@memberjunction/interactive-component-types 2.93.0 → 2.94.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/README.md +191 -0
- package/dist/component-spec.d.ts +42 -1
- package/dist/component-spec.d.ts.map +1 -1
- package/dist/component-spec.js.map +1 -1
- package/dist/runtime-types.d.ts +63 -2
- package/dist/runtime-types.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -224,6 +224,197 @@ async function loadDashboardData(props, events, data, metadata, runView) {
|
|
|
224
224
|
}
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
## Component Methods System
|
|
228
|
+
|
|
229
|
+
### ComponentObject Interface
|
|
230
|
+
|
|
231
|
+
The `ComponentObject` interface defines the structure returned by compiled components, providing both the React component and method accessors:
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
interface ComponentObject {
|
|
235
|
+
// The React component function
|
|
236
|
+
component: Function;
|
|
237
|
+
|
|
238
|
+
// Standard methods (all optional)
|
|
239
|
+
print?: () => void;
|
|
240
|
+
refresh?: () => void;
|
|
241
|
+
getCurrentDataState?: () => any;
|
|
242
|
+
getDataStateHistory?: () => Array<{ timestamp: Date; state: any }>;
|
|
243
|
+
validate?: () => boolean | { valid: boolean; errors?: string[] };
|
|
244
|
+
isDirty?: () => boolean;
|
|
245
|
+
reset?: () => void;
|
|
246
|
+
scrollTo?: (target: string | HTMLElement | { top?: number; left?: number }) => void;
|
|
247
|
+
focus?: (target?: string | HTMLElement) => void;
|
|
248
|
+
|
|
249
|
+
// Dynamic method access
|
|
250
|
+
invokeMethod?: (methodName: string, ...args: any[]) => any;
|
|
251
|
+
hasMethod?: (methodName: string) => boolean;
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### ComponentCallbacks Interface
|
|
256
|
+
|
|
257
|
+
Components receive callbacks that enable interaction with their container:
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
interface ComponentCallbacks {
|
|
261
|
+
// Open an entity record in the container
|
|
262
|
+
OpenEntityRecord: (entityName: string, key: CompositeKey) => void;
|
|
263
|
+
|
|
264
|
+
// Register a method that can be called by the container
|
|
265
|
+
RegisterMethod: (methodName: string, handler: Function) => void;
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### How Method Registration Works
|
|
270
|
+
|
|
271
|
+
1. **Component registers methods** during initialization using the `RegisterMethod` callback
|
|
272
|
+
2. **Runtime stores methods** in an internal registry Map
|
|
273
|
+
3. **ComponentObject exposes methods** with type-safe accessors for standard methods
|
|
274
|
+
4. **Containers call methods** directly or via `invokeMethod()` for custom methods
|
|
275
|
+
|
|
276
|
+
### Example: Component Registering Methods
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
function DataTableComponent({ callbacks, data, userState }) {
|
|
280
|
+
const [tableData, setTableData] = React.useState(data);
|
|
281
|
+
const [hasChanges, setHasChanges] = React.useState(false);
|
|
282
|
+
const [selectedRows, setSelectedRows] = React.useState([]);
|
|
283
|
+
|
|
284
|
+
React.useEffect(() => {
|
|
285
|
+
if (callbacks?.RegisterMethod) {
|
|
286
|
+
// Register standard methods
|
|
287
|
+
callbacks.RegisterMethod('getCurrentDataState', () => ({
|
|
288
|
+
data: tableData,
|
|
289
|
+
selectedRows: selectedRows,
|
|
290
|
+
totalCount: tableData.length
|
|
291
|
+
}));
|
|
292
|
+
|
|
293
|
+
callbacks.RegisterMethod('isDirty', () => hasChanges);
|
|
294
|
+
|
|
295
|
+
callbacks.RegisterMethod('validate', () => {
|
|
296
|
+
if (tableData.length === 0) {
|
|
297
|
+
return { valid: false, errors: ['Table cannot be empty'] };
|
|
298
|
+
}
|
|
299
|
+
return true;
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
callbacks.RegisterMethod('reset', () => {
|
|
303
|
+
setTableData(data);
|
|
304
|
+
setSelectedRows([]);
|
|
305
|
+
setHasChanges(false);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
// Register custom business logic methods
|
|
309
|
+
callbacks.RegisterMethod('exportSelectedRows', () => {
|
|
310
|
+
return selectedRows.map(idx => tableData[idx]);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
callbacks.RegisterMethod('deleteSelected', () => {
|
|
314
|
+
const newData = tableData.filter((_, idx) => !selectedRows.includes(idx));
|
|
315
|
+
setTableData(newData);
|
|
316
|
+
setHasChanges(true);
|
|
317
|
+
setSelectedRows([]);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}, [callbacks, tableData, selectedRows, hasChanges]);
|
|
321
|
+
|
|
322
|
+
return <div>{/* Table UI */}</div>;
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Example: Container Using Methods
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
// After component compilation
|
|
330
|
+
const componentObject = compiledComponent as ComponentObject;
|
|
331
|
+
|
|
332
|
+
// Use standard methods with type safety
|
|
333
|
+
if (componentObject.isDirty && componentObject.isDirty()) {
|
|
334
|
+
console.log('Component has unsaved changes');
|
|
335
|
+
|
|
336
|
+
const validation = componentObject.validate?.();
|
|
337
|
+
if (validation === true || validation?.valid) {
|
|
338
|
+
// Safe to proceed
|
|
339
|
+
const currentState = componentObject.getCurrentDataState?.();
|
|
340
|
+
await saveData(currentState);
|
|
341
|
+
} else {
|
|
342
|
+
console.error('Validation failed:', validation?.errors);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Use custom methods via invokeMethod
|
|
347
|
+
if (componentObject.hasMethod?.('exportSelectedRows')) {
|
|
348
|
+
const selectedData = componentObject.invokeMethod('exportSelectedRows');
|
|
349
|
+
await exportToFile(selectedData);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Reset the component
|
|
353
|
+
componentObject.reset?.();
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Method Declaration in ComponentSpec
|
|
357
|
+
|
|
358
|
+
Components can declare their supported methods in the spec for static discovery:
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
interface ComponentSpec {
|
|
362
|
+
name: string;
|
|
363
|
+
code: string;
|
|
364
|
+
|
|
365
|
+
// Optional method declarations for discovery/documentation
|
|
366
|
+
methods?: Array<{
|
|
367
|
+
name: string;
|
|
368
|
+
category?: 'standard' | 'custom';
|
|
369
|
+
description?: string;
|
|
370
|
+
parameters?: Array<{
|
|
371
|
+
name: string;
|
|
372
|
+
type: string; // Free-form type description
|
|
373
|
+
required?: boolean;
|
|
374
|
+
description?: string;
|
|
375
|
+
}>;
|
|
376
|
+
returnType?: string; // Free-form type description
|
|
377
|
+
}>;
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Example declaration:
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
const spec: ComponentSpec = {
|
|
385
|
+
name: 'DataTable',
|
|
386
|
+
code: '...',
|
|
387
|
+
methods: [
|
|
388
|
+
{
|
|
389
|
+
name: 'getCurrentDataState',
|
|
390
|
+
category: 'standard',
|
|
391
|
+
description: 'Returns current table data and selection state',
|
|
392
|
+
returnType: '{data: any[], selectedRows: number[], totalCount: number}'
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: 'exportSelectedRows',
|
|
396
|
+
category: 'custom',
|
|
397
|
+
description: 'Exports currently selected rows',
|
|
398
|
+
returnType: 'any[]'
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
name: 'deleteSelected',
|
|
402
|
+
category: 'custom',
|
|
403
|
+
description: 'Deletes selected rows from the table'
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
};
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Benefits of the Method System
|
|
410
|
+
|
|
411
|
+
1. **AI Agent Integration**: AI agents can introspect component state for analysis
|
|
412
|
+
2. **Validation & State Management**: Containers can check dirty state and validate before saving
|
|
413
|
+
3. **Custom Business Logic**: Components can expose domain-specific operations
|
|
414
|
+
4. **Framework Agnostic**: Works across Angular, React, and other frameworks
|
|
415
|
+
5. **Type Safety**: Standard methods have full TypeScript support
|
|
416
|
+
6. **Discoverability**: Method declarations enable static analysis without runtime
|
|
417
|
+
|
|
227
418
|
## Component Specifications
|
|
228
419
|
|
|
229
420
|
The package includes comprehensive types for component specifications:
|
package/dist/component-spec.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ export declare class ComponentSpec {
|
|
|
26
26
|
* Follows conventions documented here: https://semver.org/ and https://docs.npmjs.com/about-semantic-versioning
|
|
27
27
|
*/
|
|
28
28
|
version?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Only used when location === 'registry', logic explaining why this component is being selected
|
|
31
|
+
* to serve a specific use case or requirement
|
|
32
|
+
*/
|
|
33
|
+
selectionReasoning?: string;
|
|
29
34
|
/**
|
|
30
35
|
* When an architect decides to use an existing component as a base for a new version,
|
|
31
36
|
* they can set this flag to true. This indicates that the new version will be created
|
|
@@ -74,6 +79,10 @@ export declare class ComponentSpec {
|
|
|
74
79
|
* Events that the component emits, if any
|
|
75
80
|
*/
|
|
76
81
|
events?: ComponentEvent[];
|
|
82
|
+
/**
|
|
83
|
+
* Metadata about methods the component supports, if any
|
|
84
|
+
*/
|
|
85
|
+
methods?: ComponentMethodInfo;
|
|
77
86
|
/**
|
|
78
87
|
* Example of the component being used in JSX format. This is used to provide a clear example on the properties and
|
|
79
88
|
* event handling that the component supports.
|
|
@@ -90,7 +99,39 @@ export declare class ComponentSpec {
|
|
|
90
99
|
/**
|
|
91
100
|
* Relevant examples of components intended to inspire this component's creation
|
|
92
101
|
*/
|
|
93
|
-
relevantExamples?:
|
|
102
|
+
relevantExamples?: ComponentExample[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Defines standard and custom methods a component implements
|
|
106
|
+
*/
|
|
107
|
+
export interface ComponentMethodInfo {
|
|
108
|
+
standardMethodsSupported: {
|
|
109
|
+
print?: boolean;
|
|
110
|
+
refresh?: boolean;
|
|
111
|
+
getCurrentDataState?: boolean;
|
|
112
|
+
getDataStateHistory?: boolean;
|
|
113
|
+
validate?: boolean;
|
|
114
|
+
isDirty?: boolean;
|
|
115
|
+
reset?: boolean;
|
|
116
|
+
scrollTo?: boolean;
|
|
117
|
+
focus?: boolean;
|
|
118
|
+
invokeMethod?: boolean;
|
|
119
|
+
hasMethod?: boolean;
|
|
120
|
+
};
|
|
121
|
+
customMethods: CustomComponentMethod[];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Defines a single custom component method
|
|
125
|
+
*/
|
|
126
|
+
export interface CustomComponentMethod {
|
|
127
|
+
name: string;
|
|
128
|
+
description: string;
|
|
129
|
+
parameters: Array<{
|
|
130
|
+
name: string;
|
|
131
|
+
type: string;
|
|
132
|
+
description?: string;
|
|
133
|
+
}>;
|
|
134
|
+
returnType: string;
|
|
94
135
|
}
|
|
95
136
|
/**
|
|
96
137
|
* Type that defines an example component used to inspire the creation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-spec.d.ts","sourceRoot":"","sources":["../src/component-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE;;GAEG;AACH,qBAAa,aAAa;IACtB,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,QAAQ,EAAE,UAAU,GAAG,UAAU,CAAC;IAElC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,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,CAAC;QACvB,SAAS,CAAC,EAAE,OAAO,CAAC;KACvB,CAAA;IACD,aAAa,EAAE,qBAAqB,EAAE,CAAA;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvE,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B;;OAEG;IACH,4BAA4B,CAAC,EAAE,MAAM,EAAE,CAAC;IACxC;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjC;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;CACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-spec.js","sourceRoot":"","sources":["../src/component-spec.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,MAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"component-spec.js","sourceRoot":"","sources":["../src/component-spec.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,MAAa,aAAa;CAmHzB;AAnHD,sCAmHC;AAAA,CAAC"}
|
package/dist/runtime-types.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ export interface ComponentCallbacks {
|
|
|
11
11
|
* @param key - this is an array of key/value pairs representing the primary key. The format of a Composite Key is an array of KeyValuePair objects and KeyValuePair objects simply have FieldName and Value properties. In most cases entities have single-valued primary keys but this structure is here for complex entity types that have composite primary keys
|
|
12
12
|
*/
|
|
13
13
|
OpenEntityRecord: (entityName: string, key: CompositeKey) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Allows a component to register methods that can be called by the container.
|
|
16
|
+
* @param methodName - Name of the method being registered
|
|
17
|
+
* @param handler - The method implementation
|
|
18
|
+
*/
|
|
19
|
+
RegisterMethod: (methodName: string, handler: Function) => void;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
22
|
* Defines styles for the component. Container can provide styles to a top level component. The top level component
|
|
@@ -130,9 +136,9 @@ export type ComponentRefreshFunction = () => void;
|
|
|
130
136
|
*/
|
|
131
137
|
export interface ComponentObject {
|
|
132
138
|
/**
|
|
133
|
-
*
|
|
139
|
+
* The React component function that receives props including data, userState, callbacks, utilities, and styles.
|
|
134
140
|
*/
|
|
135
|
-
component:
|
|
141
|
+
component: Function;
|
|
136
142
|
/**
|
|
137
143
|
* The optional print function that is called when the user clicks on the print button in the parent of the component. This function will never be called by the parent before the init function so the print function
|
|
138
144
|
* can assume the component has been initialized;
|
|
@@ -142,6 +148,61 @@ export interface ComponentObject {
|
|
|
142
148
|
* The optional refresh function that is called when the user clicks on the refresh button in the parent of the component. This function will never be called by the parent before the init function so the refresh function
|
|
143
149
|
*/
|
|
144
150
|
refresh?: ComponentRefreshFunction;
|
|
151
|
+
/**
|
|
152
|
+
* Gets the current data state of the component.
|
|
153
|
+
* Used by AI agents to understand what data is currently displayed.
|
|
154
|
+
*/
|
|
155
|
+
getCurrentDataState?: () => any;
|
|
156
|
+
/**
|
|
157
|
+
* Gets the history of data state changes in the component.
|
|
158
|
+
* Returns an array of timestamped state snapshots.
|
|
159
|
+
*/
|
|
160
|
+
getDataStateHistory?: () => Array<{
|
|
161
|
+
timestamp: Date;
|
|
162
|
+
state: any;
|
|
163
|
+
}>;
|
|
164
|
+
/**
|
|
165
|
+
* Validates the current state of the component.
|
|
166
|
+
* Returns true if valid, false or validation errors otherwise.
|
|
167
|
+
*/
|
|
168
|
+
validate?: () => boolean | {
|
|
169
|
+
valid: boolean;
|
|
170
|
+
errors?: string[];
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Checks if the component has unsaved changes.
|
|
174
|
+
*/
|
|
175
|
+
isDirty?: () => boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Resets the component to its initial state.
|
|
178
|
+
*/
|
|
179
|
+
reset?: () => void;
|
|
180
|
+
/**
|
|
181
|
+
* Scrolls to a specific element or position within the component.
|
|
182
|
+
* @param target - Element selector, element reference, or scroll options
|
|
183
|
+
*/
|
|
184
|
+
scrollTo?: (target: string | HTMLElement | {
|
|
185
|
+
top?: number;
|
|
186
|
+
left?: number;
|
|
187
|
+
}) => void;
|
|
188
|
+
/**
|
|
189
|
+
* Sets focus to a specific element within the component.
|
|
190
|
+
* @param target - Element selector or element reference
|
|
191
|
+
*/
|
|
192
|
+
focus?: (target?: string | HTMLElement) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Generic method invoker for custom methods
|
|
195
|
+
* @param methodName - Name of the method to invoke
|
|
196
|
+
* @param args - Arguments to pass to the method
|
|
197
|
+
* @returns The result of the method call, or undefined if method doesn't exist
|
|
198
|
+
*/
|
|
199
|
+
invokeMethod?: (methodName: string, ...args: any[]) => any;
|
|
200
|
+
/**
|
|
201
|
+
* Check if a method is registered on the component
|
|
202
|
+
* @param methodName - Name of the method to check
|
|
203
|
+
* @returns true if the method exists
|
|
204
|
+
*/
|
|
205
|
+
hasMethod?: (methodName: string) => boolean;
|
|
145
206
|
}
|
|
146
207
|
/**
|
|
147
208
|
* This interface defines the utilities that are available to the component at runtime. These utilities are used to interact with the host MJ system to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-types.d.ts","sourceRoot":"","sources":["../src/runtime-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAqB,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE3G;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-types.d.ts","sourceRoot":"","sources":["../src/runtime-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAqB,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE3G;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;IAElE;;;;OAIG;IACH,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;CACnE;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE;QAEJ,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;QACpB,YAAY,CAAC,EAAE,MAAM,CAAA;QAGrB,SAAS,EAAE,MAAM,CAAA;QACjB,cAAc,CAAC,EAAE,MAAM,CAAA;QAGvB,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,UAAU,CAAC,EAAE,MAAM,CAAA;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GG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,KAAK,IAAI,CAAC;IAEhD;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;IAE3D;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,cAAc,CAAC;IACnB,EAAE,EAAE,aAAa,CAAC;IAClB,EAAE,EAAE,cAAc,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,aAAa,CAAA;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/interactive-component-types",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.94.0",
|
|
4
4
|
"description": "MemberJunction: Interactive Component - Type specifications for MJ Interactive UI Componentry",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"typescript": "^5.4.5"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@memberjunction/core": "2.
|
|
23
|
-
"@memberjunction/ai-vectors-memory": "2.
|
|
22
|
+
"@memberjunction/core": "2.94.0",
|
|
23
|
+
"@memberjunction/ai-vectors-memory": "2.94.0"
|
|
24
24
|
}
|
|
25
25
|
}
|