@getsoren/shared-module 2.66.0 → 2.68.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/README.md CHANGED
@@ -211,9 +211,10 @@ input: "./openapi.json"
211
211
  | resolveOrvalInput | Standalone schema target resolution (local file → local → upstream) |
212
212
 
213
213
  ## Utils function
214
- | Module | Description |
215
- |---------------------|-----------------------------------------------------------------------------|
216
- | articleNameAdapter | Split an article's name from its mention of the driver, for a tag to say it |
217
- | dateAdapter | Adapt given date |
218
- | distanceAdapter | Adapt given distance |
219
- | worksiteNameAdapter | Adapt worksite name |
214
+ | Module | Description |
215
+ |---------------------|----------------------------------------------------------------------------------------|
216
+ | articleNameAdapter | Split an article's name from its mention of the driver, for a tag to say it |
217
+ | dateAdapter | Adapt given date |
218
+ | distanceAdapter | Adapt given distance |
219
+ | operator | A machine rented with its driver: its article, its line by the hour, its hours per day |
220
+ | worksiteNameAdapter | Adapt worksite name |
package/dist/main.d.ts CHANGED
@@ -55,6 +55,7 @@ export { default as worksiteNameAdapter } from './utils/adapter/worksiteNameAdap
55
55
  export * from './utils/getCurrentLanguage/getCurrentLanguage';
56
56
  export { default as getCurrentLanguage } from './utils/getCurrentLanguage/getCurrentLanguage';
57
57
  export { default as lazyWithRetry } from './utils/lazyWithRetry';
58
+ export * from './utils/operator/operator';
58
59
  export * from './utils/pageDuration/pageDuration';
59
60
  export { default as shouldRetryQuery } from './utils/shouldRetryQuery/shouldRetryQuery';
60
61
  export * from './utils/token/token';
package/dist/main.js CHANGED
@@ -129,17 +129,17 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
129
129
  value: i,
130
130
  children: e
131
131
  });
132
- }, x = 900 * 1e3, S = 60 * 1e3, C = 600 * 1e3, w = "auto-reload-on-new-version-timestamp", ee = /<meta[^>]*name="version"[^>]*content="([^"]*)"/, T = (e) => {
132
+ }, x = 900 * 1e3, S = 60 * 1e3, C = 600 * 1e3, w = "auto-reload-on-new-version-timestamp", T = /<meta[^>]*name="version"[^>]*content="([^"]*)"/, E = (e) => {
133
133
  try {
134
134
  return sessionStorage.getItem(e);
135
135
  } catch {
136
136
  return null;
137
137
  }
138
- }, E = (e, t) => {
138
+ }, D = (e, t) => {
139
139
  try {
140
140
  sessionStorage.setItem(e, t);
141
141
  } catch {}
142
- }, D = ({ version: e, checkInterval: t = x, children: n, ...r }) => {
142
+ }, O = ({ version: e, checkInterval: t = x, children: n, ...r }) => {
143
143
  let { libraries: i } = a(y), s = r?.reactRouter || i?.reactRouter, c = l(!1), u = l(0);
144
144
  if (!s) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of AutoReloadOnNewVersion.");
145
145
  let { useLocation: f, Outlet: p } = s, { pathname: m } = f(), h = l(m);
@@ -151,7 +151,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
151
151
  try {
152
152
  let t = await fetch("/index.html", { cache: "no-store" });
153
153
  if (!t.ok) return;
154
- let n = (await t.text()).match(ee)?.[1];
154
+ let n = (await t.text()).match(T)?.[1];
155
155
  n && n !== "%VERSION%" && n !== e && (c.current = !0);
156
156
  } catch {}
157
157
  }
@@ -164,10 +164,10 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
164
164
  }, [e, t]), o(() => {
165
165
  if (m === h.current || (h.current = m, !c.current)) return;
166
166
  c.current = !1;
167
- let e = Number(T(w) || "0");
168
- Date.now() - e < C || (E(w, String(Date.now())), window.location.reload());
167
+ let e = Number(E(w) || "0");
168
+ Date.now() - e < C || (D(w, String(Date.now())), window.location.reload());
169
169
  }, [m]), n ?? /* @__PURE__ */ d(p, {});
170
- }, O = ({ data: e, ...t }) => {
170
+ }, k = ({ data: e, ...t }) => {
171
171
  let { libraries: n } = a(y), r = t?.reactRouter || n?.reactRouter, i = t?.gtm || n?.gtm;
172
172
  if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
173
173
  if (!i) throw Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
@@ -183,7 +183,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
183
183
  u,
184
184
  f
185
185
  ]), /* @__PURE__ */ d(l, {});
186
- }, k = "[data-amp-track-feature]", A = [
186
+ }, A = "[data-amp-track-feature]", j = [
187
187
  "a",
188
188
  "button",
189
189
  "input",
@@ -195,18 +195,18 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
195
195
  "[contenteditable=\"true\" i]",
196
196
  "[data-amp-default-track]",
197
197
  ".amp-default-track"
198
- ], te = { defaultMaskLevel: "medium" }, j = (e, t) => {
198
+ ], ee = { defaultMaskLevel: "medium" }, te = (e, t) => {
199
199
  if (e === !1) return !1;
200
200
  let n = e === !0 ? {} : e;
201
201
  return {
202
- cssSelectorAllowlist: [...t, k],
202
+ cssSelectorAllowlist: [...t, A],
203
203
  ...n
204
204
  };
205
- }, M = (e, t) => !t || e === !1 ? !1 : {
205
+ }, ne = (e, t) => !t || e === !1 ? !1 : {
206
206
  deadClicks: !0,
207
207
  rageClicks: !0,
208
208
  ...e === !0 ? {} : e
209
- }, N = ({ apiKey: e, appVersion: t, sessionReplaySampleRate: n, serverZone: r, elementInteractions: i = !0, frustrationInteractions: c = !0, platform: d = "desktop", sessionReplayPrivacy: f = te, userId: p, ...m }) => {
209
+ }, M = ({ apiKey: e, appVersion: t, sessionReplaySampleRate: n, serverZone: r, elementInteractions: i = !0, frustrationInteractions: c = !0, platform: d = "desktop", sessionReplayPrivacy: f = ee, userId: p, ...m }) => {
210
210
  let [h, g] = u(!!p), { libraries: _ } = a(y), v = m.amplitude || _?.amplitude, b = l({
211
211
  elementInteractions: i,
212
212
  frustrationInteractions: c,
@@ -221,12 +221,12 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
221
221
  }), o(() => {
222
222
  let i = v?.analytics, a = v?.sessionReplayPlugin;
223
223
  if (!(e && i && h)) return;
224
- let { elementInteractions: o, frustrationInteractions: s, sessionReplayPrivacy: c } = b.current, l = x.current, u = !l, f = "platform-enrichment", p = j(o, i.Types?.DEFAULT_CSS_SELECTOR_ALLOWLIST ?? A);
224
+ let { elementInteractions: o, frustrationInteractions: s, sessionReplayPrivacy: c } = b.current, l = x.current, u = !l, f = "platform-enrichment", p = te(o, i.Types?.DEFAULT_CSS_SELECTOR_ALLOWLIST ?? j);
225
225
  return i.init(e, l, {
226
226
  appVersion: t,
227
227
  autocapture: {
228
228
  elementInteractions: p,
229
- frustrationInteractions: M(s, p !== !1),
229
+ frustrationInteractions: ne(s, p !== !1),
230
230
  pageViews: { trackHistoryChanges: "pathOnly" }
231
231
  },
232
232
  optOut: u,
@@ -270,22 +270,22 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
270
270
  h,
271
271
  p
272
272
  ]), null;
273
- }, P = (() => {
273
+ }, N = (() => {
274
274
  try {
275
275
  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;
276
276
  } catch {
277
277
  return !1;
278
278
  }
279
- })(), ne = "user", re = ({ tokenTypeKey: e = "tokenType", tokenKey: t = "accessToken", postContentType: n = "application/json", ...r }) => {
280
- let { apiURL: i = r.apiURL, libraries: o, localStorageKeys: s } = a(y), c = r?.userLocalStorageKey || s?.user || ne, l = r?.axios || o?.axios;
279
+ })(), P = "user", F = ({ tokenTypeKey: e = "tokenType", tokenKey: t = "accessToken", postContentType: n = "application/json", ...r }) => {
280
+ let { apiURL: i = r.apiURL, libraries: o, localStorageKeys: s } = a(y), c = r?.userLocalStorageKey || s?.user || P, l = r?.axios || o?.axios;
281
281
  if (!l) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
282
- if (!l?.defaults || P) return null;
282
+ if (!l?.defaults || N) return null;
283
283
  if (typeof window < "u" && window.localStorage) {
284
284
  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;
285
285
  o && (l.defaults.headers.common.Authorization = o);
286
286
  }
287
287
  return l.defaults.baseURL = i, l.defaults.headers.post["Content-Type"] = n, null;
288
- }, ie = [
288
+ }, re = [
289
289
  "ar",
290
290
  "de",
291
291
  "en",
@@ -293,15 +293,15 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
293
293
  "fr",
294
294
  "it",
295
295
  "pt"
296
- ], ae = (e) => ie.includes(e), oe = ({ language: e, ...t }) => {
296
+ ], ie = (e) => re.includes(e), ae = ({ language: e, ...t }) => {
297
297
  let { libraries: n } = a(y), r = t?.dayjs || n?.dayjs, i = t?.plugin || n?.dayjsPlugin;
298
298
  if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");
299
299
  r.extend(t.localizedFormat), i && i.forEach((e) => {
300
300
  e && r.extend(e);
301
301
  });
302
- let o = e || navigator.language?.slice(0, 2) || "en", s = ae(o) ? o : "en";
302
+ let o = e || navigator.language?.slice(0, 2) || "en", s = ie(o) ? o : "en";
303
303
  return r.locale() !== s && r.locale(s), null;
304
- }, F = "hubspot-messages-iframe-container", I = "hs-show", L = "data-hs-hidden", se = ({ hubId: e }) => (o(() => {
304
+ }, I = "hubspot-messages-iframe-container", L = "hs-show", R = "data-hs-hidden", oe = ({ hubId: e }) => (o(() => {
305
305
  if (!e) return;
306
306
  let t = document.createElement("script");
307
307
  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), () => {
@@ -310,14 +310,14 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
310
310
  }, [e]), o(() => {
311
311
  let e = document.createElement("style");
312
312
  return e.textContent = `
313
- html[${L}] div#${F} { display: none !important; }
314
- html[${L}] div#${F}.${I} { display: initial !important; }
315
- `, document.head.appendChild(e), document.documentElement.setAttribute(L, ""), () => {
316
- e.remove(), document.documentElement.removeAttribute(L);
313
+ html[${R}] div#${I} { display: none !important; }
314
+ html[${R}] div#${I}.${L} { display: initial !important; }
315
+ `, document.head.appendChild(e), document.documentElement.setAttribute(R, ""), () => {
316
+ e.remove(), document.documentElement.removeAttribute(R);
317
317
  };
318
- }, []), null), ce = ({ debug: e, resources: t, ...n }) => {
318
+ }, []), null), se = ({ debug: e, resources: t, ...n }) => {
319
319
  let { libraries: r } = a(y), i = n?.i18 || r?.i18, { i18next: o, initReactI18next: s, languageDetector: c } = i || {};
320
- if (P) return null;
320
+ if (N) return null;
321
321
  if (!(i && o && c && s)) throw Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
322
322
  return o.isInitialized ? null : (o.use(c).use(s).init({
323
323
  debug: e,
@@ -335,12 +335,12 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
335
335
  }), o.on("languageChanged", (e) => {
336
336
  document.documentElement.setAttribute("lang", e);
337
337
  }), null);
338
- }, R = { replay: "keep" }, z = (e) => e.tags?.replay === R.replay, B = [/^https:\/\/(api|events)\.mapbox\.com\//], V = (e, t) => t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e)), le = ({ dsn: e, integrations: t, tracesSampleRate: n, tracePropagationTargets: r, ignoreErrors: i, ignoreRequestUrls: s, debug: c, environment: l, release: u, replaysSessionSampleRate: d = 0, replaysOnErrorSampleRate: f = 1, replayBeforeErrorSampling: p = z, ...m }) => {
338
+ }, ce = { replay: "keep" }, le = (e) => e.tags?.replay === ce.replay, ue = [/^https:\/\/(api|events)\.mapbox\.com\//], z = (e, t) => t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e)), de = ({ dsn: e, integrations: t, tracesSampleRate: n, tracePropagationTargets: r, ignoreErrors: i, ignoreRequestUrls: s, debug: c, environment: l, release: u, replaysSessionSampleRate: d = 0, replaysOnErrorSampleRate: f = 1, replayBeforeErrorSampling: p = le, ...m }) => {
339
339
  let { libraries: h } = a(y), g = m?.sentry || h?.sentry, _ = m?.reactRouter || h?.reactRouter;
340
340
  if (!g) throw Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
341
341
  if (!_) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
342
342
  if (g.isInitialized()) return null;
343
- let { createRoutesFromChildren: v, matchRoutes: b, useLocation: x, useNavigationType: S } = _, C = d > 0 || f > 0, w = [...s || [], ...B];
343
+ let { createRoutesFromChildren: v, matchRoutes: b, useLocation: x, useNavigationType: S } = _, C = d > 0 || f > 0, w = [...s || [], ...ue];
344
344
  return (c || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && g.init({
345
345
  debug: c,
346
346
  dsn: e,
@@ -358,7 +358,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
358
358
  g.reactRouterV6BrowserTracingIntegration({
359
359
  createRoutesFromChildren: v,
360
360
  matchRoutes: b,
361
- shouldCreateSpanForRequest: (e) => !V(e, w),
361
+ shouldCreateSpanForRequest: (e) => !z(e, w),
362
362
  useEffect: o,
363
363
  useLocation: x,
364
364
  useNavigationType: S
@@ -372,12 +372,12 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
372
372
  tracePropagationTargets: r,
373
373
  tracesSampleRate: n ?? 1
374
374
  }), null;
375
- }, H = /* @__PURE__ */ new WeakMap(), ue = "user", de = ({ Fallback: e, isLogged: n, loginPath: r = "/login", redirect401Path: i = "/login", ...s }) => {
376
- let { libraries: c, localStorageKeys: l } = a(y), f = s?.reactRouter || c?.reactRouter, p = s?.axios || c?.axios, m = s?.localStorageKey || l?.user || ue;
375
+ }, B = /* @__PURE__ */ new WeakMap(), fe = "user", pe = ({ Fallback: e, isLogged: n, loginPath: r = "/login", redirect401Path: i = "/login", ...s }) => {
376
+ let { libraries: c, localStorageKeys: l } = a(y), f = s?.reactRouter || c?.reactRouter, p = s?.axios || c?.axios, m = s?.localStorageKey || l?.user || fe;
377
377
  if (!f) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
378
378
  let [h, g] = u(null), { useLocation: _, Navigate: v, Outlet: b } = f, x = _(), S = typeof n == "function" ? n() : !!n, C = typeof S == "boolean" ? S : S?.isLogged;
379
379
  return o(() => {
380
- p && (H.has(p) || (H.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)))));
380
+ 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)))));
381
381
  }, [
382
382
  p,
383
383
  m,
@@ -393,34 +393,34 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
393
393
  state: { from: x },
394
394
  replace: !0
395
395
  });
396
- }, U = /* @__PURE__ */ new Set(), fe = () => (o(() => {
396
+ }, V = /* @__PURE__ */ new Set(), me = () => (o(() => {
397
397
  let e = Symbol();
398
- return U.add(e), document.documentElement.removeAttribute(L), () => {
399
- U.delete(e), U.size === 0 && document.documentElement.setAttribute(L, "");
398
+ return V.add(e), document.documentElement.removeAttribute(R), () => {
399
+ V.delete(e), V.size === 0 && document.documentElement.setAttribute(R, "");
400
400
  };
401
- }, []), null), pe = "user", me = {
401
+ }, []), null), he = "user", ge = {
402
402
  client: "/v2/threads/ws",
403
403
  supplier: "/v1/threads/ws"
404
- }, he = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, ge = (e) => {
404
+ }, _e = (e, t) => `${e.startsWith("https") ? "wss" : "ws"}://${e.replace(/^https?:\/\//, "")}${t}`, ve = (e) => {
405
405
  try {
406
406
  let t = localStorage.getItem(e);
407
407
  return t ? JSON.parse(t)?.accessToken ?? null : null;
408
408
  } catch {
409
409
  return null;
410
410
  }
411
- }, W = n(null), _e = ({ 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, ee] = u(m), T = m && w, { apiURL: E, localStorageKeys: D } = a(y), O = D?.user || pe, k = l(null), A = l(/* @__PURE__ */ new Set());
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
413
  o(() => {
414
- if (!T) return;
415
- let e = r ?? me[h], i = n || (E ? he(E, e) : null);
414
+ if (!E) return;
415
+ let e = r ?? ge[h], i = n || (D ? _e(D, e) : null);
416
416
  if (!i) return;
417
- let a = () => t ?? ge(O), o = (e) => {
417
+ let a = () => t ?? ve(k), o = (e) => {
418
418
  switch (e.type) {
419
419
  case "ready":
420
420
  x(!0), C(e.unreadCount ?? 0);
421
421
  break;
422
422
  }
423
- for (let t of A.current) t(e);
423
+ for (let t of j.current) t(e);
424
424
  }, l = setTimeout(() => {
425
425
  let e = new _({
426
426
  getToken: a,
@@ -434,80 +434,80 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
434
434
  reconnectBaseDelay: c,
435
435
  url: i
436
436
  });
437
- k.current = e, e.connect();
437
+ A.current = e, e.connect();
438
438
  }, 0);
439
439
  return () => {
440
- clearTimeout(l), k.current?.disconnect(), k.current = null;
440
+ clearTimeout(l), A.current?.disconnect(), A.current = null;
441
441
  };
442
442
  }, [
443
- T,
443
+ E,
444
444
  n,
445
445
  r,
446
446
  h,
447
447
  t,
448
448
  p,
449
- E,
450
- O,
449
+ D,
450
+ k,
451
451
  f,
452
452
  s,
453
453
  c
454
454
  ]);
455
- let te = i((e) => {
456
- k.current?.joinThread(e);
457
- }, []), j = i((e) => {
458
- k.current?.leaveThread(e);
459
- }, []), M = i((e, t) => {
460
- k.current?.sendMessage(e, t);
461
- }, []), N = i((e) => {
462
- k.current?.markRead(e);
463
- }, []), P = i((e, t) => {
464
- k.current?.listThreads(e, t);
465
- }, []), ne = i((e = 1) => {
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
466
  C((t) => t + e);
467
- }, []), re = {
467
+ }, []), F = {
468
468
  decrementUnreadCount: i((e = 1) => {
469
469
  C((t) => Math.max(0, t - e));
470
470
  }, []),
471
471
  disconnect: i(() => {
472
- k.current?.disconnect(), k.current = null;
472
+ A.current?.disconnect(), A.current = null;
473
473
  }, []),
474
- incrementUnreadCount: ne,
474
+ incrementUnreadCount: P,
475
475
  isConnected: g,
476
476
  isReady: b,
477
- joinThread: te,
478
- leaveThread: j,
479
- listThreads: P,
480
- markRead: N,
481
- sendMessage: M,
477
+ joinThread: ee,
478
+ leaveThread: te,
479
+ listThreads: N,
480
+ markRead: M,
481
+ sendMessage: ne,
482
482
  setEnabled: i((e) => {
483
- ee(e);
483
+ T(e);
484
484
  }, []),
485
- subscribe: i((e) => (A.current.add(e), () => {
486
- A.current.delete(e);
485
+ subscribe: i((e) => (j.current.add(e), () => {
486
+ j.current.delete(e);
487
487
  }), []),
488
488
  unreadCount: S
489
489
  };
490
- return /* @__PURE__ */ d(W.Provider, {
491
- value: re,
490
+ return /* @__PURE__ */ d(H.Provider, {
491
+ value: F,
492
492
  children: e
493
493
  });
494
- }, ve = 3, ye = new Set([
494
+ }, be = 3, xe = new Set([
495
495
  400,
496
496
  401,
497
497
  403,
498
498
  404
499
- ]), be = (e) => e?.response?.status, G = (e, t) => {
500
- let n = be(t);
501
- return e < ve && !(n !== void 0 && ye.has(n));
502
- }, xe = (e, t, n) => (Array.isArray(e) ? e.length : 0) + (typeof n == "number" ? n : 0), Se = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
499
+ ]), Se = (e) => e?.response?.status, U = (e, t) => {
500
+ let n = Se(t);
501
+ return e < be && !(n !== void 0 && xe.has(n));
502
+ }, Ce = (e, t, n) => (Array.isArray(e) ? e.length : 0) + (typeof n == "number" ? n : 0), we = ({ children: e, defaultQueriesOptions: t, defaultMutationsOptions: n, ...r }) => {
503
503
  let { libraries: i } = a(y), o = r.QueryClient || i?.reactQuery?.QueryClient, s = r.QueryClientProvider || i?.reactQuery?.QueryClientProvider;
504
504
  if (!o) throw Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
505
505
  if (!s) throw Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
506
506
  let [c] = u(() => new o({ defaultOptions: {
507
507
  mutations: n,
508
508
  queries: {
509
- getNextPageParam: xe,
510
- retry: G,
509
+ getNextPageParam: Ce,
510
+ retry: U,
511
511
  ...t
512
512
  }
513
513
  } }));
@@ -515,17 +515,17 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
515
515
  client: c,
516
516
  children: e
517
517
  });
518
- }, K = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), q = (e, t) => {
518
+ }, W = ({ library: e, date: t, format: n = "ll" }) => e(t).format(n), G = (e, t) => {
519
519
  let { fractionDigits: n = 0, metric: r = "km", spacingBetween: i = !0 } = t || {}, a = Number(e), o = i ? " " : "";
520
520
  return Number.isNaN(a) ? `0${o}${r}` : `${a.toFixed(n)}${o}${r}`;
521
- }, J = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((e) => e.length > 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" "), Ce = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, we = ({ path: e, size: t, apiURL: n }) => {
521
+ }, K = (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
522
  if (!e) return "";
523
- let r = `${n}${Ce(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
523
+ let r = `${n}${Te(e)}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
524
524
  return typeof t == "number" && i ? `${r.replace("/files", `/thumbs/${t}`)}` : r;
525
- }, Te = (e) => {
525
+ }, De = (e) => {
526
526
  let { apiURL: t, libraries: n } = a(y), r = e?.dayjs || n?.dayjs, o = i((e, n) => {
527
527
  if (!t) throw Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");
528
- return typeof e == "string" && /^https?:\/\//.test(e) ? e : we({
528
+ return typeof e == "string" && /^https?:\/\//.test(e) ? e : Ee({
529
529
  apiURL: t,
530
530
  path: e,
531
531
  size: n
@@ -534,17 +534,17 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
534
534
  return {
535
535
  dateAdapter: i((e, t) => {
536
536
  if (!r) throw Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
537
- return K({
537
+ return W({
538
538
  date: e,
539
539
  format: t,
540
540
  library: r
541
541
  });
542
542
  }, [r]),
543
- distanceAdapter: q,
543
+ distanceAdapter: G,
544
544
  filePathAdapter: o,
545
- worksiteNameAdapter: J
545
+ worksiteNameAdapter: K
546
546
  };
547
- }, Ee = () => {
547
+ }, Oe = () => {
548
548
  let { libraries: e } = a(y), t = e?.amplitude?.analytics, n = i((e, n) => {
549
549
  if (!t || (t.setUserId(e), !n)) return;
550
550
  let r = new t.Identify();
@@ -568,7 +568,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
568
568
  setGroup: r,
569
569
  track: o
570
570
  };
571
- }, De = (e) => {
571
+ }, ke = (e) => {
572
572
  let { libraries: t, localStorageKeys: n } = a(y), r = e?.axios || t?.axios, s = e?.localStorageKey || n?.user || "user";
573
573
  if (!r) throw Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
574
574
  let c = i(({ tokenType: e, accessToken: t }) => {
@@ -577,7 +577,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
577
577
  r.defaults.headers.common.Authorization = null;
578
578
  }, [r.defaults.headers.common]);
579
579
  return o(() => {
580
- if (P) return;
580
+ if (N) return;
581
581
  let e = ({ newValue: e, key: t }) => {
582
582
  if (t === s) try {
583
583
  let { accessToken: t, tokenType: n } = JSON.parse(e ?? "null") ?? {};
@@ -604,9 +604,9 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
604
604
  clearAuthenticationToken: l,
605
605
  setAuthenticationToken: c
606
606
  };
607
- }, Oe = "New message", ke = (e, t) => {
607
+ }, Ae = "New message", je = (e, t) => {
608
608
  if (!("Notification" in window) || typeof Notification != "function" || Notification.permission !== "granted" || !document.hidden) return;
609
- let n = new Notification(t.title ?? Oe, {
609
+ let n = new Notification(t.title ?? Ae, {
610
610
  badge: t?.badge,
611
611
  body: t?.body || e.bodyPreview,
612
612
  data: t?.data,
@@ -621,8 +621,8 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
621
621
  let { onClick: r } = t;
622
622
  n.onclick = () => r(e);
623
623
  }
624
- }, Ae = (e) => {
625
- let t = a(W);
624
+ }, Me = (e) => {
625
+ let t = a(H);
626
626
  if (!t) throw Error("useChat must be used within ChatProvider");
627
627
  let { subscribe: n, setEnabled: r, ...i } = t, s = l(e);
628
628
  return s.current = e, o(() => {
@@ -639,7 +639,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
639
639
  r?.(e);
640
640
  break;
641
641
  case "new_message_notification":
642
- i?.(e), t && t.enabled !== !1 && ke(e, t);
642
+ i?.(e), t && t.enabled !== !1 && je(e, t);
643
643
  break;
644
644
  case "presence":
645
645
  a?.(e);
@@ -664,44 +664,44 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
664
664
  break;
665
665
  }
666
666
  }), [n]), i;
667
- }, Y = (e, t = "full") => {
667
+ }, q = (e, t = "full") => {
668
668
  let n = e || navigator.language;
669
669
  return t === "short" ? n.split("-")[0] : n;
670
- }, je = (e, t = "full") => {
671
- let [n, r] = u(() => Y(e?.language, t));
670
+ }, Ne = (e, t = "full") => {
671
+ let [n, r] = u(() => q(e?.language, t));
672
672
  return o(() => {
673
- e && "isInitialized" in e && e.isInitialized && e.language && r(Y(e.language, t));
673
+ e && "isInitialized" in e && e.isInitialized && e.language && r(q(e.language, t));
674
674
  let n = (e) => {
675
- r(Y(e, t));
675
+ r(q(e, t));
676
676
  };
677
677
  return e?.on?.("languageChanged", n), () => {
678
678
  e?.off?.("languageChanged", n);
679
679
  };
680
680
  }, [e, t]), n;
681
- }, Me = "tracktor.filter", Ne = {
681
+ }, Pe = "tracktor.filter", Fe = {
682
682
  getFilter: () => void 0,
683
683
  getFilters: () => ({}),
684
684
  handleFilter: () => () => {},
685
685
  setFilter: () => {}
686
- }, Pe = (e) => {
686
+ }, Ie = (e) => {
687
687
  try {
688
688
  return JSON.parse(e);
689
689
  } catch {
690
690
  return e;
691
691
  }
692
- }, Fe = (e, t, n) => `${n}_${e}=>${t}`, Ie = (e) => e.reduce((e, t) => {
692
+ }, Le = (e, t, n) => `${n}_${e}=>${t}`, Re = (e) => e.reduce((e, t) => {
693
693
  let n = localStorage.getItem(t);
694
694
  if (n) try {
695
695
  let t = JSON.parse(n), r = Object.keys(t)?.[0];
696
696
  r && (e[r] = Object.values(t)?.[0]);
697
697
  } catch {}
698
698
  return e;
699
- }, {}), Le = (e) => {
700
- let { libraries: t, localStorageKeys: n } = a(y), r = e?.reactRouter || t?.reactRouter, { pathname: i } = r?.useLocation?.() ?? { pathname: "/" }, [o, s] = r?.useSearchParams?.() ?? [new URLSearchParams(), () => {}], [c, l] = u({}), d = n?.filter || Me, f = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, p = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
701
- if (P) return Ne;
699
+ }, {}), ze = (e) => {
700
+ let { libraries: t, localStorageKeys: n } = a(y), r = e?.reactRouter || t?.reactRouter, { pathname: i } = r?.useLocation?.() ?? { pathname: "/" }, [o, s] = r?.useSearchParams?.() ?? [new URLSearchParams(), () => {}], [c, l] = u({}), d = n?.filter || Pe, f = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, p = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
701
+ if (N) return Fe;
702
702
  if (!r) throw Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");
703
703
  let m = () => Object.keys(localStorage).filter((t) => t.startsWith(d) && t.endsWith(e?.pathname || i)), h = (t, n, r = !0) => {
704
- let a = Fe(t, e?.pathname || i, d);
704
+ let a = Le(t, e?.pathname || i, d);
705
705
  if (!n || Array.isArray(n) && !n.length) {
706
706
  f ? (o.delete(t), s(o)) : l((e) => {
707
707
  let n = { ...e };
@@ -721,13 +721,13 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
721
721
  getFilter: (t, n) => {
722
722
  if (f) {
723
723
  let e = o.get(t);
724
- if (e) return Pe(e);
724
+ if (e) return Ie(e);
725
725
  } else {
726
726
  let e = c[t];
727
727
  if (e !== void 0) return e;
728
728
  }
729
729
  if (p) {
730
- let n = Fe(t, e?.pathname || i, d), r = localStorage.getItem(n);
730
+ let n = Le(t, e?.pathname || i, d), r = localStorage.getItem(n);
731
731
  if (r) try {
732
732
  let e = JSON.parse(r)[t];
733
733
  return !f && e !== void 0 && l((n) => ({
@@ -739,9 +739,9 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
739
739
  return n;
740
740
  },
741
741
  getFilters: () => {
742
- let e = p ? Ie(m()) : {};
742
+ let e = p ? Re(m()) : {};
743
743
  if (f) {
744
- let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = Pe(n), e), {});
744
+ let t = Array.from(o.entries()).reduce((e, [t, n]) => (e[t] = Ie(n), e), {});
745
745
  return {
746
746
  ...e,
747
747
  ...t
@@ -762,7 +762,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
762
762
  },
763
763
  setFilter: h
764
764
  };
765
- }, Re = () => document.getElementById(F), ze = () => {
765
+ }, Be = () => document.getElementById(I), Ve = () => {
766
766
  let [e, t] = u(() => !!window.HubSpotConversations);
767
767
  return o(() => {
768
768
  if (window.HubSpotConversations) {
@@ -772,16 +772,16 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
772
772
  window.hsConversationsOnReady = [() => t(!0)];
773
773
  }, []), o(() => {
774
774
  e && window.HubSpotConversations?.on("widgetClosed", () => {
775
- Re()?.classList.remove(I);
775
+ Be()?.classList.remove(L);
776
776
  });
777
777
  }, [e]), {
778
778
  isAvailable: e,
779
779
  toggle: i(() => {
780
- let e = window.HubSpotConversations, t = Re();
781
- e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(I)) : (t.classList.add(I), e.widget.open()));
780
+ let e = window.HubSpotConversations, t = Be();
781
+ e && t && (t.classList.contains("hs-show") ? (e.widget.close(), t.classList.remove(L)) : (t.classList.add(L), e.widget.open()));
782
782
  }, [])
783
783
  };
784
- }, Be = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
784
+ }, He = ({ data: e, fetchNextPage: t, isFetchingNextPage: n, isInitialLoading: r, isLoading: a, enabled: o = !0 }) => {
785
785
  let s = i(async (e) => {
786
786
  n || !o || await t({ pageParam: e?.pageParam || e.visibleRowsCount });
787
787
  }, [
@@ -797,7 +797,7 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
797
797
  loadingVariant: r ? "skeleton" : "linear-progress",
798
798
  rows: l
799
799
  };
800
- }, Ve = (e) => {
800
+ }, Ue = (e) => {
801
801
  let { libraries: t } = a(y), n = e?.i18 || t?.i18, r = e?.i18?.translateFunction || t?.i18?.translateFunction, o = n?.i18next?.t || r || ((e) => e), { unknownErrorTranslationKey: s = "error.unknownError" } = e || {}, c = o(s), l = i((e) => {
802
802
  if (e && typeof e == "object" && "response" in e) {
803
803
  let { response: t } = e || {};
@@ -821,10 +821,10 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
821
821
  }, []),
822
822
  printError: l
823
823
  };
824
- }, He = String.raw`(?:chauffeur|conducteur|op[ée]rateur|machiniste|driver|operator)`, Ue = String.raw`(?:(?:avec|with|incl(?:\.|uding|us)?|y\s+compris)\s+|\+\s*)(?:(?:un|une|le|la|son|sa|an?|the|its)\s+)?`, We = String.raw`(?:\s+(?:inclus|compris|included))?`, Ge = 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?))`, Ke = String.raw`(?:\s*[-–—,/·:]?\s*${Ge}|\s*\(\s*${Ge}\s*\))?`, qe = String.raw`(?:(?:location|rental|rented)\s+)?(?:${Ue}${He}${We}|${He}\s+(?:inclus|compris|included))${Ke}`, X = new RegExp(String.raw`\s*[[(]\s*${qe}\s*[\])]`, "giu"), Je = new RegExp(String.raw`(?:^|[\s,;:/|–—-])\s*${qe}\s*$`, "iu"), Ye = /[\s,;:/|–—-]+$/u, Xe = ([e]) => {
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
825
  let t = e.replace(/^[\s,;:/|–—-]+/u, "").trim(), n = (/^[[(]/u.test(t) ? t.slice(1, -1) : t).trim().replace(/\s+/g, " ");
826
826
  return n.charAt(0).toLocaleUpperCase() + n.slice(1);
827
- }, Ze = (e) => e[1] || e[3] ? "days" : e[2] || e[4] ? "hours" : void 0, Qe = (e, { readDriver: t = !0 } = {}) => {
827
+ }, et = (e) => e[1] || e[3] ? "days" : e[2] || e[4] ? "hours" : void 0, tt = (e, { readDriver: t = !0 } = {}) => {
828
828
  if (typeof e != "string") return {
829
829
  label: "",
830
830
  withDriver: !1
@@ -833,12 +833,12 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
833
833
  label: e.trim(),
834
834
  withDriver: !1
835
835
  };
836
- let n = e.normalize("NFC"), r = [...n.matchAll(X)], i = n.replace(X, ""), a = i.match(Je), o = a ? i.slice(0, a.index) : i;
836
+ let n = e.normalize("NFC"), r = [...n.matchAll(Xe)], i = n.replace(Xe, ""), a = i.match(Ze), o = a ? i.slice(0, a.index) : i;
837
837
  if (o === n) return {
838
838
  label: e.trim(),
839
839
  withDriver: !1
840
840
  };
841
- let s = o.replace(Ye, "").replace(/\s{2,}/g, " ").trim(), c = [...r, ...a ? [a] : []], l = c.map(Ze).find(Boolean), u = Xe(c[0]);
841
+ let s = o.replace(Qe, "").replace(/\s{2,}/g, " ").trim(), c = [...r, ...a ? [a] : []], l = c.map(et).find(Boolean), u = $e(c[0]);
842
842
  return s ? l ? {
843
843
  driverMention: u,
844
844
  driverUnit: l,
@@ -852,38 +852,38 @@ var f = 3e4, p = 1e3, m = 1e4, h = (e) => Array.isArray(e) ? e.map(h) : typeof e
852
852
  label: e.trim(),
853
853
  withDriver: !1
854
854
  };
855
- }, $e = "chunk-reload-timestamp", Z = "chunk-reload", et = 1e4, Q = 2, tt = !1;
856
- if (!P && typeof window < "u") {
855
+ }, nt = "chunk-reload-timestamp", J = "chunk-reload", rt = 1e4, Y = 2, it = !1;
856
+ if (!N && typeof window < "u") {
857
857
  try {
858
858
  let e = new URL(window.location.href);
859
- e.searchParams.has(Z) && (tt = !0, e.searchParams.delete(Z), window.history.replaceState(null, "", e.toString()));
859
+ e.searchParams.has(J) && (it = !0, e.searchParams.delete(J), window.history.replaceState(null, "", e.toString()));
860
860
  } catch {}
861
861
  window.addEventListener("vite:preloadError", (e) => {
862
862
  e.preventDefault();
863
863
  });
864
864
  }
865
- var nt = (e) => {
865
+ var at = (e) => {
866
866
  if (!(e instanceof Error)) return !1;
867
867
  let t = e.message.toLowerCase();
868
868
  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
- }, rt = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, it = (e) => e.toString().match(rt)?.[2] ?? null, at = (e) => {
869
+ }, ot = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, st = (e) => e.toString().match(ot)?.[2] ?? null, ct = (e) => {
870
870
  try {
871
871
  return sessionStorage.getItem(e);
872
872
  } catch {
873
873
  return null;
874
874
  }
875
- }, ot = (e, t) => {
875
+ }, lt = (e, t) => {
876
876
  try {
877
877
  sessionStorage.setItem(e, t);
878
878
  } catch {}
879
- }, st = (e) => Function("url", "return import(url)")(e), ct = async (e) => {
880
- for (let t = 0; t < Q; t++) try {
881
- return await st(`${e}?t=${Date.now()}`);
879
+ }, ut = (e) => Function("url", "return import(url)")(e), dt = async (e) => {
880
+ for (let t = 0; t < Y; t++) try {
881
+ return await ut(`${e}?t=${Date.now()}`);
882
882
  } catch {
883
- t < Q - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
883
+ t < Y - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
884
884
  }
885
- throw Error(`Failed to import ${e} after ${Q} retries`);
886
- }, lt = async () => {
885
+ throw Error(`Failed to import ${e} after ${Y} retries`);
886
+ }, ft = async () => {
887
887
  try {
888
888
  if (typeof navigator < "u" && "serviceWorker" in navigator) {
889
889
  let e = await navigator.serviceWorker.getRegistrations();
@@ -894,28 +894,34 @@ var nt = (e) => {
894
894
  await Promise.all(e.map((e) => caches.delete(e)));
895
895
  }
896
896
  } catch {}
897
- }, ut = async () => {
898
- await lt();
897
+ }, pt = async () => {
898
+ await ft();
899
899
  let e = new URL(window.location.href);
900
- e.searchParams.set(Z, String(Date.now())), window.location.replace(e.toString());
901
- }, dt = (e) => e != null && e.default !== void 0, ft = (e) => r(async () => {
900
+ e.searchParams.set(J, String(Date.now())), window.location.replace(e.toString());
901
+ }, mt = (e) => e != null && e.default !== void 0, ht = (e) => r(async () => {
902
902
  let t;
903
903
  try {
904
904
  let n = await e();
905
- if (dt(n)) return n;
905
+ if (mt(n)) return n;
906
906
  t = /* @__PURE__ */ Error("Module resolved without a valid default export");
907
907
  } catch (e) {
908
908
  t = e;
909
909
  }
910
- if (P || !nt(t)) throw t;
911
- let n = it(e);
910
+ if (N || !at(t)) throw t;
911
+ let n = st(e);
912
912
  if (n) try {
913
- let e = await ct(n);
914
- if (dt(e)) return e;
913
+ let e = await dt(n);
914
+ if (mt(e)) return e;
915
915
  } catch {}
916
- let r = Number(at($e) || "0");
917
- return Date.now() - r < et || tt || (ot($e, String(Date.now())), await ut()), { default: () => null };
918
- }), pt = "Page Left", mt = 1800 * 1e3, ht = 1e3, gt = (e, t = !0) => {
916
+ let r = Number(ct(nt) || "0");
917
+ return Date.now() - r < rt || it || (lt(nt, String(Date.now())), await pt()), { default: () => null };
918
+ }), gt = "machine+operator", _t = "HOURS", vt = 8, yt = 24, X = (e) => e?.withOperator ?? e?.type === gt, bt = (e) => X(e) && tt(e?.name).driverUnit !== "days", Z = (e = []) => e.find((e) => Q(e) || X(e.article)), Q = ({ qtyUnit: e }) => e === _t, xt = ({ qtyUnit: e, quantity: t }) => Q({ qtyUnit: e }) ? 1 : t || 1, St = (e) => {
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) => {
919
925
  let n = 0, r = t ? e : null, i = !1, a = (e) => {
920
926
  r !== null && (n += Math.max(0, e - r), r = null);
921
927
  };
@@ -926,39 +932,39 @@ var nt = (e) => {
926
932
  resume: (e) => {
927
933
  !i && r === null && (r = e);
928
934
  },
929
- stop: (e) => (i ||= (a(e), !0), Math.min(mt, Math.round(n)))
935
+ stop: (e) => (i ||= (a(e), !0), Math.min(Tt, Math.round(n)))
930
936
  };
931
- }, _t = (e, t) => t < 1e3 ? null : {
937
+ }, Ot = (e, t) => t < 1e3 ? null : {
932
938
  duration_ms: Math.round(t),
933
939
  page_path: e
934
- }, vt = (e) => {
940
+ }, kt = (e) => {
935
941
  if (typeof e != "object" || !e) return !1;
936
942
  let { exp: t, sub: n, entity_id: r, scope: i } = e;
937
943
  return typeof t == "number" && typeof n == "string" && typeof r == "number" && Array.isArray(i) && i.every((e) => typeof e == "string");
938
- }, yt = (e) => {
944
+ }, At = (e) => {
939
945
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4);
940
946
  return decodeURIComponent(Array.from(atob(n), (e) => `%${e.charCodeAt(0).toString(16).padStart(2, "0")}`).join(""));
941
- }, bt = (e) => {
947
+ }, jt = (e) => {
942
948
  let t = e?.split(".")[1];
943
949
  if (!t) return null;
944
950
  try {
945
- let e = JSON.parse(yt(t));
946
- return vt(e) ? e : null;
951
+ let e = JSON.parse(At(t));
952
+ return kt(e) ? e : null;
947
953
  } catch {
948
954
  return null;
949
955
  }
950
- }, $ = (e) => btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), xt = async (e, t) => {
956
+ }, $ = (e) => btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), Mt = async (e, t) => {
951
957
  let n = new TextEncoder(), r = await crypto.subtle.importKey("raw", n.encode(e), {
952
958
  hash: "SHA-256",
953
959
  name: "HMAC"
954
960
  }, !1, ["sign"]), i = await crypto.subtle.sign("HMAC", r, n.encode(t));
955
961
  return $(String.fromCharCode(...new Uint8Array(i)));
956
- }, St = async (e, t) => {
962
+ }, Nt = async (e, t) => {
957
963
  let n = `${$(JSON.stringify({
958
964
  alg: "HS256",
959
965
  typ: "JWT"
960
966
  }))}.${$(JSON.stringify(e))}`;
961
- return `${n}.${await xt(t, n)}`;
967
+ return `${n}.${await Mt(t, n)}`;
962
968
  };
963
969
  //#endregion
964
- export { k as AMPLITUDE_FEATURE_SELECTOR, D as AutoReloadOnNewVersion, _ as ChatClient, W as ChatContext, _e as ChatProvider, O as GTMSendPageView, N as InitializeAmplitude, re as InitializeAxiosConfig, oe as InitializeDaysJSConfig, se as InitializeHubSpot, ce as InitializeI18nConfig, le as InitializeSentryConfig, y as InjectDependenciesContext, b as InjectDependenciesProvider, v as MaskTextField, mt as PAGE_DURATION_CAP_MS, ht as PAGE_DURATION_MIN_MS, pt as PAGE_LEFT_EVENT, Se as QueryProvider, de as RequireAuth, B as SENTRY_IGNORED_REQUEST_URLS, R as SENTRY_KEEP_REPLAY, ie as SUPPORTED_LANGUAGE, fe as ShowHubSpotBubble, Qe as articleNameAdapter, gt as createVisibleStopwatch, K as dateAdapter, bt as decodeToken, q as distanceAdapter, St as encodeToken, Y as getCurrentLanguage, e as getOrvalConfig, z as isReplayKeptForError, ft as lazyWithRetry, V as matchesRequestUrl, _t as pageLeftProperties, G as shouldRetryQuery, Te as useAdapter, Ee as useAmplitude, De as useAuth, Ae as useChat, je as useCurrentLanguage, Le as useFilters, ze as useHubSpot, Be as useInfiniteDataGrid, Ve as useResponseError, J as worksiteNameAdapter };
970
+ export { A as AMPLITUDE_FEATURE_SELECTOR, O as AutoReloadOnNewVersion, _ as ChatClient, H as ChatContext, ye as ChatProvider, vt as DEFAULT_OPERATOR_HOURS_PER_DAY, k as GTMSendPageView, M as InitializeAmplitude, F as InitializeAxiosConfig, ae as InitializeDaysJSConfig, oe as InitializeHubSpot, se as InitializeI18nConfig, de as InitializeSentryConfig, y as InjectDependenciesContext, b as InjectDependenciesProvider, yt as MAX_OPERATOR_HOURS_PER_DAY, v as MaskTextField, Tt as PAGE_DURATION_CAP_MS, Et as PAGE_DURATION_MIN_MS, wt as PAGE_LEFT_EVENT, we as QueryProvider, pe as RequireAuth, ue as SENTRY_IGNORED_REQUEST_URLS, ce as SENTRY_KEEP_REPLAY, re as SUPPORTED_LANGUAGE, me as ShowHubSpotBubble, tt as articleNameAdapter, Dt as createVisibleStopwatch, W as dateAdapter, jt as decodeToken, G as distanceAdapter, Nt as encodeToken, Z as findOperatorItem, q as getCurrentLanguage, St as getOperatorHoursPerDay, e as getOrvalConfig, xt as getUnitCount, Q as isHourlyLine, X as isOperatorArticle, Ct as isOperatorRateMissing, bt as isOrderedByTheHour, le as isReplayKeptForError, ht as lazyWithRetry, z as matchesRequestUrl, Ot as pageLeftProperties, U as shouldRetryQuery, De as useAdapter, Oe as useAmplitude, ke as useAuth, Me as useChat, Ne as useCurrentLanguage, ze as useFilters, Ve as useHubSpot, He as useInfiniteDataGrid, Ue as useResponseError, K as worksiteNameAdapter };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Driver's hours per day when none is asked: the day a contract's day price stands for
3
+ */
4
+ export declare const DEFAULT_OPERATOR_HOURS_PER_DAY = 8;
5
+ /**
6
+ * A whole day, the most a driver's day counts: past 12 hours the machine runs in shifts, its drivers taking turns
7
+ */
8
+ export declare const MAX_OPERATOR_HOURS_PER_DAY = 24;
9
+ /**
10
+ * What tells an article rented with its driver
11
+ */
12
+ export interface OperatorArticle {
13
+ type?: string | null;
14
+ withOperator?: boolean | null;
15
+ }
16
+ /**
17
+ * What tells a line ordered by the hour
18
+ */
19
+ export interface OperatorLine {
20
+ article?: OperatorArticle | null;
21
+ qtyUnit?: string | null;
22
+ quantity?: number | null;
23
+ /**
24
+ * On a line ordered by the hour, the hourly rate
25
+ */
26
+ unitPrice?: number | null;
27
+ }
28
+ /**
29
+ * Whether an article is rented with its driver: the catalog says so, or the article's type where the catalog says nothing
30
+ */
31
+ export declare const isOperatorArticle: (article?: OperatorArticle | null) => boolean;
32
+ /**
33
+ * Whether an article rented with its driver is ordered by the hour, for the driver's hours per day: unless its catalog
34
+ * name says it is billed by the day ("[Avec opérateur Jours]"), as a client's catalog does for its day rates
35
+ */
36
+ export declare const isOrderedByTheHour: (article?: (OperatorArticle & {
37
+ name?: string | null;
38
+ }) | null) => boolean;
39
+ /**
40
+ * The line of an order rented with its driver, the one its hour sheets are about: the line ordered by the hour (a
41
+ * machine asked with its driver is, whatever its article), or one whose article comes with its driver, ordered by the day
42
+ * before the hourly lines
43
+ */
44
+ export declare const findOperatorItem: <Item extends Pick<OperatorLine, "article" | "qtyUnit">>(items?: Item[]) => Item | undefined;
45
+ /**
46
+ * Whether a line is ordered by the hour: its quantity is then the driver's hours per day, not a number of machines
47
+ */
48
+ export declare const isHourlyLine: ({ qtyUnit }: Pick<OperatorLine, "qtyUnit">) => boolean;
49
+ /**
50
+ * The number of machines a line orders: its quantity, but for a line ordered by the hour, which is a single machine
51
+ */
52
+ export declare const getUnitCount: ({ qtyUnit, quantity }: Pick<OperatorLine, "qtyUnit" | "quantity">) => number;
53
+ /**
54
+ * Driver's hours per day of an order: the quantity of its driver's line once ordered by the hour, none before
55
+ */
56
+ export declare const getOperatorHoursPerDay: (order?: {
57
+ items?: OperatorLine[];
58
+ } | null) => number | undefined;
59
+ /**
60
+ * Whether the driver's line of an order, ordered by the hour, still lacks its hourly rate: the API takes none of its
61
+ * hour sheets until it has one
62
+ */
63
+ export declare const isOperatorRateMissing: (order?: {
64
+ items?: OperatorLine[];
65
+ } | null) => boolean;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getsoren/shared-module",
3
- "version": "2.66.0",
3
+ "version": "2.68.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "types": "./dist/main.d.ts",