@getsoren/shared-module 2.68.0 → 2.69.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/README.md +15 -0
- package/dist/documentImport.js +202 -0
- package/dist/events.js +1 -1
- package/dist/hourSheets.js +58 -0
- package/dist/main.d.ts +6 -6
- package/dist/main.js +512 -548
- package/dist/{context → modules/chat/context}/ChatProvider.d.ts +1 -1
- package/dist/{hooks → modules/chat/hooks}/useChat.d.ts +1 -1
- package/dist/modules/documentImport/index.d.ts +9 -0
- package/dist/modules/documentImport/types.d.ts +127 -0
- package/dist/modules/documentImport/utils/matching/matching.d.ts +144 -0
- package/dist/modules/documentImport/utils/proposals/proposals.d.ts +10 -0
- package/dist/modules/documentImport/utils/reading/reading.d.ts +26 -0
- package/dist/modules/events/utils/payload/payload.test.d.ts +1 -0
- package/dist/modules/events/utils/readEvent/readEvent.test.d.ts +1 -0
- package/dist/modules/events/utils/steps/steps.test.d.ts +1 -0
- package/dist/modules/hourSheets/constants.d.ts +33 -0
- package/dist/modules/hourSheets/index.d.ts +13 -0
- package/dist/modules/hourSheets/types.d.ts +143 -0
- package/dist/modules/hourSheets/utils/billingReferences/billingReferences.d.ts +35 -0
- package/dist/modules/hourSheets/utils/billingReferences/billingReferences.test.d.ts +1 -0
- package/dist/modules/hourSheets/utils/imputation/imputation.d.ts +44 -0
- package/dist/modules/hourSheets/utils/imputation/imputation.test.d.ts +1 -0
- package/dist/modules/hourSheets/utils/readCostCentres/readCostCentres.d.ts +42 -0
- package/dist/modules/hourSheets/utils/readCostCentres/readCostCentres.test.d.ts +1 -0
- package/dist/modules/hourSheets/utils/sheetBlocker/sheetBlocker.d.ts +53 -0
- package/dist/modules/hourSheets/utils/sheetBlocker/sheetBlocker.test.d.ts +1 -0
- package/dist/modules/hourSheets/utils/sheetDays/sheetDays.d.ts +68 -0
- package/dist/modules/hourSheets/utils/sheetDays/sheetDays.test.d.ts +1 -0
- package/dist/modules/hourSheets/utils/sheetLines/sheetLines.d.ts +103 -0
- package/dist/modules/hourSheets/utils/sheetLines/sheetLines.test.d.ts +1 -0
- package/dist/operator-Cj1X_Zg5.js +41 -0
- package/dist/orval.js +1 -1
- package/dist/sheetLines-DECsEz55.js +123 -0
- package/package.json +17 -2
- /package/dist/{chat → modules/chat}/ChatClient.d.ts +0 -0
- /package/dist/{chat → modules/chat}/tests/ChatClient.test.d.ts +0 -0
- /package/dist/{chat → modules/chat}/types.d.ts +0 -0
- /package/dist/{events/hooks/useEventDeclaration/useEventDeclaration.test.d.ts → modules/documentImport/utils/matching/matching.test.d.ts} +0 -0
- /package/dist/{events/tenants/tenants.test.d.ts → modules/documentImport/utils/proposals/proposals.test.d.ts} +0 -0
- /package/dist/{events/utils/amounts/amounts.test.d.ts → modules/documentImport/utils/reading/reading.test.d.ts} +0 -0
- /package/dist/{events → modules/events}/catalog/clientEvents.d.ts +0 -0
- /package/dist/{events → modules/events}/catalog/supplierEvents.d.ts +0 -0
- /package/dist/{events → modules/events}/constants.d.ts +0 -0
- /package/dist/{events → modules/events}/hooks/useEventDeclaration/useEventDeclaration.d.ts +0 -0
- /package/dist/{events/utils/credits/credits.test.d.ts → modules/events/hooks/useEventDeclaration/useEventDeclaration.test.d.ts} +0 -0
- /package/dist/{events → modules/events}/index.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/ar.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/de.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/en.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/es.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/fr.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/it.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/locales.d.ts +0 -0
- /package/dist/{events → modules/events}/locales/pt.d.ts +0 -0
- /package/dist/{events → modules/events}/tenants/bouygues/bouygues.d.ts +0 -0
- /package/dist/{events → modules/events}/tenants/index.d.ts +0 -0
- /package/dist/{events/utils/lineFunnel/lineFunnel.test.d.ts → modules/events/tenants/tenants.test.d.ts} +0 -0
- /package/dist/{events → modules/events}/types.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/amounts/amounts.d.ts +0 -0
- /package/dist/{events/utils/payload/payload.test.d.ts → modules/events/utils/amounts/amounts.test.d.ts} +0 -0
- /package/dist/{events → modules/events}/utils/credits/credits.d.ts +0 -0
- /package/dist/{events/utils/readEvent/readEvent.test.d.ts → modules/events/utils/credits/credits.test.d.ts} +0 -0
- /package/dist/{events → modules/events}/utils/lineFunnel/lineFunnel.d.ts +0 -0
- /package/dist/{events/utils/steps/steps.test.d.ts → modules/events/utils/lineFunnel/lineFunnel.test.d.ts} +0 -0
- /package/dist/{events → modules/events}/utils/payload/payload.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/readEvent/readEvent.d.ts +0 -0
- /package/dist/{events → modules/events}/utils/steps/steps.d.ts +0 -0
- /package/dist/{orval-Bf_zcxLE.js → orval-BSFwOlVR.js} +0 -0
package/dist/main.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./operator-Cj1X_Zg5.js";
|
|
2
|
+
import { t as u } from "./orval-BSFwOlVR.js";
|
|
3
|
+
import { Suspense as d, createContext as f, lazy as p, useCallback as m, useContext as h, useEffect as g, useLayoutEffect as _, useMemo as v, useRef as y, useState as b } from "react";
|
|
4
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
4
5
|
import "dayjs/locale/ar";
|
|
5
6
|
import "dayjs/locale/de";
|
|
6
7
|
import "dayjs/locale/en";
|
|
@@ -8,115 +9,9 @@ import "dayjs/locale/es";
|
|
|
8
9
|
import "dayjs/locale/fr";
|
|
9
10
|
import "dayjs/locale/it";
|
|
10
11
|
import "dayjs/locale/pt";
|
|
11
|
-
//#region src/
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
getToken;
|
|
15
|
-
onEvent;
|
|
16
|
-
onConnectionChange;
|
|
17
|
-
shouldReconnect;
|
|
18
|
-
maxReconnectAttempts;
|
|
19
|
-
reconnectBaseDelay;
|
|
20
|
-
maxMessageBodyLength;
|
|
21
|
-
ws = null;
|
|
22
|
-
reconnectAttempt = 0;
|
|
23
|
-
reconnectTimer = null;
|
|
24
|
-
intentionalClose = !1;
|
|
25
|
-
joinedThreads = /* @__PURE__ */ new Set();
|
|
26
|
-
pendingMessages = [];
|
|
27
|
-
_connected = !1;
|
|
28
|
-
_ready = !1;
|
|
29
|
-
constructor(e) {
|
|
30
|
-
this.url = e.url, this.getToken = e.getToken, this.onEvent = e.onEvent, this.onConnectionChange = e.onConnectionChange, this.shouldReconnect = e.reconnect ?? !0, this.maxReconnectAttempts = e.maxReconnectAttempts ?? Infinity, this.reconnectBaseDelay = e.reconnectBaseDelay ?? p, this.maxMessageBodyLength = e.maxMessageBodyLength ?? m;
|
|
31
|
-
}
|
|
32
|
-
get connected() {
|
|
33
|
-
return this._connected;
|
|
34
|
-
}
|
|
35
|
-
get ready() {
|
|
36
|
-
return this._ready;
|
|
37
|
-
}
|
|
38
|
-
connect() {
|
|
39
|
-
let e = this.getToken();
|
|
40
|
-
if (!e) return;
|
|
41
|
-
this.intentionalClose = !1;
|
|
42
|
-
let t = this.url.includes("?") ? "&" : "?", n = `${this.url}${t}token=${e}`;
|
|
43
|
-
this.ws = new WebSocket(n), this.ws.onopen = () => {
|
|
44
|
-
this._connected = !0, this.reconnectAttempt = 0, this.onConnectionChange?.(!0), this.rejoinThreads(), this.flushPendingMessages();
|
|
45
|
-
}, this.ws.onmessage = (e) => {
|
|
46
|
-
try {
|
|
47
|
-
let t = h(JSON.parse(e.data));
|
|
48
|
-
t.type === "ready" && (this._ready = !0), this.onEvent?.(t);
|
|
49
|
-
} catch {}
|
|
50
|
-
}, this.ws.onclose = () => {
|
|
51
|
-
this._connected = !1, this._ready = !1, this.onConnectionChange?.(!1), !this.intentionalClose && this.shouldReconnect && this.reconnectAttempt < this.maxReconnectAttempts && this.scheduleReconnect();
|
|
52
|
-
}, this.ws.onerror = () => {};
|
|
53
|
-
}
|
|
54
|
-
disconnect() {
|
|
55
|
-
this.intentionalClose = !0, this.pendingMessages = [], this.clearReconnectTimer(), this.ws &&= (this.ws.close(), null);
|
|
56
|
-
}
|
|
57
|
-
joinThread(e) {
|
|
58
|
-
this.joinedThreads.add(e), this.send({
|
|
59
|
-
threadId: e,
|
|
60
|
-
type: "join_thread"
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
leaveThread(e) {
|
|
64
|
-
this.joinedThreads.delete(e), this.send({
|
|
65
|
-
threadId: e,
|
|
66
|
-
type: "leave_thread"
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
sendMessage(e, t) {
|
|
70
|
-
if (t.length > this.maxMessageBodyLength) throw Error(`Message body exceeds maximum length of ${this.maxMessageBodyLength} characters`);
|
|
71
|
-
this.send({
|
|
72
|
-
body: t,
|
|
73
|
-
threadId: e,
|
|
74
|
-
type: "send_message"
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
markRead(e) {
|
|
78
|
-
this.send({
|
|
79
|
-
threadId: e,
|
|
80
|
-
type: "mark_read"
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
listThreads(e, t) {
|
|
84
|
-
this.send({
|
|
85
|
-
limit: e,
|
|
86
|
-
offset: t,
|
|
87
|
-
type: "list_threads"
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
send(e) {
|
|
91
|
-
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
92
|
-
this.pendingMessages.push(e);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
this.ws.send(JSON.stringify(g(e)));
|
|
96
|
-
}
|
|
97
|
-
flushPendingMessages() {
|
|
98
|
-
let e = [...this.pendingMessages];
|
|
99
|
-
this.pendingMessages = [];
|
|
100
|
-
for (let t of e) this.send(t);
|
|
101
|
-
}
|
|
102
|
-
rejoinThreads() {
|
|
103
|
-
for (let e of this.joinedThreads) this.send({
|
|
104
|
-
threadId: e,
|
|
105
|
-
type: "join_thread"
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
scheduleReconnect() {
|
|
109
|
-
this.clearReconnectTimer();
|
|
110
|
-
let e = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, f);
|
|
111
|
-
this.reconnectAttempt++, this.reconnectTimer = setTimeout(() => {
|
|
112
|
-
this.connect();
|
|
113
|
-
}, e);
|
|
114
|
-
}
|
|
115
|
-
clearReconnectTimer() {
|
|
116
|
-
this.reconnectTimer !== null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
|
|
117
|
-
}
|
|
118
|
-
}, v = ({ IMaskMixin: e, ...t }) => /* @__PURE__ */ d(c(() => e(({ TextField: e, ...t }) => /* @__PURE__ */ d(e, { ...t })), [e]), { ...t }), y = n({}), b = ({ children: e, apiURL: t, libraries: n, localStorageKeys: r }) => {
|
|
119
|
-
let i = c(() => ({
|
|
12
|
+
//#region src/components/Inputs/MaskTextField.tsx
|
|
13
|
+
var S = ({ IMaskMixin: e, ...t }) => /* @__PURE__ */ x(v(() => e(({ TextField: e, ...t }) => /* @__PURE__ */ x(e, { ...t })), [e]), { ...t }), C = f({}), w = ({ children: e, apiURL: t, libraries: n, localStorageKeys: r }) => {
|
|
14
|
+
let i = v(() => ({
|
|
120
15
|
apiURL: t,
|
|
121
16
|
libraries: n,
|
|
122
17
|
localStorageKeys: r
|
|
@@ -125,34 +20,34 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
125
20
|
n,
|
|
126
21
|
r
|
|
127
22
|
]);
|
|
128
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ x(C.Provider, {
|
|
129
24
|
value: i,
|
|
130
25
|
children: e
|
|
131
26
|
});
|
|
132
|
-
},
|
|
27
|
+
}, T = 900 * 1e3, E = 60 * 1e3, ee = 600 * 1e3, D = "auto-reload-on-new-version-timestamp", O = /<meta[^>]*name="version"[^>]*content="([^"]*)"/, k = (e) => {
|
|
133
28
|
try {
|
|
134
29
|
return sessionStorage.getItem(e);
|
|
135
30
|
} catch {
|
|
136
31
|
return null;
|
|
137
32
|
}
|
|
138
|
-
},
|
|
33
|
+
}, te = (e, t) => {
|
|
139
34
|
try {
|
|
140
35
|
sessionStorage.setItem(e, t);
|
|
141
36
|
} catch {}
|
|
142
|
-
},
|
|
143
|
-
let { libraries: i } =
|
|
144
|
-
if (!
|
|
145
|
-
let { useLocation:
|
|
146
|
-
return
|
|
37
|
+
}, ne = ({ version: e, checkInterval: t = T, children: n, ...r }) => {
|
|
38
|
+
let { libraries: i } = h(C), a = r?.reactRouter || i?.reactRouter, o = y(!1), s = y(0);
|
|
39
|
+
if (!a) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of AutoReloadOnNewVersion.");
|
|
40
|
+
let { useLocation: c, Outlet: l } = a, { pathname: u } = c(), d = y(u);
|
|
41
|
+
return g(() => {
|
|
147
42
|
if (!e || typeof window > "u") return;
|
|
148
43
|
let n = async () => {
|
|
149
|
-
if (!(
|
|
150
|
-
|
|
44
|
+
if (!(o.current || Date.now() - s.current < E)) {
|
|
45
|
+
s.current = Date.now();
|
|
151
46
|
try {
|
|
152
47
|
let t = await fetch("/index.html", { cache: "no-store" });
|
|
153
48
|
if (!t.ok) return;
|
|
154
|
-
let n = (await t.text()).match(
|
|
155
|
-
n && n !== "%VERSION%" && n !== e && (
|
|
49
|
+
let n = (await t.text()).match(O)?.[1];
|
|
50
|
+
n && n !== "%VERSION%" && n !== e && (o.current = !0);
|
|
156
51
|
} catch {}
|
|
157
52
|
}
|
|
158
53
|
}, r = () => {
|
|
@@ -161,28 +56,28 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
161
56
|
return document.addEventListener("visibilitychange", r), () => {
|
|
162
57
|
clearInterval(i), document.removeEventListener("visibilitychange", r);
|
|
163
58
|
};
|
|
164
|
-
}, [e, t]),
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
let e = Number(
|
|
168
|
-
Date.now() - e <
|
|
169
|
-
}, [
|
|
170
|
-
},
|
|
171
|
-
let { libraries: n } =
|
|
59
|
+
}, [e, t]), g(() => {
|
|
60
|
+
if (u === d.current || (d.current = u, !o.current)) return;
|
|
61
|
+
o.current = !1;
|
|
62
|
+
let e = Number(k(D) || "0");
|
|
63
|
+
Date.now() - e < ee || (te(D, String(Date.now())), window.location.reload());
|
|
64
|
+
}, [u]), n ?? /* @__PURE__ */ x(l, {});
|
|
65
|
+
}, re = ({ data: e, ...t }) => {
|
|
66
|
+
let { libraries: n } = h(C), r = t?.reactRouter || n?.reactRouter, i = t?.gtm || n?.gtm;
|
|
172
67
|
if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
173
68
|
if (!i) throw Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
174
|
-
let { useGoogleTagManager:
|
|
175
|
-
return
|
|
176
|
-
|
|
69
|
+
let { useGoogleTagManager: a } = i, { useLocation: o, Outlet: s } = r, { pathname: c } = o(), { sendEvent: l } = a();
|
|
70
|
+
return g(() => {
|
|
71
|
+
l({
|
|
177
72
|
event: "pageView",
|
|
178
|
-
pathname:
|
|
73
|
+
pathname: c,
|
|
179
74
|
...e
|
|
180
75
|
});
|
|
181
76
|
}, [
|
|
182
77
|
e,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
]), /* @__PURE__ */
|
|
78
|
+
c,
|
|
79
|
+
l
|
|
80
|
+
]), /* @__PURE__ */ x(s, {});
|
|
186
81
|
}, A = "[data-amp-track-feature]", j = [
|
|
187
82
|
"a",
|
|
188
83
|
"button",
|
|
@@ -195,80 +90,80 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
195
90
|
"[contenteditable=\"true\" i]",
|
|
196
91
|
"[data-amp-default-track]",
|
|
197
92
|
".amp-default-track"
|
|
198
|
-
],
|
|
93
|
+
], M = { defaultMaskLevel: "medium" }, ie = (e, t) => {
|
|
199
94
|
if (e === !1) return !1;
|
|
200
95
|
let n = e === !0 ? {} : e;
|
|
201
96
|
return {
|
|
202
97
|
cssSelectorAllowlist: [...t, A],
|
|
203
98
|
...n
|
|
204
99
|
};
|
|
205
|
-
},
|
|
100
|
+
}, ae = (e, t) => !t || e === !1 ? !1 : {
|
|
206
101
|
deadClicks: !0,
|
|
207
102
|
rageClicks: !0,
|
|
208
103
|
...e === !0 ? {} : e
|
|
209
|
-
},
|
|
210
|
-
let [
|
|
104
|
+
}, oe = ({ apiKey: e, appVersion: t, sessionReplaySampleRate: n, serverZone: r, elementInteractions: i = !0, frustrationInteractions: a = !0, platform: o = "desktop", sessionReplayPrivacy: s = M, userId: c, ...l }) => {
|
|
105
|
+
let [u, d] = b(!!c), { libraries: f } = h(C), p = l.amplitude || f?.amplitude, m = y({
|
|
211
106
|
elementInteractions: i,
|
|
212
|
-
frustrationInteractions:
|
|
213
|
-
sessionReplayPrivacy:
|
|
214
|
-
}),
|
|
215
|
-
return
|
|
216
|
-
|
|
107
|
+
frustrationInteractions: a,
|
|
108
|
+
sessionReplayPrivacy: s
|
|
109
|
+
}), v = y(c);
|
|
110
|
+
return c && !u && d(!0), _(() => {
|
|
111
|
+
m.current = {
|
|
217
112
|
elementInteractions: i,
|
|
218
|
-
frustrationInteractions:
|
|
219
|
-
sessionReplayPrivacy:
|
|
220
|
-
},
|
|
221
|
-
}),
|
|
222
|
-
let i =
|
|
223
|
-
if (!(e && i &&
|
|
224
|
-
let { elementInteractions:
|
|
225
|
-
return i.init(e,
|
|
113
|
+
frustrationInteractions: a,
|
|
114
|
+
sessionReplayPrivacy: s
|
|
115
|
+
}, v.current = c;
|
|
116
|
+
}), g(() => {
|
|
117
|
+
let i = p?.analytics, a = p?.sessionReplayPlugin;
|
|
118
|
+
if (!(e && i && u)) return;
|
|
119
|
+
let { elementInteractions: s, frustrationInteractions: c, sessionReplayPrivacy: l } = m.current, d = v.current, f = !d, h = "platform-enrichment", g = ie(s, i.Types?.DEFAULT_CSS_SELECTOR_ALLOWLIST ?? j);
|
|
120
|
+
return i.init(e, d, {
|
|
226
121
|
appVersion: t,
|
|
227
122
|
autocapture: {
|
|
228
|
-
elementInteractions:
|
|
229
|
-
frustrationInteractions:
|
|
123
|
+
elementInteractions: g,
|
|
124
|
+
frustrationInteractions: ae(c, g !== !1),
|
|
230
125
|
pageViews: { trackHistoryChanges: "pathOnly" }
|
|
231
126
|
},
|
|
232
|
-
optOut:
|
|
127
|
+
optOut: f,
|
|
233
128
|
serverZone: r
|
|
234
|
-
}), i.setOptOut(
|
|
235
|
-
privacyConfig:
|
|
129
|
+
}), i.setOptOut(f), a && i.add(a({
|
|
130
|
+
privacyConfig: l,
|
|
236
131
|
...n === void 0 ? {} : { sampleRate: n }
|
|
237
132
|
})), i.add({
|
|
238
133
|
execute: async (e) => ({
|
|
239
134
|
...e,
|
|
240
135
|
event_properties: {
|
|
241
136
|
...e.event_properties,
|
|
242
|
-
platform:
|
|
137
|
+
platform: o
|
|
243
138
|
}
|
|
244
139
|
}),
|
|
245
|
-
name:
|
|
140
|
+
name: h,
|
|
246
141
|
type: "enrichment"
|
|
247
142
|
}), () => {
|
|
248
|
-
a && i.remove("@amplitude/plugin-session-replay-browser"), i.remove(
|
|
143
|
+
a && i.remove("@amplitude/plugin-session-replay-browser"), i.remove(h), i.setOptOut(!0);
|
|
249
144
|
};
|
|
250
145
|
}, [
|
|
251
146
|
e,
|
|
252
|
-
|
|
147
|
+
p,
|
|
253
148
|
t,
|
|
254
|
-
|
|
149
|
+
o,
|
|
255
150
|
r,
|
|
256
151
|
n,
|
|
257
|
-
|
|
258
|
-
]),
|
|
259
|
-
let t =
|
|
260
|
-
if (e && t &&
|
|
261
|
-
if (!
|
|
152
|
+
u
|
|
153
|
+
]), g(() => {
|
|
154
|
+
let t = p?.analytics;
|
|
155
|
+
if (e && t && u) {
|
|
156
|
+
if (!c) {
|
|
262
157
|
t.setOptOut(!0);
|
|
263
158
|
return;
|
|
264
159
|
}
|
|
265
|
-
t.setUserId(
|
|
160
|
+
t.setUserId(c), t.setOptOut(!1);
|
|
266
161
|
}
|
|
267
162
|
}, [
|
|
268
163
|
e,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
164
|
+
p,
|
|
165
|
+
u,
|
|
166
|
+
c
|
|
272
167
|
]), null;
|
|
273
168
|
}, N = (() => {
|
|
274
169
|
try {
|
|
@@ -276,16 +171,16 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
276
171
|
} catch {
|
|
277
172
|
return !1;
|
|
278
173
|
}
|
|
279
|
-
})(),
|
|
280
|
-
let { apiURL: i = r.apiURL, libraries:
|
|
281
|
-
if (!
|
|
282
|
-
if (!
|
|
174
|
+
})(), se = "user", ce = ({ tokenTypeKey: e = "tokenType", tokenKey: t = "accessToken", postContentType: n = "application/json", ...r }) => {
|
|
175
|
+
let { apiURL: i = r.apiURL, libraries: a, localStorageKeys: o } = h(C), s = r?.userLocalStorageKey || o?.user || se, c = r?.axios || a?.axios;
|
|
176
|
+
if (!c) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
177
|
+
if (!c?.defaults || N) return null;
|
|
283
178
|
if (typeof window < "u" && window.localStorage) {
|
|
284
|
-
let n = localStorage.getItem(
|
|
285
|
-
o && (
|
|
179
|
+
let n = localStorage.getItem(s), r = n ? JSON.parse(n) : null, i = r?.[e] ? r[e] : null, a = r?.[t] ? r[t] : null, o = n ? `${i} ${a}` : null;
|
|
180
|
+
o && (c.defaults.headers.common.Authorization = o);
|
|
286
181
|
}
|
|
287
|
-
return
|
|
288
|
-
},
|
|
182
|
+
return c.defaults.baseURL = i, c.defaults.headers.post["Content-Type"] = n, null;
|
|
183
|
+
}, le = [
|
|
289
184
|
"ar",
|
|
290
185
|
"de",
|
|
291
186
|
"en",
|
|
@@ -293,33 +188,33 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
293
188
|
"fr",
|
|
294
189
|
"it",
|
|
295
190
|
"pt"
|
|
296
|
-
],
|
|
297
|
-
let { libraries: n } =
|
|
191
|
+
], ue = (e) => le.includes(e), de = ({ language: e, ...t }) => {
|
|
192
|
+
let { libraries: n } = h(C), r = t?.dayjs || n?.dayjs, i = t?.plugin || n?.dayjsPlugin;
|
|
298
193
|
if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");
|
|
299
194
|
r.extend(t.localizedFormat), i && i.forEach((e) => {
|
|
300
195
|
e && r.extend(e);
|
|
301
196
|
});
|
|
302
|
-
let
|
|
303
|
-
return r.locale() !==
|
|
304
|
-
},
|
|
197
|
+
let a = e || navigator.language?.slice(0, 2) || "en", o = ue(a) ? a : "en";
|
|
198
|
+
return r.locale() !== o && r.locale(o), null;
|
|
199
|
+
}, P = "hubspot-messages-iframe-container", F = "hs-show", I = "data-hs-hidden", fe = ({ hubId: e }) => (g(() => {
|
|
305
200
|
if (!e) return;
|
|
306
201
|
let t = document.createElement("script");
|
|
307
202
|
return t.id = "hs-script-loader", t.src = `//js-eu1.hs-scripts.com/${e}.js`, t.async = !0, t.defer = !0, document.body.appendChild(t), () => {
|
|
308
203
|
t.remove();
|
|
309
204
|
};
|
|
310
|
-
}, [e]),
|
|
205
|
+
}, [e]), g(() => {
|
|
311
206
|
let e = document.createElement("style");
|
|
312
207
|
return e.textContent = `
|
|
313
|
-
html[${
|
|
314
|
-
html[${
|
|
315
|
-
`, document.head.appendChild(e), document.documentElement.setAttribute(
|
|
316
|
-
e.remove(), document.documentElement.removeAttribute(
|
|
208
|
+
html[${I}] div#${P} { display: none !important; }
|
|
209
|
+
html[${I}] div#${P}.${F} { display: initial !important; }
|
|
210
|
+
`, document.head.appendChild(e), document.documentElement.setAttribute(I, ""), () => {
|
|
211
|
+
e.remove(), document.documentElement.removeAttribute(I);
|
|
317
212
|
};
|
|
318
|
-
}, []), null),
|
|
319
|
-
let { libraries: r } =
|
|
213
|
+
}, []), null), pe = ({ debug: e, resources: t, ...n }) => {
|
|
214
|
+
let { libraries: r } = h(C), i = n?.i18 || r?.i18, { i18next: a, initReactI18next: o, languageDetector: s } = i || {};
|
|
320
215
|
if (N) return null;
|
|
321
|
-
if (!(i &&
|
|
322
|
-
return
|
|
216
|
+
if (!(i && a && s && o)) throw Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
217
|
+
return a.isInitialized ? null : (a.use(s).use(o).init({
|
|
323
218
|
debug: e,
|
|
324
219
|
fallbackLng: "en",
|
|
325
220
|
interpolation: { escapeValue: !1 },
|
|
@@ -331,20 +226,20 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
331
226
|
resources: t,
|
|
332
227
|
returnNull: !1
|
|
333
228
|
}).then(() => {
|
|
334
|
-
document.documentElement.lang !==
|
|
335
|
-
}),
|
|
229
|
+
document.documentElement.lang !== a.resolvedLanguage && a.resolvedLanguage && document.documentElement.setAttribute("lang", a.resolvedLanguage);
|
|
230
|
+
}), a.on("languageChanged", (e) => {
|
|
336
231
|
document.documentElement.setAttribute("lang", e);
|
|
337
232
|
}), null);
|
|
338
|
-
},
|
|
339
|
-
let { libraries:
|
|
340
|
-
if (!
|
|
233
|
+
}, me = { replay: "keep" }, he = (e) => e.tags?.replay === me.replay, L = [/^https:\/\/(api|events)\.mapbox\.com\//], R = (e, t) => t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e)), ge = ({ dsn: e, integrations: t, tracesSampleRate: n, tracePropagationTargets: r, ignoreErrors: i, ignoreRequestUrls: a, debug: o, environment: s, release: c, replaysSessionSampleRate: l = 0, replaysOnErrorSampleRate: u = 1, replayBeforeErrorSampling: d = he, ...f }) => {
|
|
234
|
+
let { libraries: p } = h(C), m = f?.sentry || p?.sentry, _ = f?.reactRouter || p?.reactRouter;
|
|
235
|
+
if (!m) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
341
236
|
if (!_) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
342
|
-
if (
|
|
343
|
-
let { createRoutesFromChildren: v, matchRoutes:
|
|
344
|
-
return (
|
|
345
|
-
debug:
|
|
237
|
+
if (m.isInitialized()) return null;
|
|
238
|
+
let { createRoutesFromChildren: v, matchRoutes: y, useLocation: b, useNavigationType: x } = _, S = l > 0 || u > 0, w = [...a || [], ...L];
|
|
239
|
+
return (o || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && m.init({
|
|
240
|
+
debug: o,
|
|
346
241
|
dsn: e,
|
|
347
|
-
environment:
|
|
242
|
+
environment: s || "production",
|
|
348
243
|
ignoreErrors: [
|
|
349
244
|
...i || [],
|
|
350
245
|
/dynamically imported module/,
|
|
@@ -355,175 +250,82 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
355
250
|
/vite:preloadError/
|
|
356
251
|
],
|
|
357
252
|
integrations: [
|
|
358
|
-
|
|
253
|
+
m.reactRouterV6BrowserTracingIntegration({
|
|
359
254
|
createRoutesFromChildren: v,
|
|
360
|
-
matchRoutes:
|
|
361
|
-
shouldCreateSpanForRequest: (e) => !
|
|
362
|
-
useEffect:
|
|
363
|
-
useLocation:
|
|
364
|
-
useNavigationType:
|
|
255
|
+
matchRoutes: y,
|
|
256
|
+
shouldCreateSpanForRequest: (e) => !R(e, w),
|
|
257
|
+
useEffect: g,
|
|
258
|
+
useLocation: b,
|
|
259
|
+
useNavigationType: x
|
|
365
260
|
}),
|
|
366
|
-
...
|
|
261
|
+
...S ? [m.replayIntegration({ beforeErrorSampling: d })] : [],
|
|
367
262
|
...t || []
|
|
368
263
|
],
|
|
369
|
-
release:
|
|
370
|
-
replaysOnErrorSampleRate:
|
|
371
|
-
replaysSessionSampleRate:
|
|
264
|
+
release: c,
|
|
265
|
+
replaysOnErrorSampleRate: u,
|
|
266
|
+
replaysSessionSampleRate: l,
|
|
372
267
|
tracePropagationTargets: r,
|
|
373
268
|
tracesSampleRate: n ?? 1
|
|
374
269
|
}), null;
|
|
375
|
-
},
|
|
376
|
-
let { libraries:
|
|
377
|
-
if (!
|
|
378
|
-
let [
|
|
379
|
-
return
|
|
380
|
-
|
|
270
|
+
}, z = /* @__PURE__ */ new WeakMap(), _e = "user", ve = ({ Fallback: e, isLogged: t, loginPath: n = "/login", redirect401Path: r = "/login", ...i }) => {
|
|
271
|
+
let { libraries: a, localStorageKeys: o } = h(C), s = i?.reactRouter || a?.reactRouter, c = i?.axios || a?.axios, l = i?.localStorageKey || o?.user || _e;
|
|
272
|
+
if (!s) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
273
|
+
let [u, f] = b(null), { useLocation: p, Navigate: m, Outlet: _ } = s, v = p(), y = typeof t == "function" ? t() : !!t, S = typeof y == "boolean" ? y : y?.isLogged;
|
|
274
|
+
return g(() => {
|
|
275
|
+
c && (z.has(c) || (z.set(c, !0), c.interceptors.response.use((e) => e, (e) => (typeof e == "object" && e && "response" in e && e.response && typeof e.response == "object" && "status" in e.response && e.response && typeof e.response == "object" && "status" in e.response && e?.response?.status === 401 && (typeof e == "object" && e && "config" in e && e.config && typeof e.config == "object" && "headers" in e.config && e.config.headers && typeof e.config.headers == "object" && "Authorization" in e.config.headers && e.config.headers.Authorization && (c.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(l)), f(r)), Promise.reject(e)))));
|
|
381
276
|
}, [
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
]),
|
|
277
|
+
c,
|
|
278
|
+
l,
|
|
279
|
+
r
|
|
280
|
+
]), S && !u ? /* @__PURE__ */ x(d, {
|
|
386
281
|
fallback: e,
|
|
387
|
-
children:
|
|
388
|
-
to:
|
|
282
|
+
children: v.state?.from?.state && v.state?.from?.pathname === n ? /* @__PURE__ */ x(m, {
|
|
283
|
+
to: v.state.from.state.from.pathname + v.state.from.state.from.search,
|
|
389
284
|
replace: !0
|
|
390
|
-
}) : /* @__PURE__ */
|
|
391
|
-
}) : /* @__PURE__ */
|
|
392
|
-
to:
|
|
393
|
-
state: { from:
|
|
285
|
+
}) : /* @__PURE__ */ x(_, {})
|
|
286
|
+
}) : /* @__PURE__ */ x(m, {
|
|
287
|
+
to: n + v.search,
|
|
288
|
+
state: { from: v },
|
|
394
289
|
replace: !0
|
|
395
290
|
});
|
|
396
|
-
},
|
|
291
|
+
}, B = /* @__PURE__ */ new Set(), ye = () => (g(() => {
|
|
397
292
|
let e = Symbol();
|
|
398
|
-
return
|
|
399
|
-
|
|
400
|
-
};
|
|
401
|
-
}, []), null), he = "user", ge = {
|
|
402
|
-
client: "/v2/threads/ws",
|
|
403
|
-
supplier: "/v1/threads/ws"
|
|
404
|
-
}, _e = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, ve = (e) => {
|
|
405
|
-
try {
|
|
406
|
-
let t = localStorage.getItem(e);
|
|
407
|
-
return t ? JSON.parse(t)?.accessToken ?? null : null;
|
|
408
|
-
} catch {
|
|
409
|
-
return null;
|
|
410
|
-
}
|
|
411
|
-
}, H = n(null), ye = ({ children: e, token: t, url: n, wsPath: r, maxReconnectAttempts: s, reconnectBaseDelay: c, maxMessageBodyLength: f = 1e4, reconnect: p = !0, enabled: m = !0, context: h = "client" }) => {
|
|
412
|
-
let [g, v] = u(!1), [b, x] = u(!1), [S, C] = u(0), [w, T] = u(m), E = m && w, { apiURL: D, localStorageKeys: O } = a(y), k = O?.user || he, A = l(null), j = l(/* @__PURE__ */ new Set());
|
|
413
|
-
o(() => {
|
|
414
|
-
if (!E) return;
|
|
415
|
-
let e = r ?? ge[h], i = n || (D ? _e(D, e) : null);
|
|
416
|
-
if (!i) return;
|
|
417
|
-
let a = () => t ?? ve(k), o = (e) => {
|
|
418
|
-
switch (e.type) {
|
|
419
|
-
case "ready":
|
|
420
|
-
x(!0), C(e.unreadCount ?? 0);
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
for (let t of j.current) t(e);
|
|
424
|
-
}, l = setTimeout(() => {
|
|
425
|
-
let e = new _({
|
|
426
|
-
getToken: a,
|
|
427
|
-
maxMessageBodyLength: f,
|
|
428
|
-
maxReconnectAttempts: s,
|
|
429
|
-
onConnectionChange: (e) => {
|
|
430
|
-
v(e), e || x(!1);
|
|
431
|
-
},
|
|
432
|
-
onEvent: o,
|
|
433
|
-
reconnect: p,
|
|
434
|
-
reconnectBaseDelay: c,
|
|
435
|
-
url: i
|
|
436
|
-
});
|
|
437
|
-
A.current = e, e.connect();
|
|
438
|
-
}, 0);
|
|
439
|
-
return () => {
|
|
440
|
-
clearTimeout(l), A.current?.disconnect(), A.current = null;
|
|
441
|
-
};
|
|
442
|
-
}, [
|
|
443
|
-
E,
|
|
444
|
-
n,
|
|
445
|
-
r,
|
|
446
|
-
h,
|
|
447
|
-
t,
|
|
448
|
-
p,
|
|
449
|
-
D,
|
|
450
|
-
k,
|
|
451
|
-
f,
|
|
452
|
-
s,
|
|
453
|
-
c
|
|
454
|
-
]);
|
|
455
|
-
let ee = i((e) => {
|
|
456
|
-
A.current?.joinThread(e);
|
|
457
|
-
}, []), te = i((e) => {
|
|
458
|
-
A.current?.leaveThread(e);
|
|
459
|
-
}, []), ne = i((e, t) => {
|
|
460
|
-
A.current?.sendMessage(e, t);
|
|
461
|
-
}, []), M = i((e) => {
|
|
462
|
-
A.current?.markRead(e);
|
|
463
|
-
}, []), N = i((e, t) => {
|
|
464
|
-
A.current?.listThreads(e, t);
|
|
465
|
-
}, []), P = i((e = 1) => {
|
|
466
|
-
C((t) => t + e);
|
|
467
|
-
}, []), F = {
|
|
468
|
-
decrementUnreadCount: i((e = 1) => {
|
|
469
|
-
C((t) => Math.max(0, t - e));
|
|
470
|
-
}, []),
|
|
471
|
-
disconnect: i(() => {
|
|
472
|
-
A.current?.disconnect(), A.current = null;
|
|
473
|
-
}, []),
|
|
474
|
-
incrementUnreadCount: P,
|
|
475
|
-
isConnected: g,
|
|
476
|
-
isReady: b,
|
|
477
|
-
joinThread: ee,
|
|
478
|
-
leaveThread: te,
|
|
479
|
-
listThreads: N,
|
|
480
|
-
markRead: M,
|
|
481
|
-
sendMessage: ne,
|
|
482
|
-
setEnabled: i((e) => {
|
|
483
|
-
T(e);
|
|
484
|
-
}, []),
|
|
485
|
-
subscribe: i((e) => (j.current.add(e), () => {
|
|
486
|
-
j.current.delete(e);
|
|
487
|
-
}), []),
|
|
488
|
-
unreadCount: S
|
|
293
|
+
return B.add(e), document.documentElement.removeAttribute(I), () => {
|
|
294
|
+
B.delete(e), B.size === 0 && document.documentElement.setAttribute(I, "");
|
|
489
295
|
};
|
|
490
|
-
|
|
491
|
-
value: F,
|
|
492
|
-
children: e
|
|
493
|
-
});
|
|
494
|
-
}, be = 3, xe = new Set([
|
|
296
|
+
}, []), null), be = 3, xe = new Set([
|
|
495
297
|
400,
|
|
496
298
|
401,
|
|
497
299
|
403,
|
|
498
300
|
404
|
|
499
|
-
]), Se = (e) => e?.response?.status,
|
|
301
|
+
]), Se = (e) => e?.response?.status, V = (e, t) => {
|
|
500
302
|
let n = Se(t);
|
|
501
303
|
return e < be && !(n !== void 0 && xe.has(n));
|
|
502
304
|
}, Ce = (e, t, n) => (Array.isArray(e) ? e.length : 0) + (typeof n == "number" ? n : 0), we = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
|
|
503
|
-
let { libraries: i } =
|
|
504
|
-
if (!
|
|
505
|
-
if (!
|
|
506
|
-
let [
|
|
305
|
+
let { libraries: i } = h(C), a = r.QueryClient || i?.reactQuery?.QueryClient, o = r.QueryClientProvider || i?.reactQuery?.QueryClientProvider;
|
|
306
|
+
if (!a) throw Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
307
|
+
if (!o) throw Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
308
|
+
let [s] = b(() => new a({ defaultOptions: {
|
|
507
309
|
mutations: n,
|
|
508
310
|
queries: {
|
|
509
311
|
getNextPageParam: Ce,
|
|
510
|
-
retry:
|
|
312
|
+
retry: V,
|
|
511
313
|
...t
|
|
512
314
|
}
|
|
513
315
|
} }));
|
|
514
|
-
return /* @__PURE__ */
|
|
515
|
-
client:
|
|
316
|
+
return /* @__PURE__ */ x(o, {
|
|
317
|
+
client: s,
|
|
516
318
|
children: e
|
|
517
319
|
});
|
|
518
|
-
},
|
|
320
|
+
}, H = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), U = (e, t) => {
|
|
519
321
|
let { fractionDigits: n = 0, metric: r = "km", spacingBetween: i = !0 } = t || {}, a = Number(e), o = i ? " " : "";
|
|
520
322
|
return Number.isNaN(a) ? `0${o}${r}` : `${a.toFixed(n)}${o}${r}`;
|
|
521
|
-
},
|
|
323
|
+
}, W = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((e) => e.length > 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" "), Te = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, Ee = ({ path: e, size: t, apiURL: n }) => {
|
|
522
324
|
if (!e) return "";
|
|
523
325
|
let r = `${n}${Te(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
524
326
|
return typeof t == "number" && i ? `${r.replace("/files", `/thumbs/${t}`)}` : r;
|
|
525
327
|
}, De = (e) => {
|
|
526
|
-
let { apiURL: t, libraries: n } =
|
|
328
|
+
let { apiURL: t, libraries: n } = h(C), r = e?.dayjs || n?.dayjs, i = m((e, n) => {
|
|
527
329
|
if (!t) throw Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");
|
|
528
330
|
return typeof e == "string" && /^https?:\/\//.test(e) ? e : Ee({
|
|
529
331
|
apiURL: t,
|
|
@@ -532,60 +334,60 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
532
334
|
});
|
|
533
335
|
}, [t]);
|
|
534
336
|
return {
|
|
535
|
-
dateAdapter:
|
|
337
|
+
dateAdapter: m((e, t) => {
|
|
536
338
|
if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
537
|
-
return
|
|
339
|
+
return H({
|
|
538
340
|
date: e,
|
|
539
341
|
format: t,
|
|
540
342
|
library: r
|
|
541
343
|
});
|
|
542
344
|
}, [r]),
|
|
543
|
-
distanceAdapter:
|
|
544
|
-
filePathAdapter:
|
|
545
|
-
worksiteNameAdapter:
|
|
345
|
+
distanceAdapter: U,
|
|
346
|
+
filePathAdapter: i,
|
|
347
|
+
worksiteNameAdapter: W
|
|
546
348
|
};
|
|
547
349
|
}, Oe = () => {
|
|
548
|
-
let { libraries: e } =
|
|
350
|
+
let { libraries: e } = h(C), t = e?.amplitude?.analytics, n = m((e, n) => {
|
|
549
351
|
if (!t || (t.setUserId(e), !n)) return;
|
|
550
352
|
let r = new t.Identify();
|
|
551
353
|
Object.entries(n).forEach(([e, t]) => {
|
|
552
354
|
r.set(e, t);
|
|
553
355
|
}), t.identify(r);
|
|
554
|
-
}, [t]), r =
|
|
356
|
+
}, [t]), r = m((e, n, r) => {
|
|
555
357
|
if (!t || (t.setGroup(e, n), !r)) return;
|
|
556
358
|
let i = new t.Identify();
|
|
557
359
|
Object.entries(r).forEach(([e, t]) => {
|
|
558
360
|
i.set(e, t);
|
|
559
361
|
}), t.groupIdentify(e, n, i);
|
|
560
|
-
}, [t]),
|
|
362
|
+
}, [t]), i = m((e, n) => {
|
|
561
363
|
t && t.track(e, n);
|
|
562
364
|
}, [t]);
|
|
563
365
|
return {
|
|
564
366
|
identify: n,
|
|
565
|
-
reset:
|
|
367
|
+
reset: m(() => {
|
|
566
368
|
t && (t.setOptOut(!0), t.reset());
|
|
567
369
|
}, [t]),
|
|
568
370
|
setGroup: r,
|
|
569
|
-
track:
|
|
371
|
+
track: i
|
|
570
372
|
};
|
|
571
373
|
}, ke = (e) => {
|
|
572
|
-
let { libraries: t, localStorageKeys: n } =
|
|
374
|
+
let { libraries: t, localStorageKeys: n } = h(C), r = e?.axios || t?.axios, i = e?.localStorageKey || n?.user || "user";
|
|
573
375
|
if (!r) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
574
|
-
let
|
|
376
|
+
let a = m(({ tokenType: e, accessToken: t }) => {
|
|
575
377
|
r.defaults.headers.common.Authorization = `${e} ${t}`;
|
|
576
|
-
}, [r.defaults.headers.common]),
|
|
378
|
+
}, [r.defaults.headers.common]), o = m(() => {
|
|
577
379
|
r.defaults.headers.common.Authorization = null;
|
|
578
380
|
}, [r.defaults.headers.common]);
|
|
579
|
-
return
|
|
381
|
+
return g(() => {
|
|
580
382
|
if (N) return;
|
|
581
383
|
let e = ({ newValue: e, key: t }) => {
|
|
582
|
-
if (t ===
|
|
384
|
+
if (t === i) try {
|
|
583
385
|
let { accessToken: t, tokenType: n } = JSON.parse(e ?? "null") ?? {};
|
|
584
386
|
if (!t) {
|
|
585
|
-
|
|
387
|
+
o();
|
|
586
388
|
return;
|
|
587
389
|
}
|
|
588
|
-
|
|
390
|
+
a({
|
|
589
391
|
accessToken: t,
|
|
590
392
|
tokenType: n
|
|
591
393
|
});
|
|
@@ -597,140 +399,80 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
597
399
|
window.removeEventListener("storage", e);
|
|
598
400
|
};
|
|
599
401
|
}, [
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
402
|
+
o,
|
|
403
|
+
i,
|
|
404
|
+
a
|
|
603
405
|
]), {
|
|
604
|
-
clearAuthenticationToken:
|
|
605
|
-
setAuthenticationToken:
|
|
406
|
+
clearAuthenticationToken: o,
|
|
407
|
+
setAuthenticationToken: a
|
|
606
408
|
};
|
|
607
|
-
},
|
|
608
|
-
if (!("Notification" in window) || typeof Notification != "function" || Notification.permission !== "granted" || !document.hidden) return;
|
|
609
|
-
let n = new Notification(t.title ?? Ae, {
|
|
610
|
-
badge: t?.badge,
|
|
611
|
-
body: t?.body || e.bodyPreview,
|
|
612
|
-
data: t?.data,
|
|
613
|
-
dir: t?.dir,
|
|
614
|
-
icon: t?.icon,
|
|
615
|
-
lang: t?.lang,
|
|
616
|
-
requireInteraction: t?.requireInteraction,
|
|
617
|
-
silent: t?.silent,
|
|
618
|
-
tag: t?.tag || e.messageId
|
|
619
|
-
});
|
|
620
|
-
if (t.onClick) {
|
|
621
|
-
let { onClick: r } = t;
|
|
622
|
-
n.onclick = () => r(e);
|
|
623
|
-
}
|
|
624
|
-
}, Me = (e) => {
|
|
625
|
-
let t = a(H);
|
|
626
|
-
if (!t) throw Error("useChat must be used within ChatProvider");
|
|
627
|
-
let { subscribe: n, setEnabled: r, ...i } = t, s = l(e);
|
|
628
|
-
return s.current = e, o(() => {
|
|
629
|
-
e?.enabled !== void 0 && r(e.enabled);
|
|
630
|
-
}, [e?.enabled, r]), o(() => {
|
|
631
|
-
e?.browserNotification && e.browserNotification.enabled !== !1 && "Notification" in window && Notification.permission === "default" && typeof Notification.requestPermission == "function" && Notification.requestPermission();
|
|
632
|
-
}, [e?.browserNotification]), o(() => n((e) => {
|
|
633
|
-
let { browserNotification: t, onReady: n, onNewMessage: r, onNewMessageNotification: i, onPresence: a, onError: o, onJoinedThread: c, onLeftThread: l, onMarkedRead: u, onThreadArchived: d, onThreadsList: f } = s.current ?? {};
|
|
634
|
-
switch (e.type) {
|
|
635
|
-
case "ready":
|
|
636
|
-
n?.(e);
|
|
637
|
-
break;
|
|
638
|
-
case "new_message":
|
|
639
|
-
r?.(e);
|
|
640
|
-
break;
|
|
641
|
-
case "new_message_notification":
|
|
642
|
-
i?.(e), t && t.enabled !== !1 && je(e, t);
|
|
643
|
-
break;
|
|
644
|
-
case "presence":
|
|
645
|
-
a?.(e);
|
|
646
|
-
break;
|
|
647
|
-
case "error":
|
|
648
|
-
o?.(e);
|
|
649
|
-
break;
|
|
650
|
-
case "joined_thread":
|
|
651
|
-
c?.(e);
|
|
652
|
-
break;
|
|
653
|
-
case "left_thread":
|
|
654
|
-
l?.(e);
|
|
655
|
-
break;
|
|
656
|
-
case "marked_read":
|
|
657
|
-
u?.(e);
|
|
658
|
-
break;
|
|
659
|
-
case "thread_archived":
|
|
660
|
-
d?.(e);
|
|
661
|
-
break;
|
|
662
|
-
case "threads_list":
|
|
663
|
-
f?.(e);
|
|
664
|
-
break;
|
|
665
|
-
}
|
|
666
|
-
}), [n]), i;
|
|
667
|
-
}, q = (e, t = "full") => {
|
|
409
|
+
}, G = (e, t = "full") => {
|
|
668
410
|
let n = e || navigator.language;
|
|
669
411
|
return t === "short" ? n.split("-")[0] : n;
|
|
670
|
-
},
|
|
671
|
-
let [n, r] =
|
|
672
|
-
return
|
|
673
|
-
e && "isInitialized" in e && e.isInitialized && e.language && r(
|
|
412
|
+
}, Ae = (e, t = "full") => {
|
|
413
|
+
let [n, r] = b(() => G(e?.language, t));
|
|
414
|
+
return g(() => {
|
|
415
|
+
e && "isInitialized" in e && e.isInitialized && e.language && r(G(e.language, t));
|
|
674
416
|
let n = (e) => {
|
|
675
|
-
r(
|
|
417
|
+
r(G(e, t));
|
|
676
418
|
};
|
|
677
419
|
return e?.on?.("languageChanged", n), () => {
|
|
678
420
|
e?.off?.("languageChanged", n);
|
|
679
421
|
};
|
|
680
422
|
}, [e, t]), n;
|
|
681
|
-
},
|
|
423
|
+
}, je = "tracktor.filter", Me = {
|
|
682
424
|
getFilter: () => void 0,
|
|
683
425
|
getFilters: () => ({}),
|
|
684
426
|
handleFilter: () => () => {},
|
|
685
427
|
setFilter: () => {}
|
|
686
|
-
},
|
|
428
|
+
}, K = (e) => {
|
|
687
429
|
try {
|
|
688
430
|
return JSON.parse(e);
|
|
689
431
|
} catch {
|
|
690
432
|
return e;
|
|
691
433
|
}
|
|
692
|
-
},
|
|
434
|
+
}, Ne = (e, t, n) => `${n}_${e}=>${t}`, Pe = (e) => e.reduce((e, t) => {
|
|
693
435
|
let n = localStorage.getItem(t);
|
|
694
436
|
if (n) try {
|
|
695
437
|
let t = JSON.parse(n), r = Object.keys(t)?.[0];
|
|
696
438
|
r && (e[r] = Object.values(t)?.[0]);
|
|
697
439
|
} catch {}
|
|
698
440
|
return e;
|
|
699
|
-
}, {}),
|
|
700
|
-
let { libraries: t, localStorageKeys: n } =
|
|
701
|
-
if (N) return
|
|
441
|
+
}, {}), Fe = (e) => {
|
|
442
|
+
let { libraries: t, localStorageKeys: n } = h(C), r = e?.reactRouter || t?.reactRouter, { pathname: i } = r?.useLocation?.() ?? { pathname: "/" }, [a, o] = r?.useSearchParams?.() ?? [new URLSearchParams(), () => {}], [s, c] = b({}), l = n?.filter || je, u = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, d = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
|
|
443
|
+
if (N) return Me;
|
|
702
444
|
if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");
|
|
703
|
-
let
|
|
704
|
-
let
|
|
445
|
+
let f = () => Object.keys(localStorage).filter((t) => t.startsWith(l) && t.endsWith(e?.pathname || i)), p = (t, n, r = !0) => {
|
|
446
|
+
let s = Ne(t, e?.pathname || i, l);
|
|
705
447
|
if (!n || Array.isArray(n) && !n.length) {
|
|
706
|
-
|
|
448
|
+
u ? (a.delete(t), o(a)) : c((e) => {
|
|
707
449
|
let n = { ...e };
|
|
708
450
|
return delete n[t], n;
|
|
709
|
-
}),
|
|
451
|
+
}), d && localStorage.removeItem(s);
|
|
710
452
|
return;
|
|
711
453
|
}
|
|
712
|
-
|
|
713
|
-
...
|
|
454
|
+
d && r && n && localStorage.setItem(s, JSON.stringify({
|
|
455
|
+
...a,
|
|
714
456
|
[t]: n
|
|
715
|
-
})),
|
|
457
|
+
})), u && n ? (a.set(t, JSON.stringify(n)), o(a)) : !u && n && c((e) => ({
|
|
716
458
|
...e,
|
|
717
459
|
[t]: n
|
|
718
460
|
}));
|
|
719
461
|
};
|
|
720
462
|
return {
|
|
721
463
|
getFilter: (t, n) => {
|
|
722
|
-
if (
|
|
723
|
-
let e =
|
|
724
|
-
if (e) return
|
|
464
|
+
if (u) {
|
|
465
|
+
let e = a.get(t);
|
|
466
|
+
if (e) return K(e);
|
|
725
467
|
} else {
|
|
726
|
-
let e =
|
|
468
|
+
let e = s[t];
|
|
727
469
|
if (e !== void 0) return e;
|
|
728
470
|
}
|
|
729
|
-
if (
|
|
730
|
-
let n =
|
|
471
|
+
if (d) {
|
|
472
|
+
let n = Ne(t, e?.pathname || i, l), r = localStorage.getItem(n);
|
|
731
473
|
if (r) try {
|
|
732
474
|
let e = JSON.parse(r)[t];
|
|
733
|
-
return !
|
|
475
|
+
return !u && e !== void 0 && c((n) => ({
|
|
734
476
|
...n,
|
|
735
477
|
[t]: e
|
|
736
478
|
})), e;
|
|
@@ -739,9 +481,9 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
739
481
|
return n;
|
|
740
482
|
},
|
|
741
483
|
getFilters: () => {
|
|
742
|
-
let e =
|
|
743
|
-
if (
|
|
744
|
-
let t = Array.from(
|
|
484
|
+
let e = d ? Pe(f()) : {};
|
|
485
|
+
if (u) {
|
|
486
|
+
let t = Array.from(a.entries()).reduce((e, [t, n]) => (e[t] = K(n), e), {});
|
|
745
487
|
return {
|
|
746
488
|
...e,
|
|
747
489
|
...t
|
|
@@ -749,56 +491,56 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
749
491
|
}
|
|
750
492
|
return {
|
|
751
493
|
...e,
|
|
752
|
-
...
|
|
494
|
+
...s
|
|
753
495
|
};
|
|
754
496
|
},
|
|
755
497
|
handleFilter: (e, t) => (n, r) => {
|
|
756
498
|
if (r || Array.isArray(r) && r.length === 0) {
|
|
757
499
|
let n = t || "value";
|
|
758
|
-
|
|
500
|
+
p(e, typeof r == "object" && n in r ? r[n || "value"] : r);
|
|
759
501
|
return;
|
|
760
502
|
}
|
|
761
|
-
|
|
503
|
+
p(e, void 0);
|
|
762
504
|
},
|
|
763
|
-
setFilter:
|
|
505
|
+
setFilter: p
|
|
764
506
|
};
|
|
765
|
-
},
|
|
766
|
-
let [e, t] =
|
|
767
|
-
return
|
|
507
|
+
}, Ie = () => document.getElementById(P), Le = () => {
|
|
508
|
+
let [e, t] = b(() => !!window.HubSpotConversations);
|
|
509
|
+
return g(() => {
|
|
768
510
|
if (window.HubSpotConversations) {
|
|
769
511
|
t(!0);
|
|
770
512
|
return;
|
|
771
513
|
}
|
|
772
514
|
window.hsConversationsOnReady = [() => t(!0)];
|
|
773
|
-
}, []),
|
|
515
|
+
}, []), g(() => {
|
|
774
516
|
e && window.HubSpotConversations?.on("widgetClosed", () => {
|
|
775
|
-
|
|
517
|
+
Ie()?.classList.remove(F);
|
|
776
518
|
});
|
|
777
519
|
}, [e]), {
|
|
778
520
|
isAvailable: e,
|
|
779
|
-
toggle:
|
|
780
|
-
let e = window.HubSpotConversations, t =
|
|
781
|
-
e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(
|
|
521
|
+
toggle: m(() => {
|
|
522
|
+
let e = window.HubSpotConversations, t = Ie();
|
|
523
|
+
e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(F)) : (t.classList.add(F), e.widget.open()));
|
|
782
524
|
}, [])
|
|
783
525
|
};
|
|
784
|
-
},
|
|
785
|
-
let
|
|
786
|
-
n || !
|
|
526
|
+
}, Re = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: i, enabled: a = !0 }) => {
|
|
527
|
+
let o = m(async (e) => {
|
|
528
|
+
n || !a || await t({ pageParam: e?.pageParam || e.visibleRowsCount });
|
|
787
529
|
}, [
|
|
788
|
-
|
|
530
|
+
a,
|
|
789
531
|
t,
|
|
790
532
|
n
|
|
791
|
-
]),
|
|
533
|
+
]), s = v(() => {
|
|
792
534
|
if (e) return e.pages.reduce((e, t) => [...e, ...t], []);
|
|
793
535
|
}, [e]);
|
|
794
536
|
return {
|
|
795
|
-
fetchNextPageOnRowsScrollEnd:
|
|
796
|
-
isLoading: n ||
|
|
537
|
+
fetchNextPageOnRowsScrollEnd: o,
|
|
538
|
+
isLoading: n || i,
|
|
797
539
|
loadingVariant: r ? "skeleton" : "linear-progress",
|
|
798
|
-
rows:
|
|
540
|
+
rows: s
|
|
799
541
|
};
|
|
800
|
-
},
|
|
801
|
-
let { libraries: t } =
|
|
542
|
+
}, ze = (e) => {
|
|
543
|
+
let { libraries: t } = h(C), n = e?.i18 || t?.i18, r = e?.i18?.translateFunction || t?.i18?.translateFunction, i = n?.i18next?.t || r || ((e) => e), { unknownErrorTranslationKey: a = "error.unknownError" } = e || {}, o = i(a), s = m((e) => {
|
|
802
544
|
if (e && typeof e == "object" && "response" in e) {
|
|
803
545
|
let { response: t } = e || {};
|
|
804
546
|
if (t && typeof t == "object" && "reason" in t && t.reason) return String(t.reason);
|
|
@@ -812,78 +554,306 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
|
|
|
812
554
|
}
|
|
813
555
|
}
|
|
814
556
|
}
|
|
815
|
-
return e instanceof Error ? e.message :
|
|
816
|
-
}, [
|
|
557
|
+
return e instanceof Error ? e.message : o;
|
|
558
|
+
}, [o]);
|
|
817
559
|
return {
|
|
818
|
-
getErrorCode:
|
|
560
|
+
getErrorCode: m((e) => {
|
|
819
561
|
let { response: t } = e || {};
|
|
820
562
|
return t?.error_code ? String(t?.error_code) : t?.data?.error_code ? String(t?.data?.error_code) : t?.error_code ? String(t?.error_code) : t?.data?.error_code ? String(t.data.error_code) : "unknown_error_code";
|
|
821
563
|
}, []),
|
|
822
|
-
printError:
|
|
823
|
-
};
|
|
824
|
-
}, We = String.raw`(?:chauffeur|conducteur|op[ée]rateur|machiniste|driver|operator)`, Ge = String.raw`(?:(?:avec|with|incl(?:\.|uding|us)?|y\s+compris)\s+|\+\s*)(?:(?:un|une|le|la|son|sa|an?|the|its)\s+)?`, Ke = String.raw`(?:\s+(?:inclus|compris|included))?`, qe = String.raw`(?:(?:(?:à\s+la|par|per|by\s+the|tarif)\s+)?(jours?|journ[ée]es?|journalier|days?)|(?:(?:à\s+l['’]\s*|(?:par|per|by\s+the|tarif)\s+))?(heures?|horaire|hours?))`, Je = String.raw`(?:\s*[-–—,/·:]?\s*${qe}|\s*\(\s*${qe}\s*\))?`, Ye = String.raw`(?:(?:location|rental|rented)\s+)?(?:${Ge}${We}${Ke}|${We}\s+(?:inclus|compris|included))${Je}`, Xe = new RegExp(String.raw`\s*[[(]\s*${Ye}\s*[\])]`, "giu"), Ze = new RegExp(String.raw`(?:^|[\s,;:/|–—-])\s*${Ye}\s*$`, "iu"), Qe = /[\s,;:/|–—-]+$/u, $e = ([e]) => {
|
|
825
|
-
let t = e.replace(/^[\s,;:/|–—-]+/u, "").trim(), n = (/^[[(]/u.test(t) ? t.slice(1, -1) : t).trim().replace(/\s+/g, " ");
|
|
826
|
-
return n.charAt(0).toLocaleUpperCase() + n.slice(1);
|
|
827
|
-
}, et = (e) => e[1] || e[3] ? "days" : e[2] || e[4] ? "hours" : void 0, tt = (e, { readDriver: t = !0 } = {}) => {
|
|
828
|
-
if (typeof e != "string") return {
|
|
829
|
-
label: "",
|
|
830
|
-
withDriver: !1
|
|
564
|
+
printError: s
|
|
831
565
|
};
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
|
|
566
|
+
}, Be = 3e4, Ve = 1e3, He = 1e4, q = (e) => Array.isArray(e) ? e.map(q) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.replace(/_([a-z])/g, (e, t) => t.toUpperCase()), q(t)])) : e, J = (e) => Array.isArray(e) ? e.map(J) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`), J(t)])) : e, Ue = class {
|
|
567
|
+
url;
|
|
568
|
+
getToken;
|
|
569
|
+
onEvent;
|
|
570
|
+
onConnectionChange;
|
|
571
|
+
shouldReconnect;
|
|
572
|
+
maxReconnectAttempts;
|
|
573
|
+
reconnectBaseDelay;
|
|
574
|
+
maxMessageBodyLength;
|
|
575
|
+
ws = null;
|
|
576
|
+
reconnectAttempt = 0;
|
|
577
|
+
reconnectTimer = null;
|
|
578
|
+
intentionalClose = !1;
|
|
579
|
+
joinedThreads = /* @__PURE__ */ new Set();
|
|
580
|
+
pendingMessages = [];
|
|
581
|
+
_connected = !1;
|
|
582
|
+
_ready = !1;
|
|
583
|
+
constructor(e) {
|
|
584
|
+
this.url = e.url, this.getToken = e.getToken, this.onEvent = e.onEvent, this.onConnectionChange = e.onConnectionChange, this.shouldReconnect = e.reconnect ?? !0, this.maxReconnectAttempts = e.maxReconnectAttempts ?? Infinity, this.reconnectBaseDelay = e.reconnectBaseDelay ?? Ve, this.maxMessageBodyLength = e.maxMessageBodyLength ?? He;
|
|
585
|
+
}
|
|
586
|
+
get connected() {
|
|
587
|
+
return this._connected;
|
|
588
|
+
}
|
|
589
|
+
get ready() {
|
|
590
|
+
return this._ready;
|
|
591
|
+
}
|
|
592
|
+
connect() {
|
|
593
|
+
let e = this.getToken();
|
|
594
|
+
if (!e) return;
|
|
595
|
+
this.intentionalClose = !1;
|
|
596
|
+
let t = this.url.includes("?") ? "&" : "?", n = `${this.url}${t}token=${e}`;
|
|
597
|
+
this.ws = new WebSocket(n), this.ws.onopen = () => {
|
|
598
|
+
this._connected = !0, this.reconnectAttempt = 0, this.onConnectionChange?.(!0), this.rejoinThreads(), this.flushPendingMessages();
|
|
599
|
+
}, this.ws.onmessage = (e) => {
|
|
600
|
+
try {
|
|
601
|
+
let t = q(JSON.parse(e.data));
|
|
602
|
+
t.type === "ready" && (this._ready = !0), this.onEvent?.(t);
|
|
603
|
+
} catch {}
|
|
604
|
+
}, this.ws.onclose = () => {
|
|
605
|
+
this._connected = !1, this._ready = !1, this.onConnectionChange?.(!1), !this.intentionalClose && this.shouldReconnect && this.reconnectAttempt < this.maxReconnectAttempts && this.scheduleReconnect();
|
|
606
|
+
}, this.ws.onerror = () => {};
|
|
607
|
+
}
|
|
608
|
+
disconnect() {
|
|
609
|
+
this.intentionalClose = !0, this.pendingMessages = [], this.clearReconnectTimer(), this.ws &&= (this.ws.close(), null);
|
|
610
|
+
}
|
|
611
|
+
joinThread(e) {
|
|
612
|
+
this.joinedThreads.add(e), this.send({
|
|
613
|
+
threadId: e,
|
|
614
|
+
type: "join_thread"
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
leaveThread(e) {
|
|
618
|
+
this.joinedThreads.delete(e), this.send({
|
|
619
|
+
threadId: e,
|
|
620
|
+
type: "leave_thread"
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
sendMessage(e, t) {
|
|
624
|
+
if (t.length > this.maxMessageBodyLength) throw Error(`Message body exceeds maximum length of ${this.maxMessageBodyLength} characters`);
|
|
625
|
+
this.send({
|
|
626
|
+
body: t,
|
|
627
|
+
threadId: e,
|
|
628
|
+
type: "send_message"
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
markRead(e) {
|
|
632
|
+
this.send({
|
|
633
|
+
threadId: e,
|
|
634
|
+
type: "mark_read"
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
listThreads(e, t) {
|
|
638
|
+
this.send({
|
|
639
|
+
limit: e,
|
|
640
|
+
offset: t,
|
|
641
|
+
type: "list_threads"
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
send(e) {
|
|
645
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
646
|
+
this.pendingMessages.push(e);
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
this.ws.send(JSON.stringify(J(e)));
|
|
650
|
+
}
|
|
651
|
+
flushPendingMessages() {
|
|
652
|
+
let e = [...this.pendingMessages];
|
|
653
|
+
this.pendingMessages = [];
|
|
654
|
+
for (let t of e) this.send(t);
|
|
655
|
+
}
|
|
656
|
+
rejoinThreads() {
|
|
657
|
+
for (let e of this.joinedThreads) this.send({
|
|
658
|
+
threadId: e,
|
|
659
|
+
type: "join_thread"
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
scheduleReconnect() {
|
|
663
|
+
this.clearReconnectTimer();
|
|
664
|
+
let e = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, Be);
|
|
665
|
+
this.reconnectAttempt++, this.reconnectTimer = setTimeout(() => {
|
|
666
|
+
this.connect();
|
|
667
|
+
}, e);
|
|
668
|
+
}
|
|
669
|
+
clearReconnectTimer() {
|
|
670
|
+
this.reconnectTimer !== null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
|
|
671
|
+
}
|
|
672
|
+
}, We = "user", Ge = {
|
|
673
|
+
client: "/v2/threads/ws",
|
|
674
|
+
supplier: "/v1/threads/ws"
|
|
675
|
+
}, Ke = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, qe = (e) => {
|
|
676
|
+
try {
|
|
677
|
+
let t = localStorage.getItem(e);
|
|
678
|
+
return t ? JSON.parse(t)?.accessToken ?? null : null;
|
|
679
|
+
} catch {
|
|
680
|
+
return null;
|
|
681
|
+
}
|
|
682
|
+
}, Y = f(null), Je = ({ children: e, token: t, url: n, wsPath: r, maxReconnectAttempts: i, reconnectBaseDelay: a, maxMessageBodyLength: o = 1e4, reconnect: s = !0, enabled: c = !0, context: l = "client" }) => {
|
|
683
|
+
let [u, d] = b(!1), [f, p] = b(!1), [_, v] = b(0), [S, w] = b(c), T = c && S, { apiURL: E, localStorageKeys: ee } = h(C), D = ee?.user || We, O = y(null), k = y(/* @__PURE__ */ new Set());
|
|
684
|
+
g(() => {
|
|
685
|
+
if (!T) return;
|
|
686
|
+
let e = r ?? Ge[l], c = n || (E ? Ke(E, e) : null);
|
|
687
|
+
if (!c) return;
|
|
688
|
+
let u = () => t ?? qe(D), f = (e) => {
|
|
689
|
+
switch (e.type) {
|
|
690
|
+
case "ready":
|
|
691
|
+
p(!0), v(e.unreadCount ?? 0);
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
for (let t of k.current) t(e);
|
|
695
|
+
}, m = setTimeout(() => {
|
|
696
|
+
let e = new Ue({
|
|
697
|
+
getToken: u,
|
|
698
|
+
maxMessageBodyLength: o,
|
|
699
|
+
maxReconnectAttempts: i,
|
|
700
|
+
onConnectionChange: (e) => {
|
|
701
|
+
d(e), e || p(!1);
|
|
702
|
+
},
|
|
703
|
+
onEvent: f,
|
|
704
|
+
reconnect: s,
|
|
705
|
+
reconnectBaseDelay: a,
|
|
706
|
+
url: c
|
|
707
|
+
});
|
|
708
|
+
O.current = e, e.connect();
|
|
709
|
+
}, 0);
|
|
710
|
+
return () => {
|
|
711
|
+
clearTimeout(m), O.current?.disconnect(), O.current = null;
|
|
712
|
+
};
|
|
713
|
+
}, [
|
|
714
|
+
T,
|
|
715
|
+
n,
|
|
716
|
+
r,
|
|
717
|
+
l,
|
|
718
|
+
t,
|
|
719
|
+
s,
|
|
720
|
+
E,
|
|
721
|
+
D,
|
|
722
|
+
o,
|
|
723
|
+
i,
|
|
724
|
+
a
|
|
725
|
+
]);
|
|
726
|
+
let te = m((e) => {
|
|
727
|
+
O.current?.joinThread(e);
|
|
728
|
+
}, []), ne = m((e) => {
|
|
729
|
+
O.current?.leaveThread(e);
|
|
730
|
+
}, []), re = m((e, t) => {
|
|
731
|
+
O.current?.sendMessage(e, t);
|
|
732
|
+
}, []), A = m((e) => {
|
|
733
|
+
O.current?.markRead(e);
|
|
734
|
+
}, []), j = m((e, t) => {
|
|
735
|
+
O.current?.listThreads(e, t);
|
|
736
|
+
}, []), M = m((e = 1) => {
|
|
737
|
+
v((t) => t + e);
|
|
738
|
+
}, []), ie = {
|
|
739
|
+
decrementUnreadCount: m((e = 1) => {
|
|
740
|
+
v((t) => Math.max(0, t - e));
|
|
741
|
+
}, []),
|
|
742
|
+
disconnect: m(() => {
|
|
743
|
+
O.current?.disconnect(), O.current = null;
|
|
744
|
+
}, []),
|
|
745
|
+
incrementUnreadCount: M,
|
|
746
|
+
isConnected: u,
|
|
747
|
+
isReady: f,
|
|
748
|
+
joinThread: te,
|
|
749
|
+
leaveThread: ne,
|
|
750
|
+
listThreads: j,
|
|
751
|
+
markRead: A,
|
|
752
|
+
sendMessage: re,
|
|
753
|
+
setEnabled: m((e) => {
|
|
754
|
+
w(e);
|
|
755
|
+
}, []),
|
|
756
|
+
subscribe: m((e) => (k.current.add(e), () => {
|
|
757
|
+
k.current.delete(e);
|
|
758
|
+
}), []),
|
|
759
|
+
unreadCount: _
|
|
854
760
|
};
|
|
855
|
-
|
|
761
|
+
return /* @__PURE__ */ x(Y.Provider, {
|
|
762
|
+
value: ie,
|
|
763
|
+
children: e
|
|
764
|
+
});
|
|
765
|
+
}, Ye = "New message", Xe = (e, t) => {
|
|
766
|
+
if (!("Notification" in window) || typeof Notification != "function" || Notification.permission !== "granted" || !document.hidden) return;
|
|
767
|
+
let n = new Notification(t.title ?? Ye, {
|
|
768
|
+
badge: t?.badge,
|
|
769
|
+
body: t?.body || e.bodyPreview,
|
|
770
|
+
data: t?.data,
|
|
771
|
+
dir: t?.dir,
|
|
772
|
+
icon: t?.icon,
|
|
773
|
+
lang: t?.lang,
|
|
774
|
+
requireInteraction: t?.requireInteraction,
|
|
775
|
+
silent: t?.silent,
|
|
776
|
+
tag: t?.tag || e.messageId
|
|
777
|
+
});
|
|
778
|
+
if (t.onClick) {
|
|
779
|
+
let { onClick: r } = t;
|
|
780
|
+
n.onclick = () => r(e);
|
|
781
|
+
}
|
|
782
|
+
}, Ze = (e) => {
|
|
783
|
+
let t = h(Y);
|
|
784
|
+
if (!t) throw Error("useChat must be used within ChatProvider");
|
|
785
|
+
let { subscribe: n, setEnabled: r, ...i } = t, a = y(e);
|
|
786
|
+
return a.current = e, g(() => {
|
|
787
|
+
e?.enabled !== void 0 && r(e.enabled);
|
|
788
|
+
}, [e?.enabled, r]), g(() => {
|
|
789
|
+
e?.browserNotification && e.browserNotification.enabled !== !1 && "Notification" in window && Notification.permission === "default" && typeof Notification.requestPermission == "function" && Notification.requestPermission();
|
|
790
|
+
}, [e?.browserNotification]), g(() => n((e) => {
|
|
791
|
+
let { browserNotification: t, onReady: n, onNewMessage: r, onNewMessageNotification: i, onPresence: o, onError: s, onJoinedThread: c, onLeftThread: l, onMarkedRead: u, onThreadArchived: d, onThreadsList: f } = a.current ?? {};
|
|
792
|
+
switch (e.type) {
|
|
793
|
+
case "ready":
|
|
794
|
+
n?.(e);
|
|
795
|
+
break;
|
|
796
|
+
case "new_message":
|
|
797
|
+
r?.(e);
|
|
798
|
+
break;
|
|
799
|
+
case "new_message_notification":
|
|
800
|
+
i?.(e), t && t.enabled !== !1 && Xe(e, t);
|
|
801
|
+
break;
|
|
802
|
+
case "presence":
|
|
803
|
+
o?.(e);
|
|
804
|
+
break;
|
|
805
|
+
case "error":
|
|
806
|
+
s?.(e);
|
|
807
|
+
break;
|
|
808
|
+
case "joined_thread":
|
|
809
|
+
c?.(e);
|
|
810
|
+
break;
|
|
811
|
+
case "left_thread":
|
|
812
|
+
l?.(e);
|
|
813
|
+
break;
|
|
814
|
+
case "marked_read":
|
|
815
|
+
u?.(e);
|
|
816
|
+
break;
|
|
817
|
+
case "thread_archived":
|
|
818
|
+
d?.(e);
|
|
819
|
+
break;
|
|
820
|
+
case "threads_list":
|
|
821
|
+
f?.(e);
|
|
822
|
+
break;
|
|
823
|
+
}
|
|
824
|
+
}), [n]), i;
|
|
825
|
+
}, Qe = "chunk-reload-timestamp", X = "chunk-reload", $e = 1e4, Z = 2, Q = !1;
|
|
856
826
|
if (!N && typeof window < "u") {
|
|
857
827
|
try {
|
|
858
828
|
let e = new URL(window.location.href);
|
|
859
|
-
e.searchParams.has(
|
|
829
|
+
e.searchParams.has(X) && (Q = !0, e.searchParams.delete(X), window.history.replaceState(null, "", e.toString()));
|
|
860
830
|
} catch {}
|
|
861
831
|
window.addEventListener("vite:preloadError", (e) => {
|
|
862
832
|
e.preventDefault();
|
|
863
833
|
});
|
|
864
834
|
}
|
|
865
|
-
var
|
|
835
|
+
var et = (e) => {
|
|
866
836
|
if (!(e instanceof Error)) return !1;
|
|
867
837
|
let t = e.message.toLowerCase();
|
|
868
838
|
return t.includes("dynamically imported module") || t.includes("importing a module script failed") || t.includes("loading chunk") || t.includes("loading css chunk") || t.includes("unable to preload css") || t.includes("failed to fetch") || t.includes("error loading dynamically imported module") || t.includes("load failed") || t.includes("without a valid default export") || e.name === "ChunkLoadError";
|
|
869
|
-
},
|
|
839
|
+
}, tt = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, nt = (e) => e.toString().match(tt)?.[2] ?? null, rt = (e) => {
|
|
870
840
|
try {
|
|
871
841
|
return sessionStorage.getItem(e);
|
|
872
842
|
} catch {
|
|
873
843
|
return null;
|
|
874
844
|
}
|
|
875
|
-
},
|
|
845
|
+
}, it = (e, t) => {
|
|
876
846
|
try {
|
|
877
847
|
sessionStorage.setItem(e, t);
|
|
878
848
|
} catch {}
|
|
879
|
-
},
|
|
880
|
-
for (let t = 0; t <
|
|
881
|
-
return await
|
|
849
|
+
}, at = (e) => Function("url", "return import(url)")(e), ot = async (e) => {
|
|
850
|
+
for (let t = 0; t < Z; t++) try {
|
|
851
|
+
return await at(`${e}?t=${Date.now()}`);
|
|
882
852
|
} catch {
|
|
883
|
-
t <
|
|
853
|
+
t < Z - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
|
|
884
854
|
}
|
|
885
|
-
throw Error(`Failed to import ${e} after ${
|
|
886
|
-
},
|
|
855
|
+
throw Error(`Failed to import ${e} after ${Z} retries`);
|
|
856
|
+
}, st = async () => {
|
|
887
857
|
try {
|
|
888
858
|
if (typeof navigator < "u" && "serviceWorker" in navigator) {
|
|
889
859
|
let e = await navigator.serviceWorker.getRegistrations();
|
|
@@ -894,34 +864,28 @@ var at = (e) => {
|
|
|
894
864
|
await Promise.all(e.map((e) => caches.delete(e)));
|
|
895
865
|
}
|
|
896
866
|
} catch {}
|
|
897
|
-
},
|
|
898
|
-
await
|
|
867
|
+
}, ct = async () => {
|
|
868
|
+
await st();
|
|
899
869
|
let e = new URL(window.location.href);
|
|
900
|
-
e.searchParams.set(
|
|
901
|
-
},
|
|
870
|
+
e.searchParams.set(X, String(Date.now())), window.location.replace(e.toString());
|
|
871
|
+
}, lt = (e) => e != null && e.default !== void 0, ut = (e) => p(async () => {
|
|
902
872
|
let t;
|
|
903
873
|
try {
|
|
904
874
|
let n = await e();
|
|
905
|
-
if (
|
|
875
|
+
if (lt(n)) return n;
|
|
906
876
|
t = /* @__PURE__ */ Error("Module resolved without a valid default export");
|
|
907
877
|
} catch (e) {
|
|
908
878
|
t = e;
|
|
909
879
|
}
|
|
910
|
-
if (N || !
|
|
911
|
-
let n =
|
|
880
|
+
if (N || !et(t)) throw t;
|
|
881
|
+
let n = nt(e);
|
|
912
882
|
if (n) try {
|
|
913
|
-
let e = await
|
|
914
|
-
if (
|
|
883
|
+
let e = await ot(n);
|
|
884
|
+
if (lt(e)) return e;
|
|
915
885
|
} catch {}
|
|
916
|
-
let r = Number(
|
|
917
|
-
return Date.now() - r <
|
|
918
|
-
}),
|
|
919
|
-
let t = Z(e?.items);
|
|
920
|
-
return t && Q(t) && t.quantity ? t.quantity : void 0;
|
|
921
|
-
}, Ct = (e) => {
|
|
922
|
-
let t = Z(e?.items);
|
|
923
|
-
return !!t && Q(t) && t.unitPrice == null;
|
|
924
|
-
}, wt = "Page Left", Tt = 1800 * 1e3, Et = 1e3, Dt = (e, t = !0) => {
|
|
886
|
+
let r = Number(rt(Qe) || "0");
|
|
887
|
+
return Date.now() - r < $e || Q || (it(Qe, String(Date.now())), await ct()), { default: () => null };
|
|
888
|
+
}), dt = "Page Left", ft = 1800 * 1e3, pt = 1e3, mt = (e, t = !0) => {
|
|
925
889
|
let n = 0, r = t ? e : null, i = !1, a = (e) => {
|
|
926
890
|
r !== null && (n += Math.max(0, e - r), r = null);
|
|
927
891
|
};
|
|
@@ -932,39 +896,39 @@ var at = (e) => {
|
|
|
932
896
|
resume: (e) => {
|
|
933
897
|
!i && r === null && (r = e);
|
|
934
898
|
},
|
|
935
|
-
stop: (e) => (i ||= (a(e), !0), Math.min(
|
|
899
|
+
stop: (e) => (i ||= (a(e), !0), Math.min(ft, Math.round(n)))
|
|
936
900
|
};
|
|
937
|
-
},
|
|
901
|
+
}, ht = (e, t) => t < 1e3 ? null : {
|
|
938
902
|
duration_ms: Math.round(t),
|
|
939
903
|
page_path: e
|
|
940
|
-
},
|
|
904
|
+
}, gt = (e) => {
|
|
941
905
|
if (typeof e != "object" || !e) return !1;
|
|
942
906
|
let { exp: t, sub: n, entity_id: r, scope: i } = e;
|
|
943
907
|
return typeof t == "number" && typeof n == "string" && typeof r == "number" && Array.isArray(i) && i.every((e) => typeof e == "string");
|
|
944
|
-
},
|
|
908
|
+
}, _t = (e) => {
|
|
945
909
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4);
|
|
946
910
|
return decodeURIComponent(Array.from(atob(n), (e) => `%${e.charCodeAt(0).toString(16).padStart(2, "0")}`).join(""));
|
|
947
|
-
},
|
|
911
|
+
}, vt = (e) => {
|
|
948
912
|
let t = e?.split(".")[1];
|
|
949
913
|
if (!t) return null;
|
|
950
914
|
try {
|
|
951
|
-
let e = JSON.parse(
|
|
952
|
-
return
|
|
915
|
+
let e = JSON.parse(_t(t));
|
|
916
|
+
return gt(e) ? e : null;
|
|
953
917
|
} catch {
|
|
954
918
|
return null;
|
|
955
919
|
}
|
|
956
|
-
}, $ = (e) => btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""),
|
|
920
|
+
}, $ = (e) => btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), yt = async (e, t) => {
|
|
957
921
|
let n = new TextEncoder(), r = await crypto.subtle.importKey("raw", n.encode(e), {
|
|
958
922
|
hash: "SHA-256",
|
|
959
923
|
name: "HMAC"
|
|
960
924
|
}, !1, ["sign"]), i = await crypto.subtle.sign("HMAC", r, n.encode(t));
|
|
961
925
|
return $(String.fromCharCode(...new Uint8Array(i)));
|
|
962
|
-
},
|
|
926
|
+
}, bt = async (e, t) => {
|
|
963
927
|
let n = `${$(JSON.stringify({
|
|
964
928
|
alg: "HS256",
|
|
965
929
|
typ: "JWT"
|
|
966
930
|
}))}.${$(JSON.stringify(e))}`;
|
|
967
|
-
return `${n}.${await
|
|
931
|
+
return `${n}.${await yt(t, n)}`;
|
|
968
932
|
};
|
|
969
933
|
//#endregion
|
|
970
|
-
export { A as AMPLITUDE_FEATURE_SELECTOR,
|
|
934
|
+
export { A as AMPLITUDE_FEATURE_SELECTOR, ne as AutoReloadOnNewVersion, Ue as ChatClient, Y as ChatContext, Je as ChatProvider, c as DEFAULT_OPERATOR_HOURS_PER_DAY, re as GTMSendPageView, oe as InitializeAmplitude, ce as InitializeAxiosConfig, de as InitializeDaysJSConfig, fe as InitializeHubSpot, pe as InitializeI18nConfig, ge as InitializeSentryConfig, C as InjectDependenciesContext, w as InjectDependenciesProvider, i as MAX_OPERATOR_HOURS_PER_DAY, S as MaskTextField, ft as PAGE_DURATION_CAP_MS, pt as PAGE_DURATION_MIN_MS, dt as PAGE_LEFT_EVENT, we as QueryProvider, ve as RequireAuth, L as SENTRY_IGNORED_REQUEST_URLS, me as SENTRY_KEEP_REPLAY, le as SUPPORTED_LANGUAGE, ye as ShowHubSpotBubble, l as articleNameAdapter, mt as createVisibleStopwatch, H as dateAdapter, vt as decodeToken, U as distanceAdapter, bt as encodeToken, o as findOperatorItem, G as getCurrentLanguage, n as getOperatorHoursPerDay, u as getOrvalConfig, e as getUnitCount, a as isHourlyLine, s as isOperatorArticle, t as isOperatorRateMissing, r as isOrderedByTheHour, he as isReplayKeptForError, ut as lazyWithRetry, R as matchesRequestUrl, ht as pageLeftProperties, V as shouldRetryQuery, De as useAdapter, Oe as useAmplitude, ke as useAuth, Ze as useChat, Ae as useCurrentLanguage, Fe as useFilters, Le as useHubSpot, Re as useInfiniteDataGrid, ze as useResponseError, W as worksiteNameAdapter };
|