@saasquatch/mint-components 2.0.2 → 2.0.3-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +340 -75
- package/dist/cjs/sqm-big-stat_47.cjs.entry.js +211 -10
- package/dist/cjs/sqm-header-logo.cjs.entry.js +14 -1
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +23 -2
- package/dist/collection/components/sqm-header-logo/sqm-header-logo.js +83 -3
- 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 +307 -7
- 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 +308 -8
- 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 +340 -75
- package/dist/esm/sqm-big-stat_47.entry.js +211 -10
- package/dist/esm/sqm-header-logo.entry.js +14 -1
- package/dist/esm/sqm-stencilbook.entry.js +23 -2
- 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-42760067.system.entry.js +1 -0
- package/dist/mint-components/p-7fb4470e.entry.js +1 -0
- package/dist/mint-components/p-8fa77acf.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-a2dbc9ad.system.js +6 -0
- package/dist/mint-components/{p-6976099f.entry.js → p-aabfb90f.entry.js} +2 -2
- package/dist/mint-components/{p-97747228.system.entry.js → p-bbdf93b6.system.entry.js} +1 -1
- package/dist/mint-components/{p-2ea6e2fa.entry.js → p-be0ca483.entry.js} +21 -21
- package/dist/mint-components/p-c0d60c61.entry.js +106 -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/mint-components/p-ffef3f95.system.entry.js +1 -0
- package/dist/types/components/sqm-header-logo/sqm-header-logo.d.ts +15 -1
- 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 +333 -1
- 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-303b84d7.system.entry.js +0 -1
- package/dist/mint-components/p-469a6450.system.js +0 -6
- package/dist/mint-components/p-752ede25.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
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import { useParent, useParentQueryValue, useParentValue, } from "@saasquatch/component-boilerplate";
|
|
1
|
+
import { useMutation, useParent, useParentQueryValue, useParentValue, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState, } from "@saasquatch/universal-hooks";
|
|
3
3
|
import jsonpointer from "jsonpointer";
|
|
4
4
|
import { CURRENCIES_NAMESPACE, SORTED_COUNTRIES_NAMESPACE, TAX_CONTEXT_NAMESPACE, TAX_FORM_CONTEXT_NAMESPACE, USER_FORM_CONTEXT_NAMESPACE, USER_QUERY_NAMESPACE, } from "../data";
|
|
5
5
|
import { ADDRESS_REGIONS } from "../subregions";
|
|
6
|
-
import { objectIsFull } from "../utils";
|
|
6
|
+
import { objectIsFull, validTaxDocument } from "../utils";
|
|
7
|
+
import { TAX_FORM_UPDATED_EVENT_KEY } from "../eventKeys";
|
|
8
|
+
import { CONNECT_PARTNER, } from "../sqm-indirect-tax-form/useIndirectTaxForm";
|
|
9
|
+
import { gql } from "graphql-request";
|
|
10
|
+
const GET_INDIRECT_TAX_COUNTRY_CODE = gql `
|
|
11
|
+
query getIndirectTaxCountryCode {
|
|
12
|
+
tenantSettings {
|
|
13
|
+
impactBrandCountryCode
|
|
14
|
+
impactBrandIndirectTaxCountryCode
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
7
18
|
export function useUserInfoForm(props) {
|
|
8
|
-
var _a, _b, _c, _d;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
9
20
|
const currencyRef = useRef(undefined);
|
|
10
21
|
const phoneCountryRef = useRef(undefined);
|
|
11
22
|
const formRef = useRef(null);
|
|
@@ -13,7 +24,10 @@ export function useUserInfoForm(props) {
|
|
|
13
24
|
const countries = useParentValue(SORTED_COUNTRIES_NAMESPACE);
|
|
14
25
|
const [step, setStep] = useParent(TAX_CONTEXT_NAMESPACE);
|
|
15
26
|
const [userFormContext, setUserFormContext] = useParent(USER_FORM_CONTEXT_NAMESPACE);
|
|
16
|
-
const
|
|
27
|
+
const user = useUserIdentity();
|
|
28
|
+
const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = useMutation(CONNECT_PARTNER);
|
|
29
|
+
const { data: tenantData } = useQuery(GET_INDIRECT_TAX_COUNTRY_CODE, {});
|
|
30
|
+
const { data, loading, refetch, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
17
31
|
const _currencies = useParentValue(CURRENCIES_NAMESPACE);
|
|
18
32
|
const currencies = useMemo(() => [...(_currencies || [])].sort((a, b) => a.displayName.localeCompare(b.displayName)), [_currencies]);
|
|
19
33
|
const [countrySearch, setCountrySearch] = useState("");
|
|
@@ -115,6 +129,45 @@ export function useUserInfoForm(props) {
|
|
|
115
129
|
setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
|
|
116
130
|
}
|
|
117
131
|
}, [currencySearch, currencies]);
|
|
132
|
+
async function connectPartner(formData) {
|
|
133
|
+
var _a, _b, _c, _d, _e;
|
|
134
|
+
const vars = {
|
|
135
|
+
user: {
|
|
136
|
+
id: user.id,
|
|
137
|
+
accountId: user.accountId,
|
|
138
|
+
},
|
|
139
|
+
firstName: formData.firstName,
|
|
140
|
+
lastName: formData.lastName,
|
|
141
|
+
countryCode: formData.countryCode,
|
|
142
|
+
currency: formData.currency,
|
|
143
|
+
address: formData.address,
|
|
144
|
+
city: formData.city,
|
|
145
|
+
state: formData.state,
|
|
146
|
+
postalCode: formData.postalCode,
|
|
147
|
+
phoneNumber: formData.phoneNumber,
|
|
148
|
+
phoneNumberCountryCode: formData.phoneNumberCountryCode,
|
|
149
|
+
};
|
|
150
|
+
const result = await connectImpactPartner({
|
|
151
|
+
vars,
|
|
152
|
+
});
|
|
153
|
+
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message))
|
|
154
|
+
throw new Error();
|
|
155
|
+
if (!((_b = result.createImpactConnection) === null || _b === void 0 ? void 0 : _b.success)) {
|
|
156
|
+
// Output backend errors to console for now
|
|
157
|
+
console.error("Failed to create Impact connection: ", result.createImpactConnection.validationErrors);
|
|
158
|
+
throw new Error();
|
|
159
|
+
}
|
|
160
|
+
await refetch();
|
|
161
|
+
const resultPublisher = (_e = (_d = (_c = result
|
|
162
|
+
.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;
|
|
163
|
+
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
164
|
+
// Fire form change event
|
|
165
|
+
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
166
|
+
return {
|
|
167
|
+
resultPublisher,
|
|
168
|
+
hasValidCurrentDocument,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
118
171
|
async function onSubmit(event) {
|
|
119
172
|
let formControls = event.target.getFormControls();
|
|
120
173
|
let formData = {};
|
|
@@ -157,9 +210,46 @@ export function useUserInfoForm(props) {
|
|
|
157
210
|
postalCode: userData.postalCode,
|
|
158
211
|
currency: userData.currency,
|
|
159
212
|
});
|
|
160
|
-
const
|
|
213
|
+
const skipNextStep = getSkipNextStep(userData);
|
|
214
|
+
if (skipNextStep) {
|
|
215
|
+
try {
|
|
216
|
+
const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
|
|
217
|
+
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
218
|
+
!hasValidCurrentDocument) {
|
|
219
|
+
// Go to docusign form
|
|
220
|
+
setStep("/3");
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
|
|
224
|
+
// Go to banking information form
|
|
225
|
+
setStep("/4");
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
// Go right to the dashboard
|
|
229
|
+
setStep("/dashboard");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
catch (e) {
|
|
235
|
+
setErrors({ general: true });
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
|
|
161
240
|
setStep(nextStep);
|
|
162
241
|
}
|
|
242
|
+
const indirectTaxCountry = (_a = tenantData === null || tenantData === void 0 ? void 0 : tenantData.tenantSettings) === null || _a === void 0 ? void 0 : _a.impactBrandIndirectTaxCountryCode;
|
|
243
|
+
const hasIndirectTax = !!indirectTaxCountry;
|
|
244
|
+
function getSkipNextStep(userData) {
|
|
245
|
+
if (!hasIndirectTax)
|
|
246
|
+
return true;
|
|
247
|
+
if (userData.countryCode === "US")
|
|
248
|
+
return true;
|
|
249
|
+
if (hasIndirectTax && userData.countryCode !== indirectTaxCountry)
|
|
250
|
+
return true;
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
163
253
|
const hasStates = ["ES", "AU", "US", "CA"].includes(userFormContext.countryCode);
|
|
164
254
|
const regionObj = hasStates
|
|
165
255
|
? ADDRESS_REGIONS[userFormContext === null || userFormContext === void 0 ? void 0 : userFormContext.countryCode]
|
|
@@ -187,16 +277,17 @@ export function useUserInfoForm(props) {
|
|
|
187
277
|
allCountries: countries,
|
|
188
278
|
regionLabelEnum: regionObj === null || regionObj === void 0 ? void 0 : regionObj.labelEnum,
|
|
189
279
|
regions: (regionObj === null || regionObj === void 0 ? void 0 : regionObj.regions) || [],
|
|
280
|
+
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,
|
|
190
281
|
},
|
|
191
282
|
states: {
|
|
192
283
|
step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
|
|
193
284
|
hideState: !hasStates,
|
|
194
285
|
hideSteps: !!context.hideSteps,
|
|
195
|
-
disabled: loading,
|
|
286
|
+
disabled: loading || connectLoading,
|
|
196
287
|
loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
|
|
197
|
-
loading: loading,
|
|
198
|
-
isPartner: !!((
|
|
199
|
-
isUser: !!((
|
|
288
|
+
loading: loading || connectLoading,
|
|
289
|
+
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),
|
|
290
|
+
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),
|
|
200
291
|
formState: {
|
|
201
292
|
...userFormContext,
|
|
202
293
|
errors: formErrors,
|
|
@@ -2849,14 +2849,14 @@ function ChangeMarktingView(props) {
|
|
|
2849
2849
|
}
|
|
2850
2850
|
|
|
2851
2851
|
const vanillaStyle$5 = `
|
|
2852
|
-
:host{
|
|
2852
|
+
:host {
|
|
2853
2853
|
margin: 0 auto;
|
|
2854
2854
|
width: 100%;
|
|
2855
2855
|
}
|
|
2856
|
-
a{
|
|
2856
|
+
a {
|
|
2857
2857
|
cursor:pointer;
|
|
2858
2858
|
color: var(--sqm-text-subdued);
|
|
2859
|
-
text-decoration: none
|
|
2859
|
+
text-decoration: none;
|
|
2860
2860
|
}
|
|
2861
2861
|
`;
|
|
2862
2862
|
function PortalFooterView(props) {
|
|
@@ -1000,7 +1000,7 @@ const GET_TAX_SETTING = dist.gql `
|
|
|
1000
1000
|
}
|
|
1001
1001
|
`;
|
|
1002
1002
|
function getStatus(data) {
|
|
1003
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1003
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
1004
1004
|
const account = (_b = (_a = data.user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.payoutsAccount;
|
|
1005
1005
|
const hasTransferredReward = (_e = (_d = (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.rewards) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.find((reward) => reward.statuses.includes("REDEEMED") &&
|
|
1006
1006
|
reward.partnerFundsTransfer.status === "TRANSFERRED");
|
|
@@ -1017,8 +1017,23 @@ function getStatus(data) {
|
|
|
1017
1017
|
return "VERIFICATION:REVIEW";
|
|
1018
1018
|
if ((_p = account.holdReasons) === null || _p === void 0 ? void 0 : _p.includes("IDV_CHECK_FAILED_INTERNAL"))
|
|
1019
1019
|
return "VERIFICATION:FAILED";
|
|
1020
|
+
// only show banner for NEW_PAYEE_REVIEW if a PFT was created
|
|
1020
1021
|
if (((_q = account.holdReasons) === null || _q === void 0 ? void 0 : _q.includes("NEW_PAYEE_REVIEW")) && hasTransferredReward)
|
|
1021
|
-
return "
|
|
1022
|
+
return "NEW_PAYEE_REVIEW";
|
|
1023
|
+
if ((_r = account.holdReasons) === null || _r === void 0 ? void 0 : _r.includes("NEW_PAYEE_REVIEW"))
|
|
1024
|
+
return "DONE";
|
|
1025
|
+
if ((_s = account.holdReasons) === null || _s === void 0 ? void 0 : _s.includes("PAYMENT_HOLD_ON_CHANGE"))
|
|
1026
|
+
return "PAYMENT_HOLD_ON_CHANGE";
|
|
1027
|
+
if ((_t = account.holdReasons) === null || _t === void 0 ? void 0 : _t.includes("BENEFICIARY_NAME_INVALID"))
|
|
1028
|
+
return "BENEFICIARY_NAME_INVALID";
|
|
1029
|
+
if ((_u = account.holdReasons) === null || _u === void 0 ? void 0 : _u.includes("BENEFICIARY_NAME_MISMATCH"))
|
|
1030
|
+
return "BENEFICIARY_NAME_MISMATCH";
|
|
1031
|
+
if ((_v = account.holdReasons) === null || _v === void 0 ? void 0 : _v.includes("BANK_TAX_NAME_MISMATCH"))
|
|
1032
|
+
return "BANK_TAX_NAME_MISMATCH";
|
|
1033
|
+
if ((_w = account.holdReasons) === null || _w === void 0 ? void 0 : _w.includes("WITHDRAWAL_SETTINGS_INVALID"))
|
|
1034
|
+
return "WITHDRAWAL_SETTINGS_INVALID";
|
|
1035
|
+
if ((_x = account.holdReasons) === null || _x === void 0 ? void 0 : _x.includes("PAYMENT_RETURNED"))
|
|
1036
|
+
return "PAYMENT_RETURNED";
|
|
1022
1037
|
if (account.hold)
|
|
1023
1038
|
return "HOLD";
|
|
1024
1039
|
return "DONE";
|
|
@@ -1057,6 +1072,16 @@ function usePayoutStatus(props) {
|
|
|
1057
1072
|
url += "#3";
|
|
1058
1073
|
window.history.pushState(null, "", url);
|
|
1059
1074
|
};
|
|
1075
|
+
const onPaymentInfoClick = () => {
|
|
1076
|
+
let url = props.cashPayoutsPageUrl;
|
|
1077
|
+
url += "#4";
|
|
1078
|
+
window.history.pushState(null, "", url);
|
|
1079
|
+
};
|
|
1080
|
+
const onNewFormClick = () => {
|
|
1081
|
+
let url = props.cashPayoutsPageUrl;
|
|
1082
|
+
url += "#3";
|
|
1083
|
+
window.history.pushState(null, "", url);
|
|
1084
|
+
};
|
|
1060
1085
|
return {
|
|
1061
1086
|
states: {
|
|
1062
1087
|
loading,
|
|
@@ -1070,6 +1095,8 @@ function usePayoutStatus(props) {
|
|
|
1070
1095
|
callbacks: {
|
|
1071
1096
|
onTermsClick,
|
|
1072
1097
|
onClick: render,
|
|
1098
|
+
onPaymentInfoClick,
|
|
1099
|
+
onNewFormClick,
|
|
1073
1100
|
},
|
|
1074
1101
|
};
|
|
1075
1102
|
}
|