@saasquatch/mint-components 2.1.9-0 → 2.1.9-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +1 -4
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
  6. package/dist/cjs/{sqm-user-info-form-view-efa08934.js → sqm-user-info-form-view-e7260d61.js} +0 -8
  7. package/dist/cjs/sqm-widget-verification.cjs.entry.js +85 -12
  8. package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +1 -4
  9. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +421 -3
  10. package/dist/collection/components/sqm-widget-verification/useWidgetVerification.js +0 -9
  11. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +0 -8
  12. package/dist/esm/loader.js +1 -1
  13. package/dist/esm/mint-components.js +1 -1
  14. package/dist/esm/sqm-banking-info-form_10.entry.js +1 -1
  15. package/dist/esm/sqm-email-verification_2.entry.js +1 -4
  16. package/dist/esm/sqm-stencilbook.entry.js +1 -1
  17. package/dist/esm/{sqm-user-info-form-view-b2dd8aa1.js → sqm-user-info-form-view-a18d6b15.js} +0 -8
  18. package/dist/esm/sqm-widget-verification.entry.js +85 -12
  19. package/dist/esm-es5/loader.js +1 -1
  20. package/dist/esm-es5/mint-components.js +1 -1
  21. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  22. package/dist/esm-es5/sqm-email-verification_2.entry.js +1 -1
  23. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  24. package/dist/esm-es5/{sqm-user-info-form-view-b2dd8aa1.js → sqm-user-info-form-view-a18d6b15.js} +1 -1
  25. package/dist/esm-es5/sqm-widget-verification.entry.js +1 -1
  26. package/dist/mint-components/mint-components.esm.js +1 -1
  27. package/dist/mint-components/{p-6596f0de.entry.js → p-094edc0b.entry.js} +1 -1
  28. package/dist/mint-components/p-1a0b9f0f.entry.js +16 -0
  29. package/dist/mint-components/{p-9be145c6.system.entry.js → p-237a21c1.system.entry.js} +1 -1
  30. package/dist/mint-components/p-4b365f1f.system.js +1 -1
  31. package/dist/mint-components/p-4ea9b7ec.system.entry.js +1 -0
  32. package/dist/mint-components/{p-2085bb01.system.entry.js → p-4fbfb954.system.entry.js} +1 -1
  33. package/dist/mint-components/{p-3b2ae7b9.entry.js → p-66c070e2.entry.js} +2 -2
  34. package/dist/mint-components/{p-a0667674.system.entry.js → p-6e6f19ea.system.entry.js} +1 -1
  35. package/dist/mint-components/{p-9f21ea69.js → p-725c542a.js} +1 -1
  36. package/dist/mint-components/{p-aa0b0cd6.entry.js → p-c7cac01e.entry.js} +1 -1
  37. package/dist/mint-components/{p-3dc1e209.system.js → p-debe7d04.system.js} +1 -1
  38. package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +73 -0
  39. package/dist/types/components.d.ts +146 -0
  40. package/docs/docs.docx +0 -0
  41. package/docs/raisins.json +1 -1
  42. package/grapesjs/grapesjs.js +1 -1
  43. package/package.json +1 -1
  44. package/dist/cjs/sqm-partner-info-modal.cjs.entry.js +0 -396
  45. package/dist/esm/sqm-partner-info-modal.entry.js +0 -392
  46. package/dist/esm-es5/sqm-partner-info-modal.entry.js +0 -1
  47. package/dist/mint-components/mint-components.system.js +0 -1
  48. package/dist/mint-components/p-ef64e6f0.entry.js +0 -16
  49. package/dist/mint-components/p-fd214860.system.entry.js +0 -1
  50. package/dist/mint-components/sqm-partner-info-modal.entry.js +0 -392
  51. package/dist/mint-components/sqm-partner-info-modal.system.entry.js +0 -1
  52. package/dist/mint-components/sqm-widget-verification.entry.js +0 -228
  53. package/dist/mint-components/sqm-widget-verification.system.entry.js +0 -1
@@ -1,392 +0,0 @@
1
- import { r as registerInstance, h as h$1 } from './index-d9876cd5.js';
2
- import { i as useState, j as useEffect, o as h } from './dom-context-hooks.module-8411297a.js';
3
- import { d as dist, L, w as wn, $ as $e, i as isDemo } from './index.module-5db56a7a.js';
4
- import './jss-preset-default.esm-c36417f8.js';
5
- import './JSS-8c381d8b.js';
6
- import { g as getProps } from './utils-61821fb1.js';
7
- import { c as cjs } from './cjs-e829b75b.js';
8
- import { P as PartnerInfoModalView } from './sqm-partner-info-modal-view-eb3493ec.js';
9
- import { T as TAX_FORM_UPDATED_EVENT_KEY } from './eventKeys-f76b6a03.js';
10
-
11
- // new field under impactConnection:{ resolvedByEmail: boolean } - determines if connection came from managed identity
12
- const GET_USER_PARTNER_INFO = dist.gql `
13
- query getUserPartnerInfo {
14
- user: viewer {
15
- ... on User {
16
- id
17
- accountId
18
- firstName
19
- lastName
20
- email
21
- countryCode
22
- customFields
23
- impactConnection {
24
- connected
25
- publisher {
26
- phoneNumber
27
- phoneNumberCountryCode
28
- countryCode
29
- currency
30
- requiredTaxDocumentType
31
- currentTaxDocument {
32
- type
33
- status
34
- }
35
- withdrawalSettings {
36
- paymentMethod
37
- }
38
- }
39
- }
40
- }
41
- }
42
- }
43
- `;
44
- const GET_COUNTRIES = dist.gql `
45
- query getCountries {
46
- impactPayoutCountries(limit: 1000) {
47
- data {
48
- countryCode
49
- displayName
50
- }
51
- }
52
- }
53
- `;
54
- const GET_CURRENCIES = dist.gql `
55
- query currencies($locale: RSLocale) {
56
- currencies(limit: 300) {
57
- data {
58
- displayName(locale: $locale)
59
- currencyCode
60
- }
61
- }
62
- }
63
- `;
64
- const CONNECT_PARTNER = dist.gql `
65
- mutation createImpactConnection($vars: ImpactConnectionInput!) {
66
- createImpactConnection(impactConnectionInput: $vars) {
67
- success
68
- validationErrors {
69
- field
70
- message
71
- }
72
- user {
73
- id
74
- accountId
75
- impactConnection {
76
- connected
77
- publisher {
78
- brandedSignup
79
- requiredTaxDocumentType
80
- currentTaxDocument {
81
- type
82
- status
83
- }
84
- }
85
- }
86
- }
87
- }
88
- }
89
- `;
90
- const GET_BRAND_NAME = dist.gql `
91
- query getTenantSettings {
92
- tenantSettings {
93
- companyName
94
- }
95
- }
96
- `;
97
- function usePartnerInfoModal(props) {
98
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
99
- const locale = L();
100
- const { data: userData, loading: userLoading, refetch, } = wn(GET_USER_PARTNER_INFO, {});
101
- const user = userData === null || userData === void 0 ? void 0 : userData.user;
102
- const { data: currenciesData, loading: currenciesLoading } = wn(GET_CURRENCIES, { variables: { locale } });
103
- const { data: countriesData, loading: countriesLoading } = wn(GET_COUNTRIES, {});
104
- const { data: tenantSettingsData } = wn(GET_BRAND_NAME, {});
105
- const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = $e(CONNECT_PARTNER);
106
- 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) || "");
107
- 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) || "");
108
- console.log(countryCode, currency, "initial country and currency state"); // TEMP
109
- const [countrySearch, setCountrySearch] = useState("");
110
- const [currencySearch, setCurrencySearch] = useState("");
111
- const [filteredCountries, setFilteredCountries] = useState(((_e = countriesData === null || countriesData === void 0 ? void 0 : countriesData.impactPayoutCountries) === null || _e === void 0 ? void 0 : _e.data) || []);
112
- const [filteredCurrencies, setFilteredCurrencies] = useState(((_f = currenciesData === null || currenciesData === void 0 ? void 0 : currenciesData.currencies) === null || _f === void 0 ? void 0 : _f.data) || []);
113
- const [error, setError] = useState("");
114
- const [success, setSuccess] = useState(false);
115
- const countries = ((_g = countriesData === null || countriesData === void 0 ? void 0 : countriesData.impactPayoutCountries) === null || _g === void 0 ? void 0 : _g.data) || [];
116
- const currencies = ((_h = currenciesData === null || currenciesData === void 0 ? void 0 : currenciesData.currencies) === null || _h === void 0 ? void 0 : _h.data) || [];
117
- console.log(user, "user data from partner info query"); // TEMP
118
- useEffect(() => {
119
- var _a;
120
- if (userData && ((_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher)) {
121
- setCountryCode(user.impactConnection.publisher.countryCode);
122
- setCurrency(user.impactConnection.publisher.currency);
123
- }
124
- }, [userData]);
125
- useEffect(() => {
126
- if (!(countries === null || countries === void 0 ? void 0 : countries.length))
127
- return;
128
- if (countrySearch.trim() === "") {
129
- setFilteredCountries(countries || []);
130
- }
131
- else {
132
- setFilteredCountries(countries.filter((c) => c.displayName.toLowerCase().includes(countrySearch.toLowerCase())) || []);
133
- }
134
- }, [countrySearch, countries]);
135
- useEffect(() => {
136
- if (!(currencies === null || currencies === void 0 ? void 0 : currencies.length))
137
- return;
138
- if (currencySearch.trim() === "") {
139
- setFilteredCurrencies(currencies || []);
140
- }
141
- else {
142
- setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
143
- }
144
- }, [currencySearch, currencies]);
145
- const impactConnection = user === null || user === void 0 ? void 0 : user.impactConnection;
146
- function onCountryChange(e) {
147
- var _a, _b;
148
- const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
149
- if (!value)
150
- return;
151
- setCountryCode(value);
152
- setCurrency("");
153
- setError("");
154
- }
155
- function onCurrencyChange(e) {
156
- var _a, _b;
157
- const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
158
- if (!value)
159
- return;
160
- setCurrency(value);
161
- setError("");
162
- }
163
- async function onSubmit() {
164
- var _a, _b;
165
- if (!countryCode || !currency) {
166
- setError(props.missingFieldsErrorText);
167
- return;
168
- }
169
- setError("");
170
- try {
171
- const vars = {
172
- user: {
173
- id: user.id,
174
- accountId: user.accountId,
175
- },
176
- firstName: user.firstName,
177
- lastName: user.lastName,
178
- // phoneNumber: null,
179
- // phoneNumberCountryCode: null,
180
- countryCode,
181
- currency,
182
- };
183
- const result = await connectImpactPartner({ vars });
184
- if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message)) {
185
- setError(props.networkErrorText);
186
- return;
187
- }
188
- const connectionResult = result
189
- .createImpactConnection;
190
- console.log(result, connectionResult, "result and connectionResult from creating partner from modal");
191
- if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
192
- const validationMsg = (_b = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors) === null || _b === void 0 ? void 0 : _b.map((e) => e.message).join(". ");
193
- setError(validationMsg || props.networkErrorText);
194
- console.error("Failed to create Impact connection:", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
195
- return;
196
- }
197
- window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
198
- await refetch();
199
- setSuccess(true);
200
- }
201
- catch (e) {
202
- console.error("Partner creation error:", e);
203
- setError(props.networkErrorText);
204
- }
205
- }
206
- console.log(success, "success state in partner info modal");
207
- const showModal = !success &&
208
- !userLoading &&
209
- (!(impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.connected) || !(impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.publisher));
210
- console.log(showModal, "showModal condition in partner info modal"); // TEMP
211
- return {
212
- states: {
213
- open: showModal,
214
- loading: userLoading || countriesLoading || currenciesLoading,
215
- submitting: connectLoading,
216
- isExistingPartner: (impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.connected) || (impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.publisher),
217
- countryCode,
218
- currency,
219
- error,
220
- success,
221
- brandName: ((_j = tenantSettingsData === null || tenantSettingsData === void 0 ? void 0 : tenantSettingsData.tenantSettings) === null || _j === void 0 ? void 0 : _j.companyName) || "",
222
- filteredCountries: filteredCountries || [],
223
- filteredCurrencies: filteredCurrencies || [],
224
- },
225
- callbacks: {
226
- onCountryChange,
227
- onCurrencyChange,
228
- setCurrencySearch,
229
- setCountrySearch,
230
- onSubmit,
231
- onClose: () => {
232
- window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
233
- setSuccess(true);
234
- },
235
- },
236
- text: props.getTextProps(),
237
- };
238
- }
239
-
240
- const PartnerInfoModal = class {
241
- constructor(hostRef) {
242
- registerInstance(this, hostRef);
243
- /**
244
- * Brand name shown in the modal header
245
- *
246
- * @uiName Brand name
247
- */
248
- this.brandName = "";
249
- /**
250
- * Header text when user has no existing partner
251
- *
252
- * @uiName New partner header
253
- * @uiWidget textArea
254
- */
255
- this.modalHeader = "Let's get you ready for rewards";
256
- /**
257
- * Header text when user has an existing partner
258
- *
259
- * @uiName Existing partner header
260
- * @uiWidget textArea
261
- */
262
- this.modalHeaderExistingPartner = "We found an existing account";
263
- /**
264
- * Description for new partner setup
265
- *
266
- * @uiName New partner description
267
- * @uiWidget textArea
268
- */
269
- this.descriptionNewPartner = "Confirm your country and currency now to get your future rewards faster.";
270
- /**
271
- * Description for existing partner confirmation
272
- *
273
- * @uiName Existing partner description
274
- * @uiWidget textArea
275
- */
276
- 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.";
277
- /**
278
- * Support description for existing partner confirmation
279
- *
280
- * @uiName Existing partner support description
281
- * @uiWidget textArea
282
- */
283
- this.supportDescriptionExistingPartner = "If this is a mistake, please contact Support or sign up for this referral program with a different email.";
284
- /**
285
- * @uiName Country label
286
- */
287
- this.countryLabel = "Country";
288
- /**
289
- * @uiName Currency label
290
- */
291
- this.currencyLabel = "Currency";
292
- /**
293
- * @uiName Submit button label
294
- */
295
- this.submitButtonLabel = "Submit";
296
- /**
297
- * @uiName Confirm button label
298
- */
299
- this.confirmButtonLabel = "Confirm";
300
- /**
301
- * @uiName Search country placeholder
302
- */
303
- this.searchCountryPlaceholder = "Search for a country";
304
- /**
305
- * @uiName Search currency placeholder
306
- */
307
- this.searchCurrencyPlaceholder = "Search for a currency";
308
- /**
309
- * @uiName Network error text
310
- * @uiWidget textArea
311
- */
312
- this.networkErrorText = "An error occurred. Please try again.";
313
- /**
314
- * @uiName Missing fields error text
315
- * @uiWidget textArea
316
- */
317
- this.missingFieldsErrorText = "Please select both a country and currency.";
318
- h(this);
319
- }
320
- disconnectedCallback() { }
321
- getTextProps() {
322
- return getProps(this);
323
- }
324
- render() {
325
- // AL: TODO add usePartnerInfoModal
326
- const props = isDemo()
327
- ? useDemoPartnerInfoModal(this)
328
- : usePartnerInfoModal(this);
329
- return h$1(PartnerInfoModalView, Object.assign({}, props));
330
- }
331
- };
332
- function useDemoPartnerInfoModal(props) {
333
- const [countryCode, setCountryCode] = useState("US");
334
- const [currency, setCurrency] = useState("");
335
- const [error, setError] = useState("");
336
- return cjs({
337
- states: {
338
- brandName: "Test Brand",
339
- open: true,
340
- loading: false,
341
- submitting: false,
342
- isExistingPartner: false,
343
- countryCode,
344
- currency,
345
- error,
346
- success: false,
347
- filteredCountries: [],
348
- filteredCurrencies: [],
349
- },
350
- callbacks: {
351
- onCountryChange: (e) => {
352
- var _a, _b;
353
- 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;
354
- if (value) {
355
- setCountryCode(value);
356
- setCurrency("");
357
- }
358
- },
359
- onCurrencyChange: (e) => {
360
- var _a, _b;
361
- 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;
362
- if (value)
363
- setCurrency(value);
364
- },
365
- setCountrySearch: () => { },
366
- setCurrencySearch: () => { },
367
- onSubmit: () => {
368
- if (!countryCode || !currency) {
369
- setError(props.missingFieldsErrorText);
370
- return;
371
- }
372
- setError("");
373
- },
374
- onClose: () => { },
375
- },
376
- text: {
377
- modalHeader: props.modalHeader,
378
- descriptionNewPartner: props.descriptionNewPartner,
379
- descriptionExistingPartner: props.descriptionExistingPartner,
380
- countryLabel: props.countryLabel,
381
- currencyLabel: props.currencyLabel,
382
- submitButtonLabel: props.submitButtonLabel,
383
- confirmButtonLabel: props.confirmButtonLabel,
384
- searchCountryPlaceholder: props.searchCountryPlaceholder,
385
- searchCurrencyPlaceholder: props.searchCurrencyPlaceholder,
386
- supportDescriptionExistingPartner: props.supportDescriptionExistingPartner,
387
- modalHeaderExistingPartner: props.modalHeaderExistingPartner,
388
- },
389
- }, props.demoData || {}, { arrayMerge: (_, a) => a });
390
- }
391
-
392
- export { PartnerInfoModal as sqm_partner_info_modal };
@@ -1 +0,0 @@
1
- var __makeTemplateObject=this&&this.__makeTemplateObject||function(e,n){if(Object.defineProperty){Object.defineProperty(e,"raw",{value:n})}else{e.raw=n}return e};var __awaiter=this&&this.__awaiter||function(e,n,t,r){function o(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function c(e){try{u(r["throw"](e))}catch(e){a(e)}}function u(e){e.done?t(e.value):o(e.value).then(i,c)}u((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,o,a,i;return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(n){return u([e,n])}}function u(i){if(r)throw new TypeError("Generator is already executing.");while(t)try{if(r=1,o&&(a=i[0]&2?o["return"]:i[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,i[1])).done)return a;if(o=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:t.label++;return{value:i[1],done:false};case 5:t.label++;o=i[1];i=[0];continue;case 7:i=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){t=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){t.label=i[1];break}if(i[0]===6&&t.label<a[1]){t.label=a[1];a=i;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(i);break}if(a[2])t.ops.pop();t.trys.pop();continue}i=n.call(e,t)}catch(e){i=[6,e];o=0}finally{r=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};import{r as registerInstance,h as h$1}from"./index-d9876cd5.js";import{i as useState,j as useEffect,o as h}from"./dom-context-hooks.module-8411297a.js";import{d as dist,L,w as wn,$ as $e,i as isDemo}from"./index.module-5db56a7a.js";import"./jss-preset-default.esm-c36417f8.js";import"./JSS-8c381d8b.js";import{g as getProps}from"./utils-61821fb1.js";import{c as cjs}from"./cjs-e829b75b.js";import{P as PartnerInfoModalView}from"./sqm-partner-info-modal-view-eb3493ec.js";import{T as TAX_FORM_UPDATED_EVENT_KEY}from"./eventKeys-f76b6a03.js";var GET_USER_PARTNER_INFO=dist.gql(templateObject_1||(templateObject_1=__makeTemplateObject(["\n query getUserPartnerInfo {\n user: viewer {\n ... on User {\n id\n accountId\n firstName\n lastName\n email\n countryCode\n customFields\n impactConnection {\n connected\n publisher {\n phoneNumber\n phoneNumberCountryCode\n countryCode\n currency\n requiredTaxDocumentType\n currentTaxDocument {\n type\n status\n }\n withdrawalSettings {\n paymentMethod\n }\n }\n }\n }\n }\n }\n"],["\n query getUserPartnerInfo {\n user: viewer {\n ... on User {\n id\n accountId\n firstName\n lastName\n email\n countryCode\n customFields\n impactConnection {\n connected\n publisher {\n phoneNumber\n phoneNumberCountryCode\n countryCode\n currency\n requiredTaxDocumentType\n currentTaxDocument {\n type\n status\n }\n withdrawalSettings {\n paymentMethod\n }\n }\n }\n }\n }\n }\n"])));var GET_COUNTRIES=dist.gql(templateObject_2||(templateObject_2=__makeTemplateObject(["\n query getCountries {\n impactPayoutCountries(limit: 1000) {\n data {\n countryCode\n displayName\n }\n }\n }\n"],["\n query getCountries {\n impactPayoutCountries(limit: 1000) {\n data {\n countryCode\n displayName\n }\n }\n }\n"])));var GET_CURRENCIES=dist.gql(templateObject_3||(templateObject_3=__makeTemplateObject(["\n query currencies($locale: RSLocale) {\n currencies(limit: 300) {\n data {\n displayName(locale: $locale)\n currencyCode\n }\n }\n }\n"],["\n query currencies($locale: RSLocale) {\n currencies(limit: 300) {\n data {\n displayName(locale: $locale)\n currencyCode\n }\n }\n }\n"])));var CONNECT_PARTNER=dist.gql(templateObject_4||(templateObject_4=__makeTemplateObject(["\n mutation createImpactConnection($vars: ImpactConnectionInput!) {\n createImpactConnection(impactConnectionInput: $vars) {\n success\n validationErrors {\n field\n message\n }\n user {\n id\n accountId\n impactConnection {\n connected\n publisher {\n brandedSignup\n requiredTaxDocumentType\n currentTaxDocument {\n type\n status\n }\n }\n }\n }\n }\n }\n"],["\n mutation createImpactConnection($vars: ImpactConnectionInput!) {\n createImpactConnection(impactConnectionInput: $vars) {\n success\n validationErrors {\n field\n message\n }\n user {\n id\n accountId\n impactConnection {\n connected\n publisher {\n brandedSignup\n requiredTaxDocumentType\n currentTaxDocument {\n type\n status\n }\n }\n }\n }\n }\n }\n"])));var GET_BRAND_NAME=dist.gql(templateObject_5||(templateObject_5=__makeTemplateObject(["\n query getTenantSettings {\n tenantSettings {\n companyName\n }\n }\n"],["\n query getTenantSettings {\n tenantSettings {\n companyName\n }\n }\n"])));function usePartnerInfoModal(e){var n,t,r,o,a,i,c,u,s;var l=L();var d=wn(GET_USER_PARTNER_INFO,{}),m=d.data,p=d.loading,v=d.refetch;var f=m===null||m===void 0?void 0:m.user;var y=wn(GET_CURRENCIES,{variables:{locale:l}}),h=y.data,b=y.loading;var C=wn(GET_COUNTRIES,{}),g=C.data,_=C.loading;var E=wn(GET_BRAND_NAME,{}).data;var T=$e(CONNECT_PARTNER),w=T[0],P=T[1],N=P.loading,S=P.errors;var j=useState(((t=(n=f===null||f===void 0?void 0:f.impactConnection)===null||n===void 0?void 0:n.publisher)===null||t===void 0?void 0:t.countryCode)||""),x=j[0],I=j[1];var O=useState(((o=(r=f===null||f===void 0?void 0:f.impactConnection)===null||r===void 0?void 0:r.publisher)===null||o===void 0?void 0:o.currency)||""),D=O[0],R=O[1];console.log(x,D,"initial country and currency state");var k=useState(""),q=k[0],M=k[1];var A=useState(""),U=A[0],$=A[1];var F=useState(((a=g===null||g===void 0?void 0:g.impactPayoutCountries)===null||a===void 0?void 0:a.data)||[]),B=F[0],G=F[1];var H=useState(((i=h===null||h===void 0?void 0:h.currencies)===null||i===void 0?void 0:i.data)||[]),V=H[0],K=H[1];var X=useState(""),Y=X[0],W=X[1];var J=useState(false),z=J[0],Q=J[1];var Z=((c=g===null||g===void 0?void 0:g.impactPayoutCountries)===null||c===void 0?void 0:c.data)||[];var ee=((u=h===null||h===void 0?void 0:h.currencies)===null||u===void 0?void 0:u.data)||[];console.log(f,"user data from partner info query");useEffect((function(){var e;if(m&&((e=f.impactConnection)===null||e===void 0?void 0:e.publisher)){I(f.impactConnection.publisher.countryCode);R(f.impactConnection.publisher.currency)}}),[m]);useEffect((function(){if(!(Z===null||Z===void 0?void 0:Z.length))return;if(q.trim()===""){G(Z||[])}else{G(Z.filter((function(e){return e.displayName.toLowerCase().includes(q.toLowerCase())}))||[])}}),[q,Z]);useEffect((function(){if(!(ee===null||ee===void 0?void 0:ee.length))return;if(U.trim()===""){K(ee||[])}else{K(ee.filter((function(e){return e.currencyCode.toLowerCase().includes(U.toLowerCase())}))||[])}}),[U,ee]);var ne=f===null||f===void 0?void 0:f.impactConnection;function te(e){var n,t;var r=(t=(n=e.detail)===null||n===void 0?void 0:n.item)===null||t===void 0?void 0:t.__value;if(!r)return;I(r);R("");W("")}function re(e){var n,t;var r=(t=(n=e.detail)===null||n===void 0?void 0:n.item)===null||t===void 0?void 0:t.__value;if(!r)return;R(r);W("")}function oe(){return __awaiter(this,void 0,void 0,(function(){var n,t,r,o,a,i,c;return __generator(this,(function(u){switch(u.label){case 0:if(!x||!D){W(e.missingFieldsErrorText);return[2]}W("");u.label=1;case 1:u.trys.push([1,4,,5]);r={user:{id:f.id,accountId:f.accountId},firstName:f.firstName,lastName:f.lastName,countryCode:x,currency:D};return[4,w({vars:r})];case 2:o=u.sent();if(!o||((n=o)===null||n===void 0?void 0:n.message)){W(e.networkErrorText);return[2]}a=o.createImpactConnection;console.log(o,a,"result and connectionResult from creating partner from modal");if(!(a===null||a===void 0?void 0:a.success)){i=(t=a===null||a===void 0?void 0:a.validationErrors)===null||t===void 0?void 0:t.map((function(e){return e.message})).join(". ");W(i||e.networkErrorText);console.error("Failed to create Impact connection:",a===null||a===void 0?void 0:a.validationErrors);return[2]}window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));return[4,v()];case 3:u.sent();Q(true);return[3,5];case 4:c=u.sent();console.error("Partner creation error:",c);W(e.networkErrorText);return[3,5];case 5:return[2]}}))}))}console.log(z,"success state in partner info modal");var ae=!z&&!p&&(!(ne===null||ne===void 0?void 0:ne.connected)||!(ne===null||ne===void 0?void 0:ne.publisher));console.log(ae,"showModal condition in partner info modal");return{states:{open:ae,loading:p||_||b,submitting:N,isExistingPartner:(ne===null||ne===void 0?void 0:ne.connected)||(ne===null||ne===void 0?void 0:ne.publisher),countryCode:x,currency:D,error:Y,success:z,brandName:((s=E===null||E===void 0?void 0:E.tenantSettings)===null||s===void 0?void 0:s.companyName)||"",filteredCountries:B||[],filteredCurrencies:V||[]},callbacks:{onCountryChange:te,onCurrencyChange:re,setCurrencySearch:$,setCountrySearch:M,onSubmit:oe,onClose:function(){window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));Q(true)}},text:e.getTextProps()}}var PartnerInfoModal=function(){function e(e){registerInstance(this,e);this.brandName="";this.modalHeader="Let's get you ready for rewards";this.modalHeaderExistingPartner="We found an existing account";this.descriptionNewPartner="Confirm your country and currency now to get your future rewards faster.";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.";this.supportDescriptionExistingPartner="If this is a mistake, please contact Support or sign up for this referral program with a different email.";this.countryLabel="Country";this.currencyLabel="Currency";this.submitButtonLabel="Submit";this.confirmButtonLabel="Confirm";this.searchCountryPlaceholder="Search for a country";this.searchCurrencyPlaceholder="Search for a currency";this.networkErrorText="An error occurred. Please try again.";this.missingFieldsErrorText="Please select both a country and currency.";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.getTextProps=function(){return getProps(this)};e.prototype.render=function(){var e=isDemo()?useDemoPartnerInfoModal(this):usePartnerInfoModal(this);return h$1(PartnerInfoModalView,Object.assign({},e))};return e}();function useDemoPartnerInfoModal(e){var n=useState("US"),t=n[0],r=n[1];var o=useState(""),a=o[0],i=o[1];var c=useState(""),u=c[0],s=c[1];return cjs({states:{brandName:"Test Brand",open:true,loading:false,submitting:false,isExistingPartner:false,countryCode:t,currency:a,error:u,success:false,filteredCountries:[],filteredCurrencies:[]},callbacks:{onCountryChange:function(e){var n,t;var o=(t=(n=e===null||e===void 0?void 0:e.detail)===null||n===void 0?void 0:n.item)===null||t===void 0?void 0:t.__value;if(o){r(o);i("")}},onCurrencyChange:function(e){var n,t;var r=(t=(n=e===null||e===void 0?void 0:e.detail)===null||n===void 0?void 0:n.item)===null||t===void 0?void 0:t.__value;if(r)i(r)},setCountrySearch:function(){},setCurrencySearch:function(){},onSubmit:function(){if(!t||!a){s(e.missingFieldsErrorText);return}s("")},onClose:function(){}},text:{modalHeader:e.modalHeader,descriptionNewPartner:e.descriptionNewPartner,descriptionExistingPartner:e.descriptionExistingPartner,countryLabel:e.countryLabel,currencyLabel:e.currencyLabel,submitButtonLabel:e.submitButtonLabel,confirmButtonLabel:e.confirmButtonLabel,searchCountryPlaceholder:e.searchCountryPlaceholder,searchCurrencyPlaceholder:e.searchCurrencyPlaceholder,supportDescriptionExistingPartner:e.supportDescriptionExistingPartner,modalHeaderExistingPartner:e.modalHeaderExistingPartner}},e.demoData||{},{arrayMerge:function(e,n){return n}})}export{PartnerInfoModal as sqm_partner_info_modal};var templateObject_1,templateObject_2,templateObject_3,templateObject_4,templateObject_5;