@wellesley/host-remote 1.0.252 → 1.0.254
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 +2 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{subscribeAfter as ms}from"https://cdn.jsdelivr.net/npm/@wellesley/redux-subscribe-action@1.0.154";import B_,{useRef as qr,useCallback as Ue,useEffect as Re,useState as Wu,memo as Bs}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{getStore as Vr,createStore as D_}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.409";import{api as M_,handleBasicResponse as kt}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.410";import{createSlice as U_,createAction as Ds}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as Ms}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as z_}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.261";import{useDispatch as ri,useSelector as Ae}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{routerSlice as Ie}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.338";import{useLocation as Us,useBlocker as q_,useNavigate as zs}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";import{Dialog as $_,DialogContent as V_,cn as G_,ButtonLoader as ws}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.372";import{handleLogin as K_,handleLogout as Q_}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.466";const zr="8.48.0",fe=globalThis;function Tu(t,n,e){const r=fe,i=r.__SENTRY__=r.__SENTRY__||{},o=i[zr]=i[zr]||{};return o[t]||(o[t]=n())}const qs=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,H_="Sentry Logger ",bs=["debug","info","warn","error","log","assert","trace"],Ss={};function Y_(t){if(!("console"in fe))return t();const n=fe.console,e={},r=Object.keys(Ss);r.forEach((t=>{const r=Ss[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}function J_(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return qs?bs.forEach((e=>{n[e]=(...n)=>{t&&Y_((()=>{fe.console[e](`${H_}[${e}]:`,...n)}))}})):bs.forEach((t=>{n[t]=()=>{}})),n}const Jn=Tu("logger",J_);function Nu(){return Fu(fe),fe}function Fu(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||zr,n[zr]=n[zr]||{}}const Z_=Object.prototype.toString;function X_(t,n){return Z_.call(t)===`[object ${n}]`}function tv(t){return X_(t,"Object")}function ev(t){return!(!t||!t.then||"function"!=typeof t.then)}function rv(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{qs&&Jn.log(`Failed to add non-enumerable property "${n}" to object`,t)}}const $s=1e3;function Vs(){return Date.now()/$s}function nv(){const{performance:t}=fe;if(!t||!t.now)return Vs;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/$s}const iv=nv();function cr(){const t=fe,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function uv(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),!t.did&&!n.did&&(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||iv(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:cr()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function xs(){return cr()}function As(){return cr().substring(16)}function Gs(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&n&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=Gs(r[t],n[t],e-1));return r}(()=>{const{performance:t}=fe;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,o=i<n,u=t.timing&&t.timing.navigationStart,a="number"==typeof u?Math.abs(u+e-r):n;(o||a<n)&&(i<=a&&t.timeOrigin)})();const Pu="_sentrySpan";function Is(t,n){n?rv(t,Pu,n):delete t[Pu]}function Rs(t){return t[Pu]}const ov=100;class Bu{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:xs(),spanId:As()}}clone(){const t=new Bu;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,Is(t,Rs(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&uv(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return null===n?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,[e,r]=n instanceof $r?[n.getScopeData(),n.getRequestSession()]:tv(n)?[t,t.requestSession]:[],{tags:i,extra:o,user:u,contexts:a,level:s,fingerprint:c=[],propagationContext:l}=e||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},u&&Object.keys(u).length&&(this._user=u),s&&(this._level=s),c.length&&(this._fingerprint=c),l&&(this._propagationContext=l),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Is(this,void 0),this._attachments=[],this.setPropagationContext({traceId:xs()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:ov;if(e<=0)return this;const r={timestamp:Vs(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>e?i.slice(-e):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Rs(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Gs(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:As(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,n){const e=n&&n.event_id?n.event_id:cr();if(!this._client)return Jn.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:cr();if(!this._client)return Jn.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:cr();return this._client?(this._client.captureEvent(t,{...n,event_id:e},this),e):(Jn.warn("No client configured on scope - will not capture event!"),e)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const $r=Bu;function av(){return Tu("defaultCurrentScope",(()=>new $r))}function sv(){return Tu("defaultIsolationScope",(()=>new $r))}class cv{constructor(t,n){let e,r;e=t||new $r,r=n||new $r,this._stack=[{scope:e}],this._isolationScope=r}withScope(t){const n=this._pushScope();let e;try{e=t(n)}catch(t){throw this._popScope(),t}return ev(e)?e.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function fr(){const t=Fu(Nu());return t.stack=t.stack||new cv(av(),sv())}function fv(t){return fr().withScope(t)}function lv(t,n){const e=fr();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function Es(t){return fr().withScope((()=>t(fr().getIsolationScope())))}function hv(){return{withIsolationScope:Es,withScope:fv,withSetScope:lv,withSetIsolationScope:(t,n)=>Es(n),getCurrentScope:()=>fr().getScope(),getIsolationScope:()=>fr().getIsolationScope()}}function Ks(t){const n=Fu(t);return n.acs?n.acs:hv()}function Qs(){return Ks(Nu()).getCurrentScope()}function pv(){return Ks(Nu()).getIsolationScope()}function gv(t,n){return Qs().captureException(t,void 0)}function dv(t,n){const e={captureContext:n};return Qs().captureMessage(t,void 0,e)}function _v(t,n){pv().setExtra(t,n)}var Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const vv=(...t)=>{let n="";for(const e of t){if(e instanceof Error){const t=e;return _v("exceptionMessage",n),void gv(t)}if("object"!=typeof e)n+=e;else try{n+=" "+JSON.stringify(e)}catch{n+=" "+e}}dv(n)},yv=()=>"object"!=typeof window,Os=["debug","info","warn","error"],mv=(t,n)=>{const e=Os.indexOf(t);return Os.indexOf(n)>=e},Yn=(t,n,e,...r)=>{mv(n,t)&&console.log(`[${t}] ${e}`,...r)},wv=()=>null==window?void 0:window.localStorage.getItem("logger_lvl"),bv=(t=(yv()?"info":wv()||"warn"))=>{let n=t;return{debug:(t,...e)=>Yn("debug",n,t,...e),info:(t,...e)=>Yn("info",n,t,...e),warn:(t,...e)=>Yn("warn",n,t,...e),error:(t,...e)=>(vv(t,...e),Yn("error",n,t,...e)),setLevel:t=>{n=t},getLevel:()=>n}},ni=bv(),ii="staticState",Zn={path:"",baseUrl:"",search:""},Sv=t=>{if(!t)return Zn;try{return JSON.parse(decodeURIComponent(t))||Zn}catch(t){return ni.error("Error parsing static state",t),Zn}},Hs=()=>new URLSearchParams(window.location.search).get(ii),xv=({path:t,baseUrl:n,search:e}={})=>{const{pathname:r,origin:i,search:o}=window.location;return`${ii}=${encodeURIComponent(JSON.stringify({path:t||r,baseUrl:n||i,search:e||o}))}`},Av=()=>{const t=Hs();return t&&localStorage.setItem(ii,t),Ys()},Ys=()=>{try{const t=localStorage.getItem(ii)||Hs();return Sv(t)}catch(t){return ni.error("Error parsing static state",t),Zn}},Iv={create:xv,init:Av,get:Ys},Du=({onMessage:t,whitelist:n})=>{const e=e=>{const r=e.origin!==window.location.origin,i=e.data&&"object"==typeof e.data&&"type"in e.data,o=n.some((({type:t})=>t===e.data.type||"*"===t));r&&i&&o&&t(e.data)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},Rv=t=>{try{const{type:n,payload:e}=t,r={type:n};return void 0!==e&&(r.payload=JSON.parse(JSON.stringify(e))),r}catch(n){return ni.warn(`Could not serialize action type: ${t.type}`,n),{type:t.type,payload:`[Non-serializable payload for action: ${t.type}]`}}},Mu=({action:t,windowElement:n,whitelist:e})=>{if(n)try{const{type:r}=t;if(!e.some((({type:t})=>t===r||"*"===t)))return;const i=Rv(t);n.postMessage(i,"*")}catch(t){ni.error("Failed to process or send message:",t)}},Uu="auth_token",Js=()=>localStorage.getItem(Uu)||void 0,Ev=t=>localStorage.setItem(Uu,t),Ov=()=>localStorage.removeItem(Uu),Cv=()=>!!Js(),Xn={getToken:Js,setToken:Ev,removeToken:Ov,hasToken:Cv},Cs={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!Xn.getToken(),isAuthenticated:!1},ks=U_({name:"auth",initialState:Cs,reducers:{login:(t,n)=>{t.isAuthenticated=!0,t.token=n.payload||null,t.isPending=!1},logout:()=>({...Cs,isPending:!1}),setNewEmail:(t,n)=>{t.newEmail=n.payload},setForgotPasswordStep:(t,n)=>{t.forgotPasswordStep=n.payload},updateForgotPasswordFields:(t,n)=>{t.forgotPasswordFields={...t.forgotPasswordFields,...n.payload}},resetForgotPasswordFields:t=>{t.forgotPasswordFields=null},setSignupStep:(t,n)=>{t.signupStep=n.payload},updateSignupFields:(t,n)=>{t.signupFields={...t.signupFields,...n.payload}},resetSignupFields:t=>{t.signupFields=null},setPending:(t,n)=>{t.isPending=n.payload}},selectors:{selectToken:t=>t.token,selectNewEmail:t=>t.newEmail,selectForgotPasswordStep:t=>t.forgotPasswordStep,selectForgotPasswordFields:t=>t.forgotPasswordFields,selectSignupStep:t=>t.signupStep,selectSignupFields:t=>t.signupFields,selectPending:t=>t.isPending,selectIsAuthenticated:t=>t.isAuthenticated}}),kv=t=>{if("object"!=typeof t||null===t)return!1;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n||null===Object.getPrototypeOf(t)},Pv=t=>kv(t)&&"type"in t&&"string"==typeof t.type,V=t=>{const n=n=>({type:t,payload:n});return n.toString=()=>`${t}`,n.type=t,n.match=n=>Pv(n)&&n.type===t,n},ti=V("remoteReady"),Zs=V("reselectUser"),zu=V("requestLogin"),Xs=V("requestLogout"),tc=V("setConfirmLeavePage"),qu=V("requestChangePath"),Lv=V("wsSubscribe"),jv=V("wsUnSubscribe"),ei=V("hostStoreConnect"),ec=V("remoteLogin"),rc=V("remoteLogout"),Wv=V("wsOnMessage"),nc=V("setRouterPath"),Tv=V("setDeviceType"),Nv=V("setUserError"),Fv=V("setUserIsError"),Bv=V("setUserPending"),Dv=V("setUserSuccess"),Mv=V("setUserData"),ic=V("updateAccountData"),Uv=V("updateUser"),zv=V("addNotification"),qv=V("markNotification"),$v=V("setNotificationsError"),Vv=V("setNotificationsList"),Gv=V("setNotificationsPending"),Kv=V("setNotificationsTotalCount"),Qv=V("setNotificationsUnreadCount"),Hv=V("resetNotificationsState"),Yv=V("undoNotification"),Jv=V("setInstanceInfo"),Zv=V("setInstanceInfoPending"),Xv=V("setInstanceInfoError"),t0=V("setPlatformSettings"),e0=V("setProfileSettings"),r0=V("setGroupData"),n0=V("setGroupLoading"),i0=V("showGroupBasicInfo");Ds("requestMicroFrontendFetch"),Ds("sendMicroFrontendFetchResponse");const Iu=async(t,n,e)=>{try{t(ks.actions.setPending(!0));const{data:r}=await n,i="sessionKey"in r?r.sessionKey:r.token.sessionKey;return Xn.setToken(i),t(zu(i)),null==e||e(),n}catch(n){t(ks.actions.setPending(!1)),Ms.error(z_(n))}},u0=M_.enhanceEndpoints({endpoints:{getApiV1Rules:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordRecover:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordRecoverCheckCode:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordRecoverChange:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordChangeConfirm:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},putApiV1AccountsPasswordChangeResendCode:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordChangeRequest:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},putApiV1AccountsEmailChangeResendCode:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},putApiV1AccountsResendEmailByHash:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsEmailChangeRequest:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsEmailChangeConfirm:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsConfirmEmail:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsCheckCaptcha:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsFinishCreating:{async onQueryStarted(t,{dispatch:n,queryFulfilled:e}){await Iu(n,e,(()=>{Ms.success("User registered successfully")}))}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(t,{dispatch:n,queryFulfilled:e}){await Iu(n,e)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:t},{dispatch:n,queryFulfilled:e}){await Iu(n,e),t&&n(ic({selectedUserId:t}))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}}}}),uc={[Zs.type]:t=>Vr().dispatch(u0.endpoints.postApiV1AccountsUserReselectUser.initiate(t)),[zu.type]:t=>Xn.setToken(t),[Xs.type]:()=>Xn.removeToken()},o0=t=>Object.keys(uc).includes(t.type),oc=t=>o0(t)?uc[t.type](t.payload):null,ac=({sendWhitelist:t,receiveWhitelist:n,onMessage:e})=>{const r=qr((()=>{})),i=qr((()=>{}));return Ue((o=>{o&&(r.current(),i.current(),r.current=ms((n=>{oc(n),Mu({action:n,windowElement:o,whitelist:t})})),i.current=Du({onMessage:t=>{e?e(t):Vr().dispatch(t)},whitelist:n}))}),[t,n,e,ms])},$u=[qu,Lv,jv,ti,Zs,zu,Xs,tc],Vu=[ec,rc,ei,Wv,nc,Tv,Nv,Fv,Bv,Dv,Mv,ic,Uv,zv,qv,$v,Vv,Gv,Kv,Qv,Hv,Yv,Jv,Zv,Xv,t0,e0,r0,n0,i0];if(Vu.some((t=>$u.some((n=>(null==n?void 0:n.toString())===(null==t?void 0:t.toString()))))))throw new Error("Output action is duplicated with input action");var Ps,Ur={exports:{}},a0=Ur.exports;
|
|
1
|
+
import{subscribeAfter as ms}from"https://cdn.jsdelivr.net/npm/@wellesley/redux-subscribe-action@1.0.156";import B_,{useRef as qr,useCallback as Ue,useEffect as Re,useState as Wu,memo as Bs}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{getStore as Vr,createStore as D_}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.411";import{api as M_,handleBasicResponse as kt}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.412";import{createSlice as U_,createAction as Ds}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{toast as Ms}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{getErrorMsg as z_}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.263";import{useDispatch as ri,useSelector as Ae}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{routerSlice as Ie}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.340";import{useLocation as Us,useBlocker as q_,useNavigate as zs}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";import{Dialog as $_,DialogContent as V_,cn as G_,ButtonLoader as ws}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.374";import{handleLogin as K_,handleLogout as Q_}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.468";const zr="8.48.0",fe=globalThis;function Tu(t,n,e){const r=fe,i=r.__SENTRY__=r.__SENTRY__||{},o=i[zr]=i[zr]||{};return o[t]||(o[t]=n())}const qs=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,H_="Sentry Logger ",bs=["debug","info","warn","error","log","assert","trace"],Ss={};function Y_(t){if(!("console"in fe))return t();const n=fe.console,e={},r=Object.keys(Ss);r.forEach((t=>{const r=Ss[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}function J_(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return qs?bs.forEach((e=>{n[e]=(...n)=>{t&&Y_((()=>{fe.console[e](`${H_}[${e}]:`,...n)}))}})):bs.forEach((t=>{n[t]=()=>{}})),n}const Jn=Tu("logger",J_);function Nu(){return Fu(fe),fe}function Fu(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||zr,n[zr]=n[zr]||{}}const Z_=Object.prototype.toString;function X_(t,n){return Z_.call(t)===`[object ${n}]`}function tv(t){return X_(t,"Object")}function ev(t){return!(!t||!t.then||"function"!=typeof t.then)}function rv(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{qs&&Jn.log(`Failed to add non-enumerable property "${n}" to object`,t)}}const $s=1e3;function Vs(){return Date.now()/$s}function nv(){const{performance:t}=fe;if(!t||!t.now)return Vs;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/$s}const iv=nv();function cr(){const t=fe,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function uv(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),!t.did&&!n.did&&(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||iv(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:cr()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function xs(){return cr()}function As(){return cr().substring(16)}function Gs(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&n&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=Gs(r[t],n[t],e-1));return r}(()=>{const{performance:t}=fe;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,o=i<n,u=t.timing&&t.timing.navigationStart,a="number"==typeof u?Math.abs(u+e-r):n;(o||a<n)&&(i<=a&&t.timeOrigin)})();const Pu="_sentrySpan";function Is(t,n){n?rv(t,Pu,n):delete t[Pu]}function Rs(t){return t[Pu]}const ov=100;class Bu{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:xs(),spanId:As()}}clone(){const t=new Bu;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,Is(t,Rs(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&uv(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return null===n?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,[e,r]=n instanceof $r?[n.getScopeData(),n.getRequestSession()]:tv(n)?[t,t.requestSession]:[],{tags:i,extra:o,user:u,contexts:a,level:s,fingerprint:c=[],propagationContext:l}=e||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},u&&Object.keys(u).length&&(this._user=u),s&&(this._level=s),c.length&&(this._fingerprint=c),l&&(this._propagationContext=l),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Is(this,void 0),this._attachments=[],this.setPropagationContext({traceId:xs()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:ov;if(e<=0)return this;const r={timestamp:Vs(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>e?i.slice(-e):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Rs(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Gs(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:As(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,n){const e=n&&n.event_id?n.event_id:cr();if(!this._client)return Jn.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:cr();if(!this._client)return Jn.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:cr();return this._client?(this._client.captureEvent(t,{...n,event_id:e},this),e):(Jn.warn("No client configured on scope - will not capture event!"),e)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const $r=Bu;function av(){return Tu("defaultCurrentScope",(()=>new $r))}function sv(){return Tu("defaultIsolationScope",(()=>new $r))}class cv{constructor(t,n){let e,r;e=t||new $r,r=n||new $r,this._stack=[{scope:e}],this._isolationScope=r}withScope(t){const n=this._pushScope();let e;try{e=t(n)}catch(t){throw this._popScope(),t}return ev(e)?e.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function fr(){const t=Fu(Nu());return t.stack=t.stack||new cv(av(),sv())}function fv(t){return fr().withScope(t)}function lv(t,n){const e=fr();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function Es(t){return fr().withScope((()=>t(fr().getIsolationScope())))}function hv(){return{withIsolationScope:Es,withScope:fv,withSetScope:lv,withSetIsolationScope:(t,n)=>Es(n),getCurrentScope:()=>fr().getScope(),getIsolationScope:()=>fr().getIsolationScope()}}function Ks(t){const n=Fu(t);return n.acs?n.acs:hv()}function Qs(){return Ks(Nu()).getCurrentScope()}function pv(){return Ks(Nu()).getIsolationScope()}function gv(t,n){return Qs().captureException(t,void 0)}function dv(t,n){const e={captureContext:n};return Qs().captureMessage(t,void 0,e)}function _v(t,n){pv().setExtra(t,n)}var Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const vv=(...t)=>{let n="";for(const e of t){if(e instanceof Error){const t=e;return _v("exceptionMessage",n),void gv(t)}if("object"!=typeof e)n+=e;else try{n+=" "+JSON.stringify(e)}catch{n+=" "+e}}dv(n)},yv=()=>"object"!=typeof window,Os=["debug","info","warn","error"],mv=(t,n)=>{const e=Os.indexOf(t);return Os.indexOf(n)>=e},Yn=(t,n,e,...r)=>{mv(n,t)&&console.log(`[${t}] ${e}`,...r)},wv=()=>null==window?void 0:window.localStorage.getItem("logger_lvl"),bv=(t=(yv()?"info":wv()||"warn"))=>{let n=t;return{debug:(t,...e)=>Yn("debug",n,t,...e),info:(t,...e)=>Yn("info",n,t,...e),warn:(t,...e)=>Yn("warn",n,t,...e),error:(t,...e)=>(vv(t,...e),Yn("error",n,t,...e)),setLevel:t=>{n=t},getLevel:()=>n}},ni=bv(),ii="staticState",Zn={path:"",baseUrl:"",search:""},Sv=t=>{if(!t)return Zn;try{return JSON.parse(decodeURIComponent(t))||Zn}catch(t){return ni.error("Error parsing static state",t),Zn}},Hs=()=>new URLSearchParams(window.location.search).get(ii),xv=({path:t,baseUrl:n,search:e}={})=>{const{pathname:r,origin:i,search:o}=window.location;return`${ii}=${encodeURIComponent(JSON.stringify({path:t||r,baseUrl:n||i,search:e||o}))}`},Av=()=>{const t=Hs();return t&&localStorage.setItem(ii,t),Ys()},Ys=()=>{try{const t=localStorage.getItem(ii)||Hs();return Sv(t)}catch(t){return ni.error("Error parsing static state",t),Zn}},Iv={create:xv,init:Av,get:Ys},Du=({onMessage:t,whitelist:n})=>{const e=e=>{const r=e.origin!==window.location.origin,i=e.data&&"object"==typeof e.data&&"type"in e.data,o=n.some((({type:t})=>t===e.data.type||"*"===t));r&&i&&o&&t(e.data)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},Rv=t=>{try{const{type:n,payload:e}=t,r={type:n};return void 0!==e&&(r.payload=JSON.parse(JSON.stringify(e))),r}catch(n){return ni.warn(`Could not serialize action type: ${t.type}`,n),{type:t.type,payload:`[Non-serializable payload for action: ${t.type}]`}}},Mu=({action:t,windowElement:n,whitelist:e})=>{if(n)try{const{type:r}=t;if(!e.some((({type:t})=>t===r||"*"===t)))return;const i=Rv(t);n.postMessage(i,"*")}catch(t){ni.error("Failed to process or send message:",t)}},Uu="auth_token",Js=()=>localStorage.getItem(Uu)||void 0,Ev=t=>localStorage.setItem(Uu,t),Ov=()=>localStorage.removeItem(Uu),Cv=()=>!!Js(),Xn={getToken:Js,setToken:Ev,removeToken:Ov,hasToken:Cv},Cs={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!Xn.getToken(),isAuthenticated:!1},ks=U_({name:"auth",initialState:Cs,reducers:{login:(t,n)=>{t.isAuthenticated=!0,t.token=n.payload||null,t.isPending=!1},logout:()=>({...Cs,isPending:!1}),setNewEmail:(t,n)=>{t.newEmail=n.payload},setForgotPasswordStep:(t,n)=>{t.forgotPasswordStep=n.payload},updateForgotPasswordFields:(t,n)=>{t.forgotPasswordFields={...t.forgotPasswordFields,...n.payload}},resetForgotPasswordFields:t=>{t.forgotPasswordFields=null},setSignupStep:(t,n)=>{t.signupStep=n.payload},updateSignupFields:(t,n)=>{t.signupFields={...t.signupFields,...n.payload}},resetSignupFields:t=>{t.signupFields=null},setPending:(t,n)=>{t.isPending=n.payload}},selectors:{selectToken:t=>t.token,selectNewEmail:t=>t.newEmail,selectForgotPasswordStep:t=>t.forgotPasswordStep,selectForgotPasswordFields:t=>t.forgotPasswordFields,selectSignupStep:t=>t.signupStep,selectSignupFields:t=>t.signupFields,selectPending:t=>t.isPending,selectIsAuthenticated:t=>t.isAuthenticated}}),kv=t=>{if("object"!=typeof t||null===t)return!1;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n||null===Object.getPrototypeOf(t)},Pv=t=>kv(t)&&"type"in t&&"string"==typeof t.type,V=t=>{const n=n=>({type:t,payload:n});return n.toString=()=>`${t}`,n.type=t,n.match=n=>Pv(n)&&n.type===t,n},ti=V("remoteReady"),Zs=V("reselectUser"),zu=V("requestLogin"),Xs=V("requestLogout"),tc=V("setConfirmLeavePage"),qu=V("requestChangePath"),Lv=V("wsSubscribe"),jv=V("wsUnSubscribe"),ei=V("hostStoreConnect"),ec=V("remoteLogin"),rc=V("remoteLogout"),Wv=V("wsOnMessage"),nc=V("setRouterPath"),Tv=V("setDeviceType"),Nv=V("setUserError"),Fv=V("setUserIsError"),Bv=V("setUserPending"),Dv=V("setUserSuccess"),Mv=V("setUserData"),ic=V("updateAccountData"),Uv=V("updateUser"),zv=V("addNotification"),qv=V("markNotification"),$v=V("setNotificationsError"),Vv=V("setNotificationsList"),Gv=V("setNotificationsPending"),Kv=V("setNotificationsTotalCount"),Qv=V("setNotificationsUnreadCount"),Hv=V("resetNotificationsState"),Yv=V("undoNotification"),Jv=V("setInstanceInfo"),Zv=V("setInstanceInfoPending"),Xv=V("setInstanceInfoError"),t0=V("setPlatformSettings"),e0=V("setProfileSettings"),r0=V("setGroupData"),n0=V("setGroupLoading"),i0=V("showGroupBasicInfo");Ds("requestMicroFrontendFetch"),Ds("sendMicroFrontendFetchResponse");const Iu=async(t,n,e)=>{try{t(ks.actions.setPending(!0));const{data:r}=await n,i="sessionKey"in r?r.sessionKey:r.token.sessionKey;return Xn.setToken(i),t(zu(i)),null==e||e(),n}catch(n){t(ks.actions.setPending(!1)),Ms.error(z_(n))}},u0=M_.enhanceEndpoints({endpoints:{getApiV1Rules:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordRecover:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordRecoverCheckCode:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordRecoverChange:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordChangeConfirm:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},putApiV1AccountsPasswordChangeResendCode:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsPasswordChangeRequest:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},putApiV1AccountsEmailChangeResendCode:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},putApiV1AccountsResendEmailByHash:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsEmailChangeRequest:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsEmailChangeConfirm:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsConfirmEmail:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsCheckCaptcha:{async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}},postApiV1AccountsFinishCreating:{async onQueryStarted(t,{dispatch:n,queryFulfilled:e}){await Iu(n,e,(()=>{Ms.success("User registered successfully")}))}},postApiV1AccountsAuthenticateEmail:{invalidatesTags:["Secure"],async onQueryStarted(t,{dispatch:n,queryFulfilled:e}){await Iu(n,e)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsUserReselectUser:{async onQueryStarted({userId:t},{dispatch:n,queryFulfilled:e}){await Iu(n,e),t&&n(ic({selectedUserId:t}))}},getApiV1RbacActorsByActorIdPermissions:{providesTags:["RBAC"],async onQueryStarted(t,{queryFulfilled:n}){await kt(n)}}}}),uc={[Zs.type]:t=>Vr().dispatch(u0.endpoints.postApiV1AccountsUserReselectUser.initiate(t)),[zu.type]:t=>Xn.setToken(t),[Xs.type]:()=>Xn.removeToken()},o0=t=>Object.keys(uc).includes(t.type),oc=t=>o0(t)?uc[t.type](t.payload):null,ac=({sendWhitelist:t,receiveWhitelist:n,onMessage:e})=>{const r=qr((()=>{})),i=qr((()=>{}));return Ue((o=>{o&&(r.current(),i.current(),r.current=ms((n=>{oc(n),Mu({action:n,windowElement:o,whitelist:t})})),i.current=Du({onMessage:t=>{e?e(t):Vr().dispatch(t)},whitelist:n}))}),[t,n,e,ms])},$u=[qu,Lv,jv,ti,Zs,zu,Xs,tc],Vu=[ec,rc,ei,Wv,nc,Tv,Nv,Fv,Bv,Dv,Mv,ic,Uv,zv,qv,$v,Vv,Gv,Kv,Qv,Hv,Yv,Jv,Zv,Xv,t0,e0,r0,n0,i0];if(Vu.some((t=>$u.some((n=>(null==n?void 0:n.toString())===(null==t?void 0:t.toString()))))))throw new Error("Output action is duplicated with input action");var Ps,Ur={exports:{}},a0=Ur.exports;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash <https://lodash.com/>
|
|
@@ -15,4 +15,4 @@ import{subscribeAfter as ms}from"https://cdn.jsdelivr.net/npm/@wellesley/redux-s
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/function d0(){if(Ns)return Mr;Ns=1;var t=B_,n=Symbol.for("react.element"),e=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function u(t,e,u){var a,s={},c=null,l=null;for(a in void 0!==u&&(c=""+u),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)r.call(e,a)&&!o.hasOwnProperty(a)&&(s[a]=e[a]);if(t&&t.defaultProps)for(a in e=t.defaultProps)void 0===s[a]&&(s[a]=e[a]);return{$$typeof:n,type:t,key:c,ref:l,props:s,_owner:i.current}}return Mr.Fragment=e,Mr.jsx=u,Mr.jsxs=u,Mr}function _0(){return Fs||(Fs=1,ku.exports=d0()),ku.exports}var zt=_0();const Gu=()=>{const t=Us();return t.pathname+t.search},v0=({lastLocationPathRef:t})=>{const n=ri(),e=Gu(),r=Ae(Ie.selectors.selectPath),i=Ae(Ie.selectors.selectTransitionPath);Re((()=>{e!==t.current&&(t.current=e,e!==r&&e!==i&&n(qu(e)))}),[r,i,e])},y0=(t=!1)=>{const[n,e]=Wu(t);return[n,Ue((()=>e(!0)),[]),Ue((()=>e(!1)),[]),Ue((()=>e((t=>!t))),[]),e]},m0=({open:t,modal:n,children:e,onCloseModal:r,className:i,...o})=>zt.jsx($_,{open:t,modal:n,onOpenChange:t=>{t||null==r||r()},children:zt.jsx(V_,{className:G_("max-w-[600px] rounded-lg",i),closeSize:"small",closeVariant:"insideCard",onCloseModal:r,...o,children:e})}),w0=({open:t,title:n,children:e,leftButton:r,rightButton:i,onClose:o,...u})=>zt.jsxs(m0,{open:t,onCloseModal:o,className:"gap-none max-w-[400px] rounded-lg",...u,children:[zt.jsx("h3",{className:"p-none mb-xxs text-center text-lg font-semibold text-slate-700",children:n}),e&&zt.jsx("div",{className:"text-center text-base text-slate-500",children:e}),zt.jsxs("div",{className:"mt-m max-md:gap-s md:gap-m flex justify-center",children:[zt.jsx(ws,{size:"m",variant:"secondary",className:"w-[157px] max-md:flex-1",...r,title:void 0,children:r.title}),i&&zt.jsx(ws,{size:"m",className:"w-[157px] max-md:flex-1",...i,title:void 0,children:i.title})]})]}),b0=({isOpen:t,onCancel:n,onDiscard:e})=>zt.jsx(w0,{open:t,onClose:n,title:"Discard unsaved changes?",leftButton:{title:"Cancel",variant:"secondary",onClick:n},rightButton:{title:"Discard",variant:"red_primary",onClick:e},children:"You have unsaved changes. Closing now will discard them. Do you want to continue?"}),S0=()=>y0(),x0=({canShowMessage:t,message:n="You have unsaved changes. Are you sure you want to leave?"})=>{const e=ri(),r=Ae(Ie.selectors.selectPath),i=t=>(t.preventDefault(),t.returnValue=n,n);Re((()=>(window.onbeforeunload=t?i:null,()=>{window.onbeforeunload=null})),[t,n]);const o=q_(t),u="blocked"===o.state,[a,s,c]=S0(),l=()=>{var t;null==(t=o.proceed)||t.call(o),c(),e(tc(null))},f=()=>{var t;null==(t=o.reset)||t.call(o),c(),e(qu(r))};return Re((()=>{u&&s()}),[u]),()=>zt.jsx(b0,{isOpen:a,onCancel:f,onDiscard:l})},A0=()=>{const t=ri(),n=Ae(Ie.selectors.selectPath),e=Gu();return{setPath:({transitionPath:r})=>{r&&e===r&&n!==r&&t(nc(r))}}},I0=()=>{const t=zs(),n=Us(),e=ri(),r=qr(""),i=Ae(Ie.selectors.selectPath),o=Ae(Ie.selectors.selectTransitionPath),{setPath:u}=A0(),{shouldBlock:a,message:s}=Ae(Ie.selectors.selectConfirmLeavePage)||{},c=x0({canShowMessage:!!a,message:s});return v0({lastLocationPathRef:r}),Re((()=>{u({transitionPath:o})}),[n,i,o,e]),Re((()=>{o&&o!==r.current&&(r.current=o,t(o,{replace:!1}))}),[o,t]),c},R0=Bs((()=>{const t=I0();return zt.jsx(zt.Fragment,{children:null==t?void 0:t()})}));R0.displayName="HostRouteObserver";const E0=t=>{const n=qr(t),[e,r]=Wu(null);return Re((()=>{const t=Du({onMessage:t=>{var e;if(t.type===ei.type){const i=D_(t.payload);r(i),null==(e=n.current)||e.call(n,i)}},whitelist:[ei]}),e=ti();return Mu({action:e,windowElement:window.parent,whitelist:[e]}),()=>t()}),[]),{store:e}},Lu={[ec.type]:()=>K_(),[rc.type]:()=>Q_()},O0=t=>Object.keys(Lu).includes(t.type),C0=t=>O0(t)&&t.type in Lu?Lu[t.type]():null,{path:ju,search:k0}=Iv.init();ju&&window.history.replaceState({},"",`${ju}${k0||""}`);const G0=()=>{const[t,n]=Wu(null),e=ac({sendWhitelist:$u,receiveWhitelist:Vu,onMessage:t=>{C0(t)||Vr().dispatch(t)}}),r=Ue((t=>{n(t),e(window.parent)}),[e]);return E0(r),{store:t,path:ju}},P0=()=>{const t=zs(),n=qr(""),e=Gu(),r=Ae(Ie.selectors.selectPath);Re((()=>{r&&r!==n.current&&(n.current=r,e!==r&&t(r,{replace:!0}))}),[r,t,e])},L0=Bs((()=>(P0(),null)));L0.displayName="RemoteRouteObserver";export{R0 as HostRouteObserver,L0 as RemoteRouteObserver,oc as callHostApiAction,C0 as callRemoteApiAction,Du as listenMessage,g0 as prepareState,Mu as sendMessage,Iv as staticState,V0 as useHostStoreConnect,E0 as usePreloadedStore,G0 as useRemoteStoreConnect};
|
|
18
|
+
*/function d0(){if(Ns)return Mr;Ns=1;var t=B_,n=Symbol.for("react.element"),e=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function u(t,e,u){var a,s={},c=null,l=null;for(a in void 0!==u&&(c=""+u),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)r.call(e,a)&&!o.hasOwnProperty(a)&&(s[a]=e[a]);if(t&&t.defaultProps)for(a in e=t.defaultProps)void 0===s[a]&&(s[a]=e[a]);return{$$typeof:n,type:t,key:c,ref:l,props:s,_owner:i.current}}return Mr.Fragment=e,Mr.jsx=u,Mr.jsxs=u,Mr}function _0(){return Fs||(Fs=1,ku.exports=d0()),ku.exports}var zt=_0();const Gu=()=>{const t=Us();return t.pathname+t.search},v0=({lastLocationPathRef:t})=>{const n=ri(),e=Gu(),r=Ae(Ie.selectors.selectPath),i=Ae(Ie.selectors.selectTransitionPath);Re((()=>{e!==t.current&&(t.current=e,e!==r&&e!==i&&n(qu(e)))}),[r,i,e])},y0=(t=!1)=>{const[n,e]=Wu(t);return[n,Ue((()=>e(!0)),[]),Ue((()=>e(!1)),[]),Ue((()=>e((t=>!t))),[]),e]},m0=({open:t,modal:n,children:e,onCloseModal:r,className:i,...o})=>zt.jsx($_,{open:t,modal:n,onOpenChange:t=>{t||null==r||r()},children:zt.jsx(V_,{className:G_("max-w-[600px] overflow-auto rounded-lg",o.title?"max-h-[635px]":"max-h-[700px]",i),closeSize:"small",closeVariant:"insideCard",onCloseModal:r,...o,children:e})}),w0=({open:t,title:n,children:e,leftButton:r,rightButton:i,onClose:o,...u})=>zt.jsxs(m0,{open:t,onCloseModal:o,className:"gap-none max-w-[400px] rounded-lg",...u,children:[zt.jsx("h3",{className:"p-none mb-xxs text-center text-lg font-semibold text-slate-700",children:n}),e&&zt.jsx("div",{className:"text-center text-base text-slate-500",children:e}),zt.jsxs("div",{className:"mt-m max-md:gap-s md:gap-m flex justify-center",children:[zt.jsx(ws,{size:"m",variant:"secondary",className:"w-[157px] max-md:flex-1",...r,title:void 0,children:r.title}),i&&zt.jsx(ws,{size:"m",className:"w-[157px] max-md:flex-1",...i,title:void 0,children:i.title})]})]}),b0=({isOpen:t,onCancel:n,onDiscard:e})=>zt.jsx(w0,{open:t,onClose:n,title:"Discard unsaved changes?",leftButton:{title:"Cancel",variant:"secondary",onClick:n},rightButton:{title:"Discard",variant:"red_primary",onClick:e},children:"You have unsaved changes. Closing now will discard them. Do you want to continue?"}),S0=()=>y0(),x0=({canShowMessage:t,message:n="You have unsaved changes. Are you sure you want to leave?"})=>{const e=ri(),r=Ae(Ie.selectors.selectPath),i=t=>(t.preventDefault(),t.returnValue=n,n);Re((()=>(window.onbeforeunload=t?i:null,()=>{window.onbeforeunload=null})),[t,n]);const o=q_(t),u="blocked"===o.state,[a,s,c]=S0(),l=()=>{var t;null==(t=o.proceed)||t.call(o),c(),e(tc(null))},f=()=>{var t;null==(t=o.reset)||t.call(o),c(),e(qu(r))};return Re((()=>{u&&s()}),[u]),()=>zt.jsx(b0,{isOpen:a,onCancel:f,onDiscard:l})},A0=()=>{const t=ri(),n=Ae(Ie.selectors.selectPath),e=Gu();return{setPath:({transitionPath:r})=>{r&&e===r&&n!==r&&t(nc(r))}}},I0=()=>{const t=zs(),n=Us(),e=ri(),r=qr(""),i=Ae(Ie.selectors.selectPath),o=Ae(Ie.selectors.selectTransitionPath),{setPath:u}=A0(),{shouldBlock:a,message:s}=Ae(Ie.selectors.selectConfirmLeavePage)||{},c=x0({canShowMessage:!!a,message:s});return v0({lastLocationPathRef:r}),Re((()=>{u({transitionPath:o})}),[n,i,o,e]),Re((()=>{o&&o!==r.current&&(r.current=o,t(o,{replace:!1}))}),[o,t]),c},R0=Bs((()=>{const t=I0();return zt.jsx(zt.Fragment,{children:null==t?void 0:t()})}));R0.displayName="HostRouteObserver";const E0=t=>{const n=qr(t),[e,r]=Wu(null);return Re((()=>{const t=Du({onMessage:t=>{var e;if(t.type===ei.type){const i=D_(t.payload);r(i),null==(e=n.current)||e.call(n,i)}},whitelist:[ei]}),e=ti();return Mu({action:e,windowElement:window.parent,whitelist:[e]}),()=>t()}),[]),{store:e}},Lu={[ec.type]:()=>K_(),[rc.type]:()=>Q_()},O0=t=>Object.keys(Lu).includes(t.type),C0=t=>O0(t)&&t.type in Lu?Lu[t.type]():null,{path:ju,search:k0}=Iv.init();ju&&window.history.replaceState({},"",`${ju}${k0||""}`);const G0=()=>{const[t,n]=Wu(null),e=ac({sendWhitelist:$u,receiveWhitelist:Vu,onMessage:t=>{C0(t)||Vr().dispatch(t)}}),r=Ue((t=>{n(t),e(window.parent)}),[e]);return E0(r),{store:t,path:ju}},P0=()=>{const t=zs(),n=qr(""),e=Gu(),r=Ae(Ie.selectors.selectPath);Re((()=>{r&&r!==n.current&&(n.current=r,e!==r&&t(r,{replace:!0}))}),[r,t,e])},L0=Bs((()=>(P0(),null)));L0.displayName="RemoteRouteObserver";export{R0 as HostRouteObserver,L0 as RemoteRouteObserver,oc as callHostApiAction,C0 as callRemoteApiAction,Du as listenMessage,g0 as prepareState,Mu as sendMessage,Iv as staticState,V0 as useHostStoreConnect,E0 as usePreloadedStore,G0 as useRemoteStoreConnect};
|