@saasquatch/mint-components 1.11.0-0 → 1.11.0-2

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 (36) hide show
  1. package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +74 -79
  2. package/dist/cjs/{sqm-invoice-table-view-1ea0d1fe.js → sqm-invoice-table-view-7739a5b4.js} +6 -8
  3. package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
  4. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +2 -1
  5. package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js +4 -1
  6. package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form-view.js +1 -5
  7. package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form.js +2 -2
  8. package/dist/collection/components/tax-and-cash/sqm-docusign-form/useDocusignForm.js +36 -43
  9. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +2 -2
  10. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/data.js +14 -13
  11. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +5 -3
  12. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +12 -12
  13. package/dist/collection/components/tax-and-cash/utils.js +4 -7
  14. package/dist/esm/sqm-banking-info-form_16.entry.js +74 -79
  15. package/dist/esm/{sqm-invoice-table-view-6945ea24.js → sqm-invoice-table-view-fb2f95b9.js} +6 -8
  16. package/dist/esm/sqm-stencilbook.entry.js +1 -1
  17. package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
  18. package/dist/esm-es5/sqm-invoice-table-view-fb2f95b9.js +1 -0
  19. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  20. package/dist/mint-components/mint-components.esm.js +1 -1
  21. package/dist/mint-components/p-28b6106f.js +1 -0
  22. package/dist/mint-components/p-51721f6b.system.js +1 -0
  23. package/dist/mint-components/{p-03deaf76.entry.js → p-70232f5f.entry.js} +1 -1
  24. package/dist/mint-components/p-97198e2c.system.js +1 -1
  25. package/dist/mint-components/{p-c6c63bc0.entry.js → p-b19524e2.entry.js} +25 -19
  26. package/dist/mint-components/p-ce523fb3.system.entry.js +1 -0
  27. package/dist/mint-components/{p-e566b746.system.entry.js → p-e17d1ed7.system.entry.js} +1 -1
  28. package/dist/types/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.d.ts +1 -1
  29. package/dist/types/components/tax-and-cash/sqm-docusign-form/useDocusignForm.d.ts +2 -2
  30. package/dist/types/components/tax-and-cash/utils.d.ts +2 -2
  31. package/docs/docs.docx +0 -0
  32. package/package.json +1 -1
  33. package/dist/esm-es5/sqm-invoice-table-view-6945ea24.js +0 -1
  34. package/dist/mint-components/p-869c4ee1.system.entry.js +0 -1
  35. package/dist/mint-components/p-956cd716.system.js +0 -1
  36. package/dist/mint-components/p-bfdd2042.js +0 -1
@@ -1,4 +1,4 @@
1
- import { useLocale, useParentQueryValue, useSetParent } from "@saasquatch/component-boilerplate";
1
+ import { useLocale, useParentQueryValue, useSetParent, } from "@saasquatch/component-boilerplate";
2
2
  import { useEffect, useState } from "@saasquatch/universal-hooks";
3
3
  import { DateTime } from "luxon";
4
4
  import { vatLabels } from "../countries";
@@ -40,7 +40,7 @@ function getIndirectTaxType(taxInformation) {
40
40
  return "Indirect Tax";
41
41
  }
42
42
  export const useTaxAndCashDashboard = (props) => {
43
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
43
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
44
44
  const setStep = useSetParent(TAX_CONTEXT_NAMESPACE);
45
45
  const setContext = useSetParent(TAX_FORM_CONTEXT_NAMESPACE);
46
46
  const [showDialog, setShowDialog] = useState(false);
@@ -51,8 +51,8 @@ export const useTaxAndCashDashboard = (props) => {
51
51
  }, []);
52
52
  const { data, loading, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
53
53
  const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
54
- const documentType = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.type;
55
- const submissionDate = (_d = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _d === void 0 ? void 0 : _d.dateCreated;
54
+ const documentType = publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType;
55
+ const submissionDate = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.dateCreated;
56
56
  const dateSubmitted = submissionDate
57
57
  ? DateTime.fromMillis(submissionDate).toFormat("LLL dd, yyyy")
58
58
  : undefined;
@@ -73,23 +73,23 @@ export const useTaxAndCashDashboard = (props) => {
73
73
  });
74
74
  setStep("/3");
75
75
  };
76
- const provinceName = (_e = INDIRECT_TAX_PROVINCES.find((p) => { var _a; return p.regionCode === ((_a = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _a === void 0 ? void 0 : _a.indirectTaxRegion); })) === null || _e === void 0 ? void 0 : _e.displayName;
76
+ const provinceName = (_d = INDIRECT_TAX_PROVINCES.find((p) => { var _a; return p.regionCode === ((_a = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _a === void 0 ? void 0 : _a.indirectTaxRegion); })) === null || _d === void 0 ? void 0 : _d.displayName;
77
77
  return {
78
78
  states: {
79
79
  dateSubmitted,
80
80
  documentType,
81
81
  canEditPayoutInfo: publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup,
82
82
  documentTypeString: taxTypeToName(documentType),
83
- status: (_f = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _f === void 0 ? void 0 : _f.status,
84
- subRegion: getSubRegionName((_g = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _g === void 0 ? void 0 : _g.indirectTaxRegion),
85
- subRegionTaxNumber: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _h === void 0 ? void 0 : _h.withholdingTaxId,
86
- qstNumber: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _j === void 0 ? void 0 : _j.additionalTaxId,
83
+ status: (_e = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _e === void 0 ? void 0 : _e.status,
84
+ subRegion: getSubRegionName((_f = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _f === void 0 ? void 0 : _f.indirectTaxRegion),
85
+ subRegionTaxNumber: (_g = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _g === void 0 ? void 0 : _g.withholdingTaxId,
86
+ qstNumber: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _h === void 0 ? void 0 : _h.additionalTaxId,
87
87
  indirectTaxType: getIndirectTaxType(publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation),
88
- indirectTaxNumber: (_k = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _k === void 0 ? void 0 : _k.indirectTaxId,
88
+ indirectTaxNumber: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _j === void 0 ? void 0 : _j.indirectTaxId,
89
89
  isBusinessEntity: (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) === "W8BENE",
90
90
  province: provinceName,
91
- country: getCountryName((_l = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _l === void 0 ? void 0 : _l.indirectTaxCountryCode, locale),
92
- notRegistered: !((_m = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _m === void 0 ? void 0 : _m.indirectTaxId),
91
+ country: getCountryName((_k = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _k === void 0 ? void 0 : _k.indirectTaxCountryCode, locale),
92
+ notRegistered: !((_l = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _l === void 0 ? void 0 : _l.indirectTaxId),
93
93
  noFormNeeded: !documentType,
94
94
  disabled: loading,
95
95
  loading,
@@ -1,9 +1,7 @@
1
1
  import { intl } from "../../global/global";
2
- export function validTaxDocument(requiredType, currentType) {
3
- if (requiredType === "W9" && currentType === "W9")
4
- return true;
5
- if ((requiredType === "W8BEN" || requiredType === "W8BENE") &&
6
- (currentType === "W8BEN" || currentType === "W8BENE"))
2
+ export function validTaxDocument(requiredType) {
3
+ const validTypes = ["W9", "W8BENE", "W8BEN"];
4
+ if (validTypes.includes(requiredType))
7
5
  return true;
8
6
  return false;
9
7
  }
@@ -15,9 +13,8 @@ export const taxTypeToName = (taxType) => {
15
13
  case "W9":
16
14
  return "W-9";
17
15
  case "W8BEN":
18
- return "W-8 BEN";
19
16
  case "W8BENE":
20
- return "W-8 BEN-E";
17
+ return "W-8";
21
18
  default:
22
19
  return "";
23
20
  }
@@ -12,7 +12,7 @@ import { u as useChildElements } from './useChildElements-32e1bda1.js';
12
12
  import { l as luxon } from './luxon-7600be8d.js';
13
13
  import { g as generateUserError } from './useReferralTable-f4de0650.js';
14
14
  import { g as getProps, l as luxonLocale } from './utils-334c1e34.js';
15
- import { t as taxTypeToName, v as validTaxDocument, a as INDIRECT_TAX_SPAIN_REGIONS, b as INDIRECT_TAX_PROVINCES, g as getCountryObj, O as OtherRegionSlotView, I as InvoiceTableView, E as ErrorView, L as LoadingView, c as vatLabels, G as GeneralLoadingView, f as formatErrorMessage, d as validateBillingField, o as objectIsFull, A as ADDRESS_REGIONS } from './sqm-invoice-table-view-6945ea24.js';
15
+ import { t as taxTypeToName, v as validTaxDocument, a as INDIRECT_TAX_SPAIN_REGIONS, b as INDIRECT_TAX_PROVINCES, g as getCountryObj, O as OtherRegionSlotView, I as InvoiceTableView, E as ErrorView, L as LoadingView, c as vatLabels, G as GeneralLoadingView, f as formatErrorMessage, d as validateBillingField, o as objectIsFull, A as ADDRESS_REGIONS } from './sqm-invoice-table-view-fb2f95b9.js';
16
16
 
17
17
  const TAX_CONTEXT_NAMESPACE = "sq:tax-and-cash";
18
18
  const TAX_FORM_CONTEXT_NAMESPACE = "sq:tax-form-context";
@@ -65,19 +65,20 @@ const GET_USER = dist.gql `
65
65
  type
66
66
  dateCreated
67
67
  }
68
- withdrawalSettings {
69
- paymentMethod
70
- paypalEmailAddress
71
- bankCountry
72
- bankAccountNumber
73
- paymentSchedulingType
74
- paymentThreshold
75
- paymentDay
76
- }
77
- payoutsAccount {
78
- hold
79
- balance
80
- }
68
+ # !!!!! UNCOMMENT ME !!!!!!!!
69
+ # withdrawalSettings {
70
+ # paymentMethod
71
+ # paypalEmailAddress
72
+ # bankCountry
73
+ # bankAccountNumber
74
+ # paymentSchedulingType
75
+ # paymentThreshold
76
+ # paymentDay
77
+ # }
78
+ # payoutsAccount {
79
+ # hold
80
+ # balance
81
+ # }
81
82
  }
82
83
  }
83
84
  }
@@ -1631,7 +1632,13 @@ const GET_TAX_DOCUMENT = dist.gql `
1631
1632
  createImpactPublisherTaxDocumentInput: $vars
1632
1633
  ) {
1633
1634
  documentUrl
1634
- returnUrl
1635
+ }
1636
+ }
1637
+ `;
1638
+ const COMPLETE_TAX_DOCUMENT = dist.gql `
1639
+ mutation completeImpactPublisherTaxDocument($vars: UserIdInput!) {
1640
+ completeImpactPublisherTaxDocument(user: $vars) {
1641
+ success
1635
1642
  }
1636
1643
  }
1637
1644
  `;
@@ -1643,20 +1650,21 @@ const DOCUSIGN_ERROR_STATES = [
1643
1650
  ];
1644
1651
  const DOCUSIGN_EXPIRED_STATES = ["ttl_expired", "session_timeout"];
1645
1652
  function useDocusignForm(props) {
1646
- var _a, _b, _c, _d, _e, _f;
1653
+ var _a, _b, _c;
1647
1654
  const user = Q();
1648
1655
  const context = In(TAX_FORM_CONTEXT_NAMESPACE);
1649
1656
  const [step, setStep] = bn(TAX_CONTEXT_NAMESPACE);
1650
1657
  const { data, loading: userLoading, refetch, } = Mn(USER_QUERY_NAMESPACE);
1651
1658
  const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
1652
1659
  const [createTaxDocument, { loading: documentLoading, data: document, errors: documentErrors },] = $e(GET_TAX_DOCUMENT);
1660
+ const [completeTaxDocument, { loading: completeDocumentLoading, data: completeData, errors: completeErrors, },] = $e(COMPLETE_TAX_DOCUMENT);
1653
1661
  const [docusignStatus, setDocusignStatus] = useState(undefined);
1654
1662
  const [participantType, setParticipantType] = useState(undefined);
1655
1663
  const [errors, setErrors] = useState({});
1656
1664
  const [loading, setLoading] = useState(false);
1657
1665
  // Only look at current document if it's valid (same as required type)
1658
- const existingDocumentType = validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType, (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.type)
1659
- ? (_d = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _d === void 0 ? void 0 : _d.type : undefined;
1666
+ const existingDocumentType = validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) && (publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument)
1667
+ ? publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType : undefined;
1660
1668
  const actualDocumentType = existingDocumentType ||
1661
1669
  getDocumentType(participantType) || (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType);
1662
1670
  useEffect(() => {
@@ -1677,6 +1685,7 @@ function useDocusignForm(props) {
1677
1685
  try {
1678
1686
  const result = await createTaxDocument({
1679
1687
  vars: {
1688
+ provider: "COMPLY_EXCHANGE",
1680
1689
  user: {
1681
1690
  id: user.id,
1682
1691
  accountId: user.accountId,
@@ -1695,18 +1704,22 @@ function useDocusignForm(props) {
1695
1704
  };
1696
1705
  fetchDocument();
1697
1706
  }, [user, publisher, participantType]);
1698
- const progressStep = async () => {
1699
- // TODO: Needs graphql call to determine status of document
1707
+ const completeDocument = async () => {
1708
+ if (!user)
1709
+ return;
1700
1710
  try {
1701
1711
  setLoading(true);
1702
- await refetch();
1703
- // Skip banking info form if it already is saved
1704
- // or if brandedSignup is false
1705
- setStep(context.overrideNextStep ||
1706
- !!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
1707
- !(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
1708
- ? "/dashboard"
1709
- : "/4");
1712
+ const result = await completeTaxDocument({
1713
+ vars: {
1714
+ id: user.id,
1715
+ accountId: user.accountId,
1716
+ },
1717
+ });
1718
+ if (!result || result.message)
1719
+ throw new Error();
1720
+ // @ts-expect-error: no data type for result
1721
+ if (!result.completeImpactPublisherTaxDocument.success)
1722
+ throw new Error();
1710
1723
  }
1711
1724
  catch (e) {
1712
1725
  setErrors({ general: true });
@@ -1715,32 +1728,13 @@ function useDocusignForm(props) {
1715
1728
  setLoading(false);
1716
1729
  }
1717
1730
  };
1718
- // useEffect(() => {
1719
- // const onSubmit = async () => {
1720
- // try {
1721
- // setLoading(true);
1722
- // await refetch();
1723
- // // Skip banking info form if it already is saved
1724
- // // or if brandedSignup is false
1725
- // setStep(
1726
- // context.overrideNextStep ||
1727
- // !!publisher?.withdrawalSettings ||
1728
- // !publisher?.brandedSignup
1729
- // ? "/dashboard"
1730
- // : "/4"
1731
- // );
1732
- // } catch (e) {
1733
- // setErrors({ general: true });
1734
- // } finally {
1735
- // setLoading(false);
1736
- // }
1737
- // };
1738
- // // Handled in view
1739
- // if (DOCUSIGN_ERROR_STATES.includes(docusignStatus)) return;
1740
- // if (DOCUSIGN_SUCCESS_STATES.includes(docusignStatus)) {
1741
- // onSubmit();
1742
- // }
1743
- // }, [docusignStatus, refetch]);
1731
+ const progressStep = () => {
1732
+ setStep(context.overrideNextStep ||
1733
+ !!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
1734
+ !(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
1735
+ ? "/dashboard"
1736
+ : "/4");
1737
+ };
1744
1738
  const allLoading = userLoading || documentLoading || loading;
1745
1739
  return {
1746
1740
  states: {
@@ -1748,7 +1742,7 @@ function useDocusignForm(props) {
1748
1742
  hideSteps: context.hideSteps,
1749
1743
  disabled: allLoading,
1750
1744
  participantTypeDisabled: allLoading || !!existingDocumentType,
1751
- loading: userLoading || loading,
1745
+ loading: userLoading || loading || completeDocumentLoading,
1752
1746
  urlLoading: documentLoading,
1753
1747
  loadingError: !!(documentErrors === null || documentErrors === void 0 ? void 0 : documentErrors.message),
1754
1748
  formState: {
@@ -1762,11 +1756,11 @@ function useDocusignForm(props) {
1762
1756
  },
1763
1757
  data: {
1764
1758
  taxForm: actualDocumentType,
1765
- documentUrl: (_e = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _e === void 0 ? void 0 : _e.documentUrl,
1766
- returnUrl: (_f = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _f === void 0 ? void 0 : _f.returnUrl,
1759
+ documentUrl: (_c = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _c === void 0 ? void 0 : _c.documentUrl,
1767
1760
  },
1768
1761
  callbacks: {
1769
1762
  setDocusignStatus,
1763
+ completeDocument,
1770
1764
  progressStep,
1771
1765
  setParticipantType,
1772
1766
  },
@@ -1852,7 +1846,10 @@ const DocusignIframe = ({ states, data, callbacks, text, }) => {
1852
1846
  const allowed = allowedDomains.some((d) => { var _a; return (_a = e.origin) === null || _a === void 0 ? void 0 : _a.includes(d); });
1853
1847
  if (!allowed)
1854
1848
  return;
1855
- if (e.data === "Complyexchange Thank you page Exit") {
1849
+ if (e.data === "Complyexchange Thank you page Load") {
1850
+ callbacks.completeDocument();
1851
+ }
1852
+ if (e.data == "Complyexchange Thank you page Exit") {
1856
1853
  callbacks.progressStep();
1857
1854
  }
1858
1855
  }, []);
@@ -2046,11 +2043,7 @@ const DocusignFormView = (props) => {
2046
2043
  ? text.taxFormDescriptionIndividualParticipant
2047
2044
  : text.taxFormDescriptionBusinessEntity,
2048
2045
  }, { documentType: documentTypeString }))),
2049
- h("div", null,
2050
- h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "primary", open: true, class: classes.InfoAlert },
2051
- h("sl-icon", { class: classes.InfoIcon, slot: "icon", name: "info-circle" }),
2052
- text.docusignSessionWarning),
2053
- slots.docusignIframeSlot))));
2046
+ h("div", null, slots.docusignIframeSlot))));
2054
2047
  };
2055
2048
 
2056
2049
  const DocusignForm = class {
@@ -2178,9 +2171,9 @@ const DocusignForm = class {
2178
2171
  urlLoading: props.states.urlLoading,
2179
2172
  }, data: {
2180
2173
  documentUrl: props.data.documentUrl,
2181
- returnUrl: props.data.returnUrl,
2182
2174
  }, callbacks: {
2183
2175
  progressStep: props.callbacks.progressStep,
2176
+ completeDocument: props.callbacks.completeDocument,
2184
2177
  }, text: props.text }));
2185
2178
  return (h(Host, null, h(DocusignFormView, { callbacks: props.callbacks, states: props.states, text: props.text, slots: {
2186
2179
  docusignIframeSlot: _isDemo
@@ -2528,7 +2521,7 @@ function useIndirectTaxForm(props) {
2528
2521
  setFormState((p) => ({ ...p, [field]: value }));
2529
2522
  };
2530
2523
  const onSubmit = async (event) => {
2531
- var _a, _b, _c, _d, _e, _f;
2524
+ var _a, _b, _c, _d, _e;
2532
2525
  if (!option) {
2533
2526
  setErrors({ taxDetails: true });
2534
2527
  return;
@@ -2589,7 +2582,7 @@ function useIndirectTaxForm(props) {
2589
2582
  await refetch();
2590
2583
  const resultPublisher = (_e = (_d = (_c = result
2591
2584
  .createImpactConnection) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher;
2592
- const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType, (_f = resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument) === null || _f === void 0 ? void 0 : _f.type);
2585
+ const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
2593
2586
  if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
2594
2587
  !hasValidCurrentDocument) {
2595
2588
  // Go to docusign form
@@ -3729,8 +3722,7 @@ function getCurrentStep(user) {
3729
3722
  }
3730
3723
  const { requiredTaxDocumentType, currentTaxDocument, withdrawalSettings, brandedSignup, } = user.impactConnection.publisher;
3731
3724
  // If they do have a required document, look at current document
3732
- if (requiredTaxDocumentType &&
3733
- !validTaxDocument(requiredTaxDocumentType, currentTaxDocument === null || currentTaxDocument === void 0 ? void 0 : currentTaxDocument.type))
3725
+ if (requiredTaxDocumentType && !currentTaxDocument)
3734
3726
  return "/3";
3735
3727
  if (!withdrawalSettings && brandedSignup)
3736
3728
  return "/4";
@@ -3778,6 +3770,9 @@ function useTaxAndCash() {
3778
3770
  namespace: USER_QUERY_NAMESPACE,
3779
3771
  query: GET_USER,
3780
3772
  skip: !user,
3773
+ options: {
3774
+ batch: false,
3775
+ },
3781
3776
  });
3782
3777
  const countryCode = ((_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher) === null || _c === void 0 ? void 0 : _c.countryCode) ||
3783
3778
  userFormContext.countryCode;
@@ -5177,7 +5172,7 @@ function getIndirectTaxType(taxInformation) {
5177
5172
  return "Indirect Tax";
5178
5173
  }
5179
5174
  const useTaxAndCashDashboard = (props) => {
5180
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
5175
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
5181
5176
  const setStep = wn(TAX_CONTEXT_NAMESPACE);
5182
5177
  const setContext = wn(TAX_FORM_CONTEXT_NAMESPACE);
5183
5178
  const [showDialog, setShowDialog] = useState(false);
@@ -5188,8 +5183,8 @@ const useTaxAndCashDashboard = (props) => {
5188
5183
  }, []);
5189
5184
  const { data, loading, errors: userError, } = Mn(USER_QUERY_NAMESPACE);
5190
5185
  const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
5191
- const documentType = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.type;
5192
- const submissionDate = (_d = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _d === void 0 ? void 0 : _d.dateCreated;
5186
+ const documentType = publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType;
5187
+ const submissionDate = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.dateCreated;
5193
5188
  const dateSubmitted = submissionDate
5194
5189
  ? luxon.DateTime.fromMillis(submissionDate).toFormat("LLL dd, yyyy")
5195
5190
  : undefined;
@@ -5210,23 +5205,23 @@ const useTaxAndCashDashboard = (props) => {
5210
5205
  });
5211
5206
  setStep("/3");
5212
5207
  };
5213
- const provinceName = (_e = INDIRECT_TAX_PROVINCES.find((p) => { var _a; return p.regionCode === ((_a = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _a === void 0 ? void 0 : _a.indirectTaxRegion); })) === null || _e === void 0 ? void 0 : _e.displayName;
5208
+ const provinceName = (_d = INDIRECT_TAX_PROVINCES.find((p) => { var _a; return p.regionCode === ((_a = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _a === void 0 ? void 0 : _a.indirectTaxRegion); })) === null || _d === void 0 ? void 0 : _d.displayName;
5214
5209
  return {
5215
5210
  states: {
5216
5211
  dateSubmitted,
5217
5212
  documentType,
5218
5213
  canEditPayoutInfo: publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup,
5219
5214
  documentTypeString: taxTypeToName(documentType),
5220
- status: (_f = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _f === void 0 ? void 0 : _f.status,
5221
- subRegion: getSubRegionName((_g = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _g === void 0 ? void 0 : _g.indirectTaxRegion),
5222
- subRegionTaxNumber: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _h === void 0 ? void 0 : _h.withholdingTaxId,
5223
- qstNumber: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _j === void 0 ? void 0 : _j.additionalTaxId,
5215
+ status: (_e = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _e === void 0 ? void 0 : _e.status,
5216
+ subRegion: getSubRegionName((_f = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _f === void 0 ? void 0 : _f.indirectTaxRegion),
5217
+ subRegionTaxNumber: (_g = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _g === void 0 ? void 0 : _g.withholdingTaxId,
5218
+ qstNumber: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _h === void 0 ? void 0 : _h.additionalTaxId,
5224
5219
  indirectTaxType: getIndirectTaxType(publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation),
5225
- indirectTaxNumber: (_k = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _k === void 0 ? void 0 : _k.indirectTaxId,
5220
+ indirectTaxNumber: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _j === void 0 ? void 0 : _j.indirectTaxId,
5226
5221
  isBusinessEntity: (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) === "W8BENE",
5227
5222
  province: provinceName,
5228
- country: getCountryName((_l = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _l === void 0 ? void 0 : _l.indirectTaxCountryCode, locale),
5229
- notRegistered: !((_m = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _m === void 0 ? void 0 : _m.indirectTaxId),
5223
+ country: getCountryName((_k = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _k === void 0 ? void 0 : _k.indirectTaxCountryCode, locale),
5224
+ notRegistered: !((_l = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _l === void 0 ? void 0 : _l.indirectTaxId),
5230
5225
  noFormNeeded: !documentType,
5231
5226
  disabled: loading,
5232
5227
  loading,
@@ -432,11 +432,9 @@ const LoadingView = () => {
432
432
  h("sl-skeleton", { class: sheet.classes.ButtonSkeleton })));
433
433
  };
434
434
 
435
- function validTaxDocument(requiredType, currentType) {
436
- if (requiredType === "W9" && currentType === "W9")
437
- return true;
438
- if ((requiredType === "W8BEN" || requiredType === "W8BENE") &&
439
- (currentType === "W8BEN" || currentType === "W8BENE"))
435
+ function validTaxDocument(requiredType) {
436
+ const validTypes = ["W9", "W8BENE", "W8BEN"];
437
+ if (validTypes.includes(requiredType))
440
438
  return true;
441
439
  return false;
442
440
  }
@@ -448,9 +446,8 @@ const taxTypeToName = (taxType) => {
448
446
  case "W9":
449
447
  return "W-9";
450
448
  case "W8BEN":
451
- return "W-8 BEN";
452
449
  case "W8BENE":
453
- return "W-8 BEN-E";
450
+ return "W-8";
454
451
  default:
455
452
  return "";
456
453
  }
@@ -741,7 +738,8 @@ const docusignFormProps = {
741
738
  },
742
739
  },
743
740
  callbacks: {
744
- progressStep: async () => { },
741
+ progressStep: () => { },
742
+ completeDocument: async () => { },
745
743
  setParticipantType: (p) => console.log({ p }),
746
744
  setDocusignStatus: (status) => console.log(status),
747
745
  },
@@ -26,7 +26,7 @@ import { P as PortalResetPasswordView } from './sqm-portal-reset-password-view-7
26
26
  import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-d7ea2c56.js';
27
27
  import { S as ShareButtonView, L as LeaderboardView, C as CopyTextView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalLoginView, f as PortalRegisterView, T as TaskCardView, g as ProgressBarView, h as PoweredByImg$1, i as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, j as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, k as RewardExchangeView, r as rewardExchangeCustomErrorMsg, l as rewardExchangeLongText, m as rewardExchangeSelected, n as chooseAmountFixed, o as chooseAmountFixedNoDescription, p as chooseAmountVariable, q as chooseAmountVariableNoDescription, s as chooseAmountVariableDisabled, t as chooseAmountVariableUnavailable, v as confirmFixed, w as confirmVariable, x as redemptionError, y as queryError, z as success, A as successVariable, F as loading, G as empty$1, J as rewardExchange, K as CardFeedView, M as CouponCodeView, O as ProgressBar$2, Q as autoColorScaleCss, U as ShadowViewAddon } from './ShadowViewAddon-90897c22.js';
28
28
  import { P as PortalContainerView, a as PortalSectionView } from './sqm-portal-container-view-ab89c6cc.js';
29
- import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-6945ea24.js';
29
+ import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-fb2f95b9.js';
30
30
 
31
31
  /**
32
32
  * lodash (Custom Build) <https://lodash.com/>