@opencx/widget-core 4.0.40 → 4.0.42

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.js CHANGED
@@ -1,43 +1,43 @@
1
- import D from "openapi-fetch";
2
- import N from "lodash.isequal";
3
- import { v4 as U } from "uuid";
4
- const F = (h) => {
5
- console.log(h.error);
6
- }, B = (h) => {
7
- const n = D({
8
- baseUrl: h.baseUrl
9
- }), o = {
10
- onRequest: h.onRequest,
11
- onResponse: h.onResponse,
12
- onError: h.onError || F
1
+ import N from "openapi-fetch";
2
+ import D from "lodash.isequal";
3
+ import { v4 as E } from "uuid";
4
+ const F = (_) => {
5
+ console.log(_.error);
6
+ }, V = (_) => {
7
+ const a = N({
8
+ baseUrl: _.baseUrl
9
+ }), n = {
10
+ onRequest: _.onRequest,
11
+ onResponse: _.onResponse,
12
+ onError: _.onError || F
13
13
  };
14
- return n.use(o), n;
14
+ return a.use(n), a;
15
15
  };
16
- class z {
17
- constructor({ config: n }) {
18
- var u, s;
16
+ class j {
17
+ constructor({ config: a }) {
18
+ var h, s;
19
19
  this.userToken = null, this.constructClientOptions = (e) => {
20
- const t = this.config.apiUrl || "https://api.open.cx", a = {
20
+ const t = this.config.apiUrl || "https://api.open.cx", o = {
21
21
  "X-Bot-Token": this.config.token,
22
22
  "Content-Type": "application/json",
23
23
  Accept: "application/json",
24
24
  Authorization: e ? `Bearer ${e}` : void 0
25
25
  };
26
- return { baseUrl: t, headers: a };
26
+ return { baseUrl: t, headers: o };
27
27
  }, this.createOpenAPIClient = ({
28
28
  baseUrl: e,
29
29
  headers: t
30
- }) => B({
30
+ }) => V({
31
31
  baseUrl: e,
32
- onRequest: ({ request: a }) => {
32
+ onRequest: ({ request: o }) => {
33
33
  Object.entries(t).forEach(([i, l]) => {
34
- l && a.headers.set(i, l);
34
+ l && o.headers.set(i, l);
35
35
  });
36
36
  }
37
37
  }), this.setAuthToken = (e) => {
38
38
  this.userToken = e;
39
- const { baseUrl: t, headers: a } = this.constructClientOptions(e);
40
- this.client = this.createOpenAPIClient({ baseUrl: t, headers: a });
39
+ const { baseUrl: t, headers: o } = this.constructClientOptions(e);
40
+ this.client = this.createOpenAPIClient({ baseUrl: t, headers: o });
41
41
  }, this.getExternalWidgetConfig = async () => await this.client.GET("/backend/widget/v2/config", {
42
42
  params: { header: { "X-Bot-Token": this.config.token } }
43
43
  }), this.sendMessage = async (e, t) => await this.client.POST("/backend/widget/v2/chat/send", {
@@ -54,109 +54,109 @@ class z {
54
54
  }), this.pollSessionAndHistory = async ({
55
55
  sessionId: e,
56
56
  lastMessageTimestamp: t,
57
- abortSignal: a
57
+ abortSignal: o
58
58
  }) => {
59
59
  const i = t ? { lastMessageTimestamp: t } : void 0;
60
60
  return await this.client.GET("/backend/widget/v2/poll/{sessionId}", {
61
61
  params: { path: { sessionId: e }, query: i },
62
- signal: a
62
+ signal: o
63
63
  });
64
64
  }, this.getSessions = async ({
65
65
  cursor: e,
66
66
  filters: t,
67
- abortSignal: a
67
+ abortSignal: o
68
68
  }) => await this.client.GET("/backend/widget/v2/sessions", {
69
69
  params: { query: { cursor: e, filters: JSON.stringify(t) } },
70
- signal: a
70
+ signal: o
71
71
  }), this.uploadFile = async ({
72
72
  file: e,
73
73
  abortSignal: t,
74
- onProgress: a
74
+ onProgress: o
75
75
  }) => new Promise((i, l) => {
76
76
  var y;
77
77
  const c = new FormData();
78
78
  c.append("file", e);
79
- const _ = new XMLHttpRequest();
79
+ const u = new XMLHttpRequest();
80
80
  if (t && (t.addEventListener("abort", () => {
81
- _.abort(), l(new DOMException("Aborted", "AbortError"));
81
+ u.abort(), l(new DOMException("Aborted", "AbortError"));
82
82
  }), t.aborted)) {
83
83
  l(new DOMException("Aborted", "AbortError"));
84
84
  return;
85
85
  }
86
- _.upload.addEventListener("progress", (v) => {
87
- if (v.lengthComputable && a) {
88
- const f = Math.round(v.loaded / v.total * 100);
89
- a(f);
86
+ u.upload.addEventListener("progress", (v) => {
87
+ if (v.lengthComputable && o) {
88
+ const b = Math.round(v.loaded / v.total * 100);
89
+ o(b);
90
90
  }
91
- }), _.addEventListener("load", () => {
92
- if (_.status >= 200 && _.status < 300)
91
+ }), u.addEventListener("load", () => {
92
+ if (u.status >= 200 && u.status < 300)
93
93
  try {
94
- const v = JSON.parse(_.responseText);
94
+ const v = JSON.parse(u.responseText);
95
95
  i(v);
96
96
  } catch (v) {
97
97
  l(new Error(`Failed to parse response: ${v}`));
98
98
  }
99
99
  else
100
- l(new Error(`Upload failed with status: ${_.status}`));
101
- }), _.addEventListener("error", () => {
100
+ l(new Error(`Upload failed with status: ${u.status}`));
101
+ }), u.addEventListener("error", () => {
102
102
  l(new Error("Network error occurred"));
103
- }), _.addEventListener("timeout", () => {
103
+ }), u.addEventListener("timeout", () => {
104
104
  l(new Error("Upload timed out"));
105
105
  });
106
106
  const { baseUrl: p } = this.constructClientOptions(this.userToken), d = `${p}/backend/widget/v2/upload`;
107
- _.open("POST", d), _.setRequestHeader("X-Bot-Token", this.config.token), this.userToken ?? ((y = this.config.user) == null ? void 0 : y.token) ? _.setRequestHeader("Authorization", `Bearer ${this.userToken}`) : console.error("User token not set"), _.send(c);
107
+ u.open("POST", d), u.setRequestHeader("X-Bot-Token", this.config.token), this.userToken ?? ((y = this.config.user) == null ? void 0 : y.token) ? u.setRequestHeader("Authorization", `Bearer ${this.userToken}`) : console.error("User token not set"), u.send(c);
108
108
  }), this.vote = async (e) => await this.client.POST("/backend/widget/v2/chat/vote", { body: e }), this.resolveSession = async (e, t) => await this.client.POST("/backend/widget/v2/session/resolve", {
109
109
  body: e,
110
110
  signal: t
111
111
  }), this.createStateCheckpoint = async (e) => await this.client.POST("/backend/widget/v2/checkpoint", {
112
112
  body: e
113
- }), this.submitCsat = async (e) => await this.client.POST("/backend/widget/v2/submit-csat", { body: e }), this.config = n, this.userToken = ((u = n.user) == null ? void 0 : u.token) || null;
114
- const { baseUrl: o, headers: r } = this.constructClientOptions(
115
- (s = n.user) == null ? void 0 : s.token
113
+ }), this.submitCsat = async (e) => await this.client.POST("/backend/widget/v2/submit-csat", { body: e }), this.config = a, this.userToken = ((h = a.user) == null ? void 0 : h.token) || null;
114
+ const { baseUrl: n, headers: r } = this.constructClientOptions(
115
+ (s = a.user) == null ? void 0 : s.token
116
116
  );
117
- this.client = this.createOpenAPIClient({ baseUrl: o, headers: r });
117
+ this.client = this.createOpenAPIClient({ baseUrl: n, headers: r });
118
118
  }
119
119
  }
120
- function V(h, n) {
121
- console.error(`Missing case for ${h} in ${n}`);
120
+ function B(_, a) {
121
+ console.error(`Missing case for ${_} in ${a}`);
122
122
  }
123
123
  class S {
124
- constructor(n) {
125
- this.subscribers = /* @__PURE__ */ new Set(), this.get = () => this.state, this.set = (o) => {
126
- N(this.state, o) || (this.state = o, this.notifySubscribers(o));
127
- }, this.setPartial = (o) => {
128
- if (o == null) return;
129
- const r = { ...this.state, ...o };
124
+ constructor(a) {
125
+ this.subscribers = /* @__PURE__ */ new Set(), this.get = () => this.state, this.set = (n) => {
126
+ D(this.state, n) || (this.state = n, this.notifySubscribers(n));
127
+ }, this.setPartial = (n) => {
128
+ if (n == null) return;
129
+ const r = { ...this.state, ...n };
130
130
  this.set(r);
131
131
  }, this.reset = () => {
132
132
  this.set(this.initialState);
133
- }, this.notifySubscribers = (o) => {
134
- Array.from(this.subscribers).forEach((u) => {
133
+ }, this.notifySubscribers = (n) => {
134
+ Array.from(this.subscribers).forEach((h) => {
135
135
  try {
136
- u(o);
136
+ h(n);
137
137
  } catch (s) {
138
138
  console.error(s);
139
139
  }
140
140
  });
141
- }, this.subscribe = (o) => (this.subscribers.add(o), () => {
142
- this.subscribers.delete(o);
143
- }), this.state = n, this.initialState = n;
141
+ }, this.subscribe = (n) => (this.subscribers.add(n), () => {
142
+ this.subscribers.delete(n);
143
+ }), this.state = a, this.initialState = a;
144
144
  }
145
145
  }
146
- class O {
146
+ class U {
147
147
  constructor() {
148
148
  this.state = new S({
149
149
  isPolling: !1,
150
150
  isError: !1
151
151
  }), this.abortController = new AbortController(), this.reset = () => {
152
- var n;
153
- this.abortController.abort("Resetting poller"), (n = this.stopPolling) == null || n.call(this), this.stopPolling = null;
154
- }, this.stopPolling = null, this.startPolling = (n, o) => {
152
+ var a;
153
+ this.abortController.abort("Resetting poller"), (a = this.stopPolling) == null || a.call(this), this.stopPolling = null;
154
+ }, this.stopPolling = null, this.startPolling = (a, n) => {
155
155
  if (this.stopPolling) return;
156
- const r = [], u = async () => {
156
+ const r = [], h = async () => {
157
157
  this.abortController = new AbortController(), this.state.setPartial({ isPolling: !0 });
158
158
  try {
159
- await n(this.abortController.signal);
159
+ await a(this.abortController.signal);
160
160
  } catch (s) {
161
161
  if (this.abortController.signal.aborted)
162
162
  return;
@@ -164,31 +164,31 @@ class O {
164
164
  } finally {
165
165
  this.state.setPartial({ isPolling: !1 });
166
166
  }
167
- this.abortController.signal.aborted ? console.log("Poller aborted, not scheduling anymore") : r.push(setTimeout(u, o));
167
+ this.abortController.signal.aborted ? console.log("Poller aborted, not scheduling anymore") : r.push(setTimeout(h, n));
168
168
  };
169
- u(), this.stopPolling = () => {
169
+ h(), this.stopPolling = () => {
170
170
  r.forEach(clearTimeout), this.state.reset();
171
171
  };
172
172
  };
173
173
  }
174
174
  }
175
- function j(h) {
175
+ function L(_) {
176
176
  try {
177
- const n = h();
178
- return n instanceof Promise ? n.then((o) => ({ data: o })).catch((o) => ({ error: o })) : { data: n };
179
- } catch (n) {
180
- return { error: n };
177
+ const a = _();
178
+ return a instanceof Promise ? a.then((n) => ({ data: n })).catch((n) => ({ error: n })) : { data: a };
179
+ } catch (a) {
180
+ return { error: a };
181
181
  }
182
182
  }
183
- class H {
183
+ class K {
184
184
  constructor({
185
- api: n,
186
- config: o,
185
+ api: a,
186
+ config: n,
187
187
  sessionCtx: r,
188
- messageCtx: u,
188
+ messageCtx: h,
189
189
  sessionPollingIntervalSeconds: s
190
190
  }) {
191
- this.poller = new O(), this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.registerPolling = () => {
191
+ this.poller = new U(), this.fetchSessionAndFullHistoryAbortController = new AbortController(), this.registerPolling = () => {
192
192
  this.sessionCtx.sessionState.subscribe(({ session: e }) => {
193
193
  e != null && e.id ? this.poller.startPolling(async (t) => {
194
194
  this.fetchSessionAndHistory({ sessionId: e.id, abortSignal: t });
@@ -210,18 +210,18 @@ class H {
210
210
  }, this.fetchSessionAndHistory = async ({
211
211
  sessionId: e,
212
212
  abortSignal: t,
213
- fetchFullHistory: a = !1
213
+ fetchFullHistory: o = !1
214
214
  }) => {
215
- var _;
215
+ var u;
216
216
  this.messageCtx.state.get().messages.length === 0 && this.messageCtx.state.setPartial({ isInitialFetchLoading: !0 });
217
- const i = this.messageCtx.state.get().messages, l = i.length > 0 ? ((_ = i[i.length - 1]) == null ? void 0 : _.timestamp) ?? void 0 : void 0, { data: c } = await this.api.pollSessionAndHistory({
217
+ const i = this.messageCtx.state.get().messages, l = i.length > 0 ? ((u = i[i.length - 1]) == null ? void 0 : u.timestamp) ?? void 0 : void 0, { data: c } = await this.api.pollSessionAndHistory({
218
218
  sessionId: e,
219
219
  abortSignal: t,
220
- lastMessageTimestamp: a ? void 0 : l
220
+ lastMessageTimestamp: o ? void 0 : l
221
221
  });
222
222
  if (c != null && c.session && (this.sessionCtx.sessionState.setPartial({ session: c.session }), this.sessionCtx.setSessions([c.session])), c != null && c.history && c.history.length > 0) {
223
223
  const p = this.messageCtx.state.get().messages, w = c.history.map(this.mapHistoryToMessage).filter((d) => d !== null).filter(
224
- (d) => !p.some((C) => C.id === d.id)
224
+ (d) => !p.some((k) => k.id === d.id)
225
225
  );
226
226
  this.messageCtx.state.setPartial({
227
227
  messages: [...p, ...w]
@@ -229,7 +229,7 @@ class H {
229
229
  }
230
230
  this.messageCtx.state.get().isInitialFetchLoading && this.messageCtx.state.setPartial({ isInitialFetchLoading: !1 });
231
231
  }, this.mapHistoryToMessage = (e) => {
232
- var a;
232
+ var o;
233
233
  const t = {
234
234
  id: e.publicId,
235
235
  timestamp: e.sentAt || "",
@@ -268,7 +268,7 @@ class H {
268
268
  component: "bot_message",
269
269
  agent: {
270
270
  id: null,
271
- name: ((a = this.config.bot) == null ? void 0 : a.name) || "",
271
+ name: ((o = this.config.bot) == null ? void 0 : o.name) || "",
272
272
  isAi: !0,
273
273
  // Do not set avatarUrl from config here... let it be taken from the config at render time
274
274
  avatarUrl: null,
@@ -326,7 +326,7 @@ class H {
326
326
  case "none":
327
327
  return null;
328
328
  default:
329
- return V(
329
+ return B(
330
330
  e.systemMessagePayload,
331
331
  this.constructSystemMessage.name
332
332
  ), null;
@@ -335,43 +335,43 @@ class H {
335
335
  const t = e.result;
336
336
  if (t === null || typeof t != "object") return t;
337
337
  if ("responseBodyText" in t && typeof t.responseBodyText == "string") {
338
- const a = t.responseBodyText, i = j(() => JSON.parse(a)).data;
338
+ const o = t.responseBodyText, i = L(() => JSON.parse(o)).data;
339
339
  if (i) return i;
340
340
  }
341
341
  return e.result;
342
- }, this.api = n, this.config = o, this.sessionCtx = r, this.messageCtx = u, this.sessionPollingIntervalSeconds = s, this.registerPolling();
342
+ }, this.api = a, this.config = n, this.sessionCtx = r, this.messageCtx = h, this.sessionPollingIntervalSeconds = s, this.registerPolling();
343
343
  }
344
344
  }
345
- class q {
345
+ class H {
346
346
  constructor({
347
- config: n,
348
- api: o,
347
+ config: a,
348
+ api: n,
349
349
  storageCtx: r
350
350
  }) {
351
- var u;
351
+ var h;
352
352
  this.shouldCollectData = () => {
353
353
  var s;
354
354
  return !!(!((s = this.state.get().contact) != null && s.token) && this.config.collectUserData);
355
355
  }, this.autoCreateUnverifiedUserIfNotExists = async () => {
356
- var s, e, t, a, i, l, c, _, p, w, d, C, y, v;
356
+ var s, e, t, o, i, l, c, u, p, w, d, k, y, v;
357
357
  if (!((s = this.config.user) != null && s.token)) {
358
358
  if (this.config.collectUserData && !((t = (e = this.config.user) == null ? void 0 : e.data) != null && t.email)) {
359
- if ((a = this.config.extraDataCollectionFields) != null && a.length)
359
+ if ((o = this.config.extraDataCollectionFields) != null && o.length)
360
360
  return;
361
- const f = await ((i = this.storageCtx) == null ? void 0 : i.getContactToken());
362
- f && await this.setUnverifiedContact(f);
361
+ const b = await ((i = this.storageCtx) == null ? void 0 : i.getContactToken());
362
+ b && await this.setUnverifiedContact(b);
363
363
  return;
364
364
  }
365
365
  if (!((c = (l = this.config.user) == null ? void 0 : l.data) != null && c.email)) {
366
- const f = await ((_ = this.storageCtx) == null ? void 0 : _.getContactToken());
367
- if (f) {
368
- await this.setUnverifiedContact(f);
366
+ const b = await ((u = this.storageCtx) == null ? void 0 : u.getContactToken());
367
+ if (b) {
368
+ await this.setUnverifiedContact(b);
369
369
  return;
370
370
  }
371
371
  }
372
372
  await this.createUnverifiedContact({
373
373
  email: (w = (p = this.config.user) == null ? void 0 : p.data) == null ? void 0 : w.email,
374
- non_verified_name: (C = (d = this.config.user) == null ? void 0 : d.data) == null ? void 0 : C.name,
374
+ non_verified_name: (k = (d = this.config.user) == null ? void 0 : d.data) == null ? void 0 : k.name,
375
375
  non_verified_custom_data: (v = (y = this.config.user) == null ? void 0 : y.data) == null ? void 0 : v.customData
376
376
  });
377
377
  }
@@ -388,14 +388,14 @@ class q {
388
388
  this.state.setPartial({ isCreatingUnverifiedContact: !1 });
389
389
  }
390
390
  }, this.setUnverifiedContact = async (s) => {
391
- var a, i, l, c;
392
- const e = await ((a = this.storageCtx) == null ? void 0 : a.getExternalContactId()), t = ((i = this.config.user) == null ? void 0 : i.externalId) || e || U();
391
+ var o, i, l, c;
392
+ const e = await ((o = this.storageCtx) == null ? void 0 : o.getExternalContactId()), t = ((i = this.config.user) == null ? void 0 : i.externalId) || e || E();
393
393
  this.api.setAuthToken(s), await ((l = this.storageCtx) == null ? void 0 : l.setContactToken(s)), await ((c = this.storageCtx) == null ? void 0 : c.setExternalContactId(t)), this.state.setPartial({ contact: { token: s, externalId: t } });
394
- }, this.config = n, this.storageCtx = r, this.api = o, this.state = new S({
395
- contact: (u = n.user) != null && u.token ? {
396
- token: n.user.token,
394
+ }, this.config = a, this.storageCtx = r, this.api = n, this.state = new S({
395
+ contact: (h = a.user) != null && h.token ? {
396
+ token: a.user.token,
397
397
  // Set optional externalId from config... not local storage
398
- externalId: n.user.externalId
398
+ externalId: a.user.externalId
399
399
  } : null,
400
400
  extraCollectedData: void 0,
401
401
  isCreatingUnverifiedContact: !1,
@@ -403,22 +403,22 @@ class q {
403
403
  }), this.autoCreateUnverifiedUserIfNotExists();
404
404
  }
405
405
  }
406
- function k() {
407
- return U();
406
+ function C() {
407
+ return E();
408
408
  }
409
- class Y {
409
+ class q {
410
410
  constructor({
411
- config: n,
412
- api: o,
411
+ config: a,
412
+ api: n,
413
413
  sessionCtx: r,
414
- messageCtx: u
414
+ messageCtx: h
415
415
  }) {
416
416
  this.submitCsat = async (s) => {
417
417
  var l;
418
418
  const e = (l = this.sessionCtx.sessionState.get().session) == null ? void 0 : l.id;
419
419
  if (!e)
420
420
  return { data: null, error: "No session id found" };
421
- const t = k();
421
+ const t = C();
422
422
  this.messageCtx.state.setPartial({
423
423
  messages: [
424
424
  ...this.messageCtx.state.get().messages,
@@ -436,23 +436,23 @@ class Y {
436
436
  }
437
437
  ]
438
438
  });
439
- const { data: a, error: i } = await this.api.submitCsat({
439
+ const { data: o, error: i } = await this.api.submitCsat({
440
440
  ...s,
441
441
  system_message_uuid: t,
442
442
  session_id: e
443
443
  });
444
- return { data: a, error: i };
445
- }, this.config = n, this.api = o, this.sessionCtx = r, this.messageCtx = u;
444
+ return { data: o, error: i };
445
+ }, this.config = a, this.api = n, this.sessionCtx = r, this.messageCtx = h;
446
446
  }
447
447
  }
448
- class K {
448
+ class J {
449
449
  constructor({
450
- config: n,
451
- api: o,
450
+ config: a,
451
+ api: n,
452
452
  contactCtx: r,
453
- sessionsPollingIntervalSeconds: u
453
+ sessionsPollingIntervalSeconds: h
454
454
  }) {
455
- this.sessionsRefresher = new O(), this.sessionState = new S({
455
+ this.sessionsRefresher = new U(), this.sessionState = new S({
456
456
  session: null,
457
457
  isCreatingSession: !1,
458
458
  isResolvingSession: !1
@@ -481,7 +481,7 @@ class K {
481
481
  Object.entries(this.config.sessionCustomData || {}).map(
482
482
  ([s, e]) => {
483
483
  var t;
484
- return typeof e == "string" ? [s, e] : typeof e == "boolean" ? [s, e] : typeof e == "number" ? [s, e] : [s, ((t = j(() => JSON.stringify(e))) == null ? void 0 : t.data) || ""];
484
+ return typeof e == "string" ? [s, e] : typeof e == "boolean" ? [s, e] : typeof e == "number" ? [s, e] : [s, ((t = L(() => JSON.stringify(e))) == null ? void 0 : t.data) || ""];
485
485
  }
486
486
  )
487
487
  ), this.createSession = async () => {
@@ -490,10 +490,10 @@ class K {
490
490
  const s = (i = this.contactCtx.state.get().contact) == null ? void 0 : i.externalId, e = {
491
491
  ...this.getParsedCustomData(),
492
492
  ...s ? { external_id: s } : {}
493
- }, { data: t, error: a } = await this.api.createSession({
493
+ }, { data: t, error: o } = await this.api.createSession({
494
494
  customData: Object.keys(e).length > 0 ? e : void 0
495
495
  });
496
- return t ? (this.sessionState.setPartial({ session: t, isCreatingSession: !1 }), t) : (this.sessionState.setPartial({ isCreatingSession: !1 }), console.error("Failed to create session:", a), null);
496
+ return t ? (this.sessionState.setPartial({ session: t, isCreatingSession: !1 }), t) : (this.sessionState.setPartial({ isCreatingSession: !1 }), console.error("Failed to create session:", o), null);
497
497
  }, this.loadMoreSessions = async () => {
498
498
  if (this.sessionsState.get().isLastPage) return;
499
499
  const { data: s } = await this.getSessions({
@@ -501,7 +501,7 @@ class K {
501
501
  });
502
502
  if (s) {
503
503
  const t = [...this.sessionsState.get().data, ...s.items].filter(
504
- (a, i, l) => i === l.findIndex((c) => a.id === c.id)
504
+ (o, i, l) => i === l.findIndex((c) => o.id === c.id)
505
505
  );
506
506
  this.sessionsState.setPartial({
507
507
  data: t,
@@ -510,9 +510,9 @@ class K {
510
510
  });
511
511
  }
512
512
  }, this.getSessions = async ({ cursor: s }) => {
513
- var t, a;
513
+ var t, o;
514
514
  if (!((t = this.contactCtx.state.get().contact) != null && t.token)) return { data: null };
515
- const e = (a = this.contactCtx.state.get().contact) == null ? void 0 : a.externalId;
515
+ const e = (o = this.contactCtx.state.get().contact) == null ? void 0 : o.externalId;
516
516
  return await this.api.getSessions({
517
517
  cursor: s,
518
518
  filters: e ? {
@@ -521,7 +521,7 @@ class K {
521
521
  });
522
522
  }, this.setSessions = (s) => {
523
523
  const e = [...s, ...this.sessionsState.get().data].filter(
524
- (t, a, i) => a === i.findIndex((l) => t.id === l.id)
524
+ (t, o, i) => o === i.findIndex((l) => t.id === l.id)
525
525
  );
526
526
  this.sessionsState.setPartial({ data: e });
527
527
  }, this.refreshSessions = async () => {
@@ -540,20 +540,20 @@ class K {
540
540
  var i;
541
541
  const e = (i = this.sessionState.get().session) == null ? void 0 : i.id;
542
542
  if (!e) return;
543
- const { data: t, error: a } = await this.api.createStateCheckpoint({
543
+ const { data: t, error: o } = await this.api.createStateCheckpoint({
544
544
  session_id: e,
545
545
  payload: s
546
546
  });
547
547
  return t != null && t.success ? { success: !0 } : { success: !1 };
548
- }, this.config = n, this.api = o, this.contactCtx = r, this.sessionsPollingIntervalSeconds = u, this.registerSessionsRefresherWrapper();
548
+ }, this.config = a, this.api = n, this.contactCtx = r, this.sessionsPollingIntervalSeconds = h, this.registerSessionsRefresherWrapper();
549
549
  }
550
550
  }
551
- class $ {
551
+ class Y {
552
552
  constructor({
553
- config: n,
554
- api: o,
553
+ config: a,
554
+ api: n,
555
555
  sessionCtx: r,
556
- contactCtx: u
556
+ contactCtx: h
557
557
  }) {
558
558
  this.state = new S({
559
559
  messages: [],
@@ -564,7 +564,7 @@ class $ {
564
564
  }), this.sendMessageAbortController = new AbortController(), this.reset = () => {
565
565
  this.sendMessageAbortController.abort("Resetting chat"), this.state.reset();
566
566
  }, this.sendMessage = async (s) => {
567
- var e, t, a, i, l, c, _, p, w;
567
+ var e, t, o, i, l, c, u, p, w;
568
568
  try {
569
569
  if (!s.content.trim() && (!s.attachments || s.attachments.length === 0)) {
570
570
  console.warn(
@@ -572,9 +572,9 @@ class $ {
572
572
  );
573
573
  return;
574
574
  }
575
- const d = this.sessionCtx.sessionState.get().session, y = (d == null ? void 0 : d.assignee.kind) === "ai", v = this.state.get().isSendingMessageToAI, f = this.state.get().messages.at(-1);
575
+ const d = this.sessionCtx.sessionState.get().session, y = (d == null ? void 0 : d.assignee.kind) === "ai", v = this.state.get().isSendingMessageToAI, b = this.state.get().messages.at(-1);
576
576
  if (v || // If last message is from user, then bot response did not arrive yet
577
- y && (f == null ? void 0 : f.type) === "USER") {
577
+ y && (b == null ? void 0 : b.type) === "USER") {
578
578
  console.warn("Cannot send messages while awaiting AI response");
579
579
  return;
580
580
  }
@@ -583,9 +583,9 @@ class $ {
583
583
  isSendingMessage: !0,
584
584
  isSendingMessageToAI: !!y || !d
585
585
  });
586
- const P = this.state.get().messages, A = !((e = this.sessionCtx.sessionState.get().session) != null && e.id) && P.length === 0 && ((t = this.config.advancedInitialMessages) == null ? void 0 : t.some((g) => g.persistent)), T = A ? (this.config.advancedInitialMessages || []).filter((g) => g.persistent).map(
586
+ const P = this.state.get().messages, z = !((e = this.sessionCtx.sessionState.get().session) != null && e.id) && P.length === 0 && ((t = this.config.advancedInitialMessages) == null ? void 0 : t.some((g) => g.persistent)), A = z ? (this.config.advancedInitialMessages || []).filter((g) => g.persistent).map(
587
587
  (g) => ({
588
- id: k(),
588
+ id: C(),
589
589
  component: "bot_message",
590
590
  type: "AI",
591
591
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -600,19 +600,19 @@ class $ {
600
600
  );
601
601
  if (this.state.setPartial({
602
602
  messages: [
603
- ...T,
603
+ ...A,
604
604
  ...P,
605
605
  I
606
606
  ]
607
- }), !((a = this.sessionCtx.sessionState.get().session) != null && a.id)) {
607
+ }), !((o = this.sessionCtx.sessionState.get().session) != null && o.id)) {
608
608
  if (!await this.sessionCtx.createSession()) {
609
609
  console.error("Failed to create session");
610
610
  return;
611
611
  }
612
612
  this.sessionCtx.refreshSessions();
613
613
  }
614
- const E = (i = this.sessionCtx.sessionState.get().session) == null ? void 0 : i.id;
615
- if (!E) return;
614
+ const T = (i = this.sessionCtx.sessionState.get().session) == null ? void 0 : i.id;
615
+ if (!T) return;
616
616
  const { data: m } = await this.api.sendMessage(
617
617
  {
618
618
  uuid: I.id,
@@ -620,7 +620,7 @@ class $ {
620
620
  headers: this.config.headers,
621
621
  query_params: this.config.queryParams,
622
622
  body_properties: this.config.bodyProperties,
623
- session_id: E,
623
+ session_id: T,
624
624
  content: I.content,
625
625
  attachments: s.attachments,
626
626
  clientContext: this.config.context,
@@ -630,7 +630,7 @@ class $ {
630
630
  },
631
631
  language: this.config.language,
632
632
  exit_mode_prompt: s.exitModePrompt,
633
- initial_messages: A ? T.map((g) => ({
633
+ initial_messages: z ? A.map((g) => ({
634
634
  uuid: g.id,
635
635
  content: g.data.message
636
636
  })) : void 0
@@ -642,7 +642,7 @@ class $ {
642
642
  if (g) {
643
643
  const x = this.state.get().messages;
644
644
  if (!!x.some(
645
- (L) => L.id === g.id
645
+ (R) => R.id === g.id
646
646
  )) {
647
647
  this.state.setPartial({
648
648
  lastAIResMightSolveUserIssue: ((l = m.autopilotResponse) == null ? void 0 : l.mightSolveUserIssue) || ((c = m.uiResponse) == null ? void 0 : c.mightSolveUserIssue)
@@ -651,7 +651,7 @@ class $ {
651
651
  }
652
652
  this.state.setPartial({
653
653
  messages: [...x, g],
654
- lastAIResMightSolveUserIssue: ((_ = m.autopilotResponse) == null ? void 0 : _.mightSolveUserIssue) || ((p = m.uiResponse) == null ? void 0 : p.mightSolveUserIssue)
654
+ lastAIResMightSolveUserIssue: ((u = m.autopilotResponse) == null ? void 0 : u.mightSolveUserIssue) || ((p = m.uiResponse) == null ? void 0 : p.mightSolveUserIssue)
655
655
  });
656
656
  }
657
657
  m.session && this.sessionCtx.sessionState.setPartial({ session: m.session });
@@ -673,14 +673,14 @@ class $ {
673
673
  }
674
674
  }, this.toUserMessage = (s, e) => {
675
675
  const t = (() => {
676
- const a = this.contactCtx.state.get().extraCollectedData;
677
- return this.state.get().messages.length === 0 && a && Object.keys(a).length > 0 ? `${Object.entries(a).filter(([l, c]) => !!c).map(([l, c]) => `${l}: ${c}`).join(`
676
+ const o = this.contactCtx.state.get().extraCollectedData;
677
+ return this.state.get().messages.length === 0 && o && Object.keys(o).length > 0 ? `${Object.entries(o).filter(([l, c]) => !!c).map(([l, c]) => `${l}: ${c}`).join(`
678
678
  `)}
679
679
 
680
680
  ${s}` : s;
681
681
  })();
682
682
  return {
683
- id: k(),
683
+ id: C(),
684
684
  type: "USER",
685
685
  content: t,
686
686
  deliveredAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -691,7 +691,7 @@ ${s}` : s;
691
691
  var e;
692
692
  return s.success && s.autopilotResponse ? {
693
693
  type: "AI",
694
- id: s.autopilotResponse.id || k(),
694
+ id: s.autopilotResponse.id || C(),
695
695
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
696
696
  component: "bot_message",
697
697
  agent: this.config.bot ? {
@@ -712,7 +712,7 @@ ${s}` : s;
712
712
  } : null;
713
713
  }, this.toBotErrorMessage = (s) => ({
714
714
  type: "AI",
715
- id: k(),
715
+ id: C(),
716
716
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
717
717
  component: "bot_message",
718
718
  data: {
@@ -720,15 +720,15 @@ ${s}` : s;
720
720
  variant: "error",
721
721
  action: void 0
722
722
  }
723
- }), this.config = n, this.api = o, this.sessionCtx = r, this.contactCtx = u;
723
+ }), this.config = a, this.api = n, this.sessionCtx = r, this.contactCtx = h;
724
724
  }
725
725
  }
726
- class G {
726
+ class $ {
727
727
  constructor({
728
- config: n,
729
- contactCtx: o,
728
+ config: a,
729
+ contactCtx: n,
730
730
  sessionCtx: r,
731
- resetChat: u
731
+ resetChat: h
732
732
  }) {
733
733
  var s;
734
734
  this.registerRoutingListener = () => {
@@ -739,12 +739,12 @@ class G {
739
739
  });
740
740
  }), this.sessionCtx.sessionsState.subscribe(
741
741
  ({ isInitialFetchLoading: e, data: t }) => {
742
- var a, i, l, c;
743
- if ((a = this.config.router) != null && a.chatScreenOnly && // Do not route to a chat if we are currently inside one already
742
+ var o, i, l, c;
743
+ if ((o = this.config.router) != null && o.chatScreenOnly && // Do not route to a chat if we are currently inside one already
744
744
  // This also applies to newly created sessions; the new session will be in `sessionState` before it is refreshed and included in `sessionsState`
745
745
  !((i = this.sessionCtx.sessionState.get().session) != null && i.id)) {
746
- const _ = (l = t.find((p) => p.isOpened)) == null ? void 0 : l.id;
747
- return _ ? this.toChatScreen(_) : void 0;
746
+ const u = (l = t.find((p) => p.isOpened)) == null ? void 0 : l.id;
747
+ return u ? this.toChatScreen(u) : void 0;
748
748
  }
749
749
  t.length || ((c = this.config.router) == null ? void 0 : c.goToChatIfNoSessions) !== !1 && !e && this.state.get().screen !== "chat" && this.toChatScreen();
750
750
  }
@@ -753,20 +753,20 @@ class G {
753
753
  this.resetChat(), this.state.setPartial({ screen: "sessions" });
754
754
  }, this.toChatScreen = (e) => {
755
755
  if (this.resetChat(), e) {
756
- const t = this.sessionCtx.sessionsState.get().data.find((a) => a.id === e);
756
+ const t = this.sessionCtx.sessionsState.get().data.find((o) => o.id === e);
757
757
  if (!t) return;
758
758
  this.sessionCtx.sessionState.setPartial({ session: t });
759
759
  }
760
760
  this.state.setPartial({ screen: "chat" });
761
- }, this.config = n, this.contactCtx = o, this.sessionCtx = r, this.resetChat = u, this.state = new S({
761
+ }, this.config = a, this.contactCtx = n, this.sessionCtx = r, this.resetChat = h, this.state = new S({
762
762
  screen: this.contactCtx.shouldCollectData() ? "welcome" : (s = this.config.router) != null && s.chatScreenOnly ? "chat" : "sessions"
763
763
  }), this.registerRoutingListener();
764
764
  }
765
765
  }
766
- class J {
766
+ class G {
767
767
  constructor({
768
- storage: n,
769
- config: o
768
+ storage: a,
769
+ config: n
770
770
  }) {
771
771
  this.KEYS = {
772
772
  contactToken: (r) => `opencx-widget:org-token-${r}:contact-token`,
@@ -775,48 +775,48 @@ class J {
775
775
  await this.storage.set(this.KEYS.contactToken(this.config.token), r);
776
776
  }, this.getContactToken = async () => this.storage.get(this.KEYS.contactToken(this.config.token)), this.setExternalContactId = async (r) => {
777
777
  await this.storage.set(this.KEYS.externalContactId(this.config.token), r);
778
- }, this.getExternalContactId = async () => this.storage.get(this.KEYS.externalContactId(this.config.token)), this.storage = n, this.config = o;
778
+ }, this.getExternalContactId = async () => this.storage.get(this.KEYS.externalContactId(this.config.token)), this.storage = a, this.config = n;
779
779
  }
780
780
  }
781
- const b = class b {
781
+ const f = class f {
782
782
  constructor({
783
- config: n,
784
- storage: o,
783
+ config: a,
784
+ storage: n,
785
785
  modes: r,
786
- org: u
786
+ org: h
787
787
  }) {
788
788
  if (this.modes = [], this.resetChat = () => {
789
789
  this.sessionCtx.reset(), this.messageCtx.reset();
790
- }, !b.pollingIntervalsSeconds)
790
+ }, !f.pollingIntervalsSeconds)
791
791
  throw Error(
792
792
  "Widget polling values are not defined, did you call WidgetCtx.initialize()"
793
793
  );
794
- this.config = n, this.org = u, this.api = new z({ config: n }), this.storageCtx = o ? new J({ storage: o, config: n }) : void 0, this.modes = r, this.contactCtx = new q({
794
+ this.config = a, this.org = h, this.api = new j({ config: a }), this.storageCtx = n ? new G({ storage: n, config: a }) : void 0, this.modes = r, this.contactCtx = new H({
795
795
  api: this.api,
796
796
  config: this.config,
797
797
  storageCtx: this.storageCtx
798
- }), this.sessionCtx = new K({
798
+ }), this.sessionCtx = new J({
799
799
  config: this.config,
800
800
  api: this.api,
801
801
  contactCtx: this.contactCtx,
802
- sessionsPollingIntervalSeconds: b.pollingIntervalsSeconds.sessions
803
- }), this.messageCtx = new $({
802
+ sessionsPollingIntervalSeconds: f.pollingIntervalsSeconds.sessions
803
+ }), this.messageCtx = new Y({
804
804
  config: this.config,
805
805
  api: this.api,
806
806
  sessionCtx: this.sessionCtx,
807
807
  contactCtx: this.contactCtx
808
- }), this.csatCtx = new Y({
808
+ }), this.csatCtx = new q({
809
809
  config: this.config,
810
810
  api: this.api,
811
811
  sessionCtx: this.sessionCtx,
812
812
  messageCtx: this.messageCtx
813
- }), this.activeSessionPollingCtx = new H({
813
+ }), this.activeSessionPollingCtx = new K({
814
814
  api: this.api,
815
815
  config: this.config,
816
816
  sessionCtx: this.sessionCtx,
817
817
  messageCtx: this.messageCtx,
818
- sessionPollingIntervalSeconds: b.pollingIntervalsSeconds.session
819
- }), this.routerCtx = new G({
818
+ sessionPollingIntervalSeconds: f.pollingIntervalsSeconds.session
819
+ }), this.routerCtx = new $({
820
820
  config: this.config,
821
821
  contactCtx: this.contactCtx,
822
822
  sessionCtx: this.sessionCtx,
@@ -824,22 +824,22 @@ const b = class b {
824
824
  });
825
825
  }
826
826
  };
827
- b.pollingIntervalsSeconds = null, b.initialize = async ({
828
- config: n,
829
- storage: o
827
+ f.pollingIntervalsSeconds = null, f.initialize = async ({
828
+ config: a,
829
+ storage: n
830
830
  }) => {
831
- var u, s, e;
832
- const r = await new z({
833
- config: n
831
+ var h, s, e;
832
+ const r = await new j({
833
+ config: a
834
834
  }).getExternalWidgetConfig();
835
835
  if (!r.data)
836
836
  throw new Error("Failed to fetch widget config");
837
- return b.pollingIntervalsSeconds = {
838
- session: ((u = r.data) == null ? void 0 : u.sessionPollingIntervalSeconds) || 10,
837
+ return f.pollingIntervalsSeconds = {
838
+ session: ((h = r.data) == null ? void 0 : h.sessionPollingIntervalSeconds) || 10,
839
839
  sessions: ((s = r.data) == null ? void 0 : s.sessionsPollingIntervalSeconds) || 60
840
- }, new b({
841
- config: n,
842
- storage: o,
840
+ }, new f({
841
+ config: a,
842
+ storage: n,
843
843
  modes: ((e = r.data) == null ? void 0 : e.modes) || [],
844
844
  org: {
845
845
  id: r.data.org.id,
@@ -847,7 +847,7 @@ b.pollingIntervalsSeconds = null, b.initialize = async ({
847
847
  }
848
848
  });
849
849
  };
850
- let M = b;
850
+ let M = f;
851
851
  const W = {
852
852
  write_a_message_placeholder: "اكتب رسالة...",
853
853
  your_issue_has_been_resolved: "تم حل مشكلتك!",
@@ -865,6 +865,22 @@ const W = {
865
865
  back_to_conversations: "العودة إلى المحادثات",
866
866
  closed_conversations: "المحادثات المغلقة"
867
867
  }, Z = {
868
+ write_a_message_placeholder: "একটি বার্তা লিখুন...",
869
+ your_issue_has_been_resolved: "আপনার সমস্যা সমাধান হয়েছে!",
870
+ new_conversation: "নতুন কথোপকথন",
871
+ welcome_screen_title: "আমাদের সাপোর্ট চ্যাটে স্বাগতম",
872
+ welcome_screen_description: "আমরা সাহায্য করতে এখানে আছি! একটি কথোপকথন শুরু করুন এবং আমরা যত তাড়াতাড়ি সম্ভব আপনার কাছে ফিরে আসব।",
873
+ your_name_placeholder: "আপনার নাম",
874
+ your_email_placeholder: "আপনার ইমেইল ঠিকানা",
875
+ start_chat_button: "সাপোর্টের সাথে কথা বলুন",
876
+ start_chat_button_loading: "সংযোগ হচ্ছে...",
877
+ i_need_more_help: "আমার আরও সাহায্য দরকার",
878
+ this_was_helpful: "এটি সহায়ক ছিল",
879
+ optional: "ঐচ্ছিক",
880
+ no_conversations_yet: "এখনো কোনো কথোপকথন নেই",
881
+ back_to_conversations: "কথোপকথনে ফিরে যান",
882
+ closed_conversations: "বন্ধ কথোপকথন"
883
+ }, X = {
868
884
  write_a_message_placeholder: "Напишете съобщение...",
869
885
  your_issue_has_been_resolved: "Вашият проблем е разрешен!",
870
886
  new_conversation: "Нов разговор",
@@ -880,7 +896,7 @@ const W = {
880
896
  no_conversations_yet: "Все още няма разговори",
881
897
  back_to_conversations: "Назад към разговорите",
882
898
  closed_conversations: "Затворени разговори"
883
- }, X = {
899
+ }, Q = {
884
900
  write_a_message_placeholder: "Napište zprávu...",
885
901
  your_issue_has_been_resolved: "Váš problém byl vyřešen!",
886
902
  new_conversation: "Nová konverzace",
@@ -896,7 +912,7 @@ const W = {
896
912
  no_conversations_yet: "Zatím žádné konverzace",
897
913
  back_to_conversations: "Zpět na konverzace",
898
914
  closed_conversations: "Uzavřené konverzace"
899
- }, Q = {
915
+ }, ee = {
900
916
  write_a_message_placeholder: "Skriv en besked...",
901
917
  your_issue_has_been_resolved: "Dit problem er løst!",
902
918
  new_conversation: "Ny samtale",
@@ -912,7 +928,7 @@ const W = {
912
928
  no_conversations_yet: "Ingen samtaler endnu",
913
929
  back_to_conversations: "Tilbage til samtaler",
914
930
  closed_conversations: "Lukkede samtaler"
915
- }, ee = {
931
+ }, te = {
916
932
  write_a_message_placeholder: "Γράψτε ένα μήνυμα...",
917
933
  your_issue_has_been_resolved: "Το πρόβλημά σας επιλύθηκε!",
918
934
  new_conversation: "Νέα συνομιλία",
@@ -928,7 +944,7 @@ const W = {
928
944
  no_conversations_yet: "Δεν υπάρχουν συνομιλίες ακόμα",
929
945
  back_to_conversations: "Πίσω στις συνομιλίες",
930
946
  closed_conversations: "Κλειστές συνομιλίες"
931
- }, te = {
947
+ }, se = {
932
948
  write_a_message_placeholder: "Nachricht schreiben...",
933
949
  your_issue_has_been_resolved: "Ihr Problem wurde gelöst!",
934
950
  new_conversation: "Neue Konversation",
@@ -944,7 +960,7 @@ const W = {
944
960
  no_conversations_yet: "noch keine Gespräche",
945
961
  back_to_conversations: "Zurück zur Konversationen",
946
962
  closed_conversations: "Geschlossene Konversationen"
947
- }, se = {
963
+ }, ae = {
948
964
  write_a_message_placeholder: "Write a message...",
949
965
  your_issue_has_been_resolved: "Your issue has been resolved!",
950
966
  new_conversation: "New conversation",
@@ -960,7 +976,7 @@ const W = {
960
976
  no_conversations_yet: "No conversations yet",
961
977
  back_to_conversations: "Back to conversations",
962
978
  closed_conversations: "Closed conversations"
963
- }, ne = {
979
+ }, oe = {
964
980
  write_a_message_placeholder: "Escribe un mensaje...",
965
981
  your_issue_has_been_resolved: "¡Tu problema fue resuelto!",
966
982
  new_conversation: "Nueva conversación",
@@ -976,7 +992,23 @@ const W = {
976
992
  no_conversations_yet: "Sin conversaciones aún",
977
993
  back_to_conversations: "Volver a conversaciones",
978
994
  closed_conversations: "Conversaciones cerradas"
979
- }, ae = {
995
+ }, ne = {
996
+ write_a_message_placeholder: "Magsulat ng mensahe...",
997
+ your_issue_has_been_resolved: "Nalutas na ang iyong isyu!",
998
+ new_conversation: "Bagong usapan",
999
+ welcome_screen_title: "Maligayang pagdating sa aming support chat",
1000
+ welcome_screen_description: "Narito kami upang tumulong! Magsimula ng usapan at babalikan ka namin sa lalong madaling panahon.",
1001
+ your_name_placeholder: "Iyong pangalan",
1002
+ your_email_placeholder: "Iyong email address",
1003
+ start_chat_button: "Makipag-usap sa support",
1004
+ start_chat_button_loading: "Kumokonekta...",
1005
+ i_need_more_help: "Kailangan ko pa ng tulong",
1006
+ this_was_helpful: "Nakatulong ito",
1007
+ optional: "Opsyonal",
1008
+ no_conversations_yet: "Wala pang mga usapan",
1009
+ back_to_conversations: "Bumalik sa mga usapan",
1010
+ closed_conversations: "Mga saradong usapan"
1011
+ }, ie = {
980
1012
  write_a_message_placeholder: "Kirjoita viesti...",
981
1013
  your_issue_has_been_resolved: "Ongelmasi on ratkaistu!",
982
1014
  new_conversation: "Uusi keskustelu",
@@ -992,7 +1024,7 @@ const W = {
992
1024
  no_conversations_yet: "Ei vielä keskusteluja",
993
1025
  back_to_conversations: "Takaisin keskusteluihin",
994
1026
  closed_conversations: "Suljetut keskustelut"
995
- }, oe = {
1027
+ }, re = {
996
1028
  write_a_message_placeholder: "Écrivez un message...",
997
1029
  your_issue_has_been_resolved: "Votre problème a été résolu !",
998
1030
  new_conversation: "Nouvelle conversation",
@@ -1008,7 +1040,23 @@ const W = {
1008
1040
  no_conversations_yet: "Aucune conversation pour le moment",
1009
1041
  back_to_conversations: "Retour aux conversations",
1010
1042
  closed_conversations: "Conversations fermées"
1011
- }, ie = {
1043
+ }, le = {
1044
+ write_a_message_placeholder: "एक संदेश लिखें...",
1045
+ your_issue_has_been_resolved: "आपकी समस्या हल हो गई है!",
1046
+ new_conversation: "नई बातचीत",
1047
+ welcome_screen_title: "हमारी सहायता चैट में आपका स्वागत है",
1048
+ welcome_screen_description: "हम मदद के लिए यहाँ हैं! बातचीत शुरू करें और हम जल्द से जल्द आपसे संपर्क करेंगे।",
1049
+ your_name_placeholder: "आपका नाम",
1050
+ your_email_placeholder: "आपका ईमेल पता",
1051
+ start_chat_button: "सहायता से बात करें",
1052
+ start_chat_button_loading: "कनेक्ट हो रहा है...",
1053
+ i_need_more_help: "मुझे और मदद चाहिए",
1054
+ this_was_helpful: "यह मददगार था",
1055
+ optional: "वैकल्पिक",
1056
+ no_conversations_yet: "अभी तक कोई बातचीत नहीं",
1057
+ back_to_conversations: "बातचीत पर वापस जाएं",
1058
+ closed_conversations: "बंद बातचीत"
1059
+ }, ce = {
1012
1060
  write_a_message_placeholder: "Scrivi un messaggio...",
1013
1061
  your_issue_has_been_resolved: "Il tuo problema è stato risolto!",
1014
1062
  new_conversation: "Nuova conversazione",
@@ -1024,7 +1072,39 @@ const W = {
1024
1072
  no_conversations_yet: "Nessuna conversazione ancora",
1025
1073
  back_to_conversations: "Torna alle conversazioni",
1026
1074
  closed_conversations: "Conversazioni chiuse"
1027
- }, re = {
1075
+ }, _e = {
1076
+ write_a_message_placeholder: "メッセージを入力...",
1077
+ your_issue_has_been_resolved: "問題が解決しました!",
1078
+ new_conversation: "新しい会話",
1079
+ welcome_screen_title: "サポートチャットへようこそ",
1080
+ welcome_screen_description: "お手伝いいたします!会話を開始していただければ、できるだけ早くご連絡いたします。",
1081
+ your_name_placeholder: "お名前",
1082
+ your_email_placeholder: "メールアドレス",
1083
+ start_chat_button: "サポートに相談",
1084
+ start_chat_button_loading: "接続中...",
1085
+ i_need_more_help: "さらにサポートが必要です",
1086
+ this_was_helpful: "役に立ちました",
1087
+ optional: "任意",
1088
+ no_conversations_yet: "まだ会話がありません",
1089
+ back_to_conversations: "会話一覧に戻る",
1090
+ closed_conversations: "終了した会話"
1091
+ }, he = {
1092
+ write_a_message_placeholder: "메시지를 입력하세요...",
1093
+ your_issue_has_been_resolved: "문제가 해결되었습니다!",
1094
+ new_conversation: "새 대화",
1095
+ welcome_screen_title: "고객 지원 채팅에 오신 것을 환영합니다",
1096
+ welcome_screen_description: "도움을 드리기 위해 여기 있습니다! 대화를 시작해 주시면 가능한 한 빨리 연락드리겠습니다.",
1097
+ your_name_placeholder: "이름",
1098
+ your_email_placeholder: "이메일 주소",
1099
+ start_chat_button: "상담원과 대화",
1100
+ start_chat_button_loading: "연결 중...",
1101
+ i_need_more_help: "추가 도움이 필요합니다",
1102
+ this_was_helpful: "도움이 되었습니다",
1103
+ optional: "선택 사항",
1104
+ no_conversations_yet: "아직 대화가 없습니다",
1105
+ back_to_conversations: "대화 목록으로 돌아가기",
1106
+ closed_conversations: "종료된 대화"
1107
+ }, ue = {
1028
1108
  write_a_message_placeholder: "Schrijf een bericht...",
1029
1109
  your_issue_has_been_resolved: "Uw probleem is opgelost!",
1030
1110
  new_conversation: "Nieuw gesprek",
@@ -1040,7 +1120,7 @@ const W = {
1040
1120
  no_conversations_yet: "Nog geen gesprekken",
1041
1121
  back_to_conversations: "Terug naar gesprekken",
1042
1122
  closed_conversations: "Afgesloten gesprekken"
1043
- }, le = {
1123
+ }, de = {
1044
1124
  write_a_message_placeholder: "Skriv en melding...",
1045
1125
  your_issue_has_been_resolved: "Problemet ditt er løst!",
1046
1126
  new_conversation: "Ny samtale",
@@ -1056,7 +1136,7 @@ const W = {
1056
1136
  no_conversations_yet: "Ingen samtaler ennå",
1057
1137
  back_to_conversations: "Tilbake til samtaler",
1058
1138
  closed_conversations: "Lukkede samtaler"
1059
- }, ce = {
1139
+ }, ge = {
1060
1140
  write_a_message_placeholder: "Napisz wiadomość...",
1061
1141
  your_issue_has_been_resolved: "Twój problem został rozwiązany!",
1062
1142
  new_conversation: "Nowa rozmowa",
@@ -1072,7 +1152,7 @@ const W = {
1072
1152
  no_conversations_yet: "Jeszcze brak rozmów",
1073
1153
  back_to_conversations: "Powrót do rozmów",
1074
1154
  closed_conversations: "Zamknięte rozmowy"
1075
- }, he = {
1155
+ }, me = {
1076
1156
  write_a_message_placeholder: "Escreva uma mensagem...",
1077
1157
  your_issue_has_been_resolved: "Seu problema foi resolvido!",
1078
1158
  new_conversation: "Nova conversa",
@@ -1088,7 +1168,7 @@ const W = {
1088
1168
  no_conversations_yet: "Nenhuma conversa ainda",
1089
1169
  back_to_conversations: "Voltar para conversas",
1090
1170
  closed_conversations: "Conversas fechadas"
1091
- }, ue = {
1171
+ }, pe = {
1092
1172
  write_a_message_placeholder: "Scrie un mesaj...",
1093
1173
  your_issue_has_been_resolved: "Problema ta a fost rezolvată!",
1094
1174
  new_conversation: "Conversație nouă",
@@ -1104,7 +1184,7 @@ const W = {
1104
1184
  no_conversations_yet: "Încă nu există conversații",
1105
1185
  back_to_conversations: "Înapoi la conversații",
1106
1186
  closed_conversations: "Conversații închise"
1107
- }, _e = {
1187
+ }, ve = {
1108
1188
  write_a_message_placeholder: "Skriv ett meddelande...",
1109
1189
  your_issue_has_been_resolved: "Ditt problem har lösts!",
1110
1190
  new_conversation: "Ny konversation",
@@ -1120,7 +1200,7 @@ const W = {
1120
1200
  no_conversations_yet: "Inga konversationer ännu",
1121
1201
  back_to_conversations: "Tillbaka till konversationer",
1122
1202
  closed_conversations: "Stängda konversationer"
1123
- }, de = {
1203
+ }, be = {
1124
1204
  write_a_message_placeholder: "Напишите сообщение...",
1125
1205
  your_issue_has_been_resolved: "Ваша проблема решена!",
1126
1206
  new_conversation: "Новый разговор",
@@ -1136,7 +1216,7 @@ const W = {
1136
1216
  no_conversations_yet: "Пока нет разговоров",
1137
1217
  back_to_conversations: "Назад к разговорам",
1138
1218
  closed_conversations: "Закрытые разговоры"
1139
- }, ge = {
1219
+ }, fe = {
1140
1220
  write_a_message_placeholder: "เขียนข้อความ...",
1141
1221
  your_issue_has_been_resolved: "ปัญหาของคุณได้รับการแก้ไขแล้ว!",
1142
1222
  new_conversation: "การสนทนาใหม่",
@@ -1152,7 +1232,7 @@ const W = {
1152
1232
  no_conversations_yet: "ยังไม่มีการสนทนา",
1153
1233
  back_to_conversations: "กลับไปที่การสนทนา",
1154
1234
  closed_conversations: "การสนทนาที่ปิดแล้ว"
1155
- }, me = {
1235
+ }, we = {
1156
1236
  write_a_message_placeholder: "Bir mesaj yazın...",
1157
1237
  your_issue_has_been_resolved: "Sorununuz çözüldü!",
1158
1238
  new_conversation: "Yeni konuşma",
@@ -1168,7 +1248,23 @@ const W = {
1168
1248
  no_conversations_yet: "Henüz konuşma yok",
1169
1249
  back_to_conversations: "Konuşmalara geri dön",
1170
1250
  closed_conversations: "Kapatılan konuşmalar"
1171
- }, pe = {
1251
+ }, ye = {
1252
+ write_a_message_placeholder: "پیغام لکھیں...",
1253
+ your_issue_has_been_resolved: "آپ کا مسئلہ حل ہو گیا ہے!",
1254
+ new_conversation: "نئی گفتگو",
1255
+ welcome_screen_title: "ہماری سپورٹ چیٹ میں خوش آمدید",
1256
+ welcome_screen_description: "ہم مدد کے لیے حاضر ہیں! گفتگو شروع کریں اور ہم جلد از جلد آپ سے رابطہ کریں گے۔",
1257
+ your_name_placeholder: "آپ کا نام",
1258
+ your_email_placeholder: "آپ کا ای میل پتہ",
1259
+ start_chat_button: "سپورٹ سے بات کریں",
1260
+ start_chat_button_loading: "جڑ رہا ہے...",
1261
+ i_need_more_help: "مجھے مزید مدد چاہیے",
1262
+ this_was_helpful: "یہ مددگار تھا",
1263
+ optional: "اختیاری",
1264
+ no_conversations_yet: "ابھی تک کوئی گفتگو نہیں",
1265
+ back_to_conversations: "گفتگو پر واپس جائیں",
1266
+ closed_conversations: "بند گفتگو"
1267
+ }, ke = {
1172
1268
  write_a_message_placeholder: "Viết tin nhắn...",
1173
1269
  your_issue_has_been_resolved: "Vấn đề của bạn đã được giải quyết!",
1174
1270
  new_conversation: "Cuộc trò chuyện mới",
@@ -1184,41 +1280,149 @@ const W = {
1184
1280
  no_conversations_yet: "Chưa có cuộc trò chuyện nào",
1185
1281
  back_to_conversations: "Quay lại cuộc trò chuyện",
1186
1282
  closed_conversations: "Cuộc trò chuyện đã đóng"
1187
- }, R = {
1283
+ }, Se = {
1284
+ write_a_message_placeholder: "写一条消息...",
1285
+ your_issue_has_been_resolved: "您的问题已解决!",
1286
+ new_conversation: "新对话",
1287
+ welcome_screen_title: "欢迎使用我们的客服聊天",
1288
+ welcome_screen_description: "我们随时为您提供帮助!开始对话,我们会尽快回复您。",
1289
+ your_name_placeholder: "您的姓名",
1290
+ your_email_placeholder: "您的电子邮件地址",
1291
+ start_chat_button: "联系客服",
1292
+ start_chat_button_loading: "连接中...",
1293
+ i_need_more_help: "我需要更多帮助",
1294
+ this_was_helpful: "这很有帮助",
1295
+ optional: "可选",
1296
+ no_conversations_yet: "暂无对话",
1297
+ back_to_conversations: "返回对话",
1298
+ closed_conversations: "已关闭的对话"
1299
+ }, Ce = {
1300
+ write_a_message_placeholder: "Napišite poruku...",
1301
+ your_issue_has_been_resolved: "Vaš problem je riješen!",
1302
+ new_conversation: "Novi razgovor",
1303
+ welcome_screen_title: "Dobrodošli u naš chat za podršku",
1304
+ welcome_screen_description: "Ovdje smo da pomognemo! Započnite razgovor i odgovorit ćemo vam što je prije moguće.",
1305
+ your_name_placeholder: "Vaše ime",
1306
+ your_email_placeholder: "Vaša e-mail adresa",
1307
+ start_chat_button: "Razgovarajte s podrškom",
1308
+ start_chat_button_loading: "Povezivanje...",
1309
+ i_need_more_help: "Trebam dodatnu pomoć",
1310
+ this_was_helpful: "Ovo je bilo korisno",
1311
+ optional: "Neobavezno",
1312
+ no_conversations_yet: "Još nema razgovora",
1313
+ back_to_conversations: "Natrag na razgovore",
1314
+ closed_conversations: "Zatvoreni razgovori"
1315
+ }, xe = {
1316
+ write_a_message_placeholder: "Kirjuta sõnum...",
1317
+ your_issue_has_been_resolved: "Teie probleem on lahendatud!",
1318
+ new_conversation: "Uus vestlus",
1319
+ welcome_screen_title: "Tere tulemast meie tugiteenusesse",
1320
+ welcome_screen_description: "Oleme siin, et aidata! Alustage vestlust ja vastame teile esimesel võimalusel.",
1321
+ your_name_placeholder: "Teie nimi",
1322
+ your_email_placeholder: "Teie e-posti aadress",
1323
+ start_chat_button: "Räägi toega",
1324
+ start_chat_button_loading: "Ühendamine...",
1325
+ i_need_more_help: "Vajan rohkem abi",
1326
+ this_was_helpful: "See oli kasulik",
1327
+ optional: "Valikuline",
1328
+ no_conversations_yet: "Vestlusi pole veel",
1329
+ back_to_conversations: "Tagasi vestluste juurde",
1330
+ closed_conversations: "Suletud vestlused"
1331
+ }, Ie = {
1332
+ write_a_message_placeholder: "Rakstiet ziņojumu...",
1333
+ your_issue_has_been_resolved: "Jūsu problēma ir atrisināta!",
1334
+ new_conversation: "Jauna saruna",
1335
+ welcome_screen_title: "Laipni lūdzam mūsu atbalsta tērzēšanā",
1336
+ welcome_screen_description: "Mēs esam šeit, lai palīdzētu! Sāciet sarunu, un mēs jums atbildēsim pēc iespējas ātrāk.",
1337
+ your_name_placeholder: "Jūsu vārds",
1338
+ your_email_placeholder: "Jūsu e-pasta adrese",
1339
+ start_chat_button: "Sazināties ar atbalstu",
1340
+ start_chat_button_loading: "Savienošana...",
1341
+ i_need_more_help: "Man vajag vairāk palīdzības",
1342
+ this_was_helpful: "Tas bija noderīgi",
1343
+ optional: "Neobligāts",
1344
+ no_conversations_yet: "Pagaidām nav sarunu",
1345
+ back_to_conversations: "Atpakaļ pie sarunām",
1346
+ closed_conversations: "Slēgtās sarunas"
1347
+ }, Pe = {
1348
+ write_a_message_placeholder: "Schreift eng Noriicht...",
1349
+ your_issue_has_been_resolved: "Äert Problem gouf geléist!",
1350
+ new_conversation: "Nei Konversatioun",
1351
+ welcome_screen_title: "Wëllkomm bei eisem Support-Chat",
1352
+ welcome_screen_description: "Mir sinn hei fir ze hëllefen! Start eng Konversatioun a mir äntweren Iech esou séier wéi méiglech.",
1353
+ your_name_placeholder: "Ären Numm",
1354
+ your_email_placeholder: "Är E-Mail-Adress",
1355
+ start_chat_button: "Mat dem Support schwätzen",
1356
+ start_chat_button_loading: "Verbindung...",
1357
+ i_need_more_help: "Ech brauch méi Hëllef",
1358
+ this_was_helpful: "Dat war hëllefräich",
1359
+ optional: "Fakultativ",
1360
+ no_conversations_yet: "Nach keng Konversatiounen",
1361
+ back_to_conversations: "Zréck zu de Konversatiounen",
1362
+ closed_conversations: "Zougemaachte Konversatiounen"
1363
+ }, ze = {
1364
+ write_a_message_placeholder: "Ikteb messaġġ...",
1365
+ your_issue_has_been_resolved: "Il-problema tiegħek ġiet riżolta!",
1366
+ new_conversation: "Konversazzjoni ġdida",
1367
+ welcome_screen_title: "Merħba fis-support chat tagħna",
1368
+ welcome_screen_description: "Aħna hawn biex ngħinu! Ibda konversazzjoni u nirrispondu malajr kemm jista' jkun.",
1369
+ your_name_placeholder: "Ismek",
1370
+ your_email_placeholder: "L-indirizz tal-email tiegħek",
1371
+ start_chat_button: "Kellem lis-support",
1372
+ start_chat_button_loading: "Qed jikkonnettja...",
1373
+ i_need_more_help: "Għandi bżonn aktar għajnuna",
1374
+ this_was_helpful: "Dan kien ta' għajnuna",
1375
+ optional: "Mhux obbligatorju",
1376
+ no_conversations_yet: "Għad m'hemmx konversazzjonijiet",
1377
+ back_to_conversations: "Lura għall-konversazzjonijiet",
1378
+ closed_conversations: "Konversazzjonijiet magħluqa"
1379
+ }, O = {
1188
1380
  ar: W,
1189
- bg: Z,
1190
- cs: X,
1191
- da: Q,
1192
- de: te,
1193
- el: ee,
1194
- en: se,
1195
- es: ne,
1196
- fi: ae,
1197
- fr: oe,
1198
- it: ie,
1199
- nl: re,
1200
- no: le,
1201
- pl: ce,
1202
- pt: he,
1203
- ro: ue,
1204
- ru: de,
1205
- sv: _e,
1206
- th: ge,
1207
- tr: me,
1208
- vi: pe
1209
- }, ve = Object.keys(R);
1210
- function Ce(h) {
1211
- return ve.includes(h);
1381
+ bn: Z,
1382
+ bg: X,
1383
+ cs: Q,
1384
+ da: ee,
1385
+ de: se,
1386
+ el: te,
1387
+ en: ae,
1388
+ es: oe,
1389
+ et: xe,
1390
+ fi: ie,
1391
+ fil: ne,
1392
+ fr: re,
1393
+ hi: le,
1394
+ hr: Ce,
1395
+ it: ce,
1396
+ ja: _e,
1397
+ ko: he,
1398
+ lb: Pe,
1399
+ lv: Ie,
1400
+ mt: ze,
1401
+ nl: ue,
1402
+ no: de,
1403
+ pl: ge,
1404
+ pt: me,
1405
+ ro: pe,
1406
+ ru: be,
1407
+ sv: ve,
1408
+ th: fe,
1409
+ tr: we,
1410
+ ur: ye,
1411
+ vi: ke,
1412
+ "zh-cn": Se
1413
+ }, Ae = Object.keys(O);
1414
+ function Ue(_) {
1415
+ return Ae.includes(_);
1212
1416
  }
1213
- function Se(h, n, o) {
1417
+ function Le(_, a, n) {
1214
1418
  var r;
1215
- return ((r = o == null ? void 0 : o[n]) == null ? void 0 : r[h]) || R[n][h] || "";
1419
+ return ((r = n == null ? void 0 : n[a]) == null ? void 0 : r[_]) || O[a][_] || "";
1216
1420
  }
1217
1421
  export {
1218
1422
  S as PrimitiveState,
1219
1423
  M as WidgetCtx,
1220
- Se as getTranslation,
1221
- V as isExhaustive,
1222
- Ce as isSupportedLanguage
1424
+ Le as getTranslation,
1425
+ B as isExhaustive,
1426
+ Ue as isSupportedLanguage
1223
1427
  };
1224
1428
  //# sourceMappingURL=index.js.map