@saasquatch/mint-components 2.1.8-1 → 2.1.8-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.
- package/dist/cjs/{ShadowViewAddon-5ce32291.js → ShadowViewAddon-a26deae6.js} +1 -90
- 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 +54 -381
- package/dist/cjs/{sqm-big-stat_46.cjs.entry.js → sqm-big-stat_45.cjs.entry.js} +9 -332
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +2 -158
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/sqm-referral-iframe/ReferralIframe.stories.js +1 -0
- package/dist/collection/components/sqm-referral-iframe/sqm-referral-iframe-view.js +1 -1
- package/dist/collection/components/sqm-referral-iframe/sqm-referral-iframe.js +27 -1
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +0 -2
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/formDefinitions.js +37 -75
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +13 -688
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +1 -95
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +4 -4
- package/dist/collection/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +6 -6
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +2 -2
- package/dist/esm/{ShadowViewAddon-9d97b5d5.js → ShadowViewAddon-47f1e579.js} +2 -90
- 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 +54 -381
- package/dist/esm/{sqm-big-stat_46.entry.js → sqm-big-stat_45.entry.js} +14 -336
- package/dist/esm/sqm-stencilbook.entry.js +2 -158
- package/dist/esm-es5/{ShadowViewAddon-9d97b5d5.js → ShadowViewAddon-47f1e579.js} +1 -1
- 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-big-stat_45.entry.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-0614dcbc.entry.js +9 -0
- package/dist/mint-components/{p-adc4e263.js → p-217dedde.js} +25 -25
- package/dist/mint-components/p-5492dd51.system.entry.js +1 -0
- package/dist/mint-components/p-7ee8f2ed.entry.js +273 -0
- package/dist/mint-components/p-bf545082.system.entry.js +1 -0
- package/dist/mint-components/p-ca098be1.system.js +1 -1
- package/dist/mint-components/p-ce050888.system.js +1 -0
- package/dist/mint-components/p-d4f332a7.entry.js +106 -0
- package/dist/mint-components/p-de343dd0.system.entry.js +1 -0
- package/dist/types/components/sqm-referral-iframe/sqm-referral-iframe-view.d.ts +1 -0
- package/dist/types/components/sqm-referral-iframe/sqm-referral-iframe.d.ts +5 -0
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/formDefinitions.d.ts +0 -2
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +0 -4
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.d.ts +0 -165
- package/dist/types/components.d.ts +10 -378
- 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/collection/components/sqm-partner-info-modal/PartnerInfoModal.stories.js +0 -143
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +0 -90
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +0 -462
- package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +0 -180
- package/dist/esm-es5/sqm-big-stat_46.entry.js +0 -1
- package/dist/mint-components/p-0f036907.system.js +0 -1
- package/dist/mint-components/p-22e39d2c.entry.js +0 -342
- package/dist/mint-components/p-499885aa.entry.js +0 -9
- package/dist/mint-components/p-a6621899.system.entry.js +0 -1
- package/dist/mint-components/p-b0253f4c.entry.js +0 -108
- package/dist/mint-components/p-d93e19e9.system.entry.js +0 -1
- package/dist/mint-components/p-e45a9966.system.entry.js +0 -1
- package/dist/types/components/sqm-partner-info-modal/PartnerInfoModal.stories.d.ts +0 -13
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal-view.d.ts +0 -41
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal.d.ts +0 -80
- package/dist/types/components/sqm-partner-info-modal/usePartnerInfoModal.d.ts +0 -16
|
@@ -1,462 +0,0 @@
|
|
|
1
|
-
import { isDemo } from "@saasquatch/component-boilerplate";
|
|
2
|
-
import { useState, withHooks } from "@saasquatch/stencil-hooks";
|
|
3
|
-
import { Component, Prop, h } from "@stencil/core";
|
|
4
|
-
import deepmerge from "deepmerge";
|
|
5
|
-
import { getProps } from "../../utils/utils";
|
|
6
|
-
import { PartnerInfoModalView, } from "./sqm-partner-info-modal-view";
|
|
7
|
-
import { usePartnerInfoModal } from "./usePartnerInfoModal";
|
|
8
|
-
/**
|
|
9
|
-
* @uiName Partner Info Modal
|
|
10
|
-
* @exampleGroup Tax and Cash
|
|
11
|
-
* @validParents ["sqm-portal-container", "sqm-portal-frame", "div", "sqb-program-section", "sqb-conditional-section"]
|
|
12
|
-
* @example Partner Info Modal - <sqm-partner-info-modal></sqm-partner-info-modal>
|
|
13
|
-
*/
|
|
14
|
-
export class PartnerInfoModal {
|
|
15
|
-
constructor() {
|
|
16
|
-
/**
|
|
17
|
-
* Brand name shown in the modal header
|
|
18
|
-
*
|
|
19
|
-
* @uiName Brand name
|
|
20
|
-
*/
|
|
21
|
-
this.brandName = "";
|
|
22
|
-
/**
|
|
23
|
-
* Header text when user has no existing partner
|
|
24
|
-
*
|
|
25
|
-
* @uiName New partner header
|
|
26
|
-
* @uiWidget textArea
|
|
27
|
-
*/
|
|
28
|
-
this.modalBrandHeader = "Welcome to {brandName} Program!";
|
|
29
|
-
/**
|
|
30
|
-
* Description for new partner setup
|
|
31
|
-
*
|
|
32
|
-
* @uiName New partner description
|
|
33
|
-
* @uiWidget textArea
|
|
34
|
-
*/
|
|
35
|
-
this.descriptionNewPartner = "We just need a bit more information about you before you start earning cash!";
|
|
36
|
-
/**
|
|
37
|
-
* Description for existing partner confirmation
|
|
38
|
-
*
|
|
39
|
-
* @uiName Existing partner description
|
|
40
|
-
* @uiWidget textArea
|
|
41
|
-
*/
|
|
42
|
-
this.descriptionExistingPartner = "We noticed you are already an Impact.com partner, please confirm your information.";
|
|
43
|
-
/**
|
|
44
|
-
* @uiName Country label
|
|
45
|
-
*/
|
|
46
|
-
this.countryLabel = "Country";
|
|
47
|
-
/**
|
|
48
|
-
* @uiName Currency label
|
|
49
|
-
*/
|
|
50
|
-
this.currencyLabel = "Currency";
|
|
51
|
-
/**
|
|
52
|
-
* @uiName Submit button label
|
|
53
|
-
*/
|
|
54
|
-
this.submitButtonLabel = "Submit";
|
|
55
|
-
/**
|
|
56
|
-
* @uiName Confirm button label
|
|
57
|
-
*/
|
|
58
|
-
this.confirmButtonLabel = "Confirm";
|
|
59
|
-
/**
|
|
60
|
-
* @uiName Search country placeholder
|
|
61
|
-
*/
|
|
62
|
-
this.searchCountryPlaceholder = "Search for a country";
|
|
63
|
-
/**
|
|
64
|
-
* @uiName Search currency placeholder
|
|
65
|
-
*/
|
|
66
|
-
this.searchCurrencyPlaceholder = "Search for a currency";
|
|
67
|
-
/**
|
|
68
|
-
* @uiName Network error text
|
|
69
|
-
* @uiWidget textArea
|
|
70
|
-
*/
|
|
71
|
-
this.networkErrorText = "An error occurred. Please try again.";
|
|
72
|
-
/**
|
|
73
|
-
* @uiName Missing fields error text
|
|
74
|
-
* @uiWidget textArea
|
|
75
|
-
*/
|
|
76
|
-
this.missingFieldsErrorText = "Please select both a country and currency.";
|
|
77
|
-
withHooks(this);
|
|
78
|
-
}
|
|
79
|
-
disconnectedCallback() { }
|
|
80
|
-
getTextProps() {
|
|
81
|
-
return getProps(this);
|
|
82
|
-
}
|
|
83
|
-
render() {
|
|
84
|
-
// AL: TODO add usePartnerInfoModal
|
|
85
|
-
const props = isDemo()
|
|
86
|
-
? useDemoPartnerInfoModal(this)
|
|
87
|
-
: usePartnerInfoModal(this);
|
|
88
|
-
return h(PartnerInfoModalView, Object.assign({}, props));
|
|
89
|
-
}
|
|
90
|
-
static get is() { return "sqm-partner-info-modal"; }
|
|
91
|
-
static get encapsulation() { return "shadow"; }
|
|
92
|
-
static get properties() { return {
|
|
93
|
-
"brandName": {
|
|
94
|
-
"type": "string",
|
|
95
|
-
"mutable": false,
|
|
96
|
-
"complexType": {
|
|
97
|
-
"original": "string",
|
|
98
|
-
"resolved": "string",
|
|
99
|
-
"references": {}
|
|
100
|
-
},
|
|
101
|
-
"required": false,
|
|
102
|
-
"optional": false,
|
|
103
|
-
"docs": {
|
|
104
|
-
"tags": [{
|
|
105
|
-
"text": "Brand name",
|
|
106
|
-
"name": "uiName"
|
|
107
|
-
}],
|
|
108
|
-
"text": "Brand name shown in the modal header"
|
|
109
|
-
},
|
|
110
|
-
"attribute": "brand-name",
|
|
111
|
-
"reflect": false,
|
|
112
|
-
"defaultValue": "\"\""
|
|
113
|
-
},
|
|
114
|
-
"modalBrandHeader": {
|
|
115
|
-
"type": "string",
|
|
116
|
-
"mutable": false,
|
|
117
|
-
"complexType": {
|
|
118
|
-
"original": "string",
|
|
119
|
-
"resolved": "string",
|
|
120
|
-
"references": {}
|
|
121
|
-
},
|
|
122
|
-
"required": false,
|
|
123
|
-
"optional": false,
|
|
124
|
-
"docs": {
|
|
125
|
-
"tags": [{
|
|
126
|
-
"text": "New partner header",
|
|
127
|
-
"name": "uiName"
|
|
128
|
-
}, {
|
|
129
|
-
"text": "textArea",
|
|
130
|
-
"name": "uiWidget"
|
|
131
|
-
}],
|
|
132
|
-
"text": "Header text when user has no existing partner"
|
|
133
|
-
},
|
|
134
|
-
"attribute": "modal-brand-header",
|
|
135
|
-
"reflect": false,
|
|
136
|
-
"defaultValue": "\"Welcome to {brandName} Program!\""
|
|
137
|
-
},
|
|
138
|
-
"descriptionNewPartner": {
|
|
139
|
-
"type": "string",
|
|
140
|
-
"mutable": false,
|
|
141
|
-
"complexType": {
|
|
142
|
-
"original": "string",
|
|
143
|
-
"resolved": "string",
|
|
144
|
-
"references": {}
|
|
145
|
-
},
|
|
146
|
-
"required": false,
|
|
147
|
-
"optional": false,
|
|
148
|
-
"docs": {
|
|
149
|
-
"tags": [{
|
|
150
|
-
"text": "New partner description",
|
|
151
|
-
"name": "uiName"
|
|
152
|
-
}, {
|
|
153
|
-
"text": "textArea",
|
|
154
|
-
"name": "uiWidget"
|
|
155
|
-
}],
|
|
156
|
-
"text": "Description for new partner setup"
|
|
157
|
-
},
|
|
158
|
-
"attribute": "description-new-partner",
|
|
159
|
-
"reflect": false,
|
|
160
|
-
"defaultValue": "\"We just need a bit more information about you before you start earning cash!\""
|
|
161
|
-
},
|
|
162
|
-
"descriptionExistingPartner": {
|
|
163
|
-
"type": "string",
|
|
164
|
-
"mutable": false,
|
|
165
|
-
"complexType": {
|
|
166
|
-
"original": "string",
|
|
167
|
-
"resolved": "string",
|
|
168
|
-
"references": {}
|
|
169
|
-
},
|
|
170
|
-
"required": false,
|
|
171
|
-
"optional": false,
|
|
172
|
-
"docs": {
|
|
173
|
-
"tags": [{
|
|
174
|
-
"text": "Existing partner description",
|
|
175
|
-
"name": "uiName"
|
|
176
|
-
}, {
|
|
177
|
-
"text": "textArea",
|
|
178
|
-
"name": "uiWidget"
|
|
179
|
-
}],
|
|
180
|
-
"text": "Description for existing partner confirmation"
|
|
181
|
-
},
|
|
182
|
-
"attribute": "description-existing-partner",
|
|
183
|
-
"reflect": false,
|
|
184
|
-
"defaultValue": "\"We noticed you are already an Impact.com partner, please confirm your information.\""
|
|
185
|
-
},
|
|
186
|
-
"countryLabel": {
|
|
187
|
-
"type": "string",
|
|
188
|
-
"mutable": false,
|
|
189
|
-
"complexType": {
|
|
190
|
-
"original": "string",
|
|
191
|
-
"resolved": "string",
|
|
192
|
-
"references": {}
|
|
193
|
-
},
|
|
194
|
-
"required": false,
|
|
195
|
-
"optional": false,
|
|
196
|
-
"docs": {
|
|
197
|
-
"tags": [{
|
|
198
|
-
"text": "Country label",
|
|
199
|
-
"name": "uiName"
|
|
200
|
-
}],
|
|
201
|
-
"text": ""
|
|
202
|
-
},
|
|
203
|
-
"attribute": "country-label",
|
|
204
|
-
"reflect": false,
|
|
205
|
-
"defaultValue": "\"Country\""
|
|
206
|
-
},
|
|
207
|
-
"currencyLabel": {
|
|
208
|
-
"type": "string",
|
|
209
|
-
"mutable": false,
|
|
210
|
-
"complexType": {
|
|
211
|
-
"original": "string",
|
|
212
|
-
"resolved": "string",
|
|
213
|
-
"references": {}
|
|
214
|
-
},
|
|
215
|
-
"required": false,
|
|
216
|
-
"optional": false,
|
|
217
|
-
"docs": {
|
|
218
|
-
"tags": [{
|
|
219
|
-
"text": "Currency label",
|
|
220
|
-
"name": "uiName"
|
|
221
|
-
}],
|
|
222
|
-
"text": ""
|
|
223
|
-
},
|
|
224
|
-
"attribute": "currency-label",
|
|
225
|
-
"reflect": false,
|
|
226
|
-
"defaultValue": "\"Currency\""
|
|
227
|
-
},
|
|
228
|
-
"submitButtonLabel": {
|
|
229
|
-
"type": "string",
|
|
230
|
-
"mutable": false,
|
|
231
|
-
"complexType": {
|
|
232
|
-
"original": "string",
|
|
233
|
-
"resolved": "string",
|
|
234
|
-
"references": {}
|
|
235
|
-
},
|
|
236
|
-
"required": false,
|
|
237
|
-
"optional": false,
|
|
238
|
-
"docs": {
|
|
239
|
-
"tags": [{
|
|
240
|
-
"text": "Submit button label",
|
|
241
|
-
"name": "uiName"
|
|
242
|
-
}],
|
|
243
|
-
"text": ""
|
|
244
|
-
},
|
|
245
|
-
"attribute": "submit-button-label",
|
|
246
|
-
"reflect": false,
|
|
247
|
-
"defaultValue": "\"Submit\""
|
|
248
|
-
},
|
|
249
|
-
"confirmButtonLabel": {
|
|
250
|
-
"type": "string",
|
|
251
|
-
"mutable": false,
|
|
252
|
-
"complexType": {
|
|
253
|
-
"original": "string",
|
|
254
|
-
"resolved": "string",
|
|
255
|
-
"references": {}
|
|
256
|
-
},
|
|
257
|
-
"required": false,
|
|
258
|
-
"optional": false,
|
|
259
|
-
"docs": {
|
|
260
|
-
"tags": [{
|
|
261
|
-
"text": "Confirm button label",
|
|
262
|
-
"name": "uiName"
|
|
263
|
-
}],
|
|
264
|
-
"text": ""
|
|
265
|
-
},
|
|
266
|
-
"attribute": "confirm-button-label",
|
|
267
|
-
"reflect": false,
|
|
268
|
-
"defaultValue": "\"Confirm\""
|
|
269
|
-
},
|
|
270
|
-
"searchCountryPlaceholder": {
|
|
271
|
-
"type": "string",
|
|
272
|
-
"mutable": false,
|
|
273
|
-
"complexType": {
|
|
274
|
-
"original": "string",
|
|
275
|
-
"resolved": "string",
|
|
276
|
-
"references": {}
|
|
277
|
-
},
|
|
278
|
-
"required": false,
|
|
279
|
-
"optional": false,
|
|
280
|
-
"docs": {
|
|
281
|
-
"tags": [{
|
|
282
|
-
"text": "Search country placeholder",
|
|
283
|
-
"name": "uiName"
|
|
284
|
-
}],
|
|
285
|
-
"text": ""
|
|
286
|
-
},
|
|
287
|
-
"attribute": "search-country-placeholder",
|
|
288
|
-
"reflect": false,
|
|
289
|
-
"defaultValue": "\"Search for a country\""
|
|
290
|
-
},
|
|
291
|
-
"searchCurrencyPlaceholder": {
|
|
292
|
-
"type": "string",
|
|
293
|
-
"mutable": false,
|
|
294
|
-
"complexType": {
|
|
295
|
-
"original": "string",
|
|
296
|
-
"resolved": "string",
|
|
297
|
-
"references": {}
|
|
298
|
-
},
|
|
299
|
-
"required": false,
|
|
300
|
-
"optional": false,
|
|
301
|
-
"docs": {
|
|
302
|
-
"tags": [{
|
|
303
|
-
"text": "Search currency placeholder",
|
|
304
|
-
"name": "uiName"
|
|
305
|
-
}],
|
|
306
|
-
"text": ""
|
|
307
|
-
},
|
|
308
|
-
"attribute": "search-currency-placeholder",
|
|
309
|
-
"reflect": false,
|
|
310
|
-
"defaultValue": "\"Search for a currency\""
|
|
311
|
-
},
|
|
312
|
-
"networkErrorText": {
|
|
313
|
-
"type": "string",
|
|
314
|
-
"mutable": false,
|
|
315
|
-
"complexType": {
|
|
316
|
-
"original": "string",
|
|
317
|
-
"resolved": "string",
|
|
318
|
-
"references": {}
|
|
319
|
-
},
|
|
320
|
-
"required": false,
|
|
321
|
-
"optional": false,
|
|
322
|
-
"docs": {
|
|
323
|
-
"tags": [{
|
|
324
|
-
"text": "Network error text",
|
|
325
|
-
"name": "uiName"
|
|
326
|
-
}, {
|
|
327
|
-
"text": "textArea",
|
|
328
|
-
"name": "uiWidget"
|
|
329
|
-
}],
|
|
330
|
-
"text": ""
|
|
331
|
-
},
|
|
332
|
-
"attribute": "network-error-text",
|
|
333
|
-
"reflect": false,
|
|
334
|
-
"defaultValue": "\"An error occurred. Please try again.\""
|
|
335
|
-
},
|
|
336
|
-
"missingFieldsErrorText": {
|
|
337
|
-
"type": "string",
|
|
338
|
-
"mutable": false,
|
|
339
|
-
"complexType": {
|
|
340
|
-
"original": "string",
|
|
341
|
-
"resolved": "string",
|
|
342
|
-
"references": {}
|
|
343
|
-
},
|
|
344
|
-
"required": false,
|
|
345
|
-
"optional": false,
|
|
346
|
-
"docs": {
|
|
347
|
-
"tags": [{
|
|
348
|
-
"text": "Missing fields error text",
|
|
349
|
-
"name": "uiName"
|
|
350
|
-
}, {
|
|
351
|
-
"text": "textArea",
|
|
352
|
-
"name": "uiWidget"
|
|
353
|
-
}],
|
|
354
|
-
"text": ""
|
|
355
|
-
},
|
|
356
|
-
"attribute": "missing-fields-error-text",
|
|
357
|
-
"reflect": false,
|
|
358
|
-
"defaultValue": "\"Please select both a country and currency.\""
|
|
359
|
-
},
|
|
360
|
-
"demoData": {
|
|
361
|
-
"type": "unknown",
|
|
362
|
-
"mutable": false,
|
|
363
|
-
"complexType": {
|
|
364
|
-
"original": "DemoData<PartnerInfoModalViewProps>",
|
|
365
|
-
"resolved": "{ states?: { open: boolean; loading: boolean; submitting: boolean; isExistingPartner: boolean; countryCode: string; currency: string; error: string; success: boolean; brandName: string; filteredCountries: { countryCode: string; displayName: string; }[]; filteredCurrencies: { currencyCode: string; displayName: string; }[]; }; }",
|
|
366
|
-
"references": {
|
|
367
|
-
"DemoData": {
|
|
368
|
-
"location": "import",
|
|
369
|
-
"path": "../../global/demo"
|
|
370
|
-
},
|
|
371
|
-
"PartnerInfoModalViewProps": {
|
|
372
|
-
"location": "import",
|
|
373
|
-
"path": "./sqm-partner-info-modal-view"
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
"required": false,
|
|
378
|
-
"optional": true,
|
|
379
|
-
"docs": {
|
|
380
|
-
"tags": [{
|
|
381
|
-
"text": undefined,
|
|
382
|
-
"name": "undocumented"
|
|
383
|
-
}, {
|
|
384
|
-
"text": "object",
|
|
385
|
-
"name": "uiType"
|
|
386
|
-
}],
|
|
387
|
-
"text": ""
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}; }
|
|
391
|
-
}
|
|
392
|
-
function useDemoPartnerInfoModal(props) {
|
|
393
|
-
const [countryCode, setCountryCode] = useState("US");
|
|
394
|
-
const [currency, setCurrency] = useState("");
|
|
395
|
-
const [error, setError] = useState("");
|
|
396
|
-
const demoCountries = [
|
|
397
|
-
{ countryCode: "US", displayName: "United States" },
|
|
398
|
-
{ countryCode: "CA", displayName: "Canada" },
|
|
399
|
-
{ countryCode: "GB", displayName: "United Kingdom" },
|
|
400
|
-
{ countryCode: "AU", displayName: "Australia" },
|
|
401
|
-
{ countryCode: "DE", displayName: "Germany" },
|
|
402
|
-
];
|
|
403
|
-
const demoCurrencies = [
|
|
404
|
-
{ currencyCode: "USD", displayName: "US Dollar" },
|
|
405
|
-
{ currencyCode: "CAD", displayName: "Canadian Dollar" },
|
|
406
|
-
{ currencyCode: "GBP", displayName: "British Pound" },
|
|
407
|
-
{ currencyCode: "EUR", displayName: "Euro" },
|
|
408
|
-
{ currencyCode: "AUD", displayName: "Australian Dollar" },
|
|
409
|
-
];
|
|
410
|
-
return deepmerge({
|
|
411
|
-
states: {
|
|
412
|
-
brandName: "Test Brand",
|
|
413
|
-
open: true,
|
|
414
|
-
loading: false,
|
|
415
|
-
submitting: false,
|
|
416
|
-
isExistingPartner: false,
|
|
417
|
-
countryCode,
|
|
418
|
-
currency,
|
|
419
|
-
error,
|
|
420
|
-
success: false,
|
|
421
|
-
filteredCountries: demoCountries,
|
|
422
|
-
filteredCurrencies: demoCurrencies,
|
|
423
|
-
},
|
|
424
|
-
callbacks: {
|
|
425
|
-
onCountryChange: (e) => {
|
|
426
|
-
var _a, _b;
|
|
427
|
-
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;
|
|
428
|
-
if (value) {
|
|
429
|
-
setCountryCode(value);
|
|
430
|
-
setCurrency("");
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
onCurrencyChange: (e) => {
|
|
434
|
-
var _a, _b;
|
|
435
|
-
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;
|
|
436
|
-
if (value)
|
|
437
|
-
setCurrency(value);
|
|
438
|
-
},
|
|
439
|
-
onCountrySearch: () => { },
|
|
440
|
-
onCurrencySearch: () => { },
|
|
441
|
-
onSubmit: () => {
|
|
442
|
-
if (!countryCode || !currency) {
|
|
443
|
-
setError(props.missingFieldsErrorText);
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
setError("");
|
|
447
|
-
},
|
|
448
|
-
onClose: () => { },
|
|
449
|
-
},
|
|
450
|
-
text: {
|
|
451
|
-
modalBrandHeader: props.modalBrandHeader,
|
|
452
|
-
descriptionNewPartner: props.descriptionNewPartner,
|
|
453
|
-
descriptionExistingPartner: props.descriptionExistingPartner,
|
|
454
|
-
countryLabel: props.countryLabel,
|
|
455
|
-
currencyLabel: props.currencyLabel,
|
|
456
|
-
submitButtonLabel: props.submitButtonLabel,
|
|
457
|
-
confirmButtonLabel: props.confirmButtonLabel,
|
|
458
|
-
searchCountryPlaceholder: props.searchCountryPlaceholder,
|
|
459
|
-
searchCurrencyPlaceholder: props.searchCurrencyPlaceholder,
|
|
460
|
-
},
|
|
461
|
-
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
462
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { useLocale, useMutation, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
2
|
-
import { useState } from "@saasquatch/universal-hooks";
|
|
3
|
-
import { gql } from "graphql-request";
|
|
4
|
-
import { TAX_FORM_UPDATED_EVENT_KEY } from "../tax-and-cash/eventKeys";
|
|
5
|
-
export const GET_USER_PARTNER_INFO = gql `
|
|
6
|
-
query getUserPartnerInfo {
|
|
7
|
-
user: viewer {
|
|
8
|
-
... on User {
|
|
9
|
-
id
|
|
10
|
-
firstName
|
|
11
|
-
lastName
|
|
12
|
-
email
|
|
13
|
-
countryCode
|
|
14
|
-
customFields
|
|
15
|
-
impactConnection {
|
|
16
|
-
connected
|
|
17
|
-
publisher {
|
|
18
|
-
countryCode
|
|
19
|
-
currency
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
export const GET_COUNTRIES = gql `
|
|
27
|
-
query getCountries {
|
|
28
|
-
impactPayoutCountries(limit: 1000) {
|
|
29
|
-
data {
|
|
30
|
-
countryCode
|
|
31
|
-
displayName
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
export const GET_CURRENCIES = gql `
|
|
37
|
-
query currencies($locale: RSLocale) {
|
|
38
|
-
currencies(limit: 300) {
|
|
39
|
-
data {
|
|
40
|
-
displayName(locale: $locale)
|
|
41
|
-
currencyCode
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
export const CONNECT_PARTNER = gql `
|
|
47
|
-
mutation createImpactConnection($vars: ImpactConnectionInput!) {
|
|
48
|
-
createImpactConnection(impactConnectionInput: $vars) {
|
|
49
|
-
success
|
|
50
|
-
validationErrors {
|
|
51
|
-
field
|
|
52
|
-
message
|
|
53
|
-
}
|
|
54
|
-
user {
|
|
55
|
-
id
|
|
56
|
-
accountId
|
|
57
|
-
impactConnection {
|
|
58
|
-
connected
|
|
59
|
-
publisher {
|
|
60
|
-
brandedSignup
|
|
61
|
-
requiredTaxDocumentType
|
|
62
|
-
currentTaxDocument {
|
|
63
|
-
type
|
|
64
|
-
status
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
const GET_BRAND_NAME = gql `
|
|
73
|
-
query getTenantSettings {
|
|
74
|
-
tenantSettings {
|
|
75
|
-
companyName
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
export function usePartnerInfoModal(props) {
|
|
80
|
-
var _a, _b, _c, _d;
|
|
81
|
-
const user = useUserIdentity();
|
|
82
|
-
const locale = useLocale();
|
|
83
|
-
const { data: userData, loading: userLoading, refetch, } = useQuery(GET_USER_PARTNER_INFO, {}, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
84
|
-
const { data: currenciesData } = useQuery(GET_CURRENCIES, { variables: { locale } }, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
85
|
-
const { data: countriesData } = useQuery(GET_COUNTRIES, {}, !(user === null || user === void 0 ? void 0 : user.jwt));
|
|
86
|
-
const { data: tenantSettingsData } = useQuery(GET_BRAND_NAME, {});
|
|
87
|
-
const [connectImpactPartner, { loading: connectLoading, errors: connectErrors },] = useMutation(CONNECT_PARTNER);
|
|
88
|
-
const [countryCode, setCountryCode] = useState("");
|
|
89
|
-
const [currency, setCurrency] = useState("");
|
|
90
|
-
const [error, setError] = useState("");
|
|
91
|
-
const [success, setSuccess] = useState(false);
|
|
92
|
-
console.log(user, "user identity in create partner modal"); // TEMP
|
|
93
|
-
console.log(userData, "user data from partner info query"); // TEMP
|
|
94
|
-
const impactConnection = (_a = userData === null || userData === void 0 ? void 0 : userData.user) === null || _a === void 0 ? void 0 : _a.impactConnection;
|
|
95
|
-
function onCountryChange(e) {
|
|
96
|
-
var _a, _b;
|
|
97
|
-
const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
98
|
-
if (!value)
|
|
99
|
-
return;
|
|
100
|
-
setCountryCode(value);
|
|
101
|
-
setCurrency("");
|
|
102
|
-
setError("");
|
|
103
|
-
}
|
|
104
|
-
function onCurrencyChange(e) {
|
|
105
|
-
var _a, _b;
|
|
106
|
-
const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
107
|
-
if (!value)
|
|
108
|
-
return;
|
|
109
|
-
setCurrency(value);
|
|
110
|
-
setError("");
|
|
111
|
-
}
|
|
112
|
-
async function onSubmit() {
|
|
113
|
-
var _a, _b;
|
|
114
|
-
if (!countryCode || !currency) {
|
|
115
|
-
setError(props.missingFieldsErrorText);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
setError("");
|
|
119
|
-
// AL TODO: How to create impact connection if we dont have address, postalCode, and city?
|
|
120
|
-
try {
|
|
121
|
-
const vars = {
|
|
122
|
-
user: {
|
|
123
|
-
id: user.id,
|
|
124
|
-
accountId: user.accountId,
|
|
125
|
-
},
|
|
126
|
-
firstName: userData.user.firstName,
|
|
127
|
-
lastName: userData.user.lastName,
|
|
128
|
-
countryCode,
|
|
129
|
-
currency,
|
|
130
|
-
};
|
|
131
|
-
const result = await connectImpactPartner({ vars });
|
|
132
|
-
if (!result || ((_a = result) === null || _a === void 0 ? void 0 : _a.message)) {
|
|
133
|
-
setError(props.networkErrorText);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const connectionResult = result
|
|
137
|
-
.createImpactConnection;
|
|
138
|
-
console.log(result, connectionResult, "result and connectionResult from creating partner from modal");
|
|
139
|
-
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
|
|
140
|
-
const validationMsg = (_b = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors) === null || _b === void 0 ? void 0 : _b.map((e) => e.message).join(". ");
|
|
141
|
-
setError(validationMsg || props.networkErrorText);
|
|
142
|
-
console.error("Failed to create Impact connection:", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
// Success
|
|
146
|
-
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
147
|
-
await refetch();
|
|
148
|
-
setSuccess(true);
|
|
149
|
-
}
|
|
150
|
-
catch (e) {
|
|
151
|
-
console.error("Partner creation error:", e);
|
|
152
|
-
setError(props.networkErrorText);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
const shouldShow = !success && !userLoading && !(impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.connected);
|
|
156
|
-
return {
|
|
157
|
-
states: {
|
|
158
|
-
open: shouldShow,
|
|
159
|
-
loading: userLoading,
|
|
160
|
-
submitting: connectLoading,
|
|
161
|
-
isExistingPartner: !!(impactConnection === null || impactConnection === void 0 ? void 0 : impactConnection.connected),
|
|
162
|
-
countryCode,
|
|
163
|
-
currency,
|
|
164
|
-
error,
|
|
165
|
-
success,
|
|
166
|
-
brandName: ((_b = tenantSettingsData === null || tenantSettingsData === void 0 ? void 0 : tenantSettingsData.tenantSettings) === null || _b === void 0 ? void 0 : _b.companyName) || "",
|
|
167
|
-
filteredCountries: ((_c = countriesData === null || countriesData === void 0 ? void 0 : countriesData.impactPayoutCountries) === null || _c === void 0 ? void 0 : _c.data) || [],
|
|
168
|
-
filteredCurrencies: ((_d = currenciesData === null || currenciesData === void 0 ? void 0 : currenciesData.currencies) === null || _d === void 0 ? void 0 : _d.data) || [],
|
|
169
|
-
},
|
|
170
|
-
callbacks: {
|
|
171
|
-
onCountryChange,
|
|
172
|
-
onCurrencyChange,
|
|
173
|
-
onCountrySearch: () => { },
|
|
174
|
-
onCurrencySearch: () => { },
|
|
175
|
-
onSubmit,
|
|
176
|
-
onClose: () => setSuccess(true),
|
|
177
|
-
},
|
|
178
|
-
text: props.getTextProps(),
|
|
179
|
-
};
|
|
180
|
-
}
|