@saasquatch/mint-components 1.15.3-1 → 1.15.3-3

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 (26) hide show
  1. package/dist/cjs/{sqm-base-registration-form-view-8a2c8763.js → sqm-base-registration-form-view-8029d30e.js} +1 -0
  2. package/dist/cjs/sqm-portal-google-registration-form.cjs.entry.js +3 -5
  3. package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
  4. package/dist/collection/components/sqm-base-registration/sqm-base-registration-form-view.js +1 -0
  5. package/dist/collection/components/sqm-portal-google-registration-form/sqm-portal-google-registration-form.js +2 -4
  6. package/dist/esm/{sqm-base-registration-form-view-593d4ac3.js → sqm-base-registration-form-view-dafba287.js} +1 -0
  7. package/dist/esm/sqm-portal-google-registration-form.entry.js +3 -5
  8. package/dist/esm/sqm-stencilbook.entry.js +1 -1
  9. package/dist/esm-es5/{sqm-base-registration-form-view-593d4ac3.js → sqm-base-registration-form-view-dafba287.js} +1 -1
  10. package/dist/esm-es5/sqm-portal-google-registration-form.entry.js +1 -1
  11. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  12. package/dist/mint-components/mint-components.esm.js +1 -1
  13. package/dist/mint-components/{p-4794641c.system.js → p-2651ef99.system.js} +1 -1
  14. package/dist/mint-components/p-37996351.system.js +1 -1
  15. package/dist/mint-components/{p-91959fbe.js → p-59fe6066.js} +1 -1
  16. package/dist/mint-components/{p-25ae959c.system.entry.js → p-7f308509.system.entry.js} +1 -1
  17. package/dist/mint-components/{p-9bfd9bed.system.entry.js → p-8693626b.system.entry.js} +1 -1
  18. package/dist/mint-components/{p-5868dc11.entry.js → p-ec309e97.entry.js} +1 -1
  19. package/dist/mint-components/{p-7f80a9d7.entry.js → p-ed0d95f0.entry.js} +1 -1
  20. package/dist/types/components/sqm-base-registration/sqm-base-registration-form-view.d.ts +1 -0
  21. package/dist/types/global/android.d.ts +7 -0
  22. package/dist/types/global/demo.d.ts +2 -0
  23. package/dist/types/stories/features.d.ts +4 -0
  24. package/dist/types/stories/templates.d.ts +4 -0
  25. package/docs/docs.docx +0 -0
  26. package/package.json +1 -1
@@ -49,6 +49,7 @@ function BaseRegistrationFormView(props) {
49
49
  index.h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.handleEmailSubmit, novalidate: true },
50
50
  states.error && (index.h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
51
51
  index.h("div", { part: "erroralert-text" }, props.states.error))),
52
+ content.formData,
52
53
  index.h("sl-input", { exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
53
54
  if (!value) {
54
55
  return content.requiredFieldErrorMessage;
@@ -11,7 +11,7 @@ const JSS = require('./JSS-8503a151.js');
11
11
  require('./mixins-f7e0377a.js');
12
12
  require('./sqm-text-span-view-0aa82125.js');
13
13
  const useRegistrationFormState = require('./useRegistrationFormState-7b820f0c.js');
14
- const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-8a2c8763.js');
14
+ const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-8029d30e.js');
15
15
  const sqmPortalRegistrationFormView = require('./sqm-portal-registration-form-view-637a4bf4.js');
16
16
  require('./AsYouType-6788393a.js');
17
17
  const usePortalRegistrationForm = require('./usePortalRegistrationForm-f25d89e7.js');
@@ -325,9 +325,7 @@ const PortalGoogleRegistrationForm = class {
325
325
  ...states,
326
326
  emailDisabled: true,
327
327
  hidePasswords: showRegistrationForm.mode === "google",
328
- }, callbacks: callbacks, content: {
329
- ...content,
330
- }, refs: refs }));
328
+ }, callbacks: callbacks, content: content, refs: refs }));
331
329
  }
332
330
  };
333
331
  function useRegisterDemo(props) {
@@ -363,7 +361,7 @@ function useGoogleDemo(props) {
363
361
  mode: "base",
364
362
  });
365
363
  return cjs.cjs({
366
- emailValidationError: true,
364
+ emailValidationError: false,
367
365
  handleEmailSubmit: () => setShowRegistrationForm({ mode: "manual" }),
368
366
  showRegistrationForm,
369
367
  handleGoogleInit: () => setShowRegistrationForm({ mode: "google" }),
@@ -28,7 +28,7 @@ const sqmNavigationSidebarItemView = require('./sqm-navigation-sidebar-item-view
28
28
  const sqmPortalEmailVerificationView = require('./sqm-portal-email-verification-view-7ebb426a.js');
29
29
  const sqmPortalForgotPasswordView = require('./sqm-portal-forgot-password-view-78f19ef9.js');
30
30
  const sqmPortalLoginView = require('./sqm-portal-login-view-761a4d8e.js');
31
- const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-8a2c8763.js');
31
+ const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-8029d30e.js');
32
32
  const sqmPortalRegistrationFormView = require('./sqm-portal-registration-form-view-637a4bf4.js');
33
33
  const sqmPortalProfileView = require('./sqm-portal-profile-view-33164798.js');
34
34
  require('./utilities-78f5e169.js');
@@ -46,6 +46,7 @@ export function BaseRegistrationFormView(props) {
46
46
  h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.handleEmailSubmit, novalidate: true },
47
47
  states.error && (h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
48
48
  h("div", { part: "erroralert-text" }, props.states.error))),
49
+ content.formData,
49
50
  h("sl-input", { exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
50
51
  if (!value) {
51
52
  return content.requiredFieldErrorMessage;
@@ -199,9 +199,7 @@ export class PortalGoogleRegistrationForm {
199
199
  ...states,
200
200
  emailDisabled: true,
201
201
  hidePasswords: showRegistrationForm.mode === "google",
202
- }, callbacks: callbacks, content: {
203
- ...content,
204
- }, refs: refs }));
202
+ }, callbacks: callbacks, content: content, refs: refs }));
205
203
  }
206
204
  static get is() { return "sqm-portal-google-registration-form"; }
207
205
  static get encapsulation() { return "shadow"; }
@@ -876,7 +874,7 @@ function useGoogleDemo(props) {
876
874
  mode: "base",
877
875
  });
878
876
  return deepmerge({
879
- emailValidationError: true,
877
+ emailValidationError: false,
880
878
  handleEmailSubmit: () => setShowRegistrationForm({ mode: "manual" }),
881
879
  showRegistrationForm,
882
880
  handleGoogleInit: () => setShowRegistrationForm({ mode: "google" }),
@@ -47,6 +47,7 @@ function BaseRegistrationFormView(props) {
47
47
  h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.handleEmailSubmit, novalidate: true },
48
48
  states.error && (h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
49
49
  h("div", { part: "erroralert-text" }, props.states.error))),
50
+ content.formData,
50
51
  h("sl-input", { exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
51
52
  if (!value) {
52
53
  return content.requiredFieldErrorMessage;
@@ -7,7 +7,7 @@ import { c as createStyleSheet } from './JSS-67b5cff8.js';
7
7
  import './mixins-83f90fa1.js';
8
8
  import './sqm-text-span-view-ca32495e.js';
9
9
  import { a as useRegistrationForm } from './useRegistrationFormState-d6f33135.js';
10
- import { B as BaseRegistrationFormView } from './sqm-base-registration-form-view-593d4ac3.js';
10
+ import { B as BaseRegistrationFormView } from './sqm-base-registration-form-view-dafba287.js';
11
11
  import { P as PortalRegistrationFormView } from './sqm-portal-registration-form-view-3c1f6000.js';
12
12
  import './AsYouType-46f67d0d.js';
13
13
  import { u as usePortalRegistrationForm } from './usePortalRegistrationForm-4b35a357.js';
@@ -321,9 +321,7 @@ const PortalGoogleRegistrationForm = class {
321
321
  ...states,
322
322
  emailDisabled: true,
323
323
  hidePasswords: showRegistrationForm.mode === "google",
324
- }, callbacks: callbacks, content: {
325
- ...content,
326
- }, refs: refs }));
324
+ }, callbacks: callbacks, content: content, refs: refs }));
327
325
  }
328
326
  };
329
327
  function useRegisterDemo(props) {
@@ -359,7 +357,7 @@ function useGoogleDemo(props) {
359
357
  mode: "base",
360
358
  });
361
359
  return cjs({
362
- emailValidationError: true,
360
+ emailValidationError: false,
363
361
  handleEmailSubmit: () => setShowRegistrationForm({ mode: "manual" }),
364
362
  showRegistrationForm,
365
363
  handleGoogleInit: () => setShowRegistrationForm({ mode: "google" }),
@@ -24,7 +24,7 @@ import { N as NavigationSidebarItemView } from './sqm-navigation-sidebar-item-vi
24
24
  import { P as PortalEmailVerificationView } from './sqm-portal-email-verification-view-35b4353b.js';
25
25
  import { P as PortalForgotPasswordView } from './sqm-portal-forgot-password-view-3d3182f1.js';
26
26
  import { P as PortalLoginView } from './sqm-portal-login-view-7e49609a.js';
27
- import { B as BaseRegistrationFormView } from './sqm-base-registration-form-view-593d4ac3.js';
27
+ import { B as BaseRegistrationFormView } from './sqm-base-registration-form-view-dafba287.js';
28
28
  import { P as PortalRegistrationFormView } from './sqm-portal-registration-form-view-3c1f6000.js';
29
29
  import { P as PortalProfileView } from './sqm-portal-profile-view-93003974.js';
30
30
  import './utilities-5b0ca040.js';
@@ -1 +1 @@
1
- var __assign=this&&this.__assign||function(){__assign=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a))t[a]=e[a]}return t};return __assign.apply(this,arguments)};import{h}from"./index-91e7729f.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import{A as AuthWrapper,a as AuthColumn,H as HostBlock,b as AuthButtonsContainer,E as ErrorStyles}from"./mixins-83f90fa1.js";import{T as TextSpanView}from"./sqm-text-span-view-ca32495e.js";var style={Wrapper:AuthWrapper,Column:AuthColumn,HostBlock:HostBlock,":host":{margin:"0 auto",width:"100%"},ButtonsContainer:__assign(__assign({},AuthButtonsContainer),{gap:"var(--sl-spacing-medium)","& > *":{margin:"0 !important"}}),ErrorStyle:ErrorStyles};var vanillaStyle="\nsqm-portal-register {\n margin: 0 auto;\n width: 100%;\n display: block;\n}\n\n:host{\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n";var sheet=createStyleSheet(style);var styleString=sheet.toString();function BaseRegistrationFormView(t){var e=t.states,r=t.content,s=t.callbacks;return h("div",{class:sheet.classes.Wrapper},h("style",{type:"text/css"},vanillaStyle,styleString),h(TextSpanView,{type:"h3"},r.pageLabel),h("sl-form",{class:sheet.classes.Column,"onSl-submit":s.handleEmailSubmit,novalidate:true},e.error&&h("sqm-form-message",{type:"error",exportparts:"erroralert-icon"},h("div",{part:"erroralert-text"},t.states.error)),h("sl-input",{exportparts:"label: input-label, base: input-base",type:"email",name:"/email",label:r.emailLabel||"Email",required:true,validationError:function(t){var e=t.value;if(!e){return r.requiredFieldErrorMessage}if(!e.includes("@")){return r.invalidEmailErrorMessage}}}),h("div",{class:sheet.classes.ButtonsContainer},h("sl-button",{submit:true,exportparts:"base: primarybutton-base",type:"primary",style:{margin:"0"}},r.submitLabel||"Register"),h("sl-menu-divider",{style:{margin:"0"}}),r.googleButton,r.secondaryButton)))}export{BaseRegistrationFormView as B};
1
+ var __assign=this&&this.__assign||function(){__assign=Object.assign||function(t){for(var e,r=1,a=arguments.length;r<a;r++){e=arguments[r];for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s))t[s]=e[s]}return t};return __assign.apply(this,arguments)};import{h}from"./index-91e7729f.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import{A as AuthWrapper,a as AuthColumn,H as HostBlock,b as AuthButtonsContainer,E as ErrorStyles}from"./mixins-83f90fa1.js";import{T as TextSpanView}from"./sqm-text-span-view-ca32495e.js";var style={Wrapper:AuthWrapper,Column:AuthColumn,HostBlock:HostBlock,":host":{margin:"0 auto",width:"100%"},ButtonsContainer:__assign(__assign({},AuthButtonsContainer),{gap:"var(--sl-spacing-medium)","& > *":{margin:"0 !important"}}),ErrorStyle:ErrorStyles};var vanillaStyle="\nsqm-portal-register {\n margin: 0 auto;\n width: 100%;\n display: block;\n}\n\n:host{\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n";var sheet=createStyleSheet(style);var styleString=sheet.toString();function BaseRegistrationFormView(t){var e=t.states,r=t.content,a=t.callbacks;return h("div",{class:sheet.classes.Wrapper},h("style",{type:"text/css"},vanillaStyle,styleString),h(TextSpanView,{type:"h3"},r.pageLabel),h("sl-form",{class:sheet.classes.Column,"onSl-submit":a.handleEmailSubmit,novalidate:true},e.error&&h("sqm-form-message",{type:"error",exportparts:"erroralert-icon"},h("div",{part:"erroralert-text"},t.states.error)),r.formData,h("sl-input",{exportparts:"label: input-label, base: input-base",type:"email",name:"/email",label:r.emailLabel||"Email",required:true,validationError:function(t){var e=t.value;if(!e){return r.requiredFieldErrorMessage}if(!e.includes("@")){return r.invalidEmailErrorMessage}}}),h("div",{class:sheet.classes.ButtonsContainer},h("sl-button",{submit:true,exportparts:"base: primarybutton-base",type:"primary",style:{margin:"0"}},r.submitLabel||"Register"),h("sl-menu-divider",{style:{margin:"0"}}),r.googleButton,r.secondaryButton)))}export{BaseRegistrationFormView as B};
@@ -1 +1 @@
1
- var __extends=this&&this.__extends||function(){var e=function(t,r){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]};return e(t,r)};return function(t,r){e(t,r);function o(){this.constructor=t}t.prototype=r===null?Object.create(r):(o.prototype=r.prototype,new o)}}();var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a))e[a]=t[a]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,r,o){function a(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function n(e){try{l(o["throw"](e))}catch(e){i(e)}}function l(e){e.done?r(e.value):a(e.value).then(s,n)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,a,i,s;return s={next:n(0),throw:n(1),return:n(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function n(e){return function(t){return l([e,t])}}function l(s){if(o)throw new TypeError("Generator is already executing.");while(r)try{if(o=1,a&&(i=s[0]&2?a["return"]:s[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;if(a=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;a=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];a=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,h as h$1}from"./index-91e7729f.js";import{k as useState,n as h}from"./stencil-hooks.module-4bc38af4.js";import{i as isDemo,j as jn}from"./index.module-89a79f66.js";import{j as jsonpointer}from"./jsonpointer-388a7082.js";import{c as cjs}from"./cjs-bdfb4486.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import"./mixins-83f90fa1.js";import"./sqm-text-span-view-ca32495e.js";import{a as useRegistrationForm}from"./useRegistrationFormState-d6f33135.js";import{B as BaseRegistrationFormView}from"./sqm-base-registration-form-view-593d4ac3.js";import{P as PortalRegistrationFormView}from"./sqm-portal-registration-form-view-3c1f6000.js";import"./AsYouType-46f67d0d.js";import{u as usePortalRegistrationForm}from"./usePortalRegistrationForm-4b35a357.js";var InvalidTokenError=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Error);InvalidTokenError.prototype.name="InvalidTokenError";function b64DecodeUnicode(e){return decodeURIComponent(atob(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();if(r.length<2){r="0"+r}return"%"+r})))}function base64UrlDecode(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return b64DecodeUnicode(t)}catch(e){return atob(t)}}function jwtDecode(e,t){if(typeof e!=="string"){throw new InvalidTokenError("Invalid token specified: must be a string")}t||(t={});var r=t.header===true?0:1;var o=e.split(".")[r];if(typeof o!=="string"){throw new InvalidTokenError("Invalid token specified: missing part #"+(r+1))}var a;try{a=base64UrlDecode(o)}catch(e){throw new InvalidTokenError("Invalid token specified: invalid base64 for part #"+(r+1)+" ("+e.message+")")}try{return JSON.parse(a)}catch(e){throw new InvalidTokenError("Invalid token specified: invalid json for part #"+(r+1)+" ("+e.message+")")}}function usePortalGoogleRegistrationForm(e){var t=this;var r=useState(null),o=r[0],a=r[1];var i=useRegistrationForm(),s=i[0],n=i[1];var l=useState({mode:"base"}),u=l[0],c=l[1];var m=function(r){return __awaiter(t,void 0,void 0,(function(){var t,o,i;return __generator(this,(function(l){t=r.target.getFormControls();o={};i=null;t.forEach((function(t){if(!t.name||t.name!=="/email")return;jsonpointer.set(o,t.name,t.value);if(t.required&&!t.value)i=e.requiredFieldErrorMessage;if(typeof t.validationError==="function"){var r=t.validationError;var a=r({control:t,key:"email",value:t.value});if(a)i=a}}));if(i){a(i);return[2]}n(__assign(__assign({},s),{initialData:__assign(__assign({},s===null||s===void 0?void 0:s.initialData),o)}));c({mode:"manual"});return[2]}))}))};var d=function(e){var t;if(!((t=e.detail)===null||t===void 0?void 0:t.credential))return;try{var r=jwtDecode(e.detail.credential);n(__assign(__assign({},s),{_googleOAuthIdToken:e.detail.credential,initialData:{email:r.email,firstName:r.given_name,lastName:r.family_name}}));c({mode:"google"})}catch(e){console.error("Failed to decode Google Sign In credential JWT:",e)}};return{showRegistrationForm:u,emailValidationError:o,handleGoogleInit:d,handleEmailSubmit:m}}var PortalGoogleRegistrationForm=function(){function e(e){registerInstance(this,e);this.ignored=true;this.nextPage="/";this.redirectPath="/verifyEmail";this.emailLabel="Email";this.passwordLabel="Password";this.submitLabel="Register";this.loginLabel="Sign in";this.confirmPasswordLabel="Confirm Password";this.confirmPassword=false;this.disablePasswordValidation=false;this.hideInputs=false;this.pageLabel="Register";this.loginPath="/login";this.loginCTA="Already have an account?";this.requiredFieldErrorMessage="Cannot be empty";this.networkErrorMessage="Network request failed.";this.passwordMismatchErrorMessage="Passwords do not match.";this.invalidEmailErrorMessage="Must be a valid email address";this.formDisabledErrorMessage="The registration form is currently disabled.";this.meetsRequirementsText="Password has met all requirements";this.doesNotMeetRequirementsText="Password must meet the following requirements:";this.minErrorText="be a minimum of 8 characters";this.uppercaseErrorText="contain at least 1 uppercase character";this.lowercaseErrorText="contain at least 1 lowercase character";this.hasErrorText="contain at least 1 number or symbol";this.googleButtonText="signup_with";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=isDemo()?useRegisterDemo(this):usePortalRegistrationForm(this),t=e.states,r=e.callbacks,o=e.refs;var a={LoginButton:{"&::part(label)":{padding:"0"}}};var i=createStyleSheet(a);var s=i.toString();var n=isDemo()?useGoogleDemo(this):usePortalGoogleRegistrationForm(this),l=n.handleGoogleInit,u=n.handleEmailSubmit,c=n.showRegistrationForm,m=n.emailValidationError;var d={formData:h$1("slot",{name:"formData"}),googleButton:h$1("sqm-google-sign-in",{text:this.googleButtonText,onInitComplete:l}),secondaryButton:h$1("slot",{name:"secondaryButton"},h$1("style",null,s),h$1("span",null,this.loginCTA," ",h$1("sl-button",{size:"large",type:"text",disabled:t.loading,onClick:function(){return jn.push(t.loginPath)},className:i.classes.LoginButton},this.loginLabel)," ")),terms:h$1("slot",{name:"terms"}),emailLabel:this.emailLabel,passwordLabel:this.passwordLabel,submitLabel:this.submitLabel,pageLabel:this.pageLabel,confirmPasswordLabel:this.confirmPasswordLabel,networkErrorMessage:this.networkErrorMessage,passwordMismatchErrorMessage:this.passwordMismatchErrorMessage,invalidEmailErrorMessage:this.invalidEmailErrorMessage,formDisabledErrorMessage:this.formDisabledErrorMessage,requiredFieldErrorMessage:this.requiredFieldErrorMessage,meetsRequirementsText:this.meetsRequirementsText,doesNotMeetRequirementsText:this.doesNotMeetRequirementsText,minErrorText:this.minErrorText,uppercaseErrorText:this.uppercaseErrorText,lowercaseErrorText:this.lowercaseErrorText,hasErrorText:this.hasErrorText};if(c.mode==="base"){return h$1(BaseRegistrationFormView,{states:{error:m},callbacks:{handleEmailSubmit:u},content:d})}return h$1(PortalRegistrationFormView,{states:__assign(__assign({},t),{emailDisabled:true,hidePasswords:c.mode==="google"}),callbacks:r,content:__assign({},d),refs:o})};return e}();function useRegisterDemo(e){var t=this;return cjs({states:{error:"",loading:false,confirmPassword:e.confirmPassword,hideInputs:e.hideInputs||false,customPasswordField:false,loginPath:"/login"},callbacks:{handleGoogleInit:function(){},setShowRegistrationForm:function(){},submit:function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){console.log("submit");return[2]}))}))},inputFunction:function(){}},content:{pageLabel:"Register",formData:null,passwordField:null},refs:{formRef:{}}},e.demoData||{},{arrayMerge:function(e,t){return t}})}function useGoogleDemo(e){var t=useState({mode:"base"}),r=t[0],o=t[1];return cjs({emailValidationError:true,handleEmailSubmit:function(){return o({mode:"manual"})},showRegistrationForm:r,handleGoogleInit:function(){return o({mode:"google"})}},e.demoGoogleData||{},{arrayMerge:function(e,t){return t}})}export{PortalGoogleRegistrationForm as sqm_portal_google_registration_form};
1
+ var __extends=this&&this.__extends||function(){var e=function(t,r){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]};return e(t,r)};return function(t,r){e(t,r);function o(){this.constructor=t}t.prototype=r===null?Object.create(r):(o.prototype=r.prototype,new o)}}();var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a))e[a]=t[a]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,r,o){function a(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function s(e){try{l(o.next(e))}catch(e){i(e)}}function n(e){try{l(o["throw"](e))}catch(e){i(e)}}function l(e){e.done?r(e.value):a(e.value).then(s,n)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,a,i,s;return s={next:n(0),throw:n(1),return:n(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function n(e){return function(t){return l([e,t])}}function l(s){if(o)throw new TypeError("Generator is already executing.");while(r)try{if(o=1,a&&(i=s[0]&2?a["return"]:s[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;if(a=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;a=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];a=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,h as h$1}from"./index-91e7729f.js";import{k as useState,n as h}from"./stencil-hooks.module-4bc38af4.js";import{i as isDemo,j as jn}from"./index.module-89a79f66.js";import{j as jsonpointer}from"./jsonpointer-388a7082.js";import{c as cjs}from"./cjs-bdfb4486.js";import{c as createStyleSheet}from"./JSS-67b5cff8.js";import"./mixins-83f90fa1.js";import"./sqm-text-span-view-ca32495e.js";import{a as useRegistrationForm}from"./useRegistrationFormState-d6f33135.js";import{B as BaseRegistrationFormView}from"./sqm-base-registration-form-view-dafba287.js";import{P as PortalRegistrationFormView}from"./sqm-portal-registration-form-view-3c1f6000.js";import"./AsYouType-46f67d0d.js";import{u as usePortalRegistrationForm}from"./usePortalRegistrationForm-4b35a357.js";var InvalidTokenError=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Error);InvalidTokenError.prototype.name="InvalidTokenError";function b64DecodeUnicode(e){return decodeURIComponent(atob(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();if(r.length<2){r="0"+r}return"%"+r})))}function base64UrlDecode(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return b64DecodeUnicode(t)}catch(e){return atob(t)}}function jwtDecode(e,t){if(typeof e!=="string"){throw new InvalidTokenError("Invalid token specified: must be a string")}t||(t={});var r=t.header===true?0:1;var o=e.split(".")[r];if(typeof o!=="string"){throw new InvalidTokenError("Invalid token specified: missing part #"+(r+1))}var a;try{a=base64UrlDecode(o)}catch(e){throw new InvalidTokenError("Invalid token specified: invalid base64 for part #"+(r+1)+" ("+e.message+")")}try{return JSON.parse(a)}catch(e){throw new InvalidTokenError("Invalid token specified: invalid json for part #"+(r+1)+" ("+e.message+")")}}function usePortalGoogleRegistrationForm(e){var t=this;var r=useState(null),o=r[0],a=r[1];var i=useRegistrationForm(),s=i[0],n=i[1];var l=useState({mode:"base"}),u=l[0],c=l[1];var m=function(r){return __awaiter(t,void 0,void 0,(function(){var t,o,i;return __generator(this,(function(l){t=r.target.getFormControls();o={};i=null;t.forEach((function(t){if(!t.name||t.name!=="/email")return;jsonpointer.set(o,t.name,t.value);if(t.required&&!t.value)i=e.requiredFieldErrorMessage;if(typeof t.validationError==="function"){var r=t.validationError;var a=r({control:t,key:"email",value:t.value});if(a)i=a}}));if(i){a(i);return[2]}n(__assign(__assign({},s),{initialData:__assign(__assign({},s===null||s===void 0?void 0:s.initialData),o)}));c({mode:"manual"});return[2]}))}))};var d=function(e){var t;if(!((t=e.detail)===null||t===void 0?void 0:t.credential))return;try{var r=jwtDecode(e.detail.credential);n(__assign(__assign({},s),{_googleOAuthIdToken:e.detail.credential,initialData:{email:r.email,firstName:r.given_name,lastName:r.family_name}}));c({mode:"google"})}catch(e){console.error("Failed to decode Google Sign In credential JWT:",e)}};return{showRegistrationForm:u,emailValidationError:o,handleGoogleInit:d,handleEmailSubmit:m}}var PortalGoogleRegistrationForm=function(){function e(e){registerInstance(this,e);this.ignored=true;this.nextPage="/";this.redirectPath="/verifyEmail";this.emailLabel="Email";this.passwordLabel="Password";this.submitLabel="Register";this.loginLabel="Sign in";this.confirmPasswordLabel="Confirm Password";this.confirmPassword=false;this.disablePasswordValidation=false;this.hideInputs=false;this.pageLabel="Register";this.loginPath="/login";this.loginCTA="Already have an account?";this.requiredFieldErrorMessage="Cannot be empty";this.networkErrorMessage="Network request failed.";this.passwordMismatchErrorMessage="Passwords do not match.";this.invalidEmailErrorMessage="Must be a valid email address";this.formDisabledErrorMessage="The registration form is currently disabled.";this.meetsRequirementsText="Password has met all requirements";this.doesNotMeetRequirementsText="Password must meet the following requirements:";this.minErrorText="be a minimum of 8 characters";this.uppercaseErrorText="contain at least 1 uppercase character";this.lowercaseErrorText="contain at least 1 lowercase character";this.hasErrorText="contain at least 1 number or symbol";this.googleButtonText="signup_with";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=isDemo()?useRegisterDemo(this):usePortalRegistrationForm(this),t=e.states,r=e.callbacks,o=e.refs;var a={LoginButton:{"&::part(label)":{padding:"0"}}};var i=createStyleSheet(a);var s=i.toString();var n=isDemo()?useGoogleDemo(this):usePortalGoogleRegistrationForm(this),l=n.handleGoogleInit,u=n.handleEmailSubmit,c=n.showRegistrationForm,m=n.emailValidationError;var d={formData:h$1("slot",{name:"formData"}),googleButton:h$1("sqm-google-sign-in",{text:this.googleButtonText,onInitComplete:l}),secondaryButton:h$1("slot",{name:"secondaryButton"},h$1("style",null,s),h$1("span",null,this.loginCTA," ",h$1("sl-button",{size:"large",type:"text",disabled:t.loading,onClick:function(){return jn.push(t.loginPath)},className:i.classes.LoginButton},this.loginLabel)," ")),terms:h$1("slot",{name:"terms"}),emailLabel:this.emailLabel,passwordLabel:this.passwordLabel,submitLabel:this.submitLabel,pageLabel:this.pageLabel,confirmPasswordLabel:this.confirmPasswordLabel,networkErrorMessage:this.networkErrorMessage,passwordMismatchErrorMessage:this.passwordMismatchErrorMessage,invalidEmailErrorMessage:this.invalidEmailErrorMessage,formDisabledErrorMessage:this.formDisabledErrorMessage,requiredFieldErrorMessage:this.requiredFieldErrorMessage,meetsRequirementsText:this.meetsRequirementsText,doesNotMeetRequirementsText:this.doesNotMeetRequirementsText,minErrorText:this.minErrorText,uppercaseErrorText:this.uppercaseErrorText,lowercaseErrorText:this.lowercaseErrorText,hasErrorText:this.hasErrorText};if(c.mode==="base"){return h$1(BaseRegistrationFormView,{states:{error:m},callbacks:{handleEmailSubmit:u},content:d})}return h$1(PortalRegistrationFormView,{states:__assign(__assign({},t),{emailDisabled:true,hidePasswords:c.mode==="google"}),callbacks:r,content:d,refs:o})};return e}();function useRegisterDemo(e){var t=this;return cjs({states:{error:"",loading:false,confirmPassword:e.confirmPassword,hideInputs:e.hideInputs||false,customPasswordField:false,loginPath:"/login"},callbacks:{handleGoogleInit:function(){},setShowRegistrationForm:function(){},submit:function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){console.log("submit");return[2]}))}))},inputFunction:function(){}},content:{pageLabel:"Register",formData:null,passwordField:null},refs:{formRef:{}}},e.demoData||{},{arrayMerge:function(e,t){return t}})}function useGoogleDemo(e){var t=useState({mode:"base"}),r=t[0],o=t[1];return cjs({emailValidationError:false,handleEmailSubmit:function(){return o({mode:"manual"})},showRegistrationForm:r,handleGoogleInit:function(){return o({mode:"google"})}},e.demoGoogleData||{},{arrayMerge:function(e,t){return t}})}export{PortalGoogleRegistrationForm as sqm_portal_google_registration_form};