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