@helpai/elements 0.14.2 → 0.15.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/configurator.mjs +5 -5
- package/elements-web-component.esm.js +7 -7
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +7 -7
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +7 -7
- package/elements.esm.js.map +4 -4
- package/elements.js +7 -7
- package/elements.js.map +4 -4
- package/index.d.ts +6 -6
- package/index.mjs +227 -216
- package/package.json +1 -1
- package/schema.d.ts +51 -51
- package/schema.json +10 -10
- package/schema.mjs +5 -5
- package/web-component.mjs +226 -215
package/index.mjs
CHANGED
|
@@ -35,7 +35,8 @@ var STRINGS_EN = {
|
|
|
35
35
|
attachmentMimeRejected: "File type not supported",
|
|
36
36
|
attachmentTooLarge: "File is too large",
|
|
37
37
|
attachmentTooMany: "Attachment limit reached",
|
|
38
|
-
|
|
38
|
+
conversationClosed: "This conversation is closed",
|
|
39
|
+
conversationLoading: "Loading conversation\u2026",
|
|
39
40
|
close: "Close",
|
|
40
41
|
collapse: "Collapse",
|
|
41
42
|
collapseSidebar: "Collapse sidebar",
|
|
@@ -55,12 +56,10 @@ var STRINGS_EN = {
|
|
|
55
56
|
history: "History",
|
|
56
57
|
historyBack: "Back to chat",
|
|
57
58
|
historyEmpty: "No previous conversations yet",
|
|
58
|
-
historyLoading: "Loading your
|
|
59
|
-
|
|
60
|
-
historyTitle: "Chat history",
|
|
59
|
+
historyLoading: "Loading your conversations\u2026",
|
|
60
|
+
historyTitle: "Conversation history",
|
|
61
61
|
language: "Language",
|
|
62
62
|
launcherOpen: "Open chat",
|
|
63
|
-
messagesLoading: "Loading conversation\u2026",
|
|
64
63
|
micStart: "Start voice input",
|
|
65
64
|
micStop: "Stop voice input",
|
|
66
65
|
micUnsupported: "Voice input is not supported in this browser",
|
|
@@ -85,7 +84,7 @@ var STRINGS_EN = {
|
|
|
85
84
|
usedTool: "Used tool",
|
|
86
85
|
// ── Messenger modules ──────────────────────────────────────────
|
|
87
86
|
tabHome: "Home",
|
|
88
|
-
|
|
87
|
+
tabConversations: "Conversations",
|
|
89
88
|
tabHelp: "Help",
|
|
90
89
|
tabNews: "News",
|
|
91
90
|
modulesEmpty: "Nothing here yet",
|
|
@@ -140,7 +139,8 @@ var STRINGS_FR = {
|
|
|
140
139
|
attachmentMimeRejected: "Type de fichier non pris en charge",
|
|
141
140
|
attachmentTooLarge: "Le fichier est trop volumineux",
|
|
142
141
|
attachmentTooMany: "Limite de pi\xE8ces jointes atteinte",
|
|
143
|
-
|
|
142
|
+
conversationClosed: "Cette conversation est ferm\xE9e",
|
|
143
|
+
conversationLoading: "Chargement de la conversation\u2026",
|
|
144
144
|
close: "Fermer",
|
|
145
145
|
collapse: "R\xE9duire",
|
|
146
146
|
collapseSidebar: "R\xE9duire la barre lat\xE9rale",
|
|
@@ -161,11 +161,9 @@ var STRINGS_FR = {
|
|
|
161
161
|
historyBack: "Retour au chat",
|
|
162
162
|
historyEmpty: "Aucune conversation pour le moment",
|
|
163
163
|
historyLoading: "Chargement de vos conversations\u2026",
|
|
164
|
-
historyNewChat: "Nouvelle conversation",
|
|
165
164
|
historyTitle: "Historique des conversations",
|
|
166
165
|
language: "Langue",
|
|
167
166
|
launcherOpen: "Ouvrir le chat",
|
|
168
|
-
messagesLoading: "Chargement de la conversation\u2026",
|
|
169
167
|
micStart: "D\xE9marrer la saisie vocale",
|
|
170
168
|
micStop: "Arr\xEAter la saisie vocale",
|
|
171
169
|
micUnsupported: "La saisie vocale n'est pas prise en charge par ce navigateur",
|
|
@@ -190,7 +188,7 @@ var STRINGS_FR = {
|
|
|
190
188
|
usedTool: "Outil utilis\xE9",
|
|
191
189
|
// ── Messenger modules ──────────────────────────────────────────
|
|
192
190
|
tabHome: "Accueil",
|
|
193
|
-
|
|
191
|
+
tabConversations: "Conversations",
|
|
194
192
|
tabHelp: "Aide",
|
|
195
193
|
tabNews: "Actualit\xE9s",
|
|
196
194
|
modulesEmpty: "Rien pour le moment",
|
|
@@ -488,7 +486,7 @@ var DEFAULT_HAPTICS = {
|
|
|
488
486
|
enabled: true,
|
|
489
487
|
events: void 0
|
|
490
488
|
};
|
|
491
|
-
var DEFAULT_MODULES = [{ label: "
|
|
489
|
+
var DEFAULT_MODULES = [{ label: "tabConversations", layout: "chat" }];
|
|
492
490
|
var DEFAULT_HOME_MODULE = { showSearchBar: true };
|
|
493
491
|
|
|
494
492
|
// src/core/config/resolve.ts
|
|
@@ -620,7 +618,7 @@ function resolveModules(overrides) {
|
|
|
620
618
|
resolved.greetingText = m.greetingText;
|
|
621
619
|
resolved.showGreeting = m.showGreeting ?? true;
|
|
622
620
|
resolved.showSearchBar = m.showSearchBar ?? DEFAULT_HOME_MODULE.showSearchBar;
|
|
623
|
-
resolved.
|
|
621
|
+
resolved.showRecentConversations = m.showRecentConversations ?? true;
|
|
624
622
|
if (m.userAvatars && m.userAvatars.length > 0) resolved.userAvatars = m.userAvatars;
|
|
625
623
|
if (m.status) resolved.status = m.status;
|
|
626
624
|
resolved.contentBlockTitle = m.contentBlockTitle;
|
|
@@ -2754,8 +2752,8 @@ var TID = {
|
|
|
2754
2752
|
sidebar: `${p2}-sidebar`,
|
|
2755
2753
|
/** Sidebar collapse / expand toggle. */
|
|
2756
2754
|
sidebarToggle: `${p2}-sidebar-toggle`,
|
|
2757
|
-
/** Sidebar "New
|
|
2758
|
-
|
|
2755
|
+
/** Sidebar "New conversation" button. */
|
|
2756
|
+
sidebarNewConversation: `${p2}-sidebar-new-conversation`,
|
|
2759
2757
|
/** Sidebar history row — suffix `-{conversationId}` at the JSX site. */
|
|
2760
2758
|
sidebarItem: `${p2}-sidebar-item`,
|
|
2761
2759
|
// ── Messenger modules ───────────────────────────────────────────
|
|
@@ -2765,7 +2763,7 @@ var TID = {
|
|
|
2765
2763
|
modulesEmpty: `${p2}-modules-empty`,
|
|
2766
2764
|
/** Bottom-nav tab button — suffix `-{moduleId}` at the JSX site. */
|
|
2767
2765
|
tab: `${p2}-tab`,
|
|
2768
|
-
/** Unread badge on the
|
|
2766
|
+
/** Unread badge on the Conversations tab. */
|
|
2769
2767
|
tabBadge: `${p2}-tab-badge`,
|
|
2770
2768
|
/** Home module root. */
|
|
2771
2769
|
homeView: `${p2}-home-view`,
|
|
@@ -2780,7 +2778,7 @@ var TID = {
|
|
|
2780
2778
|
/** Home / Help search bar. */
|
|
2781
2779
|
homeSearch: `${p2}-home-search`,
|
|
2782
2780
|
helpSearch: `${p2}-help-search`,
|
|
2783
|
-
/** Home recent-
|
|
2781
|
+
/** Home recent-conversation card. */
|
|
2784
2782
|
homeRecent: `${p2}-home-recent`,
|
|
2785
2783
|
/** Home content-list row ("Popular articles") — suffix `-{id}`. */
|
|
2786
2784
|
homeContentRow: `${p2}-home-content-row`,
|
|
@@ -4797,7 +4795,7 @@ function MessageList({
|
|
|
4797
4795
|
"aria-relevant": "additions text",
|
|
4798
4796
|
"data-scrolling": scrolling ? "true" : void 0,
|
|
4799
4797
|
children: [
|
|
4800
|
-
loading && messages.value.length === 0 ? /* @__PURE__ */ jsx17("div", { class: `${p15}-list-loading`, role: "status", children: strings.
|
|
4798
|
+
loading && messages.value.length === 0 ? /* @__PURE__ */ jsx17("div", { class: `${p15}-list-loading`, role: "status", children: strings.conversationLoading }) : null,
|
|
4801
4799
|
rows
|
|
4802
4800
|
]
|
|
4803
4801
|
}
|
|
@@ -4878,7 +4876,13 @@ var BUCKET_TO_STRING = {
|
|
|
4878
4876
|
lastWeek: "dateLastWeek",
|
|
4879
4877
|
older: "dateOlder"
|
|
4880
4878
|
};
|
|
4881
|
-
function ConversationList({
|
|
4879
|
+
function ConversationList({
|
|
4880
|
+
transport,
|
|
4881
|
+
strings,
|
|
4882
|
+
visitorId,
|
|
4883
|
+
onSelect,
|
|
4884
|
+
onNewConversation
|
|
4885
|
+
}) {
|
|
4882
4886
|
const p33 = BRAND.cssPrefix;
|
|
4883
4887
|
const [state, setState] = useState7("loading");
|
|
4884
4888
|
const [conversations, setChats] = useState7([]);
|
|
@@ -4897,10 +4901,19 @@ function ConversationList({ transport, strings, visitorId, onSelect, onNewChat }
|
|
|
4897
4901
|
cancelled = true;
|
|
4898
4902
|
};
|
|
4899
4903
|
}, [transport, visitorId]);
|
|
4900
|
-
const newChatButton =
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
+
const newChatButton = onNewConversation ? /* @__PURE__ */ jsx18("div", { class: `${p33}-history-footer`, children: /* @__PURE__ */ jsxs15(
|
|
4905
|
+
"button",
|
|
4906
|
+
{
|
|
4907
|
+
type: "button",
|
|
4908
|
+
class: `${p33}-history-new`,
|
|
4909
|
+
onClick: onNewConversation,
|
|
4910
|
+
"data-testid": TID.sidebarNewConversation,
|
|
4911
|
+
children: [
|
|
4912
|
+
/* @__PURE__ */ jsx18(PlusIcon, {}),
|
|
4913
|
+
strings.newConversation
|
|
4914
|
+
]
|
|
4915
|
+
}
|
|
4916
|
+
) }) : null;
|
|
4904
4917
|
if (state === "loading") {
|
|
4905
4918
|
return /* @__PURE__ */ jsxs15(Fragment2, { children: [
|
|
4906
4919
|
/* @__PURE__ */ jsx18("div", { class: `${p33}-history-empty`, children: strings.historyLoading }),
|
|
@@ -4938,18 +4951,12 @@ function ConversationList({ transport, strings, visitorId, onSelect, onNewChat }
|
|
|
4938
4951
|
] });
|
|
4939
4952
|
}
|
|
4940
4953
|
|
|
4941
|
-
// src/ui/chat-history-pane.tsx
|
|
4942
|
-
import { jsx as jsx19 } from "preact/jsx-runtime";
|
|
4943
|
-
function ChatHistoryPane(props2) {
|
|
4944
|
-
return /* @__PURE__ */ jsx19(ConversationList, { ...props2 });
|
|
4945
|
-
}
|
|
4946
|
-
|
|
4947
4954
|
// src/ui/suggestions.tsx
|
|
4948
|
-
import { jsx as
|
|
4955
|
+
import { jsx as jsx19 } from "preact/jsx-runtime";
|
|
4949
4956
|
var p16 = BRAND.cssPrefix;
|
|
4950
4957
|
function Suggestions({ suggestions, onPick }) {
|
|
4951
4958
|
if (suggestions.length === 0) return null;
|
|
4952
|
-
return /* @__PURE__ */
|
|
4959
|
+
return /* @__PURE__ */ jsx19("div", { class: `${p16}-suggestions`, role: "group", "aria-label": "Suggested replies", children: suggestions.map((s, i) => /* @__PURE__ */ jsx19(
|
|
4953
4960
|
"button",
|
|
4954
4961
|
{
|
|
4955
4962
|
type: "button",
|
|
@@ -4963,7 +4970,7 @@ function Suggestions({ suggestions, onPick }) {
|
|
|
4963
4970
|
}
|
|
4964
4971
|
|
|
4965
4972
|
// src/ui/panel.tsx
|
|
4966
|
-
import { Fragment as Fragment3, jsx as
|
|
4973
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs16 } from "preact/jsx-runtime";
|
|
4967
4974
|
var p17 = BRAND.cssPrefix;
|
|
4968
4975
|
function Panel(props2) {
|
|
4969
4976
|
const { options, onClose } = props2;
|
|
@@ -4999,7 +5006,7 @@ function Panel(props2) {
|
|
|
4999
5006
|
style: { position: "relative" },
|
|
5000
5007
|
"data-testid": TID.panel,
|
|
5001
5008
|
children: [
|
|
5002
|
-
/* @__PURE__ */
|
|
5009
|
+
/* @__PURE__ */ jsx20(
|
|
5003
5010
|
PanelContent,
|
|
5004
5011
|
{
|
|
5005
5012
|
...props2,
|
|
@@ -5008,7 +5015,7 @@ function Panel(props2) {
|
|
|
5008
5015
|
composerAttachApiRef
|
|
5009
5016
|
}
|
|
5010
5017
|
),
|
|
5011
|
-
/* @__PURE__ */
|
|
5018
|
+
/* @__PURE__ */ jsx20(PoweredByBar, { poweredBy: props2.options.poweredBy })
|
|
5012
5019
|
]
|
|
5013
5020
|
}
|
|
5014
5021
|
);
|
|
@@ -5033,8 +5040,8 @@ function PanelContent(props2) {
|
|
|
5033
5040
|
onBack,
|
|
5034
5041
|
onClear,
|
|
5035
5042
|
onToggleHistory,
|
|
5036
|
-
|
|
5037
|
-
|
|
5043
|
+
onSelectHistoryConversation,
|
|
5044
|
+
onNewConversation,
|
|
5038
5045
|
onWidgetSizeChange,
|
|
5039
5046
|
onSend,
|
|
5040
5047
|
onStop,
|
|
@@ -5050,11 +5057,11 @@ function PanelContent(props2) {
|
|
|
5050
5057
|
const s = options.strings;
|
|
5051
5058
|
let composerArea;
|
|
5052
5059
|
if (activeForm) {
|
|
5053
|
-
composerArea = /* @__PURE__ */
|
|
5060
|
+
composerArea = /* @__PURE__ */ jsx20(FormGate, { form: activeForm, strings: s, onSubmit: onFormSubmit, onSkip: onFormSkip });
|
|
5054
5061
|
} else if (canSend) {
|
|
5055
5062
|
composerArea = /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
5056
|
-
/* @__PURE__ */
|
|
5057
|
-
/* @__PURE__ */
|
|
5063
|
+
/* @__PURE__ */ jsx20(Suggestions, { suggestions, onPick: onSuggestion }),
|
|
5064
|
+
/* @__PURE__ */ jsx20(
|
|
5058
5065
|
Composer,
|
|
5059
5066
|
{
|
|
5060
5067
|
options,
|
|
@@ -5069,10 +5076,10 @@ function PanelContent(props2) {
|
|
|
5069
5076
|
)
|
|
5070
5077
|
] });
|
|
5071
5078
|
} else {
|
|
5072
|
-
composerArea = /* @__PURE__ */
|
|
5079
|
+
composerArea = /* @__PURE__ */ jsx20(ReadOnlyBanner, { label: s.conversationClosed, ctaLabel: s.startNewConversation, onNewConversation: onClear });
|
|
5073
5080
|
}
|
|
5074
5081
|
return /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
5075
|
-
view === "history" ? /* @__PURE__ */
|
|
5082
|
+
view === "history" ? /* @__PURE__ */ jsx20(
|
|
5076
5083
|
HistoryHeader,
|
|
5077
5084
|
{
|
|
5078
5085
|
strings: s,
|
|
@@ -5081,7 +5088,7 @@ function PanelContent(props2) {
|
|
|
5081
5088
|
showClose: canShowClose(options.mode, panelSize, options.actions)
|
|
5082
5089
|
}
|
|
5083
5090
|
) : /* @__PURE__ */ jsxs16("header", { class: `${p17}-header`, "data-testid": TID.panelHeader, children: [
|
|
5084
|
-
onBack ? /* @__PURE__ */
|
|
5091
|
+
onBack ? /* @__PURE__ */ jsx20(
|
|
5085
5092
|
"button",
|
|
5086
5093
|
{
|
|
5087
5094
|
type: "button",
|
|
@@ -5089,24 +5096,24 @@ function PanelContent(props2) {
|
|
|
5089
5096
|
onClick: onBack,
|
|
5090
5097
|
"aria-label": s.moduleBack,
|
|
5091
5098
|
title: s.moduleBack,
|
|
5092
|
-
children: /* @__PURE__ */
|
|
5099
|
+
children: /* @__PURE__ */ jsx20(BackIcon, {})
|
|
5093
5100
|
}
|
|
5094
5101
|
) : null,
|
|
5095
|
-
agent ? /* @__PURE__ */
|
|
5096
|
-
/* @__PURE__ */
|
|
5102
|
+
agent ? /* @__PURE__ */ jsx20(AgentBadge, { agent }) : /* @__PURE__ */ jsx20("h1", { children: s.panelTitle }),
|
|
5103
|
+
/* @__PURE__ */ jsx20(HeaderActions, { panelProps: props2, variant: "chat" })
|
|
5097
5104
|
] }),
|
|
5098
|
-
view === "history" ? /* @__PURE__ */
|
|
5099
|
-
|
|
5105
|
+
view === "history" ? /* @__PURE__ */ jsx20(
|
|
5106
|
+
ConversationList,
|
|
5100
5107
|
{
|
|
5101
5108
|
transport,
|
|
5102
5109
|
strings: s,
|
|
5103
5110
|
visitorId,
|
|
5104
|
-
onSelect: (
|
|
5105
|
-
|
|
5111
|
+
onSelect: (conversation) => onSelectHistoryConversation(conversation.conversationId),
|
|
5112
|
+
onNewConversation
|
|
5106
5113
|
}
|
|
5107
5114
|
) : /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
5108
|
-
/* @__PURE__ */
|
|
5109
|
-
/* @__PURE__ */
|
|
5115
|
+
/* @__PURE__ */ jsx20(DropZone, { visible: dragOver, strings: s }),
|
|
5116
|
+
/* @__PURE__ */ jsx20(
|
|
5110
5117
|
MessageList,
|
|
5111
5118
|
{
|
|
5112
5119
|
messagesSig,
|
|
@@ -5120,9 +5127,9 @@ function PanelContent(props2) {
|
|
|
5120
5127
|
}
|
|
5121
5128
|
),
|
|
5122
5129
|
composerArea,
|
|
5123
|
-
/* @__PURE__ */
|
|
5130
|
+
/* @__PURE__ */ jsx20(ComposerFooter, { disclaimer: options.composerDisclaimer })
|
|
5124
5131
|
] }),
|
|
5125
|
-
options.size.resize?.enabled ? /* @__PURE__ */
|
|
5132
|
+
options.size.resize?.enabled ? /* @__PURE__ */ jsx20(
|
|
5126
5133
|
ResizeGrip,
|
|
5127
5134
|
{
|
|
5128
5135
|
panelEl: containerEl,
|
|
@@ -5142,7 +5149,7 @@ function HistoryHeader({
|
|
|
5142
5149
|
showClose
|
|
5143
5150
|
}) {
|
|
5144
5151
|
return /* @__PURE__ */ jsxs16("header", { class: `${p17}-header`, children: [
|
|
5145
|
-
/* @__PURE__ */
|
|
5152
|
+
/* @__PURE__ */ jsx20(
|
|
5146
5153
|
"button",
|
|
5147
5154
|
{
|
|
5148
5155
|
type: "button",
|
|
@@ -5150,11 +5157,11 @@ function HistoryHeader({
|
|
|
5150
5157
|
onClick: onBack,
|
|
5151
5158
|
"aria-label": strings.historyBack,
|
|
5152
5159
|
title: strings.historyBack,
|
|
5153
|
-
children: /* @__PURE__ */
|
|
5160
|
+
children: /* @__PURE__ */ jsx20(BackIcon, {})
|
|
5154
5161
|
}
|
|
5155
5162
|
),
|
|
5156
|
-
/* @__PURE__ */
|
|
5157
|
-
showClose ? /* @__PURE__ */
|
|
5163
|
+
/* @__PURE__ */ jsx20("h1", { children: strings.historyTitle }),
|
|
5164
|
+
showClose ? /* @__PURE__ */ jsx20(
|
|
5158
5165
|
"button",
|
|
5159
5166
|
{
|
|
5160
5167
|
type: "button",
|
|
@@ -5162,34 +5169,38 @@ function HistoryHeader({
|
|
|
5162
5169
|
onClick: onClose,
|
|
5163
5170
|
"aria-label": strings.close,
|
|
5164
5171
|
title: strings.close,
|
|
5165
|
-
children: /* @__PURE__ */
|
|
5172
|
+
children: /* @__PURE__ */ jsx20(CloseIcon, {})
|
|
5166
5173
|
}
|
|
5167
5174
|
) : null
|
|
5168
5175
|
] });
|
|
5169
5176
|
}
|
|
5170
|
-
function ReadOnlyBanner({
|
|
5177
|
+
function ReadOnlyBanner({
|
|
5178
|
+
label,
|
|
5179
|
+
ctaLabel,
|
|
5180
|
+
onNewConversation
|
|
5181
|
+
}) {
|
|
5171
5182
|
return /* @__PURE__ */ jsxs16("div", { class: `${p17}-readonly-banner`, role: "note", children: [
|
|
5172
|
-
/* @__PURE__ */
|
|
5173
|
-
/* @__PURE__ */
|
|
5183
|
+
/* @__PURE__ */ jsx20("span", { class: `${p17}-readonly-label`, children: label }),
|
|
5184
|
+
/* @__PURE__ */ jsx20("button", { type: "button", class: `${p17}-readonly-cta`, onClick: onNewConversation, children: ctaLabel })
|
|
5174
5185
|
] });
|
|
5175
5186
|
}
|
|
5176
5187
|
function ComposerFooter({ disclaimer }) {
|
|
5177
5188
|
if (!disclaimer) return null;
|
|
5178
|
-
return /* @__PURE__ */
|
|
5189
|
+
return /* @__PURE__ */ jsx20("div", { class: `${p17}-composer-footer`, children: /* @__PURE__ */ jsx20("div", { class: `${p17}-disclaimer`, children: disclaimer }) });
|
|
5179
5190
|
}
|
|
5180
5191
|
function PoweredByBar({ poweredBy }) {
|
|
5181
5192
|
if (!poweredBy) return null;
|
|
5182
|
-
return /* @__PURE__ */
|
|
5193
|
+
return /* @__PURE__ */ jsx20("div", { class: `${p17}-poweredby-bar`, children: /* @__PURE__ */ jsx20(PoweredBy, { logoUrl: poweredBy.logoUrl, text: poweredBy.text, href: poweredBy.href }) });
|
|
5183
5194
|
}
|
|
5184
5195
|
function PoweredBy({ logoUrl, text, href }) {
|
|
5185
5196
|
const inner = /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
5186
|
-
logoUrl ? /* @__PURE__ */
|
|
5187
|
-
text ? /* @__PURE__ */
|
|
5197
|
+
logoUrl ? /* @__PURE__ */ jsx20("img", { class: `${p17}-poweredby-logo`, src: logoUrl, alt: "", loading: "lazy" }) : null,
|
|
5198
|
+
text ? /* @__PURE__ */ jsx20("span", { children: text }) : null
|
|
5188
5199
|
] });
|
|
5189
5200
|
if (href) {
|
|
5190
|
-
return /* @__PURE__ */
|
|
5201
|
+
return /* @__PURE__ */ jsx20("a", { class: `${p17}-poweredby`, href, target: "_blank", rel: "noopener noreferrer", children: inner });
|
|
5191
5202
|
}
|
|
5192
|
-
return /* @__PURE__ */
|
|
5203
|
+
return /* @__PURE__ */ jsx20("span", { class: `${p17}-poweredby`, children: inner });
|
|
5193
5204
|
}
|
|
5194
5205
|
|
|
5195
5206
|
// src/ui/form/form-controller.ts
|
|
@@ -5265,7 +5276,7 @@ function whenPasses(form, d) {
|
|
|
5265
5276
|
}
|
|
5266
5277
|
|
|
5267
5278
|
// src/ui/sidebar.tsx
|
|
5268
|
-
import { Fragment as Fragment4, jsx as
|
|
5279
|
+
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs17 } from "preact/jsx-runtime";
|
|
5269
5280
|
function Sidebar(props2) {
|
|
5270
5281
|
const p33 = BRAND.cssPrefix;
|
|
5271
5282
|
const { site, blocks, strings, collapsed } = props2;
|
|
@@ -5274,8 +5285,8 @@ function Sidebar(props2) {
|
|
|
5274
5285
|
const toggleLabel = collapsed ? strings.expandSidebar : strings.collapseSidebar;
|
|
5275
5286
|
return /* @__PURE__ */ jsxs17("aside", { class: `${p33}-sidebar`, "data-collapsed": collapsed ? "true" : "false", "data-testid": TID.sidebar, children: [
|
|
5276
5287
|
/* @__PURE__ */ jsxs17("div", { class: `${p33}-sidebar-header`, children: [
|
|
5277
|
-
/* @__PURE__ */
|
|
5278
|
-
/* @__PURE__ */
|
|
5288
|
+
/* @__PURE__ */ jsx21(SidebarBrand, { site }),
|
|
5289
|
+
/* @__PURE__ */ jsx21(
|
|
5279
5290
|
"button",
|
|
5280
5291
|
{
|
|
5281
5292
|
type: "button",
|
|
@@ -5285,21 +5296,21 @@ function Sidebar(props2) {
|
|
|
5285
5296
|
title: toggleLabel,
|
|
5286
5297
|
onClick: props2.onToggleCollapsed,
|
|
5287
5298
|
"data-testid": TID.sidebarToggle,
|
|
5288
|
-
children: /* @__PURE__ */
|
|
5299
|
+
children: /* @__PURE__ */ jsx21(SidebarToggleIcon, { collapsed })
|
|
5289
5300
|
}
|
|
5290
5301
|
)
|
|
5291
5302
|
] }),
|
|
5292
5303
|
collapsed ? null : /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
5293
|
-
navigation.length > 0 ? /* @__PURE__ */
|
|
5294
|
-
linkCards.length > 0 ? /* @__PURE__ */
|
|
5295
|
-
props2.showConversations ? /* @__PURE__ */
|
|
5304
|
+
navigation.length > 0 ? /* @__PURE__ */ jsx21("nav", { class: `${p33}-sidebar-section`, "data-section": "navigation", children: /* @__PURE__ */ jsx21(SidebarNav, { items: navigation }) }) : null,
|
|
5305
|
+
linkCards.length > 0 ? /* @__PURE__ */ jsx21("div", { class: `${p33}-sidebar-section`, "data-section": "link-cards", children: /* @__PURE__ */ jsx21(SidebarCards, { items: linkCards }) }) : null,
|
|
5306
|
+
props2.showConversations ? /* @__PURE__ */ jsx21("div", { class: `${p33}-sidebar-conversations`, children: /* @__PURE__ */ jsx21(
|
|
5296
5307
|
ConversationList,
|
|
5297
5308
|
{
|
|
5298
5309
|
transport: props2.transport,
|
|
5299
5310
|
strings: props2.strings,
|
|
5300
5311
|
visitorId: props2.visitorId,
|
|
5301
|
-
onSelect: props2.
|
|
5302
|
-
|
|
5312
|
+
onSelect: props2.onSelectConversation,
|
|
5313
|
+
onNewConversation: props2.onNewConversation
|
|
5303
5314
|
}
|
|
5304
5315
|
) }) : null
|
|
5305
5316
|
] })
|
|
@@ -5310,14 +5321,14 @@ function SidebarBrand({ site }) {
|
|
|
5310
5321
|
if (site?.logo?.url) {
|
|
5311
5322
|
const alt = site.logo.alt ?? site.title ?? "Logo";
|
|
5312
5323
|
return /* @__PURE__ */ jsxs17("picture", { children: [
|
|
5313
|
-
site.logoDark?.url ? /* @__PURE__ */
|
|
5314
|
-
/* @__PURE__ */
|
|
5324
|
+
site.logoDark?.url ? /* @__PURE__ */ jsx21("source", { srcset: site.logoDark.url, media: "(prefers-color-scheme: dark)" }) : null,
|
|
5325
|
+
/* @__PURE__ */ jsx21("img", { class: `${p33}-sidebar-logo`, src: site.logo.url, alt })
|
|
5315
5326
|
] });
|
|
5316
5327
|
}
|
|
5317
|
-
return /* @__PURE__ */
|
|
5328
|
+
return /* @__PURE__ */ jsx21("div", { class: `${p33}-sidebar-title`, children: site?.title ?? BRAND.name });
|
|
5318
5329
|
}
|
|
5319
5330
|
function SidebarToggleIcon({ collapsed }) {
|
|
5320
|
-
return /* @__PURE__ */
|
|
5331
|
+
return /* @__PURE__ */ jsx21(
|
|
5321
5332
|
"svg",
|
|
5322
5333
|
{
|
|
5323
5334
|
width: "16",
|
|
@@ -5327,13 +5338,13 @@ function SidebarToggleIcon({ collapsed }) {
|
|
|
5327
5338
|
stroke: "currentColor",
|
|
5328
5339
|
"stroke-width": "2",
|
|
5329
5340
|
"aria-hidden": "true",
|
|
5330
|
-
children: collapsed ? /* @__PURE__ */
|
|
5341
|
+
children: collapsed ? /* @__PURE__ */ jsx21("polyline", { points: "9 6 15 12 9 18" }) : /* @__PURE__ */ jsx21("polyline", { points: "15 6 9 12 15 18" })
|
|
5331
5342
|
}
|
|
5332
5343
|
);
|
|
5333
5344
|
}
|
|
5334
5345
|
function SidebarNav({ items }) {
|
|
5335
5346
|
const p33 = BRAND.cssPrefix;
|
|
5336
|
-
return /* @__PURE__ */
|
|
5347
|
+
return /* @__PURE__ */ jsx21("ul", { class: `${p33}-sidebar-nav`, children: items.map((item) => /* @__PURE__ */ jsx21("li", { children: /* @__PURE__ */ jsxs17(
|
|
5337
5348
|
"a",
|
|
5338
5349
|
{
|
|
5339
5350
|
class: `${p33}-sidebar-nav-item`,
|
|
@@ -5341,15 +5352,15 @@ function SidebarNav({ items }) {
|
|
|
5341
5352
|
target: item.href ? "_blank" : void 0,
|
|
5342
5353
|
rel: item.href ? "noreferrer" : void 0,
|
|
5343
5354
|
children: [
|
|
5344
|
-
item.icon ? /* @__PURE__ */
|
|
5345
|
-
/* @__PURE__ */
|
|
5355
|
+
item.icon ? /* @__PURE__ */ jsx21("span", { class: `${p33}-sidebar-nav-icon`, "data-icon": item.icon }) : null,
|
|
5356
|
+
/* @__PURE__ */ jsx21("span", { class: `${p33}-sidebar-nav-label`, children: item.label })
|
|
5346
5357
|
]
|
|
5347
5358
|
}
|
|
5348
5359
|
) }, item.id ?? item.label)) });
|
|
5349
5360
|
}
|
|
5350
5361
|
function SidebarCards({ items }) {
|
|
5351
5362
|
const p33 = BRAND.cssPrefix;
|
|
5352
|
-
return /* @__PURE__ */
|
|
5363
|
+
return /* @__PURE__ */ jsx21("div", { class: `${p33}-sidebar-cards`, children: items.map((item) => /* @__PURE__ */ jsxs17(
|
|
5353
5364
|
"a",
|
|
5354
5365
|
{
|
|
5355
5366
|
class: `${p33}-sidebar-card`,
|
|
@@ -5357,8 +5368,8 @@ function SidebarCards({ items }) {
|
|
|
5357
5368
|
target: item.href ? "_blank" : void 0,
|
|
5358
5369
|
rel: item.href ? "noreferrer" : void 0,
|
|
5359
5370
|
children: [
|
|
5360
|
-
/* @__PURE__ */
|
|
5361
|
-
item.description ? /* @__PURE__ */
|
|
5371
|
+
/* @__PURE__ */ jsx21("div", { class: `${p33}-sidebar-card-label`, children: item.label }),
|
|
5372
|
+
item.description ? /* @__PURE__ */ jsx21("div", { class: `${p33}-sidebar-card-desc`, children: item.description }) : null
|
|
5362
5373
|
]
|
|
5363
5374
|
},
|
|
5364
5375
|
item.id ?? item.label
|
|
@@ -5366,11 +5377,11 @@ function SidebarCards({ items }) {
|
|
|
5366
5377
|
}
|
|
5367
5378
|
|
|
5368
5379
|
// src/ui/page-shell.tsx
|
|
5369
|
-
import { jsx as
|
|
5380
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "preact/jsx-runtime";
|
|
5370
5381
|
var p18 = BRAND.cssPrefix;
|
|
5371
5382
|
function PageShell(props2) {
|
|
5372
5383
|
return /* @__PURE__ */ jsxs18("main", { class: `${p18}-page-shell`, "data-sidebar-collapsed": props2.sidebarCollapsed ? "true" : "false", children: [
|
|
5373
|
-
/* @__PURE__ */
|
|
5384
|
+
/* @__PURE__ */ jsx22(
|
|
5374
5385
|
Sidebar,
|
|
5375
5386
|
{
|
|
5376
5387
|
site: props2.site,
|
|
@@ -5379,13 +5390,13 @@ function PageShell(props2) {
|
|
|
5379
5390
|
strings: props2.strings,
|
|
5380
5391
|
visitorId: props2.visitorId,
|
|
5381
5392
|
showConversations: props2.showConversations,
|
|
5382
|
-
|
|
5383
|
-
|
|
5393
|
+
onSelectConversation: props2.onSelectConversation,
|
|
5394
|
+
onNewConversation: props2.onNewConversation,
|
|
5384
5395
|
collapsed: props2.sidebarCollapsed,
|
|
5385
5396
|
onToggleCollapsed: props2.onToggleSidebarCollapsed
|
|
5386
5397
|
}
|
|
5387
5398
|
),
|
|
5388
|
-
/* @__PURE__ */
|
|
5399
|
+
/* @__PURE__ */ jsx22("section", { class: `${p18}-page-chat`, "aria-label": "Chat", children: props2.children })
|
|
5389
5400
|
] });
|
|
5390
5401
|
}
|
|
5391
5402
|
|
|
@@ -5425,7 +5436,7 @@ var atTabRoot = (s) => activeStack(s).length === 0;
|
|
|
5425
5436
|
import { useCallback as useCallback4, useEffect as useEffect15, useRef as useRef8 } from "preact/hooks";
|
|
5426
5437
|
import { useComputed as useComputed6 } from "@preact/signals";
|
|
5427
5438
|
|
|
5428
|
-
// src/ui/modules/
|
|
5439
|
+
// src/ui/modules/chat.tsx
|
|
5429
5440
|
var chatLayout = {
|
|
5430
5441
|
Icon: BubblesIcon
|
|
5431
5442
|
// No `Root`: MessengerHome renders the existing chat panel for this tab.
|
|
@@ -5435,35 +5446,35 @@ var chatLayout = {
|
|
|
5435
5446
|
import { useEffect as useEffect11, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
|
|
5436
5447
|
|
|
5437
5448
|
// src/ui/back-header.tsx
|
|
5438
|
-
import { jsx as
|
|
5449
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "preact/jsx-runtime";
|
|
5439
5450
|
var p19 = BRAND.cssPrefix;
|
|
5440
5451
|
function TitleBar({ title, actions }) {
|
|
5441
5452
|
return /* @__PURE__ */ jsxs19("header", { class: `${p19}-back-header`, "data-variant": "title", children: [
|
|
5442
|
-
/* @__PURE__ */
|
|
5443
|
-
/* @__PURE__ */
|
|
5444
|
-
actions ?? /* @__PURE__ */
|
|
5453
|
+
/* @__PURE__ */ jsx23("span", { class: `${p19}-back-spacer`, "aria-hidden": "true" }),
|
|
5454
|
+
/* @__PURE__ */ jsx23("h1", { class: `${p19}-back-title`, children: title }),
|
|
5455
|
+
actions ?? /* @__PURE__ */ jsx23("span", { class: `${p19}-back-spacer`, "aria-hidden": "true" })
|
|
5445
5456
|
] });
|
|
5446
5457
|
}
|
|
5447
5458
|
function BackHeader({ title, backLabel, onBack, actions, testid }) {
|
|
5448
5459
|
return /* @__PURE__ */ jsxs19("header", { class: `${p19}-back-header`, "data-testid": testid, children: [
|
|
5449
|
-
/* @__PURE__ */
|
|
5450
|
-
/* @__PURE__ */
|
|
5451
|
-
actions ?? /* @__PURE__ */
|
|
5460
|
+
/* @__PURE__ */ jsx23("button", { type: "button", class: `${p19}-icon-btn`, onClick: onBack, "aria-label": backLabel, title: backLabel, children: /* @__PURE__ */ jsx23(BackIcon, {}) }),
|
|
5461
|
+
/* @__PURE__ */ jsx23("h1", { class: `${p19}-back-title`, children: title }),
|
|
5462
|
+
actions ?? /* @__PURE__ */ jsx23("span", { class: `${p19}-back-spacer`, "aria-hidden": "true" })
|
|
5452
5463
|
] });
|
|
5453
5464
|
}
|
|
5454
5465
|
|
|
5455
5466
|
// src/ui/home-search.tsx
|
|
5456
|
-
import { jsx as
|
|
5467
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "preact/jsx-runtime";
|
|
5457
5468
|
var p20 = BRAND.cssPrefix;
|
|
5458
5469
|
function HomeSearchButton({ placeholder, onActivate }) {
|
|
5459
5470
|
return /* @__PURE__ */ jsxs20("button", { type: "button", class: `${p20}-home-search`, onClick: onActivate, "data-testid": TID.homeSearch, children: [
|
|
5460
|
-
/* @__PURE__ */
|
|
5461
|
-
/* @__PURE__ */
|
|
5471
|
+
/* @__PURE__ */ jsx24("span", { class: `${p20}-home-search-text`, children: placeholder }),
|
|
5472
|
+
/* @__PURE__ */ jsx24("span", { class: `${p20}-home-search-icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx24(SearchIcon, {}) })
|
|
5462
5473
|
] });
|
|
5463
5474
|
}
|
|
5464
5475
|
function HelpSearchInput({ placeholder, value, onInput }) {
|
|
5465
5476
|
return /* @__PURE__ */ jsxs20("div", { class: `${p20}-home-search`, "data-input": "true", children: [
|
|
5466
|
-
/* @__PURE__ */
|
|
5477
|
+
/* @__PURE__ */ jsx24(
|
|
5467
5478
|
"input",
|
|
5468
5479
|
{
|
|
5469
5480
|
type: "search",
|
|
@@ -5474,25 +5485,25 @@ function HelpSearchInput({ placeholder, value, onInput }) {
|
|
|
5474
5485
|
"data-testid": TID.helpSearch
|
|
5475
5486
|
}
|
|
5476
5487
|
),
|
|
5477
|
-
/* @__PURE__ */
|
|
5488
|
+
/* @__PURE__ */ jsx24("span", { class: `${p20}-home-search-icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx24(SearchIcon, {}) })
|
|
5478
5489
|
] });
|
|
5479
5490
|
}
|
|
5480
5491
|
|
|
5481
5492
|
// src/ui/list-row.tsx
|
|
5482
|
-
import { jsx as
|
|
5493
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "preact/jsx-runtime";
|
|
5483
5494
|
var p21 = BRAND.cssPrefix;
|
|
5484
5495
|
function ListRow({ title, subtitle, onClick, testid }) {
|
|
5485
5496
|
return /* @__PURE__ */ jsxs21("button", { type: "button", class: `${p21}-list-row`, onClick, "data-testid": testid, children: [
|
|
5486
5497
|
/* @__PURE__ */ jsxs21("span", { class: `${p21}-list-row-body`, children: [
|
|
5487
|
-
/* @__PURE__ */
|
|
5488
|
-
subtitle ? /* @__PURE__ */
|
|
5498
|
+
/* @__PURE__ */ jsx25("span", { class: `${p21}-list-row-title`, children: title }),
|
|
5499
|
+
subtitle ? /* @__PURE__ */ jsx25("span", { class: `${p21}-list-row-sub`, children: subtitle }) : null
|
|
5489
5500
|
] }),
|
|
5490
|
-
/* @__PURE__ */
|
|
5501
|
+
/* @__PURE__ */ jsx25("span", { class: `${p21}-list-row-chevron`, "aria-hidden": "true", children: /* @__PURE__ */ jsx25(ChevronRightIcon, {}) })
|
|
5491
5502
|
] });
|
|
5492
5503
|
}
|
|
5493
5504
|
|
|
5494
5505
|
// src/ui/module-state.tsx
|
|
5495
|
-
import { jsx as
|
|
5506
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "preact/jsx-runtime";
|
|
5496
5507
|
var p22 = BRAND.cssPrefix;
|
|
5497
5508
|
function ModuleState({
|
|
5498
5509
|
tone = "info",
|
|
@@ -5501,13 +5512,13 @@ function ModuleState({
|
|
|
5501
5512
|
strings
|
|
5502
5513
|
}) {
|
|
5503
5514
|
return /* @__PURE__ */ jsxs22("div", { class: `${p22}-module-empty`, role: tone === "error" ? "alert" : "status", "aria-live": "polite", children: [
|
|
5504
|
-
/* @__PURE__ */
|
|
5505
|
-
onRetry ? /* @__PURE__ */
|
|
5515
|
+
/* @__PURE__ */ jsx26("span", { children: message }),
|
|
5516
|
+
onRetry ? /* @__PURE__ */ jsx26("button", { type: "button", class: `${p22}-module-retry`, onClick: onRetry, children: strings.errorRetry }) : null
|
|
5506
5517
|
] });
|
|
5507
5518
|
}
|
|
5508
5519
|
|
|
5509
5520
|
// src/ui/modules/help.tsx
|
|
5510
|
-
import { jsx as
|
|
5521
|
+
import { jsx as jsx27, jsxs as jsxs23 } from "preact/jsx-runtime";
|
|
5511
5522
|
var p23 = BRAND.cssPrefix;
|
|
5512
5523
|
var log12 = logger.scope("help");
|
|
5513
5524
|
var openArticle = (nav, a) => a.url ? nav.push({ kind: "iframe", url: a.url, title: a.title }) : nav.push({ kind: "content", id: a.id, title: a.title });
|
|
@@ -5537,7 +5548,7 @@ function fuzzySearch(items, query) {
|
|
|
5537
5548
|
return items.map((item) => ({ item, score: Math.max(fuzzyScore(q, item.title) * 2, fuzzyScore(q, item.description ?? "")) })).filter((r) => r.score > 0).toSorted((a, b) => b.score - a.score).map((r) => r.item);
|
|
5538
5549
|
}
|
|
5539
5550
|
function ArticleRow({ article, nav }) {
|
|
5540
|
-
return /* @__PURE__ */
|
|
5551
|
+
return /* @__PURE__ */ jsx27(
|
|
5541
5552
|
ListRow,
|
|
5542
5553
|
{
|
|
5543
5554
|
title: article.title,
|
|
@@ -5574,45 +5585,45 @@ function HelpRoot({ transport, strings, config, nav, panelProps }) {
|
|
|
5574
5585
|
const results = useMemo2(() => fuzzySearch(items, query), [items, query]);
|
|
5575
5586
|
function renderBody() {
|
|
5576
5587
|
if (query.trim().length > 0) {
|
|
5577
|
-
if (results.length === 0) return /* @__PURE__ */
|
|
5578
|
-
return /* @__PURE__ */
|
|
5588
|
+
if (results.length === 0) return /* @__PURE__ */ jsx27(ModuleState, { message: strings.helpSearchEmpty, strings });
|
|
5589
|
+
return /* @__PURE__ */ jsx27("div", { class: `${p23}-help-card`, children: results.map((a) => /* @__PURE__ */ jsx27(ArticleRow, { article: a, nav }, a.id)) });
|
|
5579
5590
|
}
|
|
5580
|
-
if (state === "loading") return /* @__PURE__ */
|
|
5591
|
+
if (state === "loading") return /* @__PURE__ */ jsx27(ModuleState, { message: strings.helpLoading, strings });
|
|
5581
5592
|
if (state === "error") {
|
|
5582
|
-
return /* @__PURE__ */
|
|
5593
|
+
return /* @__PURE__ */ jsx27(ModuleState, { tone: "error", message: errorMsg, onRetry: () => setReloadKey((k) => k + 1), strings });
|
|
5583
5594
|
}
|
|
5584
|
-
if (items.length === 0) return /* @__PURE__ */
|
|
5595
|
+
if (items.length === 0) return /* @__PURE__ */ jsx27(ModuleState, { message: strings.helpEmpty, strings });
|
|
5585
5596
|
return groupByCategory(items).map(([category, rows]) => /* @__PURE__ */ jsxs23("section", { class: `${p23}-help-group`, children: [
|
|
5586
|
-
category ? /* @__PURE__ */
|
|
5587
|
-
/* @__PURE__ */
|
|
5597
|
+
category ? /* @__PURE__ */ jsx27("h2", { class: `${p23}-help-section-title`, children: category }) : null,
|
|
5598
|
+
/* @__PURE__ */ jsx27("div", { class: `${p23}-help-card`, children: rows.map((a) => /* @__PURE__ */ jsx27(ArticleRow, { article: a, nav }, a.id)) })
|
|
5588
5599
|
] }, category));
|
|
5589
5600
|
}
|
|
5590
5601
|
return /* @__PURE__ */ jsxs23("div", { class: `${p23}-module`, children: [
|
|
5591
|
-
/* @__PURE__ */
|
|
5592
|
-
/* @__PURE__ */
|
|
5593
|
-
/* @__PURE__ */
|
|
5602
|
+
/* @__PURE__ */ jsx27(TitleBar, { title: strings.helpTitle, actions: /* @__PURE__ */ jsx27(HeaderActions, { panelProps, variant: "plain" }) }),
|
|
5603
|
+
/* @__PURE__ */ jsx27("div", { class: `${p23}-module-pad`, children: /* @__PURE__ */ jsx27(HelpSearchInput, { placeholder: strings.helpSearchPlaceholder, value: query, onInput: setQuery }) }),
|
|
5604
|
+
/* @__PURE__ */ jsx27("div", { class: `${p23}-help-list`, children: renderBody() })
|
|
5594
5605
|
] });
|
|
5595
5606
|
}
|
|
5596
5607
|
var helpLayout = {
|
|
5597
5608
|
Icon: HelpIcon,
|
|
5598
|
-
Root: (props2) => /* @__PURE__ */
|
|
5609
|
+
Root: (props2) => /* @__PURE__ */ jsx27(HelpRoot, { ...props2 })
|
|
5599
5610
|
};
|
|
5600
5611
|
|
|
5601
5612
|
// src/ui/modules/home.tsx
|
|
5602
5613
|
import { useEffect as useEffect12, useState as useState9 } from "preact/hooks";
|
|
5603
5614
|
|
|
5604
5615
|
// src/ui/home-card.tsx
|
|
5605
|
-
import { jsx as
|
|
5616
|
+
import { jsx as jsx28 } from "preact/jsx-runtime";
|
|
5606
5617
|
var p24 = BRAND.cssPrefix;
|
|
5607
5618
|
function HomeCard({ onClick, children, testid }) {
|
|
5608
5619
|
if (onClick) {
|
|
5609
|
-
return /* @__PURE__ */
|
|
5620
|
+
return /* @__PURE__ */ jsx28("button", { type: "button", class: `${p24}-home-card`, "data-interactive": "true", onClick, "data-testid": testid, children });
|
|
5610
5621
|
}
|
|
5611
|
-
return /* @__PURE__ */
|
|
5622
|
+
return /* @__PURE__ */ jsx28("div", { class: `${p24}-home-card`, "data-testid": testid, children });
|
|
5612
5623
|
}
|
|
5613
5624
|
|
|
5614
5625
|
// src/ui/modules/home.tsx
|
|
5615
|
-
import { Fragment as Fragment5, jsx as
|
|
5626
|
+
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs24 } from "preact/jsx-runtime";
|
|
5616
5627
|
var p25 = BRAND.cssPrefix;
|
|
5617
5628
|
var log13 = logger.scope("home");
|
|
5618
5629
|
function resolveGreeting(props2) {
|
|
@@ -5631,13 +5642,13 @@ function HomeRoot(props2) {
|
|
|
5631
5642
|
const [content, setContent] = useState9([]);
|
|
5632
5643
|
const tagsKey = config.contentTags?.join(",");
|
|
5633
5644
|
useEffect12(() => {
|
|
5634
|
-
if (!config.
|
|
5645
|
+
if (!config.showRecentConversations) return;
|
|
5635
5646
|
let cancelled = false;
|
|
5636
5647
|
transport.listConversations({ limit: 1 }).then((res) => !cancelled && setRecent(res.conversations?.[0] ?? null)).catch((err) => !cancelled && log13.warn("listConversations (home) failed", { err }));
|
|
5637
5648
|
return () => {
|
|
5638
5649
|
cancelled = true;
|
|
5639
5650
|
};
|
|
5640
|
-
}, [transport, config.
|
|
5651
|
+
}, [transport, config.showRecentConversations]);
|
|
5641
5652
|
useEffect12(() => {
|
|
5642
5653
|
if (!config.contentTags?.length) return;
|
|
5643
5654
|
let cancelled = false;
|
|
@@ -5650,49 +5661,49 @@ function HomeRoot(props2) {
|
|
|
5650
5661
|
const avatars = config.userAvatars ?? [];
|
|
5651
5662
|
const status = config.status;
|
|
5652
5663
|
const contentTitle = config.contentBlockTitle ? moduleLabel(strings, config.contentBlockTitle) : strings.homeContentTitle;
|
|
5653
|
-
return /* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsx29("div", { class: `${p25}-module ${p25}-home`, "data-testid": TID.homeView, children: /* @__PURE__ */ jsxs24("div", { class: `${p25}-home-scroll`, children: [
|
|
5654
5665
|
/* @__PURE__ */ jsxs24("div", { class: `${p25}-home-hero`, children: [
|
|
5655
5666
|
/* @__PURE__ */ jsxs24("div", { class: `${p25}-home-hero-top`, children: [
|
|
5656
|
-
config.brandName ? /* @__PURE__ */
|
|
5667
|
+
config.brandName ? /* @__PURE__ */ jsx29("span", { class: `${p25}-home-brand`, "data-testid": TID.homeBrand, children: config.brandName }) : /* @__PURE__ */ jsx29("span", { class: `${p25}-home-brand-spacer`, "aria-hidden": "true" }),
|
|
5657
5668
|
/* @__PURE__ */ jsxs24("div", { class: `${p25}-home-hero-actions`, children: [
|
|
5658
|
-
avatars.length > 0 ? /* @__PURE__ */
|
|
5659
|
-
/* @__PURE__ */
|
|
5669
|
+
avatars.length > 0 ? /* @__PURE__ */ jsx29("div", { class: `${p25}-home-avatars`, children: avatars.map((a) => /* @__PURE__ */ jsx29("span", { class: `${p25}-home-avatar`, title: a.role ? `${a.name} \xB7 ${a.role}` : a.name, children: a.avatar ? /* @__PURE__ */ jsx29("img", { src: a.avatar, alt: "", loading: "lazy" }) : /* @__PURE__ */ jsx29("span", { children: initials(a.name) }) }, a.name)) }) : null,
|
|
5670
|
+
/* @__PURE__ */ jsx29(HeaderActions, { panelProps, variant: "plain" })
|
|
5660
5671
|
] })
|
|
5661
5672
|
] }),
|
|
5662
5673
|
config.showGreeting !== false ? /* @__PURE__ */ jsxs24(Fragment5, { children: [
|
|
5663
|
-
/* @__PURE__ */
|
|
5664
|
-
greeting.subtitle ? /* @__PURE__ */
|
|
5674
|
+
/* @__PURE__ */ jsx29("h1", { class: `${p25}-home-greeting`, "data-testid": TID.homeGreeting, children: greeting.title }),
|
|
5675
|
+
greeting.subtitle ? /* @__PURE__ */ jsx29("p", { class: `${p25}-home-lead`, children: greeting.subtitle }) : null
|
|
5665
5676
|
] }) : null
|
|
5666
5677
|
] }),
|
|
5667
5678
|
/* @__PURE__ */ jsxs24("div", { class: `${p25}-home-cards`, children: [
|
|
5668
|
-
config.showSearchBar !== false ? /* @__PURE__ */
|
|
5679
|
+
config.showSearchBar !== false ? /* @__PURE__ */ jsx29(
|
|
5669
5680
|
HomeSearchButton,
|
|
5670
5681
|
{
|
|
5671
5682
|
placeholder: strings.homeSearchPlaceholder,
|
|
5672
5683
|
onActivate: () => nav.switchToLayout("help")
|
|
5673
5684
|
}
|
|
5674
5685
|
) : null,
|
|
5675
|
-
recent ? /* @__PURE__ */
|
|
5676
|
-
/* @__PURE__ */
|
|
5686
|
+
recent ? /* @__PURE__ */ jsx29(HomeCard, { onClick: () => nav.selectConversation(recent.conversationId), testid: TID.homeRecent, children: /* @__PURE__ */ jsxs24("div", { class: `${p25}-home-recent-row`, "data-unread": (recent.unreadCount ?? 0) > 0 ? "true" : void 0, children: [
|
|
5687
|
+
/* @__PURE__ */ jsx29("span", { class: `${p25}-home-recent-avatar`, "aria-hidden": "true", children: /* @__PURE__ */ jsx29(BubblesIcon, {}) }),
|
|
5677
5688
|
/* @__PURE__ */ jsxs24("span", { class: `${p25}-home-recent-body`, children: [
|
|
5678
|
-
/* @__PURE__ */
|
|
5679
|
-
recent.preview ? /* @__PURE__ */
|
|
5689
|
+
/* @__PURE__ */ jsx29("span", { class: `${p25}-home-recent-title`, children: recent.title }),
|
|
5690
|
+
recent.preview ? /* @__PURE__ */ jsx29("span", { class: `${p25}-home-recent-preview`, children: recent.preview }) : null
|
|
5680
5691
|
] }),
|
|
5681
|
-
(recent.unreadCount ?? 0) > 0 ? /* @__PURE__ */
|
|
5692
|
+
(recent.unreadCount ?? 0) > 0 ? /* @__PURE__ */ jsx29("span", { class: `${p25}-home-recent-dot`, "aria-label": "Unread" }) : null
|
|
5682
5693
|
] }) }) : null,
|
|
5683
|
-
status ? /* @__PURE__ */
|
|
5694
|
+
status ? /* @__PURE__ */ jsx29(
|
|
5684
5695
|
HomeCard,
|
|
5685
5696
|
{
|
|
5686
5697
|
onClick: status.url ? () => nav.push({ kind: "iframe", url: status.url, title: status.text }) : void 0,
|
|
5687
5698
|
children: /* @__PURE__ */ jsxs24("div", { class: `${p25}-home-status`, "data-level": status.level ?? "operational", children: [
|
|
5688
|
-
/* @__PURE__ */
|
|
5689
|
-
/* @__PURE__ */
|
|
5699
|
+
/* @__PURE__ */ jsx29("span", { class: `${p25}-home-status-icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx29(StatusOkIcon, {}) }),
|
|
5700
|
+
/* @__PURE__ */ jsx29("span", { class: `${p25}-home-status-text`, children: status.text })
|
|
5690
5701
|
] })
|
|
5691
5702
|
}
|
|
5692
5703
|
) : null,
|
|
5693
5704
|
content.length > 0 ? /* @__PURE__ */ jsxs24("section", { class: `${p25}-home-content`, children: [
|
|
5694
|
-
/* @__PURE__ */
|
|
5695
|
-
/* @__PURE__ */
|
|
5705
|
+
/* @__PURE__ */ jsx29("div", { class: `${p25}-home-content-title`, children: contentTitle }),
|
|
5706
|
+
/* @__PURE__ */ jsx29("div", { class: `${p25}-home-content-list`, children: content.map((item) => /* @__PURE__ */ jsx29(
|
|
5696
5707
|
ListRow,
|
|
5697
5708
|
{
|
|
5698
5709
|
title: item.title,
|
|
@@ -5708,12 +5719,12 @@ function HomeRoot(props2) {
|
|
|
5708
5719
|
}
|
|
5709
5720
|
var homeLayout = {
|
|
5710
5721
|
Icon: HomeIcon,
|
|
5711
|
-
Root: (props2) => /* @__PURE__ */
|
|
5722
|
+
Root: (props2) => /* @__PURE__ */ jsx29(HomeRoot, { ...props2 })
|
|
5712
5723
|
};
|
|
5713
5724
|
|
|
5714
5725
|
// src/ui/modules/news.tsx
|
|
5715
5726
|
import { useEffect as useEffect13, useState as useState10 } from "preact/hooks";
|
|
5716
|
-
import { jsx as
|
|
5727
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "preact/jsx-runtime";
|
|
5717
5728
|
var p26 = BRAND.cssPrefix;
|
|
5718
5729
|
var log14 = logger.scope("news");
|
|
5719
5730
|
function NewsRoot({ transport, strings, config, nav, panelProps }) {
|
|
@@ -5740,12 +5751,12 @@ function NewsRoot({ transport, strings, config, nav, panelProps }) {
|
|
|
5740
5751
|
};
|
|
5741
5752
|
}, [transport, tags, reloadKey]);
|
|
5742
5753
|
function renderBody() {
|
|
5743
|
-
if (state === "loading") return /* @__PURE__ */
|
|
5754
|
+
if (state === "loading") return /* @__PURE__ */ jsx30(ModuleState, { message: strings.newsLoading, strings });
|
|
5744
5755
|
if (state === "error") {
|
|
5745
|
-
return /* @__PURE__ */
|
|
5756
|
+
return /* @__PURE__ */ jsx30(ModuleState, { tone: "error", message: errorMsg, onRetry: () => setReloadKey((k) => k + 1), strings });
|
|
5746
5757
|
}
|
|
5747
|
-
if (items.length === 0) return /* @__PURE__ */
|
|
5748
|
-
return /* @__PURE__ */
|
|
5758
|
+
if (items.length === 0) return /* @__PURE__ */ jsx30(ModuleState, { message: strings.newsEmpty, strings });
|
|
5759
|
+
return /* @__PURE__ */ jsx30("div", { class: `${p26}-news-list`, children: items.map((item) => /* @__PURE__ */ jsxs25(
|
|
5749
5760
|
"button",
|
|
5750
5761
|
{
|
|
5751
5762
|
type: "button",
|
|
@@ -5753,11 +5764,11 @@ function NewsRoot({ transport, strings, config, nav, panelProps }) {
|
|
|
5753
5764
|
onClick: () => nav.push({ kind: "content", id: item.id, title: item.title }),
|
|
5754
5765
|
"data-testid": tid(TID.newsItem, item.id),
|
|
5755
5766
|
children: [
|
|
5756
|
-
item.image ? /* @__PURE__ */
|
|
5767
|
+
item.image ? /* @__PURE__ */ jsx30("img", { class: `${p26}-news-hero`, src: item.image, alt: "", loading: "lazy" }) : null,
|
|
5757
5768
|
/* @__PURE__ */ jsxs25("span", { class: `${p26}-news-body`, children: [
|
|
5758
|
-
item.tags && item.tags.length > 0 ? /* @__PURE__ */
|
|
5759
|
-
/* @__PURE__ */
|
|
5760
|
-
item.description ? /* @__PURE__ */
|
|
5769
|
+
item.tags && item.tags.length > 0 ? /* @__PURE__ */ jsx30("span", { class: `${p26}-news-tags`, children: item.tags.map((t) => /* @__PURE__ */ jsx30("span", { class: `${p26}-news-tag`, children: t }, t)) }) : null,
|
|
5770
|
+
/* @__PURE__ */ jsx30("span", { class: `${p26}-news-title`, children: item.title }),
|
|
5771
|
+
item.description ? /* @__PURE__ */ jsx30("span", { class: `${p26}-news-summary`, children: item.description }) : null
|
|
5761
5772
|
] })
|
|
5762
5773
|
]
|
|
5763
5774
|
},
|
|
@@ -5765,13 +5776,13 @@ function NewsRoot({ transport, strings, config, nav, panelProps }) {
|
|
|
5765
5776
|
)) });
|
|
5766
5777
|
}
|
|
5767
5778
|
return /* @__PURE__ */ jsxs25("div", { class: `${p26}-module`, children: [
|
|
5768
|
-
/* @__PURE__ */
|
|
5769
|
-
/* @__PURE__ */
|
|
5779
|
+
/* @__PURE__ */ jsx30(TitleBar, { title: strings.newsTitle, actions: /* @__PURE__ */ jsx30(HeaderActions, { panelProps, variant: "plain" }) }),
|
|
5780
|
+
/* @__PURE__ */ jsx30("div", { class: `${p26}-module-scroll`, children: renderBody() })
|
|
5770
5781
|
] });
|
|
5771
5782
|
}
|
|
5772
5783
|
var newsLayout = {
|
|
5773
5784
|
Icon: NewsIcon,
|
|
5774
|
-
Root: (props2) => /* @__PURE__ */
|
|
5785
|
+
Root: (props2) => /* @__PURE__ */ jsx30(NewsRoot, { ...props2 })
|
|
5775
5786
|
};
|
|
5776
5787
|
|
|
5777
5788
|
// src/ui/modules/registry.ts
|
|
@@ -5783,10 +5794,10 @@ var LAYOUTS = {
|
|
|
5783
5794
|
};
|
|
5784
5795
|
|
|
5785
5796
|
// src/ui/home-tab-bar.tsx
|
|
5786
|
-
import { jsx as
|
|
5797
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "preact/jsx-runtime";
|
|
5787
5798
|
var p27 = BRAND.cssPrefix;
|
|
5788
5799
|
function HomeTabBar({ modules, activeTab, strings, unreadCount, onSelect }) {
|
|
5789
|
-
return /* @__PURE__ */
|
|
5800
|
+
return /* @__PURE__ */ jsx31("nav", { class: `${p27}-tabbar`, role: "tablist", "aria-label": strings.panelTitle, children: modules.map((m) => {
|
|
5790
5801
|
const Icon = LAYOUTS[m.layout].Icon;
|
|
5791
5802
|
const selected = m.id === activeTab;
|
|
5792
5803
|
const badge = m.layout === "chat" && unreadCount > 0 ? unreadCount > 9 ? "9+" : String(unreadCount) : null;
|
|
@@ -5801,10 +5812,10 @@ function HomeTabBar({ modules, activeTab, strings, unreadCount, onSelect }) {
|
|
|
5801
5812
|
"data-testid": tid(TID.tab, m.id),
|
|
5802
5813
|
children: [
|
|
5803
5814
|
/* @__PURE__ */ jsxs26("span", { class: `${p27}-tab-icon`, "aria-hidden": "true", children: [
|
|
5804
|
-
/* @__PURE__ */
|
|
5805
|
-
badge ? /* @__PURE__ */
|
|
5815
|
+
/* @__PURE__ */ jsx31(Icon, {}),
|
|
5816
|
+
badge ? /* @__PURE__ */ jsx31("span", { class: `${p27}-tab-badge`, "data-testid": TID.tabBadge, children: badge }) : null
|
|
5806
5817
|
] }),
|
|
5807
|
-
/* @__PURE__ */
|
|
5818
|
+
/* @__PURE__ */ jsx31("span", { class: `${p27}-tab-label`, children: moduleLabel(strings, m.label) })
|
|
5808
5819
|
]
|
|
5809
5820
|
},
|
|
5810
5821
|
m.id
|
|
@@ -5813,12 +5824,12 @@ function HomeTabBar({ modules, activeTab, strings, unreadCount, onSelect }) {
|
|
|
5813
5824
|
}
|
|
5814
5825
|
|
|
5815
5826
|
// src/ui/iframe-view.tsx
|
|
5816
|
-
import { jsx as
|
|
5827
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "preact/jsx-runtime";
|
|
5817
5828
|
var p28 = BRAND.cssPrefix;
|
|
5818
5829
|
var SANDBOX = "allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";
|
|
5819
5830
|
function IframeView({ url, title, strings, onBack, actions }) {
|
|
5820
5831
|
return /* @__PURE__ */ jsxs27("div", { class: `${p28}-module`, children: [
|
|
5821
|
-
/* @__PURE__ */
|
|
5832
|
+
/* @__PURE__ */ jsx32(
|
|
5822
5833
|
BackHeader,
|
|
5823
5834
|
{
|
|
5824
5835
|
title: title || strings.moduleBack,
|
|
@@ -5827,7 +5838,7 @@ function IframeView({ url, title, strings, onBack, actions }) {
|
|
|
5827
5838
|
actions
|
|
5828
5839
|
}
|
|
5829
5840
|
),
|
|
5830
|
-
/* @__PURE__ */
|
|
5841
|
+
/* @__PURE__ */ jsx32(
|
|
5831
5842
|
"iframe",
|
|
5832
5843
|
{
|
|
5833
5844
|
class: `${p28}-content-frame`,
|
|
@@ -5844,7 +5855,7 @@ function IframeView({ url, title, strings, onBack, actions }) {
|
|
|
5844
5855
|
|
|
5845
5856
|
// src/ui/content-view.tsx
|
|
5846
5857
|
import { useCallback as useCallback3, useEffect as useEffect14, useState as useState11 } from "preact/hooks";
|
|
5847
|
-
import { jsx as
|
|
5858
|
+
import { jsx as jsx33, jsxs as jsxs28 } from "preact/jsx-runtime";
|
|
5848
5859
|
var p29 = BRAND.cssPrefix;
|
|
5849
5860
|
var log15 = logger.scope("content");
|
|
5850
5861
|
function ContentView({ id, title, transport, strings, onBack, actions }) {
|
|
@@ -5873,17 +5884,17 @@ function ContentView({ id, title, transport, strings, onBack, actions }) {
|
|
|
5873
5884
|
};
|
|
5874
5885
|
}, [transport, id, reloadKey]);
|
|
5875
5886
|
function renderBody() {
|
|
5876
|
-
if (failed) return /* @__PURE__ */
|
|
5877
|
-
if (item === null) return /* @__PURE__ */
|
|
5887
|
+
if (failed) return /* @__PURE__ */ jsx33(ModuleState, { tone: "error", message: strings.errorGeneric, onRetry: retry, strings });
|
|
5888
|
+
if (item === null) return /* @__PURE__ */ jsx33(ModuleState, { message: strings.contentLoading, strings });
|
|
5878
5889
|
return /* @__PURE__ */ jsxs28("article", { class: `${p29}-content`, "data-testid": TID.contentView, children: [
|
|
5879
|
-
item.image ? /* @__PURE__ */
|
|
5880
|
-
item.description ? /* @__PURE__ */
|
|
5881
|
-
item.tags && item.tags.length > 0 ? /* @__PURE__ */
|
|
5882
|
-
/* @__PURE__ */
|
|
5890
|
+
item.image ? /* @__PURE__ */ jsx33("img", { class: `${p29}-content-hero`, src: item.image, alt: "", loading: "lazy" }) : null,
|
|
5891
|
+
item.description ? /* @__PURE__ */ jsx33("p", { class: `${p29}-content-subtitle`, children: item.description }) : null,
|
|
5892
|
+
item.tags && item.tags.length > 0 ? /* @__PURE__ */ jsx33("span", { class: `${p29}-news-tags`, children: item.tags.map((t) => /* @__PURE__ */ jsx33("span", { class: `${p29}-news-tag`, children: t }, t)) }) : null,
|
|
5893
|
+
/* @__PURE__ */ jsx33(StaticMarkdown, { text: item.content ?? "" })
|
|
5883
5894
|
] });
|
|
5884
5895
|
}
|
|
5885
5896
|
return /* @__PURE__ */ jsxs28("div", { class: `${p29}-module`, children: [
|
|
5886
|
-
/* @__PURE__ */
|
|
5897
|
+
/* @__PURE__ */ jsx33(
|
|
5887
5898
|
BackHeader,
|
|
5888
5899
|
{
|
|
5889
5900
|
title: item?.title || title || strings.moduleBack,
|
|
@@ -5893,12 +5904,12 @@ function ContentView({ id, title, transport, strings, onBack, actions }) {
|
|
|
5893
5904
|
testid: TID.backHeader
|
|
5894
5905
|
}
|
|
5895
5906
|
),
|
|
5896
|
-
/* @__PURE__ */
|
|
5907
|
+
/* @__PURE__ */ jsx33("div", { class: `${p29}-module-scroll`, "data-testid": TID.contentScroll, children: renderBody() })
|
|
5897
5908
|
] });
|
|
5898
5909
|
}
|
|
5899
5910
|
|
|
5900
5911
|
// src/ui/messenger-home.tsx
|
|
5901
|
-
import { jsx as
|
|
5912
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "preact/jsx-runtime";
|
|
5902
5913
|
var p30 = BRAND.cssPrefix;
|
|
5903
5914
|
function MessengerHome({
|
|
5904
5915
|
panelProps,
|
|
@@ -5967,12 +5978,12 @@ function MessengerHome({
|
|
|
5967
5978
|
nav: moduleNav,
|
|
5968
5979
|
panelProps
|
|
5969
5980
|
});
|
|
5970
|
-
const plainActions = /* @__PURE__ */
|
|
5981
|
+
const plainActions = /* @__PURE__ */ jsx34(HeaderActions, { panelProps, variant: "plain" });
|
|
5971
5982
|
let body;
|
|
5972
5983
|
if (top?.kind === "iframe") {
|
|
5973
|
-
body = /* @__PURE__ */
|
|
5984
|
+
body = /* @__PURE__ */ jsx34(IframeView, { url: top.url, title: top.title, strings, onBack: nav.pop, actions: plainActions });
|
|
5974
5985
|
} else if (top?.kind === "content") {
|
|
5975
|
-
body = /* @__PURE__ */
|
|
5986
|
+
body = /* @__PURE__ */ jsx34(
|
|
5976
5987
|
ContentView,
|
|
5977
5988
|
{
|
|
5978
5989
|
id: top.id,
|
|
@@ -5984,7 +5995,7 @@ function MessengerHome({
|
|
|
5984
5995
|
}
|
|
5985
5996
|
);
|
|
5986
5997
|
} else if (activeModule?.layout === "chat") {
|
|
5987
|
-
body = /* @__PURE__ */
|
|
5998
|
+
body = /* @__PURE__ */ jsx34(
|
|
5988
5999
|
PanelContent,
|
|
5989
6000
|
{
|
|
5990
6001
|
...panelProps,
|
|
@@ -5995,7 +6006,7 @@ function MessengerHome({
|
|
|
5995
6006
|
);
|
|
5996
6007
|
} else if (activeModule) {
|
|
5997
6008
|
const Root = LAYOUTS[activeModule.layout].Root;
|
|
5998
|
-
body = Root ? /* @__PURE__ */
|
|
6009
|
+
body = Root ? /* @__PURE__ */ jsx34(Root, { ...screenProps(activeModule) }, activeModule.id) : null;
|
|
5999
6010
|
} else {
|
|
6000
6011
|
body = null;
|
|
6001
6012
|
}
|
|
@@ -6010,8 +6021,8 @@ function MessengerHome({
|
|
|
6010
6021
|
style: { position: "relative" },
|
|
6011
6022
|
"data-testid": TID.messengerHome,
|
|
6012
6023
|
children: [
|
|
6013
|
-
/* @__PURE__ */
|
|
6014
|
-
showTabBar ? /* @__PURE__ */
|
|
6024
|
+
/* @__PURE__ */ jsx34("div", { class: `${p30}-messenger-body`, children: body }),
|
|
6025
|
+
showTabBar ? /* @__PURE__ */ jsx34(
|
|
6015
6026
|
HomeTabBar,
|
|
6016
6027
|
{
|
|
6017
6028
|
modules: enabledModules,
|
|
@@ -6021,8 +6032,8 @@ function MessengerHome({
|
|
|
6021
6032
|
onSelect: nav.switchTab
|
|
6022
6033
|
}
|
|
6023
6034
|
) : null,
|
|
6024
|
-
/* @__PURE__ */
|
|
6025
|
-
options.size.resize?.enabled && !(activeModule?.layout === "chat" && !top) ? /* @__PURE__ */
|
|
6035
|
+
/* @__PURE__ */ jsx34(PoweredByBar, { poweredBy: options.poweredBy }),
|
|
6036
|
+
options.size.resize?.enabled && !(activeModule?.layout === "chat" && !top) ? /* @__PURE__ */ jsx34(
|
|
6026
6037
|
ResizeGrip,
|
|
6027
6038
|
{
|
|
6028
6039
|
panelEl: containerRef.current,
|
|
@@ -6039,7 +6050,7 @@ function MessengerHome({
|
|
|
6039
6050
|
}
|
|
6040
6051
|
|
|
6041
6052
|
// src/ui/modules-empty.tsx
|
|
6042
|
-
import { jsx as
|
|
6053
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "preact/jsx-runtime";
|
|
6043
6054
|
var p31 = BRAND.cssPrefix;
|
|
6044
6055
|
function ModulesEmpty({ strings, onClose }) {
|
|
6045
6056
|
return /* @__PURE__ */ jsxs30(
|
|
@@ -6050,7 +6061,7 @@ function ModulesEmpty({ strings, onClose }) {
|
|
|
6050
6061
|
"aria-label": strings.panelTitle,
|
|
6051
6062
|
"data-testid": TID.modulesEmpty,
|
|
6052
6063
|
children: [
|
|
6053
|
-
onClose ? /* @__PURE__ */
|
|
6064
|
+
onClose ? /* @__PURE__ */ jsx35(
|
|
6054
6065
|
"button",
|
|
6055
6066
|
{
|
|
6056
6067
|
type: "button",
|
|
@@ -6058,10 +6069,10 @@ function ModulesEmpty({ strings, onClose }) {
|
|
|
6058
6069
|
onClick: onClose,
|
|
6059
6070
|
"aria-label": strings.close,
|
|
6060
6071
|
title: strings.close,
|
|
6061
|
-
children: /* @__PURE__ */
|
|
6072
|
+
children: /* @__PURE__ */ jsx35(CloseIcon, {})
|
|
6062
6073
|
}
|
|
6063
6074
|
) : null,
|
|
6064
|
-
/* @__PURE__ */
|
|
6075
|
+
/* @__PURE__ */ jsx35("p", { class: `${p31}-modules-empty-text`, children: strings.modulesEmpty })
|
|
6065
6076
|
]
|
|
6066
6077
|
}
|
|
6067
6078
|
);
|
|
@@ -6133,7 +6144,7 @@ function useLauncherCallout({ callout, persistence }) {
|
|
|
6133
6144
|
}
|
|
6134
6145
|
|
|
6135
6146
|
// src/ui/app.tsx
|
|
6136
|
-
import { jsx as
|
|
6147
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "preact/jsx-runtime";
|
|
6137
6148
|
var log16 = logger.scope("app");
|
|
6138
6149
|
var p32 = BRAND.cssPrefix;
|
|
6139
6150
|
function App({ options, hostElement, bus }) {
|
|
@@ -6722,7 +6733,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6722
6733
|
const handlePopOut = useCallback6(() => {
|
|
6723
6734
|
if (!options.popOutUrl) return;
|
|
6724
6735
|
const url = new URL(options.popOutUrl);
|
|
6725
|
-
if (conversationIdSig.value) url.searchParams.set("
|
|
6736
|
+
if (conversationIdSig.value) url.searchParams.set("conversation", conversationIdSig.value);
|
|
6726
6737
|
if (options.widgetId !== "default") url.searchParams.set("widgetId", options.widgetId);
|
|
6727
6738
|
log16.info("popOut", { url: url.toString() });
|
|
6728
6739
|
window.open(url.toString(), "_blank", "noopener,noreferrer");
|
|
@@ -6772,12 +6783,12 @@ function App({ options, hostElement, bus }) {
|
|
|
6772
6783
|
},
|
|
6773
6784
|
[patchAndSync, bus]
|
|
6774
6785
|
);
|
|
6775
|
-
const
|
|
6776
|
-
async (
|
|
6777
|
-
log16.info("
|
|
6778
|
-
bus.emit("
|
|
6786
|
+
const handleSelectHistoryConversation = useCallback6(
|
|
6787
|
+
async (targetConversationId) => {
|
|
6788
|
+
log16.info("selectConversation", { conversationId: targetConversationId });
|
|
6789
|
+
bus.emit("selectConversation", { conversationId: targetConversationId });
|
|
6779
6790
|
try {
|
|
6780
|
-
const res = await transport.loadConversation(
|
|
6791
|
+
const res = await transport.loadConversation(targetConversationId);
|
|
6781
6792
|
const hydrated = res.messages.map(fromWireMessage);
|
|
6782
6793
|
messagesSig.value = hydrated;
|
|
6783
6794
|
conversationIdSig.value = res.conversationId;
|
|
@@ -6786,7 +6797,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6786
6797
|
setCanSend(res.canContinue);
|
|
6787
6798
|
setSuggestions(res.suggestions ?? []);
|
|
6788
6799
|
setView("chat");
|
|
6789
|
-
await transport.markRead(
|
|
6800
|
+
await transport.markRead(targetConversationId);
|
|
6790
6801
|
refreshUnread();
|
|
6791
6802
|
} catch (err) {
|
|
6792
6803
|
bus.emit("error", err);
|
|
@@ -6831,8 +6842,8 @@ function App({ options, hostElement, bus }) {
|
|
|
6831
6842
|
onPopOut: handlePopOut,
|
|
6832
6843
|
onSoundToggle: handleSoundToggle,
|
|
6833
6844
|
onToggleHistory: handleToggleHistory,
|
|
6834
|
-
|
|
6835
|
-
|
|
6845
|
+
onSelectHistoryConversation: handleSelectHistoryConversation,
|
|
6846
|
+
onNewConversation: handleNewChat,
|
|
6836
6847
|
onLocaleChange: handleLocaleChange,
|
|
6837
6848
|
onThemeChange: handleThemeChange,
|
|
6838
6849
|
onWidgetSizeChange: handleWidgetSizeChange,
|
|
@@ -6852,7 +6863,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6852
6863
|
tool: toolInteraction
|
|
6853
6864
|
};
|
|
6854
6865
|
const onSelectConversation = (conversationId) => {
|
|
6855
|
-
void
|
|
6866
|
+
void handleSelectHistoryConversation(conversationId);
|
|
6856
6867
|
const chatId = chatTabId();
|
|
6857
6868
|
if (chatId) homeNav.switchTab(chatId);
|
|
6858
6869
|
};
|
|
@@ -6861,12 +6872,12 @@ function App({ options, hostElement, bus }) {
|
|
|
6861
6872
|
const renderSurface = (size) => {
|
|
6862
6873
|
const closeable = isActionVisible("close", effectiveOptions.mode, size);
|
|
6863
6874
|
if (enabledModules.length === 0) {
|
|
6864
|
-
return /* @__PURE__ */
|
|
6875
|
+
return /* @__PURE__ */ jsx36(ModulesEmpty, { strings: effectiveOptions.strings, onClose: closeable ? handleClose : void 0 });
|
|
6865
6876
|
}
|
|
6866
6877
|
if (enabledModules.length === 1 && enabledModules[0]?.layout === "chat") {
|
|
6867
|
-
return /* @__PURE__ */
|
|
6878
|
+
return /* @__PURE__ */ jsx36(Panel, { ...panelProps, panelSize: size });
|
|
6868
6879
|
}
|
|
6869
|
-
return /* @__PURE__ */
|
|
6880
|
+
return /* @__PURE__ */ jsx36(
|
|
6870
6881
|
MessengerHome,
|
|
6871
6882
|
{
|
|
6872
6883
|
panelProps: { ...panelProps, panelSize: size, onClose: closeable ? handleClose : void 0 },
|
|
@@ -6880,11 +6891,11 @@ function App({ options, hostElement, bus }) {
|
|
|
6880
6891
|
);
|
|
6881
6892
|
};
|
|
6882
6893
|
if (options.mode === "page") {
|
|
6883
|
-
const
|
|
6884
|
-
void
|
|
6894
|
+
const onSelectConversationFromSidebar = (chat) => {
|
|
6895
|
+
void handleSelectHistoryConversation(chat.conversationId);
|
|
6885
6896
|
};
|
|
6886
|
-
const
|
|
6887
|
-
return /* @__PURE__ */
|
|
6897
|
+
const conversationsEnabled = enabledModules.some((m) => m.layout === "chat");
|
|
6898
|
+
return /* @__PURE__ */ jsx36("div", { class: `${p32}-anchor`, children: /* @__PURE__ */ jsx36(
|
|
6888
6899
|
PageShell,
|
|
6889
6900
|
{
|
|
6890
6901
|
site: parsedSite,
|
|
@@ -6892,9 +6903,9 @@ function App({ options, hostElement, bus }) {
|
|
|
6892
6903
|
transport,
|
|
6893
6904
|
strings: effectiveOptions.strings,
|
|
6894
6905
|
visitorId,
|
|
6895
|
-
showConversations:
|
|
6896
|
-
|
|
6897
|
-
|
|
6906
|
+
showConversations: conversationsEnabled,
|
|
6907
|
+
onSelectConversation: onSelectConversationFromSidebar,
|
|
6908
|
+
onNewConversation: handleNewChat,
|
|
6898
6909
|
sidebarCollapsed,
|
|
6899
6910
|
onToggleSidebarCollapsed: handleToggleSidebarCollapsed,
|
|
6900
6911
|
children: renderSurface("fullscreen")
|
|
@@ -6903,7 +6914,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6903
6914
|
}
|
|
6904
6915
|
if (isInlineLike) {
|
|
6905
6916
|
const inlineSize = options.mode === "standalone" ? "fullscreen" : panelSize;
|
|
6906
|
-
return /* @__PURE__ */
|
|
6917
|
+
return /* @__PURE__ */ jsx36("div", { class: `${p32}-anchor`, children: renderSurface(inlineSize) });
|
|
6907
6918
|
}
|
|
6908
6919
|
const drawerEdgeTab = options.mode === "drawer";
|
|
6909
6920
|
const triggerOwnedByPage = options.mode === "modal";
|
|
@@ -6911,7 +6922,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6911
6922
|
const calloutToRender = launcherVisible && !launcherLeaving && !calloutDismissed && !drawerEdgeTab ? effectiveOptions.launcher.callout : null;
|
|
6912
6923
|
return /* @__PURE__ */ jsxs31("div", { class: `${p32}-anchor`, "data-launcher-size": effectiveOptions.launcher.size, children: [
|
|
6913
6924
|
isOpen ? renderSurface(panelSize) : null,
|
|
6914
|
-
launcherVisible ? /* @__PURE__ */
|
|
6925
|
+
launcherVisible ? /* @__PURE__ */ jsx36(
|
|
6915
6926
|
Launcher,
|
|
6916
6927
|
{
|
|
6917
6928
|
onToggle: handleOpen,
|
|
@@ -6921,7 +6932,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6921
6932
|
edgeTab: drawerEdgeTab
|
|
6922
6933
|
}
|
|
6923
6934
|
) : null,
|
|
6924
|
-
calloutToRender ? /* @__PURE__ */
|
|
6935
|
+
calloutToRender ? /* @__PURE__ */ jsx36(
|
|
6925
6936
|
LauncherCallout,
|
|
6926
6937
|
{
|
|
6927
6938
|
callout: calloutToRender,
|
|
@@ -7117,7 +7128,7 @@ var EVENT_NAMES = [
|
|
|
7117
7128
|
"send",
|
|
7118
7129
|
"stop",
|
|
7119
7130
|
"clear",
|
|
7120
|
-
"
|
|
7131
|
+
"selectConversation",
|
|
7121
7132
|
"suggestion",
|
|
7122
7133
|
"toggleHistory",
|
|
7123
7134
|
// Forms + human-in-the-loop
|