@memori.ai/memori-react 8.45.1 → 8.45.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/CHANGELOG.md +7 -0
- package/dist/components/UploadButton/UploadButton.js +3 -0
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -2
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/dist/helpers/constants.d.ts +3 -2
- package/dist/helpers/constants.js +19 -20
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/utils.d.ts +2 -1
- package/dist/helpers/utils.js +7 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/UploadButton/UploadButton.js +4 -1
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +16 -4
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/esm/helpers/constants.d.ts +3 -2
- package/esm/helpers/constants.js +18 -19
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/utils.d.ts +2 -1
- package/esm/helpers/utils.js +6 -1
- package/esm/helpers/utils.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +1 -1
- package/src/components/UploadButton/UploadButton.tsx +4 -0
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +21 -5
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +2 -2
- package/src/helpers/constants.ts +21 -20
- package/src/helpers/utils.test.ts +14 -4
- package/src/helpers/utils.ts +6 -1
- package/src/version.ts +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +0 -36
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +0 -116
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +0 -1
- package/dist/components/DrawerFooter/DrawerFooter.d.ts +0 -12
- package/dist/components/DrawerFooter/DrawerFooter.js +0 -10
- package/dist/components/DrawerFooter/DrawerFooter.js.map +0 -1
- package/dist/components/IconButton/IconButton.d.ts +0 -9
- package/dist/components/IconButton/IconButton.js +0 -36
- package/dist/components/IconButton/IconButton.js.map +0 -1
- package/dist/components/MobileSessionPanel/MobileSessionPanel.d.ts +0 -65
- package/dist/components/MobileSessionPanel/MobileSessionPanel.js +0 -294
- package/dist/components/MobileSessionPanel/MobileSessionPanel.js.map +0 -1
- package/dist/components/PositionPopover/PositionPopover.d.ts +0 -22
- package/dist/components/PositionPopover/PositionPopover.js +0 -195
- package/dist/components/PositionPopover/PositionPopover.js.map +0 -1
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.d.ts +0 -4
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js +0 -64
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +0 -1
- package/dist/context/widgetSurfaceContext.d.ts +0 -3
- package/dist/context/widgetSurfaceContext.js +0 -11
- package/dist/context/widgetSurfaceContext.js.map +0 -1
- package/dist/helpers/positionPopover.d.ts +0 -1
- package/dist/helpers/positionPopover.js +0 -7
- package/dist/helpers/positionPopover.js.map +0 -1
- package/dist/helpers/tts/muteSpeaker.d.ts +0 -13
- package/dist/helpers/tts/muteSpeaker.js +0 -26
- package/dist/helpers/tts/muteSpeaker.js.map +0 -1
- package/dist/helpers/usePressTooltip.d.ts +0 -13
- package/dist/helpers/usePressTooltip.js +0 -23
- package/dist/helpers/usePressTooltip.js.map +0 -1
- package/dist/icons/FacebookIcon.d.ts +0 -3
- package/dist/icons/FacebookIcon.js +0 -6
- package/dist/icons/FacebookIcon.js.map +0 -1
- package/dist/icons/LinkedinIcon.d.ts +0 -3
- package/dist/icons/LinkedinIcon.js +0 -6
- package/dist/icons/LinkedinIcon.js.map +0 -1
- package/dist/icons/MemoriIcon.d.ts +0 -3
- package/dist/icons/MemoriIcon.js +0 -8
- package/dist/icons/MemoriIcon.js.map +0 -1
- package/dist/icons/TelegramIcon.d.ts +0 -3
- package/dist/icons/TelegramIcon.js +0 -6
- package/dist/icons/TelegramIcon.js.map +0 -1
- package/dist/icons/TwitterIcon.d.ts +0 -3
- package/dist/icons/TwitterIcon.js +0 -6
- package/dist/icons/TwitterIcon.js.map +0 -1
- package/dist/icons/WhatsappIcon.d.ts +0 -3
- package/dist/icons/WhatsappIcon.js +0 -6
- package/dist/icons/WhatsappIcon.js.map +0 -1
- package/dist/icons/artifacts/DocumentIcon.d.ts +0 -3
- package/dist/icons/artifacts/DocumentIcon.js +0 -6
- package/dist/icons/artifacts/DocumentIcon.js.map +0 -1
- package/dist/icons/artifacts/HtmlIcon.d.ts +0 -3
- package/dist/icons/artifacts/HtmlIcon.js +0 -6
- package/dist/icons/artifacts/HtmlIcon.js.map +0 -1
- package/dist/icons/artifacts/JavascriptIcon.d.ts +0 -3
- package/dist/icons/artifacts/JavascriptIcon.js +0 -6
- package/dist/icons/artifacts/JavascriptIcon.js.map +0 -1
- package/dist/icons/artifacts/MarkdownIcon.d.ts +0 -3
- package/dist/icons/artifacts/MarkdownIcon.js +0 -6
- package/dist/icons/artifacts/MarkdownIcon.js.map +0 -1
- package/dist/icons/artifacts/PythonIcon.d.ts +0 -3
- package/dist/icons/artifacts/PythonIcon.js +0 -6
- package/dist/icons/artifacts/PythonIcon.js.map +0 -1
- package/dist/icons/artifacts/SvgIcon.d.ts +0 -3
- package/dist/icons/artifacts/SvgIcon.js +0 -6
- package/dist/icons/artifacts/SvgIcon.js.map +0 -1
- package/dist/icons/artifacts/XmlIcon.d.ts +0 -3
- package/dist/icons/artifacts/XmlIcon.js +0 -6
- package/dist/icons/artifacts/XmlIcon.js.map +0 -1
- package/dist/icons/artifacts/cssIcon.d.ts +0 -3
- package/dist/icons/artifacts/cssIcon.js +0 -6
- package/dist/icons/artifacts/cssIcon.js.map +0 -1
- package/dist/testUtils.d.ts +0 -5
- package/dist/testUtils.js +0 -18
- package/dist/testUtils.js.map +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const ui_1 = require("@memori.ai/ui");
|
|
7
|
-
const lucide_react_1 = require("lucide-react");
|
|
8
|
-
const react_i18next_1 = require("react-i18next");
|
|
9
|
-
const utils_1 = require("../../helpers/utils");
|
|
10
|
-
const Chat_1 = tslib_1.__importDefault(require("../Chat/Chat"));
|
|
11
|
-
const ANIMATION_DURATION_MS = 280;
|
|
12
|
-
const EMPTY_MEMORI = {
|
|
13
|
-
memoriID: 'chat-resume-drawer',
|
|
14
|
-
name: 'AI',
|
|
15
|
-
culture: 'it-IT',
|
|
16
|
-
coverURL: '',
|
|
17
|
-
avatarURL: '',
|
|
18
|
-
enableBoardOfExperts: false,
|
|
19
|
-
};
|
|
20
|
-
const NOOP = () => { };
|
|
21
|
-
const stripMarkdownChars = (value) => {
|
|
22
|
-
return value
|
|
23
|
-
.replace(/[#*_`~>\-[\]()]/g, ' ')
|
|
24
|
-
.replace(/\s+/g, ' ')
|
|
25
|
-
.trim();
|
|
26
|
-
};
|
|
27
|
-
const escapeAttachmentAttr = (value) => value.replaceAll('"', '"');
|
|
28
|
-
const ChatResumeDrawer = ({ isOpen, onClose, onBack, embedded = false, session, onResume, isLoading = false, onExportChat, }) => {
|
|
29
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
30
|
-
const dialogRef = (0, react_1.useRef)(null);
|
|
31
|
-
const panelRef = (0, react_1.useRef)(null);
|
|
32
|
-
const backButtonRef = (0, react_1.useRef)(null);
|
|
33
|
-
const titleId = 'chat-resume-drawer-title';
|
|
34
|
-
const [shouldRender, setShouldRender] = (0, react_1.useState)(isOpen);
|
|
35
|
-
const [isVisible, setIsVisible] = (0, react_1.useState)(isOpen);
|
|
36
|
-
(0, react_1.useEffect)(() => {
|
|
37
|
-
if (isOpen) {
|
|
38
|
-
setShouldRender(true);
|
|
39
|
-
requestAnimationFrame(() => setIsVisible(true));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
setIsVisible(false);
|
|
43
|
-
const timeout = window.setTimeout(() => {
|
|
44
|
-
setShouldRender(false);
|
|
45
|
-
}, ANIMATION_DURATION_MS);
|
|
46
|
-
return () => window.clearTimeout(timeout);
|
|
47
|
-
}, [isOpen]);
|
|
48
|
-
(0, react_1.useEffect)(() => {
|
|
49
|
-
var _a;
|
|
50
|
-
if (!isOpen)
|
|
51
|
-
return;
|
|
52
|
-
(_a = backButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
53
|
-
}, [isOpen]);
|
|
54
|
-
(0, react_1.useEffect)(() => {
|
|
55
|
-
if (!isOpen || embedded)
|
|
56
|
-
return;
|
|
57
|
-
const previouslyFocused = document.activeElement;
|
|
58
|
-
const root = dialogRef.current;
|
|
59
|
-
if (!root)
|
|
60
|
-
return;
|
|
61
|
-
const handleKeyDown = (event) => {
|
|
62
|
-
if (event.key === 'Escape') {
|
|
63
|
-
onClose();
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (event.key !== 'Tab')
|
|
67
|
-
return;
|
|
68
|
-
const focusableElements = root.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
69
|
-
if (!focusableElements.length)
|
|
70
|
-
return;
|
|
71
|
-
const first = focusableElements[0];
|
|
72
|
-
const last = focusableElements[focusableElements.length - 1];
|
|
73
|
-
const active = document.activeElement;
|
|
74
|
-
if (event.shiftKey && active === first) {
|
|
75
|
-
event.preventDefault();
|
|
76
|
-
last.focus();
|
|
77
|
-
}
|
|
78
|
-
else if (!event.shiftKey && active === last) {
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
first.focus();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
84
|
-
return () => {
|
|
85
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
86
|
-
previouslyFocused === null || previouslyFocused === void 0 ? void 0 : previouslyFocused.focus();
|
|
87
|
-
};
|
|
88
|
-
}, [embedded, isOpen, onClose]);
|
|
89
|
-
const safeTitle = (0, react_1.useMemo)(() => {
|
|
90
|
-
const cleaned = stripMarkdownChars((0, utils_1.stripHTML)(session.title || ''));
|
|
91
|
-
return cleaned || 'Conversazione';
|
|
92
|
-
}, [session.title]);
|
|
93
|
-
const history = (0, react_1.useMemo)(() => session.messages.map(message => {
|
|
94
|
-
const attachmentTag = message.attachment
|
|
95
|
-
? `<document_attachment filename="${escapeAttachmentAttr(message.attachment.name)}" type="${escapeAttachmentAttr(message.attachment.type)}"></document_attachment>`
|
|
96
|
-
: '';
|
|
97
|
-
const interruptedText = message.role === 'assistant' && message.status === 'interrupted'
|
|
98
|
-
? 'Risposta interrotta - sessione in pausa'
|
|
99
|
-
: message.content;
|
|
100
|
-
return {
|
|
101
|
-
fromUser: message.role === 'user',
|
|
102
|
-
text: `${interruptedText}${attachmentTag}`,
|
|
103
|
-
timestamp: message.timestamp,
|
|
104
|
-
media: message.media || [],
|
|
105
|
-
};
|
|
106
|
-
}), [session.messages]);
|
|
107
|
-
if (!embedded && !shouldRender)
|
|
108
|
-
return null;
|
|
109
|
-
const content = ((0, jsx_runtime_1.jsxs)("div", { ref: panelRef, className: `memori-chat-resume-drawer--panel ${embedded ? 'memori-chat-resume-drawer--panel-embedded' : ''}`, onClick: event => event.stopPropagation(), children: [(0, jsx_runtime_1.jsxs)("header", { className: "memori-chat-resume-drawer--header", children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { ref: backButtonRef, variant: "ghost", type: "button", className: "memori-chat-resume-drawer--header-icon-button", onClick: onBack || onClose, "aria-label": String(t('back', { defaultValue: 'Back' })), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowLeft, { size: 16, "aria-hidden": true }) }), (0, jsx_runtime_1.jsxs)("div", { className: "memori-chat-resume-drawer--header-main", children: [(0, jsx_runtime_1.jsx)("h2", { id: titleId, className: "memori-chat-resume-drawer--title", title: safeTitle, children: safeTitle }), (0, jsx_runtime_1.jsx)("p", { className: "memori-chat-resume-drawer--subtitle", children: session.subtitle })] }), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "ghost", size: "sm", className: "memori-chat-history-drawer--header-download-button", "aria-label": String(t('download', { defaultValue: 'Download' })), title: String(t('download', { defaultValue: 'Download' })), icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Download, { "aria-hidden": true }), onClick: onExportChat })] }), (0, jsx_runtime_1.jsxs)("div", { className: "memori-chat-resume-drawer--thread", children: [isLoading && ((0, jsx_runtime_1.jsx)("div", { className: "memori-chat-resume-drawer--skeletons", children: [0, 1, 2].map(item => ((0, jsx_runtime_1.jsx)("div", { className: "memori-chat-resume-drawer--skeleton-bubble" }, item))) })), !isLoading && ((0, jsx_runtime_1.jsx)("div", { className: "memori-chat-resume-drawer--embedded-chat", children: (0, jsx_runtime_1.jsx)(Chat_1.default, { memori: EMPTY_MEMORI, sessionID: "chat-resume-drawer", history: history, pushMessage: NOOP, simulateUserPrompt: NOOP, setSendOnEnter: NOOP, setAttachmentsMenuOpen: NOOP, onChangeUserMessage: NOOP, sendMessage: NOOP, setEnableFocusChatInput: NOOP, stopAudio: NOOP, startListening: NOOP, stopListening: NOOP, showInputs: false, showAIicon: true, showCopyButton: true, isHistoryView: true, isChatlogPanel: true }) }))] }), (0, jsx_runtime_1.jsx)("footer", { className: "memori-chat-resume-drawer--actions", children: (0, jsx_runtime_1.jsxs)(ui_1.Button, { className: "memori-chat-resume-drawer--resume-cta", variant: "primary", onClick: () => onResume(), children: [t('chatResume.resume', { defaultValue: 'Resume conversation' }), ' ', (0, jsx_runtime_1.jsx)(lucide_react_1.ArrowUpRight, { size: 16, "aria-hidden": true })] }) })] }));
|
|
110
|
-
if (embedded) {
|
|
111
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "memori-chat-resume-drawer--embedded-shell", children: content }));
|
|
112
|
-
}
|
|
113
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: dialogRef, className: `memori-chat-resume-drawer ${isVisible ? 'memori-chat-resume-drawer--open' : ''}`, role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { className: "memori-chat-resume-drawer--backdrop", type: "button", "aria-label": String(t('close', { defaultValue: 'Close' })), onClick: onClose }), content] }));
|
|
114
|
-
};
|
|
115
|
-
exports.default = ChatResumeDrawer;
|
|
116
|
-
//# sourceMappingURL=ChatResumeDrawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatResumeDrawer.js","sourceRoot":"","sources":["../../../src/components/ChatHistoryDrawer/ChatResumeDrawer.tsx"],"names":[],"mappings":";;;;AAAA,iCAAoE;AACpE,sCAAuC;AAKvC,+CAAiE;AACjE,iDAA+C;AAC/C,+CAAgD;AAChD,gEAAgC;AAkChC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,oBAAoB;IAC9B,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,EAAE;IACZ,SAAS,EAAE,EAAE;IACb,oBAAoB,EAAE,KAAK;CAClB,CAAC;AACZ,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAU,EAAE;IACnD,OAAO,KAAK;SACT,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC;SAChC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAU,EAAE,CACrD,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,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,SAAS,EACd,SAAS,EAAE,6BACT,SAAS,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,EAClD,EAAE,EACF,IAAI,EAAC,QAAQ,gBACF,MAAM,qBACA,OAAO,aAExB,uBAAC,WAAM,IACL,SAAS,EAAC,qCAAqC,EAC/C,IAAI,EAAC,QAAQ,gBACD,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC,EACzD,OAAO,EAAE,OAAO,GAChB,EACD,OAAO,IACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface DrawerFooterProps {
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
start?: React.ReactNode;
|
|
5
|
-
end?: React.ReactNode;
|
|
6
|
-
center?: React.ReactNode;
|
|
7
|
-
closeLabel?: string;
|
|
8
|
-
onClose?: () => void;
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
declare const DrawerFooter: React.FC<DrawerFooterProps>;
|
|
12
|
-
export default DrawerFooter;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const ui_1 = require("@memori.ai/ui");
|
|
5
|
-
const DrawerFooter = ({ children, start, end, center, closeLabel, onClose, className = '', }) => {
|
|
6
|
-
const hasSlots = start != null || end != null || center != null || closeLabel != null;
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)("footer", { className: `memori-drawer-footer ${className}`.trim(), children: center != null ? ((0, jsx_runtime_1.jsx)("div", { className: "memori-drawer-footer__inner memori-drawer-footer__inner--centered", children: center })) : children != null && !hasSlots ? ((0, jsx_runtime_1.jsx)("div", { className: "memori-drawer-footer__inner memori-drawer-footer__inner--centered", children: children })) : ((0, jsx_runtime_1.jsxs)("div", { className: "memori-drawer-footer__inner", children: [start != null && ((0, jsx_runtime_1.jsx)("div", { className: "memori-drawer-footer__start", children: start })), (0, jsx_runtime_1.jsxs)("div", { className: "memori-drawer-footer__end", children: [end, closeLabel != null && onClose != null && ((0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "primary", onClick: onClose, children: closeLabel }))] })] })) }));
|
|
8
|
-
};
|
|
9
|
-
exports.default = DrawerFooter;
|
|
10
|
-
//# sourceMappingURL=DrawerFooter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerFooter.js","sourceRoot":"","sources":["../../../src/components/DrawerFooter/DrawerFooter.tsx"],"names":[],"mappings":";;;AACA,sCAAuC;AAgBvC,MAAM,YAAY,GAAgC,CAAC,EACjD,QAAQ,EACR,KAAK,EACL,GAAG,EACH,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,GAAG,EAAE,GACf,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,KAAK,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAC;IAEtF,OAAO,CACL,mCAAQ,SAAS,EAAE,wBAAwB,SAAS,EAAE,CAAC,IAAI,EAAE,YAC1D,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAChB,gCAAK,SAAS,EAAC,mEAAmE,YAC/E,MAAM,GACH,CACP,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAClC,gCAAK,SAAS,EAAC,mEAAmE,YAC/E,QAAQ,GACL,CACP,CAAC,CAAC,CAAC,CACF,iCAAK,SAAS,EAAC,6BAA6B,aACzC,KAAK,IAAI,IAAI,IAAI,CAChB,gCAAK,SAAS,EAAC,6BAA6B,YAAE,KAAK,GAAO,CAC3D,EACD,iCAAK,SAAS,EAAC,2BAA2B,aACvC,GAAG,EACH,UAAU,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,CACxC,uBAAC,WAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,OAAO,YACvC,UAAU,GACJ,CACV,IACG,IACF,CACP,GACM,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button } from '@memori.ai/ui';
|
|
3
|
-
export type IconButtonProps = Omit<React.ComponentProps<typeof Button>, 'variant' | 'active'> & {
|
|
4
|
-
active?: boolean;
|
|
5
|
-
recording?: boolean;
|
|
6
|
-
variant?: React.ComponentProps<typeof Button>['variant'];
|
|
7
|
-
};
|
|
8
|
-
declare const IconButton: React.ForwardRefExoticComponent<Pick<IconButtonProps, "children" | "form" | "slot" | "style" | "title" | "shape" | "value" | "className" | "key" | "name" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "render" | "type" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "focusableWhenDisabled" | "nativeButton" | "danger" | "variant" | "loading" | "icon" | "size" | "active" | "fullWidth" | "iconPosition" | "shadow" | "ariaLabel" | "recording"> & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
-
export default IconButton;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
7
|
-
const ui_1 = require("@memori.ai/ui");
|
|
8
|
-
function hasVisibleLabel(children) {
|
|
9
|
-
return react_1.default.Children.toArray(children).some(child => {
|
|
10
|
-
if (child === null || child === undefined)
|
|
11
|
-
return false;
|
|
12
|
-
if (typeof child === 'boolean')
|
|
13
|
-
return false;
|
|
14
|
-
if (typeof child === 'string')
|
|
15
|
-
return child.trim().length > 0;
|
|
16
|
-
if (typeof child === 'number')
|
|
17
|
-
return true;
|
|
18
|
-
return true;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
const IconButton = react_1.default.forwardRef(({ active = false, recording = false, className, variant = 'toolbar', shape = 'default', size = 'sm', children, ...rest }, ref) => {
|
|
22
|
-
const isRecording = !!recording;
|
|
23
|
-
const isActive = !!active && !isRecording;
|
|
24
|
-
const isLabeled = hasVisibleLabel(children);
|
|
25
|
-
const resolvedVariant = variant === 'primary' ||
|
|
26
|
-
variant === 'secondary' ||
|
|
27
|
-
variant === 'danger' ||
|
|
28
|
-
variant === 'outline' ||
|
|
29
|
-
variant === 'ghost'
|
|
30
|
-
? 'toolbar'
|
|
31
|
-
: variant;
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(ui_1.Button, { ref: ref, variant: resolvedVariant, shape: shape, size: size, active: isActive, className: (0, classnames_1.default)('memori-icon-button', isLabeled && 'memori-icon-button--labeled', isActive && 'memori-icon-button--active', isRecording && 'memori-icon-button--recording', className), ...rest, children: children }));
|
|
33
|
-
});
|
|
34
|
-
IconButton.displayName = 'IconButton';
|
|
35
|
-
exports.default = IconButton;
|
|
36
|
-
//# sourceMappingURL=IconButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","source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L,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,QAAQ,EAChB,SAAS,EAAE,IAAA,oBAAE,EACX,oBAAoB,EACpB,SAAS,IAAI,6BAA6B,EAC1C,QAAQ,IAAI,4BAA4B,EACxC,WAAW,IAAI,+BAA+B,EAC9C,SAAS,CACV,KACG,IAAI,YAEP,QAAQ,GACF,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,kBAAe,UAAU,CAAC"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Message, User, Venue } from '@memori.ai/memori-api-client/dist/types';
|
|
3
|
-
type SessionAction = {
|
|
4
|
-
key: string;
|
|
5
|
-
icon: React.ReactNode;
|
|
6
|
-
title: string;
|
|
7
|
-
subtitle?: string;
|
|
8
|
-
onClick?: () => void;
|
|
9
|
-
trailing?: React.ReactNode;
|
|
10
|
-
view?: 'location' | 'knownFacts' | 'share';
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export interface MobileSessionPanelProps {
|
|
14
|
-
open: boolean;
|
|
15
|
-
onClose: () => void;
|
|
16
|
-
presentation?: 'sheet' | 'popover';
|
|
17
|
-
title: string;
|
|
18
|
-
loginToken?: string;
|
|
19
|
-
userName: string;
|
|
20
|
-
userInitial?: string;
|
|
21
|
-
user?: User;
|
|
22
|
-
apiClient?: {
|
|
23
|
-
backend?: {
|
|
24
|
-
uploadAsset?: (name: string, payload: string, token: string) => Promise<any>;
|
|
25
|
-
pwlUpdateUser?: (token: string, userID: string, user: Partial<User>) => Promise<any>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
userEmail?: string;
|
|
29
|
-
birthDate?: string;
|
|
30
|
-
avatarURL?: string;
|
|
31
|
-
actions: SessionAction[];
|
|
32
|
-
logoutLabel?: string;
|
|
33
|
-
onLogout?: () => void;
|
|
34
|
-
onKnownFactsOpen?: () => void;
|
|
35
|
-
onLocationEnable?: () => void;
|
|
36
|
-
onLocationDisable?: () => void;
|
|
37
|
-
knownFactsPageTitle?: string;
|
|
38
|
-
sharePageTitle?: string;
|
|
39
|
-
locationPageTitle?: string;
|
|
40
|
-
backLabel?: string;
|
|
41
|
-
locationStatusLabel?: string;
|
|
42
|
-
locationPlace?: string;
|
|
43
|
-
locationUnknownLabel?: string;
|
|
44
|
-
locationEnableLabel?: string;
|
|
45
|
-
locationDisableLabel?: string;
|
|
46
|
-
venue?: Venue;
|
|
47
|
-
setVenue?: (venue?: Venue) => void;
|
|
48
|
-
knownFactsDescription?: string;
|
|
49
|
-
knownFactsCtaLabel?: string;
|
|
50
|
-
knownFactsCountLabel?: string;
|
|
51
|
-
shareContent?: React.ReactNode;
|
|
52
|
-
knownFactsDisabled?: boolean;
|
|
53
|
-
knownFactsHint?: string;
|
|
54
|
-
showSessionInfo?: boolean;
|
|
55
|
-
showKnownFacts?: boolean;
|
|
56
|
-
history?: Message[];
|
|
57
|
-
aiUsageTitle?: string;
|
|
58
|
-
showMessageConsumption?: boolean;
|
|
59
|
-
isLoggedIn?: boolean;
|
|
60
|
-
showLogin?: boolean;
|
|
61
|
-
loginLabel?: string;
|
|
62
|
-
onLogin?: () => void;
|
|
63
|
-
}
|
|
64
|
-
declare const MobileSessionPanel: React.FC<MobileSessionPanelProps>;
|
|
65
|
-
export default MobileSessionPanel;
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const lucide_react_1 = require("lucide-react");
|
|
7
|
-
const ui_1 = require("@memori.ai/ui");
|
|
8
|
-
const react_i18next_1 = require("react-i18next");
|
|
9
|
-
const error_1 = require("../../helpers/error");
|
|
10
|
-
const utils_1 = require("../../helpers/utils");
|
|
11
|
-
const GasStation_1 = tslib_1.__importDefault(require("../icons/GasStation"));
|
|
12
|
-
const ChatConsumptionDropdown_1 = require("../Header/ChatConsumptionDropdown");
|
|
13
|
-
const PositionPopover_1 = require("../PositionPopover/PositionPopover");
|
|
14
|
-
const getMetricValue = (metric) => {
|
|
15
|
-
if (typeof metric === 'number' && Number.isFinite(metric))
|
|
16
|
-
return metric;
|
|
17
|
-
if (!metric || typeof metric !== 'object')
|
|
18
|
-
return undefined;
|
|
19
|
-
if (typeof metric.parsedValue === 'number' &&
|
|
20
|
-
Number.isFinite(metric.parsedValue)) {
|
|
21
|
-
return metric.parsedValue;
|
|
22
|
-
}
|
|
23
|
-
if (typeof metric.source === 'string') {
|
|
24
|
-
const parsed = Number(metric.source);
|
|
25
|
-
if (Number.isFinite(parsed))
|
|
26
|
-
return parsed;
|
|
27
|
-
}
|
|
28
|
-
return undefined;
|
|
29
|
-
};
|
|
30
|
-
const formatMetricValue = (value, locale) => new Intl.NumberFormat(locale, {
|
|
31
|
-
minimumFractionDigits: 0,
|
|
32
|
-
maximumFractionDigits: Math.abs(value) >= 1 ? 3 : 4,
|
|
33
|
-
}).format(value);
|
|
34
|
-
const formatImpactInReadableUnit = (value, metricType, locale) => {
|
|
35
|
-
const absValue = Math.abs(value);
|
|
36
|
-
if (metricType === 'energy') {
|
|
37
|
-
if (absValue >= 1)
|
|
38
|
-
return `${formatMetricValue(value, locale)} kWh`;
|
|
39
|
-
const wh = value * 1000;
|
|
40
|
-
if (Math.abs(wh) >= 1)
|
|
41
|
-
return `${formatMetricValue(wh, locale)} Wh`;
|
|
42
|
-
return `${formatMetricValue(wh * 1000, locale)} mWh`;
|
|
43
|
-
}
|
|
44
|
-
if (metricType === 'co2') {
|
|
45
|
-
if (absValue >= 1)
|
|
46
|
-
return `${formatMetricValue(value, locale)} kg`;
|
|
47
|
-
const g = value * 1000;
|
|
48
|
-
if (Math.abs(g) >= 1)
|
|
49
|
-
return `${formatMetricValue(g, locale)} g`;
|
|
50
|
-
return `${formatMetricValue(g * 1000, locale)} mg`;
|
|
51
|
-
}
|
|
52
|
-
if (absValue >= 1)
|
|
53
|
-
return `${formatMetricValue(value, locale)} L`;
|
|
54
|
-
const ml = value * 1000;
|
|
55
|
-
if (Math.abs(ml) >= 1)
|
|
56
|
-
return `${formatMetricValue(ml, locale)} mL`;
|
|
57
|
-
return `${formatMetricValue(ml * 1000, locale)} μL`;
|
|
58
|
-
};
|
|
59
|
-
const MobileSessionPanel = ({ open, onClose, presentation = 'sheet', title, loginToken, userName, user, apiClient, userEmail, birthDate, avatarURL, actions, logoutLabel = 'Log out', onLogout, onKnownFactsOpen, onLocationEnable, onLocationDisable, knownFactsPageTitle = 'Known facts', sharePageTitle = 'Share', locationPageTitle = 'Location tracking', backLabel = 'Back', locationStatusLabel = 'Status', locationPlace, locationUnknownLabel = 'Unknown position', locationEnableLabel = 'Use current position', locationDisableLabel = 'Disable location sharing', knownFactsDescription, knownFactsCtaLabel = 'Open full known facts', knownFactsCountLabel, shareContent, knownFactsDisabled = false, knownFactsHint, showSessionInfo = false, showKnownFacts = false, history = [], aiUsageTitle, showMessageConsumption = false, isLoggedIn = false, showLogin = false, loginLabel = 'Log in', onLogin, venue, setVenue, }) => {
|
|
60
|
-
const showAuthControls = showLogin;
|
|
61
|
-
const showProfileControls = showAuthControls && isLoggedIn;
|
|
62
|
-
const panelRef = (0, react_1.useRef)(null);
|
|
63
|
-
const dialogRef = (0, react_1.useRef)(null);
|
|
64
|
-
const panelTitleId = 'mobile-session-panel-title';
|
|
65
|
-
const touchStartYRef = (0, react_1.useRef)(0);
|
|
66
|
-
const [dragOffset, setDragOffset] = (0, react_1.useState)(0);
|
|
67
|
-
const [activeView, setActiveView] = (0, react_1.useState)('session');
|
|
68
|
-
const { uploadAsset, pwlUpdateUser } = (apiClient === null || apiClient === void 0 ? void 0 : apiClient.backend) || {};
|
|
69
|
-
const { add } = (0, ui_1.useAlertManager)();
|
|
70
|
-
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
71
|
-
const currentLocale = i18n.language || navigator.language || 'en';
|
|
72
|
-
const sustainabilityTotals = (0, react_1.useMemo)(() => {
|
|
73
|
-
const totals = { energy: 0, gwp: 0, wcf: 0 };
|
|
74
|
-
history.forEach(line => {
|
|
75
|
-
var _a, _b, _c, _d;
|
|
76
|
-
const energyImpact = (_a = line.llmUsage) === null || _a === void 0 ? void 0 : _a.energyImpact;
|
|
77
|
-
if (!energyImpact)
|
|
78
|
-
return;
|
|
79
|
-
totals.energy += (_b = getMetricValue(energyImpact.energy)) !== null && _b !== void 0 ? _b : 0;
|
|
80
|
-
totals.gwp += (_c = getMetricValue(energyImpact.gwp)) !== null && _c !== void 0 ? _c : 0;
|
|
81
|
-
totals.wcf += (_d = getMetricValue(energyImpact.wcf)) !== null && _d !== void 0 ? _d : 0;
|
|
82
|
-
});
|
|
83
|
-
return totals;
|
|
84
|
-
}, [history]);
|
|
85
|
-
const hasSustainabilityData = (0, react_1.useMemo)(() => history.some(line => {
|
|
86
|
-
var _a;
|
|
87
|
-
return !!((_a = line.llmUsage) === null || _a === void 0 ? void 0 : _a.energyImpact);
|
|
88
|
-
}), [history]);
|
|
89
|
-
const hasChatConsumptionData = (0, react_1.useMemo)(() => history.some(line => !!line.llmUsage), [history]);
|
|
90
|
-
const aiUsageSubtitle = hasSustainabilityData
|
|
91
|
-
? `${formatImpactInReadableUnit(sustainabilityTotals.energy, 'energy', currentLocale)} • ${formatImpactInReadableUnit(sustainabilityTotals.gwp, 'co2', currentLocale)}`
|
|
92
|
-
: t('widget.noData', { defaultValue: 'Nessun dato disponibile' });
|
|
93
|
-
const resolvedKnownFactsHint = knownFactsHint || t('widget.knownFactsHint') || 'What I remember about you';
|
|
94
|
-
const resolvedAiUsageTitle = aiUsageTitle || t('widget.aiConsumption') || 'AI usage';
|
|
95
|
-
(0, react_1.useEffect)(() => {
|
|
96
|
-
if (!open)
|
|
97
|
-
return;
|
|
98
|
-
const onEscape = (event) => {
|
|
99
|
-
if (event.key === 'Escape')
|
|
100
|
-
onClose();
|
|
101
|
-
};
|
|
102
|
-
document.addEventListener('keydown', onEscape);
|
|
103
|
-
return () => document.removeEventListener('keydown', onEscape);
|
|
104
|
-
}, [open, onClose]);
|
|
105
|
-
(0, react_1.useEffect)(() => {
|
|
106
|
-
var _a;
|
|
107
|
-
if (!open)
|
|
108
|
-
return;
|
|
109
|
-
const previouslyFocused = document.activeElement;
|
|
110
|
-
const root = dialogRef.current;
|
|
111
|
-
if (!root)
|
|
112
|
-
return;
|
|
113
|
-
const handleKeyDown = (event) => {
|
|
114
|
-
if (event.key !== 'Tab')
|
|
115
|
-
return;
|
|
116
|
-
const focusableElements = root.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
117
|
-
if (!focusableElements.length)
|
|
118
|
-
return;
|
|
119
|
-
const first = focusableElements[0];
|
|
120
|
-
const last = focusableElements[focusableElements.length - 1];
|
|
121
|
-
const active = document.activeElement;
|
|
122
|
-
if (event.shiftKey && active === first) {
|
|
123
|
-
event.preventDefault();
|
|
124
|
-
last.focus();
|
|
125
|
-
}
|
|
126
|
-
else if (!event.shiftKey && active === last) {
|
|
127
|
-
event.preventDefault();
|
|
128
|
-
first.focus();
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
132
|
-
(_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
133
|
-
return () => {
|
|
134
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
135
|
-
previouslyFocused === null || previouslyFocused === void 0 ? void 0 : previouslyFocused.focus();
|
|
136
|
-
};
|
|
137
|
-
}, [open]);
|
|
138
|
-
(0, react_1.useEffect)(() => {
|
|
139
|
-
if (open)
|
|
140
|
-
setActiveView('session');
|
|
141
|
-
}, [open]);
|
|
142
|
-
if (!open)
|
|
143
|
-
return null;
|
|
144
|
-
const updateAvatar = async (avatar) => {
|
|
145
|
-
if (!uploadAsset || !pwlUpdateUser) {
|
|
146
|
-
add((0, ui_1.createAlertOptions)({
|
|
147
|
-
description: t('login.avatarUploadError'),
|
|
148
|
-
severity: 'error',
|
|
149
|
-
}));
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (avatar && loginToken) {
|
|
153
|
-
const reader = new FileReader();
|
|
154
|
-
reader.onload = async (e) => {
|
|
155
|
-
var _a, _b, _c, _d;
|
|
156
|
-
try {
|
|
157
|
-
const { asset: avatarAsset, ...resp } = await uploadAsset((_a = avatar.name) !== null && _a !== void 0 ? _a : 'avatar', (_b = e.target) === null || _b === void 0 ? void 0 : _b.result, loginToken !== null && loginToken !== void 0 ? loginToken : '');
|
|
158
|
-
if (resp.resultCode !== 0) {
|
|
159
|
-
console.error('[updateAvatar] Upload failed:', resp);
|
|
160
|
-
add((0, ui_1.createAlertOptions)({
|
|
161
|
-
description: t((0, error_1.getErrori18nKey)(resp.resultCode)),
|
|
162
|
-
severity: 'error',
|
|
163
|
-
}));
|
|
164
|
-
}
|
|
165
|
-
else if (avatarAsset) {
|
|
166
|
-
let newUser = {
|
|
167
|
-
userID: (_c = user === null || user === void 0 ? void 0 : user.userID) !== null && _c !== void 0 ? _c : '',
|
|
168
|
-
avatarURL: avatarAsset.assetURL,
|
|
169
|
-
};
|
|
170
|
-
const { ...updateResp } = await pwlUpdateUser(loginToken !== null && loginToken !== void 0 ? loginToken : '', (_d = user === null || user === void 0 ? void 0 : user.userID) !== null && _d !== void 0 ? _d : '', newUser);
|
|
171
|
-
if (updateResp.resultCode !== 0) {
|
|
172
|
-
add((0, ui_1.createAlertOptions)({
|
|
173
|
-
description: t((0, error_1.getErrori18nKey)(updateResp.resultCode)),
|
|
174
|
-
severity: 'error',
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
add((0, ui_1.createAlertOptions)({
|
|
179
|
-
description: t('login.avatarUploadSuccess'),
|
|
180
|
-
severity: 'success',
|
|
181
|
-
}));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
catch (e) {
|
|
186
|
-
let err = e;
|
|
187
|
-
console.error('[updateAvatar] Error:', err);
|
|
188
|
-
if (err === null || err === void 0 ? void 0 : err.message)
|
|
189
|
-
add((0, ui_1.createAlertOptions)({
|
|
190
|
-
description: err.message,
|
|
191
|
-
severity: 'error',
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
reader.readAsDataURL(avatar);
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
console.error('[updateAvatar] Missing avatar or login token', {
|
|
199
|
-
avatar,
|
|
200
|
-
loginToken,
|
|
201
|
-
});
|
|
202
|
-
add((0, ui_1.createAlertOptions)({
|
|
203
|
-
description: t('login.avatarUploadError'),
|
|
204
|
-
severity: 'error',
|
|
205
|
-
}));
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
const isPopover = presentation === 'popover';
|
|
209
|
-
const isLocationEnabled = Boolean(locationPlace &&
|
|
210
|
-
locationPlace.trim().length > 0 &&
|
|
211
|
-
locationPlace !== locationUnknownLabel);
|
|
212
|
-
const visibleActions = actions.filter(action => {
|
|
213
|
-
const normalizedKey = action.key.toLowerCase();
|
|
214
|
-
const normalizedTitle = action.title.toLowerCase();
|
|
215
|
-
const isKnownFactsAction = action.view === 'knownFacts';
|
|
216
|
-
const isAudioAction = normalizedKey.includes('audio') ||
|
|
217
|
-
normalizedTitle.includes('audio') ||
|
|
218
|
-
normalizedTitle.includes('sound');
|
|
219
|
-
return !isKnownFactsAction && !isAudioAction;
|
|
220
|
-
});
|
|
221
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: dialogRef, className: `memori-mobile-session-panel--overlay ${isPopover ? 'memori-mobile-session-panel--overlay-popover' : ''}`, role: "presentation", children: [!isPopover && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "memori-mobile-session-panel--backdrop", "aria-label": String(t('close', { defaultValue: 'Close' })), onClick: onClose })), (0, jsx_runtime_1.jsxs)("section", { ref: panelRef, tabIndex: -1, className: `memori-mobile-session-panel ${isPopover ? 'memori-mobile-session-panel--popover' : ''}`, role: "dialog", "aria-modal": "true", "aria-labelledby": panelTitleId, onClick: event => event.stopPropagation(), onTouchStart: isPopover
|
|
222
|
-
? undefined
|
|
223
|
-
: event => {
|
|
224
|
-
touchStartYRef.current = event.touches[0].clientY;
|
|
225
|
-
setDragOffset(0);
|
|
226
|
-
}, onTouchMove: isPopover
|
|
227
|
-
? undefined
|
|
228
|
-
: event => {
|
|
229
|
-
const delta = event.touches[0].clientY - touchStartYRef.current;
|
|
230
|
-
if (delta > 0)
|
|
231
|
-
setDragOffset(delta);
|
|
232
|
-
}, onTouchEnd: isPopover
|
|
233
|
-
? undefined
|
|
234
|
-
: () => {
|
|
235
|
-
if (dragOffset > 90) {
|
|
236
|
-
onClose();
|
|
237
|
-
}
|
|
238
|
-
setDragOffset(0);
|
|
239
|
-
}, style: {
|
|
240
|
-
transform: dragOffset ? `translateY(${dragOffset}px)` : undefined,
|
|
241
|
-
}, children: [!isPopover && (0, jsx_runtime_1.jsx)("div", { className: "memori-mobile-session-panel--handle" }), activeView === 'session' ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showProfileControls && ((0, jsx_runtime_1.jsxs)("div", { className: "memori-mobile-session-panel--user", children: [(0, jsx_runtime_1.jsx)("div", { className: "memori-dropdown--avatar-wrap", children: avatarURL ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { src: avatarURL, alt: userName || userEmail, className: "memori-dropdown--avatar" }), (0, jsx_runtime_1.jsx)("span", { className: "memori-dropdown--avatar-overlay", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Camera, { size: 20, strokeWidth: 2 }) }), (0, jsx_runtime_1.jsx)("label", { htmlFor: "mobile-session-avatar-upload", className: "sr-only", children: t('login.changeAvatar', {
|
|
242
|
-
defaultValue: 'Change profile picture',
|
|
243
|
-
}) }), (0, jsx_runtime_1.jsx)("input", { type: "file", name: "avatar", id: "mobile-session-avatar-upload", className: "memori-dropdown--avatar-input", onChange: e => {
|
|
244
|
-
var _a, _b;
|
|
245
|
-
return updateAvatar((_b = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null);
|
|
246
|
-
}, accept: utils_1.imgMimeTypes.join(', ') })] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "memori-dropdown--avatar-placeholder", children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-dropdown--avatar-initial", children: (userName || userEmail || 'U')
|
|
247
|
-
.charAt(0)
|
|
248
|
-
.toUpperCase() }), (0, jsx_runtime_1.jsx)("span", { className: "memori-dropdown--avatar-overlay", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)(lucide_react_1.Camera, { size: 20, strokeWidth: 2 }) }), (0, jsx_runtime_1.jsx)("label", { htmlFor: "mobile-session-avatar-upload-placeholder", className: "sr-only", children: t('login.changeAvatar', {
|
|
249
|
-
defaultValue: 'Change profile picture',
|
|
250
|
-
}) }), (0, jsx_runtime_1.jsx)("input", { type: "file", name: "avatar", id: "mobile-session-avatar-upload-placeholder", className: "memori-dropdown--avatar-input", onChange: e => {
|
|
251
|
-
var _a, _b;
|
|
252
|
-
return updateAvatar((_b = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null);
|
|
253
|
-
}, accept: utils_1.imgMimeTypes.join(', ') })] }) })) }), (0, jsx_runtime_1.jsxs)("div", { className: "memori-dropdown--user-details", children: [(0, jsx_runtime_1.jsx)("h3", { className: "memori-dropdown--user-name", children: userName }), (0, jsx_runtime_1.jsx)("p", { className: "memori-dropdown--user-email", children: userEmail }), (0, jsx_runtime_1.jsx)("div", { className: "memori-dropdown--user-badge", children: birthDate
|
|
254
|
-
? new Date(birthDate).toLocaleDateString()
|
|
255
|
-
: 'Not set' })] })] })), (0, jsx_runtime_1.jsx)("h2", { id: panelTitleId, className: "memori-mobile-session-panel--section-title", children: title }), showSessionInfo && (showKnownFacts || showMessageConsumption) && ((0, jsx_runtime_1.jsxs)("ul", { className: "memori-mobile-session-panel--actions memori-mobile-session-panel--session-info", children: [isLoggedIn && showKnownFacts && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "toolbar", size: "sm", className: "memori-mobile-session-panel--action", disabled: knownFactsDisabled, onClick: () => {
|
|
256
|
-
if (knownFactsDisabled)
|
|
257
|
-
return;
|
|
258
|
-
onKnownFactsOpen === null || onKnownFactsOpen === void 0 ? void 0 : onKnownFactsOpen();
|
|
259
|
-
}, children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-icon", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Brain, { size: 18 }) }), (0, jsx_runtime_1.jsxs)("span", { className: "memori-mobile-session-panel--action-copy", children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-title", children: knownFactsPageTitle }), (0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-subtitle", children: resolvedKnownFactsHint })] })] }) })), showMessageConsumption && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "toolbar", size: "sm", className: "memori-mobile-session-panel--action", disabled: !hasChatConsumptionData, onClick: () => {
|
|
260
|
-
if (!hasChatConsumptionData)
|
|
261
|
-
return;
|
|
262
|
-
setActiveView('aiUsage');
|
|
263
|
-
}, children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-icon", children: (0, jsx_runtime_1.jsx)(GasStation_1.default, {}) }), (0, jsx_runtime_1.jsxs)("span", { className: "memori-mobile-session-panel--action-copy", children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-title", children: resolvedAiUsageTitle }), (0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-subtitle", children: aiUsageSubtitle })] }), (0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-trailing", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 }) })] }) }))] })), (0, jsx_runtime_1.jsx)("ul", { className: "memori-mobile-session-panel--actions", children: visibleActions.map(action => ((0, jsx_runtime_1.jsx)("li", { children: (() => {
|
|
264
|
-
const isKnownFactsAction = action.view === 'knownFacts';
|
|
265
|
-
const isShareAction = action.view === 'share';
|
|
266
|
-
const isActionDisabled = action.disabled || (isKnownFactsAction && !isLoggedIn);
|
|
267
|
-
return ((0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "toolbar", size: "sm", className: "memori-mobile-session-panel--action", disabled: isActionDisabled, onClick: () => {
|
|
268
|
-
var _a;
|
|
269
|
-
if (isActionDisabled)
|
|
270
|
-
return;
|
|
271
|
-
if (action.view === 'knownFacts') {
|
|
272
|
-
if (onKnownFactsOpen) {
|
|
273
|
-
onKnownFactsOpen();
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
if (action.view) {
|
|
278
|
-
setActiveView(action.view);
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
282
|
-
}, children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-icon", children: action.icon }), (0, jsx_runtime_1.jsxs)("span", { className: "memori-mobile-session-panel--action-copy", children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-title", children: action.title }), action.subtitle && ((0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-subtitle", children: action.subtitle }))] }), (isShareAction || action.view === 'location') && ((0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-trailing", children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { size: 16 }) }))] }));
|
|
283
|
-
})() }, action.key))) }), showProfileControls && ((0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "toolbar", size: "sm", shape: "default", className: "memori-mobile-session-panel--logout", onClick: onLogout, children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-icon", children: (0, jsx_runtime_1.jsx)(lucide_react_1.LogOut, { size: 18 }) }), (0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--logout-label", children: logoutLabel })] })), showAuthControls && !isLoggedIn && ((0, jsx_runtime_1.jsx)("div", { className: "memori-mobile-session-panel--login-cta-wrap", children: (0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "toolbar", size: "sm", className: "memori-mobile-session-panel--login-cta", onClick: onLogin, children: [(0, jsx_runtime_1.jsx)("span", { className: "memori-mobile-session-panel--action-icon", children: (0, jsx_runtime_1.jsx)(lucide_react_1.LogIn, { size: 18 }) }), loginLabel] }) }))] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "memori-mobile-session-panel--page", children: [(0, jsx_runtime_1.jsxs)(ui_1.Button, { variant: "toolbar", size: "sm", className: "memori-mobile-session-panel--back", onClick: () => setActiveView('session'), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, { size: 16 }), backLabel] }), (0, jsx_runtime_1.jsx)("h3", { className: "memori-mobile-session-panel--page-title", children: activeView === 'location'
|
|
284
|
-
? locationPageTitle
|
|
285
|
-
: activeView === 'share'
|
|
286
|
-
? sharePageTitle
|
|
287
|
-
: activeView === 'aiUsage'
|
|
288
|
-
? resolvedAiUsageTitle
|
|
289
|
-
: knownFactsPageTitle }), activeView === 'location' ? ((0, jsx_runtime_1.jsx)("div", { className: "memori-mobile-session-panel--page-content memori-mobile-session-panel--location-content", children: setVenue ? ((0, jsx_runtime_1.jsx)(PositionPopover_1.PositionPopoverContent, { venue: venue, setVenue: setVenue })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("p", { className: "memori-mobile-session-panel--meta-label", children: locationStatusLabel }), (0, jsx_runtime_1.jsx)("p", { className: "memori-mobile-session-panel--meta-value", children: locationPlace || locationUnknownLabel }), (0, jsx_runtime_1.jsxs)("div", { className: "memori-mobile-session-panel--page-actions", children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "toolbar", size: "sm", className: `memori-mobile-session-panel--page-btn ${isLocationEnabled
|
|
290
|
-
? 'memori-mobile-session-panel--page-btn-active'
|
|
291
|
-
: ''}`, onClick: onLocationEnable, children: (0, jsx_runtime_1.jsx)("span", { children: locationEnableLabel }) }), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "toolbar", size: "sm", className: "memori-mobile-session-panel--page-btn memori-mobile-session-panel--page-btn-secondary", onClick: onLocationDisable, children: locationDisableLabel })] })] })) })) : activeView === 'share' ? ((0, jsx_runtime_1.jsx)("div", { className: "memori-mobile-session-panel--page-content memori-mobile-session-panel--share-content", children: shareContent })) : activeView === 'aiUsage' ? ((0, jsx_runtime_1.jsx)("div", { className: "memori-mobile-session-panel--page-content memori-mobile-session-panel--ai-usage-content", children: (0, jsx_runtime_1.jsx)(ChatConsumptionDropdown_1.ChatConsumptionContent, { history: history, showTitle: false, className: "memori-mobile-session-panel--ai-usage" }) })) : ((0, jsx_runtime_1.jsxs)("div", { className: "memori-mobile-session-panel--page-content", children: [knownFactsDescription && ((0, jsx_runtime_1.jsx)("p", { className: "memori-mobile-session-panel--known-facts-description", children: knownFactsDescription })), knownFactsCountLabel && ((0, jsx_runtime_1.jsx)("p", { className: "memori-mobile-session-panel--known-facts-count", children: knownFactsCountLabel })), (0, jsx_runtime_1.jsx)(ui_1.Button, { variant: "toolbar", size: "sm", className: "memori-mobile-session-panel--page-btn", disabled: knownFactsDisabled, onClick: onKnownFactsOpen, children: knownFactsCtaLabel })] }))] }))] })] }));
|
|
292
|
-
};
|
|
293
|
-
exports.default = MobileSessionPanel;
|
|
294
|
-
//# sourceMappingURL=MobileSessionPanel.js.map
|