@anker-in/campaign-ui 0.5.0 → 0.5.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/LiveChatWidget/components/MessageContent/FAQList.js +1 -1
- package/dist/cjs/components/LiveChatWidget/components/MessageContent/FAQList.js.map +3 -3
- package/dist/cjs/components/LiveChatWidget/components/MessageContent/PolicyBlock.js +2 -2
- package/dist/cjs/components/LiveChatWidget/components/MessageContent/PolicyBlock.js.map +2 -2
- package/dist/cjs/components/LiveChatWidget/components/MessageContent/TextBlock.js +1 -1
- package/dist/cjs/components/LiveChatWidget/components/MessageContent/TextBlock.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +2 -2
- package/dist/cjs/components/index.d.ts +2 -2
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +2 -2
- package/dist/cjs/stories/CartCard.stories.d.ts +33 -0
- package/dist/cjs/stories/CartCard.stories.js +21 -0
- package/dist/cjs/stories/CartCard.stories.js.map +7 -0
- package/dist/esm/components/LiveChatWidget/components/MessageContent/FAQList.js +1 -1
- package/dist/esm/components/LiveChatWidget/components/MessageContent/FAQList.js.map +3 -3
- package/dist/esm/components/LiveChatWidget/components/MessageContent/PolicyBlock.js +2 -2
- package/dist/esm/components/LiveChatWidget/components/MessageContent/PolicyBlock.js.map +2 -2
- package/dist/esm/components/LiveChatWidget/components/MessageContent/TextBlock.js +1 -1
- package/dist/esm/components/LiveChatWidget/components/MessageContent/TextBlock.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +2 -2
- package/dist/esm/components/index.d.ts +2 -2
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/stories/CartCard.stories.d.ts +33 -0
- package/dist/esm/stories/CartCard.stories.js +21 -0
- package/dist/esm/stories/CartCard.stories.js.map +7 -0
- package/package.json +20 -19
- package/src/components/LiveChatWidget/components/MessageContent/FAQList.tsx +15 -1
- package/src/components/LiveChatWidget/components/MessageContent/PolicyBlock.tsx +8 -0
- package/src/components/LiveChatWidget/components/MessageContent/TextBlock.tsx +3 -1
- package/src/components/credits/context/hooks/useSubscribed.ts +1 -0
- package/src/components/index.ts +2 -2
- package/src/stories/CartCard.stories.tsx +459 -0
- package/src/styles/livechat.css +15 -3
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +0 -10
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +0 -2
- package/dist/cjs/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +0 -7
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.d.ts +0 -10
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js +0 -2
- package/dist/esm/components/memberPopup/panels/EarnCredits/CompleteProfileModal.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/LiveChatWidget/components/MessageContent/TextBlock.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * \u6587\u672C\u6D88\u606F\u5185\u5BB9\u6E32\u67D3\u5668\n * \u652F\u6301 Markdown \u683C\u5F0F\n * \u57FA\u4E8E specs/livechat-widget/plan.md \u7684\u6587\u672C\u6D88\u606F\u8BBE\u8BA1\n */\n\nimport React from 'react'\nimport ReactMarkdown from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport type { MessageRenderer, TextContent } from '../../types'\n\n/**\n * \u6587\u672C\u6D88\u606F\u6E32\u67D3\u5668\n *\n * \u529F\u80FD\uFF1A\n * - \u652F\u6301 Markdown \u8BED\u6CD5\uFF08\u7C97\u4F53\u3001\u659C\u4F53\u3001\u94FE\u63A5\u3001\u5217\u8868\u7B49\uFF09\n * - \u5B89\u5168\u6E32\u67D3\uFF08React Markdown \u81EA\u52A8\u9632\u62A4 XSS\uFF09\n * - \u54CD\u5E94\u5F0F\u6587\u672C\u6837\u5F0F\n *\n * Markdown \u652F\u6301\uFF1A\n * - \u7C97\u4F53\uFF1A**text** \u6216 __text__\n * - \u659C\u4F53\uFF1A*text* \u6216 _text_\n * - \u94FE\u63A5\uFF1A[text](url)\n * - \u5217\u8868\uFF1A- item \u6216 1. item\n * - \u4EE3\u7801\uFF1A`code` \u6216 ```code block```\n *\n * @example\n * ```tsx\n * const content: TextContent = {\n * type: 'text',\n * text: '\u60A8\u597D\uFF01**\u8FD9\u662F\u7C97\u4F53**\uFF0C*\u8FD9\u662F\u659C\u4F53*\u3002'\n * }\n * <TextBlock.render(content, false, false) />\n * ```\n */\nexport const TextBlock: MessageRenderer = {\n render: (content, isUser, isSystem) => {\n const textContent = content as TextContent\n\n if (!textContent.text) {\n return null\n }\n\n return (\n <div className=\"livechat-markdown text-base md:text-sm\">\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n components={{\n // \u81EA\u5B9A\u4E49\u94FE\u63A5\u6837\u5F0F\n a: ({ node, ...props }) => (\n <a\n {...props}\n className={`underline ${isUser ? '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * \u6587\u672C\u6D88\u606F\u5185\u5BB9\u6E32\u67D3\u5668\n * \u652F\u6301 Markdown \u683C\u5F0F\n * \u57FA\u4E8E specs/livechat-widget/plan.md \u7684\u6587\u672C\u6D88\u606F\u8BBE\u8BA1\n */\n\nimport React from 'react'\nimport ReactMarkdown from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport type { MessageRenderer, TextContent } from '../../types'\n\n/**\n * \u6587\u672C\u6D88\u606F\u6E32\u67D3\u5668\n *\n * \u529F\u80FD\uFF1A\n * - \u652F\u6301 Markdown \u8BED\u6CD5\uFF08\u7C97\u4F53\u3001\u659C\u4F53\u3001\u94FE\u63A5\u3001\u5217\u8868\u7B49\uFF09\n * - \u5B89\u5168\u6E32\u67D3\uFF08React Markdown \u81EA\u52A8\u9632\u62A4 XSS\uFF09\n * - \u54CD\u5E94\u5F0F\u6587\u672C\u6837\u5F0F\n *\n * Markdown \u652F\u6301\uFF1A\n * - \u7C97\u4F53\uFF1A**text** \u6216 __text__\n * - \u659C\u4F53\uFF1A*text* \u6216 _text_\n * - \u94FE\u63A5\uFF1A[text](url)\n * - \u5217\u8868\uFF1A- item \u6216 1. item\n * - \u4EE3\u7801\uFF1A`code` \u6216 ```code block```\n *\n * @example\n * ```tsx\n * const content: TextContent = {\n * type: 'text',\n * text: '\u60A8\u597D\uFF01**\u8FD9\u662F\u7C97\u4F53**\uFF0C*\u8FD9\u662F\u659C\u4F53*\u3002'\n * }\n * <TextBlock.render(content, false, false) />\n * ```\n */\nexport const TextBlock: MessageRenderer = {\n render: (content, isUser, isSystem) => {\n const textContent = content as TextContent\n\n if (!textContent.text) {\n return null\n }\n\n return (\n <div className=\"livechat-markdown text-base md:text-sm\">\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n components={{\n // \u81EA\u5B9A\u4E49\u94FE\u63A5\u6837\u5F0F\n // livechat-link-user / livechat-link-bot \u7528\u4E8E\u533A\u5206\u7528\u6237\u8F93\u5165\u94FE\u63A5\u4E0E\u673A\u5668\u4EBA\u56DE\u590D\u94FE\u63A5\u7684\u989C\u8272\uFF0C\n // \u8C03\u7528\u65B9\u53EF\u76F4\u63A5\u8986\u76D6\u8FD9\u4E24\u4E2A\u7C7B\u540D\u81EA\u5B9A\u4E49\u989C\u8272\uFF08\u89C1 styles/livechat.css\uFF09\n a: ({ node, ...props }) => (\n <a\n {...props}\n className={`livechat-link underline ${isUser ? 'livechat-link-user' : 'livechat-link-bot'}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n // \u81EA\u5B9A\u4E49\u4EE3\u7801\u5757\u6837\u5F0F\n code: ({ node, className, ...props }: any) => {\n const isBlock = /language-/.test(className || '')\n return isBlock ? (\n <code\n {...props}\n className={`block overflow-x-auto rounded px-3 py-2 font-mono text-xs ${isUser ? 'livechat-code-user bg-[#004A6E] text-white' : 'bg-gray-200 text-gray-800'}`}\n />\n ) : (\n <code\n {...props}\n className={`rounded px-1.5 py-0.5 font-mono text-xs ${isUser ? 'livechat-code-user bg-[#004A6E] text-white' : 'bg-gray-200 text-gray-800'}`}\n />\n )\n },\n // \u81EA\u5B9A\u4E49\u6BB5\u843D\u6837\u5F0F\n p: ({ node, ...props }) => <p {...props} className=\"last:mb-0\" />,\n // \u81EA\u5B9A\u4E49\u5217\u8868\u6837\u5F0F\n ul: ({ node, ...props }) => <ul {...props} className=\"ml-4 list-disc\" />,\n ol: ({ node, ...props }) => <ol {...props} className=\"mb-2 ml-4 list-decimal\" />,\n li: ({ node, ...props }) => <li {...props} className=\"mb-1\" />,\n // \u81EA\u5B9A\u4E49\u6807\u9898\u6837\u5F0F\n h1: ({ node, ...props }) => <h1 {...props} className=\"mb-2 font-bold\" />,\n h2: ({ node, ...props }) => <h2 {...props} className=\"mb-2 font-bold\" />,\n h3: ({ node, ...props }) => <h3 {...props} className=\"mb-1 font-bold\" />,\n // \u81EA\u5B9A\u4E49\u5F3A\u8C03\u6837\u5F0F\n strong: ({ node, ...props }) => <strong {...props} className=\"font-bold\" />,\n em: ({ node, ...props }) => <em {...props} className=\"italic\" />,\n // \u8868\u683C\u6837\u5F0F\n table: ({ node, ...props }) => (\n <div className=\"my-2 overflow-x-auto\">\n <table {...props} className=\"min-w-full border-collapse border border-gray-300 text-base md:text-sm\" />\n </div>\n ),\n thead: ({ node, ...props }) => (\n <thead {...props} className=\"bg-gray-100\" />\n ),\n tbody: ({ node, ...props }) => <tbody {...props} />,\n tr: ({ node, ...props }) => (\n <tr {...props} className=\"border-b border-gray-300\" />\n ),\n th: ({ node, ...props }) => (\n <th {...props} className=\"border border-gray-300 px-3 py-2 text-left font-semibold\" />\n ),\n td: ({ node, ...props }) => (\n <td {...props} className=\"border border-gray-300 px-3 py-2\" />\n ),\n }}\n >\n {textContent.text}\n </ReactMarkdown>\n </div>\n )\n },\n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C,MAAI,GAAGS,EAAO,UAAU,iBAAiB,EACtE,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IAAMT,EAAC,MAAI,GAAGS,EAAO,UAAU,iBAAiB,EAEtE,OAAQ,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IAAMT,EAAC,UAAQ,GAAGS,EAAO,UAAU,YAAY,EACzE,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IAAMT,EAAC,MAAI,GAAGS,EAAO,UAAU,SAAS,EAE9D,MAAO,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACvBT,EAAC,OAAI,UAAU,uBACb,SAAAA,EAAC,SAAO,GAAGS,EAAO,UAAU,yEAAyE,EACvG,EAEF,MAAO,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACvBT,EAAC,SAAO,GAAGS,EAAO,UAAU,cAAc,EAE5C,MAAO,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IAAMT,EAAC,SAAO,GAAGS,EAAO,EACjD,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,2BAA2B,EAEtD,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,2DAA2D,EAEtF,GAAI,CAAC,CAAE,KAAAD,EAAM,GAAGC,CAAM,IACpBT,EAAC,MAAI,GAAGS,EAAO,UAAU,mCAAmC,CAEhE,EAEC,SAAAF,EAAY,KACf,EACF,EAtEO,IAwEX,CACF",
|
|
6
6
|
"names": ["jsx", "ReactMarkdown", "remarkGfm", "TextBlock", "content", "isUser", "isSystem", "textContent", "node", "props", "className"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useSubscribed.ts"],
|
|
4
|
-
"sourcesContent": ["import { useMemo } from 'react'\n\nimport { TaskSubType } from '../const'\nimport useActivities from './useActivities'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext, useSubscriptions } from '@anker-in/lib'\n\nexport const useSubscribed = () => {\n const { profile } = useCreditsContext()\n const { brand } = useHeadlessContext()\n\n const activitiesOptions = useMemo(() => ({ page: 1, pageSize: 50 }), [])\n\n const { activities } = useActivities(activitiesOptions)\n const { data: subscription } = useSubscriptions({ email: profile?.email })\n const subscriptionData = subscription?.data || subscription\n\n const isSubscribed = useMemo(() => {\n if (!subscriptionData?.preference) {\n return false\n }\n\n const subscribeResult = subscriptionData.preference.some((item: any) => {\n return item.brand === brand && item.subscribe\n })\n\n if (subscribeResult) {\n return true\n }\n\n return activities?.some(item => {\n return item.task_sub_type === TaskSubType.Subscription\n })\n }, [subscriptionData?.preference, activities])\n\n return isSubscribed\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,WAAAA,MAAe,QAExB,OAAS,eAAAC,MAAmB,WAC5B,OAAOC,MAAmB,kBAC1B,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,EAAoB,oBAAAC,MAAwB,gBAE9C,MAAMC,EAAgB,IAAM,CACjC,KAAM,CAAE,QAAAC,CAAQ,EAAIJ,EAAkB,EAChC,CAAE,MAAAK,CAAM,EAAIJ,EAAmB,EAE/BK,EAAoBT,EAAQ,KAAO,CAAE,KAAM,EAAG,SAAU,EAAG,GAAI,CAAC,CAAC,EAEjE,CAAE,WAAAU,CAAW,EAAIR,EAAcO,CAAiB,EAChD,CAAE,KAAME,CAAa,EAAIN,EAAiB,CAAE,MAAOE,GAAS,KAAM,CAAC,
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react'\n\nimport { TaskSubType } from '../const'\nimport useActivities from './useActivities'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext, useSubscriptions } from '@anker-in/lib'\n\nexport const useSubscribed = () => {\n const { profile } = useCreditsContext()\n const { brand } = useHeadlessContext()\n\n const activitiesOptions = useMemo(() => ({ page: 1, pageSize: 50 }), [])\n\n const { activities } = useActivities(activitiesOptions)\n const { data: subscription } = useSubscriptions({ email: profile?.email })\n //@ts-ignore\n const subscriptionData = subscription?.data || subscription\n\n const isSubscribed = useMemo(() => {\n if (!subscriptionData?.preference) {\n return false\n }\n\n const subscribeResult = subscriptionData.preference.some((item: any) => {\n return item.brand === brand && item.subscribe\n })\n\n if (subscribeResult) {\n return true\n }\n\n return activities?.some(item => {\n return item.task_sub_type === TaskSubType.Subscription\n })\n }, [subscriptionData?.preference, activities])\n\n return isSubscribed\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,WAAAA,MAAe,QAExB,OAAS,eAAAC,MAAmB,WAC5B,OAAOC,MAAmB,kBAC1B,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,EAAoB,oBAAAC,MAAwB,gBAE9C,MAAMC,EAAgB,IAAM,CACjC,KAAM,CAAE,QAAAC,CAAQ,EAAIJ,EAAkB,EAChC,CAAE,MAAAK,CAAM,EAAIJ,EAAmB,EAE/BK,EAAoBT,EAAQ,KAAO,CAAE,KAAM,EAAG,SAAU,EAAG,GAAI,CAAC,CAAC,EAEjE,CAAE,WAAAU,CAAW,EAAIR,EAAcO,CAAiB,EAChD,CAAE,KAAME,CAAa,EAAIN,EAAiB,CAAE,MAAOE,GAAS,KAAM,CAAC,EAEnEK,EAAmBD,GAAc,MAAQA,EAoB/C,OAlBqBX,EAAQ,IACtBY,GAAkB,WAICA,EAAiB,WAAW,KAAMC,GACjDA,EAAK,QAAUL,GAASK,EAAK,SACrC,EAGQ,GAGFH,GAAY,KAAKG,GACfA,EAAK,gBAAkBZ,EAAY,YAC3C,EAbQ,GAcR,CAACW,GAAkB,WAAYF,CAAU,CAAC,CAG/C",
|
|
6
6
|
"names": ["useMemo", "TaskSubType", "useActivities", "useCreditsContext", "useHeadlessContext", "useSubscriptions", "useSubscribed", "profile", "brand", "activitiesOptions", "activities", "subscription", "subscriptionData", "item"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as Chat } from './chat/index';
|
|
2
|
-
export { Role, ActionExecutionMessage, TextMessage, useCopilotChat, useCopilotAction, useCopilotReadable, } from './chat/utils';
|
|
1
|
+
export { default as Chat } from './chat/index.js';
|
|
2
|
+
export { Role, ActionExecutionMessage, TextMessage, useCopilotChat, useCopilotAction, useCopilotReadable, } from './chat/utils.js';
|
|
3
3
|
export * from './credits/index.js';
|
|
4
4
|
export * from './registration/index.js';
|
|
5
5
|
export * from './memberPopup/index.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as o}from"./chat/index";import{Role as n,ActionExecutionMessage as r,TextMessage as a,useCopilotChat as i,useCopilotAction as C,useCopilotReadable as p}from"./chat/utils";export*from"./credits/index.js";export*from"./registration/index.js";export*from"./memberPopup/index.js";import{LiveChatWidget as x}from"./LiveChatWidget/index.js";export{r as ActionExecutionMessage,o as Chat,x as LiveChatWidget,n as Role,a as TextMessage,C as useCopilotAction,i as useCopilotChat,p as useCopilotReadable};
|
|
1
|
+
import{default as o}from"./chat/index.js";import{Role as n,ActionExecutionMessage as r,TextMessage as a,useCopilotChat as i,useCopilotAction as C,useCopilotReadable as p}from"./chat/utils.js";export*from"./credits/index.js";export*from"./registration/index.js";export*from"./memberPopup/index.js";import{LiveChatWidget as x}from"./LiveChatWidget/index.js";export{r as ActionExecutionMessage,o as Chat,x as LiveChatWidget,n as Role,a as TextMessage,C as useCopilotAction,i as useCopilotChat,p as useCopilotReadable};
|
|
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\nexport * from './memberPopup/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": "AAAA,OAAoB,WAAXA,MAAuB,
|
|
4
|
+
"sourcesContent": ["export { default as Chat } from './chat/index.js'\n\nexport {\n Role,\n ActionExecutionMessage,\n TextMessage,\n useCopilotChat,\n useCopilotAction,\n useCopilotReadable,\n} from './chat/utils.js'\n\nexport * from './credits/index.js'\n\nexport * from './registration/index.js'\n\nexport * from './memberPopup/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": "AAAA,OAAoB,WAAXA,MAAuB,kBAEhC,OACE,QAAAC,EACA,0BAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,oBAAAC,EACA,sBAAAC,MACK,kBAEP,WAAc,qBAEd,WAAc,0BAEd,WAAc,yBAKd,OAAS,kBAAAC,MAAsB",
|
|
6
6
|
"names": ["default", "Role", "ActionExecutionMessage", "TextMessage", "useCopilotChat", "useCopilotAction", "useCopilotReadable", "LiveChatWidget"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CartCard Storybook Stories
|
|
3
|
+
* 展示购物车卡片组件的各种状态
|
|
4
|
+
*/
|
|
5
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { CartContent } from '../components/LiveChatWidget/types';
|
|
8
|
+
declare const CartCardWrapper: React.FC<{
|
|
9
|
+
content: CartContent;
|
|
10
|
+
}>;
|
|
11
|
+
declare const meta: Meta<typeof CartCardWrapper>;
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof CartCardWrapper>;
|
|
14
|
+
/**
|
|
15
|
+
* 空购物车状态
|
|
16
|
+
*/
|
|
17
|
+
export declare const Empty: Story;
|
|
18
|
+
/**
|
|
19
|
+
* 单件商品
|
|
20
|
+
*/
|
|
21
|
+
export declare const SingleItem: Story;
|
|
22
|
+
/**
|
|
23
|
+
* 多件商品
|
|
24
|
+
*/
|
|
25
|
+
export declare const MultipleItems: Story;
|
|
26
|
+
/**
|
|
27
|
+
* 有折扣码的购物车
|
|
28
|
+
*/
|
|
29
|
+
export declare const WithDiscount: Story;
|
|
30
|
+
/**
|
|
31
|
+
* 多个折扣码(部分失效)
|
|
32
|
+
*/
|
|
33
|
+
export declare const WithMultipleDiscounts: Story;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{CartCard as o}from"../components/LiveChatWidget/components/MessageContent/CartCard.js";const a=({content:e})=>t("div",{className:"flex min-h-screen items-center justify-center bg-gray-100 p-4",children:t("div",{className:"w-full max-w-md",children:o.render(e,!1,!1)})}),c={title:"Campaign/LiveChatWidget/MessageContent/CartCard",component:a,parameters:{layout:"fullscreen",docs:{description:{component:`
|
|
2
|
+
# \u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6
|
|
3
|
+
|
|
4
|
+
\u663E\u793A\u7528\u6237\u8D2D\u7269\u8F66\u5185\u5BB9\uFF0C\u5305\u62EC\u5546\u54C1\u5217\u8868\u3001\u4EF7\u683C\u6C47\u603B\u548C\u7ED3\u8D26\u6309\u94AE\u3002
|
|
5
|
+
|
|
6
|
+
## \u529F\u80FD\u7279\u6027
|
|
7
|
+
|
|
8
|
+
- \u{1F4E6} **\u5546\u54C1\u5217\u8868**: \u5C55\u793A\u8D2D\u7269\u8F66\u4E2D\u7684\u6240\u6709\u5546\u54C1
|
|
9
|
+
- \u{1F4B0} **\u4EF7\u683C\u6C47\u603B**: \u663E\u793A\u5C0F\u8BA1\u3001\u6298\u6263\u548C\u603B\u8BA1
|
|
10
|
+
- \u{1F39F}\uFE0F **\u6298\u6263\u7801**: \u663E\u793A\u5DF2\u5E94\u7528\u7684\u6298\u6263\u7801\u53CA\u5176\u72B6\u6001
|
|
11
|
+
- \u{1F6D2} **\u7ED3\u8D26\u6309\u94AE**: \u4E00\u952E\u8DF3\u8F6C\u5230 Shopify \u7ED3\u8D26\u9875\u9762
|
|
12
|
+
- \u{1F233} **\u7A7A\u72B6\u6001**: \u4F18\u96C5\u7684\u7A7A\u8D2D\u7269\u8F66\u63D0\u793A
|
|
13
|
+
|
|
14
|
+
## \u4F7F\u7528\u573A\u666F
|
|
15
|
+
|
|
16
|
+
- \u7528\u6237\u6DFB\u52A0\u5546\u54C1\u5230\u8D2D\u7269\u8F66\u540E (add_to_cart)
|
|
17
|
+
- \u7528\u6237\u67E5\u8BE2\u8D2D\u7269\u8F66\u5185\u5BB9 (get_cart)
|
|
18
|
+
- \u7528\u6237\u4FEE\u6539\u8D2D\u7269\u8F66\u6570\u91CF (update_cart_item)
|
|
19
|
+
- \u7528\u6237\u5E94\u7528\u6298\u6263\u7801 (update_discount_codes)
|
|
20
|
+
`}}},tags:["autodocs"]};var i=c;const d={args:{content:{type:"cart",data:{isEmpty:!0,cartId:"gid://shopify/Cart/empty",totalQuantity:0,lines:[],cost:{totalAmount:{amount:"0.00",currencyCode:"USD"},subtotalAmount:{amount:"0.00",currencyCode:"USD"}}}}}},s={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:1,lines:[{id:"gid://shopify/CartLine/12345",quantity:1,cost:{totalAmount:{amount:"99.99",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"99.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}}],cost:{totalAmount:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"99.99",currencyCode:"USD"}},checkoutUrl:"https://checkout.shopify.com/example"}}}},p={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:5,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}},{id:"gid://shopify/CartLine/12346",quantity:1,cost:{totalAmount:{amount:"129.99",currencyCode:"USD"},amountPerQuantity:{amount:"129.99",currencyCode:"USD"},subtotalAmount:{amount:"129.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567891",title:"White",price:{amount:"129.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop",altText:"eufy Security Camera"},product:{id:"gid://shopify/Product/8179159826619",title:"eufy Security Camera",handle:"eufy-security-camera"}}},{id:"gid://shopify/CartLine/12347",quantity:2,cost:{totalAmount:{amount:"79.98",currencyCode:"USD"},amountPerQuantity:{amount:"39.99",currencyCode:"USD"},subtotalAmount:{amount:"79.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567892",title:"USB-C Cable",price:{amount:"39.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=400&h=400&fit=crop",altText:"Anker USB-C Cable"},product:{id:"gid://shopify/Product/8179159826620",title:"Anker USB-C Cable 6ft",handle:"anker-usb-c-cable"}}}],cost:{totalAmount:{amount:"409.95",currencyCode:"USD"},subtotalAmount:{amount:"409.95",currencyCode:"USD"}},checkoutUrl:"https://checkout.shopify.com/example"}}}},m={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:3,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}},{id:"gid://shopify/CartLine/12346",quantity:1,cost:{totalAmount:{amount:"129.99",currencyCode:"USD"},amountPerQuantity:{amount:"129.99",currencyCode:"USD"},subtotalAmount:{amount:"129.99",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567891",title:"White",price:{amount:"129.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop",altText:"eufy Security Camera"},product:{id:"gid://shopify/Product/8179159826619",title:"eufy Security Camera",handle:"eufy-security-camera"}}}],cost:{totalAmount:{amount:"296.97",currencyCode:"USD"},subtotalAmount:{amount:"329.97",currencyCode:"USD"}},discountCodes:[{code:"SPRING20",applicable:!0}],checkoutUrl:"https://checkout.shopify.com/example"}}}},y={args:{content:{type:"cart",data:{isEmpty:!1,cartId:"gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH",totalQuantity:2,lines:[{id:"gid://shopify/CartLine/12345",quantity:2,cost:{totalAmount:{amount:"199.98",currencyCode:"USD"},amountPerQuantity:{amount:"99.99",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},merchandise:{id:"gid://shopify/ProductVariant/43234567890",title:"Black",price:{amount:"99.99",currencyCode:"USD"},image:{url:"https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop",altText:"Soundcore Space One"},product:{id:"gid://shopify/Product/8179159826618",title:"Soundcore Space One",handle:"soundcore-space-one"}}}],cost:{totalAmount:{amount:"179.98",currencyCode:"USD"},subtotalAmount:{amount:"199.98",currencyCode:"USD"}},discountCodes:[{code:"WELCOME10",applicable:!0},{code:"EXPIRED20",applicable:!1}],checkoutUrl:"https://checkout.shopify.com/example"}}}};export{d as Empty,p as MultipleItems,s as SingleItem,m as WithDiscount,y as WithMultipleDiscounts,i as default};
|
|
21
|
+
//# sourceMappingURL=CartCard.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/stories/CartCard.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * CartCard Storybook Stories\n * \u5C55\u793A\u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6\u7684\u5404\u79CD\u72B6\u6001\n */\n\nimport type { Meta, StoryObj } from '@storybook/react'\nimport React from 'react'\nimport { CartCard } from '../components/LiveChatWidget/components/MessageContent/CartCard.js'\nimport type { CartContent } from '../components/LiveChatWidget/types'\n\n// Story \u5305\u88C5\u7EC4\u4EF6\nconst CartCardWrapper: React.FC<{ content: CartContent }> = ({ content }) => {\n return (\n <div className=\"flex min-h-screen items-center justify-center bg-gray-100 p-4\">\n <div className=\"w-full max-w-md\">{CartCard.render(content, false, false)}</div>\n </div>\n )\n}\n\nconst meta: Meta<typeof CartCardWrapper> = {\n title: 'Campaign/LiveChatWidget/MessageContent/CartCard',\n component: CartCardWrapper,\n parameters: {\n layout: 'fullscreen',\n docs: {\n description: {\n component: `\n# \u8D2D\u7269\u8F66\u5361\u7247\u7EC4\u4EF6\n\n\u663E\u793A\u7528\u6237\u8D2D\u7269\u8F66\u5185\u5BB9\uFF0C\u5305\u62EC\u5546\u54C1\u5217\u8868\u3001\u4EF7\u683C\u6C47\u603B\u548C\u7ED3\u8D26\u6309\u94AE\u3002\n\n## \u529F\u80FD\u7279\u6027\n\n- \uD83D\uDCE6 **\u5546\u54C1\u5217\u8868**: \u5C55\u793A\u8D2D\u7269\u8F66\u4E2D\u7684\u6240\u6709\u5546\u54C1\n- \uD83D\uDCB0 **\u4EF7\u683C\u6C47\u603B**: \u663E\u793A\u5C0F\u8BA1\u3001\u6298\u6263\u548C\u603B\u8BA1\n- \uD83C\uDF9F\uFE0F **\u6298\u6263\u7801**: \u663E\u793A\u5DF2\u5E94\u7528\u7684\u6298\u6263\u7801\u53CA\u5176\u72B6\u6001\n- \uD83D\uDED2 **\u7ED3\u8D26\u6309\u94AE**: \u4E00\u952E\u8DF3\u8F6C\u5230 Shopify \u7ED3\u8D26\u9875\u9762\n- \uD83C\uDE33 **\u7A7A\u72B6\u6001**: \u4F18\u96C5\u7684\u7A7A\u8D2D\u7269\u8F66\u63D0\u793A\n\n## \u4F7F\u7528\u573A\u666F\n\n- \u7528\u6237\u6DFB\u52A0\u5546\u54C1\u5230\u8D2D\u7269\u8F66\u540E (add_to_cart)\n- \u7528\u6237\u67E5\u8BE2\u8D2D\u7269\u8F66\u5185\u5BB9 (get_cart)\n- \u7528\u6237\u4FEE\u6539\u8D2D\u7269\u8F66\u6570\u91CF (update_cart_item)\n- \u7528\u6237\u5E94\u7528\u6298\u6263\u7801 (update_discount_codes)\n `,\n },\n },\n },\n tags: ['autodocs'],\n}\n\nexport default meta\n\ntype Story = StoryObj<typeof CartCardWrapper>\n\n/**\n * \u7A7A\u8D2D\u7269\u8F66\u72B6\u6001\n */\nexport const Empty: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: true,\n cartId: 'gid://shopify/Cart/empty',\n totalQuantity: 0,\n lines: [],\n cost: {\n totalAmount: {\n amount: '0.00',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '0.00',\n currencyCode: 'USD',\n },\n },\n },\n },\n },\n}\n\n/**\n * \u5355\u4EF6\u5546\u54C1\n */\nexport const SingleItem: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 1,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n },\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u591A\u4EF6\u5546\u54C1\n */\nexport const MultipleItems: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 5,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12346',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567891',\n title: 'White',\n price: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop',\n altText: 'eufy Security Camera',\n },\n product: {\n id: 'gid://shopify/Product/8179159826619',\n title: 'eufy Security Camera',\n handle: 'eufy-security-camera',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12347',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '79.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '39.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '79.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567892',\n title: 'USB-C Cable',\n price: {\n amount: '39.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=400&h=400&fit=crop',\n altText: 'Anker USB-C Cable',\n },\n product: {\n id: 'gid://shopify/Product/8179159826620',\n title: 'Anker USB-C Cable 6ft',\n handle: 'anker-usb-c-cable',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '409.95',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '409.95',\n currencyCode: 'USD',\n },\n },\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u6709\u6298\u6263\u7801\u7684\u8D2D\u7269\u8F66\n */\nexport const WithDiscount: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 3,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n {\n id: 'gid://shopify/CartLine/12346',\n quantity: 1,\n cost: {\n totalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567891',\n title: 'White',\n price: {\n amount: '129.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop',\n altText: 'eufy Security Camera',\n },\n product: {\n id: 'gid://shopify/Product/8179159826619',\n title: 'eufy Security Camera',\n handle: 'eufy-security-camera',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '296.97',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '329.97',\n currencyCode: 'USD',\n },\n },\n discountCodes: [\n {\n code: 'SPRING20',\n applicable: true,\n },\n ],\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n\n/**\n * \u591A\u4E2A\u6298\u6263\u7801\uFF08\u90E8\u5206\u5931\u6548\uFF09\n */\nexport const WithMultipleDiscounts: Story = {\n args: {\n content: {\n type: 'cart',\n data: {\n isEmpty: false,\n cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',\n totalQuantity: 2,\n lines: [\n {\n id: 'gid://shopify/CartLine/12345',\n quantity: 2,\n cost: {\n totalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n amountPerQuantity: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n merchandise: {\n id: 'gid://shopify/ProductVariant/43234567890',\n title: 'Black',\n price: {\n amount: '99.99',\n currencyCode: 'USD',\n },\n image: {\n url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',\n altText: 'Soundcore Space One',\n },\n product: {\n id: 'gid://shopify/Product/8179159826618',\n title: 'Soundcore Space One',\n handle: 'soundcore-space-one',\n },\n },\n },\n ],\n cost: {\n totalAmount: {\n amount: '179.98',\n currencyCode: 'USD',\n },\n subtotalAmount: {\n amount: '199.98',\n currencyCode: 'USD',\n },\n },\n discountCodes: [\n {\n code: 'WELCOME10',\n applicable: true,\n },\n {\n code: 'EXPIRED20',\n applicable: false,\n },\n ],\n checkoutUrl: 'https://checkout.shopify.com/example',\n },\n },\n },\n}\n"],
|
|
5
|
+
"mappings": "AAcM,cAAAA,MAAA,oBAPN,OAAS,YAAAC,MAAgB,qEAIzB,MAAMC,EAAsD,CAAC,CAAE,QAAAC,CAAQ,IAEnEH,EAAC,OAAI,UAAU,gEACb,SAAAA,EAAC,OAAI,UAAU,kBAAmB,SAAAC,EAAS,OAAOE,EAAS,GAAO,EAAK,EAAE,EAC3E,EAIEC,EAAqC,CACzC,MAAO,kDACP,UAAWF,EACX,WAAY,CACV,OAAQ,aACR,KAAM,CACJ,YAAa,CACX,UAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAoBb,CACF,CACF,EACA,KAAM,CAAC,UAAU,CACnB,EAEA,IAAOG,EAAQD,EAOR,MAAME,EAAe,CAC1B,KAAM,CACJ,QAAS,CACP,KAAM,OACN,KAAM,CACJ,QAAS,GACT,OAAQ,2BACR,cAAe,EACf,MAAO,CAAC,EACR,KAAM,CACJ,YAAa,CACX,OAAQ,OACR,aAAc,KAChB,EACA,eAAgB,CACd,OAAQ,OACR,aAAc,KAChB,CACF,CACF,CACF,CACF,CACF,EAKaC,EAAoB,CAC/B,KAAM,CACJ,QAAS,CACP,KAAM,OACN,KAAM,CACJ,QAAS,GACT,OAAQ,0EACR,cAAe,EACf,MAAO,CACL,CACE,GAAI,+BAC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K,oFACL,QAAS,sBACX,EACA,QAAS,CACP,GAAI,sCACJ,MAAO,uBACP,OAAQ,sBACV,CACF,CACF,CACF,EACA,KAAM,CACJ,YAAa,CACX,OAAQ,SACR,aAAc,KAChB,EACA,eAAgB,CACd,OAAQ,SACR,aAAc,KAChB,CACF,EACA,cAAe,CACb,CACE,KAAM,WACN,WAAY,EACd,CACF,EACA,YAAa,sCACf,CACF,CACF,CACF,EAKaC,EAA+B,CAC1C,KAAM,CACJ,QAAS,CACP,KAAM,OACN,KAAM,CACJ,QAAS,GACT,OAAQ,0EACR,cAAe,EACf,MAAO,CACL,CACE,GAAI,+BACJ,SAAU,EACV,KAAM,CACJ,YAAa,CACX,OAAQ,SACR,aAAc,KAChB,EACA,kBAAmB,CACjB,OAAQ,QACR,aAAc,KAChB,EACA,eAAgB,CACd,OAAQ,SACR,aAAc,KAChB,CACF,EACA,YAAa,CACX,GAAI,2CACJ,MAAO,QACP,MAAO,CACL,OAAQ,QACR,aAAc,KAChB,EACA,MAAO,CACL,IAAK,oFACL,QAAS,qBACX,EACA,QAAS,CACP,GAAI,sCACJ,MAAO,sBACP,OAAQ,qBACV,CACF,CACF,CACF,EACA,KAAM,CACJ,YAAa,CACX,OAAQ,SACR,aAAc,KAChB,EACA,eAAgB,CACd,OAAQ,SACR,aAAc,KAChB,CACF,EACA,cAAe,CACb,CACE,KAAM,YACN,WAAY,EACd,EACA,CACE,KAAM,YACN,WAAY,EACd,CACF,EACA,YAAa,sCACf,CACF,CACF,CACF",
|
|
6
|
+
"names": ["jsx", "CartCard", "CartCardWrapper", "content", "meta", "CartCard_stories_default", "Empty", "SingleItem", "MultipleItems", "WithDiscount", "WithMultipleDiscounts"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anker-in/campaign-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1-beta.2",
|
|
4
4
|
"description": "Campaign UI components and utilities for Anker projects",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -36,6 +36,20 @@
|
|
|
36
36
|
"**/*.css",
|
|
37
37
|
"**/**/*.css"
|
|
38
38
|
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"dev": "pnpm run dev:css & tsup --watch",
|
|
41
|
+
"dev:css": "postcss src/styles/global.css -o style.css --watch",
|
|
42
|
+
"build": "pnpm run build:css & pnpm run build:js:esm & pnpm run build:js:cjs & pnpm run build:js:esm:types & pnpm run build:js:cjs:types",
|
|
43
|
+
"build:js:cjs": "node esbuild-cjs.mjs",
|
|
44
|
+
"build:js:cjs:types": "tsc --outdir dist/cjs",
|
|
45
|
+
"build:js:esm": "node esbuild-esm.mjs",
|
|
46
|
+
"build:js:esm:types": "tsc --outdir dist/esm",
|
|
47
|
+
"build:css": "postcss src/styles/global.css -o style.css",
|
|
48
|
+
"lint": "eslint \"src/**/*.ts*\"",
|
|
49
|
+
"test": "echo run @anker-in/campaign-ui tests",
|
|
50
|
+
"type-check": "tsc --noEmit",
|
|
51
|
+
"clean": "rm -rf .turbo node_modules dist style.css"
|
|
52
|
+
},
|
|
39
53
|
"keywords": [],
|
|
40
54
|
"author": "",
|
|
41
55
|
"license": "ISC",
|
|
@@ -66,6 +80,8 @@
|
|
|
66
80
|
"crypto-js": "^4.1.1"
|
|
67
81
|
},
|
|
68
82
|
"dependencies": {
|
|
83
|
+
"@anker-in/headless-ui": "workspace:*",
|
|
84
|
+
"@anker-in/lib": "workspace:*",
|
|
69
85
|
"@copilotkit/react-core": "1.1.2",
|
|
70
86
|
"@copilotkit/react-ui": "1.1.2",
|
|
71
87
|
"@copilotkit/runtime-client-gql": "1.1.2",
|
|
@@ -95,8 +111,7 @@
|
|
|
95
111
|
"remark-gfm": "^4.0.1",
|
|
96
112
|
"swiper": "^11.1.3",
|
|
97
113
|
"tailwind-merge": "^2.3.0",
|
|
98
|
-
"tailwindcss": "^3.4.3"
|
|
99
|
-
"@anker-in/lib": "1.1.4"
|
|
114
|
+
"tailwindcss": "^3.4.3"
|
|
100
115
|
},
|
|
101
116
|
"publishConfig": {
|
|
102
117
|
"access": "public",
|
|
@@ -104,19 +119,5 @@
|
|
|
104
119
|
},
|
|
105
120
|
"exclude": [
|
|
106
121
|
"dist/**/*"
|
|
107
|
-
]
|
|
108
|
-
|
|
109
|
-
"dev": "pnpm run dev:css & tsup --watch",
|
|
110
|
-
"dev:css": "postcss src/styles/global.css -o style.css --watch",
|
|
111
|
-
"build": "pnpm run build:css & pnpm run build:js:esm & pnpm run build:js:cjs & pnpm run build:js:esm:types & pnpm run build:js:cjs:types",
|
|
112
|
-
"build:js:cjs": "node esbuild-cjs.mjs",
|
|
113
|
-
"build:js:cjs:types": "tsc --outdir dist/cjs",
|
|
114
|
-
"build:js:esm": "node esbuild-esm.mjs",
|
|
115
|
-
"build:js:esm:types": "tsc --outdir dist/esm",
|
|
116
|
-
"build:css": "postcss src/styles/global.css -o style.css",
|
|
117
|
-
"lint": "eslint \"src/**/*.ts*\"",
|
|
118
|
-
"test": "echo run @anker-in/campaign-ui tests",
|
|
119
|
-
"type-check": "tsc --noEmit",
|
|
120
|
-
"clean": "rm -rf .turbo node_modules dist style.css"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
@@ -97,7 +97,21 @@ export const FAQList: React.FC<FAQListProps> = ({ content, onQuestionClick }) =>
|
|
|
97
97
|
className="prose prose-sm max-w-none border-t border-gray-100 text-sm font-bold leading-[1.4] tracking-[-0.02em] text-[#4A4C56]"
|
|
98
98
|
style={{ paddingTop: '12px' }}
|
|
99
99
|
>
|
|
100
|
-
<ReactMarkdown
|
|
100
|
+
<ReactMarkdown
|
|
101
|
+
remarkPlugins={[remarkGfm]}
|
|
102
|
+
components={{
|
|
103
|
+
a: ({ node, ...props }) => (
|
|
104
|
+
<a
|
|
105
|
+
{...props}
|
|
106
|
+
className="livechat-link livechat-link-bot"
|
|
107
|
+
target="_blank"
|
|
108
|
+
rel="noopener noreferrer"
|
|
109
|
+
/>
|
|
110
|
+
),
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{item.answer}
|
|
114
|
+
</ReactMarkdown>
|
|
101
115
|
</div>
|
|
102
116
|
|
|
103
117
|
{/* 相关问题 */}
|
|
@@ -117,6 +117,14 @@ const PolicyCard: React.FC<{
|
|
|
117
117
|
ol: ({ node, ...props }) => <ol {...props} className="mb-2 ml-4 list-decimal" />,
|
|
118
118
|
li: ({ node, ...props }) => <li {...props} className="mb-1" />,
|
|
119
119
|
strong: ({ node, ...props }) => <strong {...props} className="font-bold" />,
|
|
120
|
+
a: ({ node, ...props }) => (
|
|
121
|
+
<a
|
|
122
|
+
{...props}
|
|
123
|
+
className="livechat-link livechat-link-bot"
|
|
124
|
+
target="_blank"
|
|
125
|
+
rel="noopener noreferrer"
|
|
126
|
+
/>
|
|
127
|
+
),
|
|
120
128
|
}}
|
|
121
129
|
>
|
|
122
130
|
{content}
|
|
@@ -47,10 +47,12 @@ export const TextBlock: MessageRenderer = {
|
|
|
47
47
|
remarkPlugins={[remarkGfm]}
|
|
48
48
|
components={{
|
|
49
49
|
// 自定义链接样式
|
|
50
|
+
// livechat-link-user / livechat-link-bot 用于区分用户输入链接与机器人回复链接的颜色,
|
|
51
|
+
// 调用方可直接覆盖这两个类名自定义颜色(见 styles/livechat.css)
|
|
50
52
|
a: ({ node, ...props }) => (
|
|
51
53
|
<a
|
|
52
54
|
{...props}
|
|
53
|
-
className={`underline ${isUser ? '
|
|
55
|
+
className={`livechat-link underline ${isUser ? 'livechat-link-user' : 'livechat-link-bot'}`}
|
|
54
56
|
target="_blank"
|
|
55
57
|
rel="noopener noreferrer"
|
|
56
58
|
/>
|
|
@@ -13,6 +13,7 @@ export const useSubscribed = () => {
|
|
|
13
13
|
|
|
14
14
|
const { activities } = useActivities(activitiesOptions)
|
|
15
15
|
const { data: subscription } = useSubscriptions({ email: profile?.email })
|
|
16
|
+
//@ts-ignore
|
|
16
17
|
const subscriptionData = subscription?.data || subscription
|
|
17
18
|
|
|
18
19
|
const isSubscribed = useMemo(() => {
|
package/src/components/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as Chat } from './chat/index'
|
|
1
|
+
export { default as Chat } from './chat/index.js'
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
4
|
Role,
|
|
@@ -7,7 +7,7 @@ export {
|
|
|
7
7
|
useCopilotChat,
|
|
8
8
|
useCopilotAction,
|
|
9
9
|
useCopilotReadable,
|
|
10
|
-
} from './chat/utils'
|
|
10
|
+
} from './chat/utils.js'
|
|
11
11
|
|
|
12
12
|
export * from './credits/index.js'
|
|
13
13
|
|