@saasquatch/mint-components 1.12.0-15 → 1.12.0-20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mint-components.cjs.js +1 -1
  3. package/dist/cjs/{sqm-banking-info-form_16.cjs.entry.js → sqm-banking-info-form_17.cjs.entry.js} +443 -91
  4. package/dist/cjs/sqm-big-stat_39.cjs.entry.js +2 -2
  5. package/dist/cjs/sqm-empty_4.cjs.entry.js +1 -1
  6. package/dist/cjs/{sqm-invoice-table-view-b0602970.js → sqm-invoice-table-view-4fcf021f.js} +1 -0
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +43 -8
  8. package/dist/cjs/sqm-widget-verification-controller.cjs.entry.js +113 -0
  9. package/dist/cjs/sqm-widget-verification.cjs.entry.js +86 -108
  10. package/dist/collection/collection-manifest.json +1 -1
  11. package/dist/collection/components/sqm-payout-button-scroll/sqm-payout-button-scroll-view.js +2 -2
  12. package/dist/collection/components/sqm-text/sqm-text.js +1 -1
  13. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.js +22 -6
  14. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-controller.js +120 -0
  15. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +95 -125
  16. package/dist/collection/components/tax-and-cash/BankingForm.stories.js +17 -0
  17. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
  18. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +71 -5
  19. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +2 -1
  20. package/dist/esm/{keys-db1897ae.js → keys-406491dc.js} +1 -1
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/mint-components.js +1 -1
  23. package/dist/esm/{sqm-banking-info-form_16.entry.js → sqm-banking-info-form_17.entry.js} +445 -94
  24. package/dist/esm/sqm-big-stat_39.entry.js +2 -2
  25. package/dist/esm/sqm-email-verification.entry.js +1 -1
  26. package/dist/esm/sqm-empty_4.entry.js +1 -1
  27. package/dist/esm/{sqm-invoice-table-view-b1ac1bfc.js → sqm-invoice-table-view-b3127605.js} +1 -0
  28. package/dist/esm/sqm-stencilbook.entry.js +43 -8
  29. package/dist/esm/sqm-widget-verification-controller.entry.js +109 -0
  30. package/dist/esm/sqm-widget-verification.entry.js +90 -112
  31. package/dist/esm-es5/{keys-db1897ae.js → keys-406491dc.js} +1 -1
  32. package/dist/esm-es5/loader.js +1 -1
  33. package/dist/esm-es5/mint-components.js +1 -1
  34. package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -0
  35. package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
  36. package/dist/esm-es5/sqm-email-verification.entry.js +1 -1
  37. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  38. package/dist/esm-es5/sqm-invoice-table-view-b3127605.js +1 -0
  39. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  40. package/dist/esm-es5/sqm-widget-verification-controller.entry.js +1 -0
  41. package/dist/esm-es5/sqm-widget-verification.entry.js +1 -1
  42. package/dist/mint-components/mint-components.esm.js +1 -1
  43. package/dist/mint-components/{p-e11b605d.entry.js → p-021ccc29.entry.js} +1 -1
  44. package/dist/mint-components/{p-158568e5.system.entry.js → p-0a94fe9f.system.entry.js} +1 -1
  45. package/dist/mint-components/p-156e37c2.system.entry.js +1 -0
  46. package/dist/mint-components/{p-c58250e6.system.entry.js → p-2c342de3.system.entry.js} +1 -1
  47. package/dist/mint-components/p-3007fb7d.system.entry.js +1 -0
  48. package/dist/mint-components/p-38c7775a.js +1 -0
  49. package/dist/mint-components/{p-a8e79cad.entry.js → p-478a3755.entry.js} +2 -2
  50. package/dist/mint-components/p-57dd28bd.system.js +1 -0
  51. package/dist/mint-components/{p-9ec008cb.system.entry.js → p-70af9ba2.system.entry.js} +1 -1
  52. package/dist/mint-components/p-97c92e75.entry.js +16 -0
  53. package/dist/mint-components/p-9bd417fd.entry.js +1 -0
  54. package/dist/mint-components/{p-a5c96f2a.entry.js → p-a954c299.entry.js} +21 -11
  55. package/dist/mint-components/p-c1fa5e04.system.js +1 -0
  56. package/dist/mint-components/p-ca809fdd.system.js +1 -1
  57. package/dist/mint-components/p-cb55d3c4.system.entry.js +1 -0
  58. package/dist/mint-components/{p-4671e644.entry.js → p-cd200c95.entry.js} +1 -1
  59. package/dist/mint-components/p-d4877a65.system.entry.js +1 -0
  60. package/dist/mint-components/p-f1184442.js +1 -0
  61. package/dist/mint-components/{p-fc17c2d2.entry.js → p-f196d71a.entry.js} +11 -11
  62. package/dist/types/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.d.ts +1 -0
  63. package/dist/types/components/sqm-widget-verification/sqm-widget-verification-controller.d.ts +12 -0
  64. package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +3 -4
  65. package/dist/types/components/tax-and-cash/BankingForm.stories.d.ts +1 -0
  66. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +3 -0
  67. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.d.ts +9 -0
  68. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/extractProps.d.ts +5 -1
  69. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +1 -1
  70. package/dist/types/components.d.ts +27 -37
  71. package/docs/docs.docx +0 -0
  72. package/docs/raisins.json +1 -1
  73. package/grapesjs/grapesjs.js +1 -1
  74. package/package.json +1 -1
  75. package/dist/cjs/sqm-code-verification.cjs.entry.js +0 -342
  76. package/dist/cjs/sqm-widget-verification-internal.cjs.entry.js +0 -109
  77. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-internal.js +0 -345
  78. package/dist/esm/sqm-code-verification.entry.js +0 -338
  79. package/dist/esm/sqm-widget-verification-internal.entry.js +0 -105
  80. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +0 -1
  81. package/dist/esm-es5/sqm-code-verification.entry.js +0 -1
  82. package/dist/esm-es5/sqm-invoice-table-view-b1ac1bfc.js +0 -1
  83. package/dist/esm-es5/sqm-widget-verification-internal.entry.js +0 -1
  84. package/dist/mint-components/p-02892b2a.entry.js +0 -11
  85. package/dist/mint-components/p-03e1ac96.system.entry.js +0 -1
  86. package/dist/mint-components/p-2584baa5.entry.js +0 -16
  87. package/dist/mint-components/p-39840341.js +0 -1
  88. package/dist/mint-components/p-7789349d.system.js +0 -1
  89. package/dist/mint-components/p-8fa2809f.system.entry.js +0 -1
  90. package/dist/mint-components/p-9596e97c.system.entry.js +0 -1
  91. package/dist/mint-components/p-9e788a1a.js +0 -1
  92. package/dist/mint-components/p-b2a99637.system.js +0 -1
  93. package/dist/mint-components/p-b99108a6.system.entry.js +0 -1
  94. package/dist/mint-components/p-bfd92031.system.entry.js +0 -1
  95. package/dist/mint-components/p-c510fb88.entry.js +0 -1
  96. package/dist/types/components/sqm-widget-verification/sqm-widget-verification-internal.d.ts +0 -20
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasquatch/mint-components",
3
3
  "title": "Mint Components",
4
- "version": "1.12.0-15",
4
+ "version": "1.12.0-20",
5
5
  "description": "A minimal design library with components for referral and loyalty experiences. Built with Shoelace components by Saasquatch.",
6
6
  "icon": "https://res.cloudinary.com/saasquatch/image/upload/v1652219900/squatch-assets/For_Mint.svg",
7
7
  "raisins": "docs/raisins.json",
@@ -1,342 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-b0129cd6.js');
6
- const stencilHooks_module = require('./stencil-hooks.module-72742a0b.js');
7
- const global = require('./global-c3637175.js');
8
- const index_module = require('./index.module-b8d9d0ba.js');
9
- const cjs = require('./cjs-1066ec21.js');
10
- const mixins = require('./mixins-fe9d4112.js');
11
- const JSS = require('./JSS-8503a151.js');
12
- const utils = require('./utils-6847bc06.js');
13
- const sqmTextSpanView = require('./sqm-text-span-view-e1cd9bd3.js');
14
- const keys = require('./keys-cff24974.js');
15
- const useVerificationEmail = require('./useVerificationEmail-2eb28c2a.js');
16
-
17
- const style = {
18
- Wrapper: {
19
- display: "flex",
20
- flexDirection: "column",
21
- gap: "var(--sl-spacing-medium)",
22
- maxWidth: "550px",
23
- },
24
- HeaderContainer: {
25
- display: "flex",
26
- flexDirection: "column",
27
- },
28
- InputsContainer: {
29
- display: "flex",
30
- gap: "var(--sl-spacing-medium)",
31
- position: "relative",
32
- flexDirection: "column",
33
- },
34
- CodeInputContainer: {
35
- display: "flex",
36
- gap: "var(--sl-spacing-medium)",
37
- },
38
- CodeInput: {
39
- maxWidth: "40px",
40
- "&::part(input)": {
41
- margin: "0",
42
- padding: "0 var(--sl-input-spacing-small)",
43
- fontSize: "var(--sl-font-size-large)",
44
- },
45
- },
46
- CodeInputError: {
47
- ...mixins.ErrorStyles,
48
- maxWidth: "40px",
49
- "&::part(input)": {
50
- margin: "0",
51
- padding: "0 var(--sl-input-spacing-small)",
52
- fontSize: "var(--sl-font-size-large)",
53
- },
54
- },
55
- ErrorText: {
56
- color: "var(--sl-color-danger-500)",
57
- fontSize: "var(--sl-font-size-small)",
58
- margin: "0",
59
- },
60
- ContinueButton: {
61
- width: "100%",
62
- maxWidth: "100px",
63
- },
64
- FooterContainer: {
65
- display: "flex",
66
- flexDirection: "column",
67
- },
68
- SkeletonOne: {
69
- width: "50%",
70
- height: "16px",
71
- },
72
- SkeletonTwo: {
73
- width: "30%",
74
- height: "34px",
75
- },
76
- SkeletonThree: {
77
- width: "15%",
78
- height: "24px",
79
- },
80
- };
81
- const vanillaStyle = `
82
- :host {
83
- display: block;
84
- }
85
- :host([hidden]): {
86
- display: none;
87
- }
88
-
89
-
90
- `;
91
- const sheet = JSS.createStyleSheet(style);
92
- const styleString = sheet.toString();
93
- function WidgetCodeVerificationView(props) {
94
- const { states, refs, callbacks, text } = props;
95
- const resendCodeText = global.intl.formatMessage({
96
- id: "resendCodeText",
97
- defaultMessage: text.resendCodeText,
98
- }, {
99
- resendCodeLink: (index.h("a", { href: "", style: { textDecoration: "none" }, onClick: (e) => {
100
- e.preventDefault();
101
- callbacks.resendEmail();
102
- } }, text.resendCodeLabel)),
103
- });
104
- const codeResentSuccessfully = global.intl.formatMessage({
105
- id: "codeResentSuccessfully",
106
- defaultMessage: text.codeResentSuccessfullyText,
107
- }, {
108
- email: states.email,
109
- });
110
- const inputClass = states.verifyFailed
111
- ? sheet.classes.CodeInputError
112
- : sheet.classes.CodeInput;
113
- return (index.h("div", { part: "sqm-base" },
114
- index.h("style", { type: "text/css" },
115
- vanillaStyle,
116
- styleString),
117
- index.h("div", { class: sheet.classes.Wrapper },
118
- index.h("div", { class: sheet.classes.HeaderContainer },
119
- index.h(sqmTextSpanView.TextSpanView, { type: "p" }, global.intl.formatMessage({
120
- id: `emailHeaderText`,
121
- defaultMessage: states.verifyFailed
122
- ? text.reverifyCodeHeaderText
123
- : text.verifyCodeHeaderText,
124
- }, { email: states.email }))),
125
- states.emailResent && (index.h("sqm-form-message", { type: "success", exportparts: "successalert-icon" },
126
- index.h("b", null, codeResentSuccessfully))),
127
- index.h("div", { class: sheet.classes.InputsContainer },
128
- index.h("div", { ref: refs.codeWrapperRef, class: sheet.classes.CodeInputContainer },
129
- index.h("sl-input", { class: inputClass, name: "code" }),
130
- index.h("sl-input", { class: inputClass, name: "code" }),
131
- index.h("sl-input", { class: inputClass, name: "code" }),
132
- index.h("sl-input", { class: inputClass, name: "code" }),
133
- index.h("sl-input", { class: inputClass, name: "code" }),
134
- index.h("sl-input", { class: inputClass, name: "code" })),
135
- states.verifyFailed && (index.h("p", { class: sheet.classes.ErrorText }, text.invalidCodeText)),
136
- index.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)),
137
- index.h("div", { class: sheet.classes.FooterContainer },
138
- index.h(sqmTextSpanView.TextSpanView, { type: "p" }, resendCodeText)))));
139
- }
140
-
141
- const VerifyEmailWithCodeMutation = index_module.dist.gql `
142
- mutation submitImpactPublisherEmail2FACode(
143
- $user: UserIdInput!
144
- $code: String!
145
- ) {
146
- submitImpactPublisherEmail2FACode(user: $user, code: $code) {
147
- verifiedEmail
148
- accessKey
149
- }
150
- }
151
- `;
152
- function useWidgetCodeVerification(props) {
153
- const host = stencilHooks_module.l();
154
- const [_, setShowCode] = index_module.Mn(keys.SHOW_CODE_NAMESPACE);
155
- const email = index_module.Dn(keys.VERIFICATION_EMAIL_NAMESPACE);
156
- const [emailSent, setEmailSent] = stencilHooks_module.useState(false);
157
- const [emailResent, setEmailResent] = stencilHooks_module.useState(false);
158
- const [codeRef, setCodeRef] = stencilHooks_module.useState(null);
159
- const [validationError, setValidationError] = stencilHooks_module.useState(false);
160
- const [emailError, setEmailError] = stencilHooks_module.useState(false);
161
- const { initialized, verificationEmail, send: [sendEmail, { loading: sendLoading, errors: sendErrors }], verify: [verifyEmail, { loading: verifyLoading, errors: verifyErrors }], } = useVerificationEmail.useVerificationEmail();
162
- stencilHooks_module.useEffect(() => {
163
- if (!codeRef)
164
- return;
165
- const slInputs = codeRef.querySelectorAll("sl-input");
166
- const codeElements = Array.from(slInputs).map((node) => node.shadowRoot.querySelector(`input[name="code"]`));
167
- codeElements.forEach((element, idx) => {
168
- element.addEventListener("focus", (e) => {
169
- e.target.select();
170
- });
171
- element.addEventListener("keydown", (e) => {
172
- if (e.key === "Backspace" && e.target.value === "") {
173
- codeElements[Math.max(0, idx - 1)].focus();
174
- }
175
- });
176
- element.addEventListener("input", (e) => {
177
- const input = e.data;
178
- if (!input)
179
- return;
180
- if (idx === codeElements.length - 1) {
181
- e.target.value = input.slice(0, 1);
182
- return;
183
- }
184
- if (input.length > 1) {
185
- const rest = input.slice(1);
186
- e.target.value = input.slice(0, 1);
187
- codeElements[idx + 1].dispatchEvent(new InputEvent("input", {
188
- inputType: "insertFromPaste",
189
- data: rest,
190
- }));
191
- }
192
- codeElements[idx + 1].focus();
193
- });
194
- });
195
- }, [codeRef]);
196
- const reset = () => {
197
- setShowCode(false);
198
- setValidationError(false);
199
- };
200
- const resendEmail = async () => {
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();
205
- if (!result) {
206
- setEmailError(true);
207
- return;
208
- }
209
- if (emailSent)
210
- setEmailResent(true);
211
- setEmailSent(true);
212
- };
213
- const submitCode = async () => {
214
- const slInputs = codeRef.querySelectorAll("sl-input");
215
- const codeElements = Array.from(slInputs).map((node) => node.shadowRoot.querySelector(`input[name="code"]`));
216
- if (codeElements.find((el) => !el.value)) {
217
- setValidationError(true);
218
- return;
219
- }
220
- let code = "";
221
- codeElements.forEach((element) => {
222
- code = `${code}${element.value}`;
223
- });
224
- // UI should only allow this to be called if initialized, but checking just in case
225
- if (!initialized)
226
- return;
227
- setValidationError(false);
228
- const res = await verifyEmail(code);
229
- if (res === null || res === void 0 ? void 0 : res.success) {
230
- props.onVerification(res.accessKey);
231
- reset();
232
- }
233
- else {
234
- setValidationError(true);
235
- }
236
- };
237
- stencilHooks_module.useEffect(() => {
238
- // Wait for mutations to be determined from user lookup
239
- if (!initialized)
240
- return;
241
- // email should already exist if user has completed email-verification
242
- if (!email)
243
- resendEmail();
244
- else
245
- setEmailSent(true);
246
- }, [initialized]);
247
- return {
248
- refs: {
249
- codeWrapperRef: setCodeRef,
250
- },
251
- states: {
252
- email: verificationEmail,
253
- emailResent,
254
- resendError: sendErrors || verifyErrors,
255
- initialiseLoading: !initialized,
256
- loading: sendLoading || verifyLoading,
257
- verifyFailed: !!validationError,
258
- },
259
- callbacks: {
260
- resendEmail,
261
- submitCode,
262
- },
263
- text: props.getTextProps(),
264
- };
265
- }
266
-
267
- const WidgetCodeVerification = class {
268
- constructor(hostRef) {
269
- index.registerInstance(this, hostRef);
270
- /**
271
- * @uiName Verify code widget header text
272
- */
273
- this.verifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
274
- /**
275
- * @uiName Reverify code widget header text
276
- */
277
- this.reverifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
278
- /**
279
- * Text displayed under verify button
280
- * @uiName Resend code text
281
- */
282
- this.resendCodeText = "Didn't receive your code? {resendCodeLink}";
283
- /**
284
- * The link that appears in the resend code link
285
- * @uiName Resend code label
286
- */
287
- this.resendCodeLabel = "Resend code";
288
- /**
289
- * Link text displayed under verify button
290
- * @uiName Resend code text
291
- */
292
- this.codeResentSuccessfullyText = "Another code has been sent to {email}";
293
- /**
294
- * Error text displayed under verification input
295
- * @uiName Invalid code text
296
- */
297
- this.invalidCodeText = "Please check your code and try again. If you’re still having trouble, try resending your code.";
298
- /**
299
- * @uiName Verify code button text
300
- */
301
- this.verifyText = "Verify";
302
- /**
303
- * Displayed when the email verification fails due to a network error. The participant can try refreshing the page.
304
- * @uiName Network error message
305
- */
306
- this.networkErrorMessage = "An error occurred while verifying your email. Please refresh the page and try again.";
307
- stencilHooks_module.h$1(this);
308
- }
309
- disconnectedCallback() { }
310
- getTextProps() {
311
- return utils.getProps(this);
312
- }
313
- render() {
314
- const props = index_module.isDemo()
315
- ? useDemoWidgetCodeVerification(this)
316
- : useWidgetCodeVerification(this);
317
- return index.h(WidgetCodeVerificationView, Object.assign({}, props));
318
- }
319
- };
320
- function useDemoWidgetCodeVerification(props) {
321
- const [emailResent, setEmailResent] = stencilHooks_module.useState(false);
322
- const setVerifiedContext = index_module.Sn(keys.VERIFICATION_PARENT_NAMESPACE);
323
- return cjs.cjs({
324
- states: {
325
- loading: false,
326
- email: "test@example.com",
327
- emailResent,
328
- resendError: true,
329
- verifyFailed: true,
330
- },
331
- refs: {
332
- codeWrapperRef: () => { },
333
- },
334
- callbacks: {
335
- resendEmail: async () => setEmailResent(true),
336
- submitCode: async () => setVerifiedContext(true),
337
- },
338
- text: props.getTextProps(),
339
- }, props.demoData || {}, { arrayMerge: (_, a) => a });
340
- }
341
-
342
- exports.sqm_code_verification = WidgetCodeVerification;
@@ -1,109 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-b0129cd6.js');
6
- const stencilHooks_module = require('./stencil-hooks.module-72742a0b.js');
7
- const index_module = require('./index.module-b8d9d0ba.js');
8
- const utils = require('./utils-6847bc06.js');
9
- const keys = require('./keys-cff24974.js');
10
- const extractProps = require('./extractProps-fd93ba62.js');
11
-
12
- const USER_LOOKUP = index_module.dist.gql `
13
- query checkUserVerification {
14
- viewer {
15
- ... on User {
16
- id
17
- accountId
18
- email
19
- emailVerified
20
- managedIdentity {
21
- email
22
- emailVerified
23
- }
24
- }
25
- }
26
- }
27
- `;
28
- function useWidgetVerificationInternal() {
29
- const userIdentity = index_module.K();
30
- const [showCode, setShowCode] = index_module.Fn({
31
- namespace: keys.SHOW_CODE_NAMESPACE,
32
- initialValue: false,
33
- });
34
- const [email, setEmail] = index_module.Fn({
35
- namespace: keys.VERIFICATION_EMAIL_NAMESPACE,
36
- initialValue: userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.email,
37
- });
38
- const setContext = index_module.Sn(keys.VERIFICATION_PARENT_NAMESPACE);
39
- const [loading, setLoading] = stencilHooks_module.useState(true);
40
- const [fetch] = index_module.an(USER_LOOKUP);
41
- stencilHooks_module.useEffect(() => {
42
- const checkUser = async () => {
43
- var _a, _b, _c;
44
- try {
45
- const res = await fetch({});
46
- if (!res || res instanceof Error)
47
- throw new Error();
48
- if ((_a = res === null || res === void 0 ? void 0 : res.viewer) === null || _a === void 0 ? void 0 : _a.emailVerified)
49
- setContext(true);
50
- else if ((_c = (_b = res === null || res === void 0 ? void 0 : res.viewer) === null || _b === void 0 ? void 0 : _b.managedIdentity) === null || _c === void 0 ? void 0 : _c.emailVerified)
51
- setContext(true);
52
- }
53
- catch (e) {
54
- console.error("Could not fetch user information:", e);
55
- }
56
- finally {
57
- setLoading(false);
58
- }
59
- };
60
- checkUser();
61
- }, []);
62
- const onVerification = () => {
63
- setContext(true);
64
- };
65
- return { showCode, onVerification, loading };
66
- }
67
- const WidgetVerificationInternal = class {
68
- constructor(hostRef) {
69
- index.registerInstance(this, hostRef);
70
- stencilHooks_module.h$1(this);
71
- }
72
- disconnectedCallback() { }
73
- getStepTextProps(prefix) {
74
- const props = utils.getProps(this);
75
- return extractProps.extractProps(props, prefix);
76
- }
77
- render() {
78
- const { showCode, onVerification, loading } = index_module.isDemo()
79
- ? useDemoWidgetVerificationInternal()
80
- : useWidgetVerificationInternal();
81
- // TODO: Shoelace spinner is throwing errors
82
- if (loading)
83
- return index.h("div", null);
84
- // if (loading) {
85
- // return <sl-spinner style="font-size: 2rem;"></sl-spinner>;
86
- // }
87
- if (showCode) {
88
- return (index.h("sqm-code-verification", Object.assign({ onVerification: onVerification }, this.getStepTextProps("codeStep_"))));
89
- }
90
- return (index.h("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"))));
91
- }
92
- };
93
- function useDemoWidgetVerificationInternal() {
94
- const [showCode, setShowCode] = index_module.Fn({
95
- namespace: keys.SHOW_CODE_NAMESPACE,
96
- initialValue: false,
97
- });
98
- const [email, setEmail] = index_module.Fn({
99
- namespace: keys.VERIFICATION_EMAIL_NAMESPACE,
100
- initialValue: undefined,
101
- });
102
- const setContext = index_module.Sn(keys.VERIFICATION_PARENT_NAMESPACE);
103
- const onVerification = () => {
104
- setContext(true);
105
- };
106
- return { showCode, onVerification, loading: false };
107
- }
108
-
109
- exports.sqm_widget_verification_internal = WidgetVerificationInternal;