@wellesley/auth 1.0.648 → 1.0.650
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 gs,handleBasicResponse as Nt,useGetApiV1SearchQuery as PT,usePutApiV1AccountsResendEmailByHashMutation as kT,usePostApiV1AccountsAddReasonMutation as xT}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as gs,handleBasicResponse as Nt,useGetApiV1SearchQuery as PT,usePutApiV1AccountsResendEmailByHashMutation as kT,usePostApiV1AccountsAddReasonMutation as xT}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.594";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 $w}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as nh,getServerApiErrorCode as Tn}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.445";import*as gf from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import jT,{forwardRef as To,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 He,useDispatch as Mt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{cn as Ze,Button as As,HoverCard as TT,HoverCardTrigger as OT,HoverCardContent as HT,Switch as NT,Tooltip as Wm,TooltipTrigger as Em,TooltipContent as Sm,Avatar as DT,AvatarImage as MT,Textarea as XT,getTextareaClassName as GT,FormLabel as YT,useFormField as e9,FormField as ZT,FormItem as LT,FormControl as Ec,Input as bf,FormMessage as AT,Form as On,ButtonLoader as Wa,useIsMobile as sh,Dialog as RT,DialogContent as BT,Tabs as WT,TabsList as ET,TabsTrigger as Cm,TabsContent as Im}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.556";import{AppsLink as da,useAppsNavigate as Ur,useAppsSearchParams as ST,matchPath as CT}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.522";import{get as Mp,set as zf,appendErrors as IT,useForm as Hn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as bs,rootReducer as FT}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.593";import{EmojiPicker as QT,EmojiStyle as qT}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.445";import{useSearchParams as JT,useLocation as UT}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const KT="wlsy",t9=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},r9=()=>{const e=new Set,t=t9();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)},Rs=e=>{const t=`${KT}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>r9().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),s=t9(),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}}}},Oo="auth_token",ch=Rs("user"),a9=()=>ch.getItem(Oo)||void 0,VT=e=>ch.setItem(Oo,e),_T=()=>ch.removeItem(Oo),$T=()=>!!a9(),Bs={getToken:a9,setToken:VT,removeToken:_T,hasToken:$T},Fm={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!Bs.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=jo({name:"auth",initialState:Fm,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Fm,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}}),eO=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)},tO=e=>eO(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=>tO(t)&&t.type===e,t};xe("remoteReady");const rO=xe("askLogin");xe("reselectUser"),xe("requestLogout"),xe("setConfirmLeavePage"),xe("requestChangePath"),xe("wsSubscribe"),xe("wsUnSubscribe"),xe("hostStoreConnect");const aO=xe("remoteLogin"),n9=xe("remoteLogout");xe("wsOnMessage"),xe("setRouterPath"),xe("setDeviceType");const nO=xe("setUserError"),sO=xe("setUserIsError"),cO=xe("setUserPending"),oO=xe("setUserSuccess"),iO=xe("setUserData"),s9=xe("updateAccountData"),fO=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 lO=xe("setPlatformSettings");xe("setProfileSettings"),xe("setGroupData"),xe("setGroupLoading"),_w("requestMicroFrontendFetch"),_w("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 Bs.setToken(n),null==r||r(),t}catch(t){e(ze.actions.setPending(!1)),$w.error(nh(t))}},uO=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(s9({selectedUserId:e})),t(gs.util.invalidateTags(["UserSettings"])))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(e,{queryFulfilled:t}){await Nt(t)}}}}),{useGetApiV1RulesQuery:dO,usePostApiV1AccountsPasswordRecoverMutation:c9,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:oh,usePostApiV1AccountsPasswordRecoverChangeMutation:pO,usePostApiV1AccountsPasswordChangeConfirmMutation:o9,usePostApiV1AccountsPasswordChangeRequestMutation:hO,usePutApiV1AccountsPasswordChangeResendCodeMutation:yO,usePostApiV1AccountsAuthenticateEmailMutation:i9,usePostApiV1AccountsEmailChangeRequestMutation:vO,usePostApiV1AccountsEmailChangeConfirmMutation:f9,usePostApiV1AccountsSignupMutation:ih,usePutApiV1AccountsResendEmailByHashMutation:Cle,usePutApiV1AccountsEmailChangeResendCodeMutation:mO,usePostApiV1AccountsConfirmEmailMutation:l9,usePostApiV1AccountsFinishCreatingMutation:gO,usePostApiV1AccountsUserReselectUserMutation:Ile,usePostApiV1AccountsCheckCaptchaMutation:bO,useGetApiV1RbacActorsByActorIdPermissionsQuery:zO}=uO;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,qm,Pf={exports:{}},ns={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|