@wellesley/auth 1.0.612 → 1.0.613
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 ki,handleBasicResponse as Rt,useGetApiV1SearchQuery as vA,usePutApiV1AccountsResendEmailByHashMutation as xA,usePostApiV1AccountsAddReasonMutation as zA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as ki,handleBasicResponse as Rt,useGetApiV1SearchQuery as vA,usePutApiV1AccountsResendEmailByHashMutation as xA,usePostApiV1AccountsAddReasonMutation as zA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.557";import{createSlice as wi,createAction as Kv,createSelector as Ma}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as Jv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as nh,getServerApiErrorCode as En}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.408";import*as yl from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import SA,{forwardRef as bi,createElement as Tp,useCallback as zr,useMemo as Rp,useEffect as Le,useState as Ot,useRef as Pt}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useDispatch as Ct,useSelector as Ae}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Button as vi,cn as Ne,HoverCard as EA,HoverCardTrigger as jA,HoverCardContent as TA,Switch as RA,Tooltip as Ug,TooltipTrigger as Bg,TooltipContent as $g,Avatar as AA,AvatarImage as CA,Textarea as IA,getTextareaClassName as NA,FormLabel as qA,useFormField as Xv,FormField as OA,FormItem as PA,FormControl as Mo,Input as gl,FormMessage as DA,Form as jn,ButtonLoader as Ua,useIsMobile as sh,Dialog as LA,DialogContent as MA}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.519";import{useAppsNavigate as Vr,AppsLink as qa,useAppsSearchParams as UA}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.485";import{get as Ap,set as ml,appendErrors as BA,useForm as Tn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as ms,rootReducer as $A}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.556";import{EmojiPicker as GA,EmojiStyle as FA}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.408";import{useSearchParams as WA,useLocation as HA}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const YA="wlsy",Qv=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},e0=()=>{const e=new Set,t=Qv();if(!t)return[];for(let r=0;r<(null==t?void 0:t.length);r+=1){const a=null==t?void 0:t.key(r);"string"==typeof a&&e.add(a)}return Array.from(e)},Ps=e=>{const t=`${YA}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>e0().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),i=Qv(),s=e=>{try{return null==i?void 0:i.getItem(r(e))}catch{return null}},o=(e,t)=>{try{null==i||i.setItem(r(e),String(t))}catch{return}};return{getItem:s,setItem:o,removeItem:e=>{try{null==i||i.removeItem(r(e))}catch{return}},clear:()=>{try{a().forEach((e=>null==i?void 0:i.removeItem(e)))}catch{return}},keys:()=>a().map(n),has:e=>null!==s(e),getJSON:e=>{const t=s(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{o(e,JSON.stringify(t))}catch{return}}}},xi="auth_token",oh=Ps("user"),t0=()=>oh.getItem(xi)||void 0,VA=e=>oh.setItem(xi,e),ZA=()=>oh.removeItem(xi),KA=()=>!!t0(),zi={getToken:t0,setToken:VA,removeToken:ZA,hasToken:KA},Gg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!zi.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},we=wi({name:"auth",initialState:Gg,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Gg,isPending:!1}),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}},selectors:{selectAskLoginOpen:e=>e.isAskLoginOpen,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,selectIsAuthenticated:e=>e.isAuthenticated}}),JA=e=>{if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)},XA=e=>JA(e)&&"type"in e&&"string"==typeof e.type,ze=e=>{const t=t=>({type:e,payload:t});return t.toString=()=>`${e}`,t.type=e,t.match=t=>XA(t)&&t.type===e,t};ze("remoteReady");const QA=ze("askLogin");ze("reselectUser");const eC=ze("requestLogin");ze("requestLogout"),ze("setConfirmLeavePage"),ze("requestChangePath"),ze("wsSubscribe"),ze("wsUnSubscribe"),ze("hostStoreConnect");const tC=ze("remoteLogin"),r0=ze("remoteLogout");ze("wsOnMessage"),ze("setRouterPath"),ze("setDeviceType");const rC=ze("setUserError"),aC=ze("setUserIsError"),nC=ze("setUserPending"),sC=ze("setUserSuccess"),oC=ze("setUserData"),a0=ze("updateAccountData"),iC=ze("updateUser");ze("addNotification"),ze("markNotification"),ze("setNotificationsError"),ze("setNotificationsList"),ze("setNotificationsPending"),ze("setNotificationsTotalCount"),ze("setNotificationsUnreadCount"),ze("resetNotificationsState"),ze("undoNotification"),ze("setInstanceInfo"),ze("setInstanceInfoPending"),ze("setInstanceInfoError");const cC=ze("setPlatformSettings");ze("setProfileSettings"),ze("setGroupData"),ze("setGroupLoading"),Kv("requestMicroFrontendFetch"),Kv("sendMicroFrontendFetchResponse");const kl=async(e,t,r)=>{try{e(we.actions.setPending(!0));const{data:a}=await t,n="sessionKey"in a?a.sessionKey:a.token.sessionKey;return e(eC(n)),null==r||r(),t}catch(t){e(we.actions.setPending(!1)),Jv.error(nh(t))}},lC=ki.enhanceEndpoints({endpoints:{getApiV1Rules:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsPasswordRecover:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsPasswordRecoverCheckCode:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsPasswordRecoverChange:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsPasswordChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},putApiV1AccountsPasswordChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsPasswordChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},putApiV1AccountsEmailChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},putApiV1AccountsResendEmailByHash:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsEmailChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsEmailChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsConfirmEmail:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsCheckCaptcha:{async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}},postApiV1AccountsFinishCreating:{async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await kl(t,r,(()=>{Jv.success("User registered successfully")}))}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await kl(t,r)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await kl(t,r),e&&t(a0({selectedUserId:e}))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}}}}),{useGetApiV1RulesQuery:uC,usePostApiV1AccountsPasswordRecoverMutation:n0,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:ih,usePostApiV1AccountsPasswordRecoverChangeMutation:fC,usePostApiV1AccountsPasswordChangeConfirmMutation:s0,usePostApiV1AccountsPasswordChangeRequestMutation:dC,usePutApiV1AccountsPasswordChangeResendCodeMutation:pC,usePostApiV1AccountsAuthenticateEmailMutation:o0,usePostApiV1AccountsEmailChangeRequestMutation:hC,usePostApiV1AccountsEmailChangeConfirmMutation:i0,usePostApiV1AccountsSignupMutation:ch,usePutApiV1AccountsResendEmailByHashMutation:wue,usePutApiV1AccountsEmailChangeResendCodeMutation:_C,usePostApiV1AccountsConfirmEmailMutation:c0,usePostApiV1AccountsFinishCreatingMutation:yC,usePostApiV1AccountsUserReselectUserMutation:bue,usePostApiV1AccountsCheckCaptchaMutation:gC,useGetApiV1RbacActorsByActorIdPermissionsQuery:mC}=lC;var la=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Si(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fg,Wg,wl={exports:{}},ns={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|