@saasquatch/mint-components 1.12.0-4 → 1.12.0-6
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/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +47 -18
- package/dist/cjs/sqm-big-stat_39.cjs.entry.js +22 -4
- package/dist/cjs/sqm-code-verification.cjs.entry.js +34 -48
- package/dist/cjs/sqm-email-verification.cjs.entry.js +143 -21
- package/dist/cjs/{sqm-invoice-table-view-dbba9bb4.js → sqm-invoice-table-view-e530775f.js} +39 -0
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +19 -1
- package/dist/cjs/sqm-widget-verification-internal.cjs.entry.js +53 -7
- package/dist/cjs/sqm-widget-verification.cjs.entry.js +15 -18
- package/dist/cjs/useVerificationEmail-35aea294.js +170 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.js +7 -0
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.js +1 -1
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.js +20 -2
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.js +33 -24
- package/dist/collection/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.js +19 -42
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-internal.js +55 -7
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +17 -20
- package/dist/collection/components/sqm-widget-verification/useVerificationEmail.js +165 -0
- package/dist/collection/components/tax-and-cash/BankingForm.stories.js +1 -0
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +38 -0
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +2 -1
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +7 -0
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.js +8 -0
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +8 -3
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +11 -1
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +9 -1
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/data.js +5 -0
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +8 -8
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +11 -0
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +10 -9
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +2 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +14 -11
- package/dist/esm/{keys-a1496e39.js → keys-db1897ae.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_16.entry.js +48 -19
- package/dist/esm/sqm-big-stat_39.entry.js +22 -4
- package/dist/esm/sqm-code-verification.entry.js +36 -50
- package/dist/esm/sqm-email-verification.entry.js +127 -5
- package/dist/esm/{sqm-invoice-table-view-663674f2.js → sqm-invoice-table-view-22bb7240.js} +39 -0
- package/dist/esm/sqm-stencilbook.entry.js +19 -1
- package/dist/esm/sqm-widget-verification-internal.entry.js +53 -7
- package/dist/esm/sqm-widget-verification.entry.js +17 -20
- package/dist/esm/useVerificationEmail-02b78bd7.js +168 -0
- package/dist/esm-es5/{keys-a1496e39.js → keys-db1897ae.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
- package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
- package/dist/esm-es5/sqm-email-verification.entry.js +1 -1
- package/dist/esm-es5/sqm-invoice-table-view-22bb7240.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-widget-verification-internal.entry.js +1 -1
- package/dist/esm-es5/sqm-widget-verification.entry.js +1 -1
- package/dist/esm-es5/useVerificationEmail-02b78bd7.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-53d9df5e.entry.js → p-0aebee07.entry.js} +8 -3
- package/dist/mint-components/p-116c1809.entry.js +11 -0
- package/dist/mint-components/{p-99a09fab.entry.js → p-126a4f24.entry.js} +2 -2
- package/dist/mint-components/{p-d4138847.system.entry.js → p-28450e40.system.entry.js} +1 -1
- package/dist/mint-components/p-2b5b2586.system.js +1 -0
- package/dist/mint-components/p-39840341.js +1 -0
- package/dist/mint-components/p-4606b096.entry.js +12 -0
- package/dist/mint-components/p-46a5718f.system.entry.js +1 -0
- package/dist/mint-components/{p-ff77d11f.entry.js → p-4986a616.entry.js} +10 -10
- package/dist/mint-components/p-4a43ffbd.js +1 -0
- package/dist/mint-components/p-696e634f.system.entry.js +1 -0
- package/dist/mint-components/p-71b8adf7.system.js +1 -0
- package/dist/mint-components/p-7666cd3d.js +48 -0
- package/dist/mint-components/p-87bf9880.entry.js +25 -0
- package/dist/mint-components/p-8a7d2170.system.entry.js +1 -0
- package/dist/mint-components/p-a5eedbe2.system.entry.js +1 -0
- package/dist/mint-components/p-a60ec391.system.entry.js +1 -0
- package/dist/mint-components/p-b2a99637.system.js +1 -0
- package/dist/mint-components/p-ca423ca2.system.entry.js +1 -0
- package/dist/mint-components/p-e05ff098.system.js +1 -1
- package/dist/mint-components/p-e373b78a.entry.js +1 -0
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.d.ts +1 -0
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.d.ts +1 -0
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.d.ts +4 -0
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.d.ts +2 -1
- package/dist/types/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.d.ts +0 -6
- package/dist/types/components/sqm-widget-verification/useVerificationEmail.d.ts +14 -0
- package/dist/types/components/tax-and-cash/TaxForm.stories.d.ts +1 -0
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +1 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.d.ts +1 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +5 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +5 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +5 -0
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/data.d.ts +5 -0
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +2 -2
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +3 -0
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +2 -2
- package/dist/types/components.d.ts +60 -52
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/useEmailVerification-33465f36.js +0 -155
- package/dist/collection/components/sqm-widget-verification/useWidgetVerification.js +0 -3
- package/dist/esm/useEmailVerification-8f2dc2bd.js +0 -152
- package/dist/esm-es5/sqm-invoice-table-view-663674f2.js +0 -1
- package/dist/esm-es5/useEmailVerification-8f2dc2bd.js +0 -1
- package/dist/mint-components/p-158e9d3a.entry.js +0 -1
- package/dist/mint-components/p-20c5ce3d.system.entry.js +0 -1
- package/dist/mint-components/p-219be817.system.entry.js +0 -1
- package/dist/mint-components/p-2c03096f.system.entry.js +0 -1
- package/dist/mint-components/p-4c9b6fbe.system.js +0 -1
- package/dist/mint-components/p-4d060f15.js +0 -1
- package/dist/mint-components/p-5810e318.entry.js +0 -1
- package/dist/mint-components/p-6029c42d.entry.js +0 -8
- package/dist/mint-components/p-6cae44d7.js +0 -1
- package/dist/mint-components/p-78c1bd77.system.js +0 -1
- package/dist/mint-components/p-80a32fe9.system.entry.js +0 -1
- package/dist/mint-components/p-a2baff3e.entry.js +0 -1
- package/dist/mint-components/p-b52b7e60.system.entry.js +0 -1
- package/dist/mint-components/p-f4dff47a.system.entry.js +0 -1
- package/dist/mint-components/p-faf019cf.system.js +0 -1
- package/dist/mint-components/p-fcb224ab.js +0 -25
- package/dist/types/components/sqm-widget-verification/useWidgetVerification.d.ts +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { h, r as registerInstance } from './index-17b4da69.js';
|
|
2
2
|
import { l, f as useState, d as useEffect, j as h$1 } from './stencil-hooks.module-3c7f7c90.js';
|
|
3
3
|
import { i as intl } from './global-adae7650.js';
|
|
4
|
-
import { M as Mn, D as Dn,
|
|
4
|
+
import { M as Mn, D as Dn, i as isDemo, S as Sn } from './index.module-c0eb7dc2.js';
|
|
5
5
|
import { c as cjs } from './cjs-bdfb4486.js';
|
|
6
6
|
import { E as ErrorStyles } from './mixins-f60a614c.js';
|
|
7
7
|
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
8
8
|
import { d as dist } from './index-0c7b14c5.js';
|
|
9
9
|
import { g as getProps } from './utils-334c1e34.js';
|
|
10
10
|
import { T as TextSpanView } from './sqm-text-span-view-8d140661.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { a as VERIFICATION_EMAIL_NAMESPACE, S as SHOW_CODE_NAMESPACE, V as VERIFICATION_PARENT_NAMESPACE } from './keys-db1897ae.js';
|
|
12
|
+
import { u as useVerificationEmail } from './useVerificationEmail-02b78bd7.js';
|
|
13
13
|
|
|
14
14
|
const style = {
|
|
15
15
|
Wrapper: {
|
|
@@ -130,43 +130,22 @@ function WidgetCodeVerificationView(props) {
|
|
|
130
130
|
h("sl-input", { class: inputClass, name: "code" }),
|
|
131
131
|
h("sl-input", { class: inputClass, name: "code" })),
|
|
132
132
|
states.verifyFailed && (h("p", { class: sheet.classes.ErrorText }, text.invalidCodeText)),
|
|
133
|
-
h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.submitCode, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, text.verifyText)),
|
|
133
|
+
h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.submitCode, disabled: states.loading || states.initialiseLoading, loading: states.loading || states.initialiseLoading, exportparts: "base: primarybutton-base", type: "primary" }, text.verifyText)),
|
|
134
134
|
h("div", { class: sheet.classes.FooterContainer },
|
|
135
135
|
h(TextSpanView, { type: "p" }, resendCodeText)))));
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
// TODO: Move to component-boilerplate
|
|
139
138
|
const VerifyEmailWithCodeMutation = dist.gql `
|
|
140
|
-
mutation
|
|
141
|
-
|
|
139
|
+
mutation submitImpactPublisherEmail2FACode(
|
|
140
|
+
$user: UserIdInput!
|
|
141
|
+
$code: String!
|
|
142
|
+
) {
|
|
143
|
+
submitImpactPublisherEmail2FACode(user: $user, code: $code) {
|
|
142
144
|
verifiedEmail
|
|
143
145
|
accessKey
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
`;
|
|
147
|
-
function useCodeVerificationMutation() {
|
|
148
|
-
const user = K();
|
|
149
|
-
const [request, { loading, data, errors }] = xe(VerifyEmailWithCodeMutation);
|
|
150
|
-
const verifyUserWithCodeMutation = async (code) => {
|
|
151
|
-
try {
|
|
152
|
-
const result = await request({
|
|
153
|
-
user: {
|
|
154
|
-
id: user.id,
|
|
155
|
-
accountId: user.accountId,
|
|
156
|
-
},
|
|
157
|
-
code,
|
|
158
|
-
});
|
|
159
|
-
if (result instanceof Error || !result)
|
|
160
|
-
throw new Error();
|
|
161
|
-
return result;
|
|
162
|
-
}
|
|
163
|
-
catch (e) {
|
|
164
|
-
console.error("Failed to verify user", e);
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
return [verifyUserWithCodeMutation, { loading, data, errors }];
|
|
169
|
-
}
|
|
170
149
|
function useWidgetCodeVerification(props) {
|
|
171
150
|
const host = l();
|
|
172
151
|
const [_, setShowCode] = Mn(SHOW_CODE_NAMESPACE);
|
|
@@ -176,9 +155,10 @@ function useWidgetCodeVerification(props) {
|
|
|
176
155
|
const [codeRef, setCodeRef] = useState(null);
|
|
177
156
|
const [validationError, setValidationError] = useState(false);
|
|
178
157
|
const [emailError, setEmailError] = useState(false);
|
|
179
|
-
// TODO: Need to handle error states for these errors
|
|
180
|
-
const [verifyUser, { loading: verifyLoading, errors: verifyErrors }] =
|
|
181
|
-
|
|
158
|
+
// // TODO: Need to handle error states for these errors
|
|
159
|
+
// const [verifyUser, { loading: verifyLoading, errors: verifyErrors }] =
|
|
160
|
+
// useCodeVerificationMutation();
|
|
161
|
+
const { initialized, send: [sendEmail, { loading: sendLoading, errors: sendErrors }], verify: [verifyEmail, { loading: verifyLoading, errors: verifyErrors }], } = useVerificationEmail();
|
|
182
162
|
useEffect(() => {
|
|
183
163
|
if (!codeRef)
|
|
184
164
|
return;
|
|
@@ -194,7 +174,7 @@ function useWidgetCodeVerification(props) {
|
|
|
194
174
|
}
|
|
195
175
|
});
|
|
196
176
|
element.addEventListener("input", (e) => {
|
|
197
|
-
const input = e.
|
|
177
|
+
const input = e.data;
|
|
198
178
|
if (!input)
|
|
199
179
|
return;
|
|
200
180
|
if (idx === codeElements.length - 1) {
|
|
@@ -204,8 +184,10 @@ function useWidgetCodeVerification(props) {
|
|
|
204
184
|
if (input.length > 1) {
|
|
205
185
|
const rest = input.slice(1);
|
|
206
186
|
e.target.value = input.slice(0, 1);
|
|
207
|
-
codeElements[idx + 1].
|
|
208
|
-
|
|
187
|
+
codeElements[idx + 1].dispatchEvent(new InputEvent("input", {
|
|
188
|
+
inputType: "insertFromPaste",
|
|
189
|
+
data: rest,
|
|
190
|
+
}));
|
|
209
191
|
}
|
|
210
192
|
codeElements[idx + 1].focus();
|
|
211
193
|
});
|
|
@@ -216,7 +198,10 @@ function useWidgetCodeVerification(props) {
|
|
|
216
198
|
setValidationError(false);
|
|
217
199
|
};
|
|
218
200
|
const resendEmail = async () => {
|
|
219
|
-
|
|
201
|
+
// UI should only allow this to be called if initialized, but checking just in case
|
|
202
|
+
if (!initialized)
|
|
203
|
+
return;
|
|
204
|
+
const result = await sendEmail();
|
|
220
205
|
if (!result) {
|
|
221
206
|
setEmailError(true);
|
|
222
207
|
return;
|
|
@@ -236,16 +221,13 @@ function useWidgetCodeVerification(props) {
|
|
|
236
221
|
codeElements.forEach((element) => {
|
|
237
222
|
code = `${code}${element.value}`;
|
|
238
223
|
});
|
|
224
|
+
// UI should only allow this to be called if initialized, but checking just in case
|
|
225
|
+
if (!initialized)
|
|
226
|
+
return;
|
|
239
227
|
setValidationError(false);
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const event = new CustomEvent(VERIFICATION_EVENT_KEY, {
|
|
244
|
-
detail: { token: res.verifyUserEmail.accessKey },
|
|
245
|
-
composed: true,
|
|
246
|
-
bubbles: true,
|
|
247
|
-
});
|
|
248
|
-
host.dispatchEvent(event);
|
|
228
|
+
const res = await verifyEmail(code);
|
|
229
|
+
if (res === null || res === void 0 ? void 0 : res.success) {
|
|
230
|
+
props.onVerification(res.accessKey);
|
|
249
231
|
reset();
|
|
250
232
|
}
|
|
251
233
|
else {
|
|
@@ -253,12 +235,15 @@ function useWidgetCodeVerification(props) {
|
|
|
253
235
|
}
|
|
254
236
|
};
|
|
255
237
|
useEffect(() => {
|
|
238
|
+
// Wait for mutations to be determined from user lookup
|
|
239
|
+
if (!initialized)
|
|
240
|
+
return;
|
|
256
241
|
// email should already exist if user has completed email-verification
|
|
257
242
|
if (!email)
|
|
258
243
|
resendEmail();
|
|
259
244
|
else
|
|
260
245
|
setEmailSent(true);
|
|
261
|
-
}, []);
|
|
246
|
+
}, [initialized]);
|
|
262
247
|
return {
|
|
263
248
|
refs: {
|
|
264
249
|
codeWrapperRef: setCodeRef,
|
|
@@ -266,8 +251,9 @@ function useWidgetCodeVerification(props) {
|
|
|
266
251
|
states: {
|
|
267
252
|
email,
|
|
268
253
|
emailResent,
|
|
269
|
-
resendError:
|
|
270
|
-
|
|
254
|
+
resendError: sendErrors || verifyErrors,
|
|
255
|
+
initialiseLoading: !initialized,
|
|
256
|
+
loading: sendLoading || verifyLoading,
|
|
271
257
|
verifyFailed: !!validationError,
|
|
272
258
|
},
|
|
273
259
|
callbacks: {
|
|
@@ -347,7 +333,7 @@ function useDemoWidgetCodeVerification(props) {
|
|
|
347
333
|
},
|
|
348
334
|
callbacks: {
|
|
349
335
|
resendEmail: async () => setEmailResent(true),
|
|
350
|
-
submitCode: async () => setVerifiedContext(
|
|
336
|
+
submitCode: async () => setVerifiedContext(true),
|
|
351
337
|
},
|
|
352
338
|
text: props.getTextProps(),
|
|
353
339
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
@@ -1,13 +1,135 @@
|
|
|
1
1
|
import { h, r as registerInstance } from './index-17b4da69.js';
|
|
2
|
-
import { j as h$1 } from './stencil-hooks.module-3c7f7c90.js';
|
|
3
|
-
import { i as isDemo, S as Sn } from './index.module-c0eb7dc2.js';
|
|
2
|
+
import { f as useState, d as useEffect, j as h$1 } from './stencil-hooks.module-3c7f7c90.js';
|
|
3
|
+
import { M as Mn, E as En, K, b as xe, i as isDemo, S as Sn } from './index.module-c0eb7dc2.js';
|
|
4
4
|
import { c as cjs } from './cjs-bdfb4486.js';
|
|
5
5
|
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
6
|
-
import './index-0c7b14c5.js';
|
|
6
|
+
import { d as dist } from './index-0c7b14c5.js';
|
|
7
7
|
import { g as getProps } from './utils-334c1e34.js';
|
|
8
8
|
import { T as TextSpanView } from './sqm-text-span-view-8d140661.js';
|
|
9
|
-
import { S as SHOW_CODE_NAMESPACE } from './keys-
|
|
10
|
-
import { u as
|
|
9
|
+
import { S as SHOW_CODE_NAMESPACE, a as VERIFICATION_EMAIL_NAMESPACE } from './keys-db1897ae.js';
|
|
10
|
+
import { u as useVerificationEmail } from './useVerificationEmail-02b78bd7.js';
|
|
11
|
+
|
|
12
|
+
const UpsertUserEmailMutation = dist.gql `
|
|
13
|
+
mutation upsertUser($userInput: UserInput!) {
|
|
14
|
+
user(userInput: $userInput) {
|
|
15
|
+
id
|
|
16
|
+
accountId
|
|
17
|
+
email
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
const UserLookupQuery = dist.gql `
|
|
22
|
+
query user {
|
|
23
|
+
viewer {
|
|
24
|
+
... on User {
|
|
25
|
+
id
|
|
26
|
+
accountId
|
|
27
|
+
email
|
|
28
|
+
impactConnection {
|
|
29
|
+
user {
|
|
30
|
+
id
|
|
31
|
+
email
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
function useUpsertUserEmail() {
|
|
39
|
+
const user = K();
|
|
40
|
+
const [request, { loading: loading, data, errors }] = xe(UpsertUserEmailMutation);
|
|
41
|
+
const upsertUserEmail = async (email) => {
|
|
42
|
+
try {
|
|
43
|
+
const result = await request({
|
|
44
|
+
user: {
|
|
45
|
+
id: user.id,
|
|
46
|
+
accountId: user.accountId,
|
|
47
|
+
email,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
if (result instanceof Error || !result)
|
|
51
|
+
throw new Error();
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
console.error("Could not set email on user", e);
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return [
|
|
60
|
+
upsertUserEmail,
|
|
61
|
+
{
|
|
62
|
+
loading,
|
|
63
|
+
data,
|
|
64
|
+
errors,
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
function useWidgetEmailVerification(props) {
|
|
69
|
+
const [_, setShowCode] = Mn(SHOW_CODE_NAMESPACE);
|
|
70
|
+
const [email, setEmail] = Mn(VERIFICATION_EMAIL_NAMESPACE);
|
|
71
|
+
const [emailExists, setEmailExists] = useState(false);
|
|
72
|
+
const [error, setError] = useState(false);
|
|
73
|
+
const [mutationError, setMutationError] = useState(false);
|
|
74
|
+
const { initialized, send: [sendEmail, { loading: sendLoading, errors }], } = useVerificationEmail();
|
|
75
|
+
const [upsertUserEmail] = useUpsertUserEmail();
|
|
76
|
+
const [loading, setLoading] = useState(true);
|
|
77
|
+
const { data, loading: initialLoading } = En(UserLookupQuery, {});
|
|
78
|
+
const emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (!(data === null || data === void 0 ? void 0 : data.viewer))
|
|
81
|
+
return;
|
|
82
|
+
setEmailExists(!!data.viewer.email);
|
|
83
|
+
}, [data]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (initialized)
|
|
86
|
+
setLoading(false);
|
|
87
|
+
}, [initialized]);
|
|
88
|
+
const submitEmail = async (e) => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
if (!(data === null || data === void 0 ? void 0 : data.viewer))
|
|
91
|
+
return;
|
|
92
|
+
setLoading(true);
|
|
93
|
+
const toAddress = data.viewer.email;
|
|
94
|
+
if (!toAddress) {
|
|
95
|
+
// If no email on the user, set one
|
|
96
|
+
const formData = e.detail.formData;
|
|
97
|
+
const newEmail = formData.get("email").toString();
|
|
98
|
+
if (!emailRegex.test(newEmail)) {
|
|
99
|
+
setError(true);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const result = await upsertUserEmail(newEmail);
|
|
103
|
+
if (!result || !result.user.email)
|
|
104
|
+
setError(true);
|
|
105
|
+
}
|
|
106
|
+
// UI should not allow this call til initialisation is done
|
|
107
|
+
if (!initialized)
|
|
108
|
+
return;
|
|
109
|
+
const result = await sendEmail();
|
|
110
|
+
if (!result || !result.success)
|
|
111
|
+
setMutationError(true);
|
|
112
|
+
else {
|
|
113
|
+
// This is used to let the code verification widget know an email was already sent
|
|
114
|
+
setEmail(toAddress);
|
|
115
|
+
setShowCode(true);
|
|
116
|
+
}
|
|
117
|
+
setLoading(false);
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
callbacks: {
|
|
121
|
+
submitEmail,
|
|
122
|
+
},
|
|
123
|
+
states: {
|
|
124
|
+
loading,
|
|
125
|
+
initialLoading: initialLoading && !initialized,
|
|
126
|
+
error,
|
|
127
|
+
email: data === null || data === void 0 ? void 0 : data.viewer.email,
|
|
128
|
+
sendCodeError: mutationError,
|
|
129
|
+
},
|
|
130
|
+
text: props.getTextProps(),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
11
133
|
|
|
12
134
|
const style = {
|
|
13
135
|
Wrapper: {
|
|
@@ -712,6 +712,7 @@ const stepFourProps = {
|
|
|
712
712
|
},
|
|
713
713
|
},
|
|
714
714
|
callbacks: {
|
|
715
|
+
onVerification: () => { },
|
|
715
716
|
onSubmit: async () => console.log("Submit"),
|
|
716
717
|
setPaymentMethodChecked: () => { },
|
|
717
718
|
setPaymentScheduleChecked: () => { },
|
|
@@ -759,6 +760,7 @@ const dashboardProps = {
|
|
|
759
760
|
indirectTaxNumber: "123456",
|
|
760
761
|
indirectTaxType: "VAT",
|
|
761
762
|
showNewFormDialog: false,
|
|
763
|
+
hasHold: false,
|
|
762
764
|
},
|
|
763
765
|
slots: {
|
|
764
766
|
payoutDetailsCardSlot: (h("sqm-payout-details-card", { demoData: {
|
|
@@ -1273,6 +1275,7 @@ const TaxAndCashDashboardActiveW8BENForm = () => {
|
|
|
1273
1275
|
indirectTaxType: "VAT",
|
|
1274
1276
|
indirectTaxNumber: "123456",
|
|
1275
1277
|
showNewFormDialog: false,
|
|
1278
|
+
hasHold: false,
|
|
1276
1279
|
},
|
|
1277
1280
|
} }));
|
|
1278
1281
|
};
|
|
@@ -1288,6 +1291,7 @@ const TaxAndCashDashboardActiveW8BENEForm = () => {
|
|
|
1288
1291
|
indirectTaxType: "VAT",
|
|
1289
1292
|
indirectTaxNumber: "123456",
|
|
1290
1293
|
showNewFormDialog: false,
|
|
1294
|
+
hasHold: false,
|
|
1291
1295
|
},
|
|
1292
1296
|
} }));
|
|
1293
1297
|
};
|
|
@@ -1304,6 +1308,7 @@ const TaxAndCashDashboardNotActiveW9Form = () => {
|
|
|
1304
1308
|
indirectTaxType: "VAT",
|
|
1305
1309
|
indirectTaxNumber: "123456",
|
|
1306
1310
|
showNewFormDialog: false,
|
|
1311
|
+
hasHold: false,
|
|
1307
1312
|
},
|
|
1308
1313
|
} }));
|
|
1309
1314
|
};
|
|
@@ -1321,6 +1326,7 @@ const TaxAndCashDashboardNotVerifiedW9Form = () => {
|
|
|
1321
1326
|
indirectTaxType: "VAT",
|
|
1322
1327
|
indirectTaxNumber: "123456",
|
|
1323
1328
|
showNewFormDialog: false,
|
|
1329
|
+
hasHold: false,
|
|
1324
1330
|
},
|
|
1325
1331
|
} }));
|
|
1326
1332
|
};
|
|
@@ -1339,6 +1345,7 @@ const TaxAndCashDashboardNotVerifiedW8BENForm = () => {
|
|
|
1339
1345
|
indirectTaxType: "VAT",
|
|
1340
1346
|
indirectTaxNumber: "123456",
|
|
1341
1347
|
showNewFormDialog: false,
|
|
1348
|
+
hasHold: false,
|
|
1342
1349
|
},
|
|
1343
1350
|
} }));
|
|
1344
1351
|
};
|
|
@@ -1357,6 +1364,7 @@ const TaxAndCashDashboardNotVerifiedW8BENEForm = () => {
|
|
|
1357
1364
|
indirectTaxType: "VAT",
|
|
1358
1365
|
indirectTaxNumber: "123456",
|
|
1359
1366
|
showNewFormDialog: false,
|
|
1367
|
+
hasHold: false,
|
|
1360
1368
|
},
|
|
1361
1369
|
} }));
|
|
1362
1370
|
};
|
|
@@ -1375,6 +1383,7 @@ const TaxAndCashDashboardNotActiveW8BENEForm = () => {
|
|
|
1375
1383
|
indirectTaxType: "VAT",
|
|
1376
1384
|
country: "United Kingdom",
|
|
1377
1385
|
showNewFormDialog: false,
|
|
1386
|
+
hasHold: false,
|
|
1378
1387
|
},
|
|
1379
1388
|
} }));
|
|
1380
1389
|
};
|
|
@@ -1393,6 +1402,7 @@ const TaxAndCashDashboardNoFormNeeded = () => {
|
|
|
1393
1402
|
indirectTaxNumber: "123456",
|
|
1394
1403
|
indirectTaxType: "GST",
|
|
1395
1404
|
showNewFormDialog: false,
|
|
1405
|
+
hasHold: false,
|
|
1396
1406
|
},
|
|
1397
1407
|
} }));
|
|
1398
1408
|
};
|
|
@@ -1412,6 +1422,7 @@ const TaxAndCashDashboardIndirectTaxCanada = () => {
|
|
|
1412
1422
|
indirectTaxType: "GST",
|
|
1413
1423
|
indirectTaxNumber: "123456",
|
|
1414
1424
|
showNewFormDialog: false,
|
|
1425
|
+
hasHold: false,
|
|
1415
1426
|
},
|
|
1416
1427
|
} }));
|
|
1417
1428
|
};
|
|
@@ -1432,6 +1443,7 @@ const TaxAndCashDashboardIndirectTaxCanadaQuebec = () => {
|
|
|
1432
1443
|
indirectTaxNumber: "123456",
|
|
1433
1444
|
qstNumber: "44212",
|
|
1434
1445
|
showNewFormDialog: false,
|
|
1446
|
+
hasHold: false,
|
|
1435
1447
|
},
|
|
1436
1448
|
} }));
|
|
1437
1449
|
};
|
|
@@ -1452,6 +1464,7 @@ const TaxAndCashDashboardIndirectTaxSpain = () => {
|
|
|
1452
1464
|
indirectTaxNumber: "123456",
|
|
1453
1465
|
subRegionTaxNumber: "44212",
|
|
1454
1466
|
showNewFormDialog: false,
|
|
1467
|
+
hasHold: false,
|
|
1455
1468
|
},
|
|
1456
1469
|
} }));
|
|
1457
1470
|
};
|
|
@@ -1467,6 +1480,7 @@ const TaxAndCashDashboardIndirectTaxNotRegistered = () => {
|
|
|
1467
1480
|
noFormNeeded: false,
|
|
1468
1481
|
notRegistered: true,
|
|
1469
1482
|
showNewFormDialog: false,
|
|
1483
|
+
hasHold: false,
|
|
1470
1484
|
},
|
|
1471
1485
|
} }));
|
|
1472
1486
|
};
|
|
@@ -1484,6 +1498,7 @@ const TaxAndCashDashboardIdentityVerifcationRequired = () => {
|
|
|
1484
1498
|
noFormNeeded: false,
|
|
1485
1499
|
notRegistered: true,
|
|
1486
1500
|
showNewFormDialog: false,
|
|
1501
|
+
hasHold: false,
|
|
1487
1502
|
},
|
|
1488
1503
|
} }));
|
|
1489
1504
|
};
|
|
@@ -1499,6 +1514,25 @@ const TaxAndCashDashboardNewTaxForm = () => {
|
|
|
1499
1514
|
noFormNeeded: false,
|
|
1500
1515
|
notRegistered: true,
|
|
1501
1516
|
showNewFormDialog: true,
|
|
1517
|
+
hasHold: false,
|
|
1518
|
+
},
|
|
1519
|
+
} }));
|
|
1520
|
+
};
|
|
1521
|
+
const TaxAndCashDashboardPayoutsOnHold = () => {
|
|
1522
|
+
return (h("sqm-tax-and-cash-dashboard", { demoData: {
|
|
1523
|
+
...dashboardProps,
|
|
1524
|
+
states: {
|
|
1525
|
+
canEditPayoutInfo: true,
|
|
1526
|
+
disabled: true,
|
|
1527
|
+
status: "ACTIVE",
|
|
1528
|
+
documentType: "W8BEN",
|
|
1529
|
+
documentTypeString: taxTypeToName("W8BEN"),
|
|
1530
|
+
dateSubmitted: "Jan 18th, 2025",
|
|
1531
|
+
noFormNeeded: false,
|
|
1532
|
+
indirectTaxNumber: "123456",
|
|
1533
|
+
country: "Slovania",
|
|
1534
|
+
showNewFormDialog: false,
|
|
1535
|
+
hasHold: true,
|
|
1502
1536
|
},
|
|
1503
1537
|
} }));
|
|
1504
1538
|
};
|
|
@@ -1515,6 +1549,7 @@ const TaxAndCashDashboardLoading = () => {
|
|
|
1515
1549
|
noFormNeeded: false,
|
|
1516
1550
|
loading: true,
|
|
1517
1551
|
showNewFormDialog: false,
|
|
1552
|
+
hasHold: false,
|
|
1518
1553
|
},
|
|
1519
1554
|
} }));
|
|
1520
1555
|
};
|
|
@@ -1532,6 +1567,7 @@ const TaxAndCashDashboardWithLoadingError = () => {
|
|
|
1532
1567
|
loading: true,
|
|
1533
1568
|
loadingError: true,
|
|
1534
1569
|
showNewFormDialog: false,
|
|
1570
|
+
hasHold: false,
|
|
1535
1571
|
},
|
|
1536
1572
|
} }));
|
|
1537
1573
|
};
|
|
@@ -1550,6 +1586,7 @@ const TaxAndCashDashboardWithGeneralError = () => {
|
|
|
1550
1586
|
indirectTaxType: "VAT",
|
|
1551
1587
|
country: "Slovania",
|
|
1552
1588
|
showNewFormDialog: false,
|
|
1589
|
+
hasHold: false,
|
|
1553
1590
|
errors: {
|
|
1554
1591
|
general: true,
|
|
1555
1592
|
},
|
|
@@ -1570,6 +1607,7 @@ const TaxAndCashDashboardDisabled = () => {
|
|
|
1570
1607
|
indirectTaxNumber: "123456",
|
|
1571
1608
|
country: "Slovania",
|
|
1572
1609
|
showNewFormDialog: false,
|
|
1610
|
+
hasHold: false,
|
|
1573
1611
|
},
|
|
1574
1612
|
} }));
|
|
1575
1613
|
};
|
|
@@ -1638,6 +1676,7 @@ const TaxForm = /*#__PURE__*/Object.freeze({
|
|
|
1638
1676
|
TaxAndCashDashboardIndirectTaxNotRegistered: TaxAndCashDashboardIndirectTaxNotRegistered,
|
|
1639
1677
|
TaxAndCashDashboardIdentityVerifcationRequired: TaxAndCashDashboardIdentityVerifcationRequired,
|
|
1640
1678
|
TaxAndCashDashboardNewTaxForm: TaxAndCashDashboardNewTaxForm,
|
|
1679
|
+
TaxAndCashDashboardPayoutsOnHold: TaxAndCashDashboardPayoutsOnHold,
|
|
1641
1680
|
TaxAndCashDashboardLoading: TaxAndCashDashboardLoading,
|
|
1642
1681
|
TaxAndCashDashboardWithLoadingError: TaxAndCashDashboardWithLoadingError,
|
|
1643
1682
|
TaxAndCashDashboardWithGeneralError: TaxAndCashDashboardWithGeneralError,
|
|
@@ -27,7 +27,7 @@ import { P as PortalResetPasswordView } from './sqm-portal-reset-password-view-7
|
|
|
27
27
|
import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-d7ea2c56.js';
|
|
28
28
|
import { S as ShareButtonView, L as LeaderboardView, C as CopyTextView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalLoginView, f as PortalRegisterView, T as TaskCardView, g as ProgressBarView, h as PoweredByImg$1, i as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, j as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, k as RewardExchangeView, r as rewardExchangeCustomErrorMsg, l as rewardExchangeLongText, m as rewardExchangeSelected, n as chooseAmountFixed, o as chooseAmountFixedNoDescription, p as chooseAmountVariable, q as chooseAmountVariableNoDescription, s as chooseAmountVariableDisabled, t as chooseAmountVariableUnavailable, v as confirmFixed, w as confirmVariable, x as redemptionError, y as queryError, z as success, A as successVariable, F as loading, G as empty$1, J as rewardExchange, K as CardFeedView, M as CouponCodeView, O as ProgressBar$2, Q as autoColorScaleCss, U as ShadowViewAddon } from './ShadowViewAddon-72e231a5.js';
|
|
29
29
|
import { P as PortalContainerView, a as PortalSectionView } from './sqm-portal-container-view-6c582684.js';
|
|
30
|
-
import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-
|
|
30
|
+
import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-22bb7240.js';
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -14409,6 +14409,7 @@ const bankingFormProps = {
|
|
|
14409
14409
|
loadingError: false,
|
|
14410
14410
|
},
|
|
14411
14411
|
callbacks: {
|
|
14412
|
+
onVerification: () => { },
|
|
14412
14413
|
onSubmit: async () => console.log("Submit"),
|
|
14413
14414
|
setPaymentMethodChecked: () => { },
|
|
14414
14415
|
setPaymentScheduleChecked: () => { },
|
|
@@ -15048,12 +15049,19 @@ const WidgetCodeVerification_stories = {
|
|
|
15048
15049
|
title: "Components/Widget Code Verification",
|
|
15049
15050
|
};
|
|
15050
15051
|
const defaultProps$l = {
|
|
15052
|
+
initialiseLoading: false,
|
|
15051
15053
|
email: "testemail@example.com",
|
|
15052
15054
|
loading: false,
|
|
15053
15055
|
verifyFailed: false,
|
|
15054
15056
|
emailResent: false,
|
|
15055
15057
|
};
|
|
15056
15058
|
const Default$j = () => (h("sqm-code-verification", { demoData: { states: defaultProps$l } }));
|
|
15059
|
+
const InitialLoading = () => (h("sqm-code-verification", { demoData: {
|
|
15060
|
+
states: {
|
|
15061
|
+
...defaultProps$l,
|
|
15062
|
+
initialiseLoading: true,
|
|
15063
|
+
},
|
|
15064
|
+
} }));
|
|
15057
15065
|
const Loading$8 = () => (h("sqm-code-verification", { demoData: {
|
|
15058
15066
|
states: {
|
|
15059
15067
|
...defaultProps$l,
|
|
@@ -15077,6 +15085,7 @@ const WidgetCodeVerification = /*#__PURE__*/Object.freeze({
|
|
|
15077
15085
|
__proto__: null,
|
|
15078
15086
|
'default': WidgetCodeVerification_stories,
|
|
15079
15087
|
Default: Default$j,
|
|
15088
|
+
InitialLoading: InitialLoading,
|
|
15080
15089
|
Loading: Loading$8,
|
|
15081
15090
|
CodeResent: CodeResent,
|
|
15082
15091
|
VerificationFailed: VerificationFailed
|
|
@@ -15102,9 +15111,17 @@ const PayoutStatusAlert_stories = {
|
|
|
15102
15111
|
const defaultProps$n = {
|
|
15103
15112
|
status: "INFORMATION_REQUIRED",
|
|
15104
15113
|
loading: false,
|
|
15114
|
+
showVerifyIdentity: false,
|
|
15105
15115
|
};
|
|
15106
15116
|
const InformationRequired = () => (h("sqm-payout-status-alert", { demoData: { states: defaultProps$n } }));
|
|
15107
15117
|
const VerifyIdentity = () => (h("sqm-payout-status-alert", { demoData: { states: { ...defaultProps$n, status: "VERIFICATION_NEEDED" } } }));
|
|
15118
|
+
const VerifyIdentityOpen = () => (h("sqm-payout-status-alert", { demoData: {
|
|
15119
|
+
states: {
|
|
15120
|
+
...defaultProps$n,
|
|
15121
|
+
status: "VERIFICATION_NEEDED",
|
|
15122
|
+
showVerifyIdentity: true,
|
|
15123
|
+
},
|
|
15124
|
+
} }));
|
|
15108
15125
|
const Hold = () => (h("sqm-payout-status-alert", { demoData: { states: { ...defaultProps$n, status: "HOLD" } } }));
|
|
15109
15126
|
const Loading$9 = () => (h("sqm-payout-status-alert", { demoData: { states: { ...defaultProps$n, loading: true } } }));
|
|
15110
15127
|
|
|
@@ -15113,6 +15130,7 @@ const PayoutStatusAlert = /*#__PURE__*/Object.freeze({
|
|
|
15113
15130
|
'default': PayoutStatusAlert_stories,
|
|
15114
15131
|
InformationRequired: InformationRequired,
|
|
15115
15132
|
VerifyIdentity: VerifyIdentity,
|
|
15133
|
+
VerifyIdentityOpen: VerifyIdentityOpen,
|
|
15116
15134
|
Hold: Hold,
|
|
15117
15135
|
Loading: Loading$9
|
|
15118
15136
|
});
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { r as registerInstance, h as h$1 } from './index-17b4da69.js';
|
|
2
|
-
import { j as h } from './stencil-hooks.module-3c7f7c90.js';
|
|
3
|
-
import { i as isDemo, F as Fn, K } from './index.module-c0eb7dc2.js';
|
|
2
|
+
import { j as h, f as useState, d as useEffect } from './stencil-hooks.module-3c7f7c90.js';
|
|
3
|
+
import { i as isDemo, F as Fn, S as Sn, K, e as an } from './index.module-c0eb7dc2.js';
|
|
4
|
+
import { d as dist } from './index-0c7b14c5.js';
|
|
4
5
|
import { g as getProps } from './utils-334c1e34.js';
|
|
5
|
-
import { S as SHOW_CODE_NAMESPACE,
|
|
6
|
+
import { S as SHOW_CODE_NAMESPACE, a as VERIFICATION_EMAIL_NAMESPACE, V as VERIFICATION_PARENT_NAMESPACE } from './keys-db1897ae.js';
|
|
6
7
|
import { e as extractProps } from './extractProps-ae1afbb3.js';
|
|
7
8
|
|
|
9
|
+
const USER_LOOKUP = dist.gql `
|
|
10
|
+
query viewer {
|
|
11
|
+
viewer {
|
|
12
|
+
... on User {
|
|
13
|
+
id
|
|
14
|
+
accountId
|
|
15
|
+
email
|
|
16
|
+
emailVerified
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
8
21
|
function useWidgetVerificationInternal() {
|
|
9
22
|
const userIdentity = K();
|
|
10
23
|
const [showCode, setShowCode] = Fn({
|
|
@@ -15,7 +28,32 @@ function useWidgetVerificationInternal() {
|
|
|
15
28
|
namespace: VERIFICATION_EMAIL_NAMESPACE,
|
|
16
29
|
initialValue: userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.email,
|
|
17
30
|
});
|
|
18
|
-
|
|
31
|
+
const setContext = Sn(VERIFICATION_PARENT_NAMESPACE);
|
|
32
|
+
const [loading, setLoading] = useState(true);
|
|
33
|
+
const [fetch] = an(USER_LOOKUP);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const checkUser = async () => {
|
|
36
|
+
var _a;
|
|
37
|
+
try {
|
|
38
|
+
const res = await fetch({});
|
|
39
|
+
if (!res || res instanceof Error)
|
|
40
|
+
throw new Error();
|
|
41
|
+
if ((_a = res === null || res === void 0 ? void 0 : res.viewer) === null || _a === void 0 ? void 0 : _a.emailVerified)
|
|
42
|
+
setContext(true);
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
console.error("Could not fetch user information", e);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
setLoading(false);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
checkUser();
|
|
52
|
+
}, []);
|
|
53
|
+
const onVerification = () => {
|
|
54
|
+
setContext(true);
|
|
55
|
+
};
|
|
56
|
+
return { showCode, onVerification, loading };
|
|
19
57
|
}
|
|
20
58
|
const WidgetVerificationInternal = class {
|
|
21
59
|
constructor(hostRef) {
|
|
@@ -28,11 +66,15 @@ const WidgetVerificationInternal = class {
|
|
|
28
66
|
return extractProps(props, prefix);
|
|
29
67
|
}
|
|
30
68
|
render() {
|
|
31
|
-
const { showCode } = isDemo()
|
|
69
|
+
const { showCode, onVerification, loading } = isDemo()
|
|
32
70
|
? useDemoWidgetVerificationInternal()
|
|
33
71
|
: useWidgetVerificationInternal();
|
|
72
|
+
if (loading) {
|
|
73
|
+
// TODO: Proper loading state
|
|
74
|
+
return h$1("div", null, "Loading");
|
|
75
|
+
}
|
|
34
76
|
if (showCode) {
|
|
35
|
-
return (h$1("sqm-code-verification", Object.assign({}, this.getStepTextProps("codeStep_"))));
|
|
77
|
+
return (h$1("sqm-code-verification", Object.assign({ onVerification: onVerification }, this.getStepTextProps("codeStep_"))));
|
|
36
78
|
}
|
|
37
79
|
return (h$1("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"))));
|
|
38
80
|
}
|
|
@@ -46,7 +88,11 @@ function useDemoWidgetVerificationInternal() {
|
|
|
46
88
|
namespace: VERIFICATION_EMAIL_NAMESPACE,
|
|
47
89
|
initialValue: undefined,
|
|
48
90
|
});
|
|
49
|
-
|
|
91
|
+
const setContext = Sn(VERIFICATION_PARENT_NAMESPACE);
|
|
92
|
+
const onVerification = () => {
|
|
93
|
+
setContext(true);
|
|
94
|
+
};
|
|
95
|
+
return { showCode, onVerification, loading: false };
|
|
50
96
|
}
|
|
51
97
|
|
|
52
98
|
export { WidgetVerificationInternal as sqm_widget_verification_internal };
|