@saasquatch/mint-components 1.13.5-0 → 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 +12390 -11094
- 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-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 +75 -41
- 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.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 +10501 -9205
- 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-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 +11 -10
- 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 -89
- package/dist/types/global/android.d.ts +7 -0
- package/dist/types/global/demo.d.ts +2 -0
- package/dist/types/stories/features.d.ts +4 -0
- package/dist/types/stories/templates.d.ts +4 -0
- 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-33c96e14.entry.js +0 -16
- package/dist/mint-components/p-38b5f028.system.entry.js +0 -1
- 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-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-b93fd99c.system.entry.js +0 -1
- package/dist/mint-components/p-c36506f6.system.entry.js +0 -1
- package/dist/mint-components/p-d3d74266.js +0 -394
- package/dist/mint-components/p-f29eda2f.entry.js +0 -205
- package/dist/mint-components/p-f2cc6a6f.entry.js +0 -9
- /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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h as h$1, c as Host } from './index-91e7729f.js';
|
|
2
2
|
import { b as browser, n as h, k as useState, f as useEffect } from './stencil-hooks.module-4bc38af4.js';
|
|
3
|
-
import { I as In, u as useCallback } from './index.module-89a79f66.js';
|
|
3
|
+
import { I as In, u as useCallback, i as isDemo } from './index.module-89a79f66.js';
|
|
4
4
|
import { a as VERIFICATION_PARENT_NAMESPACE } from './keys-406491dc.js';
|
|
5
5
|
|
|
6
6
|
const debug = browser("sq:widget-verification");
|
|
@@ -33,18 +33,26 @@ function useTemplateChildren({ parent, callback }) {
|
|
|
33
33
|
const WidgetVerificationController = class {
|
|
34
34
|
constructor(hostRef) {
|
|
35
35
|
registerInstance(this, hostRef);
|
|
36
|
+
/**
|
|
37
|
+
* @componentState { "title": "Not Verified", "slot": "not-verified", "props": { "isAuth": false } }
|
|
38
|
+
* @componentState { "title": "Verified", "slot": "verified", "props": { "isAuth": true } }
|
|
39
|
+
*/
|
|
40
|
+
this.stateController = "{}";
|
|
36
41
|
h(this);
|
|
37
42
|
}
|
|
38
43
|
disconnectedCallback() { }
|
|
39
44
|
render() {
|
|
45
|
+
var _a;
|
|
40
46
|
const [context, setContext] = In({
|
|
41
47
|
namespace: VERIFICATION_PARENT_NAMESPACE,
|
|
42
48
|
initialValue: false,
|
|
43
49
|
});
|
|
50
|
+
const props = JSON.parse(this.stateController);
|
|
51
|
+
const demoIsAuth = isDemo() && ((_a = props["sqm-widget-verification-controller"]) === null || _a === void 0 ? void 0 : _a.isAuth);
|
|
44
52
|
const [container, setContainer] = useState(undefined);
|
|
45
53
|
const [slot, setSlot] = useState(undefined);
|
|
46
54
|
const updateTemplates = useCallback(() => {
|
|
47
|
-
const isAuth = context;
|
|
55
|
+
const isAuth = demoIsAuth || context;
|
|
48
56
|
const templates = slot.querySelectorAll(`template`);
|
|
49
57
|
const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
|
|
50
58
|
if (template) {
|
|
@@ -92,7 +100,7 @@ const WidgetVerificationController = class {
|
|
|
92
100
|
target.style.height = "25px";
|
|
93
101
|
});
|
|
94
102
|
}
|
|
95
|
-
}, [container, slot, context]);
|
|
103
|
+
}, [container, slot, context, demoIsAuth]);
|
|
96
104
|
useEffect(() => {
|
|
97
105
|
if (!container || !slot) {
|
|
98
106
|
debug("DOM not ready:");
|
|
@@ -101,7 +109,7 @@ const WidgetVerificationController = class {
|
|
|
101
109
|
// Run on first render
|
|
102
110
|
updateTemplates();
|
|
103
111
|
return useTemplateChildren({ parent: slot, callback: updateTemplates });
|
|
104
|
-
}, [slot, container, context]);
|
|
112
|
+
}, [slot, container, context, demoIsAuth]);
|
|
105
113
|
return (h$1(Host, null, h$1("div", { ref: setSlot, style: { display: "contents" } }, h$1("slot", { name: "not-verified" }), h$1("slot", { name: "verified" })), h$1("div", { ref: setContainer }, h$1("slot", { name: "shown" }))));
|
|
106
114
|
}
|
|
107
115
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { r as registerInstance, h as h$1 } from './index-91e7729f.js';
|
|
2
2
|
import { k as useState, f as useEffect, n as h } from './stencil-hooks.module-4bc38af4.js';
|
|
3
3
|
import { d as dist, J, I as In, q as En, X as Xe, i as isDemo } from './index.module-89a79f66.js';
|
|
4
|
+
import { c as cjs } from './cjs-bdfb4486.js';
|
|
4
5
|
import { g as getProps } from './utils-334c1e34.js';
|
|
6
|
+
import { p as parseStates } from './parseStates-ed75e224.js';
|
|
5
7
|
import { e as extractProps } from './extractProps-ae1afbb3.js';
|
|
6
8
|
import { S as SHOW_CODE_NAMESPACE, V as VERIFICATION_EMAIL_NAMESPACE, a as VERIFICATION_PARENT_NAMESPACE } from './keys-406491dc.js';
|
|
7
9
|
|
|
@@ -159,6 +161,11 @@ const WidgetVerification = class {
|
|
|
159
161
|
* @uiGroup Code Verification Step
|
|
160
162
|
*/
|
|
161
163
|
this.codeStep_networkErrorMessage = "An error occurred while verifying your email. Please refresh the page and try again.";
|
|
164
|
+
/**
|
|
165
|
+
* @componentState { "title": "Email Step", "props": { "showCode": false } }
|
|
166
|
+
* @componentState { "title": "Code Step", "props": { "showCode": true } }
|
|
167
|
+
*/
|
|
168
|
+
this.stateController = "{}";
|
|
162
169
|
h(this);
|
|
163
170
|
}
|
|
164
171
|
disconnectedCallback() { }
|
|
@@ -167,20 +174,20 @@ const WidgetVerification = class {
|
|
|
167
174
|
return extractProps(props, prefix);
|
|
168
175
|
}
|
|
169
176
|
render() {
|
|
170
|
-
const
|
|
171
|
-
? useDemoWidgetVerificationInternal()
|
|
177
|
+
const props = isDemo()
|
|
178
|
+
? useDemoWidgetVerificationInternal(this)
|
|
172
179
|
: useWidgetVerification();
|
|
173
|
-
if (loading)
|
|
180
|
+
if (props.loading)
|
|
174
181
|
return h$1("sl-spinner", null);
|
|
175
182
|
const generalText = this.getStepTextProps("general_");
|
|
176
183
|
return (h$1("div", null, h$1("h3", { style: { fontSize: "24px", margin: "0" } }, generalText.verifyEmailHeader), h$1("p", { style: {
|
|
177
184
|
color: "var(--sl-color-neutral-500)",
|
|
178
185
|
fontSize: "var(--sl-font-size-medium)",
|
|
179
186
|
margin: "0",
|
|
180
|
-
} }, generalText.verifyEmailDescription), showCode ? (h$1("sqm-code-verification", Object.assign({ onVerification: onVerification }, this.getStepTextProps("codeStep_")))) : (h$1("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"))))));
|
|
187
|
+
} }, generalText.verifyEmailDescription), props.showCode ? (h$1("sqm-code-verification", Object.assign({ onVerification: props.onVerification }, this.getStepTextProps("codeStep_"), extractProps(props, "sqm-code-verification_")))) : (h$1("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"), extractProps(props, "sqm-email-verification_"))))));
|
|
181
188
|
}
|
|
182
189
|
};
|
|
183
|
-
function useDemoWidgetVerificationInternal() {
|
|
190
|
+
function useDemoWidgetVerificationInternal(props) {
|
|
184
191
|
const [showCode, setShowCode] = In({
|
|
185
192
|
namespace: SHOW_CODE_NAMESPACE,
|
|
186
193
|
initialValue: false,
|
|
@@ -190,10 +197,14 @@ function useDemoWidgetVerificationInternal() {
|
|
|
190
197
|
initialValue: undefined,
|
|
191
198
|
});
|
|
192
199
|
const setContext = En(VERIFICATION_PARENT_NAMESPACE);
|
|
200
|
+
const states = parseStates(props.stateController);
|
|
201
|
+
const formatted = Object.keys(states).reduce((prev, key) => key === "sqm-widget-verification"
|
|
202
|
+
? { ...prev, ...states[key] }
|
|
203
|
+
: { ...prev, [`${key}_stateController`]: states[key] }, {});
|
|
193
204
|
const onVerification = () => {
|
|
194
205
|
setContext(true);
|
|
195
206
|
};
|
|
196
|
-
return { showCode, onVerification, loading: false };
|
|
207
|
+
return cjs({ showCode, onVerification, loading: false }, formatted || {}, { arrayMerge: (_, a) => a });
|
|
197
208
|
}
|
|
198
209
|
|
|
199
210
|
export { WidgetVerification as sqm_widget_verification };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { h } from './index-91e7729f.js';
|
|
2
|
+
import { i as intl } from './global-be1f9992.js';
|
|
3
|
+
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
4
|
+
|
|
5
|
+
const style = {
|
|
6
|
+
Container: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "column",
|
|
9
|
+
gap: "24px",
|
|
10
|
+
},
|
|
11
|
+
HeaderContainer: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
gap: "10px",
|
|
15
|
+
},
|
|
16
|
+
TitleSkeleton: {
|
|
17
|
+
width: "45%",
|
|
18
|
+
height: "40px !important",
|
|
19
|
+
},
|
|
20
|
+
StepSkeleton: {
|
|
21
|
+
width: "15%",
|
|
22
|
+
},
|
|
23
|
+
HeaderSkeleton: {
|
|
24
|
+
width: "25%",
|
|
25
|
+
height: "30px !important",
|
|
26
|
+
},
|
|
27
|
+
InputSkeleton: {
|
|
28
|
+
width: "75%",
|
|
29
|
+
},
|
|
30
|
+
ButtonSkeleton: {
|
|
31
|
+
width: "80px",
|
|
32
|
+
height: "30px !important",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const sheet = createStyleSheet(style);
|
|
36
|
+
const styleString = sheet.toString();
|
|
37
|
+
const LoadingView = () => {
|
|
38
|
+
return (h("div", { class: sheet.classes.Container },
|
|
39
|
+
h("style", { type: "text/css" }, styleString),
|
|
40
|
+
h("sl-skeleton", { class: sheet.classes.TitleSkeleton }),
|
|
41
|
+
h("div", { class: sheet.classes.HeaderContainer },
|
|
42
|
+
h("sl-skeleton", { class: sheet.classes.StepSkeleton }),
|
|
43
|
+
h("sl-skeleton", { class: sheet.classes.HeaderSkeleton })),
|
|
44
|
+
h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
45
|
+
h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
46
|
+
h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
47
|
+
h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
48
|
+
h("sl-skeleton", { class: sheet.classes.InputSkeleton }),
|
|
49
|
+
h("sl-skeleton", { class: sheet.classes.StepSkeleton }),
|
|
50
|
+
h("sl-skeleton", { class: sheet.classes.ButtonSkeleton })));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function validTaxDocument(requiredType) {
|
|
54
|
+
const validTypes = ["W9", "W8BENE", "W8BEN"];
|
|
55
|
+
if (validTypes.includes(requiredType))
|
|
56
|
+
return true;
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const objectIsFull = (obj) => {
|
|
60
|
+
return !Object.keys(obj).find((k) => obj[k] == undefined);
|
|
61
|
+
};
|
|
62
|
+
const taxTypeToName = (taxType) => {
|
|
63
|
+
switch (taxType) {
|
|
64
|
+
case "W9":
|
|
65
|
+
return "W-9";
|
|
66
|
+
case "W8BEN":
|
|
67
|
+
case "W8BENE":
|
|
68
|
+
return "W-8";
|
|
69
|
+
default:
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
function validateBillingField(regex, value) {
|
|
74
|
+
const trimmed = value.trim();
|
|
75
|
+
const idx = trimmed.search(regex);
|
|
76
|
+
return idx > -1;
|
|
77
|
+
}
|
|
78
|
+
const formatErrorMessage = (fieldName, errorMessage) => {
|
|
79
|
+
return intl.formatMessage({
|
|
80
|
+
id: fieldName,
|
|
81
|
+
defaultMessage: errorMessage,
|
|
82
|
+
}, {
|
|
83
|
+
fieldName,
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
function getCountryObj({ countryCode, locale, }) {
|
|
87
|
+
// @ts-ignore DisplayNames not in Intl type
|
|
88
|
+
const displayName = new Intl.DisplayNames([locale], {
|
|
89
|
+
type: "region",
|
|
90
|
+
}).of(countryCode);
|
|
91
|
+
return {
|
|
92
|
+
countryCode,
|
|
93
|
+
displayName,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { LoadingView as L, validateBillingField as a, formatErrorMessage as f, getCountryObj as g, objectIsFull as o, taxTypeToName as t, validTaxDocument as v };
|