@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
@@ -19,8 +19,9 @@ const index$1 = require('./index-8c6255f5.js');
19
19
  const useRegistrationFormState = require('./useRegistrationFormState-f9ce55be.js');
20
20
  const utilities = require('./utilities-f7de6c04.js');
21
21
  const AsYouType = require('./AsYouType-6788393a.js');
22
- const ShadowViewAddon = require('./ShadowViewAddon-88821c64.js');
22
+ const ShadowViewAddon = require('./ShadowViewAddon-040cffad.js');
23
23
  require('./sqm-portal-container-view-990a85a3.js');
24
+ const usePayoutStatus = require('./usePayoutStatus-b9fb7399.js');
24
25
 
25
26
  const BigStat = class {
26
27
  constructor(hostRef) {
@@ -1727,6 +1728,7 @@ const style$2 = {
1727
1728
  PayoutButtonDescription: {
1728
1729
  color: "var(--sl-color-neutral-500)",
1729
1730
  fontSize: "var(--sl-font-size-small)",
1731
+ margin: "0",
1730
1732
  },
1731
1733
  };
1732
1734
  const sheet$2 = JSS.createStyleSheet(style$2);
@@ -1744,7 +1746,14 @@ function PayoutButtonScrollView(props) {
1744
1746
  const PayoutButtonScroll = class {
1745
1747
  constructor(hostRef) {
1746
1748
  index.registerInstance(this, hostRef);
1749
+ /**
1750
+ * @uiName Payout button text
1751
+ */
1747
1752
  this.payoutButtonText = "Payouts & Tax Settings";
1753
+ /**
1754
+ * Description text under payout button
1755
+ * @uiName Payout button description text
1756
+ */
1748
1757
  this.payoutButtonDescription = "Check your payout settings to see when you’ll get paid out next";
1749
1758
  this.ignored = true;
1750
1759
  stencilHooks_module.h$1(this);
@@ -1776,12 +1785,53 @@ const style$3 = {
1776
1785
  margin: "0",
1777
1786
  marginBottom: "var(--sl-spacing-small)",
1778
1787
  },
1788
+ ErrorAlertContainer: {
1789
+ "&::part(base)": {
1790
+ backgroundColor: "var(--sl-color-red-100)",
1791
+ borderTop: "none",
1792
+ },
1793
+ "& sl-icon::part(base)": {
1794
+ color: "var(--sl-color-danger-500)",
1795
+ },
1796
+ },
1797
+ WarningAlertContainer: {
1798
+ "&::part(base)": {
1799
+ backgroundColor: "var(--sl-color-yellow-100)",
1800
+ borderTop: "none",
1801
+ },
1802
+ "& sl-icon::part(base)": {
1803
+ color: "var(--sl-color-danger-500)",
1804
+ },
1805
+ },
1806
+ InfoAlertContainer: {
1807
+ "&::part(base)": {
1808
+ backgroundColor: "var(--sl-color-sky-100)",
1809
+ borderTop: "none",
1810
+ },
1811
+ "& sl-icon::part(base)": {
1812
+ color: "var(--sl-color-blue-500)",
1813
+ },
1814
+ },
1815
+ Dialog: {
1816
+ "&::part(panel)": {
1817
+ height: "600px",
1818
+ },
1819
+ "&::part(close-button)": {
1820
+ marginBottom: "var(--sl-spacing-xx-large)",
1821
+ },
1822
+ "&::part(title)": {
1823
+ display: "none",
1824
+ },
1825
+ "&::part(header)": {},
1826
+ "&::part(body)": { padding: "0" },
1827
+ "&::part(footer)": {},
1828
+ },
1779
1829
  };
1780
1830
  const sheet$3 = JSS.createStyleSheet(style$3);
1781
1831
  const styleString$3 = sheet$3.toString();
1782
1832
  function PayoutStatusAlertView(props) {
1783
- var _a, _b, _c, _d;
1784
- const { text, states } = props;
1833
+ var _a, _b, _c, _d, _e;
1834
+ const { text, states, data, callbacks } = props;
1785
1835
  if (states.loading) {
1786
1836
  return index.h("sl-skeleton", { class: sheet$3.classes.SkeletonOne });
1787
1837
  }
@@ -1789,14 +1839,24 @@ function PayoutStatusAlertView(props) {
1789
1839
  return index.h("div", null);
1790
1840
  }
1791
1841
  function getAlert(status) {
1842
+ if (states.error)
1843
+ return {
1844
+ header: text.errorHeader,
1845
+ description: text.errorDescription,
1846
+ buttonText: null,
1847
+ alertType: "critical",
1848
+ icon: "exclamation-triangle",
1849
+ class: sheet$3.classes.ErrorAlertContainer,
1850
+ };
1792
1851
  switch (status) {
1793
1852
  case "INFORMATION_REQUIRED":
1794
1853
  return {
1795
1854
  header: text.informationRequiredHeader,
1796
1855
  description: text.informationRequiredDescription,
1797
- buttonText: text.verificationRequiredButtonText,
1856
+ buttonText: text.informationRequiredButtonText,
1798
1857
  alertType: "info",
1799
- icon: "exclamation-octagon",
1858
+ icon: "info-circle",
1859
+ class: sheet$3.classes.InfoAlertContainer,
1800
1860
  };
1801
1861
  case "VERIFICATION_NEEDED":
1802
1862
  return {
@@ -1804,7 +1864,8 @@ function PayoutStatusAlertView(props) {
1804
1864
  description: text.verificationRequiredDescription,
1805
1865
  buttonText: text.verificationRequiredButtonText,
1806
1866
  alertType: "warning",
1807
- icon: "exclamation-octagon",
1867
+ icon: "exclamation-triangle",
1868
+ class: sheet$3.classes.WarningAlertContainer,
1808
1869
  };
1809
1870
  case "HOLD":
1810
1871
  return {
@@ -1812,7 +1873,8 @@ function PayoutStatusAlertView(props) {
1812
1873
  description: text.holdDescription,
1813
1874
  buttonText: null,
1814
1875
  alertType: "warning",
1815
- icon: "exclamation-octagon",
1876
+ icon: "exclamation-triangle",
1877
+ class: sheet$3.classes.WarningAlertContainer,
1816
1878
  };
1817
1879
  default:
1818
1880
  return;
@@ -1822,81 +1884,75 @@ function PayoutStatusAlertView(props) {
1822
1884
  function getButton(status) {
1823
1885
  switch (status) {
1824
1886
  case "INFORMATION_REQUIRED":
1825
- return (index.h("sqm-scroll", { "scroll-tag-name": "sqm-tabs", "button-text": "Payout and tax settings", "scroll-animation": "smooth" }));
1887
+ return data.type === "SquatchJS2" ? (index.h("sqm-scroll", { "scroll-tag-name": "sqm-tabs", "button-text": text.informationRequiredButtonText, "scroll-animation": "smooth" })) : data.type === "SquatchPortal" ? (index.h("sl-button", { type: "default", onClick: callbacks.onTermsClick }, text.informationRequiredButtonText)) : (index.h("sl-button", { type: "default" }, text.informationRequiredButtonText));
1826
1888
  case "VERIFICATION_NEEDED":
1827
- return (index.h("sl-button", { type: "default", loading: states.loading }, text.verificationRequiredButtonText));
1889
+ return (index.h("sl-button", { type: "default", loading: states.loading,
1890
+ //AL: TODO callback to open verification form
1891
+ onClick: () => callbacks.onClick }, text.verificationRequiredButtonText));
1828
1892
  default:
1829
1893
  return;
1830
1894
  }
1831
1895
  }
1832
1896
  return (index.h("div", { part: "sqm-base" },
1833
1897
  index.h("style", { type: "text/css" }, styleString$3),
1834
- index.h("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 },
1835
- index.h("sl-icon", { slot: "icon", name: (_b = getAlert(states.status)) === null || _b === void 0 ? void 0 : _b.icon }),
1836
- index.h("strong", null, (_c = getAlert(states.status)) === null || _c === void 0 ? void 0 : _c.header),
1837
- index.h("p", { class: sheet$3.classes.AlertDescriptionText }, (_d = getAlert(states.status)) === null || _d === void 0 ? void 0 : _d.description),
1838
- getButton(states.status))));
1839
- }
1840
-
1841
- const GET_USER_STATUS = index_module.dist.gql `
1842
- query getUserStatus {
1843
- user: viewer {
1844
- ... on User {
1845
- id
1846
- impactConnection {
1847
- connected
1848
- publisher {
1849
- id
1850
- payoutsAccount {
1851
- hold
1852
- }
1853
- }
1854
- }
1855
- }
1856
- }
1857
- }
1858
- `;
1859
- function usePayoutStatus(props) {
1860
- const { loading, data, errors, refetch } = index_module.En(GET_USER_STATUS, {});
1861
- const [status, setStatus] = stencilHooks_module.useState(undefined);
1862
- stencilHooks_module.useEffect(() => {
1863
- if (!data)
1864
- return;
1865
- function getStatus(data) {
1866
- var _a, _b;
1867
- const account = (_b = (_a = data.user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.payoutsAccount;
1868
- if (!account)
1869
- return "INFORMATION_REQUIRED";
1870
- if (account.hold)
1871
- return "HOLD";
1872
- // @ts-ignore, TODO: add check for account verification
1873
- if (!account.verified)
1874
- return "VERIFICATION_NEEDED";
1875
- return "DONE";
1876
- }
1877
- const s = getStatus(data);
1878
- setStatus(s);
1879
- }, [data]);
1880
- stencilHooks_module.useEffect(() => {
1881
- const cb = () => refetch();
1882
- window.addEventListener("sqm:tax-form-updated", cb);
1883
- return () => window.removeEventListener("sqm:tax-form-updated", cb);
1884
- }, []);
1885
- console.log({ data });
1886
- return { states: { loading, status }, text: props.getTextProps() };
1898
+ index.h("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 },
1899
+ index.h("sl-icon", { slot: "icon", name: (_c = getAlert(states.status)) === null || _c === void 0 ? void 0 : _c.icon }),
1900
+ index.h("strong", null, (_d = getAlert(states.status)) === null || _d === void 0 ? void 0 : _d.header),
1901
+ index.h("p", { class: sheet$3.classes.AlertDescriptionText }, (_e = getAlert(states.status)) === null || _e === void 0 ? void 0 : _e.description),
1902
+ getButton(states.status)),
1903
+ index.h("sl-dialog", { noDismiss: true, class: sheet$3.classes.Dialog, open: states.showVerifyIdentity, "onSl-hide": callbacks.onCancel },
1904
+ index.h("iframe", {
1905
+ // AL: TODO replace iframe URL with verification url when available
1906
+ 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" }))));
1887
1907
  }
1888
1908
 
1889
1909
  const PayoutStatusAlert = class {
1890
1910
  constructor(hostRef) {
1891
1911
  index.registerInstance(this, hostRef);
1912
+ /**
1913
+ * @uiName Info required alert header
1914
+ */
1892
1915
  this.informationRequiredHeader = "Payout and tax information required";
1916
+ /**
1917
+ * @uiName Info required alert description
1918
+ */
1893
1919
  this.informationRequiredDescription = "Submit your banking details and tax documents to receive your rewards.";
1920
+ /**
1921
+ * @uiName Info required alert button text
1922
+ */
1894
1923
  this.informationRequiredButtonText = "Payouts & Tax Settings";
1924
+ /**
1925
+ * @uiName Verification required alert header
1926
+ */
1895
1927
  this.verificationRequiredHeader = "Verify your identity";
1928
+ /**
1929
+ * @uiName Verification required alert description
1930
+ */
1896
1931
  this.verificationRequiredDescription = "Complete your verification to start receiving your cash rewards. It should only take a few minutes verify.";
1932
+ /**
1933
+ * @uiName Verification required alert button text
1934
+ */
1897
1935
  this.verificationRequiredButtonText = "Start Verification";
1936
+ /**
1937
+ * @uiName Payout on hold alert header
1938
+ */
1898
1939
  this.holdHeader = "Your payouts and account are on hold";
1940
+ /**
1941
+ * @uiName Payout on hold alert description
1942
+ */
1899
1943
  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}.";
1944
+ /**
1945
+ * @uiName Cash & Payouts Terms and Conditions url
1946
+ */
1947
+ this.termsUrl = "https://terms.advocate.impact.com/PayoutTermsAndConditions.html";
1948
+ /**
1949
+ * @uiName Error header
1950
+ */
1951
+ this.errorHeader = "Could not determine payout status.";
1952
+ /**
1953
+ * @uiName Error description
1954
+ */
1955
+ this.errorDescription = "There was an error with determining your payout status.";
1900
1956
  stencilHooks_module.h$1(this);
1901
1957
  }
1902
1958
  disconnectedCallback() { }
@@ -1906,17 +1962,26 @@ const PayoutStatusAlert = class {
1906
1962
  render() {
1907
1963
  const props = index_module.isDemo()
1908
1964
  ? useDemoPayoutStatusAlert(this)
1909
- : usePayoutStatus(this);
1965
+ : usePayoutStatus.usePayoutStatus(this);
1966
+ console.log({ props });
1910
1967
  return index.h(PayoutStatusAlertView, Object.assign({}, props));
1911
1968
  }
1912
1969
  };
1913
1970
  function useDemoPayoutStatusAlert(props) {
1914
1971
  return cjs.cjs({
1915
1972
  states: {
1973
+ error: false,
1916
1974
  status: "INFORMATION_REQUIRED",
1917
1975
  loading: false,
1976
+ showVerifyIdentity: false,
1918
1977
  },
1978
+ data: { type: "SquatchAdmin" },
1919
1979
  text: props.getTextProps(),
1980
+ callbacks: {
1981
+ onTermsClick: () => { },
1982
+ onClick: () => console.log("show"),
1983
+ onCancel: () => console.log("hide"),
1984
+ },
1920
1985
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1921
1986
  }
1922
1987
 
@@ -12,7 +12,7 @@ const JSS = require('./JSS-8503a151.js');
12
12
  const utils = require('./utils-6847bc06.js');
13
13
  const sqmTextSpanView = require('./sqm-text-span-view-e1cd9bd3.js');
14
14
  const keys = require('./keys-cff24974.js');
15
- const useEmailVerification = require('./useEmailVerification-30a1c7f6.js');
15
+ const useVerificationEmail = require('./useVerificationEmail-6aacdb71.js');
16
16
 
17
17
  const style = {
18
18
  Wrapper: {
@@ -96,7 +96,16 @@ function WidgetCodeVerificationView(props) {
96
96
  id: "resendCodeText",
97
97
  defaultMessage: text.resendCodeText,
98
98
  }, {
99
- resendCodeLink: (index.h("a", { href: text.resendCodeLink, target: "_blank", style: { textDecoration: "none" } }, text.resendCodeLabel)),
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,
100
109
  });
101
110
  const inputClass = states.verifyFailed
102
111
  ? sheet.classes.CodeInputError
@@ -107,11 +116,14 @@ function WidgetCodeVerificationView(props) {
107
116
  styleString),
108
117
  index.h("div", { class: sheet.classes.Wrapper },
109
118
  index.h("div", { class: sheet.classes.HeaderContainer },
110
- index.h(sqmTextSpanView.TextSpanView, { type: "p" }, states.verifyFailed
111
- ? text.reverifyCodeHeaderText
112
- : text.verifyCodeHeaderText)),
113
- states.codeResent && (index.h("sqm-form-message", { type: "success", exportparts: "successalert-icon" },
114
- index.h("b", null, text.codeResentSuccessfullyText))),
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))),
115
127
  index.h("div", { class: sheet.classes.InputsContainer },
116
128
  index.h("div", { ref: refs.codeWrapperRef, class: sheet.classes.CodeInputContainer },
117
129
  index.h("sl-input", { class: inputClass, name: "code" }),
@@ -121,45 +133,22 @@ function WidgetCodeVerificationView(props) {
121
133
  index.h("sl-input", { class: inputClass, name: "code" }),
122
134
  index.h("sl-input", { class: inputClass, name: "code" })),
123
135
  states.verifyFailed && (index.h("p", { class: sheet.classes.ErrorText }, text.invalidCodeText)),
124
- index.h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.submitCode, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, text.verifyText)),
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)),
125
137
  index.h("div", { class: sheet.classes.FooterContainer },
126
- index.h(sqmTextSpanView.TextSpanView, { type: "p" }, resendCodeText),
127
- index.h(sqmTextSpanView.TextSpanView, { type: "p" },
128
- index.h("a", { href: "/", style: { textDecoration: "none" } }, text.useDifferentEmailText))))));
138
+ index.h(sqmTextSpanView.TextSpanView, { type: "p" }, resendCodeText)))));
129
139
  }
130
140
 
131
- // TODO: Move to component-boilerplate
132
141
  const VerifyEmailWithCodeMutation = index_module.dist.gql `
133
- mutation verifyUserEmail($user: UserIdInput!, $code: String!) {
134
- verifyUserEmail(user: $user, code: $code) {
142
+ mutation submitImpactPublisherEmail2FACode(
143
+ $user: UserIdInput!
144
+ $code: String!
145
+ ) {
146
+ submitImpactPublisherEmail2FACode(user: $user, code: $code) {
135
147
  verifiedEmail
136
148
  accessKey
137
149
  }
138
150
  }
139
151
  `;
140
- function useCodeVerificationMutation() {
141
- const user = index_module.K();
142
- const [request, { loading, data, errors }] = index_module.xe(VerifyEmailWithCodeMutation);
143
- const verifyUserWithCodeMutation = async (code) => {
144
- try {
145
- const result = await request({
146
- user: {
147
- id: user.id,
148
- accountId: user.accountId,
149
- },
150
- code,
151
- });
152
- if (result instanceof Error || !result)
153
- throw new Error();
154
- return result;
155
- }
156
- catch (e) {
157
- console.error("Failed to verify user", e);
158
- return null;
159
- }
160
- };
161
- return [verifyUserWithCodeMutation, { loading, data, errors }];
162
- }
163
152
  function useWidgetCodeVerification(props) {
164
153
  const host = stencilHooks_module.l();
165
154
  const [_, setShowCode] = index_module.Mn(keys.SHOW_CODE_NAMESPACE);
@@ -168,9 +157,8 @@ function useWidgetCodeVerification(props) {
168
157
  const [emailResent, setEmailResent] = stencilHooks_module.useState(false);
169
158
  const [codeRef, setCodeRef] = stencilHooks_module.useState(null);
170
159
  const [validationError, setValidationError] = stencilHooks_module.useState(false);
171
- // TODO: Need to handle error states for these errors
172
- const [verifyUser, { loading: verifyLoading, errors: verifyErrors }] = useCodeVerificationMutation();
173
- const [request, { loading: resendLoading, data, errors: resendErrors }] = useEmailVerification.useVerificationEmailMutation();
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();
174
162
  stencilHooks_module.useEffect(() => {
175
163
  if (!codeRef)
176
164
  return;
@@ -186,7 +174,7 @@ function useWidgetCodeVerification(props) {
186
174
  }
187
175
  });
188
176
  element.addEventListener("input", (e) => {
189
- const input = e.target.value;
177
+ const input = e.data;
190
178
  if (!input)
191
179
  return;
192
180
  if (idx === codeElements.length - 1) {
@@ -196,8 +184,10 @@ function useWidgetCodeVerification(props) {
196
184
  if (input.length > 1) {
197
185
  const rest = input.slice(1);
198
186
  e.target.value = input.slice(0, 1);
199
- codeElements[idx + 1].value = rest;
200
- codeElements[idx + 1].dispatchEvent(new Event("input"));
187
+ codeElements[idx + 1].dispatchEvent(new InputEvent("input", {
188
+ inputType: "insertFromPaste",
189
+ data: rest,
190
+ }));
201
191
  }
202
192
  codeElements[idx + 1].focus();
203
193
  });
@@ -208,14 +198,16 @@ function useWidgetCodeVerification(props) {
208
198
  setValidationError(false);
209
199
  };
210
200
  const resendEmail = async () => {
211
- // TODO: Error checks, depends on what mutation is set up as
212
- const result = await request();
213
- if (emailSent) {
214
- setEmailResent(true);
215
- setTimeout(() => {
216
- setEmailResent(false);
217
- }, 500);
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;
218
208
  }
209
+ if (emailSent)
210
+ setEmailResent(true);
219
211
  setEmailSent(true);
220
212
  };
221
213
  const submitCode = async () => {
@@ -229,16 +221,13 @@ function useWidgetCodeVerification(props) {
229
221
  codeElements.forEach((element) => {
230
222
  code = `${code}${element.value}`;
231
223
  });
224
+ // UI should only allow this to be called if initialized, but checking just in case
225
+ if (!initialized)
226
+ return;
232
227
  setValidationError(false);
233
- // Only 123456 passes for a valid code rn
234
- const res = await verifyUser(code);
235
- if (res) {
236
- const event = new CustomEvent(keys.VERIFICATION_EVENT_KEY, {
237
- detail: { token: res.verifyUserEmail.accessKey },
238
- composed: true,
239
- bubbles: true,
240
- });
241
- host.dispatchEvent(event);
228
+ const res = await verifyEmail(code);
229
+ if (res === null || res === void 0 ? void 0 : res.success) {
230
+ props.onVerification(res.accessKey);
242
231
  reset();
243
232
  }
244
233
  else {
@@ -246,10 +235,15 @@ function useWidgetCodeVerification(props) {
246
235
  }
247
236
  };
248
237
  stencilHooks_module.useEffect(() => {
238
+ // Wait for mutations to be determined from user lookup
239
+ if (!initialized)
240
+ return;
249
241
  // email should already exist if user has completed email-verification
250
242
  if (!email)
251
243
  resendEmail();
252
- }, []);
244
+ else
245
+ setEmailSent(true);
246
+ }, [initialized]);
253
247
  return {
254
248
  refs: {
255
249
  codeWrapperRef: setCodeRef,
@@ -257,7 +251,9 @@ function useWidgetCodeVerification(props) {
257
251
  states: {
258
252
  email,
259
253
  emailResent,
260
- loading: verifyLoading || resendLoading,
254
+ resendError: sendErrors || verifyErrors,
255
+ initialiseLoading: !initialized,
256
+ loading: sendLoading || verifyLoading,
261
257
  verifyFailed: !!validationError,
262
258
  },
263
259
  callbacks: {
@@ -274,7 +270,7 @@ const WidgetCodeVerification = class {
274
270
  /**
275
271
  * @uiName Verify code widget header text
276
272
  */
277
- this.verifyCodeHeaderText = "Enter the code sent to email@example.com from our referral provider, impact.com.";
273
+ this.verifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
278
274
  /**
279
275
  * @uiName Reverify code widget header text
280
276
  */
@@ -289,27 +285,16 @@ const WidgetCodeVerification = class {
289
285
  * @uiName Resend code label
290
286
  */
291
287
  this.resendCodeLabel = "Resend code";
292
- /**
293
- * The link that appears in the resend code link
294
- * @uiName Resend code link
295
- */
296
- // AL: TODO connect route to resend verification code
297
- this.resendCodeLink = "/resend-code";
298
288
  /**
299
289
  * Link text displayed under verify button
300
290
  * @uiName Resend code text
301
291
  */
302
292
  this.codeResentSuccessfullyText = "Another code has been sent to {email}";
303
- /**
304
- * Link text displayed under the verify button
305
- * @uiName Use different email text
306
- */
307
- this.useDifferentEmailText = "Use a different email";
308
293
  /**
309
294
  * Error text displayed under verification input
310
295
  * @uiName Invalid code text
311
296
  */
312
- this.invalidCodeText = " Please check your code and try again. If you’re still having trouble, try resending your code.";
297
+ this.invalidCodeText = "Please check your code and try again. If you’re still having trouble, try resending your code.";
313
298
  /**
314
299
  * @uiName Verify code button text
315
300
  */
@@ -333,17 +318,22 @@ const WidgetCodeVerification = class {
333
318
  }
334
319
  };
335
320
  function useDemoWidgetCodeVerification(props) {
321
+ const [emailResent, setEmailResent] = stencilHooks_module.useState(false);
322
+ const setVerifiedContext = index_module.Sn(keys.VERIFICATION_PARENT_NAMESPACE);
336
323
  return cjs.cjs({
337
324
  states: {
338
325
  loading: false,
339
- email: "",
340
- verifyFailed: false,
326
+ email: "test@example.com",
327
+ emailResent,
328
+ resendError: true,
329
+ verifyFailed: true,
341
330
  },
342
331
  refs: {
343
332
  codeWrapperRef: () => { },
344
333
  },
345
334
  callbacks: {
346
- submitCode: async () => { },
335
+ resendEmail: async () => setEmailResent(true),
336
+ submitCode: async () => setVerifiedContext(true),
347
337
  },
348
338
  text: props.getTextProps(),
349
339
  }, props.demoData || {}, { arrayMerge: (_, a) => a });