@tracktor/shared-module 2.30.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import ie from "axios";
2
- import we, { useMemo as te, createContext as ge, useContext as C, useEffect as L, useState as D, Suspense as Ee, useRef as X, useCallback as P } from "react";
3
- const Ke = (e, t) => {
4
- const n = ie.CancelToken.source(), s = ie({
2
+ import ve, { useMemo as ne, createContext as ge, useContext as k, useEffect as L, useState as D, Suspense as Ee, useRef as ee, useCallback as O } from "react";
3
+ const qe = (e, t) => {
4
+ const n = ie.CancelToken.source(), o = ie({
5
5
  ...e,
6
6
  ...t,
7
7
  cancelToken: n.token
8
- }).then(({ data: o }) => o);
9
- return s.cancel = () => {
8
+ }).then(({ data: s }) => s);
9
+ return o.cancel = () => {
10
10
  n.cancel("Query was cancelled");
11
- }, s;
12
- }, ve = 3e4, ce = 1e3, Z = (e) => Array.isArray(e) ? e.map(Z) : e !== null && typeof e == "object" ? Object.fromEntries(
11
+ }, o;
12
+ }, we = 3e4, ce = 1e3, te = (e) => Array.isArray(e) ? e.map(te) : e !== null && typeof e == "object" ? Object.fromEntries(
13
13
  Object.entries(e).map(([t, n]) => [
14
- t.replace(/_([a-z])/g, (s, o) => o.toUpperCase()),
15
- Z(n)
14
+ t.replace(/_([a-z])/g, (o, s) => s.toUpperCase()),
15
+ te(n)
16
16
  ])
17
- ) : e, ee = (e) => Array.isArray(e) ? e.map(ee) : e !== null && typeof e == "object" ? Object.fromEntries(
17
+ ) : e, re = (e) => Array.isArray(e) ? e.map(re) : e !== null && typeof e == "object" ? Object.fromEntries(
18
18
  Object.entries(e).map(([t, n]) => [
19
- t.replace(/[A-Z]/g, (s) => `_${s.toLowerCase()}`),
20
- ee(n)
19
+ t.replace(/[A-Z]/g, (o) => `_${o.toLowerCase()}`),
20
+ re(n)
21
21
  ])
22
22
  ) : e;
23
23
  class _e {
@@ -50,12 +50,12 @@ class _e {
50
50
  if (!t)
51
51
  return;
52
52
  this.intentionalClose = !1;
53
- const n = this.url.includes("?") ? "&" : "?", s = `${this.url}${n}token=${t}`;
54
- this.ws = new WebSocket(s), this.ws.onopen = () => {
53
+ const n = this.url.includes("?") ? "&" : "?", o = `${this.url}${n}token=${t}`;
54
+ this.ws = new WebSocket(o), this.ws.onopen = () => {
55
55
  this._connected = !0, this.reconnectAttempt = 0, this.onConnectionChange?.(!0), this.rejoinThreads(), this.flushPendingMessages();
56
- }, this.ws.onmessage = (o) => {
56
+ }, this.ws.onmessage = (s) => {
57
57
  try {
58
- const a = JSON.parse(o.data), c = Z(a);
58
+ const a = JSON.parse(s.data), c = te(a);
59
59
  c.type === "ready" && (this._ready = !0), this.onEvent?.(c);
60
60
  } catch {
61
61
  }
@@ -89,7 +89,7 @@ class _e {
89
89
  this.pendingMessages.push(t);
90
90
  return;
91
91
  }
92
- this.ws.send(JSON.stringify(ee(t)));
92
+ this.ws.send(JSON.stringify(re(t)));
93
93
  }
94
94
  flushPendingMessages() {
95
95
  const t = [...this.pendingMessages];
@@ -103,7 +103,7 @@ class _e {
103
103
  }
104
104
  scheduleReconnect() {
105
105
  this.clearReconnectTimer();
106
- const t = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, ve);
106
+ const t = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, we);
107
107
  this.reconnectAttempt++, this.reconnectTimer = setTimeout(() => {
108
108
  this.connect();
109
109
  }, t);
@@ -112,50 +112,50 @@ class _e {
112
112
  this.reconnectTimer !== null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
113
113
  }
114
114
  }
115
- var V = { exports: {} }, M = {};
115
+ var J = { exports: {} }, U = {};
116
116
  var le;
117
117
  function Re() {
118
- if (le) return M;
118
+ if (le) return U;
119
119
  le = 1;
120
120
  var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
121
- function n(s, o, a) {
121
+ function n(o, s, a) {
122
122
  var c = null;
123
- if (a !== void 0 && (c = "" + a), o.key !== void 0 && (c = "" + o.key), "key" in o) {
123
+ if (a !== void 0 && (c = "" + a), s.key !== void 0 && (c = "" + s.key), "key" in s) {
124
124
  a = {};
125
- for (var u in o)
126
- u !== "key" && (a[u] = o[u]);
127
- } else a = o;
128
- return o = a.ref, {
125
+ for (var l in s)
126
+ l !== "key" && (a[l] = s[l]);
127
+ } else a = s;
128
+ return s = a.ref, {
129
129
  $$typeof: e,
130
- type: s,
130
+ type: o,
131
131
  key: c,
132
- ref: o !== void 0 ? o : null,
132
+ ref: s !== void 0 ? s : null,
133
133
  props: a
134
134
  };
135
135
  }
136
- return M.Fragment = t, M.jsx = n, M.jsxs = n, M;
136
+ return U.Fragment = t, U.jsx = n, U.jsxs = n, U;
137
137
  }
138
- var U = {};
138
+ var z = {};
139
139
  var ue;
140
- function be() {
140
+ function Te() {
141
141
  return ue || (ue = 1, process.env.NODE_ENV !== "production" && (function() {
142
142
  function e(r) {
143
143
  if (r == null) return null;
144
144
  if (typeof r == "function")
145
- return r.$$typeof === K ? null : r.displayName || r.name || null;
145
+ return r.$$typeof === w ? null : r.displayName || r.name || null;
146
146
  if (typeof r == "string") return r;
147
147
  switch (r) {
148
- case k:
148
+ case _:
149
149
  return "Fragment";
150
150
  case d:
151
151
  return "Profiler";
152
- case g:
152
+ case h:
153
153
  return "StrictMode";
154
- case O:
154
+ case x:
155
155
  return "Suspense";
156
- case J:
156
+ case K:
157
157
  return "SuspenseList";
158
- case x:
158
+ case B:
159
159
  return "Activity";
160
160
  }
161
161
  if (typeof r == "object")
@@ -164,16 +164,16 @@ function be() {
164
164
  ), r.$$typeof) {
165
165
  case A:
166
166
  return "Portal";
167
- case _:
167
+ case E:
168
168
  return r.displayName || "Context";
169
- case T:
169
+ case b:
170
170
  return (r._context.displayName || "Context") + ".Consumer";
171
171
  case S:
172
172
  var p = r.render;
173
173
  return r = r.displayName, r || (r = p.displayName || p.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
174
- case G:
174
+ case q:
175
175
  return p = r.displayName || null, p !== null ? p : e(r.type) || "Memo";
176
- case w:
176
+ case Y:
177
177
  p = r._payload, r = r._init;
178
178
  try {
179
179
  return e(r(p));
@@ -194,17 +194,17 @@ function be() {
194
194
  }
195
195
  if (p) {
196
196
  p = console;
197
- var E = p.error, R = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
198
- return E.call(
197
+ var v = p.error, R = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
198
+ return v.call(
199
199
  p,
200
200
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
201
201
  R
202
202
  ), t(r);
203
203
  }
204
204
  }
205
- function s(r) {
206
- if (r === k) return "<>";
207
- if (typeof r == "object" && r !== null && r.$$typeof === w)
205
+ function o(r) {
206
+ if (r === _) return "<>";
207
+ if (typeof r == "object" && r !== null && r.$$typeof === Y)
208
208
  return "<...>";
209
209
  try {
210
210
  var p = e(r);
@@ -213,49 +213,49 @@ function be() {
213
213
  return "<...>";
214
214
  }
215
215
  }
216
- function o() {
217
- var r = Y.A;
216
+ function s() {
217
+ var r = C.A;
218
218
  return r === null ? null : r.getOwner();
219
219
  }
220
220
  function a() {
221
221
  return Error("react-stack-top-frame");
222
222
  }
223
223
  function c(r) {
224
- if (N.call(r, "key")) {
224
+ if (V.call(r, "key")) {
225
225
  var p = Object.getOwnPropertyDescriptor(r, "key").get;
226
226
  if (p && p.isReactWarning) return !1;
227
227
  }
228
228
  return r.key !== void 0;
229
229
  }
230
- function u(r, p) {
231
- function E() {
232
- re || (re = !0, console.error(
230
+ function l(r, p) {
231
+ function v() {
232
+ N || (N = !0, console.error(
233
233
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
234
234
  p
235
235
  ));
236
236
  }
237
- E.isReactWarning = !0, Object.defineProperty(r, "key", {
238
- get: E,
237
+ v.isReactWarning = !0, Object.defineProperty(r, "key", {
238
+ get: v,
239
239
  configurable: !0
240
240
  });
241
241
  }
242
- function l() {
242
+ function u() {
243
243
  var r = e(this.type);
244
- return ne[r] || (ne[r] = !0, console.error(
244
+ return $[r] || ($[r] = !0, console.error(
245
245
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
246
246
  )), r = this.props.ref, r !== void 0 ? r : null;
247
247
  }
248
- function f(r, p, E, R, W, B) {
249
- var b = E.ref;
248
+ function f(r, p, v, R, Q, X) {
249
+ var T = v.ref;
250
250
  return r = {
251
- $$typeof: v,
251
+ $$typeof: j,
252
252
  type: r,
253
253
  key: p,
254
- props: E,
254
+ props: v,
255
255
  _owner: R
256
- }, (b !== void 0 ? b : null) !== null ? Object.defineProperty(r, "ref", {
256
+ }, (T !== void 0 ? T : null) !== null ? Object.defineProperty(r, "ref", {
257
257
  enumerable: !1,
258
- get: l
258
+ get: u
259
259
  }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
260
260
  configurable: !1,
261
261
  enumerable: !1,
@@ -270,33 +270,33 @@ function be() {
270
270
  configurable: !1,
271
271
  enumerable: !1,
272
272
  writable: !0,
273
- value: W
273
+ value: Q
274
274
  }), Object.defineProperty(r, "_debugTask", {
275
275
  configurable: !1,
276
276
  enumerable: !1,
277
277
  writable: !0,
278
- value: B
278
+ value: X
279
279
  }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
280
280
  }
281
- function i(r, p, E, R, W, B) {
282
- var b = p.children;
283
- if (b !== void 0)
281
+ function i(r, p, v, R, Q, X) {
282
+ var T = p.children;
283
+ if (T !== void 0)
284
284
  if (R)
285
- if ($(b)) {
286
- for (R = 0; R < b.length; R++)
287
- h(b[R]);
288
- Object.freeze && Object.freeze(b);
285
+ if (H(T)) {
286
+ for (R = 0; R < T.length; R++)
287
+ g(T[R]);
288
+ Object.freeze && Object.freeze(T);
289
289
  } else
290
290
  console.error(
291
291
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
292
292
  );
293
- else h(b);
294
- if (N.call(p, "key")) {
295
- b = e(r);
293
+ else g(T);
294
+ if (V.call(p, "key")) {
295
+ T = e(r);
296
296
  var F = Object.keys(p).filter(function(ye) {
297
297
  return ye !== "key";
298
298
  });
299
- R = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", ae[b + R] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
299
+ R = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", ae[T + R] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
300
300
  `A props object containing a "key" prop is being spread into JSX:
301
301
  let props = %s;
302
302
  <%s {...props} />
@@ -304,35 +304,35 @@ React keys must be passed directly to JSX without using spread:
304
304
  let props = %s;
305
305
  <%s key={someKey} {...props} />`,
306
306
  R,
307
- b,
307
+ T,
308
308
  F,
309
- b
310
- ), ae[b + R] = !0);
309
+ T
310
+ ), ae[T + R] = !0);
311
311
  }
312
- if (b = null, E !== void 0 && (n(E), b = "" + E), c(p) && (n(p.key), b = "" + p.key), "key" in p) {
313
- E = {};
314
- for (var H in p)
315
- H !== "key" && (E[H] = p[H]);
316
- } else E = p;
317
- return b && u(
318
- E,
312
+ if (T = null, v !== void 0 && (n(v), T = "" + v), c(p) && (n(p.key), T = "" + p.key), "key" in p) {
313
+ v = {};
314
+ for (var Z in p)
315
+ Z !== "key" && (v[Z] = p[Z]);
316
+ } else v = p;
317
+ return T && l(
318
+ v,
319
319
  typeof r == "function" ? r.displayName || r.name || "Unknown" : r
320
320
  ), f(
321
321
  r,
322
- b,
323
- E,
324
- o(),
325
- W,
326
- B
322
+ T,
323
+ v,
324
+ s(),
325
+ Q,
326
+ X
327
327
  );
328
328
  }
329
- function h(r) {
330
- m(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === w && (r._payload.status === "fulfilled" ? m(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
329
+ function g(r) {
330
+ m(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === Y && (r._payload.status === "fulfilled" ? m(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
331
331
  }
332
332
  function m(r) {
333
- return typeof r == "object" && r !== null && r.$$typeof === v;
333
+ return typeof r == "object" && r !== null && r.$$typeof === j;
334
334
  }
335
- var y = we, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), k = /* @__PURE__ */ Symbol.for("react.fragment"), g = /* @__PURE__ */ Symbol.for("react.strict_mode"), d = /* @__PURE__ */ Symbol.for("react.profiler"), T = /* @__PURE__ */ Symbol.for("react.consumer"), _ = /* @__PURE__ */ Symbol.for("react.context"), S = /* @__PURE__ */ Symbol.for("react.forward_ref"), O = /* @__PURE__ */ Symbol.for("react.suspense"), J = /* @__PURE__ */ Symbol.for("react.suspense_list"), G = /* @__PURE__ */ Symbol.for("react.memo"), w = /* @__PURE__ */ Symbol.for("react.lazy"), x = /* @__PURE__ */ Symbol.for("react.activity"), K = /* @__PURE__ */ Symbol.for("react.client.reference"), Y = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, $ = Array.isArray, q = console.createTask ? console.createTask : function() {
335
+ var y = ve, j = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), _ = /* @__PURE__ */ Symbol.for("react.fragment"), h = /* @__PURE__ */ Symbol.for("react.strict_mode"), d = /* @__PURE__ */ Symbol.for("react.profiler"), b = /* @__PURE__ */ Symbol.for("react.consumer"), E = /* @__PURE__ */ Symbol.for("react.context"), S = /* @__PURE__ */ Symbol.for("react.forward_ref"), x = /* @__PURE__ */ Symbol.for("react.suspense"), K = /* @__PURE__ */ Symbol.for("react.suspense_list"), q = /* @__PURE__ */ Symbol.for("react.memo"), Y = /* @__PURE__ */ Symbol.for("react.lazy"), B = /* @__PURE__ */ Symbol.for("react.activity"), w = /* @__PURE__ */ Symbol.for("react.client.reference"), C = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, H = Array.isArray, M = console.createTask ? console.createTask : function() {
336
336
  return null;
337
337
  };
338
338
  y = {
@@ -340,72 +340,72 @@ React keys must be passed directly to JSX without using spread:
340
340
  return r();
341
341
  }
342
342
  };
343
- var re, ne = {}, oe = y.react_stack_bottom_frame.bind(
343
+ var N, $ = {}, oe = y.react_stack_bottom_frame.bind(
344
344
  y,
345
345
  a
346
- )(), se = q(s(a)), ae = {};
347
- U.Fragment = k, U.jsx = function(r, p, E) {
348
- var R = 1e4 > Y.recentlyCreatedOwnerStacks++;
346
+ )(), se = M(o(a)), ae = {};
347
+ z.Fragment = _, z.jsx = function(r, p, v) {
348
+ var R = 1e4 > C.recentlyCreatedOwnerStacks++;
349
349
  return i(
350
350
  r,
351
351
  p,
352
- E,
352
+ v,
353
353
  !1,
354
354
  R ? Error("react-stack-top-frame") : oe,
355
- R ? q(s(r)) : se
355
+ R ? M(o(r)) : se
356
356
  );
357
- }, U.jsxs = function(r, p, E) {
358
- var R = 1e4 > Y.recentlyCreatedOwnerStacks++;
357
+ }, z.jsxs = function(r, p, v) {
358
+ var R = 1e4 > C.recentlyCreatedOwnerStacks++;
359
359
  return i(
360
360
  r,
361
361
  p,
362
- E,
362
+ v,
363
363
  !0,
364
364
  R ? Error("react-stack-top-frame") : oe,
365
- R ? q(s(r)) : se
365
+ R ? M(o(r)) : se
366
366
  );
367
367
  };
368
- })()), U;
368
+ })()), z;
369
369
  }
370
370
  var de;
371
- function Te() {
372
- return de || (de = 1, process.env.NODE_ENV === "production" ? V.exports = Re() : V.exports = be()), V.exports;
371
+ function be() {
372
+ return de || (de = 1, process.env.NODE_ENV === "production" ? J.exports = Re() : J.exports = Te()), J.exports;
373
373
  }
374
- var I = Te();
375
- const qe = ({ IMaskMixin: e, ...t }) => {
376
- const n = te(
374
+ var I = be();
375
+ const Be = ({ IMaskMixin: e, ...t }) => {
376
+ const n = ne(
377
377
  // eslint-disable-next-line react/jsx-props-no-spreading
378
- () => e(({ TextField: s, ...o }) => /* @__PURE__ */ I.jsx(s, { ...o })),
378
+ () => e(({ TextField: o, ...s }) => /* @__PURE__ */ I.jsx(o, { ...s })),
379
379
  [e]
380
380
  );
381
381
  return /* @__PURE__ */ I.jsx(n, { ...t });
382
- }, j = ge({}), Be = ({ children: e, apiURL: t, libraries: n, localStorageKeys: s }) => {
383
- const o = te(
382
+ }, P = ge({}), He = ({ children: e, apiURL: t, libraries: n, localStorageKeys: o }) => {
383
+ const s = ne(
384
384
  () => ({
385
385
  apiURL: t,
386
386
  libraries: n,
387
- localStorageKeys: s
387
+ localStorageKeys: o
388
388
  }),
389
- [t, n, s]
389
+ [t, n, o]
390
390
  );
391
- return /* @__PURE__ */ I.jsx(j.Provider, { value: o, children: e });
392
- }, He = ({ data: e, ...t }) => {
393
- const { libraries: n } = C(j), s = t?.reactRouter || n?.reactRouter, o = t?.gtm || n?.gtm;
394
- if (!s)
391
+ return /* @__PURE__ */ I.jsx(P.Provider, { value: s, children: e });
392
+ }, Xe = ({ data: e, ...t }) => {
393
+ const { libraries: n } = k(P), o = t?.reactRouter || n?.reactRouter, s = t?.gtm || n?.gtm;
394
+ if (!o)
395
395
  throw new Error(
396
396
  "React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
397
397
  );
398
- if (!o)
398
+ if (!s)
399
399
  throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
400
- const { useGoogleTagManager: a } = o, { useLocation: c, Outlet: u } = s, { pathname: l } = c(), { sendEvent: f } = a();
400
+ const { useGoogleTagManager: a } = s, { useLocation: c, Outlet: l } = o, { pathname: u } = c(), { sendEvent: f } = a();
401
401
  return L(() => {
402
402
  f({
403
403
  event: "pageView",
404
- pathname: l,
404
+ pathname: u,
405
405
  ...e
406
406
  });
407
- }, [e, l, f]), /* @__PURE__ */ I.jsx(u, {});
408
- }, z = (() => {
407
+ }, [e, u, f]), /* @__PURE__ */ I.jsx(l, {});
408
+ }, W = (() => {
409
409
  try {
410
410
  return typeof global == "object" && global !== null && ("HermesInternal" in global || // Hermes JS engine
411
411
  "__fbBatchedBridge" in global || // RN Bridge
@@ -413,43 +413,43 @@ const qe = ({ IMaskMixin: e, ...t }) => {
413
413
  } catch {
414
414
  return !1;
415
415
  }
416
- })(), Ae = "user", Xe = ({
416
+ })(), Se = "user", Ze = ({
417
417
  tokenTypeKey: e = "tokenType",
418
418
  tokenKey: t = "accessToken",
419
419
  postContentType: n = "application/json",
420
- ...s
420
+ ...o
421
421
  }) => {
422
- const { apiURL: o = s.apiURL, libraries: a, localStorageKeys: c } = C(j), u = s?.userLocalStorageKey || c?.user || Ae, l = s?.axios || a?.axios;
423
- if (!l)
422
+ const { apiURL: s = o.apiURL, libraries: a, localStorageKeys: c } = k(P), l = o?.userLocalStorageKey || c?.user || Se, u = o?.axios || a?.axios;
423
+ if (!u)
424
424
  throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
425
- if (!l?.defaults || z)
425
+ if (!u?.defaults || W)
426
426
  return null;
427
427
  if (typeof window < "u" && window.localStorage) {
428
- const f = localStorage.getItem(u), i = f ? JSON.parse(f) : null, h = i?.[e] ? i[e] : null, m = i?.[t] ? i[t] : null, y = f ? `${h} ${m}` : null;
429
- y && (l.defaults.headers.common.Authorization = y);
428
+ const f = localStorage.getItem(l), i = f ? JSON.parse(f) : null, g = i?.[e] ? i[e] : null, m = i?.[t] ? i[t] : null, y = f ? `${g} ${m}` : null;
429
+ y && (u.defaults.headers.common.Authorization = y);
430
430
  }
431
- return l.defaults.baseURL = o, l.defaults.headers.post["Content-Type"] = n, null;
432
- }, Ze = ({ language: e, ...t }) => {
433
- const { libraries: n } = C(j), s = t?.dayjs || n?.dayjs, o = t?.plugin || n?.dayjsPlugin;
434
- if (!s)
431
+ return u.defaults.baseURL = s, u.defaults.headers.post["Content-Type"] = n, null;
432
+ }, et = ({ language: e, ...t }) => {
433
+ const { libraries: n } = k(P), o = t?.dayjs || n?.dayjs, s = t?.plugin || n?.dayjsPlugin;
434
+ if (!o)
435
435
  throw new Error(
436
436
  "Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
437
437
  );
438
438
  return L(() => {
439
439
  (async () => {
440
440
  const c = e || navigator.language?.slice(0, 2) || "en";
441
- o && o.forEach((u) => {
442
- u && s.extend(u);
443
- }), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), s.locale(c);
441
+ s && s.forEach((l) => {
442
+ l && o.extend(l);
443
+ }), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), o.locale(c);
444
444
  })().then();
445
- }, [s, o, e]), null;
446
- }, et = ({ debug: e, resources: t, ...n }) => {
447
- const { libraries: s } = C(j), o = n?.i18 || s?.i18, { i18next: a, initReactI18next: c, languageDetector: u } = o || {};
448
- if (z)
445
+ }, [o, s, e]), null;
446
+ }, tt = ({ debug: e, resources: t, ...n }) => {
447
+ const { libraries: o } = k(P), s = n?.i18 || o?.i18, { i18next: a, initReactI18next: c, languageDetector: l } = s || {};
448
+ if (W)
449
449
  return null;
450
- if (!o)
450
+ if (!s)
451
451
  throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
452
- return a?.isInitialized || (a.use(u).use(c).init({
452
+ return a?.isInitialized || (a.use(l).use(c).init({
453
453
  debug: e,
454
454
  fallbackLng: "en",
455
455
  interpolation: {
@@ -464,34 +464,34 @@ const qe = ({ IMaskMixin: e, ...t }) => {
464
464
  returnNull: !1
465
465
  }).then(() => {
466
466
  document.documentElement.lang !== a.resolvedLanguage && a.resolvedLanguage && document.documentElement.setAttribute("lang", a.resolvedLanguage);
467
- }), a.on("languageChanged", (l) => {
468
- document.documentElement.setAttribute("lang", l);
467
+ }), a.on("languageChanged", (u) => {
468
+ document.documentElement.setAttribute("lang", u);
469
469
  })), null;
470
- }, tt = ({
470
+ }, rt = ({
471
471
  dsn: e,
472
472
  integrations: t,
473
473
  tracesSampleRate: n,
474
- replaysSessionSampleRate: s,
475
- replaysOnErrorSampleRate: o,
474
+ replaysSessionSampleRate: o,
475
+ replaysOnErrorSampleRate: s,
476
476
  tracePropagationTargets: a,
477
477
  ignoreErrors: c,
478
- debug: u,
479
- environment: l,
478
+ debug: l,
479
+ environment: u,
480
480
  release: f,
481
481
  ...i
482
482
  }) => {
483
- const { libraries: h } = C(j), m = i?.sentry || h?.sentry, y = i?.reactRouter || h?.reactRouter;
483
+ const { libraries: g } = k(P), m = i?.sentry || g?.sentry, y = i?.reactRouter || g?.reactRouter;
484
484
  if (!m)
485
485
  throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
486
486
  if (!y)
487
487
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
488
488
  if (m.isInitialized())
489
489
  return null;
490
- const { createRoutesFromChildren: v, matchRoutes: A, useLocation: k, useNavigationType: g } = y;
491
- return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && m.init({
492
- debug: u,
490
+ const { createRoutesFromChildren: j, matchRoutes: A, useLocation: _, useNavigationType: h } = y;
491
+ return (l || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && m.init({
492
+ debug: l,
493
493
  dsn: e,
494
- environment: l || "production",
494
+ environment: u || "production",
495
495
  ignoreErrors: [
496
496
  ...c || [],
497
497
  /dynamically imported module/,
@@ -503,82 +503,82 @@ const qe = ({ IMaskMixin: e, ...t }) => {
503
503
  ],
504
504
  integrations: [
505
505
  m.reactRouterV6BrowserTracingIntegration({
506
- createRoutesFromChildren: v,
506
+ createRoutesFromChildren: j,
507
507
  matchRoutes: A,
508
508
  useEffect: L,
509
- useLocation: k,
510
- useNavigationType: g
509
+ useLocation: _,
510
+ useNavigationType: h
511
511
  }),
512
512
  ...t || []
513
513
  ],
514
514
  release: f,
515
- replaysOnErrorSampleRate: o || 1,
516
- replaysSessionSampleRate: s || 0.1,
515
+ replaysOnErrorSampleRate: s || 1,
516
+ replaysSessionSampleRate: o || 0.1,
517
517
  tracePropagationTargets: a,
518
518
  tracesSampleRate: n || 1
519
519
  }), null;
520
- }, rt = () => (L(() => {
521
- if (z)
520
+ }, nt = () => (L(() => {
521
+ if (W)
522
522
  return;
523
523
  const e = (t) => {
524
524
  try {
525
- t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation(), window.location.reload();
525
+ t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation(), sessionStorage.getItem("vite:preloadError:reloaded") || (sessionStorage.setItem("vite:preloadError:reloaded", "true"), window.location.reload());
526
526
  } catch {
527
527
  }
528
528
  };
529
529
  return window.addEventListener("vite:preloadError", e), () => {
530
530
  window.removeEventListener("vite:preloadError", e);
531
531
  };
532
- }, []), null), fe = /* @__PURE__ */ new WeakMap(), Se = "user", nt = ({ Fallback: e, isLogged: t, loginPath: n = "/login", redirect401Path: s = "/login", ...o }) => {
533
- const { libraries: a, localStorageKeys: c } = C(j), u = o?.reactRouter || a?.reactRouter, l = o?.axios || a?.axios, f = o?.localStorageKey || c?.user || Se;
534
- if (!u)
532
+ }, []), null), fe = /* @__PURE__ */ new WeakMap(), Ae = "user", ot = ({ Fallback: e, isLogged: t, loginPath: n = "/login", redirect401Path: o = "/login", ...s }) => {
533
+ const { libraries: a, localStorageKeys: c } = k(P), l = s?.reactRouter || a?.reactRouter, u = s?.axios || a?.axios, f = s?.localStorageKey || c?.user || Ae;
534
+ if (!l)
535
535
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
536
- const [i, h] = D(null), { useLocation: m, Navigate: y, Outlet: v } = u, A = m(), k = typeof t == "function" ? t() : !!t, g = typeof k == "boolean" ? k : k?.isLogged;
536
+ const [i, g] = D(null), { useLocation: m, Navigate: y, Outlet: j } = l, A = m(), _ = typeof t == "function" ? t() : !!t, h = typeof _ == "boolean" ? _ : _?.isLogged;
537
537
  return L(() => {
538
- fe.has(l) || (fe.set(l, !0), l.interceptors.response.use(
538
+ fe.has(u) || (fe.set(u, !0), u.interceptors.response.use(
539
539
  (d) => d,
540
- (d) => (typeof d == "object" && d && "response" in d && d.response && typeof d.response == "object" && "status" in d.response && d.response && typeof d.response == "object" && "status" in d.response && d?.response?.status === 401 && (typeof d == "object" && d && "config" in d && d.config && typeof d.config == "object" && "headers" in d.config && d.config.headers && typeof d.config.headers == "object" && "Authorization" in d.config.headers && d.config.headers.Authorization && (l.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(f)), h(s)), Promise.reject(d))
540
+ (d) => (typeof d == "object" && d && "response" in d && d.response && typeof d.response == "object" && "status" in d.response && d.response && typeof d.response == "object" && "status" in d.response && d?.response?.status === 401 && (typeof d == "object" && d && "config" in d && d.config && typeof d.config == "object" && "headers" in d.config && d.config.headers && typeof d.config.headers == "object" && "Authorization" in d.config.headers && d.config.headers.Authorization && (u.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(f)), g(o)), Promise.reject(d))
541
541
  ));
542
- }, [l, f, s]), g && !i ? /* @__PURE__ */ I.jsx(Ee, { fallback: e, children: A.state?.from?.state && A.state?.from?.pathname === n ? /* @__PURE__ */ I.jsx(y, { to: A.state.from.state.from.pathname + A.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ I.jsx(v, {}) }) : /* @__PURE__ */ I.jsx(y, { to: n + A.search, state: { from: A }, replace: !0 });
542
+ }, [u, f, o]), h && !i ? /* @__PURE__ */ I.jsx(Ee, { fallback: e, children: A.state?.from?.state && A.state?.from?.pathname === n ? /* @__PURE__ */ I.jsx(y, { to: A.state.from.state.from.pathname + A.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ I.jsx(j, {}) }) : /* @__PURE__ */ I.jsx(y, { to: n + A.search, state: { from: A }, replace: !0 });
543
543
  }, Ce = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), je = (e) => {
544
544
  const t = e.split(/[/\\]/).pop() || "";
545
545
  return t.substring(0, t.lastIndexOf("."));
546
546
  }, ke = (e) => {
547
- const s = e.split("/").filter((o) => o.length > 0).map((o) => o.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
548
- return s.charAt(0).toLowerCase() + s.slice(1);
549
- }, Pe = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), xe = (e, t, n, s) => {
550
- const o = ke(t), a = Ce(n), c = `${o}${a}`;
551
- return e && typeof e == "object" && "operationId" in e && s?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
552
- }, Oe = (e, t) => {
547
+ const o = e.split("/").filter((s) => s.length > 0).map((s) => s.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((u) => u.charAt(0).toUpperCase() + u.slice(1)).join("")).join("");
548
+ return o.charAt(0).toLowerCase() + o.slice(1);
549
+ }, Pe = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), Oe = (e, t, n, o) => {
550
+ const s = ke(t), a = Ce(n), c = `${s}${a}`;
551
+ return e && typeof e == "object" && "operationId" in e && o?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
552
+ }, xe = (e, t) => {
553
553
  const n = {};
554
- return e?.forEach((s) => {
555
- n[s] = {
554
+ return e?.forEach((o) => {
555
+ n[o] = {
556
556
  query: {
557
557
  useInfinite: !0,
558
558
  useInfiniteQueryParam: "offset",
559
559
  useQuery: !0
560
560
  }
561
561
  };
562
- }), t?.filter((s) => !n[s]).forEach((s) => {
563
- n[s] = {
562
+ }), t?.filter((o) => !n[o]).forEach((o) => {
563
+ n[o] = {
564
564
  query: {
565
565
  useQuery: !0
566
566
  }
567
567
  };
568
568
  }), Object.keys(n).length ? n : void 0;
569
- }, ot = (e) => (Array.isArray(e) ? e : [e]).reduce((n, s) => {
570
- const { output: o, useInfiniteIds: a, useQueryIds: c, input: u = "./openapi.json", customAxiosInstancePath: l, overrideApiName: f } = s || {}, i = f || Pe(u), h = l || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
569
+ }, st = (e) => (Array.isArray(e) ? e : [e]).reduce((n, o) => {
570
+ const { output: s, useInfiniteIds: a, useQueryIds: c, input: l = "./openapi.json", customAxiosInstancePath: u, overrideApiName: f } = o || {}, i = f || Pe(l), g = u || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
571
571
  return {
572
572
  ...n,
573
573
  [i]: {
574
- input: u,
574
+ input: l,
575
575
  output: {
576
- baseUrl: o?.baseUrl,
576
+ baseUrl: s?.baseUrl,
577
577
  client: "react-query",
578
578
  mode: "tags-split",
579
579
  override: {
580
580
  ...(a?.length || c?.length) && {
581
- operations: Oe(a, c)
581
+ operations: xe(a, c)
582
582
  },
583
583
  header: (m) => [
584
584
  "Generated by orval 🍺",
@@ -586,209 +586,220 @@ const qe = ({ IMaskMixin: e, ...t }) => {
586
586
  ...m.description ? [m.description] : []
587
587
  ],
588
588
  mutator: {
589
- name: je(h),
590
- path: h
589
+ name: je(g),
590
+ path: g
591
591
  },
592
- operationName: (m, y, v) => xe(m, y, v, c),
592
+ operationName: (m, y, j) => Oe(m, y, j, c),
593
593
  query: {
594
594
  useQuery: !0
595
595
  }
596
596
  },
597
- schemas: o?.schemas || `src/api/${i}/model`,
598
- target: o?.target || `src/api/${i}/services/api.ts`,
599
- ...o
597
+ schemas: s?.schemas || `src/api/${i}/model`,
598
+ target: s?.target || `src/api/${i}/services/api.ts`,
599
+ ...s
600
600
  }
601
601
  }
602
602
  };
603
- }, {}), Ie = "user", Ne = (e) => {
604
- const t = e.startsWith("https") ? "wss" : "ws", n = e.replace(/^https?:\/\//, "");
605
- return `${t}://${n}/v2/threads/ws`;
606
- }, Le = (e) => {
603
+ }, {}), Ie = "user", Ne = {
604
+ client: "/v2/threads/ws",
605
+ supplier: "/v1/threads/ws"
606
+ }, Le = (e, t) => {
607
+ const n = e.startsWith("https") ? "wss" : "ws", o = e.replace(/^https?:\/\//, "");
608
+ return `${n}://${o}${t}`;
609
+ }, $e = (e) => {
607
610
  try {
608
611
  const t = localStorage.getItem(e);
609
612
  return t ? JSON.parse(t)?.accessToken ?? null : null;
610
613
  } catch {
611
614
  return null;
612
615
  }
613
- }, me = ge(null), st = ({ children: e, reconnect: t = !0, enabled: n = !0, url: s, token: o }) => {
614
- const [a, c] = D(!1), [u, l] = D(!1), [f, i] = D(0), { apiURL: h, localStorageKeys: m } = C(j), y = m?.user || Ie, v = X(null), A = X(/* @__PURE__ */ new Set());
616
+ }, me = ge(null), at = ({
617
+ children: e,
618
+ token: t,
619
+ url: n,
620
+ wsPath: o,
621
+ reconnect: s = !0,
622
+ enabled: a = !0,
623
+ context: c = "client"
624
+ }) => {
625
+ const [l, u] = D(!1), [f, i] = D(!1), [g, m] = D(0), { apiURL: y, localStorageKeys: j } = k(P), A = j?.user || Ie, _ = ee(null), h = ee(/* @__PURE__ */ new Set());
615
626
  L(() => {
616
- if (!n)
627
+ if (!a)
617
628
  return;
618
- const w = s || (h ? Ne(h) : null);
619
- if (!w)
629
+ const w = o ?? Ne[c], C = n || (y ? Le(y, w) : null);
630
+ if (!C)
620
631
  return;
621
- const x = () => o ?? Le(y), K = (N) => {
622
- N.type === "ready" && (l(!0), i(N.unreadCount ?? 0));
623
- for (const $ of A.current)
632
+ const V = () => t ?? $e(A), H = (N) => {
633
+ N.type === "ready" && (i(!0), m(N.unreadCount ?? 0));
634
+ for (const $ of h.current)
624
635
  $(N);
625
- }, Y = setTimeout(() => {
636
+ }, M = setTimeout(() => {
626
637
  const N = new _e({
627
- getToken: x,
638
+ getToken: V,
628
639
  onConnectionChange: ($) => {
629
- c($), $ || l(!1);
640
+ u($), $ || i(!1);
630
641
  },
631
- onEvent: K,
632
- reconnect: t,
633
- url: w
642
+ onEvent: H,
643
+ reconnect: s,
644
+ url: C
634
645
  });
635
- v.current = N, N.connect();
646
+ _.current = N, N.connect();
636
647
  }, 0);
637
648
  return () => {
638
- clearTimeout(Y), v.current?.disconnect(), v.current = null;
649
+ clearTimeout(M), _.current?.disconnect(), _.current = null;
639
650
  };
640
- }, [n, s, o, h, t, y]);
641
- const k = P((w) => {
642
- v.current?.joinThread(w);
643
- }, []), g = P((w) => {
644
- v.current?.leaveThread(w);
645
- }, []), d = P((w, x) => {
646
- v.current?.sendMessage(w, x);
647
- }, []), T = P((w) => {
648
- v.current?.markRead(w);
649
- }, []), _ = P((w, x) => {
650
- v.current?.listThreads(w, x);
651
- }, []), S = P((w = 1) => {
652
- i((x) => x + w);
653
- }, []), O = P((w = 1) => {
654
- i((x) => Math.max(0, x - w));
655
- }, []), J = P((w) => (A.current.add(w), () => {
656
- A.current.delete(w);
657
- }), []), G = {
658
- decrementUnreadCount: O,
659
- incrementUnreadCount: S,
660
- isConnected: a,
661
- isReady: u,
662
- joinThread: k,
663
- leaveThread: g,
664
- listThreads: _,
665
- markRead: T,
666
- sendMessage: d,
667
- subscribe: J,
668
- unreadCount: f
651
+ }, [a, n, o, c, t, s, y, A]);
652
+ const d = O((w) => {
653
+ _.current?.joinThread(w);
654
+ }, []), b = O((w) => {
655
+ _.current?.leaveThread(w);
656
+ }, []), E = O((w, C) => {
657
+ _.current?.sendMessage(w, C);
658
+ }, []), S = O((w) => {
659
+ _.current?.markRead(w);
660
+ }, []), x = O((w, C) => {
661
+ _.current?.listThreads(w, C);
662
+ }, []), K = O((w = 1) => {
663
+ m((C) => C + w);
664
+ }, []), q = O((w = 1) => {
665
+ m((C) => Math.max(0, C - w));
666
+ }, []), Y = O((w) => (h.current.add(w), () => {
667
+ h.current.delete(w);
668
+ }), []), B = {
669
+ decrementUnreadCount: q,
670
+ incrementUnreadCount: K,
671
+ isConnected: l,
672
+ isReady: f,
673
+ joinThread: d,
674
+ leaveThread: b,
675
+ listThreads: x,
676
+ markRead: S,
677
+ sendMessage: E,
678
+ subscribe: Y,
679
+ unreadCount: g
669
680
  };
670
- return /* @__PURE__ */ I.jsx(me.Provider, { value: G, children: e });
671
- }, $e = (e) => e && typeof e == "function", Fe = (e) => e && typeof e == "function", at = ({
681
+ return /* @__PURE__ */ I.jsx(me.Provider, { value: B, children: e });
682
+ }, Fe = (e) => e && typeof e == "function", De = (e) => e && typeof e == "function", it = ({
672
683
  children: e,
673
684
  defaultQueriesOptions: t,
674
685
  defaultMutationsOptions: n,
675
- ...s
686
+ ...o
676
687
  }) => {
677
- const { libraries: o } = C(j), a = s?.QueryClient || o?.reactQuery?.QueryClient, c = s?.QueryClientProvider || o?.reactQuery?.QueryClientProvider;
688
+ const { libraries: s } = k(P), a = o?.QueryClient || s?.reactQuery?.QueryClient, c = o?.QueryClientProvider || s?.reactQuery?.QueryClientProvider;
678
689
  if (!a)
679
690
  throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
680
691
  if (!c)
681
692
  throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
682
- if (!$e(c))
693
+ if (!Fe(c))
683
694
  throw new Error("Provided QueryClientProvider dependencies are not valid.");
684
- if (!Fe(a))
695
+ if (!De(a))
685
696
  throw new Error("Provided QueryClient dependencies are not valid.");
686
- const u = new a({
697
+ const l = new a({
687
698
  defaultOptions: {
688
699
  mutations: {
689
700
  ...n
690
701
  },
691
702
  queries: {
692
- getNextPageParam: (l, f, i) => l.length + (i || 0),
703
+ getNextPageParam: (u, f, i) => u.length + (i || 0),
693
704
  refetchOnWindowFocus: !1,
694
705
  retry: 3,
695
706
  ...t
696
707
  }
697
708
  }
698
709
  });
699
- return /* @__PURE__ */ I.jsx(c, { client: u, children: e });
700
- }, De = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), Ye = (e, t) => {
701
- const { fractionDigits: n = 0, metric: s = "km", spacingBetween: o = !0 } = t || {}, a = Number(e), c = o ? " " : "";
702
- return Number.isNaN(a) ? `0${c}${s}` : `${a.toFixed(n)}${c}${s}`;
703
- }, Me = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((n) => n.length > 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n).join(" "), Ue = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, ze = ({ path: e, size: t, apiURL: n }) => {
710
+ return /* @__PURE__ */ I.jsx(c, { client: l, children: e });
711
+ }, Ye = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), Me = (e, t) => {
712
+ const { fractionDigits: n = 0, metric: o = "km", spacingBetween: s = !0 } = t || {}, a = Number(e), c = s ? " " : "";
713
+ return Number.isNaN(a) ? `0${c}${o}` : `${a.toFixed(n)}${c}${o}`;
714
+ }, Ue = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((n) => n.length > 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n).join(" "), ze = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, We = ({ path: e, size: t, apiURL: n }) => {
704
715
  if (!e)
705
716
  return "";
706
- const s = Ue(e), o = `${n}${s}`, a = o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
707
- return typeof t == "number" && a ? `${o.replace("/files", `/thumbs/${t}`)}` : o;
708
- }, it = (e) => {
709
- const { apiURL: t, libraries: n } = C(j), s = e?.dayjs || n?.dayjs;
717
+ const o = ze(e), s = `${n}${o}`, a = s.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
718
+ return typeof t == "number" && a ? `${s.replace("/files", `/thumbs/${t}`)}` : s;
719
+ }, ct = (e) => {
720
+ const { apiURL: t, libraries: n } = k(P), o = e?.dayjs || n?.dayjs;
710
721
  return {
711
- dateAdapter: (c, u) => {
712
- if (!s)
722
+ dateAdapter: (c, l) => {
723
+ if (!o)
713
724
  throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
714
- return De({
725
+ return Ye({
715
726
  date: c,
716
- format: u,
717
- library: s
727
+ format: l,
728
+ library: o
718
729
  });
719
730
  },
720
- distanceAdapter: Ye,
721
- filePathAdapter: (c, u) => {
731
+ distanceAdapter: Me,
732
+ filePathAdapter: (c, l) => {
722
733
  if (!t)
723
734
  throw new Error(
724
735
  "API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
725
736
  );
726
- return typeof c == "string" && /^https?:\/\//.test(c) ? c : ze({
737
+ return typeof c == "string" && /^https?:\/\//.test(c) ? c : We({
727
738
  apiURL: t,
728
739
  path: c,
729
- size: u
740
+ size: l
730
741
  });
731
742
  },
732
- worksiteNameAdapter: Me
743
+ worksiteNameAdapter: Ue
733
744
  };
734
- }, ct = (e) => {
735
- const { libraries: t, localStorageKeys: n } = C(j), s = e?.axios || t?.axios, o = e?.localStorageKey || n?.user || "user";
736
- if (!s)
745
+ }, lt = (e) => {
746
+ const { libraries: t, localStorageKeys: n } = k(P), o = e?.axios || t?.axios, s = e?.localStorageKey || n?.user || "user";
747
+ if (!o)
737
748
  throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
738
- const a = P(
739
- ({ tokenType: u, accessToken: l }) => {
740
- s.defaults.headers.common.Authorization = `${u} ${l}`;
749
+ const a = O(
750
+ ({ tokenType: l, accessToken: u }) => {
751
+ o.defaults.headers.common.Authorization = `${l} ${u}`;
741
752
  },
742
- [s.defaults.headers.common]
753
+ [o.defaults.headers.common]
743
754
  ), c = () => {
744
- s.defaults.headers.common.Authorization = null;
755
+ o.defaults.headers.common.Authorization = null;
745
756
  };
746
757
  return L(() => {
747
- if (z)
758
+ if (W)
748
759
  return;
749
- const u = ({ newValue: l, key: f }) => {
750
- if (f === o && l)
760
+ const l = ({ newValue: u, key: f }) => {
761
+ if (f === s && u)
751
762
  try {
752
- const { accessToken: i, tokenType: h } = JSON.parse(l);
753
- a({ accessToken: i, tokenType: h });
763
+ const { accessToken: i, tokenType: g } = JSON.parse(u);
764
+ a({ accessToken: i, tokenType: g });
754
765
  } catch (i) {
755
766
  console.error("Failed to parse newValue from localStorage:", i);
756
767
  }
757
768
  };
758
- return window.addEventListener("storage", u), () => {
759
- window.removeEventListener("storage", u);
769
+ return window.addEventListener("storage", l), () => {
770
+ window.removeEventListener("storage", l);
760
771
  };
761
- }, [o, a]), {
772
+ }, [s, a]), {
762
773
  clearAuthenticationToken: c,
763
774
  setAuthenticationToken: a
764
775
  };
765
- }, lt = (e) => {
766
- const t = C(me);
776
+ }, ut = (e) => {
777
+ const t = k(me);
767
778
  if (!t)
768
779
  throw new Error("useChat must be used within ChatProvider");
769
- const { subscribe: n, ...s } = t, o = X(e);
770
- return o.current = e, L(() => n((a) => {
780
+ const { subscribe: n, ...o } = t, s = ee(e);
781
+ return s.current = e, L(() => n((a) => {
771
782
  const {
772
783
  onReady: c,
773
- onNewMessage: u,
774
- onNewMessageNotification: l,
784
+ onNewMessage: l,
785
+ onNewMessageNotification: u,
775
786
  onPresence: f,
776
787
  onError: i,
777
- onJoinedThread: h,
788
+ onJoinedThread: g,
778
789
  onLeftThread: m,
779
790
  onMarkedRead: y,
780
- onThreadArchived: v,
791
+ onThreadArchived: j,
781
792
  onThreadsList: A
782
- } = o.current ?? {};
793
+ } = s.current ?? {};
783
794
  switch (a.type) {
784
795
  case "ready":
785
796
  c?.(a);
786
797
  break;
787
798
  case "new_message":
788
- u?.(a);
799
+ l?.(a);
789
800
  break;
790
801
  case "new_message_notification":
791
- l?.(a);
802
+ u?.(a);
792
803
  break;
793
804
  case "presence":
794
805
  f?.(a);
@@ -797,7 +808,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
797
808
  i?.(a);
798
809
  break;
799
810
  case "joined_thread":
800
- h?.(a);
811
+ g?.(a);
801
812
  break;
802
813
  case "left_thread":
803
814
  m?.(a);
@@ -806,28 +817,28 @@ const qe = ({ IMaskMixin: e, ...t }) => {
806
817
  y?.(a);
807
818
  break;
808
819
  case "thread_archived":
809
- v?.(a);
820
+ j?.(a);
810
821
  break;
811
822
  case "threads_list":
812
823
  A?.(a);
813
824
  break;
814
825
  }
815
- }), [n]), s;
816
- }, Q = (e, t) => t === "short" ? e.split("-")[0] : e, ut = (e, t = "full") => {
817
- const [n, s] = D(() => {
818
- const o = e?.language || navigator.language;
819
- return e && "isInitialized" in e && e.isInitialized, Q(o, t);
826
+ }), [n]), o;
827
+ }, G = (e, t) => t === "short" ? e.split("-")[0] : e, dt = (e, t = "full") => {
828
+ const [n, o] = D(() => {
829
+ const s = e?.language || navigator.language;
830
+ return e && "isInitialized" in e && e.isInitialized, G(s, t);
820
831
  });
821
832
  return L(() => {
822
- e && "isInitialized" in e && e.isInitialized && e.language && s(Q(e.language, t));
823
- const o = (a) => {
824
- s(Q(a, t));
833
+ e && "isInitialized" in e && e.isInitialized && e.language && o(G(e.language, t));
834
+ const s = (a) => {
835
+ o(G(a, t));
825
836
  };
826
- return e?.on?.("languageChanged", o), () => {
827
- e?.off?.("languageChanged", o);
837
+ return e?.on?.("languageChanged", s), () => {
838
+ e?.off?.("languageChanged", s);
828
839
  };
829
840
  }, [e, t]), n;
830
- }, We = "tracktor.filter", Ve = {
841
+ }, Ve = "tracktor.filter", Qe = {
831
842
  getFilter: () => {
832
843
  },
833
844
  getFilters: () => ({}),
@@ -841,108 +852,108 @@ const qe = ({ IMaskMixin: e, ...t }) => {
841
852
  } catch {
842
853
  return e;
843
854
  }
844
- }, he = (e, t, n) => `${n}_${e}=>${t}`, Qe = (e) => e.reduce((t, n) => {
845
- const s = localStorage.getItem(n);
846
- if (s)
855
+ }, he = (e, t, n) => `${n}_${e}=>${t}`, Je = (e) => e.reduce((t, n) => {
856
+ const o = localStorage.getItem(n);
857
+ if (o)
847
858
  try {
848
- const o = JSON.parse(s), a = Object.keys(o)?.[0];
849
- a && (t[a] = Object.values(o)?.[0]);
859
+ const s = JSON.parse(o), a = Object.keys(s)?.[0];
860
+ a && (t[a] = Object.values(s)?.[0]);
850
861
  } catch {
851
862
  }
852
863
  return t;
853
- }, {}), dt = (e) => {
854
- const { libraries: t, localStorageKeys: n } = C(j), s = e?.reactRouter || t?.reactRouter, { pathname: o } = s?.useLocation?.() ?? { pathname: "/" }, [a, c] = s?.useSearchParams?.() ?? [new URLSearchParams(), () => {
855
- }], [u, l] = D({}), f = n?.filter || We, i = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, h = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
856
- if (z)
857
- return Ve;
858
- if (!s)
864
+ }, {}), ft = (e) => {
865
+ const { libraries: t, localStorageKeys: n } = k(P), o = e?.reactRouter || t?.reactRouter, { pathname: s } = o?.useLocation?.() ?? { pathname: "/" }, [a, c] = o?.useSearchParams?.() ?? [new URLSearchParams(), () => {
866
+ }], [l, u] = D({}), f = n?.filter || Ve, i = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, g = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
867
+ if (W)
868
+ return Qe;
869
+ if (!o)
859
870
  throw new Error(
860
871
  "React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
861
872
  );
862
873
  const m = () => Object.keys(localStorage).filter(
863
- (g) => g.startsWith(f) && g.endsWith(e?.pathname || o)
864
- ), y = (g, d, T = !0) => {
865
- const _ = he(g, e?.pathname || o, f);
874
+ (h) => h.startsWith(f) && h.endsWith(e?.pathname || s)
875
+ ), y = (h, d, b = !0) => {
876
+ const E = he(h, e?.pathname || s, f);
866
877
  if (!d || Array.isArray(d) && !d.length) {
867
- i ? (a.delete(g), c(a)) : l((S) => {
868
- const O = { ...S };
869
- return delete O[g], O;
870
- }), h && localStorage.removeItem(_);
878
+ i ? (a.delete(h), c(a)) : u((S) => {
879
+ const x = { ...S };
880
+ return delete x[h], x;
881
+ }), g && localStorage.removeItem(E);
871
882
  return;
872
883
  }
873
- h && T && d && localStorage.setItem(_, JSON.stringify({ ...a, [g]: d })), i && d ? (a.set(g, JSON.stringify(d)), c(a)) : !i && d && l((S) => ({ ...S, [g]: d }));
884
+ g && b && d && localStorage.setItem(E, JSON.stringify({ ...a, [h]: d })), i && d ? (a.set(h, JSON.stringify(d)), c(a)) : !i && d && u((S) => ({ ...S, [h]: d }));
874
885
  };
875
886
  return {
876
- getFilter: (g, d) => {
887
+ getFilter: (h, d) => {
877
888
  if (i) {
878
- const T = a.get(g);
879
- if (T)
880
- return pe(T);
889
+ const b = a.get(h);
890
+ if (b)
891
+ return pe(b);
881
892
  } else {
882
- const T = u[g];
883
- if (T !== void 0)
884
- return T;
893
+ const b = l[h];
894
+ if (b !== void 0)
895
+ return b;
885
896
  }
886
- if (h) {
887
- const T = he(g, e?.pathname || o, f), _ = localStorage.getItem(T);
888
- if (_)
897
+ if (g) {
898
+ const b = he(h, e?.pathname || s, f), E = localStorage.getItem(b);
899
+ if (E)
889
900
  try {
890
- const S = JSON.parse(_)[g];
891
- return !i && S !== void 0 && l((O) => ({ ...O, [g]: S })), S;
901
+ const S = JSON.parse(E)[h];
902
+ return !i && S !== void 0 && u((x) => ({ ...x, [h]: S })), S;
892
903
  } catch {
893
904
  }
894
905
  }
895
906
  return d;
896
907
  },
897
908
  getFilters: () => {
898
- const g = h ? Qe(m()) : {};
909
+ const h = g ? Je(m()) : {};
899
910
  if (i) {
900
- const d = Array.from(a.entries()).reduce((T, [_, S]) => (T[_] = pe(S), T), {});
911
+ const d = Array.from(a.entries()).reduce((b, [E, S]) => (b[E] = pe(S), b), {});
901
912
  return {
902
- ...g,
913
+ ...h,
903
914
  ...d
904
915
  };
905
916
  }
906
917
  return {
907
- ...g,
908
- ...u
918
+ ...h,
919
+ ...l
909
920
  };
910
921
  },
911
- handleFilter: (g, d) => (T, _) => {
912
- if (_ || Array.isArray(_) && _.length === 0) {
913
- const S = d || "value", O = typeof _ == "object" && S in _ ? _[S] : _;
914
- y(g, O);
922
+ handleFilter: (h, d) => (b, E) => {
923
+ if (E || Array.isArray(E) && E.length === 0) {
924
+ const S = d || "value", x = typeof E == "object" && S in E ? E[S] : E;
925
+ y(h, x);
915
926
  return;
916
927
  }
917
- y(g, void 0);
928
+ y(h, void 0);
918
929
  },
919
930
  setFilter: y
920
931
  };
921
- }, ft = ({
932
+ }, pt = ({
922
933
  data: e,
923
934
  fetchNextPage: t,
924
935
  isFetchingNextPage: n,
925
- isInitialLoading: s,
926
- isLoading: o,
936
+ isInitialLoading: o,
937
+ isLoading: s,
927
938
  enabled: a = !0
928
939
  }) => {
929
- const c = P(
930
- async (l) => {
931
- n || !a || await t({ pageParam: l?.pageParam || l.visibleRowsCount });
940
+ const c = O(
941
+ async (u) => {
942
+ n || !a || await t({ pageParam: u?.pageParam || u.visibleRowsCount });
932
943
  },
933
944
  [a, t, n]
934
- ), u = te(() => {
945
+ ), l = ne(() => {
935
946
  if (e)
936
- return e.pages.reduce((l, f) => [...l, ...f], []);
947
+ return e.pages.reduce((u, f) => [...u, ...f], []);
937
948
  }, [e]);
938
949
  return {
939
950
  fetchNextPageOnRowsScrollEnd: c,
940
- isLoading: n || o,
941
- loadingVariant: s ? "skeleton" : "linear-progress",
942
- rows: u
951
+ isLoading: n || s,
952
+ loadingVariant: o ? "skeleton" : "linear-progress",
953
+ rows: l
943
954
  };
944
- }, pt = (e) => {
945
- const { libraries: t } = C(j), n = e?.i18 || t?.i18, s = e?.i18?.translateFunction || t?.i18?.translateFunction, o = n?.i18next?.t || s || ((f) => f), { unknownErrorTranslationKey: a = "error.unknownError" } = e || {}, c = o(a), u = P(
955
+ }, ht = (e) => {
956
+ const { libraries: t } = k(P), n = e?.i18 || t?.i18, o = e?.i18?.translateFunction || t?.i18?.translateFunction, s = n?.i18next?.t || o || ((f) => f), { unknownErrorTranslationKey: a = "error.unknownError" } = e || {}, c = s(a), l = O(
946
957
  (f) => {
947
958
  if (f && typeof f == "object" && "response" in f) {
948
959
  const { response: i } = f || {};
@@ -953,9 +964,9 @@ const qe = ({ IMaskMixin: e, ...t }) => {
953
964
  if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "message" in i.data && i.data.message)
954
965
  return String(i.data.message);
955
966
  if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "detail" in i.data) {
956
- const { detail: h } = i.data;
957
- if (Array.isArray(h) && h.length > 0 && typeof h[0] == "object" && h[0] !== null && "msg" in h[0]) {
958
- const { msg: m } = h[0];
967
+ const { detail: g } = i.data;
968
+ if (Array.isArray(g) && g.length > 0 && typeof g[0] == "object" && g[0] !== null && "msg" in g[0]) {
969
+ const { msg: m } = g[0];
959
970
  if (typeof m == "string")
960
971
  return String(m);
961
972
  }
@@ -965,36 +976,36 @@ const qe = ({ IMaskMixin: e, ...t }) => {
965
976
  },
966
977
  [c]
967
978
  );
968
- return { getErrorCode: P((f) => {
979
+ return { getErrorCode: O((f) => {
969
980
  const { response: i } = f || {};
970
981
  return i?.error_code ? String(i?.error_code) : i?.data?.error_code ? String(i?.data?.error_code) : i?.error_code ? String(i?.error_code) : i?.data?.error_code ? String(i.data.error_code) : "unknown_error_code";
971
- }, []), printError: u };
982
+ }, []), printError: l };
972
983
  };
973
984
  export {
974
985
  _e as ChatClient,
975
986
  me as ChatContext,
976
- st as ChatProvider,
977
- He as GTMSendPageView,
978
- Xe as InitializeAxiosConfig,
979
- Ze as InitializeDaysJSConfig,
980
- et as InitializeI18nConfig,
981
- tt as InitializeSentryConfig,
982
- j as InjectDependenciesContext,
983
- Be as InjectDependenciesProvider,
984
- qe as MaskTextField,
985
- rt as PreloadErrorHandler,
986
- at as QueryClientProviderWithConfig,
987
- nt as RequireAuth,
988
- Ke as axiosCustomInstance,
989
- De as dateAdapter,
990
- Ye as distanceAdapter,
991
- ot as getOrvalConfig,
992
- it as useAdapter,
993
- ct as useAuth,
994
- lt as useChat,
995
- ut as useCurrentLanguage,
996
- dt as useFilters,
997
- ft as useInfiniteDataGrid,
998
- pt as useResponseError,
999
- Me as worksiteNameAdapter
987
+ at as ChatProvider,
988
+ Xe as GTMSendPageView,
989
+ Ze as InitializeAxiosConfig,
990
+ et as InitializeDaysJSConfig,
991
+ tt as InitializeI18nConfig,
992
+ rt as InitializeSentryConfig,
993
+ P as InjectDependenciesContext,
994
+ He as InjectDependenciesProvider,
995
+ Be as MaskTextField,
996
+ nt as PreloadErrorHandler,
997
+ it as QueryClientProviderWithConfig,
998
+ ot as RequireAuth,
999
+ qe as axiosCustomInstance,
1000
+ Ye as dateAdapter,
1001
+ Me as distanceAdapter,
1002
+ st as getOrvalConfig,
1003
+ ct as useAdapter,
1004
+ lt as useAuth,
1005
+ ut as useChat,
1006
+ dt as useCurrentLanguage,
1007
+ ft as useFilters,
1008
+ pt as useInfiniteDataGrid,
1009
+ ht as useResponseError,
1010
+ Ue as worksiteNameAdapter
1000
1011
  };