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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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_react4 = 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,563 @@ 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_react3 = __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/queryClient.tsx
232
372
  var import_jsx_runtime2 = require("react/jsx-runtime");
233
- var HAI3Provider = ({
373
+ var APP_QUERY_CLIENT_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client");
374
+ var APP_QUERY_CLIENT_RESOLVER_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client-resolver");
375
+ var APP_QUERY_CLIENT_ACTIVATOR_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client-activator");
376
+ var FrontXQueryClientContext = (0, import_react3.createContext)(void 0);
377
+ var useCommitEffect = typeof globalThis.window === "undefined" ? import_react3.useEffect : import_react3.useLayoutEffect;
378
+ function resolveFrontXQueryClient(app) {
379
+ const clientApp = app;
380
+ return clientApp[APP_QUERY_CLIENT_SYMBOL] ?? clientApp[APP_QUERY_CLIENT_RESOLVER_SYMBOL]?.();
381
+ }
382
+ function hasFrontXQueryClientActivator(app) {
383
+ return typeof app[APP_QUERY_CLIENT_ACTIVATOR_SYMBOL] === "function";
384
+ }
385
+ function activateFrontXQueryClient(app) {
386
+ const clientApp = app;
387
+ return clientApp[APP_QUERY_CLIENT_SYMBOL] ?? clientApp[APP_QUERY_CLIENT_ACTIVATOR_SYMBOL]?.();
388
+ }
389
+ async function invalidateQueryCacheForApp(app, target) {
390
+ const queryClient = resolveFrontXQueryClient(app) ?? activateFrontXQueryClient(app);
391
+ if (!queryClient) {
392
+ throw new Error(
393
+ "[invalidateQueryCacheForApp] No QueryClient on app. Ensure queryCache() or queryCacheShared() is in the plugin chain."
394
+ );
395
+ }
396
+ await createQueryCache(queryClient).invalidate(target);
397
+ }
398
+ function bootstrapFrontXQueryClient(app) {
399
+ return resolveFrontXQueryClient(app);
400
+ }
401
+ function useBootstrappedFrontXQueryClient(app) {
402
+ const fromApp = (0, import_react3.useMemo)(() => bootstrapFrontXQueryClient(app), [app]);
403
+ const [eventResolvedClient, setEventResolvedClient] = (0, import_react3.useState)(
404
+ void 0
405
+ );
406
+ const queryClient = fromApp ?? (eventResolvedClient?.app === app ? eventResolvedClient.queryClient : void 0);
407
+ useCommitEffect(() => {
408
+ if (fromApp || !hasFrontXQueryClientActivator(app)) {
409
+ return;
410
+ }
411
+ const tryResolveQueryClient = () => {
412
+ const nextQueryClient = resolveFrontXQueryClient(app) ?? activateFrontXQueryClient(app);
413
+ if (nextQueryClient) {
414
+ setEventResolvedClient((current) => {
415
+ if (current?.app === app && current.queryClient === nextQueryClient) {
416
+ return current;
417
+ }
418
+ return {
419
+ app,
420
+ queryClient: nextQueryClient
421
+ };
422
+ });
423
+ }
424
+ };
425
+ tryResolveQueryClient();
426
+ const subscription = (0, import_framework2.subscribeQueryCacheRuntimeChanged)(() => {
427
+ tryResolveQueryClient();
428
+ });
429
+ return () => {
430
+ subscription.unsubscribe();
431
+ };
432
+ }, [app, fromApp]);
433
+ return queryClient;
434
+ }
435
+ function FrontXQueryClientProvider({
436
+ queryClient,
437
+ children
438
+ }) {
439
+ if (!queryClient) {
440
+ 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 }) });
441
+ }
442
+ 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 }) });
443
+ }
444
+ function useOptionalFrontXQueryClient() {
445
+ return (0, import_react3.useContext)(FrontXQueryClientContext);
446
+ }
447
+ function useRequiredFrontXQueryClient() {
448
+ const queryClient = useOptionalFrontXQueryClient();
449
+ if (!queryClient) {
450
+ throw new Error(
451
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition."
452
+ );
453
+ }
454
+ return queryClient;
455
+ }
456
+ function buildPageContext(page, pages, descriptor, descriptors) {
457
+ return {
458
+ page,
459
+ pages,
460
+ descriptor,
461
+ descriptors
462
+ };
463
+ }
464
+ function normalizeFetchStaleTime(staleTime) {
465
+ if (staleTime === "static") {
466
+ return Number.POSITIVE_INFINITY;
467
+ }
468
+ return typeof staleTime === "number" ? staleTime : void 0;
469
+ }
470
+ function resolveFetchStaleTime(queryClient, descriptor, overrideStaleTime) {
471
+ return normalizeFetchStaleTime(
472
+ overrideStaleTime ?? descriptor.staleTime ?? queryClient.getDefaultOptions().queries?.staleTime
473
+ );
474
+ }
475
+ function fetchDescriptor(descriptor, options) {
476
+ return descriptor.fetch(options);
477
+ }
478
+ function useFrontXQuery(descriptor, overrides) {
479
+ const queryClient = useRequiredFrontXQueryClient();
480
+ const staleTime = resolveFetchStaleTime(queryClient, descriptor, overrides?.staleTime);
481
+ const result = (0, import_react_query.useQuery)({
482
+ queryKey: descriptor.key,
483
+ queryFn: ({ signal }) => fetchDescriptor(descriptor, { signal, staleTime }),
484
+ staleTime: overrides?.staleTime ?? descriptor.staleTime,
485
+ gcTime: overrides?.gcTime ?? descriptor.gcTime
486
+ });
487
+ return {
488
+ data: result.data,
489
+ error: result.error,
490
+ isLoading: result.isLoading,
491
+ isFetching: result.isFetching,
492
+ isError: result.isError,
493
+ refetch: result.refetch
494
+ };
495
+ }
496
+ function useFrontXSuspenseQuery(descriptor, overrides) {
497
+ const queryClient = useRequiredFrontXQueryClient();
498
+ const staleTime = resolveFetchStaleTime(queryClient, descriptor, overrides?.staleTime);
499
+ const result = (0, import_react_query.useSuspenseQuery)({
500
+ queryKey: descriptor.key,
501
+ queryFn: ({ signal }) => fetchDescriptor(descriptor, { signal, staleTime }),
502
+ staleTime: overrides?.staleTime ?? descriptor.staleTime,
503
+ gcTime: overrides?.gcTime ?? descriptor.gcTime
504
+ });
505
+ return {
506
+ data: result.data,
507
+ error: result.error,
508
+ isFetching: result.isFetching,
509
+ refetch: async () => {
510
+ await result.refetch();
511
+ }
512
+ };
513
+ }
514
+ function useFrontXInfiniteQuery(options) {
515
+ const queryClient = useRequiredFrontXQueryClient();
516
+ const result = (0, import_react_query.useInfiniteQuery)({
517
+ queryKey: options.initialPage.key,
518
+ initialPageParam: options.initialPage,
519
+ queryFn: ({ pageParam, signal }) => fetchDescriptor(pageParam, {
520
+ signal,
521
+ staleTime: resolveFetchStaleTime(queryClient, pageParam, options.staleTime)
522
+ }),
523
+ getNextPageParam: (lastPage, allPages, lastPageDescriptor, allPageDescriptors) => options.getNextPage(
524
+ buildPageContext(
525
+ lastPage,
526
+ allPages,
527
+ lastPageDescriptor,
528
+ allPageDescriptors
529
+ )
530
+ ),
531
+ getPreviousPageParam: options.getPreviousPage ? (firstPage, allPages, firstPageDescriptor, allPageDescriptors) => options.getPreviousPage?.(
532
+ buildPageContext(
533
+ firstPage,
534
+ allPages,
535
+ firstPageDescriptor,
536
+ allPageDescriptors
537
+ )
538
+ ) : void 0,
539
+ select: (data) => data.pages,
540
+ staleTime: options.staleTime ?? options.initialPage.staleTime,
541
+ gcTime: options.gcTime ?? options.initialPage.gcTime,
542
+ maxPages: options.maxPages
543
+ });
544
+ return {
545
+ data: result.data,
546
+ error: result.error,
547
+ isLoading: result.isLoading,
548
+ isFetching: result.isFetching,
549
+ isError: result.isError,
550
+ hasNextPage: result.hasNextPage ?? false,
551
+ hasPreviousPage: result.hasPreviousPage ?? false,
552
+ isFetchingNextPage: result.isFetchingNextPage,
553
+ isFetchingPreviousPage: result.isFetchingPreviousPage,
554
+ fetchNextPage: async () => {
555
+ await result.fetchNextPage();
556
+ },
557
+ fetchPreviousPage: async () => {
558
+ await result.fetchPreviousPage();
559
+ },
560
+ refetch: async () => {
561
+ await result.refetch();
562
+ }
563
+ };
564
+ }
565
+ function useFrontXSuspenseInfiniteQuery(options) {
566
+ const queryClient = useRequiredFrontXQueryClient();
567
+ const result = (0, import_react_query.useSuspenseInfiniteQuery)({
568
+ queryKey: options.initialPage.key,
569
+ initialPageParam: options.initialPage,
570
+ queryFn: ({ pageParam, signal }) => fetchDescriptor(pageParam, {
571
+ signal,
572
+ staleTime: resolveFetchStaleTime(queryClient, pageParam, options.staleTime)
573
+ }),
574
+ getNextPageParam: (lastPage, allPages, lastPageDescriptor, allPageDescriptors) => options.getNextPage(
575
+ buildPageContext(
576
+ lastPage,
577
+ allPages,
578
+ lastPageDescriptor,
579
+ allPageDescriptors
580
+ )
581
+ ),
582
+ getPreviousPageParam: options.getPreviousPage ? (firstPage, allPages, firstPageDescriptor, allPageDescriptors) => options.getPreviousPage?.(
583
+ buildPageContext(
584
+ firstPage,
585
+ allPages,
586
+ firstPageDescriptor,
587
+ allPageDescriptors
588
+ )
589
+ ) : void 0,
590
+ select: (data) => data.pages,
591
+ staleTime: options.staleTime ?? options.initialPage.staleTime,
592
+ gcTime: options.gcTime ?? options.initialPage.gcTime,
593
+ maxPages: options.maxPages
594
+ });
595
+ return {
596
+ data: result.data,
597
+ error: result.error,
598
+ isFetching: result.isFetching,
599
+ hasNextPage: result.hasNextPage ?? false,
600
+ hasPreviousPage: result.hasPreviousPage ?? false,
601
+ isFetchingNextPage: result.isFetchingNextPage,
602
+ isFetchingPreviousPage: result.isFetchingPreviousPage,
603
+ fetchNextPage: async () => {
604
+ await result.fetchNextPage();
605
+ },
606
+ fetchPreviousPage: async () => {
607
+ await result.fetchPreviousPage();
608
+ },
609
+ refetch: async () => {
610
+ await result.refetch();
611
+ }
612
+ };
613
+ }
614
+ function useFrontXMutation(options, callbackCtx) {
615
+ useRequiredFrontXQueryClient();
616
+ const latestRef = import_react3.default.useRef({ options, callbackCtx });
617
+ latestRef.current = { options, callbackCtx };
618
+ const fetchAbortControllersRef = import_react3.default.useRef(/* @__PURE__ */ new Set());
619
+ import_react3.default.useEffect(() => {
620
+ const fetchAbortControllers = fetchAbortControllersRef.current;
621
+ return () => {
622
+ if (latestRef.current.options.abortOnUnmount) {
623
+ for (const controller of fetchAbortControllers) {
624
+ controller.abort();
625
+ }
626
+ fetchAbortControllers.clear();
627
+ }
628
+ };
629
+ }, []);
630
+ const mutationFn = import_react3.default.useCallback((variables, context) => {
631
+ const cancelOnSupersede = latestRef.current.options.cancelOnSupersede;
632
+ if (cancelOnSupersede) {
633
+ for (const controller2 of fetchAbortControllersRef.current) {
634
+ controller2.abort();
635
+ }
636
+ fetchAbortControllersRef.current.clear();
637
+ }
638
+ const controller = new AbortController();
639
+ fetchAbortControllersRef.current.add(controller);
640
+ const librarySignal = context.signal;
641
+ if (cancelOnSupersede && librarySignal) {
642
+ if (librarySignal.aborted) {
643
+ controller.abort();
644
+ } else {
645
+ librarySignal.addEventListener("abort", () => controller.abort(), { once: true });
646
+ }
647
+ }
648
+ return latestRef.current.options.endpoint.fetch(variables, { signal: controller.signal }).finally(() => {
649
+ fetchAbortControllersRef.current.delete(controller);
650
+ });
651
+ }, []);
652
+ const onMutate = import_react3.default.useCallback((variables, _context) => {
653
+ const current = latestRef.current;
654
+ if (!current.options.onMutate) {
655
+ return void 0;
656
+ }
657
+ return current.options.onMutate(variables, current.callbackCtx);
658
+ }, []);
659
+ const onSuccess = import_react3.default.useCallback((data, variables, context) => {
660
+ const current = latestRef.current;
661
+ return current.options.onSuccess?.(data, variables, context, current.callbackCtx);
662
+ }, []);
663
+ const onError = import_react3.default.useCallback((error, variables, context) => {
664
+ const current = latestRef.current;
665
+ return current.options.onError?.(error, variables, context, current.callbackCtx);
666
+ }, []);
667
+ const onSettled = import_react3.default.useCallback((data, error, variables, context) => {
668
+ const current = latestRef.current;
669
+ return current.options.onSettled?.(
670
+ data,
671
+ error,
672
+ variables,
673
+ context,
674
+ current.callbackCtx
675
+ );
676
+ }, []);
677
+ const mutation = (0, import_react_query.useMutation)({
678
+ mutationFn,
679
+ onMutate: options.onMutate ? onMutate : void 0,
680
+ onSuccess: options.onSuccess ? onSuccess : void 0,
681
+ onError: options.onError ? onError : void 0,
682
+ onSettled: options.onSettled ? onSettled : void 0
683
+ });
684
+ return {
685
+ mutate: mutation.mutate,
686
+ mutateAsync: mutation.mutateAsync,
687
+ isPending: mutation.isPending,
688
+ error: mutation.error,
689
+ data: mutation.data,
690
+ reset: mutation.reset
691
+ };
692
+ }
693
+
694
+ // src/FrontXProvider.tsx
695
+ var import_jsx_runtime3 = require("react/jsx-runtime");
696
+ function shallowEqual(a, b) {
697
+ if (a === b) return true;
698
+ if (!a || !b) return false;
699
+ const keysA = Object.keys(a);
700
+ if (keysA.length !== Object.keys(b).length) return false;
701
+ return keysA.every((k) => Object.is(a[k], b[k]));
702
+ }
703
+ function createProviderOwnedApp(config) {
704
+ return (0, import_framework3.createFrontXApp)(config);
705
+ }
706
+ var FrontXProvider = ({
234
707
  children,
235
708
  config,
236
709
  app: providedApp,
237
710
  mfeBridge
238
711
  }) => {
239
- const app = (0, import_react3.useMemo)(() => {
712
+ const [stableConfig, setStableConfig] = (0, import_react4.useState)(config);
713
+ if (!shallowEqual(
714
+ stableConfig,
715
+ config
716
+ )) {
717
+ setStableConfig(config);
718
+ }
719
+ const app = (0, import_react4.useMemo)(() => {
240
720
  if (providedApp) {
241
721
  return providedApp;
242
722
  }
243
- return (0, import_framework.createHAI3App)(config);
244
- }, [providedApp, config]);
245
- (0, import_react3.useEffect)(() => {
723
+ return createProviderOwnedApp(stableConfig);
724
+ }, [providedApp, stableConfig]);
725
+ const queryClient = useBootstrappedFrontXQueryClient(app);
726
+ const deferQuerySubtree = hasFrontXQueryClientActivator(app) && queryClient === void 0;
727
+ (0, import_react4.useEffect)(() => {
728
+ if (queryClient || hasFrontXQueryClientActivator(app) || process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test" || process.env.VITEST === "true") {
729
+ return;
730
+ }
731
+ console.warn(
732
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition. useApiQuery/useApiMutation will fail without it."
733
+ );
734
+ }, [app, queryClient]);
735
+ (0, import_react4.useEffect)(() => {
246
736
  return () => {
247
737
  if (!providedApp) {
248
738
  app.destroy();
249
739
  }
250
740
  };
251
741
  }, [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 }) });
742
+ 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
743
  if (mfeBridge) {
254
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MfeProvider, { value: mfeBridge, children: content });
744
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MfeProvider, { value: mfeBridge, children: content });
255
745
  }
256
746
  return content;
257
747
  };
258
748
 
749
+ // src/hooks/useCanAccess.ts
750
+ var import_react5 = require("react");
751
+ function serializeRecordValue(value) {
752
+ if (value === null) return "n:";
753
+ if (typeof value === "string") return `s:${value}`;
754
+ if (typeof value === "number") {
755
+ return `d:${Object.is(value, -0) ? "-0" : String(value)}`;
756
+ }
757
+ return value ? "b:1" : "b:0";
758
+ }
759
+ function accessQueryKey(query) {
760
+ const { action, resource, record } = query;
761
+ const normalizedRecord = record ? Object.entries(record).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => [k, serializeRecordValue(v)]) : null;
762
+ return JSON.stringify([action, resource, normalizedRecord]);
763
+ }
764
+ function getAuthRuntime(app) {
765
+ return app.auth ?? null;
766
+ }
767
+ function useCanAccess(query) {
768
+ const app = useFrontX();
769
+ const stableKey = accessQueryKey(query);
770
+ const [stableQuery, setStableQuery] = (0, import_react5.useState)(() => query);
771
+ const [storedKey, setStoredKey] = (0, import_react5.useState)(stableKey);
772
+ const [result, setResult] = (0, import_react5.useState)({ allow: false, isResolving: true });
773
+ if (storedKey !== stableKey) {
774
+ setStoredKey(stableKey);
775
+ setStableQuery(query);
776
+ setResult({ allow: false, isResolving: true });
777
+ }
778
+ (0, import_react5.useEffect)(() => {
779
+ const auth2 = getAuthRuntime(app);
780
+ if (!auth2) {
781
+ setResult({ allow: false, isResolving: false });
782
+ return;
783
+ }
784
+ setResult({ allow: false, isResolving: true });
785
+ let alive = true;
786
+ const controller = new AbortController();
787
+ void auth2.canAccess(stableQuery, { signal: controller.signal }).then((decision) => {
788
+ if (alive) {
789
+ setResult({ allow: decision === "allow", isResolving: false });
790
+ }
791
+ }).catch(() => {
792
+ if (alive) {
793
+ setResult({ allow: false, isResolving: false });
794
+ }
795
+ });
796
+ return () => {
797
+ alive = false;
798
+ controller.abort();
799
+ };
800
+ }, [app, stableQuery]);
801
+ return result;
802
+ }
803
+
804
+ // src/components/CanAccess.tsx
805
+ function CanAccess({
806
+ query,
807
+ allowed,
808
+ denied = null,
809
+ loading
810
+ }) {
811
+ const { allow, isResolving } = useCanAccess(query);
812
+ if (isResolving) {
813
+ return loading !== void 0 ? loading : denied;
814
+ }
815
+ return allow ? allowed : denied;
816
+ }
817
+
259
818
  // src/hooks/useAppDispatch.ts
260
819
  var import_react_redux2 = require("react-redux");
261
820
  function useAppDispatch() {
@@ -267,12 +826,12 @@ var import_react_redux3 = require("react-redux");
267
826
  var useAppSelector = import_react_redux3.useSelector;
268
827
 
269
828
  // src/hooks/useTranslation.ts
270
- var import_react4 = require("react");
829
+ var import_react6 = require("react");
271
830
  function useTranslation() {
272
- const app = useHAI3();
831
+ const app = useFrontX();
273
832
  const { i18nRegistry: i18nRegistry2 } = app;
274
- const version = (0, import_react4.useSyncExternalStore)(
275
- (0, import_react4.useCallback)(
833
+ const version = (0, import_react6.useSyncExternalStore)(
834
+ (0, import_react6.useCallback)(
276
835
  (callback) => {
277
836
  return i18nRegistry2.subscribe(callback);
278
837
  },
@@ -281,17 +840,17 @@ function useTranslation() {
281
840
  () => i18nRegistry2.getVersion(),
282
841
  () => i18nRegistry2.getVersion()
283
842
  );
284
- const language = (0, import_react4.useMemo)(() => {
843
+ const language = (0, import_react6.useMemo)(() => {
285
844
  void version;
286
845
  return i18nRegistry2.getLanguage();
287
846
  }, [i18nRegistry2, version]);
288
- const t = (0, import_react4.useCallback)(
847
+ const t = (0, import_react6.useCallback)(
289
848
  (key, params) => {
290
849
  return i18nRegistry2.t(key, params);
291
850
  },
292
851
  [i18nRegistry2]
293
852
  );
294
- const setLanguage = (0, import_react4.useCallback)(
853
+ const setLanguage = (0, import_react6.useCallback)(
295
854
  (lang) => {
296
855
  if (app.actions.setLanguage) {
297
856
  app.actions.setLanguage({ language: lang });
@@ -299,7 +858,7 @@ function useTranslation() {
299
858
  },
300
859
  [app.actions]
301
860
  );
302
- const isRTL = (0, import_react4.useMemo)(() => {
861
+ const isRTL = (0, import_react6.useMemo)(() => {
303
862
  void language;
304
863
  return i18nRegistry2.isRTL();
305
864
  }, [i18nRegistry2, language]);
@@ -312,29 +871,29 @@ function useTranslation() {
312
871
  }
313
872
 
314
873
  // src/hooks/useScreenTranslations.ts
315
- var import_react5 = require("react");
874
+ var import_react7 = require("react");
316
875
  function isTranslationLoader(input) {
317
876
  return typeof input === "function";
318
877
  }
319
878
  function useScreenTranslations(screensetId, screenId, translations) {
320
- const app = useHAI3();
879
+ const app = useFrontX();
321
880
  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)(
881
+ const [loadedLanguage, setLoadedLanguage] = (0, import_react7.useState)(null);
882
+ const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
883
+ const [error, setError] = (0, import_react7.useState)(null);
884
+ const version = (0, import_react7.useSyncExternalStore)(
885
+ (0, import_react7.useCallback)(
327
886
  (callback) => i18nRegistry2.subscribe(callback),
328
887
  [i18nRegistry2]
329
888
  ),
330
889
  () => i18nRegistry2.getVersion(),
331
890
  () => i18nRegistry2.getVersion()
332
891
  );
333
- const currentLanguage = (0, import_react5.useMemo)(() => {
892
+ const currentLanguage = (0, import_react7.useMemo)(() => {
334
893
  void version;
335
894
  return i18nRegistry2.getLanguage();
336
895
  }, [i18nRegistry2, version]);
337
- const loader = (0, import_react5.useMemo)(() => {
896
+ const loader = (0, import_react7.useMemo)(() => {
338
897
  if (isTranslationLoader(translations)) {
339
898
  return translations;
340
899
  }
@@ -347,7 +906,7 @@ function useScreenTranslations(screensetId, screenId, translations) {
347
906
  return module2.default;
348
907
  };
349
908
  }, [translations]);
350
- (0, import_react5.useEffect)(() => {
909
+ (0, import_react7.useEffect)(() => {
351
910
  if (!currentLanguage || currentLanguage === loadedLanguage) {
352
911
  return;
353
912
  }
@@ -381,24 +940,24 @@ function useScreenTranslations(screensetId, screenId, translations) {
381
940
  }
382
941
 
383
942
  // src/hooks/useFormatters.ts
384
- var import_react6 = require("react");
385
- var import_framework2 = require("@gears-frontx/framework");
943
+ var import_react8 = require("react");
944
+ var import_framework4 = require("@gears-frontx/framework");
386
945
  function useFormatters() {
387
946
  const { language } = useTranslation();
388
- return (0, import_react6.useMemo)(
947
+ return (0, import_react8.useMemo)(
389
948
  () => {
390
949
  void language;
391
950
  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
951
+ formatDate: import_framework4.formatDate,
952
+ formatTime: import_framework4.formatTime,
953
+ formatDateTime: import_framework4.formatDateTime,
954
+ formatRelative: import_framework4.formatRelative,
955
+ formatNumber: import_framework4.formatNumber,
956
+ formatPercent: import_framework4.formatPercent,
957
+ formatCompact: import_framework4.formatCompact,
958
+ formatCurrency: import_framework4.formatCurrency,
959
+ compareStrings: import_framework4.compareStrings,
960
+ createCollator: import_framework4.createCollator
402
961
  };
403
962
  },
404
963
  [language]
@@ -406,12 +965,12 @@ function useFormatters() {
406
965
  }
407
966
 
408
967
  // src/hooks/useTheme.ts
409
- var import_react7 = require("react");
968
+ var import_react9 = require("react");
410
969
  function useTheme() {
411
- const app = useHAI3();
970
+ const app = useFrontX();
412
971
  const { themeRegistry } = app;
413
- const version = (0, import_react7.useSyncExternalStore)(
414
- (0, import_react7.useCallback)(
972
+ const version = (0, import_react9.useSyncExternalStore)(
973
+ (0, import_react9.useCallback)(
415
974
  (callback) => {
416
975
  return themeRegistry.subscribe(callback);
417
976
  },
@@ -420,18 +979,18 @@ function useTheme() {
420
979
  () => themeRegistry.getVersion(),
421
980
  () => themeRegistry.getVersion()
422
981
  );
423
- const currentTheme = (0, import_react7.useMemo)(() => {
982
+ const currentTheme = (0, import_react9.useMemo)(() => {
424
983
  void version;
425
984
  const theme = themeRegistry.getCurrent();
426
985
  return theme?.id;
427
986
  }, [themeRegistry, version]);
428
- const themes2 = (0, import_react7.useMemo)(() => {
987
+ const themes2 = (0, import_react9.useMemo)(() => {
429
988
  return themeRegistry.getAll().map((theme) => ({
430
989
  id: theme.id,
431
990
  name: theme.name
432
991
  }));
433
992
  }, [themeRegistry]);
434
- const setTheme = (0, import_react7.useCallback)(
993
+ const setTheme = (0, import_react9.useCallback)(
435
994
  (themeId) => {
436
995
  if (app.actions.changeTheme) {
437
996
  app.actions.changeTheme({ themeId });
@@ -446,6 +1005,137 @@ function useTheme() {
446
1005
  };
447
1006
  }
448
1007
 
1008
+ // src/hooks/useApiQuery.ts
1009
+ function useApiQuery(descriptor, overrides) {
1010
+ return useFrontXQuery(descriptor, overrides);
1011
+ }
1012
+
1013
+ // src/hooks/useApiSuspenseQuery.ts
1014
+ function useApiSuspenseQuery(descriptor, overrides) {
1015
+ return useFrontXSuspenseQuery(descriptor, overrides);
1016
+ }
1017
+
1018
+ // src/hooks/useApiInfiniteQuery.ts
1019
+ function useApiInfiniteQuery(options) {
1020
+ return useFrontXInfiniteQuery(options);
1021
+ }
1022
+
1023
+ // src/hooks/useApiSuspenseInfiniteQuery.ts
1024
+ function useApiSuspenseInfiniteQuery(options) {
1025
+ return useFrontXSuspenseInfiniteQuery(options);
1026
+ }
1027
+
1028
+ // src/hooks/useApiMutation.ts
1029
+ var import_react10 = require("react");
1030
+ function useApiMutation(options) {
1031
+ const queryClient = useRequiredFrontXQueryClient();
1032
+ const queryCache2 = (0, import_react10.useMemo)(() => createQueryCache(queryClient), [queryClient]);
1033
+ const callbackCtx = (0, import_react10.useMemo)(() => ({ queryCache: queryCache2 }), [queryCache2]);
1034
+ return useFrontXMutation(options, callbackCtx);
1035
+ }
1036
+
1037
+ // src/hooks/useApiStream.ts
1038
+ var import_react11 = require("react");
1039
+ function useApiStream(descriptor, options) {
1040
+ const mode = options?.mode ?? "latest";
1041
+ const enabled = options?.enabled ?? true;
1042
+ const [data, setData] = (0, import_react11.useState)(void 0);
1043
+ const [events, setEvents] = (0, import_react11.useState)([]);
1044
+ const [status, setStatus] = (0, import_react11.useState)("idle");
1045
+ const [error, setError] = (0, import_react11.useState)(null);
1046
+ const connectPromiseRef = (0, import_react11.useRef)(null);
1047
+ const connectionIdRef = (0, import_react11.useRef)(null);
1048
+ const disconnectRequestedRef = (0, import_react11.useRef)(false);
1049
+ const descriptorRef = (0, import_react11.useRef)(descriptor);
1050
+ descriptorRef.current = descriptor;
1051
+ const descriptorKey = (0, import_react11.useMemo)(() => JSON.stringify(descriptor.key), [descriptor.key]);
1052
+ (0, import_react11.useEffect)(() => {
1053
+ setData(void 0);
1054
+ setEvents([]);
1055
+ setError(null);
1056
+ }, [descriptorKey, mode]);
1057
+ const disconnect = (0, import_react11.useCallback)(() => {
1058
+ disconnectRequestedRef.current = true;
1059
+ if (connectionIdRef.current) {
1060
+ descriptorRef.current.disconnect(connectionIdRef.current);
1061
+ connectionIdRef.current = null;
1062
+ disconnectRequestedRef.current = false;
1063
+ }
1064
+ setStatus("disconnected");
1065
+ }, []);
1066
+ (0, import_react11.useEffect)(() => {
1067
+ if (!enabled) {
1068
+ setStatus("idle");
1069
+ return;
1070
+ }
1071
+ let cancelled = false;
1072
+ disconnectRequestedRef.current = false;
1073
+ const d = descriptorRef.current;
1074
+ setData(void 0);
1075
+ setEvents([]);
1076
+ setStatus("connecting");
1077
+ setError(null);
1078
+ const connectPromise = d.connect(
1079
+ (event) => {
1080
+ if (cancelled) return;
1081
+ setData(event);
1082
+ setStatus("connected");
1083
+ if (mode === "accumulate") {
1084
+ setEvents((prev) => [...prev, event]);
1085
+ }
1086
+ },
1087
+ () => {
1088
+ if (cancelled) return;
1089
+ setStatus("disconnected");
1090
+ connectionIdRef.current = null;
1091
+ }
1092
+ );
1093
+ connectPromiseRef.current = connectPromise;
1094
+ connectPromise.then((id) => {
1095
+ if (cancelled) return;
1096
+ if (disconnectRequestedRef.current) {
1097
+ d.disconnect(id);
1098
+ disconnectRequestedRef.current = false;
1099
+ return;
1100
+ }
1101
+ connectionIdRef.current = id;
1102
+ setStatus("connected");
1103
+ }).catch((err) => {
1104
+ if (cancelled) return;
1105
+ if (disconnectRequestedRef.current) {
1106
+ disconnectRequestedRef.current = false;
1107
+ setStatus("disconnected");
1108
+ return;
1109
+ }
1110
+ setError(err instanceof Error ? err : new Error(String(err)));
1111
+ setStatus("error");
1112
+ });
1113
+ return () => {
1114
+ cancelled = true;
1115
+ connectPromise.then(
1116
+ (id) => d.disconnect(id),
1117
+ () => {
1118
+ }
1119
+ );
1120
+ connectPromiseRef.current = null;
1121
+ connectionIdRef.current = null;
1122
+ };
1123
+ }, [descriptorKey, enabled, mode]);
1124
+ return { data, events, status, error, disconnect };
1125
+ }
1126
+
1127
+ // src/hooks/useQueryCache.ts
1128
+ var import_react12 = require("react");
1129
+ function useQueryCache() {
1130
+ const queryClient = useOptionalFrontXQueryClient();
1131
+ if (!queryClient) {
1132
+ throw new Error(
1133
+ "[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition."
1134
+ );
1135
+ }
1136
+ return (0, import_react12.useMemo)(() => createQueryCache(queryClient), [queryClient]);
1137
+ }
1138
+
449
1139
  // src/mfe/hooks/useMfeBridge.ts
450
1140
  function useMfeBridge() {
451
1141
  const { bridge } = useMfeContext();
@@ -453,27 +1143,27 @@ function useMfeBridge() {
453
1143
  }
454
1144
 
455
1145
  // src/mfe/hooks/useSharedProperty.ts
456
- var import_react8 = require("react");
1146
+ var import_react13 = require("react");
457
1147
  function useSharedProperty(propertyTypeId) {
458
1148
  const { bridge } = useMfeContext();
459
- const subscribe = (0, import_react8.useCallback)((callback) => {
1149
+ const subscribe = (0, import_react13.useCallback)((callback) => {
460
1150
  return bridge.subscribeToProperty(propertyTypeId, () => {
461
1151
  callback();
462
1152
  });
463
1153
  }, [bridge, propertyTypeId]);
464
- const getSnapshot = (0, import_react8.useCallback)(() => {
1154
+ const getSnapshot = (0, import_react13.useCallback)(() => {
465
1155
  const property = bridge.getProperty(propertyTypeId);
466
1156
  return property?.value;
467
1157
  }, [bridge, propertyTypeId]);
468
- const value = (0, import_react8.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1158
+ const value = (0, import_react13.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
469
1159
  return value;
470
1160
  }
471
1161
 
472
1162
  // src/mfe/hooks/useHostAction.ts
473
- var import_react9 = require("react");
1163
+ var import_react14 = require("react");
474
1164
  function useHostAction(actionTypeId) {
475
1165
  const { bridge } = useMfeContext();
476
- return (0, import_react9.useCallback)((payload) => {
1166
+ return (0, import_react14.useCallback)((payload) => {
477
1167
  const chain = {
478
1168
  action: {
479
1169
  type: actionTypeId,
@@ -491,23 +1181,23 @@ function useHostAction(actionTypeId) {
491
1181
  }
492
1182
 
493
1183
  // src/mfe/hooks/useDomainExtensions.ts
494
- var import_react10 = require("react");
1184
+ var import_react15 = require("react");
495
1185
  function useDomainExtensions(domainId) {
496
- const app = useHAI3();
497
- const registry = app.screensetsRegistry;
1186
+ const app = useFrontX();
1187
+ const registry = app.mfeRegistry;
498
1188
  if (!registry) {
499
1189
  throw new Error(
500
- "useDomainExtensions requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
1190
+ "useDomainExtensions requires the microfrontends plugin. Add microfrontends() to your Gears FrontX app configuration."
501
1191
  );
502
1192
  }
503
- const subscribe = (0, import_react10.useCallback)(
1193
+ const subscribe = (0, import_react15.useCallback)(
504
1194
  (onStoreChange) => {
505
1195
  return app.store.subscribe(onStoreChange);
506
1196
  },
507
1197
  [app.store]
508
1198
  );
509
- const cacheRef = (0, import_react10.useRef)({ ids: "", extensions: [] });
510
- const getSnapshot = (0, import_react10.useCallback)(() => {
1199
+ const cacheRef = (0, import_react15.useRef)({ ids: "", extensions: [] });
1200
+ const getSnapshot = (0, import_react15.useCallback)(() => {
511
1201
  const extensions = registry.getExtensionsForDomain(domainId);
512
1202
  const ids = extensions.map((e) => e.id).join(",");
513
1203
  if (ids !== cacheRef.current.ids) {
@@ -515,205 +1205,219 @@ function useDomainExtensions(domainId) {
515
1205
  }
516
1206
  return cacheRef.current.extensions;
517
1207
  }, [registry, domainId]);
518
- return (0, import_react10.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1208
+ return (0, import_react15.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
519
1209
  }
520
1210
 
521
- // src/mfe/hooks/useRegisteredPackages.ts
522
- var import_react11 = require("react");
523
- function useRegisteredPackages() {
524
- const app = useHAI3();
525
- const registry = app.screensetsRegistry;
1211
+ // src/mfe/hooks/useMountedExtensions.ts
1212
+ var import_react16 = require("react");
1213
+ function useMountedExtensions(domainId) {
1214
+ const app = useFrontX();
1215
+ const registry = app.mfeRegistry;
526
1216
  if (!registry) {
527
1217
  throw new Error(
528
- "useRegisteredPackages requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
1218
+ "useMountedExtensions requires the microfrontends plugin. Add microfrontends() to your Gears FrontX app configuration."
529
1219
  );
530
1220
  }
531
- const subscribe = (0, import_react11.useCallback)(
1221
+ const subscribe = (0, import_react16.useCallback)(
532
1222
  (onStoreChange) => {
533
1223
  return app.store.subscribe(onStoreChange);
534
1224
  },
535
1225
  [app.store]
536
1226
  );
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 };
1227
+ const cacheRef = (0, import_react16.useRef)({ key: "", extensions: [] });
1228
+ const getSnapshot = (0, import_react16.useCallback)(() => {
1229
+ const ids = registry.getMountedExtensions(domainId);
1230
+ const resolved = ids.map((id) => registry.getExtension(id)).filter((ext) => ext !== void 0);
1231
+ const key = ids.join(",");
1232
+ if (key !== cacheRef.current.key) {
1233
+ cacheRef.current = { key, extensions: resolved };
543
1234
  }
544
- return cacheRef.current.list;
545
- }, [registry]);
546
- return (0, import_react11.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1235
+ return cacheRef.current.extensions;
1236
+ }, [registry, domainId]);
1237
+ return (0, import_react16.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
547
1238
  }
548
1239
 
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;
1240
+ // src/mfe/hooks/useRegisteredPackages.ts
1241
+ var import_react17 = require("react");
1242
+ function useRegisteredPackages() {
1243
+ const app = useFrontX();
1244
+ const registry = app.mfeRegistry;
555
1245
  if (!registry) {
556
1246
  throw new Error(
557
- "useActivePackage requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
1247
+ "useRegisteredPackages requires the microfrontends plugin. Add microfrontends() to your Gears FrontX app configuration."
558
1248
  );
559
1249
  }
560
- const subscribe = (0, import_react12.useCallback)(
1250
+ const subscribe = (0, import_react17.useCallback)(
561
1251
  (onStoreChange) => {
562
1252
  return app.store.subscribe(onStoreChange);
563
1253
  },
564
1254
  [app.store]
565
1255
  );
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 };
1256
+ const cacheRef = (0, import_react17.useRef)({ packages: "", list: [] });
1257
+ const getSnapshot = (0, import_react17.useCallback)(() => {
1258
+ const list = registry.getRegisteredPackages();
1259
+ const packages = list.join(",");
1260
+ if (packages !== cacheRef.current.packages) {
1261
+ cacheRef.current = { packages, list };
579
1262
  }
580
- return cacheRef.current.activePackage;
1263
+ return cacheRef.current.list;
581
1264
  }, [registry]);
582
- return (0, import_react12.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
1265
+ return (0, import_react17.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
583
1266
  }
584
1267
 
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;
1268
+ // src/mfe/ThemeAwareReactLifecycle.tsx
1269
+ var import_client = require("react-dom/client");
1270
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1271
+ function resolveProviderMountOptions(app, bridge, mountContext) {
1272
+ const extensionId = mountContext?.extensionId;
1273
+ const domainId = mountContext?.domainId;
1274
+ const isMountedMfe = typeof extensionId === "string" && typeof domainId === "string";
1275
+ if (isMountedMfe && !resolveFrontXQueryClient(app) && !hasFrontXQueryClientActivator(app)) {
1276
+ throw new Error(
1277
+ "[FrontXProvider] Mounted MFEs require queryCacheShared() in the child app and queryCache() in the host app before loading the MFE app."
1278
+ );
591
1279
  }
592
- getContainer(_extensionId) {
593
- if (!this.containerRef.current) {
594
- throw new Error("Container ref is not attached -- component may not be mounted yet");
1280
+ return {
1281
+ mfeBridge: isMountedMfe ? { bridge, extensionId, domainId } : void 0
1282
+ };
1283
+ }
1284
+ function MountRuntimeAwareProvider({
1285
+ app,
1286
+ mfeBridge,
1287
+ children
1288
+ }) {
1289
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FrontXProvider, { app, mfeBridge, children });
1290
+ }
1291
+ var ThemeAwareReactLifecycle = class {
1292
+ constructor(app) {
1293
+ this.app = app;
1294
+ }
1295
+ app;
1296
+ root = null;
1297
+ mount(container, bridge, mountContext) {
1298
+ if (container instanceof ShadowRoot) {
1299
+ this.adoptHostStylesIntoShadowRoot(container);
595
1300
  }
596
- return this.containerRef.current;
1301
+ this.injectBaseResets(container);
1302
+ this.initializeStyles(container);
1303
+ const providerMountOptions = resolveProviderMountOptions(this.app, bridge, mountContext);
1304
+ this.root = (0, import_client.createRoot)(container);
1305
+ this.root.render(
1306
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1307
+ MountRuntimeAwareProvider,
1308
+ {
1309
+ app: this.app,
1310
+ mfeBridge: providerMountOptions.mfeBridge,
1311
+ children: this.renderContent(bridge)
1312
+ }
1313
+ )
1314
+ );
597
1315
  }
598
- releaseContainer(_extensionId) {
1316
+ unmount(_container) {
1317
+ if (this.root) {
1318
+ this.root.unmount();
1319
+ this.root = null;
1320
+ }
1321
+ }
1322
+ /**
1323
+ * Copy all inline <style> and <link rel="stylesheet"> from the host document
1324
+ * into the shadow root so that Tailwind and component styles apply inside the MFE.
1325
+ */
1326
+ adoptHostStylesIntoShadowRoot(shadowRoot) {
1327
+ const styleElements = document.head.querySelectorAll("style");
1328
+ styleElements.forEach((el) => {
1329
+ const clone = document.createElement("style");
1330
+ clone.textContent = el.textContent ?? "";
1331
+ shadowRoot.appendChild(clone);
1332
+ });
1333
+ const linkElements = document.head.querySelectorAll('link[rel="stylesheet"]');
1334
+ linkElements.forEach((el) => {
1335
+ const clone = el.cloneNode(true);
1336
+ shadowRoot.appendChild(clone);
1337
+ });
1338
+ }
1339
+ /**
1340
+ * Box-model resets and :host defaults needed inside every shadow root.
1341
+ * These aren't part of Tailwind's compiled output but are required for
1342
+ * consistent rendering across browsers.
1343
+ */
1344
+ injectBaseResets(container) {
1345
+ const style = document.createElement("style");
1346
+ style.textContent = `
1347
+ *, *::before, *::after {
1348
+ box-sizing: border-box;
1349
+ border-width: 0;
1350
+ border-style: solid;
1351
+ border-color: currentColor;
1352
+ }
1353
+ * { margin: 0; padding: 0; }
1354
+ :host {
1355
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
1356
+ line-height: 1.5;
1357
+ -webkit-font-smoothing: antialiased;
1358
+ -moz-osx-font-smoothing: grayscale;
1359
+ color: hsl(var(--foreground));
1360
+ background-color: hsl(var(--background));
1361
+ }
1362
+ `;
1363
+ container.appendChild(style);
1364
+ }
1365
+ /**
1366
+ * Hook for subclasses to inject additional CSS not covered by the adopted host
1367
+ * stylesheet (e.g., MFE-specific @font-face rules or custom animations).
1368
+ * No-op by default: host styles adopted in adoptHostStylesIntoShadowRoot()
1369
+ * already include all Tailwind utilities compiled from MFE source files.
1370
+ */
1371
+ initializeStyles(_container) {
599
1372
  }
600
1373
  };
601
1374
 
602
1375
  // 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");
1376
+ var import_react18 = require("react");
1377
+ var import_jsx_runtime5 = require("react/jsx-runtime");
606
1378
  function ExtensionDomainSlot(props) {
607
1379
  const {
608
1380
  registry,
609
1381
  domainId,
610
- extensionId,
611
1382
  className,
612
- onMounted,
613
- onUnmounted,
614
- onError,
615
- loadingComponent,
616
- errorComponent
1383
+ onAttached,
1384
+ onDetached,
1385
+ loadingComponent = null
617
1386
  } = 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
- }
1387
+ const rootRef = (0, import_react18.useRef)(null);
1388
+ const onAttachedRef = (0, import_react18.useRef)(onAttached);
1389
+ const onDetachedRef = (0, import_react18.useRef)(onDetached);
1390
+ onAttachedRef.current = onAttached;
1391
+ onDetachedRef.current = onDetached;
1392
+ const [attached, setAttached] = (0, import_react18.useState)(false);
1393
+ (0, import_react18.useEffect)(() => {
1394
+ const root = rootRef.current;
1395
+ if (!root) {
1396
+ return;
674
1397
  }
675
- void mountExtension2();
1398
+ const mounter = registry.getMounter(domainId);
1399
+ mounter.attach(root);
1400
+ setAttached(true);
1401
+ onAttachedRef.current?.(root);
676
1402
  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
- }
1403
+ void mounter.detach();
1404
+ setAttached(false);
1405
+ onDetachedRef.current?.();
693
1406
  };
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)(
1407
+ }, [registry, domainId]);
1408
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
705
1409
  "div",
706
1410
  {
707
- ref: containerRef,
1411
+ ref: rootRef,
708
1412
  className,
709
1413
  "data-domain-id": domainId,
710
- "data-extension-id": extensionId,
711
- "data-bridge-active": bridge !== null
1414
+ children: !attached ? loadingComponent : null
712
1415
  }
713
1416
  );
714
1417
  }
715
1418
 
716
1419
  // src/index.ts
1420
+ var import_framework5 = require("@gears-frontx/framework");
717
1421
  var import_framework6 = require("@gears-frontx/framework");
718
1422
  var import_framework7 = require("@gears-frontx/framework");
719
1423
  var import_framework8 = require("@gears-frontx/framework");
@@ -727,17 +1431,23 @@ var import_framework15 = require("@gears-frontx/framework");
727
1431
  var import_framework16 = require("@gears-frontx/framework");
728
1432
  var import_framework17 = require("@gears-frontx/framework");
729
1433
  var import_framework18 = require("@gears-frontx/framework");
730
- var import_framework19 = require("@gears-frontx/framework");
731
- var eventBus = import_framework19.eventBus;
1434
+ var eventBus2 = import_framework18.eventBus;
732
1435
  // Annotate the CommonJS export names for ESM import in node:
733
1436
  0 && (module.exports = {
734
1437
  ACCOUNTS_DOMAIN,
1438
+ ActionHandler,
735
1439
  ApiPlugin,
736
1440
  ApiPluginBase,
737
1441
  ApiProtocol,
738
1442
  BaseApiService,
739
- ContainerProvider,
1443
+ CanAccess,
1444
+ ChildMfeBridge,
1445
+ ConcurrentMountStrategy,
1446
+ ExclusiveMountStrategy,
1447
+ ExtensionDomainImplementation,
1448
+ ExtensionDomainImplementationFactory,
740
1449
  ExtensionDomainSlot,
1450
+ ExtensionMounter,
741
1451
  FRONTX_ACTION_LOAD_EXT,
742
1452
  FRONTX_ACTION_MOUNT_EXT,
743
1453
  FRONTX_ACTION_UNMOUNT_EXT,
@@ -749,8 +1459,8 @@ var eventBus = import_framework19.eventBus;
749
1459
  FRONTX_SHARED_PROPERTY_LANGUAGE,
750
1460
  FRONTX_SHARED_PROPERTY_THEME,
751
1461
  FRONTX_SIDEBAR_DOMAIN,
752
- HAI3Context,
753
- HAI3Provider,
1462
+ FrontXContext,
1463
+ FrontXProvider,
754
1464
  I18nRegistry,
755
1465
  I18nRegistryImpl,
756
1466
  LAYOUT_SLICE_NAME,
@@ -763,34 +1473,39 @@ var eventBus = import_framework19.eventBus;
763
1473
  MfeHandler,
764
1474
  MfeHandlerMF,
765
1475
  MfeProvider,
1476
+ MfeRegistry,
1477
+ MfeRegistryFactory,
766
1478
  MockEventSource,
767
1479
  MockEvents,
768
- RefContainerProvider,
1480
+ MountStrategy,
1481
+ OptionalMountStrategy,
1482
+ ParentMfeBridge,
1483
+ RestEndpointProtocol,
769
1484
  RestMockPlugin,
770
1485
  RestPlugin,
771
1486
  RestPluginWithConfig,
772
1487
  RestProtocol,
773
1488
  SUPPORTED_LANGUAGES,
774
- ScreensetsRegistry,
775
- ScreensetsRegistryFactory,
776
1489
  SseMockPlugin,
777
1490
  SsePlugin,
778
1491
  SsePluginWithConfig,
779
1492
  SseProtocol,
1493
+ SseStreamProtocol,
780
1494
  TENANT_SLICE_NAME,
781
1495
  TenantEvents,
782
1496
  TextDirection,
1497
+ ThemeAwareReactLifecycle,
783
1498
  apiRegistry,
1499
+ auth,
784
1500
  changeTenant,
785
- clearActiveScreen,
786
1501
  clearTenant,
787
1502
  clearTenantAction,
788
1503
  clearUser,
789
1504
  closeAllPopups,
790
1505
  closePopup,
791
1506
  closeTopPopup,
792
- createHAI3,
793
- createHAI3App,
1507
+ createFrontX,
1508
+ createFrontXApp,
794
1509
  createI18nRegistry,
795
1510
  createShadowRoot,
796
1511
  createSlice,
@@ -802,6 +1517,7 @@ var eventBus = import_framework19.eventBus;
802
1517
  extractGtsPackage,
803
1518
  footerActions,
804
1519
  footerSlice,
1520
+ frontxApiTransport,
805
1521
  getLanguageMetadata,
806
1522
  getStore,
807
1523
  gtsPlugin,
@@ -814,6 +1530,7 @@ var eventBus = import_framework19.eventBus;
814
1530
  initMockEffects,
815
1531
  initTenantEffects,
816
1532
  injectCssVariables,
1533
+ invalidateQueryCacheForApp,
817
1534
  isMockPlugin,
818
1535
  isRestShortCircuit,
819
1536
  isShortCircuit,
@@ -825,12 +1542,12 @@ var eventBus = import_framework19.eventBus;
825
1542
  loadExtension,
826
1543
  menuActions,
827
1544
  menuSlice,
1545
+ mfeRegistryFactory,
828
1546
  microfrontends,
829
1547
  mock,
830
1548
  mockActions,
831
1549
  mockSlice,
832
1550
  mountExtension,
833
- navigateTo,
834
1551
  openPopup,
835
1552
  overlayActions,
836
1553
  overlayDomain,
@@ -839,17 +1556,15 @@ var eventBus = import_framework19.eventBus;
839
1556
  popupDomain,
840
1557
  popupSlice,
841
1558
  presets,
1559
+ queryCache,
1560
+ queryCacheShared,
842
1561
  registerExtension,
843
1562
  registerSlice,
844
- screenActions,
845
1563
  screenDomain,
846
- screenSlice,
847
- screensets,
848
- screensetsRegistryFactory,
849
1564
  selectExtensionError,
850
1565
  selectExtensionState,
1566
+ selectMountedExtensions,
851
1567
  selectRegisteredExtensions,
852
- setActiveScreen,
853
1568
  setFooterConfig,
854
1569
  setFooterVisible,
855
1570
  setHeaderLoading,
@@ -859,7 +1574,6 @@ var eventBus = import_framework19.eventBus;
859
1574
  setMenuVisible,
860
1575
  setMockEnabled,
861
1576
  setOverlayVisible,
862
- setScreenLoading,
863
1577
  setSidebarCollapsed,
864
1578
  setSidebarConfig,
865
1579
  setSidebarContent,
@@ -875,6 +1589,7 @@ var eventBus = import_framework19.eventBus;
875
1589
  sidebarActions,
876
1590
  sidebarDomain,
877
1591
  sidebarSlice,
1592
+ subscribeQueryCacheRuntimeChanged,
878
1593
  tenantActions,
879
1594
  tenantReducer,
880
1595
  tenantSlice,
@@ -885,15 +1600,23 @@ var eventBus = import_framework19.eventBus;
885
1600
  toggleSidebar,
886
1601
  unmountExtension,
887
1602
  unregisterExtension,
888
- useActivePackage,
1603
+ useApiInfiniteQuery,
1604
+ useApiMutation,
1605
+ useApiQuery,
1606
+ useApiStream,
1607
+ useApiSuspenseInfiniteQuery,
1608
+ useApiSuspenseQuery,
889
1609
  useAppDispatch,
890
1610
  useAppSelector,
1611
+ useCanAccess,
891
1612
  useDomainExtensions,
892
1613
  useFormatters,
893
- useHAI3,
1614
+ useFrontX,
894
1615
  useHostAction,
895
1616
  useMfeBridge,
896
1617
  useMfeContext,
1618
+ useMountedExtensions,
1619
+ useQueryCache,
897
1620
  useRegisteredPackages,
898
1621
  useScreenTranslations,
899
1622
  useSharedProperty,