@sendbird/ai-agent-messenger-react 1.24.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AH5QEnkP.cjs +1 -0
- package/dist/cjs/BDBlMZr6.cjs +1 -0
- package/dist/cjs/BjKg30ip.cjs +1 -0
- package/dist/cjs/CMRhzGTM.cjs +1 -0
- package/dist/cjs/CuM2FtoD.cjs +1 -0
- package/dist/cjs/DB0sLqre.cjs +1 -0
- package/dist/cjs/DGIKgeo3.cjs +1 -0
- package/dist/cjs/DVhPpubH.cjs +1 -0
- package/dist/cjs/DezBdMzD.cjs +1 -0
- package/dist/cjs/Dz4mUNp4.cjs +1 -0
- package/dist/cjs/HKP2IE1G.cjs +1 -0
- package/dist/es/BBCKVL7d.js +5 -0
- package/dist/es/{CsqVHJCI.js → BfU8xV9U.js} +42 -20
- package/dist/es/{CkoDhLul.js → CaPTuvBH.js} +41 -19
- package/dist/es/{BEqaF3DV.js → CgKly2NZ.js} +42 -20
- package/dist/es/{BUKDIngh.js → CjJliSJt.js} +44 -22
- package/dist/es/{7vCh5QlQ.js → CxajqGzE.js} +44 -22
- package/dist/es/{5tV340wv.js → D0puKqeb.js} +42 -20
- package/dist/es/{CKLYurhd.js → DHn-_17E.js} +38 -16
- package/dist/es/{CXt8kUk8.js → DhZK0r9g.js} +39 -17
- package/dist/es/{ZdYGAJn_.js → DzAt_5Ix.js} +36 -14
- package/dist/es/tbfFzmFJ.js +198 -0
- package/dist/index.cjs +179 -183
- package/dist/index.d.ts +361 -134
- package/dist/index.js +5906 -4912
- package/package.json +7 -9
- package/dist/cjs/BBssumix.cjs +0 -1
- package/dist/cjs/BCDZXq61.cjs +0 -1
- package/dist/cjs/Bz2jHC-Z.cjs +0 -1
- package/dist/cjs/CFY_588Z.cjs +0 -1
- package/dist/cjs/CHz4H01e.cjs +0 -1
- package/dist/cjs/CfhYXtgc.cjs +0 -1
- package/dist/cjs/Jlh8RyJW.cjs +0 -1
- package/dist/cjs/RKaCusvu.cjs +0 -1
- package/dist/cjs/Sz9ta-fi.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { es as
|
|
2
|
-
import { m as
|
|
1
|
+
import { es as r } from "date-fns/locale/es";
|
|
2
|
+
import { m as _ } from "../index.js";
|
|
3
3
|
const t = {
|
|
4
4
|
conversation: {
|
|
5
5
|
input_placeholder: "Hacer una pregunta",
|
|
@@ -48,6 +48,10 @@ const t = {
|
|
|
48
48
|
a11y_file_image: (e) => `Archivo de imagen: ${e}`,
|
|
49
49
|
a11y_file_video: (e) => `Archivo de video: ${e}`,
|
|
50
50
|
a11y_file_document: (e) => `Archivo de documento: ${e}`,
|
|
51
|
+
a11y_received_file_image: "Archivo de imagen",
|
|
52
|
+
a11y_received_file_video: "Archivo de video",
|
|
53
|
+
a11y_received_file_pdf: (e) => `Archivo PDF: ${e}`,
|
|
54
|
+
a11y_received_files_image_count: (e) => `${e} ${e === 1 ? "imagen" : "imágenes"}`,
|
|
51
55
|
a11y_screen_conversation: "Conversación",
|
|
52
56
|
a11y_screen_conversation_with_agent: (e) => `Conversación con ${e}`,
|
|
53
57
|
a11y_screen_conversation_list_no_count: "Lista de conversaciones",
|
|
@@ -67,7 +71,13 @@ const t = {
|
|
|
67
71
|
a11y_hint_view_new_messages: "Se desplaza a los mensajes nuevos",
|
|
68
72
|
a11y_hint_open_file: "Abre el archivo",
|
|
69
73
|
a11y_hint_open_image: "Abre la imagen",
|
|
70
|
-
a11y_hint_send_reply: "Envía esta respuesta"
|
|
74
|
+
a11y_hint_send_reply: "Envía esta respuesta",
|
|
75
|
+
image_viewer_default_title: "Imagen",
|
|
76
|
+
a11y_image_viewer_close: "Cerrar visor de imágenes",
|
|
77
|
+
a11y_image_viewer_previous: "Imagen anterior",
|
|
78
|
+
a11y_image_viewer_next: "Imagen siguiente",
|
|
79
|
+
a11y_image_viewer_download: "Descargar imagen",
|
|
80
|
+
attachment_document: "Archivos"
|
|
71
81
|
},
|
|
72
82
|
conversation_list: {
|
|
73
83
|
header_title: "Conversaciones",
|
|
@@ -95,7 +105,7 @@ const t = {
|
|
|
95
105
|
question: "¿Cómo calificarías tu experiencia?",
|
|
96
106
|
submit_label: "Enviar",
|
|
97
107
|
submission_expired: "Lo sentimos, el período de la encuesta ha terminado.",
|
|
98
|
-
|
|
108
|
+
a11y_csat_rating_label: (e, a) => `${e} de 5 — ${a}`,
|
|
99
109
|
a11y_hint_select_rating: "Selecciona esta calificación"
|
|
100
110
|
},
|
|
101
111
|
form: {
|
|
@@ -127,13 +137,34 @@ const t = {
|
|
|
127
137
|
confirm_description: "Se le transferirá a un agente humano. Se compartirá su historial de conversación.",
|
|
128
138
|
confirm_cancel: "Cancelar",
|
|
129
139
|
confirm_handoff: "Transferir"
|
|
140
|
+
},
|
|
141
|
+
memory: {
|
|
142
|
+
dialog_title: "Memoria de usuario",
|
|
143
|
+
desc_on: "La memoria está **activada**. Recuerda tu historial de conversación para ofrecer respuestas personalizadas adaptadas a tus preguntas y preferencias anteriores.",
|
|
144
|
+
desc_off: "La memoria está **desactivada**. Si se activa, recordará tu historial de conversación para ofrecer respuestas personalizadas adaptadas a tus preguntas y preferencias anteriores.",
|
|
145
|
+
button_use: "Usar",
|
|
146
|
+
button_dont_use: "No usar",
|
|
147
|
+
button_keep_using: "Seguir usando",
|
|
148
|
+
button_disable: "Desactivar",
|
|
149
|
+
button_disable_and_delete: "Desactivar y eliminar memoria",
|
|
150
|
+
button_keep_off: "Mantener desactivada",
|
|
151
|
+
button_enable: "Activar memoria",
|
|
152
|
+
button_cancel: "Cancelar",
|
|
153
|
+
error_message: "No se pudo actualizar el estado de la memoria. Inténtalo de nuevo.",
|
|
154
|
+
a11y_indicator_manage: "Administrar memoria",
|
|
155
|
+
a11y_indicator_on: "La memoria está activada",
|
|
156
|
+
a11y_indicator_off: "La memoria está desactivada"
|
|
157
|
+
},
|
|
158
|
+
connection_delay: {
|
|
159
|
+
title: "Algo salió mal. Se reconectará en breve.",
|
|
160
|
+
description: (e) => `Tiempo estimado de espera: ${e}`
|
|
130
161
|
}
|
|
131
162
|
}, o = {
|
|
132
163
|
language: "es",
|
|
133
164
|
strings: t,
|
|
134
|
-
dateLocale:
|
|
135
|
-
},
|
|
136
|
-
...
|
|
165
|
+
dateLocale: r
|
|
166
|
+
}, i = _(o.strings), c = {
|
|
167
|
+
...i,
|
|
137
168
|
// Channel Header
|
|
138
169
|
HEADER_BUTTON__AGENT_HANDOFF: "Conectarse con un agente",
|
|
139
170
|
// Message Input
|
|
@@ -147,20 +178,11 @@ const t = {
|
|
|
147
178
|
FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: "El tamaño máximo por archivo es de %d MB.",
|
|
148
179
|
FILE_UPLOAD_NOTIFICATION__FILES_EXCLUDED_BY_VALIDATION: "%d archivos fueron excluidos debido a los límites. Por favor, selecciona los archivos individualmente.",
|
|
149
180
|
FILE_UPLOAD_PHOTOS: "Fotos",
|
|
150
|
-
FILE_UPLOAD_FILES: "Archivos",
|
|
151
181
|
// File Viewer
|
|
152
182
|
FILE_VIEWER__UNSUPPORT: "Mensaje no compatible",
|
|
153
|
-
// Image Viewer
|
|
154
|
-
IMAGE_VIEWER__DEFAULT_TITLE: "Imagen",
|
|
155
183
|
// Accessibility
|
|
156
|
-
A11Y_IMAGE_VIEWER_CLOSE: "Cerrar visor de imágenes",
|
|
157
|
-
A11Y_IMAGE_VIEWER_PREVIOUS: "Imagen anterior",
|
|
158
|
-
A11Y_IMAGE_VIEWER_NEXT: "Imagen siguiente",
|
|
159
|
-
A11Y_IMAGE_VIEWER_DOWNLOAD: "Descargar imagen",
|
|
160
|
-
A11Y_ATTACH_FILE: "Adjuntar archivo",
|
|
161
184
|
A11Y_FILE_SELECTED: (e) => `${e}, seleccionado`,
|
|
162
185
|
A11Y_FILE_REMOVE_BUTTON: (e) => `Eliminar archivo: ${e}`,
|
|
163
|
-
A11Y_CSAT_RATING_LABEL: (e, a) => `${e} — ${a}`,
|
|
164
186
|
A11Y_FILE_UPLOAD_OPTIONS: "Opciones de carga de archivos",
|
|
165
187
|
A11Y_FAILED_MESSAGE_OPTIONS: "Opciones de mensaje fallido",
|
|
166
188
|
A11Y_FEEDBACK_OPTIONS: "Opciones de comentarios",
|
|
@@ -176,7 +198,7 @@ const t = {
|
|
|
176
198
|
FORM_VALIDATION_MAX_SELECT: (e) => `Selecciona como máximo ${e} opciones`,
|
|
177
199
|
FORM_VALIDATION_REGEX_FAILED: "Formato inválido",
|
|
178
200
|
/** @deprecated Please use DATE_FORMAT__DATE_SHORT instead. **/
|
|
179
|
-
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE:
|
|
201
|
+
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE: i.DATE_FORMAT__DATE_SHORT,
|
|
180
202
|
/** @deprecated Unused string **/
|
|
181
203
|
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION: "HH:mm",
|
|
182
204
|
/** @deprecated Unused string **/
|
|
@@ -48,6 +48,10 @@ const o = {
|
|
|
48
48
|
a11y_file_image: (e) => `Bilddatei: ${e}`,
|
|
49
49
|
a11y_file_video: (e) => `Videodatei: ${e}`,
|
|
50
50
|
a11y_file_document: (e) => `Dokumentdatei: ${e}`,
|
|
51
|
+
a11y_received_file_image: "Bilddatei",
|
|
52
|
+
a11y_received_file_video: "Videodatei",
|
|
53
|
+
a11y_received_file_pdf: (e) => `PDF-Datei: ${e}`,
|
|
54
|
+
a11y_received_files_image_count: (e) => `${e} ${e === 1 ? "Bild" : "Bilder"}`,
|
|
51
55
|
a11y_screen_conversation: "Konversation",
|
|
52
56
|
a11y_screen_conversation_with_agent: (e) => `Konversation mit ${e}`,
|
|
53
57
|
a11y_screen_conversation_list_no_count: "Konversationsliste",
|
|
@@ -67,7 +71,13 @@ const o = {
|
|
|
67
71
|
a11y_hint_view_new_messages: "Scrollt zu neuen Nachrichten",
|
|
68
72
|
a11y_hint_open_file: "Öffnet die Datei",
|
|
69
73
|
a11y_hint_open_image: "Öffnet das Bild",
|
|
70
|
-
a11y_hint_send_reply: "Sendet diese Antwort"
|
|
74
|
+
a11y_hint_send_reply: "Sendet diese Antwort",
|
|
75
|
+
image_viewer_default_title: "Bild",
|
|
76
|
+
a11y_image_viewer_close: "Bildanzeige schließen",
|
|
77
|
+
a11y_image_viewer_previous: "Vorheriges Bild",
|
|
78
|
+
a11y_image_viewer_next: "Nächstes Bild",
|
|
79
|
+
a11y_image_viewer_download: "Bild herunterladen",
|
|
80
|
+
attachment_document: "Dateien"
|
|
71
81
|
},
|
|
72
82
|
conversation_list: {
|
|
73
83
|
header_title: "Gespräche",
|
|
@@ -75,7 +85,7 @@ const o = {
|
|
|
75
85
|
system_message: "Systemnachricht",
|
|
76
86
|
footer_title: "Ein Gespräch starten",
|
|
77
87
|
multiple_files_count: (e) => `${e} ${e === 1 ? "Datei" : "Dateien"}`,
|
|
78
|
-
a11y_conversation_item: (e, n,
|
|
88
|
+
a11y_conversation_item: (e, n, _, i) => `${e}, ${n}, ${_}, ${i} ungelesene ${i === 1 ? "Nachricht" : "Nachrichten"}`
|
|
79
89
|
},
|
|
80
90
|
date_format: {
|
|
81
91
|
just_now: "Gerade eben",
|
|
@@ -95,7 +105,7 @@ const o = {
|
|
|
95
105
|
question: "Wie würden Sie Ihre Erfahrung bewerten?",
|
|
96
106
|
submit_label: "Absenden",
|
|
97
107
|
submission_expired: "Die Umfrage ist leider nicht mehr verfügbar.",
|
|
98
|
-
|
|
108
|
+
a11y_csat_rating_label: (e, n) => `${e} von 5 — ${n}`,
|
|
99
109
|
a11y_hint_select_rating: "Wählt diese Bewertung aus"
|
|
100
110
|
},
|
|
101
111
|
form: {
|
|
@@ -127,12 +137,33 @@ const o = {
|
|
|
127
137
|
confirm_description: "Sie werden an einen menschlichen Agenten weitergeleitet. Ihr Gesprächsverlauf wird geteilt.",
|
|
128
138
|
confirm_cancel: "Abbrechen",
|
|
129
139
|
confirm_handoff: "Weiterleiten"
|
|
140
|
+
},
|
|
141
|
+
memory: {
|
|
142
|
+
dialog_title: "Nutzerspeicher",
|
|
143
|
+
desc_on: "Der Speicher ist **aktiviert**. Er merkt sich Ihren Gesprächsverlauf, um personalisierte Antworten basierend auf Ihren bisherigen Fragen und Präferenzen zu liefern.",
|
|
144
|
+
desc_off: "Der Speicher ist **deaktiviert**. Wenn aktiviert, merkt er sich Ihren Gesprächsverlauf, um personalisierte Antworten basierend auf Ihren bisherigen Fragen und Präferenzen zu liefern.",
|
|
145
|
+
button_use: "Verwenden",
|
|
146
|
+
button_dont_use: "Nicht verwenden",
|
|
147
|
+
button_keep_using: "Weiter verwenden",
|
|
148
|
+
button_disable: "Deaktivieren",
|
|
149
|
+
button_disable_and_delete: "Deaktivieren und Speicher löschen",
|
|
150
|
+
button_keep_off: "Aus lassen",
|
|
151
|
+
button_enable: "Speicher aktivieren",
|
|
152
|
+
button_cancel: "Abbrechen",
|
|
153
|
+
error_message: "Speicherstatus konnte nicht aktualisiert werden. Bitte versuchen Sie es erneut.",
|
|
154
|
+
a11y_indicator_manage: "Speicher verwalten",
|
|
155
|
+
a11y_indicator_on: "Speicher ist aktiviert",
|
|
156
|
+
a11y_indicator_off: "Speicher ist deaktiviert"
|
|
157
|
+
},
|
|
158
|
+
connection_delay: {
|
|
159
|
+
title: "Etwas ist schiefgelaufen. Sie werden in Kürze wieder verbunden.",
|
|
160
|
+
description: (e) => `Geschätzte Wartezeit: ${e}`
|
|
130
161
|
}
|
|
131
162
|
}, t = {
|
|
132
163
|
language: "de",
|
|
133
164
|
strings: o,
|
|
134
165
|
dateLocale: r
|
|
135
|
-
}, a = s(t.strings),
|
|
166
|
+
}, a = s(t.strings), c = {
|
|
136
167
|
...a,
|
|
137
168
|
// Channel Header
|
|
138
169
|
HEADER_BUTTON__AGENT_HANDOFF: "Mit einem Agenten verbinden",
|
|
@@ -147,20 +178,11 @@ const o = {
|
|
|
147
178
|
FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: "Die maximale Dateigröße beträgt %d MB.",
|
|
148
179
|
FILE_UPLOAD_NOTIFICATION__FILES_EXCLUDED_BY_VALIDATION: "%d Dateien wurden aufgrund von Limits ausgeschlossen. Bitte wählen Sie Dateien einzeln aus.",
|
|
149
180
|
FILE_UPLOAD_PHOTOS: "Fotos",
|
|
150
|
-
FILE_UPLOAD_FILES: "Dateien",
|
|
151
181
|
// File Viewer
|
|
152
182
|
FILE_VIEWER__UNSUPPORT: "Nicht unterstützte Nachricht",
|
|
153
|
-
// Image Viewer
|
|
154
|
-
IMAGE_VIEWER__DEFAULT_TITLE: "Bild",
|
|
155
183
|
// Accessibility
|
|
156
|
-
A11Y_IMAGE_VIEWER_CLOSE: "Bildanzeige schließen",
|
|
157
|
-
A11Y_IMAGE_VIEWER_PREVIOUS: "Vorheriges Bild",
|
|
158
|
-
A11Y_IMAGE_VIEWER_NEXT: "Nächstes Bild",
|
|
159
|
-
A11Y_IMAGE_VIEWER_DOWNLOAD: "Bild herunterladen",
|
|
160
|
-
A11Y_ATTACH_FILE: "Datei anhängen",
|
|
161
184
|
A11Y_FILE_SELECTED: (e) => `${e}, ausgewählt`,
|
|
162
185
|
A11Y_FILE_REMOVE_BUTTON: (e) => `Datei entfernen: ${e}`,
|
|
163
|
-
A11Y_CSAT_RATING_LABEL: (e, n) => `${e} — ${n}`,
|
|
164
186
|
A11Y_FILE_UPLOAD_OPTIONS: "Datei-Upload-Optionen",
|
|
165
187
|
A11Y_FAILED_MESSAGE_OPTIONS: "Optionen für fehlgeschlagene Nachricht",
|
|
166
188
|
A11Y_FEEDBACK_OPTIONS: "Feedback-Optionen",
|
|
@@ -196,7 +218,7 @@ const o = {
|
|
|
196
218
|
}, h = {
|
|
197
219
|
language: t.language,
|
|
198
220
|
dateLocale: t.dateLocale,
|
|
199
|
-
stringSet:
|
|
221
|
+
stringSet: c
|
|
200
222
|
};
|
|
201
223
|
export {
|
|
202
224
|
h as default
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as V from "react";
|
|
2
|
+
import { useState as A } from "react";
|
|
3
|
+
import _ from "styled-components";
|
|
4
|
+
import { MessageProvider as I, renderer as R, parser as C } from "@sendbird/react-uikit-message-template-view";
|
|
5
|
+
import { createMessageTemplate as O } from "@sendbird/uikit-message-template";
|
|
6
|
+
import { r as M, f as K, a as S, p as N, b as g, d as f, u as h, g as B, I as L, n as k } from "../index.js";
|
|
7
|
+
const v = {
|
|
8
|
+
VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
|
|
9
|
+
VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")
|
|
10
|
+
};
|
|
11
|
+
function p({ uiTemplateString: e, variables: l = {} }) {
|
|
12
|
+
const s = K(l);
|
|
13
|
+
return S({
|
|
14
|
+
template: e,
|
|
15
|
+
variables: s,
|
|
16
|
+
variableKeyPattern: (t) => v.VARIABLE(t)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function b({
|
|
20
|
+
theme: e,
|
|
21
|
+
uiTemplateString: l,
|
|
22
|
+
colorVariables: s = {}
|
|
23
|
+
}) {
|
|
24
|
+
return S({
|
|
25
|
+
template: l,
|
|
26
|
+
variables: s,
|
|
27
|
+
variableKeyPattern: (t) => v.VARIABLE(t),
|
|
28
|
+
variableValueTransformer: (t) => N(e, t)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function G({
|
|
32
|
+
theme: e,
|
|
33
|
+
uiTemplateString: l,
|
|
34
|
+
viewVariables: s = {},
|
|
35
|
+
aiAgentColorVariables: t,
|
|
36
|
+
internalVariables: a,
|
|
37
|
+
onRequestTemplate: i
|
|
38
|
+
}) {
|
|
39
|
+
const c = Object.values(s).flat().map((n) => n.key);
|
|
40
|
+
return [...new Set(c)].some((n) => !i(n)) ? null : S({
|
|
41
|
+
template: l,
|
|
42
|
+
variables: s,
|
|
43
|
+
variableKeyPattern: (n) => v.VIEW_VARIABLE(n),
|
|
44
|
+
variableValueTransformer: (n) => {
|
|
45
|
+
const T = n.map(({ key: y, variables: w }) => {
|
|
46
|
+
const E = i(y), { ui_template: o, color_variables: d } = g(E);
|
|
47
|
+
let u = JSON.stringify(o);
|
|
48
|
+
return u = p({
|
|
49
|
+
uiTemplateString: u,
|
|
50
|
+
variables: a
|
|
51
|
+
}), u = b({
|
|
52
|
+
theme: e,
|
|
53
|
+
uiTemplateString: u,
|
|
54
|
+
colorVariables: d
|
|
55
|
+
}), u = b({
|
|
56
|
+
theme: e,
|
|
57
|
+
uiTemplateString: u,
|
|
58
|
+
colorVariables: t
|
|
59
|
+
}), u = p({
|
|
60
|
+
uiTemplateString: u,
|
|
61
|
+
variables: w
|
|
62
|
+
}), f(u);
|
|
63
|
+
});
|
|
64
|
+
return JSON.stringify(T);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async function J({
|
|
69
|
+
theme: e,
|
|
70
|
+
uiTemplateString: l,
|
|
71
|
+
viewVariables: s = {},
|
|
72
|
+
aiAgentColorVariables: t,
|
|
73
|
+
internalVariables: a,
|
|
74
|
+
onRequestTemplate: i
|
|
75
|
+
}) {
|
|
76
|
+
return M({
|
|
77
|
+
template: l,
|
|
78
|
+
variables: s,
|
|
79
|
+
variableKeyPattern: (r) => v.VIEW_VARIABLE(r),
|
|
80
|
+
variableValueTransformer: async (r) => {
|
|
81
|
+
const c = r.map(async ({ key: n, variables: T }) => {
|
|
82
|
+
const y = await i(n), { ui_template: w, color_variables: E } = g(y);
|
|
83
|
+
let o = JSON.stringify(w);
|
|
84
|
+
return o = p({
|
|
85
|
+
uiTemplateString: o,
|
|
86
|
+
variables: a
|
|
87
|
+
}), o = b({
|
|
88
|
+
theme: e,
|
|
89
|
+
uiTemplateString: o,
|
|
90
|
+
colorVariables: E
|
|
91
|
+
}), o = b({
|
|
92
|
+
theme: e,
|
|
93
|
+
uiTemplateString: o,
|
|
94
|
+
colorVariables: t
|
|
95
|
+
}), o = p({
|
|
96
|
+
uiTemplateString: o,
|
|
97
|
+
variables: T
|
|
98
|
+
}), f(o);
|
|
99
|
+
}), m = await Promise.all(c);
|
|
100
|
+
return JSON.stringify(m);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const P = ({
|
|
105
|
+
rawTemplate: e,
|
|
106
|
+
aiAgentColorVariables: l,
|
|
107
|
+
internalVariables: s,
|
|
108
|
+
...t
|
|
109
|
+
}) => {
|
|
110
|
+
const { ui_template: a, color_variables: i } = g(e);
|
|
111
|
+
let r = JSON.stringify(a);
|
|
112
|
+
if (Object.keys(t.viewVariables ?? {}).length > 0) {
|
|
113
|
+
const m = G({
|
|
114
|
+
...t,
|
|
115
|
+
uiTemplateString: r,
|
|
116
|
+
aiAgentColorVariables: l,
|
|
117
|
+
internalVariables: s
|
|
118
|
+
});
|
|
119
|
+
if (m === null) return null;
|
|
120
|
+
r = m;
|
|
121
|
+
}
|
|
122
|
+
return r = p({ ...t, uiTemplateString: r, variables: s }), r = b({ ...t, uiTemplateString: r, colorVariables: i }), r = b({ ...t, uiTemplateString: r, colorVariables: l }), r = p({ ...t, uiTemplateString: r }), f(r);
|
|
123
|
+
}, U = async ({
|
|
124
|
+
rawTemplate: e,
|
|
125
|
+
aiAgentColorVariables: l,
|
|
126
|
+
internalVariables: s,
|
|
127
|
+
...t
|
|
128
|
+
}) => {
|
|
129
|
+
const { ui_template: a, color_variables: i } = g(e);
|
|
130
|
+
let r = JSON.stringify(a);
|
|
131
|
+
return Object.keys(t.viewVariables ?? {}).length > 0 && (r = await J({
|
|
132
|
+
...t,
|
|
133
|
+
uiTemplateString: r,
|
|
134
|
+
aiAgentColorVariables: l,
|
|
135
|
+
internalVariables: s
|
|
136
|
+
})), r = p({ ...t, uiTemplateString: r, variables: s }), r = b({ ...t, uiTemplateString: r, colorVariables: i }), r = b({ ...t, uiTemplateString: r, colorVariables: l }), r = p({ ...t, uiTemplateString: r }), f(r);
|
|
137
|
+
}, j = (e) => {
|
|
138
|
+
const { aiAgentColorVariables: l = {} } = e, { internalVariables: s } = h();
|
|
139
|
+
return A(() => {
|
|
140
|
+
const t = e.onGetCachedTemplate(e.templateKey);
|
|
141
|
+
return t ? P({
|
|
142
|
+
...e,
|
|
143
|
+
rawTemplate: t,
|
|
144
|
+
aiAgentColorVariables: l,
|
|
145
|
+
internalVariables: s,
|
|
146
|
+
onRequestTemplate: e.onGetCachedTemplate
|
|
147
|
+
}) : null;
|
|
148
|
+
});
|
|
149
|
+
}, q = (e) => {
|
|
150
|
+
const [l] = j(e);
|
|
151
|
+
if (l) return l;
|
|
152
|
+
const { aiAgentColorVariables: s = {} } = e, { internalVariables: t, fetchTemplate: a, suspend: i } = h();
|
|
153
|
+
return i(e.templateKey, async () => {
|
|
154
|
+
const c = await a({ ...e, suspense: !0 });
|
|
155
|
+
return await U({
|
|
156
|
+
...e,
|
|
157
|
+
rawTemplate: c,
|
|
158
|
+
aiAgentColorVariables: s,
|
|
159
|
+
internalVariables: t
|
|
160
|
+
});
|
|
161
|
+
}).value;
|
|
162
|
+
}, x = /* @__PURE__ */ new Set(["default"]), { MessageTemplate: W } = O({
|
|
163
|
+
parser: C,
|
|
164
|
+
renderer: R,
|
|
165
|
+
Container: (e) => /* @__PURE__ */ V.createElement("div", { ...e })
|
|
166
|
+
}), Y = ({
|
|
167
|
+
extendedMessagePayload: e,
|
|
168
|
+
onGetCachedMessageTemplate: l = () => null,
|
|
169
|
+
onRequestMessageTemplate: s,
|
|
170
|
+
onHandleTemplateInternalAction: t = k
|
|
171
|
+
}) => {
|
|
172
|
+
const a = e == null ? void 0 : e.message_template;
|
|
173
|
+
if (!x.has((a == null ? void 0 : a.type) ?? "default")) throw new Error("Unsupported template type");
|
|
174
|
+
if (!s) throw new Error("onRequestMessageTemplate is required");
|
|
175
|
+
const r = a == null ? void 0 : a.key;
|
|
176
|
+
if (!r) throw new Error("Template key is missing");
|
|
177
|
+
const { theme: c } = B(), m = q({
|
|
178
|
+
onRequestTemplate: s,
|
|
179
|
+
onGetCachedTemplate: l,
|
|
180
|
+
theme: c.selectedTheme,
|
|
181
|
+
templateKey: r,
|
|
182
|
+
variables: a == null ? void 0 : a.variables,
|
|
183
|
+
viewVariables: a == null ? void 0 : a.view_variables,
|
|
184
|
+
aiAgentColorVariables: c.aiAgentColorVariables
|
|
185
|
+
});
|
|
186
|
+
return /* @__PURE__ */ V.createElement($, { id: `${L}-ext-message-template` }, /* @__PURE__ */ V.createElement(
|
|
187
|
+
I,
|
|
188
|
+
{
|
|
189
|
+
handleInternalAction: (n, T) => {
|
|
190
|
+
n.stopPropagation(), t == null || t(T);
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
/* @__PURE__ */ V.createElement(W, { templateItems: m.body.items, templateVersion: m.version })
|
|
194
|
+
));
|
|
195
|
+
}, $ = _.div`box-sizing:border-box;overflow:hidden;width:100%;`;
|
|
196
|
+
export {
|
|
197
|
+
Y as MessageTemplateWrapper
|
|
198
|
+
};
|