@saasquatch/mint-components 2.1.9-10 → 2.1.9-11
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/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-big-stat_46.cjs.entry.js +15 -17
- package/dist/cjs/sqm-email-verification_2.cjs.entry.js +10 -1
- package/dist/cjs/{sqm-partner-info-modal-view-cd758f12.js → sqm-partner-info-modal-view-98e2975d.js} +23 -16
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
- package/dist/cjs/sqm-widget-verification.cjs.entry.js +360 -0
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +22 -16
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +31 -1
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +15 -21
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-big-stat_46.entry.js +15 -17
- package/dist/esm/sqm-email-verification_2.entry.js +10 -1
- package/dist/esm/{sqm-partner-info-modal-view-dbedda28.js → sqm-partner-info-modal-view-74328f70.js} +23 -17
- package/dist/esm/sqm-stencilbook.entry.js +1 -1
- package/dist/esm/sqm-widget-verification.entry.js +356 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-big-stat_46.entry.js +1 -1
- package/dist/esm-es5/sqm-email-verification_2.entry.js +1 -1
- package/dist/esm-es5/sqm-partner-info-modal-view-74328f70.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-widget-verification.entry.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-d2927531.entry.js → p-0a1669f8.entry.js} +1 -1
- package/dist/mint-components/{p-59f69bdc.system.entry.js → p-0a60980a.system.entry.js} +1 -1
- package/dist/mint-components/p-1c413a06.system.js +1 -1
- package/dist/mint-components/p-278897bd.system.entry.js +1 -0
- package/dist/mint-components/{p-7de884a0.system.entry.js → p-53f22cc0.system.entry.js} +1 -1
- package/dist/mint-components/{p-adcc37f3.entry.js → p-8d5db0d5.entry.js} +8 -8
- package/dist/mint-components/p-99b17bca.system.js +1 -0
- package/dist/mint-components/p-c68c2331.js +1 -0
- package/dist/mint-components/{p-d1a2d813.entry.js → p-fa3d7e53.entry.js} +1 -1
- package/dist/mint-components/sqm-widget-verification.entry.js +356 -0
- package/dist/mint-components/sqm-widget-verification.system.entry.js +1 -0
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal-view.d.ts +1 -0
- package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal.d.ts +6 -0
- package/dist/types/components.d.ts +10 -0
- package/docs/docs.docx +0 -0
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/sqm-partner-info-modal-view-dbedda28.js +0 -1
- package/dist/mint-components/p-6638c7c6.system.js +0 -1
- package/dist/mint-components/p-7144ac40.js +0 -1
- package/dist/mint-components/p-7a5814ef.system.entry.js +0 -1
package/dist/esm/{sqm-partner-info-modal-view-dbedda28.js → sqm-partner-info-modal-view-74328f70.js}
RENAMED
|
@@ -59,14 +59,11 @@ const style = {
|
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
|
-
function
|
|
62
|
+
function PartnerInfoModalContent(props) {
|
|
63
63
|
var _a, _b;
|
|
64
64
|
const { states, callbacks, text } = props;
|
|
65
65
|
const sheet = createStyleSheet(style);
|
|
66
66
|
const styleString = sheet.toString();
|
|
67
|
-
console.log(states, "partner info modal states"); // TEMP
|
|
68
|
-
if (!states.open)
|
|
69
|
-
return h("div", null);
|
|
70
67
|
const description = states.isExistingPartner ? (h("div", { class: sheet.classes.DescriptionContainer },
|
|
71
68
|
h("p", null, text.descriptionExistingPartner),
|
|
72
69
|
h("p", null, text.supportDescriptionExistingPartner))) : (h("p", null,
|
|
@@ -75,17 +72,7 @@ function PartnerInfoModalView(props) {
|
|
|
75
72
|
const buttonLabel = states.isExistingPartner
|
|
76
73
|
? text.confirmButtonLabel
|
|
77
74
|
: text.submitButtonLabel;
|
|
78
|
-
return
|
|
79
|
-
? text.modalHeaderExistingPartner
|
|
80
|
-
: text.modalHeader, "onSl-request-close": (e) => {
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
}, "onSl-hide": (e) => {
|
|
83
|
-
var _a;
|
|
84
|
-
// Prevent closing when clicking outside the dialog but not dropdowns
|
|
85
|
-
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
|
|
86
|
-
e.preventDefault();
|
|
87
|
-
}
|
|
88
|
-
} },
|
|
75
|
+
return [
|
|
89
76
|
h("style", { type: "text/css" }, styleString),
|
|
90
77
|
description,
|
|
91
78
|
h("div", { class: sheet.classes.FormFields },
|
|
@@ -99,7 +86,26 @@ function PartnerInfoModalView(props) {
|
|
|
99
86
|
h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCurrencyPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => { var _a; return callbacks.setCurrencySearch((_a = e.target) === null || _a === void 0 ? void 0 : _a.value); } }), (_b = states.filteredCurrencies) === null || _b === void 0 ? void 0 :
|
|
100
87
|
_b.map((c) => (h("sl-menu-item", { value: c.currencyCode }, c.currencyCode))))),
|
|
101
88
|
states.error && h("p", { class: sheet.classes.ErrorMessage }, states.error),
|
|
102
|
-
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)
|
|
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
|
+
];
|
|
91
|
+
}
|
|
92
|
+
function PartnerInfoModalView(props) {
|
|
93
|
+
const { states, text } = props;
|
|
94
|
+
const sheet = createStyleSheet(style);
|
|
95
|
+
console.log(states, "partner info modal states"); // TEMP
|
|
96
|
+
if (!states.open)
|
|
97
|
+
return h("div", null);
|
|
98
|
+
return (h("sl-dialog", { class: sheet.classes.Dialog, open: states.open, noHeader: false, label: states.isExistingPartner
|
|
99
|
+
? text.modalHeaderExistingPartner
|
|
100
|
+
: text.modalHeader, "onSl-request-close": (e) => {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
}, "onSl-hide": (e) => {
|
|
103
|
+
var _a;
|
|
104
|
+
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
}
|
|
107
|
+
} },
|
|
108
|
+
h(PartnerInfoModalContent, Object.assign({}, props))));
|
|
103
109
|
}
|
|
104
110
|
|
|
105
|
-
export { PartnerInfoModalView as P };
|
|
111
|
+
export { PartnerInfoModalView as P, PartnerInfoModalContent as a };
|
|
@@ -34,7 +34,7 @@ import { P as PortalContainerView, a as PortalSectionView } from './sqm-portal-c
|
|
|
34
34
|
import { I as InvoiceTableView, a as INDIRECT_TAX_SPAIN_REGIONS, b as INDIRECT_TAX_PROVINCES, O as OtherRegionSlotView, U as UserInfoFormView$1 } from './sqm-user-info-form-view-f9026468.js';
|
|
35
35
|
import { t as taxTypeToName, L as LoadingView } from './data-2b0feb3f.js';
|
|
36
36
|
import { L as LeadInputFieldView } from './sqm-lead-input-field-view-11a4f9a9.js';
|
|
37
|
-
import { P as PartnerInfoModalView } from './sqm-partner-info-modal-view-
|
|
37
|
+
import { P as PartnerInfoModalView } from './sqm-partner-info-modal-view-74328f70.js';
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -0,0 +1,356 @@
|
|
|
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, J, I as In, r as En, X as Xe, i as isDemo } from './index.module-76b0705d.js';
|
|
4
|
+
import './jss-preset-default.esm-c36417f8.js';
|
|
5
|
+
import { c as createStyleSheet } from './JSS-8c381d8b.js';
|
|
6
|
+
import { g as getProps } from './utils-61821fb1.js';
|
|
7
|
+
import { c as cjs } from './cjs-e829b75b.js';
|
|
8
|
+
import { S as SHOW_CODE_NAMESPACE, a as VERIFICATION_EMAIL_NAMESPACE, V as VERIFICATION_PARENT_NAMESPACE } from './keys-db1897ae.js';
|
|
9
|
+
import { p as parseStates } from './parseStates-ed75e224.js';
|
|
10
|
+
import { e as extractProps } from './extractProps-ae1afbb3.js';
|
|
11
|
+
|
|
12
|
+
const USER_LOOKUP = dist.gql `
|
|
13
|
+
query checkUserVerification {
|
|
14
|
+
viewer {
|
|
15
|
+
... on User {
|
|
16
|
+
id
|
|
17
|
+
accountId
|
|
18
|
+
email
|
|
19
|
+
emailVerified
|
|
20
|
+
managedIdentity {
|
|
21
|
+
email
|
|
22
|
+
emailVerified
|
|
23
|
+
}
|
|
24
|
+
impactConnection {
|
|
25
|
+
connected
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
function useWidgetVerification() {
|
|
32
|
+
const userIdentity = J();
|
|
33
|
+
const [showCode, setShowCode] = In({
|
|
34
|
+
namespace: SHOW_CODE_NAMESPACE,
|
|
35
|
+
initialValue: false,
|
|
36
|
+
});
|
|
37
|
+
const [email, setEmail] = In({
|
|
38
|
+
namespace: VERIFICATION_EMAIL_NAMESPACE,
|
|
39
|
+
initialValue: userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.email,
|
|
40
|
+
});
|
|
41
|
+
const setContext = En(VERIFICATION_PARENT_NAMESPACE);
|
|
42
|
+
const [loading, setLoading] = useState(true);
|
|
43
|
+
const [showPartnerModal, setShowPartnerModal] = useState(false);
|
|
44
|
+
const [fetch] = Xe(USER_LOOKUP);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const checkUser = async () => {
|
|
47
|
+
var _a, _b, _c, _d, _e;
|
|
48
|
+
try {
|
|
49
|
+
const res = await fetch({});
|
|
50
|
+
if (!res || res instanceof Error)
|
|
51
|
+
throw new Error();
|
|
52
|
+
// Flow changed to send email -> verify code -> show early partner creation modal
|
|
53
|
+
const emailVerified = ((_a = res === null || res === void 0 ? void 0 : res.viewer) === null || _a === void 0 ? void 0 : _a.emailVerified) || ((_c = (_b = res === null || res === void 0 ? void 0 : res.viewer) === null || _b === void 0 ? void 0 : _b.managedIdentity) === null || _c === void 0 ? void 0 : _c.emailVerified);
|
|
54
|
+
const isConnected = (_e = (_d = res === null || res === void 0 ? void 0 : res.viewer) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.connected;
|
|
55
|
+
if (isConnected) {
|
|
56
|
+
// Partner already created, show widget content
|
|
57
|
+
setContext(true);
|
|
58
|
+
}
|
|
59
|
+
else if (emailVerified) {
|
|
60
|
+
// Email verified but no partner yet, show partner modal
|
|
61
|
+
setShowPartnerModal(true);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
console.error("Could not fetch user information:", e);
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
setLoading(false);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
checkUser();
|
|
72
|
+
}, []);
|
|
73
|
+
const onVerification = () => {
|
|
74
|
+
setShowPartnerModal(true);
|
|
75
|
+
};
|
|
76
|
+
const onPartnerModalComplete = () => {
|
|
77
|
+
setShowPartnerModal(false);
|
|
78
|
+
setContext(true);
|
|
79
|
+
};
|
|
80
|
+
return { showCode, showPartnerModal, onVerification, onPartnerModalComplete, loading };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const WidgetVerification = class {
|
|
84
|
+
constructor(hostRef) {
|
|
85
|
+
registerInstance(this, hostRef);
|
|
86
|
+
// ! Any updated must be reflected in sqm-widget-verification-internal AND sqm-email-verification AND sqm-code-verification AND sqm-partner-info-modal
|
|
87
|
+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
88
|
+
GENERAL PROPS
|
|
89
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
90
|
+
/**
|
|
91
|
+
* @uiName General verify widget header text
|
|
92
|
+
* @uiGroup General Text
|
|
93
|
+
*/
|
|
94
|
+
this.general_verifyEmailHeader = "Verify your email";
|
|
95
|
+
/**
|
|
96
|
+
* @uiName General verify widget description text
|
|
97
|
+
* @uiGroup General Text
|
|
98
|
+
*/
|
|
99
|
+
this.general_verifyEmailDescription = "To get your cash paid out directly to your bank account, please complete your account setup";
|
|
100
|
+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
101
|
+
EMAIL STEP PROPS
|
|
102
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
103
|
+
/**
|
|
104
|
+
* @uiName Verify email widget header text
|
|
105
|
+
* @uiGroup Email Verification Step
|
|
106
|
+
*/
|
|
107
|
+
this.emailStep_verifyEmailHeaderText = "Start by verifying your email. We’ll send you a code through our referral provider, impact.com.";
|
|
108
|
+
/**
|
|
109
|
+
* @uiName Send code to email alert header
|
|
110
|
+
* @uiGroup Email Verification Step
|
|
111
|
+
*/
|
|
112
|
+
this.emailStep_sendCodeErrorHeader = "There was an error sending your code.";
|
|
113
|
+
/**
|
|
114
|
+
* @uiName Send code to email alert description
|
|
115
|
+
* @uiGroup Email Verification Step
|
|
116
|
+
*/
|
|
117
|
+
this.emailStep_sendCodeErrorDescription = "Please try again. If this problem continues, contact our program support team.";
|
|
118
|
+
/**
|
|
119
|
+
* @uiName Email input label
|
|
120
|
+
* @uiGroup Email Verification Step
|
|
121
|
+
*/
|
|
122
|
+
this.emailStep_emailLabel = "Email";
|
|
123
|
+
/**
|
|
124
|
+
* @uiName Send code button text
|
|
125
|
+
* @uiGroup Email Verification Step
|
|
126
|
+
*/
|
|
127
|
+
this.emailStep_sendCodeText = "Send code";
|
|
128
|
+
/**
|
|
129
|
+
* @uiName Send code button text
|
|
130
|
+
* @uiGroup Email Verification Step
|
|
131
|
+
*/
|
|
132
|
+
this.emailStep_emailValidationErrorText = "Please enter a valid email";
|
|
133
|
+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
134
|
+
CODE STEP PROPS
|
|
135
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
136
|
+
/**
|
|
137
|
+
* @uiName Verify code widget header text
|
|
138
|
+
* @uiGroup Code Verification Step
|
|
139
|
+
*/
|
|
140
|
+
this.codeStep_verifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
|
|
141
|
+
/**
|
|
142
|
+
* @uiName Reverify code widget header text
|
|
143
|
+
* @uiGroup Code Verification Step
|
|
144
|
+
*/
|
|
145
|
+
this.codeStep_reverifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
|
|
146
|
+
/**
|
|
147
|
+
* Text displayed under verify button
|
|
148
|
+
* @uiName Resend code text
|
|
149
|
+
* @uiGroup Code Verification Step
|
|
150
|
+
*/
|
|
151
|
+
this.codeStep_resendCodeText = "Didn't receive your code? {resendCodeLink}";
|
|
152
|
+
/**
|
|
153
|
+
* The link that appears in the resend code link
|
|
154
|
+
* @uiName Resend code label
|
|
155
|
+
* @uiGroup Code Verification Step
|
|
156
|
+
*/
|
|
157
|
+
this.codeStep_resendCodeLabel = "Resend code";
|
|
158
|
+
/**
|
|
159
|
+
* Link text displayed under verify button
|
|
160
|
+
* @uiName Resend code text
|
|
161
|
+
* @uiGroup Code Verification Step
|
|
162
|
+
*/
|
|
163
|
+
this.codeStep_codeResentSuccessfullyText = "Another code has been sent to {email}";
|
|
164
|
+
/**
|
|
165
|
+
* Error text displayed under verification input
|
|
166
|
+
* @uiName Invalid code text
|
|
167
|
+
* @uiGroup Code Verification Step
|
|
168
|
+
*/
|
|
169
|
+
this.codeStep_invalidCodeText = "Please check your code and try again. If you’re still having trouble, try resending your code.";
|
|
170
|
+
/**
|
|
171
|
+
* @uiName Verify code button text
|
|
172
|
+
* @uiGroup Code Verification Step
|
|
173
|
+
*/
|
|
174
|
+
this.codeStep_verifyText = "Verify";
|
|
175
|
+
/**
|
|
176
|
+
* Displayed when the email verification fails due to a network error. The participant can try refreshing the page.
|
|
177
|
+
* @uiName Network error message
|
|
178
|
+
* @uiGroup Code Verification Step
|
|
179
|
+
*/
|
|
180
|
+
this.codeStep_networkErrorMessage = "An error occurred while verifying your email. Please refresh the page and try again.";
|
|
181
|
+
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
182
|
+
PARTNER CREATION STEP PROPS
|
|
183
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
184
|
+
/**
|
|
185
|
+
* @uiName New partner header
|
|
186
|
+
* @uiGroup Partner Creation Step
|
|
187
|
+
* @uiWidget textArea
|
|
188
|
+
*/
|
|
189
|
+
this.createPartnerStep_modalHeader = "Let's get you ready for rewards";
|
|
190
|
+
/**
|
|
191
|
+
* @uiName Existing partner header
|
|
192
|
+
* @uiGroup Partner Creation Step
|
|
193
|
+
* @uiWidget textArea
|
|
194
|
+
*/
|
|
195
|
+
this.createPartnerStep_modalHeaderExistingPartner = "We found an existing account";
|
|
196
|
+
/**
|
|
197
|
+
* @uiName New partner description
|
|
198
|
+
* @uiGroup Partner Creation Step
|
|
199
|
+
* @uiWidget textArea
|
|
200
|
+
*/
|
|
201
|
+
this.createPartnerStep_descriptionNewPartner = "Confirm your country and currency now to get your future rewards faster.";
|
|
202
|
+
/**
|
|
203
|
+
* @uiName Existing partner description
|
|
204
|
+
* @uiGroup Partner Creation Step
|
|
205
|
+
* @uiWidget textArea
|
|
206
|
+
*/
|
|
207
|
+
this.createPartnerStep_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.";
|
|
208
|
+
/**
|
|
209
|
+
* @uiName Existing partner support description
|
|
210
|
+
* @uiGroup Partner Creation Step
|
|
211
|
+
* @uiWidget textArea
|
|
212
|
+
*/
|
|
213
|
+
this.createPartnerStep_supportDescriptionExistingPartner = "If this is a mistake, please contact Support or sign up for this referral program with a different email.";
|
|
214
|
+
/**
|
|
215
|
+
* @uiName Country label
|
|
216
|
+
* @uiGroup Partner Creation Step
|
|
217
|
+
*/
|
|
218
|
+
this.createPartnerStep_countryLabel = "Country";
|
|
219
|
+
/**
|
|
220
|
+
* @uiName Currency label
|
|
221
|
+
* @uiGroup Partner Creation Step
|
|
222
|
+
*/
|
|
223
|
+
this.createPartnerStep_currencyLabel = "Currency";
|
|
224
|
+
/**
|
|
225
|
+
* @uiName Submit button label
|
|
226
|
+
* @uiGroup Partner Creation Step
|
|
227
|
+
*/
|
|
228
|
+
this.createPartnerStep_submitButtonLabel = "Submit";
|
|
229
|
+
/**
|
|
230
|
+
* @uiName Confirm button label
|
|
231
|
+
* @uiGroup Partner Creation Step
|
|
232
|
+
*/
|
|
233
|
+
this.createPartnerStep_confirmButtonLabel = "Confirm";
|
|
234
|
+
/**
|
|
235
|
+
* @uiName Search country placeholder
|
|
236
|
+
* @uiGroup Partner Creation Step
|
|
237
|
+
*/
|
|
238
|
+
this.createPartnerStep_searchCountryPlaceholder = "Search for a country";
|
|
239
|
+
/**
|
|
240
|
+
* @uiName Search currency placeholder
|
|
241
|
+
* @uiGroup Partner Creation Step
|
|
242
|
+
*/
|
|
243
|
+
this.createPartnerStep_searchCurrencyPlaceholder = "Search for a currency";
|
|
244
|
+
/**
|
|
245
|
+
* @uiName Network error text
|
|
246
|
+
* @uiGroup Partner Creation Step
|
|
247
|
+
* @uiWidget textArea
|
|
248
|
+
*/
|
|
249
|
+
this.createPartnerStep_networkErrorText = "An error occurred. Please try again.";
|
|
250
|
+
/**
|
|
251
|
+
* @uiName Missing fields error text
|
|
252
|
+
* @uiGroup Partner Creation Step
|
|
253
|
+
* @uiWidget textArea
|
|
254
|
+
*/
|
|
255
|
+
this.createPartnerStep_missingFieldsErrorText = "Please select both a country and currency.";
|
|
256
|
+
/**
|
|
257
|
+
* @undocumented
|
|
258
|
+
* @componentState { "title": "Step 1: Enter email", "props": { "showCode": false }, "dependencies": ["sqm-email-verification"], "uiGroup": "Email Verification Step" }
|
|
259
|
+
* @componentState { "title": "Step 2: Enter code", "props": { "showCode": true }, "dependencies": ["sqm-code-verification"], "uiGroup": "Code Verification Step" }
|
|
260
|
+
* @componentState { "title": "Step 3: Create Partner", "props": { "showPartnerModal": true }, "dependencies": ["sqm-partner-info-modal"], "uiGroup": "Partner Creation Step" }
|
|
261
|
+
*/
|
|
262
|
+
this.stateController = "{}";
|
|
263
|
+
h(this);
|
|
264
|
+
}
|
|
265
|
+
disconnectedCallback() { }
|
|
266
|
+
getStepTextProps(prefix) {
|
|
267
|
+
const props = getProps(this);
|
|
268
|
+
return extractProps(props, prefix);
|
|
269
|
+
}
|
|
270
|
+
render() {
|
|
271
|
+
const props = isDemo()
|
|
272
|
+
? useDemoWidgetVerificationInternal(this)
|
|
273
|
+
: useWidgetVerification();
|
|
274
|
+
if (props.loading)
|
|
275
|
+
return h$1("sl-spinner", null);
|
|
276
|
+
const style = {
|
|
277
|
+
Dialog: {
|
|
278
|
+
"&::part(panel)": {
|
|
279
|
+
maxWidth: "480px",
|
|
280
|
+
},
|
|
281
|
+
"&::part(title)": {
|
|
282
|
+
fontSize: "var(--sl-font-size-x-large)",
|
|
283
|
+
fontWeight: "600",
|
|
284
|
+
padding: "var(--sl-spacing-x-large) var(--sl-spacing-x-large) 0 var(--sl-spacing-x-large)",
|
|
285
|
+
},
|
|
286
|
+
"&::part(body)": {
|
|
287
|
+
padding: "0 var(--sl-spacing-x-large)",
|
|
288
|
+
fontSize: "var(--sl-font-size-small)",
|
|
289
|
+
overflow: "visible",
|
|
290
|
+
},
|
|
291
|
+
"&::part(footer)": {
|
|
292
|
+
display: "flex",
|
|
293
|
+
flexDirection: "column",
|
|
294
|
+
gap: "var(--sl-spacing-small)",
|
|
295
|
+
},
|
|
296
|
+
"&::part(overlay)": {
|
|
297
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
298
|
+
},
|
|
299
|
+
"&::part(close-button)": {
|
|
300
|
+
display: "none",
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
const sheet = createStyleSheet(style);
|
|
305
|
+
const styleString = sheet.toString();
|
|
306
|
+
const generalText = this.getStepTextProps("general_");
|
|
307
|
+
const partnerText = this.getStepTextProps("createPartnerStep_");
|
|
308
|
+
const dialogLabel = props.showPartnerModal
|
|
309
|
+
? partnerText.modalHeader
|
|
310
|
+
: generalText.verifyEmailHeader;
|
|
311
|
+
const renderStepContent = () => {
|
|
312
|
+
if (props.showPartnerModal) {
|
|
313
|
+
return (h$1("sqm-partner-info-modal", Object.assign({ embedded: true }, partnerText)));
|
|
314
|
+
}
|
|
315
|
+
if (props.showCode) {
|
|
316
|
+
return (h$1("sqm-code-verification", Object.assign({ onVerification: props.onVerification }, this.getStepTextProps("codeStep_"), extractProps(props, "sqm-code-verification_"))));
|
|
317
|
+
}
|
|
318
|
+
return (h$1("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"), extractProps(props, "sqm-email-verification_"))));
|
|
319
|
+
};
|
|
320
|
+
return (h$1("div", null, h$1("style", { type: "text/css" }, styleString), h$1("sl-dialog", { class: sheet.classes.Dialog, noHeader: false, open: true, label: dialogLabel, "onSl-request-close": (e) => {
|
|
321
|
+
e.preventDefault();
|
|
322
|
+
}, "onSl-hide": (e) => {
|
|
323
|
+
var _a;
|
|
324
|
+
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
|
|
325
|
+
e.preventDefault();
|
|
326
|
+
}
|
|
327
|
+
} }, renderStepContent())));
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
function useDemoWidgetVerificationInternal(props) {
|
|
331
|
+
const [showCode, setShowCode] = In({
|
|
332
|
+
namespace: SHOW_CODE_NAMESPACE,
|
|
333
|
+
initialValue: false,
|
|
334
|
+
});
|
|
335
|
+
const [email, setEmail] = In({
|
|
336
|
+
namespace: VERIFICATION_EMAIL_NAMESPACE,
|
|
337
|
+
initialValue: undefined,
|
|
338
|
+
});
|
|
339
|
+
const setContext = En(VERIFICATION_PARENT_NAMESPACE);
|
|
340
|
+
const states = parseStates(props.stateController);
|
|
341
|
+
const formatted = Object.keys(states).reduce((prev, key) => key === "sqm-widget-verification"
|
|
342
|
+
? { ...prev, ...states[key] }
|
|
343
|
+
: { ...prev, [`${key}_stateController`]: states[key] }, {});
|
|
344
|
+
const onVerification = () => {
|
|
345
|
+
setContext(true);
|
|
346
|
+
};
|
|
347
|
+
return cjs({
|
|
348
|
+
showCode,
|
|
349
|
+
showPartnerModal: false,
|
|
350
|
+
onVerification,
|
|
351
|
+
onPartnerModalComplete: () => { },
|
|
352
|
+
loading: false,
|
|
353
|
+
}, formatted || {}, { arrayMerge: (_, a) => a });
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export { WidgetVerification as sqm_widget_verification };
|