@tracktor/shared-module 2.23.0 → 2.24.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/README.md +29 -13
- package/dist/context/ChatProvider.d.ts +14 -0
- package/dist/hooks/useChat.d.ts +7 -10
- package/dist/main.d.ts +2 -0
- package/dist/main.js +334 -327
- package/dist/main.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import oe from "axios";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import me, { useMemo as te, createContext as pe, useContext as j, useEffect as I, useState as M, Suspense as ye, useRef as se, useCallback as O } from "react";
|
|
3
|
+
const Je = (e, t) => {
|
|
4
4
|
const n = oe.CancelToken.source(), s = oe({
|
|
5
5
|
...e,
|
|
6
6
|
...t,
|
|
@@ -9,8 +9,8 @@ const Qe = (e, t) => {
|
|
|
9
9
|
return s.cancel = () => {
|
|
10
10
|
n.cancel("Query was cancelled");
|
|
11
11
|
}, s;
|
|
12
|
-
},
|
|
13
|
-
class
|
|
12
|
+
}, ve = 3e4, ae = 1e3;
|
|
13
|
+
class we {
|
|
14
14
|
url;
|
|
15
15
|
getToken;
|
|
16
16
|
onEvent;
|
|
@@ -93,7 +93,7 @@ class Ee {
|
|
|
93
93
|
}
|
|
94
94
|
scheduleReconnect() {
|
|
95
95
|
this.clearReconnectTimer();
|
|
96
|
-
const t = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt,
|
|
96
|
+
const t = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, ve);
|
|
97
97
|
this.reconnectAttempt++, this.reconnectTimer = setTimeout(() => {
|
|
98
98
|
this.connect();
|
|
99
99
|
}, t);
|
|
@@ -102,9 +102,9 @@ class Ee {
|
|
|
102
102
|
this.reconnectTimer !== null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
var
|
|
105
|
+
var G = { exports: {} }, D = {};
|
|
106
106
|
var ie;
|
|
107
|
-
function
|
|
107
|
+
function Ee() {
|
|
108
108
|
if (ie) return D;
|
|
109
109
|
ie = 1;
|
|
110
110
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
@@ -112,8 +112,8 @@ function ve() {
|
|
|
112
112
|
var c = null;
|
|
113
113
|
if (a !== void 0 && (c = "" + a), o.key !== void 0 && (c = "" + o.key), "key" in o) {
|
|
114
114
|
a = {};
|
|
115
|
-
for (var
|
|
116
|
-
|
|
115
|
+
for (var u in o)
|
|
116
|
+
u !== "key" && (a[u] = o[u]);
|
|
117
117
|
} else a = o;
|
|
118
118
|
return o = a.ref, {
|
|
119
119
|
$$typeof: e,
|
|
@@ -127,43 +127,43 @@ function ve() {
|
|
|
127
127
|
}
|
|
128
128
|
var Y = {};
|
|
129
129
|
var ce;
|
|
130
|
-
function
|
|
130
|
+
function Re() {
|
|
131
131
|
return ce || (ce = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
132
132
|
function e(r) {
|
|
133
133
|
if (r == null) return null;
|
|
134
134
|
if (typeof r == "function")
|
|
135
|
-
return r.$$typeof ===
|
|
135
|
+
return r.$$typeof === H ? null : r.displayName || r.name || null;
|
|
136
136
|
if (typeof r == "string") return r;
|
|
137
137
|
switch (r) {
|
|
138
|
-
case
|
|
138
|
+
case P:
|
|
139
139
|
return "Fragment";
|
|
140
140
|
case d:
|
|
141
141
|
return "Profiler";
|
|
142
|
-
case
|
|
142
|
+
case g:
|
|
143
143
|
return "StrictMode";
|
|
144
|
-
case
|
|
144
|
+
case S:
|
|
145
145
|
return "Suspense";
|
|
146
|
-
case
|
|
146
|
+
case q:
|
|
147
147
|
return "SuspenseList";
|
|
148
|
-
case
|
|
148
|
+
case B:
|
|
149
149
|
return "Activity";
|
|
150
150
|
}
|
|
151
151
|
if (typeof r == "object")
|
|
152
152
|
switch (typeof r.tag == "number" && console.error(
|
|
153
153
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
154
154
|
), r.$$typeof) {
|
|
155
|
-
case
|
|
155
|
+
case A:
|
|
156
156
|
return "Portal";
|
|
157
157
|
case E:
|
|
158
158
|
return r.displayName || "Context";
|
|
159
|
-
case y:
|
|
160
|
-
return (r._context.displayName || "Context") + ".Consumer";
|
|
161
159
|
case b:
|
|
160
|
+
return (r._context.displayName || "Context") + ".Consumer";
|
|
161
|
+
case y:
|
|
162
162
|
var p = r.render;
|
|
163
163
|
return r = r.displayName, r || (r = p.displayName || p.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
164
|
-
case G:
|
|
165
|
-
return p = r.displayName || null, p !== null ? p : e(r.type) || "Memo";
|
|
166
164
|
case L:
|
|
165
|
+
return p = r.displayName || null, p !== null ? p : e(r.type) || "Memo";
|
|
166
|
+
case T:
|
|
167
167
|
p = r._payload, r = r._init;
|
|
168
168
|
try {
|
|
169
169
|
return e(r(p));
|
|
@@ -193,8 +193,8 @@ function we() {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
function s(r) {
|
|
196
|
-
if (r ===
|
|
197
|
-
if (typeof r == "object" && r !== null && r.$$typeof ===
|
|
196
|
+
if (r === P) return "<>";
|
|
197
|
+
if (typeof r == "object" && r !== null && r.$$typeof === T)
|
|
198
198
|
return "<...>";
|
|
199
199
|
try {
|
|
200
200
|
var p = e(r);
|
|
@@ -217,7 +217,7 @@ function we() {
|
|
|
217
217
|
}
|
|
218
218
|
return r.key !== void 0;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function u(r, p) {
|
|
221
221
|
function w() {
|
|
222
222
|
W || (W = !0, console.error(
|
|
223
223
|
"%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)",
|
|
@@ -229,23 +229,23 @@ function we() {
|
|
|
229
229
|
configurable: !0
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function l() {
|
|
233
233
|
var r = e(this.type);
|
|
234
|
-
return
|
|
234
|
+
return V[r] || (V[r] = !0, console.error(
|
|
235
235
|
"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."
|
|
236
236
|
)), r = this.props.ref, r !== void 0 ? r : null;
|
|
237
237
|
}
|
|
238
|
-
function f(r, p, w, R,
|
|
238
|
+
function f(r, p, w, R, J, Z) {
|
|
239
239
|
var _ = w.ref;
|
|
240
240
|
return r = {
|
|
241
|
-
$$typeof:
|
|
241
|
+
$$typeof: k,
|
|
242
242
|
type: r,
|
|
243
243
|
key: p,
|
|
244
244
|
props: w,
|
|
245
245
|
_owner: R
|
|
246
246
|
}, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(r, "ref", {
|
|
247
247
|
enumerable: !1,
|
|
248
|
-
get:
|
|
248
|
+
get: l
|
|
249
249
|
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
250
250
|
configurable: !1,
|
|
251
251
|
enumerable: !1,
|
|
@@ -260,31 +260,31 @@ function we() {
|
|
|
260
260
|
configurable: !1,
|
|
261
261
|
enumerable: !1,
|
|
262
262
|
writable: !0,
|
|
263
|
-
value:
|
|
263
|
+
value: J
|
|
264
264
|
}), Object.defineProperty(r, "_debugTask", {
|
|
265
265
|
configurable: !1,
|
|
266
266
|
enumerable: !1,
|
|
267
267
|
writable: !0,
|
|
268
|
-
value:
|
|
268
|
+
value: Z
|
|
269
269
|
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
270
270
|
}
|
|
271
|
-
function i(r, p, w, R,
|
|
271
|
+
function i(r, p, w, R, J, Z) {
|
|
272
272
|
var _ = p.children;
|
|
273
273
|
if (_ !== void 0)
|
|
274
274
|
if (R)
|
|
275
|
-
if (
|
|
275
|
+
if (X(_)) {
|
|
276
276
|
for (R = 0; R < _.length; R++)
|
|
277
|
-
|
|
277
|
+
h(_[R]);
|
|
278
278
|
Object.freeze && Object.freeze(_);
|
|
279
279
|
} else
|
|
280
280
|
console.error(
|
|
281
281
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
282
282
|
);
|
|
283
|
-
else
|
|
283
|
+
else h(_);
|
|
284
284
|
if (z.call(p, "key")) {
|
|
285
285
|
_ = e(r);
|
|
286
|
-
var N = Object.keys(p).filter(function(
|
|
287
|
-
return
|
|
286
|
+
var N = Object.keys(p).filter(function(ge) {
|
|
287
|
+
return ge !== "key";
|
|
288
288
|
});
|
|
289
289
|
R = 0 < N.length ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}", ne[_ + R] || (N = 0 < N.length ? "{" + N.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
290
290
|
`A props object containing a "key" prop is being spread into JSX:
|
|
@@ -301,10 +301,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
301
301
|
}
|
|
302
302
|
if (_ = null, w !== void 0 && (n(w), _ = "" + w), c(p) && (n(p.key), _ = "" + p.key), "key" in p) {
|
|
303
303
|
w = {};
|
|
304
|
-
for (var
|
|
305
|
-
|
|
304
|
+
for (var ee in p)
|
|
305
|
+
ee !== "key" && (w[ee] = p[ee]);
|
|
306
306
|
} else w = p;
|
|
307
|
-
return _ &&
|
|
307
|
+
return _ && u(
|
|
308
308
|
w,
|
|
309
309
|
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
310
310
|
), f(
|
|
@@ -312,36 +312,36 @@ React keys must be passed directly to JSX without using spread:
|
|
|
312
312
|
_,
|
|
313
313
|
w,
|
|
314
314
|
o(),
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
J,
|
|
316
|
+
Z
|
|
317
317
|
);
|
|
318
318
|
}
|
|
319
|
-
function g(r) {
|
|
320
|
-
h(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === L && (r._payload.status === "fulfilled" ? h(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
|
|
321
|
-
}
|
|
322
319
|
function h(r) {
|
|
323
|
-
|
|
320
|
+
v(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === T && (r._payload.status === "fulfilled" ? v(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
|
|
321
|
+
}
|
|
322
|
+
function v(r) {
|
|
323
|
+
return typeof r == "object" && r !== null && r.$$typeof === k;
|
|
324
324
|
}
|
|
325
|
-
var
|
|
325
|
+
var m = me, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), P = /* @__PURE__ */ Symbol.for("react.fragment"), g = /* @__PURE__ */ Symbol.for("react.strict_mode"), d = /* @__PURE__ */ Symbol.for("react.profiler"), b = /* @__PURE__ */ Symbol.for("react.consumer"), E = /* @__PURE__ */ Symbol.for("react.context"), y = /* @__PURE__ */ Symbol.for("react.forward_ref"), S = /* @__PURE__ */ Symbol.for("react.suspense"), q = /* @__PURE__ */ Symbol.for("react.suspense_list"), L = /* @__PURE__ */ Symbol.for("react.memo"), T = /* @__PURE__ */ Symbol.for("react.lazy"), B = /* @__PURE__ */ Symbol.for("react.activity"), H = /* @__PURE__ */ Symbol.for("react.client.reference"), $ = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, z = Object.prototype.hasOwnProperty, X = Array.isArray, F = console.createTask ? console.createTask : function() {
|
|
326
326
|
return null;
|
|
327
327
|
};
|
|
328
|
-
|
|
328
|
+
m = {
|
|
329
329
|
react_stack_bottom_frame: function(r) {
|
|
330
330
|
return r();
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
|
-
var W,
|
|
334
|
-
|
|
333
|
+
var W, V = {}, Q = m.react_stack_bottom_frame.bind(
|
|
334
|
+
m,
|
|
335
335
|
a
|
|
336
336
|
)(), re = F(s(a)), ne = {};
|
|
337
|
-
Y.Fragment =
|
|
337
|
+
Y.Fragment = P, Y.jsx = function(r, p, w) {
|
|
338
338
|
var R = 1e4 > $.recentlyCreatedOwnerStacks++;
|
|
339
339
|
return i(
|
|
340
340
|
r,
|
|
341
341
|
p,
|
|
342
342
|
w,
|
|
343
343
|
!1,
|
|
344
|
-
R ? Error("react-stack-top-frame") :
|
|
344
|
+
R ? Error("react-stack-top-frame") : Q,
|
|
345
345
|
R ? F(s(r)) : re
|
|
346
346
|
);
|
|
347
347
|
}, Y.jsxs = function(r, p, w) {
|
|
@@ -351,26 +351,26 @@ React keys must be passed directly to JSX without using spread:
|
|
|
351
351
|
p,
|
|
352
352
|
w,
|
|
353
353
|
!0,
|
|
354
|
-
R ? Error("react-stack-top-frame") :
|
|
354
|
+
R ? Error("react-stack-top-frame") : Q,
|
|
355
355
|
R ? F(s(r)) : re
|
|
356
356
|
);
|
|
357
357
|
};
|
|
358
358
|
})()), Y;
|
|
359
359
|
}
|
|
360
360
|
var le;
|
|
361
|
-
function
|
|
362
|
-
return le || (le = 1, process.env.NODE_ENV === "production" ?
|
|
361
|
+
function _e() {
|
|
362
|
+
return le || (le = 1, process.env.NODE_ENV === "production" ? G.exports = Ee() : G.exports = Re()), G.exports;
|
|
363
363
|
}
|
|
364
|
-
var
|
|
365
|
-
const
|
|
366
|
-
const n =
|
|
364
|
+
var x = _e();
|
|
365
|
+
const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
366
|
+
const n = te(
|
|
367
367
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
368
|
-
() => e(({ TextField: s, ...o }) => /* @__PURE__ */
|
|
368
|
+
() => e(({ TextField: s, ...o }) => /* @__PURE__ */ x.jsx(s, { ...o })),
|
|
369
369
|
[e]
|
|
370
370
|
);
|
|
371
|
-
return /* @__PURE__ */
|
|
372
|
-
},
|
|
373
|
-
const o =
|
|
371
|
+
return /* @__PURE__ */ x.jsx(n, { ...t });
|
|
372
|
+
}, C = pe({}), Ke = ({ children: e, apiURL: t, libraries: n, localStorageKeys: s }) => {
|
|
373
|
+
const o = te(
|
|
374
374
|
() => ({
|
|
375
375
|
apiURL: t,
|
|
376
376
|
libraries: n,
|
|
@@ -378,23 +378,23 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
378
378
|
}),
|
|
379
379
|
[t, n, s]
|
|
380
380
|
);
|
|
381
|
-
return /* @__PURE__ */
|
|
382
|
-
},
|
|
383
|
-
const { libraries: n } =
|
|
381
|
+
return /* @__PURE__ */ x.jsx(C.Provider, { value: o, children: e });
|
|
382
|
+
}, qe = ({ data: e, ...t }) => {
|
|
383
|
+
const { libraries: n } = j(C), s = t?.reactRouter || n?.reactRouter, o = t?.gtm || n?.gtm;
|
|
384
384
|
if (!s)
|
|
385
385
|
throw new Error(
|
|
386
386
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
387
387
|
);
|
|
388
388
|
if (!o)
|
|
389
389
|
throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
390
|
-
const { useGoogleTagManager: a } = o, { useLocation: c, Outlet:
|
|
390
|
+
const { useGoogleTagManager: a } = o, { useLocation: c, Outlet: u } = s, { pathname: l } = c(), { sendEvent: f } = a();
|
|
391
391
|
return I(() => {
|
|
392
392
|
f({
|
|
393
393
|
event: "pageView",
|
|
394
|
-
pathname:
|
|
394
|
+
pathname: l,
|
|
395
395
|
...e
|
|
396
396
|
});
|
|
397
|
-
}, [e,
|
|
397
|
+
}, [e, l, f]), /* @__PURE__ */ x.jsx(u, {});
|
|
398
398
|
}, U = (() => {
|
|
399
399
|
try {
|
|
400
400
|
return typeof global == "object" && global !== null && ("HermesInternal" in global || // Hermes JS engine
|
|
@@ -403,24 +403,24 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
403
403
|
} catch {
|
|
404
404
|
return !1;
|
|
405
405
|
}
|
|
406
|
-
})(),
|
|
406
|
+
})(), be = "user", Be = ({
|
|
407
407
|
tokenTypeKey: e = "tokenType",
|
|
408
408
|
tokenKey: t = "accessToken",
|
|
409
409
|
postContentType: n = "application/json",
|
|
410
410
|
...s
|
|
411
411
|
}) => {
|
|
412
|
-
const { apiURL: o = s.apiURL, libraries: a, localStorageKeys: c } =
|
|
413
|
-
if (!
|
|
412
|
+
const { apiURL: o = s.apiURL, libraries: a, localStorageKeys: c } = j(C), u = s?.userLocalStorageKey || c?.user || be, l = s?.axios || a?.axios;
|
|
413
|
+
if (!l)
|
|
414
414
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
415
|
-
if (!
|
|
415
|
+
if (!l?.defaults || U)
|
|
416
416
|
return null;
|
|
417
417
|
if (typeof window < "u" && window.localStorage) {
|
|
418
|
-
const f = localStorage.getItem(
|
|
419
|
-
|
|
418
|
+
const f = localStorage.getItem(u), i = f ? JSON.parse(f) : null, h = i?.[e] ? i[e] : null, v = i?.[t] ? i[t] : null, m = f ? `${h} ${v}` : null;
|
|
419
|
+
m && (l.defaults.headers.common.Authorization = m);
|
|
420
420
|
}
|
|
421
|
-
return
|
|
422
|
-
},
|
|
423
|
-
const { libraries: n } =
|
|
421
|
+
return l.defaults.baseURL = o, l.defaults.headers.post["Content-Type"] = n, null;
|
|
422
|
+
}, He = ({ language: e, ...t }) => {
|
|
423
|
+
const { libraries: n } = j(C), s = t?.dayjs || n?.dayjs, o = t?.plugin || n?.dayjsPlugin;
|
|
424
424
|
if (!s)
|
|
425
425
|
throw new Error(
|
|
426
426
|
"Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
|
|
@@ -428,18 +428,18 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
428
428
|
return I(() => {
|
|
429
429
|
(async () => {
|
|
430
430
|
const c = e || navigator.language?.slice(0, 2) || "en";
|
|
431
|
-
o && o.forEach((
|
|
432
|
-
|
|
431
|
+
o && o.forEach((u) => {
|
|
432
|
+
u && s.extend(u);
|
|
433
433
|
}), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), s.locale(c);
|
|
434
434
|
})().then();
|
|
435
435
|
}, [s, o, e]), null;
|
|
436
|
-
},
|
|
437
|
-
const { libraries: s } =
|
|
436
|
+
}, Xe = ({ debug: e, resources: t, ...n }) => {
|
|
437
|
+
const { libraries: s } = j(C), o = n?.i18 || s?.i18, { i18next: a, initReactI18next: c, languageDetector: u } = o || {};
|
|
438
438
|
if (U)
|
|
439
439
|
return null;
|
|
440
440
|
if (!o)
|
|
441
441
|
throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
442
|
-
return a?.isInitialized || (a.use(
|
|
442
|
+
return a?.isInitialized || (a.use(u).use(c).init({
|
|
443
443
|
debug: e,
|
|
444
444
|
fallbackLng: "en",
|
|
445
445
|
interpolation: {
|
|
@@ -454,10 +454,10 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
454
454
|
returnNull: !1
|
|
455
455
|
}).then(() => {
|
|
456
456
|
document.documentElement.lang !== a.resolvedLanguage && a.resolvedLanguage && document.documentElement.setAttribute("lang", a.resolvedLanguage);
|
|
457
|
-
}), a.on("languageChanged", (
|
|
458
|
-
document.documentElement.setAttribute("lang",
|
|
457
|
+
}), a.on("languageChanged", (l) => {
|
|
458
|
+
document.documentElement.setAttribute("lang", l);
|
|
459
459
|
})), null;
|
|
460
|
-
},
|
|
460
|
+
}, Ze = ({
|
|
461
461
|
dsn: e,
|
|
462
462
|
integrations: t,
|
|
463
463
|
tracesSampleRate: n,
|
|
@@ -465,23 +465,23 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
465
465
|
replaysOnErrorSampleRate: o,
|
|
466
466
|
tracePropagationTargets: a,
|
|
467
467
|
ignoreErrors: c,
|
|
468
|
-
debug:
|
|
469
|
-
environment:
|
|
468
|
+
debug: u,
|
|
469
|
+
environment: l,
|
|
470
470
|
release: f,
|
|
471
471
|
...i
|
|
472
472
|
}) => {
|
|
473
|
-
const { libraries:
|
|
474
|
-
if (!h)
|
|
475
|
-
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
473
|
+
const { libraries: h } = j(C), v = i?.sentry || h?.sentry, m = i?.reactRouter || h?.reactRouter;
|
|
476
474
|
if (!v)
|
|
475
|
+
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
476
|
+
if (!m)
|
|
477
477
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
478
|
-
if (
|
|
478
|
+
if (v.isInitialized())
|
|
479
479
|
return null;
|
|
480
|
-
const { createRoutesFromChildren:
|
|
481
|
-
return (
|
|
482
|
-
debug:
|
|
480
|
+
const { createRoutesFromChildren: k, matchRoutes: A, useLocation: P, useNavigationType: g } = m;
|
|
481
|
+
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && v.init({
|
|
482
|
+
debug: u,
|
|
483
483
|
dsn: e,
|
|
484
|
-
environment:
|
|
484
|
+
environment: l || "production",
|
|
485
485
|
ignoreErrors: [
|
|
486
486
|
...c || [],
|
|
487
487
|
/dynamically imported module/,
|
|
@@ -492,12 +492,12 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
492
492
|
/vite:preloadError/
|
|
493
493
|
],
|
|
494
494
|
integrations: [
|
|
495
|
-
|
|
496
|
-
createRoutesFromChildren:
|
|
497
|
-
matchRoutes:
|
|
495
|
+
v.reactRouterV6BrowserTracingIntegration({
|
|
496
|
+
createRoutesFromChildren: k,
|
|
497
|
+
matchRoutes: A,
|
|
498
498
|
useEffect: I,
|
|
499
|
-
useLocation:
|
|
500
|
-
useNavigationType:
|
|
499
|
+
useLocation: P,
|
|
500
|
+
useNavigationType: g
|
|
501
501
|
}),
|
|
502
502
|
...t || []
|
|
503
503
|
],
|
|
@@ -507,7 +507,7 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
507
507
|
tracePropagationTargets: a,
|
|
508
508
|
tracesSampleRate: n || 1
|
|
509
509
|
}), null;
|
|
510
|
-
},
|
|
510
|
+
}, et = () => (I(() => {
|
|
511
511
|
if (U)
|
|
512
512
|
return;
|
|
513
513
|
const e = (t) => {
|
|
@@ -519,27 +519,27 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
519
519
|
return window.addEventListener("vite:preloadError", e), () => {
|
|
520
520
|
window.removeEventListener("vite:preloadError", e);
|
|
521
521
|
};
|
|
522
|
-
}, []), null), ue = /* @__PURE__ */ new WeakMap(),
|
|
523
|
-
const { libraries: a, localStorageKeys: c } =
|
|
524
|
-
if (!
|
|
522
|
+
}, []), null), ue = /* @__PURE__ */ new WeakMap(), Te = "user", tt = ({ Fallback: e, isLogged: t, loginPath: n = "/login", redirect401Path: s = "/login", ...o }) => {
|
|
523
|
+
const { libraries: a, localStorageKeys: c } = j(C), u = o?.reactRouter || a?.reactRouter, l = o?.axios || a?.axios, f = o?.localStorageKey || c?.user || Te;
|
|
524
|
+
if (!u)
|
|
525
525
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
526
|
-
const [i,
|
|
526
|
+
const [i, h] = M(null), { useLocation: v, Navigate: m, Outlet: k } = u, A = v(), P = typeof t == "function" ? t() : !!t, g = typeof P == "boolean" ? P : P?.isLogged;
|
|
527
527
|
return I(() => {
|
|
528
|
-
ue.has(
|
|
528
|
+
ue.has(l) || (ue.set(l, !0), l.interceptors.response.use(
|
|
529
529
|
(d) => d,
|
|
530
|
-
(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 && (
|
|
530
|
+
(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))
|
|
531
531
|
));
|
|
532
|
-
}, [
|
|
533
|
-
},
|
|
532
|
+
}, [l, f, s]), g && !i ? /* @__PURE__ */ x.jsx(ye, { fallback: e, children: A.state?.from?.state && A.state?.from?.pathname === n ? /* @__PURE__ */ x.jsx(m, { to: A.state.from.state.from.pathname + A.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ x.jsx(k, {}) }) : /* @__PURE__ */ x.jsx(m, { to: n + A.search, state: { from: A }, replace: !0 });
|
|
533
|
+
}, Se = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), Ae = (e) => {
|
|
534
534
|
const t = e.split(/[/\\]/).pop() || "";
|
|
535
535
|
return t.substring(0, t.lastIndexOf("."));
|
|
536
|
-
},
|
|
537
|
-
const s = e.split("/").filter((o) => o.length > 0).map((o) => o.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((
|
|
536
|
+
}, je = (e) => {
|
|
537
|
+
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("");
|
|
538
538
|
return s.charAt(0).toLowerCase() + s.slice(1);
|
|
539
|
-
},
|
|
540
|
-
const o =
|
|
539
|
+
}, Ce = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), ke = (e, t, n, s) => {
|
|
540
|
+
const o = je(t), a = Se(n), c = `${o}${a}`;
|
|
541
541
|
return e && typeof e == "object" && "operationId" in e && s?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
|
|
542
|
-
},
|
|
542
|
+
}, Pe = (e, t) => {
|
|
543
543
|
const n = {};
|
|
544
544
|
return e?.forEach((s) => {
|
|
545
545
|
n[s] = {
|
|
@@ -556,30 +556,30 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
556
556
|
}
|
|
557
557
|
};
|
|
558
558
|
}), Object.keys(n).length ? n : void 0;
|
|
559
|
-
},
|
|
560
|
-
const { output: o, useInfiniteIds: a, useQueryIds: c, input:
|
|
559
|
+
}, rt = (e) => (Array.isArray(e) ? e : [e]).reduce((n, s) => {
|
|
560
|
+
const { output: o, useInfiniteIds: a, useQueryIds: c, input: u = "./openapi.json", customAxiosInstancePath: l, overrideApiName: f } = s || {}, i = f || Ce(u), h = l || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
|
|
561
561
|
return {
|
|
562
562
|
...n,
|
|
563
563
|
[i]: {
|
|
564
|
-
input:
|
|
564
|
+
input: u,
|
|
565
565
|
output: {
|
|
566
566
|
baseUrl: o?.baseUrl,
|
|
567
567
|
client: "react-query",
|
|
568
568
|
mode: "tags-split",
|
|
569
569
|
override: {
|
|
570
570
|
...(a?.length || c?.length) && {
|
|
571
|
-
operations:
|
|
571
|
+
operations: Pe(a, c)
|
|
572
572
|
},
|
|
573
|
-
header: (
|
|
573
|
+
header: (v) => [
|
|
574
574
|
"Generated by orval 🍺",
|
|
575
|
-
...
|
|
576
|
-
...
|
|
575
|
+
...v.title ? [v.title] : [],
|
|
576
|
+
...v.description ? [v.description] : []
|
|
577
577
|
],
|
|
578
578
|
mutator: {
|
|
579
|
-
name:
|
|
580
|
-
path:
|
|
579
|
+
name: Ae(h),
|
|
580
|
+
path: h
|
|
581
581
|
},
|
|
582
|
-
operationName: (
|
|
582
|
+
operationName: (v, m, k) => ke(v, m, k, c),
|
|
583
583
|
query: {
|
|
584
584
|
useQuery: !0
|
|
585
585
|
}
|
|
@@ -590,76 +590,168 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
};
|
|
593
|
-
}, {}),
|
|
593
|
+
}, {}), xe = "user", Oe = (e) => {
|
|
594
|
+
const t = e.startsWith("https") ? "wss" : "ws", n = e.replace(/^https?:\/\//, "");
|
|
595
|
+
return `${t}://${n}/v2/threads/ws`;
|
|
596
|
+
}, Ie = (e) => {
|
|
597
|
+
try {
|
|
598
|
+
const t = localStorage.getItem(e);
|
|
599
|
+
return t ? JSON.parse(t)?.accessToken ?? null : null;
|
|
600
|
+
} catch {
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
}, he = pe(null), nt = ({ children: e, ...t }) => {
|
|
604
|
+
const [n, s] = M(!1), [o, a] = M(!1), { apiURL: c, localStorageKeys: u } = j(C), { reconnect: l = !0, enabled: f = !0, url: i, token: h } = t, v = u?.user || xe, m = se(null), k = se(t);
|
|
605
|
+
k.current = t, I(() => {
|
|
606
|
+
if (!f || m.current?.connected)
|
|
607
|
+
return;
|
|
608
|
+
const y = i || (c ? Oe(c) : null);
|
|
609
|
+
if (!y)
|
|
610
|
+
return;
|
|
611
|
+
const S = () => h ?? Ie(v), q = (T) => {
|
|
612
|
+
const {
|
|
613
|
+
onError: B,
|
|
614
|
+
onReady: H,
|
|
615
|
+
onNewMessage: $,
|
|
616
|
+
onNewMessageNotification: z,
|
|
617
|
+
onPresence: X,
|
|
618
|
+
onJoinedThread: F,
|
|
619
|
+
onLeftThread: W,
|
|
620
|
+
onMarkedRead: V,
|
|
621
|
+
onThreadsList: Q
|
|
622
|
+
} = k.current || {};
|
|
623
|
+
switch (T.type) {
|
|
624
|
+
case "ready":
|
|
625
|
+
a(!0), H?.(T);
|
|
626
|
+
break;
|
|
627
|
+
case "new_message":
|
|
628
|
+
$?.(T);
|
|
629
|
+
break;
|
|
630
|
+
case "new_message_notification":
|
|
631
|
+
z?.(T);
|
|
632
|
+
break;
|
|
633
|
+
case "presence":
|
|
634
|
+
X?.(T);
|
|
635
|
+
break;
|
|
636
|
+
case "error":
|
|
637
|
+
B?.(T);
|
|
638
|
+
break;
|
|
639
|
+
case "joined_thread":
|
|
640
|
+
F?.(T);
|
|
641
|
+
break;
|
|
642
|
+
case "left_thread":
|
|
643
|
+
W?.(T);
|
|
644
|
+
break;
|
|
645
|
+
case "marked_read":
|
|
646
|
+
V?.(T);
|
|
647
|
+
break;
|
|
648
|
+
case "threads_list":
|
|
649
|
+
Q?.(T);
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
652
|
+
}, L = new we({
|
|
653
|
+
getToken: S,
|
|
654
|
+
onConnectionChange: (T) => {
|
|
655
|
+
s(T), T || a(!1);
|
|
656
|
+
},
|
|
657
|
+
onEvent: q,
|
|
658
|
+
reconnect: l,
|
|
659
|
+
url: y
|
|
660
|
+
});
|
|
661
|
+
return m.current = L, L.connect(), () => {
|
|
662
|
+
L.disconnect(), m.current = null;
|
|
663
|
+
};
|
|
664
|
+
}, [f, i, h, c, l, v]);
|
|
665
|
+
const A = O((y) => {
|
|
666
|
+
m.current?.joinThread(y);
|
|
667
|
+
}, []), P = O((y) => {
|
|
668
|
+
m.current?.leaveThread(y);
|
|
669
|
+
}, []), g = O((y, S) => {
|
|
670
|
+
m.current?.sendMessage(y, S);
|
|
671
|
+
}, []), d = O((y) => {
|
|
672
|
+
m.current?.markRead(y);
|
|
673
|
+
}, []), b = O((y, S) => {
|
|
674
|
+
m.current?.listThreads(y, S);
|
|
675
|
+
}, []), E = {
|
|
676
|
+
isConnected: n,
|
|
677
|
+
isReady: o,
|
|
678
|
+
joinThread: A,
|
|
679
|
+
leaveThread: P,
|
|
680
|
+
listThreads: b,
|
|
681
|
+
markRead: d,
|
|
682
|
+
sendMessage: g
|
|
683
|
+
};
|
|
684
|
+
return /* @__PURE__ */ x.jsx(he.Provider, { value: E, children: e });
|
|
685
|
+
}, Ne = (e) => e && typeof e == "function", Le = (e) => e && typeof e == "function", ot = ({
|
|
594
686
|
children: e,
|
|
595
687
|
defaultQueriesOptions: t,
|
|
596
688
|
defaultMutationsOptions: n,
|
|
597
689
|
...s
|
|
598
690
|
}) => {
|
|
599
|
-
const { libraries: o } =
|
|
691
|
+
const { libraries: o } = j(C), a = s?.QueryClient || o?.reactQuery?.QueryClient, c = s?.QueryClientProvider || o?.reactQuery?.QueryClientProvider;
|
|
600
692
|
if (!a)
|
|
601
693
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
602
694
|
if (!c)
|
|
603
695
|
throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
604
|
-
if (!
|
|
696
|
+
if (!Ne(c))
|
|
605
697
|
throw new Error("Provided QueryClientProvider dependencies are not valid.");
|
|
606
|
-
if (!
|
|
698
|
+
if (!Le(a))
|
|
607
699
|
throw new Error("Provided QueryClient dependencies are not valid.");
|
|
608
|
-
const
|
|
700
|
+
const u = new a({
|
|
609
701
|
defaultOptions: {
|
|
610
702
|
mutations: {
|
|
611
703
|
...n
|
|
612
704
|
},
|
|
613
705
|
queries: {
|
|
614
|
-
getNextPageParam: (
|
|
706
|
+
getNextPageParam: (l, f, i) => l.length + (i || 0),
|
|
615
707
|
refetchOnWindowFocus: !1,
|
|
616
708
|
retry: 3,
|
|
617
709
|
...t
|
|
618
710
|
}
|
|
619
711
|
}
|
|
620
712
|
});
|
|
621
|
-
return /* @__PURE__ */
|
|
622
|
-
},
|
|
713
|
+
return /* @__PURE__ */ x.jsx(c, { client: u, children: e });
|
|
714
|
+
}, $e = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), Fe = (e, t) => {
|
|
623
715
|
const { fractionDigits: n = 0, metric: s = "km", spacingBetween: o = !0 } = t || {}, a = Number(e), c = o ? " " : "";
|
|
624
716
|
return Number.isNaN(a) ? `0${c}${s}` : `${a.toFixed(n)}${c}${s}`;
|
|
625
|
-
},
|
|
717
|
+
}, De = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((n) => n.length > 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n).join(" "), Ye = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, Me = ({ path: e, size: t, apiURL: n }) => {
|
|
626
718
|
if (!e)
|
|
627
719
|
return "";
|
|
628
|
-
const s =
|
|
720
|
+
const s = Ye(e), o = `${n}${s}`, a = o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
629
721
|
return typeof t == "number" && a ? `${o.replace("/files", `/thumbs/${t}`)}` : o;
|
|
630
|
-
},
|
|
631
|
-
const { apiURL: t, libraries: n } =
|
|
722
|
+
}, st = (e) => {
|
|
723
|
+
const { apiURL: t, libraries: n } = j(C), s = e?.dayjs || n?.dayjs;
|
|
632
724
|
return {
|
|
633
|
-
dateAdapter: (c,
|
|
725
|
+
dateAdapter: (c, u) => {
|
|
634
726
|
if (!s)
|
|
635
727
|
throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
636
|
-
return
|
|
728
|
+
return $e({
|
|
637
729
|
date: c,
|
|
638
|
-
format:
|
|
730
|
+
format: u,
|
|
639
731
|
library: s
|
|
640
732
|
});
|
|
641
733
|
},
|
|
642
|
-
distanceAdapter:
|
|
643
|
-
filePathAdapter: (c,
|
|
734
|
+
distanceAdapter: Fe,
|
|
735
|
+
filePathAdapter: (c, u) => {
|
|
644
736
|
if (!t)
|
|
645
737
|
throw new Error(
|
|
646
738
|
"API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
|
|
647
739
|
);
|
|
648
|
-
return typeof c == "string" && /^https?:\/\//.test(c) ? c :
|
|
740
|
+
return typeof c == "string" && /^https?:\/\//.test(c) ? c : Me({
|
|
649
741
|
apiURL: t,
|
|
650
742
|
path: c,
|
|
651
|
-
size:
|
|
743
|
+
size: u
|
|
652
744
|
});
|
|
653
745
|
},
|
|
654
|
-
worksiteNameAdapter:
|
|
746
|
+
worksiteNameAdapter: De
|
|
655
747
|
};
|
|
656
|
-
},
|
|
657
|
-
const { libraries: t, localStorageKeys: n } =
|
|
748
|
+
}, at = (e) => {
|
|
749
|
+
const { libraries: t, localStorageKeys: n } = j(C), s = e?.axios || t?.axios, o = e?.localStorageKey || n?.user || "user";
|
|
658
750
|
if (!s)
|
|
659
751
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
660
|
-
const a =
|
|
661
|
-
({ tokenType:
|
|
662
|
-
s.defaults.headers.common.Authorization = `${
|
|
752
|
+
const a = O(
|
|
753
|
+
({ tokenType: u, accessToken: l }) => {
|
|
754
|
+
s.defaults.headers.common.Authorization = `${u} ${l}`;
|
|
663
755
|
},
|
|
664
756
|
[s.defaults.headers.common]
|
|
665
757
|
), c = () => {
|
|
@@ -668,129 +760,42 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
668
760
|
return I(() => {
|
|
669
761
|
if (U)
|
|
670
762
|
return;
|
|
671
|
-
const
|
|
672
|
-
if (f === o &&
|
|
763
|
+
const u = ({ newValue: l, key: f }) => {
|
|
764
|
+
if (f === o && l)
|
|
673
765
|
try {
|
|
674
|
-
const { accessToken: i, tokenType:
|
|
675
|
-
a({ accessToken: i, tokenType:
|
|
766
|
+
const { accessToken: i, tokenType: h } = JSON.parse(l);
|
|
767
|
+
a({ accessToken: i, tokenType: h });
|
|
676
768
|
} catch (i) {
|
|
677
769
|
console.error("Failed to parse newValue from localStorage:", i);
|
|
678
770
|
}
|
|
679
771
|
};
|
|
680
|
-
return window.addEventListener("storage",
|
|
681
|
-
window.removeEventListener("storage",
|
|
772
|
+
return window.addEventListener("storage", u), () => {
|
|
773
|
+
window.removeEventListener("storage", u);
|
|
682
774
|
};
|
|
683
775
|
}, [o, a]), {
|
|
684
776
|
clearAuthenticationToken: c,
|
|
685
777
|
setAuthenticationToken: a
|
|
686
778
|
};
|
|
687
|
-
},
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
return t ? JSON.parse(t)?.accessToken ?? null : null;
|
|
694
|
-
} catch {
|
|
695
|
-
return null;
|
|
696
|
-
}
|
|
697
|
-
}, st = (e) => {
|
|
698
|
-
const [t, n] = M(!1), [s, o] = M(!1), { apiURL: a, localStorageKeys: c } = k(A), { reconnect: l = !0, enabled: u = !0, url: f, token: i } = e || {}, g = c?.user || Fe, h = se(null), v = se(e);
|
|
699
|
-
v.current = e, I(() => {
|
|
700
|
-
if (!u)
|
|
701
|
-
return;
|
|
702
|
-
const y = f || (a ? De(a) : null);
|
|
703
|
-
if (!y)
|
|
704
|
-
return;
|
|
705
|
-
const E = () => i ?? Ye(g), b = (T) => {
|
|
706
|
-
const {
|
|
707
|
-
onError: G,
|
|
708
|
-
onReady: L,
|
|
709
|
-
onNewMessage: K,
|
|
710
|
-
onNewMessageNotification: q,
|
|
711
|
-
onPresence: $,
|
|
712
|
-
onJoinedThread: z,
|
|
713
|
-
onLeftThread: B,
|
|
714
|
-
onMarkedRead: F,
|
|
715
|
-
onThreadsList: W
|
|
716
|
-
} = v.current || {};
|
|
717
|
-
switch (T.type) {
|
|
718
|
-
case "ready":
|
|
719
|
-
o(!0), L?.(T);
|
|
720
|
-
break;
|
|
721
|
-
case "new_message":
|
|
722
|
-
K?.(T);
|
|
723
|
-
break;
|
|
724
|
-
case "new_message_notification":
|
|
725
|
-
q?.(T);
|
|
726
|
-
break;
|
|
727
|
-
case "presence":
|
|
728
|
-
$?.(T);
|
|
729
|
-
break;
|
|
730
|
-
case "error":
|
|
731
|
-
G?.(T);
|
|
732
|
-
break;
|
|
733
|
-
case "joined_thread":
|
|
734
|
-
z?.(T);
|
|
735
|
-
break;
|
|
736
|
-
case "left_thread":
|
|
737
|
-
B?.(T);
|
|
738
|
-
break;
|
|
739
|
-
case "marked_read":
|
|
740
|
-
F?.(T);
|
|
741
|
-
break;
|
|
742
|
-
case "threads_list":
|
|
743
|
-
W?.(T);
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
}, C = new Ee({
|
|
747
|
-
getToken: E,
|
|
748
|
-
onConnectionChange: (T) => {
|
|
749
|
-
n(T), T || o(!1);
|
|
750
|
-
},
|
|
751
|
-
onEvent: b,
|
|
752
|
-
reconnect: l,
|
|
753
|
-
url: y
|
|
754
|
-
});
|
|
755
|
-
return h.current = C, C.connect(), () => {
|
|
756
|
-
C.disconnect(), h.current = null;
|
|
757
|
-
};
|
|
758
|
-
}, [u, f, i, a, l, g]);
|
|
759
|
-
const P = x((y) => {
|
|
760
|
-
h.current?.joinThread(y);
|
|
761
|
-
}, []), S = x((y) => {
|
|
762
|
-
h.current?.leaveThread(y);
|
|
763
|
-
}, []), j = x((y, E) => {
|
|
764
|
-
h.current?.sendMessage(y, E);
|
|
765
|
-
}, []), m = x((y) => {
|
|
766
|
-
h.current?.markRead(y);
|
|
767
|
-
}, []), d = x((y, E) => {
|
|
768
|
-
h.current?.listThreads(y, E);
|
|
769
|
-
}, []);
|
|
770
|
-
return {
|
|
771
|
-
isConnected: t,
|
|
772
|
-
isReady: s,
|
|
773
|
-
joinThread: P,
|
|
774
|
-
leaveThread: S,
|
|
775
|
-
listThreads: d,
|
|
776
|
-
markRead: m,
|
|
777
|
-
sendMessage: j
|
|
778
|
-
};
|
|
779
|
-
}, J = (e, t) => t === "short" ? e.split("-")[0] : e, at = (e, t = "full") => {
|
|
779
|
+
}, it = () => {
|
|
780
|
+
const e = j(he);
|
|
781
|
+
if (!e)
|
|
782
|
+
throw new Error("useChat must be used within ChatProvider");
|
|
783
|
+
return e;
|
|
784
|
+
}, K = (e, t) => t === "short" ? e.split("-")[0] : e, ct = (e, t = "full") => {
|
|
780
785
|
const [n, s] = M(() => {
|
|
781
786
|
const o = e?.language || navigator.language;
|
|
782
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
787
|
+
return e && "isInitialized" in e && e.isInitialized, K(o, t);
|
|
783
788
|
});
|
|
784
789
|
return I(() => {
|
|
785
|
-
e && "isInitialized" in e && e.isInitialized && e.language && s(
|
|
790
|
+
e && "isInitialized" in e && e.isInitialized && e.language && s(K(e.language, t));
|
|
786
791
|
const o = (a) => {
|
|
787
|
-
s(
|
|
792
|
+
s(K(a, t));
|
|
788
793
|
};
|
|
789
794
|
return e?.on?.("languageChanged", o), () => {
|
|
790
795
|
e?.off?.("languageChanged", o);
|
|
791
796
|
};
|
|
792
797
|
}, [e, t]), n;
|
|
793
|
-
},
|
|
798
|
+
}, Ue = "tracktor.filter", ze = {
|
|
794
799
|
getFilter: () => {
|
|
795
800
|
},
|
|
796
801
|
getFilters: () => ({}),
|
|
@@ -804,7 +809,7 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
804
809
|
} catch {
|
|
805
810
|
return e;
|
|
806
811
|
}
|
|
807
|
-
}, fe = (e, t, n) => `${n}_${e}=>${t}`,
|
|
812
|
+
}, fe = (e, t, n) => `${n}_${e}=>${t}`, We = (e) => e.reduce((t, n) => {
|
|
808
813
|
const s = localStorage.getItem(n);
|
|
809
814
|
if (s)
|
|
810
815
|
try {
|
|
@@ -813,75 +818,75 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
813
818
|
} catch {
|
|
814
819
|
}
|
|
815
820
|
return t;
|
|
816
|
-
}, {}),
|
|
817
|
-
const { libraries: t, localStorageKeys: n } =
|
|
818
|
-
}], [
|
|
821
|
+
}, {}), lt = (e) => {
|
|
822
|
+
const { libraries: t, localStorageKeys: n } = j(C), s = e?.reactRouter || t?.reactRouter, { pathname: o } = s?.useLocation?.() ?? { pathname: "/" }, [a, c] = s?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
823
|
+
}], [u, l] = M({}), f = n?.filter || Ue, i = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, h = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
|
|
819
824
|
if (U)
|
|
820
|
-
return
|
|
825
|
+
return ze;
|
|
821
826
|
if (!s)
|
|
822
827
|
throw new Error(
|
|
823
828
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
|
|
824
829
|
);
|
|
825
|
-
const
|
|
826
|
-
(
|
|
827
|
-
),
|
|
828
|
-
const E = fe(
|
|
830
|
+
const v = () => Object.keys(localStorage).filter(
|
|
831
|
+
(g) => g.startsWith(f) && g.endsWith(e?.pathname || o)
|
|
832
|
+
), m = (g, d, b = !0) => {
|
|
833
|
+
const E = fe(g, e?.pathname || o, f);
|
|
829
834
|
if (!d || Array.isArray(d) && !d.length) {
|
|
830
|
-
i ? (a.delete(
|
|
831
|
-
const
|
|
832
|
-
return delete
|
|
833
|
-
}),
|
|
835
|
+
i ? (a.delete(g), c(a)) : l((y) => {
|
|
836
|
+
const S = { ...y };
|
|
837
|
+
return delete S[g], S;
|
|
838
|
+
}), h && localStorage.removeItem(E);
|
|
834
839
|
return;
|
|
835
840
|
}
|
|
836
|
-
|
|
841
|
+
h && b && d && localStorage.setItem(E, JSON.stringify({ ...a, [g]: d })), i && d ? (a.set(g, JSON.stringify(d)), c(a)) : !i && d && l((y) => ({ ...y, [g]: d }));
|
|
837
842
|
};
|
|
838
843
|
return {
|
|
839
|
-
getFilter: (
|
|
844
|
+
getFilter: (g, d) => {
|
|
840
845
|
if (i) {
|
|
841
|
-
const
|
|
842
|
-
if (
|
|
843
|
-
return de(
|
|
846
|
+
const b = a.get(g);
|
|
847
|
+
if (b)
|
|
848
|
+
return de(b);
|
|
844
849
|
} else {
|
|
845
|
-
const
|
|
846
|
-
if (
|
|
847
|
-
return
|
|
850
|
+
const b = u[g];
|
|
851
|
+
if (b !== void 0)
|
|
852
|
+
return b;
|
|
848
853
|
}
|
|
849
|
-
if (
|
|
850
|
-
const
|
|
854
|
+
if (h) {
|
|
855
|
+
const b = fe(g, e?.pathname || o, f), E = localStorage.getItem(b);
|
|
851
856
|
if (E)
|
|
852
857
|
try {
|
|
853
|
-
const
|
|
854
|
-
return !i &&
|
|
858
|
+
const y = JSON.parse(E)[g];
|
|
859
|
+
return !i && y !== void 0 && l((S) => ({ ...S, [g]: y })), y;
|
|
855
860
|
} catch {
|
|
856
861
|
}
|
|
857
862
|
}
|
|
858
863
|
return d;
|
|
859
864
|
},
|
|
860
865
|
getFilters: () => {
|
|
861
|
-
const
|
|
866
|
+
const g = h ? We(v()) : {};
|
|
862
867
|
if (i) {
|
|
863
|
-
const d = Array.from(a.entries()).reduce((
|
|
868
|
+
const d = Array.from(a.entries()).reduce((b, [E, y]) => (b[E] = de(y), b), {});
|
|
864
869
|
return {
|
|
865
|
-
...
|
|
870
|
+
...g,
|
|
866
871
|
...d
|
|
867
872
|
};
|
|
868
873
|
}
|
|
869
874
|
return {
|
|
870
|
-
...
|
|
871
|
-
...
|
|
875
|
+
...g,
|
|
876
|
+
...u
|
|
872
877
|
};
|
|
873
878
|
},
|
|
874
|
-
handleFilter: (
|
|
879
|
+
handleFilter: (g, d) => (b, E) => {
|
|
875
880
|
if (E || Array.isArray(E) && E.length === 0) {
|
|
876
|
-
const
|
|
877
|
-
|
|
881
|
+
const y = d || "value", S = typeof E == "object" && y in E ? E[y] : E;
|
|
882
|
+
m(g, S);
|
|
878
883
|
return;
|
|
879
884
|
}
|
|
880
|
-
|
|
885
|
+
m(g, void 0);
|
|
881
886
|
},
|
|
882
|
-
setFilter:
|
|
887
|
+
setFilter: m
|
|
883
888
|
};
|
|
884
|
-
},
|
|
889
|
+
}, ut = ({
|
|
885
890
|
data: e,
|
|
886
891
|
fetchNextPage: t,
|
|
887
892
|
isFetchingNextPage: n,
|
|
@@ -889,23 +894,23 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
889
894
|
isLoading: o,
|
|
890
895
|
enabled: a = !0
|
|
891
896
|
}) => {
|
|
892
|
-
const c =
|
|
893
|
-
async (
|
|
894
|
-
n || !a || await t({ pageParam:
|
|
897
|
+
const c = O(
|
|
898
|
+
async (l) => {
|
|
899
|
+
n || !a || await t({ pageParam: l?.pageParam || l.visibleRowsCount });
|
|
895
900
|
},
|
|
896
901
|
[a, t, n]
|
|
897
|
-
),
|
|
902
|
+
), u = te(() => {
|
|
898
903
|
if (e)
|
|
899
|
-
return e.pages.reduce((
|
|
904
|
+
return e.pages.reduce((l, f) => [...l, ...f], []);
|
|
900
905
|
}, [e]);
|
|
901
906
|
return {
|
|
902
907
|
fetchNextPageOnRowsScrollEnd: c,
|
|
903
908
|
isLoading: n || o,
|
|
904
909
|
loadingVariant: s ? "skeleton" : "linear-progress",
|
|
905
|
-
rows:
|
|
910
|
+
rows: u
|
|
906
911
|
};
|
|
907
|
-
},
|
|
908
|
-
const { libraries: t } =
|
|
912
|
+
}, dt = (e) => {
|
|
913
|
+
const { libraries: t } = j(C), 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 = O(
|
|
909
914
|
(f) => {
|
|
910
915
|
if (f && typeof f == "object" && "response" in f) {
|
|
911
916
|
const { response: i } = f || {};
|
|
@@ -916,11 +921,11 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
916
921
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "message" in i.data && i.data.message)
|
|
917
922
|
return String(i.data.message);
|
|
918
923
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "detail" in i.data) {
|
|
919
|
-
const { detail:
|
|
920
|
-
if (Array.isArray(
|
|
921
|
-
const { msg:
|
|
922
|
-
if (typeof
|
|
923
|
-
return String(
|
|
924
|
+
const { detail: h } = i.data;
|
|
925
|
+
if (Array.isArray(h) && h.length > 0 && typeof h[0] == "object" && h[0] !== null && "msg" in h[0]) {
|
|
926
|
+
const { msg: v } = h[0];
|
|
927
|
+
if (typeof v == "string")
|
|
928
|
+
return String(v);
|
|
924
929
|
}
|
|
925
930
|
}
|
|
926
931
|
}
|
|
@@ -928,34 +933,36 @@ const Je = ({ IMaskMixin: e, ...t }) => {
|
|
|
928
933
|
},
|
|
929
934
|
[c]
|
|
930
935
|
);
|
|
931
|
-
return { getErrorCode:
|
|
936
|
+
return { getErrorCode: O((f) => {
|
|
932
937
|
const { response: i } = f || {};
|
|
933
938
|
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";
|
|
934
|
-
}, []), printError:
|
|
939
|
+
}, []), printError: u };
|
|
935
940
|
};
|
|
936
941
|
export {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
et as
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
st as
|
|
956
|
-
at as
|
|
957
|
-
it as
|
|
958
|
-
ct as
|
|
959
|
-
lt as
|
|
960
|
-
|
|
942
|
+
we as ChatClient,
|
|
943
|
+
he as ChatContext,
|
|
944
|
+
nt as ChatProvider,
|
|
945
|
+
qe as GTMSendPageView,
|
|
946
|
+
Be as InitializeAxiosConfig,
|
|
947
|
+
He as InitializeDaysJSConfig,
|
|
948
|
+
Xe as InitializeI18nConfig,
|
|
949
|
+
Ze as InitializeSentryConfig,
|
|
950
|
+
C as InjectDependenciesContext,
|
|
951
|
+
Ke as InjectDependenciesProvider,
|
|
952
|
+
Ge as MaskTextField,
|
|
953
|
+
et as PreloadErrorHandler,
|
|
954
|
+
ot as QueryClientProviderWithConfig,
|
|
955
|
+
tt as RequireAuth,
|
|
956
|
+
Je as axiosCustomInstance,
|
|
957
|
+
$e as dateAdapter,
|
|
958
|
+
Fe as distanceAdapter,
|
|
959
|
+
rt as getOrvalConfig,
|
|
960
|
+
st as useAdapter,
|
|
961
|
+
at as useAuth,
|
|
962
|
+
it as useChat,
|
|
963
|
+
ct as useCurrentLanguage,
|
|
964
|
+
lt as useFilters,
|
|
965
|
+
ut as useInfiniteDataGrid,
|
|
966
|
+
dt as useResponseError,
|
|
967
|
+
De as worksiteNameAdapter
|
|
961
968
|
};
|