dynim-react 1.0.36 → 1.0.38
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/DynimProvider.d.ts.map +1 -1
- package/dist/DynimProvider.js +18 -8
- package/dist/builder/CodeChatPanel.js +2 -2
- package/dist/builder/index.d.ts +0 -2
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +0 -2
- package/dist/inference/index.d.ts +2 -3
- package/dist/inference/index.d.ts.map +1 -1
- package/dist/inference/index.js +1 -3
- package/dist/inference/types.d.ts +0 -43
- package/dist/inference/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynimProvider.d.ts","sourceRoot":"","sources":["../src/DynimProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAc,EAQZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DynimProvider.d.ts","sourceRoot":"","sources":["../src/DynimProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAc,EAQZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAKV,WAAW,EAEZ,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,WAAW;IAC1B,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrE,kCAAkC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,KAAK,IAAI,CAAC;IACzC,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,qBAAqB;IACrB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,yBAAyB;IACzB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,oCAAoC;IACpC,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,yDAAyD;IACzD,WAAW,EAAE,WAAW,CAAC;IACzB,2CAA2C;IAC3C,cAAc,EAAE,OAAO,CAAC;IACxB,gCAAgC;IAChC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,MAAW,GACZ,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA0WlC;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C"}
|
package/dist/DynimProvider.js
CHANGED
|
@@ -9,8 +9,8 @@ import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-run
|
|
|
9
9
|
*/
|
|
10
10
|
import React, { createContext, useContext, useEffect, useRef, useCallback, useMemo, useState, } from 'react';
|
|
11
11
|
import ReactDOM from 'react-dom';
|
|
12
|
-
import { createBuilderClient, createBuilder, createCodeClient, createBundleLoader, BundleNotFoundError,
|
|
13
|
-
import { createSharedContext } from './inference/sharedContext';
|
|
12
|
+
import { createBuilderClient, createBuilder, createCodeClient, createBundleLoader, BundleNotFoundError, } from 'dynim-core';
|
|
13
|
+
import { createSharedContext, updateSharedContext, isSharedContextReady } from './inference/sharedContext';
|
|
14
14
|
import { generateThemeCSS } from './theme';
|
|
15
15
|
const DynimContext = createContext(null);
|
|
16
16
|
/**
|
|
@@ -62,15 +62,25 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
62
62
|
configRef.current = config;
|
|
63
63
|
// Set up shared context for bundles (only once on mount)
|
|
64
64
|
useEffect(() => {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const { packages = {}, hooks = {}, contexts = {} } = configRef.current;
|
|
66
|
+
const sdkPackages = {
|
|
67
|
+
'dynim-react': { DynimProvider, useDynim },
|
|
68
|
+
...packages,
|
|
69
|
+
};
|
|
70
|
+
if (!isSharedContextReady()) {
|
|
71
|
+
// Create fresh shared context
|
|
67
72
|
createSharedContext({
|
|
68
73
|
React,
|
|
69
74
|
ReactDOM,
|
|
70
|
-
packages:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
packages: sdkPackages,
|
|
76
|
+
hooks,
|
|
77
|
+
contexts,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Update existing context with packages (handles HMR)
|
|
82
|
+
updateSharedContext({
|
|
83
|
+
packages: sdkPackages,
|
|
74
84
|
hooks,
|
|
75
85
|
contexts,
|
|
76
86
|
});
|
|
@@ -10,7 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
* Consuming app just drops this in and it works.
|
|
11
11
|
*/
|
|
12
12
|
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { useDynim } from '../DynimProvider';
|
|
14
14
|
import { themeVars } from '../theme';
|
|
15
15
|
// Styles using CSS variables for easy theming
|
|
16
16
|
const styles = {
|
|
@@ -214,7 +214,7 @@ const styles = {
|
|
|
214
214
|
},
|
|
215
215
|
};
|
|
216
216
|
export function CodeChatPanel({ placeholder = 'Ask me to make changes to your code...', className = '', onSave, onAbandon, onError, }) {
|
|
217
|
-
const { sendCode, saveCode, abandonCode, codeMessage } =
|
|
217
|
+
const { sendCode, saveCode, abandonCode, codeMessage } = useDynim();
|
|
218
218
|
const [inputValue, setInputValue] = useState('');
|
|
219
219
|
const [thinkingExpanded, setThinkingExpanded] = useState(false);
|
|
220
220
|
const [isSaving, setIsSaving] = useState(false);
|
package/dist/builder/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Builder React exports
|
|
3
3
|
*/
|
|
4
|
-
export { BuilderProvider, useBuilder } from './BuilderProvider';
|
|
5
|
-
export type { BuilderConfig, BuilderContextValue, BuilderProviderProps } from './BuilderProvider';
|
|
6
4
|
export { ChatProvider, useChatContext } from './ChatContext';
|
|
7
5
|
export type { ChatProviderProps } from './ChatContext';
|
|
8
6
|
export { MessageList } from './MessageList';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/builder/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/builder/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/builder/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Inference exports
|
|
3
3
|
*/
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export type { DynimSDKConfig, InferenceProviderProps, InferenceState, DynimGlobal } from './types';
|
|
4
|
+
export { createSharedContext, updateSharedContext, getSharedContext, isSharedContextReady, } from './sharedContext';
|
|
5
|
+
export type { DynimSDKConfig, DynimGlobal } from './types';
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inference/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inference/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/inference/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Inference exports
|
|
3
3
|
*/
|
|
4
|
-
// Components
|
|
5
|
-
export { InferenceProvider, default as InferenceProviderDefault } from './InferenceProvider';
|
|
6
4
|
// Shared context utilities
|
|
7
|
-
export { createSharedContext, getSharedContext, isSharedContextReady, } from './sharedContext';
|
|
5
|
+
export { createSharedContext, updateSharedContext, getSharedContext, isSharedContextReady, } from './sharedContext';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
1
|
/**
|
|
3
2
|
* Configuration for the Dynim SDK registration
|
|
4
3
|
*/
|
|
@@ -16,47 +15,5 @@ export interface DynimSDKConfig {
|
|
|
16
15
|
/** Additional globals to expose */
|
|
17
16
|
globals?: Record<string, unknown>;
|
|
18
17
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Props for the InferenceProvider component
|
|
21
|
-
*/
|
|
22
|
-
export interface InferenceProviderProps {
|
|
23
|
-
/** Current tenant ID, null if no tenant */
|
|
24
|
-
tenantId: string | null;
|
|
25
|
-
/** Optional async function to check if tenant has customizations before loading */
|
|
26
|
-
checkCustomizations?: (tenantId: string) => Promise<boolean>;
|
|
27
|
-
/** Custom loading component to show while bundle is loading */
|
|
28
|
-
loadingComponent?: ReactNode;
|
|
29
|
-
/** Show error banner on load failure. Can be boolean or custom ReactNode */
|
|
30
|
-
errorBanner?: boolean | ReactNode;
|
|
31
|
-
/** Callback when bundle fails to load */
|
|
32
|
-
onError?: (error: Error, tenantId: string) => void;
|
|
33
|
-
/** Callback when bundle successfully loads */
|
|
34
|
-
onLoad?: (tenantId: string) => void;
|
|
35
|
-
/** Base app to render (used as fallback when no customizations) */
|
|
36
|
-
children: ReactNode;
|
|
37
|
-
/** NPM packages to expose to bundles (e.g., { 'react-router-dom': ReactRouterDOM }) */
|
|
38
|
-
packages?: Record<string, unknown>;
|
|
39
|
-
/** Custom hooks to expose to bundles */
|
|
40
|
-
hooks?: Record<string, unknown>;
|
|
41
|
-
/** React contexts to expose to bundles */
|
|
42
|
-
contexts?: Record<string, unknown>;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Internal state for the InferenceProvider
|
|
46
|
-
*/
|
|
47
|
-
export interface InferenceState {
|
|
48
|
-
status: 'idle' | 'checking' | 'loading' | 'loaded' | 'error' | 'no-customization';
|
|
49
|
-
error: Error | null;
|
|
50
|
-
currentTenantId: string | null;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Module loaded from a tenant bundle via dynamic import
|
|
54
|
-
*/
|
|
55
|
-
export interface BundleModule {
|
|
56
|
-
/** The App component exported by the bundle */
|
|
57
|
-
App: React.ComponentType<unknown>;
|
|
58
|
-
/** Cleanup function to revoke the blob URL */
|
|
59
|
-
cleanup: () => void;
|
|
60
|
-
}
|
|
61
18
|
export type { DynimGlobal } from 'dynim-core';
|
|
62
19
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/inference/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/inference/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,KAAK,EAAE,cAAc,OAAO,CAAC,CAAC;IAC9B,mDAAmD;IACnD,QAAQ,EAAE,cAAc,WAAW,CAAC,CAAC;IACrC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAGD,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|