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