@everymatrix/general-about-us 1.55.0 → 1.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/cjs/general-about-us.cjs.entry.js +109 -41
  2. package/dist/cjs/general-about-us.cjs.js +3 -3
  3. package/dist/cjs/{index-3d4db61a.js → index-e275fea3.js} +174 -71
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/components/general-about-us/general-about-us.js +86 -40
  7. package/dist/esm/general-about-us.entry.js +109 -41
  8. package/dist/esm/general-about-us.js +4 -4
  9. package/dist/esm/{index-f6c09f3b.js → index-5f2a97a2.js} +174 -71
  10. package/dist/esm/loader.js +3 -3
  11. package/dist/general-about-us/general-about-us.esm.js +1 -1
  12. package/dist/general-about-us/p-73146ff7.entry.js +1 -0
  13. package/dist/general-about-us/p-c303f99c.js +2 -0
  14. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-about-us/.stencil/packages/stencil/general-about-us/stencil.config.d.ts +2 -0
  15. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-about-us/.stencil/packages/stencil/general-about-us/stencil.config.dev.d.ts +2 -0
  16. package/dist/types/components/general-about-us/general-about-us.d.ts +8 -4
  17. package/dist/types/components.d.ts +8 -0
  18. package/package.json +1 -1
  19. package/dist/general-about-us/p-157a2384.entry.js +0 -1
  20. package/dist/general-about-us/p-a4cae9d7.js +0 -2
  21. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/general-about-us/.stencil/packages/stencil/general-about-us/stencil.config.d.ts +0 -2
  22. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/general-about-us/.stencil/packages/stencil/general-about-us/stencil.config.dev.d.ts +0 -2
  23. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-about-us/.stencil/tools/plugins/index.d.ts +0 -0
  24. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-about-us/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  25. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-about-us/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  26. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/general-about-us/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-3d4db61a.js');
5
+ const index = require('./index-e275fea3.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
8
  const TRANSLATIONS = {
@@ -36,6 +36,63 @@ const translate = (key, customLang) => {
36
36
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
37
37
  };
38
38
 
39
+ /**
40
+ * @name setClientStyling
41
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
42
+ * @param {HTMLElement} stylingContainer The reference element of the widget
43
+ * @param {string} clientStyling The style content
44
+ */
45
+ function setClientStyling(stylingContainer, clientStyling) {
46
+ if (stylingContainer) {
47
+ const sheet = document.createElement('style');
48
+ sheet.innerHTML = clientStyling;
49
+ stylingContainer.appendChild(sheet);
50
+ }
51
+ }
52
+
53
+ /**
54
+ * @name setClientStylingURL
55
+ * @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
56
+ * @param {HTMLElement} stylingContainer The reference element of the widget
57
+ * @param {string} clientStylingUrl The URL of the style content
58
+ */
59
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
60
+ const url = new URL(clientStylingUrl);
61
+
62
+ fetch(url.href)
63
+ .then((res) => res.text())
64
+ .then((data) => {
65
+ const cssFile = document.createElement('style');
66
+ cssFile.innerHTML = data;
67
+ if (stylingContainer) {
68
+ stylingContainer.appendChild(cssFile);
69
+ }
70
+ })
71
+ .catch((err) => {
72
+ console.error('There was an error while trying to load client styling from URL', err);
73
+ });
74
+ }
75
+
76
+ /**
77
+ * @name setStreamLibrary
78
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
79
+ * @param {HTMLElement} stylingContainer The highest element of the widget
80
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
81
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
82
+ */
83
+ function setStreamStyling(stylingContainer, domain, subscription) {
84
+ if (window.emMessageBus) {
85
+ const sheet = document.createElement('style');
86
+
87
+ window.emMessageBus.subscribe(domain, (data) => {
88
+ sheet.innerHTML = data;
89
+ if (stylingContainer) {
90
+ stylingContainer.appendChild(sheet);
91
+ }
92
+ });
93
+ }
94
+ }
95
+
39
96
  function checkDeviceType() {
40
97
  const userAgent = navigator.userAgent.toLowerCase();
41
98
  const width = screen.availWidth;
@@ -101,6 +158,29 @@ const GeneralAboutUsStyle0 = generalAboutUsCss;
101
158
  const GeneralAboutUs = class {
102
159
  constructor(hostRef) {
103
160
  index.registerInstance(this, hostRef);
161
+ /**
162
+ * Language of the widget
163
+ */
164
+ this.language = 'en';
165
+ /**
166
+ * User roles
167
+ */
168
+ this.userRoles = 'everyone';
169
+ /**
170
+ * CMS Endpoint stage
171
+ */
172
+ this.cmsEnv = 'stage';
173
+ /**
174
+ * Client custom styling via inline style
175
+ */
176
+ this.clientStyling = '';
177
+ /**
178
+ * Client custom styling via url
179
+ */
180
+ this.clientStylingUrl = '';
181
+ this.hasErrors = false;
182
+ this.isLoading = true;
183
+ this.device = '';
104
184
  this.handleClick = (url, target, location, isExternal) => {
105
185
  window.postMessage({ type: 'NavigateTo', path: url, target: target, locations: location, externalLink: isExternal || false }, window.location.href);
106
186
  // @ts-ignore Analytics event
@@ -127,25 +207,6 @@ const GeneralAboutUs = class {
127
207
  }
128
208
  return source;
129
209
  };
130
- this.setClientStyling = () => {
131
- let sheet = document.createElement('style');
132
- sheet.innerHTML = this.clientStyling;
133
- this.stylingContainer.prepend(sheet);
134
- };
135
- this.setClientStylingURL = () => {
136
- let url = new URL(this.clientStylingUrl);
137
- let cssFile = document.createElement('style');
138
- fetch(url.href)
139
- .then((res) => res.text())
140
- .then((data) => {
141
- cssFile.innerHTML = data;
142
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
143
- })
144
- .catch((err) => {
145
- console.log('error ', err);
146
- });
147
- };
148
- // end custom styling area
149
210
  this.formatTitle = (title, language) => {
150
211
  let firstWord, restOfTitle;
151
212
  // Check for common languages that do not use space - here: Chinese, Japanese, Thai
@@ -160,22 +221,23 @@ const GeneralAboutUs = class {
160
221
  }
161
222
  return index.h("div", { class: "Title" }, index.h("span", { class: "FirstWord" }, firstWord, " "), index.h("span", null, restOfTitle));
162
223
  };
163
- this.cmsEndpoint = undefined;
164
- this.language = 'en';
165
- this.userRoles = 'everyone';
166
- this.cmsEnv = 'stage';
167
- this.clientStyling = '';
168
- this.clientStylingUrl = '';
169
- this.hasErrors = false;
170
- this.isLoading = true;
171
- this.limitStylingAppends = false;
172
- this.device = '';
173
224
  }
174
225
  watchEndpoint(newValue, oldValue) {
175
226
  if (newValue && newValue != oldValue && this.cmsEndpoint) {
176
227
  this.getAboutUs();
177
228
  }
178
229
  }
230
+ handleClientStylingChange(newValue, oldValue) {
231
+ if (newValue != oldValue) {
232
+ setClientStyling(this.stylingContainer, this.clientStyling);
233
+ }
234
+ }
235
+ handleClientStylingChangeURL(newValue, oldValue) {
236
+ if (newValue != oldValue) {
237
+ if (this.clientStylingUrl)
238
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
239
+ }
240
+ }
179
241
  componentWillLoad() {
180
242
  if (this.cmsEndpoint && this.language) {
181
243
  return this.getAboutUs();
@@ -183,6 +245,20 @@ const GeneralAboutUs = class {
183
245
  }
184
246
  componentDidLoad() {
185
247
  this.device = getDeviceCustom();
248
+ if (this.stylingContainer) {
249
+ if (window.emMessageBus != undefined) {
250
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
251
+ }
252
+ else {
253
+ if (this.clientStyling)
254
+ setClientStyling(this.stylingContainer, this.clientStyling);
255
+ if (this.clientStylingUrl)
256
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
257
+ }
258
+ }
259
+ }
260
+ disconnectedCallback() {
261
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
186
262
  }
187
263
  getAboutUs() {
188
264
  let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
@@ -212,16 +288,6 @@ const GeneralAboutUs = class {
212
288
  });
213
289
  });
214
290
  }
215
- componentDidRender() {
216
- // start custom styling area
217
- if (!this.limitStylingAppends && this.stylingContainer) {
218
- if (this.clientStyling)
219
- this.setClientStyling();
220
- if (this.clientStylingUrl)
221
- this.setClientStylingURL();
222
- this.limitStylingAppends = true;
223
- }
224
- }
225
291
  render() {
226
292
  var _a, _b, _c, _d, _e;
227
293
  if (this.hasErrors) {
@@ -242,7 +308,9 @@ const GeneralAboutUs = class {
242
308
  "cmsEndpoint": ["watchEndpoint"],
243
309
  "language": ["watchEndpoint"],
244
310
  "userRoles": ["watchEndpoint"],
245
- "device": ["watchEndpoint"]
311
+ "device": ["watchEndpoint"],
312
+ "clientStyling": ["handleClientStylingChange"],
313
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
246
314
  }; }
247
315
  };
248
316
  GeneralAboutUs.style = GeneralAboutUsStyle0;
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-3d4db61a.js');
5
+ const index = require('./index-e275fea3.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.26.0 | 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-about-us.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-about-us.cjs",[[1,"general-about-us",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"hasErrors":[32],"isLoading":[32],"limitStylingAppends":[32],"device":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"userRoles":["watchEndpoint"],"device":["watchEndpoint"]}]]]], options);
22
+ return index.bootstrapLazy([["general-about-us.cjs",[[1,"general-about-us",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"hasErrors":[32],"isLoading":[32],"device":[32]},null,{"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"userRoles":["watchEndpoint"],"device":["watchEndpoint"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;