@saasquatch/mint-components 2.1.9-20 → 2.1.9-21
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/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 +1 -1
- package/dist/cjs/sqm-email-verification_2.cjs.entry.js +42 -2
- package/dist/cjs/{sqm-partner-info-modal-view-d5c997e6.js → sqm-partner-info-modal-view-464c52c9.js} +20 -2
- package/dist/cjs/sqm-partner-info-modal.cjs.entry.js +493 -0
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +10 -2
- package/dist/cjs/{sqm-user-info-form-view-db47a968.js → sqm-user-info-form-view-01bf2f41.js} +2 -7
- package/dist/collection/components/sqm-partner-info-modal/PartnerInfoModal.stories.js +8 -0
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +20 -2
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +91 -2
- package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +17 -0
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +2 -7
- 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 +1 -1
- package/dist/esm/sqm-email-verification_2.entry.js +42 -2
- package/dist/esm/{sqm-partner-info-modal-view-08b7c5f6.js → sqm-partner-info-modal-view-a6324934.js} +20 -2
- package/dist/esm/sqm-partner-info-modal.entry.js +489 -0
- package/dist/esm/sqm-stencilbook.entry.js +10 -2
- package/dist/esm/{sqm-user-info-form-view-712cd51b.js → sqm-user-info-form-view-365cef98.js} +2 -7
- 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-email-verification_2.entry.js +1 -1
- package/dist/esm-es5/sqm-partner-info-modal-view-a6324934.js +1 -0
- package/dist/esm-es5/sqm-partner-info-modal.entry.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/{sqm-user-info-form-view-712cd51b.js → sqm-user-info-form-view-365cef98.js} +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-fc783749.entry.js → p-038d0b8f.entry.js} +1 -1
- package/dist/mint-components/p-1c413a06.system.js +1 -1
- package/dist/mint-components/p-1e35f151.system.js +1 -0
- package/dist/mint-components/{p-842f45b9.js → p-52eca331.js} +1 -1
- package/dist/mint-components/{p-0dc17c6a.entry.js → p-6530c3f1.entry.js} +2 -2
- package/dist/mint-components/{p-1b7dfd6f.system.entry.js → p-9b790948.system.entry.js} +1 -1
- package/dist/mint-components/{p-0a126d1b.system.entry.js → p-a0986077.system.entry.js} +1 -1
- package/dist/mint-components/p-a1e1c42a.js +1 -0
- package/dist/mint-components/{p-8e1acd9a.system.js → p-a2db4345.system.js} +1 -1
- package/dist/mint-components/{p-45e72bed.system.entry.js → p-b6ac3080.system.entry.js} +1 -1
- package/dist/mint-components/{p-91a00693.entry.js → p-bc4b2728.entry.js} +5 -5
- package/dist/mint-components/sqm-partner-info-modal.entry.js +489 -0
- package/dist/mint-components/sqm-partner-info-modal.system.entry.js +1 -0
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal-view.d.ts +7 -0
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal.d.ts +16 -0
- package/dist/types/components.d.ts +32 -0
- 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/esm-es5/sqm-partner-info-modal-view-08b7c5f6.js +0 -1
- package/dist/mint-components/p-b077d478.js +0 -1
- package/dist/mint-components/p-da6c5d98.system.js +0 -1
package/dist/cjs/{sqm-partner-info-modal-view-d5c997e6.js → sqm-partner-info-modal-view-464c52c9.js}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index-8277cbb3.js');
|
|
4
|
+
const global = require('./global-0f8b1267.js');
|
|
4
5
|
const JSS = require('./JSS-8503a151.js');
|
|
5
6
|
|
|
6
7
|
const style = {
|
|
@@ -50,6 +51,11 @@ const style = {
|
|
|
50
51
|
margin: "0",
|
|
51
52
|
},
|
|
52
53
|
},
|
|
54
|
+
CheckboxWrapper: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
justifyContent: "flex-start",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
},
|
|
53
59
|
SubmitButton: {
|
|
54
60
|
width: "100%",
|
|
55
61
|
marginTop: "var(--sl-spacing-large)",
|
|
@@ -66,6 +72,12 @@ function PartnerInfoModalContentView(props) {
|
|
|
66
72
|
const buttonLabel = states.isExistingPartner
|
|
67
73
|
? text.confirmButtonLabel
|
|
68
74
|
: text.submitButtonLabel;
|
|
75
|
+
const bankingCollectionText = global.intl.formatMessage({
|
|
76
|
+
id: "bankingCollectionText",
|
|
77
|
+
defaultMessage: text.allowBankingCollection,
|
|
78
|
+
}, {
|
|
79
|
+
termsAndConditionsLink: (index.h("a", { href: text.termsAndConditionsLink, target: "_blank" }, text.termsAndConditionsLabel)),
|
|
80
|
+
});
|
|
69
81
|
return (index.h("div", null,
|
|
70
82
|
index.h("style", { type: "text/css" },
|
|
71
83
|
" ",
|
|
@@ -83,9 +95,15 @@ function PartnerInfoModalContentView(props) {
|
|
|
83
95
|
_b.map((c) => (index.h("sl-menu-item", { value: c.currencyCode },
|
|
84
96
|
c.currencyCode,
|
|
85
97
|
" - ",
|
|
86
|
-
c.displayName))))
|
|
98
|
+
c.displayName)))),
|
|
99
|
+
index.h("div", { class: sheet.classes.CheckboxWrapper },
|
|
100
|
+
index.h("sl-checkbox", { checked: states.allowBankingCollection === true, "onSl-change": callbacks.onCheckboxChange, disabled: states.submitting, required: true, value: states.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
|
|
101
|
+
states.checkboxError && (index.h("p", { class: sheet.classes.ErrorMessage }, states.checkboxError)))),
|
|
87
102
|
states.error && index.h("p", { class: sheet.classes.ErrorMessage }, states.error),
|
|
88
|
-
index.h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting ||
|
|
103
|
+
index.h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting ||
|
|
104
|
+
!states.countryCode ||
|
|
105
|
+
!states.currency ||
|
|
106
|
+
!states.allowBankingCollection, onClick: callbacks.onSubmit, class: sheet.classes.SubmitButton, exportparts: "base: primarybutton-base" }, buttonLabel)));
|
|
89
107
|
}
|
|
90
108
|
function PartnerInfoModalView(props) {
|
|
91
109
|
const { states, text, callbacks } = props;
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-fd67d7bc.js');
|
|
6
|
+
require('./global-746daf93.js');
|
|
7
|
+
const domContextHooks_module = require('./dom-context-hooks.module-224e09d4.js');
|
|
8
|
+
const index_module = require('./index.module-c79bd5b0.js');
|
|
9
|
+
require('./GoogleFonts-039d880f.js');
|
|
10
|
+
require('./jss-preset-default.esm-b48f0c33.js');
|
|
11
|
+
require('./JSS-518e9b4d.js');
|
|
12
|
+
const utils = require('./utils-e326d1b5.js');
|
|
13
|
+
const cjs = require('./cjs-2bf512b9.js');
|
|
14
|
+
const data = require('./data-61e58813.js');
|
|
15
|
+
const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-2c4eef62.js');
|
|
16
|
+
const keys = require('./keys-cff24974.js');
|
|
17
|
+
const eventKeys = require('./eventKeys-7af4df4d.js');
|
|
18
|
+
const parseStates = require('./parseStates-d1effc19.js');
|
|
19
|
+
|
|
20
|
+
// new field under impactConnection:{ resolvedByEmail: boolean } - determines if connection came from managed identity
|
|
21
|
+
const GET_USER_PARTNER_INFO = index_module.dist.gql `
|
|
22
|
+
query getUserPartnerInfo {
|
|
23
|
+
user: viewer {
|
|
24
|
+
... on User {
|
|
25
|
+
id
|
|
26
|
+
accountId
|
|
27
|
+
firstName
|
|
28
|
+
lastName
|
|
29
|
+
email
|
|
30
|
+
countryCode
|
|
31
|
+
customFields
|
|
32
|
+
impactConnection {
|
|
33
|
+
connected
|
|
34
|
+
connectionStatus
|
|
35
|
+
publisher {
|
|
36
|
+
id
|
|
37
|
+
countryCode
|
|
38
|
+
currency
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
const GET_COUNTRIES = index_module.dist.gql `
|
|
46
|
+
query getCountries {
|
|
47
|
+
impactPayoutCountries(limit: 1000) {
|
|
48
|
+
data {
|
|
49
|
+
countryCode
|
|
50
|
+
displayName
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
const GET_CURRENCIES = index_module.dist.gql `
|
|
56
|
+
query currencies($locale: RSLocale) {
|
|
57
|
+
currencies(limit: 300) {
|
|
58
|
+
data {
|
|
59
|
+
displayName(locale: $locale)
|
|
60
|
+
currencyCode
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
const CONNECT_PARTNER = index_module.dist.gql `
|
|
66
|
+
mutation createImpactConnection($vars: ImpactConnectionInput!) {
|
|
67
|
+
createImpactConnection(impactConnectionInput: $vars) {
|
|
68
|
+
success
|
|
69
|
+
validationErrors {
|
|
70
|
+
field
|
|
71
|
+
message
|
|
72
|
+
}
|
|
73
|
+
user {
|
|
74
|
+
id
|
|
75
|
+
accountId
|
|
76
|
+
impactConnection {
|
|
77
|
+
connected
|
|
78
|
+
publisher {
|
|
79
|
+
brandedSignup
|
|
80
|
+
requiredTaxDocumentType
|
|
81
|
+
currentTaxDocument {
|
|
82
|
+
type
|
|
83
|
+
status
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
const START_IMPACT_CONNECTION = index_module.dist.gql `
|
|
92
|
+
mutation startImpactConnection($vars: ImpactConnectionInput!) {
|
|
93
|
+
startImpactConnection(impactConnectionInput: $vars) {
|
|
94
|
+
success
|
|
95
|
+
validationErrors {
|
|
96
|
+
field
|
|
97
|
+
message
|
|
98
|
+
}
|
|
99
|
+
user {
|
|
100
|
+
id
|
|
101
|
+
accountId
|
|
102
|
+
impactConnection {
|
|
103
|
+
connected
|
|
104
|
+
publisher {
|
|
105
|
+
brandedSignup
|
|
106
|
+
requiredTaxDocumentType
|
|
107
|
+
currentTaxDocument {
|
|
108
|
+
type
|
|
109
|
+
status
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
const GET_BRAND_NAME = index_module.dist.gql `
|
|
118
|
+
query getTenantSettings {
|
|
119
|
+
tenantSettings {
|
|
120
|
+
companyName
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
function usePartnerInfoModal(props) {
|
|
125
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
126
|
+
const locale = index_module.L();
|
|
127
|
+
const setVerificationContext = index_module.En(keys.VERIFICATION_PARENT_NAMESPACE);
|
|
128
|
+
const { data: userData, loading: userLoading, refetch, } = index_module.wn(GET_USER_PARTNER_INFO, {});
|
|
129
|
+
const user = userData === null || userData === void 0 ? void 0 : userData.user;
|
|
130
|
+
const { data: currenciesData, loading: currenciesLoading } = index_module.wn(GET_CURRENCIES, { variables: { locale } });
|
|
131
|
+
const { data: countriesData, loading: countriesLoading } = index_module.wn(GET_COUNTRIES, {});
|
|
132
|
+
const { data: tenantSettingsData } = index_module.wn(GET_BRAND_NAME, {});
|
|
133
|
+
const { data: financeNetworkData } = index_module.wn(data.GET_FINANCE_NETWORK_SETTINGS, {
|
|
134
|
+
variables: { filter: {} },
|
|
135
|
+
});
|
|
136
|
+
const [startImpactConnection, { loading: connectLoading, errors: connectErrors },] = index_module.$e(START_IMPACT_CONNECTION);
|
|
137
|
+
const [allowBankingCollection, setAllowBankingCollection] = domContextHooks_module.useState(false);
|
|
138
|
+
const [checkboxError, setCheckboxError] = domContextHooks_module.useState("");
|
|
139
|
+
// No pre-filled country, use locale to determine countryCode instead
|
|
140
|
+
const [countryCode, setCountryCode] = domContextHooks_module.useState(((_b = (_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.countryCode) ||
|
|
141
|
+
locale.replace(/^.*_/, ""));
|
|
142
|
+
const [currency, setCurrency] = domContextHooks_module.useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.currency) || "");
|
|
143
|
+
const countries = ((_e = countriesData === null || countriesData === void 0 ? void 0 : countriesData.impactPayoutCountries) === null || _e === void 0 ? void 0 : _e.data) || [];
|
|
144
|
+
// copied from useTaxAndCash for displaying currencies based on country - could be in helper?
|
|
145
|
+
const currencies = domContextHooks_module.useMemo(() => {
|
|
146
|
+
var _a, _b;
|
|
147
|
+
const allValidCurrencies = (_b = (_a = financeNetworkData === null || financeNetworkData === void 0 ? void 0 : financeNetworkData.impactFinanceNetworkSettings) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.reduce((agg, settings) => {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
const currency = (_b = (_a = currenciesData === null || currenciesData === void 0 ? void 0 : currenciesData.currencies) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.find((c) => c.currencyCode === settings.currency);
|
|
150
|
+
if (!currency)
|
|
151
|
+
return agg;
|
|
152
|
+
if (agg.find((c) => c.currencyCode === settings.currency))
|
|
153
|
+
return agg;
|
|
154
|
+
if (countryCode && settings.countryCode !== countryCode)
|
|
155
|
+
return agg;
|
|
156
|
+
return [...agg, currency];
|
|
157
|
+
}, []);
|
|
158
|
+
return (allValidCurrencies || []).sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
159
|
+
}, [financeNetworkData, currenciesData, countryCode]);
|
|
160
|
+
const [countrySearch, setCountrySearch] = domContextHooks_module.useState("");
|
|
161
|
+
const [currencySearch, setCurrencySearch] = domContextHooks_module.useState("");
|
|
162
|
+
const [filteredCountries, setFilteredCountries] = domContextHooks_module.useState(((_f = countriesData === null || countriesData === void 0 ? void 0 : countriesData.impactPayoutCountries) === null || _f === void 0 ? void 0 : _f.data) || []);
|
|
163
|
+
const [filteredCurrencies, setFilteredCurrencies] = domContextHooks_module.useState(currencies || []);
|
|
164
|
+
console.log(userData, "userData partner info modal");
|
|
165
|
+
const [error, setError] = domContextHooks_module.useState("");
|
|
166
|
+
const [success, setSuccess] = domContextHooks_module.useState(false);
|
|
167
|
+
domContextHooks_module.useEffect(() => {
|
|
168
|
+
var _a;
|
|
169
|
+
const publisher = (_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher;
|
|
170
|
+
if (!userData || !publisher)
|
|
171
|
+
return;
|
|
172
|
+
setCountryCode(publisher.countryCode);
|
|
173
|
+
setCurrency(publisher.currency);
|
|
174
|
+
}, [userData, user]);
|
|
175
|
+
domContextHooks_module.useEffect(() => {
|
|
176
|
+
if (!(countries === null || countries === void 0 ? void 0 : countries.length))
|
|
177
|
+
return;
|
|
178
|
+
if (countrySearch.trim() === "") {
|
|
179
|
+
setFilteredCountries(countries || []);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
setFilteredCountries(countries.filter((c) => c.displayName.toLowerCase().includes(countrySearch.toLowerCase())) || []);
|
|
183
|
+
}
|
|
184
|
+
}, [countrySearch, countries]);
|
|
185
|
+
domContextHooks_module.useEffect(() => {
|
|
186
|
+
if (!(currencies === null || currencies === void 0 ? void 0 : currencies.length))
|
|
187
|
+
return;
|
|
188
|
+
if (currencySearch.trim() === "") {
|
|
189
|
+
setFilteredCurrencies(currencies || []);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
|
|
193
|
+
}
|
|
194
|
+
}, [currencySearch, currencies]);
|
|
195
|
+
const impactConnection = user === null || user === void 0 ? void 0 : user.impactConnection;
|
|
196
|
+
function onCountryChange(e) {
|
|
197
|
+
var _a, _b;
|
|
198
|
+
const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
199
|
+
if (!value)
|
|
200
|
+
return;
|
|
201
|
+
setCountryCode(value);
|
|
202
|
+
setCurrency("");
|
|
203
|
+
setError("");
|
|
204
|
+
}
|
|
205
|
+
function onCurrencyChange(e) {
|
|
206
|
+
var _a, _b;
|
|
207
|
+
const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
208
|
+
if (!value)
|
|
209
|
+
return;
|
|
210
|
+
setCurrency(value);
|
|
211
|
+
setError("");
|
|
212
|
+
}
|
|
213
|
+
function onCheckboxChange(e) {
|
|
214
|
+
const checked = e.target.checked;
|
|
215
|
+
setAllowBankingCollection(checked);
|
|
216
|
+
if (checked)
|
|
217
|
+
setCheckboxError("");
|
|
218
|
+
}
|
|
219
|
+
async function onSubmit() {
|
|
220
|
+
var _a, _b;
|
|
221
|
+
if (!allowBankingCollection) {
|
|
222
|
+
setCheckboxError(props.missingFieldsErrorText);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (!countryCode || !currency) {
|
|
226
|
+
setError(props.missingFieldsErrorText);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
setError("");
|
|
230
|
+
setCheckboxError("");
|
|
231
|
+
try {
|
|
232
|
+
const vars = {
|
|
233
|
+
user: {
|
|
234
|
+
id: user.id,
|
|
235
|
+
accountId: user.accountId,
|
|
236
|
+
},
|
|
237
|
+
firstName: user.firstName,
|
|
238
|
+
lastName: user.lastName,
|
|
239
|
+
// phoneNumber: null,
|
|
240
|
+
// phoneNumberCountryCode: null,
|
|
241
|
+
countryCode,
|
|
242
|
+
currency,
|
|
243
|
+
};
|
|
244
|
+
const result = await startImpactConnection({ vars });
|
|
245
|
+
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message)) {
|
|
246
|
+
setError(props.networkErrorText);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const connectionResult = result
|
|
250
|
+
.startImpactConnection;
|
|
251
|
+
console.log(result, connectionResult, "result and connectionResult from creating partner from modal");
|
|
252
|
+
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
|
|
253
|
+
const validationMsg = (_b = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors) === null || _b === void 0 ? void 0 : _b.map((e) => e.message).join(". ");
|
|
254
|
+
setError(validationMsg || props.networkErrorText);
|
|
255
|
+
console.error("Failed to create Impact connection:", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
window.dispatchEvent(new Event(eventKeys.TAX_FORM_UPDATED_EVENT_KEY));
|
|
259
|
+
await refetch();
|
|
260
|
+
setSuccess(true);
|
|
261
|
+
setVerificationContext(true);
|
|
262
|
+
}
|
|
263
|
+
catch (e) {
|
|
264
|
+
console.error("Partner creation error:", e);
|
|
265
|
+
setError(props.networkErrorText);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const showModal = !success &&
|
|
269
|
+
!userLoading &&
|
|
270
|
+
(impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.connectionStatus) === "NOT_STARTED";
|
|
271
|
+
return {
|
|
272
|
+
states: {
|
|
273
|
+
open: showModal,
|
|
274
|
+
loading: userLoading || countriesLoading || currenciesLoading,
|
|
275
|
+
submitting: connectLoading,
|
|
276
|
+
isExistingPartner: impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.publisher,
|
|
277
|
+
countryCode,
|
|
278
|
+
currency,
|
|
279
|
+
error,
|
|
280
|
+
success,
|
|
281
|
+
brandName: ((_g = tenantSettingsData === null || tenantSettingsData === void 0 ? void 0 : tenantSettingsData.tenantSettings) === null || _g === void 0 ? void 0 : _g.companyName) || "",
|
|
282
|
+
filteredCountries: filteredCountries || [],
|
|
283
|
+
filteredCurrencies: filteredCurrencies || [],
|
|
284
|
+
allowBankingCollection,
|
|
285
|
+
checkboxError,
|
|
286
|
+
disabled: userLoading || connectLoading,
|
|
287
|
+
},
|
|
288
|
+
callbacks: {
|
|
289
|
+
onCountryChange,
|
|
290
|
+
onCurrencyChange,
|
|
291
|
+
onCheckboxChange,
|
|
292
|
+
setCurrencySearch,
|
|
293
|
+
setCountrySearch,
|
|
294
|
+
onSubmit,
|
|
295
|
+
onClose: () => setSuccess(true),
|
|
296
|
+
},
|
|
297
|
+
text: props.getTextProps(),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const PartnerInfoModal = class {
|
|
302
|
+
constructor(hostRef) {
|
|
303
|
+
index.registerInstance(this, hostRef);
|
|
304
|
+
/**
|
|
305
|
+
* Brand name shown in the modal header
|
|
306
|
+
*
|
|
307
|
+
* @uiName Brand name
|
|
308
|
+
*/
|
|
309
|
+
this.brandName = "";
|
|
310
|
+
/**
|
|
311
|
+
* Header text when user has no existing partner
|
|
312
|
+
*
|
|
313
|
+
* @uiName New partner header
|
|
314
|
+
* @uiWidget textArea
|
|
315
|
+
*/
|
|
316
|
+
this.modalHeader = "Let's get you ready for rewards";
|
|
317
|
+
/**
|
|
318
|
+
* Header text when user has an existing partner
|
|
319
|
+
*
|
|
320
|
+
* @uiName Existing partner header
|
|
321
|
+
* @uiWidget textArea
|
|
322
|
+
*/
|
|
323
|
+
this.modalHeaderExistingPartner = "We found an existing account";
|
|
324
|
+
/**
|
|
325
|
+
* Description for new partner setup
|
|
326
|
+
*
|
|
327
|
+
* @uiName New partner description
|
|
328
|
+
* @uiWidget textArea
|
|
329
|
+
*/
|
|
330
|
+
this.descriptionNewPartner = "Confirm your country and currency now to get your future rewards faster.";
|
|
331
|
+
/**
|
|
332
|
+
* Description for existing partner confirmation
|
|
333
|
+
*
|
|
334
|
+
* @uiName Existing partner description
|
|
335
|
+
* @uiWidget textArea
|
|
336
|
+
*/
|
|
337
|
+
this.descriptionExistingPartner = "We found an account with this email on our referral program provider, impact.com. Please confirm your country and currency now to get your future rewards faster.";
|
|
338
|
+
/**
|
|
339
|
+
* Support description for existing partner confirmation
|
|
340
|
+
*
|
|
341
|
+
* @uiName Existing partner support description
|
|
342
|
+
* @uiWidget textArea
|
|
343
|
+
*/
|
|
344
|
+
this.supportDescriptionExistingPartner = "If this is a mistake, please contact Support or sign up for this referral program with a different email.";
|
|
345
|
+
/**
|
|
346
|
+
* Edit the property called terms and conditions text to change what's displayed for {termsAndConditionsLink}.
|
|
347
|
+
* @uiName Terms and conditions checkbox
|
|
348
|
+
*/
|
|
349
|
+
this.allowBankingCollection = "I have read the {termsAndConditionsLink} and allow impact.com to collect my tax and banking information";
|
|
350
|
+
/**
|
|
351
|
+
* The link text that appears in the terms and conditions checkbox
|
|
352
|
+
* @uiName Terms and conditions text
|
|
353
|
+
* @uiWidget textArea
|
|
354
|
+
*/
|
|
355
|
+
this.termsAndConditionsLabel = "terms and conditions";
|
|
356
|
+
/**
|
|
357
|
+
* The link that appears in the terms and conditions checkbox
|
|
358
|
+
* @uiName Terms and conditions link
|
|
359
|
+
*/
|
|
360
|
+
this.termsAndConditionsLink = "https://terms.advocate.impact.com/PayoutTermsAndConditions.html";
|
|
361
|
+
/**
|
|
362
|
+
* @uiName Country label
|
|
363
|
+
*/
|
|
364
|
+
this.countryLabel = "Country";
|
|
365
|
+
/**
|
|
366
|
+
* @uiName Currency label
|
|
367
|
+
*/
|
|
368
|
+
this.currencyLabel = "Currency";
|
|
369
|
+
/**
|
|
370
|
+
* @uiName Submit button label
|
|
371
|
+
*/
|
|
372
|
+
this.submitButtonLabel = "Submit";
|
|
373
|
+
/**
|
|
374
|
+
* @uiName Confirm button label
|
|
375
|
+
*/
|
|
376
|
+
this.confirmButtonLabel = "Confirm";
|
|
377
|
+
/**
|
|
378
|
+
* @uiName Search country placeholder
|
|
379
|
+
*/
|
|
380
|
+
this.searchCountryPlaceholder = "Search for a country";
|
|
381
|
+
/**
|
|
382
|
+
* @uiName Search currency placeholder
|
|
383
|
+
*/
|
|
384
|
+
this.searchCurrencyPlaceholder = "Search for a currency";
|
|
385
|
+
/**
|
|
386
|
+
* @uiName Network error text
|
|
387
|
+
* @uiWidget textArea
|
|
388
|
+
*/
|
|
389
|
+
this.networkErrorText = "An error occurred. Please try again.";
|
|
390
|
+
/**
|
|
391
|
+
* @uiName Missing fields error text
|
|
392
|
+
* @uiWidget textArea
|
|
393
|
+
*/
|
|
394
|
+
this.missingFieldsErrorText = "Please select both a country and currency.";
|
|
395
|
+
/**
|
|
396
|
+
* Used to render in another modal.
|
|
397
|
+
* @undocumented
|
|
398
|
+
*/
|
|
399
|
+
this.inModal = false;
|
|
400
|
+
/**
|
|
401
|
+
* @undocumented
|
|
402
|
+
* @componentState { "title": "New partner", "props": { "states": { "open": true, "isExistingPartner": false } } }
|
|
403
|
+
* @componentState { "title": "Existing partner", "props": { "states": { "open": true, "isExistingPartner": true, "countryCode": "US", "currency": "USD" } } }
|
|
404
|
+
* @componentState { "title": "Connected (hidden)", "props": { "states": { "open": false } } }
|
|
405
|
+
*/
|
|
406
|
+
this.stateController = "{}";
|
|
407
|
+
domContextHooks_module.h$1(this);
|
|
408
|
+
}
|
|
409
|
+
disconnectedCallback() { }
|
|
410
|
+
getTextProps() {
|
|
411
|
+
return utils.getProps(this);
|
|
412
|
+
}
|
|
413
|
+
render() {
|
|
414
|
+
const props = index_module.isDemo()
|
|
415
|
+
? useDemoPartnerInfoModal(this)
|
|
416
|
+
: usePartnerInfoModal(this);
|
|
417
|
+
if (this.inModal) {
|
|
418
|
+
return index.h(sqmPartnerInfoModalView.PartnerInfoModalContentView, Object.assign({}, props));
|
|
419
|
+
}
|
|
420
|
+
return index.h(sqmPartnerInfoModalView.PartnerInfoModalView, Object.assign({}, props));
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
function useDemoPartnerInfoModal(props) {
|
|
424
|
+
const [countryCode, setCountryCode] = domContextHooks_module.useState("US");
|
|
425
|
+
const [currency, setCurrency] = domContextHooks_module.useState("");
|
|
426
|
+
const [error, setError] = domContextHooks_module.useState("");
|
|
427
|
+
const [allowBankingCollection, setAllowBankingCollection] = domContextHooks_module.useState(false);
|
|
428
|
+
const parsed = parseStates.parseStates(props.stateController);
|
|
429
|
+
const stateOverride = (parsed === null || parsed === void 0 ? void 0 : parsed["sqm-partner-info-modal"]) || parsed || {};
|
|
430
|
+
// @ts-ignore
|
|
431
|
+
return cjs.cjs({
|
|
432
|
+
states: {
|
|
433
|
+
brandName: "Test Brand",
|
|
434
|
+
open: false,
|
|
435
|
+
loading: false,
|
|
436
|
+
submitting: false,
|
|
437
|
+
isExistingPartner: false,
|
|
438
|
+
countryCode,
|
|
439
|
+
currency,
|
|
440
|
+
error,
|
|
441
|
+
success: false,
|
|
442
|
+
filteredCountries: [],
|
|
443
|
+
filteredCurrencies: [],
|
|
444
|
+
allowBankingCollection,
|
|
445
|
+
checkboxError: "",
|
|
446
|
+
disabled: false,
|
|
447
|
+
},
|
|
448
|
+
callbacks: {
|
|
449
|
+
onCountryChange: (e) => {
|
|
450
|
+
var _a, _b;
|
|
451
|
+
const value = (_b = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
452
|
+
if (value) {
|
|
453
|
+
setCountryCode(value);
|
|
454
|
+
setCurrency("");
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
onCurrencyChange: (e) => {
|
|
458
|
+
var _a, _b;
|
|
459
|
+
const value = (_b = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
460
|
+
if (value)
|
|
461
|
+
setCurrency(value);
|
|
462
|
+
},
|
|
463
|
+
onCheckboxChange: (e) => {
|
|
464
|
+
setAllowBankingCollection(e.target.checked);
|
|
465
|
+
},
|
|
466
|
+
setCountrySearch: () => { },
|
|
467
|
+
setCurrencySearch: () => { },
|
|
468
|
+
onSubmit: () => {
|
|
469
|
+
if (!countryCode || !currency) {
|
|
470
|
+
setError(props.missingFieldsErrorText);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
setError("");
|
|
474
|
+
},
|
|
475
|
+
onClose: () => { },
|
|
476
|
+
},
|
|
477
|
+
text: {
|
|
478
|
+
modalHeader: props.modalHeader,
|
|
479
|
+
descriptionNewPartner: props.descriptionNewPartner,
|
|
480
|
+
descriptionExistingPartner: props.descriptionExistingPartner,
|
|
481
|
+
countryLabel: props.countryLabel,
|
|
482
|
+
currencyLabel: props.currencyLabel,
|
|
483
|
+
submitButtonLabel: props.submitButtonLabel,
|
|
484
|
+
confirmButtonLabel: props.confirmButtonLabel,
|
|
485
|
+
searchCountryPlaceholder: props.searchCountryPlaceholder,
|
|
486
|
+
searchCurrencyPlaceholder: props.searchCurrencyPlaceholder,
|
|
487
|
+
supportDescriptionExistingPartner: props.supportDescriptionExistingPartner,
|
|
488
|
+
modalHeaderExistingPartner: props.modalHeaderExistingPartner,
|
|
489
|
+
},
|
|
490
|
+
}, props.demoData || stateOverride, { arrayMerge: (_, a) => a });
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
exports.sqm_partner_info_modal = PartnerInfoModal;
|
|
@@ -35,11 +35,11 @@ require('./ErrorView-ee7b0f36.js');
|
|
|
35
35
|
const sqmQrCodeView = require('./sqm-qr-code-view-1f2daa76.js');
|
|
36
36
|
const ShadowViewAddon = require('./ShadowViewAddon-2b3f51be.js');
|
|
37
37
|
const sqmPortalContainerView = require('./sqm-portal-container-view-70a47420.js');
|
|
38
|
-
const sqmUserInfoFormView = require('./sqm-user-info-form-view-
|
|
38
|
+
const sqmUserInfoFormView = require('./sqm-user-info-form-view-01bf2f41.js');
|
|
39
39
|
const utils = require('./utils-a8e0bd9b.js');
|
|
40
40
|
const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-818d9e9a.js');
|
|
41
41
|
require('./data-6b5095f8.js');
|
|
42
|
-
const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-
|
|
42
|
+
const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-464c52c9.js');
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -18724,6 +18724,7 @@ const demoCurrencies = [
|
|
|
18724
18724
|
const noopCallbacks = {
|
|
18725
18725
|
onCountryChange: (e) => console.log("Country changed:", e),
|
|
18726
18726
|
onCurrencyChange: (e) => console.log("Currency changed:", e),
|
|
18727
|
+
onCheckboxChange: (e) => console.log("Checkbox changed:", e),
|
|
18727
18728
|
setCountrySearch: (v) => console.log("Country search:", v),
|
|
18728
18729
|
setCurrencySearch: (v) => console.log("Currency search:", v),
|
|
18729
18730
|
onSubmit: () => console.log("Submit"),
|
|
@@ -18741,6 +18742,10 @@ const defaultText$1 = {
|
|
|
18741
18742
|
confirmButtonLabel: "Confirm",
|
|
18742
18743
|
searchCountryPlaceholder: "Search for a country",
|
|
18743
18744
|
searchCurrencyPlaceholder: "Search for a currency",
|
|
18745
|
+
bankingCollectionText: "",
|
|
18746
|
+
allowBankingCollection: "I have read the {termsAndConditionsLink} and allow impact.com to collect my tax and banking information",
|
|
18747
|
+
termsAndConditionsLabel: "terms and conditions",
|
|
18748
|
+
termsAndConditionsLink: "https://terms.advocate.impact.com/PayoutTermsAndConditions.html",
|
|
18744
18749
|
};
|
|
18745
18750
|
const defaultProps$y = {
|
|
18746
18751
|
states: {
|
|
@@ -18755,6 +18760,9 @@ const defaultProps$y = {
|
|
|
18755
18760
|
brandName: "Test Brand",
|
|
18756
18761
|
filteredCountries: demoCountries,
|
|
18757
18762
|
filteredCurrencies: demoCurrencies,
|
|
18763
|
+
allowBankingCollection: false,
|
|
18764
|
+
checkboxError: "",
|
|
18765
|
+
disabled: false,
|
|
18758
18766
|
},
|
|
18759
18767
|
callbacks: noopCallbacks,
|
|
18760
18768
|
text: defaultText$1,
|
package/dist/cjs/{sqm-user-info-form-view-db47a968.js → sqm-user-info-form-view-01bf2f41.js}
RENAMED
|
@@ -1883,7 +1883,7 @@ const vanillaStyle$1 = `
|
|
|
1883
1883
|
}
|
|
1884
1884
|
`;
|
|
1885
1885
|
const UserInfoFormView = (props) => {
|
|
1886
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
1886
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
1887
1887
|
const { states, states: { formState }, callbacks, text, refs, data: data$1, } = props;
|
|
1888
1888
|
const { classes } = sheet$1;
|
|
1889
1889
|
const bankingCollectionText = global.intl.formatMessage({
|
|
@@ -2054,12 +2054,7 @@ const UserInfoFormView = (props) => {
|
|
|
2054
2054
|
_t.map((c) => (index.h("sl-menu-item", { value: c.currencyCode, style: { display: "none" } },
|
|
2055
2055
|
c.currencyCode,
|
|
2056
2056
|
" - ",
|
|
2057
|
-
c.displayName)))),
|
|
2058
|
-
index.h("div", { class: classes.CheckboxWrapper },
|
|
2059
|
-
index.h("sl-checkbox", { checked: formState.allowBankingCollection === true, "onSl-change": (e) => {
|
|
2060
|
-
e.target.value = e.target.checked;
|
|
2061
|
-
}, disabled: states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
|
|
2062
|
-
((_u = formState.errors) === null || _u === void 0 ? void 0 : _u.allowBankingCollection) && (index.h("p", { class: classes.ErrorText }, utils.formatErrorMessage(text.termsAndConditionsLabel, formState.errors.allowBankingCollection))))),
|
|
2057
|
+
c.displayName))))),
|
|
2063
2058
|
index.h("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
|
|
2064
2059
|
};
|
|
2065
2060
|
|
|
@@ -22,6 +22,7 @@ const demoCurrencies = [
|
|
|
22
22
|
const noopCallbacks = {
|
|
23
23
|
onCountryChange: (e) => console.log("Country changed:", e),
|
|
24
24
|
onCurrencyChange: (e) => console.log("Currency changed:", e),
|
|
25
|
+
onCheckboxChange: (e) => console.log("Checkbox changed:", e),
|
|
25
26
|
setCountrySearch: (v) => console.log("Country search:", v),
|
|
26
27
|
setCurrencySearch: (v) => console.log("Currency search:", v),
|
|
27
28
|
onSubmit: () => console.log("Submit"),
|
|
@@ -39,6 +40,10 @@ const defaultText = {
|
|
|
39
40
|
confirmButtonLabel: "Confirm",
|
|
40
41
|
searchCountryPlaceholder: "Search for a country",
|
|
41
42
|
searchCurrencyPlaceholder: "Search for a currency",
|
|
43
|
+
bankingCollectionText: "",
|
|
44
|
+
allowBankingCollection: "I have read the {termsAndConditionsLink} and allow impact.com to collect my tax and banking information",
|
|
45
|
+
termsAndConditionsLabel: "terms and conditions",
|
|
46
|
+
termsAndConditionsLink: "https://terms.advocate.impact.com/PayoutTermsAndConditions.html",
|
|
42
47
|
};
|
|
43
48
|
const defaultProps = {
|
|
44
49
|
states: {
|
|
@@ -53,6 +58,9 @@ const defaultProps = {
|
|
|
53
58
|
brandName: "Test Brand",
|
|
54
59
|
filteredCountries: demoCountries,
|
|
55
60
|
filteredCurrencies: demoCurrencies,
|
|
61
|
+
allowBankingCollection: false,
|
|
62
|
+
checkboxError: "",
|
|
63
|
+
disabled: false,
|
|
56
64
|
},
|
|
57
65
|
callbacks: noopCallbacks,
|
|
58
66
|
text: defaultText,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { createStyleSheet } from "../../styling/JSS";
|
|
3
|
+
import { intl } from "../../global/global";
|
|
3
4
|
const style = {
|
|
4
5
|
Dialog: {
|
|
5
6
|
"&::part(panel)": {
|
|
@@ -47,6 +48,11 @@ const style = {
|
|
|
47
48
|
margin: "0",
|
|
48
49
|
},
|
|
49
50
|
},
|
|
51
|
+
CheckboxWrapper: {
|
|
52
|
+
display: "flex",
|
|
53
|
+
justifyContent: "flex-start",
|
|
54
|
+
flexDirection: "column",
|
|
55
|
+
},
|
|
50
56
|
SubmitButton: {
|
|
51
57
|
width: "100%",
|
|
52
58
|
marginTop: "var(--sl-spacing-large)",
|
|
@@ -63,6 +69,12 @@ export function PartnerInfoModalContentView(props) {
|
|
|
63
69
|
const buttonLabel = states.isExistingPartner
|
|
64
70
|
? text.confirmButtonLabel
|
|
65
71
|
: text.submitButtonLabel;
|
|
72
|
+
const bankingCollectionText = intl.formatMessage({
|
|
73
|
+
id: "bankingCollectionText",
|
|
74
|
+
defaultMessage: text.allowBankingCollection,
|
|
75
|
+
}, {
|
|
76
|
+
termsAndConditionsLink: (h("a", { href: text.termsAndConditionsLink, target: "_blank" }, text.termsAndConditionsLabel)),
|
|
77
|
+
});
|
|
66
78
|
return (h("div", null,
|
|
67
79
|
h("style", { type: "text/css" },
|
|
68
80
|
" ",
|
|
@@ -80,9 +92,15 @@ export function PartnerInfoModalContentView(props) {
|
|
|
80
92
|
_b.map((c) => (h("sl-menu-item", { value: c.currencyCode },
|
|
81
93
|
c.currencyCode,
|
|
82
94
|
" - ",
|
|
83
|
-
c.displayName))))
|
|
95
|
+
c.displayName)))),
|
|
96
|
+
h("div", { class: sheet.classes.CheckboxWrapper },
|
|
97
|
+
h("sl-checkbox", { checked: states.allowBankingCollection === true, "onSl-change": callbacks.onCheckboxChange, disabled: states.submitting, required: true, value: states.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
|
|
98
|
+
states.checkboxError && (h("p", { class: sheet.classes.ErrorMessage }, states.checkboxError)))),
|
|
84
99
|
states.error && h("p", { class: sheet.classes.ErrorMessage }, states.error),
|
|
85
|
-
h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting ||
|
|
100
|
+
h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting ||
|
|
101
|
+
!states.countryCode ||
|
|
102
|
+
!states.currency ||
|
|
103
|
+
!states.allowBankingCollection, onClick: callbacks.onSubmit, class: sheet.classes.SubmitButton, exportparts: "base: primarybutton-base" }, buttonLabel)));
|
|
86
104
|
}
|
|
87
105
|
export function PartnerInfoModalView(props) {
|
|
88
106
|
const { states, text, callbacks } = props;
|