@wellesley/auth 1.0.569 → 1.0.571

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 mi,handleBasicResponse as Rt,useGetApiV1SearchQuery as mA,usePutApiV1AccountsResendEmailByHashMutation as kA,usePostApiV1AccountsAddReasonMutation as wA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.513";import{createSlice as ki,createAction as Vv,createSelector as Ma}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as Zv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as ah,getServerApiErrorCode as En}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.364";import*as _l from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import bA,{forwardRef as wi,createElement as jp,useCallback as zr,useMemo as Tp,useEffect as He,useState as Xt,useRef as qt}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useDispatch as Dt,useSelector as De}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Button as bi,cn as qe,HoverCard as vA,HoverCardTrigger as xA,HoverCardContent as zA,Switch as SA,Tooltip as Mg,TooltipTrigger as Ug,TooltipContent as Bg,Avatar as EA,AvatarImage as jA,Textarea as TA,getTextareaClassName as RA,FormLabel as AA,useFormField as Kv,FormField as CA,FormItem as IA,FormControl as Do,Input as yl,FormMessage as NA,Form as jn,ButtonLoader as Ua,useIsMobile as nh}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.475";import{useAppsNavigate as Rr,AppsLink as Na}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.441";import{get as Rp,set as gl,appendErrors as qA,useForm as Tn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as si,rootReducer as OA}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.512";import{EmojiPicker as PA,EmojiStyle as DA}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.364";import{useSearchParams as LA}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const MA="wlsy",Jv=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},UA=()=>{const e=new Set,t=Jv();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)},vi=e=>{const t=`${MA}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>UA().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),i=Jv(),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}}}},sh="auth_token",oh=vi("user"),Xv=()=>oh.getItem(sh)||void 0,BA=e=>oh.setItem(sh,e),$A=()=>oh.removeItem(sh),GA=()=>!!Xv(),xi={getToken:Xv,setToken:BA,removeToken:$A,hasToken:GA},$g={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!xi.getToken(),isAuthenticated:!1},Te=ki({name:"auth",initialState:$g,reducers:{login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...$g,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:{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}}),FA=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)},WA=e=>FA(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=>WA(t)&&t.type===e,t};xe("remoteReady"),xe("reselectUser");const HA=xe("requestLogin");xe("requestLogout"),xe("setConfirmLeavePage"),xe("requestChangePath"),xe("wsSubscribe"),xe("wsUnSubscribe"),xe("hostStoreConnect");const YA=xe("remoteLogin"),Qv=xe("remoteLogout");xe("wsOnMessage"),xe("setRouterPath"),xe("setDeviceType");const VA=xe("setUserError"),ZA=xe("setUserIsError"),KA=xe("setUserPending"),JA=xe("setUserSuccess"),XA=xe("setUserData"),e0=xe("updateAccountData"),QA=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 eC=xe("setPlatformSettings");xe("setProfileSettings"),xe("setGroupData"),xe("setGroupLoading"),xe("showGroupBasicInfo"),Vv("requestMicroFrontendFetch"),Vv("sendMicroFrontendFetchResponse");const ml=async(e,t,r)=>{try{e(Te.actions.setPending(!0));const{data:a}=await t,n="sessionKey"in a?a.sessionKey:a.token.sessionKey;return e(HA(n)),null==r||r(),t}catch(t){e(Te.actions.setPending(!1)),Zv.error(ah(t))}},tC=mi.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 ml(t,r,(()=>{Zv.success("User registered successfully")}))}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await ml(t,r)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await ml(t,r),e&&t(e0({selectedUserId:e}))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}}}}),{useGetApiV1RulesQuery:rC,usePostApiV1AccountsPasswordRecoverMutation:t0,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:ih,usePostApiV1AccountsPasswordRecoverChangeMutation:aC,usePostApiV1AccountsPasswordChangeConfirmMutation:r0,usePostApiV1AccountsPasswordChangeRequestMutation:nC,usePutApiV1AccountsPasswordChangeResendCodeMutation:sC,usePostApiV1AccountsAuthenticateEmailMutation:a0,usePostApiV1AccountsEmailChangeRequestMutation:oC,usePostApiV1AccountsEmailChangeConfirmMutation:n0,usePostApiV1AccountsSignupMutation:ch,usePutApiV1AccountsResendEmailByHashMutation:nue,usePutApiV1AccountsEmailChangeResendCodeMutation:iC,usePostApiV1AccountsConfirmEmailMutation:s0,usePostApiV1AccountsFinishCreatingMutation:cC,usePostApiV1AccountsUserReselectUserMutation:sue,usePostApiV1AccountsCheckCaptchaMutation:lC,useGetApiV1RbacActorsByActorIdPermissionsQuery:uC}=tC;var ca=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gg,Fg,kl={exports:{}},ns={};
1
+ import{api as mi,handleBasicResponse as Rt,useGetApiV1SearchQuery as mA,usePutApiV1AccountsResendEmailByHashMutation as kA,usePostApiV1AccountsAddReasonMutation as wA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.515";import{createSlice as ki,createAction as Vv,createSelector as Ma}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as Zv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as ah,getServerApiErrorCode as En}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.366";import*as _l from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import bA,{forwardRef as wi,createElement as jp,useCallback as zr,useMemo as Tp,useEffect as He,useState as Xt,useRef as qt}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useDispatch as Dt,useSelector as De}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Button as bi,cn as qe,HoverCard as vA,HoverCardTrigger as xA,HoverCardContent as zA,Switch as SA,Tooltip as Mg,TooltipTrigger as Ug,TooltipContent as Bg,Avatar as EA,AvatarImage as jA,Textarea as TA,getTextareaClassName as RA,FormLabel as AA,useFormField as Kv,FormField as CA,FormItem as IA,FormControl as Do,Input as yl,FormMessage as NA,Form as jn,ButtonLoader as Ua,useIsMobile as nh}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.477";import{useAppsNavigate as Rr,AppsLink as Na}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.443";import{get as Rp,set as gl,appendErrors as qA,useForm as Tn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as si,rootReducer as OA}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.514";import{EmojiPicker as PA,EmojiStyle as DA}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.366";import{useSearchParams as LA}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const MA="wlsy",Jv=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},UA=()=>{const e=new Set,t=Jv();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)},vi=e=>{const t=`${MA}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>UA().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),i=Jv(),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}}}},sh="auth_token",oh=vi("user"),Xv=()=>oh.getItem(sh)||void 0,BA=e=>oh.setItem(sh,e),$A=()=>oh.removeItem(sh),GA=()=>!!Xv(),xi={getToken:Xv,setToken:BA,removeToken:$A,hasToken:GA},$g={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!xi.getToken(),isAuthenticated:!1},Te=ki({name:"auth",initialState:$g,reducers:{login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...$g,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:{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}}),FA=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)},WA=e=>FA(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=>WA(t)&&t.type===e,t};xe("remoteReady"),xe("reselectUser");const HA=xe("requestLogin");xe("requestLogout"),xe("setConfirmLeavePage"),xe("requestChangePath"),xe("wsSubscribe"),xe("wsUnSubscribe"),xe("hostStoreConnect");const YA=xe("remoteLogin"),Qv=xe("remoteLogout");xe("wsOnMessage"),xe("setRouterPath"),xe("setDeviceType");const VA=xe("setUserError"),ZA=xe("setUserIsError"),KA=xe("setUserPending"),JA=xe("setUserSuccess"),XA=xe("setUserData"),e0=xe("updateAccountData"),QA=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 eC=xe("setPlatformSettings");xe("setProfileSettings"),xe("setGroupData"),xe("setGroupLoading"),xe("showGroupBasicInfo"),Vv("requestMicroFrontendFetch"),Vv("sendMicroFrontendFetchResponse");const ml=async(e,t,r)=>{try{e(Te.actions.setPending(!0));const{data:a}=await t,n="sessionKey"in a?a.sessionKey:a.token.sessionKey;return e(HA(n)),null==r||r(),t}catch(t){e(Te.actions.setPending(!1)),Zv.error(ah(t))}},tC=mi.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 ml(t,r,(()=>{Zv.success("User registered successfully")}))}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await ml(t,r)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await ml(t,r),e&&t(e0({selectedUserId:e}))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}}}}),{useGetApiV1RulesQuery:rC,usePostApiV1AccountsPasswordRecoverMutation:t0,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:ih,usePostApiV1AccountsPasswordRecoverChangeMutation:aC,usePostApiV1AccountsPasswordChangeConfirmMutation:r0,usePostApiV1AccountsPasswordChangeRequestMutation:nC,usePutApiV1AccountsPasswordChangeResendCodeMutation:sC,usePostApiV1AccountsAuthenticateEmailMutation:a0,usePostApiV1AccountsEmailChangeRequestMutation:oC,usePostApiV1AccountsEmailChangeConfirmMutation:n0,usePostApiV1AccountsSignupMutation:ch,usePutApiV1AccountsResendEmailByHashMutation:nue,usePutApiV1AccountsEmailChangeResendCodeMutation:iC,usePostApiV1AccountsConfirmEmailMutation:s0,usePostApiV1AccountsFinishCreatingMutation:cC,usePostApiV1AccountsUserReselectUserMutation:sue,usePostApiV1AccountsCheckCaptchaMutation:lC,useGetApiV1RbacActorsByActorIdPermissionsQuery:uC}=tC;var ca=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gg,Fg,kl={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.569",
3
+ "version": "1.0.571",
4
4
  "license": "UNLICENSED",
5
5
  "main": "index.mjs",
6
6
  "files": [