@memberjunction/ng-react 2.90.0 → 2.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/components/mj-react-component.component.js +10 -4
- package/dist/lib/components/mj-react-component.component.js.map +1 -1
- package/dist/lib/services/angular-adapter.service.d.ts +1 -9
- package/dist/lib/services/angular-adapter.service.js +0 -15
- package/dist/lib/services/angular-adapter.service.js.map +1 -1
- package/dist/lib/utilities/runtime-utilities.d.ts +30 -0
- package/dist/lib/utilities/runtime-utilities.js +113 -0
- package/dist/lib/utilities/runtime-utilities.js.map +1 -0
- package/dist/public-api.d.ts +0 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +4 -4
|
@@ -8,8 +8,10 @@ import { Subject } from 'rxjs';
|
|
|
8
8
|
import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
9
9
|
import { ReactBridgeService } from '../services/react-bridge.service';
|
|
10
10
|
import { AngularAdapterService } from '../services/angular-adapter.service';
|
|
11
|
-
import { createErrorBoundary, ComponentHierarchyRegistrar, resourceManager, reactRootManager, SetupStyles
|
|
11
|
+
import { createErrorBoundary, ComponentHierarchyRegistrar, resourceManager, reactRootManager, SetupStyles } from '@memberjunction/react-runtime';
|
|
12
|
+
import { createRuntimeUtilities } from '../utilities/runtime-utilities';
|
|
12
13
|
import { LogError, CompositeKey, Metadata, RunView } from '@memberjunction/core';
|
|
14
|
+
import { ComponentMetadataEngine } from '@memberjunction/core-entities';
|
|
13
15
|
import * as i0 from "@angular/core";
|
|
14
16
|
import * as i1 from "../services/react-bridge.service";
|
|
15
17
|
import * as i2 from "../services/angular-adapter.service";
|
|
@@ -110,11 +112,13 @@ export class MJReactComponent {
|
|
|
110
112
|
// Register component hierarchy
|
|
111
113
|
await this.registerComponentHierarchy();
|
|
112
114
|
// Compile main component with its library dependencies
|
|
115
|
+
await ComponentMetadataEngine.Instance.Config(false, Metadata.Provider.CurrentUser);
|
|
113
116
|
const result = await this.adapter.compileComponent({
|
|
114
117
|
componentName: this.component.name,
|
|
115
118
|
componentCode: this.component.code,
|
|
116
119
|
styles: this.styles,
|
|
117
|
-
libraries: this.component.libraries // Pass library dependencies from ComponentSpec
|
|
120
|
+
libraries: this.component.libraries, // Pass library dependencies from ComponentSpec
|
|
121
|
+
allLibraries: ComponentMetadataEngine.Instance.ComponentLibraries
|
|
118
122
|
});
|
|
119
123
|
if (!result.success) {
|
|
120
124
|
throw new Error(result.error?.message || 'Component compilation failed');
|
|
@@ -272,12 +276,14 @@ export class MJReactComponent {
|
|
|
272
276
|
}
|
|
273
277
|
// Create the hierarchy registrar with adapter's compiler and registry
|
|
274
278
|
const registrar = new ComponentHierarchyRegistrar(this.adapter.getCompiler(), this.adapter.getRegistry(), this.adapter.getRuntimeContext());
|
|
279
|
+
await ComponentMetadataEngine.Instance.Config(false, Metadata.Provider.CurrentUser);
|
|
275
280
|
// Register the entire hierarchy with hash-based version
|
|
276
281
|
const result = await registrar.registerHierarchy(this.component, {
|
|
277
282
|
styles: this.styles, // Skip components use SkipComponentStyles which is a superset
|
|
278
283
|
namespace: 'Global',
|
|
279
284
|
version: version, // Use hash-based version instead of hardcoded 'v1'
|
|
280
|
-
allowOverride: false // Don't override - each version is unique
|
|
285
|
+
allowOverride: false, // Don't override - each version is unique
|
|
286
|
+
allLibraries: ComponentMetadataEngine.Instance.ComponentLibraries
|
|
281
287
|
});
|
|
282
288
|
// Check for errors
|
|
283
289
|
if (!result.success) {
|
|
@@ -570,5 +576,5 @@ export class MJReactComponent {
|
|
|
570
576
|
type: ViewChild,
|
|
571
577
|
args: ['container', { read: ElementRef, static: true }]
|
|
572
578
|
}] }); })();
|
|
573
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJReactComponent, { className: "MJReactComponent", filePath: "lib/components/mj-react-component.component.ts", lineNumber:
|
|
579
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJReactComponent, { className: "MJReactComponent", filePath: "lib/components/mj-react-component.component.ts", lineNumber: 128 }); })();
|
|
574
580
|
//# sourceMappingURL=mj-react-component.component.js.map
|
|
@@ -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,EAAa,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAuC,MAAM,6CAA6C,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAEL,mBAAmB,EACnB,2BAA2B,EAE3B,eAAe,EACf,gBAAgB,EAEhB,WAAW,EACX,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAgB,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;;;;;;IAuCrF,AADF,8BAA6B,aACE;IAC3B,uBAA2C;IAC7C,iBAAM;IACN,8BAA0B;IAAA,oCAAoB;IAChD,AADgD,iBAAM,EAChD;;AAhBd;;;;GAIG;AA8DH,MAAM,OAAO,gBAAgB;IAK3B,IACI,SAAS,CAAC,KAAU;QACtB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IACD,IAAI,SAAS;QACX,kEAAkE;QAClE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,YAAY,GAAG,sBAAsB,EAAE,CAAC;YAC9C,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;YAChD,OAAO,C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;;;;;;;;;;GAYT,mBA6CgB,uBAAuB,CAAC,MAAM;uHAGtC,SAAS;kBAAjB,KAAK;YAKF,SAAS;kBADZ,KAAK;YAiBF,MAAM;kBADT,KAAK;YAeF,iBAAiB;kBADpB,KAAK;YAYI,WAAW;kBAApB,MAAM;YACG,cAAc;kBAAvB,MAAM;YACG,WAAW;kBAApB,MAAM;YACG,gBAAgB;kBAAzB,MAAM;YACG,mBAAmB;kBAA5B,MAAM;YAEqD,SAAS;kBAApE,SAAS;mBAAC,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;;kFArD/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, takeUntil } from 'rxjs';\nimport { ComponentSpec, ComponentCallbacks, ComponentStyles } from '@memberjunction/interactive-component-types';\nimport { ReactBridgeService } from '../services/react-bridge.service';\nimport { AngularAdapterService } from '../services/angular-adapter.service';\nimport { \n buildComponentProps,\n createErrorBoundary,\n ComponentHierarchyRegistrar,\n HierarchyRegistrationResult,\n resourceManager,\n reactRootManager,\n ResolvedComponents,\n SetupStyles,\n createRuntimeUtilities\n} from '@memberjunction/react-runtime';\nimport { LogError, CompositeKey, KeyValuePair, Metadata, RunView } from '@memberjunction/core';\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 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 implements AfterViewInit, OnDestroy {\n @Input() component!: ComponentSpec;\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();\n console.log('MJReactComponent: Auto-initialized utilities using createRuntimeUtilities()');\n }\n return this._utilities;\n }\n \n // Auto-initialize styles if not provided\n private _styles?: Partial<ComponentStyles>;\n @Input()\n set styles(value: Partial<ComponentStyles> | undefined) {\n this._styles = value;\n }\n get styles(): Partial<ComponentStyles> {\n // Lazy initialization - only create default styles when needed\n if (!this._styles) {\n this._styles = SetupStyles();\n console.log('MJReactComponent: Auto-initialized styles using SetupStyles()');\n }\n return this._styles;\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 @Output() stateChange = new EventEmitter<StateChangeEvent>();\n @Output() componentEvent = new EventEmitter<ReactComponentEvent>();\n @Output() refreshData = new EventEmitter<void>();\n @Output() openEntityRecord = new EventEmitter<{ entityName: string; key: CompositeKey }>();\n @Output() userSettingsChanged = new EventEmitter<UserSettingsChangedEvent>();\n \n @ViewChild('container', { read: ElementRef, static: true }) container!: ElementRef<HTMLDivElement>;\n \n private reactRootId: string | null = null;\n private compiledComponent: any = null;\n private destroyed$ = new Subject<void>();\n private currentCallbacks: ComponentCallbacks | null = null;\n isInitialized = false;\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 constructor(\n private reactBridge: ReactBridgeService,\n private adapter: AngularAdapterService,\n private cdr: ChangeDetectorRef\n ) {\n // Generate unique component ID for resource tracking\n this.componentId = `mj-react-component-${Date.now()}-${Math.random()}`;\n }\n\n async ngAfterViewInit() {\n // Trigger change detection to show loading state\n this.cdr.detectChanges();\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.destroyed$.next();\n this.destroyed$.complete();\n this.cleanup();\n }\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 // Register component hierarchy\n await this.registerComponentHierarchy();\n \n // Compile main component with its library dependencies\n const result = await this.adapter.compileComponent({\n componentName: this.component.name,\n componentCode: this.component.code,\n styles: this.styles,\n libraries: this.component.libraries // Pass library dependencies from ComponentSpec\n });\n\n if (!result.success) {\n throw new Error(result.error?.message || 'Component compilation failed');\n }\n\n // Get runtime context and execute component factory\n const context = this.adapter.getRuntimeContext();\n \n // Call the factory function to get the component wrapper\n // result.component is a CompiledComponent object with a 'component' property that's the factory\n const componentWrapper = result.component!.component(context, this.styles);\n \n // Validate the component wrapper 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 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 \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 // 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 } 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 * Generate a hash from component code for versioning\n * Uses a simple hash function that's fast and sufficient for version differentiation\n */\n private generateComponentHash(spec: ComponentSpec): string {\n // Collect all code from the component hierarchy\n const codeStrings: string[] = [];\n \n const collectCode = (s: ComponentSpec) => {\n if (s.code) {\n codeStrings.push(s.code);\n }\n if (s.dependencies) {\n for (const dep of s.dependencies) {\n collectCode(dep);\n }\n }\n };\n \n collectCode(spec);\n \n // Generate hash from concatenated code\n const fullCode = codeStrings.join('|');\n let hash = 0;\n for (let i = 0; i < fullCode.length; i++) {\n const char = fullCode.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n \n // Convert to hex string and take first 8 characters for readability\n const hexHash = Math.abs(hash).toString(16).padStart(8, '0').substring(0, 8);\n return `v${hexHash}`;\n }\n\n /**\n * Resolve components with specific version\n */\n private resolveComponentsWithVersion(spec: ComponentSpec, version: string, namespace: string = 'Global'): ResolvedComponents {\n const resolved: ResolvedComponents = {};\n const registry = this.adapter.getRegistry();\n \n const resolveHierarchy = (s: ComponentSpec, visited: Set<string> = new Set()) => {\n // Prevent circular dependencies\n if (visited.has(s.name)) {\n console.warn(`Circular dependency detected for component: ${s.name}`);\n return;\n }\n visited.add(s.name);\n \n // Get component with specific version\n const component = registry.get(s.name, namespace, version);\n if (component) {\n resolved[s.name] = component;\n console.log(` Resolved ${s.name}@${version}`);\n } else {\n console.warn(` ⚠️ Component not found: ${s.name}@${version}`);\n }\n \n // Process dependencies\n if (s.dependencies) {\n for (const dep of s.dependencies) {\n resolveHierarchy(dep, visited);\n }\n }\n };\n \n console.log(`Resolving components with version ${version}:`);\n resolveHierarchy(spec);\n \n return resolved;\n }\n\n /**\n * Log existing versions of components in registry (for debugging)\n */\n private logExistingVersions(spec: ComponentSpec, namespace: string = 'Global'): void {\n const registry = this.adapter.getRegistry();\n \n // Check for existing versions of this component\n const namespaceComponents = registry.getNamespace(namespace);\n const componentVersions = namespaceComponents.filter(c => c.name === spec.name);\n \n // Log existing versions for awareness\n if (componentVersions.length > 0) {\n console.log(` Found ${componentVersions.length} existing version(s) of ${spec.name}:`);\n componentVersions.forEach(comp => {\n console.log(` - ${comp.name}@${comp.version}`);\n });\n }\n \n // Recursively check dependencies\n if (spec.dependencies) {\n for (const dep of spec.dependencies) {\n const depVersions = namespaceComponents.filter(c => c.name === dep.name);\n if (depVersions.length > 0) {\n console.log(` Found ${depVersions.length} existing version(s) of ${dep.name}:`);\n depVersions.forEach(comp => {\n console.log(` - ${comp.name}@${comp.version}`);\n });\n }\n }\n }\n }\n\n /**\n * Register all components in the hierarchy\n */\n private async registerComponentHierarchy() {\n // Generate unique version based on component code hash\n const version = this.generateComponentHash(this.component);\n this.componentVersion = version; // Store for use in resolver\n \n console.log(`\\n🔄 Registering component hierarchy for ${this.component.name}`);\n console.log(` Version: ${version}`);\n \n // Log existing versions (don't clear - allow multiple versions to coexist)\n this.logExistingVersions(this.component);\n \n // Check if this exact version already exists to avoid re-registration\n const registry = this.adapter.getRegistry();\n const existingComponent = registry.get(this.component.name, 'Global', version);\n if (existingComponent) {\n console.log(` ℹ️ Version ${version} already registered - skipping registration`);\n return;\n }\n \n // Create the hierarchy registrar with adapter's compiler and registry\n const registrar = new ComponentHierarchyRegistrar(\n this.adapter.getCompiler(),\n this.adapter.getRegistry(),\n this.adapter.getRuntimeContext()\n );\n \n // Register the entire hierarchy with hash-based version\n const result: HierarchyRegistrationResult = await registrar.registerHierarchy(\n this.component,\n {\n styles: this.styles as any, // Skip components use SkipComponentStyles which is a superset\n namespace: 'Global',\n version: version, // Use hash-based version instead of hardcoded 'v1'\n allowOverride: false // Don't override - each version is unique\n }\n );\n \n // Check for errors\n if (!result.success) {\n const errorMessages = result.errors.map(e => \n `${e.componentName}: ${e.error}`\n );\n throw new Error(`Component registration failed: ${errorMessages.join(', ')}`);\n }\n \n // Log registered components for debugging\n console.log(`✅ Successfully registered ${result.registeredComponents.length} components with version ${version}:`);\n result.registeredComponents.forEach(name => {\n console.log(` - ${name}@${version}`);\n });\n \n // Also log current registry stats\n const stats = this.adapter.getRegistry().getStats();\n console.log(`📊 Registry stats: ${stats.totalComponents} total components in ${stats.namespaces} namespace(s)\\n`);\n }\n\n /**\n * Render the React component\n */\n private 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 // Manually resolve components with the correct version\n const components = this.resolveComponentsWithVersion(this.component, this.componentVersion);\n \n // Create callbacks once per component instance\n if (!this.currentCallbacks) {\n this.currentCallbacks = this.createCallbacks();\n }\n \n // Build props with savedUserSettings pattern\n const props = {\n utilities: this.utilities, // Now uses getter which auto-initializes if needed\n callbacks: this.currentCallbacks,\n components,\n styles: this.styles as any,\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 // 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\n const element = React.createElement(\n ErrorBoundary,\n null,\n React.createElement(this.compiledComponent.component, props)\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 OpenEntityRecord: async (entityName: string, key: CompositeKey) => {\n let keyToUse: CompositeKey | null = null;\n if (key instanceof Array) {\n keyToUse = CompositeKey.FromKeyValuePairs(key);\n }\n else if (typeof key === 'object' && !!key.GetValueByFieldName) {\n keyToUse = key as CompositeKey;\n }\n else if (typeof key === 'object') {\n //} && !!key.FieldName && !!key.Value) {\n // possible that have an object that is a simple key/value pair with\n // FieldName and value properties\n const keyAny = key as any;\n if (keyAny.FieldName && keyAny.Value) {\n keyToUse = CompositeKey.FromKeyValuePairs([keyAny as KeyValuePair]);\n }\n }\n if (keyToUse) {\n // now in some cases we have key/value pairs that the component we are hosting\n // use, but are not the pkey, so if that is the case, we'll run a quick view to try\n // and get the pkey so that we can emit the openEntityRecord call with the pkey\n const md = new Metadata();\n const e = md.EntityByName(entityName);\n let shouldRunView = false;\n // now check each key in the keyToUse to see if it is a pkey\n for (const singleKey of keyToUse.KeyValuePairs) {\n const field = e.Fields.find(f => f.Name.trim().toLowerCase() === singleKey.FieldName.trim().toLowerCase());\n if (!field) {\n // if we get here this is a problem, the component has given us a non-matching field, this shouldn't ever happen\n // but if it doesn't log warning to console and exit\n console.warn(`Non-matching field found for key: ${JSON.stringify(keyToUse)}`);\n return;\n }\n else if (!field.IsPrimaryKey) {\n // if we get here that means we have a non-pkey so we'll want to do a lookup via a RunView\n // to get the actual pkey value\n shouldRunView = true;\n break;\n }\n }\n\n // if we get here and shouldRunView is true, we need to run a view using the info provided\n // by our contained component to get the pkey\n if (shouldRunView) {\n const rv = new RunView();\n const result = await rv.RunView({\n EntityName: entityName,\n ExtraFilter: keyToUse.ToWhereClause()\n })\n if (result && result.Success && result.Results.length > 0) {\n // we have a match, use the first row and update our keyToUse\n const kvPairs: KeyValuePair[] = [];\n e.PrimaryKeys.forEach(pk => {\n kvPairs.push(\n {\n FieldName: pk.Name,\n Value: result.Results[0][pk.Name]\n }\n )\n })\n keyToUse = CompositeKey.FromKeyValuePairs(kvPairs);\n }\n }\n\n this.openEntityRecord.emit({ entityName, key: keyToUse });\n } \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 * This implements the SavedUserSettings pattern\n */\n private handleSaveUserSettings(newSettings: Record<string, any>) {\n // Just bubble the event up to parent containers for persistence\n // We don't need to store anything here\n this.userSettingsChanged.emit({\n settings: newSettings,\n componentName: this.component?.name,\n timestamp: new Date()\n });\n \n // DO NOT re-render the component!\n // The component already has the correct state - it's the one that told us about the change.\n // Re-rendering would cause unnecessary DOM updates and visual flashing.\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\n // Trigger registry cleanup\n this.adapter.getRegistry().cleanup();\n }\n\n /**\n * Public method to refresh the component\n * @deprecated Components manage their own state and data now\n */\n refresh() {\n // Just trigger a re-render if needed\n this.renderComponent();\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}"]}
|
|
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,EAC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;;YAT8C,cAAgC;YAAhC,6CAAgC;YAClF,eAOC;YAPD,8DAOC;;;iFAiDM,gBAAgB;cA7D5B,SAAS;2BACE,oBAAoB,YACpB;;;;;;;;;;;;GAYT,mBA6CgB,uBAAuB,CAAC,MAAM;uHAGtC,SAAS;kBAAjB,KAAK;YAKF,SAAS;kBADZ,KAAK;YAiBF,MAAM;kBADT,KAAK;YAeF,iBAAiB;kBADpB,KAAK;YAYI,WAAW;kBAApB,MAAM;YACG,cAAc;kBAAvB,MAAM;YACG,WAAW;kBAApB,MAAM;YACG,gBAAgB;kBAAzB,MAAM;YACG,mBAAmB;kBAA5B,MAAM;YAEqD,SAAS;kBAApE,SAAS;mBAAC,WAAW,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;;kFArD/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, takeUntil } from 'rxjs';\nimport { ComponentSpec, ComponentCallbacks, ComponentStyles } from '@memberjunction/interactive-component-types';\nimport { ReactBridgeService } from '../services/react-bridge.service';\nimport { AngularAdapterService } from '../services/angular-adapter.service';\nimport { \n buildComponentProps,\n createErrorBoundary,\n ComponentHierarchyRegistrar,\n HierarchyRegistrationResult,\n resourceManager,\n reactRootManager,\n ResolvedComponents,\n SetupStyles\n} from '@memberjunction/react-runtime';\nimport { createRuntimeUtilities } from '../utilities/runtime-utilities';\nimport { LogError, CompositeKey, KeyValuePair, Metadata, RunView } from '@memberjunction/core';\nimport { ComponentMetadataEngine } from '@memberjunction/core-entities';\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 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 implements AfterViewInit, OnDestroy {\n @Input() component!: ComponentSpec;\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();\n console.log('MJReactComponent: Auto-initialized utilities using createRuntimeUtilities()');\n }\n return this._utilities;\n }\n \n // Auto-initialize styles if not provided\n private _styles?: Partial<ComponentStyles>;\n @Input()\n set styles(value: Partial<ComponentStyles> | undefined) {\n this._styles = value;\n }\n get styles(): Partial<ComponentStyles> {\n // Lazy initialization - only create default styles when needed\n if (!this._styles) {\n this._styles = SetupStyles();\n console.log('MJReactComponent: Auto-initialized styles using SetupStyles()');\n }\n return this._styles;\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 @Output() stateChange = new EventEmitter<StateChangeEvent>();\n @Output() componentEvent = new EventEmitter<ReactComponentEvent>();\n @Output() refreshData = new EventEmitter<void>();\n @Output() openEntityRecord = new EventEmitter<{ entityName: string; key: CompositeKey }>();\n @Output() userSettingsChanged = new EventEmitter<UserSettingsChangedEvent>();\n \n @ViewChild('container', { read: ElementRef, static: true }) container!: ElementRef<HTMLDivElement>;\n \n private reactRootId: string | null = null;\n private compiledComponent: any = null;\n private destroyed$ = new Subject<void>();\n private currentCallbacks: ComponentCallbacks | null = null;\n isInitialized = false;\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 constructor(\n private reactBridge: ReactBridgeService,\n private adapter: AngularAdapterService,\n private cdr: ChangeDetectorRef\n ) {\n // Generate unique component ID for resource tracking\n this.componentId = `mj-react-component-${Date.now()}-${Math.random()}`;\n }\n\n async ngAfterViewInit() {\n // Trigger change detection to show loading state\n this.cdr.detectChanges();\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.destroyed$.next();\n this.destroyed$.complete();\n this.cleanup();\n }\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 // Register component hierarchy\n await this.registerComponentHierarchy();\n \n // Compile main component with its library dependencies\n await ComponentMetadataEngine.Instance.Config(false, Metadata.Provider.CurrentUser);\n const result = await this.adapter.compileComponent({\n componentName: this.component.name,\n componentCode: this.component.code,\n styles: this.styles as ComponentStyles,\n libraries: this.component.libraries, // Pass library dependencies from ComponentSpec\n allLibraries: ComponentMetadataEngine.Instance.ComponentLibraries\n });\n\n if (!result.success) {\n throw new Error(result.error?.message || 'Component compilation failed');\n }\n\n // Get runtime context and execute component factory\n const context = this.adapter.getRuntimeContext();\n \n // Call the factory function to get the component wrapper\n // result.component is a CompiledComponent object with a 'component' property that's the factory\n const componentWrapper = result.component!.component(context, this.styles);\n \n // Validate the component wrapper 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 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 \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 // 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 } 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 * Generate a hash from component code for versioning\n * Uses a simple hash function that's fast and sufficient for version differentiation\n */\n private generateComponentHash(spec: ComponentSpec): string {\n // Collect all code from the component hierarchy\n const codeStrings: string[] = [];\n \n const collectCode = (s: ComponentSpec) => {\n if (s.code) {\n codeStrings.push(s.code);\n }\n if (s.dependencies) {\n for (const dep of s.dependencies) {\n collectCode(dep);\n }\n }\n };\n \n collectCode(spec);\n \n // Generate hash from concatenated code\n const fullCode = codeStrings.join('|');\n let hash = 0;\n for (let i = 0; i < fullCode.length; i++) {\n const char = fullCode.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n \n // Convert to hex string and take first 8 characters for readability\n const hexHash = Math.abs(hash).toString(16).padStart(8, '0').substring(0, 8);\n return `v${hexHash}`;\n }\n\n /**\n * Resolve components with specific version\n */\n private resolveComponentsWithVersion(spec: ComponentSpec, version: string, namespace: string = 'Global'): ResolvedComponents {\n const resolved: ResolvedComponents = {};\n const registry = this.adapter.getRegistry();\n \n const resolveHierarchy = (s: ComponentSpec, visited: Set<string> = new Set()) => {\n // Prevent circular dependencies\n if (visited.has(s.name)) {\n console.warn(`Circular dependency detected for component: ${s.name}`);\n return;\n }\n visited.add(s.name);\n \n // Get component with specific version\n const component = registry.get(s.name, namespace, version);\n if (component) {\n resolved[s.name] = component;\n console.log(` Resolved ${s.name}@${version}`);\n } else {\n console.warn(` ⚠️ Component not found: ${s.name}@${version}`);\n }\n \n // Process dependencies\n if (s.dependencies) {\n for (const dep of s.dependencies) {\n resolveHierarchy(dep, visited);\n }\n }\n };\n \n console.log(`Resolving components with version ${version}:`);\n resolveHierarchy(spec);\n \n return resolved;\n }\n\n /**\n * Log existing versions of components in registry (for debugging)\n */\n private logExistingVersions(spec: ComponentSpec, namespace: string = 'Global'): void {\n const registry = this.adapter.getRegistry();\n \n // Check for existing versions of this component\n const namespaceComponents = registry.getNamespace(namespace);\n const componentVersions = namespaceComponents.filter(c => c.name === spec.name);\n \n // Log existing versions for awareness\n if (componentVersions.length > 0) {\n console.log(` Found ${componentVersions.length} existing version(s) of ${spec.name}:`);\n componentVersions.forEach(comp => {\n console.log(` - ${comp.name}@${comp.version}`);\n });\n }\n \n // Recursively check dependencies\n if (spec.dependencies) {\n for (const dep of spec.dependencies) {\n const depVersions = namespaceComponents.filter(c => c.name === dep.name);\n if (depVersions.length > 0) {\n console.log(` Found ${depVersions.length} existing version(s) of ${dep.name}:`);\n depVersions.forEach(comp => {\n console.log(` - ${comp.name}@${comp.version}`);\n });\n }\n }\n }\n }\n\n /**\n * Register all components in the hierarchy\n */\n private async registerComponentHierarchy() {\n // Generate unique version based on component code hash\n const version = this.generateComponentHash(this.component);\n this.componentVersion = version; // Store for use in resolver\n \n console.log(`\\n🔄 Registering component hierarchy for ${this.component.name}`);\n console.log(` Version: ${version}`);\n \n // Log existing versions (don't clear - allow multiple versions to coexist)\n this.logExistingVersions(this.component);\n \n // Check if this exact version already exists to avoid re-registration\n const registry = this.adapter.getRegistry();\n const existingComponent = registry.get(this.component.name, 'Global', version);\n if (existingComponent) {\n console.log(` ℹ️ Version ${version} already registered - skipping registration`);\n return;\n }\n \n // Create the hierarchy registrar with adapter's compiler and registry\n const registrar = new ComponentHierarchyRegistrar(\n this.adapter.getCompiler(),\n this.adapter.getRegistry(),\n this.adapter.getRuntimeContext()\n );\n \n await ComponentMetadataEngine.Instance.Config(false, Metadata.Provider.CurrentUser);\n // Register the entire hierarchy with hash-based version\n const result: HierarchyRegistrationResult = await registrar.registerHierarchy(\n this.component,\n {\n styles: this.styles as any, // Skip components use SkipComponentStyles which is a superset\n namespace: 'Global',\n version: version, // Use hash-based version instead of hardcoded 'v1'\n allowOverride: false, // Don't override - each version is unique\n allLibraries: ComponentMetadataEngine.Instance.ComponentLibraries\n }\n );\n \n // Check for errors\n if (!result.success) {\n const errorMessages = result.errors.map(e => \n `${e.componentName}: ${e.error}`\n );\n throw new Error(`Component registration failed: ${errorMessages.join(', ')}`);\n }\n \n // Log registered components for debugging\n console.log(`✅ Successfully registered ${result.registeredComponents.length} components with version ${version}:`);\n result.registeredComponents.forEach(name => {\n console.log(` - ${name}@${version}`);\n });\n \n // Also log current registry stats\n const stats = this.adapter.getRegistry().getStats();\n console.log(`📊 Registry stats: ${stats.totalComponents} total components in ${stats.namespaces} namespace(s)\\n`);\n }\n\n /**\n * Render the React component\n */\n private 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 // Manually resolve components with the correct version\n const components = this.resolveComponentsWithVersion(this.component, this.componentVersion);\n \n // Create callbacks once per component instance\n if (!this.currentCallbacks) {\n this.currentCallbacks = this.createCallbacks();\n }\n \n // Build props with savedUserSettings pattern\n const props = {\n utilities: this.utilities, // Now uses getter which auto-initializes if needed\n callbacks: this.currentCallbacks,\n components,\n styles: this.styles as any,\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 // 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\n const element = React.createElement(\n ErrorBoundary,\n null,\n React.createElement(this.compiledComponent.component, props)\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 OpenEntityRecord: async (entityName: string, key: CompositeKey) => {\n let keyToUse: CompositeKey | null = null;\n if (key instanceof Array) {\n keyToUse = CompositeKey.FromKeyValuePairs(key);\n }\n else if (typeof key === 'object' && !!key.GetValueByFieldName) {\n keyToUse = key as CompositeKey;\n }\n else if (typeof key === 'object') {\n //} && !!key.FieldName && !!key.Value) {\n // possible that have an object that is a simple key/value pair with\n // FieldName and value properties\n const keyAny = key as any;\n if (keyAny.FieldName && keyAny.Value) {\n keyToUse = CompositeKey.FromKeyValuePairs([keyAny as KeyValuePair]);\n }\n }\n if (keyToUse) {\n // now in some cases we have key/value pairs that the component we are hosting\n // use, but are not the pkey, so if that is the case, we'll run a quick view to try\n // and get the pkey so that we can emit the openEntityRecord call with the pkey\n const md = new Metadata();\n const e = md.EntityByName(entityName);\n let shouldRunView = false;\n // now check each key in the keyToUse to see if it is a pkey\n for (const singleKey of keyToUse.KeyValuePairs) {\n const field = e.Fields.find(f => f.Name.trim().toLowerCase() === singleKey.FieldName.trim().toLowerCase());\n if (!field) {\n // if we get here this is a problem, the component has given us a non-matching field, this shouldn't ever happen\n // but if it doesn't log warning to console and exit\n console.warn(`Non-matching field found for key: ${JSON.stringify(keyToUse)}`);\n return;\n }\n else if (!field.IsPrimaryKey) {\n // if we get here that means we have a non-pkey so we'll want to do a lookup via a RunView\n // to get the actual pkey value\n shouldRunView = true;\n break;\n }\n }\n\n // if we get here and shouldRunView is true, we need to run a view using the info provided\n // by our contained component to get the pkey\n if (shouldRunView) {\n const rv = new RunView();\n const result = await rv.RunView({\n EntityName: entityName,\n ExtraFilter: keyToUse.ToWhereClause()\n })\n if (result && result.Success && result.Results.length > 0) {\n // we have a match, use the first row and update our keyToUse\n const kvPairs: KeyValuePair[] = [];\n e.PrimaryKeys.forEach(pk => {\n kvPairs.push(\n {\n FieldName: pk.Name,\n Value: result.Results[0][pk.Name]\n }\n )\n })\n keyToUse = CompositeKey.FromKeyValuePairs(kvPairs);\n }\n }\n\n this.openEntityRecord.emit({ entityName, key: keyToUse });\n } \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 * This implements the SavedUserSettings pattern\n */\n private handleSaveUserSettings(newSettings: Record<string, any>) {\n // Just bubble the event up to parent containers for persistence\n // We don't need to store anything here\n this.userSettingsChanged.emit({\n settings: newSettings,\n componentName: this.component?.name,\n timestamp: new Date()\n });\n \n // DO NOT re-render the component!\n // The component already has the correct state - it's the one that told us about the change.\n // Re-rendering would cause unnecessary DOM updates and visual flashing.\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\n // Trigger registry cleanup\n this.adapter.getRegistry().cleanup();\n }\n\n /**\n * Public method to refresh the component\n * @deprecated Components manage their own state and data now\n */\n refresh() {\n // Just trigger a re-render if needed\n this.renderComponent();\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}"]}
|
|
@@ -37,20 +37,12 @@ export declare class AngularAdapterService {
|
|
|
37
37
|
* @returns Runtime context with React and libraries
|
|
38
38
|
*/
|
|
39
39
|
getRuntimeContext(): RuntimeContext;
|
|
40
|
-
/**
|
|
41
|
-
* Convert SkipComponentStyles to ComponentStyles
|
|
42
|
-
* @param skipStyles - Skip component styles
|
|
43
|
-
* @returns Component styles for React runtime
|
|
44
|
-
*/
|
|
45
|
-
private convertStyles;
|
|
46
40
|
/**
|
|
47
41
|
* Compile a component with Angular-specific defaults
|
|
48
42
|
* @param options - Compilation options
|
|
49
43
|
* @returns Promise resolving to compilation result
|
|
50
44
|
*/
|
|
51
|
-
compileComponent(options: CompileOptions
|
|
52
|
-
styles?: any;
|
|
53
|
-
}): Promise<import("@memberjunction/react-runtime").CompilationResult>;
|
|
45
|
+
compileComponent(options: CompileOptions): Promise<import("@memberjunction/react-runtime").CompilationResult>;
|
|
54
46
|
/**
|
|
55
47
|
* Register a component in the registry
|
|
56
48
|
* @param name - Component name
|
|
@@ -92,21 +92,6 @@ export class AngularAdapterService {
|
|
|
92
92
|
}
|
|
93
93
|
return this.runtimeContext;
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Convert SkipComponentStyles to ComponentStyles
|
|
97
|
-
* @param skipStyles - Skip component styles
|
|
98
|
-
* @returns Component styles for React runtime
|
|
99
|
-
*/
|
|
100
|
-
convertStyles(skipStyles) {
|
|
101
|
-
if (!skipStyles)
|
|
102
|
-
return undefined;
|
|
103
|
-
// Extract CSS-compatible properties
|
|
104
|
-
return {
|
|
105
|
-
className: skipStyles.className,
|
|
106
|
-
style: skipStyles.style,
|
|
107
|
-
globalCss: skipStyles.globalCss
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
95
|
/**
|
|
111
96
|
* Compile a component with Angular-specific defaults
|
|
112
97
|
* @param options - Compilation options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-adapter.service.js","sourceRoot":"","sources":["../../../src/lib/services/angular-adapter.service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAIL,kBAAkB,EAMnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;;;AAEnD;;;GAGG;AAEH,MAAM,OAAO,qBAAqB;IAShC,YAAoB,YAAiC;QAAjC,iBAAY,GAAZ,YAAY,CAAqB;IAAG,CAAC;IAEzD;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CACd,MAA6B,EAC7B,mBAA6C;QAE7C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,sBAAsB;QAChC,CAAC;QAED,0DAA0D;QAC1D,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAE1F,yBAAyB;QACzB,IAAI,CAAC,cAAc,GAAG;YACpB,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,QAAQ,EAAE,SAAS,CAAC,QAAQ;YAC5B,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,SAAS,EAAE;YACT,0CAA0C;aAC3C;SACF,CAAC;QAEF,2BAA2B;QAC3B,IAAI,CAAC,OAAO,GAAG,kBAAkB,CAAC,SAAS,CAAC,KAAK,EAAE;YACjD,QAAQ,EAAE;gBACR,KAAK,EAAE,IAAI;gBACX,YAAY,EAAE,GAAG;aAClB;YACD,QAAQ,EAAE;gBACR,aAAa,EAAE,IAAI;gBACnB,eAAe,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AI,CAAC;QACrB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;sFAvPU,qBAAqB;uEAArB,qBAAqB,WAArB,qBAAqB,mBADR,MAAM;;iFACnB,qBAAqB;cADjC,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["/**\n * @fileoverview Angular adapter service that bridges the React runtime with Angular.\n * Provides Angular-specific functionality for the platform-agnostic React runtime.\n * @module @memberjunction/ng-react\n */\n\nimport { Injectable } from '@angular/core';\nimport { \n ComponentCompiler,\n ComponentRegistry,\n ComponentResolver,\n createReactRuntime,\n CompileOptions,\n RuntimeContext,\n ComponentStyles,\n ExternalLibraryConfig,\n LibraryConfiguration\n} from '@memberjunction/react-runtime';\nimport { ScriptLoaderService } from './script-loader.service';\nimport { DEFAULT_STYLES } from '../default-styles';\n\n/**\n * Angular-specific adapter for the React runtime.\n * Manages the integration between Angular services and the platform-agnostic React runtime.\n */\n@Injectable({ providedIn: 'root' })\nexport class AngularAdapterService {\n private runtime?: {\n compiler: ComponentCompiler;\n registry: ComponentRegistry;\n resolver: ComponentResolver;\n version: string;\n };\n private runtimeContext?: RuntimeContext;\n\n constructor(private scriptLoader: ScriptLoaderService) {}\n\n /**\n * Initialize the React runtime with Angular-specific configuration\n * @param config Optional library configuration\n * @param additionalLibraries Optional additional libraries to merge\n * @returns Promise resolving when runtime is ready\n */\n async initialize(\n config?: LibraryConfiguration,\n additionalLibraries?: ExternalLibraryConfig[]\n ): Promise<void> {\n if (this.runtime) {\n return; // Already initialized\n }\n\n // Load React ecosystem with optional additional libraries\n const ecosystem = await this.scriptLoader.loadReactEcosystem(config, additionalLibraries);\n \n // Create runtime context\n this.runtimeContext = {\n React: ecosystem.React,\n ReactDOM: ecosystem.ReactDOM,\n libraries: ecosystem.libraries,\n utilities: {\n // Add any Angular-specific utilities here\n }\n };\n\n // Create the React runtime\n this.runtime = createReactRuntime(ecosystem.Babel, {\n compiler: {\n cache: true,\n maxCacheSize: 100\n },\n registry: {\n maxComponents: 1000,\n cleanupInterval: 60000,\n useLRU: true,\n enableNamespaces: true\n }\n });\n }\n\n /**\n * Get the component compiler\n * @returns Component compiler instance\n */\n getCompiler(): ComponentCompiler {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.compiler;\n }\n\n /**\n * Get the component registry\n * @returns Component registry instance\n */\n getRegistry(): ComponentRegistry {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry;\n }\n\n /**\n * Get the component resolver\n * @returns Component resolver instance\n */\n getResolver(): ComponentResolver {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.resolver;\n }\n\n /**\n * Get the runtime context\n * @returns Runtime context with React and libraries\n */\n getRuntimeContext(): RuntimeContext {\n if (!this.runtimeContext) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtimeContext;\n }\n\n /**\n * Convert SkipComponentStyles to ComponentStyles\n * @param skipStyles - Skip component styles\n * @returns Component styles for React runtime\n */\n private convertStyles(skipStyles?: any): ComponentStyles | undefined {\n if (!skipStyles) return undefined;\n \n // Extract CSS-compatible properties\n return {\n className: skipStyles.className,\n style: skipStyles.style,\n globalCss: skipStyles.globalCss\n };\n }\n\n /**\n * Compile a component with Angular-specific defaults\n * @param options - Compilation options\n * @returns Promise resolving to compilation result\n */\n async compileComponent(options: CompileOptions & { styles?: any }) {\n // Validate options before initialization\n if (!options) {\n throw new Error(\n 'Angular adapter error: No compilation options provided.\\n' +\n 'This usually means the component spec is null or undefined.\\n' +\n 'Please check that:\\n' +\n '1. Your component data is loaded properly\\n' +\n '2. The component spec has \"name\" and \"code\" properties\\n' +\n '3. The component input is not undefined'\n );\n }\n\n if (!options.componentName || options.componentName.trim() === '') {\n throw new Error(\n 'Angular adapter error: Component name is missing or empty.\\n' +\n `Received options: ${JSON.stringify(options, null, 2)}\\n` +\n 'Make sure your component spec includes a \"name\" property.'\n );\n }\n\n if (!options.componentCode || options.componentCode.trim() === '') {\n throw new Error(\n `Angular adapter error: Component code is missing or empty for component \"${options.componentName}\".\\n` +\n 'Make sure your component spec includes a \"code\" property with the React component source.'\n );\n }\n\n await this.initialize();\n \n // Apply default styles if not provided\n const optionsWithDefaults = {\n ...options,\n styles: options.styles || DEFAULT_STYLES\n };\n\n return this.runtime!.compiler.compile(optionsWithDefaults);\n }\n\n /**\n * Register a component in the registry\n * @param name - Component name\n * @param component - Compiled component\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Component metadata\n */\n registerComponent(\n name: string,\n component: any,\n namespace: string = 'Global',\n version: string = 'v1'\n ) {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry.register(name, component, namespace, version);\n }\n\n /**\n * Get a component from the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Component if found\n */\n getComponent(name: string, namespace: string = 'Global', version?: string) {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry.get(name, namespace, version);\n }\n\n /**\n * Check if runtime is initialized\n * @returns true if initialized\n */\n isInitialized(): boolean {\n return !!this.runtime && !!this.runtimeContext;\n }\n\n /**\n * Get runtime version\n * @returns Runtime version string\n */\n getVersion(): string {\n return this.runtime?.version || 'unknown';\n }\n\n /**\n * Clean up resources\n */\n destroy(): void {\n if (this.runtime) {\n this.runtime.registry.destroy();\n this.runtime = undefined;\n this.runtimeContext = undefined;\n }\n }\n\n /**\n * Get Babel instance for direct use\n * @returns Babel instance\n */\n getBabel(): any {\n return this.runtimeContext?.libraries?.Babel || (window as any).Babel;\n }\n\n /**\n * Transpile JSX code directly\n * @param code - JSX code to transpile\n * @param filename - Optional filename for better error messages\n * @returns Transpiled JavaScript code\n */\n transpileJSX(code: string, filename?: string): string {\n const babel = this.getBabel();\n if (!babel) {\n throw new Error('Babel not loaded. Initialize the runtime first.');\n }\n\n try {\n const result = babel.transform(code, {\n presets: ['react'],\n filename: filename || 'component.jsx'\n });\n return result.code;\n } catch (error: any) {\n throw new Error(`Failed to transpile JSX: ${error.message}`);\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"angular-adapter.service.js","sourceRoot":"","sources":["../../../src/lib/services/angular-adapter.service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAIL,kBAAkB,EAKnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;;;AAGnD;;;GAGG;AAEH,MAAM,OAAO,qBAAqB;IAShC,YAAoB,YAAiC;QAAjC,iBAAY,GAAZ,YAAY,CAAqB;IAAG,CAAC;IAEzD;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CACd,MAA6B,EAC7B,mBAA6C;QAE7C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,sBAAsB;QAChC,CAAC;QAED,0DAA0D;QAC1D,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAE1F,yBAAyB;QACzB,IAAI,CAAC,cAAc,GAAG;YACpB,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,QAAQ,EAAE,SAAS,CAAC,QAAQ;YAC5B,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,SAAS,EAAE;YACT,0CAA0C;aAC3C;SACF,CAAC;QAEF,2BAA2B;QAC3B,IAAI,CAAC,OAAO,GAAG,kBAAkB,CAAC,SAAS,CAAC,KAAK,EAAE;YACjD,QAAQ,EAAE;gBACR,KAAK,EAAE,IAAI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,qBAAqB;uEAArB,qBAAqB,WAArB,qBAAqB,mBADR,MAAM;;iFACnB,qBAAqB;cADjC,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["/**\n * @fileoverview Angular adapter service that bridges the React runtime with Angular.\n * Provides Angular-specific functionality for the platform-agnostic React runtime.\n * @module @memberjunction/ng-react\n */\n\nimport { Injectable } from '@angular/core';\nimport { \n ComponentCompiler,\n ComponentRegistry,\n ComponentResolver,\n createReactRuntime,\n CompileOptions,\n RuntimeContext,\n ExternalLibraryConfig,\n LibraryConfiguration\n} from '@memberjunction/react-runtime';\nimport { ScriptLoaderService } from './script-loader.service';\nimport { DEFAULT_STYLES } from '../default-styles';\nimport { ComponentStyles } from '@memberjunction/interactive-component-types';\n\n/**\n * Angular-specific adapter for the React runtime.\n * Manages the integration between Angular services and the platform-agnostic React runtime.\n */\n@Injectable({ providedIn: 'root' })\nexport class AngularAdapterService {\n private runtime?: {\n compiler: ComponentCompiler;\n registry: ComponentRegistry;\n resolver: ComponentResolver;\n version: string;\n };\n private runtimeContext?: RuntimeContext;\n\n constructor(private scriptLoader: ScriptLoaderService) {}\n\n /**\n * Initialize the React runtime with Angular-specific configuration\n * @param config Optional library configuration\n * @param additionalLibraries Optional additional libraries to merge\n * @returns Promise resolving when runtime is ready\n */\n async initialize(\n config?: LibraryConfiguration,\n additionalLibraries?: ExternalLibraryConfig[]\n ): Promise<void> {\n if (this.runtime) {\n return; // Already initialized\n }\n\n // Load React ecosystem with optional additional libraries\n const ecosystem = await this.scriptLoader.loadReactEcosystem(config, additionalLibraries);\n \n // Create runtime context\n this.runtimeContext = {\n React: ecosystem.React,\n ReactDOM: ecosystem.ReactDOM,\n libraries: ecosystem.libraries,\n utilities: {\n // Add any Angular-specific utilities here\n }\n };\n\n // Create the React runtime\n this.runtime = createReactRuntime(ecosystem.Babel, {\n compiler: {\n cache: true,\n maxCacheSize: 100\n },\n registry: {\n maxComponents: 1000,\n cleanupInterval: 60000,\n useLRU: true,\n enableNamespaces: true\n }\n });\n }\n\n /**\n * Get the component compiler\n * @returns Component compiler instance\n */\n getCompiler(): ComponentCompiler {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.compiler;\n }\n\n /**\n * Get the component registry\n * @returns Component registry instance\n */\n getRegistry(): ComponentRegistry {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry;\n }\n\n /**\n * Get the component resolver\n * @returns Component resolver instance\n */\n getResolver(): ComponentResolver {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.resolver;\n }\n\n /**\n * Get the runtime context\n * @returns Runtime context with React and libraries\n */\n getRuntimeContext(): RuntimeContext {\n if (!this.runtimeContext) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtimeContext;\n }\n\n\n /**\n * Compile a component with Angular-specific defaults\n * @param options - Compilation options\n * @returns Promise resolving to compilation result\n */\n async compileComponent(options: CompileOptions) {\n // Validate options before initialization\n if (!options) {\n throw new Error(\n 'Angular adapter error: No compilation options provided.\\n' +\n 'This usually means the component spec is null or undefined.\\n' +\n 'Please check that:\\n' +\n '1. Your component data is loaded properly\\n' +\n '2. The component spec has \"name\" and \"code\" properties\\n' +\n '3. The component input is not undefined'\n );\n }\n\n if (!options.componentName || options.componentName.trim() === '') {\n throw new Error(\n 'Angular adapter error: Component name is missing or empty.\\n' +\n `Received options: ${JSON.stringify(options, null, 2)}\\n` +\n 'Make sure your component spec includes a \"name\" property.'\n );\n }\n\n if (!options.componentCode || options.componentCode.trim() === '') {\n throw new Error(\n `Angular adapter error: Component code is missing or empty for component \"${options.componentName}\".\\n` +\n 'Make sure your component spec includes a \"code\" property with the React component source.'\n );\n }\n\n await this.initialize();\n \n // Apply default styles if not provided\n const optionsWithDefaults = {\n ...options,\n styles: options.styles || DEFAULT_STYLES\n };\n\n return this.runtime!.compiler.compile(optionsWithDefaults);\n }\n\n /**\n * Register a component in the registry\n * @param name - Component name\n * @param component - Compiled component\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Component metadata\n */\n registerComponent(\n name: string,\n component: any,\n namespace: string = 'Global',\n version: string = 'v1'\n ) {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry.register(name, component, namespace, version);\n }\n\n /**\n * Get a component from the registry\n * @param name - Component name\n * @param namespace - Component namespace\n * @param version - Component version\n * @returns Component if found\n */\n getComponent(name: string, namespace: string = 'Global', version?: string) {\n if (!this.runtime) {\n throw new Error('React runtime not initialized. Call initialize() first.');\n }\n return this.runtime.registry.get(name, namespace, version);\n }\n\n /**\n * Check if runtime is initialized\n * @returns true if initialized\n */\n isInitialized(): boolean {\n return !!this.runtime && !!this.runtimeContext;\n }\n\n /**\n * Get runtime version\n * @returns Runtime version string\n */\n getVersion(): string {\n return this.runtime?.version || 'unknown';\n }\n\n /**\n * Clean up resources\n */\n destroy(): void {\n if (this.runtime) {\n this.runtime.registry.destroy();\n this.runtime = undefined;\n this.runtimeContext = undefined;\n }\n }\n\n /**\n * Get Babel instance for direct use\n * @returns Babel instance\n */\n getBabel(): any {\n return this.runtimeContext?.libraries?.Babel || (window as any).Babel;\n }\n\n /**\n * Transpile JSX code directly\n * @param code - JSX code to transpile\n * @param filename - Optional filename for better error messages\n * @returns Transpiled JavaScript code\n */\n transpileJSX(code: string, filename?: string): string {\n const babel = this.getBabel();\n if (!babel) {\n throw new Error('Babel not loaded. Initialize the runtime first.');\n }\n\n try {\n const result = babel.transform(code, {\n presets: ['react'],\n filename: filename || 'component.jsx'\n });\n return result.code;\n } catch (error: any) {\n throw new Error(`Failed to transpile JSX: ${error.message}`);\n }\n }\n}"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Runtime utilities for React components providing access to MemberJunction core functionality
|
|
3
|
+
* @module @memberjunction/ng-react/utilities
|
|
4
|
+
*/
|
|
5
|
+
import { ComponentUtilities } from '@memberjunction/interactive-component-types';
|
|
6
|
+
/**
|
|
7
|
+
* Base class for providing runtime utilities to React components in Angular.
|
|
8
|
+
* This class can be extended and registered with MJ's ClassFactory
|
|
9
|
+
* to provide custom implementations of data access methods.
|
|
10
|
+
*/
|
|
11
|
+
export declare class RuntimeUtilities {
|
|
12
|
+
/**
|
|
13
|
+
* Builds the complete utilities object for React components
|
|
14
|
+
* This is the main method that components will use
|
|
15
|
+
*/
|
|
16
|
+
buildUtilities(): ComponentUtilities;
|
|
17
|
+
/**
|
|
18
|
+
* Sets up the utilities object - copied from skip-chat implementation
|
|
19
|
+
*/
|
|
20
|
+
private SetupUtilities;
|
|
21
|
+
private CreateSimpleMetadata;
|
|
22
|
+
private CreateSimpleRunQuery;
|
|
23
|
+
private CreateSimpleRunView;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Factory function to create RuntimeUtilities
|
|
27
|
+
* In a Node.js environment, this will use MJ's ClassFactory for runtime substitution
|
|
28
|
+
* In a browser environment, it will use the base class directly
|
|
29
|
+
*/
|
|
30
|
+
export declare function createRuntimeUtilities(): RuntimeUtilities;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Runtime utilities for React components providing access to MemberJunction core functionality
|
|
3
|
+
* @module @memberjunction/ng-react/utilities
|
|
4
|
+
*/
|
|
5
|
+
import { __decorate } from "tslib";
|
|
6
|
+
import { Metadata, RunView, RunQuery, LogError } from '@memberjunction/core';
|
|
7
|
+
import { MJGlobal, RegisterClass } from '@memberjunction/global';
|
|
8
|
+
/**
|
|
9
|
+
* Base class for providing runtime utilities to React components in Angular.
|
|
10
|
+
* This class can be extended and registered with MJ's ClassFactory
|
|
11
|
+
* to provide custom implementations of data access methods.
|
|
12
|
+
*/
|
|
13
|
+
let RuntimeUtilities = class RuntimeUtilities {
|
|
14
|
+
/**
|
|
15
|
+
* Builds the complete utilities object for React components
|
|
16
|
+
* This is the main method that components will use
|
|
17
|
+
*/
|
|
18
|
+
buildUtilities() {
|
|
19
|
+
const md = new Metadata();
|
|
20
|
+
return this.SetupUtilities(md);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sets up the utilities object - copied from skip-chat implementation
|
|
24
|
+
*/
|
|
25
|
+
SetupUtilities(md) {
|
|
26
|
+
const rv = new RunView();
|
|
27
|
+
const rq = new RunQuery();
|
|
28
|
+
const u = {
|
|
29
|
+
md: this.CreateSimpleMetadata(md),
|
|
30
|
+
rv: this.CreateSimpleRunView(rv),
|
|
31
|
+
rq: this.CreateSimpleRunQuery(rq)
|
|
32
|
+
};
|
|
33
|
+
return u;
|
|
34
|
+
}
|
|
35
|
+
CreateSimpleMetadata(md) {
|
|
36
|
+
return {
|
|
37
|
+
Entities: md.Entities,
|
|
38
|
+
GetEntityObject: (entityName) => {
|
|
39
|
+
return md.GetEntityObject(entityName);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
CreateSimpleRunQuery(rq) {
|
|
44
|
+
return {
|
|
45
|
+
RunQuery: async (params) => {
|
|
46
|
+
// Run a single query and return the results
|
|
47
|
+
try {
|
|
48
|
+
const result = await rq.RunQuery(params);
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
LogError(error);
|
|
53
|
+
throw error; // Re-throw to handle it in the caller
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
CreateSimpleRunView(rv) {
|
|
59
|
+
return {
|
|
60
|
+
RunView: async (params) => {
|
|
61
|
+
// Run a single view and return the results
|
|
62
|
+
try {
|
|
63
|
+
const result = await rv.RunView(params);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
LogError(error);
|
|
68
|
+
throw error; // Re-throw to handle it in the caller
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
RunViews: async (params) => {
|
|
72
|
+
// Runs multiple views and returns the results
|
|
73
|
+
try {
|
|
74
|
+
const results = await rv.RunViews(params);
|
|
75
|
+
return results;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
LogError(error);
|
|
79
|
+
throw error; // Re-throw to handle it in the caller
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
RuntimeUtilities = __decorate([
|
|
86
|
+
RegisterClass(RuntimeUtilities, 'RuntimeUtilities')
|
|
87
|
+
], RuntimeUtilities);
|
|
88
|
+
export { RuntimeUtilities };
|
|
89
|
+
/**
|
|
90
|
+
* Factory function to create RuntimeUtilities
|
|
91
|
+
* In a Node.js environment, this will use MJ's ClassFactory for runtime substitution
|
|
92
|
+
* In a browser environment, it will use the base class directly
|
|
93
|
+
*/
|
|
94
|
+
export function createRuntimeUtilities() {
|
|
95
|
+
// Check if we're in a Node.js environment with MJGlobal available
|
|
96
|
+
if (typeof window === 'undefined') {
|
|
97
|
+
try {
|
|
98
|
+
// Use ClassFactory to get the registered class, defaulting to base RuntimeUtilities
|
|
99
|
+
const obj = MJGlobal.Instance.ClassFactory.CreateInstance(RuntimeUtilities);
|
|
100
|
+
if (!obj) {
|
|
101
|
+
throw new Error('Failed to create RuntimeUtilities instance');
|
|
102
|
+
}
|
|
103
|
+
// Ensure the object is an instance of RuntimeUtilities
|
|
104
|
+
return obj;
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
// Fall through to default
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Default: just use the base class
|
|
111
|
+
return new RuntimeUtilities();
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=runtime-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-utilities.js","sourceRoot":"","sources":["../../../src/lib/utilities/runtime-utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EACL,QAAQ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;YACvD,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,0BAA0B;QAC5B,CAAC;IACH,CAAC;IAED,mCAAmC;IACnC,OAAO,IAAI,gBAAgB,EAAE,CAAC;AAChC,CAAC","sourcesContent":["/**\n * @fileoverview Runtime utilities for React components providing access to MemberJunction core functionality\n * @module @memberjunction/ng-react/utilities\n */\n\nimport { \n Metadata, \n RunView, \n RunQuery, \n RunViewParams, \n RunQueryParams,\n LogError\n} from '@memberjunction/core';\n\nimport { MJGlobal, RegisterClass } from '@memberjunction/global';\nimport { ComponentUtilities, SimpleMetadata, SimpleRunQuery, SimpleRunView } from '@memberjunction/interactive-component-types';\n\n/**\n * Base class for providing runtime utilities to React components in Angular.\n * This class can be extended and registered with MJ's ClassFactory\n * to provide custom implementations of data access methods.\n */\n@RegisterClass(RuntimeUtilities, 'RuntimeUtilities')\nexport class RuntimeUtilities {\n /**\n * Builds the complete utilities object for React components\n * This is the main method that components will use\n */\n public buildUtilities(): ComponentUtilities {\n const md = new Metadata();\n return this.SetupUtilities(md);\n }\n\n /**\n * Sets up the utilities object - copied from skip-chat implementation\n */\n private SetupUtilities(md: Metadata): ComponentUtilities {\n const rv = new RunView();\n const rq = new RunQuery();\n const u: ComponentUtilities = {\n md: this.CreateSimpleMetadata(md),\n rv: this.CreateSimpleRunView(rv),\n rq: this.CreateSimpleRunQuery(rq)\n }; \n return u;\n }\n\n private CreateSimpleMetadata(md: Metadata): SimpleMetadata {\n return {\n Entities: md.Entities,\n GetEntityObject: (entityName: string) => {\n return md.GetEntityObject(entityName)\n }\n }\n }\n\n private CreateSimpleRunQuery(rq: RunQuery): SimpleRunQuery {\n return {\n RunQuery: async (params: RunQueryParams) => {\n // Run a single query and return the results\n try {\n const result = await rq.RunQuery(params);\n return result;\n } catch (error) {\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n }\n }\n }\n\n private CreateSimpleRunView(rv: RunView): SimpleRunView {\n return {\n RunView: async (params: RunViewParams) => {\n // Run a single view and return the results\n try {\n const result = await rv.RunView(params);\n return result;\n } catch (error) {\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n },\n RunViews: async (params: RunViewParams[]) => {\n // Runs multiple views and returns the results\n try {\n const results = await rv.RunViews(params);\n return results;\n } catch (error) {\n LogError(error);\n throw error; // Re-throw to handle it in the caller\n }\n }\n }\n }\n}\n\n/**\n * Factory function to create RuntimeUtilities\n * In a Node.js environment, this will use MJ's ClassFactory for runtime substitution\n * In a browser environment, it will use the base class directly\n */\nexport function createRuntimeUtilities(): RuntimeUtilities {\n // Check if we're in a Node.js environment with MJGlobal available\n if (typeof window === 'undefined') {\n try {\n // Use ClassFactory to get the registered class, defaulting to base RuntimeUtilities\n const obj = MJGlobal.Instance.ClassFactory.CreateInstance<RuntimeUtilities>(RuntimeUtilities);\n if (!obj) {\n throw new Error('Failed to create RuntimeUtilities instance');\n }\n\n // Ensure the object is an instance of RuntimeUtilities\n return obj;\n } catch (e) {\n // Fall through to default\n }\n }\n \n // Default: just use the base class\n return new RuntimeUtilities();\n}"]}
|
package/dist/public-api.d.ts
CHANGED
|
@@ -9,4 +9,3 @@ export * from './lib/services/script-loader.service';
|
|
|
9
9
|
export * from './lib/services/react-bridge.service';
|
|
10
10
|
export * from './lib/services/angular-adapter.service';
|
|
11
11
|
export * from './lib/default-styles';
|
|
12
|
-
export { ComponentProps, ComponentCallbacks, ComponentStyles, ComponentError, CompileOptions, CompilationResult } from '@memberjunction/react-runtime';
|
package/dist/public-api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,SAAS;AACT,cAAc,cAAc,CAAC;AAE7B,aAAa;AACb,cAAc,+CAA+C,CAAC;AAE9D,WAAW;AACX,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AAEvD,YAAY;AACZ,cAAc,sBAAsB,CAAC","sourcesContent":["/**\n * @fileoverview Public API Surface of @memberjunction/ng-react\n * This file exports all public APIs from the Angular React integration library.\n * @module @memberjunction/ng-react\n */\n\n// Module\nexport * from './lib/module';\n\n// Components\nexport * from './lib/components/mj-react-component.component';\n\n// Services\nexport * from './lib/services/script-loader.service';\nexport * from './lib/services/react-bridge.service';\nexport * from './lib/services/angular-adapter.service';\n\n// Constants\nexport * from './lib/default-styles'
|
|
1
|
+
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,SAAS;AACT,cAAc,cAAc,CAAC;AAE7B,aAAa;AACb,cAAc,+CAA+C,CAAC;AAE9D,WAAW;AACX,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wCAAwC,CAAC;AAEvD,YAAY;AACZ,cAAc,sBAAsB,CAAC","sourcesContent":["/**\n * @fileoverview Public API Surface of @memberjunction/ng-react\n * This file exports all public APIs from the Angular React integration library.\n * @module @memberjunction/ng-react\n */\n\n// Module\nexport * from './lib/module';\n\n// Components\nexport * from './lib/components/mj-react-component.component';\n\n// Services\nexport * from './lib/services/script-loader.service';\nexport * from './lib/services/react-bridge.service';\nexport * from './lib/services/angular-adapter.service';\n\n// Constants\nexport * from './lib/default-styles';"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.92.0",
|
|
4
4
|
"description": "Angular components for hosting React components in MemberJunction applications",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "ngc -p tsconfig.json",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"styles"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@memberjunction/core": "2.
|
|
44
|
-
"@memberjunction/react-runtime": "2.
|
|
45
|
-
"@memberjunction/interactive-component-types": "^2.
|
|
43
|
+
"@memberjunction/core": "2.92.0",
|
|
44
|
+
"@memberjunction/react-runtime": "2.92.0",
|
|
45
|
+
"@memberjunction/interactive-component-types": "^2.92.0",
|
|
46
46
|
"@angular/common": ">=18.0.0",
|
|
47
47
|
"@angular/core": ">=18.0.0",
|
|
48
48
|
"@angular/platform-browser": ">=18.0.0",
|