@saasquatch/mint-components 2.0.1 → 2.0.2-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/cjs/{ShadowViewAddon-1b38dcfc.js → ShadowViewAddon-925a8fa6.js} +3 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +339 -110
  5. package/dist/cjs/sqm-big-stat_47.cjs.entry.js +215 -26
  6. package/dist/cjs/sqm-header-logo.cjs.entry.js +14 -1
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +2 -1
  8. package/dist/cjs/{data-16106637.js → usePayoutStatus-67c78085.js} +161 -129
  9. package/dist/collection/components/sqm-header-logo/sqm-header-logo.js +80 -3
  10. package/dist/collection/components/sqm-portal-footer/sqm-portal-footer-view.js +3 -3
  11. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
  12. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +46 -40
  13. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +84 -2
  14. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +353 -0
  15. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +36 -3
  16. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +301 -1
  17. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +92 -2
  18. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +300 -0
  19. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +23 -12
  20. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +1 -1
  21. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +92 -9
  22. package/dist/esm/{ShadowViewAddon-1adaf077.js → ShadowViewAddon-aae27c2e.js} +3 -3
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/mint-components.js +1 -1
  25. package/dist/esm/sqm-banking-info-form_10.entry.js +290 -61
  26. package/dist/esm/sqm-big-stat_47.entry.js +193 -4
  27. package/dist/esm/sqm-header-logo.entry.js +14 -1
  28. package/dist/esm/sqm-stencilbook.entry.js +2 -1
  29. package/dist/esm/{data-acdb790f.js → usePayoutStatus-f064247b.js} +162 -130
  30. package/dist/esm-es5/{ShadowViewAddon-1adaf077.js → ShadowViewAddon-aae27c2e.js} +1 -1
  31. package/dist/esm-es5/loader.js +1 -1
  32. package/dist/esm-es5/mint-components.js +1 -1
  33. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  34. package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
  35. package/dist/esm-es5/sqm-header-logo.entry.js +1 -1
  36. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  37. package/dist/esm-es5/usePayoutStatus-f064247b.js +6 -0
  38. package/dist/mint-components/mint-components.esm.js +1 -1
  39. package/dist/mint-components/{p-662ed116.system.entry.js → p-0649123a.system.entry.js} +1 -1
  40. package/dist/mint-components/p-2933bbe9.system.entry.js +1 -0
  41. package/dist/mint-components/p-2c86af62.system.entry.js +1 -0
  42. package/dist/mint-components/p-2e87159a.system.entry.js +1 -0
  43. package/dist/mint-components/p-2ed300e9.entry.js +1 -0
  44. package/dist/mint-components/p-3219fdbe.entry.js +99 -0
  45. package/dist/mint-components/{p-9f8d34d1.system.js → p-38f932ae.system.js} +1 -1
  46. package/dist/mint-components/p-40e0251f.system.js +6 -0
  47. package/dist/mint-components/{p-0e1a1b14.js → p-57ce33dd.js} +1 -1
  48. package/dist/mint-components/{p-31bba357.entry.js → p-5f3eafd4.entry.js} +2 -2
  49. package/dist/mint-components/p-967a9040.system.js +1 -1
  50. package/dist/mint-components/p-b1c4500e.entry.js +273 -0
  51. package/dist/mint-components/p-f17b6de6.js +157 -0
  52. package/dist/types/components/sqm-header-logo/sqm-header-logo.d.ts +14 -1
  53. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +24 -0
  54. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +16 -0
  55. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +57 -0
  56. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +3 -1
  57. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +48 -0
  58. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +12 -0
  59. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +48 -0
  60. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +2 -0
  61. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +1 -0
  62. package/dist/types/components.d.ts +331 -1
  63. package/docs/docs.docx +0 -0
  64. package/docs/raisins.json +1 -1
  65. package/grapesjs/grapesjs.js +1 -1
  66. package/package.json +1 -1
  67. package/dist/esm-es5/data-acdb790f.js +0 -6
  68. package/dist/mint-components/p-010957a1.entry.js +0 -99
  69. package/dist/mint-components/p-469a6450.system.js +0 -6
  70. package/dist/mint-components/p-720341b1.entry.js +0 -273
  71. package/dist/mint-components/p-a7ee19dc.entry.js +0 -1
  72. package/dist/mint-components/p-d2bb770d.system.entry.js +0 -1
  73. package/dist/mint-components/p-e1e7d01c.js +0 -157
  74. package/dist/mint-components/p-eea87fdc.system.entry.js +0 -1
  75. package/dist/mint-components/p-fedb9ab8.system.entry.js +0 -1
@@ -19,7 +19,7 @@ const useReferralTable = require('./useReferralTable-90d4d6e9.js');
19
19
  const IndirectTaxDetailsView = require('./IndirectTaxDetailsView-e5f70b8b.js');
20
20
  const utils$1 = require('./utils-83d125fa.js');
21
21
  const keys = require('./keys-cff24974.js');
22
- const data = require('./data-16106637.js');
22
+ const usePayoutStatus = require('./usePayoutStatus-67c78085.js');
23
23
 
24
24
  function getFormMap({ props, getValidationErrorMessage, bankCountry, }) {
25
25
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32;
@@ -728,7 +728,7 @@ const BankingInfoFormView = (props) => {
728
728
  !states.hideSteps && (index.h("p", null, global.intl.formatMessage({
729
729
  id: "formStep",
730
730
  defaultMessage: text.formStep,
731
- }, { step: states.step, count: data.FORM_STEPS }))),
731
+ }, { step: states.step, count: usePayoutStatus.FORM_STEPS }))),
732
732
  index.h("h3", { style: { fontSize: "24px" } }, text.taxAndPayouts),
733
733
  index.h("p", { class: classes.PageDescriptionText }, text.taxAndPayoutsDescription)),
734
734
  ((_a = formState.errors) === null || _a === void 0 ? void 0 : _a.general) && (index.h("sqm-form-message", { type: "error" },
@@ -865,12 +865,12 @@ function useBankingInfoForm(props) {
865
865
  const host = index_module._();
866
866
  const locale = index_module.L();
867
867
  const user = index_module.J();
868
- const [step, setStep] = index_module.Pn(data.TAX_CONTEXT_NAMESPACE);
869
- const context = index_module.Fn(data.TAX_FORM_CONTEXT_NAMESPACE);
870
- const countries = index_module.Fn(data.SORTED_COUNTRIES_NAMESPACE);
868
+ const [step, setStep] = index_module.Pn(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
869
+ const context = index_module.Fn(usePayoutStatus.TAX_FORM_CONTEXT_NAMESPACE);
870
+ const countries = index_module.Fn(usePayoutStatus.SORTED_COUNTRIES_NAMESPACE);
871
871
  const formRef = domContextHooks_module.useRef(null);
872
- const { data: paymentOptionsData, loading: paymentOptionsLoading, errors: paymentOptionsError, } = index_module.$n(data.FINANCE_NETWORK_SETTINGS_NAMESPACE);
873
- const { data: userData, refetch, errors: userError, } = index_module.$n(data.USER_QUERY_NAMESPACE);
872
+ const { data: paymentOptionsData, loading: paymentOptionsLoading, errors: paymentOptionsError, } = index_module.$n(usePayoutStatus.FINANCE_NETWORK_SETTINGS_NAMESPACE);
873
+ const { data: userData, refetch, errors: userError, } = index_module.$n(usePayoutStatus.USER_QUERY_NAMESPACE);
874
874
  const [saveWithdrawalSettings] = index_module.$e(SAVE_WITHDRAWAL_SETTINGS);
875
875
  const [updateWithdrawalSettings] = index_module.$e(UPDATE_WITHDRAWAL_SETTINGS);
876
876
  const [showVerification, setShowVerification] = domContextHooks_module.useState(false);
@@ -1031,7 +1031,7 @@ function useBankingInfoForm(props) {
1031
1031
  return;
1032
1032
  }
1033
1033
  // Fire form change event
1034
- window.dispatchEvent(new Event(data.TAX_FORM_UPDATED_EVENT_KEY));
1034
+ window.dispatchEvent(new Event(usePayoutStatus.TAX_FORM_UPDATED_EVENT_KEY));
1035
1035
  await refetch();
1036
1036
  setStep("/dashboard");
1037
1037
  }
@@ -1574,7 +1574,7 @@ function useDemoBankingInfoForm(props) {
1574
1574
  const defaultPaymentScheduleChecked = (_f = (_e = (_d = props.demoData) === null || _d === void 0 ? void 0 : _d.states) === null || _e === void 0 ? void 0 : _e.formState) === null || _f === void 0 ? void 0 : _f.paymentScheduleChecked;
1575
1575
  const defaultCurrency = (_h = (_g = props.demoData) === null || _g === void 0 ? void 0 : _g.states) === null || _h === void 0 ? void 0 : _h.currency;
1576
1576
  const defaultCountry = (_l = (_k = (_j = props.demoData) === null || _j === void 0 ? void 0 : _j.states) === null || _k === void 0 ? void 0 : _k.formState) === null || _l === void 0 ? void 0 : _l.bankCountry;
1577
- const setStep = index_module.En(data.TAX_CONTEXT_NAMESPACE);
1577
+ const setStep = index_module.En(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
1578
1578
  const [paymentMethodChecked, setPaymentMethodChecked] = domContextHooks_module.useState(undefined);
1579
1579
  const [paymentScheduleChecked, setPaymentScheduleChecked] = domContextHooks_module.useState(undefined);
1580
1580
  const [currency, setCurrency] = domContextHooks_module.useState(defaultCurrency);
@@ -1698,10 +1698,10 @@ const DOCUSIGN_EXPIRED_STATES = ["ttl_expired", "session_timeout"];
1698
1698
  function useDocusignForm(props) {
1699
1699
  var _a, _b, _c;
1700
1700
  const user = index_module.J();
1701
- const context = index_module.Fn(data.TAX_FORM_CONTEXT_NAMESPACE);
1702
- const [step, setStep] = index_module.Pn(data.TAX_CONTEXT_NAMESPACE);
1703
- const { data: data$1, loading: userLoading, refetch, } = index_module.$n(data.USER_QUERY_NAMESPACE);
1704
- const publisher = (_b = (_a = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
1701
+ const context = index_module.Fn(usePayoutStatus.TAX_FORM_CONTEXT_NAMESPACE);
1702
+ const [step, setStep] = index_module.Pn(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
1703
+ const { data, loading: userLoading, refetch, } = index_module.$n(usePayoutStatus.USER_QUERY_NAMESPACE);
1704
+ 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;
1705
1705
  const [createTaxDocument, { loading: documentLoading, data: document, errors: documentErrors },] = index_module.$e(GET_TAX_DOCUMENT);
1706
1706
  const [completeTaxDocument, { loading: completeDocumentLoading, data: completeData, errors: completeErrors, },] = index_module.$e(COMPLETE_TAX_DOCUMENT);
1707
1707
  const [docusignStatus, setDocusignStatus] = domContextHooks_module.useState(undefined);
@@ -1769,7 +1769,7 @@ function useDocusignForm(props) {
1769
1769
  if (!result.completeImpactPublisherTaxDocument.success)
1770
1770
  throw new Error();
1771
1771
  // Fire form change event
1772
- window.dispatchEvent(new Event(data.TAX_FORM_UPDATED_EVENT_KEY));
1772
+ window.dispatchEvent(new Event(usePayoutStatus.TAX_FORM_UPDATED_EVENT_KEY));
1773
1773
  setShowExitButton(true);
1774
1774
  }
1775
1775
  catch (e) {
@@ -2073,7 +2073,7 @@ const DocusignFormView = (props) => {
2073
2073
  !states.hideSteps && (index.h("p", null, global.intl.formatMessage({
2074
2074
  id: "formStep",
2075
2075
  defaultMessage: text.formStep,
2076
- }, { step: states.step, count: data.FORM_STEPS }))),
2076
+ }, { step: states.step, count: usePayoutStatus.FORM_STEPS }))),
2077
2077
  index.h("h3", null, text.taxForm),
2078
2078
  index.h("p", { class: classes.PageDescriptionText }, text.taxAndPayoutsDescription))),
2079
2079
  states.loadingError && (index.h("div", null,
@@ -2266,7 +2266,7 @@ const DocusignForm = class {
2266
2266
  get el() { return index.getElement(this); }
2267
2267
  };
2268
2268
  function useDocusignFormDemo(props) {
2269
- const setStep = index_module.En(data.TAX_CONTEXT_NAMESPACE);
2269
+ const setStep = index_module.En(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
2270
2270
  return cjs.cjs({
2271
2271
  text: props.getTextProps(),
2272
2272
  states: {
@@ -2452,7 +2452,7 @@ const IndirectTaxFormView = (props) => {
2452
2452
  global.intl.formatMessage({
2453
2453
  id: "formStep",
2454
2454
  defaultMessage: text.formStep,
2455
- }, { step: states.step, count: data.FORM_STEPS }))),
2455
+ }, { step: states.step, count: usePayoutStatus.FORM_STEPS }))),
2456
2456
  index.h("h3", null, text.indirectTax),
2457
2457
  index.h("p", { class: classes.PageDescriptionText }, text.taxAndPayoutsDescription),
2458
2458
  index.h("p", { class: classes.DescriptionText }, text.indirectTaxDescription)),
@@ -2547,12 +2547,12 @@ function useIndirectTaxForm(props) {
2547
2547
  const user = index_module.J();
2548
2548
  const locale = index_module.L();
2549
2549
  const formRef = domContextHooks_module.useRef(null);
2550
- const context = index_module.Fn(data.TAX_FORM_CONTEXT_NAMESPACE);
2551
- const [step, setStep] = index_module.Pn(data.TAX_CONTEXT_NAMESPACE);
2550
+ const context = index_module.Fn(usePayoutStatus.TAX_FORM_CONTEXT_NAMESPACE);
2551
+ const [step, setStep] = index_module.Pn(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
2552
2552
  const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = index_module.$e(CONNECT_PARTNER);
2553
- const userForm = index_module.Fn(data.USER_FORM_CONTEXT_NAMESPACE);
2554
- const { data: userData, refetch, errors: userError, } = index_module.$n(data.USER_QUERY_NAMESPACE);
2555
- const { data: _countriesRes, loading: countriesLoading } = index_module.$n(data.COUNTRIES_QUERY_NAMESPACE);
2553
+ const userForm = index_module.Fn(usePayoutStatus.USER_FORM_CONTEXT_NAMESPACE);
2554
+ const { data: userData, refetch, errors: userError, } = index_module.$n(usePayoutStatus.USER_QUERY_NAMESPACE);
2555
+ const { data: _countriesRes, loading: countriesLoading } = index_module.$n(usePayoutStatus.COUNTRIES_QUERY_NAMESPACE);
2556
2556
  const intlLocale = (locale === null || locale === void 0 ? void 0 : locale.replace("_", "-")) || "en";
2557
2557
  const _countries = domContextHooks_module.useMemo(() => { var _a, _b; return (_b = (_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.map((country) => utils$1.getCountryObj({ countryCode: country.countryCode, locale: intlLocale })); }, [(_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data]);
2558
2558
  const [loading, setLoading] = domContextHooks_module.useState(false);
@@ -2611,8 +2611,51 @@ function useIndirectTaxForm(props) {
2611
2611
  console.error("Could not detect select change");
2612
2612
  setFormState((p) => ({ ...p, [field]: value }));
2613
2613
  };
2614
- const onSubmit = async (event) => {
2614
+ async function connectPartner(formData) {
2615
2615
  var _a, _b, _c, _d, _e;
2616
+ const vars = {
2617
+ user: {
2618
+ id: user.id,
2619
+ accountId: user.accountId,
2620
+ },
2621
+ firstName: userForm.firstName,
2622
+ lastName: userForm.lastName,
2623
+ countryCode: userForm.countryCode,
2624
+ currency: userForm.currency,
2625
+ address: userForm.address,
2626
+ city: userForm.city,
2627
+ state: userForm.state,
2628
+ postalCode: userForm.postalCode,
2629
+ phoneNumber: userForm.phoneNumber,
2630
+ phoneNumberCountryCode: userForm.phoneNumberCountryCode,
2631
+ indirectTaxCountryCode: formData.selectedRegion,
2632
+ indirectTaxRegion: formData.province || formData.subRegion,
2633
+ indirectTaxId: formData.indirectTaxNumber,
2634
+ additionalTaxId: formData.qstNumber,
2635
+ withholdingTaxId: formData.subRegionTaxNumber,
2636
+ };
2637
+ const result = await connectImpactPartner({
2638
+ vars,
2639
+ });
2640
+ if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
2641
+ throw new Error();
2642
+ if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
2643
+ // Output backend errors to console for now
2644
+ console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
2645
+ throw new Error();
2646
+ }
2647
+ await refetch();
2648
+ const resultPublisher = (_e = (_d = (_c = result
2649
+ .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;
2650
+ const hasValidCurrentDocument = utils$1.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
2651
+ // Fire form change event
2652
+ window.dispatchEvent(new Event(usePayoutStatus.TAX_FORM_UPDATED_EVENT_KEY));
2653
+ return {
2654
+ resultPublisher,
2655
+ hasValidCurrentDocument,
2656
+ };
2657
+ }
2658
+ const onSubmit = async (event) => {
2616
2659
  if (!option) {
2617
2660
  setErrors({ taxDetails: true });
2618
2661
  return;
@@ -2638,44 +2681,7 @@ function useIndirectTaxForm(props) {
2638
2681
  }
2639
2682
  setLoading(true);
2640
2683
  try {
2641
- const vars = {
2642
- user: {
2643
- id: user.id,
2644
- accountId: user.accountId,
2645
- },
2646
- firstName: userForm.firstName,
2647
- lastName: userForm.lastName,
2648
- countryCode: userForm.countryCode,
2649
- currency: userForm.currency,
2650
- address: userForm.address,
2651
- city: userForm.city,
2652
- state: userForm.state,
2653
- postalCode: userForm.postalCode,
2654
- phoneNumber: userForm.phoneNumber,
2655
- phoneNumberCountryCode: userForm.phoneNumberCountryCode,
2656
- indirectTaxCountryCode: formData.selectedRegion,
2657
- indirectTaxRegion: formData.province || formData.subRegion,
2658
- indirectTaxId: formData.indirectTaxNumber,
2659
- additionalTaxId: formData.qstNumber,
2660
- withholdingTaxId: formData.subRegionTaxNumber,
2661
- };
2662
- const result = await connectImpactPartner({
2663
- vars,
2664
- });
2665
- if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
2666
- throw new Error();
2667
- if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
2668
- // Output backend errors to console for now
2669
- console.error("Failed to create Impact connection: ", result.createImpactConnection
2670
- .validationErrors);
2671
- throw new Error();
2672
- }
2673
- await refetch();
2674
- const resultPublisher = (_e = (_d = (_c = result
2675
- .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;
2676
- const hasValidCurrentDocument = utils$1.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
2677
- // Fire form change event
2678
- window.dispatchEvent(new Event(data.TAX_FORM_UPDATED_EVENT_KEY));
2684
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
2679
2685
  if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
2680
2686
  !hasValidCurrentDocument) {
2681
2687
  // Go to docusign form
@@ -2951,7 +2957,7 @@ const IndirectTaxForm = class {
2951
2957
  }
2952
2958
  };
2953
2959
  function useDemoIndirectTaxForm(props) {
2954
- const setStep = index_module.En(data.TAX_CONTEXT_NAMESPACE);
2960
+ const setStep = index_module.En(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
2955
2961
  const [option, setOption] = domContextHooks_module.useState("otherRegion");
2956
2962
  const [demoFormState, setDemoFormState] = domContextHooks_module.useState({});
2957
2963
  return cjs.cjs({
@@ -3586,8 +3592,8 @@ function PayoutDetailsCardView(props) {
3586
3592
 
3587
3593
  function usePayoutDetailsCard(props) {
3588
3594
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3589
- const { data: data$1, loading } = index_module.$n(data.USER_QUERY_NAMESPACE);
3590
- const publisher = (_b = (_a = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
3595
+ const { data, loading } = index_module.$n(usePayoutStatus.USER_QUERY_NAMESPACE);
3596
+ 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;
3591
3597
  function getPayoutDetailedStatusText(paymentDay) {
3592
3598
  var _a;
3593
3599
  const currentDay = luxon.luxon.DateTime.now().day;
@@ -4028,7 +4034,7 @@ const TaxAndCashDashboardView = (props) => {
4028
4034
  icon: "exclamation-octagon",
4029
4035
  class: sheet$4.classes.ErrorHoldAlertContainer,
4030
4036
  };
4031
- case "ACCOUNT_REVIEW":
4037
+ case "NEW_PAYEE_REVIEW":
4032
4038
  return {
4033
4039
  header: text.accountReviewHeader,
4034
4040
  description: global.intl.formatMessage({
@@ -4042,6 +4048,96 @@ const TaxAndCashDashboardView = (props) => {
4042
4048
  icon: "exclamation-triangle",
4043
4049
  class: sheet$4.classes.WarningHoldAlertContainer,
4044
4050
  };
4051
+ case "PAYMENT_HOLD_ON_CHANGE":
4052
+ return {
4053
+ header: text.paymentHoldOnChangeHeader,
4054
+ description: global.intl.formatMessage({
4055
+ id: "accountReviewDescription",
4056
+ defaultMessage: text.paymentHoldOnChangeDescription,
4057
+ }, {
4058
+ supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4059
+ }),
4060
+ buttonText: null,
4061
+ alertType: "warning",
4062
+ icon: "exclamation-triangle",
4063
+ class: sheet$4.classes.WarningHoldAlertContainer,
4064
+ };
4065
+ case "BENEFICIARY_NAME_INVALID":
4066
+ return {
4067
+ header: text.beneficiaryNameInvalidHeader,
4068
+ description: global.intl.formatMessage({
4069
+ id: "accountReviewDescription",
4070
+ defaultMessage: text.beneficiaryNameInvalidDescription,
4071
+ }, {
4072
+ supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4073
+ }),
4074
+ button: (index.h(index.Fragment, null,
4075
+ index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4076
+ index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4077
+ alertType: "warning",
4078
+ icon: "exclamation-triangle",
4079
+ class: sheet$4.classes.WarningHoldAlertContainer,
4080
+ };
4081
+ case "BENEFICIARY_NAME_MISMATCH":
4082
+ return {
4083
+ header: text.beneficiaryNameMismatchHeader,
4084
+ description: global.intl.formatMessage({
4085
+ id: "accountReviewDescription",
4086
+ defaultMessage: text.beneficiaryNameMismatchDescription,
4087
+ }, {
4088
+ supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4089
+ }),
4090
+ button: (index.h(index.Fragment, null,
4091
+ index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4092
+ index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4093
+ alertType: "warning",
4094
+ icon: "exclamation-triangle",
4095
+ class: sheet$4.classes.WarningHoldAlertContainer,
4096
+ };
4097
+ case "BANK_TAX_NAME_MISMATCH":
4098
+ return {
4099
+ header: text.bankTaxNameMismatchHeader,
4100
+ description: global.intl.formatMessage({
4101
+ id: "accountReviewDescription",
4102
+ defaultMessage: text.bankTaxNameMismatchDescription,
4103
+ }, {
4104
+ supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4105
+ }),
4106
+ button: (index.h(index.Fragment, null,
4107
+ index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4108
+ index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4109
+ alertType: "warning",
4110
+ icon: "exclamation-triangle",
4111
+ class: sheet$4.classes.WarningHoldAlertContainer,
4112
+ };
4113
+ case "WITHDRAWAL_SETTINGS_INVALID":
4114
+ return {
4115
+ header: text.withdrawalSettingsInvalidHeader,
4116
+ description: global.intl.formatMessage({
4117
+ id: "accountReviewDescription",
4118
+ defaultMessage: text.withdrawalSettingsInvalidDescription,
4119
+ }, {
4120
+ supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4121
+ }),
4122
+ button: (index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
4123
+ alertType: "warning",
4124
+ icon: "exclamation-triangle",
4125
+ class: sheet$4.classes.WarningHoldAlertContainer,
4126
+ };
4127
+ case "PAYMENT_RETURNED":
4128
+ return {
4129
+ header: text.paymentReturnedHeader,
4130
+ description: global.intl.formatMessage({
4131
+ id: "accountReviewDescription",
4132
+ defaultMessage: text.paymentReturnedDescription,
4133
+ }, {
4134
+ supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4135
+ }),
4136
+ button: (index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
4137
+ alertType: "warning",
4138
+ icon: "exclamation-triangle",
4139
+ class: sheet$4.classes.WarningHoldAlertContainer,
4140
+ };
4045
4141
  case "HOLD":
4046
4142
  return {
4047
4143
  header: text.payoutHoldAlertHeader,
@@ -4289,10 +4385,10 @@ function getIndirectTaxType(taxInformation) {
4289
4385
  }
4290
4386
  const useTaxAndCashDashboard = (props) => {
4291
4387
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
4292
- const setStep = index_module.En(data.TAX_CONTEXT_NAMESPACE);
4293
- const setContext = index_module.En(data.TAX_FORM_CONTEXT_NAMESPACE);
4388
+ const setStep = index_module.En(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
4389
+ const setContext = index_module.En(usePayoutStatus.TAX_FORM_CONTEXT_NAMESPACE);
4294
4390
  const [showDialog, setShowDialog] = domContextHooks_module.useState(false);
4295
- const { render, loading: veriffLoading, errors: veriffErrors, } = data.useVeriffApp();
4391
+ const { render, loading: veriffLoading, errors: veriffErrors, } = usePayoutStatus.useVeriffApp();
4296
4392
  const { data: taxSettingRes } = index_module.wn(GET_TAX_SETTING, {});
4297
4393
  const locale = index_module.L();
4298
4394
  domContextHooks_module.useEffect(() => {
@@ -4301,8 +4397,8 @@ const useTaxAndCashDashboard = (props) => {
4301
4397
  if (window.location.hash)
4302
4398
  setStep(`/${window.location.hash.replace("#", "")}`);
4303
4399
  }, []);
4304
- const { data: data$1, loading, errors: userError, refetch, } = index_module.$n(data.USER_QUERY_NAMESPACE);
4305
- const publisher = (_b = (_a = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
4400
+ const { data, loading, errors: userError, refetch, } = index_module.$n(usePayoutStatus.USER_QUERY_NAMESPACE);
4401
+ 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;
4306
4402
  const documentType = publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType;
4307
4403
  const submissionDate = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.dateCreated;
4308
4404
  const dateSubmitted = submissionDate
@@ -4326,12 +4422,12 @@ const useTaxAndCashDashboard = (props) => {
4326
4422
  setStep("/3");
4327
4423
  };
4328
4424
  const provinceName = (_d = IndirectTaxDetailsView.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;
4329
- const payoutStatus = data$1 ? data.getStatus(data$1) : null;
4425
+ const payoutStatus = data ? usePayoutStatus.getStatus(data) : null;
4330
4426
  domContextHooks_module.useEffect(() => {
4331
4427
  const cb = () => refetch();
4332
- window.addEventListener(data.VERIFF_COMPLETE_EVENT_KEY, cb);
4428
+ window.addEventListener(usePayoutStatus.VERIFF_COMPLETE_EVENT_KEY, cb);
4333
4429
  return () => {
4334
- window.removeEventListener(data.VERIFF_COMPLETE_EVENT_KEY, cb);
4430
+ window.removeEventListener(usePayoutStatus.VERIFF_COMPLETE_EVENT_KEY, cb);
4335
4431
  };
4336
4432
  }, []);
4337
4433
  const enforceUsTaxComplianceOption = (_e = taxSettingRes === null || taxSettingRes === void 0 ? void 0 : taxSettingRes.tenantSettings) === null || _e === void 0 ? void 0 : _e.enforceUsTaxCompliance;
@@ -4612,6 +4708,54 @@ const TaxAndCashDashboard = class {
4612
4708
  * @uiName Account review alert description
4613
4709
  */
4614
4710
  this.accountReviewDescription = "This process takes 48 hours, payouts are on hold until it's completed. You will receive an email from our referral provider, Impact.com, if any issues arise. It contains details on how to resolve this issue. If you need further assistance, please reach out to our {supportLink}.";
4711
+ /**
4712
+ * @uiName Payment hold on change alert header
4713
+ */
4714
+ this.paymentHoldOnChangeHeader = "We are reviewing your new payout settings";
4715
+ /**
4716
+ * @uiName Payment hold on change alert description
4717
+ */
4718
+ this.paymentHoldOnChangeDescription = "Your payout is temporarily on hold while we review your new payment information, this process is usually resolved within 48 hours.";
4719
+ /**
4720
+ * @uiName Beneficiary name invalid alert header
4721
+ */
4722
+ this.beneficiaryNameInvalidHeader = "Your payment information does not match your tax form";
4723
+ /**
4724
+ * @uiName Beneficiary name invalid description
4725
+ */
4726
+ this.beneficiaryNameInvalidDescription = "The beneficiary name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
4727
+ /**
4728
+ * @uiName Beneficiary name mismatch alert header
4729
+ */
4730
+ this.beneficiaryNameMismatchHeader = "Your payment information does not match your tax form";
4731
+ /**
4732
+ * @uiName Beneficiary name mismatch alert description
4733
+ */
4734
+ this.beneficiaryNameMismatchDescription = "The beneficiary name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
4735
+ /**
4736
+ * @uiName Bank name mismatch alert header
4737
+ */
4738
+ this.bankTaxNameMismatchHeader = "Your payment information does not match your tax form";
4739
+ /**
4740
+ * @uiName Bank name mismatch alert description
4741
+ */
4742
+ this.bankTaxNameMismatchDescription = "The bank name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
4743
+ /**
4744
+ * @uiName Withdrawal settings invalid alert header
4745
+ */
4746
+ this.withdrawalSettingsInvalidHeader = "Your payment information includes invalid characters";
4747
+ /**
4748
+ * @uiName Withdrawal settings invalid alert description
4749
+ */
4750
+ this.withdrawalSettingsInvalidDescription = "There are invalid characters in your payment information. Please review your information and make sure it is correct with no invalid characters. Your payouts are on hold until this is resolved.";
4751
+ /**
4752
+ * @uiName Payment returned alert header
4753
+ */
4754
+ this.paymentReturnedHeader = "Payout unsuccessful";
4755
+ /**
4756
+ * @uiName Payment returned alert description
4757
+ */
4758
+ this.paymentReturnedDescription = "Our recent payment attempt for your earnings was unsuccessful. Please review your payment information and make sure it is correct.";
4615
4759
  /**
4616
4760
  * @uiName Terms and Conditions text
4617
4761
  */
@@ -6008,7 +6152,7 @@ const vanillaStyle$4 = `
6008
6152
  `;
6009
6153
  const UserInfoFormView = (props) => {
6010
6154
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
6011
- const { states, states: { formState }, callbacks, text, refs, data: data$1, } = props;
6155
+ const { states, states: { formState }, callbacks, text, refs, data, } = props;
6012
6156
  const { classes } = sheet$5;
6013
6157
  const bankingCollectionText = global.intl.formatMessage({
6014
6158
  id: "bankingCollectionText",
@@ -6017,7 +6161,7 @@ const UserInfoFormView = (props) => {
6017
6161
  termsAndConditionsLink: (index.h("a", { href: text.termsAndConditionsLink, target: "_blank" }, text.termsAndConditionsLabel)),
6018
6162
  });
6019
6163
  let regionLabel = undefined;
6020
- switch (data$1.regionLabelEnum) {
6164
+ switch (data.regionLabelEnum) {
6021
6165
  case "STATE":
6022
6166
  regionLabel = text.state;
6023
6167
  break;
@@ -6030,6 +6174,12 @@ const UserInfoFormView = (props) => {
6030
6174
  default:
6031
6175
  regionLabel = text.state;
6032
6176
  }
6177
+ function isDisabledInput(field) {
6178
+ var _a;
6179
+ if (states.isPartner && !!((_a = data.partnerData) === null || _a === void 0 ? void 0 : _a[field]))
6180
+ return true;
6181
+ return false;
6182
+ }
6033
6183
  return (index.h("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit, ref: (el) => (refs.formRef.current = el), novalidate: true },
6034
6184
  index.h("style", { type: "text/css" },
6035
6185
  styleString$5,
@@ -6049,7 +6199,7 @@ const UserInfoFormView = (props) => {
6049
6199
  !states.hideSteps && (index.h("p", null, global.intl.formatMessage({
6050
6200
  id: "formStep",
6051
6201
  defaultMessage: text.formStep,
6052
- }, { step: states.step, count: data.FORM_STEPS }))),
6202
+ }, { step: states.step, count: usePayoutStatus.FORM_STEPS }))),
6053
6203
  index.h("h3", null, text.personalInformation),
6054
6204
  index.h("p", { class: classes.PageDescriptionText }, text.taxAndPayoutsDescription))),
6055
6205
  ((_a = formState.errors) === null || _a === void 0 ? void 0 : _a.general) && (index.h("sqm-form-message", { type: "error" },
@@ -6070,18 +6220,22 @@ const UserInfoFormView = (props) => {
6070
6220
  })))),
6071
6221
  index.h("div", null,
6072
6222
  index.h("div", { class: classes.InputContainer },
6073
- index.h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled || states.isUser || states.isPartner }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
6223
+ index.h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled ||
6224
+ states.isUser ||
6225
+ isDisabledInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
6074
6226
  class: classes.ErrorInput,
6075
6227
  helpText: utils$1.formatErrorMessage(text.firstName, formState.errors.firstName),
6076
6228
  }
6077
6229
  : {}), { id: "firstName", name: "/firstName", required: true })),
6078
- index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled || states.isUser || states.isPartner }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
6230
+ index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled ||
6231
+ states.isUser ||
6232
+ isDisabledInput("lastName") }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
6079
6233
  class: classes.ErrorInput,
6080
6234
  helpText: utils$1.formatErrorMessage(text.lastName, formState.errors.lastName),
6081
6235
  }
6082
6236
  : {}), { id: "lastName", name: "/lastName", required: true })),
6083
6237
  index.h("sl-input", { exportparts: "label: input-label, base: input-base", value: formState.email, label: text.email, disabled: true, id: "email", name: "/email", required: true }),
6084
- index.h("sl-select", Object.assign({ id: "countryCode", exportparts: "label: input-label, base: input-base", name: "/countryCode", label: text.country, value: formState.countryCode, disabled: states.disabled || states.isPartner }, (((_d = formState.errors) === null || _d === void 0 ? void 0 : _d.countryCode) ? {
6238
+ index.h("sl-select", Object.assign({ id: "countryCode", exportparts: "label: input-label, base: input-base", name: "/countryCode", label: text.country, value: formState.countryCode, disabled: states.disabled || isDisabledInput("countryCode") }, (((_d = formState.errors) === null || _d === void 0 ? void 0 : _d.countryCode) ? {
6085
6239
  class: classes.ErrorInput,
6086
6240
  helpText: utils$1.formatErrorMessage(text.country, formState.errors.countryCode),
6087
6241
  }
@@ -6091,13 +6245,14 @@ const UserInfoFormView = (props) => {
6091
6245
  e.stopPropagation();
6092
6246
  }, "onSl-input": (e) => {
6093
6247
  callbacks.setCountrySearch(e.target.value);
6094
- } }), (_e = data$1 === null || data$1 === void 0 ? void 0 : data$1.countries) === null || _e === void 0 ? void 0 :
6095
- _e.map((c) => (index.h("sl-menu-item", { value: c.countryCode }, c.displayName))), (_f = data$1 === null || data$1 === void 0 ? void 0 : data$1.allCountries) === null || _f === void 0 ? void 0 :
6248
+ } }), (_e = data === null || data === void 0 ? void 0 : data.countries) === null || _e === void 0 ? void 0 :
6249
+ _e.map((c) => (index.h("sl-menu-item", { value: c.countryCode }, c.displayName))), (_f = data === null || data === void 0 ? void 0 : data.allCountries) === null || _f === void 0 ? void 0 :
6096
6250
  _f.map((c) => (index.h("sl-menu-item", { value: c.countryCode, style: { display: "none" } }, c.displayName)))),
6097
6251
  index.h("div", { class: classes.PhoneInputsSection },
6098
6252
  index.h("p", null, text.phoneNumber),
6099
6253
  index.h("div", { class: classes.PhoneInputsContainer },
6100
- index.h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled || states.isPartner, ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
6254
+ index.h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled ||
6255
+ isDisabledInput("phoneNumberCountryCode"), ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
6101
6256
  class: classes.ErrorInput,
6102
6257
  }
6103
6258
  : {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
@@ -6106,13 +6261,13 @@ const UserInfoFormView = (props) => {
6106
6261
  e.stopPropagation();
6107
6262
  }, "onSl-input": (e) => {
6108
6263
  callbacks.setPhoneCountrySearch(e.target.value);
6109
- } }), (_h = data$1 === null || data$1 === void 0 ? void 0 : data$1.phoneCountries) === null || _h === void 0 ? void 0 :
6264
+ } }), (_h = data === null || data === void 0 ? void 0 : data.phoneCountries) === null || _h === void 0 ? void 0 :
6110
6265
  _h.map((c) => {
6111
6266
  var _a, _b;
6112
6267
  return (index.h("sl-menu-item", { value: c.countryCode },
6113
6268
  index.h("div", { slot: "prefix" }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
6114
6269
  _b.dial_code));
6115
- }), (_j = data$1 === null || data$1 === void 0 ? void 0 : data$1.allCountries) === null || _j === void 0 ? void 0 :
6270
+ }), (_j = data === null || data === void 0 ? void 0 : data.allCountries) === null || _j === void 0 ? void 0 :
6116
6271
  _j.map((c) => {
6117
6272
  var _a, _b;
6118
6273
  return (index.h("sl-menu-item", { value: c.countryCode, style: { display: "none" } },
@@ -6123,7 +6278,7 @@ const UserInfoFormView = (props) => {
6123
6278
  // Naive phone number validation
6124
6279
  utils$1.validateBillingField(/[a-zA-Z]+/, value) &&
6125
6280
  utils$1.formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError);
6126
- }, disabled: states.disabled || states.isPartner }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
6281
+ }, disabled: states.disabled || isDisabledInput("phoneNumber") }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
6127
6282
  class: classes.ErrorInput,
6128
6283
  helpText: utils$1.formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
6129
6284
  }
@@ -6131,7 +6286,7 @@ const UserInfoFormView = (props) => {
6131
6286
  index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.address, id: "address", name: "/address", value: formState.address, validationError: ({ value }) =>
6132
6287
  // Checks for non-ASCII characters
6133
6288
  !utils$1.validateBillingField(/^[\x20-\xFF]+$/, value) &&
6134
- utils$1.formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || states.isPartner }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
6289
+ utils$1.formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("address") }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
6135
6290
  class: classes.ErrorInput,
6136
6291
  helpText: utils$1.formatErrorMessage(text.address, formState.errors.address),
6137
6292
  }
@@ -6139,22 +6294,22 @@ const UserInfoFormView = (props) => {
6139
6294
  index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.city, id: "city", name: "/city", value: formState.city, validationError: ({ value }) =>
6140
6295
  // Checks for non-ASCII characters
6141
6296
  !utils$1.validateBillingField(/^[\x20-\xFF]+$/, value) &&
6142
- utils$1.formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || states.isPartner }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
6297
+ utils$1.formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("city") }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
6143
6298
  class: classes.ErrorInput,
6144
6299
  helpText: utils$1.formatErrorMessage(text.city, formState.errors.city),
6145
6300
  }
6146
6301
  : {}), { required: true })),
6147
- !states.hideState && (index.h("sl-select", Object.assign({ label: regionLabel, exportparts: "label: input-label, base: input-base", id: "state", name: "/state", value: formState.state, disabled: states.disabled || states.isPartner }, (((_o = formState.errors) === null || _o === void 0 ? void 0 : _o.state) ? {
6302
+ !states.hideState && (index.h("sl-select", Object.assign({ label: regionLabel, exportparts: "label: input-label, base: input-base", id: "state", name: "/state", value: formState.state, disabled: states.disabled || isDisabledInput("state") }, (((_o = formState.errors) === null || _o === void 0 ? void 0 : _o.state) ? {
6148
6303
  class: classes.ErrorInput,
6149
6304
  helpText: utils$1.formatErrorMessage(text.state, formState.errors.state),
6150
6305
  }
6151
- : {}), { required: true }), (_p = data$1.regions) === null || _p === void 0 ? void 0 : _p.map((r) => (index.h("sl-menu-item", { value: r.value }, r.label))))),
6152
- index.h("sl-input", Object.assign({ label: text.postalCode, exportparts: "label: input-label, base: input-base", id: "postalCode", name: "/postalCode", value: formState.postalCode, disabled: states.disabled || states.isPartner }, (((_q = formState.errors) === null || _q === void 0 ? void 0 : _q.postalCode) ? {
6306
+ : {}), { required: true }), (_p = data.regions) === null || _p === void 0 ? void 0 : _p.map((r) => (index.h("sl-menu-item", { value: r.value }, r.label))))),
6307
+ index.h("sl-input", Object.assign({ label: text.postalCode, exportparts: "label: input-label, base: input-base", id: "postalCode", name: "/postalCode", value: formState.postalCode, disabled: states.disabled || isDisabledInput("postalCode") }, (((_q = formState.errors) === null || _q === void 0 ? void 0 : _q.postalCode) ? {
6153
6308
  class: classes.ErrorInput,
6154
6309
  helpText: utils$1.formatErrorMessage(text.postalCode, formState.errors.postalCode),
6155
6310
  }
6156
6311
  : {}), { required: true })),
6157
- index.h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || states.isPartner, helpText: text.currencyHelpText }, (((_r = formState.errors) === null || _r === void 0 ? void 0 : _r.currency) ? {
6312
+ index.h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || isDisabledInput("currency"), helpText: text.currencyHelpText }, (((_r = formState.errors) === null || _r === void 0 ? void 0 : _r.currency) ? {
6158
6313
  class: classes.ErrorInput,
6159
6314
  helpText: utils$1.formatErrorMessage(text.currency, formState.errors.currency),
6160
6315
  }
@@ -6164,11 +6319,11 @@ const UserInfoFormView = (props) => {
6164
6319
  e.stopPropagation();
6165
6320
  }, "onSl-input": (e) => {
6166
6321
  callbacks.setCurrencySearch(e.target.value);
6167
- } }), (_s = data$1 === null || data$1 === void 0 ? void 0 : data$1.currencies) === null || _s === void 0 ? void 0 :
6322
+ } }), (_s = data === null || data === void 0 ? void 0 : data.currencies) === null || _s === void 0 ? void 0 :
6168
6323
  _s.map((c) => (index.h("sl-menu-item", { value: c.currencyCode },
6169
6324
  c.currencyCode,
6170
6325
  " - ",
6171
- c.displayName))), (_t = data$1 === null || data$1 === void 0 ? void 0 : data$1.allCurrencies) === null || _t === void 0 ? void 0 :
6326
+ c.displayName))), (_t = data === null || data === void 0 ? void 0 : data.allCurrencies) === null || _t === void 0 ? void 0 :
6172
6327
  _t.map((c) => (index.h("sl-menu-item", { value: c.currencyCode, style: { display: "none" } },
6173
6328
  c.currencyCode,
6174
6329
  " - ",
@@ -6176,22 +6331,24 @@ const UserInfoFormView = (props) => {
6176
6331
  index.h("div", { class: classes.CheckboxWrapper },
6177
6332
  index.h("sl-checkbox", { checked: formState.allowBankingCollection === true, "onSl-change": (e) => {
6178
6333
  e.target.value = e.target.checked;
6179
- }, disabled: states.isPartner ? false : states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
6334
+ }, disabled: states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
6180
6335
  ((_u = formState.errors) === null || _u === void 0 ? void 0 : _u.allowBankingCollection) && (index.h("p", { class: classes.ErrorText }, utils$1.formatErrorMessage(text.termsAndConditionsLabel, formState.errors.allowBankingCollection))))),
6181
- index.h("sl-button", { type: "primary", disabled: states.isPartner ? false : states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
6336
+ index.h("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
6182
6337
  };
6183
6338
 
6184
6339
  function useUserInfoForm(props) {
6185
- var _a, _b, _c, _d;
6340
+ var _a, _b, _c, _d, _e, _f;
6186
6341
  const currencyRef = domContextHooks_module.useRef(undefined);
6187
6342
  const phoneCountryRef = domContextHooks_module.useRef(undefined);
6188
6343
  const formRef = domContextHooks_module.useRef(null);
6189
- const context = index_module.Fn(data.TAX_FORM_CONTEXT_NAMESPACE);
6190
- const countries = index_module.Fn(data.SORTED_COUNTRIES_NAMESPACE);
6191
- const [step, setStep] = index_module.Pn(data.TAX_CONTEXT_NAMESPACE);
6192
- const [userFormContext, setUserFormContext] = index_module.Pn(data.USER_FORM_CONTEXT_NAMESPACE);
6193
- const { data: data$1, loading, errors: userError, } = index_module.$n(data.USER_QUERY_NAMESPACE);
6194
- const _currencies = index_module.Fn(data.CURRENCIES_NAMESPACE);
6344
+ const context = index_module.Fn(usePayoutStatus.TAX_FORM_CONTEXT_NAMESPACE);
6345
+ const countries = index_module.Fn(usePayoutStatus.SORTED_COUNTRIES_NAMESPACE);
6346
+ const [step, setStep] = index_module.Pn(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
6347
+ const [userFormContext, setUserFormContext] = index_module.Pn(usePayoutStatus.USER_FORM_CONTEXT_NAMESPACE);
6348
+ const user = index_module.J();
6349
+ const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = index_module.$e(CONNECT_PARTNER);
6350
+ const { data, loading, refetch, errors: userError, } = index_module.$n(usePayoutStatus.USER_QUERY_NAMESPACE);
6351
+ const _currencies = index_module.Fn(usePayoutStatus.CURRENCIES_NAMESPACE);
6195
6352
  const currencies = domContextHooks_module.useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
6196
6353
  const [countrySearch, setCountrySearch] = domContextHooks_module.useState("");
6197
6354
  const [phoneCountrySearch, setPhoneCountrySearch] = domContextHooks_module.useState("");
@@ -6206,7 +6363,7 @@ function useUserInfoForm(props) {
6206
6363
  }, []);
6207
6364
  domContextHooks_module.useEffect(() => {
6208
6365
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
6209
- const user = data$1 === null || data$1 === void 0 ? void 0 : data$1.user;
6366
+ const user = data === null || data === void 0 ? void 0 : data.user;
6210
6367
  if (!user || step !== "/1")
6211
6368
  return;
6212
6369
  // If form already filled out, skip initialising it
@@ -6247,7 +6404,7 @@ function useUserInfoForm(props) {
6247
6404
  postalCode: (_k = user.customFields) === null || _k === void 0 ? void 0 : _k.postalCode,
6248
6405
  });
6249
6406
  }
6250
- }, [data$1, step, userFormContext]);
6407
+ }, [data, step, userFormContext]);
6251
6408
  const onFormChange = (field, e) => {
6252
6409
  var _a, _b;
6253
6410
  const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
@@ -6292,6 +6449,45 @@ function useUserInfoForm(props) {
6292
6449
  setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
6293
6450
  }
6294
6451
  }, [currencySearch, currencies]);
6452
+ async function connectPartner(formData) {
6453
+ var _a, _b, _c, _d, _e;
6454
+ const vars = {
6455
+ user: {
6456
+ id: user.id,
6457
+ accountId: user.accountId,
6458
+ },
6459
+ firstName: formData.firstName,
6460
+ lastName: formData.lastName,
6461
+ countryCode: formData.countryCode,
6462
+ currency: formData.currency,
6463
+ address: formData.address,
6464
+ city: formData.city,
6465
+ state: formData.state,
6466
+ postalCode: formData.postalCode,
6467
+ phoneNumber: formData.phoneNumber,
6468
+ phoneNumberCountryCode: formData.phoneNumberCountryCode,
6469
+ };
6470
+ const result = await connectImpactPartner({
6471
+ vars,
6472
+ });
6473
+ if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
6474
+ throw new Error();
6475
+ if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
6476
+ // Output backend errors to console for now
6477
+ console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
6478
+ throw new Error();
6479
+ }
6480
+ await refetch();
6481
+ const resultPublisher = (_e = (_d = (_c = result
6482
+ .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;
6483
+ const hasValidCurrentDocument = utils$1.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
6484
+ // Fire form change event
6485
+ window.dispatchEvent(new Event(usePayoutStatus.TAX_FORM_UPDATED_EVENT_KEY));
6486
+ return {
6487
+ resultPublisher,
6488
+ hasValidCurrentDocument,
6489
+ };
6490
+ }
6295
6491
  async function onSubmit(event) {
6296
6492
  let formControls = event.target.getFormControls();
6297
6493
  let formData = {};
@@ -6334,9 +6530,41 @@ function useUserInfoForm(props) {
6334
6530
  postalCode: userData.postalCode,
6335
6531
  currency: userData.currency,
6336
6532
  });
6337
- const nextStep = context.overrideNextStep || "/2";
6533
+ const skipNextStep = getSkipNextStep(userData);
6534
+ console.log({ skipNextStep });
6535
+ if (skipNextStep) {
6536
+ try {
6537
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
6538
+ if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
6539
+ !hasValidCurrentDocument) {
6540
+ // Go to docusign form
6541
+ setStep("/3");
6542
+ }
6543
+ else {
6544
+ if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
6545
+ // Go to banking information form
6546
+ setStep("/4");
6547
+ }
6548
+ else {
6549
+ // Go right to the dashboard
6550
+ setStep("/dashboard");
6551
+ }
6552
+ }
6553
+ return;
6554
+ }
6555
+ catch (e) {
6556
+ setErrors({ general: true });
6557
+ return;
6558
+ }
6559
+ }
6560
+ const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
6338
6561
  setStep(nextStep);
6339
6562
  }
6563
+ function getSkipNextStep(userData) {
6564
+ if (userData.countryCode === "US")
6565
+ return true;
6566
+ return true;
6567
+ }
6340
6568
  const hasStates = ["ES", "AU", "US", "CA"].includes(userFormContext.countryCode);
6341
6569
  const regionObj = hasStates
6342
6570
  ? IndirectTaxDetailsView.ADDRESS_REGIONS[userFormContext === null || userFormContext === void 0 ? void 0 : userFormContext.countryCode]
@@ -6364,16 +6592,17 @@ function useUserInfoForm(props) {
6364
6592
  allCountries: countries,
6365
6593
  regionLabelEnum: regionObj === null || regionObj === void 0 ? void 0 : regionObj.labelEnum,
6366
6594
  regions: (regionObj === null || regionObj === void 0 ? void 0 : regionObj.regions) || [],
6595
+ partnerData: (_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,
6367
6596
  },
6368
6597
  states: {
6369
6598
  step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
6370
6599
  hideState: !hasStates,
6371
6600
  hideSteps: !!context.hideSteps,
6372
- disabled: loading,
6601
+ disabled: loading || connectLoading,
6373
6602
  loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
6374
- loading: loading,
6375
- isPartner: !!((_b = (_a = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher),
6376
- isUser: !!((_d = (_c = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.user),
6603
+ loading: loading || connectLoading,
6604
+ isPartner: !!((_d = (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.publisher),
6605
+ isUser: !!((_f = (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.impactConnection) === null || _f === void 0 ? void 0 : _f.user),
6377
6606
  formState: {
6378
6607
  ...userFormContext,
6379
6608
  errors: formErrors,
@@ -6563,7 +6792,7 @@ const TaxForm = class {
6563
6792
  }
6564
6793
  };
6565
6794
  function useDemoUserInfoForm(props) {
6566
- const setStep = index_module.En(data.TAX_CONTEXT_NAMESPACE);
6795
+ const setStep = index_module.En(usePayoutStatus.TAX_CONTEXT_NAMESPACE);
6567
6796
  return cjs.cjs({
6568
6797
  setStep,
6569
6798
  onSubmit: async () => {