@truworth/twc-auth 1.0.0

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.
@@ -0,0 +1,70 @@
1
+ (function(z,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react"),require("@truworth/twc-web-design")):typeof define=="function"&&define.amd?define(["exports","react","@truworth/twc-web-design"],o):(z=typeof globalThis<"u"?globalThis:z||self,o(z.TWCAuthPackage={},z.React,z.TWCWebDesign))})(this,function(z,o,t){"use strict";var ie={exports:{}},ee={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var _e;function er(){if(_e)return ee;_e=1;var c=o,p=Symbol.for("react.element"),m=Symbol.for("react.fragment"),f=Object.prototype.hasOwnProperty,b=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0};function j(d,n,C){var g,E={},S=null,x=null;C!==void 0&&(S=""+C),n.key!==void 0&&(S=""+n.key),n.ref!==void 0&&(x=n.ref);for(g in n)f.call(n,g)&&!y.hasOwnProperty(g)&&(E[g]=n[g]);if(d&&d.defaultProps)for(g in n=d.defaultProps,n)E[g]===void 0&&(E[g]=n[g]);return{$$typeof:p,type:d,key:S,ref:x,props:E,_owner:b.current}}return ee.Fragment=m,ee.jsx=j,ee.jsxs=j,ee}var re={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Pe;function rr(){return Pe||(Pe=1,process.env.NODE_ENV!=="production"&&function(){var c=o,p=Symbol.for("react.element"),m=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),d=Symbol.for("react.context"),n=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),P=Symbol.iterator,F="@@iterator";function l(e){if(e===null||typeof e!="object")return null;var a=P&&e[P]||e[F];return typeof a=="function"?a:null}var h=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function i(e){{for(var a=arguments.length,s=new Array(a>1?a-1:0),u=1;u<a;u++)s[u-1]=arguments[u];I("error",e,s)}}function I(e,a,s){{var u=h.ReactDebugCurrentFrame,T=u.getStackAddendum();T!==""&&(a+="%s",s=s.concat([T]));var _=s.map(function(N){return String(N)});_.unshift("Warning: "+a),Function.prototype.apply.call(console[e],console,_)}}var B=!1,O=!1,M=!1,X=!1,K=!1,Z;Z=Symbol.for("react.module.reference");function se(e){return!!(typeof e=="string"||typeof e=="function"||e===f||e===y||K||e===b||e===C||e===g||X||e===x||B||O||M||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===E||e.$$typeof===j||e.$$typeof===d||e.$$typeof===n||e.$$typeof===Z||e.getModuleId!==void 0))}function Q(e,a,s){var u=e.displayName;if(u)return u;var T=a.displayName||a.name||"";return T!==""?s+"("+T+")":s}function k(e){return e.displayName||"Context"}function w(e){if(e==null)return null;if(typeof e.tag=="number"&&i("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case f:return"Fragment";case m:return"Portal";case y:return"Profiler";case b:return"StrictMode";case C:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var a=e;return k(a)+".Consumer";case j:var s=e;return k(s._context)+".Provider";case n:return Q(e,e.render,"ForwardRef");case E:var u=e.displayName||null;return u!==null?u:w(e.type)||"Memo";case S:{var T=e,_=T._payload,N=T._init;try{return w(N(_))}catch{return null}}}return null}var $=Object.assign,U=0,J,me,fe,A,G,ne,oe;function Be(){}Be.__reactDisabledLog=!0;function hr(){{if(U===0){J=console.log,me=console.info,fe=console.warn,A=console.error,G=console.group,ne=console.groupCollapsed,oe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Be,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function pr(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:$({},e,{value:J}),info:$({},e,{value:me}),warn:$({},e,{value:fe}),error:$({},e,{value:A}),group:$({},e,{value:G}),groupCollapsed:$({},e,{value:ne}),groupEnd:$({},e,{value:oe})})}U<0&&i("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ve=h.ReactCurrentDispatcher,je;function he(e,a,s){{if(je===void 0)try{throw Error()}catch(T){var u=T.stack.trim().match(/\n( *(at )?)/);je=u&&u[1]||""}return`
18
+ `+je+e}}var Se=!1,pe;{var yr=typeof WeakMap=="function"?WeakMap:Map;pe=new yr}function Me(e,a){if(!e||Se)return"";{var s=pe.get(e);if(s!==void 0)return s}var u;Se=!0;var T=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _;_=ve.current,ve.current=null,hr();try{if(a){var N=function(){throw Error()};if(Object.defineProperty(N.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(N,[])}catch(V){u=V}Reflect.construct(e,[],N)}else{try{N.call()}catch(V){u=V}e.call(N.prototype)}}else{try{throw Error()}catch(V){u=V}e()}}catch(V){if(V&&u&&typeof V.stack=="string"){for(var v=V.stack.split(`
19
+ `),Y=u.stack.split(`
20
+ `),R=v.length-1,L=Y.length-1;R>=1&&L>=0&&v[R]!==Y[L];)L--;for(;R>=1&&L>=0;R--,L--)if(v[R]!==Y[L]){if(R!==1||L!==1)do if(R--,L--,L<0||v[R]!==Y[L]){var q=`
21
+ `+v[R].replace(" at new "," at ");return e.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",e.displayName)),typeof e=="function"&&pe.set(e,q),q}while(R>=1&&L>=0);break}}}finally{Se=!1,ve.current=_,pr(),Error.prepareStackTrace=T}var W=e?e.displayName||e.name:"",H=W?he(W):"";return typeof e=="function"&&pe.set(e,H),H}function gr(e,a,s){return Me(e,!1)}function xr(e){var a=e.prototype;return!!(a&&a.isReactComponent)}function ye(e,a,s){if(e==null)return"";if(typeof e=="function")return Me(e,xr(e));if(typeof e=="string")return he(e);switch(e){case C:return he("Suspense");case g:return he("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case n:return gr(e.render);case E:return ye(e.type,a,s);case S:{var u=e,T=u._payload,_=u._init;try{return ye(_(T),a,s)}catch{}}}return""}var le=Object.prototype.hasOwnProperty,$e={},Ye=h.ReactDebugCurrentFrame;function ge(e){if(e){var a=e._owner,s=ye(e.type,e._source,a?a.type:null);Ye.setExtraStackFrame(s)}else Ye.setExtraStackFrame(null)}function vr(e,a,s,u,T){{var _=Function.call.bind(le);for(var N in e)if(_(e,N)){var v=void 0;try{if(typeof e[N]!="function"){var Y=Error((u||"React class")+": "+s+" type `"+N+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[N]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Y.name="Invariant Violation",Y}v=e[N](a,N,u,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){v=R}v&&!(v instanceof Error)&&(ge(T),i("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",u||"React class",s,N,typeof v),ge(null)),v instanceof Error&&!(v.message in $e)&&($e[v.message]=!0,ge(T),i("Failed %s type: %s",s,v.message),ge(null))}}}var jr=Array.isArray;function be(e){return jr(e)}function Sr(e){{var a=typeof Symbol=="function"&&Symbol.toStringTag,s=a&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function br(e){try{return Ve(e),!1}catch{return!0}}function Ve(e){return""+e}function qe(e){if(br(e))return i("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Sr(e)),Ve(e)}var Ue=h.ReactCurrentOwner,Nr={key:!0,ref:!0,__self:!0,__source:!0},Ge,Je;function Cr(e){if(le.call(e,"ref")){var a=Object.getOwnPropertyDescriptor(e,"ref").get;if(a&&a.isReactWarning)return!1}return e.ref!==void 0}function Er(e){if(le.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function Tr(e,a){typeof e.ref=="string"&&Ue.current}function _r(e,a){{var s=function(){Ge||(Ge=!0,i("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}}function Pr(e,a){{var s=function(){Je||(Je=!0,i("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",a))};s.isReactWarning=!0,Object.defineProperty(e,"ref",{get:s,configurable:!0})}}var wr=function(e,a,s,u,T,_,N){var v={$$typeof:p,type:e,key:a,ref:s,props:N,_owner:_};return v._store={},Object.defineProperty(v._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(v,"_self",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.defineProperty(v,"_source",{configurable:!1,enumerable:!1,writable:!1,value:T}),Object.freeze&&(Object.freeze(v.props),Object.freeze(v)),v};function Or(e,a,s,u,T){{var _,N={},v=null,Y=null;s!==void 0&&(qe(s),v=""+s),Er(a)&&(qe(a.key),v=""+a.key),Cr(a)&&(Y=a.ref,Tr(a,T));for(_ in a)le.call(a,_)&&!Nr.hasOwnProperty(_)&&(N[_]=a[_]);if(e&&e.defaultProps){var R=e.defaultProps;for(_ in R)N[_]===void 0&&(N[_]=R[_])}if(v||Y){var L=typeof e=="function"?e.displayName||e.name||"Unknown":e;v&&_r(N,L),Y&&Pr(N,L)}return wr(e,v,Y,T,u,Ue.current,N)}}var Ne=h.ReactCurrentOwner,Xe=h.ReactDebugCurrentFrame;function D(e){if(e){var a=e._owner,s=ye(e.type,e._source,a?a.type:null);Xe.setExtraStackFrame(s)}else Xe.setExtraStackFrame(null)}var Ce;Ce=!1;function Ee(e){return typeof e=="object"&&e!==null&&e.$$typeof===p}function Ke(){{if(Ne.current){var e=w(Ne.current.type);if(e)return`
22
+
23
+ Check the render method of \``+e+"`."}return""}}function kr(e){return""}var He={};function Rr(e){{var a=Ke();if(!a){var s=typeof e=="string"?e:e.displayName||e.name;s&&(a=`
24
+
25
+ Check the top-level render call using <`+s+">.")}return a}}function Ze(e,a){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var s=Rr(a);if(He[s])return;He[s]=!0;var u="";e&&e._owner&&e._owner!==Ne.current&&(u=" It was passed a child from "+w(e._owner.type)+"."),D(e),i('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,u),D(null)}}function Qe(e,a){{if(typeof e!="object")return;if(be(e))for(var s=0;s<e.length;s++){var u=e[s];Ee(u)&&Ze(u,a)}else if(Ee(e))e._store&&(e._store.validated=!0);else if(e){var T=l(e);if(typeof T=="function"&&T!==e.entries)for(var _=T.call(e),N;!(N=_.next()).done;)Ee(N.value)&&Ze(N.value,a)}}}function Fr(e){{var a=e.type;if(a==null||typeof a=="string")return;var s;if(typeof a=="function")s=a.propTypes;else if(typeof a=="object"&&(a.$$typeof===n||a.$$typeof===E))s=a.propTypes;else return;if(s){var u=w(a);vr(s,e.props,"prop",u,e)}else if(a.PropTypes!==void 0&&!Ce){Ce=!0;var T=w(a);i("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",T||"Unknown")}typeof a.getDefaultProps=="function"&&!a.getDefaultProps.isReactClassApproved&&i("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ir(e){{for(var a=Object.keys(e.props),s=0;s<a.length;s++){var u=a[s];if(u!=="children"&&u!=="key"){D(e),i("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",u),D(null);break}}e.ref!==null&&(D(e),i("Invalid attribute `ref` supplied to `React.Fragment`."),D(null))}}var De={};function We(e,a,s,u,T,_){{var N=se(e);if(!N){var v="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(v+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Y=kr();Y?v+=Y:v+=Ke();var R;e===null?R="null":be(e)?R="array":e!==void 0&&e.$$typeof===p?(R="<"+(w(e.type)||"Unknown")+" />",v=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,i("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,v)}var L=Or(e,a,s,T,_);if(L==null)return L;if(N){var q=a.children;if(q!==void 0)if(u)if(be(q)){for(var W=0;W<q.length;W++)Qe(q[W],e);Object.freeze&&Object.freeze(q)}else i("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Qe(q,e)}if(le.call(a,"key")){var H=w(e),V=Object.keys(a).filter(function($r){return $r!=="key"}),Te=V.length>0?"{key: someKey, "+V.join(": ..., ")+": ...}":"{key: someKey}";if(!De[H+Te]){var Mr=V.length>0?"{"+V.join(": ..., ")+": ...}":"{}";i(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,Te,H,Mr,H),De[H+Te]=!0}}return e===f?Ir(L):Fr(L),L}}function Ar(e,a,s){return We(e,a,s,!0)}function Lr(e,a,s){return We(e,a,s,!1)}var zr=Lr,Br=Ar;re.Fragment=f,re.jsx=zr,re.jsxs=Br}()),re}var we;function tr(){return we||(we=1,process.env.NODE_ENV==="production"?ie.exports=er():ie.exports=rr()),ie.exports}var r=tr();/**
31
+ * @license lucide-react v0.474.0 - ISC
32
+ *
33
+ * This source code is licensed under the ISC license.
34
+ * See the LICENSE file in the root directory of this source tree.
35
+ */const ar=c=>c.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Oe=(...c)=>c.filter((p,m,f)=>!!p&&p.trim()!==""&&f.indexOf(p)===m).join(" ").trim();/**
36
+ * @license lucide-react v0.474.0 - ISC
37
+ *
38
+ * This source code is licensed under the ISC license.
39
+ * See the LICENSE file in the root directory of this source tree.
40
+ */var sr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
41
+ * @license lucide-react v0.474.0 - ISC
42
+ *
43
+ * This source code is licensed under the ISC license.
44
+ * See the LICENSE file in the root directory of this source tree.
45
+ */const nr=o.forwardRef(({color:c="currentColor",size:p=24,strokeWidth:m=2,absoluteStrokeWidth:f,className:b="",children:y,iconNode:j,...d},n)=>o.createElement("svg",{ref:n,...sr,width:p,height:p,stroke:c,strokeWidth:f?Number(m)*24/Number(p):m,className:Oe("lucide",b),...d},[...j.map(([C,g])=>o.createElement(C,g)),...Array.isArray(y)?y:[y]]));/**
46
+ * @license lucide-react v0.474.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ */const ce=(c,p)=>{const m=o.forwardRef(({className:f,...b},y)=>o.createElement(nr,{ref:y,iconNode:p,className:Oe(`lucide-${ar(c)}`,f),...b}));return m.displayName=`${c}`,m};/**
51
+ * @license lucide-react v0.474.0 - ISC
52
+ *
53
+ * This source code is licensed under the ISC license.
54
+ * See the LICENSE file in the root directory of this source tree.
55
+ */const te=ce("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
56
+ * @license lucide-react v0.474.0 - ISC
57
+ *
58
+ * This source code is licensed under the ISC license.
59
+ * See the LICENSE file in the root directory of this source tree.
60
+ */const or=ce("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
61
+ * @license lucide-react v0.474.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const ke=ce("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
66
+ * @license lucide-react v0.474.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const lr=ce("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),ir=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,Re=({email:c,password:p,loading:m,enterPassword:f,invalidPassword:b,onEmailChange:y,onPasswordChange:j,onValidateEmail:d,onSubmit:n,onBack:C,onForgotPassword:g})=>{const E=t.useForm({defaultValues:{email:c||"",password:""}});return r.jsxs(t.Flex,{direction:"column",children:[f&&r.jsx(t.Button,{variant:"link",leftIcon:r.jsx(te,{}),size:"large",className:"self-start p-0 mb-6",onClick:C,children:"Back"}),r.jsx("img",{src:"https://cdn.thewellnesscorner.com/twc-web-images/new-twc_logo.svg",alt:"logo",width:176,height:40,className:"lg:hidden block md:mb-10 mb-6 h-auto"}),r.jsx(t.Typography,{type:"heading",size:"h5",className:"mb-2",children:"Hi, Welcome To The Wellness Corner!"}),r.jsx(t.Typography,{type:"body",size:"large",className:"md:mb-8 mb-6 text-gray-400",children:f?c:"Please enter email to get started."}),r.jsx(t.Form,{className:"w-full",form:E,onSubmit:n,children:f?r.jsx(ur,{form:E,onPasswordChange:j,onForgotPassword:g,onSubmit:n,loading:m,password:p,invalidPassword:b}):r.jsxs(r.Fragment,{children:[r.jsx(cr,{email:c,form:E,onEmailChange:y}),r.jsx(t.Button,{isFullWidth:!0,variant:"primary",loading:m,className:"mt-3",disabled:!ir.test(c),onClick:d,children:"Continue"})]})})]})},cr=({email:c,form:p,onEmailChange:m})=>r.jsx(t.Form.Item,{label:"Email",name:"email",children:r.jsx(t.TextInput,{type:"email",value:c,size:"medium",placeholder:"example@domain.com",...p.register("email",{onChange:f=>{m(f.target.value)}})})}),ur=({invalidPassword:c,password:p,form:m,onPasswordChange:f,onForgotPassword:b,onSubmit:y,loading:j})=>r.jsxs(r.Fragment,{children:[r.jsx(t.Form.Item,{label:"Password",name:"password",description:r.jsx(t.Typography,{type:"body",size:"small",className:"h-5 -mt-2",color:"text-utility-danger-main",children:c&&"Incorrect password. Please try again."}),children:r.jsx(t.PasswordInput,{placeholder:"Enter your password",value:p,showStrengthIndicator:!1,...m.register("password",{onChange:d=>{f(d.target.value)}})})}),r.jsx(t.Button,{type:"button",size:"small",variant:"link",className:"px-0 h-auto ml-auto block -mt-4",onClick:b,children:"Forgot Password?"}),r.jsx(t.Button,{isFullWidth:!0,variant:"primary",loading:j,disabled:!p,className:"mt-3",type:"button",onClick:y,children:"Continue"})]}),Fe=({loading:c,onBack:p,onSSOSearch:m,onSSOLogin:f})=>{const[b,y]=o.useState(""),[j,d]=o.useState([]),[n,C]=o.useState(!1),[g,E]=o.useState(!1),[S,x]=o.useState(void 0),[P,F]=o.useState(!1),[l,h]=o.useState(!1),i=()=>{if(!b||b.length<3)return d([]),!1;b.trim().length>2?(h(!1),F(!0),m(b,O=>{F(!1),O.length||h(!0),d(O)})):d([])},I=(O,M)=>{const X={id:M.key,name:M.value,image:M.image,key:M.key};x(X),d([])},B=()=>{S&&f(S.key,O=>{localStorage.setItem("clientId",S.key),window.location.href=O})};return o.useEffect(()=>{d([]);const O=setTimeout(i,1e3);return()=>clearTimeout(O)},[b]),r.jsx(r.Fragment,{children:g?r.jsxs(t.Flex,{direction:"column",className:"py-10",children:[r.jsx(t.Button,{variant:"link",leftIcon:r.jsx(te,{}),className:"p-0 h-auto mt-10 mb-7",onClick:()=>E(!1),children:"Back"}),r.jsx("img",{src:S==null?void 0:S.image,width:175,height:117,className:"mx-auto mb-9",alt:(S==null?void 0:S.name)||"Organization"}),r.jsx(t.Typography,{type:"heading",size:"h5",className:"my-9",children:"Select how to sign-in"}),r.jsx(t.Button,{isFullWidth:!0,variant:"primary",onClick:B,loading:c,children:"Login with SSO"}),r.jsx(t.Typography,{type:"body",size:"large",className:"mt-6 text-gray-600",children:"The above option is recommended for quick access"}),r.jsxs(t.Flex,{align:"center",className:"my-8",children:[r.jsx("div",{className:"flex-1 border-t border-gray-300"}),r.jsx(t.Typography,{type:"body",size:"small",className:"text-gray-500 px-4",children:"OR"}),r.jsx("div",{className:"flex-1 border-t border-gray-300"})]}),r.jsx(t.Button,{isFullWidth:!0,variant:"secondary",onClick:p,type:"button",children:"Login with Email & Password"})]}):r.jsxs(t.Flex,{direction:"column",children:[r.jsx(t.Button,{size:"large",variant:"link",leftIcon:r.jsx(te,{}),className:"p-0 h-auto",onClick:p,children:"Back"}),r.jsx(t.Typography,{type:"heading",size:"h5",className:"my-9",children:"Search Organization"}),r.jsx(t.AutoCompleteField,{type:"text",loading:P,onSelect:I,onFocus:()=>C(!0),onSearch:O=>y(O.trimStart()),placeholder:"Enter at least 3 characters",debounceTimer:300,value:S?S.name:b,onChange:()=>{h(!1),x(void 0)},leftIcon:!1,rightIcon:n&&!S?r.jsx(lr,{size:20,className:"text-gray-600 flex"}):r.jsx(or,{size:20,className:"text-gray-600 flex"}),notFoundContent:l?r.jsx(t.Flex,{padding:"sm",className:"rounded-lg",children:r.jsx(t.Typography,{type:"body",size:"large",className:"text-gray-900",children:`No result found for "${b}"`})}):null,options:j==null?void 0:j.map(O=>({key:O.id,value:O.name,image:O.image,label:r.jsxs(t.Flex,{align:"center",className:"gap-2",children:[r.jsx("img",{src:O.image,width:32,height:32,className:"h-auto",alt:O.name}),r.jsx(t.Typography,{type:"body",size:"medium",children:O.name})]})}))}),r.jsx(t.Button,{isFullWidth:!0,variant:"primary",className:"mt-9 mb-9",style:{marginTop:"18px"},disabled:!S,onClick:()=>E(!0),children:"Continue"})]})})},Ie=({show:c,hide:p,email:m,onOTPRequest:f,onOTPVerify:b,onSuccess:y})=>{const[j,d]=o.useState(""),[n,C]=o.useState(""),g=({mobileNo:x,countryCode:P})=>{if(P!=="91"){alert("Login with OTP feature is only available for Indian phone numbers");return}C(x),f(m,F=>{F&&d("otp_requested")})},E=()=>{d(""),C("")},S=()=>{E(),p()};return r.jsx(t.ResponsiveModal,{title:"",size:"sm",open:c,onOpenChange:S,footer:null,showCloseButton:!1,top:200,children:r.jsxs(t.Flex,{direction:"column",children:[!j&&r.jsx(dr,{title:"Sign In With Mobile",subtitle:"Enter your registered mobile number to generate a One-Time Password (OTP)",onSubmit:g,onClose:S}),j&&r.jsx(mr,{mobileNo:n,email:m,onOTPVerify:b,onOTPRequest:f,onSuccess:y,onBack:E})]})})},dr=({title:c,subtitle:p,onSubmit:m,onClose:f})=>{const b=t.useForm({defaultValues:{mobileNo:"",countryCode:"91"}}),[y,j]=o.useState(""),d=n=>{n.preventDefault(),y.length===10&&m({mobileNo:y,countryCode:"91"})};return r.jsxs(r.Fragment,{children:[r.jsx(t.Typography,{type:"heading",size:"h6",className:"mb-2 text-center",children:c}),r.jsx(t.Typography,{type:"body",size:"medium",className:"mb-6 text-gray-400 text-center",children:p}),r.jsxs(t.Form,{form:b,onSubmit:d,children:[r.jsx(t.Form.Item,{label:"Mobile Number",name:"mobileNo",children:r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"flex items-center px-3 border border-r-0 border-gray-300 rounded-l-md bg-gray-50",children:r.jsx(t.Typography,{type:"body",size:"medium",children:"+91"})}),r.jsx(t.TextInput,{type:"tel",value:y,onChange:n=>j(n.target.value.replace(/\D/g,"").slice(0,10)),placeholder:"Enter mobile number",className:"rounded-l-none border-l-0",maxLength:10})]})}),r.jsxs(t.Flex,{justify:"between",className:"mt-6 gap-3",children:[r.jsx(t.Button,{type:"button",variant:"secondary",onClick:f,className:"flex-1",children:"Cancel"}),r.jsx(t.Button,{type:"submit",variant:"primary",disabled:y.length!==10,className:"flex-1",children:"Send OTP"})]})]})]})},mr=({mobileNo:c,email:p,onOTPVerify:m,onOTPRequest:f,onSuccess:b,onBack:y})=>{const[j,d]=o.useState(""),[n,C]=o.useState(!1),[g,E]=o.useState(180),[S,x]=o.useState(""),[P,F]=o.useState(!1);o.useEffect(()=>{if(!g)return;const i=setInterval(()=>{const I=Math.floor(g/60),B=g%60,O=`${I<10?"0":""}${I}:${B<10?"0":""}${B}`;x(O),E(M=>M-1)},1e3);return()=>clearInterval(i)},[g]);const l=()=>{d(""),f(p,i=>{})},h=()=>{F(!0),C(!1),m(p,j,(i,I)=>{F(!1),i&&I?b(I):C(!0)})};return r.jsxs(r.Fragment,{children:[r.jsx(t.Button,{variant:"link",onClick:y,className:"self-start p-0 mb-4",children:"← Back"}),r.jsx(t.Typography,{type:"heading",size:"h6",className:"mb-2 text-center",children:"Sign In With Mobile"}),r.jsxs(t.Typography,{type:"body",size:"large",className:"mb-6 text-gray-400 text-center",children:["OTP sent to"," ",r.jsxs(t.Typography,{type:"utility",size:"large",color:"text-secondary-dark",className:"inline",children:["XXXXXXX",c.slice(-3)]})]}),r.jsx(t.OTPInput,{value:j,onChange:i=>d(i),maxLength:6,className:`!w-auto ${n?"!border-red-500":""}`}),n&&r.jsx(t.Typography,{type:"utility",size:"medium",className:"text-left mt-1",color:"text-utility-danger-main",children:"Please enter the correct OTP."}),g<60?r.jsxs(t.Flex,{justify:"between",align:"center",className:"mb-6",children:[r.jsx(t.Typography,{type:"body",size:"medium",className:"font-semibold",color:"text-gray-400",children:"Didn't receive OTP?"}),r.jsx(t.Button,{type:"button",variant:"link",size:"small",className:"px-0",onClick:()=>{E(180),C(!1),l()},children:"Resend Code"})]}):r.jsxs(t.Typography,{type:"body",size:"medium",className:"p-0 font-semibold text-gray-400 py-6 text-center",children:["Resend Code in ",S]}),r.jsx(t.Button,{variant:"primary",type:"button",onClick:h,isFullWidth:!0,disabled:(j==null?void 0:j.length)!==6,loading:P,children:"Continue"})]})},ue="https://cdn.thewellnesscorner.com/twc-web-images",xe=()=>r.jsxs(t.Flex,{direction:"column",justify:"center",className:"h-screen",children:[r.jsx("img",{src:`${ue}/new-twc_logo.svg`,alt:"logo",width:154,height:31,className:"mb-5 mx-auto z-10 h-7"}),r.jsx(t.Typography,{type:"heading",size:"h6",className:"mx-auto z-10 text-gray-800",children:"A Peek into"}),r.jsx(t.Typography,{type:"heading",size:"h5",className:"mb-2 mx-auto z-10 text-gray-800",children:"Platform Excellence"}),r.jsx(t.Slider,{className:"w-auto",arrows:!1,autoplay:!0,infinite:!0,data:[{image:`${ue}/home/platform-excellence-screen2.png`,title:"Benefits",description:"Explore exclusive sponsored and discounted health benefits."},{image:`${ue}/home/platform-excellence-screen1.png`,title:"Community",description:"Connect, share and thrive together."},{image:`${ue}/home/platform-excellence-screen3.png`,title:"Engagement",description:"Interact, inspire and lead a healthy lifestyle together."}],dots:!0,sliderItems:c=>r.jsxs(r.Fragment,{children:[r.jsx(t.Flex,{children:r.jsx("img",{src:c.image,alt:c.title,width:154,height:312,className:"block mx-auto mb-0 h-auto",style:{width:"10vw"}})}),r.jsx(t.Typography,{type:"heading",size:"h6",className:"text-center mt-4 text-gray-800",children:c.title}),r.jsx(t.Typography,{type:"body",size:"large",className:"px-2 mb-2 text-gray-300 text-center",children:c.description})]}),slidesToShow:1})]}),ae={EMAIL_ENTRY:"EMAIL_ENTRY",SSO_LOGIN:"SSO_LOGIN"},de={PERSONAL_DETAILS:"PERSONAL_DETAILS",PASSWORD_CREATION:"PASSWORD_CREATION"},Ae=({onEmailExists:c,onLogin:p,onSuccess:m,onError:f,onSSOSearch:b,onSSOLogin:y,onOTPRequest:j,onOTPVerify:d,makeRequest:n,initialEmail:C="",className:g=""})=>{const[E,S]=o.useState(ae.EMAIL_ENTRY),[x,P]=o.useState(C),[F,l]=o.useState(""),[h,i]=o.useState(!1),[I,B]=o.useState(!1),[O,M]=o.useState(!1),[X,K]=o.useState(!1);o.useEffect(()=>{C&&P(C)},[C]);const Z=A=>{A.preventDefault(),i(!0),n({url:"/auth/email-exists",method:"POST",data:{email:x},onSuccess:()=>{i(!1),B(!0),c(x)},onError:G=>{var ne,oe;i(!1),((oe=(ne=G==null?void 0:G.response)==null?void 0:ne.request)==null?void 0:oe.status)===404?f&&f({type:"USER_NOT_FOUND",message:"User not found. Please register first.",redirectToRegistration:!0,email:x}):f&&f(G)}})},se=A=>{A.preventDefault(),i(!0),M(!1),p(x,F)},Q=A=>{i(!1),m(A)},k=A=>{var G;i(!1),((G=A==null?void 0:A.response)==null?void 0:G.status)===400&&M(!0),f&&f(A)};o.useEffect(()=>(typeof window<"u"&&(window.authLoginHandlers={handleLoginSuccess:Q,handleLoginError:k}),()=>{typeof window<"u"&&delete window.authLoginHandlers}),[]);const w=()=>{B(!1),l(""),M(!1)},$=()=>{B(!1),S(ae.EMAIL_ENTRY),P("")},U=()=>{console.log("Forgot password triggered for:",x)},J=A=>{P(A)},me=A=>{l((typeof A=="string"?A:"").replace(/\s/g,"")),M(!1)},fe=A=>{K(!1),m(A)};return r.jsx(t.Container,{maxWidth:"fluid",className:`lg:px-0 h-screen ${g}`,children:r.jsxs(t.Row,{justify:"center",align:"middle",children:[r.jsxs(t.Col,{md:10,className:"relative h-full lg:block hidden",children:[r.jsx("img",{src:"https://cdn.thewellnesscorner.com/twc-web-images/login/login-left-bg.jpg",className:"absolute inset-0 w-full h-full object-cover",alt:"Login Background"}),r.jsx(xe,{})]}),r.jsx(t.Col,{md:14,span:24,className:"lg:overflow-y-auto lg:h-screen my-auto",style:{padding:"60px 100px"},children:r.jsxs(t.Flex,{direction:"column",justify:"center",className:`lg:w-[70%] lg:h-screen mx-auto h-full my-10 ${E===ae.SSO_LOGIN?"lg:my-0":""}`,children:[E===ae.SSO_LOGIN?r.jsx(Fe,{loading:h,onBack:$,onSSOSearch:b,onSSOLogin:y}):r.jsxs(r.Fragment,{children:[r.jsx(Re,{email:x,password:F,loading:h,enterPassword:I,invalidPassword:O,onEmailChange:J,onPasswordChange:me,onValidateEmail:Z,onSubmit:se,onBack:w,onForgotPassword:U}),!I&&r.jsx(t.Button,{isFullWidth:!0,type:"button",variant:"secondary",className:"mt-6 flex-none",onClick:()=>S(ae.SSO_LOGIN),children:"Sign In with SSO"}),r.jsx("br",{}),I?r.jsx(t.Button,{isFullWidth:!0,type:"button",variant:"secondary",className:"flex-none",onClick:()=>K(!0),children:"Sign In with OTP"}):r.jsx(r.Fragment,{}),r.jsxs(t.Flex,{padding:"sm",className:"rounded-lg bg-gray-100 md:mt-8 mt-6 gap-3",children:[r.jsx(ke,{size:20,className:"min-w-5 text-primary"}),r.jsxs(t.Typography,{type:"body",size:"small",children:["For any customer support related queries, please write to us on"," ",r.jsx("a",{href:"mailto:support@thewellnesscorner.com",className:"text-primary",children:r.jsx("u",{children:"support@thewellnesscorner.com"})})]})]})]}),r.jsx(Ie,{show:X,hide:()=>K(!1),email:x,onOTPRequest:j,onOTPVerify:d,onSuccess:fe})]})})]})})},Le=({personalDetails:c,loading:p,onPersonalDetailsChange:m,onSubmit:f,onBack:b})=>{const y=t.useForm({defaultValues:{firstName:c.firstName||"",lastName:c.lastName||"",gender:c.gender||"M",dateOfBirth:c.dateOfBirth||"",phoneNumber:c.phoneNumber||"",referralCode:c.referralCode||"",termsAndConditions:c.termsAndConditions||!1}}),{watch:j}=y,d=j();o.useEffect(()=>{m(d)},[d,m]);const[n,C]=o.useState({day:"",month:"",year:""});o.useEffect(()=>{if(d.dateOfBirth){const l=d.dateOfBirth.split("/");l.length===3&&C({day:l[0],month:l[1],year:l[2]})}},[]),o.useEffect(()=>{if(n.day&&n.month&&n.year){const l=`${n.day}/${n.month}/${n.year}`;y.setValue("dateOfBirth",l)}else y.setValue("dateOfBirth","")},[n,y]);const g=(l,h)=>{C(i=>({...i,[l]:h}))},E=d.firstName&&d.lastName&&d.gender&&n.day&&n.month&&n.year&&d.termsAndConditions,S=[{label:"Male",value:"M"},{label:"Female",value:"F"}],x=()=>Array.from({length:31},(l,h)=>(h+1).toString().padStart(2,"0")),P=()=>["January","February","March","April","May","June","July","August","September","October","November","December"],F=()=>{const l=new Date().getFullYear(),h=l-100,i=l-13;return Array.from({length:i-h+1},(I,B)=>(i-B).toString())};return r.jsxs(t.Flex,{direction:"column",className:"px-12",children:[r.jsx(t.Button,{variant:"link",leftIcon:r.jsx(te,{}),className:"p-0 h-auto mb-7",onClick:b,children:"Back"}),r.jsx(t.Typography,{type:"heading",size:"h5",className:"mb-2",children:"Looks like you're new here!"}),r.jsx(t.Typography,{type:"body",size:"large",color:"text-gray-400",children:"Tell us more about you so we can set up your account."}),r.jsxs(t.Form,{className:"w-full p-0 m-0",form:y,onSubmit:l=>{const h=new Event("submit");h.preventDefault=()=>{},f(h)},children:[r.jsxs(t.Row,{gutter:18,className:"py-0 my-0",children:[r.jsx(t.Col,{xs:24,md:12,children:r.jsx(t.Form.Item,{name:"firstName",label:"First Name",className:"mt-5",rules:[{required:!0,message:"Please enter your first name"},{pattern:/^[a-zA-Z\s]+$/,message:"Name can only contain letters"},{validator:async(l,h)=>{if(h&&h.length<2)throw new Error("Name must be at least 2 characters")}}],children:r.jsx(t.TextInput,{placeholder:"Enter your first name",maxLength:50})})}),r.jsx(t.Col,{xs:24,md:12,children:r.jsx(t.Form.Item,{name:"lastName",label:"Last Name",className:"mt-5",rules:[{required:!0,message:"Please enter your last name"},{pattern:/^[a-zA-Z\s]+$/,message:"Name can only contain letters"},{validator:async(l,h)=>{if(h&&h.length<2)throw new Error("Name must be at least 2 characters")}}],children:r.jsx(t.TextInput,{placeholder:"Enter your last name",maxLength:50})})})]}),r.jsxs(t.Row,{gutter:18,className:"py-0 mt-5 relative",children:[r.jsx(t.Col,{xs:18,md:19,children:r.jsx(t.Typography,{type:"body",size:"large",className:"text-gray-700",children:"Your biological sex at the time of birth"})}),r.jsxs(t.Col,{xs:6,md:5,className:"flex justify-end group",children:[r.jsx(t.Typography,{type:"body",size:"large",className:"text-primary cursor-pointer whitespace-nowrap",children:"Know More"}),r.jsxs(t.Flex,{className:"hidden group-hover:block w-full absolute left-2 top-6 rounded-md p-4 z-10 text-gray-950 bg-white shadow-[0_0_10px_0_rgba(0,0,0,0.3)]",children:[r.jsxs(t.Flex,{className:"p-0 mb-3 gap-3",children:[r.jsx("img",{src:"https://cdn.thewellnesscorner.com/twc-web-images/registration/gender-diversity.svg",alt:"gender diversity",width:44,height:44,className:"h-auto"}),r.jsx(t.Typography,{type:"body",size:"large",className:"text-gray-800",children:"The Wellness Corner respects Gender Diversity & Inclusion!"})]}),r.jsx(t.Typography,{type:"body",size:"small",className:"text-gray-500",children:"The Wellness Corner aims to provide you with a personalized wellness experience. This requires us to incorporate certain algorithms based on protocols provided by established health & medical institutions around the world. These protocols are based on your biological sex at birth."})]})]})]}),r.jsx(t.Form.Item,{name:"gender",className:"mt-3",rules:[{required:!0,message:"Please select your gender"}],children:r.jsx(t.RadioGroup,{options:S,orientation:"horizontal"})}),r.jsx(t.Form.Item,{name:"dateOfBirth",label:"Date of Birth",className:"mt-5",rules:[{required:!0,message:"Please select your date of birth"}],children:r.jsxs(t.Row,{gutter:12,children:[r.jsx(t.Col,{xs:8,children:r.jsxs("select",{value:n.day,onChange:l=>g("day",l.target.value),className:"w-full h-10 px-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[r.jsx("option",{value:"",children:"Day"}),x().map(l=>r.jsx("option",{value:l,children:l},l))]})}),r.jsx(t.Col,{xs:8,children:r.jsxs("select",{value:n.month,onChange:l=>g("month",l.target.value),className:"w-full h-10 px-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[r.jsx("option",{value:"",children:"Month"}),P().map((l,h)=>r.jsx("option",{value:(h+1).toString().padStart(2,"0"),children:l},l))]})}),r.jsx(t.Col,{xs:8,children:r.jsxs("select",{value:n.year,onChange:l=>g("year",l.target.value),className:"w-full h-10 px-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",children:[r.jsx("option",{value:"",children:"Year"}),F().map(l=>r.jsx("option",{value:l,children:l},l))]})})]})}),r.jsx(t.Form.Item,{name:"referralCode",label:"Referral Code (Optional)",className:"mt-5",children:r.jsx(t.TextInput,{placeholder:"Enter referral code if you have one",maxLength:20})}),r.jsx(t.Form.Item,{name:"termsAndConditions",className:"mt-6",rules:[{validator:async(l,h)=>{if(!h)throw new Error("You must accept the terms and conditions")}}],children:r.jsx(t.CustomCheckbox,{value:d.termsAndConditions?"true":"false",checked:d.termsAndConditions,onClick:()=>{y.setValue("termsAndConditions",!d.termsAndConditions)},label:r.jsxs(t.Typography,{type:"body",size:"medium",className:"ml-2",children:["I accept the",r.jsx("a",{href:"/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"Terms & Conditions"})," "," listed on The Wellness Corner"]})})}),r.jsx(t.Button,{isFullWidth:!0,variant:"primary",loading:p,disabled:!E,className:"mt-6",type:"button",onClick:()=>{const l=new Event("submit");l.preventDefault=()=>{},f(l)},children:"Continue"})]})]})},ze=({password:c,confirmPassword:p,loading:m,passwordErrors:f,onPasswordChange:b,onConfirmPasswordChange:y,onSubmit:j,onBack:d})=>{const n=t.useForm({liveValidation:!0,defaultValues:{password:"",confirmPassword:""}}),[C,g]=o.useState(!1),[E,S]=o.useState(!1),x=n.watch("password"),P=n.watch("confirmPassword");o.useEffect(()=>{b(x||"")},[x]),o.useEffect(()=>{y(P||"")},[P]),o.useEffect(()=>{(()=>{g(E&&x===P&&!!(x&&P))})()},[x,P,E]);const F=i=>{console.log("🔥 PasswordForm handleSubmit called with values:",i);const I={preventDefault:()=>{},stopPropagation:()=>{}};console.log("🔥 Calling onSubmit from PasswordForm"),j(I)},l=i=>{S(i)},h=[{regex:/.{6,}/,text:"At least 6 characters"},{regex:/[0-9]/,text:"At least 1 number"},{regex:/[a-z]/,text:"At least 1 lowercase letter"},{regex:/[A-Z]/,text:"At least 1 uppercase letter"},{regex:/[!@#$%^&*()_+]/,text:"At least 1 special character"}];return r.jsxs(t.Flex,{direction:"column",children:[r.jsx(t.Button,{variant:"link",leftIcon:r.jsx(te,{}),size:"large",className:"self-start p-0 mb-6",onClick:d,children:"Back"}),r.jsx("img",{src:"https://cdn.thewellnesscorner.com/twc-web-images/new-twc_logo.svg",alt:"logo",width:176,height:40,className:"lg:hidden block md:mb-10 mb-6 h-auto"}),r.jsx(t.Typography,{type:"heading",size:"h5",className:"mb-2",children:"Create your Password"}),r.jsx(t.Typography,{type:"body",size:"large",className:"md:mb-8 mb-6 text-gray-400",children:"Use a password that's easy to remember and fulfills all the requirements listed below."}),r.jsxs("div",{className:"w-full",children:[r.jsxs("div",{className:"mb-4",children:[r.jsx(t.Typography,{type:"body",size:"medium",className:"mb-2 text-gray-700",children:"Password"}),r.jsx(t.PasswordInput,{requirements:h,placeholder:"Enter your password",value:x,onChange:i=>n.setValue("password",i),onAllRequirementsMet:l})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx(t.Typography,{type:"body",size:"medium",className:"mb-2 text-gray-700",children:"Confirm Password"}),r.jsx(t.PasswordInput,{requirements:h,showStrengthIndicator:!1,placeholder:"Confirm your password",value:P,onChange:i=>n.setValue("confirmPassword",i)}),P&&x!==P&&r.jsx(t.Typography,{type:"body",size:"small",className:"text-red-500 mt-1",children:"Passwords don't match"})]}),r.jsx(t.Button,{disabled:!C,isFullWidth:!0,variant:"primary",type:"button",loading:m,className:"hover:border-none mt-6",onClick:i=>{i.preventDefault(),i.stopPropagation(),console.log("🔥 Button onClick triggered"),F({password:x,confirmPassword:P})},children:"Continue"})]})]})},fr=({onRegister:c,onSuccess:p,onError:m,onPasswordValidation:f,initialEmail:b="",className:y="",onLoginRedirect:j})=>{const[d,n]=o.useState(de.PERSONAL_DETAILS),[C,g]=o.useState(!1),[E,S]=o.useState(b),[x,P]=o.useState({firstName:"",lastName:"",gender:"M",dateOfBirth:"",phoneNumber:"",referralCode:"",termsAndConditions:!1}),[F,l]=o.useState(""),[h,i]=o.useState(""),[I,B]=o.useState([]);o.useEffect(()=>{if(typeof window<"u"){const w=new URLSearchParams(window.location.search).get("email");w&&S(w)}},[]);const O=k=>{if(k.preventDefault(),!x.firstName||!x.lastName||!x.gender||!x.dateOfBirth){m&&m({type:"REGISTRATION_ERROR",message:"Please fill in all required fields"});return}n(de.PASSWORD_CREATION)},M=k=>{if(f)f(k,(w,$)=>{B($)});else{const w=[];k.length<8&&w.push("Password must be at least 8 characters"),/[A-Z]/.test(k)||w.push("Password must contain at least one uppercase letter"),/[a-z]/.test(k)||w.push("Password must contain at least one lowercase letter"),/[0-9]/.test(k)||w.push("Password must contain at least one number"),/[!@#$%^&*]/.test(k)||w.push("Password must contain at least one special character"),B(w)}},X=k=>{l(k),M(k)},K=k=>{i(k)},Z=k=>{if(console.log("🔥 handlePasswordSubmit called"),k.preventDefault(),I.length>0){m&&m({type:"REGISTRATION_ERROR",message:"Please fix password requirements"});return}if(F!==h){m&&m({type:"REGISTRATION_ERROR",message:"Passwords do not match"});return}const w={...x,email:E,password:F};console.log("=== REGISTRATION DATA DEBUG ==="),console.log("personalDetails:",x),console.log("registrationData:",w),console.log("gender:",w.gender),console.log("referralCode:",w.referralCode),console.log("================================"),g(!0),c(w,($,U,J)=>{console.log("🔄 Registration callback received:",{success:$,error:U,token:J?"present":"missing"}),g(!1),$&&J?(console.log("✅ Registration successful, calling onSuccess with token:",J),p(J),console.log("✅ onSuccess called")):(console.log("❌ Registration failed or no token:",{success:$,error:U,token:J}),m&&m(U||{type:"REGISTRATION_ERROR",message:"Registration failed. Please try again."}))})},se=()=>{n(de.PERSONAL_DETAILS)},Q=()=>{j?j():typeof window<"u"&&(window.location.href="/login")};return r.jsx(t.Container,{maxWidth:"fluid",className:`p-0 h-screen overflow-hidden ${y}`,children:r.jsxs(t.Row,{className:"h-full",children:[r.jsxs(t.Col,{lg:10,className:"hidden lg:block relative h-full",children:[r.jsx("img",{src:"https://cdn.thewellnesscorner.com/twc-web-images/login/login-left-bg.jpg",className:"absolute w-full h-full object-cover",alt:"Registration Background"}),r.jsx(xe,{})]}),r.jsx(t.Col,{xs:24,lg:14,className:"overflow-y-auto h-screen",style:{padding:"100px 80px 60px 80px"},children:r.jsxs(t.Flex,{direction:"column",className:"w-[90%] md:w-[70%] p-0 my-[35px] md:my-[56px] h-full md:justify-center mx-auto",align:"center",children:[d===de.PERSONAL_DETAILS?r.jsxs(r.Fragment,{children:[r.jsx(t.Flex,{direction:"column",className:"p-0",children:r.jsx(Le,{personalDetails:x,loading:C,onPersonalDetailsChange:P,onSubmit:O,onBack:Q})}),r.jsxs(t.Flex,{align:"center",className:"p-0 mt-4 px-12",children:[r.jsx(t.Typography,{type:"body",size:"large",className:"text-gray-700",children:"Already have an account?"}),r.jsx(t.Button,{variant:"link",size:"medium",className:"ml-2 h-auto px-0",onClick:Q,children:"Sign-In"})]})]}):r.jsx(ze,{password:F,confirmPassword:h,loading:C,passwordErrors:I,onPasswordChange:X,onConfirmPasswordChange:K,onSubmit:Z,onBack:se}),r.jsx("div",{className:"px-12",children:r.jsxs(t.Flex,{padding:"sm",className:"rounded-lg bg-gray-100 md:mt-8 mt-6 gap-3",children:[r.jsx(ke,{size:20,className:"min-w-5 text-primary"}),r.jsxs(t.Typography,{type:"body",size:"small",children:["For any customer support related queries, please write to us on"," ",r.jsx("a",{href:"mailto:support@thewellnesscorner.com",className:"text-primary",children:r.jsx("u",{children:"support@thewellnesscorner.com"})})]})]})})]})})]})})};z.AuthLogin=Ae,z.AuthRegister=fr,z.LoginForm=Re,z.MobileSignIn=Ie,z.PasswordForm=ze,z.PeekExcellenceCarousel=xe,z.RegistrationForm=Le,z.SSOLogin=Fe,z.default=Ae,Object.defineProperties(z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@truworth/twc-auth",
3
+ "description": "Truworth TWC Auth",
4
+ "version": "1.0.0",
5
+ "main": "dist/index.esm.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.esm.js",
12
+ "require": "./dist/index.umd.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "dev": "vite",
20
+ "build": "tsc --project tsconfig.build.json && vite build",
21
+ "build:types": "tsc --project tsconfig.build.json",
22
+ "lint": "eslint .",
23
+ "preview": "vite preview"
24
+ },
25
+ "dependencies": {
26
+ "react": "^18.2.0",
27
+ "react-dom": "^18.2.0"
28
+ },
29
+ "devDependencies": {
30
+ "@eslint/js": "^9.25.0",
31
+ "@truworth/twc-web-design": "^1.0.5",
32
+ "@types/node": "^20.0.0",
33
+ "@types/react": "^18.2.38",
34
+ "@types/react-dom": "^18.2.15",
35
+ "@vitejs/plugin-react": "^4.4.1",
36
+ "eslint": "^9.25.0",
37
+ "eslint-plugin-react-hooks": "^5.2.0",
38
+ "eslint-plugin-react-refresh": "^0.4.19",
39
+ "globals": "^16.0.0",
40
+ "typescript": "~5.8.3",
41
+ "typescript-eslint": "^8.30.1",
42
+ "vite": "^6.3.5",
43
+ "vite-plugin-dts": "^4.5.0"
44
+ },
45
+ "peerDependencies": {
46
+ "react": "^18.2.0",
47
+ "react-dom": "^18.2.0",
48
+ "@truworth/twc-web-design": "^1.0.0"
49
+ }
50
+ }