@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
|
@@ -19,7 +19,7 @@ const useReferralTable = require('./useReferralTable-90d4d6e9.js');
|
|
|
19
19
|
const IndirectTaxDetailsView = require('./IndirectTaxDetailsView-659a139c.js');
|
|
20
20
|
const utils$1 = require('./utils-4eb18a29.js');
|
|
21
21
|
const keys = require('./keys-cff24974.js');
|
|
22
|
-
const data = require('./data-
|
|
22
|
+
const data = require('./data-44260010.js');
|
|
23
23
|
|
|
24
24
|
function getFormMap({ props, getValidationErrorMessage, bankCountry, }) {
|
|
25
25
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32;
|
|
@@ -903,10 +903,6 @@ function useBankingInfoForm(props) {
|
|
|
903
903
|
const paymentMethodChecked = !hasPayPal
|
|
904
904
|
? "toBankAccount"
|
|
905
905
|
: _paymentMethodChecked;
|
|
906
|
-
domContextHooks_module.useEffect(() => {
|
|
907
|
-
// reset redirect hash
|
|
908
|
-
window.location.hash = "";
|
|
909
|
-
}, []);
|
|
910
906
|
domContextHooks_module.useEffect(() => {
|
|
911
907
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
912
908
|
if (!userData)
|
|
@@ -1078,6 +1074,7 @@ function useBankingInfoForm(props) {
|
|
|
1078
1074
|
}
|
|
1079
1075
|
await runMutation(formData, token);
|
|
1080
1076
|
setShowModal(false);
|
|
1077
|
+
window.location.hash = "";
|
|
1081
1078
|
};
|
|
1082
1079
|
const onVerification = async (token) => {
|
|
1083
1080
|
host.dispatchEvent(new CustomEvent(keys.VERIFICATION_EVENT_KEY, {
|
|
@@ -1107,7 +1104,15 @@ function useBankingInfoForm(props) {
|
|
|
1107
1104
|
setBankCountry: updateBankCountry,
|
|
1108
1105
|
setPaymentMethodChecked,
|
|
1109
1106
|
setPaymentScheduleChecked,
|
|
1110
|
-
onBack: () =>
|
|
1107
|
+
onBack: () => {
|
|
1108
|
+
// return to dashboard
|
|
1109
|
+
if (window.location.hash) {
|
|
1110
|
+
window.location.hash = "";
|
|
1111
|
+
}
|
|
1112
|
+
else {
|
|
1113
|
+
setStep("/dashboard");
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1111
1116
|
setCountrySearch,
|
|
1112
1117
|
onVerification,
|
|
1113
1118
|
onVerificationHide: () => onVerification(null),
|
|
@@ -1780,11 +1785,17 @@ function useDocusignForm(props) {
|
|
|
1780
1785
|
}
|
|
1781
1786
|
};
|
|
1782
1787
|
const progressStep = () => {
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
+
// return to dashboard
|
|
1789
|
+
if (window.location.hash) {
|
|
1790
|
+
window.location.hash = "";
|
|
1791
|
+
}
|
|
1792
|
+
else {
|
|
1793
|
+
setStep(context.overrideNextStep ||
|
|
1794
|
+
!!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
|
|
1795
|
+
!(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
|
|
1796
|
+
? "/dashboard"
|
|
1797
|
+
: "/4");
|
|
1798
|
+
}
|
|
1788
1799
|
};
|
|
1789
1800
|
const allLoading = userLoading || documentLoading || loading;
|
|
1790
1801
|
return {
|
|
@@ -2611,8 +2622,51 @@ function useIndirectTaxForm(props) {
|
|
|
2611
2622
|
console.error("Could not detect select change");
|
|
2612
2623
|
setFormState((p) => ({ ...p, [field]: value }));
|
|
2613
2624
|
};
|
|
2614
|
-
|
|
2625
|
+
async function connectPartner(formData) {
|
|
2615
2626
|
var _a, _b, _c, _d, _e;
|
|
2627
|
+
const vars = {
|
|
2628
|
+
user: {
|
|
2629
|
+
id: user.id,
|
|
2630
|
+
accountId: user.accountId,
|
|
2631
|
+
},
|
|
2632
|
+
firstName: userForm.firstName,
|
|
2633
|
+
lastName: userForm.lastName,
|
|
2634
|
+
countryCode: userForm.countryCode,
|
|
2635
|
+
currency: userForm.currency,
|
|
2636
|
+
address: userForm.address,
|
|
2637
|
+
city: userForm.city,
|
|
2638
|
+
state: userForm.state,
|
|
2639
|
+
postalCode: userForm.postalCode,
|
|
2640
|
+
phoneNumber: userForm.phoneNumber,
|
|
2641
|
+
phoneNumberCountryCode: userForm.phoneNumberCountryCode,
|
|
2642
|
+
indirectTaxCountryCode: formData.selectedRegion,
|
|
2643
|
+
indirectTaxRegion: formData.province || formData.subRegion,
|
|
2644
|
+
indirectTaxId: formData.indirectTaxNumber,
|
|
2645
|
+
additionalTaxId: formData.qstNumber,
|
|
2646
|
+
withholdingTaxId: formData.subRegionTaxNumber,
|
|
2647
|
+
};
|
|
2648
|
+
const result = await connectImpactPartner({
|
|
2649
|
+
vars,
|
|
2650
|
+
});
|
|
2651
|
+
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
2652
|
+
throw new Error();
|
|
2653
|
+
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
2654
|
+
// Output backend errors to console for now
|
|
2655
|
+
console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
|
|
2656
|
+
throw new Error();
|
|
2657
|
+
}
|
|
2658
|
+
await refetch();
|
|
2659
|
+
const resultPublisher = (_e = (_d = (_c = result
|
|
2660
|
+
.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;
|
|
2661
|
+
const hasValidCurrentDocument = utils$1.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
2662
|
+
// Fire form change event
|
|
2663
|
+
window.dispatchEvent(new Event(data.TAX_FORM_UPDATED_EVENT_KEY));
|
|
2664
|
+
return {
|
|
2665
|
+
resultPublisher,
|
|
2666
|
+
hasValidCurrentDocument,
|
|
2667
|
+
};
|
|
2668
|
+
}
|
|
2669
|
+
const onSubmit = async (event) => {
|
|
2616
2670
|
if (!option) {
|
|
2617
2671
|
setErrors({ taxDetails: true });
|
|
2618
2672
|
return;
|
|
@@ -2638,44 +2692,7 @@ function useIndirectTaxForm(props) {
|
|
|
2638
2692
|
}
|
|
2639
2693
|
setLoading(true);
|
|
2640
2694
|
try {
|
|
2641
|
-
const
|
|
2642
|
-
user: {
|
|
2643
|
-
id: user.id,
|
|
2644
|
-
accountId: user.accountId,
|
|
2645
|
-
},
|
|
2646
|
-
firstName: userForm.firstName,
|
|
2647
|
-
lastName: userForm.lastName,
|
|
2648
|
-
countryCode: userForm.countryCode,
|
|
2649
|
-
currency: userForm.currency,
|
|
2650
|
-
address: userForm.address,
|
|
2651
|
-
city: userForm.city,
|
|
2652
|
-
state: userForm.state,
|
|
2653
|
-
postalCode: userForm.postalCode,
|
|
2654
|
-
phoneNumber: userForm.phoneNumber,
|
|
2655
|
-
phoneNumberCountryCode: userForm.phoneNumberCountryCode,
|
|
2656
|
-
indirectTaxCountryCode: formData.selectedRegion,
|
|
2657
|
-
indirectTaxRegion: formData.province || formData.subRegion,
|
|
2658
|
-
indirectTaxId: formData.indirectTaxNumber,
|
|
2659
|
-
additionalTaxId: formData.qstNumber,
|
|
2660
|
-
withholdingTaxId: formData.subRegionTaxNumber,
|
|
2661
|
-
};
|
|
2662
|
-
const result = await connectImpactPartner({
|
|
2663
|
-
vars,
|
|
2664
|
-
});
|
|
2665
|
-
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
2666
|
-
throw new Error();
|
|
2667
|
-
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
2668
|
-
// Output backend errors to console for now
|
|
2669
|
-
console.error("Failed to create Impact connection: ", result.createImpactConnection
|
|
2670
|
-
.validationErrors);
|
|
2671
|
-
throw new Error();
|
|
2672
|
-
}
|
|
2673
|
-
await refetch();
|
|
2674
|
-
const resultPublisher = (_e = (_d = (_c = result
|
|
2675
|
-
.createImpactConnection) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher;
|
|
2676
|
-
const hasValidCurrentDocument = utils$1.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
2677
|
-
// Fire form change event
|
|
2678
|
-
window.dispatchEvent(new Event(data.TAX_FORM_UPDATED_EVENT_KEY));
|
|
2695
|
+
const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
|
|
2679
2696
|
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
2680
2697
|
!hasValidCurrentDocument) {
|
|
2681
2698
|
// Go to docusign form
|
|
@@ -3916,6 +3933,11 @@ const style$5 = {
|
|
|
3916
3933
|
SubduedText: {
|
|
3917
3934
|
color: "var(--sqm-text-subdued)",
|
|
3918
3935
|
},
|
|
3936
|
+
ButtonContainer: {
|
|
3937
|
+
display: "flex",
|
|
3938
|
+
gap: "var(--sl-spacing-medium)",
|
|
3939
|
+
flexWrap: "wrap",
|
|
3940
|
+
},
|
|
3919
3941
|
};
|
|
3920
3942
|
const sheet$4 = JSS.createStyleSheet(style$5);
|
|
3921
3943
|
const styleString$4 = sheet$4.toString();
|
|
@@ -4028,7 +4050,7 @@ const TaxAndCashDashboardView = (props) => {
|
|
|
4028
4050
|
icon: "exclamation-octagon",
|
|
4029
4051
|
class: sheet$4.classes.ErrorHoldAlertContainer,
|
|
4030
4052
|
};
|
|
4031
|
-
case "
|
|
4053
|
+
case "NEW_PAYEE_REVIEW":
|
|
4032
4054
|
return {
|
|
4033
4055
|
header: text.accountReviewHeader,
|
|
4034
4056
|
description: global.intl.formatMessage({
|
|
@@ -4042,6 +4064,96 @@ const TaxAndCashDashboardView = (props) => {
|
|
|
4042
4064
|
icon: "exclamation-triangle",
|
|
4043
4065
|
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4044
4066
|
};
|
|
4067
|
+
case "PAYMENT_HOLD_ON_CHANGE":
|
|
4068
|
+
return {
|
|
4069
|
+
header: text.paymentHoldOnChangeHeader,
|
|
4070
|
+
description: global.intl.formatMessage({
|
|
4071
|
+
id: "accountReviewDescription",
|
|
4072
|
+
defaultMessage: text.paymentHoldOnChangeDescription,
|
|
4073
|
+
}, {
|
|
4074
|
+
supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4075
|
+
}),
|
|
4076
|
+
buttonText: null,
|
|
4077
|
+
alertType: "warning",
|
|
4078
|
+
icon: "exclamation-triangle",
|
|
4079
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4080
|
+
};
|
|
4081
|
+
case "BENEFICIARY_NAME_INVALID":
|
|
4082
|
+
return {
|
|
4083
|
+
header: text.beneficiaryNameInvalidHeader,
|
|
4084
|
+
description: global.intl.formatMessage({
|
|
4085
|
+
id: "accountReviewDescription",
|
|
4086
|
+
defaultMessage: text.beneficiaryNameInvalidDescription,
|
|
4087
|
+
}, {
|
|
4088
|
+
supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4089
|
+
}),
|
|
4090
|
+
button: (index.h("div", { class: sheet$4.classes.ButtonContainer },
|
|
4091
|
+
index.h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
|
|
4092
|
+
index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
|
|
4093
|
+
alertType: "warning",
|
|
4094
|
+
icon: "exclamation-triangle",
|
|
4095
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4096
|
+
};
|
|
4097
|
+
case "BENEFICIARY_NAME_MISMATCH":
|
|
4098
|
+
return {
|
|
4099
|
+
header: text.beneficiaryNameMismatchHeader,
|
|
4100
|
+
description: global.intl.formatMessage({
|
|
4101
|
+
id: "accountReviewDescription",
|
|
4102
|
+
defaultMessage: text.beneficiaryNameMismatchDescription,
|
|
4103
|
+
}, {
|
|
4104
|
+
supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4105
|
+
}),
|
|
4106
|
+
button: (index.h("div", { class: sheet$4.classes.ButtonContainer },
|
|
4107
|
+
index.h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
|
|
4108
|
+
index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
|
|
4109
|
+
alertType: "warning",
|
|
4110
|
+
icon: "exclamation-triangle",
|
|
4111
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4112
|
+
};
|
|
4113
|
+
case "BANK_TAX_NAME_MISMATCH":
|
|
4114
|
+
return {
|
|
4115
|
+
header: text.bankTaxNameMismatchHeader,
|
|
4116
|
+
description: global.intl.formatMessage({
|
|
4117
|
+
id: "accountReviewDescription",
|
|
4118
|
+
defaultMessage: text.bankTaxNameMismatchDescription,
|
|
4119
|
+
}, {
|
|
4120
|
+
supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4121
|
+
}),
|
|
4122
|
+
button: (index.h("div", { class: sheet$4.classes.ButtonContainer },
|
|
4123
|
+
index.h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton),
|
|
4124
|
+
index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onNewFormClick }, text.newFormButton))),
|
|
4125
|
+
alertType: "warning",
|
|
4126
|
+
icon: "exclamation-triangle",
|
|
4127
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4128
|
+
};
|
|
4129
|
+
case "WITHDRAWAL_SETTINGS_INVALID":
|
|
4130
|
+
return {
|
|
4131
|
+
header: text.withdrawalSettingsInvalidHeader,
|
|
4132
|
+
description: global.intl.formatMessage({
|
|
4133
|
+
id: "accountReviewDescription",
|
|
4134
|
+
defaultMessage: text.withdrawalSettingsInvalidDescription,
|
|
4135
|
+
}, {
|
|
4136
|
+
supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4137
|
+
}),
|
|
4138
|
+
button: (index.h("sl-button", { disabled: states.disabled || states.loading, type: "default", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
|
|
4139
|
+
alertType: "warning",
|
|
4140
|
+
icon: "exclamation-triangle",
|
|
4141
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4142
|
+
};
|
|
4143
|
+
case "PAYMENT_RETURNED":
|
|
4144
|
+
return {
|
|
4145
|
+
header: text.paymentReturnedHeader,
|
|
4146
|
+
description: global.intl.formatMessage({
|
|
4147
|
+
id: "accountReviewDescription",
|
|
4148
|
+
defaultMessage: text.paymentReturnedDescription,
|
|
4149
|
+
}, {
|
|
4150
|
+
supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
4151
|
+
}),
|
|
4152
|
+
button: (index.h("sl-button", { disabled: states.disabled || states.loading, type: "primary", class: sheet$4.classes.EditBankDetailsButton, onClick: callbacks.onEditPayoutInfo }, text.editPaymentInformationButton)),
|
|
4153
|
+
alertType: "error",
|
|
4154
|
+
icon: "exclamation-triangle",
|
|
4155
|
+
class: sheet$4.classes.WarningHoldAlertContainer,
|
|
4156
|
+
};
|
|
4045
4157
|
case "HOLD":
|
|
4046
4158
|
return {
|
|
4047
4159
|
header: text.payoutHoldAlertHeader,
|
|
@@ -4298,8 +4410,14 @@ const useTaxAndCashDashboard = (props) => {
|
|
|
4298
4410
|
domContextHooks_module.useEffect(() => {
|
|
4299
4411
|
// Clear override context once on submitted
|
|
4300
4412
|
setContext({});
|
|
4301
|
-
if (window.location.hash)
|
|
4413
|
+
if (window.location.hash) {
|
|
4414
|
+
setContext({
|
|
4415
|
+
overrideNextStep: "/dashboard",
|
|
4416
|
+
overrideBackStep: "/dashboard",
|
|
4417
|
+
hideSteps: true,
|
|
4418
|
+
});
|
|
4302
4419
|
setStep(`/${window.location.hash.replace("#", "")}`);
|
|
4420
|
+
}
|
|
4303
4421
|
}, []);
|
|
4304
4422
|
const { data: data$1, loading, errors: userError, refetch, } = index_module.$n(data.USER_QUERY_NAMESPACE);
|
|
4305
4423
|
const publisher = (_b = (_a = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
|
|
@@ -4504,12 +4622,12 @@ const TaxAndCashDashboard = class {
|
|
|
4504
4622
|
/**
|
|
4505
4623
|
* @uiName Submit new tax form button label
|
|
4506
4624
|
*/
|
|
4507
|
-
this.newFormButton = "Submit new form";
|
|
4625
|
+
this.newFormButton = "Submit new tax form";
|
|
4508
4626
|
/**
|
|
4509
4627
|
*
|
|
4510
4628
|
* @uiName Edit payment info button label
|
|
4511
4629
|
*/
|
|
4512
|
-
this.editPaymentInformationButton = "Edit
|
|
4630
|
+
this.editPaymentInformationButton = "Edit payout information";
|
|
4513
4631
|
/**
|
|
4514
4632
|
* @uiName Not registered for indirect tax text
|
|
4515
4633
|
* @uiWidget textArea
|
|
@@ -4570,7 +4688,7 @@ const TaxAndCashDashboard = class {
|
|
|
4570
4688
|
/**
|
|
4571
4689
|
* @uiName Verification required internal alert header
|
|
4572
4690
|
*/
|
|
4573
|
-
this.verificationRequiredInternalHeader = "Identity
|
|
4691
|
+
this.verificationRequiredInternalHeader = "Identity verification in progress";
|
|
4574
4692
|
/**
|
|
4575
4693
|
* @uiName Verification required internal alert description
|
|
4576
4694
|
*/
|
|
@@ -4578,7 +4696,7 @@ const TaxAndCashDashboard = class {
|
|
|
4578
4696
|
/**
|
|
4579
4697
|
* @uiName Verification review internal alert header
|
|
4580
4698
|
*/
|
|
4581
|
-
this.verificationReviewInternalHeader = "Identity
|
|
4699
|
+
this.verificationReviewInternalHeader = "Identity verification under review";
|
|
4582
4700
|
/**
|
|
4583
4701
|
* @uiName Verification review internal alert description
|
|
4584
4702
|
*/
|
|
@@ -4586,7 +4704,7 @@ const TaxAndCashDashboard = class {
|
|
|
4586
4704
|
/**
|
|
4587
4705
|
* @uiName Verification failed internal alert header
|
|
4588
4706
|
*/
|
|
4589
|
-
this.verificationFailedInternalHeader = "Identity
|
|
4707
|
+
this.verificationFailedInternalHeader = "Identity verification unsuccessful";
|
|
4590
4708
|
/**
|
|
4591
4709
|
* @uiName Verification failed internal alert description
|
|
4592
4710
|
*/
|
|
@@ -4612,6 +4730,54 @@ const TaxAndCashDashboard = class {
|
|
|
4612
4730
|
* @uiName Account review alert description
|
|
4613
4731
|
*/
|
|
4614
4732
|
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}.";
|
|
4733
|
+
/**
|
|
4734
|
+
* @uiName Payment hold on change alert header
|
|
4735
|
+
*/
|
|
4736
|
+
this.paymentHoldOnChangeHeader = "We are reviewing your new payout settings";
|
|
4737
|
+
/**
|
|
4738
|
+
* @uiName Payment hold on change alert description
|
|
4739
|
+
*/
|
|
4740
|
+
this.paymentHoldOnChangeDescription = "Your payout is temporarily on hold while we review your new payment information, this process is usually resolved within 48 hours.";
|
|
4741
|
+
/**
|
|
4742
|
+
* @uiName Beneficiary name invalid alert header
|
|
4743
|
+
*/
|
|
4744
|
+
this.beneficiaryNameInvalidHeader = "Your payment information does not match your tax form";
|
|
4745
|
+
/**
|
|
4746
|
+
* @uiName Beneficiary name invalid description
|
|
4747
|
+
*/
|
|
4748
|
+
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.";
|
|
4749
|
+
/**
|
|
4750
|
+
* @uiName Beneficiary name mismatch alert header
|
|
4751
|
+
*/
|
|
4752
|
+
this.beneficiaryNameMismatchHeader = "Your payment information does not match your tax form";
|
|
4753
|
+
/**
|
|
4754
|
+
* @uiName Beneficiary name mismatch alert description
|
|
4755
|
+
*/
|
|
4756
|
+
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.";
|
|
4757
|
+
/**
|
|
4758
|
+
* @uiName Bank name mismatch alert header
|
|
4759
|
+
*/
|
|
4760
|
+
this.bankTaxNameMismatchHeader = "Your payment information does not match your tax form";
|
|
4761
|
+
/**
|
|
4762
|
+
* @uiName Bank name mismatch alert description
|
|
4763
|
+
*/
|
|
4764
|
+
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.";
|
|
4765
|
+
/**
|
|
4766
|
+
* @uiName Withdrawal settings invalid alert header
|
|
4767
|
+
*/
|
|
4768
|
+
this.withdrawalSettingsInvalidHeader = "Your payment information is incomplete or includes invalid characters";
|
|
4769
|
+
/**
|
|
4770
|
+
* @uiName Withdrawal settings invalid alert description
|
|
4771
|
+
*/
|
|
4772
|
+
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.";
|
|
4773
|
+
/**
|
|
4774
|
+
* @uiName Payment returned alert header
|
|
4775
|
+
*/
|
|
4776
|
+
this.paymentReturnedHeader = "Payout unsuccessful";
|
|
4777
|
+
/**
|
|
4778
|
+
* @uiName Payment returned alert description
|
|
4779
|
+
*/
|
|
4780
|
+
this.paymentReturnedDescription = "Our recent payment attempt for your earnings was unsuccessful. Please review your payment information and make sure it is correct.";
|
|
4615
4781
|
/**
|
|
4616
4782
|
* @uiName Terms and Conditions text
|
|
4617
4783
|
*/
|
|
@@ -6030,6 +6196,12 @@ const UserInfoFormView = (props) => {
|
|
|
6030
6196
|
default:
|
|
6031
6197
|
regionLabel = text.state;
|
|
6032
6198
|
}
|
|
6199
|
+
function isDisabledInput(field) {
|
|
6200
|
+
var _a;
|
|
6201
|
+
if (states.isPartner && !!((_a = data$1.partnerData) === null || _a === void 0 ? void 0 : _a[field]))
|
|
6202
|
+
return true;
|
|
6203
|
+
return false;
|
|
6204
|
+
}
|
|
6033
6205
|
return (index.h("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit, ref: (el) => (refs.formRef.current = el), novalidate: true },
|
|
6034
6206
|
index.h("style", { type: "text/css" },
|
|
6035
6207
|
styleString$5,
|
|
@@ -6070,18 +6242,22 @@ const UserInfoFormView = (props) => {
|
|
|
6070
6242
|
})))),
|
|
6071
6243
|
index.h("div", null,
|
|
6072
6244
|
index.h("div", { class: classes.InputContainer },
|
|
6073
|
-
index.h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled ||
|
|
6245
|
+
index.h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled ||
|
|
6246
|
+
states.isUser ||
|
|
6247
|
+
isDisabledInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
|
|
6074
6248
|
class: classes.ErrorInput,
|
|
6075
6249
|
helpText: utils$1.formatErrorMessage(text.firstName, formState.errors.firstName),
|
|
6076
6250
|
}
|
|
6077
6251
|
: {}), { id: "firstName", name: "/firstName", required: true })),
|
|
6078
|
-
index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled ||
|
|
6252
|
+
index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled ||
|
|
6253
|
+
states.isUser ||
|
|
6254
|
+
isDisabledInput("lastName") }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
|
|
6079
6255
|
class: classes.ErrorInput,
|
|
6080
6256
|
helpText: utils$1.formatErrorMessage(text.lastName, formState.errors.lastName),
|
|
6081
6257
|
}
|
|
6082
6258
|
: {}), { id: "lastName", name: "/lastName", required: true })),
|
|
6083
6259
|
index.h("sl-input", { exportparts: "label: input-label, base: input-base", value: formState.email, label: text.email, disabled: true, id: "email", name: "/email", required: true }),
|
|
6084
|
-
index.h("sl-select", Object.assign({ id: "countryCode", exportparts: "label: input-label, base: input-base", name: "/countryCode", label: text.country, value: formState.countryCode, disabled: states.disabled ||
|
|
6260
|
+
index.h("sl-select", Object.assign({ id: "countryCode", exportparts: "label: input-label, base: input-base", name: "/countryCode", label: text.country, value: formState.countryCode, disabled: states.disabled || isDisabledInput("countryCode") }, (((_d = formState.errors) === null || _d === void 0 ? void 0 : _d.countryCode) ? {
|
|
6085
6261
|
class: classes.ErrorInput,
|
|
6086
6262
|
helpText: utils$1.formatErrorMessage(text.country, formState.errors.countryCode),
|
|
6087
6263
|
}
|
|
@@ -6097,7 +6273,8 @@ const UserInfoFormView = (props) => {
|
|
|
6097
6273
|
index.h("div", { class: classes.PhoneInputsSection },
|
|
6098
6274
|
index.h("p", null, text.phoneNumber),
|
|
6099
6275
|
index.h("div", { class: classes.PhoneInputsContainer },
|
|
6100
|
-
index.h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled ||
|
|
6276
|
+
index.h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled ||
|
|
6277
|
+
isDisabledInput("phoneNumberCountryCode"), ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
|
|
6101
6278
|
class: classes.ErrorInput,
|
|
6102
6279
|
}
|
|
6103
6280
|
: {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
|
|
@@ -6123,7 +6300,7 @@ const UserInfoFormView = (props) => {
|
|
|
6123
6300
|
// Naive phone number validation
|
|
6124
6301
|
utils$1.validateBillingField(/[a-zA-Z]+/, value) &&
|
|
6125
6302
|
utils$1.formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError);
|
|
6126
|
-
}, disabled: states.disabled ||
|
|
6303
|
+
}, disabled: states.disabled || isDisabledInput("phoneNumber") }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
|
|
6127
6304
|
class: classes.ErrorInput,
|
|
6128
6305
|
helpText: utils$1.formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
|
|
6129
6306
|
}
|
|
@@ -6131,7 +6308,7 @@ const UserInfoFormView = (props) => {
|
|
|
6131
6308
|
index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.address, id: "address", name: "/address", value: formState.address, validationError: ({ value }) =>
|
|
6132
6309
|
// Checks for non-ASCII characters
|
|
6133
6310
|
!utils$1.validateBillingField(/^[\x20-\xFF]+$/, value) &&
|
|
6134
|
-
utils$1.formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled ||
|
|
6311
|
+
utils$1.formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("billingAddress") }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
|
|
6135
6312
|
class: classes.ErrorInput,
|
|
6136
6313
|
helpText: utils$1.formatErrorMessage(text.address, formState.errors.address),
|
|
6137
6314
|
}
|
|
@@ -6139,22 +6316,22 @@ const UserInfoFormView = (props) => {
|
|
|
6139
6316
|
index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.city, id: "city", name: "/city", value: formState.city, validationError: ({ value }) =>
|
|
6140
6317
|
// Checks for non-ASCII characters
|
|
6141
6318
|
!utils$1.validateBillingField(/^[\x20-\xFF]+$/, value) &&
|
|
6142
|
-
utils$1.formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled ||
|
|
6319
|
+
utils$1.formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("billingCity") }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
|
|
6143
6320
|
class: classes.ErrorInput,
|
|
6144
6321
|
helpText: utils$1.formatErrorMessage(text.city, formState.errors.city),
|
|
6145
6322
|
}
|
|
6146
6323
|
: {}), { required: true })),
|
|
6147
|
-
!states.hideState && (index.h("sl-select", Object.assign({ label: regionLabel, exportparts: "label: input-label, base: input-base", id: "state", name: "/state", value: formState.state, disabled: states.disabled ||
|
|
6324
|
+
!states.hideState && (index.h("sl-select", Object.assign({ label: regionLabel, exportparts: "label: input-label, base: input-base", id: "state", name: "/state", value: formState.state, disabled: states.disabled || isDisabledInput("billingState") }, (((_o = formState.errors) === null || _o === void 0 ? void 0 : _o.state) ? {
|
|
6148
6325
|
class: classes.ErrorInput,
|
|
6149
6326
|
helpText: utils$1.formatErrorMessage(text.state, formState.errors.state),
|
|
6150
6327
|
}
|
|
6151
6328
|
: {}), { required: true }), (_p = data$1.regions) === null || _p === void 0 ? void 0 : _p.map((r) => (index.h("sl-menu-item", { value: r.value }, r.label))))),
|
|
6152
|
-
index.h("sl-input", Object.assign({ label: text.postalCode, exportparts: "label: input-label, base: input-base", id: "postalCode", name: "/postalCode", value: formState.postalCode, disabled: states.disabled ||
|
|
6329
|
+
index.h("sl-input", Object.assign({ label: text.postalCode, exportparts: "label: input-label, base: input-base", id: "postalCode", name: "/postalCode", value: formState.postalCode, disabled: states.disabled || isDisabledInput("billingPostalCode") }, (((_q = formState.errors) === null || _q === void 0 ? void 0 : _q.postalCode) ? {
|
|
6153
6330
|
class: classes.ErrorInput,
|
|
6154
6331
|
helpText: utils$1.formatErrorMessage(text.postalCode, formState.errors.postalCode),
|
|
6155
6332
|
}
|
|
6156
6333
|
: {}), { required: true })),
|
|
6157
|
-
index.h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled ||
|
|
6334
|
+
index.h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || isDisabledInput("currency"), helpText: text.currencyHelpText }, (((_r = formState.errors) === null || _r === void 0 ? void 0 : _r.currency) ? {
|
|
6158
6335
|
class: classes.ErrorInput,
|
|
6159
6336
|
helpText: utils$1.formatErrorMessage(text.currency, formState.errors.currency),
|
|
6160
6337
|
}
|
|
@@ -6176,13 +6353,21 @@ const UserInfoFormView = (props) => {
|
|
|
6176
6353
|
index.h("div", { class: classes.CheckboxWrapper },
|
|
6177
6354
|
index.h("sl-checkbox", { checked: formState.allowBankingCollection === true, "onSl-change": (e) => {
|
|
6178
6355
|
e.target.value = e.target.checked;
|
|
6179
|
-
}, disabled: states.
|
|
6356
|
+
}, disabled: states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
|
|
6180
6357
|
((_u = formState.errors) === null || _u === void 0 ? void 0 : _u.allowBankingCollection) && (index.h("p", { class: classes.ErrorText }, utils$1.formatErrorMessage(text.termsAndConditionsLabel, formState.errors.allowBankingCollection))))),
|
|
6181
|
-
index.h("sl-button", { type: "primary", disabled: states.
|
|
6358
|
+
index.h("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
|
|
6182
6359
|
};
|
|
6183
6360
|
|
|
6361
|
+
const GET_INDIRECT_TAX_COUNTRY_CODE = index_module.dist.gql `
|
|
6362
|
+
query getIndirectTaxCountryCode {
|
|
6363
|
+
tenantSettings {
|
|
6364
|
+
impactBrandCountryCode
|
|
6365
|
+
impactBrandIndirectTaxCountryCode
|
|
6366
|
+
}
|
|
6367
|
+
}
|
|
6368
|
+
`;
|
|
6184
6369
|
function useUserInfoForm(props) {
|
|
6185
|
-
var _a, _b, _c, _d;
|
|
6370
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6186
6371
|
const currencyRef = domContextHooks_module.useRef(undefined);
|
|
6187
6372
|
const phoneCountryRef = domContextHooks_module.useRef(undefined);
|
|
6188
6373
|
const formRef = domContextHooks_module.useRef(null);
|
|
@@ -6190,7 +6375,10 @@ function useUserInfoForm(props) {
|
|
|
6190
6375
|
const countries = index_module.Fn(data.SORTED_COUNTRIES_NAMESPACE);
|
|
6191
6376
|
const [step, setStep] = index_module.Pn(data.TAX_CONTEXT_NAMESPACE);
|
|
6192
6377
|
const [userFormContext, setUserFormContext] = index_module.Pn(data.USER_FORM_CONTEXT_NAMESPACE);
|
|
6193
|
-
const
|
|
6378
|
+
const user = index_module.J();
|
|
6379
|
+
const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = index_module.$e(CONNECT_PARTNER);
|
|
6380
|
+
const { data: tenantData } = index_module.wn(GET_INDIRECT_TAX_COUNTRY_CODE, {});
|
|
6381
|
+
const { data: data$1, loading, refetch, errors: userError, } = index_module.$n(data.USER_QUERY_NAMESPACE);
|
|
6194
6382
|
const _currencies = index_module.Fn(data.CURRENCIES_NAMESPACE);
|
|
6195
6383
|
const currencies = domContextHooks_module.useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
|
|
6196
6384
|
const [countrySearch, setCountrySearch] = domContextHooks_module.useState("");
|
|
@@ -6292,6 +6480,45 @@ function useUserInfoForm(props) {
|
|
|
6292
6480
|
setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
|
|
6293
6481
|
}
|
|
6294
6482
|
}, [currencySearch, currencies]);
|
|
6483
|
+
async function connectPartner(formData) {
|
|
6484
|
+
var _a, _b, _c, _d, _e;
|
|
6485
|
+
const vars = {
|
|
6486
|
+
user: {
|
|
6487
|
+
id: user.id,
|
|
6488
|
+
accountId: user.accountId,
|
|
6489
|
+
},
|
|
6490
|
+
firstName: formData.firstName,
|
|
6491
|
+
lastName: formData.lastName,
|
|
6492
|
+
countryCode: formData.countryCode,
|
|
6493
|
+
currency: formData.currency,
|
|
6494
|
+
address: formData.address,
|
|
6495
|
+
city: formData.city,
|
|
6496
|
+
state: formData.state,
|
|
6497
|
+
postalCode: formData.postalCode,
|
|
6498
|
+
phoneNumber: formData.phoneNumber,
|
|
6499
|
+
phoneNumberCountryCode: formData.phoneNumberCountryCode,
|
|
6500
|
+
};
|
|
6501
|
+
const result = await connectImpactPartner({
|
|
6502
|
+
vars,
|
|
6503
|
+
});
|
|
6504
|
+
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
6505
|
+
throw new Error();
|
|
6506
|
+
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
6507
|
+
// Output backend errors to console for now
|
|
6508
|
+
console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
|
|
6509
|
+
throw new Error();
|
|
6510
|
+
}
|
|
6511
|
+
await refetch();
|
|
6512
|
+
const resultPublisher = (_e = (_d = (_c = result
|
|
6513
|
+
.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;
|
|
6514
|
+
const hasValidCurrentDocument = utils$1.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
6515
|
+
// Fire form change event
|
|
6516
|
+
window.dispatchEvent(new Event(data.TAX_FORM_UPDATED_EVENT_KEY));
|
|
6517
|
+
return {
|
|
6518
|
+
resultPublisher,
|
|
6519
|
+
hasValidCurrentDocument,
|
|
6520
|
+
};
|
|
6521
|
+
}
|
|
6295
6522
|
async function onSubmit(event) {
|
|
6296
6523
|
let formControls = event.target.getFormControls();
|
|
6297
6524
|
let formData = {};
|
|
@@ -6334,9 +6561,46 @@ function useUserInfoForm(props) {
|
|
|
6334
6561
|
postalCode: userData.postalCode,
|
|
6335
6562
|
currency: userData.currency,
|
|
6336
6563
|
});
|
|
6337
|
-
const
|
|
6564
|
+
const skipNextStep = getSkipNextStep(userData);
|
|
6565
|
+
if (skipNextStep) {
|
|
6566
|
+
try {
|
|
6567
|
+
const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
|
|
6568
|
+
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
6569
|
+
!hasValidCurrentDocument) {
|
|
6570
|
+
// Go to docusign form
|
|
6571
|
+
setStep("/3");
|
|
6572
|
+
}
|
|
6573
|
+
else {
|
|
6574
|
+
if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
|
|
6575
|
+
// Go to banking information form
|
|
6576
|
+
setStep("/4");
|
|
6577
|
+
}
|
|
6578
|
+
else {
|
|
6579
|
+
// Go right to the dashboard
|
|
6580
|
+
setStep("/dashboard");
|
|
6581
|
+
}
|
|
6582
|
+
}
|
|
6583
|
+
return;
|
|
6584
|
+
}
|
|
6585
|
+
catch (e) {
|
|
6586
|
+
setErrors({ general: true });
|
|
6587
|
+
return;
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6590
|
+
const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
|
|
6338
6591
|
setStep(nextStep);
|
|
6339
6592
|
}
|
|
6593
|
+
const indirectTaxCountry = (_a = tenantData === null || tenantData === void 0 ? void 0 : tenantData.tenantSettings) === null || _a === void 0 ? void 0 : _a.impactBrandIndirectTaxCountryCode;
|
|
6594
|
+
const hasIndirectTax = !!indirectTaxCountry;
|
|
6595
|
+
function getSkipNextStep(userData) {
|
|
6596
|
+
if (!hasIndirectTax)
|
|
6597
|
+
return true;
|
|
6598
|
+
if (userData.countryCode === "US")
|
|
6599
|
+
return true;
|
|
6600
|
+
if (hasIndirectTax && userData.countryCode !== indirectTaxCountry)
|
|
6601
|
+
return true;
|
|
6602
|
+
return false;
|
|
6603
|
+
}
|
|
6340
6604
|
const hasStates = ["ES", "AU", "US", "CA"].includes(userFormContext.countryCode);
|
|
6341
6605
|
const regionObj = hasStates
|
|
6342
6606
|
? IndirectTaxDetailsView.ADDRESS_REGIONS[userFormContext === null || userFormContext === void 0 ? void 0 : userFormContext.countryCode]
|
|
@@ -6364,16 +6628,17 @@ function useUserInfoForm(props) {
|
|
|
6364
6628
|
allCountries: countries,
|
|
6365
6629
|
regionLabelEnum: regionObj === null || regionObj === void 0 ? void 0 : regionObj.labelEnum,
|
|
6366
6630
|
regions: (regionObj === null || regionObj === void 0 ? void 0 : regionObj.regions) || [],
|
|
6631
|
+
partnerData: (_c = (_b = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _b === void 0 ? void 0 : _b.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher,
|
|
6367
6632
|
},
|
|
6368
6633
|
states: {
|
|
6369
6634
|
step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
|
|
6370
6635
|
hideState: !hasStates,
|
|
6371
6636
|
hideSteps: !!context.hideSteps,
|
|
6372
|
-
disabled: loading,
|
|
6637
|
+
disabled: loading || connectLoading,
|
|
6373
6638
|
loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
|
|
6374
|
-
loading: loading,
|
|
6375
|
-
isPartner: !!((
|
|
6376
|
-
isUser: !!((
|
|
6639
|
+
loading: loading || connectLoading,
|
|
6640
|
+
isPartner: !!((_e = (_d = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher),
|
|
6641
|
+
isUser: !!((_g = (_f = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.user),
|
|
6377
6642
|
formState: {
|
|
6378
6643
|
...userFormContext,
|
|
6379
6644
|
errors: formErrors,
|