@wellesley/auth 1.0.583 → 1.0.585

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 wA,usePutApiV1AccountsResendEmailByHashMutation as bA,usePostApiV1AccountsAddReasonMutation as vA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.527";import{createSlice as wi,createAction as Kv,createSelector as Ma}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as Jv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as nh,getServerApiErrorCode as En}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.378";import*as yl from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import xA,{forwardRef as bi,createElement as Tp,useCallback as Sr,useMemo as Rp,useEffect as Ge,useState as Xt,useRef as Ot}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useDispatch as Ct,useSelector as Ce}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Button as vi,cn as Oe,HoverCard as zA,HoverCardTrigger as SA,HoverCardContent as EA,Switch as jA,Tooltip as Ug,TooltipTrigger as Bg,TooltipContent as $g,Avatar as TA,AvatarImage as RA,Textarea as AA,getTextareaClassName as CA,FormLabel as IA,useFormField as Xv,FormField as NA,FormItem as qA,FormControl as Lo,Input as gl,FormMessage as OA,Form as jn,ButtonLoader as Ua,useIsMobile as sh,Dialog as PA,DialogContent as DA}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.489";import{useAppsNavigate as Ar,AppsLink as Na}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.455";import{get as Ap,set as ml,appendErrors as LA,useForm as Tn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as oi,rootReducer as MA}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.526";import{EmojiPicker as UA,EmojiStyle as BA}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.378";import{useSearchParams as $A}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const GA="wlsy",Qv=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},e0=()=>{const e=new Set,t=Qv();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=`${GA}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>e0().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),i=Qv(),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",oh=Os("user"),t0=()=>oh.getItem(xi)||void 0,FA=e=>oh.setItem(xi,e),WA=()=>oh.removeItem(xi),HA=()=>!!t0(),zi={getToken:t0,setToken:FA,removeToken:WA,hasToken:HA},Gg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!zi.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=wi({name:"auth",initialState:Gg,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Gg,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}}),YA=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)},VA=e=>YA(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=>VA(t)&&t.type===e,t};we("remoteReady");const ZA=we("askLogin");we("reselectUser");const KA=we("requestLogin");we("requestLogout"),we("setConfirmLeavePage"),we("requestChangePath"),we("wsSubscribe"),we("wsUnSubscribe"),we("hostStoreConnect");const JA=we("remoteLogin"),r0=we("remoteLogout");we("wsOnMessage"),we("setRouterPath"),we("setDeviceType");const XA=we("setUserError"),QA=we("setUserIsError"),eC=we("setUserPending"),tC=we("setUserSuccess"),rC=we("setUserData"),a0=we("updateAccountData"),aC=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 nC=we("setPlatformSettings");we("setProfileSettings"),we("setGroupData"),we("setGroupLoading"),we("showGroupBasicInfo"),Kv("requestMicroFrontendFetch"),Kv("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(KA(n)),null==r||r(),t}catch(t){e(ze.actions.setPending(!1)),Jv.error(nh(t))}},sC=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,(()=>{Jv.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(a0({selectedUserId:e}))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}}}}),{useGetApiV1RulesQuery:oC,usePostApiV1AccountsPasswordRecoverMutation:n0,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:ih,usePostApiV1AccountsPasswordRecoverChangeMutation:iC,usePostApiV1AccountsPasswordChangeConfirmMutation:s0,usePostApiV1AccountsPasswordChangeRequestMutation:cC,usePutApiV1AccountsPasswordChangeResendCodeMutation:lC,usePostApiV1AccountsAuthenticateEmailMutation:o0,usePostApiV1AccountsEmailChangeRequestMutation:uC,usePostApiV1AccountsEmailChangeConfirmMutation:i0,usePostApiV1AccountsSignupMutation:ch,usePutApiV1AccountsResendEmailByHashMutation:pue,usePutApiV1AccountsEmailChangeResendCodeMutation:fC,usePostApiV1AccountsConfirmEmailMutation:c0,usePostApiV1AccountsFinishCreatingMutation:dC,usePostApiV1AccountsUserReselectUserMutation:hue,usePostApiV1AccountsCheckCaptchaMutation:pC,useGetApiV1RbacActorsByActorIdPermissionsQuery:hC}=sC;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 Fg,Wg,wl={exports:{}},ns={};
1
+ import{api as ki,handleBasicResponse as Rt,useGetApiV1SearchQuery as wA,usePutApiV1AccountsResendEmailByHashMutation as bA,usePostApiV1AccountsAddReasonMutation as vA}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.529";import{createSlice as wi,createAction as Kv,createSelector as Ma}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as Jv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as nh,getServerApiErrorCode as En}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.380";import*as yl from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import xA,{forwardRef as bi,createElement as Tp,useCallback as Sr,useMemo as Rp,useEffect as Ge,useState as Xt,useRef as Ot}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useDispatch as Ct,useSelector as Ce}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Button as vi,cn as Oe,HoverCard as zA,HoverCardTrigger as SA,HoverCardContent as EA,Switch as jA,Tooltip as Ug,TooltipTrigger as Bg,TooltipContent as $g,Avatar as TA,AvatarImage as RA,Textarea as AA,getTextareaClassName as CA,FormLabel as IA,useFormField as Xv,FormField as NA,FormItem as qA,FormControl as Lo,Input as gl,FormMessage as OA,Form as jn,ButtonLoader as Ua,useIsMobile as sh,Dialog as PA,DialogContent as DA}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.491";import{useAppsNavigate as Ar,AppsLink as Na}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.457";import{get as Ap,set as ml,appendErrors as LA,useForm as Tn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as oi,rootReducer as MA}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.528";import{EmojiPicker as UA,EmojiStyle as BA}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.380";import{useSearchParams as $A}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const GA="wlsy",Qv=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},e0=()=>{const e=new Set,t=Qv();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=`${GA}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>e0().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),i=Qv(),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",oh=Os("user"),t0=()=>oh.getItem(xi)||void 0,FA=e=>oh.setItem(xi,e),WA=()=>oh.removeItem(xi),HA=()=>!!t0(),zi={getToken:t0,setToken:FA,removeToken:WA,hasToken:HA},Gg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!zi.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=wi({name:"auth",initialState:Gg,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Gg,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}}),YA=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)},VA=e=>YA(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=>VA(t)&&t.type===e,t};we("remoteReady");const ZA=we("askLogin");we("reselectUser");const KA=we("requestLogin");we("requestLogout"),we("setConfirmLeavePage"),we("requestChangePath"),we("wsSubscribe"),we("wsUnSubscribe"),we("hostStoreConnect");const JA=we("remoteLogin"),r0=we("remoteLogout");we("wsOnMessage"),we("setRouterPath"),we("setDeviceType");const XA=we("setUserError"),QA=we("setUserIsError"),eC=we("setUserPending"),tC=we("setUserSuccess"),rC=we("setUserData"),a0=we("updateAccountData"),aC=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 nC=we("setPlatformSettings");we("setProfileSettings"),we("setGroupData"),we("setGroupLoading"),we("showGroupBasicInfo"),Kv("requestMicroFrontendFetch"),Kv("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(KA(n)),null==r||r(),t}catch(t){e(ze.actions.setPending(!1)),Jv.error(nh(t))}},sC=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,(()=>{Jv.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(a0({selectedUserId:e}))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Rt(t)}}}}),{useGetApiV1RulesQuery:oC,usePostApiV1AccountsPasswordRecoverMutation:n0,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:ih,usePostApiV1AccountsPasswordRecoverChangeMutation:iC,usePostApiV1AccountsPasswordChangeConfirmMutation:s0,usePostApiV1AccountsPasswordChangeRequestMutation:cC,usePutApiV1AccountsPasswordChangeResendCodeMutation:lC,usePostApiV1AccountsAuthenticateEmailMutation:o0,usePostApiV1AccountsEmailChangeRequestMutation:uC,usePostApiV1AccountsEmailChangeConfirmMutation:i0,usePostApiV1AccountsSignupMutation:ch,usePutApiV1AccountsResendEmailByHashMutation:pue,usePutApiV1AccountsEmailChangeResendCodeMutation:fC,usePostApiV1AccountsConfirmEmailMutation:c0,usePostApiV1AccountsFinishCreatingMutation:dC,usePostApiV1AccountsUserReselectUserMutation:hue,usePostApiV1AccountsCheckCaptchaMutation:pC,useGetApiV1RbacActorsByActorIdPermissionsQuery:hC}=sC;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 Fg,Wg,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.583",
3
+ "version": "1.0.585",
4
4
  "license": "UNLICENSED",
5
5
  "main": "index.mjs",
6
6
  "files": [