@chatsystem/client 1.1.86 → 1.1.87

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/index.mjs CHANGED
@@ -21228,13 +21228,13 @@ const P_ = (e) => {
21228
21228
  type: "unhandled_client_event",
21229
21229
  event: e
21230
21230
  };
21231
- }, U_ = 1e4, z_ = (e) => {
21231
+ }, U_ = 1e4, z_ = 3e3, $_ = (e) => {
21232
21232
  const t = new URL(e);
21233
21233
  return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t;
21234
- }, $_ = ({
21234
+ }, j_ = ({
21235
21235
  apiUrl: e,
21236
21236
  handoff: t
21237
- }) => (t.socketUrl.startsWith("ws://") || t.socketUrl.startsWith("wss://") ? new URL(t.socketUrl) : new URL(t.socketUrl, z_(e))).toString(), j_ = (e) => {
21237
+ }) => (t.socketUrl.startsWith("ws://") || t.socketUrl.startsWith("wss://") ? new URL(t.socketUrl) : new URL(t.socketUrl, $_(e))).toString(), Y_ = (e) => {
21238
21238
  if (typeof e != "object" || e === null) return !1;
21239
21239
  const t = e;
21240
21240
  return [
@@ -21245,7 +21245,7 @@ const P_ = (e) => {
21245
21245
  "error"
21246
21246
  ].includes(t.type);
21247
21247
  };
21248
- class Y_ {
21248
+ class G_ {
21249
21249
  socket;
21250
21250
  callbacks;
21251
21251
  url;
@@ -21253,8 +21253,9 @@ class Y_ {
21253
21253
  handoffToken;
21254
21254
  isIntentionalClose = !1;
21255
21255
  handshakeTimeout;
21256
+ closeAcknowledgementTimeout = null;
21256
21257
  constructor(t) {
21257
- this.callbacks = t.callbacks, this.url = $_(t), this.appToken = t.appToken;
21258
+ this.callbacks = t.callbacks, this.url = j_(t), this.appToken = t.appToken;
21258
21259
  const n = t.handoff.reconnectToken ?? t.handoff.handoffToken;
21259
21260
  if (!n)
21260
21261
  throw new Error("Customer support socket requires a reconnect token");
@@ -21296,9 +21297,12 @@ class Y_ {
21296
21297
  type: "close",
21297
21298
  reason: t
21298
21299
  };
21299
- this.socket.send(JSON.stringify(r));
21300
+ this.socket.send(JSON.stringify(r)), this.closeAcknowledgementTimeout = setTimeout(() => {
21301
+ this.closeTransport(t);
21302
+ }, z_);
21303
+ return;
21300
21304
  }
21301
- this.socket.close(1e3, t ?? "Customer support socket detached");
21305
+ this.closeTransport(t);
21302
21306
  }
21303
21307
  handleMessage = (t) => {
21304
21308
  clearTimeout(this.handshakeTimeout);
@@ -21313,7 +21317,7 @@ class Y_ {
21313
21317
  });
21314
21318
  return;
21315
21319
  }
21316
- if (j_(n)) {
21320
+ if (Y_(n)) {
21317
21321
  if (n.type === "connected") {
21318
21322
  this.callbacks.onConnected?.(n);
21319
21323
  return;
@@ -21323,6 +21327,10 @@ class Y_ {
21323
21327
  return;
21324
21328
  }
21325
21329
  if (n.type === "closed") {
21330
+ if (this.closeAcknowledgementTimeout !== null) {
21331
+ clearTimeout(this.closeAcknowledgementTimeout), this.closeAcknowledgementTimeout = null, this.closeTransport("Customer support session closed");
21332
+ return;
21333
+ }
21326
21334
  this.callbacks.onClosed?.(n);
21327
21335
  return;
21328
21336
  }
@@ -21330,7 +21338,7 @@ class Y_ {
21330
21338
  }
21331
21339
  };
21332
21340
  handleClose = (t) => {
21333
- clearTimeout(this.handshakeTimeout), !this.isIntentionalClose && this.callbacks.onClose?.(t);
21341
+ clearTimeout(this.handshakeTimeout), this.closeAcknowledgementTimeout !== null && (clearTimeout(this.closeAcknowledgementTimeout), this.closeAcknowledgementTimeout = null), !this.isIntentionalClose && this.callbacks.onClose?.(t);
21334
21342
  };
21335
21343
  handleTransportError = () => {
21336
21344
  this.isIntentionalClose || this.callbacks.onTransportError?.({
@@ -21338,36 +21346,39 @@ class Y_ {
21338
21346
  url: this.safeUrlForLogs()
21339
21347
  });
21340
21348
  };
21349
+ closeTransport(t) {
21350
+ this.closeAcknowledgementTimeout !== null && (clearTimeout(this.closeAcknowledgementTimeout), this.closeAcknowledgementTimeout = null), this.socket.close(1e3, t ?? "Customer support socket detached");
21351
+ }
21341
21352
  safeUrlForLogs() {
21342
21353
  const t = new URL(this.url);
21343
21354
  return t.searchParams.has("handoffToken") && t.searchParams.set("handoffToken", "<redacted>"), t.toString();
21344
21355
  }
21345
21356
  }
21346
- const G_ = /* @__PURE__ */ new Set([
21357
+ const q_ = /* @__PURE__ */ new Set([
21347
21358
  "SLACK_INBOUND_EVENT_NOT_OBSERVED"
21348
- ]), q_ = (e) => e && G_.has(e) ? "provider_unavailable" : "connection_error", V_ = (e) => e.isClosed ? e.labels.closed : !e.isCustomerSupportMode || !e.hasTransportFailed ? null : e.failureKind === "provider_unavailable" ? e.labels.providerUnavailable : e.labels.connectionError, W_ = [500, 1500, 3e3], X_ = (e) => {
21349
- const t = W_[e];
21359
+ ]), V_ = (e) => e && q_.has(e) ? "provider_unavailable" : "connection_error", W_ = (e) => e.isClosed ? e.labels.closed : !e.isCustomerSupportMode || !e.hasTransportFailed ? null : e.failureKind === "provider_unavailable" ? e.labels.providerUnavailable : e.labels.connectionError, X_ = [500, 1500, 3e3], Q_ = (e) => {
21360
+ const t = X_[e];
21350
21361
  return t === void 0 ? { shouldRetry: !1 } : { shouldRetry: !0, delayMs: t };
21351
21362
  }, Ot = {
21352
21363
  ai: "ai",
21353
21364
  customerSupport: "customer_support"
21354
- }, oi = "chatsystem-widget", Q_ = 1440 * 60 * 1e3;
21365
+ }, oi = "chatsystem-widget", K_ = 1440 * 60 * 1e3;
21355
21366
  function Sr(e) {
21356
21367
  return typeof e == "string" && !Number.isNaN(Date.parse(e));
21357
21368
  }
21358
- function K_(e) {
21369
+ function Z_(e) {
21359
21370
  return !(typeof e != "object" || e === null || typeof e.enabled != "boolean" || typeof e.timeoutMinutes != "number" || typeof e.requireEmail != "boolean" || typeof e.requirePhone != "boolean");
21360
21371
  }
21361
- function Z_(e) {
21372
+ function J_(e) {
21362
21373
  return !(typeof e != "object" || e === null || typeof e.enabled != "boolean" || typeof e.requireEmail != "boolean" || typeof e.requirePhone != "boolean" || typeof e.requireReason != "boolean");
21363
21374
  }
21364
- function J_(e) {
21375
+ function ex(e) {
21365
21376
  if (typeof e != "object" || e === null || typeof e.discussionId != "number" || typeof e.reconnectToken != "string" || !Sr(e.startedAt) || !Sr(e.updatedAt) || e.reconnectTokenExpiresAt !== void 0 && !Sr(e.reconnectTokenExpiresAt) || e.closedAt !== void 0 && !Sr(e.closedAt) || e.closedReason !== void 0 && typeof e.closedReason != "string")
21366
21377
  return !1;
21367
21378
  const t = e.mode ?? "live_chat";
21368
- return t === "closed_hours_contact_capture" ? !(!["active", "closed"].includes(e.status) || typeof e.customerSupportSessionId != "number" || !Z_(e.closedHoursContactCapture) || typeof e.businessHours != "object" || e.businessHours === null || typeof e.businessHours.timezone != "string" || e.businessHours.todayScheduleLabel !== void 0 && typeof e.businessHours.todayScheduleLabel != "string") : !(t !== "live_chat" || !["connecting", "active", "closed"].includes(e.status) || typeof e.socketUrl != "string" || e.customerSupportSessionId !== void 0 && typeof e.customerSupportSessionId != "number" || e.isWaitingForFirstProviderReply !== void 0 && typeof e.isWaitingForFirstProviderReply != "boolean" || e.fallbackContactCapture !== void 0 && !K_(e.fallbackContactCapture));
21379
+ return t === "closed_hours_contact_capture" ? !(!["active", "closed"].includes(e.status) || typeof e.customerSupportSessionId != "number" || !J_(e.closedHoursContactCapture) || typeof e.businessHours != "object" || e.businessHours === null || typeof e.businessHours.timezone != "string" || e.businessHours.todayScheduleLabel !== void 0 && typeof e.businessHours.todayScheduleLabel != "string") : !(t !== "live_chat" || !["connecting", "active", "closed"].includes(e.status) || typeof e.socketUrl != "string" || e.customerSupportSessionId !== void 0 && typeof e.customerSupportSessionId != "number" || e.isWaitingForFirstProviderReply !== void 0 && typeof e.isWaitingForFirstProviderReply != "boolean" || e.fallbackContactCapture !== void 0 && !Z_(e.fallbackContactCapture));
21369
21380
  }
21370
- function ex(e) {
21381
+ function tx(e) {
21371
21382
  return !(typeof e != "object" || e === null || e.userType !== "user" && e.userType !== "assistant" || "content" in e && e.content !== void 0 && typeof e.content != "string" || "metaData" in e && e.metaData !== void 0 && (typeof e.metaData != "object" || e.metaData === null || "isErrorMessage" in e.metaData && e.metaData.isErrorMessage !== void 0 && typeof e.metaData.isErrorMessage != "boolean" || "messageKind" in e.metaData && e.metaData.messageKind !== void 0 && !["conversation", "system"].includes(e.metaData.messageKind) || "systemEvent" in e.metaData && e.metaData.systemEvent !== void 0 && ![
21372
21383
  "customer_support_connecting",
21373
21384
  "customer_support_connected",
@@ -21375,10 +21386,10 @@ function ex(e) {
21375
21386
  "customer_support_connection_error"
21376
21387
  ].includes(e.metaData.systemEvent) || "customerSupportAuthorName" in e.metaData && e.metaData.customerSupportAuthorName !== void 0 && typeof e.metaData.customerSupportAuthorName != "string"));
21377
21388
  }
21378
- function tx(e) {
21379
- return !(typeof e != "object" || e === null || !Array.isArray(e.items) || !e.items.every(ex) || e.discussionId !== null && typeof e.discussionId != "number" || typeof e.updatedAt != "string" || Number.isNaN(Date.parse(e.updatedAt)) || e.customerSupport !== void 0 && e.customerSupport !== null && !J_(e.customerSupport));
21380
- }
21381
21389
  function nx(e) {
21390
+ return !(typeof e != "object" || e === null || !Array.isArray(e.items) || !e.items.every(tx) || e.discussionId !== null && typeof e.discussionId != "number" || typeof e.updatedAt != "string" || Number.isNaN(Date.parse(e.updatedAt)) || e.customerSupport !== void 0 && e.customerSupport !== null && !ex(e.customerSupport));
21391
+ }
21392
+ function rx(e) {
21382
21393
  const t = Lt();
21383
21394
  if (typeof window > "u")
21384
21395
  return;
@@ -21403,12 +21414,12 @@ function id(e) {
21403
21414
  if (!r) return null;
21404
21415
  try {
21405
21416
  const i = JSON.parse(r);
21406
- return tx(i) ? i : (t.warn("Chat state in localStorage has unexpected shape, ignoring."), null);
21417
+ return nx(i) ? i : (t.warn("Chat state in localStorage has unexpected shape, ignoring."), null);
21407
21418
  } catch (i) {
21408
21419
  return t.error("Failed to parse chat state from localStorage", i), null;
21409
21420
  }
21410
21421
  }
21411
- function rx(e) {
21422
+ function ix(e) {
21412
21423
  if (typeof window > "u")
21413
21424
  return null;
21414
21425
  const t = oi;
@@ -21428,7 +21439,7 @@ const ad = (e, t) => {
21428
21439
  if (n <= Date.now()) return "expired_reconnect_token";
21429
21440
  }
21430
21441
  return null;
21431
- }, ix = () => {
21442
+ }, ax = () => {
21432
21443
  const e = id(), t = e?.customerSupport ?? null;
21433
21444
  if (!t)
21434
21445
  return {
@@ -21453,17 +21464,17 @@ const ad = (e, t) => {
21453
21464
  customerSupportState: t,
21454
21465
  reason: "valid_reconnect_state"
21455
21466
  };
21456
- }, sd = (e) => e.mode !== Ot.customerSupport ? !1 : e.customerSupportState.status !== "closed", os = (e) => e.mode !== Ot.customerSupport ? !1 : e.customerSupportState.status === "closed", us = (e) => e.mode !== Ot.customerSupport || e.customerSupportState.status === "closed" ? !1 : e.customerSupportState.mode === "closed_hours_contact_capture", ax = (e) => us(e) ? "customer_support" : sd(e) ? "customer_support_connecting" : os(e) ? "customer_support" : "ai", sx = (e) => us(e) ? "idle" : sd(e) ? "connecting" : os(e) ? "closed" : "idle", ox = (e) => us(e) ? "visible" : "idle", ux = (e) => e?.trim() || void 0, lx = (e) => e.mode !== Ot.customerSupport || e.customerSupportState.status === "closed" || e.customerSupportState.mode === "closed_hours_contact_capture" ? null : e.customerSupportState, od = (e) => !!(e && e.mode !== "closed_hours_contact_capture"), ls = (e) => e?.mode === "closed_hours_contact_capture", cx = (e) => {
21467
+ }, sd = (e) => e.mode !== Ot.customerSupport ? !1 : e.customerSupportState.status !== "closed", os = (e) => e.mode !== Ot.customerSupport ? !1 : e.customerSupportState.status === "closed", us = (e) => e.mode !== Ot.customerSupport || e.customerSupportState.status === "closed" ? !1 : e.customerSupportState.mode === "closed_hours_contact_capture", sx = (e) => us(e) ? "customer_support" : sd(e) ? "customer_support_connecting" : os(e) ? "customer_support" : "ai", ox = (e) => us(e) ? "idle" : sd(e) ? "connecting" : os(e) ? "closed" : "idle", ux = (e) => us(e) ? "visible" : "idle", lx = (e) => e?.trim() || void 0, cx = (e) => e.mode !== Ot.customerSupport || e.customerSupportState.status === "closed" || e.customerSupportState.mode === "closed_hours_contact_capture" ? null : e.customerSupportState, od = (e) => !!(e && e.mode !== "closed_hours_contact_capture"), ls = (e) => e?.mode === "closed_hours_contact_capture", dx = (e) => {
21457
21468
  if (e.isCustomerSupportMode && e.isCurrentDiscussion && od(e.state))
21458
21469
  return e.state.fallbackContactCapture;
21459
- }, dx = (e) => {
21470
+ }, fx = (e) => {
21460
21471
  if (e.isCustomerSupportMode && e.isCurrentDiscussion && ls(e.state))
21461
21472
  return e.state.closedHoursContactCapture;
21462
- }, fx = (e) => {
21473
+ }, hx = (e) => {
21463
21474
  if (e.isCustomerSupportMode && e.isCurrentDiscussion && ls(e.state))
21464
21475
  return e.state.businessHours;
21465
- }, hx = (e) => e.isCustomerSupportMode ? e.chatTransportMode === "customer_support_connecting" ? "customer_support_connecting" : e.isCurrentDiscussion ? ls(e.state) ? "customer_support_closed_hours_form" : e.socketStatus !== "connected" ? `socket_${e.socketStatus}` : e.isWaitingForFirstProviderReply ? "waiting_first_provider_reply" : e.isCustomerSupportClosed ? "customer_support_closed" : null : e.currentDiscussionId === null ? "discussion_not_loaded" : "discussion_mismatch" : null;
21466
- function px({
21476
+ }, px = (e) => e.isCustomerSupportMode ? e.chatTransportMode === "customer_support_connecting" ? "customer_support_connecting" : e.isCurrentDiscussion ? ls(e.state) ? "customer_support_closed_hours_form" : e.socketStatus !== "connected" ? `socket_${e.socketStatus}` : e.isWaitingForFirstProviderReply ? "waiting_first_provider_reply" : e.isCustomerSupportClosed ? "customer_support_closed" : null : e.currentDiscussionId === null ? "discussion_not_loaded" : "discussion_mismatch" : null;
21477
+ function mx({
21467
21478
  appToken: e,
21468
21479
  currentConversation: t,
21469
21480
  loadingStatus: n,
@@ -21477,18 +21488,18 @@ function px({
21477
21488
  resetConversationRequestId: d
21478
21489
  }) {
21479
21490
  const f = c, [p, h] = ae(
21480
- () => ax(f)
21491
+ () => sx(f)
21481
21492
  ), [b, y] = ae(
21482
21493
  f.customerSupportState
21483
21494
  ), [C, x] = ae(
21484
- () => sx(f)
21485
- ), [I, w] = ae(null), [R, S] = ae("idle"), [v, $] = ae(
21486
21495
  () => ox(f)
21496
+ ), [I, w] = ae(null), [R, S] = ae("idle"), [v, $] = ae(
21497
+ () => ux(f)
21487
21498
  ), V = fe(null), ee = fe(
21488
21499
  d
21489
21500
  ), A = fe(!1), H = fe(null), z = fe(
21490
- lx(f)
21491
- ), B = fe(os(f)), Y = fe(!1), X = fe(0), ge = fe(null), se = p !== "ai", Ie = b?.discussionId === t.discussionId, ke = se && b?.status === "closed", m = V_({
21501
+ cx(f)
21502
+ ), B = fe(os(f)), Y = fe(!1), X = fe(0), ge = fe(null), se = p !== "ai", Ie = b?.discussionId === t.discussionId, ke = se && b?.status === "closed", m = W_({
21492
21503
  isCustomerSupportMode: se,
21493
21504
  isClosed: ke,
21494
21505
  hasTransportFailed: C === "failed",
@@ -21498,17 +21509,17 @@ function px({
21498
21509
  isCustomerSupportMode: se,
21499
21510
  isCurrentDiscussion: Ie,
21500
21511
  state: b
21501
- }, T = cx(
21512
+ }, T = dx(
21502
21513
  ne
21503
- ), Z = dx(
21514
+ ), Z = fx(
21504
21515
  ne
21505
- ), de = fx(
21516
+ ), de = hx(
21506
21517
  ne
21507
21518
  ), q = !!T?.enabled && ["visible", "submitting", "submitted", "failed"].includes(
21508
21519
  R
21509
21520
  ), ue = !!Z?.enabled && ["visible", "submitting", "submitted", "failed"].includes(
21510
21521
  v
21511
- ), te = hx({
21522
+ ), te = px({
21512
21523
  chatTransportMode: p,
21513
21524
  currentDiscussionId: t.discussionId,
21514
21525
  isCustomerSupportClosed: ke,
@@ -21521,7 +21532,7 @@ function px({
21521
21532
  Ee(() => {
21522
21533
  if (n !== "notLoading" || t.items.length === 0) return;
21523
21534
  const F = Ie ? b : null;
21524
- !t.discussionId && !F || nx({
21535
+ !t.discussionId && !F || rx({
21525
21536
  conversation: t,
21526
21537
  customerSupport: F
21527
21538
  });
@@ -21594,7 +21605,7 @@ function px({
21594
21605
  w(K), x("failed"), s("notLoading");
21595
21606
  }, le = (K) => {
21596
21607
  V.current = null;
21597
- const Ae = X_(
21608
+ const Ae = Q_(
21598
21609
  X.current
21599
21610
  );
21600
21611
  if (!Ae.shouldRetry) {
@@ -21612,7 +21623,7 @@ function px({
21612
21623
  });
21613
21624
  }, Ae.delayMs);
21614
21625
  };
21615
- V.current = new Y_({
21626
+ V.current = new G_({
21616
21627
  apiUrl: xt.getApiUrl(),
21617
21628
  appToken: e,
21618
21629
  handoff: F,
@@ -21657,7 +21668,7 @@ function px({
21657
21668
  isWaitingForFirstProviderReply: !1,
21658
21669
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
21659
21670
  }), Le(K.text, {
21660
- customerSupportAuthorName: ux(
21671
+ customerSupportAuthorName: lx(
21661
21672
  K.authorName
21662
21673
  ),
21663
21674
  customerSupportProvider: K.provider
@@ -21673,7 +21684,7 @@ function px({
21673
21684
  onError: (K) => {
21674
21685
  P = !0, i.error(
21675
21686
  "Customer support socket server error code=" + K.code + " message=" + K.message
21676
- ), W(q_(K.code));
21687
+ ), W(V_(K.code));
21677
21688
  },
21678
21689
  onClose: (K) => {
21679
21690
  Y.current || B.current || P || le(K);
@@ -21928,7 +21939,7 @@ const ud = () => {
21928
21939
  cancelTranslation: p,
21929
21940
  recentMessagesTranslation: h
21930
21941
  };
21931
- }, mx = ({}) => {
21942
+ }, gx = ({}) => {
21932
21943
  const { companySettings: e } = Qe(fn);
21933
21944
  return /* @__PURE__ */ k(
21934
21945
  "div",
@@ -21949,7 +21960,7 @@ const ud = () => {
21949
21960
  )
21950
21961
  }
21951
21962
  );
21952
- }, gx = ({
21963
+ }, bx = ({
21953
21964
  loadingStatus: e,
21954
21965
  currentStepName: t,
21955
21966
  currentStepNumber: n,
@@ -21972,9 +21983,9 @@ const ud = () => {
21972
21983
  r
21973
21984
  ] })
21974
21985
  ] }),
21975
- /* @__PURE__ */ k("div", { className: "flex justify-center", children: /* @__PURE__ */ k(mx, {}) })
21986
+ /* @__PURE__ */ k("div", { className: "flex justify-center", children: /* @__PURE__ */ k(gx, {}) })
21976
21987
  ] }) });
21977
- }, bx = ({
21988
+ }, Ex = ({
21978
21989
  onPressLoadingButton: e
21979
21990
  }) => /* @__PURE__ */ k("div", { children: /* @__PURE__ */ k(
21980
21991
  "button",
@@ -22032,7 +22043,7 @@ const ud = () => {
22032
22043
  }
22033
22044
  ) })
22034
22045
  }
22035
- ) }), Ex = (e) => {
22046
+ ) }), Tx = (e) => {
22036
22047
  const t = fe(null), [n, r] = ae(!1), i = fe(!0), a = fe(!1), s = fe(0), o = () => {
22037
22048
  const d = t.current, f = 4;
22038
22049
  if (d) {
@@ -22071,7 +22082,7 @@ const ud = () => {
22071
22082
  messagesContainerRef: t,
22072
22083
  showScrollButton: n
22073
22084
  };
22074
- }, Tx = () => {
22085
+ }, yx = () => {
22075
22086
  const e = pn(), t = e.formatMessage({
22076
22087
  defaultMessage: "Discussion limit reached",
22077
22088
  id: "chatbot.DiscussionLimitReached.title"
@@ -22087,14 +22098,14 @@ const ud = () => {
22087
22098
  DiscussionLimitReachedExplainationTranslation: n,
22088
22099
  DiscussionLimitReachedCtaTranslation: r
22089
22100
  };
22090
- }, yx = (e) => /* @__PURE__ */ Ye.createElement("svg", { width: "800px", height: "800px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ Ye.createElement("g", { clipPath: "url(#clip0_1276_7761)" }, /* @__PURE__ */ Ye.createElement("path", { d: "M19.7285 10.9288C20.4413 13.5978 19.7507 16.5635 17.6569 18.6573C15.1798 21.1344 11.4826 21.6475 8.5 20.1966M18.364 8.05071L17.6569 7.3436C14.5327 4.21941 9.46736 4.21941 6.34316 7.3436C3.42964 10.2571 3.23318 14.8588 5.75376 18M18.364 8.05071H14.1213M18.364 8.05071V3.80807", stroke: "#1C274C", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })), /* @__PURE__ */ Ye.createElement("defs", null, /* @__PURE__ */ Ye.createElement("clipPath", { id: "clip0_1276_7761" }, /* @__PURE__ */ Ye.createElement("rect", { width: 24, height: 24, fill: "white" })))), _x = ({
22101
+ }, _x = (e) => /* @__PURE__ */ Ye.createElement("svg", { width: "800px", height: "800px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ Ye.createElement("g", { clipPath: "url(#clip0_1276_7761)" }, /* @__PURE__ */ Ye.createElement("path", { d: "M19.7285 10.9288C20.4413 13.5978 19.7507 16.5635 17.6569 18.6573C15.1798 21.1344 11.4826 21.6475 8.5 20.1966M18.364 8.05071L17.6569 7.3436C14.5327 4.21941 9.46736 4.21941 6.34316 7.3436C3.42964 10.2571 3.23318 14.8588 5.75376 18M18.364 8.05071H14.1213M18.364 8.05071V3.80807", stroke: "#1C274C", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })), /* @__PURE__ */ Ye.createElement("defs", null, /* @__PURE__ */ Ye.createElement("clipPath", { id: "clip0_1276_7761" }, /* @__PURE__ */ Ye.createElement("rect", { width: 24, height: 24, fill: "white" })))), xx = ({
22091
22102
  onReset: e
22092
22103
  }) => {
22093
22104
  const {
22094
22105
  DiscussionLimitReachedCtaTranslation: t,
22095
22106
  DiscussionLimitReachedExplainationTranslation: n,
22096
22107
  DiscussionLimitReachedTitleTranslation: r
22097
- } = Tx();
22108
+ } = yx();
22098
22109
  return /* @__PURE__ */ k(zt, { children: /* @__PURE__ */ k("div", { className: "px-3 mt-4", children: /* @__PURE__ */ he(
22099
22110
  "div",
22100
22111
  {
@@ -22140,7 +22151,7 @@ const ud = () => {
22140
22151
  active:scale-[0.98]`,
22141
22152
  children: [
22142
22153
  /* @__PURE__ */ k(
22143
- yx,
22154
+ _x,
22144
22155
  {
22145
22156
  "aria-hidden": "true",
22146
22157
  className: "w-5 h-5 transition-transform duration-200 group-hover:rotate-180"
@@ -22154,7 +22165,7 @@ const ud = () => {
22154
22165
  ]
22155
22166
  }
22156
22167
  ) }) });
22157
- }, xx = ({
22168
+ }, Sx = ({
22158
22169
  onClick: e,
22159
22170
  label: t = "voir les messages plus récents",
22160
22171
  className: n
@@ -22348,7 +22359,7 @@ const ud = () => {
22348
22359
  }
22349
22360
  )
22350
22361
  ] })
22351
- ] }), Sx = ({ config: e, status: t, labels: n, onSubmit: r }) => {
22362
+ ] }), Cx = ({ config: e, status: t, labels: n, onSubmit: r }) => {
22352
22363
  const [i, a] = ae(""), [s, o] = ae(""), u = t === "submitting", c = t === "submitted";
22353
22364
  return /* @__PURE__ */ k(
22354
22365
  "div",
@@ -22423,7 +22434,7 @@ const ud = () => {
22423
22434
  )
22424
22435
  }
22425
22436
  );
22426
- }, Cx = ({ config: e, status: t, scheduleLabel: n, labels: r, onSubmit: i }) => {
22437
+ }, Ax = ({ config: e, status: t, scheduleLabel: n, labels: r, onSubmit: i }) => {
22427
22438
  const [a, s] = ae(""), [o, u] = ae(""), [c, d] = ae(""), f = t === "submitting", p = t === "submitted";
22428
22439
  return /* @__PURE__ */ k(
22429
22440
  "div",
@@ -22515,7 +22526,7 @@ const ud = () => {
22515
22526
  )
22516
22527
  }
22517
22528
  );
22518
- }, Ax = ({
22529
+ }, wx = ({
22519
22530
  onPressMicButton: e,
22520
22531
  isDisabled: t,
22521
22532
  className: n
@@ -22602,7 +22613,7 @@ const ud = () => {
22602
22613
  ) })
22603
22614
  }
22604
22615
  ) });
22605
- function wx() {
22616
+ function vx() {
22606
22617
  const [e, t] = ae("idle"), [n, r] = ae(null), [i, a] = ae(0), s = fe(null), o = fe(null), u = fe([]), c = fe(null), d = fe(null), f = fe(null), p = fe(null), h = lt(() => {
22607
22618
  p.current !== null && (cancelAnimationFrame(p.current), p.current = null);
22608
22619
  try {
@@ -22683,7 +22694,7 @@ function wx() {
22683
22694
  h(), o.current?.getTracks().forEach((I) => I.stop());
22684
22695
  }, [h]), { state: e, error: n, audioLevel: i, start: y, stop: C, cancel: x };
22685
22696
  }
22686
- const vx = () => {
22697
+ const Ix = () => {
22687
22698
  const e = pn(), t = e.formatMessage({
22688
22699
  defaultMessage: "Recording...",
22689
22700
  id: "recordingOverlay.recording"
@@ -22699,7 +22710,7 @@ const vx = () => {
22699
22710
  cancelTranslation: n,
22700
22711
  recordingExplainationTranslation: r
22701
22712
  };
22702
- }, Ix = ({
22713
+ }, kx = ({
22703
22714
  isOpen: e,
22704
22715
  onStop: t,
22705
22716
  onCancel: n,
@@ -22708,7 +22719,7 @@ const vx = () => {
22708
22719
  if (!e) return null;
22709
22720
  const {
22710
22721
  recordingTranslation: i
22711
- } = vx(), a = Xt(() => {
22722
+ } = Ix(), a = Xt(() => {
22712
22723
  const s = Math.max(0, Math.min(1, r));
22713
22724
  return Array.from({ length: 20 }, (o, u) => {
22714
22725
  const c = Math.sin(u / 19 * Math.PI * 2) * 0.5 + 0.5, d = u % 2 === 0 ? 0.9 : 0.65, f = 6 + s * (14 + c * 18) * d;
@@ -22817,13 +22828,13 @@ const vx = () => {
22817
22828
  ] })
22818
22829
  }
22819
22830
  );
22820
- }, kx = (e) => /(\[.*|\!\[.*)$/.test(e), Nx = (e) => /\)/.test(e), au = () => ({
22831
+ }, Nx = (e) => /(\[.*|\!\[.*)$/.test(e), Ox = (e) => /\)/.test(e), au = () => ({
22821
22832
  rendered: "",
22822
22833
  markdownTag: "",
22823
22834
  isWritingTag: !1,
22824
22835
  lastStreamSourceUuid: null
22825
22836
  });
22826
- class Ox {
22837
+ class Rx {
22827
22838
  buffers = /* @__PURE__ */ new Map();
22828
22839
  callbacks;
22829
22840
  constructor(t) {
@@ -22866,18 +22877,18 @@ class Ox {
22866
22877
  }
22867
22878
  /** Applies the existing markdown buffering rule before appending visible text. */
22868
22879
  appendDelta(t, n) {
22869
- if (Nx(n)) {
22880
+ if (Ox(n)) {
22870
22881
  t.markdownTag += n, t.rendered += t.markdownTag, t.markdownTag = "", t.isWritingTag = !1;
22871
22882
  return;
22872
22883
  }
22873
- if (t.isWritingTag || kx(n)) {
22884
+ if (t.isWritingTag || Nx(n)) {
22874
22885
  t.markdownTag += n, t.isWritingTag = !0;
22875
22886
  return;
22876
22887
  }
22877
22888
  t.rendered += n;
22878
22889
  }
22879
22890
  }
22880
- const Rx = 30, Lx = (e) => {
22891
+ const Lx = 30, Dx = (e) => {
22881
22892
  try {
22882
22893
  const t = e.split(".")[1];
22883
22894
  if (!t) return null;
@@ -22890,7 +22901,7 @@ const Rx = 30, Lx = (e) => {
22890
22901
  return null;
22891
22902
  }
22892
22903
  };
22893
- class Dx {
22904
+ class Px {
22894
22905
  token = null;
22895
22906
  expiresAt = null;
22896
22907
  pendingRequest = null;
@@ -22905,7 +22916,7 @@ class Dx {
22905
22916
  async getToken(t) {
22906
22917
  if (!this.provider) return null;
22907
22918
  const n = Math.floor(Date.now() / 1e3);
22908
- if (this.token && this.expiresAt != null && this.expiresAt - Rx > n)
22919
+ if (this.token && this.expiresAt != null && this.expiresAt - Lx > n)
22909
22920
  return this.token;
22910
22921
  if (this.pendingRequest) return this.pendingRequest;
22911
22922
  const r = this.generation;
@@ -22914,7 +22925,7 @@ class Dx {
22914
22925
  if (r !== this.generation) return null;
22915
22926
  if (!a)
22916
22927
  return this.clear(), null;
22917
- const s = Lx(a);
22928
+ const s = Dx(a);
22918
22929
  return s == null || s <= Math.floor(Date.now() / 1e3) ? (this.clear(), null) : (this.token = a, this.expiresAt = s, a);
22919
22930
  }).finally(() => {
22920
22931
  this.pendingRequest === i && (this.pendingRequest = null);
@@ -22931,7 +22942,7 @@ const dd = ({
22931
22942
  const r = On(), i = Qe(cd);
22932
22943
  e || r.error("App Token missing");
22933
22944
  const a = fe(null), s = fe(null), o = fe(i);
22934
- (!s.current || o.current !== i) && (o.current = i, s.current = new Dx(i)), Ee(() => {
22945
+ (!s.current || o.current !== i) && (o.current = i, s.current = new Px(i)), Ee(() => {
22935
22946
  const pe = s.current;
22936
22947
  if (!(!pe || !i))
22937
22948
  return pe.getToken({ interactive: !1 }).catch(() => pe.clear()), i.subscribe?.(() => {
@@ -22987,7 +22998,7 @@ const dd = ({
22987
22998
  showScrollButton: ye,
22988
22999
  messagesContainerRef: Ne,
22989
23000
  removeStickyNess: F
22990
- } = Ex(se.items), {
23001
+ } = Tx(se.items), {
22991
23002
  chatTransportMode: Q,
22992
23003
  isCustomerSupportMode: O,
22993
23004
  customerSupportStatusMessage: P,
@@ -23004,7 +23015,7 @@ const dd = ({
23004
23015
  closedHoursContactCaptureStatus: _t,
23005
23016
  shouldDisplayClosedHoursContactCapture: _d,
23006
23017
  submitClosedHoursContactCapture: xd
23007
- } = px({
23018
+ } = mx({
23008
23019
  appToken: e,
23009
23020
  currentConversation: se,
23010
23021
  loadingStatus: te,
@@ -23029,14 +23040,14 @@ const dd = ({
23029
23040
  },
23030
23041
  chatboxBootState: de,
23031
23042
  resetConversationRequestId: q
23032
- }), [hs, ui] = ae(!1), { start: Sd, stop: Cd, cancel: Ad, audioLevel: wd } = wx(), { companySettings: li } = Qe(fn), { appCurrentLang: ps } = Qe(rd), [vd, Id] = ae(() => {
23043
+ }), [hs, ui] = ae(!1), { start: Sd, stop: Cd, cancel: Ad, audioLevel: wd } = vx(), { companySettings: li } = Qe(fn), { appCurrentLang: ps } = Qe(rd), [vd, Id] = ae(() => {
23033
23044
  if (typeof window > "u") return !0;
23034
23045
  const pe = window.matchMedia("(pointer: coarse)"), Me = window.matchMedia("(hover: none)");
23035
23046
  return !(pe.matches || Me.matches);
23036
23047
  }), ci = fe(
23037
23048
  null
23038
23049
  );
23039
- ci.current || (ci.current = new Ox({
23050
+ ci.current || (ci.current = new Rx({
23040
23051
  addEmptyMessage: Ie,
23041
23052
  updateMessage: T,
23042
23053
  onAssistantMessageStart: () => ie("loadingDisplayedAnswer")
@@ -23240,7 +23251,7 @@ const dd = ({
23240
23251
  pe.temporaryId
23241
23252
  )),
23242
23253
  /* @__PURE__ */ k(
23243
- gx,
23254
+ bx,
23244
23255
  {
23245
23256
  currentStepName: qe,
23246
23257
  currentStepNumber: Tt,
@@ -23252,7 +23263,7 @@ const dd = ({
23252
23263
  }
23253
23264
  ),
23254
23265
  ye && /* @__PURE__ */ k(
23255
- xx,
23266
+ Sx,
23256
23267
  {
23257
23268
  label: Le,
23258
23269
  onClick: () => at({
@@ -23261,9 +23272,9 @@ const dd = ({
23261
23272
  })
23262
23273
  }
23263
23274
  ),
23264
- !O && ze && /* @__PURE__ */ k(_x, { onReset: j }),
23275
+ !O && ze && /* @__PURE__ */ k(xx, { onReset: j }),
23265
23276
  _d && We && /* @__PURE__ */ k(
23266
- Cx,
23277
+ Ax,
23267
23278
  {
23268
23279
  config: We,
23269
23280
  status: _t,
@@ -23284,7 +23295,7 @@ const dd = ({
23284
23295
  }
23285
23296
  ),
23286
23297
  dt && st && /* @__PURE__ */ k(
23287
- Sx,
23298
+ Cx,
23288
23299
  {
23289
23300
  config: st,
23290
23301
  status: nt,
@@ -23318,7 +23329,7 @@ const dd = ({
23318
23329
  }
23319
23330
  ),
23320
23331
  /* @__PURE__ */ k("div", { className: "chatbox-input-wrapper flex-shrink-0", children: hs ? /* @__PURE__ */ k(
23321
- Ix,
23332
+ kx,
23322
23333
  {
23323
23334
  isOpen: hs,
23324
23335
  onStop: Hd,
@@ -23362,12 +23373,12 @@ const dd = ({
23362
23373
  placeholder: u,
23363
23374
  autoFocus: vd,
23364
23375
  isLoadingStream: te === "loadingDisplayedAnswer" || te === "loadingIntermediaryStates",
23365
- LoadingComponent: bx,
23376
+ LoadingComponent: Ex,
23366
23377
  onPressLoadingButton: Pd,
23367
23378
  onPressMicButton: () => {
23368
23379
  Fd();
23369
23380
  },
23370
- MicComponent: Ax,
23381
+ MicComponent: wx,
23371
23382
  audioEnabled: li?.agent?.isAudioAllowed && !O
23372
23383
  }
23373
23384
  ) })
@@ -23407,7 +23418,7 @@ object-assign
23407
23418
  @license MIT
23408
23419
  */
23409
23420
  var ji, su;
23410
- function Px() {
23421
+ function Mx() {
23411
23422
  if (su) return ji;
23412
23423
  su = 1;
23413
23424
  var e = Object.getOwnPropertySymbols, t = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
@@ -23464,7 +23475,7 @@ function pd() {
23464
23475
  return uu || (uu = 1, Gi = Function.call.bind(Object.prototype.hasOwnProperty)), Gi;
23465
23476
  }
23466
23477
  var qi, lu;
23467
- function Mx() {
23478
+ function Bx() {
23468
23479
  if (lu) return qi;
23469
23480
  lu = 1;
23470
23481
  var e = function() {
@@ -23513,10 +23524,10 @@ function Mx() {
23513
23524
  }, qi = i, qi;
23514
23525
  }
23515
23526
  var Vi, cu;
23516
- function Bx() {
23527
+ function Fx() {
23517
23528
  if (cu) return Vi;
23518
23529
  cu = 1;
23519
- var e = Ra(), t = Px(), n = /* @__PURE__ */ ds(), r = /* @__PURE__ */ pd(), i = /* @__PURE__ */ Mx(), a = function() {
23530
+ var e = Ra(), t = Mx(), n = /* @__PURE__ */ ds(), r = /* @__PURE__ */ pd(), i = /* @__PURE__ */ Bx(), a = function() {
23520
23531
  };
23521
23532
  process.env.NODE_ENV !== "production" && (a = function(o) {
23522
23533
  var u = "Warning: " + o;
@@ -23834,7 +23845,7 @@ Valid keys: ` + JSON.stringify(Object.keys(m), null, " ")
23834
23845
  }, Vi;
23835
23846
  }
23836
23847
  var Wi, du;
23837
- function Fx() {
23848
+ function Hx() {
23838
23849
  if (du) return Wi;
23839
23850
  du = 1;
23840
23851
  var e = /* @__PURE__ */ ds();
@@ -23882,37 +23893,37 @@ function Fx() {
23882
23893
  }, Wi;
23883
23894
  }
23884
23895
  var fu;
23885
- function Hx() {
23896
+ function Ux() {
23886
23897
  if (fu) return Ar.exports;
23887
23898
  if (fu = 1, process.env.NODE_ENV !== "production") {
23888
23899
  var e = Ra(), t = !0;
23889
- Ar.exports = /* @__PURE__ */ Bx()(e.isElement, t);
23900
+ Ar.exports = /* @__PURE__ */ Fx()(e.isElement, t);
23890
23901
  } else
23891
- Ar.exports = /* @__PURE__ */ Fx()();
23902
+ Ar.exports = /* @__PURE__ */ Hx()();
23892
23903
  return Ar.exports;
23893
23904
  }
23894
- var Ux = /* @__PURE__ */ Hx();
23895
- const me = /* @__PURE__ */ ka(Ux);
23896
- function zx(e, t) {
23905
+ var zx = /* @__PURE__ */ Ux();
23906
+ const me = /* @__PURE__ */ ka(zx);
23907
+ function $x(e, t) {
23897
23908
  return e.classList ? !!t && e.classList.contains(t) : (" " + (e.className.baseVal || e.className) + " ").indexOf(" " + t + " ") !== -1;
23898
23909
  }
23899
- function $x(e, t) {
23900
- e.classList ? e.classList.add(t) : zx(e, t) || (typeof e.className == "string" ? e.className = e.className + " " + t : e.setAttribute("class", (e.className && e.className.baseVal || "") + " " + t));
23910
+ function jx(e, t) {
23911
+ e.classList ? e.classList.add(t) : $x(e, t) || (typeof e.className == "string" ? e.className = e.className + " " + t : e.setAttribute("class", (e.className && e.className.baseVal || "") + " " + t));
23901
23912
  }
23902
23913
  function hu(e, t) {
23903
23914
  return e.replace(new RegExp("(^|\\s)" + t + "(?:\\s|$)", "g"), "$1").replace(/\s+/g, " ").replace(/^\s*|\s*$/g, "");
23904
23915
  }
23905
- function jx(e, t) {
23916
+ function Yx(e, t) {
23906
23917
  e.classList ? e.classList.remove(t) : typeof e.className == "string" ? e.className = hu(e.className, t) : e.setAttribute("class", hu(e.className && e.className.baseVal || "", t));
23907
23918
  }
23908
23919
  const pu = {
23909
23920
  disabled: !1
23910
23921
  };
23911
- var Yx = process.env.NODE_ENV !== "production" ? me.oneOfType([me.number, me.shape({
23922
+ var Gx = process.env.NODE_ENV !== "production" ? me.oneOfType([me.number, me.shape({
23912
23923
  enter: me.number,
23913
23924
  exit: me.number,
23914
23925
  appear: me.number
23915
- }).isRequired]) : null, Gx = process.env.NODE_ENV !== "production" ? me.oneOfType([me.string, me.shape({
23926
+ }).isRequired]) : null, qx = process.env.NODE_ENV !== "production" ? me.oneOfType([me.string, me.shape({
23916
23927
  enter: me.string,
23917
23928
  exit: me.string,
23918
23929
  active: me.string
@@ -24152,7 +24163,7 @@ Mt.propTypes = process.env.NODE_ENV !== "production" ? {
24152
24163
  * @type {number | { enter?: number, exit?: number, appear?: number }}
24153
24164
  */
24154
24165
  timeout: function(t) {
24155
- var n = Yx;
24166
+ var n = Gx;
24156
24167
  t.addEndListener || (n = n.isRequired);
24157
24168
  for (var r = arguments.length, i = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
24158
24169
  i[a - 1] = arguments[a];
@@ -24246,13 +24257,13 @@ Mt.EXITED = rn;
24246
24257
  Mt.ENTERING = an;
24247
24258
  Mt.ENTERED = Sn;
24248
24259
  Mt.EXITING = va;
24249
- var qx = function(t, n) {
24260
+ var Vx = function(t, n) {
24250
24261
  return t && n && n.split(" ").forEach(function(r) {
24251
- return $x(t, r);
24262
+ return jx(t, r);
24252
24263
  });
24253
24264
  }, Xi = function(t, n) {
24254
24265
  return t && n && n.split(" ").forEach(function(r) {
24255
- return jx(t, r);
24266
+ return Yx(t, r);
24256
24267
  });
24257
24268
  }, fs = /* @__PURE__ */ (function(e) {
24258
24269
  hd(t, e);
@@ -24295,7 +24306,7 @@ var qx = function(t, n) {
24295
24306
  var n = t.prototype;
24296
24307
  return n.addClass = function(i, a, s) {
24297
24308
  var o = this.getClassNames(a)[s + "ClassName"], u = this.getClassNames("enter"), c = u.doneClassName;
24298
- a === "appear" && s === "done" && c && (o += " " + c), s === "active" && i && gd(i), o && (this.appliedClasses[a][s] = o, qx(i, o));
24309
+ a === "appear" && s === "done" && c && (o += " " + c), s === "active" && i && gd(i), o && (this.appliedClasses[a][s] = o, Vx(i, o));
24299
24310
  }, n.removeClasses = function(i, a) {
24300
24311
  var s = this.appliedClasses[a], o = s.base, u = s.active, c = s.done;
24301
24312
  this.appliedClasses[a] = {}, o && Xi(i, o), u && Xi(i, u), c && Xi(i, c);
@@ -24385,7 +24396,7 @@ fs.propTypes = process.env.NODE_ENV !== "production" ? jr({}, Mt.propTypes, {
24385
24396
  * exitDone?: string,
24386
24397
  * }}
24387
24398
  */
24388
- classNames: Gx,
24399
+ classNames: qx,
24389
24400
  /**
24390
24401
  * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
24391
24402
  * applied.
@@ -24456,7 +24467,7 @@ const bd = () => {
24456
24467
  startNewDiscussionTranslation: n,
24457
24468
  closeChatTranslation: r
24458
24469
  };
24459
- }, Vx = ({ setIsWidgetOpen: e }) => {
24470
+ }, Wx = ({ setIsWidgetOpen: e }) => {
24460
24471
  const { closeChatTranslation: t } = bd();
24461
24472
  return /* @__PURE__ */ k(zt, { children: /* @__PURE__ */ k(
24462
24473
  "button",
@@ -24575,7 +24586,7 @@ const bd = () => {
24575
24586
  ]
24576
24587
  }
24577
24588
  );
24578
- }, Wx = gu(
24589
+ }, Xx = gu(
24579
24590
  ({ props: e }, t) => {
24580
24591
  const { companySettings: n } = Qe(fn), { resetConversation: r } = cs(), i = n.agent?.customNameToDisplay || "Assistant";
24581
24592
  return /* @__PURE__ */ he(
@@ -24613,7 +24624,7 @@ const bd = () => {
24613
24624
  onStartNewDiscussion: r
24614
24625
  }
24615
24626
  ) }),
24616
- /* @__PURE__ */ k(Vx, { setIsWidgetOpen: e.setIsWidgetOpen })
24627
+ /* @__PURE__ */ k(Wx, { setIsWidgetOpen: e.setIsWidgetOpen })
24617
24628
  ]
24618
24629
  }
24619
24630
  ),
@@ -24622,7 +24633,7 @@ const bd = () => {
24622
24633
  }
24623
24634
  );
24624
24635
  }
24625
- ), Xx = ({
24636
+ ), Qx = ({
24626
24637
  isWidgetOpen: e,
24627
24638
  appToken: t,
24628
24639
  agentId: n,
@@ -24654,10 +24665,10 @@ const bd = () => {
24654
24665
  timeout: 200,
24655
24666
  classNames: "menuTransition",
24656
24667
  unmountOnExit: !0,
24657
- children: /* @__PURE__ */ k(Wx, { ref: i, props: { appToken: t, agentId: n, setIsWidgetOpen: r } })
24668
+ children: /* @__PURE__ */ k(Xx, { ref: i, props: { appToken: t, agentId: n, setIsWidgetOpen: r } })
24658
24669
  }
24659
24670
  ) });
24660
- }, Qx = () => {
24671
+ }, Kx = () => {
24661
24672
  const { resetConversation: e } = cs();
24662
24673
  return /* @__PURE__ */ k("div", { className: "relative z-20 flex justify-end px-2 pt-2", children: /* @__PURE__ */ k(
24663
24674
  Ed,
@@ -24669,7 +24680,7 @@ const bd = () => {
24669
24680
  }, Td = () => ({
24670
24681
  hasFetchedSettings: !1,
24671
24682
  hasDisplayedCSS: !1
24672
- }), Kx = () => {
24683
+ }), Zx = () => {
24673
24684
  const [e, t] = ae(Td());
24674
24685
  return {
24675
24686
  appInternalContext: e,
@@ -24693,7 +24704,7 @@ const bd = () => {
24693
24704
  },
24694
24705
  setHasFetchedSettings: () => {
24695
24706
  }
24696
- }), Zx = ({
24707
+ }), Jx = ({
24697
24708
  displayMode: e,
24698
24709
  appToken: t,
24699
24710
  agentId: n
@@ -24709,7 +24720,7 @@ const bd = () => {
24709
24720
  }
24710
24721
  ),
24711
24722
  /* @__PURE__ */ k(
24712
- Xx,
24723
+ Qx,
24713
24724
  {
24714
24725
  isWidgetOpen: r,
24715
24726
  appToken: t,
@@ -24719,44 +24730,44 @@ const bd = () => {
24719
24730
  )
24720
24731
  ] }),
24721
24732
  e === Nn.CHATBOX && a.hasFetchedSettings && /* @__PURE__ */ he("div", { className: "chatBox w-full max-w-[1200px] mx-auto", children: [
24722
- /* @__PURE__ */ k(Qx, {}),
24733
+ /* @__PURE__ */ k(Kx, {}),
24723
24734
  /* @__PURE__ */ k(dd, { appToken: t, agentId: n })
24724
24735
  ] })
24725
24736
  ] });
24726
- }, Jx = (e) => Object.values(Nn).includes(e), eS = (e) => {
24737
+ }, eS = (e) => Object.values(Nn).includes(e), tS = (e) => {
24727
24738
  const t = Lt();
24728
- return Jx(e) ? e : (t.warn(
24739
+ return eS(e) ? e : (t.warn(
24729
24740
  `Display mode not valid. Using ${Nn.LAUNCHER} as default.`
24730
24741
  ), Nn.LAUNCHER);
24731
- }, tS = (e, t) => {
24742
+ }, nS = (e, t) => {
24732
24743
  let n, r;
24733
24744
  return typeof window < "u" && (r = window.localStorage.getItem(
24734
24745
  O_
24735
24746
  )), r && e?.[r] !== void 0 ? n = e[r] : (n = e[t], n.isDefault = !0), n;
24736
- }, nS = (e, t) => {
24747
+ }, rS = (e, t) => {
24737
24748
  const [n, r] = ae(e[t]), i = (a) => {
24738
24749
  Object.keys(e).includes(a?.locale) ? r(a) : r(e[mt.ENGLISH]);
24739
24750
  };
24740
24751
  return Ee(() => {
24741
- let a = tS(e, t);
24752
+ let a = nS(e, t);
24742
24753
  a.locale !== t && r(e[a.locale]);
24743
24754
  }, []), {
24744
24755
  appCurrentLang: n,
24745
24756
  handleSetContextCurrentLang: i
24746
24757
  };
24747
- }, rS = (e) => Object.values(mt).includes(e), iS = (e, t) => {
24758
+ }, iS = (e) => Object.values(mt).includes(e), aS = (e, t) => {
24748
24759
  const n = t ?? Lt();
24749
- return rS(e) ? e : (n.warn(
24760
+ return iS(e) ? e : (n.warn(
24750
24761
  `Language ${e} not handled for now. Using ${mt.ENGLISH}.`
24751
24762
  ), mt.ENGLISH);
24752
24763
  };
24753
- function aS(e, t = Date.now()) {
24764
+ function sS(e, t = Date.now()) {
24754
24765
  return t - e;
24755
24766
  }
24756
- function sS(e, t = Date.now()) {
24757
- return aS(new Date(e).getTime(), t) <= Q_;
24767
+ function oS(e, t = Date.now()) {
24768
+ return sS(new Date(e).getTime(), t) <= K_;
24758
24769
  }
24759
- function oS({
24770
+ function uS({
24760
24771
  settings: e,
24761
24772
  setCurrentConversation: t,
24762
24773
  setArchivedConversation: n
@@ -24775,7 +24786,7 @@ function oS({
24775
24786
  });
24776
24787
  return;
24777
24788
  }
24778
- sS(r.updatedAt) ? t({
24789
+ oS(r.updatedAt) ? t({
24779
24790
  discussionId: r.discussionId,
24780
24791
  items: r.items,
24781
24792
  updatedAt: r.updatedAt
@@ -24794,7 +24805,7 @@ function oS({
24794
24805
  updatedAt: r.updatedAt
24795
24806
  }));
24796
24807
  }
24797
- const uS = ({
24808
+ const lS = ({
24798
24809
  agentId: e,
24799
24810
  appToken: t,
24800
24811
  onFetched: n
@@ -24813,7 +24824,7 @@ const uS = ({
24813
24824
  items: [],
24814
24825
  updatedAt: null
24815
24826
  }), [f, p] = ae(
24816
- () => ix()
24827
+ () => ax()
24817
24828
  ), [h, b] = ae(0), C = {
24818
24829
  currentConversation: o,
24819
24830
  setCurrentConversation: u,
@@ -24823,7 +24834,7 @@ const uS = ({
24823
24834
  setChatboxBootState: p,
24824
24835
  resetConversationRequestId: h,
24825
24836
  resetConversation: () => {
24826
- rx(), p({
24837
+ ix(), p({
24827
24838
  mode: Ot.ai,
24828
24839
  customerSupportState: null,
24829
24840
  reason: "manual_start_new_conversation"
@@ -24848,7 +24859,7 @@ const uS = ({
24848
24859
  let w = `${x}/company/settings/${t}`;
24849
24860
  w += `/${e}`, fetch(w, { ...I, credentials: "omit" }).then(async (R) => {
24850
24861
  const S = await R.json();
24851
- a(S), oS({
24862
+ a(S), uS({
24852
24863
  settings: S,
24853
24864
  setCurrentConversation: u,
24854
24865
  setArchivedConversation: d
@@ -24858,7 +24869,7 @@ const uS = ({
24858
24869
  });
24859
24870
  }, [t, e, r]), { contextCompanySettings: s, contextInitialConversationState: C };
24860
24871
  };
24861
- function lS(e, t = {}, n, r) {
24872
+ function cS(e, t = {}, n, r) {
24862
24873
  const i = On(), { id: a, nonce: s, target: o, disableConstructable: u } = t, c = o, d = fe(null), f = fe(null);
24863
24874
  Ee(() => {
24864
24875
  if (!o) return;
@@ -24887,14 +24898,14 @@ function lS(e, t = {}, n, r) {
24887
24898
  };
24888
24899
  }, [e, a, s, o, u, i]);
24889
24900
  }
24890
- function cS(e, t) {
24891
- const { manifest: n, origins: r } = dS(e, t);
24901
+ function dS(e, t) {
24902
+ const { manifest: n, origins: r } = fS(e, t);
24892
24903
  r.forEach(nf), af(n), tf(n);
24893
24904
  }
24894
- function dS(e, t) {
24895
- const n = t ?? Lt(), r = fS(e), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
24905
+ function fS(e, t) {
24906
+ const n = t ?? Lt(), r = hS(e), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
24896
24907
  for (const { url: d, mode: f } of r)
24897
- switch (hS(f, d, n)) {
24908
+ switch (pS(f, d, n)) {
24898
24909
  case "svg":
24899
24910
  a.add(d);
24900
24911
  break;
@@ -24913,10 +24924,10 @@ function dS(e, t) {
24913
24924
  svgs: Array.from(a),
24914
24925
  lotties: Array.from(s),
24915
24926
  sprites: Array.from(o)
24916
- }, c = pS(u, n);
24927
+ }, c = mS(u, n);
24917
24928
  return { manifest: u, origins: c };
24918
24929
  }
24919
- function fS(e) {
24930
+ function hS(e) {
24920
24931
  if (!e?.agent?.display) return [];
24921
24932
  const t = e.agent.display, n = [
24922
24933
  t.launcher,
@@ -24927,7 +24938,7 @@ function fS(e) {
24927
24938
  i?.assetUrl && r.push({ url: i.assetUrl, mode: i.mode });
24928
24939
  return r;
24929
24940
  }
24930
- function hS(e, t, n) {
24941
+ function pS(e, t, n) {
24931
24942
  if (e)
24932
24943
  switch (e) {
24933
24944
  case "svg":
@@ -24953,7 +24964,7 @@ function hS(e, t, n) {
24953
24964
  }
24954
24965
  return "unknown";
24955
24966
  }
24956
- function pS(e, t) {
24967
+ function mS(e, t) {
24957
24968
  const n = /* @__PURE__ */ new Set(), r = (i) => {
24958
24969
  if (i)
24959
24970
  try {
@@ -24965,7 +24976,7 @@ function pS(e, t) {
24965
24976
  };
24966
24977
  return (e.images ?? []).forEach(r), (e.svgs ?? []).forEach(r), (e.lotties ?? []).forEach(r), (e.sprites ?? []).forEach(r), Array.from(n);
24967
24978
  }
24968
- const mS = ({
24979
+ const gS = ({
24969
24980
  children: e,
24970
24981
  appToken: t,
24971
24982
  agentId: n,
@@ -24975,21 +24986,21 @@ const mS = ({
24975
24986
  }) => {
24976
24987
  var s = navigator.language;
24977
24988
  i.log("Brower language", s);
24978
- const o = iS(s, i), { appCurrentLang: u, handleSetContextCurrentLang: c } = nS(
24989
+ const o = aS(s, i), { appCurrentLang: u, handleSetContextCurrentLang: c } = rS(
24979
24990
  si,
24980
24991
  o
24981
24992
  ), d = {
24982
24993
  appCurrentLang: u,
24983
24994
  setAppCurrentLang: c
24984
- }, f = Kx(), { contextCompanySettings: p, contextInitialConversationState: h } = uS({
24995
+ }, f = Zx(), { contextCompanySettings: p, contextInitialConversationState: h } = lS({
24985
24996
  agentId: n,
24986
24997
  appToken: t,
24987
24998
  onFetched: f.setHasFetchedSettings
24988
24999
  });
24989
- return cS(
25000
+ return dS(
24990
25001
  p.companySettings,
24991
25002
  i
24992
- ), lS(
25003
+ ), cS(
24993
25004
  p.companySettings?.agent?.display?.CSSRules,
24994
25005
  { id: `${n}`, target: r },
24995
25006
  f.appInternalContext.hasFetchedSettings,
@@ -25010,7 +25021,7 @@ const mS = ({
25010
25021
  ) }) }) });
25011
25022
  };
25012
25023
  var Nn = /* @__PURE__ */ ((e) => (e.LAUNCHER = "launcher", e.CHATBOX = "chatbox", e))(Nn || {});
25013
- function gS({
25024
+ function bS({
25014
25025
  appToken: e,
25015
25026
  displayMode: t = "launcher",
25016
25027
  agentId: n,
@@ -25021,9 +25032,9 @@ function gS({
25021
25032
  e || a.warn(
25022
25033
  "appToken not defined in ai-client. Please see the documentation at URL_ERROR_IN_DOC"
25023
25034
  );
25024
- const s = eS(t);
25035
+ const s = tS(t);
25025
25036
  return a.log(`App boot in ${s} mode.`), /* @__PURE__ */ k("div", { className: "chatSystemWidget app-root", id: "chatSystemWidget", children: /* @__PURE__ */ k(
25026
- mS,
25037
+ gS,
25027
25038
  {
25028
25039
  appToken: e,
25029
25040
  agentId: n,
@@ -25031,7 +25042,7 @@ function gS({
25031
25042
  logger: a,
25032
25043
  identityProvider: i,
25033
25044
  children: /* @__PURE__ */ k(
25034
- Zx,
25045
+ Jx,
25035
25046
  {
25036
25047
  displayMode: s,
25037
25048
  appToken: e,
@@ -25041,7 +25052,7 @@ function gS({
25041
25052
  }
25042
25053
  ) });
25043
25054
  }
25044
- const bS = `*, ::before, ::after {
25055
+ const ES = `*, ::before, ::after {
25045
25056
  --tw-border-spacing-x: 0;
25046
25057
  --tw-border-spacing-y: 0;
25047
25058
  --tw-translate-x: 0;
@@ -26943,7 +26954,7 @@ video {
26943
26954
  padding-right: 6rem;
26944
26955
  }
26945
26956
  }
26946
- `, ES = `
26957
+ `, TS = `
26947
26958
  .chatBox {
26948
26959
  overflow-x: hidden; /* Hide horizontal scrollbar */
26949
26960
  overflow-wrap: anywhere;
@@ -27168,7 +27179,7 @@ video {
27168
27179
  width: 100%;
27169
27180
  }
27170
27181
  }
27171
- `, TS = `/* React-Css Transitions */
27182
+ `, yS = `/* React-Css Transitions */
27172
27183
  .menuTransition-enter {
27173
27184
  opacity: 0;
27174
27185
  transform: scale(0.9) translateX(200px);
@@ -27237,7 +27248,7 @@ textarea::placeholder {
27237
27248
  .messagesContainer {
27238
27249
  outline:none
27239
27250
  }
27240
- `, yS = `/* Core mic button */
27251
+ `, _S = `/* Core mic button */
27241
27252
  .mic-core {
27242
27253
  position: absolute;
27243
27254
  inset: 0;
@@ -27285,7 +27296,7 @@ textarea::placeholder {
27285
27296
  70% { opacity: 0.12; }
27286
27297
  100% { transform: scale(2.1); opacity: 0; }
27287
27298
  }
27288
- `, _S = `/* 1) Remove UA outline on the shadow host */
27299
+ `, xS = `/* 1) Remove UA outline on the shadow host */
27289
27300
  :host(:focus),
27290
27301
  :host(:focus-visible) { outline: none; }
27291
27302
 
@@ -27297,12 +27308,12 @@ textarea::placeholder {
27297
27308
 
27298
27309
  /* Ensure the wrapper itself doesn't get a default outline either */
27299
27310
  .app-root:focus { outline: none; }
27300
- `, mu = `${bS}
27301
- ${ES}
27311
+ `, mu = `${ES}
27302
27312
  ${TS}
27303
- ${_S}
27304
- ${yS}`;
27305
- function kS({
27313
+ ${yS}
27314
+ ${xS}
27315
+ ${_S}`;
27316
+ function NS({
27306
27317
  cssHref: e,
27307
27318
  appToken: t,
27308
27319
  agentId: n,
@@ -27350,7 +27361,7 @@ function kS({
27350
27361
  " ",
27351
27362
  c && Vd(
27352
27363
  /* @__PURE__ */ k(
27353
- gS,
27364
+ bS,
27354
27365
  {
27355
27366
  ...a,
27356
27367
  appToken: t,
@@ -27364,6 +27375,6 @@ function kS({
27364
27375
  ] });
27365
27376
  }
27366
27377
  export {
27367
- kS as App
27378
+ NS as App
27368
27379
  };
27369
27380
  //# sourceMappingURL=index.mjs.map