@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
@@ -1,4 +1,4 @@
1
- import { h, r as registerInstance, c as Host, g as getElement } from './index-b3a06de8.js';
1
+ import { h, r as registerInstance, c as Host, g as getElement, F as Fragment } from './index-b3a06de8.js';
2
2
  import { i as intl } from './global-1099f20d.js';
3
3
  import { m as useRef, k as useState, f as useEffect, n as h$1, u as useMemo, b as browser, j as useReducer } from './dom-context-hooks.module-63370afd.js';
4
4
  import { d as dist, _, L, J, t as Pn, F as Fn, x as $n, $ as $e, i as isDemo, p as En, u as useCallback, R as Rn, w as wn } from './index.module-c9811a48.js';
@@ -15,7 +15,7 @@ import { g as generateUserError } from './useReferralTable-909ccb28.js';
15
15
  import { a as INDIRECT_TAX_SPAIN_REGIONS, b as INDIRECT_TAX_PROVINCES, O as OtherRegionSlotView, I as InvoiceTableView, v as vatLabels, A as ADDRESS_REGIONS } from './IndirectTaxDetailsView-0a57b622.js';
16
16
  import { t as taxTypeToName, v as validTaxDocument, g as getCountryObj, L as LoadingView, f as formatErrorMessage, a as validateBillingField, o as objectIsFull } from './utils-6122971b.js';
17
17
  import { b as VERIFICATION_EVENT_KEY } from './keys-406491dc.js';
18
- import { i as FORM_STEPS, a as TAX_FORM_CONTEXT_NAMESPACE, S as SORTED_COUNTRIES_NAMESPACE, c as USER_QUERY_NAMESPACE, T as TAX_CONTEXT_NAMESPACE, F as FINANCE_NETWORK_SETTINGS_NAMESPACE, j as TAX_FORM_UPDATED_EVENT_KEY, U as USER_FORM_CONTEXT_NAMESPACE, d as COUNTRIES_QUERY_NAMESPACE, k as useVeriffApp, l as getStatus, V as VERIFF_COMPLETE_EVENT_KEY, C as CURRENCIES_NAMESPACE } from './data-acdb790f.js';
18
+ import { i as FORM_STEPS, a as TAX_FORM_CONTEXT_NAMESPACE, S as SORTED_COUNTRIES_NAMESPACE, c as USER_QUERY_NAMESPACE, T as TAX_CONTEXT_NAMESPACE, F as FINANCE_NETWORK_SETTINGS_NAMESPACE, j as TAX_FORM_UPDATED_EVENT_KEY, U as USER_FORM_CONTEXT_NAMESPACE, d as COUNTRIES_QUERY_NAMESPACE, k as useVeriffApp, l as getStatus, V as VERIFF_COMPLETE_EVENT_KEY, C as CURRENCIES_NAMESPACE } from './usePayoutStatus-f064247b.js';
19
19
 
20
20
  function getFormMap({ props, getValidationErrorMessage, bankCountry, }) {
21
21
  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;
@@ -2607,8 +2607,51 @@ function useIndirectTaxForm(props) {
2607
2607
  console.error("Could not detect select change");
2608
2608
  setFormState((p) => ({ ...p, [field]: value }));
2609
2609
  };
2610
- const onSubmit = async (event) => {
2610
+ async function connectPartner(formData) {
2611
2611
  var _a, _b, _c, _d, _e;
2612
+ const vars = {
2613
+ user: {
2614
+ id: user.id,
2615
+ accountId: user.accountId,
2616
+ },
2617
+ firstName: userForm.firstName,
2618
+ lastName: userForm.lastName,
2619
+ countryCode: userForm.countryCode,
2620
+ currency: userForm.currency,
2621
+ address: userForm.address,
2622
+ city: userForm.city,
2623
+ state: userForm.state,
2624
+ postalCode: userForm.postalCode,
2625
+ phoneNumber: userForm.phoneNumber,
2626
+ phoneNumberCountryCode: userForm.phoneNumberCountryCode,
2627
+ indirectTaxCountryCode: formData.selectedRegion,
2628
+ indirectTaxRegion: formData.province || formData.subRegion,
2629
+ indirectTaxId: formData.indirectTaxNumber,
2630
+ additionalTaxId: formData.qstNumber,
2631
+ withholdingTaxId: formData.subRegionTaxNumber,
2632
+ };
2633
+ const result = await connectImpactPartner({
2634
+ vars,
2635
+ });
2636
+ if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
2637
+ throw new Error();
2638
+ if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
2639
+ // Output backend errors to console for now
2640
+ console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
2641
+ throw new Error();
2642
+ }
2643
+ await refetch();
2644
+ const resultPublisher = (_e = (_d = (_c = result
2645
+ .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;
2646
+ const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
2647
+ // Fire form change event
2648
+ window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
2649
+ return {
2650
+ resultPublisher,
2651
+ hasValidCurrentDocument,
2652
+ };
2653
+ }
2654
+ const onSubmit = async (event) => {
2612
2655
  if (!option) {
2613
2656
  setErrors({ taxDetails: true });
2614
2657
  return;
@@ -2634,44 +2677,7 @@ function useIndirectTaxForm(props) {
2634
2677
  }
2635
2678
  setLoading(true);
2636
2679
  try {
2637
- const vars = {
2638
- user: {
2639
- id: user.id,
2640
- accountId: user.accountId,
2641
- },
2642
- firstName: userForm.firstName,
2643
- lastName: userForm.lastName,
2644
- countryCode: userForm.countryCode,
2645
- currency: userForm.currency,
2646
- address: userForm.address,
2647
- city: userForm.city,
2648
- state: userForm.state,
2649
- postalCode: userForm.postalCode,
2650
- phoneNumber: userForm.phoneNumber,
2651
- phoneNumberCountryCode: userForm.phoneNumberCountryCode,
2652
- indirectTaxCountryCode: formData.selectedRegion,
2653
- indirectTaxRegion: formData.province || formData.subRegion,
2654
- indirectTaxId: formData.indirectTaxNumber,
2655
- additionalTaxId: formData.qstNumber,
2656
- withholdingTaxId: formData.subRegionTaxNumber,
2657
- };
2658
- const result = await connectImpactPartner({
2659
- vars,
2660
- });
2661
- if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
2662
- throw new Error();
2663
- if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
2664
- // Output backend errors to console for now
2665
- console.error("Failed to create Impact connection: ", result.createImpactConnection
2666
- .validationErrors);
2667
- throw new Error();
2668
- }
2669
- await refetch();
2670
- const resultPublisher = (_e = (_d = (_c = result
2671
- .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;
2672
- const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
2673
- // Fire form change event
2674
- window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
2680
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
2675
2681
  if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
2676
2682
  !hasValidCurrentDocument) {
2677
2683
  // Go to docusign form
@@ -4024,7 +4030,7 @@ const TaxAndCashDashboardView = (props) => {
4024
4030
  icon: "exclamation-octagon",
4025
4031
  class: sheet$4.classes.ErrorHoldAlertContainer,
4026
4032
  };
4027
- case "ACCOUNT_REVIEW":
4033
+ case "NEW_PAYEE_REVIEW":
4028
4034
  return {
4029
4035
  header: text.accountReviewHeader,
4030
4036
  description: intl.formatMessage({
@@ -4038,6 +4044,96 @@ const TaxAndCashDashboardView = (props) => {
4038
4044
  icon: "exclamation-triangle",
4039
4045
  class: sheet$4.classes.WarningHoldAlertContainer,
4040
4046
  };
4047
+ case "PAYMENT_HOLD_ON_CHANGE":
4048
+ return {
4049
+ header: text.paymentHoldOnChangeHeader,
4050
+ description: intl.formatMessage({
4051
+ id: "accountReviewDescription",
4052
+ defaultMessage: text.paymentHoldOnChangeDescription,
4053
+ }, {
4054
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4055
+ }),
4056
+ buttonText: null,
4057
+ alertType: "warning",
4058
+ icon: "exclamation-triangle",
4059
+ class: sheet$4.classes.WarningHoldAlertContainer,
4060
+ };
4061
+ case "BENEFICIARY_NAME_INVALID":
4062
+ return {
4063
+ header: text.beneficiaryNameInvalidHeader,
4064
+ description: intl.formatMessage({
4065
+ id: "accountReviewDescription",
4066
+ defaultMessage: text.beneficiaryNameInvalidDescription,
4067
+ }, {
4068
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4069
+ }),
4070
+ button: (h(Fragment, null,
4071
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4072
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4073
+ alertType: "warning",
4074
+ icon: "exclamation-triangle",
4075
+ class: sheet$4.classes.WarningHoldAlertContainer,
4076
+ };
4077
+ case "BENEFICIARY_NAME_MISMATCH":
4078
+ return {
4079
+ header: text.beneficiaryNameMismatchHeader,
4080
+ description: intl.formatMessage({
4081
+ id: "accountReviewDescription",
4082
+ defaultMessage: text.beneficiaryNameMismatchDescription,
4083
+ }, {
4084
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4085
+ }),
4086
+ button: (h(Fragment, null,
4087
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4088
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4089
+ alertType: "warning",
4090
+ icon: "exclamation-triangle",
4091
+ class: sheet$4.classes.WarningHoldAlertContainer,
4092
+ };
4093
+ case "BANK_TAX_NAME_MISMATCH":
4094
+ return {
4095
+ header: text.bankTaxNameMismatchHeader,
4096
+ description: intl.formatMessage({
4097
+ id: "accountReviewDescription",
4098
+ defaultMessage: text.bankTaxNameMismatchDescription,
4099
+ }, {
4100
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4101
+ }),
4102
+ button: (h(Fragment, null,
4103
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4104
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4105
+ alertType: "warning",
4106
+ icon: "exclamation-triangle",
4107
+ class: sheet$4.classes.WarningHoldAlertContainer,
4108
+ };
4109
+ case "WITHDRAWAL_SETTINGS_INVALID":
4110
+ return {
4111
+ header: text.withdrawalSettingsInvalidHeader,
4112
+ description: intl.formatMessage({
4113
+ id: "accountReviewDescription",
4114
+ defaultMessage: text.withdrawalSettingsInvalidDescription,
4115
+ }, {
4116
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4117
+ }),
4118
+ button: (h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
4119
+ alertType: "warning",
4120
+ icon: "exclamation-triangle",
4121
+ class: sheet$4.classes.WarningHoldAlertContainer,
4122
+ };
4123
+ case "PAYMENT_RETURNED":
4124
+ return {
4125
+ header: text.paymentReturnedHeader,
4126
+ description: intl.formatMessage({
4127
+ id: "accountReviewDescription",
4128
+ defaultMessage: text.paymentReturnedDescription,
4129
+ }, {
4130
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4131
+ }),
4132
+ button: (h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
4133
+ alertType: "warning",
4134
+ icon: "exclamation-triangle",
4135
+ class: sheet$4.classes.WarningHoldAlertContainer,
4136
+ };
4041
4137
  case "HOLD":
4042
4138
  return {
4043
4139
  header: text.payoutHoldAlertHeader,
@@ -4608,6 +4704,54 @@ const TaxAndCashDashboard = class {
4608
4704
  * @uiName Account review alert description
4609
4705
  */
4610
4706
  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}.";
4707
+ /**
4708
+ * @uiName Payment hold on change alert header
4709
+ */
4710
+ this.paymentHoldOnChangeHeader = "We are reviewing your new payout settings";
4711
+ /**
4712
+ * @uiName Payment hold on change alert description
4713
+ */
4714
+ this.paymentHoldOnChangeDescription = "Your payout is temporarily on hold while we review your new payment information, this process is usually resolved within 48 hours.";
4715
+ /**
4716
+ * @uiName Beneficiary name invalid alert header
4717
+ */
4718
+ this.beneficiaryNameInvalidHeader = "Your payment information does not match your tax form";
4719
+ /**
4720
+ * @uiName Beneficiary name invalid description
4721
+ */
4722
+ 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.";
4723
+ /**
4724
+ * @uiName Beneficiary name mismatch alert header
4725
+ */
4726
+ this.beneficiaryNameMismatchHeader = "Your payment information does not match your tax form";
4727
+ /**
4728
+ * @uiName Beneficiary name mismatch alert description
4729
+ */
4730
+ 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.";
4731
+ /**
4732
+ * @uiName Bank name mismatch alert header
4733
+ */
4734
+ this.bankTaxNameMismatchHeader = "Your payment information does not match your tax form";
4735
+ /**
4736
+ * @uiName Bank name mismatch alert description
4737
+ */
4738
+ 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.";
4739
+ /**
4740
+ * @uiName Withdrawal settings invalid alert header
4741
+ */
4742
+ this.withdrawalSettingsInvalidHeader = "Your payment information includes invalid characters";
4743
+ /**
4744
+ * @uiName Withdrawal settings invalid alert description
4745
+ */
4746
+ 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.";
4747
+ /**
4748
+ * @uiName Payment returned alert header
4749
+ */
4750
+ this.paymentReturnedHeader = "Payout unsuccessful";
4751
+ /**
4752
+ * @uiName Payment returned alert description
4753
+ */
4754
+ this.paymentReturnedDescription = "Our recent payment attempt for your earnings was unsuccessful. Please review your payment information and make sure it is correct.";
4611
4755
  /**
4612
4756
  * @uiName Terms and Conditions text
4613
4757
  */
@@ -6026,6 +6170,12 @@ const UserInfoFormView = (props) => {
6026
6170
  default:
6027
6171
  regionLabel = text.state;
6028
6172
  }
6173
+ function isDisabledInput(field) {
6174
+ var _a;
6175
+ if (states.isPartner && !!((_a = data.partnerData) === null || _a === void 0 ? void 0 : _a[field]))
6176
+ return true;
6177
+ return false;
6178
+ }
6029
6179
  return (h("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit, ref: (el) => (refs.formRef.current = el), novalidate: true },
6030
6180
  h("style", { type: "text/css" },
6031
6181
  styleString$5,
@@ -6066,18 +6216,22 @@ const UserInfoFormView = (props) => {
6066
6216
  })))),
6067
6217
  h("div", null,
6068
6218
  h("div", { class: classes.InputContainer },
6069
- 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) ? {
6219
+ h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled ||
6220
+ states.isUser ||
6221
+ isDisabledInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
6070
6222
  class: classes.ErrorInput,
6071
6223
  helpText: formatErrorMessage(text.firstName, formState.errors.firstName),
6072
6224
  }
6073
6225
  : {}), { id: "firstName", name: "/firstName", required: true })),
6074
- 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) ? {
6226
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled ||
6227
+ states.isUser ||
6228
+ isDisabledInput("lastName") }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
6075
6229
  class: classes.ErrorInput,
6076
6230
  helpText: formatErrorMessage(text.lastName, formState.errors.lastName),
6077
6231
  }
6078
6232
  : {}), { id: "lastName", name: "/lastName", required: true })),
6079
6233
  h("sl-input", { exportparts: "label: input-label, base: input-base", value: formState.email, label: text.email, disabled: true, id: "email", name: "/email", required: true }),
6080
- 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) ? {
6234
+ 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) ? {
6081
6235
  class: classes.ErrorInput,
6082
6236
  helpText: formatErrorMessage(text.country, formState.errors.countryCode),
6083
6237
  }
@@ -6093,7 +6247,8 @@ const UserInfoFormView = (props) => {
6093
6247
  h("div", { class: classes.PhoneInputsSection },
6094
6248
  h("p", null, text.phoneNumber),
6095
6249
  h("div", { class: classes.PhoneInputsContainer },
6096
- 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) ? {
6250
+ h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled ||
6251
+ isDisabledInput("phoneNumberCountryCode"), ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
6097
6252
  class: classes.ErrorInput,
6098
6253
  }
6099
6254
  : {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
@@ -6119,7 +6274,7 @@ const UserInfoFormView = (props) => {
6119
6274
  // Naive phone number validation
6120
6275
  validateBillingField(/[a-zA-Z]+/, value) &&
6121
6276
  formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError);
6122
- }, disabled: states.disabled || states.isPartner }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
6277
+ }, disabled: states.disabled || isDisabledInput("phoneNumber") }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
6123
6278
  class: classes.ErrorInput,
6124
6279
  helpText: formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
6125
6280
  }
@@ -6127,7 +6282,7 @@ const UserInfoFormView = (props) => {
6127
6282
  h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.address, id: "address", name: "/address", value: formState.address, validationError: ({ value }) =>
6128
6283
  // Checks for non-ASCII characters
6129
6284
  !validateBillingField(/^[\x20-\xFF]+$/, value) &&
6130
- formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || states.isPartner }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
6285
+ formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("address") }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
6131
6286
  class: classes.ErrorInput,
6132
6287
  helpText: formatErrorMessage(text.address, formState.errors.address),
6133
6288
  }
@@ -6135,22 +6290,22 @@ const UserInfoFormView = (props) => {
6135
6290
  h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.city, id: "city", name: "/city", value: formState.city, validationError: ({ value }) =>
6136
6291
  // Checks for non-ASCII characters
6137
6292
  !validateBillingField(/^[\x20-\xFF]+$/, value) &&
6138
- formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || states.isPartner }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
6293
+ formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("city") }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
6139
6294
  class: classes.ErrorInput,
6140
6295
  helpText: formatErrorMessage(text.city, formState.errors.city),
6141
6296
  }
6142
6297
  : {}), { required: true })),
6143
- !states.hideState && (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) ? {
6298
+ !states.hideState && (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) ? {
6144
6299
  class: classes.ErrorInput,
6145
6300
  helpText: formatErrorMessage(text.state, formState.errors.state),
6146
6301
  }
6147
6302
  : {}), { required: true }), (_p = data.regions) === null || _p === void 0 ? void 0 : _p.map((r) => (h("sl-menu-item", { value: r.value }, r.label))))),
6148
- 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) ? {
6303
+ 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) ? {
6149
6304
  class: classes.ErrorInput,
6150
6305
  helpText: formatErrorMessage(text.postalCode, formState.errors.postalCode),
6151
6306
  }
6152
6307
  : {}), { required: true })),
6153
- 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) ? {
6308
+ 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) ? {
6154
6309
  class: classes.ErrorInput,
6155
6310
  helpText: formatErrorMessage(text.currency, formState.errors.currency),
6156
6311
  }
@@ -6172,13 +6327,13 @@ const UserInfoFormView = (props) => {
6172
6327
  h("div", { class: classes.CheckboxWrapper },
6173
6328
  h("sl-checkbox", { checked: formState.allowBankingCollection === true, "onSl-change": (e) => {
6174
6329
  e.target.value = e.target.checked;
6175
- }, disabled: states.isPartner ? false : states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
6330
+ }, disabled: states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
6176
6331
  ((_u = formState.errors) === null || _u === void 0 ? void 0 : _u.allowBankingCollection) && (h("p", { class: classes.ErrorText }, formatErrorMessage(text.termsAndConditionsLabel, formState.errors.allowBankingCollection))))),
6177
- h("sl-button", { type: "primary", disabled: states.isPartner ? false : states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
6332
+ h("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
6178
6333
  };
6179
6334
 
6180
6335
  function useUserInfoForm(props) {
6181
- var _a, _b, _c, _d;
6336
+ var _a, _b, _c, _d, _e, _f;
6182
6337
  const currencyRef = useRef(undefined);
6183
6338
  const phoneCountryRef = useRef(undefined);
6184
6339
  const formRef = useRef(null);
@@ -6186,7 +6341,9 @@ function useUserInfoForm(props) {
6186
6341
  const countries = Fn(SORTED_COUNTRIES_NAMESPACE);
6187
6342
  const [step, setStep] = Pn(TAX_CONTEXT_NAMESPACE);
6188
6343
  const [userFormContext, setUserFormContext] = Pn(USER_FORM_CONTEXT_NAMESPACE);
6189
- const { data, loading, errors: userError, } = $n(USER_QUERY_NAMESPACE);
6344
+ const user = J();
6345
+ const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = $e(CONNECT_PARTNER);
6346
+ const { data, loading, refetch, errors: userError, } = $n(USER_QUERY_NAMESPACE);
6190
6347
  const _currencies = Fn(CURRENCIES_NAMESPACE);
6191
6348
  const currencies = useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
6192
6349
  const [countrySearch, setCountrySearch] = useState("");
@@ -6288,6 +6445,45 @@ function useUserInfoForm(props) {
6288
6445
  setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
6289
6446
  }
6290
6447
  }, [currencySearch, currencies]);
6448
+ async function connectPartner(formData) {
6449
+ var _a, _b, _c, _d, _e;
6450
+ const vars = {
6451
+ user: {
6452
+ id: user.id,
6453
+ accountId: user.accountId,
6454
+ },
6455
+ firstName: formData.firstName,
6456
+ lastName: formData.lastName,
6457
+ countryCode: formData.countryCode,
6458
+ currency: formData.currency,
6459
+ address: formData.address,
6460
+ city: formData.city,
6461
+ state: formData.state,
6462
+ postalCode: formData.postalCode,
6463
+ phoneNumber: formData.phoneNumber,
6464
+ phoneNumberCountryCode: formData.phoneNumberCountryCode,
6465
+ };
6466
+ const result = await connectImpactPartner({
6467
+ vars,
6468
+ });
6469
+ if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
6470
+ throw new Error();
6471
+ if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
6472
+ // Output backend errors to console for now
6473
+ console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
6474
+ throw new Error();
6475
+ }
6476
+ await refetch();
6477
+ const resultPublisher = (_e = (_d = (_c = result
6478
+ .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;
6479
+ const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
6480
+ // Fire form change event
6481
+ window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
6482
+ return {
6483
+ resultPublisher,
6484
+ hasValidCurrentDocument,
6485
+ };
6486
+ }
6291
6487
  async function onSubmit(event) {
6292
6488
  let formControls = event.target.getFormControls();
6293
6489
  let formData = {};
@@ -6330,9 +6526,41 @@ function useUserInfoForm(props) {
6330
6526
  postalCode: userData.postalCode,
6331
6527
  currency: userData.currency,
6332
6528
  });
6333
- const nextStep = context.overrideNextStep || "/2";
6529
+ const skipNextStep = getSkipNextStep(userData);
6530
+ console.log({ skipNextStep });
6531
+ if (skipNextStep) {
6532
+ try {
6533
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
6534
+ if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
6535
+ !hasValidCurrentDocument) {
6536
+ // Go to docusign form
6537
+ setStep("/3");
6538
+ }
6539
+ else {
6540
+ if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
6541
+ // Go to banking information form
6542
+ setStep("/4");
6543
+ }
6544
+ else {
6545
+ // Go right to the dashboard
6546
+ setStep("/dashboard");
6547
+ }
6548
+ }
6549
+ return;
6550
+ }
6551
+ catch (e) {
6552
+ setErrors({ general: true });
6553
+ return;
6554
+ }
6555
+ }
6556
+ const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
6334
6557
  setStep(nextStep);
6335
6558
  }
6559
+ function getSkipNextStep(userData) {
6560
+ if (userData.countryCode === "US")
6561
+ return true;
6562
+ return true;
6563
+ }
6336
6564
  const hasStates = ["ES", "AU", "US", "CA"].includes(userFormContext.countryCode);
6337
6565
  const regionObj = hasStates
6338
6566
  ? ADDRESS_REGIONS[userFormContext === null || userFormContext === void 0 ? void 0 : userFormContext.countryCode]
@@ -6360,16 +6588,17 @@ function useUserInfoForm(props) {
6360
6588
  allCountries: countries,
6361
6589
  regionLabelEnum: regionObj === null || regionObj === void 0 ? void 0 : regionObj.labelEnum,
6362
6590
  regions: (regionObj === null || regionObj === void 0 ? void 0 : regionObj.regions) || [],
6591
+ 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,
6363
6592
  },
6364
6593
  states: {
6365
6594
  step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
6366
6595
  hideState: !hasStates,
6367
6596
  hideSteps: !!context.hideSteps,
6368
- disabled: loading,
6597
+ disabled: loading || connectLoading,
6369
6598
  loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
6370
- loading: loading,
6371
- isPartner: !!((_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),
6372
- isUser: !!((_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.user),
6599
+ loading: loading || connectLoading,
6600
+ 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),
6601
+ 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),
6373
6602
  formState: {
6374
6603
  ...userFormContext,
6375
6604
  errors: formErrors,