@everymatrix/general-registration-otp-standalone 0.0.0-stage → 0.0.2

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 (58) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/checkbox-group-input_15.cjs.entry.js +15369 -0
  3. package/dist/cjs/general-registration-otp-standalone-597153d4.js +1409 -0
  4. package/dist/cjs/general-registration-otp-standalone.cjs.js +25 -0
  5. package/dist/cjs/index-b0fda18c.js +1324 -0
  6. package/dist/cjs/index.cjs.js +10 -0
  7. package/dist/cjs/loader.cjs.js +15 -0
  8. package/dist/collection/collection-manifest.json +32 -0
  9. package/dist/collection/components/general-registration-otp-standalone/general-registration-otp-standalone.css +32 -0
  10. package/dist/collection/components/general-registration-otp-standalone/general-registration-otp-standalone.js +473 -0
  11. package/dist/collection/components/general-registration-otp-standalone/index.js +1 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +1098 -0
  14. package/dist/collection/utils/utils.js +3 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/checkbox-group-input_15.entry.js +15352 -0
  17. package/dist/esm/general-registration-otp-standalone-f724cbe2.js +1403 -0
  18. package/dist/esm/general-registration-otp-standalone.js +20 -0
  19. package/dist/esm/index-5fadd4cf.js +1294 -0
  20. package/dist/esm/index.js +2 -0
  21. package/dist/esm/loader.js +11 -0
  22. package/dist/general-registration-otp-standalone/app-globals-0f993ce5.js +1 -0
  23. package/dist/general-registration-otp-standalone/checkbox-group-input_15.entry.js +6657 -0
  24. package/dist/general-registration-otp-standalone/general-registration-otp-standalone-f724cbe2.js +1 -0
  25. package/dist/general-registration-otp-standalone/general-registration-otp-standalone.esm.js +1 -0
  26. package/dist/general-registration-otp-standalone/index-5fadd4cf.js +2 -0
  27. package/dist/general-registration-otp-standalone/index.esm.js +1 -0
  28. package/dist/index.cjs.js +1 -0
  29. package/dist/index.js +1 -0
  30. package/dist/stencil.config.dev.js +19 -0
  31. package/dist/stencil.config.js +19 -0
  32. package/dist/storybook/main.js +43 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/packages/stencil/general-registration-otp-standalone/stencil.config.d.ts +2 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/packages/stencil/general-registration-otp-standalone/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/packages/stencil/general-registration-otp-standalone/storybook/main.d.ts +3 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/packages/stencil/general-registration-otp-standalone/storybook/preview.d.ts +70 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/tools/plugins/index.d.ts +4 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/general-registration-otp-standalone/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  44. package/dist/types/components/general-registration-otp-standalone/general-registration-otp-standalone.d.ts +56 -0
  45. package/dist/types/components/general-registration-otp-standalone/index.d.ts +1 -0
  46. package/dist/types/components.d.ts +157 -0
  47. package/dist/types/index.d.ts +1 -0
  48. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  49. package/dist/types/utils/locale.utils.d.ts +18 -0
  50. package/dist/types/utils/utils.d.ts +1 -0
  51. package/loader/cdn.js +1 -0
  52. package/loader/index.cjs.js +1 -0
  53. package/loader/index.d.ts +24 -0
  54. package/loader/index.es2017.js +1 -0
  55. package/loader/index.js +2 -0
  56. package/loader/package.json +11 -0
  57. package/package.json +24 -3
  58. package/README.md +0 -3
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const generalRegistrationOtpStandalone = require('./general-registration-otp-standalone-597153d4.js');
6
+ require('./index-b0fda18c.js');
7
+
8
+
9
+
10
+ exports.GeneralRegistrationOtpStandalone = generalRegistrationOtpStandalone.GeneralRegistrationOtpStandalone;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-b0fda18c.js');
6
+ const appGlobals = require('./app-globals-3a1e7e63.js');
7
+
8
+ const defineCustomElements = async (win, options) => {
9
+ if (typeof window === 'undefined') return undefined;
10
+ await appGlobals.globalScripts();
11
+ return index.bootstrapLazy(JSON.parse("[[\"checkbox-group-input_15.cjs\",[[1,\"general-registration-otp-standalone\",{\"endpoint\":[1],\"registrationId\":[1,\"registration-id\"],\"step\":[1],\"destination\":[1],\"language\":[1],\"translationUrl\":[1,\"translation-url\"],\"mbSource\":[1,\"mb-source\"],\"gmversion\":[1],\"otpLength\":[2,\"otp-length\"],\"otpFieldName\":[1,\"otp-field-name\"],\"resendIntervalSeconds\":[2,\"resend-interval-seconds\"],\"startCountDown\":[4,\"start-count-down\"],\"pinAttemptsExceeded\":[4,\"pin-attempts-exceeded\"],\"clientStyling\":[1,\"client-styling\"],\"clientStylingUrl\":[1,\"client-styling-url\"],\"isSubmitting\":[32],\"errorMessage\":[32],\"isOtpValid\":[32]},[[0,\"sendValidityState\",\"handleValidity\"],[0,\"resendCode\",\"handleResend\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"clientStylingUrl\":[\"handleClientStylingUrlChange\"],\"mbSource\":[\"handleMbSourceChange\"]}],[1,\"general-input\",{\"type\":[513],\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"action\":[513],\"validation\":[16],\"options\":[520],\"language\":[513],\"autofilled\":[516],\"tooltip\":[513],\"defaultValue\":[520,\"default-value\"],\"emitValue\":[516,\"emit-value\"],\"isDuplicateInput\":[516,\"is-duplicate-input\"],\"hidePasswordComplexity\":[516,\"hide-password-complexity\"],\"noValidation\":[516,\"no-validation\"],\"clientStyling\":[520,\"client-styling\"],\"clientStylingUrl\":[513,\"client-styling-url\"],\"dateFormat\":[513,\"date-format\"],\"translationUrl\":[513,\"translation-url\"],\"emitOnClick\":[516,\"emit-on-click\"],\"twofaDestination\":[513,\"twofa-destination\"],\"twofaResendIntervalSeconds\":[514,\"twofa-resend-interval-seconds\"],\"twofaStartCountDown\":[516,\"twofa-start-count-down\"],\"haspostalcodelookup\":[516],\"postalcodelength\":[514],\"addresses\":[520],\"ignoreCountry\":[516,\"ignore-country\"],\"enableSouthAfricanMode\":[516,\"enable-south-african-mode\"],\"enableManualDateInput\":[516,\"enable-manual-date-input\"],\"pinAttemptsExceeded\":[516,\"pin-attempts-exceeded\"],\"mbSource\":[513,\"mb-source\"],\"enableCustomRegexValidation\":[516,\"enable-custom-regex-validation\"]},null,{\"clientStyling\":[\"handleClientStylingChange\"],\"clientStylingUrl\":[\"handleClientStylingChangeURL\"]}],[1,\"toggle-checkbox-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"defaultValue\":[513,\"default-value\"],\"options\":[16],\"autofilled\":[516],\"tooltip\":[513],\"validation\":[16],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"mbSource\":[513,\"mb-source\"],\"translationUrl\":[513,\"translation-url\"],\"errorMessage\":[32],\"isValid\":[32],\"showTooltip\":[32],\"showFields\":[32]},[[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"]}],[1,\"checkbox-group-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"options\":[16],\"validation\":[16],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"mbSource\":[513,\"mb-source\"],\"errorMessage\":[32],\"isValid\":[32],\"showTooltip\":[32],\"selectedValues\":[32],\"showCheckboxes\":[32]},[[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"selectedValues\":[\"setValue\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"checkbox-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"validation\":[16],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"mbSource\":[513,\"mb-source\"],\"errorMessage\":[32],\"isValid\":[32],\"showTooltip\":[32]},[[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"date-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"validation\":[16],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"dateFormat\":[513,\"date-format\"],\"emitOnClick\":[516,\"emit-on-click\"],\"enableSouthAfricanMode\":[516,\"enable-south-african-mode\"],\"enableManualDateInput\":[516,\"enable-manual-date-input\"],\"mbSource\":[513,\"mb-source\"],\"errorMessage\":[32],\"isValid\":[32],\"showTooltip\":[32]},[[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"],\"enableSouthAfricanMode\":[\"handleCustomRegistrationChange\"]}],[1,\"email-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"validation\":[16],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"isDuplicateInput\":[516,\"is-duplicate-input\"],\"clientStyling\":[513,\"client-styling\"],\"mbSource\":[513,\"mb-source\"],\"errorMessage\":[32],\"isValid\":[32],\"showTooltip\":[32]},[[10,\"click\",\"handleClickOutside\"],[16,\"sendInputValue\",\"valueChangedHandler\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"number-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"validation\":[16],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"mbSource\":[513,\"mb-source\"],\"errorMessage\":[32],\"isValid\":[32],\"showTooltip\":[32]},[[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"password-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"validation\":[16],\"noValidation\":[516,\"no-validation\"],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"isDuplicateInput\":[516,\"is-duplicate-input\"],\"hidePasswordComplexity\":[516,\"hide-password-complexity\"],\"clientStyling\":[513,\"client-styling\"],\"enableSouthAfricanMode\":[516,\"enable-south-african-mode\"],\"mbSource\":[513,\"mb-source\"],\"isValid\":[32],\"errorMessage\":[32],\"showTooltip\":[32],\"passwordComplexity\":[32],\"showPopup\":[32],\"value\":[32]},[[16,\"sendOriginalValidityState\",\"originalValidityChangedHandler\"],[16,\"sendInputValue\",\"valueChangedHandler\"],[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"value\":[\"valueChanged\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"postalcode-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"validation\":[16],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"postalcodelength\":[520],\"addresses\":[520],\"ignoreCountry\":[516,\"ignore-country\"],\"mbSource\":[513,\"mb-source\"],\"isValid\":[32],\"errorMessage\":[32],\"showTooltip\":[32],\"selectedCountryCode\":[32],\"currentPostalCode\":[32],\"openAddressDropdown\":[32],\"showNoResultsMessage\":[32],\"refreshTrigger\":[32],\"isFetchingAddresses\":[32]},[[10,\"click\",\"handleClickOutside\"],[8,\"countryCodeUpdated\",\"handleCountryCodeUpdate\"],[8,\"addressFetchStarted\",\"handleFetchStarted\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"],\"addresses\":[\"handleAddresses\"]}],[1,\"radio-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"optionsGroup\":[16],\"validation\":[16],\"tooltip\":[513],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"mbSource\":[513,\"mb-source\"],\"errorMessage\":[32],\"isValid\":[32],\"showTooltip\":[32]},[[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"select-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"action\":[513],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"options\":[16],\"validation\":[16],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"mbSource\":[513,\"mb-source\"],\"errorMessage\":[32],\"isValid\":[32],\"showTooltip\":[32]},[[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"tel-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"showLabels\":[516,\"show-labels\"],\"action\":[513],\"validation\":[16],\"defaultValue\":[520,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"clientStyling\":[513,\"client-styling\"],\"mbSource\":[513,\"mb-source\"],\"enableCustomRegexValidation\":[516,\"enable-custom-regex-validation\"],\"isValid\":[32],\"errorMessage\":[32],\"showTooltip\":[32],\"disablePhonePrefix\":[32],\"phoneValue\":[32],\"phoneCodesOptions\":[32]},[[10,\"click\",\"handleClickOutside\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"text-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"validation\":[16],\"defaultValue\":[513,\"default-value\"],\"autofilled\":[516],\"tooltip\":[513],\"language\":[513],\"checkValidity\":[516,\"check-validity\"],\"emitValue\":[516,\"emit-value\"],\"isDuplicateInput\":[516,\"is-duplicate-input\"],\"clientStyling\":[513,\"client-styling\"],\"haspostalcodelookup\":[516],\"enableSouthAfricanMode\":[516,\"enable-south-african-mode\"],\"mbSource\":[513,\"mb-source\"],\"isValid\":[32],\"errorMessage\":[32],\"showTooltip\":[32],\"selectedCountryCode\":[32]},[[10,\"click\",\"handleClickOutside\"],[16,\"sendInputValue\",\"valueChangedHandler\"],[16,\"validationChange\",\"handleValidationChange\"],[8,\"countryCodeUpdated\",\"handleCountryCodeUpdate\"],[16,\"sendAddressValue\",\"handleAddressSelection\"],[8,\"documentNumberUpdatedExternally\",\"handleExternalDocUpdate\"],[8,\"documentNumberResetValidation\",\"handleDocReset\"]],{\"clientStyling\":[\"handleClientStylingChange\"],\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"]}],[1,\"twofa-input\",{\"name\":[513],\"displayName\":[513,\"display-name\"],\"placeholder\":[513],\"validation\":[16],\"tooltip\":[513],\"language\":[513],\"emitValue\":[516,\"emit-value\"],\"destination\":[513],\"resendIntervalSeconds\":[514,\"resend-interval-seconds\"],\"clientStyling\":[513,\"client-styling\"],\"enableSouthAfricanMode\":[516,\"enable-south-african-mode\"],\"pinAttemptsExceeded\":[516,\"pin-attempts-exceeded\"],\"clientStylingUrl\":[513,\"client-styling-url\"],\"mbSource\":[513,\"mb-source\"],\"startCountDown\":[516,\"start-count-down\"],\"isValid\":[32],\"isResendButtonAvailable\":[32],\"showTooltip\":[32],\"errorMessage\":[32],\"code\":[32],\"resendIntervalSecondsLeft\":[32],\"revealedIndexes\":[32],\"getOtpValue\":[64]},[[10,\"click\",\"handleClickOutside\"]],{\"isValid\":[\"validityChanged\"],\"emitValue\":[\"emitValueHandler\"],\"clientStyling\":[\"handleClientStylingChange\"],\"clientStylingUrl\":[\"handleClientStylingChangeURL\"]}]]]]"), options);
12
+ };
13
+
14
+ exports.setNonce = index.setNonce;
15
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,32 @@
1
+ {
2
+ "entries": [
3
+ "components/general-registration-otp-standalone/general-registration-otp-standalone.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "4.19.2",
8
+ "typescriptVersion": "5.4.5"
9
+ },
10
+ "collections": [
11
+ {
12
+ "name": "@everymatrix/general-input",
13
+ "tags": [
14
+ "checkbox-group-input",
15
+ "checkbox-input",
16
+ "date-input",
17
+ "email-input",
18
+ "general-input",
19
+ "number-input",
20
+ "password-input",
21
+ "postalcode-input",
22
+ "radio-input",
23
+ "select-input",
24
+ "tel-input",
25
+ "text-input",
26
+ "toggle-checkbox-input",
27
+ "twofa-input"
28
+ ]
29
+ }
30
+ ],
31
+ "bundles": []
32
+ }
@@ -0,0 +1,32 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .registration-otp__form {
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: 1rem;
9
+ }
10
+
11
+ .registration-otp__submit {
12
+ border-radius: 5px;
13
+ background: var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));
14
+ border: 1px solid var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));
15
+ color: var(--emw--button-typography, var(--emw--color-white, #FFFFFF));
16
+ text-transform: uppercase;
17
+ font-size: 20px;
18
+ height: 44px;
19
+ width: 100%;
20
+ padding: 10px 20px;
21
+ cursor: pointer;
22
+ }
23
+
24
+ .registration-otp__submit:disabled {
25
+ background: var(--emw--color-gray-100, #E6E6E6);
26
+ border-color: var(--emw--color-gray-150, #828282);
27
+ cursor: default;
28
+ }
29
+
30
+ .registration-otp__error {
31
+ color: var(--emw--color-error, #c00);
32
+ }
@@ -0,0 +1,473 @@
1
+ import { forceUpdate, h } from "@stencil/core";
2
+ import { getStreamTranslations } from "../../../../../../../../libs/common/src/i18n/index";
3
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
4
+ import { getTranslations, setTranslation, translate } from "../../utils/locale.utils";
5
+ import "../../../../../general-input/dist/types/index";
6
+ export class GeneralRegistrationOtpStandalone {
7
+ constructor() {
8
+ this.endpoint = undefined;
9
+ this.registrationId = undefined;
10
+ this.step = undefined;
11
+ this.destination = undefined;
12
+ this.language = 'en';
13
+ this.translationUrl = '';
14
+ this.mbSource = undefined;
15
+ this.gmversion = '';
16
+ this.otpLength = 6;
17
+ this.otpFieldName = 'ValidateSMS';
18
+ this.resendIntervalSeconds = 60;
19
+ this.startCountDown = true;
20
+ this.pinAttemptsExceeded = false;
21
+ this.clientStyling = undefined;
22
+ this.clientStylingUrl = undefined;
23
+ this.isSubmitting = false;
24
+ this.errorMessage = '';
25
+ this.isOtpValid = false;
26
+ }
27
+ handleClientStylingChange(newValue, oldValue) {
28
+ if (newValue !== oldValue)
29
+ setClientStyling(this.stylingContainer, newValue);
30
+ }
31
+ handleClientStylingUrlChange(newValue, oldValue) {
32
+ if (newValue !== oldValue)
33
+ setClientStylingURL(this.stylingContainer, newValue);
34
+ }
35
+ handleMbSourceChange(newValue, oldValue) {
36
+ if (newValue !== oldValue) {
37
+ if (this.stylingSubscription)
38
+ this.stylingSubscription.unsubscribe();
39
+ this.stylingSubscription = newValue
40
+ ? setStreamStyling(this.stylingContainer, `${newValue}.Style`, this.stylingSubscription)
41
+ : undefined;
42
+ }
43
+ }
44
+ componentDidLoad() {
45
+ this.handleClientTranslations();
46
+ if (this.mbSource)
47
+ this.stylingSubscription = setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
48
+ if (this.clientStyling)
49
+ setClientStyling(this.stylingContainer, this.clientStyling);
50
+ if (this.clientStylingUrl)
51
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
52
+ }
53
+ disconnectedCallback() {
54
+ var _a;
55
+ (_a = this.translationSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
56
+ if (this.stylingSubscription) {
57
+ this.stylingSubscription.unsubscribe();
58
+ }
59
+ }
60
+ handleClientTranslations() {
61
+ if (this.translationUrl) {
62
+ getTranslations(this.translationUrl).then(() => forceUpdate(this.host)).catch(error => console.error('Failed to fetch translations:', error));
63
+ }
64
+ else if (this.mbSource) {
65
+ this.translationSubscription = getStreamTranslations(`${this.mbSource}.Translation`, this.translationSubscription, data => {
66
+ if (!data || typeof data !== 'object')
67
+ return;
68
+ setTranslation(data);
69
+ forceUpdate(this.host);
70
+ });
71
+ }
72
+ }
73
+ handleValidity(event) {
74
+ if (event.detail.name === this.otpFieldName)
75
+ this.isOtpValid = event.detail.valid;
76
+ }
77
+ async handleResend() {
78
+ if (!this.endpoint || !this.destination) {
79
+ this.errorMessage = 'A phone number and endpoint are required to resend the code.';
80
+ return;
81
+ }
82
+ try {
83
+ await this.request('/api/v1/gm/legislation/twoFaCode/', 'POST', {
84
+ channel: 'Sms', destination: this.destination
85
+ }, 'application/problem+json; charset=utf-8');
86
+ this.errorMessage = '';
87
+ }
88
+ catch (error) {
89
+ this.errorMessage = this.getErrorMessage(error);
90
+ }
91
+ }
92
+ getErrorMessage(error) {
93
+ var _a, _b;
94
+ const code = (_a = error === null || error === void 0 ? void 0 : error.thirdPartyResponse) === null || _a === void 0 ? void 0 : _a.errorCode;
95
+ return (code && translate(code, this.language)) || ((_b = error === null || error === void 0 ? void 0 : error.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message) || (error === null || error === void 0 ? void 0 : error.message) || translate('generalError', this.language);
96
+ }
97
+ async request(path, method, body, contentType = 'application/json') {
98
+ const response = await fetch(new URL(`${this.endpoint}${path}`).href, {
99
+ method,
100
+ headers: { 'Content-Type': contentType, Accept: 'application/json' },
101
+ body: JSON.stringify(body)
102
+ });
103
+ const text = await response.text();
104
+ const data = text ? JSON.parse(text) : {};
105
+ if (!response.ok)
106
+ throw data;
107
+ return data;
108
+ }
109
+ async getCurrentOtp() {
110
+ var _a, _b;
111
+ const input = (_a = this.stylingContainer) === null || _a === void 0 ? void 0 : _a.querySelector('general-input');
112
+ const twofa = (_b = input === null || input === void 0 ? void 0 : input.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('twofa-input');
113
+ if (!twofa || typeof twofa.getOtpValue !== 'function') {
114
+ throw new Error('OTP input is unavailable. Please update general-input and try again.');
115
+ }
116
+ return twofa.getOtpValue();
117
+ }
118
+ async handleSubmit(event) {
119
+ event.preventDefault();
120
+ if (this.isSubmitting || !this.isOtpValid)
121
+ return;
122
+ if (!this.endpoint || !this.registrationId || !this.step) {
123
+ this.errorMessage = 'Registration details are missing.';
124
+ return;
125
+ }
126
+ this.isSubmitting = true;
127
+ this.errorMessage = '';
128
+ try {
129
+ const otp = await this.getCurrentOtp();
130
+ if (otp.length !== this.otpLength)
131
+ return;
132
+ window.postMessage({ type: 'SubmitRegister' }, window.location.href);
133
+ const isGm2 = this.gmversion === 'gm2';
134
+ const stepPath = isGm2 ? '/api/pam/v2/legislation/register/step' : '/v1/player/legislation/registration/step/';
135
+ const stepResult = await this.request(stepPath, 'POST', {
136
+ registrationId: this.registrationId,
137
+ registerUserDto: { [this.otpFieldName]: otp },
138
+ step: this.step
139
+ });
140
+ if (!stepResult.registrationId)
141
+ throw new Error('Registration ID is missing from the step response.');
142
+ const registerPath = isGm2 ? '/api/pam/v2/legislation/register' : '/v1/player/legislation/register/';
143
+ const result = await this.request(registerPath, isGm2 ? 'POST' : 'PUT', {
144
+ registrationId: stepResult.registrationId
145
+ });
146
+ window.postMessage({ type: 'registrationSuccessful', userId: result === null || result === void 0 ? void 0 : result.userId, extraActions: [] }, window.location.href);
147
+ }
148
+ catch (error) {
149
+ this.errorMessage = this.getErrorMessage(error);
150
+ window.postMessage({ type: 'registrationFailed', errorMessage: this.errorMessage }, window.location.href);
151
+ }
152
+ finally {
153
+ this.isSubmitting = false;
154
+ }
155
+ }
156
+ render() {
157
+ return (h("div", { key: '28793fb63e99cffcc3db3da99f3594987114f276', class: "registration-otp", ref: el => (this.stylingContainer = el) }, h("form", { key: '737bfd076f32e84b67271a1473d5f0dc52b6043b', class: "registration-otp__form", onSubmit: event => this.handleSubmit(event) }, h("general-input", { key: '46685ab2b974e02bc60f97a6863680afe835326a', type: "twofa", name: this.otpFieldName, validation: { mandatory: true, maxLength: this.otpLength }, emitValue: true, language: this.language, translationUrl: this.translationUrl, mbSource: this.mbSource, clientStyling: this.clientStyling, clientStylingUrl: this.clientStylingUrl, twofaDestination: this.destination, twofaResendIntervalSeconds: this.resendIntervalSeconds, twofaStartCountDown: this.startCountDown, pinAttemptsExceeded: this.pinAttemptsExceeded }), this.errorMessage && h("div", { key: 'dfcadb1ca92b303f810ce9bd608da7787dd803dd', class: "registration-otp__error", role: "alert" }, this.errorMessage), h("button", { key: '1d850e57e3d507a967255d497f05d3c4831912c0', class: "registration-otp__submit", type: "submit", disabled: this.isSubmitting || !this.isOtpValid }, translate('doneButton', this.language)))));
158
+ }
159
+ static get is() { return "general-registration-otp-standalone"; }
160
+ static get encapsulation() { return "shadow"; }
161
+ static get originalStyleUrls() {
162
+ return {
163
+ "$": ["general-registration-otp-standalone.scss"]
164
+ };
165
+ }
166
+ static get styleUrls() {
167
+ return {
168
+ "$": ["general-registration-otp-standalone.css"]
169
+ };
170
+ }
171
+ static get properties() {
172
+ return {
173
+ "endpoint": {
174
+ "type": "string",
175
+ "mutable": false,
176
+ "complexType": {
177
+ "original": "string",
178
+ "resolved": "string",
179
+ "references": {}
180
+ },
181
+ "required": false,
182
+ "optional": false,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": "API endpoint."
186
+ },
187
+ "attribute": "endpoint",
188
+ "reflect": false
189
+ },
190
+ "registrationId": {
191
+ "type": "string",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "string",
195
+ "resolved": "string",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": "Registration identifier from the previous step."
203
+ },
204
+ "attribute": "registration-id",
205
+ "reflect": false
206
+ },
207
+ "step": {
208
+ "type": "string",
209
+ "mutable": false,
210
+ "complexType": {
211
+ "original": "string",
212
+ "resolved": "string",
213
+ "references": {}
214
+ },
215
+ "required": false,
216
+ "optional": false,
217
+ "docs": {
218
+ "tags": [],
219
+ "text": "Registration step to submit."
220
+ },
221
+ "attribute": "step",
222
+ "reflect": false
223
+ },
224
+ "destination": {
225
+ "type": "string",
226
+ "mutable": false,
227
+ "complexType": {
228
+ "original": "string",
229
+ "resolved": "string",
230
+ "references": {}
231
+ },
232
+ "required": false,
233
+ "optional": false,
234
+ "docs": {
235
+ "tags": [],
236
+ "text": "Phone number to which the verification code is sent."
237
+ },
238
+ "attribute": "destination",
239
+ "reflect": false
240
+ },
241
+ "language": {
242
+ "type": "string",
243
+ "mutable": false,
244
+ "complexType": {
245
+ "original": "string",
246
+ "resolved": "string",
247
+ "references": {}
248
+ },
249
+ "required": false,
250
+ "optional": false,
251
+ "docs": {
252
+ "tags": [],
253
+ "text": "Selected language."
254
+ },
255
+ "attribute": "language",
256
+ "reflect": false,
257
+ "defaultValue": "'en'"
258
+ },
259
+ "translationUrl": {
260
+ "type": "string",
261
+ "mutable": false,
262
+ "complexType": {
263
+ "original": "string",
264
+ "resolved": "string",
265
+ "references": {}
266
+ },
267
+ "required": false,
268
+ "optional": false,
269
+ "docs": {
270
+ "tags": [],
271
+ "text": "Translations via URL."
272
+ },
273
+ "attribute": "translation-url",
274
+ "reflect": false,
275
+ "defaultValue": "''"
276
+ },
277
+ "mbSource": {
278
+ "type": "string",
279
+ "mutable": false,
280
+ "complexType": {
281
+ "original": "string",
282
+ "resolved": "string",
283
+ "references": {}
284
+ },
285
+ "required": false,
286
+ "optional": false,
287
+ "docs": {
288
+ "tags": [],
289
+ "text": "Message bus source for styling and translations."
290
+ },
291
+ "attribute": "mb-source",
292
+ "reflect": false
293
+ },
294
+ "gmversion": {
295
+ "type": "string",
296
+ "mutable": false,
297
+ "complexType": {
298
+ "original": "string",
299
+ "resolved": "string",
300
+ "references": {}
301
+ },
302
+ "required": false,
303
+ "optional": false,
304
+ "docs": {
305
+ "tags": [],
306
+ "text": "GM API version; use gm2 for the GM2 endpoints."
307
+ },
308
+ "attribute": "gmversion",
309
+ "reflect": false,
310
+ "defaultValue": "''"
311
+ },
312
+ "otpLength": {
313
+ "type": "number",
314
+ "mutable": false,
315
+ "complexType": {
316
+ "original": "number",
317
+ "resolved": "number",
318
+ "references": {}
319
+ },
320
+ "required": false,
321
+ "optional": false,
322
+ "docs": {
323
+ "tags": [],
324
+ "text": "Number of OTP digits."
325
+ },
326
+ "attribute": "otp-length",
327
+ "reflect": false,
328
+ "defaultValue": "6"
329
+ },
330
+ "otpFieldName": {
331
+ "type": "string",
332
+ "mutable": false,
333
+ "complexType": {
334
+ "original": "string",
335
+ "resolved": "string",
336
+ "references": {}
337
+ },
338
+ "required": false,
339
+ "optional": false,
340
+ "docs": {
341
+ "tags": [],
342
+ "text": "Name of the OTP field in the registration request."
343
+ },
344
+ "attribute": "otp-field-name",
345
+ "reflect": false,
346
+ "defaultValue": "'ValidateSMS'"
347
+ },
348
+ "resendIntervalSeconds": {
349
+ "type": "number",
350
+ "mutable": false,
351
+ "complexType": {
352
+ "original": "number",
353
+ "resolved": "number",
354
+ "references": {}
355
+ },
356
+ "required": false,
357
+ "optional": false,
358
+ "docs": {
359
+ "tags": [],
360
+ "text": "Resend countdown in seconds."
361
+ },
362
+ "attribute": "resend-interval-seconds",
363
+ "reflect": false,
364
+ "defaultValue": "60"
365
+ },
366
+ "startCountDown": {
367
+ "type": "boolean",
368
+ "mutable": false,
369
+ "complexType": {
370
+ "original": "boolean",
371
+ "resolved": "boolean",
372
+ "references": {}
373
+ },
374
+ "required": false,
375
+ "optional": false,
376
+ "docs": {
377
+ "tags": [],
378
+ "text": "Start the resend countdown when the widget loads."
379
+ },
380
+ "attribute": "start-count-down",
381
+ "reflect": false,
382
+ "defaultValue": "true"
383
+ },
384
+ "pinAttemptsExceeded": {
385
+ "type": "boolean",
386
+ "mutable": false,
387
+ "complexType": {
388
+ "original": "boolean",
389
+ "resolved": "boolean",
390
+ "references": {}
391
+ },
392
+ "required": false,
393
+ "optional": false,
394
+ "docs": {
395
+ "tags": [],
396
+ "text": "Disable resending after the maximum number of PIN attempts."
397
+ },
398
+ "attribute": "pin-attempts-exceeded",
399
+ "reflect": false,
400
+ "defaultValue": "false"
401
+ },
402
+ "clientStyling": {
403
+ "type": "string",
404
+ "mutable": false,
405
+ "complexType": {
406
+ "original": "string",
407
+ "resolved": "string",
408
+ "references": {}
409
+ },
410
+ "required": false,
411
+ "optional": false,
412
+ "docs": {
413
+ "tags": [],
414
+ "text": "Client custom styling via inline styles."
415
+ },
416
+ "attribute": "client-styling",
417
+ "reflect": false
418
+ },
419
+ "clientStylingUrl": {
420
+ "type": "string",
421
+ "mutable": false,
422
+ "complexType": {
423
+ "original": "string",
424
+ "resolved": "string",
425
+ "references": {}
426
+ },
427
+ "required": false,
428
+ "optional": false,
429
+ "docs": {
430
+ "tags": [],
431
+ "text": "Client custom styling via URL."
432
+ },
433
+ "attribute": "client-styling-url",
434
+ "reflect": false
435
+ }
436
+ };
437
+ }
438
+ static get states() {
439
+ return {
440
+ "isSubmitting": {},
441
+ "errorMessage": {},
442
+ "isOtpValid": {}
443
+ };
444
+ }
445
+ static get elementRef() { return "host"; }
446
+ static get watchers() {
447
+ return [{
448
+ "propName": "clientStyling",
449
+ "methodName": "handleClientStylingChange"
450
+ }, {
451
+ "propName": "clientStylingUrl",
452
+ "methodName": "handleClientStylingUrlChange"
453
+ }, {
454
+ "propName": "mbSource",
455
+ "methodName": "handleMbSourceChange"
456
+ }];
457
+ }
458
+ static get listeners() {
459
+ return [{
460
+ "name": "sendValidityState",
461
+ "method": "handleValidity",
462
+ "target": undefined,
463
+ "capture": false,
464
+ "passive": false
465
+ }, {
466
+ "name": "resendCode",
467
+ "method": "handleResend",
468
+ "target": undefined,
469
+ "capture": false,
470
+ "passive": false
471
+ }];
472
+ }
473
+ }
@@ -0,0 +1 @@
1
+ export { GeneralRegistrationOtpStandalone } from './general-registration-otp-standalone';
@@ -0,0 +1 @@
1
+ export * from './components/general-registration-otp-standalone';