@everymatrix/general-stories 1.54.12 → 1.56.0

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-5e8dba8b.js');
3
+ const index = require('./index-4176da89.js');
4
4
 
5
5
  const getDevice = () => {
6
6
  let userAgent = window.navigator.userAgent;
@@ -85,6 +85,63 @@ const translate = (key, customLang) => {
85
85
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
86
86
  };
87
87
 
88
+ /**
89
+ * @name setClientStyling
90
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
91
+ * @param {HTMLElement} stylingContainer The reference element of the widget
92
+ * @param {string} clientStyling The style content
93
+ */
94
+ function setClientStyling(stylingContainer, clientStyling) {
95
+ if (stylingContainer) {
96
+ const sheet = document.createElement('style');
97
+ sheet.innerHTML = clientStyling;
98
+ stylingContainer.appendChild(sheet);
99
+ }
100
+ }
101
+
102
+ /**
103
+ * @name setClientStylingURL
104
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
105
+ * @param {HTMLElement} stylingContainer The reference element of the widget
106
+ * @param {string} clientStylingUrl The URL of the style content
107
+ */
108
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
109
+ const url = new URL(clientStylingUrl);
110
+
111
+ fetch(url.href)
112
+ .then((res) => res.text())
113
+ .then((data) => {
114
+ const cssFile = document.createElement('style');
115
+ cssFile.innerHTML = data;
116
+ if (stylingContainer) {
117
+ stylingContainer.appendChild(cssFile);
118
+ }
119
+ })
120
+ .catch((err) => {
121
+ console.error('There was an error while trying to load client styling from URL', err);
122
+ });
123
+ }
124
+
125
+ /**
126
+ * @name setStreamLibrary
127
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
128
+ * @param {HTMLElement} stylingContainer The highest element of the widget
129
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
130
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
131
+ */
132
+ function setStreamStyling(stylingContainer, domain, subscription) {
133
+ if (window.emMessageBus) {
134
+ const sheet = document.createElement('style');
135
+
136
+ window.emMessageBus.subscribe(domain, (data) => {
137
+ sheet.innerHTML = data;
138
+ if (stylingContainer) {
139
+ stylingContainer.appendChild(sheet);
140
+ }
141
+ });
142
+ }
143
+ }
144
+
88
145
  const generalStoriesCss = ".ImageContainer{display:flex;flex-direction:row;background-color:var(--emw--color-background, #0E1511);overflow:auto}.StoryThumbnailContainer{margin:5px;position:relative;display:inline-block;border-radius:50%}.StoryThumbnailContainer.Highlighted::before{content:\"\";position:absolute;border-radius:50%;background:linear-gradient(to bottom, var(--emw--color-primary, #22B04E), var(--emw--color-secondary, #E1A749));top:-3px;left:-3px;width:111%;height:103%}.StoryThumbnailContainer.Viewed::before{content:\"\";position:absolute;border-radius:50%;height:50px;width:50px;background:var(--emw--color-grey-150, #828282);top:-3px;left:-3px;width:111%;height:103%}.StoryThumbnailImage{height:50px;width:50px;border-radius:50%;position:relative;z-index:1}.StoryThumbnailImage.Highlighted,.StoryThumbnailImage.Viewed{border:2px solid var(--emw--color-white, #ffffff)}.FullScreenHeader{position:fixed;top:0;background:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));top:0px;width:100%;display:flex;flex-direction:column;padding:10px 0;z-index:5;height:30px}.FullScreenHeader .CloseStoryButton{position:absolute;right:0;width:20px;margin-right:20px;margin-top:8px;z-index:50}.FullScreenHeader .ProgressBarContainer{width:90%;height:2px;position:relative;top:0;background-color:var(--emw--color-grey-150, #828282);border-radius:10px;overflow:hidden;margin:0 auto}.FullScreenHeader .ProgressBarContainer .ProgressBar{height:100%;background:var(--emw--color-white, #ffffff);width:0%;transition:width 0.1s linear}.FullScreenStory{position:fixed;top:0;width:100%;height:100%;background-color:var(--emw--color-grey-400, #24211f);display:flex;align-items:center;justify-content:center;overflow:hidden;z-index:300}.FullScreenStory video{height:100vh;width:100vw}.FullScreenStory img{width:100%;height:100%;object-fit:contain}.FullScreenStory .LoadMoreButtonBackground{width:100%;height:15%;background:linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));position:absolute;bottom:0;display:flex;justify-content:center}.FullScreenStory .LoadMoreButtonBackground .LoadMoreButton{width:auto;font-size:var(--emw--font-size-small, 14px);font-family:inherit;background-color:var(--emw--color-grey-50, #F9F8F8);box-shadow:0px 0px 7px 1px var(--emw--color-grey-400, #24211f);color:var(--emw--color-black, #000000);border-radius:50px;position:absolute;bottom:15px;padding:10px 20px}";
89
146
  const GeneralStoriesStyle0 = generalStoriesCss;
90
147
 
@@ -144,24 +201,6 @@ const GeneralStories = class {
144
201
  });
145
202
  });
146
203
  };
147
- this.setClientStyling = () => {
148
- let sheet = document.createElement('style');
149
- sheet.innerHTML = this.clientStyling;
150
- this.stylingContainer.prepend(sheet);
151
- };
152
- this.setClientStylingURL = () => {
153
- let url = new URL(this.clientStylingUrl);
154
- let cssFile = document.createElement('style');
155
- fetch(url.href)
156
- .then((res) => res.text())
157
- .then((data) => {
158
- cssFile.innerHTML = data;
159
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
160
- })
161
- .catch((err) => {
162
- console.log('error ', err);
163
- });
164
- };
165
204
  this.navigateToExternalStoryLink = () => {
166
205
  window.postMessage({ type: 'OpenStoryLink', url: this.currentStory.storyUrl }, window.location.href);
167
206
  };
@@ -216,11 +255,16 @@ const GeneralStories = class {
216
255
  return (index.h("div", { class: `StoryThumbnailContainer ${props.viewed ? 'Viewed' : 'Highlighted'}`, onTouchStart: open }, index.h("img", { class: `StoryThumbnailImage ${props.viewed ? 'Viewed' : 'Highlighted'}`, src: props.icon, alt: "story-icon" })));
217
256
  };
218
257
  }
219
- handleStylingUpdate() {
220
- if (this.clientStyling)
221
- this.setClientStyling();
222
- if (this.clientStylingUrl)
223
- this.setClientStylingURL();
258
+ handleClientStylingChange(newValue, oldValue) {
259
+ if (newValue != oldValue) {
260
+ setClientStyling(this.stylingContainer, this.clientStyling);
261
+ }
262
+ }
263
+ handleClientStylingChangeURL(newValue, oldValue) {
264
+ if (newValue != oldValue) {
265
+ if (this.clientStylingUrl)
266
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
267
+ }
224
268
  }
225
269
  handleNewTranslations() {
226
270
  this.isLoading = true;
@@ -241,6 +285,22 @@ const GeneralStories = class {
241
285
  await getTranslations(this.translationUrl);
242
286
  }
243
287
  }
288
+ componentDidLoad() {
289
+ if (this.stylingContainer) {
290
+ if (window.emMessageBus != undefined) {
291
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
292
+ }
293
+ else {
294
+ if (this.clientStyling)
295
+ setClientStyling(this.stylingContainer, this.clientStyling);
296
+ if (this.clientStylingUrl)
297
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
298
+ }
299
+ }
300
+ }
301
+ disconnectedCallback() {
302
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
303
+ }
244
304
  onTouchStart(e) {
245
305
  this.touchPosStart = { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY };
246
306
  }
@@ -293,8 +353,8 @@ const GeneralStories = class {
293
353
  }
294
354
  }
295
355
  static get watchers() { return {
296
- "clientStyling": ["handleStylingUpdate"],
297
- "clientStylingUrl": ["handleStylingUpdate"],
356
+ "clientStyling": ["handleClientStylingChange"],
357
+ "clientStylingUrl": ["handleClientStylingChangeURL"],
298
358
  "translationUrl": ["handleNewTranslations"],
299
359
  "progress": ["handleTimeEnds"]
300
360
  }; }
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const generalStories = require('./general-stories-a5262e54.js');
6
- require('./index-5e8dba8b.js');
5
+ const generalStories = require('./general-stories-f3bf4099.js');
6
+ require('./index-4176da89.js');
7
7
 
8
8
 
9
9
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-5e8dba8b.js');
5
+ const index = require('./index-4176da89.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["general-stories.cjs",[[1,"general-stories",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"cmsEnv":[513,"cms-env"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"progressBarDuration":[514,"progress-bar-duration"],"currentStory":[32],"currentStoryId":[32],"progress":[32],"touchPosStart":[32],"touchPosEnd":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{"clientStyling":["handleStylingUpdate"],"clientStylingUrl":["handleStylingUpdate"],"translationUrl":["handleNewTranslations"],"progress":["handleTimeEnds"]}]]]], options);
22
+ return index.bootstrapLazy([["general-stories.cjs",[[1,"general-stories",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"progressBarDuration":[514,"progress-bar-duration"],"currentStory":[32],"currentStoryId":[32],"progress":[32],"touchPosStart":[32],"touchPosEnd":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"progress":["handleTimeEnds"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'general-stories';
24
- const BUILD = /* general-stories */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
24
+ const BUILD = /* general-stories */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
25
25
 
26
26
  /*
27
27
  Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
@@ -921,12 +921,16 @@ var postUpdateComponent = (hostRef) => {
921
921
  const tagName = hostRef.$cmpMeta$.$tagName$;
922
922
  const elm = hostRef.$hostElement$;
923
923
  const endPostUpdate = createTime("postUpdate", tagName);
924
+ const instance = hostRef.$lazyInstance$ ;
924
925
  const ancestorComponent = hostRef.$ancestorComponent$;
925
926
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
926
927
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
927
928
  {
928
929
  addHydratedFlag(elm);
929
930
  }
931
+ {
932
+ safeCall(instance, "componentDidLoad", void 0, elm);
933
+ }
930
934
  endPostUpdate();
931
935
  {
932
936
  hostRef.$onReadyResolve$(elm);
@@ -1241,6 +1245,9 @@ var connectedCallback = (elm) => {
1241
1245
  }
1242
1246
  };
1243
1247
  var disconnectInstance = (instance, elm) => {
1248
+ {
1249
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1250
+ }
1244
1251
  };
1245
1252
  var disconnectedCallback = async (elm) => {
1246
1253
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -1251,8 +1258,10 @@ var disconnectedCallback = async (elm) => {
1251
1258
  hostRef.$rmListeners$ = void 0;
1252
1259
  }
1253
1260
  }
1254
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1255
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1261
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1262
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1263
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1264
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1256
1265
  }
1257
1266
  }
1258
1267
  if (rootAppliedStyles.has(elm)) {
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const generalStories = require('./general-stories-a5262e54.js');
6
- require('./index-5e8dba8b.js');
5
+ const generalStories = require('./general-stories-f3bf4099.js');
6
+ require('./index-4176da89.js');
7
7
 
8
8
 
9
9
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-5e8dba8b.js');
5
+ const index = require('./index-4176da89.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["general-stories.cjs",[[1,"general-stories",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"cmsEnv":[513,"cms-env"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"progressBarDuration":[514,"progress-bar-duration"],"currentStory":[32],"currentStoryId":[32],"progress":[32],"touchPosStart":[32],"touchPosEnd":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{"clientStyling":["handleStylingUpdate"],"clientStylingUrl":["handleStylingUpdate"],"translationUrl":["handleNewTranslations"],"progress":["handleTimeEnds"]}]]]], options);
11
+ return index.bootstrapLazy([["general-stories.cjs",[[1,"general-stories",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"progressBarDuration":[514,"progress-bar-duration"],"currentStory":[32],"currentStoryId":[32],"progress":[32],"touchPosStart":[32],"touchPosEnd":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"progress":["handleTimeEnds"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -1,6 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { getDevicePlatform } from "../../utils/utils";
3
3
  import { translate, getTranslations } from "../../utils/locale.utils";
4
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
4
5
  export class GeneralStories {
5
6
  constructor() {
6
7
  /**
@@ -56,24 +57,6 @@ export class GeneralStories {
56
57
  });
57
58
  });
58
59
  };
59
- this.setClientStyling = () => {
60
- let sheet = document.createElement('style');
61
- sheet.innerHTML = this.clientStyling;
62
- this.stylingContainer.prepend(sheet);
63
- };
64
- this.setClientStylingURL = () => {
65
- let url = new URL(this.clientStylingUrl);
66
- let cssFile = document.createElement('style');
67
- fetch(url.href)
68
- .then((res) => res.text())
69
- .then((data) => {
70
- cssFile.innerHTML = data;
71
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
72
- })
73
- .catch((err) => {
74
- console.log('error ', err);
75
- });
76
- };
77
60
  this.navigateToExternalStoryLink = () => {
78
61
  window.postMessage({ type: 'OpenStoryLink', url: this.currentStory.storyUrl }, window.location.href);
79
62
  };
@@ -128,11 +111,16 @@ export class GeneralStories {
128
111
  return (h("div", { class: `StoryThumbnailContainer ${props.viewed ? 'Viewed' : 'Highlighted'}`, onTouchStart: open }, h("img", { class: `StoryThumbnailImage ${props.viewed ? 'Viewed' : 'Highlighted'}`, src: props.icon, alt: "story-icon" })));
129
112
  };
130
113
  }
131
- handleStylingUpdate() {
132
- if (this.clientStyling)
133
- this.setClientStyling();
134
- if (this.clientStylingUrl)
135
- this.setClientStylingURL();
114
+ handleClientStylingChange(newValue, oldValue) {
115
+ if (newValue != oldValue) {
116
+ setClientStyling(this.stylingContainer, this.clientStyling);
117
+ }
118
+ }
119
+ handleClientStylingChangeURL(newValue, oldValue) {
120
+ if (newValue != oldValue) {
121
+ if (this.clientStylingUrl)
122
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
123
+ }
136
124
  }
137
125
  handleNewTranslations() {
138
126
  this.isLoading = true;
@@ -153,6 +141,22 @@ export class GeneralStories {
153
141
  await getTranslations(this.translationUrl);
154
142
  }
155
143
  }
144
+ componentDidLoad() {
145
+ if (this.stylingContainer) {
146
+ if (window.emMessageBus != undefined) {
147
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
148
+ }
149
+ else {
150
+ if (this.clientStyling)
151
+ setClientStyling(this.stylingContainer, this.clientStyling);
152
+ if (this.clientStylingUrl)
153
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
154
+ }
155
+ }
156
+ }
157
+ disconnectedCallback() {
158
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
159
+ }
156
160
  onTouchStart(e) {
157
161
  this.touchPosStart = { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY };
158
162
  }
@@ -277,6 +281,25 @@ export class GeneralStories {
277
281
  "reflect": true,
278
282
  "defaultValue": "'stage'"
279
283
  },
284
+ "mbSource": {
285
+ "type": "string",
286
+ "mutable": false,
287
+ "complexType": {
288
+ "original": "string",
289
+ "resolved": "string",
290
+ "references": {}
291
+ },
292
+ "required": false,
293
+ "optional": false,
294
+ "docs": {
295
+ "tags": [],
296
+ "text": "Client custom styling via streamStyling"
297
+ },
298
+ "getter": false,
299
+ "setter": false,
300
+ "attribute": "mb-source",
301
+ "reflect": false
302
+ },
280
303
  "clientStyling": {
281
304
  "type": "string",
282
305
  "mutable": false,
@@ -371,10 +394,10 @@ export class GeneralStories {
371
394
  static get watchers() {
372
395
  return [{
373
396
  "propName": "clientStyling",
374
- "methodName": "handleStylingUpdate"
397
+ "methodName": "handleClientStylingChange"
375
398
  }, {
376
399
  "propName": "clientStylingUrl",
377
- "methodName": "handleStylingUpdate"
400
+ "methodName": "handleClientStylingChangeURL"
378
401
  }, {
379
402
  "propName": "translationUrl",
380
403
  "methodName": "handleNewTranslations"
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-3d519791.js';
1
+ import { r as registerInstance, h } from './index-95b2d607.js';
2
2
 
3
3
  const getDevice = () => {
4
4
  let userAgent = window.navigator.userAgent;
@@ -83,6 +83,63 @@ const translate = (key, customLang) => {
83
83
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
84
84
  };
85
85
 
86
+ /**
87
+ * @name setClientStyling
88
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
89
+ * @param {HTMLElement} stylingContainer The reference element of the widget
90
+ * @param {string} clientStyling The style content
91
+ */
92
+ function setClientStyling(stylingContainer, clientStyling) {
93
+ if (stylingContainer) {
94
+ const sheet = document.createElement('style');
95
+ sheet.innerHTML = clientStyling;
96
+ stylingContainer.appendChild(sheet);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * @name setClientStylingURL
102
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
103
+ * @param {HTMLElement} stylingContainer The reference element of the widget
104
+ * @param {string} clientStylingUrl The URL of the style content
105
+ */
106
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
107
+ const url = new URL(clientStylingUrl);
108
+
109
+ fetch(url.href)
110
+ .then((res) => res.text())
111
+ .then((data) => {
112
+ const cssFile = document.createElement('style');
113
+ cssFile.innerHTML = data;
114
+ if (stylingContainer) {
115
+ stylingContainer.appendChild(cssFile);
116
+ }
117
+ })
118
+ .catch((err) => {
119
+ console.error('There was an error while trying to load client styling from URL', err);
120
+ });
121
+ }
122
+
123
+ /**
124
+ * @name setStreamLibrary
125
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
126
+ * @param {HTMLElement} stylingContainer The highest element of the widget
127
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
128
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
129
+ */
130
+ function setStreamStyling(stylingContainer, domain, subscription) {
131
+ if (window.emMessageBus) {
132
+ const sheet = document.createElement('style');
133
+
134
+ window.emMessageBus.subscribe(domain, (data) => {
135
+ sheet.innerHTML = data;
136
+ if (stylingContainer) {
137
+ stylingContainer.appendChild(sheet);
138
+ }
139
+ });
140
+ }
141
+ }
142
+
86
143
  const generalStoriesCss = ".ImageContainer{display:flex;flex-direction:row;background-color:var(--emw--color-background, #0E1511);overflow:auto}.StoryThumbnailContainer{margin:5px;position:relative;display:inline-block;border-radius:50%}.StoryThumbnailContainer.Highlighted::before{content:\"\";position:absolute;border-radius:50%;background:linear-gradient(to bottom, var(--emw--color-primary, #22B04E), var(--emw--color-secondary, #E1A749));top:-3px;left:-3px;width:111%;height:103%}.StoryThumbnailContainer.Viewed::before{content:\"\";position:absolute;border-radius:50%;height:50px;width:50px;background:var(--emw--color-grey-150, #828282);top:-3px;left:-3px;width:111%;height:103%}.StoryThumbnailImage{height:50px;width:50px;border-radius:50%;position:relative;z-index:1}.StoryThumbnailImage.Highlighted,.StoryThumbnailImage.Viewed{border:2px solid var(--emw--color-white, #ffffff)}.FullScreenHeader{position:fixed;top:0;background:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));top:0px;width:100%;display:flex;flex-direction:column;padding:10px 0;z-index:5;height:30px}.FullScreenHeader .CloseStoryButton{position:absolute;right:0;width:20px;margin-right:20px;margin-top:8px;z-index:50}.FullScreenHeader .ProgressBarContainer{width:90%;height:2px;position:relative;top:0;background-color:var(--emw--color-grey-150, #828282);border-radius:10px;overflow:hidden;margin:0 auto}.FullScreenHeader .ProgressBarContainer .ProgressBar{height:100%;background:var(--emw--color-white, #ffffff);width:0%;transition:width 0.1s linear}.FullScreenStory{position:fixed;top:0;width:100%;height:100%;background-color:var(--emw--color-grey-400, #24211f);display:flex;align-items:center;justify-content:center;overflow:hidden;z-index:300}.FullScreenStory video{height:100vh;width:100vw}.FullScreenStory img{width:100%;height:100%;object-fit:contain}.FullScreenStory .LoadMoreButtonBackground{width:100%;height:15%;background:linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));position:absolute;bottom:0;display:flex;justify-content:center}.FullScreenStory .LoadMoreButtonBackground .LoadMoreButton{width:auto;font-size:var(--emw--font-size-small, 14px);font-family:inherit;background-color:var(--emw--color-grey-50, #F9F8F8);box-shadow:0px 0px 7px 1px var(--emw--color-grey-400, #24211f);color:var(--emw--color-black, #000000);border-radius:50px;position:absolute;bottom:15px;padding:10px 20px}";
87
144
  const GeneralStoriesStyle0 = generalStoriesCss;
88
145
 
@@ -142,24 +199,6 @@ const GeneralStories = class {
142
199
  });
143
200
  });
144
201
  };
145
- this.setClientStyling = () => {
146
- let sheet = document.createElement('style');
147
- sheet.innerHTML = this.clientStyling;
148
- this.stylingContainer.prepend(sheet);
149
- };
150
- this.setClientStylingURL = () => {
151
- let url = new URL(this.clientStylingUrl);
152
- let cssFile = document.createElement('style');
153
- fetch(url.href)
154
- .then((res) => res.text())
155
- .then((data) => {
156
- cssFile.innerHTML = data;
157
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
158
- })
159
- .catch((err) => {
160
- console.log('error ', err);
161
- });
162
- };
163
202
  this.navigateToExternalStoryLink = () => {
164
203
  window.postMessage({ type: 'OpenStoryLink', url: this.currentStory.storyUrl }, window.location.href);
165
204
  };
@@ -214,11 +253,16 @@ const GeneralStories = class {
214
253
  return (h("div", { class: `StoryThumbnailContainer ${props.viewed ? 'Viewed' : 'Highlighted'}`, onTouchStart: open }, h("img", { class: `StoryThumbnailImage ${props.viewed ? 'Viewed' : 'Highlighted'}`, src: props.icon, alt: "story-icon" })));
215
254
  };
216
255
  }
217
- handleStylingUpdate() {
218
- if (this.clientStyling)
219
- this.setClientStyling();
220
- if (this.clientStylingUrl)
221
- this.setClientStylingURL();
256
+ handleClientStylingChange(newValue, oldValue) {
257
+ if (newValue != oldValue) {
258
+ setClientStyling(this.stylingContainer, this.clientStyling);
259
+ }
260
+ }
261
+ handleClientStylingChangeURL(newValue, oldValue) {
262
+ if (newValue != oldValue) {
263
+ if (this.clientStylingUrl)
264
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
265
+ }
222
266
  }
223
267
  handleNewTranslations() {
224
268
  this.isLoading = true;
@@ -239,6 +283,22 @@ const GeneralStories = class {
239
283
  await getTranslations(this.translationUrl);
240
284
  }
241
285
  }
286
+ componentDidLoad() {
287
+ if (this.stylingContainer) {
288
+ if (window.emMessageBus != undefined) {
289
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
290
+ }
291
+ else {
292
+ if (this.clientStyling)
293
+ setClientStyling(this.stylingContainer, this.clientStyling);
294
+ if (this.clientStylingUrl)
295
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
296
+ }
297
+ }
298
+ }
299
+ disconnectedCallback() {
300
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
301
+ }
242
302
  onTouchStart(e) {
243
303
  this.touchPosStart = { clientX: e.touches[0].clientX, clientY: e.touches[0].clientY };
244
304
  }
@@ -291,8 +351,8 @@ const GeneralStories = class {
291
351
  }
292
352
  }
293
353
  static get watchers() { return {
294
- "clientStyling": ["handleStylingUpdate"],
295
- "clientStylingUrl": ["handleStylingUpdate"],
354
+ "clientStyling": ["handleClientStylingChange"],
355
+ "clientStylingUrl": ["handleClientStylingChangeURL"],
296
356
  "translationUrl": ["handleNewTranslations"],
297
357
  "progress": ["handleTimeEnds"]
298
358
  }; }
@@ -1,2 +1,2 @@
1
- export { G as general_stories } from './general-stories-9cdd7600.js';
2
- import './index-3d519791.js';
1
+ export { G as general_stories } from './general-stories-8ada9aa4.js';
2
+ import './index-95b2d607.js';
@@ -1,5 +1,5 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-3d519791.js';
2
- export { s as setNonce } from './index-3d519791.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-95b2d607.js';
2
+ export { s as setNonce } from './index-95b2d607.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  /*
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["general-stories",[[1,"general-stories",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"cmsEnv":[513,"cms-env"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"progressBarDuration":[514,"progress-bar-duration"],"currentStory":[32],"currentStoryId":[32],"progress":[32],"touchPosStart":[32],"touchPosEnd":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{"clientStyling":["handleStylingUpdate"],"clientStylingUrl":["handleStylingUpdate"],"translationUrl":["handleNewTranslations"],"progress":["handleTimeEnds"]}]]]], options);
19
+ return bootstrapLazy([["general-stories",[[1,"general-stories",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"progressBarDuration":[514,"progress-bar-duration"],"currentStory":[32],"currentStoryId":[32],"progress":[32],"touchPosStart":[32],"touchPosEnd":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"progress":["handleTimeEnds"]}]]]], options);
20
20
  });
@@ -1,5 +1,5 @@
1
1
  const NAMESPACE = 'general-stories';
2
- const BUILD = /* general-stories */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
2
+ const BUILD = /* general-stories */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
3
3
 
4
4
  /*
5
5
  Stencil Client Platform v4.26.0 | MIT Licensed | https://stenciljs.com
@@ -899,12 +899,16 @@ var postUpdateComponent = (hostRef) => {
899
899
  const tagName = hostRef.$cmpMeta$.$tagName$;
900
900
  const elm = hostRef.$hostElement$;
901
901
  const endPostUpdate = createTime("postUpdate", tagName);
902
+ const instance = hostRef.$lazyInstance$ ;
902
903
  const ancestorComponent = hostRef.$ancestorComponent$;
903
904
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
904
905
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
905
906
  {
906
907
  addHydratedFlag(elm);
907
908
  }
909
+ {
910
+ safeCall(instance, "componentDidLoad", void 0, elm);
911
+ }
908
912
  endPostUpdate();
909
913
  {
910
914
  hostRef.$onReadyResolve$(elm);
@@ -1219,6 +1223,9 @@ var connectedCallback = (elm) => {
1219
1223
  }
1220
1224
  };
1221
1225
  var disconnectInstance = (instance, elm) => {
1226
+ {
1227
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1228
+ }
1222
1229
  };
1223
1230
  var disconnectedCallback = async (elm) => {
1224
1231
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
@@ -1229,8 +1236,10 @@ var disconnectedCallback = async (elm) => {
1229
1236
  hostRef.$rmListeners$ = void 0;
1230
1237
  }
1231
1238
  }
1232
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1233
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1239
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1240
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1241
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1242
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1234
1243
  }
1235
1244
  }
1236
1245
  if (rootAppliedStyles.has(elm)) {
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { G as GeneralStories } from './general-stories-9cdd7600.js';
2
- import './index-3d519791.js';
1
+ export { G as GeneralStories } from './general-stories-8ada9aa4.js';
2
+ import './index-95b2d607.js';
@@ -1,11 +1,11 @@
1
- import { b as bootstrapLazy } from './index-3d519791.js';
2
- export { s as setNonce } from './index-3d519791.js';
1
+ import { b as bootstrapLazy } from './index-95b2d607.js';
2
+ export { s as setNonce } from './index-95b2d607.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["general-stories",[[1,"general-stories",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"cmsEnv":[513,"cms-env"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"progressBarDuration":[514,"progress-bar-duration"],"currentStory":[32],"currentStoryId":[32],"progress":[32],"touchPosStart":[32],"touchPosEnd":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{"clientStyling":["handleStylingUpdate"],"clientStylingUrl":["handleStylingUpdate"],"translationUrl":["handleNewTranslations"],"progress":["handleTimeEnds"]}]]]], options);
8
+ return bootstrapLazy([["general-stories",[[1,"general-stories",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"progressBarDuration":[514,"progress-bar-duration"],"currentStory":[32],"currentStoryId":[32],"progress":[32],"touchPosStart":[32],"touchPosEnd":[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"],"progress":["handleTimeEnds"]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1 +1 @@
1
- import{p as t,b as n}from"./p-9be4d8b5.js";export{s as setNonce}from"./p-9be4d8b5.js";import{g as r}from"./p-e1255160.js";(()=>{const n=import.meta.url,r={};return""!==n&&(r.resourcesUrl=new URL(".",n).href),t(r)})().then((async t=>(await r(),n([["p-4cdc6e50",[[1,"general-stories",{cmsEndpoint:[513,"cms-endpoint"],language:[513],cmsEnv:[513,"cms-env"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],progressBarDuration:[514,"progress-bar-duration"],currentStory:[32],currentStoryId:[32],progress:[32],touchPosStart:[32],touchPosEnd:[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{clientStyling:["handleStylingUpdate"],clientStylingUrl:["handleStylingUpdate"],translationUrl:["handleNewTranslations"],progress:["handleTimeEnds"]}]]]],t))));
1
+ import{p as n,b as t}from"./p-56d326ea.js";export{s as setNonce}from"./p-56d326ea.js";import{g as e}from"./p-e1255160.js";(()=>{const t=import.meta.url,e={};return""!==t&&(e.resourcesUrl=new URL(".",t).href),n(e)})().then((async n=>(await e(),t([["p-3e7fe480",[[1,"general-stories",{cmsEndpoint:[513,"cms-endpoint"],language:[513],cmsEnv:[513,"cms-env"],mbSource:[1,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],progressBarDuration:[514,"progress-bar-duration"],currentStory:[32],currentStoryId:[32],progress:[32],touchPosStart:[32],touchPosEnd:[32]},[[1,"touchstart","onTouchStart"],[1,"touchmove","onTouchMove"],[1,"touchend","onTouchEnd"]],{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"],progress:["handleTimeEnds"]}]]]],n))));
@@ -1 +1 @@
1
- export{G as GeneralStories}from"./p-e1e1a6fa.js";import"./p-9be4d8b5.js";
1
+ export{G as GeneralStories}from"./p-004038c9.js";import"./p-56d326ea.js";
@@ -0,0 +1 @@
1
+ import{r as t,h as i}from"./p-56d326ea.js";const e={en:{error:"Error",generalStoriesLoading:"Loading, please wait ...",loadMore:"Load More"},hu:{error:"Hiba",generalStoriesLoading:"Betöltés, kérjük várjon ...",loadMore:"Továbbiak betöltése"},ro:{error:"Eroare",generalStoriesLoading:"Se încarcă, vă rugăm așteptați ...",loadMore:"Încarcă mai multe"},fr:{error:"Erreur",generalStoriesLoading:"Chargement, veuillez patienter ...",loadMore:"Charger plus"},ar:{error:"خطأ",generalStoriesLoading:"جار التحميل، يرجى الانتظار ...",loadMore:"تحميل المزيد"},hr:{error:"Greška",generalStoriesLoading:"Učitavanje, molimo pričekajte ...",loadMore:"Učitaj više"}},o=t=>new Promise((i=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((i=>{e[i]||(e[i]={});for(let o in t[i])e[i][o]=t[i][o]})),i(!0)}))})),r=(t,i)=>e[void 0!==i&&i in e?i:"en"][t];function s(t,i){if(t){const e=document.createElement("style");e.innerHTML=i,t.appendChild(e)}}function n(t,i){const e=new URL(i);fetch(e.href).then((t=>t.text())).then((i=>{const e=document.createElement("style");e.innerHTML=i,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const a=class{constructor(e){t(this,e),this.language="en",this.cmsEnv="stage",this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.progressBarDuration=10,this.hasErrors=!1,this.isLoading=!0,this.isSwipe=!1,this.currentStoryId=null,this.progress=0,this.getStories=()=>{let t=new URL(`${this.cmsEndpoint}/${this.language}/stories`);return t.searchParams.append("env",this.cmsEnv),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"mtWeb"})()),t.searchParams.append("language",this.language),new Promise(((i,e)=>{this.isLoading=!0,fetch(t.href).then((t=>t.json())).then((t=>{this.stories=t,this.stories.forEach((t=>{t.viewed=!1})),this.isLoading=!1,i(!0)})).catch((t=>{console.log(t),this.isLoading=!1,this.hasErrors=!0,e(t)}))}))},this.navigateToExternalStoryLink=()=>{window.postMessage({type:"OpenStoryLink",url:this.currentStory.storyUrl},window.location.href)},this.openFullScreenStory=t=>{this.currentStoryId=t,this.currentStory=this.stories.find((i=>i.id===t)),this.markStoryAsViewed(t),this.startProgress()},this.closeFullScreenView=()=>{this.markStoryAsViewed(this.currentStoryId.toString()),this.currentStoryId=null,this.progress=0,clearInterval(this.intervalId)},this.markStoryAsViewed=t=>{const i=this.stories.findIndex((i=>i.id===t));if(i>-1){const[t]=this.stories.splice(i,1);t.viewed=!0,this.stories=[...this.stories,t]}},this.changeStory=(t,i)=>{const e="next"===i?Number(t.index)+1:Number(t.index)-1;if(e>this.stories.length-1||e<0)this.markStoryAsViewed(t.index),this.closeFullScreenView();else{const t=this.stories.find((t=>t.index===e));this.currentStory=t,this.currentStoryId=t.id,this.progress=0,this.markStoryAsViewed(t.id)}},this.startProgress=()=>{const t=100/(1e3*this.progressBarDuration)*100;this.intervalId=setInterval((()=>{this.progress>=100?clearInterval(this.intervalId):this.progress+=t}),100)},this.Thumbnail=({props:t})=>i("div",{class:"StoryThumbnailContainer "+(t.viewed?"Viewed":"Highlighted"),onTouchStart:()=>this.openFullScreenStory(t.id)},i("img",{class:"StoryThumbnailImage "+(t.viewed?"Viewed":"Highlighted"),src:t.icon,alt:"story-icon"}))}handleClientStylingChange(t,i){t!=i&&s(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!=i&&this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl)}handleNewTranslations(){this.isLoading=!0,o(this.translationUrl).then((()=>{this.isLoading=!1}))}handleTimeEnds(t){t>=100&&this.changeStory(this.currentStory,"next")}async componentWillLoad(){this.cmsEndpoint&&this.language&&await this.getStories(),this.translationUrl.length>2&&await o(this.translationUrl)}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBus?function(t,i){if(window.emMessageBus){const e=document.createElement("style");window.emMessageBus.subscribe(i,(i=>{e.innerHTML=i,t&&t.appendChild(e)}))}}(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&s(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}onTouchStart(t){this.touchPosStart={clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}}onTouchMove(t){this.touchPosEnd={clientX:t.touches[0].clientX,clientY:t.touches[0].clientY},Math.abs(this.touchPosEnd.clientX-this.touchPosStart.clientX)>50&&(this.isSwipe=!0)}onTouchEnd(t){if(this.isSwipe)this.touchPosEnd={clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY},this.changeStory(this.currentStory,this.touchPosEnd.clientX-this.touchPosStart.clientX>0?"previous":"next");else{const i=window.innerWidth;this.changeStory(this.currentStory,t.changedTouches[0].clientX>i/2?"next":"previous")}}render(){return this.hasErrors?i("div",{class:"GeneralStoriesError"},i("div",{class:"Title"},r("error",this.language))):this.isLoading?i("div",{class:"GeneralStoriesLoading"},i("div",{class:"Title"},r("generalStoriesLoading",this.language))):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},this.currentStoryId?i("div",{class:"FullScreenStory"},i("div",{class:"FullScreenHeader"},i("div",{class:"ProgressBarContainer"},i("div",{class:"ProgressBar",style:{width:`${this.progress}%`}})),i("div",{id:"close",class:"CloseStoryButton",onTouchStart:this.closeFullScreenView},i("svg",{fill:"none",stroke:"#ffffff",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})))),"video"===this.currentStory.type?i("video",{autoPlay:!0},i("source",{src:this.currentStory.url,type:"video/mp4"})):i("img",{src:this.currentStory.url,alt:"story-image"}),this.currentStory.storyUrl&&i("div",{class:"LoadMoreButtonBackground"},i("button",{onTouchStart:this.navigateToExternalStoryLink,class:"LoadMoreButton"},r("loadMore",this.language)))):i("div",{class:"ImageContainer"},this.stories.map((t=>i(this.Thumbnail,{props:t})))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"],progress:["handleTimeEnds"]}}};a.style='.ImageContainer{display:flex;flex-direction:row;background-color:var(--emw--color-background, #0E1511);overflow:auto}.StoryThumbnailContainer{margin:5px;position:relative;display:inline-block;border-radius:50%}.StoryThumbnailContainer.Highlighted::before{content:"";position:absolute;border-radius:50%;background:linear-gradient(to bottom, var(--emw--color-primary, #22B04E), var(--emw--color-secondary, #E1A749));top:-3px;left:-3px;width:111%;height:103%}.StoryThumbnailContainer.Viewed::before{content:"";position:absolute;border-radius:50%;height:50px;width:50px;background:var(--emw--color-grey-150, #828282);top:-3px;left:-3px;width:111%;height:103%}.StoryThumbnailImage{height:50px;width:50px;border-radius:50%;position:relative;z-index:1}.StoryThumbnailImage.Highlighted,.StoryThumbnailImage.Viewed{border:2px solid var(--emw--color-white, #ffffff)}.FullScreenHeader{position:fixed;top:0;background:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));top:0px;width:100%;display:flex;flex-direction:column;padding:10px 0;z-index:5;height:30px}.FullScreenHeader .CloseStoryButton{position:absolute;right:0;width:20px;margin-right:20px;margin-top:8px;z-index:50}.FullScreenHeader .ProgressBarContainer{width:90%;height:2px;position:relative;top:0;background-color:var(--emw--color-grey-150, #828282);border-radius:10px;overflow:hidden;margin:0 auto}.FullScreenHeader .ProgressBarContainer .ProgressBar{height:100%;background:var(--emw--color-white, #ffffff);width:0%;transition:width 0.1s linear}.FullScreenStory{position:fixed;top:0;width:100%;height:100%;background-color:var(--emw--color-grey-400, #24211f);display:flex;align-items:center;justify-content:center;overflow:hidden;z-index:300}.FullScreenStory video{height:100vh;width:100vw}.FullScreenStory img{width:100%;height:100%;object-fit:contain}.FullScreenStory .LoadMoreButtonBackground{width:100%;height:15%;background:linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));position:absolute;bottom:0;display:flex;justify-content:center}.FullScreenStory .LoadMoreButtonBackground .LoadMoreButton{width:auto;font-size:var(--emw--font-size-small, 14px);font-family:inherit;background-color:var(--emw--color-grey-50, #F9F8F8);box-shadow:0px 0px 7px 1px var(--emw--color-grey-400, #24211f);color:var(--emw--color-black, #000000);border-radius:50px;position:absolute;bottom:15px;padding:10px 20px}';export{a as G}
@@ -0,0 +1 @@
1
+ export{G as general_stories}from"./p-004038c9.js";import"./p-56d326ea.js";
@@ -0,0 +1,2 @@
1
+ var t=Object.defineProperty,e=new WeakMap,n=t=>e.get(t),o=(t,n)=>{e.set(n.t=t,n)},l=(t,e)=>e in t,s=(t,e)=>(0,console.error)(t,e),i=new Map,r=new Map,c="slot-fb{display:contents}slot-fb[hidden]{display:none}",u="undefined"!=typeof window?window:{},a=u.document||{head:{}},f={o:0,l:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},h=t=>Promise.resolve(t),d=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(t){}return!1})(),p=!1,m=[],v=[],y=(t,e)=>n=>{t.push(n),p||(p=!0,e&&4&f.o?$(b):f.raf(b))},w=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){s(t)}t.length=0},b=()=>{w(m),w(v),(p=m.length>0)&&f.raf(b)},$=t=>h().then(t),g=y(v,!0),S=t=>"object"==(t=typeof t)||"function"===t;function j(t){var e,n,o;return null!=(o=null==(n=null==(e=t.head)?void 0:e.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?o:void 0}((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})({},{err:()=>k,map:()=>E,ok:()=>O,unwrap:()=>M,unwrapErr:()=>x});var O=t=>({isOk:!0,isErr:!1,value:t}),k=t=>({isOk:!1,isErr:!0,value:t});function E(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then((t=>O(t))):O(n)}if(t.isErr)return k(t.value);throw"should never get here"}var C,M=t=>{if(t.isOk)return t.value;throw t.value},x=t=>{if(t.isErr)return t.value;throw t.value},P=(t,e,...n)=>{let o=null,l=!1,s=!1;const i=[],r=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?r(o):null!=o&&"boolean"!=typeof o&&((l="function"!=typeof t&&!S(o))&&(o+=""),l&&s?i[i.length-1].i+=o:i.push(l?A(null,o):o),s=l)};if(r(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}if("function"==typeof t)return t(null===e?{}:e,i,N);const c=A(t,null);return c.u=e,i.length>0&&(c.h=i),c},A=(t,e)=>({o:0,p:t,i:e,m:null,h:null,u:null}),L={},N={forEach:(t,e)=>t.map(R).forEach(e),map:(t,e)=>t.map(R).map(e).map(T)},R=t=>({vattrs:t.u,vchildren:t.h,vkey:t.v,vname:t.$,vtag:t.p,vtext:t.i}),T=t=>{if("function"==typeof t.vtag){const e={...t.vattrs};return t.vkey&&(e.key=t.vkey),t.vname&&(e.name=t.vname),P(t.vtag,e,...t.vchildren||[])}const e=A(t.vtag,t.vtext);return e.u=t.vattrs,e.h=t.vchildren,e.v=t.vkey,e.$=t.vname,e},D=(t,e)=>null==t||S(t)?t:2&e?parseFloat(t):1&e?t+"":t,F=new WeakMap,H=t=>"sc-"+t.S,U=(t,e,n,o,s,i)=>{if(n!==o){let r=l(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList,l=V(n);let s=V(o);e.remove(...l.filter((t=>t&&!s.includes(t)))),e.add(...s.filter((t=>t&&!l.includes(t))))}else if("style"===e){for(const e in n)o&&null!=o[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in o)n&&o[e]===n[e]||(e.includes("-")?t.style.setProperty(e,o[e]):t.style[e]=o[e])}else if("ref"===e)o&&o(t);else if(r||"o"!==e[0]||"n"!==e[1]){const l=S(o);if((r||l&&null!==o)&&!s)try{if(t.tagName.includes("-"))t[e]!==o&&(t[e]=o);else{const l=null==o?"":o;"list"===e?r=!1:null!=n&&t[e]==l||("function"==typeof t.__lookupSetter__(e)?t[e]=l:t.setAttribute(e,l))}}catch(t){}null==o||!1===o?!1===o&&""!==t.getAttribute(e)||t.removeAttribute(e):(!r||4&i||s)&&!l&&t.setAttribute(e,o=!0===o?"":o)}else if(e="-"===e[2]?e.slice(3):l(u,c)?c.slice(2):c[2]+e.slice(3),n||o){const l=e.endsWith(q);e=e.replace(G,""),n&&f.rel(t,e,n,l),o&&f.ael(t,e,o,l)}}},W=/\s/,V=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(W):[]),q="Capture",G=RegExp(q+"$"),_=(t,e,n)=>{const o=11===e.m.nodeType&&e.m.host?e.m.host:e.m,l=t&&t.u||{},s=e.u||{};for(const t of z(Object.keys(l)))t in s||U(o,t,l[t],void 0,n,e.o);for(const t of z(Object.keys(s)))U(o,t,l[t],s[t],n,e.o)};function z(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var B=!1,I=(t,e,n)=>{const o=e.h[n];let l,s,i=0;if(null!==o.i)l=o.m=a.createTextNode(o.i);else{if(B||(B="svg"===o.p),l=o.m=a.createElementNS(B?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.p),B&&"foreignObject"===o.p&&(B=!1),_(null,o,B),o.h)for(i=0;i<o.h.length;++i)s=I(t,o,i),s&&l.appendChild(s);"svg"===o.p?B=!1:"foreignObject"===l.tagName&&(B=!0)}return l["s-hn"]=C,l},J=(t,e,n,o,l,s)=>{let i,r=t;for(r.shadowRoot&&r.tagName===C&&(r=r.shadowRoot);l<=s;++l)o[l]&&(i=I(null,n,l),i&&(o[l].m=i,Z(r,i,e)))},K=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.m;Y(e),t&&t.remove()}}},Q=(t,e,n=!1)=>t.p===e.p&&(n&&!t.v&&e.v&&(t.v=e.v),!0),X=(t,e,n=!1)=>{const o=e.m=t.m,l=t.h,s=e.h,i=e.p,r=e.i;null===r?(_(t,e,B="svg"===i||"foreignObject"!==i&&B),null!==l&&null!==s?((t,e,n,o,l=!1)=>{let s,i=0,r=0,c=e.length-1,u=e[0],a=e[c],f=o.length-1,h=o[0],d=o[f];for(;i<=c&&r<=f;)null==u?u=e[++i]:null==a?a=e[--c]:null==h?h=o[++r]:null==d?d=o[--f]:Q(u,h,l)?(X(u,h,l),u=e[++i],h=o[++r]):Q(a,d,l)?(X(a,d,l),a=e[--c],d=o[--f]):Q(u,d,l)?(X(u,d,l),Z(t,u.m,a.m.nextSibling),u=e[++i],d=o[--f]):Q(a,h,l)?(X(a,h,l),Z(t,a.m,u.m),a=e[--c],h=o[++r]):(s=I(e&&e[r],n,r),h=o[++r],s&&Z(u.m.parentNode,s,u.m));i>c?J(t,null==o[f+1]?null:o[f+1].m,n,o,r,f):r>f&&K(e,i,c)})(o,l,e,s,n):null!==s?(null!==t.i&&(o.textContent=""),J(o,null,e,s,0,s.length-1)):!n&&null!==l&&K(l,0,l.length-1),B&&"svg"===i&&(B=!1)):t.i!==r&&(o.data=r)},Y=t=>{t.u&&t.u.ref&&t.u.ref(null),t.h&&t.h.map(Y)},Z=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),tt=(t,e)=>{if(e&&!t.j&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.j=()=>{e["s-p"].splice(n-1,1),o()})))}},et=(t,e)=>{if(t.o|=16,!(4&t.o))return tt(t,t.O),g((()=>nt(t,e)));t.o|=512},nt=(t,e)=>{const n=t.$hostElement$,o=t.t;if(!o)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return e&&(t.o|=256,t.k&&(t.k.map((([t,e])=>ut(o,t,e,n))),t.k=void 0),l=ut(o,"componentWillLoad",void 0,n)),ot(l,(()=>st(t,o,e)))},ot=(t,e)=>lt(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),lt=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,st=async(t,e,n)=>{var o;const l=t.$hostElement$,s=l["s-rc"];n&&(t=>{const e=t.C,n=t.$hostElement$,o=e.o,l=((t,e)=>{var n;const o=H(e),l=r.get(o);if(t=11===t.nodeType?t:a,l)if("string"==typeof l){let s,i=F.get(t=t.head||t);if(i||F.set(t,i=new Set),!i.has(o)){{s=document.querySelector(`[sty-id="${o}"]`)||a.createElement("style"),s.innerHTML=l;const i=null!=(n=f.M)?n:j(a);if(null!=i&&s.setAttribute("nonce",i),!(1&e.o))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(s,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(d){const e=new CSSStyleSheet;e.replaceSync(l),t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.innerHTML=l+e.innerHTML:t.prepend(s)}else t.append(s);1&e.o&&t.insertBefore(s,null)}4&e.o&&(s.innerHTML+=c),i&&i.add(o)}}else t.adoptedStyleSheets.includes(l)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,l]);return o})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);(10&o&&2&o||128&o)&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);it(t,e,l,n),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>rt(t);0===e.length?n():(Promise.all(e).then(n),t.o|=4,e.length=0)}},it=(t,e,n,o)=>{try{e=e.render(),t.o&=-17,t.o|=2,((t,e,n=!1)=>{const o=t.$hostElement$,l=t.C,s=t.P||A(null,null),i=(t=>t&&t.p===L)(e)?e:P(null,null,e);if(C=o.tagName,l.A&&(i.u=i.u||{},l.A.map((([t,e])=>i.u[e]=o[t]))),n&&i.u)for(const t of Object.keys(i.u))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(i.u[t]=o[t]);i.p=null,i.o|=4,t.P=i,i.m=s.m=o.shadowRoot||o,X(s,i,n)})(t,e,o)}catch(e){s(e,t.$hostElement$)}return null},rt=t=>{const e=t.$hostElement$,n=t.t,o=t.O;64&t.o||(t.o|=64,at(e),ut(n,"componentDidLoad",void 0,e),t.L(e),o||ct()),t.j&&(t.j(),t.j=void 0),512&t.o&&$((()=>et(t,!1))),t.o&=-517},ct=()=>{$((()=>(t=>{const e=f.ce("appload",{detail:{namespace:"general-stories"}});return t.dispatchEvent(e),e})(u)))},ut=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){s(t,o)}},at=t=>t.classList.add("hydrated"),ft=(t,e,o,l)=>{const i=n(t);if(!i)throw Error(`Couldn't find host element for "${l.S}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const r=i.$hostElement$,c=i.N.get(e),u=i.o,a=i.t;if(o=D(o,l.R[e][0]),(!(8&u)||void 0===c)&&o!==c&&(!Number.isNaN(c)||!Number.isNaN(o))&&(i.N.set(e,o),a)){if(l.T&&128&u){const t=l.T[e];t&&t.map((t=>{try{a[t](o,c,e)}catch(t){s(t,r)}}))}2==(18&u)&&et(i,!1)}},ht=(t,e,o)=>{var l,s;const i=t.prototype;if(e.R||e.T||t.watchers){t.watchers&&!e.T&&(e.T=t.watchers);const r=Object.entries(null!=(l=e.R)?l:{});if(r.map((([t,[l]])=>{if(31&l||2&o&&32&l){const{get:s,set:r}=Object.getOwnPropertyDescriptor(i,t)||{};s&&(e.R[t][0]|=2048),r&&(e.R[t][0]|=4096),(1&o||!s)&&Object.defineProperty(i,t,{get(){{if(!(2048&e.R[t][0]))return((t,e)=>n(this).N.get(e))(0,t);const o=n(this),l=o?o.t:i;if(!l)return;return l[t]}},configurable:!0,enumerable:!0}),Object.defineProperty(i,t,{set(s){const i=n(this);if(r){const n=32&l?this[t]:i.$hostElement$[t];return void 0===n&&i.N.get(t)?s=i.N.get(t):!i.N.get(t)&&n&&i.N.set(t,n),r.call(this,D(s,l)),void ft(this,t,s=32&l?this[t]:i.$hostElement$[t],e)}{if(!(1&o&&4096&e.R[t][0]))return ft(this,t,s,e),void(1&o&&!i.t&&i.D.then((()=>{4096&e.R[t][0]&&i.t[t]!==i.N.get(t)&&(i.t[t]=s)})));const n=()=>{const n=i.t[t];!i.N.get(t)&&n&&i.N.set(t,n),i.t[t]=D(s,l),ft(this,t,i.t[t],e)};i.t?n():i.D.then((()=>n()))}}})}})),1&o){const o=new Map;i.attributeChangedCallback=function(t,l,s){f.jmp((()=>{var r;const c=o.get(t);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(i.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const o=n(this),i=null==o?void 0:o.o;if(i&&!(8&i)&&128&i&&s!==l){const n=o.t,i=null==(r=e.T)?void 0:r[t];null==i||i.forEach((e=>{null!=n[e]&&n[e].call(n,s,l,t)}))}return}}const u=Object.getOwnPropertyDescriptor(i,c);(s=(null!==s||"boolean"!=typeof this[c])&&s)===this[c]||u.get&&!u.set||(this[c]=s)}))},t.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=e.T)?s:{}),...r.filter((([t,e])=>15&e[0])).map((([t,n])=>{var l;const s=n[1]||t;return o.set(s,t),512&n[0]&&(null==(l=e.A)||l.push([t,s])),s}))]))}}return t},dt=(t,e)=>{ut(t,"disconnectedCallback",void 0,e||t)},pt=(t,o={})=>{var l;const h=[],p=o.exclude||[],m=u.customElements,v=a.head,y=v.querySelector("meta[charset]"),w=a.createElement("style"),b=[];let $,g=!0;Object.assign(f,o),f.l=new URL(o.resourcesUrl||"./",a.baseURI).href;let S=!1;if(t.map((t=>{t[1].map((o=>{var l;const c={o:o[0],S:o[1],R:o[2],F:o[3]};4&c.o&&(S=!0),c.R=o[2],c.F=o[3],c.A=[],c.T=null!=(l=o[4])?l:{};const u=c.S,a=class extends HTMLElement{constructor(t){if(super(t),this.hasRegisteredEventListeners=!1,((t,n)=>{const o={o:0,$hostElement$:t,C:n,N:new Map};o.D=new Promise((t=>o.L=t)),t["s-p"]=[],t["s-rc"]=[],e.set(t,o)})(t=this,c),1&c.o)if(t.shadowRoot){if("open"!==t.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.S}! Mode is set to ${t.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else t.attachShadow({mode:"open"})}connectedCallback(){const t=n(this);this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,mt(this,t,c.F)),$&&(clearTimeout($),$=null),g?b.push(this):f.jmp((()=>(t=>{if(!(1&f.o)){const e=n(t),o=e.C,l=()=>{};if(1&e.o)mt(t,e,o.F),(null==e?void 0:e.t)||(null==e?void 0:e.D)&&e.D.then((()=>{}));else{e.o|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){tt(e,e.O=n);break}}o.R&&Object.entries(o.R).map((([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n)=>{let o;if(!(32&e.o)){if(e.o|=32,n.H){const l=((t,e)=>{const n=t.S.replace(/-/g,"_"),o=t.H;if(!o)return;const l=i.get(o);return l?l[n]:import(`./${o}.entry.js`).then((t=>(i.set(o,t),t[n])),(t=>{s(t,e.$hostElement$)}))
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n,e);if(l&&"then"in l){const t=()=>{};o=await l,t()}else o=l;if(!o)throw Error(`Constructor for "${n.S}#${e.U}" was not found`);o.isProxied||(n.T=o.watchers,ht(o,n,2),o.isProxied=!0);const r=()=>{};e.o|=8;try{new o(e)}catch(e){s(e,t)}e.o&=-9,e.o|=128,r()}else o=t.constructor,customElements.whenDefined(t.localName).then((()=>e.o|=128));if(o&&o.style){let t;"string"==typeof o.style&&(t=o.style);const e=H(n);if(!r.has(e)){const o=()=>{};((t,e,n)=>{let o=r.get(t);d&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,r.set(t,o)})(e,t,!!(1&n.o)),o()}}}const l=e.O,c=()=>et(e,!0);l&&l["s-rc"]?l["s-rc"].push(c):c()})(t,e,o)}l()}})(this)))}disconnectedCallback(){f.jmp((()=>(async t=>{if(!(1&f.o)){const e=n(t);e.W&&(e.W.map((t=>t())),e.W=void 0),(null==e?void 0:e.t)?dt(e.t,t):(null==e?void 0:e.D)&&e.D.then((()=>dt(e.t,t)))}F.has(t)&&F.delete(t),t.shadowRoot&&F.has(t.shadowRoot)&&F.delete(t.shadowRoot)})(this))),f.raf((()=>{var t;const e=n(this),o=b.findIndex((t=>t===this));o>-1&&b.splice(o,1),(null==(t=null==e?void 0:e.P)?void 0:t.m)instanceof Node&&!e.P.m.isConnected&&delete e.P.m}))}componentOnReady(){return n(this).D}};c.H=t[0],p.includes(u)||m.get(u)||(h.push(u),m.define(u,ht(a,c,1)))}))})),h.length>0&&(S&&(w.textContent+=c),w.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",w.innerHTML.length)){w.setAttribute("data-styles","");const t=null!=(l=f.M)?l:j(a);null!=t&&w.setAttribute("nonce",t),v.insertBefore(w,y?y.nextSibling:v.firstChild)}g=!1,b.length?b.map((t=>t.connectedCallback())):f.jmp((()=>$=setTimeout(ct,30)))},mt=(t,e,n)=>{n&&n.map((([n,o,l])=>{const s=t,i=vt(e,l),r=yt(n);f.ael(s,o,i,r),(e.W=e.W||[]).push((()=>f.rel(s,o,i,r)))}))},vt=(t,e)=>n=>{var o;try{256&t.o?null==(o=t.t)||o[e](n):(t.k=t.k||[]).push([e,n])}catch(e){s(e,t.$hostElement$)}},yt=t=>({passive:!!(1&t),capture:!!(2&t)}),wt=t=>f.M=t;export{pt as b,P as h,h as p,o as r,wt as s}
@@ -12,6 +12,10 @@ export declare class GeneralStories {
12
12
  * CMS Endpoint stage
13
13
  */
14
14
  cmsEnv: string;
15
+ /**
16
+ * Client custom styling via streamStyling
17
+ */
18
+ mbSource: string;
15
19
  /**
16
20
  * Client custom styling via string
17
21
  */
@@ -29,6 +33,7 @@ export declare class GeneralStories {
29
33
  */
30
34
  progressBarDuration: number;
31
35
  private stylingContainer;
36
+ private stylingSubscription;
32
37
  private stories;
33
38
  intervalId: ReturnType<typeof setInterval>;
34
39
  hasErrors: boolean;
@@ -45,13 +50,14 @@ export declare class GeneralStories {
45
50
  clientX: number;
46
51
  clientY: number;
47
52
  };
48
- handleStylingUpdate(): void;
53
+ handleClientStylingChange(newValue: any, oldValue: any): void;
54
+ handleClientStylingChangeURL(newValue: any, oldValue: any): void;
49
55
  handleNewTranslations(): void;
50
56
  handleTimeEnds(newValue: number): void;
51
57
  componentWillLoad(): Promise<void>;
52
58
  getStories: () => Promise<any>;
53
- setClientStyling: () => void;
54
- setClientStylingURL: () => void;
59
+ componentDidLoad(): void;
60
+ disconnectedCallback(): void;
55
61
  navigateToExternalStoryLink: () => void;
56
62
  openFullScreenStory: (id: any) => void;
57
63
  closeFullScreenView: () => void;
@@ -27,6 +27,10 @@ export namespace Components {
27
27
  * Language of the widget
28
28
  */
29
29
  "language": string;
30
+ /**
31
+ * Client custom styling via streamStyling
32
+ */
33
+ "mbSource": string;
30
34
  /**
31
35
  * Duration of progress bar
32
36
  */
@@ -70,6 +74,10 @@ declare namespace LocalJSX {
70
74
  * Language of the widget
71
75
  */
72
76
  "language"?: string;
77
+ /**
78
+ * Client custom styling via streamStyling
79
+ */
80
+ "mbSource"?: string;
73
81
  /**
74
82
  * Duration of progress bar
75
83
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-stories",
3
- "version": "1.54.12",
3
+ "version": "1.56.0",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- export{G as general_stories}from"./p-e1e1a6fa.js";import"./p-9be4d8b5.js";
@@ -1,2 +0,0 @@
1
- var t=Object.defineProperty,e=new WeakMap,n=t=>e.get(t),o=(t,n)=>{e.set(n.t=t,n)},l=(t,e)=>e in t,s=(t,e)=>(0,console.error)(t,e),i=new Map,r=new Map,c="slot-fb{display:contents}slot-fb[hidden]{display:none}",u="undefined"!=typeof window?window:{},a=u.document||{head:{}},f={o:0,l:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},h=t=>Promise.resolve(t),p=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(t){}return!1})(),d=!1,m=[],v=[],y=(t,e)=>n=>{t.push(n),d||(d=!0,e&&4&f.o?$(b):f.raf(b))},w=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){s(t)}t.length=0},b=()=>{w(m),w(v),(d=m.length>0)&&f.raf(b)},$=t=>h().then(t),g=y(v,!0),S=t=>"object"==(t=typeof t)||"function"===t;function j(t){var e,n,o;return null!=(o=null==(n=null==(e=t.head)?void 0:e.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?o:void 0}((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})({},{err:()=>E,map:()=>k,ok:()=>O,unwrap:()=>M,unwrapErr:()=>x});var O=t=>({isOk:!0,isErr:!1,value:t}),E=t=>({isOk:!1,isErr:!0,value:t});function k(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then((t=>O(t))):O(n)}if(t.isErr)return E(t.value);throw"should never get here"}var C,M=t=>{if(t.isOk)return t.value;throw t.value},x=t=>{if(t.isErr)return t.value;throw t.value},P=(t,e,...n)=>{let o=null,l=!1,s=!1;const i=[],r=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?r(o):null!=o&&"boolean"!=typeof o&&((l="function"!=typeof t&&!S(o))&&(o+=""),l&&s?i[i.length-1].i+=o:i.push(l?A(null,o):o),s=l)};if(r(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}if("function"==typeof t)return t(null===e?{}:e,i,R);const c=A(t,null);return c.u=e,i.length>0&&(c.h=i),c},A=(t,e)=>({o:0,p:t,i:e,m:null,h:null,u:null}),N={},R={forEach:(t,e)=>t.map(T).forEach(e),map:(t,e)=>t.map(T).map(e).map(F)},T=t=>({vattrs:t.u,vchildren:t.h,vkey:t.v,vname:t.$,vtag:t.p,vtext:t.i}),F=t=>{if("function"==typeof t.vtag){const e={...t.vattrs};return t.vkey&&(e.key=t.vkey),t.vname&&(e.name=t.vname),P(t.vtag,e,...t.vchildren||[])}const e=A(t.vtag,t.vtext);return e.u=t.vattrs,e.h=t.vchildren,e.v=t.vkey,e.$=t.vname,e},H=(t,e)=>null==t||S(t)?t:2&e?parseFloat(t):1&e?t+"":t,L=new WeakMap,U=t=>"sc-"+t.S,W=(t,e,n,o,s,i)=>{if(n!==o){let r=l(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList,l=V(n);let s=V(o);e.remove(...l.filter((t=>t&&!s.includes(t)))),e.add(...s.filter((t=>t&&!l.includes(t))))}else if("style"===e){for(const e in n)o&&null!=o[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in o)n&&o[e]===n[e]||(e.includes("-")?t.style.setProperty(e,o[e]):t.style[e]=o[e])}else if("ref"===e)o&&o(t);else if(r||"o"!==e[0]||"n"!==e[1]){const l=S(o);if((r||l&&null!==o)&&!s)try{if(t.tagName.includes("-"))t[e]!==o&&(t[e]=o);else{const l=null==o?"":o;"list"===e?r=!1:null!=n&&t[e]==l||("function"==typeof t.__lookupSetter__(e)?t[e]=l:t.setAttribute(e,l))}}catch(t){}null==o||!1===o?!1===o&&""!==t.getAttribute(e)||t.removeAttribute(e):(!r||4&i||s)&&!l&&t.setAttribute(e,o=!0===o?"":o)}else if(e="-"===e[2]?e.slice(3):l(u,c)?c.slice(2):c[2]+e.slice(3),n||o){const l=e.endsWith(q);e=e.replace(G,""),n&&f.rel(t,e,n,l),o&&f.ael(t,e,o,l)}}},D=/\s/,V=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(D):[]),q="Capture",G=RegExp(q+"$"),_=(t,e,n)=>{const o=11===e.m.nodeType&&e.m.host?e.m.host:e.m,l=t&&t.u||{},s=e.u||{};for(const t of z(Object.keys(l)))t in s||W(o,t,l[t],void 0,n,e.o);for(const t of z(Object.keys(s)))W(o,t,l[t],s[t],n,e.o)};function z(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var B=!1,I=(t,e,n)=>{const o=e.h[n];let l,s,i=0;if(null!==o.i)l=o.m=a.createTextNode(o.i);else{if(B||(B="svg"===o.p),l=o.m=a.createElementNS(B?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.p),B&&"foreignObject"===o.p&&(B=!1),_(null,o,B),o.h)for(i=0;i<o.h.length;++i)s=I(t,o,i),s&&l.appendChild(s);"svg"===o.p?B=!1:"foreignObject"===l.tagName&&(B=!0)}return l["s-hn"]=C,l},J=(t,e,n,o,l,s)=>{let i,r=t;for(r.shadowRoot&&r.tagName===C&&(r=r.shadowRoot);l<=s;++l)o[l]&&(i=I(null,n,l),i&&(o[l].m=i,Z(r,i,e)))},K=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.m;Y(e),t&&t.remove()}}},Q=(t,e,n=!1)=>t.p===e.p&&(n&&!t.v&&e.v&&(t.v=e.v),!0),X=(t,e,n=!1)=>{const o=e.m=t.m,l=t.h,s=e.h,i=e.p,r=e.i;null===r?(_(t,e,B="svg"===i||"foreignObject"!==i&&B),null!==l&&null!==s?((t,e,n,o,l=!1)=>{let s,i=0,r=0,c=e.length-1,u=e[0],a=e[c],f=o.length-1,h=o[0],p=o[f];for(;i<=c&&r<=f;)null==u?u=e[++i]:null==a?a=e[--c]:null==h?h=o[++r]:null==p?p=o[--f]:Q(u,h,l)?(X(u,h,l),u=e[++i],h=o[++r]):Q(a,p,l)?(X(a,p,l),a=e[--c],p=o[--f]):Q(u,p,l)?(X(u,p,l),Z(t,u.m,a.m.nextSibling),u=e[++i],p=o[--f]):Q(a,h,l)?(X(a,h,l),Z(t,a.m,u.m),a=e[--c],h=o[++r]):(s=I(e&&e[r],n,r),h=o[++r],s&&Z(u.m.parentNode,s,u.m));i>c?J(t,null==o[f+1]?null:o[f+1].m,n,o,r,f):r>f&&K(e,i,c)})(o,l,e,s,n):null!==s?(null!==t.i&&(o.textContent=""),J(o,null,e,s,0,s.length-1)):!n&&null!==l&&K(l,0,l.length-1),B&&"svg"===i&&(B=!1)):t.i!==r&&(o.data=r)},Y=t=>{t.u&&t.u.ref&&t.u.ref(null),t.h&&t.h.map(Y)},Z=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),tt=(t,e)=>{if(e&&!t.j&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.j=()=>{e["s-p"].splice(n-1,1),o()})))}},et=(t,e)=>{if(t.o|=16,!(4&t.o))return tt(t,t.O),g((()=>nt(t,e)));t.o|=512},nt=(t,e)=>{const n=t.$hostElement$,o=t.t;if(!o)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return e&&(t.o|=256,t.k&&(t.k.map((([t,e])=>ut(o,t,e,n))),t.k=void 0),l=ut(o,"componentWillLoad",void 0,n)),ot(l,(()=>st(t,o,e)))},ot=(t,e)=>lt(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),lt=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,st=async(t,e,n)=>{var o;const l=t.$hostElement$,s=l["s-rc"];n&&(t=>{const e=t.C,n=t.$hostElement$,o=e.o,l=((t,e)=>{var n;const o=U(e),l=r.get(o);if(t=11===t.nodeType?t:a,l)if("string"==typeof l){let s,i=L.get(t=t.head||t);if(i||L.set(t,i=new Set),!i.has(o)){{s=document.querySelector(`[sty-id="${o}"]`)||a.createElement("style"),s.innerHTML=l;const i=null!=(n=f.M)?n:j(a);if(null!=i&&s.setAttribute("nonce",i),!(1&e.o))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(s,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(p){const e=new CSSStyleSheet;e.replaceSync(l),t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.innerHTML=l+e.innerHTML:t.prepend(s)}else t.append(s);1&e.o&&t.insertBefore(s,null)}4&e.o&&(s.innerHTML+=c),i&&i.add(o)}}else t.adoptedStyleSheets.includes(l)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,l]);return o})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);(10&o&&2&o||128&o)&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);it(t,e,l,n),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>rt(t);0===e.length?n():(Promise.all(e).then(n),t.o|=4,e.length=0)}},it=(t,e,n,o)=>{try{e=e.render(),t.o&=-17,t.o|=2,((t,e,n=!1)=>{const o=t.$hostElement$,l=t.C,s=t.P||A(null,null),i=(t=>t&&t.p===N)(e)?e:P(null,null,e);if(C=o.tagName,l.A&&(i.u=i.u||{},l.A.map((([t,e])=>i.u[e]=o[t]))),n&&i.u)for(const t of Object.keys(i.u))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(i.u[t]=o[t]);i.p=null,i.o|=4,t.P=i,i.m=s.m=o.shadowRoot||o,X(s,i,n)})(t,e,o)}catch(e){s(e,t.$hostElement$)}return null},rt=t=>{const e=t.$hostElement$,n=t.O;64&t.o||(t.o|=64,at(e),t.N(e),n||ct()),t.j&&(t.j(),t.j=void 0),512&t.o&&$((()=>et(t,!1))),t.o&=-517},ct=()=>{$((()=>(t=>{const e=f.ce("appload",{detail:{namespace:"general-stories"}});return t.dispatchEvent(e),e})(u)))},ut=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){s(t,o)}},at=t=>t.classList.add("hydrated"),ft=(t,e,o,l)=>{const i=n(t);if(!i)throw Error(`Couldn't find host element for "${l.S}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const r=i.$hostElement$,c=i.R.get(e),u=i.o,a=i.t;if(o=H(o,l.T[e][0]),(!(8&u)||void 0===c)&&o!==c&&(!Number.isNaN(c)||!Number.isNaN(o))&&(i.R.set(e,o),a)){if(l.F&&128&u){const t=l.F[e];t&&t.map((t=>{try{a[t](o,c,e)}catch(t){s(t,r)}}))}2==(18&u)&&et(i,!1)}},ht=(t,e,o)=>{var l,s;const i=t.prototype;if(e.T||e.F||t.watchers){t.watchers&&!e.F&&(e.F=t.watchers);const r=Object.entries(null!=(l=e.T)?l:{});if(r.map((([t,[l]])=>{if(31&l||2&o&&32&l){const{get:s,set:r}=Object.getOwnPropertyDescriptor(i,t)||{};s&&(e.T[t][0]|=2048),r&&(e.T[t][0]|=4096),(1&o||!s)&&Object.defineProperty(i,t,{get(){{if(!(2048&e.T[t][0]))return((t,e)=>n(this).R.get(e))(0,t);const o=n(this),l=o?o.t:i;if(!l)return;return l[t]}},configurable:!0,enumerable:!0}),Object.defineProperty(i,t,{set(s){const i=n(this);if(r){const n=32&l?this[t]:i.$hostElement$[t];return void 0===n&&i.R.get(t)?s=i.R.get(t):!i.R.get(t)&&n&&i.R.set(t,n),r.call(this,H(s,l)),void ft(this,t,s=32&l?this[t]:i.$hostElement$[t],e)}{if(!(1&o&&4096&e.T[t][0]))return ft(this,t,s,e),void(1&o&&!i.t&&i.H.then((()=>{4096&e.T[t][0]&&i.t[t]!==i.R.get(t)&&(i.t[t]=s)})));const n=()=>{const n=i.t[t];!i.R.get(t)&&n&&i.R.set(t,n),i.t[t]=H(s,l),ft(this,t,i.t[t],e)};i.t?n():i.H.then((()=>n()))}}})}})),1&o){const o=new Map;i.attributeChangedCallback=function(t,l,s){f.jmp((()=>{var r;const c=o.get(t);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(i.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const o=n(this),i=null==o?void 0:o.o;if(i&&!(8&i)&&128&i&&s!==l){const n=o.t,i=null==(r=e.F)?void 0:r[t];null==i||i.forEach((e=>{null!=n[e]&&n[e].call(n,s,l,t)}))}return}}const u=Object.getOwnPropertyDescriptor(i,c);(s=(null!==s||"boolean"!=typeof this[c])&&s)===this[c]||u.get&&!u.set||(this[c]=s)}))},t.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=e.F)?s:{}),...r.filter((([t,e])=>15&e[0])).map((([t,n])=>{var l;const s=n[1]||t;return o.set(s,t),512&n[0]&&(null==(l=e.A)||l.push([t,s])),s}))]))}}return t},pt=(t,o={})=>{var l;const h=[],d=o.exclude||[],m=u.customElements,v=a.head,y=v.querySelector("meta[charset]"),w=a.createElement("style"),b=[];let $,g=!0;Object.assign(f,o),f.l=new URL(o.resourcesUrl||"./",a.baseURI).href;let S=!1;if(t.map((t=>{t[1].map((o=>{var l;const c={o:o[0],S:o[1],T:o[2],L:o[3]};4&c.o&&(S=!0),c.T=o[2],c.L=o[3],c.A=[],c.F=null!=(l=o[4])?l:{};const u=c.S,a=class extends HTMLElement{constructor(t){if(super(t),this.hasRegisteredEventListeners=!1,((t,n)=>{const o={o:0,$hostElement$:t,C:n,R:new Map};o.H=new Promise((t=>o.N=t)),t["s-p"]=[],t["s-rc"]=[],e.set(t,o)})(t=this,c),1&c.o)if(t.shadowRoot){if("open"!==t.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.S}! Mode is set to ${t.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else t.attachShadow({mode:"open"})}connectedCallback(){const t=n(this);this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,dt(this,t,c.L)),$&&(clearTimeout($),$=null),g?b.push(this):f.jmp((()=>(t=>{if(!(1&f.o)){const e=n(t),o=e.C,l=()=>{};if(1&e.o)dt(t,e,o.L),(null==e?void 0:e.t)||(null==e?void 0:e.H)&&e.H.then((()=>{}));else{e.o|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){tt(e,e.O=n);break}}o.T&&Object.entries(o.T).map((([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n)=>{let o;if(!(32&e.o)){if(e.o|=32,n.U){const l=((t,e)=>{const n=t.S.replace(/-/g,"_"),o=t.U;if(!o)return;const l=i.get(o);return l?l[n]:import(`./${o}.entry.js`).then((t=>(i.set(o,t),t[n])),(t=>{s(t,e.$hostElement$)}))
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n,e);if(l&&"then"in l){const t=()=>{};o=await l,t()}else o=l;if(!o)throw Error(`Constructor for "${n.S}#${e.W}" was not found`);o.isProxied||(n.F=o.watchers,ht(o,n,2),o.isProxied=!0);const r=()=>{};e.o|=8;try{new o(e)}catch(e){s(e,t)}e.o&=-9,e.o|=128,r()}else o=t.constructor,customElements.whenDefined(t.localName).then((()=>e.o|=128));if(o&&o.style){let t;"string"==typeof o.style&&(t=o.style);const e=U(n);if(!r.has(e)){const o=()=>{};((t,e,n)=>{let o=r.get(t);p&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,r.set(t,o)})(e,t,!!(1&n.o)),o()}}}const l=e.O,c=()=>et(e,!0);l&&l["s-rc"]?l["s-rc"].push(c):c()})(t,e,o)}l()}})(this)))}disconnectedCallback(){f.jmp((()=>(async t=>{if(!(1&f.o)){const e=n(t);e.D&&(e.D.map((t=>t())),e.D=void 0),(null==e?void 0:e.t)||(null==e?void 0:e.H)&&e.H.then((()=>{}))}L.has(t)&&L.delete(t),t.shadowRoot&&L.has(t.shadowRoot)&&L.delete(t.shadowRoot)})(this))),f.raf((()=>{var t;const e=n(this),o=b.findIndex((t=>t===this));o>-1&&b.splice(o,1),(null==(t=null==e?void 0:e.P)?void 0:t.m)instanceof Node&&!e.P.m.isConnected&&delete e.P.m}))}componentOnReady(){return n(this).H}};c.U=t[0],d.includes(u)||m.get(u)||(h.push(u),m.define(u,ht(a,c,1)))}))})),h.length>0&&(S&&(w.textContent+=c),w.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",w.innerHTML.length)){w.setAttribute("data-styles","");const t=null!=(l=f.M)?l:j(a);null!=t&&w.setAttribute("nonce",t),v.insertBefore(w,y?y.nextSibling:v.firstChild)}g=!1,b.length?b.map((t=>t.connectedCallback())):f.jmp((()=>$=setTimeout(ct,30)))},dt=(t,e,n)=>{n&&n.map((([n,o,l])=>{const s=t,i=mt(e,l),r=vt(n);f.ael(s,o,i,r),(e.D=e.D||[]).push((()=>f.rel(s,o,i,r)))}))},mt=(t,e)=>n=>{var o;try{256&t.o?null==(o=t.t)||o[e](n):(t.k=t.k||[]).push([e,n])}catch(e){s(e,t.$hostElement$)}},vt=t=>({passive:!!(1&t),capture:!!(2&t)}),yt=t=>f.M=t;export{pt as b,P as h,h as p,o as r,yt as s}
@@ -1 +0,0 @@
1
- import{r as t,h as i}from"./p-9be4d8b5.js";const e={en:{error:"Error",generalStoriesLoading:"Loading, please wait ...",loadMore:"Load More"},hu:{error:"Hiba",generalStoriesLoading:"Betöltés, kérjük várjon ...",loadMore:"Továbbiak betöltése"},ro:{error:"Eroare",generalStoriesLoading:"Se încarcă, vă rugăm așteptați ...",loadMore:"Încarcă mai multe"},fr:{error:"Erreur",generalStoriesLoading:"Chargement, veuillez patienter ...",loadMore:"Charger plus"},ar:{error:"خطأ",generalStoriesLoading:"جار التحميل، يرجى الانتظار ...",loadMore:"تحميل المزيد"},hr:{error:"Greška",generalStoriesLoading:"Učitavanje, molimo pričekajte ...",loadMore:"Učitaj više"}},o=t=>new Promise((i=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((i=>{e[i]||(e[i]={});for(let o in t[i])e[i][o]=t[i][o]})),i(!0)}))})),r=(t,i)=>e[void 0!==i&&i in e?i:"en"][t],s=class{constructor(e){t(this,e),this.language="en",this.cmsEnv="stage",this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.progressBarDuration=10,this.hasErrors=!1,this.isLoading=!0,this.isSwipe=!1,this.currentStoryId=null,this.progress=0,this.getStories=()=>{let t=new URL(`${this.cmsEndpoint}/${this.language}/stories`);return t.searchParams.append("env",this.cmsEnv),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"mtWeb"})()),t.searchParams.append("language",this.language),new Promise(((i,e)=>{this.isLoading=!0,fetch(t.href).then((t=>t.json())).then((t=>{this.stories=t,this.stories.forEach((t=>{t.viewed=!1})),this.isLoading=!1,i(!0)})).catch((t=>{console.log(t),this.isLoading=!1,this.hasErrors=!0,e(t)}))}))},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))},this.navigateToExternalStoryLink=()=>{window.postMessage({type:"OpenStoryLink",url:this.currentStory.storyUrl},window.location.href)},this.openFullScreenStory=t=>{this.currentStoryId=t,this.currentStory=this.stories.find((i=>i.id===t)),this.markStoryAsViewed(t),this.startProgress()},this.closeFullScreenView=()=>{this.markStoryAsViewed(this.currentStoryId.toString()),this.currentStoryId=null,this.progress=0,clearInterval(this.intervalId)},this.markStoryAsViewed=t=>{const i=this.stories.findIndex((i=>i.id===t));if(i>-1){const[t]=this.stories.splice(i,1);t.viewed=!0,this.stories=[...this.stories,t]}},this.changeStory=(t,i)=>{const e="next"===i?Number(t.index)+1:Number(t.index)-1;if(e>this.stories.length-1||e<0)this.markStoryAsViewed(t.index),this.closeFullScreenView();else{const t=this.stories.find((t=>t.index===e));this.currentStory=t,this.currentStoryId=t.id,this.progress=0,this.markStoryAsViewed(t.id)}},this.startProgress=()=>{const t=100/(1e3*this.progressBarDuration)*100;this.intervalId=setInterval((()=>{this.progress>=100?clearInterval(this.intervalId):this.progress+=t}),100)},this.Thumbnail=({props:t})=>i("div",{class:"StoryThumbnailContainer "+(t.viewed?"Viewed":"Highlighted"),onTouchStart:()=>this.openFullScreenStory(t.id)},i("img",{class:"StoryThumbnailImage "+(t.viewed?"Viewed":"Highlighted"),src:t.icon,alt:"story-icon"}))}handleStylingUpdate(){this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL()}handleNewTranslations(){this.isLoading=!0,o(this.translationUrl).then((()=>{this.isLoading=!1}))}handleTimeEnds(t){t>=100&&this.changeStory(this.currentStory,"next")}async componentWillLoad(){this.cmsEndpoint&&this.language&&await this.getStories(),this.translationUrl.length>2&&await o(this.translationUrl)}onTouchStart(t){this.touchPosStart={clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}}onTouchMove(t){this.touchPosEnd={clientX:t.touches[0].clientX,clientY:t.touches[0].clientY},Math.abs(this.touchPosEnd.clientX-this.touchPosStart.clientX)>50&&(this.isSwipe=!0)}onTouchEnd(t){if(this.isSwipe)this.touchPosEnd={clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY},this.changeStory(this.currentStory,this.touchPosEnd.clientX-this.touchPosStart.clientX>0?"previous":"next");else{const i=window.innerWidth;this.changeStory(this.currentStory,t.changedTouches[0].clientX>i/2?"next":"previous")}}render(){return this.hasErrors?i("div",{class:"GeneralStoriesError"},i("div",{class:"Title"},r("error",this.language))):this.isLoading?i("div",{class:"GeneralStoriesLoading"},i("div",{class:"Title"},r("generalStoriesLoading",this.language))):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},this.currentStoryId?i("div",{class:"FullScreenStory"},i("div",{class:"FullScreenHeader"},i("div",{class:"ProgressBarContainer"},i("div",{class:"ProgressBar",style:{width:`${this.progress}%`}})),i("div",{id:"close",class:"CloseStoryButton",onTouchStart:this.closeFullScreenView},i("svg",{fill:"none",stroke:"#ffffff",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})))),"video"===this.currentStory.type?i("video",{autoPlay:!0},i("source",{src:this.currentStory.url,type:"video/mp4"})):i("img",{src:this.currentStory.url,alt:"story-image"}),this.currentStory.storyUrl&&i("div",{class:"LoadMoreButtonBackground"},i("button",{onTouchStart:this.navigateToExternalStoryLink,class:"LoadMoreButton"},r("loadMore",this.language)))):i("div",{class:"ImageContainer"},this.stories.map((t=>i(this.Thumbnail,{props:t})))))}static get watchers(){return{clientStyling:["handleStylingUpdate"],clientStylingUrl:["handleStylingUpdate"],translationUrl:["handleNewTranslations"],progress:["handleTimeEnds"]}}};s.style='.ImageContainer{display:flex;flex-direction:row;background-color:var(--emw--color-background, #0E1511);overflow:auto}.StoryThumbnailContainer{margin:5px;position:relative;display:inline-block;border-radius:50%}.StoryThumbnailContainer.Highlighted::before{content:"";position:absolute;border-radius:50%;background:linear-gradient(to bottom, var(--emw--color-primary, #22B04E), var(--emw--color-secondary, #E1A749));top:-3px;left:-3px;width:111%;height:103%}.StoryThumbnailContainer.Viewed::before{content:"";position:absolute;border-radius:50%;height:50px;width:50px;background:var(--emw--color-grey-150, #828282);top:-3px;left:-3px;width:111%;height:103%}.StoryThumbnailImage{height:50px;width:50px;border-radius:50%;position:relative;z-index:1}.StoryThumbnailImage.Highlighted,.StoryThumbnailImage.Viewed{border:2px solid var(--emw--color-white, #ffffff)}.FullScreenHeader{position:fixed;top:0;background:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));top:0px;width:100%;display:flex;flex-direction:column;padding:10px 0;z-index:5;height:30px}.FullScreenHeader .CloseStoryButton{position:absolute;right:0;width:20px;margin-right:20px;margin-top:8px;z-index:50}.FullScreenHeader .ProgressBarContainer{width:90%;height:2px;position:relative;top:0;background-color:var(--emw--color-grey-150, #828282);border-radius:10px;overflow:hidden;margin:0 auto}.FullScreenHeader .ProgressBarContainer .ProgressBar{height:100%;background:var(--emw--color-white, #ffffff);width:0%;transition:width 0.1s linear}.FullScreenStory{position:fixed;top:0;width:100%;height:100%;background-color:var(--emw--color-grey-400, #24211f);display:flex;align-items:center;justify-content:center;overflow:hidden;z-index:300}.FullScreenStory video{height:100vh;width:100vw}.FullScreenStory img{width:100%;height:100%;object-fit:contain}.FullScreenStory .LoadMoreButtonBackground{width:100%;height:15%;background:linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));position:absolute;bottom:0;display:flex;justify-content:center}.FullScreenStory .LoadMoreButtonBackground .LoadMoreButton{width:auto;font-size:var(--emw--font-size-small, 14px);font-family:inherit;background-color:var(--emw--color-grey-50, #F9F8F8);box-shadow:0px 0px 7px 1px var(--emw--color-grey-400, #24211f);color:var(--emw--color-black, #000000);border-radius:50px;position:absolute;bottom:15px;padding:10px 20px}';export{s as G}