@saasquatch/component-boilerplate 1.2.2-0 → 1.2.3-10

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.
@@ -1,4 +1,4 @@
1
- import{useDomContext as e}from"@saasquatch/dom-context-hooks";import{ContextProvider as t}from"dom-context";import n from"jwt-decode";import{equal as r}from"@wry/equality";import{parse as a,print as o}from"graphql";import{useReducer as i,useCallback as s,useRef as u,useEffect as d,useState as c,useMemo as l}from"@saasquatch/universal-hooks";import m from"fast-memoize";import{Subject as f}from"rxjs";import{bufferTime as g}from"rxjs/operators";import{nanoid as p}from"nanoid";import{ClientError as h}from"graphql-request/dist/types";import{GraphQLClient as y,gql as w}from"graphql-request";import v from"graphql-combine-query";import{createMemoryHistory as C,createBrowserHistory as b}from"history";import I from"debounce";import F from"jsonpointer";const q={current:void 0};function E(){if(void 0===q.current)throw new Error("no implementation of useHost provided");return q.current()}function S(e){if(!e)throw new Error("Must supply an implementation");if("function"!=typeof e)throw new Error("implementation must be a function");q.current=e}function P(){var e;window.squatchProgramId||(window.squatchProgramId=new t({element:document.documentElement,initialState:(null==(e=window.widgetIdent)?void 0:e.programId)||void 0,contextName:"sq:program-id"}).start())}function M(){P();const t=E();return e(t,"sq:program-id")}function D(e){P(),window.squatchProgramId.context=e}function A(){var e,t;return window.SquatchAndroid?{type:"SquatchAndroid",android:window.SquatchAndroid,widgetIdent:window.widgetIdent}:window.SquatchPortal?{type:"SquatchPortal",env:window.SquatchPortal}:window.SquatchAdmin?{type:"SquatchAdmin",adminSDK:window.SquatchAdmin}:window.widgetIdent&&"demo"!==(null==(e=window.widgetIdent)?void 0:e.env)?{type:"SquatchJS2",api:null==(t=window.frameElement)?void 0:t.squatchJsApi,widgetIdent:window.widgetIdent}:{type:"None"}}function $(){const e=A();return"None"===e.type||"SquatchAdmin"===e.type}function k(){const e=A();switch(e.type){case"SquatchAndroid":case"SquatchJS2":return e.widgetIdent.tenantAlias;case"SquatchAdmin":case"None":return"demo";case"SquatchPortal":return e.env.tenantAlias}}function j(){var e;const t=A();switch(t.type){case"SquatchAndroid":case"SquatchJS2":return t.widgetIdent.appDomain;case"SquatchPortal":return(null==(e=t.env)?void 0:e.appDomain)||"https://app.referralsaasquatch.com";case"SquatchAdmin":case"None":return"https://app.referralsaasquatch.com"}}function x(){const e=A();switch(e.type){case"SquatchJS2":return e.widgetIdent.engagementMedium||"EMBED";case"SquatchAndroid":case"SquatchPortal":case"SquatchAdmin":case"None":return"EMBED"}}function R(){return function(){const e=navigator.language,t=null==e?void 0:e.split("-");return t&&1!==t.length?`${t[0]}_${t[1].toUpperCase()}`:e}()}function V(){return(V=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function N(){window.squatchUserIdentity||(window.squatchUserIdentity=new t({element:document.documentElement,initialState:H(),contextName:"sq:user-identity"}).start())}function O(e){if(e)try{const t=n(e),r=t.exp;let a,o;if(function(e){return e.sub&&/.*:.*@.*:users/.test(e.sub)}(t)){const e=t.sub.match(/(.*):(.*)@(.*):users/);o=atob(e[1]),a=atob(e[2])}else(function(e){return e.user&&e.user.id&&e.user.accountId})(t)&&(o=t.user.accountId,a=t.user.id);if(!a||!o)return;if(r&&Date.now()>=1e3*r)return;return{id:a,accountId:o,jwt:e}}catch(e){return}}function H(){const e=A();switch(e.type){case"SquatchAndroid":case"SquatchJS2":return{id:e.widgetIdent.userId,accountId:e.widgetIdent.accountId,jwt:e.widgetIdent.token};case"SquatchPortal":const t=new URLSearchParams(document.location.search);if(t.has("jwt"))return O(t.get("jwt"));const n=localStorage.getItem("sq:user-identity");if(!n)return;try{const e=JSON.parse(n),t=O(e.jwt);return t?V({},e,t):void 0}catch(e){return}case"SquatchAdmin":case"None":return}}function W(e){N();const t=window.squatchUserIdentity;r(t.context,e)||(t.context=e),e&&"SquatchPortal"===A().type?localStorage.setItem("sq:user-identity",JSON.stringify(e)):localStorage.removeItem("sq:user-identity")}function U(){var e;return null==(e=J())?void 0:e.jwt}function J(){N();const t=E(),n=e(t,"sq:user-identity");if(O(null==n?void 0:n.jwt))return n;W(void 0)}var L=function(){return(L=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},_=new Map,Q=new Map,T=!0,z=!1;function G(e){return e.replace(/[\s,]+/g," ").trim()}function B(e){var t,n,r,o=G(e);if(!_.has(o)){var i=a(e,{experimentalFragmentVariables:z});if(!i||"Document"!==i.kind)throw new Error("Not a valid GraphQL document.");_.set(o,function(e){var t=new Set(e.definitions);t.forEach(function(e){e.loc&&delete e.loc,Object.keys(e).forEach(function(n){var r=e[n];r&&"object"==typeof r&&t.add(r)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}((t=i,n=new Set,r=[],t.definitions.forEach(function(e){if("FragmentDefinition"===e.kind){var t=e.name.value,a=G((i=e.loc).source.body.substring(i.start,i.end)),o=Q.get(t);o&&!o.has(a)?T&&console.warn("Warning: fragment with name "+t+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"):o||Q.set(t,o=new Set),o.add(a),n.has(a)||(n.add(a),r.push(e))}else r.push(e);var i}),L(L({},t),{definitions:r}))))}return _.get(o)}function K(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];"string"==typeof e&&(e=[e]);var r=e[0];return t.forEach(function(t,n){r+=t&&"Document"===t.kind?t.loc.source.body:t,r+=e[n+1]}),B(r)}var Z,X=K;(Z=K||(K={})).gql=X,Z.resetCaches=function(){_.clear(),Q.clear()},Z.disableFragmentWarnings=function(){T=!1},Z.enableExperimentalFragmentVariables=function(){z=!0},Z.disableExperimentalFragmentVariables=function(){z=!1},K.default=K;var Y=K;class ee extends y{constructor(e,t){var n;super(e,t),n=this,this.subject=new f;const r=new f;this.subject.pipe(g(200,void 0,10)).subscribe(async function(e){if(!e.length)return;const{mergedQuery:t,mergedVariables:a,mergedQueryAddedEvents:i,unmergedQueryAddedEvents:s}=ae(e);for(const e of s)r.next(e);if(i.length)try{const e=await n.superRequest(t,a);se(e,i)}catch(e){if(e instanceof h){const{data:t,errors:n}=e.response;if(!t)return de(i,e);const r=Object.keys(t);let a=[...i];for(const t of n){let n;t.path.find((i,s,u)=>{if(r.includes(i)){const d=re(i),c=a.findIndex(e=>e.id===d);if(-1===c)return!1;r.splice(s,1),n=a.splice(c,1)[0];const l=oe(e.response.data,n);u[s]=ne(u[s],d);const{query:m,variables:f}=n,g=V({},e.response,{errors:[t],data:l,path:u}),p=new h(g,{query:"string"!=typeof m?o(m):m,variables:f});return ue(n,p),!0}return!1})}se(t,a)}else de(i,e)}}),r.subscribe(async function(e){try{const{query:t,variables:r}=e,a=await n.superRequest(t,r);ie(a,e)}catch(t){ue(e,t)}})}superRequest(e,t){return super.request(e,t)}request(e,t){return new Promise((n,r)=>{const a={query:e,variables:t,id:te(),resolve:n,reject:r};this.subject.next(a)})}}const te=()=>p().replace(/[-_]/g,""),ne=(e,t)=>e.replace(`_${t}`,""),re=e=>{const t=e.split("_");return t[t.length-1]},ae=e=>{const t=[],n=[],{document:r,variables:i}=e.reduce((e,r)=>{const{query:i,variables:s,id:u}=r;try{const d="string"==typeof i?a(i):i,c=d.definitions.find(e=>"FragmentDefinition"===e.kind),l="string"==typeof i?i:o(i),m=/@/.test(l);if(c||m)return n.push(r),e;const f=e=>((e,t)=>`${e}_${t}`)(e,u);return e=e.addN(d,[s],f,f),t.push(r),e}catch(t){return n.push(r),e}},v("BatchedQuery"));return{mergedQuery:r&&o(r),mergedVariables:i,mergedQueryAddedEvents:t,unmergedQueryAddedEvents:n}},oe=(e,t)=>{if(!e)return e;const n=Object.keys(e),{id:r}=t;return n.reduce((t,n)=>(n.endsWith(r)&&(t=V({},t,{[ne(n,r)]:e[n]})),t),{})},ie=(e,t)=>{const{resolve:n}=t;n(e)},se=(e,t)=>{for(const n of t){const t=oe(e,n);n.resolve(t)}},ue=(e,t)=>{const{reject:n}=e;n(t)},de=(e,t)=>{for(const n of e){const{reject:e}=n;e(t)}},ce="sq:graphql-client",le=m(function(e,t,n){return new ee(e+"/api/v1/"+t+"/graphql",{headers:{Authorization:`Bearer ${n||""}`}})});function me(e,t){switch(t.type){case"loading":return{data:void 0,errors:void 0,loading:!0};case"data":return{data:t.payload,errors:void 0,loading:!1};case"errors":return{data:void 0,errors:t.payload,loading:!1}}}function fe(t,n){const r=function(){const t=U(),n=j(),r=k(),a=le(n,r,t),o=E(),i=e(o,"sq:graphql-client",{attempts:0});return null!=i?i:a}(),a=function(){const e=u(null);return d(()=>(e.current=!0,()=>{e.current=!1})),e}(),[o,c]=i(me,n);return[o,s(async function(e){if(r)try{c({type:"loading"});const n=await r.request(t,e);if(!a.current)return;c({type:"data",payload:n})}catch(e){c({type:"errors",payload:e})}else c({type:"errors",payload:new Error("No GraphQL client found")})},[r,t,c])]}const ge={loading:!1,data:void 0,errors:void 0};function pe(e){const[t,n]=fe(e,ge);return[n,t]}let he;const ye=Y(he||(he=(e=>e)`
1
+ import{useDomContext as e}from"@saasquatch/dom-context-hooks";import{ContextProvider as t}from"dom-context";import n from"jwt-decode";import{equal as r}from"@wry/equality";import{parse as a,print as o}from"graphql";import{useReducer as i,useCallback as s,useEffect as d,useRef as u,useState as c,useMemo as l}from"@saasquatch/universal-hooks";import m from"fast-memoize";import{Subject as f}from"rxjs";import{bufferTime as g}from"rxjs/operators";import{nanoid as p}from"nanoid";import{ClientError as h}from"graphql-request/dist/types";import{GraphQLClient as y,gql as w}from"graphql-request";import v from"graphql-combine-query";import{createMemoryHistory as C,createBrowserHistory as b}from"history";import I from"debounce";import F from"jsonpointer";const q={current:void 0};function S(){if(void 0===q.current)throw new Error("no implementation of useHost provided");return q.current()}function E(e){if(!e)throw new Error("Must supply an implementation");if("function"!=typeof e)throw new Error("implementation must be a function");q.current=e}function P(){var e;window.squatchProgramId||(window.squatchProgramId=new t({element:document.documentElement,initialState:(null==(e=window.widgetIdent)?void 0:e.programId)||void 0,contextName:"sq:program-id"}).start())}function M(){P();const t=S();return e(t,"sq:program-id")}function D(e){P(),window.squatchProgramId.context=e}function $(){var e,t;return window.SquatchAndroid?{type:"SquatchAndroid",android:window.SquatchAndroid,widgetIdent:window.widgetIdent}:window.SquatchPortal?{type:"SquatchPortal",env:window.SquatchPortal}:window.SquatchAdmin?{type:"SquatchAdmin",adminSDK:window.SquatchAdmin}:window.widgetIdent&&"demo"!==(null==(e=window.widgetIdent)?void 0:e.env)?{type:"SquatchJS2",api:null==(t=window.frameElement)?void 0:t.squatchJsApi,widgetIdent:window.widgetIdent}:{type:"None"}}function A(){const e=$();return"None"===e.type||"SquatchAdmin"===e.type}function k(){const e=$();switch(e.type){case"SquatchAndroid":case"SquatchJS2":return e.widgetIdent.tenantAlias;case"SquatchAdmin":case"None":return"demo";case"SquatchPortal":return e.env.tenantAlias}}function j(){var e;const t=$();switch(t.type){case"SquatchAndroid":case"SquatchJS2":return t.widgetIdent.appDomain;case"SquatchPortal":return(null==(e=t.env)?void 0:e.appDomain)||"https://app.referralsaasquatch.com";case"SquatchAdmin":case"None":return"https://app.referralsaasquatch.com"}}function x(){const e=$();switch(e.type){case"SquatchJS2":return e.widgetIdent.engagementMedium||"EMBED";case"SquatchAndroid":case"SquatchPortal":case"SquatchAdmin":case"None":return"EMBED"}}function R(){return function(){const e=navigator.language,t=null==e?void 0:e.split("-");return t&&1!==t.length?`${t[0]}_${t[1].toUpperCase()}`:e}()}function V(){return(V=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function N(){window.squatchUserIdentity||(window.squatchUserIdentity=new t({element:document.documentElement,initialState:H(),contextName:"sq:user-identity"}).start())}function O(e){if(e)try{const t=n(e),r=t.exp;let a,o;if(function(e){return e.sub&&/.*:.*@.*:users/.test(e.sub)}(t)){const e=t.sub.match(/(.*):(.*)@(.*):users/);o=atob(e[1]),a=atob(e[2])}else(function(e){return e.user&&e.user.id&&e.user.accountId})(t)&&(o=t.user.accountId,a=t.user.id);if(!a||!o)return;if(r&&Date.now()>=1e3*r)return;return{id:a,accountId:o,jwt:e}}catch(e){return}}function H(){const e=$();switch(e.type){case"SquatchAndroid":case"SquatchJS2":return{id:e.widgetIdent.userId,accountId:e.widgetIdent.accountId,jwt:e.widgetIdent.token};case"SquatchPortal":const t=new URLSearchParams(document.location.search);if(t.has("jwt"))return O(t.get("jwt"));const n=localStorage.getItem("sq:user-identity");if(!n)return;try{const e=JSON.parse(n),t=O(e.jwt);return t?V({},e,t):void 0}catch(e){return}case"SquatchAdmin":case"None":return}}function W(e){N();const t=window.squatchUserIdentity;r(t.context,e)||(t.context=e),e&&"SquatchPortal"===$().type?localStorage.setItem("sq:user-identity",JSON.stringify(e)):e||localStorage.removeItem("sq:user-identity")}function U(){var e;return null==(e=J())?void 0:e.jwt}function J(){N();const t=S(),n=e(t,"sq:user-identity"),r=O(null==n?void 0:n.jwt);if(!n||r)return n;W(void 0)}var L=function(){return(L=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},_=new Map,Q=new Map,T=!0,z=!1;function G(e){return e.replace(/[\s,]+/g," ").trim()}function B(e){var t,n,r,o=G(e);if(!_.has(o)){var i=a(e,{experimentalFragmentVariables:z});if(!i||"Document"!==i.kind)throw new Error("Not a valid GraphQL document.");_.set(o,function(e){var t=new Set(e.definitions);t.forEach(function(e){e.loc&&delete e.loc,Object.keys(e).forEach(function(n){var r=e[n];r&&"object"==typeof r&&t.add(r)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}((t=i,n=new Set,r=[],t.definitions.forEach(function(e){if("FragmentDefinition"===e.kind){var t=e.name.value,a=G((i=e.loc).source.body.substring(i.start,i.end)),o=Q.get(t);o&&!o.has(a)?T&&console.warn("Warning: fragment with name "+t+" already exists.\ngraphql-tag enforces all fragment names across your application to be unique; read more about\nthis in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"):o||Q.set(t,o=new Set),o.add(a),n.has(a)||(n.add(a),r.push(e))}else r.push(e);var i}),L(L({},t),{definitions:r}))))}return _.get(o)}function K(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];"string"==typeof e&&(e=[e]);var r=e[0];return t.forEach(function(t,n){r+=t&&"Document"===t.kind?t.loc.source.body:t,r+=e[n+1]}),B(r)}var Z,X=K;(Z=K||(K={})).gql=X,Z.resetCaches=function(){_.clear(),Q.clear()},Z.disableFragmentWarnings=function(){T=!1},Z.enableExperimentalFragmentVariables=function(){z=!0},Z.disableExperimentalFragmentVariables=function(){z=!1},K.default=K;var Y=K;class ee extends y{constructor(e,t){var n;super(e,t),n=this,this.subject=new f;const r=new f;this.subject.pipe(g(200,void 0,10)).subscribe(async function(e){if(!e.length)return;const{mergedQuery:t,mergedVariables:a,mergedQueryAddedEvents:i,unmergedQueryAddedEvents:s}=ae(e);for(const e of s)r.next(e);if(i.length)try{const e=await n.superRequest(t,a);se(e,i)}catch(e){if(e instanceof h){const{data:t,errors:n}=e.response;if(!t)return ue(i,e);const r=Object.keys(t);let a=[...i];for(const t of n){let n;t.path.find((i,s,d)=>{if(r.includes(i)){const u=re(i),c=a.findIndex(e=>e.id===u);if(-1===c)return!1;r.splice(s,1),n=a.splice(c,1)[0];const l=oe(e.response.data,n);d[s]=ne(d[s],u);const{query:m,variables:f}=n,g=V({},e.response,{errors:[t],data:l,path:d}),p=new h(g,{query:"string"!=typeof m?o(m):m,variables:f});return de(n,p),!0}return!1})}se(t,a)}else ue(i,e)}}),r.subscribe(async function(e){try{const{query:t,variables:r}=e,a=await n.superRequest(t,r);ie(a,e)}catch(t){de(e,t)}})}superRequest(e,t){return super.request(e,t)}request(e,t){return new Promise((n,r)=>{const a={query:e,variables:t,id:te(),resolve:n,reject:r};this.subject.next(a)})}}const te=()=>p().replace(/[-_]/g,""),ne=(e,t)=>e.replace(`_${t}`,""),re=e=>{const t=e.split("_");return t[t.length-1]},ae=e=>{const t=[],n=[],{document:r,variables:i}=e.reduce((e,r)=>{const{query:i,variables:s,id:d}=r;try{const u="string"==typeof i?a(i):i,c=u.definitions.find(e=>"FragmentDefinition"===e.kind),l="string"==typeof i?i:o(i),m=/@/.test(l);if(c||m)return n.push(r),e;const f=e=>((e,t)=>`${e}_${t}`)(e,d);return e=e.addN(u,[s],f,f),t.push(r),e}catch(t){return n.push(r),e}},v("BatchedQuery"));return{mergedQuery:r&&o(r),mergedVariables:i,mergedQueryAddedEvents:t,unmergedQueryAddedEvents:n}},oe=(e,t)=>{if(!e)return e;const n=Object.keys(e),{id:r}=t;return n.reduce((t,n)=>(n.endsWith(r)&&(t=V({},t,{[ne(n,r)]:e[n]})),t),{})},ie=(e,t)=>{const{resolve:n}=t;n(e)},se=(e,t)=>{for(const n of t){const t=oe(e,n);n.resolve(t)}},de=(e,t)=>{const{reject:n}=e;n(t)},ue=(e,t)=>{for(const n of e){const{reject:e}=n;e(t)}},ce="sq:graphql-client",le=m(function(e,t,n){return new ee(e+"/api/v1/"+t+"/graphql",{headers:{Authorization:`Bearer ${n||""}`}})});function me(e,t){switch(t.type){case"loading":return{data:void 0,errors:void 0,loading:!0};case"data":return{data:t.payload,errors:void 0,loading:!1};case"errors":return{data:void 0,errors:t.payload,loading:!1}}}function fe(t,n){const r=function(){const t=U(),n=j(),r=k(),a=le(n,r,t),o=S(),i=e(o,"sq:graphql-client",{attempts:0});return null!=i?i:a}(),[a,o]=i(me,n);return[a,s(async function(e){if(r)try{o({type:"loading"});const n=await r.request(t,e);o({type:"data",payload:n})}catch(e){o({type:"errors",payload:e})}else o({type:"errors",payload:new Error("No GraphQL client found")})},[r,t,o])]}const ge={loading:!1,data:void 0,errors:void 0};function pe(e){const[t,n]=fe(e,ge);return[n,t]}let he;const ye=Y(he||(he=(e=>e)`
2
2
  mutation AuthenticateWithEmailAndPassword(
3
3
  $email: String!
4
4
  $password: String!
@@ -20,12 +20,14 @@ import{useDomContext as e}from"@saasquatch/dom-context-hooks";import{ContextProv
20
20
  $email: String!
21
21
  $password: String!
22
22
  $formData: RSJsonNode
23
+ $redirectPath: String
23
24
  ) {
24
25
  registerManagedIdentityWithEmailAndPassword(
25
26
  registerManagedIdentityWithEmailAndPasswordInput: {
26
27
  email: $email
27
28
  password: $password
28
29
  formData: $formData
30
+ redirectPath: $redirectPath
29
31
  }
30
32
  ) {
31
33
  token
@@ -42,7 +44,7 @@ import{useDomContext as e}from"@saasquatch/dom-context-hooks";import{ContextProv
42
44
  success
43
45
  }
44
46
  }
45
- `));function qe(){const[e,{loading:t,data:n,errors:r}]=pe(Fe);return[e,{loading:t,data:n,errors:r}]}let Ee;const Se=Y(Ee||(Ee=(e=>e)`
47
+ `));function qe(){const[e,{loading:t,data:n,errors:r}]=pe(Fe);return[e,{loading:t,data:n,errors:r}]}let Se;const Ee=Y(Se||(Se=(e=>e)`
46
48
  mutation ResetPassword($oobCode: String!, $password: String!) {
47
49
  resetManagedIdentityPassword(
48
50
  resetManagedIdentityPasswordInput: {
@@ -56,7 +58,7 @@ import{useDomContext as e}from"@saasquatch/dom-context-hooks";import{ContextProv
56
58
  sessionData
57
59
  }
58
60
  }
59
- `));function Pe(){const[e,{loading:t,data:r,errors:a}]=pe(Se);return d(()=>{if(null!=r&&r.resetManagedIdentityPassword){const{resetManagedIdentityPassword:e}=r,t=e.token,{user:a}=n(t);W({jwt:t,id:a.id,accountId:a.accountId,managedIdentity:{email:e.email,emailVerified:e.emailVerified,sessionData:e.sessionData}})}},[null==r?void 0:r.resetManagedIdentityPassword]),[e,{loading:t,data:r,errors:a}]}let Me;const De=Y(Me||(Me=(e=>e)`
61
+ `));function Pe(){const[e,{loading:t,data:r,errors:a}]=pe(Ee);return d(()=>{if(null!=r&&r.resetManagedIdentityPassword){const{resetManagedIdentityPassword:e}=r,t=e.token,{user:a}=n(t);W({jwt:t,id:a.id,accountId:a.accountId,managedIdentity:{email:e.email,emailVerified:e.emailVerified,sessionData:e.sessionData}})}},[null==r?void 0:r.resetManagedIdentityPassword]),[e,{loading:t,data:r,errors:a}]}let Me;const De=Y(Me||(Me=(e=>e)`
60
62
  mutation VerifyPasswordResetCode($oobCode: String!) {
61
63
  verifyManagedIdentityPasswordResetCode(
62
64
  verifyManagedIdentityPasswordResetCodeInput: { oobCode: $oobCode }
@@ -64,7 +66,7 @@ import{useDomContext as e}from"@saasquatch/dom-context-hooks";import{ContextProv
64
66
  success
65
67
  }
66
68
  }
67
- `));function Ae(){return pe(De)}const $e={loading:!1,data:void 0,errors:void 0};function ke(e){const[t,n]=fe(e,$e);return[n,V({},t,{refetch:e=>n(e)})]}let je;const xe=Y(je||(je=(e=>e)`
69
+ `));function $e(){return pe(De)}const Ae={loading:!1,data:void 0,errors:void 0};function ke(e){const[t,n]=fe(e,Ae);return[n,V({},t,{refetch:e=>n(e)})]}let je;const xe=Y(je||(je=(e=>e)`
68
70
  query ManagedIdentity {
69
71
  managedIdentity {
70
72
  email
@@ -81,32 +83,42 @@ import{useDomContext as e}from"@saasquatch/dom-context-hooks";import{ContextProv
81
83
  }
82
84
  }
83
85
  `));function Oe(){var e;const[t]=Re(),[n,{loading:r,data:a,errors:o}]=pe(Ne);return d(()=>{var e;null!=a&&null!=(e=a.verifyManagedIdentityEmail)&&e.success&&t()},[null==a||null==(e=a.verifyManagedIdentityEmail)?void 0:e.success]),[n,{loading:r,data:a,errors:o}]}let He;const We=Y(He||(He=(e=>e)`
84
- mutation RequestPasswordResetEmail($email: String!, $urlParams: RSJsonNode) {
86
+ mutation RequestPasswordResetEmail(
87
+ $email: String!
88
+ $urlParams: RSJsonNode
89
+ $redirectPath: String
90
+ ) {
85
91
  requestManagedIdentityPasswordResetEmail(
86
92
  requestManagedIdentityPasswordResetEmailInput: {
87
93
  email: $email
88
94
  urlParams: $urlParams
95
+ redirectPath: $redirectPath
89
96
  }
90
97
  ) {
91
98
  success
92
99
  }
93
100
  }
94
101
  `));function Ue(){return pe(We)}let Je;const Le=Y(Je||(Je=(e=>e)`
95
- mutation RequestVerificationEmail($email: String!, $urlParams: RSJsonNode) {
102
+ mutation RequestVerificationEmail(
103
+ $email: String!
104
+ $urlParams: RSJsonNode
105
+ $redirectPath: String
106
+ ) {
96
107
  requestManagedIdentityVerificationEmail(
97
108
  requestManagedIdentityVerificationEmailInput: {
98
109
  email: $email
99
110
  urlParams: $urlParams
111
+ redirectPath: $redirectPath
100
112
  }
101
113
  ) {
102
114
  success
103
115
  }
104
116
  }
105
- `));function _e(){return pe(Le)}function Qe(e,t){const n=u();return n.current&&r(t,n.current.key)||(n.current={key:t,value:e()}),n.current.value}function Te(){return i(e=>e+1,0)}function ze(e){const t=Object.getOwnPropertyNames(e);for(const n of t){const t=e[n];t&&"object"==typeof t&&ze(t)}return Object.freeze(e)}const Ge={loading:!0,data:void 0,errors:void 0};function Be(e,t,n){const[r,a]=fe(e,Ge),[o,i]=Te();return Qe(()=>{!n&&a(t)},[e,t,a,o,n]),ze(V({},r,{refetch:i}))}function Ke(){return window.squatchHistory=window.squatchHistory||function(){switch(A().type){case"SquatchPortal":return b();default:return C()}}(),window.squatchHistory}const Ze={createHref:(...e)=>Ke().createHref(...e),push:(...e)=>Ke().push(...e),replace:(...e)=>Ke().replace(...e),go:(...e)=>Ke().go(...e),back:()=>Ke().back(),forward:(...e)=>Ke().forward(...e)};function Xe(){const[,e]=Te();return d(()=>Ke().listen(()=>{e()}),[]),Ke().location}function Ye(e){const[t,n]=c({limit:e.limit,offset:e.offset}),{offset:r,limit:a}=t,o=(e,t)=>e*t,i=(e,t)=>Math.ceil(e/t)||0;return{limit:a,setLimit:e=>{const a=i(r,e),s=o(e,a);n(V({},t,{limit:e,offset:s}))},offset:r,setCurrentPage:e=>{let t=o(e,a);n(e=>V({},e,{offset:t}))},calculatePagination:function(e,t){const n=i(r,a),o=((e,t)=>Math.ceil(e/t)||0)(t,a),s=0===e?"0":e>1?`${r+1}-${r+e}`:`${r+1}`;return{currentPage:n,pageCount:o,rangeOnPage:s,pageProgress:`${s} of ${t}`}}}}function et(e,t,n,r={},a=!1){var o;const{limit:i,offset:s,setLimit:u,setCurrentPage:d,calculatePagination:c}=Ye(n),l=V({limit:i,offset:s},r),{loading:m,errors:f,data:g,refetch:p}=Be(e,l,a),h=t(g),{currentPage:y,pageCount:w,pageProgress:v}=c((null==h||null==(o=h.data)?void 0:o.length)||0,(null==h?void 0:h.totalCount)||0);return{envelope:h,states:{errors:f,loading:m,limit:i,currentPage:y,pageCount:w,pageProgress:v},callbacks:{refetch:p,setLimit:u,setCurrentPage:d}}}function tt(e,t){return e===t}function nt(e,t,n){const r=n&&n.equalityFn||tt,[a,o]=c(e),i=rt(s(e=>o(e),[]),t,n),l=u(e);return d(()=>{r(l.current,e)||(i.callback(e),l.current=e)},[e,i,r]),[a,{cancel:i.cancel,flush:i.flush}]}function rt(e,t=0,n={leading:!1}){const r=l(()=>I(e,t,n.leading),[e,t,n.leading]),{flush:a,clear:o}=r;return{flush:a,cancel:o,callback:r}}let at;const ot=w(at||(at=(e=>e)`
117
+ `));function _e(){return pe(Le)}function Qe(e,t){const n=u();return n.current&&r(t,n.current.key)||(n.current={key:t,value:e()}),n.current.value}function Te(){return i(e=>e+1,0)}function ze(e){const t=Object.getOwnPropertyNames(e);for(const n of t){const t=e[n];t&&"object"==typeof t&&ze(t)}return Object.freeze(e)}const Ge={loading:!0,data:void 0,errors:void 0};function Be(e,t,n){const[r,a]=fe(e,Ge),[o,i]=Te();return Qe(()=>{!n&&a(t)},[e,t,a,o,n]),ze(V({},r,{refetch:i}))}function Ke(){return window.squatchHistory=window.squatchHistory||function(){switch($().type){case"SquatchPortal":return b();default:return C()}}(),window.squatchHistory}const Ze={createHref:(...e)=>Ke().createHref(...e),push:(...e)=>Ke().push(...e),replace:(...e)=>Ke().replace(...e),go:(...e)=>Ke().go(...e),back:()=>Ke().back(),forward:(...e)=>Ke().forward(...e)};function Xe(){const[,e]=Te();return d(()=>Ke().listen(()=>{e()}),[]),Ke().location}function Ye(e){const[t,n]=c({limit:e.limit,offset:e.offset}),{offset:r,limit:a}=t,o=(e,t)=>e*t,i=(e,t)=>Math.ceil(e/t)||0;return{limit:a,setLimit:e=>{const a=i(r,e),s=o(e,a);n(V({},t,{limit:e,offset:s}))},offset:r,setCurrentPage:e=>{let t=o(e,a);n(e=>V({},e,{offset:t}))},calculatePagination:function(e,t){const n=i(r,a),o=((e,t)=>Math.ceil(e/t)||0)(t,a),s=0===e?"0":e>1?`${r+1}-${r+e}`:`${r+1}`;return{currentPage:n,pageCount:o,rangeOnPage:s,pageProgress:`${s} of ${t}`}}}}function et(e,t,n,r={},a=!1){var o;const{limit:i,offset:s,setLimit:d,setCurrentPage:u,calculatePagination:c}=Ye(n),l=V({limit:i,offset:s},r),{loading:m,errors:f,data:g,refetch:p}=Be(e,l,a),h=t(g),{currentPage:y,pageCount:w,pageProgress:v}=c((null==h||null==(o=h.data)?void 0:o.length)||0,(null==h?void 0:h.totalCount)||0);return{envelope:h,states:{errors:f,loading:m,limit:i,currentPage:y,pageCount:w,pageProgress:v},callbacks:{refetch:p,setLimit:d,setCurrentPage:u}}}function tt(e,t){return e===t}function nt(e,t,n){const r=n&&n.equalityFn||tt,[a,o]=c(e),i=rt(s(e=>o(e),[]),t,n),l=u(e);return d(()=>{r(l.current,e)||(i.callback(e),l.current=e)},[e,i,r]),[a,{cancel:i.cancel,flush:i.flush}]}function rt(e,t=0,n={leading:!1}){const r=l(()=>I(e,t,n.leading),[e,t,n.leading]),{flush:a,clear:o}=r;return{flush:a,cancel:o,callback:r}}let at;const ot=w(at||(at=(e=>e)`
106
118
  mutation ($eventMeta: UserAnalyticsEvent!) {
107
119
  createUserAnalyticsEvent(eventMeta: $eventMeta)
108
120
  }
109
- `));function it(){const e=x(),t=J(),n=M(),[r]=pe(ot);return t?a=>{r({eventMeta:{id:t.id,accountId:t.accountId,programId:n,type:"USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",meta:{engagementMedium:e,shareMedium:a}}})}:()=>{}}var st,ut=1e3,dt=60*ut,ct=60*dt,lt=24*ct,mt=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return n*lt;case"hours":case"hour":case"hrs":case"hr":case"h":return n*ct;case"minutes":case"minute":case"mins":case"min":case"m":return n*dt;case"seconds":case"second":case"secs":case"sec":case"s":return n*ut;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=lt?ft(e,t,lt,"day"):t>=ct?ft(e,t,ct,"hour"):t>=dt?ft(e,t,dt,"minute"):t>=ut?ft(e,t,ut,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=lt?Math.round(e/lt)+"d":t>=ct?Math.round(e/ct)+"h":t>=dt?Math.round(e/dt)+"m":t>=ut?Math.round(e/ut)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ft(e,t,n,r){var a=t>=1.5*n;return Math.round(e/n)+" "+r+(a?"s":"")}let gt,pt,ht,yt=e=>e;const wt=(function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,a=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(a=r))}),t.splice(a,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=function(e){function t(e){let r,a=null;function o(...e){if(!o.enabled)return;const n=o,a=Number(new Date);n.diff=a-(r||a),n.prev=r,n.curr=a,r=a,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,a)=>{if("%%"===r)return"%";i++;const o=t.formatters[a];return"function"==typeof o&&(r=o.call(n,e[i]),e.splice(i,1),i--),r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=n,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null===a?t.enabled(e):a,set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),a=r.length;for(n=0;n<a;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=mt,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(st={exports:{}},st.exports),st.exports)("sq:useForm"),vt=w(gt||(gt=yt`
121
+ `));function it(){const e=x(),t=J(),n=M(),[r]=pe(ot);return t?a=>{r({eventMeta:{id:t.id,accountId:t.accountId,programId:n,type:"USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",meta:{engagementMedium:e,shareMedium:a}}})}:()=>{}}var st,dt=1e3,ut=60*dt,ct=60*ut,lt=24*ct,mt=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return n*lt;case"hours":case"hour":case"hrs":case"hr":case"h":return n*ct;case"minutes":case"minute":case"mins":case"min":case"m":return n*ut;case"seconds":case"second":case"secs":case"sec":case"s":return n*dt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=lt?ft(e,t,lt,"day"):t>=ct?ft(e,t,ct,"hour"):t>=ut?ft(e,t,ut,"minute"):t>=dt?ft(e,t,dt,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=lt?Math.round(e/lt)+"d":t>=ct?Math.round(e/ct)+"h":t>=ut?Math.round(e/ut)+"m":t>=dt?Math.round(e/dt)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ft(e,t,n,r){var a=t>=1.5*n;return Math.round(e/n)+" "+r+(a?"s":"")}let gt,pt,ht,yt=e=>e;const wt=(function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,a=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(a=r))}),t.splice(a,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=function(e){function t(e){let r,a=null;function o(...e){if(!o.enabled)return;const n=o,a=Number(new Date);n.diff=a-(r||a),n.prev=r,n.curr=a,r=a,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,a)=>{if("%%"===r)return"%";i++;const o=t.formatters[a];return"function"==typeof o&&(r=o.call(n,e[i]),e.splice(i,1),i--),r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=n,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null===a?t.enabled(e):a,set:e=>{a=e}}),"function"==typeof t.init&&t.init(o),o}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),a=r.length;for(n=0;n<a;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=mt,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(st={exports:{}},st.exports),st.exports)("sq:useForm"),vt=w(gt||(gt=yt`
110
122
  query ($key: String!) {
111
123
  form(key: $key) {
112
124
  schema
@@ -177,5 +189,5 @@ import{useDomContext as e}from"@saasquatch/dom-context-hooks";import{ContextProv
177
189
  }
178
190
  }
179
191
  }
180
- `));function It(e){var t,n,r,a;const{formKey:o,formRef:s,autoSubmit:u=!1}=e,[c,{data:l,loading:m}]=ke(vt),[f,g]=pe(Ct),[p,h]=ke(bt),y={enabled:!1,validating:!1,valid:!0,validationMessage:"",error:"",disabledMessage:"",formData:{},validationData:h,submitData:g},[w,v]=i((e,t)=>V({},e,t),y),{enabled:C,disabledMessage:b,validating:I,valid:q,error:E,formData:S}=w;async function P(e){await p({formValidationInput:{key:o,formData:e}})}return Qe(()=>{wt("submitData useEffect",g),v({submitData:g})},[g]),Qe(()=>{wt("validationData useEffect",h),v({validationData:h})},[h]),d(()=>{!m&&l&&function(){var t,n,r,a,o;v({enabled:null==l||null==(t=l.form.initialData)?void 0:t.isEnabled,disabledMessage:null==l||null==(n=l.form)||null==(r=n.initialData)?void 0:r.isEnabledErrorMessage});const i=s;if(!i)return;const u=null==l||null==(a=l.form)||null==(o=a.initialData)?void 0:o.initialData;void 0!==e.setInitialData?e.setInitialData(i,u):async function(e,t){const n=e.elements,r=new FormData(e);wt({htmlForm:e,formContent:r}),null==r||r.forEach((e,r)=>{wt({value:e,key:r,inputs:n});const a=n.namedItem(r);try{"checkbox"==a.type?a.checked=F.get(t,r):a.value=F.get(t,r)||""}catch(e){wt("no initialData found for key",r)}})}(i,u)}()},[m]),d(()=>{var e,t,n,r,a,i;w.validationData&&(v({validating:!1,valid:(null==(e=w.validationData)||null==(t=e.data)||null==(n=t.validateForm)?void 0:n.valid)||!1}),u&&null!=(r=w.validationData)&&null!=(a=r.data)&&null!=(i=a.validateForm)&&i.valid&&f({formSubmissionInput:{key:o,formData:S}}))},[null==(t=w.validationData)||null==(n=t.data)||null==(r=n.validateForm)?void 0:r.valid]),{states:{enabled:C,disabledMessage:b,loadingForm:m,validating:I,valid:q,error:E,validationData:w.validationData,submitData:w.submitData},data:{formKey:o,schema:null==l||null==(a=l.form)?void 0:a.schema},callbacks:{getForm:c,handleSubmit:async function(e){e.preventDefault(),v({validating:!0});const t=e.target;wt("submit form",t);const n=new FormData(t);let r={};for(var a of n.entries())F.set(r,a[0],a[1]);v({formData:r}),await P(r)},validateForm:P,submitForm:async function(e){await f({formSubmissionInput:{key:o,formData:e}})},setFormState:v,getValidationErrors:function(){var e,t,n,r;const a=null==h||null==(e=h.data)||null==(t=e.validateForm)||null==(n=t.results[0])||null==(r=n.result)?void 0:r.errors;function o(e){return null==a?void 0:a.filter(t=>t.instanceLocation.substring(1).startsWith(`${e}`))}return{getErrorAtPath:function(e){return null==a?void 0:a.filter(t=>t.instanceLocation.substring(1)===e)},getSubErrorsAtPath:o,hasSubErrors:e=>{var t;return(null==(t=o(e))?void 0:t.length)>0}}},getSubmissionErrors:function(){var e;if(!w.submitData)return[];const t=null==(e=w.submitData.data)?void 0:e.submitForm.results;return(null==t?void 0:t.map(e=>{var t,n,r,a,o,i,s;const u=null==(t=e.result)||null==(n=t.results)?void 0:n.flatMap(e=>!e.success&&e.message).filter(e=>e),d=null==(r=e.result)||null==(a=r.results)?void 0:a.flatMap(e=>!e.success&&{error:e.error,errorType:e.errorType,errorCode:e.errorCode}).filter(({error:e})=>e);return{integration:null==(o=e.formHandler)||null==(i=o.integration)?void 0:i.name,formHandler:null==(s=e.formHandler)?void 0:s.name,messages:u,errors:d}}))||[]}}}}export{ee as BatchedGraphQLClient,ce as GRAPHQL_CONTEXT,A as getEnvironmentSDK,$ as isDemo,le as memoizedGraphQLClient,Ze as navigation,D as setProgramId,S as setUseHostImplementation,W as setUserIdentity,j as useAppDomain,we as useAuthenticateWithEmailAndPasswordMutation,qe as useChangePasswordMutation,Xe as useCurrentPage,nt as useDebounce,rt as useDebouncedCallback,x as useEngagementMedium,It as useForm,E as useHost,ke as useLazyQuery,R as useLocale,Re as useManagedIdentityQuery,pe as useMutation,et as usePaginatedQuery,Ye as usePagination,M as useProgramId,Be as useQuery,be as useRegisterWithEmailAndPasswordMutation,Ue as useRequestPasswordResetEmailMutation,_e as useRequestVerificationEmailMutation,Pe as useResetPasswordMutation,it as useShareEvent,k as useTenantAlias,Te as useTick,U as useToken,J as useUserIdentity,Oe as useVerifyEmailMutation,Ae as useVerifyPasswordResetCodeMutation};
192
+ `));function It(e){var t,n,r,a;const{formKey:o,formRef:s,autoSubmit:u=!1}=e,[c,{data:l,loading:m}]=ke(vt),[f,g]=pe(Ct),[p,h]=ke(bt),y={enabled:!1,validating:!1,valid:!0,validationMessage:"",error:"",disabledMessage:"",formData:{},validationData:h,submitData:g},[w,v]=i((e,t)=>V({},e,t),y),{enabled:C,disabledMessage:b,validating:I,valid:q,error:S,formData:E}=w;async function P(e){await p({formValidationInput:{key:o,formData:e}})}return Qe(()=>{wt("submitData useEffect",g),v({submitData:g})},[g]),Qe(()=>{wt("validationData useEffect",h),v({validationData:h})},[h]),d(()=>{!m&&l&&function(){var t,n,r,a,o;v({enabled:null==l||null==(t=l.form.initialData)?void 0:t.isEnabled,disabledMessage:null==l||null==(n=l.form)||null==(r=n.initialData)?void 0:r.isEnabledErrorMessage});const i=s;if(!i)return;const d=null==l||null==(a=l.form)||null==(o=a.initialData)?void 0:o.initialData;void 0!==e.setInitialData?e.setInitialData(i,d):async function(e,t){const n=e.elements,r=new FormData(e);wt({htmlForm:e,formContent:r}),null==r||r.forEach((e,r)=>{wt({value:e,key:r,inputs:n});const a=n.namedItem(r);try{"checkbox"==a.type?a.checked=F.get(t,r):a.value=F.get(t,r)||""}catch(e){wt("no initialData found for key",r)}})}(i,d)}()},[m]),d(()=>{var e,t,n,r,a,i;w.validationData&&(v({validating:!1,valid:(null==(e=w.validationData)||null==(t=e.data)||null==(n=t.validateForm)?void 0:n.valid)||!1}),u&&null!=(r=w.validationData)&&null!=(a=r.data)&&null!=(i=a.validateForm)&&i.valid&&f({formSubmissionInput:{key:o,formData:E}}))},[null==(t=w.validationData)||null==(n=t.data)||null==(r=n.validateForm)?void 0:r.valid]),{states:{enabled:C,disabledMessage:b,loadingForm:m,validating:I,valid:q,error:S,validationData:w.validationData,submitData:w.submitData},data:{formKey:o,schema:null==l||null==(a=l.form)?void 0:a.schema},callbacks:{getForm:c,handleSubmit:async function(e){e.preventDefault(),v({validating:!0});const t=e.target;wt("submit form",t);const n=new FormData(t);let r={};for(var a of n.entries())F.set(r,a[0],a[1]);v({formData:r}),await P(r)},validateForm:P,submitForm:async function(e){await f({formSubmissionInput:{key:o,formData:e}})},setFormState:v,getValidationErrors:function(){var e,t,n,r;const a=null==h||null==(e=h.data)||null==(t=e.validateForm)||null==(n=t.results[0])||null==(r=n.result)?void 0:r.errors;function o(e){return null==a?void 0:a.filter(t=>t.instanceLocation.substring(1).startsWith(`${e}`))}return{getErrorAtPath:function(e){return null==a?void 0:a.filter(t=>t.instanceLocation.substring(1)===e)},getSubErrorsAtPath:o,hasSubErrors:e=>{var t;return(null==(t=o(e))?void 0:t.length)>0}}},getSubmissionErrors:function(){var e;if(!w.submitData)return[];const t=null==(e=w.submitData.data)?void 0:e.submitForm.results;return(null==t?void 0:t.map(e=>{var t,n,r,a,o,i,s;const d=null==(t=e.result)||null==(n=t.results)?void 0:n.flatMap(e=>!e.success&&e.message).filter(e=>e),u=null==(r=e.result)||null==(a=r.results)?void 0:a.flatMap(e=>!e.success&&{error:e.error,errorType:e.errorType,errorCode:e.errorCode}).filter(({error:e})=>e);return{integration:null==(o=e.formHandler)||null==(i=o.integration)?void 0:i.name,formHandler:null==(s=e.formHandler)?void 0:s.name,messages:d,errors:u}}))||[]}}}}export{ee as BatchedGraphQLClient,ce as GRAPHQL_CONTEXT,$ as getEnvironmentSDK,A as isDemo,le as memoizedGraphQLClient,Ze as navigation,D as setProgramId,E as setUseHostImplementation,W as setUserIdentity,j as useAppDomain,we as useAuthenticateWithEmailAndPasswordMutation,qe as useChangePasswordMutation,Xe as useCurrentPage,nt as useDebounce,rt as useDebouncedCallback,x as useEngagementMedium,It as useForm,S as useHost,ke as useLazyQuery,R as useLocale,Re as useManagedIdentityQuery,pe as useMutation,et as usePaginatedQuery,Ye as usePagination,M as useProgramId,Be as useQuery,be as useRegisterWithEmailAndPasswordMutation,Ue as useRequestPasswordResetEmailMutation,_e as useRequestVerificationEmailMutation,Pe as useResetPasswordMutation,it as useShareEvent,k as useTenantAlias,Te as useTick,U as useToken,J as useUserIdentity,Oe as useVerifyEmailMutation,$e as useVerifyPasswordResetCodeMutation};
181
193
  //# sourceMappingURL=index.modern.js.map