@everymatrix/user-action-controller 1.37.4 → 1.37.6

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.
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["player-user-consents_2.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
17
+ return index.bootstrapLazy([["player-user-consents_2.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -412,6 +412,9 @@ const UserActionController = class {
412
412
  .catch(error => {
413
413
  console.error('Error fetching data:', error);
414
414
  this.isLoading = false;
415
+ }).finally(() => {
416
+ this.calcMandatoryActions();
417
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
415
418
  });
416
419
  }
417
420
  determineUserActions16() {
@@ -436,6 +439,9 @@ const UserActionController = class {
436
439
  .catch(error => {
437
440
  console.error('Error fetching data:', error);
438
441
  this.isLoading = false;
442
+ }).finally(() => {
443
+ this.calcMandatoryActions();
444
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
439
445
  });
440
446
  }
441
447
  updateUserConsents() {
@@ -504,22 +510,26 @@ const UserActionController = class {
504
510
  }
505
511
  // end custom styling area
506
512
  }
507
- render() {
508
- let mandatoryItems = 0;
513
+ calcMandatoryActions() {
514
+ this.mandatoryItems = 0;
509
515
  this.mandatoryActions.map(action => {
510
516
  const isPresent = this.activeUserActions.includes(action);
511
517
  if (isPresent) {
512
- mandatoryItems++;
518
+ this.mandatoryItems++;
513
519
  }
514
520
  });
515
- const isMandatoryPresent = mandatoryItems > 0 ? true : false;
516
- this.userActionsValidated = isMandatoryPresent && (this.mandatoryActionsChecked === mandatoryItems);
517
- if (isMandatoryPresent) {
521
+ }
522
+ render() {
523
+ if (this.mandatoryItems > 0) {
524
+ this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
518
525
  return (index.h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (index.h("slot", { name: 'spinner' })
519
526
  &&
520
527
  index.h("svg", { class: "spinner", viewBox: "0 0 50 50" }, index.h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" }))) : (index.h("div", { class: "UserActionController" }, index.h("h2", { class: "UserConsentNotice" }, this.userNoticeText), index.h("div", { class: "PlayerLegislationWrapper" }, this.activeUserActions.map(action => (index.h("slot", { name: action }, index.h("player-user-consents", { lang: this.lang, "gm-version": this.gmVersion, "translation-url": this.translationUrl, consentType: action, consentTitle: this.consentTitles[action], queried: this.queryFired, mandatory: this.mandatoryActions.includes(action), "client-styling": this.clientStyling }))))), this.includeSubmitButton &&
521
528
  index.h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, this.submitButtonText)))));
522
529
  }
530
+ else {
531
+ return;
532
+ }
523
533
  }
524
534
  static get watchers() { return {
525
535
  "translationUrl": ["handleNewTranslations"],
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["player-user-consents_2.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
18
+ return index.bootstrapLazy([["player-user-consents_2.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
19
19
  });
@@ -111,6 +111,9 @@ export class UserActionController {
111
111
  .catch(error => {
112
112
  console.error('Error fetching data:', error);
113
113
  this.isLoading = false;
114
+ }).finally(() => {
115
+ this.calcMandatoryActions();
116
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
114
117
  });
115
118
  }
116
119
  determineUserActions16() {
@@ -135,6 +138,9 @@ export class UserActionController {
135
138
  .catch(error => {
136
139
  console.error('Error fetching data:', error);
137
140
  this.isLoading = false;
141
+ }).finally(() => {
142
+ this.calcMandatoryActions();
143
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
138
144
  });
139
145
  }
140
146
  updateUserConsents() {
@@ -203,17 +209,18 @@ export class UserActionController {
203
209
  }
204
210
  // end custom styling area
205
211
  }
206
- render() {
207
- let mandatoryItems = 0;
212
+ calcMandatoryActions() {
213
+ this.mandatoryItems = 0;
208
214
  this.mandatoryActions.map(action => {
209
215
  const isPresent = this.activeUserActions.includes(action);
210
216
  if (isPresent) {
211
- mandatoryItems++;
217
+ this.mandatoryItems++;
212
218
  }
213
219
  });
214
- const isMandatoryPresent = mandatoryItems > 0 ? true : false;
215
- this.userActionsValidated = isMandatoryPresent && (this.mandatoryActionsChecked === mandatoryItems);
216
- if (isMandatoryPresent) {
220
+ }
221
+ render() {
222
+ if (this.mandatoryItems > 0) {
223
+ this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
217
224
  return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("slot", { name: 'spinner' })
218
225
  &&
219
226
  h("svg", { class: "spinner", viewBox: "0 0 50 50" },
@@ -224,6 +231,9 @@ export class UserActionController {
224
231
  this.includeSubmitButton &&
225
232
  h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, this.submitButtonText)))));
226
233
  }
234
+ else {
235
+ return;
236
+ }
227
237
  }
228
238
  static get is() { return "user-action-controller"; }
229
239
  static get encapsulation() { return "shadow"; }
@@ -435,7 +445,8 @@ export class UserActionController {
435
445
  "receivedQueryResponses": {},
436
446
  "limitStylingAppends": {},
437
447
  "isLoading": {},
438
- "mandatoryActionsChecked": {}
448
+ "mandatoryActionsChecked": {},
449
+ "mandatoryItems": {}
439
450
  }; }
440
451
  static get watchers() { return [{
441
452
  "propName": "translationUrl",
@@ -183,6 +183,9 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
183
183
  .catch(error => {
184
184
  console.error('Error fetching data:', error);
185
185
  this.isLoading = false;
186
+ }).finally(() => {
187
+ this.calcMandatoryActions();
188
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
186
189
  });
187
190
  }
188
191
  determineUserActions16() {
@@ -207,6 +210,9 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
207
210
  .catch(error => {
208
211
  console.error('Error fetching data:', error);
209
212
  this.isLoading = false;
213
+ }).finally(() => {
214
+ this.calcMandatoryActions();
215
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
210
216
  });
211
217
  }
212
218
  updateUserConsents() {
@@ -275,22 +281,26 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
275
281
  }
276
282
  // end custom styling area
277
283
  }
278
- render() {
279
- let mandatoryItems = 0;
284
+ calcMandatoryActions() {
285
+ this.mandatoryItems = 0;
280
286
  this.mandatoryActions.map(action => {
281
287
  const isPresent = this.activeUserActions.includes(action);
282
288
  if (isPresent) {
283
- mandatoryItems++;
289
+ this.mandatoryItems++;
284
290
  }
285
291
  });
286
- const isMandatoryPresent = mandatoryItems > 0 ? true : false;
287
- this.userActionsValidated = isMandatoryPresent && (this.mandatoryActionsChecked === mandatoryItems);
288
- if (isMandatoryPresent) {
292
+ }
293
+ render() {
294
+ if (this.mandatoryItems > 0) {
295
+ this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
289
296
  return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("slot", { name: 'spinner' })
290
297
  &&
291
298
  h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" }))) : (h("div", { class: "UserActionController" }, h("h2", { class: "UserConsentNotice" }, this.userNoticeText), h("div", { class: "PlayerLegislationWrapper" }, this.activeUserActions.map(action => (h("slot", { name: action }, h("player-user-consents", { lang: this.lang, "gm-version": this.gmVersion, "translation-url": this.translationUrl, consentType: action, consentTitle: this.consentTitles[action], queried: this.queryFired, mandatory: this.mandatoryActions.includes(action), "client-styling": this.clientStyling }))))), this.includeSubmitButton &&
292
299
  h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, this.submitButtonText)))));
293
300
  }
301
+ else {
302
+ return;
303
+ }
294
304
  }
295
305
  static get watchers() { return {
296
306
  "translationUrl": ["handleNewTranslations"],
@@ -316,7 +326,8 @@ const UserActionController$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
316
326
  "receivedQueryResponses": [32],
317
327
  "limitStylingAppends": [32],
318
328
  "isLoading": [32],
319
- "mandatoryActionsChecked": [32]
329
+ "mandatoryActionsChecked": [32],
330
+ "mandatoryItems": [32]
320
331
  }, [[0, "userLegislationConsent", "userLegislationConsentHandler"]]]);
321
332
  function defineCustomElement$1() {
322
333
  if (typeof customElements === "undefined") {
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["player-user-consents_2",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
13
+ return bootstrapLazy([["player-user-consents_2",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -408,6 +408,9 @@ const UserActionController = class {
408
408
  .catch(error => {
409
409
  console.error('Error fetching data:', error);
410
410
  this.isLoading = false;
411
+ }).finally(() => {
412
+ this.calcMandatoryActions();
413
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
411
414
  });
412
415
  }
413
416
  determineUserActions16() {
@@ -432,6 +435,9 @@ const UserActionController = class {
432
435
  .catch(error => {
433
436
  console.error('Error fetching data:', error);
434
437
  this.isLoading = false;
438
+ }).finally(() => {
439
+ this.calcMandatoryActions();
440
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
435
441
  });
436
442
  }
437
443
  updateUserConsents() {
@@ -500,22 +506,26 @@ const UserActionController = class {
500
506
  }
501
507
  // end custom styling area
502
508
  }
503
- render() {
504
- let mandatoryItems = 0;
509
+ calcMandatoryActions() {
510
+ this.mandatoryItems = 0;
505
511
  this.mandatoryActions.map(action => {
506
512
  const isPresent = this.activeUserActions.includes(action);
507
513
  if (isPresent) {
508
- mandatoryItems++;
514
+ this.mandatoryItems++;
509
515
  }
510
516
  });
511
- const isMandatoryPresent = mandatoryItems > 0 ? true : false;
512
- this.userActionsValidated = isMandatoryPresent && (this.mandatoryActionsChecked === mandatoryItems);
513
- if (isMandatoryPresent) {
517
+ }
518
+ render() {
519
+ if (this.mandatoryItems > 0) {
520
+ this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
514
521
  return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("slot", { name: 'spinner' })
515
522
  &&
516
523
  h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" }))) : (h("div", { class: "UserActionController" }, h("h2", { class: "UserConsentNotice" }, this.userNoticeText), h("div", { class: "PlayerLegislationWrapper" }, this.activeUserActions.map(action => (h("slot", { name: action }, h("player-user-consents", { lang: this.lang, "gm-version": this.gmVersion, "translation-url": this.translationUrl, consentType: action, consentTitle: this.consentTitles[action], queried: this.queryFired, mandatory: this.mandatoryActions.includes(action), "client-styling": this.clientStyling }))))), this.includeSubmitButton &&
517
524
  h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, this.submitButtonText)))));
518
525
  }
526
+ else {
527
+ return;
528
+ }
519
529
  }
520
530
  static get watchers() { return {
521
531
  "translationUrl": ["handleNewTranslations"],
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["player-user-consents_2",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
16
+ return bootstrapLazy([["player-user-consents_2",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"submitButtonText":[513,"submit-button-text"],"userNoticeText":[513,"user-notice-text"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]}]]]], options);
17
17
  });
@@ -62,6 +62,7 @@ export declare class UserActionController {
62
62
  private limitStylingAppends;
63
63
  private isLoading;
64
64
  private mandatoryActionsChecked;
65
+ private mandatoryItems;
65
66
  private mandatoryActions;
66
67
  private userActions;
67
68
  private stylingContainer;
@@ -74,6 +75,7 @@ export declare class UserActionController {
74
75
  componentDidRender(): void;
75
76
  setClientStyling: () => void;
76
77
  setClientStylingURL: () => void;
78
+ calcMandatoryActions(): void;
77
79
  render(): any;
78
80
  }
79
81
  export {};
@@ -1 +1 @@
1
- import{r as t,c as e,h as i}from"./p-ba444709.js";const s={en:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},ro:{termsAndConditions:{acceptPart1:"Accept ",acceptPart2:" platformei. Am citit şi înţeles ",acceptPart3:" publicată pe acest site şi confirm că am vârstă peste 18 ani.",tc:"Termenii şi condiţiile"},privacyPolicy:{readUnderstandPart1:"Am citit şi înţeles ",readUnderstandPart2:" publicată pe acest site şi confirm că am vârstă peste 18 ani.",privacy:"Politica de confidenţialitate"},sms:"Sunt de acord să primesc promoţii de marketing prin SMS.",emailmarketing:"Sunt de acord să primesc promoţii de marketing pe e-mail."},hr:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},fr:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},cs:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},de:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."}},n=t=>new Promise((e=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((e=>{for(let i in t[e])s[e][i]=t[e][i]})),e(!0)}))})),a=(t,e,i)=>{let n=(a=s[e||"en"],t.split(".").reduce(((t,e)=>t&&void 0!==t[e]?t[e]:null),a));var a;if(null===n)return t;if(void 0!==i)for(const[t,e]of Object.entries(i)){const i=new RegExp(`{${t}}`,"g");n=n.replace(i,e)}return n},r=class{constructor(i){t(this,i),this.userLegislationConsent=e(this,"userLegislationConsent",7),this.lang="en",this.queried=!1,this.consentType="",this.mandatory=!1,this.gmVersion="",this.consentTitle="",this.clientStyling="",this.translationUrl="",this.textContent="",this.limitStylingAppends=!1,this.goToTermsAndConditions=()=>window.postMessage({type:"GoToTermsAndConditions"}),this.goToPrivacyPolicy=()=>window.postMessage({type:"GoToPrivacyPolicy"}),this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}handleNewTranslations(){n(this.translationUrl)}async componentWillLoad(){this.translationUrl.length>2&&await n(this.translationUrl)}userLegislationConsentHandler(){this.userLegislationConsent.emit({type:this.consentType,value:this.checkboxInput.checked})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}determineTextContent(){if("gmcore"===this.gmVersion&&"termsandconditions"===this.consentType)return i("p",null,a("termsAndConditions.acceptPart1",this.lang),i("span",{class:"ConsentLink",onClick:this.goToTermsAndConditions},a("termsAndConditions.tc",this.lang)),a("termsAndConditions.acceptPart2",this.lang),i("span",{class:"ConsentLink",onClick:this.goToPrivacyPolicy},a("privacyPolicy.privacy",this.lang)),a("termsAndConditions.acceptPart3",this.lang));if("gm16"===this.gmVersion){if("termsandconditions"===this.consentType)return i("p",null,a("termsAndConditions.acceptPart1",this.lang),i("span",{class:"ConsentLink",onClick:this.goToTermsAndConditions},a("termsAndConditions.tc",this.lang)));if("privacypolicy"===this.consentType)return i("p",null,a("privacyPolicy.readUnderstandPart1",this.lang),i("span",{class:"ConsentLink",onClick:this.goToPrivacyPolicy},a("privacyPolicy.privacy",this.lang)),a("privacyPolicy.readUnderstandPart2",this.lang))}return i("p",null,a(this.consentType,this.lang))}render(){return this.queried&&this.userLegislationConsentHandler(),i("div",{ref:t=>this.stylingContainer=t},i("p",{class:"ConsentTitle"},this.consentTitle),i("label",{class:"UserConsent",htmlFor:"userConsent"},i("input",{ref:t=>this.checkboxInput=t,id:"userConsent",type:"checkbox",onInput:()=>this.userLegislationConsentHandler()}),this.determineTextContent(),this.mandatory&&i("span",{class:"MandatoryItem"},"*")))}static get watchers(){return{translationUrl:["handleNewTranslations"]}}};r.style=":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(--emfe-w-color-primary);font-weight:bold}";const o=["ro","en","cz","de","hr"],c={en:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},ro:{termsandconditions:"Termeni şi condiţii",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},hr:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},fr:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},cs:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},de:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"}},d=t=>new Promise((e=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((e=>{for(let i in t[e])c[e][i]=t[e][i]})),e(!0)}))})),h=(t,e,i)=>{const s=e;let n=c[void 0!==s&&o.includes(s)?s:"en"][t];if(void 0!==i)for(const[t,e]of Object.entries(i.values)){const i=new RegExp(`{${t}}`,"g");n=n.replace(i,e)}return n},l=class{constructor(e){t(this,e),this.lang="en",this.gmVersion="",this.translationUrl="",this.clientStyling="",this.clientStylingUrl="",this.queryFired=!1,this.readyActionsCount=0,this.activeUserActions=[],this.userActionsValidated=!0,this.receivedQueryResponses=0,this.limitStylingAppends=!1,this.isLoading=!0,this.mandatoryActionsChecked=0,this.mandatoryActions=["termsandconditions","privacypolicy"],this.userActions=[],this.consentTitles={termsandconditions:h("termsandconditions",this.lang),sms:h("sms",this.lang),emailmarketing:h("emailmarketing",this.lang),privacypolicy:h("privacypolicy",this.lang)},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),e=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{this.clientStyling=t,e.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(e)}),1)})).catch((t=>{console.log("error ",t)}))}}handleNewTranslations(){d(this.translationUrl)}handleQueryResponse(){this.receivedQueryResponses===this.activeUserActions.length&&this.updateUserConsents()}userLegislationConsentHandler(t){const e=t.detail.type,i=t.detail.value;this.mandatoryActions.includes(e)&&!1===this.queryFired&&(!0===i?this.mandatoryActionsChecked++:this.mandatoryActionsChecked--),this.queryFired&&(this.userActions.push(Object.assign({tagCode:e,status:(t=>"gm16"===this.gmVersion?t?1:0:t?"Accepted":"Denied")(i)},"gm16"===this.gmVersion&&{note:""})),this.receivedQueryResponses++)}determineUserActionsCore(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/consent`),e=new Headers;return e.append("X-SessionId",this.userSession),fetch(t.href,{method:"GET",headers:e}).then((t=>t.json())).then((t=>{t.items.forEach((t=>{"Expired"===t.status&&this.activeUserActions.push(t.tagCode)})),this.isLoading=!1})).catch((t=>{console.error("Error fetching data:",t),this.isLoading=!1}))}determineUserActions16(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`),e=new Headers;return e.append("X-SessionId",this.userSession),fetch(t.href,{method:"GET",headers:e}).then((t=>t.json())).then((t=>{t.consents.forEach((t=>{2===t.status&&"pepconsent"!==t.tagCode&&this.activeUserActions.push(t.tagCode)})),this.isLoading=!1})).catch((t=>{console.error("Error fetching data:",t),this.isLoading=!1}))}updateUserConsents(){const t="gmcore"===this.gmVersion?new URL(`${this.endpoint}/v1/player/${this.userId}/consent`):new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);let e={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-SessionId":`${this.userSession}`},body:JSON.stringify({consents:this.userActions})};fetch(t.href,e).then((t=>t.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:"Consent update successful!"}},window.location.href)})).catch((t=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:"Server might not be responding",err:t}},window.location.href)})).finally((()=>{window.postMessage({type:"UserActionsCompleted"},window.location.href)}))}handleApplyClick(){this.queryFired=!0}async componentWillLoad(){"gmcore"===this.gmVersion&&this.determineUserActionsCore(),"gm16"===this.gmVersion&&this.determineUserActions16(),this.translationUrl.length>2&&await d(this.translationUrl)}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let t=0;this.mandatoryActions.map((e=>{this.activeUserActions.includes(e)&&t++}));const e=t>0;if(this.userActionsValidated=e&&this.mandatoryActionsChecked===t,e)return i("div",{class:"QueryReferenceContainer",ref:t=>this.stylingContainer=t},this.isLoading?i("slot",{name:"spinner"})&&i("svg",{class:"spinner",viewBox:"0 0 50 50"},i("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"})):i("div",{class:"UserActionController"},i("h2",{class:"UserConsentNotice"},this.userNoticeText),i("div",{class:"PlayerLegislationWrapper"},this.activeUserActions.map((t=>i("slot",{name:t},i("player-user-consents",{lang:this.lang,"gm-version":this.gmVersion,"translation-url":this.translationUrl,consentType:t,consentTitle:this.consentTitles[t],queried:this.queryFired,mandatory:this.mandatoryActions.includes(t),"client-styling":this.clientStyling}))))),this.includeSubmitButton&&i("button",{class:"ConsentSubmitButton",disabled:!this.userActionsValidated,onClick:()=>this.handleApplyClick()},this.submitButtonText)))}static get watchers(){return{translationUrl:["handleNewTranslations"],receivedQueryResponses:["handleQueryResponse"]}}};l.style=":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserActionController{font-family:Arial, Helvetica, sans-serif;font-weight:100;height:100%;width:100%;padding:1rem 1.5rem 2rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;border-radius:5%}.ConsentSubmitButton{font-size:1rem;padding:0.4rem 1.4rem;background:#fff;border:2px solid #000;color:#000;border-radius:5px;align-self:flex-end;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid #ccc;color:#ccc;cursor:unset}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:blue}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";export{r as player_user_consents,l as user_action_controller}
1
+ import{r as t,c as e,h as i}from"./p-ba444709.js";const s={en:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},ro:{termsAndConditions:{acceptPart1:"Accept ",acceptPart2:" platformei. Am citit şi înţeles ",acceptPart3:" publicată pe acest site şi confirm că am vârstă peste 18 ani.",tc:"Termenii şi condiţiile"},privacyPolicy:{readUnderstandPart1:"Am citit şi înţeles ",readUnderstandPart2:" publicată pe acest site şi confirm că am vârstă peste 18 ani.",privacy:"Politica de confidenţialitate"},sms:"Sunt de acord să primesc promoţii de marketing prin SMS.",emailmarketing:"Sunt de acord să primesc promoţii de marketing pe e-mail."},hr:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},fr:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},cs:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."},de:{termsAndConditions:{acceptPart1:"I accept the ",acceptPart2:", I have read and understood the ",acceptPart3:" as published on this site and confirm that I am over 18 years old.",tc:"Terms and Conditions"},privacyPolicy:{readUnderstandPart1:"I have read and understood the ",readUnderstandPart2:", as published on this site and confirm that I am over 18 years old.",privacy:"Privacy Policy"},sms:"I consent to receive marketing communication via SMS.",emailmarketing:"I consent to receive marketing communication via Email."}},n=t=>new Promise((e=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((e=>{for(let i in t[e])s[e][i]=t[e][i]})),e(!0)}))})),a=(t,e,i)=>{let n=(a=s[e||"en"],t.split(".").reduce(((t,e)=>t&&void 0!==t[e]?t[e]:null),a));var a;if(null===n)return t;if(void 0!==i)for(const[t,e]of Object.entries(i)){const i=new RegExp(`{${t}}`,"g");n=n.replace(i,e)}return n},r=class{constructor(i){t(this,i),this.userLegislationConsent=e(this,"userLegislationConsent",7),this.lang="en",this.queried=!1,this.consentType="",this.mandatory=!1,this.gmVersion="",this.consentTitle="",this.clientStyling="",this.translationUrl="",this.textContent="",this.limitStylingAppends=!1,this.goToTermsAndConditions=()=>window.postMessage({type:"GoToTermsAndConditions"}),this.goToPrivacyPolicy=()=>window.postMessage({type:"GoToPrivacyPolicy"}),this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)}}handleNewTranslations(){n(this.translationUrl)}async componentWillLoad(){this.translationUrl.length>2&&await n(this.translationUrl)}userLegislationConsentHandler(){this.userLegislationConsent.emit({type:this.consentType,value:this.checkboxInput.checked})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.limitStylingAppends=!0)}determineTextContent(){if("gmcore"===this.gmVersion&&"termsandconditions"===this.consentType)return i("p",null,a("termsAndConditions.acceptPart1",this.lang),i("span",{class:"ConsentLink",onClick:this.goToTermsAndConditions},a("termsAndConditions.tc",this.lang)),a("termsAndConditions.acceptPart2",this.lang),i("span",{class:"ConsentLink",onClick:this.goToPrivacyPolicy},a("privacyPolicy.privacy",this.lang)),a("termsAndConditions.acceptPart3",this.lang));if("gm16"===this.gmVersion){if("termsandconditions"===this.consentType)return i("p",null,a("termsAndConditions.acceptPart1",this.lang),i("span",{class:"ConsentLink",onClick:this.goToTermsAndConditions},a("termsAndConditions.tc",this.lang)));if("privacypolicy"===this.consentType)return i("p",null,a("privacyPolicy.readUnderstandPart1",this.lang),i("span",{class:"ConsentLink",onClick:this.goToPrivacyPolicy},a("privacyPolicy.privacy",this.lang)),a("privacyPolicy.readUnderstandPart2",this.lang))}return i("p",null,a(this.consentType,this.lang))}render(){return this.queried&&this.userLegislationConsentHandler(),i("div",{ref:t=>this.stylingContainer=t},i("p",{class:"ConsentTitle"},this.consentTitle),i("label",{class:"UserConsent",htmlFor:"userConsent"},i("input",{ref:t=>this.checkboxInput=t,id:"userConsent",type:"checkbox",onInput:()=>this.userLegislationConsentHandler()}),this.determineTextContent(),this.mandatory&&i("span",{class:"MandatoryItem"},"*")))}static get watchers(){return{translationUrl:["handleNewTranslations"]}}};r.style=":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(--emfe-w-color-primary);font-weight:bold}";const o=["ro","en","cz","de","hr"],c={en:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},ro:{termsandconditions:"Termeni şi condiţii",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},hr:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},fr:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},cs:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"},de:{termsandconditions:"Terms and Conditions",sms:"SMS marketing",emailmarketing:"Email marketing",privacypolicy:"Privacy Policy"}},d=t=>new Promise((e=>{fetch(t).then((t=>t.json())).then((t=>{Object.keys(t).forEach((e=>{for(let i in t[e])c[e][i]=t[e][i]})),e(!0)}))})),h=(t,e,i)=>{const s=e;let n=c[void 0!==s&&o.includes(s)?s:"en"][t];if(void 0!==i)for(const[t,e]of Object.entries(i.values)){const i=new RegExp(`{${t}}`,"g");n=n.replace(i,e)}return n},l=class{constructor(e){t(this,e),this.lang="en",this.gmVersion="",this.translationUrl="",this.clientStyling="",this.clientStylingUrl="",this.queryFired=!1,this.readyActionsCount=0,this.activeUserActions=[],this.userActionsValidated=!0,this.receivedQueryResponses=0,this.limitStylingAppends=!1,this.isLoading=!0,this.mandatoryActionsChecked=0,this.mandatoryActions=["termsandconditions","privacypolicy"],this.userActions=[],this.consentTitles={termsandconditions:h("termsandconditions",this.lang),sms:h("sms",this.lang),emailmarketing:h("emailmarketing",this.lang),privacypolicy:h("privacypolicy",this.lang)},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),e=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{this.clientStyling=t,e.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(e)}),1)})).catch((t=>{console.log("error ",t)}))}}handleNewTranslations(){d(this.translationUrl)}handleQueryResponse(){this.receivedQueryResponses===this.activeUserActions.length&&this.updateUserConsents()}userLegislationConsentHandler(t){const e=t.detail.type,i=t.detail.value;this.mandatoryActions.includes(e)&&!1===this.queryFired&&(!0===i?this.mandatoryActionsChecked++:this.mandatoryActionsChecked--),this.queryFired&&(this.userActions.push(Object.assign({tagCode:e,status:(t=>"gm16"===this.gmVersion?t?1:0:t?"Accepted":"Denied")(i)},"gm16"===this.gmVersion&&{note:""})),this.receivedQueryResponses++)}determineUserActionsCore(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/consent`),e=new Headers;return e.append("X-SessionId",this.userSession),fetch(t.href,{method:"GET",headers:e}).then((t=>t.json())).then((t=>{t.items.forEach((t=>{"Expired"===t.status&&this.activeUserActions.push(t.tagCode)})),this.isLoading=!1})).catch((t=>{console.error("Error fetching data:",t),this.isLoading=!1})).finally((()=>{this.calcMandatoryActions(),window.postMessage({type:"UserActionsExists",displayUserActions:this.mandatoryItems>0},window.location.href)}))}determineUserActions16(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`),e=new Headers;return e.append("X-SessionId",this.userSession),fetch(t.href,{method:"GET",headers:e}).then((t=>t.json())).then((t=>{t.consents.forEach((t=>{2===t.status&&"pepconsent"!==t.tagCode&&this.activeUserActions.push(t.tagCode)})),this.isLoading=!1})).catch((t=>{console.error("Error fetching data:",t),this.isLoading=!1})).finally((()=>{this.calcMandatoryActions(),window.postMessage({type:"UserActionsExists",displayUserActions:this.mandatoryItems>0},window.location.href)}))}updateUserConsents(){const t="gmcore"===this.gmVersion?new URL(`${this.endpoint}/v1/player/${this.userId}/consent`):new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);let e={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-SessionId":`${this.userSession}`},body:JSON.stringify({consents:this.userActions})};fetch(t.href,e).then((t=>t.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:"Consent update successful!"}},window.location.href)})).catch((t=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:"Server might not be responding",err:t}},window.location.href)})).finally((()=>{window.postMessage({type:"UserActionsCompleted"},window.location.href)}))}handleApplyClick(){this.queryFired=!0}async componentWillLoad(){"gmcore"===this.gmVersion&&this.determineUserActionsCore(),"gm16"===this.gmVersion&&this.determineUserActions16(),this.translationUrl.length>2&&await d(this.translationUrl)}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}calcMandatoryActions(){this.mandatoryItems=0,this.mandatoryActions.map((t=>{this.activeUserActions.includes(t)&&this.mandatoryItems++}))}render(){return this.mandatoryItems>0?(this.userActionsValidated=this.mandatoryActionsChecked===this.mandatoryItems,i("div",{class:"QueryReferenceContainer",ref:t=>this.stylingContainer=t},this.isLoading?i("slot",{name:"spinner"})&&i("svg",{class:"spinner",viewBox:"0 0 50 50"},i("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"})):i("div",{class:"UserActionController"},i("h2",{class:"UserConsentNotice"},this.userNoticeText),i("div",{class:"PlayerLegislationWrapper"},this.activeUserActions.map((t=>i("slot",{name:t},i("player-user-consents",{lang:this.lang,"gm-version":this.gmVersion,"translation-url":this.translationUrl,consentType:t,consentTitle:this.consentTitles[t],queried:this.queryFired,mandatory:this.mandatoryActions.includes(t),"client-styling":this.clientStyling}))))),this.includeSubmitButton&&i("button",{class:"ConsentSubmitButton",disabled:!this.userActionsValidated,onClick:()=>this.handleApplyClick()},this.submitButtonText)))):void 0}static get watchers(){return{translationUrl:["handleNewTranslations"],receivedQueryResponses:["handleQueryResponse"]}}};l.style=":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserActionController{font-family:Arial, Helvetica, sans-serif;font-weight:100;height:100%;width:100%;padding:1rem 1.5rem 2rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;border-radius:5%}.ConsentSubmitButton{font-size:1rem;padding:0.4rem 1.4rem;background:#fff;border:2px solid #000;color:#000;border-radius:5px;align-self:flex-end;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid #ccc;color:#ccc;cursor:unset}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:blue}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";export{r as player_user_consents,l as user_action_controller}
@@ -1 +1 @@
1
- import{p as t,b as n}from"./p-ba444709.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((t=>n([["p-c1bba01c",[[1,"user-action-controller",{endpoint:[513],userSession:[513,"user-session"],userId:[513,"user-id"],lang:[1537],includeSubmitButton:[516,"include-submit-button"],submitButtonText:[513,"submit-button-text"],userNoticeText:[513,"user-notice-text"],gmVersion:[1,"gm-version"],translationUrl:[513,"translation-url"],clientStyling:[1537,"client-styling"],clientStylingUrl:[513,"client-styling-url"],queryFired:[32],readyActionsCount:[32],activeUserActions:[32],userActionsValidated:[32],receivedQueryResponses:[32],limitStylingAppends:[32],isLoading:[32],mandatoryActionsChecked:[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],translationUrl:[513,"translation-url"],textContent:[32],limitStylingAppends:[32]}]]]],t)));
1
+ import{p as t,b as n}from"./p-ba444709.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((t=>n([["p-52129348",[[1,"user-action-controller",{endpoint:[513],userSession:[513,"user-session"],userId:[513,"user-id"],lang:[1537],includeSubmitButton:[516,"include-submit-button"],submitButtonText:[513,"submit-button-text"],userNoticeText:[513,"user-notice-text"],gmVersion:[1,"gm-version"],translationUrl:[513,"translation-url"],clientStyling:[1537,"client-styling"],clientStylingUrl:[513,"client-styling-url"],queryFired:[32],readyActionsCount:[32],activeUserActions:[32],userActionsValidated:[32],receivedQueryResponses:[32],limitStylingAppends:[32],isLoading:[32],mandatoryActionsChecked:[32],mandatoryItems:[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[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"],translationUrl:[513,"translation-url"],textContent:[32],limitStylingAppends:[32]}]]]],t)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/user-action-controller",
3
- "version": "1.37.4",
3
+ "version": "1.37.6",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",