@wellesley/auth 1.0.594 → 1.0.595

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 ki,handleBasicResponse as Rt,useGetApiV1SearchQuery as bA,usePutApiV1AccountsResendEmailByHashMutation as vA,usePostApiV1AccountsAddReasonMutation as xA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.538";import{createSlice as wi,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.389";import*as yl from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import zA,{forwardRef as bi,createElement as Tp,useCallback as Sr,useMemo as Rp,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 vi,cn as Ie,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 gl,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.500";import{useAppsNavigate as Ar,AppsLink as qa}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.466";import{get as Ap,set as ml,appendErrors as MA,useForm as Tn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as oi,rootReducer as UA}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.537";import{EmojiPicker as BA,EmojiStyle as $A}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.389";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}}}},xi="auth_token",ih=Os("user"),r0=()=>ih.getItem(xi)||void 0,WA=e=>ih.setItem(xi,e),HA=()=>ih.removeItem(xi),YA=()=>!!r0(),zi={getToken:r0,setToken:WA,removeToken:HA,hasToken:YA},Fg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!zi.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=wi({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,we=e=>{const t=t=>({type:e,payload:t});return t.toString=()=>`${e}`,t.type=e,t.match=t=>ZA(t)&&t.type===e,t};we("remoteReady");const KA=we("askLogin");we("reselectUser");const JA=we("requestLogin");we("requestLogout"),we("setConfirmLeavePage"),we("requestChangePath"),we("wsSubscribe"),we("wsUnSubscribe"),we("hostStoreConnect");const XA=we("remoteLogin"),a0=we("remoteLogout");we("wsOnMessage"),we("setRouterPath"),we("setDeviceType");const QA=we("setUserError"),eC=we("setUserIsError"),tC=we("setUserPending"),rC=we("setUserSuccess"),aC=we("setUserData"),n0=we("updateAccountData"),nC=we("updateUser");we("addNotification"),we("markNotification"),we("setNotificationsError"),we("setNotificationsList"),we("setNotificationsPending"),we("setNotificationsTotalCount"),we("setNotificationsUnreadCount"),we("resetNotificationsState"),we("undoNotification"),we("setInstanceInfo"),we("setInstanceInfoPending"),we("setInstanceInfoError");const sC=we("setPlatformSettings");we("setProfileSettings"),we("setGroupData"),we("setGroupLoading"),we("showGroupBasicInfo"),Jv("requestMicroFrontendFetch"),Jv("sendMicroFrontendFetchResponse");const kl=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(JA(n)),null==r||r(),t}catch(t){e(ze.actions.setPending(!1)),Xv.error(sh(t))}},oC=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,(()=>{Xv.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(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 Si(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wg,Hg,wl={exports:{}},ns={};
1
+ import{api as ki,handleBasicResponse as Rt,useGetApiV1SearchQuery as bA,usePutApiV1AccountsResendEmailByHashMutation as vA,usePostApiV1AccountsAddReasonMutation as xA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.539";import{createSlice as wi,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.390";import*as yl from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import zA,{forwardRef as bi,createElement as Tp,useCallback as Sr,useMemo as Rp,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 vi,cn as Ie,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 gl,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.501";import{useAppsNavigate as Ar,AppsLink as qa}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.467";import{get as Ap,set as ml,appendErrors as MA,useForm as Tn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as oi,rootReducer as UA}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.538";import{EmojiPicker as BA,EmojiStyle as $A}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.390";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}}}},xi="auth_token",ih=Os("user"),r0=()=>ih.getItem(xi)||void 0,WA=e=>ih.setItem(xi,e),HA=()=>ih.removeItem(xi),YA=()=>!!r0(),zi={getToken:r0,setToken:WA,removeToken:HA,hasToken:YA},Fg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!zi.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=wi({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,we=e=>{const t=t=>({type:e,payload:t});return t.toString=()=>`${e}`,t.type=e,t.match=t=>ZA(t)&&t.type===e,t};we("remoteReady");const KA=we("askLogin");we("reselectUser");const JA=we("requestLogin");we("requestLogout"),we("setConfirmLeavePage"),we("requestChangePath"),we("wsSubscribe"),we("wsUnSubscribe"),we("hostStoreConnect");const XA=we("remoteLogin"),a0=we("remoteLogout");we("wsOnMessage"),we("setRouterPath"),we("setDeviceType");const QA=we("setUserError"),eC=we("setUserIsError"),tC=we("setUserPending"),rC=we("setUserSuccess"),aC=we("setUserData"),n0=we("updateAccountData"),nC=we("updateUser");we("addNotification"),we("markNotification"),we("setNotificationsError"),we("setNotificationsList"),we("setNotificationsPending"),we("setNotificationsTotalCount"),we("setNotificationsUnreadCount"),we("resetNotificationsState"),we("undoNotification"),we("setInstanceInfo"),we("setInstanceInfoPending"),we("setInstanceInfoError");const sC=we("setPlatformSettings");we("setProfileSettings"),we("setGroupData"),we("setGroupLoading"),we("showGroupBasicInfo"),Jv("requestMicroFrontendFetch"),Jv("sendMicroFrontendFetchResponse");const kl=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(JA(n)),null==r||r(),t}catch(t){e(ze.actions.setPending(!1)),Xv.error(sh(t))}},oC=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,(()=>{Xv.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(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 Si(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wg,Hg,wl={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.594",
3
+ "version": "1.0.595",
4
4
  "license": "UNLICENSED",
5
5
  "main": "index.mjs",
6
6
  "files": [