@saasquatch/mint-components 1.13.5 → 1.14.0-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.
- package/dist/cjs/{ShadowViewAddon-14a02da4.js → AutoColor-3b59126f.js} +1137 -1137
- package/dist/cjs/ErrorView-b2fcf954.js +35 -0
- package/dist/cjs/IndirectTaxDetailsView-409dae6f.js +646 -0
- package/dist/cjs/data-6d96b89c.js +137 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/parseStates-d1effc19.js +16 -0
- package/dist/cjs/{sqm-banking-info-form_17.cjs.entry.js → sqm-banking-info-form_10.cjs.entry.js} +209 -1885
- package/dist/cjs/sqm-big-stat_41.cjs.entry.js +30 -30
- package/dist/cjs/sqm-code-verification.cjs.entry.js +349 -0
- package/dist/cjs/sqm-invoice-table-data-cell_5.cjs.entry.js +84 -0
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +13619 -12323
- package/dist/cjs/sqm-tax-and-cash.cjs.entry.js +1221 -0
- package/dist/cjs/sqm-widget-verification-controller.cjs.entry.js +11 -3
- package/dist/cjs/sqm-widget-verification.cjs.entry.js +17 -6
- package/dist/cjs/utils-8257e7ab.js +105 -0
- package/dist/collection/components/sqm-pagination/sqm-pagination.js +1 -1
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +78 -78
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.js +37 -3
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-controller.js +39 -5
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +41 -6
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +12 -8
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form-view.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/useDocusignForm.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card.js +26 -1
- package/dist/collection/components/tax-and-cash/sqm-payout-details-card/usePayoutDetailsCard.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +77 -28
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +62 -3
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +3 -3
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +5 -4
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +49 -11
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +3 -3
- package/dist/collection/utils/parseStates.js +12 -0
- package/dist/esm/{ShadowViewAddon-23a6afab.js → AutoColor-d8d7f31d.js} +1141 -1141
- package/dist/esm/ErrorView-48e2b969.js +33 -0
- package/dist/esm/IndirectTaxDetailsView-c321099a.js +639 -0
- package/dist/esm/data-a05c78ae.js +121 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/parseStates-ed75e224.js +14 -0
- package/dist/esm/{sqm-banking-info-form_17.entry.js → sqm-banking-info-form_10.entry.js} +133 -1802
- package/dist/esm/sqm-big-stat_41.entry.js +1 -1
- package/dist/esm/sqm-code-verification.entry.js +345 -0
- package/dist/esm/sqm-invoice-table-data-cell_5.entry.js +76 -0
- package/dist/esm/sqm-stencilbook.entry.js +10610 -9314
- package/dist/esm/sqm-tax-and-cash.entry.js +1217 -0
- package/dist/esm/sqm-widget-verification-controller.entry.js +12 -4
- package/dist/esm/sqm-widget-verification.entry.js +17 -6
- package/dist/esm/utils-7c96856c.js +97 -0
- package/dist/esm-es5/AutoColor-d8d7f31d.js +1 -0
- package/dist/esm-es5/ErrorView-48e2b969.js +1 -0
- package/dist/esm-es5/IndirectTaxDetailsView-c321099a.js +1 -0
- package/dist/esm-es5/data-a05c78ae.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/parseStates-ed75e224.js +1 -0
- package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -0
- package/dist/esm-es5/sqm-big-stat_41.entry.js +1 -1
- package/dist/esm-es5/sqm-code-verification.entry.js +1 -0
- package/dist/esm-es5/sqm-invoice-table-data-cell_5.entry.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-tax-and-cash.entry.js +1 -0
- package/dist/esm-es5/sqm-widget-verification-controller.entry.js +1 -1
- package/dist/esm-es5/sqm-widget-verification.entry.js +1 -1
- package/dist/esm-es5/utils-7c96856c.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-0603a39f.js +1 -0
- package/dist/mint-components/p-0a37a288.system.entry.js +1 -0
- package/dist/mint-components/p-0b8f6a39.entry.js +11 -0
- package/dist/mint-components/p-115dfc03.system.js +1 -0
- package/dist/mint-components/p-13f3a647.js +1 -0
- package/dist/mint-components/p-1a7453c6.system.js +1 -0
- package/dist/mint-components/p-33d79be3.entry.js +93 -0
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-3a62a7e2.system.js +1 -0
- package/dist/mint-components/p-4a46897f.system.js +1 -0
- package/dist/mint-components/p-4d11920f.entry.js +1 -0
- package/dist/mint-components/p-5510be1e.system.entry.js +1 -0
- package/dist/mint-components/p-6ef506ba.entry.js +16 -0
- package/dist/mint-components/{p-33ed6f1c.system.entry.js → p-70adcf4f.system.entry.js} +1 -1
- package/dist/mint-components/p-70d3d873.system.entry.js +1 -0
- package/dist/mint-components/p-7e0bf3de.system.entry.js +1 -0
- package/dist/mint-components/p-83acd617.js +1 -0
- package/dist/mint-components/p-84a78d09.entry.js +1 -0
- package/dist/mint-components/{p-01010af0.entry.js → p-84ed9923.entry.js} +5 -5
- package/dist/mint-components/p-889ec1df.system.entry.js +1 -0
- package/dist/mint-components/p-8a784f2a.system.entry.js +1 -0
- package/dist/mint-components/p-93e4a3c3.system.js +1 -0
- package/dist/mint-components/p-98a48fc4.system.entry.js +1 -0
- package/dist/mint-components/p-9acb5038.js +1 -0
- package/dist/mint-components/p-a38ca165.entry.js +9 -0
- package/dist/mint-components/p-c75a3b4a.js +103 -0
- package/dist/mint-components/p-d75c462c.entry.js +1 -0
- package/dist/mint-components/p-ea7f379d.js +394 -0
- package/dist/mint-components/p-f8175201.system.js +1 -0
- package/dist/types/components/sqm-pagination/sqm-pagination.d.ts +1 -1
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.d.ts +6 -0
- package/dist/types/components/sqm-widget-verification/sqm-widget-verification-controller.d.ts +5 -0
- package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +5 -0
- package/dist/types/components/tax-and-cash/TaxForm.stories.d.ts +0 -1
- package/dist/types/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form-view.d.ts +1 -1
- package/dist/types/components/tax-and-cash/sqm-docusign-form/useDocusignForm.d.ts +2 -2
- package/dist/types/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card.d.ts +4 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +1 -1
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +10 -4
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.d.ts +1 -1
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +1 -1
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +10 -0
- package/dist/types/components/tax-and-cash/sqm-user-info-form/small-views/IndirectTaxDetailsView.d.ts +1 -1
- package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.d.ts +7 -0
- package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +1 -1
- package/dist/types/components/tax-and-cash/utils.d.ts +1 -1
- package/dist/types/components.d.ts +96 -7
- package/dist/types/utils/parseStates.d.ts +1 -0
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +2 -1
- package/dist/cjs/sqm-invoice-table-view-baded4af.js +0 -2067
- package/dist/esm/sqm-invoice-table-view-af69cd33.js +0 -2050
- package/dist/esm-es5/ShadowViewAddon-23a6afab.js +0 -1
- package/dist/esm-es5/sqm-banking-info-form_17.entry.js +0 -1
- package/dist/esm-es5/sqm-invoice-table-view-af69cd33.js +0 -1
- package/dist/mint-components/p-23ed5e6f.entry.js +0 -205
- package/dist/mint-components/p-33c96e14.entry.js +0 -16
- package/dist/mint-components/p-6427e963.entry.js +0 -1
- package/dist/mint-components/p-7e7cbccf.system.js +0 -1
- package/dist/mint-components/p-8da00a59.system.entry.js +0 -1
- package/dist/mint-components/p-8f8245da.system.entry.js +0 -1
- package/dist/mint-components/p-9320582e.system.js +0 -1
- package/dist/mint-components/p-962f3200.js +0 -1
- package/dist/mint-components/p-9cf80e85.system.entry.js +0 -1
- package/dist/mint-components/p-ba9b5b20.entry.js +0 -9
- package/dist/mint-components/p-c36506f6.system.entry.js +0 -1
- package/dist/mint-components/p-d3d74266.js +0 -394
- /package/dist/collection/components/tax-and-cash/{sqm-tax-and-cash/data.js → data.js} +0 -0
- /package/dist/types/components/tax-and-cash/{sqm-tax-and-cash/data.d.ts → data.d.ts} +0 -0
|
@@ -37,18 +37,26 @@ function useTemplateChildren({ parent, callback }) {
|
|
|
37
37
|
const WidgetVerificationController = class {
|
|
38
38
|
constructor(hostRef) {
|
|
39
39
|
index.registerInstance(this, hostRef);
|
|
40
|
+
/**
|
|
41
|
+
* @componentState { "title": "Not Verified", "slot": "not-verified", "props": { "isAuth": false } }
|
|
42
|
+
* @componentState { "title": "Verified", "slot": "verified", "props": { "isAuth": true } }
|
|
43
|
+
*/
|
|
44
|
+
this.stateController = "{}";
|
|
40
45
|
stencilHooks_module.h$1(this);
|
|
41
46
|
}
|
|
42
47
|
disconnectedCallback() { }
|
|
43
48
|
render() {
|
|
49
|
+
var _a;
|
|
44
50
|
const [context, setContext] = index_module.In({
|
|
45
51
|
namespace: keys.VERIFICATION_PARENT_NAMESPACE,
|
|
46
52
|
initialValue: false,
|
|
47
53
|
});
|
|
54
|
+
const props = JSON.parse(this.stateController);
|
|
55
|
+
const demoIsAuth = index_module.isDemo() && ((_a = props["sqm-widget-verification-controller"]) === null || _a === void 0 ? void 0 : _a.isAuth);
|
|
48
56
|
const [container, setContainer] = stencilHooks_module.useState(undefined);
|
|
49
57
|
const [slot, setSlot] = stencilHooks_module.useState(undefined);
|
|
50
58
|
const updateTemplates = index_module.useCallback(() => {
|
|
51
|
-
const isAuth = context;
|
|
59
|
+
const isAuth = demoIsAuth || context;
|
|
52
60
|
const templates = slot.querySelectorAll(`template`);
|
|
53
61
|
const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
|
|
54
62
|
if (template) {
|
|
@@ -96,7 +104,7 @@ const WidgetVerificationController = class {
|
|
|
96
104
|
target.style.height = "25px";
|
|
97
105
|
});
|
|
98
106
|
}
|
|
99
|
-
}, [container, slot, context]);
|
|
107
|
+
}, [container, slot, context, demoIsAuth]);
|
|
100
108
|
stencilHooks_module.useEffect(() => {
|
|
101
109
|
if (!container || !slot) {
|
|
102
110
|
debug("DOM not ready:");
|
|
@@ -105,7 +113,7 @@ const WidgetVerificationController = class {
|
|
|
105
113
|
// Run on first render
|
|
106
114
|
updateTemplates();
|
|
107
115
|
return useTemplateChildren({ parent: slot, callback: updateTemplates });
|
|
108
|
-
}, [slot, container, context]);
|
|
116
|
+
}, [slot, container, context, demoIsAuth]);
|
|
109
117
|
return (index.h(index.Host, null, index.h("div", { ref: setSlot, style: { display: "contents" } }, index.h("slot", { name: "not-verified" }), index.h("slot", { name: "verified" })), index.h("div", { ref: setContainer }, index.h("slot", { name: "shown" }))));
|
|
110
118
|
}
|
|
111
119
|
};
|
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-a29c60ef.js');
|
|
6
6
|
const stencilHooks_module = require('./stencil-hooks.module-3a336b0f.js');
|
|
7
7
|
const index_module = require('./index.module-ee84433d.js');
|
|
8
|
+
const cjs = require('./cjs-1066ec21.js');
|
|
8
9
|
const utils = require('./utils-6847bc06.js');
|
|
10
|
+
const parseStates = require('./parseStates-d1effc19.js');
|
|
9
11
|
const extractProps = require('./extractProps-fd93ba62.js');
|
|
10
12
|
const keys = require('./keys-cff24974.js');
|
|
11
13
|
|
|
@@ -163,6 +165,11 @@ const WidgetVerification = class {
|
|
|
163
165
|
* @uiGroup Code Verification Step
|
|
164
166
|
*/
|
|
165
167
|
this.codeStep_networkErrorMessage = "An error occurred while verifying your email. Please refresh the page and try again.";
|
|
168
|
+
/**
|
|
169
|
+
* @componentState { "title": "Email Step", "props": { "showCode": false } }
|
|
170
|
+
* @componentState { "title": "Code Step", "props": { "showCode": true } }
|
|
171
|
+
*/
|
|
172
|
+
this.stateController = "{}";
|
|
166
173
|
stencilHooks_module.h$1(this);
|
|
167
174
|
}
|
|
168
175
|
disconnectedCallback() { }
|
|
@@ -171,20 +178,20 @@ const WidgetVerification = class {
|
|
|
171
178
|
return extractProps.extractProps(props, prefix);
|
|
172
179
|
}
|
|
173
180
|
render() {
|
|
174
|
-
const
|
|
175
|
-
? useDemoWidgetVerificationInternal()
|
|
181
|
+
const props = index_module.isDemo()
|
|
182
|
+
? useDemoWidgetVerificationInternal(this)
|
|
176
183
|
: useWidgetVerification();
|
|
177
|
-
if (loading)
|
|
184
|
+
if (props.loading)
|
|
178
185
|
return index.h("sl-spinner", null);
|
|
179
186
|
const generalText = this.getStepTextProps("general_");
|
|
180
187
|
return (index.h("div", null, index.h("h3", { style: { fontSize: "24px", margin: "0" } }, generalText.verifyEmailHeader), index.h("p", { style: {
|
|
181
188
|
color: "var(--sl-color-neutral-500)",
|
|
182
189
|
fontSize: "var(--sl-font-size-medium)",
|
|
183
190
|
margin: "0",
|
|
184
|
-
} }, generalText.verifyEmailDescription), showCode ? (index.h("sqm-code-verification", Object.assign({ onVerification: onVerification }, this.getStepTextProps("codeStep_")))) : (index.h("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"))))));
|
|
191
|
+
} }, generalText.verifyEmailDescription), props.showCode ? (index.h("sqm-code-verification", Object.assign({ onVerification: props.onVerification }, this.getStepTextProps("codeStep_"), extractProps.extractProps(props, "sqm-code-verification_")))) : (index.h("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"), extractProps.extractProps(props, "sqm-email-verification_"))))));
|
|
185
192
|
}
|
|
186
193
|
};
|
|
187
|
-
function useDemoWidgetVerificationInternal() {
|
|
194
|
+
function useDemoWidgetVerificationInternal(props) {
|
|
188
195
|
const [showCode, setShowCode] = index_module.In({
|
|
189
196
|
namespace: keys.SHOW_CODE_NAMESPACE,
|
|
190
197
|
initialValue: false,
|
|
@@ -194,10 +201,14 @@ function useDemoWidgetVerificationInternal() {
|
|
|
194
201
|
initialValue: undefined,
|
|
195
202
|
});
|
|
196
203
|
const setContext = index_module.En(keys.VERIFICATION_PARENT_NAMESPACE);
|
|
204
|
+
const states = parseStates.parseStates(props.stateController);
|
|
205
|
+
const formatted = Object.keys(states).reduce((prev, key) => key === "sqm-widget-verification"
|
|
206
|
+
? { ...prev, ...states[key] }
|
|
207
|
+
: { ...prev, [`${key}_stateController`]: states[key] }, {});
|
|
197
208
|
const onVerification = () => {
|
|
198
209
|
setContext(true);
|
|
199
210
|
};
|
|
200
|
-
return { showCode, onVerification, loading: false };
|
|
211
|
+
return cjs.cjs({ showCode, onVerification, loading: false }, formatted || {}, { arrayMerge: (_, a) => a });
|
|
201
212
|
}
|
|
202
213
|
|
|
203
214
|
exports.sqm_widget_verification = WidgetVerification;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-a29c60ef.js');
|
|
4
|
+
const global = require('./global-e31dc4f5.js');
|
|
5
|
+
const JSS = require('./JSS-8503a151.js');
|
|
6
|
+
|
|
7
|
+
const style = {
|
|
8
|
+
Container: {
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
gap: "24px",
|
|
12
|
+
},
|
|
13
|
+
HeaderContainer: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
gap: "10px",
|
|
17
|
+
},
|
|
18
|
+
TitleSkeleton: {
|
|
19
|
+
width: "45%",
|
|
20
|
+
height: "40px !important",
|
|
21
|
+
},
|
|
22
|
+
StepSkeleton: {
|
|
23
|
+
width: "15%",
|
|
24
|
+
},
|
|
25
|
+
HeaderSkeleton: {
|
|
26
|
+
width: "25%",
|
|
27
|
+
height: "30px !important",
|
|
28
|
+
},
|
|
29
|
+
InputSkeleton: {
|
|
30
|
+
width: "75%",
|
|
31
|
+
},
|
|
32
|
+
ButtonSkeleton: {
|
|
33
|
+
width: "80px",
|
|
34
|
+
height: "30px !important",
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const sheet = JSS.createStyleSheet(style);
|
|
38
|
+
const styleString = sheet.toString();
|
|
39
|
+
const LoadingView = () => {
|
|
40
|
+
return (index.h("div", { class: sheet.classes.Container },
|
|
41
|
+
index.h("style", { type: "text/css" }, styleString),
|
|
42
|
+
index.h("sl-skeleton", { class: sheet.classes.TitleSkeleton }),
|
|
43
|
+
index.h("div", { class: sheet.classes.HeaderContainer },
|
|
44
|
+
index.h("sl-skeleton", { class: sheet.classes.StepSkeleton }),
|
|
45
|
+
index.h("sl-skeleton", { class: sheet.classes.HeaderSkeleton })),
|
|
46
|
+
index.h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
47
|
+
index.h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
48
|
+
index.h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
49
|
+
index.h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
50
|
+
index.h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
51
|
+
index.h("sl-skeleton", { class: sheet.classes.StepSkeleton }),
|
|
52
|
+
index.h("sl-skeleton", { class: sheet.classes.ButtonSkeleton })));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function validTaxDocument(requiredType) {
|
|
56
|
+
const validTypes = ["W9", "W8BENE", "W8BEN"];
|
|
57
|
+
if (validTypes.includes(requiredType))
|
|
58
|
+
return true;
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
const objectIsFull = (obj) => {
|
|
62
|
+
return !Object.keys(obj).find((k) => obj[k] == undefined);
|
|
63
|
+
};
|
|
64
|
+
const taxTypeToName = (taxType) => {
|
|
65
|
+
switch (taxType) {
|
|
66
|
+
case "W9":
|
|
67
|
+
return "W-9";
|
|
68
|
+
case "W8BEN":
|
|
69
|
+
case "W8BENE":
|
|
70
|
+
return "W-8";
|
|
71
|
+
default:
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function validateBillingField(regex, value) {
|
|
76
|
+
const trimmed = value.trim();
|
|
77
|
+
const idx = trimmed.search(regex);
|
|
78
|
+
return idx > -1;
|
|
79
|
+
}
|
|
80
|
+
const formatErrorMessage = (fieldName, errorMessage) => {
|
|
81
|
+
return global.intl.formatMessage({
|
|
82
|
+
id: fieldName,
|
|
83
|
+
defaultMessage: errorMessage,
|
|
84
|
+
}, {
|
|
85
|
+
fieldName,
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
function getCountryObj({ countryCode, locale, }) {
|
|
89
|
+
// @ts-ignore DisplayNames not in Intl type
|
|
90
|
+
const displayName = new Intl.DisplayNames([locale], {
|
|
91
|
+
type: "region",
|
|
92
|
+
}).of(countryCode);
|
|
93
|
+
return {
|
|
94
|
+
countryCode,
|
|
95
|
+
displayName,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
exports.LoadingView = LoadingView;
|
|
100
|
+
exports.formatErrorMessage = formatErrorMessage;
|
|
101
|
+
exports.getCountryObj = getCountryObj;
|
|
102
|
+
exports.objectIsFull = objectIsFull;
|
|
103
|
+
exports.taxTypeToName = taxTypeToName;
|
|
104
|
+
exports.validTaxDocument = validTaxDocument;
|
|
105
|
+
exports.validateBillingField = validateBillingField;
|
|
@@ -10,7 +10,7 @@ import { usePagination } from "./usePagination";
|
|
|
10
10
|
/**
|
|
11
11
|
* @uiName Pagination
|
|
12
12
|
* @exampleGroup Common Components
|
|
13
|
-
* @example
|
|
13
|
+
* @example Link Button - <sqm-pagination></sqm-pagination>
|
|
14
14
|
*/
|
|
15
15
|
export class Pagination {
|
|
16
16
|
constructor() {
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { h, Component, Host, State } from "@stencil/core";
|
|
2
|
-
import { useStencilbook } from "@saasquatch/stencilbook";
|
|
3
1
|
import { useState, withHooks } from "@saasquatch/stencil-hooks";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
2
|
+
import { useStencilbook } from "@saasquatch/stencilbook";
|
|
3
|
+
import { Component, h, Host, State } from "@stencil/core";
|
|
4
|
+
import * as NewPortal from "../../stories/NewPortal.stories";
|
|
5
|
+
import * as PortalTemplates from "../../stories/PortalTemplates.stories";
|
|
6
|
+
import * as PoweredByImg from "../../stories/PoweredByImg.stories";
|
|
7
|
+
import * as Widget from "../../stories/Widget.stories";
|
|
8
|
+
import * as AssetCard from "../sqm-asset-card/AssetCard.stories";
|
|
9
|
+
import * as BaseRegistrationForm from "../sqm-base-registration/BaseRegistrationForm.stories";
|
|
8
10
|
import * as BigStat from "../sqm-big-stat/BigStat.stories";
|
|
9
|
-
import * as Leaderboard from "../sqm-leaderboard/Leaderboard.stories";
|
|
10
|
-
import * as Router from "../sqm-router/Router.stories";
|
|
11
|
-
import * as LeaderboardRank from "../sqm-leaderboard-rank/LeaderboardRank.stories";
|
|
12
|
-
import * as PortalFrame from "../sqm-portal-frame/PortalFrame.stories";
|
|
13
|
-
import * as EditProfile from "../sqm-edit-profile/EditProfileForm.stories";
|
|
14
|
-
import * as UseShareLink from "../sqm-share-link/UseShareLink.stories";
|
|
15
|
-
import * as UseShareButton from "../sqm-share-button/UseShareButton.stories";
|
|
16
11
|
import * as UseBigStat from "../sqm-big-stat/UseBigStat.stories";
|
|
12
|
+
import * as BrandStories from "../sqm-brand/SqmBrand.stories";
|
|
13
|
+
import * as CardFeed from "../sqm-card-feed/CardFeed.stories";
|
|
14
|
+
import * as CheckboxField from "../sqm-checkbox-field/CheckboxField.stories";
|
|
15
|
+
import * as UseCheckboxField from "../sqm-checkbox-field/UseCheckboxField.stories";
|
|
16
|
+
import * as CloseButton from "../sqm-close-button/CloseButton.stories";
|
|
17
|
+
import * as CouponCode from "../sqm-coupon-code/CouponCode.stories";
|
|
18
|
+
import * as DividedLayout from "../sqm-divided-layout/DividedLayout.stories";
|
|
19
|
+
import * as DropdownField from "../sqm-dropdown-field/DropdownField.stories";
|
|
20
|
+
import * as UseDropdownField from "../sqm-dropdown-field/UseDropdownField.stories";
|
|
21
|
+
import * as EditProfile from "../sqm-edit-profile/EditProfileForm.stories";
|
|
17
22
|
import * as UseEditProfile from "../sqm-edit-profile/UseEditProfile.stories";
|
|
18
|
-
import * as
|
|
23
|
+
import * as EmptyState from "../sqm-empty/EmptyState.stories";
|
|
19
24
|
import * as FormMessage from "../sqm-form-message/FormMessage.stories";
|
|
20
|
-
import * as
|
|
21
|
-
import * as
|
|
22
|
-
import * as
|
|
23
|
-
import * as
|
|
24
|
-
import * as
|
|
25
|
+
import * as HeroImage from "../sqm-hero-image/HeroImage.stories";
|
|
26
|
+
import * as Hero from "../sqm-hero/Hero.stories";
|
|
27
|
+
import * as Image from "../sqm-image/Image.stories";
|
|
28
|
+
import * as InputField from "../sqm-input-field/InputField.stories";
|
|
29
|
+
import * as UseInputField from "../sqm-input-field/UseInputField.stories";
|
|
30
|
+
import * as InvoiceTable from "../sqm-invoice-table/InvoiceTable.stories";
|
|
31
|
+
import * as InvoiceTableCells from "../sqm-invoice-table/InvoiceTableCell.stories";
|
|
32
|
+
import * as UseInvoiceTableCells from "../sqm-invoice-table/UseInvoiceTable.stories";
|
|
33
|
+
import * as LeaderboardRank from "../sqm-leaderboard-rank/LeaderboardRank.stories";
|
|
34
|
+
import * as Leaderboard from "../sqm-leaderboard/Leaderboard.stories";
|
|
35
|
+
import * as UseLeaderboard from "../sqm-leaderboard/UseLeaderboard.stories";
|
|
36
|
+
import * as LinkButton from "../sqm-link-button/LinkButton.stories";
|
|
37
|
+
import * as LogoutCurrentUser from "../sqm-logout-current-user/LogoutCurrentUser.stories";
|
|
38
|
+
import * as MarketingEmailsCheckbox from "../sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories";
|
|
39
|
+
import * as NameFields from "../sqm-name-fields/NameFields.stories";
|
|
25
40
|
import * as SidebarItem from "../sqm-navigation-sidebar-item/SidebarItem.stories";
|
|
26
41
|
import * as NavigationSidebar from "../sqm-navigation-sidebar/NavigationSidebar.stories";
|
|
42
|
+
import * as Pagination from "../sqm-pagination/Pagination.stories";
|
|
43
|
+
import * as PasswordField from "../sqm-password-field/PasswordField.stories";
|
|
44
|
+
import * as PayoutButtonScroll from "../sqm-payout-button-scroll/PayoutButtonScroll.stories";
|
|
45
|
+
import * as ChangeMarketing from "../sqm-portal-change-marketing/ChangeMarketing.stories";
|
|
46
|
+
import * as ChangePassword from "../sqm-portal-change-password/ChangePassword.stories";
|
|
47
|
+
import * as PortalContainer from "../sqm-portal-container/PortalContainer.stories";
|
|
48
|
+
import * as PortalEmailVerification from "../sqm-portal-email-verification/PortalEmailVerification.stories";
|
|
49
|
+
import * as PortalFooter from "../sqm-portal-footer/PortalFooter.stories";
|
|
50
|
+
import * as PortalForgotPassword from "../sqm-portal-forgot-password/PortalForgotPassword.stories";
|
|
51
|
+
import * as PortalFrame from "../sqm-portal-frame/PortalFrame.stories";
|
|
52
|
+
import * as PortalGoogleRegistrationFormStories from "../sqm-portal-google-registration-form/PortalGoogleRegistrationForm.stories";
|
|
27
53
|
import * as PortalLogin from "../sqm-portal-login/PortalLogin.stories";
|
|
54
|
+
import * as PortalProfile from "../sqm-portal-profile/PortalProfile.stories";
|
|
28
55
|
import * as PortalRegister from "../sqm-portal-register/PortalRegister.stories";
|
|
29
56
|
import * as NewPortalRegistrationForm from "../sqm-portal-registration-form/PortalRegistrationForm.stories";
|
|
30
|
-
import * as
|
|
31
|
-
import * as PortalEmailVerification from "../sqm-portal-email-verification/PortalEmailVerification.stories";
|
|
57
|
+
import * as PortalRegistrationForm from "../sqm-portal-registration-form/PortalRegistrationForm.stories";
|
|
32
58
|
import * as PortalResetPassword from "../sqm-portal-reset-password/PortalResetPassword.stories";
|
|
33
59
|
import * as PortalVerifyEmail from "../sqm-portal-verify-email/PortalVerifyEmail.stories";
|
|
34
|
-
import * as
|
|
35
|
-
import * as
|
|
36
|
-
import * as
|
|
37
|
-
import * as
|
|
38
|
-
import * as
|
|
60
|
+
import * as ProgramExplainerStep from "../sqm-program-explainer-step/ProgramExplainerStep.stories";
|
|
61
|
+
import * as ProgramExplainer from "../sqm-program-explainer/ProgramExplainer.stories";
|
|
62
|
+
import * as ProgramMenu from "../sqm-program-menu/ProgramMenu.stories";
|
|
63
|
+
import * as RadioCard from "../sqm-radio-card/RadioCard.stories";
|
|
64
|
+
import * as ReferralCard from "../sqm-referral-card/ReferralCard.stories";
|
|
65
|
+
import * as ReferralCode from "../sqm-referral-code/ReferralCode.stories";
|
|
66
|
+
import * as ReferralCodes from "../sqm-referral-codes/ReferralCodes.stories";
|
|
67
|
+
import * as ReferralIframe from "../sqm-referral-iframe/ReferralIframe.stories";
|
|
39
68
|
import * as ReferralTable from "../sqm-referral-table/ReferralTable.stories";
|
|
40
69
|
import * as ReferralTableCell from "../sqm-referral-table/ReferralTableCell.stories";
|
|
41
70
|
import * as ReferralTableRewardsCell from "../sqm-referral-table/ReferralTableRewardsCell.stories";
|
|
42
|
-
import * as
|
|
43
|
-
import * as PasswordField from "../sqm-password-field/PasswordField.stories";
|
|
44
|
-
import * as TaskCard from "../sqm-task-card/TaskCard.stories";
|
|
45
|
-
import * as PortalTemplates from "../../stories/PortalTemplates.stories";
|
|
46
|
-
import * as ProgramMenu from "../sqm-program-menu/ProgramMenu.stories";
|
|
47
|
-
import * as PoweredByImg from "../../stories/PoweredByImg.stories";
|
|
48
|
-
import * as PortalFooter from "../sqm-portal-footer/PortalFooter.stories";
|
|
49
|
-
import * as Hero from "../sqm-hero/Hero.stories";
|
|
50
|
-
import * as ReferralIframe from "../sqm-referral-iframe/ReferralIframe.stories";
|
|
51
|
-
import * as NameFields from "../sqm-name-fields/NameFields.stories";
|
|
52
|
-
import * as CheckboxField from "../sqm-checkbox-field/CheckboxField.stories";
|
|
53
|
-
import * as MarketingEmailsCheckbox from "../sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories";
|
|
54
|
-
import * as UseCheckboxField from "../sqm-checkbox-field/UseCheckboxField.stories";
|
|
55
|
-
import * as DropdownField from "../sqm-dropdown-field/DropdownField.stories";
|
|
56
|
-
import * as UseDropdownField from "../sqm-dropdown-field/UseDropdownField.stories";
|
|
57
|
-
import * as InputField from "../sqm-input-field/InputField.stories";
|
|
58
|
-
import * as UseInputField from "../sqm-input-field/UseInputField.stories";
|
|
71
|
+
import * as UseReferralTable from "../sqm-referral-table/UseReferralTable.stories";
|
|
59
72
|
import * as RewardExchangeList from "../sqm-reward-exchange-list/RewardExchangeList.stories";
|
|
60
|
-
import * as
|
|
61
|
-
import * as ProgramExplainerStep from "../sqm-program-explainer-step/ProgramExplainerStep.stories";
|
|
62
|
-
import * as BrandStories from "../sqm-brand/SqmBrand.stories";
|
|
63
|
-
import * as CardFeed from "../sqm-card-feed/CardFeed.stories";
|
|
64
|
-
import * as PortalContainer from "../sqm-portal-container/PortalContainer.stories";
|
|
65
|
-
import * as RewardsTableCell from "../sqm-rewards-table/RewardsTableCell.stories";
|
|
73
|
+
import * as UseRewardExchangeList from "../sqm-reward-exchange-list/UseRewardExchangeList.stories";
|
|
66
74
|
import * as RewardsTable from "../sqm-rewards-table/RewardsTable.stories";
|
|
67
|
-
import * as
|
|
68
|
-
import * as
|
|
69
|
-
import * as
|
|
70
|
-
import * as Timeline from "../sqm-timeline/Timeline.stories";
|
|
71
|
-
import * as Image from "../sqm-image/Image.stories";
|
|
72
|
-
import * as TitledSection from "../sqm-titled-section/TitledSection.stories";
|
|
75
|
+
import * as RewardsTableCell from "../sqm-rewards-table/RewardsTableCell.stories";
|
|
76
|
+
import * as UseRewardsTable from "../sqm-rewards-table/UseRewardsTable.stories";
|
|
77
|
+
import * as Router from "../sqm-router/Router.stories";
|
|
73
78
|
import * as Scroll from "../sqm-scroll/Scroll.stories";
|
|
74
|
-
import * as
|
|
79
|
+
import * as ShareButton from "../sqm-share-button/ShareButton.stories";
|
|
80
|
+
import * as UseShareButton from "../sqm-share-button/UseShareButton.stories";
|
|
75
81
|
import * as ShareCode from "../sqm-share-code/ShareCode.stories";
|
|
76
|
-
import * as
|
|
77
|
-
import * as
|
|
78
|
-
import * as
|
|
79
|
-
import * as
|
|
80
|
-
import * as
|
|
81
|
-
import * as CloseButton from "../sqm-close-button/CloseButton.stories";
|
|
82
|
-
import * as TaxForm from "../tax-and-cash/TaxForm.stories";
|
|
83
|
-
import * as TaxFormSlots from "../tax-and-cash/sqm-user-info-form/small-views/SlotViews.stories";
|
|
84
|
-
import * as RadioCard from "../sqm-radio-card/RadioCard.stories";
|
|
82
|
+
import * as ShareLink from "../sqm-share-link/ShareLink.stories";
|
|
83
|
+
import * as UseShareLink from "../sqm-share-link/UseShareLink.stories";
|
|
84
|
+
import * as Tabs from "../sqm-tabs/Tabs.stories";
|
|
85
|
+
import * as TaskCard from "../sqm-task-card/TaskCard.stories";
|
|
86
|
+
import * as UseTaskCard from "../sqm-task-card/UseTaskCard.stories";
|
|
85
87
|
import * as ProgressBar from "../sqm-task-card/progress-bar/ProgressBar.stories";
|
|
86
|
-
import * as
|
|
87
|
-
import * as
|
|
88
|
-
import * as
|
|
89
|
-
import * as InvoiceTableCells from "../sqm-invoice-table/InvoiceTableCell.stories";
|
|
90
|
-
import * as UseInvoiceTableCells from "../sqm-invoice-table/UseInvoiceTable.stories";
|
|
91
|
-
import * as WidgetEmailVerification from "../sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories";
|
|
88
|
+
import * as Timeline from "../sqm-timeline/Timeline.stories";
|
|
89
|
+
import * as TitledSection from "../sqm-titled-section/TitledSection.stories";
|
|
90
|
+
import * as UserName from "../sqm-user-name/UserName.stories";
|
|
92
91
|
import * as WidgetCodeVerification from "../sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories";
|
|
93
|
-
import * as
|
|
92
|
+
import * as WidgetEmailVerification from "../sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories";
|
|
93
|
+
import * as BankingInfoForm from "../tax-and-cash/BankingForm.stories";
|
|
94
|
+
import * as TaxForm from "../tax-and-cash/TaxForm.stories";
|
|
95
|
+
import * as PayoutDetailsCard from "../tax-and-cash/sqm-payout-details-card/PayoutDetailsCard.stories";
|
|
94
96
|
import * as PayoutStatusAlert from "../tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories";
|
|
95
|
-
import * as
|
|
96
|
-
import * as
|
|
97
|
-
import
|
|
98
|
-
import * as PortalGoogleRegistrationFormStories from "../sqm-portal-google-registration-form/PortalGoogleRegistrationForm.stories";
|
|
99
|
-
import * as Themes from "./Themes";
|
|
97
|
+
import * as TaxFormSlots from "../tax-and-cash/sqm-user-info-form/small-views/SlotViews.stories";
|
|
98
|
+
import * as EmailRegistration from "../views/EmailRegistration.stories";
|
|
99
|
+
import { ShadowViewAddon } from "../../ShadowViewAddon";
|
|
100
100
|
import { CucumberAddon } from "./CucumberAddon";
|
|
101
101
|
import { HookStoryAddon } from "./HookStoryAddon";
|
|
102
|
-
import { ShadowViewAddon } from "../../ShadowViewAddon";
|
|
103
102
|
import { ResizerStylesheet } from "./Resizer";
|
|
103
|
+
import * as Themes from "./Themes";
|
|
104
104
|
const stories = [
|
|
105
105
|
InvoiceTable,
|
|
106
106
|
InvoiceTableCells,
|
|
@@ -2,10 +2,11 @@ import { isDemo, useSetParent } from "@saasquatch/component-boilerplate";
|
|
|
2
2
|
import { useState, withHooks } from "@saasquatch/stencil-hooks";
|
|
3
3
|
import { Component, h, Prop } from "@stencil/core";
|
|
4
4
|
import deepmerge from "deepmerge";
|
|
5
|
+
import { parseStates } from "../../../utils/parseStates";
|
|
5
6
|
import { getProps } from "../../../utils/utils";
|
|
7
|
+
import { VERIFICATION_PARENT_NAMESPACE } from "../keys";
|
|
6
8
|
import { WidgetCodeVerificationView, } from "./sqm-code-verification-view";
|
|
7
9
|
import { useWidgetCodeVerification } from "./useCodeVerification";
|
|
8
|
-
import { VERIFICATION_PARENT_NAMESPACE } from "../keys";
|
|
9
10
|
export class WidgetCodeVerification {
|
|
10
11
|
constructor() {
|
|
11
12
|
/**
|
|
@@ -45,6 +46,12 @@ export class WidgetCodeVerification {
|
|
|
45
46
|
* @uiName Network error message
|
|
46
47
|
*/
|
|
47
48
|
this.networkErrorMessage = "An error occurred while verifying your email. Please refresh the page and try again.";
|
|
49
|
+
/**
|
|
50
|
+
* @parentState {"parent": "sqm-widget-verification", "title": "Code Step" }
|
|
51
|
+
* @componentState { "title": "Verification Failed", "props": { "states": { "verifyFailed": true } } }
|
|
52
|
+
* @componentState { "title": "Loading", "props": { "states": { "loading": true } } }
|
|
53
|
+
*/
|
|
54
|
+
this.stateController = "{}";
|
|
48
55
|
withHooks(this);
|
|
49
56
|
}
|
|
50
57
|
disconnectedCallback() { }
|
|
@@ -228,6 +235,33 @@ export class WidgetCodeVerification {
|
|
|
228
235
|
"reflect": false,
|
|
229
236
|
"defaultValue": "\"An error occurred while verifying your email. Please refresh the page and try again.\""
|
|
230
237
|
},
|
|
238
|
+
"stateController": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "string",
|
|
243
|
+
"resolved": "string",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [{
|
|
250
|
+
"text": "{\"parent\": \"sqm-widget-verification\", \"title\": \"Code Step\" }",
|
|
251
|
+
"name": "parentState"
|
|
252
|
+
}, {
|
|
253
|
+
"text": "{ \"title\": \"Verification Failed\", \"props\": { \"states\": { \"verifyFailed\": true } } }",
|
|
254
|
+
"name": "componentState"
|
|
255
|
+
}, {
|
|
256
|
+
"text": "{ \"title\": \"Loading\", \"props\": { \"states\": { \"loading\": true } } }",
|
|
257
|
+
"name": "componentState"
|
|
258
|
+
}],
|
|
259
|
+
"text": ""
|
|
260
|
+
},
|
|
261
|
+
"attribute": "state-controller",
|
|
262
|
+
"reflect": false,
|
|
263
|
+
"defaultValue": "\"{}\""
|
|
264
|
+
},
|
|
231
265
|
"demoData": {
|
|
232
266
|
"type": "unknown",
|
|
233
267
|
"mutable": false,
|
|
@@ -283,10 +317,10 @@ function useDemoWidgetCodeVerification(props) {
|
|
|
283
317
|
const setVerifiedContext = useSetParent(VERIFICATION_PARENT_NAMESPACE);
|
|
284
318
|
return deepmerge({
|
|
285
319
|
states: {
|
|
320
|
+
initialiseLoading: false,
|
|
286
321
|
loading: false,
|
|
287
322
|
email: "test@example.com",
|
|
288
323
|
emailResent,
|
|
289
|
-
resendError: false,
|
|
290
324
|
verifyFailed: false,
|
|
291
325
|
},
|
|
292
326
|
refs: {
|
|
@@ -297,5 +331,5 @@ function useDemoWidgetCodeVerification(props) {
|
|
|
297
331
|
submitCode: async () => setVerifiedContext(true),
|
|
298
332
|
},
|
|
299
333
|
text: props.getTextProps(),
|
|
300
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
334
|
+
}, props.demoData || parseStates(props.stateController) || {}, { arrayMerge: (_, a) => a });
|
|
301
335
|
}
|
package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-controller.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useParentState } from "@saasquatch/component-boilerplate";
|
|
1
|
+
import { isDemo, useParentState } from "@saasquatch/component-boilerplate";
|
|
2
2
|
import { withHooks } from "@saasquatch/stencil-hooks";
|
|
3
3
|
import { useCallback, useEffect, useState } from "@saasquatch/universal-hooks";
|
|
4
|
-
import { Component, h, Host } from "@stencil/core";
|
|
4
|
+
import { Component, h, Host, Prop } from "@stencil/core";
|
|
5
5
|
import debugFn from "debug";
|
|
6
6
|
import { VERIFICATION_PARENT_NAMESPACE } from "./keys";
|
|
7
7
|
const debug = debugFn("sq:widget-verification");
|
|
@@ -40,18 +40,26 @@ function useTemplateChildren({ parent, callback }) {
|
|
|
40
40
|
*/
|
|
41
41
|
export class WidgetVerificationController {
|
|
42
42
|
constructor() {
|
|
43
|
+
/**
|
|
44
|
+
* @componentState { "title": "Not Verified", "slot": "not-verified", "props": { "isAuth": false } }
|
|
45
|
+
* @componentState { "title": "Verified", "slot": "verified", "props": { "isAuth": true } }
|
|
46
|
+
*/
|
|
47
|
+
this.stateController = "{}";
|
|
43
48
|
withHooks(this);
|
|
44
49
|
}
|
|
45
50
|
disconnectedCallback() { }
|
|
46
51
|
render() {
|
|
52
|
+
var _a;
|
|
47
53
|
const [context, setContext] = useParentState({
|
|
48
54
|
namespace: VERIFICATION_PARENT_NAMESPACE,
|
|
49
55
|
initialValue: false,
|
|
50
56
|
});
|
|
57
|
+
const props = JSON.parse(this.stateController);
|
|
58
|
+
const demoIsAuth = isDemo() && ((_a = props["sqm-widget-verification-controller"]) === null || _a === void 0 ? void 0 : _a.isAuth);
|
|
51
59
|
const [container, setContainer] = useState(undefined);
|
|
52
60
|
const [slot, setSlot] = useState(undefined);
|
|
53
61
|
const updateTemplates = useCallback(() => {
|
|
54
|
-
const isAuth = context;
|
|
62
|
+
const isAuth = demoIsAuth || context;
|
|
55
63
|
const templates = slot.querySelectorAll(`template`);
|
|
56
64
|
const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
|
|
57
65
|
if (template) {
|
|
@@ -99,7 +107,7 @@ export class WidgetVerificationController {
|
|
|
99
107
|
target.style.height = "25px";
|
|
100
108
|
});
|
|
101
109
|
}
|
|
102
|
-
}, [container, slot, context]);
|
|
110
|
+
}, [container, slot, context, demoIsAuth]);
|
|
103
111
|
useEffect(() => {
|
|
104
112
|
if (!container || !slot) {
|
|
105
113
|
debug("DOM not ready:");
|
|
@@ -108,7 +116,7 @@ export class WidgetVerificationController {
|
|
|
108
116
|
// Run on first render
|
|
109
117
|
updateTemplates();
|
|
110
118
|
return useTemplateChildren({ parent: slot, callback: updateTemplates });
|
|
111
|
-
}, [slot, container, context]);
|
|
119
|
+
}, [slot, container, context, demoIsAuth]);
|
|
112
120
|
return (h(Host, null,
|
|
113
121
|
h("div", { ref: setSlot, style: { display: "contents" } },
|
|
114
122
|
h("slot", { name: "not-verified" }),
|
|
@@ -117,4 +125,30 @@ export class WidgetVerificationController {
|
|
|
117
125
|
h("slot", { name: "shown" }))));
|
|
118
126
|
}
|
|
119
127
|
static get is() { return "sqm-widget-verification-controller"; }
|
|
128
|
+
static get properties() { return {
|
|
129
|
+
"stateController": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "string",
|
|
134
|
+
"resolved": "string",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [{
|
|
141
|
+
"text": "{ \"title\": \"Not Verified\", \"slot\": \"not-verified\", \"props\": { \"isAuth\": false } }",
|
|
142
|
+
"name": "componentState"
|
|
143
|
+
}, {
|
|
144
|
+
"text": "{ \"title\": \"Verified\", \"slot\": \"verified\", \"props\": { \"isAuth\": true } }",
|
|
145
|
+
"name": "componentState"
|
|
146
|
+
}],
|
|
147
|
+
"text": ""
|
|
148
|
+
},
|
|
149
|
+
"attribute": "state-controller",
|
|
150
|
+
"reflect": false,
|
|
151
|
+
"defaultValue": "\"{}\""
|
|
152
|
+
}
|
|
153
|
+
}; }
|
|
120
154
|
}
|