@saasquatch/mint-components 1.8.5-32 → 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 (31) 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 +1 -2
  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 +0 -1
  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 +1 -2
  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-cdbd968e.system.entry.js → p-1ca5dd90.system.entry.js} +1 -1
  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-2cbc3524.js +0 -1
  28. package/dist/mint-components/p-40eed63d.entry.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
@@ -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) {
@@ -90,7 +90,6 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
90
90
  return {
91
91
  states: {
92
92
  loading: loading || disableContinue,
93
- success,
94
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) ||
95
94
  ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
96
95
  verified,
@@ -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",
@@ -80,7 +80,6 @@ export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText,
80
80
  return {
81
81
  states: {
82
82
  loading: loading || disableContinue,
83
- success,
84
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) ||
85
84
  ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
86
85
  verified,
@@ -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) {
@@ -86,7 +86,6 @@ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyE
86
86
  return {
87
87
  states: {
88
88
  loading: loading || disableContinue,
89
- success,
90
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) ||
91
90
  ((errors === null || errors === void 0 ? void 0 : errors.message) && networkErrorMessage),
92
91
  verified,
@@ -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,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-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,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,success:I,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};
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};