dinocollab-core 2.0.13 → 2.1.0
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/package.json +1 -15
- package/dist/mfe-shared/auth.debug.js +0 -2
- package/dist/mfe-shared/auth.debug.js.map +0 -1
- package/dist/mfe-shared/auth.js +0 -2
- package/dist/mfe-shared/auth.js.map +0 -1
- package/dist/mfe-shared/auth.ssr.js +0 -2
- package/dist/mfe-shared/auth.ssr.js.map +0 -1
- package/dist/mfe-shared/auth.types.js +0 -2
- package/dist/mfe-shared/auth.types.js.map +0 -1
- package/dist/mfe-shared/environment.js +0 -2
- package/dist/mfe-shared/environment.js.map +0 -1
- package/dist/mfe-shared/hydration-helper.js +0 -2
- package/dist/mfe-shared/hydration-helper.js.map +0 -1
- package/dist/mfe-shared/index.js +0 -2
- package/dist/mfe-shared/index.js.map +0 -1
- package/dist/mfe-shared/mfe-bridge.js +0 -2
- package/dist/mfe-shared/mfe-bridge.js.map +0 -1
- package/dist/mfe-shared/navigation.debug.js +0 -2
- package/dist/mfe-shared/navigation.debug.js.map +0 -1
- package/dist/mfe-shared/navigation.js +0 -2
- package/dist/mfe-shared/navigation.js.map +0 -1
- package/dist/mfe-shared.d.ts +0 -2
- package/dist/mfe-shared.js +0 -2
- package/dist/mfe-shared.mjs +0 -2
- package/dist/types/mfe-shared/auth.d.ts +0 -50
- package/dist/types/mfe-shared/auth.debug.d.ts +0 -8
- package/dist/types/mfe-shared/auth.ssr.d.ts +0 -53
- package/dist/types/mfe-shared/auth.types.d.ts +0 -53
- package/dist/types/mfe-shared/environment.d.ts +0 -18
- package/dist/types/mfe-shared/hydration-helper.d.ts +0 -46
- package/dist/types/mfe-shared/index.d.ts +0 -21
- package/dist/types/mfe-shared/mfe-bridge.d.ts +0 -46
- package/dist/types/mfe-shared/navigation.d.ts +0 -31
- package/dist/types/mfe-shared/navigation.debug.d.ts +0 -4
- package/dist/types/mfe-shared/types.d.ts +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dinocollab-core",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -60,12 +60,6 @@
|
|
|
60
60
|
"./http-service": [
|
|
61
61
|
"./dist/types/http-service/index.d.ts"
|
|
62
62
|
],
|
|
63
|
-
"mfe-shared": [
|
|
64
|
-
"./dist/mfe-shared.d.ts"
|
|
65
|
-
],
|
|
66
|
-
"./mfe-shared": [
|
|
67
|
-
"./dist/types/mfe-shared/index.d.ts"
|
|
68
|
-
],
|
|
69
63
|
"redux": [
|
|
70
64
|
"./dist/redux.d.ts"
|
|
71
65
|
],
|
|
@@ -146,14 +140,6 @@
|
|
|
146
140
|
"./http-service.js": "./dist/http-service.js",
|
|
147
141
|
"./http-service.mjs": "./dist/http-service.mjs",
|
|
148
142
|
"./http-service.d.ts": "./dist/http-service.d.ts",
|
|
149
|
-
"./mfe-shared": {
|
|
150
|
-
"import": "./dist/mfe-shared/index.js",
|
|
151
|
-
"require": "./dist/mfe-shared/index.js",
|
|
152
|
-
"types": "./dist/types/mfe-shared/index.d.ts"
|
|
153
|
-
},
|
|
154
|
-
"./mfe-shared.js": "./dist/mfe-shared.js",
|
|
155
|
-
"./mfe-shared.mjs": "./dist/mfe-shared.mjs",
|
|
156
|
-
"./mfe-shared.d.ts": "./dist/mfe-shared.d.ts",
|
|
157
143
|
"./redux": {
|
|
158
144
|
"import": "./dist/redux/index.js",
|
|
159
145
|
"require": "./dist/redux/index.js",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{slicedToArray as t,objectSpread2 as e,toConsumableArray as r,defineProperty as o}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as i,jsx as n}from"react/jsx-runtime";import{useState as a,useEffect as l}from"react";import{AUTH_CHANNELS as c}from"./auth.types.js";var d=function(d){var s=a({}),p=t(s,2),f=p[0],m=p[1],u=d.channelPrefix||"mfe:auth:";l((function(){var t=Object.values(c),i=function(i){var n=i,a=n.type;if(t.includes(a)){var l=Date.now(),c=n.detail;m((function(t){var i=t[a]||{channel:a,history:[]},n=[{channel:a,payload:c,timestamp:l}].concat(r(i.history.slice(0,9)));return e(e({},t),{},o({},a,e(e({},i),{},{history:n})))}))}};return t.forEach((function(t){window.addEventListener(t,i)})),function(){t.forEach((function(t){window.removeEventListener(t,i)}))}}),[u]);var h=e({position:"fixed",top:"10px",right:"10px",background:"rgba(0, 0, 0, 0.9)",color:"#fff",padding:"12px",borderRadius:"8px",fontSize:"12px",fontFamily:"monospace",zIndex:9999,maxWidth:"400px",maxHeight:"500px",overflow:"auto",border:"2px solid #4CAF50"},d.style);return i("div",{style:h,children:[n("h4",{style:{margin:"0 0 10px 0",color:"#4CAF50"},children:d.title||"MFE Auth Debug Panel"}),0===Object.keys(f).length?n("div",{style:{color:"#888"},children:"No auth events yet..."}):Object.entries(f).map((function(e){var r=t(e,2),o=r[0],a=r[1];return i("div",{style:{marginBottom:"15px"},children:[n("div",{style:{fontWeight:"bold",color:"#FFD700",marginBottom:"5px"},children:o.replace(u,"")}),a.history.map((function(t,e){return i("div",{style:{marginBottom:"5px",paddingLeft:"10px",borderLeft:"2px solid #555",fontSize:"11px"},children:[n("div",{style:{color:"#888"},children:new Date(t.timestamp).toLocaleTimeString()}),n("div",{style:{color:"#fff"},children:JSON.stringify(t.payload,null,2)})]},"".concat(t.timestamp,"-").concat(e))}))]},o)}))]})};export{d as MfeAuthDebugPanel};
|
|
2
|
-
//# sourceMappingURL=auth.debug.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.debug.js","sources":["../../src/mfe-shared/auth.debug.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { AUTH_CHANNELS } from './auth.types'\r\n\r\ninterface IEventHistoryEntry {\r\n channel: string\r\n payload: any\r\n timestamp: number\r\n}\r\n\r\ninterface IEventDebugData {\r\n channel: string\r\n history: IEventHistoryEntry[]\r\n}\r\n\r\ninterface IDebugPanelProps {\r\n title?: string\r\n style?: React.CSSProperties\r\n channelPrefix?: string\r\n}\r\n\r\nexport const MfeAuthDebugPanel: React.FC<IDebugPanelProps> = (props) => {\r\n const [events, setEvents] = useState<Record<string, IEventDebugData>>({})\r\n const channelPrefix = props.channelPrefix || 'mfe:auth:'\r\n\r\n useEffect(() => {\r\n const authChannels = Object.values(AUTH_CHANNELS)\r\n\r\n const handleEvent = (e: Event) => {\r\n const customEvent = e as CustomEvent\r\n const channel = customEvent.type\r\n\r\n if (!authChannels.includes(channel)) return\r\n\r\n const timestamp = Date.now()\r\n const payload = customEvent.detail\r\n\r\n setEvents((prev) => {\r\n const existing = prev[channel] || { channel, history: [] }\r\n const newHistory = [\r\n { channel, payload, timestamp },\r\n ...existing.history.slice(0, 9) // Keep last 10 events\r\n ]\r\n\r\n return {\r\n ...prev,\r\n [channel]: {\r\n ...existing,\r\n history: newHistory\r\n }\r\n }\r\n })\r\n }\r\n\r\n // Listen to all auth channels\r\n authChannels.forEach((channel) => {\r\n window.addEventListener(channel, handleEvent)\r\n })\r\n\r\n return () => {\r\n authChannels.forEach((channel) => {\r\n window.removeEventListener(channel, handleEvent)\r\n })\r\n }\r\n }, [channelPrefix])\r\n\r\n const panelStyle: React.CSSProperties = {\r\n position: 'fixed',\r\n top: '10px',\r\n right: '10px',\r\n background: 'rgba(0, 0, 0, 0.9)',\r\n color: '#fff',\r\n padding: '12px',\r\n borderRadius: '8px',\r\n fontSize: '12px',\r\n fontFamily: 'monospace',\r\n zIndex: 9999,\r\n maxWidth: '400px',\r\n maxHeight: '500px',\r\n overflow: 'auto',\r\n border: '2px solid #4CAF50',\r\n ...props.style\r\n }\r\n\r\n return (\r\n <div style={panelStyle}>\r\n <h4 style={{ margin: '0 0 10px 0', color: '#4CAF50' }}>\r\n {props.title || 'MFE Auth Debug Panel'}\r\n </h4>\r\n \r\n {Object.keys(events).length === 0 ? (\r\n <div style={{ color: '#888' }}>No auth events yet...</div>\r\n ) : (\r\n Object.entries(events).map(([channel, data]) => (\r\n <div key={channel} style={{ marginBottom: '15px' }}>\r\n <div style={{ fontWeight: 'bold', color: '#FFD700', marginBottom: '5px' }}>\r\n {channel.replace(channelPrefix, '')}\r\n </div>\r\n \r\n {data.history.map((event, index) => (\r\n <div\r\n key={`${event.timestamp}-${index}`}\r\n style={{\r\n marginBottom: '5px',\r\n paddingLeft: '10px',\r\n borderLeft: '2px solid #555',\r\n fontSize: '11px'\r\n }}\r\n >\r\n <div style={{ color: '#888' }}>\r\n {new Date(event.timestamp).toLocaleTimeString()}\r\n </div>\r\n <div style={{ color: '#fff' }}>\r\n {JSON.stringify(event.payload, null, 2)}\r\n </div>\r\n </div>\r\n ))}\r\n </div>\r\n ))\r\n )}\r\n </div>\r\n )\r\n}\r\n"],"names":["MfeAuthDebugPanel","props","_useState","useState","_useState2","_slicedToArray","events","setEvents","channelPrefix","useEffect","authChannels","Object","values","AUTH_CHANNELS","handleEvent","e","customEvent","channel","type","includes","timestamp","Date","now","payload","detail","prev","existing","history","newHistory","concat","_toConsumableArray","slice","_objectSpread","_defineProperty","forEach","window","addEventListener","removeEventListener","panelStyle","position","top","right","background","color","padding","borderRadius","fontSize","fontFamily","zIndex","maxWidth","maxHeight","overflow","border","style","_jsxs","children","_jsx","margin","title","keys","length","entries","map","_ref","_ref2","data","marginBottom","fontWeight","replace","event","index","paddingLeft","borderLeft","toLocaleTimeString","JSON","stringify"],"mappings":"6RAoBaA,EAAgD,SAACC,GAC5D,IAAAC,EAA4BC,EAA0C,IAAGC,EAAAC,EAAAH,EAAA,GAAlEI,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAClBI,EAAgBP,EAAMO,eAAiB,YAE7CC,GAAU,WACR,IAAMC,EAAeC,OAAOC,OAAOC,GAE7BC,EAAc,SAACC,GACnB,IAAMC,EAAcD,EACdE,EAAUD,EAAYE,KAE5B,GAAKR,EAAaS,SAASF,GAA3B,CAEA,IAAMG,EAAYC,KAAKC,MACjBC,EAAUP,EAAYQ,OAE5BjB,GAAU,SAACkB,GACT,IAAMC,EAAWD,EAAKR,IAAY,CAAEA,QAAAA,EAASU,QAAS,IAChDC,EACJ,CAAA,CAAEX,QAAAA,EAASM,QAAAA,EAASH,UAAAA,IAAWS,OAAAC,EAC5BJ,EAASC,QAAQI,MAAM,EAAG,KAG/B,OAAAC,EAAAA,EAAA,CAAA,EACKP,GAAIQ,CAAAA,EAAAA,EACNhB,CAAAA,EAAAA,EAAOe,EAAAA,KACHN,GAAQ,CAAA,EAAA,CACXC,QAASC,KAGf,GAnBqC,CAoBtC,EAOD,OAJAlB,EAAawB,SAAQ,SAACjB,GACpBkB,OAAOC,iBAAiBnB,EAASH,EACnC,IAEO,WACLJ,EAAawB,SAAQ,SAACjB,GACpBkB,OAAOE,oBAAoBpB,EAASH,EACtC,GACD,CACH,GAAG,CAACN,IAEJ,IAAM8B,EAAUN,EAAA,CACdO,SAAU,QACVC,IAAK,OACLC,MAAO,OACPC,WAAY,qBACZC,MAAO,OACPC,QAAS,OACTC,aAAc,MACdC,SAAU,OACVC,WAAY,YACZC,OAAQ,KACRC,SAAU,QACVC,UAAW,QACXC,SAAU,OACVC,OAAQ,qBACLnD,EAAMoD,OAGX,OACEC,EAAA,MAAA,CAAKD,MAAOf,EAAUiB,SAAA,CACpBC,EAAI,KAAA,CAAAH,MAAO,CAAEI,OAAQ,aAAcd,MAAO,WACvCY,SAAAtD,EAAMyD,OAAS,yBAGc,IAA/B/C,OAAOgD,KAAKrD,GAAQsD,OACnBJ,EAAK,MAAA,CAAAH,MAAO,CAAEV,MAAO,QAAqCY,SAAA,0BAE1D5C,OAAOkD,QAAQvD,GAAQwD,KAAI,SAAAC,GAAA,IAAAC,EAAA3D,EAAA0D,EAAA,GAAE9C,EAAO+C,EAAA,GAAEC,EAAID,EAAA,GAAA,OACxCV,EAAA,MAAA,CAAmBD,MAAO,CAAEa,aAAc,QAAQX,SAAA,CAChDC,EAAK,MAAA,CAAAH,MAAO,CAAEc,WAAY,OAAQxB,MAAO,UAAWuB,aAAc,OAC/DX,SAAAtC,EAAQmD,QAAQ5D,EAAe,MAGjCyD,EAAKtC,QAAQmC,KAAI,SAACO,EAAOC,GAAK,OAC7BhB,EAAA,MAAA,CAEED,MAAO,CACLa,aAAc,MACdK,YAAa,OACbC,WAAY,iBACZ1B,SAAU,QACXS,SAAA,CAEDC,EAAK,MAAA,CAAAH,MAAO,CAAEV,MAAO,QAClBY,SAAA,IAAIlC,KAAKgD,EAAMjD,WAAWqD,uBAE7BjB,EAAA,MAAA,CAAKH,MAAO,CAAEV,MAAO,QAClBY,SAAAmB,KAAKC,UAAUN,EAAM9C,QAAS,KAAM,OAZlC,GAAAM,OAAGwC,EAAMjD,UAAS,KAAAS,OAAIyC,GAcvB,MArBArD,EAuBJ,MAKhB"}
|
package/dist/mfe-shared/auth.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{slicedToArray as r,asyncToGenerator as n,objectSpread2 as e,regenerator as i}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as o,Fragment as a}from"react/jsx-runtime";import{useState as t,useEffect as u}from"react";import{mfeBridge as s}from"./mfe-bridge.js";import{INITIAL_AUTH_STATE as l,AUTH_CHANNELS as c}from"./auth.types.js";import{isBrowser as d}from"./environment.js";var f=function(f){var p=f.children,h=f.onLogin,v=f.onLogout,b=f.initialState,m=void 0===b?l:b,g=f.authData,A=f.onAuthChange,E=t(m),T=r(E,2),L=T[0],w=T[1];u((function(){if(g){var r=null;(g.id||g.displayName)&&(r={id:g.id||"unknown",displayName:g.displayName||"Unknown User",email:g.email||"",roles:g.roles||[],avatar:g.avatar});var n={isAuthenticated:!!g.id||!!g.displayName,isLoading:!1,user:r,error:null,serverRendered:!d()};w(n),s.publish(c.STATE_CHANGE,n)}}),[g]),u((function(){if(A)return A((function(r){w(r),s.publish(c.STATE_CHANGE,r)}))}),[A]),u((function(){var r=s.subscribe(c.REQUEST_STATE,(function(){s.publish(c.STATE_CHANGE,L)})),n=s.subscribe(c.LOGIN,(function(r){N(r.username,r.password)})),e=s.subscribe(c.LOGOUT,(function(){S()}));return function(){r(),n(),e()}}),[L]);var N=function(){var r=n(i().m((function r(n,o){var a,t,u,l,f;return i().w((function(r){for(;;)switch(r.n){case 0:if(w((function(r){return e(e({},r),{},{isLoading:!0,error:null})})),r.p=1,!h){r.n=3;break}return r.n=2,h({username:n,password:o});case 2:(a=r.v)?(t={isAuthenticated:a.isAuthenticated,isLoading:!1,user:a.user||null,error:a.error||null,serverRendered:!d()},w(t),s.publish(c.STATE_CHANGE,t)):w((function(r){return e(e({},r),{},{isLoading:!1})})),r.n=4;break;case 3:throw new Error("No login handler provided. Please provide an onLogin handler to AuthProvider.");case 4:r.n=6;break;case 5:r.p=5,f=r.v,u=f instanceof Error?f.message:"Login failed",l={isAuthenticated:!1,isLoading:!1,user:null,error:u,serverRendered:!d()},w(l),s.publish(c.STATE_CHANGE,l);case 6:return r.a(2)}}),r,null,[[1,5]])})));return function(n,e){return r.apply(this,arguments)}}(),S=function(){var r=n(i().m((function r(){var n,o,a;return i().w((function(r){for(;;)switch(r.n){case 0:if(w((function(r){return e(e({},r),{},{isLoading:!0})})),r.p=1,!v){r.n=5;break}return r.n=2,v();case 2:if(!1===r.v){r.n=3;break}n={isAuthenticated:!1,isLoading:!1,user:null,error:null,serverRendered:!d()},w(n),s.publish(c.STATE_CHANGE,n),r.n=4;break;case 3:throw new Error("Logout failed");case 4:r.n=6;break;case 5:throw new Error("No logout handler provided. Please provide an onLogout handler to AuthProvider.");case 6:r.n=8;break;case 7:r.p=7,a=r.v,o=a instanceof Error?a.message:"Logout failed",w((function(r){return e(e({},r),{},{isLoading:!1,error:o})}));case 8:return r.a(2)}}),r,null,[[1,7]])})));return function(){return r.apply(this,arguments)}}();return o(a,{children:p})};function p(){var n=t(l),i=r(n,2),o=i[0],a=i[1];u((function(){var r=s.subscribe(c.STATE_CHANGE,(function(r){a(r)}));return s.publish(c.REQUEST_STATE,null),r}),[]);return e(e({},o),{},{login:function(r,n){s.publish(c.LOGIN,{username:r,password:n})},logout:function(){s.publish(c.LOGOUT,null)}})}export{f as MfeAuthProvider,p as useMfeAuth};
|
|
2
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["../../src/mfe-shared/auth.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { mfeBridge } from './mfe-bridge'\r\nimport { AUTH_CHANNELS, IAuthState, INITIAL_AUTH_STATE, IUser } from './auth.types'\r\nimport { isBrowser } from './environment'\r\n\r\n/**\r\n * Login parameters structure\r\n */\r\nexport interface ILoginParams {\r\n username: string\r\n password: string\r\n}\r\n\r\n/**\r\n * Login response structure\r\n */\r\nexport interface ILoginResponse {\r\n isAuthenticated: boolean\r\n user?: IUser\r\n error?: string\r\n}\r\n\r\nexport interface IMfeAuthProviderProps {\r\n children?: React.ReactNode\r\n\r\n // Custom handlers for manual authentication\r\n // onLogin can simply trigger authentication (like opening a login modal) without returning immediate data\r\n onLogin?: (params: ILoginParams) => Promise<ILoginResponse | void>\r\n onLogout?: () => Promise<boolean | void>\r\n\r\n // Initial state\r\n initialState?: IAuthState\r\n\r\n // Direct auth data - allows updating state directly from external sources\r\n // Main approach for real-world applications with their own authentication services\r\n authData?: {\r\n id?: string\r\n displayName?: string\r\n email?: string\r\n avatar?: string\r\n roles?: string[]\r\n [key: string]: any // Allow custom fields\r\n }\r\n\r\n // Auth state subscription\r\n // Allows registering callbacks to receive notifications when auth state changes from external services\r\n onAuthChange?: (callback: (newState: IAuthState) => void) => () => void\r\n}\r\n\r\n/**\r\n * AuthProvider - Component for Host application\r\n *\r\n * Manages authentication state and broadcasts events to MFEs.\r\n * Place this component anywhere in your application, no need to wrap other components.\r\n *\r\n * Host can customize login/logout behavior by providing custom handlers.\r\n */\r\nexport const MfeAuthProvider: React.FC<IMfeAuthProviderProps> = ({\r\n children,\r\n onLogin,\r\n onLogout,\r\n initialState = INITIAL_AUTH_STATE,\r\n authData,\r\n onAuthChange\r\n}) => {\r\n // Authentication state\r\n const [authState, setAuthState] = useState<IAuthState>(initialState)\r\n\r\n // Handle when authData is provided directly and changes\r\n useEffect(() => {\r\n if (authData) {\r\n // Convert from authData to AuthState\r\n\r\n let user: IUser | null = null\r\n if (authData.id || authData.displayName) {\r\n user = {\r\n id: authData.id || 'unknown',\r\n displayName: authData.displayName || 'Unknown User',\r\n email: authData.email || '',\r\n roles: authData.roles || [],\r\n avatar: authData.avatar\r\n }\r\n }\r\n const isAuthenticated = !!authData.id || !!authData.displayName\r\n const newState: IAuthState = {\r\n isAuthenticated,\r\n isLoading: false,\r\n user,\r\n error: null,\r\n // Mark if running in SSR environment\r\n serverRendered: !isBrowser()\r\n }\r\n // Update state and notify MFEs\r\n setAuthState(newState)\r\n mfeBridge.publish(AUTH_CHANNELS.STATE_CHANGE, newState)\r\n }\r\n }, [authData]) // Re-run when authData changes\r\n\r\n // Register with onAuthChange if provided\r\n useEffect(() => {\r\n if (onAuthChange) {\r\n // Register callback to receive notifications when auth changes from external service\r\n const unsubscribe = onAuthChange((newState) => {\r\n setAuthState(newState)\r\n mfeBridge.publish(AUTH_CHANNELS.STATE_CHANGE, newState)\r\n })\r\n\r\n return unsubscribe\r\n }\r\n }, [onAuthChange])\r\n\r\n useEffect(() => {\r\n // Listen for requests from MFEs\r\n const unsubscribeRequestState = mfeBridge.subscribe(AUTH_CHANNELS.REQUEST_STATE, () => {\r\n // Send current state when requested by an MFE\r\n mfeBridge.publish(AUTH_CHANNELS.STATE_CHANGE, authState)\r\n })\r\n\r\n const unsubscribeLogin = mfeBridge.subscribe(AUTH_CHANNELS.LOGIN, (credentials) => {\r\n handleLogin(credentials.username, credentials.password)\r\n })\r\n\r\n const unsubscribeLogout = mfeBridge.subscribe(AUTH_CHANNELS.LOGOUT, () => {\r\n handleLogout()\r\n })\r\n\r\n return () => {\r\n unsubscribeRequestState()\r\n unsubscribeLogin()\r\n unsubscribeLogout()\r\n }\r\n }, [authState])\r\n\r\n // Login handler - uses onLogin from props if provided\r\n const handleLogin = async (username: string, password: string) => {\r\n setAuthState((prev) => ({ ...prev, isLoading: true, error: null }))\r\n\r\n try {\r\n // Use provided login handler if available\r\n if (onLogin) {\r\n const result = await onLogin({ username, password })\r\n\r\n // If onLogin returns login response data, use it to update state\r\n if (result) {\r\n const newState: IAuthState = {\r\n isAuthenticated: result.isAuthenticated,\r\n isLoading: false,\r\n user: result.user || null,\r\n error: result.error || null,\r\n serverRendered: !isBrowser()\r\n }\r\n\r\n setAuthState(newState)\r\n mfeBridge.publish(AUTH_CHANNELS.STATE_CHANGE, newState)\r\n } else {\r\n // If onLogin doesn't return data, just set loading to false\r\n // This allows the host app to handle the auth flow completely\r\n setAuthState((prev) => ({ ...prev, isLoading: false }))\r\n }\r\n } else {\r\n // No default handling in library mode\r\n throw new Error('No login handler provided. Please provide an onLogin handler to AuthProvider.')\r\n }\r\n } catch (error) {\r\n const message = error instanceof Error ? error.message : 'Login failed'\r\n const errorState: IAuthState = {\r\n isAuthenticated: false,\r\n isLoading: false,\r\n user: null,\r\n error: message,\r\n serverRendered: !isBrowser()\r\n }\r\n setAuthState(errorState)\r\n mfeBridge.publish(AUTH_CHANNELS.STATE_CHANGE, errorState)\r\n }\r\n }\r\n\r\n // Logout handler - uses onLogout from props if provided\r\n const handleLogout = async () => {\r\n setAuthState((prev) => ({ ...prev, isLoading: true }))\r\n\r\n try {\r\n // Use provided logout handler if available\r\n if (onLogout) {\r\n const result = await onLogout()\r\n\r\n // If onLogout returns a boolean, use it to determine success\r\n // If it returns nothing (void), assume success\r\n if (result !== false) {\r\n const newState: IAuthState = {\r\n isAuthenticated: false,\r\n isLoading: false,\r\n user: null,\r\n error: null,\r\n serverRendered: !isBrowser()\r\n }\r\n setAuthState(newState)\r\n mfeBridge.publish(AUTH_CHANNELS.STATE_CHANGE, newState)\r\n } else {\r\n throw new Error('Logout failed')\r\n }\r\n } else {\r\n // No default handling in library mode\r\n throw new Error('No logout handler provided. Please provide an onLogout handler to AuthProvider.')\r\n }\r\n } catch (error) {\r\n const message = error instanceof Error ? error.message : 'Logout failed'\r\n setAuthState((prev) => ({ ...prev, isLoading: false, error: message }))\r\n }\r\n }\r\n\r\n // Simply return children\r\n return <>{children}</>\r\n}\r\n\r\n// Hook for using micro-frontend Auth in both host and MFE\r\nexport function useMfeAuth() {\r\n const [authState, setAuthState] = useState<IAuthState>(INITIAL_AUTH_STATE)\r\n\r\n useEffect(() => {\r\n // Subscribe to authentication state changes from provider\r\n const unsubscribe = mfeBridge.subscribe<IAuthState>(AUTH_CHANNELS.STATE_CHANGE, (newState) => {\r\n setAuthState(newState)\r\n })\r\n\r\n // Request current state\r\n mfeBridge.publish(AUTH_CHANNELS.REQUEST_STATE, null)\r\n\r\n return unsubscribe\r\n }, [])\r\n\r\n // Functions always use mfeBridge for communication\r\n const login = (username: string, password: string) => {\r\n mfeBridge.publish(AUTH_CHANNELS.LOGIN, { username, password })\r\n }\r\n\r\n const logout = () => {\r\n mfeBridge.publish(AUTH_CHANNELS.LOGOUT, null)\r\n }\r\n\r\n return { ...authState, login, logout }\r\n}\r\n"],"names":["MfeAuthProvider","_ref","children","onLogin","onLogout","_ref$initialState","initialState","INITIAL_AUTH_STATE","authData","onAuthChange","_useState","useState","_useState2","_slicedToArray","authState","setAuthState","useEffect","user","id","displayName","email","roles","avatar","newState","isAuthenticated","isLoading","error","serverRendered","isBrowser","mfeBridge","publish","AUTH_CHANNELS","STATE_CHANGE","unsubscribeRequestState","subscribe","REQUEST_STATE","unsubscribeLogin","LOGIN","credentials","handleLogin","username","password","unsubscribeLogout","LOGOUT","handleLogout","_ref2","_asyncToGenerator","_regenerator","m","_callee","result","message","errorState","_t","w","_context","n","prev","_objectSpread","p","v","Error","a","_x","_x2","apply","this","arguments","_ref3","_callee2","_t2","_context2","_jsx","_Fragment","useMfeAuth","_useState3","_useState4","unsubscribe","login","logout"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{objectSpread2 as r}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as t}from"react/jsx-runtime";import{INITIAL_AUTH_STATE as e}from"./auth.types.js";import{MfeAuthProvider as o}from"./auth.js";import{HydrationGuard as a}from"./hydration-helper.js";var n=function(n){var i=n.children,u=n.initialAuthState,h=n.userData,l=n.authData,s=n.onLogin,d=n.onLogout,m=n.onAuthChange,p=u;return!p&&h&&(p={isAuthenticated:!0,isLoading:!1,user:h,error:null,serverRendered:!0}),t(o,{initialState:p||r(r({},e),{},{serverRendered:!0}),authData:l,onLogin:s,onLogout:d,onAuthChange:m,children:t(a,{children:i})})};export{n as SsrAuthProvider};
|
|
2
|
-
//# sourceMappingURL=auth.ssr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.ssr.js","sources":["../../src/mfe-shared/auth.ssr.tsx"],"sourcesContent":["import React from 'react'\r\nimport { IAuthState, INITIAL_AUTH_STATE, IUser } from './auth.types'\r\nimport { MfeAuthProvider, type IMfeAuthProviderProps } from './auth'\r\nimport { HydrationGuard } from './hydration-helper'\r\n\r\n/**\r\n * Props for the SSR-compatible auth provider\r\n */\r\ninterface ISsrAuthProviderProps {\r\n /** Content to render */\r\n children: React.ReactNode\r\n /** Initial auth state for SSR */\r\n initialAuthState?: IAuthState\r\n /** User data for initial state */\r\n userData?: IUser\r\n /** Custom auth data to be passed to AuthProvider */\r\n authData?: {\r\n id?: string\r\n displayName?: string\r\n email?: string\r\n avatar?: string\r\n roles?: string[]\r\n [key: string]: any\r\n }\r\n /** Custom login handler */\r\n onLogin?: IMfeAuthProviderProps['onLogin']\r\n /** Custom logout handler */\r\n onLogout?: IMfeAuthProviderProps['onLogout']\r\n /** Auth state change subscription */\r\n onAuthChange?: IMfeAuthProviderProps['onAuthChange']\r\n}\r\n\r\n/**\r\n * Auth provider component that supports SSR\r\n * \r\n * This component allows providing initial auth data during server-side rendering\r\n * and then hydrating from API or other sources once client-side.\r\n */\r\nexport const SsrAuthProvider: React.FC<ISsrAuthProviderProps> = ({\r\n children,\r\n initialAuthState,\r\n userData,\r\n authData,\r\n onLogin,\r\n onLogout,\r\n onAuthChange\r\n}) => {\r\n // Prepare auth state for SSR\r\n let ssrAuthState = initialAuthState\r\n \r\n // If userData is provided but not initialAuthState, create auth state from userData\r\n if (!ssrAuthState && userData) {\r\n ssrAuthState = {\r\n isAuthenticated: true,\r\n isLoading: false,\r\n user: userData,\r\n error: null,\r\n serverRendered: true\r\n }\r\n }\r\n\r\n return (\r\n <MfeAuthProvider\r\n initialState={ssrAuthState || { ...INITIAL_AUTH_STATE, serverRendered: true }}\r\n authData={authData}\r\n onLogin={onLogin}\r\n onLogout={onLogout}\r\n onAuthChange={onAuthChange}\r\n >\r\n <HydrationGuard>\r\n {children}\r\n </HydrationGuard>\r\n </MfeAuthProvider>\r\n )\r\n}\r\n\r\n/**\r\n * Props for the SSR-compatible authenticated content component\r\n */\r\ninterface IAuthenticatedContentProps {\r\n /** Content to show when authenticated */\r\n children: React.ReactNode\r\n /** Content to show when not authenticated */\r\n fallback?: React.ReactNode\r\n /** Initial authentication state for SSR */\r\n initiallyAuthenticated?: boolean\r\n}\r\n\r\n/**\r\n * Component that conditionally renders content based on authentication state\r\n * with SSR support\r\n */\r\nexport const AuthenticatedContent: React.FC<IAuthenticatedContentProps> = ({\r\n children,\r\n fallback,\r\n initiallyAuthenticated = false\r\n}) => {\r\n // Let the AuthProvider handle hydration - we just need to render the right content\r\n return (\r\n <HydrationGuard\r\n serverFallback={initiallyAuthenticated ? <>{children}</> : <>{fallback}</>}\r\n >\r\n {/* Regular content will be rendered during hydration and after */}\r\n {children}\r\n </HydrationGuard>\r\n )\r\n}\r\n"],"names":["SsrAuthProvider","_ref","children","initialAuthState","userData","authData","onLogin","onLogout","onAuthChange","ssrAuthState","isAuthenticated","isLoading","user","error","serverRendered","_jsx","MfeAuthProvider","initialState","_objectSpread","INITIAL_AUTH_STATE","HydrationGuard"],"mappings":"6QAsCaA,EAAmD,SAApCC,GAQvB,IAPHC,EAAQD,EAARC,SACAC,EAAgBF,EAAhBE,iBACAC,EAAQH,EAARG,SACAC,EAAQJ,EAARI,SACAC,EAAOL,EAAPK,QACAC,EAAQN,EAARM,SACAC,EAAYP,EAAZO,aAGIC,EAAeN,EAanB,OAVKM,GAAgBL,IACnBK,EAAe,CACbC,iBAAiB,EACjBC,WAAW,EACXC,KAAMR,EACNS,MAAO,KACPC,gBAAgB,IAKlBC,EAACC,GACCC,aAAcR,GAAYS,EAAAA,KAASC,GAAkB,GAAA,CAAEL,gBAAgB,IACvET,SAAUA,EACVC,QAASA,EACTC,SAAUA,EACVC,aAAcA,EAAYN,SAE1Ba,EAACK,EAAc,CAAAlB,SACZA,KAIT"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e={STATE_CHANGE:"mfe:auth:state_change",REQUEST_STATE:"mfe:auth:request_state",LOGIN:"mfe:auth:login",LOGOUT:"mfe:auth:logout"},t={isAuthenticated:!1,isLoading:!1,user:null,error:null,serverRendered:!1};export{e as AUTH_CHANNELS,t as INITIAL_AUTH_STATE};
|
|
2
|
-
//# sourceMappingURL=auth.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.types.js","sources":["../../src/mfe-shared/auth.types.ts"],"sourcesContent":["/**\r\n * auth.types.ts - Type definitions for Authentication System\r\n *\r\n * This file defines the data structures and communication channels\r\n * for the micro-frontend authentication system.\r\n */\r\n\r\n/**\r\n * User data structure\r\n */\r\nexport type IUser = {\r\n /** Unique identifier for the user */\r\n id: string\r\n /** User's display name */\r\n displayName: string\r\n /** User's email address */\r\n email: string\r\n /** Optional URL to user's avatar image */\r\n avatar?: string\r\n /** List of roles/permissions assigned to the user */\r\n roles: string[]\r\n}\r\n\r\n/**\r\n * Authentication state structure\r\n */\r\nexport type IAuthState = {\r\n /** Whether the user is currently authenticated */\r\n isAuthenticated: boolean\r\n /** Whether an authentication operation is in progress */\r\n isLoading: boolean\r\n /** The authenticated user, or null if not authenticated */\r\n user: IUser | null\r\n /** Error message if authentication failed, or null */\r\n error: string | null\r\n /** Whether the auth state was rendered on the server */\r\n serverRendered?: boolean\r\n}\r\n\r\n/**\r\n * Communication channels between auth provider and consumers\r\n */\r\nexport const AUTH_CHANNELS = {\r\n /** Provider → Consumer: Notify when auth state changes */\r\n STATE_CHANGE: 'mfe:auth:state_change',\r\n /** Consumer → Provider: Request the current auth state */\r\n REQUEST_STATE: 'mfe:auth:request_state',\r\n /** Consumer → Provider: Request to log in */\r\n LOGIN: 'mfe:auth:login',\r\n /** Consumer → Provider: Request to log out */\r\n LOGOUT: 'mfe:auth:logout'\r\n}\r\n\r\n/**\r\n * Default authentication state - unauthenticated, not loading, no user, no error\r\n */\r\nexport const INITIAL_AUTH_STATE: IAuthState = {\r\n isAuthenticated: false,\r\n isLoading: false,\r\n user: null,\r\n error: null,\r\n serverRendered: false\r\n}\r\n"],"names":["AUTH_CHANNELS","STATE_CHANGE","REQUEST_STATE","LOGIN","LOGOUT","INITIAL_AUTH_STATE","isAuthenticated","isLoading","user","error","serverRendered"],"mappings":"AA0CO,IAAMA,EAAgB,CAE3BC,aAAc,wBAEdC,cAAe,yBAEfC,MAAO,iBAEPC,OAAQ,mBAMGC,EAAiC,CAC5CC,iBAAiB,EACjBC,WAAW,EACXC,KAAM,KACNC,MAAO,KACPC,gBAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sources":["../../src/mfe-shared/environment.ts"],"sourcesContent":["/**\r\n * Utility functions to check the environment\r\n */\r\n\r\n/**\r\n * Check if code is running in a browser environment\r\n * @returns boolean indicating if window is available\r\n */\r\nexport const isBrowser = (): boolean => {\r\n return typeof window !== 'undefined' && !!window\r\n}\r\n\r\n/**\r\n * Safe access to window object for browser environments\r\n * @returns window object or undefined\r\n */\r\nexport const getBrowserGlobal = (): Window | undefined => {\r\n return isBrowser() ? window : undefined\r\n}\r\n\r\n/**\r\n * Safe access to globalThis object with browser fallback\r\n * @returns globalThis object\r\n */\r\nexport const getGlobal = (): any => {\r\n return typeof globalThis !== 'undefined' ? globalThis : getBrowserGlobal()\r\n}\r\n"],"names":["isBrowser","window"],"mappings":"IAQaA,EAAY,WACvB,MAAyB,oBAAXC,UAA4BA,MAC5C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{slicedToArray as r}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as n,Fragment as t}from"react/jsx-runtime";import{useState as e,useEffect as i}from"react";import{isBrowser as o}from"./environment.js";var u;!function(r){r.SERVER="server",r.HYDRATING="hydrating",r.HYDRATED="hydrated"}(u||(u={}));var a=function(a){var l=a.children,R=a.serverFallback,c=a.hydrationFallback,T=a.hydrationDelay,f=void 0===T?0:T,D=o()?u.HYDRATING:u.SERVER,E=e(D),m=r(E,2),d=m[0],v=m[1];return i((function(){if(d===u.SERVER&&v(u.HYDRATING),d===u.HYDRATING){var r=setTimeout((function(){v(u.HYDRATED)}),f);return function(){return clearTimeout(r)}}}),[d,f]),d===u.SERVER?n(t,{children:null!=R?R:l}):d===u.HYDRATING?n(t,{children:null!=c?c:l}):n(t,{children:l})},l=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=o()?u.HYDRATING:u.SERVER,a=e(t),l=r(a,2),R=l[0],c=l[1];return i((function(){if(R===u.SERVER&&c(u.HYDRATING),R===u.HYDRATING){var r=setTimeout((function(){c(u.HYDRATED)}),n);return function(){return clearTimeout(r)}}}),[R,n]),R};export{a as HydrationGuard,u as IHydrationState,l as useHydration};
|
|
2
|
-
//# sourceMappingURL=hydration-helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hydration-helper.js","sources":["../../src/mfe-shared/hydration-helper.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { isBrowser } from './environment'\r\n\r\n/**\r\n * Hydration state for components\r\n */\r\nexport enum IHydrationState {\r\n /** Component is rendering on the server */\r\n SERVER = 'server',\r\n /** Component is in the process of hydrating on the client */\r\n HYDRATING = 'hydrating',\r\n /** Component is fully hydrated on the client */\r\n HYDRATED = 'hydrated'\r\n}\r\n\r\n/**\r\n * Props for the HydrationGuard component\r\n */\r\nexport interface IHydrationGuardProps {\r\n /** Content to render */\r\n children: React.ReactNode\r\n /** Optional fallback content to show during server rendering */\r\n serverFallback?: React.ReactNode\r\n /** Optional fallback content to show during hydration */\r\n hydrationFallback?: React.ReactNode\r\n /**\r\n * Optional delay in milliseconds before considering the component hydrated\r\n * This can help with \"flash of content\" issues\r\n */\r\n hydrationDelay?: number\r\n}\r\n\r\n/**\r\n * HydrationGuard - Component to handle SSR hydration\r\n *\r\n * This component helps manage the transition between server-rendered content\r\n * and client-side hydration, allowing different content to be shown during\r\n * different stages of the hydration process.\r\n */\r\nexport const HydrationGuard: React.FC<IHydrationGuardProps> = ({ children, serverFallback, hydrationFallback, hydrationDelay = 0 }) => {\r\n // Determine initial hydration state\r\n const initialState = !isBrowser() ? IHydrationState.SERVER : IHydrationState.HYDRATING\r\n\r\n const [hydrationState, setHydrationState] = useState<IHydrationState>(initialState)\r\n\r\n useEffect(() => {\r\n // We're now client-side, so at minimum we're hydrating\r\n if (hydrationState === IHydrationState.SERVER) {\r\n setHydrationState(IHydrationState.HYDRATING)\r\n }\r\n\r\n // If we're hydrating, set a timer to transition to fully hydrated\r\n if (hydrationState === IHydrationState.HYDRATING) {\r\n const timer = setTimeout(() => {\r\n setHydrationState(IHydrationState.HYDRATED)\r\n }, hydrationDelay)\r\n\r\n return () => clearTimeout(timer)\r\n }\r\n }, [hydrationState, hydrationDelay])\r\n\r\n // Render appropriate content based on hydration state\r\n if (hydrationState === IHydrationState.SERVER) {\r\n return <>{serverFallback ?? children}</>\r\n }\r\n\r\n if (hydrationState === IHydrationState.HYDRATING) {\r\n return <>{hydrationFallback ?? children}</>\r\n }\r\n\r\n return <>{children}</>\r\n}\r\n\r\n/**\r\n * Hook to get the current hydration state\r\n *\r\n * Use this hook to conditionally run code based on whether the component\r\n * is being rendered on the server or has been hydrated on the client.\r\n *\r\n * @param hydrationDelay Optional delay before considering the component hydrated\r\n * @returns Current hydration state\r\n */\r\nexport const useHydration = (hydrationDelay = 0): IHydrationState => {\r\n const initialState = !isBrowser() ? IHydrationState.SERVER : IHydrationState.HYDRATING\r\n\r\n const [hydrationState, setHydrationState] = useState<IHydrationState>(initialState)\r\n\r\n useEffect(() => {\r\n // We're now client-side, so at minimum we're hydrating\r\n if (hydrationState === IHydrationState.SERVER) {\r\n setHydrationState(IHydrationState.HYDRATING)\r\n }\r\n\r\n // If we're hydrating, set a timer to transition to fully hydrated\r\n if (hydrationState === IHydrationState.HYDRATING) {\r\n const timer = setTimeout(() => {\r\n setHydrationState(IHydrationState.HYDRATED)\r\n }, hydrationDelay)\r\n\r\n return () => clearTimeout(timer)\r\n }\r\n }, [hydrationState, hydrationDelay])\r\n\r\n return hydrationState\r\n}\r\n"],"names":["IHydrationState","HydrationGuard","_ref","children","serverFallback","hydrationFallback","_ref$hydrationDelay","hydrationDelay","initialState","isBrowser","HYDRATING","SERVER","_useState","useState","_useState2","_slicedToArray","hydrationState","setHydrationState","useEffect","timer","setTimeout","HYDRATED","clearTimeout","_jsx","_Fragment","useHydration","arguments","length","undefined","_useState3","_useState4"],"mappings":"gOAMYA,GAAZ,SAAYA,GAEVA,EAAA,OAAA,SAEAA,EAAA,UAAA,YAEAA,EAAA,SAAA,UACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,QA0BYC,EAAiD,SAAnCC,GAA2G,IAArEC,EAAQD,EAARC,SAAUC,EAAcF,EAAdE,eAAgBC,EAAiBH,EAAjBG,kBAAiBC,EAAAJ,EAAEK,eAAAA,OAAiB,IAAHD,EAAG,EAACA,EAExHE,EAAgBC,IAAuCT,EAAgBU,UAAzCV,EAAgBW,OAEpDC,EAA4CC,EAA0BL,GAAaM,EAAAC,EAAAH,EAAA,GAA5EI,EAAcF,EAAA,GAAEG,EAAiBH,EAAA,GAmBxC,OAjBAI,GAAU,WAOR,GALIF,IAAmBhB,EAAgBW,QACrCM,EAAkBjB,EAAgBU,WAIhCM,IAAmBhB,EAAgBU,UAAW,CAChD,IAAMS,EAAQC,YAAW,WACvBH,EAAkBjB,EAAgBqB,SACnC,GAAEd,GAEH,OAAO,WAAA,OAAMe,aAAaH,EAAM,CACjC,CACH,GAAG,CAACH,EAAgBT,IAGhBS,IAAmBhB,EAAgBW,OAC9BY,EAAGC,EAAA,CAAArB,SAAAC,QAAAA,EAAkBD,IAG1Ba,IAAmBhB,EAAgBU,UAC9Ba,EAAGC,EAAA,CAAArB,SAAAE,QAAAA,EAAqBF,IAG1BoB,EAAAC,EAAA,CAAArB,SAAGA,GACZ,EAWasB,EAAe,WAAwC,IAAvClB,EAAcmB,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,EACtClB,EAAgBC,IAAuCT,EAAgBU,UAAzCV,EAAgBW,OAEpDkB,EAA4ChB,EAA0BL,GAAasB,EAAAf,EAAAc,EAAA,GAA5Eb,EAAcc,EAAA,GAAEb,EAAiBa,EAAA,GAkBxC,OAhBAZ,GAAU,WAOR,GALIF,IAAmBhB,EAAgBW,QACrCM,EAAkBjB,EAAgBU,WAIhCM,IAAmBhB,EAAgBU,UAAW,CAChD,IAAMS,EAAQC,YAAW,WACvBH,EAAkBjB,EAAgBqB,SACnC,GAAEd,GAEH,OAAO,WAAA,OAAMe,aAAaH,EAAM,CACjC,CACH,GAAG,CAACH,EAAgBT,IAEbS,CACT"}
|
package/dist/mfe-shared/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{mfeBridge}from"./mfe-bridge.js";export{MfeAuthProvider,useMfeAuth}from"./auth.js";export{AUTH_CHANNELS}from"./auth.types.js";export{SsrAuthProvider}from"./auth.ssr.js";export{MfeLink,MfeNavigateProvider,NAVIGATION_CHANNELS,useMfeNavigate}from"./navigation.js";export{isBrowser}from"./environment.js";export{HydrationGuard,useHydration}from"./hydration-helper.js";export{MfeAuthDebugPanel}from"./auth.debug.js";export{MfeNavigateDebugPanel}from"./navigation.debug.js";
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createClass as e,createForOfIteratorHelper as n,classCallCheck as i,defineProperty as r}from"../_virtual/_rollupPluginBabelHelpers.js";import{isBrowser as a}from"./environment.js";var t=new(function(){return e((function e(){i(this,e),r(this,"middlewares",[])}),[{key:"subscribe",value:function(e,n){if(!a())return function(){};var i=function(i){var r,a=i;(null===(r=a.detail)||void 0===r?void 0:r.__channel)===e&&n(a.detail.payload)};return window.addEventListener(e,i),function(){a()&&window.removeEventListener(e,i)}}},{key:"publish",value:function(e,i){if(a()){var r,t=n(this.middlewares);try{for(t.s();!(r=t.n()).done;){if(!1===(0,r.value)(e,i))return}}catch(e){t.e(e)}finally{t.f()}var l=new CustomEvent(e,{detail:{__channel:e,payload:i}});window.dispatchEvent(l)}}},{key:"use",value:function(e){this.middlewares.push(e)}},{key:"clearMiddlewares",value:function(){this.middlewares=[]}}])}());export{t as mfeBridge};
|
|
2
|
-
//# sourceMappingURL=mfe-bridge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mfe-bridge.js","sources":["../../src/mfe-shared/mfe-bridge.tsx"],"sourcesContent":["import { isBrowser } from './environment'\r\n\r\n/**\r\n * Callback function type for event subscribers\r\n * @template T Type of payload data\r\n */\r\ntype ICallback<T = any> = (payload: T) => void\r\n\r\n/**\r\n * Middleware function type for intercepting events\r\n * @returns boolean|void Return false to cancel event propagation\r\n */\r\ntype IMiddleware = (channel: string, payload: any) => boolean | void\r\n\r\n/**\r\n * MfeBridge - Event-based communication system for micro-frontends\r\n *\r\n * This class provides a way for different micro-frontends to communicate\r\n * with each other via a publish/subscribe pattern using CustomEvents.\r\n * Includes SSR compatibility checks.\r\n */\r\nclass MfeBridge {\r\n private middlewares: IMiddleware[] = []\r\n\r\n /**\r\n * Subscribe to events on a specific channel\r\n * @template T Type of payload data\r\n * @param channel The channel to subscribe to\r\n * @param callback Function to call when an event occurs on this channel\r\n * @returns Unsubscribe function to remove the event listener\r\n */\r\n subscribe<T = any>(channel: string, callback: ICallback<T>) {\r\n // No-op function for SSR environment\r\n const noop = () => {}\r\n\r\n // If not in browser environment, return no-op\r\n if (!isBrowser()) {\r\n return noop\r\n }\r\n\r\n const handler = (e: Event) => {\r\n const customEvent = e as CustomEvent\r\n if (customEvent.detail?.__channel === channel) {\r\n callback(customEvent.detail.payload)\r\n }\r\n }\r\n\r\n window.addEventListener(channel, handler)\r\n\r\n // Return unsubscribe function\r\n return () => {\r\n if (isBrowser()) {\r\n window.removeEventListener(channel, handler)\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Publish an event to a specific channel\r\n * @template T Type of payload data\r\n * @param channel The channel to publish to\r\n * @param payload Data to send with the event\r\n */\r\n publish<T = any>(channel: string, payload: T) {\r\n // Skip in SSR environment\r\n if (!isBrowser()) {\r\n return\r\n }\r\n\r\n // Run through middleware stack\r\n for (const mw of this.middlewares) {\r\n const result = mw(channel, payload)\r\n if (result === false) return // middleware can cancel\r\n }\r\n\r\n const event = new CustomEvent(channel, { detail: { __channel: channel, payload } })\r\n window.dispatchEvent(event)\r\n }\r\n\r\n /**\r\n * Add middleware to intercept events before they're published\r\n * @param middleware Function that can inspect or modify events\r\n */\r\n use(middleware: IMiddleware) {\r\n this.middlewares.push(middleware)\r\n }\r\n\r\n /**\r\n * Remove all middleware\r\n */\r\n clearMiddlewares() {\r\n this.middlewares = []\r\n }\r\n}\r\n\r\n// Export a singleton instance to be used throughout the application\r\nexport const mfeBridge = new MfeBridge()\r\n"],"names":["mfeBridge","_createClass","MfeBridge","_classCallCheck","_defineProperty","key","value","channel","callback","isBrowser","handler","e","_customEvent$detail","customEvent","detail","__channel","payload","window","addEventListener","removeEventListener","_step","_iterator","_createForOfIteratorHelper","this","middlewares","s","n","done","mw","err","f","event","CustomEvent","dispatchEvent","middleware","push"],"mappings":"2LAcA,IAkFaA,EAAY,IA3EV,WAC0B,OAAAC,GAD1B,SAAAC,IAAAC,OAAAD,GAAAE,qBACwB,GAAE,GAAA,CAAA,CAAAC,IAAA,YAAAC,MASvC,SAAmBC,EAAiBC,GAKlC,IAAKC,IACH,OAJW,WAAQ,EAOrB,IAAMC,EAAU,SAACC,GAAY,IAAAC,EACrBC,EAAcF,GACE,QAAlBC,EAAAC,EAAYC,cAAM,IAAAF,OAAA,EAAlBA,EAAoBG,aAAcR,GACpCC,EAASK,EAAYC,OAAOE,QAE/B,EAKD,OAHAC,OAAOC,iBAAiBX,EAASG,GAG1B,WACDD,KACFQ,OAAOE,oBAAoBZ,EAASG,EAEvC,CACH,GAEA,CAAAL,IAAA,UAAAC,MAMA,SAAiBC,EAAiBS,GAEhC,GAAKP,IAAL,CAIA,IACiCW,EADjCC,EAAAC,EACiBC,KAAKC,aAAW,IAAjC,IAAAH,EAAAI,MAAAL,EAAAC,EAAAK,KAAAC,MAAmC,CAEjC,IAAe,KADAC,EADJR,EAAAd,OACOC,EAASS,GACL,MACvB,CAAA,CAAA,MAAAa,GAAAR,EAAAV,EAAAkB,EAAA,CAAA,QAAAR,EAAAS,GAAA,CAED,IAAMC,EAAQ,IAAIC,YAAYzB,EAAS,CAAEO,OAAQ,CAAEC,UAAWR,EAASS,QAAAA,KACvEC,OAAOgB,cAAcF,EATpB,CAUH,GAEA,CAAA1B,IAAA,MAAAC,MAIA,SAAI4B,GACFX,KAAKC,YAAYW,KAAKD,EACxB,GAEA,CAAA7B,IAAA,mBAAAC,MAGA,WACEiB,KAAKC,YAAc,EACrB,IAAC,CAvEY"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{slicedToArray as e,objectSpread2 as r,toConsumableArray as n}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useEffect as a}from"react";var l=function(l){var s=l.style,c=o([]),d=e(c,2),f=d[0],m=d[1];return a((function(){var e=function(e){var r=e.detail,t=r.primaryHref,i=r.secondaryHref,o=r.internal,a=r.options;m((function(e){return[{primaryHref:t,secondaryHref:i,internal:o,options:a}].concat(n(e.slice(0,9)))}))};return globalThis.addEventListener("mfe:navigate",e),function(){return globalThis.removeEventListener("mfe:navigate",e)}}),[]),t("div",{style:r({position:"fixed",background:"rgba(0,0,0,0.8)",color:"#fff",padding:12,borderRadius:8,fontSize:12,zIndex:9999,maxWidth:320,maxHeight:240,overflowY:"auto",boxShadow:"0 2px 8px rgba(0,0,0,0.2)"},null!=s?s:{bottom:16,left:16}),children:[i("div",{style:{fontWeight:"bold",marginBottom:8},children:"MFE Navigate Debug"}),0===f.length?i("div",{style:{opacity:.7},children:"No navigation events"}):i("ul",{style:{margin:0,padding:0,listStyle:"none"},children:f.map((function(e,r){var n;return t("li",{style:{marginBottom:4},children:[i("span",{style:{color:"#90ee90"},children:e.primaryHref}),e.secondaryHref&&t("span",{style:{color:"#ffa500",marginLeft:8},children:["→ ",e.secondaryHref]}),e.internal&&i("span",{style:{color:"#87ceeb",marginLeft:8},children:"[internal]"}),(null===(n=e.options)||void 0===n?void 0:n.target)&&t("span",{style:{color:"#ffb6c1",marginLeft:8},children:["(",e.options.target,")"]})]},r)}))})]})};export{l as MfeNavigateDebugPanel};
|
|
2
|
-
//# sourceMappingURL=navigation.debug.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.debug.js","sources":["../../src/mfe-shared/navigation.debug.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\r\nimport type { FC } from 'react'\r\nimport type { IMfeNavigate } from './navigation'\r\n\r\nconst MAX_EVENTS = 10\r\n\r\nexport const MfeNavigateDebugPanel: FC<{ style?: React.CSSProperties }> = ({ style }) => {\r\n const [debugEvents, setDebugEvents] = useState<IMfeNavigate[]>([])\r\n\r\n useEffect(() => {\r\n const handleNavigate = (e: CustomEvent) => {\r\n const { primaryHref, secondaryHref, internal, options } = e.detail as IMfeNavigate\r\n setDebugEvents((events) => [{ primaryHref, secondaryHref, internal, options }, ...events.slice(0, MAX_EVENTS - 1)])\r\n }\r\n globalThis.addEventListener('mfe:navigate', handleNavigate as EventListener)\r\n return () => globalThis.removeEventListener('mfe:navigate', handleNavigate as EventListener)\r\n }, [])\r\n\r\n return (\r\n <div\r\n style={{\r\n position: 'fixed',\r\n background: 'rgba(0,0,0,0.8)',\r\n color: '#fff',\r\n padding: 12,\r\n borderRadius: 8,\r\n fontSize: 12,\r\n zIndex: 9999,\r\n maxWidth: 320,\r\n maxHeight: 240,\r\n overflowY: 'auto',\r\n boxShadow: '0 2px 8px rgba(0,0,0,0.2)',\r\n ...(style ?? { bottom: 16, left: 16 })\r\n }}\r\n >\r\n <div style={{ fontWeight: 'bold', marginBottom: 8 }}>MFE Navigate Debug</div>\r\n {debugEvents.length === 0 ? (\r\n <div style={{ opacity: 0.7 }}>No navigation events</div>\r\n ) : (\r\n <ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>\r\n {debugEvents.map((ev, idx) => (\r\n <li key={idx} style={{ marginBottom: 4 }}>\r\n <span style={{ color: '#90ee90' }}>{ev.primaryHref}</span>\r\n {ev.secondaryHref && <span style={{ color: '#ffa500', marginLeft: 8 }}>→ {ev.secondaryHref}</span>}\r\n {ev.internal && <span style={{ color: '#87ceeb', marginLeft: 8 }}>[internal]</span>}\r\n {ev.options?.target && <span style={{ color: '#ffb6c1', marginLeft: 8 }}>({ev.options.target})</span>}\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n </div>\r\n )\r\n}\r\n"],"names":["MfeNavigateDebugPanel","_ref","style","_useState","useState","_useState2","_slicedToArray","debugEvents","setDebugEvents","useEffect","handleNavigate","e","_e$detail","detail","primaryHref","secondaryHref","internal","options","events","concat","_toConsumableArray","slice","MAX_EVENTS","globalThis","addEventListener","removeEventListener","_jsxs","_objectSpread","position","background","color","padding","borderRadius","fontSize","zIndex","maxWidth","maxHeight","overflowY","boxShadow","bottom","left","children","_jsx","fontWeight","marginBottom","length","opacity","margin","listStyle","map","ev","idx","_ev$options","marginLeft","target"],"mappings":"qNAIA,IAEaA,EAA6D,SAAxCC,GAAsD,IAAXC,EAAKD,EAALC,MAC3EC,EAAsCC,EAAyB,IAAGC,EAAAC,EAAAH,EAAA,GAA3DI,EAAWF,EAAA,GAAEG,EAAcH,EAAA,GAWlC,OATAI,GAAU,WACR,IAAMC,EAAiB,SAACC,GACtB,IAAAC,EAA0DD,EAAEE,OAApDC,EAAWF,EAAXE,YAAaC,EAAaH,EAAbG,cAAeC,EAAQJ,EAARI,SAAUC,EAAOL,EAAPK,QAC9CT,GAAe,SAACU,GAAM,MAAM,CAAA,CAAEJ,YAAAA,EAAaC,cAAAA,EAAeC,SAAAA,EAAUC,QAAAA,IAASE,OAAAC,EAAKF,EAAOG,MAAM,EAAGC,IAAe,GAClH,EAED,OADAC,WAAWC,iBAAiB,eAAgBd,GACrC,WAAA,OAAMa,WAAWE,oBAAoB,eAAgBf,EAAgC,CAC7F,GAAE,IAGDgB,EACE,MAAA,CAAAxB,MAAKyB,EAAA,CACHC,SAAU,QACVC,WAAY,kBACZC,MAAO,OACPC,QAAS,GACTC,aAAc,EACdC,SAAU,GACVC,OAAQ,KACRC,SAAU,IACVC,UAAW,IACXC,UAAW,OACXC,UAAW,6BACPpC,QAAAA,EAAS,CAAEqC,OAAQ,GAAIC,KAAM,KAClCC,SAAA,CAEDC,SAAKxC,MAAO,CAAEyC,WAAY,OAAQC,aAAc,GAAGH,SAAA,uBAC3B,IAAvBlC,EAAYsC,OACXH,EAAK,MAAA,CAAAxC,MAAO,CAAE4C,QAAS,IAAiCL,SAAA,yBAExDC,EAAI,KAAA,CAAAxC,MAAO,CAAE6C,OAAQ,EAAGhB,QAAS,EAAGiB,UAAW,QAAQP,SACpDlC,EAAY0C,KAAI,SAACC,EAAIC,GAAG,IAAAC,EAAA,OACvB1B,EAAA,KAAA,CAAcxB,MAAO,CAAE0C,aAAc,GAAGH,SAAA,CACtCC,UAAMxC,MAAO,CAAE4B,MAAO,oBAAcoB,EAAGpC,cACtCoC,EAAGnC,eAAiBW,UAAMxB,MAAO,CAAE4B,MAAO,UAAWuB,WAAY,GAAQZ,SAAA,CAAA,KAAAS,EAAGnC,iBAC5EmC,EAAGlC,UAAY0B,EAAM,OAAA,CAAAxC,MAAO,CAAE4B,MAAO,UAAWuB,WAAY,GAAGZ,SAAA,gBACrD,QAAVW,EAAAF,EAAGjC,eAAO,IAAAmC,OAAA,EAAVA,EAAYE,SAAU5B,UAAMxB,MAAO,CAAE4B,MAAO,UAAWuB,WAAY,GAAOZ,SAAA,CAAA,IAAAS,EAAGjC,QAAQqC,OAAM,SAJrFH,EAMV,QAKX"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{objectWithoutProperties as r,objectSpread2 as n}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useEffect as i}from"react";import{mfeBridge as a}from"./mfe-bridge.js";import{isBrowser as o}from"./environment.js";var f=["internal","primaryHref","secondaryHref","onClick"],u={NAVIGATE:"mfe:navigation:navigate"},c=function(){return{navigate:function(r){a.publish(u.NAVIGATE,r)}}},l=function(t){var i=t.internal,a=t.primaryHref,o=t.secondaryHref,u=t.onClick,l=r(t,f),m=c().navigate;return e("a",n(n({},l),{},{href:a,onClick:function(r){if(u&&u(r),!r.defaultPrevented)return i&&o?(r.preventDefault(),void m({primaryHref:a,secondaryHref:o,internal:i})):void 0}}))},m=function(r){var n=r.navigate;return i((function(){var r=a.subscribe(u.NAVIGATE,(function(r){var e=r.primaryHref,t=r.secondaryHref,i=r.options;if(e){var a=t||e||"/";"_blank"!==(null==i?void 0:i.target)?n(a,i):o()&&window.open("".concat(a),"_blank")}}));return function(){return r()}}),[n]),e(t,{})};export{l as MfeLink,m as MfeNavigateProvider,u as NAVIGATION_CHANNELS,c as useMfeNavigate};
|
|
2
|
-
//# sourceMappingURL=navigation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sources":["../../src/mfe-shared/navigation.tsx"],"sourcesContent":["import { useEffect, type AnchorHTMLAttributes, type FC } from 'react'\r\nimport { mfeBridge } from './mfe-bridge'\r\nimport { isBrowser } from './environment'\r\n\r\n// Define channels for navigation events\r\nexport const NAVIGATION_CHANNELS = {\r\n NAVIGATE: 'mfe:navigation:navigate'\r\n}\r\n\r\nexport type AppSite = 'client' | 'home' | 'music' | 'api'\r\n\r\nexport type IMfeNavigateHref = {\r\n primaryHref: string\r\n secondaryHref?: string\r\n}\r\n\r\nexport interface IMfeNavigate {\r\n primaryHref: string\r\n secondaryHref?: string\r\n internal?: boolean\r\n site?: AppSite\r\n options?: any\r\n target?: '_self' | '_blank'\r\n}\r\n\r\nexport /**\r\n * Hook for navigation between micro-frontends\r\n * @returns Navigation utilities\r\n */\r\nconst useMfeNavigate = () => {\r\n const navigate = (params: IMfeNavigate) => {\r\n // Use mfeBridge consistently instead of direct globalThis.dispatchEvent\r\n mfeBridge.publish(NAVIGATION_CHANNELS.NAVIGATE, params)\r\n }\r\n return { navigate }\r\n}\r\n\r\nexport interface IMfeLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {\r\n internal?: boolean\r\n primaryHref: string\r\n secondaryHref?: string\r\n}\r\n\r\nexport const MfeLink: FC<IMfeLinkProps> = (props) => {\r\n const { internal, primaryHref, secondaryHref, onClick, ...rest } = props\r\n const { navigate } = useMfeNavigate()\r\n\r\n const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\r\n if (onClick) onClick(e)\r\n if (e.defaultPrevented) return\r\n if (internal && secondaryHref) {\r\n e.preventDefault()\r\n navigate({ primaryHref, secondaryHref, internal })\r\n return\r\n }\r\n // If not internal or no secondaryHref, let the anchor tag handle it\r\n }\r\n\r\n return <a {...rest} href={primaryHref} onClick={handleClick} />\r\n}\r\n\r\n// Define types to avoid direct imports\r\nexport type NavigateFunction<O = any> = (path: string, options?: O) => void\r\n\r\nexport interface IMfeNavigateProviderProps {\r\n navigate: NavigateFunction\r\n}\r\n\r\nexport const MfeNavigateProvider: FC<IMfeNavigateProviderProps> = ({ navigate }) => {\r\n useEffect(() => {\r\n const unsubscribe = mfeBridge.subscribe(NAVIGATION_CHANNELS.NAVIGATE, (payload: IMfeNavigate) => {\r\n const { primaryHref, secondaryHref, options } = payload\r\n if (!primaryHref) return\r\n // Navigate to secondaryHref if available, otherwise fallback to primaryHref\r\n const url = secondaryHref || primaryHref || '/'\r\n if (options?.target === '_blank') {\r\n // Only open in new window if in browser environment\r\n if (isBrowser()) {\r\n window.open(`${url}`, '_blank')\r\n }\r\n return\r\n }\r\n navigate(url, options)\r\n })\r\n return () => unsubscribe() // Unsubscribe from the event\r\n }, [navigate])\r\n return <></>\r\n}\r\n"],"names":["NAVIGATION_CHANNELS","NAVIGATE","useMfeNavigate","navigate","params","mfeBridge","publish","MfeLink","props","internal","primaryHref","secondaryHref","onClick","rest","_objectWithoutProperties","_excluded","_jsx","_objectSpread","href","e","defaultPrevented","preventDefault","MfeNavigateProvider","_ref","useEffect","unsubscribe","subscribe","payload","options","url","target","isBrowser","window","open","concat"],"mappings":"kVAKaA,EAAsB,CACjCC,SAAU,2BAuBNC,EAAiB,WAKrB,MAAO,CAAEC,SAJQ,SAACC,GAEhBC,EAAUC,QAAQN,EAAoBC,SAAUG,EACjD,EAEH,EAQaG,EAA6B,SAACC,GACzC,IAAQC,EAA2DD,EAA3DC,SAAUC,EAAiDF,EAAjDE,YAAaC,EAAoCH,EAApCG,cAAeC,EAAqBJ,EAArBI,QAAYC,EAAIC,EAAKN,EAAKO,GAChEZ,EAAaD,IAAbC,SAaR,OAAOa,EAAA,IAAAC,EAAAA,KAAOJ,GAAI,GAAA,CAAEK,KAAMR,EAAaE,QAXnB,SAACO,GAEnB,GADIP,GAASA,EAAQO,IACjBA,EAAEC,iBACN,OAAIX,GAAYE,GACdQ,EAAEE,sBACFlB,EAAS,CAAEO,YAAAA,EAAaC,cAAAA,EAAeF,SAAAA,UAFzC,CAMD,IAGH,EASaa,EAAqD,SAAlCC,GAAmD,IAAdpB,EAAQoB,EAARpB,SAkBnE,OAjBAqB,GAAU,WACR,IAAMC,EAAcpB,EAAUqB,UAAU1B,EAAoBC,UAAU,SAAC0B,GACrE,IAAQjB,EAAwCiB,EAAxCjB,YAAaC,EAA2BgB,EAA3BhB,cAAeiB,EAAYD,EAAZC,QACpC,GAAKlB,EAAL,CAEA,IAAMmB,EAAMlB,GAAiBD,GAAe,IACpB,YAApBkB,aAAO,EAAPA,EAASE,QAOb3B,EAAS0B,EAAKD,GALRG,KACFC,OAAOC,KAAIC,GAAAA,OAAIL,GAAO,SANR,CAWpB,IACA,OAAO,WAAA,OAAMJ,GAAa,CAC5B,GAAG,CAACtB,IACGa,OACT"}
|
package/dist/mfe-shared.d.ts
DELETED
package/dist/mfe-shared.js
DELETED
package/dist/mfe-shared.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IAuthState, IUser } from './auth.types';
|
|
3
|
-
/**
|
|
4
|
-
* Login parameters structure
|
|
5
|
-
*/
|
|
6
|
-
export interface ILoginParams {
|
|
7
|
-
username: string;
|
|
8
|
-
password: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Login response structure
|
|
12
|
-
*/
|
|
13
|
-
export interface ILoginResponse {
|
|
14
|
-
isAuthenticated: boolean;
|
|
15
|
-
user?: IUser;
|
|
16
|
-
error?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface IMfeAuthProviderProps {
|
|
19
|
-
children?: React.ReactNode;
|
|
20
|
-
onLogin?: (params: ILoginParams) => Promise<ILoginResponse | void>;
|
|
21
|
-
onLogout?: () => Promise<boolean | void>;
|
|
22
|
-
initialState?: IAuthState;
|
|
23
|
-
authData?: {
|
|
24
|
-
id?: string;
|
|
25
|
-
displayName?: string;
|
|
26
|
-
email?: string;
|
|
27
|
-
avatar?: string;
|
|
28
|
-
roles?: string[];
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
};
|
|
31
|
-
onAuthChange?: (callback: (newState: IAuthState) => void) => () => void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* AuthProvider - Component for Host application
|
|
35
|
-
*
|
|
36
|
-
* Manages authentication state and broadcasts events to MFEs.
|
|
37
|
-
* Place this component anywhere in your application, no need to wrap other components.
|
|
38
|
-
*
|
|
39
|
-
* Host can customize login/logout behavior by providing custom handlers.
|
|
40
|
-
*/
|
|
41
|
-
export declare const MfeAuthProvider: React.FC<IMfeAuthProviderProps>;
|
|
42
|
-
export declare function useMfeAuth(): {
|
|
43
|
-
login: (username: string, password: string) => void;
|
|
44
|
-
logout: () => void;
|
|
45
|
-
isAuthenticated: boolean;
|
|
46
|
-
isLoading: boolean;
|
|
47
|
-
user: IUser | null;
|
|
48
|
-
error: string | null;
|
|
49
|
-
serverRendered?: boolean | undefined;
|
|
50
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IAuthState, IUser } from './auth.types';
|
|
3
|
-
import { type IMfeAuthProviderProps } from './auth';
|
|
4
|
-
/**
|
|
5
|
-
* Props for the SSR-compatible auth provider
|
|
6
|
-
*/
|
|
7
|
-
interface ISsrAuthProviderProps {
|
|
8
|
-
/** Content to render */
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
/** Initial auth state for SSR */
|
|
11
|
-
initialAuthState?: IAuthState;
|
|
12
|
-
/** User data for initial state */
|
|
13
|
-
userData?: IUser;
|
|
14
|
-
/** Custom auth data to be passed to AuthProvider */
|
|
15
|
-
authData?: {
|
|
16
|
-
id?: string;
|
|
17
|
-
displayName?: string;
|
|
18
|
-
email?: string;
|
|
19
|
-
avatar?: string;
|
|
20
|
-
roles?: string[];
|
|
21
|
-
[key: string]: any;
|
|
22
|
-
};
|
|
23
|
-
/** Custom login handler */
|
|
24
|
-
onLogin?: IMfeAuthProviderProps['onLogin'];
|
|
25
|
-
/** Custom logout handler */
|
|
26
|
-
onLogout?: IMfeAuthProviderProps['onLogout'];
|
|
27
|
-
/** Auth state change subscription */
|
|
28
|
-
onAuthChange?: IMfeAuthProviderProps['onAuthChange'];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Auth provider component that supports SSR
|
|
32
|
-
*
|
|
33
|
-
* This component allows providing initial auth data during server-side rendering
|
|
34
|
-
* and then hydrating from API or other sources once client-side.
|
|
35
|
-
*/
|
|
36
|
-
export declare const SsrAuthProvider: React.FC<ISsrAuthProviderProps>;
|
|
37
|
-
/**
|
|
38
|
-
* Props for the SSR-compatible authenticated content component
|
|
39
|
-
*/
|
|
40
|
-
interface IAuthenticatedContentProps {
|
|
41
|
-
/** Content to show when authenticated */
|
|
42
|
-
children: React.ReactNode;
|
|
43
|
-
/** Content to show when not authenticated */
|
|
44
|
-
fallback?: React.ReactNode;
|
|
45
|
-
/** Initial authentication state for SSR */
|
|
46
|
-
initiallyAuthenticated?: boolean;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Component that conditionally renders content based on authentication state
|
|
50
|
-
* with SSR support
|
|
51
|
-
*/
|
|
52
|
-
export declare const AuthenticatedContent: React.FC<IAuthenticatedContentProps>;
|
|
53
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* auth.types.ts - Type definitions for Authentication System
|
|
3
|
-
*
|
|
4
|
-
* This file defines the data structures and communication channels
|
|
5
|
-
* for the micro-frontend authentication system.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* User data structure
|
|
9
|
-
*/
|
|
10
|
-
export type IUser = {
|
|
11
|
-
/** Unique identifier for the user */
|
|
12
|
-
id: string;
|
|
13
|
-
/** User's display name */
|
|
14
|
-
displayName: string;
|
|
15
|
-
/** User's email address */
|
|
16
|
-
email: string;
|
|
17
|
-
/** Optional URL to user's avatar image */
|
|
18
|
-
avatar?: string;
|
|
19
|
-
/** List of roles/permissions assigned to the user */
|
|
20
|
-
roles: string[];
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Authentication state structure
|
|
24
|
-
*/
|
|
25
|
-
export type IAuthState = {
|
|
26
|
-
/** Whether the user is currently authenticated */
|
|
27
|
-
isAuthenticated: boolean;
|
|
28
|
-
/** Whether an authentication operation is in progress */
|
|
29
|
-
isLoading: boolean;
|
|
30
|
-
/** The authenticated user, or null if not authenticated */
|
|
31
|
-
user: IUser | null;
|
|
32
|
-
/** Error message if authentication failed, or null */
|
|
33
|
-
error: string | null;
|
|
34
|
-
/** Whether the auth state was rendered on the server */
|
|
35
|
-
serverRendered?: boolean;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Communication channels between auth provider and consumers
|
|
39
|
-
*/
|
|
40
|
-
export declare const AUTH_CHANNELS: {
|
|
41
|
-
/** Provider → Consumer: Notify when auth state changes */
|
|
42
|
-
STATE_CHANGE: string;
|
|
43
|
-
/** Consumer → Provider: Request the current auth state */
|
|
44
|
-
REQUEST_STATE: string;
|
|
45
|
-
/** Consumer → Provider: Request to log in */
|
|
46
|
-
LOGIN: string;
|
|
47
|
-
/** Consumer → Provider: Request to log out */
|
|
48
|
-
LOGOUT: string;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Default authentication state - unauthenticated, not loading, no user, no error
|
|
52
|
-
*/
|
|
53
|
-
export declare const INITIAL_AUTH_STATE: IAuthState;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions to check the environment
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Check if code is running in a browser environment
|
|
6
|
-
* @returns boolean indicating if window is available
|
|
7
|
-
*/
|
|
8
|
-
export declare const isBrowser: () => boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Safe access to window object for browser environments
|
|
11
|
-
* @returns window object or undefined
|
|
12
|
-
*/
|
|
13
|
-
export declare const getBrowserGlobal: () => Window | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Safe access to globalThis object with browser fallback
|
|
16
|
-
* @returns globalThis object
|
|
17
|
-
*/
|
|
18
|
-
export declare const getGlobal: () => any;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hydration state for components
|
|
4
|
-
*/
|
|
5
|
-
export declare enum IHydrationState {
|
|
6
|
-
/** Component is rendering on the server */
|
|
7
|
-
SERVER = "server",
|
|
8
|
-
/** Component is in the process of hydrating on the client */
|
|
9
|
-
HYDRATING = "hydrating",
|
|
10
|
-
/** Component is fully hydrated on the client */
|
|
11
|
-
HYDRATED = "hydrated"
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Props for the HydrationGuard component
|
|
15
|
-
*/
|
|
16
|
-
export interface IHydrationGuardProps {
|
|
17
|
-
/** Content to render */
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
/** Optional fallback content to show during server rendering */
|
|
20
|
-
serverFallback?: React.ReactNode;
|
|
21
|
-
/** Optional fallback content to show during hydration */
|
|
22
|
-
hydrationFallback?: React.ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Optional delay in milliseconds before considering the component hydrated
|
|
25
|
-
* This can help with "flash of content" issues
|
|
26
|
-
*/
|
|
27
|
-
hydrationDelay?: number;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* HydrationGuard - Component to handle SSR hydration
|
|
31
|
-
*
|
|
32
|
-
* This component helps manage the transition between server-rendered content
|
|
33
|
-
* and client-side hydration, allowing different content to be shown during
|
|
34
|
-
* different stages of the hydration process.
|
|
35
|
-
*/
|
|
36
|
-
export declare const HydrationGuard: React.FC<IHydrationGuardProps>;
|
|
37
|
-
/**
|
|
38
|
-
* Hook to get the current hydration state
|
|
39
|
-
*
|
|
40
|
-
* Use this hook to conditionally run code based on whether the component
|
|
41
|
-
* is being rendered on the server or has been hydrated on the client.
|
|
42
|
-
*
|
|
43
|
-
* @param hydrationDelay Optional delay before considering the component hydrated
|
|
44
|
-
* @returns Current hydration state
|
|
45
|
-
*/
|
|
46
|
-
export declare const useHydration: (hydrationDelay?: number) => IHydrationState;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mfe-shared - Core library for micro-frontend communication and shared state
|
|
3
|
-
*
|
|
4
|
-
* This module provides a standardized way for micro-frontends to communicate and share state.
|
|
5
|
-
* Only the public API is exported here, internal implementation details are hidden.
|
|
6
|
-
*/
|
|
7
|
-
export { mfeBridge } from './mfe-bridge';
|
|
8
|
-
export { MfeAuthProvider } from './auth';
|
|
9
|
-
export type { IMfeAuthProviderProps, ILoginParams, ILoginResponse } from './auth';
|
|
10
|
-
export { useMfeAuth } from './auth';
|
|
11
|
-
export type { IAuthState, IUser } from './auth.types';
|
|
12
|
-
export { AUTH_CHANNELS } from './auth.types';
|
|
13
|
-
export { SsrAuthProvider } from './auth.ssr';
|
|
14
|
-
export { useMfeNavigate, MfeLink, MfeNavigateProvider } from './navigation';
|
|
15
|
-
export type { IMfeNavigate, IMfeLinkProps, NavigateFunction, AppSite, IMfeNavigateProviderProps } from './navigation';
|
|
16
|
-
export { NAVIGATION_CHANNELS } from './navigation';
|
|
17
|
-
export { isBrowser } from './environment';
|
|
18
|
-
export { HydrationGuard, useHydration } from './hydration-helper';
|
|
19
|
-
export type { IHydrationState } from './hydration-helper';
|
|
20
|
-
export { MfeAuthDebugPanel } from './auth.debug';
|
|
21
|
-
export { MfeNavigateDebugPanel } from './navigation.debug';
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Callback function type for event subscribers
|
|
3
|
-
* @template T Type of payload data
|
|
4
|
-
*/
|
|
5
|
-
type ICallback<T = any> = (payload: T) => void;
|
|
6
|
-
/**
|
|
7
|
-
* Middleware function type for intercepting events
|
|
8
|
-
* @returns boolean|void Return false to cancel event propagation
|
|
9
|
-
*/
|
|
10
|
-
type IMiddleware = (channel: string, payload: any) => boolean | void;
|
|
11
|
-
/**
|
|
12
|
-
* MfeBridge - Event-based communication system for micro-frontends
|
|
13
|
-
*
|
|
14
|
-
* This class provides a way for different micro-frontends to communicate
|
|
15
|
-
* with each other via a publish/subscribe pattern using CustomEvents.
|
|
16
|
-
* Includes SSR compatibility checks.
|
|
17
|
-
*/
|
|
18
|
-
declare class MfeBridge {
|
|
19
|
-
private middlewares;
|
|
20
|
-
/**
|
|
21
|
-
* Subscribe to events on a specific channel
|
|
22
|
-
* @template T Type of payload data
|
|
23
|
-
* @param channel The channel to subscribe to
|
|
24
|
-
* @param callback Function to call when an event occurs on this channel
|
|
25
|
-
* @returns Unsubscribe function to remove the event listener
|
|
26
|
-
*/
|
|
27
|
-
subscribe<T = any>(channel: string, callback: ICallback<T>): () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Publish an event to a specific channel
|
|
30
|
-
* @template T Type of payload data
|
|
31
|
-
* @param channel The channel to publish to
|
|
32
|
-
* @param payload Data to send with the event
|
|
33
|
-
*/
|
|
34
|
-
publish<T = any>(channel: string, payload: T): void;
|
|
35
|
-
/**
|
|
36
|
-
* Add middleware to intercept events before they're published
|
|
37
|
-
* @param middleware Function that can inspect or modify events
|
|
38
|
-
*/
|
|
39
|
-
use(middleware: IMiddleware): void;
|
|
40
|
-
/**
|
|
41
|
-
* Remove all middleware
|
|
42
|
-
*/
|
|
43
|
-
clearMiddlewares(): void;
|
|
44
|
-
}
|
|
45
|
-
export declare const mfeBridge: MfeBridge;
|
|
46
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type AnchorHTMLAttributes, type FC } from 'react';
|
|
2
|
-
export declare const NAVIGATION_CHANNELS: {
|
|
3
|
-
NAVIGATE: string;
|
|
4
|
-
};
|
|
5
|
-
export type AppSite = 'client' | 'home' | 'music' | 'api';
|
|
6
|
-
export type IMfeNavigateHref = {
|
|
7
|
-
primaryHref: string;
|
|
8
|
-
secondaryHref?: string;
|
|
9
|
-
};
|
|
10
|
-
export interface IMfeNavigate {
|
|
11
|
-
primaryHref: string;
|
|
12
|
-
secondaryHref?: string;
|
|
13
|
-
internal?: boolean;
|
|
14
|
-
site?: AppSite;
|
|
15
|
-
options?: any;
|
|
16
|
-
target?: '_self' | '_blank';
|
|
17
|
-
}
|
|
18
|
-
export declare const useMfeNavigate: () => {
|
|
19
|
-
navigate: (params: IMfeNavigate) => void;
|
|
20
|
-
};
|
|
21
|
-
export interface IMfeLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
|
|
22
|
-
internal?: boolean;
|
|
23
|
-
primaryHref: string;
|
|
24
|
-
secondaryHref?: string;
|
|
25
|
-
}
|
|
26
|
-
export declare const MfeLink: FC<IMfeLinkProps>;
|
|
27
|
-
export type NavigateFunction<O = any> = (path: string, options?: O) => void;
|
|
28
|
-
export interface IMfeNavigateProviderProps {
|
|
29
|
-
navigate: NavigateFunction;
|
|
30
|
-
}
|
|
31
|
-
export declare const MfeNavigateProvider: FC<IMfeNavigateProviderProps>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for mfe-shared library
|
|
3
|
-
*
|
|
4
|
-
* This file is used to re-export all types from the library
|
|
5
|
-
* to ensure they're available to consumers.
|
|
6
|
-
*/
|
|
7
|
-
export type { IAuthState, IUser } from './auth.types';
|
|
8
|
-
export type { IMfeAuthProviderProps as IAuthProviderProps, ILoginParams, ILoginResponse } from './auth';
|
|
9
|
-
export type { AppSite, IMfeNavigate, IMfeNavigateHref, IMfeLinkProps, NavigateFunction, IMfeNavigateProviderProps } from './navigation';
|
|
10
|
-
export type { IHydrationState } from './hydration-helper';
|