@wellesley/auth 1.0.635 → 1.0.636
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,useGetApiV1UploadsByIdQuery as kT,useGetApiV1SearchQuery as xT,usePutApiV1AccountsResendEmailByHashMutation as jT,usePostApiV1AccountsAddReasonMutation as TT}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as gs,handleBasicResponse as Nt,useGetApiV1UploadsByIdQuery as kT,useGetApiV1SearchQuery as xT,usePutApiV1AccountsResendEmailByHashMutation as jT,usePostApiV1AccountsAddReasonMutation as TT}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.580";import{createSlice as ko,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.431";import*as gf from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import OT,{forwardRef as xo,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 Te,useDispatch as Mt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{cn as Ze,Button as jo,HoverCard as HT,HoverCardTrigger as NT,HoverCardContent as DT,Switch as MT,Tooltip as Wm,TooltipTrigger as Em,TooltipContent as Sm,Avatar as XT,AvatarImage as GT,Textarea as YT,getTextareaClassName as ZT,FormLabel as LT,useFormField as e9,FormField as AT,FormItem as RT,FormControl as Wc,Input as bf,FormMessage as BT,Form as On,ButtonLoader as Wa,useIsMobile as sh,Dialog as WT,DialogContent as ET,Tabs as ST,TabsList as CT,TabsTrigger as Cm,TabsContent as Im}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.542";import{selectUploadFile as IT}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.465";import{useAppsNavigate as Ur,AppsLink as Ya,useAppsSearchParams as FT,matchPath as QT}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.508";import{get as Mp,set as zf,appendErrors as qT,useForm as Hn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as bs,rootReducer as JT}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.579";import{EmojiPicker as UT,EmojiStyle as KT}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.431";import{useSearchParams as VT,useLocation as _T}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";const $T="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)},As=e=>{const t=`${$T}${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}}}},To="auth_token",ch=As("user"),a9=()=>ch.getItem(To)||void 0,eO=e=>ch.setItem(To,e),tO=()=>ch.removeItem(To),rO=()=>!!a9(),Rs={getToken:a9,setToken:eO,removeToken:tO,hasToken:rO},Fm={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!Rs.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ze=ko({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}}),aO=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)},nO=e=>aO(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=>nO(t)&&t.type===e,t};xe("remoteReady");const sO=xe("askLogin");xe("reselectUser"),xe("requestLogout"),xe("setConfirmLeavePage"),xe("requestChangePath"),xe("wsSubscribe"),xe("wsUnSubscribe"),xe("hostStoreConnect");const cO=xe("remoteLogin"),n9=xe("remoteLogout");xe("wsOnMessage"),xe("setRouterPath"),xe("setDeviceType");const oO=xe("setUserError"),iO=xe("setUserIsError"),fO=xe("setUserPending"),lO=xe("setUserSuccess"),uO=xe("setUserData"),s9=xe("updateAccountData"),dO=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 pO=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 Rs.setToken(n),null==r||r(),t}catch(t){e(ze.actions.setPending(!1)),$w.error(nh(t))}},hO=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:yO,usePostApiV1AccountsPasswordRecoverMutation:c9,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:oh,usePostApiV1AccountsPasswordRecoverChangeMutation:vO,usePostApiV1AccountsPasswordChangeConfirmMutation:o9,usePostApiV1AccountsPasswordChangeRequestMutation:mO,usePutApiV1AccountsPasswordChangeResendCodeMutation:gO,usePostApiV1AccountsAuthenticateEmailMutation:i9,usePostApiV1AccountsEmailChangeRequestMutation:bO,usePostApiV1AccountsEmailChangeConfirmMutation:f9,usePostApiV1AccountsSignupMutation:ih,usePutApiV1AccountsResendEmailByHashMutation:Jle,usePutApiV1AccountsEmailChangeResendCodeMutation:zO,usePostApiV1AccountsConfirmEmailMutation:l9,usePostApiV1AccountsFinishCreatingMutation:wO,usePostApiV1AccountsUserReselectUserMutation:Ule,usePostApiV1AccountsCheckCaptchaMutation:PO,useGetApiV1RbacActorsByActorIdPermissionsQuery:kO}=hO;var la=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oo(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
|