@saasquatch/mint-components 1.8.5-31 → 1.8.5-33

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-4f7063ff.js → sqm-portal-verify-email-view-f2952402.js} +2 -2
  2. package/dist/cjs/sqm-portal-verify-email.cjs.entry.js +25 -63
  3. package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -3
  4. package/dist/collection/components/sqm-portal-verify-email/PortalVerifyEmail.stories.js +0 -2
  5. package/dist/collection/components/sqm-portal-verify-email/sqm-portal-verify-email-view.js +2 -2
  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 +13 -62
  8. package/dist/esm/{sqm-portal-verify-email-view-4c562714.js → sqm-portal-verify-email-view-2e1dabcc.js} +2 -2
  9. package/dist/esm/sqm-portal-verify-email.entry.js +25 -63
  10. package/dist/esm/sqm-stencilbook.entry.js +1 -3
  11. package/dist/esm-es5/sqm-portal-verify-email-view-2e1dabcc.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-0566ef3f.entry.js +9 -0
  16. package/dist/mint-components/p-1ca5dd90.system.entry.js +1 -0
  17. package/dist/mint-components/p-42ca1639.js +1 -0
  18. package/dist/mint-components/p-44b12b2e.system.js +1 -1
  19. package/dist/mint-components/p-499913d2.system.js +1 -0
  20. package/dist/mint-components/p-6217c5f3.system.entry.js +1 -0
  21. package/dist/mint-components/p-dd2a4d31.entry.js +1 -0
  22. package/dist/types/components/sqm-portal-verify-email/sqm-portal-verify-email-view.d.ts +0 -1
  23. package/dist/types/components/sqm-portal-verify-email/usePortalVerifyEmail.d.ts +0 -1
  24. package/docs/docs.docx +0 -0
  25. package/package.json +1 -1
  26. package/dist/esm-es5/sqm-portal-verify-email-view-4c562714.js +0 -1
  27. package/dist/mint-components/p-26a300dc.entry.js +0 -1
  28. package/dist/mint-components/p-2cbc3524.js +0 -1
  29. package/dist/mint-components/p-570eaaee.system.js +0 -1
  30. package/dist/mint-components/p-bed01771.system.entry.js +0 -1
  31. package/dist/mint-components/p-c33bbf65.entry.js +0 -9
  32. package/dist/mint-components/p-ddba12bb.system.entry.js +0 -1
@@ -26,13 +26,13 @@ function PortalVerifyEmailView(props) {
26
26
  const { states, data, callbacks, content } = props;
27
27
  console.log({
28
28
  loading: states.loading,
29
- success: states.success,
29
+ verified: states.verified,
30
30
  error: states.error,
31
31
  oobCode: data.oobCode,
32
32
  });
33
33
  if (states.loading)
34
34
  return;
35
- if (states.success) {
35
+ if (states.verified) {
36
36
  return (index.h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
37
37
  index.h("style", { type: "text/css" },
38
38
  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-4f7063ff.js');
13
+ const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-f2952402.js');
14
14
 
15
15
  const SUBMITTED_CONTEXT = "sq:verify-submitted";
16
16
  function setWindowSubmitted(submitted) {
@@ -18,7 +18,7 @@ function setWindowSubmitted(submitted) {
18
18
  window[SUBMITTED_CONTEXT] = submitted;
19
19
  }
20
20
  function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyEmailText, verifyInvalidText, networkErrorMessage, continueText, }) {
21
- var _b, _c, _d, _e, _f, _g, _h, _j;
21
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
22
22
  const [submitted, setSubmitted] = stencilHooks_module.useState(window[SUBMITTED_CONTEXT]);
23
23
  const userIdent = index_module.Q();
24
24
  const [verificationError, setVerificationError] = stencilHooks_module.useState(null);
@@ -36,6 +36,7 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
36
36
  const disableContinue = data === undefined && errors === undefined && !!oobCode;
37
37
  // if logged out, userIdent?.managedIdentity?.emailVerified will be falsey, even if verification was successful
38
38
  const verified = !!((_b = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _b === void 0 ? void 0 : _b.emailVerified);
39
+ const validEmail = ((_c = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _c === void 0 ? void 0 : _c.email) === oobEmail;
39
40
  const failed = () => {
40
41
  return index_module.$n.push({
41
42
  pathname: failedPage,
@@ -55,81 +56,42 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
55
56
  verificationError,
56
57
  success,
57
58
  });
58
- const check = async () => {
59
+ const logout = () => {
60
+ console.log("LOGGING OUT", success, verified, verificationError);
61
+ setTimeout(() => {
62
+ index_module.setUserIdentity(undefined);
63
+ gotoNextPage();
64
+ }, 3000);
65
+ };
66
+ const login = () => {
67
+ console.log("LOGGING IN", success, verified, verificationError);
68
+ setTimeout(gotoNextPage, 3000);
69
+ };
70
+ const submit = async () => {
59
71
  var _a;
60
72
  syncSubmitted(true);
61
73
  const response = await request({ oobCode });
62
74
  if (response instanceof Error ||
63
75
  !((_a = response === null || response === void 0 ? void 0 : response.verifyManagedIdentityEmail) === null || _a === void 0 ? void 0 : _a.success)) {
64
- // logout();
65
- console.debug("set verification error");
66
- setVerificationError({ message: true });
67
- }
68
- else {
69
- console.debug("set success: true");
70
- setSuccess(true);
76
+ logout();
77
+ return;
71
78
  }
72
79
  console.debug("SUBMITTED", response);
73
80
  console.debug("window", window[SUBMITTED_CONTEXT]);
74
81
  };
75
82
  stencilHooks_module.useEffect(() => {
83
+ if (verified && validEmail)
84
+ login();
85
+ if (!validEmail)
86
+ logout();
76
87
  if (!submitted)
77
- check();
78
- }, [submitted]);
79
- stencilHooks_module.useEffect(() => {
80
- var _a;
81
- if (!submitted || !(success || verificationError))
82
- return;
83
- if (!verificationError &&
84
- ((_a = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _a === void 0 ? void 0 : _a.email) === oobEmail &&
85
- (success || verified)) {
86
- console.log("LOGGING IN", success, verified, verificationError);
87
- setTimeout(gotoNextPage, 3000);
88
- }
89
- else {
90
- console.log("LOGGING OUT", success, verified, verificationError);
91
- setTimeout(() => {
92
- index_module.setUserIdentity(undefined);
93
- gotoNextPage();
94
- }, 3000);
95
- }
96
- }, [verified, verificationError, success, submitted, userIdent]);
97
- stencilHooks_module.useEffect(() => {
98
- if (errors)
99
- setVerificationError(errors);
100
- }, [errors, setVerificationError]);
101
- // useEffect(() => {
102
- // if (!data && !submitted && oobCode) {
103
- // submit();
104
- // return;
105
- // }
106
- // // verification successful but user in context is not verified
107
- // // or mismatch between logged in user and user associated with oobCode
108
- // if (submitted) {
109
- // console.debug("in submit condition");
110
- // if (email && email !== oobEmail) {
111
- // console.debug("email mismatch");
112
- // logout();
113
- // return;
114
- // // Already verified, begin redirect
115
- // }
116
- // if (verified) {
117
- // if (!verificationError) setSuccess(true);
118
- // console.debug("verified");
119
- // setTimeout(() => {
120
- // gotoNextPage();
121
- // setSubmitted(false);
122
- // }, 3000);
123
- // return;
124
- // }
125
- // }
126
- // }, [submitted, verificationError, data, email, oobCode, oobEmail, submit]);
88
+ submit();
89
+ }, [submitted, verified, validEmail]);
127
90
  return {
128
91
  states: {
129
92
  loading: loading || disableContinue,
130
- success,
131
- 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) ||
132
- ((verificationError === null || verificationError === void 0 ? void 0 : verificationError.message) && networkErrorMessage),
93
+ error: ((_g = (_f = (_e = (_d = errors === null || errors === void 0 ? void 0 : errors.response) === null || _d === void 0 ? void 0 : _d.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.extensions) === null || _g === void 0 ? void 0 : _g.message) || ((_k = (_j = (_h = errors === null || errors === void 0 ? void 0 : errors.response) === null || _h === void 0 ? void 0 : _h.errors) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.message) ||
94
+ ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
133
95
  verified,
134
96
  },
135
97
  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-4f7063ff.js');
30
+ const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-f2952402.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,7 +7618,6 @@ const errorProps$5 = {
7618
7618
  error: "Something went wrong. Please try again.",
7619
7619
  loading: false,
7620
7620
  verified: false,
7621
- success: false,
7622
7621
  },
7623
7622
  data: {
7624
7623
  oobCode: "abc123",
@@ -7638,7 +7637,6 @@ const verifiedProps = {
7638
7637
  error: "",
7639
7638
  loading: false,
7640
7639
  verified: true,
7641
- success: true,
7642
7640
  },
7643
7641
  data: {
7644
7642
  oobCode: "abc123",
@@ -12,7 +12,6 @@ const errorProps = {
12
12
  error: "Something went wrong. Please try again.",
13
13
  loading: false,
14
14
  verified: false,
15
- success: false,
16
15
  },
17
16
  data: {
18
17
  oobCode: "abc123",
@@ -32,7 +31,6 @@ const verifiedProps = {
32
31
  error: "",
33
32
  loading: false,
34
33
  verified: true,
35
- success: true,
36
34
  },
37
35
  data: {
38
36
  oobCode: "abc123",
@@ -23,13 +23,13 @@ export function PortalVerifyEmailView(props) {
23
23
  const { states, data, callbacks, content } = props;
24
24
  console.log({
25
25
  loading: states.loading,
26
- success: states.success,
26
+ verified: states.verified,
27
27
  error: states.error,
28
28
  oobCode: data.oobCode,
29
29
  });
30
30
  if (states.loading)
31
31
  return;
32
- if (states.success) {
32
+ if (states.verified) {
33
33
  return (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
34
34
  h("style", { type: "text/css" },
35
35
  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; success: boolean; verified: boolean; }; data?: { oobCode: string; }; content?: { verifySuccessText?: string; verifyEmailText?: string; verifyInvalidText?: string; continueText?: string; }; }",
231
+ "resolved": "{ states?: { error: string; loading: 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",
@@ -7,7 +7,7 @@ function setWindowSubmitted(submitted) {
7
7
  window[SUBMITTED_CONTEXT] = submitted;
8
8
  }
9
9
  export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyEmailText, verifyInvalidText, networkErrorMessage, continueText, }) {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11
11
  const [submitted, setSubmitted] = useState(window[SUBMITTED_CONTEXT]);
12
12
  const userIdent = useUserIdentity();
13
13
  const [verificationError, setVerificationError] = useState(null);
@@ -26,6 +26,7 @@ export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText,
26
26
  const disableContinue = data === undefined && errors === undefined && !!oobCode;
27
27
  // if logged out, userIdent?.managedIdentity?.emailVerified will be falsey, even if verification was successful
28
28
  const verified = !!((_b = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _b === void 0 ? void 0 : _b.emailVerified);
29
+ const validEmail = ((_c = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _c === void 0 ? void 0 : _c.email) === oobEmail;
29
30
  const failed = () => {
30
31
  return navigation.push({
31
32
  pathname: failedPage,
@@ -56,81 +57,31 @@ export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText,
56
57
  console.log("LOGGING IN", success, verified, verificationError);
57
58
  setTimeout(gotoNextPage, 3000);
58
59
  };
59
- const check = async () => {
60
+ const submit = async () => {
60
61
  var _a;
61
62
  syncSubmitted(true);
62
63
  const response = await request({ oobCode });
63
64
  if (response instanceof Error ||
64
65
  !((_a = response === null || response === void 0 ? void 0 : response.verifyManagedIdentityEmail) === null || _a === void 0 ? void 0 : _a.success)) {
65
- // logout();
66
- console.debug("set verification error");
67
- setVerificationError({ message: true });
68
- }
69
- else {
70
- console.debug("set success: true");
71
- setSuccess(true);
66
+ logout();
67
+ return;
72
68
  }
73
69
  console.debug("SUBMITTED", response);
74
70
  console.debug("window", window[SUBMITTED_CONTEXT]);
75
71
  };
76
72
  useEffect(() => {
73
+ if (verified && validEmail)
74
+ login();
75
+ if (!validEmail)
76
+ logout();
77
77
  if (!submitted)
78
- check();
79
- }, [submitted]);
80
- useEffect(() => {
81
- var _a;
82
- if (!submitted || !(success || verificationError))
83
- return;
84
- if (!verificationError &&
85
- ((_a = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _a === void 0 ? void 0 : _a.email) === oobEmail &&
86
- (success || verified)) {
87
- console.log("LOGGING IN", success, verified, verificationError);
88
- setTimeout(gotoNextPage, 3000);
89
- }
90
- else {
91
- console.log("LOGGING OUT", success, verified, verificationError);
92
- setTimeout(() => {
93
- setUserIdentity(undefined);
94
- gotoNextPage();
95
- }, 3000);
96
- }
97
- }, [verified, verificationError, success, submitted, userIdent]);
98
- useEffect(() => {
99
- if (errors)
100
- setVerificationError(errors);
101
- }, [errors, setVerificationError]);
102
- // useEffect(() => {
103
- // if (!data && !submitted && oobCode) {
104
- // submit();
105
- // return;
106
- // }
107
- // // verification successful but user in context is not verified
108
- // // or mismatch between logged in user and user associated with oobCode
109
- // if (submitted) {
110
- // console.debug("in submit condition");
111
- // if (email && email !== oobEmail) {
112
- // console.debug("email mismatch");
113
- // logout();
114
- // return;
115
- // // Already verified, begin redirect
116
- // }
117
- // if (verified) {
118
- // if (!verificationError) setSuccess(true);
119
- // console.debug("verified");
120
- // setTimeout(() => {
121
- // gotoNextPage();
122
- // setSubmitted(false);
123
- // }, 3000);
124
- // return;
125
- // }
126
- // }
127
- // }, [submitted, verificationError, data, email, oobCode, oobEmail, submit]);
78
+ submit();
79
+ }, [submitted, verified, validEmail]);
128
80
  return {
129
81
  states: {
130
82
  loading: loading || disableContinue,
131
- success,
132
- 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) ||
133
- ((verificationError === null || verificationError === void 0 ? void 0 : verificationError.message) && networkErrorMessage),
83
+ error: ((_g = (_f = (_e = (_d = errors === null || errors === void 0 ? void 0 : errors.response) === null || _d === void 0 ? void 0 : _d.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.extensions) === null || _g === void 0 ? void 0 : _g.message) || ((_k = (_j = (_h = errors === null || errors === void 0 ? void 0 : errors.response) === null || _h === void 0 ? void 0 : _h.errors) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.message) ||
84
+ ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
134
85
  verified,
135
86
  },
136
87
  data: {
@@ -24,13 +24,13 @@ function PortalVerifyEmailView(props) {
24
24
  const { states, data, callbacks, content } = props;
25
25
  console.log({
26
26
  loading: states.loading,
27
- success: states.success,
27
+ verified: states.verified,
28
28
  error: states.error,
29
29
  oobCode: data.oobCode,
30
30
  });
31
31
  if (states.loading)
32
32
  return;
33
- if (states.success) {
33
+ if (states.verified) {
34
34
  return (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
35
35
  h("style", { type: "text/css" },
36
36
  vanillaStyle,
@@ -6,7 +6,7 @@ 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-4c562714.js';
9
+ import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-2e1dabcc.js';
10
10
 
11
11
  const SUBMITTED_CONTEXT = "sq:verify-submitted";
12
12
  function setWindowSubmitted(submitted) {
@@ -14,7 +14,7 @@ function setWindowSubmitted(submitted) {
14
14
  window[SUBMITTED_CONTEXT] = submitted;
15
15
  }
16
16
  function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyEmailText, verifyInvalidText, networkErrorMessage, continueText, }) {
17
- var _b, _c, _d, _e, _f, _g, _h, _j;
17
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
18
18
  const [submitted, setSubmitted] = useState(window[SUBMITTED_CONTEXT]);
19
19
  const userIdent = Q();
20
20
  const [verificationError, setVerificationError] = useState(null);
@@ -32,6 +32,7 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
32
32
  const disableContinue = data === undefined && errors === undefined && !!oobCode;
33
33
  // if logged out, userIdent?.managedIdentity?.emailVerified will be falsey, even if verification was successful
34
34
  const verified = !!((_b = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _b === void 0 ? void 0 : _b.emailVerified);
35
+ const validEmail = ((_c = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _c === void 0 ? void 0 : _c.email) === oobEmail;
35
36
  const failed = () => {
36
37
  return $n.push({
37
38
  pathname: failedPage,
@@ -51,81 +52,42 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
51
52
  verificationError,
52
53
  success,
53
54
  });
54
- const check = async () => {
55
+ const logout = () => {
56
+ console.log("LOGGING OUT", success, verified, verificationError);
57
+ setTimeout(() => {
58
+ setUserIdentity(undefined);
59
+ gotoNextPage();
60
+ }, 3000);
61
+ };
62
+ const login = () => {
63
+ console.log("LOGGING IN", success, verified, verificationError);
64
+ setTimeout(gotoNextPage, 3000);
65
+ };
66
+ const submit = async () => {
55
67
  var _a;
56
68
  syncSubmitted(true);
57
69
  const response = await request({ oobCode });
58
70
  if (response instanceof Error ||
59
71
  !((_a = response === null || response === void 0 ? void 0 : response.verifyManagedIdentityEmail) === null || _a === void 0 ? void 0 : _a.success)) {
60
- // logout();
61
- console.debug("set verification error");
62
- setVerificationError({ message: true });
63
- }
64
- else {
65
- console.debug("set success: true");
66
- setSuccess(true);
72
+ logout();
73
+ return;
67
74
  }
68
75
  console.debug("SUBMITTED", response);
69
76
  console.debug("window", window[SUBMITTED_CONTEXT]);
70
77
  };
71
78
  useEffect(() => {
79
+ if (verified && validEmail)
80
+ login();
81
+ if (!validEmail)
82
+ logout();
72
83
  if (!submitted)
73
- check();
74
- }, [submitted]);
75
- useEffect(() => {
76
- var _a;
77
- if (!submitted || !(success || verificationError))
78
- return;
79
- if (!verificationError &&
80
- ((_a = userIdent === null || userIdent === void 0 ? void 0 : userIdent.managedIdentity) === null || _a === void 0 ? void 0 : _a.email) === oobEmail &&
81
- (success || verified)) {
82
- console.log("LOGGING IN", success, verified, verificationError);
83
- setTimeout(gotoNextPage, 3000);
84
- }
85
- else {
86
- console.log("LOGGING OUT", success, verified, verificationError);
87
- setTimeout(() => {
88
- setUserIdentity(undefined);
89
- gotoNextPage();
90
- }, 3000);
91
- }
92
- }, [verified, verificationError, success, submitted, userIdent]);
93
- useEffect(() => {
94
- if (errors)
95
- setVerificationError(errors);
96
- }, [errors, setVerificationError]);
97
- // useEffect(() => {
98
- // if (!data && !submitted && oobCode) {
99
- // submit();
100
- // return;
101
- // }
102
- // // verification successful but user in context is not verified
103
- // // or mismatch between logged in user and user associated with oobCode
104
- // if (submitted) {
105
- // console.debug("in submit condition");
106
- // if (email && email !== oobEmail) {
107
- // console.debug("email mismatch");
108
- // logout();
109
- // return;
110
- // // Already verified, begin redirect
111
- // }
112
- // if (verified) {
113
- // if (!verificationError) setSuccess(true);
114
- // console.debug("verified");
115
- // setTimeout(() => {
116
- // gotoNextPage();
117
- // setSubmitted(false);
118
- // }, 3000);
119
- // return;
120
- // }
121
- // }
122
- // }, [submitted, verificationError, data, email, oobCode, oobEmail, submit]);
84
+ submit();
85
+ }, [submitted, verified, validEmail]);
123
86
  return {
124
87
  states: {
125
88
  loading: loading || disableContinue,
126
- success,
127
- 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) ||
128
- ((verificationError === null || verificationError === void 0 ? void 0 : verificationError.message) && networkErrorMessage),
89
+ error: ((_g = (_f = (_e = (_d = errors === null || errors === void 0 ? void 0 : errors.response) === null || _d === void 0 ? void 0 : _d.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.extensions) === null || _g === void 0 ? void 0 : _g.message) || ((_k = (_j = (_h = errors === null || errors === void 0 ? void 0 : errors.response) === null || _h === void 0 ? void 0 : _h.errors) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.message) ||
90
+ ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
129
91
  verified,
130
92
  },
131
93
  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-4c562714.js';
26
+ import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-2e1dabcc.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,7 +7614,6 @@ const errorProps$5 = {
7614
7614
  error: "Something went wrong. Please try again.",
7615
7615
  loading: false,
7616
7616
  verified: false,
7617
- success: false,
7618
7617
  },
7619
7618
  data: {
7620
7619
  oobCode: "abc123",
@@ -7634,7 +7633,6 @@ const verifiedProps = {
7634
7633
  error: "",
7635
7634
  loading: false,
7636
7635
  verified: true,
7637
- success: true,
7638
7636
  },
7639
7637
  data: {
7640
7638
  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,r=e.data,s=e.callbacks,a=e.content;console.log({loading:t.loading,verified:t.verified,error:t.error,oobCode:r.oobCode});if(t.loading)return;if(t.verified){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:s.gotoNextPage,loading:t.loading,exportparts:"base: primarybutton-base",type:"primary"},a.continueText))}if(t.error||!r.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:s.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,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r["throw"](e))}catch(e){o(e)}}function l(e){e.done?i(e.value):n(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(i)try{if(r=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];n=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[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-4c562714.js";var SUBMITTED_CONTEXT="sq:verify-submitted";function setWindowSubmitted(e){window[SUBMITTED_CONTEXT]=e}function usePortalVerifyEmail(e){var t=this;var i=e.nextPage,r=e.failedPage,n=e.verifySuccessText,o=e.verifyEmailText,a=e.verifyInvalidText,s=e.networkErrorMessage,l=e.continueText;var u,c,f,d,v,m,y,h;var g=useState(window[SUBMITTED_CONTEXT]),p=g[0],T=g[1];var b=Q();var x=useState(null),w=x[0],E=x[1];var P=useState(false),S=P[0],I=P[1];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 N=D.get("email");var G=D.get("nextPage");var O=function(e){T(e);setWindowSubmitted(e)};var $=C===undefined&&U===undefined&&!!M;var B=!!((u=b===null||b===void 0?void 0:b.managedIdentity)===null||u===void 0?void 0:u.emailVerified);var q=function(){return $n.push({pathname:r,search:D.toString()&&"?"+D.toString()})};var X=function(){D.delete("nextPage");var e=sanitizeUrlPath(G||i);$n.push(e.href)};console.log({userIdent:b,data:C,submitted:p,verified:B,verificationError:w,success:S});var L=function(){return __awaiter(t,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:O(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)){console.debug("set verification error");E({message:true})}else{console.debug("set success: true");I(true)}console.debug("SUBMITTED",t);console.debug("window",window[SUBMITTED_CONTEXT]);return[2]}}))}))};useEffect((function(){if(!p)L()}),[p]);useEffect((function(){var e;if(!p||!(S||w))return;if(!w&&((e=b===null||b===void 0?void 0:b.managedIdentity)===null||e===void 0?void 0:e.email)===N&&(S||B)){console.log("LOGGING IN",S,B,w);setTimeout(X,3e3)}else{console.log("LOGGING OUT",S,B,w);setTimeout((function(){setUserIdentity(undefined);X()}),3e3)}}),[B,w,S,p,b]);useEffect((function(){if(U)E(U)}),[U,E]);return{states:{loading:V||$,success:S,error:((v=(d=(f=(c=w===null||w===void 0?void 0:w.response)===null||c===void 0?void 0:c.errors)===null||f===void 0?void 0:f[0])===null||d===void 0?void 0:d.extensions)===null||v===void 0?void 0:v.message)||((h=(y=(m=w===null||w===void 0?void 0:w.response)===null||m===void 0?void 0:m.errors)===null||y===void 0?void 0:y[0])===null||h===void 0?void 0:h.message)||(w===null||w===void 0?void 0:w.message)&&s,verified:B},data:{oobCode:M},callbacks:{failed:q,gotoNextPage:X},content:{verifySuccessText:n,verifyEmailText:o,verifyInvalidText:a,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-2e1dabcc.js";var SUBMITTED_CONTEXT="sq:verify-submitted";function setWindowSubmitted(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 p=useState(window[SUBMITTED_CONTEXT]),T=p[0],b=p[1];var x=Q();var w=useState(null),E=w[0],P=w[1];var S=useState(false),I=S[0],_=S[1];var k=an(),j=k[0],V=k[1],C=V.loading,U=V.data,D=V.errors;var M=new URLSearchParams($n.location.search);var N=M.get("oobCode");var G=M.get("email");var O=M.get("nextPage");var $=function(e){b(e);setWindowSubmitted(e)};var B=U===undefined&&D===undefined&&!!N;var q=!!((u=x===null||x===void 0?void 0:x.managedIdentity)===null||u===void 0?void 0:u.emailVerified);var X=((c=x===null||x===void 0?void 0:x.managedIdentity)===null||c===void 0?void 0:c.email)===G;var L=function(){return $n.push({pathname:r,search:M.toString()&&"?"+M.toString()})};var z=function(){M.delete("nextPage");var e=sanitizeUrlPath(O||i);$n.push(e.href)};console.log({userIdent:x,data:U,submitted:T,verified:q,verificationError:E,success:I});var W=function(){console.log("LOGGING OUT",I,q,E);setTimeout((function(){setUserIdentity(undefined);z()}),3e3)};var A=function(){console.log("LOGGING IN",I,q,E);setTimeout(z,3e3)};var J=function(){return __awaiter(t,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:$(true);return[4,j({oobCode:N})];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)){W();return[2]}console.debug("SUBMITTED",t);console.debug("window",window[SUBMITTED_CONTEXT]);return[2]}}))}))};useEffect((function(){if(q&&X)A();if(!X)W();if(!T)J()}),[T,q,X]);return{states:{loading:C||B,error:((m=(v=(f=(d=D===null||D===void 0?void 0:D.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=D===null||D===void 0?void 0:D.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)||(D===null||D===void 0?void 0:D.message)&&s,verified:q},data:{oobCode:N},callbacks:{failed:L,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};