@choosemycompany/lib 0.8.0 → 0.9.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
@@ -40,7 +40,7 @@ The sandbox uses a Vite alias `@choosemycompany/lib` → `../src/index.ts`, so e
40
40
 
41
41
  ### The `/auth` page
42
42
 
43
- It exercises `useAuthSession` against a mocked auth backend: `POST /auth/api/v2/login`, `POST /auth/api/v2/login/token/refresh` and `POST /auth/api/v2/logout` served at the **origin** like the real auth-api, a protected resource under `/api/session/protected`, and `POST /api/session/simulate` to age the session without waiting 4 h.
43
+ It exercises `useAuthSession` against a mocked auth backend: `POST /auth/api/v2/login`, `POST /auth/api/v2/session/tokens` and `POST /auth/api/v2/logout` served at the **origin** like the real auth-api, a protected resource under `/api/session/protected`, and `POST /api/session/simulate` to age the session without waiting 4 h.
44
44
 
45
45
  The scenario: sign in, call the protected API, expire the token, call again. The app writes a single `http.get` and the trace shows three calls — the `401`, the renewal, the replay.
46
46
 
@@ -4,7 +4,7 @@ import { SessionExpiryReason } from './types';
4
4
  * declared base URL, never appended to it: that base URL may carry a path
5
5
  * prefix, while the auth API always sits at this path on the origin. Internal.
6
6
  */
7
- export declare const REFRESH_URI = "/auth/api/v2/login/token/refresh";
7
+ export declare const REFRESH_URI = "/auth/api/v2/session/tokens";
8
8
  /**
9
9
  * Path prefix of the auth API. A call to it is never renewed and replayed: it
10
10
  * speaks *about* the session rather than relying on it, so a `401` from `login`
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Resolves the `{name}` placeholders of a URI template.
3
+ *
4
+ * Every placeholder is replaced, each value is passed through
5
+ * `encodeURIComponent`, and a placeholder the params do not provide throws
6
+ * instead of sending a request to a wrong path.
7
+ *
8
+ * @example
9
+ * buildUrl('/v3/forms/{id}/periods/{period}', { id: 42, period: '2026' })
10
+ * // → '/v3/forms/42/periods/2026'
11
+ */
12
+ export declare function buildUrl(template: string, params: Record<string, string | number>): string;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,8 @@
6
6
  *
7
7
  * Grouped by concern:
8
8
  * - **HTTP** — {@link configureHttp}: the app declares its base URLs;
9
- * {@link useHttp}: thin `mande` wrapper bound to one of them.
9
+ * {@link useHttp}: thin `mande` wrapper bound to one of them;
10
+ * {@link buildUrl}: resolves the `{name}` placeholders of a URI template.
10
11
  * - **Store** — {@link useStore}, {@link getViewKey}: typed cache for `retrieve` /
11
12
  * `list` workflows with single-flight, per-key errors, and CRUD mutations.
12
13
  * - **i18n** — locale-aware translators for plain strings, country names,
@@ -21,6 +22,7 @@
21
22
  */
22
23
  export { useHttp } from './http/useHttp';
23
24
  export { configureHttp, type HttpConfig } from './http/config';
25
+ export { buildUrl } from './http/buildUrl';
24
26
  export { useAuthSession } from './auth/useAuthSession';
25
27
  export { useStore, getViewKey, CREATE_PENDING_KEY, type Store } from './store/useStore';
26
28
  export { useClickOutside } from './ui/useClickOutside';
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { mande as N } from "mande";
2
- import { ref as w, computed as E, onMounted as z, onBeforeUnmount as K, onUnmounted as H } from "vue";
2
+ import { ref as w, computed as R, onMounted as z, onBeforeUnmount as H, onUnmounted as K } from "vue";
3
3
  import { defineStore as F } from "pinia";
4
- import { useI18n as k } from "vue-i18n";
4
+ import { useI18n as E } from "vue-i18n";
5
5
  import { createError as O } from "h3";
6
6
  import { showError as x, useRuntimeConfig as q, useState as Z } from "nuxt/app";
7
7
  let I;
8
- function le(e) {
8
+ function ce(e) {
9
9
  if (!e.baseUrl)
10
10
  throw new Error("@choosemycompany/lib: configureHttp() needs a non-empty baseUrl");
11
11
  I = e;
@@ -16,30 +16,30 @@ function D(e) {
16
16
  "@choosemycompany/lib: useHttp() was called before configureHttp(). Declare the base URLs from an app plugin."
17
17
  );
18
18
  if (e === void 0) return I.baseUrl;
19
- const a = I.targets ?? {}, n = Object.hasOwn(a, e) ? a[e] : void 0;
20
- if (typeof n != "string" || !n) {
21
- const t = Object.keys(a), i = t.length > 0 ? t.join(", ") : "none";
19
+ const a = I.targets ?? {}, i = Object.hasOwn(a, e) ? a[e] : void 0;
20
+ if (typeof i != "string" || !i) {
21
+ const t = Object.keys(a), n = t.length > 0 ? t.join(", ") : "none";
22
22
  throw new Error(
23
- `@choosemycompany/lib: no HTTP target named "${e}". Declared targets: ${i}.`
23
+ `@choosemycompany/lib: no HTTP target named "${e}". Declared targets: ${n}.`
24
24
  );
25
25
  }
26
- return n;
26
+ return i;
27
27
  }
28
- const V = "/auth/api/v2/login/token/refresh", J = "/auth/api/v2/", j = "cmc-auth-session-refresh", _ = F("cmc-auth-session", () => {
29
- const e = w(!1), a = w(!1), n = w(void 0);
30
- let t, i = 0;
31
- const s = E(() => e.value && !a.value);
28
+ const V = "/auth/api/v2/session/tokens", J = "/auth/api/v2/", j = "cmc-auth-session-refresh", _ = F("cmc-auth-session", () => {
29
+ const e = w(!1), a = w(!1), i = w(void 0);
30
+ let t, n = 0;
31
+ const s = R(() => e.value && !a.value);
32
32
  function d() {
33
- e.value = !0, a.value = !1, n.value = void 0;
33
+ e.value = !0, a.value = !1, i.value = void 0;
34
34
  }
35
35
  function l() {
36
- i += 1, e.value = !1, a.value = !1, n.value = void 0;
36
+ n += 1, e.value = !1, a.value = !1, i.value = void 0;
37
37
  }
38
38
  function p() {
39
- i += 1, e.value = !1, a.value = !0, n.value = "logout";
39
+ n += 1, e.value = !1, a.value = !0, i.value = "logout";
40
40
  }
41
41
  function c(h) {
42
- i += 1, e.value = !1, a.value = !0, n.value = h;
42
+ n += 1, e.value = !1, a.value = !0, i.value = h;
43
43
  }
44
44
  async function m() {
45
45
  if (a.value)
@@ -54,7 +54,7 @@ const V = "/auth/api/v2/login/token/refresh", J = "/auth/api/v2/", j = "cmc-auth
54
54
  await b.request(j, h);
55
55
  }
56
56
  async function g() {
57
- const h = i, b = () => h !== i, r = new URL(V, D()).href;
57
+ const h = n, b = () => h !== n, r = new URL(V, D()).href;
58
58
  let u;
59
59
  try {
60
60
  u = await fetch(r, {
@@ -71,12 +71,12 @@ const V = "/auth/api/v2/login/token/refresh", J = "/auth/api/v2/", j = "cmc-auth
71
71
  d();
72
72
  }
73
73
  function C() {
74
- n.value = "refresh-unreachable";
74
+ i.value = "refresh-unreachable";
75
75
  }
76
76
  return {
77
77
  isOpen: e,
78
78
  isExpired: a,
79
- expiryReason: n,
79
+ expiryReason: i,
80
80
  isAuthenticated: s,
81
81
  open: d,
82
82
  expire: c,
@@ -94,44 +94,53 @@ function W(e) {
94
94
  function Q() {
95
95
  return async (e, a) => {
96
96
  if ($()) return fetch(e, a);
97
- const n = await fetch(e, a);
98
- if (n.status !== 401 || W(e) || new Headers(a?.headers).has("Authorization")) return n;
97
+ const i = await fetch(e, a);
98
+ if (i.status !== 401 || W(e) || new Headers(a?.headers).has("Authorization")) return i;
99
99
  let t;
100
100
  try {
101
101
  t = _();
102
102
  } catch {
103
- return n;
103
+ return i;
104
104
  }
105
- if (t.isExpired) return n;
105
+ if (t.isExpired) return i;
106
106
  try {
107
107
  await t.refresh();
108
- } catch (i) {
109
- return t.isExpired || console.warn("[cmc-lib] token refresh failed, returning the original 401", i), n;
108
+ } catch (n) {
109
+ return t.isExpired || console.warn("[cmc-lib] token refresh failed, returning the original 401", n), i;
110
110
  }
111
111
  return fetch(e, a);
112
112
  };
113
113
  }
114
- function ce(e) {
114
+ function fe(e) {
115
115
  const a = N(D(e), {
116
116
  headers: {}
117
117
  }, Q());
118
- function n(i) {
118
+ function i(n) {
119
119
  a.options.headers = {
120
120
  ...a.options.headers ?? {},
121
- Authorization: `Bearer ${i}`
121
+ Authorization: `Bearer ${n}`
122
122
  };
123
123
  }
124
124
  function t() {
125
125
  a.options.headers && delete a.options.headers.Authorization;
126
126
  }
127
- return { http: a, setToken: n, clearToken: t };
127
+ return { http: a, setToken: i, clearToken: t };
128
128
  }
129
- function U(e) {
130
- return Object.entries(e).sort(([a], [n]) => a.localeCompare(n)).map(([a, n]) => `${a}=${n}`).join("|");
129
+ function pe(e, a) {
130
+ return e.replace(Y, (i, t) => {
131
+ const n = Object.hasOwn(a, t) ? a[t] : void 0;
132
+ if (typeof n != "string" && typeof n != "number")
133
+ throw new Error(`Missing URL parameter "${t}" for template "${e}"`);
134
+ return encodeURIComponent(String(n));
135
+ });
131
136
  }
132
- const Y = "create";
133
- function fe(e) {
134
- const a = w({}), n = w({}), t = w({}), i = w({}), s = e.getItemId ?? ((r) => {
137
+ const Y = /\{(\w+)\}/g;
138
+ function T(e) {
139
+ return Object.entries(e).sort(([a], [i]) => a.localeCompare(i)).map(([a, i]) => `${a}=${i}`).join("|");
140
+ }
141
+ const X = "create";
142
+ function ge(e) {
143
+ const a = w({}), i = w({}), t = w({}), n = w({}), s = e.getItemId ?? ((r) => {
135
144
  const u = r.id;
136
145
  if (u === void 0)
137
146
  throw new Error(
@@ -140,17 +149,17 @@ function fe(e) {
140
149
  return u;
141
150
  });
142
151
  function d(r) {
143
- return !!i.value[r];
152
+ return !!n.value[r];
144
153
  }
145
154
  async function l(r, u) {
146
- i.value[r] = u;
155
+ n.value[r] = u;
147
156
  try {
148
157
  const o = await u;
149
158
  return delete t.value[r], o;
150
159
  } catch (o) {
151
160
  throw t.value[r] = o, o;
152
161
  } finally {
153
- i.value[r] === u && delete i.value[r];
162
+ n.value[r] === u && delete n.value[r];
154
163
  }
155
164
  }
156
165
  async function p(r, u = {}) {
@@ -159,7 +168,7 @@ function fe(e) {
159
168
  const { force: o = !1 } = u;
160
169
  if (a.value[r] && !o)
161
170
  return a.value[r];
162
- const f = i.value[r];
171
+ const f = n.value[r];
163
172
  if (f)
164
173
  return f;
165
174
  const B = e.fetchOne, S = (async () => {
@@ -170,13 +179,13 @@ function fe(e) {
170
179
  t.value[r] = M;
171
180
  return;
172
181
  } finally {
173
- delete i.value[r];
182
+ delete n.value[r];
174
183
  }
175
184
  })();
176
- return i.value[r] = S, S;
185
+ return n.value[r] = S, S;
177
186
  }
178
187
  function c(r) {
179
- const u = U(r), o = n.value[u];
188
+ const u = T(r), o = i.value[u];
180
189
  if (o)
181
190
  return {
182
191
  items: o.itemIds.map((f) => a.value[f]).filter((f) => f !== void 0),
@@ -189,21 +198,21 @@ function fe(e) {
189
198
  async function m(r, u = {}) {
190
199
  if (!e.fetchPage)
191
200
  throw new Error("useStore.list called but fetchPage is not defined in store options");
192
- const o = U(r), { force: f = !1 } = u;
193
- if (n.value[o] && !f)
201
+ const o = T(r), { force: f = !1 } = u;
202
+ if (i.value[o] && !f)
194
203
  return c(r);
195
- const B = i.value[o];
204
+ const B = n.value[o];
196
205
  if (B)
197
206
  return await B, c(r);
198
207
  const S = e.fetchPage, M = (async () => {
199
208
  try {
200
- const A = await S(r), R = [];
209
+ const A = await S(r), k = [];
201
210
  for (const y of A.items) {
202
- const P = e.enrichItem ? e.enrichItem(y) : y, T = s(P);
203
- a.value[T] = P, R.push(T);
211
+ const P = e.enrichItem ? e.enrichItem(y) : y, U = s(P);
212
+ a.value[U] = P, k.push(U);
204
213
  }
205
- n.value[o] = {
206
- itemIds: R,
214
+ i.value[o] = {
215
+ itemIds: k,
207
216
  total: A.total,
208
217
  hasMore: A.hasMore,
209
218
  page: A.page,
@@ -212,16 +221,16 @@ function fe(e) {
212
221
  } catch (A) {
213
222
  t.value[o] = A;
214
223
  } finally {
215
- delete i.value[o];
224
+ delete n.value[o];
216
225
  }
217
226
  })();
218
- return i.value[o] = M, await M, c(r);
227
+ return n.value[o] = M, await M, c(r);
219
228
  }
220
- async function v(r, u = Y) {
229
+ async function v(r, u = X) {
221
230
  if (!e.createMutation)
222
231
  throw new Error("useStore.create called but createMutation is not defined in store options");
223
232
  const o = e.createMutation, f = await l(u, (async () => o(r))()), B = e.enrichItem ? e.enrichItem(f) : f, S = s(B);
224
- return a.value[S] = B, n.value = {}, B;
233
+ return a.value[S] = B, i.value = {}, B;
225
234
  }
226
235
  async function g(r, u) {
227
236
  if (!e.updateMutation)
@@ -234,7 +243,7 @@ function fe(e) {
234
243
  throw new Error("useStore.remove called but removeMutation is not defined in store options");
235
244
  const u = e.removeMutation;
236
245
  await l(r, (async () => u(r))()), delete a.value[r];
237
- for (const o of Object.values(n.value)) {
246
+ for (const o of Object.values(i.value)) {
238
247
  const f = o.itemIds.indexOf(r);
239
248
  f !== -1 && (o.itemIds.splice(f, 1), o.total = Math.max(0, o.total - 1));
240
249
  }
@@ -243,38 +252,38 @@ function fe(e) {
243
252
  t.value = {};
244
253
  }
245
254
  function b() {
246
- a.value = {}, n.value = {}, t.value = {}, i.value = {};
255
+ a.value = {}, i.value = {}, t.value = {}, n.value = {};
247
256
  }
248
- return { items: a, views: n, errors: t, isPending: d, list: m, reset: b, retrieve: p, getView: c, withPending: l, create: v, update: g, remove: C, clearErrors: h };
257
+ return { items: a, views: i, errors: t, isPending: d, list: m, reset: b, retrieve: p, getView: c, withPending: l, create: v, update: g, remove: C, clearErrors: h };
249
258
  }
250
- function pe(e, a) {
251
- const n = (t) => {
252
- const i = e.value, s = t.target;
253
- !i || !s || i.contains(s) || a();
259
+ function me(e, a) {
260
+ const i = (t) => {
261
+ const n = e.value, s = t.target;
262
+ !n || !s || n.contains(s) || a();
254
263
  };
255
264
  z(() => {
256
- document.addEventListener("click", n);
257
- }), K(() => {
258
- document.removeEventListener("click", n);
265
+ document.addEventListener("click", i);
266
+ }), H(() => {
267
+ document.removeEventListener("click", i);
259
268
  });
260
269
  }
261
- function ge() {
262
- const { locale: e } = k();
263
- function a(n, t = null) {
264
- const i = X[n.trim().toUpperCase()];
265
- if (!i)
266
- throw new Error(`Unknown country code: ${n}`);
267
- if (t && i[t])
268
- return i[t];
269
- if (i[e.value])
270
- return i[e.value];
271
- if (e.value !== "en" && i.en)
272
- return i.en;
273
- throw new Error(`Unknown country code: ${n}`);
270
+ function he() {
271
+ const { locale: e } = E();
272
+ function a(i, t = null) {
273
+ const n = ee[i.trim().toUpperCase()];
274
+ if (!n)
275
+ throw new Error(`Unknown country code: ${i}`);
276
+ if (t && n[t])
277
+ return n[t];
278
+ if (n[e.value])
279
+ return n[e.value];
280
+ if (e.value !== "en" && n.en)
281
+ return n.en;
282
+ throw new Error(`Unknown country code: ${i}`);
274
283
  }
275
284
  return a;
276
285
  }
277
- const X = {
286
+ const ee = {
278
287
  AD: { en: "Andorra", fr: "Andorre", es: "Andorra", de: "Andorra", it: "Andorra", pt: "Andorra", da: "Andorra" },
279
288
  AE: { en: "United Arab Emirates", fr: "Émirats arabes unis", es: "Emiratos Árabes Unidos", de: "Vereinigte Arabische Emirate", it: "Emirati Arabi Uniti", pt: "Emirados Árabes Unidos", da: "De Forenede Arabiske Emirater" },
280
289
  AF: { en: "Afghanistan", fr: "Afghanistan", es: "Afganistán", de: "Afghanistan", it: "Afghanistan", pt: "Afeganistão", da: "Afghanistan" },
@@ -412,53 +421,53 @@ const X = {
412
421
  ZA: { en: "South Africa", fr: "Afrique Du Sud", es: "Sudáfrica", de: "Südafrika", it: "Sudafrica", pt: "África Do Sul", da: "Sydafrika" },
413
422
  ZM: { en: "Zambia", fr: "Zambie", es: "Zambia", de: "Sambia", it: "Zambia", pt: "Zâmbia", da: "Zambia" },
414
423
  ZW: { en: "Zimbabwe", fr: "Zimbabwe", es: "Zimbabue", de: "Simbabwe", it: "Zimbabwe", pt: "Zimbábue", da: "Zimbabwe" }
415
- }, me = ({ code: e, message: a, data: n }) => {
416
- const t = a || "An unexpected error occurred", i = O({
424
+ }, be = ({ code: e, message: a, data: i }) => {
425
+ const t = a || "An unexpected error occurred", n = O({
417
426
  statusCode: e,
418
427
  statusMessage: t,
419
428
  message: t,
420
- data: n
429
+ data: i
421
430
  });
422
- throw x(i), i;
423
- }, ee = "ilcJCL_lmpwcEJfSkKND";
424
- function he() {
431
+ throw x(n), n;
432
+ }, ae = "ilcJCL_lmpwcEJfSkKND";
433
+ function Be() {
425
434
  const { gtagId: e } = q().public;
426
435
  return { reportConversion: () => {
427
436
  if (typeof window > "u" || typeof window.gtag > "u" || !e)
428
437
  return;
429
- const n = `${e}/${ee}`;
438
+ const i = `${e}/${ae}`;
430
439
  window.gtag("event", "conversion", {
431
- send_to: n
440
+ send_to: i
432
441
  });
433
442
  } };
434
443
  }
435
444
  const L = "https://5509641.hs-sites-eu1.com";
436
- function be() {
437
- const { locale: e } = k();
438
- return { contactUrl: E(() => e.value === "fr" ? `${L}/contact` : `${L}/${e.value}/contact`) };
445
+ function ve() {
446
+ const { locale: e } = E();
447
+ return { contactUrl: R(() => e.value === "fr" ? `${L}/contact` : `${L}/${e.value}/contact`) };
439
448
  }
440
- function Be() {
449
+ function Ae() {
441
450
  async function e(t) {
442
451
  await Promise.all(
443
452
  t.map(
444
- (i) => new Promise((s) => {
445
- if (!i) return s(null);
453
+ (n) => new Promise((s) => {
454
+ if (!n) return s(null);
446
455
  const d = new Image();
447
- d.onload = () => s(null), d.onerror = () => s(null), d.src = i;
456
+ d.onload = () => s(null), d.onerror = () => s(null), d.src = n;
448
457
  })
449
458
  )
450
459
  );
451
460
  }
452
- function a(t, i) {
453
- return i.split(".").reduce((s, d) => s && typeof s == "object" && d in s ? s[d] : "", t) ?? "";
461
+ function a(t, n) {
462
+ return n.split(".").reduce((s, d) => s && typeof s == "object" && d in s ? s[d] : "", t) ?? "";
454
463
  }
455
- function n(t, i, s) {
464
+ function i(t, n, s) {
456
465
  if (import.meta.server)
457
466
  return async (l) => {
458
467
  t.value = !0;
459
468
  };
460
469
  const d = Z(
461
- `${i}LoadedImageCache`,
470
+ `${n}LoadedImageCache`,
462
471
  () => ({})
463
472
  );
464
473
  return async (l) => {
@@ -466,7 +475,7 @@ function Be() {
466
475
  t.value = !1;
467
476
  return;
468
477
  }
469
- const p = s.map((v) => a(l, v)), c = `${i}|${p.join("|")}`;
478
+ const p = s.map((v) => a(l, v)), c = `${n}|${p.join("|")}`;
470
479
  if (d.value[c]) {
471
480
  t.value = !0;
472
481
  return;
@@ -476,51 +485,51 @@ function Be() {
476
485
  await e(m), d.value[c] = !0, t.value = !0;
477
486
  };
478
487
  }
479
- return n;
488
+ return i;
480
489
  }
481
- const ae = {
490
+ const ne = {
482
491
  en: ["US", "UK"]
483
- }, ne = "FR";
484
- function ie(e) {
485
- const a = e.trim().replace("_", "-"), [n, t] = a.split("-");
492
+ }, ie = "FR";
493
+ function te(e) {
494
+ const a = e.trim().replace("_", "-"), [i, t] = a.split("-");
486
495
  return {
487
- language: n?.toLowerCase() ?? "",
496
+ language: i?.toLowerCase() ?? "",
488
497
  region: t?.toUpperCase() ?? ""
489
498
  };
490
499
  }
491
500
  function G(e) {
492
501
  return e.toString().trim().toUpperCase();
493
502
  }
494
- function ve() {
495
- function e(a, n) {
496
- if (!n.length) return;
497
- const t = n.map(G), i = new Set(t), { language: s, region: d } = ie(a), l = [];
503
+ function Ce() {
504
+ function e(a, i) {
505
+ if (!i.length) return;
506
+ const t = i.map(G), n = new Set(t), { language: s, region: d } = te(a), l = [];
498
507
  d && l.push(d);
499
- const p = ae[s];
500
- p?.length && l.push(...p.map(G)), s && l.push(s.toUpperCase()), l.push(ne);
508
+ const p = ne[s];
509
+ p?.length && l.push(...p.map(G)), s && l.push(s.toUpperCase()), l.push(ie);
501
510
  for (const c of l)
502
- if (i.has(c))
511
+ if (n.has(c))
503
512
  return c;
504
513
  return t[0];
505
514
  }
506
515
  return { getRegionFromLocale: e };
507
516
  }
508
- function Ae() {
509
- const { t: e } = k();
510
- function a(n, t) {
511
- const i = e(n), s = [], l = t.map((g) => g.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), p = new RegExp(`\\[(${l})\\]([\\s\\S]*?)\\[\\/\\1\\]`, "g"), c = t.reduce((g, C) => (g[C] = !1, g), {});
512
- let m = 0, v = p.exec(i);
517
+ function we() {
518
+ const { t: e } = E();
519
+ function a(i, t) {
520
+ const n = e(i), s = [], l = t.map((g) => g.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), p = new RegExp(`\\[(${l})\\]([\\s\\S]*?)\\[\\/\\1\\]`, "g"), c = t.reduce((g, C) => (g[C] = !1, g), {});
521
+ let m = 0, v = p.exec(n);
513
522
  for (; v; ) {
514
523
  const { index: g, 0: C, 1: h, 2: b } = v;
515
- g > m && s.push({ text: i.slice(m, g), ...c }), b && h && s.push({ text: b, ...c, [h]: !0 }), m = g + C.length, v = p.exec(i);
524
+ g > m && s.push({ text: n.slice(m, g), ...c }), b && h && s.push({ text: b, ...c, [h]: !0 }), m = g + C.length, v = p.exec(n);
516
525
  }
517
- return m < i.length && s.push({ text: i.slice(m), ...c }), s;
526
+ return m < n.length && s.push({ text: n.slice(m), ...c }), s;
518
527
  }
519
528
  return { parse: a };
520
529
  }
521
- function Ce(e, a, n = 768) {
522
- const t = w(n - 1), i = E(
523
- () => t.value >= n ? a : e
530
+ function Me(e, a, i = 768) {
531
+ const t = w(i - 1), n = R(
532
+ () => t.value >= i ? a : e
524
533
  );
525
534
  if (import.meta.client) {
526
535
  const s = () => {
@@ -528,36 +537,37 @@ function Ce(e, a, n = 768) {
528
537
  };
529
538
  z(() => {
530
539
  s(), window.addEventListener("resize", s);
531
- }), H(() => {
540
+ }), K(() => {
532
541
  window.removeEventListener("resize", s);
533
542
  });
534
543
  }
535
- return { size: i, windowWidth: t };
544
+ return { size: n, windowWidth: t };
536
545
  }
537
- function we() {
538
- const { locale: e } = k();
539
- function a(n, t = "fr") {
540
- if (!n) return "";
541
- const i = e.value;
542
- return n[i] ?? n[t] ?? "";
546
+ function Se() {
547
+ const { locale: e } = E();
548
+ function a(i, t = "fr") {
549
+ if (!i) return "";
550
+ const n = e.value;
551
+ return i[n] ?? i[t] ?? "";
543
552
  }
544
553
  return a;
545
554
  }
546
555
  export {
547
- Y as CREATE_PENDING_KEY,
548
- le as configureHttp,
549
- U as getViewKey,
550
- me as showAndThrowError,
556
+ X as CREATE_PENDING_KEY,
557
+ pe as buildUrl,
558
+ ce as configureHttp,
559
+ T as getViewKey,
560
+ be as showAndThrowError,
551
561
  _ as useAuthSession,
552
- pe as useClickOutside,
553
- ge as useCountriesTranslation,
554
- he as useGtagConversion,
555
- ce as useHttp,
556
- be as useHubspotContactUrl,
557
- Be as useImageCacheWatcherCallback,
558
- ve as useLocaleHelpers,
559
- Ae as useParseTranslation,
560
- Ce as useResponsiveSize,
561
- fe as useStore,
562
- we as useTranslate
562
+ me as useClickOutside,
563
+ he as useCountriesTranslation,
564
+ Be as useGtagConversion,
565
+ fe as useHttp,
566
+ ve as useHubspotContactUrl,
567
+ Ae as useImageCacheWatcherCallback,
568
+ Ce as useLocaleHelpers,
569
+ we as useParseTranslation,
570
+ Me as useResponsiveSize,
571
+ ge as useStore,
572
+ Se as useTranslate
563
573
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@choosemycompany/lib",
3
3
  "description": "Shared composables, stores and types for ChooseMyCompany front apps",
4
- "version": "0.8.0",
4
+ "version": "0.9.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "packageManager": "pnpm@10.17.0",