@wellesley/auth 1.0.633 → 1.0.634

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.
Files changed (2) hide show
  1. package/index.mjs +1 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{api as gs,handleBasicResponse as Nt,useGetApiV1UploadsByIdQuery as kO,useGetApiV1SearchQuery as xO,usePutApiV1AccountsResendEmailByHashMutation as jO,usePostApiV1AccountsAddReasonMutation as OO}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.577";import{createSlice as zo,createAction as Vw,createSelector as Ba}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as _w}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as sh,getServerApiErrorCode as On}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.428";import*as gf from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import TO,{forwardRef as wo,createElement as Np,useCallback as jr,useMemo as Dp,useEffect as Re,useState as Zt,useRef as Lt}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useSelector as Oe,useDispatch as Mt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{cn as Me,Button as Po,HoverCard as HO,HoverCardTrigger as NO,HoverCardContent as DO,Switch as MO,Tooltip as Em,TooltipTrigger as Sm,TooltipContent as Cm,Avatar as XO,AvatarImage as GO,Textarea as YO,getTextareaClassName as ZO,FormLabel as LO,useFormField as $w,FormField as AO,FormItem as RO,FormControl as Bc,Input as bf,FormMessage as BO,Form as Tn,ButtonLoader as Wa,useIsMobile as ch,Dialog as WO,DialogContent as EO}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.539";import{selectUploadFile as SO}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.462";import{useAppsNavigate as Ur,AppsLink as Ya,useAppsSearchParams as CO}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.505";import{get as Mp,set as zf,appendErrors as IO,useForm as Hn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as bs,rootReducer as FO}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.576";import{EmojiPicker as QO,EmojiStyle as qO}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.428";import{useSearchParams as JO,useLocation as UO}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const KO="wlsy",e9=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},t9=()=>{const e=new Set,t=e9();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)},As=e=>{const t=`${KO}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>t9().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),s=e9(),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}}}},ko="auth_token",oh=As("user"),r9=()=>oh.getItem(ko)||void 0,VO=e=>oh.setItem(ko,e),_O=()=>oh.removeItem(ko),$O=()=>!!r9(),xo={getToken:r9,setToken:VO,removeToken:_O,hasToken:$O},Im={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!xo.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=zo({name:"auth",initialState:Im,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Im,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}}),eT=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)},tT=e=>eT(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=>tT(t)&&t.type===e,t};xe("remoteReady");const rT=xe("askLogin");xe("reselectUser");const aT=xe("requestLogin");xe("requestLogout"),xe("setConfirmLeavePage"),xe("requestChangePath"),xe("wsSubscribe"),xe("wsUnSubscribe"),xe("hostStoreConnect");const nT=xe("remoteLogin"),a9=xe("remoteLogout");xe("wsOnMessage"),xe("setRouterPath"),xe("setDeviceType");const sT=xe("setUserError"),cT=xe("setUserIsError"),oT=xe("setUserPending"),iT=xe("setUserSuccess"),fT=xe("setUserData"),n9=xe("updateAccountData"),lT=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 uT=xe("setPlatformSettings");xe("setProfileSettings"),xe("setGroupData"),xe("setGroupLoading"),Vw("requestMicroFrontendFetch"),Vw("sendMicroFrontendFetchResponse");const wf=async(e,t,r)=>{try{e(ze.actions.setPending(!0));const{data:a}=await t,n="sessionKey"in a?a.sessionKey:a.token.sessionKey;return e(aT(n)),null==r||r(),t}catch(t){e(ze.actions.setPending(!1)),_w.error(sh(t))}},dT=gs.enhanceEndpoints({endpoints:{getApiV1Rules:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordRecover:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordRecoverCheckCode:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordRecoverChange:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},putApiV1AccountsPasswordChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},putApiV1AccountsEmailChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},putApiV1AccountsResendEmailByHash:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsEmailChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsEmailChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsConfirmEmail:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsCheckCaptcha:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsFinishCreating:{async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await wf(t,r,(()=>{_w.success("User registered successfully")}))}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await wf(t,r)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await wf(t,r),e&&(t(n9({selectedUserId:e})),t(gs.util.invalidateTags(["UserSettings"])))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}}}}),{useGetApiV1RulesQuery:pT,usePostApiV1AccountsPasswordRecoverMutation:s9,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:ih,usePostApiV1AccountsPasswordRecoverChangeMutation:hT,usePostApiV1AccountsPasswordChangeConfirmMutation:c9,usePostApiV1AccountsPasswordChangeRequestMutation:yT,usePutApiV1AccountsPasswordChangeResendCodeMutation:vT,usePostApiV1AccountsAuthenticateEmailMutation:o9,usePostApiV1AccountsEmailChangeRequestMutation:mT,usePostApiV1AccountsEmailChangeConfirmMutation:i9,usePostApiV1AccountsSignupMutation:fh,usePutApiV1AccountsResendEmailByHashMutation:Cle,usePutApiV1AccountsEmailChangeResendCodeMutation:gT,usePostApiV1AccountsConfirmEmailMutation:f9,usePostApiV1AccountsFinishCreatingMutation:bT,usePostApiV1AccountsUserReselectUserMutation:Ile,usePostApiV1AccountsCheckCaptchaMutation:zT,useGetApiV1RbacActorsByActorIdPermissionsQuery:wT}=dT;var la=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fm,Qm,Pf={exports:{}},ns={};
1
+ import{api as gs,handleBasicResponse as Nt,useGetApiV1UploadsByIdQuery as kO,useGetApiV1SearchQuery as xO,usePutApiV1AccountsResendEmailByHashMutation as jO,usePostApiV1AccountsAddReasonMutation as OO}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.578";import{createSlice as zo,createAction as Vw,createSelector as Ba}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as _w}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as sh,getServerApiErrorCode as On}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.429";import*as gf from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import TO,{forwardRef as wo,createElement as Np,useCallback as jr,useMemo as Dp,useEffect as Re,useState as Zt,useRef as Lt}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useSelector as Oe,useDispatch as Mt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{cn as Me,Button as Po,HoverCard as HO,HoverCardTrigger as NO,HoverCardContent as DO,Switch as MO,Tooltip as Em,TooltipTrigger as Sm,TooltipContent as Cm,Avatar as XO,AvatarImage as GO,Textarea as YO,getTextareaClassName as ZO,FormLabel as LO,useFormField as $w,FormField as AO,FormItem as RO,FormControl as Bc,Input as bf,FormMessage as BO,Form as Tn,ButtonLoader as Wa,useIsMobile as ch,Dialog as WO,DialogContent as EO}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.540";import{selectUploadFile as SO}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.463";import{useAppsNavigate as Ur,AppsLink as Ya,useAppsSearchParams as CO}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.506";import{get as Mp,set as zf,appendErrors as IO,useForm as Hn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as bs,rootReducer as FO}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.577";import{EmojiPicker as QO,EmojiStyle as qO}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.429";import{useSearchParams as JO,useLocation as UO}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const KO="wlsy",e9=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},t9=()=>{const e=new Set,t=e9();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)},As=e=>{const t=`${KO}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>t9().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),s=e9(),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}}}},ko="auth_token",oh=As("user"),r9=()=>oh.getItem(ko)||void 0,VO=e=>oh.setItem(ko,e),_O=()=>oh.removeItem(ko),$O=()=>!!r9(),xo={getToken:r9,setToken:VO,removeToken:_O,hasToken:$O},Im={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!xo.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=zo({name:"auth",initialState:Im,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Im,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}}),eT=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)},tT=e=>eT(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=>tT(t)&&t.type===e,t};xe("remoteReady");const rT=xe("askLogin");xe("reselectUser");const aT=xe("requestLogin");xe("requestLogout"),xe("setConfirmLeavePage"),xe("requestChangePath"),xe("wsSubscribe"),xe("wsUnSubscribe"),xe("hostStoreConnect");const nT=xe("remoteLogin"),a9=xe("remoteLogout");xe("wsOnMessage"),xe("setRouterPath"),xe("setDeviceType");const sT=xe("setUserError"),cT=xe("setUserIsError"),oT=xe("setUserPending"),iT=xe("setUserSuccess"),fT=xe("setUserData"),n9=xe("updateAccountData"),lT=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 uT=xe("setPlatformSettings");xe("setProfileSettings"),xe("setGroupData"),xe("setGroupLoading"),Vw("requestMicroFrontendFetch"),Vw("sendMicroFrontendFetchResponse");const wf=async(e,t,r)=>{try{e(ze.actions.setPending(!0));const{data:a}=await t,n="sessionKey"in a?a.sessionKey:a.token.sessionKey;return e(aT(n)),null==r||r(),t}catch(t){e(ze.actions.setPending(!1)),_w.error(sh(t))}},dT=gs.enhanceEndpoints({endpoints:{getApiV1Rules:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordRecover:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordRecoverCheckCode:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordRecoverChange:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},putApiV1AccountsPasswordChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsPasswordChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},putApiV1AccountsEmailChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},putApiV1AccountsResendEmailByHash:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsEmailChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsEmailChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsConfirmEmail:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsCheckCaptcha:{async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}},postApiV1AccountsFinishCreating:{async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await wf(t,r,(()=>{_w.success("User registered successfully")}))}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await wf(t,r)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await wf(t,r),e&&(t(n9({selectedUserId:e})),t(gs.util.invalidateTags(["UserSettings"])))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}}}}),{useGetApiV1RulesQuery:pT,usePostApiV1AccountsPasswordRecoverMutation:s9,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:ih,usePostApiV1AccountsPasswordRecoverChangeMutation:hT,usePostApiV1AccountsPasswordChangeConfirmMutation:c9,usePostApiV1AccountsPasswordChangeRequestMutation:yT,usePutApiV1AccountsPasswordChangeResendCodeMutation:vT,usePostApiV1AccountsAuthenticateEmailMutation:o9,usePostApiV1AccountsEmailChangeRequestMutation:mT,usePostApiV1AccountsEmailChangeConfirmMutation:i9,usePostApiV1AccountsSignupMutation:fh,usePutApiV1AccountsResendEmailByHashMutation:Cle,usePutApiV1AccountsEmailChangeResendCodeMutation:gT,usePostApiV1AccountsConfirmEmailMutation:f9,usePostApiV1AccountsFinishCreatingMutation:bT,usePostApiV1AccountsUserReselectUserMutation:Ile,usePostApiV1AccountsCheckCaptchaMutation:zT,useGetApiV1RbacActorsByActorIdPermissionsQuery:wT}=dT;var la=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fm,Qm,Pf={exports:{}},ns={};
2
2
  /**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.min.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wellesley/auth",
3
- "version": "1.0.633",
3
+ "version": "1.0.634",
4
4
  "license": "UNLICENSED",
5
5
  "main": "index.mjs",
6
6
  "files": [