@gears-frontx/react 0.1.0 → 0.2.0-alpha.15

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/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,174 +17,194 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
21
31
  var src_exports = {};
22
32
  __export(src_exports, {
23
- ACCOUNTS_DOMAIN: () => import_framework6.ACCOUNTS_DOMAIN,
24
- ApiPlugin: () => import_framework6.ApiPlugin,
25
- ApiPluginBase: () => import_framework6.ApiPluginBase,
26
- ApiProtocol: () => import_framework6.ApiProtocol,
27
- BaseApiService: () => import_framework6.BaseApiService,
28
- ContainerProvider: () => import_framework15.ContainerProvider,
33
+ ACCOUNTS_DOMAIN: () => import_framework4.ACCOUNTS_DOMAIN,
34
+ ActionHandler: () => import_framework13.ActionHandler,
35
+ ApiPlugin: () => import_framework4.ApiPlugin,
36
+ ApiPluginBase: () => import_framework4.ApiPluginBase,
37
+ ApiProtocol: () => import_framework4.ApiProtocol,
38
+ AuthEvents: () => import_framework4.AuthEvents,
39
+ BaseApiService: () => import_framework4.BaseApiService,
40
+ CanAccess: () => CanAccess,
41
+ ChildMfeBridge: () => import_framework13.ChildMfeBridge,
42
+ ConcurrentMountStrategy: () => import_framework13.ConcurrentMountStrategy,
43
+ ExclusiveMountStrategy: () => import_framework13.ExclusiveMountStrategy,
44
+ ExtensionDomainImplementation: () => import_framework13.ExtensionDomainImplementation,
45
+ ExtensionDomainImplementationFactory: () => import_framework13.ExtensionDomainImplementationFactory,
29
46
  ExtensionDomainSlot: () => ExtensionDomainSlot,
30
- FRONTX_ACTION_LOAD_EXT: () => import_framework13.FRONTX_ACTION_LOAD_EXT,
31
- FRONTX_ACTION_MOUNT_EXT: () => import_framework13.FRONTX_ACTION_MOUNT_EXT,
32
- FRONTX_ACTION_UNMOUNT_EXT: () => import_framework13.FRONTX_ACTION_UNMOUNT_EXT,
33
- FRONTX_MFE_ENTRY_MF: () => import_framework12.FRONTX_MFE_ENTRY_MF,
34
- FRONTX_OVERLAY_DOMAIN: () => import_framework11.FRONTX_OVERLAY_DOMAIN,
35
- FRONTX_POPUP_DOMAIN: () => import_framework11.FRONTX_POPUP_DOMAIN,
36
- FRONTX_SCREEN_DOMAIN: () => import_framework11.FRONTX_SCREEN_DOMAIN,
37
- FRONTX_SCREEN_EXTENSION_TYPE: () => import_framework12.FRONTX_SCREEN_EXTENSION_TYPE,
38
- FRONTX_SHARED_PROPERTY_LANGUAGE: () => import_framework14.FRONTX_SHARED_PROPERTY_LANGUAGE,
39
- FRONTX_SHARED_PROPERTY_THEME: () => import_framework14.FRONTX_SHARED_PROPERTY_THEME,
40
- FRONTX_SIDEBAR_DOMAIN: () => import_framework11.FRONTX_SIDEBAR_DOMAIN,
41
- HAI3Context: () => HAI3Context,
42
- HAI3Provider: () => HAI3Provider,
43
- I18nRegistry: () => import_framework6.I18nRegistry,
44
- I18nRegistryImpl: () => import_framework6.I18nRegistryImpl,
45
- LAYOUT_SLICE_NAME: () => import_framework6.LAYOUT_SLICE_NAME,
46
- Language: () => import_framework7.Language,
47
- LanguageDisplayMode: () => import_framework7.LanguageDisplayMode,
48
- LayoutDomain: () => import_framework6.LayoutDomain,
49
- MOCK_PLUGIN: () => import_framework6.MOCK_PLUGIN,
50
- MfeBridgeFactory: () => import_framework15.MfeBridgeFactory,
47
+ ExtensionMounter: () => import_framework13.ExtensionMounter,
48
+ FRONTX_ACTION_LOAD_EXT: () => import_framework11.FRONTX_ACTION_LOAD_EXT,
49
+ FRONTX_ACTION_MOUNT_EXT: () => import_framework11.FRONTX_ACTION_MOUNT_EXT,
50
+ FRONTX_ACTION_UNMOUNT_EXT: () => import_framework11.FRONTX_ACTION_UNMOUNT_EXT,
51
+ FRONTX_MFE_ENTRY_MF: () => import_framework10.FRONTX_MFE_ENTRY_MF,
52
+ FRONTX_OVERLAY_DOMAIN: () => import_framework9.FRONTX_OVERLAY_DOMAIN,
53
+ FRONTX_POPUP_DOMAIN: () => import_framework9.FRONTX_POPUP_DOMAIN,
54
+ FRONTX_SCREEN_DOMAIN: () => import_framework9.FRONTX_SCREEN_DOMAIN,
55
+ FRONTX_SCREEN_EXTENSION_TYPE: () => import_framework10.FRONTX_SCREEN_EXTENSION_TYPE,
56
+ FRONTX_SHARED_PROPERTY_LANGUAGE: () => import_framework12.FRONTX_SHARED_PROPERTY_LANGUAGE,
57
+ FRONTX_SHARED_PROPERTY_THEME: () => import_framework12.FRONTX_SHARED_PROPERTY_THEME,
58
+ FRONTX_SIDEBAR_DOMAIN: () => import_framework9.FRONTX_SIDEBAR_DOMAIN,
59
+ FrontXContext: () => FrontXContext,
60
+ FrontXProvider: () => FrontXProvider,
61
+ I18nRegistry: () => import_framework4.I18nRegistry,
62
+ I18nRegistryImpl: () => import_framework4.I18nRegistryImpl,
63
+ LAYOUT_SLICE_NAME: () => import_framework4.LAYOUT_SLICE_NAME,
64
+ Language: () => import_framework5.Language,
65
+ LanguageDisplayMode: () => import_framework5.LanguageDisplayMode,
66
+ MOCK_PLUGIN: () => import_framework4.MOCK_PLUGIN,
67
+ MfeBridgeFactory: () => import_framework13.MfeBridgeFactory,
51
68
  MfeContext: () => MfeContext,
52
- MfeHandler: () => import_framework15.MfeHandler,
53
- MfeHandlerMF: () => import_framework16.MfeHandlerMF,
69
+ MfeHandler: () => import_framework13.MfeHandler,
70
+ MfeHandlerMF: () => import_framework14.MfeHandlerMF,
54
71
  MfeProvider: () => MfeProvider,
55
- MockEventSource: () => import_framework6.MockEventSource,
56
- MockEvents: () => import_framework6.MockEvents,
57
- RefContainerProvider: () => RefContainerProvider,
58
- RestMockPlugin: () => import_framework6.RestMockPlugin,
59
- RestPlugin: () => import_framework6.RestPlugin,
60
- RestPluginWithConfig: () => import_framework6.RestPluginWithConfig,
61
- RestProtocol: () => import_framework6.RestProtocol,
62
- SUPPORTED_LANGUAGES: () => import_framework6.SUPPORTED_LANGUAGES,
63
- ScreensetsRegistry: () => import_framework15.ScreensetsRegistry,
64
- ScreensetsRegistryFactory: () => import_framework15.ScreensetsRegistryFactory,
65
- SseMockPlugin: () => import_framework6.SseMockPlugin,
66
- SsePlugin: () => import_framework6.SsePlugin,
67
- SsePluginWithConfig: () => import_framework6.SsePluginWithConfig,
68
- SseProtocol: () => import_framework6.SseProtocol,
69
- TENANT_SLICE_NAME: () => import_framework6.TENANT_SLICE_NAME,
70
- TenantEvents: () => import_framework6.TenantEvents,
71
- TextDirection: () => import_framework7.TextDirection,
72
- apiRegistry: () => import_framework6.apiRegistry,
73
- changeTenant: () => import_framework6.changeTenant,
74
- clearActiveScreen: () => import_framework6.clearActiveScreen,
75
- clearTenant: () => import_framework6.clearTenant,
76
- clearTenantAction: () => import_framework6.clearTenantAction,
77
- clearUser: () => import_framework6.clearUser,
78
- closeAllPopups: () => import_framework6.closeAllPopups,
79
- closePopup: () => import_framework6.closePopup,
80
- closeTopPopup: () => import_framework6.closeTopPopup,
81
- createHAI3: () => import_framework6.createHAI3,
82
- createHAI3App: () => import_framework6.createHAI3App,
83
- createI18nRegistry: () => import_framework6.createI18nRegistry,
84
- createShadowRoot: () => import_framework18.createShadowRoot,
85
- createSlice: () => import_framework6.createSlice,
86
- createStore: () => import_framework6.createStore,
87
- createThemeRegistry: () => import_framework6.createThemeRegistry,
88
- effects: () => import_framework6.effects,
89
- eventBus: () => eventBus,
90
- extensionScreenSchema: () => import_framework17.extensionScreenSchema,
91
- extractGtsPackage: () => import_framework18.extractGtsPackage,
92
- footerActions: () => import_framework6.footerActions,
93
- footerSlice: () => import_framework6.footerSlice,
94
- getLanguageMetadata: () => import_framework6.getLanguageMetadata,
95
- getStore: () => import_framework6.getStore,
96
- gtsPlugin: () => import_framework16.gtsPlugin,
97
- hasSlice: () => import_framework6.hasSlice,
98
- headerActions: () => import_framework6.headerActions,
99
- headerSlice: () => import_framework6.headerSlice,
100
- hideOverlay: () => import_framework6.hideOverlay,
101
- i18n: () => import_framework6.i18n,
102
- i18nRegistry: () => import_framework6.i18nRegistry,
103
- initMockEffects: () => import_framework6.initMockEffects,
104
- initTenantEffects: () => import_framework6.initTenantEffects,
105
- injectCssVariables: () => import_framework18.injectCssVariables,
106
- isMockPlugin: () => import_framework6.isMockPlugin,
107
- isRestShortCircuit: () => import_framework6.isRestShortCircuit,
108
- isShortCircuit: () => import_framework6.isShortCircuit,
109
- isSseShortCircuit: () => import_framework6.isSseShortCircuit,
110
- languageSchema: () => import_framework17.languageSchema,
111
- layout: () => import_framework6.layout,
112
- layoutDomainReducers: () => import_framework6.layoutDomainReducers,
113
- layoutReducer: () => import_framework6.layoutReducer,
114
- loadExtension: () => import_framework9.loadExtension,
115
- menuActions: () => import_framework6.menuActions,
116
- menuSlice: () => import_framework6.menuSlice,
117
- microfrontends: () => import_framework8.microfrontends,
118
- mock: () => import_framework8.mock,
119
- mockActions: () => import_framework6.mockActions,
120
- mockSlice: () => import_framework6.mockSlice,
121
- mountExtension: () => import_framework9.mountExtension,
122
- navigateTo: () => import_framework6.navigateTo,
123
- openPopup: () => import_framework6.openPopup,
124
- overlayActions: () => import_framework6.overlayActions,
125
- overlayDomain: () => import_framework11.overlayDomain,
126
- overlaySlice: () => import_framework6.overlaySlice,
127
- popupActions: () => import_framework6.popupActions,
128
- popupDomain: () => import_framework11.popupDomain,
129
- popupSlice: () => import_framework6.popupSlice,
130
- presets: () => import_framework6.presets,
131
- registerExtension: () => import_framework9.registerExtension,
132
- registerSlice: () => import_framework6.registerSlice,
133
- screenActions: () => import_framework6.screenActions,
134
- screenDomain: () => import_framework11.screenDomain,
135
- screenSlice: () => import_framework6.screenSlice,
136
- screensets: () => import_framework6.screensets,
137
- screensetsRegistryFactory: () => import_framework15.screensetsRegistryFactory,
138
- selectExtensionError: () => import_framework10.selectExtensionError,
139
- selectExtensionState: () => import_framework10.selectExtensionState,
140
- selectRegisteredExtensions: () => import_framework10.selectRegisteredExtensions,
141
- setActiveScreen: () => import_framework6.setActiveScreen,
142
- setFooterConfig: () => import_framework6.setFooterConfig,
143
- setFooterVisible: () => import_framework6.setFooterVisible,
144
- setHeaderLoading: () => import_framework6.setHeaderLoading,
145
- setMenuCollapsed: () => import_framework6.setMenuCollapsed,
146
- setMenuConfig: () => import_framework6.setMenuConfig,
147
- setMenuItems: () => import_framework6.setMenuItems,
148
- setMenuVisible: () => import_framework6.setMenuVisible,
149
- setMockEnabled: () => import_framework6.setMockEnabled,
150
- setOverlayVisible: () => import_framework6.setOverlayVisible,
151
- setScreenLoading: () => import_framework6.setScreenLoading,
152
- setSidebarCollapsed: () => import_framework6.setSidebarCollapsed,
153
- setSidebarConfig: () => import_framework6.setSidebarConfig,
154
- setSidebarContent: () => import_framework6.setSidebarContent,
155
- setSidebarPosition: () => import_framework6.setSidebarPosition,
156
- setSidebarTitle: () => import_framework6.setSidebarTitle,
157
- setSidebarVisible: () => import_framework6.setSidebarVisible,
158
- setSidebarWidth: () => import_framework6.setSidebarWidth,
159
- setTenant: () => import_framework6.setTenant,
160
- setTenantLoading: () => import_framework6.setTenantLoading,
161
- setTenantLoadingState: () => import_framework6.setTenantLoadingState,
162
- setUser: () => import_framework6.setUser,
163
- showOverlay: () => import_framework6.showOverlay,
164
- sidebarActions: () => import_framework6.sidebarActions,
165
- sidebarDomain: () => import_framework11.sidebarDomain,
166
- sidebarSlice: () => import_framework6.sidebarSlice,
167
- tenantActions: () => import_framework6.tenantActions,
168
- tenantReducer: () => import_framework6.tenantReducer,
169
- tenantSlice: () => import_framework6.tenantSlice,
170
- themeSchema: () => import_framework17.themeSchema,
171
- themes: () => import_framework6.themes,
172
- toggleMenu: () => import_framework6.toggleMenu,
173
- toggleMockMode: () => import_framework6.toggleMockMode,
174
- toggleSidebar: () => import_framework6.toggleSidebar,
175
- unmountExtension: () => import_framework9.unmountExtension,
176
- unregisterExtension: () => import_framework9.unregisterExtension,
177
- useActivePackage: () => useActivePackage,
72
+ MfeRegistry: () => import_framework13.MfeRegistry,
73
+ MfeRegistryFactory: () => import_framework13.MfeRegistryFactory,
74
+ MockEvents: () => import_framework4.MockEvents,
75
+ MountStrategy: () => import_framework13.MountStrategy,
76
+ OptionalMountStrategy: () => import_framework13.OptionalMountStrategy,
77
+ ParentMfeBridge: () => import_framework13.ParentMfeBridge,
78
+ RestEndpointProtocol: () => import_framework4.RestEndpointProtocol,
79
+ RestPlugin: () => import_framework4.RestPlugin,
80
+ RestPluginWithConfig: () => import_framework4.RestPluginWithConfig,
81
+ RestProtocol: () => import_framework4.RestProtocol,
82
+ SUPPORTED_LANGUAGES: () => import_framework4.SUPPORTED_LANGUAGES,
83
+ SsePlugin: () => import_framework4.SsePlugin,
84
+ SsePluginWithConfig: () => import_framework4.SsePluginWithConfig,
85
+ SseProtocol: () => import_framework4.SseProtocol,
86
+ SseStreamProtocol: () => import_framework4.SseStreamProtocol,
87
+ TENANT_SLICE_NAME: () => import_framework4.TENANT_SLICE_NAME,
88
+ TenantEvents: () => import_framework4.TenantEvents,
89
+ TextDirection: () => import_framework5.TextDirection,
90
+ ThemeAwareReactLifecycle: () => ThemeAwareReactLifecycle,
91
+ apiRegistry: () => import_framework4.apiRegistry,
92
+ auth: () => import_framework4.auth,
93
+ changeTenant: () => import_framework4.changeTenant,
94
+ clearTenant: () => import_framework4.clearTenant,
95
+ clearTenantAction: () => import_framework4.clearTenantAction,
96
+ clearUser: () => import_framework4.clearUser,
97
+ closeAllPopups: () => import_framework4.closeAllPopups,
98
+ closePopup: () => import_framework4.closePopup,
99
+ closeTopPopup: () => import_framework4.closeTopPopup,
100
+ createFrontX: () => import_framework4.createFrontX,
101
+ createI18nRegistry: () => import_framework4.createI18nRegistry,
102
+ createShadowRoot: () => import_framework15.createShadowRoot,
103
+ createSlice: () => import_framework4.createSlice,
104
+ createStore: () => import_framework4.createStore,
105
+ createThemeRegistry: () => import_framework4.createThemeRegistry,
106
+ effects: () => import_framework4.effects,
107
+ eventBus: () => eventBus2,
108
+ extractGtsPackage: () => import_framework15.extractGtsPackage,
109
+ footerActions: () => import_framework4.footerActions,
110
+ footerSlice: () => import_framework4.footerSlice,
111
+ frontxApiTransport: () => import_framework4.frontxApiTransport,
112
+ getLanguageMetadata: () => import_framework4.getLanguageMetadata,
113
+ getStore: () => import_framework4.getStore,
114
+ gtsPlugin: () => import_framework14.gtsPlugin,
115
+ hasSlice: () => import_framework4.hasSlice,
116
+ headerActions: () => import_framework4.headerActions,
117
+ headerSlice: () => import_framework4.headerSlice,
118
+ hideOverlay: () => import_framework4.hideOverlay,
119
+ i18n: () => import_framework4.i18n,
120
+ i18nRegistry: () => import_framework4.i18nRegistry,
121
+ initMockEffects: () => import_framework4.initMockEffects,
122
+ initTenantEffects: () => import_framework4.initTenantEffects,
123
+ injectCssVariables: () => import_framework15.injectCssVariables,
124
+ invalidateQueryCacheForApp: () => invalidateQueryCacheForApp,
125
+ isMockPlugin: () => import_framework4.isMockPlugin,
126
+ isRestShortCircuit: () => import_framework4.isRestShortCircuit,
127
+ isShortCircuit: () => import_framework4.isShortCircuit,
128
+ isSseShortCircuit: () => import_framework4.isSseShortCircuit,
129
+ layout: () => import_framework4.layout,
130
+ layoutDomainReducers: () => import_framework4.layoutDomainReducers,
131
+ layoutReducer: () => import_framework4.layoutReducer,
132
+ loadExtension: () => import_framework7.loadExtension,
133
+ menuActions: () => import_framework4.menuActions,
134
+ menuSlice: () => import_framework4.menuSlice,
135
+ mfeRegistryFactory: () => import_framework13.mfeRegistryFactory,
136
+ microfrontends: () => import_framework6.microfrontends,
137
+ mock: () => import_framework6.mock,
138
+ mockActions: () => import_framework4.mockActions,
139
+ mockSlice: () => import_framework4.mockSlice,
140
+ mountExtension: () => import_framework7.mountExtension,
141
+ openPopup: () => import_framework4.openPopup,
142
+ overlayActions: () => import_framework4.overlayActions,
143
+ overlayDomain: () => import_framework9.overlayDomain,
144
+ overlaySlice: () => import_framework4.overlaySlice,
145
+ popupActions: () => import_framework4.popupActions,
146
+ popupDomain: () => import_framework9.popupDomain,
147
+ popupSlice: () => import_framework4.popupSlice,
148
+ presets: () => import_framework4.presets,
149
+ queryCache: () => import_framework4.queryCache,
150
+ queryCacheShared: () => import_framework4.queryCacheShared,
151
+ registerExtension: () => import_framework7.registerExtension,
152
+ registerSlice: () => import_framework4.registerSlice,
153
+ screenDomain: () => import_framework9.screenDomain,
154
+ selectExtensionError: () => import_framework8.selectExtensionError,
155
+ selectExtensionState: () => import_framework8.selectExtensionState,
156
+ selectRegisteredExtensions: () => import_framework8.selectRegisteredExtensions,
157
+ setFooterConfig: () => import_framework4.setFooterConfig,
158
+ setFooterVisible: () => import_framework4.setFooterVisible,
159
+ setHeaderLoading: () => import_framework4.setHeaderLoading,
160
+ setMenuCollapsed: () => import_framework4.setMenuCollapsed,
161
+ setMenuConfig: () => import_framework4.setMenuConfig,
162
+ setMenuItems: () => import_framework4.setMenuItems,
163
+ setMenuVisible: () => import_framework4.setMenuVisible,
164
+ setMockEnabled: () => import_framework4.setMockEnabled,
165
+ setOverlayVisible: () => import_framework4.setOverlayVisible,
166
+ setSidebarCollapsed: () => import_framework4.setSidebarCollapsed,
167
+ setSidebarConfig: () => import_framework4.setSidebarConfig,
168
+ setSidebarContent: () => import_framework4.setSidebarContent,
169
+ setSidebarPosition: () => import_framework4.setSidebarPosition,
170
+ setSidebarTitle: () => import_framework4.setSidebarTitle,
171
+ setSidebarVisible: () => import_framework4.setSidebarVisible,
172
+ setSidebarWidth: () => import_framework4.setSidebarWidth,
173
+ setTenant: () => import_framework4.setTenant,
174
+ setTenantLoading: () => import_framework4.setTenantLoading,
175
+ setTenantLoadingState: () => import_framework4.setTenantLoadingState,
176
+ setUser: () => import_framework4.setUser,
177
+ showOverlay: () => import_framework4.showOverlay,
178
+ sidebarActions: () => import_framework4.sidebarActions,
179
+ sidebarDomain: () => import_framework9.sidebarDomain,
180
+ sidebarSlice: () => import_framework4.sidebarSlice,
181
+ subscribeQueryCacheRuntimeChanged: () => import_framework4.subscribeQueryCacheRuntimeChanged,
182
+ tenantActions: () => import_framework4.tenantActions,
183
+ tenantReducer: () => import_framework4.tenantReducer,
184
+ tenantSlice: () => import_framework4.tenantSlice,
185
+ themes: () => import_framework4.themes,
186
+ toggleMenu: () => import_framework4.toggleMenu,
187
+ toggleMockMode: () => import_framework4.toggleMockMode,
188
+ toggleSidebar: () => import_framework4.toggleSidebar,
189
+ unmountExtension: () => import_framework7.unmountExtension,
190
+ unregisterExtension: () => import_framework7.unregisterExtension,
191
+ useApiInfiniteQuery: () => useApiInfiniteQuery,
192
+ useApiMutation: () => useApiMutation,
193
+ useApiQuery: () => useApiQuery,
194
+ useApiStream: () => useApiStream,
195
+ useApiSuspenseInfiniteQuery: () => useApiSuspenseInfiniteQuery,
196
+ useApiSuspenseQuery: () => useApiSuspenseQuery,
178
197
  useAppDispatch: () => useAppDispatch,
179
198
  useAppSelector: () => useAppSelector,
199
+ useCanAccess: () => useCanAccess,
180
200
  useDomainExtensions: () => useDomainExtensions,
181
201
  useFormatters: () => useFormatters,
182
- useHAI3: () => useHAI3,
202
+ useFrontX: () => useFrontX,
183
203
  useHostAction: () => useHostAction,
184
204
  useMfeBridge: () => useMfeBridge,
185
205
  useMfeContext: () => useMfeContext,
206
+ useMfeRegistry: () => useMfeRegistry,
207
+ useQueryCache: () => useQueryCache,
186
208
  useRegisteredPackages: () => useRegisteredPackages,
187
209
  useScreenTranslations: () => useScreenTranslations,
188
210
  useSharedProperty: () => useSharedProperty,
@@ -191,19 +213,18 @@ __export(src_exports, {
191
213
  });
192
214
  module.exports = __toCommonJS(src_exports);
193
215
 
194
- // src/HAI3Provider.tsx
195
- var import_react3 = require("react");
216
+ // src/FrontXProvider.tsx
217
+ var import_react5 = require("react");
196
218
  var import_react_redux = require("react-redux");
197
- var import_framework = require("@gears-frontx/framework");
198
219
 
199
- // src/HAI3Context.tsx
220
+ // src/FrontXContext.tsx
200
221
  var import_react = require("react");
201
- var HAI3Context = (0, import_react.createContext)(null);
202
- function useHAI3() {
203
- const context = (0, import_react.useContext)(HAI3Context);
222
+ var FrontXContext = (0, import_react.createContext)(null);
223
+ function useFrontX() {
224
+ const context = (0, import_react.useContext)(FrontXContext);
204
225
  if (!context) {
205
226
  throw new Error(
206
- "useHAI3 must be used within a HAI3Provider. Wrap your application with <HAI3Provider> to access HAI3 features."
227
+ "useFrontX must be used within a FrontXProvider. Wrap your application with <FrontXProvider> to access Gears FrontX features."
207
228
  );
208
229
  }
209
230
  return context;
@@ -228,34 +249,625 @@ var MfeProvider = ({ value, children }) => {
228
249
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MfeContext.Provider, { value, children });
229
250
  };
230
251
 
231
- // src/HAI3Provider.tsx
232
- var import_jsx_runtime2 = require("react/jsx-runtime");
233
- var HAI3Provider = ({
234
- children,
235
- config,
236
- app: providedApp,
237
- mfeBridge
238
- }) => {
239
- const app = (0, import_react3.useMemo)(() => {
240
- if (providedApp) {
241
- return providedApp;
252
+ // src/queryClient.tsx
253
+ var import_react4 = __toESM(require("react"), 1);
254
+ var import_react_query = require("@tanstack/react-query");
255
+ var import_framework2 = require("@gears-frontx/framework");
256
+
257
+ // src/hooks/QueryCache.ts
258
+ var import_framework = require("@gears-frontx/framework");
259
+ var QUERY_CLIENT_BROADCAST_TARGET = /* @__PURE__ */ Symbol.for("frontx:query-cache:broadcast-target");
260
+ var QUERY_CLIENT_BROADCAST_COUNTER = /* @__PURE__ */ Symbol.for("frontx:query-cache:broadcast-counter");
261
+ function emitCacheEvent(event, payload) {
262
+ import_framework.eventBus.emit(event, payload);
263
+ }
264
+ function ensureBroadcastSource(queryClient) {
265
+ const clientWithMetadata = queryClient;
266
+ const existingSource = clientWithMetadata[QUERY_CLIENT_BROADCAST_TARGET];
267
+ if (typeof existingSource === "string" && existingSource.length > 0) {
268
+ return existingSource;
269
+ }
270
+ const host = globalThis;
271
+ const nextCounter = (host[QUERY_CLIENT_BROADCAST_COUNTER] ?? 0) + 1;
272
+ host[QUERY_CLIENT_BROADCAST_COUNTER] = nextCounter;
273
+ const source = `query-cache-${nextCounter}`;
274
+ clientWithMetadata[QUERY_CLIENT_BROADCAST_TARGET] = source;
275
+ return source;
276
+ }
277
+ function resolveKey(target) {
278
+ if (target !== null && typeof target === "object" && !Array.isArray(target) && "key" in target && "fetch" in target && Array.isArray(target.key) && typeof target.fetch === "function") {
279
+ return target.key;
280
+ }
281
+ return target;
282
+ }
283
+ function toQueryUpdater(dataOrUpdater) {
284
+ if (typeof dataOrUpdater === "function") {
285
+ return dataOrUpdater;
286
+ }
287
+ return () => dataOrUpdater;
288
+ }
289
+ function mapQueryState(state) {
290
+ return {
291
+ data: state.data,
292
+ dataUpdatedAt: state.dataUpdatedAt,
293
+ error: state.error,
294
+ errorUpdatedAt: state.errorUpdatedAt,
295
+ fetchFailureCount: state.fetchFailureCount,
296
+ fetchFailureReason: state.fetchFailureReason,
297
+ fetchStatus: state.fetchStatus,
298
+ isInvalidated: state.isInvalidated,
299
+ status: state.status
300
+ };
301
+ }
302
+ function createQueryCache(queryClient) {
303
+ return {
304
+ get: (key) => {
305
+ return queryClient.getQueryData(resolveKey(key));
306
+ },
307
+ getState: (key) => {
308
+ const state = queryClient.getQueryState(resolveKey(key));
309
+ return state ? mapQueryState(state) : void 0;
310
+ },
311
+ set: (key, dataOrUpdater) => {
312
+ const resolvedKey = resolveKey(key);
313
+ queryClient.setQueryData(resolvedKey, toQueryUpdater(dataOrUpdater));
314
+ emitCacheEvent("cache/set", {
315
+ queryKey: resolvedKey,
316
+ dataOrUpdater,
317
+ source: ensureBroadcastSource(queryClient)
318
+ });
319
+ },
320
+ cancel: (key) => {
321
+ return queryClient.cancelQueries({ queryKey: resolveKey(key) });
322
+ },
323
+ invalidate: (key) => {
324
+ const resolvedKey = resolveKey(key);
325
+ const result = queryClient.invalidateQueries({ queryKey: resolvedKey });
326
+ emitCacheEvent("cache/invalidate", {
327
+ queryKey: resolvedKey,
328
+ source: ensureBroadcastSource(queryClient)
329
+ });
330
+ return result;
331
+ },
332
+ invalidateMany: (filters) => {
333
+ if (filters?.queryKey == null) {
334
+ return Promise.resolve();
335
+ }
336
+ const resolvedKey = resolveKey(filters.queryKey);
337
+ if (!Array.isArray(resolvedKey) || resolvedKey.length === 0) {
338
+ return Promise.resolve();
339
+ }
340
+ const payload = {
341
+ ...filters,
342
+ queryKey: resolvedKey
343
+ };
344
+ const result = queryClient.invalidateQueries(payload);
345
+ emitCacheEvent("cache/invalidate", {
346
+ ...payload,
347
+ source: ensureBroadcastSource(queryClient)
348
+ });
349
+ return result;
350
+ },
351
+ remove: (key) => {
352
+ const resolvedKey = resolveKey(key);
353
+ queryClient.removeQueries({ queryKey: resolvedKey });
354
+ emitCacheEvent("cache/remove", {
355
+ queryKey: resolvedKey,
356
+ source: ensureBroadcastSource(queryClient)
357
+ });
242
358
  }
243
- return (0, import_framework.createHAI3App)(config);
244
- }, [providedApp, config]);
359
+ };
360
+ }
361
+
362
+ // src/hooks/useLatest.ts
363
+ var import_react3 = require("react");
364
+ function useLatest(value) {
365
+ const ref = (0, import_react3.useRef)(value);
245
366
  (0, import_react3.useEffect)(() => {
367
+ ref.current = value;
368
+ });
369
+ return ref;
370
+ }
371
+
372
+ // src/queryClient.tsx
373
+ var import_jsx_runtime2 = require("react/jsx-runtime");
374
+ var APP_QUERY_CLIENT_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client");
375
+ var APP_QUERY_CLIENT_RESOLVER_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client-resolver");
376
+ var APP_QUERY_CLIENT_ACTIVATOR_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client-activator");
377
+ var FrontXQueryClientContext = (0, import_react4.createContext)(void 0);
378
+ var useCommitEffect = typeof globalThis.window === "undefined" ? import_react4.useEffect : import_react4.useLayoutEffect;
379
+ function resolveFrontXQueryClient(app) {
380
+ const clientApp = app;
381
+ return clientApp[APP_QUERY_CLIENT_SYMBOL] ?? clientApp[APP_QUERY_CLIENT_RESOLVER_SYMBOL]?.();
382
+ }
383
+ function hasFrontXQueryClientActivator(app) {
384
+ return typeof app[APP_QUERY_CLIENT_ACTIVATOR_SYMBOL] === "function";
385
+ }
386
+ function activateFrontXQueryClient(app) {
387
+ const clientApp = app;
388
+ return clientApp[APP_QUERY_CLIENT_SYMBOL] ?? clientApp[APP_QUERY_CLIENT_ACTIVATOR_SYMBOL]?.();
389
+ }
390
+ async function invalidateQueryCacheForApp(app, target) {
391
+ const queryClient = resolveFrontXQueryClient(app) ?? activateFrontXQueryClient(app);
392
+ if (!queryClient) {
393
+ throw new Error(
394
+ "[invalidateQueryCacheForApp] No QueryClient on app. Ensure queryCache() or queryCacheShared() is in the plugin chain."
395
+ );
396
+ }
397
+ await createQueryCache(queryClient).invalidate(target);
398
+ }
399
+ function bootstrapFrontXQueryClient(app) {
400
+ return resolveFrontXQueryClient(app);
401
+ }
402
+ function useBootstrappedFrontXQueryClient(app) {
403
+ const fromApp = (0, import_react4.useMemo)(() => bootstrapFrontXQueryClient(app), [app]);
404
+ const [eventResolvedClient, setEventResolvedClient] = (0, import_react4.useState)(
405
+ void 0
406
+ );
407
+ const queryClient = fromApp ?? (eventResolvedClient?.app === app ? eventResolvedClient.queryClient : void 0);
408
+ useCommitEffect(() => {
409
+ if (fromApp || !hasFrontXQueryClientActivator(app)) {
410
+ return;
411
+ }
412
+ const tryResolveQueryClient = () => {
413
+ const nextQueryClient = resolveFrontXQueryClient(app) ?? activateFrontXQueryClient(app);
414
+ if (nextQueryClient) {
415
+ setEventResolvedClient((current) => {
416
+ if (current?.app === app && current.queryClient === nextQueryClient) {
417
+ return current;
418
+ }
419
+ return {
420
+ app,
421
+ queryClient: nextQueryClient
422
+ };
423
+ });
424
+ }
425
+ };
426
+ tryResolveQueryClient();
427
+ const subscription = (0, import_framework2.subscribeQueryCacheRuntimeChanged)(() => {
428
+ tryResolveQueryClient();
429
+ });
246
430
  return () => {
247
- if (!providedApp) {
248
- app.destroy();
431
+ subscription.unsubscribe();
432
+ };
433
+ }, [app, fromApp]);
434
+ return queryClient;
435
+ }
436
+ function FrontXQueryClientProvider({
437
+ queryClient,
438
+ children
439
+ }) {
440
+ if (!queryClient) {
441
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FrontXQueryClientContext.Provider, { value: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_query.QueryClientContext.Provider, { value: void 0, children }) });
442
+ }
443
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FrontXQueryClientContext.Provider, { value: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children }) });
444
+ }
445
+ function useOptionalFrontXQueryClient() {
446
+ return (0, import_react4.useContext)(FrontXQueryClientContext);
447
+ }
448
+ function useRequiredFrontXQueryClient() {
449
+ const queryClient = useOptionalFrontXQueryClient();
450
+ if (!queryClient) {
451
+ throw new Error(
452
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition."
453
+ );
454
+ }
455
+ return queryClient;
456
+ }
457
+ function buildPageContext(page, pages, descriptor, descriptors) {
458
+ return {
459
+ page,
460
+ pages,
461
+ descriptor,
462
+ descriptors
463
+ };
464
+ }
465
+ function normalizeFetchStaleTime(staleTime) {
466
+ if (staleTime === "static") {
467
+ return Number.POSITIVE_INFINITY;
468
+ }
469
+ if (typeof staleTime === "function") {
470
+ return 0;
471
+ }
472
+ return typeof staleTime === "number" ? staleTime : void 0;
473
+ }
474
+ function resolveFetchStaleTime(queryClient, queryKey, descriptor, overrideStaleTime) {
475
+ const clientDefaults = {
476
+ ...queryClient.getDefaultOptions().queries,
477
+ ...queryClient.getQueryDefaults(queryKey)
478
+ };
479
+ return normalizeFetchStaleTime(
480
+ overrideStaleTime ?? descriptor.staleTime ?? clientDefaults.staleTime
481
+ );
482
+ }
483
+ function cacheTimeOptions(staleTime, gcTime) {
484
+ return {
485
+ ...staleTime === void 0 ? {} : { staleTime },
486
+ ...gcTime === void 0 ? {} : { gcTime }
487
+ };
488
+ }
489
+ function fetchDescriptor(descriptor, options) {
490
+ return descriptor.fetch(options);
491
+ }
492
+ function useFrontXQuery(descriptor, overrides) {
493
+ const queryClient = useRequiredFrontXQueryClient();
494
+ const staleTime = resolveFetchStaleTime(
495
+ queryClient,
496
+ descriptor.key,
497
+ descriptor,
498
+ overrides?.staleTime
499
+ );
500
+ const result = (0, import_react_query.useQuery)({
501
+ queryKey: descriptor.key,
502
+ queryFn: ({ signal }) => fetchDescriptor(descriptor, { signal, staleTime }),
503
+ ...cacheTimeOptions(
504
+ overrides?.staleTime ?? descriptor.staleTime,
505
+ overrides?.gcTime ?? descriptor.gcTime
506
+ ),
507
+ ...overrides?.enabled === void 0 ? {} : { enabled: overrides.enabled }
508
+ });
509
+ return {
510
+ data: result.data,
511
+ error: result.error,
512
+ isLoading: result.isLoading,
513
+ isFetching: result.isFetching,
514
+ isError: result.isError,
515
+ refetch: result.refetch
516
+ };
517
+ }
518
+ function useFrontXSuspenseQuery(descriptor, overrides) {
519
+ const queryClient = useRequiredFrontXQueryClient();
520
+ const staleTime = resolveFetchStaleTime(
521
+ queryClient,
522
+ descriptor.key,
523
+ descriptor,
524
+ overrides?.staleTime
525
+ );
526
+ const result = (0, import_react_query.useSuspenseQuery)({
527
+ queryKey: descriptor.key,
528
+ queryFn: ({ signal }) => fetchDescriptor(descriptor, { signal, staleTime }),
529
+ ...cacheTimeOptions(
530
+ overrides?.staleTime ?? descriptor.staleTime,
531
+ overrides?.gcTime ?? descriptor.gcTime
532
+ )
533
+ });
534
+ return {
535
+ data: result.data,
536
+ error: result.error,
537
+ isFetching: result.isFetching,
538
+ refetch: async () => {
539
+ await result.refetch();
540
+ }
541
+ };
542
+ }
543
+ function useFrontXInfiniteQuery(options) {
544
+ const queryClient = useRequiredFrontXQueryClient();
545
+ const result = (0, import_react_query.useInfiniteQuery)({
546
+ queryKey: options.initialPage.key,
547
+ initialPageParam: options.initialPage,
548
+ queryFn: ({ pageParam, signal }) => fetchDescriptor(pageParam, {
549
+ signal,
550
+ staleTime: resolveFetchStaleTime(
551
+ queryClient,
552
+ options.initialPage.key,
553
+ pageParam,
554
+ options.staleTime
555
+ )
556
+ }),
557
+ getNextPageParam: (lastPage, allPages, lastPageDescriptor, allPageDescriptors) => options.getNextPage(
558
+ buildPageContext(
559
+ lastPage,
560
+ allPages,
561
+ lastPageDescriptor,
562
+ allPageDescriptors
563
+ )
564
+ ),
565
+ getPreviousPageParam: options.getPreviousPage ? (firstPage, allPages, firstPageDescriptor, allPageDescriptors) => options.getPreviousPage?.(
566
+ buildPageContext(
567
+ firstPage,
568
+ allPages,
569
+ firstPageDescriptor,
570
+ allPageDescriptors
571
+ )
572
+ ) : void 0,
573
+ select: (data) => data.pages,
574
+ ...cacheTimeOptions(
575
+ options.staleTime ?? options.initialPage.staleTime,
576
+ options.gcTime ?? options.initialPage.gcTime
577
+ ),
578
+ maxPages: options.maxPages,
579
+ ...options.enabled === void 0 ? {} : { enabled: options.enabled }
580
+ });
581
+ return {
582
+ data: result.data,
583
+ error: result.error,
584
+ isLoading: result.isLoading,
585
+ isFetching: result.isFetching,
586
+ isError: result.isError,
587
+ hasNextPage: result.hasNextPage ?? false,
588
+ hasPreviousPage: result.hasPreviousPage ?? false,
589
+ isFetchingNextPage: result.isFetchingNextPage,
590
+ isFetchingPreviousPage: result.isFetchingPreviousPage,
591
+ fetchNextPage: async () => {
592
+ await result.fetchNextPage();
593
+ },
594
+ fetchPreviousPage: async () => {
595
+ await result.fetchPreviousPage();
596
+ },
597
+ refetch: async () => {
598
+ await result.refetch();
599
+ }
600
+ };
601
+ }
602
+ function useFrontXSuspenseInfiniteQuery(options) {
603
+ const queryClient = useRequiredFrontXQueryClient();
604
+ const result = (0, import_react_query.useSuspenseInfiniteQuery)({
605
+ queryKey: options.initialPage.key,
606
+ initialPageParam: options.initialPage,
607
+ queryFn: ({ pageParam, signal }) => fetchDescriptor(pageParam, {
608
+ signal,
609
+ staleTime: resolveFetchStaleTime(
610
+ queryClient,
611
+ options.initialPage.key,
612
+ pageParam,
613
+ options.staleTime
614
+ )
615
+ }),
616
+ getNextPageParam: (lastPage, allPages, lastPageDescriptor, allPageDescriptors) => options.getNextPage(
617
+ buildPageContext(
618
+ lastPage,
619
+ allPages,
620
+ lastPageDescriptor,
621
+ allPageDescriptors
622
+ )
623
+ ),
624
+ getPreviousPageParam: options.getPreviousPage ? (firstPage, allPages, firstPageDescriptor, allPageDescriptors) => options.getPreviousPage?.(
625
+ buildPageContext(
626
+ firstPage,
627
+ allPages,
628
+ firstPageDescriptor,
629
+ allPageDescriptors
630
+ )
631
+ ) : void 0,
632
+ select: (data) => data.pages,
633
+ ...cacheTimeOptions(
634
+ options.staleTime ?? options.initialPage.staleTime,
635
+ options.gcTime ?? options.initialPage.gcTime
636
+ ),
637
+ maxPages: options.maxPages
638
+ });
639
+ return {
640
+ data: result.data,
641
+ error: result.error,
642
+ isFetching: result.isFetching,
643
+ hasNextPage: result.hasNextPage ?? false,
644
+ hasPreviousPage: result.hasPreviousPage ?? false,
645
+ isFetchingNextPage: result.isFetchingNextPage,
646
+ isFetchingPreviousPage: result.isFetchingPreviousPage,
647
+ fetchNextPage: async () => {
648
+ await result.fetchNextPage();
649
+ },
650
+ fetchPreviousPage: async () => {
651
+ await result.fetchPreviousPage();
652
+ },
653
+ refetch: async () => {
654
+ await result.refetch();
655
+ }
656
+ };
657
+ }
658
+ var mutationScopes = /* @__PURE__ */ new WeakMap();
659
+ function scopeBoundQueryCache(queryCache2, scope) {
660
+ const scopeChanged = () => (0, import_framework2.readQueryCacheScopeGeneration)(scope.queryClient) !== scope.generation;
661
+ const dropped = () => {
662
+ if (!scopeChanged()) return false;
663
+ (0, import_framework2.recordQueryCacheScopeWriteDropped)(scope.queryClient, scope.generation);
664
+ return true;
665
+ };
666
+ return {
667
+ get: queryCache2.get,
668
+ getState: queryCache2.getState,
669
+ set: (key, dataOrUpdater) => {
670
+ if (!dropped()) queryCache2.set(key, dataOrUpdater);
671
+ },
672
+ cancel: (key) => scopeChanged() ? Promise.resolve() : queryCache2.cancel(key),
673
+ invalidate: (key) => dropped() ? Promise.resolve() : queryCache2.invalidate(key),
674
+ invalidateMany: (filters) => dropped() ? Promise.resolve() : queryCache2.invalidateMany(filters),
675
+ remove: (key) => {
676
+ if (!dropped()) queryCache2.remove(key);
677
+ }
678
+ };
679
+ }
680
+ function scopeBoundCallbackCtx(callbackCtx, scope) {
681
+ return scope ? { queryCache: scopeBoundQueryCache(createQueryCache(scope.queryClient), scope) } : callbackCtx;
682
+ }
683
+ function useFrontXMutation(options, callbackCtx) {
684
+ const queryClient = useRequiredFrontXQueryClient();
685
+ const latestRef = useLatest({ options, callbackCtx, queryClient });
686
+ const fetchAbortControllersRef = import_react4.default.useRef(/* @__PURE__ */ new Set());
687
+ const abortFetchesOnUnmount = import_react4.default.useEffectEvent(() => {
688
+ if (options.abortOnUnmount) {
689
+ for (const controller of fetchAbortControllersRef.current) {
690
+ controller.abort();
691
+ }
692
+ fetchAbortControllersRef.current.clear();
693
+ }
694
+ });
695
+ import_react4.default.useEffect(() => {
696
+ return () => {
697
+ abortFetchesOnUnmount();
698
+ };
699
+ }, []);
700
+ const mutationFn = import_react4.default.useCallback((variables, context) => {
701
+ const cancelOnSupersede = latestRef.current.options.cancelOnSupersede;
702
+ if (cancelOnSupersede) {
703
+ for (const controller2 of fetchAbortControllersRef.current) {
704
+ controller2.abort();
705
+ }
706
+ fetchAbortControllersRef.current.clear();
707
+ }
708
+ const controller = new AbortController();
709
+ fetchAbortControllersRef.current.add(controller);
710
+ const librarySignal = context.signal;
711
+ if (cancelOnSupersede && librarySignal) {
712
+ if (librarySignal.aborted) {
713
+ controller.abort();
714
+ } else {
715
+ librarySignal.addEventListener("abort", () => controller.abort(), { once: true });
249
716
  }
717
+ }
718
+ return latestRef.current.options.endpoint.fetch(variables, { signal: controller.signal }).finally(() => {
719
+ fetchAbortControllersRef.current.delete(controller);
720
+ });
721
+ }, [latestRef]);
722
+ const onMutate = import_react4.default.useCallback(async (variables, mutationFnContext) => {
723
+ const current = latestRef.current;
724
+ const scope = {
725
+ queryClient: current.queryClient,
726
+ generation: (0, import_framework2.readQueryCacheScopeGeneration)(current.queryClient)
250
727
  };
251
- }, [app, providedApp]);
252
- const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(HAI3Context.Provider, { value: app, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_redux.Provider, { store: app.store, children }) });
728
+ mutationScopes.set(mutationFnContext, scope);
729
+ return current.options.onMutate?.(
730
+ variables,
731
+ scopeBoundCallbackCtx(current.callbackCtx, scope)
732
+ );
733
+ }, [latestRef]);
734
+ const onSuccess = import_react4.default.useCallback((data, variables, context, mutationFnContext) => {
735
+ const current = latestRef.current;
736
+ return current.options.onSuccess?.(
737
+ data,
738
+ variables,
739
+ context,
740
+ scopeBoundCallbackCtx(current.callbackCtx, mutationScopes.get(mutationFnContext))
741
+ );
742
+ }, [latestRef]);
743
+ const onError = import_react4.default.useCallback((error, variables, context, mutationFnContext) => {
744
+ const current = latestRef.current;
745
+ return current.options.onError?.(
746
+ error,
747
+ variables,
748
+ context,
749
+ scopeBoundCallbackCtx(current.callbackCtx, mutationScopes.get(mutationFnContext))
750
+ );
751
+ }, [latestRef]);
752
+ const onSettled = import_react4.default.useCallback((data, error, variables, context, mutationFnContext) => {
753
+ const current = latestRef.current;
754
+ return current.options.onSettled?.(
755
+ data,
756
+ error,
757
+ variables,
758
+ context,
759
+ scopeBoundCallbackCtx(current.callbackCtx, mutationScopes.get(mutationFnContext))
760
+ );
761
+ }, [latestRef]);
762
+ const mutation = (0, import_react_query.useMutation)({
763
+ mutationFn,
764
+ onMutate,
765
+ onSuccess: options.onSuccess ? onSuccess : void 0,
766
+ onError: options.onError ? onError : void 0,
767
+ onSettled: options.onSettled ? onSettled : void 0
768
+ });
769
+ return {
770
+ mutate: mutation.mutate,
771
+ mutateAsync: mutation.mutateAsync,
772
+ isPending: mutation.isPending,
773
+ error: mutation.error,
774
+ data: mutation.data,
775
+ reset: mutation.reset
776
+ };
777
+ }
778
+
779
+ // src/FrontXProvider.tsx
780
+ var import_jsx_runtime3 = require("react/jsx-runtime");
781
+ var FrontXProvider = ({
782
+ children,
783
+ app,
784
+ mfeBridge
785
+ }) => {
786
+ const queryClient = useBootstrappedFrontXQueryClient(app);
787
+ const deferQuerySubtree = hasFrontXQueryClientActivator(app) && queryClient === void 0;
788
+ (0, import_react5.useEffect)(() => {
789
+ if (queryClient || hasFrontXQueryClientActivator(app) || process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test" || process.env.VITEST === "true") {
790
+ return;
791
+ }
792
+ console.warn(
793
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition. useApiQuery/useApiMutation will fail without it."
794
+ );
795
+ }, [app, queryClient]);
796
+ const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FrontXContext.Provider, { value: app, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_redux.Provider, { store: app.store, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FrontXQueryClientProvider, { queryClient, children: deferQuerySubtree ? null : children }) }) });
253
797
  if (mfeBridge) {
254
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MfeProvider, { value: mfeBridge, children: content });
798
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MfeProvider, { value: mfeBridge, children: content });
255
799
  }
256
800
  return content;
257
801
  };
258
802
 
803
+ // src/hooks/useCanAccess.ts
804
+ var import_react6 = require("react");
805
+ function serializeRecordValue(value) {
806
+ if (value === null) return "n:";
807
+ if (typeof value === "string") return `s:${value}`;
808
+ if (typeof value === "number") {
809
+ return `d:${Object.is(value, -0) ? "-0" : String(value)}`;
810
+ }
811
+ return value ? "b:1" : "b:0";
812
+ }
813
+ function accessQueryKey(query) {
814
+ const { action, resource, record } = query;
815
+ const normalizedRecord = record ? Object.entries(record).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => [k, serializeRecordValue(v)]) : null;
816
+ return JSON.stringify([action, resource, normalizedRecord]);
817
+ }
818
+ function getAuthRuntime(app) {
819
+ return app.auth ?? null;
820
+ }
821
+ var DENIED_NO_AUTH = { allow: false, isResolving: false };
822
+ function useCanAccess(query) {
823
+ const app = useFrontX();
824
+ const auth2 = getAuthRuntime(app);
825
+ const stableKey = accessQueryKey(query);
826
+ const [stableQuery, setStableQuery] = (0, import_react6.useState)(() => query);
827
+ const [runState, setRunState] = (0, import_react6.useState)({ auth: auth2, stableKey });
828
+ const [result, setResult] = (0, import_react6.useState)({ allow: false, isResolving: true });
829
+ if (runState.auth !== auth2 || runState.stableKey !== stableKey) {
830
+ setRunState({ auth: auth2, stableKey });
831
+ setStableQuery(query);
832
+ setResult({ allow: false, isResolving: true });
833
+ }
834
+ (0, import_react6.useEffect)(() => {
835
+ if (!auth2) {
836
+ return;
837
+ }
838
+ let alive = true;
839
+ const controller = new AbortController();
840
+ void auth2.canAccess(stableQuery, { signal: controller.signal }).then((decision) => {
841
+ if (alive) {
842
+ setResult({ allow: decision === "allow", isResolving: false });
843
+ }
844
+ }).catch(() => {
845
+ if (alive) {
846
+ setResult({ allow: false, isResolving: false });
847
+ }
848
+ });
849
+ return () => {
850
+ alive = false;
851
+ controller.abort();
852
+ };
853
+ }, [auth2, stableQuery]);
854
+ return auth2 ? result : DENIED_NO_AUTH;
855
+ }
856
+
857
+ // src/components/CanAccess.tsx
858
+ function CanAccess({
859
+ query,
860
+ allowed,
861
+ denied = null,
862
+ loading
863
+ }) {
864
+ const { allow, isResolving } = useCanAccess(query);
865
+ if (isResolving) {
866
+ return loading !== void 0 ? loading : denied;
867
+ }
868
+ return allow ? allowed : denied;
869
+ }
870
+
259
871
  // src/hooks/useAppDispatch.ts
260
872
  var import_react_redux2 = require("react-redux");
261
873
  function useAppDispatch() {
@@ -267,12 +879,12 @@ var import_react_redux3 = require("react-redux");
267
879
  var useAppSelector = import_react_redux3.useSelector;
268
880
 
269
881
  // src/hooks/useTranslation.ts
270
- var import_react4 = require("react");
882
+ var import_react7 = require("react");
271
883
  function useTranslation() {
272
- const app = useHAI3();
884
+ const app = useFrontX();
273
885
  const { i18nRegistry: i18nRegistry2 } = app;
274
- const version = (0, import_react4.useSyncExternalStore)(
275
- (0, import_react4.useCallback)(
886
+ const version = (0, import_react7.useSyncExternalStore)(
887
+ (0, import_react7.useCallback)(
276
888
  (callback) => {
277
889
  return i18nRegistry2.subscribe(callback);
278
890
  },
@@ -281,17 +893,17 @@ function useTranslation() {
281
893
  () => i18nRegistry2.getVersion(),
282
894
  () => i18nRegistry2.getVersion()
283
895
  );
284
- const language = (0, import_react4.useMemo)(() => {
896
+ const language = (0, import_react7.useMemo)(() => {
285
897
  void version;
286
898
  return i18nRegistry2.getLanguage();
287
899
  }, [i18nRegistry2, version]);
288
- const t = (0, import_react4.useCallback)(
900
+ const t = (0, import_react7.useCallback)(
289
901
  (key, params) => {
290
902
  return i18nRegistry2.t(key, params);
291
903
  },
292
904
  [i18nRegistry2]
293
905
  );
294
- const setLanguage = (0, import_react4.useCallback)(
906
+ const setLanguage = (0, import_react7.useCallback)(
295
907
  (lang) => {
296
908
  if (app.actions.setLanguage) {
297
909
  app.actions.setLanguage({ language: lang });
@@ -299,7 +911,7 @@ function useTranslation() {
299
911
  },
300
912
  [app.actions]
301
913
  );
302
- const isRTL = (0, import_react4.useMemo)(() => {
914
+ const isRTL = (0, import_react7.useMemo)(() => {
303
915
  void language;
304
916
  return i18nRegistry2.isRTL();
305
917
  }, [i18nRegistry2, language]);
@@ -312,29 +924,28 @@ function useTranslation() {
312
924
  }
313
925
 
314
926
  // src/hooks/useScreenTranslations.ts
315
- var import_react5 = require("react");
927
+ var import_react8 = require("react");
316
928
  function isTranslationLoader(input) {
317
929
  return typeof input === "function";
318
930
  }
319
931
  function useScreenTranslations(screensetId, screenId, translations) {
320
- const app = useHAI3();
932
+ const app = useFrontX();
321
933
  const { i18nRegistry: i18nRegistry2 } = app;
322
- const [loadedLanguage, setLoadedLanguage] = (0, import_react5.useState)(null);
323
- const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
324
- const [error, setError] = (0, import_react5.useState)(null);
325
- const version = (0, import_react5.useSyncExternalStore)(
326
- (0, import_react5.useCallback)(
934
+ const [loadedLanguage, setLoadedLanguage] = (0, import_react8.useState)(null);
935
+ const [error, setError] = (0, import_react8.useState)(null);
936
+ const version = (0, import_react8.useSyncExternalStore)(
937
+ (0, import_react8.useCallback)(
327
938
  (callback) => i18nRegistry2.subscribe(callback),
328
939
  [i18nRegistry2]
329
940
  ),
330
941
  () => i18nRegistry2.getVersion(),
331
942
  () => i18nRegistry2.getVersion()
332
943
  );
333
- const currentLanguage = (0, import_react5.useMemo)(() => {
944
+ const currentLanguage = (0, import_react8.useMemo)(() => {
334
945
  void version;
335
946
  return i18nRegistry2.getLanguage();
336
947
  }, [i18nRegistry2, version]);
337
- const loader = (0, import_react5.useMemo)(() => {
948
+ const loader = (0, import_react8.useMemo)(() => {
338
949
  if (isTranslationLoader(translations)) {
339
950
  return translations;
340
951
  }
@@ -347,12 +958,11 @@ function useScreenTranslations(screensetId, screenId, translations) {
347
958
  return module2.default;
348
959
  };
349
960
  }, [translations]);
350
- (0, import_react5.useEffect)(() => {
961
+ (0, import_react8.useEffect)(() => {
351
962
  if (!currentLanguage || currentLanguage === loadedLanguage) {
352
963
  return;
353
964
  }
354
965
  let cancelled = false;
355
- setIsLoading(true);
356
966
  const loadTranslations = async () => {
357
967
  try {
358
968
  const namespace = `screen.${screensetId}.${screenId}`;
@@ -361,13 +971,11 @@ function useScreenTranslations(screensetId, screenId, translations) {
361
971
  i18nRegistry2.register(namespace, currentLanguage, loadedTranslations);
362
972
  if (!cancelled) {
363
973
  setLoadedLanguage(currentLanguage);
364
- setIsLoading(false);
365
974
  setError(null);
366
975
  }
367
976
  } catch (err) {
368
977
  if (!cancelled) {
369
978
  setError(err instanceof Error ? err : new Error(String(err)));
370
- setIsLoading(false);
371
979
  }
372
980
  }
373
981
  };
@@ -376,29 +984,29 @@ function useScreenTranslations(screensetId, screenId, translations) {
376
984
  cancelled = true;
377
985
  };
378
986
  }, [screensetId, screenId, loader, i18nRegistry2, currentLanguage, loadedLanguage]);
379
- const isLoaded = currentLanguage !== null && currentLanguage === loadedLanguage && !isLoading;
987
+ const isLoaded = currentLanguage !== null && currentLanguage === loadedLanguage;
380
988
  return { isLoaded, error };
381
989
  }
382
990
 
383
991
  // src/hooks/useFormatters.ts
384
- var import_react6 = require("react");
385
- var import_framework2 = require("@gears-frontx/framework");
992
+ var import_react9 = require("react");
993
+ var import_framework3 = require("@gears-frontx/framework");
386
994
  function useFormatters() {
387
995
  const { language } = useTranslation();
388
- return (0, import_react6.useMemo)(
996
+ return (0, import_react9.useMemo)(
389
997
  () => {
390
998
  void language;
391
999
  return {
392
- formatDate: import_framework2.formatDate,
393
- formatTime: import_framework2.formatTime,
394
- formatDateTime: import_framework2.formatDateTime,
395
- formatRelative: import_framework2.formatRelative,
396
- formatNumber: import_framework2.formatNumber,
397
- formatPercent: import_framework2.formatPercent,
398
- formatCompact: import_framework2.formatCompact,
399
- formatCurrency: import_framework2.formatCurrency,
400
- compareStrings: import_framework2.compareStrings,
401
- createCollator: import_framework2.createCollator
1000
+ formatDate: import_framework3.formatDate,
1001
+ formatTime: import_framework3.formatTime,
1002
+ formatDateTime: import_framework3.formatDateTime,
1003
+ formatRelative: import_framework3.formatRelative,
1004
+ formatNumber: import_framework3.formatNumber,
1005
+ formatPercent: import_framework3.formatPercent,
1006
+ formatCompact: import_framework3.formatCompact,
1007
+ formatCurrency: import_framework3.formatCurrency,
1008
+ compareStrings: import_framework3.compareStrings,
1009
+ createCollator: import_framework3.createCollator
402
1010
  };
403
1011
  },
404
1012
  [language]
@@ -406,12 +1014,12 @@ function useFormatters() {
406
1014
  }
407
1015
 
408
1016
  // src/hooks/useTheme.ts
409
- var import_react7 = require("react");
1017
+ var import_react10 = require("react");
410
1018
  function useTheme() {
411
- const app = useHAI3();
1019
+ const app = useFrontX();
412
1020
  const { themeRegistry } = app;
413
- const version = (0, import_react7.useSyncExternalStore)(
414
- (0, import_react7.useCallback)(
1021
+ const version = (0, import_react10.useSyncExternalStore)(
1022
+ (0, import_react10.useCallback)(
415
1023
  (callback) => {
416
1024
  return themeRegistry.subscribe(callback);
417
1025
  },
@@ -420,18 +1028,18 @@ function useTheme() {
420
1028
  () => themeRegistry.getVersion(),
421
1029
  () => themeRegistry.getVersion()
422
1030
  );
423
- const currentTheme = (0, import_react7.useMemo)(() => {
1031
+ const currentTheme = (0, import_react10.useMemo)(() => {
424
1032
  void version;
425
1033
  const theme = themeRegistry.getCurrent();
426
1034
  return theme?.id;
427
1035
  }, [themeRegistry, version]);
428
- const themes2 = (0, import_react7.useMemo)(() => {
1036
+ const themes2 = (0, import_react10.useMemo)(() => {
429
1037
  return themeRegistry.getAll().map((theme) => ({
430
1038
  id: theme.id,
431
1039
  name: theme.name
432
1040
  }));
433
1041
  }, [themeRegistry]);
434
- const setTheme = (0, import_react7.useCallback)(
1042
+ const setTheme = (0, import_react10.useCallback)(
435
1043
  (themeId) => {
436
1044
  if (app.actions.changeTheme) {
437
1045
  app.actions.changeTheme({ themeId });
@@ -446,6 +1054,145 @@ function useTheme() {
446
1054
  };
447
1055
  }
448
1056
 
1057
+ // src/hooks/useApiQuery.ts
1058
+ function useApiQuery(descriptor, overrides) {
1059
+ return useFrontXQuery(descriptor, overrides);
1060
+ }
1061
+
1062
+ // src/hooks/useApiSuspenseQuery.ts
1063
+ function useApiSuspenseQuery(descriptor, overrides) {
1064
+ return useFrontXSuspenseQuery(descriptor, overrides);
1065
+ }
1066
+
1067
+ // src/hooks/useApiInfiniteQuery.ts
1068
+ function useApiInfiniteQuery(options) {
1069
+ return useFrontXInfiniteQuery(options);
1070
+ }
1071
+
1072
+ // src/hooks/useApiSuspenseInfiniteQuery.ts
1073
+ function useApiSuspenseInfiniteQuery(options) {
1074
+ return useFrontXSuspenseInfiniteQuery(options);
1075
+ }
1076
+
1077
+ // src/hooks/useApiMutation.ts
1078
+ var import_react11 = require("react");
1079
+ function useApiMutation(options) {
1080
+ const queryClient = useRequiredFrontXQueryClient();
1081
+ const queryCache2 = (0, import_react11.useMemo)(() => createQueryCache(queryClient), [queryClient]);
1082
+ const callbackCtx = (0, import_react11.useMemo)(() => ({ queryCache: queryCache2 }), [queryCache2]);
1083
+ return useFrontXMutation(options, callbackCtx);
1084
+ }
1085
+
1086
+ // src/hooks/useApiStream.ts
1087
+ var import_react12 = require("react");
1088
+ function useApiStream(descriptor, options) {
1089
+ const mode = options?.mode ?? "latest";
1090
+ const enabled = options?.enabled ?? true;
1091
+ const [data, setData] = (0, import_react12.useState)(void 0);
1092
+ const [events, setEvents] = (0, import_react12.useState)([]);
1093
+ const [status, setStatus] = (0, import_react12.useState)(() => enabled ? "connecting" : "idle");
1094
+ const [error, setError] = (0, import_react12.useState)(null);
1095
+ const connectPromiseRef = (0, import_react12.useRef)(null);
1096
+ const connectionIdRef = (0, import_react12.useRef)(null);
1097
+ const disconnectRequestedRef = (0, import_react12.useRef)(false);
1098
+ const descriptorRef = useLatest(descriptor);
1099
+ const descriptorKey = (0, import_react12.useMemo)(() => JSON.stringify(descriptor.key), [descriptor.key]);
1100
+ const resetKey = `${descriptorKey}:${mode}`;
1101
+ const [prevResetKey, setPrevResetKey] = (0, import_react12.useState)(resetKey);
1102
+ if (resetKey !== prevResetKey) {
1103
+ setPrevResetKey(resetKey);
1104
+ setData(void 0);
1105
+ setEvents([]);
1106
+ setError(null);
1107
+ }
1108
+ const connectKey = `${resetKey}:${enabled}`;
1109
+ const [prevConnectKey, setPrevConnectKey] = (0, import_react12.useState)(connectKey);
1110
+ if (connectKey !== prevConnectKey) {
1111
+ setPrevConnectKey(connectKey);
1112
+ if (enabled) {
1113
+ setData(void 0);
1114
+ setEvents([]);
1115
+ setStatus("connecting");
1116
+ setError(null);
1117
+ }
1118
+ }
1119
+ const disconnect = (0, import_react12.useCallback)(() => {
1120
+ disconnectRequestedRef.current = true;
1121
+ if (connectionIdRef.current) {
1122
+ descriptorRef.current.disconnect(connectionIdRef.current);
1123
+ connectionIdRef.current = null;
1124
+ disconnectRequestedRef.current = false;
1125
+ }
1126
+ setStatus("disconnected");
1127
+ }, [descriptorRef]);
1128
+ (0, import_react12.useEffect)(() => {
1129
+ if (!enabled) {
1130
+ return;
1131
+ }
1132
+ let cancelled = false;
1133
+ disconnectRequestedRef.current = false;
1134
+ const d = descriptorRef.current;
1135
+ const connectPromise = d.connect(
1136
+ (event) => {
1137
+ if (cancelled) return;
1138
+ setData(event);
1139
+ setStatus("connected");
1140
+ if (mode === "accumulate") {
1141
+ setEvents((prev) => [...prev, event]);
1142
+ }
1143
+ },
1144
+ () => {
1145
+ if (cancelled) return;
1146
+ setStatus("disconnected");
1147
+ connectionIdRef.current = null;
1148
+ }
1149
+ );
1150
+ connectPromiseRef.current = connectPromise;
1151
+ connectPromise.then((id) => {
1152
+ if (cancelled) return;
1153
+ if (disconnectRequestedRef.current) {
1154
+ d.disconnect(id);
1155
+ disconnectRequestedRef.current = false;
1156
+ return;
1157
+ }
1158
+ connectionIdRef.current = id;
1159
+ setStatus("connected");
1160
+ }).catch((err) => {
1161
+ if (cancelled) return;
1162
+ if (disconnectRequestedRef.current) {
1163
+ disconnectRequestedRef.current = false;
1164
+ setStatus("disconnected");
1165
+ return;
1166
+ }
1167
+ setError(err instanceof Error ? err : new Error(String(err)));
1168
+ setStatus("error");
1169
+ });
1170
+ return () => {
1171
+ cancelled = true;
1172
+ connectPromise.then(
1173
+ (id) => d.disconnect(id),
1174
+ () => {
1175
+ }
1176
+ );
1177
+ connectPromiseRef.current = null;
1178
+ connectionIdRef.current = null;
1179
+ };
1180
+ }, [descriptorKey, enabled, mode, descriptorRef]);
1181
+ return { data, events, status: enabled ? status : "idle", error, disconnect };
1182
+ }
1183
+
1184
+ // src/hooks/useQueryCache.ts
1185
+ var import_react13 = require("react");
1186
+ function useQueryCache() {
1187
+ const queryClient = useOptionalFrontXQueryClient();
1188
+ if (!queryClient) {
1189
+ throw new Error(
1190
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition."
1191
+ );
1192
+ }
1193
+ return (0, import_react13.useMemo)(() => createQueryCache(queryClient), [queryClient]);
1194
+ }
1195
+
449
1196
  // src/mfe/hooks/useMfeBridge.ts
450
1197
  function useMfeBridge() {
451
1198
  const { bridge } = useMfeContext();
@@ -453,61 +1200,73 @@ function useMfeBridge() {
453
1200
  }
454
1201
 
455
1202
  // src/mfe/hooks/useSharedProperty.ts
456
- var import_react8 = require("react");
457
- function useSharedProperty(propertyTypeId) {
458
- const { bridge } = useMfeContext();
459
- const subscribe = (0, import_react8.useCallback)((callback) => {
460
- return bridge.subscribeToProperty(propertyTypeId, () => {
461
- callback();
462
- });
463
- }, [bridge, propertyTypeId]);
464
- const getSnapshot = (0, import_react8.useCallback)(() => {
465
- const property = bridge.getProperty(propertyTypeId);
466
- return property?.value;
467
- }, [bridge, propertyTypeId]);
468
- const value = (0, import_react8.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
469
- return value;
1203
+ var import_react14 = require("react");
1204
+ function useSharedProperty(propertyTypeId, options) {
1205
+ const contextValue = (0, import_react14.useContext)(MfeContext);
1206
+ const bridge = options?.bridge ?? contextValue?.bridge;
1207
+ const fallback = options?.fallback;
1208
+ if (!bridge) {
1209
+ throw new Error(
1210
+ "useSharedProperty must be used within a MfeProvider, or given an explicit `bridge` option, for components that never mount MfeProvider."
1211
+ );
1212
+ }
1213
+ const subscribe = (0, import_react14.useCallback)(
1214
+ (onStoreChange) => bridge.subscribeToProperty(propertyTypeId, () => {
1215
+ onStoreChange();
1216
+ }),
1217
+ [bridge, propertyTypeId]
1218
+ );
1219
+ const getSnapshot = (0, import_react14.useCallback)(() => {
1220
+ const raw = bridge.getProperty(propertyTypeId)?.value;
1221
+ return raw === void 0 ? fallback : raw;
1222
+ }, [bridge, propertyTypeId, fallback]);
1223
+ return (0, import_react14.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
470
1224
  }
471
1225
 
472
1226
  // src/mfe/hooks/useHostAction.ts
473
- var import_react9 = require("react");
1227
+ var import_react15 = require("react");
474
1228
  function useHostAction(actionTypeId) {
475
1229
  const { bridge } = useMfeContext();
476
- return (0, import_react9.useCallback)((payload) => {
1230
+ return (0, import_react15.useCallback)((payload) => {
477
1231
  const chain = {
478
1232
  action: {
479
1233
  type: actionTypeId,
480
- target: bridge.domainId,
1234
+ target: bridge.extDomainId,
481
1235
  payload
482
1236
  }
483
1237
  };
484
- bridge.executeActionsChain(chain).catch((error) => {
485
- console.error(
486
- `[useHostAction] Failed to send action '${actionTypeId}':`,
487
- error
488
- );
489
- });
1238
+ bridge.executeActionsChain(chain);
490
1239
  }, [actionTypeId, bridge]);
491
1240
  }
492
1241
 
493
- // src/mfe/hooks/useDomainExtensions.ts
494
- var import_react10 = require("react");
495
- function useDomainExtensions(domainId) {
496
- const app = useHAI3();
497
- const registry = app.screensetsRegistry;
1242
+ // src/mfe/hooks/useMfeRegistry.ts
1243
+ function resolveMfeRegistry(app, callerName) {
1244
+ const registry = app.mfeRegistry;
498
1245
  if (!registry) {
499
1246
  throw new Error(
500
- "useDomainExtensions requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
1247
+ `${callerName} requires the microfrontends plugin. Add microfrontends() to your Gears FrontX app configuration.`
501
1248
  );
502
1249
  }
503
- const subscribe = (0, import_react10.useCallback)(
1250
+ return registry;
1251
+ }
1252
+ function useMfeRegistry() {
1253
+ const app = useFrontX();
1254
+ return resolveMfeRegistry(app, "useMfeRegistry");
1255
+ }
1256
+
1257
+ // src/mfe/hooks/useDomainExtensions.ts
1258
+ var import_react16 = require("react");
1259
+ function useDomainExtensions(domainId) {
1260
+ const app = useFrontX();
1261
+ const registry = resolveMfeRegistry(app, "useDomainExtensions");
1262
+ const subscribe = (0, import_react16.useCallback)(
504
1263
  (onStoreChange) => {
505
1264
  return app.store.subscribe(onStoreChange);
506
1265
  },
507
1266
  [app.store]
508
1267
  );
509
- const cacheRef = (0, import_react10.useRef)({ ids: "", extensions: [] });
510
- const getSnapshot = (0, import_react10.useCallback)(() => {
1268
+ const cacheRef = (0, import_react16.useRef)({ ids: "", extensions: [] });
1269
+ const getSnapshot = (0, import_react16.useCallback)(() => {
511
1270
  const extensions = registry.getExtensionsForDomain(domainId);
512
1271
  const ids = extensions.map((e) => e.id).join(",");
513
1272
  if (ids !== cacheRef.current.ids) {
@@ -515,27 +1274,22 @@ function useDomainExtensions(domainId) {
515
1274
  }
516
1275
  return cacheRef.current.extensions;
517
1276
  }, [registry, domainId]);
518
- return (0, import_react10.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1277
+ return (0, import_react16.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
519
1278
  }
520
1279
 
521
1280
  // src/mfe/hooks/useRegisteredPackages.ts
522
- var import_react11 = require("react");
1281
+ var import_react17 = require("react");
523
1282
  function useRegisteredPackages() {
524
- const app = useHAI3();
525
- const registry = app.screensetsRegistry;
526
- if (!registry) {
527
- throw new Error(
528
- "useRegisteredPackages requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
529
- );
530
- }
531
- const subscribe = (0, import_react11.useCallback)(
1283
+ const app = useFrontX();
1284
+ const registry = resolveMfeRegistry(app, "useRegisteredPackages");
1285
+ const subscribe = (0, import_react17.useCallback)(
532
1286
  (onStoreChange) => {
533
1287
  return app.store.subscribe(onStoreChange);
534
1288
  },
535
1289
  [app.store]
536
1290
  );
537
- const cacheRef = (0, import_react11.useRef)({ packages: "", list: [] });
538
- const getSnapshot = (0, import_react11.useCallback)(() => {
1291
+ const cacheRef = (0, import_react17.useRef)({ packages: "", list: [] });
1292
+ const getSnapshot = (0, import_react17.useCallback)(() => {
539
1293
  const list = registry.getRegisteredPackages();
540
1294
  const packages = list.join(",");
541
1295
  if (packages !== cacheRef.current.packages) {
@@ -543,177 +1297,318 @@ function useRegisteredPackages() {
543
1297
  }
544
1298
  return cacheRef.current.list;
545
1299
  }, [registry]);
546
- return (0, import_react11.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1300
+ return (0, import_react17.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
547
1301
  }
548
1302
 
549
- // src/mfe/hooks/useActivePackage.ts
550
- var import_react12 = require("react");
551
- var import_framework3 = require("@gears-frontx/framework");
552
- function useActivePackage() {
553
- const app = useHAI3();
554
- const registry = app.screensetsRegistry;
555
- if (!registry) {
1303
+ // src/mfe/ThemeAwareReactLifecycle.tsx
1304
+ var import_client = require("react-dom/client");
1305
+
1306
+ // src/mfe/domainTeardownCollector.ts
1307
+ var activeCollector;
1308
+ function collectDomainTeardowns(fn) {
1309
+ const previousCollector = activeCollector;
1310
+ const collector = [];
1311
+ activeCollector = collector;
1312
+ try {
1313
+ fn();
1314
+ } finally {
1315
+ activeCollector = previousCollector;
1316
+ }
1317
+ return collector;
1318
+ }
1319
+ function registerDomainTeardown(promise) {
1320
+ activeCollector?.push(promise);
1321
+ }
1322
+
1323
+ // src/mfe/ThemeAwareReactLifecycle.tsx
1324
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1325
+ var ADOPTED_HOST_STYLE_ATTR = "data-frontx-adopted-host-style";
1326
+ var BASE_RESETS_STYLE_ID = "__frontx-base-resets__";
1327
+ var SHELL_OWNED_SHADOW_STYLE_IDS = ["__frontx-shadow-isolation__", "__frontx-css-variables__"];
1328
+ function cssToCopy(style) {
1329
+ const text = style.textContent ?? "";
1330
+ const sheet = style.sheet;
1331
+ if (text.trim() || !sheet) return text;
1332
+ return Array.from(sheet.cssRules, (rule) => rule.cssText).join("\n");
1333
+ }
1334
+ function resolveProviderMountOptions(app, bridge, mountContext) {
1335
+ const extensionId = mountContext?.extensionId;
1336
+ const domainId = mountContext?.domainId;
1337
+ const isMountedMfe = typeof extensionId === "string" && typeof domainId === "string";
1338
+ if (isMountedMfe && !resolveFrontXQueryClient(app) && !hasFrontXQueryClientActivator(app)) {
556
1339
  throw new Error(
557
- "useActivePackage requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
1340
+ "[FrontXProvider] Mounted MFEs require queryCacheShared() in the child app and queryCache() in the host app before loading the MFE app."
558
1341
  );
559
1342
  }
560
- const subscribe = (0, import_react12.useCallback)(
561
- (onStoreChange) => {
562
- return app.store.subscribe(onStoreChange);
563
- },
564
- [app.store]
565
- );
566
- const cacheRef = (0, import_react12.useRef)({ activePackage: void 0 });
567
- const getSnapshot = (0, import_react12.useCallback)(() => {
568
- const mountedExtensionId = registry.getMountedExtension(import_framework3.FRONTX_SCREEN_DOMAIN);
569
- if (!mountedExtensionId) {
570
- const result = void 0;
571
- if (result !== cacheRef.current.activePackage) {
572
- cacheRef.current = { activePackage: result };
573
- }
574
- return cacheRef.current.activePackage;
575
- }
576
- const activePackage = (0, import_framework3.extractGtsPackage)(mountedExtensionId);
577
- if (activePackage !== cacheRef.current.activePackage) {
578
- cacheRef.current = { activePackage };
579
- }
580
- return cacheRef.current.activePackage;
581
- }, [registry]);
582
- return (0, import_react12.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1343
+ return {
1344
+ mfeBridge: isMountedMfe ? { bridge, extensionId, domainId } : void 0
1345
+ };
583
1346
  }
584
-
585
- // src/mfe/components/RefContainerProvider.ts
586
- var import_framework4 = require("@gears-frontx/framework");
587
- var RefContainerProvider = class extends import_framework4.ContainerProvider {
588
- constructor(containerRef) {
589
- super();
590
- this.containerRef = containerRef;
1347
+ function MountRuntimeAwareProvider({
1348
+ app,
1349
+ mfeBridge,
1350
+ children
1351
+ }) {
1352
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FrontXProvider, { app, mfeBridge, children });
1353
+ }
1354
+ var ThemeAwareReactLifecycle = class {
1355
+ constructor(app) {
1356
+ this.app = app;
591
1357
  }
592
- getContainer(_extensionId) {
593
- if (!this.containerRef.current) {
594
- throw new Error("Container ref is not attached -- component may not be mounted yet");
1358
+ app;
1359
+ root = null;
1360
+ mount(container, bridge, mountContext) {
1361
+ void this.app.mfeRegistry;
1362
+ if (container instanceof ShadowRoot) {
1363
+ this.adoptHostStylesIntoShadowRoot(container);
595
1364
  }
596
- return this.containerRef.current;
1365
+ this.injectBaseResets(container);
1366
+ this.initializeStyles(container);
1367
+ const providerMountOptions = resolveProviderMountOptions(this.app, bridge, mountContext);
1368
+ this.root = (0, import_client.createRoot)(container);
1369
+ this.root.render(
1370
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1371
+ MountRuntimeAwareProvider,
1372
+ {
1373
+ app: this.app,
1374
+ mfeBridge: providerMountOptions.mfeBridge,
1375
+ children: this.renderContent(bridge)
1376
+ }
1377
+ )
1378
+ );
597
1379
  }
598
- releaseContainer(_extensionId) {
1380
+ /**
1381
+ * `Root.unmount()` itself is synchronous, but a nested `ExtensionDomainSlot`
1382
+ * mounted anywhere in this root's own tree cannot make ITS cleanup
1383
+ * synchronous too — its mounter's own `detach()` awaits per-extension
1384
+ * unmounts. Collecting whatever that cleanup fire-and-forgets (through
1385
+ * `domainTeardownCollector`, scoped to this one `Root.unmount()` call) and
1386
+ * awaiting it here is what makes this method's own returned promise settle
1387
+ * only once every nested domain this root owns has actually finished
1388
+ * tearing down — never before. A root with no routed nested domain
1389
+ * collects nothing, and this resolves exactly as before (a microtask after
1390
+ * the synchronous unmount, same observable timing `void | Promise<void>`
1391
+ * already allows).
1392
+ */
1393
+ async unmount(_container) {
1394
+ if (!this.root) return;
1395
+ const root = this.root;
1396
+ this.root = null;
1397
+ const pendingTeardowns = collectDomainTeardowns(() => root.unmount());
1398
+ const settled = await Promise.allSettled(pendingTeardowns);
1399
+ const failed = settled.find((result) => result.status === "rejected");
1400
+ if (failed) throw failed.reason;
1401
+ }
1402
+ /**
1403
+ * Copy all inline <style> and <link rel="stylesheet"> from the host document
1404
+ * into the shadow root so that Tailwind and component styles apply inside the MFE.
1405
+ *
1406
+ * The clones are inserted ahead of everything already in the shadow root, never
1407
+ * appended, because adopted host styles are context rather than authority: where
1408
+ * they and the MFE's own CSS declare the same property at equal specificity, the
1409
+ * MFE has to win. Appending inverted that. `MfeHandlerMF` injects the MFE's
1410
+ * compiled stylesheet into the shadow root before it calls mount, so an appended
1411
+ * clone of the shell's Tailwind preflight - whose
1412
+ * `button, [type='button'], [type='reset'], [type='submit']` rule sets
1413
+ * `background-color: transparent` at specificity (0,1,0) - tied with
1414
+ * `@gears-frontx/ui-kit`'s single-class button rule and won on document order,
1415
+ * leaving every kit Button transparent until it was hovered.
1416
+ *
1417
+ * Inserting at the front rather than pushing MFE styles to the back is what makes
1418
+ * the invariant hold for stylesheets that appear after mount too - a lazily
1419
+ * imported component's CSS module, or whatever initializeStyles() adds - since
1420
+ * those land behind the adopted block by construction.
1421
+ *
1422
+ * A cascade layer around the adopted CSS was the alternative and is rejected:
1423
+ * layered rules lose to unlayered ones at *any* specificity, so a host utility
1424
+ * class would stop overriding an MFE element selector. Document order keeps
1425
+ * specificity in charge and only settles the ties.
1426
+ *
1427
+ * The block replaces its predecessor instead of stacking on it, the same
1428
+ * upsert shape `injectStylesheet` and `injectCssVariables` use in
1429
+ * `@gears-frontx/mfes`' shadow utilities, widened from one id-keyed node to a
1430
+ * marked block. Replacement is required rather than tidy: `createShadowRoot`
1431
+ * hands back an existing `element.shadowRoot` instead of attaching a new one,
1432
+ * so remounting the same container runs this method again on a shadow root
1433
+ * that already holds a full adopted block, and appending would grow it once
1434
+ * per mount with no bound. It does not save re-resolving the cloned `<link>`s -
1435
+ * every mount clones them afresh and the browser resolves each clone; what
1436
+ * replacement buys is that the count stays at one block instead of one per
1437
+ * mount.
1438
+ *
1439
+ * The block is rebuilt from the host head rather than left in place, because
1440
+ * the head is not fixed: a lazily imported chunk adds stylesheets to it after
1441
+ * the first mount, and the second mount has to pick those up.
1442
+ *
1443
+ * A `<style>` is copied into a new element that holds the host's CSS - see
1444
+ * `cssToCopy` - and takes three things from the host element: `media`,
1445
+ * without which a print-only host style applies on screen inside the MFE;
1446
+ * `type`, which keeps the copy of a non-CSS element as inert as the original;
1447
+ * and the nonce, without which a nonce-based CSP blocks the copy. The nonce is read from the `nonce` property, because
1448
+ * browsers blank the attribute in a document served with a CSP header.
1449
+ * Nothing else is carried over, because libraries look for their own
1450
+ * attributes inside the shadow root: styled-components, rendering into it,
1451
+ * puts its tag right after the last `style[data-styled]` there, so a copy of
1452
+ * the host's tag would pull the MFE's rules ahead of the base resets and the
1453
+ * MFE's own CSS. A `<link>` is a deep clone and is loaded from its `href`
1454
+ * again.
1455
+ *
1456
+ * The fresh block goes in before the previous one comes out. Removing first
1457
+ * leaves the shadow root with no host CSS at all, and everything between that
1458
+ * removal and the insertion is synchronous work in this same task - so the gap
1459
+ * never reaches a paint, but any code that reads computed styles from the tree
1460
+ * in between sees an unstyled one. Inserting first costs one moment with two
1461
+ * blocks present, which changes nothing: the old block is a clone of the same
1462
+ * host head and loses every tie to the new one on document order anyway.
1463
+ */
1464
+ adoptHostStylesIntoShadowRoot(shadowRoot) {
1465
+ const supersededStyles = Array.from(shadowRoot.querySelectorAll(`[${ADOPTED_HOST_STYLE_ATTR}]`));
1466
+ const adoptedStyles = document.createDocumentFragment();
1467
+ const hostStyleNodes = document.head.querySelectorAll('style, link[rel="stylesheet"]');
1468
+ hostStyleNodes.forEach((el) => {
1469
+ if (el instanceof HTMLStyleElement) {
1470
+ const copy = document.createElement("style");
1471
+ if (el.media) copy.media = el.media;
1472
+ if (el.type) copy.type = el.type;
1473
+ if (el.nonce) copy.nonce = el.nonce;
1474
+ copy.textContent = cssToCopy(el);
1475
+ copy.setAttribute(ADOPTED_HOST_STYLE_ATTR, "");
1476
+ adoptedStyles.appendChild(copy);
1477
+ return;
1478
+ }
1479
+ const linkClone = el.cloneNode(true);
1480
+ linkClone.setAttribute(ADOPTED_HOST_STYLE_ATTR, "");
1481
+ adoptedStyles.appendChild(linkClone);
1482
+ });
1483
+ shadowRoot.insertBefore(adoptedStyles, shadowRoot.firstChild);
1484
+ supersededStyles.forEach((el) => el.remove());
1485
+ }
1486
+ /**
1487
+ * Box-model resets and :host defaults needed inside every shadow root.
1488
+ * These aren't part of Tailwind's compiled output but are required for
1489
+ * consistent rendering across browsers.
1490
+ *
1491
+ * Reuses the node a previous mount left behind, exactly as `injectStylesheet`
1492
+ * does in `@gears-frontx/mfes`' shadow utilities: a remount runs against a
1493
+ * shadow root that `createShadowRoot` handed back intact, and appending a
1494
+ * second copy would add one node per mount forever.
1495
+ *
1496
+ * Reuse alone is not enough, which is why the node is also positioned on every
1497
+ * mount rather than left where the previous one sat. These resets are context
1498
+ * like the adopted block is - `border-color: currentColor` on `*` is a 0-0-0
1499
+ * declaration that beats an MFE preflight's own 0-0-0 reset purely on document
1500
+ * order - so they have to stay ahead of the MFE's CSS, and where they land is
1501
+ * not stable on its own. `MfeHandlerMF.wrapLifecycleWithStylesheets` removes the
1502
+ * MFE's stylesheet on unmount and appends a fresh one before the next mount, so
1503
+ * a node merely left in place ends up ahead of that stylesheet on a remount and
1504
+ * behind it on the first mount: two different cascades for one component.
1505
+ * Anchoring it to the end of the shell-owned head gives every mount the same
1506
+ * order - adopted block, isolation, resets, MFE - which is also the order the
1507
+ * adoption method's invariant is written against.
1508
+ *
1509
+ * With no shell-owned node to anchor to, the resets go to the front. That is the
1510
+ * plain-`Element` container: no adopted block, no isolation style, and the MFE
1511
+ * stylesheet already appended by the handler, so the front is again the only
1512
+ * position that leaves the MFE winning ties.
1513
+ *
1514
+ * Looked up by attribute-selector form rather than `getElementById`, which
1515
+ * `ShadowRoot` has but `Element` does not, and this hook takes either.
1516
+ */
1517
+ injectBaseResets(container) {
1518
+ const existing = container.querySelector(
1519
+ `style[id="${BASE_RESETS_STYLE_ID}"]`
1520
+ );
1521
+ const style = existing ?? document.createElement("style");
1522
+ style.id = BASE_RESETS_STYLE_ID;
1523
+ style.textContent = `
1524
+ *, *::before, *::after {
1525
+ box-sizing: border-box;
1526
+ border-width: 0;
1527
+ border-style: solid;
1528
+ border-color: currentColor;
1529
+ }
1530
+ * { margin: 0; padding: 0; }
1531
+ :host {
1532
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
1533
+ line-height: 1.5;
1534
+ -webkit-font-smoothing: antialiased;
1535
+ -moz-osx-font-smoothing: grayscale;
1536
+ color: var(--foreground);
1537
+ background-color: var(--background);
1538
+ }
1539
+ `;
1540
+ const shellOwnedHead = container.querySelectorAll(
1541
+ [
1542
+ `[${ADOPTED_HOST_STYLE_ATTR}]`,
1543
+ ...SHELL_OWNED_SHADOW_STYLE_IDS.map((id) => `[id="${id}"]`)
1544
+ ].join(", ")
1545
+ );
1546
+ const lastShellOwnedNode = shellOwnedHead[shellOwnedHead.length - 1];
1547
+ container.insertBefore(
1548
+ style,
1549
+ lastShellOwnedNode ? lastShellOwnedNode.nextSibling : container.firstChild
1550
+ );
1551
+ }
1552
+ /**
1553
+ * Hook for subclasses to inject additional CSS not covered by the adopted host
1554
+ * stylesheet (e.g., MFE-specific @font-face rules or custom animations).
1555
+ * No-op by default: host styles adopted in adoptHostStylesIntoShadowRoot()
1556
+ * already include all Tailwind utilities compiled from MFE source files.
1557
+ */
1558
+ initializeStyles(_container) {
599
1559
  }
600
1560
  };
601
1561
 
602
1562
  // src/mfe/components/ExtensionDomainSlot.tsx
603
- var import_react13 = require("react");
604
- var import_framework5 = require("@gears-frontx/framework");
605
- var import_jsx_runtime3 = require("react/jsx-runtime");
1563
+ var import_react18 = require("react");
1564
+ var import_jsx_runtime5 = require("react/jsx-runtime");
606
1565
  function ExtensionDomainSlot(props) {
607
1566
  const {
608
1567
  registry,
609
1568
  domainId,
610
- extensionId,
611
1569
  className,
612
- onMounted,
613
- onUnmounted,
614
- onError,
615
- loadingComponent,
616
- errorComponent
1570
+ onAttached,
1571
+ onDetached,
1572
+ loadingComponent = null
617
1573
  } = props;
618
- const containerRef = (0, import_react13.useRef)(null);
619
- const [isLoading, setIsLoading] = (0, import_react13.useState)(true);
620
- const [error, setError] = (0, import_react13.useState)(null);
621
- const [bridge, setBridge] = (0, import_react13.useState)(null);
622
- (0, import_react13.useEffect)(() => {
623
- let mounted = true;
624
- let currentBridge = null;
625
- async function mountExtension2() {
626
- if (!containerRef.current) {
627
- return;
628
- }
629
- try {
630
- setIsLoading(true);
631
- setError(null);
632
- await registry.executeActionsChain({
633
- action: {
634
- type: import_framework5.FRONTX_ACTION_MOUNT_EXT,
635
- target: domainId,
636
- payload: {
637
- extensionId
638
- }
639
- }
640
- });
641
- if (!mounted) {
642
- await registry.executeActionsChain({
643
- action: {
644
- type: import_framework5.FRONTX_ACTION_UNMOUNT_EXT,
645
- target: domainId,
646
- payload: {
647
- extensionId
648
- }
649
- }
650
- });
651
- return;
652
- }
653
- const newBridge = registry.getParentBridge(extensionId);
654
- if (!newBridge) {
655
- throw new Error(`Failed to obtain bridge for extension ${extensionId} after mount`);
656
- }
657
- currentBridge = newBridge;
658
- setBridge(newBridge);
659
- setIsLoading(false);
660
- if (onMounted) {
661
- onMounted(newBridge);
662
- }
663
- } catch (err) {
664
- if (!mounted) {
665
- return;
666
- }
667
- const errorObj = err instanceof Error ? err : new Error(String(err));
668
- setError(errorObj);
669
- setIsLoading(false);
670
- if (onError) {
671
- onError(errorObj);
672
- }
673
- }
1574
+ const rootRef = (0, import_react18.useRef)(null);
1575
+ const emitAttached = (0, import_react18.useEffectEvent)((root) => {
1576
+ onAttached?.(root);
1577
+ });
1578
+ const emitDetached = (0, import_react18.useEffectEvent)(() => {
1579
+ onDetached?.();
1580
+ });
1581
+ const [attached, setAttached] = (0, import_react18.useState)(false);
1582
+ (0, import_react18.useEffect)(() => {
1583
+ const root = rootRef.current;
1584
+ if (!root) {
1585
+ return;
674
1586
  }
675
- void mountExtension2();
1587
+ const mounter = registry.getMounter(domainId);
1588
+ mounter.attach(root);
1589
+ setAttached(true);
1590
+ emitAttached(root);
676
1591
  return () => {
677
- mounted = false;
678
- if (currentBridge) {
679
- void registry.executeActionsChain({
680
- action: {
681
- type: import_framework5.FRONTX_ACTION_UNMOUNT_EXT,
682
- target: domainId,
683
- payload: {
684
- extensionId
685
- }
686
- }
687
- }).then(() => {
688
- if (onUnmounted) {
689
- onUnmounted();
690
- }
691
- });
692
- }
1592
+ const detachPromise = mounter.detach();
1593
+ registerDomainTeardown(detachPromise);
1594
+ setAttached(false);
1595
+ emitDetached();
693
1596
  };
694
- }, [registry, domainId, extensionId, onMounted, onUnmounted, onError]);
695
- if (isLoading) {
696
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, "data-domain-id": domainId, "data-extension-id": extensionId, children: loadingComponent ?? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: "Loading extension..." }) });
697
- }
698
- if (error) {
699
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, "data-domain-id": domainId, "data-extension-id": extensionId, children: errorComponent ? errorComponent(error) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
700
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "Error loading extension:" }),
701
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("pre", { children: error.message })
702
- ] }) });
703
- }
704
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1597
+ }, [registry, domainId]);
1598
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
705
1599
  "div",
706
1600
  {
707
- ref: containerRef,
1601
+ ref: rootRef,
708
1602
  className,
709
1603
  "data-domain-id": domainId,
710
- "data-extension-id": extensionId,
711
- "data-bridge-active": bridge !== null
1604
+ children: !attached ? loadingComponent : null
712
1605
  }
713
1606
  );
714
1607
  }
715
1608
 
716
1609
  // src/index.ts
1610
+ var import_framework4 = require("@gears-frontx/framework");
1611
+ var import_framework5 = require("@gears-frontx/framework");
717
1612
  var import_framework6 = require("@gears-frontx/framework");
718
1613
  var import_framework7 = require("@gears-frontx/framework");
719
1614
  var import_framework8 = require("@gears-frontx/framework");
@@ -725,19 +1620,24 @@ var import_framework13 = require("@gears-frontx/framework");
725
1620
  var import_framework14 = require("@gears-frontx/framework");
726
1621
  var import_framework15 = require("@gears-frontx/framework");
727
1622
  var import_framework16 = require("@gears-frontx/framework");
728
- var import_framework17 = require("@gears-frontx/framework");
729
- var import_framework18 = require("@gears-frontx/framework");
730
- var import_framework19 = require("@gears-frontx/framework");
731
- var eventBus = import_framework19.eventBus;
1623
+ var eventBus2 = import_framework16.eventBus;
732
1624
  // Annotate the CommonJS export names for ESM import in node:
733
1625
  0 && (module.exports = {
734
1626
  ACCOUNTS_DOMAIN,
1627
+ ActionHandler,
735
1628
  ApiPlugin,
736
1629
  ApiPluginBase,
737
1630
  ApiProtocol,
1631
+ AuthEvents,
738
1632
  BaseApiService,
739
- ContainerProvider,
1633
+ CanAccess,
1634
+ ChildMfeBridge,
1635
+ ConcurrentMountStrategy,
1636
+ ExclusiveMountStrategy,
1637
+ ExtensionDomainImplementation,
1638
+ ExtensionDomainImplementationFactory,
740
1639
  ExtensionDomainSlot,
1640
+ ExtensionMounter,
741
1641
  FRONTX_ACTION_LOAD_EXT,
742
1642
  FRONTX_ACTION_MOUNT_EXT,
743
1643
  FRONTX_ACTION_UNMOUNT_EXT,
@@ -749,48 +1649,48 @@ var eventBus = import_framework19.eventBus;
749
1649
  FRONTX_SHARED_PROPERTY_LANGUAGE,
750
1650
  FRONTX_SHARED_PROPERTY_THEME,
751
1651
  FRONTX_SIDEBAR_DOMAIN,
752
- HAI3Context,
753
- HAI3Provider,
1652
+ FrontXContext,
1653
+ FrontXProvider,
754
1654
  I18nRegistry,
755
1655
  I18nRegistryImpl,
756
1656
  LAYOUT_SLICE_NAME,
757
1657
  Language,
758
1658
  LanguageDisplayMode,
759
- LayoutDomain,
760
1659
  MOCK_PLUGIN,
761
1660
  MfeBridgeFactory,
762
1661
  MfeContext,
763
1662
  MfeHandler,
764
1663
  MfeHandlerMF,
765
1664
  MfeProvider,
766
- MockEventSource,
1665
+ MfeRegistry,
1666
+ MfeRegistryFactory,
767
1667
  MockEvents,
768
- RefContainerProvider,
769
- RestMockPlugin,
1668
+ MountStrategy,
1669
+ OptionalMountStrategy,
1670
+ ParentMfeBridge,
1671
+ RestEndpointProtocol,
770
1672
  RestPlugin,
771
1673
  RestPluginWithConfig,
772
1674
  RestProtocol,
773
1675
  SUPPORTED_LANGUAGES,
774
- ScreensetsRegistry,
775
- ScreensetsRegistryFactory,
776
- SseMockPlugin,
777
1676
  SsePlugin,
778
1677
  SsePluginWithConfig,
779
1678
  SseProtocol,
1679
+ SseStreamProtocol,
780
1680
  TENANT_SLICE_NAME,
781
1681
  TenantEvents,
782
1682
  TextDirection,
1683
+ ThemeAwareReactLifecycle,
783
1684
  apiRegistry,
1685
+ auth,
784
1686
  changeTenant,
785
- clearActiveScreen,
786
1687
  clearTenant,
787
1688
  clearTenantAction,
788
1689
  clearUser,
789
1690
  closeAllPopups,
790
1691
  closePopup,
791
1692
  closeTopPopup,
792
- createHAI3,
793
- createHAI3App,
1693
+ createFrontX,
794
1694
  createI18nRegistry,
795
1695
  createShadowRoot,
796
1696
  createSlice,
@@ -798,10 +1698,10 @@ var eventBus = import_framework19.eventBus;
798
1698
  createThemeRegistry,
799
1699
  effects,
800
1700
  eventBus,
801
- extensionScreenSchema,
802
1701
  extractGtsPackage,
803
1702
  footerActions,
804
1703
  footerSlice,
1704
+ frontxApiTransport,
805
1705
  getLanguageMetadata,
806
1706
  getStore,
807
1707
  gtsPlugin,
@@ -814,23 +1714,23 @@ var eventBus = import_framework19.eventBus;
814
1714
  initMockEffects,
815
1715
  initTenantEffects,
816
1716
  injectCssVariables,
1717
+ invalidateQueryCacheForApp,
817
1718
  isMockPlugin,
818
1719
  isRestShortCircuit,
819
1720
  isShortCircuit,
820
1721
  isSseShortCircuit,
821
- languageSchema,
822
1722
  layout,
823
1723
  layoutDomainReducers,
824
1724
  layoutReducer,
825
1725
  loadExtension,
826
1726
  menuActions,
827
1727
  menuSlice,
1728
+ mfeRegistryFactory,
828
1729
  microfrontends,
829
1730
  mock,
830
1731
  mockActions,
831
1732
  mockSlice,
832
1733
  mountExtension,
833
- navigateTo,
834
1734
  openPopup,
835
1735
  overlayActions,
836
1736
  overlayDomain,
@@ -839,17 +1739,14 @@ var eventBus = import_framework19.eventBus;
839
1739
  popupDomain,
840
1740
  popupSlice,
841
1741
  presets,
1742
+ queryCache,
1743
+ queryCacheShared,
842
1744
  registerExtension,
843
1745
  registerSlice,
844
- screenActions,
845
1746
  screenDomain,
846
- screenSlice,
847
- screensets,
848
- screensetsRegistryFactory,
849
1747
  selectExtensionError,
850
1748
  selectExtensionState,
851
1749
  selectRegisteredExtensions,
852
- setActiveScreen,
853
1750
  setFooterConfig,
854
1751
  setFooterVisible,
855
1752
  setHeaderLoading,
@@ -859,7 +1756,6 @@ var eventBus = import_framework19.eventBus;
859
1756
  setMenuVisible,
860
1757
  setMockEnabled,
861
1758
  setOverlayVisible,
862
- setScreenLoading,
863
1759
  setSidebarCollapsed,
864
1760
  setSidebarConfig,
865
1761
  setSidebarContent,
@@ -875,25 +1771,33 @@ var eventBus = import_framework19.eventBus;
875
1771
  sidebarActions,
876
1772
  sidebarDomain,
877
1773
  sidebarSlice,
1774
+ subscribeQueryCacheRuntimeChanged,
878
1775
  tenantActions,
879
1776
  tenantReducer,
880
1777
  tenantSlice,
881
- themeSchema,
882
1778
  themes,
883
1779
  toggleMenu,
884
1780
  toggleMockMode,
885
1781
  toggleSidebar,
886
1782
  unmountExtension,
887
1783
  unregisterExtension,
888
- useActivePackage,
1784
+ useApiInfiniteQuery,
1785
+ useApiMutation,
1786
+ useApiQuery,
1787
+ useApiStream,
1788
+ useApiSuspenseInfiniteQuery,
1789
+ useApiSuspenseQuery,
889
1790
  useAppDispatch,
890
1791
  useAppSelector,
1792
+ useCanAccess,
891
1793
  useDomainExtensions,
892
1794
  useFormatters,
893
- useHAI3,
1795
+ useFrontX,
894
1796
  useHostAction,
895
1797
  useMfeBridge,
896
1798
  useMfeContext,
1799
+ useMfeRegistry,
1800
+ useQueryCache,
897
1801
  useRegisteredPackages,
898
1802
  useScreenTranslations,
899
1803
  useSharedProperty,