@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
@@ -0,0 +1,120 @@
1
+ import { useParentState } from "@saasquatch/component-boilerplate";
2
+ import { withHooks } from "@saasquatch/stencil-hooks";
3
+ import { useCallback, useEffect, useState } from "@saasquatch/universal-hooks";
4
+ import { Component, h, Host } from "@stencil/core";
5
+ import debugFn from "debug";
6
+ import { VERIFICATION_PARENT_NAMESPACE } from "./keys";
7
+ const debug = debugFn("sq:widget-verification");
8
+ function useTemplateChildren({ parent, callback }) {
9
+ const parentObserver = new MutationObserver(listenForTemplateChanges);
10
+ const childTemplateObserver = new MutationObserver(callback);
11
+ parentObserver.observe(parent, {
12
+ childList: true,
13
+ // We only care about immediate children templates
14
+ subtree: false,
15
+ });
16
+ listenForTemplateChanges({ addedNodes: parent.querySelectorAll("template") });
17
+ function listenForTemplateChanges(mutationList) {
18
+ var _a;
19
+ // Be smart, only look at the mutation list
20
+ (_a = mutationList.addedNodes) === null || _a === void 0 ? void 0 : _a.forEach((t) => {
21
+ childTemplateObserver.observe(t.content, {
22
+ childList: true,
23
+ attributes: true,
24
+ // Look deep into the templates for re-rendering
25
+ subtree: true,
26
+ });
27
+ });
28
+ }
29
+ return () => {
30
+ parentObserver.disconnect();
31
+ childTemplateObserver.disconnect();
32
+ };
33
+ }
34
+ /**
35
+ * @uiName Widget Verification Controller
36
+ * @slots [{"name":"not-verified","title":"Not Verified template"},{"name":"verified","title":"Verified template"}]
37
+ * @canvasRenderer always-replace
38
+ * @exampleGroup Widget Verification
39
+ * @example Widget Verification Controller - <sqm-widget-verification-controller><template slot="not-verified"><sqm-widget-verification></sqm-widget-verification></template><template slot="verified"><sqm-tax-and-cash></sqm-tax-and-cash></template></sqm-widget-verification-controller>
40
+ */
41
+ export class WidgetVerificationController {
42
+ constructor() {
43
+ withHooks(this);
44
+ }
45
+ disconnectedCallback() { }
46
+ render() {
47
+ const [context, setContext] = useParentState({
48
+ namespace: VERIFICATION_PARENT_NAMESPACE,
49
+ initialValue: false,
50
+ });
51
+ const [container, setContainer] = useState(undefined);
52
+ const [slot, setSlot] = useState(undefined);
53
+ const updateTemplates = useCallback(() => {
54
+ const isAuth = context;
55
+ const templates = slot.querySelectorAll(`template`);
56
+ const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
57
+ if (template) {
58
+ // use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
59
+ const newContent = template.innerHTML || template.firstElementChild.outerHTML;
60
+ // if template contents are an exact match
61
+ if (newContent === container.innerHTML) {
62
+ debug("don't rerender");
63
+ }
64
+ else if (template) {
65
+ container.innerHTML = newContent;
66
+ }
67
+ }
68
+ const plopTargets = Array.from(slot.children).filter((el) => el.tagName === "RAISINS-PLOP-TARGET");
69
+ // if editing in raisins
70
+ if (plopTargets.length) {
71
+ const loggedInPlopTargets = plopTargets.filter((el) => el.slot === "verified");
72
+ const loggedOutPlopTargets = plopTargets.filter((el) => el.slot === "not-verified");
73
+ loggedOutPlopTargets.forEach((target, i) => {
74
+ if (isAuth) {
75
+ target.style.display = "none";
76
+ return;
77
+ }
78
+ // Place last plop target at the bottom of the parent
79
+ if (i === loggedOutPlopTargets.length - 1) {
80
+ target.style.bottom = "0px";
81
+ target.style.left = "0px";
82
+ target.style.right = "0px";
83
+ target.style.position = "absolute";
84
+ }
85
+ target.style.height = "25px";
86
+ });
87
+ loggedInPlopTargets.forEach((target, i) => {
88
+ if (!isAuth) {
89
+ target.style.display = "none";
90
+ return;
91
+ }
92
+ // Place last plop target at the bottom of the parent
93
+ if (i === loggedInPlopTargets.length - 1) {
94
+ target.style.bottom = "0px";
95
+ target.style.left = "0px";
96
+ target.style.right = "0px";
97
+ target.style.position = "absolute";
98
+ }
99
+ target.style.height = "25px";
100
+ });
101
+ }
102
+ }, [container, slot, context]);
103
+ useEffect(() => {
104
+ if (!container || !slot) {
105
+ debug("DOM not ready:");
106
+ return;
107
+ }
108
+ // Run on first render
109
+ updateTemplates();
110
+ return useTemplateChildren({ parent: slot, callback: updateTemplates });
111
+ }, [slot, container, context]);
112
+ return (h(Host, null,
113
+ h("div", { ref: setSlot, style: { display: "contents" } },
114
+ h("slot", { name: "not-verified" }),
115
+ h("slot", { name: "verified" })),
116
+ h("div", { ref: setContainer },
117
+ h("slot", { name: "shown" }))));
118
+ }
119
+ static get is() { return "sqm-widget-verification-controller"; }
120
+ }
@@ -1,53 +1,77 @@
1
- import { useParentState } from "@saasquatch/component-boilerplate";
2
- import { withHooks } from "@saasquatch/stencil-hooks";
3
- import { useCallback, useEffect, useState } from "@saasquatch/universal-hooks";
4
- import { Component, h, Host, Prop } from "@stencil/core";
5
- import debugFn from "debug";
6
- import { VERIFICATION_PARENT_NAMESPACE } from "./keys";
1
+ import { isDemo, useLazyQuery, useParentState, useSetParent, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
+ import { useState, withHooks } from "@saasquatch/stencil-hooks";
3
+ import { Component, h, Prop } from "@stencil/core";
4
+ import { SHOW_CODE_NAMESPACE, VERIFICATION_EMAIL_NAMESPACE, VERIFICATION_PARENT_NAMESPACE, } from "./keys";
7
5
  import { getProps } from "../../utils/utils";
8
- const debug = debugFn("sq:widget-verification");
9
- function useTemplateChildren({ parent, callback }) {
10
- const parentObserver = new MutationObserver(listenForTemplateChanges);
11
- const childTemplateObserver = new MutationObserver(callback);
12
- parentObserver.observe(parent, {
13
- childList: true,
14
- // We only care about immediate children templates
15
- subtree: false,
16
- });
17
- listenForTemplateChanges({ addedNodes: parent.querySelectorAll("template") });
18
- function listenForTemplateChanges(mutationList) {
19
- var _a;
20
- // Be smart, only look at the mutation list
21
- (_a = mutationList.addedNodes) === null || _a === void 0 ? void 0 : _a.forEach((t) => {
22
- childTemplateObserver.observe(t.content, {
23
- childList: true,
24
- attributes: true,
25
- // Look deep into the templates for re-rendering
26
- subtree: true,
27
- });
28
- });
6
+ import { extractProps } from "../tax-and-cash/sqm-tax-and-cash/extractProps";
7
+ import { gql } from "graphql-request";
8
+ import { useEffect } from "@saasquatch/universal-hooks";
9
+ const USER_LOOKUP = gql `
10
+ query checkUserVerification {
11
+ viewer {
12
+ ... on User {
13
+ id
14
+ accountId
15
+ email
16
+ emailVerified
17
+ managedIdentity {
18
+ email
19
+ emailVerified
20
+ }
21
+ }
22
+ }
29
23
  }
30
- return () => {
31
- parentObserver.disconnect();
32
- childTemplateObserver.disconnect();
24
+ `;
25
+ function useWidgetVerificationInternal() {
26
+ const userIdentity = useUserIdentity();
27
+ const [showCode, setShowCode] = useParentState({
28
+ namespace: SHOW_CODE_NAMESPACE,
29
+ initialValue: false,
30
+ });
31
+ const [email, setEmail] = useParentState({
32
+ namespace: VERIFICATION_EMAIL_NAMESPACE,
33
+ initialValue: userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.email,
34
+ });
35
+ const setContext = useSetParent(VERIFICATION_PARENT_NAMESPACE);
36
+ const [loading, setLoading] = useState(true);
37
+ const [fetch] = useLazyQuery(USER_LOOKUP);
38
+ useEffect(() => {
39
+ const checkUser = async () => {
40
+ var _a, _b, _c;
41
+ try {
42
+ const res = await fetch({});
43
+ if (!res || res instanceof Error)
44
+ throw new Error();
45
+ if ((_a = res === null || res === void 0 ? void 0 : res.viewer) === null || _a === void 0 ? void 0 : _a.emailVerified)
46
+ setContext(true);
47
+ 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)
48
+ setContext(true);
49
+ }
50
+ catch (e) {
51
+ console.error("Could not fetch user information:", e);
52
+ }
53
+ finally {
54
+ setLoading(false);
55
+ }
56
+ };
57
+ checkUser();
58
+ }, []);
59
+ const onVerification = () => {
60
+ setContext(true);
33
61
  };
62
+ return { showCode, onVerification, loading };
34
63
  }
35
64
  /**
36
- * @uiName Widget Verification Gate
37
- * @slots [{"name":"not-verified","title":"Not verified template"},{"name":"verified","title":"Verified template"}]
38
- * @canvasRenderer always-replace
65
+ * @uiName Widget Verification Flow
39
66
  * @exampleGroup Widget Verification
40
- * @example Widget Verification Gate - <sqm-widget-verification><template slot="verified"><sqm-tax-and-cash></sqm-tax-and-cash></template></sqm-widget-verification>
67
+ * @example Widget Verification Flow - <sqm-widget-verification></sqm-widget-verification>
41
68
  */
42
69
  export class WidgetVerification {
43
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
- CODE STEP PROPS
45
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
46
70
  constructor() {
47
71
  // ! Any updated must be reflected in sqm-widget-verification-internal AND sqm-email-verification AND sqm-code-verification
48
72
  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49
- EMAIL STEP PROPS
50
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
73
+ EMAIL STEP PROPS
74
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
51
75
  /**
52
76
  * @uiName Verify email widget header text
53
77
  * @uiGroup Email Verification Step
@@ -79,8 +103,8 @@ export class WidgetVerification {
79
103
  */
80
104
  this.emailStep_emailValidationErrorText = "Please enter a valid email";
81
105
  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82
- EMAIL STEP PROPS
83
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
106
+ EMAIL STEP PROPS
107
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
84
108
  /**
85
109
  * @uiName Verify code widget header text
86
110
  * @uiGroup Code Verification Step
@@ -129,93 +153,24 @@ export class WidgetVerification {
129
153
  withHooks(this);
130
154
  }
131
155
  disconnectedCallback() { }
156
+ getStepTextProps(prefix) {
157
+ const props = getProps(this);
158
+ return extractProps(props, prefix);
159
+ }
132
160
  render() {
133
- const [context, setContext] = useParentState({
134
- namespace: VERIFICATION_PARENT_NAMESPACE,
135
- initialValue: false,
136
- });
137
- const [container, setContainer] = useState(undefined);
138
- const [slot, setSlot] = useState(undefined);
139
- const updateTemplates = useCallback(() => {
140
- const isAuth = context;
141
- const templates = slot.querySelectorAll(`template`);
142
- const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
143
- if (template) {
144
- // use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
145
- const newContent = template.innerHTML || template.firstElementChild.outerHTML;
146
- // if template contents are an exact match
147
- if (newContent === container.innerHTML) {
148
- debug("don't rerender");
149
- }
150
- else if (template) {
151
- container.innerHTML = newContent;
152
- }
153
- }
154
- const plopTargets = Array.from(slot.children).filter((el) => el.tagName === "RAISINS-PLOP-TARGET");
155
- // if editing in raisins
156
- if (plopTargets.length) {
157
- const loggedInPlopTargets = plopTargets.filter((el) => el.slot === "verified");
158
- const loggedOutPlopTargets = plopTargets.filter((el) => el.slot === "not-verified");
159
- loggedOutPlopTargets.forEach((target, i) => {
160
- if (isAuth) {
161
- target.style.display = "none";
162
- return;
163
- }
164
- // Place last plop target at the bottom of the parent
165
- if (i === loggedOutPlopTargets.length - 1) {
166
- target.style.bottom = "0px";
167
- target.style.left = "0px";
168
- target.style.right = "0px";
169
- target.style.position = "absolute";
170
- }
171
- target.style.height = "25px";
172
- });
173
- loggedInPlopTargets.forEach((target, i) => {
174
- if (!isAuth) {
175
- target.style.display = "none";
176
- return;
177
- }
178
- // Place last plop target at the bottom of the parent
179
- if (i === loggedInPlopTargets.length - 1) {
180
- target.style.bottom = "0px";
181
- target.style.left = "0px";
182
- target.style.right = "0px";
183
- target.style.position = "absolute";
184
- }
185
- target.style.height = "25px";
186
- });
187
- }
188
- }, [container, slot, context]);
189
- useEffect(() => {
190
- if (!container || !slot) {
191
- debug("DOM not ready:");
192
- return;
193
- }
194
- // Run on first render
195
- updateTemplates();
196
- return useTemplateChildren({ parent: slot, callback: updateTemplates });
197
- }, [slot, container, context]);
198
- // useEffect(() => {
199
- // const host = useHost();
200
- // const callback = (e: CustomEvent) => {
201
- // e.stopPropagation();
202
- // setContext({ token: e.detail.token });
203
- // };
204
- // host.addEventListener(VERIFICATION_EVENT_KEY, callback);
205
- // return () => {
206
- // host.removeEventListener(VERIFICATION_EVENT_KEY, callback);
207
- // };
208
- // }, []);
209
- return (h(Host, null,
210
- h("div", { ref: setSlot, style: { display: "contents" } },
211
- h("template", { slot: "not-verified" },
212
- h("sqm-widget-verification-internal", Object.assign({}, getProps(this)))),
213
- h("slot", { name: "not-verified" }),
214
- h("slot", { name: "verified" })),
215
- h("div", { ref: setContainer },
216
- h("slot", { name: "shown" }))));
161
+ const { showCode, onVerification, loading } = isDemo()
162
+ ? useDemoWidgetVerificationInternal()
163
+ : useWidgetVerificationInternal();
164
+ // TODO: Shoelace spinner is throwing errors
165
+ if (loading)
166
+ return h("div", null);
167
+ if (showCode) {
168
+ return (h("sqm-code-verification", Object.assign({ onVerification: onVerification }, this.getStepTextProps("codeStep_"))));
169
+ }
170
+ return (h("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"))));
217
171
  }
218
172
  static get is() { return "sqm-widget-verification"; }
173
+ static get encapsulation() { return "shadow"; }
219
174
  static get properties() { return {
220
175
  "emailStep_verifyEmailHeaderText": {
221
176
  "type": "string",
@@ -555,3 +510,18 @@ export class WidgetVerification {
555
510
  }
556
511
  }; }
557
512
  }
513
+ function useDemoWidgetVerificationInternal() {
514
+ const [showCode, setShowCode] = useParentState({
515
+ namespace: SHOW_CODE_NAMESPACE,
516
+ initialValue: false,
517
+ });
518
+ const [email, setEmail] = useParentState({
519
+ namespace: VERIFICATION_EMAIL_NAMESPACE,
520
+ initialValue: undefined,
521
+ });
522
+ const setContext = useSetParent(VERIFICATION_PARENT_NAMESPACE);
523
+ const onVerification = () => {
524
+ setContext(true);
525
+ };
526
+ return { showCode, onVerification, loading: false };
527
+ }
@@ -19,6 +19,7 @@ const bankingFormProps = {
19
19
  thresholds: [],
20
20
  currency: "USD",
21
21
  loadingError: false,
22
+ email: "test@example.com",
22
23
  },
23
24
  callbacks: {
24
25
  onVerificationHide: () => { },
@@ -332,3 +333,19 @@ export const BankingInfoFormWithFixedDayPaymentScheduleLoading = () => {
332
333
  },
333
334
  } }));
334
335
  };
336
+ export const BankingInfoFormVerififyIdentityModal = () => {
337
+ return (h("sqm-banking-info-form", { demoData: {
338
+ ...bankingFormProps,
339
+ states: {
340
+ ...bankingFormProps.states,
341
+ isPartner: true,
342
+ showVerification: true,
343
+ formState: {
344
+ ...bankingFormProps.states.formState,
345
+ bankCountry: "US",
346
+ paymentScheduleChecked: "FIXED_DAY",
347
+ },
348
+ currency: "USD",
349
+ },
350
+ } }));
351
+ };
@@ -205,6 +205,7 @@ const stepFourProps = {
205
205
  saveDisabled: false,
206
206
  thresholds: [],
207
207
  loadingError: false,
208
+ email: "test@example.com",
208
209
  formState: {
209
210
  paymentMethodChecked: "toBankAccount",
210
211
  },
@@ -215,6 +215,15 @@ export class BankingInfoForm {
215
215
  * @uiWidget textArea
216
216
  */
217
217
  this.isPartnerAlertDescription = "If you don’t recognize this referral program provider or believe this is a mistake, please contact our {supportLink} or sign up for this referral program with a different email.";
218
+ /**
219
+ * Text for verify email dialog
220
+ * @uiName Verify email header
221
+ */
222
+ this.verifyEmailHeaderText = "Verify your email";
223
+ /**
224
+ * @uiName Verify code widget header text
225
+ */
226
+ this.verifyEmailDescriptionText = "Verify your email to update your payment settings. Enter the code sent to {email} from our referral provider, impact.com.";
218
227
  /**
219
228
  * Part of the alert displayed at the top of the page.
220
229
  * @uiName Form submission error message title
@@ -315,14 +324,21 @@ export class BankingInfoForm {
315
324
  });
316
325
  const style = {
317
326
  Dialog: {
327
+ position: "relative",
318
328
  "&::part(panel)": {
319
329
  maxWidth: "420px",
320
330
  },
331
+ "&::part(title)": {
332
+ padding: "var(--sl-spacing-large) var(--sl-spacing-large) 0 var(--sl-spacing-large)",
333
+ },
334
+ "&::part(base)": {
335
+ position: "absolute",
336
+ },
321
337
  "&::part(close-button)": {
322
- marginBottom: "var(--sl-spacing-xx-large)",
338
+ marginBottom: "var(--sl-spacing-large)",
323
339
  },
324
340
  "&::part(body)": {
325
- padding: "0 var(--sl-spacing-x-large) 0 var(--sl-spacing-x-large)",
341
+ padding: "0 var(--sl-spacing-large) 0 var(--sl-spacing-large)",
326
342
  fontSize: "var(--sl-font-size-small)",
327
343
  },
328
344
  "&::part(footer)": {
@@ -339,9 +355,17 @@ export class BankingInfoForm {
339
355
  },
340
356
  };
341
357
  const sheet = createStyleSheet(style);
358
+ const styleString = sheet.toString();
359
+ const verifyDescription = intl.formatMessage({
360
+ id: "codeResentSuccessfully",
361
+ defaultMessage: props.text.verifyEmailDescriptionText,
362
+ }, {
363
+ email: props.states.email,
364
+ });
342
365
  return (h(Host, null,
343
- props.states.isPartner && props.states.showVerification ? (h("sl-dialog", { class: sheet.classes.Dialog, open: true, "onSl-hide": props.callbacks.onVerificationHide },
344
- h("sqm-code-verification", { onVerification: props.callbacks.onVerification }))) : null,
366
+ h("style", { type: "text/css" }, styleString),
367
+ props.states.isPartner && props.states.showVerification ? (h("sl-dialog", { class: sheet.classes.Dialog, open: true, "onSl-hide": props.callbacks.onVerificationHide, label: props.text.verifyEmailHeaderText },
368
+ h("sqm-code-verification", { verifyCodeHeaderText: verifyDescription, reverifyCodeHeaderText: verifyDescription, onVerification: props.callbacks.onVerification }))) : null,
345
369
  h(BankingInfoFormView, { callbacks: props.callbacks, text: props.text, states: props.states, refs: props.refs, slots: {
346
370
  formInputsSlot: inputFields === null || inputFields === void 0 ? void 0 : inputFields.map(({ input }) => input),
347
371
  countryInputSlot: (h("sl-select", Object.assign({ label: props.text.bankLocationLabel, disabled: props.states.saveLoading, required: true, name: "/bankCountry", id: "bankCountry", value: props.states.formState.bankCountry || "", "onSl-select": (e) => { var _a, _b; return props.callbacks.setBankCountry((_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.value); } }, (((_a = errors === null || errors === void 0 ? void 0 : errors.inputErrors) === null || _a === void 0 ? void 0 : _a.bankCountry) && {
@@ -1340,6 +1364,48 @@ export class BankingInfoForm {
1340
1364
  "reflect": false,
1341
1365
  "defaultValue": "\"If you don\u2019t recognize this referral program provider or believe this is a mistake, please contact our {supportLink} or sign up for this referral program with a different email.\""
1342
1366
  },
1367
+ "verifyEmailHeaderText": {
1368
+ "type": "string",
1369
+ "mutable": false,
1370
+ "complexType": {
1371
+ "original": "string",
1372
+ "resolved": "string",
1373
+ "references": {}
1374
+ },
1375
+ "required": false,
1376
+ "optional": false,
1377
+ "docs": {
1378
+ "tags": [{
1379
+ "text": "Verify email header",
1380
+ "name": "uiName"
1381
+ }],
1382
+ "text": "Text for verify email dialog"
1383
+ },
1384
+ "attribute": "verify-email-header-text",
1385
+ "reflect": false,
1386
+ "defaultValue": "\"Verify your email\""
1387
+ },
1388
+ "verifyEmailDescriptionText": {
1389
+ "type": "string",
1390
+ "mutable": false,
1391
+ "complexType": {
1392
+ "original": "string",
1393
+ "resolved": "string",
1394
+ "references": {}
1395
+ },
1396
+ "required": false,
1397
+ "optional": false,
1398
+ "docs": {
1399
+ "tags": [{
1400
+ "text": "Verify code widget header text",
1401
+ "name": "uiName"
1402
+ }],
1403
+ "text": ""
1404
+ },
1405
+ "attribute": "verify-email-description-text",
1406
+ "reflect": false,
1407
+ "defaultValue": "\"Verify your email to update your payment settings. Enter the code sent to {email} from our referral provider, impact.com.\""
1408
+ },
1343
1409
  "generalErrorTitle": {
1344
1410
  "type": "string",
1345
1411
  "mutable": false,
@@ -1546,7 +1612,7 @@ export class BankingInfoForm {
1546
1612
  "mutable": false,
1547
1613
  "complexType": {
1548
1614
  "original": "DemoData<BankingInfoFormViewProps>",
1549
- "resolved": "{ states?: { showVerification: boolean; step?: string; locale?: string; loading: boolean; saveLoading?: boolean; disabled: boolean; saveDisabled: boolean; hideSteps?: boolean; hasPayPal: boolean; hideBanking?: boolean; hidePayPal?: boolean; hideBalanceThreshold?: boolean; hideFixedDay?: boolean; hideBackButton: boolean; feeCap?: string; isPartner: boolean; paymentMethodFeeLabel?: string; loadingError: boolean; formState: BankingInfoFormData & { paymentMethodChecked?: \"toBankAccount\" | \"toPayPalAccount\"; paymentScheduleChecked?: \"BALANCE_THRESHOLD\" | \"FIXED_DAY\"; errors?: { general?: boolean; inputErrors?: { [field: string]: { type: \"required\" | \"invalid\"; }; }; }; }; bitset?: number; currency?: string; thresholds: string[]; countries?: { countryCode: string; displayName: string; }[]; allCountries?: { countryCode: string; displayName: string; }[]; currentPaymentOption?: any; showInputs?: boolean; bankCountry?: string; countrySearch?: string; }; slots?: { verificationDialogSlot?: VNode; formInputsSlot?: VNode[]; countryInputSlot?: VNode; paymentMethodSlot?: VNode; paymentThresholdSelectSlot?: VNode; paymentFixedDaySelectSlot?: VNode; paypalInputSlot?: VNode; }; refs?: { formRef: any; }; }",
1615
+ "resolved": "{ states?: { showVerification: boolean; step?: string; locale?: string; loading: boolean; saveLoading?: boolean; disabled: boolean; saveDisabled: boolean; hideSteps?: boolean; hasPayPal: boolean; hideBanking?: boolean; hidePayPal?: boolean; hideBalanceThreshold?: boolean; hideFixedDay?: boolean; hideBackButton: boolean; feeCap?: string; isPartner: boolean; paymentMethodFeeLabel?: string; loadingError: boolean; formState: BankingInfoFormData & { paymentMethodChecked?: \"toBankAccount\" | \"toPayPalAccount\"; paymentScheduleChecked?: \"BALANCE_THRESHOLD\" | \"FIXED_DAY\"; errors?: { general?: boolean; inputErrors?: { [field: string]: { type: \"required\" | \"invalid\"; }; }; }; }; bitset?: number; currency?: string; thresholds: string[]; countries?: { countryCode: string; displayName: string; }[]; allCountries?: { countryCode: string; displayName: string; }[]; currentPaymentOption?: any; showInputs?: boolean; bankCountry?: string; countrySearch?: string; email?: string; }; slots?: { verificationDialogSlot?: VNode; formInputsSlot?: VNode[]; countryInputSlot?: VNode; paymentMethodSlot?: VNode; paymentThresholdSelectSlot?: VNode; paymentFixedDaySelectSlot?: VNode; paypalInputSlot?: VNode; }; refs?: { formRef: any; }; }",
1550
1616
  "references": {
1551
1617
  "DemoData": {
1552
1618
  "location": "import",
@@ -83,7 +83,7 @@ function parseImpactThreshold(threshold) {
83
83
  return parsed.toString();
84
84
  }
85
85
  export function useBankingInfoForm(props) {
86
- var _a, _b, _c, _d, _e, _f, _g, _h;
86
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
87
87
  const host = useHost();
88
88
  const locale = useLocale();
89
89
  const user = useUserIdentity();
@@ -357,6 +357,7 @@ export function useBankingInfoForm(props) {
357
357
  hasPayPal,
358
358
  bankCountry: formState.bankCountry,
359
359
  countrySearch,
360
+ email: (_j = userData === null || userData === void 0 ? void 0 : userData.user) === null || _j === void 0 ? void 0 : _j.email,
360
361
  },
361
362
  refs: {
362
363
  formRef,
@@ -3,4 +3,4 @@ const VERIFICATION_EMAIL_NAMESPACE = "sq:verification-email";
3
3
  const VERIFICATION_PARENT_NAMESPACE = "sq:verification-context";
4
4
  const VERIFICATION_EVENT_KEY = "sq:code-verified";
5
5
 
6
- export { SHOW_CODE_NAMESPACE as S, VERIFICATION_PARENT_NAMESPACE as V, VERIFICATION_EMAIL_NAMESPACE as a, VERIFICATION_EVENT_KEY as b };
6
+ export { SHOW_CODE_NAMESPACE as S, VERIFICATION_EMAIL_NAMESPACE as V, VERIFICATION_PARENT_NAMESPACE as a, VERIFICATION_EVENT_KEY as b };