@memberjunction/ng-react 6.2.0-edge.3 → 6.2.0-edge.4
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/README.md +4 -0
- package/dist/lib/components/mj-react-component.component.d.ts +5 -2
- package/dist/lib/components/mj-react-component.component.dom.test.js +28 -0
- package/dist/lib/components/mj-react-component.component.dom.test.js.map +1 -1
- package/dist/lib/components/mj-react-component.component.js +8 -3
- package/dist/lib/components/mj-react-component.component.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -104,6 +104,10 @@ componentProps = {
|
|
|
104
104
|
| `ComponentError` | `EventEmitter<Error>` | Errors during rendering or transpilation |
|
|
105
105
|
| `ComponentReady` | `EventEmitter<void>` | React component has mounted |
|
|
106
106
|
|
|
107
|
+
### MJReactComponent Methods
|
|
108
|
+
|
|
109
|
+
Hosts that drive a component from outside (an agent operating it through a realtime channel, a toolbar) call the standard component methods on the `MJReactComponent` instance: `InvokeMethod(name, ...args)`, `HasMethod(name)`, `GetCurrentDataState()`, `Refresh()` (the component's own `refresh()` when it registered one, otherwise a re-render), `Print()`, `validate()`, `IsDirty()`, `Reset()`, `ScrollTo(target)` and `Focus(target?)`. Each is a no-op (or `undefined`/`false`) until the component has initialized (`Initialized` fires). A new `Component` input is a new version: the component reinitializes in place and `Initialized` fires again.
|
|
110
|
+
|
|
107
111
|
## Services
|
|
108
112
|
|
|
109
113
|
| Service | Purpose |
|
|
@@ -350,9 +350,12 @@ export declare class MJReactComponent extends BaseAngularComponent implements Af
|
|
|
350
350
|
*/
|
|
351
351
|
private cleanup;
|
|
352
352
|
/**
|
|
353
|
-
*
|
|
354
|
-
*
|
|
353
|
+
* Refreshes the component: calls the component's own `refresh()` when it registered one, otherwise re-renders it.
|
|
354
|
+
* Hosts that drive a component from outside (an agent operating it through a realtime channel) use this; a
|
|
355
|
+
* component that manages its own data does not need it.
|
|
355
356
|
*/
|
|
357
|
+
Refresh(): void;
|
|
358
|
+
/** @deprecated Use {@link Refresh}. */
|
|
356
359
|
refresh(): void;
|
|
357
360
|
/**
|
|
358
361
|
* Public method to update state programmatically
|
|
@@ -92,5 +92,33 @@ describe('MJReactComponent (DOM)', () => {
|
|
|
92
92
|
const container = fixture.nativeElement.querySelector('.react-component-container');
|
|
93
93
|
expect(container.classList.contains('loading')).toBe(true);
|
|
94
94
|
});
|
|
95
|
+
describe('Refresh()', () => {
|
|
96
|
+
it("calls the component's own refresh() when it registered one", () => {
|
|
97
|
+
const fixture = createFixture();
|
|
98
|
+
const internals = fixture.componentInstance;
|
|
99
|
+
const refresh = vi.fn();
|
|
100
|
+
const render = vi.fn();
|
|
101
|
+
internals.compiledComponent = { refresh };
|
|
102
|
+
internals.renderComponent = render;
|
|
103
|
+
fixture.componentInstance.Refresh();
|
|
104
|
+
expect(refresh).toHaveBeenCalledTimes(1);
|
|
105
|
+
expect(render).not.toHaveBeenCalled();
|
|
106
|
+
});
|
|
107
|
+
it('re-renders when the component has no refresh() of its own', () => {
|
|
108
|
+
const fixture = createFixture();
|
|
109
|
+
const internals = fixture.componentInstance;
|
|
110
|
+
const render = vi.fn();
|
|
111
|
+
internals.compiledComponent = {};
|
|
112
|
+
internals.renderComponent = render;
|
|
113
|
+
fixture.componentInstance.Refresh();
|
|
114
|
+
expect(render).toHaveBeenCalledTimes(1);
|
|
115
|
+
});
|
|
116
|
+
it('keeps the deprecated lowercase refresh() working by delegating to Refresh()', () => {
|
|
117
|
+
const fixture = createFixture();
|
|
118
|
+
const spy = vi.spyOn(fixture.componentInstance, 'Refresh').mockImplementation(() => undefined);
|
|
119
|
+
fixture.componentInstance.refresh();
|
|
120
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
95
123
|
});
|
|
96
124
|
//# sourceMappingURL=mj-react-component.component.dom.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mj-react-component.component.dom.test.js","sourceRoot":"","s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AC,aAAa,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;QACpF,MAAM,CAAC,SAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect, vi, beforeEach } from 'vitest';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { CommonModule } from '@angular/common';\nimport { MJReactComponent } from './mj-react-component.component';\nimport { ReactBridgeService } from '../services/react-bridge.service';\nimport { AngularAdapterService } from '../services/angular-adapter.service';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { ComponentRegistry } from '@memberjunction/react-runtime';\n\n/**\n * DOM tests for MJReactComponent.\n *\n * MJReactComponent hosts a React component compiled at runtime via @babel/standalone.\n * The real React bootstrap (ReactBridgeService.getReactContext / babel compilation /\n * reactRootManager) is NOT exercisable in jsdom and is out of scope for a DOM unit\n * test — that is the live/integration surface. What IS unit-testable is the component's\n * own Angular *template contract*: the loading-overlay gating\n * @if (!isInitialized && !hasError) { ...overlay... }\n * and the container's conditional class\n * [class.loading]=\"!isInitialized\"\n *\n * To isolate that template contract we stub ReactBridgeService at the DI seam with a\n * never-resolving getReactContext(), so ngAfterViewInit's async initializeComponent()\n * starts but never flips isInitialized — leaving the component in its deterministic\n * initial render state. The internal isInitialized / hasError state for the other two\n * states is set BEFORE the first detectChanges() per the zoneless CD rule\n * (guides/ANGULAR_TESTING_GUIDE.md §5).\n */\ndescribe('MJReactComponent (DOM)', () => {\n beforeEach(() => {\n // Never-resolving promise so initializeComponent() begins but never completes,\n // keeping the component in its initial (isInitialized=false) render state.\n const bridgeStub: Pick<ReactBridgeService, 'getReactContext' | 'waitForReactReady'> = {\n // Promise<never> never resolves AND is assignable to the methods' Promise<RuntimeContext>/Promise<void> returns.\n getReactContext: vi.fn(() => new Promise<never>(() => {})),\n waitForReactReady: vi.fn(() => new Promise<never>(() => {})),\n };\n // getRegistry() is called during ngOnDestroy -> cleanup(); return a real\n // (empty) registry so teardown's registry.cleanup() runs harmlessly.\n const registry = new ComponentRegistry();\n const adapterStub: Pick<AngularAdapterService, 'isInitialized' | 'getRegistry'> = {\n isInitialized: vi.fn(() => false),\n getRegistry: vi.fn(() => registry),\n };\n const notificationStub: Partial<MJNotificationService> = {};\n\n TestBed.configureTestingModule({\n imports: [CommonModule],\n declarations: [MJReactComponent],\n providers: [\n { provide: ReactBridgeService, useValue: bridgeStub },\n { provide: AngularAdapterService, useValue: adapterStub },\n { provide: MJNotificationService, useValue: notificationStub },\n ],\n });\n });\n\n function createFixture(): ComponentFixture<MJReactComponent> {\n return TestBed.createComponent(MJReactComponent);\n }\n\n it('renders the loading overlay and marks the container loading in the initial state', () => {\n const fixture = createFixture();\n fixture.detectChanges();\n\n const overlay = fixture.nativeElement.querySelector('.loading-overlay');\n expect(overlay).not.toBeNull();\n expect(overlay!.querySelector('.loading-spinner')).not.toBeNull();\n expect(overlay!.querySelector('.loading-text')?.textContent).toContain('Loading component');\n\n const container = fixture.nativeElement.querySelector('.react-component-container');\n expect(container).not.toBeNull();\n expect(container!.classList.contains('loading')).toBe(true);\n });\n\n it('always renders the react-component-wrapper host structure', () => {\n const fixture = createFixture();\n fixture.detectChanges();\n\n expect(fixture.nativeElement.querySelector('.react-component-wrapper')).not.toBeNull();\n // The #container ViewChild target is always present (static: true).\n expect(fixture.componentInstance.container?.nativeElement).toBeTruthy();\n });\n\n it('hides the loading overlay and clears the loading class once initialized', () => {\n const fixture = createFixture();\n // Set internal state BEFORE first CD (zoneless-safe).\n fixture.componentInstance.isInitialized = true;\n fixture.detectChanges();\n\n expect(fixture.nativeElement.querySelector('.loading-overlay')).toBeNull();\n\n const container = fixture.nativeElement.querySelector('.react-component-container');\n expect(container!.classList.contains('loading')).toBe(false);\n });\n\n it('hides the loading overlay when an error occurs (even before initialization)', () => {\n const fixture = createFixture();\n // isInitialized stays false; hasError gates the overlay off.\n fixture.componentInstance.hasError = true;\n fixture.detectChanges();\n\n expect(fixture.nativeElement.querySelector('.loading-overlay')).toBeNull();\n // Container is still in the loading (opacity:0) class because not yet initialized.\n const container = fixture.nativeElement.querySelector('.react-component-container');\n expect(container!.classList.contains('loading')).toBe(true);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"mj-react-component.component.dom.test.js","sourceRoot":"","sources":["../../../src/lib/components/mj-react-component.component.dom.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAoB,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,UAAU,CAAC,GAAG,EAAE;QACd,+EAA+E;QAC/E,2EAA2E;QAC3E,MAAM,UAAU,GAAsE;YACpF,iHAAiH;YACjH,eAAe,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAQ,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC1D,iBAAiB,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,OAAO,CAAQ,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;SAC7D,CAAC;QACF,yEAAyE;QACzE,qEAAqE;QACrE,M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YACvB,SAAS,CAAC,iBAAiB,GAAG,EAAE,CAAC;YACjC,SAAS,CAAC,eAAe,GAAG,MAAM,CAAC;YAEnC,OAAO,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;YAEpC,MAAM,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6EAA6E,EAAE,GAAG,EAAE;YACrF,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;YAChC,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAE/F,OAAO,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;YAEpC,MAAM,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect, vi, beforeEach } from 'vitest';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { CommonModule } from '@angular/common';\nimport { MJReactComponent } from './mj-react-component.component';\nimport { ReactBridgeService } from '../services/react-bridge.service';\nimport { AngularAdapterService } from '../services/angular-adapter.service';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { ComponentRegistry } from '@memberjunction/react-runtime';\n\n/**\n * DOM tests for MJReactComponent.\n *\n * MJReactComponent hosts a React component compiled at runtime via @babel/standalone.\n * The real React bootstrap (ReactBridgeService.getReactContext / babel compilation /\n * reactRootManager) is NOT exercisable in jsdom and is out of scope for a DOM unit\n * test — that is the live/integration surface. What IS unit-testable is the component's\n * own Angular *template contract*: the loading-overlay gating\n * @if (!isInitialized && !hasError) { ...overlay... }\n * and the container's conditional class\n * [class.loading]=\"!isInitialized\"\n *\n * To isolate that template contract we stub ReactBridgeService at the DI seam with a\n * never-resolving getReactContext(), so ngAfterViewInit's async initializeComponent()\n * starts but never flips isInitialized — leaving the component in its deterministic\n * initial render state. The internal isInitialized / hasError state for the other two\n * states is set BEFORE the first detectChanges() per the zoneless CD rule\n * (guides/ANGULAR_TESTING_GUIDE.md §5).\n */\ndescribe('MJReactComponent (DOM)', () => {\n beforeEach(() => {\n // Never-resolving promise so initializeComponent() begins but never completes,\n // keeping the component in its initial (isInitialized=false) render state.\n const bridgeStub: Pick<ReactBridgeService, 'getReactContext' | 'waitForReactReady'> = {\n // Promise<never> never resolves AND is assignable to the methods' Promise<RuntimeContext>/Promise<void> returns.\n getReactContext: vi.fn(() => new Promise<never>(() => {})),\n waitForReactReady: vi.fn(() => new Promise<never>(() => {})),\n };\n // getRegistry() is called during ngOnDestroy -> cleanup(); return a real\n // (empty) registry so teardown's registry.cleanup() runs harmlessly.\n const registry = new ComponentRegistry();\n const adapterStub: Pick<AngularAdapterService, 'isInitialized' | 'getRegistry'> = {\n isInitialized: vi.fn(() => false),\n getRegistry: vi.fn(() => registry),\n };\n const notificationStub: Partial<MJNotificationService> = {};\n\n TestBed.configureTestingModule({\n imports: [CommonModule],\n declarations: [MJReactComponent],\n providers: [\n { provide: ReactBridgeService, useValue: bridgeStub },\n { provide: AngularAdapterService, useValue: adapterStub },\n { provide: MJNotificationService, useValue: notificationStub },\n ],\n });\n });\n\n function createFixture(): ComponentFixture<MJReactComponent> {\n return TestBed.createComponent(MJReactComponent);\n }\n\n it('renders the loading overlay and marks the container loading in the initial state', () => {\n const fixture = createFixture();\n fixture.detectChanges();\n\n const overlay = fixture.nativeElement.querySelector('.loading-overlay');\n expect(overlay).not.toBeNull();\n expect(overlay!.querySelector('.loading-spinner')).not.toBeNull();\n expect(overlay!.querySelector('.loading-text')?.textContent).toContain('Loading component');\n\n const container = fixture.nativeElement.querySelector('.react-component-container');\n expect(container).not.toBeNull();\n expect(container!.classList.contains('loading')).toBe(true);\n });\n\n it('always renders the react-component-wrapper host structure', () => {\n const fixture = createFixture();\n fixture.detectChanges();\n\n expect(fixture.nativeElement.querySelector('.react-component-wrapper')).not.toBeNull();\n // The #container ViewChild target is always present (static: true).\n expect(fixture.componentInstance.container?.nativeElement).toBeTruthy();\n });\n\n it('hides the loading overlay and clears the loading class once initialized', () => {\n const fixture = createFixture();\n // Set internal state BEFORE first CD (zoneless-safe).\n fixture.componentInstance.isInitialized = true;\n fixture.detectChanges();\n\n expect(fixture.nativeElement.querySelector('.loading-overlay')).toBeNull();\n\n const container = fixture.nativeElement.querySelector('.react-component-container');\n expect(container!.classList.contains('loading')).toBe(false);\n });\n\n it('hides the loading overlay when an error occurs (even before initialization)', () => {\n const fixture = createFixture();\n // isInitialized stays false; hasError gates the overlay off.\n fixture.componentInstance.hasError = true;\n fixture.detectChanges();\n\n expect(fixture.nativeElement.querySelector('.loading-overlay')).toBeNull();\n // Container is still in the loading (opacity:0) class because not yet initialized.\n const container = fixture.nativeElement.querySelector('.react-component-container');\n expect(container!.classList.contains('loading')).toBe(true);\n });\n\n describe('Refresh()', () => {\n /** The private members Refresh() reads; named here so the test does not reach for `any`. */\n interface RefreshInternals {\n compiledComponent: { refresh?: () => void } | null;\n renderComponent: () => void;\n }\n\n it(\"calls the component's own refresh() when it registered one\", () => {\n const fixture = createFixture();\n const internals = fixture.componentInstance as unknown as RefreshInternals;\n const refresh = vi.fn();\n const render = vi.fn();\n internals.compiledComponent = { refresh };\n internals.renderComponent = render;\n\n fixture.componentInstance.Refresh();\n\n expect(refresh).toHaveBeenCalledTimes(1);\n expect(render).not.toHaveBeenCalled();\n });\n\n it('re-renders when the component has no refresh() of its own', () => {\n const fixture = createFixture();\n const internals = fixture.componentInstance as unknown as RefreshInternals;\n const render = vi.fn();\n internals.compiledComponent = {};\n internals.renderComponent = render;\n\n fixture.componentInstance.Refresh();\n\n expect(render).toHaveBeenCalledTimes(1);\n });\n\n it('keeps the deprecated lowercase refresh() working by delegating to Refresh()', () => {\n const fixture = createFixture();\n const spy = vi.spyOn(fixture.componentInstance, 'Refresh').mockImplementation(() => undefined);\n\n fixture.componentInstance.refresh();\n\n expect(spy).toHaveBeenCalledTimes(1);\n });\n });\n});\n"]}
|
|
@@ -1156,10 +1156,11 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
1158
|
/**
|
|
1159
|
-
*
|
|
1160
|
-
*
|
|
1159
|
+
* Refreshes the component: calls the component's own `refresh()` when it registered one, otherwise re-renders it.
|
|
1160
|
+
* Hosts that drive a component from outside (an agent operating it through a realtime channel) use this; a
|
|
1161
|
+
* component that manages its own data does not need it.
|
|
1161
1162
|
*/
|
|
1162
|
-
|
|
1163
|
+
Refresh() {
|
|
1163
1164
|
// Check if the component has registered a refresh method
|
|
1164
1165
|
if (this.compiledComponent?.refresh) {
|
|
1165
1166
|
this.compiledComponent.refresh();
|
|
@@ -1169,6 +1170,10 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1169
1170
|
this.renderComponent();
|
|
1170
1171
|
}
|
|
1171
1172
|
}
|
|
1173
|
+
/** @deprecated Use {@link Refresh}. */
|
|
1174
|
+
refresh() {
|
|
1175
|
+
this.Refresh();
|
|
1176
|
+
}
|
|
1172
1177
|
/**
|
|
1173
1178
|
* Public method to update state programmatically
|
|
1174
1179
|
* @param path - State path to update
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mj-react-component.component.js","sourceRoot":"","sources":["../../../src/lib/components/mj-react-component.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,SAAS,EACT,UAAU,EAGV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAuF,MAAM,6C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KAAK;;kBAUL,KAAK;;kBAuBL,KAAK;;kBAgCL,KAAK;;kBA4EL,KAAK;;kBAiBL,KAAK;;kBAaL,KAAK;;kBASL,KAAK;;kBAaL,KAAK;;kBAgBL,KAAK;;kBAIL,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBAEN,MAAM;;kBASN,MAAM;;kBAEN,SAAS;mBAAC,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;;kFApV/C,gBAAgB","sourcesContent":["/**\n * @fileoverview Angular component that hosts React components with proper memory management.\n * Provides a bridge between Angular and React ecosystems in MemberJunction applications.\n * @module @memberjunction/ng-react\n */\n\nimport {\n Component,\n Input,\n Output,\n EventEmitter,\n ViewChild,\n ElementRef,\n AfterViewInit,\n OnDestroy,\n ChangeDetectionStrategy,\n ChangeDetectorRef\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { ComponentSpec, ComponentCallbacks, ComponentStyles, ComponentObject, BaseEventArgs, StyleOverrides } from '@memberjunction/interactive-component-types';\nimport { ReactBridgeService } from '../services/react-bridge.service';\nimport { AngularAdapterService } from '../services/angular-adapter.service';\nimport {\n createErrorBoundary,\n ComponentHierarchyRegistrar,\n resourceManager,\n reactRootManager,\n ResolvedComponents,\n SetupStyles,\n BuildStylesFromTheme,\n ApplyStyleOverrides,\n wrapWithLibraryThemeProviders,\n ComponentRegistryService,\n resolveUserStateScope,\n userStateStorageKey,\n parseStoredUserSettings,\n mergeUserSettings,\n applyUserSettingsUpdate,\n generateComponentHierarchyHash,\n createRuntimeUtilities,\n resolveEntityRecordKey\n} from '@memberjunction/react-runtime';\nimport { LogError, CompositeKey, KeyValuePair, Metadata, RunView, RunViewParams, RunViewResult, RunQueryParams, RunQueryResult, DataSnapshot, DataTable, MJColumnDescriptor } from '@memberjunction/core';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { ComponentMetadataEngine, UserInfoEngine } from '@memberjunction/core-entities';\nimport { ComponentUtilities, SimpleRunView, SimpleRunQuery } from '@memberjunction/interactive-component-types';\n\n/**\n * A captured RunView/RunQuery result with its original parameters.\n * Used by the automatic data capture system for components that don't\n * implement getCurrentDataState().\n */\ninterface CapturedDataResult {\n /** Entity name or query name */\n sourceName: string;\n /** 'view' or 'query' */\n sourceType: 'view' | 'query';\n /** Original RunView/RunQuery params */\n params: Record<string, unknown>;\n /** Returned rows */\n rows: Record<string, unknown>[];\n /** Total available rows (may differ from rows.length due to pagination) */\n totalRows: number;\n /** When the data was fetched */\n fetchedAt: Date;\n}\n\n/**\n * Event emitted by React components\n */\nexport interface ReactComponentEvent {\n type: string;\n payload: any;\n}\n\n/**\n * State change event emitted when component state updates\n */\nexport interface StateChangeEvent {\n path: string;\n value: any;\n}\n\n/**\n * User settings changed event emitted when component saves user preferences\n */\nexport interface UserSettingsChangedEvent {\n settings: Record<string, any>;\n componentName?: string;\n timestamp: Date;\n}\n\n/**\n * Angular component that hosts React components with proper memory management.\n * This component provides a bridge between Angular and React, allowing React components\n * to be used seamlessly within Angular applications.\n */\n@Component({\n standalone: false,\n selector: 'mj-react-component',\n template: `\n <div class=\"react-component-wrapper\">\n <div #container class=\"react-component-container\" [class.loading]=\"!isInitialized\"></div>\n @if (!isInitialized && !hasError) {\n <div class=\"loading-overlay\">\n <div class=\"loading-spinner\">\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n </div>\n <div class=\"loading-text\">Loading component...</div>\n </div>\n }\n </div>\n `,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n .react-component-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n }\n .react-component-container {\n width: 100%;\n height: 100%;\n transition: opacity 0.3s ease;\n }\n .react-component-container.loading {\n opacity: 0;\n }\n .loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background-color: rgba(255, 255, 255, 0.9);\n z-index: 1;\n }\n .loading-spinner {\n font-size: 48px;\n color: #5B4FE9;\n margin-bottom: 16px;\n }\n .loading-text {\n font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", Roboto, sans-serif;\n font-size: 14px;\n color: #64748B;\n margin-top: 8px;\n }\n `],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MJReactComponent extends BaseAngularComponent implements AfterViewInit, OnDestroy {\n private _component!: ComponentSpec;\n\n /**\n * The component specification to render.\n * When this changes after initialization, the component will be reinitialized\n * to load and render the new specification.\n */\n @Input()\n set Component(value: ComponentSpec) {\n const previousComponent = this._component;\n this._component = value;\n\n // If already initialized and component spec changed, reinitialize\n if (this.IsInitialized && value && previousComponent !== value) {\n // Check if it's actually a different component (not just same reference)\n const isDifferent = !previousComponent ||\n previousComponent.name !== value.name ||\n previousComponent.code !== value.code ||\n previousComponent.version !== value.version;\n\n if (isDifferent) {\n this.reinitializeComponent();\n } else if (JSON.stringify(previousComponent.styleOverrides) !== JSON.stringify(value.styleOverrides)) {\n // Same code, new styleOverrides (a regenerated spec whose only change is the\n // requested styling): re-render in place — no teardown needed. The resolved\n // spec must be kept in step because the styleOverrides getter prefers it.\n if (this.ResolvedComponentSpec) {\n this.ResolvedComponentSpec.styleOverrides = value.styleOverrides;\n }\n this.renderComponent();\n }\n }\n }\n get Component(): ComponentSpec {\n return this._component;\n }\n\n /** @deprecated Use {@link Component}. */\n get component(): ComponentSpec {\n return this.Component;\n }\n /** @deprecated Use {@link Component}. */\n @Input() set component(value: ComponentSpec) {\n this.Component = value;\n }\n\n /**\n * Controls verbose logging for component lifecycle and operations.\n * Note: This does NOT control which React build (dev/prod) is loaded.\n * To control React builds, use ReactDebugConfig.setDebugMode() at app startup.\n */\n @Input() EnableLogging: boolean = false;\n\n /** @deprecated Use {@link EnableLogging}. */\n @Input() set enableLogging(value: boolean) {\n this.EnableLogging = value;\n }\n /** @deprecated Use {@link EnableLogging}. */\n get enableLogging(): boolean {\n return this.EnableLogging;\n }\n @Input() UseComponentManager: boolean = true;\n\n /** @deprecated Use {@link UseComponentManager}. */\n @Input() set useComponentManager(value: boolean) {\n this.UseComponentManager = value;\n }\n /** @deprecated Use {@link UseComponentManager}. */\n get useComponentManager(): boolean {\n return this.UseComponentManager;\n } // NEW: Use unified ComponentManager by default\n \n // Auto-initialize utilities if not provided\n private _utilities: any;\n @Input()\n set utilities(value: any) {\n this._utilities = value;\n }\n get utilities(): any {\n // Lazy initialization - only create default utilities when needed\n if (!this._utilities) {\n const runtimeUtils = createRuntimeUtilities();\n this._utilities = runtimeUtils.buildUtilities(this.EnableLogging, this.ProviderToUse);\n if (this.EnableLogging) {\n console.log('MJReactComponent: Auto-initialized utilities using createRuntimeUtilities()');\n }\n }\n return this._utilities;\n }\n \n // Auto-initialize styles if not provided\n private _styles?: Partial<ComponentStyles>;\n // Theme-bridge cache: the ComponentStyles derived from the live `--mj-*` theme,\n // memoized per theme key so we don't re-read getComputedStyle on every access.\n private _themeStyles?: ComponentStyles;\n private _themeStylesKey?: string;\n private themeObserver?: MutationObserver;\n @Input()\n set Styles(value: Partial<ComponentStyles> | undefined) {\n this._styles = value;\n }\n get Styles(): Partial<ComponentStyles> {\n // An explicitly-provided styles input always wins — but user-requested overrides\n // still layer on top, since they represent an explicit request rather than a theme.\n if (this._styles) {\n return this.applyStyleOverridesMemoized(this._styles);\n }\n // Otherwise bridge the host's live MJ theme (--mj-* tokens) into ComponentStyles\n // so generated components inherit the active theme — including dark mode and\n // hover/active/focus state families — instead of the frozen defaults. Memoized\n // per theme key; invalidated by the MutationObserver on data-theme changes.\n const key = this.computeThemeKey();\n if (!this._themeStyles || this._themeStylesKey !== key) {\n this._themeStyles = BuildStylesFromTheme();\n this._themeStylesKey = key;\n if (this.EnableLogging) {\n console.log(`MJReactComponent: Bridged styles from live theme (key=\"${key}\")`);\n }\n }\n // Applied outside the theme memo so the spec's overrides survive a theme flip\n // (the memo caches the theme, not the request).\n return this.applyStyleOverridesMemoized(this._themeStyles);\n }\n\n /** @deprecated Use {@link Styles}. */\n get styles(): Partial<ComponentStyles> {\n return this.Styles;\n }\n /** @deprecated Use {@link Styles}. */\n @Input() set styles(value: Partial<ComponentStyles> | undefined) {\n this.Styles = value;\n }\n\n /**\n * Explicitly user-requested styling from the spec being rendered, resolved above\n * the theme. Reads the resolved spec when available (registry components resolve\n * asynchronously) and falls back to the spec passed in.\n */\n private get styleOverrides(): StyleOverrides | undefined {\n return this.ResolvedComponentSpec?.styleOverrides ?? this._component?.styleOverrides;\n }\n\n // Memo for the override merge. ApplyStyleOverrides allocates a new object whenever\n // overrides are present, and components key effects/memos on the styles identity\n // (e.g. simple-chart tears down and rebuilds its Chart.js instance) — so the merged\n // result must be stable across reads. Keyed by reference: a theme rebuild, a new\n // styles input, or a restyled spec each produce a new ref, which is exactly when\n // the merge must re-run.\n private _mergedStylesBase?: Partial<ComponentStyles>;\n private _mergedStylesOverrides?: StyleOverrides;\n private _mergedStylesResult?: Partial<ComponentStyles>;\n\n private applyStyleOverridesMemoized(base: Partial<ComponentStyles>): Partial<ComponentStyles> {\n const overrides = this.styleOverrides;\n if (!overrides) {\n return base;\n }\n if (!this._mergedStylesResult || this._mergedStylesBase !== base || this._mergedStylesOverrides !== overrides) {\n this._mergedStylesBase = base;\n this._mergedStylesOverrides = overrides;\n this._mergedStylesResult = ApplyStyleOverrides(base, overrides);\n }\n return this._mergedStylesResult;\n }\n\n /**\n * Identifies the current theme so bridged styles can be memoized and refreshed\n * when the user's mode (`data-theme`) or the org overlay (`data-theme-overlay`)\n * changes. Non-DOM environments return a constant key.\n */\n private computeThemeKey(): string {\n if (typeof document === 'undefined') {\n return 'no-dom';\n }\n const root = document.documentElement;\n return `${root.getAttribute('data-theme') || 'light'}|${root.getAttribute('data-theme-overlay') || ''}`;\n }\n\n /**\n * Watches the document root for theme changes (`data-theme` / `data-theme-overlay`)\n * and, when the theme flips, invalidates the bridged-styles cache and re-renders so\n * the live React component picks up the new theme. No-op when styles are supplied\n * explicitly or when there is no DOM.\n */\n private setupThemeObserver(): void {\n if (this._styles || typeof MutationObserver === 'undefined' || typeof document === 'undefined') {\n return;\n }\n this.themeObserver = new MutationObserver(() => {\n const key = this.computeThemeKey();\n if (key !== this._themeStylesKey) {\n this._themeStyles = undefined;\n this._themeStylesKey = undefined;\n if (this.IsInitialized) {\n this.renderComponent();\n }\n }\n });\n this.themeObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-theme', 'data-theme-overlay'],\n });\n }\n \n private _savedUserSettings: any = {};\n @Input()\n set SavedUserSettings(value: any) {\n this._savedUserSettings = value || {};\n // Re-render if component is initialized\n if (this.IsInitialized) {\n this.renderComponent();\n }\n }\n get SavedUserSettings(): any {\n return this._savedUserSettings;\n }\n\n /** @deprecated Use {@link SavedUserSettings}. */\n get savedUserSettings(): any {\n return this.SavedUserSettings;\n }\n /** @deprecated Use {@link SavedUserSettings}. */\n @Input() set savedUserSettings(value: any) {\n this.SavedUserSettings = value;\n }\n\n /**\n * Optional explicit scope for per-user settings persistence. When omitted, the\n * scope defaults to `<namespace>/<name>` of the component spec. Settings are\n * stored per-user via `UserInfoEngine` under the key\n * `InteractiveComponents_UserState_Root/<scope>`. Provide an\n * explicit scope when a single component spec is rendered in multiple distinct\n * contexts that should NOT share preferences (e.g. the same form spec used for\n * different entities) — set it to something stable and unique per context.\n */\n @Input() UserStateScope?: string;\n\n /**\n * When `true` (default), the host transparently persists `savedUserSettings`\n * per-user, cross-device via `UserInfoEngine` — seeding the component from\n * storage on load and saving (debounced) on every `onSaveUserSettings` call,\n * auto-scoped per component. Set to `false` to opt out and own persistence\n * yourself by handling the `userSettingsChanged` output instead.\n */\n @Input() PersistUserSettings: boolean = true;\n\n /**\n * Host-supplied props spread into the React component's props alongside the\n * standard `utilities`, `callbacks`, `components`, `styles`, `libraries`, and\n * `savedUserSettings`. Used by hosts that need to push data context the React\n * component can't fetch itself — e.g. `InteractiveFormComponent` passing\n * `FormHostProps` (the current record snapshot, mode, permissions).\n *\n * Standard keys take precedence over caller-supplied keys to keep the\n * platform contract stable.\n */\n private _componentProps: object = {};\n @Input()\n set ComponentProps(value: object | undefined) {\n this._componentProps = value ?? {};\n if (this.IsInitialized) {\n this.renderComponent();\n }\n }\n get ComponentProps(): object {\n return this._componentProps;\n }\n\n /** @deprecated Use {@link ComponentProps}. */\n get componentProps(): object {\n return this.ComponentProps;\n }\n /** @deprecated Use {@link ComponentProps}. */\n @Input() set componentProps(value: object | undefined) {\n this.ComponentProps = value;\n }\n\n @Output() StateChange = new EventEmitter<StateChangeEvent>();\n\n /**\n * @deprecated Use {@link StateChange}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (stateChange) keeps working. Must stay AFTER StateChange: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() stateChange = this.StateChange;\n @Output() ComponentEvent = new EventEmitter<ReactComponentEvent>();\n\n /**\n * @deprecated Use {@link ComponentEvent}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (componentEvent) keeps working. Must stay AFTER ComponentEvent: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() componentEvent = this.ComponentEvent;\n @Output() RefreshData = new EventEmitter<void>();\n\n /**\n * @deprecated Use {@link RefreshData}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (refreshData) keeps working. Must stay AFTER RefreshData: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() refreshData = this.RefreshData;\n @Output() OpenEntityRecord = new EventEmitter<{ entityName: string; key: CompositeKey }>();\n\n /**\n * @deprecated Use {@link OpenEntityRecord}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (openEntityRecord) keeps working. Must stay AFTER OpenEntityRecord: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() openEntityRecord = this.OpenEntityRecord;\n @Output() UserSettingsChanged = new EventEmitter<UserSettingsChangedEvent>();\n\n /**\n * @deprecated Use {@link UserSettingsChanged}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (userSettingsChanged) keeps working. Must stay AFTER UserSettingsChanged: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() userSettingsChanged = this.UserSettingsChanged;\n /** Emitted once after the component successfully loads and resolvedComponentSpec is populated. */\n @Output() Initialized = new EventEmitter<void>();\n\n /**\n * @deprecated Use {@link Initialized}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (initialized) keeps working. Must stay AFTER Initialized: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() initialized = this.Initialized;\n \n @ViewChild('container', { read: ElementRef, static: true }) Container!: ElementRef<HTMLDivElement>;\n\n /** @deprecated Use {@link Container}. */\n get container(): ElementRef<HTMLDivElement> {\n return this.Container;\n }\n /** @deprecated Use {@link Container}. */\n set container(value: ElementRef<HTMLDivElement>) {\n this.Container = value;\n }\n\n // ─── Automatic data capture ───\n // Stores RunView/RunQuery results for components that don't implement getCurrentDataState().\n // Cleared on component reinitialize. Used as fallback in GetCurrentDataState().\n private capturedData: CapturedDataResult[] = [];\n\n private reactRootId: string | null = null;\n private compiledComponent: ComponentObject | null = null;\n private loadedDependencies: Record<string, ComponentObject> = {};\n private destroyed$ = new Subject<void>();\n private currentCallbacks: ComponentCallbacks | null = null;\n IsInitialized = false;\n\n /** @deprecated Use {@link IsInitialized}. */\n get isInitialized() {\n return this.IsInitialized;\n }\n /** @deprecated Use {@link IsInitialized}. */\n set isInitialized(value) {\n this.IsInitialized = value;\n }\n private isRendering = false;\n private pendingRender = false;\n private isDestroying = false;\n private componentId: string;\n private componentVersion: string = ''; // Store the version for resolver\n HasError = false;\n\n /** @deprecated Use {@link HasError}. */\n get hasError() {\n return this.HasError;\n }\n /** @deprecated Use {@link HasError}. */\n set hasError(value) {\n this.HasError = value;\n }\n \n /**\n * Public property containing the fully resolved component specification.\n * This includes all external code fetched from registries, allowing consumers\n * to inspect the complete resolved specification including dependencies.\n * Only populated after successful component initialization.\n */\n public ResolvedComponentSpec: ComponentSpec | null = null;\n\n /** @deprecated Use {@link ResolvedComponentSpec}. */\n public get resolvedComponentSpec(): ComponentSpec | null {\n return this.ResolvedComponentSpec;\n }\n /** @deprecated Use {@link ResolvedComponentSpec}. */\n public set resolvedComponentSpec(value: ComponentSpec | null) {\n this.ResolvedComponentSpec = value;\n }\n\n constructor(\n private reactBridge: ReactBridgeService,\n private adapter: AngularAdapterService,\n private cdr: ChangeDetectorRef,\n private notificationService: MJNotificationService\n ) {\n super();\n // Generate unique component ID for resource tracking\n this.componentId = `mj-react-component-${Date.now()}-${Math.random()}`;\n }\n\n async ngAfterViewInit() {\n // Try to get registry size safely\n let registrySize = 'N/A';\n try {\n if (this.adapter.isInitialized()) {\n registrySize = this.adapter.getRegistry().size().toString();\n } else {\n registrySize = 'Not initialized yet';\n }\n } catch (e) {\n registrySize = 'Not available';\n }\n \n console.log(`🎬 [ngAfterViewInit] Starting component initialization:`, {\n componentId: this.componentId,\n componentName: this.Component?.name,\n timestamp: new Date().toISOString(),\n registrySize: registrySize\n });\n \n // Trigger change detection to show loading state\n this.cdr.detectChanges();\n // Refresh bridged theme styles when the user's mode / org overlay changes.\n this.setupThemeObserver();\n await this.initializeComponent();\n }\n\n ngOnDestroy() {\n // Set destroying flag immediately\n this.isDestroying = true;\n\n // Cancel any pending renders\n this.pendingRender = false;\n\n this.themeObserver?.disconnect();\n this.themeObserver = undefined;\n\n this.destroyed$.next();\n this.destroyed$.complete();\n this.cleanup();\n }\n\n /**\n * Reinitialize the component when the input spec changes.\n * Cleans up the current component and initializes with the new spec.\n */\n private async reinitializeComponent() {\n // Don't reinitialize if we're being destroyed\n if (this.isDestroying) {\n return;\n }\n\n // Clear cached state from previous component\n this.compiledComponent = null;\n this.ResolvedComponentSpec = null;\n this.loadedDependencies = {};\n this.componentVersion = '';\n this.HasError = false;\n this.IsInitialized = false;\n this.capturedData = [];\n\n // Unmount existing React root if present\n if (this.reactRootId) {\n this.isRendering = false;\n this.pendingRender = false;\n reactRootManager.unmountRoot(this.reactRootId);\n this.reactRootId = null;\n }\n\n // Trigger change detection to show loading state\n this.cdr.detectChanges();\n\n // Initialize with the new component spec\n await this.initializeComponent();\n }\n\n /**\n * Initialize the React component\n */\n private async initializeComponent() {\n try {\n // Ensure React is loaded\n await this.reactBridge.getReactContext();\n\n // Wait for React to be fully ready (handles first-load delay)\n await this.reactBridge.waitForReactReady();\n\n // NEW: Use ComponentManager if enabled (default: true)\n if (this.UseComponentManager) {\n console.log(`🎯 [initializeComponent] Using NEW ComponentManager approach`);\n await this.loadComponentWithManager();\n \n // Component is already compiled and stored in this.compiledComponent\n // No need to fetch from registry - it's already set\n } else {\n console.log(`📦 [initializeComponent] Using legacy approach (will be deprecated)`);\n // Register component hierarchy (this compiles and registers all components including from registries)\n await this.registerComponentHierarchy();\n \n // The resolved spec should now be available from the registration result\n // No need to fetch again\n \n // Get the already-registered component from the registry\n const registry = this.adapter.getRegistry();\n \n console.log(`🔍 [initializeComponent] Looking for component in registry:`, {\n name: this.Component.name,\n namespace: this.Component.namespace || 'Global',\n version: this.componentVersion\n });\n \n // Let's also check what's actually in the registry\n // Note: ComponentRegistry doesn't have a list() method, so we'll skip this for now\n \n const componentWrapper = registry.get(\n this.Component.name, \n this.Component.namespace || 'Global', \n this.componentVersion\n );\n \n console.log(`🔍 [initializeComponent] Registry.get result:`, {\n found: !!componentWrapper,\n type: componentWrapper ? typeof componentWrapper : 'undefined',\n hasComponent: componentWrapper ? !!componentWrapper.component : false\n });\n \n if (!componentWrapper) {\n const source = this.Component.registry ? `external registry ${this.Component.registry}` : 'local registry';\n console.error(`❌ [initializeComponent] Component not found! Details:`, {\n searchedName: this.Component.name,\n searchedNamespace: this.Component.namespace || 'Global',\n searchedVersion: this.componentVersion,\n source: source\n });\n throw new Error(`Component ${this.Component.name} was not found in registry after registration from ${source}`);\n }\n \n // The registry now stores ComponentObjects directly\n // Validate it has the expected structure\n if (!componentWrapper || typeof componentWrapper !== 'object') {\n throw new Error(`Invalid component wrapper returned for ${this.Component.name}: ${typeof componentWrapper}`);\n }\n \n if (!componentWrapper.component) {\n throw new Error(`Component wrapper missing 'component' property for ${this.Component.name}`);\n }\n \n // Now that we use a regular HOC wrapper, components should always be functions\n if (typeof componentWrapper.component !== 'function') {\n throw new Error(`Component is not a function for ${this.Component.name}: ${typeof componentWrapper.component}`);\n }\n \n this.compiledComponent = componentWrapper;\n } // End of else block for legacy approach\n \n // Create managed React root\n const reactContext = this.reactBridge.getCurrentContext();\n if (!reactContext) {\n throw new Error('React context not available');\n }\n \n this.reactRootId = reactRootManager.createRoot(\n this.Container.nativeElement,\n (container: HTMLElement) => reactContext.ReactDOM.createRoot(container),\n this.componentId\n );\n\n // Seed savedUserSettings from durable per-user storage before the first\n // render so the component mounts with the user's persisted preferences.\n await this.seedUserSettingsFromStore();\n\n // Initial render\n this.renderComponent();\n this.IsInitialized = true;\n\n // Trigger change detection since we're using OnPush\n this.cdr.detectChanges();\n\n // Notify parent that the component has successfully initialized and\n // resolvedComponentSpec is now populated with the full spec from the registry\n this.Initialized.emit();\n\n } catch (error) {\n this.HasError = true;\n LogError(`Failed to initialize React component: ${error}`);\n this.ComponentEvent.emit({\n type: 'error',\n payload: {\n error: error instanceof Error ? error.message : String(error),\n source: 'initialization'\n }\n });\n // Trigger change detection to show error state\n this.cdr.detectChanges();\n }\n }\n \n\n /**\n * Generate a hash from component code for versioning.\n *\n * Delegates to the runtime so every host derives the same version for the same spec. When this\n * lived here, the React Native app had to reimplement it to load the same component, and two\n * implementations of a registry key is how one surface silently compiles a second copy of a\n * component the other already has.\n */\n private generateComponentHash(spec: ComponentSpec): string {\n return generateComponentHierarchyHash(spec);\n }\n\n /**\n * Resolve components using the runtime's resolver\n */\n private async resolveComponentsWithVersion(spec: ComponentSpec, version: string, namespace: string = 'Global'): Promise<ResolvedComponents> {\n const resolver = this.adapter.getResolver();\n \n // Debug: Log what dependencies we're trying to resolve\n if (this.EnableLogging) {\n console.log(`Resolving components for ${spec.name}. Dependencies:`, spec.dependencies);\n }\n \n // Use the runtime's resolver which now handles registry-based components\n const resolved = await resolver.resolveComponents(\n spec, \n namespace,\n this.ProviderToUse.CurrentUser // Pass current user context for database operations\n );\n \n if (this.EnableLogging) {\n console.log(`Resolved ${Object.keys(resolved).length} components for version ${version}:`, Object.keys(resolved));\n }\n return resolved;\n }\n\n\n /**\n * NEW: Load component using unified ComponentManager - MUCH SIMPLER!\n */\n private async loadComponentWithManager() {\n try {\n const manager = this.adapter.getComponentManager();\n \n console.log(`🚀 [ComponentManager] Loading component hierarchy: ${this.Component.name}`);\n \n // Load the entire hierarchy with one simple call\n const result = await manager.loadHierarchy(this.Component, {\n contextUser: this.ProviderToUse.CurrentUser,\n defaultNamespace: 'Global',\n defaultVersion: this.Component.version || this.generateComponentHash(this.Component),\n returnType: 'both'\n });\n \n if (!result.success) {\n const errorMessages = result.errors.map(e => `${e.componentName}: ${e.message}`).join(', ');\n console.error(`❌ [ComponentManager] Failed to load hierarchy:`, errorMessages);\n throw new Error(`Component loading failed: ${errorMessages}`);\n }\n \n // Store the results (handle undefined values)\n this.ResolvedComponentSpec = this.enrichSpecWithRegistryInfo(result.resolvedSpec || null);\n this.compiledComponent = result.rootComponent || null;\n this.componentVersion = result.resolvedSpec?.version || this.Component.version || 'latest';\n \n // IMPORTANT: Store the loaded dependencies for use in renderComponent\n this.loadedDependencies = result.components || {};\n \n console.log(`✅ [ComponentManager] Successfully loaded hierarchy:`, {\n rootComponent: result.resolvedSpec?.name,\n loadedCount: result.loadedComponents.length,\n dependencies: Object.keys(this.loadedDependencies),\n stats: result.stats\n });\n \n // Component is ready to render\n return true;\n \n } catch (error) {\n console.error(`❌ [ComponentManager] Error loading component:`, error);\n throw error;\n }\n }\n\n /**\n * Register all components in the hierarchy\n * @deprecated Use loadComponentWithManager() instead\n */\n private async registerComponentHierarchy() {\n // Use semantic version from spec or generate hash-based version for uniqueness\n const version = this.Component.version || this.generateComponentHash(this.Component);\n this.componentVersion = version; // Store for use in resolver\n \n console.log(`🔍 [registerComponentHierarchy] Starting registration for ${this.Component.name}@${version}`, {\n location: this.Component.location,\n registry: this.Component.registry,\n namespace: this.Component.namespace,\n hasCode: !!this.Component.code,\n codeLength: this.Component.code?.length || 0\n });\n \n // Check if already registered to avoid duplication\n const registry = this.adapter.getRegistry();\n const checkNamespace = this.Component.namespace || 'Global';\n \n console.log(`🔍 [registerComponentHierarchy] Checking registry for existing component:`, {\n name: this.Component.name,\n namespace: checkNamespace,\n version: version,\n registrySize: registry.size(),\n registryId: registry.registryId || 'unknown'\n });\n \n // Log registry state for debugging\n console.log(`📦 [registerComponentHierarchy] Registry state:`, {\n totalSize: registry.size(),\n registryInstance: registry.registryId || 'unknown'\n });\n \n const existingComponent = registry.get(this.Component.name, checkNamespace, version);\n \n if (existingComponent) {\n console.log(`⚠️ [registerComponentHierarchy] Component ${this.Component.name}@${version} already registered!`, {\n existingType: typeof existingComponent,\n hasComponent: !!(existingComponent as any).component,\n registrationTime: (existingComponent as any).registeredAt || 'unknown',\n runtimeContextLibraries: Object.keys(this.adapter.getRuntimeContext().libraries || {})\n });\n \n // For registry components, we need to check the resolved spec's libraries, not the input spec\n // The input spec from Angular doesn't have library information for registry components\n if (this.Component.location === 'registry' && this.Component.registry) {\n console.log(`📋 [registerComponentHierarchy] Component is from registry, need to fetch full spec to check libraries`);\n // Continue to fetch the full spec below - don't return early\n } else {\n // For local components, check using the input spec\n const requiredLibraries = this.Component.libraries || [];\n const runtimeLibraries = this.adapter.getRuntimeContext().libraries || {};\n const missingLibraries = requiredLibraries.filter(lib => !runtimeLibraries[lib.globalVariable]);\n \n if (missingLibraries.length > 0) {\n console.warn(`⚠️ [registerComponentHierarchy] Component registered but libraries missing:`, {\n required: requiredLibraries.map(l => l.globalVariable),\n loaded: Object.keys(runtimeLibraries),\n missing: missingLibraries.map(l => l.globalVariable)\n });\n // Don't return early - continue to load libraries\n } else {\n console.log(`✅ [registerComponentHierarchy] Component ${this.Component.name}@${version} already registered with all libraries, skipping`);\n return;\n }\n }\n } else {\n console.log(`🆕 [registerComponentHierarchy] Component not found in registry, proceeding with registration`);\n }\n \n // Initialize metadata engine\n await ComponentMetadataEngine.Instance.Config(false, this.ProviderToUse.CurrentUser);\n \n // Use the runtime's hierarchy registrar\n const registrar = new ComponentHierarchyRegistrar(\n this.adapter.getCompiler(),\n this.adapter.getRegistry(),\n this.adapter.getRuntimeContext()\n );\n \n console.log(`📦 [registerComponentHierarchy] Calling registrar.registerHierarchy for ${this.Component.name}`, {\n hasStyles: !!this.Styles,\n namespace: this.Component.namespace || 'Global',\n version: version,\n libraryCount: ComponentMetadataEngine.Instance.ComponentLibraries?.length || 0,\n hasCode: !!this.Component.code,\n codeLength: this.Component.code?.length || 0\n });\n \n // Register with proper configuration\n // Pass the partial spec - the React runtime will handle fetching from registries\n const result = await registrar.registerHierarchy(\n this.Component, // Pass the original spec, not fetched\n {\n styles: this.Styles as ComponentStyles,\n namespace: this.Component.namespace || 'Global',\n version: version,\n allowOverride: false, // Each version is unique\n allLibraries: ComponentMetadataEngine.Instance.ComponentLibraries,\n debug: true,\n contextUser: this.ProviderToUse.CurrentUser\n }\n );\n \n if (!result.success) {\n const errors = result.errors.map(e => e.error).join(', ');\n console.error(`❌ [registerComponentHierarchy] Registration failed:`, errors);\n throw new Error(`Component registration failed: ${errors}`);\n }\n \n // Store the resolved spec from the registration result\n if (result.resolvedSpec) {\n this.ResolvedComponentSpec = this.enrichSpecWithRegistryInfo(result.resolvedSpec || null);\n console.log(`📋 [registerComponentHierarchy] Received resolved spec from runtime:`, {\n name: result.resolvedSpec.name,\n hasCode: !!result.resolvedSpec.code,\n libraryCount: result.resolvedSpec.libraries?.length || 0,\n dependencyCount: result.resolvedSpec.dependencies?.length || 0\n });\n }\n \n console.log(`✅ [registerComponentHierarchy] Successfully registered ${result.registeredComponents.length} components:`, result.registeredComponents);\n \n // Verify the component is actually in the registry\n const verifyComponent = registry.get(this.Component.name, this.Component.namespace || 'Global', version);\n console.log(`🔍 [registerComponentHierarchy] Verification - component in registry after registration:`, {\n found: !!verifyComponent,\n name: this.Component.name,\n namespace: this.Component.namespace || 'Global',\n version: version,\n componentType: verifyComponent ? typeof verifyComponent : 'not found'\n });\n }\n\n /**\n * Post-process resolved spec to ensure all components show their true registry source.\n * This enriches the spec for UI display purposes to show where components actually came from.\n * Applied to all resolved specs so any consumer of this wrapper benefits.\n */\n private enrichSpecWithRegistryInfo(spec: ComponentSpec | null): ComponentSpec | null {\n if (!spec || !this.Component) return spec;\n \n // Create a deep copy to avoid mutating the original\n const enrichedSpec = JSON.parse(JSON.stringify(spec));\n \n // Recursive function to process spec and all dependencies\n // Takes the original spec at the same level to find registry info\n const processSpec = (currentSpec: ComponentSpec, originalSpec: ComponentSpec) => {\n // If this component has code but shows location as 'embedded', \n // check the original spec to see where it came from\n if (currentSpec.code && currentSpec.location === 'embedded' && currentSpec.name) {\n // Try to find this component in the original spec at the same level\n // First check if the original spec itself matches by name\n if (originalSpec.name === currentSpec.name) {\n // Use the original's registry info if it had any\n if (originalSpec.location === 'registry' || originalSpec.registry) {\n currentSpec.location = 'registry';\n if (originalSpec.registry) {\n currentSpec.registry = originalSpec.registry;\n }\n if (originalSpec.namespace) {\n currentSpec.namespace = originalSpec.namespace;\n }\n }\n }\n \n // Also check in original's dependencies for a match\n if (originalSpec.dependencies) {\n const originalDep = originalSpec.dependencies.find(d => d.name === currentSpec.name);\n if (originalDep && (originalDep.location === 'registry' || originalDep.registry)) {\n currentSpec.location = 'registry';\n if (originalDep.registry) {\n currentSpec.registry = originalDep.registry;\n }\n if (originalDep.namespace) {\n currentSpec.namespace = originalDep.namespace;\n }\n }\n }\n }\n \n // Process all dependencies recursively\n if (currentSpec.dependencies && Array.isArray(currentSpec.dependencies)) {\n currentSpec.dependencies.forEach((dep, index) => {\n // Find the corresponding original dependency by name or use the one at same index\n let originalDep = originalSpec.dependencies?.find(d => d.name === dep.name);\n if (!originalDep && originalSpec.dependencies && index < originalSpec.dependencies.length) {\n originalDep = originalSpec.dependencies[index];\n }\n if (originalDep) {\n processSpec(dep, originalDep);\n }\n });\n }\n };\n \n processSpec(enrichedSpec, this.Component);\n return enrichedSpec;\n }\n\n /**\n * Render the React component\n */\n private async renderComponent() {\n // Don't render if component is being destroyed\n if (this.isDestroying) {\n return;\n }\n \n if (!this.compiledComponent || !this.reactRootId) {\n return;\n }\n\n // Prevent concurrent renders\n if (this.isRendering) {\n this.pendingRender = true;\n return;\n }\n\n const context = this.reactBridge.getCurrentContext();\n if (!context) {\n return;\n }\n\n this.isRendering = true;\n const { React } = context;\n \n // Resolve components with the correct version using runtime's resolver\n // SKIP this if using ComponentManager - components are already loaded!\n let components = {};\n if (!this.UseComponentManager) {\n components = await this.resolveComponentsWithVersion(this.Component, this.componentVersion);\n } else {\n // Use the dependencies that were already loaded and unwrapped by ComponentManager\n components = this.loadedDependencies;\n console.log(`🎯 [renderComponent] Using dependencies from ComponentManager:`, Object.keys(components));\n }\n \n // Create callbacks once per component instance\n if (!this.currentCallbacks) {\n this.currentCallbacks = this.createCallbacks();\n }\n \n // Get libraries from runtime context\n const runtimeContext = this.adapter.getRuntimeContext();\n const libraries = runtimeContext.libraries || {};\n \n // Build props — wrap utilities with data capture for fallback snapshot support.\n // Host-supplied componentProps spread first so platform-provided keys\n // (utilities, callbacks, components, styles, libraries, savedUserSettings,\n // onSaveUserSettings) always win — the contract stays stable regardless of\n // what a host passes in.\n const wrappedUtilities = this.wrapUtilitiesWithCapture(this.utilities);\n const props = {\n ...this._componentProps,\n utilities: wrappedUtilities,\n callbacks: this.currentCallbacks,\n components,\n styles: this.Styles as any,\n libraries, // Pass the loaded libraries to components\n savedUserSettings: this._savedUserSettings,\n onSaveUserSettings: this.handleSaveUserSettings.bind(this)\n };\n\n // Validate component before creating element\n if (!this.compiledComponent.component) {\n LogError(`Component is undefined for ${this.Component.name} during render`);\n return;\n }\n \n // Components should be functions after HOC wrapping\n if (typeof this.compiledComponent.component !== 'function') {\n LogError(`Component is not a function for ${this.Component.name}: ${typeof this.compiledComponent.component}`);\n return;\n }\n\n // Create error boundary\n const ErrorBoundary = createErrorBoundary(React, {\n onError: this.handleReactError.bind(this),\n logErrors: true,\n recovery: 'retry'\n });\n\n // Create element with error boundary. Auto-theme component libraries (antd) from\n // the live MJ theme by wrapping the mounted tree in their theme provider — antd\n // components don't read styles.* on their own and would otherwise render in their\n // built-in light theme even in dark mode. One wrap themes every antd component in\n // the subtree; no-op when antd isn't loaded.\n const themedComponent = wrapWithLibraryThemeProviders(\n React,\n React.createElement(this.compiledComponent.component, props),\n libraries,\n this.Styles as ComponentStyles\n );\n const element = React.createElement(\n ErrorBoundary,\n null,\n themedComponent\n );\n\n // Render with timeout protection using resource manager\n const timeoutId = resourceManager.setTimeout(\n this.componentId,\n () => {\n // Check if still rendering and not destroyed\n if (this.isRendering && !this.isDestroying) {\n this.ComponentEvent.emit({\n type: 'error',\n payload: {\n error: 'Component render timeout - possible infinite loop detected',\n source: 'render'\n }\n });\n }\n },\n 5000,\n { purpose: 'render-timeout-protection' }\n );\n\n // Use managed React root for rendering\n reactRootManager.render(\n this.reactRootId,\n element,\n () => {\n // Clear the timeout as render completed\n resourceManager.clearTimeout(this.componentId, timeoutId);\n \n // Don't update state if component is destroyed\n if (this.isDestroying) {\n return;\n }\n \n this.isRendering = false;\n \n // If there was a pending render request, execute it now\n if (this.pendingRender) {\n this.pendingRender = false;\n this.renderComponent();\n }\n }\n );\n }\n\n /**\n * Create callbacks for the React component\n */\n private createCallbacks(): ComponentCallbacks {\n return {\n RegisterMethod: (_methodName: string, _handler: any) => {\n // The component compiler wrapper will handle this internally\n // This is just a placeholder to satisfy the interface\n // The actual registration happens in the wrapper component\n },\n CreateSimpleNotification: (message: string, style: \"none\" | \"success\" | \"error\" | \"warning\" | \"info\", hideAfter?: number) => {\n // Use the MJ notification service to display the notification\n const notificationStyle = style as \"none\" | \"success\" | \"error\" | \"warning\" | \"info\" | undefined;\n this.notificationService.CreateSimpleNotification(\n message, \n style, \n hideAfter\n );\n },\n OpenEntityRecord: async (entityName: string, key: CompositeKey) => {\n // Shape coercion and the non-primary-key lookup both live in the runtime now, so the\n // React Native host resolves a component's key exactly the way this one does. What stays\n // here is the only part that is Angular's: what \"open\" means.\n const keyToUse = await resolveEntityRecordKey(entityName, key, this.ProviderToUse);\n if (keyToUse) {\n this.OpenEntityRecord.emit({ entityName, key: keyToUse });\n }\n },\n NotifyEvent: async (eventName: string, args: BaseEventArgs) => {\n this.ComponentEvent.emit({ type: eventName, payload: args });\n }\n };\n }\n\n /**\n * Handle React component errors\n */\n private handleReactError(error: any, errorInfo?: any) {\n LogError(`React component error: ${error?.toString() || 'Unknown error'}`, errorInfo);\n this.ComponentEvent.emit({\n type: 'error',\n payload: {\n error: error?.toString() || 'Unknown error',\n errorInfo,\n source: 'react'\n }\n });\n }\n\n /**\n * Handle onSaveUserSettings from components.\n *\n * This implements the SavedUserSettings pattern: the component owns its single\n * settings object and hands us the full latest copy whenever it changes. We\n * (1) **merge** the payload over our in-memory snapshot so any future re-render\n * passes the latest values, (2) persist the merged snapshot per-user via\n * UserInfoEngine (debounced, auto-scoped) unless the host opted out, and\n * (3) still bubble the event up for any parent container that wants to observe\n * changes — carrying the merged snapshot, so observers and storage agree.\n *\n * Merge (not replace) makes the host resilient to a component passing only the\n * changed keys, and to the stale-prop case: we deliberately never re-render on\n * save, so the `savedUserSettings` prop a component spreads is frozen at mount\n * and would otherwise lose earlier same-session changes. Removing a key\n * requires explicit intent — set it to `null` (see applyUserSettingsUpdate).\n */\n private handleSaveUserSettings(newSettings: Record<string, any>) {\n // Keep our snapshot current WITHOUT going through the setter (which would\n // re-render). The component already holds the correct state — it's the one\n // that told us about the change — so re-rendering would only cause flicker.\n this._savedUserSettings = applyUserSettingsUpdate(this._savedUserSettings, newSettings);\n\n // Durably persist the latest settings for this user, scoped to this component.\n this.persistUserSettings(this._savedUserSettings);\n\n // Bubble the event up to parent containers (back-compat; no consumer required).\n this.UserSettingsChanged.emit({\n settings: this._savedUserSettings,\n componentName: this.Component?.name,\n timestamp: new Date()\n });\n }\n\n /**\n * Resolve the durable storage key for this component's per-user settings, or\n * null when persistence is disabled or no stable scope can be derived.\n */\n private getUserStateStorageKey(): string | null {\n if (!this.PersistUserSettings) {\n return null;\n }\n const scope = resolveUserStateScope(\n this.UserStateScope,\n this._component?.namespace,\n this._component?.name\n );\n return userStateStorageKey(scope);\n }\n\n /**\n * Seed `savedUserSettings` from durable per-user storage (UserInfoEngine),\n * merging stored values over any host-provided defaults (stored wins). Best\n * effort — any failure leaves the host-provided / empty settings in place.\n */\n private async seedUserSettingsFromStore(): Promise<void> {\n const key = this.getUserStateStorageKey();\n if (!key) {\n return;\n }\n try {\n const provider = this.ProviderToUse;\n const user = provider?.CurrentUser;\n if (!user) {\n return; // No user context — cannot scope settings to a user.\n }\n // Idempotent: a no-op when the engine is already loaded for this user.\n await UserInfoEngine.Instance.Config(false, user, provider);\n const stored = parseStoredUserSettings(UserInfoEngine.Instance.GetSetting(key));\n this._savedUserSettings = mergeUserSettings(this._savedUserSettings, stored);\n } catch (error) {\n if (this.EnableLogging) {\n console.warn('MJReactComponent: failed to seed user settings from store', error);\n }\n }\n }\n\n /**\n * Persist the component's settings object for the current user (debounced,\n * cross-device). Best effort — failures are logged when logging is enabled and\n * never surfaced to the component.\n */\n private persistUserSettings(settings: Record<string, any> | string): void {\n const key = this.getUserStateStorageKey();\n if (!key) {\n return;\n }\n try {\n const provider = this.ProviderToUse;\n const user = provider?.CurrentUser;\n if (!user) {\n return;\n }\n // The component normally hands us an object, but guard against a caller\n // that already serialized it — double-stringifying would store a quoted\n // JSON string the seed path could not parse back into settings.\n const serialized = typeof settings === 'string' ? settings : JSON.stringify(settings);\n UserInfoEngine.Instance.SetSettingDebounced(key, serialized, user);\n } catch (error) {\n if (this.EnableLogging) {\n console.warn('MJReactComponent: failed to persist user settings', error);\n }\n }\n }\n\n // =================================================================\n // Automatic Data Capture — intercept RunView/RunQuery for fallback\n // =================================================================\n\n /**\n * Wraps a ComponentUtilities object so that every RunView / RunViews / RunQuery\n * call transparently stores the result in `this.capturedData`. The wrapped\n * object is referentially distinct from the original and is safe to pass to\n * multiple renders (results accumulate until the component resets).\n */\n private wrapUtilitiesWithCapture(original: ComponentUtilities): ComponentUtilities {\n const self = this;\n const wrappedRv: SimpleRunView = {\n RunView: async (params: RunViewParams, contextUser?: unknown) => {\n const result = await original.rv.RunView(params, contextUser as undefined);\n if (result?.Success) {\n self.capturedData.push({\n sourceName: String(params.EntityName ?? params.ExtraFilter ?? 'Unknown'),\n sourceType: 'view',\n params: params as unknown as Record<string, unknown>,\n rows: result.Results ?? [],\n totalRows: result.TotalRowCount ?? result.Results?.length ?? 0,\n fetchedAt: new Date()\n });\n }\n return result;\n },\n RunViews: async (params: RunViewParams[], contextUser?: unknown) => {\n const results = await original.rv.RunViews(params, contextUser as undefined);\n results.forEach((result: RunViewResult, i: number) => {\n if (result?.Success) {\n self.capturedData.push({\n sourceName: String(params[i]?.EntityName ?? `View ${i}`),\n sourceType: 'view',\n params: params[i] as unknown as Record<string, unknown>,\n rows: result.Results ?? [],\n totalRows: result.TotalRowCount ?? result.Results?.length ?? 0,\n fetchedAt: new Date()\n });\n }\n });\n return results;\n }\n };\n\n const wrappedRq: SimpleRunQuery = {\n RunQuery: async (params: RunQueryParams, contextUser?: unknown) => {\n const result = await original.rq.RunQuery(params, contextUser as undefined);\n if (result?.Success) {\n self.capturedData.push({\n sourceName: String(params.QueryID ?? params.QueryName ?? 'Query'),\n sourceType: 'query',\n params: params as unknown as Record<string, unknown>,\n rows: (result.Results ?? []) as Record<string, unknown>[],\n totalRows: result.TotalRowCount ?? result.Results?.length ?? 0,\n fetchedAt: new Date()\n });\n }\n return result;\n }\n };\n\n return {\n ...original,\n rv: wrappedRv,\n rq: wrappedRq\n };\n }\n\n /**\n * Builds a DataSnapshot from captured RunView/RunQuery results.\n * Returns null if no data was captured.\n */\n private buildCapturedDataSnapshot(): DataSnapshot | null {\n if (this.capturedData.length === 0) return null;\n\n const tables: DataTable[] = this.capturedData.map((captured, idx) => {\n const table = new DataTable();\n table.name = captured.sourceName || `Table ${idx + 1}`;\n table.source = captured.sourceType;\n table.rows = captured.rows;\n // Infer columns from the first row's keys\n if (captured.rows.length > 0) {\n const firstRow = captured.rows[0];\n table.columns = Object.keys(firstRow).map(key => {\n const col = new MJColumnDescriptor(key);\n col.displayName = key;\n const val = firstRow[key];\n if (typeof val === 'number') col.sqlBaseType = 'float';\n else if (val instanceof Date) col.sqlBaseType = 'datetime';\n else col.sqlBaseType = 'nvarchar';\n return col;\n });\n }\n table.metadata = {\n entityName: captured.sourceType === 'view' ? captured.sourceName : undefined,\n rowCount: captured.rows.length,\n totalAvailableRows: captured.totalRows,\n fetchedAt: captured.fetchedAt\n };\n return table;\n });\n\n return DataSnapshot.FromTables(tables, this.Component?.title ?? this.Component?.name);\n }\n\n /**\n * Clean up resources\n */\n private cleanup() {\n // Clean up all resources managed by resource manager\n resourceManager.cleanupComponent(this.componentId);\n \n // Clean up prop builder subscriptions\n if (this.currentCallbacks) {\n this.currentCallbacks = null;\n }\n \n // Unmount React root using managed unmount\n if (this.reactRootId) {\n // Force stop rendering flags\n this.isRendering = false;\n this.pendingRender = false;\n \n // This will handle waiting for render completion if needed\n reactRootManager.unmountRoot(this.reactRootId);\n this.reactRootId = null;\n }\n\n // Clear references\n this.compiledComponent = null;\n this.IsInitialized = false;\n this.capturedData = [];\n\n // Trigger registry cleanup (guard: adapter may not be initialized if\n // React bootstrap failed or was destroyed during retry)\n if (this.adapter.isInitialized()) {\n this.adapter.getRegistry().cleanup();\n }\n }\n\n /**\n * Public method to refresh the component\n * @deprecated Components manage their own state and data now\n */\n refresh() {\n // Check if the component has registered a refresh method\n if (this.compiledComponent?.refresh) {\n this.compiledComponent.refresh();\n } else {\n // Fallback: trigger a re-render if needed\n this.renderComponent();\n }\n }\n\n /**\n * Public method to update state programmatically\n * @param path - State path to update\n * @param value - New value\n * @deprecated Components manage their own state now\n */\n updateState(path: string, value: any) {\n // Just emit the event, don't manage state here\n this.StateChange.emit({ path, value });\n }\n\n // =================================================================\n // Standard Component Methods - Strongly Typed\n // =================================================================\n \n /**\n * Gets the current data state of the component.\n * Tries the component's explicit implementation first, then falls back\n * to a DataSnapshot built from intercepted RunView/RunQuery results.\n */\n getCurrentDataState(): DataSnapshot | undefined { // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope\n const explicit = this.compiledComponent?.getCurrentDataState?.();\n if (explicit && typeof explicit === 'object') return explicit;\n return this.buildCapturedDataSnapshot() ?? undefined;\n }\n \n /**\n * Validates the current state of the component\n * @returns true if valid, false or validation errors otherwise\n */\n validate(): boolean | { valid: boolean; errors?: string[] } {\n return this.compiledComponent?.validate?.() || true;\n }\n \n /**\n * Checks if the component has unsaved changes\n * @returns true if dirty, false otherwise\n */\n IsDirty(): boolean {\n return this.compiledComponent?.isDirty?.() || false;\n }\n\n /** @deprecated Use {@link IsDirty}. */\n isDirty(): boolean {\n return this.IsDirty();\n }\n \n /**\n * Resets the component to its initial state\n */\n Reset(): void {\n this.compiledComponent?.reset?.();\n }\n\n /** @deprecated Use {@link Reset}. */\n reset(): void {\n return this.Reset();\n }\n \n /**\n * Scrolls to a specific element or position within the component\n * @param target - Element selector, element reference, or scroll options\n */\n ScrollTo(target: string | HTMLElement | { top?: number; left?: number }): void {\n this.compiledComponent?.scrollTo?.(target);\n }\n\n /** @deprecated Use {@link ScrollTo}. */\n scrollTo(target: string | HTMLElement | { top?: number; left?: number }): void {\n return this.ScrollTo(target);\n }\n \n /**\n * Sets focus to a specific element within the component\n * @param target - Element selector or element reference\n */\n Focus(target?: string | HTMLElement): void {\n this.compiledComponent?.focus?.(target);\n }\n\n /** @deprecated Use {@link Focus}. */\n focus(target?: string | HTMLElement): void {\n return this.Focus(target);\n }\n \n /**\n * Invokes a custom method on the component\n * @param methodName - Name of the method to invoke\n * @param args - Arguments to pass to the method\n * @returns The result of the method call, or undefined if method doesn't exist\n */\n InvokeMethod(methodName: string, ...args: any[]): any {\n return this.compiledComponent?.invokeMethod?.(methodName, ...args);\n }\n\n /** @deprecated Use {@link InvokeMethod}. */\n invokeMethod(methodName: string, ...args: any[]): any {\n return this.InvokeMethod(methodName, ...args);\n }\n \n /**\n * Checks if a method is available on the component\n * @param methodName - Name of the method to check\n * @returns true if the method exists\n */\n HasMethod(methodName: string): boolean {\n return this.compiledComponent?.hasMethod?.(methodName) || false;\n }\n\n /** @deprecated Use {@link HasMethod}. */\n hasMethod(methodName: string): boolean {\n return this.HasMethod(methodName);\n }\n \n /**\n * Print the component content\n * Uses component's print method if available, otherwise uses window.print()\n */\n Print(): void {\n if (this.compiledComponent?.print) {\n this.compiledComponent.print();\n } else if (typeof window !== 'undefined' && window.print) {\n window.print();\n }\n }\n\n /** @deprecated Use {@link Print}. */\n print(): void {\n return this.Print();\n }\n\n /**\n * Force clear component registries\n * Used by Component Studio for fresh loads\n * This is a static method that can be called without a component instance\n */\n public static ForceClearRegistries(): void {\n // Clear React runtime's component registry service\n ComponentRegistryService.reset();\n\n // Clear any cached hierarchy registrar\n if (typeof window !== 'undefined' && (window as any).__MJ_COMPONENT_HIERARCHY_REGISTRAR__) {\n (window as any).__MJ_COMPONENT_HIERARCHY_REGISTRAR__ = null;\n }\n\n console.log('🧹 All component registries cleared for fresh load');\n }\n\n /** @deprecated Use {@link ForceClearRegistries}. */\n public static forceClearRegistries(): void {\n return this.ForceClearRegistries();\n }\n\n /**\n * Gets the current data state from the hosted React component.\n * Falls back to a DataSnapshot built from intercepted RunView/RunQuery results\n * when the component does not explicitly implement getCurrentDataState.\n */\n public GetCurrentDataState(): DataSnapshot | undefined {\n return this.getCurrentDataState();\n }\n\n /**\n * Applies a data state snapshot to the hosted React component.\n * Returns true if the snapshot was successfully applied, false if the\n * component does not support setDataState or the operation failed.\n */\n public SetDataState(snapshot: DataSnapshot): boolean {\n return this.compiledComponent?.setDataState?.(snapshot) ?? false;\n }\n\n}"]}
|
|
1
|
+
{"version":3,"file":"mj-react-component.component.js","sourceRoot":"","sources":["../../../src/lib/components/mj-react-component.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,SAAS,EACT,UAAU,EAGV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAuF,MAAM,6CAA6C,CAAC;AACjK,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,EAGhB,oBAAoB,EACpB,mBAAmB,EACnB,6BAA6B,EAC7B,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,uBAAuB,EACvB,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAA+G,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1M,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;;;;;;;IA6D9E,AADF,8BAA6B,aACE;IAC3B,uBAA2C;IAC7C,iBAAM;IACN,8BAA0B;IAAA,oCAAoB;IAChD,AADgD,iBAAM,EAChD;;AAjBd;;;;GAIG;AA+DH,MAAM,OAAO,gBAAiB,SAAQ,oBAAoB;IAGxD;;;;OAIG;IACH,IACI,SAAS,CAAC,KAAoB;QAChC,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C,QAAsB;QACxC,OAAO,IAAI,CAAC,iBAAiB,EAAE,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC;IACnE,CAAC;iHAt/CU,gBAAgB;oEAAhB,gBAAgB;mCAoVK,UAAU;;;;;YA9YxC,8BAAqC;YACnC,4BAAyF;YACzF,kFAAmC;YAQrC,iBAAM;;YAT8C,cAAgC;YAAhC,6CAAgC;YAClF,eAOC;YAPD,8DAOC;;;iFAiDM,gBAAgB;cA9D5B,SAAS;6BACI,KAAK,YACP,oBAAoB,YACpB;;;;;;;;;;;;GAYT,mBA6CgB,uBAAuB,CAAC,MAAM;;kBAU9C,KAAK;;kBAmCL,KAAK;;kBASL,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAUL,KAAK;;kBAuBL,KAAK;;kBAgCL,KAAK;;kBA4EL,KAAK;;kBAiBL,KAAK;;kBAaL,KAAK;;kBASL,KAAK;;kBAaL,KAAK;;kBAgBL,KAAK;;kBAIL,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBAEN,MAAM;;kBASN,MAAM;;kBAEN,SAAS;mBAAC,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;;kFApV/C,gBAAgB","sourcesContent":["/**\n * @fileoverview Angular component that hosts React components with proper memory management.\n * Provides a bridge between Angular and React ecosystems in MemberJunction applications.\n * @module @memberjunction/ng-react\n */\n\nimport {\n Component,\n Input,\n Output,\n EventEmitter,\n ViewChild,\n ElementRef,\n AfterViewInit,\n OnDestroy,\n ChangeDetectionStrategy,\n ChangeDetectorRef\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { ComponentSpec, ComponentCallbacks, ComponentStyles, ComponentObject, BaseEventArgs, StyleOverrides } from '@memberjunction/interactive-component-types';\nimport { ReactBridgeService } from '../services/react-bridge.service';\nimport { AngularAdapterService } from '../services/angular-adapter.service';\nimport {\n createErrorBoundary,\n ComponentHierarchyRegistrar,\n resourceManager,\n reactRootManager,\n ResolvedComponents,\n SetupStyles,\n BuildStylesFromTheme,\n ApplyStyleOverrides,\n wrapWithLibraryThemeProviders,\n ComponentRegistryService,\n resolveUserStateScope,\n userStateStorageKey,\n parseStoredUserSettings,\n mergeUserSettings,\n applyUserSettingsUpdate,\n generateComponentHierarchyHash,\n createRuntimeUtilities,\n resolveEntityRecordKey\n} from '@memberjunction/react-runtime';\nimport { LogError, CompositeKey, KeyValuePair, Metadata, RunView, RunViewParams, RunViewResult, RunQueryParams, RunQueryResult, DataSnapshot, DataTable, MJColumnDescriptor } from '@memberjunction/core';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { ComponentMetadataEngine, UserInfoEngine } from '@memberjunction/core-entities';\nimport { ComponentUtilities, SimpleRunView, SimpleRunQuery } from '@memberjunction/interactive-component-types';\n\n/**\n * A captured RunView/RunQuery result with its original parameters.\n * Used by the automatic data capture system for components that don't\n * implement getCurrentDataState().\n */\ninterface CapturedDataResult {\n /** Entity name or query name */\n sourceName: string;\n /** 'view' or 'query' */\n sourceType: 'view' | 'query';\n /** Original RunView/RunQuery params */\n params: Record<string, unknown>;\n /** Returned rows */\n rows: Record<string, unknown>[];\n /** Total available rows (may differ from rows.length due to pagination) */\n totalRows: number;\n /** When the data was fetched */\n fetchedAt: Date;\n}\n\n/**\n * Event emitted by React components\n */\nexport interface ReactComponentEvent {\n type: string;\n payload: any;\n}\n\n/**\n * State change event emitted when component state updates\n */\nexport interface StateChangeEvent {\n path: string;\n value: any;\n}\n\n/**\n * User settings changed event emitted when component saves user preferences\n */\nexport interface UserSettingsChangedEvent {\n settings: Record<string, any>;\n componentName?: string;\n timestamp: Date;\n}\n\n/**\n * Angular component that hosts React components with proper memory management.\n * This component provides a bridge between Angular and React, allowing React components\n * to be used seamlessly within Angular applications.\n */\n@Component({\n standalone: false,\n selector: 'mj-react-component',\n template: `\n <div class=\"react-component-wrapper\">\n <div #container class=\"react-component-container\" [class.loading]=\"!isInitialized\"></div>\n @if (!isInitialized && !hasError) {\n <div class=\"loading-overlay\">\n <div class=\"loading-spinner\">\n <i class=\"fa-solid fa-spinner fa-spin\"></i>\n </div>\n <div class=\"loading-text\">Loading component...</div>\n </div>\n }\n </div>\n `,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n .react-component-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n }\n .react-component-container {\n width: 100%;\n height: 100%;\n transition: opacity 0.3s ease;\n }\n .react-component-container.loading {\n opacity: 0;\n }\n .loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background-color: rgba(255, 255, 255, 0.9);\n z-index: 1;\n }\n .loading-spinner {\n font-size: 48px;\n color: #5B4FE9;\n margin-bottom: 16px;\n }\n .loading-text {\n font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", Roboto, sans-serif;\n font-size: 14px;\n color: #64748B;\n margin-top: 8px;\n }\n `],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MJReactComponent extends BaseAngularComponent implements AfterViewInit, OnDestroy {\n private _component!: ComponentSpec;\n\n /**\n * The component specification to render.\n * When this changes after initialization, the component will be reinitialized\n * to load and render the new specification.\n */\n @Input()\n set Component(value: ComponentSpec) {\n const previousComponent = this._component;\n this._component = value;\n\n // If already initialized and component spec changed, reinitialize\n if (this.IsInitialized && value && previousComponent !== value) {\n // Check if it's actually a different component (not just same reference)\n const isDifferent = !previousComponent ||\n previousComponent.name !== value.name ||\n previousComponent.code !== value.code ||\n previousComponent.version !== value.version;\n\n if (isDifferent) {\n this.reinitializeComponent();\n } else if (JSON.stringify(previousComponent.styleOverrides) !== JSON.stringify(value.styleOverrides)) {\n // Same code, new styleOverrides (a regenerated spec whose only change is the\n // requested styling): re-render in place — no teardown needed. The resolved\n // spec must be kept in step because the styleOverrides getter prefers it.\n if (this.ResolvedComponentSpec) {\n this.ResolvedComponentSpec.styleOverrides = value.styleOverrides;\n }\n this.renderComponent();\n }\n }\n }\n get Component(): ComponentSpec {\n return this._component;\n }\n\n /** @deprecated Use {@link Component}. */\n get component(): ComponentSpec {\n return this.Component;\n }\n /** @deprecated Use {@link Component}. */\n @Input() set component(value: ComponentSpec) {\n this.Component = value;\n }\n\n /**\n * Controls verbose logging for component lifecycle and operations.\n * Note: This does NOT control which React build (dev/prod) is loaded.\n * To control React builds, use ReactDebugConfig.setDebugMode() at app startup.\n */\n @Input() EnableLogging: boolean = false;\n\n /** @deprecated Use {@link EnableLogging}. */\n @Input() set enableLogging(value: boolean) {\n this.EnableLogging = value;\n }\n /** @deprecated Use {@link EnableLogging}. */\n get enableLogging(): boolean {\n return this.EnableLogging;\n }\n @Input() UseComponentManager: boolean = true;\n\n /** @deprecated Use {@link UseComponentManager}. */\n @Input() set useComponentManager(value: boolean) {\n this.UseComponentManager = value;\n }\n /** @deprecated Use {@link UseComponentManager}. */\n get useComponentManager(): boolean {\n return this.UseComponentManager;\n } // NEW: Use unified ComponentManager by default\n \n // Auto-initialize utilities if not provided\n private _utilities: any;\n @Input()\n set utilities(value: any) {\n this._utilities = value;\n }\n get utilities(): any {\n // Lazy initialization - only create default utilities when needed\n if (!this._utilities) {\n const runtimeUtils = createRuntimeUtilities();\n this._utilities = runtimeUtils.buildUtilities(this.EnableLogging, this.ProviderToUse);\n if (this.EnableLogging) {\n console.log('MJReactComponent: Auto-initialized utilities using createRuntimeUtilities()');\n }\n }\n return this._utilities;\n }\n \n // Auto-initialize styles if not provided\n private _styles?: Partial<ComponentStyles>;\n // Theme-bridge cache: the ComponentStyles derived from the live `--mj-*` theme,\n // memoized per theme key so we don't re-read getComputedStyle on every access.\n private _themeStyles?: ComponentStyles;\n private _themeStylesKey?: string;\n private themeObserver?: MutationObserver;\n @Input()\n set Styles(value: Partial<ComponentStyles> | undefined) {\n this._styles = value;\n }\n get Styles(): Partial<ComponentStyles> {\n // An explicitly-provided styles input always wins — but user-requested overrides\n // still layer on top, since they represent an explicit request rather than a theme.\n if (this._styles) {\n return this.applyStyleOverridesMemoized(this._styles);\n }\n // Otherwise bridge the host's live MJ theme (--mj-* tokens) into ComponentStyles\n // so generated components inherit the active theme — including dark mode and\n // hover/active/focus state families — instead of the frozen defaults. Memoized\n // per theme key; invalidated by the MutationObserver on data-theme changes.\n const key = this.computeThemeKey();\n if (!this._themeStyles || this._themeStylesKey !== key) {\n this._themeStyles = BuildStylesFromTheme();\n this._themeStylesKey = key;\n if (this.EnableLogging) {\n console.log(`MJReactComponent: Bridged styles from live theme (key=\"${key}\")`);\n }\n }\n // Applied outside the theme memo so the spec's overrides survive a theme flip\n // (the memo caches the theme, not the request).\n return this.applyStyleOverridesMemoized(this._themeStyles);\n }\n\n /** @deprecated Use {@link Styles}. */\n get styles(): Partial<ComponentStyles> {\n return this.Styles;\n }\n /** @deprecated Use {@link Styles}. */\n @Input() set styles(value: Partial<ComponentStyles> | undefined) {\n this.Styles = value;\n }\n\n /**\n * Explicitly user-requested styling from the spec being rendered, resolved above\n * the theme. Reads the resolved spec when available (registry components resolve\n * asynchronously) and falls back to the spec passed in.\n */\n private get styleOverrides(): StyleOverrides | undefined {\n return this.ResolvedComponentSpec?.styleOverrides ?? this._component?.styleOverrides;\n }\n\n // Memo for the override merge. ApplyStyleOverrides allocates a new object whenever\n // overrides are present, and components key effects/memos on the styles identity\n // (e.g. simple-chart tears down and rebuilds its Chart.js instance) — so the merged\n // result must be stable across reads. Keyed by reference: a theme rebuild, a new\n // styles input, or a restyled spec each produce a new ref, which is exactly when\n // the merge must re-run.\n private _mergedStylesBase?: Partial<ComponentStyles>;\n private _mergedStylesOverrides?: StyleOverrides;\n private _mergedStylesResult?: Partial<ComponentStyles>;\n\n private applyStyleOverridesMemoized(base: Partial<ComponentStyles>): Partial<ComponentStyles> {\n const overrides = this.styleOverrides;\n if (!overrides) {\n return base;\n }\n if (!this._mergedStylesResult || this._mergedStylesBase !== base || this._mergedStylesOverrides !== overrides) {\n this._mergedStylesBase = base;\n this._mergedStylesOverrides = overrides;\n this._mergedStylesResult = ApplyStyleOverrides(base, overrides);\n }\n return this._mergedStylesResult;\n }\n\n /**\n * Identifies the current theme so bridged styles can be memoized and refreshed\n * when the user's mode (`data-theme`) or the org overlay (`data-theme-overlay`)\n * changes. Non-DOM environments return a constant key.\n */\n private computeThemeKey(): string {\n if (typeof document === 'undefined') {\n return 'no-dom';\n }\n const root = document.documentElement;\n return `${root.getAttribute('data-theme') || 'light'}|${root.getAttribute('data-theme-overlay') || ''}`;\n }\n\n /**\n * Watches the document root for theme changes (`data-theme` / `data-theme-overlay`)\n * and, when the theme flips, invalidates the bridged-styles cache and re-renders so\n * the live React component picks up the new theme. No-op when styles are supplied\n * explicitly or when there is no DOM.\n */\n private setupThemeObserver(): void {\n if (this._styles || typeof MutationObserver === 'undefined' || typeof document === 'undefined') {\n return;\n }\n this.themeObserver = new MutationObserver(() => {\n const key = this.computeThemeKey();\n if (key !== this._themeStylesKey) {\n this._themeStyles = undefined;\n this._themeStylesKey = undefined;\n if (this.IsInitialized) {\n this.renderComponent();\n }\n }\n });\n this.themeObserver.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-theme', 'data-theme-overlay'],\n });\n }\n \n private _savedUserSettings: any = {};\n @Input()\n set SavedUserSettings(value: any) {\n this._savedUserSettings = value || {};\n // Re-render if component is initialized\n if (this.IsInitialized) {\n this.renderComponent();\n }\n }\n get SavedUserSettings(): any {\n return this._savedUserSettings;\n }\n\n /** @deprecated Use {@link SavedUserSettings}. */\n get savedUserSettings(): any {\n return this.SavedUserSettings;\n }\n /** @deprecated Use {@link SavedUserSettings}. */\n @Input() set savedUserSettings(value: any) {\n this.SavedUserSettings = value;\n }\n\n /**\n * Optional explicit scope for per-user settings persistence. When omitted, the\n * scope defaults to `<namespace>/<name>` of the component spec. Settings are\n * stored per-user via `UserInfoEngine` under the key\n * `InteractiveComponents_UserState_Root/<scope>`. Provide an\n * explicit scope when a single component spec is rendered in multiple distinct\n * contexts that should NOT share preferences (e.g. the same form spec used for\n * different entities) — set it to something stable and unique per context.\n */\n @Input() UserStateScope?: string;\n\n /**\n * When `true` (default), the host transparently persists `savedUserSettings`\n * per-user, cross-device via `UserInfoEngine` — seeding the component from\n * storage on load and saving (debounced) on every `onSaveUserSettings` call,\n * auto-scoped per component. Set to `false` to opt out and own persistence\n * yourself by handling the `userSettingsChanged` output instead.\n */\n @Input() PersistUserSettings: boolean = true;\n\n /**\n * Host-supplied props spread into the React component's props alongside the\n * standard `utilities`, `callbacks`, `components`, `styles`, `libraries`, and\n * `savedUserSettings`. Used by hosts that need to push data context the React\n * component can't fetch itself — e.g. `InteractiveFormComponent` passing\n * `FormHostProps` (the current record snapshot, mode, permissions).\n *\n * Standard keys take precedence over caller-supplied keys to keep the\n * platform contract stable.\n */\n private _componentProps: object = {};\n @Input()\n set ComponentProps(value: object | undefined) {\n this._componentProps = value ?? {};\n if (this.IsInitialized) {\n this.renderComponent();\n }\n }\n get ComponentProps(): object {\n return this._componentProps;\n }\n\n /** @deprecated Use {@link ComponentProps}. */\n get componentProps(): object {\n return this.ComponentProps;\n }\n /** @deprecated Use {@link ComponentProps}. */\n @Input() set componentProps(value: object | undefined) {\n this.ComponentProps = value;\n }\n\n @Output() StateChange = new EventEmitter<StateChangeEvent>();\n\n /**\n * @deprecated Use {@link StateChange}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (stateChange) keeps working. Must stay AFTER StateChange: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() stateChange = this.StateChange;\n @Output() ComponentEvent = new EventEmitter<ReactComponentEvent>();\n\n /**\n * @deprecated Use {@link ComponentEvent}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (componentEvent) keeps working. Must stay AFTER ComponentEvent: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() componentEvent = this.ComponentEvent;\n @Output() RefreshData = new EventEmitter<void>();\n\n /**\n * @deprecated Use {@link RefreshData}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (refreshData) keeps working. Must stay AFTER RefreshData: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() refreshData = this.RefreshData;\n @Output() OpenEntityRecord = new EventEmitter<{ entityName: string; key: CompositeKey }>();\n\n /**\n * @deprecated Use {@link OpenEntityRecord}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (openEntityRecord) keeps working. Must stay AFTER OpenEntityRecord: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() openEntityRecord = this.OpenEntityRecord;\n @Output() UserSettingsChanged = new EventEmitter<UserSettingsChangedEvent>();\n\n /**\n * @deprecated Use {@link UserSettingsChanged}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (userSettingsChanged) keeps working. Must stay AFTER UserSettingsChanged: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() userSettingsChanged = this.UserSettingsChanged;\n /** Emitted once after the component successfully loads and resolvedComponentSpec is populated. */\n @Output() Initialized = new EventEmitter<void>();\n\n /**\n * @deprecated Use {@link Initialized}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (initialized) keeps working. Must stay AFTER Initialized: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() initialized = this.Initialized;\n \n @ViewChild('container', { read: ElementRef, static: true }) Container!: ElementRef<HTMLDivElement>;\n\n /** @deprecated Use {@link Container}. */\n get container(): ElementRef<HTMLDivElement> {\n return this.Container;\n }\n /** @deprecated Use {@link Container}. */\n set container(value: ElementRef<HTMLDivElement>) {\n this.Container = value;\n }\n\n // ─── Automatic data capture ───\n // Stores RunView/RunQuery results for components that don't implement getCurrentDataState().\n // Cleared on component reinitialize. Used as fallback in GetCurrentDataState().\n private capturedData: CapturedDataResult[] = [];\n\n private reactRootId: string | null = null;\n private compiledComponent: ComponentObject | null = null;\n private loadedDependencies: Record<string, ComponentObject> = {};\n private destroyed$ = new Subject<void>();\n private currentCallbacks: ComponentCallbacks | null = null;\n IsInitialized = false;\n\n /** @deprecated Use {@link IsInitialized}. */\n get isInitialized() {\n return this.IsInitialized;\n }\n /** @deprecated Use {@link IsInitialized}. */\n set isInitialized(value) {\n this.IsInitialized = value;\n }\n private isRendering = false;\n private pendingRender = false;\n private isDestroying = false;\n private componentId: string;\n private componentVersion: string = ''; // Store the version for resolver\n HasError = false;\n\n /** @deprecated Use {@link HasError}. */\n get hasError() {\n return this.HasError;\n }\n /** @deprecated Use {@link HasError}. */\n set hasError(value) {\n this.HasError = value;\n }\n \n /**\n * Public property containing the fully resolved component specification.\n * This includes all external code fetched from registries, allowing consumers\n * to inspect the complete resolved specification including dependencies.\n * Only populated after successful component initialization.\n */\n public ResolvedComponentSpec: ComponentSpec | null = null;\n\n /** @deprecated Use {@link ResolvedComponentSpec}. */\n public get resolvedComponentSpec(): ComponentSpec | null {\n return this.ResolvedComponentSpec;\n }\n /** @deprecated Use {@link ResolvedComponentSpec}. */\n public set resolvedComponentSpec(value: ComponentSpec | null) {\n this.ResolvedComponentSpec = value;\n }\n\n constructor(\n private reactBridge: ReactBridgeService,\n private adapter: AngularAdapterService,\n private cdr: ChangeDetectorRef,\n private notificationService: MJNotificationService\n ) {\n super();\n // Generate unique component ID for resource tracking\n this.componentId = `mj-react-component-${Date.now()}-${Math.random()}`;\n }\n\n async ngAfterViewInit() {\n // Try to get registry size safely\n let registrySize = 'N/A';\n try {\n if (this.adapter.isInitialized()) {\n registrySize = this.adapter.getRegistry().size().toString();\n } else {\n registrySize = 'Not initialized yet';\n }\n } catch (e) {\n registrySize = 'Not available';\n }\n \n console.log(`🎬 [ngAfterViewInit] Starting component initialization:`, {\n componentId: this.componentId,\n componentName: this.Component?.name,\n timestamp: new Date().toISOString(),\n registrySize: registrySize\n });\n \n // Trigger change detection to show loading state\n this.cdr.detectChanges();\n // Refresh bridged theme styles when the user's mode / org overlay changes.\n this.setupThemeObserver();\n await this.initializeComponent();\n }\n\n ngOnDestroy() {\n // Set destroying flag immediately\n this.isDestroying = true;\n\n // Cancel any pending renders\n this.pendingRender = false;\n\n this.themeObserver?.disconnect();\n this.themeObserver = undefined;\n\n this.destroyed$.next();\n this.destroyed$.complete();\n this.cleanup();\n }\n\n /**\n * Reinitialize the component when the input spec changes.\n * Cleans up the current component and initializes with the new spec.\n */\n private async reinitializeComponent() {\n // Don't reinitialize if we're being destroyed\n if (this.isDestroying) {\n return;\n }\n\n // Clear cached state from previous component\n this.compiledComponent = null;\n this.ResolvedComponentSpec = null;\n this.loadedDependencies = {};\n this.componentVersion = '';\n this.HasError = false;\n this.IsInitialized = false;\n this.capturedData = [];\n\n // Unmount existing React root if present\n if (this.reactRootId) {\n this.isRendering = false;\n this.pendingRender = false;\n reactRootManager.unmountRoot(this.reactRootId);\n this.reactRootId = null;\n }\n\n // Trigger change detection to show loading state\n this.cdr.detectChanges();\n\n // Initialize with the new component spec\n await this.initializeComponent();\n }\n\n /**\n * Initialize the React component\n */\n private async initializeComponent() {\n try {\n // Ensure React is loaded\n await this.reactBridge.getReactContext();\n\n // Wait for React to be fully ready (handles first-load delay)\n await this.reactBridge.waitForReactReady();\n\n // NEW: Use ComponentManager if enabled (default: true)\n if (this.UseComponentManager) {\n console.log(`🎯 [initializeComponent] Using NEW ComponentManager approach`);\n await this.loadComponentWithManager();\n \n // Component is already compiled and stored in this.compiledComponent\n // No need to fetch from registry - it's already set\n } else {\n console.log(`📦 [initializeComponent] Using legacy approach (will be deprecated)`);\n // Register component hierarchy (this compiles and registers all components including from registries)\n await this.registerComponentHierarchy();\n \n // The resolved spec should now be available from the registration result\n // No need to fetch again\n \n // Get the already-registered component from the registry\n const registry = this.adapter.getRegistry();\n \n console.log(`🔍 [initializeComponent] Looking for component in registry:`, {\n name: this.Component.name,\n namespace: this.Component.namespace || 'Global',\n version: this.componentVersion\n });\n \n // Let's also check what's actually in the registry\n // Note: ComponentRegistry doesn't have a list() method, so we'll skip this for now\n \n const componentWrapper = registry.get(\n this.Component.name, \n this.Component.namespace || 'Global', \n this.componentVersion\n );\n \n console.log(`🔍 [initializeComponent] Registry.get result:`, {\n found: !!componentWrapper,\n type: componentWrapper ? typeof componentWrapper : 'undefined',\n hasComponent: componentWrapper ? !!componentWrapper.component : false\n });\n \n if (!componentWrapper) {\n const source = this.Component.registry ? `external registry ${this.Component.registry}` : 'local registry';\n console.error(`❌ [initializeComponent] Component not found! Details:`, {\n searchedName: this.Component.name,\n searchedNamespace: this.Component.namespace || 'Global',\n searchedVersion: this.componentVersion,\n source: source\n });\n throw new Error(`Component ${this.Component.name} was not found in registry after registration from ${source}`);\n }\n \n // The registry now stores ComponentObjects directly\n // Validate it has the expected structure\n if (!componentWrapper || typeof componentWrapper !== 'object') {\n throw new Error(`Invalid component wrapper returned for ${this.Component.name}: ${typeof componentWrapper}`);\n }\n \n if (!componentWrapper.component) {\n throw new Error(`Component wrapper missing 'component' property for ${this.Component.name}`);\n }\n \n // Now that we use a regular HOC wrapper, components should always be functions\n if (typeof componentWrapper.component !== 'function') {\n throw new Error(`Component is not a function for ${this.Component.name}: ${typeof componentWrapper.component}`);\n }\n \n this.compiledComponent = componentWrapper;\n } // End of else block for legacy approach\n \n // Create managed React root\n const reactContext = this.reactBridge.getCurrentContext();\n if (!reactContext) {\n throw new Error('React context not available');\n }\n \n this.reactRootId = reactRootManager.createRoot(\n this.Container.nativeElement,\n (container: HTMLElement) => reactContext.ReactDOM.createRoot(container),\n this.componentId\n );\n\n // Seed savedUserSettings from durable per-user storage before the first\n // render so the component mounts with the user's persisted preferences.\n await this.seedUserSettingsFromStore();\n\n // Initial render\n this.renderComponent();\n this.IsInitialized = true;\n\n // Trigger change detection since we're using OnPush\n this.cdr.detectChanges();\n\n // Notify parent that the component has successfully initialized and\n // resolvedComponentSpec is now populated with the full spec from the registry\n this.Initialized.emit();\n\n } catch (error) {\n this.HasError = true;\n LogError(`Failed to initialize React component: ${error}`);\n this.ComponentEvent.emit({\n type: 'error',\n payload: {\n error: error instanceof Error ? error.message : String(error),\n source: 'initialization'\n }\n });\n // Trigger change detection to show error state\n this.cdr.detectChanges();\n }\n }\n \n\n /**\n * Generate a hash from component code for versioning.\n *\n * Delegates to the runtime so every host derives the same version for the same spec. When this\n * lived here, the React Native app had to reimplement it to load the same component, and two\n * implementations of a registry key is how one surface silently compiles a second copy of a\n * component the other already has.\n */\n private generateComponentHash(spec: ComponentSpec): string {\n return generateComponentHierarchyHash(spec);\n }\n\n /**\n * Resolve components using the runtime's resolver\n */\n private async resolveComponentsWithVersion(spec: ComponentSpec, version: string, namespace: string = 'Global'): Promise<ResolvedComponents> {\n const resolver = this.adapter.getResolver();\n \n // Debug: Log what dependencies we're trying to resolve\n if (this.EnableLogging) {\n console.log(`Resolving components for ${spec.name}. Dependencies:`, spec.dependencies);\n }\n \n // Use the runtime's resolver which now handles registry-based components\n const resolved = await resolver.resolveComponents(\n spec, \n namespace,\n this.ProviderToUse.CurrentUser // Pass current user context for database operations\n );\n \n if (this.EnableLogging) {\n console.log(`Resolved ${Object.keys(resolved).length} components for version ${version}:`, Object.keys(resolved));\n }\n return resolved;\n }\n\n\n /**\n * NEW: Load component using unified ComponentManager - MUCH SIMPLER!\n */\n private async loadComponentWithManager() {\n try {\n const manager = this.adapter.getComponentManager();\n \n console.log(`🚀 [ComponentManager] Loading component hierarchy: ${this.Component.name}`);\n \n // Load the entire hierarchy with one simple call\n const result = await manager.loadHierarchy(this.Component, {\n contextUser: this.ProviderToUse.CurrentUser,\n defaultNamespace: 'Global',\n defaultVersion: this.Component.version || this.generateComponentHash(this.Component),\n returnType: 'both'\n });\n \n if (!result.success) {\n const errorMessages = result.errors.map(e => `${e.componentName}: ${e.message}`).join(', ');\n console.error(`❌ [ComponentManager] Failed to load hierarchy:`, errorMessages);\n throw new Error(`Component loading failed: ${errorMessages}`);\n }\n \n // Store the results (handle undefined values)\n this.ResolvedComponentSpec = this.enrichSpecWithRegistryInfo(result.resolvedSpec || null);\n this.compiledComponent = result.rootComponent || null;\n this.componentVersion = result.resolvedSpec?.version || this.Component.version || 'latest';\n \n // IMPORTANT: Store the loaded dependencies for use in renderComponent\n this.loadedDependencies = result.components || {};\n \n console.log(`✅ [ComponentManager] Successfully loaded hierarchy:`, {\n rootComponent: result.resolvedSpec?.name,\n loadedCount: result.loadedComponents.length,\n dependencies: Object.keys(this.loadedDependencies),\n stats: result.stats\n });\n \n // Component is ready to render\n return true;\n \n } catch (error) {\n console.error(`❌ [ComponentManager] Error loading component:`, error);\n throw error;\n }\n }\n\n /**\n * Register all components in the hierarchy\n * @deprecated Use loadComponentWithManager() instead\n */\n private async registerComponentHierarchy() {\n // Use semantic version from spec or generate hash-based version for uniqueness\n const version = this.Component.version || this.generateComponentHash(this.Component);\n this.componentVersion = version; // Store for use in resolver\n \n console.log(`🔍 [registerComponentHierarchy] Starting registration for ${this.Component.name}@${version}`, {\n location: this.Component.location,\n registry: this.Component.registry,\n namespace: this.Component.namespace,\n hasCode: !!this.Component.code,\n codeLength: this.Component.code?.length || 0\n });\n \n // Check if already registered to avoid duplication\n const registry = this.adapter.getRegistry();\n const checkNamespace = this.Component.namespace || 'Global';\n \n console.log(`🔍 [registerComponentHierarchy] Checking registry for existing component:`, {\n name: this.Component.name,\n namespace: checkNamespace,\n version: version,\n registrySize: registry.size(),\n registryId: registry.registryId || 'unknown'\n });\n \n // Log registry state for debugging\n console.log(`📦 [registerComponentHierarchy] Registry state:`, {\n totalSize: registry.size(),\n registryInstance: registry.registryId || 'unknown'\n });\n \n const existingComponent = registry.get(this.Component.name, checkNamespace, version);\n \n if (existingComponent) {\n console.log(`⚠️ [registerComponentHierarchy] Component ${this.Component.name}@${version} already registered!`, {\n existingType: typeof existingComponent,\n hasComponent: !!(existingComponent as any).component,\n registrationTime: (existingComponent as any).registeredAt || 'unknown',\n runtimeContextLibraries: Object.keys(this.adapter.getRuntimeContext().libraries || {})\n });\n \n // For registry components, we need to check the resolved spec's libraries, not the input spec\n // The input spec from Angular doesn't have library information for registry components\n if (this.Component.location === 'registry' && this.Component.registry) {\n console.log(`📋 [registerComponentHierarchy] Component is from registry, need to fetch full spec to check libraries`);\n // Continue to fetch the full spec below - don't return early\n } else {\n // For local components, check using the input spec\n const requiredLibraries = this.Component.libraries || [];\n const runtimeLibraries = this.adapter.getRuntimeContext().libraries || {};\n const missingLibraries = requiredLibraries.filter(lib => !runtimeLibraries[lib.globalVariable]);\n \n if (missingLibraries.length > 0) {\n console.warn(`⚠️ [registerComponentHierarchy] Component registered but libraries missing:`, {\n required: requiredLibraries.map(l => l.globalVariable),\n loaded: Object.keys(runtimeLibraries),\n missing: missingLibraries.map(l => l.globalVariable)\n });\n // Don't return early - continue to load libraries\n } else {\n console.log(`✅ [registerComponentHierarchy] Component ${this.Component.name}@${version} already registered with all libraries, skipping`);\n return;\n }\n }\n } else {\n console.log(`🆕 [registerComponentHierarchy] Component not found in registry, proceeding with registration`);\n }\n \n // Initialize metadata engine\n await ComponentMetadataEngine.Instance.Config(false, this.ProviderToUse.CurrentUser);\n \n // Use the runtime's hierarchy registrar\n const registrar = new ComponentHierarchyRegistrar(\n this.adapter.getCompiler(),\n this.adapter.getRegistry(),\n this.adapter.getRuntimeContext()\n );\n \n console.log(`📦 [registerComponentHierarchy] Calling registrar.registerHierarchy for ${this.Component.name}`, {\n hasStyles: !!this.Styles,\n namespace: this.Component.namespace || 'Global',\n version: version,\n libraryCount: ComponentMetadataEngine.Instance.ComponentLibraries?.length || 0,\n hasCode: !!this.Component.code,\n codeLength: this.Component.code?.length || 0\n });\n \n // Register with proper configuration\n // Pass the partial spec - the React runtime will handle fetching from registries\n const result = await registrar.registerHierarchy(\n this.Component, // Pass the original spec, not fetched\n {\n styles: this.Styles as ComponentStyles,\n namespace: this.Component.namespace || 'Global',\n version: version,\n allowOverride: false, // Each version is unique\n allLibraries: ComponentMetadataEngine.Instance.ComponentLibraries,\n debug: true,\n contextUser: this.ProviderToUse.CurrentUser\n }\n );\n \n if (!result.success) {\n const errors = result.errors.map(e => e.error).join(', ');\n console.error(`❌ [registerComponentHierarchy] Registration failed:`, errors);\n throw new Error(`Component registration failed: ${errors}`);\n }\n \n // Store the resolved spec from the registration result\n if (result.resolvedSpec) {\n this.ResolvedComponentSpec = this.enrichSpecWithRegistryInfo(result.resolvedSpec || null);\n console.log(`📋 [registerComponentHierarchy] Received resolved spec from runtime:`, {\n name: result.resolvedSpec.name,\n hasCode: !!result.resolvedSpec.code,\n libraryCount: result.resolvedSpec.libraries?.length || 0,\n dependencyCount: result.resolvedSpec.dependencies?.length || 0\n });\n }\n \n console.log(`✅ [registerComponentHierarchy] Successfully registered ${result.registeredComponents.length} components:`, result.registeredComponents);\n \n // Verify the component is actually in the registry\n const verifyComponent = registry.get(this.Component.name, this.Component.namespace || 'Global', version);\n console.log(`🔍 [registerComponentHierarchy] Verification - component in registry after registration:`, {\n found: !!verifyComponent,\n name: this.Component.name,\n namespace: this.Component.namespace || 'Global',\n version: version,\n componentType: verifyComponent ? typeof verifyComponent : 'not found'\n });\n }\n\n /**\n * Post-process resolved spec to ensure all components show their true registry source.\n * This enriches the spec for UI display purposes to show where components actually came from.\n * Applied to all resolved specs so any consumer of this wrapper benefits.\n */\n private enrichSpecWithRegistryInfo(spec: ComponentSpec | null): ComponentSpec | null {\n if (!spec || !this.Component) return spec;\n \n // Create a deep copy to avoid mutating the original\n const enrichedSpec = JSON.parse(JSON.stringify(spec));\n \n // Recursive function to process spec and all dependencies\n // Takes the original spec at the same level to find registry info\n const processSpec = (currentSpec: ComponentSpec, originalSpec: ComponentSpec) => {\n // If this component has code but shows location as 'embedded', \n // check the original spec to see where it came from\n if (currentSpec.code && currentSpec.location === 'embedded' && currentSpec.name) {\n // Try to find this component in the original spec at the same level\n // First check if the original spec itself matches by name\n if (originalSpec.name === currentSpec.name) {\n // Use the original's registry info if it had any\n if (originalSpec.location === 'registry' || originalSpec.registry) {\n currentSpec.location = 'registry';\n if (originalSpec.registry) {\n currentSpec.registry = originalSpec.registry;\n }\n if (originalSpec.namespace) {\n currentSpec.namespace = originalSpec.namespace;\n }\n }\n }\n \n // Also check in original's dependencies for a match\n if (originalSpec.dependencies) {\n const originalDep = originalSpec.dependencies.find(d => d.name === currentSpec.name);\n if (originalDep && (originalDep.location === 'registry' || originalDep.registry)) {\n currentSpec.location = 'registry';\n if (originalDep.registry) {\n currentSpec.registry = originalDep.registry;\n }\n if (originalDep.namespace) {\n currentSpec.namespace = originalDep.namespace;\n }\n }\n }\n }\n \n // Process all dependencies recursively\n if (currentSpec.dependencies && Array.isArray(currentSpec.dependencies)) {\n currentSpec.dependencies.forEach((dep, index) => {\n // Find the corresponding original dependency by name or use the one at same index\n let originalDep = originalSpec.dependencies?.find(d => d.name === dep.name);\n if (!originalDep && originalSpec.dependencies && index < originalSpec.dependencies.length) {\n originalDep = originalSpec.dependencies[index];\n }\n if (originalDep) {\n processSpec(dep, originalDep);\n }\n });\n }\n };\n \n processSpec(enrichedSpec, this.Component);\n return enrichedSpec;\n }\n\n /**\n * Render the React component\n */\n private async renderComponent() {\n // Don't render if component is being destroyed\n if (this.isDestroying) {\n return;\n }\n \n if (!this.compiledComponent || !this.reactRootId) {\n return;\n }\n\n // Prevent concurrent renders\n if (this.isRendering) {\n this.pendingRender = true;\n return;\n }\n\n const context = this.reactBridge.getCurrentContext();\n if (!context) {\n return;\n }\n\n this.isRendering = true;\n const { React } = context;\n \n // Resolve components with the correct version using runtime's resolver\n // SKIP this if using ComponentManager - components are already loaded!\n let components = {};\n if (!this.UseComponentManager) {\n components = await this.resolveComponentsWithVersion(this.Component, this.componentVersion);\n } else {\n // Use the dependencies that were already loaded and unwrapped by ComponentManager\n components = this.loadedDependencies;\n console.log(`🎯 [renderComponent] Using dependencies from ComponentManager:`, Object.keys(components));\n }\n \n // Create callbacks once per component instance\n if (!this.currentCallbacks) {\n this.currentCallbacks = this.createCallbacks();\n }\n \n // Get libraries from runtime context\n const runtimeContext = this.adapter.getRuntimeContext();\n const libraries = runtimeContext.libraries || {};\n \n // Build props — wrap utilities with data capture for fallback snapshot support.\n // Host-supplied componentProps spread first so platform-provided keys\n // (utilities, callbacks, components, styles, libraries, savedUserSettings,\n // onSaveUserSettings) always win — the contract stays stable regardless of\n // what a host passes in.\n const wrappedUtilities = this.wrapUtilitiesWithCapture(this.utilities);\n const props = {\n ...this._componentProps,\n utilities: wrappedUtilities,\n callbacks: this.currentCallbacks,\n components,\n styles: this.Styles as any,\n libraries, // Pass the loaded libraries to components\n savedUserSettings: this._savedUserSettings,\n onSaveUserSettings: this.handleSaveUserSettings.bind(this)\n };\n\n // Validate component before creating element\n if (!this.compiledComponent.component) {\n LogError(`Component is undefined for ${this.Component.name} during render`);\n return;\n }\n \n // Components should be functions after HOC wrapping\n if (typeof this.compiledComponent.component !== 'function') {\n LogError(`Component is not a function for ${this.Component.name}: ${typeof this.compiledComponent.component}`);\n return;\n }\n\n // Create error boundary\n const ErrorBoundary = createErrorBoundary(React, {\n onError: this.handleReactError.bind(this),\n logErrors: true,\n recovery: 'retry'\n });\n\n // Create element with error boundary. Auto-theme component libraries (antd) from\n // the live MJ theme by wrapping the mounted tree in their theme provider — antd\n // components don't read styles.* on their own and would otherwise render in their\n // built-in light theme even in dark mode. One wrap themes every antd component in\n // the subtree; no-op when antd isn't loaded.\n const themedComponent = wrapWithLibraryThemeProviders(\n React,\n React.createElement(this.compiledComponent.component, props),\n libraries,\n this.Styles as ComponentStyles\n );\n const element = React.createElement(\n ErrorBoundary,\n null,\n themedComponent\n );\n\n // Render with timeout protection using resource manager\n const timeoutId = resourceManager.setTimeout(\n this.componentId,\n () => {\n // Check if still rendering and not destroyed\n if (this.isRendering && !this.isDestroying) {\n this.ComponentEvent.emit({\n type: 'error',\n payload: {\n error: 'Component render timeout - possible infinite loop detected',\n source: 'render'\n }\n });\n }\n },\n 5000,\n { purpose: 'render-timeout-protection' }\n );\n\n // Use managed React root for rendering\n reactRootManager.render(\n this.reactRootId,\n element,\n () => {\n // Clear the timeout as render completed\n resourceManager.clearTimeout(this.componentId, timeoutId);\n \n // Don't update state if component is destroyed\n if (this.isDestroying) {\n return;\n }\n \n this.isRendering = false;\n \n // If there was a pending render request, execute it now\n if (this.pendingRender) {\n this.pendingRender = false;\n this.renderComponent();\n }\n }\n );\n }\n\n /**\n * Create callbacks for the React component\n */\n private createCallbacks(): ComponentCallbacks {\n return {\n RegisterMethod: (_methodName: string, _handler: any) => {\n // The component compiler wrapper will handle this internally\n // This is just a placeholder to satisfy the interface\n // The actual registration happens in the wrapper component\n },\n CreateSimpleNotification: (message: string, style: \"none\" | \"success\" | \"error\" | \"warning\" | \"info\", hideAfter?: number) => {\n // Use the MJ notification service to display the notification\n const notificationStyle = style as \"none\" | \"success\" | \"error\" | \"warning\" | \"info\" | undefined;\n this.notificationService.CreateSimpleNotification(\n message, \n style, \n hideAfter\n );\n },\n OpenEntityRecord: async (entityName: string, key: CompositeKey) => {\n // Shape coercion and the non-primary-key lookup both live in the runtime now, so the\n // React Native host resolves a component's key exactly the way this one does. What stays\n // here is the only part that is Angular's: what \"open\" means.\n const keyToUse = await resolveEntityRecordKey(entityName, key, this.ProviderToUse);\n if (keyToUse) {\n this.OpenEntityRecord.emit({ entityName, key: keyToUse });\n }\n },\n NotifyEvent: async (eventName: string, args: BaseEventArgs) => {\n this.ComponentEvent.emit({ type: eventName, payload: args });\n }\n };\n }\n\n /**\n * Handle React component errors\n */\n private handleReactError(error: any, errorInfo?: any) {\n LogError(`React component error: ${error?.toString() || 'Unknown error'}`, errorInfo);\n this.ComponentEvent.emit({\n type: 'error',\n payload: {\n error: error?.toString() || 'Unknown error',\n errorInfo,\n source: 'react'\n }\n });\n }\n\n /**\n * Handle onSaveUserSettings from components.\n *\n * This implements the SavedUserSettings pattern: the component owns its single\n * settings object and hands us the full latest copy whenever it changes. We\n * (1) **merge** the payload over our in-memory snapshot so any future re-render\n * passes the latest values, (2) persist the merged snapshot per-user via\n * UserInfoEngine (debounced, auto-scoped) unless the host opted out, and\n * (3) still bubble the event up for any parent container that wants to observe\n * changes — carrying the merged snapshot, so observers and storage agree.\n *\n * Merge (not replace) makes the host resilient to a component passing only the\n * changed keys, and to the stale-prop case: we deliberately never re-render on\n * save, so the `savedUserSettings` prop a component spreads is frozen at mount\n * and would otherwise lose earlier same-session changes. Removing a key\n * requires explicit intent — set it to `null` (see applyUserSettingsUpdate).\n */\n private handleSaveUserSettings(newSettings: Record<string, any>) {\n // Keep our snapshot current WITHOUT going through the setter (which would\n // re-render). The component already holds the correct state — it's the one\n // that told us about the change — so re-rendering would only cause flicker.\n this._savedUserSettings = applyUserSettingsUpdate(this._savedUserSettings, newSettings);\n\n // Durably persist the latest settings for this user, scoped to this component.\n this.persistUserSettings(this._savedUserSettings);\n\n // Bubble the event up to parent containers (back-compat; no consumer required).\n this.UserSettingsChanged.emit({\n settings: this._savedUserSettings,\n componentName: this.Component?.name,\n timestamp: new Date()\n });\n }\n\n /**\n * Resolve the durable storage key for this component's per-user settings, or\n * null when persistence is disabled or no stable scope can be derived.\n */\n private getUserStateStorageKey(): string | null {\n if (!this.PersistUserSettings) {\n return null;\n }\n const scope = resolveUserStateScope(\n this.UserStateScope,\n this._component?.namespace,\n this._component?.name\n );\n return userStateStorageKey(scope);\n }\n\n /**\n * Seed `savedUserSettings` from durable per-user storage (UserInfoEngine),\n * merging stored values over any host-provided defaults (stored wins). Best\n * effort — any failure leaves the host-provided / empty settings in place.\n */\n private async seedUserSettingsFromStore(): Promise<void> {\n const key = this.getUserStateStorageKey();\n if (!key) {\n return;\n }\n try {\n const provider = this.ProviderToUse;\n const user = provider?.CurrentUser;\n if (!user) {\n return; // No user context — cannot scope settings to a user.\n }\n // Idempotent: a no-op when the engine is already loaded for this user.\n await UserInfoEngine.Instance.Config(false, user, provider);\n const stored = parseStoredUserSettings(UserInfoEngine.Instance.GetSetting(key));\n this._savedUserSettings = mergeUserSettings(this._savedUserSettings, stored);\n } catch (error) {\n if (this.EnableLogging) {\n console.warn('MJReactComponent: failed to seed user settings from store', error);\n }\n }\n }\n\n /**\n * Persist the component's settings object for the current user (debounced,\n * cross-device). Best effort — failures are logged when logging is enabled and\n * never surfaced to the component.\n */\n private persistUserSettings(settings: Record<string, any> | string): void {\n const key = this.getUserStateStorageKey();\n if (!key) {\n return;\n }\n try {\n const provider = this.ProviderToUse;\n const user = provider?.CurrentUser;\n if (!user) {\n return;\n }\n // The component normally hands us an object, but guard against a caller\n // that already serialized it — double-stringifying would store a quoted\n // JSON string the seed path could not parse back into settings.\n const serialized = typeof settings === 'string' ? settings : JSON.stringify(settings);\n UserInfoEngine.Instance.SetSettingDebounced(key, serialized, user);\n } catch (error) {\n if (this.EnableLogging) {\n console.warn('MJReactComponent: failed to persist user settings', error);\n }\n }\n }\n\n // =================================================================\n // Automatic Data Capture — intercept RunView/RunQuery for fallback\n // =================================================================\n\n /**\n * Wraps a ComponentUtilities object so that every RunView / RunViews / RunQuery\n * call transparently stores the result in `this.capturedData`. The wrapped\n * object is referentially distinct from the original and is safe to pass to\n * multiple renders (results accumulate until the component resets).\n */\n private wrapUtilitiesWithCapture(original: ComponentUtilities): ComponentUtilities {\n const self = this;\n const wrappedRv: SimpleRunView = {\n RunView: async (params: RunViewParams, contextUser?: unknown) => {\n const result = await original.rv.RunView(params, contextUser as undefined);\n if (result?.Success) {\n self.capturedData.push({\n sourceName: String(params.EntityName ?? params.ExtraFilter ?? 'Unknown'),\n sourceType: 'view',\n params: params as unknown as Record<string, unknown>,\n rows: result.Results ?? [],\n totalRows: result.TotalRowCount ?? result.Results?.length ?? 0,\n fetchedAt: new Date()\n });\n }\n return result;\n },\n RunViews: async (params: RunViewParams[], contextUser?: unknown) => {\n const results = await original.rv.RunViews(params, contextUser as undefined);\n results.forEach((result: RunViewResult, i: number) => {\n if (result?.Success) {\n self.capturedData.push({\n sourceName: String(params[i]?.EntityName ?? `View ${i}`),\n sourceType: 'view',\n params: params[i] as unknown as Record<string, unknown>,\n rows: result.Results ?? [],\n totalRows: result.TotalRowCount ?? result.Results?.length ?? 0,\n fetchedAt: new Date()\n });\n }\n });\n return results;\n }\n };\n\n const wrappedRq: SimpleRunQuery = {\n RunQuery: async (params: RunQueryParams, contextUser?: unknown) => {\n const result = await original.rq.RunQuery(params, contextUser as undefined);\n if (result?.Success) {\n self.capturedData.push({\n sourceName: String(params.QueryID ?? params.QueryName ?? 'Query'),\n sourceType: 'query',\n params: params as unknown as Record<string, unknown>,\n rows: (result.Results ?? []) as Record<string, unknown>[],\n totalRows: result.TotalRowCount ?? result.Results?.length ?? 0,\n fetchedAt: new Date()\n });\n }\n return result;\n }\n };\n\n return {\n ...original,\n rv: wrappedRv,\n rq: wrappedRq\n };\n }\n\n /**\n * Builds a DataSnapshot from captured RunView/RunQuery results.\n * Returns null if no data was captured.\n */\n private buildCapturedDataSnapshot(): DataSnapshot | null {\n if (this.capturedData.length === 0) return null;\n\n const tables: DataTable[] = this.capturedData.map((captured, idx) => {\n const table = new DataTable();\n table.name = captured.sourceName || `Table ${idx + 1}`;\n table.source = captured.sourceType;\n table.rows = captured.rows;\n // Infer columns from the first row's keys\n if (captured.rows.length > 0) {\n const firstRow = captured.rows[0];\n table.columns = Object.keys(firstRow).map(key => {\n const col = new MJColumnDescriptor(key);\n col.displayName = key;\n const val = firstRow[key];\n if (typeof val === 'number') col.sqlBaseType = 'float';\n else if (val instanceof Date) col.sqlBaseType = 'datetime';\n else col.sqlBaseType = 'nvarchar';\n return col;\n });\n }\n table.metadata = {\n entityName: captured.sourceType === 'view' ? captured.sourceName : undefined,\n rowCount: captured.rows.length,\n totalAvailableRows: captured.totalRows,\n fetchedAt: captured.fetchedAt\n };\n return table;\n });\n\n return DataSnapshot.FromTables(tables, this.Component?.title ?? this.Component?.name);\n }\n\n /**\n * Clean up resources\n */\n private cleanup() {\n // Clean up all resources managed by resource manager\n resourceManager.cleanupComponent(this.componentId);\n \n // Clean up prop builder subscriptions\n if (this.currentCallbacks) {\n this.currentCallbacks = null;\n }\n \n // Unmount React root using managed unmount\n if (this.reactRootId) {\n // Force stop rendering flags\n this.isRendering = false;\n this.pendingRender = false;\n \n // This will handle waiting for render completion if needed\n reactRootManager.unmountRoot(this.reactRootId);\n this.reactRootId = null;\n }\n\n // Clear references\n this.compiledComponent = null;\n this.IsInitialized = false;\n this.capturedData = [];\n\n // Trigger registry cleanup (guard: adapter may not be initialized if\n // React bootstrap failed or was destroyed during retry)\n if (this.adapter.isInitialized()) {\n this.adapter.getRegistry().cleanup();\n }\n }\n\n /**\n * Refreshes the component: calls the component's own `refresh()` when it registered one, otherwise re-renders it.\n * Hosts that drive a component from outside (an agent operating it through a realtime channel) use this; a\n * component that manages its own data does not need it.\n */\n Refresh(): void {\n // Check if the component has registered a refresh method\n if (this.compiledComponent?.refresh) {\n this.compiledComponent.refresh();\n } else {\n // Fallback: trigger a re-render if needed\n this.renderComponent();\n }\n }\n\n /** @deprecated Use {@link Refresh}. */\n refresh(): void {\n this.Refresh();\n }\n\n /**\n * Public method to update state programmatically\n * @param path - State path to update\n * @param value - New value\n * @deprecated Components manage their own state now\n */\n updateState(path: string, value: any) {\n // Just emit the event, don't manage state here\n this.StateChange.emit({ path, value });\n }\n\n // =================================================================\n // Standard Component Methods - Strongly Typed\n // =================================================================\n \n /**\n * Gets the current data state of the component.\n * Tries the component's explicit implementation first, then falls back\n * to a DataSnapshot built from intercepted RunView/RunQuery results.\n */\n getCurrentDataState(): DataSnapshot | undefined { // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope\n const explicit = this.compiledComponent?.getCurrentDataState?.();\n if (explicit && typeof explicit === 'object') return explicit;\n return this.buildCapturedDataSnapshot() ?? undefined;\n }\n \n /**\n * Validates the current state of the component\n * @returns true if valid, false or validation errors otherwise\n */\n validate(): boolean | { valid: boolean; errors?: string[] } {\n return this.compiledComponent?.validate?.() || true;\n }\n \n /**\n * Checks if the component has unsaved changes\n * @returns true if dirty, false otherwise\n */\n IsDirty(): boolean {\n return this.compiledComponent?.isDirty?.() || false;\n }\n\n /** @deprecated Use {@link IsDirty}. */\n isDirty(): boolean {\n return this.IsDirty();\n }\n \n /**\n * Resets the component to its initial state\n */\n Reset(): void {\n this.compiledComponent?.reset?.();\n }\n\n /** @deprecated Use {@link Reset}. */\n reset(): void {\n return this.Reset();\n }\n \n /**\n * Scrolls to a specific element or position within the component\n * @param target - Element selector, element reference, or scroll options\n */\n ScrollTo(target: string | HTMLElement | { top?: number; left?: number }): void {\n this.compiledComponent?.scrollTo?.(target);\n }\n\n /** @deprecated Use {@link ScrollTo}. */\n scrollTo(target: string | HTMLElement | { top?: number; left?: number }): void {\n return this.ScrollTo(target);\n }\n \n /**\n * Sets focus to a specific element within the component\n * @param target - Element selector or element reference\n */\n Focus(target?: string | HTMLElement): void {\n this.compiledComponent?.focus?.(target);\n }\n\n /** @deprecated Use {@link Focus}. */\n focus(target?: string | HTMLElement): void {\n return this.Focus(target);\n }\n \n /**\n * Invokes a custom method on the component\n * @param methodName - Name of the method to invoke\n * @param args - Arguments to pass to the method\n * @returns The result of the method call, or undefined if method doesn't exist\n */\n InvokeMethod(methodName: string, ...args: any[]): any {\n return this.compiledComponent?.invokeMethod?.(methodName, ...args);\n }\n\n /** @deprecated Use {@link InvokeMethod}. */\n invokeMethod(methodName: string, ...args: any[]): any {\n return this.InvokeMethod(methodName, ...args);\n }\n \n /**\n * Checks if a method is available on the component\n * @param methodName - Name of the method to check\n * @returns true if the method exists\n */\n HasMethod(methodName: string): boolean {\n return this.compiledComponent?.hasMethod?.(methodName) || false;\n }\n\n /** @deprecated Use {@link HasMethod}. */\n hasMethod(methodName: string): boolean {\n return this.HasMethod(methodName);\n }\n \n /**\n * Print the component content\n * Uses component's print method if available, otherwise uses window.print()\n */\n Print(): void {\n if (this.compiledComponent?.print) {\n this.compiledComponent.print();\n } else if (typeof window !== 'undefined' && window.print) {\n window.print();\n }\n }\n\n /** @deprecated Use {@link Print}. */\n print(): void {\n return this.Print();\n }\n\n /**\n * Force clear component registries\n * Used by Component Studio for fresh loads\n * This is a static method that can be called without a component instance\n */\n public static ForceClearRegistries(): void {\n // Clear React runtime's component registry service\n ComponentRegistryService.reset();\n\n // Clear any cached hierarchy registrar\n if (typeof window !== 'undefined' && (window as any).__MJ_COMPONENT_HIERARCHY_REGISTRAR__) {\n (window as any).__MJ_COMPONENT_HIERARCHY_REGISTRAR__ = null;\n }\n\n console.log('🧹 All component registries cleared for fresh load');\n }\n\n /** @deprecated Use {@link ForceClearRegistries}. */\n public static forceClearRegistries(): void {\n return this.ForceClearRegistries();\n }\n\n /**\n * Gets the current data state from the hosted React component.\n * Falls back to a DataSnapshot built from intercepted RunView/RunQuery results\n * when the component does not explicitly implement getCurrentDataState.\n */\n public GetCurrentDataState(): DataSnapshot | undefined {\n return this.getCurrentDataState();\n }\n\n /**\n * Applies a data state snapshot to the hosted React component.\n * Returns true if the snapshot was successfully applied, false if the\n * component does not support setDataState or the operation failed.\n */\n public SetDataState(snapshot: DataSnapshot): boolean {\n return this.compiledComponent?.setDataState?.(snapshot) ?? false;\n }\n\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-react",
|
|
3
|
-
"version": "6.2.0-edge.
|
|
3
|
+
"version": "6.2.0-edge.4",
|
|
4
4
|
"description": "Angular components for hosting React components in MemberJunction applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,21 +34,21 @@
|
|
|
34
34
|
"styles"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@memberjunction/ai-vectors-memory": "6.2.0-edge.
|
|
38
|
-
"@memberjunction/core": "6.2.0-edge.
|
|
39
|
-
"@memberjunction/core-entities": "6.2.0-edge.
|
|
40
|
-
"@memberjunction/global": "6.2.0-edge.
|
|
41
|
-
"@memberjunction/graphql-dataprovider": "6.2.0-edge.
|
|
42
|
-
"@memberjunction/interactive-component-types": "6.2.0-edge.
|
|
43
|
-
"@memberjunction/ng-notifications": "6.2.0-edge.
|
|
44
|
-
"@memberjunction/react-runtime": "6.2.0-edge.
|
|
37
|
+
"@memberjunction/ai-vectors-memory": "6.2.0-edge.4",
|
|
38
|
+
"@memberjunction/core": "6.2.0-edge.4",
|
|
39
|
+
"@memberjunction/core-entities": "6.2.0-edge.4",
|
|
40
|
+
"@memberjunction/global": "6.2.0-edge.4",
|
|
41
|
+
"@memberjunction/graphql-dataprovider": "6.2.0-edge.4",
|
|
42
|
+
"@memberjunction/interactive-component-types": "6.2.0-edge.4",
|
|
43
|
+
"@memberjunction/ng-notifications": "6.2.0-edge.4",
|
|
44
|
+
"@memberjunction/react-runtime": "6.2.0-edge.4",
|
|
45
45
|
"@babel/standalone": "^7.29.1",
|
|
46
46
|
"react": "^19.2.4",
|
|
47
47
|
"react-dom": "^19.2.4",
|
|
48
48
|
"rxjs": "^7.8.2",
|
|
49
49
|
"@types/react": "^19.2.13",
|
|
50
50
|
"@types/react-dom": "^19.2.3",
|
|
51
|
-
"@memberjunction/ng-base-types": "6.2.0-edge.
|
|
51
|
+
"@memberjunction/ng-base-types": "6.2.0-edge.4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@angular/compiler": "21.2.22",
|