@saasquatch/mint-components 2.1.9-11 → 2.1.9-12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mint-components.cjs.js +1 -1
  3. package/dist/cjs/sqm-big-stat_46.cjs.entry.js +8 -5
  4. package/dist/cjs/sqm-email-verification_2.cjs.entry.js +5 -7
  5. package/dist/cjs/{sqm-partner-info-modal-view-98e2975d.js → sqm-partner-info-modal-view-7bcb2262.js} +3 -3
  6. package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
  7. package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +2 -2
  8. package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +8 -10
  9. package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +32 -5
  10. package/dist/esm/loader.js +1 -1
  11. package/dist/esm/mint-components.js +1 -1
  12. package/dist/esm/sqm-big-stat_46.entry.js +8 -5
  13. package/dist/esm/sqm-email-verification_2.entry.js +5 -7
  14. package/dist/esm/{sqm-partner-info-modal-view-74328f70.js → sqm-partner-info-modal-view-dd777f00.js} +3 -3
  15. package/dist/esm/sqm-stencilbook.entry.js +1 -1
  16. package/dist/esm-es5/loader.js +1 -1
  17. package/dist/esm-es5/mint-components.js +1 -1
  18. package/dist/esm-es5/sqm-big-stat_46.entry.js +1 -1
  19. package/dist/esm-es5/sqm-email-verification_2.entry.js +1 -1
  20. package/dist/esm-es5/sqm-partner-info-modal-view-dd777f00.js +1 -0
  21. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  22. package/dist/mint-components/mint-components.esm.js +1 -1
  23. package/dist/mint-components/{p-278897bd.system.entry.js → p-0581c425.system.entry.js} +1 -1
  24. package/dist/mint-components/{p-53f22cc0.system.entry.js → p-0a769ba3.system.entry.js} +1 -1
  25. package/dist/mint-components/p-1c413a06.system.js +1 -1
  26. package/dist/mint-components/{p-0a60980a.system.entry.js → p-50cdc2d0.system.entry.js} +1 -1
  27. package/dist/mint-components/{p-0a1669f8.entry.js → p-52e702ad.entry.js} +1 -1
  28. package/dist/mint-components/{p-8d5db0d5.entry.js → p-aabc6b28.entry.js} +2 -2
  29. package/dist/mint-components/{p-fa3d7e53.entry.js → p-e7c3d207.entry.js} +1 -1
  30. package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal-view.d.ts +1 -1
  31. package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal.d.ts +2 -3
  32. package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +5 -0
  33. package/dist/types/components.d.ts +14 -4
  34. package/docs/docs.docx +0 -0
  35. package/docs/raisins.json +1 -1
  36. package/grapesjs/grapesjs.js +1 -1
  37. package/package.json +1 -1
  38. package/dist/cjs/sqm-widget-verification.cjs.entry.js +0 -360
  39. package/dist/esm/sqm-widget-verification.entry.js +0 -356
  40. package/dist/esm-es5/sqm-partner-info-modal-view-74328f70.js +0 -1
  41. package/dist/esm-es5/sqm-widget-verification.entry.js +0 -1
  42. package/dist/mint-components/sqm-widget-verification.entry.js +0 -356
  43. package/dist/mint-components/sqm-widget-verification.system.entry.js +0 -1
  44. /package/dist/mint-components/{p-c68c2331.js → p-71d00dcf.js} +0 -0
  45. /package/dist/mint-components/{p-99b17bca.system.js → p-f10e42e8.system.js} +0 -0
@@ -1,356 +0,0 @@
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 };
@@ -1 +0,0 @@
1
- import{h}from"./index-38ad4957.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";var style={Dialog:{"&::part(panel)":{maxWidth:"480px"},"&::part(title)":{fontSize:"var(--sl-font-size-x-large)",fontWeight:"600",padding:"var(--sl-spacing-x-large) var(--sl-spacing-x-large) 0 var(--sl-spacing-x-large)"},"&::part(body)":{padding:"0 var(--sl-spacing-x-large)",fontSize:"var(--sl-font-size-small)",overflow:"visible"},"&::part(footer)":{display:"flex",flexDirection:"column",gap:"var(--sl-spacing-small)"},"&::part(overlay)":{background:"rgba(0, 0, 0, 0.5)"},"&::part(close-button)":{display:"none"}},FormFields:{display:"flex",flexDirection:"column",gap:"var(--sl-spacing-medium)",marginTop:"var(--sl-spacing-medium)","& > *":{flex:1}},ErrorMessage:{color:"var(--sqm-danger-color-text, #d32f2f)",fontSize:"var(--sl-font-size-small)",marginTop:"var(--sl-spacing-x-small)"},SearchInput:{"&::part(base)":{border:"none",borderBottom:"1px solid var(--sl-color-neutral-300)",borderRadius:"0"}},DescriptionContainer:{display:"flex",flexDirection:"column",gap:"var(--sl-spacing-medium)",marginTop:"var(--sl-spacing-small)","& > p":{margin:"0"}}};function PartnerInfoModalContent(e){var r,a;var t=e.states,n=e.callbacks,l=e.text;var s=createStyleSheet(style);var o=s.toString();var i=t.isExistingPartner?h("div",{class:s.classes.DescriptionContainer},h("p",null,l.descriptionExistingPartner),h("p",null,l.supportDescriptionExistingPartner)):h("p",null," ",l.descriptionNewPartner);var c=t.isExistingPartner?l.confirmButtonLabel:l.submitButtonLabel;return[h("style",{type:"text/css"},o),i,h("div",{class:s.classes.FormFields},h("sl-select",{key:"country-"+t.countryCode,exportparts:"label: input-label, base: input-base",label:l.countryLabel,value:t.countryCode,disabled:t.submitting||!!t.isExistingPartner,required:true,"onSl-select":n.onCountryChange},h("sl-input",{class:s.classes.SearchInput,placeholder:l.searchCountryPlaceholder,onKeyDown:function(e){return e.stopPropagation()},"onSl-input":function(e){var r;n.setCountrySearch((r=e.target)===null||r===void 0?void 0:r.value)}}),(r=t.filteredCountries)===null||r===void 0?void 0:r.map((function(e){return h("sl-menu-item",{value:e.countryCode},e.displayName)}))),h("sl-select",{key:"currency-"+t.currency,exportparts:"label: input-label, base: input-base",label:l.currencyLabel,value:t.currency,disabled:t.submitting||!!t.isExistingPartner,required:true,"onSl-select":n.onCurrencyChange},h("sl-input",{class:s.classes.SearchInput,placeholder:l.searchCurrencyPlaceholder,onKeyDown:function(e){return e.stopPropagation()},"onSl-input":function(e){var r;return n.setCurrencySearch((r=e.target)===null||r===void 0?void 0:r.value)}}),(a=t.filteredCurrencies)===null||a===void 0?void 0:a.map((function(e){return h("sl-menu-item",{value:e.currencyCode},e.currencyCode)})))),t.error&&h("p",{class:s.classes.ErrorMessage},t.error),h("sl-button",{slot:"footer",type:"primary",loading:t.submitting,disabled:t.submitting||!t.countryCode||!t.currency,onClick:n.onSubmit,style:{width:"100%"},exportparts:"base: primarybutton-base"},c)]}function PartnerInfoModalView(e){var r=e.states,a=e.text;var t=createStyleSheet(style);console.log(r,"partner info modal states");if(!r.open)return h("div",null);return h("sl-dialog",{class:t.classes.Dialog,open:r.open,noHeader:false,label:r.isExistingPartner?a.modalHeaderExistingPartner:a.modalHeader,"onSl-request-close":function(e){e.preventDefault()},"onSl-hide":function(e){var r;if(((r=e.target)===null||r===void 0?void 0:r.tagName)==="SL-DIALOG"){e.preventDefault()}}},h(PartnerInfoModalContent,Object.assign({},e)))}export{PartnerInfoModalView as P,PartnerInfoModalContent as a};
@@ -1 +0,0 @@
1
- var __makeTemplateObject=this&&this.__makeTemplateObject||function(e,r){if(Object.defineProperty){Object.defineProperty(e,"raw",{value:r})}else{e.raw=r}return e};var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++){r=arguments[t];for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n))e[n]=r[n]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,r,t,a){function n(e){return e instanceof t?e:new t((function(r){r(e)}))}return new(t||(t=Promise))((function(t,i){function o(e){try{c(a.next(e))}catch(e){i(e)}}function s(e){try{c(a["throw"](e))}catch(e){i(e)}}function c(e){e.done?t(e.value):n(e.value).then(o,s)}c((a=a.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,n,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(r){return c([e,r])}}function c(o){if(a)throw new TypeError("Generator is already executing.");while(t)try{if(a=1,n&&(i=o[0]&2?n["return"]:o[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;if(n=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:t.label++;return{value:o[1],done:false};case 5:t.label++;n=o[1];o=[0];continue;case 7:o=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){t=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){t.label=o[1];break}if(o[0]===6&&t.label<i[1]){t.label=i[1];i=o;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(o);break}if(i[2])t.ops.pop();t.trys.pop();continue}o=r.call(e,t)}catch(e){o=[6,e];n=0}finally{a=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};import{r as registerInstance,h as h$1}from"./index-d9876cd5.js";import{i as useState,j as useEffect,o as h}from"./dom-context-hooks.module-8411297a.js";import{d as dist,J,I as In,r as En,X as Xe,i as isDemo}from"./index.module-76b0705d.js";import"./jss-preset-default.esm-c36417f8.js";import{c as createStyleSheet}from"./JSS-8c381d8b.js";import{g as getProps}from"./utils-61821fb1.js";import{c as cjs}from"./cjs-e829b75b.js";import{S as SHOW_CODE_NAMESPACE,a as VERIFICATION_EMAIL_NAMESPACE,V as VERIFICATION_PARENT_NAMESPACE}from"./keys-db1897ae.js";import{p as parseStates}from"./parseStates-ed75e224.js";import{e as extractProps}from"./extractProps-ae1afbb3.js";var USER_LOOKUP=dist.gql(templateObject_1||(templateObject_1=__makeTemplateObject(["\n query checkUserVerification {\n viewer {\n ... on User {\n id\n accountId\n email\n emailVerified\n managedIdentity {\n email\n emailVerified\n }\n impactConnection {\n connected\n }\n }\n }\n }\n"],["\n query checkUserVerification {\n viewer {\n ... on User {\n id\n accountId\n email\n emailVerified\n managedIdentity {\n email\n emailVerified\n }\n impactConnection {\n connected\n }\n }\n }\n }\n"])));function useWidgetVerification(){var e=this;var r=J();var t=In({namespace:SHOW_CODE_NAMESPACE,initialValue:false}),a=t[0],n=t[1];var i=In({namespace:VERIFICATION_EMAIL_NAMESPACE,initialValue:r===null||r===void 0?void 0:r.email}),o=i[0],s=i[1];var c=En(VERIFICATION_PARENT_NAMESPACE);var l=useState(true),u=l[0],d=l[1];var f=useState(false),p=f[0],m=f[1];var h=Xe(USER_LOOKUP)[0];useEffect((function(){var r=function(){return __awaiter(e,void 0,void 0,(function(){var e,r,t,a,n,i,o,s,l;return __generator(this,(function(u){switch(u.label){case 0:u.trys.push([0,2,3,4]);return[4,h({})];case 1:i=u.sent();if(!i||i instanceof Error)throw new Error;o=((e=i===null||i===void 0?void 0:i.viewer)===null||e===void 0?void 0:e.emailVerified)||((t=(r=i===null||i===void 0?void 0:i.viewer)===null||r===void 0?void 0:r.managedIdentity)===null||t===void 0?void 0:t.emailVerified);s=(n=(a=i===null||i===void 0?void 0:i.viewer)===null||a===void 0?void 0:a.impactConnection)===null||n===void 0?void 0:n.connected;if(s){c(true)}else if(o){m(true)}return[3,4];case 2:l=u.sent();console.error("Could not fetch user information:",l);return[3,4];case 3:d(false);return[7];case 4:return[2]}}))}))};r()}),[]);var v=function(){m(true)};var g=function(){m(false);c(true)};return{showCode:a,showPartnerModal:p,onVerification:v,onPartnerModalComplete:g,loading:u}}var WidgetVerification=function(){function e(e){registerInstance(this,e);this.general_verifyEmailHeader="Verify your email";this.general_verifyEmailDescription="To get your cash paid out directly to your bank account, please complete your account setup";this.emailStep_verifyEmailHeaderText="Start by verifying your email. We’ll send you a code through our referral provider, impact.com.";this.emailStep_sendCodeErrorHeader="There was an error sending your code.";this.emailStep_sendCodeErrorDescription="Please try again. If this problem continues, contact our program support team.";this.emailStep_emailLabel="Email";this.emailStep_sendCodeText="Send code";this.emailStep_emailValidationErrorText="Please enter a valid email";this.codeStep_verifyCodeHeaderText="Enter the code sent to {email} from our referral provider, impact.com.";this.codeStep_reverifyCodeHeaderText="Enter the code sent to {email} from our referral provider, impact.com.";this.codeStep_resendCodeText="Didn't receive your code? {resendCodeLink}";this.codeStep_resendCodeLabel="Resend code";this.codeStep_codeResentSuccessfullyText="Another code has been sent to {email}";this.codeStep_invalidCodeText="Please check your code and try again. If you’re still having trouble, try resending your code.";this.codeStep_verifyText="Verify";this.codeStep_networkErrorMessage="An error occurred while verifying your email. Please refresh the page and try again.";this.createPartnerStep_modalHeader="Let's get you ready for rewards";this.createPartnerStep_modalHeaderExistingPartner="We found an existing account";this.createPartnerStep_descriptionNewPartner="Confirm your country and currency now to get your future rewards faster.";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.";this.createPartnerStep_supportDescriptionExistingPartner="If this is a mistake, please contact Support or sign up for this referral program with a different email.";this.createPartnerStep_countryLabel="Country";this.createPartnerStep_currencyLabel="Currency";this.createPartnerStep_submitButtonLabel="Submit";this.createPartnerStep_confirmButtonLabel="Confirm";this.createPartnerStep_searchCountryPlaceholder="Search for a country";this.createPartnerStep_searchCurrencyPlaceholder="Search for a currency";this.createPartnerStep_networkErrorText="An error occurred. Please try again.";this.createPartnerStep_missingFieldsErrorText="Please select both a country and currency.";this.stateController="{}";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.getStepTextProps=function(e){var r=getProps(this);return extractProps(r,e)};e.prototype.render=function(){var e=this;var r=isDemo()?useDemoWidgetVerificationInternal(this):useWidgetVerification();if(r.loading)return h$1("sl-spinner",null);var t={Dialog:{"&::part(panel)":{maxWidth:"480px"},"&::part(title)":{fontSize:"var(--sl-font-size-x-large)",fontWeight:"600",padding:"var(--sl-spacing-x-large) var(--sl-spacing-x-large) 0 var(--sl-spacing-x-large)"},"&::part(body)":{padding:"0 var(--sl-spacing-x-large)",fontSize:"var(--sl-font-size-small)",overflow:"visible"},"&::part(footer)":{display:"flex",flexDirection:"column",gap:"var(--sl-spacing-small)"},"&::part(overlay)":{background:"rgba(0, 0, 0, 0.5)"},"&::part(close-button)":{display:"none"}}};var a=createStyleSheet(t);var n=a.toString();var i=this.getStepTextProps("general_");var o=this.getStepTextProps("createPartnerStep_");var s=r.showPartnerModal?o.modalHeader:i.verifyEmailHeader;var c=function(){if(r.showPartnerModal){return h$1("sqm-partner-info-modal",Object.assign({embedded:true},o))}if(r.showCode){return h$1("sqm-code-verification",Object.assign({onVerification:r.onVerification},e.getStepTextProps("codeStep_"),extractProps(r,"sqm-code-verification_")))}return h$1("sqm-email-verification",Object.assign({},e.getStepTextProps("emailStep_"),extractProps(r,"sqm-email-verification_")))};return h$1("div",null,h$1("style",{type:"text/css"},n),h$1("sl-dialog",{class:a.classes.Dialog,noHeader:false,open:true,label:s,"onSl-request-close":function(e){e.preventDefault()},"onSl-hide":function(e){var r;if(((r=e.target)===null||r===void 0?void 0:r.tagName)==="SL-DIALOG"){e.preventDefault()}}},c()))};return e}();function useDemoWidgetVerificationInternal(e){var r=In({namespace:SHOW_CODE_NAMESPACE,initialValue:false}),t=r[0],a=r[1];var n=In({namespace:VERIFICATION_EMAIL_NAMESPACE,initialValue:undefined}),i=n[0],o=n[1];var s=En(VERIFICATION_PARENT_NAMESPACE);var c=parseStates(e.stateController);var l=Object.keys(c).reduce((function(e,r){var t;return r==="sqm-widget-verification"?__assign(__assign({},e),c[r]):__assign(__assign({},e),(t={},t[r+"_stateController"]=c[r],t))}),{});var u=function(){s(true)};return cjs({showCode:t,showPartnerModal:false,onVerification:u,onPartnerModalComplete:function(){},loading:false},l||{},{arrayMerge:function(e,r){return r}})}export{WidgetVerification as sqm_widget_verification};var templateObject_1;