@everymatrix/general-registration 1.59.2 → 1.60.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.
@@ -3,22 +3,12 @@
3
3
  function safeDecorator(fn) {
4
4
  // eslint-disable-next-line func-names
5
5
  return function (...args) {
6
- // @TODO investigate more and remove this hardcoded customElements for which we need to return false for unknown reasons right now
7
- // this is related to the fact that the widget is not loading properly in firefox while used in toow
8
- if (window.navigator.userAgent.includes('Firefox')) {
9
- if (args[0] == 'dom-repeat' || args[0] == 'dom-module')
10
- return false;
6
+ if (customElements.get(args[0])) {
7
+ return false;
11
8
  }
12
- try {
9
+ else {
13
10
  return fn.apply(this, args);
14
11
  }
15
- catch (error) {
16
- if (error instanceof DOMException &&
17
- error.message.includes('has already been used with this registry') || error.message.includes('Cannot define multiple custom elements with the same tag name')) {
18
- return false;
19
- }
20
- throw error;
21
- }
22
12
  };
23
13
  }
24
14
  customElements.define = safeDecorator(customElements.define);
@@ -1,7 +1,8 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { getTranslations, translate, TRANSLATIONS, DEFAULT_LANGUAGE } from "../../utils/locale.utils";
3
+ import { dispatchCustomEvent } from "../../../../../../../../libs/custom-events/src/index";
3
4
  import "../../../../../general-input/dist/types/index";
4
- import "../../../../../../svelte/player-consents/esnext/player-consents";
5
+ import "../../../../../../svelte/player-consents/es2015/player-consents";
5
6
  export class GeneralRegistration {
6
7
  constructor() {
7
8
  this.listOfInputValues = [];
@@ -311,6 +312,12 @@ export class GeneralRegistration {
311
312
  }
312
313
  });
313
314
  }
315
+ if (this.registrationStep === 'Step1')
316
+ dispatchCustomEvent('register_step1', { eventLabel: this.registrationStep, eventAction: 'nextStep', eventCategory: 'Registration' });
317
+ else if (this.registrationStep === 'Step2')
318
+ dispatchCustomEvent('register_step2', { eventLabel: this.registrationStep, eventAction: 'nextStep', eventCategory: 'Registration' });
319
+ else if (this.registrationStep === 'Step3')
320
+ dispatchCustomEvent('register_step3', { eventLabel: this.registrationStep, eventAction: 'nextStep', eventCategory: 'Registration' });
314
321
  return res.json();
315
322
  })
316
323
  .then((data) => {
@@ -366,6 +373,7 @@ export class GeneralRegistration {
366
373
  body: JSON.stringify({ registrationId: this.registrationID }),
367
374
  headers
368
375
  };
376
+ dispatchCustomEvent('register_submit', { registrationId: this.registrationID });
369
377
  fetch(url.href, options)
370
378
  .then((res) => {
371
379
  if (!res.ok) {
@@ -387,6 +395,7 @@ export class GeneralRegistration {
387
395
  type: 'error',
388
396
  message: this.errorMessage
389
397
  } }, window.location.href);
398
+ dispatchCustomEvent('register_fail', { error: this.errorMessage });
390
399
  });
391
400
  }
392
401
  return res.json();
@@ -400,6 +409,7 @@ export class GeneralRegistration {
400
409
  type: 'success',
401
410
  message: translate('successMessage', this.language)
402
411
  } }, window.location.href);
412
+ dispatchCustomEvent('register_success', { userId: data.userId });
403
413
  }
404
414
  })
405
415
  .catch((err) => {
@@ -1,22 +1,12 @@
1
1
  function safeDecorator(fn) {
2
2
  // eslint-disable-next-line func-names
3
3
  return function (...args) {
4
- // @TODO investigate more and remove this hardcoded customElements for which we need to return false for unknown reasons right now
5
- // this is related to the fact that the widget is not loading properly in firefox while used in toow
6
- if (window.navigator.userAgent.includes('Firefox')) {
7
- if (args[0] == 'dom-repeat' || args[0] == 'dom-module')
8
- return false;
4
+ if (customElements.get(args[0])) {
5
+ return false;
9
6
  }
10
- try {
7
+ else {
11
8
  return fn.apply(this, args);
12
9
  }
13
- catch (error) {
14
- if (error instanceof DOMException &&
15
- error.message.includes('has already been used with this registry') || error.message.includes('Cannot define multiple custom elements with the same tag name')) {
16
- return false;
17
- }
18
- throw error;
19
- }
20
10
  };
21
11
  }
22
12
  customElements.define = safeDecorator(customElements.define);