@everymatrix/general-registration 1.99.56 → 1.99.57

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,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-4ef02ef9.js');
6
+ const types = require('./types-ef75801c.js');
6
7
 
7
8
  const DEFAULT_LANGUAGE$1 = 'en';
8
9
  const TRANSLATIONS$1 = {
@@ -14799,6 +14800,7 @@ const GeneralRegistration = class {
14799
14800
  index.registerInstance(this, hostRef);
14800
14801
  this.registrationWidgetLoaded = index.createEvent(this, "registrationWidgetLoaded", 7);
14801
14802
  this.registrationStepUpdated = index.createEvent(this, "registrationStepUpdated", 7);
14803
+ this.registrationConfigStatus = index.createEvent(this, "registrationConfigStatus", 7);
14802
14804
  this.validationChange = index.createEvent(this, "validationChange", 7);
14803
14805
  this.isSelectingAddress = false;
14804
14806
  this.lastPostalCode = null;
@@ -15291,6 +15293,10 @@ const GeneralRegistration = class {
15291
15293
  });
15292
15294
  await this.captchaInstance.render(captchaContainerEl);
15293
15295
  }
15296
+ emitRegistrationConfigStatus(status) {
15297
+ this.registrationConfigStatus.emit(status);
15298
+ window.postMessage({ type: 'registrationConfigStatus', status }, window.location.href);
15299
+ }
15294
15300
  getRegisterConfig(registrationID) {
15295
15301
  const configPath = this.gmversion === 'gm2'
15296
15302
  ? '/api/pam/v2/legislation/register/config'
@@ -15308,6 +15314,7 @@ const GeneralRegistration = class {
15308
15314
  };
15309
15315
  return new Promise((resolve, reject) => {
15310
15316
  this.isLoading = true;
15317
+ this.emitRegistrationConfigStatus(types.RegistrationConfigStatus.Loading);
15311
15318
  fetch(url.href, options)
15312
15319
  .then((res) => {
15313
15320
  if (!res.ok) {
@@ -15323,11 +15330,14 @@ const GeneralRegistration = class {
15323
15330
  .then((config) => {
15324
15331
  this.isLoading = false;
15325
15332
  if (!config) {
15333
+ this.emitRegistrationConfigStatus(types.RegistrationConfigStatus.Error);
15326
15334
  return reject('Get register config is empty or has an error.');
15327
15335
  }
15336
+ this.emitRegistrationConfigStatus(types.RegistrationConfigStatus.Success);
15328
15337
  return resolve(config);
15329
15338
  }, (err) => {
15330
15339
  console.error('Get register config is empty or has an error: ', err);
15340
+ this.emitRegistrationConfigStatus(types.RegistrationConfigStatus.Error);
15331
15341
  return reject(err);
15332
15342
  }).finally(() => {
15333
15343
  this.isLoading = false;
@@ -15914,8 +15924,8 @@ const GeneralRegistration = class {
15914
15924
  const isLoading = this.isLoading && !this.registerErrors;
15915
15925
  const isError = !this.isLoading && this.registerErrors;
15916
15926
  const showForm = !(isLoading || isError);
15917
- return (index.h("div", { key: '53b15694dbc2a96e11d7f4063bcd6025c8e3c729', ref: (el) => (this.stylingContainer = el), class: `registration registration__${this.registrationStep}` }, isLoading && index.h("p", { key: 'd23e595780422a46e6b8b2f20d51444ba46e2c8d', class: `registration registration__loading-message` }, translate('loadingMessage', this.language)), isError && this.renderErrorMessage(this.errorMessage), showForm && this.renderForm(), showForm && !this.buttonInsideForm && this.renderButtons(), this.turnstileSiteKey &&
15918
- index.h("div", { key: '94a3b0a7a5f7afb770817364e4cc3fad3328a523', class: "captcha-wrapper" }, index.h("slot", { key: 'f4821bcc295105fdd15b72153822eed1989614b6', name: CAPTCHA_CONTAINER_SLOT }))));
15927
+ return (index.h("div", { key: '8bd2260523f0cc8c4cba59496dcc75e5a725cf27', ref: (el) => (this.stylingContainer = el), class: `registration registration__${this.registrationStep}` }, isLoading && index.h("p", { key: '5ab45acffbf827dd501fc069d3febb6b06876273', class: `registration registration__loading-message` }, translate('loadingMessage', this.language)), isError && this.renderErrorMessage(this.errorMessage), showForm && this.renderForm(), showForm && !this.buttonInsideForm && this.renderButtons(), this.turnstileSiteKey &&
15928
+ index.h("div", { key: '1a9506c7a4cecf2598ba22c2508277bdc2b55fc5', class: "captcha-wrapper" }, index.h("slot", { key: 'db4a6364ba72d9f51e672f247661bf5134c91d86', name: CAPTCHA_CONTAINER_SLOT }))));
15919
15929
  }
15920
15930
  get host() { return index.getElement(this); }
15921
15931
  static get watchers() { return {
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const types = require('./types-ef75801c.js');
6
+
3
7
  function safeDecorator(fn) {
4
8
  // eslint-disable-next-line func-names
5
9
  return function (...args) {
@@ -12,3 +16,10 @@ function safeDecorator(fn) {
12
16
  };
13
17
  }
14
18
  customElements.define = safeDecorator(customElements.define);
19
+
20
+ Object.defineProperty(exports, 'RegistrationConfigStatus', {
21
+ enumerable: true,
22
+ get: function () {
23
+ return types.RegistrationConfigStatus;
24
+ }
25
+ });
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ exports.RegistrationConfigStatus = void 0;
4
+ (function (RegistrationConfigStatus) {
5
+ RegistrationConfigStatus["Loading"] = "Loading";
6
+ RegistrationConfigStatus["Success"] = "Success";
7
+ RegistrationConfigStatus["Error"] = "Error";
8
+ })(exports.RegistrationConfigStatus || (exports.RegistrationConfigStatus = {}));
@@ -1,5 +1,6 @@
1
1
  import { forceUpdate, h } from "@stencil/core";
2
2
  import { getTranslations, setTranslation, translate, TRANSLATIONS, DEFAULT_LANGUAGE, CONSTANTS } from "../../utils/locale.utils";
3
+ import { RegistrationConfigStatus } from "../../utils/types";
3
4
  import { getStreamTranslations } from "../../../../../../../../libs/common/src/i18n/index";
4
5
  import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
5
6
  import { dispatchCustomEvent } from "../../../../../../../../libs/custom-events/src/index";
@@ -500,6 +501,10 @@ export class GeneralRegistration {
500
501
  });
501
502
  await this.captchaInstance.render(captchaContainerEl);
502
503
  }
504
+ emitRegistrationConfigStatus(status) {
505
+ this.registrationConfigStatus.emit(status);
506
+ window.postMessage({ type: 'registrationConfigStatus', status }, window.location.href);
507
+ }
503
508
  getRegisterConfig(registrationID) {
504
509
  const configPath = this.gmversion === 'gm2'
505
510
  ? '/api/pam/v2/legislation/register/config'
@@ -517,6 +522,7 @@ export class GeneralRegistration {
517
522
  };
518
523
  return new Promise((resolve, reject) => {
519
524
  this.isLoading = true;
525
+ this.emitRegistrationConfigStatus(RegistrationConfigStatus.Loading);
520
526
  fetch(url.href, options)
521
527
  .then((res) => {
522
528
  if (!res.ok) {
@@ -532,11 +538,14 @@ export class GeneralRegistration {
532
538
  .then((config) => {
533
539
  this.isLoading = false;
534
540
  if (!config) {
541
+ this.emitRegistrationConfigStatus(RegistrationConfigStatus.Error);
535
542
  return reject('Get register config is empty or has an error.');
536
543
  }
544
+ this.emitRegistrationConfigStatus(RegistrationConfigStatus.Success);
537
545
  return resolve(config);
538
546
  }, (err) => {
539
547
  console.error('Get register config is empty or has an error: ', err);
548
+ this.emitRegistrationConfigStatus(RegistrationConfigStatus.Error);
540
549
  return reject(err);
541
550
  }).finally(() => {
542
551
  this.isLoading = false;
@@ -1124,8 +1133,8 @@ export class GeneralRegistration {
1124
1133
  const isLoading = this.isLoading && !this.registerErrors;
1125
1134
  const isError = !this.isLoading && this.registerErrors;
1126
1135
  const showForm = !(isLoading || isError);
1127
- return (h("div", { key: '53b15694dbc2a96e11d7f4063bcd6025c8e3c729', ref: (el) => (this.stylingContainer = el), class: `registration registration__${this.registrationStep}` }, isLoading && h("p", { key: 'd23e595780422a46e6b8b2f20d51444ba46e2c8d', class: `registration registration__loading-message` }, translate('loadingMessage', this.language)), isError && this.renderErrorMessage(this.errorMessage), showForm && this.renderForm(), showForm && !this.buttonInsideForm && this.renderButtons(), this.turnstileSiteKey &&
1128
- h("div", { key: '94a3b0a7a5f7afb770817364e4cc3fad3328a523', class: "captcha-wrapper" }, h("slot", { key: 'f4821bcc295105fdd15b72153822eed1989614b6', name: CAPTCHA_CONTAINER_SLOT }))));
1136
+ return (h("div", { key: '8bd2260523f0cc8c4cba59496dcc75e5a725cf27', ref: (el) => (this.stylingContainer = el), class: `registration registration__${this.registrationStep}` }, isLoading && h("p", { key: '5ab45acffbf827dd501fc069d3febb6b06876273', class: `registration registration__loading-message` }, translate('loadingMessage', this.language)), isError && this.renderErrorMessage(this.errorMessage), showForm && this.renderForm(), showForm && !this.buttonInsideForm && this.renderButtons(), this.turnstileSiteKey &&
1137
+ h("div", { key: '1a9506c7a4cecf2598ba22c2508277bdc2b55fc5', class: "captcha-wrapper" }, h("slot", { key: 'db4a6364ba72d9f51e672f247661bf5134c91d86', name: CAPTCHA_CONTAINER_SLOT }))));
1129
1138
  }
1130
1139
  static get is() { return "general-registration"; }
1131
1140
  static get encapsulation() { return "shadow"; }
@@ -1509,6 +1518,27 @@ export class GeneralRegistration {
1509
1518
  "resolved": "string",
1510
1519
  "references": {}
1511
1520
  }
1521
+ }, {
1522
+ "method": "registrationConfigStatus",
1523
+ "name": "registrationConfigStatus",
1524
+ "bubbles": true,
1525
+ "cancelable": true,
1526
+ "composed": true,
1527
+ "docs": {
1528
+ "tags": [],
1529
+ "text": "Status of the registration configuration request."
1530
+ },
1531
+ "complexType": {
1532
+ "original": "RegistrationConfigStatus",
1533
+ "resolved": "RegistrationConfigStatus.Error | RegistrationConfigStatus.Loading | RegistrationConfigStatus.Success",
1534
+ "references": {
1535
+ "RegistrationConfigStatus": {
1536
+ "location": "import",
1537
+ "path": "../../utils/types",
1538
+ "id": "../../../../packages/stencil/general-registration/src/utils/types.ts::RegistrationConfigStatus"
1539
+ }
1540
+ }
1541
+ }
1512
1542
  }, {
1513
1543
  "method": "validationChange",
1514
1544
  "name": "validationChange",
@@ -11,3 +11,4 @@ function safeDecorator(fn) {
11
11
  }
12
12
  customElements.define = safeDecorator(customElements.define);
13
13
  export * from './components';
14
+ export { RegistrationConfigStatus } from './utils/types';
@@ -0,0 +1,6 @@
1
+ export var RegistrationConfigStatus;
2
+ (function (RegistrationConfigStatus) {
3
+ RegistrationConfigStatus["Loading"] = "Loading";
4
+ RegistrationConfigStatus["Success"] = "Success";
5
+ RegistrationConfigStatus["Error"] = "Error";
6
+ })(RegistrationConfigStatus || (RegistrationConfigStatus = {}));
@@ -1,4 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement, H as Host, f as forceUpdate } from './index-66ea2aae.js';
2
+ import { R as RegistrationConfigStatus } from './types-d6cd6856.js';
2
3
 
3
4
  const DEFAULT_LANGUAGE$1 = 'en';
4
5
  const TRANSLATIONS$1 = {
@@ -14795,6 +14796,7 @@ const GeneralRegistration = class {
14795
14796
  registerInstance(this, hostRef);
14796
14797
  this.registrationWidgetLoaded = createEvent(this, "registrationWidgetLoaded", 7);
14797
14798
  this.registrationStepUpdated = createEvent(this, "registrationStepUpdated", 7);
14799
+ this.registrationConfigStatus = createEvent(this, "registrationConfigStatus", 7);
14798
14800
  this.validationChange = createEvent(this, "validationChange", 7);
14799
14801
  this.isSelectingAddress = false;
14800
14802
  this.lastPostalCode = null;
@@ -15287,6 +15289,10 @@ const GeneralRegistration = class {
15287
15289
  });
15288
15290
  await this.captchaInstance.render(captchaContainerEl);
15289
15291
  }
15292
+ emitRegistrationConfigStatus(status) {
15293
+ this.registrationConfigStatus.emit(status);
15294
+ window.postMessage({ type: 'registrationConfigStatus', status }, window.location.href);
15295
+ }
15290
15296
  getRegisterConfig(registrationID) {
15291
15297
  const configPath = this.gmversion === 'gm2'
15292
15298
  ? '/api/pam/v2/legislation/register/config'
@@ -15304,6 +15310,7 @@ const GeneralRegistration = class {
15304
15310
  };
15305
15311
  return new Promise((resolve, reject) => {
15306
15312
  this.isLoading = true;
15313
+ this.emitRegistrationConfigStatus(RegistrationConfigStatus.Loading);
15307
15314
  fetch(url.href, options)
15308
15315
  .then((res) => {
15309
15316
  if (!res.ok) {
@@ -15319,11 +15326,14 @@ const GeneralRegistration = class {
15319
15326
  .then((config) => {
15320
15327
  this.isLoading = false;
15321
15328
  if (!config) {
15329
+ this.emitRegistrationConfigStatus(RegistrationConfigStatus.Error);
15322
15330
  return reject('Get register config is empty or has an error.');
15323
15331
  }
15332
+ this.emitRegistrationConfigStatus(RegistrationConfigStatus.Success);
15324
15333
  return resolve(config);
15325
15334
  }, (err) => {
15326
15335
  console.error('Get register config is empty or has an error: ', err);
15336
+ this.emitRegistrationConfigStatus(RegistrationConfigStatus.Error);
15327
15337
  return reject(err);
15328
15338
  }).finally(() => {
15329
15339
  this.isLoading = false;
@@ -15910,8 +15920,8 @@ const GeneralRegistration = class {
15910
15920
  const isLoading = this.isLoading && !this.registerErrors;
15911
15921
  const isError = !this.isLoading && this.registerErrors;
15912
15922
  const showForm = !(isLoading || isError);
15913
- return (h("div", { key: '53b15694dbc2a96e11d7f4063bcd6025c8e3c729', ref: (el) => (this.stylingContainer = el), class: `registration registration__${this.registrationStep}` }, isLoading && h("p", { key: 'd23e595780422a46e6b8b2f20d51444ba46e2c8d', class: `registration registration__loading-message` }, translate('loadingMessage', this.language)), isError && this.renderErrorMessage(this.errorMessage), showForm && this.renderForm(), showForm && !this.buttonInsideForm && this.renderButtons(), this.turnstileSiteKey &&
15914
- h("div", { key: '94a3b0a7a5f7afb770817364e4cc3fad3328a523', class: "captcha-wrapper" }, h("slot", { key: 'f4821bcc295105fdd15b72153822eed1989614b6', name: CAPTCHA_CONTAINER_SLOT }))));
15923
+ return (h("div", { key: '8bd2260523f0cc8c4cba59496dcc75e5a725cf27', ref: (el) => (this.stylingContainer = el), class: `registration registration__${this.registrationStep}` }, isLoading && h("p", { key: '5ab45acffbf827dd501fc069d3febb6b06876273', class: `registration registration__loading-message` }, translate('loadingMessage', this.language)), isError && this.renderErrorMessage(this.errorMessage), showForm && this.renderForm(), showForm && !this.buttonInsideForm && this.renderButtons(), this.turnstileSiteKey &&
15924
+ h("div", { key: '1a9506c7a4cecf2598ba22c2508277bdc2b55fc5', class: "captcha-wrapper" }, h("slot", { key: 'db4a6364ba72d9f51e672f247661bf5134c91d86', name: CAPTCHA_CONTAINER_SLOT }))));
15915
15925
  }
15916
15926
  get host() { return getElement(this); }
15917
15927
  static get watchers() { return {
package/dist/esm/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ export { R as RegistrationConfigStatus } from './types-d6cd6856.js';
2
+
1
3
  function safeDecorator(fn) {
2
4
  // eslint-disable-next-line func-names
3
5
  return function (...args) {
@@ -0,0 +1,8 @@
1
+ var RegistrationConfigStatus;
2
+ (function (RegistrationConfigStatus) {
3
+ RegistrationConfigStatus["Loading"] = "Loading";
4
+ RegistrationConfigStatus["Success"] = "Success";
5
+ RegistrationConfigStatus["Error"] = "Error";
6
+ })(RegistrationConfigStatus || (RegistrationConfigStatus = {}));
7
+
8
+ export { RegistrationConfigStatus as R };