@tracktor/shared-module 2.26.3 → 2.27.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/context/ChatProvider.d.ts +2 -0
- package/dist/main.js +173 -177
- package/dist/main.umd.cjs +2 -2
- package/package.json +1 -1
|
@@ -11,6 +11,8 @@ export interface ChatContextValue {
|
|
|
11
11
|
isConnected: boolean;
|
|
12
12
|
isReady: boolean;
|
|
13
13
|
unreadCount: number;
|
|
14
|
+
incrementUnreadCount: (amount?: number) => void;
|
|
15
|
+
decrementUnreadCount: (amount?: number) => void;
|
|
14
16
|
subscribe: (callback: EventListener) => () => void;
|
|
15
17
|
joinThread: (threadId: string) => void;
|
|
16
18
|
leaveThread: (threadId: string) => void;
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import we, { useMemo as
|
|
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
3
|
const Ke = (e, t) => {
|
|
4
|
-
const n =
|
|
4
|
+
const n = ie.CancelToken.source(), s = ie({
|
|
5
5
|
...e,
|
|
6
6
|
...t,
|
|
7
7
|
cancelToken: n.token
|
|
@@ -9,18 +9,18 @@ const Ke = (e, t) => {
|
|
|
9
9
|
return s.cancel = () => {
|
|
10
10
|
n.cancel("Query was cancelled");
|
|
11
11
|
}, s;
|
|
12
|
-
}, ve = 3e4,
|
|
12
|
+
}, ve = 3e4, ce = 1e3, Z = (e) => Array.isArray(e) ? e.map(Z) : e !== null && typeof e == "object" ? Object.fromEntries(
|
|
13
13
|
Object.entries(e).map(([t, n]) => [
|
|
14
14
|
t.replace(/_([a-z])/g, (s, o) => o.toUpperCase()),
|
|
15
|
-
|
|
15
|
+
Z(n)
|
|
16
16
|
])
|
|
17
|
-
) : e,
|
|
17
|
+
) : e, ee = (e) => Array.isArray(e) ? e.map(ee) : e !== null && typeof e == "object" ? Object.fromEntries(
|
|
18
18
|
Object.entries(e).map(([t, n]) => [
|
|
19
19
|
t.replace(/[A-Z]/g, (s) => `_${s.toLowerCase()}`),
|
|
20
|
-
|
|
20
|
+
ee(n)
|
|
21
21
|
])
|
|
22
22
|
) : e;
|
|
23
|
-
class
|
|
23
|
+
class Re {
|
|
24
24
|
url;
|
|
25
25
|
getToken;
|
|
26
26
|
onEvent;
|
|
@@ -55,7 +55,7 @@ class _e {
|
|
|
55
55
|
this._connected = !0, this.reconnectAttempt = 0, this.onConnectionChange?.(!0), this.rejoinThreads(), this.flushPendingMessages();
|
|
56
56
|
}, this.ws.onmessage = (o) => {
|
|
57
57
|
try {
|
|
58
|
-
const a = JSON.parse(o.data), c =
|
|
58
|
+
const a = JSON.parse(o.data), c = Z(a);
|
|
59
59
|
c.type === "ready" && (this._ready = !0), this.onEvent?.(c);
|
|
60
60
|
} catch {
|
|
61
61
|
}
|
|
@@ -74,8 +74,8 @@ class _e {
|
|
|
74
74
|
this.joinedThreads.delete(t), this.send({ threadId: t, type: "leave_thread" });
|
|
75
75
|
}
|
|
76
76
|
sendMessage(t, n) {
|
|
77
|
-
if (n.length >
|
|
78
|
-
throw new Error(`Message body exceeds maximum length of ${
|
|
77
|
+
if (n.length > ce)
|
|
78
|
+
throw new Error(`Message body exceeds maximum length of ${ce} characters`);
|
|
79
79
|
this.send({ body: n, threadId: t, type: "send_message" });
|
|
80
80
|
}
|
|
81
81
|
markRead(t) {
|
|
@@ -89,7 +89,7 @@ class _e {
|
|
|
89
89
|
this.pendingMessages.push(t);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
this.ws.send(JSON.stringify(
|
|
92
|
+
this.ws.send(JSON.stringify(ee(t)));
|
|
93
93
|
}
|
|
94
94
|
flushPendingMessages() {
|
|
95
95
|
const t = [...this.pendingMessages];
|
|
@@ -113,10 +113,10 @@ class _e {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
var V = { exports: {} }, M = {};
|
|
116
|
-
var
|
|
117
|
-
function
|
|
118
|
-
if (
|
|
119
|
-
|
|
116
|
+
var le;
|
|
117
|
+
function _e() {
|
|
118
|
+
if (le) return M;
|
|
119
|
+
le = 1;
|
|
120
120
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
121
121
|
function n(s, o, a) {
|
|
122
122
|
var c = null;
|
|
@@ -136,13 +136,13 @@ function Re() {
|
|
|
136
136
|
return M.Fragment = t, M.jsx = n, M.jsxs = n, M;
|
|
137
137
|
}
|
|
138
138
|
var U = {};
|
|
139
|
-
var
|
|
140
|
-
function
|
|
141
|
-
return
|
|
139
|
+
var ue;
|
|
140
|
+
function Te() {
|
|
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 ===
|
|
145
|
+
return r.$$typeof === K ? null : r.displayName || r.name || null;
|
|
146
146
|
if (typeof r == "string") return r;
|
|
147
147
|
switch (r) {
|
|
148
148
|
case k:
|
|
@@ -151,11 +151,11 @@ function be() {
|
|
|
151
151
|
return "Profiler";
|
|
152
152
|
case g:
|
|
153
153
|
return "StrictMode";
|
|
154
|
-
case
|
|
154
|
+
case O:
|
|
155
155
|
return "Suspense";
|
|
156
|
-
case S:
|
|
157
|
-
return "SuspenseList";
|
|
158
156
|
case J:
|
|
157
|
+
return "SuspenseList";
|
|
158
|
+
case x:
|
|
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 R:
|
|
168
168
|
return r.displayName || "Context";
|
|
169
169
|
case b:
|
|
170
170
|
return (r._context.displayName || "Context") + ".Consumer";
|
|
171
|
-
case
|
|
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
|
|
174
|
+
case G:
|
|
175
175
|
return p = r.displayName || null, p !== null ? p : e(r.type) || "Memo";
|
|
176
|
-
case
|
|
176
|
+
case w:
|
|
177
177
|
p = r._payload, r = r._init;
|
|
178
178
|
try {
|
|
179
179
|
return e(r(p));
|
|
@@ -194,8 +194,8 @@ function be() {
|
|
|
194
194
|
}
|
|
195
195
|
if (p) {
|
|
196
196
|
p = console;
|
|
197
|
-
var
|
|
198
|
-
return
|
|
197
|
+
var E = p.error, _ = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
198
|
+
return E.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
|
_
|
|
@@ -204,7 +204,7 @@ function be() {
|
|
|
204
204
|
}
|
|
205
205
|
function s(r) {
|
|
206
206
|
if (r === k) return "<>";
|
|
207
|
-
if (typeof r == "object" && r !== null && r.$$typeof ===
|
|
207
|
+
if (typeof r == "object" && r !== null && r.$$typeof === w)
|
|
208
208
|
return "<...>";
|
|
209
209
|
try {
|
|
210
210
|
var p = e(r);
|
|
@@ -214,46 +214,46 @@ function be() {
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
function o() {
|
|
217
|
-
var r =
|
|
217
|
+
var r = Y.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 (
|
|
224
|
+
if (N.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
230
|
function u(r, p) {
|
|
231
|
-
function
|
|
232
|
-
|
|
231
|
+
function E() {
|
|
232
|
+
re || (re = !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
|
-
|
|
238
|
-
get:
|
|
237
|
+
E.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
238
|
+
get: E,
|
|
239
239
|
configurable: !0
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
function l() {
|
|
243
243
|
var r = e(this.type);
|
|
244
|
-
return
|
|
244
|
+
return ne[r] || (ne[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,
|
|
249
|
-
var
|
|
248
|
+
function f(r, p, E, _, W, B) {
|
|
249
|
+
var T = E.ref;
|
|
250
250
|
return r = {
|
|
251
|
-
$$typeof:
|
|
251
|
+
$$typeof: v,
|
|
252
252
|
type: r,
|
|
253
253
|
key: p,
|
|
254
|
-
props:
|
|
254
|
+
props: E,
|
|
255
255
|
_owner: _
|
|
256
|
-
}, (
|
|
256
|
+
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(r, "ref", {
|
|
257
257
|
enumerable: !1,
|
|
258
258
|
get: l
|
|
259
259
|
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
@@ -275,28 +275,28 @@ function be() {
|
|
|
275
275
|
configurable: !1,
|
|
276
276
|
enumerable: !1,
|
|
277
277
|
writable: !0,
|
|
278
|
-
value:
|
|
278
|
+
value: B
|
|
279
279
|
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
280
280
|
}
|
|
281
|
-
function i(r, p,
|
|
282
|
-
var
|
|
283
|
-
if (
|
|
281
|
+
function i(r, p, E, _, W, B) {
|
|
282
|
+
var T = p.children;
|
|
283
|
+
if (T !== void 0)
|
|
284
284
|
if (_)
|
|
285
|
-
if (
|
|
286
|
-
for (_ = 0; _ <
|
|
287
|
-
h(
|
|
288
|
-
Object.freeze && Object.freeze(
|
|
285
|
+
if ($(T)) {
|
|
286
|
+
for (_ = 0; _ < T.length; _++)
|
|
287
|
+
h(T[_]);
|
|
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(
|
|
294
|
-
if (
|
|
295
|
-
|
|
293
|
+
else h(T);
|
|
294
|
+
if (N.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
|
-
_ = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
299
|
+
_ = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", ae[T + _] || (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
|
_,
|
|
307
|
-
|
|
307
|
+
T,
|
|
308
308
|
F,
|
|
309
|
-
|
|
310
|
-
),
|
|
309
|
+
T
|
|
310
|
+
), ae[T + _] = !0);
|
|
311
311
|
}
|
|
312
|
-
if (
|
|
313
|
-
|
|
314
|
-
for (var
|
|
315
|
-
|
|
316
|
-
} else
|
|
317
|
-
return
|
|
318
|
-
|
|
312
|
+
if (T = null, E !== void 0 && (n(E), T = "" + E), c(p) && (n(p.key), T = "" + 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 T && u(
|
|
318
|
+
E,
|
|
319
319
|
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
320
320
|
), f(
|
|
321
321
|
r,
|
|
322
|
-
|
|
323
|
-
|
|
322
|
+
T,
|
|
323
|
+
E,
|
|
324
324
|
o(),
|
|
325
325
|
W,
|
|
326
|
-
|
|
326
|
+
B
|
|
327
327
|
);
|
|
328
328
|
}
|
|
329
329
|
function h(r) {
|
|
330
|
-
m(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof ===
|
|
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));
|
|
331
331
|
}
|
|
332
332
|
function m(r) {
|
|
333
|
-
return typeof r == "object" && r !== null && r.$$typeof ===
|
|
333
|
+
return typeof r == "object" && r !== null && r.$$typeof === v;
|
|
334
334
|
}
|
|
335
|
-
var y = we,
|
|
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"), b = /* @__PURE__ */ Symbol.for("react.consumer"), R = /* @__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() {
|
|
336
336
|
return null;
|
|
337
337
|
};
|
|
338
338
|
y = {
|
|
@@ -340,47 +340,47 @@ React keys must be passed directly to JSX without using spread:
|
|
|
340
340
|
return r();
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
|
-
var
|
|
343
|
+
var re, ne = {}, oe = y.react_stack_bottom_frame.bind(
|
|
344
344
|
y,
|
|
345
345
|
a
|
|
346
|
-
)(),
|
|
347
|
-
U.Fragment = k, U.jsx = function(r, p,
|
|
348
|
-
var _ = 1e4 >
|
|
346
|
+
)(), se = q(s(a)), ae = {};
|
|
347
|
+
U.Fragment = k, U.jsx = function(r, p, E) {
|
|
348
|
+
var _ = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
349
349
|
return i(
|
|
350
350
|
r,
|
|
351
351
|
p,
|
|
352
|
-
|
|
352
|
+
E,
|
|
353
353
|
!1,
|
|
354
|
-
_ ? Error("react-stack-top-frame") :
|
|
355
|
-
_ ?
|
|
354
|
+
_ ? Error("react-stack-top-frame") : oe,
|
|
355
|
+
_ ? q(s(r)) : se
|
|
356
356
|
);
|
|
357
|
-
}, U.jsxs = function(r, p,
|
|
358
|
-
var _ = 1e4 >
|
|
357
|
+
}, U.jsxs = function(r, p, E) {
|
|
358
|
+
var _ = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
359
359
|
return i(
|
|
360
360
|
r,
|
|
361
361
|
p,
|
|
362
|
-
|
|
362
|
+
E,
|
|
363
363
|
!0,
|
|
364
|
-
_ ? Error("react-stack-top-frame") :
|
|
365
|
-
_ ?
|
|
364
|
+
_ ? Error("react-stack-top-frame") : oe,
|
|
365
|
+
_ ? q(s(r)) : se
|
|
366
366
|
);
|
|
367
367
|
};
|
|
368
368
|
})()), U;
|
|
369
369
|
}
|
|
370
|
-
var
|
|
371
|
-
function
|
|
372
|
-
return
|
|
370
|
+
var de;
|
|
371
|
+
function be() {
|
|
372
|
+
return de || (de = 1, process.env.NODE_ENV === "production" ? V.exports = _e() : V.exports = Te()), V.exports;
|
|
373
373
|
}
|
|
374
|
-
var I =
|
|
374
|
+
var I = be();
|
|
375
375
|
const qe = ({ IMaskMixin: e, ...t }) => {
|
|
376
|
-
const n =
|
|
376
|
+
const n = te(
|
|
377
377
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
378
378
|
() => e(({ TextField: s, ...o }) => /* @__PURE__ */ I.jsx(s, { ...o })),
|
|
379
379
|
[e]
|
|
380
380
|
);
|
|
381
381
|
return /* @__PURE__ */ I.jsx(n, { ...t });
|
|
382
|
-
}, j =
|
|
383
|
-
const o =
|
|
382
|
+
}, j = ge({}), Be = ({ children: e, apiURL: t, libraries: n, localStorageKeys: s }) => {
|
|
383
|
+
const o = te(
|
|
384
384
|
() => ({
|
|
385
385
|
apiURL: t,
|
|
386
386
|
libraries: n,
|
|
@@ -398,7 +398,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
398
398
|
if (!o)
|
|
399
399
|
throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
400
400
|
const { useGoogleTagManager: a } = o, { useLocation: c, Outlet: u } = s, { pathname: l } = c(), { sendEvent: f } = a();
|
|
401
|
-
return
|
|
401
|
+
return L(() => {
|
|
402
402
|
f({
|
|
403
403
|
event: "pageView",
|
|
404
404
|
pathname: l,
|
|
@@ -435,7 +435,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
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
|
-
return
|
|
438
|
+
return L(() => {
|
|
439
439
|
(async () => {
|
|
440
440
|
const c = e || navigator.language?.slice(0, 2) || "en";
|
|
441
441
|
o && o.forEach((u) => {
|
|
@@ -487,7 +487,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
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:
|
|
490
|
+
const { createRoutesFromChildren: v, matchRoutes: A, useLocation: k, useNavigationType: g } = y;
|
|
491
491
|
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && m.init({
|
|
492
492
|
debug: u,
|
|
493
493
|
dsn: e,
|
|
@@ -503,9 +503,9 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
503
503
|
],
|
|
504
504
|
integrations: [
|
|
505
505
|
m.reactRouterV6BrowserTracingIntegration({
|
|
506
|
-
createRoutesFromChildren:
|
|
506
|
+
createRoutesFromChildren: v,
|
|
507
507
|
matchRoutes: A,
|
|
508
|
-
useEffect:
|
|
508
|
+
useEffect: L,
|
|
509
509
|
useLocation: k,
|
|
510
510
|
useNavigationType: g
|
|
511
511
|
}),
|
|
@@ -517,7 +517,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
517
517
|
tracePropagationTargets: a,
|
|
518
518
|
tracesSampleRate: n || 1
|
|
519
519
|
}), null;
|
|
520
|
-
}, rt = () => (
|
|
520
|
+
}, rt = () => (L(() => {
|
|
521
521
|
if (z)
|
|
522
522
|
return;
|
|
523
523
|
const e = (t) => {
|
|
@@ -529,17 +529,17 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
529
529
|
return window.addEventListener("vite:preloadError", e), () => {
|
|
530
530
|
window.removeEventListener("vite:preloadError", e);
|
|
531
531
|
};
|
|
532
|
-
}, []), null),
|
|
532
|
+
}, []), null), fe = /* @__PURE__ */ new WeakMap(), Ae = "user", nt = ({ Fallback: e, isLogged: t, loginPath: n = "/login", redirect401Path: s = "/login", ...o }) => {
|
|
533
533
|
const { libraries: a, localStorageKeys: c } = C(j), u = o?.reactRouter || a?.reactRouter, l = o?.axios || a?.axios, f = o?.localStorageKey || c?.user || Ae;
|
|
534
534
|
if (!u)
|
|
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:
|
|
537
|
-
return
|
|
538
|
-
|
|
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;
|
|
537
|
+
return L(() => {
|
|
538
|
+
fe.has(l) || (fe.set(l, !0), l.interceptors.response.use(
|
|
539
539
|
(d) => d,
|
|
540
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))
|
|
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(
|
|
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 });
|
|
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("."));
|
|
@@ -589,7 +589,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
589
589
|
name: je(h),
|
|
590
590
|
path: h
|
|
591
591
|
},
|
|
592
|
-
operationName: (m, y,
|
|
592
|
+
operationName: (m, y, v) => xe(m, y, v, c),
|
|
593
593
|
query: {
|
|
594
594
|
useQuery: !0
|
|
595
595
|
}
|
|
@@ -610,68 +610,64 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
610
610
|
} catch {
|
|
611
611
|
return null;
|
|
612
612
|
}
|
|
613
|
-
},
|
|
614
|
-
const [a, c] = D(!1), [u, l] = D(!1), [f, i] = D(0), { apiURL: h, localStorageKeys: m } = C(j), y = m?.user || Ie,
|
|
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());
|
|
615
|
+
L(() => {
|
|
616
616
|
if (!n)
|
|
617
617
|
return;
|
|
618
|
-
const
|
|
619
|
-
if (!
|
|
618
|
+
const w = s || (h ? Ne(h) : null);
|
|
619
|
+
if (!w)
|
|
620
620
|
return;
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
i((P) => Math.max(0, P - 1));
|
|
631
|
-
break;
|
|
632
|
-
}
|
|
633
|
-
for (const P of A.current)
|
|
634
|
-
P(L);
|
|
635
|
-
}, J = setTimeout(() => {
|
|
636
|
-
const L = new _e({
|
|
637
|
-
getToken: $,
|
|
638
|
-
onConnectionChange: (P) => {
|
|
639
|
-
c(P), P || l(!1);
|
|
621
|
+
const x = () => o ?? Le(y), K = (N) => {
|
|
622
|
+
N.type === "ready" && (l(!0), i(N.unreadCount ?? 0));
|
|
623
|
+
for (const $ of A.current)
|
|
624
|
+
$(N);
|
|
625
|
+
}, Y = setTimeout(() => {
|
|
626
|
+
const N = new Re({
|
|
627
|
+
getToken: x,
|
|
628
|
+
onConnectionChange: ($) => {
|
|
629
|
+
c($), $ || l(!1);
|
|
640
630
|
},
|
|
641
|
-
onEvent:
|
|
631
|
+
onEvent: K,
|
|
642
632
|
reconnect: t,
|
|
643
|
-
url:
|
|
633
|
+
url: w
|
|
644
634
|
});
|
|
645
|
-
|
|
635
|
+
v.current = N, N.connect();
|
|
646
636
|
}, 0);
|
|
647
637
|
return () => {
|
|
648
|
-
clearTimeout(
|
|
638
|
+
clearTimeout(Y), v.current?.disconnect(), v.current = null;
|
|
649
639
|
};
|
|
650
640
|
}, [n, s, o, h, t, y]);
|
|
651
|
-
const k =
|
|
652
|
-
|
|
653
|
-
}, []), g =
|
|
654
|
-
|
|
655
|
-
}, []), d =
|
|
656
|
-
|
|
657
|
-
}, []), b =
|
|
658
|
-
|
|
659
|
-
}, []),
|
|
660
|
-
|
|
661
|
-
}, []),
|
|
662
|
-
|
|
663
|
-
}
|
|
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
|
+
}, []), b = P((w) => {
|
|
648
|
+
v.current?.markRead(w);
|
|
649
|
+
}, []), R = 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,
|
|
664
660
|
isConnected: a,
|
|
665
661
|
isReady: u,
|
|
666
662
|
joinThread: k,
|
|
667
663
|
leaveThread: g,
|
|
668
|
-
listThreads:
|
|
664
|
+
listThreads: R,
|
|
669
665
|
markRead: b,
|
|
670
666
|
sendMessage: d,
|
|
671
|
-
subscribe:
|
|
667
|
+
subscribe: J,
|
|
672
668
|
unreadCount: f
|
|
673
669
|
};
|
|
674
|
-
return /* @__PURE__ */ I.jsx(
|
|
670
|
+
return /* @__PURE__ */ I.jsx(me.Provider, { value: G, children: e });
|
|
675
671
|
}, $e = (e) => e && typeof e == "function", Fe = (e) => e && typeof e == "function", at = ({
|
|
676
672
|
children: e,
|
|
677
673
|
defaultQueriesOptions: t,
|
|
@@ -739,7 +735,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
739
735
|
const { libraries: t, localStorageKeys: n } = C(j), s = e?.axios || t?.axios, o = e?.localStorageKey || n?.user || "user";
|
|
740
736
|
if (!s)
|
|
741
737
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
742
|
-
const a =
|
|
738
|
+
const a = P(
|
|
743
739
|
({ tokenType: u, accessToken: l }) => {
|
|
744
740
|
s.defaults.headers.common.Authorization = `${u} ${l}`;
|
|
745
741
|
},
|
|
@@ -747,7 +743,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
747
743
|
), c = () => {
|
|
748
744
|
s.defaults.headers.common.Authorization = null;
|
|
749
745
|
};
|
|
750
|
-
return
|
|
746
|
+
return L(() => {
|
|
751
747
|
if (z)
|
|
752
748
|
return;
|
|
753
749
|
const u = ({ newValue: l, key: f }) => {
|
|
@@ -767,11 +763,11 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
767
763
|
setAuthenticationToken: a
|
|
768
764
|
};
|
|
769
765
|
}, lt = (e) => {
|
|
770
|
-
const t = C(
|
|
766
|
+
const t = C(me);
|
|
771
767
|
if (!t)
|
|
772
768
|
throw new Error("useChat must be used within ChatProvider");
|
|
773
|
-
const { subscribe: n, ...s } = t, o =
|
|
774
|
-
return o.current = e,
|
|
769
|
+
const { subscribe: n, ...s } = t, o = X(e);
|
|
770
|
+
return o.current = e, L(() => n((a) => {
|
|
775
771
|
const {
|
|
776
772
|
onReady: c,
|
|
777
773
|
onNewMessage: u,
|
|
@@ -781,7 +777,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
781
777
|
onJoinedThread: h,
|
|
782
778
|
onLeftThread: m,
|
|
783
779
|
onMarkedRead: y,
|
|
784
|
-
onThreadsList:
|
|
780
|
+
onThreadsList: v
|
|
785
781
|
} = o.current ?? {};
|
|
786
782
|
switch (a.type) {
|
|
787
783
|
case "ready":
|
|
@@ -809,7 +805,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
809
805
|
y?.(a);
|
|
810
806
|
break;
|
|
811
807
|
case "threads_list":
|
|
812
|
-
|
|
808
|
+
v?.(a);
|
|
813
809
|
break;
|
|
814
810
|
}
|
|
815
811
|
}), [n]), s;
|
|
@@ -818,7 +814,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
818
814
|
const o = e?.language || navigator.language;
|
|
819
815
|
return e && "isInitialized" in e && e.isInitialized, Q(o, t);
|
|
820
816
|
});
|
|
821
|
-
return
|
|
817
|
+
return L(() => {
|
|
822
818
|
e && "isInitialized" in e && e.isInitialized && e.language && s(Q(e.language, t));
|
|
823
819
|
const o = (a) => {
|
|
824
820
|
s(Q(a, t));
|
|
@@ -835,13 +831,13 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
835
831
|
},
|
|
836
832
|
setFilter: () => {
|
|
837
833
|
}
|
|
838
|
-
},
|
|
834
|
+
}, pe = (e) => {
|
|
839
835
|
try {
|
|
840
836
|
return JSON.parse(e);
|
|
841
837
|
} catch {
|
|
842
838
|
return e;
|
|
843
839
|
}
|
|
844
|
-
},
|
|
840
|
+
}, he = (e, t, n) => `${n}_${e}=>${t}`, Qe = (e) => e.reduce((t, n) => {
|
|
845
841
|
const s = localStorage.getItem(n);
|
|
846
842
|
if (s)
|
|
847
843
|
try {
|
|
@@ -862,33 +858,33 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
862
858
|
const m = () => Object.keys(localStorage).filter(
|
|
863
859
|
(g) => g.startsWith(f) && g.endsWith(e?.pathname || o)
|
|
864
860
|
), y = (g, d, b = !0) => {
|
|
865
|
-
const
|
|
861
|
+
const R = he(g, e?.pathname || o, f);
|
|
866
862
|
if (!d || Array.isArray(d) && !d.length) {
|
|
867
|
-
i ? (a.delete(g), c(a)) : l((
|
|
868
|
-
const
|
|
869
|
-
return delete
|
|
870
|
-
}), h && localStorage.removeItem(
|
|
863
|
+
i ? (a.delete(g), c(a)) : l((S) => {
|
|
864
|
+
const O = { ...S };
|
|
865
|
+
return delete O[g], O;
|
|
866
|
+
}), h && localStorage.removeItem(R);
|
|
871
867
|
return;
|
|
872
868
|
}
|
|
873
|
-
h && b && d && localStorage.setItem(
|
|
869
|
+
h && b && d && localStorage.setItem(R, JSON.stringify({ ...a, [g]: d })), i && d ? (a.set(g, JSON.stringify(d)), c(a)) : !i && d && l((S) => ({ ...S, [g]: d }));
|
|
874
870
|
};
|
|
875
871
|
return {
|
|
876
872
|
getFilter: (g, d) => {
|
|
877
873
|
if (i) {
|
|
878
874
|
const b = a.get(g);
|
|
879
875
|
if (b)
|
|
880
|
-
return
|
|
876
|
+
return pe(b);
|
|
881
877
|
} else {
|
|
882
878
|
const b = u[g];
|
|
883
879
|
if (b !== void 0)
|
|
884
880
|
return b;
|
|
885
881
|
}
|
|
886
882
|
if (h) {
|
|
887
|
-
const b =
|
|
888
|
-
if (
|
|
883
|
+
const b = he(g, e?.pathname || o, f), R = localStorage.getItem(b);
|
|
884
|
+
if (R)
|
|
889
885
|
try {
|
|
890
|
-
const
|
|
891
|
-
return !i &&
|
|
886
|
+
const S = JSON.parse(R)[g];
|
|
887
|
+
return !i && S !== void 0 && l((O) => ({ ...O, [g]: S })), S;
|
|
892
888
|
} catch {
|
|
893
889
|
}
|
|
894
890
|
}
|
|
@@ -897,7 +893,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
897
893
|
getFilters: () => {
|
|
898
894
|
const g = h ? Qe(m()) : {};
|
|
899
895
|
if (i) {
|
|
900
|
-
const d = Array.from(a.entries()).reduce((b, [
|
|
896
|
+
const d = Array.from(a.entries()).reduce((b, [R, S]) => (b[R] = pe(S), b), {});
|
|
901
897
|
return {
|
|
902
898
|
...g,
|
|
903
899
|
...d
|
|
@@ -908,10 +904,10 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
908
904
|
...u
|
|
909
905
|
};
|
|
910
906
|
},
|
|
911
|
-
handleFilter: (g, d) => (b,
|
|
912
|
-
if (
|
|
913
|
-
const
|
|
914
|
-
y(g,
|
|
907
|
+
handleFilter: (g, d) => (b, R) => {
|
|
908
|
+
if (R || Array.isArray(R) && R.length === 0) {
|
|
909
|
+
const S = d || "value", O = typeof R == "object" && S in R ? R[S] : R;
|
|
910
|
+
y(g, O);
|
|
915
911
|
return;
|
|
916
912
|
}
|
|
917
913
|
y(g, void 0);
|
|
@@ -926,12 +922,12 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
926
922
|
isLoading: o,
|
|
927
923
|
enabled: a = !0
|
|
928
924
|
}) => {
|
|
929
|
-
const c =
|
|
925
|
+
const c = P(
|
|
930
926
|
async (l) => {
|
|
931
927
|
n || !a || await t({ pageParam: l?.pageParam || l.visibleRowsCount });
|
|
932
928
|
},
|
|
933
929
|
[a, t, n]
|
|
934
|
-
), u =
|
|
930
|
+
), u = te(() => {
|
|
935
931
|
if (e)
|
|
936
932
|
return e.pages.reduce((l, f) => [...l, ...f], []);
|
|
937
933
|
}, [e]);
|
|
@@ -942,7 +938,7 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
942
938
|
rows: u
|
|
943
939
|
};
|
|
944
940
|
}, 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 =
|
|
941
|
+
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(
|
|
946
942
|
(f) => {
|
|
947
943
|
if (f && typeof f == "object" && "response" in f) {
|
|
948
944
|
const { response: i } = f || {};
|
|
@@ -965,14 +961,14 @@ const qe = ({ IMaskMixin: e, ...t }) => {
|
|
|
965
961
|
},
|
|
966
962
|
[c]
|
|
967
963
|
);
|
|
968
|
-
return { getErrorCode:
|
|
964
|
+
return { getErrorCode: P((f) => {
|
|
969
965
|
const { response: i } = f || {};
|
|
970
966
|
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
967
|
}, []), printError: u };
|
|
972
968
|
};
|
|
973
969
|
export {
|
|
974
|
-
|
|
975
|
-
|
|
970
|
+
Re as ChatClient,
|
|
971
|
+
me as ChatContext,
|
|
976
972
|
st as ChatProvider,
|
|
977
973
|
He as GTMSendPageView,
|
|
978
974
|
Xe as InitializeAxiosConfig,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(g,
|
|
1
|
+
(function(g,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],L):(g=typeof globalThis<"u"?globalThis:g||self,L(g["@tracktor/shared-module"]={},g.axios,g.React))})(this,(function(g,L,l){"use strict";const ge=(e,t)=>{const r=L.CancelToken.source(),s=L({...e,...t,cancelToken:r.token}).then(({data:o})=>o);return s.cancel=()=>{r.cancel("Query was cancelled")},s},Q=e=>Array.isArray(e)?e.map(Q):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,r])=>[t.replace(/_([a-z])/g,(s,o)=>o.toUpperCase()),Q(r)])):e,J=e=>Array.isArray(e)?e.map(J):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,r])=>[t.replace(/[A-Z]/g,s=>`_${s.toLowerCase()}`),J(r)])):e;class ee{url;getToken;onEvent;onConnectionChange;shouldReconnect;maxReconnectAttempts;reconnectBaseDelay;ws=null;reconnectAttempt=0;reconnectTimer=null;intentionalClose=!1;joinedThreads=new Set;pendingMessages=[];_connected=!1;_ready=!1;constructor(t){this.url=t.url,this.getToken=t.getToken,this.onEvent=t.onEvent,this.onConnectionChange=t.onConnectionChange,this.shouldReconnect=t.reconnect??!0,this.maxReconnectAttempts=t.maxReconnectAttempts??Number.POSITIVE_INFINITY,this.reconnectBaseDelay=t.reconnectBaseDelay??1e3}get connected(){return this._connected}get ready(){return this._ready}connect(){const t=this.getToken();if(!t)return;this.intentionalClose=!1;const r=this.url.includes("?")?"&":"?",s=`${this.url}${r}token=${t}`;this.ws=new WebSocket(s),this.ws.onopen=()=>{this._connected=!0,this.reconnectAttempt=0,this.onConnectionChange?.(!0),this.rejoinThreads(),this.flushPendingMessages()},this.ws.onmessage=o=>{try{const a=JSON.parse(o.data),c=Q(a);c.type==="ready"&&(this._ready=!0),this.onEvent?.(c)}catch{}},this.ws.onclose=()=>{this._connected=!1,this._ready=!1,this.onConnectionChange?.(!1),!this.intentionalClose&&this.shouldReconnect&&this.reconnectAttempt<this.maxReconnectAttempts&&this.scheduleReconnect()},this.ws.onerror=()=>{}}disconnect(){this.intentionalClose=!0,this.pendingMessages=[],this.clearReconnectTimer(),this.ws&&(this.ws.close(),this.ws=null)}joinThread(t){this.joinedThreads.add(t),this.send({threadId:t,type:"join_thread"})}leaveThread(t){this.joinedThreads.delete(t),this.send({threadId:t,type:"leave_thread"})}sendMessage(t,r){if(r.length>1e3)throw new Error("Message body exceeds maximum length of 1000 characters");this.send({body:r,threadId:t,type:"send_message"})}markRead(t){this.send({threadId:t,type:"mark_read"})}listThreads(t,r){this.send({limit:t,offset:r,type:"list_threads"})}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.pendingMessages.push(t);return}this.ws.send(JSON.stringify(J(t)))}flushPendingMessages(){const t=[...this.pendingMessages];this.pendingMessages=[];for(const r of t)this.send(r)}rejoinThreads(){for(const t of this.joinedThreads)this.send({threadId:t,type:"join_thread"})}scheduleReconnect(){this.clearReconnectTimer();const t=Math.min(this.reconnectBaseDelay*2**this.reconnectAttempt,3e4);this.reconnectAttempt++,this.reconnectTimer=setTimeout(()=>{this.connect()},t)}clearReconnectTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}var W={exports:{}},M={};var te;function me(){if(te)return M;te=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,o,a){var c=null;if(a!==void 0&&(c=""+a),o.key!==void 0&&(c=""+o.key),"key"in o){a={};for(var d in o)d!=="key"&&(a[d]=o[d])}else a=o;return o=a.ref,{$$typeof:e,type:s,key:c,ref:o!==void 0?o:null,props:a}}return M.Fragment=t,M.jsx=r,M.jsxs=r,M}var Y={};var ne;function ye(){return ne||(ne=1,process.env.NODE_ENV!=="production"&&(function(){function e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===X?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case P:return"Fragment";case f:return"Profiler";case y:return"StrictMode";case N:return"Suspense";case B:return"SuspenseList";case O:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case k:return"Portal";case R:return n.displayName||"Context";case S:return(n._context.displayName||"Context")+".Consumer";case A:var h=n.render;return n=n.displayName,n||(n=h.displayName||h.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case H:return h=n.displayName||null,h!==null?h:e(n.type)||"Memo";case w:h=n._payload,n=n._init;try{return e(n(h))}catch{}}return null}function t(n){return""+n}function r(n){try{t(n);var h=!1}catch{h=!0}if(h){h=console;var C=h.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return C.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),t(n)}}function s(n){if(n===P)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===w)return"<...>";try{var h=e(n);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function o(){var n=z.A;return n===null?null:n.getOwner()}function a(){return Error("react-stack-top-frame")}function c(n){if(x.call(n,"key")){var h=Object.getOwnPropertyDescriptor(n,"key").get;if(h&&h.isReactWarning)return!1}return n.key!==void 0}function d(n,h){function C(){ue||(ue=!0,console.error("%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)",h))}C.isReactWarning=!0,Object.defineProperty(n,"key",{get:C,configurable:!0})}function u(){var n=e(this.type);return de[n]||(de[n]=!0,console.error("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.")),n=this.props.ref,n!==void 0?n:null}function p(n,h,C,b,V,q){var T=C.ref;return n={$$typeof:_,type:n,key:h,props:C,_owner:b},(T!==void 0?T:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:u}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function i(n,h,C,b,V,q){var T=h.children;if(T!==void 0)if(b)if(F(T)){for(b=0;b<T.length;b++)m(T[b]);Object.freeze&&Object.freeze(T)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(T);if(x.call(h,"key")){T=e(n);var D=Object.keys(h).filter(function(nt){return nt!=="key"});b=0<D.length?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}",he[T+b]||(D=0<D.length?"{"+D.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,R,b,D,b),he[b+R]=!0)}if(b=null,v!==void 0&&(r(v),b=""+v),c(p)&&(r(p.key),b=""+p.key),"key"in p){v={};for(var Z in p)Z!=="key"&&(v[Z]=p[Z])}else v=p;return b&&d(v,typeof n=="function"?n.displayName||n.name||"Unknown":n),h(n,b,v,o(),V,X)}function m(n){E(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===U&&(n._payload.status==="fulfilled"?E(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function E(n){return typeof n=="object"&&n!==null&&n.$$typeof===C}var w=l,C=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),_=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),x=Symbol.for("react.client.reference"),O=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce=Object.prototype.hasOwnProperty,tt=Array.isArray,H=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(n){return n()}};var le,ue={},de=w.react_stack_bottom_frame.bind(w,a)(),fe=H(s(a)),he={};Y.Fragment=P,Y.jsx=function(n,p,v){var R=1e4>O.recentlyCreatedOwnerStacks++;return i(n,p,v,!1,R?Error("react-stack-top-frame"):de,R?H(s(n)):fe)},Y.jsxs=function(n,p,v){var R=1e4>O.recentlyCreatedOwnerStacks++;return i(n,p,v,!0,R?Error("react-stack-top-frame"):de,R?H(s(n)):fe)}})()),Y}var te;function ye(){return te||(te=1,process.env.NODE_ENV==="production"?W.exports=ge():W.exports=me()),W.exports}var I=ye();const Ee=({IMaskMixin:e,...t})=>{const r=l.useMemo(()=>e(({TextField:s,...o})=>I.jsx(s,{...o})),[e]);return I.jsx(r,{...t})},j=l.createContext({}),we=({children:e,apiURL:t,libraries:r,localStorageKeys:s})=>{const o=l.useMemo(()=>({apiURL:t,libraries:r,localStorageKeys:s}),[t,r,s]);return I.jsx(j.Provider,{value:o,children:e})},ve=({data:e,...t})=>{const{libraries:r}=l.useContext(j),s=t?.reactRouter||r?.reactRouter,o=t?.gtm||r?.gtm;if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!o)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:a}=o,{useLocation:c,Outlet:d}=s,{pathname:u}=c(),{sendEvent:h}=a();return l.useEffect(()=>{h({event:"pageView",pathname:u,...e})},[e,u,h]),I.jsx(d,{})},z=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),Ce="user",_e=({tokenTypeKey:e="tokenType",tokenKey:t="accessToken",postContentType:r="application/json",...s})=>{const{apiURL:o=s.apiURL,libraries:a,localStorageKeys:c}=l.useContext(j),d=s?.userLocalStorageKey||c?.user||Ce,u=s?.axios||a?.axios;if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!u?.defaults||z)return null;if(typeof window<"u"&&window.localStorage){const h=localStorage.getItem(d),i=h?JSON.parse(h):null,m=i?.[e]?i[e]:null,E=i?.[t]?i[t]:null,w=h?`${m} ${E}`:null;w&&(u.defaults.headers.common.Authorization=w)}return u.defaults.baseURL=o,u.defaults.headers.post["Content-Type"]=r,null},Re=({language:e,...t})=>{const{libraries:r}=l.useContext(j),s=t?.dayjs||r?.dayjs,o=t?.plugin||r?.dayjsPlugin;if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return l.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";o&&o.forEach(d=>{d&&s.extend(d)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),s.locale(c)})().then()},[s,o,e]),null},be=({debug:e,resources:t,...r})=>{const{libraries:s}=l.useContext(j),o=r?.i18||s?.i18,{i18next:a,initReactI18next:c,languageDetector:d}=o||{};if(z)return null;if(!o)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return a?.isInitialized||(a.use(d).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:t,returnNull:!1}).then(()=>{document.documentElement.lang!==a.resolvedLanguage&&a.resolvedLanguage&&document.documentElement.setAttribute("lang",a.resolvedLanguage)}),a.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Te=({dsn:e,integrations:t,tracesSampleRate:r,replaysSessionSampleRate:s,replaysOnErrorSampleRate:o,tracePropagationTargets:a,ignoreErrors:c,debug:d,environment:u,release:h,...i})=>{const{libraries:m}=l.useContext(j),E=i?.sentry||m?.sentry,w=i?.reactRouter||m?.reactRouter;if(!E)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!w)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(E.isInitialized())return null;const{createRoutesFromChildren:C,matchRoutes:k,useLocation:P,useNavigationType:y}=w;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&E.init({debug:d,dsn:e,environment:u||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[E.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:C,matchRoutes:k,useEffect:l.useEffect,useLocation:P,useNavigationType:y}),...t||[]],release:h,replaysOnErrorSampleRate:o||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:a,tracesSampleRate:r||1}),null},Se=()=>(l.useEffect(()=>{if(z)return;const e=t=>{try{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),ne=new WeakMap,Ae="user",ke=({Fallback:e,isLogged:t,loginPath:r="/login",redirect401Path:s="/login",...o})=>{const{libraries:a,localStorageKeys:c}=l.useContext(j),d=o?.reactRouter||a?.reactRouter,u=o?.axios||a?.axios,h=o?.localStorageKey||c?.user||Ae;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,m]=l.useState(null),{useLocation:E,Navigate:w,Outlet:C}=d,k=E(),P=typeof t=="function"?t():!!t,y=typeof P=="boolean"?P:P?.isLogged;return l.useEffect(()=>{ne.has(u)||(ne.set(u,!0),u.interceptors.response.use(f=>f,f=>(typeof f=="object"&&f&&"response"in f&&f.response&&typeof f.response=="object"&&"status"in f.response&&f.response&&typeof f.response=="object"&&"status"in f.response&&f?.response?.status===401&&(typeof f=="object"&&f&&"config"in f&&f.config&&typeof f.config=="object"&&"headers"in f.config&&f.config.headers&&typeof f.config.headers=="object"&&"Authorization"in f.config.headers&&f.config.headers.Authorization&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(h)),m(s)),Promise.reject(f))))},[u,h,s]),y&&!i?I.jsx(l.Suspense,{fallback:e,children:k.state?.from?.state&&k.state?.from?.pathname===r?I.jsx(w,{to:k.state.from.state.from.pathname+k.state.from.state.from.search,replace:!0}):I.jsx(C,{})}):I.jsx(w,{to:r+k.search,state:{from:k},replace:!0})},je=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Pe=e=>{const t=e.split(/[/\\]/).pop()||"";return t.substring(0,t.lastIndexOf("."))},Oe=e=>{const s=e.split("/").filter(o=>o.length>0).map(o=>o.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return s.charAt(0).toLowerCase()+s.slice(1)},Ie=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Ne=(e,t,r,s)=>{const o=Oe(t),a=je(r),c=`${o}${a}`;return e&&typeof e=="object"&&"operationId"in e&&s?.includes(String(e.operationId))?`${c}AsQuery`:c},xe=(e,t)=>{const r={};return e?.forEach(s=>{r[s]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),t?.filter(s=>!r[s]).forEach(s=>{r[s]={query:{useQuery:!0}}}),Object.keys(r).length?r:void 0},Le=e=>(Array.isArray(e)?e:[e]).reduce((r,s)=>{const{output:o,useInfiniteIds:a,useQueryIds:c,input:d="./openapi.json",customAxiosInstancePath:u,overrideApiName:h}=s||{},i=h||Ie(d),m=u||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...r,[i]:{input:d,output:{baseUrl:o?.baseUrl,client:"react-query",mode:"tags-split",override:{...(a?.length||c?.length)&&{operations:xe(a,c)},header:E=>["Generated by orval 🍺",...E.title?[E.title]:[],...E.description?[E.description]:[]],mutator:{name:Pe(m),path:m},operationName:(E,w,C)=>Ne(E,w,C,c),query:{useQuery:!0}},schemas:o?.schemas||`src/api/${i}/model`,target:o?.target||`src/api/${i}/services/api.ts`,...o}}}},{}),Fe="user",De=e=>{const t=e.startsWith("https")?"wss":"ws",r=e.replace(/^https?:\/\//,"");return`${t}://${r}/v2/threads/ws`},Me=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t)?.accessToken??null:null}catch{return null}},K=l.createContext(null),Ye=({children:e,reconnect:t=!0,enabled:r=!0,url:s,token:o})=>{const[a,c]=l.useState(!1),[d,u]=l.useState(!1),[h,i]=l.useState(0),{apiURL:m,localStorageKeys:E}=l.useContext(j),w=E?.user||Fe,C=l.useRef(null),k=l.useRef(new Set);l.useEffect(()=>{if(!r)return;const A=s||(m?De(m):null);if(!A)return;const L=()=>o??Me(w),U=x=>{switch(x.type){case"ready":u(!0),i(x.unreadCount??0);break;case"new_message_notification":i(O=>O+1);break;case"marked_read":i(O=>Math.max(0,O-1));break}for(const O of k.current)O(x)},B=setTimeout(()=>{const x=new q({getToken:L,onConnectionChange:O=>{c(O),O||u(!1)},onEvent:U,reconnect:t,url:A});C.current=x,x.connect()},0);return()=>{clearTimeout(B),C.current?.disconnect(),C.current=null}},[r,s,o,m,t,w]);const P=l.useCallback(A=>{C.current?.joinThread(A)},[]),y=l.useCallback(A=>{C.current?.leaveThread(A)},[]),f=l.useCallback((A,L)=>{C.current?.sendMessage(A,L)},[]),T=l.useCallback(A=>{C.current?.markRead(A)},[]),_=l.useCallback((A,L)=>{C.current?.listThreads(A,L)},[]),S=l.useCallback(A=>(k.current.add(A),()=>{k.current.delete(A)}),[]),N={isConnected:a,isReady:d,joinThread:P,leaveThread:y,listThreads:_,markRead:T,sendMessage:f,subscribe:S,unreadCount:h};return I.jsx(K.Provider,{value:N,children:e})},ze=e=>e&&typeof e=="function",Ue=e=>e&&typeof e=="function",We=({children:e,defaultQueriesOptions:t,defaultMutationsOptions:r,...s})=>{const{libraries:o}=l.useContext(j),a=s?.QueryClient||o?.reactQuery?.QueryClient,c=s?.QueryClientProvider||o?.reactQuery?.QueryClientProvider;if(!a)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!ze(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Ue(a))throw new Error("Provided QueryClient dependencies are not valid.");const d=new a({defaultOptions:{mutations:{...r},queries:{getNextPageParam:(u,h,i)=>u.length+(i||0),refetchOnWindowFocus:!1,retry:3,...t}}});return I.jsx(c,{client:d,children:e})},re=({library:e,date:t,format:r="ll"})=>e(t).format(r),oe=(e,t)=>{const{fractionDigits:r=0,metric:s="km",spacingBetween:o=!0}=t||{},a=Number(e),c=o?" ":"";return Number.isNaN(a)?`0${c}${s}`:`${a.toFixed(r)}${c}${s}`},se=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(r=>r.length>0?r.charAt(0).toUpperCase()+r.slice(1):r).join(" "),Ge=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Ve=({path:e,size:t,apiURL:r})=>{if(!e)return"";const s=Ge(e),o=`${r}${s}`,a=o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof t=="number"&&a?`${o.replace("/files",`/thumbs/${t}`)}`:o},Qe=e=>{const{apiURL:t,libraries:r}=l.useContext(j),s=e?.dayjs||r?.dayjs;return{dateAdapter:(c,d)=>{if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return re({date:c,format:d,library:s})},distanceAdapter:oe,filePathAdapter:(c,d)=>{if(!t)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Ve({apiURL:t,path:c,size:d})},worksiteNameAdapter:se}},Je=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(j),s=e?.axios||t?.axios,o=e?.localStorageKey||r?.user||"user";if(!s)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=l.useCallback(({tokenType:d,accessToken:u})=>{s.defaults.headers.common.Authorization=`${d} ${u}`},[s.defaults.headers.common]),c=()=>{s.defaults.headers.common.Authorization=null};return l.useEffect(()=>{if(z)return;const d=({newValue:u,key:h})=>{if(h===o&&u)try{const{accessToken:i,tokenType:m}=JSON.parse(u);a({accessToken:i,tokenType:m})}catch(i){console.error("Failed to parse newValue from localStorage:",i)}};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}},[o,a]),{clearAuthenticationToken:c,setAuthenticationToken:a}},Ke=e=>{const t=l.useContext(K);if(!t)throw new Error("useChat must be used within ChatProvider");const{subscribe:r,...s}=t,o=l.useRef(e);return o.current=e,l.useEffect(()=>r(a=>{const{onReady:c,onNewMessage:d,onNewMessageNotification:u,onPresence:h,onError:i,onJoinedThread:m,onLeftThread:E,onMarkedRead:w,onThreadsList:C}=o.current??{};switch(a.type){case"ready":c?.(a);break;case"new_message":d?.(a);break;case"new_message_notification":u?.(a);break;case"presence":h?.(a);break;case"error":i?.(a);break;case"joined_thread":m?.(a);break;case"left_thread":E?.(a);break;case"marked_read":w?.(a);break;case"threads_list":C?.(a);break}}),[r]),s},G=(e,t)=>t==="short"?e.split("-")[0]:e,Be=(e,t="full")=>{const[r,s]=l.useState(()=>{const o=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,G(o,t)});return l.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&s(G(e.language,t));const o=a=>{s(G(a,t))};return e?.on?.("languageChanged",o),()=>{e?.off?.("languageChanged",o)}},[e,t]),r},He="tracktor.filter",Xe={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},ae=e=>{try{return JSON.parse(e)}catch{return e}},ie=(e,t,r)=>`${r}_${e}=>${t}`,Ze=e=>e.reduce((t,r)=>{const s=localStorage.getItem(r);if(s)try{const o=JSON.parse(s),a=Object.keys(o)?.[0];a&&(t[a]=Object.values(o)?.[0])}catch{}return t},{}),qe=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(j),s=e?.reactRouter||t?.reactRouter,{pathname:o}=s?.useLocation?.()??{pathname:"/"},[a,c]=s?.useSearchParams?.()??[new URLSearchParams,()=>{}],[d,u]=l.useState({}),h=r?.filter||He,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl,m=e?.persistToLocalStorage===void 0?!0:e?.persistToLocalStorage;if(z)return Xe;if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const E=()=>Object.keys(localStorage).filter(y=>y.startsWith(h)&&y.endsWith(e?.pathname||o)),w=(y,f,T=!0)=>{const _=ie(y,e?.pathname||o,h);if(!f||Array.isArray(f)&&!f.length){i?(a.delete(y),c(a)):u(S=>{const N={...S};return delete N[y],N}),m&&localStorage.removeItem(_);return}m&&T&&f&&localStorage.setItem(_,JSON.stringify({...a,[y]:f})),i&&f?(a.set(y,JSON.stringify(f)),c(a)):!i&&f&&u(S=>({...S,[y]:f}))};return{getFilter:(y,f)=>{if(i){const T=a.get(y);if(T)return ae(T)}else{const T=d[y];if(T!==void 0)return T}if(m){const T=ie(y,e?.pathname||o,h),_=localStorage.getItem(T);if(_)try{const S=JSON.parse(_)[y];return!i&&S!==void 0&&u(N=>({...N,[y]:S})),S}catch{}}return f},getFilters:()=>{const y=m?Ze(E()):{};if(i){const f=Array.from(a.entries()).reduce((T,[_,S])=>(T[_]=ae(S),T),{});return{...y,...f}}return{...y,...d}},handleFilter:(y,f)=>(T,_)=>{if(_||Array.isArray(_)&&_.length===0){const S=f||"value",N=typeof _=="object"&&S in _?_[S]:_;w(y,N);return}w(y,void 0)},setFilter:w}},$e=({data:e,fetchNextPage:t,isFetchingNextPage:r,isInitialLoading:s,isLoading:o,enabled:a=!0})=>{const c=l.useCallback(async u=>{r||!a||await t({pageParam:u?.pageParam||u.visibleRowsCount})},[a,t,r]),d=l.useMemo(()=>{if(e)return e.pages.reduce((u,h)=>[...u,...h],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:r||o,loadingVariant:s?"skeleton":"linear-progress",rows:d}},et=e=>{const{libraries:t}=l.useContext(j),r=e?.i18||t?.i18,s=e?.i18?.translateFunction||t?.i18?.translateFunction,o=r?.i18next?.t||s||(h=>h),{unknownErrorTranslationKey:a="error.unknownError"}=e||{},c=o(a),d=l.useCallback(h=>{if(h&&typeof h=="object"&&"response"in h){const{response:i}=h||{};if(i&&typeof i=="object"&&"reason"in i&&i.reason)return String(i.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"reason"in i.data&&i.data.reason)return String(i.data.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"message"in i.data&&i.data.message)return String(i.data.message);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"detail"in i.data){const{detail:m}=i.data;if(Array.isArray(m)&&m.length>0&&typeof m[0]=="object"&&m[0]!==null&&"msg"in m[0]){const{msg:E}=m[0];if(typeof E=="string")return String(E)}}}return h instanceof Error?h.message:c},[c]);return{getErrorCode:l.useCallback(h=>{const{response:i}=h||{};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"},[]),printError:d}};g.ChatClient=q,g.ChatContext=K,g.ChatProvider=Ye,g.GTMSendPageView=ve,g.InitializeAxiosConfig=_e,g.InitializeDaysJSConfig=Re,g.InitializeI18nConfig=be,g.InitializeSentryConfig=Te,g.InjectDependenciesContext=j,g.InjectDependenciesProvider=we,g.MaskTextField=Ee,g.PreloadErrorHandler=Se,g.QueryClientProviderWithConfig=We,g.RequireAuth=ke,g.axiosCustomInstance=pe,g.dateAdapter=re,g.distanceAdapter=oe,g.getOrvalConfig=Le,g.useAdapter=Qe,g.useAuth=Je,g.useChat=Ke,g.useCurrentLanguage=Be,g.useFilters=qe,g.useInfiniteDataGrid=$e,g.useResponseError=et,g.worksiteNameAdapter=se,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,b,T,D,T),he[T+b]=!0)}if(T=null,C!==void 0&&(r(C),T=""+C),c(h)&&(r(h.key),T=""+h.key),"key"in h){C={};for(var $ in h)$!=="key"&&(C[$]=h[$])}else C=h;return T&&d(C,typeof n=="function"?n.displayName||n.name||"Unknown":n),p(n,T,C,o(),V,q)}function m(n){E(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===w&&(n._payload.status==="fulfilled"?E(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function E(n){return typeof n=="object"&&n!==null&&n.$$typeof===_}var v=l,_=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),R=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),X=Symbol.for("react.client.reference"),z=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,x=Object.prototype.hasOwnProperty,F=Array.isArray,Z=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(n){return n()}};var ue,de={},fe=v.react_stack_bottom_frame.bind(v,a)(),pe=Z(s(a)),he={};Y.Fragment=P,Y.jsx=function(n,h,C){var b=1e4>z.recentlyCreatedOwnerStacks++;return i(n,h,C,!1,b?Error("react-stack-top-frame"):fe,b?Z(s(n)):pe)},Y.jsxs=function(n,h,C){var b=1e4>z.recentlyCreatedOwnerStacks++;return i(n,h,C,!0,b?Error("react-stack-top-frame"):fe,b?Z(s(n)):pe)}})()),Y}var re;function Ee(){return re||(re=1,process.env.NODE_ENV==="production"?W.exports=me():W.exports=ye()),W.exports}var I=Ee();const ve=({IMaskMixin:e,...t})=>{const r=l.useMemo(()=>e(({TextField:s,...o})=>I.jsx(s,{...o})),[e]);return I.jsx(r,{...t})},j=l.createContext({}),we=({children:e,apiURL:t,libraries:r,localStorageKeys:s})=>{const o=l.useMemo(()=>({apiURL:t,libraries:r,localStorageKeys:s}),[t,r,s]);return I.jsx(j.Provider,{value:o,children:e})},Ce=({data:e,...t})=>{const{libraries:r}=l.useContext(j),s=t?.reactRouter||r?.reactRouter,o=t?.gtm||r?.gtm;if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!o)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:a}=o,{useLocation:c,Outlet:d}=s,{pathname:u}=c(),{sendEvent:p}=a();return l.useEffect(()=>{p({event:"pageView",pathname:u,...e})},[e,u,p]),I.jsx(d,{})},U=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),_e="user",Re=({tokenTypeKey:e="tokenType",tokenKey:t="accessToken",postContentType:r="application/json",...s})=>{const{apiURL:o=s.apiURL,libraries:a,localStorageKeys:c}=l.useContext(j),d=s?.userLocalStorageKey||c?.user||_e,u=s?.axios||a?.axios;if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!u?.defaults||U)return null;if(typeof window<"u"&&window.localStorage){const p=localStorage.getItem(d),i=p?JSON.parse(p):null,m=i?.[e]?i[e]:null,E=i?.[t]?i[t]:null,v=p?`${m} ${E}`:null;v&&(u.defaults.headers.common.Authorization=v)}return u.defaults.baseURL=o,u.defaults.headers.post["Content-Type"]=r,null},be=({language:e,...t})=>{const{libraries:r}=l.useContext(j),s=t?.dayjs||r?.dayjs,o=t?.plugin||r?.dayjsPlugin;if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return l.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";o&&o.forEach(d=>{d&&s.extend(d)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),s.locale(c)})().then()},[s,o,e]),null},Te=({debug:e,resources:t,...r})=>{const{libraries:s}=l.useContext(j),o=r?.i18||s?.i18,{i18next:a,initReactI18next:c,languageDetector:d}=o||{};if(U)return null;if(!o)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return a?.isInitialized||(a.use(d).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:t,returnNull:!1}).then(()=>{document.documentElement.lang!==a.resolvedLanguage&&a.resolvedLanguage&&document.documentElement.setAttribute("lang",a.resolvedLanguage)}),a.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Se=({dsn:e,integrations:t,tracesSampleRate:r,replaysSessionSampleRate:s,replaysOnErrorSampleRate:o,tracePropagationTargets:a,ignoreErrors:c,debug:d,environment:u,release:p,...i})=>{const{libraries:m}=l.useContext(j),E=i?.sentry||m?.sentry,v=i?.reactRouter||m?.reactRouter;if(!E)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!v)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(E.isInitialized())return null;const{createRoutesFromChildren:_,matchRoutes:k,useLocation:P,useNavigationType:y}=v;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&E.init({debug:d,dsn:e,environment:u||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[E.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:_,matchRoutes:k,useEffect:l.useEffect,useLocation:P,useNavigationType:y}),...t||[]],release:p,replaysOnErrorSampleRate:o||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:a,tracesSampleRate:r||1}),null},Ae=()=>(l.useEffect(()=>{if(U)return;const e=t=>{try{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),oe=new WeakMap,ke="user",je=({Fallback:e,isLogged:t,loginPath:r="/login",redirect401Path:s="/login",...o})=>{const{libraries:a,localStorageKeys:c}=l.useContext(j),d=o?.reactRouter||a?.reactRouter,u=o?.axios||a?.axios,p=o?.localStorageKey||c?.user||ke;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,m]=l.useState(null),{useLocation:E,Navigate:v,Outlet:_}=d,k=E(),P=typeof t=="function"?t():!!t,y=typeof P=="boolean"?P:P?.isLogged;return l.useEffect(()=>{oe.has(u)||(oe.set(u,!0),u.interceptors.response.use(f=>f,f=>(typeof f=="object"&&f&&"response"in f&&f.response&&typeof f.response=="object"&&"status"in f.response&&f.response&&typeof f.response=="object"&&"status"in f.response&&f?.response?.status===401&&(typeof f=="object"&&f&&"config"in f&&f.config&&typeof f.config=="object"&&"headers"in f.config&&f.config.headers&&typeof f.config.headers=="object"&&"Authorization"in f.config.headers&&f.config.headers.Authorization&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(p)),m(s)),Promise.reject(f))))},[u,p,s]),y&&!i?I.jsx(l.Suspense,{fallback:e,children:k.state?.from?.state&&k.state?.from?.pathname===r?I.jsx(v,{to:k.state.from.state.from.pathname+k.state.from.state.from.search,replace:!0}):I.jsx(_,{})}):I.jsx(v,{to:r+k.search,state:{from:k},replace:!0})},Pe=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Oe=e=>{const t=e.split(/[/\\]/).pop()||"";return t.substring(0,t.lastIndexOf("."))},Ie=e=>{const s=e.split("/").filter(o=>o.length>0).map(o=>o.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return s.charAt(0).toLowerCase()+s.slice(1)},Ne=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),xe=(e,t,r,s)=>{const o=Ie(t),a=Pe(r),c=`${o}${a}`;return e&&typeof e=="object"&&"operationId"in e&&s?.includes(String(e.operationId))?`${c}AsQuery`:c},Le=(e,t)=>{const r={};return e?.forEach(s=>{r[s]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),t?.filter(s=>!r[s]).forEach(s=>{r[s]={query:{useQuery:!0}}}),Object.keys(r).length?r:void 0},Fe=e=>(Array.isArray(e)?e:[e]).reduce((r,s)=>{const{output:o,useInfiniteIds:a,useQueryIds:c,input:d="./openapi.json",customAxiosInstancePath:u,overrideApiName:p}=s||{},i=p||Ne(d),m=u||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...r,[i]:{input:d,output:{baseUrl:o?.baseUrl,client:"react-query",mode:"tags-split",override:{...(a?.length||c?.length)&&{operations:Le(a,c)},header:E=>["Generated by orval 🍺",...E.title?[E.title]:[],...E.description?[E.description]:[]],mutator:{name:Oe(m),path:m},operationName:(E,v,_)=>xe(E,v,_,c),query:{useQuery:!0}},schemas:o?.schemas||`src/api/${i}/model`,target:o?.target||`src/api/${i}/services/api.ts`,...o}}}},{}),De="user",Me=e=>{const t=e.startsWith("https")?"wss":"ws",r=e.replace(/^https?:\/\//,"");return`${t}://${r}/v2/threads/ws`},Ye=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t)?.accessToken??null:null}catch{return null}},K=l.createContext(null),Ue=({children:e,reconnect:t=!0,enabled:r=!0,url:s,token:o})=>{const[a,c]=l.useState(!1),[d,u]=l.useState(!1),[p,i]=l.useState(0),{apiURL:m,localStorageKeys:E}=l.useContext(j),v=E?.user||De,_=l.useRef(null),k=l.useRef(new Set);l.useEffect(()=>{if(!r)return;const w=s||(m?Me(m):null);if(!w)return;const O=()=>o??Ye(v),X=x=>{x.type==="ready"&&(u(!0),i(x.unreadCount??0));for(const F of k.current)F(x)},z=setTimeout(()=>{const x=new ee({getToken:O,onConnectionChange:F=>{c(F),F||u(!1)},onEvent:X,reconnect:t,url:w});_.current=x,x.connect()},0);return()=>{clearTimeout(z),_.current?.disconnect(),_.current=null}},[r,s,o,m,t,v]);const P=l.useCallback(w=>{_.current?.joinThread(w)},[]),y=l.useCallback(w=>{_.current?.leaveThread(w)},[]),f=l.useCallback((w,O)=>{_.current?.sendMessage(w,O)},[]),S=l.useCallback(w=>{_.current?.markRead(w)},[]),R=l.useCallback((w,O)=>{_.current?.listThreads(w,O)},[]),A=l.useCallback((w=1)=>{i(O=>O+w)},[]),N=l.useCallback((w=1)=>{i(O=>Math.max(0,O-w))},[]),B=l.useCallback(w=>(k.current.add(w),()=>{k.current.delete(w)}),[]),H={decrementUnreadCount:N,incrementUnreadCount:A,isConnected:a,isReady:d,joinThread:P,leaveThread:y,listThreads:R,markRead:S,sendMessage:f,subscribe:B,unreadCount:p};return I.jsx(K.Provider,{value:H,children:e})},ze=e=>e&&typeof e=="function",We=e=>e&&typeof e=="function",Ge=({children:e,defaultQueriesOptions:t,defaultMutationsOptions:r,...s})=>{const{libraries:o}=l.useContext(j),a=s?.QueryClient||o?.reactQuery?.QueryClient,c=s?.QueryClientProvider||o?.reactQuery?.QueryClientProvider;if(!a)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!ze(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!We(a))throw new Error("Provided QueryClient dependencies are not valid.");const d=new a({defaultOptions:{mutations:{...r},queries:{getNextPageParam:(u,p,i)=>u.length+(i||0),refetchOnWindowFocus:!1,retry:3,...t}}});return I.jsx(c,{client:d,children:e})},se=({library:e,date:t,format:r="ll"})=>e(t).format(r),ae=(e,t)=>{const{fractionDigits:r=0,metric:s="km",spacingBetween:o=!0}=t||{},a=Number(e),c=o?" ":"";return Number.isNaN(a)?`0${c}${s}`:`${a.toFixed(r)}${c}${s}`},ie=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(r=>r.length>0?r.charAt(0).toUpperCase()+r.slice(1):r).join(" "),Ve=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Qe=({path:e,size:t,apiURL:r})=>{if(!e)return"";const s=Ve(e),o=`${r}${s}`,a=o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof t=="number"&&a?`${o.replace("/files",`/thumbs/${t}`)}`:o},Je=e=>{const{apiURL:t,libraries:r}=l.useContext(j),s=e?.dayjs||r?.dayjs;return{dateAdapter:(c,d)=>{if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return se({date:c,format:d,library:s})},distanceAdapter:ae,filePathAdapter:(c,d)=>{if(!t)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Qe({apiURL:t,path:c,size:d})},worksiteNameAdapter:ie}},Ke=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(j),s=e?.axios||t?.axios,o=e?.localStorageKey||r?.user||"user";if(!s)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=l.useCallback(({tokenType:d,accessToken:u})=>{s.defaults.headers.common.Authorization=`${d} ${u}`},[s.defaults.headers.common]),c=()=>{s.defaults.headers.common.Authorization=null};return l.useEffect(()=>{if(U)return;const d=({newValue:u,key:p})=>{if(p===o&&u)try{const{accessToken:i,tokenType:m}=JSON.parse(u);a({accessToken:i,tokenType:m})}catch(i){console.error("Failed to parse newValue from localStorage:",i)}};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}},[o,a]),{clearAuthenticationToken:c,setAuthenticationToken:a}},Be=e=>{const t=l.useContext(K);if(!t)throw new Error("useChat must be used within ChatProvider");const{subscribe:r,...s}=t,o=l.useRef(e);return o.current=e,l.useEffect(()=>r(a=>{const{onReady:c,onNewMessage:d,onNewMessageNotification:u,onPresence:p,onError:i,onJoinedThread:m,onLeftThread:E,onMarkedRead:v,onThreadsList:_}=o.current??{};switch(a.type){case"ready":c?.(a);break;case"new_message":d?.(a);break;case"new_message_notification":u?.(a);break;case"presence":p?.(a);break;case"error":i?.(a);break;case"joined_thread":m?.(a);break;case"left_thread":E?.(a);break;case"marked_read":v?.(a);break;case"threads_list":_?.(a);break}}),[r]),s},G=(e,t)=>t==="short"?e.split("-")[0]:e,He=(e,t="full")=>{const[r,s]=l.useState(()=>{const o=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,G(o,t)});return l.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&s(G(e.language,t));const o=a=>{s(G(a,t))};return e?.on?.("languageChanged",o),()=>{e?.off?.("languageChanged",o)}},[e,t]),r},Xe="tracktor.filter",Ze={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},ce=e=>{try{return JSON.parse(e)}catch{return e}},le=(e,t,r)=>`${r}_${e}=>${t}`,qe=e=>e.reduce((t,r)=>{const s=localStorage.getItem(r);if(s)try{const o=JSON.parse(s),a=Object.keys(o)?.[0];a&&(t[a]=Object.values(o)?.[0])}catch{}return t},{}),$e=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(j),s=e?.reactRouter||t?.reactRouter,{pathname:o}=s?.useLocation?.()??{pathname:"/"},[a,c]=s?.useSearchParams?.()??[new URLSearchParams,()=>{}],[d,u]=l.useState({}),p=r?.filter||Xe,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl,m=e?.persistToLocalStorage===void 0?!0:e?.persistToLocalStorage;if(U)return Ze;if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const E=()=>Object.keys(localStorage).filter(y=>y.startsWith(p)&&y.endsWith(e?.pathname||o)),v=(y,f,S=!0)=>{const R=le(y,e?.pathname||o,p);if(!f||Array.isArray(f)&&!f.length){i?(a.delete(y),c(a)):u(A=>{const N={...A};return delete N[y],N}),m&&localStorage.removeItem(R);return}m&&S&&f&&localStorage.setItem(R,JSON.stringify({...a,[y]:f})),i&&f?(a.set(y,JSON.stringify(f)),c(a)):!i&&f&&u(A=>({...A,[y]:f}))};return{getFilter:(y,f)=>{if(i){const S=a.get(y);if(S)return ce(S)}else{const S=d[y];if(S!==void 0)return S}if(m){const S=le(y,e?.pathname||o,p),R=localStorage.getItem(S);if(R)try{const A=JSON.parse(R)[y];return!i&&A!==void 0&&u(N=>({...N,[y]:A})),A}catch{}}return f},getFilters:()=>{const y=m?qe(E()):{};if(i){const f=Array.from(a.entries()).reduce((S,[R,A])=>(S[R]=ce(A),S),{});return{...y,...f}}return{...y,...d}},handleFilter:(y,f)=>(S,R)=>{if(R||Array.isArray(R)&&R.length===0){const A=f||"value",N=typeof R=="object"&&A in R?R[A]:R;v(y,N);return}v(y,void 0)},setFilter:v}},et=({data:e,fetchNextPage:t,isFetchingNextPage:r,isInitialLoading:s,isLoading:o,enabled:a=!0})=>{const c=l.useCallback(async u=>{r||!a||await t({pageParam:u?.pageParam||u.visibleRowsCount})},[a,t,r]),d=l.useMemo(()=>{if(e)return e.pages.reduce((u,p)=>[...u,...p],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:r||o,loadingVariant:s?"skeleton":"linear-progress",rows:d}},tt=e=>{const{libraries:t}=l.useContext(j),r=e?.i18||t?.i18,s=e?.i18?.translateFunction||t?.i18?.translateFunction,o=r?.i18next?.t||s||(p=>p),{unknownErrorTranslationKey:a="error.unknownError"}=e||{},c=o(a),d=l.useCallback(p=>{if(p&&typeof p=="object"&&"response"in p){const{response:i}=p||{};if(i&&typeof i=="object"&&"reason"in i&&i.reason)return String(i.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"reason"in i.data&&i.data.reason)return String(i.data.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"message"in i.data&&i.data.message)return String(i.data.message);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"detail"in i.data){const{detail:m}=i.data;if(Array.isArray(m)&&m.length>0&&typeof m[0]=="object"&&m[0]!==null&&"msg"in m[0]){const{msg:E}=m[0];if(typeof E=="string")return String(E)}}}return p instanceof Error?p.message:c},[c]);return{getErrorCode:l.useCallback(p=>{const{response:i}=p||{};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"},[]),printError:d}};g.ChatClient=ee,g.ChatContext=K,g.ChatProvider=Ue,g.GTMSendPageView=Ce,g.InitializeAxiosConfig=Re,g.InitializeDaysJSConfig=be,g.InitializeI18nConfig=Te,g.InitializeSentryConfig=Se,g.InjectDependenciesContext=j,g.InjectDependenciesProvider=we,g.MaskTextField=ve,g.PreloadErrorHandler=Ae,g.QueryClientProviderWithConfig=Ge,g.RequireAuth=je,g.axiosCustomInstance=ge,g.dateAdapter=se,g.distanceAdapter=ae,g.getOrvalConfig=Fe,g.useAdapter=Je,g.useAuth=Ke,g.useChat=Be,g.useCurrentLanguage=He,g.useFilters=$e,g.useInfiniteDataGrid=et,g.useResponseError=tt,g.worksiteNameAdapter=ie,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|