@saasquatch/mint-components 2.3.0-11 → 2.3.0-13
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/{usePortalRegistrationForm-23ee2d62.js → AsYouType-d15caac8.js} +265 -223
- package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +46 -27
- package/dist/cjs/sqm-big-stat_47.cjs.entry.js +17 -13
- package/dist/cjs/sqm-portal-forgot-password_6.cjs.entry.js +3 -2
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +59 -2
- package/dist/cjs/{sqm-user-info-form-view-8f7186b8.js → sqm-user-info-form-view-60e09262.js} +1004 -8
- package/dist/cjs/subregions-3542b0b8.js +1068 -0
- package/dist/cjs/{useIndirectTaxForm-112914a0.js → useIndirectTaxForm-c439eb81.js} +6 -2
- package/dist/cjs/usePortalRegistrationForm-8a3a14ac.js +215 -0
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +3 -0
- package/dist/collection/components/tax-and-cash/phoneExtensions.js +12 -0
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.js +8 -0
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +2 -1
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +5 -1
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +12 -9
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.js +52 -0
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +18 -5
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +3 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +31 -27
- package/dist/collection/components/tax-and-cash/utils.js +30 -27
- package/dist/esm/{usePortalRegistrationForm-3a1f36a2.js → AsYouType-2d56519e.js} +248 -223
- package/dist/esm/sqm-banking-info-form_10.entry.js +46 -27
- package/dist/esm/sqm-big-stat_47.entry.js +16 -12
- package/dist/esm/sqm-portal-forgot-password_6.entry.js +2 -1
- package/dist/esm/sqm-stencilbook.entry.js +59 -2
- package/dist/esm/{sqm-user-info-form-view-599a6922.js → sqm-user-info-form-view-647a2bd5.js} +1002 -6
- package/dist/esm/subregions-7c5112e8.js +1055 -0
- package/dist/esm/{useIndirectTaxForm-a6ac7e7e.js → useIndirectTaxForm-38cd984e.js} +6 -2
- package/dist/esm/usePortalRegistrationForm-78fdfd93.js +213 -0
- package/dist/esm-es5/AsYouType-2d56519e.js +1 -0
- 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-portal-forgot-password_6.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-user-info-form-view-647a2bd5.js +1 -0
- package/dist/esm-es5/subregions-7c5112e8.js +1 -0
- package/dist/esm-es5/{useIndirectTaxForm-a6ac7e7e.js → useIndirectTaxForm-38cd984e.js} +2 -2
- package/dist/esm-es5/usePortalRegistrationForm-78fdfd93.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-1f387c7b.system.js +1 -1
- package/dist/mint-components/p-34179541.system.js +1 -0
- package/dist/mint-components/p-4065ae93.entry.js +9 -0
- package/dist/mint-components/p-5c3bff99.entry.js +1 -0
- package/dist/mint-components/p-6fd8981d.system.entry.js +1 -0
- package/dist/mint-components/p-769166a5.system.js +1 -0
- package/dist/mint-components/p-7c72eeb5.js +1 -0
- package/dist/mint-components/p-8d30945a.js +1 -0
- package/dist/mint-components/p-8dcd72fe.system.entry.js +1 -0
- package/dist/mint-components/p-a08157c4.js +1 -0
- package/dist/mint-components/p-a779e577.js +13 -0
- package/dist/mint-components/{p-2d4132fb.js → p-aa2c6585.js} +7 -5
- package/dist/mint-components/{p-6ef373ed.system.js → p-aab8a207.system.js} +2 -2
- package/dist/mint-components/p-af8b8c06.system.entry.js +1 -0
- package/dist/mint-components/{p-86231add.entry.js → p-b3f25c0e.entry.js} +8 -8
- package/dist/mint-components/p-c31966e3.system.entry.js +1 -0
- package/dist/mint-components/p-d463fa82.system.js +1 -0
- package/dist/mint-components/{p-339ce676.entry.js → p-dd5c1db9.entry.js} +11 -11
- package/dist/mint-components/p-ee91aeac.system.js +1 -0
- package/dist/types/components/tax-and-cash/phoneExtensions.d.ts +12 -0
- package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.d.ts +1 -0
- package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +1 -0
- package/dist/types/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.d.ts +1 -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 +2 -0
- package/dist/types/components/tax-and-cash/utils.d.ts +8 -2
- package/docs/docs.docx +0 -0
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/subregions-984e30d7.js +0 -1505
- package/dist/esm/subregions-7c9778d0.js +0 -1492
- package/dist/esm-es5/sqm-user-info-form-view-599a6922.js +0 -1
- package/dist/esm-es5/subregions-7c9778d0.js +0 -1
- package/dist/esm-es5/usePortalRegistrationForm-3a1f36a2.js +0 -1
- package/dist/mint-components/p-26a4ebfd.js +0 -1
- package/dist/mint-components/p-335a5736.entry.js +0 -1
- package/dist/mint-components/p-3a41b39c.js +0 -13
- package/dist/mint-components/p-40894343.entry.js +0 -9
- package/dist/mint-components/p-5fdf0286.system.js +0 -1
- package/dist/mint-components/p-7f29622d.js +0 -1
- package/dist/mint-components/p-81270b9f.system.js +0 -1
- package/dist/mint-components/p-b62d8b95.system.entry.js +0 -1
- package/dist/mint-components/p-bd03efe0.system.js +0 -1
- package/dist/mint-components/p-c9d2ccfc.system.entry.js +0 -1
- package/dist/mint-components/p-db6bf7cf.system.entry.js +0 -1
- package/dist/mint-components/p-f0ef09a0.system.entry.js +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const domContextHooks_module = require('./dom-context-hooks.module-e7b6727c.js');
|
|
4
4
|
const index_module = require('./index.module-f8c8495f.js');
|
|
5
5
|
const jsonpointer = require('./jsonpointer-11327262.js');
|
|
6
|
-
const subregions = require('./subregions-
|
|
6
|
+
const subregions = require('./subregions-3542b0b8.js');
|
|
7
7
|
const data = require('./data-89ac73dd.js');
|
|
8
8
|
const eventKeys = require('./eventKeys-7af4df4d.js');
|
|
9
9
|
|
|
@@ -1151,6 +1151,8 @@ const COMPLETE_PARTNER = index_module.dist.gql `
|
|
|
1151
1151
|
impactConnection {
|
|
1152
1152
|
connected
|
|
1153
1153
|
publisher {
|
|
1154
|
+
phoneNumber
|
|
1155
|
+
phoneNumberCountryCode
|
|
1154
1156
|
brandedSignup
|
|
1155
1157
|
requiredTaxDocumentType
|
|
1156
1158
|
currentTaxDocument {
|
|
@@ -1174,7 +1176,7 @@ function getOption(countries, countryCode) {
|
|
|
1174
1176
|
}
|
|
1175
1177
|
}
|
|
1176
1178
|
function useIndirectTaxForm(props) {
|
|
1177
|
-
var _a, _b, _c, _d, _e;
|
|
1179
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1178
1180
|
const user = index_module.J();
|
|
1179
1181
|
const locale = index_module.L();
|
|
1180
1182
|
const formRef = domContextHooks_module.useRef(null);
|
|
@@ -1359,6 +1361,8 @@ function useIndirectTaxForm(props) {
|
|
|
1359
1361
|
disabled: loading || countriesLoading || connectLoading || completeLoading,
|
|
1360
1362
|
loading: loading || connectLoading || countriesLoading || completeLoading,
|
|
1361
1363
|
isPartner: !!((_e = (_d = userData === null || userData === void 0 ? void 0 : userData.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher),
|
|
1364
|
+
isPartnerLegacy: !!((_g = (_f = userData === null || userData === void 0 ? void 0 : userData.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher) &&
|
|
1365
|
+
((_j = (_h = userData === null || userData === void 0 ? void 0 : userData.user) === null || _h === void 0 ? void 0 : _h.impactConnection) === null || _j === void 0 ? void 0 : _j.connectionStatus) !== "STARTED",
|
|
1362
1366
|
loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
|
|
1363
1367
|
formState: {
|
|
1364
1368
|
checked: option,
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const domContextHooks_module = require('./dom-context-hooks.module-e7b6727c.js');
|
|
4
|
+
const index_module = require('./index.module-f8c8495f.js');
|
|
5
|
+
const jsonpointer = require('./jsonpointer-11327262.js');
|
|
6
|
+
const AsYouType = require('./AsYouType-d15caac8.js');
|
|
7
|
+
const useRegistrationFormState = require('./useRegistrationFormState-4fe5b770.js');
|
|
8
|
+
|
|
9
|
+
const RegistrationFormQuery = index_module.dist.gql `
|
|
10
|
+
query RegistrationFormQuery($key: String!) {
|
|
11
|
+
form(key: $key) {
|
|
12
|
+
key
|
|
13
|
+
type
|
|
14
|
+
initialData {
|
|
15
|
+
initialData
|
|
16
|
+
isEnabled
|
|
17
|
+
isEnabledErrorMessage
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
function usePortalRegistrationForm(props) {
|
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
24
|
+
const formRef = domContextHooks_module.useRef(null);
|
|
25
|
+
const locale = index_module.L();
|
|
26
|
+
const { registrationFormState, setRegistrationFormState } = useRegistrationFormState.useRegistrationFormState({});
|
|
27
|
+
const [request, { loading, errors, data, formError }] = index_module.Oe();
|
|
28
|
+
const queryResponse = index_module.wn(RegistrationFormQuery, { key: props.formKey });
|
|
29
|
+
const formLoading = loading || queryResponse.loading;
|
|
30
|
+
domContextHooks_module.useEffect(() => {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
const initialData = (_a = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _a === void 0 ? void 0 : _a.form.initialData.initialData;
|
|
33
|
+
const disabled = ((_b = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _b === void 0 ? void 0 : _b.form.initialData.isEnabled) === false;
|
|
34
|
+
const disabledMessage = ((_c = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _c === void 0 ? void 0 : _c.form.initialData.isEnabledErrorMessage) ||
|
|
35
|
+
props.formDisabledErrorMessage;
|
|
36
|
+
const formState = {
|
|
37
|
+
loading: formLoading,
|
|
38
|
+
disabled,
|
|
39
|
+
disabledMessage,
|
|
40
|
+
initialData,
|
|
41
|
+
};
|
|
42
|
+
setRegistrationFormState(formState);
|
|
43
|
+
}, [(_a = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _a === void 0 ? void 0 : _a.form.initialData]);
|
|
44
|
+
domContextHooks_module.useEffect(() => {
|
|
45
|
+
if (!formRef.current)
|
|
46
|
+
return;
|
|
47
|
+
const form = formRef.current;
|
|
48
|
+
form.addEventListener("sl-input", inputFunction);
|
|
49
|
+
return () => {
|
|
50
|
+
form.removeEventListener("sl-input", inputFunction);
|
|
51
|
+
};
|
|
52
|
+
}, [formRef.current]);
|
|
53
|
+
const submit = async (event) => {
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
55
|
+
let formControls = event.target.getFormControls();
|
|
56
|
+
let formData = {};
|
|
57
|
+
let validationErrors = {};
|
|
58
|
+
formControls === null || formControls === void 0 ? void 0 : formControls.forEach((control) => {
|
|
59
|
+
if (!control.name)
|
|
60
|
+
return;
|
|
61
|
+
const key = control.name;
|
|
62
|
+
const value = control.value;
|
|
63
|
+
// control.value = initialData[key] || control.value;
|
|
64
|
+
jsonpointer.jsonpointer.set(formData, key, value);
|
|
65
|
+
// required validation
|
|
66
|
+
if (control.required && !value) {
|
|
67
|
+
jsonpointer.jsonpointer.set(validationErrors, key, props.requiredFieldErrorMessage);
|
|
68
|
+
}
|
|
69
|
+
// custom validation
|
|
70
|
+
if (typeof control.validationError === "function") {
|
|
71
|
+
const validate = control.validationError;
|
|
72
|
+
const validationError = validate({ control, key, value });
|
|
73
|
+
if (validationError)
|
|
74
|
+
jsonpointer.jsonpointer.set(validationErrors, key, validationError);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
if ((props.confirmPassword || formData.confirmPassword) &&
|
|
78
|
+
formData.password !== formData.confirmPassword) {
|
|
79
|
+
validationErrors = {
|
|
80
|
+
...validationErrors,
|
|
81
|
+
confirmPassword: props.passwordMismatchErrorMessage,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (Object.keys(validationErrors).length) {
|
|
85
|
+
// early return for validation errors
|
|
86
|
+
setRegistrationFormState({
|
|
87
|
+
...registrationFormState,
|
|
88
|
+
loading: false,
|
|
89
|
+
error: "",
|
|
90
|
+
validationErrors,
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
setRegistrationFormState({
|
|
95
|
+
...registrationFormState,
|
|
96
|
+
loading: true,
|
|
97
|
+
error: "",
|
|
98
|
+
validationErrors: {},
|
|
99
|
+
});
|
|
100
|
+
const { email, password } = formData;
|
|
101
|
+
delete formData.email;
|
|
102
|
+
delete formData.password;
|
|
103
|
+
delete formData.confirmPassword;
|
|
104
|
+
const redirectPath = props.redirectPath;
|
|
105
|
+
const _googleOAuthIdToken = registrationFormState._googleOAuthIdToken;
|
|
106
|
+
const variables = {
|
|
107
|
+
key: props.formKey,
|
|
108
|
+
formData: {
|
|
109
|
+
...(_googleOAuthIdToken ? { _googleOAuthIdToken } : {}),
|
|
110
|
+
locale,
|
|
111
|
+
email,
|
|
112
|
+
password,
|
|
113
|
+
redirectPath,
|
|
114
|
+
...formData,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
try {
|
|
118
|
+
const result = await request(variables);
|
|
119
|
+
if (result instanceof Error) {
|
|
120
|
+
throw result;
|
|
121
|
+
}
|
|
122
|
+
setRegistrationFormState({
|
|
123
|
+
...registrationFormState,
|
|
124
|
+
loading: false,
|
|
125
|
+
error: "",
|
|
126
|
+
validationErrors: {},
|
|
127
|
+
});
|
|
128
|
+
const managedIdentityResponse = (_a = result.submitForm) === null || _a === void 0 ? void 0 : _a.results.find((result) => { var _a; return ((_a = result === null || result === void 0 ? void 0 : result.formHandler) === null || _a === void 0 ? void 0 : _a.namespace) === "identity"; });
|
|
129
|
+
if (managedIdentityResponse &&
|
|
130
|
+
managedIdentityResponse.result.results.length &&
|
|
131
|
+
managedIdentityResponse.result.results[0].success &&
|
|
132
|
+
managedIdentityResponse.result.results[0].data.token) {
|
|
133
|
+
index_module.jn.push(props.nextPage);
|
|
134
|
+
}
|
|
135
|
+
else if (
|
|
136
|
+
// check for blocked email error response
|
|
137
|
+
((_b = result.submitForm) === null || _b === void 0 ? void 0 : _b.results.length) === 1 &&
|
|
138
|
+
((_f = (_e = (_d = (_c = result.submitForm) === null || _c === void 0 ? void 0 : _c.results[0]) === null || _d === void 0 ? void 0 : _d.result) === null || _e === void 0 ? void 0 : _e.results) === null || _f === void 0 ? void 0 : _f.length) === 1 &&
|
|
139
|
+
((_l = (_k = (_j = (_h = (_g = result.submitForm) === null || _g === void 0 ? void 0 : _g.results[0]) === null || _h === void 0 ? void 0 : _h.result) === null || _j === void 0 ? void 0 : _j.results) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.success) ===
|
|
140
|
+
false && ((_s = (_r = (_q = (_p = (_o = (_m = result.submitForm) === null || _m === void 0 ? void 0 : _m.results[0]) === null || _o === void 0 ? void 0 : _o.result) === null || _p === void 0 ? void 0 : _p.results) === null || _q === void 0 ? void 0 : _q[0]) === null || _r === void 0 ? void 0 : _r.message) === null || _s === void 0 ? void 0 : _s.startsWith("Blocked email"))) {
|
|
141
|
+
setRegistrationFormState({
|
|
142
|
+
...registrationFormState,
|
|
143
|
+
loading: false,
|
|
144
|
+
error: "",
|
|
145
|
+
validationErrors: {
|
|
146
|
+
email: props.invalidEmailErrorMessage,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
// check for invalid email
|
|
153
|
+
if ((_t = error === null || error === void 0 ? void 0 : error.message) === null || _t === void 0 ? void 0 : _t.includes("is not a valid email address")) {
|
|
154
|
+
setRegistrationFormState({
|
|
155
|
+
...registrationFormState,
|
|
156
|
+
loading: false,
|
|
157
|
+
error: "",
|
|
158
|
+
validationErrors: { email: props.invalidEmailErrorMessage },
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
setRegistrationFormState({
|
|
163
|
+
...registrationFormState,
|
|
164
|
+
loading: false,
|
|
165
|
+
error: props.networkErrorMessage,
|
|
166
|
+
validationErrors: {},
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const inputFunction = index_module.useCallback((e) => {
|
|
172
|
+
var _a, _b;
|
|
173
|
+
const name = (_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
174
|
+
if (name !== "tel")
|
|
175
|
+
return;
|
|
176
|
+
const asYouType = new AsYouType.AsYouType("US");
|
|
177
|
+
e.target.value = asYouType.input(e.target.value);
|
|
178
|
+
}, []);
|
|
179
|
+
let errorMessage = "";
|
|
180
|
+
if (((_b = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _b === void 0 ? void 0 : _b.form.initialData.isEnabled) === false) {
|
|
181
|
+
errorMessage =
|
|
182
|
+
((_c = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _c === void 0 ? void 0 : _c.form.initialData.isEnabledErrorMessage) ||
|
|
183
|
+
props.formDisabledErrorMessage;
|
|
184
|
+
}
|
|
185
|
+
else if ((_d = errors === null || errors === void 0 ? void 0 : errors.response) === null || _d === void 0 ? void 0 : _d["error"]) {
|
|
186
|
+
errorMessage = props.networkErrorMessage;
|
|
187
|
+
}
|
|
188
|
+
else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((_e = errors === null || errors === void 0 ? void 0 : errors.response) === null || _e === void 0 ? void 0 : _e.errors.length)) {
|
|
189
|
+
errorMessage = props.networkErrorMessage;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
errorMessage =
|
|
193
|
+
formError || ((_j = (_h = (_g = (_f = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.errors) === null || _f === void 0 ? void 0 : _f.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) || (registrationFormState === null || registrationFormState === void 0 ? void 0 : registrationFormState.error);
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
states: {
|
|
197
|
+
loading: loading || queryResponse.loading,
|
|
198
|
+
error: errorMessage,
|
|
199
|
+
registrationFormState,
|
|
200
|
+
confirmPassword: props.confirmPassword,
|
|
201
|
+
hideInputs: props.hideInputs,
|
|
202
|
+
loginPath: props.loginPath,
|
|
203
|
+
enablePasswordValidation: !props.disablePasswordValidation,
|
|
204
|
+
},
|
|
205
|
+
callbacks: {
|
|
206
|
+
submit,
|
|
207
|
+
inputFunction,
|
|
208
|
+
},
|
|
209
|
+
refs: {
|
|
210
|
+
formRef,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
exports.usePortalRegistrationForm = usePortalRegistrationForm;
|
|
@@ -14,6 +14,8 @@ const stepOneProps = {
|
|
|
14
14
|
disabled: false,
|
|
15
15
|
isPartner: false,
|
|
16
16
|
isUser: false,
|
|
17
|
+
isPartnerLegacy: false,
|
|
18
|
+
isUserLegacy: false,
|
|
17
19
|
loadingError: false,
|
|
18
20
|
formState: {
|
|
19
21
|
firstName: "Bob",
|
|
@@ -134,6 +136,7 @@ const stepTwoProps = {
|
|
|
134
136
|
disabled: false,
|
|
135
137
|
loading: false,
|
|
136
138
|
isPartner: false,
|
|
139
|
+
isPartnerLegacy: false,
|
|
137
140
|
loadingError: false,
|
|
138
141
|
formState: {
|
|
139
142
|
checked: undefined,
|
|
@@ -219,6 +219,10 @@ export const PHONE_EXTENSIONS = {
|
|
|
219
219
|
name: "Cuba",
|
|
220
220
|
dial_code: "+53",
|
|
221
221
|
},
|
|
222
|
+
CW: {
|
|
223
|
+
name: "Curaçao",
|
|
224
|
+
dial_code: "+599",
|
|
225
|
+
},
|
|
222
226
|
CY: {
|
|
223
227
|
name: "Cyprus",
|
|
224
228
|
dial_code: "+357",
|
|
@@ -299,6 +303,10 @@ export const PHONE_EXTENSIONS = {
|
|
|
299
303
|
name: "French Polynesia",
|
|
300
304
|
dial_code: "+689",
|
|
301
305
|
},
|
|
306
|
+
TF: {
|
|
307
|
+
name: "French Southern Territories",
|
|
308
|
+
dial_code: "+262",
|
|
309
|
+
},
|
|
302
310
|
GA: {
|
|
303
311
|
name: "Gabon",
|
|
304
312
|
dial_code: "+241",
|
|
@@ -955,6 +963,10 @@ export const PHONE_EXTENSIONS = {
|
|
|
955
963
|
name: "Wallis and Futuna",
|
|
956
964
|
dial_code: "+681",
|
|
957
965
|
},
|
|
966
|
+
EH: {
|
|
967
|
+
name: "Western Sahara",
|
|
968
|
+
dial_code: "+212",
|
|
969
|
+
},
|
|
958
970
|
YE: {
|
|
959
971
|
name: "Yemen",
|
|
960
972
|
dial_code: "+967",
|
package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.js
CHANGED
|
@@ -157,6 +157,14 @@ export const IndirectTaxFormView = (props) => {
|
|
|
157
157
|
}, {
|
|
158
158
|
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
159
159
|
}))),
|
|
160
|
+
states.isPartnerLegacy && (h("sqm-form-message", { loading: states.loading, type: "info" },
|
|
161
|
+
h("p", { part: "alert-title" }, text.isPartnerAlertHeader),
|
|
162
|
+
intl.formatMessage({
|
|
163
|
+
id: "isPartnerAlertDescription",
|
|
164
|
+
defaultMessage: text.isPartnerAlertDescription,
|
|
165
|
+
}, {
|
|
166
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
167
|
+
}))),
|
|
160
168
|
h("div", null,
|
|
161
169
|
h("h4", null, text.indirectTaxDetails))),
|
|
162
170
|
states.loading ? (h("sl-spinner", { style: { fontSize: "50px", margin: "40px" } })) : (h("div", null,
|
package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js
CHANGED
|
@@ -887,7 +887,7 @@ export class IndirectTaxForm {
|
|
|
887
887
|
"mutable": false,
|
|
888
888
|
"complexType": {
|
|
889
889
|
"original": "DemoData<UseIndirectTaxFormResult>",
|
|
890
|
-
"resolved": "{ states?: { step: string; hideSteps: boolean; disabled: boolean; loading: boolean; isPartner: boolean; loadingError: boolean; formState: { checked: \"hstCanada\" | \"otherRegion\" | \"notRegistered\"; errors: {}; }; }; refs?: { formRef: Ref<HTMLFormElement>; }; data?: { esRegions: { regionCode: string; taxType: string; displayName: string; }[]; countries: { countryCode: string; displayName: any; }[]; allCountries: { countryCode: string; displayName: any; }[]; provinces: { regionCode: string; taxType: string; displayName: string; }[]; }; slotProps?: { formState: { selectedRegion?: string; subRegion?: string; subRegionTaxNumber?: string; qstNumber?: string; province?: string; indirectTaxNumber?: string; hasQst?: boolean; hasSubRegionTaxNumber?: boolean; errors?: any; error?: string; }; }; }",
|
|
890
|
+
"resolved": "{ states?: { step: string; hideSteps: boolean; disabled: boolean; loading: boolean; isPartner: boolean; isPartnerLegacy: boolean; loadingError: boolean; formState: { checked: \"hstCanada\" | \"otherRegion\" | \"notRegistered\"; errors: {}; }; }; refs?: { formRef: Ref<HTMLFormElement>; }; data?: { esRegions: { regionCode: string; taxType: string; displayName: string; }[]; countries: { countryCode: string; displayName: any; }[]; allCountries: { countryCode: string; displayName: any; }[]; provinces: { regionCode: string; taxType: string; displayName: string; }[]; }; slotProps?: { formState: { selectedRegion?: string; subRegion?: string; subRegionTaxNumber?: string; qstNumber?: string; province?: string; indirectTaxNumber?: string; hasQst?: boolean; hasSubRegionTaxNumber?: boolean; errors?: any; error?: string; }; }; }",
|
|
891
891
|
"references": {
|
|
892
892
|
"DemoData": {
|
|
893
893
|
"location": "import",
|
|
@@ -921,6 +921,7 @@ function useDemoIndirectTaxForm(props) {
|
|
|
921
921
|
disabled: false,
|
|
922
922
|
loading: false,
|
|
923
923
|
isPartner: false,
|
|
924
|
+
isPartnerLegacy: false,
|
|
924
925
|
loadingError: false,
|
|
925
926
|
errors: {},
|
|
926
927
|
formState: {
|
|
@@ -46,6 +46,8 @@ export const COMPLETE_PARTNER = gql `
|
|
|
46
46
|
impactConnection {
|
|
47
47
|
connected
|
|
48
48
|
publisher {
|
|
49
|
+
phoneNumber
|
|
50
|
+
phoneNumberCountryCode
|
|
49
51
|
brandedSignup
|
|
50
52
|
requiredTaxDocumentType
|
|
51
53
|
currentTaxDocument {
|
|
@@ -69,7 +71,7 @@ function getOption(countries, countryCode) {
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
export function useIndirectTaxForm(props) {
|
|
72
|
-
var _a, _b, _c, _d, _e;
|
|
74
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
73
75
|
const user = useUserIdentity();
|
|
74
76
|
const locale = useLocale();
|
|
75
77
|
const formRef = useRef(null);
|
|
@@ -254,6 +256,8 @@ export function useIndirectTaxForm(props) {
|
|
|
254
256
|
disabled: loading || countriesLoading || connectLoading || completeLoading,
|
|
255
257
|
loading: loading || connectLoading || countriesLoading || completeLoading,
|
|
256
258
|
isPartner: !!((_e = (_d = userData === null || userData === void 0 ? void 0 : userData.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher),
|
|
259
|
+
isPartnerLegacy: !!((_g = (_f = userData === null || userData === void 0 ? void 0 : userData.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher) &&
|
|
260
|
+
((_j = (_h = userData === null || userData === void 0 ? void 0 : userData.user) === null || _h === void 0 ? void 0 : _h.impactConnection) === null || _j === void 0 ? void 0 : _j.connectionStatus) !== "STARTED",
|
|
257
261
|
loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
|
|
258
262
|
formState: {
|
|
259
263
|
checked: option,
|
|
@@ -9,15 +9,18 @@ function getCurrentStep(user) {
|
|
|
9
9
|
return "/1";
|
|
10
10
|
}
|
|
11
11
|
const { requiredTaxDocumentType, currentTaxDocument, withdrawalSettings, brandedSignup, payoutsAccount, billingAddress, billingCity, billingCountryCode, billingPostalCode, phoneNumber, phoneNumberCountryCode, } = user.impactConnection.publisher;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const isCompleted = user.impactConnection.connectionStatus === "COMPLETED";
|
|
13
|
+
if (!isCompleted) {
|
|
14
|
+
const hasBillingInfo = billingAddress &&
|
|
15
|
+
billingCity &&
|
|
16
|
+
billingCountryCode &&
|
|
17
|
+
billingPostalCode &&
|
|
18
|
+
phoneNumberCountryCode &&
|
|
19
|
+
phoneNumber &&
|
|
20
|
+
isValidI18nPhoneNumber(phoneNumberCountryCode, phoneNumber);
|
|
21
|
+
if (!hasBillingInfo) {
|
|
22
|
+
return "/1";
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
// If they do have a required document, look at current document
|
|
23
26
|
if (requiredTaxDocumentType && !currentTaxDocument) {
|
package/dist/collection/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.js
CHANGED
|
@@ -11,6 +11,11 @@ const mockCountries = [
|
|
|
11
11
|
{ countryCode: "DE", displayName: "Germany" },
|
|
12
12
|
{ countryCode: "FR", displayName: "France" },
|
|
13
13
|
{ countryCode: "ES", displayName: "Spain" },
|
|
14
|
+
// Show handling of long country names
|
|
15
|
+
{
|
|
16
|
+
countryCode: "CD",
|
|
17
|
+
displayName: "Congo, The Democratic Republic of the Congo",
|
|
18
|
+
},
|
|
14
19
|
];
|
|
15
20
|
const mockCurrencies = [
|
|
16
21
|
{ currencyCode: "USD", displayName: "US Dollar" },
|
|
@@ -101,6 +106,8 @@ const baseProps = {
|
|
|
101
106
|
loading: false,
|
|
102
107
|
isPartner: false,
|
|
103
108
|
isUser: false,
|
|
109
|
+
isPartnerLegacy: false,
|
|
110
|
+
isUserLegacy: false,
|
|
104
111
|
formState: {
|
|
105
112
|
firstName: "",
|
|
106
113
|
lastName: "",
|
|
@@ -213,6 +220,7 @@ export const PartnerAccount = () => {
|
|
|
213
220
|
return (h(UserInfoFormView, Object.assign({}, baseProps, { states: {
|
|
214
221
|
...baseProps.states,
|
|
215
222
|
isPartner: true,
|
|
223
|
+
isPartnerLegacy: true,
|
|
216
224
|
formState: {
|
|
217
225
|
...baseProps.states.formState,
|
|
218
226
|
firstName: "Jane",
|
|
@@ -232,10 +240,53 @@ export const PartnerAccount = () => {
|
|
|
232
240
|
partnerData: mockPartnerData,
|
|
233
241
|
} })));
|
|
234
242
|
};
|
|
243
|
+
// Early partner created via <sqm-partner-info-modal>: connectionStatus is "STARTED",
|
|
244
|
+
// publisher has only countryCode + currency populated. Banner must NOT show; only
|
|
245
|
+
// country + currency disabled; firstName/lastName disabled via userData; everything
|
|
246
|
+
// else (phone, address, city, state, postalCode) stays editable.
|
|
247
|
+
export const EarlyPartnerFromModal = () => {
|
|
248
|
+
return (h(UserInfoFormView, Object.assign({}, baseProps, { states: {
|
|
249
|
+
...baseProps.states,
|
|
250
|
+
isPartner: true,
|
|
251
|
+
isUser: true,
|
|
252
|
+
isPartnerLegacy: false,
|
|
253
|
+
isUserLegacy: false,
|
|
254
|
+
formState: {
|
|
255
|
+
...baseProps.states.formState,
|
|
256
|
+
firstName: "Jane",
|
|
257
|
+
lastName: "Smith",
|
|
258
|
+
email: "jane.smith@example.com",
|
|
259
|
+
countryCode: "US",
|
|
260
|
+
currency: "USD",
|
|
261
|
+
phoneNumberCountryCode: undefined,
|
|
262
|
+
phoneNumber: undefined,
|
|
263
|
+
address: undefined,
|
|
264
|
+
city: undefined,
|
|
265
|
+
state: undefined,
|
|
266
|
+
postalCode: undefined,
|
|
267
|
+
},
|
|
268
|
+
}, data: {
|
|
269
|
+
...baseProps.data,
|
|
270
|
+
partnerData: {
|
|
271
|
+
...mockPartnerData,
|
|
272
|
+
billingAddress: undefined,
|
|
273
|
+
billingCity: undefined,
|
|
274
|
+
billingState: undefined,
|
|
275
|
+
billingPostalCode: undefined,
|
|
276
|
+
phoneNumber: undefined,
|
|
277
|
+
phoneNumberCountryCode: undefined,
|
|
278
|
+
},
|
|
279
|
+
userData: {
|
|
280
|
+
firstName: "Jane",
|
|
281
|
+
lastName: "Smith",
|
|
282
|
+
},
|
|
283
|
+
} })));
|
|
284
|
+
};
|
|
235
285
|
export const UserAccount = () => {
|
|
236
286
|
return (h(UserInfoFormView, Object.assign({}, baseProps, { states: {
|
|
237
287
|
...baseProps.states,
|
|
238
288
|
isUser: true,
|
|
289
|
+
isUserLegacy: true,
|
|
239
290
|
formState: {
|
|
240
291
|
...baseProps.states.formState,
|
|
241
292
|
firstName: "Bob",
|
|
@@ -254,6 +305,7 @@ export const UserAccountMissingLastName = () => {
|
|
|
254
305
|
return (h(UserInfoFormView, Object.assign({}, baseProps, { states: {
|
|
255
306
|
...baseProps.states,
|
|
256
307
|
isUser: true,
|
|
308
|
+
isUserLegacy: true,
|
|
257
309
|
formState: {
|
|
258
310
|
...baseProps.states.formState,
|
|
259
311
|
firstName: "Bob",
|
package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
+
import { AsYouType } from "libphonenumber-js";
|
|
2
3
|
import { intl } from "../../../global/global";
|
|
3
4
|
import { createStyleSheet } from "../../../styling/JSS";
|
|
4
5
|
import { FORM_STEPS } from "../data";
|
|
@@ -107,10 +108,6 @@ const vanillaStyle = `
|
|
|
107
108
|
flex-direction: column;
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
sl-select#phoneNumberCountryCode::part(menu) {
|
|
111
|
-
min-width: 250px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
111
|
sl-button[type="primary"]::part(base){
|
|
115
112
|
background-color: var(--sqm-primary-button-background);
|
|
116
113
|
color: var(--sqm-primary-button-color);
|
|
@@ -204,6 +201,7 @@ const vanillaStyle = `
|
|
|
204
201
|
background: var(--sqm-input-background, inherit);
|
|
205
202
|
color: var(--sqm-input-color, inherit);
|
|
206
203
|
border:none;
|
|
204
|
+
min-width: max-content;
|
|
207
205
|
}
|
|
208
206
|
|
|
209
207
|
sl-menu-item::part(base) {
|
|
@@ -336,6 +334,14 @@ export const UserInfoFormView = (props) => {
|
|
|
336
334
|
}, {
|
|
337
335
|
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
338
336
|
})))),
|
|
337
|
+
(states.isPartnerLegacy || states.isUserLegacy) && (h("sqm-form-message", { loading: states.loading, type: "info" },
|
|
338
|
+
h("p", { part: "alert-title" }, text.isPartnerAlertHeader),
|
|
339
|
+
h("p", { part: "alert-description" }, intl.formatMessage({
|
|
340
|
+
id: "isPartnerAlertDescription",
|
|
341
|
+
defaultMessage: text.isPartnerAlertDescription,
|
|
342
|
+
}, {
|
|
343
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
|
|
344
|
+
})))),
|
|
339
345
|
h("div", null,
|
|
340
346
|
h("div", { class: classes.InputContainer },
|
|
341
347
|
h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled || isDisabledUserInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
|
|
@@ -388,7 +394,14 @@ export const UserInfoFormView = (props) => {
|
|
|
388
394
|
h("div", { slot: "prefix" }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
|
|
389
395
|
_b.dial_code));
|
|
390
396
|
})),
|
|
391
|
-
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber
|
|
397
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber !== null
|
|
398
|
+
? formState.phoneNumber
|
|
399
|
+
: "", "onSl-input": (e) => {
|
|
400
|
+
var _a;
|
|
401
|
+
const target = e.target;
|
|
402
|
+
const country = (((_a = refs.phoneCountryRef.current) === null || _a === void 0 ? void 0 : _a.value) || "US");
|
|
403
|
+
target.value = new AsYouType(country).input(target.value);
|
|
404
|
+
}, validationError: ({ control, value, formData }) => {
|
|
392
405
|
// skip validation for values the user can't edit
|
|
393
406
|
if (control === null || control === void 0 ? void 0 : control.disabled)
|
|
394
407
|
return undefined;
|
|
@@ -864,7 +864,7 @@ export class TaxForm {
|
|
|
864
864
|
"mutable": false,
|
|
865
865
|
"complexType": {
|
|
866
866
|
"original": "DemoData<UseUserInfoFormResult>",
|
|
867
|
-
"resolved": "{ states?: { step: string; hideState: boolean; hideSteps: boolean; disabled: boolean; loadingError: boolean; loading: boolean; isPartner: boolean; isUser: boolean; formState: { errors: {}; firstName: string; lastName: string; email: string; phoneNumberCountryCode: string; phoneNumber: string; countryCode: string; currency: string; address: string; city: string; state: string; postalCode: string; }; }; refs?: { formRef: Ref<HTMLFormElement>; currencyRef: Ref<HTMLSelectElement>; phoneCountryRef: Ref<HTMLSelectElement>; }; data?: { currencies: { displayName: string; currencyCode: string; }[]; countries: TaxCountry[]; phoneCountries: TaxCountry[]; allCurrencies: { displayName: string; currencyCode: string; }[]; allCountries: TaxCountry[]; regionLabelEnum: \"STATE\" | \"PROVINCE\" | \"REGION\"; regions: { label: string; value: string; }[]; partnerData: ImpactPublisher; userData: ImpactUser; }; setStep?: (value: string) => void; onSubmit?: (event: any) => Promise<void>; }",
|
|
867
|
+
"resolved": "{ states?: { step: string; hideState: boolean; hideSteps: boolean; disabled: boolean; loadingError: boolean; loading: boolean; isPartner: boolean; isUser: boolean; isUserLegacy: boolean; isPartnerLegacy: boolean; formState: { errors: {}; firstName: string; lastName: string; email: string; phoneNumberCountryCode: string; phoneNumber: string; countryCode: string; currency: string; address: string; city: string; state: string; postalCode: string; }; }; refs?: { formRef: Ref<HTMLFormElement>; currencyRef: Ref<HTMLSelectElement>; phoneCountryRef: Ref<HTMLSelectElement>; }; data?: { currencies: { displayName: string; currencyCode: string; }[]; countries: TaxCountry[]; phoneCountries: TaxCountry[]; allCurrencies: { displayName: string; currencyCode: string; }[]; allCountries: TaxCountry[]; regionLabelEnum: \"STATE\" | \"PROVINCE\" | \"REGION\"; regions: { label: string; value: string; }[]; partnerData: ImpactPublisher; userData: ImpactUser; }; setStep?: (value: string) => void; onSubmit?: (event: any) => Promise<void>; }",
|
|
868
868
|
"references": {
|
|
869
869
|
"DemoData": {
|
|
870
870
|
"location": "import",
|
|
@@ -927,6 +927,8 @@ function useDemoUserInfoForm(props) {
|
|
|
927
927
|
loading: false,
|
|
928
928
|
isPartner: false,
|
|
929
929
|
isUser: false,
|
|
930
|
+
isPartnerLegacy: false,
|
|
931
|
+
isUserLegacy: false,
|
|
930
932
|
loadingError: false,
|
|
931
933
|
formState: {
|
|
932
934
|
errors: {
|