@anker-in/campaign-ui 0.3.2 → 0.3.4

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 (229) 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 +2 -2
  46. package/dist/cjs/components/LiveChatWidget/components/MessageList.js.map +2 -2
  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 +35 -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 +212 -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/credits/creditsBanner/index.js +2 -2
  68. package/dist/cjs/components/credits/creditsBanner/index.js.map +2 -2
  69. package/dist/cjs/components/index.d.ts +2 -0
  70. package/dist/cjs/components/index.js +1 -1
  71. package/dist/cjs/components/index.js.map +3 -3
  72. package/dist/cjs/stories/LiveChatWidget.stories.d.ts +1 -79
  73. package/dist/cjs/stories/LiveChatWidget.stories.js +8 -47
  74. package/dist/cjs/stories/LiveChatWidget.stories.js.map +3 -3
  75. package/dist/esm/components/LiveChatWidget/LiveChatWidget.d.ts +21 -1
  76. package/dist/esm/components/LiveChatWidget/LiveChatWidget.js +1 -1
  77. package/dist/esm/components/LiveChatWidget/LiveChatWidget.js.map +3 -3
  78. package/dist/esm/components/LiveChatWidget/api/chat.d.ts +23 -2
  79. package/dist/esm/components/LiveChatWidget/api/chat.js +2 -2
  80. package/dist/esm/components/LiveChatWidget/api/chat.js.map +3 -3
  81. package/dist/esm/components/LiveChatWidget/components/ChatHeader.js +1 -1
  82. package/dist/esm/components/LiveChatWidget/components/ChatHeader.js.map +2 -2
  83. package/dist/esm/components/LiveChatWidget/components/ChatInput.d.ts +5 -0
  84. package/dist/esm/components/LiveChatWidget/components/ChatInput.js +1 -1
  85. package/dist/esm/components/LiveChatWidget/components/ChatInput.js.map +3 -3
  86. package/dist/esm/components/LiveChatWidget/components/ChatMessage.js +2 -2
  87. package/dist/esm/components/LiveChatWidget/components/ChatMessage.js.map +3 -3
  88. package/dist/esm/components/LiveChatWidget/components/ChatWindow.d.ts +5 -0
  89. package/dist/esm/components/LiveChatWidget/components/ChatWindow.js +1 -1
  90. package/dist/esm/components/LiveChatWidget/components/ChatWindow.js.map +3 -3
  91. package/dist/esm/components/LiveChatWidget/components/ComplianceDialog.d.ts +51 -0
  92. package/dist/esm/components/LiveChatWidget/components/ComplianceDialog.js +33 -0
  93. package/dist/esm/components/LiveChatWidget/components/ComplianceDialog.js.map +7 -0
  94. package/dist/esm/components/LiveChatWidget/components/MessageContent/CartCard.js +1 -1
  95. package/dist/esm/components/LiveChatWidget/components/MessageContent/CartCard.js.map +3 -3
  96. package/dist/esm/components/LiveChatWidget/components/MessageContent/ErrorBlock.js +1 -1
  97. package/dist/esm/components/LiveChatWidget/components/MessageContent/ErrorBlock.js.map +2 -2
  98. package/dist/esm/components/LiveChatWidget/components/MessageContent/FAQList.js +1 -1
  99. package/dist/esm/components/LiveChatWidget/components/MessageContent/FAQList.js.map +3 -3
  100. package/dist/esm/components/LiveChatWidget/components/MessageContent/PolicyBlock.js +2 -2
  101. package/dist/esm/components/LiveChatWidget/components/MessageContent/PolicyBlock.js.map +3 -3
  102. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductCard.d.ts +17 -24
  103. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductCard.js +1 -4
  104. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductCard.js.map +3 -3
  105. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductComparison.d.ts +7 -1
  106. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductComparison.js +1 -1
  107. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductComparison.js.map +3 -3
  108. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductList.js +1 -1
  109. package/dist/esm/components/LiveChatWidget/components/MessageContent/ProductList.js.map +3 -3
  110. package/dist/esm/components/LiveChatWidget/components/MessageContent/PromotionList.d.ts +4 -1
  111. package/dist/esm/components/LiveChatWidget/components/MessageContent/PromotionList.js +1 -1
  112. package/dist/esm/components/LiveChatWidget/components/MessageContent/PromotionList.js.map +3 -3
  113. package/dist/esm/components/LiveChatWidget/components/MessageContent/QuickReplies.js +1 -1
  114. package/dist/esm/components/LiveChatWidget/components/MessageContent/QuickReplies.js.map +2 -2
  115. package/dist/esm/components/LiveChatWidget/components/MessageContent/TextBlock.js +1 -1
  116. package/dist/esm/components/LiveChatWidget/components/MessageContent/TextBlock.js.map +3 -3
  117. package/dist/esm/components/LiveChatWidget/components/MessageContent.js +1 -1
  118. package/dist/esm/components/LiveChatWidget/components/MessageContent.js.map +2 -2
  119. package/dist/esm/components/LiveChatWidget/components/MessageList.js +2 -2
  120. package/dist/esm/components/LiveChatWidget/components/MessageList.js.map +2 -2
  121. package/dist/esm/components/LiveChatWidget/constants.d.ts +5 -0
  122. package/dist/esm/components/LiveChatWidget/constants.js +1 -1
  123. package/dist/esm/components/LiveChatWidget/constants.js.map +3 -3
  124. package/dist/esm/components/LiveChatWidget/hooks/useChatAPI.d.ts +9 -0
  125. package/dist/esm/components/LiveChatWidget/hooks/useChatAPI.js +1 -1
  126. package/dist/esm/components/LiveChatWidget/hooks/useChatAPI.js.map +3 -3
  127. package/dist/esm/components/LiveChatWidget/hooks/useChatState.d.ts +35 -2
  128. package/dist/esm/components/LiveChatWidget/hooks/useChatState.js +1 -1
  129. package/dist/esm/components/LiveChatWidget/hooks/useChatState.js.map +3 -3
  130. package/dist/esm/components/LiveChatWidget/index.d.ts +1 -1
  131. package/dist/esm/components/LiveChatWidget/index.js +1 -1
  132. package/dist/esm/components/LiveChatWidget/index.js.map +2 -2
  133. package/dist/esm/components/LiveChatWidget/types.d.ts +212 -3
  134. package/dist/esm/components/LiveChatWidget/utils/fetcher.d.ts +42 -0
  135. package/dist/esm/components/LiveChatWidget/utils/fetcher.js +2 -0
  136. package/dist/esm/components/LiveChatWidget/utils/fetcher.js.map +7 -0
  137. package/dist/esm/components/chat/markdown.js +1 -1
  138. package/dist/esm/components/chat/markdown.js.map +2 -2
  139. package/dist/esm/components/credits/creditsBanner/index.js +2 -2
  140. package/dist/esm/components/credits/creditsBanner/index.js.map +2 -2
  141. package/dist/esm/components/index.d.ts +2 -0
  142. package/dist/esm/components/index.js +1 -1
  143. package/dist/esm/components/index.js.map +3 -3
  144. package/dist/esm/stories/LiveChatWidget.stories.d.ts +1 -79
  145. package/dist/esm/stories/LiveChatWidget.stories.js +8 -47
  146. package/dist/esm/stories/LiveChatWidget.stories.js.map +3 -3
  147. package/dist/index.d.mts +1305 -0
  148. package/dist/index.d.ts +1305 -0
  149. package/dist/index.js +26656 -0
  150. package/dist/index.js.map +1 -0
  151. package/dist/index.mjs +26641 -0
  152. package/dist/index.mjs.map +1 -0
  153. package/package.json +8 -1
  154. package/src/components/LiveChatWidget/LiveChatWidget.tsx +887 -0
  155. package/src/components/LiveChatWidget/api/chat.ts +175 -0
  156. package/src/components/LiveChatWidget/components/ChatBubble.tsx +152 -0
  157. package/src/components/LiveChatWidget/components/ChatHeader.tsx +150 -0
  158. package/src/components/LiveChatWidget/components/ChatInput.tsx +253 -0
  159. package/src/components/LiveChatWidget/components/ChatMessage.tsx +190 -0
  160. package/src/components/LiveChatWidget/components/ChatWindow.tsx +363 -0
  161. package/src/components/LiveChatWidget/components/ComplianceDialog.tsx +216 -0
  162. package/src/components/LiveChatWidget/components/MessageContent/CartCard.tsx +202 -0
  163. package/src/components/LiveChatWidget/components/MessageContent/ErrorBlock.tsx +75 -0
  164. package/src/components/LiveChatWidget/components/MessageContent/FAQList.tsx +128 -0
  165. package/src/components/LiveChatWidget/components/MessageContent/PolicyBlock.tsx +152 -0
  166. package/src/components/LiveChatWidget/components/MessageContent/ProductCard.tsx +227 -0
  167. package/src/components/LiveChatWidget/components/MessageContent/ProductComparison.tsx +377 -0
  168. package/src/components/LiveChatWidget/components/MessageContent/ProductList.tsx +293 -0
  169. package/src/components/LiveChatWidget/components/MessageContent/PromotionList.tsx +170 -0
  170. package/src/components/LiveChatWidget/components/MessageContent/QuickReplies.tsx +91 -0
  171. package/src/components/LiveChatWidget/components/MessageContent/TextBlock.tsx +110 -0
  172. package/src/components/LiveChatWidget/components/MessageContent/ThinkingBlock.tsx +53 -0
  173. package/src/components/LiveChatWidget/components/MessageContent/index.ts +16 -0
  174. package/src/components/LiveChatWidget/components/MessageContent.tsx +113 -0
  175. package/src/components/LiveChatWidget/components/MessageList.tsx +261 -0
  176. package/src/components/LiveChatWidget/components/ScrollAnchor.tsx +75 -0
  177. package/src/components/LiveChatWidget/constants.ts +36 -0
  178. package/src/components/LiveChatWidget/hooks/useChatAPI.ts +146 -0
  179. package/src/components/LiveChatWidget/hooks/useChatState.ts +1090 -0
  180. package/src/components/LiveChatWidget/hooks/useSession.ts +123 -0
  181. package/src/components/LiveChatWidget/index.tsx +63 -0
  182. package/src/components/LiveChatWidget/types.ts +1011 -0
  183. package/src/components/LiveChatWidget/utils/cartTransformers.ts +72 -0
  184. package/src/components/LiveChatWidget/utils/fetcher.ts +131 -0
  185. package/src/components/LiveChatWidget/utils/messageRenderers.ts +120 -0
  186. package/src/components/LiveChatWidget/utils/productTransformers.ts +149 -0
  187. package/src/components/LiveChatWidget/utils/userId.ts +140 -0
  188. package/src/components/LiveChatWidget/utils/validation.ts +99 -0
  189. package/src/components/chat/markdown.tsx +1 -1
  190. package/src/components/credits/creditsBanner/index.tsx +5 -5
  191. package/src/components/index.ts +23 -0
  192. package/src/stories/LiveChatWidget.stories.tsx +322 -0
  193. package/src/styles/livechat.css +317 -0
  194. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.d.ts +0 -7
  195. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +0 -2
  196. package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +0 -7
  197. package/dist/cjs/components/credits/context/utils/atobID.d.ts +0 -1
  198. package/dist/cjs/components/credits/context/utils/atobID.js +0 -2
  199. package/dist/cjs/components/credits/context/utils/atobID.js.map +0 -7
  200. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.d.ts +0 -5
  201. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js +0 -2
  202. package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js.map +0 -7
  203. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +0 -8
  204. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +0 -2
  205. package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +0 -7
  206. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +0 -9
  207. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +0 -2
  208. package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +0 -7
  209. package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +0 -6
  210. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +0 -2
  211. package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +0 -7
  212. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +0 -7
  213. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +0 -2
  214. package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +0 -7
  215. package/dist/esm/components/credits/context/utils/atobID.d.ts +0 -1
  216. package/dist/esm/components/credits/context/utils/atobID.js +0 -2
  217. package/dist/esm/components/credits/context/utils/atobID.js.map +0 -7
  218. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.d.ts +0 -5
  219. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js +0 -2
  220. package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js.map +0 -7
  221. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +0 -8
  222. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +0 -2
  223. package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +0 -7
  224. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +0 -9
  225. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +0 -2
  226. package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +0 -7
  227. package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +0 -6
  228. package/dist/esm/components/credits/context/utils/variantGetCoupon.js +0 -2
  229. package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/LiveChatWidget/types.ts"],
4
- "sourcesContent": ["/**\n * LiveChat \u7EC4\u4EF6\u6838\u5FC3\u7C7B\u578B\u5B9A\u4E49\n * \u57FA\u4E8E specs/livechat-widget/data-model.md\n */\n\n// ============================================================================\n// Session Types (\u4F1A\u8BDD)\n// ============================================================================\n\nexport type SessionStatus = 'active' | 'expired'\n\nexport interface Session {\n sessionId: string\n userId: string\n site: string\n status: SessionStatus\n createdAt?: number\n lastActivityAt?: number\n}\n\n// ============================================================================\n// Message Types (\u6D88\u606F)\n// ============================================================================\n\nexport type MessageRole = 'user' | 'assistant' | 'system' | 'tool'\n\nexport interface MessageMetadata {\n tokenUsage?: {\n inputTokens: number\n outputTokens: number\n }\n toolCalls?: Array<{\n id: string\n type: string\n name: string\n }>\n}\n\nexport interface Message {\n id: string\n sessionId?: string\n role: MessageRole\n content: MessageContent[]\n timestamp: number\n metadata?: MessageMetadata\n}\n\n// ============================================================================\n// Message Content Types (\u6D88\u606F\u5185\u5BB9)\n// ============================================================================\n\nexport type MessageContentType =\n | 'text'\n | 'product_card'\n | 'product_list'\n | 'product_comparison'\n | 'policy'\n | 'quick_replies'\n | 'thinking'\n | 'error'\n | 'faq_list'\n | 'cart'\n\nexport type MessageContent =\n | TextContent\n | ProductCardContent\n | ProductListContent\n | ProductComparisonContent\n | PolicyContent\n | QuickRepliesContent\n | ThinkingContent\n | ErrorContent\n | FAQListContent\n | PromotionListContent\n | CartContent\n\nexport interface TextContent {\n type: 'text'\n text: string\n}\n\nexport interface ProductCardContent {\n type: 'product_card'\n data: {\n product: Product\n }\n}\n\nexport interface ProductListContent {\n type: 'product_list'\n data: {\n products: Product[]\n title?: string\n onAddToCart?: (product: Product) => void\n }\n}\n\nexport interface ProductComparisonContent {\n type: 'product_comparison'\n data: {\n products: Product[]\n dimensions: {\n price?: {\n label: string\n values: Array<{\n product_id: string\n min: number\n max: number\n currency: string\n has_discount: boolean\n }>\n }\n variants?: {\n label: string\n values: Array<{\n product_id: string\n count: number\n }>\n }\n member_price?: {\n label: string\n values: Array<{\n product_id: string\n available: boolean\n min: number\n max: number\n currency: string\n }>\n }\n discount?: {\n label: string\n values: Array<{\n product_id: string\n has_discount: boolean\n }>\n }\n [key: string]: any\n }\n onAddToCart?: (product: Product) => void\n }\n}\n\nexport interface PolicyContent {\n type: 'policy'\n data: {\n title: string\n content: string\n }\n}\n\nexport interface QuickRepliesContent {\n type: 'quick_replies'\n data: {\n replies: QuickReply[]\n }\n}\n\nexport interface ThinkingContent {\n type: 'thinking'\n data: {\n status: string\n }\n}\n\nexport interface ErrorContent {\n type: 'error'\n data: {\n message: string\n code?: string\n }\n}\n\nexport interface FAQListContent {\n type: 'faq_list'\n data: {\n found: boolean\n count: number\n total?: number\n results: FAQItem[]\n }\n}\n\nexport interface PromotionListContent {\n type: 'promotion_list'\n data: {\n found: boolean\n count: number\n total?: number\n results: PromotionItem[]\n }\n}\n\n// ============================================================================\n// FAQ Types (\u5E38\u89C1\u95EE\u9898)\n// ============================================================================\n\nexport type FAQCategory = 'shipping' | 'return' | 'product' | 'payment' | 'general'\n\nexport interface FAQItem {\n id: string\n question: string\n answer: string\n category: FAQCategory\n keywords?: string[]\n relatedQuestions?: string[]\n metadata?: {\n language?: string\n priority?: number\n lastUpdated?: string\n }\n}\n\n// ============================================================================\n// Promotion Types (\u4FC3\u9500\u6D3B\u52A8)\n// ============================================================================\n\nexport interface PromotionItem {\n id: string\n title: string\n subtitle?: string\n description?: string\n banner_url?: string\n url?: string\n time_range: {\n start: string\n end?: string | null\n is_active: boolean\n }\n priority?: number\n product_count?: number\n metadata?: {\n display_order?: number\n target_audience?: string\n }\n}\n\n// ============================================================================\n// Product Types (\u5546\u54C1)\n// ============================================================================\n\nexport type StockStatus = 'in_stock' | 'low_stock' | 'out_of_stock'\n\nexport interface Price {\n amount: number\n currency: string\n}\n\nexport interface PriceRange {\n min: number\n max: number\n currency: string\n}\n\nexport interface VariantDiscount {\n has_discount: boolean\n discount_price?: number\n discount_code?: string\n discount_percentage?: number\n /** \u6298\u6263\u7C7B\u578B\uFF1Afixed_amount \u56FA\u5B9A\u91D1\u989D\u6298\u6263\uFF0Cpercentage \u767E\u5206\u6BD4\u6298\u6263 */\n discount_type?: 'fixed_amount' | 'percentage'\n /** \u6298\u6263\u6570\u503C\uFF08\u53EF\u80FD\u662F\u5B57\u7B26\u4E32\u6216\u6570\u5B57\uFF09 */\n discount_value?: string | number\n}\n\nexport interface VariantMemberPrice {\n has_member_price: boolean\n price?: number\n}\n\nexport interface ProductFeatures {\n is_new?: boolean\n has_rental?: boolean\n has_presale?: boolean\n has_member_price?: boolean\n has_discount?: boolean\n}\n\nexport interface Variant {\n id: string\n title: string\n sku?: string\n price?: Price\n availableForSale: boolean\n color?: string\n discount?: VariantDiscount\n memberPrice?: VariantMemberPrice\n inventoryQuantity?: number\n option1?: string\n option2?: string\n option3?: string\n}\n\nexport interface Product {\n shopifyId: string\n sku?: string\n handle: string\n title: string\n description?: string\n vendor?: string\n price: Price\n priceRange?: PriceRange\n memberPriceRange?: PriceRange\n imageUrl: string\n productUrl: string\n stockStatus: StockStatus\n hotScore?: number\n averageRating?: number\n reviewCount?: number\n variants?: Variant[]\n variantCount?: number\n availableCount?: number\n features?: ProductFeatures\n tags?: string[]\n}\n\n// ============================================================================\n// Quick Reply Types (\u5FEB\u6377\u56DE\u590D)\n// ============================================================================\n\nexport interface QuickReply {\n id: string\n label: string\n value: string\n icon?: string\n}\n\n// ============================================================================\n// Policy Types (\u653F\u7B56)\n// ============================================================================\n\nexport interface Policy {\n title: string\n content: string\n}\n\n// ============================================================================\n// Cart Types (\u8D2D\u7269\u8F66)\n// ============================================================================\n\n/**\n * \u8D2D\u7269\u8F66\u91D1\u989D\u4FE1\u606F\n */\nexport interface CartAmount {\n /** \u91D1\u989D\u5B57\u7B26\u4E32\uFF08\u5982 \"99.99\"\uFF09 */\n amount: string\n /** \u8D27\u5E01\u4EE3\u7801\uFF08\u5982 \"USD\"\uFF09 */\n currencyCode: string\n}\n\n/**\n * \u8D2D\u7269\u8F66\u4EF7\u683C\u6C47\u603B\n */\nexport interface CartCost {\n /** \u5E94\u4ED8\u603B\u4EF7\uFF08\u5DF2\u5E94\u7528\u6298\u6263\uFF09 */\n totalAmount: CartAmount\n /** \u539F\u4EF7\u5C0F\u8BA1\uFF08\u672A\u5E94\u7528\u6298\u6263\uFF09 */\n subtotalAmount: CartAmount\n}\n\n/**\n * \u8D2D\u7269\u8F66\u5546\u54C1\u53D8\u4F53\u4FE1\u606F\n */\nexport interface CartMerchandise {\n /** \u53D8\u4F53 ID (Shopify ProductVariant GID) */\n id: string\n /** \u53D8\u4F53\u6807\u9898\uFF08\u5982 \"Black\", \"Large\" \u7B49\uFF09 */\n title: string\n /** \u5355\u4EF7 */\n price: CartAmount\n /** \u5546\u54C1\u56FE\u7247 URL */\n image?: {\n url: string\n altText?: string\n }\n /** \u5173\u8054\u7684\u5546\u54C1\u4FE1\u606F */\n product: {\n /** \u5546\u54C1 ID */\n id: string\n /** \u5546\u54C1\u6807\u9898 */\n title: string\n /** \u5546\u54C1 handle */\n handle: string\n }\n}\n\n/**\n * \u8D2D\u7269\u8F66\u5546\u54C1\u884C\n */\nexport interface CartLine {\n /** \u8D2D\u7269\u8F66\u884C ID (\u7528\u4E8E\u66F4\u65B0/\u5220\u9664\u64CD\u4F5C) */\n id: string\n /** \u5546\u54C1\u6570\u91CF */\n quantity: number\n /** \u4EF7\u683C\u4FE1\u606F */\n cost: {\n /** \u884C\u603B\u4EF7\uFF08\u5355\u4EF7 \u00D7 \u6570\u91CF\uFF0C\u5DF2\u5E94\u7528\u6298\u6263\uFF09 */\n totalAmount: CartAmount\n /** \u5355\u4EF7 */\n amountPerQuantity: CartAmount\n /** \u884C\u5C0F\u8BA1\uFF08\u5355\u4EF7 \u00D7 \u6570\u91CF\uFF0C\u672A\u5E94\u7528\u6298\u6263\uFF09 */\n subtotalAmount: CartAmount\n }\n /** \u5546\u54C1\u53D8\u4F53\u4FE1\u606F */\n merchandise: CartMerchandise\n /** \u81EA\u5B9A\u4E49\u5C5E\u6027\uFF08\u53EF\u9009\uFF09 */\n attributes?: Array<{\n key: string\n value: string\n }>\n}\n\n/**\n * \u8D2D\u7269\u8F66\u6298\u6263\u7801\n */\nexport interface CartDiscountCode {\n /** \u6298\u6263\u7801 */\n code: string\n /** \u662F\u5426\u6709\u6548/\u9002\u7528 */\n applicable: boolean\n}\n\n/**\n * \u8D2D\u7269\u8F66\u6570\u636E\n */\nexport interface CartData {\n /** \u8D2D\u7269\u8F66\u662F\u5426\u4E3A\u7A7A */\n isEmpty: boolean\n /** \u8D2D\u7269\u8F66 ID (Shopify Cart GID) */\n cartId: string\n /** \u5546\u54C1\u603B\u6570\u91CF */\n totalQuantity: number\n /** \u5546\u54C1\u5217\u8868 */\n lines: CartLine[]\n /** \u4EF7\u683C\u6C47\u603B */\n cost: CartCost\n /** \u6298\u6263\u7801\u5217\u8868 */\n discountCodes?: CartDiscountCode[]\n /** \u7ED3\u8D26\u9875\u9762 URL */\n checkoutUrl?: string\n /** \u8D2D\u7269\u8F66\u6309\u94AE\u56DE\u8C03\u51FD\u6570 */\n onCart?: (cartId: string, checkoutUrl?: string) => void\n}\n\n/**\n * \u8D2D\u7269\u8F66\u5185\u5BB9\u5757\n */\nexport interface CartContent {\n type: 'cart'\n data: CartData\n}\n\n// ============================================================================\n// Backend Cart Types (\u540E\u7AEF\u8D2D\u7269\u8F66\u6570\u636E\u683C\u5F0F - Shopify GraphQL)\n// ============================================================================\n\n/**\n * \u540E\u7AEF\u8FD4\u56DE\u7684\u8D2D\u7269\u8F66\u5546\u54C1\u884C\u6570\u636E (Shopify GraphQL \u683C\u5F0F)\n */\nexport interface BackendCartLineNode {\n id: string\n quantity: number\n cost: {\n totalAmount: CartAmount\n amountPerQuantity: CartAmount\n compareAtAmountPerQuantity?: CartAmount | null\n subtotalAmount: CartAmount\n }\n discountAllocations: any[]\n merchandise: {\n id: string\n title: string\n availableForSale: boolean\n quantityAvailable?: number\n price: CartAmount\n compareAtPrice?: CartAmount | null\n image?: {\n url: string\n altText?: string | null\n width?: number\n height?: number\n } | null\n product: {\n id: string\n title: string\n handle: string\n vendor?: string\n featuredImage?: {\n url: string\n altText?: string | null\n width?: number\n height?: number\n } | null\n tags?: string[]\n }\n }\n attributes?: Array<{\n key: string\n value: string\n }>\n}\n\n/**\n * \u540E\u7AEF\u8FD4\u56DE\u7684\u8D2D\u7269\u8F66\u6570\u636E (Shopify GraphQL \u683C\u5F0F)\n */\nexport interface BackendCartData {\n id: string\n checkoutUrl?: string\n totalQuantity: number\n lines: {\n edges: Array<{\n node: BackendCartLineNode\n }>\n }\n cost: {\n totalAmount: CartAmount\n subtotalAmount: CartAmount\n checkoutChargeAmount?: CartAmount\n totalAmountEstimated?: boolean\n subtotalAmountEstimated?: boolean\n totalTaxAmount?: CartAmount | null\n totalDutyAmount?: CartAmount | null\n }\n discountAllocations?: any[]\n buyerIdentity?: any\n attributes?: Array<{\n key: string\n value: string\n }>\n discountCodes?: any[]\n createdAt?: string\n updatedAt?: string\n}\n\n// ============================================================================\n// SSE Event Types (SSE \u4E8B\u4EF6)\n// ============================================================================\n\nexport type SSEEventType =\n | 'message_start'\n | 'content_delta'\n | 'content_block'\n | 'message_end'\n | 'tool_start'\n | 'tool_end'\n | 'status'\n | 'error'\n | 'done'\n\nexport interface SSEEvent<T = any> {\n event: SSEEventType | null\n data: T\n}\n\n// \u5177\u4F53\u4E8B\u4EF6\u6570\u636E\u7C7B\u578B\nexport interface MessageStartData {\n sessionId: string\n}\n\nexport interface ContentDeltaData {\n text: string\n}\n\nexport interface ContentBlockData {\n type: string\n data: any\n}\n\nexport interface MessageEndData {\n usage: {\n inputTokens: number\n outputTokens: number\n }\n}\n\nexport interface ToolStartData {\n id: string\n type: string\n name: string\n}\n\nexport interface ToolEndData {\n id: string\n}\n\nexport interface StatusData {\n type: string\n message?: string\n}\n\nexport interface ErrorData {\n message: string\n code?: string\n}\n\n// ============================================================================\n// API Request/Response Types (API \u8BF7\u6C42\u54CD\u5E94)\n// ============================================================================\n\n/**\n * \u6D41\u5F0F\u5BF9\u8BDD\u8BF7\u6C42\u53C2\u6570\n */\nexport interface ChatStreamRequest {\n /** \u7528\u6237\u7684\u6D88\u606F\u6587\u672C */\n message: string\n /** \u7528\u6237\u6807\u8BC6\u7B26 */\n user_id: string\n /** \u6765\u81EA new-session \u7AEF\u70B9\u7684\u4F1A\u8BDD ID */\n session_id: string\n /** \u53EF\u9009\u7684\u4E0A\u4E0B\u6587\u4FE1\u606F */\n context?: {\n /** \u7528\u4E8E\u8D2D\u7269\u8F66\u64CD\u4F5C\u7684 Shopify \u8D2D\u7269\u8F66 ID */\n cartId?: string\n /** Storefront API \u8BBF\u95EE\u4EE4\u724C */\n accessToken?: string\n /** \u5DF2\u767B\u5F55\u7528\u6237\u7684 ID */\n real_user_id?: string\n }\n}\n\nexport interface NewSessionRequest {\n user_id: string\n session_id?: string\n site?: string\n real_user_id?: string\n}\n\nexport interface NewSessionResponse {\n success: boolean\n sessionId: string\n message: string\n resumed?: boolean\n messages?: Message[]\n welcomeMessage?: string\n quickQuestions?: string[]\n brand?: string\n}\n\nexport interface ErrorResponse {\n success: boolean\n error: string\n code?: string\n details?: any\n}\n\n// ============================================================================\n// Component Props Types (\u7EC4\u4EF6 Props)\n// ============================================================================\n\nexport interface LiveChatWidgetProps {\n /**\n * API \u57FA\u7840 URL\n * @example \"https://beta-api-livechat.anker.com\"\n */\n apiBaseUrl: string\n\n /**\n * Shopify \u5E97\u94FA\u57DF\u540D\n * @example \"www.eufy.com\"\n */\n site?: string\n\n /**\n * \u5DF2\u767B\u5F55\u7528\u6237\u7684 ID\uFF08\u53EF\u9009\uFF09\n * \u5982\u679C\u63D0\u4F9B\uFF0C\u5C06\u5728 API \u8BF7\u6C42\u4E2D\u4F20\u9012\n */\n loginUserId?: string\n\n /**\n * Shopify \u8D2D\u7269\u8F66 ID\uFF08\u53EF\u9009\uFF09\n * \u7528\u4E8E\u8D2D\u7269\u8F66\u64CD\u4F5C\uFF0C\u5C06\u5728 stream \u63A5\u53E3\u7684 context \u4E2D\u4F20\u9012\n * @example \"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZH...\"\n */\n cartId?: string\n\n /**\n * Storefront API \u8BBF\u95EE\u4EE4\u724C\uFF08\u53EF\u9009\uFF09\n * \u7528\u4E8E\u8D2D\u7269\u8F66\u64CD\u4F5C\uFF0C\u5C06\u5728 stream \u63A5\u53E3\u7684 context \u4E2D\u4F20\u9012\n */\n accessToken?: string\n\n /**\n * \u6C14\u6CE1\u6309\u94AE\u4F4D\u7F6E\n * \u81EA\u5B9A\u4E49\u4F4D\u7F6E\u5BF9\u8C61\uFF1A{ top?: string, bottom?: string, left?: string, right?: string }\n * @default { bottom: \"1.5rem\", right: \"1.5rem\" }\n * @example\n * // \u81EA\u5B9A\u4E49\u4F4D\u7F6E\n * position={{ bottom: \"20px\", right: \"30px\" }}\n * position={{ top: \"100px\", left: \"50px\" }}\n */\n position?: BubblePosition\n\n /**\n * \u6B22\u8FCE\u6D88\u606F\n * @default \"\u4F60\u597D\uFF01\u6211\u662F AI \u52A9\u624B\uFF0C\u6709\u4EC0\u4E48\u53EF\u4EE5\u5E2E\u52A9\u4F60\u7684\u5417\uFF1F\"\n */\n welcomeMessage?: string\n\n /**\n * \u521D\u59CB\u5FEB\u6377\u56DE\u590D\u6309\u94AE\n */\n quickReplies?: QuickReply[]\n\n /**\n * \u81EA\u5B9A\u4E49\u6D88\u606F\u6E32\u67D3\u5668\n */\n customRenderers?: Record<string, MessageRenderer>\n\n /**\n * Logo URL\n */\n logoUrl?: string\n\n /**\n * \u804A\u5929\u7A97\u53E3\u6807\u9898\n * @default \"AI \u52A9\u624B\"\n */\n title?: string\n\n /**\n * \u804A\u5929\u6C14\u6CE1\u6309\u94AE\u56FE\u6807\uFF08\u56FE\u7247 URL\uFF09\n * \u5982\u679C\u63D0\u4F9B\uFF0C\u5C06\u4F7F\u7528\u56FE\u7247\u66FF\u4EE3\u9ED8\u8BA4\u7684 SVG \u56FE\u6807\n */\n chatBubbleIcon?: string\n\n /**\n * \u4E8B\u4EF6\u56DE\u8C03\n */\n onOpen?: () => void\n onClose?: () => void\n onMessageSend?: (message: string) => void\n onError?: (error: Error) => void\n\n /**\n * \u5546\u54C1\u64CD\u4F5C\u56DE\u8C03\n */\n onAddToCart?: (product: Product) => void\n\n /**\n * \u8D2D\u7269\u8F66\u6309\u94AE\u70B9\u51FB\u56DE\u8C03\n */\n onCart?: (cartId: string, checkoutUrl?: string) => void\n\n /**\n * \u662F\u5426\u663E\u793A\u65B0\u4F1A\u8BDD\u6309\u94AE\n * @default true\n */\n showNewSessionButton?: boolean\n}\n\nexport interface MessageRenderer {\n render: (content: MessageContent, isUser: boolean, isSystem: boolean) => React.ReactNode\n}\n\nexport interface CustomRendererMap {\n [type: string]: MessageRenderer\n}\n\n// ============================================================================\n// Utility Types (\u5DE5\u5177\u7C7B\u578B)\n// ============================================================================\n\nexport interface PositionStyles {\n bottom?: string\n top?: string\n left?: string\n right?: string\n}\n\nexport type BubblePosition = PositionStyles\n"],
4
+ "sourcesContent": ["/**\n * LiveChat \u7EC4\u4EF6\u6838\u5FC3\u7C7B\u578B\u5B9A\u4E49\n * \u57FA\u4E8E specs/livechat-widget/data-model.md\n */\n\n// ============================================================================\n// Session Types (\u4F1A\u8BDD)\n// ============================================================================\n\nexport type SessionStatus = 'active' | 'expired'\n\nexport interface Session {\n sessionId: string\n userId: string\n site: string\n status: SessionStatus\n createdAt?: number\n lastActivityAt?: number\n}\n\n// ============================================================================\n// Message Types (\u6D88\u606F)\n// ============================================================================\n\nexport type MessageRole = 'user' | 'assistant' | 'system' | 'tool'\n\nexport interface MessageMetadata {\n tokenUsage?: {\n inputTokens: number\n outputTokens: number\n }\n toolCalls?: Array<{\n id: string\n type: string\n name: string\n }>\n}\n\nexport interface Message {\n id: string\n sessionId?: string\n role: MessageRole\n content: MessageContent[]\n timestamp: number\n metadata?: MessageMetadata\n structured_content?: Array<{\n type: string\n data: any\n }>\n}\n\n// ============================================================================\n// Message Content Types (\u6D88\u606F\u5185\u5BB9)\n// ============================================================================\n\nexport type MessageContentType =\n | 'text'\n | 'product_card'\n | 'product_list'\n | 'product_comparison'\n | 'policy'\n | 'quick_replies'\n | 'thinking'\n | 'error'\n | 'faq_list'\n | 'cart'\n\nexport type MessageContent =\n | TextContent\n | ProductCardContent\n | ProductListContent\n | ProductComparisonContent\n | PolicyContent\n | QuickRepliesContent\n | ThinkingContent\n | ErrorContent\n | FAQListContent\n | PromotionListContent\n | CartContent\n\nexport interface TextContent {\n type: 'text'\n text: string\n}\n\nexport interface ProductCardContent {\n type: 'product_card'\n data: {\n product?: Product\n rawProduct?: any // Raw backend product data (for custom render)\n productHandle: string // Product ID from placeholder {{product:ID}}, for app-level product lookup\n onAddToCart?: (product: Product) => void\n productCardRender?: (product: any, productHandle: string) => React.ReactNode\n }\n}\n\nexport interface ProductListContent {\n type: 'product_list'\n data: {\n products: Product[]\n title?: string\n onAddToCart?: (product: Product) => void\n commonText?: CommonText\n }\n}\n\nexport interface ProductComparisonContent {\n type: 'product_comparison'\n data: {\n products: Product[]\n dimensions: {\n price?: {\n label: string\n values: Array<{\n product_id: string\n min: number\n max: number\n currency: string\n has_discount: boolean\n }>\n }\n variants?: {\n label: string\n values: Array<{\n product_id: string\n count: number\n }>\n }\n member_price?: {\n label: string\n values: Array<{\n product_id: string\n available: boolean\n min: number\n max: number\n currency: string\n }>\n }\n discount?: {\n label: string\n values: Array<{\n product_id: string\n has_discount: boolean\n }>\n }\n [key: string]: any\n }\n onAddToCart?: (product: Product) => void\n commonText?: CommonText\n }\n}\n\nexport interface PolicyContent {\n type: 'policy'\n data: {\n title: string\n content: string\n }\n}\n\nexport interface QuickRepliesContent {\n type: 'quick_replies'\n data: {\n replies: QuickReply[]\n }\n}\n\nexport interface ThinkingContent {\n type: 'thinking'\n data: {\n status: string\n }\n}\n\nexport interface ErrorContent {\n type: 'error'\n data: {\n message: string\n code?: string\n }\n}\n\nexport interface FAQListContent {\n type: 'faq_list'\n data: {\n found: boolean\n count: number\n total?: number\n results: FAQItem[]\n }\n}\n\nexport interface PromotionListContent {\n type: 'promotion_list'\n data: {\n found: boolean\n count: number\n total?: number\n results: PromotionItem[]\n commonText?: CommonText\n }\n}\n\n// ============================================================================\n// FAQ Types (\u5E38\u89C1\u95EE\u9898)\n// ============================================================================\n\nexport type FAQCategory = 'shipping' | 'return' | 'product' | 'payment' | 'general'\n\nexport interface FAQItem {\n id: string\n question: string\n answer: string\n category: FAQCategory\n keywords?: string[]\n relatedQuestions?: string[]\n metadata?: {\n language?: string\n priority?: number\n lastUpdated?: string\n }\n}\n\n// ============================================================================\n// Promotion Types (\u4FC3\u9500\u6D3B\u52A8)\n// ============================================================================\n\nexport interface PromotionItem {\n id: string\n title: string\n subtitle?: string\n description?: string\n banner_url?: string\n url?: string\n time_range: {\n start: string\n end?: string | null\n is_active: boolean\n }\n priority?: number\n product_count?: number\n metadata?: {\n display_order?: number\n target_audience?: string\n }\n}\n\n// ============================================================================\n// Product Types (\u5546\u54C1)\n// ============================================================================\n\nexport type StockStatus = 'in_stock' | 'low_stock' | 'out_of_stock'\n\nexport interface Price {\n amount: number\n currency: string\n}\n\nexport interface PriceRange {\n min: number\n max: number\n currency: string\n}\n\nexport interface VariantDiscount {\n has_discount: boolean\n discount_price?: number\n discount_code?: string\n discount_percentage?: number\n /** \u6298\u6263\u7C7B\u578B\uFF1Afixed_amount \u56FA\u5B9A\u91D1\u989D\u6298\u6263\uFF0Cpercentage \u767E\u5206\u6BD4\u6298\u6263 */\n discount_type?: 'fixed_amount' | 'percentage'\n /** \u6298\u6263\u6570\u503C\uFF08\u53EF\u80FD\u662F\u5B57\u7B26\u4E32\u6216\u6570\u5B57\uFF09 */\n discount_value?: string | number\n}\n\nexport interface VariantMemberPrice {\n has_member_price: boolean\n price?: number\n}\n\nexport interface ProductFeatures {\n is_new?: boolean\n has_rental?: boolean\n has_presale?: boolean\n has_member_price?: boolean\n has_discount?: boolean\n}\n\nexport interface Variant {\n id: string\n title: string\n sku?: string\n price?: Price\n availableForSale: boolean\n color?: string\n discount?: VariantDiscount\n memberPrice?: VariantMemberPrice\n inventoryQuantity?: number\n option1?: string\n option2?: string\n option3?: string\n}\n\nexport interface Product {\n shopifyId: string\n sku?: string\n handle: string\n title: string\n description?: string\n vendor?: string\n price: Price\n priceRange?: PriceRange\n memberPriceRange?: PriceRange\n imageUrl: string\n productUrl: string\n stockStatus: StockStatus\n hotScore?: number\n averageRating?: number\n reviewCount?: number\n variants?: Variant[]\n variantCount?: number\n availableCount?: number\n features?: ProductFeatures\n tags?: string[]\n}\n\n// ============================================================================\n// Quick Reply Types (\u5FEB\u6377\u56DE\u590D)\n// ============================================================================\n\nexport interface QuickReply {\n id: string\n label: string\n value: string\n icon?: string\n}\n\n// ============================================================================\n// Policy Types (\u653F\u7B56)\n// ============================================================================\n\nexport interface Policy {\n title: string\n content: string\n}\n\n// ============================================================================\n// Cart Types (\u8D2D\u7269\u8F66)\n// ============================================================================\n\n/**\n * \u8D2D\u7269\u8F66\u91D1\u989D\u4FE1\u606F\n */\nexport interface CartAmount {\n /** \u91D1\u989D\u5B57\u7B26\u4E32\uFF08\u5982 \"99.99\"\uFF09 */\n amount: string\n /** \u8D27\u5E01\u4EE3\u7801\uFF08\u5982 \"USD\"\uFF09 */\n currencyCode: string\n}\n\n/**\n * \u8D2D\u7269\u8F66\u4EF7\u683C\u6C47\u603B\n */\nexport interface CartCost {\n /** \u5E94\u4ED8\u603B\u4EF7\uFF08\u5DF2\u5E94\u7528\u6298\u6263\uFF09 */\n totalAmount: CartAmount\n /** \u539F\u4EF7\u5C0F\u8BA1\uFF08\u672A\u5E94\u7528\u6298\u6263\uFF09 */\n subtotalAmount: CartAmount\n}\n\n/**\n * \u8D2D\u7269\u8F66\u5546\u54C1\u53D8\u4F53\u4FE1\u606F\n */\nexport interface CartMerchandise {\n /** \u53D8\u4F53 ID (Shopify ProductVariant GID) */\n id: string\n /** \u53D8\u4F53\u6807\u9898\uFF08\u5982 \"Black\", \"Large\" \u7B49\uFF09 */\n title: string\n /** \u5355\u4EF7 */\n price: CartAmount\n /** \u5546\u54C1\u56FE\u7247 URL */\n image?: {\n url: string\n altText?: string\n }\n /** \u5173\u8054\u7684\u5546\u54C1\u4FE1\u606F */\n product: {\n /** \u5546\u54C1 ID */\n id: string\n /** \u5546\u54C1\u6807\u9898 */\n title: string\n /** \u5546\u54C1 handle */\n handle: string\n }\n}\n\n/**\n * \u8D2D\u7269\u8F66\u5546\u54C1\u884C\n */\nexport interface CartLine {\n /** \u8D2D\u7269\u8F66\u884C ID (\u7528\u4E8E\u66F4\u65B0/\u5220\u9664\u64CD\u4F5C) */\n id: string\n /** \u5546\u54C1\u6570\u91CF */\n quantity: number\n /** \u4EF7\u683C\u4FE1\u606F */\n cost: {\n /** \u884C\u603B\u4EF7\uFF08\u5355\u4EF7 \u00D7 \u6570\u91CF\uFF0C\u5DF2\u5E94\u7528\u6298\u6263\uFF09 */\n totalAmount: CartAmount\n /** \u5355\u4EF7 */\n amountPerQuantity: CartAmount\n /** \u884C\u5C0F\u8BA1\uFF08\u5355\u4EF7 \u00D7 \u6570\u91CF\uFF0C\u672A\u5E94\u7528\u6298\u6263\uFF09 */\n subtotalAmount: CartAmount\n }\n /** \u5546\u54C1\u53D8\u4F53\u4FE1\u606F */\n merchandise: CartMerchandise\n /** \u81EA\u5B9A\u4E49\u5C5E\u6027\uFF08\u53EF\u9009\uFF09 */\n attributes?: Array<{\n key: string\n value: string\n }>\n}\n\n/**\n * \u8D2D\u7269\u8F66\u6298\u6263\u7801\n */\nexport interface CartDiscountCode {\n /** \u6298\u6263\u7801 */\n code: string\n /** \u662F\u5426\u6709\u6548/\u9002\u7528 */\n applicable: boolean\n}\n\n/**\n * \u8D2D\u7269\u8F66\u6570\u636E\n */\nexport interface CartData {\n /** \u8D2D\u7269\u8F66\u662F\u5426\u4E3A\u7A7A */\n isEmpty: boolean\n /** \u8D2D\u7269\u8F66 ID (Shopify Cart GID) */\n cartId: string\n /** \u5546\u54C1\u603B\u6570\u91CF */\n totalQuantity: number\n /** \u5546\u54C1\u5217\u8868 */\n lines: CartLine[]\n /** \u4EF7\u683C\u6C47\u603B */\n cost: CartCost\n /** \u6298\u6263\u7801\u5217\u8868 */\n discountCodes?: CartDiscountCode[]\n /** \u7ED3\u8D26\u9875\u9762 URL */\n checkoutUrl?: string\n /** \u8D2D\u7269\u8F66\u6309\u94AE\u56DE\u8C03\u51FD\u6570 */\n onCart?: (cartId: string, checkoutUrl?: string) => void\n /** \u901A\u7528\u6587\u6848\u914D\u7F6E */\n commonText?: CommonText\n}\n\n/**\n * \u8D2D\u7269\u8F66\u5185\u5BB9\u5757\n */\nexport interface CartContent {\n type: 'cart'\n data: CartData\n}\n\n// ============================================================================\n// Backend Cart Types (\u540E\u7AEF\u8D2D\u7269\u8F66\u6570\u636E\u683C\u5F0F - Shopify GraphQL)\n// ============================================================================\n\n/**\n * \u540E\u7AEF\u8FD4\u56DE\u7684\u8D2D\u7269\u8F66\u5546\u54C1\u884C\u6570\u636E (Shopify GraphQL \u683C\u5F0F)\n */\nexport interface BackendCartLineNode {\n id: string\n quantity: number\n cost: {\n totalAmount: CartAmount\n amountPerQuantity: CartAmount\n compareAtAmountPerQuantity?: CartAmount | null\n subtotalAmount: CartAmount\n }\n discountAllocations: any[]\n merchandise: {\n id: string\n title: string\n availableForSale: boolean\n quantityAvailable?: number\n price: CartAmount\n compareAtPrice?: CartAmount | null\n image?: {\n url: string\n altText?: string | null\n width?: number\n height?: number\n } | null\n product: {\n id: string\n title: string\n handle: string\n vendor?: string\n featuredImage?: {\n url: string\n altText?: string | null\n width?: number\n height?: number\n } | null\n tags?: string[]\n }\n }\n attributes?: Array<{\n key: string\n value: string\n }>\n}\n\n/**\n * \u540E\u7AEF\u8FD4\u56DE\u7684\u8D2D\u7269\u8F66\u6570\u636E (Shopify GraphQL \u683C\u5F0F)\n */\nexport interface BackendCartData {\n id: string\n checkoutUrl?: string\n totalQuantity: number\n lines: {\n edges: Array<{\n node: BackendCartLineNode\n }>\n }\n cost: {\n totalAmount: CartAmount\n subtotalAmount: CartAmount\n checkoutChargeAmount?: CartAmount\n totalAmountEstimated?: boolean\n subtotalAmountEstimated?: boolean\n totalTaxAmount?: CartAmount | null\n totalDutyAmount?: CartAmount | null\n }\n discountAllocations?: any[]\n buyerIdentity?: any\n attributes?: Array<{\n key: string\n value: string\n }>\n discountCodes?: any[]\n createdAt?: string\n updatedAt?: string\n}\n\n// ============================================================================\n// SSE Event Types (SSE \u4E8B\u4EF6)\n// ============================================================================\n\nexport type SSEEventType =\n | 'message_start'\n | 'content_delta'\n | 'content_block'\n | 'message_end'\n | 'tool_start'\n | 'tool_end'\n | 'status'\n | 'error'\n | 'done'\n\nexport interface SSEEvent<T = any> {\n event: SSEEventType | null\n data: T\n}\n\n// \u5177\u4F53\u4E8B\u4EF6\u6570\u636E\u7C7B\u578B\nexport interface MessageStartData {\n sessionId: string\n}\n\nexport interface ContentDeltaData {\n text: string\n}\n\nexport interface ContentBlockData {\n type: string\n data: any\n}\n\nexport interface MessageEndData {\n usage: {\n inputTokens: number\n outputTokens: number\n }\n}\n\nexport interface ToolStartData {\n id: string\n type: string\n name: string\n}\n\nexport interface ToolEndData {\n id: string\n}\n\nexport interface StatusData {\n type: string\n message?: string\n}\n\nexport interface ErrorData {\n message: string\n code?: string\n type?: string\n}\n\n// ============================================================================\n// API Request/Response Types (API \u8BF7\u6C42\u54CD\u5E94)\n// ============================================================================\n\n/**\n * \u6D41\u5F0F\u5BF9\u8BDD\u8BF7\u6C42\u53C2\u6570\n */\nexport interface ChatStreamRequest {\n /** \u7528\u6237\u7684\u6D88\u606F\u6587\u672C */\n message: string\n /** \u7528\u6237\u6807\u8BC6\u7B26 */\n user_id: string\n /** \u6765\u81EA new-session \u7AEF\u70B9\u7684\u4F1A\u8BDD ID */\n session_id: string\n /** \u53EF\u9009\u7684\u4E0A\u4E0B\u6587\u4FE1\u606F */\n context?: {\n /** \u7528\u4E8E\u8D2D\u7269\u8F66\u64CD\u4F5C\u7684 Shopify \u8D2D\u7269\u8F66 ID */\n cartId?: string\n /** Storefront API \u8BBF\u95EE\u4EE4\u724C */\n accessToken?: string\n /** \u5DF2\u767B\u5F55\u7528\u6237\u7684 ID */\n real_user_id?: string\n }\n}\n\nexport interface NewSessionRequest {\n user_id: string\n session_id?: string\n site?: string\n channel_code?: string\n real_user_id?: string\n}\n\nexport interface NewSessionResponse {\n success: boolean\n sessionId: string\n message: string\n resumed?: boolean\n messages?: Message[]\n welcomeMessage?: string\n quickQuestions?: string[]\n brand?: string\n}\n\nexport interface ErrorResponse {\n success: boolean\n error: string\n code?: string\n details?: any\n}\n\n// ============================================================================\n// Common Text Types (\u901A\u7528\u6587\u6848)\n// ============================================================================\n\n/**\n * \u901A\u7528\u6587\u6848\u914D\u7F6E\n * \u7528\u4E8E\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u4E2D\u7684\u6309\u94AE\u6587\u6848\n */\nexport interface CommonText {\n /**\n * \u4EA7\u54C1\u5217\u8868\u5C55\u5F00\u6309\u94AE\u6587\u6848\n * @default \"Learn More\"\n */\n learnMore?: string\n\n /**\n * \u4EA7\u54C1\u5217\u8868\u6536\u8D77\u6309\u94AE\u6587\u6848\n * @default \"Show Less\"\n */\n showLess?: string\n\n /**\n * \u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\u6309\u94AE\u6587\u6848\n * @default \"Add to Cart\"\n */\n addToCart?: string\n\n /**\n * \u67E5\u770B\u8D2D\u7269\u8F66/\u66F4\u591A\u6309\u94AE\u6587\u6848\n * @default \"View More\"\n */\n viewMore?: string\n\n /**\n * \u6298\u6263\u6807\u7B7E\u540E\u7F00\u6587\u6848\uFF08\u5982 \"20% OFF\" \u4E2D\u7684 \"OFF\"\uFF09\n * @default \"OFF\"\n */\n off?: string\n\n /**\n * \u8D2D\u7269\u8F66\u603B\u8BA1\u6587\u6848\n * @default \"Total\"\n */\n total?: string\n}\n\n// ============================================================================\n// Compliance Dialog Types (\u6CD5\u89C4\u534F\u8BAE\u5F39\u7A97)\n// ============================================================================\n\n/**\n * \u6CD5\u89C4\u534F\u8BAE\u5F39\u7A97\u914D\u7F6E\n */\nexport interface ComplianceDialogConfig {\n /**\n * \u5F39\u7A97\u6807\u9898\n * @example \"Hi! I'm your eufy AI assistant.\"\n */\n title: string\n\n /**\n * \u5F39\u7A97\u5185\u5BB9\u6587\u672C\uFF08\u652F\u6301 HTML\uFF09\n * @example \"AI-generated responses can be inaccurate. Please verify important info. Do not input sensitive personal data\"\n */\n content: string\n\n /**\n * \u52FE\u9009\u6846\u6587\u672C\uFF08\u652F\u6301\u5B8C\u6574 HTML\uFF0C\u5305\u62EC\u94FE\u63A5\uFF09\n * \u53EF\u4EE5\u76F4\u63A5\u5305\u542B <a> \u6807\u7B7E\u7B49 HTML \u5143\u7D20\n * @example \"By starting to use \\\"Live Chat\\\", you agree to Anker's <a href=\\\"https://www.anker.com/privacy\\\" target=\\\"_blank\\\">LIVE CHAT PRIVACY NOTICE</a>.\"\n */\n checkboxText: string\n\n /**\n * \u540C\u610F\u6309\u94AE\u6587\u672C\n * @default \"Agree\"\n */\n agreeButtonText?: string\n\n /**\n * Cookie \u540D\u79F0\uFF0C\u7528\u4E8E\u8BB0\u5F55\u7528\u6237\u540C\u610F\u72B6\u6001\n * Cookie \u6709\u6548\u671F\u4E3A 365 \u5929\n * @default \"livechat_compliance_agreed\"\n */\n cookieName?: string\n}\n\n// ============================================================================\n// Component Props Types (\u7EC4\u4EF6 Props)\n// ============================================================================\n\nexport interface LiveChatWidgetProps {\n /**\n * API \u57FA\u7840 URL\n * @example \"https://beta-api-livechat.anker.com\"\n */\n apiBaseUrl: string\n\n /**\n * \u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\n * \u5C06\u5728\u6240\u6709 API \u8BF7\u6C42\u4E2D\u6DFB\u52A0\u8FD9\u4E9B\u8BF7\u6C42\u5934\n * @example { \"Authorization\": \"Bearer token\", \"X-Custom-Header\": \"value\" }\n */\n headers?: Record<string, string>\n\n /**\n * reCAPTCHA site key\n * \u63D0\u4F9B\u6B64\u53C2\u6570\u5C06\u81EA\u52A8\u542F\u7528 reCAPTCHA v3 \u9A8C\u8BC1\n * @example \"6LfS4J4pAAAAACX1e_WrxutmxxzCK7FU4WzVqL14\"\n */\n recaptchaSitekey?: string\n\n /**\n * reCAPTCHA action \u524D\u7F00\n * \u5B9E\u9645\u4F7F\u7528\u65F6\u4F1A\u6839\u636E\u4E0D\u540C\u63A5\u53E3\u6DFB\u52A0\u540E\u7F00\uFF08\u5982 chat_stream, new_session\uFF09\n * @default \"livechat\"\n */\n recaptchaAction?: string\n\n /**\n * Shopify \u5E97\u94FA\u57DF\u540D\n * @example \"www.eufy.com\"\n */\n site?: string\n\n /**\n * \u6E20\u9053\u7F16\u7801\n * \u7528\u4E8E\u6807\u8BC6\u6765\u6E90\u6E20\u9053\n * @example \"web_homepage\"\n */\n channelCode?: string\n\n /**\n * \u5DF2\u767B\u5F55\u7528\u6237\u7684 ID\uFF08\u53EF\u9009\uFF09\n * \u5982\u679C\u63D0\u4F9B\uFF0C\u5C06\u5728 API \u8BF7\u6C42\u4E2D\u4F20\u9012\n */\n loginUserId?: string\n\n /**\n * Shopify \u8D2D\u7269\u8F66 ID\uFF08\u53EF\u9009\uFF09\n * \u7528\u4E8E\u8D2D\u7269\u8F66\u64CD\u4F5C\uFF0C\u5C06\u5728 stream \u63A5\u53E3\u7684 context \u4E2D\u4F20\u9012\n * @example \"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZH...\"\n */\n cartId?: string\n\n /**\n * Storefront API \u8BBF\u95EE\u4EE4\u724C\uFF08\u53EF\u9009\uFF09\n * \u7528\u4E8E\u8D2D\u7269\u8F66\u64CD\u4F5C\uFF0C\u5C06\u5728 stream \u63A5\u53E3\u7684 context \u4E2D\u4F20\u9012\n */\n accessToken?: string\n\n /**\n * \u6C14\u6CE1\u6309\u94AE\u4F4D\u7F6E\n * \u81EA\u5B9A\u4E49\u4F4D\u7F6E\u5BF9\u8C61\uFF1A{ top?: string, bottom?: string, left?: string, right?: string }\n * @default { bottom: \"1.5rem\", right: \"1.5rem\" }\n * @example\n * // \u81EA\u5B9A\u4E49\u4F4D\u7F6E\n * position={{ bottom: \"20px\", right: \"30px\" }}\n * position={{ top: \"100px\", left: \"50px\" }}\n */\n position?: BubblePosition\n\n /**\n * \u6B22\u8FCE\u6D88\u606F\n */\n welcomeMessage?: string\n\n /**\n * \u521D\u59CB\u5FEB\u6377\u56DE\u590D\u6309\u94AE\n */\n quickReplies?: QuickReply[]\n\n /**\n * \u81EA\u5B9A\u4E49\u6D88\u606F\u6E32\u67D3\u5668\n */\n customRenderers?: Record<string, MessageRenderer>\n\n /**\n * Logo URL\n */\n logoUrl?: string\n\n /**\n * \u804A\u5929\u7A97\u53E3\u6807\u9898\n * @default \"AI \u52A9\u624B\"\n */\n title?: string\n\n /**\n * \u804A\u5929\u6C14\u6CE1\u6309\u94AE\u56FE\u6807\uFF08\u56FE\u7247 URL\uFF09\n * \u5982\u679C\u63D0\u4F9B\uFF0C\u5C06\u4F7F\u7528\u56FE\u7247\u66FF\u4EE3\u9ED8\u8BA4\u7684 SVG \u56FE\u6807\n */\n chatBubbleIcon?: string\n\n /**\n * \u53D7\u63A7\u6A21\u5F0F\uFF1A\u662F\u5426\u6253\u5F00\u804A\u5929\u7A97\u53E3\n * \u63D0\u4F9B\u6B64\u53C2\u6570\u65F6\uFF0C\u7EC4\u4EF6\u5C06\u5904\u4E8E\u53D7\u63A7\u6A21\u5F0F\n * @example\n * ```tsx\n * const [isOpen, setIsOpen] = useState(false)\n * <LiveChatWidget open={isOpen} onOpenChange={setIsOpen} />\n * ```\n */\n open?: boolean\n\n /**\n * \u53D7\u63A7\u6A21\u5F0F\uFF1A\u6253\u5F00/\u5173\u95ED\u72B6\u6001\u53D8\u5316\u56DE\u8C03\n * \u3010\u5FC5\u9700\u3011\u914D\u5408 `open` \u4F7F\u7528\uFF0C\u7528\u4E8E\u540C\u6B65\u72B6\u6001\u5230\u7236\u7EC4\u4EF6\n * \u5F53\u7528\u6237\u70B9\u51FB\u6253\u5F00\u6216\u5173\u95ED\u6309\u94AE\u65F6\u89E6\u53D1\n * @example\n * ```tsx\n * <LiveChatWidget\n * open={isOpen}\n * onOpenChange={setIsOpen} // \u5FC5\u9700\uFF1A\u540C\u6B65\u72B6\u6001\n * />\n * ```\n */\n onOpenChange?: (open: boolean) => void\n\n /**\n * \u3010\u53EF\u9009\u3011\u7A97\u53E3\u6253\u5F00\u4E8B\u4EF6\u76D1\u542C\n * \u7528\u4E8E\u57CB\u70B9\u3001\u65E5\u5FD7\u7B49\u526F\u4F5C\u7528\uFF0C\u4E0D\u5F71\u54CD\u72B6\u6001\u63A7\u5236\n * \u5728 onOpenChange \u4E4B\u540E\u89E6\u53D1\n * @example\n * ```tsx\n * <LiveChatWidget\n * open={isOpen}\n * onOpenChange={setIsOpen}\n * onOpen={() => trackEvent('chat_opened')} // \u53EF\u9009\uFF1A\u57CB\u70B9\n * />\n * ```\n */\n onOpen?: () => void\n\n /**\n * \u3010\u53EF\u9009\u3011\u7A97\u53E3\u5173\u95ED\u4E8B\u4EF6\u76D1\u542C\n * \u7528\u4E8E\u57CB\u70B9\u3001\u65E5\u5FD7\u7B49\u526F\u4F5C\u7528\uFF0C\u4E0D\u5F71\u54CD\u72B6\u6001\u63A7\u5236\n * \u5728 onOpenChange \u4E4B\u540E\u89E6\u53D1\n * @example\n * ```tsx\n * <LiveChatWidget\n * open={isOpen}\n * onOpenChange={setIsOpen}\n * onClose={() => trackEvent('chat_closed')} // \u53EF\u9009\uFF1A\u57CB\u70B9\n * />\n * ```\n */\n onClose?: () => void\n onMessageSend?: (message: string) => void\n onError?: (error: Error) => void\n\n /**\n * AI \u6D88\u606F\u56DE\u8C03\n */\n /**\n * AI \u56DE\u590D\u6587\u672C\u6D88\u606F\u65F6\u89E6\u53D1\n */\n onTextMessage?: () => void\n\n /**\n * AI \u56DE\u590D\u5546\u54C1\u5217\u8868\u5361\u7247\u65F6\u89E6\u53D1\n */\n onProductList?: () => void\n\n /**\n * AI \u56DE\u590D\u4FC3\u9500\u5361\u7247\u65F6\u89E6\u53D1\n */\n onPromotionList?: () => void\n\n /**\n * \u5546\u54C1\u64CD\u4F5C\u56DE\u8C03\n */\n onAddToCart?: (product: Product) => void\n\n /**\n * \u8D2D\u7269\u8F66\u6309\u94AE\u70B9\u51FB\u56DE\u8C03\n */\n onCart?: (cartId: string, checkoutUrl?: string) => void\n\n /**\n * \u662F\u5426\u663E\u793A\u65B0\u4F1A\u8BDD\u6309\u94AE\n * @default true\n */\n showNewSessionButton?: boolean\n\n /**\n * \u901A\u7528\u6587\u6848\u914D\u7F6E\n * \u7528\u4E8E\u81EA\u5B9A\u4E49\u6309\u94AE\u6587\u6848\n */\n commonText?: CommonText\n\n /**\n * \u81EA\u5B9A\u4E49\u4EA7\u54C1\u5361\u7247\u6E32\u67D3\u51FD\u6570\n * \u7528\u4E8E\u81EA\u5B9A\u4E49\u6E32\u67D3 product_card \u7C7B\u578B\u7684\u4EA7\u54C1\u5361\u7247\n * \u5F53\u63D0\u4F9B\u6B64\u51FD\u6570\u65F6\uFF0C\u5C06\u66FF\u4EE3\u9ED8\u8BA4\u7684\u4EA7\u54C1\u5361\u7247\u6E32\u67D3\u903B\u8F91\n * @param product \u539F\u59CB\u540E\u7AEF\u4EA7\u54C1\u6570\u636E\uFF08\u672A\u7ECF\u8F6C\u6362\u7684\u6570\u636E\uFF09\uFF0C\u5982\u679C\u5728 product_list \u4E2D\u627E\u4E0D\u5230\u5219\u4E3A undefined\n * @param productHandle \u6587\u672C\u5360\u4F4D\u7B26\u4E2D\u7684\u4EA7\u54C1 ID\uFF08\u5982 {{product:ID}} \u4E2D\u7684 ID\uFF09\uFF0C\u53EF\u7528\u4E8E\u5E94\u7528\u5C42\u67E5\u8BE2\u4EA7\u54C1\u6570\u636E\n * @returns React \u53EF\u6E32\u67D3\u7684\u5185\u5BB9\n * @example\n * ```tsx\n * <LiveChatWidget\n * productCardRender={(product, productHandle) => {\n * // product \u53EF\u80FD\u4E3A undefined\uFF0C\u6B64\u65F6\u53EF\u7528 productHandle \u67E5\u8BE2\u4EA7\u54C1\n * if (!product) {\n * return <ProductCardByHandle handle={productHandle} />\n * }\n * return (\n * <div>\n * <h3>{product.title}</h3>\n * <p>{product.price_range?.min}</p>\n * </div>\n * )\n * }}\n * />\n * ```\n */\n productCardRender?: (product: any, productHandle: string) => React.ReactNode\n\n /**\n * \u8F93\u5165\u6846\u5E95\u90E8\u63D0\u793A\u6587\u672C\n * \u4E0D\u4F20\u5165\u5219\u4E0D\u663E\u793A\n */\n bottomTips?: string\n\n /**\n * \u6CD5\u89C4\u534F\u8BAE\u5F39\u7A97\u914D\u7F6E\n * \u63D0\u4F9B\u6B64\u53C2\u6570\u5C06\u5728\u7528\u6237\u9996\u6B21\u70B9\u51FB\u804A\u5929\u6C14\u6CE1\u65F6\u663E\u793A\u6CD5\u89C4\u534F\u8BAE\u5F39\u7A97\n * \u7528\u6237\u540C\u610F\u540E\u624D\u4F1A\u6253\u5F00\u804A\u5929\u7A97\u53E3\n */\n complianceConfig?: ComplianceDialogConfig\n}\n\nexport interface MessageRenderer {\n render: (content: MessageContent, isUser: boolean, isSystem: boolean) => React.ReactNode\n}\n\nexport interface CustomRendererMap {\n [type: string]: MessageRenderer\n}\n\n// ============================================================================\n// Utility Types (\u5DE5\u5177\u7C7B\u578B)\n// ============================================================================\n\nexport interface PositionStyles {\n bottom?: string\n top?: string\n left?: string\n right?: string\n}\n\nexport type BubblePosition = PositionStyles\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["types_exports", "__toCommonJS"]
7
7
  }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * LiveChat Fetcher
3
+ * 参照 storefront 的实现,支持 reCAPTCHA
4
+ */
5
+ /**
6
+ * Fetcher 参数
7
+ */
8
+ export interface FetcherOptions {
9
+ url: string;
10
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
11
+ headers?: Record<string, string>;
12
+ body?: any;
13
+ timeout?: number;
14
+ needRecaptcha?: boolean;
15
+ recaptchaSitekey?: string;
16
+ recaptchaAction?: string;
17
+ recaptchaHeaderKey?: string;
18
+ }
19
+ /**
20
+ * Fetcher 函数
21
+ * 支持 reCAPTCHA 和自定义 headers
22
+ */
23
+ export declare const fetcher: ({ url, method, headers, body, timeout, needRecaptcha, recaptchaSitekey, recaptchaAction, recaptchaHeaderKey, }: FetcherOptions) => Promise<Response>;
24
+ /**
25
+ * 扩展 Window 接口以支持 grecaptcha
26
+ */
27
+ declare global {
28
+ interface Window {
29
+ grecaptcha?: {
30
+ execute: (sitekey: string, options: {
31
+ action: string;
32
+ }) => Promise<string>;
33
+ ready: (callback: () => void) => void;
34
+ enterprise?: {
35
+ execute: (sitekey: string, options: {
36
+ action: string;
37
+ }) => Promise<string>;
38
+ ready: (callback: () => void) => void;
39
+ };
40
+ };
41
+ }
42
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of T(e))!y.call(t,i)&&i!==r&&c(t,i,{get:()=>e[i],enumerable:!(n=f(e,i))||n.enumerable});return t};var P=t=>m(c({},"__esModule",{value:!0}),t);var R={};w(R,{fetcher:()=>C});module.exports=P(R);const b=async(t,e)=>{if(typeof window>"u"||!window.grecaptcha?.enterprise?.execute)return console.warn("[LiveChat Fetcher] reCAPTCHA not loaded"),!1;try{return await window.grecaptcha.enterprise.execute(e,{action:t})}catch(r){return console.error("[LiveChat Fetcher] reCAPTCHA execution failed:",r),!1}};async function k(t,e,r="X-Recaptcha-Token"){const n=await b(t,e);return n?{[r]:n}:{}}const C=async({url:t,method:e="POST",headers:r={},body:n,timeout:i=9e4,needRecaptcha:h=!1,recaptchaSitekey:s,recaptchaAction:p="",recaptchaHeaderKey:u="X-Recaptcha-Token"})=>{let d={};h&&(s?d=await k(p,s,u):console.warn("[LiveChat Fetcher] needRecaptcha=true but recaptchaSitekey is missing"));const g=n?JSON.stringify(n):void 0,l=new AbortController;let a;i&&(a=setTimeout(()=>l.abort(),i));try{const o=await fetch(t,{method:e,mode:"cors",headers:{"Content-Type":"application/json",...r,...d},signal:l.signal,...e!=="GET"&&g&&{body:g}});return a&&clearTimeout(a),o}catch(o){throw a&&clearTimeout(a),o}};
2
+ //# sourceMappingURL=fetcher.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/LiveChatWidget/utils/fetcher.ts"],
4
+ "sourcesContent": ["/**\n * LiveChat Fetcher\n * \u53C2\u7167 storefront \u7684\u5B9E\u73B0\uFF0C\u652F\u6301 reCAPTCHA\n */\n\n/**\n * \u6267\u884C Google reCAPTCHA \u9A8C\u8BC1\n */\nconst executeRecaptcha = async (action: string, sitekey: string): Promise<string | false> => {\n if (typeof window === 'undefined' || !window.grecaptcha?.enterprise?.execute) {\n console.warn('[LiveChat Fetcher] reCAPTCHA not loaded')\n return false\n }\n\n try {\n const token = await window.grecaptcha.enterprise.execute(sitekey, { action })\n return token\n } catch (error) {\n console.error('[LiveChat Fetcher] reCAPTCHA execution failed:', error)\n return false\n }\n}\n\n/**\n * \u83B7\u53D6 reCAPTCHA headers\n */\nasync function getRecaptchaHeaders(\n action: string,\n sitekey: string,\n headerKey = 'X-Recaptcha-Token'\n): Promise<Record<string, string>> {\n const recaptchaToken = await executeRecaptcha(action, sitekey)\n if (!recaptchaToken) {\n return {}\n }\n return {\n [headerKey]: recaptchaToken,\n }\n}\n\n/**\n * Fetcher \u53C2\u6570\n */\nexport interface FetcherOptions {\n url: string\n method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'\n headers?: Record<string, string>\n body?: any\n timeout?: number\n needRecaptcha?: boolean\n recaptchaSitekey?: string\n recaptchaAction?: string\n recaptchaHeaderKey?: string\n}\n\n/**\n * Fetcher \u51FD\u6570\n * \u652F\u6301 reCAPTCHA \u548C\u81EA\u5B9A\u4E49 headers\n */\nexport const fetcher = async ({\n url,\n method = 'POST',\n headers = {},\n body,\n timeout = 90000,\n needRecaptcha = false,\n recaptchaSitekey,\n recaptchaAction = '',\n recaptchaHeaderKey = 'X-Recaptcha-Token',\n}: FetcherOptions): Promise<Response> => {\n // \u83B7\u53D6 reCAPTCHA headers\uFF08\u5982\u679C\u9700\u8981\uFF09\n let recaptchaHeaders: Record<string, string> = {}\n if (needRecaptcha) {\n if (!recaptchaSitekey) {\n console.warn('[LiveChat Fetcher] needRecaptcha=true but recaptchaSitekey is missing')\n } else {\n recaptchaHeaders = await getRecaptchaHeaders(recaptchaAction, recaptchaSitekey, recaptchaHeaderKey)\n }\n }\n\n // \u51C6\u5907\u8BF7\u6C42\u4F53\n const bodyData = body ? JSON.stringify(body) : undefined\n\n const controller = new AbortController()\n let timeoutTimer: NodeJS.Timeout | undefined\n if (timeout) {\n timeoutTimer = setTimeout(() => controller.abort(), timeout)\n }\n\n try {\n const response = await fetch(url, {\n method,\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n ...recaptchaHeaders,\n },\n signal: controller.signal,\n ...(method !== 'GET' && bodyData && { body: bodyData }),\n })\n\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n }\n\n return response\n } catch (error) {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n }\n throw error\n }\n}\n\n/**\n * \u6269\u5C55 Window \u63A5\u53E3\u4EE5\u652F\u6301 grecaptcha\n */\n declare global {\n interface Window {\n grecaptcha?: {\n execute: (sitekey: string, options: { action: string }) => Promise<string>\n ready: (callback: () => void) => void\n enterprise?: {\n execute: (sitekey: string, options: { action: string }) =>\n Promise<string>\n ready: (callback: () => void) => void\n }\n }\n }\n }\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAQA,MAAMI,EAAmB,MAAOC,EAAgBC,IAA6C,CAC3F,GAAI,OAAO,OAAW,KAAe,CAAC,OAAO,YAAY,YAAY,QACnE,eAAQ,KAAK,yCAAyC,EAC/C,GAGT,GAAI,CAEF,OADc,MAAM,OAAO,WAAW,WAAW,QAAQA,EAAS,CAAE,OAAAD,CAAO,CAAC,CAE9E,OAASE,EAAO,CACd,eAAQ,MAAM,iDAAkDA,CAAK,EAC9D,EACT,CACF,EAKA,eAAeC,EACbH,EACAC,EACAG,EAAY,oBACqB,CACjC,MAAMC,EAAiB,MAAMN,EAAiBC,EAAQC,CAAO,EAC7D,OAAKI,EAGE,CACL,CAACD,CAAS,EAAGC,CACf,EAJS,CAAC,CAKZ,CAqBO,MAAMR,EAAU,MAAO,CAC5B,IAAAS,EACA,OAAAC,EAAS,OACT,QAAAC,EAAU,CAAC,EACX,KAAAC,EACA,QAAAC,EAAU,IACV,cAAAC,EAAgB,GAChB,iBAAAC,EACA,gBAAAC,EAAkB,GAClB,mBAAAC,EAAqB,mBACvB,IAAyC,CAEvC,IAAIC,EAA2C,CAAC,EAC5CJ,IACGC,EAGHG,EAAmB,MAAMZ,EAAoBU,EAAiBD,EAAkBE,CAAkB,EAFlG,QAAQ,KAAK,uEAAuE,GAOxF,MAAME,EAAWP,EAAO,KAAK,UAAUA,CAAI,EAAI,OAEzCQ,EAAa,IAAI,gBACvB,IAAIC,EACAR,IACFQ,EAAe,WAAW,IAAMD,EAAW,MAAM,EAAGP,CAAO,GAG7D,GAAI,CACF,MAAMS,EAAW,MAAM,MAAMb,EAAK,CAChC,OAAAC,EACA,KAAM,OACN,QAAS,CACP,eAAgB,mBAChB,GAAGC,EACH,GAAGO,CACL,EACA,OAAQE,EAAW,OACnB,GAAIV,IAAW,OAASS,GAAY,CAAE,KAAMA,CAAS,CACvD,CAAC,EAED,OAAIE,GACF,aAAaA,CAAY,EAGpBC,CACT,OAASjB,EAAO,CACd,MAAIgB,GACF,aAAaA,CAAY,EAErBhB,CACR,CACF",
6
+ "names": ["fetcher_exports", "__export", "fetcher", "__toCommonJS", "executeRecaptcha", "action", "sitekey", "error", "getRecaptchaHeaders", "headerKey", "recaptchaToken", "url", "method", "headers", "body", "timeout", "needRecaptcha", "recaptchaSitekey", "recaptchaAction", "recaptchaHeaderKey", "recaptchaHeaders", "bodyData", "controller", "timeoutTimer", "response"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var k=Object.create;var a=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var y=(o,e)=>{for(var r in e)a(o,r,{get:e[r],enumerable:!0})},i=(o,e,r,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!u.call(o,n)&&n!==r&&a(o,n,{get:()=>e[n],enumerable:!(p=M(e,n))||p.enumerable});return o};var m=(o,e,r)=>(r=o!=null?k(f(o)):{},i(e||!o||!o.__esModule?a(r,"default",{value:o,enumerable:!0}):r,o)),C=o=>i(a({},"__esModule",{value:!0}),o);var R={};y(R,{Markdown:()=>h});module.exports=C(R);var t=require("react/jsx-runtime"),s=require("react"),c=m(require("react-markdown")),d=m(require("remark-gfm")),l=m(require("remark-math"));const g=(0,s.memo)(c.default,(o,e)=>o.children===e.children&&o.className===e.className),h=({content:o})=>(0,t.jsx)("div",{className:"copilotKitMarkdown",children:(0,t.jsx)(g,{components:N,remarkPlugins:[d.default,l.default],children:o})}),N={p({children:o}){return(0,t.jsx)("p",{children:o})},a({children:o,...e}){return(0,t.jsx)("a",{style:{color:"blue",textDecoration:"underline"},...e,target:"_blank",rel:"noopener noreferrer",children:o})}};
1
+ "use strict";var l=Object.create;var p=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var y=(o,r)=>{for(var e in r)p(o,e,{get:r[e],enumerable:!0})},i=(o,r,e,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of w(r))!u.call(o,n)&&n!==e&&p(o,n,{get:()=>r[n],enumerable:!(m=M(r,n))||m.enumerable});return o};var a=(o,r,e)=>(e=o!=null?l(f(o)):{},i(r||!o||!o.__esModule?p(e,"default",{value:o,enumerable:!0}):e,o)),C=o=>i(p({},"__esModule",{value:!0}),o);var R={};y(R,{Markdown:()=>h});module.exports=C(R);var t=require("react/jsx-runtime"),s=require("react"),c=a(require("react-markdown")),d=a(require("remark-gfm")),k=a(require("remark-math"));const g=(0,s.memo)(c.default,(o,r)=>o.children===r.children),h=({content:o})=>(0,t.jsx)("div",{className:"copilotKitMarkdown",children:(0,t.jsx)(g,{components:P,remarkPlugins:[d.default,k.default],children:o})}),P={p({children:o}){return(0,t.jsx)("p",{children:o})},a({children:o,...r}){return(0,t.jsx)("a",{style:{color:"blue",textDecoration:"underline"},...r,target:"_blank",rel:"noopener noreferrer",children:o})}};
2
2
  //# sourceMappingURL=markdown.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/chat/markdown.tsx"],
4
- "sourcesContent": ["import { type FC, memo } from 'react'\nimport ReactMarkdown, { type Options, type Components } from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport remarkMath from 'remark-math'\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className\n)\n\ntype MarkdownProps = {\n content: string\n}\n\nexport const Markdown = ({ content }: MarkdownProps) => {\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown components={components} remarkPlugins={[remarkGfm, remarkMath]}>\n {content}\n </MemoizedReactMarkdown>\n </div>\n )\n}\n\nconst components: Components = {\n p({ children }) {\n return <p>{children}</p>\n },\n a({ children, ...props }) {\n return (\n <a style={{ color: 'blue', textDecoration: 'underline' }} {...props} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n )\n },\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAiBM,IAAAI,EAAA,6BAjBNC,EAA8B,iBAC9BC,EAA6D,6BAC7DC,EAAsB,yBACtBC,EAAuB,0BAEvB,MAAMC,KAAqC,QACzC,EAAAC,QACA,CAACC,EAAWC,IAAcD,EAAU,WAAaC,EAAU,UAAYD,EAAU,YAAcC,EAAU,SAC3G,EAMaV,EAAW,CAAC,CAAE,QAAAW,CAAQ,OAE/B,OAAC,OAAI,UAAU,qBACb,mBAACJ,EAAA,CAAsB,WAAYK,EAAY,cAAe,CAAC,EAAAC,QAAW,EAAAC,OAAU,EACjF,SAAAH,EACH,EACF,EAIEC,EAAyB,CAC7B,EAAE,CAAE,SAAAG,CAAS,EAAG,CACd,SAAO,OAAC,KAAG,SAAAA,EAAS,CACtB,EACA,EAAE,CAAE,SAAAA,EAAU,GAAGC,CAAM,EAAG,CACxB,SACE,OAAC,KAAE,MAAO,CAAE,MAAO,OAAQ,eAAgB,WAAY,EAAI,GAAGA,EAAO,OAAO,SAAS,IAAI,sBACtF,SAAAD,EACH,CAEJ,CACF",
4
+ "sourcesContent": ["import { type FC, memo } from 'react'\nimport ReactMarkdown, { type Options, type Components } from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport remarkMath from 'remark-math'\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) => prevProps.children === nextProps.children\n)\n\ntype MarkdownProps = {\n content: string\n}\n\nexport const Markdown = ({ content }: MarkdownProps) => {\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown components={components} remarkPlugins={[remarkGfm, remarkMath]}>\n {content}\n </MemoizedReactMarkdown>\n </div>\n )\n}\n\nconst components: Components = {\n p({ children }) {\n return <p>{children}</p>\n },\n a({ children, ...props }) {\n return (\n <a style={{ color: 'blue', textDecoration: 'underline' }} {...props} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n )\n },\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAiBM,IAAAI,EAAA,6BAjBNC,EAA8B,iBAC9BC,EAA6D,6BAC7DC,EAAsB,yBACtBC,EAAuB,0BAEvB,MAAMC,KAAqC,QACzC,EAAAC,QACA,CAACC,EAAWC,IAAcD,EAAU,WAAaC,EAAU,QAC7D,EAMaV,EAAW,CAAC,CAAE,QAAAW,CAAQ,OAE/B,OAAC,OAAI,UAAU,qBACb,mBAACJ,EAAA,CAAsB,WAAYK,EAAY,cAAe,CAAC,EAAAC,QAAW,EAAAC,OAAU,EACjF,SAAAH,EACH,EACF,EAIEC,EAAyB,CAC7B,EAAE,CAAE,SAAAG,CAAS,EAAG,CACd,SAAO,OAAC,KAAG,SAAAA,EAAS,CACtB,EACA,EAAE,CAAE,SAAAA,EAAU,GAAGC,CAAM,EAAG,CACxB,SACE,OAAC,KAAE,MAAO,CAAE,MAAO,OAAQ,eAAgB,WAAY,EAAI,GAAGA,EAAO,OAAO,SAAS,IAAI,sBACtF,SAAAD,EACH,CAEJ,CACF",
6
6
  "names": ["markdown_exports", "__export", "Markdown", "__toCommonJS", "import_jsx_runtime", "import_react", "import_react_markdown", "import_remark_gfm", "import_remark_math", "MemoizedReactMarkdown", "ReactMarkdown", "prevProps", "nextProps", "content", "components", "remarkGfm", "remarkMath", "children", "props"]
7
7
  }
@@ -1,4 +1,4 @@
1
- "use strict";var I=Object.create;var m=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var N=(t,a)=>{for(var e in a)m(t,e,{get:a[e],enumerable:!0})},o=(t,a,e,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of w(a))!C.call(t,n)&&n!==e&&m(t,n,{get:()=>a[n],enumerable:!(r=f(a,n))||r.enumerable});return t};var $=(t,a,e)=>(e=t!=null?I(v(t)):{},o(a||!t||!t.__esModule?m(e,"default",{value:t,enumerable:!0}):e,t)),B=t=>o(m({},"__esModule",{value:!0}),t);var k={};N(k,{CreditsBanner:()=>j});module.exports=B(k);var i=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),d=$(require("classnames")),p=require("../context/provider");function j({copy:t,id:a}){const{profile:e,openSignInPopup:r,openSignUpPopup:n}=(0,p.useCreditsContext)(),s=e?Object.keys(e).length!==0:!1,c=e?.first_name?e?.first_name+" "+e?.last_name:e?.email?.split("@")[0],g=b=>{b==="primary"?n():r()},h=t.pcImg?.width&&t.pcImg?.height?`${t.pcImg.width} / ${t.pcImg.height}`:"1920 / 804",u=t.laptopImg?.width&&t.laptopImg?.height?`${t.laptopImg.width} / ${t.laptopImg.height}`:"768 / 660",x=t.mobileImg?.width&&t.mobileImg?.height?`${t.mobileImg.width} / ${t.mobileImg.height}`:"390 / 660";return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{id:a,className:" relative w-full",children:[(0,i.jsx)(l.Picture,{className:"credits-banner-image w-full",style:{aspectRatio:h},imgClassName:"object-cover w-full h-full",source:`${t.pcImg?.url}, ${t.laptopImg?.url} 1024, ${t.mobileImg?.url} 768`,alt:t.pcImg?.alt,loading:"eager"}),(0,i.jsx)("style",{children:`
1
+ "use strict";var f=Object.create;var m=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var N=(t,a)=>{for(var e in a)m(t,e,{get:a[e],enumerable:!0})},o=(t,a,e,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of w(a))!C.call(t,n)&&n!==e&&m(t,n,{get:()=>a[n],enumerable:!(r=b(a,n))||r.enumerable});return t};var $=(t,a,e)=>(e=t!=null?f(v(t)):{},o(a||!t||!t.__esModule?m(e,"default",{value:t,enumerable:!0}):e,t)),B=t=>o(m({},"__esModule",{value:!0}),t);var k={};N(k,{CreditsBanner:()=>j});module.exports=B(k);var i=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),d=$(require("classnames")),p=require("../context/provider");function j({copy:t,id:a}){const{profile:e,openSignInPopup:r,openSignUpPopup:n}=(0,p.useCreditsContext)(),s=e?Object.keys(e).length!==0:!1,c=e?.first_name?e?.first_name+" "+e?.last_name:e?.email?.split("@")[0],g=I=>{I==="primary"?n():r()},h=t.pcImg?.width&&t.pcImg?.height?`${t.pcImg.width} / ${t.pcImg.height}`:"1920 / 804",u=t.laptopImg?.width&&t.laptopImg?.height?`${t.laptopImg.width} / ${t.laptopImg.height}`:"768 / 660",x=t.mobileImg?.width&&t.mobileImg?.height?`${t.mobileImg.width} / ${t.mobileImg.height}`:"390 / 660";return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{id:a,className:" relative w-full",children:[(0,i.jsx)(l.Picture,{className:"credits-banner-image w-full",style:{aspectRatio:h},imgClassName:"object-cover w-full h-full",source:`${t.pcImg?.url}, ${t.laptopImg?.url} 1024, ${t.mobileImg?.url} 768`,alt:t.pcImg?.alt,loading:"eager"}),(0,i.jsx)("style",{children:`
2
2
  @media (max-width: 1024px) and (min-width: 768px) {
3
3
  .credits-banner-image {
4
4
  aspect-ratio: ${u} !important;
@@ -9,5 +9,5 @@
9
9
  aspect-ratio: ${x} !important;
10
10
  }
11
11
  }
12
- `}),s&&(0,i.jsx)("div",{className:"absolute inset-0 ",style:{background:"linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)"}}),(0,i.jsx)(l.Container,{className:"l-tablet:h-auto !absolute inset-0 mx-auto grid h-full",asChild:!0,children:(0,i.jsx)("div",{className:"grid grid-cols-12",children:(0,i.jsxs)("div",{className:"l-tablet:col-span-12 l-tablet:justify-start l-tablet:truncate l-tablet:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]",children:[(0,i.jsx)(l.Heading,{as:"h1",className:"text-[48px] font-bold xl-xxl:text-[40px] l-tablet:text-[32px]",html:s?t.login.title?.replace("$name",c||""):t.unLogin.title}),(0,i.jsx)(l.Text,{size:"3",className:"l-tablet:mt-[4px] l-xxl:text-[14px] mt-[16px]",html:s?t.login.description:t.unLogin.description}),!s&&(0,i.jsxs)("div",{className:(0,d.default)("mt-[32px] grid w-fit grid-flow-col gap-[12px] l-tablet:mt-[24px]",s&&"hidden"),children:[(0,i.jsx)(l.Button,{variant:"secondary",size:"lg",onClick:()=>{g("primary")},children:t.joinNow}),(0,i.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>{g("secondary")},children:t.loginIn})]})]})})})]})})}
12
+ `}),s&&(0,i.jsx)("div",{className:"absolute inset-0 ",style:{background:"linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)"}}),(0,i.jsx)(l.Container,{className:"l:h-auto !absolute inset-0 mx-auto grid h-full",asChild:!0,children:(0,i.jsx)("div",{className:"grid grid-cols-12",children:(0,i.jsxs)("div",{className:"l:col-span-12 l:justify-start l:truncate l:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]",children:[(0,i.jsx)(l.Heading,{as:"h1",className:"text-[48px] font-bold xl-xxl:text-[40px] l:text-[32px]",html:s?t.login.title?.replace("$name",c||""):t.unLogin.title}),(0,i.jsx)(l.Text,{size:"3",className:"l:mt-[4px] l-xxl:text-[14px] mt-[16px]",html:s?t.login.description:t.unLogin.description}),!s&&(0,i.jsxs)("div",{className:(0,d.default)("mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]",s&&"hidden"),children:[(0,i.jsx)(l.Button,{variant:"secondary",size:"lg",onClick:()=>{g("primary")},children:t.joinNow}),(0,i.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>{g("secondary")},children:t.loginIn})]})]})})})]})})}
13
13
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/components/credits/creditsBanner/index.tsx"],
4
- "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\n\ntype Img = {\n url: string\n alt: string\n width?: number\n height?: number\n}\nexport type CreditsBannerCopy = {\n pcImg: Img\n laptopImg: Img\n mobileImg: Img\n joinNow: string\n loginIn: string\n login: {\n title: string\n description: string\n }\n unLogin: {\n title: string\n description: string\n }\n}\n\nexport function CreditsBanner({ copy, id }: { copy: CreditsBannerCopy; id?: string }) {\n const { profile, openSignInPopup, openSignUpPopup } = useCreditsContext()\n const isLogin = profile ? Object.keys(profile).length !== 0 : false\n\n const displayName = profile?.first_name\n ? profile?.first_name + ' ' + profile?.last_name\n : profile?.email?.split('@')[0]\n\n const handleButtonClick = (buttonType: 'primary' | 'secondary') => {\n buttonType === 'primary' ? openSignUpPopup() : openSignInPopup()\n }\n\n // \u8BA1\u7B97\u56FE\u7247\u6BD4\u4F8B\uFF0C\u5982\u679C\u6CA1\u6709\u914D\u7F6E\u5219\u4F7F\u7528\u9ED8\u8BA4\u503C\n const pcAspectRatio =\n copy.pcImg?.width && copy.pcImg?.height ? `${copy.pcImg.width} / ${copy.pcImg.height}` : '1920 / 804'\n const laptopAspectRatio =\n copy.laptopImg?.width && copy.laptopImg?.height ? `${copy.laptopImg.width} / ${copy.laptopImg.height}` : '768 / 660'\n const mobileAspectRatio =\n copy.mobileImg?.width && copy.mobileImg?.height ? `${copy.mobileImg.width} / ${copy.mobileImg.height}` : '390 / 660'\n\n return (\n <>\n <div id={id} className=\" relative w-full\">\n <Picture\n className=\"credits-banner-image w-full\"\n style={{\n aspectRatio: pcAspectRatio,\n }}\n imgClassName=\"object-cover w-full h-full\"\n source={`${copy.pcImg?.url}, ${copy.laptopImg?.url} 1024, ${copy.mobileImg?.url} 768`}\n alt={copy.pcImg?.alt}\n loading=\"eager\"\n ></Picture>\n <style>\n {`\n @media (max-width: 1024px) and (min-width: 768px) {\n .credits-banner-image {\n aspect-ratio: ${laptopAspectRatio} !important;\n }\n }\n @media (max-width: 767px) {\n .credits-banner-image {\n aspect-ratio: ${mobileAspectRatio} !important;\n }\n }\n `}\n </style>\n {isLogin && (\n <div\n className=\"absolute inset-0 \"\n style={{\n background: 'linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)',\n }}\n ></div>\n )}\n\n <Container className=\"l-tablet:h-auto !absolute inset-0 mx-auto grid h-full\" asChild>\n <div className=\"grid grid-cols-12\">\n <div className=\"l-tablet:col-span-12 l-tablet:justify-start l-tablet:truncate l-tablet:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]\">\n <Heading\n as=\"h1\"\n className=\"text-[48px] font-bold xl-xxl:text-[40px] l-tablet:text-[32px]\"\n html={isLogin ? copy.login.title?.replace('$name', displayName || '') : copy.unLogin.title}\n ></Heading>\n\n <Text\n size=\"3\"\n className=\"l-tablet:mt-[4px] l-xxl:text-[14px] mt-[16px]\"\n html={isLogin ? copy.login.description : copy.unLogin.description}\n ></Text>\n\n {!isLogin && (\n <div\n className={classNames(\n 'mt-[32px] grid w-fit grid-flow-col gap-[12px] l-tablet:mt-[24px]',\n isLogin && 'hidden'\n )}\n >\n <Button\n variant=\"secondary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('primary')\n }}\n >\n {copy.joinNow}\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('secondary')\n }}\n >\n {copy.loginIn}\n </Button>\n </div>\n )}\n </div>\n </div>\n </Container>\n </div>\n </>\n )\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GA+CI,IAAAI,EAAA,6BA/CJC,EAA0D,iCAC1DC,EAAuB,yBACvBC,EAAkC,+BAwB3B,SAASL,EAAc,CAAE,KAAAM,EAAM,GAAAC,CAAG,EAA6C,CACpF,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,gBAAAC,CAAgB,KAAI,qBAAkB,EAClEC,EAAUH,EAAU,OAAO,KAAKA,CAAO,EAAE,SAAW,EAAI,GAExDI,EAAcJ,GAAS,WACzBA,GAAS,WAAa,IAAMA,GAAS,UACrCA,GAAS,OAAO,MAAM,GAAG,EAAE,CAAC,EAE1BK,EAAqBC,GAAwC,CACjEA,IAAe,UAAYJ,EAAgB,EAAID,EAAgB,CACjE,EAGMM,EACJT,EAAK,OAAO,OAASA,EAAK,OAAO,OAAS,GAAGA,EAAK,MAAM,KAAK,MAAMA,EAAK,MAAM,MAAM,GAAK,aACrFU,EACJV,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YACrGW,EACJX,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YAE3G,SACE,mBACE,oBAAC,OAAI,GAAIC,EAAI,UAAU,mBACrB,oBAAC,WACC,UAAU,8BACV,MAAO,CACL,YAAaQ,CACf,EACA,aAAa,6BACb,OAAQ,GAAGT,EAAK,OAAO,GAAG,KAAKA,EAAK,WAAW,GAAG,UAAUA,EAAK,WAAW,GAAG,OAC/E,IAAKA,EAAK,OAAO,IACjB,QAAQ,QACT,KACD,OAAC,SACE;AAAA;AAAA;AAAA,gCAGqBU,CAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,gCAKjBC,CAAiB;AAAA;AAAA;AAAA,YAIzC,EACCN,MACC,OAAC,OACC,UAAU,oBACV,MAAO,CACL,WAAY,sEACd,EACD,KAGH,OAAC,aAAU,UAAU,wDAAwD,QAAO,GAClF,mBAAC,OAAI,UAAU,oBACb,oBAAC,OAAI,UAAU,iJACb,oBAAC,WACC,GAAG,KACH,UAAU,gEACV,KAAMA,EAAUL,EAAK,MAAM,OAAO,QAAQ,QAASM,GAAe,EAAE,EAAIN,EAAK,QAAQ,MACtF,KAED,OAAC,QACC,KAAK,IACL,UAAU,gDACV,KAAMK,EAAUL,EAAK,MAAM,YAAcA,EAAK,QAAQ,YACvD,EAEA,CAACK,MACA,QAAC,OACC,aAAW,EAAAO,SACT,mEACAP,GAAW,QACb,EAEA,oBAAC,UACC,QAAQ,YACR,KAAK,KACL,QAAS,IAAM,CACbE,EAAkB,SAAS,CAC7B,EAEC,SAAAP,EAAK,QACR,KACA,OAAC,UACC,QAAQ,UACR,KAAK,KACL,QAAS,IAAM,CACbO,EAAkB,WAAW,CAC/B,EAEC,SAAAP,EAAK,QACR,GACF,GAEJ,EACF,EACF,GACF,EACF,CAEJ",
4
+ "sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\n\ntype Img = {\n url: string\n alt: string\n width?: number\n height?: number\n}\nexport type CreditsBannerCopy = {\n pcImg: Img\n laptopImg: Img\n mobileImg: Img\n joinNow: string\n loginIn: string\n login: {\n title: string\n description: string\n }\n unLogin: {\n title: string\n description: string\n }\n}\n\nexport function CreditsBanner({ copy, id }: { copy: CreditsBannerCopy; id?: string }) {\n const { profile, openSignInPopup, openSignUpPopup } = useCreditsContext()\n const isLogin = profile ? Object.keys(profile).length !== 0 : false\n\n const displayName = profile?.first_name\n ? profile?.first_name + ' ' + profile?.last_name\n : profile?.email?.split('@')[0]\n\n const handleButtonClick = (buttonType: 'primary' | 'secondary') => {\n buttonType === 'primary' ? openSignUpPopup() : openSignInPopup()\n }\n\n // \u8BA1\u7B97\u56FE\u7247\u6BD4\u4F8B\uFF0C\u5982\u679C\u6CA1\u6709\u914D\u7F6E\u5219\u4F7F\u7528\u9ED8\u8BA4\u503C\n const pcAspectRatio =\n copy.pcImg?.width && copy.pcImg?.height ? `${copy.pcImg.width} / ${copy.pcImg.height}` : '1920 / 804'\n const laptopAspectRatio =\n copy.laptopImg?.width && copy.laptopImg?.height ? `${copy.laptopImg.width} / ${copy.laptopImg.height}` : '768 / 660'\n const mobileAspectRatio =\n copy.mobileImg?.width && copy.mobileImg?.height ? `${copy.mobileImg.width} / ${copy.mobileImg.height}` : '390 / 660'\n\n return (\n <>\n <div id={id} className=\" relative w-full\">\n <Picture\n className=\"credits-banner-image w-full\"\n style={{\n aspectRatio: pcAspectRatio,\n }}\n imgClassName=\"object-cover w-full h-full\"\n source={`${copy.pcImg?.url}, ${copy.laptopImg?.url} 1024, ${copy.mobileImg?.url} 768`}\n alt={copy.pcImg?.alt}\n loading=\"eager\"\n ></Picture>\n <style>\n {`\n @media (max-width: 1024px) and (min-width: 768px) {\n .credits-banner-image {\n aspect-ratio: ${laptopAspectRatio} !important;\n }\n }\n @media (max-width: 767px) {\n .credits-banner-image {\n aspect-ratio: ${mobileAspectRatio} !important;\n }\n }\n `}\n </style>\n {isLogin && (\n <div\n className=\"absolute inset-0 \"\n style={{\n background: 'linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)',\n }}\n ></div>\n )}\n\n <Container className=\"l:h-auto !absolute inset-0 mx-auto grid h-full\" asChild>\n <div className=\"grid grid-cols-12\">\n <div className=\"l:col-span-12 l:justify-start l:truncate l:pt-[32px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]\">\n <Heading\n as=\"h1\"\n className=\"text-[48px] font-bold xl-xxl:text-[40px] l:text-[32px]\"\n html={isLogin ? copy.login.title?.replace('$name', displayName || '') : copy.unLogin.title}\n ></Heading>\n\n <Text\n size=\"3\"\n className=\"l:mt-[4px] l-xxl:text-[14px] mt-[16px]\"\n html={isLogin ? copy.login.description : copy.unLogin.description}\n ></Text>\n\n {!isLogin && (\n <div\n className={classNames(\n 'mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]',\n isLogin && 'hidden'\n )}\n >\n <Button\n variant=\"secondary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('primary')\n }}\n >\n {copy.joinNow}\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n onClick={() => {\n handleButtonClick('secondary')\n }}\n >\n {copy.loginIn}\n </Button>\n </div>\n )}\n </div>\n </div>\n </Container>\n </div>\n </>\n )\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GA+CI,IAAAI,EAAA,6BA/CJC,EAA0D,iCAC1DC,EAAuB,yBACvBC,EAAkC,+BAwB3B,SAASL,EAAc,CAAE,KAAAM,EAAM,GAAAC,CAAG,EAA6C,CACpF,KAAM,CAAE,QAAAC,EAAS,gBAAAC,EAAiB,gBAAAC,CAAgB,KAAI,qBAAkB,EAClEC,EAAUH,EAAU,OAAO,KAAKA,CAAO,EAAE,SAAW,EAAI,GAExDI,EAAcJ,GAAS,WACzBA,GAAS,WAAa,IAAMA,GAAS,UACrCA,GAAS,OAAO,MAAM,GAAG,EAAE,CAAC,EAE1BK,EAAqBC,GAAwC,CACjEA,IAAe,UAAYJ,EAAgB,EAAID,EAAgB,CACjE,EAGMM,EACJT,EAAK,OAAO,OAASA,EAAK,OAAO,OAAS,GAAGA,EAAK,MAAM,KAAK,MAAMA,EAAK,MAAM,MAAM,GAAK,aACrFU,EACJV,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YACrGW,EACJX,EAAK,WAAW,OAASA,EAAK,WAAW,OAAS,GAAGA,EAAK,UAAU,KAAK,MAAMA,EAAK,UAAU,MAAM,GAAK,YAE3G,SACE,mBACE,oBAAC,OAAI,GAAIC,EAAI,UAAU,mBACrB,oBAAC,WACC,UAAU,8BACV,MAAO,CACL,YAAaQ,CACf,EACA,aAAa,6BACb,OAAQ,GAAGT,EAAK,OAAO,GAAG,KAAKA,EAAK,WAAW,GAAG,UAAUA,EAAK,WAAW,GAAG,OAC/E,IAAKA,EAAK,OAAO,IACjB,QAAQ,QACT,KACD,OAAC,SACE;AAAA;AAAA;AAAA,gCAGqBU,CAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,gCAKjBC,CAAiB;AAAA;AAAA;AAAA,YAIzC,EACCN,MACC,OAAC,OACC,UAAU,oBACV,MAAO,CACL,WAAY,sEACd,EACD,KAGH,OAAC,aAAU,UAAU,iDAAiD,QAAO,GAC3E,mBAAC,OAAI,UAAU,oBACb,oBAAC,OAAI,UAAU,qHACb,oBAAC,WACC,GAAG,KACH,UAAU,yDACV,KAAMA,EAAUL,EAAK,MAAM,OAAO,QAAQ,QAASM,GAAe,EAAE,EAAIN,EAAK,QAAQ,MACtF,KAED,OAAC,QACC,KAAK,IACL,UAAU,yCACV,KAAMK,EAAUL,EAAK,MAAM,YAAcA,EAAK,QAAQ,YACvD,EAEA,CAACK,MACA,QAAC,OACC,aAAW,EAAAO,SACT,4DACAP,GAAW,QACb,EAEA,oBAAC,UACC,QAAQ,YACR,KAAK,KACL,QAAS,IAAM,CACbE,EAAkB,SAAS,CAC7B,EAEC,SAAAP,EAAK,QACR,KACA,OAAC,UACC,QAAQ,UACR,KAAK,KACL,QAAS,IAAM,CACbO,EAAkB,WAAW,CAC/B,EAEC,SAAAP,EAAK,QACR,GACF,GAEJ,EACF,EACF,GACF,EACF,CAEJ",
6
6
  "names": ["creditsBanner_exports", "__export", "CreditsBanner", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_provider", "copy", "id", "profile", "openSignInPopup", "openSignUpPopup", "isLogin", "displayName", "handleButtonClick", "buttonType", "pcAspectRatio", "laptopAspectRatio", "mobileAspectRatio", "classNames"]
7
7
  }
@@ -2,3 +2,5 @@ export { default as Chat } from './chat/index';
2
2
  export { Role, ActionExecutionMessage, TextMessage, useCopilotChat, useCopilotAction, useCopilotReadable, } from './chat/utils';
3
3
  export * from './credits/index.js';
4
4
  export * from './registration/index.js';
5
+ export { LiveChatWidget } from './LiveChatWidget/index.js';
6
+ export type { LiveChatWidgetProps, Message, MessageContent, MessageRole, MessageContentType, MessageMetadata, MessageRenderer, QuickReply, ProductCardContent, ProductListContent, PolicyContent, QuickRepliesContent, ThinkingContent, ErrorContent, SSEEvent, ChatStreamRequest, } from './LiveChatWidget/index.js';
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.create;var l=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty;var d=(o,e)=>{for(var a in e)l(o,a,{get:e[a],enumerable:!0})},i=(o,e,a,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of m(e))!n.call(o,p)&&p!==a&&l(o,p,{get:()=>e[p],enumerable:!(x=C(e,p))||x.enumerable});return o},s=(o,e,a)=>(i(o,e,"default"),a&&i(a,e,"default")),g=(o,e,a)=>(a=o!=null?u(c(o)):{},i(e||!o||!o.__esModule?l(a,"default",{value:o,enumerable:!0}):a,o)),h=o=>i(l({},"__esModule",{value:!0}),o);var r={};d(r,{ActionExecutionMessage:()=>t.ActionExecutionMessage,Chat:()=>f.default,Role:()=>t.Role,TextMessage:()=>t.TextMessage,useCopilotAction:()=>t.useCopilotAction,useCopilotChat:()=>t.useCopilotChat,useCopilotReadable:()=>t.useCopilotReadable});module.exports=h(r);var f=g(require("./chat/index")),t=require("./chat/utils");s(r,require("./credits/index.js"),module.exports);s(r,require("./registration/index.js"),module.exports);
1
+ "use strict";var l=Object.create;var C=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var s in t)C(e,s,{get:t[s],enumerable:!0})},i=(e,t,s,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of x(t))!c.call(e,r)&&r!==s&&C(e,r,{get:()=>t[r],enumerable:!(p=u(t,r))||p.enumerable});return e},a=(e,t,s)=>(i(e,t,"default"),s&&i(s,t,"default")),h=(e,t,s)=>(s=e!=null?l(M(e)):{},i(t||!e||!e.__esModule?C(s,"default",{value:e,enumerable:!0}):s,e)),m=e=>i(C({},"__esModule",{value:!0}),e);var n={};f(n,{ActionExecutionMessage:()=>o.ActionExecutionMessage,Chat:()=>g.default,LiveChatWidget:()=>d.LiveChatWidget,Role:()=>o.Role,TextMessage:()=>o.TextMessage,useCopilotAction:()=>o.useCopilotAction,useCopilotChat:()=>o.useCopilotChat,useCopilotReadable:()=>o.useCopilotReadable});module.exports=m(n);var g=h(require("./chat/index")),o=require("./chat/utils");a(n,require("./credits/index.js"),module.exports);a(n,require("./registration/index.js"),module.exports);var d=require("./LiveChatWidget/index.js");
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/index.ts"],
4
- "sourcesContent": ["export { default as Chat } from './chat/index'\n\nexport {\n Role,\n ActionExecutionMessage,\n TextMessage,\n useCopilotChat,\n useCopilotAction,\n useCopilotReadable,\n} from './chat/utils'\n\nexport * from './credits/index.js'\n\nexport * from './registration/index.js'\n"],
5
- "mappings": "wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+PAAAE,EAAAF,GAAA,IAAAG,EAAgC,2BAEhCC,EAOO,wBAEPC,EAAAL,EAAc,8BAXd,gBAaAK,EAAAL,EAAc,mCAbd",
6
- "names": ["components_exports", "__export", "__toCommonJS", "import_chat", "import_utils", "__reExport"]
4
+ "sourcesContent": ["export { default as Chat } from './chat/index'\n\nexport {\n Role,\n ActionExecutionMessage,\n TextMessage,\n useCopilotChat,\n useCopilotAction,\n useCopilotReadable,\n} from './chat/utils'\n\nexport * from './credits/index.js'\n\nexport * from './registration/index.js'\n\n\n\n// LiveChatWidget \u5BFC\u51FA\nexport { LiveChatWidget } from './LiveChatWidget/index.js'\nexport type {\n LiveChatWidgetProps,\n Message,\n MessageContent,\n MessageRole,\n MessageContentType,\n MessageMetadata,\n MessageRenderer,\n QuickReply,\n ProductCardContent,\n ProductListContent,\n PolicyContent,\n QuickRepliesContent,\n ThinkingContent,\n ErrorContent,\n SSEEvent,\n ChatStreamRequest,\n} from './LiveChatWidget/index.js'\n"],
5
+ "mappings": "wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mSAAAE,EAAAF,GAAA,IAAAG,EAAgC,2BAEhCC,EAOO,wBAEPC,EAAAL,EAAc,8BAXd,gBAaAK,EAAAL,EAAc,mCAbd,gBAkBA,IAAAM,EAA+B",
6
+ "names": ["components_exports", "__export", "__toCommonJS", "import_chat", "import_utils", "__reExport", "import_LiveChatWidget"]
7
7
  }
@@ -9,84 +9,6 @@ declare const meta: Meta<typeof LiveChatWidget>;
9
9
  export default meta;
10
10
  type Story = StoryObj<typeof LiveChatWidget>;
11
11
  /**
12
- * 默认配置
13
- *
14
- * 最简单的使用方式,使用默认配置。
12
+ * 默认配置 - 展示所有功能
15
13
  */
16
14
  export declare const Default: Story;
17
- /**
18
- * 自定义位置
19
- *
20
- * 使用自定义位置对象来控制气泡按钮的位置。
21
- */
22
- export declare const CustomPosition: Story;
23
- /**
24
- * 自定义品牌样式
25
- *
26
- * 自定义 Logo 和欢迎消息。
27
- */
28
- export declare const CustomBranding: Story;
29
- /**
30
- * 带快捷回复
31
- *
32
- * 在欢迎消息后显示快捷回复按钮。
33
- */
34
- export declare const WithQuickReplies: Story;
35
- /**
36
- * 自定义欢迎消息
37
- *
38
- * 自定义首次打开聊天窗口时的欢迎消息。
39
- */
40
- export declare const CustomWelcomeMessage: Story;
41
- /**
42
- * 事件回调
43
- *
44
- * 监听组件事件进行自定义处理。
45
- */
46
- export declare const WithEventCallbacks: Story;
47
- /**
48
- * 自定义视频消息渲染器
49
- *
50
- * 扩展消息类型,添加视频消息支持。
51
- */
52
- export declare const CustomVideoRenderer: Story;
53
- /**
54
- * 自定义图片画廊渲染器
55
- *
56
- * 扩展消息类型,添加图片画廊支持。
57
- */
58
- export declare const CustomImageGalleryRenderer: Story;
59
- /**
60
- * 移动端预览
61
- *
62
- * 在移动端尺寸下查看效果(全屏显示)。
63
- */
64
- export declare const MobileView: Story;
65
- /**
66
- * 平板端预览
67
- *
68
- * 在平板端尺寸下查看效果。
69
- */
70
- export declare const TabletView: Story;
71
- /**
72
- * 默认位置展示
73
- *
74
- * 展示气泡按钮的默认位置(右下角)。
75
- */
76
- export declare const DefaultPositionDemo: Story;
77
- /**
78
- * 产品对比消息
79
- *
80
- * 展示产品对比类型的消息渲染效果,包括价格、会员价、变体数量、折扣等多个维度的对比。
81
- *
82
- * 产品对比组件会以网格布局展示多个产品的基本信息,并在下方显示各维度的对比数据。
83
- */
84
- export declare const ProductComparisonMessage: Story;
85
- /**
86
- * FAQ 列表消息
87
- *
88
- * 展示常见问题列表,支持折叠/展开。
89
- *
90
- * FAQ 组件会显示搜索结果的常见问题,每个问题可以点击展开查看答案。
91
- */
92
- export declare const FAQListMessage: Story;
@@ -1,4 +1,4 @@
1
- "use strict";var l=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of c(e))!d.call(t,s)&&s!==r&&l(t,s,{get:()=>e[s],enumerable:!(a=n(e,s))||a.enumerable});return t};var p=t=>m(l({},"__esModule",{value:!0}),t);var A={};g(A,{CustomBranding:()=>C,CustomImageGalleryRenderer:()=>x,CustomPosition:()=>v,CustomVideoRenderer:()=>w,CustomWelcomeMessage:()=>b,Default:()=>f,DefaultPositionDemo:()=>I,FAQListMessage:()=>k,MobileView:()=>M,ProductComparisonMessage:()=>R,TabletView:()=>U,WithEventCallbacks:()=>S,WithQuickReplies:()=>h,default:()=>y});module.exports=p(A);var o=require("react/jsx-runtime"),i=require("../components/LiveChatWidget"),N=require("../styles/livechat.css");const u={title:"Campaign/LiveChatWidget",component:i.LiveChatWidget,parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:500},description:{component:`
1
+ "use strict";var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var a in e)n(t,a,{get:e[a],enumerable:!0})},u=(t,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d(e))!p.call(t,r)&&r!==a&&n(t,r,{get:()=>e[r],enumerable:!(i=c(e,r))||i.enumerable});return t};var m=t=>u(n({},"__esModule",{value:!0}),t);var f={};g(f,{Default:()=>v,default:()=>h});module.exports=m(f);var o=require("react/jsx-runtime"),s=require("../components/LiveChatWidget"),b=require("../styles/livechat.css");const y={title:"Campaign/LiveChatWidget",component:s.LiveChatWidget,parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:500},description:{component:`
2
2
  # LiveChat \u804A\u5929\u7EC4\u4EF6
3
3
 
4
4
  \u53EF\u590D\u7528\u7684\u6C14\u6CE1\u5F39\u7A97\u804A\u5929\u7EC4\u4EF6\uFF0C\u652F\u6301 SSE \u6D41\u5F0F\u6D88\u606F\u3001\u81EA\u5B9A\u4E49\u6E32\u67D3\u5668\u548C\u591A\u79CD\u6D88\u606F\u7C7B\u578B\u3002
@@ -24,6 +24,7 @@ function App() {
24
24
  <LiveChatWidget
25
25
  apiBaseUrl="https://beta-api-livechat.anker.com"
26
26
  site="www.eufy.com"
27
+ channel_code="web_homepage"
27
28
  welcomeMessage="\u4F60\u597D\uFF01\u6211\u662F AI \u52A9\u624B"
28
29
  />
29
30
  )
@@ -47,52 +48,12 @@ const customRenderers = {
47
48
  customRenderers={customRenderers}
48
49
  />
49
50
  \`\`\`
50
- `}}},tags:["autodocs"],argTypes:{apiBaseUrl:{control:"text",description:"API \u57FA\u7840 URL"},site:{control:"text",description:"Shopify \u5E97\u94FA URL"},welcomeMessage:{control:"text",description:"\u6B22\u8FCE\u6D88\u606F",table:{defaultValue:{summary:"\u4F60\u597D\uFF01\u6211\u662F AI \u52A9\u624B\uFF0C\u6709\u4EC0\u4E48\u53EF\u4EE5\u5E2E\u52A9\u4F60\u7684\u5417\uFF1F"}}},logoUrl:{control:"text",description:"Logo URL"},position:{control:"object",description:"\u6C14\u6CE1\u6309\u94AE\u4F4D\u7F6E\u5BF9\u8C61",table:{defaultValue:{summary:'{ bottom: "1.5rem", right: "1.5rem" }'}}}},args:{apiBaseUrl:"http://172.16.38.183:3003",site:"www.eufy.com",loginUserId:"test_test",welcomeMessage:"\u4F60\u597D\uFF01\u6211\u662F AI \u52A9\u624B\uFF0C\u6709\u4EC0\u4E48\u53EF\u4EE5\u5E2E\u52A9\u4F60\u7684\u5417\uFF1F"}};var y=u;const f={args:{loginUserId:"test_test",apiBaseUrl:"http://172.16.38.183:3003",cartId:"gid://shopify/Cart/hWN7oFnMh7jKxbO1CYSzWVue?key=68f4cf2c4c772b9aed2fab2902e6dab3",accessToken:"92301d516a0a38a0a483bc230e5bfaad",title:"eufy"}},v={args:{position:{bottom:"1.5rem",left:"1.5rem"}}},C={args:{logoUrl:"https://images.unsplash.com/photo-1599305445671-ac291c95aaa9?w=100&h=100&fit=crop",welcomeMessage:"\u6B22\u8FCE\u6765\u5230 Soundcore\uFF01\u6211\u662F\u60A8\u7684\u4E13\u5C5E AI \u52A9\u624B \u{1F3A7}"}},h={args:{quickReplies:[{id:"1",label:"\u67E5\u8BE2\u4EF7\u683C",value:"\u6211\u60F3\u4E86\u89E3\u4EA7\u54C1\u4EF7\u683C",icon:"\u{1F4B0}"},{id:"2",label:"\u67E5\u8BE2\u7269\u6D41",value:"\u6211\u60F3\u67E5\u8BE2\u8BA2\u5355\u7269\u6D41",icon:"\u{1F4E6}"},{id:"3",label:"\u552E\u540E\u670D\u52A1",value:"\u6211\u9700\u8981\u552E\u540E\u5E2E\u52A9",icon:"\u{1F527}"},{id:"4",label:"\u4EA7\u54C1\u63A8\u8350",value:"\u8BF7\u63A8\u8350\u9002\u5408\u6211\u7684\u4EA7\u54C1",icon:"\u2B50"}]}},b={args:{welcomeMessage:`
51
- \u{1F44B} \u60A8\u597D\uFF01\u6B22\u8FCE\u6765\u5230 Soundcore \u5B98\u65B9\u5546\u57CE\u3002
51
+ `}}},tags:["autodocs"],argTypes:{apiBaseUrl:{control:"text",description:"API \u57FA\u7840 URL"},headers:{control:"object",description:"\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\uFF0C\u5C06\u5728\u6240\u6709 API \u8BF7\u6C42\u4E2D\u6DFB\u52A0",table:{defaultValue:{summary:"undefined"}}},recaptchaSitekey:{control:"text",description:"Google reCAPTCHA v3 site key\uFF0C\u63D0\u4F9B\u6B64\u53C2\u6570\u5C06\u81EA\u52A8\u542F\u7528 reCAPTCHA v3 \u9A8C\u8BC1",table:{defaultValue:{summary:"undefined"}}},recaptchaAction:{control:"text",description:"reCAPTCHA action \u540D\u79F0\uFF0C\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u7684\u9A8C\u8BC1\u573A\u666F",table:{defaultValue:{summary:'"activity"'}}},site:{control:"text",description:"Shopify \u5E97\u94FA URL"},channelCode:{control:"text",description:"\u6E20\u9053\u7F16\u7801\uFF0C\u7528\u4E8E\u6807\u8BC6\u6765\u6E90\u6E20\u9053",table:{defaultValue:{summary:"undefined"}}},welcomeMessage:{control:"text",description:"\u6B22\u8FCE\u6D88\u606F",table:{defaultValue:{summary:"\u4F60\u597D\uFF01\u6211\u662F AI \u52A9\u624B\uFF0C\u6709\u4EC0\u4E48\u53EF\u4EE5\u5E2E\u52A9\u4F60\u7684\u5417\uFF1F"}}},logoUrl:{control:"text",description:"Logo URL"},position:{control:"object",description:"\u6C14\u6CE1\u6309\u94AE\u4F4D\u7F6E\u5BF9\u8C61",table:{defaultValue:{summary:'{ bottom: "1.5rem", right: "1.5rem" }'}}}},args:{apiBaseUrl:"http://172.16.38.183:3003",site:"www.eufy.com",loginUserId:"test_test",welcomeMessage:"\u4F60\u597D\uFF01\u6211\u662F AI \u52A9\u624B\uFF0C\u6709\u4EC0\u4E48\u53EF\u4EE5\u5E2E\u52A9\u4F60\u7684\u5417\uFF1F"}};var h=y;const v={args:{loginUserId:"test_test",apiBaseUrl:"http://172.16.38.183:3003",site:"beta.eufy.com",channelCode:"dtc",title:"eufy AI Assistant",cartId:"gid://shopify/Cart/hWN7wB3Pa12gh78d8hPOAUBI?key=0e73db1d3fb5ac21da19099c45033253",accessToken:"47b1aa2c0797043f9baba39388029d70",position:{bottom:"24px",right:"30px"},welcomeMessage:`Welcome to eufy AI Assistant!
52
52
 
53
- \u6211\u662F\u60A8\u7684 AI \u8D2D\u7269\u52A9\u624B\uFF0C\u53EF\u4EE5\u5E2E\u60A8\uFF1A
54
- - \u{1F50D} \u67E5\u627E\u4EA7\u54C1
55
- - \u{1F4B0} \u6BD4\u8F83\u4EF7\u683C
56
- - \u{1F4E6} \u8DDF\u8E2A\u8BA2\u5355
57
- - \u{1F4AC} \u89E3\u7B54\u7591\u95EE
53
+ I can help you with:
54
+ - Product recommendations
55
+ - Order tracking
56
+ - FAQs and support
58
57
 
59
- \u6709\u4EC0\u4E48\u6211\u53EF\u4EE5\u5E2E\u52A9\u60A8\u7684\u5417\uFF1F
60
- `.trim()}},S={args:{title:"",showNewSessionButton:!1,position:{bottom:"24px",right:"30px"},chatBubbleIcon:"https://cdn.shopify.com/s/files/1/0504/7094/4954/files/Rectangle_400770314.png?v=1768894153"},render:t=>(0,o.jsx)(i.LiveChatWidget,{...t,onOpen:()=>{console.log("[Story] Chat opened")},onClose:()=>{console.log("[Story] Chat closed")},onMessageSend:e=>{console.log("[Story] Message sent:",e)},onError:e=>{console.error("[Story] Error occurred:",e)},onAddToCart:e=>{console.log("\u{1F6D2} [Story] Add to Cart clicked!"),console.log("\u{1F4E6} Product Info:",{id:e.shopifyId,title:e.title,price:e.price,imageUrl:e.imageUrl,productUrl:e.productUrl}),console.log("\u{1F4CB} Full Product Object:",e),alert(`\u2705 "${e.title}" \u5DF2\u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\uFF01
61
-
62
- \u4EF7\u683C: ${e.price.currency} ${e.price.amount}`)},onCart:(e,r)=>{console.log("\u{1F6D2} [Story] Cart button clicked!"),console.log("\u{1F4CB} Cart ID:",e),console.log("\u{1F517} Checkout URL:",r),alert(`\u8D2D\u7269\u8F66\u6309\u94AE\u88AB\u70B9\u51FB\uFF01
63
-
64
- Cart ID: ${e}
65
- Checkout URL: ${r||"\u65E0"}`)}})},w={args:{customRenderers:{video:{render:t=>{const e=t;return(0,o.jsxs)("div",{className:"w-full",children:[(0,o.jsx)("video",{src:e.url,controls:!0,className:"w-full rounded-lg",poster:e.poster,children:"\u60A8\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u89C6\u9891\u64AD\u653E"}),e.title&&(0,o.jsx)("p",{className:"mt-2 text-sm text-gray-600",children:e.title})]})}}}}},x={args:{customRenderers:{image_gallery:{render:t=>{const r=t.images||[];return(0,o.jsx)("div",{className:"grid grid-cols-2 gap-2",children:r.map((a,s)=>(0,o.jsx)("div",{className:"relative aspect-square",children:(0,o.jsx)("img",{src:a.url,alt:a.alt||`Image ${s+1}`,className:"size-full rounded-lg object-cover"})},s))})}}}}},M={parameters:{viewport:{defaultViewport:"mobile1"}},args:{}},U={parameters:{viewport:{defaultViewport:"tablet"}},args:{}},I={render:()=>(0,o.jsxs)("div",{className:"relative h-screen w-full bg-gray-50",children:[(0,o.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,o.jsx)("p",{className:"text-gray-500",children:"\u9875\u9762\u5185\u5BB9\u533A\u57DF"})}),(0,o.jsx)("div",{className:"absolute bottom-4 right-4 text-xs text-gray-400",children:"\u9ED8\u8BA4\u4F4D\u7F6E (\u53F3\u4E0B\u89D2)"}),(0,o.jsx)(i.LiveChatWidget,{apiBaseUrl:"https://beta-api-livechat.anker.com",site:"www.eufy.com"})]})},R={render:t=>(0,o.jsx)(i.LiveChatWidget,{...t,onAddToCart:e=>{console.log("\u{1F6D2} [ProductComparison Story] Add to Cart clicked!"),console.log("\u{1F4E6} Product Info:",{id:e.shopifyId,title:e.title,price:e.price,imageUrl:e.imageUrl,productUrl:e.productUrl}),console.log("\u{1F4CB} Full Product Object:",e),alert(`\u2705 "${e.title}" \u5DF2\u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\uFF01
66
-
67
- \u4EF7\u683C: ${e.price.currency} ${e.price.amount}`)}}),args:{welcomeMessage:"\u4EE5\u4E0B\u662F\u60A8\u5173\u6CE8\u7684\u4EA7\u54C1\u5BF9\u6BD4\u4FE1\u606F\uFF1A"},parameters:{docs:{description:{story:`
68
- \u4EA7\u54C1\u5BF9\u6BD4\u6D88\u606F\u652F\u6301\u4EE5\u4E0B\u7EF4\u5EA6\uFF1A
69
-
70
- - **\u4EF7\u683C\u5BF9\u6BD4**: \u663E\u793A\u4EA7\u54C1\u7684\u4EF7\u683C\u533A\u95F4\u548C\u4FC3\u9500\u6807\u7B7E
71
- - **\u4F1A\u5458\u4EF7\u5BF9\u6BD4**: \u663E\u793A\u4F1A\u5458\u4E13\u4EAB\u4EF7\u683C\uFF08\u5982\u679C\u53EF\u7528\uFF09
72
- - **\u53D8\u4F53\u6570\u91CF\u5BF9\u6BD4**: \u663E\u793A\u4EA7\u54C1\u7684\u53EF\u9009\u53D8\u4F53\u6570\u91CF
73
- - **\u6298\u6263\u5BF9\u6BD4**: \u663E\u793A\u4EA7\u54C1\u662F\u5426\u6709\u6298\u6263\u6D3B\u52A8
74
-
75
- \u7EC4\u4EF6\u4F1A\u81EA\u52A8\u5904\u7406\u4ECE\u540E\u7AEF\u8FD4\u56DE\u7684\u4EA7\u54C1\u5BF9\u6BD4\u6570\u636E\uFF0C\u5305\u62EC\uFF1A
76
- - \u4EA7\u54C1\u57FA\u672C\u4FE1\u606F\uFF08\u56FE\u7247\u3001\u6807\u9898\u3001\u4EF7\u683C\u7B49\uFF09
77
- - \u591A\u7EF4\u5EA6\u5BF9\u6BD4\u6570\u636E\uFF08\u4EF7\u683C\u3001\u4F1A\u5458\u4EF7\u3001\u53D8\u4F53\u3001\u6298\u6263\uFF09
78
- - \u54CD\u5E94\u5F0F\u5E03\u5C40\uFF08\u79FB\u52A8\u7AEF\u53EF\u6A2A\u5411\u6EDA\u52A8\uFF09
79
-
80
- **\u6D4B\u8BD5 Add to Cart \u529F\u80FD\uFF1A**
81
- - \u70B9\u51FB\u4EA7\u54C1\u5BF9\u6BD4\u5361\u7247\u4E2D\u7684 "Add to Cart" \u6309\u94AE
82
- - \u67E5\u770B\u63A7\u5236\u53F0\u8F93\u51FA\u7684\u4EA7\u54C1\u4FE1\u606F
83
- - \u4F1A\u5F39\u51FA\u786E\u8BA4\u63D0\u793A\u6846\u663E\u793A\u5DF2\u6DFB\u52A0\u5230\u8D2D\u7269\u8F66
84
- `}}}},k={args:{welcomeMessage:"\u4EE5\u4E0B\u662F\u4E0E\u60A8\u7684\u95EE\u9898\u76F8\u5173\u7684\u5E38\u89C1\u89E3\u7B54\uFF1A"},parameters:{docs:{description:{story:`
85
- FAQ \u5217\u8868\u6D88\u606F\u652F\u6301\uFF1A
86
-
87
- - **\u53EF\u6298\u53E0\u95EE\u9898**: \u70B9\u51FB\u95EE\u9898\u6807\u9898\u5C55\u5F00/\u6298\u53E0\u7B54\u6848
88
- - **Markdown \u7B54\u6848**: \u7B54\u6848\u652F\u6301 Markdown \u683C\u5F0F\uFF0C\u53EF\u663E\u793A\u5BCC\u6587\u672C
89
- - **\u76F8\u5173\u95EE\u9898**: \u5C55\u5F00\u7B54\u6848\u540E\u663E\u793A\u76F8\u5173\u95EE\u9898\uFF0C\u70B9\u51FB\u53EF\u89E6\u53D1\u65B0\u641C\u7D22
90
- - **\u5206\u7C7B\u6807\u8BB0**: \u6839\u636E\u95EE\u9898\u5206\u7C7B\u663E\u793A\uFF08\u914D\u9001\u3001\u9000\u8D27\u3001\u4EA7\u54C1\u3001\u652F\u4ED8\u3001\u901A\u7528\uFF09
91
- - **\u641C\u7D22\u7ED3\u679C\u7EDF\u8BA1**: \u663E\u793A\u627E\u5230\u7684\u95EE\u9898\u6570\u91CF
92
-
93
- \u4F7F\u7528\u573A\u666F\uFF1A
94
- - \u7528\u6237\u8BE2\u95EE\u5E38\u89C1\u95EE\u9898\u65F6\u8FD4\u56DE FAQ \u5217\u8868
95
- - \u4EA7\u54C1\u4E13\u5C5E\u95EE\u9898\u67E5\u8BE2
96
- - \u6309\u5206\u7C7B\u67E5\u8BE2 FAQ
97
- `}}}};
58
+ How can I assist you today?`,quickReplies:[{id:"1",label:"Product Info",value:"Tell me about your products",icon:"\u{1F4E6}"},{id:"2",label:"Track Order",value:"I want to track my order",icon:"\u{1F69A}"},{id:"3",label:"Support",value:"I need help with my device",icon:"\u{1F527}"},{id:"4",label:"Recommendations",value:"Recommend products for me",icon:"\u2B50"}],complianceConfig:{title:"Hi! I'm your eufy AI assistant.",content:"AI-generated responses can be inaccurate. Please verify important info. Do not input sensitive personal data.",checkboxText:`By starting to use "Live Chat", you agree to Anker's <a href="https://www.anker.com/pages/privacy-policy" target="_blank" rel="noopener noreferrer" style="text-decoration: underline;">LIVE CHAT PRIVACY NOTICE</a>.`,agreeButtonText:"Agree"},recaptchaAction:"livechat",showNewSessionButton:!0,commonText:{learnMore:"Learn More",total:"Total"},customRenderers:{video:{render:t=>{const e=t;return(0,o.jsxs)("div",{className:"w-full",children:[(0,o.jsx)("video",{src:e.url,controls:!0,className:"w-full rounded-lg",poster:e.poster,children:"Your browser does not support video playback"}),e.title&&(0,o.jsx)("p",{className:"mt-2 text-sm text-gray-600",children:e.title})]})}},image_gallery:{render:t=>{const a=t.images||[];return(0,o.jsx)("div",{className:"grid grid-cols-2 gap-2",children:a.map((i,r)=>(0,o.jsx)("div",{className:"relative aspect-square",children:(0,o.jsx)("img",{src:i.url,alt:i.alt||`Image ${r+1}`,className:"size-full rounded-lg object-cover"})},r))})}}},productCardRender:(t,e)=>{if(!t)return(0,o.jsx)("div",{style:{padding:"16px",border:"1px dashed #ccc",borderRadius:"8px",textAlign:"center"},children:(0,o.jsxs)("p",{children:["Product loading... (handle: ",e,")"]})});const a=t?.featured_image||"",i=t?.title||"",r=t?.description||"",l=t?.average_rating;return(0,o.jsx)("div",{style:{border:"2px solid #4CAF50",borderRadius:"16px",padding:"16px",margin:"12px 0",backgroundColor:"#f0f9ff",boxShadow:"0 4px 12px rgba(76, 175, 80, 0.15)"},children:(0,o.jsxs)("div",{style:{display:"flex",gap:"12px",alignItems:"center"},children:[a&&(0,o.jsx)("img",{src:a,alt:i,style:{width:"60px",height:"60px",borderRadius:"8px",objectFit:"cover"}}),(0,o.jsxs)("div",{style:{flex:1},children:[(0,o.jsx)("h4",{style:{margin:"0 0 4px 0",fontSize:"16px",fontWeight:"bold"},children:i}),r&&(0,o.jsxs)("p",{style:{margin:0,fontSize:"12px",color:"#666",lineHeight:1.4},children:[r.slice(0,80),"..."]}),l&&(0,o.jsxs)("span",{style:{fontSize:"12px",color:"#FFB800"},children:["Rating: ",l.toFixed(1)]})]}),(0,o.jsx)("button",{style:{padding:"8px 16px",backgroundColor:"#4CAF50",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},onClick:()=>console.log("View product:",e,t),children:"View"})]})})}},render:t=>(0,o.jsx)(s.LiveChatWidget,{...t,onOpen:()=>console.log("[LiveChat] Chat opened"),onClose:()=>console.log("[LiveChat] Chat closed"),onMessageSend:e=>console.log("[LiveChat] Message sent:",e),onError:e=>console.error("[LiveChat] Error:",e),onTextMessage:()=>console.log("[LiveChat] AI text message received"),onProductList:()=>console.log("[LiveChat] Product list received"),onPromotionList:()=>console.log("[LiveChat] Promotion list received"),onAddToCart:e=>{console.log("[LiveChat] Add to cart:",e),alert(`Added "${e.title}" to cart!`)},onCart:(e,a)=>{console.log("[LiveChat] Cart clicked:",{cartId:e,checkoutUrl:a}),alert(`Cart ID: ${e}`)}})};
98
59
  //# sourceMappingURL=LiveChatWidget.stories.js.map