@wix/legends-platform-sdk 1.10.0 → 1.11.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/dist/cjs/hooks/useTextChat/useTextChat.js.map +1 -1
- package/dist/cjs/hooks/useTextChat/useToolAwareSend.js +2 -1
- package/dist/cjs/hooks/useTextChat/useToolAwareSend.js.map +1 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/service.js.map +1 -1
- package/dist/esm/hooks/useTextChat/useTextChat.js.map +1 -1
- package/dist/esm/hooks/useTextChat/useToolAwareSend.js +2 -1
- package/dist/esm/hooks/useTextChat/useToolAwareSend.js.map +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/service.js.map +1 -1
- package/dist/types/hooks/useTextChat/useTextChat.d.ts +2 -1
- package/dist/types/hooks/useTextChat/useTextChat.d.ts.map +1 -1
- package/dist/types/hooks/useTextChat/useToolAwareSend.d.ts +2 -1
- package/dist/types/hooks/useTextChat/useToolAwareSend.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/service.d.ts +11 -2
- package/dist/types/types/service.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactQuery","require","_sdkConsumer","_usePendingMessages","_useToolAwareSend","useTextChat","options","limit","chatId","namespace","personaChatService","useSdkConsumer","send","useToolAwareSend","pending","usePendingMessages","data","messages","status","fetchNextPage","refetch","useInfiniteQuery","queryKey","queryFn","pageParam","nextCursor","undefined","queryChatMessages","cursor","getNextPageParam","lastPage","initialPageParam","select","pages","flatMap","page","fetchNext","sendMessage","message"],"sources":["../../../../src/hooks/useTextChat/useTextChat.ts"],"sourcesContent":["import { useInfiniteQuery } from '@tanstack/react-query';\nimport type {
|
|
1
|
+
{"version":3,"names":["_reactQuery","require","_sdkConsumer","_usePendingMessages","_useToolAwareSend","useTextChat","options","limit","chatId","namespace","personaChatService","useSdkConsumer","send","useToolAwareSend","pending","usePendingMessages","data","messages","status","fetchNextPage","refetch","useInfiniteQuery","queryKey","queryFn","pageParam","nextCursor","undefined","queryChatMessages","cursor","getNextPageParam","lastPage","initialPageParam","select","pages","flatMap","page","fetchNext","sendMessage","message"],"sources":["../../../../src/hooks/useTextChat/useTextChat.ts"],"sourcesContent":["import { useInfiniteQuery } from '@tanstack/react-query';\nimport type {\n ChatMessage,\n ChatMessageAttachment,\n SendMessageMetadata,\n} from '../../types';\nimport { useSdkConsumer } from '../../sdk-consumer';\nimport { usePendingMessages } from './usePendingMessages';\nimport { useToolAwareSend } from './useToolAwareSend';\n\ninterface UseTextChatOptions {\n limit?: number;\n}\n\nexport function useTextChat(options: UseTextChatOptions = {}) {\n const { limit = 100 } = options;\n\n const { chatId, namespace, personaChatService } = useSdkConsumer();\n\n const send = useToolAwareSend(chatId, namespace);\n const pending = usePendingMessages();\n\n const {\n data: messages = [],\n status,\n fetchNextPage,\n refetch,\n } = useInfiniteQuery({\n queryKey: ['chat-messages', chatId, namespace],\n queryFn: async ({ pageParam }: { pageParam?: string }) => {\n if (!personaChatService) {\n return { messages: [], nextCursor: undefined };\n }\n return personaChatService.queryChatMessages({\n chatId,\n namespace,\n limit,\n cursor: pageParam,\n });\n },\n getNextPageParam: (lastPage) => lastPage.nextCursor,\n initialPageParam: undefined as string | undefined,\n select: (data) =>\n data.pages.flatMap((page) => page.messages as ChatMessage[]),\n });\n\n return {\n status,\n pending,\n messages,\n fetchNext,\n refetch,\n send: sendMessage,\n };\n\n function sendMessage(message: {\n message?: string;\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n metadata?: SendMessageMetadata;\n }) {\n return send(message);\n }\n\n function fetchNext() {\n void fetchNextPage();\n }\n}\n"],"mappings":";;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,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B,OAAO,CAAC;EACtB;EAEA,SAASF,SAASA,CAAA,EAAG;IACnB,KAAKjB,aAAa,CAAC,CAAC;EACtB;AACF","ignoreList":[]}
|
|
@@ -46,7 +46,8 @@ function useToolAwareSend(chatId, namespace) {
|
|
|
46
46
|
namespace,
|
|
47
47
|
message: message.message ?? '',
|
|
48
48
|
chatConfig: message.chatConfig,
|
|
49
|
-
attachments: message.attachments
|
|
49
|
+
attachments: message.attachments,
|
|
50
|
+
metadata: message.metadata
|
|
50
51
|
});
|
|
51
52
|
return toolRuntime.resolveResponseToolCalls(initialResponse, functionCallResults => mutation.mutateAsync({
|
|
52
53
|
chatId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactQuery","require","_sdkConsumer","_useTools","_useToolCallingRuntime","_helpers","useToolAwareSend","chatId","namespace","personaChatService","useSdkConsumer","toolRuntime","useToolCallingRuntime","queryClient","useQueryClient","mutation","useMutation","mutationKey","mutationFn","params","Error","sendChatMessage","onSuccess","data","variables","_data$messages","queryKey","message","setQueryData","append","id","Date","now","toString","content","role","attachments","messages","length","appendMany","send","isRunning","ToolExecutionInProgressError","initialResponse","mutateAsync","chatConfig","resolveResponseToolCalls","functionCallResults"],"sources":["../../../../src/hooks/useTextChat/useToolAwareSend.ts"],"sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query';\nimport type {\n FunctionCall,\n ChatMessageAttachment,\n SendMessageParams,\n} from '../../types';\nimport { useSdkConsumer } from '../../sdk-consumer';\nimport { ToolExecutionInProgressError } from '../useTools';\nimport { useToolCallingRuntime } from '../useTools/runtime/useToolCallingRuntime';\nimport { append, appendMany } from './helpers';\n\nexport interface SendChatMessageResponse {\n functionCalls?: FunctionCall[];\n}\n\nexport function useToolAwareSend(chatId: string, namespace: string) {\n const { personaChatService } = useSdkConsumer();\n const toolRuntime = useToolCallingRuntime<SendChatMessageResponse>();\n const queryClient = useQueryClient();\n\n const mutation = useMutation({\n mutationKey: ['pending-chat-message'],\n mutationFn: (params: SendMessageParams) => {\n if (!personaChatService) {\n throw new Error('personaChatService is required to send messages.');\n }\n return personaChatService.sendChatMessage(params);\n },\n onSuccess(data, variables) {\n const queryKey = ['chat-messages', chatId, namespace];\n\n if (variables.message) {\n queryClient.setQueryData(\n queryKey,\n append({\n id: Date.now().toString(),\n content: variables.message,\n role: 'USER' as const,\n attachments: variables.attachments,\n }),\n );\n }\n\n if (data.messages?.length) {\n queryClient.setQueryData(queryKey, appendMany(data.messages));\n }\n },\n });\n\n return async function send(message: {\n message?: string;\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n }) {\n if (toolRuntime.isRunning) {\n throw new ToolExecutionInProgressError();\n }\n\n const initialResponse = await mutation.mutateAsync({\n chatId,\n namespace,\n message: message.message ?? '',\n chatConfig: message.chatConfig,\n attachments: message.attachments,\n });\n\n return toolRuntime.resolveResponseToolCalls(\n initialResponse,\n (functionCallResults) =>\n mutation.mutateAsync({\n chatId,\n namespace,\n message: '',\n functionCallResults,\n }),\n );\n };\n}\n"],"mappings":";;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactQuery","require","_sdkConsumer","_useTools","_useToolCallingRuntime","_helpers","useToolAwareSend","chatId","namespace","personaChatService","useSdkConsumer","toolRuntime","useToolCallingRuntime","queryClient","useQueryClient","mutation","useMutation","mutationKey","mutationFn","params","Error","sendChatMessage","onSuccess","data","variables","_data$messages","queryKey","message","setQueryData","append","id","Date","now","toString","content","role","attachments","messages","length","appendMany","send","isRunning","ToolExecutionInProgressError","initialResponse","mutateAsync","chatConfig","metadata","resolveResponseToolCalls","functionCallResults"],"sources":["../../../../src/hooks/useTextChat/useToolAwareSend.ts"],"sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query';\nimport type {\n FunctionCall,\n ChatMessageAttachment,\n SendMessageParams,\n SendMessageMetadata,\n} from '../../types';\nimport { useSdkConsumer } from '../../sdk-consumer';\nimport { ToolExecutionInProgressError } from '../useTools';\nimport { useToolCallingRuntime } from '../useTools/runtime/useToolCallingRuntime';\nimport { append, appendMany } from './helpers';\n\nexport interface SendChatMessageResponse {\n functionCalls?: FunctionCall[];\n}\n\nexport function useToolAwareSend(chatId: string, namespace: string) {\n const { personaChatService } = useSdkConsumer();\n const toolRuntime = useToolCallingRuntime<SendChatMessageResponse>();\n const queryClient = useQueryClient();\n\n const mutation = useMutation({\n mutationKey: ['pending-chat-message'],\n mutationFn: (params: SendMessageParams) => {\n if (!personaChatService) {\n throw new Error('personaChatService is required to send messages.');\n }\n return personaChatService.sendChatMessage(params);\n },\n onSuccess(data, variables) {\n const queryKey = ['chat-messages', chatId, namespace];\n\n if (variables.message) {\n queryClient.setQueryData(\n queryKey,\n append({\n id: Date.now().toString(),\n content: variables.message,\n role: 'USER' as const,\n attachments: variables.attachments,\n }),\n );\n }\n\n if (data.messages?.length) {\n queryClient.setQueryData(queryKey, appendMany(data.messages));\n }\n },\n });\n\n return async function send(message: {\n message?: string;\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n metadata?: SendMessageMetadata;\n }) {\n if (toolRuntime.isRunning) {\n throw new ToolExecutionInProgressError();\n }\n\n const initialResponse = await mutation.mutateAsync({\n chatId,\n namespace,\n message: message.message ?? '',\n chatConfig: message.chatConfig,\n attachments: message.attachments,\n metadata: message.metadata,\n });\n\n return toolRuntime.resolveResponseToolCalls(\n initialResponse,\n (functionCallResults) =>\n mutation.mutateAsync({\n chatId,\n namespace,\n message: '',\n functionCallResults,\n }),\n );\n };\n}\n"],"mappings":";;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAMO,SAASK,gBAAgBA,CAACC,MAAc,EAAEC,SAAiB,EAAE;EAClE,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,2BAAc,EAAC,C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M;MACNC,SAAS;MACTmB,OAAO,EAAEA,OAAO,CAACA,OAAO,IAAI,EAAE;MAC9BkB,UAAU,EAAElB,OAAO,CAACkB,UAAU;MAC9BT,WAAW,EAAET,OAAO,CAACS,WAAW;MAChCU,QAAQ,EAAEnB,OAAO,CAACmB;IACpB,CAAC,CAAC;IAEF,OAAOnC,WAAW,CAACoC,wBAAwB,CACzCJ,eAAe,EACdK,mBAAmB,IAClBjC,QAAQ,CAAC6B,WAAW,CAAC;MACnBrC,MAAM;MACNC,SAAS;MACTmB,OAAO,EAAE,EAAE;MACXqB;IACF,CAAC,CACL,CAAC;EACH,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_http","require","exports","HttpError"],"sources":["../../../src/types/index.ts"],"sourcesContent":["export type { IHttpClient, HttpRequestConfig } from './http';\nexport { HttpError } from './http';\nexport type {\n IPersonaChatService,\n ConversationResult,\n CreateConversationParams,\n EndConversationParams,\n SendMessageParams,\n ChatMessage,\n ChatMessageAttachment,\n QueryMessagesParams,\n QueryMessagesResult,\n FunctionCall,\n FunctionCallResult,\n Limitation,\n LimitationType,\n} from './service';\n"],"mappings":";;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAAmCC,OAAA,CAAAC,SAAA,GAAAH,KAAA,CAAAG,SAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_http","require","exports","HttpError"],"sources":["../../../src/types/index.ts"],"sourcesContent":["export type { IHttpClient, HttpRequestConfig } from './http';\nexport { HttpError } from './http';\nexport type {\n IPersonaChatService,\n ConversationResult,\n CreateConversationParams,\n EndConversationParams,\n SendMessageParams,\n SendMessageMetadata,\n AdditionalMetadata,\n ChatMessage,\n ChatMessageAttachment,\n QueryMessagesParams,\n QueryMessagesResult,\n FunctionCall,\n FunctionCallResult,\n Limitation,\n LimitationType,\n} from './service';\n"],"mappings":";;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAAmCC,OAAA,CAAAC,SAAA,GAAAH,KAAA,CAAAG,SAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/types/service.ts"],"sourcesContent":["export type FunctionCall = {\n functionCallId: string;\n name: string;\n arguments: string;\n};\n\nexport type FunctionCallResult = {\n functionCallId: string;\n result: string;\n error?: string;\n};\n\nexport type LimitationType = 'MINUTES' | 'SECONDS' | 'TOKENS';\n\nexport interface Limitation {\n type?: LimitationType;\n limit?: number;\n}\n\nexport interface ConversationResult {\n url: string;\n id: string;\n limit?: number;\n}\n\nexport interface CreateConversationParams {\n chatId: string;\n namespace: string;\n chatConfig?: object;\n /** Whether this is the visitor's first-ever conversation with the persona (drives the opening message). */\n firstConversation?: boolean;\n /** Title of the visitor's last meaningful conversation, for a returning-visitor greeting. */\n lastConversationTopic?: string;\n}\n\nexport interface EndConversationParams {\n chatId: string;\n conversationId: string;\n namespace: string;\n}\n\nexport interface ChatMessageAttachment {\n fileName?: string;\n url?: string;\n mimeType?: string;\n textFileContent?: string;\n}\n\nexport interface SendMessageParams {\n chatId: string;\n namespace: string;\n message: string;\n functionCallResults?: FunctionCallResult[];\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n}\n\nexport interface ChatMessage {\n id: string;\n content: string;\n role: 'USER' | 'ASSISTANT';\n createdAt?: string;\n attachments?: ChatMessageAttachment[];\n}\n\nexport interface QueryMessagesParams {\n chatId: string;\n namespace: string;\n limit?: number;\n cursor?: string;\n}\n\nexport interface QueryMessagesResult {\n messages: ChatMessage[];\n nextCursor?: string;\n}\n\nexport interface IPersonaChatService {\n createVoiceConversation(\n params: CreateConversationParams,\n ): Promise<ConversationResult>;\n createInteractiveConversation(\n params: CreateConversationParams,\n ): Promise<ConversationResult>;\n endInteractiveConversation(params: EndConversationParams): Promise<void>;\n sendChatMessage(\n params: SendMessageParams,\n ): Promise<{ functionCalls?: FunctionCall[]; messages?: ChatMessage[] }>;\n queryChatMessages(params: QueryMessagesParams): Promise<QueryMessagesResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/service.ts"],"sourcesContent":["export type FunctionCall = {\n functionCallId: string;\n name: string;\n arguments: string;\n};\n\nexport type FunctionCallResult = {\n functionCallId: string;\n result: string;\n error?: string;\n};\n\nexport type LimitationType = 'MINUTES' | 'SECONDS' | 'TOKENS';\n\nexport interface Limitation {\n type?: LimitationType;\n limit?: number;\n}\n\nexport interface ConversationResult {\n url: string;\n id: string;\n limit?: number;\n}\n\nexport interface CreateConversationParams {\n chatId: string;\n namespace: string;\n chatConfig?: object;\n /** Whether this is the visitor's first-ever conversation with the persona (drives the opening message). */\n firstConversation?: boolean;\n /** Title of the visitor's last meaningful conversation, for a returning-visitor greeting. */\n lastConversationTopic?: string;\n}\n\nexport interface EndConversationParams {\n chatId: string;\n conversationId: string;\n namespace: string;\n}\n\nexport interface ChatMessageAttachment {\n fileName?: string;\n url?: string | null;\n mimeType?: string;\n textFileContent?: string | null;\n}\n\nexport interface AdditionalMetadata {\n key?: string | null;\n value?: string | null;\n excludeFromPrompt?: boolean | null;\n}\n\nexport interface SendMessageMetadata {\n additionalMetadata?: AdditionalMetadata[];\n}\n\nexport interface SendMessageParams {\n chatId: string;\n namespace: string;\n message: string;\n functionCallResults?: FunctionCallResult[];\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n metadata?: SendMessageMetadata;\n}\n\nexport interface ChatMessage {\n id: string;\n content: string;\n role: 'USER' | 'ASSISTANT';\n createdAt?: string;\n attachments?: ChatMessageAttachment[];\n}\n\nexport interface QueryMessagesParams {\n chatId: string;\n namespace: string;\n limit?: number;\n cursor?: string;\n}\n\nexport interface QueryMessagesResult {\n messages: ChatMessage[];\n nextCursor?: string;\n}\n\nexport interface IPersonaChatService {\n createVoiceConversation(\n params: CreateConversationParams,\n ): Promise<ConversationResult>;\n createInteractiveConversation(\n params: CreateConversationParams,\n ): Promise<ConversationResult>;\n endInteractiveConversation(params: EndConversationParams): Promise<void>;\n sendChatMessage(\n params: SendMessageParams,\n ): Promise<{ functionCalls?: FunctionCall[]; messages?: ChatMessage[] }>;\n queryChatMessages(params: QueryMessagesParams): Promise<QueryMessagesResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useInfiniteQuery","useSdkConsumer","usePendingMessages","useToolAwareSend","useTextChat","options","_options","_options$limit","limit","_useSdkConsumer","chatId","namespace","personaChatService","send","pending","_useInfiniteQuery","queryKey","queryFn","_ref","pageParam","messages","nextCursor","undefined","queryChatMessages","cursor","getNextPageParam","lastPage","initialPageParam","select","data","pages","flatMap","page","_useInfiniteQuery$dat","status","fetchNextPage","refetch","fetchNext","sendMessage","message"],"sources":["../../../../src/hooks/useTextChat/useTextChat.ts"],"sourcesContent":["import { useInfiniteQuery } from '@tanstack/react-query';\nimport type {
|
|
1
|
+
{"version":3,"names":["useInfiniteQuery","useSdkConsumer","usePendingMessages","useToolAwareSend","useTextChat","options","_options","_options$limit","limit","_useSdkConsumer","chatId","namespace","personaChatService","send","pending","_useInfiniteQuery","queryKey","queryFn","_ref","pageParam","messages","nextCursor","undefined","queryChatMessages","cursor","getNextPageParam","lastPage","initialPageParam","select","data","pages","flatMap","page","_useInfiniteQuery$dat","status","fetchNextPage","refetch","fetchNext","sendMessage","message"],"sources":["../../../../src/hooks/useTextChat/useTextChat.ts"],"sourcesContent":["import { useInfiniteQuery } from '@tanstack/react-query';\nimport type {\n ChatMessage,\n ChatMessageAttachment,\n SendMessageMetadata,\n} from '../../types';\nimport { useSdkConsumer } from '../../sdk-consumer';\nimport { usePendingMessages } from './usePendingMessages';\nimport { useToolAwareSend } from './useToolAwareSend';\n\ninterface UseTextChatOptions {\n limit?: number;\n}\n\nexport function useTextChat(options: UseTextChatOptions = {}) {\n const { limit = 100 } = options;\n\n const { chatId, namespace, personaChatService } = useSdkConsumer();\n\n const send = useToolAwareSend(chatId, namespace);\n const pending = usePendingMessages();\n\n const {\n data: messages = [],\n status,\n fetchNextPage,\n refetch,\n } = useInfiniteQuery({\n queryKey: ['chat-messages', chatId, namespace],\n queryFn: async ({ pageParam }: { pageParam?: string }) => {\n if (!personaChatService) {\n return { messages: [], nextCursor: undefined };\n }\n return personaChatService.queryChatMessages({\n chatId,\n namespace,\n limit,\n cursor: pageParam,\n });\n },\n getNextPageParam: (lastPage) => lastPage.nextCursor,\n initialPageParam: undefined as string | undefined,\n select: (data) =>\n data.pages.flatMap((page) => page.messages as ChatMessage[]),\n });\n\n return {\n status,\n pending,\n messages,\n fetchNext,\n refetch,\n send: sendMessage,\n };\n\n function sendMessage(message: {\n message?: string;\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n metadata?: SendMessageMetadata;\n }) {\n return send(message);\n }\n\n function fetchNext() {\n void fetchNextPage();\n }\n}\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,uBAAuB;AAMxD,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;AAMrD,OAAO,SAASC,WAAWA,CAACC,OAA2B,EAAO;EAAA,IAAlCA,OAA2B;IAA3BA,OAA2B,GAAG,CAAC,CAAC;EAAA;EAC1D,MAAAC,QAAA,GAAwBD,OAAO;IAAAE,cAAA,GAAAD,QAAA,CAAvBE,KAAK;IAALA,KAAK,GAAAD,cAAA,cAAG,GAAG,GAAAA,cAAA;EAEnB,MAAAE,eAAA,GAAkDR,cAAc,CAAC,CAAC;IAA1DS,MAAM,GAAAD,eAAA,CAANC,MAAM;IAAEC,SAAS,GAAAF,eAAA,CAATE,SAAS;IAAEC,kBAAkB,GAAAH,eAAA,CAAlBG,kBAAkB;EAE7C,MAAMC,IAAI,GAAGV,gBAAgB,CAACO,MAAM,EAAEC,SAAS,CAAC;EAChD,MAAMG,OAAO,GAAGZ,kBAAkB,CAAC,CAAC;EAEpC,MAAAa,iBAAA,GAKIf,gBAAgB,CAAC;MACnBgB,QAAQ,EAAE,CAAC,eAAe,EAAEN,MAAM,EAAEC,SAAS,CAAC;MAC9CM,OAAO,EAAE,MAAAC,IAAA,IAAiD;QAAA,IAAxCC,SAAS,GAAAD,IAAA,CAATC,SAAS;QACzB,IAAI,CAACP,kBAAkB,EAAE;UACvB,OAAO;YAAEQ,QAAQ,EAAE,EAAE;YAAEC,UAAU,EAAEC;UAAU,CAAC;QAChD;QACA,OAAOV,kBAAkB,CAACW,iBAAiB,CAAC;UAC1Cb,MAAM;UACNC,SAAS;UACTH,KAAK;UACLgB,MAAM,EAAEL;QACV,CAAC,CAAC;MACJ,CAAC;MACDM,gBAAgB,EAAGC,QAAQ,IAAKA,QAAQ,CAACL,UAAU;MACnDM,gBAAgB,EAAEL,SAA+B;MACjDM,MAAM,EAAGC,IAAI,IACXA,IAAI,CAACC,KAAK,CAACC,OAAO,CAAEC,IAAI,IAAKA,IAAI,CAACZ,QAAyB;IAC/D,CAAC,CAAC;IAAAa,qBAAA,GAAAlB,iBAAA,CArBAc,IAAI;IAAET,QAAQ,GAAAa,qBAAA,cAAG,EAAE,GAAAA,qBAAA;IACnBC,MAAM,GAAAnB,iBAAA,CAANmB,MAAM;IACNC,aAAa,GAAApB,iBAAA,CAAboB,aAAa;IACbC,OAAO,GAAArB,iBAAA,CAAPqB,OAAO;EAoBT,OAAO;IACLF,MAAM;IACNpB,OAAO;IACPM,QAAQ;IACRiB,SAAS;IACTD,OAAO;IACPvB,IAAI,EAAEyB;EACR,CAAC;EAED,SAASA,WAAWA,CAACC,OAKpB,EAAE;IACD,OAAO1B,IAAI,CAAC0B,OAAO,CAAC;EACtB;EAEA,SAASF,SAASA,CAAA,EAAG;IACnB,KAAKF,aAAa,CAAC,CAAC;EACtB;AACF","ignoreList":[]}
|
|
@@ -41,7 +41,8 @@ export function useToolAwareSend(chatId, namespace) {
|
|
|
41
41
|
namespace,
|
|
42
42
|
message: message.message ?? '',
|
|
43
43
|
chatConfig: message.chatConfig,
|
|
44
|
-
attachments: message.attachments
|
|
44
|
+
attachments: message.attachments,
|
|
45
|
+
metadata: message.metadata
|
|
45
46
|
});
|
|
46
47
|
return toolRuntime.resolveResponseToolCalls(initialResponse, functionCallResults => mutation.mutateAsync({
|
|
47
48
|
chatId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMutation","useQueryClient","useSdkConsumer","ToolExecutionInProgressError","useToolCallingRuntime","append","appendMany","useToolAwareSend","chatId","namespace","_useSdkConsumer","personaChatService","toolRuntime","queryClient","mutation","mutationKey","mutationFn","params","Error","sendChatMessage","onSuccess","data","variables","_data$messages","queryKey","message","setQueryData","id","Date","now","toString","content","role","attachments","messages","length","send","isRunning","initialResponse","mutateAsync","chatConfig","resolveResponseToolCalls","functionCallResults"],"sources":["../../../../src/hooks/useTextChat/useToolAwareSend.ts"],"sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query';\nimport type {\n FunctionCall,\n ChatMessageAttachment,\n SendMessageParams,\n} from '../../types';\nimport { useSdkConsumer } from '../../sdk-consumer';\nimport { ToolExecutionInProgressError } from '../useTools';\nimport { useToolCallingRuntime } from '../useTools/runtime/useToolCallingRuntime';\nimport { append, appendMany } from './helpers';\n\nexport interface SendChatMessageResponse {\n functionCalls?: FunctionCall[];\n}\n\nexport function useToolAwareSend(chatId: string, namespace: string) {\n const { personaChatService } = useSdkConsumer();\n const toolRuntime = useToolCallingRuntime<SendChatMessageResponse>();\n const queryClient = useQueryClient();\n\n const mutation = useMutation({\n mutationKey: ['pending-chat-message'],\n mutationFn: (params: SendMessageParams) => {\n if (!personaChatService) {\n throw new Error('personaChatService is required to send messages.');\n }\n return personaChatService.sendChatMessage(params);\n },\n onSuccess(data, variables) {\n const queryKey = ['chat-messages', chatId, namespace];\n\n if (variables.message) {\n queryClient.setQueryData(\n queryKey,\n append({\n id: Date.now().toString(),\n content: variables.message,\n role: 'USER' as const,\n attachments: variables.attachments,\n }),\n );\n }\n\n if (data.messages?.length) {\n queryClient.setQueryData(queryKey, appendMany(data.messages));\n }\n },\n });\n\n return async function send(message: {\n message?: string;\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n }) {\n if (toolRuntime.isRunning) {\n throw new ToolExecutionInProgressError();\n }\n\n const initialResponse = await mutation.mutateAsync({\n chatId,\n namespace,\n message: message.message ?? '',\n chatConfig: message.chatConfig,\n attachments: message.attachments,\n });\n\n return toolRuntime.resolveResponseToolCalls(\n initialResponse,\n (functionCallResults) =>\n mutation.mutateAsync({\n chatId,\n namespace,\n message: '',\n functionCallResults,\n }),\n );\n };\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,cAAc,QAAQ,uBAAuB;
|
|
1
|
+
{"version":3,"names":["useMutation","useQueryClient","useSdkConsumer","ToolExecutionInProgressError","useToolCallingRuntime","append","appendMany","useToolAwareSend","chatId","namespace","_useSdkConsumer","personaChatService","toolRuntime","queryClient","mutation","mutationKey","mutationFn","params","Error","sendChatMessage","onSuccess","data","variables","_data$messages","queryKey","message","setQueryData","id","Date","now","toString","content","role","attachments","messages","length","send","isRunning","initialResponse","mutateAsync","chatConfig","metadata","resolveResponseToolCalls","functionCallResults"],"sources":["../../../../src/hooks/useTextChat/useToolAwareSend.ts"],"sourcesContent":["import { useMutation, useQueryClient } from '@tanstack/react-query';\nimport type {\n FunctionCall,\n ChatMessageAttachment,\n SendMessageParams,\n SendMessageMetadata,\n} from '../../types';\nimport { useSdkConsumer } from '../../sdk-consumer';\nimport { ToolExecutionInProgressError } from '../useTools';\nimport { useToolCallingRuntime } from '../useTools/runtime/useToolCallingRuntime';\nimport { append, appendMany } from './helpers';\n\nexport interface SendChatMessageResponse {\n functionCalls?: FunctionCall[];\n}\n\nexport function useToolAwareSend(chatId: string, namespace: string) {\n const { personaChatService } = useSdkConsumer();\n const toolRuntime = useToolCallingRuntime<SendChatMessageResponse>();\n const queryClient = useQueryClient();\n\n const mutation = useMutation({\n mutationKey: ['pending-chat-message'],\n mutationFn: (params: SendMessageParams) => {\n if (!personaChatService) {\n throw new Error('personaChatService is required to send messages.');\n }\n return personaChatService.sendChatMessage(params);\n },\n onSuccess(data, variables) {\n const queryKey = ['chat-messages', chatId, namespace];\n\n if (variables.message) {\n queryClient.setQueryData(\n queryKey,\n append({\n id: Date.now().toString(),\n content: variables.message,\n role: 'USER' as const,\n attachments: variables.attachments,\n }),\n );\n }\n\n if (data.messages?.length) {\n queryClient.setQueryData(queryKey, appendMany(data.messages));\n }\n },\n });\n\n return async function send(message: {\n message?: string;\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n metadata?: SendMessageMetadata;\n }) {\n if (toolRuntime.isRunning) {\n throw new ToolExecutionInProgressError();\n }\n\n const initialResponse = await mutation.mutateAsync({\n chatId,\n namespace,\n message: message.message ?? '',\n chatConfig: message.chatConfig,\n attachments: message.attachments,\n metadata: message.metadata,\n });\n\n return toolRuntime.resolveResponseToolCalls(\n initialResponse,\n (functionCallResults) =>\n mutation.mutateAsync({\n chatId,\n namespace,\n message: '',\n functionCallResults,\n }),\n );\n };\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,cAAc,QAAQ,uBAAuB;AAOnE,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,4BAA4B,QAAQ,aAAa;AAC1D,SAASC,qBAAqB,QAAQ,2CAA2C;AACjF,SAASC,MAAM,EAAEC,UAAU,QAAQ,WAAW;AAM9C,OAAO,SAASC,gBAAgBA,CAACC,MAAc,EAAEC,SAAiB,EAAE;EAClE,MAAAC,eAAA,GAA+BR,cAAc,CAAC,CAAC;IAAvCS,kBAAkB,GAAAD,eAAA,CAAlBC,kBAAkB;EAC1B,MAAMC,WAAW,GAAGR,qBAAqB,CAA0B,CAAC;EACpE,MAAMS,WAAW,GAAGZ,cAAc,CAAC,CAAC;EAEpC,MAAMa,QAAQ,GAAGd,WAAW,CAAC;IAC3Be,WAAW,EAAE,CAAC,sBAAsB,CAAC;IACrCC,UAAU,EAAGC,MAAyB,IAAK;MACzC,IA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BAAmB,IAClB7B,QAAQ,CAACyB,WAAW,CAAC;MACnB/B,MAAM;MACNC,SAAS;MACTgB,OAAO,EAAE,EAAE;MACXkB;IACF,CAAC,CACL,CAAC;EACH,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HttpError"],"sources":["../../../src/types/index.ts"],"sourcesContent":["export type { IHttpClient, HttpRequestConfig } from './http';\nexport { HttpError } from './http';\nexport type {\n IPersonaChatService,\n ConversationResult,\n CreateConversationParams,\n EndConversationParams,\n SendMessageParams,\n ChatMessage,\n ChatMessageAttachment,\n QueryMessagesParams,\n QueryMessagesResult,\n FunctionCall,\n FunctionCallResult,\n Limitation,\n LimitationType,\n} from './service';\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["HttpError"],"sources":["../../../src/types/index.ts"],"sourcesContent":["export type { IHttpClient, HttpRequestConfig } from './http';\nexport { HttpError } from './http';\nexport type {\n IPersonaChatService,\n ConversationResult,\n CreateConversationParams,\n EndConversationParams,\n SendMessageParams,\n SendMessageMetadata,\n AdditionalMetadata,\n ChatMessage,\n ChatMessageAttachment,\n QueryMessagesParams,\n QueryMessagesResult,\n FunctionCall,\n FunctionCallResult,\n Limitation,\n LimitationType,\n} from './service';\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,QAAQ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/types/service.ts"],"sourcesContent":["export type FunctionCall = {\n functionCallId: string;\n name: string;\n arguments: string;\n};\n\nexport type FunctionCallResult = {\n functionCallId: string;\n result: string;\n error?: string;\n};\n\nexport type LimitationType = 'MINUTES' | 'SECONDS' | 'TOKENS';\n\nexport interface Limitation {\n type?: LimitationType;\n limit?: number;\n}\n\nexport interface ConversationResult {\n url: string;\n id: string;\n limit?: number;\n}\n\nexport interface CreateConversationParams {\n chatId: string;\n namespace: string;\n chatConfig?: object;\n /** Whether this is the visitor's first-ever conversation with the persona (drives the opening message). */\n firstConversation?: boolean;\n /** Title of the visitor's last meaningful conversation, for a returning-visitor greeting. */\n lastConversationTopic?: string;\n}\n\nexport interface EndConversationParams {\n chatId: string;\n conversationId: string;\n namespace: string;\n}\n\nexport interface ChatMessageAttachment {\n fileName?: string;\n url?: string;\n mimeType?: string;\n textFileContent?: string;\n}\n\nexport interface SendMessageParams {\n chatId: string;\n namespace: string;\n message: string;\n functionCallResults?: FunctionCallResult[];\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n}\n\nexport interface ChatMessage {\n id: string;\n content: string;\n role: 'USER' | 'ASSISTANT';\n createdAt?: string;\n attachments?: ChatMessageAttachment[];\n}\n\nexport interface QueryMessagesParams {\n chatId: string;\n namespace: string;\n limit?: number;\n cursor?: string;\n}\n\nexport interface QueryMessagesResult {\n messages: ChatMessage[];\n nextCursor?: string;\n}\n\nexport interface IPersonaChatService {\n createVoiceConversation(\n params: CreateConversationParams,\n ): Promise<ConversationResult>;\n createInteractiveConversation(\n params: CreateConversationParams,\n ): Promise<ConversationResult>;\n endInteractiveConversation(params: EndConversationParams): Promise<void>;\n sendChatMessage(\n params: SendMessageParams,\n ): Promise<{ functionCalls?: FunctionCall[]; messages?: ChatMessage[] }>;\n queryChatMessages(params: QueryMessagesParams): Promise<QueryMessagesResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/service.ts"],"sourcesContent":["export type FunctionCall = {\n functionCallId: string;\n name: string;\n arguments: string;\n};\n\nexport type FunctionCallResult = {\n functionCallId: string;\n result: string;\n error?: string;\n};\n\nexport type LimitationType = 'MINUTES' | 'SECONDS' | 'TOKENS';\n\nexport interface Limitation {\n type?: LimitationType;\n limit?: number;\n}\n\nexport interface ConversationResult {\n url: string;\n id: string;\n limit?: number;\n}\n\nexport interface CreateConversationParams {\n chatId: string;\n namespace: string;\n chatConfig?: object;\n /** Whether this is the visitor's first-ever conversation with the persona (drives the opening message). */\n firstConversation?: boolean;\n /** Title of the visitor's last meaningful conversation, for a returning-visitor greeting. */\n lastConversationTopic?: string;\n}\n\nexport interface EndConversationParams {\n chatId: string;\n conversationId: string;\n namespace: string;\n}\n\nexport interface ChatMessageAttachment {\n fileName?: string;\n url?: string | null;\n mimeType?: string;\n textFileContent?: string | null;\n}\n\nexport interface AdditionalMetadata {\n key?: string | null;\n value?: string | null;\n excludeFromPrompt?: boolean | null;\n}\n\nexport interface SendMessageMetadata {\n additionalMetadata?: AdditionalMetadata[];\n}\n\nexport interface SendMessageParams {\n chatId: string;\n namespace: string;\n message: string;\n functionCallResults?: FunctionCallResult[];\n chatConfig?: object;\n attachments?: ChatMessageAttachment[];\n metadata?: SendMessageMetadata;\n}\n\nexport interface ChatMessage {\n id: string;\n content: string;\n role: 'USER' | 'ASSISTANT';\n createdAt?: string;\n attachments?: ChatMessageAttachment[];\n}\n\nexport interface QueryMessagesParams {\n chatId: string;\n namespace: string;\n limit?: number;\n cursor?: string;\n}\n\nexport interface QueryMessagesResult {\n messages: ChatMessage[];\n nextCursor?: string;\n}\n\nexport interface IPersonaChatService {\n createVoiceConversation(\n params: CreateConversationParams,\n ): Promise<ConversationResult>;\n createInteractiveConversation(\n params: CreateConversationParams,\n ): Promise<ConversationResult>;\n endInteractiveConversation(params: EndConversationParams): Promise<void>;\n sendChatMessage(\n params: SendMessageParams,\n ): Promise<{ functionCalls?: FunctionCall[]; messages?: ChatMessage[] }>;\n queryChatMessages(params: QueryMessagesParams): Promise<QueryMessagesResult>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatMessage, ChatMessageAttachment } from '../../types';
|
|
1
|
+
import type { ChatMessage, ChatMessageAttachment, SendMessageMetadata } from '../../types';
|
|
2
2
|
interface UseTextChatOptions {
|
|
3
3
|
limit?: number;
|
|
4
4
|
}
|
|
@@ -17,6 +17,7 @@ export declare function useTextChat(options?: UseTextChatOptions): {
|
|
|
17
17
|
message?: string | undefined;
|
|
18
18
|
chatConfig?: object | undefined;
|
|
19
19
|
attachments?: ChatMessageAttachment[] | undefined;
|
|
20
|
+
metadata?: SendMessageMetadata | undefined;
|
|
20
21
|
}) => Promise<import("./useToolAwareSend").SendChatMessageResponse>;
|
|
21
22
|
};
|
|
22
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTextChat.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useTextChat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useTextChat.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useTextChat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAKrB,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB;;;;;;;;;;;;;;;;;EAqD3D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FunctionCall, ChatMessageAttachment } from '../../types';
|
|
1
|
+
import type { FunctionCall, ChatMessageAttachment, SendMessageMetadata } from '../../types';
|
|
2
2
|
export interface SendChatMessageResponse {
|
|
3
3
|
functionCalls?: FunctionCall[];
|
|
4
4
|
}
|
|
@@ -6,5 +6,6 @@ export declare function useToolAwareSend(chatId: string, namespace: string): (me
|
|
|
6
6
|
message?: string | undefined;
|
|
7
7
|
chatConfig?: object | undefined;
|
|
8
8
|
attachments?: ChatMessageAttachment[] | undefined;
|
|
9
|
+
metadata?: SendMessageMetadata | undefined;
|
|
9
10
|
}) => Promise<SendChatMessageResponse>;
|
|
10
11
|
//# sourceMappingURL=useToolAwareSend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToolAwareSend.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useToolAwareSend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,
|
|
1
|
+
{"version":3,"file":"useToolAwareSend.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTextChat/useToolAwareSend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EAErB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAMrB,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;uCAgEjE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { IHttpClient, HttpRequestConfig } from './http';
|
|
2
2
|
export { HttpError } from './http';
|
|
3
|
-
export type { IPersonaChatService, ConversationResult, CreateConversationParams, EndConversationParams, SendMessageParams, ChatMessage, ChatMessageAttachment, QueryMessagesParams, QueryMessagesResult, FunctionCall, FunctionCallResult, Limitation, LimitationType, } from './service';
|
|
3
|
+
export type { IPersonaChatService, ConversationResult, CreateConversationParams, EndConversationParams, SendMessageParams, SendMessageMetadata, AdditionalMetadata, ChatMessage, ChatMessageAttachment, QueryMessagesParams, QueryMessagesResult, FunctionCall, FunctionCallResult, Limitation, LimitationType, } from './service';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,cAAc,GACf,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,cAAc,GACf,MAAM,WAAW,CAAC"}
|
|
@@ -34,9 +34,17 @@ export interface EndConversationParams {
|
|
|
34
34
|
}
|
|
35
35
|
export interface ChatMessageAttachment {
|
|
36
36
|
fileName?: string;
|
|
37
|
-
url?: string;
|
|
37
|
+
url?: string | null;
|
|
38
38
|
mimeType?: string;
|
|
39
|
-
textFileContent?: string;
|
|
39
|
+
textFileContent?: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface AdditionalMetadata {
|
|
42
|
+
key?: string | null;
|
|
43
|
+
value?: string | null;
|
|
44
|
+
excludeFromPrompt?: boolean | null;
|
|
45
|
+
}
|
|
46
|
+
export interface SendMessageMetadata {
|
|
47
|
+
additionalMetadata?: AdditionalMetadata[];
|
|
40
48
|
}
|
|
41
49
|
export interface SendMessageParams {
|
|
42
50
|
chatId: string;
|
|
@@ -45,6 +53,7 @@ export interface SendMessageParams {
|
|
|
45
53
|
functionCallResults?: FunctionCallResult[];
|
|
46
54
|
chatConfig?: object;
|
|
47
55
|
attachments?: ChatMessageAttachment[];
|
|
56
|
+
metadata?: SendMessageMetadata;
|
|
48
57
|
}
|
|
49
58
|
export interface ChatMessage {
|
|
50
59
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/types/service.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2GAA2G;IAC3G,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,6FAA6F;IAC7F,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/types/service.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;I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AE,YAAY,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;KAAE,CAAC,CAAC;IACzE,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9E"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.11.0",
|
|
3
3
|
"name": "@wix/legends-platform-sdk",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@tanstack/react-query": "^5.74.2",
|
|
76
76
|
"lodash": "^4.17.16",
|
|
77
|
-
"react": "^16.8.0",
|
|
78
|
-
"react-dom": "^16.8.0"
|
|
77
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
78
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
79
79
|
},
|
|
80
80
|
"jest": {
|
|
81
81
|
"preset": "@wix/jest-yoshi-preset"
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"wallaby": {
|
|
104
104
|
"autoDetect": true
|
|
105
105
|
},
|
|
106
|
-
"falconPackageHash": "
|
|
106
|
+
"falconPackageHash": "96c20a4fb8f1770afc7ff3b8f303787d1931a80acc24ee437f961380"
|
|
107
107
|
}
|