@open-mercato/ai-assistant 0.6.8-develop.6974.1.43440f247a → 0.6.8-develop.6976.1.9b79145ac4
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/modules/ai_assistant/widgets/notifications/ConversationSharedRenderer.js +3 -2
- package/dist/modules/ai_assistant/widgets/notifications/ConversationSharedRenderer.js.map +2 -2
- package/package.json +6 -6
- package/src/modules/ai_assistant/widgets/notifications/ConversationSharedRenderer.tsx +3 -2
|
@@ -7,7 +7,7 @@ import { Button } from "@open-mercato/ui/primitives/button";
|
|
|
7
7
|
import { IconButton } from "@open-mercato/ui/primitives/icon-button";
|
|
8
8
|
import { cn } from "@open-mercato/shared/lib/utils";
|
|
9
9
|
import { formatRelativeTime } from "@open-mercato/shared/lib/time";
|
|
10
|
-
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
10
|
+
import { useLocale, useT } from "@open-mercato/shared/lib/i18n/context";
|
|
11
11
|
function ConversationSharedRenderer({
|
|
12
12
|
notification,
|
|
13
13
|
onAction,
|
|
@@ -15,6 +15,7 @@ function ConversationSharedRenderer({
|
|
|
15
15
|
actions = []
|
|
16
16
|
}) {
|
|
17
17
|
const t = useT();
|
|
18
|
+
const locale = useLocale();
|
|
18
19
|
const router = useRouter();
|
|
19
20
|
const [executing, setExecuting] = React.useState(false);
|
|
20
21
|
const isUnread = notification.status === "unread";
|
|
@@ -30,7 +31,7 @@ function ConversationSharedRenderer({
|
|
|
30
31
|
setExecuting(false);
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
|
-
const timeAgo = formatRelativeTime(notification.createdAt, { translate: t }) ?? "";
|
|
34
|
+
const timeAgo = formatRelativeTime(notification.createdAt, { locale, translate: t }) ?? "";
|
|
34
35
|
return /* @__PURE__ */ jsxs(
|
|
35
36
|
"div",
|
|
36
37
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/ai_assistant/widgets/notifications/ConversationSharedRenderer.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Share2, ExternalLink, X } from 'lucide-react'\nimport { useRouter } from 'next/navigation'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { cn } from '@open-mercato/shared/lib/utils'\nimport { formatRelativeTime } from '@open-mercato/shared/lib/time'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { NotificationRendererProps } from '@open-mercato/shared/modules/notifications/types'\n\nexport function ConversationSharedRenderer({\n notification,\n onAction,\n onDismiss,\n actions = [],\n}: NotificationRendererProps) {\n const t = useT()\n const router = useRouter()\n const [executing, setExecuting] = React.useState(false)\n const isUnread = notification.status === 'unread'\n const viewAction = actions.find((a) => a.id === 'view') ?? actions[0] ?? null\n\n const handleView = async () => {\n setExecuting(true)\n try {\n if (viewAction) {\n await onAction(viewAction.id)\n }\n if (notification.linkHref) router.push(notification.linkHref)\n } finally {\n setExecuting(false)\n }\n }\n\n const timeAgo = formatRelativeTime(notification.createdAt, { translate: t }) ?? ''\n\n return (\n <div\n className={cn(\n 'group relative flex gap-4 items-start rounded-xl p-3 transition-colors hover:bg-muted/40 cursor-pointer',\n isUnread && 'bg-muted/20',\n )}\n onClick={executing ? undefined : handleView}\n onKeyDown={(e) => {\n if (executing) return\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleView()\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n <div className=\"relative shrink-0 flex size-10 items-center justify-center rounded-full bg-status-info-bg\">\n <Share2 className=\"size-5 text-status-info-icon\" aria-hidden=\"true\" />\n {isUnread ? (\n <span\n className=\"absolute -right-1 -top-1 size-3 rounded-full bg-accent-indigo ring-2 ring-background\"\n aria-hidden=\"true\"\n />\n ) : null}\n </div>\n\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <p className=\"truncate text-sm font-medium leading-5 tracking-tight text-foreground\">\n {notification.title}\n </p>\n\n <div className=\"text-xs leading-4 text-muted-foreground\">\n {timeAgo ? <span className=\"whitespace-nowrap\">{timeAgo}</span> : null}\n </div>\n\n <div className=\"mt-2 flex items-center gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n className=\"h-8 rounded-md px-2.5 bg-accent-indigo text-accent-indigo-foreground hover:bg-accent-indigo/90\"\n onClick={(e) => {\n e.stopPropagation()\n handleView()\n }}\n disabled={executing || (!viewAction && !notification.linkHref)}\n >\n <ExternalLink className=\"size-3.5\" aria-hidden=\"true\" />\n {t('ai_assistant.notifications.conversation_shared.view_button', 'View Conversation')}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"h-8 rounded-md px-2.5\"\n onClick={(e) => {\n e.stopPropagation()\n onDismiss()\n }}\n >\n {t('notifications.actions.dismiss', 'Dismiss')}\n </Button>\n </div>\n </div>\n\n <IconButton\n type=\"button\"\n variant=\"ghost\"\n size=\"xs\"\n className=\"absolute right-2 top-2 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100\"\n onClick={(e) => {\n e.stopPropagation()\n onDismiss()\n }}\n aria-label={t('notifications.actions.dismiss', 'Dismiss')}\n >\n <X className=\"size-3.5\" />\n </IconButton>\n </div>\n )\n}\n\nexport default ConversationSharedRenderer\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Share2, ExternalLink, X } from 'lucide-react'\nimport { useRouter } from 'next/navigation'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { cn } from '@open-mercato/shared/lib/utils'\nimport { formatRelativeTime } from '@open-mercato/shared/lib/time'\nimport { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { NotificationRendererProps } from '@open-mercato/shared/modules/notifications/types'\n\nexport function ConversationSharedRenderer({\n notification,\n onAction,\n onDismiss,\n actions = [],\n}: NotificationRendererProps) {\n const t = useT()\n const locale = useLocale()\n const router = useRouter()\n const [executing, setExecuting] = React.useState(false)\n const isUnread = notification.status === 'unread'\n const viewAction = actions.find((a) => a.id === 'view') ?? actions[0] ?? null\n\n const handleView = async () => {\n setExecuting(true)\n try {\n if (viewAction) {\n await onAction(viewAction.id)\n }\n if (notification.linkHref) router.push(notification.linkHref)\n } finally {\n setExecuting(false)\n }\n }\n\n const timeAgo = formatRelativeTime(notification.createdAt, { locale, translate: t }) ?? ''\n\n return (\n <div\n className={cn(\n 'group relative flex gap-4 items-start rounded-xl p-3 transition-colors hover:bg-muted/40 cursor-pointer',\n isUnread && 'bg-muted/20',\n )}\n onClick={executing ? undefined : handleView}\n onKeyDown={(e) => {\n if (executing) return\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleView()\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n <div className=\"relative shrink-0 flex size-10 items-center justify-center rounded-full bg-status-info-bg\">\n <Share2 className=\"size-5 text-status-info-icon\" aria-hidden=\"true\" />\n {isUnread ? (\n <span\n className=\"absolute -right-1 -top-1 size-3 rounded-full bg-accent-indigo ring-2 ring-background\"\n aria-hidden=\"true\"\n />\n ) : null}\n </div>\n\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <p className=\"truncate text-sm font-medium leading-5 tracking-tight text-foreground\">\n {notification.title}\n </p>\n\n <div className=\"text-xs leading-4 text-muted-foreground\">\n {timeAgo ? <span className=\"whitespace-nowrap\">{timeAgo}</span> : null}\n </div>\n\n <div className=\"mt-2 flex items-center gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n className=\"h-8 rounded-md px-2.5 bg-accent-indigo text-accent-indigo-foreground hover:bg-accent-indigo/90\"\n onClick={(e) => {\n e.stopPropagation()\n handleView()\n }}\n disabled={executing || (!viewAction && !notification.linkHref)}\n >\n <ExternalLink className=\"size-3.5\" aria-hidden=\"true\" />\n {t('ai_assistant.notifications.conversation_shared.view_button', 'View Conversation')}\n </Button>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className=\"h-8 rounded-md px-2.5\"\n onClick={(e) => {\n e.stopPropagation()\n onDismiss()\n }}\n >\n {t('notifications.actions.dismiss', 'Dismiss')}\n </Button>\n </div>\n </div>\n\n <IconButton\n type=\"button\"\n variant=\"ghost\"\n size=\"xs\"\n className=\"absolute right-2 top-2 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100\"\n onClick={(e) => {\n e.stopPropagation()\n onDismiss()\n }}\n aria-label={t('notifications.actions.dismiss', 'Dismiss')}\n >\n <X className=\"size-3.5\" />\n </IconButton>\n </div>\n )\n}\n\nexport default ConversationSharedRenderer\n"],
|
|
5
|
+
"mappings": ";AAwDM,SACE,KADF;AAtDN,YAAY,WAAW;AACvB,SAAS,QAAQ,cAAc,SAAS;AACxC,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,WAAW,YAAY;AAGzB,SAAS,2BAA2B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AACb,GAA8B;AAC5B,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,UAAU;AACzB,QAAM,SAAS,UAAU;AACzB,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,KAAK;AACtD,QAAM,WAAW,aAAa,WAAW;AACzC,QAAM,aAAa,QAAQ,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,KAAK;AAEzE,QAAM,aAAa,YAAY;AAC7B,iBAAa,IAAI;AACjB,QAAI;AACF,UAAI,YAAY;AACd,cAAM,SAAS,WAAW,EAAE;AAAA,MAC9B;AACA,UAAI,aAAa,SAAU,QAAO,KAAK,aAAa,QAAQ;AAAA,IAC9D,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;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,oBAAE,gBAAgB;AAClB,4BAAU;AAAA,gBACZ;AAAA,gBAEC,YAAE,iCAAiC,SAAS;AAAA;AAAA,YAC/C;AAAA,aACF;AAAA,WACF;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS,CAAC,MAAM;AACd,gBAAE,gBAAgB;AAClB,wBAAU;AAAA,YACZ;AAAA,YACA,cAAY,EAAE,iCAAiC,SAAS;AAAA,YAExD,8BAAC,KAAE,WAAU,YAAW;AAAA;AAAA,QAC1B;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,qCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/ai-assistant",
|
|
3
|
-
"version": "0.6.8-develop.
|
|
3
|
+
"version": "0.6.8-develop.6976.1.9b79145ac4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -99,16 +99,16 @@
|
|
|
99
99
|
"zod-to-json-schema": "^3.25.2"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
|
-
"@open-mercato/shared": "0.6.8-develop.
|
|
103
|
-
"@open-mercato/ui": "0.6.8-develop.
|
|
102
|
+
"@open-mercato/shared": "0.6.8-develop.6976.1.9b79145ac4",
|
|
103
|
+
"@open-mercato/ui": "0.6.8-develop.6976.1.9b79145ac4",
|
|
104
104
|
"react": "^19.0.0",
|
|
105
105
|
"react-dom": "^19.0.0",
|
|
106
106
|
"zod": ">=3.23.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@open-mercato/cli": "0.6.8-develop.
|
|
110
|
-
"@open-mercato/shared": "0.6.8-develop.
|
|
111
|
-
"@open-mercato/ui": "0.6.8-develop.
|
|
109
|
+
"@open-mercato/cli": "0.6.8-develop.6976.1.9b79145ac4",
|
|
110
|
+
"@open-mercato/shared": "0.6.8-develop.6976.1.9b79145ac4",
|
|
111
|
+
"@open-mercato/ui": "0.6.8-develop.6976.1.9b79145ac4",
|
|
112
112
|
"@types/react": "^19.2.17",
|
|
113
113
|
"@types/react-dom": "^19.2.3",
|
|
114
114
|
"react": "19.2.8",
|
|
@@ -7,7 +7,7 @@ import { Button } from '@open-mercato/ui/primitives/button'
|
|
|
7
7
|
import { IconButton } from '@open-mercato/ui/primitives/icon-button'
|
|
8
8
|
import { cn } from '@open-mercato/shared/lib/utils'
|
|
9
9
|
import { formatRelativeTime } from '@open-mercato/shared/lib/time'
|
|
10
|
-
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
10
|
+
import { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'
|
|
11
11
|
import type { NotificationRendererProps } from '@open-mercato/shared/modules/notifications/types'
|
|
12
12
|
|
|
13
13
|
export function ConversationSharedRenderer({
|
|
@@ -17,6 +17,7 @@ export function ConversationSharedRenderer({
|
|
|
17
17
|
actions = [],
|
|
18
18
|
}: NotificationRendererProps) {
|
|
19
19
|
const t = useT()
|
|
20
|
+
const locale = useLocale()
|
|
20
21
|
const router = useRouter()
|
|
21
22
|
const [executing, setExecuting] = React.useState(false)
|
|
22
23
|
const isUnread = notification.status === 'unread'
|
|
@@ -34,7 +35,7 @@ export function ConversationSharedRenderer({
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
const timeAgo = formatRelativeTime(notification.createdAt, { translate: t }) ?? ''
|
|
38
|
+
const timeAgo = formatRelativeTime(notification.createdAt, { locale, translate: t }) ?? ''
|
|
38
39
|
|
|
39
40
|
return (
|
|
40
41
|
<div
|