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