@gears-frontx/react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +421 -0
- package/commands/hai3-duplicate-screenset.md +58 -0
- package/commands/hai3-new-component.md +48 -0
- package/commands/hai3-new-mfe.md +166 -0
- package/commands/hai3-new-screen.md +39 -0
- package/commands/hai3-new-screenset.md +47 -0
- package/dist/index.cjs +903 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +590 -0
- package/dist/index.d.ts +590 -0
- package/dist/index.js +872 -0
- package/dist/index.js.map +1 -0
- package/dist/types-Cp8Zm5s0.d.cts +136 -0
- package/dist/types-Cp8Zm5s0.d.ts +136 -0
- package/dist/types.cjs +19 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +3 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/llms.txt +122 -0
- package/package.json +75 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { RefObject } from 'react';
|
|
3
|
+
import { H as HAI3ProviderProps, U as UseTranslationReturn, a as UseScreenTranslationsReturn, b as UseFormattersReturn, c as UseThemeReturn, M as MfeContextValue } from './types-Cp8Zm5s0.cjs';
|
|
4
|
+
export { d as MfeContext, e as UseAppDispatchReturn, f as UseAppSelector, g as UseHAI3Return, u as useMfeContext } from './types-Cp8Zm5s0.cjs';
|
|
5
|
+
import { HAI3App, AppDispatch, RootState, TranslationMap, TranslationLoader, ChildMfeBridge, Extension, ContainerProvider, ScreensetsRegistry, ParentMfeBridge, EventPayloadMap as EventPayloadMap$1, EventBus } from '@gears-frontx/framework';
|
|
6
|
+
export { ACCOUNTS_DOMAIN, Action, ActionsChain, ApiPlugin, ApiPluginBase, ApiPluginErrorContext, ApiProtocol, ApiRequestContext, ApiResponseContext, ApiServiceConfig, AppDispatch, BaseApiService, BasePluginHooks, ChangeThemePayload, ChildMfeBridge, ContainerProvider, EventHandler, EventSourceLike, Extension, ExtensionDomain, ExtensionPresentation, ExtensionRegistrationState, FRONTX_ACTION_LOAD_EXT, FRONTX_ACTION_MOUNT_EXT, FRONTX_ACTION_UNMOUNT_EXT, FRONTX_MFE_ENTRY_MF, FRONTX_OVERLAY_DOMAIN, FRONTX_POPUP_DOMAIN, FRONTX_SCREEN_DOMAIN, FRONTX_SCREEN_EXTENSION_TYPE, FRONTX_SHARED_PROPERTY_LANGUAGE, FRONTX_SHARED_PROPERTY_THEME, FRONTX_SIDEBAR_DOMAIN, FooterConfig, FooterState, HAI3App, HAI3AppBuilder, HAI3Config, HAI3Plugin, HAI3Store, HeaderConfig, HeaderState, HeaderUser, I18nConfig, I18nRegistry, I18nRegistryImpl, I18nRegistryType, JSONSchema, JsonCompatible, JsonObject, JsonPrimitive, JsonValue, LAYOUT_SLICE_NAME, Language, LanguageDisplayMode, LanguageMetadata, LayoutDomain, LayoutDomainReducers, LayoutDomainState, LayoutState, LifecycleHook, LifecycleStage, LoadExtPayload, MOCK_PLUGIN, MenuItem, MenuState, MfeBridgeFactory, MfeEntry, MfeEntryLifecycle, MfeEntryMF, MfeHandler, MfeHandlerMF, MfeState, MockEventSource, MockEvents, MockMap, MockState, MockTogglePayload, MountExtPayload, OverlayConfig, OverlayState, ParentMfeBridge, PluginClass, PluginFactory, PluginLifecycle, PluginProvides, PopupConfig, PopupSliceState, PopupState, Preset, Presets, ProtocolClass, ProtocolPluginType, ReducerPayload, RegisterExtensionPayload, RestMockConfig, RestMockPlugin, RestPlugin, RestPluginHooks, RestPluginWithConfig, RestProtocol, RestProtocolConfig, RestRequestContext, RestResponseContext, RestShortCircuitResponse, RootState, RootStateWithLayout, SUPPORTED_LANGUAGES, ScreenExtension, ScreenState, ScreensetsConfig, ScreensetsRegistry, ScreensetsRegistryConfig, ScreensetsRegistryFactory, SetLanguagePayload, SharedProperty, ShortCircuitResponse, ShowPopupPayload, SidebarPosition, SidebarState, SliceObject, SseConnectContext, SseMockConfig, SseMockEvent, SseMockPlugin, SsePlugin, SsePluginHooks, SsePluginWithConfig, SseProtocol, SseProtocolConfig, SseShortCircuitResponse, Subscription, TENANT_SLICE_NAME, Tenant, TenantChangedPayload, TenantClearedPayload, TenantEvents, TenantState, TextDirection, ThemeConfig, ThemeRegistry, TranslationDictionary, TranslationLoader, TranslationMap, TypeSystemPlugin, UnmountExtPayload, UnregisterExtensionPayload, ValidationError, ValidationResult, apiRegistry, changeTenant, clearActiveScreen, clearTenant, clearTenantAction, clearUser, closeAllPopups, closePopup, closeTopPopup, createHAI3, createHAI3App, createI18nRegistry, createShadowRoot, createSlice, createStore, createThemeRegistry, effects, extensionScreenSchema, extractGtsPackage, footerActions, footerSlice, getLanguageMetadata, getStore, gtsPlugin, hasSlice, headerActions, headerSlice, hideOverlay, i18n, i18nRegistry, initMockEffects, initTenantEffects, injectCssVariables, isMockPlugin, isRestShortCircuit, isShortCircuit, isSseShortCircuit, languageSchema, layout, layoutDomainReducers, layoutReducer, loadExtension, menuActions, menuSlice, microfrontends, mock, mockActions, mockSlice, mountExtension, navigateTo, openPopup, overlayActions, overlayDomain, overlaySlice, popupActions, popupDomain, popupSlice, presets, registerExtension, registerSlice, screenActions, screenDomain, screenSlice, screensets, screensetsRegistryFactory, selectExtensionError, selectExtensionState, selectRegisteredExtensions, setActiveScreen, setFooterConfig, setFooterVisible, setHeaderLoading, setMenuCollapsed, setMenuConfig, setMenuItems, setMenuVisible, setMockEnabled, setOverlayVisible, setScreenLoading, setSidebarCollapsed, setSidebarConfig, setSidebarContent, setSidebarPosition, setSidebarTitle, setSidebarVisible, setSidebarWidth, setTenant, setTenantLoading, setTenantLoadingState, setUser, showOverlay, sidebarActions, sidebarDomain, sidebarSlice, tenantActions, tenantReducer, tenantSlice, themeSchema, themes, toggleMenu, toggleMockMode, toggleSidebar, unmountExtension, unregisterExtension } from '@gears-frontx/framework';
|
|
7
|
+
import { TypedUseSelectorHook } from 'react-redux';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* HAI3 Provider - Main provider component for HAI3 applications
|
|
11
|
+
*
|
|
12
|
+
* React Layer: L3 (Depends on @gears-frontx/framework)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* HAI3 Provider Component
|
|
17
|
+
*
|
|
18
|
+
* Provides the HAI3 application context to all child components.
|
|
19
|
+
* Creates the HAI3 app instance with the full preset by default.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // Default - creates app with full preset
|
|
24
|
+
* <HAI3Provider>
|
|
25
|
+
* <App />
|
|
26
|
+
* </HAI3Provider>
|
|
27
|
+
*
|
|
28
|
+
* // With configuration
|
|
29
|
+
* <HAI3Provider config={{ devMode: true }}>
|
|
30
|
+
* <App />
|
|
31
|
+
* </HAI3Provider>
|
|
32
|
+
*
|
|
33
|
+
* // With pre-built app
|
|
34
|
+
* const app = createHAI3().use(screensets()).use(microfrontends()).build();
|
|
35
|
+
* <HAI3Provider app={app}>
|
|
36
|
+
* <App />
|
|
37
|
+
* </HAI3Provider>
|
|
38
|
+
*
|
|
39
|
+
* // With MFE bridge (for MFE components)
|
|
40
|
+
* <HAI3Provider mfeBridge={{ bridge, extensionId, domainId }}>
|
|
41
|
+
* <MyMfeApp />
|
|
42
|
+
* </HAI3Provider>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const HAI3Provider: React__default.FC<HAI3ProviderProps>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* HAI3 Context
|
|
49
|
+
* Holds the HAI3 app instance for the application.
|
|
50
|
+
*/
|
|
51
|
+
declare const HAI3Context: React.Context<HAI3App | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Use the HAI3 context.
|
|
54
|
+
* Throws if used outside of HAI3Provider.
|
|
55
|
+
*
|
|
56
|
+
* @returns The HAI3 app instance
|
|
57
|
+
*/
|
|
58
|
+
declare function useHAI3(): HAI3App;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* useAppDispatch Hook - Type-safe dispatch hook
|
|
62
|
+
*
|
|
63
|
+
* React Layer: L3
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Type-safe dispatch hook.
|
|
68
|
+
*
|
|
69
|
+
* @returns The typed dispatch function
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* const dispatch = useAppDispatch();
|
|
74
|
+
* dispatch(someAction());
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare function useAppDispatch(): AppDispatch;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* useAppSelector Hook - Type-safe selector hook
|
|
81
|
+
*
|
|
82
|
+
* React Layer: L3
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Type-safe selector hook.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* const activeScreen = useAppSelector(selectActiveScreen);
|
|
91
|
+
* const menuCollapsed = useAppSelector(selectMenuCollapsed);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* useTranslation Hook - Translation utilities
|
|
98
|
+
*
|
|
99
|
+
* React Layer: L3
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Hook for accessing translation utilities.
|
|
104
|
+
*
|
|
105
|
+
* @returns Translation utilities
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* const { t, language, setLanguage, isRTL } = useTranslation();
|
|
110
|
+
*
|
|
111
|
+
* return (
|
|
112
|
+
* <div dir={isRTL ? 'rtl' : 'ltr'}>
|
|
113
|
+
* <h1>{t('common:app.title')}</h1>
|
|
114
|
+
* <p>{t('common:app.welcome', { name: 'John' })}</p>
|
|
115
|
+
* </div>
|
|
116
|
+
* );
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
declare function useTranslation(): UseTranslationReturn;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* useScreenTranslations Hook - Screen-level translation loading
|
|
123
|
+
*
|
|
124
|
+
* React Layer: L3
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Hook for loading screen-level translations.
|
|
129
|
+
* Use this in screen components to lazy-load translations.
|
|
130
|
+
* Automatically reloads translations when language changes.
|
|
131
|
+
*
|
|
132
|
+
* @param screensetId - The screenset ID
|
|
133
|
+
* @param screenId - The screen ID
|
|
134
|
+
* @param translations - Either a TranslationMap object or a TranslationLoader function
|
|
135
|
+
* (from I18nRegistry.createLoader)
|
|
136
|
+
* @returns Loading state
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```tsx
|
|
140
|
+
* // Option 1: Using I18nRegistry.createLoader (recommended)
|
|
141
|
+
* const translations = I18nRegistry.createLoader({
|
|
142
|
+
* en: () => import('./i18n/en.json'),
|
|
143
|
+
* es: () => import('./i18n/es.json'),
|
|
144
|
+
* });
|
|
145
|
+
*
|
|
146
|
+
* // Option 2: Using raw TranslationMap
|
|
147
|
+
* const translations = {
|
|
148
|
+
* en: () => import('./i18n/en.json'),
|
|
149
|
+
* es: () => import('./i18n/es.json'),
|
|
150
|
+
* };
|
|
151
|
+
*
|
|
152
|
+
* export const HomeScreen: React.FC = () => {
|
|
153
|
+
* const { isLoaded, error } = useScreenTranslations(
|
|
154
|
+
* 'demo',
|
|
155
|
+
* 'home',
|
|
156
|
+
* translations
|
|
157
|
+
* );
|
|
158
|
+
*
|
|
159
|
+
* if (!isLoaded) return <LoadingSpinner />;
|
|
160
|
+
* if (error) return <ErrorMessage error={error} />;
|
|
161
|
+
*
|
|
162
|
+
* return <div>...</div>;
|
|
163
|
+
* };
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
declare function useScreenTranslations(screensetId: string, screenId: string, translations: TranslationMap | TranslationLoader): UseScreenTranslationsReturn;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* useFormatters Hook - Locale-aware formatters
|
|
170
|
+
*
|
|
171
|
+
* Returns formatters that use i18nRegistry.getLanguage() internally.
|
|
172
|
+
* Calls useTranslation() so the component re-renders when language changes.
|
|
173
|
+
*
|
|
174
|
+
* React Layer: L3
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Hook for accessing locale-aware formatters (date, number, currency, sort).
|
|
179
|
+
*
|
|
180
|
+
* Formatters use the current app language from i18nRegistry.getLanguage().
|
|
181
|
+
* Re-renders when language changes via useTranslation() subscription.
|
|
182
|
+
*
|
|
183
|
+
* @returns Object with formatDate, formatTime, formatDateTime, formatRelative,
|
|
184
|
+
* formatNumber, formatPercent, formatCompact, formatCurrency, compareStrings, createCollator
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```tsx
|
|
188
|
+
* const { formatDate, formatCurrency } = useFormatters();
|
|
189
|
+
* return (
|
|
190
|
+
* <span>{formatDate(new Date(), 'short')}</span>
|
|
191
|
+
* <span>{formatCurrency(99.99, 'USD')}</span>
|
|
192
|
+
* );
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
declare function useFormatters(): UseFormattersReturn;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* useTheme Hook - Theme utilities
|
|
199
|
+
*
|
|
200
|
+
* React Layer: L3
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Hook for theme utilities.
|
|
205
|
+
*
|
|
206
|
+
* @returns Theme utilities
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```tsx
|
|
210
|
+
* const { currentTheme, themes, setTheme } = useTheme();
|
|
211
|
+
*
|
|
212
|
+
* return (
|
|
213
|
+
* <select
|
|
214
|
+
* value={currentTheme}
|
|
215
|
+
* onChange={(e) => setTheme(e.target.value)}
|
|
216
|
+
* >
|
|
217
|
+
* {themes.map((theme) => (
|
|
218
|
+
* <option key={theme.id} value={theme.id}>
|
|
219
|
+
* {theme.name}
|
|
220
|
+
* </option>
|
|
221
|
+
* ))}
|
|
222
|
+
* </select>
|
|
223
|
+
* );
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
declare function useTheme(): UseThemeReturn;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* MFE Provider - Provides MFE context to child components
|
|
230
|
+
*
|
|
231
|
+
* Wraps MFE components with bridge and metadata.
|
|
232
|
+
* Used by the MFE mounting system.
|
|
233
|
+
*
|
|
234
|
+
* React Layer: L3 (Depends on @gears-frontx/framework)
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* MFE Provider Props
|
|
239
|
+
*/
|
|
240
|
+
interface MfeProviderProps {
|
|
241
|
+
/** MFE context value */
|
|
242
|
+
value: MfeContextValue;
|
|
243
|
+
/** Child components */
|
|
244
|
+
children: React__default.ReactNode;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* MFE Provider Component
|
|
248
|
+
*
|
|
249
|
+
* Provides MFE bridge and metadata to child components.
|
|
250
|
+
* Used by the MFE mounting system to wrap MFE components.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```tsx
|
|
254
|
+
* <MfeProvider value={{ bridge, extensionId, domainId }}>
|
|
255
|
+
* <MyMfeComponent />
|
|
256
|
+
* </MfeProvider>
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
declare const MfeProvider: React__default.FC<MfeProviderProps>;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* useMfeBridge Hook - MFE bridge access
|
|
263
|
+
*
|
|
264
|
+
* Returns the ChildMfeBridge from context for communication with host.
|
|
265
|
+
*
|
|
266
|
+
* React Layer: L3
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Hook for accessing the MFE bridge.
|
|
271
|
+
*
|
|
272
|
+
* Returns the ChildMfeBridge instance for communication with the host.
|
|
273
|
+
* Must be used within a MfeProvider (i.e., inside an MFE component).
|
|
274
|
+
*
|
|
275
|
+
* @returns Child MFE bridge
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```tsx
|
|
279
|
+
* function MyMfeComponent() {
|
|
280
|
+
* const bridge = useMfeBridge();
|
|
281
|
+
*
|
|
282
|
+
* // Bridge methods:
|
|
283
|
+
* // bridge.executeActionsChain(chain);
|
|
284
|
+
* // bridge.subscribeToProperty(propertyTypeId, callback);
|
|
285
|
+
*
|
|
286
|
+
* return <div>Domain: {bridge.domainId}</div>;
|
|
287
|
+
* }
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
declare function useMfeBridge(): ChildMfeBridge;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* useSharedProperty Hook - Shared property subscription
|
|
294
|
+
*
|
|
295
|
+
* Subscribes to shared property updates from the host.
|
|
296
|
+
*
|
|
297
|
+
* React Layer: L3
|
|
298
|
+
*/
|
|
299
|
+
/**
|
|
300
|
+
* Hook for subscribing to a shared property.
|
|
301
|
+
*
|
|
302
|
+
* Subscribes to property updates from the host and returns the current value.
|
|
303
|
+
* Must be used within a MfeProvider (i.e., inside an MFE component).
|
|
304
|
+
*
|
|
305
|
+
* NOTE: This hook provides the interface and uses useSyncExternalStore with a stub subscription.
|
|
306
|
+
* Full bridge subscription should be implemented when bridge methods are available.
|
|
307
|
+
*
|
|
308
|
+
* @param _propertyTypeId - Type ID of the shared property to subscribe to (currently unused)
|
|
309
|
+
* @returns Current property value
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```tsx
|
|
313
|
+
* function MyMfeComponent() {
|
|
314
|
+
* const userData = useSharedProperty('gts.frontx.mfes.comm.shared_property.v1~myapp.user_data.v1');
|
|
315
|
+
*
|
|
316
|
+
* return <div>User: {userData?.name}</div>;
|
|
317
|
+
* }
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
declare function useSharedProperty<T = unknown>(propertyTypeId: string): T | undefined;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* useHostAction Hook - Host action requests
|
|
324
|
+
*
|
|
325
|
+
* Returns a callback to request host actions via the bridge.
|
|
326
|
+
*
|
|
327
|
+
* React Layer: L3
|
|
328
|
+
*/
|
|
329
|
+
/**
|
|
330
|
+
* Hook for requesting host actions.
|
|
331
|
+
*
|
|
332
|
+
* Returns a callback function that sends an actions chain to the host.
|
|
333
|
+
* Must be used within a MfeProvider (i.e., inside an MFE component).
|
|
334
|
+
*
|
|
335
|
+
* NOTE: This hook provides the interface. Bridge executeActionsChain() delegates to the registry.
|
|
336
|
+
*
|
|
337
|
+
* @param actionTypeId - Type ID of the action to request
|
|
338
|
+
* @returns Callback function to request the action with payload
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```tsx
|
|
342
|
+
* function MyMfeComponent() {
|
|
343
|
+
* const requestNavigation = useHostAction('gts.frontx.mfes.comm.action.v1~myapp.navigate.v1');
|
|
344
|
+
*
|
|
345
|
+
* const handleClick = () => {
|
|
346
|
+
* requestNavigation({ path: '/dashboard' });
|
|
347
|
+
* };
|
|
348
|
+
*
|
|
349
|
+
* return <button onClick={handleClick}>Navigate</button>;
|
|
350
|
+
* }
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
declare function useHostAction<TPayload extends Record<string, unknown> = Record<string, unknown>>(actionTypeId: string): (payload?: TPayload) => void;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* useDomainExtensions Hook - Domain extension list subscription
|
|
357
|
+
*
|
|
358
|
+
* Subscribes to store changes to detect when extensions are registered or unregistered,
|
|
359
|
+
* and returns the current list of extensions for a domain.
|
|
360
|
+
*
|
|
361
|
+
* React Layer: L3
|
|
362
|
+
*/
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Hook for observing extensions registered for a domain.
|
|
366
|
+
*
|
|
367
|
+
* Subscribes to the HAI3 store to detect registration state changes,
|
|
368
|
+
* and returns the current list of extensions for the specified domain.
|
|
369
|
+
*
|
|
370
|
+
* @param domainId - Domain ID to query extensions for
|
|
371
|
+
* @returns Array of extensions currently registered for the domain
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```tsx
|
|
375
|
+
* function SidebarExtensions() {
|
|
376
|
+
* const extensions = useDomainExtensions('gts.frontx.mfes.ext.domain.v1~frontx.screensets.layout.sidebar.v1');
|
|
377
|
+
*
|
|
378
|
+
* return (
|
|
379
|
+
* <div>
|
|
380
|
+
* {extensions.map(ext => (
|
|
381
|
+
* <div key={ext.id}>{ext.id}</div>
|
|
382
|
+
* ))}
|
|
383
|
+
* </div>
|
|
384
|
+
* );
|
|
385
|
+
* }
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
declare function useDomainExtensions(domainId: string): Extension[];
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* useRegisteredPackages Hook - Registered GTS packages subscription
|
|
392
|
+
*
|
|
393
|
+
* Subscribes to store changes to detect when extensions are registered or unregistered,
|
|
394
|
+
* and returns the current list of registered GTS packages.
|
|
395
|
+
*
|
|
396
|
+
* React Layer: L3
|
|
397
|
+
*/
|
|
398
|
+
/**
|
|
399
|
+
* Hook for observing registered GTS packages.
|
|
400
|
+
*
|
|
401
|
+
* Subscribes to the HAI3 store to detect registration state changes,
|
|
402
|
+
* and returns the current list of GTS packages extracted from registered
|
|
403
|
+
* extensions.
|
|
404
|
+
*
|
|
405
|
+
* ARCHITECTURAL NOTE ON STORE SUBSCRIPTION COUPLING:
|
|
406
|
+
* This hook uses `useSyncExternalStore` with `app.store.subscribe`, which
|
|
407
|
+
* fires on any Redux dispatch. Since `registerExtension()` dispatches to
|
|
408
|
+
* the mfe store slice, the subscription WILL trigger when packages change.
|
|
409
|
+
* The `getSnapshot` function calls `screensetsRegistry.getRegisteredPackages()`
|
|
410
|
+
* which reads the private `packages` Map. This works because every package
|
|
411
|
+
* map mutation (in registerExtension/unregisterExtension) is always
|
|
412
|
+
* accompanied by a store dispatch in the same serializer callback.
|
|
413
|
+
*
|
|
414
|
+
* IMPORTANT: If a future change mutates the packages map WITHOUT a store
|
|
415
|
+
* dispatch, this hook would fail to re-render. Keep this coupling documented.
|
|
416
|
+
*
|
|
417
|
+
* @returns Array of GTS package strings currently registered
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* ```tsx
|
|
421
|
+
* function PackageList() {
|
|
422
|
+
* const packages = useRegisteredPackages();
|
|
423
|
+
*
|
|
424
|
+
* return (
|
|
425
|
+
* <div>
|
|
426
|
+
* {packages.map(pkg => (
|
|
427
|
+
* <div key={pkg}>{pkg}</div>
|
|
428
|
+
* ))}
|
|
429
|
+
* </div>
|
|
430
|
+
* );
|
|
431
|
+
* }
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
declare function useRegisteredPackages(): string[];
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* useActivePackage Hook - Active GTS package subscription
|
|
438
|
+
*
|
|
439
|
+
* Subscribes to store changes and returns the GTS package of the currently
|
|
440
|
+
* mounted screen extension.
|
|
441
|
+
*
|
|
442
|
+
* React Layer: L3
|
|
443
|
+
*/
|
|
444
|
+
/**
|
|
445
|
+
* Hook for observing the active GTS package (the package of the currently
|
|
446
|
+
* mounted screen extension).
|
|
447
|
+
*
|
|
448
|
+
* Subscribes to the HAI3 store to detect mount state changes, and returns
|
|
449
|
+
* the GTS package extracted from the currently mounted screen extension's ID.
|
|
450
|
+
*
|
|
451
|
+
* Returns `undefined` if no screen extension is currently mounted.
|
|
452
|
+
*
|
|
453
|
+
* @returns GTS package string of the active screen extension, or undefined
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```tsx
|
|
457
|
+
* function ActivePackageIndicator() {
|
|
458
|
+
* const activePackage = useActivePackage();
|
|
459
|
+
*
|
|
460
|
+
* if (!activePackage) {
|
|
461
|
+
* return <div>No active screen</div>;
|
|
462
|
+
* }
|
|
463
|
+
*
|
|
464
|
+
* return <div>Active package: {activePackage}</div>;
|
|
465
|
+
* }
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
468
|
+
declare function useActivePackage(): string | undefined;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Ref Container Provider
|
|
472
|
+
*
|
|
473
|
+
* Concrete ContainerProvider that wraps a React ref.
|
|
474
|
+
* Created by React components (like ExtensionDomainSlot) for use
|
|
475
|
+
* by framework-level domain registration code.
|
|
476
|
+
*
|
|
477
|
+
* @packageDocumentation
|
|
478
|
+
*/
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Concrete ContainerProvider that wraps a React ref.
|
|
482
|
+
*
|
|
483
|
+
* This provider reads the container element from a React ref at mount time.
|
|
484
|
+
* It is designed to be created by React components but passed to domain
|
|
485
|
+
* registration code (framework-level).
|
|
486
|
+
*
|
|
487
|
+
* Usage pattern:
|
|
488
|
+
* 1. React component creates a ref via `useRef<HTMLDivElement>(null)`
|
|
489
|
+
* 2. Framework-level code creates `RefContainerProvider` wrapping the ref
|
|
490
|
+
* 3. Framework-level code passes the provider to `registerDomain(domain, provider)`
|
|
491
|
+
* 4. When mount_ext is dispatched, the provider returns `ref.current`
|
|
492
|
+
*/
|
|
493
|
+
declare class RefContainerProvider extends ContainerProvider {
|
|
494
|
+
private readonly containerRef;
|
|
495
|
+
constructor(containerRef: RefObject<HTMLDivElement>);
|
|
496
|
+
getContainer(_extensionId: string): Element;
|
|
497
|
+
releaseContainer(_extensionId: string): void;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Extension Domain Slot Component
|
|
502
|
+
*
|
|
503
|
+
* React component that renders extensions within a domain slot.
|
|
504
|
+
* Manages extension lifecycle (mount/unmount) and provides rendering context.
|
|
505
|
+
*
|
|
506
|
+
* @packageDocumentation
|
|
507
|
+
*/
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Props for ExtensionDomainSlot component
|
|
511
|
+
*/
|
|
512
|
+
interface ExtensionDomainSlotProps {
|
|
513
|
+
/**
|
|
514
|
+
* The screensets registry instance
|
|
515
|
+
*/
|
|
516
|
+
registry: ScreensetsRegistry;
|
|
517
|
+
/**
|
|
518
|
+
* The domain ID for this slot
|
|
519
|
+
*/
|
|
520
|
+
domainId: string;
|
|
521
|
+
/**
|
|
522
|
+
* The extension ID to render in this slot
|
|
523
|
+
*/
|
|
524
|
+
extensionId: string;
|
|
525
|
+
/**
|
|
526
|
+
* Optional CSS class name for the container
|
|
527
|
+
*/
|
|
528
|
+
className?: string;
|
|
529
|
+
/**
|
|
530
|
+
* Optional callback when extension is mounted
|
|
531
|
+
*/
|
|
532
|
+
onMounted?: (bridge: ParentMfeBridge) => void;
|
|
533
|
+
/**
|
|
534
|
+
* Optional callback when extension is unmounted
|
|
535
|
+
*/
|
|
536
|
+
onUnmounted?: () => void;
|
|
537
|
+
/**
|
|
538
|
+
* Optional error callback
|
|
539
|
+
*/
|
|
540
|
+
onError?: (error: Error) => void;
|
|
541
|
+
/**
|
|
542
|
+
* Optional loading component
|
|
543
|
+
*/
|
|
544
|
+
loadingComponent?: React__default.ReactNode;
|
|
545
|
+
/**
|
|
546
|
+
* Optional error component renderer
|
|
547
|
+
*/
|
|
548
|
+
errorComponent?: (error: Error) => React__default.ReactNode;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Extension Domain Slot Component
|
|
552
|
+
*
|
|
553
|
+
* Renders an extension within a domain slot. Manages the extension lifecycle:
|
|
554
|
+
* - Mounts the extension on component mount
|
|
555
|
+
* - Unmounts the extension on component unmount
|
|
556
|
+
* - Handles loading and error states
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* ```tsx
|
|
560
|
+
* <ExtensionDomainSlot
|
|
561
|
+
* registry={registry}
|
|
562
|
+
* domainId="gts.frontx.mfes.ext.domain.v1~frontx.screensets.layout.sidebar.v1"
|
|
563
|
+
* extensionId="gts.frontx.mfes.ext.extension.v1~myapp.sidebar.widget.v1"
|
|
564
|
+
* className="sidebar-slot"
|
|
565
|
+
* />
|
|
566
|
+
* ```
|
|
567
|
+
*/
|
|
568
|
+
declare function ExtensionDomainSlot(props: ExtensionDomainSlotProps): React__default.ReactElement;
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @gears-frontx/react - React Bindings
|
|
572
|
+
*
|
|
573
|
+
* This package provides:
|
|
574
|
+
* - HAI3Provider context provider
|
|
575
|
+
* - Type-safe hooks for state and actions
|
|
576
|
+
* - MFE context, hooks, and components
|
|
577
|
+
*
|
|
578
|
+
* Layer: L3 (Depends on @gears-frontx/framework)
|
|
579
|
+
*/
|
|
580
|
+
|
|
581
|
+
interface EventPayloadMap extends EventPayloadMap$1 {
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Re-export eventBus with augmented EventPayloadMap type.
|
|
585
|
+
* This ensures that code importing eventBus from @gears-frontx/react gets
|
|
586
|
+
* type-safe access to both framework events and app-layer augmented events.
|
|
587
|
+
*/
|
|
588
|
+
declare const eventBus: EventBus<EventPayloadMap>;
|
|
589
|
+
|
|
590
|
+
export { type EventPayloadMap, ExtensionDomainSlot, type ExtensionDomainSlotProps, HAI3Context, HAI3Provider, HAI3ProviderProps, MfeContextValue, MfeProvider, type MfeProviderProps, RefContainerProvider, UseFormattersReturn, UseScreenTranslationsReturn, UseThemeReturn, UseTranslationReturn, eventBus, useActivePackage, useAppDispatch, useAppSelector, useDomainExtensions, useFormatters, useHAI3, useHostAction, useMfeBridge, useRegisteredPackages, useScreenTranslations, useSharedProperty, useTheme, useTranslation };
|