@saasquatch/mint-components 1.12.0-1 → 1.12.0-10

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 (158) hide show
  1. package/dist/cjs/{ShadowViewAddon-88821c64.js → ShadowViewAddon-040cffad.js} +6 -3
  2. package/dist/cjs/extractProps-fd93ba62.js +21 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/mint-components.cjs.js +1 -1
  5. package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +91 -72
  6. package/dist/cjs/sqm-big-stat_39.cjs.entry.js +128 -63
  7. package/dist/cjs/sqm-code-verification.cjs.entry.js +67 -77
  8. package/dist/cjs/sqm-email-verification.cjs.entry.js +158 -12
  9. package/dist/cjs/{sqm-invoice-table-view-ce9a34ac.js → sqm-invoice-table-view-c58966f8.js} +79 -0
  10. package/dist/cjs/sqm-stencilbook.cjs.entry.js +56 -14
  11. package/dist/cjs/sqm-widget-verification-internal.cjs.entry.js +81 -11
  12. package/dist/cjs/sqm-widget-verification.cjs.entry.js +102 -19
  13. package/dist/cjs/usePayoutStatus-b9fb7399.js +70 -0
  14. package/dist/cjs/useVerificationEmail-6aacdb71.js +169 -0
  15. package/dist/collection/collection-manifest.json +1 -1
  16. package/dist/collection/components/sqm-big-stat/useBigStat.js +6 -3
  17. package/dist/collection/components/sqm-payout-button-scroll/PayoutButtonScroll.stories.js +1 -2
  18. package/dist/collection/components/sqm-payout-button-scroll/sqm-payout-button-scroll-view.js +1 -0
  19. package/dist/collection/components/sqm-payout-button-scroll/sqm-payout-button-scroll.js +16 -3
  20. package/dist/collection/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.js +9 -2
  21. package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.js +20 -10
  22. package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.js +34 -63
  23. package/dist/collection/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.js +38 -29
  24. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.js +23 -3
  25. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification-view.js +17 -4
  26. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.js +65 -11
  27. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.js +76 -20
  28. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-internal.js +327 -15
  29. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +447 -22
  30. package/dist/collection/components/sqm-widget-verification/useVerificationEmail.js +165 -0
  31. package/dist/collection/components/tax-and-cash/BankingForm.stories.js +1 -0
  32. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +78 -0
  33. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +2 -1
  34. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +7 -0
  35. package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js +0 -1
  36. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.js +10 -0
  37. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +72 -13
  38. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +146 -9
  39. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +30 -15
  40. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/data.js +6 -0
  41. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +8 -8
  42. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +2 -2
  43. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +22 -16
  44. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +99 -88
  45. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +8 -1
  46. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +16 -11
  47. package/dist/esm/{ShadowViewAddon-65c8679e.js → ShadowViewAddon-69b61037.js} +6 -3
  48. package/dist/esm/extractProps-ae1afbb3.js +19 -0
  49. package/dist/esm/{keys-a1496e39.js → keys-db1897ae.js} +1 -1
  50. package/dist/esm/loader.js +1 -1
  51. package/dist/esm/mint-components.js +1 -1
  52. package/dist/esm/sqm-banking-info-form_16.entry.js +91 -72
  53. package/dist/esm/sqm-big-stat_39.entry.js +127 -62
  54. package/dist/esm/sqm-code-verification.entry.js +69 -79
  55. package/dist/esm/sqm-email-verification.entry.js +159 -13
  56. package/dist/esm/{sqm-invoice-table-view-08c03ba7.js → sqm-invoice-table-view-d1cfdaf4.js} +79 -0
  57. package/dist/esm/sqm-stencilbook.entry.js +56 -14
  58. package/dist/esm/sqm-widget-verification-internal.entry.js +84 -14
  59. package/dist/esm/sqm-widget-verification.entry.js +104 -21
  60. package/dist/esm/usePayoutStatus-1a635054.js +67 -0
  61. package/dist/esm/useVerificationEmail-c32696ba.js +167 -0
  62. package/dist/esm-es5/ShadowViewAddon-69b61037.js +1 -0
  63. package/dist/esm-es5/extractProps-ae1afbb3.js +1 -0
  64. package/dist/esm-es5/{keys-a1496e39.js → keys-db1897ae.js} +1 -1
  65. package/dist/esm-es5/loader.js +1 -1
  66. package/dist/esm-es5/mint-components.js +1 -1
  67. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
  68. package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
  69. package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
  70. package/dist/esm-es5/sqm-email-verification.entry.js +1 -1
  71. package/dist/esm-es5/sqm-invoice-table-view-d1cfdaf4.js +1 -0
  72. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  73. package/dist/esm-es5/sqm-widget-verification-internal.entry.js +1 -1
  74. package/dist/esm-es5/sqm-widget-verification.entry.js +1 -1
  75. package/dist/esm-es5/usePayoutStatus-1a635054.js +1 -0
  76. package/dist/esm-es5/useVerificationEmail-c32696ba.js +1 -0
  77. package/dist/mint-components/mint-components.esm.js +1 -1
  78. package/dist/mint-components/p-15c7a1d2.system.entry.js +1 -0
  79. package/dist/mint-components/p-1712a9fd.entry.js +11 -0
  80. package/dist/mint-components/p-1e616d45.system.js +1 -0
  81. package/dist/mint-components/{p-721a89c6.entry.js → p-24092973.entry.js} +2 -2
  82. package/dist/mint-components/p-26468242.js +1 -0
  83. package/dist/mint-components/p-331d060e.entry.js +223 -0
  84. package/dist/mint-components/p-39840341.js +1 -0
  85. package/dist/mint-components/p-4364001c.entry.js +12 -0
  86. package/dist/mint-components/p-4bd7a472.js +1 -0
  87. package/dist/mint-components/p-517224ef.js +19 -0
  88. package/dist/mint-components/p-5a23b560.system.entry.js +1 -0
  89. package/dist/mint-components/p-8300d8c8.system.js +1 -0
  90. package/dist/mint-components/p-8bddb468.system.entry.js +1 -0
  91. package/dist/mint-components/p-9596e97c.system.entry.js +1 -0
  92. package/dist/mint-components/p-974070c4.system.entry.js +1 -0
  93. package/dist/mint-components/{p-b651706a.js → p-9eae245f.js} +6 -3
  94. package/dist/mint-components/p-a8645c1b.system.js +1 -0
  95. package/dist/mint-components/p-b2a99637.system.js +1 -0
  96. package/dist/mint-components/{p-66a04cca.system.entry.js → p-b62faaa5.system.entry.js} +1 -1
  97. package/dist/mint-components/p-c41e1df8.entry.js +195 -0
  98. package/dist/mint-components/p-c510fb88.entry.js +1 -0
  99. package/dist/mint-components/p-ca809fdd.system.js +1 -1
  100. package/dist/mint-components/p-d7806f31.js +48 -0
  101. package/dist/mint-components/p-e01ac27c.system.js +1 -0
  102. package/dist/mint-components/p-e45a8501.system.entry.js +1 -0
  103. package/dist/mint-components/p-e990dc21.system.js +1 -0
  104. package/dist/mint-components/p-f340214f.entry.js +25 -0
  105. package/dist/types/components/sqm-payout-button-scroll/PayoutButtonScroll.stories.d.ts +0 -1
  106. package/dist/types/components/sqm-payout-button-scroll/sqm-payout-button-scroll.d.ts +7 -0
  107. package/dist/types/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.d.ts +1 -0
  108. package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.d.ts +3 -3
  109. package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.d.ts +4 -10
  110. package/dist/types/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.d.ts +2 -0
  111. package/dist/types/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.d.ts +4 -1
  112. package/dist/types/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification-view.d.ts +6 -1
  113. package/dist/types/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.d.ts +10 -2
  114. package/dist/types/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.d.ts +3 -2
  115. package/dist/types/components/sqm-widget-verification/sqm-widget-verification-internal.d.ts +15 -0
  116. package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +79 -0
  117. package/dist/types/components/sqm-widget-verification/useVerificationEmail.d.ts +14 -0
  118. package/dist/types/components/tax-and-cash/TaxForm.stories.d.ts +1 -0
  119. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +1 -0
  120. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.d.ts +2 -0
  121. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +12 -0
  122. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +41 -0
  123. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +12 -0
  124. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/data.d.ts +6 -0
  125. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +2 -2
  126. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +10 -3
  127. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +19 -18
  128. package/dist/types/components.d.ts +366 -92
  129. package/docs/docs.docx +0 -0
  130. package/docs/raisins.json +1 -1
  131. package/grapesjs/grapesjs.js +1 -1
  132. package/package.json +1 -1
  133. package/dist/cjs/useEmailVerification-30a1c7f6.js +0 -75
  134. package/dist/collection/components/sqm-widget-verification/useWidgetVerification.js +0 -3
  135. package/dist/esm/useEmailVerification-7135732c.js +0 -72
  136. package/dist/esm-es5/ShadowViewAddon-65c8679e.js +0 -1
  137. package/dist/esm-es5/sqm-invoice-table-view-08c03ba7.js +0 -1
  138. package/dist/esm-es5/useEmailVerification-7135732c.js +0 -1
  139. package/dist/mint-components/p-117b4705.system.js +0 -1
  140. package/dist/mint-components/p-1bd0cda8.system.entry.js +0 -1
  141. package/dist/mint-components/p-1ee62d9f.system.entry.js +0 -1
  142. package/dist/mint-components/p-1f9a9b70.system.entry.js +0 -1
  143. package/dist/mint-components/p-23fdd44e.entry.js +0 -1
  144. package/dist/mint-components/p-36f7caec.system.entry.js +0 -1
  145. package/dist/mint-components/p-39397731.entry.js +0 -1
  146. package/dist/mint-components/p-39af4acd.entry.js +0 -240
  147. package/dist/mint-components/p-4c9b6fbe.system.js +0 -1
  148. package/dist/mint-components/p-65e2c043.system.js +0 -1
  149. package/dist/mint-components/p-663303b7.entry.js +0 -8
  150. package/dist/mint-components/p-6cae44d7.js +0 -1
  151. package/dist/mint-components/p-7f5c7bf7.system.entry.js +0 -1
  152. package/dist/mint-components/p-8a337864.js +0 -7
  153. package/dist/mint-components/p-a02afa72.system.js +0 -1
  154. package/dist/mint-components/p-a5a9aa07.entry.js +0 -189
  155. package/dist/mint-components/p-c763c0b2.js +0 -1
  156. package/dist/mint-components/p-e93e5740.entry.js +0 -1
  157. package/dist/mint-components/p-e9ca48fc.system.entry.js +0 -1
  158. package/dist/types/components/sqm-widget-verification/useWidgetVerification.d.ts +0 -1
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-b0129cd6.js');
6
6
  const stencilHooks_module = require('./stencil-hooks.module-72742a0b.js');
7
7
  const index_module = require('./index.module-b8d9d0ba.js');
8
+ const utils = require('./utils-6847bc06.js');
8
9
  const keys = require('./keys-cff24974.js');
9
10
 
10
11
  const debug = stencilHooks_module.browser("sq:widget-verification");
@@ -35,23 +36,105 @@ function useTemplateChildren({ parent, callback }) {
35
36
  };
36
37
  }
37
38
  const WidgetVerification = class {
39
+ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
+ CODE STEP PROPS
41
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
38
42
  constructor(hostRef) {
39
43
  index.registerInstance(this, hostRef);
44
+ // ! Any updated must be reflected in sqm-widget-verification-internal AND sqm-email-verification AND sqm-code-verification
45
+ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46
+ EMAIL STEP PROPS
47
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
48
+ /**
49
+ * @uiName Verify email widget header text
50
+ * @uiGroup Email Verification Step
51
+ */
52
+ this.emailStep_verifyEmailHeaderText = "Start by verifying your email. We’ll send you a code through our referral provider, impact.com.";
53
+ /**
54
+ * @uiName Send code to email alert header
55
+ * @uiGroup Email Verification Step
56
+ */
57
+ this.emailStep_sendCodeErrorHeader = "There was an error sending your code.";
58
+ /**
59
+ * @uiName Send code to email alert description
60
+ * @uiGroup Email Verification Step
61
+ */
62
+ this.emailStep_sendCodeErrorDescription = "Please try again. If this problem continues, contact our program support team.";
63
+ /**
64
+ * @uiName Email input label
65
+ * @uiGroup Email Verification Step
66
+ */
67
+ this.emailStep_emailLabel = "Email";
68
+ /**
69
+ * @uiName Send code button text
70
+ * @uiGroup Email Verification Step
71
+ */
72
+ this.emailStep_sendCodeText = "Send code";
73
+ /**
74
+ * @uiName Send code button text
75
+ * @uiGroup Email Verification Step
76
+ */
77
+ this.emailStep_emailValidationErrorText = "Please enter a valid email";
78
+ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79
+ EMAIL STEP PROPS
80
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
81
+ /**
82
+ * @uiName Verify code widget header text
83
+ * @uiGroup Code Verification Step
84
+ */
85
+ this.codeStep_verifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
86
+ /**
87
+ * @uiName Reverify code widget header text
88
+ * @uiGroup Code Verification Step
89
+ */
90
+ this.codeStep_reverifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
91
+ /**
92
+ * Text displayed under verify button
93
+ * @uiName Resend code text
94
+ * @uiGroup Code Verification Step
95
+ */
96
+ this.codeStep_resendCodeText = "Didn't receive your code? {resendCodeLink}";
97
+ /**
98
+ * The link that appears in the resend code link
99
+ * @uiName Resend code label
100
+ * @uiGroup Code Verification Step
101
+ */
102
+ this.codeStep_resendCodeLabel = "Resend code";
103
+ /**
104
+ * Link text displayed under verify button
105
+ * @uiName Resend code text
106
+ * @uiGroup Code Verification Step
107
+ */
108
+ this.codeStep_codeResentSuccessfullyText = "Another code has been sent to {email}";
109
+ /**
110
+ * Error text displayed under verification input
111
+ * @uiName Invalid code text
112
+ * @uiGroup Code Verification Step
113
+ */
114
+ this.codeStep_invalidCodeText = "Please check your code and try again. If you’re still having trouble, try resending your code.";
115
+ /**
116
+ * @uiName Verify code button text
117
+ * @uiGroup Code Verification Step
118
+ */
119
+ this.codeStep_verifyText = "Verify";
120
+ /**
121
+ * Displayed when the email verification fails due to a network error. The participant can try refreshing the page.
122
+ * @uiName Network error message
123
+ * @uiGroup Code Verification Step
124
+ */
125
+ this.codeStep_networkErrorMessage = "An error occurred while verifying your email. Please refresh the page and try again.";
40
126
  stencilHooks_module.h$1(this);
41
127
  }
42
128
  disconnectedCallback() { }
43
129
  render() {
44
130
  const [context, setContext] = index_module.Fn({
45
131
  namespace: keys.VERIFICATION_PARENT_NAMESPACE,
46
- initialValue: undefined,
132
+ initialValue: false,
47
133
  });
48
- const authToken = context === null || context === void 0 ? void 0 : context.token;
49
134
  const [container, setContainer] = stencilHooks_module.useState(undefined);
50
135
  const [slot, setSlot] = stencilHooks_module.useState(undefined);
51
- if (!authToken)
52
- debug("No user identity available");
53
136
  const updateTemplates = index_module.useCallback(() => {
54
- const isAuth = !!authToken;
137
+ const isAuth = context;
55
138
  const templates = slot.querySelectorAll(`template`);
56
139
  const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
57
140
  if (template) {
@@ -99,7 +182,7 @@ const WidgetVerification = class {
99
182
  target.style.height = "25px";
100
183
  });
101
184
  }
102
- }, [container, slot, authToken]);
185
+ }, [container, slot, context]);
103
186
  stencilHooks_module.useEffect(() => {
104
187
  if (!container || !slot) {
105
188
  debug("DOM not ready:");
@@ -108,19 +191,19 @@ const WidgetVerification = class {
108
191
  // Run on first render
109
192
  updateTemplates();
110
193
  return useTemplateChildren({ parent: slot, callback: updateTemplates });
111
- }, [slot, container, authToken]);
112
- stencilHooks_module.useEffect(() => {
113
- const host = stencilHooks_module.l();
114
- const callback = (e) => {
115
- e.stopPropagation();
116
- setContext({ token: e.detail.token });
117
- };
118
- host.addEventListener(keys.VERIFICATION_EVENT_KEY, callback);
119
- return () => {
120
- host.removeEventListener(keys.VERIFICATION_EVENT_KEY, callback);
121
- };
122
- }, []);
123
- return (index.h(index.Host, null, index.h("div", { ref: setSlot, style: { display: "contents" } }, index.h("template", { slot: "not-verified" }, index.h("sqm-widget-verification-internal", null)), index.h("slot", { name: "not-verified" }), index.h("slot", { name: "verified" })), index.h("div", { ref: setContainer }, index.h("slot", { name: "shown" }))));
194
+ }, [slot, container, context]);
195
+ // useEffect(() => {
196
+ // const host = useHost();
197
+ // const callback = (e: CustomEvent) => {
198
+ // e.stopPropagation();
199
+ // setContext({ token: e.detail.token });
200
+ // };
201
+ // host.addEventListener(VERIFICATION_EVENT_KEY, callback);
202
+ // return () => {
203
+ // host.removeEventListener(VERIFICATION_EVENT_KEY, callback);
204
+ // };
205
+ // }, []);
206
+ return (index.h(index.Host, null, index.h("div", { ref: setSlot, style: { display: "contents" } }, index.h("template", { slot: "not-verified" }, index.h("sqm-widget-verification-internal", Object.assign({}, utils.getProps(this)))), index.h("slot", { name: "not-verified" }), index.h("slot", { name: "verified" })), index.h("div", { ref: setContainer }, index.h("slot", { name: "shown" }))));
124
207
  }
125
208
  };
126
209
 
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ const stencilHooks_module = require('./stencil-hooks.module-72742a0b.js');
4
+ const index_module = require('./index.module-b8d9d0ba.js');
5
+
6
+ const GET_USER_STATUS = index_module.dist.gql `
7
+ query getUserStatus {
8
+ user: viewer {
9
+ ... on User {
10
+ id
11
+ impactConnection {
12
+ connected
13
+ publisher {
14
+ id
15
+ payoutsAccount {
16
+ hold
17
+ holdReasons
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ `;
25
+ function getStatus(data) {
26
+ var _a, _b, _c, _d, _e;
27
+ const account = (_b = (_a = data.user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.payoutsAccount;
28
+ if (!((_d = (_c = data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.connected) || !account)
29
+ return "INFORMATION_REQUIRED";
30
+ if ((_e = account.holdReasons) === null || _e === void 0 ? void 0 : _e.includes("IDV_CHECK_REQUIRED"))
31
+ return "VERIFICATION_NEEDED";
32
+ if (account.hold)
33
+ return "HOLD";
34
+ return "DONE";
35
+ }
36
+ function usePayoutStatus(props) {
37
+ const { type } = index_module.getEnvironmentSDK();
38
+ const { loading, data, errors, refetch } = index_module.En(GET_USER_STATUS, {});
39
+ const [status, setStatus] = stencilHooks_module.useState(undefined);
40
+ const [showDialog, setShowDialog] = stencilHooks_module.useState(false);
41
+ stencilHooks_module.useEffect(() => {
42
+ if (!data)
43
+ return;
44
+ const s = getStatus(data);
45
+ setStatus(s);
46
+ }, [data]);
47
+ stencilHooks_module.useEffect(() => {
48
+ const cb = () => refetch();
49
+ window.addEventListener("sqm:tax-form-updated", cb);
50
+ return () => window.removeEventListener("sqm:tax-form-updated", cb);
51
+ }, []);
52
+ return {
53
+ states: {
54
+ loading,
55
+ status,
56
+ showVerifyIdentity: showDialog,
57
+ error: !!errors,
58
+ },
59
+ data: { type },
60
+ text: props.getTextProps(),
61
+ callbacks: {
62
+ onTermsClick: () => window.open(props.termsUrl, "_blank").focus(),
63
+ onClick: () => setShowDialog(true),
64
+ onCancel: () => setShowDialog(false),
65
+ },
66
+ };
67
+ }
68
+
69
+ exports.getStatus = getStatus;
70
+ exports.usePayoutStatus = usePayoutStatus;
@@ -0,0 +1,169 @@
1
+ 'use strict';
2
+
3
+ const stencilHooks_module = require('./stencil-hooks.module-72742a0b.js');
4
+ const index_module = require('./index.module-b8d9d0ba.js');
5
+
6
+ const UserLookupQuery = index_module.dist.gql `
7
+ query userLookup {
8
+ viewer {
9
+ ... on User {
10
+ id
11
+ accountId
12
+ email
13
+ impactConnection {
14
+ user {
15
+ id
16
+ email
17
+ }
18
+ }
19
+ }
20
+ }
21
+ }
22
+ `;
23
+ const ParticipantVerificationEmailMutation = index_module.dist.gql `
24
+ mutation requestUserEmailVerification($user: UserIdInput!) {
25
+ requestUserEmailVerification(user: $user) {
26
+ success
27
+ }
28
+ }
29
+ `;
30
+ const ImpactVerificationEmailMutation = index_module.dist.gql `
31
+ mutation requestImpactPublisherEmail2FA($user: UserIdInput!) {
32
+ requestImpactPublisherEmail2FA(user: $user) {
33
+ success
34
+ }
35
+ }
36
+ `;
37
+ const VerifyUserEmailMutation = index_module.dist.gql `
38
+ mutation verifyUserEmail($user: UserIdInput!, $code: String!) {
39
+ verifyUserEmail(user: $user, code: $code) {
40
+ id
41
+ accountId
42
+ email
43
+ emailVerified
44
+ }
45
+ }
46
+ `;
47
+ const SubmitImpactCodeMutation = index_module.dist.gql `
48
+ mutation submitImpactPublisherEmail2FACode(
49
+ $user: UserIdInput!
50
+ $code: String!
51
+ ) {
52
+ submitImpactPublisherEmail2FACode(user: $user, code: $code) {
53
+ verifiedEmail
54
+ accessKey
55
+ }
56
+ }
57
+ `;
58
+ // ! It's important when using this hook to ensure initialisation
59
+ // ! is done before calling any mutations
60
+ function useVerificationEmail() {
61
+ const userIdentity = index_module.K();
62
+ const [hasEmails, setHasEmails] = stencilHooks_module.useState({
63
+ participant: false,
64
+ impact: false,
65
+ });
66
+ const [fetch] = index_module.an(UserLookupQuery);
67
+ // Send mutations
68
+ const [sendParticipantEmail, { loading: participantEmailLoading, errors: participantEmailErrors },] = index_module.xe(ParticipantVerificationEmailMutation);
69
+ const [sendImpactEmail, { loading: impactEmailLoading, errors: impactEmailErrors },] = index_module.xe(ImpactVerificationEmailMutation);
70
+ const sendLoading = participantEmailLoading || impactEmailLoading;
71
+ const sendErrors = participantEmailErrors || impactEmailErrors;
72
+ // Verification mutations
73
+ const [verifyUserEmail, { loading: verifyMutationLoading, errors: verifyMutationErrors },] = index_module.xe(VerifyUserEmailMutation);
74
+ const [submitImpactCode, { loading: submitImpactCodeLoading, errors: submitImpactCodeErrors },] = index_module.xe(SubmitImpactCodeMutation);
75
+ const verifyLoading = verifyMutationLoading || submitImpactCodeLoading;
76
+ const verifyErrors = verifyMutationErrors || submitImpactCodeErrors;
77
+ const [initialized, setInitialized] = stencilHooks_module.useState(false);
78
+ const initialise = async () => {
79
+ var _a, _b, _c, _d;
80
+ try {
81
+ const lookup = await fetch({});
82
+ if (!lookup || lookup instanceof Error)
83
+ throw new Error();
84
+ setHasEmails({
85
+ participant: !!((_a = lookup === null || lookup === void 0 ? void 0 : lookup.viewer) === null || _a === void 0 ? void 0 : _a.email),
86
+ impact: !!((_d = (_c = (_b = lookup === null || lookup === void 0 ? void 0 : lookup.viewer) === null || _b === void 0 ? void 0 : _b.impactConnection) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.email),
87
+ });
88
+ setInitialized(true);
89
+ }
90
+ catch (e) {
91
+ console.error("Could not initialise verification", e);
92
+ }
93
+ };
94
+ const sendVerificationEmail = async () => {
95
+ let result = null;
96
+ if (!initialized)
97
+ return result;
98
+ if (!hasEmails.participant && !hasEmails.impact)
99
+ return result;
100
+ try {
101
+ const request = hasEmails.impact ? sendImpactEmail : sendParticipantEmail;
102
+ const res = await request({
103
+ user: {
104
+ id: userIdentity.id,
105
+ accountId: userIdentity.accountId,
106
+ },
107
+ });
108
+ if (res instanceof Error || !res)
109
+ throw new Error();
110
+ result = hasEmails.impact
111
+ ? res.requestImpactPublisherEmail2FA
112
+ : res.requestUserEmailVerification;
113
+ }
114
+ catch (e) {
115
+ console.error("Could not send verification email", e);
116
+ }
117
+ finally {
118
+ return result;
119
+ }
120
+ };
121
+ const verifyVerificationEmail = async (code) => {
122
+ var _a;
123
+ let result = null;
124
+ if (!initialized)
125
+ return result;
126
+ if (!hasEmails.participant && !hasEmails.impact)
127
+ return result;
128
+ try {
129
+ const request = hasEmails.impact ? submitImpactCode : verifyUserEmail;
130
+ const res = await request({
131
+ user: {
132
+ id: userIdentity.id,
133
+ accountId: userIdentity.accountId,
134
+ },
135
+ code,
136
+ });
137
+ if (res instanceof Error || !res)
138
+ throw new Error();
139
+ result = {
140
+ success: true,
141
+ accessKey: hasEmails.impact
142
+ ? (_a = res.submitImpactPublisherEmail2FACode) === null || _a === void 0 ? void 0 : _a.accessKey : undefined,
143
+ };
144
+ }
145
+ catch (e) {
146
+ console.error("Could not verify email", e);
147
+ }
148
+ finally {
149
+ return result;
150
+ }
151
+ };
152
+ stencilHooks_module.useEffect(() => {
153
+ if (!initialized)
154
+ initialise();
155
+ }, []);
156
+ return {
157
+ initialized,
158
+ send: [
159
+ sendVerificationEmail,
160
+ { loading: sendLoading, errors: sendErrors },
161
+ ],
162
+ verify: [
163
+ verifyVerificationEmail,
164
+ { loading: verifyLoading, errors: verifyErrors },
165
+ ],
166
+ };
167
+ }
168
+
169
+ exports.useVerificationEmail = useVerificationEmail;
@@ -110,8 +110,8 @@
110
110
  "./components/sqm-user-name/sqm-user-name.js",
111
111
  "./components/sqm-widget-verification/sqm-widget-verification-internal.js",
112
112
  "./components/sqm-widget-verification/sqm-widget-verification.js",
113
- "./components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.js",
114
113
  "./components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.js",
114
+ "./components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.js",
115
115
  "./components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card.js",
116
116
  "./components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js"
117
117
  ],
@@ -709,9 +709,12 @@ const payoutBalanceQuery = () => {
709
709
  query payoutBalance {
710
710
  viewer: viewer {
711
711
  ... on User {
712
- publisher {
713
- payoutsAccount {
714
- balance
712
+ id
713
+ impactConnection {
714
+ publisher {
715
+ payoutsAccount {
716
+ balance
717
+ }
715
718
  }
716
719
  }
717
720
  }
@@ -3,7 +3,6 @@ export default {
3
3
  title: "Components/Payout Scroll Button",
4
4
  };
5
5
  const defaultProps = {
6
- payoutSettingsComplete: false,
6
+ payoutSettingsComplete: true,
7
7
  };
8
- export const Default = () => (h("sqm-payout-button-scroll", { demoData: { states: defaultProps } }));
9
8
  export const CompletedTaxForm = () => (h("sqm-payout-button-scroll", { demoData: { states: { ...defaultProps, payoutSettingsComplete: true } } }));
@@ -7,6 +7,7 @@ const style = {
7
7
  PayoutButtonDescription: {
8
8
  color: "var(--sl-color-neutral-500)",
9
9
  fontSize: "var(--sl-font-size-small)",
10
+ margin: "0",
10
11
  },
11
12
  };
12
13
  const sheet = createStyleSheet(style);
@@ -8,7 +8,14 @@ import deepmerge from "deepmerge";
8
8
  */
9
9
  export class PayoutButtonScroll {
10
10
  constructor() {
11
+ /**
12
+ * @uiName Payout button text
13
+ */
11
14
  this.payoutButtonText = "Payouts & Tax Settings";
15
+ /**
16
+ * Description text under payout button
17
+ * @uiName Payout button description text
18
+ */
12
19
  this.payoutButtonDescription = "Check your payout settings to see when you’ll get paid out next";
13
20
  this.ignored = true;
14
21
  withHooks(this);
@@ -35,7 +42,10 @@ export class PayoutButtonScroll {
35
42
  "required": false,
36
43
  "optional": false,
37
44
  "docs": {
38
- "tags": [],
45
+ "tags": [{
46
+ "text": "Payout button text",
47
+ "name": "uiName"
48
+ }],
39
49
  "text": ""
40
50
  },
41
51
  "attribute": "payout-button-text",
@@ -53,8 +63,11 @@ export class PayoutButtonScroll {
53
63
  "required": false,
54
64
  "optional": false,
55
65
  "docs": {
56
- "tags": [],
57
- "text": ""
66
+ "tags": [{
67
+ "text": "Payout button description text",
68
+ "name": "uiName"
69
+ }],
70
+ "text": "Description text under payout button"
58
71
  },
59
72
  "attribute": "payout-button-description",
60
73
  "reflect": false,
@@ -3,12 +3,19 @@ export default {
3
3
  title: "Components/Widget Code Verification",
4
4
  };
5
5
  const defaultProps = {
6
+ initialiseLoading: false,
6
7
  email: "testemail@example.com",
7
8
  loading: false,
8
9
  verifyFailed: false,
9
- codeResent: false,
10
+ emailResent: false,
10
11
  };
11
12
  export const Default = () => (h("sqm-code-verification", { demoData: { states: defaultProps } }));
13
+ export const InitialLoading = () => (h("sqm-code-verification", { demoData: {
14
+ states: {
15
+ ...defaultProps,
16
+ initialiseLoading: true,
17
+ },
18
+ } }));
12
19
  export const Loading = () => (h("sqm-code-verification", { demoData: {
13
20
  states: {
14
21
  ...defaultProps,
@@ -18,7 +25,7 @@ export const Loading = () => (h("sqm-code-verification", { demoData: {
18
25
  export const CodeResent = () => (h("sqm-code-verification", { demoData: {
19
26
  states: {
20
27
  ...defaultProps,
21
- codeResent: true,
28
+ emailResent: true,
22
29
  },
23
30
  } }));
24
31
  export const VerificationFailed = () => (h("sqm-code-verification", { demoData: {
@@ -85,7 +85,16 @@ export function WidgetCodeVerificationView(props) {
85
85
  id: "resendCodeText",
86
86
  defaultMessage: text.resendCodeText,
87
87
  }, {
88
- resendCodeLink: (h("a", { href: text.resendCodeLink, target: "_blank", style: { textDecoration: "none" } }, text.resendCodeLabel)),
88
+ resendCodeLink: (h("a", { href: "", style: { textDecoration: "none" }, onClick: (e) => {
89
+ e.preventDefault();
90
+ callbacks.resendEmail();
91
+ } }, text.resendCodeLabel)),
92
+ });
93
+ const codeResentSuccessfully = intl.formatMessage({
94
+ id: "codeResentSuccessfully",
95
+ defaultMessage: text.codeResentSuccessfullyText,
96
+ }, {
97
+ email: states.email,
89
98
  });
90
99
  const inputClass = states.verifyFailed
91
100
  ? sheet.classes.CodeInputError
@@ -96,11 +105,14 @@ export function WidgetCodeVerificationView(props) {
96
105
  styleString),
97
106
  h("div", { class: sheet.classes.Wrapper },
98
107
  h("div", { class: sheet.classes.HeaderContainer },
99
- h(TextSpanView, { type: "p" }, states.verifyFailed
100
- ? text.reverifyCodeHeaderText
101
- : text.verifyCodeHeaderText)),
102
- states.codeResent && (h("sqm-form-message", { type: "success", exportparts: "successalert-icon" },
103
- h("b", null, text.codeResentSuccessfullyText))),
108
+ h(TextSpanView, { type: "p" }, intl.formatMessage({
109
+ id: `emailHeaderText`,
110
+ defaultMessage: states.verifyFailed
111
+ ? text.reverifyCodeHeaderText
112
+ : text.verifyCodeHeaderText,
113
+ }, { email: states.email }))),
114
+ states.emailResent && (h("sqm-form-message", { type: "success", exportparts: "successalert-icon" },
115
+ h("b", null, codeResentSuccessfully))),
104
116
  h("div", { class: sheet.classes.InputsContainer },
105
117
  h("div", { ref: refs.codeWrapperRef, class: sheet.classes.CodeInputContainer },
106
118
  h("sl-input", { class: inputClass, name: "code" }),
@@ -110,9 +122,7 @@ export function WidgetCodeVerificationView(props) {
110
122
  h("sl-input", { class: inputClass, name: "code" }),
111
123
  h("sl-input", { class: inputClass, name: "code" })),
112
124
  states.verifyFailed && (h("p", { class: sheet.classes.ErrorText }, text.invalidCodeText)),
113
- h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.submitCode, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, text.verifyText)),
125
+ 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)),
114
126
  h("div", { class: sheet.classes.FooterContainer },
115
- h(TextSpanView, { type: "p" }, resendCodeText),
116
- h(TextSpanView, { type: "p" },
117
- h("a", { href: "/", style: { textDecoration: "none" } }, text.useDifferentEmailText))))));
127
+ h(TextSpanView, { type: "p" }, resendCodeText)))));
118
128
  }