@saasquatch/mint-components 1.8.5-15 → 1.8.5-17

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 (32) hide show
  1. package/dist/cjs/{sqm-portal-verify-email-view-81ef761a.js → sqm-portal-verify-email-view-1ae5724a.js} +1 -1
  2. package/dist/cjs/sqm-portal-verify-email.cjs.entry.js +20 -6
  3. package/dist/cjs/sqm-stencilbook.cjs.entry.js +3 -1
  4. package/dist/collection/components/sqm-portal-verify-email/PortalVerifyEmail.stories.js +2 -0
  5. package/dist/collection/components/sqm-portal-verify-email/sqm-portal-verify-email-view.js +1 -1
  6. package/dist/collection/components/sqm-portal-verify-email/sqm-portal-verify-email.js +1 -1
  7. package/dist/collection/components/sqm-portal-verify-email/usePortalVerifyEmail.js +20 -6
  8. package/dist/esm/{sqm-portal-verify-email-view-857a46e3.js → sqm-portal-verify-email-view-279b4e58.js} +1 -1
  9. package/dist/esm/sqm-portal-verify-email.entry.js +21 -7
  10. package/dist/esm/sqm-stencilbook.entry.js +3 -1
  11. package/dist/esm-es5/sqm-portal-verify-email-view-279b4e58.js +1 -0
  12. package/dist/esm-es5/sqm-portal-verify-email.entry.js +1 -1
  13. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  14. package/dist/mint-components/mint-components.esm.js +1 -1
  15. package/dist/mint-components/p-0bc62218.system.entry.js +1 -0
  16. package/dist/mint-components/p-44b12b2e.system.js +1 -1
  17. package/dist/mint-components/p-737aac25.entry.js +1 -0
  18. package/dist/mint-components/p-a40d2ed3.system.js +1 -0
  19. package/dist/mint-components/p-b7bd62b1.system.entry.js +1 -0
  20. package/dist/mint-components/p-b9d010e0.js +1 -0
  21. package/dist/mint-components/p-e0d7fab3.entry.js +9 -0
  22. package/dist/types/components/sqm-portal-verify-email/sqm-portal-verify-email-view.d.ts +1 -0
  23. package/dist/types/components/sqm-portal-verify-email/usePortalVerifyEmail.d.ts +1 -0
  24. package/docs/docs.docx +0 -0
  25. package/package.json +1 -1
  26. package/dist/esm-es5/sqm-portal-verify-email-view-857a46e3.js +0 -1
  27. package/dist/mint-components/p-1db8fde3.entry.js +0 -9
  28. package/dist/mint-components/p-335ec624.system.entry.js +0 -1
  29. package/dist/mint-components/p-65200af1.system.js +0 -1
  30. package/dist/mint-components/p-af770211.system.entry.js +0 -1
  31. package/dist/mint-components/p-c16c33d8.entry.js +0 -1
  32. package/dist/mint-components/p-d8e56725.js +0 -1
@@ -26,7 +26,7 @@ function PortalVerifyEmailView(props) {
26
26
  const { states, data, callbacks, content } = props;
27
27
  if (states.loading)
28
28
  return;
29
- if (states.verified) {
29
+ if (states.success) {
30
30
  return (index.h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
31
31
  index.h("style", { type: "text/css" },
32
32
  vanillaStyle,
@@ -10,7 +10,7 @@ require('./mixins-fe9d4112.js');
10
10
  require('./JSS-8503a151.js');
11
11
  const utils = require('./utils-6847bc06.js');
12
12
  require('./sqm-text-span-view-e1cd9bd3.js');
13
- const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-81ef761a.js');
13
+ const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-1ae5724a.js');
14
14
 
15
15
  const SUBMITTED_CONTEXT = "sq:verify-submitted";
16
16
  function setSubmitted(submitted) {
@@ -21,6 +21,8 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
21
21
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22
22
  const submitted = window[SUBMITTED_CONTEXT];
23
23
  const userIdent = index_module.Q();
24
+ const [verificationError, setVerificationError] = stencilHooks_module.useState(null);
25
+ const [success, setSuccess] = stencilHooks_module.useState(false);
24
26
  const email = (_a = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _a === void 0 ? void 0 : _a.email;
25
27
  const [request, { loading, data, errors }] = index_module.an();
26
28
  const urlParams = new URLSearchParams(index_module.$n.location.search);
@@ -52,11 +54,20 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
52
54
  }, 3000);
53
55
  };
54
56
  const submit = async () => {
57
+ var _a;
55
58
  setSubmitted(true);
56
- console.debug("SUBMITTED");
57
- await request({ oobCode });
59
+ const response = await request({ oobCode });
60
+ if (response instanceof Error ||
61
+ !((_a = response === null || response === void 0 ? void 0 : response.verifyManagedIdentityEmail) === null || _a === void 0 ? void 0 : _a.success)) {
62
+ setVerificationError({ message: true });
63
+ }
64
+ console.debug("SUBMITTED", response);
58
65
  };
59
66
  console.log({ hasContext, userIdent, data, submitted, verified, errors });
67
+ stencilHooks_module.useEffect(() => {
68
+ if (errors && !verified)
69
+ setVerificationError(errors);
70
+ }, [errors, verified]);
60
71
  stencilHooks_module.useEffect(() => {
61
72
  if (!data && !submitted && oobCode)
62
73
  submit();
@@ -71,6 +82,8 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
71
82
  // Already verified, begin redirect
72
83
  }
73
84
  if (verified) {
85
+ if (!verificationError)
86
+ setSuccess(true);
74
87
  console.debug("verified");
75
88
  setTimeout(() => {
76
89
  gotoNextPage();
@@ -79,12 +92,13 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
79
92
  return;
80
93
  }
81
94
  }
82
- }, [submitted, data, email, oobCode, oobEmail, submit]);
95
+ }, [submitted, verificationError, data, email, oobCode, oobEmail, submit]);
83
96
  return {
84
97
  states: {
85
98
  loading: loading || disableContinue,
86
- error: ((_f = (_e = (_d = (_c = errors === null || errors === void 0 ? void 0 : errors.response) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.extensions) === null || _f === void 0 ? void 0 : _f.message) || ((_j = (_h = (_g = errors === null || errors === void 0 ? void 0 : errors.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) ||
87
- ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
99
+ success,
100
+ error: ((_f = (_e = (_d = (_c = verificationError === null || verificationError === void 0 ? void 0 : verificationError.response) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.extensions) === null || _f === void 0 ? void 0 : _f.message) || ((_j = (_h = (_g = verificationError === null || verificationError === void 0 ? void 0 : verificationError.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) ||
101
+ ((verificationError === null || verificationError === void 0 ? void 0 : verificationError.message) && networkErrorMessage),
88
102
  verified,
89
103
  },
90
104
  data: {
@@ -27,7 +27,7 @@ const sqmPortalForgotPasswordView = require('./sqm-portal-forgot-password-view-c
27
27
  const sqmPortalProfileView = require('./sqm-portal-profile-view-d8697f23.js');
28
28
  require('./utilities-73df97e1.js');
29
29
  const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-07a13210.js');
30
- const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-81ef761a.js');
30
+ const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-1ae5724a.js');
31
31
  const ShadowViewAddon = require('./ShadowViewAddon-89ba2ab0.js');
32
32
  const sqmPortalContainerView = require('./sqm-portal-container-view-5fb2ad49.js');
33
33
  const sqmInvoiceTableView = require('./sqm-invoice-table-view-501f8985.js');
@@ -7618,6 +7618,7 @@ const errorProps$5 = {
7618
7618
  error: "Something went wrong. Please try again.",
7619
7619
  loading: false,
7620
7620
  verified: false,
7621
+ success: false,
7621
7622
  },
7622
7623
  data: {
7623
7624
  oobCode: "abc123",
@@ -7637,6 +7638,7 @@ const verifiedProps = {
7637
7638
  error: "",
7638
7639
  loading: false,
7639
7640
  verified: true,
7641
+ success: true,
7640
7642
  },
7641
7643
  data: {
7642
7644
  oobCode: "abc123",
@@ -12,6 +12,7 @@ const errorProps = {
12
12
  error: "Something went wrong. Please try again.",
13
13
  loading: false,
14
14
  verified: false,
15
+ success: false,
15
16
  },
16
17
  data: {
17
18
  oobCode: "abc123",
@@ -31,6 +32,7 @@ const verifiedProps = {
31
32
  error: "",
32
33
  loading: false,
33
34
  verified: true,
35
+ success: true,
34
36
  },
35
37
  data: {
36
38
  oobCode: "abc123",
@@ -23,7 +23,7 @@ export function PortalVerifyEmailView(props) {
23
23
  const { states, data, callbacks, content } = props;
24
24
  if (states.loading)
25
25
  return;
26
- if (states.verified) {
26
+ if (states.success) {
27
27
  return (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
28
28
  h("style", { type: "text/css" },
29
29
  vanillaStyle,
@@ -228,7 +228,7 @@ export class PortalVerifyEmail {
228
228
  "mutable": false,
229
229
  "complexType": {
230
230
  "original": "DemoData<PortalVerifyEmailViewProps>",
231
- "resolved": "{ states?: { error: string; loading: boolean; verified: boolean; }; data?: { oobCode: string; }; content?: { verifySuccessText?: string; verifyEmailText?: string; verifyInvalidText?: string; continueText?: string; }; }",
231
+ "resolved": "{ states?: { error: string; loading: boolean; success: boolean; verified: boolean; }; data?: { oobCode: string; }; content?: { verifySuccessText?: string; verifyEmailText?: string; verifyInvalidText?: string; continueText?: string; }; }",
232
232
  "references": {
233
233
  "DemoData": {
234
234
  "location": "import",
@@ -1,5 +1,5 @@
1
1
  import { navigation, setUserIdentity, useUserIdentity, useVerifyEmailMutation, } from "@saasquatch/component-boilerplate";
2
- import { useEffect } from "@saasquatch/universal-hooks";
2
+ import { useEffect, useState } from "@saasquatch/universal-hooks";
3
3
  import { sanitizeUrlPath } from "../../utils/utils";
4
4
  const SUBMITTED_CONTEXT = "sq:verify-submitted";
5
5
  function setSubmitted(submitted) {
@@ -10,6 +10,8 @@ export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText,
10
10
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11
11
  const submitted = window[SUBMITTED_CONTEXT];
12
12
  const userIdent = useUserIdentity();
13
+ const [verificationError, setVerificationError] = useState(null);
14
+ const [success, setSuccess] = useState(false);
13
15
  const email = (_a = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _a === void 0 ? void 0 : _a.email;
14
16
  const [request, { loading, data, errors }] = useVerifyEmailMutation();
15
17
  const urlParams = new URLSearchParams(navigation.location.search);
@@ -41,11 +43,20 @@ export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText,
41
43
  }, 3000);
42
44
  };
43
45
  const submit = async () => {
46
+ var _a;
44
47
  setSubmitted(true);
45
- console.debug("SUBMITTED");
46
- await request({ oobCode });
48
+ const response = await request({ oobCode });
49
+ if (response instanceof Error ||
50
+ !((_a = response === null || response === void 0 ? void 0 : response.verifyManagedIdentityEmail) === null || _a === void 0 ? void 0 : _a.success)) {
51
+ setVerificationError({ message: true });
52
+ }
53
+ console.debug("SUBMITTED", response);
47
54
  };
48
55
  console.log({ hasContext, userIdent, data, submitted, verified, errors });
56
+ useEffect(() => {
57
+ if (errors && !verified)
58
+ setVerificationError(errors);
59
+ }, [errors, verified]);
49
60
  useEffect(() => {
50
61
  if (!data && !submitted && oobCode)
51
62
  submit();
@@ -60,6 +71,8 @@ export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText,
60
71
  // Already verified, begin redirect
61
72
  }
62
73
  if (verified) {
74
+ if (!verificationError)
75
+ setSuccess(true);
63
76
  console.debug("verified");
64
77
  setTimeout(() => {
65
78
  gotoNextPage();
@@ -68,12 +81,13 @@ export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText,
68
81
  return;
69
82
  }
70
83
  }
71
- }, [submitted, data, email, oobCode, oobEmail, submit]);
84
+ }, [submitted, verificationError, data, email, oobCode, oobEmail, submit]);
72
85
  return {
73
86
  states: {
74
87
  loading: loading || disableContinue,
75
- error: ((_f = (_e = (_d = (_c = errors === null || errors === void 0 ? void 0 : errors.response) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.extensions) === null || _f === void 0 ? void 0 : _f.message) || ((_j = (_h = (_g = errors === null || errors === void 0 ? void 0 : errors.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) ||
76
- ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
88
+ success,
89
+ error: ((_f = (_e = (_d = (_c = verificationError === null || verificationError === void 0 ? void 0 : verificationError.response) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.extensions) === null || _f === void 0 ? void 0 : _f.message) || ((_j = (_h = (_g = verificationError === null || verificationError === void 0 ? void 0 : verificationError.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) ||
90
+ ((verificationError === null || verificationError === void 0 ? void 0 : verificationError.message) && networkErrorMessage),
77
91
  verified,
78
92
  },
79
93
  data: {
@@ -24,7 +24,7 @@ function PortalVerifyEmailView(props) {
24
24
  const { states, data, callbacks, content } = props;
25
25
  if (states.loading)
26
26
  return;
27
- if (states.verified) {
27
+ if (states.success) {
28
28
  return (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
29
29
  h("style", { type: "text/css" },
30
30
  vanillaStyle,
@@ -1,12 +1,12 @@
1
1
  import { r as registerInstance, h as h$1 } from './index-17b4da69.js';
2
- import { f as useEffect, n as h } from './stencil-hooks.module-8032b139.js';
2
+ import { k as useState, f as useEffect, n as h } from './stencil-hooks.module-8032b139.js';
3
3
  import { Q, j as an, $ as $n, b as setUserIdentity, i as isDemo } from './index.module-ba0ed7a8.js';
4
4
  import { c as cjs } from './cjs-bdfb4486.js';
5
5
  import './mixins-f60a614c.js';
6
6
  import './JSS-67b5cff8.js';
7
7
  import { s as sanitizeUrlPath, g as getProps } from './utils-334c1e34.js';
8
8
  import './sqm-text-span-view-8d140661.js';
9
- import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-857a46e3.js';
9
+ import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-279b4e58.js';
10
10
 
11
11
  const SUBMITTED_CONTEXT = "sq:verify-submitted";
12
12
  function setSubmitted(submitted) {
@@ -17,6 +17,8 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
17
17
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
18
18
  const submitted = window[SUBMITTED_CONTEXT];
19
19
  const userIdent = Q();
20
+ const [verificationError, setVerificationError] = useState(null);
21
+ const [success, setSuccess] = useState(false);
20
22
  const email = (_a = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _a === void 0 ? void 0 : _a.email;
21
23
  const [request, { loading, data, errors }] = an();
22
24
  const urlParams = new URLSearchParams($n.location.search);
@@ -48,11 +50,20 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
48
50
  }, 3000);
49
51
  };
50
52
  const submit = async () => {
53
+ var _a;
51
54
  setSubmitted(true);
52
- console.debug("SUBMITTED");
53
- await request({ oobCode });
55
+ const response = await request({ oobCode });
56
+ if (response instanceof Error ||
57
+ !((_a = response === null || response === void 0 ? void 0 : response.verifyManagedIdentityEmail) === null || _a === void 0 ? void 0 : _a.success)) {
58
+ setVerificationError({ message: true });
59
+ }
60
+ console.debug("SUBMITTED", response);
54
61
  };
55
62
  console.log({ hasContext, userIdent, data, submitted, verified, errors });
63
+ useEffect(() => {
64
+ if (errors && !verified)
65
+ setVerificationError(errors);
66
+ }, [errors, verified]);
56
67
  useEffect(() => {
57
68
  if (!data && !submitted && oobCode)
58
69
  submit();
@@ -67,6 +78,8 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
67
78
  // Already verified, begin redirect
68
79
  }
69
80
  if (verified) {
81
+ if (!verificationError)
82
+ setSuccess(true);
70
83
  console.debug("verified");
71
84
  setTimeout(() => {
72
85
  gotoNextPage();
@@ -75,12 +88,13 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
75
88
  return;
76
89
  }
77
90
  }
78
- }, [submitted, data, email, oobCode, oobEmail, submit]);
91
+ }, [submitted, verificationError, data, email, oobCode, oobEmail, submit]);
79
92
  return {
80
93
  states: {
81
94
  loading: loading || disableContinue,
82
- error: ((_f = (_e = (_d = (_c = errors === null || errors === void 0 ? void 0 : errors.response) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.extensions) === null || _f === void 0 ? void 0 : _f.message) || ((_j = (_h = (_g = errors === null || errors === void 0 ? void 0 : errors.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) ||
83
- ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
95
+ success,
96
+ error: ((_f = (_e = (_d = (_c = verificationError === null || verificationError === void 0 ? void 0 : verificationError.response) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.extensions) === null || _f === void 0 ? void 0 : _f.message) || ((_j = (_h = (_g = verificationError === null || verificationError === void 0 ? void 0 : verificationError.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) ||
97
+ ((verificationError === null || verificationError === void 0 ? void 0 : verificationError.message) && networkErrorMessage),
84
98
  verified,
85
99
  },
86
100
  data: {
@@ -23,7 +23,7 @@ import { P as PortalForgotPasswordView } from './sqm-portal-forgot-password-view
23
23
  import { P as PortalProfileView } from './sqm-portal-profile-view-13f0ef79.js';
24
24
  import './utilities-21d8a4df.js';
25
25
  import { P as PortalResetPasswordView } from './sqm-portal-reset-password-view-d3e726a9.js';
26
- import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-857a46e3.js';
26
+ import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-279b4e58.js';
27
27
  import { S as ShareButtonView, L as LeaderboardView, C as CopyTextView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalLoginView, f as PortalRegisterView, T as TaskCardView, g as ProgressBarView, h as PoweredByImg$1, i as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, j as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, k as RewardExchangeView, r as rewardExchangeCustomErrorMsg, l as rewardExchangeLongText, m as rewardExchangeSelected, n as chooseAmountFixed, o as chooseAmountFixedNoDescription, p as chooseAmountVariable, q as chooseAmountVariableNoDescription, s as chooseAmountVariableDisabled, t as chooseAmountVariableUnavailable, v as confirmFixed, w as confirmVariable, x as redemptionError, y as queryError, z as success, A as successVariable, F as loading, G as empty$1, J as rewardExchange, K as CardFeedView, M as CouponCodeView, O as ProgressBar$2, Q as autoColorScaleCss, U as ShadowViewAddon } from './ShadowViewAddon-c22043d9.js';
28
28
  import { P as PortalContainerView, a as PortalSectionView } from './sqm-portal-container-view-ab89c6cc.js';
29
29
  import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-d00894ce.js';
@@ -7614,6 +7614,7 @@ const errorProps$5 = {
7614
7614
  error: "Something went wrong. Please try again.",
7615
7615
  loading: false,
7616
7616
  verified: false,
7617
+ success: false,
7617
7618
  },
7618
7619
  data: {
7619
7620
  oobCode: "abc123",
@@ -7633,6 +7634,7 @@ const verifiedProps = {
7633
7634
  error: "",
7634
7635
  loading: false,
7635
7636
  verified: true,
7637
+ success: true,
7636
7638
  },
7637
7639
  data: {
7638
7640
  oobCode: "abc123",
@@ -0,0 +1 @@
1
+ import{h}from"./index-17b4da69.js";import{A as AuthWrapper,a as AuthColumn}from"./mixins-f60a614c.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import{T as TextSpanView}from"./sqm-text-span-view-8d140661.js";var style={Wrapper:AuthWrapper,Column:AuthColumn,ContinueButton:{width:"100%"}};var vanillaStyle="\n:host {\n display: block;\n}\n:host([hidden]): {\n display: none;\n}\n";var sheet=createStyleSheet(style);var styleString=sheet.toString();function PortalVerifyEmailView(e){var t=e.states,s=e.data,r=e.callbacks,a=e.content;if(t.loading)return;if(t.success){return h("div",{class:sheet.classes.Wrapper,part:"sqm-base"},h("style",{type:"text/css"},vanillaStyle,styleString),h(TextSpanView,{type:"h3"},a.verifyEmailText),h("sqm-form-message",{exportparts:"success-icon"},h("div",{part:"successalert-text"},a.verifySuccessText)),h("sl-button",{class:sheet.classes.ContinueButton,onClick:r.gotoNextPage,loading:t.loading,exportparts:"base: primarybutton-base",type:"primary"},a.continueText))}if(t.error||!s.oobCode){return h("div",{class:sheet.classes.Wrapper,part:"sqm-base"},h("style",{type:"text/css"},styleString),h(TextSpanView,{type:"h3"},a.verifyEmailText),h("sqm-form-message",{type:"error",exportparts:"erroralert-icon"},h("div",{part:"erroralert-text"},a.verifyInvalidText)),h("sl-button",{class:sheet.classes.ContinueButton,onClick:r.failed,loading:t.loading,exportparts:"base: primarybutton-base",type:"primary"},a.continueText))}}export{PortalVerifyEmailView as P};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,r){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r["throw"](e))}catch(e){a(e)}}function l(e){e.done?i(e.value):n(e.value).then(o,s)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,n,a,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(t){return l([e,t])}}function l(o){if(r)throw new TypeError("Generator is already executing.");while(i)try{if(r=1,n&&(a=o[0]&2?n["return"]:o[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;if(n=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;n=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(o[0]===6&&i.label<a[1]){i.label=a[1];a=o;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(o);break}if(a[2])i.ops.pop();i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e];n=0}finally{r=a=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-17b4da69.js";import{f as useEffect,n as h}from"./stencil-hooks.module-8032b139.js";import{Q,j as an,$ as $n,b as setUserIdentity,i as isDemo}from"./index.module-ba0ed7a8.js";import{c as cjs}from"./cjs-bdfb4486.js";import"./mixins-f60a614c.js";import"./JSS-67b5cff8.js";import{s as sanitizeUrlPath,g as getProps}from"./utils-334c1e34.js";import"./sqm-text-span-view-8d140661.js";import{P as PortalVerifyEmailView}from"./sqm-portal-verify-email-view-857a46e3.js";var SUBMITTED_CONTEXT="sq:verify-submitted";function setSubmitted(e){window[SUBMITTED_CONTEXT]=e}function usePortalVerifyEmail(e){var t=this;var i=e.nextPage,r=e.failedPage,n=e.verifySuccessText,a=e.verifyEmailText,o=e.verifyInvalidText,s=e.networkErrorMessage,l=e.continueText;var u,c,d,f,v,m,h,y,g;var p=window[SUBMITTED_CONTEXT];var b=Q();var x=(u=b===null||b===void 0?void 0:b.managedIdentity)===null||u===void 0?void 0:u.email;var T=an(),w=T[0],E=T[1],P=E.loading,S=E.data,I=E.errors;var _=new URLSearchParams($n.location.search);var j=_.get("oobCode");var k=_.get("email");var V=_.get("nextPage");var C=S===undefined&&I===undefined&&!!j;var U=localStorage.getItem("sq:user-identity");var D=!!(((c=b===null||b===void 0?void 0:b.managedIdentity)===null||c===void 0?void 0:c.emailVerified)||(S===null||S===void 0?void 0:S.verifyManagedIdentityEmail.success));var M=function(){return $n.push({pathname:r,search:_.toString()&&"?"+_.toString()})};var $=function(){_.delete("nextPage");var e=sanitizeUrlPath(V||i);$n.push(e.href)};var q=function(){console.debug("LOGOUT");setTimeout((function(){$();setUserIdentity(undefined);setSubmitted(false)}),3e3)};var N=function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:setSubmitted(true);console.debug("SUBMITTED");return[4,w({oobCode:j})];case 1:e.sent();return[2]}}))}))};console.log({hasContext:U,userIdent:b,data:S,submitted:p,verified:D,errors:I});useEffect((function(){if(!S&&!p&&j)N();if(p){console.debug("in submit condition");if(x&&x!==k){console.debug("email mismatch");q();return}if(D){console.debug("verified");setTimeout((function(){$();setSubmitted(false)}),3e3);return}}}),[p,S,x,j,k,N]);return{states:{loading:P||C,error:((m=(v=(f=(d=I===null||I===void 0?void 0:I.response)===null||d===void 0?void 0:d.errors)===null||f===void 0?void 0:f[0])===null||v===void 0?void 0:v.extensions)===null||m===void 0?void 0:m.message)||((g=(y=(h=I===null||I===void 0?void 0:I.response)===null||h===void 0?void 0:h.errors)===null||y===void 0?void 0:y[0])===null||g===void 0?void 0:g.message)||(I===null||I===void 0?void 0:I.message)&&s,verified:D},data:{oobCode:j},callbacks:{failed:M,gotoNextPage:$},content:{verifySuccessText:n,verifyEmailText:a,verifyInvalidText:o,continueText:l}}}var PortalVerifyEmail=function(){function e(e){registerInstance(this,e);this.ignored=true;this.nextPage="/";this.failedPage="/";this.verifyEmailText="Verify your email";this.verifySuccessText="Your email has been verified and you are being redirected. If you are not redirected, please click Continue.";this.verifyInvalidText="The email verification code is invalid or has expired, please try again.";this.continueText="Continue";this.networkErrorMessage="An error occurred while verifying your email. Please refresh the page and try again.";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=isDemo()?usePortalVerifyEmailDemo(getProps(this)):usePortalVerifyEmail(getProps(this)),t=e.states,i=e.data,r=e.callbacks,n=e.content;return h$1(PortalVerifyEmailView,{states:t,data:i,callbacks:r,content:n})};return e}();function usePortalVerifyEmailDemo(e){return cjs({states:{error:"",loading:false,verified:true},data:{oobCode:"code"},callbacks:{failed:function(){console.log("failed")},gotoNextPage:function(){}},content:{verifySuccessText:e.verifySuccessText,verifyEmailText:e.verifyEmailText,verifyInvalidText:e.verifyInvalidText,continueText:e.continueText}},e.demoData||{},{arrayMerge:function(e,t){return t}})}export{PortalVerifyEmail as sqm_portal_verify_email};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,i,r){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r["throw"](e))}catch(e){a(e)}}function l(e){e.done?i(e.value):n(e.value).then(o,s)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,n,a,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(t){return l([e,t])}}function l(o){if(r)throw new TypeError("Generator is already executing.");while(i)try{if(r=1,n&&(a=o[0]&2?n["return"]:o[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;if(n=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;n=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(o[0]===6&&i.label<a[1]){i.label=a[1];a=o;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(o);break}if(a[2])i.ops.pop();i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e];n=0}finally{r=a=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-17b4da69.js";import{k as useState,f as useEffect,n as h}from"./stencil-hooks.module-8032b139.js";import{Q,j as an,$ as $n,b as setUserIdentity,i as isDemo}from"./index.module-ba0ed7a8.js";import{c as cjs}from"./cjs-bdfb4486.js";import"./mixins-f60a614c.js";import"./JSS-67b5cff8.js";import{s as sanitizeUrlPath,g as getProps}from"./utils-334c1e34.js";import"./sqm-text-span-view-8d140661.js";import{P as PortalVerifyEmailView}from"./sqm-portal-verify-email-view-279b4e58.js";var SUBMITTED_CONTEXT="sq:verify-submitted";function setSubmitted(e){window[SUBMITTED_CONTEXT]=e}function usePortalVerifyEmail(e){var t=this;var i=e.nextPage,r=e.failedPage,n=e.verifySuccessText,a=e.verifyEmailText,o=e.verifyInvalidText,s=e.networkErrorMessage,l=e.continueText;var u,c,d,f,v,m,y,h,g;var b=window[SUBMITTED_CONTEXT];var p=Q();var x=useState(null),T=x[0],E=x[1];var w=useState(false),P=w[0],S=w[1];var I=(u=p===null||p===void 0?void 0:p.managedIdentity)===null||u===void 0?void 0:u.email;var _=an(),k=_[0],j=_[1],V=j.loading,C=j.data,U=j.errors;var D=new URLSearchParams($n.location.search);var M=D.get("oobCode");var $=D.get("email");var q=D.get("nextPage");var N=C===undefined&&U===undefined&&!!M;var O=localStorage.getItem("sq:user-identity");var B=!!(((c=p===null||p===void 0?void 0:p.managedIdentity)===null||c===void 0?void 0:c.emailVerified)||(C===null||C===void 0?void 0:C.verifyManagedIdentityEmail.success));var X=function(){return $n.push({pathname:r,search:D.toString()&&"?"+D.toString()})};var z=function(){D.delete("nextPage");var e=sanitizeUrlPath(q||i);$n.push(e.href)};var G=function(){console.debug("LOGOUT");setTimeout((function(){z();setUserIdentity(undefined);setSubmitted(false)}),3e3)};var L=function(){return __awaiter(t,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:setSubmitted(true);return[4,k({oobCode:M})];case 1:t=i.sent();if(t instanceof Error||!((e=t===null||t===void 0?void 0:t.verifyManagedIdentityEmail)===null||e===void 0?void 0:e.success)){E({message:true})}console.debug("SUBMITTED",t);return[2]}}))}))};console.log({hasContext:O,userIdent:p,data:C,submitted:b,verified:B,errors:U});useEffect((function(){if(U&&!B)E(U)}),[U,B]);useEffect((function(){if(!C&&!b&&M)L();if(b){console.debug("in submit condition");if(I&&I!==$){console.debug("email mismatch");G();return}if(B){if(!T)S(true);console.debug("verified");setTimeout((function(){z();setSubmitted(false)}),3e3);return}}}),[b,T,C,I,M,$,L]);return{states:{loading:V||N,success:P,error:((m=(v=(f=(d=T===null||T===void 0?void 0:T.response)===null||d===void 0?void 0:d.errors)===null||f===void 0?void 0:f[0])===null||v===void 0?void 0:v.extensions)===null||m===void 0?void 0:m.message)||((g=(h=(y=T===null||T===void 0?void 0:T.response)===null||y===void 0?void 0:y.errors)===null||h===void 0?void 0:h[0])===null||g===void 0?void 0:g.message)||(T===null||T===void 0?void 0:T.message)&&s,verified:B},data:{oobCode:M},callbacks:{failed:X,gotoNextPage:z},content:{verifySuccessText:n,verifyEmailText:a,verifyInvalidText:o,continueText:l}}}var PortalVerifyEmail=function(){function e(e){registerInstance(this,e);this.ignored=true;this.nextPage="/";this.failedPage="/";this.verifyEmailText="Verify your email";this.verifySuccessText="Your email has been verified and you are being redirected. If you are not redirected, please click Continue.";this.verifyInvalidText="The email verification code is invalid or has expired, please try again.";this.continueText="Continue";this.networkErrorMessage="An error occurred while verifying your email. Please refresh the page and try again.";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=isDemo()?usePortalVerifyEmailDemo(getProps(this)):usePortalVerifyEmail(getProps(this)),t=e.states,i=e.data,r=e.callbacks,n=e.content;return h$1(PortalVerifyEmailView,{states:t,data:i,callbacks:r,content:n})};return e}();function usePortalVerifyEmailDemo(e){return cjs({states:{error:"",loading:false,verified:true},data:{oobCode:"code"},callbacks:{failed:function(){console.log("failed")},gotoNextPage:function(){}},content:{verifySuccessText:e.verifySuccessText,verifyEmailText:e.verifyEmailText,verifyInvalidText:e.verifyInvalidText,continueText:e.continueText}},e.demoData||{},{arrayMerge:function(e,t){return t}})}export{PortalVerifyEmail as sqm_portal_verify_email};