@getsoren/shared-module 2.44.0 → 2.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-DxWKHrrW.js +84 -0
- package/dist/chunk-D8eiyYIV.js +16 -0
- package/dist/components/Utils/AutoReloadOnNewVersion.d.ts +34 -0
- package/dist/components/Utils/InitializeDaysJSConfig.d.ts +6 -2
- package/dist/components/Utils/tests/AutoReloadOnNewVersion.test.d.ts +1 -0
- package/dist/de-B9uAlw43.js +67 -0
- package/dist/es-Czh059B4.js +49 -0
- package/dist/it-BMMOnRzo.js +49 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +260 -213
- package/dist/orval.js +1 -1
- package/dist/pt-cqbtpCpu.js +50 -0
- package/package.json +1 -1
- /package/dist/{orval-Bf_zcxLE.js → orval-D6vce7Ml.js} +0 -0
package/dist/main.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as e } from "./chunk-D8eiyYIV.js";
|
|
2
|
+
import { t } from "./orval-D6vce7Ml.js";
|
|
3
|
+
import { Suspense as n, createContext as r, lazy as i, useCallback as a, useContext as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
4
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
4
5
|
//#region src/chat/ChatClient.ts
|
|
5
|
-
var
|
|
6
|
+
var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.replace(/_([a-z])/g, (e, t) => t.toUpperCase()), h(t)])) : e, g = (e) => Array.isArray(e) ? e.map(g) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`), g(t)])) : e, _ = class {
|
|
6
7
|
url;
|
|
7
8
|
getToken;
|
|
8
9
|
onEvent;
|
|
@@ -20,7 +21,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
20
21
|
_connected = !1;
|
|
21
22
|
_ready = !1;
|
|
22
23
|
constructor(e) {
|
|
23
|
-
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 ??
|
|
24
|
+
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;
|
|
24
25
|
}
|
|
25
26
|
get connected() {
|
|
26
27
|
return this._connected;
|
|
@@ -37,7 +38,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
37
38
|
this._connected = !0, this.reconnectAttempt = 0, this.onConnectionChange?.(!0), this.rejoinThreads(), this.flushPendingMessages();
|
|
38
39
|
}, this.ws.onmessage = (e) => {
|
|
39
40
|
try {
|
|
40
|
-
let t =
|
|
41
|
+
let t = h(JSON.parse(e.data));
|
|
41
42
|
t.type === "ready" && (this._ready = !0), this.onEvent?.(t);
|
|
42
43
|
} catch {}
|
|
43
44
|
}, this.ws.onclose = () => {
|
|
@@ -85,7 +86,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
85
86
|
this.pendingMessages.push(e);
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
|
-
this.ws.send(JSON.stringify(
|
|
89
|
+
this.ws.send(JSON.stringify(g(e)));
|
|
89
90
|
}
|
|
90
91
|
flushPendingMessages() {
|
|
91
92
|
let e = [...this.pendingMessages];
|
|
@@ -100,7 +101,7 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
100
101
|
}
|
|
101
102
|
scheduleReconnect() {
|
|
102
103
|
this.clearReconnectTimer();
|
|
103
|
-
let e = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt,
|
|
104
|
+
let e = Math.min(this.reconnectBaseDelay * 2 ** this.reconnectAttempt, f);
|
|
104
105
|
this.reconnectAttempt++, this.reconnectTimer = setTimeout(() => {
|
|
105
106
|
this.connect();
|
|
106
107
|
}, e);
|
|
@@ -108,8 +109,8 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
108
109
|
clearReconnectTimer() {
|
|
109
110
|
this.reconnectTimer !== null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
|
|
110
111
|
}
|
|
111
|
-
},
|
|
112
|
-
let i =
|
|
112
|
+
}, v = ({ IMaskMixin: e, ...t }) => /* @__PURE__ */ d(c(() => e(({ TextField: e, ...t }) => /* @__PURE__ */ d(e, { ...t })), [e]), { ...t }), y = r({}), b = ({ children: e, apiURL: t, libraries: n, localStorageKeys: r }) => {
|
|
113
|
+
let i = c(() => ({
|
|
113
114
|
apiURL: t,
|
|
114
115
|
libraries: n,
|
|
115
116
|
localStorageKeys: r
|
|
@@ -118,32 +119,70 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
118
119
|
n,
|
|
119
120
|
r
|
|
120
121
|
]);
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ d(y.Provider, {
|
|
122
123
|
value: i,
|
|
123
124
|
children: e
|
|
124
125
|
});
|
|
125
|
-
},
|
|
126
|
-
|
|
126
|
+
}, x = 900 * 1e3, S = 60 * 1e3, C = 600 * 1e3, w = "auto-reload-on-new-version-timestamp", T = /<meta[^>]*name="version"[^>]*content="([^"]*)"/, E = (e) => {
|
|
127
|
+
try {
|
|
128
|
+
return sessionStorage.getItem(e);
|
|
129
|
+
} catch {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}, D = (e, t) => {
|
|
133
|
+
try {
|
|
134
|
+
sessionStorage.setItem(e, t);
|
|
135
|
+
} catch {}
|
|
136
|
+
}, O = ({ version: e, checkInterval: t = x, children: n, ...r }) => {
|
|
137
|
+
let { libraries: i } = o(y), a = r?.reactRouter || i?.reactRouter, c = l(!1), u = l(0);
|
|
138
|
+
if (!a) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of AutoReloadOnNewVersion.");
|
|
139
|
+
let { useLocation: f, Outlet: p } = a, { pathname: m } = f(), h = l(m);
|
|
140
|
+
return s(() => {
|
|
141
|
+
if (!e || typeof window > "u") return;
|
|
142
|
+
let n = async () => {
|
|
143
|
+
if (!(c.current || Date.now() - u.current < S)) {
|
|
144
|
+
u.current = Date.now();
|
|
145
|
+
try {
|
|
146
|
+
let t = await fetch("/index.html", { cache: "no-store" });
|
|
147
|
+
if (!t.ok) return;
|
|
148
|
+
let n = (await t.text()).match(T)?.[1];
|
|
149
|
+
n && n !== "%VERSION%" && n !== e && (c.current = !0);
|
|
150
|
+
} catch {}
|
|
151
|
+
}
|
|
152
|
+
}, r = () => {
|
|
153
|
+
document.visibilityState === "visible" && n();
|
|
154
|
+
}, i = setInterval(n, t);
|
|
155
|
+
return document.addEventListener("visibilitychange", r), () => {
|
|
156
|
+
clearInterval(i), document.removeEventListener("visibilitychange", r);
|
|
157
|
+
};
|
|
158
|
+
}, [e, t]), s(() => {
|
|
159
|
+
if (m === h.current || (h.current = m, !c.current)) return;
|
|
160
|
+
c.current = !1;
|
|
161
|
+
let e = Number(E(w) || "0");
|
|
162
|
+
Date.now() - e < C || (D(w, String(Date.now())), window.location.reload());
|
|
163
|
+
}, [m]), n ?? /* @__PURE__ */ d(p, {});
|
|
164
|
+
}, k = ({ data: e, ...t }) => {
|
|
165
|
+
let { libraries: n } = o(y), r = t?.reactRouter || n?.reactRouter, i = t?.gtm || n?.gtm;
|
|
127
166
|
if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
128
167
|
if (!i) throw Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
129
|
-
let { useGoogleTagManager:
|
|
130
|
-
return
|
|
168
|
+
let { useGoogleTagManager: a } = i, { useLocation: c, Outlet: l } = r, { pathname: u } = c(), { sendEvent: f } = a();
|
|
169
|
+
return s(() => {
|
|
131
170
|
f({
|
|
132
171
|
event: "pageView",
|
|
133
|
-
pathname:
|
|
172
|
+
pathname: u,
|
|
134
173
|
...e
|
|
135
174
|
});
|
|
136
175
|
}, [
|
|
137
176
|
e,
|
|
138
|
-
|
|
177
|
+
u,
|
|
139
178
|
f
|
|
140
|
-
]), /* @__PURE__ */
|
|
141
|
-
},
|
|
142
|
-
let { libraries: i } =
|
|
143
|
-
return
|
|
144
|
-
let r =
|
|
179
|
+
]), /* @__PURE__ */ d(l, {});
|
|
180
|
+
}, A = ({ apiKey: e, platform: t = "desktop", sessionReplaySampleRate: n = .25, ...r }) => {
|
|
181
|
+
let { libraries: i } = o(y), a = r.amplitude || i?.amplitude;
|
|
182
|
+
return s(() => {
|
|
183
|
+
let r = a?.analytics, i = a?.sessionReplayPlugin;
|
|
145
184
|
if (!(e && r)) return;
|
|
146
|
-
let
|
|
185
|
+
let o = "platform-enrichment";
|
|
147
186
|
return r.init(e, { autocapture: { elementInteractions: !1 } }), i && r.add(i({ sampleRate: n })), r.add({
|
|
148
187
|
execute: async (e) => ({
|
|
149
188
|
...e,
|
|
@@ -152,67 +191,75 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
152
191
|
platform: t
|
|
153
192
|
}
|
|
154
193
|
}),
|
|
155
|
-
name:
|
|
194
|
+
name: o,
|
|
156
195
|
type: "enrichment"
|
|
157
196
|
}), () => {
|
|
158
|
-
i && r.remove("@amplitude/plugin-session-replay-browser"), r.remove(
|
|
197
|
+
i && r.remove("@amplitude/plugin-session-replay-browser"), r.remove(o);
|
|
159
198
|
};
|
|
160
199
|
}, [
|
|
161
200
|
e,
|
|
162
|
-
|
|
201
|
+
a,
|
|
163
202
|
t,
|
|
164
203
|
n
|
|
165
204
|
]), null;
|
|
166
|
-
},
|
|
205
|
+
}, j = (() => {
|
|
167
206
|
try {
|
|
168
207
|
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;
|
|
169
208
|
} catch {
|
|
170
209
|
return !1;
|
|
171
210
|
}
|
|
172
|
-
})(),
|
|
173
|
-
let { apiURL: i = r.apiURL, libraries:
|
|
211
|
+
})(), M = "user", N = ({ tokenTypeKey: e = "tokenType", tokenKey: t = "accessToken", postContentType: n = "application/json", ...r }) => {
|
|
212
|
+
let { apiURL: i = r.apiURL, libraries: a, localStorageKeys: s } = o(y), c = r?.userLocalStorageKey || s?.user || M, l = r?.axios || a?.axios;
|
|
174
213
|
if (!l) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
175
|
-
if (!l?.defaults ||
|
|
214
|
+
if (!l?.defaults || j) return null;
|
|
176
215
|
if (typeof window < "u" && window.localStorage) {
|
|
177
216
|
let n = localStorage.getItem(c), r = n ? JSON.parse(n) : null, i = r?.[e] ? r[e] : null, a = r?.[t] ? r[t] : null, o = n ? `${i} ${a}` : null;
|
|
178
217
|
o && (l.defaults.headers.common.Authorization = o);
|
|
179
218
|
}
|
|
180
219
|
return l.defaults.baseURL = i, l.defaults.headers.post["Content-Type"] = n, null;
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
220
|
+
}, P = [
|
|
221
|
+
"ar",
|
|
222
|
+
"de",
|
|
223
|
+
"en",
|
|
224
|
+
"es",
|
|
225
|
+
"fr",
|
|
226
|
+
"it",
|
|
227
|
+
"pt"
|
|
228
|
+
], F = (e) => P.includes(e), I = ({ language: t, ...n }) => {
|
|
229
|
+
let { libraries: r } = o(y), i = n?.dayjs || r?.dayjs, a = n?.plugin || r?.dayjsPlugin;
|
|
230
|
+
if (!i) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");
|
|
231
|
+
return s(() => {
|
|
185
232
|
(async () => {
|
|
186
|
-
let
|
|
187
|
-
|
|
188
|
-
e &&
|
|
189
|
-
}), await import("dayjs/locale/en"), await import("dayjs/locale/fr"),
|
|
233
|
+
let r = t || navigator.language?.slice(0, 2) || "en";
|
|
234
|
+
i.extend(n.localizedFormat), a && a.forEach((e) => {
|
|
235
|
+
e && i.extend(e);
|
|
236
|
+
}), await import("./ar-DxWKHrrW.js").then((t) => /* @__PURE__ */ e(t.default, 1)), await import("./de-B9uAlw43.js").then((t) => /* @__PURE__ */ e(t.default, 1)), await import("dayjs/locale/en"), await import("./es-Czh059B4.js").then((t) => /* @__PURE__ */ e(t.default, 1)), await import("dayjs/locale/fr"), await import("./it-BMMOnRzo.js").then((t) => /* @__PURE__ */ e(t.default, 1)), await import("./pt-cqbtpCpu.js").then((t) => /* @__PURE__ */ e(t.default, 1)), i.locale(F(r) ? r : "en");
|
|
190
237
|
})().then();
|
|
191
238
|
}, [
|
|
192
|
-
r,
|
|
193
239
|
i,
|
|
194
|
-
|
|
195
|
-
t
|
|
240
|
+
a,
|
|
241
|
+
t,
|
|
242
|
+
n.localizedFormat
|
|
196
243
|
]), null;
|
|
197
|
-
},
|
|
244
|
+
}, L = "hubspot-messages-iframe-container", R = "hs-show", z = "data-hs-hidden", ee = ({ hubId: e }) => (s(() => {
|
|
198
245
|
if (!e) return;
|
|
199
246
|
let t = document.createElement("script");
|
|
200
247
|
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), () => {
|
|
201
248
|
t.remove();
|
|
202
249
|
};
|
|
203
|
-
}, [e]),
|
|
250
|
+
}, [e]), s(() => {
|
|
204
251
|
let e = document.createElement("style");
|
|
205
252
|
return e.textContent = `
|
|
206
|
-
html[${
|
|
207
|
-
html[${
|
|
208
|
-
`, document.head.appendChild(e), document.documentElement.setAttribute(
|
|
209
|
-
e.remove(), document.documentElement.removeAttribute(
|
|
253
|
+
html[${z}] div#${L} { display: none !important; }
|
|
254
|
+
html[${z}] div#${L}.${R} { display: initial !important; }
|
|
255
|
+
`, document.head.appendChild(e), document.documentElement.setAttribute(z, ""), () => {
|
|
256
|
+
e.remove(), document.documentElement.removeAttribute(z);
|
|
210
257
|
};
|
|
211
|
-
}, []), null),
|
|
212
|
-
let { libraries: r } =
|
|
213
|
-
if (
|
|
214
|
-
if (!(i &&
|
|
215
|
-
return
|
|
258
|
+
}, []), null), te = ({ debug: e, resources: t, ...n }) => {
|
|
259
|
+
let { libraries: r } = o(y), i = n?.i18 || r?.i18, { i18next: a, initReactI18next: s, languageDetector: c } = i || {};
|
|
260
|
+
if (j) return null;
|
|
261
|
+
if (!(i && a && c && s)) throw Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
262
|
+
return a.isInitialized ? null : (a.use(c).use(s).init({
|
|
216
263
|
debug: e,
|
|
217
264
|
fallbackLng: "en",
|
|
218
265
|
interpolation: { escapeValue: !1 },
|
|
@@ -224,16 +271,16 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
224
271
|
resources: t,
|
|
225
272
|
returnNull: !1
|
|
226
273
|
}).then(() => {
|
|
227
|
-
document.documentElement.lang !==
|
|
228
|
-
}),
|
|
274
|
+
document.documentElement.lang !== a.resolvedLanguage && a.resolvedLanguage && document.documentElement.setAttribute("lang", a.resolvedLanguage);
|
|
275
|
+
}), a.on("languageChanged", (e) => {
|
|
229
276
|
document.documentElement.setAttribute("lang", e);
|
|
230
277
|
}), null);
|
|
231
|
-
},
|
|
232
|
-
let { libraries: p } =
|
|
278
|
+
}, ne = ({ dsn: e, integrations: t, tracesSampleRate: n, replaysSessionSampleRate: r, replaysOnErrorSampleRate: i, tracePropagationTargets: a, ignoreErrors: c, debug: l, environment: u, release: d, ...f }) => {
|
|
279
|
+
let { libraries: p } = o(y), m = f?.sentry || p?.sentry, h = f?.reactRouter || p?.reactRouter;
|
|
233
280
|
if (!m) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
234
281
|
if (!h) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
235
282
|
if (m.isInitialized()) return null;
|
|
236
|
-
let { createRoutesFromChildren: g, matchRoutes: _, useLocation:
|
|
283
|
+
let { createRoutesFromChildren: g, matchRoutes: _, useLocation: v, useNavigationType: b } = h;
|
|
237
284
|
return (l || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && m.init({
|
|
238
285
|
debug: l,
|
|
239
286
|
dsn: e,
|
|
@@ -250,82 +297,82 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
250
297
|
integrations: [m.reactRouterV6BrowserTracingIntegration({
|
|
251
298
|
createRoutesFromChildren: g,
|
|
252
299
|
matchRoutes: _,
|
|
253
|
-
useEffect:
|
|
254
|
-
useLocation:
|
|
300
|
+
useEffect: s,
|
|
301
|
+
useLocation: v,
|
|
255
302
|
useNavigationType: b
|
|
256
303
|
}), ...t || []],
|
|
257
304
|
release: d,
|
|
258
305
|
replaysOnErrorSampleRate: i || 1,
|
|
259
306
|
replaysSessionSampleRate: r || .1,
|
|
260
|
-
tracePropagationTargets:
|
|
307
|
+
tracePropagationTargets: a,
|
|
261
308
|
tracesSampleRate: n || 1
|
|
262
309
|
}), null;
|
|
263
|
-
},
|
|
264
|
-
let { libraries: c, localStorageKeys:
|
|
310
|
+
}, B = /* @__PURE__ */ new WeakMap(), re = "user", ie = ({ Fallback: e, isLogged: t, loginPath: r = "/login", redirect401Path: i = "/login", ...a }) => {
|
|
311
|
+
let { libraries: c, localStorageKeys: l } = o(y), f = a?.reactRouter || c?.reactRouter, p = a?.axios || c?.axios, m = a?.localStorageKey || l?.user || re;
|
|
265
312
|
if (!f) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
266
|
-
let [h, g] =
|
|
267
|
-
return
|
|
268
|
-
p && (
|
|
313
|
+
let [h, g] = u(null), { useLocation: _, Navigate: v, Outlet: b } = f, x = _(), S = typeof t == "function" ? t() : !!t, C = typeof S == "boolean" ? S : S?.isLogged;
|
|
314
|
+
return s(() => {
|
|
315
|
+
p && (B.has(p) || (B.set(p, !0), p.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 && (p.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(m)), g(i)), Promise.reject(e)))));
|
|
269
316
|
}, [
|
|
270
317
|
p,
|
|
271
318
|
m,
|
|
272
319
|
i
|
|
273
|
-
]), C && !h ? /* @__PURE__ */
|
|
320
|
+
]), C && !h ? /* @__PURE__ */ d(n, {
|
|
274
321
|
fallback: e,
|
|
275
|
-
children: x.state?.from?.state && x.state?.from?.pathname === r ? /* @__PURE__ */
|
|
322
|
+
children: x.state?.from?.state && x.state?.from?.pathname === r ? /* @__PURE__ */ d(v, {
|
|
276
323
|
to: x.state.from.state.from.pathname + x.state.from.state.from.search,
|
|
277
324
|
replace: !0
|
|
278
|
-
}) : /* @__PURE__ */
|
|
279
|
-
}) : /* @__PURE__ */
|
|
325
|
+
}) : /* @__PURE__ */ d(b, {})
|
|
326
|
+
}) : /* @__PURE__ */ d(v, {
|
|
280
327
|
to: r + x.search,
|
|
281
328
|
state: { from: x },
|
|
282
329
|
replace: !0
|
|
283
330
|
});
|
|
284
|
-
},
|
|
331
|
+
}, V = /* @__PURE__ */ new Set(), ae = () => (s(() => {
|
|
285
332
|
let e = Symbol();
|
|
286
|
-
return
|
|
287
|
-
|
|
333
|
+
return V.add(e), document.documentElement.removeAttribute(z), () => {
|
|
334
|
+
V.delete(e), V.size === 0 && document.documentElement.setAttribute(z, "");
|
|
288
335
|
};
|
|
289
|
-
}, []), null),
|
|
336
|
+
}, []), null), oe = "user", se = {
|
|
290
337
|
client: "/v2/threads/ws",
|
|
291
338
|
supplier: "/v1/threads/ws"
|
|
292
|
-
},
|
|
339
|
+
}, ce = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, le = (e) => {
|
|
293
340
|
try {
|
|
294
341
|
let t = localStorage.getItem(e);
|
|
295
342
|
return t ? JSON.parse(t)?.accessToken ?? null : null;
|
|
296
343
|
} catch {
|
|
297
344
|
return null;
|
|
298
345
|
}
|
|
299
|
-
},
|
|
300
|
-
let [
|
|
301
|
-
|
|
346
|
+
}, H = r(null), ue = ({ children: e, token: t, url: n, wsPath: r, maxReconnectAttempts: i, reconnectBaseDelay: c, maxMessageBodyLength: f = 1e4, reconnect: p = !0, enabled: m = !0, context: h = "client" }) => {
|
|
347
|
+
let [g, v] = u(!1), [b, x] = u(!1), [S, C] = u(0), [w, T] = u(m), E = m && w, { apiURL: D, localStorageKeys: O } = o(y), k = O?.user || oe, A = l(null), j = l(/* @__PURE__ */ new Set());
|
|
348
|
+
s(() => {
|
|
302
349
|
if (!E) return;
|
|
303
|
-
let e = r ??
|
|
304
|
-
if (!
|
|
305
|
-
let
|
|
350
|
+
let e = r ?? se[h], a = n || (D ? ce(D, e) : null);
|
|
351
|
+
if (!a) return;
|
|
352
|
+
let o = () => t ?? le(k), s = (e) => {
|
|
306
353
|
switch (e.type) {
|
|
307
354
|
case "ready":
|
|
308
355
|
x(!0), C(e.unreadCount ?? 0);
|
|
309
356
|
break;
|
|
310
357
|
}
|
|
311
358
|
for (let t of j.current) t(e);
|
|
312
|
-
},
|
|
313
|
-
let e = new
|
|
314
|
-
getToken:
|
|
359
|
+
}, l = setTimeout(() => {
|
|
360
|
+
let e = new _({
|
|
361
|
+
getToken: o,
|
|
315
362
|
maxMessageBodyLength: f,
|
|
316
|
-
maxReconnectAttempts:
|
|
363
|
+
maxReconnectAttempts: i,
|
|
317
364
|
onConnectionChange: (e) => {
|
|
318
|
-
|
|
365
|
+
v(e), e || x(!1);
|
|
319
366
|
},
|
|
320
|
-
onEvent:
|
|
367
|
+
onEvent: s,
|
|
321
368
|
reconnect: p,
|
|
322
|
-
reconnectBaseDelay:
|
|
323
|
-
url:
|
|
369
|
+
reconnectBaseDelay: c,
|
|
370
|
+
url: a
|
|
324
371
|
});
|
|
325
372
|
A.current = e, e.connect();
|
|
326
373
|
}, 0);
|
|
327
374
|
return () => {
|
|
328
|
-
clearTimeout(
|
|
375
|
+
clearTimeout(l), A.current?.disconnect(), A.current = null;
|
|
329
376
|
};
|
|
330
377
|
}, [
|
|
331
378
|
E,
|
|
@@ -337,56 +384,56 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
337
384
|
D,
|
|
338
385
|
k,
|
|
339
386
|
f,
|
|
340
|
-
|
|
341
|
-
|
|
387
|
+
i,
|
|
388
|
+
c
|
|
342
389
|
]);
|
|
343
|
-
let M =
|
|
390
|
+
let M = a((e) => {
|
|
344
391
|
A.current?.joinThread(e);
|
|
345
|
-
}, []), N =
|
|
392
|
+
}, []), N = a((e) => {
|
|
346
393
|
A.current?.leaveThread(e);
|
|
347
|
-
}, []), P =
|
|
394
|
+
}, []), P = a((e, t) => {
|
|
348
395
|
A.current?.sendMessage(e, t);
|
|
349
|
-
}, []), F =
|
|
396
|
+
}, []), F = a((e) => {
|
|
350
397
|
A.current?.markRead(e);
|
|
351
|
-
}, []), I =
|
|
398
|
+
}, []), I = a((e, t) => {
|
|
352
399
|
A.current?.listThreads(e, t);
|
|
353
|
-
}, []),
|
|
400
|
+
}, []), L = a((e = 1) => {
|
|
354
401
|
C((t) => t + e);
|
|
355
|
-
}, []),
|
|
356
|
-
decrementUnreadCount:
|
|
402
|
+
}, []), R = {
|
|
403
|
+
decrementUnreadCount: a((e = 1) => {
|
|
357
404
|
C((t) => Math.max(0, t - e));
|
|
358
405
|
}, []),
|
|
359
|
-
disconnect:
|
|
406
|
+
disconnect: a(() => {
|
|
360
407
|
A.current?.disconnect(), A.current = null;
|
|
361
408
|
}, []),
|
|
362
|
-
incrementUnreadCount:
|
|
363
|
-
isConnected:
|
|
409
|
+
incrementUnreadCount: L,
|
|
410
|
+
isConnected: g,
|
|
364
411
|
isReady: b,
|
|
365
412
|
joinThread: M,
|
|
366
413
|
leaveThread: N,
|
|
367
414
|
listThreads: I,
|
|
368
415
|
markRead: F,
|
|
369
416
|
sendMessage: P,
|
|
370
|
-
setEnabled:
|
|
417
|
+
setEnabled: a((e) => {
|
|
371
418
|
T(e);
|
|
372
419
|
}, []),
|
|
373
|
-
subscribe:
|
|
420
|
+
subscribe: a((e) => (j.current.add(e), () => {
|
|
374
421
|
j.current.delete(e);
|
|
375
422
|
}), []),
|
|
376
423
|
unreadCount: S
|
|
377
424
|
};
|
|
378
|
-
return /* @__PURE__ */
|
|
379
|
-
value:
|
|
425
|
+
return /* @__PURE__ */ d(H.Provider, {
|
|
426
|
+
value: R,
|
|
380
427
|
children: e
|
|
381
428
|
});
|
|
382
|
-
},
|
|
383
|
-
let { libraries: i } =
|
|
384
|
-
if (!
|
|
429
|
+
}, de = (e) => e && typeof e == "function", fe = (e) => e && typeof e == "function", pe = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
|
|
430
|
+
let { libraries: i } = o(y), a = r?.QueryClient || i?.reactQuery?.QueryClient, s = r?.QueryClientProvider || i?.reactQuery?.QueryClientProvider;
|
|
431
|
+
if (!a) throw Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
385
432
|
if (!s) throw Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
386
|
-
if (!
|
|
387
|
-
if (!
|
|
388
|
-
let
|
|
389
|
-
return
|
|
433
|
+
if (!de(s)) throw Error("Provided QueryClientProvider dependencies are not valid.");
|
|
434
|
+
if (!fe(a)) throw Error("Provided QueryClient dependencies are not valid.");
|
|
435
|
+
let c = l(null);
|
|
436
|
+
return c.current ||= new a({ defaultOptions: {
|
|
390
437
|
mutations: { ...n },
|
|
391
438
|
queries: {
|
|
392
439
|
getNextPageParam: (e, t, n) => e.length + (n || 0),
|
|
@@ -394,73 +441,73 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
394
441
|
retry: 3,
|
|
395
442
|
...t
|
|
396
443
|
}
|
|
397
|
-
} }), /* @__PURE__ */
|
|
398
|
-
client:
|
|
444
|
+
} }), /* @__PURE__ */ d(s, {
|
|
445
|
+
client: c.current,
|
|
399
446
|
children: e
|
|
400
447
|
});
|
|
401
|
-
},
|
|
448
|
+
}, U = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), W = (e, t) => {
|
|
402
449
|
let { fractionDigits: n = 0, metric: r = "km", spacingBetween: i = !0 } = t || {}, a = Number(e), o = i ? " " : "";
|
|
403
450
|
return Number.isNaN(a) ? `0${o}${r}` : `${a.toFixed(n)}${o}${r}`;
|
|
404
|
-
},
|
|
451
|
+
}, G = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((e) => e.length > 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" "), me = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, he = ({ path: e, size: t, apiURL: n }) => {
|
|
405
452
|
if (!e) return "";
|
|
406
|
-
let r = `${n}${
|
|
453
|
+
let r = `${n}${me(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
407
454
|
return typeof t == "number" && i ? `${r.replace("/files", `/thumbs/${t}`)}` : r;
|
|
408
|
-
},
|
|
409
|
-
let { apiURL: t, libraries: n } =
|
|
455
|
+
}, ge = (e) => {
|
|
456
|
+
let { apiURL: t, libraries: n } = o(y), r = e?.dayjs || n?.dayjs;
|
|
410
457
|
return {
|
|
411
458
|
dateAdapter: (e, t) => {
|
|
412
459
|
if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
413
|
-
return
|
|
460
|
+
return U({
|
|
414
461
|
date: e,
|
|
415
462
|
format: t,
|
|
416
463
|
library: r
|
|
417
464
|
});
|
|
418
465
|
},
|
|
419
|
-
distanceAdapter:
|
|
466
|
+
distanceAdapter: W,
|
|
420
467
|
filePathAdapter: (e, n) => {
|
|
421
468
|
if (!t) throw Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");
|
|
422
|
-
return typeof e == "string" && /^https?:\/\//.test(e) ? e :
|
|
469
|
+
return typeof e == "string" && /^https?:\/\//.test(e) ? e : he({
|
|
423
470
|
apiURL: t,
|
|
424
471
|
path: e,
|
|
425
472
|
size: n
|
|
426
473
|
});
|
|
427
474
|
},
|
|
428
|
-
worksiteNameAdapter:
|
|
475
|
+
worksiteNameAdapter: G
|
|
429
476
|
};
|
|
430
|
-
},
|
|
431
|
-
let { libraries: e } =
|
|
477
|
+
}, _e = () => {
|
|
478
|
+
let { libraries: e } = o(y), t = e?.amplitude?.analytics, n = a((e, n) => {
|
|
432
479
|
if (!t || (t.setUserId(e), !n)) return;
|
|
433
480
|
let r = new t.Identify();
|
|
434
481
|
Object.entries(n).forEach(([e, t]) => {
|
|
435
482
|
r.set(e, t);
|
|
436
483
|
}), t.identify(r);
|
|
437
|
-
}, [t]), r =
|
|
484
|
+
}, [t]), r = a((e, n, r) => {
|
|
438
485
|
if (!t || (t.setGroup(e, n), !r)) return;
|
|
439
486
|
let i = new t.Identify();
|
|
440
487
|
Object.entries(r).forEach(([e, t]) => {
|
|
441
488
|
i.set(e, t);
|
|
442
489
|
}), t.groupIdentify(e, n, i);
|
|
443
|
-
}, [t]),
|
|
490
|
+
}, [t]), i = a((e, n) => {
|
|
444
491
|
t && t.track(e, n);
|
|
445
492
|
}, [t]);
|
|
446
493
|
return {
|
|
447
494
|
identify: n,
|
|
448
|
-
reset:
|
|
495
|
+
reset: a(() => {
|
|
449
496
|
t && t.reset();
|
|
450
497
|
}, [t]),
|
|
451
498
|
setGroup: r,
|
|
452
|
-
track:
|
|
499
|
+
track: i
|
|
453
500
|
};
|
|
454
|
-
},
|
|
455
|
-
let { libraries: t, localStorageKeys: n } =
|
|
501
|
+
}, ve = (e) => {
|
|
502
|
+
let { libraries: t, localStorageKeys: n } = o(y), r = e?.axios || t?.axios, i = e?.localStorageKey || n?.user || "user";
|
|
456
503
|
if (!r) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
457
|
-
let c =
|
|
504
|
+
let c = a(({ tokenType: e, accessToken: t }) => {
|
|
458
505
|
r.defaults.headers.common.Authorization = `${e} ${t}`;
|
|
459
506
|
}, [r.defaults.headers.common]);
|
|
460
|
-
return
|
|
461
|
-
if (
|
|
507
|
+
return s(() => {
|
|
508
|
+
if (j) return;
|
|
462
509
|
let e = ({ newValue: e, key: t }) => {
|
|
463
|
-
if (t ===
|
|
510
|
+
if (t === i && e) try {
|
|
464
511
|
let { accessToken: t, tokenType: n } = JSON.parse(e);
|
|
465
512
|
c({
|
|
466
513
|
accessToken: t,
|
|
@@ -473,15 +520,15 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
473
520
|
return window.addEventListener("storage", e), () => {
|
|
474
521
|
window.removeEventListener("storage", e);
|
|
475
522
|
};
|
|
476
|
-
}, [
|
|
523
|
+
}, [i, c]), {
|
|
477
524
|
clearAuthenticationToken: () => {
|
|
478
525
|
r.defaults.headers.common.Authorization = null;
|
|
479
526
|
},
|
|
480
527
|
setAuthenticationToken: c
|
|
481
528
|
};
|
|
482
|
-
},
|
|
529
|
+
}, ye = "New message", be = (e, t) => {
|
|
483
530
|
if (!("Notification" in window) || typeof Notification != "function" || Notification.permission !== "granted" || !document.hidden) return;
|
|
484
|
-
let n = new Notification(t.title ??
|
|
531
|
+
let n = new Notification(t.title ?? ye, {
|
|
485
532
|
badge: t?.badge,
|
|
486
533
|
body: t?.body || e.bodyPreview,
|
|
487
534
|
data: t?.data,
|
|
@@ -496,16 +543,16 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
496
543
|
let { onClick: r } = t;
|
|
497
544
|
n.onclick = () => r(e);
|
|
498
545
|
}
|
|
499
|
-
},
|
|
500
|
-
let t =
|
|
546
|
+
}, xe = (e) => {
|
|
547
|
+
let t = o(H);
|
|
501
548
|
if (!t) throw Error("useChat must be used within ChatProvider");
|
|
502
|
-
let { subscribe: n, setEnabled: r, ...i } = t,
|
|
503
|
-
return
|
|
549
|
+
let { subscribe: n, setEnabled: r, ...i } = t, a = l(e);
|
|
550
|
+
return a.current = e, s(() => {
|
|
504
551
|
e?.enabled !== void 0 && r(e.enabled);
|
|
505
|
-
}, [e?.enabled, r]),
|
|
552
|
+
}, [e?.enabled, r]), s(() => {
|
|
506
553
|
e?.browserNotification && e.browserNotification.enabled !== !1 && "Notification" in window && Notification.permission === "default" && typeof Notification.requestPermission == "function" && Notification.requestPermission();
|
|
507
|
-
}, [e?.browserNotification]),
|
|
508
|
-
let { browserNotification: t, onReady: n, onNewMessage: r, onNewMessageNotification: i, onPresence:
|
|
554
|
+
}, [e?.browserNotification]), s(() => n((e) => {
|
|
555
|
+
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 ?? {};
|
|
509
556
|
switch (e.type) {
|
|
510
557
|
case "ready":
|
|
511
558
|
n?.(e);
|
|
@@ -514,13 +561,13 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
514
561
|
r?.(e);
|
|
515
562
|
break;
|
|
516
563
|
case "new_message_notification":
|
|
517
|
-
i?.(e), t && t.enabled !== !1 &&
|
|
564
|
+
i?.(e), t && t.enabled !== !1 && be(e, t);
|
|
518
565
|
break;
|
|
519
566
|
case "presence":
|
|
520
|
-
|
|
567
|
+
o?.(e);
|
|
521
568
|
break;
|
|
522
569
|
case "error":
|
|
523
|
-
|
|
570
|
+
s?.(e);
|
|
524
571
|
break;
|
|
525
572
|
case "joined_thread":
|
|
526
573
|
c?.(e);
|
|
@@ -539,55 +586,55 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
539
586
|
break;
|
|
540
587
|
}
|
|
541
588
|
}), [n]), i;
|
|
542
|
-
},
|
|
543
|
-
let [n, r] =
|
|
589
|
+
}, K = (e, t) => t === "short" ? e.split("-")[0] : e, Se = (e, t = "full") => {
|
|
590
|
+
let [n, r] = u(() => {
|
|
544
591
|
let n = e?.language || navigator.language;
|
|
545
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
592
|
+
return e && "isInitialized" in e && e.isInitialized, K(n, t);
|
|
546
593
|
});
|
|
547
|
-
return
|
|
548
|
-
e && "isInitialized" in e && e.isInitialized && e.language && r(
|
|
594
|
+
return s(() => {
|
|
595
|
+
e && "isInitialized" in e && e.isInitialized && e.language && r(K(e.language, t));
|
|
549
596
|
let n = (e) => {
|
|
550
|
-
r(
|
|
597
|
+
r(K(e, t));
|
|
551
598
|
};
|
|
552
599
|
return e?.on?.("languageChanged", n), () => {
|
|
553
600
|
e?.off?.("languageChanged", n);
|
|
554
601
|
};
|
|
555
602
|
}, [e, t]), n;
|
|
556
|
-
},
|
|
603
|
+
}, Ce = "tracktor.filter", we = {
|
|
557
604
|
getFilter: () => void 0,
|
|
558
605
|
getFilters: () => ({}),
|
|
559
606
|
handleFilter: () => () => {},
|
|
560
607
|
setFilter: () => {}
|
|
561
|
-
},
|
|
608
|
+
}, q = (e) => {
|
|
562
609
|
try {
|
|
563
610
|
return JSON.parse(e);
|
|
564
611
|
} catch {
|
|
565
612
|
return e;
|
|
566
613
|
}
|
|
567
|
-
},
|
|
614
|
+
}, J = (e, t, n) => `${n}_${e}=>${t}`, Te = (e) => e.reduce((e, t) => {
|
|
568
615
|
let n = localStorage.getItem(t);
|
|
569
616
|
if (n) try {
|
|
570
617
|
let t = JSON.parse(n), r = Object.keys(t)?.[0];
|
|
571
618
|
r && (e[r] = Object.values(t)?.[0]);
|
|
572
619
|
} catch {}
|
|
573
620
|
return e;
|
|
574
|
-
}, {}),
|
|
575
|
-
let { libraries: t, localStorageKeys: n } =
|
|
576
|
-
if (
|
|
621
|
+
}, {}), Ee = (e) => {
|
|
622
|
+
let { libraries: t, localStorageKeys: n } = o(y), r = e?.reactRouter || t?.reactRouter, { pathname: i } = r?.useLocation?.() ?? { pathname: "/" }, [a, s] = r?.useSearchParams?.() ?? [new URLSearchParams(), () => {}], [c, l] = u({}), d = n?.filter || Ce, f = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, p = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
|
|
623
|
+
if (j) return we;
|
|
577
624
|
if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");
|
|
578
625
|
let m = () => Object.keys(localStorage).filter((t) => t.startsWith(d) && t.endsWith(e?.pathname || i)), h = (t, n, r = !0) => {
|
|
579
|
-
let
|
|
626
|
+
let o = J(t, e?.pathname || i, d);
|
|
580
627
|
if (!n || Array.isArray(n) && !n.length) {
|
|
581
|
-
f ? (
|
|
628
|
+
f ? (a.delete(t), s(a)) : l((e) => {
|
|
582
629
|
let n = { ...e };
|
|
583
630
|
return delete n[t], n;
|
|
584
|
-
}), p && localStorage.removeItem(
|
|
631
|
+
}), p && localStorage.removeItem(o);
|
|
585
632
|
return;
|
|
586
633
|
}
|
|
587
|
-
p && r && n && localStorage.setItem(
|
|
588
|
-
...
|
|
634
|
+
p && r && n && localStorage.setItem(o, JSON.stringify({
|
|
635
|
+
...a,
|
|
589
636
|
[t]: n
|
|
590
|
-
})), f && n ? (
|
|
637
|
+
})), f && n ? (a.set(t, JSON.stringify(n)), s(a)) : !f && n && l((e) => ({
|
|
591
638
|
...e,
|
|
592
639
|
[t]: n
|
|
593
640
|
}));
|
|
@@ -595,17 +642,17 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
595
642
|
return {
|
|
596
643
|
getFilter: (t, n) => {
|
|
597
644
|
if (f) {
|
|
598
|
-
let e =
|
|
599
|
-
if (e) return
|
|
645
|
+
let e = a.get(t);
|
|
646
|
+
if (e) return q(e);
|
|
600
647
|
} else {
|
|
601
648
|
let e = c[t];
|
|
602
649
|
if (e !== void 0) return e;
|
|
603
650
|
}
|
|
604
651
|
if (p) {
|
|
605
|
-
let n =
|
|
652
|
+
let n = J(t, e?.pathname || i, d), r = localStorage.getItem(n);
|
|
606
653
|
if (r) try {
|
|
607
654
|
let e = JSON.parse(r)[t];
|
|
608
|
-
return !f && e !== void 0 &&
|
|
655
|
+
return !f && e !== void 0 && l((n) => ({
|
|
609
656
|
...n,
|
|
610
657
|
[t]: e
|
|
611
658
|
})), e;
|
|
@@ -614,9 +661,9 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
614
661
|
return n;
|
|
615
662
|
},
|
|
616
663
|
getFilters: () => {
|
|
617
|
-
let e = p ?
|
|
664
|
+
let e = p ? Te(m()) : {};
|
|
618
665
|
if (f) {
|
|
619
|
-
let t = Array.from(
|
|
666
|
+
let t = Array.from(a.entries()).reduce((e, [t, n]) => (e[t] = q(n), e), {});
|
|
620
667
|
return {
|
|
621
668
|
...e,
|
|
622
669
|
...t
|
|
@@ -637,43 +684,43 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
637
684
|
},
|
|
638
685
|
setFilter: h
|
|
639
686
|
};
|
|
640
|
-
},
|
|
641
|
-
let [e, t] =
|
|
642
|
-
return
|
|
687
|
+
}, Y = () => document.getElementById(L), De = () => {
|
|
688
|
+
let [e, t] = u(() => !!window.HubSpotConversations);
|
|
689
|
+
return s(() => {
|
|
643
690
|
if (window.HubSpotConversations) {
|
|
644
691
|
t(!0);
|
|
645
692
|
return;
|
|
646
693
|
}
|
|
647
694
|
window.hsConversationsOnReady = [() => t(!0)];
|
|
648
|
-
}, []),
|
|
695
|
+
}, []), s(() => {
|
|
649
696
|
e && window.HubSpotConversations?.on("widgetClosed", () => {
|
|
650
|
-
|
|
697
|
+
Y()?.classList.remove(R);
|
|
651
698
|
});
|
|
652
699
|
}, [e]), {
|
|
653
700
|
isAvailable: e,
|
|
654
|
-
toggle:
|
|
655
|
-
let e = window.HubSpotConversations, t =
|
|
656
|
-
e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(
|
|
701
|
+
toggle: a(() => {
|
|
702
|
+
let e = window.HubSpotConversations, t = Y();
|
|
703
|
+
e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(R)) : (t.classList.add(R), e.widget.open()));
|
|
657
704
|
}, [])
|
|
658
705
|
};
|
|
659
|
-
},
|
|
660
|
-
let
|
|
706
|
+
}, Oe = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: i, enabled: o = !0 }) => {
|
|
707
|
+
let s = a(async (e) => {
|
|
661
708
|
n || !o || await t({ pageParam: e?.pageParam || e.visibleRowsCount });
|
|
662
709
|
}, [
|
|
663
710
|
o,
|
|
664
711
|
t,
|
|
665
712
|
n
|
|
666
|
-
]), l =
|
|
713
|
+
]), l = c(() => {
|
|
667
714
|
if (e) return e.pages.reduce((e, t) => [...e, ...t], []);
|
|
668
715
|
}, [e]);
|
|
669
716
|
return {
|
|
670
|
-
fetchNextPageOnRowsScrollEnd:
|
|
671
|
-
isLoading: n ||
|
|
717
|
+
fetchNextPageOnRowsScrollEnd: s,
|
|
718
|
+
isLoading: n || i,
|
|
672
719
|
loadingVariant: r ? "skeleton" : "linear-progress",
|
|
673
720
|
rows: l
|
|
674
721
|
};
|
|
675
|
-
},
|
|
676
|
-
let { libraries: t } =
|
|
722
|
+
}, ke = (e) => {
|
|
723
|
+
let { libraries: t } = o(y), n = e?.i18 || t?.i18, r = e?.i18?.translateFunction || t?.i18?.translateFunction, i = n?.i18next?.t || r || ((e) => e), { unknownErrorTranslationKey: s = "error.unknownError" } = e || {}, c = i(s), l = a((e) => {
|
|
677
724
|
if (e && typeof e == "object" && "response" in e) {
|
|
678
725
|
let { response: t } = e || {};
|
|
679
726
|
if (t && typeof t == "object" && "reason" in t && t.reason) return String(t.reason);
|
|
@@ -690,44 +737,44 @@ var d = 3e4, f = 1e3, p = 1e4, m = (e) => Array.isArray(e) ? e.map(m) : typeof e
|
|
|
690
737
|
return e instanceof Error ? e.message : c;
|
|
691
738
|
}, [c]);
|
|
692
739
|
return {
|
|
693
|
-
getErrorCode:
|
|
740
|
+
getErrorCode: a((e) => {
|
|
694
741
|
let { response: t } = e || {};
|
|
695
742
|
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";
|
|
696
743
|
}, []),
|
|
697
744
|
printError: l
|
|
698
745
|
};
|
|
699
|
-
},
|
|
700
|
-
if (!
|
|
746
|
+
}, X = "chunk-reload-timestamp", Z = "chunk-reload", Ae = 1e4, Q = 2, $ = !1;
|
|
747
|
+
if (!j && typeof window < "u") {
|
|
701
748
|
try {
|
|
702
749
|
let e = new URL(window.location.href);
|
|
703
|
-
e.searchParams.has(
|
|
750
|
+
e.searchParams.has(Z) && ($ = !0, e.searchParams.delete(Z), window.history.replaceState(null, "", e.toString()));
|
|
704
751
|
} catch {}
|
|
705
752
|
window.addEventListener("vite:preloadError", (e) => {
|
|
706
753
|
e.preventDefault();
|
|
707
754
|
});
|
|
708
755
|
}
|
|
709
|
-
var
|
|
756
|
+
var je = (e) => {
|
|
710
757
|
if (!(e instanceof Error)) return !1;
|
|
711
758
|
let t = e.message.toLowerCase();
|
|
712
759
|
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";
|
|
713
|
-
},
|
|
760
|
+
}, Me = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, Ne = (e) => e.toString().match(Me)?.[2] ?? null, Pe = (e) => {
|
|
714
761
|
try {
|
|
715
762
|
return sessionStorage.getItem(e);
|
|
716
763
|
} catch {
|
|
717
764
|
return null;
|
|
718
765
|
}
|
|
719
|
-
},
|
|
766
|
+
}, Fe = (e, t) => {
|
|
720
767
|
try {
|
|
721
768
|
sessionStorage.setItem(e, t);
|
|
722
769
|
} catch {}
|
|
723
|
-
},
|
|
724
|
-
for (let t = 0; t <
|
|
725
|
-
return await
|
|
770
|
+
}, Ie = (e) => Function("url", "return import(url)")(e), Le = async (e) => {
|
|
771
|
+
for (let t = 0; t < Q; t++) try {
|
|
772
|
+
return await Ie(`${e}?t=${Date.now()}`);
|
|
726
773
|
} catch {
|
|
727
|
-
t <
|
|
774
|
+
t < Q - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
|
|
728
775
|
}
|
|
729
|
-
throw Error(`Failed to import ${e} after ${
|
|
730
|
-
},
|
|
776
|
+
throw Error(`Failed to import ${e} after ${Q} retries`);
|
|
777
|
+
}, Re = async () => {
|
|
731
778
|
try {
|
|
732
779
|
if (typeof navigator < "u" && "serviceWorker" in navigator) {
|
|
733
780
|
let e = await navigator.serviceWorker.getRegistrations();
|
|
@@ -738,27 +785,27 @@ var Se = (e) => {
|
|
|
738
785
|
await Promise.all(e.map((e) => caches.delete(e)));
|
|
739
786
|
}
|
|
740
787
|
} catch {}
|
|
741
|
-
},
|
|
742
|
-
await
|
|
788
|
+
}, ze = async () => {
|
|
789
|
+
await Re();
|
|
743
790
|
let e = new URL(window.location.href);
|
|
744
|
-
e.searchParams.set(
|
|
745
|
-
},
|
|
791
|
+
e.searchParams.set(Z, String(Date.now())), window.location.replace(e.toString());
|
|
792
|
+
}, Be = (e) => e != null && e.default !== void 0, Ve = (e) => i(async () => {
|
|
746
793
|
let t;
|
|
747
794
|
try {
|
|
748
795
|
let n = await e();
|
|
749
|
-
if (
|
|
796
|
+
if (Be(n)) return n;
|
|
750
797
|
t = /* @__PURE__ */ Error("Module resolved without a valid default export");
|
|
751
798
|
} catch (e) {
|
|
752
799
|
t = e;
|
|
753
800
|
}
|
|
754
|
-
if (
|
|
755
|
-
let n =
|
|
801
|
+
if (j || !je(t)) throw t;
|
|
802
|
+
let n = Ne(e);
|
|
756
803
|
if (n) try {
|
|
757
|
-
let e = await
|
|
758
|
-
if (
|
|
804
|
+
let e = await Le(n);
|
|
805
|
+
if (Be(e)) return e;
|
|
759
806
|
} catch {}
|
|
760
|
-
let r = Number(
|
|
761
|
-
return Date.now() - r <
|
|
807
|
+
let r = Number(Pe(X) || "0");
|
|
808
|
+
return Date.now() - r < Ae || $ || (Fe(X, String(Date.now())), await ze()), { default: () => null };
|
|
762
809
|
});
|
|
763
810
|
//#endregion
|
|
764
|
-
export {
|
|
811
|
+
export { O as AutoReloadOnNewVersion, _ as ChatClient, H as ChatContext, ue as ChatProvider, k as GTMSendPageView, A as InitializeAmplitude, N as InitializeAxiosConfig, I as InitializeDaysJSConfig, ee as InitializeHubSpot, te as InitializeI18nConfig, ne as InitializeSentryConfig, y as InjectDependenciesContext, b as InjectDependenciesProvider, v as MaskTextField, pe as QueryProvider, ie as RequireAuth, P as SUPPORTED_LANGUAGE, ae as ShowHubSpotBubble, U as dateAdapter, W as distanceAdapter, t as getOrvalConfig, Ve as lazyWithRetry, ge as useAdapter, _e as useAmplitude, ve as useAuth, xe as useChat, Se as useCurrentLanguage, Ee as useFilters, De as useHubSpot, Oe as useInfiniteDataGrid, ke as useResponseError, G as worksiteNameAdapter };
|