@inappstory/js-sdk 3.8.3 → 3.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.mjs +8 -8
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/appearance-manager/gameReader.d.ts +7 -2
- package/dist/types/appearance-manager/sharePanel.d.ts +12 -0
- package/dist/types/appearance-manager/storyReader.d.ts +1 -1
- package/dist/types/in-app-messaging/inAppMessaging.d.ts +7 -2
- package/dist/types/inAppStoryManager.d.ts +7 -4
- package/package.json +2 -2
- package/plugins/banners/index.esm.mjs +1 -1
- package/plugins/dotLottie/iasDotLottiePlugin.umd.js +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom"));else if("function"==typeof define&&define.amd)define(["@inappstory/react-sdk","react/jsx-runtime","react-dom/client","react","react-dom"],t);else{var r="object"==typeof exports?t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom")):t(e["@inappstory/react-sdk"],e["react/jsx-runtime"],e["react-dom/client"],e.react,e["react-dom"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o)=>(()=>{var a={432:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(935),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".favorite-story-list-modal--xWjHA{position:fixed;inset:0px;z-index:1090}.favorite-story-list-modal--xWjHA .container--GZBjv{width:100%;height:100%;background:var(--storiesFavoriteBackgroundColor, #333333);display:flex;flex-direction:column;position:relative;overflow-y:auto}.favorite-story-list-modal--xWjHA .header--TjHMD{display:flex;align-content:center;justify-content:center;align-items:center;flex-shrink:0;position:-webkit-sticky;position:sticky;top:0;z-index:100;background:var(--storiesFavoriteTitleBackgroundColor, #333333);box-shadow:0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12),0 1px 3px 0 rgba(0,0,0,.2);padding-top:var(--storiesFavoriteHeaderTopOffset, 0px);margin-bottom:25px}.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:1rem;margin-bottom:1rem;font-size:1.2em;color:var(--storiesFavoriteTitleColor, white);font-family:var(--storiesFavoriteTitleFontFamily);font-weight:normal;font-size:1.4rem;line-height:normal;font:var(--storiesFavoriteTitleFont, normal)}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:25px;margin-bottom:25px}}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD{margin-bottom:50px}}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:50%;transform:translateY(-50%);z-index:1140;pointer-events:all;cursor:pointer;outline:none;right:10px;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-:focus{outline:none}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm- svg{overflow:visible}.favorite-story-list-modal--xWjHA .footer--edEpn{width:100%;height:25px}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .footer--edEpn{height:50px}}.favorite-story-list-modal--xWjHA .bottom-offset--baiTh{position:-webkit-sticky;position:sticky;z-index:100;background:inherit;bottom:0;width:100%;height:var(--storiesFavoriteBottomOffset, 0px)}.favorite-story-list-modal--xWjHA .content--qCPkX{display:flex;justify-content:center;width:100%;padding:0 25px 25px;box-sizing:border-box}.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{width:100%}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:640px}}@media(min-width: 768px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:768px}}@media(min-width: 1024px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1024px}}@media(min-width: 1280px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1280px}}",""]),o.locals={"favorite-story-list-modal":"favorite-story-list-modal--xWjHA",container:"container--GZBjv",header:"header--TjHMD",title:"title--Dk04x","header__close-btn":"header__close-btn--Jojm-",footer:"footer--edEpn","bottom-offset":"bottom-offset--baiTh",content:"content--qCPkX","favorite-story-list":"favorite-story-list--MISMx"};const a=o},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var c=[].concat(e[s]);n&&o[c[0]]||(r&&(c[2]?c[2]="".concat(r," and ").concat(c[2]):c[2]=r),t.push(c))}},t}},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var o,a,i,l;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),i=a[t]),void 0===i)i=a[t]=r,++e._eventsCount;else if("function"==typeof i?i=a[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=c(e))>0&&i.length>o&&!i.warned){i.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=i.length,l=d,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=d.bind(n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){n.once&&e.removeEventListener(t,o),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,d=h(c,l);for(r=0;r<l;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,a,i;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){i=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(o=a[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},650:(e,t,r)=>{var n=r(942).Symbol;e.exports=n},379:(e,t,r)=>{var n=r(650),o=r(870),a=r(5),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},870:(e,t,r)=>{var n=r(650),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},5:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},942:(e,t,r)=>{var n=r(967),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},655:(e,t,r)=>{var n=r(379),o=r(580);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},591:(e,t,r)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function s(e){for(var t=-1,r=0;r<i.length;r++)if(i[r].identifier===e){t=r;break}return t}function c(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],c=t.base?a[0]+t.base:a[0],l=r[c]||0,d="".concat(c," ").concat(l);r[c]=l+1;var u=s(d),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(i[u].references++,i[u].updater(p)):i.push({identifier:d,updater:y(p,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=r.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function p(e,t,r,n){var o=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t,r){var n=r.css,o=r.media,a=r.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var h=null,g=0;function y(e,t){var r,n,o;if(t.singleton){var a=g++;r=h||(h=l(t)),n=p.bind(null,r,a,!1),o=p.bind(null,r,a,!0)}else r=l(t),n=f.bind(null,r,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var r=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var o=s(r[n]);i[o].references--}for(var a=c(e,t),l=0;l<r.length;l++){var d=s(r[l]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}r=a}}}},494:t=>{"use strict";t.exports=e},155:e=>{"use strict";e.exports=n},514:e=>{"use strict";e.exports=o},236:e=>{"use strict";e.exports=r},272:e=>{"use strict";e.exports=t}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return a[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0;var c={};return(()=>{"use strict";s.r(c),s.d(c,{AppearanceManager:()=>e.AppearanceManager,CloseButtonPosition:()=>e.CloseButtonPosition,GoodsWidgetRenderingType:()=>e.GoodsWidgetRenderingType,IamCheckDisplayTimeRangeError:()=>e.IamCheckDisplayTimeRangeError,IamFrequencyLimitError:()=>e.IamFrequencyLimitError,IamMessageLimitExceededError:()=>e.IamMessageLimitExceededError,IamMessageOpenError:()=>e.IamMessageOpenError,IamNotFoundByEventError:()=>e.IamNotFoundByEventError,IamNotFoundByIdError:()=>e.IamNotFoundByIdError,IamNotFoundLimitError:()=>e.IamNotFoundLimitError,IamOtherReaderIsOpenError:()=>e.IamOtherReaderIsOpenError,IamShowOnlyIfLoadedError:()=>e.IamShowOnlyIfLoadedError,IasNetworkError:()=>e.IasNetworkError,InAppStoryManager:()=>D,StoriesListCardCoverQuality:()=>e.StoriesListCardCoverQuality,StoriesListCardTitlePosition:()=>e.StoriesListCardTitlePosition,StoriesListCardTitleTextAlign:()=>e.StoriesListCardTitleTextAlign,StoriesListCardViewVariant:()=>e.StoriesListCardViewVariant,StoriesListDirection:()=>e.StoriesListDirection,StoryReaderSwipeStyle:()=>e.StoryReaderSwipeStyle});var e=s(494);class t extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const r=e=>{if(null==e||"object"!=typeof e)throw new t(null==e?"null":typeof e)};class n extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}class o extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}var a=s(46);class i extends a.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._mountPoint=this.getMountPoint(e),this.app.addItem(this).catch(console.error)}get mountPoint(){return this._mountPoint}get mountSelector(){return this._mountSelector}destroy(){this.app.removeItem(this)}getMountPoint(e){const t=document.querySelector(e);if(!t)throw new o(e);return t}}class l extends i{constructor(e,t,n,o){super(e,n),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t)}get appearanceManager(){return this._appearanceManager}get type(){return e.StoryFeedType.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){var e;return null===(e=this.params)||void 0===e?void 0:e.feed}get testKey(){var e;return null===(e=this.params)||void 0===e?void 0:e.testKey}get useUgcCard(){var e;return Boolean(null===(e=this.params)||void 0===e?void 0:e.useUgcCard)}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}}class d extends l{constructor(t,n,o,a){super(t,n,o,{feed:e.UGCFeedSlug,testKey:null==a?void 0:a.testKey,useUgcCard:null==a?void 0:a.useUgcCard}),Object.defineProperty(this,"ugcParams",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(n)}get type(){return e.StoryFeedType.UGC}get filter(){var e;return null===(e=this.ugcParams)||void 0===e?void 0:e.filter}}var u=s(272),p=s(236),f=s(155),h=s(591),g=s.n(h),y=s(432),v={insert:"head",singleton:!1};g()(y.A,v);const m=y.A.locals||{};var b;!function(e){e.LTR="ltr",e.RTL="rtl"}(b||(b={}));const M=({open:t,options:r,storyListOptions:n,onClose:o})=>{var a,i;(0,f.useLayoutEffect)((()=>{if(!t)return;const e=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=e}}),[t]);return t?(0,u.jsx)("div",{className:m["favorite-story-list-modal"],style:(()=>{var e,t,n,o;return{"--storiesFavoriteTitleColor":r.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":r.title.font,"--storiesFavoriteTitleBackgroundColor":r.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(t=null===(e=r.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==t?t:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(o=null===(n=r.bottomOffset)||void 0===n?void 0:n.toString())&&void 0!==o?o:"0")+"px","--storiesFavoriteBackgroundColor":r.backgroundColor}})(),children:(0,u.jsxs)("div",{className:m.container,children:[(0,u.jsxs)("div",{className:m.header,children:[(0,u.jsx)("p",{className:m.title,children:r.title.content}),(0,u.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},className:m["header__close-btn"],style:(()=>{var t;const n="start"===r.closeButtonPosition||"left"===r.closeButtonPosition,o=(null===(t=e.storyManager.config)||void 0===t?void 0:t.dir)===b.LTR;return{[n&&o||!n&&!o?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(i=null===(a=r.closeButton)||void 0===a?void 0:a.svgSrc.baseState)&&void 0!==i?i:""}})]}),(0,u.jsx)("div",{className:m.content,children:(0,u.jsx)("div",{className:m["favorite-story-list"],children:(0,u.jsx)(e.FavoriteStoryList,{options:Object.assign(Object.assign(Object.assign({},n),{sidePadding:0}),{direction:e.StoriesListDirection.COLUMN,layout:{height:"auto"}})})})}),(0,u.jsx)("div",{className:m.footer}),(0,u.jsx)("div",{className:m["bottom-offset"]})]})}):null};var S=s(514);const w=e=>{(0,f.useEffect)((()=>{const t=e.mountPoint,r=()=>{console.warn(`[IAS]: The node has been removed from DOM. Unsafe destruction of story feed ${e.mountSelector}`),e.destroy()};if(!document.body.contains(t))return void r();const n=new MutationObserver((()=>{document.body.contains(t)||(r(),n.disconnect())}));return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect()}}),[e])};var x;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(x||(x={}));const C=({storyList:t,onStoryCardClick:r,onFavoriteCardClick:n})=>{const[o,a]=(0,f.useState)(t.appearanceManager.storiesListOptions),i=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=i.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a)})),[t.appearanceManager]),(0,S.createPortal)((0,u.jsx)(e.StoryList,{ref:i,options:o,hasFavorite:t.appearanceManager.commonOptions.hasFavorite,testKey:t.testKey,useUgcCard:t.useUgcCard,feedSlug:t.feedSlug,onLoadStart:()=>{t.emit(x.START_LOADER)},onLoadEnd:e=>{t.emit(x.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()},onFavoriteCardClick:n,onStoryCardClick:r}),t.mountPoint)};var L;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(L||(L={}));const O=({ugcStoryList:t,onStoryCardClick:r})=>{const[n,o]=(0,f.useState)(t.appearanceManager.storiesListOptions),a=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=a.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o)})),[t.appearanceManager]),(0,S.createPortal)((0,u.jsx)(e.UGCStoryList,{ref:a,options:n,filter:t.filter,testKey:t.testKey,useUgcCard:t.useUgcCard,onStoryCardClick:r,onLoadStart:()=>{t.emit(L.START_LOADER)},onLoadEnd:e=>{t.emit(L.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()}}),t.mountPoint)},E=t=>{const[r,n]=(0,f.useState)(!1);return(0,u.jsxs)(e.IASContainer,{config:t.storyManagerConfigDto,storyReaderOptions:t.appearanceManager.storyReaderOptions,commonOptions:t.appearanceManager.commonOptions,gameReaderOptions:t.appearanceManager.gameReaderOptions,goodsWidgetOptions:t.appearanceManager.goodsWidgetOptions,children:[t.items.map((e=>e instanceof d?(0,u.jsx)(O,{ugcStoryList:e,onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)}},e.mountSelector):e instanceof l?(0,u.jsx)(C,{onFavoriteCardClick:()=>{n(!0)},onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)},storyList:e},e.mountSelector):void 0)),(0,u.jsx)(M,{open:r,onClose:()=>n(!1),options:t.appearanceManager.storyFavoriteReaderOptions,storyListOptions:t.appearanceManager.storiesListOptions})]})};class j{constructor(){Object.defineProperty(this,"_items",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get items(){return this._items}addItem(e){this._items.push(e)}removeItem(e){const t=this._items.findIndex((t=>t===e));-1!==t&&this._items.splice(t,1)}destroy(){this._items=[]}}class A{constructor(t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new e.AppearanceManager}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"appItemManager",{enumerable:!0,configurable:!0,writable:!0,value:new j}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async addItem(e){try{this.appItemManager.addItem(e),await this.storyManager.waitForConfig(),this.render()}catch(t){throw this.removeItem(e),t}}async removeItem(e){this.appItemManager.removeItem(e),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){r(e),this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,u.jsx)(E,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,items:this.appItemManager.items.slice(),onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.appItemManager.destroy(),this.unscubscribeToAppearanceManagerEvents(),this.root.unmount(),document.body.removeChild(this.rootElement),this.rootElement=null,this.root=null)}createAppRoot(){this.rootElement=document.createElement("div"),this.rootElement.id="ias-app",document.body.append(this.rootElement),this.root=(0,p.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var _,I=s(655),T=s.n(I);!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(_||(_={}));class P extends a.EventEmitter{constructor(e,t,n,o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(t),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(e,t)}async showSharePage(e,t){try{this.app.setAppearanceManager(t),this.handleStartLoad(),await this.storyManager.showSharePage(e),this.storyManager.once("closeStoryReader",this.handleCloseStoryReader),this.handleEndLoad(!0)}catch(e){this.handleEndLoad(!1)}}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(_.START_LOADING),T()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(_.END_LOADING,{result:e}),T()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(T()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(_.CLOSE_STORY_READER)>0)try{T()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(_.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class k extends a.EventEmitter{constructor(t,n,o,a){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new e.StackedStoryListViewModel(this.options),this.stackedStoryListViewModel.on("update",this.handleUpdate),this.loadStories().catch(console.error)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}async reload(){return this.stackedStoryListViewModel.reload()}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}async loadStories(){await this.storyManager.waitForConfig(),this.stackedStoryListViewModel.loadStories()}}const R=()=>{if(!D.instance)throw new n};class D{constructor(t){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"__IAS_INTERNAL_API__",{enumerable:!0,configurable:!0,writable:!0,value:e.__IAS_INTERNAL_API__}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new A(e.storyManager)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends l{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends d{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends P{constructor(t,r,n){R(),super(t,r,e.storyManager,D.instance.app,n)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends k{constructor(t,r){R(),super(t,e.storyManager,D.instance.app,r)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:e.storyManager.inAppMessaging}),Object.defineProperty(this,"products",{enumerable:!0,configurable:!0,writable:!0,value:e.storyManager.products}),D.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),D.instance):(e.storyManager.setUserAgent(`InAppStoryJSSDK/${this.sdkVersionCode}`),D.instance=this,this.app.setStoryManagerConfig(t),D.instance)}get sdkVersionName(){return"3.8.3"}get sdkVersionCode(){return parseInt(30803)}get deviceId(){return e.storyManager.deviceId}get userAgent(){return e.storyManager.userAgent}set storyLinkClickHandler(t){e.storyManager.storyLinkClickHandler=t}set shareHandler(t){e.storyManager.shareHandler=t}static getInstance(){return D.instance?D.instance:null}static use(t,r){t.install({INTERNAL_API:e.__IAS_INTERNAL_API__,HOST:D},r)}getConfig(){return e.storyManager.config}getNonce(){return e.storyManager.getNonce()}async showOnboardingStories(t,r){return R(),this.app.setAppearanceManager(t),e.storyManager.showOnboardingStories(r)}async showStory(t,r){R(),this.app.setAppearanceManager(r),await e.storyManager.showStory(t)}async showStoryOnce(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showStoryOnce(t)}async showSharePage(t,r){return R(),this.app.setAppearanceManager(r),e.storyManager.showSharePage(t)}closeAllReaders(){e.storyManager.closeAllReaders()}async openGame(t,r,n={}){return R(),this.app.setAppearanceManager(r),e.storyManager.openGame(t,n)}async closeGame(){return e.storyManager.closeGame()}async closeStoryReader(){return e.storyManager.closeStoryReader()}getUgcEditorConfig(){return e.storyManager.getUgcEditorConfig()}closeGoodsWidget(){e.storyManager.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async setUserId(e,t){R(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setOptions(e){R(),this.storyManagerConfigDto.options=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setTags(e){R(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){R(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){R(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(t,r){return e.storyManager.on(t,r),this}once(t,r){return e.storyManager.once(t,r),this}off(t,r){return e.storyManager.off(t,r),this}destroy(){null!=D.instance&&(D.instance=null,this.closeAllReaders(),this.app.destroy())}}})(),c})()));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom"));else if("function"==typeof define&&define.amd)define(["@inappstory/react-sdk","react/jsx-runtime","react-dom/client","react","react-dom"],t);else{var r="object"==typeof exports?t(require("@inappstory/react-sdk"),require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom")):t(e["@inappstory/react-sdk"],e["react/jsx-runtime"],e["react-dom/client"],e.react,e["react-dom"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o)=>(()=>{var a={432:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(935),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".favorite-story-list-modal--xWjHA{position:fixed;inset:0px;z-index:1090}.favorite-story-list-modal--xWjHA .container--GZBjv{width:100%;height:100%;background:var(--storiesFavoriteBackgroundColor, #333333);display:flex;flex-direction:column;position:relative;overflow-y:auto}.favorite-story-list-modal--xWjHA .header--TjHMD{display:flex;align-content:center;justify-content:center;align-items:center;flex-shrink:0;position:-webkit-sticky;position:sticky;top:0;z-index:100;background:var(--storiesFavoriteTitleBackgroundColor, #333333);box-shadow:0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12),0 1px 3px 0 rgba(0,0,0,.2);padding-top:var(--storiesFavoriteHeaderTopOffset, 0px);margin-bottom:25px}.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:1rem;margin-bottom:1rem;font-size:1.2em;color:var(--storiesFavoriteTitleColor, white);font-family:var(--storiesFavoriteTitleFontFamily);font-weight:normal;font-size:1.4rem;line-height:normal;font:var(--storiesFavoriteTitleFont, normal)}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD .title--Dk04x{margin-top:25px;margin-bottom:25px}}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .header--TjHMD{margin-bottom:50px}}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-{border:0;padding:0;background:rgba(0,0,0,0);position:absolute;top:50%;transform:translateY(-50%);z-index:1140;pointer-events:all;cursor:pointer;outline:none;right:10px;width:30px;height:30px;display:flex;justify-content:center;align-items:center}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm-:focus{outline:none}.favorite-story-list-modal--xWjHA .header__close-btn--Jojm- svg{overflow:visible}.favorite-story-list-modal--xWjHA .footer--edEpn{width:100%;height:25px}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .footer--edEpn{height:50px}}.favorite-story-list-modal--xWjHA .bottom-offset--baiTh{position:-webkit-sticky;position:sticky;z-index:100;background:inherit;bottom:0;width:100%;height:var(--storiesFavoriteBottomOffset, 0px)}.favorite-story-list-modal--xWjHA .content--qCPkX{display:flex;justify-content:center;width:100%;padding:0 25px 25px;box-sizing:border-box}.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{width:100%}@media(min-width: 640px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:640px}}@media(min-width: 768px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:768px}}@media(min-width: 1024px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1024px}}@media(min-width: 1280px){.favorite-story-list-modal--xWjHA .content--qCPkX .favorite-story-list--MISMx{max-width:1280px}}",""]),o.locals={"favorite-story-list-modal":"favorite-story-list-modal--xWjHA",container:"container--GZBjv",header:"header--TjHMD",title:"title--Dk04x","header__close-btn":"header__close-btn--Jojm-",footer:"footer--edEpn","bottom-offset":"bottom-offset--baiTh",content:"content--qCPkX","favorite-story-list":"favorite-story-list--MISMx"};const a=o},935:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var s=0;s<e.length;s++){var c=[].concat(e[s]);n&&o[c[0]]||(r&&(c[2]?c[2]="".concat(r," and ").concat(c[2]):c[2]=r),t.push(c))}},t}},46:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&g(e,"error",t,r)}(e,o,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var o,a,i,l;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),i=a[t]),void 0===i)i=a[t]=r,++e._eventsCount;else if("function"==typeof i?i=a[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),(o=c(e))>0&&i.length>o&&!i.warned){i.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=i.length,l=d,console&&console.warn&&console.warn(l)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=d.bind(n);return o.listener=r,n.wrapFn=o,o}function p(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(o):h(o,o.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){n.once&&e.removeEventListener(t,o),r(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return c(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,d=h(c,l);for(r=0;r<l;++r)n(d[r],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,n,o,a,i;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){i=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var o,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(o=a[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},a.prototype.listenerCount=f,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},650:(e,t,r)=>{var n=r(942).Symbol;e.exports=n},379:(e,t,r)=>{var n=r(650),o=r(870),a=r(5),i=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},967:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},870:(e,t,r)=>{var n=r(650),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var o=i.call(e);return n&&(t?e[s]=r:delete e[s]),o}},5:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},942:(e,t,r)=>{var n=r(967),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},655:(e,t,r)=>{var n=r(379),o=r(580);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},580:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},591:(e,t,r)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function s(e){for(var t=-1,r=0;r<i.length;r++)if(i[r].identifier===e){t=r;break}return t}function c(e,t){for(var r={},n=[],o=0;o<e.length;o++){var a=e[o],c=t.base?a[0]+t.base:a[0],l=r[c]||0,d="".concat(c," ").concat(l);r[c]=l+1;var u=s(d),p={css:a[1],media:a[2],sourceMap:a[3]};-1!==u?(i[u].references++,i[u].updater(p)):i.push({identifier:d,updater:y(p,t),references:1}),n.push(d)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=r.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function p(e,t,r,n){var o=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=u(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function f(e,t,r){var n=r.css,o=r.media,a=r.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var h=null,g=0;function y(e,t){var r,n,o;if(t.singleton){var a=g++;r=h||(h=l(t)),n=p.bind(null,r,a,!1),o=p.bind(null,r,a,!0)}else r=l(t),n=f.bind(null,r,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var r=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<r.length;n++){var o=s(r[n]);i[o].references--}for(var a=c(e,t),l=0;l<r.length;l++){var d=s(r[l]);0===i[d].references&&(i[d].updater(),i.splice(d,1))}r=a}}}},494:t=>{"use strict";t.exports=e},155:e=>{"use strict";e.exports=n},514:e=>{"use strict";e.exports=o},236:e=>{"use strict";e.exports=r},272:e=>{"use strict";e.exports=t}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return a[e](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nc=void 0;var c={};return(()=>{"use strict";s.r(c),s.d(c,{AppearanceManager:()=>e.AppearanceManager,CloseButtonPosition:()=>e.CloseButtonPosition,GoodsWidgetRenderingType:()=>e.GoodsWidgetRenderingType,IamCheckDisplayTimeRangeError:()=>e.IamCheckDisplayTimeRangeError,IamFrequencyLimitError:()=>e.IamFrequencyLimitError,IamMessageLimitExceededError:()=>e.IamMessageLimitExceededError,IamMessageOpenError:()=>e.IamMessageOpenError,IamNotFoundByEventError:()=>e.IamNotFoundByEventError,IamNotFoundByIdError:()=>e.IamNotFoundByIdError,IamNotFoundLimitError:()=>e.IamNotFoundLimitError,IamOtherReaderIsOpenError:()=>e.IamOtherReaderIsOpenError,IamShowOnlyIfLoadedError:()=>e.IamShowOnlyIfLoadedError,IasNetworkError:()=>e.IasNetworkError,InAppStoryManager:()=>D,StoriesListCardCoverQuality:()=>e.StoriesListCardCoverQuality,StoriesListCardTitlePosition:()=>e.StoriesListCardTitlePosition,StoriesListCardTitleTextAlign:()=>e.StoriesListCardTitleTextAlign,StoriesListCardViewVariant:()=>e.StoriesListCardViewVariant,StoriesListDirection:()=>e.StoriesListDirection,StoryReaderSwipeStyle:()=>e.StoryReaderSwipeStyle});var e=s(494);class t extends Error{constructor(e){super(`Appearance Manager must be an object, but passed ${e.toUpperCase()}. Please check your code.`),this.name="IasAppearanceManagerTypeofError"}}const r=e=>{if(null==e||"object"!=typeof e)throw new t(null==e?"null":typeof e)};class n extends Error{constructor(){super("[IAS]: The <StoryManager> instance has been destroyed, you must create a new instance"),this.name="IasInAppStoryManagerReferenceError"}}class o extends Error{constructor(e){super(`[IAS]: Mount point ${e} is not present in DOM at initialization time`),this.name="IasMountPointReferenceError"}}var a=s(46);class i extends a.EventEmitter{constructor(e,t){super(),Object.defineProperty(this,"_mountSelector",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_mountPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._mountPoint=this.getMountPoint(e),this.app.addItem(this).catch(console.error)}get mountPoint(){return this._mountPoint}get mountSelector(){return this._mountSelector}destroy(){this.app.removeItem(this)}getMountPoint(e){const t=document.querySelector(e);if(!t)throw new o(e);return t}}class l extends i{constructor(e,t,n,o){super(e,n),Object.defineProperty(this,"_appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_ugcCardClickHandler",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t)}get appearanceManager(){return this._appearanceManager}get type(){return e.StoryFeedType.DEFAULT}get identityFields(){return{feedSlug:this.feedSlug}}get feedSlug(){var e;return null===(e=this.params)||void 0===e?void 0:e.feed}get testKey(){var e;return null===(e=this.params)||void 0===e?void 0:e.testKey}get useUgcCard(){var e;return Boolean(null===(e=this.params)||void 0===e?void 0:e.useUgcCard)}set ugcCardClickHandler(e){this._ugcCardClickHandler=e}get ugcCardClickHandler(){return this._ugcCardClickHandler}set api(e){this._api=e}async reload(){var e;return null===(e=this._api)||void 0===e?void 0:e.reload()}}class d extends l{constructor(t,n,o,a){super(t,n,o,{feed:e.UGCFeedSlug,testKey:null==a?void 0:a.testKey,useUgcCard:null==a?void 0:a.useUgcCard}),Object.defineProperty(this,"ugcParams",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(n)}get type(){return e.StoryFeedType.UGC}get filter(){var e;return null===(e=this.ugcParams)||void 0===e?void 0:e.filter}}var u=s(272),p=s(236),f=s(155),h=s(591),g=s.n(h),y=s(432),v={insert:"head",singleton:!1};g()(y.A,v);const m=y.A.locals||{};var b;!function(e){e.LTR="ltr",e.RTL="rtl"}(b||(b={}));const M=({open:t,options:r,storyListOptions:n,onClose:o})=>{var a,i;(0,f.useLayoutEffect)((()=>{if(!t)return;const e=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=e}}),[t]);return t?(0,u.jsx)("div",{className:m["favorite-story-list-modal"],style:(()=>{var e,t,n,o;return{"--storiesFavoriteTitleColor":r.title.color,"--storiesFavoriteTitleFontFamily":"InternalPrimaryFont","--storiesFavoriteTitleFont":r.title.font,"--storiesFavoriteTitleBackgroundColor":r.title.backgroundColor,"--storiesFavoriteHeaderTopOffset":parseFloat(null!==(t=null===(e=r.headerTopOffset)||void 0===e?void 0:e.toString())&&void 0!==t?t:"0")+"px","--storiesFavoriteBottomOffset":parseFloat(null!==(o=null===(n=r.bottomOffset)||void 0===n?void 0:n.toString())&&void 0!==o?o:"0")+"px","--storiesFavoriteBackgroundColor":r.backgroundColor}})(),children:(0,u.jsxs)("div",{className:m.container,children:[(0,u.jsxs)("div",{className:m.header,children:[(0,u.jsx)("p",{className:m.title,children:r.title.content}),(0,u.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},className:m["header__close-btn"],style:(()=>{var t;const n="start"===r.closeButtonPosition||"left"===r.closeButtonPosition,o=(null===(t=e.storyManager.config)||void 0===t?void 0:t.dir)===b.LTR;return{[n&&o||!n&&!o?"left":"right"]:"10px"}})(),dangerouslySetInnerHTML:{__html:null!==(i=null===(a=r.closeButton)||void 0===a?void 0:a.svgSrc.baseState)&&void 0!==i?i:""}})]}),(0,u.jsx)("div",{className:m.content,children:(0,u.jsx)("div",{className:m["favorite-story-list"],children:(0,u.jsx)(e.FavoriteStoryList,{options:Object.assign(Object.assign(Object.assign({},n),{sidePadding:0}),{direction:e.StoriesListDirection.COLUMN,layout:{height:"auto"}})})})}),(0,u.jsx)("div",{className:m.footer}),(0,u.jsx)("div",{className:m["bottom-offset"]})]})}):null};var S=s(514);const w=e=>{(0,f.useEffect)((()=>{const t=e.mountPoint,r=()=>{console.warn(`[IAS]: The node has been removed from DOM. Unsafe destruction of story feed ${e.mountSelector}`),e.destroy()};if(!document.body.contains(t))return void r();const n=new MutationObserver((()=>{document.body.contains(t)||(r(),n.disconnect())}));return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect()}}),[e])};var x;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(x||(x={}));const C=({storyList:t,onStoryCardClick:r,onFavoriteCardClick:n})=>{const[o,a]=(0,f.useState)(t.appearanceManager.storiesListOptions),i=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=i.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,a)})),[t.appearanceManager]),(0,S.createPortal)((0,u.jsx)(e.StoryList,{ref:i,options:o,hasFavorite:t.appearanceManager.commonOptions.hasFavorite,testKey:t.testKey,useUgcCard:t.useUgcCard,feedSlug:t.feedSlug,onLoadStart:()=>{t.emit(x.START_LOADER)},onLoadEnd:e=>{t.emit(x.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()},onFavoriteCardClick:n,onStoryCardClick:r}),t.mountPoint)};var L;!function(e){e.START_LOADER="startLoad",e.END_LOADER="endLoad"}(L||(L={}));const O=({ugcStoryList:t,onStoryCardClick:r})=>{const[n,o]=(0,f.useState)(t.appearanceManager.storiesListOptions),a=(0,f.useRef)(null);return w(t),(0,f.useEffect)((()=>{t.api=a.current}),[]),(0,f.useEffect)((()=>(t.appearanceManager.on(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o),()=>{t.appearanceManager.off(e.AppearanceManagerEvents.EVENT_UPDATED_STORIES_LIST_OPTIONS,o)})),[t.appearanceManager]),(0,S.createPortal)((0,u.jsx)(e.UGCStoryList,{ref:a,options:n,filter:t.filter,testKey:t.testKey,useUgcCard:t.useUgcCard,onStoryCardClick:r,onLoadStart:()=>{t.emit(L.START_LOADER)},onLoadEnd:e=>{t.emit(L.END_LOADER,e)},onUgcCardClick:()=>{t.ugcCardClickHandler()}}),t.mountPoint)},E=t=>{const[r,n]=(0,f.useState)(!1);return(0,u.jsxs)(e.IASContainer,{config:t.storyManagerConfigDto,storyReaderOptions:t.appearanceManager.storyReaderOptions,commonOptions:t.appearanceManager.commonOptions,gameReaderOptions:t.appearanceManager.gameReaderOptions,goodsWidgetOptions:t.appearanceManager.goodsWidgetOptions,children:[t.items.map((e=>e instanceof d?(0,u.jsx)(O,{ugcStoryList:e,onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)}},e.mountSelector):e instanceof l?(0,u.jsx)(C,{onFavoriteCardClick:()=>{n(!0)},onStoryCardClick:()=>{t.onAppearanceManagerChange(e.appearanceManager)},storyList:e},e.mountSelector):void 0)),(0,u.jsx)(M,{open:r,onClose:()=>n(!1),options:t.appearanceManager.storyFavoriteReaderOptions,storyListOptions:t.appearanceManager.storiesListOptions})]})};class j{constructor(){Object.defineProperty(this,"_items",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get items(){return this._items}addItem(e){this._items.push(e)}removeItem(e){const t=this._items.findIndex((t=>t===e));-1!==t&&this._items.splice(t,1)}destroy(){this._items=[]}}class A{constructor(t){Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"root",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:new e.AppearanceManager}),Object.defineProperty(this,"rootElement",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"appItemManager",{enumerable:!0,configurable:!0,writable:!0,value:new j}),this.createAppRoot(),this.handleAppearanceManagerUpdate=this.handleAppearanceManagerUpdate.bind(this),this.setAppearanceManager=this.setAppearanceManager.bind(this)}async addItem(e){try{this.appItemManager.addItem(e),await this.storyManager.waitForConfig(),this.render()}catch(t){throw this.removeItem(e),t}}async removeItem(e){this.appItemManager.removeItem(e),this.render()}setStoryManagerConfig(e){this.storyManagerConfigDto=Object.assign(Object.assign({},this.storyManagerConfigDto),e),this.render()}setAppearanceManager(e){r(e),this.unscubscribeToAppearanceManagerEvents(),this.appearanceManager=e,this.subscribeToAppearanceManagerEvents(),this.render()}render(){var e;null===(e=this.root)||void 0===e||e.render((0,u.jsx)(E,{storyManagerConfigDto:this.storyManagerConfigDto,appearanceManager:this.appearanceManager,items:this.appItemManager.items.slice(),onAppearanceManagerChange:this.setAppearanceManager}))}destroy(){this.rootElement&&this.root&&(this.appItemManager.destroy(),this.unscubscribeToAppearanceManagerEvents(),this.root.unmount(),document.body.removeChild(this.rootElement),this.rootElement=null,this.root=null)}createAppRoot(){this.rootElement=document.createElement("div"),this.rootElement.id="ias-app",document.body.append(this.rootElement),this.root=(0,p.createRoot)(this.rootElement)}subscribeToAppearanceManagerEvents(){this.appearanceManager.on(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}unscubscribeToAppearanceManagerEvents(){this.appearanceManager.off(e.AppearanceManagerEvents.UPDATE,this.handleAppearanceManagerUpdate)}handleAppearanceManagerUpdate(){this.render()}}var _,I=s(655),T=s.n(I);!function(e){e.START_LOADING="startLoading",e.END_LOADING="endLoading",e.CLOSE_STORY_READER="closeStoryReader"}(_||(_={}));class P extends a.EventEmitter{constructor(e,t,n,o,a){super(),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),r(t),this.handleCloseStoryReader=this.handleCloseStoryReader.bind(this),this.showSharePage(e,t)}async showSharePage(e,t){try{this.app.setAppearanceManager(t),this.handleStartLoad(),await this.storyManager.showSharePage(e),this.storyManager.once("closeStoryReader",this.handleCloseStoryReader),this.handleEndLoad(!0)}catch(e){this.handleEndLoad(!1)}}async closeStoryReader(){this.storyManager.closeStoryReader()}handleStartLoad(){setTimeout((()=>{var e;this.emit(_.START_LOADING),T()(null===(e=this.options)||void 0===e?void 0:e.handleStartLoad)&&this.options.handleStartLoad()}))}handleEndLoad(e){var t;this.emit(_.END_LOADING,{result:e}),T()(null===(t=this.options)||void 0===t?void 0:t.handleStopLoad)&&this.options.handleStopLoad(e)}handleCloseStoryReader(){var e,t,r;if(T()(null===(e=this.options)||void 0===e?void 0:e.handleStoryReaderClose)||this.listenerCount(_.CLOSE_STORY_READER)>0)try{T()(null===(t=this.options)||void 0===t?void 0:t.handleStoryReaderClose)&&(null===(r=this.options)||void 0===r||r.handleStoryReaderClose()),this.emit(_.CLOSE_STORY_READER)}catch(e){console.error(e)}else{const e=window.location;window.open(`${e.protocol}//${e.host}`,"_parent")}}}class k extends a.EventEmitter{constructor(t,n,o,a){super(),Object.defineProperty(this,"appearanceManager",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"storyManager",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"stackedStoryListViewModel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r(t),this.handleUpdate=this.handleUpdate.bind(this),this.stackedStoryListViewModel=new e.StackedStoryListViewModel(this.options),this.stackedStoryListViewModel.on("update",this.handleUpdate),this.loadStories().catch(console.error)}get stories(){return this.stackedStoryListViewModel.stories}get length(){return this.stackedStoryListViewModel.length}get activeIndex(){return this.stackedStoryListViewModel.activeIndex}get feedCoverSrc(){return this.stackedStoryListViewModel.feedCoverSrc}get top(){return this.stackedStoryListViewModel.top}async reload(){return this.stackedStoryListViewModel.reload()}destroy(){this.stackedStoryListViewModel.destroy(),this.stackedStoryListViewModel.removeAllListeners()}showStory(e){this.app.setAppearanceManager(this.appearanceManager),this.stackedStoryListViewModel.showStory(e)}on(e,t){return"update"===e?super.on(e,t):(this.stackedStoryListViewModel.on(e,t),this)}once(e,t){return this.stackedStoryListViewModel.once(e,t),this}off(e,t){return this.stackedStoryListViewModel.off(e,t),this}handleUpdate(e){this.emit("update",{id:e.id,title:e.title,titleColor:e.titleColor,hasAudio:e.hasAudio,hasSwipeUp:e.hasSwipeUp,isOpened:e.isOpened,deeplink:e.deeplink,gameInstanceId:e.gameInstanceId,hideInReader:e.hideInReader,hide_timeline:e.hideTimeline,cover:e.getCover(this.appearanceManager.storiesListOptions.card.coverQuality)})}async loadStories(){await this.storyManager.waitForConfig(),this.stackedStoryListViewModel.loadStories()}}const R=()=>{if(!D.instance)throw new n};class D{constructor(t){return Object.defineProperty(this,"storyManagerConfigDto",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"__IAS_INTERNAL_API__",{enumerable:!0,configurable:!0,writable:!0,value:e.__IAS_INTERNAL_API__}),Object.defineProperty(this,"app",{enumerable:!0,configurable:!0,writable:!0,value:new A(e.storyManager)}),Object.defineProperty(this,"StoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends l{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"UGCStoriesList",{enumerable:!0,configurable:!0,writable:!0,value:class extends d{constructor(e,t,r){R(),super(e,t,D.instance.app,r)}}}),Object.defineProperty(this,"SharePage",{enumerable:!0,configurable:!0,writable:!0,value:class extends P{constructor(t,r,n){R(),super(t,r,e.storyManager,D.instance.app,n)}}}),Object.defineProperty(this,"StackedStoryList",{enumerable:!0,configurable:!0,writable:!0,value:class extends k{constructor(t,r){R(),super(t,e.storyManager,D.instance.app,r)}}}),Object.defineProperty(this,"inAppMessaging",{enumerable:!0,configurable:!0,writable:!0,value:e.storyManager.inAppMessaging}),Object.defineProperty(this,"products",{enumerable:!0,configurable:!0,writable:!0,value:e.storyManager.products}),D.instance?(console.warn("StoryManager singleton is created multiple times\nuse IAS.StoryManager.getInstance() instead"),D.instance):(e.storyManager.setUserAgent(`InAppStoryJSSDK/${this.sdkVersionCode}`),D.instance=this,this.app.setStoryManagerConfig(t),D.instance)}get sdkVersionName(){return"3.8.4"}get sdkVersionCode(){return parseInt(30804)}get deviceId(){return e.storyManager.deviceId}get userAgent(){return e.storyManager.userAgent}set storyLinkClickHandler(t){e.storyManager.storyLinkClickHandler=t}set shareHandler(t){e.storyManager.shareHandler=t}static getInstance(){return D.instance?D.instance:null}static use(t,r){t.install({INTERNAL_API:e.__IAS_INTERNAL_API__,HOST:D},r)}getConfig(){return e.storyManager.config}getNonce(){return e.storyManager.getNonce()}async showOnboardingStories(t,r){return R(),this.app.setAppearanceManager(t),e.storyManager.showOnboardingStories(r)}async showStory(t,r,n){R(),this.app.setAppearanceManager(r),await e.storyManager.showStory(t,n)}async showStoryOnce(t,r,n){return R(),this.app.setAppearanceManager(r),e.storyManager.showStoryOnce(t,n)}async showSharePage(t,r,n){return R(),this.app.setAppearanceManager(r),e.storyManager.showSharePage(t,n)}closeAllReaders(){e.storyManager.closeAllReaders()}async openGame(t,r,n={}){return R(),this.app.setAppearanceManager(r),e.storyManager.openGame(t,n)}async closeGame(){return e.storyManager.closeGame()}async closeStoryReader(){return e.storyManager.closeStoryReader()}getUgcEditorConfig(){return e.storyManager.getUgcEditorConfig()}closeGoodsWidget(){e.storyManager.closeGoodsWidget()}setLang(e){this.storyManagerConfigDto.lang=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async setUserId(e,t){R(),this.storyManagerConfigDto.userId=e,this.storyManagerConfigDto.userIdSign=t,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}async userLogoug(){return this.setUserId("")}setOptions(e){R(),this.storyManagerConfigDto.options=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setTags(e){R(),this.storyManagerConfigDto.tags=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setPlaceholders(e){R(),this.storyManagerConfigDto.placeholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}setImagePlaceholders(e){R(),this.storyManagerConfigDto.imagePlaceholders=e,this.app.setStoryManagerConfig(this.storyManagerConfigDto)}on(t,r){return e.storyManager.on(t,r),this}once(t,r){return e.storyManager.once(t,r),this}off(t,r){return e.storyManager.off(t,r),this}destroy(){null!=D.instance&&(D.instance=null,this.closeAllReaders(),this.app.destroy())}}})(),c})()));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CloseButtonPosition } from "./appearanceCommon";
|
|
2
2
|
import { RecursivePartial } from "../global";
|
|
3
|
-
|
|
4
3
|
import { CloseButtonPosition } from "./appearanceCommon";
|
|
5
|
-
import {
|
|
4
|
+
import { SharePanel } from "./sharePanel";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Appearance options for Game Reader.
|
|
@@ -97,6 +96,12 @@ export type GameReaderOptions = RecursivePartial<{
|
|
|
97
96
|
* @default true
|
|
98
97
|
*/
|
|
99
98
|
forceCheckOrientation?: boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Configuration for the share panel.
|
|
102
|
+
* @see https://docs.inappstory.com/sdk-guides/js-sdk/share-panel.html
|
|
103
|
+
*/
|
|
104
|
+
sharePanel: SharePanel<string>;
|
|
100
105
|
}>;
|
|
101
106
|
|
|
102
107
|
/**
|
|
@@ -18,6 +18,12 @@ type BaseShareTarget = "vk" | "ok" | "facebook" | "x" | "linkedin" | "telegram"
|
|
|
18
18
|
*/
|
|
19
19
|
export type ShareTarget<CustomTargets extends string = never> = BaseShareTarget | CustomTargets;
|
|
20
20
|
|
|
21
|
+
export declare enum ShareType {
|
|
22
|
+
Text = "text",
|
|
23
|
+
Link = "link",
|
|
24
|
+
Image = "image"
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
/**
|
|
22
28
|
* Parameters used to configure individual share targets.
|
|
23
29
|
*/
|
|
@@ -112,9 +118,15 @@ export type SharePanel<CustomTargets extends string = never> = Partial<{
|
|
|
112
118
|
copyButton: {
|
|
113
119
|
/**
|
|
114
120
|
* Button label text (e.g., "Copy link").
|
|
121
|
+
* @deprecated Use `getLabel` instead
|
|
115
122
|
*/
|
|
116
123
|
label: string;
|
|
117
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Button label text (e.g., "Copy link", "CopyText")
|
|
127
|
+
*/
|
|
128
|
+
getLabel: (config: { url?: string; text?: string; type: ShareType }) => string;
|
|
129
|
+
|
|
118
130
|
/**
|
|
119
131
|
* SVG icons for base and success (copied) states.
|
|
120
132
|
*/
|
|
@@ -127,7 +127,7 @@ export type StoryReaderOptions = RecursivePartial<{
|
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* Configuration for the share panel.
|
|
130
|
-
* @see https://docs.inappstory.com/sdk-guides/
|
|
130
|
+
* @see https://docs.inappstory.com/sdk-guides/js-sdk/share-panel.html
|
|
131
131
|
*/
|
|
132
132
|
sharePanel: SharePanel<string>;
|
|
133
133
|
|
|
@@ -152,6 +152,7 @@ export interface InAppMessaging {
|
|
|
152
152
|
* @param messageId - The ID of the message to show
|
|
153
153
|
* @param options - Optional display configuration
|
|
154
154
|
* @param options.showOnlyIfLoaded - If true, only shows messages that were preloaded
|
|
155
|
+
* @param options.signal - Abort signal to cancel the operation
|
|
155
156
|
* @returns Promise resolving to the displayed message
|
|
156
157
|
* @throws {IamNotFoundByIdError} If no message exists with this ID
|
|
157
158
|
* @throws {IamMessageOpenError} If this message is already open
|
|
@@ -159,7 +160,10 @@ export interface InAppMessaging {
|
|
|
159
160
|
* @throws {IamShowOnlyIfLoadedError} If showOnlyIfLoaded=true but message wasn't preloaded
|
|
160
161
|
* @throws {IamMessageLimitExceededError} If message display limit was reached
|
|
161
162
|
*/
|
|
162
|
-
showMessageById(
|
|
163
|
+
showMessageById(
|
|
164
|
+
messageId: number | string,
|
|
165
|
+
options?: { showOnlyIfLoaded?: boolean; signal?: AbortSignal }
|
|
166
|
+
): Promise<IamMessage>;
|
|
163
167
|
|
|
164
168
|
/**
|
|
165
169
|
* Displays a message associated with an event name
|
|
@@ -167,6 +171,7 @@ export interface InAppMessaging {
|
|
|
167
171
|
* @param options - Optional display configuration
|
|
168
172
|
* @param options.showOnlyIfLoaded - If true, only shows messages that were preloaded
|
|
169
173
|
* @param options.tags - Filter messages by tags
|
|
174
|
+
* @param options.signal - Abort signal to cancel the operation
|
|
170
175
|
* @returns Promise resolving to the displayed message
|
|
171
176
|
* @throws {IamNotFoundByEventError} If no message exists for this event
|
|
172
177
|
* @throws {IamFrequencyLimitError} If message frequency limit was exceeded
|
|
@@ -176,7 +181,7 @@ export interface InAppMessaging {
|
|
|
176
181
|
*/
|
|
177
182
|
showMessageByEvent(
|
|
178
183
|
eventName: string,
|
|
179
|
-
options?: { showOnlyIfLoaded?: boolean; tags?: string[] }
|
|
184
|
+
options?: { showOnlyIfLoaded?: boolean; tags?: string[]; signal?: AbortSignal }
|
|
180
185
|
): Promise<IamMessage>;
|
|
181
186
|
|
|
182
187
|
/**
|
|
@@ -221,26 +221,29 @@ export declare class InAppStoryManager {
|
|
|
221
221
|
*/
|
|
222
222
|
showOnboardingStories(
|
|
223
223
|
appearanceManager: AppearanceManager,
|
|
224
|
-
options?: { feed?: string; customTags?: Array<string>; limit?: number }
|
|
224
|
+
options?: { feed?: string; customTags?: Array<string>; limit?: number; signal?: AbortSignal; }
|
|
225
225
|
): Promise<void>;
|
|
226
226
|
|
|
227
227
|
/**
|
|
228
228
|
* Displays the share page for a specific story.
|
|
229
229
|
* @param storyId The story ID
|
|
230
|
+
* @param options.signal Abort signal to cancel the operation
|
|
230
231
|
*/
|
|
231
|
-
showSharePage(storyId: number | string, appearanceManager: AppearanceManager): Promise<void>;
|
|
232
|
+
showSharePage(storyId: number | string, appearanceManager: AppearanceManager, options?: { signal?: AbortSignal }): Promise<void>;
|
|
232
233
|
|
|
233
234
|
/**
|
|
234
235
|
* Opens a specific story.
|
|
235
236
|
* @param id The story ID
|
|
237
|
+
* @param options.signal Abort signal to cancel the operation
|
|
236
238
|
*/
|
|
237
|
-
showStory(id: number | string, appearanceManager: AppearanceManager): Promise<void>;
|
|
239
|
+
showStory(id: number | string, appearanceManager: AppearanceManager, options?: { signal?: AbortSignal }): Promise<void>;
|
|
238
240
|
|
|
239
241
|
/**
|
|
240
242
|
* Opens a specific story only once.
|
|
241
243
|
* @param id The story ID
|
|
244
|
+
* @param options.signal Abort signal to cancel the operation
|
|
242
245
|
*/
|
|
243
|
-
showStoryOnce(id: number | string, appearanceManager: AppearanceManager): Promise<void>;
|
|
246
|
+
showStoryOnce(id: number | string, appearanceManager: AppearanceManager, options?: { signal?: AbortSignal }): Promise<void>;
|
|
244
247
|
|
|
245
248
|
/**
|
|
246
249
|
* Opens a game by its instance ID.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inappstory/js-sdk",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.4",
|
|
4
4
|
"description": "JS SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stories",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"Samsung >= 5"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@inappstory/react-sdk": "^1.9.
|
|
61
|
+
"@inappstory/react-sdk": "^1.9.4",
|
|
62
62
|
"react": "^18.2.0",
|
|
63
63
|
"react-dom": "^18.2.0"
|
|
64
64
|
},
|