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