@wellesley/auth 1.0.658 → 1.0.659
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 lo,handleBasicResponse as Dt,useGetApiV1SearchQuery as OO,usePutApiV1AccountsResendEmailByHashMutation as TO,usePostApiV1AccountsAddReasonMutation as HO}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as lo,handleBasicResponse as Dt,useGetApiV1SearchQuery as OO,usePutApiV1AccountsResendEmailByHashMutation as TO,usePostApiV1AccountsAddReasonMutation as HO}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.603";import{createSlice as jo,createAction as $w,createSelector as Ba}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as e9}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as nh,getServerApiErrorCode as On}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.454";import*as gf from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import NO,{forwardRef as Oo,createElement as Np,useCallback as jr,useMemo as Dp,useEffect as Re,useState as Mt,useRef as At}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useSelector as He,useDispatch as Gt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{cn as Ze,Button as Zs,HoverCard as DO,HoverCardTrigger as MO,HoverCardContent as XO,Switch as GO,Tooltip as Em,TooltipTrigger as Sm,TooltipContent as Cm,Avatar as YO,AvatarImage as ZO,Textarea as LO,getTextareaClassName as AO,FormLabel as RO,useFormField as t9,FormField as BO,FormItem as WO,FormControl as Bc,Input as bf,FormMessage as EO,Form as Tn,ButtonLoader as Wa,useIsMobile as sh,Dialog as SO,DialogContent as CO,Tabs as IO,TabsList as FO,TabsTrigger as Im,TabsContent as Fm}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.565";import{AppsLink as da,useAppsNavigate as Ur,useAppsSearchParams as QO,matchPath as qO}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.531";import{get as Mp,set as zf,appendErrors as JO,useForm as Hn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{rootReducer as UO,getStore as uo}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.602";import{EmojiPicker as KO,EmojiStyle as VO}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.454";import{useSearchParams as _O,useLocation as $O}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const eT="wlsy",r9=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},a9=()=>{const e=new Set,t=r9();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)},Ls=e=>{const t=`${eT}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>a9().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),s=r9(),o=e=>{try{return null==s?void 0:s.getItem(r(e))}catch{return null}},c=(e,t)=>{try{null==s||s.setItem(r(e),String(t))}catch{return}};return{getItem:o,setItem:c,removeItem:e=>{try{null==s||s.removeItem(r(e))}catch{return}},clear:()=>{try{a().forEach((e=>null==s?void 0:s.removeItem(e)))}catch{return}},keys:()=>a().map(n),has:e=>null!==o(e),getJSON:e=>{const t=o(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{c(e,JSON.stringify(t))}catch{return}}}},To="auth_token",ch=Ls("user"),n9=()=>ch.getItem(To)||void 0,tT=e=>ch.setItem(To,e),rT=()=>ch.removeItem(To),aT=()=>!!n9(),As={getToken:n9,setToken:tT,removeToken:rT,hasToken:aT},Qm={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!As.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=jo({name:"auth",initialState:Qm,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Qm,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}}),nT=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)},sT=e=>nT(e)&&"type"in e&&"string"==typeof e.type,xe=e=>{const t=t=>({type:e,payload:t});return t.toString=()=>`${e}`,t.type=e,t.match=t=>sT(t)&&t.type===e,t};xe("remoteReady");const cT=xe("askLogin");xe("reselectUser"),xe("requestLogout"),xe("setConfirmLeavePage"),xe("requestChangePath"),xe("wsSubscribe"),xe("wsUnSubscribe"),xe("hostStoreConnect");const oT=xe("remoteLogin"),s9=xe("remoteLogout");xe("wsOnMessage"),xe("setRouterPath"),xe("setDeviceType");const iT=xe("setUserError"),fT=xe("setUserIsError"),lT=xe("setUserPending"),uT=xe("setUserSuccess"),dT=xe("setUserData"),c9=xe("updateAccountData"),pT=xe("updateUser");xe("addNotification"),xe("markNotification"),xe("setNotificationsError"),xe("setNotificationsList"),xe("setNotificationsPending"),xe("setNotificationsTotalCount"),xe("setNotificationsUnreadCount"),xe("resetNotificationsState"),xe("undoNotification"),xe("setInstanceInfo"),xe("setInstanceInfoPending"),xe("setInstanceInfoError");const hT=xe("setPlatformSettings");xe("setProfileSettings"),xe("setGroupData"),xe("setGroupLoading"),$w("requestMicroFrontendFetch"),$w("sendMicroFrontendFetchResponse");const o9=e=>{var t;return 401===(null==e?void 0:e.status)&&"UserBadCreds"===(null==(t=null==e?void 0:e.data)?void 0:t.errorCode)},wf=async({dispatch:e,queryFulfilled:t,onSuccess:r,showInvalidCredsToast:a=!0})=>{try{e(ze.actions.setPending(!0));const{data:a}=await t,n="sessionKey"in a?a.sessionKey:a.token.sessionKey;return As.setToken(n),null==r||r(),t}catch(t){const r=t.error,n=o9(r);if(e(ze.actions.setPending(!1)),n&&!a)return;e9.error(nh(t))}},yT=lo.enhanceEndpoints({endpoints:{getApiV1Rules:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsPasswordRecover:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsPasswordRecoverCheckCode:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsPasswordRecoverChange:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsPasswordChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},putApiV1AccountsPasswordChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsPasswordChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},putApiV1AccountsEmailChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},putApiV1AccountsResendEmailByHash:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsEmailChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsEmailChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsConfirmEmail:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsCheckCaptcha:{async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}},postApiV1AccountsFinishCreating:{async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await wf({dispatch:t,queryFulfilled:r,onSuccess:()=>{e9.success("User registered successfully")}})}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await wf({dispatch:t,queryFulfilled:r,showInvalidCredsToast:!1})}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await wf({dispatch:t,queryFulfilled:r}),e&&(t(c9({selectedUserId:e})),t(lo.util.invalidateTags(["UserSettings"])))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Dt(t)}}}}),{useGetApiV1RulesQuery:vT,usePostApiV1AccountsPasswordRecoverMutation:i9,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:oh,usePostApiV1AccountsPasswordRecoverChangeMutation:mT,usePostApiV1AccountsPasswordChangeConfirmMutation:f9,usePostApiV1AccountsPasswordChangeRequestMutation:gT,usePutApiV1AccountsPasswordChangeResendCodeMutation:bT,usePostApiV1AccountsAuthenticateEmailMutation:l9,usePostApiV1AccountsEmailChangeRequestMutation:zT,usePostApiV1AccountsEmailChangeConfirmMutation:u9,usePostApiV1AccountsSignupMutation:ih,usePutApiV1AccountsResendEmailByHashMutation:Qle,usePutApiV1AccountsEmailChangeResendCodeMutation:wT,usePostApiV1AccountsConfirmEmailMutation:d9,usePostApiV1AccountsFinishCreatingMutation:PT,usePostApiV1AccountsUserReselectUserMutation:qle,usePostApiV1AccountsCheckCaptchaMutation:kT,useGetApiV1RbacActorsByActorIdPermissionsQuery:xT}=yT;var la=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ho(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qm,Jm,Pf={exports:{}},ns={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|