@ensembleapp/client-sdk 0.0.22 → 0.0.24

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as ai from 'ai';
2
2
  import { UIMessage } from 'ai';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import React$1, { ReactNode } from 'react';
5
4
  import z, { AnyZodObject } from 'zod';
5
+ import React$1 from 'react';
6
6
  import { ClassValue } from 'clsx';
7
7
 
8
8
  /** @minimum 1 */
@@ -201,7 +201,7 @@ interface UIWidgetDefinition<TSchema extends AnyZodObject = AnyZodObject, TEnric
201
201
  * @param payload - The LLM-generated data matching the schema
202
202
  * @param enriched - Enrichment results keyed by name (empty object if no enrich config)
203
203
  */
204
- render(payload: z.infer<TSchema>, enriched: TEnriched): ReactNode;
204
+ render(payload: z.infer<TSchema>, enriched: TEnriched): unknown;
205
205
  }
206
206
  declare const createWidget: <TSchema extends AnyZodObject, TEnriched extends EnrichedResults = EnrichedResults>({ widgetType, schema, enrich, render, }: UIWidgetDefinition<TSchema, TEnriched>) => UIWidgetDefinition<TSchema, TEnriched>;
207
207
 
@@ -346,7 +346,8 @@ declare global {
346
346
  }
347
347
 
348
348
  declare const defaultChatWidgets: UIWidgetDefinition[];
349
+ declare const getVendorCardsWidget: (isProd?: boolean) => UIWidgetDefinition[];
349
350
 
350
351
  declare function cn(...inputs: ClassValue[]): string;
351
352
 
352
- export { type ApiConfig, type ChatContentItem, type ChatMessage, ChatWidget, type ChatWidgetFeedbackOptions, type ChatWidgetConfig as ChatWidgetProps, type ChatWidgetSpeechToTextOptions, type ChatWidgetStyles, type ChatWidgetVoiceOptions, type EmbeddableChatWidgetConfig, type EnrichedResults, type FeedbackRating, type FeedbackState, type MessageFeedback, type MessageSection, type PopupAnchorConfig, PopupChatWidget, type PopupChatWidgetProps, type SubmitFeedbackParams, type TagGroup, TagGroupDisplay, type TagGroupDisplayProps, type ToolCallContent, ToolCallDisplay, type ToolCallDisplayProps, type UIWidgetDefinition, type UseChatConfig, type UseFeedbackConfig, type WidgetEnrichConfig, cn, createWidget, defaultChatWidgets, registerChatWidgets, useChat, useFeedback };
353
+ export { type ApiConfig, type ChatContentItem, type ChatMessage, ChatWidget, type ChatWidgetFeedbackOptions, type ChatWidgetConfig as ChatWidgetProps, type ChatWidgetSpeechToTextOptions, type ChatWidgetStyles, type ChatWidgetVoiceOptions, type EmbeddableChatWidgetConfig, type EnrichedResults, type FeedbackRating, type FeedbackState, type MessageFeedback, type MessageSection, type PopupAnchorConfig, PopupChatWidget, type PopupChatWidgetProps, type SubmitFeedbackParams, type TagGroup, TagGroupDisplay, type TagGroupDisplayProps, type ToolCallContent, ToolCallDisplay, type ToolCallDisplayProps, type UIWidgetDefinition, type UseChatConfig, type UseFeedbackConfig, type WidgetEnrichConfig, cn, createWidget, defaultChatWidgets, getVendorCardsWidget, registerChatWidgets, useChat, useFeedback };
package/dist/index.js CHANGED
@@ -24896,7 +24896,7 @@ var vendorCardsSchema = zod_default.object({
24896
24896
  }).describe("The lat/lng coordinates of this vendor. This must come from the vendor's location.coordinates from the previous vendor search tool - do NOT guess")
24897
24897
  }))
24898
24898
  }).describe("displaying a list of vendor cards. Use this widget to represent data from CareNetwork vendor search tool.");
24899
- function VendorCards({ payload, enriched }) {
24899
+ function VendorCards({ payload, enriched, onAddToList }) {
24900
24900
  if (!enriched || !enriched.vendorDetails || !enriched.distanceMatrix) {
24901
24901
  return /* @__PURE__ */ jsx7("div", { children: "Outdated vendor-cards widget" });
24902
24902
  }
@@ -24933,21 +24933,38 @@ function VendorCards({ payload, enriched }) {
24933
24933
  fontSize: "0.875rem"
24934
24934
  },
24935
24935
  children: [
24936
- /* @__PURE__ */ jsx7("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
24937
- /* @__PURE__ */ jsx7("div", { style: {
24938
- width: "2rem",
24939
- height: "2rem",
24940
- borderRadius: "9999px",
24941
- background: "#bfd1f5",
24942
- display: "flex",
24943
- alignItems: "center",
24944
- justifyContent: "center",
24945
- fontWeight: 600,
24946
- fontSize: "0.875rem",
24947
- color: "#374151"
24948
- }, children: name17.charAt(0).toUpperCase() }),
24949
- /* @__PURE__ */ jsx7("span", { style: { fontWeight: 600, fontSize: "1rem", color: "#111827" }, children: name17 })
24950
- ] }) }),
24936
+ /* @__PURE__ */ jsxs7("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: [
24937
+ /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
24938
+ /* @__PURE__ */ jsx7("div", { style: {
24939
+ width: "2rem",
24940
+ height: "2rem",
24941
+ borderRadius: "9999px",
24942
+ background: "#bfd1f5",
24943
+ display: "flex",
24944
+ alignItems: "center",
24945
+ justifyContent: "center",
24946
+ fontWeight: 600,
24947
+ fontSize: "0.875rem",
24948
+ color: "#374151"
24949
+ }, children: name17.charAt(0).toUpperCase() }),
24950
+ /* @__PURE__ */ jsx7("span", { style: { fontWeight: 600, fontSize: "1rem", color: "#111827" }, children: name17 })
24951
+ ] }),
24952
+ onAddToList && /* @__PURE__ */ jsx7(
24953
+ "button",
24954
+ {
24955
+ onClick: () => onAddToList(v.vendor_id),
24956
+ style: {
24957
+ background: "none",
24958
+ border: "none",
24959
+ color: "#3b82f6",
24960
+ fontSize: "0.875rem",
24961
+ cursor: "pointer",
24962
+ padding: 0
24963
+ },
24964
+ children: "Add to list"
24965
+ }
24966
+ )
24967
+ ] }),
24951
24968
  /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", color: "#6b7280" }, children: [
24952
24969
  /* @__PURE__ */ jsx7("span", { style: { color: "#facc15" }, children: "\u2605" }),
24953
24970
  /* @__PURE__ */ jsx7("span", { children: avgRating?.toFixed(1) ?? "\u2014" }),
@@ -25102,36 +25119,42 @@ var defaultChatWidgets = [
25102
25119
  children: payload.text || payload.uri
25103
25120
  }
25104
25121
  )
25105
- }),
25106
- createWidget({
25107
- widgetType: "vendor-cards",
25108
- schema: vendorCardsSchema,
25109
- enrich: {
25110
- /** fetch vendor details from the list of IDs */
25111
- vendorDetails: {
25112
- toolId: "CPgsswom7FkUYvplmy6H",
25113
- inputs: {
25114
- vendorIds: "${vendors|map('vendor_id')|join(',')}"
25122
+ })
25123
+ ];
25124
+ var getVendorCardsWidget = (isProd) => {
25125
+ const vendorDetailsToolId = isProd ? "86dc78e28f933225750d9bcff7c94b18-CPgsswom7FkUYvplmy6H" : "CPgsswom7FkUYvplmy6H";
25126
+ const distanceMatrixToolId = isProd ? "86dc78e28f933225750d9bcff7c94b18-DwsbeKAxOctXSGgghvW8" : "DwsbeKAxOctXSGgghvW8";
25127
+ return [
25128
+ createWidget({
25129
+ widgetType: "vendor-cards",
25130
+ schema: vendorCardsSchema,
25131
+ enrich: {
25132
+ /** fetch vendor details from the list of IDs */
25133
+ vendorDetails: {
25134
+ toolId: vendorDetailsToolId,
25135
+ inputs: {
25136
+ vendorIds: "${vendors|map('vendor_id')|join(',')}"
25137
+ }
25138
+ },
25139
+ /* calculate distance from user to each vendor */
25140
+ distanceMatrix: {
25141
+ toolId: distanceMatrixToolId,
25142
+ inputs: {
25143
+ origin: "${fromCoordinates}",
25144
+ destinations: "${vendors|map('vendorCoordinates')}"
25145
+ }
25115
25146
  }
25116
25147
  },
25117
- /* calculate distance from user to each vendor */
25118
- distanceMatrix: {
25119
- toolId: "DwsbeKAxOctXSGgghvW8",
25120
- inputs: {
25121
- origin: "${fromCoordinates}",
25122
- destinations: "${vendors|map('vendorCoordinates')}"
25148
+ render: (payload, enriched) => /* @__PURE__ */ jsx8(
25149
+ VendorCards,
25150
+ {
25151
+ payload,
25152
+ enriched
25123
25153
  }
25124
- }
25125
- },
25126
- render: (payload, enriched) => /* @__PURE__ */ jsx8(
25127
- VendorCards,
25128
- {
25129
- payload,
25130
- enriched
25131
- }
25132
- )
25133
- })
25134
- ];
25154
+ )
25155
+ })
25156
+ ];
25157
+ };
25135
25158
  export {
25136
25159
  ChatWidget,
25137
25160
  PopupChatWidget,
@@ -25140,6 +25163,7 @@ export {
25140
25163
  cn,
25141
25164
  createWidget,
25142
25165
  defaultChatWidgets,
25166
+ getVendorCardsWidget,
25143
25167
  registerChatWidgets,
25144
25168
  useChat,
25145
25169
  useFeedback