@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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasquatch/mint-components",
3
3
  "title": "Mint Components",
4
- "version": "2.1.9-0",
4
+ "version": "2.1.9-2",
5
5
  "description": "A minimal design library with components for referral and loyalty experiences. Built with Shoelace components by Saasquatch.",
6
6
  "icon": "https://res.cloudinary.com/saasquatch/image/upload/v1652219900/squatch-assets/For_Mint.svg",
7
7
  "raisins": "docs/raisins.json",
@@ -1,396 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-fd67d7bc.js');
6
- const domContextHooks_module = require('./dom-context-hooks.module-224e09d4.js');
7
- const index_module = require('./index.module-c79bd5b0.js');
8
- require('./jss-preset-default.esm-b48f0c33.js');
9
- require('./JSS-518e9b4d.js');
10
- const utils = require('./utils-e326d1b5.js');
11
- const cjs = require('./cjs-2bf512b9.js');
12
- const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-a56c6df5.js');
13
- const eventKeys = require('./eventKeys-7af4df4d.js');
14
-
15
- // new field under impactConnection:{ resolvedByEmail: boolean } - determines if connection came from managed identity
16
- const GET_USER_PARTNER_INFO = index_module.dist.gql `
17
- query getUserPartnerInfo {
18
- user: viewer {
19
- ... on User {
20
- id
21
- accountId
22
- firstName
23
- lastName
24
- email
25
- countryCode
26
- customFields
27
- impactConnection {
28
- connected
29
- publisher {
30
- phoneNumber
31
- phoneNumberCountryCode
32
- countryCode
33
- currency
34
- requiredTaxDocumentType
35
- currentTaxDocument {
36
- type
37
- status
38
- }
39
- withdrawalSettings {
40
- paymentMethod
41
- }
42
- }
43
- }
44
- }
45
- }
46
- }
47
- `;
48
- const GET_COUNTRIES = index_module.dist.gql `
49
- query getCountries {
50
- impactPayoutCountries(limit: 1000) {
51
- data {
52
- countryCode
53
- displayName
54
- }
55
- }
56
- }
57
- `;
58
- const GET_CURRENCIES = index_module.dist.gql `
59
- query currencies($locale: RSLocale) {
60
- currencies(limit: 300) {
61
- data {
62
- displayName(locale: $locale)
63
- currencyCode
64
- }
65
- }
66
- }
67
- `;
68
- const CONNECT_PARTNER = index_module.dist.gql `
69
- mutation createImpactConnection($vars: ImpactConnectionInput!) {
70
- createImpactConnection(impactConnectionInput: $vars) {
71
- success
72
- validationErrors {
73
- field
74
- message
75
- }
76
- user {
77
- id
78
- accountId
79
- impactConnection {
80
- connected
81
- publisher {
82
- brandedSignup
83
- requiredTaxDocumentType
84
- currentTaxDocument {
85
- type
86
- status
87
- }
88
- }
89
- }
90
- }
91
- }
92
- }
93
- `;
94
- const GET_BRAND_NAME = index_module.dist.gql `
95
- query getTenantSettings {
96
- tenantSettings {
97
- companyName
98
- }
99
- }
100
- `;
101
- function usePartnerInfoModal(props) {
102
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
103
- const locale = index_module.L();
104
- const { data: userData, loading: userLoading, refetch, } = index_module.wn(GET_USER_PARTNER_INFO, {});
105
- const user = userData === null || userData === void 0 ? void 0 : userData.user;
106
- const { data: currenciesData, loading: currenciesLoading } = index_module.wn(GET_CURRENCIES, { variables: { locale } });
107
- const { data: countriesData, loading: countriesLoading } = index_module.wn(GET_COUNTRIES, {});
108
- const { data: tenantSettingsData } = index_module.wn(GET_BRAND_NAME, {});
109
- const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = index_module.$e(CONNECT_PARTNER);
110
- 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) || "");
111
- 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) || "");
112
- console.log(countryCode, currency, "initial country and currency state"); // TEMP
113
- const [countrySearch, setCountrySearch] = domContextHooks_module.useState("");
114
- const [currencySearch, setCurrencySearch] = domContextHooks_module.useState("");
115
- const [filteredCountries, setFilteredCountries] = domContextHooks_module.useState(((_e = countriesData === null || countriesData === void 0 ? void 0 : countriesData.impactPayoutCountries) === null || _e === void 0 ? void 0 : _e.data) || []);
116
- const [filteredCurrencies, setFilteredCurrencies] = domContextHooks_module.useState(((_f = currenciesData === null || currenciesData === void 0 ? void 0 : currenciesData.currencies) === null || _f === void 0 ? void 0 : _f.data) || []);
117
- const [error, setError] = domContextHooks_module.useState("");
118
- const [success, setSuccess] = domContextHooks_module.useState(false);
119
- const countries = ((_g = countriesData === null || countriesData === void 0 ? void 0 : countriesData.impactPayoutCountries) === null || _g === void 0 ? void 0 : _g.data) || [];
120
- const currencies = ((_h = currenciesData === null || currenciesData === void 0 ? void 0 : currenciesData.currencies) === null || _h === void 0 ? void 0 : _h.data) || [];
121
- console.log(user, "user data from partner info query"); // TEMP
122
- domContextHooks_module.useEffect(() => {
123
- var _a;
124
- if (userData && ((_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher)) {
125
- setCountryCode(user.impactConnection.publisher.countryCode);
126
- setCurrency(user.impactConnection.publisher.currency);
127
- }
128
- }, [userData]);
129
- domContextHooks_module.useEffect(() => {
130
- if (!(countries === null || countries === void 0 ? void 0 : countries.length))
131
- return;
132
- if (countrySearch.trim() === "") {
133
- setFilteredCountries(countries || []);
134
- }
135
- else {
136
- setFilteredCountries(countries.filter((c) => c.displayName.toLowerCase().includes(countrySearch.toLowerCase())) || []);
137
- }
138
- }, [countrySearch, countries]);
139
- domContextHooks_module.useEffect(() => {
140
- if (!(currencies === null || currencies === void 0 ? void 0 : currencies.length))
141
- return;
142
- if (currencySearch.trim() === "") {
143
- setFilteredCurrencies(currencies || []);
144
- }
145
- else {
146
- setFilteredCurrencies(currencies.filter((c) => c.currencyCode.toLowerCase().includes(currencySearch.toLowerCase())) || []);
147
- }
148
- }, [currencySearch, currencies]);
149
- const impactConnection = user === null || user === void 0 ? void 0 : user.impactConnection;
150
- function onCountryChange(e) {
151
- var _a, _b;
152
- const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
153
- if (!value)
154
- return;
155
- setCountryCode(value);
156
- setCurrency("");
157
- setError("");
158
- }
159
- function onCurrencyChange(e) {
160
- var _a, _b;
161
- const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
162
- if (!value)
163
- return;
164
- setCurrency(value);
165
- setError("");
166
- }
167
- async function onSubmit() {
168
- var _a, _b;
169
- if (!countryCode || !currency) {
170
- setError(props.missingFieldsErrorText);
171
- return;
172
- }
173
- setError("");
174
- try {
175
- const vars = {
176
- user: {
177
- id: user.id,
178
- accountId: user.accountId,
179
- },
180
- firstName: user.firstName,
181
- lastName: user.lastName,
182
- // phoneNumber: null,
183
- // phoneNumberCountryCode: null,
184
- countryCode,
185
- currency,
186
- };
187
- const result = await connectImpactPartner({ vars });
188
- if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message)) {
189
- setError(props.networkErrorText);
190
- return;
191
- }
192
- const connectionResult = result
193
- .createImpactConnection;
194
- console.log(result, connectionResult, "result and connectionResult from creating partner from modal");
195
- if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
196
- const validationMsg = (_b = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors) === null || _b === void 0 ? void 0 : _b.map((e) => e.message).join(". ");
197
- setError(validationMsg || props.networkErrorText);
198
- console.error("Failed to create Impact connection:", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
199
- return;
200
- }
201
- window.dispatchEvent(new Event(eventKeys.TAX_FORM_UPDATED_EVENT_KEY));
202
- await refetch();
203
- setSuccess(true);
204
- }
205
- catch (e) {
206
- console.error("Partner creation error:", e);
207
- setError(props.networkErrorText);
208
- }
209
- }
210
- console.log(success, "success state in partner info modal");
211
- const showModal = !success &&
212
- !userLoading &&
213
- (!(impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.connected) || !(impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.publisher));
214
- console.log(showModal, "showModal condition in partner info modal"); // TEMP
215
- return {
216
- states: {
217
- open: showModal,
218
- loading: userLoading || countriesLoading || currenciesLoading,
219
- submitting: connectLoading,
220
- isExistingPartner: (impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.connected) || (impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.publisher),
221
- countryCode,
222
- currency,
223
- error,
224
- success,
225
- brandName: ((_j = tenantSettingsData === null || tenantSettingsData === void 0 ? void 0 : tenantSettingsData.tenantSettings) === null || _j === void 0 ? void 0 : _j.companyName) || "",
226
- filteredCountries: filteredCountries || [],
227
- filteredCurrencies: filteredCurrencies || [],
228
- },
229
- callbacks: {
230
- onCountryChange,
231
- onCurrencyChange,
232
- setCurrencySearch,
233
- setCountrySearch,
234
- onSubmit,
235
- onClose: () => {
236
- window.dispatchEvent(new Event(eventKeys.TAX_FORM_UPDATED_EVENT_KEY));
237
- setSuccess(true);
238
- },
239
- },
240
- text: props.getTextProps(),
241
- };
242
- }
243
-
244
- const PartnerInfoModal = class {
245
- constructor(hostRef) {
246
- index.registerInstance(this, hostRef);
247
- /**
248
- * Brand name shown in the modal header
249
- *
250
- * @uiName Brand name
251
- */
252
- this.brandName = "";
253
- /**
254
- * Header text when user has no existing partner
255
- *
256
- * @uiName New partner header
257
- * @uiWidget textArea
258
- */
259
- this.modalHeader = "Let's get you ready for rewards";
260
- /**
261
- * Header text when user has an existing partner
262
- *
263
- * @uiName Existing partner header
264
- * @uiWidget textArea
265
- */
266
- this.modalHeaderExistingPartner = "We found an existing account";
267
- /**
268
- * Description for new partner setup
269
- *
270
- * @uiName New partner description
271
- * @uiWidget textArea
272
- */
273
- this.descriptionNewPartner = "Confirm your country and currency now to get your future rewards faster.";
274
- /**
275
- * Description for existing partner confirmation
276
- *
277
- * @uiName Existing partner description
278
- * @uiWidget textArea
279
- */
280
- 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.";
281
- /**
282
- * Support description for existing partner confirmation
283
- *
284
- * @uiName Existing partner support description
285
- * @uiWidget textArea
286
- */
287
- this.supportDescriptionExistingPartner = "If this is a mistake, please contact Support or sign up for this referral program with a different email.";
288
- /**
289
- * @uiName Country label
290
- */
291
- this.countryLabel = "Country";
292
- /**
293
- * @uiName Currency label
294
- */
295
- this.currencyLabel = "Currency";
296
- /**
297
- * @uiName Submit button label
298
- */
299
- this.submitButtonLabel = "Submit";
300
- /**
301
- * @uiName Confirm button label
302
- */
303
- this.confirmButtonLabel = "Confirm";
304
- /**
305
- * @uiName Search country placeholder
306
- */
307
- this.searchCountryPlaceholder = "Search for a country";
308
- /**
309
- * @uiName Search currency placeholder
310
- */
311
- this.searchCurrencyPlaceholder = "Search for a currency";
312
- /**
313
- * @uiName Network error text
314
- * @uiWidget textArea
315
- */
316
- this.networkErrorText = "An error occurred. Please try again.";
317
- /**
318
- * @uiName Missing fields error text
319
- * @uiWidget textArea
320
- */
321
- this.missingFieldsErrorText = "Please select both a country and currency.";
322
- domContextHooks_module.h$1(this);
323
- }
324
- disconnectedCallback() { }
325
- getTextProps() {
326
- return utils.getProps(this);
327
- }
328
- render() {
329
- // AL: TODO add usePartnerInfoModal
330
- const props = index_module.isDemo()
331
- ? useDemoPartnerInfoModal(this)
332
- : usePartnerInfoModal(this);
333
- return index.h(sqmPartnerInfoModalView.PartnerInfoModalView, Object.assign({}, props));
334
- }
335
- };
336
- function useDemoPartnerInfoModal(props) {
337
- const [countryCode, setCountryCode] = domContextHooks_module.useState("US");
338
- const [currency, setCurrency] = domContextHooks_module.useState("");
339
- const [error, setError] = domContextHooks_module.useState("");
340
- return cjs.cjs({
341
- states: {
342
- brandName: "Test Brand",
343
- open: true,
344
- loading: false,
345
- submitting: false,
346
- isExistingPartner: false,
347
- countryCode,
348
- currency,
349
- error,
350
- success: false,
351
- filteredCountries: [],
352
- filteredCurrencies: [],
353
- },
354
- callbacks: {
355
- onCountryChange: (e) => {
356
- var _a, _b;
357
- 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;
358
- if (value) {
359
- setCountryCode(value);
360
- setCurrency("");
361
- }
362
- },
363
- onCurrencyChange: (e) => {
364
- var _a, _b;
365
- 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;
366
- if (value)
367
- setCurrency(value);
368
- },
369
- setCountrySearch: () => { },
370
- setCurrencySearch: () => { },
371
- onSubmit: () => {
372
- if (!countryCode || !currency) {
373
- setError(props.missingFieldsErrorText);
374
- return;
375
- }
376
- setError("");
377
- },
378
- onClose: () => { },
379
- },
380
- text: {
381
- modalHeader: props.modalHeader,
382
- descriptionNewPartner: props.descriptionNewPartner,
383
- descriptionExistingPartner: props.descriptionExistingPartner,
384
- countryLabel: props.countryLabel,
385
- currencyLabel: props.currencyLabel,
386
- submitButtonLabel: props.submitButtonLabel,
387
- confirmButtonLabel: props.confirmButtonLabel,
388
- searchCountryPlaceholder: props.searchCountryPlaceholder,
389
- searchCurrencyPlaceholder: props.searchCurrencyPlaceholder,
390
- supportDescriptionExistingPartner: props.supportDescriptionExistingPartner,
391
- modalHeaderExistingPartner: props.modalHeaderExistingPartner,
392
- },
393
- }, props.demoData || {}, { arrayMerge: (_, a) => a });
394
- }
395
-
396
- exports.sqm_partner_info_modal = PartnerInfoModal;