@gobistories/gobi-web-integration
Advanced tools
Comparing version 1.7.1 to 1.7.2
@@ -15,2 +15,2 @@ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gobi=e():t.gobi=e()}(window,function(){return i={},o.m=n=[function(t,d,p){"use strict";(function(e){var t=p(2),n=setTimeout;function i(){}function r(t){if(!(this instanceof r))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],u(t,this)}function o(n,i){for(;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,r._immediateFn(function(){var t=1===n._state?i.onFulfilled:i.onRejected;if(null!==t){var e;try{e=t(n._value)}catch(t){return void a(i.promise,t)}s(i.promise,e)}else(1===n._state?s:a)(i.promise,n._value)})):n._deferreds.push(i)}function s(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof r)return e._state=3,e._value=t,void c(e);if("function"==typeof n)return void u(function(t,e){return function(){t.apply(e,arguments)}}(n,t),e)}e._state=1,e._value=t,c(e)}catch(t){a(e,t)}}function a(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&r._immediateFn(function(){t._handled||r._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)o(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function u(t,e){var n=!1;try{t(function(t){n||(n=!0,s(e,t))},function(t){n||(n=!0,a(e,t))})}catch(t){if(n)return;n=!0,a(e,t)}}r.prototype.catch=function(t){return this.then(null,t)},r.prototype.then=function(t,e){var n=new this.constructor(i);return o(this,new l(t,e,n)),n},r.prototype.finally=t.a,r.all=function(e){return new r(function(i,o){if(!e||void 0===e.length)throw new TypeError("Promise.all accepts an array");var r=Array.prototype.slice.call(e);if(0===r.length)return i([]);var s=r.length;function a(e,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void n.call(t,function(t){a(e,t)},o)}r[e]=t,0==--s&&i(r)}catch(t){o(t)}}for(var t=0;t<r.length;t++)a(t,r[t])})},r.resolve=function(e){return e&&"object"==typeof e&&e.constructor===r?e:new r(function(t){t(e)})},r.reject=function(n){return new r(function(t,e){e(n)})},r.race=function(o){return new r(function(t,e){for(var n=0,i=o.length;n<i;n++)o[n].then(t,e)})},r._immediateFn="function"==typeof e&&function(t){e(t)}||function(t){n(t,0)},r._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},d.a=r}).call(this,p(4).setImmediate)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";e.a=function(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}},function(t,e,n){},function(t,o,r){(function(t){var e=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}o.setTimeout=function(){return new i(n.call(setTimeout,e,arguments),clearTimeout)},o.setInterval=function(){return new i(n.call(setInterval,e,arguments),clearInterval)},o.clearTimeout=o.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(e,this._id)},o.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},o.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},o._unrefActive=o.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;0<=e&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r(5),o.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,o.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(1))},function(t,e,n){(function(t,f){!function(n,i){"use strict";if(!n.setImmediate){var o,r,e,s,a=1,c={},l=!1,u=n.document,t=Object.getPrototypeOf&&Object.getPrototypeOf(n);t=t&&t.setTimeout?t:n,o="[object process]"==={}.toString.call(n.process)?function(t){f.nextTick(function(){p(t)})}:function(){if(n.postMessage&&!n.importScripts){var t=!0,e=n.onmessage;return n.onmessage=function(){t=!1},n.postMessage("","*"),n.onmessage=e,t}}()?(s="setImmediate$"+Math.random()+"$",n.addEventListener?n.addEventListener("message",h,!1):n.attachEvent("onmessage",h),function(t){n.postMessage(s+t,"*")}):n.MessageChannel?((e=new MessageChannel).port1.onmessage=function(t){p(t.data)},function(t){e.port2.postMessage(t)}):u&&"onreadystatechange"in u.createElement("script")?(r=u.documentElement,function(t){var e=u.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):function(t){setTimeout(p,0,t)},t.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return c[a]=i,o(a),a++},t.clearImmediate=d}function d(t){delete c[t]}function p(t){if(l)setTimeout(p,0,t);else{var e=c[t];if(e){l=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(i,n)}}(e)}finally{d(t),l=!1}}}}function h(t){t.source===n&&"string"==typeof t.data&&0===t.data.indexOf(s)&&p(+t.data.slice(s.length))}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(1),n(6))},function(t,e){var n,i,o=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===r||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:r}catch(t){n=r}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var c,l=[],u=!1,d=-1;function p(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&h())}function h(){if(!u){var t=a(p);u=!0;for(var e=l.length;e;){for(c=l,l=[];++d<e;)c&&c[d].run();d=-1,e=l.length}c=null,u=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new f(t,e)),1!==l.length||u||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";n.r(e);n(3);function i(){this._eventsCallbacks={}}var o=(i.prototype.on=function(t,e){this._eventsCallbacks.hasOwnProperty(t)||(this._eventsCallbacks[t]=[]);var n=this._eventsCallbacks[t];-1===n.indexOf(e)&&n.push(e)},i.prototype.off=function(t,e){"string"==typeof t?this._eventsCallbacks.hasOwnProperty(t)&&("function"==typeof e?this._removeCallback(t,e):this._eventsCallbacks[t]=[]):this._removeAllCallbacks()},i.prototype.emit=function(t,e,n){if(this._eventsCallbacks.hasOwnProperty(t))for(var i=this._eventsCallbacks[t],o=i.length,r=0;r<o;r++)i[r].call(n||this,e)},i.prototype._removeCallback=function(t,e){var n=this._eventsCallbacks[t],i=n.indexOf(e);-1<i&&n.splice(i,1)},i.prototype._removeAllCallbacks=function(){for(var t in this._eventsCallbacks)this._eventsCallbacks.hasOwnProperty(t)&&delete this._eventsCallbacks[t]},i),s=n(0);function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function c(t,e){for(var n,i=t.length,o=0;o<i;o++)(n=t[o]).className=e+n.className}function r(o){return new s.a(function(t,e){var n=new XMLHttpRequest,i="https://live.gobiapp.com/projector/player/storyModules/"+o;n.open("GET",i,!0),n.send(),n.onload=function(){this.status<400?t(JSON.parse(this.responseText)):e(Error("Module didn't load successfully; error code:"+n.statusText))},n.onerror=function(){e(Error("There was a network error."))}})}function l(t,e){if(e){var n=[];for(var i in t){var o=t[i],r=e[i];n.push(r?a(o,r):o)}return n}return t}function u(t){return t.map(function(t){return{title:t.title,avatarSrc:t.thumbnail,description:t.description,id:t.story_id}})}function d(t,e,n){function i(t){return n(t)}return t.addEventListener(e,i),function(){return t.removeEventListener(e,i)}}var p={scrollTop:0,bodyOverflow:"",htmlOverflow:"",disable:function(){this.isIOS?this.IOSDisable():this.classicDisable()},enable:function(){this.isIOS?this.IOSEnable():this.classicEnable()},classicDisable:function(){this.bodyOverflow=document.body.style.overflow,this.htmlOverflow=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden"},classicEnable:function(){document.documentElement.style.overflow=this.htmlOverflow,document.body.style.overflow=this.bodyOverflow},IOSEnable:function(){document.documentElement.classList.remove("disabled-scroll"),document.body.classList.remove("disabled-scroll"),window.scrollTo(0,this.scrollTop)},IOSDisable:function(){this.scrollTop=window.pageYOffset,document.documentElement.classList.add("disabled-scroll"),document.body.classList.add("disabled-scroll")},isIOS:/iPad|iPhone|iPod/.test(navigator.userAgent)};function h(){return(h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function f(t){var n=this;this._defaultOptions={autoStart:!1,hideOverlay:!1,loop:!1,width:0,height:0,roundedCorners:!0,shadow:!0,checkViewPort:!0},this._eventEmitter=new o,this.on=this._eventEmitter.on.bind(this._eventEmitter),this.off=this._eventEmitter.off.bind(this._eventEmitter),this._removeIsOnScreenChecker=function(){},this._removeIsOutOfScreenChecker=function(){},this._options=h({},this._defaultOptions,t),this.el=this._createIframe(),this._options.container&&this._options.container.appendChild(this.el),window.addEventListener("message",function(t){if(n.el.contentWindow===t.source){var e=t.data;e.event&&(n._eventEmitter.emit(e.event,e.value,n),n._options.checkViewPort&&n._viewPortChecker(e.event))}})}var v=(Object.defineProperty(f.prototype,"storyUrl",{get:function(){var n={autoStart:this._options.autoStart,addLooping:this._options.loop,hideOverlay:this._options.hideOverlay,roundedCorners:this._options.roundedCorners},t=Object.keys(n).map(function(t){var e=n[t];return encodeURIComponent(t)+"="+encodeURIComponent(e)}).join("&");return"https://live.gobiapp.com/next/story/id/"+this._options.storyName+"?"+t},enumerable:!0,configurable:!0}),f.prototype.load=function(t){h(this._options,t),this.el.src=this.storyUrl},f.prototype.play=function(){this._callPlayerMethod("play")},f.prototype.pause=function(){this._callPlayerMethod("pause")},f.prototype.reload=function(){this._callPlayerMethod("reset")},f.prototype.setMute=function(t){this._callPlayerMethod("setMute",t)},f.prototype.isInViewport=function(){var t=this.el.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,i=.8*t.height,o=.8*t.width;return t.top>=0-i&&t.left>=0-o&&t.bottom<=e+i&&t.right<=n+o},f.prototype._callPlayerMethod=function(t,e){void 0===e&&(e=void 0),this._sendMessage({method:t,value:e})},f.prototype._sendMessage=function(t){var e=this.el.contentWindow;e&&e.postMessage(t,"*")},f.prototype._createIframe=function(){var t=document.createElement("iframe"),e=this._calculatePlayerSize();return t.src=this.storyUrl,t.width=e.width.toString(),t.height=e.height.toString(),t.frameBorder="0",t.scrolling="no",t.style.overflow="hidden",t.style.background="#000",t.style.border="0",this._options.shadow&&t.classList.add("gobi-player-shadow"),this._options.roundedCorners&&(t.style.borderRadius="10px"),t.setAttribute("allow","autoplay;"),t},f.prototype._viewPortChecker=function(t){switch(t){case"play":this._addIsOutOfScreenChecker();break;case"pause":this.isInViewport()&&(this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker());break;case"ended":this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker()}},f.prototype._addIsOutOfScreenChecker=function(){var t=this;this._removeIsOutOfScreenChecker(),this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker=d(window,"scroll",function(){t.isInViewport()||(t.pause(),t._removeIsOutOfScreenChecker(),t._addIsOnScreenChecker())})},f.prototype._addIsOnScreenChecker=function(){var t=this;this._removeIsOnScreenChecker=d(window,"scroll",function(){t.isInViewport()&&(t.play(),t._removeIsOnScreenChecker(),t._addIsOutOfScreenChecker())})},f.prototype._calculatePlayerSize=function(){var t=612,e=1088;return this._options.width&&this._options.height?(t=this._options.width,e=this._options.height):this._options.width?e=(t=this._options.width)/.5625:this._options.height&&(t=.5625*(e=this._options.height)),{width:t,height:e}},f),y=function(t,e){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)}; | ||
and limitations under the License. | ||
***************************************************************************** */function m(t,e){function n(){this.constructor=t}y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function _(t){var e=this;this._listeners=[],this._eventEmitter=new o,this.on=this._eventEmitter.on.bind(this._eventEmitter),this.off=this._eventEmitter.off.bind(this._eventEmitter),this._avatarSrc="",this.el=this._createTemplate(),this._elems={title:this._getElem("title"),description:this._getElem("description"),avatar:this._getElem("avatar"),avatarContainer:this._getElem("avatarContainer")},this.id=t.id,this._title=t.title||"",this._description=t.description||"",this.avatarSrc=t.avatarSrc||"",t.avatarSrc||function(r){return new s.a(function(n,i){var o=new XMLHttpRequest,t="https://live.gobiapp.com/projector/player/stories/"+r;o.open("GET",t,!0),o.send(),o.onload=function(){if(this.status<400){var t=JSON.parse(this.responseText),e=t&&t.videos&&t.videos[0]&&t.videos[0].poster;n(e)}else i(Error("Error loading avatar for story "+r+" -- "+o.statusText))},o.onerror=function(){i(Error("Error xhr-ing avatar for storyId "+r))}})}(this.id).then(function(t){e.avatarSrc=t}),this._color=t.color||"",this._addSelectEmitter(),"function"==typeof t.onSelect&&this._eventEmitter.on("select",t.onSelect),t.container&&t.container.appendChild(this.el)}var b,g=(Object.defineProperty(_.prototype,"avatarSrc",{get:function(){return this._avatarSrc},set:function(t){this._avatarSrc=t,this._elems.avatar.style.backgroundImage="url("+t+")"},enumerable:!0,configurable:!0}),_.prototype.destroy=function(){this.el.parentElement&&this.el.parentElement.removeChild(this.el),this._eventEmitter.off();for(var t=this._listeners.length;t--;)this._listeners[t]()},_.prototype._addSelectEmitter=function(){for(var t=this,e=this.el.querySelectorAll("[data-select-area]"),n=function(){t._eventEmitter.emit("select",t)},i=e.length;i--;)this._listeners.push(d(e[i],"click",n))},_.prototype._getElem=function(t){var e="data-"+t,n=this.el.querySelector("["+e+"]");if(n)return n.removeAttribute(e),n;throw new Error("Story does not contain element with name:"+t)},_);function w(t){var e=b.call(this,t)||this;if(e._selected=!1,t.titleColor&&(e._elems.title.style.color=t.titleColor),t.descriptionColor&&(e._elems.description.style.color=t.descriptionColor),t.titleSize&&(e._elems.title.style.fontSize=t.titleSize),t.descriptionSize&&(e._elems.description.style.fontSize=t.descriptionSize),t.avatarSize){var n=t.avatarSize,i="";i+=".gobi-popup-story__avatar-container {",i+=" width: "+n+";",i+=" margin: calc(0.1 * "+n+") calc(.2*"+n+") 0px calc(.2*"+n+");",i+="}",i+=".gobi-popup-module--hoverable .gobi-popup-story__avatar-container:hover {",i+=" width: calc(1.2 * "+n+");",i+=" margin: 0px calc(.1*"+n+") 0px calc(.1*"+n+");",i+="}",i+="@media all and (max-width: 767px) {",i+=" &__avatar-container {",i+=" width: "+n+";",i+=" margin: calc(0.1 * "+n+") calc(.2*"+n+") 0px calc(.2*"+n+");",i+=" }",i+=" .gobi-popup-module--hoverable &__avatar-container:hover {",i+=" width: calc(1.2 * "+n+"); // compute from bubble size",i+=" margin: 0px calc(.1*"+n+") 0px calc(.1*"+n+");",i+=" }",i+="}";var o=document.createElement("style");o.appendChild(document.createTextNode(i)),document.getElementsByTagName("head")[0].appendChild(o)}return e._selected=!!t.selected,e.title=e._title,e.description=e._description,e.color=e._color,e}var S=(m(w,b=g),Object.defineProperty(w.prototype,"title",{get:function(){return this._title},set:function(t){this._title=t,this._elems.title.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"description",{get:function(){return this._description},set:function(t){this._description=t,this._elems.description.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._elems.avatarContainer.style.borderColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"selected",{get:function(){return this._selected},set:function(t){t?this.el.classList.add("gobi-story--selected"):this.el.classList.remove("gobi-story--selected"),this._selected=t},enumerable:!0,configurable:!0}),w.prototype._createTemplate=function(){var t="gobi-story",e=document.createElement("div");return e.classList.add(t),e.innerHTML=w._HTML,c(e.querySelectorAll("*"),t+"__"),e},Object.defineProperty(w,"_HTML",{get:function(){return'<div class="avatar-container" data-select-area data-avatarContainer><div class="avatar" data-avatar></div></div><div class="title" data-title></div><div class="description" data-description></div>'},enumerable:!0,configurable:!0}),w);function O(){return(O=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function C(t){var e=this,n=O({},C._defaultOptions,t);this.el=this._createTemplate(),this._title=n.title,this.title=n.title,this._color=n.color,this._activeColor=n.activeColor,this.stories=this._createStories(n.stories,n),this._currentStory=this.stories[0],this._playerContainer=this.el.querySelector("[data-player]"),this.player=new v(O({storyName:this._currentStory.id,container:this._playerContainer},n.playerOptions)),this._playerContainer.style.maxWidth=Math.min(.53*window.innerHeight,350)+"px",window.addEventListener("resize",function(){e._playerContainer.style.maxWidth=Math.min(.53*window.innerHeight,350)+"px"}),this.currentStory=this._currentStory}var E=(Object.defineProperty(C.prototype,"title",{get:function(){return this._title},set:function(t){var e=this.el.querySelector("[data-title]");e&&(this._title=t,e.textContent=t)},enumerable:!0,configurable:!0}),Object.defineProperty(C.prototype,"currentStory",{get:function(){return this._currentStory},set:function(t){this._currentStory.color=this._color,this._currentStory.selected=!1,this._currentStory=t,this._currentStory.selected=!0,this._currentStory.color=this._activeColor,this.player.load({storyName:this._currentStory.id})},enumerable:!0,configurable:!0}),C.prototype.append=function(t){t.appendChild(this.el)},C.prototype.remove=function(){var t=this.el.parentElement;t&&t.removeChild(this.el)},C.prototype._createStories=function(t,e){var n=this,i=this.el.querySelector("[data-stories]");return t.map(function(t){return new S({id:t.id,container:i,avatarSrc:t.avatarSrc,title:t.title,description:t.description,titleColor:t.titleColor,descriptionColor:t.descriptionColor,color:n._color,titleSize:e.titleSize,avatarSize:e.avatarSize,descriptionSize:e.descriptionSize,onSelect:n._onStorySelect.bind(n)})})},C.prototype._onStorySelect=function(t){this.currentStory=t},C.prototype._createTemplate=function(){var t=document.createElement("div"),e="gobi-module";return t.classList.add(e),t.innerHTML=C._HTML,c(t.querySelectorAll("*"),e+"__"),t},Object.defineProperty(C,"_HTML",{get:function(){return'<div class="player-block"><div class="player" data-player></div></div><div class="stories-block"><div class="title" data-title></div><div class="stories" data-stories></div></div>'},enumerable:!0,configurable:!0}),C._defaultOptions={title:"",color:"",activeColor:"",playerOptions:{}},C);function T(){return(T=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function k(t){this._isOpen=!1,this._defaultOptions={classes:"",openers:""},this._eventEmitter=new o,this._listeners=[];var e=T({},this._defaultOptions,t);this.el=document.createElement("div"),this.el.className=e.classes,this.content=document.createElement("div"),this.content.className="gobi-popup__content",this.iframeContainer=document.createElement("div"),this.iframeContainer.className="gobi-popup__iframe-container",this._createTemplate(),this.player=e.player,this.appendPlayer(this.player),this.el.addEventListener("click",this._onDirectClickClose.bind(this)),this.content.addEventListener("click",this._onDirectClickClose.bind(this))}var P,j=(Object.defineProperty(k.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!0,configurable:!0}),k.prototype.appendPlayer=function(t){this.player=t,this.iframeContainer.insertBefore(this.player.el,this.iframeContainer.lastElementChild)},k.prototype.open=function(){p.disable(),this.el.style.zIndex=(function(){for(var t=document.body.querySelectorAll("*"),e=1,n=0,i=t.length;i--;)e<(n=Number(window.getComputedStyle(t[i]).zIndex))&&(e=n);return e}()+1).toString(),this.el.classList.add("gobi-popup--active"),this._listeners.push(d(window,"keyup",this._onEscapeClose.bind(this))),this._isOpen=!0,this._eventEmitter.emit("open",this,this)},k.prototype.close=function(){this.el.style.zIndex="",this.el.classList.remove("gobi-popup--active"),this.el.style.padding="",p.enable(),this._removeListeners(),this.player.pause(),this._isOpen=!1,this._eventEmitter.emit("close",this,this)},k.prototype.on=function(t,e){this._eventEmitter.on(t,e)},k.prototype.off=function(t,e){this._eventEmitter.off(t,e)},k.prototype._removeListeners=function(){for(var t=this._listeners.length;t--;)this._listeners[t]()},k.prototype._createTemplate=function(){var t=document.createElement("button");t.className="gobi-popup__close-btn",t.addEventListener("click",this.close.bind(this)),this._calculatePlayerSize(),this.iframeContainer.appendChild(t),this.content.appendChild(this.iframeContainer),this.el.classList.add("gobi-popup"),this.el.appendChild(this.content),window.addEventListener("resize",this._calculatePlayerSize.bind(this))},k.prototype._onDirectClickClose=function(t){t.target===t.currentTarget&&this.close()},k.prototype._onEscapeClose=function(t){(void 0!==t.key?"Escape"===t.key||"Esc"===t.key:27===t.keyCode)&&this.close()},k.prototype._calculatePlayerSize=function(){var t,e,n=window.innerHeight-100,i=window.innerWidth;e=.5625<i/n?(t=.5625*n,n):(t=i)/.5625,this.iframeContainer.style.width=t+"px",this.iframeContainer.style.height=e+"px"},k);function I(t){var e=P.call(this,t)||this;if(t.titleColor&&(e._elems.title.style.color=t.titleColor),t.descriptionColor&&(e._elems.description.style.color=t.descriptionColor),t.avatarSize){var n=t.avatarSize,i="";i+=".gobi-popup-story__avatar-container {",i+=" width: "+n+";",i+=" margin: calc(0.1 * "+n+") calc(.2*"+n+") 0px calc(.2*"+n+");",i+="}",i+=".gobi-popup-module--hoverable .gobi-popup-story__avatar-container:hover {",i+=" width: calc(1.2 * "+n+");",i+=" margin: 0px calc(.1*"+n+") 0px calc(.1*"+n+");",i+="}",i+="@media all and (max-width: 767px) {",i+=" &__avatar-container {",i+=" width: "+n+";",i+=" margin: calc(0.1 * "+n+") calc(.2*"+n+") 0px calc(.2*"+n+");",i+=" }",i+=" .gobi-popup-module--hoverable &__avatar-container:hover {",i+=" width: calc(1.2 * "+n+"); // compute from bubble size",i+=" margin: 0px calc(.1*"+n+") 0px calc(.1*"+n+");",i+=" }",i+="}";var o=document.createElement("style");o.appendChild(document.createTextNode(i)),document.getElementsByTagName("head")[0].appendChild(o)}return e.title=e._title,e.description=e._description,e.color=e._color,e}var x=(m(I,P=g),Object.defineProperty(I.prototype,"title",{get:function(){return this._title},set:function(t){this._title=t,this._elems.title.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(I.prototype,"description",{get:function(){return this._description},set:function(t){this._description=t,this._elems.description.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(I.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._elems.avatarContainer.style.borderColor=t},enumerable:!0,configurable:!0}),I.prototype._createTemplate=function(){var t="gobi-popup-story",e=document.createElement("div");return e.classList.add(t),e.innerHTML=I._HTML,c(e.querySelectorAll("*"),t+"__"),e},Object.defineProperty(I,"_HTML",{get:function(){return'<div class="avatar-container" data-select-area data-avatarContainer><div class="avatar" data-avatar></div></div><div class="title" data-title></div><div class="description"><div class="description-text" data-description></div></div>'},enumerable:!0,configurable:!0}),I);function L(){return(L=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function M(t){this.el=this._createTemplate(t.verticalOrientation,!!t.wrap),this._title=t.title||"",this.title=this._title,this.stories=this._createStories(t.stories,t.color,t.avatarSize),this._currentStory=this.stories[0],this.player=new v(L({storyName:this.currentStory.id,checkViewPort:!1},t.playerOptions)),this.popup=new j({player:this.player}),t.container&&this.append(t.container)}var z=(Object.defineProperty(M.prototype,"title",{get:function(){return this._title},set:function(t){var e=this.el.querySelector("[data-title]");e&&(this._title=t||"",e.textContent=this._title,e.style.display=this._title?"":"none")},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"currentStory",{get:function(){return this._currentStory},set:function(t){this._currentStory=t,this.player.load({storyName:this._currentStory.id})},enumerable:!0,configurable:!0}),M.prototype.append=function(t){document.body.appendChild(this.popup.el),t.appendChild(this.el)},M.prototype.remove=function(){var t=this.el.parentElement;t&&(document.body.removeChild(this.popup.el),t.removeChild(this.el),this.popup.close())},M.prototype._createStories=function(t,e,n){var i=this,o=this.el.querySelector("[data-stories]");return t.map(function(t){return new x({id:t.id,container:o,avatarSrc:t.avatarSrc,title:t.title,description:t.description,titleColor:t.titleColor,descriptionColor:t.descriptionColor,color:e,avatarSize:n,onSelect:i._onStorySelect.bind(i)})})},M.prototype._onStorySelect=function(t){this.currentStory=t,this.popup.open()},M.prototype._createTemplate=function(t,e){void 0===t&&(t=!1);var n=document.createElement("div"),i="gobi-popup-module";n.classList.add(i),n.classList.add(i+"--hoverable"),n.innerHTML=M._HTML,c(n.querySelectorAll("*"),i+"__");var o=n.lastElementChild;function r(){n.classList.remove(i+"--hoverable"),s()}function s(){window.removeEventListener("touchstart",r),window.removeEventListener("mousemove",s)}return t?o.classList.add(i+"__stories--vertical"):o.classList.add(i+"__stories--horizontal"),e||o.classList.add(i+"__stories--no-wrap"),("ontouchstart"in window||navigator.maxTouchPoints)&&(window.addEventListener("touchstart",r),window.addEventListener("mousemove",s)),n},Object.defineProperty(M,"_HTML",{get:function(){return'<div class="title" data-title></div>\n <div class="stories" data-stories></div>'},enumerable:!0,configurable:!0}),M);function H(){return(H=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function A(t){this.load(t)}var N=(A.prototype.load=function(s){var a=this;r(s.moduleId).then(function(t){var e=H({},A._defaultOptions,s),n=e.container,i=l(u(t),e.stories),o=window.innerWidth<768,r=a._initModules(e,i);window.innerWidth<768&&r.mobile.append(n),767<window.innerWidth&&r.desktop.append(n),window.addEventListener("resize",function(){window.innerWidth<768&&!o&&(r.desktop.remove(),r.mobile.append(n),o=!0),767<window.innerWidth&&o&&(r.mobile.remove(),r.desktop.append(n),o=!1)})})},A.prototype._initModules=function(t,e){return{desktop:new E({title:t.title,color:t.color,activeColor:t.activeColor,stories:e,playerOptions:t.playerOptions,titleSize:t.desktopStoryStyle.titleSize,avatarSize:t.desktopStoryStyle.avatarSize,descriptionSize:t.desktopStoryStyle.descriptionSize}),mobile:new z({title:t.title,color:t.activeColor,stories:e,playerOptions:t.playerOptions})}},A._defaultOptions={title:"",color:"#999999",activeColor:"#15d6ea",stories:[],desktopStoryStyle:{}},A);function q(t){this.load(t)}var F=(q.prototype.load=function(n){r(n.moduleId).then(function(t){var e=l(u(t),n.stories);new z({verticalOrientation:n.verticalOrientation,wrap:n.wrap,title:n.title,color:n.color,avatarSize:n.avatarSize,stories:e,playerOptions:n.playerOptions,container:n.container})})},q);n.d(e,"Module",function(){return W}),n.d(e,"Player",function(){return R}),n.d(e,"MobileModule",function(){return D}),n.d(e,"MobileLayout",function(){return V});var W=N,R=v,D=F,V=z}],o.c=i,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=7);function o(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var n,i}); | ||
***************************************************************************** */function m(t,e){function n(){this.constructor=t}y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function _(t){var e=this;this._listeners=[],this._eventEmitter=new o,this.on=this._eventEmitter.on.bind(this._eventEmitter),this.off=this._eventEmitter.off.bind(this._eventEmitter),this._avatarSrc="",this.el=this._createTemplate(),this._elems={title:this._getElem("title"),description:this._getElem("description"),avatar:this._getElem("avatar"),avatarContainer:this._getElem("avatarContainer")},this.id=t.id,this._title=t.title||"",this._description=t.description||"",this.avatarSrc=t.avatarSrc||"",t.avatarSrc||function(r){return new s.a(function(n,i){var o=new XMLHttpRequest,t="https://live.gobiapp.com/projector/player/stories/"+r;o.open("GET",t,!0),o.send(),o.onload=function(){if(this.status<400){var t=JSON.parse(this.responseText),e=t&&t.videos&&t.videos[0]&&t.videos[0].poster;n(e)}else i(Error("Error loading avatar for story "+r+" -- "+o.statusText))},o.onerror=function(){i(Error("Error xhr-ing avatar for storyId "+r))}})}(this.id).then(function(t){e.avatarSrc=t}),this._color=t.color||"",this._addSelectEmitter(),"function"==typeof t.onSelect&&this._eventEmitter.on("select",t.onSelect),t.container&&t.container.appendChild(this.el)}var b,g=(Object.defineProperty(_.prototype,"avatarSrc",{get:function(){return this._avatarSrc},set:function(t){this._avatarSrc=t,this._elems.avatar.style.backgroundImage="url("+t+")"},enumerable:!0,configurable:!0}),_.prototype.destroy=function(){this.el.parentElement&&this.el.parentElement.removeChild(this.el),this._eventEmitter.off();for(var t=this._listeners.length;t--;)this._listeners[t]()},_.prototype._addSelectEmitter=function(){for(var t=this,e=this.el.querySelectorAll("[data-select-area]"),n=function(){t._eventEmitter.emit("select",t)},i=e.length;i--;)this._listeners.push(d(e[i],"click",n))},_.prototype._getElem=function(t){var e="data-"+t,n=this.el.querySelector("["+e+"]");if(n)return n.removeAttribute(e),n;throw new Error("Story does not contain element with name:"+t)},_);function w(t){var e=b.call(this,t)||this;if(e._selected=!1,t.titleColor&&(e._elems.title.style.color=t.titleColor),t.descriptionColor&&(e._elems.description.style.color=t.descriptionColor),t.titleSize&&(e._elems.title.style.fontSize=t.titleSize),t.descriptionSize&&(e._elems.description.style.fontSize=t.descriptionSize),t.avatarSize){var n=t.avatarSize,i="";i+=".gobi-popup-story__avatar-container {",i+=" width: "+n+";",i+=" margin: calc(0.1 * "+n+") calc(.2*"+n+");",i+="}",i+=".gobi-popup-module--hoverable .gobi-popup-story__avatar-container:hover {",i+=" width: calc(1.2 * "+n+");",i+=" margin: 0px calc(.1*"+n+");",i+="}",i+="@media all and (max-width: 767px) {",i+=" &__avatar-container {",i+=" width: "+n+";",i+=" margin: calc(0.1 * "+n+") calc(.2*"+n+");",i+=" }",i+=" .gobi-popup-module--hoverable &__avatar-container:hover {",i+=" width: calc(1.2 * "+n+"); // compute from bubble size",i+=" margin: 0px calc(.1*"+n+");",i+=" }",i+="}";var o=document.createElement("style");o.appendChild(document.createTextNode(i)),document.getElementsByTagName("head")[0].appendChild(o)}return e._selected=!!t.selected,e.title=e._title,e.description=e._description,e.color=e._color,e}var S=(m(w,b=g),Object.defineProperty(w.prototype,"title",{get:function(){return this._title},set:function(t){this._title=t,this._elems.title.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"description",{get:function(){return this._description},set:function(t){this._description=t,this._elems.description.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._elems.avatarContainer.style.borderColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"selected",{get:function(){return this._selected},set:function(t){t?this.el.classList.add("gobi-story--selected"):this.el.classList.remove("gobi-story--selected"),this._selected=t},enumerable:!0,configurable:!0}),w.prototype._createTemplate=function(){var t="gobi-story",e=document.createElement("div");return e.classList.add(t),e.innerHTML=w._HTML,c(e.querySelectorAll("*"),t+"__"),e},Object.defineProperty(w,"_HTML",{get:function(){return'<div class="avatar-container" data-select-area data-avatarContainer><div class="avatar" data-avatar></div></div><div class="title" data-title></div><div class="description" data-description></div>'},enumerable:!0,configurable:!0}),w);function O(){return(O=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function C(t){var e=this,n=O({},C._defaultOptions,t);this.el=this._createTemplate(),this._title=n.title,this.title=n.title,this._color=n.color,this._activeColor=n.activeColor,this.stories=this._createStories(n.stories,n),this._currentStory=this.stories[0],this._playerContainer=this.el.querySelector("[data-player]"),this.player=new v(O({storyName:this._currentStory.id,container:this._playerContainer},n.playerOptions)),this._playerContainer.style.maxWidth=Math.min(.53*window.innerHeight,350)+"px",window.addEventListener("resize",function(){e._playerContainer.style.maxWidth=Math.min(.53*window.innerHeight,350)+"px"}),this.currentStory=this._currentStory}var E=(Object.defineProperty(C.prototype,"title",{get:function(){return this._title},set:function(t){var e=this.el.querySelector("[data-title]");e&&(this._title=t,e.textContent=t)},enumerable:!0,configurable:!0}),Object.defineProperty(C.prototype,"currentStory",{get:function(){return this._currentStory},set:function(t){this._currentStory.color=this._color,this._currentStory.selected=!1,this._currentStory=t,this._currentStory.selected=!0,this._currentStory.color=this._activeColor,this.player.load({storyName:this._currentStory.id})},enumerable:!0,configurable:!0}),C.prototype.append=function(t){t.appendChild(this.el)},C.prototype.remove=function(){var t=this.el.parentElement;t&&t.removeChild(this.el)},C.prototype._createStories=function(t,e){var n=this,i=this.el.querySelector("[data-stories]");return t.map(function(t){return new S({id:t.id,container:i,avatarSrc:t.avatarSrc,title:t.title,description:t.description,titleColor:t.titleColor,descriptionColor:t.descriptionColor,color:n._color,titleSize:e.titleSize,avatarSize:e.avatarSize,descriptionSize:e.descriptionSize,onSelect:n._onStorySelect.bind(n)})})},C.prototype._onStorySelect=function(t){this.currentStory=t},C.prototype._createTemplate=function(){var t=document.createElement("div"),e="gobi-module";return t.classList.add(e),t.innerHTML=C._HTML,c(t.querySelectorAll("*"),e+"__"),t},Object.defineProperty(C,"_HTML",{get:function(){return'<div class="player-block"><div class="player" data-player></div></div><div class="stories-block"><div class="title" data-title></div><div class="stories" data-stories></div></div>'},enumerable:!0,configurable:!0}),C._defaultOptions={title:"",color:"",activeColor:"",playerOptions:{}},C);function T(){return(T=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function k(t){this._isOpen=!1,this._defaultOptions={classes:"",openers:""},this._eventEmitter=new o,this._listeners=[];var e=T({},this._defaultOptions,t);this.el=document.createElement("div"),this.el.className=e.classes,this.content=document.createElement("div"),this.content.className="gobi-popup__content",this.iframeContainer=document.createElement("div"),this.iframeContainer.className="gobi-popup__iframe-container",this._createTemplate(),this.player=e.player,this.appendPlayer(this.player),this.el.addEventListener("click",this._onDirectClickClose.bind(this)),this.content.addEventListener("click",this._onDirectClickClose.bind(this))}var P,j=(Object.defineProperty(k.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!0,configurable:!0}),k.prototype.appendPlayer=function(t){this.player=t,this.iframeContainer.insertBefore(this.player.el,this.iframeContainer.lastElementChild)},k.prototype.open=function(){p.disable(),this.el.style.zIndex=(function(){for(var t=document.body.querySelectorAll("*"),e=1,n=0,i=t.length;i--;)e<(n=Number(window.getComputedStyle(t[i]).zIndex))&&(e=n);return e}()+1).toString(),this.el.classList.add("gobi-popup--active"),this._listeners.push(d(window,"keyup",this._onEscapeClose.bind(this))),this._isOpen=!0,this._eventEmitter.emit("open",this,this)},k.prototype.close=function(){this.el.style.zIndex="",this.el.classList.remove("gobi-popup--active"),this.el.style.padding="",p.enable(),this._removeListeners(),this.player.pause(),this._isOpen=!1,this._eventEmitter.emit("close",this,this)},k.prototype.on=function(t,e){this._eventEmitter.on(t,e)},k.prototype.off=function(t,e){this._eventEmitter.off(t,e)},k.prototype._removeListeners=function(){for(var t=this._listeners.length;t--;)this._listeners[t]()},k.prototype._createTemplate=function(){var t=document.createElement("button");t.className="gobi-popup__close-btn",t.addEventListener("click",this.close.bind(this)),this._calculatePlayerSize(),this.iframeContainer.appendChild(t),this.content.appendChild(this.iframeContainer),this.el.classList.add("gobi-popup"),this.el.appendChild(this.content),window.addEventListener("resize",this._calculatePlayerSize.bind(this))},k.prototype._onDirectClickClose=function(t){t.target===t.currentTarget&&this.close()},k.prototype._onEscapeClose=function(t){(void 0!==t.key?"Escape"===t.key||"Esc"===t.key:27===t.keyCode)&&this.close()},k.prototype._calculatePlayerSize=function(){var t,e,n=window.innerHeight-100,i=window.innerWidth;e=.5625<i/n?(t=.5625*n,n):(t=i)/.5625,this.iframeContainer.style.width=t+"px",this.iframeContainer.style.height=e+"px"},k);function I(t){var e=P.call(this,t)||this;if(t.titleColor&&(e._elems.title.style.color=t.titleColor),t.descriptionColor&&(e._elems.description.style.color=t.descriptionColor),t.avatarSize){var n=t.avatarSize,i="";i+=".gobi-popup-story__avatar-container {",i+=" width: "+n+";",i+=" margin: calc(0.1 * "+n+") calc(.2*"+n+");",i+="}",i+=".gobi-popup-module--hoverable .gobi-popup-story__avatar-container:hover {",i+=" width: calc(1.2 * "+n+");",i+=" margin: 0px calc(.1*"+n+");",i+="}",i+="@media all and (max-width: 767px) {",i+=" &__avatar-container {",i+=" width: "+n+";",i+=" margin: calc(0.1 * "+n+") calc(.2*"+n+");",i+=" }",i+=" .gobi-popup-module--hoverable &__avatar-container:hover {",i+=" width: calc(1.2 * "+n+"); // compute from bubble size",i+=" margin: 0px calc(.1*"+n+");",i+=" }",i+="}";var o=document.createElement("style");o.appendChild(document.createTextNode(i)),document.getElementsByTagName("head")[0].appendChild(o)}return e.title=e._title,e.description=e._description,e.color=e._color,e}var L=(m(I,P=g),Object.defineProperty(I.prototype,"title",{get:function(){return this._title},set:function(t){this._title=t,this._elems.title.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(I.prototype,"description",{get:function(){return this._description},set:function(t){this._description=t,this._elems.description.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(I.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._elems.avatarContainer.style.borderColor=t},enumerable:!0,configurable:!0}),I.prototype._createTemplate=function(){var t="gobi-popup-story",e=document.createElement("div");return e.classList.add(t),e.innerHTML=I._HTML,c(e.querySelectorAll("*"),t+"__"),e},Object.defineProperty(I,"_HTML",{get:function(){return'<div class="avatar-container" data-select-area data-avatarContainer><div class="avatar" data-avatar></div></div><div class="title" data-title></div><div class="description"><div class="description-text" data-description></div></div>'},enumerable:!0,configurable:!0}),I);function x(){return(x=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function M(t){this.el=this._createTemplate(t.verticalOrientation,!!t.wrap),this._title=t.title||"",this.title=this._title,this.stories=this._createStories(t.stories,t.color,t.avatarSize),this._currentStory=this.stories[0],this.player=new v(x({storyName:this.currentStory.id,checkViewPort:!1},t.playerOptions)),this.popup=new j({player:this.player}),t.container&&this.append(t.container)}var z=(Object.defineProperty(M.prototype,"title",{get:function(){return this._title},set:function(t){var e=this.el.querySelector("[data-title]");e&&(this._title=t||"",e.textContent=this._title,e.style.display=this._title?"":"none")},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"currentStory",{get:function(){return this._currentStory},set:function(t){this._currentStory=t,this.player.load({storyName:this._currentStory.id})},enumerable:!0,configurable:!0}),M.prototype.append=function(t){document.body.appendChild(this.popup.el),t.appendChild(this.el)},M.prototype.remove=function(){var t=this.el.parentElement;t&&(document.body.removeChild(this.popup.el),t.removeChild(this.el),this.popup.close())},M.prototype._createStories=function(t,e,n){var i=this,o=this.el.querySelector("[data-stories]");return t.map(function(t){return new L({id:t.id,container:o,avatarSrc:t.avatarSrc,title:t.title,description:t.description,titleColor:t.titleColor,descriptionColor:t.descriptionColor,color:e,avatarSize:n,onSelect:i._onStorySelect.bind(i)})})},M.prototype._onStorySelect=function(t){this.currentStory=t,this.popup.open()},M.prototype._createTemplate=function(t,e){void 0===t&&(t=!1);var n=document.createElement("div"),i="gobi-popup-module";n.classList.add(i),n.classList.add(i+"--hoverable"),n.innerHTML=M._HTML,c(n.querySelectorAll("*"),i+"__");var o=n.lastElementChild;function r(){n.classList.remove(i+"--hoverable"),s()}function s(){window.removeEventListener("touchstart",r),window.removeEventListener("mousemove",s)}return t?o.classList.add(i+"__stories--vertical"):o.classList.add(i+"__stories--horizontal"),e||o.classList.add(i+"__stories--no-wrap"),("ontouchstart"in window||navigator.maxTouchPoints)&&(window.addEventListener("touchstart",r),window.addEventListener("mousemove",s)),n},Object.defineProperty(M,"_HTML",{get:function(){return'<div class="title" data-title></div>\n <div class="stories" data-stories></div>'},enumerable:!0,configurable:!0}),M);function H(){return(H=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function A(t){this.load(t)}var N=(A.prototype.load=function(s){var a=this;r(s.moduleId).then(function(t){var e=H({},A._defaultOptions,s),n=e.container,i=l(u(t),e.stories),o=window.innerWidth<768,r=a._initModules(e,i);window.innerWidth<768&&r.mobile.append(n),767<window.innerWidth&&r.desktop.append(n),window.addEventListener("resize",function(){window.innerWidth<768&&!o&&(r.desktop.remove(),r.mobile.append(n),o=!0),767<window.innerWidth&&o&&(r.mobile.remove(),r.desktop.append(n),o=!1)})})},A.prototype._initModules=function(t,e){return{desktop:new E({title:t.title,color:t.color,activeColor:t.activeColor,stories:e,playerOptions:t.playerOptions,titleSize:t.desktopStoryStyle.titleSize,avatarSize:t.desktopStoryStyle.avatarSize,descriptionSize:t.desktopStoryStyle.descriptionSize}),mobile:new z({title:t.title,color:t.activeColor,stories:e,playerOptions:t.playerOptions})}},A._defaultOptions={title:"",color:"#999999",activeColor:"#15d6ea",stories:[],desktopStoryStyle:{}},A);function q(t){this.load(t)}var F=(q.prototype.load=function(n){r(n.moduleId).then(function(t){var e=l(u(t),n.stories);new z({verticalOrientation:n.verticalOrientation,wrap:n.wrap,title:n.title,color:n.color,avatarSize:n.avatarSize,stories:e,playerOptions:n.playerOptions,container:n.container})})},q);n.d(e,"Module",function(){return W}),n.d(e,"Player",function(){return R}),n.d(e,"MobileModule",function(){return D}),n.d(e,"MobileLayout",function(){return V});var W=N,R=v,D=F,V=z}],o.c=i,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=7);function o(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var n,i}); |
{ | ||
"name": "@gobistories/gobi-web-integration", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/gobi-web-integration.js", |
@@ -62,7 +62,7 @@ import {addPrefixToClassName} from "@/utils/utils"; | ||
css += ' width: ' + s + ';'; | ||
css += ' margin: calc(0.1 * ' + s + ') calc(.2*' + s + ') 0px calc(.2*' + s + ');'; | ||
css += ' margin: calc(0.1 * ' + s + ') calc(.2*' + s + ');'; | ||
css += '}'; | ||
css += '.gobi-popup-module--hoverable .gobi-popup-story__avatar-container:hover {'; | ||
css += ' width: calc(1.2 * ' + s + ');'; | ||
css += ' margin: 0px calc(.1*' + s + ') 0px calc(.1*' + s + ');'; | ||
css += ' margin: 0px calc(.1*' + s + ');'; | ||
css += '}'; | ||
@@ -72,7 +72,7 @@ css += '@media all and (max-width: 767px) {'; | ||
css += ' width: ' + s + ';'; | ||
css += ' margin: calc(0.1 * ' + s + ') calc(.2*' + s + ') 0px calc(.2*' + s + ');'; | ||
css += ' margin: calc(0.1 * ' + s + ') calc(.2*' + s + ');'; | ||
css += ' }'; | ||
css += ' .gobi-popup-module--hoverable &__avatar-container:hover {'; | ||
css += ' width: calc(1.2 * ' + s + '); // compute from bubble size'; | ||
css += ' margin: 0px calc(.1*' + s + ') 0px calc(.1*' + s + ');'; | ||
css += ' margin: 0px calc(.1*' + s + ');'; | ||
css += ' }'; | ||
@@ -79,0 +79,0 @@ css += '}'; |
@@ -41,7 +41,7 @@ import {addPrefixToClassName} from "@/utils/utils"; | ||
css += ' width: ' + s + ';'; | ||
css += ' margin: calc(0.1 * ' + s + ') calc(.2*' + s + ') 0px calc(.2*' + s + ');'; | ||
css += ' margin: calc(0.1 * ' + s + ') calc(.2*' + s + ');'; | ||
css += '}'; | ||
css += '.gobi-popup-module--hoverable .gobi-popup-story__avatar-container:hover {'; | ||
css += ' width: calc(1.2 * ' + s + ');'; | ||
css += ' margin: 0px calc(.1*' + s + ') 0px calc(.1*' + s + ');'; | ||
css += ' margin: 0px calc(.1*' + s + ');'; | ||
css += '}'; | ||
@@ -51,7 +51,7 @@ css += '@media all and (max-width: 767px) {'; | ||
css += ' width: ' + s + ';'; | ||
css += ' margin: calc(0.1 * ' + s + ') calc(.2*' + s + ') 0px calc(.2*' + s + ');'; | ||
css += ' margin: calc(0.1 * ' + s + ') calc(.2*' + s + ');'; | ||
css += ' }'; | ||
css += ' .gobi-popup-module--hoverable &__avatar-container:hover {'; | ||
css += ' width: calc(1.2 * ' + s + '); // compute from bubble size'; | ||
css += ' margin: 0px calc(.1*' + s + ') 0px calc(.1*' + s + ');'; | ||
css += ' margin: 0px calc(.1*' + s + ');'; | ||
css += ' }'; | ||
@@ -58,0 +58,0 @@ css += '}'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
133618