{"version":3,"sources":["webpack:////Users/owenli/Documents/workspace/awi-wlc-fe/src/views/blocks/videoModalBlock/js/videoModalBlock.js","webpack:////Users/owenli/Documents/workspace/awi-wlc-fe/src/views/widgets/dashboardNotificationItemWidget/js/dashboardNotificationItemWidget.js","webpack:////Users/owenli/Documents/workspace/awi-wlc-fe/src/views/widgets/dashboardNotificationsWidget/js/dashboardNotificationsWidget.js"],"names":["CLS","VideoModalBlock","element","_classCallCheck","this","$element","$","$modal","find","$iframe","$videoContainer","concat","videoType","data","videoSrcId","videoLocalSrc","addClass","initVideo","key","value","_this","on","length","embedLink","utils","VID_TYPE","youku","modal","attr","$video","play","removeAttr","pause","currentTime","DashboardNotificationItemWidget","_createClass","closeBtn","id","notificationReadApi","fadeOut","ajax","type","url","dataType","success","remove","DashboardNotificationsWidget","api","response","notifications","html","getDashboardNotificationsWidgetMarkup","each","_index","_this2","notificationsMarkup","forEach","notification","getDashboardNotificationItemWidgetMarkup","_this3","_","isNil","VideoSrcId","Id","getVideoModalBlock","Summary","DatePublished","Title"],"mappings":"+4BAAA,IACMA,EAAM,kBAICC,EAAe,WAc1B,SAbD,SAAAA,EAAYC,gGAASC,CAAAC,KAAAH,GACpBG,KAAKF,QAAUA,EACfE,KAAKC,SAAWC,EAAEJ,GAClBE,KAAKG,OAASH,KAAKC,SAASG,KAAI,UAChCJ,KAAKK,QAAUL,KAAKG,OAAOC,KAAK,sBAChCJ,KAAKM,gBAAkBN,KAAKC,SAASG,KAAI,IAAAG,OAAKX,EAAG,oBAEjDI,KAAKQ,UAAYR,KAAKC,SAASQ,KAAK,aACpCT,KAAKU,WAAaV,KAAKC,SAASQ,KAAK,cACrCT,KAAKW,cAAgBX,KAAKC,SAASQ,KAAK,iBAExCT,KAAKG,OAAOS,SAAS,gBACrBZ,KAAKa,kBACLC,IAAA,YAAAC,MAED,WAAY,IAAAC,EAAAhB,KACXA,KAAKM,gBAAgBW,GAAG,QAAS,WAGhC,GAAGD,EAAKN,WAAY,CACnB,G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AaS,cAAa,UAEzG,GACJ,wJAMPhD,IAAA,qBAAAC,MAGA,SAAmBL,GAClB,oFAAAH,OAAqFG,EAAU,8MAAAH,OAEMG,EAAU,+7BAAAH,OAejEG,EAAU,4OAlHjB","file":"widget-3.2f662a3aa586e55a56ca.js","sourcesContent":["const NS = 'VideoModalBlock';\nconst CLS = 'videoModalBlock';\n\nimport { utils } from '../../../../global/js/utils';\n\nexport class VideoModalBlock {\n\tconstructor(element) {\n\t\tthis.element = element;\n\t\tthis.$element = $(element);\n\t\tthis.$modal = this.$element.find(`.modal`);\n\t\tthis.$iframe = this.$modal.find('.videoBlock-iframe');\n\t\tthis.$videoContainer = this.$element.find(`.${CLS}-videoContainer`);\n\n\t\tthis.videoType = this.$element.data('videoType');\n\t\tthis.videoSrcId = this.$element.data('videoSrcId');\n\t\tthis.videoLocalSrc = this.$element.data('videoLocalSrc');\n\n\t\tthis.$modal.addClass('modal--black');\n\t\tthis.initVideo();\n\t}\n\n\tinitVideo() {\n\t\tthis.$videoContainer.on('click', () => {\n\t\t\t\n\t\t\t// Embed\n\t\t\tif(this.videoSrcId) {\n\t\t\t\tif (this.$iframe.length === 0) return;\n\t\t\t\tlet embedLink = '';\n\n\t\t\t\tswitch (this.videoType) {\n\t\t\t\t\tcase utils.VID_TYPE.youku:\n\t\t\t\t\t\tembedLink = `https://player.youku.com/embed/${this.videoSrcId}?autoplay=0&rel=0`;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// set default as youtube\n\t\t\t\t\t\tembedLink = `https://www.youtube.com/embed/${this.videoSrcId}?autoplay=0&showinfo=0&controls=0&rel=0`;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis.$modal.modal('show');\n\t\t\t\t$('.modal-backdrop').addClass('modal-backdrop--black');\n\t\t\t\tthis.$iframe.attr('src', embedLink);\n\t\t\t}\n\t\t\t// Local file\n\t\t\telse if(this.videoLocalSrc) {\n\t\t\t\tthis.$modal.modal('show');\n\t\t\t\tlet $video = this.$modal.find('video');\n\t\t\t\t$('.modal-backdrop').addClass('modal-backdrop--black');\n\n\t\t\t\t$video[0].play();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.error(`${NS}::Error`, 'Please supply a video-src-id or a video-local-src value to load a video on the modal.');\n\t\t\t}\n\t\t});\n\n\t\tthis.$modal.on('hidden.bs.modal', () => {\n\t\t\t// Embed\n\t\t\tif(this.videoSrcId) {\n\t\t\t\tthis.$iframe.removeAttr('src');\n\t\t\t}\n\t\t\t// Local File\n\t\t\telse if(this.videoLocalSrc) {\n\t\t\t\tlet $video = this.$modal.find('video');\n\t\t\t\t$video[0].pause();\n\t\t\t\t$video[0].currentTime = 0;\n\t\t\t}\n\t\t});\n\t}\n}\n","const NS = 'DashboardNotificationItemWidget';\nconst CLS = 'dashboardNotificationItemWidget';\n\nexport class DashboardNotificationItemWidget {\n\tconstructor(element) {\n\t\tthis.element = element;\n\t\tthis.$element = $(element);\n\t\tlet closeBtn = this.$element.find(`.${CLS}-close`);\n\t\tthis.id = this.$element.data('id');\n\t\tthis.notificationReadApi = this.$element.data('notificationReadApi');\n\n\t\tcloseBtn.on('click', () => {\n\t\t\tthis.$element.fadeOut(400, () => {\n\t\t\t\t$.ajax({\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\turl: `${this.notificationReadApi}/${this.id}`,\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\tsuccess: () => {\n\t\t\t\t\t\tthis.$element.remove();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n}\n","const NS = 'DashboardNotificationsWidget';\nconst CLS = 'dashboardNotificationsWidget';\n\nimport { DashboardNotificationItemWidget } from '../../dashboardNotificationItemWidget/js/dashboardNotificationItemWidget';\nimport { VideoModalBlock } from '../../../blocks/videoModalBlock/js/videoModalBlock';\n\nexport class DashboardNotificationsWidget {\n\tconstructor(element) {\n\t\tthis.element = element;\n\t\tthis.$element = $(element);\n\t\tthis.api = this.$element.data('api');\n\t\tthis.notificationReadApi = this.$element.data('notificationReadApi');\n\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: this.api,\n\t\t\tdataType: 'json',\n\t\t\tsuccess: (response) => {\n\t\t\t\tlet notifications = response;\n\n\t\t\t\tif(notifications && notifications.length > 0) {\n\t\t\t\t\tthis.$element.html(this.getDashboardNotificationsWidgetMarkup(notifications));\n\n\t\t\t\t\t// Instantiate dashboardNotificationItemWidget\n\t\t\t\t\tthis.$element.find('[data-wg=\"DashboardNotificationItemWidget\"]').each((_index, element) => {\n\t\t\t\t\t\tnew DashboardNotificationItemWidget(element);\n\t\t\t\t\t\tnew VideoModalBlock($(element).find('[data-blk=\"VideoModalBlock\"]'));\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.$element.html(null);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Iteration of dashboardNotificationItemWidget\n\t */\n\tgetDashboardNotificationsWidgetMarkup(notifications) {\n\t\tlet notificationsMarkup = '';\n\t\tnotifications.forEach((notification) => {\n\t\t\tnotificationsMarkup += this.getDashboardNotificationItemWidgetMarkup(notification);\n\t\t});\n\t\treturn notificationsMarkup;\n\t}\n\n\t/**\n\t * Markup is found in dashboardNotificationItemWidget\n\t */\n\tgetDashboardNotificationItemWidgetMarkup(notification) {\n\t\treturn `
\n\t\t\t ${(() => {\n\t\t\t\tif(notification.VideoSrcId) {\n\t\t\t\t\treturn `
\n\t\t\t\t\t\t${this.getVideoModalBlock(notification.VideoSrcId)}\n\t\t\t\t\t
`;\n\t\t\t\t}\n\t\t\t\telse if(!(_.isNil(notification.Summary) && _.isNil(notification.DatePublished))) {\n\t\t\t\t\treturn `
\n\t\t\t\t\t\t\n\t\t\t\t\t
`;\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t})()}\n\t\t\t
\n\t\t\t\t${(() => {\n\t\t\t\t\tif(notification.Title) {\n\t\t\t\t\t\treturn `
\n\t\t\t\t\t\t\t${notification.Title}\n\t\t\t\t\t\t
`;\n\t\t\t\t\t}\n\t\t\t\t\treturn '';\n\t\t\t\t})()}\n\t\t\t\t${(() => {\n\t\t\t\t\tif(notification.Summary) {\n\t\t\t\t\t\treturn `
\n\t\t\t\t\t\t\t${notification.Summary}\n\t\t\t\t\t\t
`;\n\t\t\t\t\t}\n\t\t\t\t\treturn '';\n\t\t\t\t})()}\n\t\t\t
\n\t\t\t
\n\t\t\t\t${(() => {\n\t\t\t\t\tif(notification.DatePublished) {\n\t\t\t\t\t\treturn `
${notification.DatePublished}
`;\n\t\t\t\t\t}\n\t\t\t\t\treturn '';\n\t\t\t\t})()}\n\t\t\t\t\n\t\t\t
\n\t\t
`;\n\t}\n\n\t/**\n\t * Markup is found in videoModalBlock\n\t */\n\tgetVideoModalBlock(videoSrcId) {\n\t\treturn `
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
`;\n\t}\n}\n"],"sourceRoot":""}