(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8454],{41395:function(t,e,r){Promise.resolve().then(r.bind(r,20558))},20558:function(t,e,r){"use strict";r.r(e),r.d(e,{Page:function(){return y},default:function(){return x}});var s=r(57437),n=r(79546),a=r(73107),o=r(24750),i=r(24282),c=r(47907),u=r(29891),l=r(73031),d=r(58440),h=r(51055),p=r(78028),m=r(59260),f=r(77599),g=r(29940),v=r(3537);let y=t=>{var e;let r=(0,c.useRouter)(),{mutate:y,isPending:x,isError:b,...P}=(e=t=>{t.access&&r.push("/accounts/buy-plan")},(0,n.M)(async t=>{let{payload:e}=t,{data:r}=await a.Z.post(o.ZP.user.register(),e);return console.log("success data",r),r},{onSuccess:t=>{i.Z.getState().setToken(t.access),e&&e(t)}})),R=(0,c.useSearchParams)(),_=(0,v.TA)({initialValues:{first_name:"",last_name:"",company:"",email:"",password:"",_error:""},onSubmit:async(t,e)=>{let{setFieldError:r}=e;y({payload:{...t,source:R.get("utm_source")||"",plan_uuid:R.get("plan")||""},setFieldError:r})}}),N=t=>({name:t,value:_.values[t],onChange:_.handleChange,onBlur:_.handleBlur,size:"sm",required:!0,isInvalid:!!_.errors[t],errorMessage:_.errors[t]});return(0,s.jsxs)(u.w,{className:"w-[300px] sm:w-[400px] max-w-[400px]",children:[(0,s.jsx)(l.u,{children:(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsx)("div",{className:"text-sm",children:"Register with Cacta"})})}),(0,s.jsx)(d.j,{}),(0,s.jsx)(h.G,{children:!b&&!x&&_.isValid&&_.submitCount>0?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"text-center space-y-6 py-8 px-2",children:(0,s.jsx)("div",{className:"text-lg font-semibold text-primary-600",children:"Registeration successful, logging in..."})})}):(0,s.jsxs)("form",{onSubmit:_.handleSubmit,children:[_.errors._error&&(0,s.jsx)("div",{className:"text-red-500 text-sm py-2",children:_.errors._error}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsx)(p.Y,{label:"First Name",...N("first_name")}),(0,s.jsx)(p.Y,{label:"Last Name",...N("last_name")}),(0,s.jsx)(p.Y,{className:"col-span-2",label:"Company",...N("company")}),(0,s.jsx)(p.Y,{className:"col-span-2",type:"email",label:"Email",...N("email")}),(0,s.jsx)(p.Y,{className:"col-span-2",type:"password",label:"Password",...N("password")})]}),(0,s.jsx)("div",{className:"mt-4 flex flex-row justify-end items-end",children:(0,s.jsx)(m.A,{color:"primary",type:"submit",className:"col-span-2",disabled:x,children:x?"Creating Account...":"Create Account"})})]})}),(0,s.jsx)(d.j,{}),(0,s.jsx)(f.i,{className:"flex justify-between",children:(0,s.jsxs)("div",{className:"text-xs",children:["Existing customer?"," ",(0,s.jsx)(g.O,{href:"/auth/login",className:"text-xs",children:"Sign in"})]})})]})};var x=y},24750:function(t,e,r){"use strict";r.d(e,{YY:function(){return a},Yr:function(){return u},__:function(){return h},db:function(){return l},iL:function(){return i},nP:function(){return o}});var s=r(73107),n=r(13449);let a=t=>{s.Z.interceptors.response.use(t=>t,e=>{var r,s;return((null===(r=e.response)||void 0===r?void 0:r.status)===401||(null===(s=e.response)||void 0===s?void 0:s.status)==403)&&t(),Promise.reject(e)})},o=t=>{s.Z.defaults.headers.common.Authorization="Bearer ".concat(t)},i=()=>{s.Z.defaults.headers.common.Authorization=void 0},c="X-Godmode-User-Id",u=t=>{s.Z.defaults.headers.common[c]=t},l=()=>{s.Z.defaults.headers.common[c]=void 0},d=n.T5,h={user:{checkAuth:()=>"".concat(d,"/auth/verify"),login:()=>"".concat(d,"/auth/login"),register:()=>"".concat(d,"/auth/register"),verifyEmail:()=>"".concat(d,"/auth/verify-email"),passwordResetRequest:()=>"".concat(d,"/auth/password-reset/request"),passwordReset:()=>"".concat(d,"/auth/password-reset"),profile:()=>"".concat(d,"/user/profile"),resetPasswordRequest:()=>"".concat(d,"/auth/reset-password/request"),resetPassword:()=>"".concat(d,"/auth/reset-password")},company:{user:()=>"".concat(d,"/company/user"),shippingPortalConnections:()=>"".concat(d,"/shipping-portal-connections"),settingsProfileGet:()=>"".concat(d,"/settings/company/profile"),settingsProfileUpdate:()=>"".concat(d,"/settings/company/profile"),settingsAddressUpdate:()=>"".concat(d,"/settings/company/address")},config:{search:()=>"".concat(d,"/routes/config")},contractDoc:{all:()=>"".concat(d,"/contract-rate-doc"),byId:t=>"".concat(d,"/contract-rate-doc/").concat(t),getUploadUrl:(t,e)=>"".concat(d,"/contract-rate-doc/upload-url?file_name=").concat(t,"&mime_type=").concat(e),surchargeConfig:t=>"".concat(d,"/contract-rate-doc/surcharge-config/").concat(t)},rates:{all:()=>"".concat(d,"/routes/search"),contract:()=>"".concat(d,"/contract/search"),getResultById:t=>"".concat(d,"/routes/search/").concat(t)},search:{locations:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"".concat(d,"/locations?q=").concat(t,"&type=").concat(e)}},demo:{validate:()=>"".concat(d,"/demo/validate"),registerInterest:()=>"".concat(d,"/demo/interest")},payments:{stripeBillingPortal:()=>"".concat(d,"/accounts/billing/stripe-billing-portal"),stripeCheckout:()=>"".concat(d,"/payments/checkout/stripe-checkout-session"),stripeCheckoutCancel:t=>"".concat(d,"/payments/checkout/stripe-checkout-session/").concat(t),stripeCheckoutReturn:()=>"".concat(d,"/payments/callbacks/stripe-checkout-return")},admin:{contractRateDocList:()=>"".concat(d,"/admin/contract-rate-doc"),contractRateDocDetail:t=>"".concat(d,"/admin/contract-rate-doc/").concat(t),contractRateDocPage:t=>"".concat(d,"/admin/contract-rate-doc/page/").concat(t),contractRateDocPageContentBlock:(t,e)=>"".concat(d,"/admin/contract-rate-doc/page/").concat(t,"/content-block/").concat(e),contractRateDocConfig:()=>"".concat(d,"/admin/contract-rate-doc/config")}};e.ZP=h},13449:function(t,e,r){"use strict";r.d(e,{Mw:function(){return a},QZ:function(){return o},T5:function(){return i}});var s=r(49079);let n=s.env.NEXT_PUBLIC_APP_ENV_NAME,a="production"===n||!n,o=s.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY||(a?"pk_live_51PZ84GGp56rr0O1JM8cpGGGfjmGzroxoADkfuoxwV1dRGBMdPgZG30DgPsFzYkKzUJOG0rlhpieG1mCLdXWsOJL300LJRN1c4J":""),i=s.env.NEXT_PUBLIC_API_URL||(a?"https://be.cacta.app/api/v1":"")},8331:function(t,e){"use strict";e.Z={user:{profile:["user","profile"]},contractRateDocument:{list:["contract_rate_document","list"],detail:t=>["contract_rate_document","detail",t]},admin:{contractRateDocList:["admin","contract_rate_doc","list"],contractRateDocDetail:t=>["admin","contract_rate_doc","detail",t],contractConfig:["admin","contract","config"]}}},24282:function(t,e,r){"use strict";r.d(e,{Z:function(){return c}});var s=r(22020),n=r(65249),a=r(24750),o=r(73107);async function i(){return(await o.Z.get(a.ZP.user.profile())).data}r(8331);var c=(0,s.Ue)((0,n.mW)((0,n.tJ)((t,e)=>({isReady:!1,token:null,isAuthenticated:!1,godModeUserId:null,profile:null,setReady:()=>{let r={isReady:!0,isAuthenticated:!1},s=e().token;if(s){(0,a.nP)(s),r.isAuthenticated=!0;let t=e().godModeUserId;t&&(0,a.Yr)(t)}else e().godModeUserId&&e().clearGodModeUserId();t(r)},setToken:e=>{(0,a.nP)(e),t({token:e,isAuthenticated:!0})},clearToken:()=>{(0,a.iL)(),(0,a.db)(),t({token:null,isAuthenticated:!1,profile:null})},setGodModeUserId:e=>{(0,a.Yr)(e),t({godModeUserId:e})},clearGodModeUserId:()=>{(0,a.db)(),t({godModeUserId:null})},fetchUserProfile:t=>{let r=e().token;r?((0,a.nP)(r),i().then(r=>{e().setProfile(r),t&&t(r)}).catch(r=>{console.log("Failed to get user profile",r),e().clearToken(),t&&t(null)})):(e().clearToken(),t&&t(null))},setProfile:e=>t({profile:e}),checkHasActivePlan:()=>{let t=e().profile;return!!t&&(!t.company.require_subscription||!!t.company.subscription&&["trialing","active"].includes(t.company.subscription.status))}}),{name:"auth-storage",version:1,onRehydrateStorage:t=>(e,r)=>{t.setReady()},partialize:t=>({token:t.token,isAuthenticated:t.isAuthenticated,godModeUserId:t.godModeUserId,profile:t.profile})}),{enabled:!1}))},79546:function(t,e,r){"use strict";r.d(e,{M:function(){return a}});var s=r(20568),n=r(73107);function a(t,e){return(0,s.D)({mutationFn:t,...e||{},onError:(t,r,s)=>{var a;if(!n.Z.isAxiosError(t))return;let o=t.response;if(!o||!o.status||500===o.status){r.setFieldError("_error","An error occurred, please try again");return}let i=(null===(a=t.response)||void 0===a?void 0:a.data)||{};if(i.error||i.detail){r.setFieldError("_error",i.error||i.detail);return}let c=i.errors;c&&(Object.entries(c).forEach(t=>{let[e,s]=t;return s&&r.setFieldError&&r.setFieldError(e,s[0]||"")}),e.onError&&e.onError(t,r,s))}})}},47907:function(t,e,r){"use strict";var s=r(15313);r.o(s,"useParams")&&r.d(e,{useParams:function(){return s.useParams}}),r.o(s,"usePathname")&&r.d(e,{usePathname:function(){return s.usePathname}}),r.o(s,"useRouter")&&r.d(e,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(e,{useSearchParams:function(){return s.useSearchParams}})},73031:function(t,e,r){"use strict";r.d(e,{u:function(){return u}});var s=r(32281),n=r(84449),a=r(72874),o=r(5142),i=r(57437),c=(0,n.Gp)((t,e)=>{var r;let{as:n,className:c,children:u,...l}=t,d=(0,a.gy)(e),{slots:h,classNames:p}=(0,s.R)(),m=(0,o.W)(null==p?void 0:p.header,c);return(0,i.jsx)(n||"div",{ref:d,className:null==(r=h.header)?void 0:r.call(h,{class:m}),...l,children:u})});c.displayName="NextUI.CardHeader";var u=c},77599:function(t,e,r){"use strict";r.d(e,{i:function(){return u}});var s=r(32281),n=r(84449),a=r(72874),o=r(5142),i=r(57437),c=(0,n.Gp)((t,e)=>{var r;let{as:n,className:c,children:u,...l}=t,d=(0,a.gy)(e),{slots:h,classNames:p}=(0,s.R)(),m=(0,o.W)(null==p?void 0:p.footer,c);return(0,i.jsx)(n||"div",{ref:d,className:null==(r=h.footer)?void 0:r.call(h,{class:m}),...l,children:u})});c.displayName="NextUI.CardFooter";var u=c},58440:function(t,e,r){"use strict";r.d(e,{j:function(){return u}});var s=r(58263),n=(0,r(50490).tv)({base:"shrink-0 bg-divider border-none",variants:{orientation:{horizontal:"w-full h-divider",vertical:"h-full w-divider"}},defaultVariants:{orientation:"horizontal"}}),a=r(2265),o=r(84449),i=r(57437),c=(0,o.Gp)((t,e)=>{let{Component:r,getDividerProps:o}=function(t){var e;let r,o;let{as:i,className:c,orientation:u,...l}=t,d=i||"hr";"hr"===d&&"vertical"===u&&(d="div");let{separatorProps:h}=(e={elementType:"string"==typeof d?d:"hr",orientation:u},o=(0,s.z)(e,{enabled:"string"==typeof e.elementType}),("vertical"===e.orientation&&(r="vertical"),"hr"!==e.elementType)?{separatorProps:{...o,role:"separator","aria-orientation":r}}:{separatorProps:o}),p=(0,a.useMemo)(()=>n({orientation:u,className:c}),[u,c]);return{Component:d,getDividerProps:(0,a.useCallback)((t={})=>({className:p,role:"separator","data-orientation":u,...h,...l,...t}),[p,u,h,l])}}({...t});return(0,i.jsx)(r,{ref:e,...o()})});c.displayName="NextUI.Divider";var u=c},20568:function(t,e,r){"use strict";r.d(e,{D:function(){return d}});var s=r(2265),n=r(1793),a=r(45139),o=r(44614),i=r(46063),c=class extends o.l{#t;#e=void 0;#r;#s;constructor(t,e){super(),this.#t=t,this.setOptions(e),this.bindMethods(),this.#n()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#t.defaultMutationOptions(t),(0,i.VS)(this.options,e)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),e?.mutationKey&&this.options.mutationKey&&(0,i.Ym)(e.mutationKey)!==(0,i.Ym)(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(t){this.#n(),this.#a(t)}getCurrentResult(){return this.#e}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#n(),this.#a()}mutate(t,e){return this.#s=e,this.#r?.removeObserver(this),this.#r=this.#t.getMutationCache().build(this.#t,this.options),this.#r.addObserver(this),this.#r.execute(t)}#n(){let t=this.#r?.state??(0,n.R)();this.#e={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#a(t){a.V.batch(()=>{if(this.#s&&this.hasListeners()){let e=this.#e.variables,r=this.#e.context;t?.type==="success"?(this.#s.onSuccess?.(t.data,e,r),this.#s.onSettled?.(t.data,null,e,r)):t?.type==="error"&&(this.#s.onError?.(t.error,e,r),this.#s.onSettled?.(void 0,t.error,e,r))}this.listeners.forEach(t=>{t(this.#e)})})}},u=r(47082),l=r(20826);function d(t,e){let r=(0,u.NL)(e),[n]=s.useState(()=>new c(r,t));s.useEffect(()=>{n.setOptions(t)},[n,t]);let o=s.useSyncExternalStore(s.useCallback(t=>n.subscribe(a.V.batchCalls(t)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=s.useCallback((t,e)=>{n.mutate(t,e).catch(l.Z)},[n]);if(o.error&&(0,l.L)(n.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}},20826:function(t,e,r){"use strict";function s(t,e){return"function"==typeof t?t(...e):!!t}function n(){}r.d(e,{L:function(){return s},Z:function(){return n}})}},function(t){t.O(0,[9426,3726,8028,8381,3537,5395,4228,2971,8069,1744],function(){return t(t.s=41395)}),_N_E=t.O()}]);