@memberjunction/react-runtime 2.102.0 → 2.104.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +66 -6
- package/README.md +95 -0
- package/dist/runtime/component-hierarchy.d.ts.map +1 -1
- package/dist/runtime/component-hierarchy.js +36 -21
- package/dist/runtime/component-hierarchy.js.map +1 -1
- package/dist/runtime/prop-builder.d.ts.map +1 -1
- package/dist/runtime/prop-builder.js +13 -4
- package/dist/runtime/prop-builder.js.map +1 -1
- package/dist/runtime.umd.js +20 -10
- package/package.json +7 -7
- package/src/runtime/component-hierarchy.ts +42 -27
- package/src/runtime/prop-builder.ts +13 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/react-runtime",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.104.0",
|
|
4
4
|
"description": "Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/MemberJunction/MJ#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@memberjunction/core": "2.
|
|
31
|
-
"@memberjunction/global": "2.
|
|
32
|
-
"@memberjunction/interactive-component-types": "2.
|
|
33
|
-
"@memberjunction/core-entities": "2.
|
|
34
|
-
"@memberjunction/graphql-dataprovider": "2.
|
|
30
|
+
"@memberjunction/core": "2.100.3",
|
|
31
|
+
"@memberjunction/global": "2.100.3",
|
|
32
|
+
"@memberjunction/interactive-component-types": "2.104.0",
|
|
33
|
+
"@memberjunction/core-entities": "2.104.0",
|
|
34
|
+
"@memberjunction/graphql-dataprovider": "2.104.0",
|
|
35
35
|
"@babel/standalone": "^7.23.5",
|
|
36
36
|
"rxjs": "^7.8.1"
|
|
37
37
|
},
|
|
@@ -47,4 +47,4 @@
|
|
|
47
47
|
"@babel/preset-env": "^7.23.5",
|
|
48
48
|
"path-browserify": "^1.0.1"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module @memberjunction/react-runtime/hierarchy
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
8
|
CompilationResult,
|
|
9
9
|
CompileOptions,
|
|
10
10
|
RuntimeContext,
|
|
@@ -14,7 +14,7 @@ import { ComponentCompiler } from '../compiler';
|
|
|
14
14
|
import { ComponentRegistry } from '../registry';
|
|
15
15
|
|
|
16
16
|
import { ComponentSpec, ComponentStyles } from '@memberjunction/interactive-component-types';
|
|
17
|
-
import { UserInfo, Metadata } from '@memberjunction/core';
|
|
17
|
+
import { UserInfo, Metadata, LogStatus, GetProductionStatus } from '@memberjunction/core';
|
|
18
18
|
import { ComponentLibraryEntity } from '@memberjunction/core-entities';
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -95,9 +95,11 @@ export class ComponentHierarchyRegistrar {
|
|
|
95
95
|
name: spec.name,
|
|
96
96
|
version: spec.version || 'latest'
|
|
97
97
|
});
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
if (fullSpec && fullSpec.code) {
|
|
100
|
-
|
|
100
|
+
if (!GetProductionStatus()) {
|
|
101
|
+
LogStatus(`✅ [ComponentHierarchyRegistrar] Fetched external component ${spec.name} with code (${fullSpec.code.length} chars)`);
|
|
102
|
+
}
|
|
101
103
|
return fullSpec;
|
|
102
104
|
} else {
|
|
103
105
|
console.warn(`⚠️ [ComponentHierarchyRegistrar] Failed to fetch external component ${spec.name} or no code`);
|
|
@@ -122,7 +124,9 @@ export class ComponentHierarchyRegistrar {
|
|
|
122
124
|
// If this is an external registry component without code, fetch it first
|
|
123
125
|
let resolvedRootSpec = rootSpec;
|
|
124
126
|
if (rootSpec.location === 'registry' && rootSpec.registry && !rootSpec.code) {
|
|
125
|
-
|
|
127
|
+
if (!GetProductionStatus()) {
|
|
128
|
+
LogStatus(`🌐 [ComponentHierarchyRegistrar] Fetching external registry component: ${rootSpec.registry}/${rootSpec.name}`);
|
|
129
|
+
}
|
|
126
130
|
resolvedRootSpec = await this.fetchExternalComponent(rootSpec, options.contextUser) || rootSpec;
|
|
127
131
|
}
|
|
128
132
|
const {
|
|
@@ -133,17 +137,18 @@ export class ComponentHierarchyRegistrar {
|
|
|
133
137
|
allowOverride = true
|
|
134
138
|
} = options;
|
|
135
139
|
|
|
136
|
-
console.log('🌳 ComponentHierarchyRegistrar.registerHierarchy:', {
|
|
137
|
-
rootComponent: resolvedRootSpec.name,
|
|
138
|
-
hasLibraries: !!(resolvedRootSpec.libraries && resolvedRootSpec.libraries.length > 0),
|
|
139
|
-
libraryCount: resolvedRootSpec.libraries?.length || 0,
|
|
140
|
-
libraries: resolvedRootSpec.libraries?.map(l => l.name)
|
|
141
|
-
});
|
|
142
|
-
|
|
143
140
|
const registeredComponents: string[] = [];
|
|
144
141
|
const errors: ComponentRegistrationError[] = [];
|
|
145
142
|
const warnings: string[] = [];
|
|
146
143
|
|
|
144
|
+
if (!GetProductionStatus()) {
|
|
145
|
+
LogStatus('🌳 ComponentHierarchyRegistrar.registerHierarchy:', undefined, {
|
|
146
|
+
rootComponent: resolvedRootSpec.name,
|
|
147
|
+
hasLibraries: !!(resolvedRootSpec.libraries && resolvedRootSpec.libraries.length > 0),
|
|
148
|
+
libraryCount: resolvedRootSpec.libraries?.length || 0
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
147
152
|
// PHASE 1: Compile all components first (but defer factory execution)
|
|
148
153
|
const compiledMap = new Map<string, CompiledComponent>();
|
|
149
154
|
const specMap = new Map<string, ComponentSpec>();
|
|
@@ -181,7 +186,9 @@ export class ComponentHierarchyRegistrar {
|
|
|
181
186
|
result.loadedLibraries.forEach((value, key) => {
|
|
182
187
|
if (!allLoadedLibraries.has(key)) {
|
|
183
188
|
allLoadedLibraries.set(key, value);
|
|
184
|
-
|
|
189
|
+
if (!GetProductionStatus()) {
|
|
190
|
+
LogStatus(`📚 [registerHierarchy] Added library ${key} to accumulated libraries`);
|
|
191
|
+
}
|
|
185
192
|
}
|
|
186
193
|
});
|
|
187
194
|
}
|
|
@@ -249,7 +256,9 @@ export class ComponentHierarchyRegistrar {
|
|
|
249
256
|
}
|
|
250
257
|
allLoadedLibraries.forEach((value, key) => {
|
|
251
258
|
this.runtimeContext.libraries![key] = value;
|
|
252
|
-
|
|
259
|
+
if (!GetProductionStatus()) {
|
|
260
|
+
LogStatus(`✅ [registerHierarchy] Added ${key} to runtime context libraries`);
|
|
261
|
+
}
|
|
253
262
|
});
|
|
254
263
|
}
|
|
255
264
|
|
|
@@ -335,7 +344,15 @@ export class ComponentHierarchyRegistrar {
|
|
|
335
344
|
if (!lib.globalVariable || lib.globalVariable === 'undefined' || lib.globalVariable === 'null') return false;
|
|
336
345
|
return true;
|
|
337
346
|
});
|
|
338
|
-
|
|
347
|
+
|
|
348
|
+
if (!GetProductionStatus()) {
|
|
349
|
+
LogStatus(`🔧 Compiling component ${spec.name} with libraries:`, undefined, {
|
|
350
|
+
originalCount: spec.libraries?.length || 0,
|
|
351
|
+
filteredCount: validLibraries?.length || 0,
|
|
352
|
+
libraries: validLibraries?.map(l => l.name) || []
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
339
356
|
// Compile the component
|
|
340
357
|
const compileOptions: CompileOptions = {
|
|
341
358
|
componentName: spec.name,
|
|
@@ -346,12 +363,6 @@ export class ComponentHierarchyRegistrar {
|
|
|
346
363
|
allLibraries: options.allLibraries
|
|
347
364
|
};
|
|
348
365
|
|
|
349
|
-
console.log(`🔧 Compiling component ${spec.name} with libraries:`, {
|
|
350
|
-
originalCount: spec.libraries?.length || 0,
|
|
351
|
-
filteredCount: validLibraries?.length || 0,
|
|
352
|
-
validLibraries: validLibraries?.map(l => ({ name: l.name, globalVariable: l.globalVariable }))
|
|
353
|
-
});
|
|
354
|
-
|
|
355
366
|
const compilationResult = await this.compiler.compile(compileOptions);
|
|
356
367
|
|
|
357
368
|
if (!compilationResult.success) {
|
|
@@ -372,18 +383,22 @@ export class ComponentHierarchyRegistrar {
|
|
|
372
383
|
}
|
|
373
384
|
compilationResult.loadedLibraries.forEach((value, key) => {
|
|
374
385
|
this.runtimeContext.libraries![key] = value;
|
|
375
|
-
|
|
386
|
+
if (!GetProductionStatus()) {
|
|
387
|
+
LogStatus(`✅ [registerSingleComponent] Added ${key} to runtime context libraries`);
|
|
388
|
+
}
|
|
376
389
|
});
|
|
377
390
|
}
|
|
378
391
|
|
|
379
392
|
// Call the factory to create the ComponentObject
|
|
380
393
|
// IMPORTANT: We don't pass components here because child components may not be registered yet
|
|
381
394
|
// Components are resolved later when the component is actually rendered
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
395
|
+
if (!GetProductionStatus()) {
|
|
396
|
+
LogStatus(`🏭 Calling factory for ${spec.name} with runtime context:`, undefined, {
|
|
397
|
+
hasReact: !!this.runtimeContext.React,
|
|
398
|
+
hasReactDOM: !!this.runtimeContext.ReactDOM,
|
|
399
|
+
libraryCount: Object.keys(this.runtimeContext.libraries || {}).length
|
|
400
|
+
});
|
|
401
|
+
}
|
|
387
402
|
const componentObject = compilationResult.component!.factory(this.runtimeContext, styles);
|
|
388
403
|
|
|
389
404
|
// Register the full ComponentObject (not just the React component)
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { ComponentStyles, ComponentCallbacks } from '@memberjunction/interactive-component-types';
|
|
8
8
|
import { ComponentProps } from '../types';
|
|
9
9
|
import { Subject, debounceTime, Subscription } from 'rxjs';
|
|
10
|
+
import { LogStatus, GetProductionStatus } from '@memberjunction/core';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Options for building component props
|
|
@@ -283,7 +284,9 @@ export function wrapCallbacksWithLogging(
|
|
|
283
284
|
Object.keys(callbacks).forEach(key => {
|
|
284
285
|
if (key !== 'OpenEntityRecord' && key !== 'RegisterMethod' && key !== 'CreateSimpleNotification' && typeof (callbacks as any)[key] === 'function') {
|
|
285
286
|
(wrapped as any)[key] = (...args: any[]) => {
|
|
286
|
-
|
|
287
|
+
if (!GetProductionStatus()) {
|
|
288
|
+
LogStatus(`[${componentName}] ${key} called with args:`, undefined, args);
|
|
289
|
+
}
|
|
287
290
|
return (callbacks as any)[key](...args);
|
|
288
291
|
};
|
|
289
292
|
}
|
|
@@ -291,21 +294,27 @@ export function wrapCallbacksWithLogging(
|
|
|
291
294
|
|
|
292
295
|
if (callbacks.OpenEntityRecord) {
|
|
293
296
|
wrapped.OpenEntityRecord = (entityName: string, key: any) => {
|
|
294
|
-
|
|
297
|
+
if (!GetProductionStatus()) {
|
|
298
|
+
LogStatus(`[${componentName}] OpenEntityRecord called:`, undefined, { entityName, key });
|
|
299
|
+
}
|
|
295
300
|
callbacks.OpenEntityRecord!(entityName, key);
|
|
296
301
|
};
|
|
297
302
|
}
|
|
298
303
|
|
|
299
304
|
if (callbacks.RegisterMethod) {
|
|
300
305
|
wrapped.RegisterMethod = (methodName: any, handler: any) => {
|
|
301
|
-
|
|
306
|
+
if (!GetProductionStatus()) {
|
|
307
|
+
LogStatus(`[${componentName}] RegisterMethod called for:`, undefined, methodName);
|
|
308
|
+
}
|
|
302
309
|
callbacks.RegisterMethod!(methodName, handler);
|
|
303
310
|
};
|
|
304
311
|
}
|
|
305
312
|
|
|
306
313
|
if (callbacks.CreateSimpleNotification) {
|
|
307
314
|
wrapped.CreateSimpleNotification = (message: string, style: "none" | "success" | "error" | "warning" | "info", hideAfter?: number) => {
|
|
308
|
-
|
|
315
|
+
if (!GetProductionStatus()) {
|
|
316
|
+
LogStatus(`[${componentName}] CreateSimpleNotification called:`, undefined, { message, style, hideAfter });
|
|
317
|
+
}
|
|
309
318
|
callbacks.CreateSimpleNotification!(message, style, hideAfter);
|
|
310
319
|
};
|
|
311
320
|
}
|