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

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 (159) 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 +92 -78
  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 +77 -21
  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/sqm-user-info-form-view.js +1 -6
  47. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +16 -11
  48. package/dist/esm/{ShadowViewAddon-65c8679e.js → ShadowViewAddon-69b61037.js} +6 -3
  49. package/dist/esm/extractProps-ae1afbb3.js +19 -0
  50. package/dist/esm/{keys-a1496e39.js → keys-db1897ae.js} +1 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/mint-components.js +1 -1
  53. package/dist/esm/sqm-banking-info-form_16.entry.js +92 -78
  54. package/dist/esm/sqm-big-stat_39.entry.js +127 -62
  55. package/dist/esm/sqm-code-verification.entry.js +69 -79
  56. package/dist/esm/sqm-email-verification.entry.js +159 -13
  57. package/dist/esm/{sqm-invoice-table-view-08c03ba7.js → sqm-invoice-table-view-d1cfdaf4.js} +79 -0
  58. package/dist/esm/sqm-stencilbook.entry.js +56 -14
  59. package/dist/esm/sqm-widget-verification-internal.entry.js +84 -14
  60. package/dist/esm/sqm-widget-verification.entry.js +104 -21
  61. package/dist/esm/usePayoutStatus-1a635054.js +67 -0
  62. package/dist/esm/useVerificationEmail-c32696ba.js +167 -0
  63. package/dist/esm-es5/ShadowViewAddon-69b61037.js +1 -0
  64. package/dist/esm-es5/extractProps-ae1afbb3.js +1 -0
  65. package/dist/esm-es5/{keys-a1496e39.js → keys-db1897ae.js} +1 -1
  66. package/dist/esm-es5/loader.js +1 -1
  67. package/dist/esm-es5/mint-components.js +1 -1
  68. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
  69. package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
  70. package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
  71. package/dist/esm-es5/sqm-email-verification.entry.js +1 -1
  72. package/dist/esm-es5/sqm-invoice-table-view-d1cfdaf4.js +1 -0
  73. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  74. package/dist/esm-es5/sqm-widget-verification-internal.entry.js +1 -1
  75. package/dist/esm-es5/sqm-widget-verification.entry.js +1 -1
  76. package/dist/esm-es5/usePayoutStatus-1a635054.js +1 -0
  77. package/dist/esm-es5/useVerificationEmail-c32696ba.js +1 -0
  78. package/dist/mint-components/mint-components.esm.js +1 -1
  79. package/dist/mint-components/p-0e45bc0e.system.entry.js +1 -0
  80. package/dist/mint-components/p-1712a9fd.entry.js +11 -0
  81. package/dist/mint-components/p-1e616d45.system.js +1 -0
  82. package/dist/mint-components/{p-721a89c6.entry.js → p-24092973.entry.js} +2 -2
  83. package/dist/mint-components/p-26468242.js +1 -0
  84. package/dist/mint-components/p-282a7d85.entry.js +195 -0
  85. package/dist/mint-components/p-331d060e.entry.js +223 -0
  86. package/dist/mint-components/p-39840341.js +1 -0
  87. package/dist/mint-components/p-4364001c.entry.js +12 -0
  88. package/dist/mint-components/p-4bd7a472.js +1 -0
  89. package/dist/mint-components/p-517224ef.js +19 -0
  90. package/dist/mint-components/p-5f766d09.entry.js +25 -0
  91. package/dist/mint-components/p-8300d8c8.system.js +1 -0
  92. package/dist/mint-components/p-8bddb468.system.entry.js +1 -0
  93. package/dist/mint-components/p-9596e97c.system.entry.js +1 -0
  94. package/dist/mint-components/p-974070c4.system.entry.js +1 -0
  95. package/dist/mint-components/{p-b651706a.js → p-9eae245f.js} +6 -3
  96. package/dist/mint-components/p-a8645c1b.system.js +1 -0
  97. package/dist/mint-components/p-aabab609.system.entry.js +1 -0
  98. package/dist/mint-components/p-b2a99637.system.js +1 -0
  99. package/dist/mint-components/{p-66a04cca.system.entry.js → p-b62faaa5.system.entry.js} +1 -1
  100. package/dist/mint-components/p-c510fb88.entry.js +1 -0
  101. package/dist/mint-components/p-ca809fdd.system.js +1 -1
  102. package/dist/mint-components/p-d7806f31.js +48 -0
  103. package/dist/mint-components/p-e01ac27c.system.js +1 -0
  104. package/dist/mint-components/p-e45a8501.system.entry.js +1 -0
  105. package/dist/mint-components/p-e990dc21.system.js +1 -0
  106. package/dist/types/components/sqm-payout-button-scroll/PayoutButtonScroll.stories.d.ts +0 -1
  107. package/dist/types/components/sqm-payout-button-scroll/sqm-payout-button-scroll.d.ts +7 -0
  108. package/dist/types/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.d.ts +1 -0
  109. package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.d.ts +3 -3
  110. package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.d.ts +4 -10
  111. package/dist/types/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.d.ts +2 -0
  112. package/dist/types/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.d.ts +4 -1
  113. package/dist/types/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification-view.d.ts +6 -1
  114. package/dist/types/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.d.ts +10 -2
  115. package/dist/types/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.d.ts +3 -2
  116. package/dist/types/components/sqm-widget-verification/sqm-widget-verification-internal.d.ts +15 -0
  117. package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +79 -0
  118. package/dist/types/components/sqm-widget-verification/useVerificationEmail.d.ts +14 -0
  119. package/dist/types/components/tax-and-cash/TaxForm.stories.d.ts +1 -0
  120. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +1 -0
  121. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.d.ts +2 -0
  122. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +12 -0
  123. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +41 -0
  124. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +12 -0
  125. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/data.d.ts +6 -0
  126. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +2 -2
  127. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +10 -3
  128. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +19 -18
  129. package/dist/types/components.d.ts +366 -92
  130. package/docs/docs.docx +0 -0
  131. package/docs/raisins.json +1 -1
  132. package/grapesjs/grapesjs.js +1 -1
  133. package/package.json +1 -1
  134. package/dist/cjs/useEmailVerification-30a1c7f6.js +0 -75
  135. package/dist/collection/components/sqm-widget-verification/useWidgetVerification.js +0 -3
  136. package/dist/esm/useEmailVerification-7135732c.js +0 -72
  137. package/dist/esm-es5/ShadowViewAddon-65c8679e.js +0 -1
  138. package/dist/esm-es5/sqm-invoice-table-view-08c03ba7.js +0 -1
  139. package/dist/esm-es5/useEmailVerification-7135732c.js +0 -1
  140. package/dist/mint-components/p-117b4705.system.js +0 -1
  141. package/dist/mint-components/p-1bd0cda8.system.entry.js +0 -1
  142. package/dist/mint-components/p-1ee62d9f.system.entry.js +0 -1
  143. package/dist/mint-components/p-1f9a9b70.system.entry.js +0 -1
  144. package/dist/mint-components/p-23fdd44e.entry.js +0 -1
  145. package/dist/mint-components/p-36f7caec.system.entry.js +0 -1
  146. package/dist/mint-components/p-39397731.entry.js +0 -1
  147. package/dist/mint-components/p-39af4acd.entry.js +0 -240
  148. package/dist/mint-components/p-4c9b6fbe.system.js +0 -1
  149. package/dist/mint-components/p-65e2c043.system.js +0 -1
  150. package/dist/mint-components/p-663303b7.entry.js +0 -8
  151. package/dist/mint-components/p-6cae44d7.js +0 -1
  152. package/dist/mint-components/p-7f5c7bf7.system.entry.js +0 -1
  153. package/dist/mint-components/p-8a337864.js +0 -7
  154. package/dist/mint-components/p-a02afa72.system.js +0 -1
  155. package/dist/mint-components/p-a5a9aa07.entry.js +0 -189
  156. package/dist/mint-components/p-c763c0b2.js +0 -1
  157. package/dist/mint-components/p-e93e5740.entry.js +0 -1
  158. package/dist/mint-components/p-e9ca48fc.system.entry.js +0 -1
  159. package/dist/types/components/sqm-widget-verification/useWidgetVerification.d.ts +0 -1
@@ -15,8 +15,9 @@ import { p as pathToRegexp } from './index-ffa26b43.js';
15
15
  import { R as REGISTRATION_FORM_STATE_CONTEXT, u as useRegistrationFormState } from './useRegistrationFormState-849e27f7.js';
16
16
  import { i as isEmpty } from './utilities-443732be.js';
17
17
  import { A as AsYouType } from './AsYouType-46f67d0d.js';
18
- import { b as useDemoBigStat, V as useBigStat, B as BigStatView, Q as autoColorScaleCss, K as CardFeedView, j as CheckboxFieldView, M as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, W as withShadowView, L as LeaderboardView, N as NameFieldsView, d as PortalChangePasswordView, i as PortalFooterView, P as PortalFrameView, e as PortalLoginView, f as PortalRegisterView, R as ReferralIframeView, X as demoRewardExchange, k as RewardExchangeView, a as useShareButton, S as ShareButtonView, C as CopyTextView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-65c8679e.js';
18
+ import { b as useDemoBigStat, V as useBigStat, B as BigStatView, Q as autoColorScaleCss, K as CardFeedView, j as CheckboxFieldView, M as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, W as withShadowView, L as LeaderboardView, N as NameFieldsView, d as PortalChangePasswordView, i as PortalFooterView, P as PortalFrameView, e as PortalLoginView, f as PortalRegisterView, R as ReferralIframeView, X as demoRewardExchange, k as RewardExchangeView, a as useShareButton, S as ShareButtonView, C as CopyTextView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-69b61037.js';
19
19
  import './sqm-portal-container-view-6c582684.js';
20
+ import { u as usePayoutStatus } from './usePayoutStatus-1a635054.js';
20
21
 
21
22
  const BigStat = class {
22
23
  constructor(hostRef) {
@@ -1723,6 +1724,7 @@ const style$2 = {
1723
1724
  PayoutButtonDescription: {
1724
1725
  color: "var(--sl-color-neutral-500)",
1725
1726
  fontSize: "var(--sl-font-size-small)",
1727
+ margin: "0",
1726
1728
  },
1727
1729
  };
1728
1730
  const sheet$2 = createStyleSheet(style$2);
@@ -1740,7 +1742,14 @@ function PayoutButtonScrollView(props) {
1740
1742
  const PayoutButtonScroll = class {
1741
1743
  constructor(hostRef) {
1742
1744
  registerInstance(this, hostRef);
1745
+ /**
1746
+ * @uiName Payout button text
1747
+ */
1743
1748
  this.payoutButtonText = "Payouts & Tax Settings";
1749
+ /**
1750
+ * Description text under payout button
1751
+ * @uiName Payout button description text
1752
+ */
1744
1753
  this.payoutButtonDescription = "Check your payout settings to see when you’ll get paid out next";
1745
1754
  this.ignored = true;
1746
1755
  h(this);
@@ -1772,12 +1781,53 @@ const style$3 = {
1772
1781
  margin: "0",
1773
1782
  marginBottom: "var(--sl-spacing-small)",
1774
1783
  },
1784
+ ErrorAlertContainer: {
1785
+ "&::part(base)": {
1786
+ backgroundColor: "var(--sl-color-red-100)",
1787
+ borderTop: "none",
1788
+ },
1789
+ "& sl-icon::part(base)": {
1790
+ color: "var(--sl-color-danger-500)",
1791
+ },
1792
+ },
1793
+ WarningAlertContainer: {
1794
+ "&::part(base)": {
1795
+ backgroundColor: "var(--sl-color-yellow-100)",
1796
+ borderTop: "none",
1797
+ },
1798
+ "& sl-icon::part(base)": {
1799
+ color: "var(--sl-color-danger-500)",
1800
+ },
1801
+ },
1802
+ InfoAlertContainer: {
1803
+ "&::part(base)": {
1804
+ backgroundColor: "var(--sl-color-sky-100)",
1805
+ borderTop: "none",
1806
+ },
1807
+ "& sl-icon::part(base)": {
1808
+ color: "var(--sl-color-blue-500)",
1809
+ },
1810
+ },
1811
+ Dialog: {
1812
+ "&::part(panel)": {
1813
+ height: "600px",
1814
+ },
1815
+ "&::part(close-button)": {
1816
+ marginBottom: "var(--sl-spacing-xx-large)",
1817
+ },
1818
+ "&::part(title)": {
1819
+ display: "none",
1820
+ },
1821
+ "&::part(header)": {},
1822
+ "&::part(body)": { padding: "0" },
1823
+ "&::part(footer)": {},
1824
+ },
1775
1825
  };
1776
1826
  const sheet$3 = createStyleSheet(style$3);
1777
1827
  const styleString$3 = sheet$3.toString();
1778
1828
  function PayoutStatusAlertView(props) {
1779
- var _a, _b, _c, _d;
1780
- const { text, states } = props;
1829
+ var _a, _b, _c, _d, _e;
1830
+ const { text, states, data, callbacks } = props;
1781
1831
  if (states.loading) {
1782
1832
  return h$1("sl-skeleton", { class: sheet$3.classes.SkeletonOne });
1783
1833
  }
@@ -1785,14 +1835,24 @@ function PayoutStatusAlertView(props) {
1785
1835
  return h$1("div", null);
1786
1836
  }
1787
1837
  function getAlert(status) {
1838
+ if (states.error)
1839
+ return {
1840
+ header: text.errorHeader,
1841
+ description: text.errorDescription,
1842
+ buttonText: null,
1843
+ alertType: "critical",
1844
+ icon: "exclamation-triangle",
1845
+ class: sheet$3.classes.ErrorAlertContainer,
1846
+ };
1788
1847
  switch (status) {
1789
1848
  case "INFORMATION_REQUIRED":
1790
1849
  return {
1791
1850
  header: text.informationRequiredHeader,
1792
1851
  description: text.informationRequiredDescription,
1793
- buttonText: text.verificationRequiredButtonText,
1852
+ buttonText: text.informationRequiredButtonText,
1794
1853
  alertType: "info",
1795
- icon: "exclamation-octagon",
1854
+ icon: "info-circle",
1855
+ class: sheet$3.classes.InfoAlertContainer,
1796
1856
  };
1797
1857
  case "VERIFICATION_NEEDED":
1798
1858
  return {
@@ -1800,7 +1860,8 @@ function PayoutStatusAlertView(props) {
1800
1860
  description: text.verificationRequiredDescription,
1801
1861
  buttonText: text.verificationRequiredButtonText,
1802
1862
  alertType: "warning",
1803
- icon: "exclamation-octagon",
1863
+ icon: "exclamation-triangle",
1864
+ class: sheet$3.classes.WarningAlertContainer,
1804
1865
  };
1805
1866
  case "HOLD":
1806
1867
  return {
@@ -1808,7 +1869,8 @@ function PayoutStatusAlertView(props) {
1808
1869
  description: text.holdDescription,
1809
1870
  buttonText: null,
1810
1871
  alertType: "warning",
1811
- icon: "exclamation-octagon",
1872
+ icon: "exclamation-triangle",
1873
+ class: sheet$3.classes.WarningAlertContainer,
1812
1874
  };
1813
1875
  default:
1814
1876
  return;
@@ -1818,81 +1880,75 @@ function PayoutStatusAlertView(props) {
1818
1880
  function getButton(status) {
1819
1881
  switch (status) {
1820
1882
  case "INFORMATION_REQUIRED":
1821
- return (h$1("sqm-scroll", { "scroll-tag-name": "sqm-tabs", "button-text": "Payout and tax settings", "scroll-animation": "smooth" }));
1883
+ return data.type === "SquatchJS2" ? (h$1("sqm-scroll", { "scroll-tag-name": "sqm-tabs", "button-text": text.informationRequiredButtonText, "scroll-animation": "smooth" })) : data.type === "SquatchPortal" ? (h$1("sl-button", { type: "default", onClick: callbacks.onTermsClick }, text.informationRequiredButtonText)) : (h$1("sl-button", { type: "default" }, text.informationRequiredButtonText));
1822
1884
  case "VERIFICATION_NEEDED":
1823
- return (h$1("sl-button", { type: "default", loading: states.loading }, text.verificationRequiredButtonText));
1885
+ return (h$1("sl-button", { type: "default", loading: states.loading,
1886
+ //AL: TODO callback to open verification form
1887
+ onClick: () => callbacks.onClick }, text.verificationRequiredButtonText));
1824
1888
  default:
1825
1889
  return;
1826
1890
  }
1827
1891
  }
1828
1892
  return (h$1("div", { part: "sqm-base" },
1829
1893
  h$1("style", { type: "text/css" }, styleString$3),
1830
- h$1("sqm-form-message", { style: { display: "flex", gap: "2px" }, exportparts: "base: alert-base, icon:alert-icon", type: (_a = getAlert(states.status)) === null || _a === void 0 ? void 0 : _a.alertType },
1831
- h$1("sl-icon", { slot: "icon", name: (_b = getAlert(states.status)) === null || _b === void 0 ? void 0 : _b.icon }),
1832
- h$1("strong", null, (_c = getAlert(states.status)) === null || _c === void 0 ? void 0 : _c.header),
1833
- h$1("p", { class: sheet$3.classes.AlertDescriptionText }, (_d = getAlert(states.status)) === null || _d === void 0 ? void 0 : _d.description),
1834
- getButton(states.status))));
1835
- }
1836
-
1837
- const GET_USER_STATUS = dist.gql `
1838
- query getUserStatus {
1839
- user: viewer {
1840
- ... on User {
1841
- id
1842
- impactConnection {
1843
- connected
1844
- publisher {
1845
- id
1846
- payoutsAccount {
1847
- hold
1848
- }
1849
- }
1850
- }
1851
- }
1852
- }
1853
- }
1854
- `;
1855
- function usePayoutStatus(props) {
1856
- const { loading, data, errors, refetch } = En(GET_USER_STATUS, {});
1857
- const [status, setStatus] = useState(undefined);
1858
- useEffect(() => {
1859
- if (!data)
1860
- return;
1861
- function getStatus(data) {
1862
- var _a, _b;
1863
- const account = (_b = (_a = data.user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.payoutsAccount;
1864
- if (!account)
1865
- return "INFORMATION_REQUIRED";
1866
- if (account.hold)
1867
- return "HOLD";
1868
- // @ts-ignore, TODO: add check for account verification
1869
- if (!account.verified)
1870
- return "VERIFICATION_NEEDED";
1871
- return "DONE";
1872
- }
1873
- const s = getStatus(data);
1874
- setStatus(s);
1875
- }, [data]);
1876
- useEffect(() => {
1877
- const cb = () => refetch();
1878
- window.addEventListener("sqm:tax-form-updated", cb);
1879
- return () => window.removeEventListener("sqm:tax-form-updated", cb);
1880
- }, []);
1881
- console.log({ data });
1882
- return { states: { loading, status }, text: props.getTextProps() };
1894
+ h$1("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: (_a = getAlert(states.status)) === null || _a === void 0 ? void 0 : _a.alertType, class: (_b = getAlert(states.status)) === null || _b === void 0 ? void 0 : _b.class, open: true },
1895
+ h$1("sl-icon", { slot: "icon", name: (_c = getAlert(states.status)) === null || _c === void 0 ? void 0 : _c.icon }),
1896
+ h$1("strong", null, (_d = getAlert(states.status)) === null || _d === void 0 ? void 0 : _d.header),
1897
+ h$1("p", { class: sheet$3.classes.AlertDescriptionText }, (_e = getAlert(states.status)) === null || _e === void 0 ? void 0 : _e.description),
1898
+ getButton(states.status)),
1899
+ h$1("sl-dialog", { noDismiss: true, class: sheet$3.classes.Dialog, open: states.showVerifyIdentity, "onSl-hide": callbacks.onCancel },
1900
+ h$1("iframe", {
1901
+ // AL: TODO replace iframe URL with verification url when available
1902
+ scrolling: "yes", frameBorder: "0", width: "100%", height: "100%", src: "https://impacttech.complytaxforms.com/ServiceRedirect.aspx?Language=eng&Param1=UxBORV4bOIrqNb4gbpNmtvW3wjdZJyx4gPElIGMJNR8=&UUID=B576EA3E-80FD-4D85-AA59-653D23A7CCE8" }))));
1883
1903
  }
1884
1904
 
1885
1905
  const PayoutStatusAlert = class {
1886
1906
  constructor(hostRef) {
1887
1907
  registerInstance(this, hostRef);
1908
+ /**
1909
+ * @uiName Info required alert header
1910
+ */
1888
1911
  this.informationRequiredHeader = "Payout and tax information required";
1912
+ /**
1913
+ * @uiName Info required alert description
1914
+ */
1889
1915
  this.informationRequiredDescription = "Submit your banking details and tax documents to receive your rewards.";
1916
+ /**
1917
+ * @uiName Info required alert button text
1918
+ */
1890
1919
  this.informationRequiredButtonText = "Payouts & Tax Settings";
1920
+ /**
1921
+ * @uiName Verification required alert header
1922
+ */
1891
1923
  this.verificationRequiredHeader = "Verify your identity";
1924
+ /**
1925
+ * @uiName Verification required alert description
1926
+ */
1892
1927
  this.verificationRequiredDescription = "Complete your verification to start receiving your cash rewards. It should only take a few minutes verify.";
1928
+ /**
1929
+ * @uiName Verification required alert button text
1930
+ */
1893
1931
  this.verificationRequiredButtonText = "Start Verification";
1932
+ /**
1933
+ * @uiName Payout on hold alert header
1934
+ */
1894
1935
  this.holdHeader = "Your payouts and account are on hold";
1936
+ /**
1937
+ * @uiName Payout on hold alert description
1938
+ */
1895
1939
  this.holdDescription = "Please check your inbox for an email from our referral provider, impact.com. It contains details on how to resolve this issue. If you need further assistance, feel free to reach out to {support email}.";
1940
+ /**
1941
+ * @uiName Cash & Payouts Terms and Conditions url
1942
+ */
1943
+ this.termsUrl = "https://terms.advocate.impact.com/PayoutTermsAndConditions.html";
1944
+ /**
1945
+ * @uiName Error header
1946
+ */
1947
+ this.errorHeader = "Could not determine payout status.";
1948
+ /**
1949
+ * @uiName Error description
1950
+ */
1951
+ this.errorDescription = "There was an error with determining your payout status.";
1896
1952
  h(this);
1897
1953
  }
1898
1954
  disconnectedCallback() { }
@@ -1903,16 +1959,25 @@ const PayoutStatusAlert = class {
1903
1959
  const props = isDemo()
1904
1960
  ? useDemoPayoutStatusAlert(this)
1905
1961
  : usePayoutStatus(this);
1962
+ console.log({ props });
1906
1963
  return h$1(PayoutStatusAlertView, Object.assign({}, props));
1907
1964
  }
1908
1965
  };
1909
1966
  function useDemoPayoutStatusAlert(props) {
1910
1967
  return cjs({
1911
1968
  states: {
1969
+ error: false,
1912
1970
  status: "INFORMATION_REQUIRED",
1913
1971
  loading: false,
1972
+ showVerifyIdentity: false,
1914
1973
  },
1974
+ data: { type: "SquatchAdmin" },
1915
1975
  text: props.getTextProps(),
1976
+ callbacks: {
1977
+ onTermsClick: () => { },
1978
+ onClick: () => console.log("show"),
1979
+ onCancel: () => console.log("hide"),
1980
+ },
1916
1981
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1917
1982
  }
1918
1983
 
@@ -1,14 +1,14 @@
1
1
  import { h, r as registerInstance } from './index-17b4da69.js';
2
2
  import { l, k as useState, f as useEffect, n as h$1 } from './stencil-hooks.module-ac12ca1c.js';
3
3
  import { i as intl } from './global-6306a9b8.js';
4
- import { d as dist, M as Mn, D as Dn, K, c as xe, i as isDemo } from './index.module-6c840c4e.js';
4
+ import { d as dist, M as Mn, D as Dn, i as isDemo, S as Sn } from './index.module-6c840c4e.js';
5
5
  import { c as cjs } from './cjs-bdfb4486.js';
6
6
  import { E as ErrorStyles } from './mixins-f60a614c.js';
7
7
  import { c as createStyleSheet } from './JSS-67b5cff8.js';
8
8
  import { g as getProps } from './utils-334c1e34.js';
9
9
  import { T as TextSpanView } from './sqm-text-span-view-8d140661.js';
10
- import { b as VERIFICATION_EMAIL_NAMESPACE, V as VERIFICATION_EVENT_KEY, S as SHOW_CODE_NAMESPACE } from './keys-a1496e39.js';
11
- import { a as useVerificationEmailMutation } from './useEmailVerification-7135732c.js';
10
+ import { a as VERIFICATION_EMAIL_NAMESPACE, S as SHOW_CODE_NAMESPACE, V as VERIFICATION_PARENT_NAMESPACE } from './keys-db1897ae.js';
11
+ import { u as useVerificationEmail } from './useVerificationEmail-c32696ba.js';
12
12
 
13
13
  const style = {
14
14
  Wrapper: {
@@ -92,7 +92,16 @@ function WidgetCodeVerificationView(props) {
92
92
  id: "resendCodeText",
93
93
  defaultMessage: text.resendCodeText,
94
94
  }, {
95
- resendCodeLink: (h("a", { href: text.resendCodeLink, target: "_blank", style: { textDecoration: "none" } }, text.resendCodeLabel)),
95
+ resendCodeLink: (h("a", { href: "", style: { textDecoration: "none" }, onClick: (e) => {
96
+ e.preventDefault();
97
+ callbacks.resendEmail();
98
+ } }, text.resendCodeLabel)),
99
+ });
100
+ const codeResentSuccessfully = intl.formatMessage({
101
+ id: "codeResentSuccessfully",
102
+ defaultMessage: text.codeResentSuccessfullyText,
103
+ }, {
104
+ email: states.email,
96
105
  });
97
106
  const inputClass = states.verifyFailed
98
107
  ? sheet.classes.CodeInputError
@@ -103,11 +112,14 @@ function WidgetCodeVerificationView(props) {
103
112
  styleString),
104
113
  h("div", { class: sheet.classes.Wrapper },
105
114
  h("div", { class: sheet.classes.HeaderContainer },
106
- h(TextSpanView, { type: "p" }, states.verifyFailed
107
- ? text.reverifyCodeHeaderText
108
- : text.verifyCodeHeaderText)),
109
- states.codeResent && (h("sqm-form-message", { type: "success", exportparts: "successalert-icon" },
110
- h("b", null, text.codeResentSuccessfullyText))),
115
+ h(TextSpanView, { type: "p" }, intl.formatMessage({
116
+ id: `emailHeaderText`,
117
+ defaultMessage: states.verifyFailed
118
+ ? text.reverifyCodeHeaderText
119
+ : text.verifyCodeHeaderText,
120
+ }, { email: states.email }))),
121
+ states.emailResent && (h("sqm-form-message", { type: "success", exportparts: "successalert-icon" },
122
+ h("b", null, codeResentSuccessfully))),
111
123
  h("div", { class: sheet.classes.InputsContainer },
112
124
  h("div", { ref: refs.codeWrapperRef, class: sheet.classes.CodeInputContainer },
113
125
  h("sl-input", { class: inputClass, name: "code" }),
@@ -117,45 +129,22 @@ function WidgetCodeVerificationView(props) {
117
129
  h("sl-input", { class: inputClass, name: "code" }),
118
130
  h("sl-input", { class: inputClass, name: "code" })),
119
131
  states.verifyFailed && (h("p", { class: sheet.classes.ErrorText }, text.invalidCodeText)),
120
- h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.submitCode, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, text.verifyText)),
132
+ 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)),
121
133
  h("div", { class: sheet.classes.FooterContainer },
122
- h(TextSpanView, { type: "p" }, resendCodeText),
123
- h(TextSpanView, { type: "p" },
124
- h("a", { href: "/", style: { textDecoration: "none" } }, text.useDifferentEmailText))))));
134
+ h(TextSpanView, { type: "p" }, resendCodeText)))));
125
135
  }
126
136
 
127
- // TODO: Move to component-boilerplate
128
137
  const VerifyEmailWithCodeMutation = dist.gql `
129
- mutation verifyUserEmail($user: UserIdInput!, $code: String!) {
130
- verifyUserEmail(user: $user, code: $code) {
138
+ mutation submitImpactPublisherEmail2FACode(
139
+ $user: UserIdInput!
140
+ $code: String!
141
+ ) {
142
+ submitImpactPublisherEmail2FACode(user: $user, code: $code) {
131
143
  verifiedEmail
132
144
  accessKey
133
145
  }
134
146
  }
135
147
  `;
136
- function useCodeVerificationMutation() {
137
- const user = K();
138
- const [request, { loading, data, errors }] = xe(VerifyEmailWithCodeMutation);
139
- const verifyUserWithCodeMutation = async (code) => {
140
- try {
141
- const result = await request({
142
- user: {
143
- id: user.id,
144
- accountId: user.accountId,
145
- },
146
- code,
147
- });
148
- if (result instanceof Error || !result)
149
- throw new Error();
150
- return result;
151
- }
152
- catch (e) {
153
- console.error("Failed to verify user", e);
154
- return null;
155
- }
156
- };
157
- return [verifyUserWithCodeMutation, { loading, data, errors }];
158
- }
159
148
  function useWidgetCodeVerification(props) {
160
149
  const host = l();
161
150
  const [_, setShowCode] = Mn(SHOW_CODE_NAMESPACE);
@@ -164,9 +153,8 @@ function useWidgetCodeVerification(props) {
164
153
  const [emailResent, setEmailResent] = useState(false);
165
154
  const [codeRef, setCodeRef] = useState(null);
166
155
  const [validationError, setValidationError] = useState(false);
167
- // TODO: Need to handle error states for these errors
168
- const [verifyUser, { loading: verifyLoading, errors: verifyErrors }] = useCodeVerificationMutation();
169
- const [request, { loading: resendLoading, data, errors: resendErrors }] = useVerificationEmailMutation();
156
+ const [emailError, setEmailError] = useState(false);
157
+ const { initialized, send: [sendEmail, { loading: sendLoading, errors: sendErrors }], verify: [verifyEmail, { loading: verifyLoading, errors: verifyErrors }], } = useVerificationEmail();
170
158
  useEffect(() => {
171
159
  if (!codeRef)
172
160
  return;
@@ -182,7 +170,7 @@ function useWidgetCodeVerification(props) {
182
170
  }
183
171
  });
184
172
  element.addEventListener("input", (e) => {
185
- const input = e.target.value;
173
+ const input = e.data;
186
174
  if (!input)
187
175
  return;
188
176
  if (idx === codeElements.length - 1) {
@@ -192,8 +180,10 @@ function useWidgetCodeVerification(props) {
192
180
  if (input.length > 1) {
193
181
  const rest = input.slice(1);
194
182
  e.target.value = input.slice(0, 1);
195
- codeElements[idx + 1].value = rest;
196
- codeElements[idx + 1].dispatchEvent(new Event("input"));
183
+ codeElements[idx + 1].dispatchEvent(new InputEvent("input", {
184
+ inputType: "insertFromPaste",
185
+ data: rest,
186
+ }));
197
187
  }
198
188
  codeElements[idx + 1].focus();
199
189
  });
@@ -204,14 +194,16 @@ function useWidgetCodeVerification(props) {
204
194
  setValidationError(false);
205
195
  };
206
196
  const resendEmail = async () => {
207
- // TODO: Error checks, depends on what mutation is set up as
208
- const result = await request();
209
- if (emailSent) {
210
- setEmailResent(true);
211
- setTimeout(() => {
212
- setEmailResent(false);
213
- }, 500);
197
+ // UI should only allow this to be called if initialized, but checking just in case
198
+ if (!initialized)
199
+ return;
200
+ const result = await sendEmail();
201
+ if (!result) {
202
+ setEmailError(true);
203
+ return;
214
204
  }
205
+ if (emailSent)
206
+ setEmailResent(true);
215
207
  setEmailSent(true);
216
208
  };
217
209
  const submitCode = async () => {
@@ -225,16 +217,13 @@ function useWidgetCodeVerification(props) {
225
217
  codeElements.forEach((element) => {
226
218
  code = `${code}${element.value}`;
227
219
  });
220
+ // UI should only allow this to be called if initialized, but checking just in case
221
+ if (!initialized)
222
+ return;
228
223
  setValidationError(false);
229
- // Only 123456 passes for a valid code rn
230
- const res = await verifyUser(code);
231
- if (res) {
232
- const event = new CustomEvent(VERIFICATION_EVENT_KEY, {
233
- detail: { token: res.verifyUserEmail.accessKey },
234
- composed: true,
235
- bubbles: true,
236
- });
237
- host.dispatchEvent(event);
224
+ const res = await verifyEmail(code);
225
+ if (res === null || res === void 0 ? void 0 : res.success) {
226
+ props.onVerification(res.accessKey);
238
227
  reset();
239
228
  }
240
229
  else {
@@ -242,10 +231,15 @@ function useWidgetCodeVerification(props) {
242
231
  }
243
232
  };
244
233
  useEffect(() => {
234
+ // Wait for mutations to be determined from user lookup
235
+ if (!initialized)
236
+ return;
245
237
  // email should already exist if user has completed email-verification
246
238
  if (!email)
247
239
  resendEmail();
248
- }, []);
240
+ else
241
+ setEmailSent(true);
242
+ }, [initialized]);
249
243
  return {
250
244
  refs: {
251
245
  codeWrapperRef: setCodeRef,
@@ -253,7 +247,9 @@ function useWidgetCodeVerification(props) {
253
247
  states: {
254
248
  email,
255
249
  emailResent,
256
- loading: verifyLoading || resendLoading,
250
+ resendError: sendErrors || verifyErrors,
251
+ initialiseLoading: !initialized,
252
+ loading: sendLoading || verifyLoading,
257
253
  verifyFailed: !!validationError,
258
254
  },
259
255
  callbacks: {
@@ -270,7 +266,7 @@ const WidgetCodeVerification = class {
270
266
  /**
271
267
  * @uiName Verify code widget header text
272
268
  */
273
- this.verifyCodeHeaderText = "Enter the code sent to email@example.com from our referral provider, impact.com.";
269
+ this.verifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
274
270
  /**
275
271
  * @uiName Reverify code widget header text
276
272
  */
@@ -285,27 +281,16 @@ const WidgetCodeVerification = class {
285
281
  * @uiName Resend code label
286
282
  */
287
283
  this.resendCodeLabel = "Resend code";
288
- /**
289
- * The link that appears in the resend code link
290
- * @uiName Resend code link
291
- */
292
- // AL: TODO connect route to resend verification code
293
- this.resendCodeLink = "/resend-code";
294
284
  /**
295
285
  * Link text displayed under verify button
296
286
  * @uiName Resend code text
297
287
  */
298
288
  this.codeResentSuccessfullyText = "Another code has been sent to {email}";
299
- /**
300
- * Link text displayed under the verify button
301
- * @uiName Use different email text
302
- */
303
- this.useDifferentEmailText = "Use a different email";
304
289
  /**
305
290
  * Error text displayed under verification input
306
291
  * @uiName Invalid code text
307
292
  */
308
- this.invalidCodeText = " Please check your code and try again. If you’re still having trouble, try resending your code.";
293
+ this.invalidCodeText = "Please check your code and try again. If you’re still having trouble, try resending your code.";
309
294
  /**
310
295
  * @uiName Verify code button text
311
296
  */
@@ -329,17 +314,22 @@ const WidgetCodeVerification = class {
329
314
  }
330
315
  };
331
316
  function useDemoWidgetCodeVerification(props) {
317
+ const [emailResent, setEmailResent] = useState(false);
318
+ const setVerifiedContext = Sn(VERIFICATION_PARENT_NAMESPACE);
332
319
  return cjs({
333
320
  states: {
334
321
  loading: false,
335
- email: "",
336
- verifyFailed: false,
322
+ email: "test@example.com",
323
+ emailResent,
324
+ resendError: true,
325
+ verifyFailed: true,
337
326
  },
338
327
  refs: {
339
328
  codeWrapperRef: () => { },
340
329
  },
341
330
  callbacks: {
342
- submitCode: async () => { },
331
+ resendEmail: async () => setEmailResent(true),
332
+ submitCode: async () => setVerifiedContext(true),
343
333
  },
344
334
  text: props.getTextProps(),
345
335
  }, props.demoData || {}, { arrayMerge: (_, a) => a });