@memberjunction/react-runtime 2.75.0 → 2.76.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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @memberjunction/react-runtime@2.75.0 build
2
+ > @memberjunction/react-runtime@2.76.0 build
3
3
  > tsc
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @memberjunction/react-runtime
2
2
 
3
+ ## 2.76.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ffda243: migration
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [7dabb22]
12
+ - @memberjunction/core@2.76.0
13
+ - @memberjunction/interactive-component-types@2.76.0
14
+ - @memberjunction/global@2.76.0
15
+
3
16
  ## 2.75.0
4
17
 
5
18
  ### Minor Changes
@@ -9,7 +9,6 @@ export declare class ComponentCompiler {
9
9
  private transpileComponent;
10
10
  private wrapComponentCode;
11
11
  private createComponentFactory;
12
- private createStateUpdaterUtility;
13
12
  private validateCompileOptions;
14
13
  private generateComponentId;
15
14
  private getCachedComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"component-compiler.d.ts","sourceRoot":"","sources":["../../src/compiler/component-compiler.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EAEd,iBAAiB,EACjB,cAAc,EAGf,MAAM,UAAU,CAAC;AAoBlB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,aAAa,CAAM;gBAMf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAS5C,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAS5B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqElE,OAAO,CAAC,kBAAkB;IAgC1B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,sBAAsB;IAmD9B,OAAO,CAAC,yBAAyB;IAwBjC,OAAO,CAAC,sBAAsB;IAwB9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,sBAAsB;IAa9B,UAAU,IAAI,IAAI;IAQlB,YAAY,IAAI,MAAM;IAQtB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;CAGpD"}
1
+ {"version":3,"file":"component-compiler.d.ts","sourceRoot":"","sources":["../../src/compiler/component-compiler.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EAEd,iBAAiB,EACjB,cAAc,EAGf,MAAM,UAAU,CAAC;AAoBlB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,aAAa,CAAM;gBAMf,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAS5C,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAS5B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqElE,OAAO,CAAC,kBAAkB;IAgC1B,OAAO,CAAC,iBAAiB;IAoCzB,OAAO,CAAC,sBAAsB;IA2D9B,OAAO,CAAC,sBAAsB;IAiE9B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,sBAAsB;IAa9B,UAAU,IAAI,IAAI;IAQlB,YAAY,IAAI,MAAM;IAQtB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;CAGpD"}
@@ -81,7 +81,11 @@ class ComponentCompiler {
81
81
  }
82
82
  wrapComponentCode(componentCode, componentName) {
83
83
  return `
84
- function createComponent(React, ReactDOM, useState, useEffect, useCallback, createStateUpdater, libraries, styles, console) {
84
+ function createComponent(
85
+ React, ReactDOM,
86
+ useState, useEffect, useCallback, useMemo, useRef, useContext, useReducer, useLayoutEffect,
87
+ libraries, styles, console
88
+ ) {
85
89
  ${componentCode}
86
90
 
87
91
  // Ensure the component exists
@@ -106,46 +110,51 @@ class ComponentCompiler {
106
110
  }
107
111
  createComponentFactory(transpiledCode, componentName) {
108
112
  try {
109
- const factoryCreator = new Function('React', 'ReactDOM', 'useState', 'useEffect', 'useCallback', 'createStateUpdater', 'libraries', 'styles', 'console', `${transpiledCode}; return createComponent;`);
113
+ const factoryCreator = new Function('React', 'ReactDOM', 'useState', 'useEffect', 'useCallback', 'useMemo', 'useRef', 'useContext', 'useReducer', 'useLayoutEffect', 'libraries', 'styles', 'console', `${transpiledCode}; return createComponent;`);
110
114
  return (context, styles = {}) => {
111
115
  const { React, ReactDOM, libraries = {} } = context;
112
- const createStateUpdater = this.createStateUpdaterUtility();
113
- const createComponentFn = factoryCreator(React, ReactDOM, React.useState, React.useEffect, React.useCallback, createStateUpdater, libraries, styles, console);
114
- return createComponentFn(React, ReactDOM, React.useState, React.useEffect, React.useCallback, createStateUpdater, libraries, styles, console);
116
+ const createComponentFn = factoryCreator(React, ReactDOM, React.useState, React.useEffect, React.useCallback, React.useMemo, React.useRef, React.useContext, React.useReducer, React.useLayoutEffect, libraries, styles, console);
117
+ return createComponentFn(React, ReactDOM, React.useState, React.useEffect, React.useCallback, React.useMemo, React.useRef, React.useContext, React.useReducer, React.useLayoutEffect, libraries, styles, console);
115
118
  };
116
119
  }
117
120
  catch (error) {
118
121
  throw new Error(`Failed to create component factory: ${error.message}`);
119
122
  }
120
123
  }
121
- createStateUpdaterUtility() {
122
- return (statePath, parentStateUpdater) => {
123
- return (componentStateUpdate) => {
124
- if (!statePath) {
125
- parentStateUpdater(componentStateUpdate);
126
- }
127
- else {
128
- const pathParts = statePath.split('.');
129
- const componentKey = pathParts[pathParts.length - 1];
130
- parentStateUpdater({
131
- [componentKey]: componentStateUpdate
132
- });
133
- }
134
- };
135
- };
136
- }
137
124
  validateCompileOptions(options) {
125
+ if (!options) {
126
+ throw new Error('Component compilation failed: No options provided.\n' +
127
+ 'Expected an object with componentName and componentCode properties.\n' +
128
+ 'Example: { componentName: "MyComponent", componentCode: "function MyComponent() { ... }" }');
129
+ }
138
130
  if (!options.componentName) {
139
- throw new Error('Component name is required');
131
+ const providedKeys = Object.keys(options).join(', ');
132
+ throw new Error('Component compilation failed: Component name is required.\n' +
133
+ `Received options with keys: [${providedKeys}]\n` +
134
+ 'Please ensure your component spec includes a "name" property.\n' +
135
+ 'Example: { name: "MyComponent", code: "..." }');
140
136
  }
141
137
  if (!options.componentCode) {
142
- throw new Error('Component code is required');
138
+ throw new Error(`Component compilation failed: Component code is required for "${options.componentName}".\n` +
139
+ 'Please ensure your component spec includes a "code" property with the component source code.\n' +
140
+ 'Example: { name: "MyComponent", code: "function MyComponent() { return <div>Hello</div>; }" }');
143
141
  }
144
142
  if (typeof options.componentCode !== 'string') {
145
- throw new Error('Component code must be a string');
143
+ const actualType = typeof options.componentCode;
144
+ throw new Error(`Component compilation failed: Component code must be a string for "${options.componentName}".\n` +
145
+ `Received type: ${actualType}\n` +
146
+ `Received value: ${JSON.stringify(options.componentCode).substring(0, 100)}...\n` +
147
+ 'Please ensure the code property contains a string of JavaScript/JSX code.');
148
+ }
149
+ if (options.componentCode.trim().length === 0) {
150
+ throw new Error(`Component compilation failed: Component code is empty for "${options.componentName}".\n` +
151
+ 'The code property must contain valid JavaScript/JSX code defining a React component.');
146
152
  }
147
153
  if (!options.componentCode.includes(options.componentName)) {
148
- throw new Error(`Component code must define a component named "${options.componentName}"`);
154
+ throw new Error(`Component compilation failed: Component code must define a component named "${options.componentName}".\n` +
155
+ 'The function/component name in the code must match the componentName property.\n' +
156
+ `Expected to find: function ${options.componentName}(...) or const ${options.componentName} = ...\n` +
157
+ 'Code preview: ' + options.componentCode.substring(0, 200) + '...');
149
158
  }
150
159
  }
151
160
  generateComponentId(componentName) {
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { ComponentRegistry } from './registry';
8
8
  export { ComponentResolver, ComponentSpec, ResolvedComponents } from './registry';
9
9
  export { createErrorBoundary, withErrorBoundary, formatComponentError, createErrorLogger } from './runtime';
10
10
  export { wrapComponent, memoizeComponent, lazyComponent, injectProps, conditionalComponent, withErrorHandler, portalComponent, WrapperOptions } from './runtime';
11
- export { buildComponentProps, cleanupPropBuilder, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths, PropBuilderOptions } from './runtime';
11
+ export { buildComponentProps, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths, PropBuilderOptions } from './runtime';
12
12
  export { ComponentHierarchyRegistrar, registerComponentHierarchy, validateComponentSpec, flattenComponentHierarchy, countComponentsInHierarchy, HierarchyRegistrationResult, ComponentRegistrationError, HierarchyRegistrationOptions } from './runtime';
13
13
  export { RuntimeUtilities, createRuntimeUtilities } from './utilities/runtime-utilities';
14
14
  export { SetupStyles, createDefaultComponentStyles } from './utilities/component-styles';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB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O,EACL,WAAW,EACX,4BAA4B,EAC7B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAG9C,eAAO,MAAM,OAAO,WAAW,CAAC;AAGhC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiB3B,CAAC;AAQF,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,GAAG,EAClB,MAAM,CAAC,EAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,SAAS,EAAE,cAAc,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,SAAS,EAAE,cAAc,CAAC,CAAC;CACtD;;;;;EAcF"}
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.createReactRuntime = exports.DEFAULT_CONFIGS = exports.VERSION = exports.ComponentErrorAnalyzer = exports.LibraryLoader = exports.createStandardLibraries = exports.StandardLibraryManager = exports.createDefaultComponentStyles = exports.SetupStyles = exports.createRuntimeUtilities = exports.RuntimeUtilities = exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.cleanupPropBuilder = exports.buildComponentProps = exports.portalComponent = exports.withErrorHandler = exports.conditionalComponent = exports.injectProps = exports.lazyComponent = exports.memoizeComponent = exports.wrapComponent = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = exports.ComponentSpec = exports.ComponentResolver = exports.ComponentRegistry = exports.getJSXConfig = exports.validateBabelPresets = exports.getBabelConfig = exports.DEVELOPMENT_CONFIG = exports.PRODUCTION_CONFIG = exports.DEFAULT_PLUGINS = exports.DEFAULT_PRESETS = exports.ComponentCompiler = void 0;
17
+ exports.createReactRuntime = exports.DEFAULT_CONFIGS = exports.VERSION = exports.ComponentErrorAnalyzer = exports.LibraryLoader = exports.createStandardLibraries = exports.StandardLibraryManager = exports.createDefaultComponentStyles = exports.SetupStyles = exports.createRuntimeUtilities = exports.RuntimeUtilities = exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = exports.portalComponent = exports.withErrorHandler = exports.conditionalComponent = exports.injectProps = exports.lazyComponent = exports.memoizeComponent = exports.wrapComponent = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = exports.ComponentSpec = exports.ComponentResolver = exports.ComponentRegistry = exports.getJSXConfig = exports.validateBabelPresets = exports.getBabelConfig = exports.DEVELOPMENT_CONFIG = exports.PRODUCTION_CONFIG = exports.DEFAULT_PLUGINS = exports.DEFAULT_PRESETS = exports.ComponentCompiler = void 0;
18
18
  const compiler_1 = require("./compiler");
19
19
  const registry_1 = require("./registry");
20
20
  const registry_2 = require("./registry");
@@ -49,7 +49,6 @@ Object.defineProperty(exports, "withErrorHandler", { enumerable: true, get: func
49
49
  Object.defineProperty(exports, "portalComponent", { enumerable: true, get: function () { return runtime_2.portalComponent; } });
50
50
  var runtime_3 = require("./runtime");
51
51
  Object.defineProperty(exports, "buildComponentProps", { enumerable: true, get: function () { return runtime_3.buildComponentProps; } });
52
- Object.defineProperty(exports, "cleanupPropBuilder", { enumerable: true, get: function () { return runtime_3.cleanupPropBuilder; } });
53
52
  Object.defineProperty(exports, "normalizeCallbacks", { enumerable: true, get: function () { return runtime_3.normalizeCallbacks; } });
54
53
  Object.defineProperty(exports, "normalizeStyles", { enumerable: true, get: function () { return runtime_3.normalizeStyles; } });
55
54
  Object.defineProperty(exports, "validateComponentProps", { enumerable: true, get: function () { return runtime_3.validateComponentProps; } });
@@ -1,5 +1,5 @@
1
1
  export { createErrorBoundary, withErrorBoundary, formatComponentError, createErrorLogger } from './error-boundary';
2
2
  export { wrapComponent, memoizeComponent, lazyComponent, injectProps, conditionalComponent, withErrorHandler, portalComponent, WrapperOptions } from './component-wrapper';
3
- export { buildComponentProps, cleanupPropBuilder, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths, PropBuilderOptions } from './prop-builder';
3
+ export { buildComponentProps, normalizeCallbacks, normalizeStyles, validateComponentProps, mergeProps, createPropsTransformer, wrapCallbacksWithLogging, extractPropPaths, PropBuilderOptions } from './prop-builder';
4
4
  export { ComponentHierarchyRegistrar, registerComponentHierarchy, validateComponentSpec, flattenComponentHierarchy, countComponentsInHierarchy, HierarchyRegistrationResult, ComponentRegistrationError, HierarchyRegistrationOptions } from './component-hierarchy';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.cleanupPropBuilder = exports.buildComponentProps = exports.portalComponent = exports.withErrorHandler = exports.conditionalComponent = exports.injectProps = exports.lazyComponent = exports.memoizeComponent = exports.wrapComponent = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = void 0;
3
+ exports.countComponentsInHierarchy = exports.flattenComponentHierarchy = exports.validateComponentSpec = exports.registerComponentHierarchy = exports.ComponentHierarchyRegistrar = exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = exports.portalComponent = exports.withErrorHandler = exports.conditionalComponent = exports.injectProps = exports.lazyComponent = exports.memoizeComponent = exports.wrapComponent = exports.createErrorLogger = exports.formatComponentError = exports.withErrorBoundary = exports.createErrorBoundary = void 0;
4
4
  var error_boundary_1 = require("./error-boundary");
5
5
  Object.defineProperty(exports, "createErrorBoundary", { enumerable: true, get: function () { return error_boundary_1.createErrorBoundary; } });
6
6
  Object.defineProperty(exports, "withErrorBoundary", { enumerable: true, get: function () { return error_boundary_1.withErrorBoundary; } });
@@ -16,7 +16,6 @@ Object.defineProperty(exports, "withErrorHandler", { enumerable: true, get: func
16
16
  Object.defineProperty(exports, "portalComponent", { enumerable: true, get: function () { return component_wrapper_1.portalComponent; } });
17
17
  var prop_builder_1 = require("./prop-builder");
18
18
  Object.defineProperty(exports, "buildComponentProps", { enumerable: true, get: function () { return prop_builder_1.buildComponentProps; } });
19
- Object.defineProperty(exports, "cleanupPropBuilder", { enumerable: true, get: function () { return prop_builder_1.cleanupPropBuilder; } });
20
19
  Object.defineProperty(exports, "normalizeCallbacks", { enumerable: true, get: function () { return prop_builder_1.normalizeCallbacks; } });
21
20
  Object.defineProperty(exports, "normalizeStyles", { enumerable: true, get: function () { return prop_builder_1.normalizeStyles; } });
22
21
  Object.defineProperty(exports, "validateComponentProps", { enumerable: true, get: function () { return prop_builder_1.validateComponentProps; } });
@@ -6,12 +6,11 @@ export interface PropBuilderOptions {
6
6
  transformState?: (state: any) => any;
7
7
  debounceUpdateUserState?: number;
8
8
  }
9
- export declare function buildComponentProps(data?: any, userState?: any, utilities?: any, callbacks?: ComponentCallbacks, components?: Record<string, any>, styles?: ComponentStyles, options?: PropBuilderOptions): ComponentProps;
9
+ export declare function buildComponentProps(data?: any, userState?: any, utilities?: any, callbacks?: ComponentCallbacks, components?: Record<string, any>, styles?: ComponentStyles, options?: PropBuilderOptions, onStateChanged?: (stateUpdate: Record<string, any>) => void): ComponentProps;
10
10
  export declare function normalizeCallbacks(callbacks: any, debounceMs?: number): ComponentCallbacks;
11
11
  export declare function normalizeStyles(styles?: any): any;
12
12
  export declare function validateComponentProps(props: ComponentProps): void;
13
13
  export declare function mergeProps(...propsList: Partial<ComponentProps>[]): ComponentProps;
14
- export declare function cleanupPropBuilder(callbacks: ComponentCallbacks): void;
15
14
  export declare function createPropsTransformer(transformations: Record<string, (value: any) => any>): (props: ComponentProps) => ComponentProps;
16
15
  export declare function wrapCallbacksWithLogging(callbacks: ComponentCallbacks, componentName: string): ComponentCallbacks;
17
16
  export declare function extractPropPaths(componentCode: string): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"prop-builder.d.ts","sourceRoot":"","sources":["../../src/runtime/prop-builder.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM/E,MAAM,WAAW,kBAAkB;IAEjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAEnC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAErC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAaD,wBAAgB,mBAAmB,CACjC,IAAI,GAAE,GAAQ,EACd,SAAS,GAAE,GAAQ,EACnB,S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EnC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAErC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAaD,wBAAgB,mBAAmB,CACjC,IAAI,GAAE,GAAQ,EACd,SAAS,GAAE,GAAQ,EACnB,SAAS,GAAE,GAAQ,EACnB,SAAS,GAAE,kBAAuB,EAClC,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACpC,MAAM,CAAC,EAAE,eAAe,EACxB,OAAO,GAAE,kBAAuB,EAChC,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,GAC1D,cAAc,CA6BhB;AA0CD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,GAAE,MAAa,GAAG,kBAAkB,CAahG;AAOD,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,CAKjD;AAOD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CA2BlE;AAOD,wBAAgB,UAAU,CAAC,GAAG,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,GAAG,cAAc,CAqClF;AAOD,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,GACnD,CAAC,KAAK,EAAE,cAAc,KAAK,cAAc,CAyB3C;AAQD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,kBAAkB,EAC7B,aAAa,EAAE,MAAM,GACpB,kBAAkB,CAkBpB;AAOD,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBhE"}
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.cleanupPropBuilder = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = void 0;
4
- const rxjs_1 = require("rxjs");
5
- function buildComponentProps(data = {}, userState = {}, utilities = {}, callbacks = {}, components = {}, styles, options = {}) {
3
+ exports.extractPropPaths = exports.wrapCallbacksWithLogging = exports.createPropsTransformer = exports.mergeProps = exports.validateComponentProps = exports.normalizeStyles = exports.normalizeCallbacks = exports.buildComponentProps = void 0;
4
+ function buildComponentProps(data = {}, userState = {}, utilities = {}, callbacks = {}, components = {}, styles, options = {}, onStateChanged) {
6
5
  const { validate = true, transformData, transformState, debounceUpdateUserState = 3000 } = options;
7
6
  const transformedData = transformData ? transformData(data) : data;
8
7
  const transformedState = transformState ? transformState(userState) : userState;
@@ -12,7 +11,8 @@ function buildComponentProps(data = {}, userState = {}, utilities = {}, callback
12
11
  utilities,
13
12
  callbacks: normalizeCallbacks(callbacks, debounceUpdateUserState),
14
13
  components,
15
- styles: normalizeStyles(styles)
14
+ styles: normalizeStyles(styles),
15
+ onStateChanged
16
16
  };
17
17
  if (validate) {
18
18
  validateComponentProps(props);
@@ -50,49 +50,6 @@ function normalizeCallbacks(callbacks, debounceMs = 3000) {
50
50
  if (callbacks.OpenEntityRecord && typeof callbacks.OpenEntityRecord === 'function') {
51
51
  normalized.OpenEntityRecord = callbacks.OpenEntityRecord;
52
52
  }
53
- if (callbacks.UpdateUserState && typeof callbacks.UpdateUserState === 'function') {
54
- const originalCallback = callbacks.UpdateUserState;
55
- let subject = updateUserStateSubjects.get(originalCallback);
56
- if (!subject) {
57
- subject = new rxjs_1.Subject();
58
- updateUserStateSubjects.set(originalCallback, subject);
59
- const subscription = subject.pipe((0, rxjs_1.debounceTime)(debounceMs)).subscribe(state => {
60
- console.log(`[Skip Component] UpdateUserState called after ${debounceMs}ms debounce`);
61
- originalCallback(state);
62
- });
63
- updateUserStateSubscriptions.set(originalCallback, subscription);
64
- }
65
- let loopState = loopDetectionStates.get(originalCallback);
66
- if (!loopState) {
67
- loopState = { count: 0, lastUpdate: 0, lastState: null };
68
- loopDetectionStates.set(originalCallback, loopState);
69
- }
70
- normalized.UpdateUserState = (state) => {
71
- if (loopState.lastState && deepEqual(state, loopState.lastState)) {
72
- console.log('[Skip Component] Skipping redundant state update');
73
- return;
74
- }
75
- const now = Date.now();
76
- const timeSinceLastUpdate = now - loopState.lastUpdate;
77
- if (timeSinceLastUpdate < 100) {
78
- loopState.count++;
79
- if (loopState.count > 5) {
80
- console.error('[Skip Component] Rapid state updates detected - possible infinite loop');
81
- console.error('Updates in last 100ms:', loopState.count);
82
- }
83
- }
84
- else {
85
- loopState.count = 0;
86
- }
87
- loopState.lastUpdate = now;
88
- loopState.lastState = JSON.parse(JSON.stringify(state));
89
- console.log('[Skip Component] Processing state update');
90
- subject.next(state);
91
- };
92
- }
93
- if (callbacks.NotifyEvent && typeof callbacks.NotifyEvent === 'function') {
94
- normalized.NotifyEvent = callbacks.NotifyEvent;
95
- }
96
53
  return normalized;
97
54
  }
98
55
  exports.normalizeCallbacks = normalizeCallbacks;
@@ -152,23 +109,6 @@ function mergeProps(...propsList) {
152
109
  return merged;
153
110
  }
154
111
  exports.mergeProps = mergeProps;
155
- function cleanupPropBuilder(callbacks) {
156
- if (callbacks.UpdateUserState && typeof callbacks.UpdateUserState === 'function') {
157
- const originalCallback = callbacks.UpdateUserState;
158
- const subscription = updateUserStateSubscriptions.get(originalCallback);
159
- if (subscription) {
160
- subscription.unsubscribe();
161
- updateUserStateSubscriptions.delete(originalCallback);
162
- }
163
- const subject = updateUserStateSubjects.get(originalCallback);
164
- if (subject) {
165
- subject.complete();
166
- updateUserStateSubjects.delete(originalCallback);
167
- }
168
- loopDetectionStates.delete(originalCallback);
169
- }
170
- }
171
- exports.cleanupPropBuilder = cleanupPropBuilder;
172
112
  function createPropsTransformer(transformations) {
173
113
  return (props) => {
174
114
  const transformed = { ...props };
@@ -204,18 +144,6 @@ function wrapCallbacksWithLogging(callbacks, componentName) {
204
144
  callbacks.OpenEntityRecord(entityName, key);
205
145
  };
206
146
  }
207
- if (callbacks.UpdateUserState) {
208
- wrapped.UpdateUserState = (state) => {
209
- console.log(`[${componentName}] UpdateUserState called:`, state);
210
- callbacks.UpdateUserState(state);
211
- };
212
- }
213
- if (callbacks.NotifyEvent) {
214
- wrapped.NotifyEvent = (event, data) => {
215
- console.log(`[${componentName}] NotifyEvent called:`, { event, data });
216
- callbacks.NotifyEvent(event, data);
217
- };
218
- }
219
147
  return wrapped;
220
148
  }
221
149
  exports.wrapCallbacksWithLogging = wrapCallbacksWithLogging;
@@ -46,6 +46,7 @@ export interface ComponentProps {
46
46
  callbacks: ComponentCallbacks;
47
47
  components?: Record<string, any>;
48
48
  styles?: ComponentStyles;
49
+ onStateChanged?: (stateUpdate: Record<string, any>) => void;
49
50
  }
50
51
  export interface ComponentCallbacks {
51
52
  RefreshData?: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,iBAAiB;IAEhC,SAAS,EAAE,GAAG,CAAC;IAEf,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,EAAE,MAAM,CAAC;IAEb,UAAU,EAAE,IAAI,CAAC;IAEjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAKD,MAAM,WAAW,cAAc;IAE7B,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;IAEtB,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAKD,MAAM,WAAW,eAAe;IAE9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,SAA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AO,GAAG,MAAM,CAAC;CACvC;AAGD,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ExternalLibraryConfig } from '../types/library-config';
2
+ export declare const CORE_RUNTIME_LIBRARIES: ExternalLibraryConfig[];
3
+ export declare function getCoreRuntimeLibraries(): ExternalLibraryConfig[];
4
+ export declare function isCoreRuntimeLibrary(libraryId: string): boolean;
5
+ //# sourceMappingURL=core-libraries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-libraries.d.ts","sourceRoot":"","sources":["../../src/utilities/core-libraries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAMhE,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EAwCzD,CAAC;AAKF,wBAAgB,uBAAuB,IAAI,qBAAqB,EAAE,CAEjE;AAKD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE/D"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCoreRuntimeLibrary = exports.getCoreRuntimeLibraries = exports.CORE_RUNTIME_LIBRARIES = void 0;
4
+ exports.CORE_RUNTIME_LIBRARIES = [
5
+ {
6
+ id: 'react',
7
+ name: 'react',
8
+ displayName: 'React',
9
+ category: 'runtime',
10
+ globalVariable: 'React',
11
+ version: '18.2.0',
12
+ cdnUrl: 'https://unpkg.com/react@18.2.0/umd/react.production.min.js',
13
+ description: 'React core library',
14
+ isEnabled: true,
15
+ isCore: true,
16
+ isRuntimeOnly: true
17
+ },
18
+ {
19
+ id: 'react-dom',
20
+ name: 'react-dom',
21
+ displayName: 'ReactDOM',
22
+ category: 'runtime',
23
+ globalVariable: 'ReactDOM',
24
+ version: '18.2.0',
25
+ cdnUrl: 'https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js',
26
+ description: 'React DOM library',
27
+ isEnabled: true,
28
+ isCore: true,
29
+ isRuntimeOnly: true
30
+ },
31
+ {
32
+ id: 'babel-standalone',
33
+ name: '@babel/standalone',
34
+ displayName: 'Babel Standalone',
35
+ category: 'runtime',
36
+ globalVariable: 'Babel',
37
+ version: '7.24.4',
38
+ cdnUrl: 'https://unpkg.com/@babel/standalone@7.24.4/babel.min.js',
39
+ description: 'Babel compiler for JSX transformation',
40
+ isEnabled: true,
41
+ isCore: true,
42
+ isRuntimeOnly: true
43
+ }
44
+ ];
45
+ function getCoreRuntimeLibraries() {
46
+ return exports.CORE_RUNTIME_LIBRARIES;
47
+ }
48
+ exports.getCoreRuntimeLibraries = getCoreRuntimeLibraries;
49
+ function isCoreRuntimeLibrary(libraryId) {
50
+ return exports.CORE_RUNTIME_LIBRARIES.some(lib => lib.id === libraryId);
51
+ }
52
+ exports.isCoreRuntimeLibrary = isCoreRuntimeLibrary;
@@ -1,5 +1,5 @@
1
1
  import { StandardLibraries } from './standard-libraries';
2
- import { LibraryConfiguration, LibraryLoadOptions as ConfigLoadOptions } from '../types/library-config';
2
+ import { LibraryConfiguration, ExternalLibraryConfig, LibraryLoadOptions as ConfigLoadOptions } from '../types/library-config';
3
3
  interface LoadedResource {
4
4
  element: HTMLScriptElement | HTMLLinkElement;
5
5
  promise: Promise<any>;
@@ -21,7 +21,7 @@ export interface LibraryLoadResult {
21
21
  }
22
22
  export declare class LibraryLoader {
23
23
  private static loadedResources;
24
- static loadAllLibraries(config?: LibraryConfiguration): Promise<LibraryLoadResult>;
24
+ static loadAllLibraries(config?: LibraryConfiguration, additionalLibraries?: ExternalLibraryConfig[]): Promise<LibraryLoadResult>;
25
25
  static loadLibrariesFromConfig(options?: ConfigLoadOptions): Promise<LibraryLoadResult>;
26
26
  static loadLibraries(options: LibraryLoadOptions): Promise<LibraryLoadResult>;
27
27
  private static loadScript;
@@ -1 +1 @@
1
- {"version":3,"file":"library-loader.d.ts","sourceRoot":"","sources":["../../src/utilities/library-loader.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,iBAAiB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2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LibraryLoader = void 0;
4
4
  const standard_libraries_1 = require("./standard-libraries");
5
+ const core_libraries_1 = require("./core-libraries");
5
6
  class LibraryLoader {
6
- static async loadAllLibraries(config) {
7
+ static async loadAllLibraries(config, additionalLibraries) {
7
8
  if (config) {
8
9
  standard_libraries_1.StandardLibraryManager.setConfiguration(config);
9
10
  }
11
+ if (additionalLibraries && additionalLibraries.length > 0) {
12
+ const currentConfig = standard_libraries_1.StandardLibraryManager.getConfiguration();
13
+ const mergedConfig = {
14
+ libraries: [...currentConfig.libraries, ...additionalLibraries],
15
+ metadata: {
16
+ ...currentConfig.metadata,
17
+ lastUpdated: new Date().toISOString()
18
+ }
19
+ };
20
+ standard_libraries_1.StandardLibraryManager.setConfiguration(mergedConfig);
21
+ }
10
22
  return this.loadLibrariesFromConfig();
11
23
  }
12
24
  static async loadLibrariesFromConfig(options) {
25
+ const coreLibraries = (0, core_libraries_1.getCoreRuntimeLibraries)();
26
+ const corePromises = coreLibraries.map(lib => this.loadScript(lib.cdnUrl, lib.globalVariable));
27
+ const coreResults = await Promise.all(corePromises);
28
+ const React = coreResults.find((_, i) => coreLibraries[i].globalVariable === 'React');
29
+ const ReactDOM = coreResults.find((_, i) => coreLibraries[i].globalVariable === 'ReactDOM');
30
+ const Babel = coreResults.find((_, i) => coreLibraries[i].globalVariable === 'Babel');
13
31
  const config = standard_libraries_1.StandardLibraryManager.getConfiguration();
14
32
  const enabledLibraries = standard_libraries_1.StandardLibraryManager.getEnabledLibraries();
15
- let librariesToLoad = enabledLibraries;
33
+ let pluginLibraries = enabledLibraries.filter(lib => !(0, core_libraries_1.isCoreRuntimeLibrary)(lib.id));
16
34
  if (options) {
17
35
  if (options.categories) {
18
- librariesToLoad = librariesToLoad.filter(lib => options.categories.includes(lib.category));
36
+ pluginLibraries = pluginLibraries.filter(lib => options.categories.includes(lib.category));
19
37
  }
20
38
  if (options.excludeRuntimeOnly) {
21
- librariesToLoad = librariesToLoad.filter(lib => !lib.isRuntimeOnly);
39
+ pluginLibraries = pluginLibraries.filter(lib => !lib.isRuntimeOnly);
22
40
  }
23
41
  }
24
- const runtimeLibs = librariesToLoad.filter(lib => lib.category === 'runtime');
25
- const componentLibs = librariesToLoad.filter(lib => lib.category !== 'runtime');
26
- const runtimePromises = runtimeLibs.map(lib => this.loadScript(lib.cdnUrl, lib.globalVariable));
27
- const runtimeResults = await Promise.all(runtimePromises);
28
- const React = runtimeResults.find((_, i) => runtimeLibs[i].globalVariable === 'React');
29
- const ReactDOM = runtimeResults.find((_, i) => runtimeLibs[i].globalVariable === 'ReactDOM');
30
- const Babel = runtimeResults.find((_, i) => runtimeLibs[i].globalVariable === 'Babel');
31
- componentLibs.forEach(lib => {
42
+ pluginLibraries.forEach(lib => {
32
43
  if (lib.cdnCssUrl) {
33
44
  this.loadCSS(lib.cdnCssUrl);
34
45
  }
35
46
  });
36
- const componentPromises = componentLibs.map(lib => this.loadScript(lib.cdnUrl, lib.globalVariable));
37
- const componentResults = await Promise.all(componentPromises);
47
+ const pluginPromises = pluginLibraries.map(lib => this.loadScript(lib.cdnUrl, lib.globalVariable));
48
+ const pluginResults = await Promise.all(pluginPromises);
38
49
  const libraries = {};
39
- componentLibs.forEach((lib, index) => {
40
- libraries[lib.globalVariable] = componentResults[index];
50
+ pluginLibraries.forEach((lib, index) => {
51
+ libraries[lib.globalVariable] = pluginResults[index];
41
52
  });
42
53
  return {
43
54
  React: React || window.React,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/react-runtime",
3
- "version": "2.75.0",
3
+ "version": "2.76.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",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "homepage": "https://github.com/MemberJunction/MJ#readme",
27
27
  "dependencies": {
28
- "@memberjunction/core": "2.75.0",
29
- "@memberjunction/global": "2.75.0",
30
- "@memberjunction/interactive-component-types": "2.75.0",
28
+ "@memberjunction/core": "2.76.0",
29
+ "@memberjunction/global": "2.76.0",
30
+ "@memberjunction/interactive-component-types": "2.76.0",
31
31
  "@babel/standalone": "^7.23.5",
32
32
  "rxjs": "^7.8.1"
33
33
  },