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