@tracktor/shared-module 2.25.0 → 2.26.1
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 +0 -4
- package/dist/context/ChatProvider.d.ts +10 -2
- package/dist/hooks/useChat.d.ts +4 -1
- package/dist/main.js +302 -281
- package/dist/main.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/chat/types.d.ts
CHANGED
|
@@ -90,10 +90,6 @@ export interface ChatClientOptions {
|
|
|
90
90
|
reconnectBaseDelay?: number;
|
|
91
91
|
}
|
|
92
92
|
export interface UseChatParams {
|
|
93
|
-
token?: string;
|
|
94
|
-
url?: string;
|
|
95
|
-
enabled?: boolean;
|
|
96
|
-
reconnect?: boolean;
|
|
97
93
|
onReady?: (event: ReadyEvent) => void;
|
|
98
94
|
onNewMessage?: (event: NewMessageEvent) => void;
|
|
99
95
|
onNewMessageNotification?: (event: NewMessageNotification) => void;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ServerEvent } from '../chat/types';
|
|
3
|
+
type EventListener = (event: ServerEvent) => void;
|
|
4
|
+
export interface ChatProviderProps {
|
|
5
|
+
token?: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
reconnect?: boolean;
|
|
9
|
+
}
|
|
3
10
|
export interface ChatContextValue {
|
|
4
11
|
isConnected: boolean;
|
|
5
12
|
isReady: boolean;
|
|
6
13
|
unreadCount: number;
|
|
14
|
+
subscribe: (callback: EventListener) => () => void;
|
|
7
15
|
joinThread: (threadId: string) => void;
|
|
8
16
|
leaveThread: (threadId: string) => void;
|
|
9
17
|
listThreads: (limit?: number, offset?: number) => void;
|
|
@@ -11,5 +19,5 @@ export interface ChatContextValue {
|
|
|
11
19
|
sendMessage: (threadId: string, body: string) => void;
|
|
12
20
|
}
|
|
13
21
|
export declare const ChatContext: import('react').Context<ChatContextValue | null>;
|
|
14
|
-
declare const ChatProvider: ({ children,
|
|
22
|
+
declare const ChatProvider: ({ children, reconnect, enabled, url, token }: PropsWithChildren<ChatProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
15
23
|
export default ChatProvider;
|
package/dist/hooks/useChat.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { UseChatParams } from '../chat/types';
|
|
1
2
|
import { ChatContextValue } from '../context/ChatProvider';
|
|
3
|
+
type UseChatReturn = Omit<ChatContextValue, "subscribe">;
|
|
2
4
|
/**
|
|
3
5
|
* Hook to access the shared WebSocket chat connection.
|
|
4
6
|
* Provides methods to join/leave threads, send messages, mark as read, and list threads.
|
|
7
|
+
* Accepts optional event handlers (onNewMessage, onNewMessageNotification, etc.).
|
|
5
8
|
* Must be used within a ChatProvider.
|
|
6
9
|
*/
|
|
7
|
-
export declare const useChat: () =>
|
|
10
|
+
export declare const useChat: (handlers?: UseChatParams) => UseChatReturn;
|
|
8
11
|
export default useChat;
|
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 H, createContext as fe, useContext as j, useEffect as N, useState as D, Suspense as ye, useRef as B, useCallback as O } from "react";
|
|
3
3
|
const Je = (e, t) => {
|
|
4
4
|
const n = oe.CancelToken.source(), s = oe({
|
|
5
5
|
...e,
|
|
@@ -9,8 +9,8 @@ const Je = (e, t) => {
|
|
|
9
9
|
return s.cancel = () => {
|
|
10
10
|
n.cancel("Query was cancelled");
|
|
11
11
|
}, s;
|
|
12
|
-
},
|
|
13
|
-
class
|
|
12
|
+
}, we = 3e4, se = 1e3;
|
|
13
|
+
class ve {
|
|
14
14
|
url;
|
|
15
15
|
getToken;
|
|
16
16
|
onEvent;
|
|
@@ -64,8 +64,8 @@ class we {
|
|
|
64
64
|
this.joinedThreads.delete(t), this.send({ threadId: t, type: "leave_thread" });
|
|
65
65
|
}
|
|
66
66
|
sendMessage(t, n) {
|
|
67
|
-
if (n.length >
|
|
68
|
-
throw new Error(`Message body exceeds maximum length of ${
|
|
67
|
+
if (n.length > se)
|
|
68
|
+
throw new Error(`Message body exceeds maximum length of ${se} characters`);
|
|
69
69
|
this.send({ body: n, threadId: t, type: "send_message" });
|
|
70
70
|
}
|
|
71
71
|
markRead(t) {
|
|
@@ -93,7 +93,7 @@ class we {
|
|
|
93
93
|
}
|
|
94
94
|
scheduleReconnect() {
|
|
95
95
|
this.clearReconnectTimer();
|
|
96
|
-
const t = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt,
|
|
96
|
+
const t = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, we);
|
|
97
97
|
this.reconnectAttempt++, this.reconnectTimer = setTimeout(() => {
|
|
98
98
|
this.connect();
|
|
99
99
|
}, t);
|
|
@@ -102,18 +102,18 @@ class we {
|
|
|
102
102
|
this.reconnectTimer !== null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
var
|
|
106
|
-
var
|
|
105
|
+
var V = { exports: {} }, M = {};
|
|
106
|
+
var ae;
|
|
107
107
|
function Ee() {
|
|
108
|
-
if (
|
|
109
|
-
|
|
108
|
+
if (ae) return M;
|
|
109
|
+
ae = 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 u in o)
|
|
116
|
+
u !== "key" && (a[u] = o[u]);
|
|
117
117
|
} else a = o;
|
|
118
118
|
return o = a.ref, {
|
|
119
119
|
$$typeof: e,
|
|
@@ -123,19 +123,19 @@ function Ee() {
|
|
|
123
123
|
props: a
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
return
|
|
126
|
+
return M.Fragment = t, M.jsx = n, M.jsxs = n, M;
|
|
127
127
|
}
|
|
128
|
-
var
|
|
129
|
-
var
|
|
128
|
+
var U = {};
|
|
129
|
+
var ie;
|
|
130
130
|
function Re() {
|
|
131
|
-
return
|
|
131
|
+
return ie || (ie = 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 === L ? null : r.displayName || r.name || null;
|
|
136
136
|
if (typeof r == "string") return r;
|
|
137
137
|
switch (r) {
|
|
138
|
-
case
|
|
138
|
+
case k:
|
|
139
139
|
return "Fragment";
|
|
140
140
|
case d:
|
|
141
141
|
return "Profiler";
|
|
@@ -143,30 +143,30 @@ function Re() {
|
|
|
143
143
|
return "StrictMode";
|
|
144
144
|
case x:
|
|
145
145
|
return "Suspense";
|
|
146
|
-
case
|
|
146
|
+
case S:
|
|
147
147
|
return "SuspenseList";
|
|
148
|
-
case
|
|
148
|
+
case J:
|
|
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 A:
|
|
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
161
|
case T:
|
|
162
|
-
var
|
|
163
|
-
return r = r.displayName, r || (r =
|
|
164
|
-
case
|
|
165
|
-
return
|
|
166
|
-
case
|
|
167
|
-
|
|
162
|
+
var p = r.render;
|
|
163
|
+
return r = r.displayName, r || (r = p.displayName || p.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
164
|
+
case $:
|
|
165
|
+
return p = r.displayName || null, p !== null ? p : e(r.type) || "Memo";
|
|
166
|
+
case Y:
|
|
167
|
+
p = r._payload, r = r._init;
|
|
168
168
|
try {
|
|
169
|
-
return e(r(
|
|
169
|
+
return e(r(p));
|
|
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 p = !1;
|
|
182
182
|
} catch {
|
|
183
|
-
|
|
183
|
+
p = !0;
|
|
184
184
|
}
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
var
|
|
188
|
-
return
|
|
189
|
-
|
|
185
|
+
if (p) {
|
|
186
|
+
p = console;
|
|
187
|
+
var w = p.error, R = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
188
|
+
return w.call(
|
|
189
|
+
p,
|
|
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 === k) return "<>";
|
|
197
|
+
if (typeof r == "object" && r !== null && r.$$typeof === Y)
|
|
198
198
|
return "<...>";
|
|
199
199
|
try {
|
|
200
|
-
var
|
|
201
|
-
return
|
|
200
|
+
var p = e(r);
|
|
201
|
+
return p ? "<" + p + ">" : "<...>";
|
|
202
202
|
} catch {
|
|
203
203
|
return "<...>";
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
function o() {
|
|
207
|
-
var r =
|
|
207
|
+
var r = P.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 (X.call(r, "key")) {
|
|
215
|
+
var p = Object.getOwnPropertyDescriptor(r, "key").get;
|
|
216
|
+
if (p && p.isReactWarning) return !1;
|
|
217
217
|
}
|
|
218
218
|
return r.key !== void 0;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
function
|
|
222
|
-
|
|
220
|
+
function u(r, p) {
|
|
221
|
+
function w() {
|
|
222
|
+
Z || (Z = !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
|
+
p
|
|
225
225
|
));
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
get:
|
|
227
|
+
w.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
228
|
+
get: w,
|
|
229
229
|
configurable: !0
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function l() {
|
|
233
233
|
var r = e(this.type);
|
|
234
|
-
return
|
|
234
|
+
return ee[r] || (ee[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 f(r, p, w, R, W, K) {
|
|
239
|
+
var _ = w.ref;
|
|
240
240
|
return r = {
|
|
241
|
-
$$typeof:
|
|
241
|
+
$$typeof: v,
|
|
242
242
|
type: r,
|
|
243
|
-
key:
|
|
244
|
-
props:
|
|
243
|
+
key: p,
|
|
244
|
+
props: w,
|
|
245
245
|
_owner: R
|
|
246
246
|
}, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(r, "ref", {
|
|
247
247
|
enumerable: !1,
|
|
248
|
-
get:
|
|
248
|
+
get: l
|
|
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: W
|
|
264
264
|
}), Object.defineProperty(r, "_debugTask", {
|
|
265
265
|
configurable: !1,
|
|
266
266
|
enumerable: !1,
|
|
267
267
|
writable: !0,
|
|
268
|
-
value:
|
|
268
|
+
value: K
|
|
269
269
|
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
270
270
|
}
|
|
271
|
-
function i(r,
|
|
272
|
-
var _ =
|
|
271
|
+
function i(r, p, w, R, W, K) {
|
|
272
|
+
var _ = p.children;
|
|
273
273
|
if (_ !== void 0)
|
|
274
274
|
if (R)
|
|
275
|
-
if (
|
|
275
|
+
if (he(_)) {
|
|
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 (X.call(p, "key")) {
|
|
285
285
|
_ = e(r);
|
|
286
|
-
var
|
|
286
|
+
var F = Object.keys(p).filter(function(ge) {
|
|
287
287
|
return ge !== "key";
|
|
288
288
|
});
|
|
289
|
-
R = 0 <
|
|
289
|
+
R = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", ne[_ + R] || (F = 0 < F.length ? "{" + F.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,34 +295,34 @@ React keys must be passed directly to JSX without using spread:
|
|
|
295
295
|
<%s key={someKey} {...props} />`,
|
|
296
296
|
R,
|
|
297
297
|
_,
|
|
298
|
-
|
|
298
|
+
F,
|
|
299
299
|
_
|
|
300
|
-
),
|
|
300
|
+
), ne[_ + R] = !0);
|
|
301
301
|
}
|
|
302
|
-
if (_ = null,
|
|
303
|
-
|
|
304
|
-
for (var
|
|
305
|
-
|
|
306
|
-
} else
|
|
307
|
-
return _ &&
|
|
308
|
-
|
|
302
|
+
if (_ = null, w !== void 0 && (n(w), _ = "" + w), c(p) && (n(p.key), _ = "" + p.key), "key" in p) {
|
|
303
|
+
w = {};
|
|
304
|
+
for (var q in p)
|
|
305
|
+
q !== "key" && (w[q] = p[q]);
|
|
306
|
+
} else w = p;
|
|
307
|
+
return _ && u(
|
|
308
|
+
w,
|
|
309
309
|
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
310
|
-
),
|
|
310
|
+
), f(
|
|
311
311
|
r,
|
|
312
312
|
_,
|
|
313
|
-
|
|
313
|
+
w,
|
|
314
314
|
o(),
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
W,
|
|
316
|
+
K
|
|
317
317
|
);
|
|
318
318
|
}
|
|
319
319
|
function h(r) {
|
|
320
|
-
m(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof ===
|
|
320
|
+
m(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === Y && (r._payload.status === "fulfilled" ? m(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
|
|
321
321
|
}
|
|
322
322
|
function m(r) {
|
|
323
|
-
return typeof r == "object" && r !== null && r.$$typeof ===
|
|
323
|
+
return typeof r == "object" && r !== null && r.$$typeof === v;
|
|
324
324
|
}
|
|
325
|
-
var y = me,
|
|
325
|
+
var y = me, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), k = /* @__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"), S = /* @__PURE__ */ Symbol.for("react.suspense_list"), $ = /* @__PURE__ */ Symbol.for("react.memo"), Y = /* @__PURE__ */ Symbol.for("react.lazy"), J = /* @__PURE__ */ Symbol.for("react.activity"), L = /* @__PURE__ */ Symbol.for("react.client.reference"), P = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, X = Object.prototype.hasOwnProperty, he = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
326
326
|
return null;
|
|
327
327
|
};
|
|
328
328
|
y = {
|
|
@@ -330,47 +330,47 @@ React keys must be passed directly to JSX without using spread:
|
|
|
330
330
|
return r();
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
|
-
var
|
|
333
|
+
var Z, ee = {}, te = y.react_stack_bottom_frame.bind(
|
|
334
334
|
y,
|
|
335
335
|
a
|
|
336
|
-
)(),
|
|
337
|
-
|
|
338
|
-
var R = 1e4 >
|
|
336
|
+
)(), re = G(s(a)), ne = {};
|
|
337
|
+
U.Fragment = k, U.jsx = function(r, p, w) {
|
|
338
|
+
var R = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
339
339
|
return i(
|
|
340
340
|
r,
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
p,
|
|
342
|
+
w,
|
|
343
343
|
!1,
|
|
344
|
-
R ? Error("react-stack-top-frame") :
|
|
345
|
-
R ?
|
|
344
|
+
R ? Error("react-stack-top-frame") : te,
|
|
345
|
+
R ? G(s(r)) : re
|
|
346
346
|
);
|
|
347
|
-
},
|
|
348
|
-
var R = 1e4 >
|
|
347
|
+
}, U.jsxs = function(r, p, w) {
|
|
348
|
+
var R = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
349
349
|
return i(
|
|
350
350
|
r,
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
p,
|
|
352
|
+
w,
|
|
353
353
|
!0,
|
|
354
|
-
R ? Error("react-stack-top-frame") :
|
|
355
|
-
R ?
|
|
354
|
+
R ? Error("react-stack-top-frame") : te,
|
|
355
|
+
R ? G(s(r)) : re
|
|
356
356
|
);
|
|
357
357
|
};
|
|
358
|
-
})()),
|
|
358
|
+
})()), U;
|
|
359
359
|
}
|
|
360
|
-
var
|
|
360
|
+
var ce;
|
|
361
361
|
function _e() {
|
|
362
|
-
return
|
|
362
|
+
return ce || (ce = 1, process.env.NODE_ENV === "production" ? V.exports = Ee() : V.exports = Re()), V.exports;
|
|
363
363
|
}
|
|
364
|
-
var
|
|
364
|
+
var I = _e();
|
|
365
365
|
const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
366
|
-
const n =
|
|
366
|
+
const n = H(
|
|
367
367
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
368
|
-
() => e(({ TextField: s, ...o }) => /* @__PURE__ */
|
|
368
|
+
() => e(({ TextField: s, ...o }) => /* @__PURE__ */ I.jsx(s, { ...o })),
|
|
369
369
|
[e]
|
|
370
370
|
);
|
|
371
|
-
return /* @__PURE__ */
|
|
372
|
-
},
|
|
373
|
-
const o =
|
|
371
|
+
return /* @__PURE__ */ I.jsx(n, { ...t });
|
|
372
|
+
}, C = fe({}), Ke = ({ children: e, apiURL: t, libraries: n, localStorageKeys: s }) => {
|
|
373
|
+
const o = H(
|
|
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__ */ I.jsx(C.Provider, { value: o, children: e });
|
|
382
382
|
}, qe = ({ data: e, ...t }) => {
|
|
383
|
-
const { libraries: n } = C
|
|
383
|
+
const { libraries: n } = j(C), 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:
|
|
390
|
+
const { useGoogleTagManager: a } = o, { useLocation: c, Outlet: u } = s, { pathname: l } = c(), { sendEvent: f } = a();
|
|
391
391
|
return N(() => {
|
|
392
|
-
|
|
392
|
+
f({
|
|
393
393
|
event: "pageView",
|
|
394
|
-
pathname:
|
|
394
|
+
pathname: l,
|
|
395
395
|
...e
|
|
396
396
|
});
|
|
397
|
-
}, [e,
|
|
398
|
-
},
|
|
397
|
+
}, [e, l, f]), /* @__PURE__ */ I.jsx(u, {});
|
|
398
|
+
}, z = (() => {
|
|
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,18 +409,18 @@ 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 } = C
|
|
413
|
-
if (!
|
|
412
|
+
const { apiURL: o = s.apiURL, libraries: a, localStorageKeys: c } = j(C), u = s?.userLocalStorageKey || c?.user || be, l = s?.axios || a?.axios;
|
|
413
|
+
if (!l)
|
|
414
414
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
415
|
-
if (!
|
|
415
|
+
if (!l?.defaults || z)
|
|
416
416
|
return null;
|
|
417
417
|
if (typeof window < "u" && window.localStorage) {
|
|
418
|
-
const
|
|
419
|
-
y && (
|
|
418
|
+
const f = localStorage.getItem(u), i = f ? JSON.parse(f) : null, h = i?.[e] ? i[e] : null, m = i?.[t] ? i[t] : null, y = f ? `${h} ${m}` : null;
|
|
419
|
+
y && (l.defaults.headers.common.Authorization = y);
|
|
420
420
|
}
|
|
421
|
-
return
|
|
421
|
+
return l.defaults.baseURL = o, l.defaults.headers.post["Content-Type"] = n, null;
|
|
422
422
|
}, He = ({ language: e, ...t }) => {
|
|
423
|
-
const { libraries: n } = C
|
|
423
|
+
const { libraries: n } = j(C), 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."
|
|
@@ -428,18 +428,18 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
428
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((u) => {
|
|
432
|
+
u && s.extend(u);
|
|
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 } = C
|
|
438
|
-
if (
|
|
437
|
+
const { libraries: s } = j(C), o = n?.i18 || s?.i18, { i18next: a, initReactI18next: c, languageDetector: u } = o || {};
|
|
438
|
+
if (z)
|
|
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(u).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", (l) => {
|
|
458
|
+
document.documentElement.setAttribute("lang", l);
|
|
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: u,
|
|
469
|
+
environment: l,
|
|
470
|
+
release: f,
|
|
471
471
|
...i
|
|
472
472
|
}) => {
|
|
473
|
-
const { libraries: h } = C
|
|
473
|
+
const { libraries: h } = j(C), m = i?.sentry || h?.sentry, y = i?.reactRouter || h?.reactRouter;
|
|
474
474
|
if (!m)
|
|
475
475
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
476
476
|
if (!y)
|
|
477
477
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
478
478
|
if (m.isInitialized())
|
|
479
479
|
return null;
|
|
480
|
-
const { createRoutesFromChildren:
|
|
481
|
-
return (
|
|
482
|
-
debug:
|
|
480
|
+
const { createRoutesFromChildren: v, matchRoutes: A, useLocation: k, useNavigationType: g } = y;
|
|
481
|
+
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && m.init({
|
|
482
|
+
debug: u,
|
|
483
483
|
dsn: e,
|
|
484
|
-
environment:
|
|
484
|
+
environment: l || "production",
|
|
485
485
|
ignoreErrors: [
|
|
486
486
|
...c || [],
|
|
487
487
|
/dynamically imported module/,
|
|
@@ -493,22 +493,22 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
493
493
|
],
|
|
494
494
|
integrations: [
|
|
495
495
|
m.reactRouterV6BrowserTracingIntegration({
|
|
496
|
-
createRoutesFromChildren:
|
|
497
|
-
matchRoutes:
|
|
496
|
+
createRoutesFromChildren: v,
|
|
497
|
+
matchRoutes: A,
|
|
498
498
|
useEffect: N,
|
|
499
|
-
useLocation:
|
|
499
|
+
useLocation: k,
|
|
500
500
|
useNavigationType: g
|
|
501
501
|
}),
|
|
502
502
|
...t || []
|
|
503
503
|
],
|
|
504
|
-
release:
|
|
504
|
+
release: f,
|
|
505
505
|
replaysOnErrorSampleRate: o || 1,
|
|
506
506
|
replaysSessionSampleRate: s || 0.1,
|
|
507
507
|
tracePropagationTargets: a,
|
|
508
508
|
tracesSampleRate: n || 1
|
|
509
509
|
}), null;
|
|
510
510
|
}, et = () => (N(() => {
|
|
511
|
-
if (
|
|
511
|
+
if (z)
|
|
512
512
|
return;
|
|
513
513
|
const e = (t) => {
|
|
514
514
|
try {
|
|
@@ -519,22 +519,22 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
519
519
|
return window.addEventListener("vite:preloadError", e), () => {
|
|
520
520
|
window.removeEventListener("vite:preloadError", e);
|
|
521
521
|
};
|
|
522
|
-
}, []), null),
|
|
523
|
-
const { libraries: a, localStorageKeys: c } = C
|
|
524
|
-
if (!
|
|
522
|
+
}, []), null), le = /* @__PURE__ */ new WeakMap(), Te = "user", tt = ({ Fallback: e, isLogged: t, loginPath: n = "/login", redirect401Path: s = "/login", ...o }) => {
|
|
523
|
+
const { libraries: a, localStorageKeys: c } = j(C), u = o?.reactRouter || a?.reactRouter, l = o?.axios || a?.axios, f = o?.localStorageKey || c?.user || Te;
|
|
524
|
+
if (!u)
|
|
525
525
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
526
|
-
const [i, h] =
|
|
526
|
+
const [i, h] = D(null), { useLocation: m, Navigate: y, Outlet: v } = u, A = m(), k = typeof t == "function" ? t() : !!t, g = typeof k == "boolean" ? k : k?.isLogged;
|
|
527
527
|
return N(() => {
|
|
528
|
-
|
|
528
|
+
le.has(l) || (le.set(l, !0), l.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 && (l.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(f)), h(s)), Promise.reject(d))
|
|
531
531
|
));
|
|
532
|
-
}, [
|
|
532
|
+
}, [l, f, s]), g && !i ? /* @__PURE__ */ I.jsx(ye, { fallback: e, children: A.state?.from?.state && A.state?.from?.pathname === n ? /* @__PURE__ */ I.jsx(y, { to: A.state.from.state.from.pathname + A.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ I.jsx(v, {}) }) : /* @__PURE__ */ I.jsx(y, { to: n + A.search, state: { from: A }, 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((l) => l.charAt(0).toUpperCase() + l.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: u = "./openapi.json", customAxiosInstancePath: l, overrideApiName: f } = s || {}, i = f || Ce(u), h = l || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
|
|
561
561
|
return {
|
|
562
562
|
...n,
|
|
563
563
|
[i]: {
|
|
564
|
-
input:
|
|
564
|
+
input: u,
|
|
565
565
|
output: {
|
|
566
566
|
baseUrl: o?.baseUrl,
|
|
567
567
|
client: "react-query",
|
|
@@ -579,7 +579,7 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
579
579
|
name: Ae(h),
|
|
580
580
|
path: h
|
|
581
581
|
},
|
|
582
|
-
operationName: (m, y,
|
|
582
|
+
operationName: (m, y, v) => ke(m, y, v, c),
|
|
583
583
|
query: {
|
|
584
584
|
useQuery: !0
|
|
585
585
|
}
|
|
@@ -600,96 +600,75 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
600
600
|
} catch {
|
|
601
601
|
return null;
|
|
602
602
|
}
|
|
603
|
-
},
|
|
604
|
-
const [
|
|
605
|
-
|
|
606
|
-
if (!
|
|
603
|
+
}, pe = fe(null), nt = ({ children: e, reconnect: t = !0, enabled: n = !0, url: s, token: o }) => {
|
|
604
|
+
const [a, c] = D(!1), [u, l] = D(!1), [f, i] = D(0), { apiURL: h, localStorageKeys: m } = j(C), y = m?.user || xe, v = B(null), A = B(/* @__PURE__ */ new Set());
|
|
605
|
+
N(() => {
|
|
606
|
+
if (!n)
|
|
607
607
|
return;
|
|
608
|
-
const
|
|
609
|
-
if (!
|
|
608
|
+
const S = s || (h ? Oe(h) : null);
|
|
609
|
+
if (!S)
|
|
610
610
|
return;
|
|
611
|
-
const
|
|
612
|
-
|
|
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) {
|
|
611
|
+
const $ = () => o ?? Ie(y), Y = (L) => {
|
|
612
|
+
switch (L.type) {
|
|
624
613
|
case "ready":
|
|
625
|
-
|
|
626
|
-
break;
|
|
627
|
-
case "new_message":
|
|
628
|
-
ee?.(S);
|
|
614
|
+
l(!0), i(L.unreadCount ?? 0);
|
|
629
615
|
break;
|
|
630
616
|
case "new_message_notification":
|
|
631
|
-
|
|
632
|
-
break;
|
|
633
|
-
case "presence":
|
|
634
|
-
J?.(S);
|
|
635
|
-
break;
|
|
636
|
-
case "error":
|
|
637
|
-
M?.(S);
|
|
638
|
-
break;
|
|
639
|
-
case "joined_thread":
|
|
640
|
-
G?.(S);
|
|
641
|
-
break;
|
|
642
|
-
case "left_thread":
|
|
643
|
-
K?.(S);
|
|
617
|
+
i((P) => P + 1);
|
|
644
618
|
break;
|
|
645
619
|
case "marked_read":
|
|
646
|
-
|
|
647
|
-
break;
|
|
648
|
-
case "threads_list":
|
|
649
|
-
B?.(S);
|
|
620
|
+
i((P) => Math.max(0, P - 1));
|
|
650
621
|
break;
|
|
651
622
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
623
|
+
for (const P of A.current)
|
|
624
|
+
P(L);
|
|
625
|
+
}, J = setTimeout(() => {
|
|
626
|
+
const L = new ve({
|
|
627
|
+
getToken: $,
|
|
628
|
+
onConnectionChange: (P) => {
|
|
629
|
+
c(P), P || l(!1);
|
|
630
|
+
},
|
|
631
|
+
onEvent: Y,
|
|
632
|
+
reconnect: t,
|
|
633
|
+
url: S
|
|
634
|
+
});
|
|
635
|
+
v.current = L, L.connect();
|
|
636
|
+
}, 0);
|
|
637
|
+
return () => {
|
|
638
|
+
clearTimeout(J), v.current?.disconnect(), v.current = null;
|
|
663
639
|
};
|
|
664
|
-
}, [
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
}, []),
|
|
668
|
-
|
|
669
|
-
}, []),
|
|
670
|
-
|
|
671
|
-
}, []),
|
|
672
|
-
|
|
673
|
-
}, []),
|
|
674
|
-
|
|
675
|
-
}, []),
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
640
|
+
}, [n, s, o, h, t, y]);
|
|
641
|
+
const k = O((S) => {
|
|
642
|
+
v.current?.joinThread(S);
|
|
643
|
+
}, []), g = O((S) => {
|
|
644
|
+
v.current?.leaveThread(S);
|
|
645
|
+
}, []), d = O((S, $) => {
|
|
646
|
+
v.current?.sendMessage(S, $);
|
|
647
|
+
}, []), b = O((S) => {
|
|
648
|
+
v.current?.markRead(S);
|
|
649
|
+
}, []), E = O((S, $) => {
|
|
650
|
+
v.current?.listThreads(S, $);
|
|
651
|
+
}, []), T = O((S) => (A.current.add(S), () => {
|
|
652
|
+
A.current.delete(S);
|
|
653
|
+
}), []), x = {
|
|
654
|
+
isConnected: a,
|
|
655
|
+
isReady: u,
|
|
656
|
+
joinThread: k,
|
|
657
|
+
leaveThread: g,
|
|
658
|
+
listThreads: E,
|
|
659
|
+
markRead: b,
|
|
660
|
+
sendMessage: d,
|
|
661
|
+
subscribe: T,
|
|
662
|
+
unreadCount: f
|
|
684
663
|
};
|
|
685
|
-
return /* @__PURE__ */
|
|
664
|
+
return /* @__PURE__ */ I.jsx(pe.Provider, { value: x, children: e });
|
|
686
665
|
}, Ne = (e) => e && typeof e == "function", Le = (e) => e && typeof e == "function", ot = ({
|
|
687
666
|
children: e,
|
|
688
667
|
defaultQueriesOptions: t,
|
|
689
668
|
defaultMutationsOptions: n,
|
|
690
669
|
...s
|
|
691
670
|
}) => {
|
|
692
|
-
const { libraries: o } = C
|
|
671
|
+
const { libraries: o } = j(C), a = s?.QueryClient || o?.reactQuery?.QueryClient, c = s?.QueryClientProvider || o?.reactQuery?.QueryClientProvider;
|
|
693
672
|
if (!a)
|
|
694
673
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
695
674
|
if (!c)
|
|
@@ -698,20 +677,20 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
698
677
|
throw new Error("Provided QueryClientProvider dependencies are not valid.");
|
|
699
678
|
if (!Le(a))
|
|
700
679
|
throw new Error("Provided QueryClient dependencies are not valid.");
|
|
701
|
-
const
|
|
680
|
+
const u = new a({
|
|
702
681
|
defaultOptions: {
|
|
703
682
|
mutations: {
|
|
704
683
|
...n
|
|
705
684
|
},
|
|
706
685
|
queries: {
|
|
707
|
-
getNextPageParam: (
|
|
686
|
+
getNextPageParam: (l, f, i) => l.length + (i || 0),
|
|
708
687
|
refetchOnWindowFocus: !1,
|
|
709
688
|
retry: 3,
|
|
710
689
|
...t
|
|
711
690
|
}
|
|
712
691
|
}
|
|
713
692
|
});
|
|
714
|
-
return /* @__PURE__ */
|
|
693
|
+
return /* @__PURE__ */ I.jsx(c, { client: u, children: e });
|
|
715
694
|
}, $e = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), Fe = (e, t) => {
|
|
716
695
|
const { fractionDigits: n = 0, metric: s = "km", spacingBetween: o = !0 } = t || {}, a = Number(e), c = o ? " " : "";
|
|
717
696
|
return Number.isNaN(a) ? `0${c}${s}` : `${a.toFixed(n)}${c}${s}`;
|
|
@@ -721,19 +700,19 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
721
700
|
const s = Ye(e), o = `${n}${s}`, a = o.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
722
701
|
return typeof t == "number" && a ? `${o.replace("/files", `/thumbs/${t}`)}` : o;
|
|
723
702
|
}, st = (e) => {
|
|
724
|
-
const { apiURL: t, libraries: n } = C
|
|
703
|
+
const { apiURL: t, libraries: n } = j(C), s = e?.dayjs || n?.dayjs;
|
|
725
704
|
return {
|
|
726
|
-
dateAdapter: (c,
|
|
705
|
+
dateAdapter: (c, u) => {
|
|
727
706
|
if (!s)
|
|
728
707
|
throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
729
708
|
return $e({
|
|
730
709
|
date: c,
|
|
731
|
-
format:
|
|
710
|
+
format: u,
|
|
732
711
|
library: s
|
|
733
712
|
});
|
|
734
713
|
},
|
|
735
714
|
distanceAdapter: Fe,
|
|
736
|
-
filePathAdapter: (c,
|
|
715
|
+
filePathAdapter: (c, u) => {
|
|
737
716
|
if (!t)
|
|
738
717
|
throw new Error(
|
|
739
718
|
"API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
|
|
@@ -741,56 +720,98 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
741
720
|
return typeof c == "string" && /^https?:\/\//.test(c) ? c : Me({
|
|
742
721
|
apiURL: t,
|
|
743
722
|
path: c,
|
|
744
|
-
size:
|
|
723
|
+
size: u
|
|
745
724
|
});
|
|
746
725
|
},
|
|
747
726
|
worksiteNameAdapter: De
|
|
748
727
|
};
|
|
749
728
|
}, at = (e) => {
|
|
750
|
-
const { libraries: t, localStorageKeys: n } = C
|
|
729
|
+
const { libraries: t, localStorageKeys: n } = j(C), s = e?.axios || t?.axios, o = e?.localStorageKey || n?.user || "user";
|
|
751
730
|
if (!s)
|
|
752
731
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
753
|
-
const a =
|
|
754
|
-
({ tokenType:
|
|
755
|
-
s.defaults.headers.common.Authorization = `${
|
|
732
|
+
const a = O(
|
|
733
|
+
({ tokenType: u, accessToken: l }) => {
|
|
734
|
+
s.defaults.headers.common.Authorization = `${u} ${l}`;
|
|
756
735
|
},
|
|
757
736
|
[s.defaults.headers.common]
|
|
758
737
|
), c = () => {
|
|
759
738
|
s.defaults.headers.common.Authorization = null;
|
|
760
739
|
};
|
|
761
740
|
return N(() => {
|
|
762
|
-
if (
|
|
741
|
+
if (z)
|
|
763
742
|
return;
|
|
764
|
-
const
|
|
765
|
-
if (
|
|
743
|
+
const u = ({ newValue: l, key: f }) => {
|
|
744
|
+
if (f === o && l)
|
|
766
745
|
try {
|
|
767
|
-
const { accessToken: i, tokenType: h } = JSON.parse(
|
|
746
|
+
const { accessToken: i, tokenType: h } = JSON.parse(l);
|
|
768
747
|
a({ accessToken: i, tokenType: h });
|
|
769
748
|
} catch (i) {
|
|
770
749
|
console.error("Failed to parse newValue from localStorage:", i);
|
|
771
750
|
}
|
|
772
751
|
};
|
|
773
|
-
return window.addEventListener("storage",
|
|
774
|
-
window.removeEventListener("storage",
|
|
752
|
+
return window.addEventListener("storage", u), () => {
|
|
753
|
+
window.removeEventListener("storage", u);
|
|
775
754
|
};
|
|
776
755
|
}, [o, a]), {
|
|
777
756
|
clearAuthenticationToken: c,
|
|
778
757
|
setAuthenticationToken: a
|
|
779
758
|
};
|
|
780
|
-
}, it = () => {
|
|
781
|
-
const
|
|
782
|
-
if (!
|
|
759
|
+
}, it = (e) => {
|
|
760
|
+
const t = j(pe);
|
|
761
|
+
if (!t)
|
|
783
762
|
throw new Error("useChat must be used within ChatProvider");
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
763
|
+
const { subscribe: n, ...s } = t, o = B(e);
|
|
764
|
+
return o.current = e, N(() => n((a) => {
|
|
765
|
+
const {
|
|
766
|
+
onReady: c,
|
|
767
|
+
onNewMessage: u,
|
|
768
|
+
onNewMessageNotification: l,
|
|
769
|
+
onPresence: f,
|
|
770
|
+
onError: i,
|
|
771
|
+
onJoinedThread: h,
|
|
772
|
+
onLeftThread: m,
|
|
773
|
+
onMarkedRead: y,
|
|
774
|
+
onThreadsList: v
|
|
775
|
+
} = o.current ?? {};
|
|
776
|
+
switch (a.type) {
|
|
777
|
+
case "ready":
|
|
778
|
+
c?.(a);
|
|
779
|
+
break;
|
|
780
|
+
case "new_message":
|
|
781
|
+
u?.(a);
|
|
782
|
+
break;
|
|
783
|
+
case "new_message_notification":
|
|
784
|
+
l?.(a);
|
|
785
|
+
break;
|
|
786
|
+
case "presence":
|
|
787
|
+
f?.(a);
|
|
788
|
+
break;
|
|
789
|
+
case "error":
|
|
790
|
+
i?.(a);
|
|
791
|
+
break;
|
|
792
|
+
case "joined_thread":
|
|
793
|
+
h?.(a);
|
|
794
|
+
break;
|
|
795
|
+
case "left_thread":
|
|
796
|
+
m?.(a);
|
|
797
|
+
break;
|
|
798
|
+
case "marked_read":
|
|
799
|
+
y?.(a);
|
|
800
|
+
break;
|
|
801
|
+
case "threads_list":
|
|
802
|
+
v?.(a);
|
|
803
|
+
break;
|
|
804
|
+
}
|
|
805
|
+
}), [n]), s;
|
|
806
|
+
}, Q = (e, t) => t === "short" ? e.split("-")[0] : e, ct = (e, t = "full") => {
|
|
807
|
+
const [n, s] = D(() => {
|
|
787
808
|
const o = e?.language || navigator.language;
|
|
788
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
809
|
+
return e && "isInitialized" in e && e.isInitialized, Q(o, t);
|
|
789
810
|
});
|
|
790
811
|
return N(() => {
|
|
791
|
-
e && "isInitialized" in e && e.isInitialized && e.language && s(
|
|
812
|
+
e && "isInitialized" in e && e.isInitialized && e.language && s(Q(e.language, t));
|
|
792
813
|
const o = (a) => {
|
|
793
|
-
s(
|
|
814
|
+
s(Q(a, t));
|
|
794
815
|
};
|
|
795
816
|
return e?.on?.("languageChanged", o), () => {
|
|
796
817
|
e?.off?.("languageChanged", o);
|
|
@@ -804,13 +825,13 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
804
825
|
},
|
|
805
826
|
setFilter: () => {
|
|
806
827
|
}
|
|
807
|
-
},
|
|
828
|
+
}, ue = (e) => {
|
|
808
829
|
try {
|
|
809
830
|
return JSON.parse(e);
|
|
810
831
|
} catch {
|
|
811
832
|
return e;
|
|
812
833
|
}
|
|
813
|
-
},
|
|
834
|
+
}, de = (e, t, n) => `${n}_${e}=>${t}`, We = (e) => e.reduce((t, n) => {
|
|
814
835
|
const s = localStorage.getItem(n);
|
|
815
836
|
if (s)
|
|
816
837
|
try {
|
|
@@ -820,44 +841,44 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
820
841
|
}
|
|
821
842
|
return t;
|
|
822
843
|
}, {}), lt = (e) => {
|
|
823
|
-
const { libraries: t, localStorageKeys: n } = C
|
|
824
|
-
}], [
|
|
825
|
-
if (
|
|
844
|
+
const { libraries: t, localStorageKeys: n } = j(C), s = e?.reactRouter || t?.reactRouter, { pathname: o } = s?.useLocation?.() ?? { pathname: "/" }, [a, c] = s?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
845
|
+
}], [u, l] = D({}), f = n?.filter || Ue, i = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, h = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
|
|
846
|
+
if (z)
|
|
826
847
|
return ze;
|
|
827
848
|
if (!s)
|
|
828
849
|
throw new Error(
|
|
829
850
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
|
|
830
851
|
);
|
|
831
852
|
const m = () => Object.keys(localStorage).filter(
|
|
832
|
-
(g) => g.startsWith(
|
|
853
|
+
(g) => g.startsWith(f) && g.endsWith(e?.pathname || o)
|
|
833
854
|
), y = (g, d, b = !0) => {
|
|
834
|
-
const E =
|
|
855
|
+
const E = de(g, e?.pathname || o, f);
|
|
835
856
|
if (!d || Array.isArray(d) && !d.length) {
|
|
836
|
-
i ? (a.delete(g), c(a)) :
|
|
857
|
+
i ? (a.delete(g), c(a)) : l((T) => {
|
|
837
858
|
const x = { ...T };
|
|
838
859
|
return delete x[g], x;
|
|
839
860
|
}), h && localStorage.removeItem(E);
|
|
840
861
|
return;
|
|
841
862
|
}
|
|
842
|
-
h && b && d && localStorage.setItem(E, JSON.stringify({ ...a, [g]: d })), i && d ? (a.set(g, JSON.stringify(d)), c(a)) : !i && d &&
|
|
863
|
+
h && b && d && localStorage.setItem(E, JSON.stringify({ ...a, [g]: d })), i && d ? (a.set(g, JSON.stringify(d)), c(a)) : !i && d && l((T) => ({ ...T, [g]: d }));
|
|
843
864
|
};
|
|
844
865
|
return {
|
|
845
866
|
getFilter: (g, d) => {
|
|
846
867
|
if (i) {
|
|
847
868
|
const b = a.get(g);
|
|
848
869
|
if (b)
|
|
849
|
-
return
|
|
870
|
+
return ue(b);
|
|
850
871
|
} else {
|
|
851
|
-
const b =
|
|
872
|
+
const b = u[g];
|
|
852
873
|
if (b !== void 0)
|
|
853
874
|
return b;
|
|
854
875
|
}
|
|
855
876
|
if (h) {
|
|
856
|
-
const b =
|
|
877
|
+
const b = de(g, e?.pathname || o, f), E = localStorage.getItem(b);
|
|
857
878
|
if (E)
|
|
858
879
|
try {
|
|
859
880
|
const T = JSON.parse(E)[g];
|
|
860
|
-
return !i && T !== void 0 &&
|
|
881
|
+
return !i && T !== void 0 && l((x) => ({ ...x, [g]: T })), T;
|
|
861
882
|
} catch {
|
|
862
883
|
}
|
|
863
884
|
}
|
|
@@ -866,7 +887,7 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
866
887
|
getFilters: () => {
|
|
867
888
|
const g = h ? We(m()) : {};
|
|
868
889
|
if (i) {
|
|
869
|
-
const d = Array.from(a.entries()).reduce((b, [E, T]) => (b[E] =
|
|
890
|
+
const d = Array.from(a.entries()).reduce((b, [E, T]) => (b[E] = ue(T), b), {});
|
|
870
891
|
return {
|
|
871
892
|
...g,
|
|
872
893
|
...d
|
|
@@ -874,7 +895,7 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
874
895
|
}
|
|
875
896
|
return {
|
|
876
897
|
...g,
|
|
877
|
-
...
|
|
898
|
+
...u
|
|
878
899
|
};
|
|
879
900
|
},
|
|
880
901
|
handleFilter: (g, d) => (b, E) => {
|
|
@@ -895,26 +916,26 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
895
916
|
isLoading: o,
|
|
896
917
|
enabled: a = !0
|
|
897
918
|
}) => {
|
|
898
|
-
const c =
|
|
899
|
-
async (
|
|
900
|
-
n || !a || await t({ pageParam:
|
|
919
|
+
const c = O(
|
|
920
|
+
async (l) => {
|
|
921
|
+
n || !a || await t({ pageParam: l?.pageParam || l.visibleRowsCount });
|
|
901
922
|
},
|
|
902
923
|
[a, t, n]
|
|
903
|
-
),
|
|
924
|
+
), u = H(() => {
|
|
904
925
|
if (e)
|
|
905
|
-
return e.pages.reduce((
|
|
926
|
+
return e.pages.reduce((l, f) => [...l, ...f], []);
|
|
906
927
|
}, [e]);
|
|
907
928
|
return {
|
|
908
929
|
fetchNextPageOnRowsScrollEnd: c,
|
|
909
930
|
isLoading: n || o,
|
|
910
931
|
loadingVariant: s ? "skeleton" : "linear-progress",
|
|
911
|
-
rows:
|
|
932
|
+
rows: u
|
|
912
933
|
};
|
|
913
934
|
}, dt = (e) => {
|
|
914
|
-
const { libraries: t } = C
|
|
915
|
-
(
|
|
916
|
-
if (
|
|
917
|
-
const { response: i } =
|
|
935
|
+
const { libraries: t } = j(C), n = e?.i18 || t?.i18, s = e?.i18?.translateFunction || t?.i18?.translateFunction, o = n?.i18next?.t || s || ((f) => f), { unknownErrorTranslationKey: a = "error.unknownError" } = e || {}, c = o(a), u = O(
|
|
936
|
+
(f) => {
|
|
937
|
+
if (f && typeof f == "object" && "response" in f) {
|
|
938
|
+
const { response: i } = f || {};
|
|
918
939
|
if (i && typeof i == "object" && "reason" in i && i.reason)
|
|
919
940
|
return String(i.reason);
|
|
920
941
|
if (i && typeof i == "object" && "data" in i && i.data && typeof i.data == "object" && "reason" in i.data && i.data.reason)
|
|
@@ -930,25 +951,25 @@ const Ge = ({ IMaskMixin: e, ...t }) => {
|
|
|
930
951
|
}
|
|
931
952
|
}
|
|
932
953
|
}
|
|
933
|
-
return
|
|
954
|
+
return f instanceof Error ? f.message : c;
|
|
934
955
|
},
|
|
935
956
|
[c]
|
|
936
957
|
);
|
|
937
|
-
return { getErrorCode:
|
|
938
|
-
const { response: i } =
|
|
958
|
+
return { getErrorCode: O((f) => {
|
|
959
|
+
const { response: i } = f || {};
|
|
939
960
|
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";
|
|
940
|
-
}, []), printError:
|
|
961
|
+
}, []), printError: u };
|
|
941
962
|
};
|
|
942
963
|
export {
|
|
943
|
-
|
|
944
|
-
|
|
964
|
+
ve as ChatClient,
|
|
965
|
+
pe as ChatContext,
|
|
945
966
|
nt as ChatProvider,
|
|
946
967
|
qe as GTMSendPageView,
|
|
947
968
|
Be as InitializeAxiosConfig,
|
|
948
969
|
He as InitializeDaysJSConfig,
|
|
949
970
|
Xe as InitializeI18nConfig,
|
|
950
971
|
Ze as InitializeSentryConfig,
|
|
951
|
-
|
|
972
|
+
C as InjectDependenciesContext,
|
|
952
973
|
Ke as InjectDependenciesProvider,
|
|
953
974
|
Ge as MaskTextField,
|
|
954
975
|
et as PreloadErrorHandler,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(g,
|
|
1
|
+
(function(g,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],F):(g=typeof globalThis<"u"?globalThis:g||self,F(g["@tracktor/shared-module"]={},g.axios,g.React))})(this,(function(g,F,l){"use strict";const fe=(e,t)=>{const r=F.CancelToken.source(),s=F({...e,...t,cancelToken:r.token}).then(({data:o})=>o);return s.cancel=()=>{r.cancel("Query was cancelled")},s};class X{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 W={exports:{}},M={};var Z;function he(){if(Z)return M;Z=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 d in o)d!=="key"&&(a[d]=o[d])}else a=o;return o=a.ref,{$$typeof:e,type:s,key:c,ref:o!==void 0?o:null,props:a}}return M.Fragment=t,M.jsx=r,M.jsxs=r,M}var Y={};var q;function pe(){return q||(q=1,process.env.NODE_ENV!=="production"&&(function(){function e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===x?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 A:return"SuspenseList";case J: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 j:return"Portal";case C:return n.displayName||"Context";case T:return(n._context.displayName||"Context")+".Consumer";case S:var p=n.render;return n=n.displayName,n||(n=p.displayName||p.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case L:return p=n.displayName||null,p!==null?p:e(n.type)||"Memo";case U:p=n._payload,n=n._init;try{return e(n(p))}catch{}}return null}function t(n){return""+n}function r(n){try{t(n);var p=!1}catch{p=!0}if(p){p=console;var w=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return w.call(p,"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===U)return"<...>";try{var p=e(n);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function o(){var n=I.A;return n===null?null:n.getOwner()}function a(){return Error("react-stack-top-frame")}function c(n){if(ae.call(n,"key")){var p=Object.getOwnPropertyDescriptor(n,"key").get;if(p&&p.isReactWarning)return!1}return n.key!==void 0}function d(n,p){function w(){ie||(ie=!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)",p))}w.isReactWarning=!0,Object.defineProperty(n,"key",{get:w,configurable:!0})}function u(){var n=e(this.type);return ce[n]||(ce[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 h(n,p,w,R,V,B){var b=w.ref;return n={$$typeof:_,type:n,key:p,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:V}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function i(n,p,w,R,V,B){var b=p.children;if(b!==void 0)if(R)if($e(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(ae.call(p,"key")){b=e(n);var D=Object.keys(p).filter(function(et){return et!=="key"});R=0<D.length?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}",de[b+R]||(D=0<D.length?"{"+D.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} />`,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"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,R,b,D,b),de[b+R]=!0)}if(b=null,w!==void 0&&(r(w),b=""+w),c(p)&&(r(p.key),b=""+p.key),"key"in p){w={};for(var H in p)H!=="key"&&(w[H]=p[H])}else w=p;return b&&d(w,typeof n=="function"?n.displayName||n.name||"Unknown":n),h(n,b,w,o(),V,B)}function m(n){E(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===U&&(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===_}var v=l,_=Symbol.for("react.transitional.element"),j=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"),C=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),x=Symbol.for("react.client.reference"),I=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=Object.prototype.hasOwnProperty,$e=Array.isArray,K=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(n){return n()}};var ie,ce={},le=v.react_stack_bottom_frame.bind(v,a)(),ue=K(s(a)),de={};Y.Fragment=P,Y.jsx=function(n,p,w){var R=1e4>I.recentlyCreatedOwnerStacks++;return i(n,p,w,!1,R?Error("react-stack-top-frame"):le,R?K(s(n)):ue)},Y.jsxs=function(n,p,w){var R=1e4>I.recentlyCreatedOwnerStacks++;return i(n,p,w,!0,R?Error("react-stack-top-frame"):le,R?K(s(n)):ue)}})()),Y}var $;function ge(){return $||($=1,process.env.NODE_ENV==="production"?W.exports=he():W.exports=pe()),W.exports}var O=ge();const me=({IMaskMixin:e,...t})=>{const r=l.useMemo(()=>e(({TextField:s,...o})=>O.jsx(s,{...o})),[e]);return O.jsx(r,{...t})},k=l.createContext({}),ye=({children:e,apiURL:t,libraries:r,localStorageKeys:s})=>{const o=l.useMemo(()=>({apiURL:t,libraries:r,localStorageKeys:s}),[t,r,s]);return O.jsx(k.Provider,{value:o,children:e})},Ee=({data:e,...t})=>{const{libraries:r}=l.useContext(k),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:u}=c(),{sendEvent:h}=a();return l.useEffect(()=>{h({event:"pageView",pathname:u,...e})},[e,u,h]),O.jsx(d,{})},z=(()=>{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}})(),ve="user",we=({tokenTypeKey:e="tokenType",tokenKey:t="accessToken",postContentType:r="application/json",...s})=>{const{apiURL:o=s.apiURL,libraries:a,localStorageKeys:c}=l.useContext(k),d=s?.userLocalStorageKey||c?.user||ve,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||z)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,E=i?.[t]?i[t]:null,v=h?`${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}=l.useContext(k),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 l.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}=l.useContext(k),o=r?.i18||s?.i18,{i18next:a,initReactI18next:c,languageDetector:d}=o||{};if(z)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",u=>{document.documentElement.setAttribute("lang",u)})),null},Re=({dsn:e,integrations:t,tracesSampleRate:r,replaysSessionSampleRate:s,replaysOnErrorSampleRate:o,tracePropagationTargets:a,ignoreErrors:c,debug:d,environment:u,release:h,...i})=>{const{libraries:m}=l.useContext(k),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:_,matchRoutes:j,useLocation:P,useNavigationType:y}=v;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&E.init({debug:d,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:_,matchRoutes:j,useEffect:l.useEffect,useLocation:P,useNavigationType:y}),...t||[]],release:h,replaysOnErrorSampleRate:o||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:a,tracesSampleRate:r||1}),null},be=()=>(l.useEffect(()=>{if(z)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),ee=new WeakMap,Te="user",Se=({Fallback:e,isLogged:t,loginPath:r="/login",redirect401Path:s="/login",...o})=>{const{libraries:a,localStorageKeys:c}=l.useContext(k),d=o?.reactRouter||a?.reactRouter,u=o?.axios||a?.axios,h=o?.localStorageKey||c?.user||Te;if(!d)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:E,Navigate:v,Outlet:_}=d,j=E(),P=typeof t=="function"?t():!!t,y=typeof P=="boolean"?P:P?.isLogged;return l.useEffect(()=>{ee.has(u)||(ee.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(h)),m(s)),Promise.reject(f))))},[u,h,s]),y&&!i?O.jsx(l.Suspense,{fallback:e,children:j.state?.from?.state&&j.state?.from?.pathname===r?O.jsx(v,{to:j.state.from.state.from.pathname+j.state.from.state.from.search,replace:!0}):O.jsx(_,{})}):O.jsx(v,{to:r+j.search,state:{from:j},replace:!0})},Ae=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),je=e=>{const t=e.split(/[/\\]/).pop()||"";return t.substring(0,t.lastIndexOf("."))},ke=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)},Pe=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Ie=(e,t,r,s)=>{const o=ke(t),a=Ae(r),c=`${o}${a}`;return e&&typeof e=="object"&&"operationId"in e&&s?.includes(String(e.operationId))?`${c}AsQuery`:c},Oe=(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},Ne=e=>(Array.isArray(e)?e:[e]).reduce((r,s)=>{const{output:o,useInfiniteIds:a,useQueryIds:c,input:d="./openapi.json",customAxiosInstancePath:u,overrideApiName:h}=s||{},i=h||Pe(d),m=u||"./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:Oe(a,c)},header:E=>["Generated by orval 🍺",...E.title?[E.title]:[],...E.description?[E.description]:[]],mutator:{name:je(m),path:m},operationName:(E,v,_)=>Ie(E,v,_,c),query:{useQuery:!0}},schemas:o?.schemas||`src/api/${i}/model`,target:o?.target||`src/api/${i}/services/api.ts`,...o}}}},{}),xe="user",Le=e=>{const t=e.startsWith("https")?"wss":"ws",r=e.replace(/^https?:\/\//,"");return`${t}://${r}/v2/threads/ws`},Fe=e=>{try{const t=localStorage.getItem(e);return t?JSON.parse(t)?.accessToken??null:null}catch{return null}},Q=l.createContext(null),De=({children:e,reconnect:t=!0,enabled:r=!0,url:s,token:o})=>{const[a,c]=l.useState(!1),[d,u]=l.useState(!1),[h,i]=l.useState(0),{apiURL:m,localStorageKeys:E}=l.useContext(k),v=E?.user||xe,_=l.useRef(null),j=l.useRef(new Set);l.useEffect(()=>{if(!r)return;const A=s||(m?Le(m):null);if(!A)return;const L=()=>o??Fe(v),U=x=>{switch(x.type){case"ready":u(!0),i(x.unreadCount??0);break;case"new_message_notification":i(I=>I+1);break;case"marked_read":i(I=>Math.max(0,I-1));break}for(const I of j.current)I(x)},J=setTimeout(()=>{const x=new X({getToken:L,onConnectionChange:I=>{c(I),I||u(!1)},onEvent:U,reconnect:t,url:A});_.current=x,x.connect()},0);return()=>{clearTimeout(J),_.current?.disconnect(),_.current=null}},[r,s,o,m,t,v]);const P=l.useCallback(A=>{_.current?.joinThread(A)},[]),y=l.useCallback(A=>{_.current?.leaveThread(A)},[]),f=l.useCallback((A,L)=>{_.current?.sendMessage(A,L)},[]),T=l.useCallback(A=>{_.current?.markRead(A)},[]),C=l.useCallback((A,L)=>{_.current?.listThreads(A,L)},[]),S=l.useCallback(A=>(j.current.add(A),()=>{j.current.delete(A)}),[]),N={isConnected:a,isReady:d,joinThread:P,leaveThread:y,listThreads:C,markRead:T,sendMessage:f,subscribe:S,unreadCount:h};return O.jsx(Q.Provider,{value:N,children:e})},Me=e=>e&&typeof e=="function",Ye=e=>e&&typeof e=="function",ze=({children:e,defaultQueriesOptions:t,defaultMutationsOptions:r,...s})=>{const{libraries:o}=l.useContext(k),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(!Me(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Ye(a))throw new Error("Provided QueryClient dependencies are not valid.");const d=new a({defaultOptions:{mutations:{...r},queries:{getNextPageParam:(u,h,i)=>u.length+(i||0),refetchOnWindowFocus:!1,retry:3,...t}}});return O.jsx(c,{client:d,children:e})},te=({library:e,date:t,format:r="ll"})=>e(t).format(r),ne=(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}`},re=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(r=>r.length>0?r.charAt(0).toUpperCase()+r.slice(1):r).join(" "),Ue=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,We=({path:e,size:t,apiURL:r})=>{if(!e)return"";const s=Ue(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},Ge=e=>{const{apiURL:t,libraries:r}=l.useContext(k),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 te({date:c,format:d,library:s})},distanceAdapter:ne,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:We({apiURL:t,path:c,size:d})},worksiteNameAdapter:re}},Ve=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(k),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=l.useCallback(({tokenType:d,accessToken:u})=>{s.defaults.headers.common.Authorization=`${d} ${u}`},[s.defaults.headers.common]),c=()=>{s.defaults.headers.common.Authorization=null};return l.useEffect(()=>{if(z)return;const d=({newValue:u,key:h})=>{if(h===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",d),()=>{window.removeEventListener("storage",d)}},[o,a]),{clearAuthenticationToken:c,setAuthenticationToken:a}},Qe=e=>{const t=l.useContext(Q);if(!t)throw new Error("useChat must be used within ChatProvider");const{subscribe:r,...s}=t,o=l.useRef(e);return o.current=e,l.useEffect(()=>r(a=>{const{onReady:c,onNewMessage:d,onNewMessageNotification:u,onPresence:h,onError:i,onJoinedThread:m,onLeftThread:E,onMarkedRead:v,onThreadsList:_}=o.current??{};switch(a.type){case"ready":c?.(a);break;case"new_message":d?.(a);break;case"new_message_notification":u?.(a);break;case"presence":h?.(a);break;case"error":i?.(a);break;case"joined_thread":m?.(a);break;case"left_thread":E?.(a);break;case"marked_read":v?.(a);break;case"threads_list":_?.(a);break}}),[r]),s},G=(e,t)=>t==="short"?e.split("-")[0]:e,Je=(e,t="full")=>{const[r,s]=l.useState(()=>{const o=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,G(o,t)});return l.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&s(G(e.language,t));const o=a=>{s(G(a,t))};return e?.on?.("languageChanged",o),()=>{e?.off?.("languageChanged",o)}},[e,t]),r},Ke="tracktor.filter",Be={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},oe=e=>{try{return JSON.parse(e)}catch{return e}},se=(e,t,r)=>`${r}_${e}=>${t}`,He=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},{}),Xe=e=>{const{libraries:t,localStorageKeys:r}=l.useContext(k),s=e?.reactRouter||t?.reactRouter,{pathname:o}=s?.useLocation?.()??{pathname:"/"},[a,c]=s?.useSearchParams?.()??[new URLSearchParams,()=>{}],[d,u]=l.useState({}),h=r?.filter||Ke,i=e?.syncWithUrl===void 0?!0:e?.syncWithUrl,m=e?.persistToLocalStorage===void 0?!0:e?.persistToLocalStorage;if(z)return Be;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(h)&&y.endsWith(e?.pathname||o)),v=(y,f,T=!0)=>{const C=se(y,e?.pathname||o,h);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(C);return}m&&T&&f&&localStorage.setItem(C,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 oe(T)}else{const T=d[y];if(T!==void 0)return T}if(m){const T=se(y,e?.pathname||o,h),C=localStorage.getItem(T);if(C)try{const S=JSON.parse(C)[y];return!i&&S!==void 0&&u(N=>({...N,[y]:S})),S}catch{}}return f},getFilters:()=>{const y=m?He(E()):{};if(i){const f=Array.from(a.entries()).reduce((T,[C,S])=>(T[C]=oe(S),T),{});return{...y,...f}}return{...y,...d}},handleFilter:(y,f)=>(T,C)=>{if(C||Array.isArray(C)&&C.length===0){const S=f||"value",N=typeof C=="object"&&S in C?C[S]:C;v(y,N);return}v(y,void 0)},setFilter:v}},Ze=({data:e,fetchNextPage:t,isFetchingNextPage:r,isInitialLoading:s,isLoading:o,enabled:a=!0})=>{const c=l.useCallback(async u=>{r||!a||await t({pageParam:u?.pageParam||u.visibleRowsCount})},[a,t,r]),d=l.useMemo(()=>{if(e)return e.pages.reduce((u,h)=>[...u,...h],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:r||o,loadingVariant:s?"skeleton":"linear-progress",rows:d}},qe=e=>{const{libraries:t}=l.useContext(k),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=l.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:E}=m[0];if(typeof E=="string")return String(E)}}}return h instanceof Error?h.message:c},[c]);return{getErrorCode:l.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=X,g.ChatContext=Q,g.ChatProvider=De,g.GTMSendPageView=Ee,g.InitializeAxiosConfig=we,g.InitializeDaysJSConfig=_e,g.InitializeI18nConfig=Ce,g.InitializeSentryConfig=Re,g.InjectDependenciesContext=k,g.InjectDependenciesProvider=ye,g.MaskTextField=me,g.PreloadErrorHandler=be,g.QueryClientProviderWithConfig=ze,g.RequireAuth=Se,g.axiosCustomInstance=fe,g.dateAdapter=te,g.distanceAdapter=ne,g.getOrvalConfig=Ne,g.useAdapter=Ge,g.useAuth=Ve,g.useChat=Qe,g.useCurrentLanguage=Je,g.useFilters=Xe,g.useInfiniteDataGrid=Ze,g.useResponseError=qe,g.worksiteNameAdapter=re,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|