@saasquatch/mint-components 2.1.8-0 → 2.1.8-1
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-1d15cdf7.js → ShadowViewAddon-5ce32291.js} +89 -0
- 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 +2 -16
- package/dist/cjs/{sqm-big-stat_45.cjs.entry.js → sqm-big-stat_46.cjs.entry.js} +329 -1
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +158 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sqm-partner-info-modal/PartnerInfoModal.stories.js +143 -0
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +90 -0
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +462 -0
- package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +180 -0
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +2 -16
- package/dist/esm/{ShadowViewAddon-53b9090b.js → ShadowViewAddon-9d97b5d5.js} +89 -1
- 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 +2 -16
- package/dist/esm/{sqm-big-stat_45.entry.js → sqm-big-stat_46.entry.js} +333 -6
- package/dist/esm/sqm-stencilbook.entry.js +158 -1
- package/dist/esm-es5/{ShadowViewAddon-53b9090b.js → ShadowViewAddon-9d97b5d5.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_46.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-0f036907.system.js +1 -0
- package/dist/mint-components/{p-0e6c90b1.entry.js → p-22e39d2c.entry.js} +90 -21
- package/dist/mint-components/p-499885aa.entry.js +9 -0
- package/dist/mint-components/p-a6621899.system.entry.js +1 -0
- package/dist/mint-components/{p-e980472a.js → p-adc4e263.js} +25 -25
- package/dist/mint-components/{p-7d16ee0e.entry.js → p-b0253f4c.entry.js} +2 -2
- package/dist/mint-components/p-ca098be1.system.js +1 -1
- package/dist/mint-components/p-d93e19e9.system.entry.js +1 -0
- package/dist/mint-components/p-e45a9966.system.entry.js +1 -0
- package/dist/types/components/sqm-partner-info-modal/PartnerInfoModal.stories.d.ts +13 -0
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal-view.d.ts +41 -0
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal.d.ts +80 -0
- package/dist/types/components/sqm-partner-info-modal/usePartnerInfoModal.d.ts +16 -0
- package/dist/types/components.d.ts +138 -0
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/sqm-big-stat_45.entry.js +0 -1
- package/dist/mint-components/p-17b32de7.system.entry.js +0 -1
- package/dist/mint-components/p-54ea8b9b.system.entry.js +0 -1
- package/dist/mint-components/p-807ed3bf.system.js +0 -1
- package/dist/mint-components/p-de7bb373.entry.js +0 -9
- package/dist/mint-components/p-e9258d20.system.entry.js +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { createStyleSheet } from "../../styling/JSS";
|
|
3
|
+
import { intl } from "../../global/global";
|
|
4
|
+
const style = {
|
|
5
|
+
Dialog: {
|
|
6
|
+
"&::part(panel)": {
|
|
7
|
+
maxWidth: "480px",
|
|
8
|
+
},
|
|
9
|
+
"&::part(title)": {
|
|
10
|
+
fontSize: "var(--sl-font-size-x-large)",
|
|
11
|
+
fontWeight: "600",
|
|
12
|
+
padding: "var(--sl-spacing-x-large) var(--sl-spacing-x-large) 0 var(--sl-spacing-x-large)",
|
|
13
|
+
},
|
|
14
|
+
"&::part(body)": {
|
|
15
|
+
padding: "var(--sl-spacing-small) var(--sl-spacing-x-large)",
|
|
16
|
+
fontSize: "var(--sl-font-size-small)",
|
|
17
|
+
overflow: "visible",
|
|
18
|
+
},
|
|
19
|
+
"&::part(footer)": {
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
gap: "var(--sl-spacing-small)",
|
|
23
|
+
padding: "var(--sl-spacing-small) var(--sl-spacing-x-large) var(--sl-spacing-x-large)",
|
|
24
|
+
},
|
|
25
|
+
"&::part(overlay)": {
|
|
26
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
27
|
+
},
|
|
28
|
+
"&::part(close-button)": {
|
|
29
|
+
display: "none",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
FormFields: {
|
|
33
|
+
display: "flex",
|
|
34
|
+
gap: "var(--sl-spacing-medium)",
|
|
35
|
+
marginTop: "var(--sl-spacing-medium)",
|
|
36
|
+
"& > *": {
|
|
37
|
+
flex: 1,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
ErrorMessage: {
|
|
41
|
+
color: "var(--sqm-danger-color-text, #d32f2f)",
|
|
42
|
+
fontSize: "var(--sl-font-size-small)",
|
|
43
|
+
marginTop: "var(--sl-spacing-x-small)",
|
|
44
|
+
},
|
|
45
|
+
SearchInput: {
|
|
46
|
+
"&::part(base)": {
|
|
47
|
+
border: "none",
|
|
48
|
+
borderBottom: "1px solid var(--sl-color-neutral-300)",
|
|
49
|
+
borderRadius: "0",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
export function PartnerInfoModalView(props) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
const { states, callbacks, text } = props;
|
|
56
|
+
const sheet = createStyleSheet(style);
|
|
57
|
+
const styleString = sheet.toString();
|
|
58
|
+
const description = states.isExistingPartner
|
|
59
|
+
? text.descriptionExistingPartner
|
|
60
|
+
: text.descriptionNewPartner;
|
|
61
|
+
const buttonLabel = states.isExistingPartner
|
|
62
|
+
? text.confirmButtonLabel
|
|
63
|
+
: text.submitButtonLabel;
|
|
64
|
+
return (h("sl-dialog", { class: sheet.classes.Dialog, open: states.open, noHeader: false, label: intl.formatMessage({
|
|
65
|
+
id: "modalBrandHeader",
|
|
66
|
+
defaultMessage: text.modalBrandHeader,
|
|
67
|
+
}, { brandName: states.brandName }), "onSl-request-close": (e) => {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
}, "onSl-hide": (e) => {
|
|
70
|
+
var _a;
|
|
71
|
+
// Prevent closing when clicking outside the dialog but not dropdowns
|
|
72
|
+
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
}
|
|
75
|
+
} },
|
|
76
|
+
h("style", { type: "text/css" }, styleString),
|
|
77
|
+
h("p", null, description),
|
|
78
|
+
h("div", { class: sheet.classes.FormFields },
|
|
79
|
+
h("sl-select", { exportparts: "label: input-label, base: input-base", label: text.countryLabel, value: states.countryCode, disabled: states.submitting, required: true, "onSl-select": callbacks.onCountryChange },
|
|
80
|
+
h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCountryPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => { var _a; return callbacks.onCountrySearch(((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) || ""); } }), (_a = states.filteredCountries) === null || _a === void 0 ? void 0 :
|
|
81
|
+
_a.map((c) => (h("sl-menu-item", { value: c.countryCode }, c.displayName)))),
|
|
82
|
+
h("sl-select", { exportparts: "label: input-label, base: input-base", label: text.currencyLabel, value: states.currency, disabled: states.submitting, required: true, "onSl-select": callbacks.onCurrencyChange },
|
|
83
|
+
h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCurrencyPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => { var _a; return callbacks.onCurrencySearch(((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) || ""); } }), (_b = states.filteredCurrencies) === null || _b === void 0 ? void 0 :
|
|
84
|
+
_b.map((c) => (h("sl-menu-item", { value: c.currencyCode },
|
|
85
|
+
c.currencyCode,
|
|
86
|
+
" - ",
|
|
87
|
+
c.displayName))))),
|
|
88
|
+
states.error && h("p", { class: sheet.classes.ErrorMessage }, states.error),
|
|
89
|
+
h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting || !states.countryCode || !states.currency, onClick: callbacks.onSubmit, style: { width: "100%" }, exportparts: "base: primarybutton-base" }, buttonLabel)));
|
|
90
|
+
}
|
|
@@ -0,0 +1,462 @@
|
|
|
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
|
+
}
|