@getsoren/shared-module 2.63.2 → 2.65.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,8 +211,9 @@ 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
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
|
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 |
|
package/dist/main.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export { default as useInfiniteDataGrid } from './hooks/useInfiniteDataGrid';
|
|
|
47
47
|
export * from './hooks/useResponseError/useResponseError';
|
|
48
48
|
export { default as useResponseError } from './hooks/useResponseError/useResponseError';
|
|
49
49
|
export { default as getOrvalConfig } from './orval/orval';
|
|
50
|
+
export * from './utils/adapter/articleNameAdapter/articleNameAdapter';
|
|
51
|
+
export { default as articleNameAdapter } from './utils/adapter/articleNameAdapter/articleNameAdapter';
|
|
50
52
|
export { default as dateAdapter } from './utils/adapter/dateAdapter';
|
|
51
53
|
export { default as distanceAdapter } from './utils/adapter/distanceAdapter';
|
|
52
54
|
export { default as worksiteNameAdapter } from './utils/adapter/worksiteNameAdapter/worksiteNameAdapter';
|
package/dist/main.js
CHANGED
|
@@ -821,38 +821,64 @@ 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 = "
|
|
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) => e[1] || e[3] ? "days" : e[2] || e[4] ? "hours" : void 0, Ze = (e, { readDriver: t = !0 } = {}) => {
|
|
825
|
+
if (typeof e != "string") return {
|
|
826
|
+
label: "",
|
|
827
|
+
withDriver: !1
|
|
828
|
+
};
|
|
829
|
+
if (!t) return {
|
|
830
|
+
label: e.trim(),
|
|
831
|
+
withDriver: !1
|
|
832
|
+
};
|
|
833
|
+
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;
|
|
834
|
+
if (o === n) return {
|
|
835
|
+
label: e.trim(),
|
|
836
|
+
withDriver: !1
|
|
837
|
+
};
|
|
838
|
+
let s = o.replace(Ye, "").replace(/\s{2,}/g, " ").trim(), c = [...r, ...a ? [a] : []].map(Xe).find(Boolean);
|
|
839
|
+
return s ? c ? {
|
|
840
|
+
driverUnit: c,
|
|
841
|
+
label: s,
|
|
842
|
+
withDriver: !0
|
|
843
|
+
} : {
|
|
844
|
+
label: s,
|
|
845
|
+
withDriver: !0
|
|
846
|
+
} : {
|
|
847
|
+
label: e.trim(),
|
|
848
|
+
withDriver: !1
|
|
849
|
+
};
|
|
850
|
+
}, Qe = "chunk-reload-timestamp", Z = "chunk-reload", $e = 1e4, Q = 2, et = !1;
|
|
825
851
|
if (!P && typeof window < "u") {
|
|
826
852
|
try {
|
|
827
853
|
let e = new URL(window.location.href);
|
|
828
|
-
e.searchParams.has(
|
|
854
|
+
e.searchParams.has(Z) && (et = !0, e.searchParams.delete(Z), window.history.replaceState(null, "", e.toString()));
|
|
829
855
|
} catch {}
|
|
830
856
|
window.addEventListener("vite:preloadError", (e) => {
|
|
831
857
|
e.preventDefault();
|
|
832
858
|
});
|
|
833
859
|
}
|
|
834
|
-
var
|
|
860
|
+
var tt = (e) => {
|
|
835
861
|
if (!(e instanceof Error)) return !1;
|
|
836
862
|
let t = e.message.toLowerCase();
|
|
837
863
|
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";
|
|
838
|
-
},
|
|
864
|
+
}, nt = /import\s*\(\s*(['"])((\w+:(\/?\/?))?[^\s,]+)\1/, rt = (e) => e.toString().match(nt)?.[2] ?? null, it = (e) => {
|
|
839
865
|
try {
|
|
840
866
|
return sessionStorage.getItem(e);
|
|
841
867
|
} catch {
|
|
842
868
|
return null;
|
|
843
869
|
}
|
|
844
|
-
},
|
|
870
|
+
}, at = (e, t) => {
|
|
845
871
|
try {
|
|
846
872
|
sessionStorage.setItem(e, t);
|
|
847
873
|
} catch {}
|
|
848
|
-
},
|
|
849
|
-
for (let t = 0; t <
|
|
850
|
-
return await
|
|
874
|
+
}, ot = (e) => Function("url", "return import(url)")(e), st = async (e) => {
|
|
875
|
+
for (let t = 0; t < Q; t++) try {
|
|
876
|
+
return await ot(`${e}?t=${Date.now()}`);
|
|
851
877
|
} catch {
|
|
852
|
-
t <
|
|
878
|
+
t < Q - 1 && await new Promise((e) => setTimeout(e, 500 * 2 ** t));
|
|
853
879
|
}
|
|
854
|
-
throw Error(`Failed to import ${e} after ${
|
|
855
|
-
},
|
|
880
|
+
throw Error(`Failed to import ${e} after ${Q} retries`);
|
|
881
|
+
}, ct = async () => {
|
|
856
882
|
try {
|
|
857
883
|
if (typeof navigator < "u" && "serviceWorker" in navigator) {
|
|
858
884
|
let e = await navigator.serviceWorker.getRegistrations();
|
|
@@ -863,28 +889,28 @@ var We = (e) => {
|
|
|
863
889
|
await Promise.all(e.map((e) => caches.delete(e)));
|
|
864
890
|
}
|
|
865
891
|
} catch {}
|
|
866
|
-
},
|
|
867
|
-
await
|
|
892
|
+
}, lt = async () => {
|
|
893
|
+
await ct();
|
|
868
894
|
let e = new URL(window.location.href);
|
|
869
|
-
e.searchParams.set(
|
|
870
|
-
},
|
|
895
|
+
e.searchParams.set(Z, String(Date.now())), window.location.replace(e.toString());
|
|
896
|
+
}, ut = (e) => e != null && e.default !== void 0, dt = (e) => r(async () => {
|
|
871
897
|
let t;
|
|
872
898
|
try {
|
|
873
899
|
let n = await e();
|
|
874
|
-
if (
|
|
900
|
+
if (ut(n)) return n;
|
|
875
901
|
t = /* @__PURE__ */ Error("Module resolved without a valid default export");
|
|
876
902
|
} catch (e) {
|
|
877
903
|
t = e;
|
|
878
904
|
}
|
|
879
|
-
if (P || !
|
|
880
|
-
let n =
|
|
905
|
+
if (P || !tt(t)) throw t;
|
|
906
|
+
let n = rt(e);
|
|
881
907
|
if (n) try {
|
|
882
|
-
let e = await
|
|
883
|
-
if (
|
|
908
|
+
let e = await st(n);
|
|
909
|
+
if (ut(e)) return e;
|
|
884
910
|
} catch {}
|
|
885
|
-
let r = Number(
|
|
886
|
-
return Date.now() - r <
|
|
887
|
-
}),
|
|
911
|
+
let r = Number(it(Qe) || "0");
|
|
912
|
+
return Date.now() - r < $e || et || (at(Qe, String(Date.now())), await lt()), { default: () => null };
|
|
913
|
+
}), ft = "Page Left", pt = 1800 * 1e3, mt = 1e3, ht = (e, t = !0) => {
|
|
888
914
|
let n = 0, r = t ? e : null, i = !1, a = (e) => {
|
|
889
915
|
r !== null && (n += Math.max(0, e - r), r = null);
|
|
890
916
|
};
|
|
@@ -895,39 +921,39 @@ var We = (e) => {
|
|
|
895
921
|
resume: (e) => {
|
|
896
922
|
!i && r === null && (r = e);
|
|
897
923
|
},
|
|
898
|
-
stop: (e) => (i ||= (a(e), !0), Math.min(
|
|
924
|
+
stop: (e) => (i ||= (a(e), !0), Math.min(pt, Math.round(n)))
|
|
899
925
|
};
|
|
900
|
-
},
|
|
926
|
+
}, gt = (e, t) => t < 1e3 ? null : {
|
|
901
927
|
duration_ms: Math.round(t),
|
|
902
928
|
page_path: e
|
|
903
|
-
},
|
|
929
|
+
}, _t = (e) => {
|
|
904
930
|
if (typeof e != "object" || !e) return !1;
|
|
905
931
|
let { exp: t, sub: n, entity_id: r, scope: i } = e;
|
|
906
932
|
return typeof t == "number" && typeof n == "string" && typeof r == "number" && Array.isArray(i) && i.every((e) => typeof e == "string");
|
|
907
|
-
},
|
|
933
|
+
}, vt = (e) => {
|
|
908
934
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4);
|
|
909
935
|
return decodeURIComponent(Array.from(atob(n), (e) => `%${e.charCodeAt(0).toString(16).padStart(2, "0")}`).join(""));
|
|
910
|
-
},
|
|
936
|
+
}, yt = (e) => {
|
|
911
937
|
let t = e?.split(".")[1];
|
|
912
938
|
if (!t) return null;
|
|
913
939
|
try {
|
|
914
|
-
let e = JSON.parse(
|
|
915
|
-
return
|
|
940
|
+
let e = JSON.parse(vt(t));
|
|
941
|
+
return _t(e) ? e : null;
|
|
916
942
|
} catch {
|
|
917
943
|
return null;
|
|
918
944
|
}
|
|
919
|
-
}, $ = (e) => btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""),
|
|
945
|
+
}, $ = (e) => btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), bt = async (e, t) => {
|
|
920
946
|
let n = new TextEncoder(), r = await crypto.subtle.importKey("raw", n.encode(e), {
|
|
921
947
|
hash: "SHA-256",
|
|
922
948
|
name: "HMAC"
|
|
923
949
|
}, !1, ["sign"]), i = await crypto.subtle.sign("HMAC", r, n.encode(t));
|
|
924
950
|
return $(String.fromCharCode(...new Uint8Array(i)));
|
|
925
|
-
},
|
|
951
|
+
}, xt = async (e, t) => {
|
|
926
952
|
let n = `${$(JSON.stringify({
|
|
927
953
|
alg: "HS256",
|
|
928
954
|
typ: "JWT"
|
|
929
955
|
}))}.${$(JSON.stringify(e))}`;
|
|
930
|
-
return `${n}.${await
|
|
956
|
+
return `${n}.${await bt(t, n)}`;
|
|
931
957
|
};
|
|
932
958
|
//#endregion
|
|
933
|
-
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,
|
|
959
|
+
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, pt as PAGE_DURATION_CAP_MS, mt as PAGE_DURATION_MIN_MS, ft 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, Ze as articleNameAdapter, ht as createVisibleStopwatch, K as dateAdapter, yt as decodeToken, q as distanceAdapter, xt as encodeToken, Y as getCurrentLanguage, e as getOrvalConfig, z as isReplayKeptForError, dt as lazyWithRetry, V as matchesRequestUrl, gt 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 };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An article's name split from the mention of its driver.
|
|
3
|
+
*/
|
|
4
|
+
export interface ArticleName {
|
|
5
|
+
/**
|
|
6
|
+
* The name without the mention, to show beside a tag that says it instead.
|
|
7
|
+
*/
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* The name said the machine comes with its driver.
|
|
11
|
+
*/
|
|
12
|
+
withDriver: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* How the name says the driver is billed, when it does: by the day or by the hour. Two articles of a catalog can
|
|
15
|
+
* differ by it alone ("[Avec opérateur Jours]", "[Avec opérateur Heures]"): the tag says it.
|
|
16
|
+
*/
|
|
17
|
+
driverUnit?: DriverUnit;
|
|
18
|
+
}
|
|
19
|
+
export type DriverUnit = "days" | "hours";
|
|
20
|
+
export interface ArticleNameOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Off, the mention of the driver is left in the name, as written, and never read: where no tag would say it
|
|
23
|
+
* instead.
|
|
24
|
+
*/
|
|
25
|
+
readDriver?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Reads the mention of the driver a catalog or a supplier writes in an article's name ("Grue mobile 50T [avec
|
|
29
|
+
* chauffeur]", "Pelle 9-10 t - avec conducteur", "Chariot télescopique [Avec opérateur Jours]"), and how the driver is
|
|
30
|
+
* billed when the name says so, so that a tag says it instead. A mention between brackets or parentheses is read
|
|
31
|
+
* anywhere; one without them only at the end of the name, where it cannot be part of it. "Sans chauffeur" and any
|
|
32
|
+
* other wording are left in the name.
|
|
33
|
+
*/
|
|
34
|
+
declare const articleNameAdapter: (name: unknown, { readDriver }?: ArticleNameOptions) => ArticleName;
|
|
35
|
+
export default articleNameAdapter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|