@liftitapp/wa-conversations 0.11.0 → 0.13.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.
@@ -756,7 +756,7 @@ function dedupeByWamid(messages) {
756
756
  //#endregion
757
757
  //#region src/core/contract/operator-send.ts
758
758
  /** El payload del cable es entrada NO confiable: se mira como diccionario, no como tipo. */
759
- function asRecord$1(value) {
759
+ function asRecord$2(value) {
760
760
  return typeof value === "object" && value !== null ? value : {};
761
761
  }
762
762
  /** Un string útil, o `null`. El vacío es tan inútil como el ausente. */
@@ -833,7 +833,7 @@ function optimisticMessage(text, at, clientMessageId) {
833
833
  * hacerle perder al operador el mensaje que acaba de mandar.
834
834
  */
835
835
  function normalizeReplyMessage(payload) {
836
- const record = asRecord$1(payload);
836
+ const record = asRecord$2(payload);
837
837
  return {
838
838
  id: asNonEmptyString(record.wamid) ?? asNonEmptyString(record.id),
839
839
  at: asNonEmptyString(record.at) ?? asNonEmptyString(record.occurred_at),
@@ -868,8 +868,8 @@ const UNSTRUCTURED_ERROR_CODE = "unknown";
868
868
  * exactamente el atajo que en FlexOS terminaba mandando plantillas facturadas.
869
869
  */
870
870
  function readSendError(cause) {
871
- const fromError = asRecord$1(asRecord$1(cause).body);
872
- const direct = asRecord$1(cause);
871
+ const fromError = asRecord$2(asRecord$2(cause).body);
872
+ const direct = asRecord$2(cause);
873
873
  const body = typeof fromError.error_code === "string" ? fromError : typeof direct.error_code === "string" ? direct : {};
874
874
  const errorCode = asNonEmptyString(body.error_code);
875
875
  if (errorCode === null) return {
@@ -903,9 +903,158 @@ function sendFailureCopy(failure) {
903
903
  case "takeover_unavailable": return "No se pudo pausar el bot, así que el mensaje no se envió. Reintenta en un momento.";
904
904
  case "send_failed": return "WhatsApp rechazó el envío. El mensaje quedó registrado en el hilo como no entregado.";
905
905
  case "write_forbidden": return "No tienes permiso para responder en esta conversación.";
906
+ case "invalid_phone": return "El número de destino no es un celular válido en formato E.164.";
907
+ case "template_not_allowed": return "La plantilla no está habilitada para este número.";
908
+ case "invalid_template_params": return "Los parámetros no coinciden con la plantilla.";
906
909
  default: return failure.serverMessage ?? "No se pudo enviar el mensaje.";
907
910
  }
908
911
  }
912
+ function asRecord$1(value) {
913
+ return typeof value === "object" && value !== null ? value : {};
914
+ }
915
+ function asString$1(value) {
916
+ return typeof value === "string" ? value : "";
917
+ }
918
+ function asNullableString$1(value) {
919
+ return typeof value === "string" && value !== "" ? value : null;
920
+ }
921
+ /**
922
+ * Estrecha una plantilla del cable. Sin `name` o `language` no hay qué mandar: se descarta. Un
923
+ * `body_param_count` fuera de 0–10 o no entero también: ofrecerla sería un formulario que el store
924
+ * siempre rechaza.
925
+ */
926
+ function normalizeTemplate(value) {
927
+ const record = asRecord$1(value);
928
+ const name = asNullableString$1(record.name);
929
+ const language = asNullableString$1(record.language);
930
+ const count = record.body_param_count;
931
+ if (name === null || language === null) return null;
932
+ if (typeof count !== "number" || !Number.isInteger(count)) return null;
933
+ if (count < 0 || count > 10) return null;
934
+ return {
935
+ name,
936
+ language,
937
+ label: asNullableString$1(record.label),
938
+ body_param_count: count,
939
+ body_text: asNullableString$1(record.body_text)
940
+ };
941
+ }
942
+ /**
943
+ * El 200 de la lista. `can_start` es fail-closed (sólo el `true` literal), como `can_reply`.
944
+ */
945
+ function normalizeTemplates(payload) {
946
+ const record = asRecord$1(payload);
947
+ const items = Array.isArray(record.items) ? record.items.map(normalizeTemplate).filter((item) => item !== null) : [];
948
+ return {
949
+ phone_number_id: asString$1(record.phone_number_id),
950
+ can_start: record.can_start === true,
951
+ items
952
+ };
953
+ }
954
+ /** El 201/200 del envío: la burbuja es el MISMO `ThreadMessage` del hilo y de `/reply`. */
955
+ function normalizeStartResponse(payload) {
956
+ const record = asRecord$1(payload);
957
+ return {
958
+ phone_e164: asString$1(record.phone_e164),
959
+ phone_number_id: asString$1(record.phone_number_id),
960
+ message: normalizeReplyMessage(record.message)
961
+ };
962
+ }
963
+ /**
964
+ * ¿El rechazo del hilo dice «no hay conversación con este número»?
965
+ *
966
+ * El store responde 404 genérico a un par inexistente (no revela qué teléfonos existen). Se
967
+ * reconocen las dos formas que llegan hoy: `status === 404` (el `WaFetchError` del default-fetcher
968
+ * del entry `./element`, o cualquier error con `.status`) y la marca `code: 'wa_no_conversation'`
969
+ * del fetcher de `lms-web-app`. Cualquier otra cosa es un error de verdad y se pinta como tal.
970
+ */
971
+ function isNoThreadError(error) {
972
+ const record = asRecord$1(error);
973
+ return record.status === 404 || record.code === "wa_no_conversation";
974
+ }
975
+ /**
976
+ * La regla de cuándo se ofrece la plantilla (DEV-8758).
977
+ *
978
+ * 🔴 Sólo `closed` la abre: `unverified` NO. «No pudimos leer la ventana» no es «está cerrada», y
979
+ * ofrecer una plantilla —que Meta cobra— por un parpadeo de Postgres es exactamente el bug de
980
+ * FlexOS que el composer ya evita (`CLAUDE.md`).
981
+ *
982
+ * Con un hilo existente hace falta además `can_reply`: un operador de solo lectura ve el visor como
983
+ * siempre. Sin hilo no hay `can_reply` que leer, y quien decide es el `can_start` de la lista.
984
+ */
985
+ function templateOffer(input) {
986
+ if (!(input.noThread || input.canReply && input.windowState === "closed")) return "none";
987
+ const { templates } = input;
988
+ if (templates.status === "idle" || templates.status === "loading") return "loading";
989
+ if (templates.status === "error") return "unavailable";
990
+ if (!templates.canStart) return "read_only";
991
+ if (templates.itemCount === 0) return "no_templates";
992
+ return "form";
993
+ }
994
+ /**
995
+ * ¿Los parámetros que tipeó el operador pasan las reglas del contrato? Es la misma validación que
996
+ * hace el store (422 `invalid_template_params`) y se repite acá sólo para no habilitar «Enviar
997
+ * mensaje» con algo que va a volver rechazado. El store sigue siendo quien decide.
998
+ */
999
+ function templateParamsValid(params, expectedCount) {
1000
+ if (params.length !== expectedCount) return false;
1001
+ return params.every((raw) => {
1002
+ const value = raw.trim();
1003
+ if (value === "" || value.length > 1024) return false;
1004
+ if (/[\n\r\t]/.test(value)) return false;
1005
+ return !/ {5,}/.test(value);
1006
+ });
1007
+ }
1008
+ /** El primer nombre del contacto: «Nelson Chaves» ⇒ «Nelson». Sin nombre, `''`. */
1009
+ function firstName$1(name) {
1010
+ return (typeof name === "string" ? name.trim().split(/\s+/)[0] : "") ?? "";
1011
+ }
1012
+ /**
1013
+ * Qué parámetros pone el host y cuáles tiene que escribir el operador (DEV-8832, D-2).
1014
+ *
1015
+ * El host sólo conoce el parámetro 1: el primer nombre del contacto. Si lo tiene, no se pide —
1016
+ * pedirle al operador algo que ya está en pantalla es el formulario técnico que este issue saca—.
1017
+ * Si el nombre es nulo o está en blanco, el 1 se pide; los parámetros 2..n se piden siempre.
1018
+ *
1019
+ * 🔴 Es la ÚNICA fuente de esta decisión: el panel no la repite, sólo pinta un input por índice de
1020
+ * `asked`.
1021
+ */
1022
+ function hostTemplateParams(count, contactName) {
1023
+ const known = firstName$1(contactName);
1024
+ const values = [];
1025
+ const asked = [];
1026
+ for (let index = 0; index < count; index += 1) if (index === 0 && known !== "") values.push(known);
1027
+ else {
1028
+ values.push("");
1029
+ asked.push(index);
1030
+ }
1031
+ return {
1032
+ values,
1033
+ asked
1034
+ };
1035
+ }
1036
+ /**
1037
+ * ¿Se puede enviar esta plantilla con estos parámetros? (DEV-8832, D-4).
1038
+ *
1039
+ * Sin el texto aprobado (Meta no lo devolvió para ese número) el operador no sabría qué manda, y
1040
+ * cada plantilla se cobra: nunca a ciegas. Con texto, mandan las reglas del contrato
1041
+ * (`templateParamsValid`).
1042
+ */
1043
+ function canSendTemplate(template, params) {
1044
+ if (template === null || template.body_text === null) return false;
1045
+ return templateParamsValid(params, template.body_param_count);
1046
+ }
1047
+ /**
1048
+ * La vista previa: el `body_text` aprobado con cada `{{n}}` reemplazado por su parámetro. Un
1049
+ * parámetro vacío deja el `{{n}}` a la vista, para que se note qué falta. Sin `body_text`, `null`.
1050
+ */
1051
+ function renderTemplatePreview(bodyText, params) {
1052
+ if (bodyText === null) return null;
1053
+ return bodyText.replace(/\{\{(\d+)\}\}/g, (match, index) => {
1054
+ const value = params[Number(index) - 1]?.trim() ?? "";
1055
+ return value === "" ? match : value;
1056
+ });
1057
+ }
909
1058
  //#endregion
910
1059
  //#region src/core/data/fetcher.ts
911
1060
  /**
@@ -1108,6 +1257,25 @@ async function loadConversations(fetcher, request = {}, options) {
1108
1257
  next_cursor: asNullableString(payload.next_cursor)
1109
1258
  };
1110
1259
  }
1260
+ /**
1261
+ * La lista de plantillas que se pueden mandar desde el número del host (DEV-8758). Coerción
1262
+ * defensiva como el resto: un payload deforme sale `can_start: false` e `items: []`. Los rechazos
1263
+ * se propagan tal cual: el panel decide qué pintar.
1264
+ */
1265
+ async function loadTemplates(fetcher, options) {
1266
+ return normalizeTemplates(await fetcher({ resource: "templates" }, options));
1267
+ }
1268
+ /**
1269
+ * Inicia la conversación con la plantilla (DEV-8758, 201 o 200 idempotente). Los rechazos se
1270
+ * propagan TAL CUAL y se leen con `readSendError` — el cuerpo plano `{error_code, retryable,
1271
+ * message}` es el mismo molde que el de `/reply`.
1272
+ */
1273
+ async function startConversation(fetcher, request, options) {
1274
+ return normalizeStartResponse(await fetcher({
1275
+ resource: "startConversation",
1276
+ ...request
1277
+ }, options));
1278
+ }
1111
1279
  //#endregion
1112
1280
  //#region src/core/usePolling.ts
1113
1281
  /**
@@ -1994,7 +2162,7 @@ function ReleaseToBot({ composer }) {
1994
2162
  ]
1995
2163
  });
1996
2164
  }
1997
- function Composer({ canReply, composer, onRetryWindow, prefill, locked = false, takeoverNotice = null, focusRequest = null }) {
2165
+ function Composer({ canReply, composer, onRetryWindow, prefill, locked = false, takeoverNotice = null, focusRequest = null, templateStart = null }) {
1998
2166
  /**
1999
2167
  * Lo que el operador tipeó, junto con **de qué precarga vino** (DEC-G).
2000
2168
  *
@@ -2043,6 +2211,14 @@ function Composer({ canReply, composer, onRetryWindow, prefill, locked = false,
2043
2211
  /** El id del aviso del pie, para que el lector de pantalla lo lea al enfocar el textarea. */
2044
2212
  const noticeId = useId();
2045
2213
  if (!canReply) return null;
2214
+ if (composer.windowState === "closed" && templateStart !== null) return /* @__PURE__ */ jsxs("div", {
2215
+ className: "wa-composer wa-composer--template",
2216
+ children: [
2217
+ /* @__PURE__ */ jsx(FailureNotice, { composer }),
2218
+ templateStart,
2219
+ /* @__PURE__ */ jsx(ReleaseToBot, { composer })
2220
+ ]
2221
+ });
2046
2222
  if (composer.windowState === "closed") return /* @__PURE__ */ jsxs("div", {
2047
2223
  className: "wa-composer wa-composer--closed",
2048
2224
  children: [
@@ -3961,6 +4137,191 @@ const THREAD_CSS = `
3961
4137
  color: #52606d;
3962
4138
  }
3963
4139
 
4140
+ /* DEV-8758 — «Iniciar con plantilla» (tableros 391/392): con la ventana cerrada o sin hilo, el
4141
+ composer es un formulario de plantilla. Mismo fondo y bordes que el composer de texto.
4142
+ DEV-8832 (tablero 393) cambió el selector por chips de acción y agregó la vista previa con su
4143
+ rótulo y su nota. */
4144
+ .wa-composer--template {
4145
+ gap: 10px;
4146
+ }
4147
+ .wa-template {
4148
+ display: flex;
4149
+ flex-direction: column;
4150
+ gap: 10px;
4151
+ }
4152
+ .wa-template__notice {
4153
+ margin: 0;
4154
+ padding: 8px 12px;
4155
+ border: 1px solid #F5E7C8;
4156
+ border-radius: 8px;
4157
+ font-size: 12px;
4158
+ color: #8A5A10;
4159
+ background: #FFFBF2;
4160
+ }
4161
+ .wa-template__route {
4162
+ display: flex;
4163
+ flex-direction: column;
4164
+ gap: 2px;
4165
+ padding: 8px 12px;
4166
+ border-radius: 8px;
4167
+ font-size: 12px;
4168
+ color: #2D3340;
4169
+ background: #F4F5F7;
4170
+ }
4171
+ .wa-template__route-line {
4172
+ margin: 0;
4173
+ }
4174
+ .wa-template__route-key {
4175
+ font-weight: 600;
4176
+ color: #616e7c;
4177
+ }
4178
+ .wa-template__note {
4179
+ margin: 0;
4180
+ font-size: 12px;
4181
+ color: #8A91A0;
4182
+ }
4183
+ .wa-template__link {
4184
+ padding: 0;
4185
+ border: 0;
4186
+ font: inherit;
4187
+ color: #4F5AED;
4188
+ background: none;
4189
+ cursor: pointer;
4190
+ }
4191
+ .wa-template__form {
4192
+ display: flex;
4193
+ flex-direction: column;
4194
+ gap: 8px;
4195
+ }
4196
+ .wa-template__field {
4197
+ display: flex;
4198
+ flex-direction: column;
4199
+ gap: 4px;
4200
+ }
4201
+ .wa-template__label {
4202
+ font-size: 11px;
4203
+ font-weight: 600;
4204
+ color: #616e7c;
4205
+ }
4206
+ .wa-template__chips {
4207
+ display: flex;
4208
+ flex-wrap: wrap;
4209
+ gap: 6px;
4210
+ }
4211
+ .wa-template__chip {
4212
+ display: inline-flex;
4213
+ align-items: center;
4214
+ gap: 4px;
4215
+ padding: 4px 12px;
4216
+ border: 1px solid #E4E7EE;
4217
+ border-radius: 999px;
4218
+ font: inherit;
4219
+ font-size: 12px;
4220
+ color: #52606d;
4221
+ background: #ffffff;
4222
+ cursor: pointer;
4223
+ }
4224
+ /* El resaltado cuelga del MISMO atributo que lo anuncia al lector de pantalla: no puede verse
4225
+ elegido un chip que el lector anuncia como no elegido, ni al revés. */
4226
+ .wa-template__chip[aria-pressed='true'] {
4227
+ border-color: #4F5AED;
4228
+ font-weight: 600;
4229
+ color: #4F5AED;
4230
+ background: #EEF1FE;
4231
+ }
4232
+ .wa-template__chip:disabled {
4233
+ cursor: default;
4234
+ opacity: 0.6;
4235
+ }
4236
+ .wa-template__chip-check {
4237
+ width: 12px;
4238
+ height: 12px;
4239
+ flex: none;
4240
+ }
4241
+ .wa-template__input {
4242
+ padding: 7px 10px;
4243
+ border: 1px solid #E4E7EE;
4244
+ border-radius: 8px;
4245
+ font: inherit;
4246
+ font-size: 13px;
4247
+ color: #2D3340;
4248
+ background: #F4F5F7;
4249
+ }
4250
+ .wa-template__input:focus {
4251
+ border-color: #4F5AED;
4252
+ outline: 2px solid rgba(79, 90, 237, 0.25);
4253
+ outline-offset: 0;
4254
+ }
4255
+ /* La vista previa como burbuja de salida: es lo que va a leer la persona. */
4256
+ .wa-template__preview {
4257
+ align-self: flex-end;
4258
+ max-width: 85%;
4259
+ padding: 8px 12px;
4260
+ border-radius: 12px 12px 4px 12px;
4261
+ background: #EEF1FE;
4262
+ }
4263
+ .wa-template__preview-label {
4264
+ font-size: 11px;
4265
+ font-weight: 600;
4266
+ color: #616e7c;
4267
+ }
4268
+ /* Alineada con la burbuja, a la derecha. */
4269
+ .wa-template__preview-note {
4270
+ align-self: flex-end;
4271
+ margin: 0;
4272
+ font-size: 10.5px;
4273
+ color: #9AA1AE;
4274
+ }
4275
+ .wa-template__preview-body {
4276
+ margin: 0;
4277
+ font-size: 13px;
4278
+ color: #2D3340;
4279
+ white-space: pre-wrap;
4280
+ }
4281
+ .wa-template__error {
4282
+ display: flex;
4283
+ flex-wrap: wrap;
4284
+ align-items: center;
4285
+ justify-content: space-between;
4286
+ gap: 8px;
4287
+ padding: 8px 10px;
4288
+ border: 1px solid #e5b9b6;
4289
+ border-radius: 6px;
4290
+ background: #fdf6f6;
4291
+ }
4292
+ .wa-template__error-text {
4293
+ margin: 0;
4294
+ font-size: 12px;
4295
+ color: #7d1f1a;
4296
+ }
4297
+ .wa-template__retry {
4298
+ padding: 4px 12px;
4299
+ border: 1px solid #F0C9C5;
4300
+ border-radius: 999px;
4301
+ font: inherit;
4302
+ font-size: 12px;
4303
+ color: #D93025;
4304
+ background: #ffffff;
4305
+ cursor: pointer;
4306
+ }
4307
+ .wa-template__sent {
4308
+ margin: 0;
4309
+ font-size: 12px;
4310
+ color: #1E7F4F;
4311
+ }
4312
+ .wa-template__footer {
4313
+ display: flex;
4314
+ align-items: center;
4315
+ justify-content: space-between;
4316
+ gap: 8px;
4317
+ }
4318
+ .wa-template__hint {
4319
+ margin-right: auto;
4320
+ min-width: 0;
4321
+ font-size: 10.5px;
4322
+ color: #9AA1AE;
4323
+ }
4324
+
3964
4325
  /* El envío que no salió: el porqué y qué se puede hacer, junto a la caja donde se escribió. */
3965
4326
  .wa-composer__failures {
3966
4327
  display: flex;
@@ -4863,6 +5224,338 @@ function useSuggestion({ fetcher, phone, messages, outgoing = [], onPrefill }) {
4863
5224
  };
4864
5225
  }
4865
5226
  //#endregion
5227
+ //#region src/core/thread/TemplateStartPanel.tsx
5228
+ /**
5229
+ * «Iniciar con plantilla» (DEV-8758) — el composer cuando WhatsApp sólo deja escribir con una
5230
+ * plantilla aprobada: ventana de 24 h cerrada (tablero 391) o sin hilo (tablero 392).
5231
+ *
5232
+ * DEV-8832 (tablero 393) rehízo el formulario para que el operador lo entienda: un chip por acción
5233
+ * en vez del selector técnico, sin pedir lo que el host ya sabe (el primer nombre) y con la vista
5234
+ * previa obligatoria de lo que le llega a la persona.
5235
+ *
5236
+ * Presentacional: qué modo se pinta lo decide `templateOffer` y la red vive en `useTemplateStart`.
5237
+ * Interno del hilo — NO sale al barrel (mismo criterio que `Composer`).
5238
+ *
5239
+ * 🔴 Todo lo que viene del store (`label`, `body_text`) y el nombre del contacto entran como hijos
5240
+ * de texto, que React escapa. Nada de `dangerouslySetInnerHTML`.
5241
+ */
5242
+ /** La clave estable de una plantilla: el mismo nombre puede existir en dos idiomas. */
5243
+ function templateKey(option) {
5244
+ return `${option.name}#${option.language}`;
5245
+ }
5246
+ /** La etiqueta de un parámetro que se pide, sin el marcador técnico (D-2). */
5247
+ function askedParamLabel(index) {
5248
+ return index === 0 ? "Nombre de la persona" : `Dato ${index + 1}`;
5249
+ }
5250
+ function TemplateStartPanel({ mode, start, noThread, phone, contactName, senderLabel }) {
5251
+ const chipsLabelId = useId();
5252
+ const items = start.response?.items ?? [];
5253
+ /** La acción que tocó el operador (`templateKey`). Con una sola plantilla no hace falta tocar. */
5254
+ const [picked, setPicked] = useState(null);
5255
+ /** Lo que tipeó el operador, por plantilla: cambiar de acción no mezcla parámetros. */
5256
+ const [typed, setTyped] = useState({});
5257
+ if (mode === "none") return null;
5258
+ const template = items.length === 1 ? items[0] ?? null : items.find((item) => templateKey(item) === picked) ?? null;
5259
+ const key = template !== null ? templateKey(template) : "";
5260
+ const host = hostTemplateParams(template?.body_param_count ?? 0, contactName);
5261
+ const typedForTemplate = typed[key] ?? [];
5262
+ const params = host.values.map((value, index) => host.asked.includes(index) ? typedForTemplate[index] ?? "" : value);
5263
+ const sending = start.sendState === "sending";
5264
+ const canSend = mode === "form" && !sending && canSendTemplate(template, params);
5265
+ const preview = template !== null ? renderTemplatePreview(template.body_text, params) : null;
5266
+ const recipient = firstName$1(contactName);
5267
+ const setParam = (index, value) => {
5268
+ const next = [...typedForTemplate];
5269
+ next[index] = value;
5270
+ setTyped({
5271
+ ...typed,
5272
+ [key]: next
5273
+ });
5274
+ };
5275
+ const submit = () => {
5276
+ if (!canSend || template === null) return;
5277
+ start.send(template.name, template.language, params);
5278
+ };
5279
+ return /* @__PURE__ */ jsxs("div", {
5280
+ className: "wa-template",
5281
+ "data-mode": mode,
5282
+ children: [
5283
+ noThread ? /* @__PURE__ */ jsxs("div", {
5284
+ className: "wa-template__route",
5285
+ children: [/* @__PURE__ */ jsxs("p", {
5286
+ className: "wa-template__route-line",
5287
+ children: [
5288
+ /* @__PURE__ */ jsx("span", {
5289
+ className: "wa-template__route-key",
5290
+ children: "Para:"
5291
+ }),
5292
+ " ",
5293
+ phone,
5294
+ contactName !== null && ` · ${contactName}`
5295
+ ]
5296
+ }), senderLabel !== null && /* @__PURE__ */ jsxs("p", {
5297
+ className: "wa-template__route-line",
5298
+ children: [
5299
+ /* @__PURE__ */ jsx("span", {
5300
+ className: "wa-template__route-key",
5301
+ children: "Desde:"
5302
+ }),
5303
+ " ",
5304
+ senderLabel
5305
+ ]
5306
+ })]
5307
+ }) : /* @__PURE__ */ jsx("p", {
5308
+ className: "wa-template__notice",
5309
+ role: "status",
5310
+ children: "La ventana de 24 h está cerrada: solo se puede escribir con una plantilla aprobada. Al enviarla, el bot se pausa."
5311
+ }),
5312
+ mode === "loading" && /* @__PURE__ */ jsx("p", {
5313
+ className: "wa-template__note",
5314
+ children: "Cargando plantillas…"
5315
+ }),
5316
+ mode === "unavailable" && /* @__PURE__ */ jsxs("div", {
5317
+ className: "wa-template__note",
5318
+ role: "alert",
5319
+ children: [
5320
+ "No se pudieron cargar las plantillas.",
5321
+ " ",
5322
+ /* @__PURE__ */ jsx("button", {
5323
+ type: "button",
5324
+ className: "wa-template__link",
5325
+ onClick: start.reloadTemplates,
5326
+ children: "Reintentar"
5327
+ })
5328
+ ]
5329
+ }),
5330
+ mode === "read_only" && /* @__PURE__ */ jsx("p", {
5331
+ className: "wa-template__note",
5332
+ children: "Tu rol puede ver conversaciones, pero no iniciarlas."
5333
+ }),
5334
+ mode === "no_templates" && /* @__PURE__ */ jsx("p", {
5335
+ className: "wa-template__note",
5336
+ children: "No hay plantillas habilitadas para este número."
5337
+ }),
5338
+ mode === "form" && /* @__PURE__ */ jsxs("form", {
5339
+ className: "wa-template__form",
5340
+ onSubmit: (event) => {
5341
+ event.preventDefault();
5342
+ submit();
5343
+ },
5344
+ children: [
5345
+ /* @__PURE__ */ jsxs("div", {
5346
+ className: "wa-template__field",
5347
+ children: [/* @__PURE__ */ jsx("span", {
5348
+ className: "wa-template__label",
5349
+ id: chipsLabelId,
5350
+ children: "¿Qué quieres hacer?"
5351
+ }), /* @__PURE__ */ jsx("div", {
5352
+ className: "wa-template__chips",
5353
+ role: "group",
5354
+ "aria-labelledby": chipsLabelId,
5355
+ children: items.map((item) => {
5356
+ const itemKey = templateKey(item);
5357
+ const pressed = template !== null && templateKey(template) === itemKey;
5358
+ return /* @__PURE__ */ jsxs("button", {
5359
+ type: "button",
5360
+ className: "wa-template__chip",
5361
+ "aria-pressed": pressed,
5362
+ disabled: sending,
5363
+ onClick: () => setPicked(itemKey),
5364
+ children: [pressed && /* @__PURE__ */ jsx("svg", {
5365
+ className: "wa-template__chip-check",
5366
+ viewBox: "0 0 16 16",
5367
+ "aria-hidden": "true",
5368
+ focusable: "false",
5369
+ children: /* @__PURE__ */ jsx("path", {
5370
+ d: "M3.5 8.5l3 3 6-7",
5371
+ fill: "none",
5372
+ stroke: "currentColor",
5373
+ strokeWidth: "2",
5374
+ strokeLinecap: "round",
5375
+ strokeLinejoin: "round"
5376
+ })
5377
+ }), item.label ?? item.name]
5378
+ }, itemKey);
5379
+ })
5380
+ })]
5381
+ }),
5382
+ template !== null && template.body_text === null && /* @__PURE__ */ jsx("p", {
5383
+ className: "wa-template__note",
5384
+ role: "status",
5385
+ children: "Esta acción no está disponible en este número"
5386
+ }),
5387
+ template !== null && template.body_text !== null && host.asked.map((index) => /* @__PURE__ */ jsxs("label", {
5388
+ className: "wa-template__field",
5389
+ children: [/* @__PURE__ */ jsx("span", {
5390
+ className: "wa-template__label",
5391
+ children: askedParamLabel(index)
5392
+ }), /* @__PURE__ */ jsx("input", {
5393
+ className: "wa-template__input",
5394
+ value: typedForTemplate[index] ?? "",
5395
+ maxLength: 1024,
5396
+ disabled: sending,
5397
+ onChange: (event) => setParam(index, event.target.value)
5398
+ })]
5399
+ }, index)),
5400
+ preview !== null && /* @__PURE__ */ jsxs("div", {
5401
+ className: "wa-template__field",
5402
+ children: [
5403
+ /* @__PURE__ */ jsx("span", {
5404
+ className: "wa-template__preview-label",
5405
+ children: recipient !== "" ? `Así le llega a ${recipient}` : "Así le llega"
5406
+ }),
5407
+ /* @__PURE__ */ jsx("div", {
5408
+ className: "wa-template__preview",
5409
+ children: /* @__PURE__ */ jsx("p", {
5410
+ className: "wa-template__preview-body",
5411
+ children: preview
5412
+ })
5413
+ }),
5414
+ /* @__PURE__ */ jsx("p", {
5415
+ className: "wa-template__preview-note",
5416
+ children: "Mensaje aprobado por WhatsApp"
5417
+ })
5418
+ ]
5419
+ }),
5420
+ start.sendState === "error" && start.failure !== null && /* @__PURE__ */ jsxs("div", {
5421
+ className: "wa-template__error",
5422
+ role: "alert",
5423
+ children: [/* @__PURE__ */ jsx("p", {
5424
+ className: "wa-template__error-text",
5425
+ children: sendFailureCopy(start.failure)
5426
+ }), start.failure.retryable && /* @__PURE__ */ jsx("button", {
5427
+ type: "button",
5428
+ className: "wa-template__retry",
5429
+ onClick: submit,
5430
+ children: "Reintentar"
5431
+ })]
5432
+ }),
5433
+ start.sendState === "sent" && /* @__PURE__ */ jsx("p", {
5434
+ className: "wa-template__sent",
5435
+ role: "status",
5436
+ children: "Mensaje enviado. El bot quedó en pausa."
5437
+ }),
5438
+ /* @__PURE__ */ jsxs("div", {
5439
+ className: "wa-template__footer",
5440
+ children: [/* @__PURE__ */ jsx("span", {
5441
+ className: "wa-template__hint",
5442
+ children: "Se envía a tu nombre · pausa el bot"
5443
+ }), /* @__PURE__ */ jsx("button", {
5444
+ type: "submit",
5445
+ className: "wa-composer__send",
5446
+ disabled: !canSend,
5447
+ children: sending ? "Enviando…" : "Enviar mensaje"
5448
+ })]
5449
+ })
5450
+ ]
5451
+ })
5452
+ ]
5453
+ });
5454
+ }
5455
+ //#endregion
5456
+ //#region src/core/thread/useTemplateStart.ts
5457
+ /**
5458
+ * El estado de «Iniciar con plantilla» (DEV-8758): la lista de plantillas del número y el envío.
5459
+ *
5460
+ * Mismo molde que `useThread`/`useComposer` (DEC-G): lo cargado se guarda JUNTO con de qué
5461
+ * consulta vino (`fetcher` + `phone`), y "estoy pidiendo otra cosa" se DERIVA en el render — nada
5462
+ * de `setState` síncrono dentro de un efecto.
5463
+ *
5464
+ * La lista se pide sólo con `active` (ventana cerrada con permiso de escritura, o sin hilo): con la
5465
+ * ventana abierta no hay por qué molestar al store.
5466
+ *
5467
+ * 🔴 Sin `console.*`: los parámetros llevan el nombre del lifter y el teléfono es dato personal.
5468
+ */
5469
+ function useTemplateStart({ fetcher, phone, active, onStarted }) {
5470
+ const [attempt, setAttempt] = useState(0);
5471
+ const [loaded, setLoaded] = useState(null);
5472
+ const [outcome, setOutcome] = useState(null);
5473
+ const onStartedRef = useRef(onStarted);
5474
+ useEffect(() => {
5475
+ onStartedRef.current = onStarted;
5476
+ }, [onStarted]);
5477
+ useEffect(() => {
5478
+ if (!active) return;
5479
+ const controller = new AbortController();
5480
+ loadTemplates(fetcher, { signal: controller.signal }).then((response) => {
5481
+ if (controller.signal.aborted) return;
5482
+ setLoaded({
5483
+ fetcher,
5484
+ phone,
5485
+ attempt,
5486
+ response,
5487
+ failed: false
5488
+ });
5489
+ }, () => {
5490
+ if (controller.signal.aborted) return;
5491
+ setLoaded({
5492
+ fetcher,
5493
+ phone,
5494
+ attempt,
5495
+ response: null,
5496
+ failed: true
5497
+ });
5498
+ });
5499
+ return () => controller.abort();
5500
+ }, [
5501
+ active,
5502
+ fetcher,
5503
+ phone,
5504
+ attempt
5505
+ ]);
5506
+ const current = loaded !== null && loaded.fetcher === fetcher && loaded.phone === phone && loaded.attempt === attempt ? loaded : null;
5507
+ let templates;
5508
+ if (!active) templates = { status: "idle" };
5509
+ else if (current === null) templates = { status: "loading" };
5510
+ else if (current.failed || current.response === null) templates = { status: "error" };
5511
+ else templates = {
5512
+ status: "ready",
5513
+ canStart: current.response.can_start,
5514
+ itemCount: current.response.items.length
5515
+ };
5516
+ const currentOutcome = outcome !== null && outcome.fetcher === fetcher && outcome.phone === phone ? outcome : null;
5517
+ const send = useCallback((templateName, language, bodyParams) => {
5518
+ const clientMessageId = newClientMessageId();
5519
+ setOutcome({
5520
+ fetcher,
5521
+ phone,
5522
+ state: "sending",
5523
+ failure: null
5524
+ });
5525
+ startConversation(fetcher, {
5526
+ phone,
5527
+ templateName,
5528
+ language,
5529
+ bodyParams: bodyParams.map((value) => value.trim()),
5530
+ clientMessageId
5531
+ }).then(() => {
5532
+ setOutcome({
5533
+ fetcher,
5534
+ phone,
5535
+ state: "sent",
5536
+ failure: null
5537
+ });
5538
+ onStartedRef.current?.();
5539
+ }, (cause) => {
5540
+ setOutcome({
5541
+ fetcher,
5542
+ phone,
5543
+ state: "error",
5544
+ failure: readSendError(cause)
5545
+ });
5546
+ });
5547
+ }, [fetcher, phone]);
5548
+ const reloadTemplates = useCallback(() => setAttempt((value) => value + 1), []);
5549
+ return {
5550
+ templates,
5551
+ response: templates.status === "ready" && current !== null ? current.response : null,
5552
+ sendState: currentOutcome?.state ?? "idle",
5553
+ failure: currentOutcome?.failure ?? null,
5554
+ send,
5555
+ reloadTemplates
5556
+ };
5557
+ }
5558
+ //#endregion
4866
5559
  //#region src/core/thread/useThread.ts
4867
5560
  /**
4868
5561
  * El estado del hilo de conversación: pide el hilo por el `fetcher` del host y sostiene los estados
@@ -5391,7 +6084,7 @@ function firstName(takenBy) {
5391
6084
  const first = typeof takenBy === "string" ? takenBy.trim().split(/\s+/)[0] : "";
5392
6085
  return first !== void 0 && first !== "" ? first : "Otra persona";
5393
6086
  }
5394
- function ConversationThread({ fetcher, phone, displayName, refreshIntervalMs, saveDocument, className }) {
6087
+ function ConversationThread({ fetcher, phone, displayName, refreshIntervalMs, saveDocument, senderLabel = null, className }) {
5395
6088
  const { messages: serverMessages, status, error, windowState, canReply, takenBy, takenUntil, takenByMe, takenAt, takenByRole, hasOlder, loadOlder, retry, refresh } = useThread({
5396
6089
  fetcher,
5397
6090
  phone,
@@ -5529,6 +6222,33 @@ function ConversationThread({ fetcher, phone, displayName, refreshIntervalMs, sa
5529
6222
  * se ofrece; el bloqueo por ventana sigue mandando.
5530
6223
  */
5531
6224
  const hasComposer = canReply && composer.windowState !== "closed";
6225
+ /**
6226
+ * DEV-8758 — «Iniciar con plantilla». Sin hilo (el 404 genérico del store) o con la ventana
6227
+ * cerrada y permiso de escritura, WhatsApp sólo deja escribir con una plantilla. Tras el envío el
6228
+ * hilo se vuelve a leer: sin hilo, entero (`retry`, ahora sí existe); con hilo, el latido
6229
+ * (`refresh`), que trae la burbuja y la barra «Bot en pausa».
6230
+ */
6231
+ const noThread = status === "error" && serverMessages.length === 0 && isNoThreadError(error);
6232
+ const templateStart = useTemplateStart({
6233
+ fetcher,
6234
+ phone,
6235
+ active: noThread || canReply && composer.windowState === "closed",
6236
+ onStarted: noThread ? retry : refresh
6237
+ });
6238
+ const offer = templateOffer({
6239
+ noThread,
6240
+ windowState: composer.windowState,
6241
+ canReply,
6242
+ templates: templateStart.templates
6243
+ });
6244
+ const templatePanel = offer === "none" ? null : /* @__PURE__ */ jsx(TemplateStartPanel, {
6245
+ mode: offer,
6246
+ start: templateStart,
6247
+ noThread,
6248
+ phone,
6249
+ contactName: typeof displayName === "string" && displayName.trim() !== "" ? displayName : null,
6250
+ senderLabel
6251
+ });
5532
6252
  const messagesRef = useRef(null);
5533
6253
  /** De qué consulta ya se hizo el scroll inicial: una vez por hilo, no en cada página. */
5534
6254
  const scrolledForRef = useRef(null);
@@ -5587,7 +6307,7 @@ function ConversationThread({ fetcher, phone, displayName, refreshIntervalMs, sa
5587
6307
  className: "wa-thread__note",
5588
6308
  children: "Cargando conversación…"
5589
6309
  }),
5590
- error !== null && /* @__PURE__ */ jsxs("div", {
6310
+ error !== null && !noThread && /* @__PURE__ */ jsxs("div", {
5591
6311
  className: "wa-thread__error",
5592
6312
  role: "alert",
5593
6313
  children: [/* @__PURE__ */ jsxs("p", { children: ["No se pudo cargar la conversación: ", error.message] }), /* @__PURE__ */ jsx("button", {
@@ -5602,70 +6322,87 @@ function ConversationThread({ fetcher, phone, displayName, refreshIntervalMs, sa
5602
6322
  }),
5603
6323
  /* @__PURE__ */ jsxs("div", {
5604
6324
  className: "wa-thread__header",
5605
- children: [/* @__PURE__ */ jsxs("div", {
5606
- className: "wa-thread__identity",
5607
- children: [/* @__PURE__ */ jsx("span", {
5608
- className: "wa-thread__avatar",
5609
- "aria-hidden": "true",
5610
- children: initials(name, phone)
5611
- }), /* @__PURE__ */ jsxs("span", {
5612
- className: "wa-thread__who",
6325
+ children: [
6326
+ /* @__PURE__ */ jsxs("div", {
6327
+ className: "wa-thread__identity",
5613
6328
  children: [/* @__PURE__ */ jsx("span", {
5614
- className: "wa-thread__name",
5615
- children: name ?? phone
5616
- }), name !== null && /* @__PURE__ */ jsx("span", {
5617
- className: "wa-thread__phone",
5618
- children: phone
6329
+ className: "wa-thread__avatar",
6330
+ "aria-hidden": "true",
6331
+ children: initials(name, phone)
6332
+ }), /* @__PURE__ */ jsxs("span", {
6333
+ className: "wa-thread__who",
6334
+ children: [/* @__PURE__ */ jsx("span", {
6335
+ className: "wa-thread__name",
6336
+ children: name ?? phone
6337
+ }), name !== null && /* @__PURE__ */ jsx("span", {
6338
+ className: "wa-thread__phone",
6339
+ children: phone
6340
+ })]
5619
6341
  })]
5620
- })]
5621
- }), currentStep !== null && /* @__PURE__ */ jsx("div", {
5622
- className: "wa-thread__chips",
5623
- children: /* @__PURE__ */ jsxs("span", {
5624
- className: "wa-thread__step",
5625
- title: currentStep,
5626
- children: ["Paso: ", serviceStateLabel(currentStep)]
6342
+ }),
6343
+ noThread && /* @__PURE__ */ jsx("div", {
6344
+ className: "wa-thread__chips",
6345
+ children: /* @__PURE__ */ jsx("span", {
6346
+ className: "wa-thread__step",
6347
+ children: "Sin conversación"
6348
+ })
6349
+ }),
6350
+ currentStep !== null && /* @__PURE__ */ jsx("div", {
6351
+ className: "wa-thread__chips",
6352
+ children: /* @__PURE__ */ jsxs("span", {
6353
+ className: "wa-thread__step",
6354
+ title: currentStep,
6355
+ children: ["Paso: ", serviceStateLabel(currentStep)]
6356
+ })
5627
6357
  })
5628
- })]
6358
+ ]
5629
6359
  }),
5630
6360
  /* @__PURE__ */ jsxs("div", {
5631
6361
  className: "wa-thread__messages",
5632
6362
  ref: messagesRef,
5633
- children: [hasOlder && /* @__PURE__ */ jsx("button", {
5634
- ref: sentinel,
5635
- type: "button",
5636
- className: "wa-thread__older",
5637
- onClick: handleLoadOlder,
5638
- disabled: status === "loading-older",
5639
- children: status === "loading-older" ? "Cargando…" : "Cargar mensajes anteriores"
5640
- }), groups.map((group, groupIndex) => /* @__PURE__ */ jsxs("div", {
5641
- className: "wa-thread__group",
5642
- children: [group.label !== null && /* @__PURE__ */ jsx("div", {
5643
- className: "wa-thread__day",
5644
- children: group.label
5645
- }), group.items.map(({ message, position }) => /* @__PURE__ */ jsxs(Fragment, { children: [showServiceState[position] && typeof message.service_state === "string" && message.service_state !== "" && /* @__PURE__ */ jsxs("div", {
5646
- className: "wa-thread__flow-pill",
5647
- children: ["El flujo pasó a ", serviceStateLabel(message.service_state)]
5648
- }), isSuggestion(message) ? /* @__PURE__ */ jsx(SuggestionBubble, {
5649
- message,
5650
- canDiscard: canReply,
5651
- state: suggestion.state,
5652
- error: suggestion.error,
5653
- onDiscard: suggestion.discard,
5654
- canUse: canReply && composer.windowState !== "closed",
5655
- armed: suggestion.armed,
5656
- onUse: suggestion.use,
5657
- onDisarm: suggestion.disarm
5658
- }) : /* @__PURE__ */ jsx(MessageBubble, {
5659
- message,
5660
- optimistic: optimistic.has(message),
5661
- fetcher,
5662
- savedDocument: savedDocumentMark(message, saveDocument),
5663
- onSaveAsDocument: canSaveAsDocument(message, saveDocument) ? () => setSaveTarget({
6363
+ children: [
6364
+ noThread && /* @__PURE__ */ jsx("p", {
6365
+ className: "wa-thread__note",
6366
+ children: "Todavía no hay conversación con este número."
6367
+ }),
6368
+ hasOlder && /* @__PURE__ */ jsx("button", {
6369
+ ref: sentinel,
6370
+ type: "button",
6371
+ className: "wa-thread__older",
6372
+ onClick: handleLoadOlder,
6373
+ disabled: status === "loading-older",
6374
+ children: status === "loading-older" ? "Cargando…" : "Cargar mensajes anteriores"
6375
+ }),
6376
+ groups.map((group, groupIndex) => /* @__PURE__ */ jsxs("div", {
6377
+ className: "wa-thread__group",
6378
+ children: [group.label !== null && /* @__PURE__ */ jsx("div", {
6379
+ className: "wa-thread__day",
6380
+ children: group.label
6381
+ }), group.items.map(({ message, position }) => /* @__PURE__ */ jsxs(Fragment, { children: [showServiceState[position] && typeof message.service_state === "string" && message.service_state !== "" && /* @__PURE__ */ jsxs("div", {
6382
+ className: "wa-thread__flow-pill",
6383
+ children: ["El flujo pasó a ", serviceStateLabel(message.service_state)]
6384
+ }), isSuggestion(message) ? /* @__PURE__ */ jsx(SuggestionBubble, {
6385
+ message,
6386
+ canDiscard: canReply,
6387
+ state: suggestion.state,
6388
+ error: suggestion.error,
6389
+ onDiscard: suggestion.discard,
6390
+ canUse: canReply && composer.windowState !== "closed",
6391
+ armed: suggestion.armed,
6392
+ onUse: suggestion.use,
6393
+ onDisarm: suggestion.disarm
6394
+ }) : /* @__PURE__ */ jsx(MessageBubble, {
5664
6395
  message,
5665
- phone
5666
- }) : void 0
5667
- })] }, message.id ?? `sin-wamid-${position}`))]
5668
- }, group.key ?? `sin-dia-${groupIndex}`))]
6396
+ optimistic: optimistic.has(message),
6397
+ fetcher,
6398
+ savedDocument: savedDocumentMark(message, saveDocument),
6399
+ onSaveAsDocument: canSaveAsDocument(message, saveDocument) ? () => setSaveTarget({
6400
+ message,
6401
+ phone
6402
+ }) : void 0
6403
+ })] }, message.id ?? `sin-wamid-${position}`))]
6404
+ }, group.key ?? `sin-dia-${groupIndex}`))
6405
+ ]
5669
6406
  }),
5670
6407
  /* @__PURE__ */ jsx(TakeoverBar, {
5671
6408
  takenBy,
@@ -5685,7 +6422,12 @@ function ConversationThread({ fetcher, phone, displayName, refreshIntervalMs, sa
5685
6422
  prefill,
5686
6423
  locked: foreignLive && !unlocked,
5687
6424
  takeoverNotice: foreignLive && unlocked ? `${firstName(takenBy)} está atendiendo · el lifter verá a dos personas` : null,
5688
- focusRequest: unlocked && writeAnyway !== null ? writeAnyway.focus : null
6425
+ focusRequest: unlocked && writeAnyway !== null ? writeAnyway.focus : null,
6426
+ templateStart: !noThread && offer === "form" ? templatePanel : null
6427
+ }),
6428
+ noThread && templatePanel !== null && /* @__PURE__ */ jsx("div", {
6429
+ className: "wa-composer wa-composer--template",
6430
+ children: templatePanel
5689
6431
  }),
5690
6432
  showSaveDialog && saveDocument !== void 0 && saveTarget !== null && /* @__PURE__ */ jsx(SaveDocumentDialog, {
5691
6433
  message: saveTarget.message,
@@ -5780,7 +6522,7 @@ const SHELL_CSS = `
5780
6522
  color: #8A91A0;
5781
6523
  }
5782
6524
  `;
5783
- function WaConversations({ fetcher, initialPhone, pinned = false, refreshIntervalMs, saveDocument, className }) {
6525
+ function WaConversations({ fetcher, initialPhone, pinned = false, refreshIntervalMs, saveDocument, contactName, senderLabel, className }) {
5784
6526
  /**
5785
6527
  * El layout lo decide el ancho de ESTE contenedor, no el del viewport: el visor va embebido
5786
6528
  * (en lms-web-app vive dentro del layout del LMS, no a pantalla completa).
@@ -5801,7 +6543,7 @@ function WaConversations({ fetcher, initialPhone, pinned = false, refreshInterva
5801
6543
  * `initialPhone` siembra SÓLO el teléfono: sin summary no hay nombre que sembrar y no se
5802
6544
  * inventa uno. El header cae al teléfono, como la fila de la lista.
5803
6545
  */
5804
- const [selectedName, setSelectedName] = useState(null);
6546
+ const [selectedName, setSelectedName] = useState(initialPhone !== void 0 && typeof contactName === "string" && contactName.trim() !== "" ? contactName : null);
5805
6547
  const rootClass = className ? `wa-conversations ${className}` : "wa-conversations";
5806
6548
  if (fetcher === void 0) return /* @__PURE__ */ jsx("div", {
5807
6549
  className: rootClass,
@@ -5838,7 +6580,8 @@ function WaConversations({ fetcher, initialPhone, pinned = false, refreshInterva
5838
6580
  phone: selectedPhone,
5839
6581
  displayName: selectedName,
5840
6582
  refreshIntervalMs,
5841
- saveDocument: anchored ? saveDocument : void 0
6583
+ saveDocument: anchored ? saveDocument : void 0,
6584
+ senderLabel: senderLabel ?? null
5842
6585
  })]
5843
6586
  }) : layout === "wide" && /* @__PURE__ */ jsx("p", {
5844
6587
  className: "wa-conversations__empty",
@@ -5868,4 +6611,4 @@ const WA_CONVERSATIONS_TAG = "wa-conversations";
5868
6611
  */
5869
6612
  const SAVE_DOCUMENT_EVENT = "wa-conversations:save-document";
5870
6613
  //#endregion
5871
- export { ConversationList, ConversationThread, DEFAULT_REFRESH_INTERVAL_MS, NARROW_MAX_WIDTH, REPLY_TEXT_MAX_LENGTH, SAVE_DOCUMENT_EVENT, SUGGESTION_STATUS, WA_CONVERSATIONS_TAG, WaConversations, WaFetchError, dedupeByWamid, discardSuggestion, isCtaLink, isSuggestion, loadConversations, loadThread, mergeThread, mergeThreadPage, newClientMessageId, normalizeReplyMessage, normalizeWindowState, readSendError, releaseConversation, sendFailureCopy, sendReply, threadCtas, useComposer, useContainerLayout, useConversations, useSuggestion, useThread };
6614
+ export { ConversationList, ConversationThread, DEFAULT_REFRESH_INTERVAL_MS, NARROW_MAX_WIDTH, REPLY_TEXT_MAX_LENGTH, SAVE_DOCUMENT_EVENT, SUGGESTION_STATUS, WA_CONVERSATIONS_TAG, WaConversations, WaFetchError, canSendTemplate, dedupeByWamid, discardSuggestion, hostTemplateParams, isCtaLink, isNoThreadError, isSuggestion, loadConversations, loadTemplates, loadThread, mergeThread, mergeThreadPage, newClientMessageId, normalizeReplyMessage, normalizeStartResponse, normalizeTemplates, normalizeWindowState, readSendError, releaseConversation, renderTemplatePreview, sendFailureCopy, sendReply, startConversation, templateOffer, templateParamsValid, threadCtas, useComposer, useContainerLayout, useConversations, useSuggestion, useThread };