@open-mercato/core 0.6.7-develop.6785.1.1dd7cfac55 → 0.6.7-develop.6795.1.8a3f27921c
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/.turbo/turbo-build.log +1 -1
- package/dist/generated/entities.ids.generated.js +1 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/modules/auth/backend/settings/page.js +14 -9
- package/dist/modules/auth/backend/settings/page.js.map +2 -2
- package/dist/modules/customers/cli.js +17 -7
- package/dist/modules/customers/cli.js.map +2 -2
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js +229 -216
- package/dist/modules/customers/components/detail/ScheduleActivityDialog.js.map +2 -2
- package/dist/modules/customers/search.js +50 -29
- package/dist/modules/customers/search.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/[id]/route.js +22 -9
- package/dist/modules/data_sync/api/mappings/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/mappings/route.js +13 -4
- package/dist/modules/data_sync/api/mappings/route.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +7 -2
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/api/run.js +7 -2
- package/dist/modules/data_sync/api/run.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +8 -3
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js +7 -2
- package/dist/modules/data_sync/api/runs/[id]/retry.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/route.js +8 -3
- package/dist/modules/data_sync/api/runs/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/runs.js +7 -2
- package/dist/modules/data_sync/api/runs.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/[id]/route.js +19 -6
- package/dist/modules/data_sync/api/schedules/[id]/route.js.map +2 -2
- package/dist/modules/data_sync/api/schedules/route.js +13 -4
- package/dist/modules/data_sync/api/schedules/route.js.map +2 -2
- package/dist/modules/data_sync/api/validate.js +9 -4
- package/dist/modules/data_sync/api/validate.js.map +2 -2
- package/dist/modules/design_system/acl.js +9 -0
- package/dist/modules/design_system/acl.js.map +7 -0
- package/dist/modules/design_system/backend/design-system/page.js +11 -0
- package/dist/modules/design_system/backend/design-system/page.js.map +7 -0
- package/dist/modules/design_system/backend/design-system/page.meta.js +15 -0
- package/dist/modules/design_system/backend/design-system/page.meta.js.map +7 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js +52 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +7 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js +63 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js +163 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js.map +7 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js +9 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/banners.js +186 -0
- package/dist/modules/design_system/gallery/entries/banners.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/buttons.js +361 -0
- package/dist/modules/design_system/gallery/entries/buttons.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/charts.js +457 -0
- package/dist/modules/design_system/gallery/entries/charts.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/dates.js +306 -0
- package/dist/modules/design_system/gallery/entries/dates.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/detail.js +358 -0
- package/dist/modules/design_system/gallery/entries/detail.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/display.js +785 -0
- package/dist/modules/design_system/gallery/entries/display.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/feedback.js +658 -0
- package/dist/modules/design_system/gallery/entries/feedback.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/filters.js +505 -0
- package/dist/modules/design_system/gallery/entries/filters.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/foundations.js +453 -0
- package/dist/modules/design_system/gallery/entries/foundations.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/icons.js +140 -0
- package/dist/modules/design_system/gallery/entries/icons.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/inputs.js +1217 -0
- package/dist/modules/design_system/gallery/entries/inputs.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/messages.js +334 -0
- package/dist/modules/design_system/gallery/entries/messages.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/navigation.js +475 -0
- package/dist/modules/design_system/gallery/entries/navigation.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/notifications.js +257 -0
- package/dist/modules/design_system/gallery/entries/notifications.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/overlays.js +576 -0
- package/dist/modules/design_system/gallery/entries/overlays.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/scaffolding.js +378 -0
- package/dist/modules/design_system/gallery/entries/scaffolding.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/schedule.js +297 -0
- package/dist/modules/design_system/gallery/entries/schedule.js.map +7 -0
- package/dist/modules/design_system/gallery/registry.js +139 -0
- package/dist/modules/design_system/gallery/registry.js.map +7 -0
- package/dist/modules/design_system/gallery/types.js +1 -0
- package/dist/modules/design_system/gallery/types.js.map +7 -0
- package/dist/modules/design_system/index.js +9 -0
- package/dist/modules/design_system/index.js.map +7 -0
- package/dist/modules/design_system/setup.js +14 -0
- package/dist/modules/design_system/setup.js.map +7 -0
- package/dist/modules/inbox_ops/search.js +15 -4
- package/dist/modules/inbox_ops/search.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +11 -5
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/health/route.js +6 -3
- package/dist/modules/integrations/api/[id]/health/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/route.js +6 -3
- package/dist/modules/integrations/api/[id]/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/state/route.js +6 -3
- package/dist/modules/integrations/api/[id]/state/route.js.map +2 -2
- package/dist/modules/integrations/api/[id]/version/route.js +6 -3
- package/dist/modules/integrations/api/[id]/version/route.js.map +2 -2
- package/dist/modules/integrations/api/logs/route.js +6 -3
- package/dist/modules/integrations/api/logs/route.js.map +2 -2
- package/dist/modules/integrations/api/route.js +6 -3
- package/dist/modules/integrations/api/route.js.map +2 -2
- package/dist/modules/integrations/api/umes-read.js +2 -2
- package/dist/modules/integrations/api/umes-read.js.map +2 -2
- package/dist/modules/integrations/lib/organization-scope.js +2 -9
- package/dist/modules/integrations/lib/organization-scope.js.map +2 -2
- package/dist/modules/messages/search.js +10 -5
- package/dist/modules/messages/search.js.map +2 -2
- package/dist/modules/query_index/data/entities.js +2 -1
- package/dist/modules/query_index/data/entities.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +32 -50
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js +17 -0
- package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js.map +7 -0
- package/generated/entities.ids.generated.ts +1 -0
- package/package.json +16 -16
- package/src/modules/auth/backend/settings/page.tsx +17 -8
- package/src/modules/customers/cli.ts +17 -7
- package/src/modules/customers/components/detail/ScheduleActivityDialog.tsx +24 -13
- package/src/modules/customers/i18n/de.json +17 -0
- package/src/modules/customers/i18n/en.json +17 -0
- package/src/modules/customers/i18n/es.json +17 -0
- package/src/modules/customers/i18n/pl.json +17 -0
- package/src/modules/customers/search.ts +59 -27
- package/src/modules/data_sync/AGENTS.md +1 -0
- package/src/modules/data_sync/api/mappings/[id]/route.ts +22 -9
- package/src/modules/data_sync/api/mappings/route.ts +13 -4
- package/src/modules/data_sync/api/options.ts +7 -2
- package/src/modules/data_sync/api/run.ts +7 -2
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +8 -3
- package/src/modules/data_sync/api/runs/[id]/retry.ts +7 -2
- package/src/modules/data_sync/api/runs/[id]/route.ts +8 -3
- package/src/modules/data_sync/api/runs.ts +7 -2
- package/src/modules/data_sync/api/schedules/[id]/route.ts +19 -6
- package/src/modules/data_sync/api/schedules/route.ts +13 -4
- package/src/modules/data_sync/api/validate.ts +9 -4
- package/src/modules/design_system/AGENTS.md +34 -0
- package/src/modules/design_system/acl.ts +5 -0
- package/src/modules/design_system/backend/design-system/page.meta.ts +11 -0
- package/src/modules/design_system/backend/design-system/page.tsx +14 -0
- package/src/modules/design_system/gallery/components/CodeSnippet.tsx +55 -0
- package/src/modules/design_system/gallery/components/EntryCard.tsx +95 -0
- package/src/modules/design_system/gallery/components/GalleryShell.tsx +206 -0
- package/src/modules/design_system/gallery/components/VariantPreview.tsx +15 -0
- package/src/modules/design_system/gallery/entries/banners.tsx +226 -0
- package/src/modules/design_system/gallery/entries/buttons.tsx +422 -0
- package/src/modules/design_system/gallery/entries/charts.tsx +518 -0
- package/src/modules/design_system/gallery/entries/dates.tsx +325 -0
- package/src/modules/design_system/gallery/entries/detail.tsx +403 -0
- package/src/modules/design_system/gallery/entries/display.tsx +893 -0
- package/src/modules/design_system/gallery/entries/feedback.tsx +746 -0
- package/src/modules/design_system/gallery/entries/filters.tsx +570 -0
- package/src/modules/design_system/gallery/entries/foundations.tsx +529 -0
- package/src/modules/design_system/gallery/entries/icons.tsx +168 -0
- package/src/modules/design_system/gallery/entries/inputs.tsx +1516 -0
- package/src/modules/design_system/gallery/entries/messages.tsx +339 -0
- package/src/modules/design_system/gallery/entries/navigation.tsx +573 -0
- package/src/modules/design_system/gallery/entries/notifications.tsx +285 -0
- package/src/modules/design_system/gallery/entries/overlays.tsx +677 -0
- package/src/modules/design_system/gallery/entries/scaffolding.tsx +430 -0
- package/src/modules/design_system/gallery/entries/schedule.tsx +307 -0
- package/src/modules/design_system/gallery/registry.ts +152 -0
- package/src/modules/design_system/gallery/types.ts +32 -0
- package/src/modules/design_system/i18n/.hardcoded-allowlist.json +71 -0
- package/src/modules/design_system/i18n/de.json +46 -0
- package/src/modules/design_system/i18n/en.json +46 -0
- package/src/modules/design_system/i18n/es.json +46 -0
- package/src/modules/design_system/i18n/pl.json +46 -0
- package/src/modules/design_system/index.ts +7 -0
- package/src/modules/design_system/setup.ts +12 -0
- package/src/modules/inbox_ops/i18n/de.json +3 -0
- package/src/modules/inbox_ops/i18n/en.json +3 -0
- package/src/modules/inbox_ops/i18n/es.json +3 -0
- package/src/modules/inbox_ops/i18n/pl.json +3 -0
- package/src/modules/inbox_ops/search.ts +20 -4
- package/src/modules/integrations/api/[id]/credentials/route.ts +11 -5
- package/src/modules/integrations/api/[id]/health/route.ts +6 -3
- package/src/modules/integrations/api/[id]/route.ts +6 -3
- package/src/modules/integrations/api/[id]/state/route.ts +6 -3
- package/src/modules/integrations/api/[id]/version/route.ts +6 -3
- package/src/modules/integrations/api/logs/route.ts +6 -3
- package/src/modules/integrations/api/route.ts +6 -3
- package/src/modules/integrations/api/umes-read.ts +2 -2
- package/src/modules/integrations/lib/organization-scope.ts +5 -25
- package/src/modules/messages/i18n/de.json +2 -0
- package/src/modules/messages/i18n/en.json +2 -0
- package/src/modules/messages/i18n/es.json +2 -0
- package/src/modules/messages/i18n/pl.json +2 -0
- package/src/modules/messages/search.ts +11 -5
- package/src/modules/query_index/data/entities.ts +7 -0
- package/src/modules/query_index/lib/engine.ts +40 -63
- package/src/modules/query_index/migrations/.snapshot-open-mercato.json +12 -0
- package/src/modules/query_index/migrations/Migration20260731105052_query_index.ts +35 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
EmailThreadsPanel,
|
|
4
|
+
MessageObjectPreview,
|
|
5
|
+
type EmailThread,
|
|
6
|
+
} from '@open-mercato/ui/backend/messages'
|
|
7
|
+
import { MessagePrioritySelector } from '@open-mercato/ui/backend/messages/MessagePrioritySelector'
|
|
8
|
+
import type { MessagePriority } from '@open-mercato/ui/backend/messages/message-priority'
|
|
9
|
+
import type { GalleryEntry } from '../types'
|
|
10
|
+
|
|
11
|
+
// Component titles and variant names are proper nouns from the codebase and
|
|
12
|
+
// are deliberately not translated. `code` MUST contain the entry's importPath
|
|
13
|
+
// (enforced by the registry-integrity test) and is always reviewed alongside
|
|
14
|
+
// its sibling `render`.
|
|
15
|
+
|
|
16
|
+
// Fixed sample timestamps (June 2026) — previews must not depend on "today".
|
|
17
|
+
const sampleThreads: EmailThread[] = [
|
|
18
|
+
{
|
|
19
|
+
threadKey: 'thread-fitting',
|
|
20
|
+
subject: 'Fitting appointment — June 12',
|
|
21
|
+
preview: 'Great, see you Friday at 10:00.',
|
|
22
|
+
participants: ['anna.nowak@example.com'],
|
|
23
|
+
lastMessageAt: '2026-06-10T14:05:00.000Z',
|
|
24
|
+
messageCount: 2,
|
|
25
|
+
providerKey: 'gmail',
|
|
26
|
+
lastDirection: 'inbound',
|
|
27
|
+
messages: [
|
|
28
|
+
{
|
|
29
|
+
id: 'msg-fitting-1',
|
|
30
|
+
messageId: null,
|
|
31
|
+
rfcMessageId: '<fitting-1@example.com>',
|
|
32
|
+
references: [],
|
|
33
|
+
direction: 'outbound',
|
|
34
|
+
fromName: 'Studio Team',
|
|
35
|
+
fromEmail: 'studio@example.com',
|
|
36
|
+
to: ['anna.nowak@example.com'],
|
|
37
|
+
cc: [],
|
|
38
|
+
subject: 'Fitting appointment — June 12',
|
|
39
|
+
bodyText: 'Hi Anna, we can offer Friday June 12 at 10:00. Does that work for you?',
|
|
40
|
+
sentAt: '2026-06-10T09:24:00.000Z',
|
|
41
|
+
providerKey: 'gmail',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'msg-fitting-2',
|
|
45
|
+
messageId: null,
|
|
46
|
+
rfcMessageId: '<fitting-2@example.com>',
|
|
47
|
+
references: ['<fitting-1@example.com>'],
|
|
48
|
+
direction: 'inbound',
|
|
49
|
+
fromName: 'Anna Nowak',
|
|
50
|
+
fromEmail: 'anna.nowak@example.com',
|
|
51
|
+
to: ['studio@example.com'],
|
|
52
|
+
cc: [],
|
|
53
|
+
subject: 'Re: Fitting appointment — June 12',
|
|
54
|
+
bodyText: 'Great, see you Friday at 10:00.',
|
|
55
|
+
sentAt: '2026-06-10T14:05:00.000Z',
|
|
56
|
+
providerKey: 'gmail',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
threadKey: 'thread-invoice',
|
|
62
|
+
subject: 'Invoice 2026-118',
|
|
63
|
+
preview: 'Attached is the corrected invoice for May.',
|
|
64
|
+
participants: ['billing@acme.example.com'],
|
|
65
|
+
lastMessageAt: '2026-06-08T08:12:00.000Z',
|
|
66
|
+
messageCount: 1,
|
|
67
|
+
providerKey: 'gmail',
|
|
68
|
+
lastDirection: 'inbound',
|
|
69
|
+
messages: [
|
|
70
|
+
{
|
|
71
|
+
id: 'msg-invoice-1',
|
|
72
|
+
messageId: null,
|
|
73
|
+
rfcMessageId: '<invoice-1@example.com>',
|
|
74
|
+
references: [],
|
|
75
|
+
direction: 'inbound',
|
|
76
|
+
fromName: 'Acme Billing',
|
|
77
|
+
fromEmail: 'billing@acme.example.com',
|
|
78
|
+
to: ['studio@example.com'],
|
|
79
|
+
cc: ['accounting@example.com'],
|
|
80
|
+
subject: 'Invoice 2026-118',
|
|
81
|
+
bodyText: 'Attached is the corrected invoice for May.',
|
|
82
|
+
sentAt: '2026-06-08T08:12:00.000Z',
|
|
83
|
+
providerKey: 'gmail',
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
const optimisticThread: EmailThread[] = [
|
|
90
|
+
{
|
|
91
|
+
threadKey: 'thread-optimistic',
|
|
92
|
+
subject: 'Order 10241 — delivery update',
|
|
93
|
+
preview: 'Your order ships tomorrow.',
|
|
94
|
+
participants: ['jan.kowalski@example.com'],
|
|
95
|
+
lastMessageAt: '2026-06-11T16:40:00.000Z',
|
|
96
|
+
messageCount: 3,
|
|
97
|
+
providerKey: 'gmail',
|
|
98
|
+
lastDirection: 'outbound',
|
|
99
|
+
messages: [
|
|
100
|
+
{
|
|
101
|
+
id: 'msg-opt-1',
|
|
102
|
+
messageId: null,
|
|
103
|
+
rfcMessageId: null,
|
|
104
|
+
references: [],
|
|
105
|
+
direction: 'outbound',
|
|
106
|
+
fromName: 'Studio Team',
|
|
107
|
+
fromEmail: 'studio@example.com',
|
|
108
|
+
to: ['jan.kowalski@example.com'],
|
|
109
|
+
cc: [],
|
|
110
|
+
subject: 'Order 10241 — delivery update',
|
|
111
|
+
bodyText: 'Your order ships tomorrow.',
|
|
112
|
+
sentAt: '2026-06-11T16:38:00.000Z',
|
|
113
|
+
providerKey: 'gmail',
|
|
114
|
+
status: 'sent',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'msg-opt-2',
|
|
118
|
+
messageId: null,
|
|
119
|
+
rfcMessageId: null,
|
|
120
|
+
references: [],
|
|
121
|
+
direction: 'outbound',
|
|
122
|
+
fromName: 'Studio Team',
|
|
123
|
+
fromEmail: 'studio@example.com',
|
|
124
|
+
to: ['jan.kowalski@example.com'],
|
|
125
|
+
cc: [],
|
|
126
|
+
subject: 'Re: Order 10241 — delivery update',
|
|
127
|
+
bodyText: 'Tracking number follows in a separate email.',
|
|
128
|
+
sentAt: '2026-06-11T16:39:00.000Z',
|
|
129
|
+
providerKey: 'gmail',
|
|
130
|
+
status: 'sending',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: 'msg-opt-3',
|
|
134
|
+
messageId: null,
|
|
135
|
+
rfcMessageId: null,
|
|
136
|
+
references: [],
|
|
137
|
+
direction: 'outbound',
|
|
138
|
+
fromName: 'Studio Team',
|
|
139
|
+
fromEmail: 'studio@example.com',
|
|
140
|
+
to: ['jan.kowalski@example.com'],
|
|
141
|
+
cc: [],
|
|
142
|
+
subject: 'Re: Order 10241 — delivery update',
|
|
143
|
+
bodyText: 'Here is the tracking link.',
|
|
144
|
+
sentAt: '2026-06-11T16:40:00.000Z',
|
|
145
|
+
providerKey: 'gmail',
|
|
146
|
+
status: 'failed',
|
|
147
|
+
statusError: 'Mailbox temporarily unavailable.',
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
const emailThreadsPanelEntry: GalleryEntry = {
|
|
154
|
+
id: 'email-threads-panel',
|
|
155
|
+
title: 'EmailThreadsPanel',
|
|
156
|
+
importPath: '@open-mercato/ui/backend/messages',
|
|
157
|
+
variants: [
|
|
158
|
+
{
|
|
159
|
+
id: 'conversations',
|
|
160
|
+
title: 'Conversations',
|
|
161
|
+
render: () => (
|
|
162
|
+
<EmailThreadsPanel
|
|
163
|
+
threads={sampleThreads}
|
|
164
|
+
canCompose
|
|
165
|
+
onComposeNew={() => {}}
|
|
166
|
+
onReply={() => {}}
|
|
167
|
+
onRefresh={() => {}}
|
|
168
|
+
className="w-full"
|
|
169
|
+
/>
|
|
170
|
+
),
|
|
171
|
+
code: `import { EmailThreadsPanel, type EmailThread } from '@open-mercato/ui/backend/messages'
|
|
172
|
+
|
|
173
|
+
<EmailThreadsPanel
|
|
174
|
+
threads={threads /* EmailThread[] fetched by the host page */}
|
|
175
|
+
canCompose
|
|
176
|
+
onComposeNew={() => openComposer()}
|
|
177
|
+
onReply={(thread) => openReply(thread)}
|
|
178
|
+
onRefresh={() => refetch()}
|
|
179
|
+
/>`,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: 'optimistic-status',
|
|
183
|
+
title: 'Optimistic send status',
|
|
184
|
+
render: () => (
|
|
185
|
+
<EmailThreadsPanel
|
|
186
|
+
threads={optimisticThread}
|
|
187
|
+
canCompose
|
|
188
|
+
onComposeNew={() => {}}
|
|
189
|
+
onReply={() => {}}
|
|
190
|
+
onRetry={() => {}}
|
|
191
|
+
className="w-full"
|
|
192
|
+
/>
|
|
193
|
+
),
|
|
194
|
+
code: `import { EmailThreadsPanel } from '@open-mercato/ui/backend/messages'
|
|
195
|
+
|
|
196
|
+
// Messages carry status: 'sending' | 'sent' | 'failed' via mergeOptimisticEmailThreads
|
|
197
|
+
<EmailThreadsPanel
|
|
198
|
+
threads={threads}
|
|
199
|
+
canCompose
|
|
200
|
+
onComposeNew={() => openComposer()}
|
|
201
|
+
onReply={(thread) => openReply(thread)}
|
|
202
|
+
onRetry={(message) => resend(message)}
|
|
203
|
+
/>`,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
id: 'empty',
|
|
207
|
+
title: 'Empty state',
|
|
208
|
+
render: () => (
|
|
209
|
+
<EmailThreadsPanel threads={[]} canCompose onComposeNew={() => {}} className="w-full" />
|
|
210
|
+
),
|
|
211
|
+
code: `import { EmailThreadsPanel } from '@open-mercato/ui/backend/messages'
|
|
212
|
+
|
|
213
|
+
<EmailThreadsPanel threads={[]} canCompose onComposeNew={() => openComposer()} />`,
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: 'read-only',
|
|
217
|
+
title: 'Read-only (compose disabled)',
|
|
218
|
+
render: () => (
|
|
219
|
+
<EmailThreadsPanel
|
|
220
|
+
threads={sampleThreads}
|
|
221
|
+
canCompose={false}
|
|
222
|
+
composeDisabledHint={
|
|
223
|
+
<span className="text-sm text-muted-foreground">
|
|
224
|
+
Connect an email provider to reply from here.
|
|
225
|
+
</span>
|
|
226
|
+
}
|
|
227
|
+
onRefresh={() => {}}
|
|
228
|
+
className="w-full"
|
|
229
|
+
/>
|
|
230
|
+
),
|
|
231
|
+
code: `import { EmailThreadsPanel } from '@open-mercato/ui/backend/messages'
|
|
232
|
+
|
|
233
|
+
<EmailThreadsPanel
|
|
234
|
+
threads={threads}
|
|
235
|
+
canCompose={false}
|
|
236
|
+
composeDisabledHint={<span className="text-sm text-muted-foreground">Connect an email provider to reply from here.</span>}
|
|
237
|
+
onRefresh={() => refetch()}
|
|
238
|
+
/>`,
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const galleryT = (key: string, fallback?: string) => fallback ?? key
|
|
244
|
+
|
|
245
|
+
function DemoMessagePrioritySelector() {
|
|
246
|
+
const [value, setValue] = React.useState<MessagePriority>('high')
|
|
247
|
+
return <MessagePrioritySelector value={value} onChange={setValue} t={galleryT} />
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const messagePrioritySelectorEntry: GalleryEntry = {
|
|
251
|
+
id: 'message-priority-selector',
|
|
252
|
+
title: 'MessagePrioritySelector',
|
|
253
|
+
importPath: '@open-mercato/ui/backend/messages/MessagePrioritySelector',
|
|
254
|
+
variants: [
|
|
255
|
+
{
|
|
256
|
+
id: 'interactive',
|
|
257
|
+
title: 'Interactive (presentational core of the API-wired MessageComposer)',
|
|
258
|
+
render: () => <DemoMessagePrioritySelector />,
|
|
259
|
+
code: `import { MessagePrioritySelector } from '@open-mercato/ui/backend/messages/MessagePrioritySelector'
|
|
260
|
+
import type { MessagePriority } from '@open-mercato/ui/backend/messages/message-priority'
|
|
261
|
+
|
|
262
|
+
const [value, setValue] = React.useState<MessagePriority>('high')
|
|
263
|
+
|
|
264
|
+
// Inside MessageComposer priorities come through defaultValues.priority;
|
|
265
|
+
// standalone usage is fully controlled.
|
|
266
|
+
<MessagePrioritySelector value={value} onChange={setValue} t={t} />`,
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const messageObjectPreviewEntry: GalleryEntry = {
|
|
272
|
+
id: 'message-object-preview',
|
|
273
|
+
title: 'MessageObjectPreview',
|
|
274
|
+
importPath: '@open-mercato/ui/backend/messages',
|
|
275
|
+
variants: [
|
|
276
|
+
{
|
|
277
|
+
id: 'preview-data',
|
|
278
|
+
title: 'Preview data',
|
|
279
|
+
render: () => (
|
|
280
|
+
<MessageObjectPreview
|
|
281
|
+
entityId="order-10241"
|
|
282
|
+
entityModule="sales"
|
|
283
|
+
entityType="order"
|
|
284
|
+
previewData={{
|
|
285
|
+
title: 'Order #10241',
|
|
286
|
+
subtitle: 'Anna Nowak — 3 items',
|
|
287
|
+
status: 'processing',
|
|
288
|
+
}}
|
|
289
|
+
/>
|
|
290
|
+
),
|
|
291
|
+
code: `import { MessageObjectPreview } from '@open-mercato/ui/backend/messages'
|
|
292
|
+
|
|
293
|
+
<MessageObjectPreview
|
|
294
|
+
entityId="order-10241"
|
|
295
|
+
entityModule="sales"
|
|
296
|
+
entityType="order"
|
|
297
|
+
previewData={{ title: 'Order #10241', subtitle: 'Anna Nowak — 3 items', status: 'processing' }}
|
|
298
|
+
/>`,
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
id: 'action-required',
|
|
302
|
+
title: 'Action required with metadata',
|
|
303
|
+
render: () => (
|
|
304
|
+
<MessageObjectPreview
|
|
305
|
+
entityId="return-1182"
|
|
306
|
+
entityModule="sales"
|
|
307
|
+
entityType="return"
|
|
308
|
+
actionRequired
|
|
309
|
+
actionLabel="Approve return"
|
|
310
|
+
previewData={{
|
|
311
|
+
title: 'Return request #1182',
|
|
312
|
+
subtitle: 'Order #10241 — Anna Nowak',
|
|
313
|
+
metadata: { total: 'EUR 412.00', due: 'Jun 15, 2026' },
|
|
314
|
+
}}
|
|
315
|
+
/>
|
|
316
|
+
),
|
|
317
|
+
code: `import { MessageObjectPreview } from '@open-mercato/ui/backend/messages'
|
|
318
|
+
|
|
319
|
+
<MessageObjectPreview
|
|
320
|
+
entityId="return-1182"
|
|
321
|
+
entityModule="sales"
|
|
322
|
+
entityType="return"
|
|
323
|
+
actionRequired
|
|
324
|
+
actionLabel="Approve return"
|
|
325
|
+
previewData={{
|
|
326
|
+
title: 'Return request #1182',
|
|
327
|
+
subtitle: 'Order #10241 — Anna Nowak',
|
|
328
|
+
metadata: { total: 'EUR 412.00', due: 'Jun 15, 2026' },
|
|
329
|
+
}}
|
|
330
|
+
/>`,
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export const entries: GalleryEntry[] = [
|
|
336
|
+
emailThreadsPanelEntry,
|
|
337
|
+
messagePrioritySelectorEntry,
|
|
338
|
+
messageObjectPreviewEntry,
|
|
339
|
+
]
|