@everymatrix/player-user-consents 1.54.11 → 1.55.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/{index-8a0eadbd.js → index-025ec107.js} +75 -171
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/player-user-consents.cjs.entry.js +76 -62
  4. package/dist/cjs/player-user-consents.cjs.js +3 -3
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/components/player-user-consents/player-user-consents.js +37 -81
  7. package/dist/esm/{index-d33945fb.js → index-d1010d42.js} +75 -171
  8. package/dist/esm/loader.js +3 -3
  9. package/dist/esm/player-user-consents.entry.js +76 -62
  10. package/dist/esm/player-user-consents.js +4 -4
  11. package/dist/player-user-consents/p-69e15f00.js +2 -0
  12. package/dist/player-user-consents/p-77c91e34.entry.js +1 -0
  13. package/dist/player-user-consents/player-user-consents.esm.js +1 -1
  14. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/player-user-consents/.stencil/packages/stencil/player-user-consents/stencil.config.d.ts +2 -0
  15. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/player-user-consents/.stencil/packages/stencil/player-user-consents/stencil.config.dev.d.ts +2 -0
  16. package/dist/types/components/player-user-consents/player-user-consents.d.ts +4 -4
  17. package/dist/types/components.d.ts +8 -0
  18. package/package.json +1 -1
  19. package/dist/player-user-consents/p-1475dc71.entry.js +0 -1
  20. package/dist/player-user-consents/p-e16d0bad.js +0 -2
  21. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-user-consents/.stencil/packages/stencil/player-user-consents/stencil.config.d.ts +0 -2
  22. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/player-user-consents/.stencil/packages/stencil/player-user-consents/stencil.config.dev.d.ts +0 -2
  23. /package/dist/types/{builds/emfe-widgets → Users/maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/player-user-consents/.stencil/tools/plugins/index.d.ts +0 -0
  24. /package/dist/types/{builds/emfe-widgets → Users/maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/player-user-consents/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  25. /package/dist/types/{builds/emfe-widgets → Users/maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/player-user-consents/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  26. /package/dist/types/{builds/emfe-widgets → Users/maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/player-user-consents/.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-8a0eadbd.js');
5
+ const index = require('./index-025ec107.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
8
  const TRANSLATIONS = {
@@ -130,6 +130,63 @@ const translate = (key, customLang, values) => {
130
130
  return translation;
131
131
  };
132
132
 
133
+ /**
134
+ * @name setClientStyling
135
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
136
+ * @param {HTMLElement} stylingContainer The reference element of the widget
137
+ * @param {string} clientStyling The style content
138
+ */
139
+ function setClientStyling(stylingContainer, clientStyling) {
140
+ if (stylingContainer) {
141
+ const sheet = document.createElement('style');
142
+ sheet.innerHTML = clientStyling;
143
+ stylingContainer.appendChild(sheet);
144
+ }
145
+ }
146
+
147
+ /**
148
+ * @name setClientStylingURL
149
+ * @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
150
+ * @param {HTMLElement} stylingContainer The reference element of the widget
151
+ * @param {string} clientStylingUrl The URL of the style content
152
+ */
153
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
154
+ const url = new URL(clientStylingUrl);
155
+
156
+ fetch(url.href)
157
+ .then((res) => res.text())
158
+ .then((data) => {
159
+ const cssFile = document.createElement('style');
160
+ cssFile.innerHTML = data;
161
+ if (stylingContainer) {
162
+ stylingContainer.appendChild(cssFile);
163
+ }
164
+ })
165
+ .catch((err) => {
166
+ console.error('There was an error while trying to load client styling from URL', err);
167
+ });
168
+ }
169
+
170
+ /**
171
+ * @name setStreamLibrary
172
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
173
+ * @param {HTMLElement} stylingContainer The highest element of the widget
174
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
175
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
176
+ */
177
+ function setStreamStyling(stylingContainer, domain, subscription) {
178
+ if (window.emMessageBus) {
179
+ const sheet = document.createElement('style');
180
+
181
+ window.emMessageBus.subscribe(domain, (data) => {
182
+ sheet.innerHTML = data;
183
+ if (stylingContainer) {
184
+ stylingContainer.appendChild(sheet);
185
+ }
186
+ });
187
+ }
188
+ }
189
+
133
190
  const playerUserConsentsCss = ":host{display:block}.ConsentTitle{margin-bottom:0.2rem;font-weight:600}.UserConsent:hover{cursor:pointer}.UserConsent{display:flex;align-items:baseline}.MandatoryItem{color:#f00;font-size:1.2rem}.ConsentLink{text-decoration:underline;color:var(--emw--color-primary);font-weight:bold}";
134
191
  const PlayerUserConsentsStyle0 = playerUserConsentsCss;
135
192
 
@@ -137,67 +194,19 @@ const PlayerUserConsents = class {
137
194
  constructor(hostRef) {
138
195
  index.registerInstance(this, hostRef);
139
196
  this.userLegislationConsent = index.createEvent(this, "userLegislationConsent", 7);
140
- /**
141
- * Language
142
- */
197
+ this.goToTermsAndConditions = () => window.postMessage({ type: 'GoToTermsAndConditions' });
198
+ this.goToPrivacyPolicy = () => window.postMessage({ type: 'GoToPrivacyPolicy' });
143
199
  this.lang = 'en';
144
- /**
145
- * 'true' when parent expects component to emit it's current value
146
- */
147
200
  this.queried = false;
148
- /**
149
- * the type of the consent, used to determine render details
150
- */
151
201
  this.consentType = '';
152
- /**
153
- * wether or not this consent is mandatory. Used for render details
154
- */
155
202
  this.mandatory = false;
156
- /**
157
- * Select GM version
158
- */
159
203
  this.gmVersion = '';
160
- /**
161
- * the title of the consent to be displayed
162
- */
163
204
  this.consentTitle = '';
164
- /**
165
- * Client custom styling via inline style
166
- */
167
205
  this.clientStyling = '';
168
- /**
169
- * Client custom styling via url
170
- */
171
206
  this.clientStylingUrl = '';
172
- /**
173
- * Translation url
174
- */
175
207
  this.translationUrl = '';
176
- /**
177
- * the text content to be rendered by the component. Determined at runtime
178
- */
208
+ this.mbSource = undefined;
179
209
  this.textContent = '';
180
- this.limitStylingAppends = false;
181
- this.goToTermsAndConditions = () => window.postMessage({ type: 'GoToTermsAndConditions' });
182
- this.goToPrivacyPolicy = () => window.postMessage({ type: 'GoToPrivacyPolicy' });
183
- this.setClientStyling = () => {
184
- let sheet = document.createElement('style');
185
- sheet.innerHTML = this.clientStyling;
186
- this.stylingContainer.prepend(sheet);
187
- };
188
- this.setClientStylingURL = () => {
189
- let url = new URL(this.clientStylingUrl);
190
- let cssFile = document.createElement('style');
191
- fetch(url.href)
192
- .then((res) => res.text())
193
- .then((data) => {
194
- cssFile.innerHTML = data;
195
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
196
- })
197
- .catch((err) => {
198
- console.log('error ', err);
199
- });
200
- };
201
210
  }
202
211
  handleNewTranslations() {
203
212
  getTranslations(this.translationUrl);
@@ -217,17 +226,22 @@ const PlayerUserConsents = class {
217
226
  value: this.checkboxInput.checked
218
227
  });
219
228
  }
220
- componentDidRender() {
221
- // start custom styling area
222
- if (!this.limitStylingAppends && this.stylingContainer) {
223
- if (this.clientStylingUrl) {
224
- this.setClientStylingURL();
229
+ componentDidLoad() {
230
+ if (this.stylingContainer) {
231
+ // @ts-ignore
232
+ if (window.emMessageBus != undefined) {
233
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
234
+ }
235
+ else {
236
+ if (this.clientStyling)
237
+ setClientStyling(this.stylingContainer, this.clientStyling);
238
+ if (this.clientStylingUrl)
239
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
225
240
  }
226
- if (this.clientStyling)
227
- this.setClientStyling();
228
- this.limitStylingAppends = true;
229
241
  }
230
- // end custom styling area
242
+ }
243
+ disconnectedCallback() {
244
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
231
245
  }
232
246
  determineTextContent() {
233
247
  if (this.gmVersion === 'gmcore') {
@@ -249,7 +263,7 @@ const PlayerUserConsents = class {
249
263
  if (this.queried) {
250
264
  this.userLegislationConsentHandler();
251
265
  }
252
- return (index.h("div", { key: '54601e536a075b95277641c2d123f21fb5b9a9e8', ref: el => this.stylingContainer = el }, index.h("p", { key: '8cceca5a2a2e69a4180e10848d0fea081fe7a78a', class: "ConsentTitle" }, this.consentTitle), index.h("label", { key: '80f41a7876f3831c1030cba896282290f33c14b3', class: "UserConsent", htmlFor: "userConsent" }, index.h("input", { key: '7db0bada1af6d9df763f63a4eb92e79615322801', ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.determineTextContent(), this.mandatory && index.h("span", { key: 'ce67fcdf09cfefb48df87d043950fd4fba7fdb00', class: "MandatoryItem" }, "*"))));
266
+ return (index.h("div", { key: 'e3c4962028cea95e4391432bba0c6a4fa20d64cb', ref: el => this.stylingContainer = el }, index.h("p", { key: '606baf671f199a739b3738a73cd6e76748eb71c0', class: "ConsentTitle" }, this.consentTitle), index.h("label", { key: '7a581d02cbebf1ad6ec31b58e4b3b3583c0115bc', class: "UserConsent", htmlFor: "userConsent" }, index.h("input", { key: '70949461872d972a8d8a393dd36e6bbfbd3b82d0', ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.determineTextContent(), this.mandatory && index.h("span", { key: 'e10c68ce2898d1b5801672b022ef9e1d0f185a17', class: "MandatoryItem" }, "*"))));
253
267
  }
254
268
  static get watchers() { return {
255
269
  "translationUrl": ["handleNewTranslations"],
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-8a0eadbd.js');
5
+ const index = require('./index-025ec107.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
9
- Stencil Client Patch Browser v4.26.0 | MIT Licensed | https://stenciljs.com
9
+ Stencil Client Patch Browser v4.22.3 | 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('player-user-consents.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([["player-user-consents.cjs",[[1,"player-user-consents",{"lang":[1537],"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"gmVersion":[1,"gm-version"],"consentTitle":[513,"consent-title"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStylingUrl":["handleStylingUrlChange"]}]]]], options);
22
+ return index.bootstrapLazy([["player-user-consents.cjs",[[1,"player-user-consents",{"lang":[1537],"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"gmVersion":[1,"gm-version"],"consentTitle":[513,"consent-title"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"mbSource":[513,"mb-source"],"textContent":[32]},null,{"translationUrl":["handleNewTranslations"],"clientStylingUrl":["handleStylingUrlChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "4.26.0",
7
+ "version": "4.22.3",
8
8
  "typescriptVersion": "5.5.4"
9
9
  },
10
10
  "collections": [],
@@ -1,68 +1,21 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { getTranslations, translate } from "../../utils/locale.utils";
3
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
4
  export class PlayerUserConsents {
4
5
  constructor() {
5
- /**
6
- * Language
7
- */
6
+ this.goToTermsAndConditions = () => window.postMessage({ type: 'GoToTermsAndConditions' });
7
+ this.goToPrivacyPolicy = () => window.postMessage({ type: 'GoToPrivacyPolicy' });
8
8
  this.lang = 'en';
9
- /**
10
- * 'true' when parent expects component to emit it's current value
11
- */
12
9
  this.queried = false;
13
- /**
14
- * the type of the consent, used to determine render details
15
- */
16
10
  this.consentType = '';
17
- /**
18
- * wether or not this consent is mandatory. Used for render details
19
- */
20
11
  this.mandatory = false;
21
- /**
22
- * Select GM version
23
- */
24
12
  this.gmVersion = '';
25
- /**
26
- * the title of the consent to be displayed
27
- */
28
13
  this.consentTitle = '';
29
- /**
30
- * Client custom styling via inline style
31
- */
32
14
  this.clientStyling = '';
33
- /**
34
- * Client custom styling via url
35
- */
36
15
  this.clientStylingUrl = '';
37
- /**
38
- * Translation url
39
- */
40
16
  this.translationUrl = '';
41
- /**
42
- * the text content to be rendered by the component. Determined at runtime
43
- */
17
+ this.mbSource = undefined;
44
18
  this.textContent = '';
45
- this.limitStylingAppends = false;
46
- this.goToTermsAndConditions = () => window.postMessage({ type: 'GoToTermsAndConditions' });
47
- this.goToPrivacyPolicy = () => window.postMessage({ type: 'GoToPrivacyPolicy' });
48
- this.setClientStyling = () => {
49
- let sheet = document.createElement('style');
50
- sheet.innerHTML = this.clientStyling;
51
- this.stylingContainer.prepend(sheet);
52
- };
53
- this.setClientStylingURL = () => {
54
- let url = new URL(this.clientStylingUrl);
55
- let cssFile = document.createElement('style');
56
- fetch(url.href)
57
- .then((res) => res.text())
58
- .then((data) => {
59
- cssFile.innerHTML = data;
60
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
61
- })
62
- .catch((err) => {
63
- console.log('error ', err);
64
- });
65
- };
66
19
  }
67
20
  handleNewTranslations() {
68
21
  getTranslations(this.translationUrl);
@@ -82,17 +35,22 @@ export class PlayerUserConsents {
82
35
  value: this.checkboxInput.checked
83
36
  });
84
37
  }
85
- componentDidRender() {
86
- // start custom styling area
87
- if (!this.limitStylingAppends && this.stylingContainer) {
88
- if (this.clientStylingUrl) {
89
- this.setClientStylingURL();
38
+ componentDidLoad() {
39
+ if (this.stylingContainer) {
40
+ // @ts-ignore
41
+ if (window.emMessageBus != undefined) {
42
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
43
+ }
44
+ else {
45
+ if (this.clientStyling)
46
+ setClientStyling(this.stylingContainer, this.clientStyling);
47
+ if (this.clientStylingUrl)
48
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
90
49
  }
91
- if (this.clientStyling)
92
- this.setClientStyling();
93
- this.limitStylingAppends = true;
94
50
  }
95
- // end custom styling area
51
+ }
52
+ disconnectedCallback() {
53
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
96
54
  }
97
55
  determineTextContent() {
98
56
  if (this.gmVersion === 'gmcore') {
@@ -114,7 +72,7 @@ export class PlayerUserConsents {
114
72
  if (this.queried) {
115
73
  this.userLegislationConsentHandler();
116
74
  }
117
- return (h("div", { key: '54601e536a075b95277641c2d123f21fb5b9a9e8', ref: el => this.stylingContainer = el }, h("p", { key: '8cceca5a2a2e69a4180e10848d0fea081fe7a78a', class: "ConsentTitle" }, this.consentTitle), h("label", { key: '80f41a7876f3831c1030cba896282290f33c14b3', class: "UserConsent", htmlFor: "userConsent" }, h("input", { key: '7db0bada1af6d9df763f63a4eb92e79615322801', ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.determineTextContent(), this.mandatory && h("span", { key: 'ce67fcdf09cfefb48df87d043950fd4fba7fdb00', class: "MandatoryItem" }, "*"))));
75
+ return (h("div", { key: 'e3c4962028cea95e4391432bba0c6a4fa20d64cb', ref: el => this.stylingContainer = el }, h("p", { key: '606baf671f199a739b3738a73cd6e76748eb71c0', class: "ConsentTitle" }, this.consentTitle), h("label", { key: '7a581d02cbebf1ad6ec31b58e4b3b3583c0115bc', class: "UserConsent", htmlFor: "userConsent" }, h("input", { key: '70949461872d972a8d8a393dd36e6bbfbd3b82d0', ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.determineTextContent(), this.mandatory && h("span", { key: 'e10c68ce2898d1b5801672b022ef9e1d0f185a17', class: "MandatoryItem" }, "*"))));
118
76
  }
119
77
  static get is() { return "player-user-consents"; }
120
78
  static get encapsulation() { return "shadow"; }
@@ -144,8 +102,6 @@ export class PlayerUserConsents {
144
102
  "tags": [],
145
103
  "text": "Language"
146
104
  },
147
- "getter": false,
148
- "setter": false,
149
105
  "attribute": "lang",
150
106
  "reflect": true,
151
107
  "defaultValue": "'en'"
@@ -164,8 +120,6 @@ export class PlayerUserConsents {
164
120
  "tags": [],
165
121
  "text": "'true' when parent expects component to emit it's current value"
166
122
  },
167
- "getter": false,
168
- "setter": false,
169
123
  "attribute": "queried",
170
124
  "reflect": true,
171
125
  "defaultValue": "false"
@@ -184,8 +138,6 @@ export class PlayerUserConsents {
184
138
  "tags": [],
185
139
  "text": "the type of the consent, used to determine render details"
186
140
  },
187
- "getter": false,
188
- "setter": false,
189
141
  "attribute": "consent-type",
190
142
  "reflect": true,
191
143
  "defaultValue": "''"
@@ -204,8 +156,6 @@ export class PlayerUserConsents {
204
156
  "tags": [],
205
157
  "text": "wether or not this consent is mandatory. Used for render details"
206
158
  },
207
- "getter": false,
208
- "setter": false,
209
159
  "attribute": "mandatory",
210
160
  "reflect": true,
211
161
  "defaultValue": "false"
@@ -224,8 +174,6 @@ export class PlayerUserConsents {
224
174
  "tags": [],
225
175
  "text": "Select GM version"
226
176
  },
227
- "getter": false,
228
- "setter": false,
229
177
  "attribute": "gm-version",
230
178
  "reflect": false,
231
179
  "defaultValue": "''"
@@ -244,8 +192,6 @@ export class PlayerUserConsents {
244
192
  "tags": [],
245
193
  "text": "the title of the consent to be displayed"
246
194
  },
247
- "getter": false,
248
- "setter": false,
249
195
  "attribute": "consent-title",
250
196
  "reflect": true,
251
197
  "defaultValue": "''"
@@ -264,8 +210,6 @@ export class PlayerUserConsents {
264
210
  "tags": [],
265
211
  "text": "Client custom styling via inline style"
266
212
  },
267
- "getter": false,
268
- "setter": false,
269
213
  "attribute": "client-styling",
270
214
  "reflect": false,
271
215
  "defaultValue": "''"
@@ -284,8 +228,6 @@ export class PlayerUserConsents {
284
228
  "tags": [],
285
229
  "text": "Client custom styling via url"
286
230
  },
287
- "getter": false,
288
- "setter": false,
289
231
  "attribute": "client-styling-url",
290
232
  "reflect": true,
291
233
  "defaultValue": "''"
@@ -304,18 +246,32 @@ export class PlayerUserConsents {
304
246
  "tags": [],
305
247
  "text": "Translation url"
306
248
  },
307
- "getter": false,
308
- "setter": false,
309
249
  "attribute": "translation-url",
310
250
  "reflect": true,
311
251
  "defaultValue": "''"
252
+ },
253
+ "mbSource": {
254
+ "type": "string",
255
+ "mutable": false,
256
+ "complexType": {
257
+ "original": "string",
258
+ "resolved": "string",
259
+ "references": {}
260
+ },
261
+ "required": false,
262
+ "optional": false,
263
+ "docs": {
264
+ "tags": [],
265
+ "text": "the text content to be rendered by the component. Determined at runtime"
266
+ },
267
+ "attribute": "mb-source",
268
+ "reflect": true
312
269
  }
313
270
  };
314
271
  }
315
272
  static get states() {
316
273
  return {
317
- "textContent": {},
318
- "limitStylingAppends": {}
274
+ "textContent": {}
319
275
  };
320
276
  }
321
277
  static get events() {