@everymatrix/general-news-notification 1.55.0 → 1.56.2

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.
Files changed (26) hide show
  1. package/dist/cjs/{general-news-notification-3e467546.js → general-news-notification-cc63ab71.js} +86 -37
  2. package/dist/cjs/general-news-notification.cjs.entry.js +2 -2
  3. package/dist/cjs/general-news-notification.cjs.js +3 -3
  4. package/dist/cjs/{index-889e271c.js → index-a2d41176.js} +19 -44
  5. package/dist/cjs/index.cjs.js +2 -2
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/collection/collection-manifest.json +2 -2
  8. package/dist/collection/components/general-news-notification/general-news-notification.js +46 -36
  9. package/dist/esm/{general-news-notification-3db68ce9.js → general-news-notification-56380f40.js} +86 -37
  10. package/dist/esm/general-news-notification.entry.js +2 -2
  11. package/dist/esm/general-news-notification.js +4 -4
  12. package/dist/esm/{index-e9994984.js → index-4f53ce97.js} +19 -44
  13. package/dist/esm/index.js +2 -2
  14. package/dist/esm/loader.js +3 -3
  15. package/dist/general-news-notification/general-news-notification.esm.js +1 -1
  16. package/dist/general-news-notification/index.esm.js +1 -1
  17. package/dist/general-news-notification/p-1e0da72c.js +1 -0
  18. package/dist/general-news-notification/p-3b72c03a.entry.js +1 -0
  19. package/dist/general-news-notification/p-b1020fc5.js +2 -0
  20. package/dist/types/components/general-news-notification/general-news-notification.d.ts +9 -5
  21. package/dist/types/components.d.ts +8 -0
  22. package/dist/types/stencil-public-runtime.d.ts +0 -6
  23. package/package.json +1 -1
  24. package/dist/general-news-notification/p-51c5e725.js +0 -2
  25. package/dist/general-news-notification/p-bb80c541.js +0 -1
  26. package/dist/general-news-notification/p-f176153a.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-889e271c.js');
3
+ const index = require('./index-a2d41176.js');
4
4
 
5
5
  const getDevice = () => {
6
6
  let userAgent = window.navigator.userAgent;
@@ -65,45 +65,74 @@ const translate = (key, customLang, values) => {
65
65
  return translation;
66
66
  };
67
67
 
68
+ /**
69
+ * @name setClientStyling
70
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
71
+ * @param {HTMLElement} stylingContainer The reference element of the widget
72
+ * @param {string} clientStyling The style content
73
+ */
74
+ function setClientStyling(stylingContainer, clientStyling) {
75
+ if (stylingContainer) {
76
+ const sheet = document.createElement('style');
77
+ sheet.innerHTML = clientStyling;
78
+ stylingContainer.appendChild(sheet);
79
+ }
80
+ }
81
+
82
+ /**
83
+ * @name setClientStylingURL
84
+ * @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
85
+ * @param {HTMLElement} stylingContainer The reference element of the widget
86
+ * @param {string} clientStylingUrl The URL of the style content
87
+ */
88
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
89
+ const url = new URL(clientStylingUrl);
90
+
91
+ fetch(url.href)
92
+ .then((res) => res.text())
93
+ .then((data) => {
94
+ const cssFile = document.createElement('style');
95
+ cssFile.innerHTML = data;
96
+ if (stylingContainer) {
97
+ stylingContainer.appendChild(cssFile);
98
+ }
99
+ })
100
+ .catch((err) => {
101
+ console.error('There was an error while trying to load client styling from URL', err);
102
+ });
103
+ }
104
+
105
+ /**
106
+ * @name setStreamLibrary
107
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
108
+ * @param {HTMLElement} stylingContainer The highest element of the widget
109
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
110
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
111
+ */
112
+ function setStreamStyling(stylingContainer, domain, subscription) {
113
+ if (window.emMessageBus) {
114
+ const sheet = document.createElement('style');
115
+
116
+ window.emMessageBus.subscribe(domain, (data) => {
117
+ sheet.innerHTML = data;
118
+ if (stylingContainer) {
119
+ stylingContainer.appendChild(sheet);
120
+ }
121
+ });
122
+ }
123
+ }
124
+
68
125
  const generalNewsNotificationCss = ":host{display:block}.NotificationWrapper{background:var(--emw--header-color-background, var(--emw--color-background, #000000));color:var(--emw--color-white, #FFFFFF);position:sticky;width:100%;text-align:center;overflow:hidden;z-index:298;display:flex;justify-content:flex-end;align-items:center;border-bottom:6px solid var(--emw--color-primary, #22B04E);max-height:40px}.SlidingBar{transition:all 0.3s ease-in-out;width:100%}.Message{will-change:transform;margin:0 auto;padding:10px;width:90%}.ScrollLeft .Message{white-space:nowrap;animation:scroll-left 10s linear infinite;width:100%}.ScrollRight .Message{white-space:nowrap;animation:scroll-right 10s linear infinite;width:100%}.VisibleButtons .Message{display:flex}@keyframes scroll-left{from{transform:translateX(100%)}to{transform:translateX(-100%)}}@keyframes scroll-right{from{transform:translateX(-100%)}to{transform:translateX(100%)}}.SlidingBar:hover .Message{animation-play-state:paused}.CloseButton{padding-left:10px;background-color:var(--emw--header-color-background, var(--emw--color-background, #000000));display:flex;z-index:299;gap:10px}.ToggleButton{position:absolute;left:0}.ToggleButton .TriangleActive,.ToggleButton .TriangleInactive{display:block;transition:all 0.2s}.ToggleButton .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px);fill:var(--emw--color-primary, #52d004);margin-top:8px}.ToggleButton svg{fill:var(--emw--header-color-background, var(--emw--color-background, #000000));width:16px;transform:rotate(180deg)}.CloseButton{right:10px}button{background-color:var(--emw--color-primary, #22B04E);color:var(--emw--header-color-background, var(--emw--color-background, #000000));border:none;width:40px;height:40px;cursor:pointer}.NotificationWrapper.Minimized{visibility:hidden}";
69
126
  const GeneralNewsNotificationStyle0 = generalNewsNotificationCss;
70
127
 
71
128
  const GeneralNewsNotification = class {
72
129
  constructor(hostRef) {
73
130
  index.registerInstance(this, hostRef);
74
- this.componentDidLoad = () => {
75
- // start custom styling area
76
- if (this.stylingContainer) {
77
- if (this.clientStyling)
78
- this.setClientStyling();
79
- if (this.clientStylingUrl)
80
- this.setClientStylingURL();
81
- }
82
- // end custom styling area
83
- };
84
131
  this.connectedCallback = () => {
85
132
  if (this.cmsEndpoint && this.language) {
86
133
  this.getNotificationMessage();
87
134
  }
88
135
  };
89
- this.setClientStyling = () => {
90
- let sheet = document.createElement('style');
91
- sheet.innerHTML = this.clientStyling;
92
- this.stylingContainer.prepend(sheet);
93
- };
94
- this.setClientStylingURL = () => {
95
- let url = new URL(this.clientStylingUrl);
96
- let cssFile = document.createElement('style');
97
- fetch(url.href)
98
- .then((res) => res.text())
99
- .then((data) => {
100
- cssFile.innerHTML = data;
101
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
102
- })
103
- .catch((err) => {
104
- console.log('error ', err);
105
- });
106
- };
107
136
  this.getNotificationMessage = () => {
108
137
  this.isLoading = true;
109
138
  try {
@@ -144,6 +173,7 @@ const GeneralNewsNotification = class {
144
173
  this.speed = 30;
145
174
  this.canMinimize = false;
146
175
  this.canClose = false;
176
+ this.mbSource = undefined;
147
177
  this.clientStyling = '';
148
178
  this.clientStylingUrl = '';
149
179
  this.translationUrl = '';
@@ -157,13 +187,16 @@ const GeneralNewsNotification = class {
157
187
  this.getNotificationMessage();
158
188
  }
159
189
  }
160
- handleStylingChange(newValue, oldValue) {
161
- if (newValue !== oldValue)
162
- this.setClientStyling();
190
+ handleClientStylingChange(newValue, oldValue) {
191
+ if (newValue != oldValue) {
192
+ setClientStyling(this.stylingContainer, this.clientStyling);
193
+ }
163
194
  }
164
- handleStylingUrlChange(newValue, oldValue) {
165
- if (newValue !== oldValue)
166
- this.setClientStylingURL();
195
+ handleClientStylingChangeURL(newValue, oldValue) {
196
+ if (newValue != oldValue) {
197
+ if (this.clientStylingUrl)
198
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
199
+ }
167
200
  }
168
201
  handleNewTranslations() {
169
202
  this.isLoading = true;
@@ -176,6 +209,22 @@ const GeneralNewsNotification = class {
176
209
  await getTranslations(this.translationUrl);
177
210
  }
178
211
  }
212
+ componentDidLoad() {
213
+ if (this.stylingContainer) {
214
+ if (window.emMessageBus != undefined) {
215
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
216
+ }
217
+ else {
218
+ if (this.clientStyling)
219
+ setClientStyling(this.stylingContainer, this.clientStyling);
220
+ if (this.clientStylingUrl)
221
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
222
+ }
223
+ }
224
+ }
225
+ disconnectedCallback() {
226
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
227
+ }
179
228
  render() {
180
229
  if (this.isClosed)
181
230
  return null;
@@ -196,8 +245,8 @@ const GeneralNewsNotification = class {
196
245
  static get watchers() { return {
197
246
  "cmsEndpoint": ["watchEndpoint"],
198
247
  "language": ["watchEndpoint"],
199
- "clientStyling": ["handleStylingChange"],
200
- "clientStylingUrl": ["handleStylingUrlChange"],
248
+ "clientStyling": ["handleClientStylingChange"],
249
+ "clientStylingUrl": ["handleClientStylingChangeURL"],
201
250
  "translationUrl": ["handleNewTranslations"]
202
251
  }; }
203
252
  };
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const generalNewsNotification = require('./general-news-notification-3e467546.js');
6
- require('./index-889e271c.js');
5
+ const generalNewsNotification = require('./general-news-notification-cc63ab71.js');
6
+ require('./index-a2d41176.js');
7
7
 
8
8
 
9
9
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-889e271c.js');
5
+ const index = require('./index-a2d41176.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
9
- Stencil Client Patch Browser v4.22.3 | MIT Licensed | https://stenciljs.com
9
+ Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
10
10
  */
11
11
  var patchBrowser = () => {
12
12
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('general-news-notification.cjs.js', document.baseURI).href));
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["general-news-notification.cjs",[[1,"general-news-notification",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"animationType":[1,"animation-type"],"speed":[2],"canMinimize":[4,"can-minimize"],"canClose":[4,"can-close"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"message":[32],"isMinimized":[32],"isClosed":[32],"isLoading":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"],"translationUrl":["handleNewTranslations"]}]]]], options);
22
+ return index.bootstrapLazy([["general-news-notification.cjs",[[1,"general-news-notification",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"animationType":[1,"animation-type"],"speed":[2],"canMinimize":[4,"can-minimize"],"canClose":[4,"can-close"],"mbSource":[1,"mb-source"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"message":[32],"isMinimized":[32],"isClosed":[32],"isLoading":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -21,10 +21,10 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'general-news-notification';
24
- const BUILD = /* general-news-notification */ { 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: false, 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, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, 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: false, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
24
+ const BUILD = /* general-news-notification */ { 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: false, 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, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, 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: false, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
25
25
 
26
26
  /*
27
- Stencil Client Platform v4.22.3 | MIT Licensed | https://stenciljs.com
27
+ Stencil Client Platform v4.19.2 | MIT Licensed | https://stenciljs.com
28
28
  */
29
29
  var __defProp = Object.defineProperty;
30
30
  var __export = (target, all) => {
@@ -341,31 +341,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
341
341
  if (nonce != null) {
342
342
  styleElm.setAttribute("nonce", nonce);
343
343
  }
344
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
345
- if (styleContainerNode.nodeName === "HEAD") {
346
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
347
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
348
- styleContainerNode.insertBefore(styleElm, referenceNode2);
349
- } else if ("host" in styleContainerNode) {
350
- if (supportsConstructableStylesheets) {
351
- const stylesheet = new CSSStyleSheet();
352
- stylesheet.replaceSync(style);
353
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
354
- } else {
355
- const existingStyleContainer = styleContainerNode.querySelector("style");
356
- if (existingStyleContainer) {
357
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
358
- } else {
359
- styleContainerNode.prepend(styleElm);
360
- }
361
- }
362
- } else {
363
- styleContainerNode.append(styleElm);
364
- }
365
- }
366
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
367
- styleContainerNode.insertBefore(styleElm, null);
368
- }
344
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
369
345
  }
370
346
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
371
347
  styleElm.innerHTML += SLOT_FB_CSS;
@@ -388,7 +364,7 @@ var attachStyles = (hostRef) => {
388
364
  const scopeId2 = addStyle(
389
365
  elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
390
366
  cmpMeta);
391
- if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
367
+ if (flags & 10 /* needsScopedEncapsulation */) {
392
368
  elm["s-sc"] = scopeId2;
393
369
  elm.classList.add(scopeId2 + "-h");
394
370
  }
@@ -457,11 +433,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
457
433
  if (memberName === "list") {
458
434
  isProp = false;
459
435
  } else if (oldValue == null || elm[memberName] != n) {
460
- if (typeof elm.__lookupSetter__(memberName) === "function") {
461
- elm[memberName] = n;
462
- } else {
463
- elm.setAttribute(memberName, n);
464
- }
436
+ elm[memberName] = n;
465
437
  }
466
438
  } else {
467
439
  elm[memberName] = newValue;
@@ -541,9 +513,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
541
513
  {
542
514
  updateElement(null, newVNode2, isSvgMode);
543
515
  }
544
- const rootNode = elm.getRootNode();
545
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
546
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
516
+ if (isDef(scopeId) && elm["s-si"] !== scopeId) {
547
517
  elm.classList.add(elm["s-si"] = scopeId);
548
518
  }
549
519
  if (newVNode2.$children$) {
@@ -683,10 +653,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
683
653
  elm.textContent = "";
684
654
  }
685
655
  addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
686
- } else if (
687
- // don't do this on initial render as it can cause non-hydrated content to be removed
688
- !isInitialRender && BUILD.updatable && oldChildren !== null
689
- ) {
656
+ } else if (oldChildren !== null) {
690
657
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
691
658
  }
692
659
  if (isSvgMode && tag === "svg") {
@@ -826,12 +793,16 @@ var postUpdateComponent = (hostRef) => {
826
793
  const tagName = hostRef.$cmpMeta$.$tagName$;
827
794
  const elm = hostRef.$hostElement$;
828
795
  const endPostUpdate = createTime("postUpdate", tagName);
796
+ const instance = hostRef.$lazyInstance$ ;
829
797
  const ancestorComponent = hostRef.$ancestorComponent$;
830
798
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
831
799
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
832
800
  {
833
801
  addHydratedFlag(elm);
834
802
  }
803
+ {
804
+ safeCall(instance, "componentDidLoad");
805
+ }
835
806
  endPostUpdate();
836
807
  {
837
808
  hostRef.$onReadyResolve$(elm);
@@ -944,8 +915,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
944
915
  if (this.hasOwnProperty(propName)) {
945
916
  newValue = this[propName];
946
917
  delete this[propName];
947
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
948
- this[propName] == newValue) {
918
+ } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) {
949
919
  return;
950
920
  } else if (propName == null) {
951
921
  const hostRef = getHostRef(this);
@@ -1087,12 +1057,17 @@ var connectedCallback = (elm) => {
1087
1057
  }
1088
1058
  };
1089
1059
  var disconnectInstance = (instance) => {
1060
+ {
1061
+ safeCall(instance, "disconnectedCallback");
1062
+ }
1090
1063
  };
1091
1064
  var disconnectedCallback = async (elm) => {
1092
1065
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1093
1066
  const hostRef = getHostRef(elm);
1094
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1095
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1067
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1068
+ disconnectInstance(hostRef.$lazyInstance$);
1069
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1070
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
1096
1071
  }
1097
1072
  }
1098
1073
  };
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const generalNewsNotification = require('./general-news-notification-3e467546.js');
6
- require('./index-889e271c.js');
5
+ const generalNewsNotification = require('./general-news-notification-cc63ab71.js');
6
+ require('./index-a2d41176.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-889e271c.js');
5
+ const index = require('./index-a2d41176.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-news-notification.cjs",[[1,"general-news-notification",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"animationType":[1,"animation-type"],"speed":[2],"canMinimize":[4,"can-minimize"],"canClose":[4,"can-close"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"message":[32],"isMinimized":[32],"isClosed":[32],"isLoading":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"],"translationUrl":["handleNewTranslations"]}]]]], options);
11
+ return index.bootstrapLazy([["general-news-notification.cjs",[[1,"general-news-notification",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"animationType":[1,"animation-type"],"speed":[2],"canMinimize":[4,"can-minimize"],"canClose":[4,"can-close"],"mbSource":[1,"mb-source"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"message":[32],"isMinimized":[32],"isClosed":[32],"isLoading":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -4,8 +4,8 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "4.22.3",
8
- "typescriptVersion": "5.5.4"
7
+ "version": "4.19.2",
8
+ "typescriptVersion": "5.4.5"
9
9
  },
10
10
  "collections": [],
11
11
  "bundles": []
@@ -1,41 +1,14 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { getDevicePlatform } from "../../utils/utils";
3
3
  import { getTranslations, translate } from "../../utils/locale.utils";
4
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
4
5
  export class GeneralNewsNotification {
5
6
  constructor() {
6
- this.componentDidLoad = () => {
7
- // start custom styling area
8
- if (this.stylingContainer) {
9
- if (this.clientStyling)
10
- this.setClientStyling();
11
- if (this.clientStylingUrl)
12
- this.setClientStylingURL();
13
- }
14
- // end custom styling area
15
- };
16
7
  this.connectedCallback = () => {
17
8
  if (this.cmsEndpoint && this.language) {
18
9
  this.getNotificationMessage();
19
10
  }
20
11
  };
21
- this.setClientStyling = () => {
22
- let sheet = document.createElement('style');
23
- sheet.innerHTML = this.clientStyling;
24
- this.stylingContainer.prepend(sheet);
25
- };
26
- this.setClientStylingURL = () => {
27
- let url = new URL(this.clientStylingUrl);
28
- let cssFile = document.createElement('style');
29
- fetch(url.href)
30
- .then((res) => res.text())
31
- .then((data) => {
32
- cssFile.innerHTML = data;
33
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
34
- })
35
- .catch((err) => {
36
- console.log('error ', err);
37
- });
38
- };
39
12
  this.getNotificationMessage = () => {
40
13
  this.isLoading = true;
41
14
  try {
@@ -76,6 +49,7 @@ export class GeneralNewsNotification {
76
49
  this.speed = 30;
77
50
  this.canMinimize = false;
78
51
  this.canClose = false;
52
+ this.mbSource = undefined;
79
53
  this.clientStyling = '';
80
54
  this.clientStylingUrl = '';
81
55
  this.translationUrl = '';
@@ -89,13 +63,16 @@ export class GeneralNewsNotification {
89
63
  this.getNotificationMessage();
90
64
  }
91
65
  }
92
- handleStylingChange(newValue, oldValue) {
93
- if (newValue !== oldValue)
94
- this.setClientStyling();
66
+ handleClientStylingChange(newValue, oldValue) {
67
+ if (newValue != oldValue) {
68
+ setClientStyling(this.stylingContainer, this.clientStyling);
69
+ }
95
70
  }
96
- handleStylingUrlChange(newValue, oldValue) {
97
- if (newValue !== oldValue)
98
- this.setClientStylingURL();
71
+ handleClientStylingChangeURL(newValue, oldValue) {
72
+ if (newValue != oldValue) {
73
+ if (this.clientStylingUrl)
74
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
75
+ }
99
76
  }
100
77
  handleNewTranslations() {
101
78
  this.isLoading = true;
@@ -108,6 +85,22 @@ export class GeneralNewsNotification {
108
85
  await getTranslations(this.translationUrl);
109
86
  }
110
87
  }
88
+ componentDidLoad() {
89
+ if (this.stylingContainer) {
90
+ if (window.emMessageBus != undefined) {
91
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
92
+ }
93
+ else {
94
+ if (this.clientStyling)
95
+ setClientStyling(this.stylingContainer, this.clientStyling);
96
+ if (this.clientStylingUrl)
97
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
98
+ }
99
+ }
100
+ }
101
+ disconnectedCallback() {
102
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
103
+ }
111
104
  render() {
112
105
  if (this.isClosed)
113
106
  return null;
@@ -245,6 +238,23 @@ export class GeneralNewsNotification {
245
238
  "reflect": false,
246
239
  "defaultValue": "false"
247
240
  },
241
+ "mbSource": {
242
+ "type": "string",
243
+ "mutable": false,
244
+ "complexType": {
245
+ "original": "string",
246
+ "resolved": "string",
247
+ "references": {}
248
+ },
249
+ "required": false,
250
+ "optional": false,
251
+ "docs": {
252
+ "tags": [],
253
+ "text": "Client custom styling via streamStyling"
254
+ },
255
+ "attribute": "mb-source",
256
+ "reflect": false
257
+ },
248
258
  "clientStyling": {
249
259
  "type": "string",
250
260
  "mutable": false,
@@ -318,10 +328,10 @@ export class GeneralNewsNotification {
318
328
  "methodName": "watchEndpoint"
319
329
  }, {
320
330
  "propName": "clientStyling",
321
- "methodName": "handleStylingChange"
331
+ "methodName": "handleClientStylingChange"
322
332
  }, {
323
333
  "propName": "clientStylingUrl",
324
- "methodName": "handleStylingUrlChange"
334
+ "methodName": "handleClientStylingChangeURL"
325
335
  }, {
326
336
  "propName": "translationUrl",
327
337
  "methodName": "handleNewTranslations"
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-e9994984.js';
1
+ import { r as registerInstance, h } from './index-4f53ce97.js';
2
2
 
3
3
  const getDevice = () => {
4
4
  let userAgent = window.navigator.userAgent;
@@ -63,45 +63,74 @@ const translate = (key, customLang, values) => {
63
63
  return translation;
64
64
  };
65
65
 
66
+ /**
67
+ * @name setClientStyling
68
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
69
+ * @param {HTMLElement} stylingContainer The reference element of the widget
70
+ * @param {string} clientStyling The style content
71
+ */
72
+ function setClientStyling(stylingContainer, clientStyling) {
73
+ if (stylingContainer) {
74
+ const sheet = document.createElement('style');
75
+ sheet.innerHTML = clientStyling;
76
+ stylingContainer.appendChild(sheet);
77
+ }
78
+ }
79
+
80
+ /**
81
+ * @name setClientStylingURL
82
+ * @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
83
+ * @param {HTMLElement} stylingContainer The reference element of the widget
84
+ * @param {string} clientStylingUrl The URL of the style content
85
+ */
86
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
87
+ const url = new URL(clientStylingUrl);
88
+
89
+ fetch(url.href)
90
+ .then((res) => res.text())
91
+ .then((data) => {
92
+ const cssFile = document.createElement('style');
93
+ cssFile.innerHTML = data;
94
+ if (stylingContainer) {
95
+ stylingContainer.appendChild(cssFile);
96
+ }
97
+ })
98
+ .catch((err) => {
99
+ console.error('There was an error while trying to load client styling from URL', err);
100
+ });
101
+ }
102
+
103
+ /**
104
+ * @name setStreamLibrary
105
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
106
+ * @param {HTMLElement} stylingContainer The highest element of the widget
107
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
108
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
109
+ */
110
+ function setStreamStyling(stylingContainer, domain, subscription) {
111
+ if (window.emMessageBus) {
112
+ const sheet = document.createElement('style');
113
+
114
+ window.emMessageBus.subscribe(domain, (data) => {
115
+ sheet.innerHTML = data;
116
+ if (stylingContainer) {
117
+ stylingContainer.appendChild(sheet);
118
+ }
119
+ });
120
+ }
121
+ }
122
+
66
123
  const generalNewsNotificationCss = ":host{display:block}.NotificationWrapper{background:var(--emw--header-color-background, var(--emw--color-background, #000000));color:var(--emw--color-white, #FFFFFF);position:sticky;width:100%;text-align:center;overflow:hidden;z-index:298;display:flex;justify-content:flex-end;align-items:center;border-bottom:6px solid var(--emw--color-primary, #22B04E);max-height:40px}.SlidingBar{transition:all 0.3s ease-in-out;width:100%}.Message{will-change:transform;margin:0 auto;padding:10px;width:90%}.ScrollLeft .Message{white-space:nowrap;animation:scroll-left 10s linear infinite;width:100%}.ScrollRight .Message{white-space:nowrap;animation:scroll-right 10s linear infinite;width:100%}.VisibleButtons .Message{display:flex}@keyframes scroll-left{from{transform:translateX(100%)}to{transform:translateX(-100%)}}@keyframes scroll-right{from{transform:translateX(-100%)}to{transform:translateX(100%)}}.SlidingBar:hover .Message{animation-play-state:paused}.CloseButton{padding-left:10px;background-color:var(--emw--header-color-background, var(--emw--color-background, #000000));display:flex;z-index:299;gap:10px}.ToggleButton{position:absolute;left:0}.ToggleButton .TriangleActive,.ToggleButton .TriangleInactive{display:block;transition:all 0.2s}.ToggleButton .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px);fill:var(--emw--color-primary, #52d004);margin-top:8px}.ToggleButton svg{fill:var(--emw--header-color-background, var(--emw--color-background, #000000));width:16px;transform:rotate(180deg)}.CloseButton{right:10px}button{background-color:var(--emw--color-primary, #22B04E);color:var(--emw--header-color-background, var(--emw--color-background, #000000));border:none;width:40px;height:40px;cursor:pointer}.NotificationWrapper.Minimized{visibility:hidden}";
67
124
  const GeneralNewsNotificationStyle0 = generalNewsNotificationCss;
68
125
 
69
126
  const GeneralNewsNotification = class {
70
127
  constructor(hostRef) {
71
128
  registerInstance(this, hostRef);
72
- this.componentDidLoad = () => {
73
- // start custom styling area
74
- if (this.stylingContainer) {
75
- if (this.clientStyling)
76
- this.setClientStyling();
77
- if (this.clientStylingUrl)
78
- this.setClientStylingURL();
79
- }
80
- // end custom styling area
81
- };
82
129
  this.connectedCallback = () => {
83
130
  if (this.cmsEndpoint && this.language) {
84
131
  this.getNotificationMessage();
85
132
  }
86
133
  };
87
- this.setClientStyling = () => {
88
- let sheet = document.createElement('style');
89
- sheet.innerHTML = this.clientStyling;
90
- this.stylingContainer.prepend(sheet);
91
- };
92
- this.setClientStylingURL = () => {
93
- let url = new URL(this.clientStylingUrl);
94
- let cssFile = document.createElement('style');
95
- fetch(url.href)
96
- .then((res) => res.text())
97
- .then((data) => {
98
- cssFile.innerHTML = data;
99
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
100
- })
101
- .catch((err) => {
102
- console.log('error ', err);
103
- });
104
- };
105
134
  this.getNotificationMessage = () => {
106
135
  this.isLoading = true;
107
136
  try {
@@ -142,6 +171,7 @@ const GeneralNewsNotification = class {
142
171
  this.speed = 30;
143
172
  this.canMinimize = false;
144
173
  this.canClose = false;
174
+ this.mbSource = undefined;
145
175
  this.clientStyling = '';
146
176
  this.clientStylingUrl = '';
147
177
  this.translationUrl = '';
@@ -155,13 +185,16 @@ const GeneralNewsNotification = class {
155
185
  this.getNotificationMessage();
156
186
  }
157
187
  }
158
- handleStylingChange(newValue, oldValue) {
159
- if (newValue !== oldValue)
160
- this.setClientStyling();
188
+ handleClientStylingChange(newValue, oldValue) {
189
+ if (newValue != oldValue) {
190
+ setClientStyling(this.stylingContainer, this.clientStyling);
191
+ }
161
192
  }
162
- handleStylingUrlChange(newValue, oldValue) {
163
- if (newValue !== oldValue)
164
- this.setClientStylingURL();
193
+ handleClientStylingChangeURL(newValue, oldValue) {
194
+ if (newValue != oldValue) {
195
+ if (this.clientStylingUrl)
196
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
197
+ }
165
198
  }
166
199
  handleNewTranslations() {
167
200
  this.isLoading = true;
@@ -174,6 +207,22 @@ const GeneralNewsNotification = class {
174
207
  await getTranslations(this.translationUrl);
175
208
  }
176
209
  }
210
+ componentDidLoad() {
211
+ if (this.stylingContainer) {
212
+ if (window.emMessageBus != undefined) {
213
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
214
+ }
215
+ else {
216
+ if (this.clientStyling)
217
+ setClientStyling(this.stylingContainer, this.clientStyling);
218
+ if (this.clientStylingUrl)
219
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
220
+ }
221
+ }
222
+ }
223
+ disconnectedCallback() {
224
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
225
+ }
177
226
  render() {
178
227
  if (this.isClosed)
179
228
  return null;
@@ -194,8 +243,8 @@ const GeneralNewsNotification = class {
194
243
  static get watchers() { return {
195
244
  "cmsEndpoint": ["watchEndpoint"],
196
245
  "language": ["watchEndpoint"],
197
- "clientStyling": ["handleStylingChange"],
198
- "clientStylingUrl": ["handleStylingUrlChange"],
246
+ "clientStyling": ["handleClientStylingChange"],
247
+ "clientStylingUrl": ["handleClientStylingChangeURL"],
199
248
  "translationUrl": ["handleNewTranslations"]
200
249
  }; }
201
250
  };
@@ -1,2 +1,2 @@
1
- export { G as general_news_notification } from './general-news-notification-3db68ce9.js';
2
- import './index-e9994984.js';
1
+ export { G as general_news_notification } from './general-news-notification-56380f40.js';
2
+ import './index-4f53ce97.js';
@@ -1,9 +1,9 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-e9994984.js';
2
- export { s as setNonce } from './index-e9994984.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-4f53ce97.js';
2
+ export { s as setNonce } from './index-4f53ce97.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v4.22.3 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
  var patchBrowser = () => {
9
9
  const importMeta = import.meta.url;
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["general-news-notification",[[1,"general-news-notification",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"animationType":[1,"animation-type"],"speed":[2],"canMinimize":[4,"can-minimize"],"canClose":[4,"can-close"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"message":[32],"isMinimized":[32],"isClosed":[32],"isLoading":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"],"translationUrl":["handleNewTranslations"]}]]]], options);
19
+ return bootstrapLazy([["general-news-notification",[[1,"general-news-notification",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"animationType":[1,"animation-type"],"speed":[2],"canMinimize":[4,"can-minimize"],"canClose":[4,"can-close"],"mbSource":[1,"mb-source"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"message":[32],"isMinimized":[32],"isClosed":[32],"isLoading":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"]}]]]], options);
20
20
  });
@@ -1,8 +1,8 @@
1
1
  const NAMESPACE = 'general-news-notification';
2
- const BUILD = /* general-news-notification */ { 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: false, 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, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, 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: false, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
2
+ const BUILD = /* general-news-notification */ { 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: false, 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, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: true, propString: true, reflect: false, 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: false, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.22.3 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.19.2 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  var __defProp = Object.defineProperty;
8
8
  var __export = (target, all) => {
@@ -319,31 +319,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
319
319
  if (nonce != null) {
320
320
  styleElm.setAttribute("nonce", nonce);
321
321
  }
322
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
323
- if (styleContainerNode.nodeName === "HEAD") {
324
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
325
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
326
- styleContainerNode.insertBefore(styleElm, referenceNode2);
327
- } else if ("host" in styleContainerNode) {
328
- if (supportsConstructableStylesheets) {
329
- const stylesheet = new CSSStyleSheet();
330
- stylesheet.replaceSync(style);
331
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
332
- } else {
333
- const existingStyleContainer = styleContainerNode.querySelector("style");
334
- if (existingStyleContainer) {
335
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
336
- } else {
337
- styleContainerNode.prepend(styleElm);
338
- }
339
- }
340
- } else {
341
- styleContainerNode.append(styleElm);
342
- }
343
- }
344
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
345
- styleContainerNode.insertBefore(styleElm, null);
346
- }
322
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
347
323
  }
348
324
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
349
325
  styleElm.innerHTML += SLOT_FB_CSS;
@@ -366,7 +342,7 @@ var attachStyles = (hostRef) => {
366
342
  const scopeId2 = addStyle(
367
343
  elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
368
344
  cmpMeta);
369
- if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
345
+ if (flags & 10 /* needsScopedEncapsulation */) {
370
346
  elm["s-sc"] = scopeId2;
371
347
  elm.classList.add(scopeId2 + "-h");
372
348
  }
@@ -435,11 +411,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
435
411
  if (memberName === "list") {
436
412
  isProp = false;
437
413
  } else if (oldValue == null || elm[memberName] != n) {
438
- if (typeof elm.__lookupSetter__(memberName) === "function") {
439
- elm[memberName] = n;
440
- } else {
441
- elm.setAttribute(memberName, n);
442
- }
414
+ elm[memberName] = n;
443
415
  }
444
416
  } else {
445
417
  elm[memberName] = newValue;
@@ -519,9 +491,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
519
491
  {
520
492
  updateElement(null, newVNode2, isSvgMode);
521
493
  }
522
- const rootNode = elm.getRootNode();
523
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
524
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
494
+ if (isDef(scopeId) && elm["s-si"] !== scopeId) {
525
495
  elm.classList.add(elm["s-si"] = scopeId);
526
496
  }
527
497
  if (newVNode2.$children$) {
@@ -661,10 +631,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
661
631
  elm.textContent = "";
662
632
  }
663
633
  addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
664
- } else if (
665
- // don't do this on initial render as it can cause non-hydrated content to be removed
666
- !isInitialRender && BUILD.updatable && oldChildren !== null
667
- ) {
634
+ } else if (oldChildren !== null) {
668
635
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
669
636
  }
670
637
  if (isSvgMode && tag === "svg") {
@@ -804,12 +771,16 @@ var postUpdateComponent = (hostRef) => {
804
771
  const tagName = hostRef.$cmpMeta$.$tagName$;
805
772
  const elm = hostRef.$hostElement$;
806
773
  const endPostUpdate = createTime("postUpdate", tagName);
774
+ const instance = hostRef.$lazyInstance$ ;
807
775
  const ancestorComponent = hostRef.$ancestorComponent$;
808
776
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
809
777
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
810
778
  {
811
779
  addHydratedFlag(elm);
812
780
  }
781
+ {
782
+ safeCall(instance, "componentDidLoad");
783
+ }
813
784
  endPostUpdate();
814
785
  {
815
786
  hostRef.$onReadyResolve$(elm);
@@ -922,8 +893,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
922
893
  if (this.hasOwnProperty(propName)) {
923
894
  newValue = this[propName];
924
895
  delete this[propName];
925
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
926
- this[propName] == newValue) {
896
+ } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) {
927
897
  return;
928
898
  } else if (propName == null) {
929
899
  const hostRef = getHostRef(this);
@@ -1065,12 +1035,17 @@ var connectedCallback = (elm) => {
1065
1035
  }
1066
1036
  };
1067
1037
  var disconnectInstance = (instance) => {
1038
+ {
1039
+ safeCall(instance, "disconnectedCallback");
1040
+ }
1068
1041
  };
1069
1042
  var disconnectedCallback = async (elm) => {
1070
1043
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1071
1044
  const hostRef = getHostRef(elm);
1072
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1073
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1045
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1046
+ disconnectInstance(hostRef.$lazyInstance$);
1047
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1048
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
1074
1049
  }
1075
1050
  }
1076
1051
  };
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { G as GeneralNewsNotification } from './general-news-notification-3db68ce9.js';
2
- import './index-e9994984.js';
1
+ export { G as GeneralNewsNotification } from './general-news-notification-56380f40.js';
2
+ import './index-4f53ce97.js';
@@ -1,11 +1,11 @@
1
- import { b as bootstrapLazy } from './index-e9994984.js';
2
- export { s as setNonce } from './index-e9994984.js';
1
+ import { b as bootstrapLazy } from './index-4f53ce97.js';
2
+ export { s as setNonce } from './index-4f53ce97.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-news-notification",[[1,"general-news-notification",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"animationType":[1,"animation-type"],"speed":[2],"canMinimize":[4,"can-minimize"],"canClose":[4,"can-close"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"message":[32],"isMinimized":[32],"isClosed":[32],"isLoading":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"],"translationUrl":["handleNewTranslations"]}]]]], options);
8
+ return bootstrapLazy([["general-news-notification",[[1,"general-news-notification",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"animationType":[1,"animation-type"],"speed":[2],"canMinimize":[4,"can-minimize"],"canClose":[4,"can-close"],"mbSource":[1,"mb-source"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"message":[32],"isMinimized":[32],"isClosed":[32],"isLoading":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"],"translationUrl":["handleNewTranslations"]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1 +1 @@
1
- import{p as n,b as i}from"./p-51c5e725.js";export{s as setNonce}from"./p-51c5e725.js";import{g as t}from"./p-e1255160.js";(()=>{const i=import.meta.url,t={};return""!==i&&(t.resourcesUrl=new URL(".",i).href),n(t)})().then((async n=>(await t(),i([["p-f176153a",[[1,"general-news-notification",{cmsEndpoint:[1,"cms-endpoint"],language:[1],animationType:[1,"animation-type"],speed:[2],canMinimize:[4,"can-minimize"],canClose:[4,"can-close"],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],translationUrl:[1,"translation-url"],message:[32],isMinimized:[32],isClosed:[32],isLoading:[32]},null,{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],clientStyling:["handleStylingChange"],clientStylingUrl:["handleStylingUrlChange"],translationUrl:["handleNewTranslations"]}]]]],n))));
1
+ import{p as n,b as i}from"./p-b1020fc5.js";export{s as setNonce}from"./p-b1020fc5.js";import{g as t}from"./p-e1255160.js";(()=>{const i=import.meta.url,t={};return""!==i&&(t.resourcesUrl=new URL(".",i).href),n(t)})().then((async n=>(await t(),i([["p-3b72c03a",[[1,"general-news-notification",{cmsEndpoint:[1,"cms-endpoint"],language:[1],animationType:[1,"animation-type"],speed:[2],canMinimize:[4,"can-minimize"],canClose:[4,"can-close"],mbSource:[1,"mb-source"],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],translationUrl:[1,"translation-url"],message:[32],isMinimized:[32],isClosed:[32],isLoading:[32]},null,{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"]}]]]],n))));
@@ -1 +1 @@
1
- export{G as GeneralNewsNotification}from"./p-bb80c541.js";import"./p-51c5e725.js";
1
+ export{G as GeneralNewsNotification}from"./p-1e0da72c.js";import"./p-b1020fc5.js";
@@ -0,0 +1 @@
1
+ import{r as t,h as i}from"./p-b1020fc5.js";const n=()=>{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":"iPad"===t||"iPhone"===t?"ios":"mtWeb"},o={en:{loading:"Is Loading ..."}},e=t=>new Promise((i=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((i=>{o[i]||(o[i]={});for(let n in t[i])o[i][n]=t[i][n]})),i(!0)}))}));function s(t,i){if(t){const n=document.createElement("style");n.innerHTML=i,t.appendChild(n)}}function a(t,i){const n=new URL(i);fetch(n.href).then((t=>t.text())).then((i=>{const n=document.createElement("style");n.innerHTML=i,t&&t.appendChild(n)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}const r=class{constructor(i){t(this,i),this.connectedCallback=()=>{this.cmsEndpoint&&this.language&&this.getNotificationMessage()},this.getNotificationMessage=()=>{this.isLoading=!0;try{let t=new URL(`${this.cmsEndpoint}/${this.language}/header-notification`);t.searchParams.append("device",n()),t.searchParams.append("platform",n()),fetch(t.href).then((t=>{if(200===t.status)return t.json();throw new Error("HTTP status "+t.status)})).then((t=>{this.message=t.message})).catch((t=>{console.error(t)})).finally((()=>this.isLoading=!1))}catch(t){console.error("Error fetching message:",t)}},this.toggleMinimize=()=>{this.isMinimized=!this.isMinimized},this.closeNotification=()=>{this.isClosed=!0},this.cmsEndpoint=void 0,this.language=void 0,this.animationType="static",this.speed=30,this.canMinimize=!1,this.canClose=!1,this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.message=void 0,this.isMinimized=!1,this.isClosed=!1,this.isLoading=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.language&&this.getNotificationMessage()}handleClientStylingChange(t,i){t!=i&&s(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!=i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}handleNewTranslations(){this.isLoading=!0,e(this.translationUrl).then((()=>{this.isLoading=!1}))}async componentWillLoad(){this.translationUrl.length>2&&await e(this.translationUrl)}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBus?function(t,i){if(window.emMessageBus){const n=document.createElement("style");window.emMessageBus.subscribe(i,(i=>{n.innerHTML=i,t&&t.appendChild(n)}))}}(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&s(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){if(this.isClosed)return null;const t=`${this.speed}s`;return i("div",{ref:t=>this.stylingContainer=t},this.canMinimize&&i("button",{class:"ToggleButton",onClick:this.toggleMinimize},i("span",{class:this.isMinimized?"TriangleActive":"TriangleInactive"},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"6.835",viewBox:"0 0 14 6.835"},i("path",{id:"arrow",d:"M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z",transform:"translate(-274.511 -441.088)"})))),i("div",{class:{NotificationWrapper:!0,Minimized:this.isMinimized}},i("div",{class:{SlidingBar:!0,Minimized:this.isMinimized,ScrollLeft:"scroll-left"===this.animationType,ScrollRight:"scroll-right"===this.animationType,VisibleButtons:this.canMinimize||!0===this.canClose}},i("div",{class:"Message",style:{animationDuration:t}},this.isLoading?((t,i)=>{let n=o[void 0!==i&&i in o?i:"en"].loading;return n})(0,this.language):this.message)),this.canClose&&i("div",{class:"CloseButton"},i("button",{onClick:this.closeNotification},"X"))))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"],translationUrl:["handleNewTranslations"]}}};r.style=":host{display:block}.NotificationWrapper{background:var(--emw--header-color-background, var(--emw--color-background, #000000));color:var(--emw--color-white, #FFFFFF);position:sticky;width:100%;text-align:center;overflow:hidden;z-index:298;display:flex;justify-content:flex-end;align-items:center;border-bottom:6px solid var(--emw--color-primary, #22B04E);max-height:40px}.SlidingBar{transition:all 0.3s ease-in-out;width:100%}.Message{will-change:transform;margin:0 auto;padding:10px;width:90%}.ScrollLeft .Message{white-space:nowrap;animation:scroll-left 10s linear infinite;width:100%}.ScrollRight .Message{white-space:nowrap;animation:scroll-right 10s linear infinite;width:100%}.VisibleButtons .Message{display:flex}@keyframes scroll-left{from{transform:translateX(100%)}to{transform:translateX(-100%)}}@keyframes scroll-right{from{transform:translateX(-100%)}to{transform:translateX(100%)}}.SlidingBar:hover .Message{animation-play-state:paused}.CloseButton{padding-left:10px;background-color:var(--emw--header-color-background, var(--emw--color-background, #000000));display:flex;z-index:299;gap:10px}.ToggleButton{position:absolute;left:0}.ToggleButton .TriangleActive,.ToggleButton .TriangleInactive{display:block;transition:all 0.2s}.ToggleButton .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px);fill:var(--emw--color-primary, #52d004);margin-top:8px}.ToggleButton svg{fill:var(--emw--header-color-background, var(--emw--color-background, #000000));width:16px;transform:rotate(180deg)}.CloseButton{right:10px}button{background-color:var(--emw--color-primary, #22B04E);color:var(--emw--header-color-background, var(--emw--color-background, #000000));border:none;width:40px;height:40px;cursor:pointer}.NotificationWrapper.Minimized{visibility:hidden}";export{r as G}
@@ -0,0 +1 @@
1
+ export{G as general_news_notification}from"./p-1e0da72c.js";import"./p-b1020fc5.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),r=new Map,i=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})(),m=!1,d=[],w=[],y=(t,e)=>n=>{t.push(n),m||(m=!0,e&&4&f.o?b(v):f.raf(v))},$=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){s(t)}t.length=0},v=()=>{$(d),$(w),(m=d.length>0)&&f.raf(v)},b=t=>h().then(t),g=y(w,!0),S={},j=t=>"object"==(t=typeof t)||"function"===t;function O(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:()=>C,ok:()=>k,unwrap:()=>P,unwrapErr:()=>L});var k=t=>({isOk:!0,isErr:!1,value:t}),E=t=>({isOk:!1,isErr:!0,value:t});function C(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then((t=>k(t))):k(n)}if(t.isErr)return E(t.value);throw"should never get here"}var M,x,P=t=>{if(t.isOk)return t.value;throw t.value},L=t=>{if(t.isErr)return t.value;throw t.value},R=(t,e,...n)=>{let o=null,l=!1,s=!1;const r=[],i=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?i(o):null!=o&&"boolean"!=typeof o&&((l="function"!=typeof t&&!j(o))&&(o+=""),l&&s?r[r.length-1].i+=o:r.push(l?T(null,o):o),s=l)};if(i(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}const c=T(t,null);return c.u=e,r.length>0&&(c.h=r),c},T=(t,e)=>({o:0,p:t,i:e,m:null,h:null,u:null}),A={},F=new WeakMap,N=t=>"sc-"+t.$,U=(t,e,n,o,s,r)=>{if(n!==o){let i=l(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList,l=D(n),s=D(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(i||"o"!==e[0]||"n"!==e[1]){const l=j(o);if((i||l&&null!==o)&&!s)try{if(t.tagName.includes("-"))t[e]=o;else{const l=null==o?"":o;"list"===e?i=!1:null!=n&&t[e]==l||(t[e]=l)}}catch(t){}null==o||!1===o?!1===o&&""!==t.getAttribute(e)||t.removeAttribute(e):(!i||4&r||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(H);e=e.replace(q,""),n&&f.rel(t,e,n,l),o&&f.ael(t,e,o,l)}}},W=/\s/,D=t=>t?t.split(W):[],H="Capture",q=RegExp(H+"$"),G=(t,e,n)=>{const o=11===e.m.nodeType&&e.m.host?e.m.host:e.m,l=t&&t.u||S,s=e.u||S;for(const t of V(Object.keys(l)))t in s||U(o,t,l[t],void 0,n,e.o);for(const t of V(Object.keys(s)))U(o,t,l[t],s[t],n,e.o)};function V(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var _=!1,z=(t,e,n)=>{const o=e.h[n];let l,s,r=0;if(null!==o.i)l=o.m=a.createTextNode(o.i);else{if(_||(_="svg"===o.p),l=o.m=a.createElementNS(_?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.p),_&&"foreignObject"===o.p&&(_=!1),G(null,o,_),null!=M&&l["s-si"]!==M&&l.classList.add(l["s-si"]=M),o.h)for(r=0;r<o.h.length;++r)s=z(t,o,r),s&&l.appendChild(s);"svg"===o.p?_=!1:"foreignObject"===l.tagName&&(_=!0)}return l["s-hn"]=x,l},B=(t,e,n,o,l,s)=>{let r,i=t;for(i.shadowRoot&&i.tagName===x&&(i=i.shadowRoot);l<=s;++l)o[l]&&(r=z(null,n,l),r&&(o[l].m=r,X(i,r,e)))},I=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.m;Q(e),t&&t.remove()}}},J=(t,e)=>t.p===e.p,K=(t,e,n=!1)=>{const o=e.m=t.m,l=t.h,s=e.h,r=e.p,i=e.i;null===i?(G(t,e,_="svg"===r||"foreignObject"!==r&&_),null!==l&&null!==s?((t,e,n,o,l=!1)=>{let s,r=0,i=0,c=e.length-1,u=e[0],a=e[c],f=o.length-1,h=o[0],p=o[f];for(;r<=c&&i<=f;)null==u?u=e[++r]:null==a?a=e[--c]:null==h?h=o[++i]:null==p?p=o[--f]:J(u,h)?(K(u,h,l),u=e[++r],h=o[++i]):J(a,p)?(K(a,p,l),a=e[--c],p=o[--f]):J(u,p)?(K(u,p,l),X(t,u.m,a.m.nextSibling),u=e[++r],p=o[--f]):J(a,h)?(K(a,h,l),X(t,a.m,u.m),a=e[--c],h=o[++i]):(s=z(e&&e[i],n,i),h=o[++i],s&&X(u.m.parentNode,s,u.m));r>c?B(t,null==o[f+1]?null:o[f+1].m,n,o,i,f):i>f&&I(e,r,c)})(o,l,e,s,n):null!==s?(null!==t.i&&(o.textContent=""),B(o,null,e,s,0,s.length-1)):null!==l&&I(l,0,l.length-1),_&&"svg"===r&&(_=!1)):t.i!==i&&(o.data=i)},Q=t=>{t.u&&t.u.ref&&t.u.ref(null),t.h&&t.h.map(Q)},X=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),Y=(t,e)=>{e&&!t.v&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.v=e)))},Z=(t,e)=>{if(t.o|=16,!(4&t.o))return Y(t,t.S),g((()=>tt(t,e)));t.o|=512},tt=(t,e)=>{const n=t.t;if(!n)throw Error(`Can't render component <${t.$hostElement$.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 o;return e&&(o=it(n,"componentWillLoad")),et(o,(()=>ot(t,n,e)))},et=(t,e)=>nt(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),nt=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,ot=async(t,e,n)=>{var o;const l=t.$hostElement$,s=l["s-rc"];n&&(t=>{const e=t.j,n=t.$hostElement$,o=e.o,l=((t,e)=>{var n;const o=N(e),l=i.get(o);if(t=11===t.nodeType?t:a,l)if("string"==typeof l){let s,r=F.get(t=t.head||t);if(r||F.set(t,r=new Set),!r.has(o)){{s=a.createElement("style"),s.innerHTML=l;const e=null!=(n=f.O)?n:O(a);null!=e&&s.setAttribute("nonce",e),t.insertBefore(s,t.querySelector("link"))}4&e.o&&(s.innerHTML+=c),r&&r.add(o)}}else t.adoptedStyleSheets.includes(l)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,l]);return o})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);lt(t,e,l,n),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>st(t);0===e.length?n():(Promise.all(e).then(n),t.o|=4,e.length=0)}},lt=(t,e,n,o)=>{try{e=e.render(),t.o&=-17,t.o|=2,((t,e,n=!1)=>{const o=t.$hostElement$,l=t.j,s=t.k||T(null,null),r=(t=>t&&t.p===A)(e)?e:R(null,null,e);if(x=o.tagName,n&&r.u)for(const t of Object.keys(r.u))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(r.u[t]=o[t]);r.p=null,r.o|=4,t.k=r,r.m=s.m=o.shadowRoot||o,M=o["s-sc"],K(s,r,n)})(t,e,o)}catch(e){s(e,t.$hostElement$)}return null},st=t=>{const e=t.$hostElement$,n=t.t,o=t.S;64&t.o||(t.o|=64,ct(e),it(n,"componentDidLoad"),t.C(e),o||rt()),t.v&&(t.v(),t.v=void 0),512&t.o&&b((()=>Z(t,!1))),t.o&=-517},rt=()=>{ct(a.documentElement),b((()=>(t=>{const e=f.ce("appload",{detail:{namespace:"general-news-notification"}});return t.dispatchEvent(e),e})(u)))},it=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(t){s(t)}},ct=t=>t.classList.add("hydrated"),ut=(t,e,o)=>{var l,r;const i=t.prototype;if(e.M||e.P||t.watchers){t.watchers&&!e.P&&(e.P=t.watchers);const c=Object.entries(null!=(l=e.M)?l:{});if(c.map((([t,[l]])=>{(31&l||2&o&&32&l)&&Object.defineProperty(i,t,{get(){return((t,e)=>n(this).L.get(e))(0,t)},set(o){((t,e,o,l)=>{const r=n(t);if(!r)throw Error(`Couldn't find host element for "${l.$}" 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 i=r.$hostElement$,c=r.L.get(e),u=r.o,a=r.t;if(o=((t,e)=>null==t||j(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?parseFloat(t):1&e?t+"":t)(o,l.M[e][0]),(!(8&u)||void 0===c)&&o!==c&&(!Number.isNaN(c)||!Number.isNaN(o))&&(r.L.set(e,o),a)){if(l.P&&128&u){const t=l.P[e];t&&t.map((t=>{try{a[t](o,c,e)}catch(t){s(t,i)}}))}2==(18&u)&&Z(r,!1)}})(this,t,o,e)},configurable:!0,enumerable:!0})})),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.P)?void 0:r[t];null==i||i.forEach((e=>{null!=n[e]&&n[e].call(n,s,l,t)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},t.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=e.P)?r:{}),...c.filter((([t,e])=>15&e[0])).map((([t,e])=>{const n=e[1]||t;return o.set(n,t),n}))]))}}return t},at=t=>{it(t,"disconnectedCallback")},ft=(t,o={})=>{var l;const h=[],m=o.exclude||[],d=u.customElements,w=a.head,y=w.querySelector("meta[charset]"),$=a.createElement("style"),v=[];let b,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],$:o[1],M:o[2],R:o[3]};4&c.o&&(S=!0),c.M=o[2],c.P=null!=(l=o[4])?l:{};const u=c.$,a=class extends HTMLElement{constructor(t){if(super(t),this.hasRegisteredEventListeners=!1,((t,n)=>{const o={o:0,$hostElement$:t,j:n,L:new Map};o.T=new Promise((t=>o.C=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.$}! Mode is set to ${t.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else t.attachShadow({mode:"open"})}connectedCallback(){this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),b&&(clearTimeout(b),b=null),g?v.push(this):f.jmp((()=>(t=>{if(!(1&f.o)){const e=n(t),o=e.j,l=()=>{};if(1&e.o)(null==e?void 0:e.t)||(null==e?void 0:e.T)&&e.T.then((()=>{}));else{e.o|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){Y(e,e.S=n);break}}o.M&&Object.entries(o.M).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.A){const t=(t=>{const e=t.$.replace(/-/g,"_"),n=t.A;if(!n)return;const o=r.get(n);return o?o[e]:import(`./${n}.entry.js`).then((t=>(r.set(n,t),t[e])),s)
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n);if(t&&"then"in t){const e=()=>{};o=await t,e()}else o=t;if(!o)throw Error(`Constructor for "${n.$}#${e.F}" was not found`);o.isProxied||(n.P=o.watchers,ut(o,n,2),o.isProxied=!0);const l=()=>{};e.o|=8;try{new o(e)}catch(t){s(t)}e.o&=-9,e.o|=128,l()}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=N(n);if(!i.has(e)){const o=()=>{};((t,e,n)=>{let o=i.get(t);p&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,i.set(t,o)})(e,t,!!(1&n.o)),o()}}}const l=e.S,c=()=>Z(e,!0);l&&l["s-rc"]?l["s-rc"].push(c):c()})(t,e,o)}l()}})(this)))}disconnectedCallback(){f.jmp((()=>(async()=>{if(!(1&f.o)){const t=n(this);(null==t?void 0:t.t)?at(t.t):(null==t?void 0:t.T)&&t.T.then((()=>at(t.t)))}})()))}componentOnReady(){return n(this).T}};c.A=t[0],m.includes(u)||d.get(u)||(h.push(u),d.define(u,ut(a,c,1)))}))})),h.length>0&&(S&&($.textContent+=c),$.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",$.innerHTML.length)){$.setAttribute("data-styles","");const t=null!=(l=f.O)?l:O(a);null!=t&&$.setAttribute("nonce",t),w.insertBefore($,y?y.nextSibling:w.firstChild)}g=!1,v.length?v.map((t=>t.connectedCallback())):f.jmp((()=>b=setTimeout(rt,30)))},ht=t=>f.O=t;export{ft as b,R as h,h as p,o as r,ht as s}
@@ -23,6 +23,10 @@ export declare class GeneralNewsNotification {
23
23
  * Option to close the notification
24
24
  */
25
25
  canClose: boolean;
26
+ /**
27
+ * Client custom styling via streamStyling
28
+ */
29
+ mbSource: string;
26
30
  /**
27
31
  * Client custom styling via string
28
32
  */
@@ -40,15 +44,15 @@ export declare class GeneralNewsNotification {
40
44
  isClosed: boolean;
41
45
  private isLoading;
42
46
  private stylingContainer;
47
+ private stylingSubscription;
43
48
  watchEndpoint(newValue: string, oldValue: string): void;
44
- handleStylingChange(newValue: string, oldValue: string): void;
45
- handleStylingUrlChange(newValue: string, oldValue: string): void;
49
+ handleClientStylingChange(newValue: any, oldValue: any): void;
50
+ handleClientStylingChangeURL(newValue: any, oldValue: any): void;
46
51
  handleNewTranslations(): void;
47
52
  componentWillLoad(): Promise<void>;
48
- componentDidLoad: () => void;
53
+ componentDidLoad(): void;
54
+ disconnectedCallback(): void;
49
55
  connectedCallback: () => void;
50
- setClientStyling: () => void;
51
- setClientStylingURL: () => void;
52
56
  getNotificationMessage: () => void;
53
57
  toggleMinimize: () => void;
54
58
  closeNotification: () => void;
@@ -35,6 +35,10 @@ export namespace Components {
35
35
  * The language
36
36
  */
37
37
  "language": string;
38
+ /**
39
+ * Client custom styling via streamStyling
40
+ */
41
+ "mbSource": string;
38
42
  /**
39
43
  * Default speed of the scroll animation in seconds
40
44
  */
@@ -86,6 +90,10 @@ declare namespace LocalJSX {
86
90
  * The language
87
91
  */
88
92
  "language"?: string;
93
+ /**
94
+ * Client custom styling via streamStyling
95
+ */
96
+ "mbSource"?: string;
89
97
  /**
90
98
  * Default speed of the scroll animation in seconds
91
99
  */
@@ -1015,8 +1015,6 @@ export declare namespace JSXBase {
1015
1015
  autoPlay?: boolean;
1016
1016
  autoplay?: boolean | string;
1017
1017
  controls?: boolean;
1018
- controlslist?: 'nodownload' | 'nofullscreen' | 'noremoteplayback';
1019
- controlsList?: 'nodownload' | 'nofullscreen' | 'noremoteplayback';
1020
1018
  crossOrigin?: string;
1021
1019
  crossorigin?: string;
1022
1020
  loop?: boolean;
@@ -1566,10 +1564,6 @@ export declare namespace JSXBase {
1566
1564
  onSubmitCapture?: (event: Event) => void;
1567
1565
  onInvalid?: (event: Event) => void;
1568
1566
  onInvalidCapture?: (event: Event) => void;
1569
- onBeforeToggle?: (event: Event) => void;
1570
- onBeforeToggleCapture?: (event: Event) => void;
1571
- onToggle?: (event: Event) => void;
1572
- onToggleCapture?: (event: Event) => void;
1573
1567
  onLoad?: (event: Event) => void;
1574
1568
  onLoadCapture?: (event: Event) => void;
1575
1569
  onError?: (event: Event) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-news-notification",
3
- "version": "1.55.0",
3
+ "version": "1.56.2",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -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),r=new Map,i=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})(),m=!1,d=[],y=[],w=(t,e)=>n=>{t.push(n),m||(m=!0,e&&4&f.o?b(v):f.raf(v))},$=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){s(t)}t.length=0},v=()=>{$(d),$(y),(m=d.length>0)&&f.raf(v)},b=t=>h().then(t),g=w(y,!0),S={},j=t=>"object"==(t=typeof t)||"function"===t;function O(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:()=>C,ok:()=>E,unwrap:()=>x,unwrapErr:()=>P});var E=t=>({isOk:!0,isErr:!1,value:t}),k=t=>({isOk:!1,isErr:!0,value:t});function C(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then((t=>E(t))):E(n)}if(t.isErr)return k(t.value);throw"should never get here"}var M,x=t=>{if(t.isOk)return t.value;throw t.value},P=t=>{if(t.isErr)return t.value;throw t.value},A=(t,e,...n)=>{let o=null,l=!1,s=!1;const r=[],i=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?i(o):null!=o&&"boolean"!=typeof o&&((l="function"!=typeof t&&!j(o))&&(o+=""),l&&s?r[r.length-1].i+=o:r.push(l?H(null,o):o),s=l)};if(i(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}const c=H(t,null);return c.u=e,r.length>0&&(c.h=r),c},H=(t,e)=>({o:0,p:t,i:e,m:null,h:null,u:null}),R={},T=new WeakMap,D=t=>"sc-"+t.$,F=(t,e,n,o,s,r)=>{if(n!==o){let i=l(t,e),c=e.toLowerCase();if("class"===e){const e=t.classList,l=N(n),s=N(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(i||"o"!==e[0]||"n"!==e[1]){const l=j(o);if((i||l&&null!==o)&&!s)try{if(t.tagName.includes("-"))t[e]=o;else{const l=null==o?"":o;"list"===e?i=!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):(!i||4&r||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(U);e=e.replace(W,""),n&&f.rel(t,e,n,l),o&&f.ael(t,e,o,l)}}},L=/\s/,N=t=>t?t.split(L):[],U="Capture",W=RegExp(U+"$"),q=(t,e,n)=>{const o=11===e.m.nodeType&&e.m.host?e.m.host:e.m,l=t&&t.u||S,s=e.u||S;for(const t of G(Object.keys(l)))t in s||F(o,t,l[t],void 0,n,e.o);for(const t of G(Object.keys(s)))F(o,t,l[t],s[t],n,e.o)};function G(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var V=!1,_=(t,e,n)=>{const o=e.h[n];let l,s,r=0;if(null!==o.i)l=o.m=a.createTextNode(o.i);else{if(V||(V="svg"===o.p),l=o.m=a.createElementNS(V?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.p),V&&"foreignObject"===o.p&&(V=!1),q(null,o,V),l.getRootNode().querySelector("body"),o.h)for(r=0;r<o.h.length;++r)s=_(t,o,r),s&&l.appendChild(s);"svg"===o.p?V=!1:"foreignObject"===l.tagName&&(V=!0)}return l["s-hn"]=M,l},z=(t,e,n,o,l,s)=>{let r,i=t;for(i.shadowRoot&&i.tagName===M&&(i=i.shadowRoot);l<=s;++l)o[l]&&(r=_(null,n,l),r&&(o[l].m=r,Q(i,r,e)))},B=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.m;K(e),t&&t.remove()}}},I=(t,e)=>t.p===e.p,J=(t,e,n=!1)=>{const o=e.m=t.m,l=t.h,s=e.h,r=e.p,i=e.i;null===i?(q(t,e,V="svg"===r||"foreignObject"!==r&&V),null!==l&&null!==s?((t,e,n,o,l=!1)=>{let s,r=0,i=0,c=e.length-1,u=e[0],a=e[c],f=o.length-1,h=o[0],p=o[f];for(;r<=c&&i<=f;)null==u?u=e[++r]:null==a?a=e[--c]:null==h?h=o[++i]:null==p?p=o[--f]:I(u,h)?(J(u,h,l),u=e[++r],h=o[++i]):I(a,p)?(J(a,p,l),a=e[--c],p=o[--f]):I(u,p)?(J(u,p,l),Q(t,u.m,a.m.nextSibling),u=e[++r],p=o[--f]):I(a,h)?(J(a,h,l),Q(t,a.m,u.m),a=e[--c],h=o[++i]):(s=_(e&&e[i],n,i),h=o[++i],s&&Q(u.m.parentNode,s,u.m));r>c?z(t,null==o[f+1]?null:o[f+1].m,n,o,i,f):i>f&&B(e,r,c)})(o,l,e,s,n):null!==s?(null!==t.i&&(o.textContent=""),z(o,null,e,s,0,s.length-1)):!n&&null!==l&&B(l,0,l.length-1),V&&"svg"===r&&(V=!1)):t.i!==i&&(o.data=i)},K=t=>{t.u&&t.u.ref&&t.u.ref(null),t.h&&t.h.map(K)},Q=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),X=(t,e)=>{e&&!t.v&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.v=e)))},Y=(t,e)=>{if(t.o|=16,!(4&t.o))return X(t,t.S),g((()=>Z(t,e)));t.o|=512},Z=(t,e)=>{const n=t.t;if(!n)throw Error(`Can't render component <${t.$hostElement$.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 o;return e&&(o=rt(n,"componentWillLoad")),tt(o,(()=>nt(t,n,e)))},tt=(t,e)=>et(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),et=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,nt=async(t,e,n)=>{var o;const l=t.$hostElement$,s=l["s-rc"];n&&(t=>{const e=t.j,n=t.$hostElement$,o=e.o,l=((t,e)=>{var n;const o=D(e),l=i.get(o);if(t=11===t.nodeType?t:a,l)if("string"==typeof l){let s,r=T.get(t=t.head||t);if(r||T.set(t,r=new Set),!r.has(o)){{s=a.createElement("style"),s.innerHTML=l;const o=null!=(n=f.O)?n:O(a);if(null!=o&&s.setAttribute("nonce",o),!(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,n)}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&&"HEAD"!==t.nodeName&&t.insertBefore(s,null)}4&e.o&&(s.innerHTML+=c),r&&r.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&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);ot(t,e,l,n),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>lt(t);0===e.length?n():(Promise.all(e).then(n),t.o|=4,e.length=0)}},ot=(t,e,n,o)=>{try{e=e.render(),t.o&=-17,t.o|=2,((t,e,n=!1)=>{const o=t.$hostElement$,l=t.j,s=t.k||H(null,null),r=(t=>t&&t.p===R)(e)?e:A(null,null,e);if(M=o.tagName,n&&r.u)for(const t of Object.keys(r.u))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(r.u[t]=o[t]);r.p=null,r.o|=4,t.k=r,r.m=s.m=o.shadowRoot||o,J(s,r,n)})(t,e,o)}catch(e){s(e,t.$hostElement$)}return null},lt=t=>{const e=t.$hostElement$,n=t.S;64&t.o||(t.o|=64,it(e),t.C(e),n||st()),t.v&&(t.v(),t.v=void 0),512&t.o&&b((()=>Y(t,!1))),t.o&=-517},st=()=>{it(a.documentElement),b((()=>(t=>{const e=f.ce("appload",{detail:{namespace:"general-news-notification"}});return t.dispatchEvent(e),e})(u)))},rt=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(t){s(t)}},it=t=>t.classList.add("hydrated"),ct=(t,e,o)=>{var l,r;const i=t.prototype;if(e.M||e.P||t.watchers){t.watchers&&!e.P&&(e.P=t.watchers);const c=Object.entries(null!=(l=e.M)?l:{});if(c.map((([t,[l]])=>{(31&l||2&o&&32&l)&&Object.defineProperty(i,t,{get(){return((t,e)=>n(this).A.get(e))(0,t)},set(o){((t,e,o,l)=>{const r=n(t);if(!r)throw Error(`Couldn't find host element for "${l.$}" 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 i=r.$hostElement$,c=r.A.get(e),u=r.o,a=r.t;if(o=((t,e)=>null==t||j(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?parseFloat(t):1&e?t+"":t)(o,l.M[e][0]),(!(8&u)||void 0===c)&&o!==c&&(!Number.isNaN(c)||!Number.isNaN(o))&&(r.A.set(e,o),a)){if(l.P&&128&u){const t=l.P[e];t&&t.map((t=>{try{a[t](o,c,e)}catch(t){s(t,i)}}))}2==(18&u)&&Y(r,!1)}})(this,t,o,e)},configurable:!0,enumerable:!0})})),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.P)?void 0:r[t];null==i||i.forEach((e=>{null!=n[e]&&n[e].call(n,s,l,t)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},t.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=e.P)?r:{}),...c.filter((([t,e])=>15&e[0])).map((([t,e])=>{const n=e[1]||t;return o.set(n,t),n}))]))}}return t},ut=(t,o={})=>{var l;const h=[],m=o.exclude||[],d=u.customElements,y=a.head,w=y.querySelector("meta[charset]"),$=a.createElement("style"),v=[];let b,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],$:o[1],M:o[2],H:o[3]};4&c.o&&(S=!0),c.M=o[2],c.P=null!=(l=o[4])?l:{};const u=c.$,a=class extends HTMLElement{constructor(t){if(super(t),this.hasRegisteredEventListeners=!1,((t,n)=>{const o={o:0,$hostElement$:t,j:n,A:new Map};o.R=new Promise((t=>o.C=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.$}! Mode is set to ${t.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else t.attachShadow({mode:"open"})}connectedCallback(){this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),b&&(clearTimeout(b),b=null),g?v.push(this):f.jmp((()=>(t=>{if(!(1&f.o)){const e=n(t),o=e.j,l=()=>{};if(1&e.o)(null==e?void 0:e.t)||(null==e?void 0:e.R)&&e.R.then((()=>{}));else{e.o|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){X(e,e.S=n);break}}o.M&&Object.entries(o.M).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.T){const t=(t=>{const e=t.$.replace(/-/g,"_"),n=t.T;if(!n)return;const o=r.get(n);return o?o[e]:import(`./${n}.entry.js`).then((t=>(r.set(n,t),t[e])),s)
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n);if(t&&"then"in t){const e=()=>{};o=await t,e()}else o=t;if(!o)throw Error(`Constructor for "${n.$}#${e.D}" was not found`);o.isProxied||(n.P=o.watchers,ct(o,n,2),o.isProxied=!0);const l=()=>{};e.o|=8;try{new o(e)}catch(t){s(t)}e.o&=-9,e.o|=128,l()}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=D(n);if(!i.has(e)){const o=()=>{};((t,e,n)=>{let o=i.get(t);p&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,i.set(t,o)})(e,t,!!(1&n.o)),o()}}}const l=e.S,c=()=>Y(e,!0);l&&l["s-rc"]?l["s-rc"].push(c):c()})(t,e,o)}l()}})(this)))}disconnectedCallback(){f.jmp((()=>(async()=>{if(!(1&f.o)){const t=n(this);(null==t?void 0:t.t)||(null==t?void 0:t.R)&&t.R.then((()=>{}))}})()))}componentOnReady(){return n(this).R}};c.T=t[0],m.includes(u)||d.get(u)||(h.push(u),d.define(u,ct(a,c,1)))}))})),h.length>0&&(S&&($.textContent+=c),$.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",$.innerHTML.length)){$.setAttribute("data-styles","");const t=null!=(l=f.O)?l:O(a);null!=t&&$.setAttribute("nonce",t),y.insertBefore($,w?w.nextSibling:y.firstChild)}g=!1,v.length?v.map((t=>t.connectedCallback())):f.jmp((()=>b=setTimeout(st,30)))},at=t=>f.O=t;export{ut as b,A as h,h as p,o as r,at as s}
@@ -1 +0,0 @@
1
- import{r as t,h as i}from"./p-51c5e725.js";const e=()=>{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":"iPad"===t||"iPhone"===t?"ios":"mtWeb"},s={en:{loading:"Is Loading ..."}},o=t=>new Promise((i=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((i=>{s[i]||(s[i]={});for(let e in t[i])s[i][e]=t[i][e]})),i(!0)}))})),r=class{constructor(i){t(this,i),this.componentDidLoad=()=>{this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL())},this.connectedCallback=()=>{this.cmsEndpoint&&this.language&&this.getNotificationMessage()},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.getNotificationMessage=()=>{this.isLoading=!0;try{let t=new URL(`${this.cmsEndpoint}/${this.language}/header-notification`);t.searchParams.append("device",e()),t.searchParams.append("platform",e()),fetch(t.href).then((t=>{if(200===t.status)return t.json();throw new Error("HTTP status "+t.status)})).then((t=>{this.message=t.message})).catch((t=>{console.error(t)})).finally((()=>this.isLoading=!1))}catch(t){console.error("Error fetching message:",t)}},this.toggleMinimize=()=>{this.isMinimized=!this.isMinimized},this.closeNotification=()=>{this.isClosed=!0},this.cmsEndpoint=void 0,this.language=void 0,this.animationType="static",this.speed=30,this.canMinimize=!1,this.canClose=!1,this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.message=void 0,this.isMinimized=!1,this.isClosed=!1,this.isLoading=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.language&&this.getNotificationMessage()}handleStylingChange(t,i){t!==i&&this.setClientStyling()}handleStylingUrlChange(t,i){t!==i&&this.setClientStylingURL()}handleNewTranslations(){this.isLoading=!0,o(this.translationUrl).then((()=>{this.isLoading=!1}))}async componentWillLoad(){this.translationUrl.length>2&&await o(this.translationUrl)}render(){if(this.isClosed)return null;const t=`${this.speed}s`;return i("div",{ref:t=>this.stylingContainer=t},this.canMinimize&&i("button",{class:"ToggleButton",onClick:this.toggleMinimize},i("span",{class:this.isMinimized?"TriangleActive":"TriangleInactive"},i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"6.835",viewBox:"0 0 14 6.835"},i("path",{id:"arrow",d:"M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z",transform:"translate(-274.511 -441.088)"})))),i("div",{class:{NotificationWrapper:!0,Minimized:this.isMinimized}},i("div",{class:{SlidingBar:!0,Minimized:this.isMinimized,ScrollLeft:"scroll-left"===this.animationType,ScrollRight:"scroll-right"===this.animationType,VisibleButtons:this.canMinimize||!0===this.canClose}},i("div",{class:"Message",style:{animationDuration:t}},this.isLoading?((t,i)=>{let e=s[void 0!==i&&i in s?i:"en"].loading;return e})(0,this.language):this.message)),this.canClose&&i("div",{class:"CloseButton"},i("button",{onClick:this.closeNotification},"X"))))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],clientStyling:["handleStylingChange"],clientStylingUrl:["handleStylingUrlChange"],translationUrl:["handleNewTranslations"]}}};r.style=":host{display:block}.NotificationWrapper{background:var(--emw--header-color-background, var(--emw--color-background, #000000));color:var(--emw--color-white, #FFFFFF);position:sticky;width:100%;text-align:center;overflow:hidden;z-index:298;display:flex;justify-content:flex-end;align-items:center;border-bottom:6px solid var(--emw--color-primary, #22B04E);max-height:40px}.SlidingBar{transition:all 0.3s ease-in-out;width:100%}.Message{will-change:transform;margin:0 auto;padding:10px;width:90%}.ScrollLeft .Message{white-space:nowrap;animation:scroll-left 10s linear infinite;width:100%}.ScrollRight .Message{white-space:nowrap;animation:scroll-right 10s linear infinite;width:100%}.VisibleButtons .Message{display:flex}@keyframes scroll-left{from{transform:translateX(100%)}to{transform:translateX(-100%)}}@keyframes scroll-right{from{transform:translateX(-100%)}to{transform:translateX(100%)}}.SlidingBar:hover .Message{animation-play-state:paused}.CloseButton{padding-left:10px;background-color:var(--emw--header-color-background, var(--emw--color-background, #000000));display:flex;z-index:299;gap:10px}.ToggleButton{position:absolute;left:0}.ToggleButton .TriangleActive,.ToggleButton .TriangleInactive{display:block;transition:all 0.2s}.ToggleButton .TriangleActive{transform:scale(1.1) rotateX(180deg) translateY(3px);fill:var(--emw--color-primary, #52d004);margin-top:8px}.ToggleButton svg{fill:var(--emw--header-color-background, var(--emw--color-background, #000000));width:16px;transform:rotate(180deg)}.CloseButton{right:10px}button{background-color:var(--emw--color-primary, #22B04E);color:var(--emw--header-color-background, var(--emw--color-background, #000000));border:none;width:40px;height:40px;cursor:pointer}.NotificationWrapper.Minimized{visibility:hidden}";export{r as G}
@@ -1 +0,0 @@
1
- export{G as general_news_notification}from"./p-bb80c541.js";import"./p-51c5e725.js";