@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
@@ -1,9 +1,33 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { translate } from "../../utils/locale.utils";
3
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
4
  import { getDeviceCustom, checkDeviceType, getDevicePlatform } from "../../utils/utils";
4
5
  import chevronRight from "../../utils/chevron.svg";
5
6
  export class GeneralAboutUs {
6
7
  constructor() {
8
+ /**
9
+ * Language of the widget
10
+ */
11
+ this.language = 'en';
12
+ /**
13
+ * User roles
14
+ */
15
+ this.userRoles = 'everyone';
16
+ /**
17
+ * CMS Endpoint stage
18
+ */
19
+ this.cmsEnv = 'stage';
20
+ /**
21
+ * Client custom styling via inline style
22
+ */
23
+ this.clientStyling = '';
24
+ /**
25
+ * Client custom styling via url
26
+ */
27
+ this.clientStylingUrl = '';
28
+ this.hasErrors = false;
29
+ this.isLoading = true;
30
+ this.device = '';
7
31
  this.handleClick = (url, target, location, isExternal) => {
8
32
  window.postMessage({ type: 'NavigateTo', path: url, target: target, locations: location, externalLink: isExternal || false }, window.location.href);
9
33
  // @ts-ignore Analytics event
@@ -30,25 +54,6 @@ export class GeneralAboutUs {
30
54
  }
31
55
  return source;
32
56
  };
33
- this.setClientStyling = () => {
34
- let sheet = document.createElement('style');
35
- sheet.innerHTML = this.clientStyling;
36
- this.stylingContainer.prepend(sheet);
37
- };
38
- this.setClientStylingURL = () => {
39
- let url = new URL(this.clientStylingUrl);
40
- let cssFile = document.createElement('style');
41
- fetch(url.href)
42
- .then((res) => res.text())
43
- .then((data) => {
44
- cssFile.innerHTML = data;
45
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
46
- })
47
- .catch((err) => {
48
- console.log('error ', err);
49
- });
50
- };
51
- // end custom styling area
52
57
  this.formatTitle = (title, language) => {
53
58
  let firstWord, restOfTitle;
54
59
  // Check for common languages that do not use space - here: Chinese, Japanese, Thai
@@ -63,22 +68,23 @@ export class GeneralAboutUs {
63
68
  }
64
69
  return h("div", { class: "Title" }, h("span", { class: "FirstWord" }, firstWord, " "), h("span", null, restOfTitle));
65
70
  };
66
- this.cmsEndpoint = undefined;
67
- this.language = 'en';
68
- this.userRoles = 'everyone';
69
- this.cmsEnv = 'stage';
70
- this.clientStyling = '';
71
- this.clientStylingUrl = '';
72
- this.hasErrors = false;
73
- this.isLoading = true;
74
- this.limitStylingAppends = false;
75
- this.device = '';
76
71
  }
77
72
  watchEndpoint(newValue, oldValue) {
78
73
  if (newValue && newValue != oldValue && this.cmsEndpoint) {
79
74
  this.getAboutUs();
80
75
  }
81
76
  }
77
+ handleClientStylingChange(newValue, oldValue) {
78
+ if (newValue != oldValue) {
79
+ setClientStyling(this.stylingContainer, this.clientStyling);
80
+ }
81
+ }
82
+ handleClientStylingChangeURL(newValue, oldValue) {
83
+ if (newValue != oldValue) {
84
+ if (this.clientStylingUrl)
85
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
86
+ }
87
+ }
82
88
  componentWillLoad() {
83
89
  if (this.cmsEndpoint && this.language) {
84
90
  return this.getAboutUs();
@@ -86,6 +92,20 @@ export class GeneralAboutUs {
86
92
  }
87
93
  componentDidLoad() {
88
94
  this.device = getDeviceCustom();
95
+ if (this.stylingContainer) {
96
+ if (window.emMessageBus != undefined) {
97
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
98
+ }
99
+ else {
100
+ if (this.clientStyling)
101
+ setClientStyling(this.stylingContainer, this.clientStyling);
102
+ if (this.clientStylingUrl)
103
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
104
+ }
105
+ }
106
+ }
107
+ disconnectedCallback() {
108
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
89
109
  }
90
110
  getAboutUs() {
91
111
  let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
@@ -115,16 +135,6 @@ export class GeneralAboutUs {
115
135
  });
116
136
  });
117
137
  }
118
- componentDidRender() {
119
- // start custom styling area
120
- if (!this.limitStylingAppends && this.stylingContainer) {
121
- if (this.clientStyling)
122
- this.setClientStyling();
123
- if (this.clientStylingUrl)
124
- this.setClientStylingURL();
125
- this.limitStylingAppends = true;
126
- }
127
- }
128
138
  render() {
129
139
  var _a, _b, _c, _d, _e;
130
140
  if (this.hasErrors) {
@@ -169,6 +179,8 @@ export class GeneralAboutUs {
169
179
  "tags": [],
170
180
  "text": "Endpoint URL for the source of data"
171
181
  },
182
+ "getter": false,
183
+ "setter": false,
172
184
  "attribute": "cms-endpoint",
173
185
  "reflect": true
174
186
  },
@@ -186,6 +198,8 @@ export class GeneralAboutUs {
186
198
  "tags": [],
187
199
  "text": "Language of the widget"
188
200
  },
201
+ "getter": false,
202
+ "setter": false,
189
203
  "attribute": "language",
190
204
  "reflect": true,
191
205
  "defaultValue": "'en'"
@@ -204,6 +218,8 @@ export class GeneralAboutUs {
204
218
  "tags": [],
205
219
  "text": "User roles"
206
220
  },
221
+ "getter": false,
222
+ "setter": false,
207
223
  "attribute": "user-roles",
208
224
  "reflect": true,
209
225
  "defaultValue": "'everyone'"
@@ -222,10 +238,31 @@ export class GeneralAboutUs {
222
238
  "tags": [],
223
239
  "text": "CMS Endpoint stage"
224
240
  },
241
+ "getter": false,
242
+ "setter": false,
225
243
  "attribute": "cms-env",
226
244
  "reflect": true,
227
245
  "defaultValue": "'stage'"
228
246
  },
247
+ "mbSource": {
248
+ "type": "string",
249
+ "mutable": false,
250
+ "complexType": {
251
+ "original": "string",
252
+ "resolved": "string",
253
+ "references": {}
254
+ },
255
+ "required": false,
256
+ "optional": false,
257
+ "docs": {
258
+ "tags": [],
259
+ "text": "Client custom styling via inline streamStyling"
260
+ },
261
+ "getter": false,
262
+ "setter": false,
263
+ "attribute": "mb-source",
264
+ "reflect": false
265
+ },
229
266
  "clientStyling": {
230
267
  "type": "string",
231
268
  "mutable": false,
@@ -240,6 +277,8 @@ export class GeneralAboutUs {
240
277
  "tags": [],
241
278
  "text": "Client custom styling via inline style"
242
279
  },
280
+ "getter": false,
281
+ "setter": false,
243
282
  "attribute": "client-styling",
244
283
  "reflect": true,
245
284
  "defaultValue": "''"
@@ -258,6 +297,8 @@ export class GeneralAboutUs {
258
297
  "tags": [],
259
298
  "text": "Client custom styling via url"
260
299
  },
300
+ "getter": false,
301
+ "setter": false,
261
302
  "attribute": "client-styling-url",
262
303
  "reflect": true,
263
304
  "defaultValue": "''"
@@ -268,7 +309,6 @@ export class GeneralAboutUs {
268
309
  return {
269
310
  "hasErrors": {},
270
311
  "isLoading": {},
271
- "limitStylingAppends": {},
272
312
  "device": {}
273
313
  };
274
314
  }
@@ -285,6 +325,12 @@ export class GeneralAboutUs {
285
325
  }, {
286
326
  "propName": "device",
287
327
  "methodName": "watchEndpoint"
328
+ }, {
329
+ "propName": "clientStyling",
330
+ "methodName": "handleClientStylingChange"
331
+ }, {
332
+ "propName": "clientStylingUrl",
333
+ "methodName": "handleClientStylingChangeURL"
288
334
  }];
289
335
  }
290
336
  }
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-f6c09f3b.js';
1
+ import { r as registerInstance, h } from './index-5f2a97a2.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
4
  const TRANSLATIONS = {
@@ -32,6 +32,63 @@ const translate = (key, customLang) => {
32
32
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
33
33
  };
34
34
 
35
+ /**
36
+ * @name setClientStyling
37
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
38
+ * @param {HTMLElement} stylingContainer The reference element of the widget
39
+ * @param {string} clientStyling The style content
40
+ */
41
+ function setClientStyling(stylingContainer, clientStyling) {
42
+ if (stylingContainer) {
43
+ const sheet = document.createElement('style');
44
+ sheet.innerHTML = clientStyling;
45
+ stylingContainer.appendChild(sheet);
46
+ }
47
+ }
48
+
49
+ /**
50
+ * @name setClientStylingURL
51
+ * @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
52
+ * @param {HTMLElement} stylingContainer The reference element of the widget
53
+ * @param {string} clientStylingUrl The URL of the style content
54
+ */
55
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
56
+ const url = new URL(clientStylingUrl);
57
+
58
+ fetch(url.href)
59
+ .then((res) => res.text())
60
+ .then((data) => {
61
+ const cssFile = document.createElement('style');
62
+ cssFile.innerHTML = data;
63
+ if (stylingContainer) {
64
+ stylingContainer.appendChild(cssFile);
65
+ }
66
+ })
67
+ .catch((err) => {
68
+ console.error('There was an error while trying to load client styling from URL', err);
69
+ });
70
+ }
71
+
72
+ /**
73
+ * @name setStreamLibrary
74
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
75
+ * @param {HTMLElement} stylingContainer The highest element of the widget
76
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
77
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
78
+ */
79
+ function setStreamStyling(stylingContainer, domain, subscription) {
80
+ if (window.emMessageBus) {
81
+ const sheet = document.createElement('style');
82
+
83
+ window.emMessageBus.subscribe(domain, (data) => {
84
+ sheet.innerHTML = data;
85
+ if (stylingContainer) {
86
+ stylingContainer.appendChild(sheet);
87
+ }
88
+ });
89
+ }
90
+ }
91
+
35
92
  function checkDeviceType() {
36
93
  const userAgent = navigator.userAgent.toLowerCase();
37
94
  const width = screen.availWidth;
@@ -97,6 +154,29 @@ const GeneralAboutUsStyle0 = generalAboutUsCss;
97
154
  const GeneralAboutUs = class {
98
155
  constructor(hostRef) {
99
156
  registerInstance(this, hostRef);
157
+ /**
158
+ * Language of the widget
159
+ */
160
+ this.language = 'en';
161
+ /**
162
+ * User roles
163
+ */
164
+ this.userRoles = 'everyone';
165
+ /**
166
+ * CMS Endpoint stage
167
+ */
168
+ this.cmsEnv = 'stage';
169
+ /**
170
+ * Client custom styling via inline style
171
+ */
172
+ this.clientStyling = '';
173
+ /**
174
+ * Client custom styling via url
175
+ */
176
+ this.clientStylingUrl = '';
177
+ this.hasErrors = false;
178
+ this.isLoading = true;
179
+ this.device = '';
100
180
  this.handleClick = (url, target, location, isExternal) => {
101
181
  window.postMessage({ type: 'NavigateTo', path: url, target: target, locations: location, externalLink: isExternal || false }, window.location.href);
102
182
  // @ts-ignore Analytics event
@@ -123,25 +203,6 @@ const GeneralAboutUs = class {
123
203
  }
124
204
  return source;
125
205
  };
126
- this.setClientStyling = () => {
127
- let sheet = document.createElement('style');
128
- sheet.innerHTML = this.clientStyling;
129
- this.stylingContainer.prepend(sheet);
130
- };
131
- this.setClientStylingURL = () => {
132
- let url = new URL(this.clientStylingUrl);
133
- let cssFile = document.createElement('style');
134
- fetch(url.href)
135
- .then((res) => res.text())
136
- .then((data) => {
137
- cssFile.innerHTML = data;
138
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
139
- })
140
- .catch((err) => {
141
- console.log('error ', err);
142
- });
143
- };
144
- // end custom styling area
145
206
  this.formatTitle = (title, language) => {
146
207
  let firstWord, restOfTitle;
147
208
  // Check for common languages that do not use space - here: Chinese, Japanese, Thai
@@ -156,22 +217,23 @@ const GeneralAboutUs = class {
156
217
  }
157
218
  return h("div", { class: "Title" }, h("span", { class: "FirstWord" }, firstWord, " "), h("span", null, restOfTitle));
158
219
  };
159
- this.cmsEndpoint = undefined;
160
- this.language = 'en';
161
- this.userRoles = 'everyone';
162
- this.cmsEnv = 'stage';
163
- this.clientStyling = '';
164
- this.clientStylingUrl = '';
165
- this.hasErrors = false;
166
- this.isLoading = true;
167
- this.limitStylingAppends = false;
168
- this.device = '';
169
220
  }
170
221
  watchEndpoint(newValue, oldValue) {
171
222
  if (newValue && newValue != oldValue && this.cmsEndpoint) {
172
223
  this.getAboutUs();
173
224
  }
174
225
  }
226
+ handleClientStylingChange(newValue, oldValue) {
227
+ if (newValue != oldValue) {
228
+ setClientStyling(this.stylingContainer, this.clientStyling);
229
+ }
230
+ }
231
+ handleClientStylingChangeURL(newValue, oldValue) {
232
+ if (newValue != oldValue) {
233
+ if (this.clientStylingUrl)
234
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
235
+ }
236
+ }
175
237
  componentWillLoad() {
176
238
  if (this.cmsEndpoint && this.language) {
177
239
  return this.getAboutUs();
@@ -179,6 +241,20 @@ const GeneralAboutUs = class {
179
241
  }
180
242
  componentDidLoad() {
181
243
  this.device = getDeviceCustom();
244
+ if (this.stylingContainer) {
245
+ if (window.emMessageBus != undefined) {
246
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
247
+ }
248
+ else {
249
+ if (this.clientStyling)
250
+ setClientStyling(this.stylingContainer, this.clientStyling);
251
+ if (this.clientStylingUrl)
252
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
253
+ }
254
+ }
255
+ }
256
+ disconnectedCallback() {
257
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
182
258
  }
183
259
  getAboutUs() {
184
260
  let url = new URL(`${this.cmsEndpoint}/${this.language}/homepage`);
@@ -208,16 +284,6 @@ const GeneralAboutUs = class {
208
284
  });
209
285
  });
210
286
  }
211
- componentDidRender() {
212
- // start custom styling area
213
- if (!this.limitStylingAppends && this.stylingContainer) {
214
- if (this.clientStyling)
215
- this.setClientStyling();
216
- if (this.clientStylingUrl)
217
- this.setClientStylingURL();
218
- this.limitStylingAppends = true;
219
- }
220
- }
221
287
  render() {
222
288
  var _a, _b, _c, _d, _e;
223
289
  if (this.hasErrors) {
@@ -238,7 +304,9 @@ const GeneralAboutUs = class {
238
304
  "cmsEndpoint": ["watchEndpoint"],
239
305
  "language": ["watchEndpoint"],
240
306
  "userRoles": ["watchEndpoint"],
241
- "device": ["watchEndpoint"]
307
+ "device": ["watchEndpoint"],
308
+ "clientStyling": ["handleClientStylingChange"],
309
+ "clientStylingUrl": ["handleClientStylingChangeURL"]
242
310
  }; }
243
311
  };
244
312
  GeneralAboutUs.style = GeneralAboutUsStyle0;
@@ -1,9 +1,9 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-f6c09f3b.js';
2
- export { s as setNonce } from './index-f6c09f3b.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-5f2a97a2.js';
2
+ export { s as setNonce } from './index-5f2a97a2.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.26.0 | 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-about-us",[[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);
19
+ return bootstrapLazy([["general-about-us",[[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);
20
20
  });