@burdenoff/fe-libs 2026.522.2 → 2026.522.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chrome/NotificationCenter.d.ts.map +1 -1
- package/dist/chrome/NotificationCenter.js +114 -100
- package/dist/chrome/ProductSwitcher.d.ts +2 -0
- package/dist/chrome/ProductSwitcher.d.ts.map +1 -1
- package/dist/chrome/ProductSwitcher.js +9 -3
- package/dist/shared/config/products.d.ts +14 -0
- package/dist/shared/config/products.d.ts.map +1 -1
- package/dist/shared/config/products.js +20 -17
- package/dist/shared/hooks/shell/useLanguages.d.ts +7 -0
- package/dist/shared/hooks/shell/useLanguages.d.ts.map +1 -1
- package/dist/shared/hooks/shell/useLanguages.js +31 -28
- package/dist/shared/tours/ToursContext.d.ts.map +1 -1
- package/dist/shared/tours/ToursContext.js +93 -79
- package/package.json +1 -1
|
@@ -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,
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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
|
-
},
|
|
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
|
-
}),
|
|
282
|
-
let
|
|
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
|
-
|
|
286
|
-
let t = (e) =>
|
|
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 (!
|
|
289
|
+
if (!C || T) return;
|
|
290
290
|
let e = (e) => {
|
|
291
|
-
|
|
291
|
+
S.current && !S.current.contains(e.target) && w(!1);
|
|
292
292
|
};
|
|
293
293
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
294
|
-
}, [
|
|
295
|
-
if (!
|
|
294
|
+
}, [C, T]), t(() => {
|
|
295
|
+
if (!C) return;
|
|
296
296
|
let e = (e) => {
|
|
297
|
-
e.key === "Escape" &&
|
|
297
|
+
e.key === "Escape" && w(!1);
|
|
298
298
|
};
|
|
299
299
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
300
|
-
}, [
|
|
301
|
-
let
|
|
300
|
+
}, [C]);
|
|
301
|
+
let K = n(s);
|
|
302
302
|
t(() => {
|
|
303
|
-
|
|
303
|
+
K.current = s;
|
|
304
304
|
}, [s]);
|
|
305
|
-
let
|
|
305
|
+
let q = e(async () => {
|
|
306
306
|
try {
|
|
307
|
-
let e = (await
|
|
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
|
-
|
|
315
|
+
A(e?.myUnreadNotificationCount ?? 0);
|
|
316
316
|
} catch {}
|
|
317
|
-
}, []);
|
|
317
|
+
}, []), [J, ie] = r(!1);
|
|
318
318
|
t(() => {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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" &&
|
|
341
|
+
typeof t?.myUnreadNotificationCountStream == "number" && A(t.myUnreadNotificationCountStream);
|
|
332
342
|
},
|
|
333
343
|
error: () => {}
|
|
334
|
-
}), t = setInterval(
|
|
344
|
+
}), t = setInterval(q, 300 * 1e3);
|
|
335
345
|
return () => {
|
|
336
346
|
e.unsubscribe(), clearInterval(t);
|
|
337
347
|
};
|
|
338
|
-
}, [
|
|
348
|
+
}, [
|
|
349
|
+
q,
|
|
350
|
+
x,
|
|
351
|
+
J
|
|
352
|
+
]);
|
|
339
353
|
let Y = e(async () => {
|
|
340
|
-
|
|
354
|
+
I(!0), R(null);
|
|
341
355
|
try {
|
|
342
356
|
let e = {
|
|
343
357
|
channel: "IN_APP",
|
|
344
358
|
archived: !1
|
|
345
359
|
};
|
|
346
|
-
|
|
347
|
-
let t = (await
|
|
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 && (
|
|
370
|
+
t && (O(t.items ?? []), P(t.total ?? 0));
|
|
357
371
|
} catch (e) {
|
|
358
|
-
|
|
372
|
+
R(e instanceof Error ? e.message : "Failed to load notifications");
|
|
359
373
|
} finally {
|
|
360
|
-
|
|
374
|
+
I(!1);
|
|
361
375
|
}
|
|
362
376
|
}, [
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
377
|
+
z,
|
|
378
|
+
V,
|
|
379
|
+
U
|
|
366
380
|
]), X = e(async () => {
|
|
367
381
|
try {
|
|
368
|
-
let e = (await
|
|
382
|
+
let e = (await K.current.query({
|
|
369
383
|
query: d,
|
|
370
384
|
fetchPolicy: "network-only"
|
|
371
385
|
})).data;
|
|
372
|
-
|
|
386
|
+
M(e?.myNotificationCountsByApp ?? {});
|
|
373
387
|
} catch {}
|
|
374
388
|
}, []);
|
|
375
389
|
t(() => {
|
|
376
|
-
|
|
390
|
+
C && (x && q(), Y(), X(), q());
|
|
377
391
|
}, [
|
|
378
|
-
|
|
392
|
+
C,
|
|
379
393
|
Y,
|
|
380
394
|
X,
|
|
381
|
-
|
|
382
|
-
|
|
395
|
+
q,
|
|
396
|
+
x
|
|
383
397
|
]);
|
|
384
|
-
let
|
|
385
|
-
|
|
386
|
-
}, []),
|
|
398
|
+
let ae = e(() => {
|
|
399
|
+
w((e) => !e);
|
|
400
|
+
}, []), oe = e(async (e) => {
|
|
387
401
|
try {
|
|
388
|
-
await
|
|
402
|
+
await K.current.mutate({
|
|
389
403
|
mutation: f,
|
|
390
404
|
variables: { id: e }
|
|
391
|
-
}),
|
|
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)),
|
|
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
|
-
}, []),
|
|
413
|
+
}, []), se = e(async () => {
|
|
400
414
|
try {
|
|
401
|
-
await
|
|
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
|
-
}))),
|
|
419
|
+
}))), A(0);
|
|
406
420
|
} catch (e) {
|
|
407
421
|
console.error("Failed to mark all notifications as read:", e);
|
|
408
422
|
}
|
|
409
|
-
}, []),
|
|
423
|
+
}, []), ce = e(async (e) => {
|
|
410
424
|
try {
|
|
411
|
-
await
|
|
425
|
+
await K.current.mutate({
|
|
412
426
|
mutation: m,
|
|
413
427
|
variables: { id: e }
|
|
414
428
|
});
|
|
415
|
-
let t =
|
|
416
|
-
|
|
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
|
-
}, [
|
|
434
|
+
}, [D]), le = e((e) => {
|
|
421
435
|
window.open(e, "_blank", "noopener,noreferrer");
|
|
422
|
-
}, []),
|
|
423
|
-
|
|
424
|
-
}, [h]), Z =
|
|
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
|
-
|
|
433
|
-
onClick: () =>
|
|
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
|
-
|
|
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:
|
|
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: [
|
|
473
|
-
onClick:
|
|
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
|
-
}), !
|
|
477
|
-
onClick: () =>
|
|
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: () =>
|
|
502
|
-
className: `px-3 py-1 text-xs font-medium rounded-full transition-colors ${
|
|
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: () =>
|
|
510
|
-
className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${
|
|
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:
|
|
517
|
-
onChange: (e) =>
|
|
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: () =>
|
|
540
|
-
className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${
|
|
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: () =>
|
|
544
|
-
className: `px-2 py-0.5 text-[11px] font-medium rounded-full whitespace-nowrap transition-colors ${
|
|
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:
|
|
573
|
+
children: F ? /* @__PURE__ */ o("div", {
|
|
560
574
|
className: "p-3 space-y-2",
|
|
561
575
|
children: [
|
|
562
|
-
/* @__PURE__ */ a(
|
|
563
|
-
/* @__PURE__ */ a(
|
|
564
|
-
/* @__PURE__ */ a(
|
|
576
|
+
/* @__PURE__ */ a(b, {}),
|
|
577
|
+
/* @__PURE__ */ a(b, {}),
|
|
578
|
+
/* @__PURE__ */ a(b, {})
|
|
565
579
|
]
|
|
566
|
-
}) :
|
|
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:
|
|
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(
|
|
631
|
+
children: Z.map((e) => /* @__PURE__ */ a(te, {
|
|
618
632
|
notification: e,
|
|
619
|
-
onMarkAsRead:
|
|
620
|
-
onDelete:
|
|
621
|
-
onRedirect:
|
|
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
|
-
|
|
646
|
+
N,
|
|
633
647
|
" notification",
|
|
634
|
-
|
|
648
|
+
N === 1 ? "" : "s"
|
|
635
649
|
]
|
|
636
650
|
}), h && /* @__PURE__ */ a("button", {
|
|
637
|
-
onClick:
|
|
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:
|
|
660
|
+
ref: S,
|
|
647
661
|
className: "relative",
|
|
648
662
|
children: [
|
|
649
663
|
/* @__PURE__ */ o("button", {
|
|
650
|
-
onClick:
|
|
664
|
+
onClick: ae,
|
|
651
665
|
className: "relative p-2 hover:bg-action-ghost-bg-hover rounded-button text-text-primary",
|
|
652
|
-
"aria-label": `Notifications${
|
|
653
|
-
"aria-expanded":
|
|
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
|
-
}),
|
|
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:
|
|
682
|
+
children: k > 9 ? "9+" : k
|
|
669
683
|
})]
|
|
670
684
|
}),
|
|
671
|
-
|
|
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
|
-
|
|
691
|
+
C && T && /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("div", {
|
|
678
692
|
className: "fixed inset-0 bg-black/50 z-[60]",
|
|
679
|
-
onClick: () =>
|
|
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 {
|
|
705
|
+
export { ne as NotificationCenter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductSwitcher.d.ts","sourceRoot":"","sources":["../../src/chrome/ProductSwitcher.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ProductSwitcher.d.ts","sourceRoot":"","sources":["../../src/chrome/ProductSwitcher.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAwIpD,CAAC"}
|
|
@@ -10,7 +10,7 @@ var a = ({ products: a, currentProductId: o, onProductChange: s, compact: c = !1
|
|
|
10
10
|
if (l) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
11
11
|
}, [l]);
|
|
12
12
|
let p = (e) => {
|
|
13
|
-
s ? s(e) : window.location.href = e.url, u(!1);
|
|
13
|
+
e.comingSoon || (s ? s(e) : window.location.href = e.url, u(!1));
|
|
14
14
|
};
|
|
15
15
|
return /* @__PURE__ */ i("div", {
|
|
16
16
|
className: "relative",
|
|
@@ -55,7 +55,10 @@ var a = ({ products: a, currentProductId: o, onProductChange: s, compact: c = !1
|
|
|
55
55
|
className: "py-1 max-h-96 overflow-y-auto",
|
|
56
56
|
children: a.map((e) => /* @__PURE__ */ i("button", {
|
|
57
57
|
onClick: () => p(e),
|
|
58
|
-
|
|
58
|
+
disabled: e.comingSoon,
|
|
59
|
+
"aria-disabled": e.comingSoon,
|
|
60
|
+
title: e.comingSoon ? "Coming soon" : void 0,
|
|
61
|
+
className: `w-full flex items-center gap-3 px-4 py-2.5 text-body-sm transition-colors ${e.comingSoon ? "text-text-tertiary cursor-not-allowed opacity-60" : e.id === o ? "bg-action-ghost-bg-hover text-text-primary font-medium" : "text-text-primary hover:bg-action-ghost-bg-hover"}`,
|
|
59
62
|
children: [
|
|
60
63
|
/* @__PURE__ */ r("div", {
|
|
61
64
|
className: "w-8 h-8 rounded flex items-center justify-center flex-shrink-0 text-white font-semibold text-sm",
|
|
@@ -66,7 +69,10 @@ var a = ({ products: a, currentProductId: o, onProductChange: s, compact: c = !1
|
|
|
66
69
|
className: "flex-1 text-left",
|
|
67
70
|
children: e.name
|
|
68
71
|
}),
|
|
69
|
-
e.
|
|
72
|
+
e.comingSoon ? /* @__PURE__ */ r("span", {
|
|
73
|
+
className: "text-body-xs px-2 py-0.5 rounded-full bg-bg-sunken text-text-secondary border border-border-subtle",
|
|
74
|
+
children: "Coming soon"
|
|
75
|
+
}) : e.id === o && /* @__PURE__ */ r("svg", {
|
|
70
76
|
className: "w-5 h-5 text-action-primary-text",
|
|
71
77
|
fill: "currentColor",
|
|
72
78
|
viewBox: "0 0 20 20",
|
|
@@ -9,6 +9,13 @@ export interface ProductConfig {
|
|
|
9
9
|
icon: string;
|
|
10
10
|
color: string;
|
|
11
11
|
description?: string;
|
|
12
|
+
/**
|
|
13
|
+
* When true, the product appears in the switcher but is gated:
|
|
14
|
+
* non-clickable, with a "Coming soon" badge. Use this for products
|
|
15
|
+
* that exist in the catalog but aren't yet GA so users see the lineup
|
|
16
|
+
* without being able to navigate into a broken shell.
|
|
17
|
+
*/
|
|
18
|
+
comingSoon?: boolean;
|
|
12
19
|
}
|
|
13
20
|
export declare const PRODUCT_URLS: {
|
|
14
21
|
readonly development: {
|
|
@@ -38,5 +45,12 @@ export declare function getProductsWithUrls(): {
|
|
|
38
45
|
icon: string;
|
|
39
46
|
color: string;
|
|
40
47
|
description?: string;
|
|
48
|
+
/**
|
|
49
|
+
* When true, the product appears in the switcher but is gated:
|
|
50
|
+
* non-clickable, with a "Coming soon" badge. Use this for products
|
|
51
|
+
* that exist in the catalog but aren't yet GA so users see the lineup
|
|
52
|
+
* without being able to navigate into a broken shell.
|
|
53
|
+
*/
|
|
54
|
+
comingSoon?: boolean;
|
|
41
55
|
}[];
|
|
42
56
|
//# sourceMappingURL=products.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/shared/config/products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;CAef,CAAC;AAEX,eAAO,MAAM,QAAQ,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/shared/config/products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;CAef,CAAC;AAEX,eAAO,MAAM,QAAQ,EAAE,aAAa,EA0CnC,CAAC;AAOF,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB;;QAzF7B,MAAM;UACJ,MAAM;UACN,MAAM;WACL,MAAM;kBACC,MAAM;IACpB;;;;;OAKG;iBACU,OAAO;IAgFrB"}
|
|
@@ -15,40 +15,43 @@ var e = {
|
|
|
15
15
|
botlit: "https://app.botlit.ai/"
|
|
16
16
|
}
|
|
17
17
|
}, t = [
|
|
18
|
+
{
|
|
19
|
+
id: "vibecontrols",
|
|
20
|
+
name: "VibeControls",
|
|
21
|
+
icon: "VC",
|
|
22
|
+
color: "#10b981",
|
|
23
|
+
description: "Real-time collaboration controls"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "workspaces",
|
|
27
|
+
name: "Workspaces",
|
|
28
|
+
icon: "WS",
|
|
29
|
+
color: "#06b6d4",
|
|
30
|
+
description: "Enterprise collaboration platform"
|
|
31
|
+
},
|
|
18
32
|
{
|
|
19
33
|
id: "fluidgrids",
|
|
20
34
|
name: "FluidGrids",
|
|
21
35
|
icon: "FG",
|
|
22
36
|
color: "#3b82f6",
|
|
23
|
-
description: "Visual workflow automation platform"
|
|
37
|
+
description: "Visual workflow automation platform",
|
|
38
|
+
comingSoon: !0
|
|
24
39
|
},
|
|
25
40
|
{
|
|
26
41
|
id: "bigconsole",
|
|
27
42
|
name: "BigConsole",
|
|
28
43
|
icon: "BC",
|
|
29
44
|
color: "#8b5cf6",
|
|
30
|
-
description: "AI development console"
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
id: "workspaces",
|
|
34
|
-
name: "Workspaces",
|
|
35
|
-
icon: "WS",
|
|
36
|
-
color: "#06b6d4",
|
|
37
|
-
description: "Enterprise collaboration platform"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: "vibecontrols",
|
|
41
|
-
name: "VibeControls",
|
|
42
|
-
icon: "VC",
|
|
43
|
-
color: "#10b981",
|
|
44
|
-
description: "Real-time collaboration controls"
|
|
45
|
+
description: "AI development console",
|
|
46
|
+
comingSoon: !0
|
|
45
47
|
},
|
|
46
48
|
{
|
|
47
49
|
id: "botlit",
|
|
48
50
|
name: "Botlit",
|
|
49
51
|
icon: "BL",
|
|
50
52
|
color: "#f59e0b",
|
|
51
|
-
description: "AI agent platform"
|
|
53
|
+
description: "AI agent platform",
|
|
54
|
+
comingSoon: !0
|
|
52
55
|
}
|
|
53
56
|
];
|
|
54
57
|
function n() {
|
|
@@ -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,
|
|
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,
|
|
4
|
-
import { gql as
|
|
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
|
|
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
|
-
`,
|
|
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
|
-
},
|
|
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
|
|
106
|
-
return t &&
|
|
105
|
+
function l(e, t) {
|
|
106
|
+
return t && c[t.toUpperCase()] ? c[t.toUpperCase()] : s[e.toLowerCase()] ? s[e.toLowerCase()] : "🌐";
|
|
107
107
|
}
|
|
108
|
-
var
|
|
108
|
+
var u = {
|
|
109
109
|
code: "en",
|
|
110
110
|
name: "English",
|
|
111
111
|
nativeName: "English",
|
|
112
112
|
flag: "🇺🇸"
|
|
113
113
|
};
|
|
114
|
-
function
|
|
115
|
-
let
|
|
116
|
-
|
|
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
|
|
119
|
-
query:
|
|
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)
|
|
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:
|
|
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
|
-
}),
|
|
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),
|
|
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
|
-
|
|
144
|
+
p(!1);
|
|
144
145
|
}
|
|
145
|
-
}, [
|
|
146
|
+
}, [s, c.length]);
|
|
146
147
|
return n(() => {
|
|
147
|
-
if (
|
|
148
|
-
|
|
148
|
+
if (a?.autoFetch !== !0) {
|
|
149
|
+
p(!1);
|
|
149
150
|
return;
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
+
y();
|
|
152
153
|
}, []), {
|
|
153
|
-
languages:
|
|
154
|
-
isLoading:
|
|
155
|
-
error:
|
|
156
|
-
refetch:
|
|
157
|
-
|
|
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 {
|
|
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,
|
|
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
|
|
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
|
|
212
|
-
function
|
|
213
|
-
let g = te(), _ = e("global"), { workspaceId: x } = n(), { user: S } = t(), { productSlug:
|
|
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
|
-
|
|
218
|
-
]), [
|
|
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 (
|
|
224
|
-
|
|
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 =
|
|
229
|
-
productSlug:
|
|
230
|
-
workspaceId:
|
|
231
|
-
moduleId:
|
|
232
|
-
pageId:
|
|
241
|
+
let t = E.child("fetch", {
|
|
242
|
+
productSlug: T,
|
|
243
|
+
workspaceId: D,
|
|
244
|
+
moduleId: k,
|
|
245
|
+
pageId: A
|
|
233
246
|
}), n = C(), r = [
|
|
234
|
-
|
|
247
|
+
T,
|
|
248
|
+
k ?? "",
|
|
235
249
|
A ?? "",
|
|
236
|
-
|
|
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 && (
|
|
255
|
+
U.current && (P(!0), I(null));
|
|
243
256
|
let i = ++W.current;
|
|
244
257
|
try {
|
|
245
258
|
let e = { context: {
|
|
246
|
-
productId:
|
|
247
|
-
moduleId:
|
|
248
|
-
pageId:
|
|
249
|
-
workspaceId:
|
|
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 && (
|
|
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),
|
|
293
|
+
t.error("Failed to fetch tours for context", n), I(n), M([]);
|
|
281
294
|
} finally {
|
|
282
|
-
U.current && i === W.current &&
|
|
295
|
+
U.current && i === W.current && P(!1);
|
|
283
296
|
}
|
|
284
297
|
}, [
|
|
285
|
-
|
|
298
|
+
L,
|
|
299
|
+
O,
|
|
286
300
|
_,
|
|
287
|
-
D,
|
|
288
|
-
A,
|
|
289
|
-
j,
|
|
290
301
|
E,
|
|
291
|
-
|
|
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 &&
|
|
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 =
|
|
300
|
-
}, [
|
|
313
|
+
R.current = j;
|
|
314
|
+
}, [j]);
|
|
301
315
|
let J = l(() => {
|
|
302
316
|
K(!0);
|
|
303
|
-
}, [K]), Y = f(() =>
|
|
304
|
-
productId:
|
|
305
|
-
moduleId:
|
|
306
|
-
pageId:
|
|
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
|
-
|
|
312
|
-
|
|
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),
|
|
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
|
-
|
|
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:
|
|
383
|
-
moduleId:
|
|
384
|
-
pageId:
|
|
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:
|
|
390
|
-
workspaceId:
|
|
391
|
-
productId:
|
|
392
|
-
moduleId:
|
|
393
|
-
pageId:
|
|
403
|
+
context: D ? {
|
|
404
|
+
workspaceId: D,
|
|
405
|
+
productId: T,
|
|
406
|
+
moduleId: k,
|
|
407
|
+
pageId: A
|
|
394
408
|
} : {
|
|
395
|
-
productId:
|
|
396
|
-
moduleId:
|
|
397
|
-
pageId:
|
|
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
|
-
|
|
406
|
-
E,
|
|
420
|
+
T,
|
|
407
421
|
S?.id,
|
|
408
|
-
|
|
409
|
-
]),
|
|
410
|
-
tours:
|
|
422
|
+
D
|
|
423
|
+
]), de = f(() => ({
|
|
424
|
+
tours: j,
|
|
411
425
|
pageTours: Y,
|
|
412
|
-
loading:
|
|
413
|
-
error:
|
|
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:
|
|
420
|
-
moduleId:
|
|
421
|
-
pageId:
|
|
433
|
+
productId: T,
|
|
434
|
+
moduleId: k,
|
|
435
|
+
pageId: A
|
|
422
436
|
}), [
|
|
423
|
-
|
|
437
|
+
j,
|
|
424
438
|
X,
|
|
425
|
-
|
|
426
|
-
|
|
439
|
+
F,
|
|
440
|
+
N,
|
|
441
|
+
k,
|
|
427
442
|
A,
|
|
428
|
-
j,
|
|
429
443
|
Y,
|
|
430
|
-
|
|
444
|
+
T,
|
|
431
445
|
Q,
|
|
432
446
|
J,
|
|
433
447
|
$,
|
|
434
448
|
Z
|
|
435
449
|
]);
|
|
436
|
-
return /* @__PURE__ */ ee(
|
|
437
|
-
value:
|
|
450
|
+
return /* @__PURE__ */ ee(w.Provider, {
|
|
451
|
+
value: de,
|
|
438
452
|
children: a
|
|
439
453
|
});
|
|
440
454
|
}
|
|
441
|
-
function
|
|
442
|
-
let e = u(
|
|
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
|
|
447
|
-
return u(
|
|
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
|
|
463
|
-
let e =
|
|
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
|
|
473
|
-
return
|
|
486
|
+
function k() {
|
|
487
|
+
return E().autoStartTour;
|
|
474
488
|
}
|
|
475
489
|
//#endregion
|
|
476
|
-
export {
|
|
490
|
+
export { T as ToursProvider, k as useAutoStartTour, D as useSafeToursContext, O as useTours, E as useToursContext };
|