@bikdotai/bik-component-library 0.0.838-beta.2 → 0.0.838-beta.3

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.
Files changed (26) hide show
  1. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +23 -23
  2. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/components/AiTextArea.js +1 -1
  4. package/dist/cjs/components/agent-builder/components/AiTextArea.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +2 -2
  6. package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
  7. package/dist/cjs/components/bik-chatbot/components/ChatWindow.js +20 -20
  8. package/dist/cjs/components/bik-chatbot/components/ChatWindow.js.map +1 -1
  9. package/dist/cjs/editor/BikEditor.js +1 -1
  10. package/dist/cjs/editor/BikEditor.js.map +1 -1
  11. package/dist/cjs/editor/BikEditor.utils.js +3 -3
  12. package/dist/cjs/editor/BikEditor.utils.js.map +1 -1
  13. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +144 -143
  14. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
  15. package/dist/esm/components/agent-builder/components/AiTextArea.js +24 -23
  16. package/dist/esm/components/agent-builder/components/AiTextArea.js.map +1 -1
  17. package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +31 -30
  18. package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
  19. package/dist/esm/components/bik-chatbot/components/ChatWindow.js +54 -53
  20. package/dist/esm/components/bik-chatbot/components/ChatWindow.js.map +1 -1
  21. package/dist/esm/editor/BikEditor.js +122 -118
  22. package/dist/esm/editor/BikEditor.js.map +1 -1
  23. package/dist/esm/editor/BikEditor.utils.d.ts +1 -1
  24. package/dist/esm/editor/BikEditor.utils.js +111 -111
  25. package/dist/esm/editor/BikEditor.utils.js.map +1 -1
  26. package/package.json +1 -1
@@ -1,30 +1,31 @@
1
- import { jsxs as h, jsx as n, Fragment as Ne } from "react/jsx-runtime";
2
- import Ue from "../../assets/icons/check.svg.js";
3
- import ze from "../../assets/icons/chevronLeft.svg.js";
4
- import Ge from "../../assets/icons/chevronRight.svg.js";
5
- import je from "../../assets/icons/cross.svg.js";
6
- import We from "../../assets/icons/edit.svg.js";
7
- import Xe from "../../assets/icons/info.svg.js";
8
- import Ye from "../../assets/icons/rewind.svg.js";
9
- import Je from "../../assets/icons/thumb-down-line.svg.js";
10
- import Qe from "../../assets/icons/thumb-up-line.svg.js";
11
- import { BaseWhatsappContentLangHelper as Ze } from "../../helpers/BaseWhatsappContentLang.helper.js";
12
- import qe, { useRef as f, useState as S, useMemo as L, useEffect as _, useCallback as E, useImperativeHandle as Ve } from "react";
13
- import a, { keyframes as Ke } from "styled-components";
1
+ import { jsxs as h, jsx as n, Fragment as Ue } from "react/jsx-runtime";
2
+ import ze from "../../assets/icons/check.svg.js";
3
+ import Ge from "../../assets/icons/chevronLeft.svg.js";
4
+ import je from "../../assets/icons/chevronRight.svg.js";
5
+ import We from "../../assets/icons/cross.svg.js";
6
+ import Xe from "../../assets/icons/edit.svg.js";
7
+ import Ye from "../../assets/icons/info.svg.js";
8
+ import Je from "../../assets/icons/rewind.svg.js";
9
+ import Qe from "../../assets/icons/thumb-down-line.svg.js";
10
+ import Ze from "../../assets/icons/thumb-up-line.svg.js";
11
+ import { BaseWhatsappContentLangHelper as qe } from "../../helpers/BaseWhatsappContentLang.helper.js";
12
+ import { stripHtmlTags as ge } from "../../helpers/sanitize.js";
13
+ import Ve, { useRef as f, useState as S, useMemo as L, useEffect as _, useCallback as E, useImperativeHandle as Ke } from "react";
14
+ import a, { keyframes as tn } from "styled-components";
14
15
  import { COLORS as i } from "../../constants/Theme.js";
15
16
  import { Tooltip as it } from "../tooltips/Tooltip.js";
16
- import { TitleSmall as tn, BodyCaption as ge } from "../TypographyStyle.js";
17
- import { resolveActionPrompts as en, DEFAULT_INSTRUCTION_SUGGESTIONS as nn, DEFAULT_AI_ACTION_MIN_CHARS as pt } from "./ai/actionRegistry.js";
18
- import { computeAiTagOnPostEdit as rn, computeAiTagOnAccept as on } from "./ai/aiTag.js";
19
- import { AI_TAG_CHANGE_RATIO_THRESHOLD as sr, levenshteinDistance as lr } from "./ai/aiTag.js";
20
- import { buildActionPrompt as cn, requestAISuggestion as sn } from "./ai/api.js";
21
- import { OuterContainer as ln, EditorFooterRow as an, EditorFooterTitle as un, EditorFooterRight as dn, Container as gn, TextSpace as hn } from "./CustomEditor.styled.js";
22
- import { AIEditorActionTypes as p, AIActionVariant as mt, WhatsAppTextEditorHeader as fn, EditorActionTypes as kt } from "./WhatsAppTextEditorHeader.js";
23
- const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn = 1e3, bn = "Rephrase this WhatsApp utility template to improve clarity and readability while preserving variables, intent, and compliance.", be = Ke`
17
+ import { TitleSmall as en, BodyCaption as he } from "../TypographyStyle.js";
18
+ import { resolveActionPrompts as nn, DEFAULT_INSTRUCTION_SUGGESTIONS as rn, DEFAULT_AI_ACTION_MIN_CHARS as pt } from "./ai/actionRegistry.js";
19
+ import { computeAiTagOnPostEdit as on, computeAiTagOnAccept as cn } from "./ai/aiTag.js";
20
+ import { AI_TAG_CHANGE_RATIO_THRESHOLD as ar, levenshteinDistance as ur } from "./ai/aiTag.js";
21
+ import { buildActionPrompt as sn, requestAISuggestion as ln } from "./ai/api.js";
22
+ import { OuterContainer as an, EditorFooterRow as un, EditorFooterTitle as dn, EditorFooterRight as gn, Container as hn, TextSpace as fn } from "./CustomEditor.styled.js";
23
+ import { AIEditorActionTypes as p, AIActionVariant as mt, WhatsAppTextEditorHeader as pn, EditorActionTypes as kt } from "./WhatsAppTextEditorHeader.js";
24
+ const Ht = "Character limit reached", fe = 3e3, mn = 5, pe = 3, me = 1200, bn = 1e3, xn = "Rephrase this WhatsApp utility template to improve clarity and readability while preserving variables, intent, and compliance.", xe = tn`
24
25
  0% { opacity: 0.55; }
25
26
  50% { opacity: 1; }
26
27
  100% { opacity: 0.55; }
27
- `, xn = a.div`
28
+ `, Sn = a.div`
28
29
  padding: 14px 12px;
29
30
  display: flex;
30
31
  flex-direction: column;
@@ -35,8 +36,8 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
35
36
  border-radius: 6px;
36
37
  width: ${(g) => g.width};
37
38
  background: #ececef;
38
- animation: ${be} 1.1s ease-in-out infinite;
39
- `, Sn = a.div`
39
+ animation: ${xe} 1.1s ease-in-out infinite;
40
+ `, Rn = a.div`
40
41
  padding: 12px;
41
42
  display: flex;
42
43
  flex-direction: column;
@@ -55,22 +56,22 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
55
56
  ::-webkit-scrollbar-track {
56
57
  background: transparent;
57
58
  }
58
- `, Rn = a.div`
59
+ `, En = a.div`
59
60
  text-decoration: line-through;
60
61
  color: ${i.content.secondary};
61
- `, me = a.div`
62
+ `, be = a.div`
62
63
  color: ${i.content.primary};
63
- `, En = a.div`
64
+ `, vn = a.div`
64
65
  display: flex;
65
66
  flex-direction: column;
66
67
  gap: 8px;
67
68
  width: 100%;
68
69
  min-height: 40px;
69
- `, vn = a.div`
70
+ `, Tn = a.div`
70
71
  display: flex;
71
72
  align-items: center;
72
73
  gap: 6px;
73
- `, Tn = a.span`
74
+ `, wn = a.span`
74
75
  color: ${i.content.primary};
75
76
  font-size: 14px;
76
77
  `, O = a.button`
@@ -91,19 +92,19 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
91
92
  opacity: 0.35;
92
93
  cursor: not-allowed;
93
94
  }
94
- `, wn = a(O)`
95
+ `, Cn = a(O)`
95
96
  :disabled {
96
97
  opacity: 1;
97
98
  cursor: wait;
98
99
  }
99
- `, Cn = a.div`
100
+ `, _n = a.div`
100
101
  width: 14px;
101
102
  height: 14px;
102
103
  border-radius: 4px;
103
104
  background: #ececef;
104
105
  flex-shrink: 0;
105
- animation: ${be} 1.1s ease-in-out infinite;
106
- `, _n = a.div`
106
+ animation: ${xe} 1.1s ease-in-out infinite;
107
+ `, An = a.div`
107
108
  background: ${i.surface.standard};
108
109
  display: flex;
109
110
  flex-direction: column;
@@ -111,7 +112,7 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
111
112
  gap: 10px;
112
113
  border-radius: 0 0 4px 4px;
113
114
  position: relative;
114
- `, An = a.div`
115
+ `, yn = a.div`
115
116
  border: 1px solid #f5a4c0;
116
117
  border-radius: 10px;
117
118
  padding: 8px 10px;
@@ -119,7 +120,7 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
119
120
  align-items: center;
120
121
  gap: 10px;
121
122
  background: ${i.surface.standard};
122
- `, yn = a.input`
123
+ `, kn = a.input`
123
124
  flex: 1;
124
125
  min-width: 0;
125
126
  border: 0;
@@ -127,11 +128,11 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
127
128
  font-size: 14px;
128
129
  background: transparent;
129
130
  color: ${i.content.primary};
130
- `, kn = a.div`
131
+ `, Hn = a.div`
131
132
  display: flex;
132
133
  align-items: center;
133
134
  gap: 10px;
134
- `, Hn = a.button`
135
+ `, In = a.button`
135
136
  border: 0;
136
137
  background: transparent;
137
138
  color: ${i.content.secondary};
@@ -139,7 +140,7 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
139
140
  font-weight: 500;
140
141
  padding: 0;
141
142
  cursor: pointer;
142
- `, In = a.button`
143
+ `, Ln = a.button`
143
144
  border: 1px solid #5d3a72;
144
145
  color: #5d3a72;
145
146
  background: ${i.surface.standard};
@@ -149,7 +150,7 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
149
150
  line-height: 1.1;
150
151
  font-weight: 600;
151
152
  cursor: pointer;
152
- `, Ln = a.div`
153
+ `, Pn = a.div`
153
154
  margin-top: 4px;
154
155
  border-radius: 12px;
155
156
  width: 331px;
@@ -160,7 +161,7 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
160
161
  display: flex;
161
162
  flex-direction: column;
162
163
  gap: 2px;
163
- `, Pn = a.button`
164
+ `, $n = a.button`
164
165
  width: 100%;
165
166
  border: 0;
166
167
  border-radius: 8px;
@@ -174,25 +175,25 @@ const Ht = "Character limit reached", he = 3e3, pn = 5, fe = 3, pe = 1200, mn =
174
175
  :hover {
175
176
  background: ${(g) => g.selected ? "#d9e8db" : i.surface.subdued};
176
177
  }
177
- `, B = new Ze(), $n = {
178
+ `, B = new qe(), Dn = {
178
179
  [kt.BOLD]: "*",
179
180
  [kt.ITALIC]: "_",
180
181
  [kt.STRIKETHROUGH]: "~"
181
182
  };
182
- function Dn(g) {
183
+ function Mn(g) {
183
184
  return `whatsapp-editor-rephrase-highlight-${g || "default"}`;
184
185
  }
185
- const Mn = qe.forwardRef(
186
+ const Fn = Ve.forwardRef(
186
187
  ({
187
188
  onChange: g,
188
- onClickVariable: Fn,
189
+ onClickVariable: Bn,
189
190
  text: N,
190
- RightComponent: xe,
191
+ RightComponent: Se,
191
192
  error: P,
192
193
  limit: U,
193
194
  onError: z,
194
- rows: Se,
195
- actions: Re,
195
+ rows: Re,
196
+ actions: Ee,
196
197
  editorInstanceKey: w,
197
198
  editorSessionId: ot,
198
199
  templateType: $ = "marketing",
@@ -216,18 +217,18 @@ const Mn = qe.forwardRef(
216
217
  promptOverrides: Ot,
217
218
  rephraseTones: Nt,
218
219
  aiActionMinChars: Ut,
219
- instructionSuggestions: zt = nn,
220
+ instructionSuggestions: zt = rn,
220
221
  onAnalyticsEvent: Gt,
221
222
  onAITagComputed: ct,
222
223
  prefillWasAiGenerated: A = !1,
223
224
  editorHeader: jt,
224
- onAIToneSelect: Ee,
225
+ onAIToneSelect: ve,
225
226
  onAIActionRequest: st,
226
227
  onBuildAIPrompt: Wt,
227
- onBlur: ve,
228
- ...Te
229
- }, we) => {
230
- const u = f(null), [o, Ce] = S(N || ""), [Xt, Y] = S(!1), [Rt, Yt] = S(0), [c, Jt] = S(!1), [Qt, Et] = S(!1), [y, lt] = S(""), [at, _e] = S({}), [R, Zt] = S(
228
+ onBlur: Te,
229
+ ...we
230
+ }, Ce) => {
231
+ const u = f(null), [o, _e] = S(N || ""), [Xt, Y] = S(!1), [Rt, Yt] = S(0), [c, Jt] = S(!1), [Qt, Et] = S(!1), [y, lt] = S(""), [at, Ae] = S({}), [R, Zt] = S(
231
232
  null
232
233
  ), [m, vt] = S(
233
234
  []
@@ -235,10 +236,10 @@ const Mn = qe.forwardRef(
235
236
  null
236
237
  ), C = f(
237
238
  null
238
- ), Z = f(null), q = f(null), Kt = f(null), Tt = f(!!A), ut = f(null), V = f(""), dt = f(!1), [wt, te] = S({}), Ae = f(
239
+ ), Z = f(null), q = f(null), Kt = f(null), Tt = f(!!A), ut = f(null), V = f(""), dt = f(!1), [wt, te] = S({}), ye = f(
239
240
  `mount-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`
240
- ), K = L(() => Dn(
241
- `${w || "default"}-${ot || Ae.current}`
241
+ ), K = L(() => Mn(
242
+ `${w || "default"}-${ot || ye.current}`
242
243
  ), [w, ot]);
243
244
  _(() => {
244
245
  Tt.current = !!A;
@@ -253,7 +254,7 @@ const Mn = qe.forwardRef(
253
254
  const t = N ?? "";
254
255
  t.length > 0 && (V.current = t, dt.current = !0);
255
256
  }, [A, N, w, ot]);
256
- const gt = L(() => en($, Ot, Nt), [Ot, Nt, $]), ee = L(() => {
257
+ const gt = L(() => nn($, Ot, Nt), [Ot, Nt, $]), ee = L(() => {
257
258
  const t = y.trim().toLowerCase();
258
259
  return t ? zt.filter(
259
260
  (e) => e.toLowerCase().includes(t)
@@ -261,7 +262,7 @@ const Mn = qe.forwardRef(
261
262
  }, [zt, y]), tt = L(() => ({
262
263
  ...pt,
263
264
  ...Ut || {}
264
- }), [Ut]), ne = tt[p.REPHRASE] || pt[p.REPHRASE], ye = E((t) => {
265
+ }), [Ut]), ne = tt[p.REPHRASE] || pt[p.REPHRASE], ke = E((t) => {
265
266
  const e = t.trim().replace(/\s+/g, " ");
266
267
  if (!e) return "";
267
268
  const r = e.split(" ").length;
@@ -272,10 +273,10 @@ const Mn = qe.forwardRef(
272
273
  },
273
274
  [Gt]
274
275
  ), H = E((t) => {
275
- Ce((e) => e === t ? e : t);
276
+ _e((e) => e === t ? e : t);
276
277
  }, []), D = E(
277
278
  (t) => {
278
- if (q.current && clearTimeout(q.current), t.length > pe) {
279
+ if (q.current && clearTimeout(q.current), t.length > me) {
279
280
  g?.(t, t), q.current = setTimeout(() => {
280
281
  g?.(t, B.getHTML(t));
281
282
  }, 16);
@@ -288,7 +289,7 @@ const Mn = qe.forwardRef(
288
289
  (t) => {
289
290
  const r = ut.current?.acceptedText || (A ? V.current : "");
290
291
  if (!r || t === r) return;
291
- const l = rn({
292
+ const l = on({
292
293
  acceptedAiText: r,
293
294
  currentEditedText: t
294
295
  });
@@ -301,7 +302,7 @@ const Mn = qe.forwardRef(
301
302
  ), et = E(() => {
302
303
  Zt(null), vt([]), J(0), qt(null), te({});
303
304
  }, []), ie = E(() => {
304
- if (c || R && m.length > 0 || Rt >= pn)
305
+ if (c || R && m.length > 0 || Rt >= mn)
305
306
  return;
306
307
  const t = Rt + 1;
307
308
  Yt(t), typeof window < "u" && w && sessionStorage.setItem(K, String(t)), Y(!0), Q.current && clearTimeout(Q.current), Q.current = setTimeout(() => {
@@ -316,8 +317,8 @@ const Mn = qe.forwardRef(
316
317
  Rt
317
318
  ]), ht = f(ie);
318
319
  ht.current = ie;
319
- function ke(t) {
320
- const e = t.target.value, r = ut.current;
320
+ function He(t) {
321
+ const e = ge(t.target.value), r = ut.current;
321
322
  r && !r.editedEventEmitted && e !== r.acceptedText && (ut.current = {
322
323
  ...r,
323
324
  editedEventEmitted: !0
@@ -328,14 +329,14 @@ const Mn = qe.forwardRef(
328
329
  const l = r?.acceptedText || (A ? V.current : "");
329
330
  l && e !== l && (C.current = setTimeout(() => {
330
331
  re(e);
331
- }, mn)), H(e), D(e);
332
+ }, bn)), H(e), D(e);
332
333
  }
333
334
  function oe(t) {
334
335
  const e = u?.current;
335
336
  e != null && (e.selectionStart ? (e.focus(), e.selectionEnd = t) : e.focus());
336
337
  }
337
- function He(t) {
338
- const e = $n[t];
338
+ function Ie(t) {
339
+ const e = Dn[t];
339
340
  if (e && u.current) {
340
341
  const r = u.current.selectionStart, l = u.current.selectionEnd;
341
342
  if (r === l) {
@@ -347,7 +348,7 @@ const Mn = qe.forwardRef(
347
348
  }
348
349
  }
349
350
  }
350
- function Ie(t) {
351
+ function Le(t) {
351
352
  const { text: e } = ft(t);
352
353
  D(e);
353
354
  }
@@ -404,7 +405,7 @@ const Mn = qe.forwardRef(
404
405
  if (Z.current === null) {
405
406
  Z.current = t, t && (d.current = setTimeout(() => {
406
407
  ht.current();
407
- }, he));
408
+ }, fe));
408
409
  return;
409
410
  }
410
411
  if (!t) {
@@ -414,7 +415,7 @@ const Mn = qe.forwardRef(
414
415
  const e = !Z.current && t;
415
416
  Z.current = !0, e && ht.current(), d.current && clearTimeout(d.current), d.current = setTimeout(() => {
416
417
  ht.current();
417
- }, he);
418
+ }, fe);
418
419
  }, [
419
420
  o,
420
421
  c,
@@ -424,13 +425,13 @@ const Mn = qe.forwardRef(
424
425
  ]), _(() => () => {
425
426
  d.current && clearTimeout(d.current), Q.current && clearTimeout(Q.current), q.current && clearTimeout(q.current), C.current && clearTimeout(C.current);
426
427
  }, []);
427
- const b = m[k] || "", G = L(() => !s || !b ? null : `${s}-${k}-${b}`, [b, s, k]), se = !!(G && wt[G]), Le = L(
428
+ const b = m[k] || "", G = L(() => !s || !b ? null : `${s}-${k}-${b}`, [b, s, k]), se = !!(G && wt[G]), Pe = L(
428
429
  () => B.getHTML(R || ""),
429
430
  [R]
430
- ), Pe = L(
431
+ ), $e = L(
431
432
  () => B.getHTML(b),
432
433
  [b]
433
- ), _t = m.length < fe, I = !!R && m.length > 0, $e = m.length <= 1 || k <= 0, De = m.length <= 1 || k >= m.length - 1;
434
+ ), _t = m.length < pe, I = !!R && m.length > 0, De = m.length <= 1 || k <= 0, Me = m.length <= 1 || k >= m.length - 1;
434
435
  _(() => {
435
436
  if (!I) return;
436
437
  const t = Vt.current;
@@ -448,7 +449,7 @@ const Mn = qe.forwardRef(
448
449
  const rt = gt[t], W = t === p.REPHRASE && $ === "utility" && x === mt.REPHRASE ? {
449
450
  ...rt,
450
451
  label: "Rephrase",
451
- basePrompt: bn
452
+ basePrompt: xn
452
453
  } : rt, M = l || at[t], ae = W.tones?.find(
453
454
  (X) => X.id === M
454
455
  ), At = r !== void 0 ? r : y, ue = Wt?.({
@@ -460,7 +461,7 @@ const Mn = qe.forwardRef(
460
461
  toneId: M,
461
462
  toneLabel: ae?.label,
462
463
  instructionText: At || void 0
463
- }) || cn({
464
+ }) || sn({
464
465
  config: W,
465
466
  currentText: o,
466
467
  selectedToneId: M,
@@ -481,7 +482,7 @@ const Mn = qe.forwardRef(
481
482
  toneLabel: ae?.label,
482
483
  instructionText: At || void 0,
483
484
  prompt: ue
484
- }) : await sn({
485
+ }) : await ln({
485
486
  apiAdapter: St,
486
487
  requestExecutor: bt,
487
488
  baseUrl: xt,
@@ -498,8 +499,8 @@ const Mn = qe.forwardRef(
498
499
  Zt(o), qt(t), vt([yt]), J(0);
499
500
  return;
500
501
  }
501
- vt((Oe) => {
502
- const de = [...Oe, yt].slice(0, fe);
502
+ vt((Ne) => {
503
+ const de = [...Ne, yt].slice(0, pe);
503
504
  return J(de.length - 1), de;
504
505
  });
505
506
  } catch {
@@ -532,7 +533,7 @@ const Mn = qe.forwardRef(
532
533
  st,
533
534
  Wt
534
535
  ]
535
- ), Me = E(() => {
536
+ ), Fe = E(() => {
536
537
  if (!b || !R || !s)
537
538
  return;
538
539
  H(b), D(b), T("ai_suggestion_accepted", {
@@ -544,7 +545,7 @@ const Mn = qe.forwardRef(
544
545
  actionType: s,
545
546
  editedEventEmitted: !1
546
547
  };
547
- const t = Tt.current, e = on({
548
+ const t = Tt.current, e = cn({
548
549
  baselineText: R,
549
550
  acceptedText: b,
550
551
  initialAiPrefillPhase: t
@@ -563,7 +564,7 @@ const Mn = qe.forwardRef(
563
564
  v,
564
565
  ct,
565
566
  et
566
- ]), Fe = E(() => {
567
+ ]), Be = E(() => {
567
568
  s && (T("ai_suggestion_discarded", {
568
569
  action_type: s,
569
570
  template_id: v
@@ -588,7 +589,7 @@ const Mn = qe.forwardRef(
588
589
  k,
589
590
  v
590
591
  ]
591
- ), Be = L(() => Bt ? [] : Ft.map((t) => {
592
+ ), Oe = L(() => Bt ? [] : Ft.map((t) => {
592
593
  const e = gt[t], r = at[t];
593
594
  return {
594
595
  type: t,
@@ -613,8 +614,8 @@ const Mn = qe.forwardRef(
613
614
  o,
614
615
  tt
615
616
  ]);
616
- return Ve(
617
- we,
617
+ return Ke(
618
+ Ce,
618
619
  () => ({
619
620
  addTextOrWrap: Ct,
620
621
  addText: ft,
@@ -630,23 +631,23 @@ const Mn = qe.forwardRef(
630
631
  if (!U || !z) return;
631
632
  const t = o.length > U ? Ht : P ?? "";
632
633
  Kt.current !== t && (Kt.current = t, z(t));
633
- }, [o, P, U, z]), /* @__PURE__ */ h(ln, { children: [
634
- /* @__PURE__ */ h(an, { children: [
635
- /* @__PURE__ */ n(un, { children: jt ? /* @__PURE__ */ n(tn, { "data-test": "body-text-for-edit-template", children: jt }) : null }),
636
- /* @__PURE__ */ h(dn, { children: [
637
- P && P !== Ht ? /* @__PURE__ */ h(Ne, { children: [
634
+ }, [o, P, U, z]), /* @__PURE__ */ h(an, { children: [
635
+ /* @__PURE__ */ h(un, { children: [
636
+ /* @__PURE__ */ n(dn, { children: jt ? /* @__PURE__ */ n(en, { "data-test": "body-text-for-edit-template", children: jt }) : null }),
637
+ /* @__PURE__ */ h(gn, { children: [
638
+ P && P !== Ht ? /* @__PURE__ */ h(Ue, { children: [
638
639
  /* @__PURE__ */ n(
639
- Xe,
640
+ Ye,
640
641
  {
641
642
  width: 16,
642
643
  height: 16,
643
644
  color: i.content.negative
644
645
  }
645
646
  ),
646
- /* @__PURE__ */ n(ge, { color: i.content.negative, children: P })
647
+ /* @__PURE__ */ n(he, { color: i.content.negative, children: P })
647
648
  ] }) : null,
648
649
  U ? /* @__PURE__ */ h(
649
- ge,
650
+ he,
650
651
  {
651
652
  style: {
652
653
  color: P === Ht || o.length > U ? i.content.negative : i.content.secondary
@@ -660,36 +661,36 @@ const Mn = qe.forwardRef(
660
661
  ) : null
661
662
  ] })
662
663
  ] }),
663
- /* @__PURE__ */ h(gn, { isError: !!P, children: [
664
- I ? /* @__PURE__ */ h(Sn, { ref: Vt, children: [
664
+ /* @__PURE__ */ h(hn, { isError: !!P, children: [
665
+ I ? /* @__PURE__ */ h(Rn, { ref: Vt, children: [
665
666
  /* @__PURE__ */ n(
666
- Rn,
667
+ En,
667
668
  {
668
- dangerouslySetInnerHTML: { __html: Le }
669
+ dangerouslySetInnerHTML: { __html: Pe }
669
670
  }
670
671
  ),
671
- c ? /* @__PURE__ */ n(me, { "aria-busy": "true", children: /* @__PURE__ */ h(En, { children: [
672
+ c ? /* @__PURE__ */ n(be, { "aria-busy": "true", children: /* @__PURE__ */ h(vn, { children: [
672
673
  /* @__PURE__ */ n(F, { width: "96%" }),
673
674
  /* @__PURE__ */ n(F, { width: "84%" }),
674
675
  /* @__PURE__ */ n(F, { width: "68%" })
675
676
  ] }) }) : /* @__PURE__ */ n(
676
- me,
677
+ be,
677
678
  {
678
679
  dangerouslySetInnerHTML: {
679
- __html: Pe
680
+ __html: $e
680
681
  }
681
682
  }
682
683
  ),
683
- /* @__PURE__ */ h(vn, { children: [
684
+ /* @__PURE__ */ h(Tn, { children: [
684
685
  /* @__PURE__ */ n(
685
686
  O,
686
687
  {
687
688
  "aria-label": "Previous suggestion",
688
689
  type: "button",
689
- disabled: $e,
690
+ disabled: De,
690
691
  onClick: () => J((t) => Math.max(0, t - 1)),
691
692
  children: /* @__PURE__ */ n(
692
- ze,
693
+ Ge,
693
694
  {
694
695
  width: 14,
695
696
  height: 14,
@@ -698,7 +699,7 @@ const Mn = qe.forwardRef(
698
699
  )
699
700
  }
700
701
  ),
701
- /* @__PURE__ */ h(Tn, { children: [
702
+ /* @__PURE__ */ h(wn, { children: [
702
703
  k + 1,
703
704
  "/",
704
705
  m.length
@@ -708,12 +709,12 @@ const Mn = qe.forwardRef(
708
709
  {
709
710
  "aria-label": "Next suggestion",
710
711
  type: "button",
711
- disabled: De,
712
+ disabled: Me,
712
713
  onClick: () => J(
713
714
  (t) => Math.min(m.length - 1, t + 1)
714
715
  ),
715
716
  children: /* @__PURE__ */ n(
716
- Ge,
717
+ je,
717
718
  {
718
719
  width: 14,
719
720
  height: 14,
@@ -733,7 +734,7 @@ const Mn = qe.forwardRef(
733
734
  /* LIKE */
734
735
  ),
735
736
  children: /* @__PURE__ */ n(
736
- Qe,
737
+ Ze,
737
738
  {
738
739
  width: 14,
739
740
  height: 14,
@@ -753,7 +754,7 @@ const Mn = qe.forwardRef(
753
754
  /* DISLIKE */
754
755
  ),
755
756
  children: /* @__PURE__ */ n(
756
- Je,
757
+ Qe,
757
758
  {
758
759
  width: 14,
759
760
  height: 14,
@@ -768,7 +769,7 @@ const Mn = qe.forwardRef(
768
769
  body: c ? "Regenerating…" : "Regenerate",
769
770
  placement: "top",
770
771
  children: /* @__PURE__ */ n(
771
- wn,
772
+ Cn,
772
773
  {
773
774
  "aria-label": "Regenerate suggestion",
774
775
  "aria-busy": c,
@@ -777,7 +778,7 @@ const Mn = qe.forwardRef(
777
778
  onClick: () => {
778
779
  s && nt(s, !0);
779
780
  },
780
- children: c ? /* @__PURE__ */ n(Cn, { "aria-hidden": !0 }) : /* @__PURE__ */ n(Ye, { width: 14, height: 14 })
781
+ children: c ? /* @__PURE__ */ n(_n, { "aria-hidden": !0 }) : /* @__PURE__ */ n(Je, { width: 14, height: 14 })
781
782
  }
782
783
  )
783
784
  }
@@ -787,9 +788,9 @@ const Mn = qe.forwardRef(
787
788
  {
788
789
  "aria-label": "Discard suggestion",
789
790
  type: "button",
790
- onClick: Fe,
791
+ onClick: Be,
791
792
  children: /* @__PURE__ */ n(
792
- je,
793
+ We,
793
794
  {
794
795
  width: 14,
795
796
  height: 14,
@@ -803,9 +804,9 @@ const Mn = qe.forwardRef(
803
804
  {
804
805
  "aria-label": "Accept suggestion",
805
806
  type: "button",
806
- onClick: Me,
807
+ onClick: Fe,
807
808
  children: /* @__PURE__ */ n(
808
- Ue,
809
+ ze,
809
810
  {
810
811
  width: 14,
811
812
  height: 14,
@@ -815,24 +816,24 @@ const Mn = qe.forwardRef(
815
816
  }
816
817
  ) })
817
818
  ] })
818
- ] }) : c ? /* @__PURE__ */ h(xn, { children: [
819
+ ] }) : c ? /* @__PURE__ */ h(Sn, { children: [
819
820
  /* @__PURE__ */ n(F, { width: "96%" }),
820
821
  /* @__PURE__ */ n(F, { width: "92%" }),
821
822
  /* @__PURE__ */ n(F, { width: "88%" }),
822
823
  /* @__PURE__ */ n(F, { width: "54%" })
823
824
  ] }) : /* @__PURE__ */ n(
824
- hn,
825
+ fn,
825
826
  {
826
827
  ref: u,
827
- ...Te,
828
+ ...we,
828
829
  value: o,
829
- onChange: ke,
830
+ onChange: He,
830
831
  onBlur: (t) => {
831
- C.current && (clearTimeout(C.current), C.current = null), re(t.target.value), ve?.(t);
832
+ C.current && (clearTimeout(C.current), C.current = null), re(t.target.value), Te?.(t);
832
833
  },
833
834
  onPaste: (t) => {
834
835
  const e = t.clipboardData.getData("text");
835
- if (e.length > pe) {
836
+ if (e.length > me) {
836
837
  t.preventDefault();
837
838
  const r = u.current, l = r?.selectionStart ?? 0, x = r?.selectionEnd ?? l, j = r?.value ?? o, rt = j.slice(0, l) + e + j.slice(x);
838
839
  H(rt), D(rt);
@@ -847,13 +848,13 @@ const Mn = qe.forwardRef(
847
848
  });
848
849
  }
849
850
  },
850
- rows: Se
851
+ rows: Re
851
852
  }
852
853
  ),
853
- Qt ? /* @__PURE__ */ h(_n, { children: [
854
- /* @__PURE__ */ h(An, { children: [
854
+ Qt ? /* @__PURE__ */ h(An, { children: [
855
+ /* @__PURE__ */ h(yn, { children: [
855
856
  /* @__PURE__ */ n(
856
- We,
857
+ Xe,
857
858
  {
858
859
  width: 18,
859
860
  height: 18,
@@ -861,16 +862,16 @@ const Mn = qe.forwardRef(
861
862
  }
862
863
  ),
863
864
  /* @__PURE__ */ n(
864
- yn,
865
+ kn,
865
866
  {
866
867
  value: y,
867
868
  placeholder: "Add specific instructions to refine your message",
868
- onChange: (t) => lt(t.target.value)
869
+ onChange: (t) => lt(ge(t.target.value))
869
870
  }
870
871
  ),
871
- /* @__PURE__ */ h(kn, { children: [
872
+ /* @__PURE__ */ h(Hn, { children: [
872
873
  /* @__PURE__ */ n(
873
- Hn,
874
+ In,
874
875
  {
875
876
  type: "button",
876
877
  onClick: () => {
@@ -880,7 +881,7 @@ const Mn = qe.forwardRef(
880
881
  }
881
882
  ),
882
883
  /* @__PURE__ */ n(
883
- In,
884
+ Ln,
884
885
  {
885
886
  type: "button",
886
887
  onClick: () => {
@@ -888,7 +889,7 @@ const Mn = qe.forwardRef(
888
889
  t && T("ai_instruction_used", {
889
890
  action_type: p.REPHRASE,
890
891
  template_id: v,
891
- instruction_text: ye(t)
892
+ instruction_text: ke(t)
892
893
  }), Et(!1), lt(""), nt(
893
894
  p.REPHRASE,
894
895
  !1,
@@ -900,8 +901,8 @@ const Mn = qe.forwardRef(
900
901
  )
901
902
  ] })
902
903
  ] }),
903
- y.trim().length > 0 && ee.length > 0 ? /* @__PURE__ */ n(Ln, { children: ee.map((t) => /* @__PURE__ */ n(
904
- Pn,
904
+ y.trim().length > 0 && ee.length > 0 ? /* @__PURE__ */ n(Pn, { children: ee.map((t) => /* @__PURE__ */ n(
905
+ $n,
905
906
  {
906
907
  type: "button",
907
908
  selected: y === t,
@@ -911,20 +912,20 @@ const Mn = qe.forwardRef(
911
912
  t
912
913
  )) }) : null
913
914
  ] }) : /* @__PURE__ */ n(
914
- fn,
915
+ pn,
915
916
  {
916
- actions: Re,
917
+ actions: Ee,
917
918
  ref: u,
918
- onActionSelect: He,
919
- RightComponent: xe,
919
+ onActionSelect: Ie,
920
+ RightComponent: Se,
920
921
  rightActionsDisabled: I || c,
921
- onEmojiClick: Ie,
922
- aiActions: Be,
922
+ onEmojiClick: Le,
923
+ aiActions: Oe,
923
924
  disableAllActions: I || c,
924
925
  instructionActive: Qt,
925
926
  onAIInstructionsClick: () => Et(!0),
926
927
  onAIToneChange: (t, e) => {
927
- _e((r) => ({ ...r, [t]: e })), Ee?.(t, e), t === p.REPHRASE && nt(
928
+ Ae((r) => ({ ...r, [t]: e })), ve?.(t, e), t === p.REPHRASE && nt(
928
929
  t,
929
930
  !1,
930
931
  void 0,
@@ -961,11 +962,11 @@ const Mn = qe.forwardRef(
961
962
  ] });
962
963
  }
963
964
  );
964
- Mn.displayName = "WhatsAppTextEditor";
965
+ Fn.displayName = "WhatsAppTextEditor";
965
966
  export {
966
- sr as AI_TAG_CHANGE_RATIO_THRESHOLD,
967
- Mn as WhatsAppTextEditor,
968
- on as computeAiTagOnAccept,
969
- lr as levenshteinDistance
967
+ ar as AI_TAG_CHANGE_RATIO_THRESHOLD,
968
+ Fn as WhatsAppTextEditor,
969
+ cn as computeAiTagOnAccept,
970
+ ur as levenshteinDistance
970
971
  };
971
972
  //# sourceMappingURL=WhatsAppTextEditor.js.map