@wellesley/auth 1.0.600 → 1.0.602
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 wi,handleBasicResponse as Rt,useGetApiV1SearchQuery as bA,usePutApiV1AccountsResendEmailByHashMutation as vA,usePostApiV1AccountsAddReasonMutation as xA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as wi,handleBasicResponse as Rt,useGetApiV1SearchQuery as bA,usePutApiV1AccountsResendEmailByHashMutation as vA,usePostApiV1AccountsAddReasonMutation as xA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.546";import{createSlice as bi,createAction as Jv,createSelector as Ma}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as Xv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as sh,getServerApiErrorCode as En}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.397";import*as gl from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import zA,{forwardRef as vi,createElement as Rp,useCallback as zr,useMemo as Ap,useEffect as $e,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 xi,cn as Ne,HoverCard as SA,HoverCardTrigger as EA,HoverCardContent as jA,Switch as TA,Tooltip as Bg,TooltipTrigger as $g,TooltipContent as Gg,Avatar as RA,AvatarImage as AA,Textarea as CA,getTextareaClassName as IA,FormLabel as NA,useFormField as Qv,FormField as qA,FormItem as OA,FormControl as Lo,Input as ml,FormMessage as PA,Form as jn,ButtonLoader as Ua,useIsMobile as oh,Dialog as DA,DialogContent as LA}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.508";import{useAppsNavigate as Rr,AppsLink as qa}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.474";import{get as Cp,set as kl,appendErrors as MA,useForm as Tn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as ii,rootReducer as UA}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.545";import{EmojiPicker as BA,EmojiStyle as $A}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.397";import{useSearchParams as GA}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const FA="wlsy",e0=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},t0=()=>{const e=new Set,t=e0();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)},Os=e=>{const t=`${FA}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>t0().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),i=e0(),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}}}},zi="auth_token",ih=Os("user"),r0=()=>ih.getItem(zi)||void 0,WA=e=>ih.setItem(zi,e),HA=()=>ih.removeItem(zi),YA=()=>!!r0(),Si={getToken:r0,setToken:WA,removeToken:HA,hasToken:YA},Fg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!Si.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},xe=bi({name:"auth",initialState:Fg,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Fg,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}}),VA=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)},ZA=e=>VA(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=>ZA(t)&&t.type===e,t};ze("remoteReady");const KA=ze("askLogin");ze("reselectUser");const JA=ze("requestLogin");ze("requestLogout"),ze("setConfirmLeavePage"),ze("requestChangePath"),ze("wsSubscribe"),ze("wsUnSubscribe"),ze("hostStoreConnect");const XA=ze("remoteLogin"),a0=ze("remoteLogout");ze("wsOnMessage"),ze("setRouterPath"),ze("setDeviceType");const QA=ze("setUserError"),eC=ze("setUserIsError"),tC=ze("setUserPending"),rC=ze("setUserSuccess"),aC=ze("setUserData"),n0=ze("updateAccountData"),nC=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 sC=ze("setPlatformSettings");ze("setProfileSettings"),ze("setGroupData"),ze("setGroupLoading"),Jv("requestMicroFrontendFetch"),Jv("sendMicroFrontendFetchResponse");const wl=async(e,t,r)=>{try{e(xe.actions.setPending(!0));const{data:a}=await t,n="sessionKey"in a?a.sessionKey:a.token.sessionKey;return e(JA(n)),null==r||r(),t}catch(t){e(xe.actions.setPending(!1)),Xv.error(sh(t))}},oC=wi.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 wl(t,r,(()=>{Xv.success("User registered successfully")}))}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await wl(t,r)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await wl(t,r),e&&t(n0({selectedUserId:e}))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}}}}),{useGetApiV1RulesQuery:iC,usePostApiV1AccountsPasswordRecoverMutation:s0,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:ch,usePostApiV1AccountsPasswordRecoverChangeMutation:cC,usePostApiV1AccountsPasswordChangeConfirmMutation:o0,usePostApiV1AccountsPasswordChangeRequestMutation:lC,usePutApiV1AccountsPasswordChangeResendCodeMutation:uC,usePostApiV1AccountsAuthenticateEmailMutation:i0,usePostApiV1AccountsEmailChangeRequestMutation:fC,usePostApiV1AccountsEmailChangeConfirmMutation:c0,usePostApiV1AccountsSignupMutation:lh,usePutApiV1AccountsResendEmailByHashMutation:hue,usePutApiV1AccountsEmailChangeResendCodeMutation:dC,usePostApiV1AccountsConfirmEmailMutation:l0,usePostApiV1AccountsFinishCreatingMutation:pC,usePostApiV1AccountsUserReselectUserMutation:_ue,usePostApiV1AccountsCheckCaptchaMutation:hC,useGetApiV1RbacActorsByActorIdPermissionsQuery:_C}=oC;var la=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ei(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wg,Hg,bl={exports:{}},ns={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|