@anker-in/campaign-ui 0.3.3 → 0.3.5

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 (224) hide show
  1. package/dist/cjs/components/LiveChatWidget/LiveChatWidget.d.ts +21 -1
  2. package/dist/cjs/components/LiveChatWidget/LiveChatWidget.js +1 -1
  3. package/dist/cjs/components/LiveChatWidget/LiveChatWidget.js.map +3 -3
  4. package/dist/cjs/components/LiveChatWidget/api/chat.d.ts +23 -2
  5. package/dist/cjs/components/LiveChatWidget/api/chat.js +2 -2
  6. package/dist/cjs/components/LiveChatWidget/api/chat.js.map +3 -3
  7. package/dist/cjs/components/LiveChatWidget/components/ChatHeader.js +1 -1
  8. package/dist/cjs/components/LiveChatWidget/components/ChatHeader.js.map +2 -2
  9. package/dist/cjs/components/LiveChatWidget/components/ChatInput.d.ts +5 -0
  10. package/dist/cjs/components/LiveChatWidget/components/ChatInput.js +1 -1
  11. package/dist/cjs/components/LiveChatWidget/components/ChatInput.js.map +3 -3
  12. package/dist/cjs/components/LiveChatWidget/components/ChatMessage.js +2 -2
  13. package/dist/cjs/components/LiveChatWidget/components/ChatMessage.js.map +3 -3
  14. package/dist/cjs/components/LiveChatWidget/components/ChatWindow.d.ts +5 -0
  15. package/dist/cjs/components/LiveChatWidget/components/ChatWindow.js +1 -1
  16. package/dist/cjs/components/LiveChatWidget/components/ChatWindow.js.map +3 -3
  17. package/dist/cjs/components/LiveChatWidget/components/ComplianceDialog.d.ts +51 -0
  18. package/dist/cjs/components/LiveChatWidget/components/ComplianceDialog.js +33 -0
  19. package/dist/cjs/components/LiveChatWidget/components/ComplianceDialog.js.map +7 -0
  20. package/dist/cjs/components/LiveChatWidget/components/MessageContent/CartCard.js +1 -1
  21. package/dist/cjs/components/LiveChatWidget/components/MessageContent/CartCard.js.map +3 -3
  22. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ErrorBlock.js +1 -1
  23. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ErrorBlock.js.map +2 -2
  24. package/dist/cjs/components/LiveChatWidget/components/MessageContent/FAQList.js +1 -1
  25. package/dist/cjs/components/LiveChatWidget/components/MessageContent/FAQList.js.map +3 -3
  26. package/dist/cjs/components/LiveChatWidget/components/MessageContent/PolicyBlock.js +2 -2
  27. package/dist/cjs/components/LiveChatWidget/components/MessageContent/PolicyBlock.js.map +3 -3
  28. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ProductCard.d.ts +17 -24
  29. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ProductCard.js +1 -4
  30. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ProductCard.js.map +3 -3
  31. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ProductComparison.d.ts +7 -1
  32. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ProductComparison.js +1 -1
  33. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ProductComparison.js.map +3 -3
  34. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ProductList.js +1 -1
  35. package/dist/cjs/components/LiveChatWidget/components/MessageContent/ProductList.js.map +3 -3
  36. package/dist/cjs/components/LiveChatWidget/components/MessageContent/PromotionList.d.ts +4 -1
  37. package/dist/cjs/components/LiveChatWidget/components/MessageContent/PromotionList.js +1 -1
  38. package/dist/cjs/components/LiveChatWidget/components/MessageContent/PromotionList.js.map +3 -3
  39. package/dist/cjs/components/LiveChatWidget/components/MessageContent/QuickReplies.js +1 -1
  40. package/dist/cjs/components/LiveChatWidget/components/MessageContent/QuickReplies.js.map +2 -2
  41. package/dist/cjs/components/LiveChatWidget/components/MessageContent/TextBlock.js +1 -1
  42. package/dist/cjs/components/LiveChatWidget/components/MessageContent/TextBlock.js.map +3 -3
  43. package/dist/cjs/components/LiveChatWidget/components/MessageContent.js +1 -1
  44. package/dist/cjs/components/LiveChatWidget/components/MessageContent.js.map +2 -2
  45. package/dist/cjs/components/LiveChatWidget/components/MessageList.js +3 -3
  46. package/dist/cjs/components/LiveChatWidget/components/MessageList.js.map +3 -3
  47. package/dist/cjs/components/LiveChatWidget/constants.d.ts +5 -0
  48. package/dist/cjs/components/LiveChatWidget/constants.js +1 -1
  49. package/dist/cjs/components/LiveChatWidget/constants.js.map +3 -3
  50. package/dist/cjs/components/LiveChatWidget/hooks/useChatAPI.d.ts +9 -0
  51. package/dist/cjs/components/LiveChatWidget/hooks/useChatAPI.js +1 -1
  52. package/dist/cjs/components/LiveChatWidget/hooks/useChatAPI.js.map +3 -3
  53. package/dist/cjs/components/LiveChatWidget/hooks/useChatState.d.ts +36 -2
  54. package/dist/cjs/components/LiveChatWidget/hooks/useChatState.js +1 -1
  55. package/dist/cjs/components/LiveChatWidget/hooks/useChatState.js.map +3 -3
  56. package/dist/cjs/components/LiveChatWidget/index.d.ts +1 -1
  57. package/dist/cjs/components/LiveChatWidget/index.js +1 -1
  58. package/dist/cjs/components/LiveChatWidget/index.js.map +2 -2
  59. package/dist/cjs/components/LiveChatWidget/types.d.ts +213 -3
  60. package/dist/cjs/components/LiveChatWidget/types.js +1 -1
  61. package/dist/cjs/components/LiveChatWidget/types.js.map +1 -1
  62. package/dist/cjs/components/LiveChatWidget/utils/fetcher.d.ts +42 -0
  63. package/dist/cjs/components/LiveChatWidget/utils/fetcher.js +2 -0
  64. package/dist/cjs/components/LiveChatWidget/utils/fetcher.js.map +7 -0
  65. package/dist/cjs/components/chat/markdown.js +1 -1
  66. package/dist/cjs/components/chat/markdown.js.map +2 -2
  67. package/dist/cjs/components/index.d.ts +2 -0
  68. package/dist/cjs/components/index.js +1 -1
  69. package/dist/cjs/components/index.js.map +3 -3
  70. package/dist/cjs/stories/LiveChatWidget.stories.d.ts +1 -79
  71. package/dist/cjs/stories/LiveChatWidget.stories.js +3 -49
  72. package/dist/cjs/stories/LiveChatWidget.stories.js.map +3 -3
  73. package/dist/esm/components/LiveChatWidget/LiveChatWidget.d.ts +21 -1
  74. package/dist/esm/components/LiveChatWidget/LiveChatWidget.js +1 -1
  75. package/dist/esm/components/LiveChatWidget/LiveChatWidget.js.map +3 -3
  76. package/dist/esm/components/LiveChatWidget/api/chat.d.ts +23 -2
  77. package/dist/esm/components/LiveChatWidget/api/chat.js +2 -2
  78. package/dist/esm/components/LiveChatWidget/api/chat.js.map +3 -3
  79. package/dist/esm/components/LiveChatWidget/components/ChatHeader.js +1 -1
  80. package/dist/esm/components/LiveChatWidget/components/ChatHeader.js.map +2 -2
  81. package/dist/esm/components/LiveChatWidget/components/ChatInput.d.ts +5 -0
  82. package/dist/esm/components/LiveChatWidget/components/ChatInput.js +1 -1
  83. package/dist/esm/components/LiveChatWidget/components/ChatInput.js.map +3 -3
  84. package/dist/esm/components/LiveChatWidget/components/ChatMessage.js +2 -2
  85. package/dist/esm/components/LiveChatWidget/components/ChatMessage.js.map +3 -3
  86. package/dist/esm/components/LiveChatWidget/components/ChatWindow.d.ts +5 -0
  87. package/dist/esm/components/LiveChatWidget/components/ChatWindow.js +1 -1
  88. package/dist/esm/components/LiveChatWidget/components/ChatWindow.js.map +3 -3
  89. package/dist/esm/components/LiveChatWidget/components/ComplianceDialog.d.ts +51 -0
  90. package/dist/esm/components/LiveChatWidget/components/ComplianceDialog.js +33 -0
  91. package/dist/esm/components/LiveChatWidget/components/ComplianceDialog.js.map +7 -0
  92. package/dist/esm/components/LiveChatWidget/components/MessageContent/CartCard.js +1 -1
  93. package/dist/esm/components/LiveChatWidget/components/MessageContent/CartCard.js.map +3 -3
  94. package/dist/esm/components/LiveChatWidget/components/MessageContent/ErrorBlock.js +1 -1
  95. package/dist/esm/components/LiveChatWidget/components/MessageContent/ErrorBlock.js.map +2 -2
  96. package/dist/esm/components/LiveChatWidget/components/MessageContent/FAQList.js +1 -1
  97. package/dist/esm/components/LiveChatWidget/components/MessageContent/FAQList.js.map +3 -3
  98. package/dist/esm/components/LiveChatWidget/components/MessageContent/PolicyBlock.js +2 -2
  99. package/dist/esm/components/LiveChatWidget/components/MessageContent/PolicyBlock.js.map +3 -3
  100. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductCard.d.ts +17 -24
  101. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductCard.js +1 -4
  102. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductCard.js.map +3 -3
  103. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductComparison.d.ts +7 -1
  104. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductComparison.js +1 -1
  105. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductComparison.js.map +3 -3
  106. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductList.js +1 -1
  107. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductList.js.map +3 -3
  108. package/dist/esm/components/LiveChatWidget/components/MessageContent/PromotionList.d.ts +4 -1
  109. package/dist/esm/components/LiveChatWidget/components/MessageContent/PromotionList.js +1 -1
  110. package/dist/esm/components/LiveChatWidget/components/MessageContent/PromotionList.js.map +3 -3
  111. package/dist/esm/components/LiveChatWidget/components/MessageContent/QuickReplies.js +1 -1
  112. package/dist/esm/components/LiveChatWidget/components/MessageContent/QuickReplies.js.map +2 -2
  113. package/dist/esm/components/LiveChatWidget/components/MessageContent/TextBlock.js +1 -1
  114. package/dist/esm/components/LiveChatWidget/components/MessageContent/TextBlock.js.map +3 -3
  115. package/dist/esm/components/LiveChatWidget/components/MessageContent.js +1 -1
  116. package/dist/esm/components/LiveChatWidget/components/MessageContent.js.map +2 -2
  117. package/dist/esm/components/LiveChatWidget/components/MessageList.js +3 -3
  118. package/dist/esm/components/LiveChatWidget/components/MessageList.js.map +3 -3
  119. package/dist/esm/components/LiveChatWidget/constants.d.ts +5 -0
  120. package/dist/esm/components/LiveChatWidget/constants.js +1 -1
  121. package/dist/esm/components/LiveChatWidget/constants.js.map +3 -3
  122. package/dist/esm/components/LiveChatWidget/hooks/useChatAPI.d.ts +9 -0
  123. package/dist/esm/components/LiveChatWidget/hooks/useChatAPI.js +1 -1
  124. package/dist/esm/components/LiveChatWidget/hooks/useChatAPI.js.map +3 -3
  125. package/dist/esm/components/LiveChatWidget/hooks/useChatState.d.ts +36 -2
  126. package/dist/esm/components/LiveChatWidget/hooks/useChatState.js +1 -1
  127. package/dist/esm/components/LiveChatWidget/hooks/useChatState.js.map +3 -3
  128. package/dist/esm/components/LiveChatWidget/index.d.ts +1 -1
  129. package/dist/esm/components/LiveChatWidget/index.js +1 -1
  130. package/dist/esm/components/LiveChatWidget/index.js.map +2 -2
  131. package/dist/esm/components/LiveChatWidget/types.d.ts +213 -3
  132. package/dist/esm/components/LiveChatWidget/utils/fetcher.d.ts +42 -0
  133. package/dist/esm/components/LiveChatWidget/utils/fetcher.js +2 -0
  134. package/dist/esm/components/LiveChatWidget/utils/fetcher.js.map +7 -0
  135. package/dist/esm/components/chat/markdown.js +1 -1
  136. package/dist/esm/components/chat/markdown.js.map +2 -2
  137. package/dist/esm/components/index.d.ts +2 -0
  138. package/dist/esm/components/index.js +1 -1
  139. package/dist/esm/components/index.js.map +3 -3
  140. package/dist/esm/stories/LiveChatWidget.stories.d.ts +1 -79
  141. package/dist/esm/stories/LiveChatWidget.stories.js +3 -49
  142. package/dist/esm/stories/LiveChatWidget.stories.js.map +3 -3
  143. package/dist/index.d.mts +1305 -0
  144. package/dist/index.d.ts +1305 -0
  145. package/dist/index.js +26656 -0
  146. package/dist/index.js.map +1 -0
  147. package/dist/index.mjs +26641 -0
  148. package/dist/index.mjs.map +1 -0
  149. package/package.json +8 -1
  150. package/src/components/LiveChatWidget/LiveChatWidget.tsx +907 -0
  151. package/src/components/LiveChatWidget/api/chat.ts +175 -0
  152. package/src/components/LiveChatWidget/components/ChatBubble.tsx +152 -0
  153. package/src/components/LiveChatWidget/components/ChatHeader.tsx +150 -0
  154. package/src/components/LiveChatWidget/components/ChatInput.tsx +253 -0
  155. package/src/components/LiveChatWidget/components/ChatMessage.tsx +190 -0
  156. package/src/components/LiveChatWidget/components/ChatWindow.tsx +363 -0
  157. package/src/components/LiveChatWidget/components/ComplianceDialog.tsx +216 -0
  158. package/src/components/LiveChatWidget/components/MessageContent/CartCard.tsx +202 -0
  159. package/src/components/LiveChatWidget/components/MessageContent/ErrorBlock.tsx +75 -0
  160. package/src/components/LiveChatWidget/components/MessageContent/FAQList.tsx +128 -0
  161. package/src/components/LiveChatWidget/components/MessageContent/PolicyBlock.tsx +152 -0
  162. package/src/components/LiveChatWidget/components/MessageContent/ProductCard.tsx +227 -0
  163. package/src/components/LiveChatWidget/components/MessageContent/ProductComparison.tsx +377 -0
  164. package/src/components/LiveChatWidget/components/MessageContent/ProductList.tsx +293 -0
  165. package/src/components/LiveChatWidget/components/MessageContent/PromotionList.tsx +170 -0
  166. package/src/components/LiveChatWidget/components/MessageContent/QuickReplies.tsx +91 -0
  167. package/src/components/LiveChatWidget/components/MessageContent/TextBlock.tsx +110 -0
  168. package/src/components/LiveChatWidget/components/MessageContent/ThinkingBlock.tsx +53 -0
  169. package/src/components/LiveChatWidget/components/MessageContent/index.ts +16 -0
  170. package/src/components/LiveChatWidget/components/MessageContent.tsx +113 -0
  171. package/src/components/LiveChatWidget/components/MessageList.tsx +256 -0
  172. package/src/components/LiveChatWidget/components/ScrollAnchor.tsx +75 -0
  173. package/src/components/LiveChatWidget/constants.ts +36 -0
  174. package/src/components/LiveChatWidget/hooks/useChatAPI.ts +146 -0
  175. package/src/components/LiveChatWidget/hooks/useChatState.ts +1091 -0
  176. package/src/components/LiveChatWidget/hooks/useSession.ts +123 -0
  177. package/src/components/LiveChatWidget/index.tsx +63 -0
  178. package/src/components/LiveChatWidget/types.ts +1012 -0
  179. package/src/components/LiveChatWidget/utils/cartTransformers.ts +72 -0
  180. package/src/components/LiveChatWidget/utils/fetcher.ts +131 -0
  181. package/src/components/LiveChatWidget/utils/messageRenderers.ts +120 -0
  182. package/src/components/LiveChatWidget/utils/productTransformers.ts +149 -0
  183. package/src/components/LiveChatWidget/utils/userId.ts +140 -0
  184. package/src/components/LiveChatWidget/utils/validation.ts +99 -0
  185. package/src/components/chat/markdown.tsx +1 -1
  186. package/src/components/index.ts +23 -0
  187. package/src/stories/LiveChatWidget.stories.tsx +317 -0
  188. package/src/styles/livechat.css +346 -0
  189. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.d.ts +0 -7
  190. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +0 -2
  191. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +0 -7
  192. package/dist/cjs/components/credits/context/utils/atobID.d.ts +0 -1
  193. package/dist/cjs/components/credits/context/utils/atobID.js +0 -2
  194. package/dist/cjs/components/credits/context/utils/atobID.js.map +0 -7
  195. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.d.ts +0 -5
  196. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js +0 -2
  197. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js.map +0 -7
  198. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +0 -8
  199. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +0 -2
  200. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +0 -7
  201. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +0 -9
  202. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +0 -2
  203. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +0 -7
  204. package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +0 -6
  205. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +0 -2
  206. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +0 -7
  207. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +0 -7
  208. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +0 -2
  209. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +0 -7
  210. package/dist/esm/components/credits/context/utils/atobID.d.ts +0 -1
  211. package/dist/esm/components/credits/context/utils/atobID.js +0 -2
  212. package/dist/esm/components/credits/context/utils/atobID.js.map +0 -7
  213. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.d.ts +0 -5
  214. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js +0 -2
  215. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js.map +0 -7
  216. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +0 -8
  217. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +0 -2
  218. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +0 -7
  219. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +0 -9
  220. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +0 -2
  221. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +0 -7
  222. package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +0 -6
  223. package/dist/esm/components/credits/context/utils/variantGetCoupon.js +0 -2
  224. package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +0 -7
@@ -0,0 +1,1305 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React$1 from 'react';
3
+ import React__default, { PropsWithChildren, Dispatch, SetStateAction } from 'react';
4
+ export { useCopilotAction, useCopilotChat, useCopilotReadable } from '@copilotkit/react-core';
5
+ export { ActionExecutionMessage, Role, TextMessage } from '@copilotkit/runtime-client-gql';
6
+ import * as swr_dist_mutation from 'swr/dist/mutation';
7
+ import { HeadlessConfig } from '@anker-in/lib';
8
+
9
+ interface ChatProps {
10
+ title: string;
11
+ runtimeUrl: string;
12
+ shopifyDomain: string;
13
+ /** GA 的 client id
14
+ */
15
+ userId: string;
16
+ /** 是否登陆用户 0 or 1
17
+ */
18
+ account?: string;
19
+ /** 用户浏览器语言
20
+ */
21
+ locale?: string;
22
+ /** 开场白
23
+ */
24
+ prologue?: string;
25
+ /** ?a=1&b=2
26
+ */
27
+ query?: string;
28
+ /** 'follow' or 'unfollow' | true or false
29
+ * follow: ResponseButton 会跟随在 messages 的后边
30
+ * unfollow: ResponseButton 在聊天框底部
31
+ */
32
+ showResponseButton?: string | boolean;
33
+ /** messages 的回调事件
34
+ * 每次生成/接受新的messages,会将 整个 messages list 传递给外部
35
+ */
36
+ messagesCallback?: (_messages: any) => void;
37
+ /** 通用 action 的触发事件
38
+ */
39
+ commonRender?: string | ((_props: any) => React__default.ReactElement);
40
+ /** shulex的 action 的触发事件
41
+ */
42
+ shulexRender?: string | ((_props: any) => React__default.ReactElement);
43
+ /** 通用 积分 换 Coupon 的触发事件
44
+ */
45
+ pointsExchangeCouponRender?: string | ((_props: any) => React__default.ReactElement);
46
+ /** 跳转 checkout action 卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
47
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
48
+ */
49
+ gotocheckoutRender?: string | ((_props: any) => React__default.ReactElement);
50
+ /** 打开购物车 action 卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
51
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
52
+ */
53
+ gotocartRender?: string | ((_props: any) => React__default.ReactElement);
54
+ /** 打开购物车 action 的触发事件
55
+ */
56
+ addtocartHandler?: (_args: any) => Promise<any>;
57
+ /** 加购卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
58
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
59
+ */
60
+ addtocartRender?: string | ((_props: any) => React__default.ReactElement);
61
+ /** 订阅卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
62
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
63
+ */
64
+ signupRender?: string | ((_props: any) => React__default.ReactElement);
65
+ /** 产品卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
66
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
67
+ */
68
+ productRender?: string | ((_props: any) => React__default.ReactElement);
69
+ /** CopilotPopup 自定义参数,参考:https://docs.copilotkit.ai/reference/components/CopilotPopup */
70
+ popup?: any;
71
+ /** 文案,{"productRenderTipMessage": "","popupTip": "Hi ! Welcome to soundcore Innovations live chat!", "popupTipTimeout": [3000, 6000]} */
72
+ lang?: any;
73
+ /** 参考此文档:https://docs.copilotkit.ai/concepts/customize-look-and-feel */
74
+ style?: any;
75
+ className?: string;
76
+ }
77
+ declare const Chat: (props: ChatProps) => react_jsx_runtime.JSX.Element;
78
+
79
+ declare enum ConsumeType {
80
+ Coupon = "coupon",
81
+ GiftCard = "giftCard",
82
+ GoGift = "goGift",
83
+ Product = "product",
84
+ ShippingCoupon = "shippingCoupon"
85
+ }
86
+ declare enum DTC_TASK_TYPE {
87
+ FirstPurchase = "firstPurchase",
88
+ UploadReceipt = "uploadReceipt",
89
+ Shopping = "shopping"
90
+ }
91
+
92
+ interface BaseResponse {
93
+ brand: string;
94
+ }
95
+ interface CreditInfoResponse extends BaseResponse {
96
+ total_credit: number;
97
+ available_credit: number;
98
+ pending_credit: number;
99
+ expired_credit: number;
100
+ cancel_credit: number;
101
+ consumed_credit: number;
102
+ }
103
+
104
+ interface MyActivitiesMetafields {
105
+ title: string;
106
+ tips: string;
107
+ allTab: string;
108
+ earnedTab: string;
109
+ deductedTab: string;
110
+ expiredTab: string;
111
+ activationTask: string;
112
+ updateNameTask: string;
113
+ updatePhoneTask: string;
114
+ updateBirthdayTask: string;
115
+ updateAppNameTask: string;
116
+ subscriptionTask: string;
117
+ refundTask: string;
118
+ productUnApprovedTask: string;
119
+ pendingTips?: string;
120
+ pendingTips2?: string;
121
+ firstPurchaseTask: string;
122
+ uploadReceiptTask: string;
123
+ shoppingTask: string;
124
+ emptyListImage: {
125
+ url: string;
126
+ alt?: string;
127
+ };
128
+ emptyListLabel: string;
129
+ }
130
+
131
+ interface MyRewardsMetafields {
132
+ title: string;
133
+ orderNumberLabel: string;
134
+ valueLabel: string;
135
+ receivedLabel: string;
136
+ failedLabel: string;
137
+ approveSuccessLabel: string;
138
+ couponTab: string;
139
+ productTab: string;
140
+ pendingLabel: string;
141
+ unfulfilledLabel: string;
142
+ fulfilledLabel: string;
143
+ confirmedTip: string;
144
+ pendingTip: string;
145
+ processingTip: string;
146
+ ShippedTip: string;
147
+ emptyListLabel: string;
148
+ pointUnit: string;
149
+ code: string;
150
+ copied: string;
151
+ copy: string;
152
+ emptyListImage: {
153
+ url: string;
154
+ alt?: string;
155
+ };
156
+ }
157
+
158
+ type CreditsPageCommon = {
159
+ pointUnit?: string;
160
+ infoIcon?: string;
161
+ ruleLabel?: string;
162
+ soldOut?: string;
163
+ copied?: string;
164
+ off?: string;
165
+ copy?: string;
166
+ giftCardLabel?: string;
167
+ imageMapping?: {
168
+ [key in ConsumeType]: {
169
+ url: string;
170
+ };
171
+ };
172
+ activitiesModal?: MyActivitiesMetafields;
173
+ rewardsModal?: MyRewardsMetafields;
174
+ insufficientCredits?: string;
175
+ validatorInfo?: {
176
+ addressInfo: {
177
+ name: string;
178
+ country: string;
179
+ province: string;
180
+ city: string;
181
+ address: string;
182
+ };
183
+ };
184
+ };
185
+
186
+ declare enum FunctionDiscountType {
187
+ Percentage = 1,
188
+ FixedAmount = 2,
189
+ FixedPrice = 3
190
+ }
191
+
192
+ type DiscountConfig = {
193
+ discount_type: FunctionDiscountType;
194
+ discount_value: number;
195
+ };
196
+ type FunctionMemberPriceConfig = {
197
+ rule_id: string;
198
+ result_detail: {
199
+ member_discounts?: {
200
+ user_identity: number;
201
+ main_products: {
202
+ all_store_variant: boolean;
203
+ variants: {
204
+ variant_id: string;
205
+ sku: string;
206
+ handle: string;
207
+ }[];
208
+ };
209
+ discount_conf: DiscountConfig;
210
+ }[];
211
+ };
212
+ discount_combinations: {
213
+ other_product_discounts: boolean;
214
+ };
215
+ };
216
+
217
+ type Context = {
218
+ profile: any;
219
+ isLoadingProfile: boolean;
220
+ removeProfile: () => void;
221
+ taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>;
222
+ openSignInPopup: () => void;
223
+ openSignUpPopup: () => void;
224
+ creditInfo?: CreditInfoResponse;
225
+ customer?: any;
226
+ customerLoading: boolean;
227
+ fetchCreditInfo: (user_id: string) => void;
228
+ gtm: {
229
+ pageGroup: string;
230
+ pageHandle?: string;
231
+ };
232
+ pageCommon: CreditsPageCommon;
233
+ memberPriceDiscount?: FunctionMemberPriceConfig[];
234
+ alpcBrand?: string;
235
+ cartConfig?: {
236
+ addToCart: (params: {
237
+ variantList: Array<{
238
+ variant: any;
239
+ quantity: number;
240
+ attributes?: Array<{
241
+ key: string;
242
+ value: string;
243
+ }>;
244
+ }>;
245
+ cartAttributes?: Record<string, string>;
246
+ discountCodes?: string[];
247
+ }) => void | Promise<any>;
248
+ };
249
+ };
250
+ declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, }: PropsWithChildren<Context>): react_jsx_runtime.JSX.Element;
251
+ declare function useCreditsContext(): Context;
252
+
253
+ declare const useUploadReceipt: () => swr_dist_mutation.SWRMutationResponse<{
254
+ ok: boolean;
255
+ code: number;
256
+ }, any, "/api/multipass/mktsrv/v1/credit/upload_third_party_order", {
257
+ orderName: string;
258
+ }>;
259
+
260
+ type ReceiptCopy = {
261
+ title: string;
262
+ description: string;
263
+ placeholder: string;
264
+ note: string;
265
+ submit: string;
266
+ successTitle: string;
267
+ successDescription: string;
268
+ gotIt: string;
269
+ failedTitle: string;
270
+ successIcon: string;
271
+ failedIcon: string;
272
+ failedReasons: {
273
+ code: string;
274
+ id: string;
275
+ description: string;
276
+ }[];
277
+ };
278
+ declare function CreditsUploadReceiptModal({ isOpen, onClose, copy, onSuccess, }: {
279
+ isOpen: boolean;
280
+ onClose: () => void;
281
+ copy: ReceiptCopy;
282
+ onSuccess: () => void;
283
+ }): react_jsx_runtime.JSX.Element;
284
+
285
+ type Img = {
286
+ url: string;
287
+ alt: string;
288
+ width?: number;
289
+ height?: number;
290
+ };
291
+ type CreditsBannerCopy = {
292
+ pcImg: Img;
293
+ laptopImg: Img;
294
+ mobileImg: Img;
295
+ joinNow: string;
296
+ loginIn: string;
297
+ login: {
298
+ title: string;
299
+ description: string;
300
+ };
301
+ unLogin: {
302
+ title: string;
303
+ description: string;
304
+ };
305
+ };
306
+ declare function CreditsBanner({ copy, id }: {
307
+ copy: CreditsBannerCopy;
308
+ id?: string;
309
+ }): react_jsx_runtime.JSX.Element;
310
+
311
+ interface BenefitItemCopy {
312
+ icon: {
313
+ alt: string;
314
+ url: string;
315
+ };
316
+ text: string;
317
+ note?: string;
318
+ tag?: string;
319
+ }
320
+
321
+ type CreditsBenefitsCopy = {
322
+ title: string;
323
+ benefits: BenefitItemCopy[];
324
+ bigIcon?: boolean;
325
+ cardBgColor?: string;
326
+ cardBorderColor?: string;
327
+ };
328
+ declare const CreditsBenefits: ({ copy, id }: {
329
+ copy: CreditsBenefitsCopy;
330
+ id?: string;
331
+ }) => react_jsx_runtime.JSX.Element;
332
+
333
+ type ButtonConfig = {
334
+ text: string;
335
+ type: 'activities' | 'rewards';
336
+ };
337
+ type CreditsInfoCardCopy = {
338
+ balanceLabel: string;
339
+ comingSoonLabel: string;
340
+ comingSoonTips: string;
341
+ buttons: ButtonConfig[];
342
+ };
343
+ declare function CreditsInfoCard({ copy, id }: {
344
+ copy: CreditsInfoCardCopy;
345
+ id?: string;
346
+ }): react_jsx_runtime.JSX.Element;
347
+
348
+ type CreditsSubscribeModalCopy = {
349
+ title: string;
350
+ desc?: string;
351
+ placeholder: string;
352
+ policy?: string;
353
+ successTips?: string;
354
+ dealsType?: string;
355
+ };
356
+
357
+ type BenefitItem = {
358
+ title: string;
359
+ credits: string;
360
+ id: string;
361
+ };
362
+ type CreditsWaysToGetCreditsCopy = {
363
+ title: string;
364
+ subtitle: string;
365
+ equalCredits: string;
366
+ musicIcon: string;
367
+ list: BenefitItem[];
368
+ mainImage: {
369
+ url: string;
370
+ alt: string;
371
+ };
372
+ joinNow: string;
373
+ activate: string;
374
+ completed: string;
375
+ completeProfile: string;
376
+ makeFirstPurchase: string;
377
+ goShopLink: string;
378
+ uploadReceipt: string;
379
+ shopNow: string;
380
+ subscribeLabel: string;
381
+ sendEmailSuccess: string;
382
+ creditsIcon: {
383
+ url: string;
384
+ alt: string;
385
+ };
386
+ receipt: ReceiptCopy;
387
+ subscribe: CreditsSubscribeModalCopy;
388
+ };
389
+ type CreditsWaysToGetCreditsProps = {
390
+ copy: CreditsWaysToGetCreditsCopy;
391
+ classNames?: {
392
+ equalCreditsText?: string;
393
+ subtitle?: string;
394
+ };
395
+ };
396
+
397
+ declare const CreditsWaysToGetCredits: ({ copy, classNames, id }: CreditsWaysToGetCreditsProps & {
398
+ id?: string;
399
+ }) => react_jsx_runtime.JSX.Element;
400
+
401
+ type CreditsFaqCopy = {
402
+ title: string;
403
+ subTitle: string;
404
+ learnMore: {
405
+ link: string;
406
+ label: string;
407
+ };
408
+ items: {
409
+ category_name: string;
410
+ question: string;
411
+ answer: string;
412
+ }[];
413
+ };
414
+ declare const CreditsFaq: ({ copy, id }: {
415
+ copy: CreditsFaqCopy;
416
+ id?: string;
417
+ }) => react_jsx_runtime.JSX.Element;
418
+
419
+ type RedeemableItemConfig$1 = {
420
+ title: string;
421
+ desc: string;
422
+ price: number;
423
+ credit: string;
424
+ rules: string;
425
+ image: {
426
+ url: string;
427
+ };
428
+ mobileImage: {
429
+ url: string;
430
+ };
431
+ redeemId: number;
432
+ };
433
+ type CreditsCashCopy = {
434
+ title: string;
435
+ list: (RedeemableItemConfig$1 & {
436
+ products: {
437
+ handle: string;
438
+ sku: string;
439
+ }[];
440
+ })[];
441
+ soldOut: string;
442
+ unlockRewards: string;
443
+ btnRedeem: string;
444
+ off: string;
445
+ badgeLabel?: string;
446
+ };
447
+
448
+ declare const CreditsCash: ({ copy, id }: {
449
+ copy: CreditsCashCopy;
450
+ id?: string;
451
+ }) => react_jsx_runtime.JSX.Element;
452
+
453
+ type CreditsRedeemListCopy = {
454
+ title: string;
455
+ availableCredits: string;
456
+ unlockRewards: string;
457
+ btnRedeem: string;
458
+ list: {
459
+ label: string;
460
+ list: {
461
+ id: string;
462
+ type: string;
463
+ value: string;
464
+ rules: string[];
465
+ }[];
466
+ }[];
467
+ redeemModal: {
468
+ confirmTitle: string;
469
+ confirmButton: string;
470
+ commonError: string;
471
+ redeemLimitError: string;
472
+ inventoryNotEnough: string;
473
+ creditsNotEnough: string;
474
+ crossSiteError: string;
475
+ errorImageUrl: string;
476
+ coupon: {
477
+ successDesc: string;
478
+ successTitle: string;
479
+ successButton: string;
480
+ successButtonUrl: string;
481
+ };
482
+ product: {
483
+ required: string;
484
+ invalidEmail: string;
485
+ shippingAddress: string;
486
+ shippingProduct: string;
487
+ addressForm: {
488
+ key: string;
489
+ type: string;
490
+ label: string;
491
+ isSelect: boolean;
492
+ required: boolean;
493
+ placeholder: string;
494
+ }[][];
495
+ form: {
496
+ key: string;
497
+ type: string;
498
+ isSelect: boolean;
499
+ required: boolean;
500
+ placeholder: string;
501
+ }[][];
502
+ successDesc: string[];
503
+ rules: string[];
504
+ steps: {
505
+ imageUrl: string;
506
+ title: string;
507
+ }[];
508
+ quantityLabel: string;
509
+ totalPriceLabel: string;
510
+ variantLabel: string;
511
+ shippingFeeLabel: string;
512
+ paymentButton: string;
513
+ stepTitle: string;
514
+ };
515
+ };
516
+ };
517
+
518
+ declare const CreditsRedeemList: ({ copy, id }: {
519
+ copy: CreditsRedeemListCopy;
520
+ id?: string;
521
+ }) => react_jsx_runtime.JSX.Element;
522
+
523
+ type AuthCodeActivateCopy = {
524
+ authCodeTitle?: string;
525
+ authCodeDesc?: string;
526
+ enterActiveCodeText?: string;
527
+ authCodeContent?: string;
528
+ authCodeReceiveText?: string;
529
+ sendAgainText?: string;
530
+ buttonText?: string;
531
+ note?: string;
532
+ codeEmptyError?: string;
533
+ incorrectCodeError?: string;
534
+ retrieveText?: string;
535
+ authSuccessMessage?: string;
536
+ sendEmailSuccessMessage?: string;
537
+ sendEmailErrorMessage?: string;
538
+ beenActivatedMessage?: string;
539
+ invalidCodeMessage?: string;
540
+ expiredCodeMessage?: string;
541
+ };
542
+ type AuthCodeActivateProps = {
543
+ copy: AuthCodeActivateCopy;
544
+ };
545
+
546
+ declare const AuthCodeActivate: React__default.FC<AuthCodeActivateProps>;
547
+
548
+ interface RegistrationContextType {
549
+ email?: string;
550
+ copy?: any;
551
+ authCodeActivate: {
552
+ isOpen: boolean;
553
+ open: () => void;
554
+ close: () => void;
555
+ isActivateSuccess: boolean;
556
+ activeToken?: string;
557
+ onAuthSuccess: (() => void) | undefined;
558
+ isSendingActivateEmail: boolean;
559
+ setIsSendingActivateEmail: Dispatch<SetStateAction<boolean>>;
560
+ setActiveToken: Dispatch<SetStateAction<string | undefined>>;
561
+ setIsActivateSuccess: Dispatch<SetStateAction<boolean>>;
562
+ setOnAuthSuccess: Dispatch<SetStateAction<(() => void) | undefined>>;
563
+ autoSendEmail: boolean;
564
+ setAutoSendEmail: Dispatch<SetStateAction<boolean>>;
565
+ };
566
+ }
567
+ declare const RegistrationContext: React$1.Context<RegistrationContextType>;
568
+ declare const useRegistration: () => RegistrationContextType;
569
+ declare const RegistrationProvider: ({ children, email, copy }: PropsWithChildren<{
570
+ email?: string;
571
+ copy?: any;
572
+ }>) => react_jsx_runtime.JSX.Element;
573
+
574
+ type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
575
+ interface MessageMetadata {
576
+ tokenUsage?: {
577
+ inputTokens: number;
578
+ outputTokens: number;
579
+ };
580
+ toolCalls?: Array<{
581
+ id: string;
582
+ type: string;
583
+ name: string;
584
+ }>;
585
+ }
586
+ interface Message {
587
+ id: string;
588
+ sessionId?: string;
589
+ role: MessageRole;
590
+ content: MessageContent[];
591
+ timestamp: number;
592
+ metadata?: MessageMetadata;
593
+ }
594
+ type MessageContentType = 'text' | 'product_card' | 'product_list' | 'product_comparison' | 'policy' | 'quick_replies' | 'thinking' | 'error' | 'faq_list' | 'cart';
595
+ type MessageContent = TextContent | ProductCardContent | ProductListContent | ProductComparisonContent | PolicyContent | QuickRepliesContent | ThinkingContent | ErrorContent | FAQListContent | PromotionListContent | CartContent;
596
+ interface TextContent {
597
+ type: 'text';
598
+ text: string;
599
+ }
600
+ interface ProductCardContent {
601
+ type: 'product_card';
602
+ data: {
603
+ product: Product;
604
+ };
605
+ }
606
+ interface ProductListContent {
607
+ type: 'product_list';
608
+ data: {
609
+ products: Product[];
610
+ title?: string;
611
+ onAddToCart?: (product: Product) => void;
612
+ commonText?: CommonText;
613
+ };
614
+ }
615
+ interface ProductComparisonContent {
616
+ type: 'product_comparison';
617
+ data: {
618
+ products: Product[];
619
+ dimensions: {
620
+ price?: {
621
+ label: string;
622
+ values: Array<{
623
+ product_id: string;
624
+ min: number;
625
+ max: number;
626
+ currency: string;
627
+ has_discount: boolean;
628
+ }>;
629
+ };
630
+ variants?: {
631
+ label: string;
632
+ values: Array<{
633
+ product_id: string;
634
+ count: number;
635
+ }>;
636
+ };
637
+ member_price?: {
638
+ label: string;
639
+ values: Array<{
640
+ product_id: string;
641
+ available: boolean;
642
+ min: number;
643
+ max: number;
644
+ currency: string;
645
+ }>;
646
+ };
647
+ discount?: {
648
+ label: string;
649
+ values: Array<{
650
+ product_id: string;
651
+ has_discount: boolean;
652
+ }>;
653
+ };
654
+ [key: string]: any;
655
+ };
656
+ onAddToCart?: (product: Product) => void;
657
+ commonText?: CommonText;
658
+ };
659
+ }
660
+ interface PolicyContent {
661
+ type: 'policy';
662
+ data: {
663
+ title: string;
664
+ content: string;
665
+ };
666
+ }
667
+ interface QuickRepliesContent {
668
+ type: 'quick_replies';
669
+ data: {
670
+ replies: QuickReply[];
671
+ };
672
+ }
673
+ interface ThinkingContent {
674
+ type: 'thinking';
675
+ data: {
676
+ status: string;
677
+ };
678
+ }
679
+ interface ErrorContent {
680
+ type: 'error';
681
+ data: {
682
+ message: string;
683
+ code?: string;
684
+ };
685
+ }
686
+ interface FAQListContent {
687
+ type: 'faq_list';
688
+ data: {
689
+ found: boolean;
690
+ count: number;
691
+ total?: number;
692
+ results: FAQItem[];
693
+ };
694
+ }
695
+ interface PromotionListContent {
696
+ type: 'promotion_list';
697
+ data: {
698
+ found: boolean;
699
+ count: number;
700
+ total?: number;
701
+ results: PromotionItem[];
702
+ commonText?: CommonText;
703
+ };
704
+ }
705
+ type FAQCategory = 'shipping' | 'return' | 'product' | 'payment' | 'general';
706
+ interface FAQItem {
707
+ id: string;
708
+ question: string;
709
+ answer: string;
710
+ category: FAQCategory;
711
+ keywords?: string[];
712
+ relatedQuestions?: string[];
713
+ metadata?: {
714
+ language?: string;
715
+ priority?: number;
716
+ lastUpdated?: string;
717
+ };
718
+ }
719
+ interface PromotionItem {
720
+ id: string;
721
+ title: string;
722
+ subtitle?: string;
723
+ description?: string;
724
+ banner_url?: string;
725
+ url?: string;
726
+ time_range: {
727
+ start: string;
728
+ end?: string | null;
729
+ is_active: boolean;
730
+ };
731
+ priority?: number;
732
+ product_count?: number;
733
+ metadata?: {
734
+ display_order?: number;
735
+ target_audience?: string;
736
+ };
737
+ }
738
+ type StockStatus = 'in_stock' | 'low_stock' | 'out_of_stock';
739
+ interface Price {
740
+ amount: number;
741
+ currency: string;
742
+ }
743
+ interface PriceRange {
744
+ min: number;
745
+ max: number;
746
+ currency: string;
747
+ }
748
+ interface VariantDiscount {
749
+ has_discount: boolean;
750
+ discount_price?: number;
751
+ discount_code?: string;
752
+ discount_percentage?: number;
753
+ /** 折扣类型:fixed_amount 固定金额折扣,percentage 百分比折扣 */
754
+ discount_type?: 'fixed_amount' | 'percentage';
755
+ /** 折扣数值(可能是字符串或数字) */
756
+ discount_value?: string | number;
757
+ }
758
+ interface VariantMemberPrice {
759
+ has_member_price: boolean;
760
+ price?: number;
761
+ }
762
+ interface ProductFeatures {
763
+ is_new?: boolean;
764
+ has_rental?: boolean;
765
+ has_presale?: boolean;
766
+ has_member_price?: boolean;
767
+ has_discount?: boolean;
768
+ }
769
+ interface Variant {
770
+ id: string;
771
+ title: string;
772
+ sku?: string;
773
+ price?: Price;
774
+ availableForSale: boolean;
775
+ color?: string;
776
+ discount?: VariantDiscount;
777
+ memberPrice?: VariantMemberPrice;
778
+ inventoryQuantity?: number;
779
+ option1?: string;
780
+ option2?: string;
781
+ option3?: string;
782
+ }
783
+ interface Product {
784
+ shopifyId: string;
785
+ sku?: string;
786
+ handle: string;
787
+ title: string;
788
+ description?: string;
789
+ vendor?: string;
790
+ price: Price;
791
+ priceRange?: PriceRange;
792
+ memberPriceRange?: PriceRange;
793
+ imageUrl: string;
794
+ productUrl: string;
795
+ stockStatus: StockStatus;
796
+ hotScore?: number;
797
+ averageRating?: number;
798
+ reviewCount?: number;
799
+ variants?: Variant[];
800
+ variantCount?: number;
801
+ availableCount?: number;
802
+ features?: ProductFeatures;
803
+ tags?: string[];
804
+ }
805
+ interface QuickReply {
806
+ id: string;
807
+ label: string;
808
+ value: string;
809
+ icon?: string;
810
+ }
811
+ /**
812
+ * 购物车金额信息
813
+ */
814
+ interface CartAmount {
815
+ /** 金额字符串(如 "99.99") */
816
+ amount: string;
817
+ /** 货币代码(如 "USD") */
818
+ currencyCode: string;
819
+ }
820
+ /**
821
+ * 购物车价格汇总
822
+ */
823
+ interface CartCost {
824
+ /** 应付总价(已应用折扣) */
825
+ totalAmount: CartAmount;
826
+ /** 原价小计(未应用折扣) */
827
+ subtotalAmount: CartAmount;
828
+ }
829
+ /**
830
+ * 购物车商品变体信息
831
+ */
832
+ interface CartMerchandise {
833
+ /** 变体 ID (Shopify ProductVariant GID) */
834
+ id: string;
835
+ /** 变体标题(如 "Black", "Large" 等) */
836
+ title: string;
837
+ /** 单价 */
838
+ price: CartAmount;
839
+ /** 商品图片 URL */
840
+ image?: {
841
+ url: string;
842
+ altText?: string;
843
+ };
844
+ /** 关联的商品信息 */
845
+ product: {
846
+ /** 商品 ID */
847
+ id: string;
848
+ /** 商品标题 */
849
+ title: string;
850
+ /** 商品 handle */
851
+ handle: string;
852
+ };
853
+ }
854
+ /**
855
+ * 购物车商品行
856
+ */
857
+ interface CartLine {
858
+ /** 购物车行 ID (用于更新/删除操作) */
859
+ id: string;
860
+ /** 商品数量 */
861
+ quantity: number;
862
+ /** 价格信息 */
863
+ cost: {
864
+ /** 行总价(单价 × 数量,已应用折扣) */
865
+ totalAmount: CartAmount;
866
+ /** 单价 */
867
+ amountPerQuantity: CartAmount;
868
+ /** 行小计(单价 × 数量,未应用折扣) */
869
+ subtotalAmount: CartAmount;
870
+ };
871
+ /** 商品变体信息 */
872
+ merchandise: CartMerchandise;
873
+ /** 自定义属性(可选) */
874
+ attributes?: Array<{
875
+ key: string;
876
+ value: string;
877
+ }>;
878
+ }
879
+ /**
880
+ * 购物车折扣码
881
+ */
882
+ interface CartDiscountCode {
883
+ /** 折扣码 */
884
+ code: string;
885
+ /** 是否有效/适用 */
886
+ applicable: boolean;
887
+ }
888
+ /**
889
+ * 购物车数据
890
+ */
891
+ interface CartData {
892
+ /** 购物车是否为空 */
893
+ isEmpty: boolean;
894
+ /** 购物车 ID (Shopify Cart GID) */
895
+ cartId: string;
896
+ /** 商品总数量 */
897
+ totalQuantity: number;
898
+ /** 商品列表 */
899
+ lines: CartLine[];
900
+ /** 价格汇总 */
901
+ cost: CartCost;
902
+ /** 折扣码列表 */
903
+ discountCodes?: CartDiscountCode[];
904
+ /** 结账页面 URL */
905
+ checkoutUrl?: string;
906
+ /** 购物车按钮回调函数 */
907
+ onCart?: (cartId: string, checkoutUrl?: string) => void;
908
+ /** 通用文案配置 */
909
+ commonText?: CommonText;
910
+ }
911
+ /**
912
+ * 购物车内容块
913
+ */
914
+ interface CartContent {
915
+ type: 'cart';
916
+ data: CartData;
917
+ }
918
+ type SSEEventType = 'message_start' | 'content_delta' | 'content_block' | 'message_end' | 'tool_start' | 'tool_end' | 'status' | 'error' | 'done';
919
+ interface SSEEvent<T = any> {
920
+ event: SSEEventType | null;
921
+ data: T;
922
+ }
923
+ /**
924
+ * 流式对话请求参数
925
+ */
926
+ interface ChatStreamRequest {
927
+ /** 用户的消息文本 */
928
+ message: string;
929
+ /** 用户标识符 */
930
+ user_id: string;
931
+ /** 来自 new-session 端点的会话 ID */
932
+ session_id: string;
933
+ /** 可选的上下文信息 */
934
+ context?: {
935
+ /** 用于购物车操作的 Shopify 购物车 ID */
936
+ cartId?: string;
937
+ /** Storefront API 访问令牌 */
938
+ accessToken?: string;
939
+ /** 已登录用户的 ID */
940
+ real_user_id?: string;
941
+ };
942
+ }
943
+ /**
944
+ * 通用文案配置
945
+ * 用于自定义组件中的按钮文案
946
+ */
947
+ interface CommonText {
948
+ /**
949
+ * 产品列表展开按钮文案
950
+ * @default "Learn More"
951
+ */
952
+ learnMore?: string;
953
+ /**
954
+ * 产品列表收起按钮文案
955
+ * @default "Show Less"
956
+ */
957
+ showLess?: string;
958
+ /**
959
+ * 添加到购物车按钮文案
960
+ * @default "Add to Cart"
961
+ */
962
+ addToCart?: string;
963
+ /**
964
+ * 查看购物车/更多按钮文案
965
+ * @default "View More"
966
+ */
967
+ viewMore?: string;
968
+ /**
969
+ * 折扣标签后缀文案(如 "20% OFF" 中的 "OFF")
970
+ * @default "OFF"
971
+ */
972
+ off?: string;
973
+ }
974
+ interface LiveChatWidgetProps {
975
+ /**
976
+ * API 基础 URL
977
+ * @example "https://beta-api-livechat.anker.com"
978
+ */
979
+ apiBaseUrl: string;
980
+ /**
981
+ * 自定义请求头
982
+ * 将在所有 API 请求中添加这些请求头
983
+ * @example { "Authorization": "Bearer token", "X-Custom-Header": "value" }
984
+ */
985
+ headers?: Record<string, string>;
986
+ /**
987
+ * 是否启用 reCAPTCHA 验证
988
+ * @default false
989
+ */
990
+ needRecaptcha?: boolean;
991
+ /**
992
+ * reCAPTCHA site key
993
+ * 当 needRecaptcha=true 时必填
994
+ * @example "6LfS4J4pAAAAACX1e_WrxutmxxzCK7FU4WzVqL14"
995
+ */
996
+ recaptchaSitekey?: string;
997
+ /**
998
+ * reCAPTCHA action 前缀
999
+ * 实际使用时会根据不同接口添加后缀(如 chat_stream, new_session)
1000
+ * @default "livechat"
1001
+ */
1002
+ recaptchaAction?: string;
1003
+ /**
1004
+ * Shopify 店铺域名
1005
+ * @example "www.eufy.com"
1006
+ */
1007
+ site?: string;
1008
+ /**
1009
+ * 已登录用户的 ID(可选)
1010
+ * 如果提供,将在 API 请求中传递
1011
+ */
1012
+ loginUserId?: string;
1013
+ /**
1014
+ * Shopify 购物车 ID(可选)
1015
+ * 用于购物车操作,将在 stream 接口的 context 中传递
1016
+ * @example "gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZH..."
1017
+ */
1018
+ cartId?: string;
1019
+ /**
1020
+ * Storefront API 访问令牌(可选)
1021
+ * 用于购物车操作,将在 stream 接口的 context 中传递
1022
+ */
1023
+ accessToken?: string;
1024
+ /**
1025
+ * 气泡按钮位置
1026
+ * 自定义位置对象:{ top?: string, bottom?: string, left?: string, right?: string }
1027
+ * @default { bottom: "1.5rem", right: "1.5rem" }
1028
+ * @example
1029
+ * // 自定义位置
1030
+ * position={{ bottom: "20px", right: "30px" }}
1031
+ * position={{ top: "100px", left: "50px" }}
1032
+ */
1033
+ position?: BubblePosition;
1034
+ /**
1035
+ * 欢迎消息
1036
+ * @default "你好!我是 AI 助手,有什么可以帮助你的吗?"
1037
+ */
1038
+ welcomeMessage?: string;
1039
+ /**
1040
+ * 初始快捷回复按钮
1041
+ */
1042
+ quickReplies?: QuickReply[];
1043
+ /**
1044
+ * 自定义消息渲染器
1045
+ */
1046
+ customRenderers?: Record<string, MessageRenderer>;
1047
+ /**
1048
+ * Logo URL
1049
+ */
1050
+ logoUrl?: string;
1051
+ /**
1052
+ * 聊天窗口标题
1053
+ * @default "AI 助手"
1054
+ */
1055
+ title?: string;
1056
+ /**
1057
+ * 聊天气泡按钮图标(图片 URL)
1058
+ * 如果提供,将使用图片替代默认的 SVG 图标
1059
+ */
1060
+ chatBubbleIcon?: string;
1061
+ /**
1062
+ * 事件回调
1063
+ */
1064
+ onOpen?: () => void;
1065
+ onClose?: () => void;
1066
+ onMessageSend?: (message: string) => void;
1067
+ onError?: (error: Error) => void;
1068
+ /**
1069
+ * AI 消息回调
1070
+ */
1071
+ /**
1072
+ * AI 回复文本消息时触发
1073
+ */
1074
+ onTextMessage?: () => void;
1075
+ /**
1076
+ * AI 回复商品列表卡片时触发
1077
+ */
1078
+ onProductList?: () => void;
1079
+ /**
1080
+ * AI 回复促销卡片时触发
1081
+ */
1082
+ onPromotionList?: () => void;
1083
+ /**
1084
+ * 商品操作回调
1085
+ */
1086
+ onAddToCart?: (product: Product) => void;
1087
+ /**
1088
+ * 购物车按钮点击回调
1089
+ */
1090
+ onCart?: (cartId: string, checkoutUrl?: string) => void;
1091
+ /**
1092
+ * 是否显示新会话按钮
1093
+ * @default true
1094
+ */
1095
+ showNewSessionButton?: boolean;
1096
+ /**
1097
+ * 通用文案配置
1098
+ * 用于自定义按钮文案
1099
+ */
1100
+ commonText?: CommonText;
1101
+ }
1102
+ interface MessageRenderer {
1103
+ render: (content: MessageContent, isUser: boolean, isSystem: boolean) => React.ReactNode;
1104
+ }
1105
+ interface PositionStyles {
1106
+ bottom?: string;
1107
+ top?: string;
1108
+ left?: string;
1109
+ right?: string;
1110
+ }
1111
+ type BubblePosition = PositionStyles;
1112
+
1113
+ /**
1114
+ * LiveChat 主组件
1115
+ * 集成所有子组件,提供完整的聊天功能
1116
+ * 基于 specs/livechat-widget/plan.md 的三层架构设计
1117
+ */
1118
+
1119
+ /**
1120
+ * LiveChat 聊天组件
1121
+ *
1122
+ * 功能:
1123
+ * - 气泡弹窗聊天界面
1124
+ * - SSE 流式消息接收
1125
+ * - 会话管理(userId, sessionId)
1126
+ * - 历史消息加载
1127
+ * - 多种消息类型渲染
1128
+ * - 自定义扩展机制
1129
+ * - reCAPTCHA v3 安全防护
1130
+ *
1131
+ * 架构:
1132
+ * - UI Layer: ChatBubble, ChatWindow, MessageList, etc.
1133
+ * - Logic Layer: useChatState, useChatAPI, useSession
1134
+ * - Core Layer: MessageRendererRegistry, 自定义渲染器
1135
+ *
1136
+ * @example
1137
+ * ```tsx
1138
+ * // 基础使用(使用默认位置)
1139
+ * <LiveChatWidget
1140
+ * apiBaseUrl="https://beta-api-livechat.anker.com"
1141
+ * site="www.eufy.com"
1142
+ * welcomeMessage="你好!我是 AI 助手"
1143
+ * onMessageSend={(msg) => console.log('Sent:', msg)}
1144
+ * />
1145
+ *
1146
+ * // 使用自定义位置
1147
+ * <LiveChatWidget
1148
+ * apiBaseUrl="https://beta-api-livechat.anker.com"
1149
+ * site="www.eufy.com"
1150
+ * position={{ bottom: "20px", right: "30px" }}
1151
+ * onMessageSend={(msg) => console.log('Sent:', msg)}
1152
+ * />
1153
+ *
1154
+ * // 启用 reCAPTCHA v3 安全防护
1155
+ * <LiveChatWidget
1156
+ * apiBaseUrl="https://beta-api-livechat.anker.com"
1157
+ * site="www.eufy.com"
1158
+ * needRecaptcha={true}
1159
+ * recaptchaSitekey="6LfS4J4pAAAAACX1e_WrxutmxxzCK7FU4WzVqL14"
1160
+ * recaptchaAction="livechat"
1161
+ * />
1162
+ *
1163
+ * // 使用自定义 headers 和 reCAPTCHA
1164
+ * <LiveChatWidget
1165
+ * apiBaseUrl="https://beta-api-livechat.anker.com"
1166
+ * site="www.eufy.com"
1167
+ * headers={{
1168
+ * "Authorization": "Bearer your-token",
1169
+ * "X-Custom-Header": "value"
1170
+ * }}
1171
+ * needRecaptcha={true}
1172
+ * recaptchaSitekey="your-site-key"
1173
+ * />
1174
+ * ```
1175
+ */
1176
+ declare const LiveChatWidget: React__default.FC<LiveChatWidgetProps>;
1177
+
1178
+ type RedeemableItemConfig = {
1179
+ title: string;
1180
+ desc: string;
1181
+ price: number;
1182
+ credit: string;
1183
+ rules: string;
1184
+ image: {
1185
+ url: string;
1186
+ };
1187
+ mobileImage: {
1188
+ url: string;
1189
+ };
1190
+ redeemId: number;
1191
+ };
1192
+ type TabConfig = {
1193
+ label: string;
1194
+ type: 'memberPrice' | 'redeem';
1195
+ };
1196
+ type CreditsMemberPriceCopy = {
1197
+ title: string;
1198
+ tabs: TabConfig[];
1199
+ memberPriceTab: {
1200
+ memberPriceRuleId: string;
1201
+ addToCart: string;
1202
+ shopNowText: string;
1203
+ memberPriceLabel: string;
1204
+ badgeLabel?: string;
1205
+ };
1206
+ redeemTab: {
1207
+ list: (RedeemableItemConfig & {
1208
+ products: {
1209
+ handle: string;
1210
+ sku: string;
1211
+ }[];
1212
+ })[];
1213
+ soldOut: string;
1214
+ unlockRewards: string;
1215
+ btnRedeem: string;
1216
+ off: string;
1217
+ badgeLabel?: string;
1218
+ };
1219
+ };
1220
+
1221
+ type NavigationItem = {
1222
+ label: string;
1223
+ targetId: string;
1224
+ };
1225
+ type CreditsNavigationCopy = {
1226
+ items: NavigationItem[];
1227
+ };
1228
+
1229
+ declare enum ComponentKey {
1230
+ Navigation = "creditsNavigation",
1231
+ Banner = "creditsBanner",
1232
+ InfoCard = "creditsInfoCard",
1233
+ Benefits = "creditsBenefits",
1234
+ WaysToGetCredits = "creditsWaysToGetCredits",
1235
+ AnkersolixTask = "creditsAnkersolixTask",
1236
+ RedeemList = "creditsRedeemList",
1237
+ SpendCreditsLikeCash = "creditsCash",
1238
+ MemberPrice = "creditsMemberPrice",
1239
+ Faqs = "creditsFaq"
1240
+ }
1241
+ type CreditsTemplateProps = {
1242
+ headlessConfig: HeadlessConfig;
1243
+ siteConfig: {
1244
+ registrationsSettings: {
1245
+ authCodeActivate: AuthCodeActivateCopy;
1246
+ };
1247
+ taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>;
1248
+ memberPriceDiscount?: FunctionMemberPriceConfig[];
1249
+ };
1250
+ creditsConfig?: {
1251
+ alpcBrand?: string;
1252
+ };
1253
+ pageConfig: {
1254
+ order: ComponentKey[];
1255
+ common: CreditsPageCommon;
1256
+ components: {
1257
+ [ComponentKey.Navigation]?: CreditsNavigationCopy;
1258
+ [ComponentKey.Banner]?: CreditsBannerCopy;
1259
+ [ComponentKey.InfoCard]?: CreditsInfoCardCopy;
1260
+ [ComponentKey.Benefits]?: CreditsBenefitsCopy;
1261
+ [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy;
1262
+ [ComponentKey.AnkersolixTask]?: CreditsWaysToGetCreditsCopy;
1263
+ [ComponentKey.RedeemList]?: CreditsRedeemListCopy;
1264
+ [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy;
1265
+ [ComponentKey.MemberPrice]?: CreditsMemberPriceCopy;
1266
+ [ComponentKey.Faqs]?: CreditsFaqCopy;
1267
+ };
1268
+ };
1269
+ userContext: {
1270
+ profile: any;
1271
+ removeProfile: () => void;
1272
+ isLoadingProfile: boolean;
1273
+ creditInfo: any;
1274
+ customer: any;
1275
+ customerLoading: boolean;
1276
+ fetchCreditInfo: () => void;
1277
+ };
1278
+ registrationContext: {
1279
+ openSignUpPopup: () => void;
1280
+ openSignInPopup: () => void;
1281
+ };
1282
+ gtm: {
1283
+ pageGroup: string;
1284
+ pageHandle?: string;
1285
+ };
1286
+ cartConfig?: {
1287
+ addToCart: (params: {
1288
+ variantList: Array<{
1289
+ variant: any;
1290
+ quantity: number;
1291
+ attributes?: Array<{
1292
+ key: string;
1293
+ value: string;
1294
+ }>;
1295
+ }>;
1296
+ cartAttributes?: Record<string, string>;
1297
+ discountCodes?: string[];
1298
+ }) => void | Promise<any>;
1299
+ };
1300
+ };
1301
+ declare const CreditsTemplate: ({ headlessConfig, siteConfig, creditsConfig, userContext, pageConfig, registrationContext, gtm, cartConfig, }: CreditsTemplateProps) => react_jsx_runtime.JSX.Element;
1302
+
1303
+ declare const ROUNDED_BRANDS: string[];
1304
+
1305
+ export { AuthCodeActivate, Chat, type ChatStreamRequest, ComponentKey, CreditsBanner, CreditsBenefits, CreditsCash, CreditsFaq, CreditsInfoCard, CreditsProvider, CreditsRedeemList, CreditsTemplate, type CreditsTemplateProps, CreditsUploadReceiptModal, CreditsWaysToGetCredits, type ErrorContent, LiveChatWidget, type LiveChatWidgetProps, type Message, type MessageContent, type MessageContentType, type MessageMetadata, type MessageRenderer, type MessageRole, type PolicyContent, type ProductCardContent, type ProductListContent, type QuickRepliesContent, type QuickReply, ROUNDED_BRANDS, RegistrationContext, RegistrationProvider, type SSEEvent, type ThinkingContent, useCreditsContext, useUploadReceipt as useCreditsUploadReceipt, useRegistration };