@saasquatch/mint-components 1.15.5-0 → 1.15.5-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/sqm-banking-info-form_17.cjs.entry.js +125 -54
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +47 -40
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +24 -24
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +71 -5
- package/dist/esm/sqm-banking-info-form_17.entry.js +125 -54
- package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-ba14b5f7.system.entry.js +1 -0
- package/dist/mint-components/{p-28131538.entry.js → p-d0b404d5.entry.js} +2 -2
- package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +31 -0
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +12 -12
- package/dist/types/components.d.ts +24 -24
- package/docs/docs.docx +0 -0
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/mint-components/p-b24fae32.system.entry.js +0 -1
- package/dist/types/global/android.d.ts +0 -7
- package/dist/types/global/demo.d.ts +0 -2
- package/dist/types/stories/features.d.ts +0 -4
- package/dist/types/stories/templates.d.ts +0 -4
|
@@ -3045,8 +3045,51 @@ function useIndirectTaxForm(props) {
|
|
|
3045
3045
|
console.error("Could not detect select change");
|
|
3046
3046
|
setFormState((p) => ({ ...p, [field]: value }));
|
|
3047
3047
|
};
|
|
3048
|
-
|
|
3048
|
+
async function connectPartner(formData) {
|
|
3049
3049
|
var _a, _b, _c, _d, _e;
|
|
3050
|
+
const vars = {
|
|
3051
|
+
user: {
|
|
3052
|
+
id: user.id,
|
|
3053
|
+
accountId: user.accountId,
|
|
3054
|
+
},
|
|
3055
|
+
firstName: userForm.firstName,
|
|
3056
|
+
lastName: userForm.lastName,
|
|
3057
|
+
countryCode: userForm.countryCode,
|
|
3058
|
+
currency: userForm.currency,
|
|
3059
|
+
address: userForm.address,
|
|
3060
|
+
city: userForm.city,
|
|
3061
|
+
state: userForm.state,
|
|
3062
|
+
postalCode: userForm.postalCode,
|
|
3063
|
+
phoneNumber: userForm.phoneNumber,
|
|
3064
|
+
phoneNumberCountryCode: userForm.phoneNumberCountryCode,
|
|
3065
|
+
indirectTaxCountryCode: formData.selectedRegion,
|
|
3066
|
+
indirectTaxRegion: formData.province || formData.subRegion,
|
|
3067
|
+
indirectTaxId: formData.indirectTaxNumber,
|
|
3068
|
+
additionalTaxId: formData.qstNumber,
|
|
3069
|
+
withholdingTaxId: formData.subRegionTaxNumber,
|
|
3070
|
+
};
|
|
3071
|
+
const result = await connectImpactPartner({
|
|
3072
|
+
vars,
|
|
3073
|
+
});
|
|
3074
|
+
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
3075
|
+
throw new Error();
|
|
3076
|
+
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
3077
|
+
// Output backend errors to console for now
|
|
3078
|
+
console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
|
|
3079
|
+
throw new Error();
|
|
3080
|
+
}
|
|
3081
|
+
await refetch();
|
|
3082
|
+
const resultPublisher = (_e = (_d = (_c = result
|
|
3083
|
+
.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;
|
|
3084
|
+
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
3085
|
+
// Fire form change event
|
|
3086
|
+
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
3087
|
+
return {
|
|
3088
|
+
resultPublisher,
|
|
3089
|
+
hasValidCurrentDocument,
|
|
3090
|
+
};
|
|
3091
|
+
}
|
|
3092
|
+
const onSubmit = async (event) => {
|
|
3050
3093
|
if (!option) {
|
|
3051
3094
|
setErrors({ taxDetails: true });
|
|
3052
3095
|
return;
|
|
@@ -3072,44 +3115,7 @@ function useIndirectTaxForm(props) {
|
|
|
3072
3115
|
}
|
|
3073
3116
|
setLoading(true);
|
|
3074
3117
|
try {
|
|
3075
|
-
const
|
|
3076
|
-
user: {
|
|
3077
|
-
id: user.id,
|
|
3078
|
-
accountId: user.accountId,
|
|
3079
|
-
},
|
|
3080
|
-
firstName: userForm.firstName,
|
|
3081
|
-
lastName: userForm.lastName,
|
|
3082
|
-
countryCode: userForm.countryCode,
|
|
3083
|
-
currency: userForm.currency,
|
|
3084
|
-
address: userForm.address,
|
|
3085
|
-
city: userForm.city,
|
|
3086
|
-
state: userForm.state,
|
|
3087
|
-
postalCode: userForm.postalCode,
|
|
3088
|
-
phoneNumber: userForm.phoneNumber,
|
|
3089
|
-
phoneNumberCountryCode: userForm.phoneNumberCountryCode,
|
|
3090
|
-
indirectTaxCountryCode: formData.selectedRegion,
|
|
3091
|
-
indirectTaxRegion: formData.province || formData.subRegion,
|
|
3092
|
-
indirectTaxId: formData.indirectTaxNumber,
|
|
3093
|
-
additionalTaxId: formData.qstNumber,
|
|
3094
|
-
withholdingTaxId: formData.subRegionTaxNumber,
|
|
3095
|
-
};
|
|
3096
|
-
const result = await connectImpactPartner({
|
|
3097
|
-
vars,
|
|
3098
|
-
});
|
|
3099
|
-
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
3100
|
-
throw new Error();
|
|
3101
|
-
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
3102
|
-
// Output backend errors to console for now
|
|
3103
|
-
console.error("Failed to create Impact connection: ", result.createImpactConnection
|
|
3104
|
-
.validationErrors);
|
|
3105
|
-
throw new Error();
|
|
3106
|
-
}
|
|
3107
|
-
await refetch();
|
|
3108
|
-
const resultPublisher = (_e = (_d = (_c = result
|
|
3109
|
-
.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;
|
|
3110
|
-
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
3111
|
-
// Fire form change event
|
|
3112
|
-
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
3118
|
+
const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
|
|
3113
3119
|
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
3114
3120
|
!hasValidCurrentDocument) {
|
|
3115
3121
|
// Go to docusign form
|
|
@@ -3160,6 +3166,7 @@ function useIndirectTaxForm(props) {
|
|
|
3160
3166
|
...p,
|
|
3161
3167
|
hasSubRegionTaxNumber: !p.hasSubRegionTaxNumber,
|
|
3162
3168
|
})),
|
|
3169
|
+
connectPartner,
|
|
3163
3170
|
},
|
|
3164
3171
|
data: {
|
|
3165
3172
|
esRegions: INDIRECT_TAX_SPAIN_REGIONS,
|
|
@@ -5302,51 +5309,51 @@ const TaxAndCashMonolith = class {
|
|
|
5302
5309
|
*/
|
|
5303
5310
|
this.dashboard_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}.";
|
|
5304
5311
|
/**
|
|
5305
|
-
* @uiName
|
|
5312
|
+
* @uiName Payment on hold alert header
|
|
5306
5313
|
*/
|
|
5307
5314
|
this.dashboard_paymentOnHoldHeader = "We are reviewing your new payout settings";
|
|
5308
5315
|
/**
|
|
5309
|
-
* @uiName
|
|
5316
|
+
* @uiName Payment on hold alert description
|
|
5310
5317
|
*/
|
|
5311
5318
|
this.dashboard_paymentOnHoldDescription = "Your payout is temporarily on hold while we review your new payment information, this process is usually resolved within 48 hours.";
|
|
5312
5319
|
/**
|
|
5313
|
-
* @uiName
|
|
5320
|
+
* @uiName Beneficiary name invalid alert header
|
|
5314
5321
|
*/
|
|
5315
5322
|
this.dashboard_beneficiaryNameInvalidHeader = "Your payment information does not match your tax form";
|
|
5316
5323
|
/**
|
|
5317
|
-
* @uiName
|
|
5324
|
+
* @uiName Beneficiary name invalid description
|
|
5318
5325
|
*/
|
|
5319
5326
|
this.dashboard_beneficiaryNameInvalidDescription = "The beneficiary name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
|
|
5320
5327
|
/**
|
|
5321
|
-
* @uiName
|
|
5328
|
+
* @uiName Beneficiary name mismatch alert header
|
|
5322
5329
|
*/
|
|
5323
5330
|
this.dashboard_beneficiaryNameMismatchHeader = "Your payment information does not match your tax form";
|
|
5324
5331
|
/**
|
|
5325
|
-
* @uiName
|
|
5332
|
+
* @uiName Beneficiary name mismatch alert description
|
|
5326
5333
|
*/
|
|
5327
5334
|
this.dashboard_beneficiaryNameMismatchDescription = "The beneficiary name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
|
|
5328
5335
|
/**
|
|
5329
|
-
* @uiName
|
|
5336
|
+
* @uiName Bank name mismatch alert header
|
|
5330
5337
|
*/
|
|
5331
5338
|
this.dashboard_bankNameMismatchHeader = "Your payment information does not match your tax form";
|
|
5332
5339
|
/**
|
|
5333
|
-
* @uiName
|
|
5340
|
+
* @uiName Bank name mismatch alert description
|
|
5334
5341
|
*/
|
|
5335
5342
|
this.dashboard_bankNameMismatchDescription = "The bank name in your payment information does not match what was submitted in your tax form. Please review and update your payment information or tax form so that they match exactly and do not include any invalid characters. Your payouts are on hold until this is resolved.";
|
|
5336
5343
|
/**
|
|
5337
|
-
* @uiName
|
|
5344
|
+
* @uiName Withdrawal settings invalid alert header
|
|
5338
5345
|
*/
|
|
5339
5346
|
this.dashboard_withdrawalSettingsInvalidHeader = "Your payment information includes invalid characters";
|
|
5340
5347
|
/**
|
|
5341
|
-
* @uiName
|
|
5348
|
+
* @uiName Withdrawal settings invalid alert description
|
|
5342
5349
|
*/
|
|
5343
5350
|
this.dashboard_withdrawalSettingsInvalidDescription = "There are invalid characters in your payment information. Please review your information and make sure it is correct with no invalid characters. Your payouts are on hold until this is resolved.";
|
|
5344
5351
|
/**
|
|
5345
|
-
* @uiName
|
|
5352
|
+
* @uiName Payment returned alert header
|
|
5346
5353
|
*/
|
|
5347
5354
|
this.dashboard_paymentReturnedHeader = "Payout unsuccessful";
|
|
5348
5355
|
/**
|
|
5349
|
-
* @uiName
|
|
5356
|
+
* @uiName Payment returned alert description
|
|
5350
5357
|
*/
|
|
5351
5358
|
this.dashboard_paymentReturnedDescription = "Our recent payment attempt for your earnings was unsuccessful. Please review your payment information and make sure it is correct.";
|
|
5352
5359
|
/**
|
|
@@ -7978,7 +7985,9 @@ function useUserInfoForm(props) {
|
|
|
7978
7985
|
const countries = Fn(SORTED_COUNTRIES_NAMESPACE);
|
|
7979
7986
|
const [step, setStep] = Pn(TAX_CONTEXT_NAMESPACE);
|
|
7980
7987
|
const [userFormContext, setUserFormContext] = Pn(USER_FORM_CONTEXT_NAMESPACE);
|
|
7981
|
-
const
|
|
7988
|
+
const user = J();
|
|
7989
|
+
const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = $e(CONNECT_PARTNER);
|
|
7990
|
+
const { data, loading, refetch, errors: userError, } = $n(USER_QUERY_NAMESPACE);
|
|
7982
7991
|
const _currencies = Fn(CURRENCIES_NAMESPACE);
|
|
7983
7992
|
const currencies = useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
|
|
7984
7993
|
const [countrySearch, setCountrySearch] = useState("");
|
|
@@ -8080,6 +8089,45 @@ function useUserInfoForm(props) {
|
|
|
8080
8089
|
setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
|
|
8081
8090
|
}
|
|
8082
8091
|
}, [currencySearch, currencies]);
|
|
8092
|
+
async function connectPartner(formData) {
|
|
8093
|
+
var _a, _b, _c, _d, _e;
|
|
8094
|
+
const vars = {
|
|
8095
|
+
user: {
|
|
8096
|
+
id: user.id,
|
|
8097
|
+
accountId: user.accountId,
|
|
8098
|
+
},
|
|
8099
|
+
firstName: formData.firstName,
|
|
8100
|
+
lastName: formData.lastName,
|
|
8101
|
+
countryCode: formData.countryCode,
|
|
8102
|
+
currency: formData.currency,
|
|
8103
|
+
address: formData.address,
|
|
8104
|
+
city: formData.city,
|
|
8105
|
+
state: formData.state,
|
|
8106
|
+
postalCode: formData.postalCode,
|
|
8107
|
+
phoneNumber: formData.phoneNumber,
|
|
8108
|
+
phoneNumberCountryCode: formData.phoneNumberCountryCode,
|
|
8109
|
+
};
|
|
8110
|
+
const result = await connectImpactPartner({
|
|
8111
|
+
vars,
|
|
8112
|
+
});
|
|
8113
|
+
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
8114
|
+
throw new Error();
|
|
8115
|
+
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
8116
|
+
// Output backend errors to console for now
|
|
8117
|
+
console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
|
|
8118
|
+
throw new Error();
|
|
8119
|
+
}
|
|
8120
|
+
await refetch();
|
|
8121
|
+
const resultPublisher = (_e = (_d = (_c = result
|
|
8122
|
+
.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;
|
|
8123
|
+
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
8124
|
+
// Fire form change event
|
|
8125
|
+
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
8126
|
+
return {
|
|
8127
|
+
resultPublisher,
|
|
8128
|
+
hasValidCurrentDocument,
|
|
8129
|
+
};
|
|
8130
|
+
}
|
|
8083
8131
|
async function onSubmit(event) {
|
|
8084
8132
|
let formControls = event.target.getFormControls();
|
|
8085
8133
|
let formData = {};
|
|
@@ -8124,6 +8172,29 @@ function useUserInfoForm(props) {
|
|
|
8124
8172
|
});
|
|
8125
8173
|
const skipNextStep = getSkipNextStep(userData);
|
|
8126
8174
|
console.log({ skipNextStep });
|
|
8175
|
+
if (skipNextStep) {
|
|
8176
|
+
try {
|
|
8177
|
+
const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
|
|
8178
|
+
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
8179
|
+
!hasValidCurrentDocument) {
|
|
8180
|
+
// Go to docusign form
|
|
8181
|
+
setStep("/3");
|
|
8182
|
+
}
|
|
8183
|
+
else {
|
|
8184
|
+
if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
|
|
8185
|
+
// Go to banking information form
|
|
8186
|
+
setStep("/4");
|
|
8187
|
+
}
|
|
8188
|
+
else {
|
|
8189
|
+
// Go right to the dashboard
|
|
8190
|
+
setStep("/dashboard");
|
|
8191
|
+
}
|
|
8192
|
+
}
|
|
8193
|
+
}
|
|
8194
|
+
catch (e) {
|
|
8195
|
+
setErrors({ general: true });
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8127
8198
|
const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
|
|
8128
8199
|
setStep(nextStep);
|
|
8129
8200
|
}
|
|
@@ -8165,9 +8236,9 @@ function useUserInfoForm(props) {
|
|
|
8165
8236
|
step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
|
|
8166
8237
|
hideState: !hasStates,
|
|
8167
8238
|
hideSteps: !!context.hideSteps,
|
|
8168
|
-
disabled: loading,
|
|
8239
|
+
disabled: loading || connectLoading,
|
|
8169
8240
|
loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
|
|
8170
|
-
loading: loading,
|
|
8241
|
+
loading: loading || connectLoading,
|
|
8171
8242
|
isPartner: !!((_d = (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.publisher),
|
|
8172
8243
|
isUser: !!((_f = (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.impactConnection) === null || _f === void 0 ? void 0 : _f.user),
|
|
8173
8244
|
formState: {
|