@everymatrix/user-action-controller 1.61.0 → 1.62.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/loader.cjs.js +1 -1
  2. package/dist/cjs/player-user-consents_2.cjs.entry.js +105 -56
  3. package/dist/cjs/user-action-controller.cjs.js +1 -1
  4. package/dist/collection/components/user-action-controller/user-action-controller.css +17 -6
  5. package/dist/collection/components/user-action-controller/user-action-controller.js +84 -41
  6. package/dist/collection/utils/locale.utils.js +37 -15
  7. package/dist/esm/loader.js +1 -1
  8. package/dist/esm/player-user-consents_2.entry.js +105 -56
  9. package/dist/esm/user-action-controller.js +1 -1
  10. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.d.ts +2 -0
  11. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.dev.d.ts +2 -0
  12. package/dist/types/components/user-action-controller/user-action-controller.d.ts +12 -3
  13. package/dist/types/components.d.ts +16 -0
  14. package/dist/user-action-controller/p-e132fb80.entry.js +1 -0
  15. package/dist/user-action-controller/user-action-controller.esm.js +1 -1
  16. package/package.json +1 -1
  17. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.d.ts +0 -2
  18. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.dev.d.ts +0 -2
  19. package/dist/user-action-controller/p-a6c8de57.entry.js +0 -1
  20. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/user-action-controller/.stencil/libs/common/src/storybook/storybook-utils.d.ts +0 -0
  21. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/storybook/main.d.ts +0 -0
  22. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/storybook/preview.d.ts +0 -0
  23. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/user-action-controller/.stencil/tools/plugins/index.d.ts +0 -0
  24. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/user-action-controller/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  25. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/user-action-controller/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  26. /package/dist/types/Users/{adrian.pripon/Documents/Work → maria.bumbar/Desktop}/widgets-monorepo/packages/stencil/user-action-controller/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- 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"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"mbSource":[513,"mb-source"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]],{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"receivedQueryResponses":["handleQueryResponse"]}],[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);
11
+ 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"],"includeRejectButton":[516,"include-reject-button"],"includeRejectText":[516,"include-reject-text"],"gmVersion":[513,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"mbSource":[513,"mb-source"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]],{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"receivedQueryResponses":["handleQueryResponse"]}],[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);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -280,7 +280,9 @@ const TRANSLATIONS = {
280
280
  emailMarketingTitle: 'Email marketing',
281
281
  privacyPolicyTitle: 'Privacy Policy',
282
282
  userNoticeText: 'Before you can proceed you must consent to the following',
283
- submitButtonText: 'Submit'
283
+ submitButtonText: 'Submit',
284
+ rejectButtonText: 'Reject',
285
+ rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.'
284
286
  },
285
287
  'en-us': {
286
288
  termsAndConditionsTitle: 'Terms and Conditions',
@@ -288,7 +290,9 @@ const TRANSLATIONS = {
288
290
  emailMarketingTitle: 'Email marketing',
289
291
  privacyPolicyTitle: 'Privacy Policy',
290
292
  userNoticeText: 'Before you can proceed you must consent to the following',
291
- submitButtonText: 'Submit'
293
+ submitButtonText: 'Submit',
294
+ rejectButtonText: 'Reject',
295
+ rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.'
292
296
  },
293
297
  ro: {
294
298
  termsAndConditionsTitle: 'Termeni și Condiții',
@@ -296,7 +300,9 @@ const TRANSLATIONS = {
296
300
  emailMarketingTitle: 'Marketing prin Email',
297
301
  privacyPolicyTitle: 'Politica de Confidențialitate',
298
302
  userNoticeText: 'Înainte de a continua, trebuie să vă dați consimțământul pentru următoarele',
299
- submitButtonText: 'Trimite'
303
+ submitButtonText: 'Trimite',
304
+ rejectButtonText: 'Respinge',
305
+ rejectText: 'Respingerea noilor consimțăminte va duce la imposibilitatea de a continua procesul de autentificare și veți fi deconectat.'
300
306
  },
301
307
  hr: {
302
308
  termsAndConditionsTitle: 'Opći uvjeti i odredbe',
@@ -304,7 +310,9 @@ const TRANSLATIONS = {
304
310
  emailMarketingTitle: 'E-mail makretinški sadržaj',
305
311
  privacyPolicyTitle: 'Politika Privatnosti',
306
312
  userNoticeText: 'Prije nego što možete nastaviti, morate pristati na sljedeće',
307
- submitButtonText: 'Pošalji'
313
+ submitButtonText: 'Pošalji',
314
+ rejectButtonText: 'Odbij',
315
+ rejectText: 'Odbijanje novih pristanka rezultirat će nemogućnošću nastavka procesa prijave i bit ćete odjavljeni.'
308
316
  },
309
317
  fr: {
310
318
  termsAndConditionsTitle: 'Termes et Conditions',
@@ -312,15 +320,19 @@ const TRANSLATIONS = {
312
320
  emailMarketingTitle: 'Marketing par Email',
313
321
  privacyPolicyTitle: 'Politique de Confidentialité',
314
322
  userNoticeText: 'Avant de continuer, vous devez consentir aux éléments suivants',
315
- submitButtonText: 'Soumettre'
323
+ submitButtonText: 'Soumettre',
324
+ rejectButtonText: 'Rejeter',
325
+ rejectText: 'Le rejet des nouveaux consentements entraînera l\'impossibilité de continuer le processus de connexion et vous serez déconnecté.'
316
326
  },
317
327
  cs: {
318
- termsAndConditionsTitle: 'Terms and Conditions',
328
+ termsAndConditionsTitle: 'Podmínky a ujednání',
319
329
  smsTitle: 'SMS marketing',
320
- emailMarketingTitle: 'Email marketing',
321
- privacyPolicyTitle: 'Privacy Policy',
322
- userNoticeText: 'Before you can proceed you must consent to the following',
323
- submitButtonText: 'Submit'
330
+ emailMarketingTitle: 'Emailový marketing',
331
+ privacyPolicyTitle: 'Zásady ochrany osobních údajů',
332
+ userNoticeText: 'Než budete moci pokračovat, musíte souhlasit s následujícím',
333
+ submitButtonText: 'Odeslat',
334
+ rejectButtonText: 'Odmítnout',
335
+ rejectText: 'Odmítnutí nových souhlasů povede k nemožnosti pokračovat v procesu přihlášení a budete odhlášeni.'
324
336
  },
325
337
  de: {
326
338
  termsAndConditionsTitle: 'Allgemeine Geschäftsbedingungen',
@@ -328,7 +340,9 @@ const TRANSLATIONS = {
328
340
  emailMarketingTitle: 'E-Mail-Marketing',
329
341
  privacyPolicyTitle: 'Datenschutzrichtlinie',
330
342
  userNoticeText: 'Bevor Sie fortfahren können, müssen Sie den folgenden Punkten zustimmen',
331
- submitButtonText: 'Absenden'
343
+ submitButtonText: 'Absenden',
344
+ rejectButtonText: 'Ablehnen',
345
+ rejectText: 'Das Ablehnen neuer Zustimmungen führt dazu, dass der Anmeldevorgang nicht fortgesetzt werden kann und Sie abgemeldet werden.'
332
346
  },
333
347
  es: {
334
348
  termsAndConditionsTitle: 'Términos y Condiciones',
@@ -336,7 +350,9 @@ const TRANSLATIONS = {
336
350
  emailMarketingTitle: 'Marketing por Email',
337
351
  privacyPolicyTitle: 'Política de Privacidad',
338
352
  userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
339
- submitButtonText: 'Enviar'
353
+ submitButtonText: 'Enviar',
354
+ rejectButtonText: 'Rechazar',
355
+ rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.'
340
356
  },
341
357
  pt: {
342
358
  termsAndConditionsTitle: 'Termos e Condições',
@@ -344,7 +360,9 @@ const TRANSLATIONS = {
344
360
  emailMarketingTitle: 'Marketing por Email',
345
361
  privacyPolicyTitle: 'Política de Privacidade',
346
362
  userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
347
- submitButtonText: 'Enviar'
363
+ submitButtonText: 'Enviar',
364
+ rejectButtonText: 'Rejeitar',
365
+ rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.'
348
366
  },
349
367
  'es-mx': {
350
368
  termsAndConditionsTitle: 'Términos y Condiciones',
@@ -352,7 +370,9 @@ const TRANSLATIONS = {
352
370
  emailMarketingTitle: 'Marketing por Email',
353
371
  privacyPolicyTitle: 'Política de Privacidad',
354
372
  userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
355
- submitButtonText: 'Enviar'
373
+ submitButtonText: 'Enviar',
374
+ rejectButtonText: 'Rechazar',
375
+ rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.'
356
376
  },
357
377
  'pt-br': {
358
378
  termsAndConditionsTitle: 'Termos e Condições',
@@ -360,7 +380,9 @@ const TRANSLATIONS = {
360
380
  emailMarketingTitle: 'Marketing por Email',
361
381
  privacyPolicyTitle: 'Política de Privacidade',
362
382
  userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
363
- submitButtonText: 'Enviar'
383
+ submitButtonText: 'Enviar',
384
+ rejectButtonText: 'Rejeitar',
385
+ rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.'
364
386
  }
365
387
  };
366
388
  const getTranslations = (url) => {
@@ -392,7 +414,26 @@ const translate = (key, customLang, values) => {
392
414
  return translation;
393
415
  };
394
416
 
395
- const userActionControllerCss = ":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(--emw--login-color-primary, var(--emw--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}}";
417
+ /**
418
+ * @name dispatchCustomEvent
419
+ * @description dispatches the custom event CustomEventProcessor is listening for
420
+ * @param {string} type of the custom event
421
+ * @param {Object} data may contain additional information about the event, e.g. userId
422
+ */
423
+ const dispatchCustomEvent = (type, data = {}) => {
424
+ const event = new CustomEvent('track-custom-event', {
425
+ detail: {
426
+ type,
427
+ data
428
+ },
429
+ bubbles: true,
430
+ composed: true
431
+ });
432
+
433
+ document.dispatchEvent(event);
434
+ };
435
+
436
+ const userActionControllerCss = ":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,.ConsentRejectButton{font-size:1rem;font-family:var(--emw--button-typography);padding:0.4rem 1.4rem;background:var(--emw--button-background-color, #FFFFFF);border:var(--emw-button-border, 2px solid #000);color:var(--emw--button-text-color, #000000);border-radius:var(--emw--button-border-radius, 5px);align-self:flex-end;cursor:pointer}.ConsentSubmitButton:disabled,.ConsentRejectButton:disabled{border:2px solid #ccc;color:#ccc;cursor:unset}.ButtonsWrapper{display:flex;flex-direction:row;justify-content:space-between;margin-top:10px}.ButtonsWrapper button:only-child{margin-left:auto}@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(--emw--login-color-primary, var(--emw--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}}";
396
437
  const UserActionControllerStyle0 = userActionControllerCss;
397
438
 
398
439
  const UserActionController = class {
@@ -407,11 +448,30 @@ const UserActionController = class {
407
448
  emailmarketing: translate('emailMarketingTitle', this.lang),
408
449
  privacypolicy: translate('privacyPolicyTitle', this.lang)
409
450
  };
451
+ this.handleApplyClick = () => {
452
+ this.queryFired = true;
453
+ };
454
+ this.handleReject = () => {
455
+ const headers = new Headers();
456
+ headers.append('Content-type', 'application/json');
457
+ headers.append('X-SessionID', this.userSession);
458
+ const options = {
459
+ method: 'DELETE',
460
+ headers: headers
461
+ };
462
+ fetch(`${this.endpoint}/v1/player/session/player`, options)
463
+ .then(() => {
464
+ window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
465
+ dispatchCustomEvent('logged_out', {});
466
+ });
467
+ };
410
468
  this.endpoint = undefined;
411
469
  this.userSession = undefined;
412
470
  this.userId = undefined;
413
471
  this.lang = 'en';
414
472
  this.includeSubmitButton = undefined;
473
+ this.includeRejectButton = undefined;
474
+ this.includeRejectText = undefined;
415
475
  this.gmVersion = '';
416
476
  this.translationUrl = '';
417
477
  this.clientStyling = '';
@@ -467,54 +527,52 @@ const UserActionController = class {
467
527
  const url = new URL(`${this.endpoint}/v1/player/${this.userId}/consent`);
468
528
  const headers = new Headers();
469
529
  headers.append('X-SessionId', this.userSession);
470
- let requestOptions = {
530
+ const options = {
471
531
  method: 'GET',
472
532
  headers
473
533
  };
474
- return fetch(url.href, requestOptions)
534
+ fetch(url.href, options)
475
535
  .then(res => res.json())
476
536
  .then(data => {
477
- const actionItems = data.items;
478
- actionItems.forEach(element => {
537
+ data.items.forEach(element => {
479
538
  if (element.status === 'Expired') {
480
539
  this.activeUserActions.push(element.tagCode);
481
540
  }
482
541
  });
483
- this.isLoading = false;
484
542
  })
485
543
  .catch(error => {
486
544
  console.error('Error fetching data:', error);
487
- this.isLoading = false;
488
- }).finally(() => {
545
+ })
546
+ .finally(() => {
489
547
  this.calcMandatoryActions();
490
- window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
548
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 }, window.location.href);
549
+ this.isLoading = false;
491
550
  });
492
551
  }
493
552
  determineUserActions16() {
494
553
  const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
495
554
  const headers = new Headers();
496
555
  headers.append('X-SessionId', this.userSession);
497
- let requestOptions = {
556
+ const options = {
498
557
  method: 'GET',
499
558
  headers
500
559
  };
501
- return fetch(url.href, requestOptions)
560
+ fetch(url.href, options)
502
561
  .then(res => res.json())
503
562
  .then(data => {
504
- const actionItems = data.consents;
505
- actionItems.forEach(element => {
563
+ data.consents.forEach(element => {
506
564
  if (element.status === 2 && element.tagCode !== 'pepconsent') {
507
565
  this.activeUserActions.push(element.tagCode);
508
566
  }
509
567
  });
510
- this.isLoading = false;
511
568
  })
512
569
  .catch(error => {
513
570
  console.error('Error fetching data:', error);
514
- this.isLoading = false;
515
- }).finally(() => {
571
+ })
572
+ .finally(() => {
516
573
  this.calcMandatoryActions();
517
- window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
574
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 }, window.location.href);
575
+ this.isLoading = false;
518
576
  });
519
577
  }
520
578
  updateUserConsents() {
@@ -524,7 +582,7 @@ const UserActionController = class {
524
582
  const body = {
525
583
  consents: this.userActions
526
584
  };
527
- let requestOptions = {
585
+ let options = {
528
586
  method: 'POST',
529
587
  headers: {
530
588
  'Content-Type': 'application/json',
@@ -533,7 +591,7 @@ const UserActionController = class {
533
591
  },
534
592
  body: JSON.stringify(body)
535
593
  };
536
- fetch(url.href, requestOptions)
594
+ fetch(url.href, options)
537
595
  .then(res => res.json())
538
596
  .then(() => {
539
597
  window.postMessage({
@@ -558,15 +616,14 @@ const UserActionController = class {
558
616
  window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
559
617
  });
560
618
  }
561
- handleApplyClick() {
562
- this.queryFired = true;
563
- }
564
619
  async componentWillLoad() {
565
- if (this.gmVersion === 'gmcore') {
566
- this.determineUserActionsCore();
567
- }
568
- if (this.gmVersion === 'gm16') {
569
- this.determineUserActions16();
620
+ switch (this.gmVersion) {
621
+ case 'gmcore':
622
+ this.determineUserActionsCore();
623
+ break;
624
+ case 'gm16':
625
+ this.determineUserActions16();
626
+ break;
570
627
  }
571
628
  if (this.translationUrl.length > 2) {
572
629
  await getTranslations(this.translationUrl);
@@ -591,24 +648,16 @@ const UserActionController = class {
591
648
  }
592
649
  calcMandatoryActions() {
593
650
  this.mandatoryItems = 0;
594
- this.mandatoryActions.map(action => {
595
- const isPresent = this.activeUserActions.includes(action);
596
- if (isPresent) {
597
- this.mandatoryItems++;
598
- }
599
- });
651
+ this.mandatoryActions.forEach(action => this.activeUserActions.includes(action) && this.mandatoryItems++);
600
652
  }
601
653
  render() {
602
- if (this.mandatoryItems > 0) {
603
- this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
604
- return (index.h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (index.h("slot", { name: 'spinner' })
605
- &&
606
- 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" }, translate('userNoticeText', this.lang)), 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-url": this.clientStylingUrl, "mb-source": this.mbSource, "client-styling": this.clientStyling }))))), this.includeSubmitButton &&
607
- index.h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, translate('submitButtonText', this.lang))))));
608
- }
609
- else {
654
+ if (this.mandatoryItems === 0) {
610
655
  return;
611
656
  }
657
+ this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
658
+ return (index.h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (index.h("div", null, index.h("slot", { name: 'spinner' }), 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" }, translate('userNoticeText', this.lang)), 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-url": this.clientStylingUrl, "mb-source": this.mbSource, "client-styling": this.clientStyling }))))), index.h("div", { class: "ButtonsWrapper" }, this.includeRejectButton &&
659
+ index.h("button", { class: "ConsentRejectButton", onClick: this.handleReject }, translate('rejectButtonText', this.lang)), this.includeSubmitButton &&
660
+ index.h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: this.handleApplyClick }, translate('submitButtonText', this.lang))), this.includeRejectText && index.h("p", { class: "RejectText" }, translate('rejectText', this.lang))))));
612
661
  }
613
662
  static get watchers() { return {
614
663
  "translationUrl": ["handleNewTranslations"],
@@ -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_2.cjs",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"mbSource":[513,"mb-source"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]],{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"receivedQueryResponses":["handleQueryResponse"]}],[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);
22
+ 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"],"includeRejectButton":[516,"include-reject-button"],"includeRejectText":[516,"include-reject-text"],"gmVersion":[513,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"mbSource":[513,"mb-source"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]],{"translationUrl":["handleNewTranslations"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"receivedQueryResponses":["handleQueryResponse"]}],[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;
@@ -32,22 +32,33 @@
32
32
  border-radius: 5%;
33
33
  }
34
34
 
35
- .ConsentSubmitButton {
35
+ .ConsentSubmitButton, .ConsentRejectButton {
36
36
  font-size: 1rem;
37
+ font-family: var(--emw--button-typography);
37
38
  padding: 0.4rem 1.4rem;
38
- background: #fff;
39
- border: 2px solid #000;
40
- color: #000;
41
- border-radius: 5px;
39
+ background: var(--emw--button-background-color, #FFFFFF);
40
+ border: var(--emw-button-border, 2px solid #000);
41
+ color: var(--emw--button-text-color, #000000);
42
+ border-radius: var(--emw--button-border-radius, 5px);
42
43
  align-self: flex-end;
43
44
  cursor: pointer;
44
45
  }
45
- .ConsentSubmitButton:disabled {
46
+ .ConsentSubmitButton:disabled, .ConsentRejectButton:disabled {
46
47
  border: 2px solid #ccc;
47
48
  color: #ccc;
48
49
  cursor: unset;
49
50
  }
50
51
 
52
+ .ButtonsWrapper {
53
+ display: flex;
54
+ flex-direction: row;
55
+ justify-content: space-between;
56
+ margin-top: 10px;
57
+ }
58
+ .ButtonsWrapper button:only-child {
59
+ margin-left: auto;
60
+ }
61
+
51
62
  @media screen and (max-width: 320px) {
52
63
  .QueryReferenceContainer {
53
64
  font-size: 0.8rem;
@@ -1,6 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { getTranslations, translate } from "../../utils/locale.utils";
3
3
  import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
4
+ import { dispatchCustomEvent } from "../../../../../../../../libs/custom-events/src/index";
4
5
  import "../../../../../player-user-consents/dist/types/index";
5
6
  export class UserActionController {
6
7
  constructor() {
@@ -13,11 +14,30 @@ export class UserActionController {
13
14
  emailmarketing: translate('emailMarketingTitle', this.lang),
14
15
  privacypolicy: translate('privacyPolicyTitle', this.lang)
15
16
  };
17
+ this.handleApplyClick = () => {
18
+ this.queryFired = true;
19
+ };
20
+ this.handleReject = () => {
21
+ const headers = new Headers();
22
+ headers.append('Content-type', 'application/json');
23
+ headers.append('X-SessionID', this.userSession);
24
+ const options = {
25
+ method: 'DELETE',
26
+ headers: headers
27
+ };
28
+ fetch(`${this.endpoint}/v1/player/session/player`, options)
29
+ .then(() => {
30
+ window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
31
+ dispatchCustomEvent('logged_out', {});
32
+ });
33
+ };
16
34
  this.endpoint = undefined;
17
35
  this.userSession = undefined;
18
36
  this.userId = undefined;
19
37
  this.lang = 'en';
20
38
  this.includeSubmitButton = undefined;
39
+ this.includeRejectButton = undefined;
40
+ this.includeRejectText = undefined;
21
41
  this.gmVersion = '';
22
42
  this.translationUrl = '';
23
43
  this.clientStyling = '';
@@ -73,54 +93,52 @@ export class UserActionController {
73
93
  const url = new URL(`${this.endpoint}/v1/player/${this.userId}/consent`);
74
94
  const headers = new Headers();
75
95
  headers.append('X-SessionId', this.userSession);
76
- let requestOptions = {
96
+ const options = {
77
97
  method: 'GET',
78
98
  headers
79
99
  };
80
- return fetch(url.href, requestOptions)
100
+ fetch(url.href, options)
81
101
  .then(res => res.json())
82
102
  .then(data => {
83
- const actionItems = data.items;
84
- actionItems.forEach(element => {
103
+ data.items.forEach(element => {
85
104
  if (element.status === 'Expired') {
86
105
  this.activeUserActions.push(element.tagCode);
87
106
  }
88
107
  });
89
- this.isLoading = false;
90
108
  })
91
109
  .catch(error => {
92
110
  console.error('Error fetching data:', error);
93
- this.isLoading = false;
94
- }).finally(() => {
111
+ })
112
+ .finally(() => {
95
113
  this.calcMandatoryActions();
96
- window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
114
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 }, window.location.href);
115
+ this.isLoading = false;
97
116
  });
98
117
  }
99
118
  determineUserActions16() {
100
119
  const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
101
120
  const headers = new Headers();
102
121
  headers.append('X-SessionId', this.userSession);
103
- let requestOptions = {
122
+ const options = {
104
123
  method: 'GET',
105
124
  headers
106
125
  };
107
- return fetch(url.href, requestOptions)
126
+ fetch(url.href, options)
108
127
  .then(res => res.json())
109
128
  .then(data => {
110
- const actionItems = data.consents;
111
- actionItems.forEach(element => {
129
+ data.consents.forEach(element => {
112
130
  if (element.status === 2 && element.tagCode !== 'pepconsent') {
113
131
  this.activeUserActions.push(element.tagCode);
114
132
  }
115
133
  });
116
- this.isLoading = false;
117
134
  })
118
135
  .catch(error => {
119
136
  console.error('Error fetching data:', error);
120
- this.isLoading = false;
121
- }).finally(() => {
137
+ })
138
+ .finally(() => {
122
139
  this.calcMandatoryActions();
123
- window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
140
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 }, window.location.href);
141
+ this.isLoading = false;
124
142
  });
125
143
  }
126
144
  updateUserConsents() {
@@ -130,7 +148,7 @@ export class UserActionController {
130
148
  const body = {
131
149
  consents: this.userActions
132
150
  };
133
- let requestOptions = {
151
+ let options = {
134
152
  method: 'POST',
135
153
  headers: {
136
154
  'Content-Type': 'application/json',
@@ -139,7 +157,7 @@ export class UserActionController {
139
157
  },
140
158
  body: JSON.stringify(body)
141
159
  };
142
- fetch(url.href, requestOptions)
160
+ fetch(url.href, options)
143
161
  .then(res => res.json())
144
162
  .then(() => {
145
163
  window.postMessage({
@@ -164,15 +182,14 @@ export class UserActionController {
164
182
  window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
165
183
  });
166
184
  }
167
- handleApplyClick() {
168
- this.queryFired = true;
169
- }
170
185
  async componentWillLoad() {
171
- if (this.gmVersion === 'gmcore') {
172
- this.determineUserActionsCore();
173
- }
174
- if (this.gmVersion === 'gm16') {
175
- this.determineUserActions16();
186
+ switch (this.gmVersion) {
187
+ case 'gmcore':
188
+ this.determineUserActionsCore();
189
+ break;
190
+ case 'gm16':
191
+ this.determineUserActions16();
192
+ break;
176
193
  }
177
194
  if (this.translationUrl.length > 2) {
178
195
  await getTranslations(this.translationUrl);
@@ -197,24 +214,16 @@ export class UserActionController {
197
214
  }
198
215
  calcMandatoryActions() {
199
216
  this.mandatoryItems = 0;
200
- this.mandatoryActions.map(action => {
201
- const isPresent = this.activeUserActions.includes(action);
202
- if (isPresent) {
203
- this.mandatoryItems++;
204
- }
205
- });
217
+ this.mandatoryActions.forEach(action => this.activeUserActions.includes(action) && this.mandatoryItems++);
206
218
  }
207
219
  render() {
208
- if (this.mandatoryItems > 0) {
209
- this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
210
- return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("slot", { name: 'spinner' })
211
- &&
212
- 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" }, translate('userNoticeText', this.lang)), 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-url": this.clientStylingUrl, "mb-source": this.mbSource, "client-styling": this.clientStyling }))))), this.includeSubmitButton &&
213
- h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, translate('submitButtonText', this.lang))))));
214
- }
215
- else {
220
+ if (this.mandatoryItems === 0) {
216
221
  return;
217
222
  }
223
+ this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
224
+ return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("div", null, h("slot", { name: 'spinner' }), 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" }, translate('userNoticeText', this.lang)), 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-url": this.clientStylingUrl, "mb-source": this.mbSource, "client-styling": this.clientStyling }))))), h("div", { class: "ButtonsWrapper" }, this.includeRejectButton &&
225
+ h("button", { class: "ConsentRejectButton", onClick: this.handleReject }, translate('rejectButtonText', this.lang)), this.includeSubmitButton &&
226
+ h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: this.handleApplyClick }, translate('submitButtonText', this.lang))), this.includeRejectText && h("p", { class: "RejectText" }, translate('rejectText', this.lang))))));
218
227
  }
219
228
  static get is() { return "user-action-controller"; }
220
229
  static get encapsulation() { return "shadow"; }
@@ -316,6 +325,40 @@ export class UserActionController {
316
325
  "attribute": "include-submit-button",
317
326
  "reflect": true
318
327
  },
328
+ "includeRejectButton": {
329
+ "type": "boolean",
330
+ "mutable": false,
331
+ "complexType": {
332
+ "original": "boolean",
333
+ "resolved": "boolean",
334
+ "references": {}
335
+ },
336
+ "required": true,
337
+ "optional": false,
338
+ "docs": {
339
+ "tags": [],
340
+ "text": "whether or not to include the reject button"
341
+ },
342
+ "attribute": "include-reject-button",
343
+ "reflect": true
344
+ },
345
+ "includeRejectText": {
346
+ "type": "boolean",
347
+ "mutable": false,
348
+ "complexType": {
349
+ "original": "boolean",
350
+ "resolved": "boolean",
351
+ "references": {}
352
+ },
353
+ "required": true,
354
+ "optional": false,
355
+ "docs": {
356
+ "tags": [],
357
+ "text": "whether or not to include the reject desctiption text"
358
+ },
359
+ "attribute": "include-reject-text",
360
+ "reflect": true
361
+ },
319
362
  "gmVersion": {
320
363
  "type": "string",
321
364
  "mutable": false,
@@ -331,7 +374,7 @@ export class UserActionController {
331
374
  "text": "Select GM version"
332
375
  },
333
376
  "attribute": "gm-version",
334
- "reflect": false,
377
+ "reflect": true,
335
378
  "defaultValue": "''"
336
379
  },
337
380
  "translationUrl": {