@chatsdk-dev/elements 0.0.1

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.
Files changed (218) hide show
  1. package/README.md +43 -0
  2. package/dist/chunk-2LHKM7RD.js +14 -0
  3. package/dist/chunk-5UMYP6MD.js +10 -0
  4. package/dist/chunk-AP4MG32M.js +36 -0
  5. package/dist/chunk-CFM57HOS.js +358 -0
  6. package/dist/chunk-EGIUE7H2.js +37 -0
  7. package/dist/chunk-M5OONVIO.js +90 -0
  8. package/dist/chunk-MXTBCHYC.js +31 -0
  9. package/dist/chunk-NIC3MOMY.js +55 -0
  10. package/dist/chunk-QTRMNIG3.js +83 -0
  11. package/dist/chunk-R7G3RQLU.js +36 -0
  12. package/dist/chunk-RJG5D2TM.js +113 -0
  13. package/dist/chunk-SLJNKQ2G.js +125 -0
  14. package/dist/chunk-TDEFIW2L.js +9 -0
  15. package/dist/chunk-TDP6D7U7.js +551 -0
  16. package/dist/chunk-V2ITXC65.js +24 -0
  17. package/dist/chunk-VS55HRUS.js +16 -0
  18. package/dist/chunk-VYDYCGJL.js +25 -0
  19. package/dist/chunk-X5YUF2YM.js +113 -0
  20. package/dist/chunk-YX46JVQN.js +78 -0
  21. package/dist/chunk-YXAMLTTT.js +16 -0
  22. package/dist/chunk-YXFVHSY4.js +51 -0
  23. package/dist/chunk-ZCSZX3OI.js +4 -0
  24. package/dist/common/use-copy-to-clipboard.d.ts +3 -0
  25. package/dist/common/use-copy-to-clipboard.js +33 -0
  26. package/dist/common/utilts.d.ts +8 -0
  27. package/dist/common/utilts.js +28 -0
  28. package/dist/components/ai-elements/actions.d.ts +13 -0
  29. package/dist/components/ai-elements/actions.js +42 -0
  30. package/dist/components/ai-elements/agent.d.ts +31 -0
  31. package/dist/components/ai-elements/agent.js +77 -0
  32. package/dist/components/ai-elements/artifact.d.ts +27 -0
  33. package/dist/components/ai-elements/artifact.js +108 -0
  34. package/dist/components/ai-elements/attachments.d.ts +57 -0
  35. package/dist/components/ai-elements/attachments.js +258 -0
  36. package/dist/components/ai-elements/audio-player.d.ts +33 -0
  37. package/dist/components/ai-elements/audio-player.js +199 -0
  38. package/dist/components/ai-elements/canvas.d.ts +10 -0
  39. package/dist/components/ai-elements/canvas.js +24 -0
  40. package/dist/components/ai-elements/chain-of-thought.d.ts +34 -0
  41. package/dist/components/ai-elements/chain-of-thought.js +159 -0
  42. package/dist/components/ai-elements/checkpoint.d.ts +16 -0
  43. package/dist/components/ai-elements/checkpoint.js +47 -0
  44. package/dist/components/ai-elements/code-block.d.ts +48 -0
  45. package/dist/components/ai-elements/code-block.js +1 -0
  46. package/dist/components/ai-elements/commit.d.ts +68 -0
  47. package/dist/components/ai-elements/commit.js +314 -0
  48. package/dist/components/ai-elements/confirmation.d.ts +52 -0
  49. package/dist/components/ai-elements/confirmation.js +76 -0
  50. package/dist/components/ai-elements/connection.d.ts +5 -0
  51. package/dist/components/ai-elements/connection.js +34 -0
  52. package/dist/components/ai-elements/context.d.ts +36 -0
  53. package/dist/components/ai-elements/context.js +320 -0
  54. package/dist/components/ai-elements/controls.d.ts +8 -0
  55. package/dist/components/ai-elements/controls.js +17 -0
  56. package/dist/components/ai-elements/conversation.d.ts +27 -0
  57. package/dist/components/ai-elements/conversation.js +119 -0
  58. package/dist/components/ai-elements/edge.d.ts +9 -0
  59. package/dist/components/ai-elements/edge.js +111 -0
  60. package/dist/components/ai-elements/environment-variables.d.ts +42 -0
  61. package/dist/components/ai-elements/environment-variables.js +208 -0
  62. package/dist/components/ai-elements/file-tree.d.ts +30 -0
  63. package/dist/components/ai-elements/file-tree.js +212 -0
  64. package/dist/components/ai-elements/image.d.ts +10 -0
  65. package/dist/components/ai-elements/image.js +23 -0
  66. package/dist/components/ai-elements/inline-citation.d.ts +42 -0
  67. package/dist/components/ai-elements/inline-citation.js +203 -0
  68. package/dist/components/ai-elements/jsx-preview.d.ts +33 -0
  69. package/dist/components/ai-elements/jsx-preview.js +206 -0
  70. package/dist/components/ai-elements/loader.d.ts +9 -0
  71. package/dist/components/ai-elements/loader.js +115 -0
  72. package/dist/components/ai-elements/message.d.ts +42 -0
  73. package/dist/components/ai-elements/message.js +259 -0
  74. package/dist/components/ai-elements/mic-selector.d.ts +49 -0
  75. package/dist/components/ai-elements/mic-selector.js +252 -0
  76. package/dist/components/ai-elements/model-selector.d.ts +39 -0
  77. package/dist/components/ai-elements/model-selector.js +73 -0
  78. package/dist/components/ai-elements/node.d.ts +25 -0
  79. package/dist/components/ai-elements/node.js +41 -0
  80. package/dist/components/ai-elements/open-in-chat.d.ts +32 -0
  81. package/dist/components/ai-elements/open-in-chat.js +366 -0
  82. package/dist/components/ai-elements/package-info.d.ts +32 -0
  83. package/dist/components/ai-elements/package-info.js +162 -0
  84. package/dist/components/ai-elements/panel.d.ts +8 -0
  85. package/dist/components/ai-elements/panel.js +17 -0
  86. package/dist/components/ai-elements/persona.d.ts +50 -0
  87. package/dist/components/ai-elements/persona.js +209 -0
  88. package/dist/components/ai-elements/plan.d.ts +29 -0
  89. package/dist/components/ai-elements/plan.js +95 -0
  90. package/dist/components/ai-elements/prompt-input.d.ts +153 -0
  91. package/dist/components/ai-elements/prompt-input.js +939 -0
  92. package/dist/components/ai-elements/queue.d.ts +65 -0
  93. package/dist/components/ai-elements/queue.js +179 -0
  94. package/dist/components/ai-elements/reasoning.d.ts +30 -0
  95. package/dist/components/ai-elements/reasoning.js +161 -0
  96. package/dist/components/ai-elements/response.d.ts +9 -0
  97. package/dist/components/ai-elements/response.js +33 -0
  98. package/dist/components/ai-elements/sandbox.d.ts +28 -0
  99. package/dist/components/ai-elements/sandbox.js +98 -0
  100. package/dist/components/ai-elements/schema-display.d.ts +58 -0
  101. package/dist/components/ai-elements/schema-display.js +313 -0
  102. package/dist/components/ai-elements/shimmer.d.ts +14 -0
  103. package/dist/components/ai-elements/shimmer.js +1 -0
  104. package/dist/components/ai-elements/snippet.d.ts +22 -0
  105. package/dist/components/ai-elements/snippet.js +90 -0
  106. package/dist/components/ai-elements/sources.d.ts +16 -0
  107. package/dist/components/ai-elements/sources.js +62 -0
  108. package/dist/components/ai-elements/speech-input.d.ts +57 -0
  109. package/dist/components/ai-elements/speech-input.js +206 -0
  110. package/dist/components/ai-elements/stack-trace.d.ts +42 -0
  111. package/dist/components/ai-elements/stack-trace.js +377 -0
  112. package/dist/components/ai-elements/suggestion.d.ts +14 -0
  113. package/dist/components/ai-elements/suggestion.js +41 -0
  114. package/dist/components/ai-elements/task.d.ts +18 -0
  115. package/dist/components/ai-elements/task.js +60 -0
  116. package/dist/components/ai-elements/terminal.d.ts +31 -0
  117. package/dist/components/ai-elements/terminal.js +203 -0
  118. package/dist/components/ai-elements/test-results.d.ts +61 -0
  119. package/dist/components/ai-elements/test-results.js +349 -0
  120. package/dist/components/ai-elements/tool.d.ts +35 -0
  121. package/dist/components/ai-elements/tool.js +2 -0
  122. package/dist/components/ai-elements/toolbar.d.ts +8 -0
  123. package/dist/components/ai-elements/toolbar.js +18 -0
  124. package/dist/components/ai-elements/transcription.d.ts +19 -0
  125. package/dist/components/ai-elements/transcription.js +90 -0
  126. package/dist/components/ai-elements/voice-selector.d.ts +66 -0
  127. package/dist/components/ai-elements/voice-selector.js +332 -0
  128. package/dist/components/ai-elements/web-preview.d.ts +38 -0
  129. package/dist/components/ai-elements/web-preview.js +214 -0
  130. package/dist/components/info-card.d.ts +14 -0
  131. package/dist/components/info-card.js +1 -0
  132. package/dist/components/responsive-alert-dialog.d.ts +19 -0
  133. package/dist/components/responsive-alert-dialog.js +1 -0
  134. package/dist/components/responsive-dialog.d.ts +14 -0
  135. package/dist/components/responsive-dialog.js +1 -0
  136. package/dist/config-IcWUmjwj.d.ts +239 -0
  137. package/dist/features/chat/chat-card.d.ts +5 -0
  138. package/dist/features/chat/chat-card.js +14 -0
  139. package/dist/features/chat/chat-element/chat-element.d.ts +8 -0
  140. package/dist/features/chat/chat-element/chat-element.js +14 -0
  141. package/dist/features/chat/chat-element/use-chat.d.ts +21 -0
  142. package/dist/features/chat/chat-element/use-chat.js +14 -0
  143. package/dist/features/chat/chat-element/use-initial-messages.d.ts +20 -0
  144. package/dist/features/chat/chat-element/use-initial-messages.js +14 -0
  145. package/dist/features/chat/chat-header/chat-header.d.ts +8 -0
  146. package/dist/features/chat/chat-header/chat-header.js +14 -0
  147. package/dist/features/chat/chat-header/chat-menu.d.ts +5 -0
  148. package/dist/features/chat/chat-header/chat-menu.js +2 -0
  149. package/dist/features/chat/chat-history/chat-history-empty.d.ts +5 -0
  150. package/dist/features/chat/chat-history/chat-history-empty.js +1 -0
  151. package/dist/features/chat/chat-history/chat-history.d.ts +5 -0
  152. package/dist/features/chat/chat-history/chat-history.js +14 -0
  153. package/dist/features/chat/chat-message.d.ts +10 -0
  154. package/dist/features/chat/chat-message.js +1 -0
  155. package/dist/features/chat/chat-molecule.d.ts +35 -0
  156. package/dist/features/chat/chat-molecule.js +14 -0
  157. package/dist/features/chat/chat-prompt-input.d.ts +16 -0
  158. package/dist/features/chat/chat-prompt-input.js +14 -0
  159. package/dist/features/chat/chat.context.d.ts +26 -0
  160. package/dist/features/chat/chat.context.js +13 -0
  161. package/dist/features/chat/index.d.ts +14 -0
  162. package/dist/features/chat/index.js +14 -0
  163. package/dist/features/chat/queries/query-keys.d.ts +8 -0
  164. package/dist/features/chat/queries/query-keys.js +1 -0
  165. package/dist/features/chat/queries/use-create-conversation-mutation.d.ts +29 -0
  166. package/dist/features/chat/queries/use-create-conversation-mutation.js +38 -0
  167. package/dist/features/chat/queries/use-get-chat-query.d.ts +9 -0
  168. package/dist/features/chat/queries/use-get-chat-query.js +14 -0
  169. package/dist/features/chat/queries/use-get-conversation-query.d.ts +62 -0
  170. package/dist/features/chat/queries/use-get-conversation-query.js +14 -0
  171. package/dist/features/chat/queries/use-list-conversations-query.d.ts +29 -0
  172. package/dist/features/chat/queries/use-list-conversations-query.js +14 -0
  173. package/dist/features/chat/store.d.ts +13 -0
  174. package/dist/features/chat/store.js +1 -0
  175. package/dist/features/chat/utils.d.ts +5 -0
  176. package/dist/features/chat/utils.js +1 -0
  177. package/dist/features/data-fetching/use-api-client.d.ts +5 -0
  178. package/dist/features/data-fetching/use-api-client.js +14 -0
  179. package/dist/features/logger/logger.d.ts +9 -0
  180. package/dist/features/logger/logger.js +1 -0
  181. package/dist/features/molecule/chatsdk-provider.d.ts +19 -0
  182. package/dist/features/molecule/chatsdk-provider.js +26 -0
  183. package/dist/features/molecule/constants.d.ts +3 -0
  184. package/dist/features/molecule/constants.js +1 -0
  185. package/dist/features/molecule/molecule-provider.d.ts +39 -0
  186. package/dist/features/molecule/molecule-provider.js +1 -0
  187. package/dist/features/molecule/store.d.ts +53 -0
  188. package/dist/features/molecule/store.js +3 -0
  189. package/dist/features/molecule/types/api.d.ts +8 -0
  190. package/dist/features/molecule/types/api.js +1 -0
  191. package/dist/features/molecule/types/callbacks.d.ts +22 -0
  192. package/dist/features/molecule/types/callbacks.js +1 -0
  193. package/dist/features/molecule/types/config.d.ts +10 -0
  194. package/dist/features/molecule/types/config.js +1 -0
  195. package/dist/features/molecule/types/context.d.ts +11 -0
  196. package/dist/features/molecule/types/context.js +1 -0
  197. package/dist/features/molecule/types/locale.d.ts +9 -0
  198. package/dist/features/molecule/types/locale.js +1 -0
  199. package/dist/features/molecule/types/theme.d.ts +38 -0
  200. package/dist/features/molecule/types/theme.js +1 -0
  201. package/dist/features/molecule/types/translations.d.ts +10 -0
  202. package/dist/features/molecule/types/translations.js +1 -0
  203. package/dist/features/molecule/use-merge-global-config.d.ts +22 -0
  204. package/dist/features/molecule/use-merge-global-config.js +5 -0
  205. package/dist/features/molecule/use-molecule-config.d.ts +41 -0
  206. package/dist/features/molecule/use-molecule-config.js +6 -0
  207. package/dist/features/molecule/utils.d.ts +10 -0
  208. package/dist/features/molecule/utils.js +1 -0
  209. package/dist/i18n/config.d.ts +61 -0
  210. package/dist/i18n/config.js +1 -0
  211. package/dist/i18n/i18next.d.ts +11 -0
  212. package/dist/i18n/i18next.js +2 -0
  213. package/dist/i18n/utils.d.ts +11 -0
  214. package/dist/i18n/utils.js +6 -0
  215. package/dist/index.d.ts +20 -0
  216. package/dist/index.js +20 -0
  217. package/dist/styles.css +6811 -0
  218. package/package.json +123 -0
@@ -0,0 +1,38 @@
1
+ import { useApiClient, useMoleculeConfig } from '../../../chunk-TDP6D7U7.js';
2
+ import '../../../chunk-AP4MG32M.js';
3
+ import '../../../chunk-YXAMLTTT.js';
4
+ import '../../../chunk-TDEFIW2L.js';
5
+ import '../../../chunk-M5OONVIO.js';
6
+ import '../../../chunk-VYDYCGJL.js';
7
+ import '../../../chunk-MXTBCHYC.js';
8
+ import '../../../chunk-2LHKM7RD.js';
9
+ import '../../../chunk-5UMYP6MD.js';
10
+ import '../../../chunk-VS55HRUS.js';
11
+ import '../../../chunk-YX46JVQN.js';
12
+ import '../../../chunk-RJG5D2TM.js';
13
+ import '../../../chunk-ZCSZX3OI.js';
14
+ import '../../../chunk-SLJNKQ2G.js';
15
+ import { useMutation } from '@tanstack/react-query';
16
+
17
+ function useCreateConversationMutation({
18
+ chatId
19
+ }) {
20
+ const client = useApiClient();
21
+ const { context } = useMoleculeConfig();
22
+ return useMutation({
23
+ mutationFn: async () => {
24
+ const { data, error } = await client.chats.conversations.create({
25
+ path: { chatId },
26
+ body: { actorId: context?.actor?.id ?? "" }
27
+ });
28
+ if (error) {
29
+ throw new Error(
30
+ "error" in error ? error.error : "Failed to create conversation"
31
+ );
32
+ }
33
+ return data;
34
+ }
35
+ });
36
+ }
37
+
38
+ export { useCreateConversationMutation };
@@ -0,0 +1,9 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import * as _chatsdk_dev_api_client from '@chatsdk-dev/api-client';
3
+
4
+ interface UseGetChatQueryProps {
5
+ chatId?: string;
6
+ }
7
+ declare function useGetChatQuery({ chatId }: UseGetChatQueryProps): _tanstack_react_query.UseQueryResult<_chatsdk_dev_api_client.Chat, Error>;
8
+
9
+ export { useGetChatQuery };
@@ -0,0 +1,14 @@
1
+ export { useGetChatQuery } from '../../../chunk-TDP6D7U7.js';
2
+ import '../../../chunk-AP4MG32M.js';
3
+ import '../../../chunk-YXAMLTTT.js';
4
+ import '../../../chunk-TDEFIW2L.js';
5
+ import '../../../chunk-M5OONVIO.js';
6
+ import '../../../chunk-VYDYCGJL.js';
7
+ import '../../../chunk-MXTBCHYC.js';
8
+ import '../../../chunk-2LHKM7RD.js';
9
+ import '../../../chunk-5UMYP6MD.js';
10
+ import '../../../chunk-VS55HRUS.js';
11
+ import '../../../chunk-YX46JVQN.js';
12
+ import '../../../chunk-RJG5D2TM.js';
13
+ import '../../../chunk-ZCSZX3OI.js';
14
+ import '../../../chunk-SLJNKQ2G.js';
@@ -0,0 +1,62 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { ChatSDK } from '@chatsdk-dev/api-client';
3
+
4
+ interface GetConversationQueryConfigParams {
5
+ chatId: string;
6
+ conversationId?: string;
7
+ actorId: string;
8
+ client: ChatSDK;
9
+ }
10
+ declare function getConversationQueryConfig({ chatId, conversationId, client, actorId, }: GetConversationQueryConfigParams): {
11
+ queryKey: readonly ["chat", "get", string | undefined, "conversation", string | null | undefined];
12
+ queryFn: () => Promise<{
13
+ actor: {
14
+ id: string;
15
+ type: "default" | "tenant";
16
+ };
17
+ usage: {
18
+ messageCredits: number;
19
+ };
20
+ status: "active" | "archived";
21
+ summary?: string;
22
+ title?: string;
23
+ messages: Array<{
24
+ id: string;
25
+ role: "user" | "assistant" | "system";
26
+ parts: Array<{
27
+ type: "text";
28
+ text: string;
29
+ }>;
30
+ }>;
31
+ _id: string;
32
+ _creationTime: number;
33
+ }>;
34
+ };
35
+ interface UseGetConversationQueryProps {
36
+ chatId?: string;
37
+ conversationId?: string | null;
38
+ }
39
+ declare function useGetConversationQuery({ chatId, conversationId, }: UseGetConversationQueryProps): _tanstack_react_query.UseQueryResult<{
40
+ actor: {
41
+ id: string;
42
+ type: "default" | "tenant";
43
+ };
44
+ usage: {
45
+ messageCredits: number;
46
+ };
47
+ status: "active" | "archived";
48
+ summary?: string;
49
+ title?: string;
50
+ messages: Array<{
51
+ id: string;
52
+ role: "user" | "assistant" | "system";
53
+ parts: Array<{
54
+ type: "text";
55
+ text: string;
56
+ }>;
57
+ }>;
58
+ _id: string;
59
+ _creationTime: number;
60
+ }, Error>;
61
+
62
+ export { getConversationQueryConfig, useGetConversationQuery };
@@ -0,0 +1,14 @@
1
+ export { getConversationQueryConfig, useGetConversationQuery } from '../../../chunk-TDP6D7U7.js';
2
+ import '../../../chunk-AP4MG32M.js';
3
+ import '../../../chunk-YXAMLTTT.js';
4
+ import '../../../chunk-TDEFIW2L.js';
5
+ import '../../../chunk-M5OONVIO.js';
6
+ import '../../../chunk-VYDYCGJL.js';
7
+ import '../../../chunk-MXTBCHYC.js';
8
+ import '../../../chunk-2LHKM7RD.js';
9
+ import '../../../chunk-5UMYP6MD.js';
10
+ import '../../../chunk-VS55HRUS.js';
11
+ import '../../../chunk-YX46JVQN.js';
12
+ import '../../../chunk-RJG5D2TM.js';
13
+ import '../../../chunk-ZCSZX3OI.js';
14
+ import '../../../chunk-SLJNKQ2G.js';
@@ -0,0 +1,29 @@
1
+ import * as _tanstack_react_query from '@tanstack/react-query';
2
+
3
+ interface UseListConversationsQueryProps {
4
+ chatId: string;
5
+ }
6
+ declare function useListConversationsQuery({ chatId, }: UseListConversationsQueryProps): _tanstack_react_query.UseQueryResult<{
7
+ actor: {
8
+ id: string;
9
+ type: "default" | "tenant";
10
+ };
11
+ usage: {
12
+ messageCredits: number;
13
+ };
14
+ status: "active" | "archived";
15
+ summary?: string;
16
+ title?: string;
17
+ messages: Array<{
18
+ id: string;
19
+ role: "user" | "assistant" | "system";
20
+ parts: Array<{
21
+ type: "text";
22
+ text: string;
23
+ }>;
24
+ }>;
25
+ _id: string;
26
+ _creationTime: number;
27
+ }[], Error>;
28
+
29
+ export { useListConversationsQuery };
@@ -0,0 +1,14 @@
1
+ export { useListConversationsQuery } from '../../../chunk-TDP6D7U7.js';
2
+ import '../../../chunk-AP4MG32M.js';
3
+ import '../../../chunk-YXAMLTTT.js';
4
+ import '../../../chunk-TDEFIW2L.js';
5
+ import '../../../chunk-M5OONVIO.js';
6
+ import '../../../chunk-VYDYCGJL.js';
7
+ import '../../../chunk-MXTBCHYC.js';
8
+ import '../../../chunk-2LHKM7RD.js';
9
+ import '../../../chunk-5UMYP6MD.js';
10
+ import '../../../chunk-VS55HRUS.js';
11
+ import '../../../chunk-YX46JVQN.js';
12
+ import '../../../chunk-RJG5D2TM.js';
13
+ import '../../../chunk-ZCSZX3OI.js';
14
+ import '../../../chunk-SLJNKQ2G.js';
@@ -0,0 +1,13 @@
1
+ import * as zustand from 'zustand';
2
+
3
+ interface ChatStore {
4
+ tab: "chat" | "history";
5
+ selectedConversationId?: string;
6
+ conversationType: "new" | "history";
7
+ setTab: (tab: "chat" | "history") => void;
8
+ setSelectedConversationId: (id?: string) => void;
9
+ setConversationType: (type: "new" | "history") => void;
10
+ }
11
+ declare const useChatStore: zustand.UseBoundStore<zustand.StoreApi<ChatStore>>;
12
+
13
+ export { useChatStore };
@@ -0,0 +1 @@
1
+ export { useChatStore } from '../../chunk-2LHKM7RD.js';
@@ -0,0 +1,5 @@
1
+ import { UIMessage } from 'ai';
2
+
3
+ declare function getInitialMessagesFromStrings(messages: string[]): UIMessage[];
4
+
5
+ export { getInitialMessagesFromStrings };
@@ -0,0 +1 @@
1
+ export { getInitialMessagesFromStrings } from '../../chunk-5UMYP6MD.js';
@@ -0,0 +1,5 @@
1
+ import * as _chatsdk_dev_api_client from '@chatsdk-dev/api-client';
2
+
3
+ declare function useApiClient(): _chatsdk_dev_api_client.ChatSDK;
4
+
5
+ export { useApiClient };
@@ -0,0 +1,14 @@
1
+ export { useApiClient } from '../../chunk-TDP6D7U7.js';
2
+ import '../../chunk-AP4MG32M.js';
3
+ import '../../chunk-YXAMLTTT.js';
4
+ import '../../chunk-TDEFIW2L.js';
5
+ import '../../chunk-M5OONVIO.js';
6
+ import '../../chunk-VYDYCGJL.js';
7
+ import '../../chunk-MXTBCHYC.js';
8
+ import '../../chunk-2LHKM7RD.js';
9
+ import '../../chunk-5UMYP6MD.js';
10
+ import '../../chunk-VS55HRUS.js';
11
+ import '../../chunk-YX46JVQN.js';
12
+ import '../../chunk-RJG5D2TM.js';
13
+ import '../../chunk-ZCSZX3OI.js';
14
+ import '../../chunk-SLJNKQ2G.js';
@@ -0,0 +1,9 @@
1
+ interface LoggerInput {
2
+ info?: (message: string) => void;
3
+ warn?: (message: string) => void;
4
+ error?: (message: string) => void;
5
+ }
6
+ type Logger = Required<LoggerInput>;
7
+ declare function getLogger(loggers?: LoggerInput | LoggerInput["info"]): Logger;
8
+
9
+ export { type Logger, type LoggerInput, getLogger };
@@ -0,0 +1 @@
1
+ export { getLogger } from '../../chunk-VS55HRUS.js';
@@ -0,0 +1,19 @@
1
+ import react__default from 'react';
2
+ import { R as RootConfig } from '../../config-IcWUmjwj.js';
3
+ import '../logger/logger.js';
4
+ import './types/api.js';
5
+ import '@chatsdk-dev/api-client';
6
+ import './types/callbacks.js';
7
+ import './types/context.js';
8
+ import './types/locale.js';
9
+ import '@chatsdk-dev/elements/i18n/config';
10
+ import './types/theme.js';
11
+ import '@chatsdk-dev/ui/components/typography/text';
12
+
13
+ interface ChatSDKProviderProps {
14
+ config?: RootConfig;
15
+ children: react__default.ReactNode;
16
+ }
17
+ declare function ChatSDKProvider({ config, children, }: ChatSDKProviderProps): react__default.ReactNode;
18
+
19
+ export { ChatSDKProvider };
@@ -0,0 +1,26 @@
1
+ import { useChatSDKStore } from '../../chunk-YX46JVQN.js';
2
+ import '../../chunk-RJG5D2TM.js';
3
+ import '../../chunk-ZCSZX3OI.js';
4
+ import { useRef, useLayoutEffect } from 'react';
5
+
6
+ function ChatSDKProvider({
7
+ config = {},
8
+ children
9
+ }) {
10
+ const initialized = useRef(false);
11
+ const isFirstRender = useRef(true);
12
+ if (!initialized.current) {
13
+ useChatSDKStore.getState().setConfig(config);
14
+ initialized.current = true;
15
+ }
16
+ useLayoutEffect(() => {
17
+ if (isFirstRender.current) {
18
+ isFirstRender.current = false;
19
+ return;
20
+ }
21
+ useChatSDKStore.getState().setConfig(config);
22
+ }, [config]);
23
+ return children;
24
+ }
25
+
26
+ export { ChatSDKProvider };
@@ -0,0 +1,3 @@
1
+ declare const LOCAL_STORAGE_PREFIX = "chatsdk-";
2
+
3
+ export { LOCAL_STORAGE_PREFIX };
@@ -0,0 +1 @@
1
+ export { LOCAL_STORAGE_PREFIX } from '../../chunk-ZCSZX3OI.js';
@@ -0,0 +1,39 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import react__default from 'react';
3
+ import { Callbacks } from './types/callbacks.js';
4
+ import { R as RootConfig } from '../../config-IcWUmjwj.js';
5
+ import '../logger/logger.js';
6
+ import './types/api.js';
7
+ import '@chatsdk-dev/api-client';
8
+ import './types/context.js';
9
+ import './types/locale.js';
10
+ import '@chatsdk-dev/elements/i18n/config';
11
+ import './types/theme.js';
12
+ import '@chatsdk-dev/ui/components/typography/text';
13
+
14
+ interface MoleculeContextType<T, W> {
15
+ config: RootConfig;
16
+ component: T;
17
+ callbacks: Callbacks<W>;
18
+ }
19
+ interface MoleculeProviderProps<T, W> {
20
+ config: RootConfig;
21
+ component: T;
22
+ children: react__default.ReactNode;
23
+ callbacks: Callbacks<W>;
24
+ }
25
+ interface CreateMoleculeContextParams {
26
+ name: string;
27
+ }
28
+ declare function createMoleculeContext<T, W>({ name, }: CreateMoleculeContextParams): {
29
+ readonly useMolecule: () => MoleculeContextType<T, W>;
30
+ readonly useMoleculeConfig: () => RootConfig;
31
+ readonly useMoleculeComponent: () => T;
32
+ readonly useMoleculeCallbacks: () => Callbacks<W>;
33
+ readonly MoleculeProvider: {
34
+ ({ config, component, callbacks, children, }: MoleculeProviderProps<T, W>): react_jsx_runtime.JSX.Element;
35
+ displayName: string;
36
+ };
37
+ };
38
+
39
+ export { type MoleculeContextType, type MoleculeProviderProps, createMoleculeContext };
@@ -0,0 +1 @@
1
+ export { createMoleculeContext } from '../../chunk-M5OONVIO.js';
@@ -0,0 +1,53 @@
1
+ import * as zustand_middleware from 'zustand/middleware';
2
+ import * as zustand from 'zustand';
3
+ import { R as RootConfig } from '../../config-IcWUmjwj.js';
4
+ import '../logger/logger.js';
5
+ import './types/api.js';
6
+ import '@chatsdk-dev/api-client';
7
+ import './types/callbacks.js';
8
+ import './types/context.js';
9
+ import './types/locale.js';
10
+ import '@chatsdk-dev/elements/i18n/config';
11
+ import './types/theme.js';
12
+ import '@chatsdk-dev/ui/components/typography/text';
13
+
14
+ interface ChatSDKStore extends RootConfig {
15
+ setContext: (context: RootConfig["context"]) => void;
16
+ setTheme: (theme: RootConfig["theme"]) => void;
17
+ setApi: (api: RootConfig["api"]) => void;
18
+ setLocale: (locale: RootConfig["locale"]) => void;
19
+ setTranslations?: (translations: RootConfig["translations"]) => void;
20
+ setOptions: (options: RootConfig["options"]) => void;
21
+ setLogger: (logger: RootConfig["logger"]) => void;
22
+ setConfig: (config: Partial<RootConfig>, merge?: boolean) => void;
23
+ reset: (config?: Partial<RootConfig>) => void;
24
+ }
25
+ declare const defaultInitialState: Omit<ChatSDKStore, "setContext" | "setTheme" | "setApi" | "setLocale" | "setOptions" | "setLogger" | "setConfig" | "reset">;
26
+ declare const createChatSDKStore: (customInitialState?: Partial<typeof defaultInitialState>) => zustand.UseBoundStore<Omit<zustand.StoreApi<ChatSDKStore>, "setState" | "persist"> & {
27
+ setState(partial: ChatSDKStore | Partial<ChatSDKStore> | ((state: ChatSDKStore) => ChatSDKStore | Partial<ChatSDKStore>), replace?: false | undefined): unknown;
28
+ setState(state: ChatSDKStore | ((state: ChatSDKStore) => ChatSDKStore), replace: true): unknown;
29
+ persist: {
30
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<ChatSDKStore, unknown, unknown>>) => void;
31
+ clearStorage: () => void;
32
+ rehydrate: () => Promise<void> | void;
33
+ hasHydrated: () => boolean;
34
+ onHydrate: (fn: (state: ChatSDKStore) => void) => () => void;
35
+ onFinishHydration: (fn: (state: ChatSDKStore) => void) => () => void;
36
+ getOptions: () => Partial<zustand_middleware.PersistOptions<ChatSDKStore, unknown, unknown>>;
37
+ };
38
+ }>;
39
+ declare const useChatSDKStore: zustand.UseBoundStore<Omit<zustand.StoreApi<ChatSDKStore>, "setState" | "persist"> & {
40
+ setState(partial: ChatSDKStore | Partial<ChatSDKStore> | ((state: ChatSDKStore) => ChatSDKStore | Partial<ChatSDKStore>), replace?: false | undefined): unknown;
41
+ setState(state: ChatSDKStore | ((state: ChatSDKStore) => ChatSDKStore), replace: true): unknown;
42
+ persist: {
43
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<ChatSDKStore, unknown, unknown>>) => void;
44
+ clearStorage: () => void;
45
+ rehydrate: () => Promise<void> | void;
46
+ hasHydrated: () => boolean;
47
+ onHydrate: (fn: (state: ChatSDKStore) => void) => () => void;
48
+ onFinishHydration: (fn: (state: ChatSDKStore) => void) => () => void;
49
+ getOptions: () => Partial<zustand_middleware.PersistOptions<ChatSDKStore, unknown, unknown>>;
50
+ };
51
+ }>;
52
+
53
+ export { type ChatSDKStore, createChatSDKStore, useChatSDKStore };
@@ -0,0 +1,3 @@
1
+ export { createChatSDKStore, useChatSDKStore } from '../../chunk-YX46JVQN.js';
2
+ import '../../chunk-RJG5D2TM.js';
3
+ import '../../chunk-ZCSZX3OI.js';
@@ -0,0 +1,8 @@
1
+ import { Config } from '@chatsdk-dev/api-client';
2
+
3
+ type APIOptions = Omit<Config, "headers"> & {
4
+ version?: "internal" | "v1";
5
+ headers?: Record<string, string>;
6
+ } & Omit<RequestInit, "headers">;
7
+
8
+ export type { APIOptions };
@@ -0,0 +1,22 @@
1
+ interface Callbacks<T> {
2
+ /** Callback function called when the component's query is loading (in flight)
3
+ * @type function
4
+ * @category Callbacks
5
+ * @details () => void
6
+ */
7
+ onloading?: () => void;
8
+ /** Callback function called when the component's query is successful, will receive the data as an argument that is forwarded to the rendering client as an argument
9
+ * @type function
10
+ * @category Callbacks
11
+ * @details (data: T) => void
12
+ */
13
+ onsuccess?: (data: T) => void;
14
+ /** Callback function called when the component's query is unsuccessful, will receive the error as an argument
15
+ * @type function
16
+ * @category Callbacks
17
+ * @details (error: string) => void
18
+ */
19
+ onerror?: (error: string) => void;
20
+ }
21
+
22
+ export type { Callbacks };
@@ -0,0 +1,10 @@
1
+ import '../../logger/logger.js';
2
+ import './api.js';
3
+ import './callbacks.js';
4
+ import './context.js';
5
+ import './locale.js';
6
+ import './theme.js';
7
+ export { M as MoleculeConfig, O as OptionsConfig, R as RootConfig } from '../../../config-IcWUmjwj.js';
8
+ import '@chatsdk-dev/api-client';
9
+ import '@chatsdk-dev/elements/i18n/config';
10
+ import '@chatsdk-dev/ui/components/typography/text';
@@ -0,0 +1,11 @@
1
+ type Context = {
2
+ tenant?: {
3
+ id?: string;
4
+ traits?: Record<string, boolean>;
5
+ };
6
+ actor?: {
7
+ id?: string;
8
+ };
9
+ };
10
+
11
+ export type { Context };
@@ -0,0 +1,9 @@
1
+ import { Locale } from '@chatsdk-dev/elements/i18n/config';
2
+
3
+ type Formality = "formal" | "informal";
4
+ type LocaleConfig = {
5
+ language: Locale;
6
+ formality?: Formality;
7
+ };
8
+
9
+ export type { Formality, LocaleConfig };
@@ -0,0 +1,38 @@
1
+ import { TextVariants } from '@chatsdk-dev/ui/components/typography/text';
2
+
3
+ type ColorScheme = "light" | "dark" | "system";
4
+ type FontConfig = {
5
+ size: string;
6
+ lineHeight?: string;
7
+ letterSpacing?: string;
8
+ weight?: string;
9
+ family?: string;
10
+ style?: string;
11
+ transform?: string;
12
+ color?: string;
13
+ face?: Partial<{
14
+ [key in "400" | "500" | "600" | "700"]: {
15
+ normal?: string;
16
+ italic?: string;
17
+ };
18
+ }>;
19
+ };
20
+ type RawFontProps = {
21
+ fontFamily?: string;
22
+ fontSize: number;
23
+ fontWeight: number;
24
+ lineHeight: number;
25
+ };
26
+ type ThemeConfig = {
27
+ colorScheme: ColorScheme;
28
+ font: {
29
+ body: FontConfig;
30
+ heading: FontConfig;
31
+ variants: Record<NonNullable<TextVariants["variant"]>, RawFontProps>;
32
+ };
33
+ defaultRadius: string;
34
+ defaultShadow: string;
35
+ components?: Record<string, object>;
36
+ };
37
+
38
+ export type { ColorScheme, FontConfig, RawFontProps, ThemeConfig };
@@ -0,0 +1,10 @@
1
+ import '@chatsdk-dev/elements/i18n/config';
2
+ export { T as TranslationsConfig } from '../../../config-IcWUmjwj.js';
3
+ import '../../logger/logger.js';
4
+ import './api.js';
5
+ import '@chatsdk-dev/api-client';
6
+ import './callbacks.js';
7
+ import './context.js';
8
+ import './locale.js';
9
+ import './theme.js';
10
+ import '@chatsdk-dev/ui/components/typography/text';
@@ -0,0 +1,22 @@
1
+ import { R as RootConfig, T as TranslationsConfig, O as OptionsConfig } from '../../config-IcWUmjwj.js';
2
+ import { APIOptions } from './types/api.js';
3
+ import { ThemeConfig } from './types/theme.js';
4
+ import { Context } from './types/context.js';
5
+ import { LocaleConfig } from './types/locale.js';
6
+ import { LoggerInput } from '../logger/logger.js';
7
+ import './types/callbacks.js';
8
+ import '@chatsdk-dev/elements/i18n/config';
9
+ import '@chatsdk-dev/api-client';
10
+ import '@chatsdk-dev/ui/components/typography/text';
11
+
12
+ declare function useMergeGlobalConfig(config?: RootConfig): {
13
+ logger: Required<LoggerInput>;
14
+ locale: LocaleConfig | undefined;
15
+ context?: Context | undefined;
16
+ theme?: Partial<ThemeConfig> | undefined;
17
+ api?: APIOptions | undefined;
18
+ translations?: TranslationsConfig | undefined;
19
+ options?: OptionsConfig | undefined;
20
+ };
21
+
22
+ export { useMergeGlobalConfig };
@@ -0,0 +1,5 @@
1
+ export { useMergeGlobalConfig } from '../../chunk-MXTBCHYC.js';
2
+ import '../../chunk-VS55HRUS.js';
3
+ import '../../chunk-YX46JVQN.js';
4
+ import '../../chunk-RJG5D2TM.js';
5
+ import '../../chunk-ZCSZX3OI.js';
@@ -0,0 +1,41 @@
1
+ import { R as RootConfig, M as MoleculeConfig, T as TranslationsConfig, O as OptionsConfig } from '../../config-IcWUmjwj.js';
2
+ import { APIOptions } from './types/api.js';
3
+ import { ThemeConfig } from './types/theme.js';
4
+ import { Context } from './types/context.js';
5
+ import { LocaleConfig } from './types/locale.js';
6
+ import { LoggerInput } from '../logger/logger.js';
7
+ import { Callbacks } from './types/callbacks.js';
8
+ import '@chatsdk-dev/elements/i18n/config';
9
+ import '@chatsdk-dev/api-client';
10
+ import '@chatsdk-dev/ui/components/typography/text';
11
+
12
+ type RequiredTAndOptionalU<T extends object, U extends object> = Required<T> & Partial<U>;
13
+ type ComponentProps<T extends object, U extends object> = Omit<RequiredTAndOptionalU<T, U>, keyof RootConfig | keyof Callbacks<unknown> | "component">;
14
+ /**
15
+ *
16
+ * @param config.defaultProps hard coded props (and defaults)
17
+ * @param config.props passed props
18
+ * @param config.name name of the component
19
+ * @returns props with config and callbacks
20
+ */
21
+ declare function useMergeMoleculeConfig<T extends object, U extends MoleculeConfig<T, W>, W = U extends Callbacks<infer CallbackType> ? CallbackType : unknown>(moleculeConfig: {
22
+ props: U;
23
+ name: string;
24
+ }): Omit<Omit<U, "component" | "defaultProps">, "config" | "onloading" | "onsuccess" | "onerror"> & {
25
+ config: {
26
+ logger: Required<LoggerInput>;
27
+ locale: LocaleConfig | undefined;
28
+ context?: Context | undefined;
29
+ theme?: Partial<ThemeConfig> | undefined;
30
+ api?: APIOptions | undefined;
31
+ translations?: TranslationsConfig | undefined;
32
+ options?: OptionsConfig | undefined;
33
+ };
34
+ callbacks: {
35
+ onloading: U["onloading"] | undefined;
36
+ onsuccess: U["onsuccess"] | undefined;
37
+ onerror: U["onerror"] | undefined;
38
+ };
39
+ };
40
+
41
+ export { type ComponentProps, useMergeMoleculeConfig };
@@ -0,0 +1,6 @@
1
+ export { useMergeMoleculeConfig } from '../../chunk-VYDYCGJL.js';
2
+ import '../../chunk-MXTBCHYC.js';
3
+ import '../../chunk-VS55HRUS.js';
4
+ import '../../chunk-YX46JVQN.js';
5
+ import '../../chunk-RJG5D2TM.js';
6
+ import '../../chunk-ZCSZX3OI.js';
@@ -0,0 +1,10 @@
1
+ import '../logger/logger.js';
2
+ export { D as DeepPartial, d as deepMerge, m as mergeApi, a as mergeConfigs, b as mergeContext, c as mergeFont, e as mergeLocale, f as mergeLogger, g as mergeObjectsOneLevel, h as mergeTheme, i as mergeTranslations } from '../../config-IcWUmjwj.js';
3
+ import './types/locale.js';
4
+ import './types/context.js';
5
+ import './types/theme.js';
6
+ import './types/api.js';
7
+ import '@chatsdk-dev/api-client';
8
+ import './types/callbacks.js';
9
+ import '@chatsdk-dev/elements/i18n/config';
10
+ import '@chatsdk-dev/ui/components/typography/text';