@sendbird/ai-agent-messenger-react 1.24.0 → 1.25.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/1RttGdBR.cjs +1 -0
- package/dist/cjs/B8O63u6F.cjs +1 -0
- package/dist/cjs/Bb7tPFDH.cjs +1 -0
- package/dist/cjs/BjKg30ip.cjs +1 -0
- package/dist/cjs/C9Y_myeI.cjs +1 -0
- package/dist/cjs/COfoIob1.cjs +1 -0
- package/dist/cjs/CY5jZKJU.cjs +1 -0
- package/dist/cjs/DYr6MsyB.cjs +1 -0
- package/dist/cjs/KpILxsy5.cjs +1 -0
- package/dist/cjs/Xd5FCJlT.cjs +1 -0
- package/dist/es/{BEqaF3DV.js → 2pVW9wFx.js} +14 -11
- package/dist/es/{ZdYGAJn_.js → BD5xoN7u.js} +15 -12
- package/dist/es/{7vCh5QlQ.js → BWZZDg7i.js} +15 -12
- package/dist/es/{CXt8kUk8.js → Bsfn2AhF.js} +17 -14
- package/dist/es/{CkoDhLul.js → C9zJZRLg.js} +15 -12
- package/dist/es/{BUKDIngh.js → DapNV-e6.js} +18 -15
- package/dist/es/{5tV340wv.js → Dj0fB0I-.js} +13 -10
- package/dist/es/{CsqVHJCI.js → DtO4ptZX.js} +13 -10
- package/dist/es/{CKLYurhd.js → E7P-wwKR.js} +11 -8
- package/dist/es/tbfFzmFJ.js +198 -0
- package/dist/index.cjs +105 -109
- package/dist/index.d.ts +255 -127
- package/dist/index.js +5064 -4372
- package/package.json +6 -8
- 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,6 +1,6 @@
|
|
|
1
1
|
import { fr as r } from "date-fns/locale/fr";
|
|
2
|
-
import { m as
|
|
3
|
-
const
|
|
2
|
+
import { m as t } from "../index.js";
|
|
3
|
+
const o = {
|
|
4
4
|
conversation: {
|
|
5
5
|
input_placeholder: "Poser une question",
|
|
6
6
|
input_placeholder_disabled: "Le chat n'est pas disponible dans ce canal",
|
|
@@ -67,7 +67,13 @@ const t = {
|
|
|
67
67
|
a11y_hint_view_new_messages: "Fait défiler vers les nouveaux messages",
|
|
68
68
|
a11y_hint_open_file: "Ouvre le fichier",
|
|
69
69
|
a11y_hint_open_image: "Ouvre l'image",
|
|
70
|
-
a11y_hint_send_reply: "Envoie cette réponse"
|
|
70
|
+
a11y_hint_send_reply: "Envoie cette réponse",
|
|
71
|
+
image_viewer_default_title: "Image",
|
|
72
|
+
a11y_image_viewer_close: "Fermer la visionneuse d'images",
|
|
73
|
+
a11y_image_viewer_previous: "Image précédente",
|
|
74
|
+
a11y_image_viewer_next: "Image suivante",
|
|
75
|
+
a11y_image_viewer_download: "Télécharger l'image",
|
|
76
|
+
attachment_document: "Fichiers"
|
|
71
77
|
},
|
|
72
78
|
conversation_list: {
|
|
73
79
|
header_title: "Conversations",
|
|
@@ -75,7 +81,7 @@ const t = {
|
|
|
75
81
|
system_message: "Message système",
|
|
76
82
|
footer_title: "Démarrer une conversation",
|
|
77
83
|
multiple_files_count: (e) => `${e} fichier${e === 1 ? "" : "s"}`,
|
|
78
|
-
a11y_conversation_item: (e, a,
|
|
84
|
+
a11y_conversation_item: (e, a, _, n) => `${e}, ${a}, ${_}, ${n} message${n === 1 ? "" : "s"} non lu${n === 1 ? "" : "s"}`
|
|
79
85
|
},
|
|
80
86
|
date_format: {
|
|
81
87
|
just_now: "À l'instant",
|
|
@@ -127,13 +133,17 @@ const t = {
|
|
|
127
133
|
confirm_description: "Vous serez transféré à un agent humain. Votre historique de conversation sera partagé.",
|
|
128
134
|
confirm_cancel: "Annuler",
|
|
129
135
|
confirm_handoff: "Transférer"
|
|
136
|
+
},
|
|
137
|
+
connection_delay: {
|
|
138
|
+
title: "Un problème est survenu. Vous serez reconnecté sous peu.",
|
|
139
|
+
description: (e) => `Temps d'attente estimé : ${e}`
|
|
130
140
|
}
|
|
131
141
|
}, s = {
|
|
132
142
|
language: "fr",
|
|
133
|
-
strings:
|
|
143
|
+
strings: o,
|
|
134
144
|
dateLocale: r
|
|
135
|
-
},
|
|
136
|
-
...
|
|
145
|
+
}, i = t(s.strings), l = {
|
|
146
|
+
...i,
|
|
137
147
|
// Channel Header
|
|
138
148
|
HEADER_BUTTON__AGENT_HANDOFF: "Se connecter avec un agent",
|
|
139
149
|
// Message Input
|
|
@@ -147,16 +157,9 @@ const t = {
|
|
|
147
157
|
FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: "La taille maximale par fichier est de %d MB.",
|
|
148
158
|
FILE_UPLOAD_NOTIFICATION__FILES_EXCLUDED_BY_VALIDATION: "%d fichiers ont été exclus en raison des limites. Veuillez sélectionner les fichiers individuellement.",
|
|
149
159
|
FILE_UPLOAD_PHOTOS: "Photos",
|
|
150
|
-
FILE_UPLOAD_FILES: "Fichiers",
|
|
151
160
|
// File Viewer
|
|
152
161
|
FILE_VIEWER__UNSUPPORT: "Message non pris en charge",
|
|
153
|
-
// Image Viewer
|
|
154
|
-
IMAGE_VIEWER__DEFAULT_TITLE: "Image",
|
|
155
162
|
// Accessibility
|
|
156
|
-
A11Y_IMAGE_VIEWER_CLOSE: "Fermer la visionneuse d'images",
|
|
157
|
-
A11Y_IMAGE_VIEWER_PREVIOUS: "Image précédente",
|
|
158
|
-
A11Y_IMAGE_VIEWER_NEXT: "Image suivante",
|
|
159
|
-
A11Y_IMAGE_VIEWER_DOWNLOAD: "Télécharger l'image",
|
|
160
163
|
A11Y_ATTACH_FILE: "Joindre un fichier",
|
|
161
164
|
A11Y_FILE_SELECTED: (e) => `${e}, sélectionné`,
|
|
162
165
|
A11Y_FILE_REMOVE_BUTTON: (e) => `Supprimer le fichier : ${e}`,
|
|
@@ -176,7 +179,7 @@ const t = {
|
|
|
176
179
|
FORM_VALIDATION_MAX_SELECT: (e) => `Sélectionnez au maximum ${e} options`,
|
|
177
180
|
FORM_VALIDATION_REGEX_FAILED: "Format invalide",
|
|
178
181
|
/** @deprecated Please use DATE_FORMAT__DATE_SHORT instead. **/
|
|
179
|
-
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE:
|
|
182
|
+
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE: i.DATE_FORMAT__DATE_SHORT,
|
|
180
183
|
/** @deprecated Unused string **/
|
|
181
184
|
DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION: "HH:mm",
|
|
182
185
|
/** @deprecated Unused string **/
|
|
@@ -67,7 +67,13 @@ const l = {
|
|
|
67
67
|
a11y_hint_view_new_messages: "नए संदेशों तक स्क्रॉल करता है",
|
|
68
68
|
a11y_hint_open_file: "फ़ाइल खोलता है",
|
|
69
69
|
a11y_hint_open_image: "छवि खोलता है",
|
|
70
|
-
a11y_hint_send_reply: "यह जवाब भेजता है"
|
|
70
|
+
a11y_hint_send_reply: "यह जवाब भेजता है",
|
|
71
|
+
image_viewer_default_title: "छवि",
|
|
72
|
+
a11y_image_viewer_close: "छवि व्यूअर बंद करें",
|
|
73
|
+
a11y_image_viewer_previous: "पिछली छवि",
|
|
74
|
+
a11y_image_viewer_next: "अगली छवि",
|
|
75
|
+
a11y_image_viewer_download: "छवि डाउनलोड करें",
|
|
76
|
+
attachment_document: "फाइलें"
|
|
71
77
|
},
|
|
72
78
|
conversation_list: {
|
|
73
79
|
header_title: "बातचीत",
|
|
@@ -127,6 +133,10 @@ const l = {
|
|
|
127
133
|
confirm_description: "आपको एक मानव एजेंट को स्थानांतरित किया जाएगा। आपका वार्तालाप इतिहास साझा किया जाएगा।",
|
|
128
134
|
confirm_cancel: "रद्द करें",
|
|
129
135
|
confirm_handoff: "हैंडऑफ़"
|
|
136
|
+
},
|
|
137
|
+
connection_delay: {
|
|
138
|
+
title: "कुछ गलत हो गया। आप शीघ्र ही पुन: कनेक्ट हो जाएंगे।",
|
|
139
|
+
description: (_) => `अनुमानित प्रतीक्षा समय: ${_}`
|
|
130
140
|
}
|
|
131
141
|
}, a = {
|
|
132
142
|
language: "hi",
|
|
@@ -147,16 +157,9 @@ const l = {
|
|
|
147
157
|
FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: "प्रति फ़ाइल अधिकतम आकार %d MB है।",
|
|
148
158
|
FILE_UPLOAD_NOTIFICATION__FILES_EXCLUDED_BY_VALIDATION: "%d फ़ाइलें सीमा के कारण बाहर रखी गई थीं। कृपया फ़ाइलों को अलग-अलग चुनें।",
|
|
149
159
|
FILE_UPLOAD_PHOTOS: "फ़ोटो",
|
|
150
|
-
FILE_UPLOAD_FILES: "फाइलें",
|
|
151
160
|
// File Viewer
|
|
152
161
|
FILE_VIEWER__UNSUPPORT: "असमर्थित संदेश",
|
|
153
|
-
// Image Viewer
|
|
154
|
-
IMAGE_VIEWER__DEFAULT_TITLE: "छवि",
|
|
155
162
|
// Accessibility
|
|
156
|
-
A11Y_IMAGE_VIEWER_CLOSE: "छवि व्यूअर बंद करें",
|
|
157
|
-
A11Y_IMAGE_VIEWER_PREVIOUS: "पिछली छवि",
|
|
158
|
-
A11Y_IMAGE_VIEWER_NEXT: "अगली छवि",
|
|
159
|
-
A11Y_IMAGE_VIEWER_DOWNLOAD: "छवि डाउनलोड करें",
|
|
160
163
|
A11Y_ATTACH_FILE: "फ़ाइल संलग्न करें",
|
|
161
164
|
A11Y_FILE_SELECTED: (_) => `${_}, चयनित`,
|
|
162
165
|
A11Y_FILE_REMOVE_BUTTON: (_) => `फ़ाइल हटाएँ: ${_}`,
|
|
@@ -193,11 +196,11 @@ const l = {
|
|
|
193
196
|
NO_NAME: "(कोई नाम नहीं)",
|
|
194
197
|
/** @deprecated Unused string **/
|
|
195
198
|
CHANNEL_FROZEN: "चैनल फ्रीज हो गया"
|
|
196
|
-
},
|
|
199
|
+
}, d = {
|
|
197
200
|
language: a.language,
|
|
198
201
|
dateLocale: a.dateLocale,
|
|
199
202
|
stringSet: r
|
|
200
203
|
};
|
|
201
204
|
export {
|
|
202
|
-
|
|
205
|
+
d as default
|
|
203
206
|
};
|
|
@@ -67,7 +67,13 @@ const l = {
|
|
|
67
67
|
a11y_hint_view_new_messages: "새 메시지로 스크롤합니다",
|
|
68
68
|
a11y_hint_open_file: "파일을 엽니다",
|
|
69
69
|
a11y_hint_open_image: "이미지를 엽니다",
|
|
70
|
-
a11y_hint_send_reply: "이 답변을 보냅니다"
|
|
70
|
+
a11y_hint_send_reply: "이 답변을 보냅니다",
|
|
71
|
+
image_viewer_default_title: "이미지",
|
|
72
|
+
a11y_image_viewer_close: "이미지 뷰어 닫기",
|
|
73
|
+
a11y_image_viewer_previous: "이전 이미지",
|
|
74
|
+
a11y_image_viewer_next: "다음 이미지",
|
|
75
|
+
a11y_image_viewer_download: "이미지 다운로드",
|
|
76
|
+
attachment_document: "파일"
|
|
71
77
|
},
|
|
72
78
|
conversation_list: {
|
|
73
79
|
header_title: "대화",
|
|
@@ -127,6 +133,10 @@ const l = {
|
|
|
127
133
|
confirm_description: "상담사에게 연결됩니다. 대화 내용이 공유됩니다.",
|
|
128
134
|
confirm_cancel: "취소",
|
|
129
135
|
confirm_handoff: "연결"
|
|
136
|
+
},
|
|
137
|
+
connection_delay: {
|
|
138
|
+
title: "문제가 발생했습니다. 곧 다시 연결됩니다.",
|
|
139
|
+
description: (_) => `예상 대기 시간: ${_}`
|
|
130
140
|
}
|
|
131
141
|
}, a = {
|
|
132
142
|
language: "ko",
|
|
@@ -147,16 +157,9 @@ const l = {
|
|
|
147
157
|
FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: "파일당 최대 크기는 %d MB입니다.",
|
|
148
158
|
FILE_UPLOAD_NOTIFICATION__FILES_EXCLUDED_BY_VALIDATION: "%d개의 파일이 제한으로 인해 제외되었습니다. 파일을 개별적으로 선택해 주세요.",
|
|
149
159
|
FILE_UPLOAD_PHOTOS: "사진",
|
|
150
|
-
FILE_UPLOAD_FILES: "파일",
|
|
151
160
|
// File Viewer
|
|
152
161
|
FILE_VIEWER__UNSUPPORT: "지원되지 않는 메시지",
|
|
153
|
-
// Image Viewer
|
|
154
|
-
IMAGE_VIEWER__DEFAULT_TITLE: "이미지",
|
|
155
162
|
// Accessibility
|
|
156
|
-
A11Y_IMAGE_VIEWER_CLOSE: "이미지 뷰어 닫기",
|
|
157
|
-
A11Y_IMAGE_VIEWER_PREVIOUS: "이전 이미지",
|
|
158
|
-
A11Y_IMAGE_VIEWER_NEXT: "다음 이미지",
|
|
159
|
-
A11Y_IMAGE_VIEWER_DOWNLOAD: "이미지 다운로드",
|
|
160
163
|
A11Y_ATTACH_FILE: "파일 첨부",
|
|
161
164
|
A11Y_FILE_SELECTED: (_) => `${_}, 선택됨`,
|
|
162
165
|
A11Y_FILE_REMOVE_BUTTON: (_) => `파일 제거: ${_}`,
|
|
@@ -193,11 +196,11 @@ const l = {
|
|
|
193
196
|
NO_NAME: "(이름 없음)",
|
|
194
197
|
/** @deprecated Unused string **/
|
|
195
198
|
CHANNEL_FROZEN: "채널이 동결되었습니다."
|
|
196
|
-
},
|
|
199
|
+
}, d = {
|
|
197
200
|
language: a.language,
|
|
198
201
|
dateLocale: a.dateLocale,
|
|
199
202
|
stringSet: r
|
|
200
203
|
};
|
|
201
204
|
export {
|
|
202
|
-
|
|
205
|
+
d as default
|
|
203
206
|
};
|
|
@@ -67,7 +67,13 @@ const t = {
|
|
|
67
67
|
a11y_hint_view_new_messages: "Rola até as novas mensagens",
|
|
68
68
|
a11y_hint_open_file: "Abre o arquivo",
|
|
69
69
|
a11y_hint_open_image: "Abre a imagem",
|
|
70
|
-
a11y_hint_send_reply: "Envia esta resposta"
|
|
70
|
+
a11y_hint_send_reply: "Envia esta resposta",
|
|
71
|
+
image_viewer_default_title: "Imagem",
|
|
72
|
+
a11y_image_viewer_close: "Fechar visualizador de imagens",
|
|
73
|
+
a11y_image_viewer_previous: "Imagem anterior",
|
|
74
|
+
a11y_image_viewer_next: "Próxima imagem",
|
|
75
|
+
a11y_image_viewer_download: "Baixar imagem",
|
|
76
|
+
attachment_document: "Arquivos"
|
|
71
77
|
},
|
|
72
78
|
conversation_list: {
|
|
73
79
|
header_title: "Conversas",
|
|
@@ -127,6 +133,10 @@ const t = {
|
|
|
127
133
|
confirm_description: "Você será transferido para um agente humano. Seu histórico de conversa será compartilhado.",
|
|
128
134
|
confirm_cancel: "Cancelar",
|
|
129
135
|
confirm_handoff: "Transferir"
|
|
136
|
+
},
|
|
137
|
+
connection_delay: {
|
|
138
|
+
title: "Algo deu errado. Você será reconectado em breve.",
|
|
139
|
+
description: (e) => `Tempo estimado de espera: ${e}`
|
|
130
140
|
}
|
|
131
141
|
}, o = {
|
|
132
142
|
language: "pt",
|
|
@@ -147,16 +157,9 @@ const t = {
|
|
|
147
157
|
FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: "O tamanho máximo por arquivo é de %d MB.",
|
|
148
158
|
FILE_UPLOAD_NOTIFICATION__FILES_EXCLUDED_BY_VALIDATION: "%d arquivos foram excluídos devido aos limites. Selecione os arquivos individualmente.",
|
|
149
159
|
FILE_UPLOAD_PHOTOS: "Fotos",
|
|
150
|
-
FILE_UPLOAD_FILES: "Arquivos",
|
|
151
160
|
// File Viewer
|
|
152
161
|
FILE_VIEWER__UNSUPPORT: "Mensagem não suportada",
|
|
153
|
-
// Image Viewer
|
|
154
|
-
IMAGE_VIEWER__DEFAULT_TITLE: "Imagem",
|
|
155
162
|
// Accessibility
|
|
156
|
-
A11Y_IMAGE_VIEWER_CLOSE: "Fechar visualizador de imagens",
|
|
157
|
-
A11Y_IMAGE_VIEWER_PREVIOUS: "Imagem anterior",
|
|
158
|
-
A11Y_IMAGE_VIEWER_NEXT: "Próxima imagem",
|
|
159
|
-
A11Y_IMAGE_VIEWER_DOWNLOAD: "Baixar imagem",
|
|
160
163
|
A11Y_ATTACH_FILE: "Anexar arquivo",
|
|
161
164
|
A11Y_FILE_SELECTED: (e) => `${e}, selecionado`,
|
|
162
165
|
A11Y_FILE_REMOVE_BUTTON: (e) => `Remover arquivo: ${e}`,
|
|
@@ -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
|
+
};
|