@burdenoff/fe-libs 2026.522.1 → 2026.522.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationCenter.d.ts","sourceRoot":"","sources":["../../src/chrome/NotificationCenter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD,MAAM,WAAW,uBAAuB;IACtC,2CAA2C;IAC3C,MAAM,EAAE,YAAY,CAAC;IACrB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAsXD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAuiB1D,CAAC"}
1
+ {"version":3,"file":"NotificationCenter.d.ts","sourceRoot":"","sources":["../../src/chrome/NotificationCenter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD,MAAM,WAAW,uBAAuB;IACtC,2CAA2C;IAC3C,MAAM,EAAE,YAAY,CAAC;IACrB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAsXD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA8jB1D,CAAC"}
@@ -132,11 +132,11 @@ var c = s`
132
132
  label: "Marketing"
133
133
  }
134
134
  ];
135
- function ee(e) {
135
+ function y(e) {
136
136
  let t = Date.now() - new Date(e).getTime(), n = Math.floor(t / 1e3), r = Math.floor(n / 60), i = Math.floor(r / 60), a = Math.floor(i / 24);
137
137
  return n < 60 ? "Just now" : r < 60 ? `${r}m ago` : i < 24 ? `${i}h ago` : a < 7 ? `${a}d ago` : new Date(e).toLocaleDateString();
138
138
  }
139
- function y(e, t) {
139
+ function ee(e, t) {
140
140
  let n = [...e];
141
141
  switch (t) {
142
142
  case "newest": return n.sort((e, t) => new Date(t.createdAt).getTime() - new Date(e.createdAt).getTime());
@@ -145,7 +145,7 @@ function y(e, t) {
145
145
  default: return n;
146
146
  }
147
147
  }
148
- var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
148
+ var te = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
149
149
  let { id: i, title: s, message: c, type: l, priority: u, appName: d, redirectUrl: f, isRead: p, createdAt: m } = e, _ = h[u] ?? h.MEDIUM, v = g[l] ?? {
150
150
  icon: "🔔",
151
151
  label: l
@@ -238,7 +238,7 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
238
238
  }),
239
239
  /* @__PURE__ */ a("span", {
240
240
  className: "text-[10px] text-text-tertiary",
241
- children: ee(m)
241
+ children: y(m)
242
242
  }),
243
243
  f && /* @__PURE__ */ o("button", {
244
244
  onClick: (e) => {
@@ -265,7 +265,7 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
265
265
  })
266
266
  ]
267
267
  });
268
- }, x = () => /* @__PURE__ */ o("div", {
268
+ }, b = () => /* @__PURE__ */ o("div", {
269
269
  className: "flex gap-3 p-3 rounded-card border border-border-subtle animate-pulse",
270
270
  children: [/* @__PURE__ */ a("div", { className: "w-6 h-6 rounded bg-bg-muted flex-shrink-0" }), /* @__PURE__ */ o("div", {
271
271
  className: "flex-1 space-y-2",
@@ -278,33 +278,33 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
278
278
  })
279
279
  ]
280
280
  })]
281
- }), te = ({ client: s, onViewAll: h, compact: ee = !1, pollInterval: te = 3e4, lazy: S = !1 }) => {
282
- let C = n(null), [w, T] = r(!1), [E, D] = r(!1), [O, k] = r([]), [A, j] = r(0), [M, N] = r({}), [P, F] = r(0), [I, L] = r(!1), [R, z] = r(null), [B, V] = r("all"), [H, U] = r("ALL"), [W, G] = r("ALL"), [K, ne] = r("newest");
281
+ }), ne = ({ client: s, onViewAll: h, compact: y = !1, pollInterval: ne = 3e4, lazy: x = !1 }) => {
282
+ let S = n(null), [C, w] = r(!1), [T, E] = r(!1), [D, O] = r([]), [k, A] = r(0), [j, M] = r({}), [N, P] = r(0), [F, I] = r(!1), [L, R] = r(null), [z, B] = r("all"), [V, H] = r("ALL"), [U, W] = r("ALL"), [G, re] = r("newest");
283
283
  t(() => {
284
284
  let e = window.matchMedia("(max-width: 767px)");
285
- D(e.matches);
286
- let t = (e) => D(e.matches);
285
+ E(e.matches);
286
+ let t = (e) => E(e.matches);
287
287
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
288
288
  }, []), t(() => {
289
- if (!w || E) return;
289
+ if (!C || T) return;
290
290
  let e = (e) => {
291
- C.current && !C.current.contains(e.target) && T(!1);
291
+ S.current && !S.current.contains(e.target) && w(!1);
292
292
  };
293
293
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
294
- }, [w, E]), t(() => {
295
- if (!w) return;
294
+ }, [C, T]), t(() => {
295
+ if (!C) return;
296
296
  let e = (e) => {
297
- e.key === "Escape" && T(!1);
297
+ e.key === "Escape" && w(!1);
298
298
  };
299
299
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
300
- }, [w]);
301
- let q = n(s);
300
+ }, [C]);
301
+ let K = n(s);
302
302
  t(() => {
303
- q.current = s;
303
+ K.current = s;
304
304
  }, [s]);
305
- let J = e(async () => {
305
+ let q = e(async () => {
306
306
  try {
307
- let e = (await q.current.query({
307
+ let e = (await K.current.query({
308
308
  query: l,
309
309
  variables: { filter: {
310
310
  channel: "IN_APP",
@@ -312,13 +312,23 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
312
312
  } },
313
313
  fetchPolicy: "network-only"
314
314
  })).data;
315
- j(e?.myUnreadNotificationCount ?? 0);
315
+ A(e?.myUnreadNotificationCount ?? 0);
316
316
  } catch {}
317
- }, []);
317
+ }, []), [J, ie] = r(!1);
318
318
  t(() => {
319
- if (S) return;
320
- J();
321
- let e = q.current.subscribe({
319
+ let e = () => ie(!0);
320
+ if (typeof window < "u" && "requestIdleCallback" in window) {
321
+ let t = window.requestIdleCallback(e, { timeout: 2e3 });
322
+ return () => {
323
+ window.cancelIdleCallback?.(t);
324
+ };
325
+ }
326
+ let t = setTimeout(e, 500);
327
+ return () => clearTimeout(t);
328
+ }, []), t(() => {
329
+ if (x || !J) return;
330
+ q();
331
+ let e = K.current.subscribe({
322
332
  query: u,
323
333
  variables: { filter: {
324
334
  channel: "IN_APP",
@@ -328,23 +338,27 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
328
338
  }).subscribe({
329
339
  next: (e) => {
330
340
  let t = e.data;
331
- typeof t?.myUnreadNotificationCountStream == "number" && j(t.myUnreadNotificationCountStream);
341
+ typeof t?.myUnreadNotificationCountStream == "number" && A(t.myUnreadNotificationCountStream);
332
342
  },
333
343
  error: () => {}
334
- }), t = setInterval(J, 300 * 1e3);
344
+ }), t = setInterval(q, 300 * 1e3);
335
345
  return () => {
336
346
  e.unsubscribe(), clearInterval(t);
337
347
  };
338
- }, [J, S]);
348
+ }, [
349
+ q,
350
+ x,
351
+ J
352
+ ]);
339
353
  let Y = e(async () => {
340
- L(!0), z(null);
354
+ I(!0), R(null);
341
355
  try {
342
356
  let e = {
343
357
  channel: "IN_APP",
344
358
  archived: !1
345
359
  };
346
- B === "unread" && (e.isRead = !1), B === "read" && (e.isRead = !0), H !== "ALL" && (e.type = H), W !== "ALL" && (e.appName = W);
347
- let t = (await q.current.query({
360
+ z === "unread" && (e.isRead = !1), z === "read" && (e.isRead = !0), V !== "ALL" && (e.type = V), U !== "ALL" && (e.appName = U);
361
+ let t = (await K.current.query({
348
362
  query: c,
349
363
  variables: {
350
364
  filter: e,
@@ -353,75 +367,75 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
353
367
  },
354
368
  fetchPolicy: "network-only"
355
369
  })).data?.notifications;
356
- t && (k(t.items ?? []), F(t.total ?? 0));
370
+ t && (O(t.items ?? []), P(t.total ?? 0));
357
371
  } catch (e) {
358
- z(e instanceof Error ? e.message : "Failed to load notifications");
372
+ R(e instanceof Error ? e.message : "Failed to load notifications");
359
373
  } finally {
360
- L(!1);
374
+ I(!1);
361
375
  }
362
376
  }, [
363
- B,
364
- H,
365
- W
377
+ z,
378
+ V,
379
+ U
366
380
  ]), X = e(async () => {
367
381
  try {
368
- let e = (await q.current.query({
382
+ let e = (await K.current.query({
369
383
  query: d,
370
384
  fetchPolicy: "network-only"
371
385
  })).data;
372
- N(e?.myNotificationCountsByApp ?? {});
386
+ M(e?.myNotificationCountsByApp ?? {});
373
387
  } catch {}
374
388
  }, []);
375
389
  t(() => {
376
- w && (S && J(), Y(), X(), J());
390
+ C && (x && q(), Y(), X(), q());
377
391
  }, [
378
- w,
392
+ C,
379
393
  Y,
380
394
  X,
381
- J,
382
- S
395
+ q,
396
+ x
383
397
  ]);
384
- let re = e(() => {
385
- T((e) => !e);
386
- }, []), ie = e(async (e) => {
398
+ let ae = e(() => {
399
+ w((e) => !e);
400
+ }, []), oe = e(async (e) => {
387
401
  try {
388
- await q.current.mutate({
402
+ await K.current.mutate({
389
403
  mutation: f,
390
404
  variables: { id: e }
391
- }), k((t) => t.map((t) => t.id === e ? {
405
+ }), O((t) => t.map((t) => t.id === e ? {
392
406
  ...t,
393
407
  isRead: !0,
394
408
  readAt: (/* @__PURE__ */ new Date()).toISOString()
395
- } : t)), j((e) => Math.max(0, e - 1));
409
+ } : t)), A((e) => Math.max(0, e - 1));
396
410
  } catch (e) {
397
411
  console.error("Failed to mark notification as read:", e);
398
412
  }
399
- }, []), ae = e(async () => {
413
+ }, []), se = e(async () => {
400
414
  try {
401
- await q.current.mutate({ mutation: p }), k((e) => e.map((e) => ({
415
+ await K.current.mutate({ mutation: p }), O((e) => e.map((e) => ({
402
416
  ...e,
403
417
  isRead: !0,
404
418
  readAt: e.readAt || (/* @__PURE__ */ new Date()).toISOString()
405
- }))), j(0);
419
+ }))), A(0);
406
420
  } catch (e) {
407
421
  console.error("Failed to mark all notifications as read:", e);
408
422
  }
409
- }, []), oe = e(async (e) => {
423
+ }, []), ce = e(async (e) => {
410
424
  try {
411
- await q.current.mutate({
425
+ await K.current.mutate({
412
426
  mutation: m,
413
427
  variables: { id: e }
414
428
  });
415
- let t = O.find((t) => t.id === e);
416
- k((t) => t.filter((t) => t.id !== e)), F((e) => Math.max(0, e - 1)), t && !t.isRead && j((e) => Math.max(0, e - 1));
429
+ let t = D.find((t) => t.id === e);
430
+ O((t) => t.filter((t) => t.id !== e)), P((e) => Math.max(0, e - 1)), t && !t.isRead && A((e) => Math.max(0, e - 1));
417
431
  } catch (e) {
418
432
  console.error("Failed to delete notification:", e);
419
433
  }
420
- }, [O]), se = e((e) => {
434
+ }, [D]), le = e((e) => {
421
435
  window.open(e, "_blank", "noopener,noreferrer");
422
- }, []), ce = e(() => {
423
- T(!1), h?.();
424
- }, [h]), Z = y(O, K), Q = Object.entries(M).filter(([e]) => e && e !== "null").sort((e, t) => t[1] - e[1]), $ = /* @__PURE__ */ o("div", {
436
+ }, []), ue = e(() => {
437
+ w(!1), h?.();
438
+ }, [h]), Z = ee(D, G), Q = Object.entries(j).filter(([e]) => e && e !== "null").sort((e, t) => t[1] - e[1]), $ = /* @__PURE__ */ o("div", {
425
439
  className: "flex flex-col h-full",
426
440
  children: [
427
441
  /* @__PURE__ */ o("div", {
@@ -429,8 +443,8 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
429
443
  children: [/* @__PURE__ */ o("div", {
430
444
  className: "flex items-center gap-2",
431
445
  children: [
432
- E && /* @__PURE__ */ a("button", {
433
- onClick: () => T(!1),
446
+ T && /* @__PURE__ */ a("button", {
447
+ onClick: () => w(!1),
434
448
  className: "p-1 rounded-button hover:bg-action-ghost-bg-hover text-text-primary",
435
449
  "aria-label": "Close",
436
450
  children: /* @__PURE__ */ a("svg", {
@@ -462,19 +476,19 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
462
476
  className: "text-sm font-semibold text-text-primary",
463
477
  children: "Notifications"
464
478
  }),
465
- A > 0 && /* @__PURE__ */ a("span", {
479
+ k > 0 && /* @__PURE__ */ a("span", {
466
480
  className: "inline-flex items-center justify-center min-w-[20px] h-5 px-1.5 text-xs font-semibold text-action-primary-text bg-action-primary-bg rounded-full",
467
- children: A > 9 ? "9+" : A
481
+ children: k > 9 ? "9+" : k
468
482
  })
469
483
  ]
470
484
  }), /* @__PURE__ */ o("div", {
471
485
  className: "flex items-center gap-2",
472
- children: [A > 0 && /* @__PURE__ */ a("button", {
473
- onClick: ae,
486
+ children: [k > 0 && /* @__PURE__ */ a("button", {
487
+ onClick: se,
474
488
  className: "text-xs text-action-primary-bg hover:underline font-medium",
475
489
  children: "Mark all read"
476
- }), !E && /* @__PURE__ */ a("button", {
477
- onClick: () => T(!1),
490
+ }), !T && /* @__PURE__ */ a("button", {
491
+ onClick: () => w(!1),
478
492
  className: "p-1 rounded-button hover:bg-action-ghost-bg-hover text-text-tertiary",
479
493
  "aria-label": "Close panel",
480
494
  children: /* @__PURE__ */ a("svg", {
@@ -498,23 +512,23 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
498
512
  /* @__PURE__ */ a("div", {
499
513
  className: "flex gap-1",
500
514
  children: _.map((e) => /* @__PURE__ */ a("button", {
501
- onClick: () => V(e.value),
502
- className: `px-3 py-1 text-xs font-medium rounded-full transition-colors ${B === e.value ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-muted text-text-secondary hover:bg-action-ghost-bg-hover"}`,
515
+ onClick: () => B(e.value),
516
+ className: `px-3 py-1 text-xs font-medium rounded-full transition-colors ${z === e.value ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-muted text-text-secondary hover:bg-action-ghost-bg-hover"}`,
503
517
  children: e.label
504
518
  }, e.value))
505
519
  }),
506
520
  /* @__PURE__ */ o("div", {
507
521
  className: "flex flex-wrap items-center gap-1",
508
522
  children: [v.map((e) => /* @__PURE__ */ o("button", {
509
- onClick: () => U(e.value),
510
- className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${H === e.value ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
523
+ onClick: () => H(e.value),
524
+ className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${V === e.value ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
511
525
  children: [e.value !== "ALL" && g[e.value] && /* @__PURE__ */ a("span", {
512
526
  className: "mr-0.5",
513
527
  children: g[e.value].icon
514
528
  }), e.label]
515
529
  }, e.value)), /* @__PURE__ */ o("select", {
516
- value: K,
517
- onChange: (e) => ne(e.target.value),
530
+ value: G,
531
+ onChange: (e) => re(e.target.value),
518
532
  className: "ml-auto text-[11px] text-text-secondary bg-transparent border-none cursor-pointer focus:outline-none",
519
533
  "aria-label": "Sort notifications",
520
534
  children: [
@@ -536,12 +550,12 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
536
550
  Q.length > 1 && /* @__PURE__ */ o("div", {
537
551
  className: "flex flex-wrap gap-1",
538
552
  children: [/* @__PURE__ */ a("button", {
539
- onClick: () => G("ALL"),
540
- className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${W === "ALL" ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
553
+ onClick: () => W("ALL"),
554
+ className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${U === "ALL" ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
541
555
  children: "All Apps"
542
556
  }), Q.map(([e, t]) => /* @__PURE__ */ o("button", {
543
- onClick: () => G(e),
544
- className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${W === e ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
557
+ onClick: () => W(e),
558
+ className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${U === e ? "bg-bg-elevated text-text-primary border border-border-default" : "text-text-tertiary hover:text-text-secondary hover:bg-bg-muted"}`,
545
559
  children: [e, /* @__PURE__ */ o("span", {
546
560
  className: "ml-1 text-text-tertiary",
547
561
  children: [
@@ -556,14 +570,14 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
556
570
  }),
557
571
  /* @__PURE__ */ a("div", {
558
572
  className: "flex-1 overflow-y-auto",
559
- children: I ? /* @__PURE__ */ o("div", {
573
+ children: F ? /* @__PURE__ */ o("div", {
560
574
  className: "p-3 space-y-2",
561
575
  children: [
562
- /* @__PURE__ */ a(x, {}),
563
- /* @__PURE__ */ a(x, {}),
564
- /* @__PURE__ */ a(x, {})
576
+ /* @__PURE__ */ a(b, {}),
577
+ /* @__PURE__ */ a(b, {}),
578
+ /* @__PURE__ */ a(b, {})
565
579
  ]
566
- }) : R ? /* @__PURE__ */ o("div", {
580
+ }) : L ? /* @__PURE__ */ o("div", {
567
581
  className: "flex flex-col items-center justify-center p-8 text-center",
568
582
  children: [
569
583
  /* @__PURE__ */ a("svg", {
@@ -609,16 +623,16 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
609
623
  }),
610
624
  /* @__PURE__ */ a("p", {
611
625
  className: "text-xs text-text-tertiary mt-1",
612
- children: B !== "all" || H !== "ALL" || W !== "ALL" ? "No notifications match your filters" : "No notifications yet"
626
+ children: z !== "all" || V !== "ALL" || U !== "ALL" ? "No notifications match your filters" : "No notifications yet"
613
627
  })
614
628
  ]
615
629
  }) : /* @__PURE__ */ a("div", {
616
630
  className: "p-2 space-y-1.5",
617
- children: Z.map((e) => /* @__PURE__ */ a(b, {
631
+ children: Z.map((e) => /* @__PURE__ */ a(te, {
618
632
  notification: e,
619
- onMarkAsRead: ie,
620
- onDelete: oe,
621
- onRedirect: se
633
+ onMarkAsRead: oe,
634
+ onDelete: ce,
635
+ onRedirect: le
622
636
  }, e.id))
623
637
  })
624
638
  }),
@@ -629,12 +643,12 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
629
643
  children: [/* @__PURE__ */ o("span", {
630
644
  className: "text-[11px] text-text-tertiary",
631
645
  children: [
632
- P,
646
+ N,
633
647
  " notification",
634
- P === 1 ? "" : "s"
648
+ N === 1 ? "" : "s"
635
649
  ]
636
650
  }), h && /* @__PURE__ */ a("button", {
637
- onClick: ce,
651
+ onClick: ue,
638
652
  className: "text-xs text-action-primary-bg hover:underline font-medium",
639
653
  children: "View All"
640
654
  })]
@@ -643,14 +657,14 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
643
657
  ]
644
658
  });
645
659
  return /* @__PURE__ */ o("div", {
646
- ref: C,
660
+ ref: S,
647
661
  className: "relative",
648
662
  children: [
649
663
  /* @__PURE__ */ o("button", {
650
- onClick: re,
664
+ onClick: ae,
651
665
  className: "relative p-2 hover:bg-action-ghost-bg-hover rounded-button text-text-primary",
652
- "aria-label": `Notifications${A > 0 ? ` (${A} unread)` : ""}`,
653
- "aria-expanded": w,
666
+ "aria-label": `Notifications${k > 0 ? ` (${k} unread)` : ""}`,
667
+ "aria-expanded": C,
654
668
  "aria-haspopup": "true",
655
669
  children: [/* @__PURE__ */ a("svg", {
656
670
  className: "w-icon-md h-icon-md",
@@ -663,20 +677,20 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
663
677
  strokeWidth: 2,
664
678
  d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
665
679
  })
666
- }), A > 0 && /* @__PURE__ */ a("span", {
680
+ }), k > 0 && /* @__PURE__ */ a("span", {
667
681
  className: "absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[18px] h-[18px] px-1 text-[10px] font-bold text-action-primary-text bg-action-primary-bg rounded-full border-2 border-bg-elevated",
668
- children: A > 9 ? "9+" : A
682
+ children: k > 9 ? "9+" : k
669
683
  })]
670
684
  }),
671
- w && !E && /* @__PURE__ */ a("div", {
685
+ C && !T && /* @__PURE__ */ a("div", {
672
686
  className: "absolute right-0 top-full mt-2 w-[calc(100vw-1.5rem)] sm:w-[420px] max-h-[600px] bg-bg-elevated border border-border-subtle rounded-card shadow-popover z-50 overflow-hidden flex flex-col",
673
687
  role: "dialog",
674
688
  "aria-label": "Notifications panel",
675
689
  children: $
676
690
  }),
677
- w && E && /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", {
691
+ C && T && /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", {
678
692
  className: "fixed inset-0 bg-black/50 z-[60]",
679
- onClick: () => T(!1),
693
+ onClick: () => w(!1),
680
694
  "aria-hidden": "true"
681
695
  }), /* @__PURE__ */ a("div", {
682
696
  className: "fixed inset-x-0 bottom-0 top-0 bg-bg-elevated z-[70] flex flex-col",
@@ -688,4 +702,4 @@ var b = ({ notification: e, onMarkAsRead: t, onDelete: n, onRedirect: r }) => {
688
702
  });
689
703
  };
690
704
  //#endregion
691
- export { te as NotificationCenter };
705
+ export { ne as NotificationCenter };
@@ -23,6 +23,13 @@ export interface UseLanguagesReturn {
23
23
  defaultLanguageCode: string;
24
24
  }
25
25
  export interface UseLanguagesOptions {
26
+ /**
27
+ * When true, fetch on mount. Default: false — the hook is lazy so the
28
+ * global-header batch on first paint doesn't pay for a query whose
29
+ * results are only needed when the user actually opens the language
30
+ * picker dropdown. Consumers should call `refetch()` from the
31
+ * dropdown's `onMouseDown` / `onFocus` handler instead.
32
+ */
26
33
  autoFetch?: boolean;
27
34
  }
28
35
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useLanguages.d.ts","sourceRoot":"","sources":["../../../../src/shared/hooks/shell/useLanguages.ts"],"names":[],"mappings":"AAqCA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAsID;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iCAAiC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4BAA4B;IAC5B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,kBAAkB,CAkF9E"}
1
+ {"version":3,"file":"useLanguages.d.ts","sourceRoot":"","sources":["../../../../src/shared/hooks/shell/useLanguages.ts"],"names":[],"mappings":"AAqCA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAsID;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,iCAAiC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4BAA4B;IAC5B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,kBAAkB,CA0G9E"}
@@ -1,9 +1,9 @@
1
1
  import { useGatewayClient as e } from "../../graphql/GatewayContext.js";
2
2
  import "../../../shared-graphql.js";
3
- import { useCallback as t, useEffect as n, useState as r } from "react";
4
- import { gql as i } from "@apollo/client/core";
3
+ import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
4
+ import { gql as a } from "@apollo/client/core";
5
5
  //#region src/shared/hooks/shell/useLanguages.ts
6
- var a = i`
6
+ var o = a`
7
7
  query GetLanguagesForHeader($filter: LanguageFilterInput, $limit: Int, $offset: Int) {
8
8
  languages(filter: $filter, limit: $limit, offset: $offset) {
9
9
  items {
@@ -18,7 +18,7 @@ var a = i`
18
18
  total
19
19
  }
20
20
  }
21
- `, o = {
21
+ `, s = {
22
22
  en: "🇺🇸",
23
23
  es: "🇪🇸",
24
24
  fr: "🇫🇷",
@@ -59,7 +59,7 @@ var a = i`
59
59
  fa: "🇮🇷",
60
60
  sw: "🇰🇪",
61
61
  af: "🇿🇦"
62
- }, s = {
62
+ }, c = {
63
63
  US: "🇺🇸",
64
64
  GB: "🇬🇧",
65
65
  AU: "🇦🇺",
@@ -102,21 +102,21 @@ var a = i`
102
102
  VN: "🇻🇳",
103
103
  PH: "🇵🇭"
104
104
  };
105
- function c(e, t) {
106
- return t && s[t.toUpperCase()] ? s[t.toUpperCase()] : o[e.toLowerCase()] ? o[e.toLowerCase()] : "🌐";
105
+ function l(e, t) {
106
+ return t && c[t.toUpperCase()] ? c[t.toUpperCase()] : s[e.toLowerCase()] ? s[e.toLowerCase()] : "🌐";
107
107
  }
108
- var l = {
108
+ var u = {
109
109
  code: "en",
110
110
  name: "English",
111
111
  nativeName: "English",
112
112
  flag: "🇺🇸"
113
113
  };
114
- function u(i) {
115
- let o = e("global"), [s, u] = r([l]), [d, f] = r(i?.autoFetch !== !1), [p, m] = r(null), [h, g] = r("en"), _ = t(async () => {
116
- f(!0), m(null);
114
+ function d(a) {
115
+ let s = e("global"), [c, d] = i([u]), [f, p] = i(a?.autoFetch === !0), [m, h] = i(null), [g, _] = i("en"), v = r(!1), y = t(async () => {
116
+ p(!0), h(null);
117
117
  try {
118
- let e = (await o.query({
119
- query: a,
118
+ let e = (await s.query({
119
+ query: o,
120
120
  variables: {
121
121
  filter: { status: "ACTIVE" },
122
122
  limit: 50,
@@ -124,38 +124,41 @@ function u(i) {
124
124
  },
125
125
  fetchPolicy: "cache-first"
126
126
  })).data?.languages?.items || [];
127
- if (e.length === 0) u([l]), g("en");
127
+ if (e.length === 0) d([u]), _("en");
128
128
  else {
129
129
  let t = e.map((e) => ({
130
130
  code: e.code,
131
131
  name: e.name,
132
132
  nativeName: e.nativeName,
133
- flag: c(e.code, e.region)
133
+ flag: l(e.code, e.region)
134
134
  }));
135
135
  t.sort((t, n) => {
136
136
  let r = e.find((e) => e.code === t.code)?.isDefault, i = e.find((e) => e.code === n.code)?.isDefault;
137
137
  return r && !i ? -1 : !r && i ? 1 : t.name.localeCompare(n.name);
138
- }), u(t), g(e.find((e) => e.isDefault)?.code || t[0]?.code || "en");
138
+ }), d(t), _(e.find((e) => e.isDefault)?.code || t[0]?.code || "en");
139
139
  }
140
+ v.current = !0;
140
141
  } catch (e) {
141
- console.error("[useLanguages] Failed to fetch languages:", e), m(e instanceof Error ? e.message : "Failed to fetch languages"), s.length === 0 && u([l]);
142
+ console.error("[useLanguages] Failed to fetch languages:", e), h(e instanceof Error ? e.message : "Failed to fetch languages"), c.length === 0 && d([u]);
142
143
  } finally {
143
- f(!1);
144
+ p(!1);
144
145
  }
145
- }, [o, s.length]);
146
+ }, [s, c.length]);
146
147
  return n(() => {
147
- if (i?.autoFetch === !1) {
148
- f(!1);
148
+ if (a?.autoFetch !== !0) {
149
+ p(!1);
149
150
  return;
150
151
  }
151
- _();
152
+ y();
152
153
  }, []), {
153
- languages: s,
154
- isLoading: d,
155
- error: p,
156
- refetch: _,
157
- defaultLanguageCode: h
154
+ languages: c,
155
+ isLoading: f,
156
+ error: m,
157
+ refetch: t(() => {
158
+ v.current || y();
159
+ }, [y]),
160
+ defaultLanguageCode: g
158
161
  };
159
162
  }
160
163
  //#endregion
161
- export { u as useLanguages };
164
+ export { d as useLanguages };
@@ -1 +1 @@
1
- {"version":3,"file":"ToursContext.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/ToursContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAQf,OAAO,EAAoB,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAqTtD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,IAAI,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,EAC3C,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,UAAU,EAAE,CACV,SAAS,EACL,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,cAAc,GACd,aAAa,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,KACE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC7D,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAsB,EACtB,iBAAiB,EACjB,QAAgB,GACjB,EAAE,kBAAkB,2CAgfpB;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAMnD;AAED,wBAAgB,mBAAmB,IAAI,iBAAiB,CAmBvD;AAED,wBAAgB,QAAQ;;;;mBA/jBP,IAAI;4BAET,MAAM,UACN,SAAS,GAAG,WAAW,GAAG,SAAS,WAClC,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC;EAmkBnB;AAED,wBAAgB,gBAAgB,IAAI,IAAI,GAAG,IAAI,CAG9C"}
1
+ {"version":3,"file":"ToursContext.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/ToursContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAQf,OAAO,EAAoB,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAqTtD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,IAAI,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,EAC3C,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,UAAU,EAAE,CACV,SAAS,EACL,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,cAAc,GACd,aAAa,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,KACE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC7D,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAsB,EACtB,iBAAiB,EACjB,QAAgB,GACjB,EAAE,kBAAkB,2CA8gBpB;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAMnD;AAED,wBAAgB,mBAAmB,IAAI,iBAAiB,CAmBvD;AAED,wBAAgB,QAAQ;;;;mBA7lBP,IAAI;4BAET,MAAM,UACN,SAAS,GAAG,WAAW,GAAG,SAAS,WAClC,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC;EAimBnB;AAED,wBAAgB,gBAAgB,IAAI,IAAI,GAAG,IAAI,CAG9C"}
@@ -195,7 +195,7 @@ function ce() {
195
195
  return `tour-session-${Date.now()}-${Math.random().toString(36).slice(2)}`;
196
196
  }
197
197
  }
198
- function w(e, t, n, r) {
198
+ function le(e, t, n, r) {
199
199
  let i = e.split("/").filter(Boolean), a = r ? r(e) : S(e, n);
200
200
  return i.length === 0 ? {
201
201
  moduleId: t,
@@ -208,45 +208,58 @@ function w(e, t, n, r) {
208
208
  pageId: a
209
209
  };
210
210
  }
211
- var T = c(null);
212
- function E({ children: a, defaultPageId: c = "home", getPageIdFromPath: u, disabled: h = !1 }) {
213
- let g = te(), _ = e("global"), { workspaceId: x } = n(), { user: S } = t(), { productSlug: E } = r(), D = i("ToursContext"), O = x ?? void 0, k = h || g.pathname.startsWith("/devportal"), { moduleId: A, pageId: j } = f(() => w(g.pathname, E, c, u), [
211
+ var w = c(null);
212
+ function T({ children: a, defaultPageId: c = "home", getPageIdFromPath: u, disabled: h = !1 }) {
213
+ let g = te(), _ = e("global"), { workspaceId: x } = n(), { user: S } = t(), { productSlug: T } = r(), E = i("ToursContext"), D = x ?? void 0, O = h || g.pathname.startsWith("/devportal"), { moduleId: k, pageId: A } = f(() => le(g.pathname, T, c, u), [
214
214
  c,
215
215
  u,
216
216
  g.pathname,
217
- E
218
- ]), [M, N] = m([]), [P, F] = m(!1), [I, L] = m(null), R = p([]), z = p(0), B = p(/* @__PURE__ */ new Map()), V = p(void 0), H = p(!1), U = p(!0), W = p(0), G = p(!0);
217
+ T
218
+ ]), [j, M] = m([]), [N, P] = m(!1), [F, I] = m(null), [L, ue] = m(!1);
219
+ d(() => {
220
+ let e = () => ue(!0);
221
+ if (typeof window < "u" && "requestIdleCallback" in window) {
222
+ let t = window.requestIdleCallback(e, { timeout: 2e3 });
223
+ return () => {
224
+ window.cancelIdleCallback?.(t);
225
+ };
226
+ }
227
+ let t = setTimeout(e, 500);
228
+ return () => clearTimeout(t);
229
+ }, []);
230
+ let R = p([]), z = p(0), B = p(/* @__PURE__ */ new Map()), V = p(void 0), H = p(!1), U = p(!0), W = p(0), G = p(!0);
219
231
  d(() => (U.current = !0, () => {
220
232
  U.current = !1;
221
233
  }), []);
222
234
  let K = l(async (e = !1) => {
223
- if (k) {
224
- U.current && (N([]), F(!1), L(null));
235
+ if (!L && !e) return;
236
+ if (O) {
237
+ U.current && (M([]), P(!1), I(null));
225
238
  return;
226
239
  }
227
240
  if (!_) return;
228
- let t = D.child("fetch", {
229
- productSlug: E,
230
- workspaceId: O,
231
- moduleId: A,
232
- pageId: j
241
+ let t = E.child("fetch", {
242
+ productSlug: T,
243
+ workspaceId: D,
244
+ moduleId: k,
245
+ pageId: A
233
246
  }), n = C(), r = [
234
- E,
247
+ T,
248
+ k ?? "",
235
249
  A ?? "",
236
- j ?? "",
237
- O,
250
+ D,
238
251
  n,
239
252
  S?.id ?? "anonymous"
240
253
  ].join("::");
241
254
  if (!e && H.current && V.current === r) return;
242
- U.current && (F(!0), L(null));
255
+ U.current && (P(!0), I(null));
243
256
  let i = ++W.current;
244
257
  try {
245
258
  let e = { context: {
246
- productId: E,
247
- moduleId: A,
248
- pageId: j,
249
- workspaceId: O,
259
+ productId: T,
260
+ moduleId: k,
261
+ pageId: A,
262
+ workspaceId: D,
250
263
  deviceType: n
251
264
  } }, a = "network-only", o, s = G.current ? v : y;
252
265
  try {
@@ -273,46 +286,47 @@ function E({ children: a, defaultPageId: c = "home", getPageIdFromPath: u, disab
273
286
  else throw n;
274
287
  }
275
288
  let c = (o.data?.toursForContext ?? []).filter((e, t, n) => n.findIndex((t) => t.id === e.id) === t);
276
- U.current && i === W.current && (N(c), V.current = r, H.current = !0);
289
+ U.current && i === W.current && (M(c), V.current = r, H.current = !0);
277
290
  } catch (e) {
278
291
  if (!U.current || i !== W.current || se(e)) return;
279
292
  let n = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch tours");
280
- t.error("Failed to fetch tours for context", n), L(n), N([]);
293
+ t.error("Failed to fetch tours for context", n), I(n), M([]);
281
294
  } finally {
282
- U.current && i === W.current && F(!1);
295
+ U.current && i === W.current && P(!1);
283
296
  }
284
297
  }, [
285
- k,
298
+ L,
299
+ O,
286
300
  _,
287
- D,
288
- A,
289
- j,
290
301
  E,
291
- O,
302
+ k,
303
+ A,
304
+ T,
305
+ D,
292
306
  S?.id
293
307
  ]), q = p(S?.id);
294
308
  d(() => {
295
- q.current !== S?.id && (q.current = S?.id, H.current = !1, V.current = void 0, U.current && N([]));
309
+ q.current !== S?.id && (q.current = S?.id, H.current = !1, V.current = void 0, U.current && M([]));
296
310
  }, [S?.id]), d(() => {
297
311
  K();
298
312
  }, [K]), d(() => {
299
- R.current = M;
300
- }, [M]);
313
+ R.current = j;
314
+ }, [j]);
301
315
  let J = l(() => {
302
316
  K(!0);
303
- }, [K]), Y = f(() => M.filter((e) => e.isActive && e.steps?.length > 0 && o(e, {
304
- productId: E,
305
- moduleId: A,
306
- pageId: j
317
+ }, [K]), Y = f(() => j.filter((e) => e.isActive && e.steps?.length > 0 && o(e, {
318
+ productId: T,
319
+ moduleId: k,
320
+ pageId: A
307
321
  })).sort((e, t) => (t.priority ?? 0) - (e.priority ?? 0)), [
308
- M,
309
- A,
310
322
  j,
311
- E
312
- ]), X = f(() => Y.find((e) => e.triggerType === "AUTO_FIRST_VISIT" || e.triggerType === "AUTO_ALWAYS") ?? null, [Y]), Z = l(async (e, t, n) => {
323
+ k,
324
+ A,
325
+ T
326
+ ]), X = f(() => L ? Y.find((e) => e.triggerType === "AUTO_FIRST_VISIT" || e.triggerType === "AUTO_ALWAYS") ?? null : null, [Y, L]), Z = l(async (e, t, n) => {
313
327
  if (!_ || !S?.id) return;
314
328
  let r = t === "started" ? "IN_PROGRESS" : t === "completed" ? "COMPLETED" : "SKIPPED", i = R.current.find((t) => t.id === e)?.myProgress, a = z.current + 1;
315
- z.current = a, B.current.set(e, a), N((t) => {
329
+ z.current = a, B.current.set(e, a), M((t) => {
316
330
  let n = s(t, e, r);
317
331
  return R.current = n, n;
318
332
  });
@@ -347,7 +361,7 @@ function E({ children: a, defaultPageId: c = "home", getPageIdFromPath: u, disab
347
361
  });
348
362
  } catch {
349
363
  if (B.current.get(e) !== a) return;
350
- N((t) => {
364
+ M((t) => {
351
365
  let n = t.map((t) => t.id === e ? {
352
366
  ...t,
353
367
  myProgress: i
@@ -379,72 +393,72 @@ function E({ children: a, defaultPageId: c = "home", getPageIdFromPath: u, disab
379
393
  eventType: e,
380
394
  stepId: n?.stepId,
381
395
  stepOrder: n?.stepOrder,
382
- productId: E,
383
- moduleId: A,
384
- pageId: j,
396
+ productId: T,
397
+ moduleId: k,
398
+ pageId: A,
385
399
  deviceType: C(),
386
400
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
387
401
  duration: n?.duration,
388
402
  metadata: n?.metadata,
389
- context: O ? {
390
- workspaceId: O,
391
- productId: E,
392
- moduleId: A,
393
- pageId: j
403
+ context: D ? {
404
+ workspaceId: D,
405
+ productId: T,
406
+ moduleId: k,
407
+ pageId: A
394
408
  } : {
395
- productId: E,
396
- moduleId: A,
397
- pageId: j
409
+ productId: T,
410
+ moduleId: k,
411
+ pageId: A
398
412
  }
399
413
  } }
400
414
  });
401
415
  } catch {}
402
416
  }, [
403
417
  _,
418
+ k,
404
419
  A,
405
- j,
406
- E,
420
+ T,
407
421
  S?.id,
408
- O
409
- ]), le = f(() => ({
410
- tours: M,
422
+ D
423
+ ]), de = f(() => ({
424
+ tours: j,
411
425
  pageTours: Y,
412
- loading: P,
413
- error: I,
426
+ loading: N,
427
+ error: F,
414
428
  refetch: J,
415
429
  trackProgress: Z,
416
430
  recordStepCompletion: Q,
417
431
  trackEvent: $,
418
432
  autoStartTour: X,
419
- productId: E,
420
- moduleId: A,
421
- pageId: j
433
+ productId: T,
434
+ moduleId: k,
435
+ pageId: A
422
436
  }), [
423
- M,
437
+ j,
424
438
  X,
425
- I,
426
- P,
439
+ F,
440
+ N,
441
+ k,
427
442
  A,
428
- j,
429
443
  Y,
430
- E,
444
+ T,
431
445
  Q,
432
446
  J,
433
447
  $,
434
448
  Z
435
449
  ]);
436
- return /* @__PURE__ */ ee(T.Provider, {
437
- value: le,
450
+ return /* @__PURE__ */ ee(w.Provider, {
451
+ value: de,
438
452
  children: a
439
453
  });
440
454
  }
441
- function D() {
442
- let e = u(T);
455
+ function E() {
456
+ let e = u(w);
443
457
  if (!e) throw Error("useToursContext must be used within a ToursProvider");
444
458
  return e;
445
459
  }
446
- function O() {
447
- return u(T) || {
460
+ function D() {
461
+ return u(w) || {
448
462
  tours: [],
449
463
  pageTours: [],
450
464
  loading: !1,
@@ -459,8 +473,8 @@ function O() {
459
473
  pageId: void 0
460
474
  };
461
475
  }
462
- function k() {
463
- let e = D();
476
+ function O() {
477
+ let e = E();
464
478
  return {
465
479
  tours: e.pageTours,
466
480
  loading: e.loading,
@@ -469,8 +483,8 @@ function k() {
469
483
  trackProgress: e.trackProgress
470
484
  };
471
485
  }
472
- function A() {
473
- return D().autoStartTour;
486
+ function k() {
487
+ return E().autoStartTour;
474
488
  }
475
489
  //#endregion
476
- export { E as ToursProvider, A as useAutoStartTour, O as useSafeToursContext, k as useTours, D as useToursContext };
490
+ export { T as ToursProvider, k as useAutoStartTour, D as useSafeToursContext, O as useTours, E as useToursContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.522.1",
3
+ "version": "2026.522.3",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "type": "module",
6
6
  "imports": {
@@ -368,7 +368,7 @@
368
368
  }
369
369
  },
370
370
  "engines": {
371
- "bun": ">=1.3.10"
371
+ "bun": ">=1.3.14"
372
372
  },
373
373
  "publishConfig": {
374
374
  "access": "restricted"