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

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,202 @@ 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_framework5.ACCOUNTS_DOMAIN,
34
+ ActionHandler: () => import_framework14.ActionHandler,
35
+ ApiPlugin: () => import_framework5.ApiPlugin,
36
+ ApiPluginBase: () => import_framework5.ApiPluginBase,
37
+ ApiProtocol: () => import_framework5.ApiProtocol,
38
+ BaseApiService: () => import_framework5.BaseApiService,
39
+ CanAccess: () => CanAccess,
40
+ ChildMfeBridge: () => import_framework14.ChildMfeBridge,
41
+ ConcurrentMountStrategy: () => import_framework14.ConcurrentMountStrategy,
42
+ ExclusiveMountStrategy: () => import_framework14.ExclusiveMountStrategy,
43
+ ExtensionDomainImplementation: () => import_framework14.ExtensionDomainImplementation,
44
+ ExtensionDomainImplementationFactory: () => import_framework14.ExtensionDomainImplementationFactory,
29
45
  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,
46
+ ExtensionMounter: () => import_framework14.ExtensionMounter,
47
+ FRONTX_ACTION_LOAD_EXT: () => import_framework12.FRONTX_ACTION_LOAD_EXT,
48
+ FRONTX_ACTION_MOUNT_EXT: () => import_framework12.FRONTX_ACTION_MOUNT_EXT,
49
+ FRONTX_ACTION_UNMOUNT_EXT: () => import_framework12.FRONTX_ACTION_UNMOUNT_EXT,
50
+ FRONTX_MFE_ENTRY_MF: () => import_framework11.FRONTX_MFE_ENTRY_MF,
51
+ FRONTX_OVERLAY_DOMAIN: () => import_framework10.FRONTX_OVERLAY_DOMAIN,
52
+ FRONTX_POPUP_DOMAIN: () => import_framework10.FRONTX_POPUP_DOMAIN,
53
+ FRONTX_SCREEN_DOMAIN: () => import_framework10.FRONTX_SCREEN_DOMAIN,
54
+ FRONTX_SCREEN_EXTENSION_TYPE: () => import_framework11.FRONTX_SCREEN_EXTENSION_TYPE,
55
+ FRONTX_SHARED_PROPERTY_LANGUAGE: () => import_framework13.FRONTX_SHARED_PROPERTY_LANGUAGE,
56
+ FRONTX_SHARED_PROPERTY_THEME: () => import_framework13.FRONTX_SHARED_PROPERTY_THEME,
57
+ FRONTX_SIDEBAR_DOMAIN: () => import_framework10.FRONTX_SIDEBAR_DOMAIN,
58
+ FrontXContext: () => FrontXContext,
59
+ FrontXProvider: () => FrontXProvider,
60
+ I18nRegistry: () => import_framework5.I18nRegistry,
61
+ I18nRegistryImpl: () => import_framework5.I18nRegistryImpl,
62
+ LAYOUT_SLICE_NAME: () => import_framework5.LAYOUT_SLICE_NAME,
63
+ Language: () => import_framework6.Language,
64
+ LanguageDisplayMode: () => import_framework6.LanguageDisplayMode,
65
+ LayoutDomain: () => import_framework5.LayoutDomain,
66
+ MOCK_PLUGIN: () => import_framework5.MOCK_PLUGIN,
67
+ MfeBridgeFactory: () => import_framework14.MfeBridgeFactory,
51
68
  MfeContext: () => MfeContext,
52
- MfeHandler: () => import_framework15.MfeHandler,
53
- MfeHandlerMF: () => import_framework16.MfeHandlerMF,
69
+ MfeHandler: () => import_framework14.MfeHandler,
70
+ MfeHandlerMF: () => import_framework15.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_framework14.MfeRegistry,
73
+ MfeRegistryFactory: () => import_framework14.MfeRegistryFactory,
74
+ MockEventSource: () => import_framework5.MockEventSource,
75
+ MockEvents: () => import_framework5.MockEvents,
76
+ MountStrategy: () => import_framework14.MountStrategy,
77
+ OptionalMountStrategy: () => import_framework14.OptionalMountStrategy,
78
+ ParentMfeBridge: () => import_framework14.ParentMfeBridge,
79
+ RestEndpointProtocol: () => import_framework5.RestEndpointProtocol,
80
+ RestMockPlugin: () => import_framework5.RestMockPlugin,
81
+ RestPlugin: () => import_framework5.RestPlugin,
82
+ RestPluginWithConfig: () => import_framework5.RestPluginWithConfig,
83
+ RestProtocol: () => import_framework5.RestProtocol,
84
+ SUPPORTED_LANGUAGES: () => import_framework5.SUPPORTED_LANGUAGES,
85
+ SseMockPlugin: () => import_framework5.SseMockPlugin,
86
+ SsePlugin: () => import_framework5.SsePlugin,
87
+ SsePluginWithConfig: () => import_framework5.SsePluginWithConfig,
88
+ SseProtocol: () => import_framework5.SseProtocol,
89
+ SseStreamProtocol: () => import_framework5.SseStreamProtocol,
90
+ TENANT_SLICE_NAME: () => import_framework5.TENANT_SLICE_NAME,
91
+ TenantEvents: () => import_framework5.TenantEvents,
92
+ TextDirection: () => import_framework6.TextDirection,
93
+ ThemeAwareReactLifecycle: () => ThemeAwareReactLifecycle,
94
+ apiRegistry: () => import_framework5.apiRegistry,
95
+ auth: () => import_framework5.auth,
96
+ changeTenant: () => import_framework5.changeTenant,
97
+ clearTenant: () => import_framework5.clearTenant,
98
+ clearTenantAction: () => import_framework5.clearTenantAction,
99
+ clearUser: () => import_framework5.clearUser,
100
+ closeAllPopups: () => import_framework5.closeAllPopups,
101
+ closePopup: () => import_framework5.closePopup,
102
+ closeTopPopup: () => import_framework5.closeTopPopup,
103
+ createFrontX: () => import_framework5.createFrontX,
104
+ createFrontXApp: () => import_framework5.createFrontXApp,
105
+ createI18nRegistry: () => import_framework5.createI18nRegistry,
106
+ createShadowRoot: () => import_framework17.createShadowRoot,
107
+ createSlice: () => import_framework5.createSlice,
108
+ createStore: () => import_framework5.createStore,
109
+ createThemeRegistry: () => import_framework5.createThemeRegistry,
110
+ effects: () => import_framework5.effects,
111
+ eventBus: () => eventBus2,
112
+ extensionScreenSchema: () => import_framework16.extensionScreenSchema,
113
+ extractGtsPackage: () => import_framework17.extractGtsPackage,
114
+ footerActions: () => import_framework5.footerActions,
115
+ footerSlice: () => import_framework5.footerSlice,
116
+ frontxApiTransport: () => import_framework5.frontxApiTransport,
117
+ getLanguageMetadata: () => import_framework5.getLanguageMetadata,
118
+ getStore: () => import_framework5.getStore,
119
+ gtsPlugin: () => import_framework15.gtsPlugin,
120
+ hasSlice: () => import_framework5.hasSlice,
121
+ headerActions: () => import_framework5.headerActions,
122
+ headerSlice: () => import_framework5.headerSlice,
123
+ hideOverlay: () => import_framework5.hideOverlay,
124
+ i18n: () => import_framework5.i18n,
125
+ i18nRegistry: () => import_framework5.i18nRegistry,
126
+ initMockEffects: () => import_framework5.initMockEffects,
127
+ initTenantEffects: () => import_framework5.initTenantEffects,
128
+ injectCssVariables: () => import_framework17.injectCssVariables,
129
+ invalidateQueryCacheForApp: () => invalidateQueryCacheForApp,
130
+ isMockPlugin: () => import_framework5.isMockPlugin,
131
+ isRestShortCircuit: () => import_framework5.isRestShortCircuit,
132
+ isShortCircuit: () => import_framework5.isShortCircuit,
133
+ isSseShortCircuit: () => import_framework5.isSseShortCircuit,
134
+ languageSchema: () => import_framework16.languageSchema,
135
+ layout: () => import_framework5.layout,
136
+ layoutDomainReducers: () => import_framework5.layoutDomainReducers,
137
+ layoutReducer: () => import_framework5.layoutReducer,
138
+ loadExtension: () => import_framework8.loadExtension,
139
+ menuActions: () => import_framework5.menuActions,
140
+ menuSlice: () => import_framework5.menuSlice,
141
+ mfeRegistryFactory: () => import_framework14.mfeRegistryFactory,
142
+ microfrontends: () => import_framework7.microfrontends,
143
+ mock: () => import_framework7.mock,
144
+ mockActions: () => import_framework5.mockActions,
145
+ mockSlice: () => import_framework5.mockSlice,
146
+ mountExtension: () => import_framework8.mountExtension,
147
+ openPopup: () => import_framework5.openPopup,
148
+ overlayActions: () => import_framework5.overlayActions,
149
+ overlayDomain: () => import_framework10.overlayDomain,
150
+ overlaySlice: () => import_framework5.overlaySlice,
151
+ popupActions: () => import_framework5.popupActions,
152
+ popupDomain: () => import_framework10.popupDomain,
153
+ popupSlice: () => import_framework5.popupSlice,
154
+ presets: () => import_framework5.presets,
155
+ queryCache: () => import_framework5.queryCache,
156
+ queryCacheShared: () => import_framework5.queryCacheShared,
157
+ registerExtension: () => import_framework8.registerExtension,
158
+ registerSlice: () => import_framework5.registerSlice,
159
+ screenDomain: () => import_framework10.screenDomain,
160
+ selectExtensionError: () => import_framework9.selectExtensionError,
161
+ selectExtensionState: () => import_framework9.selectExtensionState,
162
+ selectMountedExtensions: () => import_framework9.selectMountedExtensions,
163
+ selectRegisteredExtensions: () => import_framework9.selectRegisteredExtensions,
164
+ setFooterConfig: () => import_framework5.setFooterConfig,
165
+ setFooterVisible: () => import_framework5.setFooterVisible,
166
+ setHeaderLoading: () => import_framework5.setHeaderLoading,
167
+ setMenuCollapsed: () => import_framework5.setMenuCollapsed,
168
+ setMenuConfig: () => import_framework5.setMenuConfig,
169
+ setMenuItems: () => import_framework5.setMenuItems,
170
+ setMenuVisible: () => import_framework5.setMenuVisible,
171
+ setMockEnabled: () => import_framework5.setMockEnabled,
172
+ setOverlayVisible: () => import_framework5.setOverlayVisible,
173
+ setSidebarCollapsed: () => import_framework5.setSidebarCollapsed,
174
+ setSidebarConfig: () => import_framework5.setSidebarConfig,
175
+ setSidebarContent: () => import_framework5.setSidebarContent,
176
+ setSidebarPosition: () => import_framework5.setSidebarPosition,
177
+ setSidebarTitle: () => import_framework5.setSidebarTitle,
178
+ setSidebarVisible: () => import_framework5.setSidebarVisible,
179
+ setSidebarWidth: () => import_framework5.setSidebarWidth,
180
+ setTenant: () => import_framework5.setTenant,
181
+ setTenantLoading: () => import_framework5.setTenantLoading,
182
+ setTenantLoadingState: () => import_framework5.setTenantLoadingState,
183
+ setUser: () => import_framework5.setUser,
184
+ showOverlay: () => import_framework5.showOverlay,
185
+ sidebarActions: () => import_framework5.sidebarActions,
186
+ sidebarDomain: () => import_framework10.sidebarDomain,
187
+ sidebarSlice: () => import_framework5.sidebarSlice,
188
+ subscribeQueryCacheRuntimeChanged: () => import_framework5.subscribeQueryCacheRuntimeChanged,
189
+ tenantActions: () => import_framework5.tenantActions,
190
+ tenantReducer: () => import_framework5.tenantReducer,
191
+ tenantSlice: () => import_framework5.tenantSlice,
192
+ themeSchema: () => import_framework16.themeSchema,
193
+ themes: () => import_framework5.themes,
194
+ toggleMenu: () => import_framework5.toggleMenu,
195
+ toggleMockMode: () => import_framework5.toggleMockMode,
196
+ toggleSidebar: () => import_framework5.toggleSidebar,
197
+ unmountExtension: () => import_framework8.unmountExtension,
198
+ unregisterExtension: () => import_framework8.unregisterExtension,
199
+ useApiInfiniteQuery: () => useApiInfiniteQuery,
200
+ useApiMutation: () => useApiMutation,
201
+ useApiQuery: () => useApiQuery,
202
+ useApiStream: () => useApiStream,
203
+ useApiSuspenseInfiniteQuery: () => useApiSuspenseInfiniteQuery,
204
+ useApiSuspenseQuery: () => useApiSuspenseQuery,
178
205
  useAppDispatch: () => useAppDispatch,
179
206
  useAppSelector: () => useAppSelector,
207
+ useCanAccess: () => useCanAccess,
180
208
  useDomainExtensions: () => useDomainExtensions,
181
209
  useFormatters: () => useFormatters,
182
- useHAI3: () => useHAI3,
210
+ useFrontX: () => useFrontX,
183
211
  useHostAction: () => useHostAction,
184
212
  useMfeBridge: () => useMfeBridge,
185
213
  useMfeContext: () => useMfeContext,
214
+ useMountedExtensions: () => useMountedExtensions,
215
+ useQueryCache: () => useQueryCache,
186
216
  useRegisteredPackages: () => useRegisteredPackages,
187
217
  useScreenTranslations: () => useScreenTranslations,
188
218
  useSharedProperty: () => useSharedProperty,
@@ -191,19 +221,19 @@ __export(src_exports, {
191
221
  });
192
222
  module.exports = __toCommonJS(src_exports);
193
223
 
194
- // src/HAI3Provider.tsx
195
- var import_react3 = require("react");
224
+ // src/FrontXProvider.tsx
225
+ var import_react5 = require("react");
196
226
  var import_react_redux = require("react-redux");
197
- var import_framework = require("@gears-frontx/framework");
227
+ var import_framework3 = require("@gears-frontx/framework");
198
228
 
199
- // src/HAI3Context.tsx
229
+ // src/FrontXContext.tsx
200
230
  var import_react = require("react");
201
- var HAI3Context = (0, import_react.createContext)(null);
202
- function useHAI3() {
203
- const context = (0, import_react.useContext)(HAI3Context);
231
+ var FrontXContext = (0, import_react.createContext)(null);
232
+ function useFrontX() {
233
+ const context = (0, import_react.useContext)(FrontXContext);
204
234
  if (!context) {
205
235
  throw new Error(
206
- "useHAI3 must be used within a HAI3Provider. Wrap your application with <HAI3Provider> to access HAI3 features."
236
+ "useFrontX must be used within a FrontXProvider. Wrap your application with <FrontXProvider> to access Gears FrontX features."
207
237
  );
208
238
  }
209
239
  return context;
@@ -228,34 +258,573 @@ var MfeProvider = ({ value, children }) => {
228
258
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MfeContext.Provider, { value, children });
229
259
  };
230
260
 
231
- // src/HAI3Provider.tsx
261
+ // src/queryClient.tsx
262
+ var import_react4 = __toESM(require("react"), 1);
263
+ var import_react_query = require("@tanstack/react-query");
264
+ var import_framework2 = require("@gears-frontx/framework");
265
+
266
+ // src/hooks/QueryCache.ts
267
+ var import_framework = require("@gears-frontx/framework");
268
+ var QUERY_CLIENT_BROADCAST_TARGET = /* @__PURE__ */ Symbol.for("frontx:query-cache:broadcast-target");
269
+ var QUERY_CLIENT_BROADCAST_COUNTER = /* @__PURE__ */ Symbol.for("frontx:query-cache:broadcast-counter");
270
+ function emitCacheEvent(event, payload) {
271
+ import_framework.eventBus.emit(event, payload);
272
+ }
273
+ function ensureBroadcastSource(queryClient) {
274
+ const clientWithMetadata = queryClient;
275
+ const existingSource = clientWithMetadata[QUERY_CLIENT_BROADCAST_TARGET];
276
+ if (typeof existingSource === "string" && existingSource.length > 0) {
277
+ return existingSource;
278
+ }
279
+ const host = globalThis;
280
+ const nextCounter = (host[QUERY_CLIENT_BROADCAST_COUNTER] ?? 0) + 1;
281
+ host[QUERY_CLIENT_BROADCAST_COUNTER] = nextCounter;
282
+ const source = `query-cache-${nextCounter}`;
283
+ clientWithMetadata[QUERY_CLIENT_BROADCAST_TARGET] = source;
284
+ return source;
285
+ }
286
+ function resolveKey(target) {
287
+ if (target !== null && typeof target === "object" && !Array.isArray(target) && "key" in target && "fetch" in target && Array.isArray(target.key) && typeof target.fetch === "function") {
288
+ return target.key;
289
+ }
290
+ return target;
291
+ }
292
+ function toQueryUpdater(dataOrUpdater) {
293
+ if (typeof dataOrUpdater === "function") {
294
+ return dataOrUpdater;
295
+ }
296
+ return () => dataOrUpdater;
297
+ }
298
+ function mapQueryState(state) {
299
+ return {
300
+ data: state.data,
301
+ dataUpdatedAt: state.dataUpdatedAt,
302
+ error: state.error,
303
+ errorUpdatedAt: state.errorUpdatedAt,
304
+ fetchFailureCount: state.fetchFailureCount,
305
+ fetchFailureReason: state.fetchFailureReason,
306
+ fetchStatus: state.fetchStatus,
307
+ isInvalidated: state.isInvalidated,
308
+ status: state.status
309
+ };
310
+ }
311
+ function createQueryCache(queryClient) {
312
+ return {
313
+ get: (key) => {
314
+ return queryClient.getQueryData(resolveKey(key));
315
+ },
316
+ getState: (key) => {
317
+ const state = queryClient.getQueryState(resolveKey(key));
318
+ return state ? mapQueryState(state) : void 0;
319
+ },
320
+ set: (key, dataOrUpdater) => {
321
+ const resolvedKey = resolveKey(key);
322
+ queryClient.setQueryData(resolvedKey, toQueryUpdater(dataOrUpdater));
323
+ emitCacheEvent("cache/set", {
324
+ queryKey: resolvedKey,
325
+ dataOrUpdater,
326
+ source: ensureBroadcastSource(queryClient)
327
+ });
328
+ },
329
+ cancel: (key) => {
330
+ return queryClient.cancelQueries({ queryKey: resolveKey(key) });
331
+ },
332
+ invalidate: (key) => {
333
+ const resolvedKey = resolveKey(key);
334
+ const result = queryClient.invalidateQueries({ queryKey: resolvedKey });
335
+ emitCacheEvent("cache/invalidate", {
336
+ queryKey: resolvedKey,
337
+ source: ensureBroadcastSource(queryClient)
338
+ });
339
+ return result;
340
+ },
341
+ invalidateMany: (filters) => {
342
+ if (filters?.queryKey == null) {
343
+ return Promise.resolve();
344
+ }
345
+ const resolvedKey = resolveKey(filters.queryKey);
346
+ if (!Array.isArray(resolvedKey) || resolvedKey.length === 0) {
347
+ return Promise.resolve();
348
+ }
349
+ const payload = {
350
+ ...filters,
351
+ queryKey: resolvedKey
352
+ };
353
+ const result = queryClient.invalidateQueries(payload);
354
+ emitCacheEvent("cache/invalidate", {
355
+ ...payload,
356
+ source: ensureBroadcastSource(queryClient)
357
+ });
358
+ return result;
359
+ },
360
+ remove: (key) => {
361
+ const resolvedKey = resolveKey(key);
362
+ queryClient.removeQueries({ queryKey: resolvedKey });
363
+ emitCacheEvent("cache/remove", {
364
+ queryKey: resolvedKey,
365
+ source: ensureBroadcastSource(queryClient)
366
+ });
367
+ }
368
+ };
369
+ }
370
+
371
+ // src/hooks/useLatest.ts
372
+ var import_react3 = require("react");
373
+ function useLatest(value) {
374
+ const ref = (0, import_react3.useRef)(value);
375
+ (0, import_react3.useEffect)(() => {
376
+ ref.current = value;
377
+ });
378
+ return ref;
379
+ }
380
+
381
+ // src/queryClient.tsx
232
382
  var import_jsx_runtime2 = require("react/jsx-runtime");
233
- var HAI3Provider = ({
383
+ var APP_QUERY_CLIENT_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client");
384
+ var APP_QUERY_CLIENT_RESOLVER_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client-resolver");
385
+ var APP_QUERY_CLIENT_ACTIVATOR_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client-activator");
386
+ var FrontXQueryClientContext = (0, import_react4.createContext)(void 0);
387
+ var useCommitEffect = typeof globalThis.window === "undefined" ? import_react4.useEffect : import_react4.useLayoutEffect;
388
+ function resolveFrontXQueryClient(app) {
389
+ const clientApp = app;
390
+ return clientApp[APP_QUERY_CLIENT_SYMBOL] ?? clientApp[APP_QUERY_CLIENT_RESOLVER_SYMBOL]?.();
391
+ }
392
+ function hasFrontXQueryClientActivator(app) {
393
+ return typeof app[APP_QUERY_CLIENT_ACTIVATOR_SYMBOL] === "function";
394
+ }
395
+ function activateFrontXQueryClient(app) {
396
+ const clientApp = app;
397
+ return clientApp[APP_QUERY_CLIENT_SYMBOL] ?? clientApp[APP_QUERY_CLIENT_ACTIVATOR_SYMBOL]?.();
398
+ }
399
+ async function invalidateQueryCacheForApp(app, target) {
400
+ const queryClient = resolveFrontXQueryClient(app) ?? activateFrontXQueryClient(app);
401
+ if (!queryClient) {
402
+ throw new Error(
403
+ "[invalidateQueryCacheForApp] No QueryClient on app. Ensure queryCache() or queryCacheShared() is in the plugin chain."
404
+ );
405
+ }
406
+ await createQueryCache(queryClient).invalidate(target);
407
+ }
408
+ function bootstrapFrontXQueryClient(app) {
409
+ return resolveFrontXQueryClient(app);
410
+ }
411
+ function useBootstrappedFrontXQueryClient(app) {
412
+ const fromApp = (0, import_react4.useMemo)(() => bootstrapFrontXQueryClient(app), [app]);
413
+ const [eventResolvedClient, setEventResolvedClient] = (0, import_react4.useState)(
414
+ void 0
415
+ );
416
+ const queryClient = fromApp ?? (eventResolvedClient?.app === app ? eventResolvedClient.queryClient : void 0);
417
+ useCommitEffect(() => {
418
+ if (fromApp || !hasFrontXQueryClientActivator(app)) {
419
+ return;
420
+ }
421
+ const tryResolveQueryClient = () => {
422
+ const nextQueryClient = resolveFrontXQueryClient(app) ?? activateFrontXQueryClient(app);
423
+ if (nextQueryClient) {
424
+ setEventResolvedClient((current) => {
425
+ if (current?.app === app && current.queryClient === nextQueryClient) {
426
+ return current;
427
+ }
428
+ return {
429
+ app,
430
+ queryClient: nextQueryClient
431
+ };
432
+ });
433
+ }
434
+ };
435
+ tryResolveQueryClient();
436
+ const subscription = (0, import_framework2.subscribeQueryCacheRuntimeChanged)(() => {
437
+ tryResolveQueryClient();
438
+ });
439
+ return () => {
440
+ subscription.unsubscribe();
441
+ };
442
+ }, [app, fromApp]);
443
+ return queryClient;
444
+ }
445
+ function FrontXQueryClientProvider({
446
+ queryClient,
447
+ children
448
+ }) {
449
+ if (!queryClient) {
450
+ 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 }) });
451
+ }
452
+ 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 }) });
453
+ }
454
+ function useOptionalFrontXQueryClient() {
455
+ return (0, import_react4.useContext)(FrontXQueryClientContext);
456
+ }
457
+ function useRequiredFrontXQueryClient() {
458
+ const queryClient = useOptionalFrontXQueryClient();
459
+ if (!queryClient) {
460
+ throw new Error(
461
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition."
462
+ );
463
+ }
464
+ return queryClient;
465
+ }
466
+ function buildPageContext(page, pages, descriptor, descriptors) {
467
+ return {
468
+ page,
469
+ pages,
470
+ descriptor,
471
+ descriptors
472
+ };
473
+ }
474
+ function normalizeFetchStaleTime(staleTime) {
475
+ if (staleTime === "static") {
476
+ return Number.POSITIVE_INFINITY;
477
+ }
478
+ return typeof staleTime === "number" ? staleTime : void 0;
479
+ }
480
+ function resolveFetchStaleTime(queryClient, descriptor, overrideStaleTime) {
481
+ return normalizeFetchStaleTime(
482
+ overrideStaleTime ?? descriptor.staleTime ?? queryClient.getDefaultOptions().queries?.staleTime
483
+ );
484
+ }
485
+ function fetchDescriptor(descriptor, options) {
486
+ return descriptor.fetch(options);
487
+ }
488
+ function useFrontXQuery(descriptor, overrides) {
489
+ const queryClient = useRequiredFrontXQueryClient();
490
+ const staleTime = resolveFetchStaleTime(queryClient, descriptor, overrides?.staleTime);
491
+ const result = (0, import_react_query.useQuery)({
492
+ queryKey: descriptor.key,
493
+ queryFn: ({ signal }) => fetchDescriptor(descriptor, { signal, staleTime }),
494
+ staleTime: overrides?.staleTime ?? descriptor.staleTime,
495
+ gcTime: overrides?.gcTime ?? descriptor.gcTime
496
+ });
497
+ return {
498
+ data: result.data,
499
+ error: result.error,
500
+ isLoading: result.isLoading,
501
+ isFetching: result.isFetching,
502
+ isError: result.isError,
503
+ refetch: result.refetch
504
+ };
505
+ }
506
+ function useFrontXSuspenseQuery(descriptor, overrides) {
507
+ const queryClient = useRequiredFrontXQueryClient();
508
+ const staleTime = resolveFetchStaleTime(queryClient, descriptor, overrides?.staleTime);
509
+ const result = (0, import_react_query.useSuspenseQuery)({
510
+ queryKey: descriptor.key,
511
+ queryFn: ({ signal }) => fetchDescriptor(descriptor, { signal, staleTime }),
512
+ staleTime: overrides?.staleTime ?? descriptor.staleTime,
513
+ gcTime: overrides?.gcTime ?? descriptor.gcTime
514
+ });
515
+ return {
516
+ data: result.data,
517
+ error: result.error,
518
+ isFetching: result.isFetching,
519
+ refetch: async () => {
520
+ await result.refetch();
521
+ }
522
+ };
523
+ }
524
+ function useFrontXInfiniteQuery(options) {
525
+ const queryClient = useRequiredFrontXQueryClient();
526
+ const result = (0, import_react_query.useInfiniteQuery)({
527
+ queryKey: options.initialPage.key,
528
+ initialPageParam: options.initialPage,
529
+ queryFn: ({ pageParam, signal }) => fetchDescriptor(pageParam, {
530
+ signal,
531
+ staleTime: resolveFetchStaleTime(queryClient, pageParam, options.staleTime)
532
+ }),
533
+ getNextPageParam: (lastPage, allPages, lastPageDescriptor, allPageDescriptors) => options.getNextPage(
534
+ buildPageContext(
535
+ lastPage,
536
+ allPages,
537
+ lastPageDescriptor,
538
+ allPageDescriptors
539
+ )
540
+ ),
541
+ getPreviousPageParam: options.getPreviousPage ? (firstPage, allPages, firstPageDescriptor, allPageDescriptors) => options.getPreviousPage?.(
542
+ buildPageContext(
543
+ firstPage,
544
+ allPages,
545
+ firstPageDescriptor,
546
+ allPageDescriptors
547
+ )
548
+ ) : void 0,
549
+ select: (data) => data.pages,
550
+ staleTime: options.staleTime ?? options.initialPage.staleTime,
551
+ gcTime: options.gcTime ?? options.initialPage.gcTime,
552
+ maxPages: options.maxPages
553
+ });
554
+ return {
555
+ data: result.data,
556
+ error: result.error,
557
+ isLoading: result.isLoading,
558
+ isFetching: result.isFetching,
559
+ isError: result.isError,
560
+ hasNextPage: result.hasNextPage ?? false,
561
+ hasPreviousPage: result.hasPreviousPage ?? false,
562
+ isFetchingNextPage: result.isFetchingNextPage,
563
+ isFetchingPreviousPage: result.isFetchingPreviousPage,
564
+ fetchNextPage: async () => {
565
+ await result.fetchNextPage();
566
+ },
567
+ fetchPreviousPage: async () => {
568
+ await result.fetchPreviousPage();
569
+ },
570
+ refetch: async () => {
571
+ await result.refetch();
572
+ }
573
+ };
574
+ }
575
+ function useFrontXSuspenseInfiniteQuery(options) {
576
+ const queryClient = useRequiredFrontXQueryClient();
577
+ const result = (0, import_react_query.useSuspenseInfiniteQuery)({
578
+ queryKey: options.initialPage.key,
579
+ initialPageParam: options.initialPage,
580
+ queryFn: ({ pageParam, signal }) => fetchDescriptor(pageParam, {
581
+ signal,
582
+ staleTime: resolveFetchStaleTime(queryClient, pageParam, options.staleTime)
583
+ }),
584
+ getNextPageParam: (lastPage, allPages, lastPageDescriptor, allPageDescriptors) => options.getNextPage(
585
+ buildPageContext(
586
+ lastPage,
587
+ allPages,
588
+ lastPageDescriptor,
589
+ allPageDescriptors
590
+ )
591
+ ),
592
+ getPreviousPageParam: options.getPreviousPage ? (firstPage, allPages, firstPageDescriptor, allPageDescriptors) => options.getPreviousPage?.(
593
+ buildPageContext(
594
+ firstPage,
595
+ allPages,
596
+ firstPageDescriptor,
597
+ allPageDescriptors
598
+ )
599
+ ) : void 0,
600
+ select: (data) => data.pages,
601
+ staleTime: options.staleTime ?? options.initialPage.staleTime,
602
+ gcTime: options.gcTime ?? options.initialPage.gcTime,
603
+ maxPages: options.maxPages
604
+ });
605
+ return {
606
+ data: result.data,
607
+ error: result.error,
608
+ isFetching: result.isFetching,
609
+ hasNextPage: result.hasNextPage ?? false,
610
+ hasPreviousPage: result.hasPreviousPage ?? false,
611
+ isFetchingNextPage: result.isFetchingNextPage,
612
+ isFetchingPreviousPage: result.isFetchingPreviousPage,
613
+ fetchNextPage: async () => {
614
+ await result.fetchNextPage();
615
+ },
616
+ fetchPreviousPage: async () => {
617
+ await result.fetchPreviousPage();
618
+ },
619
+ refetch: async () => {
620
+ await result.refetch();
621
+ }
622
+ };
623
+ }
624
+ function useFrontXMutation(options, callbackCtx) {
625
+ useRequiredFrontXQueryClient();
626
+ const latestRef = useLatest({ options, callbackCtx });
627
+ const fetchAbortControllersRef = import_react4.default.useRef(/* @__PURE__ */ new Set());
628
+ const abortFetchesOnUnmount = import_react4.default.useEffectEvent(() => {
629
+ if (options.abortOnUnmount) {
630
+ for (const controller of fetchAbortControllersRef.current) {
631
+ controller.abort();
632
+ }
633
+ fetchAbortControllersRef.current.clear();
634
+ }
635
+ });
636
+ import_react4.default.useEffect(() => {
637
+ return () => {
638
+ abortFetchesOnUnmount();
639
+ };
640
+ }, []);
641
+ const mutationFn = import_react4.default.useCallback((variables, context) => {
642
+ const cancelOnSupersede = latestRef.current.options.cancelOnSupersede;
643
+ if (cancelOnSupersede) {
644
+ for (const controller2 of fetchAbortControllersRef.current) {
645
+ controller2.abort();
646
+ }
647
+ fetchAbortControllersRef.current.clear();
648
+ }
649
+ const controller = new AbortController();
650
+ fetchAbortControllersRef.current.add(controller);
651
+ const librarySignal = context.signal;
652
+ if (cancelOnSupersede && librarySignal) {
653
+ if (librarySignal.aborted) {
654
+ controller.abort();
655
+ } else {
656
+ librarySignal.addEventListener("abort", () => controller.abort(), { once: true });
657
+ }
658
+ }
659
+ return latestRef.current.options.endpoint.fetch(variables, { signal: controller.signal }).finally(() => {
660
+ fetchAbortControllersRef.current.delete(controller);
661
+ });
662
+ }, [latestRef]);
663
+ const onMutate = import_react4.default.useCallback((variables, _context) => {
664
+ const current = latestRef.current;
665
+ if (!current.options.onMutate) {
666
+ return void 0;
667
+ }
668
+ return current.options.onMutate(variables, current.callbackCtx);
669
+ }, [latestRef]);
670
+ const onSuccess = import_react4.default.useCallback((data, variables, context) => {
671
+ const current = latestRef.current;
672
+ return current.options.onSuccess?.(data, variables, context, current.callbackCtx);
673
+ }, [latestRef]);
674
+ const onError = import_react4.default.useCallback((error, variables, context) => {
675
+ const current = latestRef.current;
676
+ return current.options.onError?.(error, variables, context, current.callbackCtx);
677
+ }, [latestRef]);
678
+ const onSettled = import_react4.default.useCallback((data, error, variables, context) => {
679
+ const current = latestRef.current;
680
+ return current.options.onSettled?.(
681
+ data,
682
+ error,
683
+ variables,
684
+ context,
685
+ current.callbackCtx
686
+ );
687
+ }, [latestRef]);
688
+ const mutation = (0, import_react_query.useMutation)({
689
+ mutationFn,
690
+ onMutate: options.onMutate ? onMutate : void 0,
691
+ onSuccess: options.onSuccess ? onSuccess : void 0,
692
+ onError: options.onError ? onError : void 0,
693
+ onSettled: options.onSettled ? onSettled : void 0
694
+ });
695
+ return {
696
+ mutate: mutation.mutate,
697
+ mutateAsync: mutation.mutateAsync,
698
+ isPending: mutation.isPending,
699
+ error: mutation.error,
700
+ data: mutation.data,
701
+ reset: mutation.reset
702
+ };
703
+ }
704
+
705
+ // src/FrontXProvider.tsx
706
+ var import_jsx_runtime3 = require("react/jsx-runtime");
707
+ function shallowEqual(a, b) {
708
+ if (a === b) return true;
709
+ if (!a || !b) return false;
710
+ const keysA = Object.keys(a);
711
+ if (keysA.length !== Object.keys(b).length) return false;
712
+ return keysA.every((k) => Object.is(a[k], b[k]));
713
+ }
714
+ function createProviderOwnedApp(config) {
715
+ return (0, import_framework3.createFrontXApp)(config);
716
+ }
717
+ var FrontXProvider = ({
234
718
  children,
235
719
  config,
236
720
  app: providedApp,
237
721
  mfeBridge
238
722
  }) => {
239
- const app = (0, import_react3.useMemo)(() => {
723
+ const [stableConfig, setStableConfig] = (0, import_react5.useState)(config);
724
+ if (!shallowEqual(
725
+ stableConfig,
726
+ config
727
+ )) {
728
+ setStableConfig(config);
729
+ }
730
+ const app = (0, import_react5.useMemo)(() => {
240
731
  if (providedApp) {
241
732
  return providedApp;
242
733
  }
243
- return (0, import_framework.createHAI3App)(config);
244
- }, [providedApp, config]);
245
- (0, import_react3.useEffect)(() => {
734
+ return createProviderOwnedApp(stableConfig);
735
+ }, [providedApp, stableConfig]);
736
+ const queryClient = useBootstrappedFrontXQueryClient(app);
737
+ const deferQuerySubtree = hasFrontXQueryClientActivator(app) && queryClient === void 0;
738
+ (0, import_react5.useEffect)(() => {
739
+ if (queryClient || hasFrontXQueryClientActivator(app) || process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test" || process.env.VITEST === "true") {
740
+ return;
741
+ }
742
+ console.warn(
743
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition. useApiQuery/useApiMutation will fail without it."
744
+ );
745
+ }, [app, queryClient]);
746
+ (0, import_react5.useEffect)(() => {
246
747
  return () => {
247
748
  if (!providedApp) {
248
749
  app.destroy();
249
750
  }
250
751
  };
251
752
  }, [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 }) });
753
+ 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
754
  if (mfeBridge) {
254
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MfeProvider, { value: mfeBridge, children: content });
755
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MfeProvider, { value: mfeBridge, children: content });
255
756
  }
256
757
  return content;
257
758
  };
258
759
 
760
+ // src/hooks/useCanAccess.ts
761
+ var import_react6 = require("react");
762
+ function serializeRecordValue(value) {
763
+ if (value === null) return "n:";
764
+ if (typeof value === "string") return `s:${value}`;
765
+ if (typeof value === "number") {
766
+ return `d:${Object.is(value, -0) ? "-0" : String(value)}`;
767
+ }
768
+ return value ? "b:1" : "b:0";
769
+ }
770
+ function accessQueryKey(query) {
771
+ const { action, resource, record } = query;
772
+ const normalizedRecord = record ? Object.entries(record).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => [k, serializeRecordValue(v)]) : null;
773
+ return JSON.stringify([action, resource, normalizedRecord]);
774
+ }
775
+ function getAuthRuntime(app) {
776
+ return app.auth ?? null;
777
+ }
778
+ var DENIED_NO_AUTH = { allow: false, isResolving: false };
779
+ function useCanAccess(query) {
780
+ const app = useFrontX();
781
+ const auth2 = getAuthRuntime(app);
782
+ const stableKey = accessQueryKey(query);
783
+ const [stableQuery, setStableQuery] = (0, import_react6.useState)(() => query);
784
+ const [runState, setRunState] = (0, import_react6.useState)({ auth: auth2, stableKey });
785
+ const [result, setResult] = (0, import_react6.useState)({ allow: false, isResolving: true });
786
+ if (runState.auth !== auth2 || runState.stableKey !== stableKey) {
787
+ setRunState({ auth: auth2, stableKey });
788
+ setStableQuery(query);
789
+ setResult({ allow: false, isResolving: true });
790
+ }
791
+ (0, import_react6.useEffect)(() => {
792
+ if (!auth2) {
793
+ return;
794
+ }
795
+ let alive = true;
796
+ const controller = new AbortController();
797
+ void auth2.canAccess(stableQuery, { signal: controller.signal }).then((decision) => {
798
+ if (alive) {
799
+ setResult({ allow: decision === "allow", isResolving: false });
800
+ }
801
+ }).catch(() => {
802
+ if (alive) {
803
+ setResult({ allow: false, isResolving: false });
804
+ }
805
+ });
806
+ return () => {
807
+ alive = false;
808
+ controller.abort();
809
+ };
810
+ }, [auth2, stableQuery]);
811
+ return auth2 ? result : DENIED_NO_AUTH;
812
+ }
813
+
814
+ // src/components/CanAccess.tsx
815
+ function CanAccess({
816
+ query,
817
+ allowed,
818
+ denied = null,
819
+ loading
820
+ }) {
821
+ const { allow, isResolving } = useCanAccess(query);
822
+ if (isResolving) {
823
+ return loading !== void 0 ? loading : denied;
824
+ }
825
+ return allow ? allowed : denied;
826
+ }
827
+
259
828
  // src/hooks/useAppDispatch.ts
260
829
  var import_react_redux2 = require("react-redux");
261
830
  function useAppDispatch() {
@@ -267,12 +836,12 @@ var import_react_redux3 = require("react-redux");
267
836
  var useAppSelector = import_react_redux3.useSelector;
268
837
 
269
838
  // src/hooks/useTranslation.ts
270
- var import_react4 = require("react");
839
+ var import_react7 = require("react");
271
840
  function useTranslation() {
272
- const app = useHAI3();
841
+ const app = useFrontX();
273
842
  const { i18nRegistry: i18nRegistry2 } = app;
274
- const version = (0, import_react4.useSyncExternalStore)(
275
- (0, import_react4.useCallback)(
843
+ const version = (0, import_react7.useSyncExternalStore)(
844
+ (0, import_react7.useCallback)(
276
845
  (callback) => {
277
846
  return i18nRegistry2.subscribe(callback);
278
847
  },
@@ -281,17 +850,17 @@ function useTranslation() {
281
850
  () => i18nRegistry2.getVersion(),
282
851
  () => i18nRegistry2.getVersion()
283
852
  );
284
- const language = (0, import_react4.useMemo)(() => {
853
+ const language = (0, import_react7.useMemo)(() => {
285
854
  void version;
286
855
  return i18nRegistry2.getLanguage();
287
856
  }, [i18nRegistry2, version]);
288
- const t = (0, import_react4.useCallback)(
857
+ const t = (0, import_react7.useCallback)(
289
858
  (key, params) => {
290
859
  return i18nRegistry2.t(key, params);
291
860
  },
292
861
  [i18nRegistry2]
293
862
  );
294
- const setLanguage = (0, import_react4.useCallback)(
863
+ const setLanguage = (0, import_react7.useCallback)(
295
864
  (lang) => {
296
865
  if (app.actions.setLanguage) {
297
866
  app.actions.setLanguage({ language: lang });
@@ -299,7 +868,7 @@ function useTranslation() {
299
868
  },
300
869
  [app.actions]
301
870
  );
302
- const isRTL = (0, import_react4.useMemo)(() => {
871
+ const isRTL = (0, import_react7.useMemo)(() => {
303
872
  void language;
304
873
  return i18nRegistry2.isRTL();
305
874
  }, [i18nRegistry2, language]);
@@ -312,29 +881,28 @@ function useTranslation() {
312
881
  }
313
882
 
314
883
  // src/hooks/useScreenTranslations.ts
315
- var import_react5 = require("react");
884
+ var import_react8 = require("react");
316
885
  function isTranslationLoader(input) {
317
886
  return typeof input === "function";
318
887
  }
319
888
  function useScreenTranslations(screensetId, screenId, translations) {
320
- const app = useHAI3();
889
+ const app = useFrontX();
321
890
  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)(
891
+ const [loadedLanguage, setLoadedLanguage] = (0, import_react8.useState)(null);
892
+ const [error, setError] = (0, import_react8.useState)(null);
893
+ const version = (0, import_react8.useSyncExternalStore)(
894
+ (0, import_react8.useCallback)(
327
895
  (callback) => i18nRegistry2.subscribe(callback),
328
896
  [i18nRegistry2]
329
897
  ),
330
898
  () => i18nRegistry2.getVersion(),
331
899
  () => i18nRegistry2.getVersion()
332
900
  );
333
- const currentLanguage = (0, import_react5.useMemo)(() => {
901
+ const currentLanguage = (0, import_react8.useMemo)(() => {
334
902
  void version;
335
903
  return i18nRegistry2.getLanguage();
336
904
  }, [i18nRegistry2, version]);
337
- const loader = (0, import_react5.useMemo)(() => {
905
+ const loader = (0, import_react8.useMemo)(() => {
338
906
  if (isTranslationLoader(translations)) {
339
907
  return translations;
340
908
  }
@@ -347,12 +915,11 @@ function useScreenTranslations(screensetId, screenId, translations) {
347
915
  return module2.default;
348
916
  };
349
917
  }, [translations]);
350
- (0, import_react5.useEffect)(() => {
918
+ (0, import_react8.useEffect)(() => {
351
919
  if (!currentLanguage || currentLanguage === loadedLanguage) {
352
920
  return;
353
921
  }
354
922
  let cancelled = false;
355
- setIsLoading(true);
356
923
  const loadTranslations = async () => {
357
924
  try {
358
925
  const namespace = `screen.${screensetId}.${screenId}`;
@@ -361,13 +928,11 @@ function useScreenTranslations(screensetId, screenId, translations) {
361
928
  i18nRegistry2.register(namespace, currentLanguage, loadedTranslations);
362
929
  if (!cancelled) {
363
930
  setLoadedLanguage(currentLanguage);
364
- setIsLoading(false);
365
931
  setError(null);
366
932
  }
367
933
  } catch (err) {
368
934
  if (!cancelled) {
369
935
  setError(err instanceof Error ? err : new Error(String(err)));
370
- setIsLoading(false);
371
936
  }
372
937
  }
373
938
  };
@@ -376,29 +941,29 @@ function useScreenTranslations(screensetId, screenId, translations) {
376
941
  cancelled = true;
377
942
  };
378
943
  }, [screensetId, screenId, loader, i18nRegistry2, currentLanguage, loadedLanguage]);
379
- const isLoaded = currentLanguage !== null && currentLanguage === loadedLanguage && !isLoading;
944
+ const isLoaded = currentLanguage !== null && currentLanguage === loadedLanguage;
380
945
  return { isLoaded, error };
381
946
  }
382
947
 
383
948
  // src/hooks/useFormatters.ts
384
- var import_react6 = require("react");
385
- var import_framework2 = require("@gears-frontx/framework");
949
+ var import_react9 = require("react");
950
+ var import_framework4 = require("@gears-frontx/framework");
386
951
  function useFormatters() {
387
952
  const { language } = useTranslation();
388
- return (0, import_react6.useMemo)(
953
+ return (0, import_react9.useMemo)(
389
954
  () => {
390
955
  void language;
391
956
  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
957
+ formatDate: import_framework4.formatDate,
958
+ formatTime: import_framework4.formatTime,
959
+ formatDateTime: import_framework4.formatDateTime,
960
+ formatRelative: import_framework4.formatRelative,
961
+ formatNumber: import_framework4.formatNumber,
962
+ formatPercent: import_framework4.formatPercent,
963
+ formatCompact: import_framework4.formatCompact,
964
+ formatCurrency: import_framework4.formatCurrency,
965
+ compareStrings: import_framework4.compareStrings,
966
+ createCollator: import_framework4.createCollator
402
967
  };
403
968
  },
404
969
  [language]
@@ -406,12 +971,12 @@ function useFormatters() {
406
971
  }
407
972
 
408
973
  // src/hooks/useTheme.ts
409
- var import_react7 = require("react");
974
+ var import_react10 = require("react");
410
975
  function useTheme() {
411
- const app = useHAI3();
976
+ const app = useFrontX();
412
977
  const { themeRegistry } = app;
413
- const version = (0, import_react7.useSyncExternalStore)(
414
- (0, import_react7.useCallback)(
978
+ const version = (0, import_react10.useSyncExternalStore)(
979
+ (0, import_react10.useCallback)(
415
980
  (callback) => {
416
981
  return themeRegistry.subscribe(callback);
417
982
  },
@@ -420,18 +985,18 @@ function useTheme() {
420
985
  () => themeRegistry.getVersion(),
421
986
  () => themeRegistry.getVersion()
422
987
  );
423
- const currentTheme = (0, import_react7.useMemo)(() => {
988
+ const currentTheme = (0, import_react10.useMemo)(() => {
424
989
  void version;
425
990
  const theme = themeRegistry.getCurrent();
426
991
  return theme?.id;
427
992
  }, [themeRegistry, version]);
428
- const themes2 = (0, import_react7.useMemo)(() => {
993
+ const themes2 = (0, import_react10.useMemo)(() => {
429
994
  return themeRegistry.getAll().map((theme) => ({
430
995
  id: theme.id,
431
996
  name: theme.name
432
997
  }));
433
998
  }, [themeRegistry]);
434
- const setTheme = (0, import_react7.useCallback)(
999
+ const setTheme = (0, import_react10.useCallback)(
435
1000
  (themeId) => {
436
1001
  if (app.actions.changeTheme) {
437
1002
  app.actions.changeTheme({ themeId });
@@ -446,6 +1011,145 @@ function useTheme() {
446
1011
  };
447
1012
  }
448
1013
 
1014
+ // src/hooks/useApiQuery.ts
1015
+ function useApiQuery(descriptor, overrides) {
1016
+ return useFrontXQuery(descriptor, overrides);
1017
+ }
1018
+
1019
+ // src/hooks/useApiSuspenseQuery.ts
1020
+ function useApiSuspenseQuery(descriptor, overrides) {
1021
+ return useFrontXSuspenseQuery(descriptor, overrides);
1022
+ }
1023
+
1024
+ // src/hooks/useApiInfiniteQuery.ts
1025
+ function useApiInfiniteQuery(options) {
1026
+ return useFrontXInfiniteQuery(options);
1027
+ }
1028
+
1029
+ // src/hooks/useApiSuspenseInfiniteQuery.ts
1030
+ function useApiSuspenseInfiniteQuery(options) {
1031
+ return useFrontXSuspenseInfiniteQuery(options);
1032
+ }
1033
+
1034
+ // src/hooks/useApiMutation.ts
1035
+ var import_react11 = require("react");
1036
+ function useApiMutation(options) {
1037
+ const queryClient = useRequiredFrontXQueryClient();
1038
+ const queryCache2 = (0, import_react11.useMemo)(() => createQueryCache(queryClient), [queryClient]);
1039
+ const callbackCtx = (0, import_react11.useMemo)(() => ({ queryCache: queryCache2 }), [queryCache2]);
1040
+ return useFrontXMutation(options, callbackCtx);
1041
+ }
1042
+
1043
+ // src/hooks/useApiStream.ts
1044
+ var import_react12 = require("react");
1045
+ function useApiStream(descriptor, options) {
1046
+ const mode = options?.mode ?? "latest";
1047
+ const enabled = options?.enabled ?? true;
1048
+ const [data, setData] = (0, import_react12.useState)(void 0);
1049
+ const [events, setEvents] = (0, import_react12.useState)([]);
1050
+ const [status, setStatus] = (0, import_react12.useState)(() => enabled ? "connecting" : "idle");
1051
+ const [error, setError] = (0, import_react12.useState)(null);
1052
+ const connectPromiseRef = (0, import_react12.useRef)(null);
1053
+ const connectionIdRef = (0, import_react12.useRef)(null);
1054
+ const disconnectRequestedRef = (0, import_react12.useRef)(false);
1055
+ const descriptorRef = useLatest(descriptor);
1056
+ const descriptorKey = (0, import_react12.useMemo)(() => JSON.stringify(descriptor.key), [descriptor.key]);
1057
+ const resetKey = `${descriptorKey}:${mode}`;
1058
+ const [prevResetKey, setPrevResetKey] = (0, import_react12.useState)(resetKey);
1059
+ if (resetKey !== prevResetKey) {
1060
+ setPrevResetKey(resetKey);
1061
+ setData(void 0);
1062
+ setEvents([]);
1063
+ setError(null);
1064
+ }
1065
+ const connectKey = `${resetKey}:${enabled}`;
1066
+ const [prevConnectKey, setPrevConnectKey] = (0, import_react12.useState)(connectKey);
1067
+ if (connectKey !== prevConnectKey) {
1068
+ setPrevConnectKey(connectKey);
1069
+ if (enabled) {
1070
+ setData(void 0);
1071
+ setEvents([]);
1072
+ setStatus("connecting");
1073
+ setError(null);
1074
+ }
1075
+ }
1076
+ const disconnect = (0, import_react12.useCallback)(() => {
1077
+ disconnectRequestedRef.current = true;
1078
+ if (connectionIdRef.current) {
1079
+ descriptorRef.current.disconnect(connectionIdRef.current);
1080
+ connectionIdRef.current = null;
1081
+ disconnectRequestedRef.current = false;
1082
+ }
1083
+ setStatus("disconnected");
1084
+ }, [descriptorRef]);
1085
+ (0, import_react12.useEffect)(() => {
1086
+ if (!enabled) {
1087
+ return;
1088
+ }
1089
+ let cancelled = false;
1090
+ disconnectRequestedRef.current = false;
1091
+ const d = descriptorRef.current;
1092
+ const connectPromise = d.connect(
1093
+ (event) => {
1094
+ if (cancelled) return;
1095
+ setData(event);
1096
+ setStatus("connected");
1097
+ if (mode === "accumulate") {
1098
+ setEvents((prev) => [...prev, event]);
1099
+ }
1100
+ },
1101
+ () => {
1102
+ if (cancelled) return;
1103
+ setStatus("disconnected");
1104
+ connectionIdRef.current = null;
1105
+ }
1106
+ );
1107
+ connectPromiseRef.current = connectPromise;
1108
+ connectPromise.then((id) => {
1109
+ if (cancelled) return;
1110
+ if (disconnectRequestedRef.current) {
1111
+ d.disconnect(id);
1112
+ disconnectRequestedRef.current = false;
1113
+ return;
1114
+ }
1115
+ connectionIdRef.current = id;
1116
+ setStatus("connected");
1117
+ }).catch((err) => {
1118
+ if (cancelled) return;
1119
+ if (disconnectRequestedRef.current) {
1120
+ disconnectRequestedRef.current = false;
1121
+ setStatus("disconnected");
1122
+ return;
1123
+ }
1124
+ setError(err instanceof Error ? err : new Error(String(err)));
1125
+ setStatus("error");
1126
+ });
1127
+ return () => {
1128
+ cancelled = true;
1129
+ connectPromise.then(
1130
+ (id) => d.disconnect(id),
1131
+ () => {
1132
+ }
1133
+ );
1134
+ connectPromiseRef.current = null;
1135
+ connectionIdRef.current = null;
1136
+ };
1137
+ }, [descriptorKey, enabled, mode, descriptorRef]);
1138
+ return { data, events, status: enabled ? status : "idle", error, disconnect };
1139
+ }
1140
+
1141
+ // src/hooks/useQueryCache.ts
1142
+ var import_react13 = require("react");
1143
+ function useQueryCache() {
1144
+ const queryClient = useOptionalFrontXQueryClient();
1145
+ if (!queryClient) {
1146
+ throw new Error(
1147
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition."
1148
+ );
1149
+ }
1150
+ return (0, import_react13.useMemo)(() => createQueryCache(queryClient), [queryClient]);
1151
+ }
1152
+
449
1153
  // src/mfe/hooks/useMfeBridge.ts
450
1154
  function useMfeBridge() {
451
1155
  const { bridge } = useMfeContext();
@@ -453,31 +1157,31 @@ function useMfeBridge() {
453
1157
  }
454
1158
 
455
1159
  // src/mfe/hooks/useSharedProperty.ts
456
- var import_react8 = require("react");
1160
+ var import_react14 = require("react");
457
1161
  function useSharedProperty(propertyTypeId) {
458
1162
  const { bridge } = useMfeContext();
459
- const subscribe = (0, import_react8.useCallback)((callback) => {
1163
+ const subscribe = (0, import_react14.useCallback)((callback) => {
460
1164
  return bridge.subscribeToProperty(propertyTypeId, () => {
461
1165
  callback();
462
1166
  });
463
1167
  }, [bridge, propertyTypeId]);
464
- const getSnapshot = (0, import_react8.useCallback)(() => {
1168
+ const getSnapshot = (0, import_react14.useCallback)(() => {
465
1169
  const property = bridge.getProperty(propertyTypeId);
466
1170
  return property?.value;
467
1171
  }, [bridge, propertyTypeId]);
468
- const value = (0, import_react8.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1172
+ const value = (0, import_react14.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
469
1173
  return value;
470
1174
  }
471
1175
 
472
1176
  // src/mfe/hooks/useHostAction.ts
473
- var import_react9 = require("react");
1177
+ var import_react15 = require("react");
474
1178
  function useHostAction(actionTypeId) {
475
1179
  const { bridge } = useMfeContext();
476
- return (0, import_react9.useCallback)((payload) => {
1180
+ return (0, import_react15.useCallback)((payload) => {
477
1181
  const chain = {
478
1182
  action: {
479
1183
  type: actionTypeId,
480
- target: bridge.domainId,
1184
+ target: bridge.extDomainId,
481
1185
  payload
482
1186
  }
483
1187
  };
@@ -491,23 +1195,23 @@ function useHostAction(actionTypeId) {
491
1195
  }
492
1196
 
493
1197
  // src/mfe/hooks/useDomainExtensions.ts
494
- var import_react10 = require("react");
1198
+ var import_react16 = require("react");
495
1199
  function useDomainExtensions(domainId) {
496
- const app = useHAI3();
497
- const registry = app.screensetsRegistry;
1200
+ const app = useFrontX();
1201
+ const registry = app.mfeRegistry;
498
1202
  if (!registry) {
499
1203
  throw new Error(
500
- "useDomainExtensions requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
1204
+ "useDomainExtensions requires the microfrontends plugin. Add microfrontends() to your Gears FrontX app configuration."
501
1205
  );
502
1206
  }
503
- const subscribe = (0, import_react10.useCallback)(
1207
+ const subscribe = (0, import_react16.useCallback)(
504
1208
  (onStoreChange) => {
505
1209
  return app.store.subscribe(onStoreChange);
506
1210
  },
507
1211
  [app.store]
508
1212
  );
509
- const cacheRef = (0, import_react10.useRef)({ ids: "", extensions: [] });
510
- const getSnapshot = (0, import_react10.useCallback)(() => {
1213
+ const cacheRef = (0, import_react16.useRef)({ ids: "", extensions: [] });
1214
+ const getSnapshot = (0, import_react16.useCallback)(() => {
511
1215
  const extensions = registry.getExtensionsForDomain(domainId);
512
1216
  const ids = extensions.map((e) => e.id).join(",");
513
1217
  if (ids !== cacheRef.current.ids) {
@@ -515,205 +1219,221 @@ function useDomainExtensions(domainId) {
515
1219
  }
516
1220
  return cacheRef.current.extensions;
517
1221
  }, [registry, domainId]);
518
- return (0, import_react10.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1222
+ return (0, import_react16.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
519
1223
  }
520
1224
 
521
- // src/mfe/hooks/useRegisteredPackages.ts
522
- var import_react11 = require("react");
523
- function useRegisteredPackages() {
524
- const app = useHAI3();
525
- const registry = app.screensetsRegistry;
1225
+ // src/mfe/hooks/useMountedExtensions.ts
1226
+ var import_react17 = require("react");
1227
+ function useMountedExtensions(domainId) {
1228
+ const app = useFrontX();
1229
+ const registry = app.mfeRegistry;
526
1230
  if (!registry) {
527
1231
  throw new Error(
528
- "useRegisteredPackages requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
1232
+ "useMountedExtensions requires the microfrontends plugin. Add microfrontends() to your Gears FrontX app configuration."
529
1233
  );
530
1234
  }
531
- const subscribe = (0, import_react11.useCallback)(
1235
+ const subscribe = (0, import_react17.useCallback)(
532
1236
  (onStoreChange) => {
533
1237
  return app.store.subscribe(onStoreChange);
534
1238
  },
535
1239
  [app.store]
536
1240
  );
537
- const cacheRef = (0, import_react11.useRef)({ packages: "", list: [] });
538
- const getSnapshot = (0, import_react11.useCallback)(() => {
539
- const list = registry.getRegisteredPackages();
540
- const packages = list.join(",");
541
- if (packages !== cacheRef.current.packages) {
542
- cacheRef.current = { packages, list };
1241
+ const cacheRef = (0, import_react17.useRef)({ key: "", extensions: [] });
1242
+ const getSnapshot = (0, import_react17.useCallback)(() => {
1243
+ const ids = registry.getMountedExtensions(domainId);
1244
+ const resolved = ids.map((id) => registry.getExtension(id)).filter((ext) => ext !== void 0);
1245
+ const key = ids.join(",");
1246
+ if (key !== cacheRef.current.key) {
1247
+ cacheRef.current = { key, extensions: resolved };
543
1248
  }
544
- return cacheRef.current.list;
545
- }, [registry]);
546
- return (0, import_react11.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1249
+ return cacheRef.current.extensions;
1250
+ }, [registry, domainId]);
1251
+ return (0, import_react17.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
547
1252
  }
548
1253
 
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;
1254
+ // src/mfe/hooks/useRegisteredPackages.ts
1255
+ var import_react18 = require("react");
1256
+ function useRegisteredPackages() {
1257
+ const app = useFrontX();
1258
+ const registry = app.mfeRegistry;
555
1259
  if (!registry) {
556
1260
  throw new Error(
557
- "useActivePackage requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
1261
+ "useRegisteredPackages requires the microfrontends plugin. Add microfrontends() to your Gears FrontX app configuration."
558
1262
  );
559
1263
  }
560
- const subscribe = (0, import_react12.useCallback)(
1264
+ const subscribe = (0, import_react18.useCallback)(
561
1265
  (onStoreChange) => {
562
1266
  return app.store.subscribe(onStoreChange);
563
1267
  },
564
1268
  [app.store]
565
1269
  );
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 };
1270
+ const cacheRef = (0, import_react18.useRef)({ packages: "", list: [] });
1271
+ const getSnapshot = (0, import_react18.useCallback)(() => {
1272
+ const list = registry.getRegisteredPackages();
1273
+ const packages = list.join(",");
1274
+ if (packages !== cacheRef.current.packages) {
1275
+ cacheRef.current = { packages, list };
579
1276
  }
580
- return cacheRef.current.activePackage;
1277
+ return cacheRef.current.list;
581
1278
  }, [registry]);
582
- return (0, import_react12.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1279
+ return (0, import_react18.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
583
1280
  }
584
1281
 
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;
1282
+ // src/mfe/ThemeAwareReactLifecycle.tsx
1283
+ var import_client = require("react-dom/client");
1284
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1285
+ function resolveProviderMountOptions(app, bridge, mountContext) {
1286
+ const extensionId = mountContext?.extensionId;
1287
+ const domainId = mountContext?.domainId;
1288
+ const isMountedMfe = typeof extensionId === "string" && typeof domainId === "string";
1289
+ if (isMountedMfe && !resolveFrontXQueryClient(app) && !hasFrontXQueryClientActivator(app)) {
1290
+ throw new Error(
1291
+ "[FrontXProvider] Mounted MFEs require queryCacheShared() in the child app and queryCache() in the host app before loading the MFE app."
1292
+ );
591
1293
  }
592
- getContainer(_extensionId) {
593
- if (!this.containerRef.current) {
594
- throw new Error("Container ref is not attached -- component may not be mounted yet");
1294
+ return {
1295
+ mfeBridge: isMountedMfe ? { bridge, extensionId, domainId } : void 0
1296
+ };
1297
+ }
1298
+ function MountRuntimeAwareProvider({
1299
+ app,
1300
+ mfeBridge,
1301
+ children
1302
+ }) {
1303
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FrontXProvider, { app, mfeBridge, children });
1304
+ }
1305
+ var ThemeAwareReactLifecycle = class {
1306
+ constructor(app) {
1307
+ this.app = app;
1308
+ }
1309
+ app;
1310
+ root = null;
1311
+ mount(container, bridge, mountContext) {
1312
+ if (container instanceof ShadowRoot) {
1313
+ this.adoptHostStylesIntoShadowRoot(container);
595
1314
  }
596
- return this.containerRef.current;
1315
+ this.injectBaseResets(container);
1316
+ this.initializeStyles(container);
1317
+ const providerMountOptions = resolveProviderMountOptions(this.app, bridge, mountContext);
1318
+ this.root = (0, import_client.createRoot)(container);
1319
+ this.root.render(
1320
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1321
+ MountRuntimeAwareProvider,
1322
+ {
1323
+ app: this.app,
1324
+ mfeBridge: providerMountOptions.mfeBridge,
1325
+ children: this.renderContent(bridge)
1326
+ }
1327
+ )
1328
+ );
597
1329
  }
598
- releaseContainer(_extensionId) {
1330
+ unmount(_container) {
1331
+ if (this.root) {
1332
+ this.root.unmount();
1333
+ this.root = null;
1334
+ }
1335
+ }
1336
+ /**
1337
+ * Copy all inline <style> and <link rel="stylesheet"> from the host document
1338
+ * into the shadow root so that Tailwind and component styles apply inside the MFE.
1339
+ */
1340
+ adoptHostStylesIntoShadowRoot(shadowRoot) {
1341
+ const styleElements = document.head.querySelectorAll("style");
1342
+ styleElements.forEach((el) => {
1343
+ const clone = document.createElement("style");
1344
+ clone.textContent = el.textContent ?? "";
1345
+ shadowRoot.appendChild(clone);
1346
+ });
1347
+ const linkElements = document.head.querySelectorAll('link[rel="stylesheet"]');
1348
+ linkElements.forEach((el) => {
1349
+ const clone = el.cloneNode(true);
1350
+ shadowRoot.appendChild(clone);
1351
+ });
1352
+ }
1353
+ /**
1354
+ * Box-model resets and :host defaults needed inside every shadow root.
1355
+ * These aren't part of Tailwind's compiled output but are required for
1356
+ * consistent rendering across browsers.
1357
+ */
1358
+ injectBaseResets(container) {
1359
+ const style = document.createElement("style");
1360
+ style.textContent = `
1361
+ *, *::before, *::after {
1362
+ box-sizing: border-box;
1363
+ border-width: 0;
1364
+ border-style: solid;
1365
+ border-color: currentColor;
1366
+ }
1367
+ * { margin: 0; padding: 0; }
1368
+ :host {
1369
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
1370
+ line-height: 1.5;
1371
+ -webkit-font-smoothing: antialiased;
1372
+ -moz-osx-font-smoothing: grayscale;
1373
+ color: hsl(var(--foreground));
1374
+ background-color: hsl(var(--background));
1375
+ }
1376
+ `;
1377
+ container.appendChild(style);
1378
+ }
1379
+ /**
1380
+ * Hook for subclasses to inject additional CSS not covered by the adopted host
1381
+ * stylesheet (e.g., MFE-specific @font-face rules or custom animations).
1382
+ * No-op by default: host styles adopted in adoptHostStylesIntoShadowRoot()
1383
+ * already include all Tailwind utilities compiled from MFE source files.
1384
+ */
1385
+ initializeStyles(_container) {
599
1386
  }
600
1387
  };
601
1388
 
602
1389
  // 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");
1390
+ var import_react19 = require("react");
1391
+ var import_jsx_runtime5 = require("react/jsx-runtime");
606
1392
  function ExtensionDomainSlot(props) {
607
1393
  const {
608
1394
  registry,
609
1395
  domainId,
610
- extensionId,
611
1396
  className,
612
- onMounted,
613
- onUnmounted,
614
- onError,
615
- loadingComponent,
616
- errorComponent
1397
+ onAttached,
1398
+ onDetached,
1399
+ loadingComponent = null
617
1400
  } = 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
- }
1401
+ const rootRef = (0, import_react19.useRef)(null);
1402
+ const emitAttached = (0, import_react19.useEffectEvent)((root) => {
1403
+ onAttached?.(root);
1404
+ });
1405
+ const emitDetached = (0, import_react19.useEffectEvent)(() => {
1406
+ onDetached?.();
1407
+ });
1408
+ const [attached, setAttached] = (0, import_react19.useState)(false);
1409
+ (0, import_react19.useEffect)(() => {
1410
+ const root = rootRef.current;
1411
+ if (!root) {
1412
+ return;
674
1413
  }
675
- void mountExtension2();
1414
+ const mounter = registry.getMounter(domainId);
1415
+ mounter.attach(root);
1416
+ setAttached(true);
1417
+ emitAttached(root);
676
1418
  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
- }
1419
+ void mounter.detach();
1420
+ setAttached(false);
1421
+ emitDetached();
693
1422
  };
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)(
1423
+ }, [registry, domainId]);
1424
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
705
1425
  "div",
706
1426
  {
707
- ref: containerRef,
1427
+ ref: rootRef,
708
1428
  className,
709
1429
  "data-domain-id": domainId,
710
- "data-extension-id": extensionId,
711
- "data-bridge-active": bridge !== null
1430
+ children: !attached ? loadingComponent : null
712
1431
  }
713
1432
  );
714
1433
  }
715
1434
 
716
1435
  // src/index.ts
1436
+ var import_framework5 = require("@gears-frontx/framework");
717
1437
  var import_framework6 = require("@gears-frontx/framework");
718
1438
  var import_framework7 = require("@gears-frontx/framework");
719
1439
  var import_framework8 = require("@gears-frontx/framework");
@@ -727,17 +1447,23 @@ var import_framework15 = require("@gears-frontx/framework");
727
1447
  var import_framework16 = require("@gears-frontx/framework");
728
1448
  var import_framework17 = require("@gears-frontx/framework");
729
1449
  var import_framework18 = require("@gears-frontx/framework");
730
- var import_framework19 = require("@gears-frontx/framework");
731
- var eventBus = import_framework19.eventBus;
1450
+ var eventBus2 = import_framework18.eventBus;
732
1451
  // Annotate the CommonJS export names for ESM import in node:
733
1452
  0 && (module.exports = {
734
1453
  ACCOUNTS_DOMAIN,
1454
+ ActionHandler,
735
1455
  ApiPlugin,
736
1456
  ApiPluginBase,
737
1457
  ApiProtocol,
738
1458
  BaseApiService,
739
- ContainerProvider,
1459
+ CanAccess,
1460
+ ChildMfeBridge,
1461
+ ConcurrentMountStrategy,
1462
+ ExclusiveMountStrategy,
1463
+ ExtensionDomainImplementation,
1464
+ ExtensionDomainImplementationFactory,
740
1465
  ExtensionDomainSlot,
1466
+ ExtensionMounter,
741
1467
  FRONTX_ACTION_LOAD_EXT,
742
1468
  FRONTX_ACTION_MOUNT_EXT,
743
1469
  FRONTX_ACTION_UNMOUNT_EXT,
@@ -749,8 +1475,8 @@ var eventBus = import_framework19.eventBus;
749
1475
  FRONTX_SHARED_PROPERTY_LANGUAGE,
750
1476
  FRONTX_SHARED_PROPERTY_THEME,
751
1477
  FRONTX_SIDEBAR_DOMAIN,
752
- HAI3Context,
753
- HAI3Provider,
1478
+ FrontXContext,
1479
+ FrontXProvider,
754
1480
  I18nRegistry,
755
1481
  I18nRegistryImpl,
756
1482
  LAYOUT_SLICE_NAME,
@@ -763,34 +1489,39 @@ var eventBus = import_framework19.eventBus;
763
1489
  MfeHandler,
764
1490
  MfeHandlerMF,
765
1491
  MfeProvider,
1492
+ MfeRegistry,
1493
+ MfeRegistryFactory,
766
1494
  MockEventSource,
767
1495
  MockEvents,
768
- RefContainerProvider,
1496
+ MountStrategy,
1497
+ OptionalMountStrategy,
1498
+ ParentMfeBridge,
1499
+ RestEndpointProtocol,
769
1500
  RestMockPlugin,
770
1501
  RestPlugin,
771
1502
  RestPluginWithConfig,
772
1503
  RestProtocol,
773
1504
  SUPPORTED_LANGUAGES,
774
- ScreensetsRegistry,
775
- ScreensetsRegistryFactory,
776
1505
  SseMockPlugin,
777
1506
  SsePlugin,
778
1507
  SsePluginWithConfig,
779
1508
  SseProtocol,
1509
+ SseStreamProtocol,
780
1510
  TENANT_SLICE_NAME,
781
1511
  TenantEvents,
782
1512
  TextDirection,
1513
+ ThemeAwareReactLifecycle,
783
1514
  apiRegistry,
1515
+ auth,
784
1516
  changeTenant,
785
- clearActiveScreen,
786
1517
  clearTenant,
787
1518
  clearTenantAction,
788
1519
  clearUser,
789
1520
  closeAllPopups,
790
1521
  closePopup,
791
1522
  closeTopPopup,
792
- createHAI3,
793
- createHAI3App,
1523
+ createFrontX,
1524
+ createFrontXApp,
794
1525
  createI18nRegistry,
795
1526
  createShadowRoot,
796
1527
  createSlice,
@@ -802,6 +1533,7 @@ var eventBus = import_framework19.eventBus;
802
1533
  extractGtsPackage,
803
1534
  footerActions,
804
1535
  footerSlice,
1536
+ frontxApiTransport,
805
1537
  getLanguageMetadata,
806
1538
  getStore,
807
1539
  gtsPlugin,
@@ -814,6 +1546,7 @@ var eventBus = import_framework19.eventBus;
814
1546
  initMockEffects,
815
1547
  initTenantEffects,
816
1548
  injectCssVariables,
1549
+ invalidateQueryCacheForApp,
817
1550
  isMockPlugin,
818
1551
  isRestShortCircuit,
819
1552
  isShortCircuit,
@@ -825,12 +1558,12 @@ var eventBus = import_framework19.eventBus;
825
1558
  loadExtension,
826
1559
  menuActions,
827
1560
  menuSlice,
1561
+ mfeRegistryFactory,
828
1562
  microfrontends,
829
1563
  mock,
830
1564
  mockActions,
831
1565
  mockSlice,
832
1566
  mountExtension,
833
- navigateTo,
834
1567
  openPopup,
835
1568
  overlayActions,
836
1569
  overlayDomain,
@@ -839,17 +1572,15 @@ var eventBus = import_framework19.eventBus;
839
1572
  popupDomain,
840
1573
  popupSlice,
841
1574
  presets,
1575
+ queryCache,
1576
+ queryCacheShared,
842
1577
  registerExtension,
843
1578
  registerSlice,
844
- screenActions,
845
1579
  screenDomain,
846
- screenSlice,
847
- screensets,
848
- screensetsRegistryFactory,
849
1580
  selectExtensionError,
850
1581
  selectExtensionState,
1582
+ selectMountedExtensions,
851
1583
  selectRegisteredExtensions,
852
- setActiveScreen,
853
1584
  setFooterConfig,
854
1585
  setFooterVisible,
855
1586
  setHeaderLoading,
@@ -859,7 +1590,6 @@ var eventBus = import_framework19.eventBus;
859
1590
  setMenuVisible,
860
1591
  setMockEnabled,
861
1592
  setOverlayVisible,
862
- setScreenLoading,
863
1593
  setSidebarCollapsed,
864
1594
  setSidebarConfig,
865
1595
  setSidebarContent,
@@ -875,6 +1605,7 @@ var eventBus = import_framework19.eventBus;
875
1605
  sidebarActions,
876
1606
  sidebarDomain,
877
1607
  sidebarSlice,
1608
+ subscribeQueryCacheRuntimeChanged,
878
1609
  tenantActions,
879
1610
  tenantReducer,
880
1611
  tenantSlice,
@@ -885,15 +1616,23 @@ var eventBus = import_framework19.eventBus;
885
1616
  toggleSidebar,
886
1617
  unmountExtension,
887
1618
  unregisterExtension,
888
- useActivePackage,
1619
+ useApiInfiniteQuery,
1620
+ useApiMutation,
1621
+ useApiQuery,
1622
+ useApiStream,
1623
+ useApiSuspenseInfiniteQuery,
1624
+ useApiSuspenseQuery,
889
1625
  useAppDispatch,
890
1626
  useAppSelector,
1627
+ useCanAccess,
891
1628
  useDomainExtensions,
892
1629
  useFormatters,
893
- useHAI3,
1630
+ useFrontX,
894
1631
  useHostAction,
895
1632
  useMfeBridge,
896
1633
  useMfeContext,
1634
+ useMountedExtensions,
1635
+ useQueryCache,
897
1636
  useRegisteredPackages,
898
1637
  useScreenTranslations,
899
1638
  useSharedProperty,