@saasquatch/mint-components 1.12.0-9 → 1.12.1-1

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 (187) hide show
  1. package/dist/cjs/{ShadowViewAddon-040cffad.js → ShadowViewAddon-88821c64.js} +3 -6
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +79 -202
  5. package/dist/cjs/sqm-big-stat_39.cjs.entry.js +160 -281
  6. package/dist/cjs/{sqm-invoice-table-view-c58966f8.js → sqm-invoice-table-view-a9133a11.js} +0 -98
  7. package/dist/cjs/sqm-portal-registration-form-view-621348a6.js +85 -0
  8. package/dist/cjs/sqm-portal-registration-form.cjs.entry.js +12 -81
  9. package/dist/cjs/sqm-stencilbook.cjs.entry.js +323 -334
  10. package/dist/collection/collection-manifest.json +1 -6
  11. package/dist/collection/components/sqm-big-stat/useBigStat.js +3 -6
  12. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +5 -5
  13. package/dist/collection/components/sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories.js +11 -0
  14. package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js +160 -0
  15. package/dist/collection/components/sqm-portal-registration-form/PortalRegistrationForm.stories.js +5 -1
  16. package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form-view.js +1 -1
  17. package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form.js +3 -2
  18. package/dist/collection/components/sqm-portal-registration-form/usePortalRegistrationForm.js +6 -0
  19. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +4 -8
  20. package/dist/collection/components/tax-and-cash/BankingForm.stories.js +0 -2
  21. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +0 -96
  22. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +1 -5
  23. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +38 -101
  24. package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js +2 -15
  25. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/data.js +0 -7
  26. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +8 -8
  27. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +2 -2
  28. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +0 -22
  29. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +9 -99
  30. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +1 -8
  31. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +2 -2
  32. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +11 -14
  33. package/dist/esm/{ShadowViewAddon-69b61037.js → ShadowViewAddon-65c8679e.js} +3 -6
  34. package/dist/esm/loader.js +1 -1
  35. package/dist/esm/mint-components.js +1 -1
  36. package/dist/esm/sqm-banking-info-form_16.entry.js +79 -202
  37. package/dist/esm/sqm-big-stat_39.entry.js +159 -280
  38. package/dist/esm/{sqm-invoice-table-view-d1cfdaf4.js → sqm-invoice-table-view-71915a5e.js} +0 -98
  39. package/dist/esm/sqm-portal-registration-form-view-1d3066e1.js +83 -0
  40. package/dist/esm/sqm-portal-registration-form.entry.js +18 -87
  41. package/dist/esm/sqm-stencilbook.entry.js +323 -334
  42. package/dist/esm/stencil-hooks.module-ac12ca1c.js +1 -1
  43. package/dist/esm-es5/ShadowViewAddon-65c8679e.js +1 -0
  44. package/dist/esm-es5/loader.js +1 -1
  45. package/dist/esm-es5/mint-components.js +1 -1
  46. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
  47. package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
  48. package/dist/esm-es5/sqm-invoice-table-view-71915a5e.js +1 -0
  49. package/dist/esm-es5/sqm-portal-registration-form-view-1d3066e1.js +1 -0
  50. package/dist/esm-es5/sqm-portal-registration-form.entry.js +1 -1
  51. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  52. package/dist/esm-es5/stencil-hooks.module-ac12ca1c.js +1 -1
  53. package/dist/mint-components/mint-components.esm.js +1 -1
  54. package/dist/mint-components/p-1279f7a3.system.entry.js +1 -0
  55. package/dist/mint-components/p-15a64357.entry.js +13 -0
  56. package/dist/mint-components/p-17f56865.entry.js +9 -0
  57. package/dist/mint-components/p-2a414b2e.system.js +2 -2
  58. package/dist/mint-components/p-3cb18382.system.js +1 -0
  59. package/dist/mint-components/p-40b1de58.js +1 -0
  60. package/dist/mint-components/p-4112e198.system.js +1 -0
  61. package/dist/mint-components/p-5cd917db.js +1 -0
  62. package/dist/mint-components/p-6792c8d8.system.entry.js +1 -0
  63. package/dist/mint-components/p-a02afa72.system.js +1 -0
  64. package/dist/mint-components/p-acd77a6e.entry.js +223 -0
  65. package/dist/mint-components/p-b3e97f8a.system.entry.js +1 -0
  66. package/dist/mint-components/{p-9eae245f.js → p-b651706a.js} +3 -6
  67. package/dist/mint-components/p-b8233366.entry.js +174 -0
  68. package/dist/mint-components/p-ca809fdd.system.js +1 -1
  69. package/dist/mint-components/p-cb38b9b0.system.entry.js +1 -0
  70. package/dist/mint-components/p-fd2c5407.js +2 -2
  71. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field-view.d.ts +1 -1
  72. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +4 -4
  73. package/dist/types/components/sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories.d.ts +8 -0
  74. package/dist/types/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.d.ts +34 -0
  75. package/dist/types/components/sqm-portal-registration-form/PortalRegistrationForm.stories.d.ts +1 -0
  76. package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form-view.d.ts +1 -0
  77. package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form.d.ts +1 -1
  78. package/dist/types/components/tax-and-cash/TaxForm.stories.d.ts +0 -2
  79. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +0 -2
  80. package/dist/types/components/tax-and-cash/sqm-docusign-form/useDocusignForm.d.ts +1 -1
  81. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/data.d.ts +0 -6
  82. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +2 -2
  83. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +0 -12
  84. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +2 -19
  85. package/dist/types/components.d.ts +108 -625
  86. package/docs/docs.docx +0 -0
  87. package/docs/raisins.json +1 -1
  88. package/grapesjs/grapesjs.js +1 -1
  89. package/package.json +2 -2
  90. package/dist/cjs/extractProps-fd93ba62.js +0 -21
  91. package/dist/cjs/keys-cff24974.js +0 -11
  92. package/dist/cjs/sqm-code-verification.cjs.entry.js +0 -342
  93. package/dist/cjs/sqm-email-verification.cjs.entry.js +0 -283
  94. package/dist/cjs/sqm-scroll.cjs.entry.js +0 -109
  95. package/dist/cjs/sqm-widget-verification-internal.cjs.entry.js +0 -103
  96. package/dist/cjs/sqm-widget-verification.cjs.entry.js +0 -210
  97. package/dist/cjs/usePayoutStatus-b9fb7399.js +0 -70
  98. package/dist/cjs/useVerificationEmail-6aacdb71.js +0 -169
  99. package/dist/collection/components/sqm-payout-button-scroll/PayoutButtonScroll.stories.js +0 -8
  100. package/dist/collection/components/sqm-payout-button-scroll/sqm-payout-button-scroll-view.js +0 -23
  101. package/dist/collection/components/sqm-payout-button-scroll/sqm-payout-button-scroll.js +0 -118
  102. package/dist/collection/components/sqm-payout-button-scroll/usePayoutButton.js +0 -44
  103. package/dist/collection/components/sqm-widget-verification/keys.js +0 -4
  104. package/dist/collection/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.js +0 -36
  105. package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.js +0 -128
  106. package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.js +0 -301
  107. package/dist/collection/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.js +0 -153
  108. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.js +0 -42
  109. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification-view.js +0 -91
  110. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.js +0 -226
  111. package/dist/collection/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.js +0 -126
  112. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-internal.js +0 -339
  113. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +0 -557
  114. package/dist/collection/components/sqm-widget-verification/useVerificationEmail.js +0 -165
  115. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.js +0 -22
  116. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +0 -131
  117. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +0 -354
  118. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +0 -65
  119. package/dist/esm/extractProps-ae1afbb3.js +0 -19
  120. package/dist/esm/keys-db1897ae.js +0 -6
  121. package/dist/esm/sqm-code-verification.entry.js +0 -338
  122. package/dist/esm/sqm-email-verification.entry.js +0 -279
  123. package/dist/esm/sqm-scroll.entry.js +0 -105
  124. package/dist/esm/sqm-widget-verification-internal.entry.js +0 -99
  125. package/dist/esm/sqm-widget-verification.entry.js +0 -206
  126. package/dist/esm/usePayoutStatus-1a635054.js +0 -67
  127. package/dist/esm/useVerificationEmail-c32696ba.js +0 -167
  128. package/dist/esm-es5/ShadowViewAddon-69b61037.js +0 -1
  129. package/dist/esm-es5/extractProps-ae1afbb3.js +0 -1
  130. package/dist/esm-es5/keys-db1897ae.js +0 -1
  131. package/dist/esm-es5/sqm-code-verification.entry.js +0 -1
  132. package/dist/esm-es5/sqm-email-verification.entry.js +0 -1
  133. package/dist/esm-es5/sqm-invoice-table-view-d1cfdaf4.js +0 -1
  134. package/dist/esm-es5/sqm-scroll.entry.js +0 -1
  135. package/dist/esm-es5/sqm-widget-verification-internal.entry.js +0 -1
  136. package/dist/esm-es5/sqm-widget-verification.entry.js +0 -1
  137. package/dist/esm-es5/usePayoutStatus-1a635054.js +0 -1
  138. package/dist/esm-es5/useVerificationEmail-c32696ba.js +0 -1
  139. package/dist/mint-components/p-1712a9fd.entry.js +0 -11
  140. package/dist/mint-components/p-1e616d45.system.js +0 -1
  141. package/dist/mint-components/p-24092973.entry.js +0 -9
  142. package/dist/mint-components/p-26468242.js +0 -1
  143. package/dist/mint-components/p-331d060e.entry.js +0 -223
  144. package/dist/mint-components/p-3925bcd6.entry.js +0 -13
  145. package/dist/mint-components/p-39840341.js +0 -1
  146. package/dist/mint-components/p-4364001c.entry.js +0 -12
  147. package/dist/mint-components/p-4bd7a472.js +0 -1
  148. package/dist/mint-components/p-517224ef.js +0 -19
  149. package/dist/mint-components/p-5a23b560.system.entry.js +0 -1
  150. package/dist/mint-components/p-64491210.system.entry.js +0 -1
  151. package/dist/mint-components/p-8300d8c8.system.js +0 -1
  152. package/dist/mint-components/p-8bddb468.system.entry.js +0 -1
  153. package/dist/mint-components/p-9596e97c.system.entry.js +0 -1
  154. package/dist/mint-components/p-974070c4.system.entry.js +0 -1
  155. package/dist/mint-components/p-a85f57bb.entry.js +0 -1
  156. package/dist/mint-components/p-a8645c1b.system.js +0 -1
  157. package/dist/mint-components/p-b2a99637.system.js +0 -1
  158. package/dist/mint-components/p-b62faaa5.system.entry.js +0 -1
  159. package/dist/mint-components/p-c05e7b9f.entry.js +0 -195
  160. package/dist/mint-components/p-c510fb88.entry.js +0 -1
  161. package/dist/mint-components/p-c7057066.system.entry.js +0 -1
  162. package/dist/mint-components/p-d7806f31.js +0 -48
  163. package/dist/mint-components/p-e01ac27c.system.js +0 -1
  164. package/dist/mint-components/p-e45a8501.system.entry.js +0 -1
  165. package/dist/mint-components/p-e990dc21.system.js +0 -1
  166. package/dist/mint-components/p-ead27698.system.entry.js +0 -1
  167. package/dist/mint-components/p-f340214f.entry.js +0 -25
  168. package/dist/types/components/sqm-payout-button-scroll/PayoutButtonScroll.stories.d.ts +0 -5
  169. package/dist/types/components/sqm-payout-button-scroll/sqm-payout-button-scroll-view.d.ts +0 -10
  170. package/dist/types/components/sqm-payout-button-scroll/sqm-payout-button-scroll.d.ts +0 -26
  171. package/dist/types/components/sqm-payout-button-scroll/usePayoutButton.d.ts +0 -7
  172. package/dist/types/components/sqm-widget-verification/keys.d.ts +0 -4
  173. package/dist/types/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.d.ts +0 -9
  174. package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.d.ts +0 -26
  175. package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.d.ts +0 -54
  176. package/dist/types/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.d.ts +0 -25
  177. package/dist/types/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.d.ts +0 -10
  178. package/dist/types/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification-view.d.ts +0 -21
  179. package/dist/types/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.d.ts +0 -40
  180. package/dist/types/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.d.ts +0 -10
  181. package/dist/types/components/sqm-widget-verification/sqm-widget-verification-internal.d.ts +0 -20
  182. package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +0 -87
  183. package/dist/types/components/sqm-widget-verification/useVerificationEmail.d.ts +0 -14
  184. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.d.ts +0 -10
  185. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +0 -30
  186. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +0 -62
  187. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +0 -21
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-9",
4
+ "version": "1.12.1-1",
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",
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@raisins/stencil-docs-target": "^1.1.1",
74
- "@saasquatch/component-boilerplate": "^1.6.8-0",
74
+ "@saasquatch/component-boilerplate": "^1.6.7",
75
75
  "@saasquatch/dom-context-hooks": "^1.0.5",
76
76
  "@saasquatch/shoelace": "^1.0.0",
77
77
  "@saasquatch/stencil-hooks": "^2.0.2",
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Util function for getting just the props with a certain prefix.
5
- * @param props Text props on stencil component
6
- * @param prefix Prefix denoting which group the text prop belongs to
7
- * @returns A new object with all keys with the prefix provided. The prefix is removed from each key.
8
- */
9
- function extractProps(props, prefix) {
10
- const keys = Object.keys(props).filter((k) => k.startsWith(prefix));
11
- const formattedProps = keys.reduce((prev, k) => {
12
- const key = k.replace(prefix, "");
13
- return {
14
- ...prev,
15
- [key]: props[k],
16
- };
17
- }, {});
18
- return formattedProps;
19
- }
20
-
21
- exports.extractProps = extractProps;
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- const SHOW_CODE_NAMESPACE = "sq:code-verification";
4
- const VERIFICATION_EMAIL_NAMESPACE = "sq:verification-email";
5
- const VERIFICATION_PARENT_NAMESPACE = "sq:verification-context";
6
- const VERIFICATION_EVENT_KEY = "sq:code-verified";
7
-
8
- exports.SHOW_CODE_NAMESPACE = SHOW_CODE_NAMESPACE;
9
- exports.VERIFICATION_EMAIL_NAMESPACE = VERIFICATION_EMAIL_NAMESPACE;
10
- exports.VERIFICATION_EVENT_KEY = VERIFICATION_EVENT_KEY;
11
- exports.VERIFICATION_PARENT_NAMESPACE = VERIFICATION_PARENT_NAMESPACE;
@@ -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-6aacdb71.js');
16
-
17
- const style = {
18
- Wrapper: {
19
- display: "flex",
20
- flexDirection: "column",
21
- gap: "var(--sl-spacing-medium)",
22
- maxWidth: "515px",
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, 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(-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,
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,283 +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 cjs = require('./cjs-1066ec21.js');
9
- const JSS = require('./JSS-8503a151.js');
10
- const utils = require('./utils-6847bc06.js');
11
- const sqmTextSpanView = require('./sqm-text-span-view-e1cd9bd3.js');
12
- const keys = require('./keys-cff24974.js');
13
- const useVerificationEmail = require('./useVerificationEmail-6aacdb71.js');
14
-
15
- const UpsertUserEmailMutation = index_module.dist.gql `
16
- mutation upsertUser($userInput: UserInput!) {
17
- user(userInput: $userInput) {
18
- id
19
- accountId
20
- email
21
- }
22
- }
23
- `;
24
- const UserLookupQuery = index_module.dist.gql `
25
- query user {
26
- viewer {
27
- ... on User {
28
- id
29
- accountId
30
- email
31
- impactConnection {
32
- user {
33
- id
34
- email
35
- }
36
- }
37
- }
38
- }
39
- }
40
- `;
41
- function useUpsertUserEmail() {
42
- const user = index_module.K();
43
- const [request, { loading: loading, data, errors }] = index_module.xe(UpsertUserEmailMutation);
44
- const upsertUserEmail = async (email) => {
45
- try {
46
- const result = await request({
47
- user: {
48
- id: user.id,
49
- accountId: user.accountId,
50
- email,
51
- },
52
- });
53
- if (result instanceof Error || !result)
54
- throw new Error();
55
- return result;
56
- }
57
- catch (e) {
58
- console.error("Could not set email on user", e);
59
- return undefined;
60
- }
61
- };
62
- return [
63
- upsertUserEmail,
64
- {
65
- loading,
66
- data,
67
- errors,
68
- },
69
- ];
70
- }
71
- function useWidgetEmailVerification(props) {
72
- const [_, setShowCode] = index_module.Mn(keys.SHOW_CODE_NAMESPACE);
73
- const [email, setEmail] = index_module.Mn(keys.VERIFICATION_EMAIL_NAMESPACE);
74
- const [emailExists, setEmailExists] = stencilHooks_module.useState(false);
75
- const [error, setError] = stencilHooks_module.useState(false);
76
- const [mutationError, setMutationError] = stencilHooks_module.useState(false);
77
- const { initialized, send: [sendEmail, { loading: sendLoading, errors }], } = useVerificationEmail.useVerificationEmail();
78
- const [upsertUserEmail] = useUpsertUserEmail();
79
- const [loading, setLoading] = stencilHooks_module.useState(true);
80
- const { data, loading: initialLoading } = index_module.En(UserLookupQuery, {});
81
- 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,}))$/;
82
- stencilHooks_module.useEffect(() => {
83
- if (!(data === null || data === void 0 ? void 0 : data.viewer))
84
- return;
85
- setEmailExists(!!data.viewer.email);
86
- }, [data]);
87
- stencilHooks_module.useEffect(() => {
88
- if (initialized)
89
- setLoading(false);
90
- }, [initialized]);
91
- const submitEmail = async (e) => {
92
- e.preventDefault();
93
- if (!(data === null || data === void 0 ? void 0 : data.viewer))
94
- return;
95
- setLoading(true);
96
- const toAddress = data.viewer.email;
97
- if (!toAddress) {
98
- // If no email on the user, set one
99
- const formData = e.detail.formData;
100
- const newEmail = formData.get("email").toString();
101
- if (!emailRegex.test(newEmail)) {
102
- setError(true);
103
- return;
104
- }
105
- const result = await upsertUserEmail(newEmail);
106
- if (!result || !result.user.email)
107
- setError(true);
108
- }
109
- // UI should not allow this call til initialisation is done
110
- if (!initialized)
111
- return;
112
- const result = await sendEmail();
113
- if (!result || !result.success)
114
- setMutationError(true);
115
- else {
116
- // This is used to let the code verification widget know an email was already sent
117
- setEmail(toAddress);
118
- setShowCode(true);
119
- }
120
- setLoading(false);
121
- };
122
- return {
123
- callbacks: {
124
- submitEmail,
125
- },
126
- states: {
127
- loading,
128
- initialLoading: initialLoading && !initialized,
129
- error,
130
- email: data === null || data === void 0 ? void 0 : data.viewer.email,
131
- sendCodeError: mutationError,
132
- },
133
- text: props.getTextProps(),
134
- };
135
- }
136
-
137
- const style = {
138
- Wrapper: {
139
- display: "flex",
140
- flexDirection: "column",
141
- gap: "var(--sl-spacing-medium)",
142
- marginTop: "var(--sl-spacing-medium)",
143
- },
144
- InputsContainer: {
145
- display: "flex",
146
- gap: "var(--sl-spacing-medium)",
147
- position: "relative",
148
- flexDirection: "column",
149
- maxWidth: "320px",
150
- },
151
- ErrorAlertContainer: {
152
- "&::part(base)": {
153
- backgroundColor: "var(--sl-color-red-100)",
154
- borderTop: "none",
155
- },
156
- "&::part(message)": {
157
- display: "flex",
158
- flexDirection: "column",
159
- },
160
- },
161
- ContinueButton: {
162
- width: "100%",
163
- maxWidth: "100px",
164
- },
165
- SkeletonOne: {
166
- width: "50%",
167
- height: "16px",
168
- },
169
- SkeletonTwo: {
170
- width: "30%",
171
- height: "34px",
172
- },
173
- SkeletonThree: {
174
- width: "15%",
175
- height: "24px",
176
- },
177
- ErrorInput: {
178
- "&::part(base)": {
179
- border: "1px solid var(--sl-color-danger-500)",
180
- borderRadius: "var(--sl-input-border-radius-medium)",
181
- },
182
- "&::part(help-text)": {
183
- color: "var(--sl-color-danger-500)",
184
- },
185
- },
186
- };
187
- const vanillaStyle = `
188
- :host {
189
- display: block;
190
- }
191
- :host([hidden]): {
192
- display: none;
193
- }
194
- `;
195
- const sheet = JSS.createStyleSheet(style);
196
- const styleString = sheet.toString();
197
- function WidgetEmailVerificationView(props) {
198
- const { states, callbacks, text } = props;
199
- const renderLoadingSkeleton = () => {
200
- return (index.h("div", { class: sheet.classes.Wrapper },
201
- index.h("sl-skeleton", { class: sheet.classes.SkeletonOne }),
202
- index.h("sl-skeleton", { class: sheet.classes.SkeletonTwo }),
203
- index.h("sl-skeleton", { class: sheet.classes.SkeletonThree })));
204
- };
205
- return (index.h("div", { part: "sqm-base" },
206
- index.h("style", { type: "text/css" },
207
- vanillaStyle,
208
- styleString),
209
- states.sendCodeError && (index.h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "danger", class: sheet.classes.ErrorAlertContainer, open: true },
210
- index.h("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
211
- index.h("b", null, text.sendCodeErrorHeader),
212
- text.sendCodeErrorDescription)),
213
- states.initialLoading ? (renderLoadingSkeleton()) : (index.h("div", { class: sheet.classes.Wrapper },
214
- index.h(sqmTextSpanView.TextSpanView, { type: "p" }, text.verifyEmailHeaderText),
215
- index.h("sl-form", { "onSl-submit": callbacks.submitEmail },
216
- index.h("div", { class: sheet.classes.InputsContainer },
217
- index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.emailLabel, value: states.email, type: "email", id: "email", name: "email", disabled: !!states.email || states.loading }, (states.error
218
- ? {
219
- class: sheet.classes.ErrorInput,
220
- helpText: text.emailValidationErrorText,
221
- }
222
- : {}))),
223
- index.h("sl-button", { submit: true, class: sheet.classes.ContinueButton, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, text.sendCodeText)))))));
224
- }
225
-
226
- const WidgetEmailVerification = class {
227
- constructor(hostRef) {
228
- index.registerInstance(this, hostRef);
229
- /**
230
- * @uiName Verify email widget header text
231
- */
232
- this.verifyEmailHeaderText = "Start by verifying your email. We’ll send you a code through our referral provider, impact.com.";
233
- /**
234
- * @uiName Send code to email alert header
235
- */
236
- this.sendCodeErrorHeader = "There was an error sending your code.";
237
- /**
238
- * @uiName Send code to email alert description
239
- */
240
- this.sendCodeErrorDescription = "Please try again. If this problem continues, contact our program support team.";
241
- /**
242
- * @uiName Email input label
243
- */
244
- this.emailLabel = "Email";
245
- /**
246
- * @uiName Send code button text
247
- */
248
- this.sendCodeText = "Send code";
249
- /**
250
- * @uiName Send code button text
251
- */
252
- this.emailValidationErrorText = "Please enter a valid email";
253
- stencilHooks_module.h$1(this);
254
- }
255
- disconnectedCallback() { }
256
- getTextProps() {
257
- return utils.getProps(this);
258
- }
259
- render() {
260
- const props = index_module.isDemo()
261
- ? useDemoWidgetEmailVerification(this)
262
- : useWidgetEmailVerification(this);
263
- return index.h(WidgetEmailVerificationView, Object.assign({}, props));
264
- }
265
- };
266
- function useDemoWidgetEmailVerification(props) {
267
- const setShowCode = index_module.Sn(keys.SHOW_CODE_NAMESPACE);
268
- return cjs.cjs({
269
- states: {
270
- error: true,
271
- initialLoading: false,
272
- loading: false,
273
- email: "test@example.com",
274
- sendCodeError: true,
275
- },
276
- callbacks: {
277
- submitEmail: async () => setShowCode(true),
278
- },
279
- text: props.getTextProps(),
280
- }, props.demoData || {}, { arrayMerge: (_, a) => a });
281
- }
282
-
283
- exports.sqm_email_verification = WidgetEmailVerification;