@salla.sa/ui-ai-kit-core 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ai-card.cjs.entry.js +2 -2
- package/dist/cjs/ai-chat-container.cjs.entry.js +84 -57
- package/dist/cjs/ai-chat-header.cjs.entry.js +29 -19
- package/dist/cjs/ai-chat-message.cjs.entry.js +1456 -21
- package/dist/cjs/ai-conversation-list.cjs.entry.js +80 -0
- package/dist/cjs/ai-conversation-summary.cjs.entry.js +33 -0
- package/dist/cjs/ai-icon.cjs.entry.js +2 -2
- package/dist/cjs/ai-link.cjs.entry.js +4 -4
- package/dist/cjs/ai-loading.cjs.entry.js +35 -22
- package/dist/cjs/ai-message-input.cjs.entry.js +48 -15
- package/dist/cjs/ai-rating.cjs.entry.js +2 -2
- package/dist/cjs/ai-route-decision.cjs.entry.js +48 -0
- package/dist/cjs/ai-suggestion.cjs.entry.js +4 -4
- package/dist/cjs/ai-voice-input.cjs.entry.js +75 -21
- package/dist/cjs/{icon-registry-dmfLA-Dj.js → icon-registry-BKb9-2Nt.js} +24 -0
- package/dist/cjs/{index-DLJcLHFH.js → index-BkNg07SW.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/ui-ai-kit.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/ai-card/ai-card.css +5 -8
- package/dist/collection/components/ai-chat-container/ai-chat-container.css +17 -14
- package/dist/collection/components/ai-chat-container/ai-chat-container.js +125 -53
- package/dist/collection/components/ai-chat-header/ai-chat-header.css +50 -17
- package/dist/collection/components/ai-chat-header/ai-chat-header.js +53 -18
- package/dist/collection/components/ai-chat-message/ai-chat-message.css +47 -38
- package/dist/collection/components/ai-chat-message/ai-chat-message.js +68 -18
- package/dist/collection/components/ai-conversation-list/ai-conversation-list.css +196 -0
- package/dist/collection/components/ai-conversation-list/ai-conversation-list.js +176 -0
- package/dist/collection/components/ai-conversation-summary/ai-conversation-summary.css +103 -0
- package/dist/collection/components/ai-conversation-summary/ai-conversation-summary.js +118 -0
- package/dist/collection/components/ai-icon/ai-icon.js +1 -1
- package/dist/collection/components/ai-link/ai-link.css +3 -7
- package/dist/collection/components/ai-link/ai-link.js +1 -1
- package/dist/collection/components/ai-loading/ai-loading.css +149 -20
- package/dist/collection/components/ai-loading/ai-loading.js +100 -23
- package/dist/collection/components/ai-message-input/ai-message-input.css +41 -37
- package/dist/collection/components/ai-message-input/ai-message-input.js +100 -19
- package/dist/collection/components/ai-rating/ai-rating.css +8 -14
- package/dist/collection/components/ai-route-decision/ai-route-decision.css +132 -0
- package/dist/collection/components/ai-route-decision/ai-route-decision.js +195 -0
- package/dist/collection/components/ai-suggestion/ai-suggestion.css +5 -11
- package/dist/collection/components/ai-suggestion/ai-suggestion.js +2 -2
- package/dist/collection/components/ai-voice-input/ai-voice-input.css +27 -22
- package/dist/collection/components/ai-voice-input/ai-voice-input.js +116 -20
- package/dist/collection/utils/icon-registry.js +24 -0
- package/dist/components/ai-card.js +1 -1
- package/dist/components/ai-chat-container.js +1 -1
- package/dist/components/ai-chat-header.js +1 -1
- package/dist/components/ai-chat-message.js +2 -1
- package/dist/components/ai-conversation-list.d.ts +11 -0
- package/dist/components/ai-conversation-list.js +1 -0
- package/dist/components/ai-conversation-summary.d.ts +11 -0
- package/dist/components/ai-conversation-summary.js +1 -0
- package/dist/components/ai-icon.js +1 -1
- package/dist/components/ai-link.js +1 -1
- package/dist/components/ai-loading.js +1 -1
- package/dist/components/ai-message-input.js +1 -1
- package/dist/components/ai-rating.js +1 -1
- package/dist/components/ai-route-decision.d.ts +11 -0
- package/dist/components/ai-route-decision.js +1 -0
- package/dist/components/ai-suggestion.js +1 -1
- package/dist/components/ai-voice-input.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-CX1Yp79q.js +1 -0
- package/dist/components/p-DnO4dikr.js +1 -0
- package/dist/components/{p-CY6emva2.js → p-Dr2tAPV7.js} +1 -1
- package/dist/{ui-ai-kit/p-DYv5ef4M.js → components/p-SJZ6Ujn9.js} +1 -1
- package/dist/esm/ai-card.entry.js +2 -2
- package/dist/esm/ai-chat-container.entry.js +84 -57
- package/dist/esm/ai-chat-header.entry.js +29 -19
- package/dist/esm/ai-chat-message.entry.js +1456 -21
- package/dist/esm/ai-conversation-list.entry.js +78 -0
- package/dist/esm/ai-conversation-summary.entry.js +31 -0
- package/dist/esm/ai-icon.entry.js +2 -2
- package/dist/esm/ai-link.entry.js +4 -4
- package/dist/esm/ai-loading.entry.js +35 -22
- package/dist/esm/ai-message-input.entry.js +48 -15
- package/dist/esm/ai-rating.entry.js +2 -2
- package/dist/esm/ai-route-decision.entry.js +46 -0
- package/dist/esm/ai-suggestion.entry.js +4 -4
- package/dist/esm/ai-voice-input.entry.js +75 -21
- package/dist/esm/{icon-registry-DYv5ef4M.js → icon-registry-SJZ6Ujn9.js} +24 -0
- package/dist/esm/{index-7hrZ8FOQ.js → index-B0yIzgh4.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/ui-ai-kit.js +3 -3
- package/dist/types/components/ai-chat-container/ai-chat-container.d.ts +11 -1
- package/dist/types/components/ai-chat-header/ai-chat-header.d.ts +7 -2
- package/dist/types/components/ai-conversation-list/ai-conversation-list.d.ts +24 -0
- package/dist/types/components/ai-conversation-summary/ai-conversation-summary.d.ts +12 -0
- package/dist/types/components/ai-loading/ai-loading.d.ts +12 -6
- package/dist/types/components/ai-message-input/ai-message-input.d.ts +17 -3
- package/dist/types/components/ai-route-decision/ai-route-decision.d.ts +21 -0
- package/dist/types/components/ai-voice-input/ai-voice-input.d.ts +7 -0
- package/dist/types/components.d.ts +335 -11
- package/dist/types/index.d.ts +2 -0
- package/dist/types/utils/icon-registry.d.ts +1 -1
- package/dist/ui-ai-kit/p-2955439f.entry.js +1 -0
- package/dist/ui-ai-kit/p-5c9e9822.entry.js +1 -0
- package/dist/ui-ai-kit/p-5caf1c38.entry.js +1 -0
- package/dist/ui-ai-kit/p-74c5c83f.entry.js +1 -0
- package/dist/ui-ai-kit/p-76195745.entry.js +1 -0
- package/dist/ui-ai-kit/p-79c78d8e.entry.js +1 -0
- package/dist/ui-ai-kit/p-87e9739b.entry.js +1 -0
- package/dist/ui-ai-kit/p-9c4c6c01.entry.js +1 -0
- package/dist/ui-ai-kit/p-B0yIzgh4.js +2 -0
- package/dist/{components/p-DYv5ef4M.js → ui-ai-kit/p-SJZ6Ujn9.js} +1 -1
- package/dist/ui-ai-kit/p-a099fcfb.entry.js +1 -0
- package/dist/ui-ai-kit/p-b28af13a.entry.js +1 -0
- package/dist/ui-ai-kit/p-d1bb1ad0.entry.js +1 -0
- package/dist/ui-ai-kit/p-eb0c7e7a.entry.js +1 -0
- package/dist/ui-ai-kit/{p-455daa17.entry.js → p-eec6f083.entry.js} +1 -1
- package/dist/ui-ai-kit/p-ef07638f.entry.js +2 -0
- package/dist/ui-ai-kit/ui-ai-kit.css +1 -1
- package/dist/ui-ai-kit/ui-ai-kit.esm.js +1 -1
- package/package.json +5 -13
- package/dist/collection/components/ai-card/ai-card.stories.js +0 -52
- package/dist/collection/components/ai-chat-container/ai-chat-container.stories.js +0 -160
- package/dist/collection/components/ai-chat-header/ai-chat-header.stories.js +0 -138
- package/dist/collection/components/ai-chat-message/ai-chat-message.stories.js +0 -164
- package/dist/collection/components/ai-link/ai-link.stories.js +0 -79
- package/dist/collection/components/ai-loading/ai-loading.stories.js +0 -145
- package/dist/collection/components/ai-message-input/ai-message-input.stories.js +0 -125
- package/dist/collection/components/ai-rating/ai-rating.stories.js +0 -78
- package/dist/collection/components/ai-suggestion/ai-suggestion.stories.js +0 -62
- package/dist/collection/components/ai-voice-input/ai-voice-input.stories.js +0 -118
- package/dist/components/p-CWjXxYJI.js +0 -1
- package/dist/types/components/ai-card/ai-card.stories.d.ts +0 -7
- package/dist/types/components/ai-chat-container/ai-chat-container.stories.d.ts +0 -7
- package/dist/types/components/ai-chat-header/ai-chat-header.stories.d.ts +0 -8
- package/dist/types/components/ai-chat-message/ai-chat-message.stories.d.ts +0 -10
- package/dist/types/components/ai-link/ai-link.stories.d.ts +0 -8
- package/dist/types/components/ai-loading/ai-loading.stories.d.ts +0 -10
- package/dist/types/components/ai-message-input/ai-message-input.stories.d.ts +0 -13
- package/dist/types/components/ai-rating/ai-rating.stories.d.ts +0 -8
- package/dist/types/components/ai-suggestion/ai-suggestion.stories.d.ts +0 -8
- package/dist/types/components/ai-voice-input/ai-voice-input.stories.d.ts +0 -9
- package/dist/ui-ai-kit/p-11facfad.entry.js +0 -1
- package/dist/ui-ai-kit/p-128a2ed4.entry.js +0 -1
- package/dist/ui-ai-kit/p-227bdb8f.entry.js +0 -1
- package/dist/ui-ai-kit/p-56163e8c.entry.js +0 -1
- package/dist/ui-ai-kit/p-6d21d0fd.entry.js +0 -1
- package/dist/ui-ai-kit/p-6ddcd77b.entry.js +0 -1
- package/dist/ui-ai-kit/p-7hrZ8FOQ.js +0 -2
- package/dist/ui-ai-kit/p-8e90143e.entry.js +0 -1
- package/dist/ui-ai-kit/p-9938c277.entry.js +0 -1
- package/dist/ui-ai-kit/p-dc5b4a7f.entry.js +0 -1
- package/dist/ui-ai-kit/p-fb1702de.entry.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/ui-ai-kit-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -42,34 +42,26 @@
|
|
|
42
42
|
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
43
43
|
"generate": "stencil generate",
|
|
44
44
|
"clean": "rm -rf dist loader/index.js loader/index.cjs loader/index.d.ts",
|
|
45
|
-
"
|
|
46
|
-
"storybook:clean": "rm -rf node_modules/.cache/storybook && npm run storybook",
|
|
47
|
-
"build-storybook": "storybook build",
|
|
48
|
-
"dev": "concurrently \"npm run build:watch\" \"npm run storybook\" --names \"stencil,storybook\" --prefix-colors \"cyan,magenta\""
|
|
45
|
+
"dev": "npm run build:watch"
|
|
49
46
|
},
|
|
50
47
|
"peerDependencies": {
|
|
51
48
|
"@salla.sa/ui-merchant-styles": "*"
|
|
52
49
|
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"dompurify": "^3.3.3"
|
|
52
|
+
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@chromatic-com/storybook": "^5.0.1",
|
|
55
54
|
"@salla.sa/ui-merchant-styles": "0.307.5",
|
|
56
55
|
"@stencil/core": "^4.27.1",
|
|
57
56
|
"@stencil/react-output-target": "^1.4.2",
|
|
58
|
-
"@storybook/addon-a11y": "^10.2.16",
|
|
59
|
-
"@storybook/addon-docs": "^10.2.16",
|
|
60
|
-
"@storybook/addon-vitest": "^10.2.16",
|
|
61
|
-
"@storybook/web-components-vite": "^10.2.16",
|
|
62
57
|
"@types/jest": "^29.5.14",
|
|
63
58
|
"@types/node": "^22.13.5",
|
|
64
59
|
"@vitest/browser-playwright": "^4.0.18",
|
|
65
60
|
"@vitest/coverage-v8": "^4.0.18",
|
|
66
|
-
"concurrently": "^8.2.2",
|
|
67
61
|
"jest": "^29.7.0",
|
|
68
62
|
"jest-cli": "^29.7.0",
|
|
69
|
-
"lit": "^3.3.2",
|
|
70
63
|
"playwright": "^1.58.2",
|
|
71
64
|
"puppeteer": "^24.3.0",
|
|
72
|
-
"storybook": "^10.2.16",
|
|
73
65
|
"vitest": "^4.0.18"
|
|
74
66
|
},
|
|
75
67
|
"license": "MIT"
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { html } from "lit";
|
|
2
|
-
const meta = {
|
|
3
|
-
title: 'UI/Card',
|
|
4
|
-
component: 'ai-card',
|
|
5
|
-
tags: ['autodocs'],
|
|
6
|
-
argTypes: {
|
|
7
|
-
noPadding: { control: 'boolean' },
|
|
8
|
-
noShadow: { control: 'boolean' },
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
export default meta;
|
|
12
|
-
const wrapStyle = 'padding: 24px; background: #f3f4f6; direction: rtl; max-width: 420px;';
|
|
13
|
-
/* ─── AI Reply (matches Figma node 1422-47585) ───────────────────────────── */
|
|
14
|
-
export const AiReply = {
|
|
15
|
-
render: () => html `
|
|
16
|
-
<div style="${wrapStyle}">
|
|
17
|
-
<ai-card>
|
|
18
|
-
<p style="margin:0; font-size:14px; font-weight:500; color:#333; line-height:20px;">
|
|
19
|
-
أهلاً بك في ذكاء سلة الاصطناعي!
|
|
20
|
-
</p>
|
|
21
|
-
<p style="margin:0; font-size:14px; color:#737373; line-height:20px;">
|
|
22
|
-
أنا هنا لمساعدتك في إنشاء شرائح عملاء قوية لحملاتك التسويقية باستخدام لغة بسيطة وتفاعلية.
|
|
23
|
-
</p>
|
|
24
|
-
<p style="margin:0; font-size:14px; color:#737373; line-height:20px;">
|
|
25
|
-
يمكنك أن تطلب مني العثور على العملاء بناءً على تاريخ مشترياتهم، مثل "أظهر لي كل من اشترى الشهر الماضي." ما نوع الجمهور الذي ترغب في بنائه اليوم؟
|
|
26
|
-
</p>
|
|
27
|
-
</ai-card>
|
|
28
|
-
</div>
|
|
29
|
-
`,
|
|
30
|
-
};
|
|
31
|
-
/* ─── With Rating (Figma node 1532-65078) ────────────────────────────────── */
|
|
32
|
-
export const WithRating = {
|
|
33
|
-
render: () => html `
|
|
34
|
-
<div style="${wrapStyle}">
|
|
35
|
-
<ai-card>
|
|
36
|
-
<ai-rating></ai-rating>
|
|
37
|
-
</ai-card>
|
|
38
|
-
</div>
|
|
39
|
-
`,
|
|
40
|
-
};
|
|
41
|
-
/* ─── No Padding ─────────────────────────────────────────────────────────── */
|
|
42
|
-
export const NoPadding = {
|
|
43
|
-
render: () => html `
|
|
44
|
-
<div style="${wrapStyle}">
|
|
45
|
-
<ai-card no-padding>
|
|
46
|
-
<div style="padding:16px; background:#f4f4f4; color:#333; font-size:14px;">
|
|
47
|
-
محتوى بدون padding من البطاقة
|
|
48
|
-
</div>
|
|
49
|
-
</ai-card>
|
|
50
|
-
</div>
|
|
51
|
-
`,
|
|
52
|
-
};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { html, render } from "lit";
|
|
2
|
-
const meta = {
|
|
3
|
-
title: 'Chat/Chat Container',
|
|
4
|
-
component: 'ai-chat-container',
|
|
5
|
-
tags: ['autodocs'],
|
|
6
|
-
argTypes: {
|
|
7
|
-
isOpen: {
|
|
8
|
-
control: 'boolean',
|
|
9
|
-
description: 'Controls visibility of the chat panel',
|
|
10
|
-
},
|
|
11
|
-
position: {
|
|
12
|
-
control: { type: 'select' },
|
|
13
|
-
options: ['left', 'right', 'float'],
|
|
14
|
-
description: 'Position of the panel',
|
|
15
|
-
},
|
|
16
|
-
width: {
|
|
17
|
-
control: 'text',
|
|
18
|
-
description: 'Width of the panel (CSS value, e.g., "400px", "30%", "28rem")',
|
|
19
|
-
},
|
|
20
|
-
floatHeight: {
|
|
21
|
-
control: 'text',
|
|
22
|
-
description: 'Height of the panel when position="float" (CSS value, e.g., "600px")',
|
|
23
|
-
},
|
|
24
|
-
autoScroll: {
|
|
25
|
-
control: 'boolean',
|
|
26
|
-
description: 'Enable/disable auto-scroll to latest message',
|
|
27
|
-
},
|
|
28
|
-
showWatermark: {
|
|
29
|
-
control: 'boolean',
|
|
30
|
-
description: 'Show AI watermark in the top half of the container',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
export default meta;
|
|
35
|
-
export const StickyRight = {
|
|
36
|
-
render: args => html `
|
|
37
|
-
<div style="position: relative; height: 600px; background: #f3f4f6;">
|
|
38
|
-
<ai-chat-container
|
|
39
|
-
?is-open="${args.isOpen}"
|
|
40
|
-
position="${args.position}"
|
|
41
|
-
width="${args.width}"
|
|
42
|
-
?auto-scroll="${args.autoScroll}"
|
|
43
|
-
?show-watermark="${args.showWatermark}"
|
|
44
|
-
float-height="${args.floatHeight}"
|
|
45
|
-
></ai-chat-container>
|
|
46
|
-
</div>
|
|
47
|
-
`,
|
|
48
|
-
args: {
|
|
49
|
-
isOpen: true,
|
|
50
|
-
position: 'right',
|
|
51
|
-
width: '28rem',
|
|
52
|
-
autoScroll: true,
|
|
53
|
-
showWatermark: true,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
export const FloatMode = {
|
|
57
|
-
render: args => html `
|
|
58
|
-
<div style="height: 700px; background: #f3f4f6; position: relative;">
|
|
59
|
-
<p style="padding: 2rem; color: #6b7280;">The floating panel appears in the top-left corner. Drag it by the grip icon in the header.</p>
|
|
60
|
-
<ai-chat-container
|
|
61
|
-
?is-open="${args.isOpen}"
|
|
62
|
-
position="${args.position}"
|
|
63
|
-
width="${args.width}"
|
|
64
|
-
float-height="${args.floatHeight}"
|
|
65
|
-
?auto-scroll="${args.autoScroll}"
|
|
66
|
-
?show-watermark="${args.showWatermark}"
|
|
67
|
-
>
|
|
68
|
-
<ai-chat-header slot="header" conversation="AI Assistant" is-draggable></ai-chat-header>
|
|
69
|
-
</ai-chat-container>
|
|
70
|
-
</div>
|
|
71
|
-
`,
|
|
72
|
-
args: {
|
|
73
|
-
isOpen: true,
|
|
74
|
-
position: 'float',
|
|
75
|
-
width: '28rem',
|
|
76
|
-
floatHeight: '600px',
|
|
77
|
-
autoScroll: true,
|
|
78
|
-
showWatermark: true,
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
export const ShowcaseConversation = {
|
|
82
|
-
render: () => {
|
|
83
|
-
const steps = JSON.stringify([
|
|
84
|
-
{ id: '1', title: 'مقارنة الباقات المتاحة', status: 'completed' },
|
|
85
|
-
{ id: '2', title: 'تحليل الفروقات والمزايا', status: 'completed' },
|
|
86
|
-
{ id: '3', title: 'تجهيز التوصية المناسبة', status: 'executing' },
|
|
87
|
-
{ id: '4', title: 'إعداد الروابط والمصادر', status: 'pending' },
|
|
88
|
-
]);
|
|
89
|
-
const t = (offsetMs) => new Date(Date.now() - offsetMs).toISOString();
|
|
90
|
-
const comparisonContent = `باقة **بلس** مناسبة للمتاجر الصغيرة والمتوسطة، بينما باقة **برو** مصممة للمتاجر الكبيرة اللي تحتاج منتجات غير محدودة وعمولات أقل ودعم فني على مدار الساعة.\n\n**التوصية:** إذا كنت تتوقع نمواً سريعاً، باقة **برو** هي الأنسب.`;
|
|
91
|
-
const root = document.createElement('div');
|
|
92
|
-
let showVoice = false;
|
|
93
|
-
const update = () => {
|
|
94
|
-
render(html `
|
|
95
|
-
<div style="position: relative; height: 700px; background: #f3f4f6;">
|
|
96
|
-
<ai-chat-container is-open position="float" float-height="800px" width="28rem" auto-scroll>
|
|
97
|
-
<ai-chat-header slot="header" is-draggable mode="agent" conversation="مساعد سلة"></ai-chat-header>
|
|
98
|
-
|
|
99
|
-
<div style="padding:1rem; display:flex; flex-direction:column; gap:0.75rem;">
|
|
100
|
-
<ai-chat-message role="agent" enable-regenerate content="أهلاً وسهلاً! أنا مساعد سلة الذكي 🤖 كيف أقدر أساعدك اليوم؟" agent-name="سلة AI" timestamp="${t(300000)}">
|
|
101
|
-
<div style="display:flex; flex-wrap:wrap; gap:0.5rem;">
|
|
102
|
-
<ai-suggestion label="وش الباقات المتاحة؟"></ai-suggestion>
|
|
103
|
-
<ai-suggestion label="كيف أرقي باقتي؟"></ai-suggestion>
|
|
104
|
-
<ai-suggestion label="مقارنة بلس وبرو"></ai-suggestion>
|
|
105
|
-
</div>
|
|
106
|
-
</ai-chat-message>
|
|
107
|
-
|
|
108
|
-
<ai-chat-message role="user" content="وش الفرق بين باقة بلس وبرو" timestamp="${t(240000)}"></ai-chat-message>
|
|
109
|
-
|
|
110
|
-
<ai-loading mode="thinking" status-text="جاري التحميل..."></ai-loading>
|
|
111
|
-
|
|
112
|
-
<ai-loading mode="steps" status-text="جاري التحليل..." steps="${steps}" expanded collapsible></ai-loading>
|
|
113
|
-
|
|
114
|
-
<ai-chat-message role="agent" .content=${comparisonContent} format="markdown" agent-name="سلة AI" timestamp="${t(180000)}" show-actions>
|
|
115
|
-
<div style="display:flex; flex-wrap:wrap; gap:0.5rem;">
|
|
116
|
-
<ai-suggestion label="كيف أرقي باقتي؟"></ai-suggestion>
|
|
117
|
-
<ai-suggestion label="ما هي طرق الدفع؟"></ai-suggestion>
|
|
118
|
-
</div>
|
|
119
|
-
</ai-chat-message>
|
|
120
|
-
<ai-card>
|
|
121
|
-
<p >للاطلاع على التفاصيل الكاملة لجميع الباقات وأسعارها:</p>
|
|
122
|
-
<ai-link label="صفحة الباقات" href="#"></ai-link>
|
|
123
|
-
</ai-card>
|
|
124
|
-
|
|
125
|
-
<ai-chat-message role="user" content="كيف أرقي باقتي؟" timestamp="${t(120000)}"></ai-chat-message>
|
|
126
|
-
|
|
127
|
-
<ai-chat-message
|
|
128
|
-
role="agent"
|
|
129
|
-
.content=${'ترقية باقتك سهلة وسريعة! اتبع الخطوات التالية:\n\n1. سجّل دخول إلى لوحة تحكم سلة\n2. اذهب إلى **الإعدادات** ← **الباقة والفوترة**\n3. اختر الباقة المطلوبة\n4. أكمل عملية الدفع\n\nسيتم تفعيل الباقة الجديدة فوراً بعد إتمام الدفع ✅'}
|
|
130
|
-
format="markdown"
|
|
131
|
-
agent-name="سلة AI"
|
|
132
|
-
timestamp="${t(60000)}"
|
|
133
|
-
feedback-value="up"
|
|
134
|
-
show-actions
|
|
135
|
-
></ai-chat-message>
|
|
136
|
-
<ai-card>
|
|
137
|
-
<ai-rating question="كيف كانت تجربتك مع المساعد؟" subtitle="رأيك يساعدنا على التحسين"></ai-rating>
|
|
138
|
-
</ai-card>
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
${showVoice
|
|
142
|
-
? html `<ai-voice-input
|
|
143
|
-
slot="footer"
|
|
144
|
-
auto-start
|
|
145
|
-
@audioRecorded=${() => { showVoice = false; update(); }}
|
|
146
|
-
@recordingCancel=${() => { showVoice = false; update(); }}
|
|
147
|
-
></ai-voice-input>`
|
|
148
|
-
: html `<ai-message-input
|
|
149
|
-
slot="footer"
|
|
150
|
-
placeholder="اكتب رسالتك هنا..."
|
|
151
|
-
@voiceButtonClick=${() => { showVoice = true; update(); }}
|
|
152
|
-
></ai-message-input>`}
|
|
153
|
-
</ai-chat-container>
|
|
154
|
-
</div>
|
|
155
|
-
`, root);
|
|
156
|
-
};
|
|
157
|
-
update();
|
|
158
|
-
return root;
|
|
159
|
-
},
|
|
160
|
-
};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { html } from "lit";
|
|
2
|
-
const meta = {
|
|
3
|
-
title: 'Chat/Chat Header',
|
|
4
|
-
component: 'ai-chat-header',
|
|
5
|
-
tags: ['autodocs'],
|
|
6
|
-
argTypes: {
|
|
7
|
-
mode: {
|
|
8
|
-
control: { type: 'select' },
|
|
9
|
-
options: ['agent', 'human'],
|
|
10
|
-
description: 'Layout variant',
|
|
11
|
-
},
|
|
12
|
-
conversation: {
|
|
13
|
-
control: 'text',
|
|
14
|
-
description: 'Conversation title (agent mode)',
|
|
15
|
-
},
|
|
16
|
-
agentName: {
|
|
17
|
-
control: 'text',
|
|
18
|
-
description: 'Human agent name (human mode)',
|
|
19
|
-
},
|
|
20
|
-
agentStatus: {
|
|
21
|
-
control: 'text',
|
|
22
|
-
description: 'Human agent status (human mode)',
|
|
23
|
-
},
|
|
24
|
-
agentAvatar: {
|
|
25
|
-
control: 'text',
|
|
26
|
-
description: 'Human agent avatar URL (human mode)',
|
|
27
|
-
},
|
|
28
|
-
showBack: {
|
|
29
|
-
control: 'boolean',
|
|
30
|
-
description: 'Show back button (human mode)',
|
|
31
|
-
},
|
|
32
|
-
isDraggable: {
|
|
33
|
-
control: 'boolean',
|
|
34
|
-
description: 'Show drag handle (used when container is draggable)',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
export default meta;
|
|
39
|
-
export const AgentMode = {
|
|
40
|
-
render: args => html `
|
|
41
|
-
<ai-chat-header
|
|
42
|
-
mode="${args.mode}"
|
|
43
|
-
conversation="${args.conversation}"
|
|
44
|
-
?isDraggable="${args.isDraggable}"
|
|
45
|
-
@closeClick="${() => console.log('Close clicked')}"
|
|
46
|
-
@editClick="${() => console.log('Edit clicked')}"
|
|
47
|
-
@dropdownClick="${() => console.log('Dropdown clicked')}"
|
|
48
|
-
></ai-chat-header>
|
|
49
|
-
`,
|
|
50
|
-
args: {
|
|
51
|
-
mode: 'agent',
|
|
52
|
-
conversation: 'محادثة جديدة',
|
|
53
|
-
isDraggable: true,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
export const HumanMode = {
|
|
57
|
-
render: args => html `
|
|
58
|
-
<ai-chat-header
|
|
59
|
-
mode="${args.mode}"
|
|
60
|
-
agent-name="${args.agentName}"
|
|
61
|
-
agent-status="${args.agentStatus}"
|
|
62
|
-
agent-avatar="${args.agentAvatar}"
|
|
63
|
-
?show-back="${args.showBack}"
|
|
64
|
-
?draggable="${args.draggable}"
|
|
65
|
-
@closeClick="${() => console.log('Close clicked')}"
|
|
66
|
-
@moreClick="${() => console.log('More clicked')}"
|
|
67
|
-
@backClick="${() => console.log('Back clicked')}"
|
|
68
|
-
></ai-chat-header>
|
|
69
|
-
`,
|
|
70
|
-
args: {
|
|
71
|
-
mode: 'human',
|
|
72
|
-
agentName: 'هلا',
|
|
73
|
-
agentStatus: 'Active',
|
|
74
|
-
agentAvatar: 'https://i.pravatar.cc/40?img=5',
|
|
75
|
-
showBack: true,
|
|
76
|
-
draggable: true,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
export const HumanWithoutBack = {
|
|
80
|
-
render: args => html `
|
|
81
|
-
<ai-chat-header
|
|
82
|
-
mode="${args.mode}"
|
|
83
|
-
agent-name="${args.agentName}"
|
|
84
|
-
agent-status="${args.agentStatus}"
|
|
85
|
-
agent-avatar="${args.agentAvatar}"
|
|
86
|
-
?show-back="${args.showBack}"
|
|
87
|
-
?isDraggable="${args.isDraggable}"
|
|
88
|
-
@closeClick="${() => console.log('Close clicked')}"
|
|
89
|
-
@moreClick="${() => console.log('More clicked')}"
|
|
90
|
-
></ai-chat-header>
|
|
91
|
-
`,
|
|
92
|
-
args: {
|
|
93
|
-
mode: 'human',
|
|
94
|
-
agentName: 'هلا',
|
|
95
|
-
agentStatus: 'Active',
|
|
96
|
-
agentAvatar: 'https://i.pravatar.cc/40?img=5',
|
|
97
|
-
showBack: false,
|
|
98
|
-
isDraggable: true,
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
export const InChatContainer = {
|
|
102
|
-
render: () => html `
|
|
103
|
-
<div style="position: relative; height: 600px; background: #f3f4f6;">
|
|
104
|
-
<ai-chat-container is-open position="right" width="32rem">
|
|
105
|
-
<div style="display: flex; flex-direction: column; height: 100%; background: white;">
|
|
106
|
-
<ai-chat-header
|
|
107
|
-
mode="agent"
|
|
108
|
-
title="محادثة مع المساعد الذكي"
|
|
109
|
-
@closeClick="${() => console.log('Close clicked')}"
|
|
110
|
-
@editClick="${() => console.log('Edit clicked')}"
|
|
111
|
-
@dropdownClick="${() => console.log('Dropdown clicked')}"
|
|
112
|
-
></ai-chat-header>
|
|
113
|
-
|
|
114
|
-
<div style="flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto;">
|
|
115
|
-
<ai-chat-message
|
|
116
|
-
role="user"
|
|
117
|
-
content="مرحباً، كيف يمكنني المساعدة؟"
|
|
118
|
-
timestamp="${new Date(Date.now() - 300000).toISOString()}"
|
|
119
|
-
language="ar"
|
|
120
|
-
></ai-chat-message>
|
|
121
|
-
|
|
122
|
-
<ai-chat-message
|
|
123
|
-
role="assistant"
|
|
124
|
-
content="مرحباً بك! أنا هنا لمساعدتك. ما الذي تحتاج إليه اليوم؟"
|
|
125
|
-
timestamp="${new Date().toISOString()}"
|
|
126
|
-
language="ar"
|
|
127
|
-
show-actions
|
|
128
|
-
></ai-chat-message>
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
<div style="padding: 1rem; border-top: 1px solid #e5e7eb;">
|
|
132
|
-
<ai-message-input placeholder="اكتب رسالتك..." language="ar"></ai-message-input>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
</ai-chat-container>
|
|
136
|
-
</div>
|
|
137
|
-
`,
|
|
138
|
-
};
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { html } from "lit";
|
|
2
|
-
const meta = {
|
|
3
|
-
title: 'Chat/Chat Message',
|
|
4
|
-
component: 'ai-chat-message',
|
|
5
|
-
tags: ['autodocs'],
|
|
6
|
-
argTypes: {
|
|
7
|
-
role: {
|
|
8
|
-
control: { type: 'select' },
|
|
9
|
-
options: ['user', 'agent'],
|
|
10
|
-
},
|
|
11
|
-
content: { control: 'text' },
|
|
12
|
-
format: {
|
|
13
|
-
control: { type: 'select' },
|
|
14
|
-
options: ['text', 'markdown'],
|
|
15
|
-
},
|
|
16
|
-
agentName: { control: 'text' },
|
|
17
|
-
timestamp: { control: 'text' },
|
|
18
|
-
isLoading: { control: 'boolean' },
|
|
19
|
-
showActions: { control: 'boolean' },
|
|
20
|
-
enableRegenerate: { control: 'boolean' },
|
|
21
|
-
feedbackValue: {
|
|
22
|
-
control: { type: 'select' },
|
|
23
|
-
options: [null, 'up', 'down'],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
export default meta;
|
|
28
|
-
const wrapStyle = 'padding: 24px; background: #f3f4f6; direction: rtl;';
|
|
29
|
-
const threadStyle = `${wrapStyle} display: flex; flex-direction: column; gap: 12px; max-width: 480px;`;
|
|
30
|
-
export const UserMessage = {
|
|
31
|
-
render: args => html `
|
|
32
|
-
<div style="${wrapStyle}">
|
|
33
|
-
<ai-chat-message
|
|
34
|
-
role="${args.role}"
|
|
35
|
-
content="${args.content}"
|
|
36
|
-
timestamp="${args.timestamp}"
|
|
37
|
-
></ai-chat-message>
|
|
38
|
-
</div>
|
|
39
|
-
`,
|
|
40
|
-
args: {
|
|
41
|
-
role: 'user',
|
|
42
|
-
content: 'مرحباً، كيف يمكنني تتبع طلبي؟',
|
|
43
|
-
timestamp: new Date(Date.now() - 120000).toISOString(),
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
export const AgentMessageSimple = {
|
|
47
|
-
render: args => html `
|
|
48
|
-
<div style="${wrapStyle}">
|
|
49
|
-
<ai-chat-message
|
|
50
|
-
role="${args.role}"
|
|
51
|
-
content="${args.content}"
|
|
52
|
-
agent-name="${args.agentName}"
|
|
53
|
-
timestamp="${args.timestamp}"
|
|
54
|
-
?show-actions="${args.showActions}"
|
|
55
|
-
></ai-chat-message>
|
|
56
|
-
</div>
|
|
57
|
-
`,
|
|
58
|
-
args: {
|
|
59
|
-
role: 'agent',
|
|
60
|
-
content: 'مرحباً بك! يسعدني مساعدتك في تتبع طلبك. هل يمكنك تزويدي برقم الطلب؟',
|
|
61
|
-
agentName: 'الرد الآلي | Salla AI',
|
|
62
|
-
timestamp: new Date().toISOString(),
|
|
63
|
-
showActions: true,
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
export const AgentMessageMarkdown = {
|
|
67
|
-
render: args => html `
|
|
68
|
-
<div style="${wrapStyle}">
|
|
69
|
-
<ai-chat-message
|
|
70
|
-
role="${args.role}"
|
|
71
|
-
content="${args.content}"
|
|
72
|
-
format="${args.format}"
|
|
73
|
-
agent-name="${args.agentName}"
|
|
74
|
-
timestamp="${args.timestamp}"
|
|
75
|
-
?show-actions="${args.showActions}"
|
|
76
|
-
?enable-regenerate="${args.enableRegenerate}"
|
|
77
|
-
></ai-chat-message>
|
|
78
|
-
</div>
|
|
79
|
-
`,
|
|
80
|
-
args: {
|
|
81
|
-
role: 'agent',
|
|
82
|
-
content: `## تفاصيل طلبك\n\nوجدت طلبك **#ORD-2024-78945**. إليك الملخص:\n\n- **الحالة**: قيد الشحن\n- **التاريخ**: 10 مارس 2026\n- **المنتجات**: 3 عناصر\n\n### الخطوات التالية\n\nسيصلك *رمز التتبع* خلال ساعة.`,
|
|
83
|
-
format: 'markdown',
|
|
84
|
-
agentName: 'الرد الآلي | Salla AI',
|
|
85
|
-
timestamp: new Date().toISOString(),
|
|
86
|
-
showActions: true,
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
export const FeedbackSelected = {
|
|
90
|
-
render: args => html `
|
|
91
|
-
<div style="${wrapStyle}">
|
|
92
|
-
<ai-chat-message
|
|
93
|
-
role="${args.role}"
|
|
94
|
-
content="${args.content}"
|
|
95
|
-
agent-name="${args.agentName}"
|
|
96
|
-
timestamp="${args.timestamp}"
|
|
97
|
-
feedback-value="${args.feedbackValue}"
|
|
98
|
-
?show-actions="${args.showActions}"
|
|
99
|
-
></ai-chat-message>
|
|
100
|
-
</div>
|
|
101
|
-
`,
|
|
102
|
-
args: {
|
|
103
|
-
role: 'agent',
|
|
104
|
-
content: 'تم شحن طلبك وسيصلك خلال يومين.',
|
|
105
|
-
agentName: 'الرد الآلي | Salla AI',
|
|
106
|
-
timestamp: new Date().toISOString(),
|
|
107
|
-
feedbackValue: 'up',
|
|
108
|
-
showActions: true,
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
export const WithSlottedContent = {
|
|
112
|
-
render: () => html `
|
|
113
|
-
<div style="${wrapStyle} max-width: 480px;">
|
|
114
|
-
<ai-chat-message
|
|
115
|
-
role="agent"
|
|
116
|
-
content="جاري معالجة طلبك..."
|
|
117
|
-
agent-name="الرد الآلي | Salla AI"
|
|
118
|
-
timestamp="${new Date().toISOString()}"
|
|
119
|
-
?show-actions="${false}"
|
|
120
|
-
>
|
|
121
|
-
<ai-execution-steps
|
|
122
|
-
steps='[{"id":"1","title":"البحث عن الطلب","status":"completed","agent":"الطلبات"},{"id":"2","title":"التحقق من حالة الشحن","status":"executing","agent":"الشحن"},{"id":"3","title":"إعداد رابط التتبع","status":"pending","agent":"التجميع"}]'
|
|
123
|
-
language="ar"
|
|
124
|
-
variant="compact"
|
|
125
|
-
title="خطة التنفيذ"
|
|
126
|
-
></ai-execution-steps>
|
|
127
|
-
</ai-chat-message>
|
|
128
|
-
</div>
|
|
129
|
-
`,
|
|
130
|
-
};
|
|
131
|
-
export const ConversationThread = {
|
|
132
|
-
render: () => html `
|
|
133
|
-
<div style="${threadStyle}">
|
|
134
|
-
<ai-chat-message
|
|
135
|
-
role="user"
|
|
136
|
-
content="مرحباً، أحتاج مساعدة في تتبع طلبي"
|
|
137
|
-
timestamp="${new Date(Date.now() - 300000).toISOString()}"
|
|
138
|
-
></ai-chat-message>
|
|
139
|
-
|
|
140
|
-
<ai-chat-message
|
|
141
|
-
role="agent"
|
|
142
|
-
content="مرحباً! يسعدني مساعدتك. هل يمكنك تزويدي برقم الطلب؟"
|
|
143
|
-
agent-name="الرد الآلي | Salla AI"
|
|
144
|
-
timestamp="${new Date(Date.now() - 240000).toISOString()}"
|
|
145
|
-
show-actions
|
|
146
|
-
></ai-chat-message>
|
|
147
|
-
|
|
148
|
-
<ai-chat-message
|
|
149
|
-
role="user"
|
|
150
|
-
content="بالتأكيد، رقمه #ORD-2024-78945"
|
|
151
|
-
timestamp="${new Date(Date.now() - 180000).toISOString()}"
|
|
152
|
-
></ai-chat-message>
|
|
153
|
-
|
|
154
|
-
<ai-chat-message
|
|
155
|
-
role="agent"
|
|
156
|
-
content="**وجدت طلبك!** حالته الآن *قيد الشحن* وسيصلك خلال يومين عمل.\n\n- رقم التتبع: **TRK-9876543**\n- شركة الشحن: أرامكس"
|
|
157
|
-
format="markdown"
|
|
158
|
-
agent-name="الرد الآلي | Salla AI"
|
|
159
|
-
timestamp="${new Date().toISOString()}"
|
|
160
|
-
show-actions
|
|
161
|
-
></ai-chat-message>
|
|
162
|
-
</div>
|
|
163
|
-
`,
|
|
164
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { html } from "lit";
|
|
2
|
-
const meta = {
|
|
3
|
-
title: 'UI/Link',
|
|
4
|
-
component: 'ai-link',
|
|
5
|
-
tags: ['autodocs'],
|
|
6
|
-
argTypes: {
|
|
7
|
-
label: { control: 'text' },
|
|
8
|
-
href: { control: 'text' },
|
|
9
|
-
target: {
|
|
10
|
-
control: { type: 'select' },
|
|
11
|
-
options: ['_blank', '_self'],
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
export default meta;
|
|
16
|
-
const wrapStyle = 'padding: 24px; background: #f3f4f6; direction: rtl;';
|
|
17
|
-
/* ─── Playground ─────────────────────────────────────────────────────────── */
|
|
18
|
-
export const Playground = {
|
|
19
|
-
render: args => html `
|
|
20
|
-
<div style="${wrapStyle}">
|
|
21
|
-
<ai-link
|
|
22
|
-
label="${args.label}"
|
|
23
|
-
href="${args.href}"
|
|
24
|
-
target="${args.target}"
|
|
25
|
-
></ai-link>
|
|
26
|
-
</div>
|
|
27
|
-
`,
|
|
28
|
-
args: {
|
|
29
|
-
label: 'صفحة الباقات',
|
|
30
|
-
href: '#',
|
|
31
|
-
target: '_blank',
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
/* ─── Multiple links ─────────────────────────────────────────────────────── */
|
|
35
|
-
export const MultipleLinks = {
|
|
36
|
-
render: () => html `
|
|
37
|
-
<div style="${wrapStyle} display: flex; flex-direction: column; gap: 12px; align-items: flex-end;">
|
|
38
|
-
<ai-link label="صفحة الباقات" href="#"></ai-link>
|
|
39
|
-
<ai-link label="لوحة التحكم" href="#"></ai-link>
|
|
40
|
-
<ai-link label="إعدادات المتجر" href="#"></ai-link>
|
|
41
|
-
</div>
|
|
42
|
-
`,
|
|
43
|
-
};
|
|
44
|
-
/* ─── Inside a card (realistic usage) ───────────────────────────────────── */
|
|
45
|
-
export const InsideCard = {
|
|
46
|
-
render: () => html `
|
|
47
|
-
<div style="padding: 24px; background: #f3f4f6; direction: rtl; max-width: 420px;">
|
|
48
|
-
<ai-card>
|
|
49
|
-
<p style="margin:0; font-size:14px; font-weight:500; color:#333;">
|
|
50
|
-
يمكنك الاطلاع على تفاصيل الباقات المتاحة
|
|
51
|
-
</p>
|
|
52
|
-
<p style="margin:0; font-size:14px; color:#737373;">
|
|
53
|
-
باقة بلس توفر ميزات متقدمة للتسويق وإدارة العملاء.
|
|
54
|
-
</p>
|
|
55
|
-
<ai-link label="صفحة الباقات" href="#"></ai-link>
|
|
56
|
-
</ai-card>
|
|
57
|
-
</div>
|
|
58
|
-
`,
|
|
59
|
-
};
|
|
60
|
-
/* ─── In message context (card + link + suggestions) ────────────────────── */
|
|
61
|
-
export const FullMessageContext = {
|
|
62
|
-
render: () => html `
|
|
63
|
-
<div style="padding: 24px; background: #f3f4f6; direction: rtl; max-width: 480px; display: flex; flex-direction: column; gap: 12px;">
|
|
64
|
-
<ai-card>
|
|
65
|
-
<p style="margin:0; font-size:14px; font-weight:500; color:#333;">
|
|
66
|
-
الفرق بين باقة بلس وبرو
|
|
67
|
-
</p>
|
|
68
|
-
<p style="margin:0; font-size:14px; color:#737373;">
|
|
69
|
-
باقة بلس مناسبة للمتاجر الناشئة، بينما باقة برو توفر أدوات تسويق متقدمة وتقارير تفصيلية.
|
|
70
|
-
</p>
|
|
71
|
-
<ai-link label="صفحة الباقات" href="#"></ai-link>
|
|
72
|
-
</ai-card>
|
|
73
|
-
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
|
74
|
-
<ai-suggestion label="قارن الأسعار"></ai-suggestion>
|
|
75
|
-
<ai-suggestion label="كيف أرقي باقتي؟"></ai-suggestion>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
`,
|
|
79
|
-
};
|