analytica-frontend-lib 1.1.45 → 1.1.47

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/index.mjs CHANGED
@@ -6367,6 +6367,7 @@ var useMenuStore = (externalStore) => {
6367
6367
  var VARIANT_CLASSES5 = {
6368
6368
  menu: "bg-background shadow-soft-shadow-1 px-6",
6369
6369
  menu2: "",
6370
+ "menu-overflow": "",
6370
6371
  breadcrumb: "bg-transparent shadow-none !px-0"
6371
6372
  };
6372
6373
  var Menu = forwardRef17(
@@ -6386,7 +6387,7 @@ var Menu = forwardRef17(
6386
6387
  useEffect11(() => {
6387
6388
  setValue(propValue ?? defaultValue);
6388
6389
  }, [defaultValue, propValue, setValue]);
6389
- const baseClasses = "w-full py-2 flex flex-row items-center justify-center";
6390
+ const baseClasses = variant === "menu-overflow" ? "w-fit py-2 flex flex-row items-center justify-center" : "w-full py-2 flex flex-row items-center justify-center";
6390
6391
  const variantClasses = VARIANT_CLASSES5[variant];
6391
6392
  return /* @__PURE__ */ jsx33(
6392
6393
  "div",
@@ -6407,7 +6408,7 @@ Menu.displayName = "Menu";
6407
6408
  var MenuContent = forwardRef17(
6408
6409
  ({ className, children, variant = "menu", ...props }, ref) => {
6409
6410
  const baseClasses = "w-full flex flex-row items-center gap-2";
6410
- const variantClasses = variant === "menu2" ? "overflow-x-auto scroll-smooth" : "";
6411
+ const variantClasses = variant === "menu2" || variant === "menu-overflow" ? "overflow-x-auto scroll-smooth" : "";
6411
6412
  return /* @__PURE__ */ jsx33(
6412
6413
  "ul",
6413
6414
  {
@@ -6418,7 +6419,7 @@ var MenuContent = forwardRef17(
6418
6419
  ${variant == "breadcrumb" ? "flex-wrap" : ""}
6419
6420
  ${className ?? ""}
6420
6421
  `,
6421
- style: variant === "menu2" ? { scrollbarWidth: "none", msOverflowStyle: "none" } : void 0,
6422
+ style: variant === "menu2" || variant === "menu-overflow" ? { scrollbarWidth: "none", msOverflowStyle: "none" } : void 0,
6422
6423
  ...props,
6423
6424
  children
6424
6425
  }
@@ -6500,6 +6501,31 @@ var MenuItem = forwardRef17(
6500
6501
  ]
6501
6502
  }
6502
6503
  ),
6504
+ "menu-overflow": /* @__PURE__ */ jsxs27(
6505
+ "li",
6506
+ {
6507
+ "data-variant": "menu-overflow",
6508
+ className: `
6509
+ w-fit flex flex-col items-center px-2 pt-4 gap-3 cursor-pointer focus:rounded-sm justify-center hover:bg-background-100 rounded-lg
6510
+ focus:outline-none focus:border-indicator-info focus:border-2
6511
+ ${selectedValue === value ? "" : "pb-4"}
6512
+ `,
6513
+ ...commonProps,
6514
+ children: [
6515
+ /* @__PURE__ */ jsx33(
6516
+ "span",
6517
+ {
6518
+ className: cn(
6519
+ "flex flex-row items-center gap-2 px-4 text-text-950 text-xs font-bold",
6520
+ className
6521
+ ),
6522
+ children
6523
+ }
6524
+ ),
6525
+ selectedValue === value && /* @__PURE__ */ jsx33("div", { className: "h-1 w-full bg-primary-950 rounded-lg" })
6526
+ ]
6527
+ }
6528
+ ),
6503
6529
  breadcrumb: /* @__PURE__ */ jsxs27(
6504
6530
  "li",
6505
6531
  {
@@ -10848,6 +10874,116 @@ var NotificationCard_default = NotificationCard;
10848
10874
  var createUseNotificationStore = (apiClient) => {
10849
10875
  return createNotificationStore(apiClient);
10850
10876
  };
10877
+
10878
+ // src/hooks/useNotifications.ts
10879
+ import { useCallback as useCallback5 } from "react";
10880
+ var createUseNotifications = (apiClient) => {
10881
+ const useNotificationStore = createUseNotificationStore(apiClient);
10882
+ return () => {
10883
+ const {
10884
+ notifications,
10885
+ unreadCount,
10886
+ loading,
10887
+ error,
10888
+ hasMore,
10889
+ currentPage,
10890
+ fetchNotifications,
10891
+ markAsRead,
10892
+ markAllAsRead,
10893
+ deleteNotification,
10894
+ clearNotifications,
10895
+ resetError,
10896
+ getGroupedNotifications
10897
+ } = useNotificationStore();
10898
+ const handleNavigate = useCallback5(
10899
+ (entityType, entityId) => {
10900
+ if (entityType && entityId) {
10901
+ switch (entityType.toUpperCase()) {
10902
+ case "ACTIVITY" /* ACTIVITY */:
10903
+ window.location.href = `/atividades/${entityId}`;
10904
+ break;
10905
+ case "GOAL" /* GOAL */:
10906
+ window.location.href = `/painel/trilhas/${entityId}`;
10907
+ break;
10908
+ default:
10909
+ break;
10910
+ }
10911
+ }
10912
+ },
10913
+ []
10914
+ );
10915
+ const getActionLabel = useCallback5(
10916
+ (entityType) => {
10917
+ if (!entityType) return void 0;
10918
+ switch (entityType.toUpperCase()) {
10919
+ case "ACTIVITY" /* ACTIVITY */:
10920
+ return "Ver atividade";
10921
+ case "GOAL" /* GOAL */:
10922
+ return "Ver meta";
10923
+ default:
10924
+ return void 0;
10925
+ }
10926
+ },
10927
+ []
10928
+ );
10929
+ const markAsReadAndNavigate = useCallback5(
10930
+ async (id, entityType, entityId) => {
10931
+ await markAsRead(id);
10932
+ if (entityType && entityId) {
10933
+ handleNavigate(entityType, entityId);
10934
+ }
10935
+ },
10936
+ [markAsRead, handleNavigate]
10937
+ );
10938
+ const refreshNotifications = useCallback5(async () => {
10939
+ resetError();
10940
+ await fetchNotifications();
10941
+ }, [resetError, fetchNotifications]);
10942
+ const formatNotification = useCallback5(
10943
+ (notification) => ({
10944
+ ...notification,
10945
+ time: formatTimeAgo(notification.createdAt),
10946
+ entityType: notification.entityType || void 0,
10947
+ entityId: notification.entityId || void 0
10948
+ }),
10949
+ []
10950
+ );
10951
+ const getFormattedGroupedNotifications = useCallback5(() => {
10952
+ const groups = getGroupedNotifications();
10953
+ return groups.map((group) => ({
10954
+ ...group,
10955
+ notifications: group.notifications.map(formatNotification)
10956
+ }));
10957
+ }, [getGroupedNotifications, formatNotification]);
10958
+ return {
10959
+ // State
10960
+ notifications,
10961
+ unreadCount,
10962
+ loading,
10963
+ error,
10964
+ hasMore,
10965
+ currentPage,
10966
+ // Actions
10967
+ fetchNotifications,
10968
+ markAsRead,
10969
+ markAllAsRead,
10970
+ deleteNotification,
10971
+ clearNotifications,
10972
+ resetError,
10973
+ markAsReadAndNavigate,
10974
+ refreshNotifications,
10975
+ // Navigation
10976
+ handleNavigate,
10977
+ // Helpers
10978
+ getActionLabel,
10979
+ getGroupedNotifications,
10980
+ getFormattedGroupedNotifications
10981
+ };
10982
+ };
10983
+ };
10984
+ var createNotificationsHook = (apiClient) => {
10985
+ return createUseNotifications(apiClient);
10986
+ };
10851
10987
  export {
10852
10988
  ANSWER_STATUS,
10853
10989
  Alert_default as Alert,
@@ -10952,7 +11088,9 @@ export {
10952
11088
  VideoPlayer_default as VideoPlayer,
10953
11089
  Whiteboard_default as Whiteboard,
10954
11090
  createNotificationStore,
11091
+ createNotificationsHook,
10955
11092
  createUseNotificationStore,
11093
+ createUseNotifications,
10956
11094
  createZustandAuthAdapter,
10957
11095
  formatTimeAgo,
10958
11096
  getDeviceType,