@wellesley/auth 1.0.178 → 1.0.179
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.
- package/index.mjs +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{api as ds,handleBasicResponse as Yt,useGetApiV1SearchQuery as UR,usePutApiV1AccountsResendEmailByHashMutation as $R,usePostApiV1AccountsAddReasonMutation as GR}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as ds,handleBasicResponse as Yt,useGetApiV1SearchQuery as UR,usePutApiV1AccountsResendEmailByHashMutation as $R,usePostApiV1AccountsAddReasonMutation as GR}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.137";import{createSlice as Oa,createSelector as vt,combineSlices as FR}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{getErrorMsg as Gp,getServerApiErrorCode as vn}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.3";import{toast as qv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{userSlice as ia,UserAvatar as WR}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.119";import*as tl from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import Ov,{forwardRef as Pv,createElement as hp,useCallback as br,useEffect as We,useState as wt,useRef as Ur,useMemo as zg}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useSelector as Ce,useDispatch as Dt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Button as Fp,cn as Ve,HoverCard as HR,HoverCardTrigger as YR,HoverCardContent as VR,Switch as ZR,Tooltip as Sg,TooltipTrigger as Eg,TooltipContent as jg,Textarea as KR,FormField as JR,FormItem as XR,FormLabel as QR,FormControl as eA,Input as Tg,FormMessage as tA,Form as xn,ButtonLoader as Pa}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.67";import{useAppsNavigate as Fr,AppsLink as Aa}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.76";import{logErrorToSentry as rA}from"https://cdn.jsdelivr.net/npm/@wellesley/sentry@1.0.10";import{get as _p,set as rl,appendErrors as aA,useForm as zn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as nA}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.143";import{EmojiPicker as sA,EmojiStyle as oA}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.3";import{useSearchParams as iA}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";import{instanceInfoSlice as yp}from"https://cdn.jsdelivr.net/npm/@wellesley/instanceinfo@1.0.10";const ci=()=>"object"!=typeof window,Dv=()=>Bv()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),Lv=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},Mv=e=>Object.keys(e).reduce(((t,r)=>`${t}${r}${!0===e[r]?"":`=${e[r]}`};`),""),cA=(e,t)=>{const r=ci()?"":document.cookie,a=`; ${t||r}`.split(`; ${e}=`);if(2===a.length)return(a.pop()||"").replace("=","").split(";").shift()},lA=(e,t)=>{ci()||(document.cookie=Mv({[e]:"",path:"/",domain:t||Dv(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},uA=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],Bv=()=>uA.includes(location.hostname),fA=(e,t="",r=10,a)=>{ci()||(document.cookie=Mv({[e]:t,path:"/",domain:a||Dv(),expires:Lv(r),...!Bv()&&{SameSite:"None",Secure:!0}}))},li={set:fA,remove:lA,get:cA,getExpireDate:Lv},ui="auth_token",Rg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isAuthBlockVisible:!0,isPending:!1,isAuthenticated:!1},Ee=Oa({name:"auth",initialState:Rg,reducers:{logout:()=>Rg,setNewEmail:(e,t)=>{e.newEmail=t.payload},setForgotPasswordStep:(e,t)=>{e.forgotPasswordStep=t.payload},updateForgotPasswordFields:(e,t)=>{e.forgotPasswordFields={...e.forgotPasswordFields,...t.payload}},resetForgotPasswordFields:e=>{e.forgotPasswordFields=null},setSignupStep:(e,t)=>{e.signupStep=t.payload},updateSignupFields:(e,t)=>{e.signupFields={...e.signupFields,...t.payload}},resetSignupFields:e=>{e.signupFields=null},setPending:(e,t)=>{e.isPending=t.payload},showAuthBlock:(e,t)=>{e.isAuthBlockVisible=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload,e.isPending=!1}},selectors:{selectToken:e=>e.token,selectNewEmail:e=>e.newEmail,selectForgotPasswordStep:e=>e.forgotPasswordStep,selectForgotPasswordFields:e=>e.forgotPasswordFields,selectSignupStep:e=>e.signupStep,selectSignupFields:e=>e.signupFields,selectPending:e=>e.isPending,selectAuthBlockVisible:e=>e.isAuthBlockVisible,selectIsAuthenticated:e=>e.isAuthenticated}}),al=async(e,t,r)=>{try{e(Ee.actions.setPending(!0));const{data:a}=await t;return li.set(ui,a.token.sessionKey),null==r||r(),t}catch(t){e(Ee.actions.setPending(!1)),qv.error(Gp(t))}},dA=ds.enhanceEndpoints({endpoints:{postApiV1AccountsPasswordRecover:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsPasswordRecoverCheckCode:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsPasswordRecoverChange:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsPasswordChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},putApiV1AccountsPasswordChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsPasswordChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},putApiV1AccountsEmailChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},putApiV1AccountsResendEmailByHash:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsEmailChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsEmailChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsConfirmEmail:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsCheckCaptcha:{async onQueryStarted(e,{queryFulfilled:t}){await Yt(t)}},postApiV1AccountsFinishCreating:{async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await al(t,r,(()=>{qv.success("User registered successfully")}))}},postApiV1AccountsAuthenticate:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await al(t,r)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await al(t,r),e&&t(ia.actions.updateData({selectedUserId:e}))}}}}),{usePostApiV1AccountsPasswordRecoverMutation:Uv,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:Wp,usePostApiV1AccountsPasswordRecoverChangeMutation:pA,usePostApiV1AccountsPasswordChangeConfirmMutation:$v,usePostApiV1AccountsPasswordChangeRequestMutation:hA,usePutApiV1AccountsPasswordChangeResendCodeMutation:_A,usePostApiV1AccountsAuthenticateMutation:Gv,usePostApiV1AccountsEmailChangeRequestMutation:yA,usePostApiV1AccountsEmailChangeConfirmMutation:Fv,usePostApiV1AccountsSignupMutation:Hp,usePutApiV1AccountsResendEmailByHashMutation:$ce,usePutApiV1AccountsEmailChangeResendCodeMutation:gA,usePostApiV1AccountsConfirmEmailMutation:Wv,usePostApiV1AccountsFinishCreatingMutation:mA,usePostApiV1AccountsReselectUserMutation:Gce,usePostApiV1AccountsCheckCaptchaMutation:kA}=dA;var oa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ag,Cg,nl={exports:{}},es={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|