@tracktor/shared-module 2.35.0 → 2.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context/QueryClientProviderWithConfig.d.ts +3 -9
- package/dist/main.d.ts +2 -2
- package/dist/main.js +243 -238
- package/dist/main.umd.cjs +5 -5
- package/dist/utils/lazyWithRetry.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { InjectDependenciesContextProps } from './InjectDependenciesProvider';
|
|
3
|
-
interface
|
|
3
|
+
interface QueryProviderProps extends PropsWithChildren {
|
|
4
4
|
/**
|
|
5
5
|
* QueryClientProvider from react-query
|
|
6
6
|
*/
|
|
@@ -22,11 +22,5 @@ interface QueryClientProviderWithConfigProps extends PropsWithChildren {
|
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* @param children
|
|
28
|
-
* @param options
|
|
29
|
-
* @constructor
|
|
30
|
-
*/
|
|
31
|
-
declare const QueryClientProviderWithConfig: ({ children, defaultQueriesOptions, defaultMutationsOptions, ...props }: QueryClientProviderWithConfigProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
export default QueryClientProviderWithConfig;
|
|
25
|
+
declare const QueryProvider: ({ children, defaultQueriesOptions, defaultMutationsOptions, ...props }: QueryProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export default QueryProvider;
|
package/dist/main.d.ts
CHANGED
|
@@ -25,8 +25,7 @@ export * from './context/ChatProvider';
|
|
|
25
25
|
export { default as ChatProvider } from './context/ChatProvider';
|
|
26
26
|
export * from './context/InjectDependenciesProvider';
|
|
27
27
|
export { default as InjectDependenciesProvider } from './context/InjectDependenciesProvider';
|
|
28
|
-
export
|
|
29
|
-
export { default as QueryClientProviderWithConfig } from './context/QueryClientProviderWithConfig';
|
|
28
|
+
export { default as QueryProvider } from './context/QueryClientProviderWithConfig';
|
|
30
29
|
export * from './hooks/useAdapter';
|
|
31
30
|
export { default as useAdapter } from './hooks/useAdapter';
|
|
32
31
|
export * from './hooks/useAuth';
|
|
@@ -46,3 +45,4 @@ export { default as useResponseError } from './hooks/useResponseError/useRespons
|
|
|
46
45
|
export { default as dateAdapter } from './utils/adapter/dateAdapter';
|
|
47
46
|
export { default as distanceAdapter } from './utils/adapter/distanceAdapter';
|
|
48
47
|
export { default as worksiteNameAdapter } from './utils/adapter/worksiteNameAdapter/worksiteNameAdapter';
|
|
48
|
+
export { default as lazyWithRetry } from './utils/lazyWithRetry';
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _e, { useMemo as
|
|
3
|
-
const
|
|
4
|
-
const n =
|
|
1
|
+
import ue from "axios";
|
|
2
|
+
import _e, { useMemo as le, createContext as ve, useContext as O, useEffect as P, useState as L, Suspense as be, useRef as X, useCallback as C, lazy as Se } from "react";
|
|
3
|
+
const et = (e, t) => {
|
|
4
|
+
const n = ue.CancelToken.source(), o = ue({
|
|
5
5
|
...e,
|
|
6
6
|
...t,
|
|
7
7
|
cancelToken: n.token
|
|
@@ -9,18 +9,18 @@ const Xe = (e, t) => {
|
|
|
9
9
|
return o.cancel = () => {
|
|
10
10
|
n.cancel("Query was cancelled");
|
|
11
11
|
}, o;
|
|
12
|
-
},
|
|
12
|
+
}, Te = 3e4, de = 1e3, ae = (e) => Array.isArray(e) ? e.map(ae) : e !== null && typeof e == "object" ? Object.fromEntries(
|
|
13
13
|
Object.entries(e).map(([t, n]) => [
|
|
14
14
|
t.replace(/_([a-z])/g, (o, s) => s.toUpperCase()),
|
|
15
|
-
|
|
15
|
+
ae(n)
|
|
16
16
|
])
|
|
17
|
-
) : e,
|
|
17
|
+
) : e, ie = (e) => Array.isArray(e) ? e.map(ie) : e !== null && typeof e == "object" ? Object.fromEntries(
|
|
18
18
|
Object.entries(e).map(([t, n]) => [
|
|
19
19
|
t.replace(/[A-Z]/g, (o) => `_${o.toLowerCase()}`),
|
|
20
|
-
|
|
20
|
+
ie(n)
|
|
21
21
|
])
|
|
22
22
|
) : e;
|
|
23
|
-
class
|
|
23
|
+
class Ae {
|
|
24
24
|
url;
|
|
25
25
|
getToken;
|
|
26
26
|
onEvent;
|
|
@@ -55,7 +55,7 @@ class Se {
|
|
|
55
55
|
this._connected = !0, this.reconnectAttempt = 0, this.onConnectionChange?.(!0), this.rejoinThreads(), this.flushPendingMessages();
|
|
56
56
|
}, this.ws.onmessage = (s) => {
|
|
57
57
|
try {
|
|
58
|
-
const a = JSON.parse(s.data), c =
|
|
58
|
+
const a = JSON.parse(s.data), c = ae(a);
|
|
59
59
|
c.type === "ready" && (this._ready = !0), this.onEvent?.(c);
|
|
60
60
|
} catch {
|
|
61
61
|
}
|
|
@@ -74,8 +74,8 @@ class Se {
|
|
|
74
74
|
this.joinedThreads.delete(t), this.send({ threadId: t, type: "leave_thread" });
|
|
75
75
|
}
|
|
76
76
|
sendMessage(t, n) {
|
|
77
|
-
if (n.length >
|
|
78
|
-
throw new Error(`Message body exceeds maximum length of ${
|
|
77
|
+
if (n.length > de)
|
|
78
|
+
throw new Error(`Message body exceeds maximum length of ${de} characters`);
|
|
79
79
|
this.send({ body: n, threadId: t, type: "send_message" });
|
|
80
80
|
}
|
|
81
81
|
markRead(t) {
|
|
@@ -89,7 +89,7 @@ class Se {
|
|
|
89
89
|
this.pendingMessages.push(t);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
this.ws.send(JSON.stringify(
|
|
92
|
+
this.ws.send(JSON.stringify(ie(t)));
|
|
93
93
|
}
|
|
94
94
|
flushPendingMessages() {
|
|
95
95
|
const t = [...this.pendingMessages];
|
|
@@ -103,7 +103,7 @@ class Se {
|
|
|
103
103
|
}
|
|
104
104
|
scheduleReconnect() {
|
|
105
105
|
this.clearReconnectTimer();
|
|
106
|
-
const t = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt,
|
|
106
|
+
const t = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, Te);
|
|
107
107
|
this.reconnectAttempt++, this.reconnectTimer = setTimeout(() => {
|
|
108
108
|
this.connect();
|
|
109
109
|
}, t);
|
|
@@ -112,11 +112,11 @@ class Se {
|
|
|
112
112
|
this.reconnectTimer !== null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
function
|
|
118
|
-
if (
|
|
119
|
-
|
|
115
|
+
var K = { exports: {} }, U = {};
|
|
116
|
+
var fe;
|
|
117
|
+
function Ce() {
|
|
118
|
+
if (fe) return U;
|
|
119
|
+
fe = 1;
|
|
120
120
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
121
121
|
function n(o, s, a) {
|
|
122
122
|
var c = null;
|
|
@@ -136,16 +136,16 @@ function Te() {
|
|
|
136
136
|
return U.Fragment = t, U.jsx = n, U.jsxs = n, U;
|
|
137
137
|
}
|
|
138
138
|
var M = {};
|
|
139
|
-
var
|
|
140
|
-
function
|
|
141
|
-
return
|
|
139
|
+
var pe;
|
|
140
|
+
function je() {
|
|
141
|
+
return pe || (pe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
142
142
|
function e(r) {
|
|
143
143
|
if (r == null) return null;
|
|
144
144
|
if (typeof r == "function")
|
|
145
|
-
return r.$$typeof ===
|
|
145
|
+
return r.$$typeof === re ? null : r.displayName || r.name || null;
|
|
146
146
|
if (typeof r == "string") return r;
|
|
147
147
|
switch (r) {
|
|
148
|
-
case
|
|
148
|
+
case A:
|
|
149
149
|
return "Fragment";
|
|
150
150
|
case d:
|
|
151
151
|
return "Profiler";
|
|
@@ -153,9 +153,9 @@ function Ce() {
|
|
|
153
153
|
return "StrictMode";
|
|
154
154
|
case I:
|
|
155
155
|
return "Suspense";
|
|
156
|
-
case q:
|
|
157
|
-
return "SuspenseList";
|
|
158
156
|
case Z:
|
|
157
|
+
return "SuspenseList";
|
|
158
|
+
case te:
|
|
159
159
|
return "Activity";
|
|
160
160
|
}
|
|
161
161
|
if (typeof r == "object")
|
|
@@ -171,7 +171,7 @@ function Ce() {
|
|
|
171
171
|
case S:
|
|
172
172
|
var f = r.render;
|
|
173
173
|
return r = r.displayName, r || (r = f.displayName || f.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
174
|
-
case
|
|
174
|
+
case ee:
|
|
175
175
|
return f = r.displayName || null, f !== null ? f : e(r.type) || "Memo";
|
|
176
176
|
case F:
|
|
177
177
|
f = r._payload, r = r._init;
|
|
@@ -194,16 +194,16 @@ function Ce() {
|
|
|
194
194
|
}
|
|
195
195
|
if (f) {
|
|
196
196
|
f = console;
|
|
197
|
-
var
|
|
198
|
-
return
|
|
197
|
+
var R = f.error, _ = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
198
|
+
return R.call(
|
|
199
199
|
f,
|
|
200
200
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
201
|
-
|
|
201
|
+
_
|
|
202
202
|
), t(r);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
function o(r) {
|
|
206
|
-
if (r ===
|
|
206
|
+
if (r === A) return "<>";
|
|
207
207
|
if (typeof r == "object" && r !== null && r.$$typeof === F)
|
|
208
208
|
return "<...>";
|
|
209
209
|
try {
|
|
@@ -228,14 +228,14 @@ function Ce() {
|
|
|
228
228
|
return r.key !== void 0;
|
|
229
229
|
}
|
|
230
230
|
function l(r, f) {
|
|
231
|
-
function
|
|
232
|
-
|
|
231
|
+
function R() {
|
|
232
|
+
v || (v = !0, console.error(
|
|
233
233
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
234
234
|
f
|
|
235
235
|
));
|
|
236
236
|
}
|
|
237
|
-
|
|
238
|
-
get:
|
|
237
|
+
R.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
238
|
+
get: R,
|
|
239
239
|
configurable: !0
|
|
240
240
|
});
|
|
241
241
|
}
|
|
@@ -245,15 +245,15 @@ function Ce() {
|
|
|
245
245
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
246
246
|
)), r = this.props.ref, r !== void 0 ? r : null;
|
|
247
247
|
}
|
|
248
|
-
function p(r, f,
|
|
249
|
-
var
|
|
248
|
+
function p(r, f, R, _, H, oe) {
|
|
249
|
+
var b = R.ref;
|
|
250
250
|
return r = {
|
|
251
251
|
$$typeof: j,
|
|
252
252
|
type: r,
|
|
253
253
|
key: f,
|
|
254
|
-
props:
|
|
255
|
-
_owner:
|
|
256
|
-
}, (
|
|
254
|
+
props: R,
|
|
255
|
+
_owner: _
|
|
256
|
+
}, (b !== void 0 ? b : null) !== null ? Object.defineProperty(r, "ref", {
|
|
257
257
|
enumerable: !1,
|
|
258
258
|
get: u
|
|
259
259
|
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
@@ -275,55 +275,55 @@ function Ce() {
|
|
|
275
275
|
configurable: !1,
|
|
276
276
|
enumerable: !1,
|
|
277
277
|
writable: !0,
|
|
278
|
-
value:
|
|
278
|
+
value: oe
|
|
279
279
|
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
280
280
|
}
|
|
281
|
-
function i(r, f,
|
|
282
|
-
var
|
|
283
|
-
if (
|
|
284
|
-
if (
|
|
285
|
-
if (
|
|
286
|
-
for (
|
|
287
|
-
h(
|
|
288
|
-
Object.freeze && Object.freeze(
|
|
281
|
+
function i(r, f, R, _, H, oe) {
|
|
282
|
+
var b = f.children;
|
|
283
|
+
if (b !== void 0)
|
|
284
|
+
if (_)
|
|
285
|
+
if (ne(b)) {
|
|
286
|
+
for (_ = 0; _ < b.length; _++)
|
|
287
|
+
h(b[_]);
|
|
288
|
+
Object.freeze && Object.freeze(b);
|
|
289
289
|
} else
|
|
290
290
|
console.error(
|
|
291
291
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
292
292
|
);
|
|
293
|
-
else h(
|
|
293
|
+
else h(b);
|
|
294
294
|
if (V.call(f, "key")) {
|
|
295
|
-
|
|
296
|
-
var $ = Object.keys(f).filter(function(
|
|
297
|
-
return
|
|
295
|
+
b = e(r);
|
|
296
|
+
var $ = Object.keys(f).filter(function(Re) {
|
|
297
|
+
return Re !== "key";
|
|
298
298
|
});
|
|
299
|
-
|
|
299
|
+
_ = 0 < $.length ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}", G[b + _] || ($ = 0 < $.length ? "{" + $.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
300
300
|
`A props object containing a "key" prop is being spread into JSX:
|
|
301
301
|
let props = %s;
|
|
302
302
|
<%s {...props} />
|
|
303
303
|
React keys must be passed directly to JSX without using spread:
|
|
304
304
|
let props = %s;
|
|
305
305
|
<%s key={someKey} {...props} />`,
|
|
306
|
+
_,
|
|
306
307
|
b,
|
|
307
|
-
R,
|
|
308
308
|
$,
|
|
309
|
-
|
|
310
|
-
), G[
|
|
309
|
+
b
|
|
310
|
+
), G[b + _] = !0);
|
|
311
311
|
}
|
|
312
|
-
if (
|
|
313
|
-
|
|
314
|
-
for (var
|
|
315
|
-
|
|
316
|
-
} else
|
|
317
|
-
return
|
|
318
|
-
|
|
312
|
+
if (b = null, R !== void 0 && (n(R), b = "" + R), c(f) && (n(f.key), b = "" + f.key), "key" in f) {
|
|
313
|
+
R = {};
|
|
314
|
+
for (var se in f)
|
|
315
|
+
se !== "key" && (R[se] = f[se]);
|
|
316
|
+
} else R = f;
|
|
317
|
+
return b && l(
|
|
318
|
+
R,
|
|
319
319
|
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
320
320
|
), p(
|
|
321
321
|
r,
|
|
322
|
+
b,
|
|
322
323
|
R,
|
|
323
|
-
_,
|
|
324
324
|
s(),
|
|
325
325
|
H,
|
|
326
|
-
|
|
326
|
+
oe
|
|
327
327
|
);
|
|
328
328
|
}
|
|
329
329
|
function h(r) {
|
|
@@ -332,55 +332,55 @@ React keys must be passed directly to JSX without using spread:
|
|
|
332
332
|
function g(r) {
|
|
333
333
|
return typeof r == "object" && r !== null && r.$$typeof === j;
|
|
334
334
|
}
|
|
335
|
-
var
|
|
335
|
+
var w = _e, j = /* @__PURE__ */ Symbol.for("react.transitional.element"), T = /* @__PURE__ */ Symbol.for("react.portal"), A = /* @__PURE__ */ Symbol.for("react.fragment"), m = /* @__PURE__ */ Symbol.for("react.strict_mode"), d = /* @__PURE__ */ Symbol.for("react.profiler"), y = /* @__PURE__ */ Symbol.for("react.consumer"), E = /* @__PURE__ */ Symbol.for("react.context"), S = /* @__PURE__ */ Symbol.for("react.forward_ref"), I = /* @__PURE__ */ Symbol.for("react.suspense"), Z = /* @__PURE__ */ Symbol.for("react.suspense_list"), ee = /* @__PURE__ */ Symbol.for("react.memo"), F = /* @__PURE__ */ Symbol.for("react.lazy"), te = /* @__PURE__ */ Symbol.for("react.activity"), re = /* @__PURE__ */ Symbol.for("react.client.reference"), D = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, ne = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
336
336
|
return null;
|
|
337
337
|
};
|
|
338
|
-
|
|
338
|
+
w = {
|
|
339
339
|
react_stack_bottom_frame: function(r) {
|
|
340
340
|
return r();
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
|
-
var
|
|
344
|
-
|
|
343
|
+
var v, k = {}, Q = w.react_stack_bottom_frame.bind(
|
|
344
|
+
w,
|
|
345
345
|
a
|
|
346
346
|
)(), J = Y(o(a)), G = {};
|
|
347
|
-
M.Fragment =
|
|
348
|
-
var
|
|
347
|
+
M.Fragment = A, M.jsx = function(r, f, R) {
|
|
348
|
+
var _ = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
349
349
|
return i(
|
|
350
350
|
r,
|
|
351
351
|
f,
|
|
352
|
-
|
|
352
|
+
R,
|
|
353
353
|
!1,
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
_ ? Error("react-stack-top-frame") : Q,
|
|
355
|
+
_ ? Y(o(r)) : J
|
|
356
356
|
);
|
|
357
|
-
}, M.jsxs = function(r, f,
|
|
358
|
-
var
|
|
357
|
+
}, M.jsxs = function(r, f, R) {
|
|
358
|
+
var _ = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
359
359
|
return i(
|
|
360
360
|
r,
|
|
361
361
|
f,
|
|
362
|
-
|
|
362
|
+
R,
|
|
363
363
|
!0,
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
_ ? Error("react-stack-top-frame") : Q,
|
|
365
|
+
_ ? Y(o(r)) : J
|
|
366
366
|
);
|
|
367
367
|
};
|
|
368
368
|
})()), M;
|
|
369
369
|
}
|
|
370
|
-
var
|
|
371
|
-
function
|
|
372
|
-
return
|
|
370
|
+
var he;
|
|
371
|
+
function ke() {
|
|
372
|
+
return he || (he = 1, process.env.NODE_ENV === "production" ? K.exports = Ce() : K.exports = je()), K.exports;
|
|
373
373
|
}
|
|
374
|
-
var N =
|
|
375
|
-
const
|
|
376
|
-
const n =
|
|
374
|
+
var N = ke();
|
|
375
|
+
const tt = ({ IMaskMixin: e, ...t }) => {
|
|
376
|
+
const n = le(
|
|
377
377
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
378
378
|
() => e(({ TextField: o, ...s }) => /* @__PURE__ */ N.jsx(o, { ...s })),
|
|
379
379
|
[e]
|
|
380
380
|
);
|
|
381
381
|
return /* @__PURE__ */ N.jsx(n, { ...t });
|
|
382
|
-
}, x = ve({}),
|
|
383
|
-
const s =
|
|
382
|
+
}, x = ve({}), rt = ({ children: e, apiURL: t, libraries: n, localStorageKeys: o }) => {
|
|
383
|
+
const s = le(
|
|
384
384
|
() => ({
|
|
385
385
|
apiURL: t,
|
|
386
386
|
libraries: n,
|
|
@@ -389,7 +389,7 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
389
389
|
[t, n, o]
|
|
390
390
|
);
|
|
391
391
|
return /* @__PURE__ */ N.jsx(x.Provider, { value: s, children: e });
|
|
392
|
-
},
|
|
392
|
+
}, nt = ({ data: e, ...t }) => {
|
|
393
393
|
const { libraries: n } = O(x), o = t?.reactRouter || n?.reactRouter, s = t?.gtm || n?.gtm;
|
|
394
394
|
if (!o)
|
|
395
395
|
throw new Error(
|
|
@@ -413,23 +413,23 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
413
413
|
} catch {
|
|
414
414
|
return !1;
|
|
415
415
|
}
|
|
416
|
-
})(),
|
|
416
|
+
})(), Pe = "user", ot = ({
|
|
417
417
|
tokenTypeKey: e = "tokenType",
|
|
418
418
|
tokenKey: t = "accessToken",
|
|
419
419
|
postContentType: n = "application/json",
|
|
420
420
|
...o
|
|
421
421
|
}) => {
|
|
422
|
-
const { apiURL: s = o.apiURL, libraries: a, localStorageKeys: c } = O(x), l = o?.userLocalStorageKey || c?.user ||
|
|
422
|
+
const { apiURL: s = o.apiURL, libraries: a, localStorageKeys: c } = O(x), l = o?.userLocalStorageKey || c?.user || Pe, u = o?.axios || a?.axios;
|
|
423
423
|
if (!u)
|
|
424
424
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
425
425
|
if (!u?.defaults || W)
|
|
426
426
|
return null;
|
|
427
427
|
if (typeof window < "u" && window.localStorage) {
|
|
428
|
-
const p = localStorage.getItem(l), i = p ? JSON.parse(p) : null, h = i?.[e] ? i[e] : null, g = i?.[t] ? i[t] : null,
|
|
429
|
-
|
|
428
|
+
const p = localStorage.getItem(l), i = p ? JSON.parse(p) : null, h = i?.[e] ? i[e] : null, g = i?.[t] ? i[t] : null, w = p ? `${h} ${g}` : null;
|
|
429
|
+
w && (u.defaults.headers.common.Authorization = w);
|
|
430
430
|
}
|
|
431
431
|
return u.defaults.baseURL = s, u.defaults.headers.post["Content-Type"] = n, null;
|
|
432
|
-
},
|
|
432
|
+
}, st = ({ language: e, ...t }) => {
|
|
433
433
|
const { libraries: n } = O(x), o = t?.dayjs || n?.dayjs, s = t?.plugin || n?.dayjsPlugin;
|
|
434
434
|
if (!o)
|
|
435
435
|
throw new Error(
|
|
@@ -443,19 +443,19 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
443
443
|
}), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), o.locale(c);
|
|
444
444
|
})().then();
|
|
445
445
|
}, [o, s, e, t.localizedFormat]), null;
|
|
446
|
-
},
|
|
446
|
+
}, ce = "hubspot-messages-iframe-container", z = "hs-show", at = ({ hubId: e }) => (P(() => {
|
|
447
447
|
if (!e)
|
|
448
448
|
return;
|
|
449
449
|
const t = document.createElement("style");
|
|
450
450
|
t.textContent = `
|
|
451
|
-
div#${
|
|
452
|
-
div#${
|
|
451
|
+
div#${ce} { display: none !important; }
|
|
452
|
+
div#${ce}.${z} { display: initial !important; }
|
|
453
453
|
`, document.head.appendChild(t);
|
|
454
454
|
const n = document.createElement("script");
|
|
455
455
|
return n.id = "hs-script-loader", n.src = `//js-eu1.hs-scripts.com/${e}.js`, n.async = !0, n.defer = !0, document.body.appendChild(n), () => {
|
|
456
456
|
t.remove(), n.remove();
|
|
457
457
|
};
|
|
458
|
-
}, [e]), null),
|
|
458
|
+
}, [e]), null), it = ({ debug: e, resources: t, ...n }) => {
|
|
459
459
|
const { libraries: o } = O(x), s = n?.i18 || o?.i18, { i18next: a, initReactI18next: c, languageDetector: l } = s || {};
|
|
460
460
|
if (W)
|
|
461
461
|
return null;
|
|
@@ -479,7 +479,7 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
479
479
|
}), a.on("languageChanged", (u) => {
|
|
480
480
|
document.documentElement.setAttribute("lang", u);
|
|
481
481
|
})), null;
|
|
482
|
-
},
|
|
482
|
+
}, ct = ({
|
|
483
483
|
dsn: e,
|
|
484
484
|
integrations: t,
|
|
485
485
|
tracesSampleRate: n,
|
|
@@ -492,14 +492,14 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
492
492
|
release: p,
|
|
493
493
|
...i
|
|
494
494
|
}) => {
|
|
495
|
-
const { libraries: h } = O(x), g = i?.sentry || h?.sentry,
|
|
495
|
+
const { libraries: h } = O(x), g = i?.sentry || h?.sentry, w = i?.reactRouter || h?.reactRouter;
|
|
496
496
|
if (!g)
|
|
497
497
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
498
|
-
if (!
|
|
498
|
+
if (!w)
|
|
499
499
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
500
500
|
if (g.isInitialized())
|
|
501
501
|
return null;
|
|
502
|
-
const { createRoutesFromChildren: j, matchRoutes: T, useLocation:
|
|
502
|
+
const { createRoutesFromChildren: j, matchRoutes: T, useLocation: A, useNavigationType: m } = w;
|
|
503
503
|
return (l || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && g.init({
|
|
504
504
|
debug: l,
|
|
505
505
|
dsn: e,
|
|
@@ -518,7 +518,7 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
518
518
|
createRoutesFromChildren: j,
|
|
519
519
|
matchRoutes: T,
|
|
520
520
|
useEffect: P,
|
|
521
|
-
useLocation:
|
|
521
|
+
useLocation: A,
|
|
522
522
|
useNavigationType: m
|
|
523
523
|
}),
|
|
524
524
|
...t || []
|
|
@@ -529,7 +529,7 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
529
529
|
tracePropagationTargets: a,
|
|
530
530
|
tracesSampleRate: n || 1
|
|
531
531
|
}), null;
|
|
532
|
-
},
|
|
532
|
+
}, lt = () => (P(() => {
|
|
533
533
|
if (W)
|
|
534
534
|
return;
|
|
535
535
|
const e = (t) => {
|
|
@@ -541,27 +541,27 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
541
541
|
return window.addEventListener("vite:preloadError", e), () => {
|
|
542
542
|
window.removeEventListener("vite:preloadError", e);
|
|
543
543
|
};
|
|
544
|
-
}, []), null),
|
|
545
|
-
const { libraries: a, localStorageKeys: c } = O(x), l = s?.reactRouter || a?.reactRouter, u = s?.axios || a?.axios, p = s?.localStorageKey || c?.user ||
|
|
544
|
+
}, []), null), ge = /* @__PURE__ */ new WeakMap(), Oe = "user", ut = ({ Fallback: e, isLogged: t, loginPath: n = "/login", redirect401Path: o = "/login", ...s }) => {
|
|
545
|
+
const { libraries: a, localStorageKeys: c } = O(x), l = s?.reactRouter || a?.reactRouter, u = s?.axios || a?.axios, p = s?.localStorageKey || c?.user || Oe;
|
|
546
546
|
if (!l)
|
|
547
547
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
548
|
-
const [i, h] = L(null), { useLocation: g, Navigate:
|
|
548
|
+
const [i, h] = L(null), { useLocation: g, Navigate: w, Outlet: j } = l, T = g(), A = typeof t == "function" ? t() : !!t, m = typeof A == "boolean" ? A : A?.isLogged;
|
|
549
549
|
return P(() => {
|
|
550
|
-
|
|
550
|
+
ge.has(u) || (ge.set(u, !0), u.interceptors.response.use(
|
|
551
551
|
(d) => d,
|
|
552
552
|
(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(o)), Promise.reject(d))
|
|
553
553
|
));
|
|
554
|
-
}, [u, p, o]), m && !i ? /* @__PURE__ */ N.jsx(be, { fallback: e, children: T.state?.from?.state && T.state?.from?.pathname === n ? /* @__PURE__ */ N.jsx(
|
|
555
|
-
},
|
|
554
|
+
}, [u, p, o]), m && !i ? /* @__PURE__ */ N.jsx(be, { fallback: e, children: T.state?.from?.state && T.state?.from?.pathname === n ? /* @__PURE__ */ N.jsx(w, { to: T.state.from.state.from.pathname + T.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ N.jsx(j, {}) }) : /* @__PURE__ */ N.jsx(w, { to: n + T.search, state: { from: T }, replace: !0 });
|
|
555
|
+
}, xe = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), Ie = (e) => {
|
|
556
556
|
const t = e.split(/[/\\]/).pop() || "";
|
|
557
557
|
return t.substring(0, t.lastIndexOf("."));
|
|
558
|
-
},
|
|
558
|
+
}, Ne = (e) => {
|
|
559
559
|
const o = e.split("/").filter((s) => s.length > 0).map((s) => s.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((u) => u.charAt(0).toUpperCase() + u.slice(1)).join("")).join("");
|
|
560
560
|
return o.charAt(0).toLowerCase() + o.slice(1);
|
|
561
|
-
},
|
|
562
|
-
const s =
|
|
561
|
+
}, Le = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), $e = (e, t, n, o) => {
|
|
562
|
+
const s = Ne(t), a = xe(n), c = `${s}${a}`;
|
|
563
563
|
return e && typeof e == "object" && "operationId" in e && o?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
|
|
564
|
-
},
|
|
564
|
+
}, Fe = (e, t) => {
|
|
565
565
|
const n = {};
|
|
566
566
|
return e?.forEach((o) => {
|
|
567
567
|
n[o] = {
|
|
@@ -578,8 +578,8 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
580
|
}), Object.keys(n).length ? n : void 0;
|
|
581
|
-
},
|
|
582
|
-
const { output: s, useInfiniteIds: a, useQueryIds: c, input: l = "./openapi.json", customAxiosInstancePath: u, overrideApiName: p } = o || {}, i = p ||
|
|
581
|
+
}, dt = (e) => (Array.isArray(e) ? e : [e]).reduce((n, o) => {
|
|
582
|
+
const { output: s, useInfiniteIds: a, useQueryIds: c, input: l = "./openapi.json", customAxiosInstancePath: u, overrideApiName: p } = o || {}, i = p || Le(l), h = u || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
|
|
583
583
|
return {
|
|
584
584
|
...n,
|
|
585
585
|
[i]: {
|
|
@@ -590,7 +590,7 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
590
590
|
mode: "tags-split",
|
|
591
591
|
override: {
|
|
592
592
|
...(a?.length || c?.length) && {
|
|
593
|
-
operations:
|
|
593
|
+
operations: Fe(a, c)
|
|
594
594
|
},
|
|
595
595
|
header: (g) => [
|
|
596
596
|
"Generated by orval 🍺",
|
|
@@ -598,10 +598,10 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
598
598
|
...g.description ? [g.description] : []
|
|
599
599
|
],
|
|
600
600
|
mutator: {
|
|
601
|
-
name:
|
|
601
|
+
name: Ie(h),
|
|
602
602
|
path: h
|
|
603
603
|
},
|
|
604
|
-
operationName: (g,
|
|
604
|
+
operationName: (g, w, j) => $e(g, w, j, c),
|
|
605
605
|
query: {
|
|
606
606
|
useQuery: !0
|
|
607
607
|
}
|
|
@@ -612,20 +612,20 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
-
}, {}),
|
|
615
|
+
}, {}), De = "user", Ye = {
|
|
616
616
|
client: "/v2/threads/ws",
|
|
617
617
|
supplier: "/v1/threads/ws"
|
|
618
|
-
},
|
|
618
|
+
}, Ue = (e, t) => {
|
|
619
619
|
const n = e.startsWith("https") ? "wss" : "ws", o = e.replace(/^https?:\/\//, "");
|
|
620
620
|
return `${n}://${o}${t}`;
|
|
621
|
-
},
|
|
621
|
+
}, Me = (e) => {
|
|
622
622
|
try {
|
|
623
623
|
const t = localStorage.getItem(e);
|
|
624
624
|
return t ? JSON.parse(t)?.accessToken ?? null : null;
|
|
625
625
|
} catch {
|
|
626
626
|
return null;
|
|
627
627
|
}
|
|
628
|
-
},
|
|
628
|
+
}, Ee = ve(null), ft = ({
|
|
629
629
|
children: e,
|
|
630
630
|
token: t,
|
|
631
631
|
url: n,
|
|
@@ -634,19 +634,19 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
634
634
|
enabled: a = !0,
|
|
635
635
|
context: c = "client"
|
|
636
636
|
}) => {
|
|
637
|
-
const [l, u] = L(!1), [p, i] = L(!1), [h, g] = L(0), [
|
|
637
|
+
const [l, u] = L(!1), [p, i] = L(!1), [h, g] = L(0), [w, j] = L(a), T = a && w, { apiURL: A, localStorageKeys: m } = O(x), d = m?.user || De, y = X(null), E = X(/* @__PURE__ */ new Set());
|
|
638
638
|
P(() => {
|
|
639
639
|
if (!T)
|
|
640
640
|
return;
|
|
641
|
-
const
|
|
641
|
+
const v = o ?? Ye[c], k = n || (A ? Ue(A, v) : null);
|
|
642
642
|
if (!k)
|
|
643
643
|
return;
|
|
644
|
-
const Q = () => t ??
|
|
644
|
+
const Q = () => t ?? Me(d), J = (r) => {
|
|
645
645
|
r.type === "ready" && (i(!0), g(r.unreadCount ?? 0));
|
|
646
646
|
for (const f of E.current)
|
|
647
647
|
f(r);
|
|
648
648
|
}, G = setTimeout(() => {
|
|
649
|
-
const r = new
|
|
649
|
+
const r = new Ae({
|
|
650
650
|
getToken: Q,
|
|
651
651
|
onConnectionChange: (f) => {
|
|
652
652
|
u(f), f || i(!1);
|
|
@@ -660,59 +660,55 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
660
660
|
return () => {
|
|
661
661
|
clearTimeout(G), y.current?.disconnect(), y.current = null;
|
|
662
662
|
};
|
|
663
|
-
}, [T, n, o, c, t, s,
|
|
664
|
-
const S =
|
|
665
|
-
y.current?.joinThread(
|
|
666
|
-
}, []), I =
|
|
667
|
-
y.current?.leaveThread(
|
|
668
|
-
}, []),
|
|
669
|
-
y.current?.sendMessage(
|
|
670
|
-
}, []),
|
|
671
|
-
y.current?.markRead(
|
|
672
|
-
}, []), F =
|
|
673
|
-
y.current?.listThreads(
|
|
674
|
-
}, []),
|
|
675
|
-
g((k) => k +
|
|
676
|
-
}, []),
|
|
677
|
-
g((k) => Math.max(0, k -
|
|
678
|
-
}, []), D =
|
|
663
|
+
}, [T, n, o, c, t, s, A, d]);
|
|
664
|
+
const S = C((v) => {
|
|
665
|
+
y.current?.joinThread(v);
|
|
666
|
+
}, []), I = C((v) => {
|
|
667
|
+
y.current?.leaveThread(v);
|
|
668
|
+
}, []), Z = C((v, k) => {
|
|
669
|
+
y.current?.sendMessage(v, k);
|
|
670
|
+
}, []), ee = C((v) => {
|
|
671
|
+
y.current?.markRead(v);
|
|
672
|
+
}, []), F = C((v, k) => {
|
|
673
|
+
y.current?.listThreads(v, k);
|
|
674
|
+
}, []), te = C((v = 1) => {
|
|
675
|
+
g((k) => k + v);
|
|
676
|
+
}, []), re = C((v = 1) => {
|
|
677
|
+
g((k) => Math.max(0, k - v));
|
|
678
|
+
}, []), D = C(() => {
|
|
679
679
|
y.current?.disconnect(), y.current = null;
|
|
680
|
-
}, []), V =
|
|
681
|
-
j(
|
|
682
|
-
}, []),
|
|
683
|
-
E.current.delete(
|
|
680
|
+
}, []), V = C((v) => {
|
|
681
|
+
j(v);
|
|
682
|
+
}, []), ne = C((v) => (E.current.add(v), () => {
|
|
683
|
+
E.current.delete(v);
|
|
684
684
|
}), []), Y = {
|
|
685
|
-
decrementUnreadCount:
|
|
685
|
+
decrementUnreadCount: re,
|
|
686
686
|
disconnect: D,
|
|
687
|
-
incrementUnreadCount:
|
|
687
|
+
incrementUnreadCount: te,
|
|
688
688
|
isConnected: l,
|
|
689
689
|
isReady: p,
|
|
690
690
|
joinThread: S,
|
|
691
691
|
leaveThread: I,
|
|
692
692
|
listThreads: F,
|
|
693
|
-
markRead:
|
|
694
|
-
sendMessage:
|
|
693
|
+
markRead: ee,
|
|
694
|
+
sendMessage: Z,
|
|
695
695
|
setEnabled: V,
|
|
696
|
-
subscribe:
|
|
696
|
+
subscribe: ne,
|
|
697
697
|
unreadCount: h
|
|
698
698
|
};
|
|
699
|
-
return /* @__PURE__ */ N.jsx(
|
|
700
|
-
},
|
|
701
|
-
children: e,
|
|
702
|
-
defaultQueriesOptions: t,
|
|
703
|
-
defaultMutationsOptions: n,
|
|
704
|
-
...o
|
|
705
|
-
}) => {
|
|
699
|
+
return /* @__PURE__ */ N.jsx(Ee.Provider, { value: Y, children: e });
|
|
700
|
+
}, ze = (e) => e && typeof e == "function", We = (e) => e && typeof e == "function", pt = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...o }) => {
|
|
706
701
|
const { libraries: s } = O(x), a = o?.QueryClient || s?.reactQuery?.QueryClient, c = o?.QueryClientProvider || s?.reactQuery?.QueryClientProvider;
|
|
707
702
|
if (!a)
|
|
708
703
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
709
704
|
if (!c)
|
|
710
705
|
throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
711
|
-
if (!
|
|
706
|
+
if (!ze(c))
|
|
712
707
|
throw new Error("Provided QueryClientProvider dependencies are not valid.");
|
|
713
|
-
if (!
|
|
708
|
+
if (!We(a))
|
|
714
709
|
throw new Error("Provided QueryClient dependencies are not valid.");
|
|
715
|
-
const l =
|
|
710
|
+
const l = X(null);
|
|
711
|
+
return l.current || (l.current = new a({
|
|
716
712
|
defaultOptions: {
|
|
717
713
|
mutations: {
|
|
718
714
|
...n
|
|
@@ -724,47 +720,46 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
724
720
|
...t
|
|
725
721
|
}
|
|
726
722
|
}
|
|
727
|
-
});
|
|
728
|
-
|
|
729
|
-
}, ze = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), We = (e, t) => {
|
|
723
|
+
})), /* @__PURE__ */ N.jsx(c, { client: l.current, children: e });
|
|
724
|
+
}, Ve = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), Qe = (e, t) => {
|
|
730
725
|
const { fractionDigits: n = 0, metric: o = "km", spacingBetween: s = !0 } = t || {}, a = Number(e), c = s ? " " : "";
|
|
731
726
|
return Number.isNaN(a) ? `0${c}${o}` : `${a.toFixed(n)}${c}${o}`;
|
|
732
|
-
},
|
|
727
|
+
}, Je = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((n) => n.length > 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n).join(" "), Ge = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, He = ({ path: e, size: t, apiURL: n }) => {
|
|
733
728
|
if (!e)
|
|
734
729
|
return "";
|
|
735
|
-
const o =
|
|
730
|
+
const o = Ge(e), s = `${n}${o}`, a = s.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
736
731
|
return typeof t == "number" && a ? `${s.replace("/files", `/thumbs/${t}`)}` : s;
|
|
737
|
-
},
|
|
732
|
+
}, ht = (e) => {
|
|
738
733
|
const { apiURL: t, libraries: n } = O(x), o = e?.dayjs || n?.dayjs;
|
|
739
734
|
return {
|
|
740
735
|
dateAdapter: (c, l) => {
|
|
741
736
|
if (!o)
|
|
742
737
|
throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
743
|
-
return
|
|
738
|
+
return Ve({
|
|
744
739
|
date: c,
|
|
745
740
|
format: l,
|
|
746
741
|
library: o
|
|
747
742
|
});
|
|
748
743
|
},
|
|
749
|
-
distanceAdapter:
|
|
744
|
+
distanceAdapter: Qe,
|
|
750
745
|
filePathAdapter: (c, l) => {
|
|
751
746
|
if (!t)
|
|
752
747
|
throw new Error(
|
|
753
748
|
"API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
|
|
754
749
|
);
|
|
755
|
-
return typeof c == "string" && /^https?:\/\//.test(c) ? c :
|
|
750
|
+
return typeof c == "string" && /^https?:\/\//.test(c) ? c : He({
|
|
756
751
|
apiURL: t,
|
|
757
752
|
path: c,
|
|
758
753
|
size: l
|
|
759
754
|
});
|
|
760
755
|
},
|
|
761
|
-
worksiteNameAdapter:
|
|
756
|
+
worksiteNameAdapter: Je
|
|
762
757
|
};
|
|
763
|
-
},
|
|
758
|
+
}, gt = (e) => {
|
|
764
759
|
const { libraries: t, localStorageKeys: n } = O(x), o = e?.axios || t?.axios, s = e?.localStorageKey || n?.user || "user";
|
|
765
760
|
if (!o)
|
|
766
761
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
767
|
-
const a =
|
|
762
|
+
const a = C(
|
|
768
763
|
({ tokenType: l, accessToken: u }) => {
|
|
769
764
|
o.defaults.headers.common.Authorization = `${l} ${u}`;
|
|
770
765
|
},
|
|
@@ -791,11 +786,11 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
791
786
|
clearAuthenticationToken: c,
|
|
792
787
|
setAuthenticationToken: a
|
|
793
788
|
};
|
|
794
|
-
},
|
|
795
|
-
const t = O(
|
|
789
|
+
}, mt = (e) => {
|
|
790
|
+
const t = O(Ee);
|
|
796
791
|
if (!t)
|
|
797
792
|
throw new Error("useChat must be used within ChatProvider");
|
|
798
|
-
const { subscribe: n, setEnabled: o, ...s } = t, a =
|
|
793
|
+
const { subscribe: n, setEnabled: o, ...s } = t, a = X(e);
|
|
799
794
|
return a.current = e, P(() => {
|
|
800
795
|
e?.enabled !== void 0 && o(e.enabled);
|
|
801
796
|
}, [e?.enabled, o]), P(() => n((c) => {
|
|
@@ -806,10 +801,10 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
806
801
|
onPresence: i,
|
|
807
802
|
onError: h,
|
|
808
803
|
onJoinedThread: g,
|
|
809
|
-
onLeftThread:
|
|
804
|
+
onLeftThread: w,
|
|
810
805
|
onMarkedRead: j,
|
|
811
806
|
onThreadArchived: T,
|
|
812
|
-
onThreadsList:
|
|
807
|
+
onThreadsList: A
|
|
813
808
|
} = a.current ?? {};
|
|
814
809
|
switch (c.type) {
|
|
815
810
|
case "ready":
|
|
@@ -831,7 +826,7 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
831
826
|
g?.(c);
|
|
832
827
|
break;
|
|
833
828
|
case "left_thread":
|
|
834
|
-
|
|
829
|
+
w?.(c);
|
|
835
830
|
break;
|
|
836
831
|
case "marked_read":
|
|
837
832
|
j?.(c);
|
|
@@ -840,25 +835,25 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
840
835
|
T?.(c);
|
|
841
836
|
break;
|
|
842
837
|
case "threads_list":
|
|
843
|
-
|
|
838
|
+
A?.(c);
|
|
844
839
|
break;
|
|
845
840
|
}
|
|
846
841
|
}), [n]), s;
|
|
847
|
-
},
|
|
842
|
+
}, B = (e, t) => t === "short" ? e.split("-")[0] : e, yt = (e, t = "full") => {
|
|
848
843
|
const [n, o] = L(() => {
|
|
849
844
|
const s = e?.language || navigator.language;
|
|
850
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
845
|
+
return e && "isInitialized" in e && e.isInitialized, B(s, t);
|
|
851
846
|
});
|
|
852
847
|
return P(() => {
|
|
853
|
-
e && "isInitialized" in e && e.isInitialized && e.language && o(
|
|
848
|
+
e && "isInitialized" in e && e.isInitialized && e.language && o(B(e.language, t));
|
|
854
849
|
const s = (a) => {
|
|
855
|
-
o(
|
|
850
|
+
o(B(a, t));
|
|
856
851
|
};
|
|
857
852
|
return e?.on?.("languageChanged", s), () => {
|
|
858
853
|
e?.off?.("languageChanged", s);
|
|
859
854
|
};
|
|
860
855
|
}, [e, t]), n;
|
|
861
|
-
},
|
|
856
|
+
}, Ke = "tracktor.filter", Be = {
|
|
862
857
|
getFilter: () => {
|
|
863
858
|
},
|
|
864
859
|
getFilters: () => ({}),
|
|
@@ -866,13 +861,13 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
866
861
|
},
|
|
867
862
|
setFilter: () => {
|
|
868
863
|
}
|
|
869
|
-
},
|
|
864
|
+
}, me = (e) => {
|
|
870
865
|
try {
|
|
871
866
|
return JSON.parse(e);
|
|
872
867
|
} catch {
|
|
873
868
|
return e;
|
|
874
869
|
}
|
|
875
|
-
},
|
|
870
|
+
}, ye = (e, t, n) => `${n}_${e}=>${t}`, qe = (e) => e.reduce((t, n) => {
|
|
876
871
|
const o = localStorage.getItem(n);
|
|
877
872
|
if (o)
|
|
878
873
|
try {
|
|
@@ -881,19 +876,19 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
881
876
|
} catch {
|
|
882
877
|
}
|
|
883
878
|
return t;
|
|
884
|
-
}, {}),
|
|
879
|
+
}, {}), wt = (e) => {
|
|
885
880
|
const { libraries: t, localStorageKeys: n } = O(x), o = e?.reactRouter || t?.reactRouter, { pathname: s } = o?.useLocation?.() ?? { pathname: "/" }, [a, c] = o?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
886
|
-
}], [l, u] = L({}), p = n?.filter ||
|
|
881
|
+
}], [l, u] = L({}), p = n?.filter || Ke, i = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, h = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
|
|
887
882
|
if (W)
|
|
888
|
-
return
|
|
883
|
+
return Be;
|
|
889
884
|
if (!o)
|
|
890
885
|
throw new Error(
|
|
891
886
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
|
|
892
887
|
);
|
|
893
888
|
const g = () => Object.keys(localStorage).filter(
|
|
894
889
|
(m) => m.startsWith(p) && m.endsWith(e?.pathname || s)
|
|
895
|
-
),
|
|
896
|
-
const E =
|
|
890
|
+
), w = (m, d, y = !0) => {
|
|
891
|
+
const E = ye(m, e?.pathname || s, p);
|
|
897
892
|
if (!d || Array.isArray(d) && !d.length) {
|
|
898
893
|
i ? (a.delete(m), c(a)) : u((S) => {
|
|
899
894
|
const I = { ...S };
|
|
@@ -908,14 +903,14 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
908
903
|
if (i) {
|
|
909
904
|
const y = a.get(m);
|
|
910
905
|
if (y)
|
|
911
|
-
return
|
|
906
|
+
return me(y);
|
|
912
907
|
} else {
|
|
913
908
|
const y = l[m];
|
|
914
909
|
if (y !== void 0)
|
|
915
910
|
return y;
|
|
916
911
|
}
|
|
917
912
|
if (h) {
|
|
918
|
-
const y =
|
|
913
|
+
const y = ye(m, e?.pathname || s, p), E = localStorage.getItem(y);
|
|
919
914
|
if (E)
|
|
920
915
|
try {
|
|
921
916
|
const S = JSON.parse(E)[m];
|
|
@@ -926,9 +921,9 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
926
921
|
return d;
|
|
927
922
|
},
|
|
928
923
|
getFilters: () => {
|
|
929
|
-
const m = h ?
|
|
924
|
+
const m = h ? qe(g()) : {};
|
|
930
925
|
if (i) {
|
|
931
|
-
const d = Array.from(a.entries()).reduce((y, [E, S]) => (y[E] =
|
|
926
|
+
const d = Array.from(a.entries()).reduce((y, [E, S]) => (y[E] = me(S), y), {});
|
|
932
927
|
return {
|
|
933
928
|
...m,
|
|
934
929
|
...d
|
|
@@ -942,14 +937,14 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
942
937
|
handleFilter: (m, d) => (y, E) => {
|
|
943
938
|
if (E || Array.isArray(E) && E.length === 0) {
|
|
944
939
|
const S = d || "value", I = typeof E == "object" && S in E ? E[S] : E;
|
|
945
|
-
|
|
940
|
+
w(m, I);
|
|
946
941
|
return;
|
|
947
942
|
}
|
|
948
|
-
|
|
943
|
+
w(m, void 0);
|
|
949
944
|
},
|
|
950
|
-
setFilter:
|
|
945
|
+
setFilter: w
|
|
951
946
|
};
|
|
952
|
-
},
|
|
947
|
+
}, we = () => document.getElementById(ce), vt = () => {
|
|
953
948
|
const [e, t] = L(() => !!window.HubSpotConversations);
|
|
954
949
|
P(() => {
|
|
955
950
|
if (window.HubSpotConversations) {
|
|
@@ -959,15 +954,15 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
959
954
|
window.hsConversationsOnReady = [() => t(!0)];
|
|
960
955
|
}, []), P(() => {
|
|
961
956
|
e && window.HubSpotConversations?.on("widgetClosed", () => {
|
|
962
|
-
|
|
957
|
+
we()?.classList.remove(z);
|
|
963
958
|
});
|
|
964
959
|
}, [e]);
|
|
965
|
-
const n =
|
|
966
|
-
const o = window.HubSpotConversations, s =
|
|
960
|
+
const n = C(() => {
|
|
961
|
+
const o = window.HubSpotConversations, s = we();
|
|
967
962
|
o && s && (s.classList.contains(z) ? (o.widget.close(), s.classList.remove(z)) : (s.classList.add(z), o.widget.open()));
|
|
968
963
|
}, []);
|
|
969
964
|
return { isAvailable: e, toggle: n };
|
|
970
|
-
},
|
|
965
|
+
}, Et = ({
|
|
971
966
|
data: e,
|
|
972
967
|
fetchNextPage: t,
|
|
973
968
|
isFetchingNextPage: n,
|
|
@@ -975,12 +970,12 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
975
970
|
isLoading: s,
|
|
976
971
|
enabled: a = !0
|
|
977
972
|
}) => {
|
|
978
|
-
const c =
|
|
973
|
+
const c = C(
|
|
979
974
|
async (u) => {
|
|
980
975
|
n || !a || await t({ pageParam: u?.pageParam || u.visibleRowsCount });
|
|
981
976
|
},
|
|
982
977
|
[a, t, n]
|
|
983
|
-
), l =
|
|
978
|
+
), l = le(() => {
|
|
984
979
|
if (e)
|
|
985
980
|
return e.pages.reduce((u, p) => [...u, ...p], []);
|
|
986
981
|
}, [e]);
|
|
@@ -990,8 +985,8 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
990
985
|
loadingVariant: o ? "skeleton" : "linear-progress",
|
|
991
986
|
rows: l
|
|
992
987
|
};
|
|
993
|
-
},
|
|
994
|
-
const { libraries: t } = O(x), n = e?.i18 || t?.i18, o = e?.i18?.translateFunction || t?.i18?.translateFunction, s = n?.i18next?.t || o || ((p) => p), { unknownErrorTranslationKey: a = "error.unknownError" } = e || {}, c = s(a), l =
|
|
988
|
+
}, Rt = (e) => {
|
|
989
|
+
const { libraries: t } = O(x), n = e?.i18 || t?.i18, o = e?.i18?.translateFunction || t?.i18?.translateFunction, s = n?.i18next?.t || o || ((p) => p), { unknownErrorTranslationKey: a = "error.unknownError" } = e || {}, c = s(a), l = C(
|
|
995
990
|
(p) => {
|
|
996
991
|
if (p && typeof p == "object" && "response" in p) {
|
|
997
992
|
const { response: i } = p || {};
|
|
@@ -1014,38 +1009,48 @@ const Ze = ({ IMaskMixin: e, ...t }) => {
|
|
|
1014
1009
|
},
|
|
1015
1010
|
[c]
|
|
1016
1011
|
);
|
|
1017
|
-
return { getErrorCode:
|
|
1012
|
+
return { getErrorCode: C((p) => {
|
|
1018
1013
|
const { response: i } = p || {};
|
|
1019
1014
|
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";
|
|
1020
1015
|
}, []), printError: l };
|
|
1021
|
-
}
|
|
1016
|
+
}, q = "chunk-reload", _t = (e) => Se(async () => {
|
|
1017
|
+
try {
|
|
1018
|
+
const t = await e();
|
|
1019
|
+
return sessionStorage.removeItem(q), t;
|
|
1020
|
+
} catch {
|
|
1021
|
+
if (!sessionStorage.getItem(q))
|
|
1022
|
+
return sessionStorage.setItem(q, "1"), window.location.reload(), { default: () => null };
|
|
1023
|
+
throw sessionStorage.removeItem(q), new Error("Chunk loading failed after reload");
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1022
1026
|
export {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1027
|
+
Ae as ChatClient,
|
|
1028
|
+
Ee as ChatContext,
|
|
1029
|
+
ft as ChatProvider,
|
|
1030
|
+
nt as GTMSendPageView,
|
|
1031
|
+
ot as InitializeAxiosConfig,
|
|
1032
|
+
st as InitializeDaysJSConfig,
|
|
1033
|
+
at as InitializeHubSpot,
|
|
1034
|
+
it as InitializeI18nConfig,
|
|
1035
|
+
ct as InitializeSentryConfig,
|
|
1032
1036
|
x as InjectDependenciesContext,
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
vt as
|
|
1049
|
-
|
|
1050
|
-
|
|
1037
|
+
rt as InjectDependenciesProvider,
|
|
1038
|
+
tt as MaskTextField,
|
|
1039
|
+
lt as PreloadErrorHandler,
|
|
1040
|
+
pt as QueryProvider,
|
|
1041
|
+
ut as RequireAuth,
|
|
1042
|
+
et as axiosCustomInstance,
|
|
1043
|
+
Ve as dateAdapter,
|
|
1044
|
+
Qe as distanceAdapter,
|
|
1045
|
+
dt as getOrvalConfig,
|
|
1046
|
+
_t as lazyWithRetry,
|
|
1047
|
+
ht as useAdapter,
|
|
1048
|
+
gt as useAuth,
|
|
1049
|
+
mt as useChat,
|
|
1050
|
+
yt as useCurrentLanguage,
|
|
1051
|
+
wt as useFilters,
|
|
1052
|
+
vt as useHubSpot,
|
|
1053
|
+
Et as useInfiniteDataGrid,
|
|
1054
|
+
Rt as useResponseError,
|
|
1055
|
+
Je as worksiteNameAdapter
|
|
1051
1056
|
};
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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,l){"use strict";const
|
|
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,l){"use strict";const ve=(e,t)=>{const r=L.CancelToken.source(),o=L({...e,...t,cancelToken:r.token}).then(({data:s})=>s);return o.cancel=()=>{r.cancel("Query was cancelled")},o},Z=e=>Array.isArray(e)?e.map(Z):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,r])=>[t.replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),Z(r)])):e,q=e=>Array.isArray(e)?e.map(q):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,r])=>[t.replace(/[A-Z]/g,o=>`_${o.toLowerCase()}`),q(r)])):e;class ce{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("?")?"&":"?",o=`${this.url}${r}token=${t}`;this.ws=new WebSocket(o),this.ws.onopen=()=>{this._connected=!0,this.reconnectAttempt=0,this.onConnectionChange?.(!0),this.rejoinThreads(),this.flushPendingMessages()},this.ws.onmessage=s=>{try{const a=JSON.parse(s.data),c=Z(a);c.type==="ready"&&(this._ready=!0),this.onEvent?.(c)}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(q(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 G={exports:{}},F={};var le;function we(){if(le)return F;le=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(o,s,a){var c=null;if(a!==void 0&&(c=""+a),s.key!==void 0&&(c=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:e,type:o,key:c,ref:s!==void 0?s:null,props:a}}return F.Fragment=t,F.jsx=r,F.jsxs=r,F}var D={};var ue;function Ce(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&(function(){function e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===oe?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case k:return"Fragment";case f:return"Profiler";case E:return"StrictMode";case N:return"Suspense";case te:return"SuspenseList";case re: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 A:return"Portal";case b:return n.displayName||"Context";case v:return(n._context.displayName||"Context")+".Consumer";case T:var h=n.render;return n=n.displayName,n||(n=h.displayName||h.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ne: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 S=h.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return S.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 o(n){if(n===k)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===z)return"<...>";try{var h=e(n);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function s(){var n=U.A;return n===null?null:n.getOwner()}function a(){return Error("react-stack-top-frame")}function c(n){if(Q.call(n,"key")){var h=Object.getOwnPropertyDescriptor(n,"key").get;if(h&&h.isReactWarning)return!1}return n.key!==void 0}function u(n,h){function S(){C||(C=!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))}S.isReactWarning=!0,Object.defineProperty(n,"key",{get:S,configurable:!0})}function d(){var n=e(this.type);return O[n]||(O[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,S,R,X,ae){var _=S.ref;return n={$$typeof:P,type:n,key:h,props:S,_owner:R},(_!==void 0?_:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:d}):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:X}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ae}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function i(n,h,S,R,X,ae){var _=h.children;if(_!==void 0)if(R)if(se(_)){for(R=0;R<_.length;R++)m(_[R]);Object.freeze&&Object.freeze(_)}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(_);if(Q.call(h,"key")){_=e(n);var x=Object.keys(h).filter(function(ut){return ut!=="key"});R=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",K[_+R]||(x=0<x.length?"{"+x.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} />`,
|
|
7
|
-
div#${
|
|
8
|
-
div#${
|
|
9
|
-
`,document.head.appendChild(t);const r=document.createElement("script");return r.id="hs-script-loader",r.src=`//js-eu1.hs-scripts.com/${e}.js`,r.async=!0,r.defer=!0,document.body.appendChild(r),()=>{t.remove(),r.remove()}},[e]),null),je=({debug:e,resources:t,...r})=>{const{libraries:o}=l.useContext(j),s=r?.i18||o?.i18,{i18next:a,initReactI18next:c,languageDetector:u}=s||{};if(M)return null;if(!s)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return a?.isInitialized||(a.use(u).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",d=>{document.documentElement.setAttribute("lang",d)})),null},Pe=({dsn:e,integrations:t,tracesSampleRate:r,replaysSessionSampleRate:o,replaysOnErrorSampleRate:s,tracePropagationTargets:a,ignoreErrors:c,debug:u,environment:d,release:p,...i})=>{const{libraries:m}=l.useContext(j),y=i?.sentry||m?.sentry,w=i?.reactRouter||m?.reactRouter;if(!y)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!w)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(y.isInitialized())return null;const{createRoutesFromChildren:P,matchRoutes:A,useLocation:k,useNavigationType:E}=w;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&y.init({debug:u,dsn:e,environment:d||"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:[y.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:P,matchRoutes:A,useEffect:l.useEffect,useLocation:k,useNavigationType:E}),...t||[]],release:p,replaysOnErrorSampleRate:s||1,replaysSessionSampleRate:o||.1,tracePropagationTargets:a,tracesSampleRate:r||1}),null},Oe=()=>(l.useEffect(()=>{if(M)return;const e=t=>{try{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),sessionStorage.getItem("vite:preloadError:reloaded")||(sessionStorage.setItem("vite:preloadError:reloaded","true"),window.location.reload())}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),de=new WeakMap,Ie="user",Ne=({Fallback:e,isLogged:t,loginPath:r="/login",redirect401Path:o="/login",...s})=>{const{libraries:a,localStorageKeys:c}=l.useContext(j),u=s?.reactRouter||a?.reactRouter,d=s?.axios||a?.axios,p=s?.localStorageKey||c?.user||Ie;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,m]=l.useState(null),{useLocation:y,Navigate:w,Outlet:P}=u,A=y(),k=typeof t=="function"?t():!!t,E=typeof k=="boolean"?k:k?.isLogged;return l.useEffect(()=>{de.has(d)||(de.set(d,!0),d.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&&(d.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(p)),m(o)),Promise.reject(f))))},[d,p,o]),E&&!i?I.jsx(l.Suspense,{fallback:e,children:A.state?.from?.state&&A.state?.from?.pathname===r?I.jsx(w,{to:A.state.from.state.from.pathname+A.state.from.state.from.search,replace:!0}):I.jsx(P,{})}):I.jsx(w,{to:r+A.search,state:{from:A},replace:!0})},Le=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),xe=e=>{const t=e.split(/[/\\]/).pop()||"";return t.substring(0,t.lastIndexOf("."))},Fe=e=>{const o=e.split("/").filter(s=>s.length>0).map(s=>s.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join("")).join("");return o.charAt(0).toLowerCase()+o.slice(1)},De=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Me=(e,t,r,o)=>{const s=Fe(t),a=Le(r),c=`${s}${a}`;return e&&typeof e=="object"&&"operationId"in e&&o?.includes(String(e.operationId))?`${c}AsQuery`:c},Ye=(e,t)=>{const r={};return e?.forEach(o=>{r[o]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),t?.filter(o=>!r[o]).forEach(o=>{r[o]={query:{useQuery:!0}}}),Object.keys(r).length?r:void 0},ze=e=>(Array.isArray(e)?e:[e]).reduce((r,o)=>{const{output:s,useInfiniteIds:a,useQueryIds:c,input:u="./openapi.json",customAxiosInstancePath:d,overrideApiName:p}=o||{},i=p||De(u),m=d||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...r,[i]:{input:u,output:{baseUrl:s?.baseUrl,client:"react-query",mode:"tags-split",override:{...(a?.length||c?.length)&&{operations:Ye(a,c)},header:y=>["Generated by orval 🍺",...y.title?[y.title]:[],...y.description?[y.description]:[]],mutator:{name:xe(m),path:m},operationName:(y,w,P)=>Me(y,w,P,c),query:{useQuery:!0}},schemas:s?.schemas||`src/api/${i}/model`,target:s?.target||`src/api/${i}/services/api.ts`,...s}}}},{}),Ue="user",We={client:"/v2/threads/ws",supplier:"/v1/threads/ws"},Ge=(e,t)=>{const r=e.startsWith("https")?"wss":"ws",o=e.replace(/^https?:\/\//,"");return`${r}://${o}${t}`},Ve=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t)?.accessToken??null:null}catch{return null}},$=l.createContext(null),He=({children:e,token:t,url:r,wsPath:o,reconnect:s=!0,enabled:a=!0,context:c="client"})=>{const[u,d]=l.useState(!1),[p,i]=l.useState(!1),[m,y]=l.useState(0),[w,P]=l.useState(a),A=a&&w,{apiURL:k,localStorageKeys:E}=l.useContext(j),f=E?.user||Ue,v=l.useRef(null),b=l.useRef(new Set);l.useEffect(()=>{if(!A)return;const C=o??We[c],O=r||(k?Ge(k,C):null);if(!O)return;const Q=()=>t??Ve(f),J=n=>{n.type==="ready"&&(i(!0),y(n.unreadCount??0));for(const h of b.current)h(n)},B=setTimeout(()=>{const n=new ie({getToken:Q,onConnectionChange:h=>{d(h),h||i(!1)},onEvent:J,reconnect:s,url:O});v.current=n,n.connect()},0);return()=>{clearTimeout(B),v.current?.disconnect(),v.current=null}},[A,r,o,c,t,s,k,f]);const T=l.useCallback(C=>{v.current?.joinThread(C)},[]),N=l.useCallback(C=>{v.current?.leaveThread(C)},[]),ee=l.useCallback((C,O)=>{v.current?.sendMessage(C,O)},[]),te=l.useCallback(C=>{v.current?.markRead(C)},[]),z=l.useCallback((C,O)=>{v.current?.listThreads(C,O)},[]),ne=l.useCallback((C=1)=>{y(O=>O+C)},[]),re=l.useCallback((C=1)=>{y(O=>Math.max(0,O-C))},[]),U=l.useCallback(()=>{v.current?.disconnect(),v.current=null},[]),H=l.useCallback(C=>{P(C)},[]),oe=l.useCallback(C=>(b.current.add(C),()=>{b.current.delete(C)}),[]),W={decrementUnreadCount:re,disconnect:U,incrementUnreadCount:ne,isConnected:u,isReady:p,joinThread:T,leaveThread:N,listThreads:z,markRead:te,sendMessage:ee,setEnabled:H,subscribe:oe,unreadCount:m};return I.jsx($.Provider,{value:W,children:e})},Qe=e=>e&&typeof e=="function",Je=e=>e&&typeof e=="function",Be=({children:e,defaultQueriesOptions:t,defaultMutationsOptions:r,...o})=>{const{libraries:s}=l.useContext(j),a=o?.QueryClient||s?.reactQuery?.QueryClient,c=o?.QueryClientProvider||s?.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(!Qe(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Je(a))throw new Error("Provided QueryClient dependencies are not valid.");const u=new a({defaultOptions:{mutations:{...r},queries:{getNextPageParam:(d,p,i)=>d.length+(i||0),refetchOnWindowFocus:!1,retry:3,...t}}});return I.jsx(c,{client:u,children:e})},fe=({library:e,date:t,format:r="ll"})=>e(t).format(r),he=(e,t)=>{const{fractionDigits:r=0,metric:o="km",spacingBetween:s=!0}=t||{},a=Number(e),c=s?" ":"";return Number.isNaN(a)?`0${c}${o}`:`${a.toFixed(r)}${c}${o}`},pe=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(r=>r.length>0?r.charAt(0).toUpperCase()+r.slice(1):r).join(" "),Ke=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Xe=({path:e,size:t,apiURL:r})=>{if(!e)return"";const o=Ke(e),s=`${r}${o}`,a=s.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof t=="number"&&a?`${s.replace("/files",`/thumbs/${t}`)}`:s},Ze=e=>{const{apiURL:t,libraries:r}=l.useContext(j),o=e?.dayjs||r?.dayjs;return{dateAdapter:(c,u)=>{if(!o)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return fe({date:c,format:u,library:o})},distanceAdapter:he,filePathAdapter:(c,u)=>{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:Xe({apiURL:t,path:c,size:u})},worksiteNameAdapter:pe}},qe=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(j),o=e?.axios||t?.axios,s=e?.localStorageKey||r?.user||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=l.useCallback(({tokenType:u,accessToken:d})=>{o.defaults.headers.common.Authorization=`${u} ${d}`},[o.defaults.headers.common]),c=()=>{o.defaults.headers.common.Authorization=null};return l.useEffect(()=>{if(M)return;const u=({newValue:d,key:p})=>{if(p===s&&d)try{const{accessToken:i,tokenType:m}=JSON.parse(d);a({accessToken:i,tokenType:m})}catch(i){console.error("Failed to parse newValue from localStorage:",i)}};return window.addEventListener("storage",u),()=>{window.removeEventListener("storage",u)}},[s,a]),{clearAuthenticationToken:c,setAuthenticationToken:a}},$e=e=>{const t=l.useContext($);if(!t)throw new Error("useChat must be used within ChatProvider");const{subscribe:r,setEnabled:o,...s}=t,a=l.useRef(e);return a.current=e,l.useEffect(()=>{e?.enabled!==void 0&&o(e.enabled)},[e?.enabled,o]),l.useEffect(()=>r(c=>{const{onReady:u,onNewMessage:d,onNewMessageNotification:p,onPresence:i,onError:m,onJoinedThread:y,onLeftThread:w,onMarkedRead:P,onThreadArchived:A,onThreadsList:k}=a.current??{};switch(c.type){case"ready":u?.(c);break;case"new_message":d?.(c);break;case"new_message_notification":p?.(c);break;case"presence":i?.(c);break;case"error":m?.(c);break;case"joined_thread":y?.(c);break;case"left_thread":w?.(c);break;case"marked_read":P?.(c);break;case"thread_archived":A?.(c);break;case"threads_list":k?.(c);break}}),[r]),s},V=(e,t)=>t==="short"?e.split("-")[0]:e,et=(e,t="full")=>{const[r,o]=l.useState(()=>{const s=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,V(s,t)});return l.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&o(V(e.language,t));const s=a=>{o(V(a,t))};return e?.on?.("languageChanged",s),()=>{e?.off?.("languageChanged",s)}},[e,t]),r},tt="tracktor.filter",nt={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},ge=e=>{try{return JSON.parse(e)}catch{return e}},me=(e,t,r)=>`${r}_${e}=>${t}`,rt=e=>e.reduce((t,r)=>{const o=localStorage.getItem(r);if(o)try{const s=JSON.parse(o),a=Object.keys(s)?.[0];a&&(t[a]=Object.values(s)?.[0])}catch{}return t},{}),ot=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(j),o=e?.reactRouter||t?.reactRouter,{pathname:s}=o?.useLocation?.()??{pathname:"/"},[a,c]=o?.useSearchParams?.()??[new URLSearchParams,()=>{}],[u,d]=l.useState({}),p=r?.filter||tt,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl,m=e?.persistToLocalStorage===void 0?!0:e?.persistToLocalStorage;if(M)return nt;if(!o)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const y=()=>Object.keys(localStorage).filter(E=>E.startsWith(p)&&E.endsWith(e?.pathname||s)),w=(E,f,v=!0)=>{const b=me(E,e?.pathname||s,p);if(!f||Array.isArray(f)&&!f.length){i?(a.delete(E),c(a)):d(T=>{const N={...T};return delete N[E],N}),m&&localStorage.removeItem(b);return}m&&v&&f&&localStorage.setItem(b,JSON.stringify({...a,[E]:f})),i&&f?(a.set(E,JSON.stringify(f)),c(a)):!i&&f&&d(T=>({...T,[E]:f}))};return{getFilter:(E,f)=>{if(i){const v=a.get(E);if(v)return ge(v)}else{const v=u[E];if(v!==void 0)return v}if(m){const v=me(E,e?.pathname||s,p),b=localStorage.getItem(v);if(b)try{const T=JSON.parse(b)[E];return!i&&T!==void 0&&d(N=>({...N,[E]:T})),T}catch{}}return f},getFilters:()=>{const E=m?rt(y()):{};if(i){const f=Array.from(a.entries()).reduce((v,[b,T])=>(v[b]=ge(T),v),{});return{...E,...f}}return{...E,...u}},handleFilter:(E,f)=>(v,b)=>{if(b||Array.isArray(b)&&b.length===0){const T=f||"value",N=typeof b=="object"&&T in b?b[T]:b;w(E,N);return}w(E,void 0)},setFilter:w}},ye=()=>document.getElementById(q),st=()=>{const[e,t]=l.useState(()=>!!window.HubSpotConversations);l.useEffect(()=>{if(window.HubSpotConversations){t(!0);return}window.hsConversationsOnReady=[()=>t(!0)]},[]),l.useEffect(()=>{e&&window.HubSpotConversations?.on("widgetClosed",()=>{ye()?.classList.remove(Y)})},[e]);const r=l.useCallback(()=>{const o=window.HubSpotConversations,s=ye();o&&s&&(s.classList.contains(Y)?(o.widget.close(),s.classList.remove(Y)):(s.classList.add(Y),o.widget.open()))},[]);return{isAvailable:e,toggle:r}},at=({data:e,fetchNextPage:t,isFetchingNextPage:r,isInitialLoading:o,isLoading:s,enabled:a=!0})=>{const c=l.useCallback(async d=>{r||!a||await t({pageParam:d?.pageParam||d.visibleRowsCount})},[a,t,r]),u=l.useMemo(()=>{if(e)return e.pages.reduce((d,p)=>[...d,...p],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:r||s,loadingVariant:o?"skeleton":"linear-progress",rows:u}},it=e=>{const{libraries:t}=l.useContext(j),r=e?.i18||t?.i18,o=e?.i18?.translateFunction||t?.i18?.translateFunction,s=r?.i18next?.t||o||(p=>p),{unknownErrorTranslationKey:a="error.unknownError"}=e||{},c=s(a),u=l.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:y}=m[0];if(typeof y=="string")return String(y)}}}return p instanceof Error?p.message:c},[c]);return{getErrorCode:l.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:u}};g.ChatClient=ie,g.ChatContext=$,g.ChatProvider=He,g.GTMSendPageView=Se,g.InitializeAxiosConfig=Te,g.InitializeDaysJSConfig=Ae,g.InitializeHubSpot=ke,g.InitializeI18nConfig=je,g.InitializeSentryConfig=Pe,g.InjectDependenciesContext=j,g.InjectDependenciesProvider=_e,g.MaskTextField=be,g.PreloadErrorHandler=Oe,g.QueryClientProviderWithConfig=Be,g.RequireAuth=Ne,g.axiosCustomInstance=Ee,g.dateAdapter=fe,g.distanceAdapter=he,g.getOrvalConfig=ze,g.useAdapter=Ze,g.useAuth=qe,g.useChat=$e,g.useCurrentLanguage=et,g.useFilters=ot,g.useHubSpot=st,g.useInfiniteDataGrid=at,g.useResponseError=it,g.worksiteNameAdapter=pe,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,R,_,x,_),K[_+R]=!0)}if(_=null,S!==void 0&&(r(S),_=""+S),c(h)&&(r(h.key),_=""+h.key),"key"in h){S={};for(var ie in h)ie!=="key"&&(S[ie]=h[ie])}else S=h;return _&&u(S,typeof n=="function"?n.displayName||n.name||"Unknown":n),p(n,_,S,s(),X,ae)}function m(n){y(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===z&&(n._payload.status==="fulfilled"?y(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function y(n){return typeof n=="object"&&n!==null&&n.$$typeof===P}var w=l,P=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),b=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),oe=Symbol.for("react.client.reference"),U=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=Object.prototype.hasOwnProperty,se=Array.isArray,W=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(n){return n()}};var C,O={},J=w.react_stack_bottom_frame.bind(w,a)(),B=W(o(a)),K={};D.Fragment=k,D.jsx=function(n,h,S){var R=1e4>U.recentlyCreatedOwnerStacks++;return i(n,h,S,!1,R?Error("react-stack-top-frame"):J,R?W(o(n)):B)},D.jsxs=function(n,h,S){var R=1e4>U.recentlyCreatedOwnerStacks++;return i(n,h,S,!0,R?Error("react-stack-top-frame"):J,R?W(o(n)):B)}})()),D}var de;function be(){return de||(de=1,process.env.NODE_ENV==="production"?G.exports=we():G.exports=Ce()),G.exports}var I=be();const Se=({IMaskMixin:e,...t})=>{const r=l.useMemo(()=>e(({TextField:o,...s})=>I.jsx(o,{...s})),[e]);return I.jsx(r,{...t})},j=l.createContext({}),Re=({children:e,apiURL:t,libraries:r,localStorageKeys:o})=>{const s=l.useMemo(()=>({apiURL:t,libraries:r,localStorageKeys:o}),[t,r,o]);return I.jsx(j.Provider,{value:s,children:e})},_e=({data:e,...t})=>{const{libraries:r}=l.useContext(j),o=t?.reactRouter||r?.reactRouter,s=t?.gtm||r?.gtm;if(!o)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!s)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:a}=s,{useLocation:c,Outlet:u}=o,{pathname:d}=c(),{sendEvent:p}=a();return l.useEffect(()=>{p({event:"pageView",pathname:d,...e})},[e,d,p]),I.jsx(u,{})},M=(()=>{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}})(),Te="user",Ae=({tokenTypeKey:e="tokenType",tokenKey:t="accessToken",postContentType:r="application/json",...o})=>{const{apiURL:s=o.apiURL,libraries:a,localStorageKeys:c}=l.useContext(j),u=o?.userLocalStorageKey||c?.user||Te,d=o?.axios||a?.axios;if(!d)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!d?.defaults||M)return null;if(typeof window<"u"&&window.localStorage){const p=localStorage.getItem(u),i=p?JSON.parse(p):null,m=i?.[e]?i[e]:null,y=i?.[t]?i[t]:null,w=p?`${m} ${y}`:null;w&&(d.defaults.headers.common.Authorization=w)}return d.defaults.baseURL=s,d.defaults.headers.post["Content-Type"]=r,null},ke=({language:e,...t})=>{const{libraries:r}=l.useContext(j),o=t?.dayjs||r?.dayjs,s=t?.plugin||r?.dayjsPlugin;if(!o)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return l.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";o.extend(t.localizedFormat),s&&s.forEach(u=>{u&&o.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),o.locale(c)})().then()},[o,s,e,t.localizedFormat]),null},$="hubspot-messages-iframe-container",Y="hs-show",je=({hubId:e})=>(l.useEffect(()=>{if(!e)return;const t=document.createElement("style");t.textContent=`
|
|
7
|
+
div#${$} { display: none !important; }
|
|
8
|
+
div#${$}.${Y} { display: initial !important; }
|
|
9
|
+
`,document.head.appendChild(t);const r=document.createElement("script");return r.id="hs-script-loader",r.src=`//js-eu1.hs-scripts.com/${e}.js`,r.async=!0,r.defer=!0,document.body.appendChild(r),()=>{t.remove(),r.remove()}},[e]),null),Pe=({debug:e,resources:t,...r})=>{const{libraries:o}=l.useContext(j),s=r?.i18||o?.i18,{i18next:a,initReactI18next:c,languageDetector:u}=s||{};if(M)return null;if(!s)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return a?.isInitialized||(a.use(u).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",d=>{document.documentElement.setAttribute("lang",d)})),null},Oe=({dsn:e,integrations:t,tracesSampleRate:r,replaysSessionSampleRate:o,replaysOnErrorSampleRate:s,tracePropagationTargets:a,ignoreErrors:c,debug:u,environment:d,release:p,...i})=>{const{libraries:m}=l.useContext(j),y=i?.sentry||m?.sentry,w=i?.reactRouter||m?.reactRouter;if(!y)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!w)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(y.isInitialized())return null;const{createRoutesFromChildren:P,matchRoutes:A,useLocation:k,useNavigationType:E}=w;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&y.init({debug:u,dsn:e,environment:d||"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:[y.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:P,matchRoutes:A,useEffect:l.useEffect,useLocation:k,useNavigationType:E}),...t||[]],release:p,replaysOnErrorSampleRate:s||1,replaysSessionSampleRate:o||.1,tracePropagationTargets:a,tracesSampleRate:r||1}),null},Ie=()=>(l.useEffect(()=>{if(M)return;const e=t=>{try{t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),sessionStorage.getItem("vite:preloadError:reloaded")||(sessionStorage.setItem("vite:preloadError:reloaded","true"),window.location.reload())}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),fe=new WeakMap,Ne="user",Le=({Fallback:e,isLogged:t,loginPath:r="/login",redirect401Path:o="/login",...s})=>{const{libraries:a,localStorageKeys:c}=l.useContext(j),u=s?.reactRouter||a?.reactRouter,d=s?.axios||a?.axios,p=s?.localStorageKey||c?.user||Ne;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[i,m]=l.useState(null),{useLocation:y,Navigate:w,Outlet:P}=u,A=y(),k=typeof t=="function"?t():!!t,E=typeof k=="boolean"?k:k?.isLogged;return l.useEffect(()=>{fe.has(d)||(fe.set(d,!0),d.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&&(d.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(p)),m(o)),Promise.reject(f))))},[d,p,o]),E&&!i?I.jsx(l.Suspense,{fallback:e,children:A.state?.from?.state&&A.state?.from?.pathname===r?I.jsx(w,{to:A.state.from.state.from.pathname+A.state.from.state.from.search,replace:!0}):I.jsx(P,{})}):I.jsx(w,{to:r+A.search,state:{from:A},replace:!0})},xe=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Fe=e=>{const t=e.split(/[/\\]/).pop()||"";return t.substring(0,t.lastIndexOf("."))},De=e=>{const o=e.split("/").filter(s=>s.length>0).map(s=>s.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join("")).join("");return o.charAt(0).toLowerCase()+o.slice(1)},Me=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Ye=(e,t,r,o)=>{const s=De(t),a=xe(r),c=`${s}${a}`;return e&&typeof e=="object"&&"operationId"in e&&o?.includes(String(e.operationId))?`${c}AsQuery`:c},ze=(e,t)=>{const r={};return e?.forEach(o=>{r[o]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),t?.filter(o=>!r[o]).forEach(o=>{r[o]={query:{useQuery:!0}}}),Object.keys(r).length?r:void 0},Ue=e=>(Array.isArray(e)?e:[e]).reduce((r,o)=>{const{output:s,useInfiniteIds:a,useQueryIds:c,input:u="./openapi.json",customAxiosInstancePath:d,overrideApiName:p}=o||{},i=p||Me(u),m=d||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...r,[i]:{input:u,output:{baseUrl:s?.baseUrl,client:"react-query",mode:"tags-split",override:{...(a?.length||c?.length)&&{operations:ze(a,c)},header:y=>["Generated by orval 🍺",...y.title?[y.title]:[],...y.description?[y.description]:[]],mutator:{name:Fe(m),path:m},operationName:(y,w,P)=>Ye(y,w,P,c),query:{useQuery:!0}},schemas:s?.schemas||`src/api/${i}/model`,target:s?.target||`src/api/${i}/services/api.ts`,...s}}}},{}),We="user",Ge={client:"/v2/threads/ws",supplier:"/v1/threads/ws"},Ve=(e,t)=>{const r=e.startsWith("https")?"wss":"ws",o=e.replace(/^https?:\/\//,"");return`${r}://${o}${t}`},He=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t)?.accessToken??null:null}catch{return null}},ee=l.createContext(null),Qe=({children:e,token:t,url:r,wsPath:o,reconnect:s=!0,enabled:a=!0,context:c="client"})=>{const[u,d]=l.useState(!1),[p,i]=l.useState(!1),[m,y]=l.useState(0),[w,P]=l.useState(a),A=a&&w,{apiURL:k,localStorageKeys:E}=l.useContext(j),f=E?.user||We,v=l.useRef(null),b=l.useRef(new Set);l.useEffect(()=>{if(!A)return;const C=o??Ge[c],O=r||(k?Ve(k,C):null);if(!O)return;const J=()=>t??He(f),B=n=>{n.type==="ready"&&(i(!0),y(n.unreadCount??0));for(const h of b.current)h(n)},K=setTimeout(()=>{const n=new ce({getToken:J,onConnectionChange:h=>{d(h),h||i(!1)},onEvent:B,reconnect:s,url:O});v.current=n,n.connect()},0);return()=>{clearTimeout(K),v.current?.disconnect(),v.current=null}},[A,r,o,c,t,s,k,f]);const T=l.useCallback(C=>{v.current?.joinThread(C)},[]),N=l.useCallback(C=>{v.current?.leaveThread(C)},[]),te=l.useCallback((C,O)=>{v.current?.sendMessage(C,O)},[]),ne=l.useCallback(C=>{v.current?.markRead(C)},[]),z=l.useCallback((C,O)=>{v.current?.listThreads(C,O)},[]),re=l.useCallback((C=1)=>{y(O=>O+C)},[]),oe=l.useCallback((C=1)=>{y(O=>Math.max(0,O-C))},[]),U=l.useCallback(()=>{v.current?.disconnect(),v.current=null},[]),Q=l.useCallback(C=>{P(C)},[]),se=l.useCallback(C=>(b.current.add(C),()=>{b.current.delete(C)}),[]),W={decrementUnreadCount:oe,disconnect:U,incrementUnreadCount:re,isConnected:u,isReady:p,joinThread:T,leaveThread:N,listThreads:z,markRead:ne,sendMessage:te,setEnabled:Q,subscribe:se,unreadCount:m};return I.jsx(ee.Provider,{value:W,children:e})},Je=e=>e&&typeof e=="function",Be=e=>e&&typeof e=="function",Ke=({children:e,defaultQueriesOptions:t,defaultMutationsOptions:r,...o})=>{const{libraries:s}=l.useContext(j),a=o?.QueryClient||s?.reactQuery?.QueryClient,c=o?.QueryClientProvider||s?.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(!Je(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Be(a))throw new Error("Provided QueryClient dependencies are not valid.");const u=l.useRef(null);return u.current||(u.current=new a({defaultOptions:{mutations:{...r},queries:{getNextPageParam:(d,p,i)=>d.length+(i||0),refetchOnWindowFocus:!1,retry:3,...t}}})),I.jsx(c,{client:u.current,children:e})},he=({library:e,date:t,format:r="ll"})=>e(t).format(r),pe=(e,t)=>{const{fractionDigits:r=0,metric:o="km",spacingBetween:s=!0}=t||{},a=Number(e),c=s?" ":"";return Number.isNaN(a)?`0${c}${o}`:`${a.toFixed(r)}${c}${o}`},ge=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(r=>r.length>0?r.charAt(0).toUpperCase()+r.slice(1):r).join(" "),Xe=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Ze=({path:e,size:t,apiURL:r})=>{if(!e)return"";const o=Xe(e),s=`${r}${o}`,a=s.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof t=="number"&&a?`${s.replace("/files",`/thumbs/${t}`)}`:s},qe=e=>{const{apiURL:t,libraries:r}=l.useContext(j),o=e?.dayjs||r?.dayjs;return{dateAdapter:(c,u)=>{if(!o)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return he({date:c,format:u,library:o})},distanceAdapter:pe,filePathAdapter:(c,u)=>{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:Ze({apiURL:t,path:c,size:u})},worksiteNameAdapter:ge}},$e=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(j),o=e?.axios||t?.axios,s=e?.localStorageKey||r?.user||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=l.useCallback(({tokenType:u,accessToken:d})=>{o.defaults.headers.common.Authorization=`${u} ${d}`},[o.defaults.headers.common]),c=()=>{o.defaults.headers.common.Authorization=null};return l.useEffect(()=>{if(M)return;const u=({newValue:d,key:p})=>{if(p===s&&d)try{const{accessToken:i,tokenType:m}=JSON.parse(d);a({accessToken:i,tokenType:m})}catch(i){console.error("Failed to parse newValue from localStorage:",i)}};return window.addEventListener("storage",u),()=>{window.removeEventListener("storage",u)}},[s,a]),{clearAuthenticationToken:c,setAuthenticationToken:a}},et=e=>{const t=l.useContext(ee);if(!t)throw new Error("useChat must be used within ChatProvider");const{subscribe:r,setEnabled:o,...s}=t,a=l.useRef(e);return a.current=e,l.useEffect(()=>{e?.enabled!==void 0&&o(e.enabled)},[e?.enabled,o]),l.useEffect(()=>r(c=>{const{onReady:u,onNewMessage:d,onNewMessageNotification:p,onPresence:i,onError:m,onJoinedThread:y,onLeftThread:w,onMarkedRead:P,onThreadArchived:A,onThreadsList:k}=a.current??{};switch(c.type){case"ready":u?.(c);break;case"new_message":d?.(c);break;case"new_message_notification":p?.(c);break;case"presence":i?.(c);break;case"error":m?.(c);break;case"joined_thread":y?.(c);break;case"left_thread":w?.(c);break;case"marked_read":P?.(c);break;case"thread_archived":A?.(c);break;case"threads_list":k?.(c);break}}),[r]),s},V=(e,t)=>t==="short"?e.split("-")[0]:e,tt=(e,t="full")=>{const[r,o]=l.useState(()=>{const s=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,V(s,t)});return l.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&o(V(e.language,t));const s=a=>{o(V(a,t))};return e?.on?.("languageChanged",s),()=>{e?.off?.("languageChanged",s)}},[e,t]),r},nt="tracktor.filter",rt={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},me=e=>{try{return JSON.parse(e)}catch{return e}},ye=(e,t,r)=>`${r}_${e}=>${t}`,ot=e=>e.reduce((t,r)=>{const o=localStorage.getItem(r);if(o)try{const s=JSON.parse(o),a=Object.keys(s)?.[0];a&&(t[a]=Object.values(s)?.[0])}catch{}return t},{}),st=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(j),o=e?.reactRouter||t?.reactRouter,{pathname:s}=o?.useLocation?.()??{pathname:"/"},[a,c]=o?.useSearchParams?.()??[new URLSearchParams,()=>{}],[u,d]=l.useState({}),p=r?.filter||nt,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl,m=e?.persistToLocalStorage===void 0?!0:e?.persistToLocalStorage;if(M)return rt;if(!o)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const y=()=>Object.keys(localStorage).filter(E=>E.startsWith(p)&&E.endsWith(e?.pathname||s)),w=(E,f,v=!0)=>{const b=ye(E,e?.pathname||s,p);if(!f||Array.isArray(f)&&!f.length){i?(a.delete(E),c(a)):d(T=>{const N={...T};return delete N[E],N}),m&&localStorage.removeItem(b);return}m&&v&&f&&localStorage.setItem(b,JSON.stringify({...a,[E]:f})),i&&f?(a.set(E,JSON.stringify(f)),c(a)):!i&&f&&d(T=>({...T,[E]:f}))};return{getFilter:(E,f)=>{if(i){const v=a.get(E);if(v)return me(v)}else{const v=u[E];if(v!==void 0)return v}if(m){const v=ye(E,e?.pathname||s,p),b=localStorage.getItem(v);if(b)try{const T=JSON.parse(b)[E];return!i&&T!==void 0&&d(N=>({...N,[E]:T})),T}catch{}}return f},getFilters:()=>{const E=m?ot(y()):{};if(i){const f=Array.from(a.entries()).reduce((v,[b,T])=>(v[b]=me(T),v),{});return{...E,...f}}return{...E,...u}},handleFilter:(E,f)=>(v,b)=>{if(b||Array.isArray(b)&&b.length===0){const T=f||"value",N=typeof b=="object"&&T in b?b[T]:b;w(E,N);return}w(E,void 0)},setFilter:w}},Ee=()=>document.getElementById($),at=()=>{const[e,t]=l.useState(()=>!!window.HubSpotConversations);l.useEffect(()=>{if(window.HubSpotConversations){t(!0);return}window.hsConversationsOnReady=[()=>t(!0)]},[]),l.useEffect(()=>{e&&window.HubSpotConversations?.on("widgetClosed",()=>{Ee()?.classList.remove(Y)})},[e]);const r=l.useCallback(()=>{const o=window.HubSpotConversations,s=Ee();o&&s&&(s.classList.contains(Y)?(o.widget.close(),s.classList.remove(Y)):(s.classList.add(Y),o.widget.open()))},[]);return{isAvailable:e,toggle:r}},it=({data:e,fetchNextPage:t,isFetchingNextPage:r,isInitialLoading:o,isLoading:s,enabled:a=!0})=>{const c=l.useCallback(async d=>{r||!a||await t({pageParam:d?.pageParam||d.visibleRowsCount})},[a,t,r]),u=l.useMemo(()=>{if(e)return e.pages.reduce((d,p)=>[...d,...p],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:r||s,loadingVariant:o?"skeleton":"linear-progress",rows:u}},ct=e=>{const{libraries:t}=l.useContext(j),r=e?.i18||t?.i18,o=e?.i18?.translateFunction||t?.i18?.translateFunction,s=r?.i18next?.t||o||(p=>p),{unknownErrorTranslationKey:a="error.unknownError"}=e||{},c=s(a),u=l.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:y}=m[0];if(typeof y=="string")return String(y)}}}return p instanceof Error?p.message:c},[c]);return{getErrorCode:l.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:u}},H="chunk-reload",lt=e=>l.lazy(async()=>{try{const t=await e();return sessionStorage.removeItem(H),t}catch{if(!sessionStorage.getItem(H))return sessionStorage.setItem(H,"1"),window.location.reload(),{default:()=>null};throw sessionStorage.removeItem(H),new Error("Chunk loading failed after reload")}});g.ChatClient=ce,g.ChatContext=ee,g.ChatProvider=Qe,g.GTMSendPageView=_e,g.InitializeAxiosConfig=Ae,g.InitializeDaysJSConfig=ke,g.InitializeHubSpot=je,g.InitializeI18nConfig=Pe,g.InitializeSentryConfig=Oe,g.InjectDependenciesContext=j,g.InjectDependenciesProvider=Re,g.MaskTextField=Se,g.PreloadErrorHandler=Ie,g.QueryProvider=Ke,g.RequireAuth=Le,g.axiosCustomInstance=ve,g.dateAdapter=he,g.distanceAdapter=pe,g.getOrvalConfig=Ue,g.lazyWithRetry=lt,g.useAdapter=qe,g.useAuth=$e,g.useChat=et,g.useCurrentLanguage=tt,g.useFilters=st,g.useHubSpot=at,g.useInfiniteDataGrid=it,g.useResponseError=ct,g.worksiteNameAdapter=ge,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Lazy loader with retry mechanism for dynamic imports. If the import fails, it will attempt to reload the page once and try again.
|
|
4
|
+
* @param importFn
|
|
5
|
+
*/
|
|
6
|
+
declare const lazyWithRetry: (importFn: () => Promise<{
|
|
7
|
+
default: ComponentType<any>;
|
|
8
|
+
}>) => import('react').LazyExoticComponent<ComponentType<any>>;
|
|
9
|
+
export default lazyWithRetry;
|