@ensembleapp/client-sdk 0.0.33 → 0.0.35
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/index.d.ts +17 -7
- package/dist/index.js +1 -13
- package/dist/index.js.map +1 -1
- package/dist/widget/widget.global.js +1 -1
- package/dist/widget/widget.global.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -168,12 +168,16 @@ declare function createSDKWidget<TSchema extends FlexibleSchema, TEnriched exten
|
|
|
168
168
|
*
|
|
169
169
|
* This type is intentionally loose to accept ReactDOM from any React version
|
|
170
170
|
* without requiring customers to cast their imports.
|
|
171
|
+
*
|
|
172
|
+
* Note: We use `any` for render parameters to avoid TypeScript contravariance issues.
|
|
173
|
+
* Using `unknown` would require customers to cast their ReactDOM imports because
|
|
174
|
+
* @types/react-dom uses `ReactNode` (narrower) which isn't assignable to `unknown` (broader).
|
|
171
175
|
*/
|
|
172
176
|
type CustomerReactDOM = {
|
|
173
|
-
render?: (element:
|
|
177
|
+
render?: (element: any, container: HTMLElement, callback?: () => void) => any;
|
|
174
178
|
unmountComponentAtNode?: (container: HTMLElement) => boolean;
|
|
175
|
-
createRoot?: (container: HTMLElement, options?: Record<string,
|
|
176
|
-
render: (children:
|
|
179
|
+
createRoot?: (container: HTMLElement, options?: Record<string, any>) => {
|
|
180
|
+
render: (children: any) => void;
|
|
177
181
|
unmount: () => void;
|
|
178
182
|
};
|
|
179
183
|
[key: string]: unknown;
|
|
@@ -228,10 +232,10 @@ interface UIWidgetDefinition<TSchema extends FlexibleSchema = FlexibleSchema, TE
|
|
|
228
232
|
render(payload: InferSchema<TSchema>, enriched: TEnriched): unknown;
|
|
229
233
|
}
|
|
230
234
|
/**
|
|
231
|
-
* Helper to create customer widgets
|
|
235
|
+
* Helper to create customer widgets.
|
|
232
236
|
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
237
|
+
* Note: Uses loose typing for schema to avoid "Type instantiation is excessively deep"
|
|
238
|
+
* errors with complex Zod schemas. Schema is validated at runtime, not compile time.
|
|
235
239
|
*
|
|
236
240
|
* @example
|
|
237
241
|
* ```typescript
|
|
@@ -250,7 +254,13 @@ interface UIWidgetDefinition<TSchema extends FlexibleSchema = FlexibleSchema, TE
|
|
|
250
254
|
* });
|
|
251
255
|
* ```
|
|
252
256
|
*/
|
|
253
|
-
declare const createWidget: <
|
|
257
|
+
declare const createWidget: <TEnriched extends EnrichedResults = EnrichedResults>(widget: {
|
|
258
|
+
widgetType: string;
|
|
259
|
+
schema: any;
|
|
260
|
+
enrich?: WidgetEnrichConfig;
|
|
261
|
+
reactDOM: CustomerReactDOM;
|
|
262
|
+
render(payload: any, enriched: TEnriched): unknown;
|
|
263
|
+
}) => UIWidgetDefinition<FlexibleSchema, TEnriched>;
|
|
254
264
|
|
|
255
265
|
type DisplayMode = 'full' | 'brief';
|
|
256
266
|
|
package/dist/index.js
CHANGED
|
@@ -25753,19 +25753,7 @@ function createSDKWidget(widget) {
|
|
|
25753
25753
|
[SDK_WIDGET_MARKER]: true
|
|
25754
25754
|
};
|
|
25755
25755
|
}
|
|
25756
|
-
var createWidget = (
|
|
25757
|
-
widgetType,
|
|
25758
|
-
schema,
|
|
25759
|
-
enrich,
|
|
25760
|
-
reactDOM,
|
|
25761
|
-
render
|
|
25762
|
-
}) => ({
|
|
25763
|
-
widgetType,
|
|
25764
|
-
schema,
|
|
25765
|
-
enrich,
|
|
25766
|
-
reactDOM,
|
|
25767
|
-
render
|
|
25768
|
-
});
|
|
25756
|
+
var createWidget = (widget) => widget;
|
|
25769
25757
|
|
|
25770
25758
|
// lib/chat/components/WidgetRenderer.tsx
|
|
25771
25759
|
import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|