@saasquatch/mint-components 2.0.2-5 → 2.0.2-7

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 (182) hide show
  1. package/dist/cjs/{IndirectTaxDetailsView-20d5b4c5.js → IndirectTaxDetailsView-e5f70b8b.js} +2 -2
  2. package/dist/cjs/{ShadowViewAddon-21e729d3.js → ShadowViewAddon-925a8fa6.js} +8 -8
  3. package/dist/cjs/{global-560ac58f.js → global-8bba5b3a.js} +0 -4
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/mint-components.cjs.js +2 -2
  6. package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +346 -116
  7. package/dist/cjs/sqm-big-stat_47.cjs.entry.js +224 -29
  8. package/dist/cjs/sqm-code-verification.cjs.entry.js +1 -1
  9. package/dist/cjs/sqm-email-verification.cjs.entry.js +1 -1
  10. package/dist/cjs/sqm-empty_4.cjs.entry.js +1 -1
  11. package/dist/cjs/sqm-header-logo.cjs.entry.js +14 -1
  12. package/dist/cjs/{sqm-lead-checkbox-field-view-f7910206.js → sqm-lead-checkbox-field-view-340acad0.js} +1 -1
  13. package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +3 -3
  14. package/dist/cjs/{sqm-lead-input-field-view-4e2a0c1a.js → sqm-lead-input-field-view-06ed3632.js} +1 -1
  15. package/dist/cjs/sqm-lead-input-field.cjs.entry.js +3 -3
  16. package/dist/cjs/sqm-leaderboard-rank.cjs.entry.js +1 -1
  17. package/dist/cjs/sqm-pagination_3.cjs.entry.js +1 -1
  18. package/dist/cjs/{sqm-portal-email-verification-view-556c645c.js → sqm-portal-email-verification-view-5518eb0d.js} +1 -1
  19. package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +2 -2
  20. package/dist/cjs/{sqm-portal-profile-view-4a41c680.js → sqm-portal-profile-view-615e6975.js} +1 -1
  21. package/dist/cjs/sqm-portal-profile.cjs.entry.js +2 -2
  22. package/dist/cjs/sqm-referral-table_11.cjs.entry.js +1 -1
  23. package/dist/cjs/sqm-rewards-table_9.cjs.entry.js +1 -1
  24. package/dist/cjs/sqm-stencilbook.cjs.entry.js +9 -8
  25. package/dist/cjs/{useLeadFormState-b916bf5d.js → useLeadFormState-fd0445f9.js} +1 -1
  26. package/dist/cjs/{data-16106637.js → usePayoutStatus-95874989.js} +155 -129
  27. package/dist/cjs/{utils-f6c4eed4.js → utils-83d125fa.js} +1 -1
  28. package/dist/collection/components/sqm-header-logo/sqm-header-logo.js +80 -3
  29. package/dist/collection/components/sqm-portal-footer/sqm-portal-footer-view.js +3 -3
  30. package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js +4 -4
  31. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
  32. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +2 -1
  33. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +46 -40
  34. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +90 -2
  35. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +353 -0
  36. package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +30 -3
  37. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +301 -1
  38. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +92 -2
  39. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +302 -2
  40. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +25 -14
  41. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +1 -1
  42. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +92 -9
  43. package/dist/collection/global/styles.js +0 -4
  44. package/dist/collection/global/styles.ts +0 -4
  45. package/dist/esm/{IndirectTaxDetailsView-d1816a57.js → IndirectTaxDetailsView-0a57b622.js} +2 -2
  46. package/dist/esm/{ShadowViewAddon-5ecab399.js → ShadowViewAddon-aae27c2e.js} +8 -8
  47. package/dist/esm/{global-80e8f351.js → global-1099f20d.js} +0 -4
  48. package/dist/esm/loader.js +2 -2
  49. package/dist/esm/mint-components.js +2 -2
  50. package/dist/esm/sqm-banking-info-form_10.entry.js +298 -68
  51. package/dist/esm/sqm-big-stat_47.entry.js +202 -7
  52. package/dist/esm/sqm-code-verification.entry.js +1 -1
  53. package/dist/esm/sqm-email-verification.entry.js +1 -1
  54. package/dist/esm/sqm-empty_4.entry.js +1 -1
  55. package/dist/esm/sqm-header-logo.entry.js +14 -1
  56. package/dist/esm/{sqm-lead-checkbox-field-view-babfef96.js → sqm-lead-checkbox-field-view-cbafee07.js} +1 -1
  57. package/dist/esm/sqm-lead-checkbox-field.entry.js +3 -3
  58. package/dist/esm/{sqm-lead-input-field-view-5e9001b5.js → sqm-lead-input-field-view-f3775c28.js} +1 -1
  59. package/dist/esm/sqm-lead-input-field.entry.js +3 -3
  60. package/dist/esm/sqm-leaderboard-rank.entry.js +1 -1
  61. package/dist/esm/sqm-pagination_3.entry.js +1 -1
  62. package/dist/esm/{sqm-portal-email-verification-view-2e84bb34.js → sqm-portal-email-verification-view-7d86299c.js} +1 -1
  63. package/dist/esm/sqm-portal-email-verification.entry.js +2 -2
  64. package/dist/esm/{sqm-portal-profile-view-87621310.js → sqm-portal-profile-view-3ed13e4d.js} +1 -1
  65. package/dist/esm/sqm-portal-profile.entry.js +2 -2
  66. package/dist/esm/sqm-referral-table_11.entry.js +1 -1
  67. package/dist/esm/sqm-rewards-table_9.entry.js +1 -1
  68. package/dist/esm/sqm-stencilbook.entry.js +9 -8
  69. package/dist/esm/{useLeadFormState-53b556e3.js → useLeadFormState-c379e5d7.js} +1 -1
  70. package/dist/esm/{data-acdb790f.js → usePayoutStatus-c515b24b.js} +156 -130
  71. package/dist/esm/{utils-7e72d7ed.js → utils-6122971b.js} +1 -1
  72. package/dist/esm-es5/{IndirectTaxDetailsView-d1816a57.js → IndirectTaxDetailsView-0a57b622.js} +1 -1
  73. package/dist/esm-es5/{ShadowViewAddon-5ecab399.js → ShadowViewAddon-aae27c2e.js} +1 -1
  74. package/dist/esm-es5/{global-80e8f351.js → global-1099f20d.js} +1 -1
  75. package/dist/esm-es5/loader.js +1 -1
  76. package/dist/esm-es5/mint-components.js +1 -1
  77. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  78. package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
  79. package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
  80. package/dist/esm-es5/sqm-email-verification.entry.js +1 -1
  81. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  82. package/dist/esm-es5/sqm-header-logo.entry.js +1 -1
  83. package/dist/esm-es5/{sqm-lead-checkbox-field-view-babfef96.js → sqm-lead-checkbox-field-view-cbafee07.js} +1 -1
  84. package/dist/esm-es5/sqm-lead-checkbox-field.entry.js +1 -1
  85. package/dist/esm-es5/{sqm-lead-input-field-view-5e9001b5.js → sqm-lead-input-field-view-f3775c28.js} +1 -1
  86. package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -1
  87. package/dist/esm-es5/sqm-leaderboard-rank.entry.js +1 -1
  88. package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
  89. package/dist/esm-es5/{sqm-portal-email-verification-view-2e84bb34.js → sqm-portal-email-verification-view-7d86299c.js} +1 -1
  90. package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
  91. package/dist/esm-es5/{sqm-portal-profile-view-87621310.js → sqm-portal-profile-view-3ed13e4d.js} +1 -1
  92. package/dist/esm-es5/sqm-portal-profile.entry.js +1 -1
  93. package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
  94. package/dist/esm-es5/sqm-rewards-table_9.entry.js +1 -1
  95. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  96. package/dist/esm-es5/{useLeadFormState-53b556e3.js → useLeadFormState-c379e5d7.js} +1 -1
  97. package/dist/esm-es5/usePayoutStatus-c515b24b.js +6 -0
  98. package/dist/esm-es5/{utils-7e72d7ed.js → utils-6122971b.js} +1 -1
  99. package/dist/mint-components/global/styles.ts +0 -4
  100. package/dist/mint-components/mint-components.esm.js +1 -1
  101. package/dist/mint-components/mint-components.js +1 -1
  102. package/dist/mint-components/{p-51c8c4a3.js → p-00bc7211.js} +1 -1
  103. package/dist/mint-components/{p-4d5845ac.system.entry.js → p-0649123a.system.entry.js} +1 -1
  104. package/dist/mint-components/p-09ab53fb.system.entry.js +1 -0
  105. package/dist/mint-components/{p-2923b3b7.system.entry.js → p-14e813a7.system.entry.js} +1 -1
  106. package/dist/mint-components/{p-364e5ac9.system.entry.js → p-18720462.system.entry.js} +1 -1
  107. package/dist/mint-components/p-1c1ae908.system.js +6 -0
  108. package/dist/mint-components/{p-70a53a17.system.entry.js → p-22a9114f.system.entry.js} +1 -1
  109. package/dist/mint-components/p-37544d95.system.entry.js +1 -0
  110. package/dist/mint-components/{p-d5db98bf.system.js → p-38f932ae.system.js} +1 -1
  111. package/dist/mint-components/{p-84ec18aa.entry.js → p-47c83656.entry.js} +1 -1
  112. package/dist/mint-components/p-49da7b73.entry.js +273 -0
  113. package/dist/mint-components/{p-f5e9fa02.entry.js → p-4c811d12.entry.js} +2 -2
  114. package/dist/mint-components/{p-4f194ece.system.entry.js → p-4ce51b1c.system.entry.js} +1 -1
  115. package/dist/mint-components/{p-a6264af4.js → p-4fed8672.js} +1 -1
  116. package/dist/mint-components/{p-4deeebde.system.entry.js → p-511c87ce.system.entry.js} +1 -1
  117. package/dist/mint-components/{p-31d32dc8.system.entry.js → p-56009bf0.system.entry.js} +1 -1
  118. package/dist/mint-components/{p-6b287172.js → p-57ce33dd.js} +2 -2
  119. package/dist/mint-components/{p-70b14f52.entry.js → p-5d059c95.entry.js} +1 -1
  120. package/dist/mint-components/{p-9c235f83.entry.js → p-5f3eafd4.entry.js} +2 -2
  121. package/dist/mint-components/{p-9de8768b.system.js → p-60465a2d.system.js} +1 -1
  122. package/dist/mint-components/{p-190407f1.entry.js → p-60c14cec.entry.js} +1 -1
  123. package/dist/mint-components/{p-74bfa4d7.system.entry.js → p-6445e926.system.entry.js} +1 -1
  124. package/dist/mint-components/{p-6483aea3.entry.js → p-6c006998.entry.js} +2 -2
  125. package/dist/mint-components/{p-4765a7b5.js → p-6d5bd95a.js} +1 -1
  126. package/dist/mint-components/{p-6c3f484f.entry.js → p-6d9ce4e5.entry.js} +1 -1
  127. package/dist/mint-components/{p-ee5fd8d3.system.entry.js → p-717b6730.system.entry.js} +1 -1
  128. package/dist/mint-components/{p-9dc453c2.system.js → p-74f43a08.system.js} +1 -1
  129. package/dist/mint-components/{p-0605808e.js → p-79a3344f.js} +1 -1
  130. package/dist/mint-components/{p-d52d3dd7.js → p-7a268047.js} +1 -1
  131. package/dist/mint-components/{p-35dd7d31.entry.js → p-8b5b2acc.entry.js} +1 -1
  132. package/dist/mint-components/p-8b726fe1.system.entry.js +1 -0
  133. package/dist/mint-components/p-8b73f5bf.entry.js +99 -0
  134. package/dist/mint-components/p-967a9040.system.js +1 -0
  135. package/dist/mint-components/{p-36d4d879.entry.js → p-a217cc8d.entry.js} +1 -1
  136. package/dist/mint-components/{p-909fe833.entry.js → p-a5c63310.entry.js} +1 -1
  137. package/dist/mint-components/{p-c594cd6a.system.js → p-aa08457e.system.js} +1 -1
  138. package/dist/mint-components/{p-0d0cbf6a.js → p-aa8c6332.js} +1 -1
  139. package/dist/mint-components/p-ab111e29.entry.js +1 -0
  140. package/dist/mint-components/{p-5eff6672.system.js → p-ad4348c3.system.js} +1 -1
  141. package/dist/mint-components/{p-506f8db5.entry.js → p-aefaec37.entry.js} +1 -1
  142. package/dist/mint-components/{p-a9be3cea.system.entry.js → p-bec87ac9.system.entry.js} +1 -1
  143. package/dist/mint-components/{p-6653236d.system.js → p-c85f204b.system.js} +1 -1
  144. package/dist/mint-components/{p-65bc35d5.system.js → p-c994512c.system.js} +1 -1
  145. package/dist/mint-components/p-c9cceb05.js +157 -0
  146. package/dist/mint-components/{p-499c11c0.system.entry.js → p-d3120982.system.entry.js} +1 -1
  147. package/dist/mint-components/{p-3dfd91d9.js → p-db1a0db1.js} +1 -1
  148. package/dist/mint-components/{p-abad7828.system.js → p-e0a724dd.system.js} +1 -1
  149. package/dist/mint-components/{p-bffd1ff7.entry.js → p-ea0bc627.entry.js} +1 -1
  150. package/dist/mint-components/{p-21cb9d95.js → p-ed16b35a.js} +1 -1
  151. package/dist/mint-components/{p-8f07cca2.system.js → p-f0eae4e6.system.js} +1 -1
  152. package/dist/mint-components/{p-f092162f.system.entry.js → p-f401ef19.system.entry.js} +1 -1
  153. package/dist/types/components/sqm-header-logo/sqm-header-logo.d.ts +14 -1
  154. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +24 -0
  155. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +16 -0
  156. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +57 -0
  157. package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +3 -1
  158. package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +48 -0
  159. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +12 -0
  160. package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +48 -0
  161. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +2 -0
  162. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +1 -0
  163. package/dist/types/components.d.ts +331 -41
  164. package/dist/types/global/android.d.ts +7 -0
  165. package/dist/types/global/demo.d.ts +2 -0
  166. package/dist/types/stories/features.d.ts +4 -0
  167. package/dist/types/stories/templates.d.ts +4 -0
  168. package/docs/docs.docx +0 -0
  169. package/docs/raisins.json +1 -1
  170. package/grapesjs/grapesjs.js +1 -1
  171. package/package.json +1 -1
  172. package/dist/esm-es5/data-acdb790f.js +0 -6
  173. package/dist/mint-components/p-27bb4223.system.js +0 -1
  174. package/dist/mint-components/p-469a6450.system.js +0 -6
  175. package/dist/mint-components/p-914e5b02.entry.js +0 -99
  176. package/dist/mint-components/p-a7ee19dc.entry.js +0 -1
  177. package/dist/mint-components/p-db1e009d.system.entry.js +0 -1
  178. package/dist/mint-components/p-e1e7d01c.js +0 -157
  179. package/dist/mint-components/p-e8b74744.entry.js +0 -273
  180. package/dist/mint-components/p-ed5629ca.system.entry.js +0 -1
  181. package/dist/mint-components/p-eea87fdc.system.entry.js +0 -1
  182. package/shoelace/assets/icons/twitter-x.svg +0 -4
@@ -1,5 +1,5 @@
1
- import { h, r as registerInstance, c as Host, g as getElement } from './index-b3a06de8.js';
2
- import { i as intl } from './global-80e8f351.js';
1
+ import { h, r as registerInstance, c as Host, g as getElement, F as Fragment } from './index-b3a06de8.js';
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';
5
5
  import { j as jsonpointer } from './jsonpointer-388a7082.js';
@@ -12,10 +12,10 @@ import { u as useRerenderListener, a as useRequestRerender } from './re-render-7
12
12
  import { u as useChildElements } from './useChildElements-3d872cef.js';
13
13
  import { l as luxon } from './luxon-bbf75a9d.js';
14
14
  import { g as generateUserError } from './useReferralTable-909ccb28.js';
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-d1816a57.js';
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-7e72d7ed.js';
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
+ 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-c515b24b.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;
@@ -901,7 +901,8 @@ function useBankingInfoForm(props) {
901
901
  : _paymentMethodChecked;
902
902
  useEffect(() => {
903
903
  // reset redirect hash
904
- window.location.hash = "";
904
+ if (window.location.hash !== "#4")
905
+ window.location.hash = "";
905
906
  }, []);
906
907
  useEffect(() => {
907
908
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -2607,8 +2608,51 @@ function useIndirectTaxForm(props) {
2607
2608
  console.error("Could not detect select change");
2608
2609
  setFormState((p) => ({ ...p, [field]: value }));
2609
2610
  };
2610
- const onSubmit = async (event) => {
2611
+ async function connectPartner(formData) {
2611
2612
  var _a, _b, _c, _d, _e;
2613
+ const vars = {
2614
+ user: {
2615
+ id: user.id,
2616
+ accountId: user.accountId,
2617
+ },
2618
+ firstName: userForm.firstName,
2619
+ lastName: userForm.lastName,
2620
+ countryCode: userForm.countryCode,
2621
+ currency: userForm.currency,
2622
+ address: userForm.address,
2623
+ city: userForm.city,
2624
+ state: userForm.state,
2625
+ postalCode: userForm.postalCode,
2626
+ phoneNumber: userForm.phoneNumber,
2627
+ phoneNumberCountryCode: userForm.phoneNumberCountryCode,
2628
+ indirectTaxCountryCode: formData.selectedRegion,
2629
+ indirectTaxRegion: formData.province || formData.subRegion,
2630
+ indirectTaxId: formData.indirectTaxNumber,
2631
+ additionalTaxId: formData.qstNumber,
2632
+ withholdingTaxId: formData.subRegionTaxNumber,
2633
+ };
2634
+ const result = await connectImpactPartner({
2635
+ vars,
2636
+ });
2637
+ if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
2638
+ throw new Error();
2639
+ if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
2640
+ // Output backend errors to console for now
2641
+ console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
2642
+ throw new Error();
2643
+ }
2644
+ await refetch();
2645
+ const resultPublisher = (_e = (_d = (_c = result
2646
+ .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;
2647
+ const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
2648
+ // Fire form change event
2649
+ window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
2650
+ return {
2651
+ resultPublisher,
2652
+ hasValidCurrentDocument,
2653
+ };
2654
+ }
2655
+ const onSubmit = async (event) => {
2612
2656
  if (!option) {
2613
2657
  setErrors({ taxDetails: true });
2614
2658
  return;
@@ -2634,44 +2678,7 @@ function useIndirectTaxForm(props) {
2634
2678
  }
2635
2679
  setLoading(true);
2636
2680
  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));
2681
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
2675
2682
  if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
2676
2683
  !hasValidCurrentDocument) {
2677
2684
  // Go to docusign form
@@ -4024,7 +4031,7 @@ const TaxAndCashDashboardView = (props) => {
4024
4031
  icon: "exclamation-octagon",
4025
4032
  class: sheet$4.classes.ErrorHoldAlertContainer,
4026
4033
  };
4027
- case "ACCOUNT_REVIEW":
4034
+ case "NEW_PAYEE_REVIEW":
4028
4035
  return {
4029
4036
  header: text.accountReviewHeader,
4030
4037
  description: intl.formatMessage({
@@ -4038,6 +4045,96 @@ const TaxAndCashDashboardView = (props) => {
4038
4045
  icon: "exclamation-triangle",
4039
4046
  class: sheet$4.classes.WarningHoldAlertContainer,
4040
4047
  };
4048
+ case "PAYMENT_HOLD_ON_CHANGE":
4049
+ return {
4050
+ header: text.paymentHoldOnChangeHeader,
4051
+ description: intl.formatMessage({
4052
+ id: "accountReviewDescription",
4053
+ defaultMessage: text.paymentHoldOnChangeDescription,
4054
+ }, {
4055
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4056
+ }),
4057
+ buttonText: null,
4058
+ alertType: "warning",
4059
+ icon: "exclamation-triangle",
4060
+ class: sheet$4.classes.WarningHoldAlertContainer,
4061
+ };
4062
+ case "BENEFICIARY_NAME_INVALID":
4063
+ return {
4064
+ header: text.beneficiaryNameInvalidHeader,
4065
+ description: intl.formatMessage({
4066
+ id: "accountReviewDescription",
4067
+ defaultMessage: text.beneficiaryNameInvalidDescription,
4068
+ }, {
4069
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4070
+ }),
4071
+ button: (h(Fragment, null,
4072
+ h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4073
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4074
+ alertType: "warning",
4075
+ icon: "exclamation-triangle",
4076
+ class: sheet$4.classes.WarningHoldAlertContainer,
4077
+ };
4078
+ case "BENEFICIARY_NAME_MISMATCH":
4079
+ return {
4080
+ header: text.beneficiaryNameMismatchHeader,
4081
+ description: intl.formatMessage({
4082
+ id: "accountReviewDescription",
4083
+ defaultMessage: text.beneficiaryNameMismatchDescription,
4084
+ }, {
4085
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4086
+ }),
4087
+ button: (h(Fragment, null,
4088
+ h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4089
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4090
+ alertType: "warning",
4091
+ icon: "exclamation-triangle",
4092
+ class: sheet$4.classes.WarningHoldAlertContainer,
4093
+ };
4094
+ case "BANK_TAX_NAME_MISMATCH":
4095
+ return {
4096
+ header: text.bankTaxNameMismatchHeader,
4097
+ description: intl.formatMessage({
4098
+ id: "accountReviewDescription",
4099
+ defaultMessage: text.bankTaxNameMismatchDescription,
4100
+ }, {
4101
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4102
+ }),
4103
+ button: (h(Fragment, null,
4104
+ h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
4105
+ h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
4106
+ alertType: "warning",
4107
+ icon: "exclamation-triangle",
4108
+ class: sheet$4.classes.WarningHoldAlertContainer,
4109
+ };
4110
+ case "WITHDRAWAL_SETTINGS_INVALID":
4111
+ return {
4112
+ header: text.withdrawalSettingsInvalidHeader,
4113
+ description: intl.formatMessage({
4114
+ id: "accountReviewDescription",
4115
+ defaultMessage: text.withdrawalSettingsInvalidDescription,
4116
+ }, {
4117
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4118
+ }),
4119
+ button: (h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
4120
+ alertType: "warning",
4121
+ icon: "exclamation-triangle",
4122
+ class: sheet$4.classes.WarningHoldAlertContainer,
4123
+ };
4124
+ case "PAYMENT_RETURNED":
4125
+ return {
4126
+ header: text.paymentReturnedHeader,
4127
+ description: intl.formatMessage({
4128
+ id: "accountReviewDescription",
4129
+ defaultMessage: text.paymentReturnedDescription,
4130
+ }, {
4131
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
4132
+ }),
4133
+ button: (h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
4134
+ alertType: "error",
4135
+ icon: "exclamation-triangle",
4136
+ class: sheet$4.classes.WarningHoldAlertContainer,
4137
+ };
4041
4138
  case "HOLD":
4042
4139
  return {
4043
4140
  header: text.payoutHoldAlertHeader,
@@ -4505,7 +4602,7 @@ const TaxAndCashDashboard = class {
4505
4602
  *
4506
4603
  * @uiName Edit payment info button label
4507
4604
  */
4508
- this.editPaymentInformationButton = "Edit Payout Information";
4605
+ this.editPaymentInformationButton = "Edit payout information";
4509
4606
  /**
4510
4607
  * @uiName Not registered for indirect tax text
4511
4608
  * @uiWidget textArea
@@ -4608,6 +4705,54 @@ const TaxAndCashDashboard = class {
4608
4705
  * @uiName Account review alert description
4609
4706
  */
4610
4707
  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}.";
4708
+ /**
4709
+ * @uiName Payment hold on change alert header
4710
+ */
4711
+ this.paymentHoldOnChangeHeader = "We are reviewing your new payout settings";
4712
+ /**
4713
+ * @uiName Payment hold on change alert description
4714
+ */
4715
+ this.paymentHoldOnChangeDescription = "Your payout is temporarily on hold while we review your new payment information, this process is usually resolved within 48 hours.";
4716
+ /**
4717
+ * @uiName Beneficiary name invalid alert header
4718
+ */
4719
+ this.beneficiaryNameInvalidHeader = "Your payment information does not match your tax form";
4720
+ /**
4721
+ * @uiName Beneficiary name invalid description
4722
+ */
4723
+ 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.";
4724
+ /**
4725
+ * @uiName Beneficiary name mismatch alert header
4726
+ */
4727
+ this.beneficiaryNameMismatchHeader = "Your payment information does not match your tax form";
4728
+ /**
4729
+ * @uiName Beneficiary name mismatch alert description
4730
+ */
4731
+ 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.";
4732
+ /**
4733
+ * @uiName Bank name mismatch alert header
4734
+ */
4735
+ this.bankTaxNameMismatchHeader = "Your payment information does not match your tax form";
4736
+ /**
4737
+ * @uiName Bank name mismatch alert description
4738
+ */
4739
+ 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.";
4740
+ /**
4741
+ * @uiName Withdrawal settings invalid alert header
4742
+ */
4743
+ this.withdrawalSettingsInvalidHeader = "Your payment information includes invalid characters";
4744
+ /**
4745
+ * @uiName Withdrawal settings invalid alert description
4746
+ */
4747
+ 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.";
4748
+ /**
4749
+ * @uiName Payment returned alert header
4750
+ */
4751
+ this.paymentReturnedHeader = "Payout unsuccessful";
4752
+ /**
4753
+ * @uiName Payment returned alert description
4754
+ */
4755
+ this.paymentReturnedDescription = "Our recent payment attempt for your earnings was unsuccessful. Please review your payment information and make sure it is correct.";
4611
4756
  /**
4612
4757
  * @uiName Terms and Conditions text
4613
4758
  */
@@ -6026,6 +6171,12 @@ const UserInfoFormView = (props) => {
6026
6171
  default:
6027
6172
  regionLabel = text.state;
6028
6173
  }
6174
+ function isDisabledInput(field) {
6175
+ var _a;
6176
+ if (states.isPartner && !!((_a = data.partnerData) === null || _a === void 0 ? void 0 : _a[field]))
6177
+ return true;
6178
+ return false;
6179
+ }
6029
6180
  return (h("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit, ref: (el) => (refs.formRef.current = el), novalidate: true },
6030
6181
  h("style", { type: "text/css" },
6031
6182
  styleString$5,
@@ -6066,18 +6217,22 @@ const UserInfoFormView = (props) => {
6066
6217
  })))),
6067
6218
  h("div", null,
6068
6219
  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) ? {
6220
+ h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled ||
6221
+ states.isUser ||
6222
+ isDisabledInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
6070
6223
  class: classes.ErrorInput,
6071
6224
  helpText: formatErrorMessage(text.firstName, formState.errors.firstName),
6072
6225
  }
6073
6226
  : {}), { 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) ? {
6227
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled ||
6228
+ states.isUser ||
6229
+ isDisabledInput("lastName") }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
6075
6230
  class: classes.ErrorInput,
6076
6231
  helpText: formatErrorMessage(text.lastName, formState.errors.lastName),
6077
6232
  }
6078
6233
  : {}), { id: "lastName", name: "/lastName", required: true })),
6079
6234
  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) ? {
6235
+ 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
6236
  class: classes.ErrorInput,
6082
6237
  helpText: formatErrorMessage(text.country, formState.errors.countryCode),
6083
6238
  }
@@ -6088,12 +6243,13 @@ const UserInfoFormView = (props) => {
6088
6243
  }, "onSl-input": (e) => {
6089
6244
  callbacks.setCountrySearch(e.target.value);
6090
6245
  } }), (_e = data === null || data === void 0 ? void 0 : data.countries) === null || _e === void 0 ? void 0 :
6091
- _e.map((c) => (h("sl-menu-item", { value: c.countryCode, exportparts: "base: menu-item-base" }, c.displayName))), (_f = data === null || data === void 0 ? void 0 : data.allCountries) === null || _f === void 0 ? void 0 :
6092
- _f.map((c) => (h("sl-menu-item", { value: c.countryCode, style: { display: "none" }, exportparts: "base: menu-item-base" }, c.displayName)))),
6246
+ _e.map((c) => (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 :
6247
+ _f.map((c) => (h("sl-menu-item", { value: c.countryCode, style: { display: "none" } }, c.displayName)))),
6093
6248
  h("div", { class: classes.PhoneInputsSection },
6094
6249
  h("p", null, text.phoneNumber),
6095
6250
  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) ? {
6251
+ h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled ||
6252
+ isDisabledInput("phoneNumberCountryCode"), ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
6097
6253
  class: classes.ErrorInput,
6098
6254
  }
6099
6255
  : {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
@@ -6119,7 +6275,7 @@ const UserInfoFormView = (props) => {
6119
6275
  // Naive phone number validation
6120
6276
  validateBillingField(/[a-zA-Z]+/, value) &&
6121
6277
  formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError);
6122
- }, disabled: states.disabled || states.isPartner }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
6278
+ }, disabled: states.disabled || isDisabledInput("phoneNumber") }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
6123
6279
  class: classes.ErrorInput,
6124
6280
  helpText: formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
6125
6281
  }
@@ -6127,7 +6283,7 @@ const UserInfoFormView = (props) => {
6127
6283
  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
6284
  // Checks for non-ASCII characters
6129
6285
  !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) ? {
6286
+ formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("address") }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
6131
6287
  class: classes.ErrorInput,
6132
6288
  helpText: formatErrorMessage(text.address, formState.errors.address),
6133
6289
  }
@@ -6135,22 +6291,22 @@ const UserInfoFormView = (props) => {
6135
6291
  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
6292
  // Checks for non-ASCII characters
6137
6293
  !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) ? {
6294
+ formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("city") }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
6139
6295
  class: classes.ErrorInput,
6140
6296
  helpText: formatErrorMessage(text.city, formState.errors.city),
6141
6297
  }
6142
6298
  : {}), { 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) ? {
6299
+ !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
6300
  class: classes.ErrorInput,
6145
6301
  helpText: formatErrorMessage(text.state, formState.errors.state),
6146
6302
  }
6147
6303
  : {}), { 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) ? {
6304
+ 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
6305
  class: classes.ErrorInput,
6150
6306
  helpText: formatErrorMessage(text.postalCode, formState.errors.postalCode),
6151
6307
  }
6152
6308
  : {}), { 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) ? {
6309
+ 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
6310
  class: classes.ErrorInput,
6155
6311
  helpText: formatErrorMessage(text.currency, formState.errors.currency),
6156
6312
  }
@@ -6172,13 +6328,13 @@ const UserInfoFormView = (props) => {
6172
6328
  h("div", { class: classes.CheckboxWrapper },
6173
6329
  h("sl-checkbox", { checked: formState.allowBankingCollection === true, "onSl-change": (e) => {
6174
6330
  e.target.value = e.target.checked;
6175
- }, disabled: states.isPartner ? false : states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
6331
+ }, disabled: states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
6176
6332
  ((_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))))));
6333
+ h("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
6178
6334
  };
6179
6335
 
6180
6336
  function useUserInfoForm(props) {
6181
- var _a, _b, _c, _d;
6337
+ var _a, _b, _c, _d, _e, _f;
6182
6338
  const currencyRef = useRef(undefined);
6183
6339
  const phoneCountryRef = useRef(undefined);
6184
6340
  const formRef = useRef(null);
@@ -6186,7 +6342,9 @@ function useUserInfoForm(props) {
6186
6342
  const countries = Fn(SORTED_COUNTRIES_NAMESPACE);
6187
6343
  const [step, setStep] = Pn(TAX_CONTEXT_NAMESPACE);
6188
6344
  const [userFormContext, setUserFormContext] = Pn(USER_FORM_CONTEXT_NAMESPACE);
6189
- const { data, loading, errors: userError, } = $n(USER_QUERY_NAMESPACE);
6345
+ const user = J();
6346
+ const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = $e(CONNECT_PARTNER);
6347
+ const { data, loading, refetch, errors: userError, } = $n(USER_QUERY_NAMESPACE);
6190
6348
  const _currencies = Fn(CURRENCIES_NAMESPACE);
6191
6349
  const currencies = useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
6192
6350
  const [countrySearch, setCountrySearch] = useState("");
@@ -6288,6 +6446,45 @@ function useUserInfoForm(props) {
6288
6446
  setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
6289
6447
  }
6290
6448
  }, [currencySearch, currencies]);
6449
+ async function connectPartner(formData) {
6450
+ var _a, _b, _c, _d, _e;
6451
+ const vars = {
6452
+ user: {
6453
+ id: user.id,
6454
+ accountId: user.accountId,
6455
+ },
6456
+ firstName: formData.firstName,
6457
+ lastName: formData.lastName,
6458
+ countryCode: formData.countryCode,
6459
+ currency: formData.currency,
6460
+ address: formData.address,
6461
+ city: formData.city,
6462
+ state: formData.state,
6463
+ postalCode: formData.postalCode,
6464
+ phoneNumber: formData.phoneNumber,
6465
+ phoneNumberCountryCode: formData.phoneNumberCountryCode,
6466
+ };
6467
+ const result = await connectImpactPartner({
6468
+ vars,
6469
+ });
6470
+ if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
6471
+ throw new Error();
6472
+ if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
6473
+ // Output backend errors to console for now
6474
+ console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
6475
+ throw new Error();
6476
+ }
6477
+ await refetch();
6478
+ const resultPublisher = (_e = (_d = (_c = result
6479
+ .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;
6480
+ const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
6481
+ // Fire form change event
6482
+ window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
6483
+ return {
6484
+ resultPublisher,
6485
+ hasValidCurrentDocument,
6486
+ };
6487
+ }
6291
6488
  async function onSubmit(event) {
6292
6489
  let formControls = event.target.getFormControls();
6293
6490
  let formData = {};
@@ -6330,9 +6527,41 @@ function useUserInfoForm(props) {
6330
6527
  postalCode: userData.postalCode,
6331
6528
  currency: userData.currency,
6332
6529
  });
6333
- const nextStep = context.overrideNextStep || "/2";
6530
+ const skipNextStep = getSkipNextStep(userData);
6531
+ console.log({ skipNextStep });
6532
+ if (skipNextStep) {
6533
+ try {
6534
+ const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
6535
+ if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
6536
+ !hasValidCurrentDocument) {
6537
+ // Go to docusign form
6538
+ setStep("/3");
6539
+ }
6540
+ else {
6541
+ if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
6542
+ // Go to banking information form
6543
+ setStep("/4");
6544
+ }
6545
+ else {
6546
+ // Go right to the dashboard
6547
+ setStep("/dashboard");
6548
+ }
6549
+ }
6550
+ return;
6551
+ }
6552
+ catch (e) {
6553
+ setErrors({ general: true });
6554
+ return;
6555
+ }
6556
+ }
6557
+ const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
6334
6558
  setStep(nextStep);
6335
6559
  }
6560
+ function getSkipNextStep(userData) {
6561
+ if (userData.countryCode === "US")
6562
+ return true;
6563
+ return true;
6564
+ }
6336
6565
  const hasStates = ["ES", "AU", "US", "CA"].includes(userFormContext.countryCode);
6337
6566
  const regionObj = hasStates
6338
6567
  ? ADDRESS_REGIONS[userFormContext === null || userFormContext === void 0 ? void 0 : userFormContext.countryCode]
@@ -6360,16 +6589,17 @@ function useUserInfoForm(props) {
6360
6589
  allCountries: countries,
6361
6590
  regionLabelEnum: regionObj === null || regionObj === void 0 ? void 0 : regionObj.labelEnum,
6362
6591
  regions: (regionObj === null || regionObj === void 0 ? void 0 : regionObj.regions) || [],
6592
+ 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
6593
  },
6364
6594
  states: {
6365
6595
  step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
6366
6596
  hideState: !hasStates,
6367
6597
  hideSteps: !!context.hideSteps,
6368
- disabled: loading,
6598
+ disabled: loading || connectLoading,
6369
6599
  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),
6600
+ loading: loading || connectLoading,
6601
+ 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),
6602
+ 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
6603
  formState: {
6374
6604
  ...userFormContext,
6375
6605
  errors: formErrors,