@saasquatch/mint-components 2.0.2 → 2.0.3-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ShadowViewAddon-fbc33c53.js → ShadowViewAddon-ae3a32c3.js} +3 -3
- package/dist/cjs/{data-16106637.js → data-44260010.js} +29 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +341 -76
- package/dist/cjs/sqm-big-stat_47.cjs.entry.js +213 -12
- package/dist/cjs/sqm-header-logo.cjs.entry.js +15 -2
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +24 -3
- package/dist/collection/components/sqm-header-logo/sqm-header-logo.js +85 -5
- package/dist/collection/components/sqm-portal-footer/sqm-portal-footer-view.js +3 -3
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -0
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +10 -5
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/useDocusignForm.js +11 -5
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +46 -40
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.js +13 -0
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +95 -1
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +360 -7
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +29 -2
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +311 -11
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +96 -1
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +310 -10
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +7 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +23 -12
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +100 -9
- package/dist/esm/{ShadowViewAddon-7a242b65.js → ShadowViewAddon-78a1c35c.js} +3 -3
- package/dist/esm/{data-acdb790f.js → data-68816061.js} +29 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_10.entry.js +341 -76
- package/dist/esm/sqm-big-stat_47.entry.js +213 -12
- package/dist/esm/sqm-header-logo.entry.js +15 -2
- package/dist/esm/sqm-stencilbook.entry.js +24 -3
- package/dist/esm-es5/{ShadowViewAddon-7a242b65.js → ShadowViewAddon-78a1c35c.js} +1 -1
- package/dist/esm-es5/{data-acdb790f.js → data-68816061.js} +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
- package/dist/esm-es5/sqm-header-logo.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-18790f90.entry.js +106 -0
- package/dist/mint-components/p-38a100b4.system.entry.js +1 -0
- package/dist/mint-components/p-3f661133.system.entry.js +1 -0
- package/dist/mint-components/p-775214ef.entry.js +273 -0
- package/dist/mint-components/p-7e550c3b.system.entry.js +1 -0
- package/dist/mint-components/p-92b5c376.js +157 -0
- package/dist/mint-components/p-947bacd1.system.js +1 -1
- package/dist/mint-components/p-9a3ff9b9.entry.js +9 -0
- package/dist/mint-components/p-a2dbc9ad.system.js +6 -0
- package/dist/mint-components/p-bdb6194c.entry.js +1 -0
- package/dist/mint-components/p-c7ac295d.system.entry.js +1 -0
- package/dist/mint-components/{p-d7635535.system.js → p-e3ee8c37.system.js} +1 -1
- package/dist/mint-components/{p-ffc3cd7c.js → p-ee83de0e.js} +1 -1
- package/dist/types/components/sqm-header-logo/sqm-header-logo.d.ts +17 -2
- package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +24 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.d.ts +7 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +16 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +57 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +3 -1
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +48 -0
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +12 -0
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +48 -0
- package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +2 -0
- package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +1 -0
- package/dist/types/components.d.ts +335 -3
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/mint-components/p-012d31bc.entry.js +0 -99
- package/dist/mint-components/p-2ea6e2fa.entry.js +0 -273
- package/dist/mint-components/p-303b84d7.system.entry.js +0 -1
- package/dist/mint-components/p-469a6450.system.js +0 -6
- package/dist/mint-components/p-6976099f.entry.js +0 -9
- package/dist/mint-components/p-752ede25.system.entry.js +0 -1
- package/dist/mint-components/p-97747228.system.entry.js +0 -1
- package/dist/mint-components/p-a7ee19dc.entry.js +0 -1
- package/dist/mint-components/p-e1e7d01c.js +0 -157
- package/dist/mint-components/p-eea87fdc.system.entry.js +0 -1
- package/shoelace/assets/icons/twitter-x.svg +0 -4
|
@@ -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-8dec05e4.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-2695a43e.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-
|
|
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-68816061.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;
|
|
@@ -899,10 +899,6 @@ function useBankingInfoForm(props) {
|
|
|
899
899
|
const paymentMethodChecked = !hasPayPal
|
|
900
900
|
? "toBankAccount"
|
|
901
901
|
: _paymentMethodChecked;
|
|
902
|
-
useEffect(() => {
|
|
903
|
-
// reset redirect hash
|
|
904
|
-
window.location.hash = "";
|
|
905
|
-
}, []);
|
|
906
902
|
useEffect(() => {
|
|
907
903
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
908
904
|
if (!userData)
|
|
@@ -1074,6 +1070,7 @@ function useBankingInfoForm(props) {
|
|
|
1074
1070
|
}
|
|
1075
1071
|
await runMutation(formData, token);
|
|
1076
1072
|
setShowModal(false);
|
|
1073
|
+
window.location.hash = "";
|
|
1077
1074
|
};
|
|
1078
1075
|
const onVerification = async (token) => {
|
|
1079
1076
|
host.dispatchEvent(new CustomEvent(VERIFICATION_EVENT_KEY, {
|
|
@@ -1103,7 +1100,15 @@ function useBankingInfoForm(props) {
|
|
|
1103
1100
|
setBankCountry: updateBankCountry,
|
|
1104
1101
|
setPaymentMethodChecked,
|
|
1105
1102
|
setPaymentScheduleChecked,
|
|
1106
|
-
onBack: () =>
|
|
1103
|
+
onBack: () => {
|
|
1104
|
+
// return to dashboard
|
|
1105
|
+
if (window.location.hash) {
|
|
1106
|
+
window.location.hash = "";
|
|
1107
|
+
}
|
|
1108
|
+
else {
|
|
1109
|
+
setStep("/dashboard");
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1107
1112
|
setCountrySearch,
|
|
1108
1113
|
onVerification,
|
|
1109
1114
|
onVerificationHide: () => onVerification(null),
|
|
@@ -1776,11 +1781,17 @@ function useDocusignForm(props) {
|
|
|
1776
1781
|
}
|
|
1777
1782
|
};
|
|
1778
1783
|
const progressStep = () => {
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
+
// return to dashboard
|
|
1785
|
+
if (window.location.hash) {
|
|
1786
|
+
window.location.hash = "";
|
|
1787
|
+
}
|
|
1788
|
+
else {
|
|
1789
|
+
setStep(context.overrideNextStep ||
|
|
1790
|
+
!!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
|
|
1791
|
+
!(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
|
|
1792
|
+
? "/dashboard"
|
|
1793
|
+
: "/4");
|
|
1794
|
+
}
|
|
1784
1795
|
};
|
|
1785
1796
|
const allLoading = userLoading || documentLoading || loading;
|
|
1786
1797
|
return {
|
|
@@ -2607,8 +2618,51 @@ function useIndirectTaxForm(props) {
|
|
|
2607
2618
|
console.error("Could not detect select change");
|
|
2608
2619
|
setFormState((p) => ({ ...p, [field]: value }));
|
|
2609
2620
|
};
|
|
2610
|
-
|
|
2621
|
+
async function connectPartner(formData) {
|
|
2611
2622
|
var _a, _b, _c, _d, _e;
|
|
2623
|
+
const vars = {
|
|
2624
|
+
user: {
|
|
2625
|
+
id: user.id,
|
|
2626
|
+
accountId: user.accountId,
|
|
2627
|
+
},
|
|
2628
|
+
firstName: userForm.firstName,
|
|
2629
|
+
lastName: userForm.lastName,
|
|
2630
|
+
countryCode: userForm.countryCode,
|
|
2631
|
+
currency: userForm.currency,
|
|
2632
|
+
address: userForm.address,
|
|
2633
|
+
city: userForm.city,
|
|
2634
|
+
state: userForm.state,
|
|
2635
|
+
postalCode: userForm.postalCode,
|
|
2636
|
+
phoneNumber: userForm.phoneNumber,
|
|
2637
|
+
phoneNumberCountryCode: userForm.phoneNumberCountryCode,
|
|
2638
|
+
indirectTaxCountryCode: formData.selectedRegion,
|
|
2639
|
+
indirectTaxRegion: formData.province || formData.subRegion,
|
|
2640
|
+
indirectTaxId: formData.indirectTaxNumber,
|
|
2641
|
+
additionalTaxId: formData.qstNumber,
|
|
2642
|
+
withholdingTaxId: formData.subRegionTaxNumber,
|
|
2643
|
+
};
|
|
2644
|
+
const result = await connectImpactPartner({
|
|
2645
|
+
vars,
|
|
2646
|
+
});
|
|
2647
|
+
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
2648
|
+
throw new Error();
|
|
2649
|
+
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
2650
|
+
// Output backend errors to console for now
|
|
2651
|
+
console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
|
|
2652
|
+
throw new Error();
|
|
2653
|
+
}
|
|
2654
|
+
await refetch();
|
|
2655
|
+
const resultPublisher = (_e = (_d = (_c = result
|
|
2656
|
+
.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;
|
|
2657
|
+
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
2658
|
+
// Fire form change event
|
|
2659
|
+
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
2660
|
+
return {
|
|
2661
|
+
resultPublisher,
|
|
2662
|
+
hasValidCurrentDocument,
|
|
2663
|
+
};
|
|
2664
|
+
}
|
|
2665
|
+
const onSubmit = async (event) => {
|
|
2612
2666
|
if (!option) {
|
|
2613
2667
|
setErrors({ taxDetails: true });
|
|
2614
2668
|
return;
|
|
@@ -2634,44 +2688,7 @@ function useIndirectTaxForm(props) {
|
|
|
2634
2688
|
}
|
|
2635
2689
|
setLoading(true);
|
|
2636
2690
|
try {
|
|
2637
|
-
const
|
|
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));
|
|
2691
|
+
const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
|
|
2675
2692
|
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
2676
2693
|
!hasValidCurrentDocument) {
|
|
2677
2694
|
// Go to docusign form
|
|
@@ -3912,6 +3929,11 @@ const style$5 = {
|
|
|
3912
3929
|
SubduedText: {
|
|
3913
3930
|
color: "var(--sqm-text-subdued)",
|
|
3914
3931
|
},
|
|
3932
|
+
ButtonContainer: {
|
|
3933
|
+
display: "flex",
|
|
3934
|
+
gap: "var(--sl-spacing-medium)",
|
|
3935
|
+
flexWrap: "wrap",
|
|
3936
|
+
},
|
|
3915
3937
|
};
|
|
3916
3938
|
const sheet$4 = createStyleSheet(style$5);
|
|
3917
3939
|
const styleString$4 = sheet$4.toString();
|
|
@@ -4024,7 +4046,7 @@ const TaxAndCashDashboardView = (props) => {
|
|
|
4024
4046
|
icon: "exclamation-octagon",
|
|
4025
4047
|
class: sheet$4.classes.ErrorHoldAlertContainer,
|
|
4026
4048
|
};
|
|
4027
|
-
case "
|
|
4049
|
+
case "NEW_PAYEE_REVIEW":
|
|
4028
4050
|
return {
|
|
4029
4051
|
header: text.accountReviewHeader,
|
|
4030
4052
|
description: intl.formatMessage({
|
|
@@ -4038,6 +4060,96 @@ const TaxAndCashDashboardView = (props) => {
|
|
|
4038
4060
|
icon: "exclamation-triangle",
|
|
4039
4061
|
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4040
4062
|
};
|
|
4063
|
+
case "PAYMENT_HOLD_ON_CHANGE":
|
|
4064
|
+
return {
|
|
4065
|
+
header: text.paymentHoldOnChangeHeader,
|
|
4066
|
+
description: intl.formatMessage({
|
|
4067
|
+
id: "accountReviewDescription",
|
|
4068
|
+
defaultMessage: text.paymentHoldOnChangeDescription,
|
|
4069
|
+
}, {
|
|
4070
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4071
|
+
}),
|
|
4072
|
+
buttonText: null,
|
|
4073
|
+
alertType: "warning",
|
|
4074
|
+
icon: "exclamation-triangle",
|
|
4075
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4076
|
+
};
|
|
4077
|
+
case "BENEFICIARY_NAME_INVALID":
|
|
4078
|
+
return {
|
|
4079
|
+
header: text.beneficiaryNameInvalidHeader,
|
|
4080
|
+
description: intl.formatMessage({
|
|
4081
|
+
id: "accountReviewDescription",
|
|
4082
|
+
defaultMessage: text.beneficiaryNameInvalidDescription,
|
|
4083
|
+
}, {
|
|
4084
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4085
|
+
}),
|
|
4086
|
+
button: (h("div", { class: sheet$4.classes.ButtonContainer },
|
|
4087
|
+
h("sl-button", { disabled: states.disabled || states.loading, type: "primary", 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 "BENEFICIARY_NAME_MISMATCH":
|
|
4094
|
+
return {
|
|
4095
|
+
header: text.beneficiaryNameMismatchHeader,
|
|
4096
|
+
description: intl.formatMessage({
|
|
4097
|
+
id: "accountReviewDescription",
|
|
4098
|
+
defaultMessage: text.beneficiaryNameMismatchDescription,
|
|
4099
|
+
}, {
|
|
4100
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4101
|
+
}),
|
|
4102
|
+
button: (h("div", { class: sheet$4.classes.ButtonContainer },
|
|
4103
|
+
h("sl-button", { disabled: states.disabled || states.loading, type: "primary", 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 "BANK_TAX_NAME_MISMATCH":
|
|
4110
|
+
return {
|
|
4111
|
+
header: text.bankTaxNameMismatchHeader,
|
|
4112
|
+
description: intl.formatMessage({
|
|
4113
|
+
id: "accountReviewDescription",
|
|
4114
|
+
defaultMessage: text.bankTaxNameMismatchDescription,
|
|
4115
|
+
}, {
|
|
4116
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4117
|
+
}),
|
|
4118
|
+
button: (h("div", { class: sheet$4.classes.ButtonContainer },
|
|
4119
|
+
h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
|
|
4120
|
+
h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
|
|
4121
|
+
alertType: "warning",
|
|
4122
|
+
icon: "exclamation-triangle",
|
|
4123
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4124
|
+
};
|
|
4125
|
+
case "WITHDRAWAL_SETTINGS_INVALID":
|
|
4126
|
+
return {
|
|
4127
|
+
header: text.withdrawalSettingsInvalidHeader,
|
|
4128
|
+
description: intl.formatMessage({
|
|
4129
|
+
id: "accountReviewDescription",
|
|
4130
|
+
defaultMessage: text.withdrawalSettingsInvalidDescription,
|
|
4131
|
+
}, {
|
|
4132
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4133
|
+
}),
|
|
4134
|
+
button: (h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
|
|
4135
|
+
alertType: "warning",
|
|
4136
|
+
icon: "exclamation-triangle",
|
|
4137
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4138
|
+
};
|
|
4139
|
+
case "PAYMENT_RETURNED":
|
|
4140
|
+
return {
|
|
4141
|
+
header: text.paymentReturnedHeader,
|
|
4142
|
+
description: intl.formatMessage({
|
|
4143
|
+
id: "accountReviewDescription",
|
|
4144
|
+
defaultMessage: text.paymentReturnedDescription,
|
|
4145
|
+
}, {
|
|
4146
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4147
|
+
}),
|
|
4148
|
+
button: (h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
|
|
4149
|
+
alertType: "error",
|
|
4150
|
+
icon: "exclamation-triangle",
|
|
4151
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4152
|
+
};
|
|
4041
4153
|
case "HOLD":
|
|
4042
4154
|
return {
|
|
4043
4155
|
header: text.payoutHoldAlertHeader,
|
|
@@ -4294,8 +4406,14 @@ const useTaxAndCashDashboard = (props) => {
|
|
|
4294
4406
|
useEffect(() => {
|
|
4295
4407
|
// Clear override context once on submitted
|
|
4296
4408
|
setContext({});
|
|
4297
|
-
if (window.location.hash)
|
|
4409
|
+
if (window.location.hash) {
|
|
4410
|
+
setContext({
|
|
4411
|
+
overrideNextStep: "/dashboard",
|
|
4412
|
+
overrideBackStep: "/dashboard",
|
|
4413
|
+
hideSteps: true,
|
|
4414
|
+
});
|
|
4298
4415
|
setStep(`/${window.location.hash.replace("#", "")}`);
|
|
4416
|
+
}
|
|
4299
4417
|
}, []);
|
|
4300
4418
|
const { data, loading, errors: userError, refetch, } = $n(USER_QUERY_NAMESPACE);
|
|
4301
4419
|
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;
|
|
@@ -4500,12 +4618,12 @@ const TaxAndCashDashboard = class {
|
|
|
4500
4618
|
/**
|
|
4501
4619
|
* @uiName Submit new tax form button label
|
|
4502
4620
|
*/
|
|
4503
|
-
this.newFormButton = "Submit new form";
|
|
4621
|
+
this.newFormButton = "Submit new tax form";
|
|
4504
4622
|
/**
|
|
4505
4623
|
*
|
|
4506
4624
|
* @uiName Edit payment info button label
|
|
4507
4625
|
*/
|
|
4508
|
-
this.editPaymentInformationButton = "Edit
|
|
4626
|
+
this.editPaymentInformationButton = "Edit payout information";
|
|
4509
4627
|
/**
|
|
4510
4628
|
* @uiName Not registered for indirect tax text
|
|
4511
4629
|
* @uiWidget textArea
|
|
@@ -4566,7 +4684,7 @@ const TaxAndCashDashboard = class {
|
|
|
4566
4684
|
/**
|
|
4567
4685
|
* @uiName Verification required internal alert header
|
|
4568
4686
|
*/
|
|
4569
|
-
this.verificationRequiredInternalHeader = "Identity
|
|
4687
|
+
this.verificationRequiredInternalHeader = "Identity verification in progress";
|
|
4570
4688
|
/**
|
|
4571
4689
|
* @uiName Verification required internal alert description
|
|
4572
4690
|
*/
|
|
@@ -4574,7 +4692,7 @@ const TaxAndCashDashboard = class {
|
|
|
4574
4692
|
/**
|
|
4575
4693
|
* @uiName Verification review internal alert header
|
|
4576
4694
|
*/
|
|
4577
|
-
this.verificationReviewInternalHeader = "Identity
|
|
4695
|
+
this.verificationReviewInternalHeader = "Identity verification under review";
|
|
4578
4696
|
/**
|
|
4579
4697
|
* @uiName Verification review internal alert description
|
|
4580
4698
|
*/
|
|
@@ -4582,7 +4700,7 @@ const TaxAndCashDashboard = class {
|
|
|
4582
4700
|
/**
|
|
4583
4701
|
* @uiName Verification failed internal alert header
|
|
4584
4702
|
*/
|
|
4585
|
-
this.verificationFailedInternalHeader = "Identity
|
|
4703
|
+
this.verificationFailedInternalHeader = "Identity verification unsuccessful";
|
|
4586
4704
|
/**
|
|
4587
4705
|
* @uiName Verification failed internal alert description
|
|
4588
4706
|
*/
|
|
@@ -4608,6 +4726,54 @@ const TaxAndCashDashboard = class {
|
|
|
4608
4726
|
* @uiName Account review alert description
|
|
4609
4727
|
*/
|
|
4610
4728
|
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}.";
|
|
4729
|
+
/**
|
|
4730
|
+
* @uiName Payment hold on change alert header
|
|
4731
|
+
*/
|
|
4732
|
+
this.paymentHoldOnChangeHeader = "We are reviewing your new payout settings";
|
|
4733
|
+
/**
|
|
4734
|
+
* @uiName Payment hold on change alert description
|
|
4735
|
+
*/
|
|
4736
|
+
this.paymentHoldOnChangeDescription = "Your payout is temporarily on hold while we review your new payment information, this process is usually resolved within 48 hours.";
|
|
4737
|
+
/**
|
|
4738
|
+
* @uiName Beneficiary name invalid alert header
|
|
4739
|
+
*/
|
|
4740
|
+
this.beneficiaryNameInvalidHeader = "Your payment information does not match your tax form";
|
|
4741
|
+
/**
|
|
4742
|
+
* @uiName Beneficiary name invalid description
|
|
4743
|
+
*/
|
|
4744
|
+
this.beneficiaryNameInvalidDescription = "The account holder (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.";
|
|
4745
|
+
/**
|
|
4746
|
+
* @uiName Beneficiary name mismatch alert header
|
|
4747
|
+
*/
|
|
4748
|
+
this.beneficiaryNameMismatchHeader = "Your payment information does not match your tax form";
|
|
4749
|
+
/**
|
|
4750
|
+
* @uiName Beneficiary name mismatch alert description
|
|
4751
|
+
*/
|
|
4752
|
+
this.beneficiaryNameMismatchDescription = "The account holder (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.";
|
|
4753
|
+
/**
|
|
4754
|
+
* @uiName Bank name mismatch alert header
|
|
4755
|
+
*/
|
|
4756
|
+
this.bankTaxNameMismatchHeader = "Your payment information does not match your tax form";
|
|
4757
|
+
/**
|
|
4758
|
+
* @uiName Bank name mismatch alert description
|
|
4759
|
+
*/
|
|
4760
|
+
this.bankTaxNameMismatchDescription = "The bank account (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.";
|
|
4761
|
+
/**
|
|
4762
|
+
* @uiName Withdrawal settings invalid alert header
|
|
4763
|
+
*/
|
|
4764
|
+
this.withdrawalSettingsInvalidHeader = "Your payment information is incomplete or includes invalid characters";
|
|
4765
|
+
/**
|
|
4766
|
+
* @uiName Withdrawal settings invalid alert description
|
|
4767
|
+
*/
|
|
4768
|
+
this.withdrawalSettingsInvalidDescription = "There are missing fields or invalid characters in your payment information. Please review your information and make sure it is correct. Your payouts are on hold until this is resolved.";
|
|
4769
|
+
/**
|
|
4770
|
+
* @uiName Payment returned alert header
|
|
4771
|
+
*/
|
|
4772
|
+
this.paymentReturnedHeader = "Payout unsuccessful";
|
|
4773
|
+
/**
|
|
4774
|
+
* @uiName Payment returned alert description
|
|
4775
|
+
*/
|
|
4776
|
+
this.paymentReturnedDescription = "Our recent payment attempt for your earnings was unsuccessful. Please review your payment information and make sure it is correct.";
|
|
4611
4777
|
/**
|
|
4612
4778
|
* @uiName Terms and Conditions text
|
|
4613
4779
|
*/
|
|
@@ -6026,6 +6192,12 @@ const UserInfoFormView = (props) => {
|
|
|
6026
6192
|
default:
|
|
6027
6193
|
regionLabel = text.state;
|
|
6028
6194
|
}
|
|
6195
|
+
function isDisabledInput(field) {
|
|
6196
|
+
var _a;
|
|
6197
|
+
if (states.isPartner && !!((_a = data.partnerData) === null || _a === void 0 ? void 0 : _a[field]))
|
|
6198
|
+
return true;
|
|
6199
|
+
return false;
|
|
6200
|
+
}
|
|
6029
6201
|
return (h("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit, ref: (el) => (refs.formRef.current = el), novalidate: true },
|
|
6030
6202
|
h("style", { type: "text/css" },
|
|
6031
6203
|
styleString$5,
|
|
@@ -6066,18 +6238,22 @@ const UserInfoFormView = (props) => {
|
|
|
6066
6238
|
})))),
|
|
6067
6239
|
h("div", null,
|
|
6068
6240
|
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 ||
|
|
6241
|
+
h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled ||
|
|
6242
|
+
states.isUser ||
|
|
6243
|
+
isDisabledInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
|
|
6070
6244
|
class: classes.ErrorInput,
|
|
6071
6245
|
helpText: formatErrorMessage(text.firstName, formState.errors.firstName),
|
|
6072
6246
|
}
|
|
6073
6247
|
: {}), { 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 ||
|
|
6248
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled ||
|
|
6249
|
+
states.isUser ||
|
|
6250
|
+
isDisabledInput("lastName") }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
|
|
6075
6251
|
class: classes.ErrorInput,
|
|
6076
6252
|
helpText: formatErrorMessage(text.lastName, formState.errors.lastName),
|
|
6077
6253
|
}
|
|
6078
6254
|
: {}), { id: "lastName", name: "/lastName", required: true })),
|
|
6079
6255
|
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 ||
|
|
6256
|
+
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
6257
|
class: classes.ErrorInput,
|
|
6082
6258
|
helpText: formatErrorMessage(text.country, formState.errors.countryCode),
|
|
6083
6259
|
}
|
|
@@ -6093,7 +6269,8 @@ const UserInfoFormView = (props) => {
|
|
|
6093
6269
|
h("div", { class: classes.PhoneInputsSection },
|
|
6094
6270
|
h("p", null, text.phoneNumber),
|
|
6095
6271
|
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 ||
|
|
6272
|
+
h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled ||
|
|
6273
|
+
isDisabledInput("phoneNumberCountryCode"), ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
|
|
6097
6274
|
class: classes.ErrorInput,
|
|
6098
6275
|
}
|
|
6099
6276
|
: {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
|
|
@@ -6119,7 +6296,7 @@ const UserInfoFormView = (props) => {
|
|
|
6119
6296
|
// Naive phone number validation
|
|
6120
6297
|
validateBillingField(/[a-zA-Z]+/, value) &&
|
|
6121
6298
|
formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError);
|
|
6122
|
-
}, disabled: states.disabled ||
|
|
6299
|
+
}, disabled: states.disabled || isDisabledInput("phoneNumber") }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
|
|
6123
6300
|
class: classes.ErrorInput,
|
|
6124
6301
|
helpText: formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
|
|
6125
6302
|
}
|
|
@@ -6127,7 +6304,7 @@ const UserInfoFormView = (props) => {
|
|
|
6127
6304
|
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
6305
|
// Checks for non-ASCII characters
|
|
6129
6306
|
!validateBillingField(/^[\x20-\xFF]+$/, value) &&
|
|
6130
|
-
formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled ||
|
|
6307
|
+
formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("billingAddress") }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
|
|
6131
6308
|
class: classes.ErrorInput,
|
|
6132
6309
|
helpText: formatErrorMessage(text.address, formState.errors.address),
|
|
6133
6310
|
}
|
|
@@ -6135,22 +6312,22 @@ const UserInfoFormView = (props) => {
|
|
|
6135
6312
|
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
6313
|
// Checks for non-ASCII characters
|
|
6137
6314
|
!validateBillingField(/^[\x20-\xFF]+$/, value) &&
|
|
6138
|
-
formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled ||
|
|
6315
|
+
formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("billingCity") }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
|
|
6139
6316
|
class: classes.ErrorInput,
|
|
6140
6317
|
helpText: formatErrorMessage(text.city, formState.errors.city),
|
|
6141
6318
|
}
|
|
6142
6319
|
: {}), { 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 ||
|
|
6320
|
+
!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("billingState") }, (((_o = formState.errors) === null || _o === void 0 ? void 0 : _o.state) ? {
|
|
6144
6321
|
class: classes.ErrorInput,
|
|
6145
6322
|
helpText: formatErrorMessage(text.state, formState.errors.state),
|
|
6146
6323
|
}
|
|
6147
6324
|
: {}), { 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 ||
|
|
6325
|
+
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("billingPostalCode") }, (((_q = formState.errors) === null || _q === void 0 ? void 0 : _q.postalCode) ? {
|
|
6149
6326
|
class: classes.ErrorInput,
|
|
6150
6327
|
helpText: formatErrorMessage(text.postalCode, formState.errors.postalCode),
|
|
6151
6328
|
}
|
|
6152
6329
|
: {}), { 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 ||
|
|
6330
|
+
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
6331
|
class: classes.ErrorInput,
|
|
6155
6332
|
helpText: formatErrorMessage(text.currency, formState.errors.currency),
|
|
6156
6333
|
}
|
|
@@ -6172,13 +6349,21 @@ const UserInfoFormView = (props) => {
|
|
|
6172
6349
|
h("div", { class: classes.CheckboxWrapper },
|
|
6173
6350
|
h("sl-checkbox", { checked: formState.allowBankingCollection === true, "onSl-change": (e) => {
|
|
6174
6351
|
e.target.value = e.target.checked;
|
|
6175
|
-
}, disabled: states.
|
|
6352
|
+
}, disabled: states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
|
|
6176
6353
|
((_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.
|
|
6354
|
+
h("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
|
|
6178
6355
|
};
|
|
6179
6356
|
|
|
6357
|
+
const GET_INDIRECT_TAX_COUNTRY_CODE = dist.gql `
|
|
6358
|
+
query getIndirectTaxCountryCode {
|
|
6359
|
+
tenantSettings {
|
|
6360
|
+
impactBrandCountryCode
|
|
6361
|
+
impactBrandIndirectTaxCountryCode
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
`;
|
|
6180
6365
|
function useUserInfoForm(props) {
|
|
6181
|
-
var _a, _b, _c, _d;
|
|
6366
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6182
6367
|
const currencyRef = useRef(undefined);
|
|
6183
6368
|
const phoneCountryRef = useRef(undefined);
|
|
6184
6369
|
const formRef = useRef(null);
|
|
@@ -6186,7 +6371,10 @@ function useUserInfoForm(props) {
|
|
|
6186
6371
|
const countries = Fn(SORTED_COUNTRIES_NAMESPACE);
|
|
6187
6372
|
const [step, setStep] = Pn(TAX_CONTEXT_NAMESPACE);
|
|
6188
6373
|
const [userFormContext, setUserFormContext] = Pn(USER_FORM_CONTEXT_NAMESPACE);
|
|
6189
|
-
const
|
|
6374
|
+
const user = J();
|
|
6375
|
+
const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = $e(CONNECT_PARTNER);
|
|
6376
|
+
const { data: tenantData } = wn(GET_INDIRECT_TAX_COUNTRY_CODE, {});
|
|
6377
|
+
const { data, loading, refetch, errors: userError, } = $n(USER_QUERY_NAMESPACE);
|
|
6190
6378
|
const _currencies = Fn(CURRENCIES_NAMESPACE);
|
|
6191
6379
|
const currencies = useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
|
|
6192
6380
|
const [countrySearch, setCountrySearch] = useState("");
|
|
@@ -6288,6 +6476,45 @@ function useUserInfoForm(props) {
|
|
|
6288
6476
|
setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
|
|
6289
6477
|
}
|
|
6290
6478
|
}, [currencySearch, currencies]);
|
|
6479
|
+
async function connectPartner(formData) {
|
|
6480
|
+
var _a, _b, _c, _d, _e;
|
|
6481
|
+
const vars = {
|
|
6482
|
+
user: {
|
|
6483
|
+
id: user.id,
|
|
6484
|
+
accountId: user.accountId,
|
|
6485
|
+
},
|
|
6486
|
+
firstName: formData.firstName,
|
|
6487
|
+
lastName: formData.lastName,
|
|
6488
|
+
countryCode: formData.countryCode,
|
|
6489
|
+
currency: formData.currency,
|
|
6490
|
+
address: formData.address,
|
|
6491
|
+
city: formData.city,
|
|
6492
|
+
state: formData.state,
|
|
6493
|
+
postalCode: formData.postalCode,
|
|
6494
|
+
phoneNumber: formData.phoneNumber,
|
|
6495
|
+
phoneNumberCountryCode: formData.phoneNumberCountryCode,
|
|
6496
|
+
};
|
|
6497
|
+
const result = await connectImpactPartner({
|
|
6498
|
+
vars,
|
|
6499
|
+
});
|
|
6500
|
+
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
6501
|
+
throw new Error();
|
|
6502
|
+
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
6503
|
+
// Output backend errors to console for now
|
|
6504
|
+
console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
|
|
6505
|
+
throw new Error();
|
|
6506
|
+
}
|
|
6507
|
+
await refetch();
|
|
6508
|
+
const resultPublisher = (_e = (_d = (_c = result
|
|
6509
|
+
.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;
|
|
6510
|
+
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
6511
|
+
// Fire form change event
|
|
6512
|
+
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
6513
|
+
return {
|
|
6514
|
+
resultPublisher,
|
|
6515
|
+
hasValidCurrentDocument,
|
|
6516
|
+
};
|
|
6517
|
+
}
|
|
6291
6518
|
async function onSubmit(event) {
|
|
6292
6519
|
let formControls = event.target.getFormControls();
|
|
6293
6520
|
let formData = {};
|
|
@@ -6330,9 +6557,46 @@ function useUserInfoForm(props) {
|
|
|
6330
6557
|
postalCode: userData.postalCode,
|
|
6331
6558
|
currency: userData.currency,
|
|
6332
6559
|
});
|
|
6333
|
-
const
|
|
6560
|
+
const skipNextStep = getSkipNextStep(userData);
|
|
6561
|
+
if (skipNextStep) {
|
|
6562
|
+
try {
|
|
6563
|
+
const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
|
|
6564
|
+
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
6565
|
+
!hasValidCurrentDocument) {
|
|
6566
|
+
// Go to docusign form
|
|
6567
|
+
setStep("/3");
|
|
6568
|
+
}
|
|
6569
|
+
else {
|
|
6570
|
+
if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
|
|
6571
|
+
// Go to banking information form
|
|
6572
|
+
setStep("/4");
|
|
6573
|
+
}
|
|
6574
|
+
else {
|
|
6575
|
+
// Go right to the dashboard
|
|
6576
|
+
setStep("/dashboard");
|
|
6577
|
+
}
|
|
6578
|
+
}
|
|
6579
|
+
return;
|
|
6580
|
+
}
|
|
6581
|
+
catch (e) {
|
|
6582
|
+
setErrors({ general: true });
|
|
6583
|
+
return;
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
|
|
6334
6587
|
setStep(nextStep);
|
|
6335
6588
|
}
|
|
6589
|
+
const indirectTaxCountry = (_a = tenantData === null || tenantData === void 0 ? void 0 : tenantData.tenantSettings) === null || _a === void 0 ? void 0 : _a.impactBrandIndirectTaxCountryCode;
|
|
6590
|
+
const hasIndirectTax = !!indirectTaxCountry;
|
|
6591
|
+
function getSkipNextStep(userData) {
|
|
6592
|
+
if (!hasIndirectTax)
|
|
6593
|
+
return true;
|
|
6594
|
+
if (userData.countryCode === "US")
|
|
6595
|
+
return true;
|
|
6596
|
+
if (hasIndirectTax && userData.countryCode !== indirectTaxCountry)
|
|
6597
|
+
return true;
|
|
6598
|
+
return false;
|
|
6599
|
+
}
|
|
6336
6600
|
const hasStates = ["ES", "AU", "US", "CA"].includes(userFormContext.countryCode);
|
|
6337
6601
|
const regionObj = hasStates
|
|
6338
6602
|
? ADDRESS_REGIONS[userFormContext === null || userFormContext === void 0 ? void 0 : userFormContext.countryCode]
|
|
@@ -6360,16 +6624,17 @@ function useUserInfoForm(props) {
|
|
|
6360
6624
|
allCountries: countries,
|
|
6361
6625
|
regionLabelEnum: regionObj === null || regionObj === void 0 ? void 0 : regionObj.labelEnum,
|
|
6362
6626
|
regions: (regionObj === null || regionObj === void 0 ? void 0 : regionObj.regions) || [],
|
|
6627
|
+
partnerData: (_c = (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher,
|
|
6363
6628
|
},
|
|
6364
6629
|
states: {
|
|
6365
6630
|
step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
|
|
6366
6631
|
hideState: !hasStates,
|
|
6367
6632
|
hideSteps: !!context.hideSteps,
|
|
6368
|
-
disabled: loading,
|
|
6633
|
+
disabled: loading || connectLoading,
|
|
6369
6634
|
loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
|
|
6370
|
-
loading: loading,
|
|
6371
|
-
isPartner: !!((
|
|
6372
|
-
isUser: !!((
|
|
6635
|
+
loading: loading || connectLoading,
|
|
6636
|
+
isPartner: !!((_e = (_d = data === null || data === void 0 ? void 0 : data.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher),
|
|
6637
|
+
isUser: !!((_g = (_f = data === null || data === void 0 ? void 0 : data.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.user),
|
|
6373
6638
|
formState: {
|
|
6374
6639
|
...userFormContext,
|
|
6375
6640
|
errors: formErrors,
|