@tracktor/shared-module 2.24.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/dist/chat/types.d.ts +1 -0
- package/dist/context/ChatProvider.d.ts +1 -0
- package/dist/main.js +275 -274
- package/dist/main.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/chat/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { UseChatParams } from '../chat/types';
|
|
|
3
3
|
export interface ChatContextValue {
|
|
4
4
|
isConnected: boolean;
|
|
5
5
|
isReady: boolean;
|
|
6
|
+
unreadCount: number;
|
|
6
7
|
joinThread: (threadId: string) => void;
|
|
7
8
|
leaveThread: (threadId: string) => void;
|
|
8
9
|
listThreads: (limit?: number, offset?: number) => void;
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import oe from "axios";
|
|
2
|
-
import me, { useMemo as
|
|
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
3
|
const Je = (e, t) => {
|
|
4
4
|
const n = oe.CancelToken.source(), s = oe({
|
|
5
5
|
...e,
|
|
@@ -102,18 +102,18 @@ class we {
|
|
|
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
107
|
function Ee() {
|
|
108
|
-
if (ie) return
|
|
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) {
|
|
112
112
|
var c = null;
|
|
113
113
|
if (a !== void 0 && (c = "" + a), o.key !== void 0 && (c = "" + o.key), "key" in o) {
|
|
114
114
|
a = {};
|
|
115
|
-
for (var
|
|
116
|
-
|
|
115
|
+
for (var l in o)
|
|
116
|
+
l !== "key" && (a[l] = o[l]);
|
|
117
117
|
} else a = o;
|
|
118
118
|
return o = a.ref, {
|
|
119
119
|
$$typeof: e,
|
|
@@ -123,50 +123,50 @@ function Ee() {
|
|
|
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
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
|
-
case
|
|
138
|
+
case j:
|
|
139
139
|
return "Fragment";
|
|
140
140
|
case d:
|
|
141
141
|
return "Profiler";
|
|
142
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
159
|
case b:
|
|
160
160
|
return (r._context.displayName || "Context") + ".Consumer";
|
|
161
|
-
case y:
|
|
162
|
-
var p = r.render;
|
|
163
|
-
return r = r.displayName, r || (r = p.displayName || p.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
164
|
-
case L:
|
|
165
|
-
return p = r.displayName || null, p !== null ? p : e(r.type) || "Memo";
|
|
166
161
|
case T:
|
|
167
|
-
|
|
162
|
+
var f = r.render;
|
|
163
|
+
return r = r.displayName, r || (r = f.displayName || f.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
164
|
+
case L:
|
|
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,74 +178,74 @@ function Re() {
|
|
|
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);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
function s(r) {
|
|
196
|
-
if (r ===
|
|
197
|
-
if (typeof r == "object" && r !== null && r.$$typeof ===
|
|
196
|
+
if (r === j) return "<>";
|
|
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
|
|
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
|
-
function
|
|
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
|
-
$$typeof:
|
|
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,
|
|
248
|
-
get:
|
|
248
|
+
get: u
|
|
249
249
|
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
250
250
|
configurable: !1,
|
|
251
251
|
enumerable: !1,
|
|
@@ -260,19 +260,19 @@ function Re() {
|
|
|
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(_);
|
|
@@ -281,12 +281,12 @@ function Re() {
|
|
|
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
283
|
else h(_);
|
|
284
|
-
if (
|
|
284
|
+
if (Q.call(f, "key")) {
|
|
285
285
|
_ = e(r);
|
|
286
|
-
var
|
|
286
|
+
var $ = Object.keys(f).filter(function(ge) {
|
|
287
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
|
|
307
|
-
return _ &&
|
|
308
|
-
|
|
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
|
+
return _ && l(
|
|
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
319
|
function h(r) {
|
|
320
|
-
|
|
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
321
|
}
|
|
322
|
-
function
|
|
323
|
-
return typeof r == "object" && r !== null && r.$$typeof ===
|
|
322
|
+
function m(r) {
|
|
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
361
|
function _e() {
|
|
362
|
-
return le || (le = 1, process.env.NODE_ENV === "production" ?
|
|
362
|
+
return le || (le = 1, process.env.NODE_ENV === "production" ? X.exports = Ee() : X.exports = Re()), X.exports;
|
|
363
363
|
}
|
|
364
|
-
var
|
|
364
|
+
var O = _e();
|
|
365
365
|
const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
366
|
-
const n =
|
|
366
|
+
const n = ne(
|
|
367
367
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
368
|
-
() => e(({ TextField: s, ...o }) => /* @__PURE__ */
|
|
368
|
+
() => e(({ TextField: s, ...o }) => /* @__PURE__ */ O.jsx(s, { ...o })),
|
|
369
369
|
[e]
|
|
370
370
|
);
|
|
371
|
-
return /* @__PURE__ */
|
|
372
|
-
},
|
|
373
|
-
const o =
|
|
371
|
+
return /* @__PURE__ */ O.jsx(n, { ...t });
|
|
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 Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
378
378
|
}),
|
|
379
379
|
[t, n, s]
|
|
380
380
|
);
|
|
381
|
-
return /* @__PURE__ */
|
|
381
|
+
return /* @__PURE__ */ O.jsx(k.Provider, { value: o, children: e });
|
|
382
382
|
}, qe = ({ data: e, ...t }) => {
|
|
383
|
-
const { libraries: n } =
|
|
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:
|
|
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
|
-
pathname:
|
|
394
|
+
pathname: u,
|
|
395
395
|
...e
|
|
396
396
|
});
|
|
397
|
-
}, [e,
|
|
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
|
|
@@ -409,37 +409,37 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
409
409
|
postContentType: n = "application/json",
|
|
410
410
|
...s
|
|
411
411
|
}) => {
|
|
412
|
-
const { apiURL: o = s.apiURL, libraries: a, localStorageKeys: c } =
|
|
413
|
-
if (!
|
|
412
|
+
const { apiURL: o = s.apiURL, libraries: a, localStorageKeys: c } = C(k), l = s?.userLocalStorageKey || c?.user || be, u = s?.axios || a?.axios;
|
|
413
|
+
if (!u)
|
|
414
414
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
415
|
-
if (!
|
|
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
|
-
return
|
|
421
|
+
return u.defaults.baseURL = o, u.defaults.headers.post["Content-Type"] = n, null;
|
|
422
422
|
}, He = ({ language: e, ...t }) => {
|
|
423
|
-
const { libraries: n } =
|
|
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
|
-
o && o.forEach((
|
|
432
|
-
|
|
431
|
+
o && o.forEach((l) => {
|
|
432
|
+
l && s.extend(l);
|
|
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
436
|
}, Xe = ({ debug: e, resources: t, ...n }) => {
|
|
437
|
-
const { libraries: s } =
|
|
438
|
-
if (
|
|
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.");
|
|
442
|
-
return a?.isInitialized || (a.use(
|
|
442
|
+
return a?.isInitialized || (a.use(l).use(c).init({
|
|
443
443
|
debug: e,
|
|
444
444
|
fallbackLng: "en",
|
|
445
445
|
interpolation: {
|
|
@@ -454,8 +454,8 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
454
454
|
returnNull: !1
|
|
455
455
|
}).then(() => {
|
|
456
456
|
document.documentElement.lang !== a.resolvedLanguage && a.resolvedLanguage && document.documentElement.setAttribute("lang", a.resolvedLanguage);
|
|
457
|
-
}), a.on("languageChanged", (
|
|
458
|
-
document.documentElement.setAttribute("lang",
|
|
457
|
+
}), a.on("languageChanged", (u) => {
|
|
458
|
+
document.documentElement.setAttribute("lang", u);
|
|
459
459
|
})), null;
|
|
460
460
|
}, Ze = ({
|
|
461
461
|
dsn: e,
|
|
@@ -465,23 +465,23 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
465
465
|
replaysOnErrorSampleRate: o,
|
|
466
466
|
tracePropagationTargets: a,
|
|
467
467
|
ignoreErrors: c,
|
|
468
|
-
debug:
|
|
469
|
-
environment:
|
|
470
|
-
release:
|
|
468
|
+
debug: l,
|
|
469
|
+
environment: u,
|
|
470
|
+
release: p,
|
|
471
471
|
...i
|
|
472
472
|
}) => {
|
|
473
|
-
const { libraries: h } =
|
|
474
|
-
if (!v)
|
|
475
|
-
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
473
|
+
const { libraries: h } = C(k), m = i?.sentry || h?.sentry, y = i?.reactRouter || h?.reactRouter;
|
|
476
474
|
if (!m)
|
|
475
|
+
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
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:
|
|
481
|
-
return (
|
|
482
|
-
debug:
|
|
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
|
+
debug: l,
|
|
483
483
|
dsn: e,
|
|
484
|
-
environment:
|
|
484
|
+
environment: u || "production",
|
|
485
485
|
ignoreErrors: [
|
|
486
486
|
...c || [],
|
|
487
487
|
/dynamically imported module/,
|
|
@@ -492,23 +492,23 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
492
492
|
/vite:preloadError/
|
|
493
493
|
],
|
|
494
494
|
integrations: [
|
|
495
|
-
|
|
496
|
-
createRoutesFromChildren:
|
|
497
|
-
matchRoutes:
|
|
498
|
-
useEffect:
|
|
499
|
-
useLocation:
|
|
495
|
+
m.reactRouterV6BrowserTracingIntegration({
|
|
496
|
+
createRoutesFromChildren: P,
|
|
497
|
+
matchRoutes: w,
|
|
498
|
+
useEffect: N,
|
|
499
|
+
useLocation: j,
|
|
500
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
|
-
}, et = () => (
|
|
511
|
-
if (
|
|
510
|
+
}, et = () => (N(() => {
|
|
511
|
+
if (V)
|
|
512
512
|
return;
|
|
513
513
|
const e = (t) => {
|
|
514
514
|
try {
|
|
@@ -520,21 +520,21 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
520
520
|
window.removeEventListener("vite:preloadError", e);
|
|
521
521
|
};
|
|
522
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 } =
|
|
524
|
-
if (!
|
|
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
|
+
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, h] =
|
|
527
|
-
return
|
|
528
|
-
ue.has(
|
|
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
|
+
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 && (
|
|
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
|
-
}, [
|
|
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
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
|
-
const s = e.split("/").filter((o) => o.length > 0).map((o) => o.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((
|
|
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
539
|
}, Ce = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), ke = (e, t, n, s) => {
|
|
540
540
|
const o = je(t), a = Se(n), c = `${o}${a}`;
|
|
@@ -557,11 +557,11 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
557
557
|
};
|
|
558
558
|
}), Object.keys(n).length ? n : void 0;
|
|
559
559
|
}, rt = (e) => (Array.isArray(e) ? e : [e]).reduce((n, s) => {
|
|
560
|
-
const { output: o, useInfiniteIds: a, useQueryIds: c, input:
|
|
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]: {
|
|
564
|
-
input:
|
|
564
|
+
input: l,
|
|
565
565
|
output: {
|
|
566
566
|
baseUrl: o?.baseUrl,
|
|
567
567
|
client: "react-query",
|
|
@@ -570,16 +570,16 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
570
570
|
...(a?.length || c?.length) && {
|
|
571
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
579
|
name: Ae(h),
|
|
580
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
|
}
|
|
@@ -601,94 +601,95 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
601
601
|
return null;
|
|
602
602
|
}
|
|
603
603
|
}, he = pe(null), nt = ({ children: e, ...t }) => {
|
|
604
|
-
const [n, s] =
|
|
605
|
-
|
|
606
|
-
if (!
|
|
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
607
|
return;
|
|
608
|
-
const
|
|
609
|
-
if (!
|
|
608
|
+
const A = m || (u ? Oe(u) : null);
|
|
609
|
+
if (!A)
|
|
610
610
|
return;
|
|
611
|
-
const
|
|
611
|
+
const L = () => y ?? Ie(P), D = (S) => {
|
|
612
612
|
const {
|
|
613
|
-
onError:
|
|
614
|
-
onReady:
|
|
615
|
-
onNewMessage:
|
|
616
|
-
onNewMessageNotification:
|
|
617
|
-
onPresence:
|
|
618
|
-
onJoinedThread:
|
|
619
|
-
onLeftThread:
|
|
620
|
-
onMarkedRead:
|
|
621
|
-
onThreadsList:
|
|
622
|
-
} =
|
|
623
|
-
switch (
|
|
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
624
|
case "ready":
|
|
625
|
-
a(!0),
|
|
625
|
+
a(!0), l(S.unreadCount ?? 0), Q?.(S);
|
|
626
626
|
break;
|
|
627
627
|
case "new_message":
|
|
628
|
-
|
|
628
|
+
ee?.(S);
|
|
629
629
|
break;
|
|
630
630
|
case "new_message_notification":
|
|
631
|
-
|
|
631
|
+
l((r) => r + 1), U?.(S);
|
|
632
632
|
break;
|
|
633
633
|
case "presence":
|
|
634
|
-
|
|
634
|
+
J?.(S);
|
|
635
635
|
break;
|
|
636
636
|
case "error":
|
|
637
|
-
|
|
637
|
+
M?.(S);
|
|
638
638
|
break;
|
|
639
639
|
case "joined_thread":
|
|
640
|
-
|
|
640
|
+
G?.(S);
|
|
641
641
|
break;
|
|
642
642
|
case "left_thread":
|
|
643
|
-
|
|
643
|
+
K?.(S);
|
|
644
644
|
break;
|
|
645
645
|
case "marked_read":
|
|
646
|
-
|
|
646
|
+
l((r) => Math.max(0, r - 1)), q?.(S);
|
|
647
647
|
break;
|
|
648
648
|
case "threads_list":
|
|
649
|
-
|
|
649
|
+
B?.(S);
|
|
650
650
|
break;
|
|
651
651
|
}
|
|
652
|
-
},
|
|
653
|
-
getToken:
|
|
654
|
-
onConnectionChange: (
|
|
655
|
-
s(
|
|
652
|
+
}, Y = new we({
|
|
653
|
+
getToken: L,
|
|
654
|
+
onConnectionChange: (S) => {
|
|
655
|
+
s(S), S || a(!1);
|
|
656
656
|
},
|
|
657
|
-
onEvent:
|
|
658
|
-
reconnect:
|
|
659
|
-
url:
|
|
657
|
+
onEvent: D,
|
|
658
|
+
reconnect: i,
|
|
659
|
+
url: A
|
|
660
660
|
});
|
|
661
|
-
return
|
|
662
|
-
|
|
661
|
+
return w.current = Y, Y.connect(), () => {
|
|
662
|
+
Y.disconnect(), w.current = null;
|
|
663
663
|
};
|
|
664
|
-
}, [
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
}, []),
|
|
668
|
-
|
|
669
|
-
}, []),
|
|
670
|
-
|
|
671
|
-
}, []),
|
|
672
|
-
|
|
673
|
-
}, []),
|
|
674
|
-
|
|
675
|
-
}, []),
|
|
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
676
|
isConnected: n,
|
|
677
677
|
isReady: o,
|
|
678
|
-
joinThread:
|
|
679
|
-
leaveThread:
|
|
680
|
-
listThreads:
|
|
681
|
-
markRead:
|
|
682
|
-
sendMessage:
|
|
678
|
+
joinThread: g,
|
|
679
|
+
leaveThread: d,
|
|
680
|
+
listThreads: T,
|
|
681
|
+
markRead: E,
|
|
682
|
+
sendMessage: b,
|
|
683
|
+
unreadCount: c
|
|
683
684
|
};
|
|
684
|
-
return /* @__PURE__ */
|
|
685
|
+
return /* @__PURE__ */ O.jsx(he.Provider, { value: x, children: e });
|
|
685
686
|
}, Ne = (e) => e && typeof e == "function", Le = (e) => e && typeof e == "function", ot = ({
|
|
686
687
|
children: e,
|
|
687
688
|
defaultQueriesOptions: t,
|
|
688
689
|
defaultMutationsOptions: n,
|
|
689
690
|
...s
|
|
690
691
|
}) => {
|
|
691
|
-
const { libraries: o } =
|
|
692
|
+
const { libraries: o } = C(k), a = s?.QueryClient || o?.reactQuery?.QueryClient, c = s?.QueryClientProvider || o?.reactQuery?.QueryClientProvider;
|
|
692
693
|
if (!a)
|
|
693
694
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
694
695
|
if (!c)
|
|
@@ -697,20 +698,20 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
697
698
|
throw new Error("Provided QueryClientProvider dependencies are not valid.");
|
|
698
699
|
if (!Le(a))
|
|
699
700
|
throw new Error("Provided QueryClient dependencies are not valid.");
|
|
700
|
-
const
|
|
701
|
+
const l = new a({
|
|
701
702
|
defaultOptions: {
|
|
702
703
|
mutations: {
|
|
703
704
|
...n
|
|
704
705
|
},
|
|
705
706
|
queries: {
|
|
706
|
-
getNextPageParam: (
|
|
707
|
+
getNextPageParam: (u, p, i) => u.length + (i || 0),
|
|
707
708
|
refetchOnWindowFocus: !1,
|
|
708
709
|
retry: 3,
|
|
709
710
|
...t
|
|
710
711
|
}
|
|
711
712
|
}
|
|
712
713
|
});
|
|
713
|
-
return /* @__PURE__ */
|
|
714
|
+
return /* @__PURE__ */ O.jsx(c, { client: l, children: e });
|
|
714
715
|
}, $e = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), Fe = (e, t) => {
|
|
715
716
|
const { fractionDigits: n = 0, metric: s = "km", spacingBetween: o = !0 } = t || {}, a = Number(e), c = o ? " " : "";
|
|
716
717
|
return Number.isNaN(a) ? `0${c}${s}` : `${a.toFixed(n)}${c}${s}`;
|
|
@@ -720,19 +721,19 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
720
721
|
const s = Ye(e), o = `${n}${s}`, a = o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
721
722
|
return typeof t == "number" && a ? `${o.replace("/files", `/thumbs/${t}`)}` : o;
|
|
722
723
|
}, st = (e) => {
|
|
723
|
-
const { apiURL: t, libraries: n } =
|
|
724
|
+
const { apiURL: t, libraries: n } = C(k), s = e?.dayjs || n?.dayjs;
|
|
724
725
|
return {
|
|
725
|
-
dateAdapter: (c,
|
|
726
|
+
dateAdapter: (c, l) => {
|
|
726
727
|
if (!s)
|
|
727
728
|
throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
728
729
|
return $e({
|
|
729
730
|
date: c,
|
|
730
|
-
format:
|
|
731
|
+
format: l,
|
|
731
732
|
library: s
|
|
732
733
|
});
|
|
733
734
|
},
|
|
734
735
|
distanceAdapter: Fe,
|
|
735
|
-
filePathAdapter: (c,
|
|
736
|
+
filePathAdapter: (c, l) => {
|
|
736
737
|
if (!t)
|
|
737
738
|
throw new Error(
|
|
738
739
|
"API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
|
|
@@ -740,56 +741,56 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
740
741
|
return typeof c == "string" && /^https?:\/\//.test(c) ? c : Me({
|
|
741
742
|
apiURL: t,
|
|
742
743
|
path: c,
|
|
743
|
-
size:
|
|
744
|
+
size: l
|
|
744
745
|
});
|
|
745
746
|
},
|
|
746
747
|
worksiteNameAdapter: De
|
|
747
748
|
};
|
|
748
749
|
}, at = (e) => {
|
|
749
|
-
const { libraries: t, localStorageKeys: n } =
|
|
750
|
+
const { libraries: t, localStorageKeys: n } = C(k), s = e?.axios || t?.axios, o = e?.localStorageKey || n?.user || "user";
|
|
750
751
|
if (!s)
|
|
751
752
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
752
|
-
const a =
|
|
753
|
-
({ tokenType:
|
|
754
|
-
s.defaults.headers.common.Authorization = `${
|
|
753
|
+
const a = I(
|
|
754
|
+
({ tokenType: l, accessToken: u }) => {
|
|
755
|
+
s.defaults.headers.common.Authorization = `${l} ${u}`;
|
|
755
756
|
},
|
|
756
757
|
[s.defaults.headers.common]
|
|
757
758
|
), c = () => {
|
|
758
759
|
s.defaults.headers.common.Authorization = null;
|
|
759
760
|
};
|
|
760
|
-
return
|
|
761
|
-
if (
|
|
761
|
+
return N(() => {
|
|
762
|
+
if (V)
|
|
762
763
|
return;
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
764
|
+
const l = ({ newValue: u, key: p }) => {
|
|
765
|
+
if (p === o && u)
|
|
765
766
|
try {
|
|
766
|
-
const { accessToken: i, tokenType: h } = JSON.parse(
|
|
767
|
+
const { accessToken: i, tokenType: h } = JSON.parse(u);
|
|
767
768
|
a({ accessToken: i, tokenType: h });
|
|
768
769
|
} catch (i) {
|
|
769
770
|
console.error("Failed to parse newValue from localStorage:", i);
|
|
770
771
|
}
|
|
771
772
|
};
|
|
772
|
-
return window.addEventListener("storage",
|
|
773
|
-
window.removeEventListener("storage",
|
|
773
|
+
return window.addEventListener("storage", l), () => {
|
|
774
|
+
window.removeEventListener("storage", l);
|
|
774
775
|
};
|
|
775
776
|
}, [o, a]), {
|
|
776
777
|
clearAuthenticationToken: c,
|
|
777
778
|
setAuthenticationToken: a
|
|
778
779
|
};
|
|
779
780
|
}, it = () => {
|
|
780
|
-
const e =
|
|
781
|
+
const e = C(he);
|
|
781
782
|
if (!e)
|
|
782
783
|
throw new Error("useChat must be used within ChatProvider");
|
|
783
784
|
return e;
|
|
784
|
-
},
|
|
785
|
-
const [n, s] =
|
|
785
|
+
}, Z = (e, t) => t === "short" ? e.split("-")[0] : e, ct = (e, t = "full") => {
|
|
786
|
+
const [n, s] = F(() => {
|
|
786
787
|
const o = e?.language || navigator.language;
|
|
787
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
788
|
+
return e && "isInitialized" in e && e.isInitialized, Z(o, t);
|
|
788
789
|
});
|
|
789
|
-
return
|
|
790
|
-
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));
|
|
791
792
|
const o = (a) => {
|
|
792
|
-
s(
|
|
793
|
+
s(Z(a, t));
|
|
793
794
|
};
|
|
794
795
|
return e?.on?.("languageChanged", o), () => {
|
|
795
796
|
e?.off?.("languageChanged", o);
|
|
@@ -819,26 +820,26 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
819
820
|
}
|
|
820
821
|
return t;
|
|
821
822
|
}, {}), lt = (e) => {
|
|
822
|
-
const { libraries: t, localStorageKeys: n } =
|
|
823
|
-
}], [
|
|
824
|
-
if (
|
|
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)
|
|
825
826
|
return ze;
|
|
826
827
|
if (!s)
|
|
827
828
|
throw new Error(
|
|
828
829
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
|
|
829
830
|
);
|
|
830
|
-
const
|
|
831
|
-
(g) => g.startsWith(
|
|
832
|
-
),
|
|
833
|
-
const E = fe(g, e?.pathname || o,
|
|
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);
|
|
834
835
|
if (!d || Array.isArray(d) && !d.length) {
|
|
835
|
-
i ? (a.delete(g), c(a)) :
|
|
836
|
-
const
|
|
837
|
-
return delete
|
|
836
|
+
i ? (a.delete(g), c(a)) : u((T) => {
|
|
837
|
+
const x = { ...T };
|
|
838
|
+
return delete x[g], x;
|
|
838
839
|
}), h && localStorage.removeItem(E);
|
|
839
840
|
return;
|
|
840
841
|
}
|
|
841
|
-
h && b && d && localStorage.setItem(E, JSON.stringify({ ...a, [g]: d })), i && d ? (a.set(g, JSON.stringify(d)), c(a)) : !i && d &&
|
|
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 }));
|
|
842
843
|
};
|
|
843
844
|
return {
|
|
844
845
|
getFilter: (g, d) => {
|
|
@@ -847,25 +848,25 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
847
848
|
if (b)
|
|
848
849
|
return de(b);
|
|
849
850
|
} else {
|
|
850
|
-
const b =
|
|
851
|
+
const b = l[g];
|
|
851
852
|
if (b !== void 0)
|
|
852
853
|
return b;
|
|
853
854
|
}
|
|
854
855
|
if (h) {
|
|
855
|
-
const b = fe(g, e?.pathname || o,
|
|
856
|
+
const b = fe(g, e?.pathname || o, p), E = localStorage.getItem(b);
|
|
856
857
|
if (E)
|
|
857
858
|
try {
|
|
858
|
-
const
|
|
859
|
-
return !i &&
|
|
859
|
+
const T = JSON.parse(E)[g];
|
|
860
|
+
return !i && T !== void 0 && u((x) => ({ ...x, [g]: T })), T;
|
|
860
861
|
} catch {
|
|
861
862
|
}
|
|
862
863
|
}
|
|
863
864
|
return d;
|
|
864
865
|
},
|
|
865
866
|
getFilters: () => {
|
|
866
|
-
const g = h ? We(
|
|
867
|
+
const g = h ? We(m()) : {};
|
|
867
868
|
if (i) {
|
|
868
|
-
const d = Array.from(a.entries()).reduce((b, [E,
|
|
869
|
+
const d = Array.from(a.entries()).reduce((b, [E, T]) => (b[E] = de(T), b), {});
|
|
869
870
|
return {
|
|
870
871
|
...g,
|
|
871
872
|
...d
|
|
@@ -873,18 +874,18 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
873
874
|
}
|
|
874
875
|
return {
|
|
875
876
|
...g,
|
|
876
|
-
...
|
|
877
|
+
...l
|
|
877
878
|
};
|
|
878
879
|
},
|
|
879
880
|
handleFilter: (g, d) => (b, E) => {
|
|
880
881
|
if (E || Array.isArray(E) && E.length === 0) {
|
|
881
|
-
const
|
|
882
|
-
|
|
882
|
+
const T = d || "value", x = typeof E == "object" && T in E ? E[T] : E;
|
|
883
|
+
y(g, x);
|
|
883
884
|
return;
|
|
884
885
|
}
|
|
885
|
-
|
|
886
|
+
y(g, void 0);
|
|
886
887
|
},
|
|
887
|
-
setFilter:
|
|
888
|
+
setFilter: y
|
|
888
889
|
};
|
|
889
890
|
}, ut = ({
|
|
890
891
|
data: e,
|
|
@@ -894,26 +895,26 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
894
895
|
isLoading: o,
|
|
895
896
|
enabled: a = !0
|
|
896
897
|
}) => {
|
|
897
|
-
const c =
|
|
898
|
-
async (
|
|
899
|
-
n || !a || await t({ pageParam:
|
|
898
|
+
const c = I(
|
|
899
|
+
async (u) => {
|
|
900
|
+
n || !a || await t({ pageParam: u?.pageParam || u.visibleRowsCount });
|
|
900
901
|
},
|
|
901
902
|
[a, t, n]
|
|
902
|
-
),
|
|
903
|
+
), l = ne(() => {
|
|
903
904
|
if (e)
|
|
904
|
-
return e.pages.reduce((
|
|
905
|
+
return e.pages.reduce((u, p) => [...u, ...p], []);
|
|
905
906
|
}, [e]);
|
|
906
907
|
return {
|
|
907
908
|
fetchNextPageOnRowsScrollEnd: c,
|
|
908
909
|
isLoading: n || o,
|
|
909
910
|
loadingVariant: s ? "skeleton" : "linear-progress",
|
|
910
|
-
rows:
|
|
911
|
+
rows: l
|
|
911
912
|
};
|
|
912
913
|
}, dt = (e) => {
|
|
913
|
-
const { libraries: t } =
|
|
914
|
-
(
|
|
915
|
-
if (
|
|
916
|
-
const { response: i } =
|
|
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 || {};
|
|
917
918
|
if (i && typeof i == "object" && "reason" in i && i.reason)
|
|
918
919
|
return String(i.reason);
|
|
919
920
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "reason" in i.data && i.data.reason)
|
|
@@ -923,20 +924,20 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
923
924
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "detail" in i.data) {
|
|
924
925
|
const { detail: h } = i.data;
|
|
925
926
|
if (Array.isArray(h) && h.length > 0 && typeof h[0] == "object" && h[0] !== null && "msg" in h[0]) {
|
|
926
|
-
const { msg:
|
|
927
|
-
if (typeof
|
|
928
|
-
return String(
|
|
927
|
+
const { msg: m } = h[0];
|
|
928
|
+
if (typeof m == "string")
|
|
929
|
+
return String(m);
|
|
929
930
|
}
|
|
930
931
|
}
|
|
931
932
|
}
|
|
932
|
-
return
|
|
933
|
+
return p instanceof Error ? p.message : c;
|
|
933
934
|
},
|
|
934
935
|
[c]
|
|
935
936
|
);
|
|
936
|
-
return { getErrorCode:
|
|
937
|
-
const { response: i } =
|
|
937
|
+
return { getErrorCode: I((p) => {
|
|
938
|
+
const { response: i } = p || {};
|
|
938
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";
|
|
939
|
-
}, []), printError:
|
|
940
|
+
}, []), printError: l };
|
|
940
941
|
};
|
|
941
942
|
export {
|
|
942
943
|
we as ChatClient,
|
|
@@ -947,7 +948,7 @@ export {
|
|
|
947
948
|
He as InitializeDaysJSConfig,
|
|
948
949
|
Xe as InitializeI18nConfig,
|
|
949
950
|
Ze as InitializeSentryConfig,
|
|
950
|
-
|
|
951
|
+
k as InjectDependenciesContext,
|
|
951
952
|
Ke as InjectDependenciesProvider,
|
|
952
953
|
Ge as MaskTextField,
|
|
953
954
|
et as PreloadErrorHandler,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(g,
|
|
1
|
+
(function(g,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],L):(g=typeof globalThis<"u"?globalThis:g||self,L(g["@tracktor/shared-module"]={},g.axios,g.React))})(this,(function(g,L,d){"use strict";const he=(e,t)=>{const r=L.CancelToken.source(),s=L({...e,...t,cancelToken:r.token}).then(({data:o})=>o);return s.cancel=()=>{r.cancel("Query was cancelled")},s};class re{url;getToken;onEvent;onConnectionChange;shouldReconnect;maxReconnectAttempts;reconnectBaseDelay;ws=null;reconnectAttempt=0;reconnectTimer=null;intentionalClose=!1;joinedThreads=new Set;pendingMessages=[];_connected=!1;_ready=!1;constructor(t){this.url=t.url,this.getToken=t.getToken,this.onEvent=t.onEvent,this.onConnectionChange=t.onConnectionChange,this.shouldReconnect=t.reconnect??!0,this.maxReconnectAttempts=t.maxReconnectAttempts??Number.POSITIVE_INFINITY,this.reconnectBaseDelay=t.reconnectBaseDelay??1e3}get connected(){return this._connected}get ready(){return this._ready}connect(){const t=this.getToken();if(!t)return;this.intentionalClose=!1;const r=this.url.includes("?")?"&":"?",s=`${this.url}${r}token=${t}`;this.ws=new WebSocket(s),this.ws.onopen=()=>{this._connected=!0,this.reconnectAttempt=0,this.onConnectionChange?.(!0),this.rejoinThreads(),this.flushPendingMessages()},this.ws.onmessage=o=>{try{const a=JSON.parse(o.data);a.type==="ready"&&(this._ready=!0),this.onEvent?.(a)}catch{}},this.ws.onclose=()=>{this._connected=!1,this._ready=!1,this.onConnectionChange?.(!1),!this.intentionalClose&&this.shouldReconnect&&this.reconnectAttempt<this.maxReconnectAttempts&&this.scheduleReconnect()},this.ws.onerror=()=>{}}disconnect(){this.intentionalClose=!0,this.pendingMessages=[],this.clearReconnectTimer(),this.ws&&(this.ws.close(),this.ws=null)}joinThread(t){this.joinedThreads.add(t),this.send({threadId:t,type:"join_thread"})}leaveThread(t){this.joinedThreads.delete(t),this.send({threadId:t,type:"leave_thread"})}sendMessage(t,r){if(r.length>1e3)throw new Error("Message body exceeds maximum length of 1000 characters");this.send({body:r,threadId:t,type:"send_message"})}markRead(t){this.send({threadId:t,type:"mark_read"})}listThreads(t,r){this.send({limit:t,offset:r,type:"list_threads"})}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.pendingMessages.push(t);return}this.ws.send(JSON.stringify(t))}flushPendingMessages(){const t=[...this.pendingMessages];this.pendingMessages=[];for(const r of t)this.send(r)}rejoinThreads(){for(const t of this.joinedThreads)this.send({threadId:t,type:"join_thread"})}scheduleReconnect(){this.clearReconnectTimer();const t=Math.min(this.reconnectBaseDelay*2**this.reconnectAttempt,3e4);this.reconnectAttempt++,this.reconnectTimer=setTimeout(()=>{this.connect()},t)}clearReconnectTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}var V={exports:{}},D={};var oe;function pe(){if(oe)return D;oe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,o,a){var c=null;if(a!==void 0&&(c=""+a),o.key!==void 0&&(c=""+o.key),"key"in o){a={};for(var l in o)l!=="key"&&(a[l]=o[l])}else a=o;return o=a.ref,{$$typeof:e,type:s,key:c,ref:o!==void 0?o:null,props:a}}return D.Fragment=t,D.jsx=r,D.jsxs=r,D}var M={};var se;function ge(){return se||(se=1,process.env.NODE_ENV!=="production"&&(function(){function e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===A?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case P:return"Fragment";case f:return"Profiler";case y:return"StrictMode";case N:return"Suspense";case k:return"SuspenseList";case U:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case C:return"Portal";case _:return n.displayName||"Context";case T:return(n._context.displayName||"Context")+".Consumer";case S:var h=n.render;return n=n.displayName,n||(n=h.displayName||h.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case x:return h=n.displayName||null,h!==null?h:e(n.type)||"Memo";case z:h=n._payload,n=n._init;try{return e(n(h))}catch{}}return null}function t(n){return""+n}function r(n){try{t(n);var h=!1}catch{h=!0}if(h){h=console;var w=h.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return w.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(n)}}function s(n){if(n===P)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===z)return"<...>";try{var h=e(n);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function o(){var n=W.A;return n===null?null:n.getOwner()}function a(){return Error("react-stack-top-frame")}function c(n){if(J.call(n,"key")){var h=Object.getOwnPropertyDescriptor(n,"key").get;if(h&&h.isReactWarning)return!1}return n.key!==void 0}function l(n,h){function w(){K||(K=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",h))}w.isReactWarning=!0,Object.defineProperty(n,"key",{get:w,configurable:!0})}function u(){var n=e(this.type);return B[n]||(B[n]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),n=this.props.ref,n!==void 0?n:null}function p(n,h,w,R,q,te){var b=w.ref;return n={$$typeof:I,type:n,key:h,props:w,_owner:R},(b!==void 0?b:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:u}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function i(n,h,w,R,q,te){var b=h.children;if(b!==void 0)if(R)if(ee(b)){for(R=0;R<b.length;R++)m(b[R]);Object.freeze&&Object.freeze(b)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(b);if(J.call(h,"key")){b=e(n);var F=Object.keys(h).filter(function(et){return et!=="key"});R=0<F.length?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}",Z[b+R]||(F=0<F.length?"{"+F.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,C,b,x,b),fe[b+C]=!0)}if(b=null,_!==void 0&&(r(_),b=""+_),c(p)&&(r(p.key),b=""+p.key),"key"in p){_={};for(var ee in p)ee!=="key"&&(_[ee]=p[ee])}else _=p;return b&&d(_,typeof n=="function"?n.displayName||n.name||"Unknown":n),h(n,b,_,o(),K,$)}function m(n){w(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===S&&(n._payload.status==="fulfilled"?w(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function w(n){return typeof n=="object"&&n!==null&&n.$$typeof===P}var E=u,P=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),R=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),Z=Symbol.for("react.client.reference"),Y=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,q=Array.isArray,z=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(n){return n()}};var V,Q={},J=E.react_stack_bottom_frame.bind(E,a)(),de=z(s(a)),fe={};F.Fragment=I,F.jsx=function(n,p,_){var C=1e4>Y.recentlyCreatedOwnerStacks++;return i(n,p,_,!1,C?Error("react-stack-top-frame"):J,C?z(s(n)):de)},F.jsxs=function(n,p,_){var C=1e4>Y.recentlyCreatedOwnerStacks++;return i(n,p,_,!0,C?Error("react-stack-top-frame"):J,C?z(s(n)):de)}})()),F}var oe;function me(){return oe||(oe=1,process.env.NODE_ENV==="production"?U.exports=pe():U.exports=ge()),U.exports}var O=me();const ye=({IMaskMixin:e,...t})=>{const r=u.useMemo(()=>e(({TextField:s,...o})=>O.jsx(s,{...o})),[e]);return O.jsx(r,{...t})},A=u.createContext({}),Ee=({children:e,apiURL:t,libraries:r,localStorageKeys:s})=>{const o=u.useMemo(()=>({apiURL:t,libraries:r,localStorageKeys:s}),[t,r,s]);return O.jsx(A.Provider,{value:o,children:e})},ve=({data:e,...t})=>{const{libraries:r}=u.useContext(A),s=t?.reactRouter||r?.reactRouter,o=t?.gtm||r?.gtm;if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!o)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:a}=o,{useLocation:c,Outlet:d}=s,{pathname:l}=c(),{sendEvent:h}=a();return u.useEffect(()=>{h({event:"pageView",pathname:l,...e})},[e,l,h]),O.jsx(d,{})},D=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),we="user",_e=({tokenTypeKey:e="tokenType",tokenKey:t="accessToken",postContentType:r="application/json",...s})=>{const{apiURL:o=s.apiURL,libraries:a,localStorageKeys:c}=u.useContext(A),d=s?.userLocalStorageKey||c?.user||we,l=s?.axios||a?.axios;if(!l)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l?.defaults||D)return null;if(typeof window<"u"&&window.localStorage){const h=localStorage.getItem(d),i=h?JSON.parse(h):null,m=i?.[e]?i[e]:null,w=i?.[t]?i[t]:null,E=h?`${m} ${w}`:null;E&&(l.defaults.headers.common.Authorization=E)}return l.defaults.baseURL=o,l.defaults.headers.post["Content-Type"]=r,null},Re=({language:e,...t})=>{const{libraries:r}=u.useContext(A),s=t?.dayjs||r?.dayjs,o=t?.plugin||r?.dayjsPlugin;if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return u.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";o&&o.forEach(d=>{d&&s.extend(d)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),s.locale(c)})().then()},[s,o,e]),null},Ce=({debug:e,resources:t,...r})=>{const{libraries:s}=u.useContext(A),o=r?.i18||s?.i18,{i18next:a,initReactI18next:c,languageDetector:d}=o||{};if(D)return null;if(!o)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return a?.isInitialized||(a.use(d).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:t,returnNull:!1}).then(()=>{document.documentElement.lang!==a.resolvedLanguage&&a.resolvedLanguage&&document.documentElement.setAttribute("lang",a.resolvedLanguage)}),a.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},be=({dsn:e,integrations:t,tracesSampleRate:r,replaysSessionSampleRate:s,replaysOnErrorSampleRate:o,tracePropagationTargets:a,ignoreErrors:c,debug:d,environment:l,release:h,...i})=>{const{libraries:m}=u.useContext(A),w=i?.sentry||m?.sentry,E=i?.reactRouter||m?.reactRouter;if(!w)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!E)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(w.isInitialized())return null;const{createRoutesFromChildren:P,matchRoutes:k,useLocation:I,useNavigationType:y}=E;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&w.init({debug:d,dsn:e,environment:l||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[w.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:P,matchRoutes:k,useEffect:u.useEffect,useLocation:I,useNavigationType:y}),...t||[]],release:h,replaysOnErrorSampleRate:o||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:a,tracesSampleRate:r||1}),null},Te=()=>(u.useEffect(()=>{if(D)return;const e=t=>{try{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),se=new WeakMap,Se="user",Ae=({Fallback:e,isLogged:t,loginPath:r="/login",redirect401Path:s="/login",...o})=>{const{libraries:a,localStorageKeys:c}=u.useContext(A),d=o?.reactRouter||a?.reactRouter,l=o?.axios||a?.axios,h=o?.localStorageKey||c?.user||Se;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,m]=u.useState(null),{useLocation:w,Navigate:E,Outlet:P}=d,k=w(),I=typeof t=="function"?t():!!t,y=typeof I=="boolean"?I:I?.isLogged;return u.useEffect(()=>{se.has(l)||(se.set(l,!0),l.interceptors.response.use(f=>f,f=>(typeof f=="object"&&f&&"response"in f&&f.response&&typeof f.response=="object"&&"status"in f.response&&f.response&&typeof f.response=="object"&&"status"in f.response&&f?.response?.status===401&&(typeof f=="object"&&f&&"config"in f&&f.config&&typeof f.config=="object"&&"headers"in f.config&&f.config.headers&&typeof f.config.headers=="object"&&"Authorization"in f.config.headers&&f.config.headers.Authorization&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(h)),m(s)),Promise.reject(f))))},[l,h,s]),y&&!i?O.jsx(u.Suspense,{fallback:e,children:k.state?.from?.state&&k.state?.from?.pathname===r?O.jsx(E,{to:k.state.from.state.from.pathname+k.state.from.state.from.search,replace:!0}):O.jsx(P,{})}):O.jsx(E,{to:r+k.search,state:{from:k},replace:!0})},je=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),ke=e=>{const t=e.split(/[/\\]/).pop()||"";return t.substring(0,t.lastIndexOf("."))},Pe=e=>{const s=e.split("/").filter(o=>o.length>0).map(o=>o.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return s.charAt(0).toLowerCase()+s.slice(1)},Ie=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Oe=(e,t,r,s)=>{const o=Pe(t),a=je(r),c=`${o}${a}`;return e&&typeof e=="object"&&"operationId"in e&&s?.includes(String(e.operationId))?`${c}AsQuery`:c},Ne=(e,t)=>{const r={};return e?.forEach(s=>{r[s]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),t?.filter(s=>!r[s]).forEach(s=>{r[s]={query:{useQuery:!0}}}),Object.keys(r).length?r:void 0},xe=e=>(Array.isArray(e)?e:[e]).reduce((r,s)=>{const{output:o,useInfiniteIds:a,useQueryIds:c,input:d="./openapi.json",customAxiosInstancePath:l,overrideApiName:h}=s||{},i=h||Ie(d),m=l||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...r,[i]:{input:d,output:{baseUrl:o?.baseUrl,client:"react-query",mode:"tags-split",override:{...(a?.length||c?.length)&&{operations:Ne(a,c)},header:w=>["Generated by orval 🍺",...w.title?[w.title]:[],...w.description?[w.description]:[]],mutator:{name:ke(m),path:m},operationName:(w,E,P)=>Oe(w,E,P,c),query:{useQuery:!0}},schemas:o?.schemas||`src/api/${i}/model`,target:o?.target||`src/api/${i}/services/api.ts`,...o}}}},{}),Le="user",Fe=e=>{const t=e.startsWith("https")?"wss":"ws",r=e.replace(/^https?:\/\//,"");return`${t}://${r}/v2/threads/ws`},De=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t)?.accessToken??null:null}catch{return null}},B=u.createContext(null),Me=({children:e,...t})=>{const[r,s]=u.useState(!1),[o,a]=u.useState(!1),{apiURL:c,localStorageKeys:d}=u.useContext(A),{reconnect:l=!0,enabled:h=!0,url:i,token:m}=t,w=d?.user||Le,E=u.useRef(null),P=u.useRef(t);P.current=t,u.useEffect(()=>{if(!h||E.current?.connected)return;const v=i||(c?Fe(c):null);if(!v)return;const j=()=>m??De(w),H=S=>{const{onError:X,onReady:Z,onNewMessage:Y,onNewMessageNotification:G,onPresence:q,onJoinedThread:z,onLeftThread:V,onMarkedRead:Q,onThreadsList:J}=P.current||{};switch(S.type){case"ready":a(!0),Z?.(S);break;case"new_message":Y?.(S);break;case"new_message_notification":G?.(S);break;case"presence":q?.(S);break;case"error":X?.(S);break;case"joined_thread":z?.(S);break;case"left_thread":V?.(S);break;case"marked_read":Q?.(S);break;case"threads_list":J?.(S);break}},M=new te({getToken:j,onConnectionChange:S=>{s(S),S||a(!1)},onEvent:H,reconnect:l,url:v});return E.current=M,M.connect(),()=>{M.disconnect(),E.current=null}},[h,i,m,c,l,w]);const k=u.useCallback(v=>{E.current?.joinThread(v)},[]),I=u.useCallback(v=>{E.current?.leaveThread(v)},[]),y=u.useCallback((v,j)=>{E.current?.sendMessage(v,j)},[]),f=u.useCallback(v=>{E.current?.markRead(v)},[]),T=u.useCallback((v,j)=>{E.current?.listThreads(v,j)},[]),R={isConnected:r,isReady:o,joinThread:k,leaveThread:I,listThreads:T,markRead:f,sendMessage:y};return O.jsx(B.Provider,{value:R,children:e})},Ye=e=>e&&typeof e=="function",ze=e=>e&&typeof e=="function",Ue=({children:e,defaultQueriesOptions:t,defaultMutationsOptions:r,...s})=>{const{libraries:o}=u.useContext(A),a=s?.QueryClient||o?.reactQuery?.QueryClient,c=s?.QueryClientProvider||o?.reactQuery?.QueryClientProvider;if(!a)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Ye(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!ze(a))throw new Error("Provided QueryClient dependencies are not valid.");const d=new a({defaultOptions:{mutations:{...r},queries:{getNextPageParam:(l,h,i)=>l.length+(i||0),refetchOnWindowFocus:!1,retry:3,...t}}});return O.jsx(c,{client:d,children:e})},ae=({library:e,date:t,format:r="ll"})=>e(t).format(r),ie=(e,t)=>{const{fractionDigits:r=0,metric:s="km",spacingBetween:o=!0}=t||{},a=Number(e),c=o?" ":"";return Number.isNaN(a)?`0${c}${s}`:`${a.toFixed(r)}${c}${s}`},ce=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(r=>r.length>0?r.charAt(0).toUpperCase()+r.slice(1):r).join(" "),We=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Ge=({path:e,size:t,apiURL:r})=>{if(!e)return"";const s=We(e),o=`${r}${s}`,a=o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof t=="number"&&a?`${o.replace("/files",`/thumbs/${t}`)}`:o},Ve=e=>{const{apiURL:t,libraries:r}=u.useContext(A),s=e?.dayjs||r?.dayjs;return{dateAdapter:(c,d)=>{if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return ae({date:c,format:d,library:s})},distanceAdapter:ie,filePathAdapter:(c,d)=>{if(!t)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Ge({apiURL:t,path:c,size:d})},worksiteNameAdapter:ce}},Qe=e=>{const{libraries:t,localStorageKeys:r}=u.useContext(A),s=e?.axios||t?.axios,o=e?.localStorageKey||r?.user||"user";if(!s)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=u.useCallback(({tokenType:d,accessToken:l})=>{s.defaults.headers.common.Authorization=`${d} ${l}`},[s.defaults.headers.common]),c=()=>{s.defaults.headers.common.Authorization=null};return u.useEffect(()=>{if(D)return;const d=({newValue:l,key:h})=>{if(h===o&&l)try{const{accessToken:i,tokenType:m}=JSON.parse(l);a({accessToken:i,tokenType:m})}catch(i){console.error("Failed to parse newValue from localStorage:",i)}};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}},[o,a]),{clearAuthenticationToken:c,setAuthenticationToken:a}},Je=()=>{const e=u.useContext(B);if(!e)throw new Error("useChat must be used within ChatProvider");return e},W=(e,t)=>t==="short"?e.split("-")[0]:e,Ke=(e,t="full")=>{const[r,s]=u.useState(()=>{const o=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,W(o,t)});return u.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&s(W(e.language,t));const o=a=>{s(W(a,t))};return e?.on?.("languageChanged",o),()=>{e?.off?.("languageChanged",o)}},[e,t]),r},Be="tracktor.filter",He={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},le=e=>{try{return JSON.parse(e)}catch{return e}},ue=(e,t,r)=>`${r}_${e}=>${t}`,Xe=e=>e.reduce((t,r)=>{const s=localStorage.getItem(r);if(s)try{const o=JSON.parse(s),a=Object.keys(o)?.[0];a&&(t[a]=Object.values(o)?.[0])}catch{}return t},{}),Ze=e=>{const{libraries:t,localStorageKeys:r}=u.useContext(A),s=e?.reactRouter||t?.reactRouter,{pathname:o}=s?.useLocation?.()??{pathname:"/"},[a,c]=s?.useSearchParams?.()??[new URLSearchParams,()=>{}],[d,l]=u.useState({}),h=r?.filter||Be,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl,m=e?.persistToLocalStorage===void 0?!0:e?.persistToLocalStorage;if(D)return He;if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const w=()=>Object.keys(localStorage).filter(y=>y.startsWith(h)&&y.endsWith(e?.pathname||o)),E=(y,f,T=!0)=>{const R=ue(y,e?.pathname||o,h);if(!f||Array.isArray(f)&&!f.length){i?(a.delete(y),c(a)):l(v=>{const j={...v};return delete j[y],j}),m&&localStorage.removeItem(R);return}m&&T&&f&&localStorage.setItem(R,JSON.stringify({...a,[y]:f})),i&&f?(a.set(y,JSON.stringify(f)),c(a)):!i&&f&&l(v=>({...v,[y]:f}))};return{getFilter:(y,f)=>{if(i){const T=a.get(y);if(T)return le(T)}else{const T=d[y];if(T!==void 0)return T}if(m){const T=ue(y,e?.pathname||o,h),R=localStorage.getItem(T);if(R)try{const v=JSON.parse(R)[y];return!i&&v!==void 0&&l(j=>({...j,[y]:v})),v}catch{}}return f},getFilters:()=>{const y=m?Xe(w()):{};if(i){const f=Array.from(a.entries()).reduce((T,[R,v])=>(T[R]=le(v),T),{});return{...y,...f}}return{...y,...d}},handleFilter:(y,f)=>(T,R)=>{if(R||Array.isArray(R)&&R.length===0){const v=f||"value",j=typeof R=="object"&&v in R?R[v]:R;E(y,j);return}E(y,void 0)},setFilter:E}},qe=({data:e,fetchNextPage:t,isFetchingNextPage:r,isInitialLoading:s,isLoading:o,enabled:a=!0})=>{const c=u.useCallback(async l=>{r||!a||await t({pageParam:l?.pageParam||l.visibleRowsCount})},[a,t,r]),d=u.useMemo(()=>{if(e)return e.pages.reduce((l,h)=>[...l,...h],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:r||o,loadingVariant:s?"skeleton":"linear-progress",rows:d}},$e=e=>{const{libraries:t}=u.useContext(A),r=e?.i18||t?.i18,s=e?.i18?.translateFunction||t?.i18?.translateFunction,o=r?.i18next?.t||s||(h=>h),{unknownErrorTranslationKey:a="error.unknownError"}=e||{},c=o(a),d=u.useCallback(h=>{if(h&&typeof h=="object"&&"response"in h){const{response:i}=h||{};if(i&&typeof i=="object"&&"reason"in i&&i.reason)return String(i.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"reason"in i.data&&i.data.reason)return String(i.data.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"message"in i.data&&i.data.message)return String(i.data.message);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"detail"in i.data){const{detail:m}=i.data;if(Array.isArray(m)&&m.length>0&&typeof m[0]=="object"&&m[0]!==null&&"msg"in m[0]){const{msg:w}=m[0];if(typeof w=="string")return String(w)}}}return h instanceof Error?h.message:c},[c]);return{getErrorCode:u.useCallback(h=>{const{response:i}=h||{};return i?.error_code?String(i?.error_code):i?.data?.error_code?String(i?.data?.error_code):i?.error_code?String(i?.error_code):i?.data?.error_code?String(i.data.error_code):"unknown_error_code"},[]),printError:d}};g.ChatClient=te,g.ChatContext=B,g.ChatProvider=Me,g.GTMSendPageView=ve,g.InitializeAxiosConfig=_e,g.InitializeDaysJSConfig=Re,g.InitializeI18nConfig=Ce,g.InitializeSentryConfig=be,g.InjectDependenciesContext=A,g.InjectDependenciesProvider=Ee,g.MaskTextField=ye,g.PreloadErrorHandler=Te,g.QueryClientProviderWithConfig=Ue,g.RequireAuth=Ae,g.axiosCustomInstance=he,g.dateAdapter=ae,g.distanceAdapter=ie,g.getOrvalConfig=xe,g.useAdapter=Ve,g.useAuth=Qe,g.useChat=Je,g.useCurrentLanguage=Ke,g.useFilters=Ze,g.useInfiniteDataGrid=qe,g.useResponseError=$e,g.worksiteNameAdapter=ce,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,R,b,F,b),Z[b+R]=!0)}if(b=null,w!==void 0&&(r(w),b=""+w),c(h)&&(r(h.key),b=""+h.key),"key"in h){w={};for(var ne in h)ne!=="key"&&(w[ne]=h[ne])}else w=h;return b&&l(w,typeof n=="function"?n.displayName||n.name||"Unknown":n),p(n,b,w,o(),q,te)}function m(n){E(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===z&&(n._payload.status==="fulfilled"?E(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function E(n){return typeof n=="object"&&n!==null&&n.$$typeof===I}var v=d,I=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),_=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),A=Symbol.for("react.client.reference"),W=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=Object.prototype.hasOwnProperty,ee=Array.isArray,G=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(n){return n()}};var K,B={},H=v.react_stack_bottom_frame.bind(v,a)(),X=G(s(a)),Z={};M.Fragment=P,M.jsx=function(n,h,w){var R=1e4>W.recentlyCreatedOwnerStacks++;return i(n,h,w,!1,R?Error("react-stack-top-frame"):H,R?G(s(n)):X)},M.jsxs=function(n,h,w){var R=1e4>W.recentlyCreatedOwnerStacks++;return i(n,h,w,!0,R?Error("react-stack-top-frame"):H,R?G(s(n)):X)}})()),M}var ae;function me(){return ae||(ae=1,process.env.NODE_ENV==="production"?V.exports=pe():V.exports=ge()),V.exports}var O=me();const ye=({IMaskMixin:e,...t})=>{const r=d.useMemo(()=>e(({TextField:s,...o})=>O.jsx(s,{...o})),[e]);return O.jsx(r,{...t})},j=d.createContext({}),Ee=({children:e,apiURL:t,libraries:r,localStorageKeys:s})=>{const o=d.useMemo(()=>({apiURL:t,libraries:r,localStorageKeys:s}),[t,r,s]);return O.jsx(j.Provider,{value:o,children:e})},ve=({data:e,...t})=>{const{libraries:r}=d.useContext(j),s=t?.reactRouter||r?.reactRouter,o=t?.gtm||r?.gtm;if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!o)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:a}=o,{useLocation:c,Outlet:l}=s,{pathname:u}=c(),{sendEvent:p}=a();return d.useEffect(()=>{p({event:"pageView",pathname:u,...e})},[e,u,p]),O.jsx(l,{})},Y=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),we="user",Ce=({tokenTypeKey:e="tokenType",tokenKey:t="accessToken",postContentType:r="application/json",...s})=>{const{apiURL:o=s.apiURL,libraries:a,localStorageKeys:c}=d.useContext(j),l=s?.userLocalStorageKey||c?.user||we,u=s?.axios||a?.axios;if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!u?.defaults||Y)return null;if(typeof window<"u"&&window.localStorage){const p=localStorage.getItem(l),i=p?JSON.parse(p):null,m=i?.[e]?i[e]:null,E=i?.[t]?i[t]:null,v=p?`${m} ${E}`:null;v&&(u.defaults.headers.common.Authorization=v)}return u.defaults.baseURL=o,u.defaults.headers.post["Content-Type"]=r,null},_e=({language:e,...t})=>{const{libraries:r}=d.useContext(j),s=t?.dayjs||r?.dayjs,o=t?.plugin||r?.dayjsPlugin;if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return d.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";o&&o.forEach(l=>{l&&s.extend(l)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),s.locale(c)})().then()},[s,o,e]),null},Re=({debug:e,resources:t,...r})=>{const{libraries:s}=d.useContext(j),o=r?.i18||s?.i18,{i18next:a,initReactI18next:c,languageDetector:l}=o||{};if(Y)return null;if(!o)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return a?.isInitialized||(a.use(l).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:t,returnNull:!1}).then(()=>{document.documentElement.lang!==a.resolvedLanguage&&a.resolvedLanguage&&document.documentElement.setAttribute("lang",a.resolvedLanguage)}),a.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},be=({dsn:e,integrations:t,tracesSampleRate:r,replaysSessionSampleRate:s,replaysOnErrorSampleRate:o,tracePropagationTargets:a,ignoreErrors:c,debug:l,environment:u,release:p,...i})=>{const{libraries:m}=d.useContext(j),E=i?.sentry||m?.sentry,v=i?.reactRouter||m?.reactRouter;if(!E)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!v)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(E.isInitialized())return null;const{createRoutesFromChildren:I,matchRoutes:C,useLocation:P,useNavigationType:y}=v;return(l||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&E.init({debug:l,dsn:e,environment:u||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[E.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:I,matchRoutes:C,useEffect:d.useEffect,useLocation:P,useNavigationType:y}),...t||[]],release:p,replaysOnErrorSampleRate:o||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:a,tracesSampleRate:r||1}),null},Te=()=>(d.useEffect(()=>{if(Y)return;const e=t=>{try{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),ie=new WeakMap,Se="user",Ae=({Fallback:e,isLogged:t,loginPath:r="/login",redirect401Path:s="/login",...o})=>{const{libraries:a,localStorageKeys:c}=d.useContext(j),l=o?.reactRouter||a?.reactRouter,u=o?.axios||a?.axios,p=o?.localStorageKey||c?.user||Se;if(!l)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,m]=d.useState(null),{useLocation:E,Navigate:v,Outlet:I}=l,C=E(),P=typeof t=="function"?t():!!t,y=typeof P=="boolean"?P:P?.isLogged;return d.useEffect(()=>{ie.has(u)||(ie.set(u,!0),u.interceptors.response.use(f=>f,f=>(typeof f=="object"&&f&&"response"in f&&f.response&&typeof f.response=="object"&&"status"in f.response&&f.response&&typeof f.response=="object"&&"status"in f.response&&f?.response?.status===401&&(typeof f=="object"&&f&&"config"in f&&f.config&&typeof f.config=="object"&&"headers"in f.config&&f.config.headers&&typeof f.config.headers=="object"&&"Authorization"in f.config.headers&&f.config.headers.Authorization&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(p)),m(s)),Promise.reject(f))))},[u,p,s]),y&&!i?O.jsx(d.Suspense,{fallback:e,children:C.state?.from?.state&&C.state?.from?.pathname===r?O.jsx(v,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):O.jsx(I,{})}):O.jsx(v,{to:r+C.search,state:{from:C},replace:!0})},je=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),ke=e=>{const t=e.split(/[/\\]/).pop()||"";return t.substring(0,t.lastIndexOf("."))},Pe=e=>{const s=e.split("/").filter(o=>o.length>0).map(o=>o.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return s.charAt(0).toLowerCase()+s.slice(1)},Ie=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Oe=(e,t,r,s)=>{const o=Pe(t),a=je(r),c=`${o}${a}`;return e&&typeof e=="object"&&"operationId"in e&&s?.includes(String(e.operationId))?`${c}AsQuery`:c},Ne=(e,t)=>{const r={};return e?.forEach(s=>{r[s]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),t?.filter(s=>!r[s]).forEach(s=>{r[s]={query:{useQuery:!0}}}),Object.keys(r).length?r:void 0},xe=e=>(Array.isArray(e)?e:[e]).reduce((r,s)=>{const{output:o,useInfiniteIds:a,useQueryIds:c,input:l="./openapi.json",customAxiosInstancePath:u,overrideApiName:p}=s||{},i=p||Ie(l),m=u||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...r,[i]:{input:l,output:{baseUrl:o?.baseUrl,client:"react-query",mode:"tags-split",override:{...(a?.length||c?.length)&&{operations:Ne(a,c)},header:E=>["Generated by orval 🍺",...E.title?[E.title]:[],...E.description?[E.description]:[]],mutator:{name:ke(m),path:m},operationName:(E,v,I)=>Oe(E,v,I,c),query:{useQuery:!0}},schemas:o?.schemas||`src/api/${i}/model`,target:o?.target||`src/api/${i}/services/api.ts`,...o}}}},{}),Le="user",Fe=e=>{const t=e.startsWith("https")?"wss":"ws",r=e.replace(/^https?:\/\//,"");return`${t}://${r}/v2/threads/ws`},De=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t)?.accessToken??null:null}catch{return null}},$=d.createContext(null),Me=({children:e,...t})=>{const[r,s]=d.useState(!1),[o,a]=d.useState(!1),[c,l]=d.useState(0),{apiURL:u,localStorageKeys:p}=d.useContext(j),{reconnect:i=!0,enabled:m=!0,url:E,token:v}=t,I=p?.user||Le,C=d.useRef(null),P=d.useRef(t);P.current=t,d.useEffect(()=>{if(!m||C.current?.connected)return;const k=E||(u?Fe(u):null);if(!k)return;const x=()=>v??De(I),z=A=>{const{onError:W,onReady:J,onNewMessage:ee,onNewMessageNotification:G,onPresence:K,onJoinedThread:B,onLeftThread:H,onMarkedRead:X,onThreadsList:Z}=P.current||{};switch(A.type){case"ready":a(!0),l(A.unreadCount??0),J?.(A);break;case"new_message":ee?.(A);break;case"new_message_notification":l(n=>n+1),G?.(A);break;case"presence":K?.(A);break;case"error":W?.(A);break;case"joined_thread":B?.(A);break;case"left_thread":H?.(A);break;case"marked_read":l(n=>Math.max(0,n-1)),X?.(A);break;case"threads_list":Z?.(A);break}},U=new re({getToken:x,onConnectionChange:A=>{s(A),A||a(!1)},onEvent:z,reconnect:i,url:k});return C.current=U,U.connect(),()=>{U.disconnect(),C.current=null}},[m,E,v,u,i,I]);const y=d.useCallback(k=>{C.current?.joinThread(k)},[]),f=d.useCallback(k=>{C.current?.leaveThread(k)},[]),T=d.useCallback((k,x)=>{C.current?.sendMessage(k,x)},[]),_=d.useCallback(k=>{C.current?.markRead(k)},[]),S=d.useCallback((k,x)=>{C.current?.listThreads(k,x)},[]),N={isConnected:r,isReady:o,joinThread:y,leaveThread:f,listThreads:S,markRead:_,sendMessage:T,unreadCount:c};return O.jsx($.Provider,{value:N,children:e})},Ye=e=>e&&typeof e=="function",ze=e=>e&&typeof e=="function",Ue=({children:e,defaultQueriesOptions:t,defaultMutationsOptions:r,...s})=>{const{libraries:o}=d.useContext(j),a=s?.QueryClient||o?.reactQuery?.QueryClient,c=s?.QueryClientProvider||o?.reactQuery?.QueryClientProvider;if(!a)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Ye(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!ze(a))throw new Error("Provided QueryClient dependencies are not valid.");const l=new a({defaultOptions:{mutations:{...r},queries:{getNextPageParam:(u,p,i)=>u.length+(i||0),refetchOnWindowFocus:!1,retry:3,...t}}});return O.jsx(c,{client:l,children:e})},ce=({library:e,date:t,format:r="ll"})=>e(t).format(r),le=(e,t)=>{const{fractionDigits:r=0,metric:s="km",spacingBetween:o=!0}=t||{},a=Number(e),c=o?" ":"";return Number.isNaN(a)?`0${c}${s}`:`${a.toFixed(r)}${c}${s}`},ue=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(r=>r.length>0?r.charAt(0).toUpperCase()+r.slice(1):r).join(" "),We=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Ge=({path:e,size:t,apiURL:r})=>{if(!e)return"";const s=We(e),o=`${r}${s}`,a=o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof t=="number"&&a?`${o.replace("/files",`/thumbs/${t}`)}`:o},Ve=e=>{const{apiURL:t,libraries:r}=d.useContext(j),s=e?.dayjs||r?.dayjs;return{dateAdapter:(c,l)=>{if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return ce({date:c,format:l,library:s})},distanceAdapter:le,filePathAdapter:(c,l)=>{if(!t)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Ge({apiURL:t,path:c,size:l})},worksiteNameAdapter:ue}},Qe=e=>{const{libraries:t,localStorageKeys:r}=d.useContext(j),s=e?.axios||t?.axios,o=e?.localStorageKey||r?.user||"user";if(!s)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=d.useCallback(({tokenType:l,accessToken:u})=>{s.defaults.headers.common.Authorization=`${l} ${u}`},[s.defaults.headers.common]),c=()=>{s.defaults.headers.common.Authorization=null};return d.useEffect(()=>{if(Y)return;const l=({newValue:u,key:p})=>{if(p===o&&u)try{const{accessToken:i,tokenType:m}=JSON.parse(u);a({accessToken:i,tokenType:m})}catch(i){console.error("Failed to parse newValue from localStorage:",i)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[o,a]),{clearAuthenticationToken:c,setAuthenticationToken:a}},Je=()=>{const e=d.useContext($);if(!e)throw new Error("useChat must be used within ChatProvider");return e},Q=(e,t)=>t==="short"?e.split("-")[0]:e,Ke=(e,t="full")=>{const[r,s]=d.useState(()=>{const o=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,Q(o,t)});return d.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&s(Q(e.language,t));const o=a=>{s(Q(a,t))};return e?.on?.("languageChanged",o),()=>{e?.off?.("languageChanged",o)}},[e,t]),r},Be="tracktor.filter",He={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},de=e=>{try{return JSON.parse(e)}catch{return e}},fe=(e,t,r)=>`${r}_${e}=>${t}`,Xe=e=>e.reduce((t,r)=>{const s=localStorage.getItem(r);if(s)try{const o=JSON.parse(s),a=Object.keys(o)?.[0];a&&(t[a]=Object.values(o)?.[0])}catch{}return t},{}),Ze=e=>{const{libraries:t,localStorageKeys:r}=d.useContext(j),s=e?.reactRouter||t?.reactRouter,{pathname:o}=s?.useLocation?.()??{pathname:"/"},[a,c]=s?.useSearchParams?.()??[new URLSearchParams,()=>{}],[l,u]=d.useState({}),p=r?.filter||Be,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl,m=e?.persistToLocalStorage===void 0?!0:e?.persistToLocalStorage;if(Y)return He;if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const E=()=>Object.keys(localStorage).filter(y=>y.startsWith(p)&&y.endsWith(e?.pathname||o)),v=(y,f,T=!0)=>{const _=fe(y,e?.pathname||o,p);if(!f||Array.isArray(f)&&!f.length){i?(a.delete(y),c(a)):u(S=>{const N={...S};return delete N[y],N}),m&&localStorage.removeItem(_);return}m&&T&&f&&localStorage.setItem(_,JSON.stringify({...a,[y]:f})),i&&f?(a.set(y,JSON.stringify(f)),c(a)):!i&&f&&u(S=>({...S,[y]:f}))};return{getFilter:(y,f)=>{if(i){const T=a.get(y);if(T)return de(T)}else{const T=l[y];if(T!==void 0)return T}if(m){const T=fe(y,e?.pathname||o,p),_=localStorage.getItem(T);if(_)try{const S=JSON.parse(_)[y];return!i&&S!==void 0&&u(N=>({...N,[y]:S})),S}catch{}}return f},getFilters:()=>{const y=m?Xe(E()):{};if(i){const f=Array.from(a.entries()).reduce((T,[_,S])=>(T[_]=de(S),T),{});return{...y,...f}}return{...y,...l}},handleFilter:(y,f)=>(T,_)=>{if(_||Array.isArray(_)&&_.length===0){const S=f||"value",N=typeof _=="object"&&S in _?_[S]:_;v(y,N);return}v(y,void 0)},setFilter:v}},qe=({data:e,fetchNextPage:t,isFetchingNextPage:r,isInitialLoading:s,isLoading:o,enabled:a=!0})=>{const c=d.useCallback(async u=>{r||!a||await t({pageParam:u?.pageParam||u.visibleRowsCount})},[a,t,r]),l=d.useMemo(()=>{if(e)return e.pages.reduce((u,p)=>[...u,...p],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:r||o,loadingVariant:s?"skeleton":"linear-progress",rows:l}},$e=e=>{const{libraries:t}=d.useContext(j),r=e?.i18||t?.i18,s=e?.i18?.translateFunction||t?.i18?.translateFunction,o=r?.i18next?.t||s||(p=>p),{unknownErrorTranslationKey:a="error.unknownError"}=e||{},c=o(a),l=d.useCallback(p=>{if(p&&typeof p=="object"&&"response"in p){const{response:i}=p||{};if(i&&typeof i=="object"&&"reason"in i&&i.reason)return String(i.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"reason"in i.data&&i.data.reason)return String(i.data.reason);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"message"in i.data&&i.data.message)return String(i.data.message);if(i&&typeof i=="object"&&"data"in i&&i.data&&typeof i.data=="object"&&"detail"in i.data){const{detail:m}=i.data;if(Array.isArray(m)&&m.length>0&&typeof m[0]=="object"&&m[0]!==null&&"msg"in m[0]){const{msg:E}=m[0];if(typeof E=="string")return String(E)}}}return p instanceof Error?p.message:c},[c]);return{getErrorCode:d.useCallback(p=>{const{response:i}=p||{};return i?.error_code?String(i?.error_code):i?.data?.error_code?String(i?.data?.error_code):i?.error_code?String(i?.error_code):i?.data?.error_code?String(i.data.error_code):"unknown_error_code"},[]),printError:l}};g.ChatClient=re,g.ChatContext=$,g.ChatProvider=Me,g.GTMSendPageView=ve,g.InitializeAxiosConfig=Ce,g.InitializeDaysJSConfig=_e,g.InitializeI18nConfig=Re,g.InitializeSentryConfig=be,g.InjectDependenciesContext=j,g.InjectDependenciesProvider=Ee,g.MaskTextField=ye,g.PreloadErrorHandler=Te,g.QueryClientProviderWithConfig=Ue,g.RequireAuth=Ae,g.axiosCustomInstance=he,g.dateAdapter=ce,g.distanceAdapter=le,g.getOrvalConfig=xe,g.useAdapter=Ve,g.useAuth=Qe,g.useChat=Je,g.useCurrentLanguage=Ke,g.useFilters=Ze,g.useInfiniteDataGrid=qe,g.useResponseError=$e,g.worksiteNameAdapter=ue,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|