ikoncomponents 1.3.7 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,36 +1,36 @@
1
- This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2
-
3
- ## Getting Started
4
-
5
- First, run the development server:
6
-
7
- ```bash
8
- npm run dev
9
- # or
10
- yarn dev
11
- # or
12
- pnpm dev
13
- # or
14
- bun dev
15
- ```
16
-
17
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
-
19
- You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
-
21
- This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22
-
23
- ## Learn More
24
-
25
- To learn more about Next.js, take a look at the following resources:
26
-
27
- - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
- - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
-
30
- You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
-
32
- ## Deploy on Vercel
33
-
34
- The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
-
36
- Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
1
+ This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2
+
3
+ ## Getting Started
4
+
5
+ First, run the development server:
6
+
7
+ ```bash
8
+ npm run dev
9
+ # or
10
+ yarn dev
11
+ # or
12
+ pnpm dev
13
+ # or
14
+ bun dev
15
+ ```
16
+
17
+ Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
+
19
+ You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
+
21
+ This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22
+
23
+ ## Learn More
24
+
25
+ To learn more about Next.js, take a look at the following resources:
26
+
27
+ - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
+ - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
+
30
+ You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
+
32
+ ## Deploy on Vercel
33
+
34
+ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
+
36
+ Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
@@ -51,8 +51,8 @@ export function FileUploader({ label = "Upload File", isDrag = false, onFileSele
51
51
  if (file)
52
52
  handleFile(file);
53
53
  };
54
- return (_jsxs("div", { className: "flex flex-col gap-2 w-full", children: [_jsx("label", { className: "text-sm font-medium", children: label }), _jsx("input", { type: "file", id: "fileInput", className: "hidden", onChange: handleInputChange }), isDrag ? (_jsx("div", { className: `border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition
55
- ${isDragging ? "border-blue-600 bg-blue-50" : "border-gray-300"}
54
+ return (_jsxs("div", { className: "flex flex-col gap-2 w-full", children: [_jsx("label", { className: "text-sm font-medium", children: label }), _jsx("input", { type: "file", id: "fileInput", className: "hidden", onChange: handleInputChange }), isDrag ? (_jsx("div", { className: `border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition
55
+ ${isDragging ? "border-blue-600 bg-blue-50" : "border-gray-300"}
56
56
  `, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: () => { var _a; return (_a = document.getElementById("fileInput")) === null || _a === void 0 ? void 0 : _a.click(); }, children: _jsxs("div", { className: "flex flex-col items-center gap-3", children: [_jsx(UploadCloud, { className: "w-10 h-10 text-blue-600" }), _jsxs("p", { className: "text-gray-600", children: ["Drag & drop your file here or", " ", _jsx("span", { className: "text-blue-600 underline", children: "browse" })] })] }) })) : (
57
57
  // ----- SIMPLE UPLOAD BOX -----
58
58
  _jsxs("div", { className: "border rounded-lg p-4 flex flex-col items-center gap-2 cursor-pointer text-center", onClick: () => { var _a; return (_a = document.getElementById("fileInput")) === null || _a === void 0 ? void 0 : _a.click(); }, children: [_jsx(FileUp, { className: "w-8 h-8 text-blue-600" }), _jsx("span", { className: "text-blue-600 underline", children: "Browse File" })] }))] }));
@@ -7,7 +7,7 @@ import { format } from "date-fns";
7
7
  import { CalendarIcon } from "lucide-react";
8
8
  import { Calendar } from "../../../shadcn/calendar";
9
9
  export function FormDateInput({ formControl, name, label, placeholder, dateFormat, calendarDateDisabled, formDescription, disabled, }) {
10
- return (_jsx(_Fragment, { children: _jsx(FormField, { control: formControl, name: name, render: ({ field }) => (_jsxs(FormItem, { children: [label && (_jsx(_Fragment, { children: _jsx(FormLabel, { children: label }) })), _jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, className: "w-full", children: _jsx(FormControl, { children: _jsxs(Button, { variant: "outline", className: cn(!field.value && "text-foreground/50"), disabled: disabled, children: [field.value ? (format(field.value, dateFormat || "PPP")) : (_jsx("span", { children: placeholder || "Pick a date" })), _jsx(CalendarIcon, { className: "ml-auto h-4 w-4 opacity-50" })] }) }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: _jsx(Calendar, { mode: "single", selected: field.value, onSelect: field.onChange, disabled: calendarDateDisabled,
10
+ return (_jsx(_Fragment, { children: _jsx(FormField, { control: formControl, name: name, render: ({ field }) => (_jsxs(FormItem, { children: [label && (_jsx(_Fragment, { children: _jsx(FormLabel, { children: label }) })), _jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, className: "w-full", children: _jsx(FormControl, { children: _jsxs(Button, { variant: "outline", className: cn(!field.value && "text-foreground/50"), disabled: disabled, children: [field.value ? (format(field.value, dateFormat || "PPP")) : (_jsx("span", { children: placeholder || "Pick a date" })), _jsx(CalendarIcon, { className: "ml-auto h-4 w-4 opacity-50" })] }) }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: _jsx(Calendar, { mode: "single", selected: field.value, onSelect: field.onChange, disabled: calendarDateDisabled, captionLayout: "dropdown",
11
11
  // disabled={(date) =>
12
12
  // date > new Date() || date < new Date("1900-01-01")
13
13
  // }
@@ -90,12 +90,12 @@ const NewImageFormComponent = ({ open, setOpen, onImageSubmit, }) => {
90
90
  const getImagePreview = (state) => {
91
91
  const imgSource = croppedImage && activeState === state ? croppedImage : prevImages[state];
92
92
  // const imgSource = prevImages[state];
93
- return imgSource ? (_jsx("div", { className: `
93
+ return imgSource ? (_jsx("div", { className: `
94
94
  ${state === "first"
95
95
  ? "relative w-3/5 h-[200px] bg-slate-400"
96
96
  : state === "second"
97
97
  ? "relative w-1/2 h-[220px] bg-slate-400"
98
- : "relative w-1/3 h-[120px] bg-slate-400"}`, children: _jsx(Image, { src: imgSource || "", alt: `Preview ${state}`, layout: "fill", objectFit: "70vh" }) })) : (_jsx("div", { className: `
98
+ : "relative w-1/3 h-[120px] bg-slate-400"}`, children: _jsx(Image, { src: imgSource || "", alt: `Preview ${state}`, layout: "fill", objectFit: "70vh" }) })) : (_jsx("div", { className: `
99
99
  ${state === "first"
100
100
  ? "relative w-3/5 h-[200px] bg-slate-400"
101
101
  : state === "second"
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface RefreshContextType {
3
+ refresh: () => void;
4
+ refreshCounter: number;
5
+ }
6
+ export declare function RefreshProvider({ children }: {
7
+ children: React.ReactNode;
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ export declare function useRefresh(): RefreshContextType;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useState, useCallback } from 'react';
3
+ const RefreshContext = createContext(undefined);
4
+ export function RefreshProvider({ children }) {
5
+ const [refreshCounter, setRefreshCounter] = useState(0);
6
+ const refresh = useCallback(() => {
7
+ setRefreshCounter((prev) => prev + 1);
8
+ }, []);
9
+ return (_jsx(RefreshContext.Provider, { value: { refresh, refreshCounter }, children: children }));
10
+ }
11
+ export function useRefresh() {
12
+ const context = useContext(RefreshContext);
13
+ if (context === undefined) {
14
+ throw new Error('useRefresh must be used within a RefreshProvider');
15
+ }
16
+ return context;
17
+ }
@@ -1,3 +1,8 @@
1
+ export interface AccountMembership {
2
+ accountId: string;
3
+ accountName: string;
4
+ primaryAccount?: boolean;
5
+ }
1
6
  export interface Account {
2
7
  accountId: string;
3
8
  accountName: string;
@@ -49,7 +54,7 @@ export interface DecodedAccessToken {
49
54
  iat: number;
50
55
  exp: number;
51
56
  }
52
- export declare const MainSidebar: ({ baseUrl, platformUrl }: {
57
+ export declare const MainSidebar: ({ baseUrl, platformUrl, }: {
53
58
  baseUrl: string;
54
59
  platformUrl: string;
55
60
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,27 +1,29 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from 'react';
4
- import { Check, CircleUserRound, FolderCode, Home, LogOut, Settings } from 'lucide-react';
5
- import { Button } from '../../shadcn/button';
6
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../shadcn/tooltip';
7
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '../../shadcn/dropdown-menu';
8
- import { getValidAccessToken } from '../../utils/token-management';
9
- import { clearAllCookieSession } from '../../utils/session/cookieSession';
10
- import axios from 'axios';
11
- import { redirect } from 'next/navigation';
12
- import Link from 'next/link';
3
+ import * as React from "react";
4
+ import { Check, CircleUserRound, FolderCode, Home, LogOut, Settings, } from "lucide-react";
5
+ import { Button } from "../../shadcn/button";
6
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../../shadcn/tooltip";
7
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "../../shadcn/dropdown-menu";
8
+ import { getValidAccessToken } from "../../utils/token-management";
9
+ import { clearAllCookieSession, setCookieSession } from "../../utils/session/cookieSession";
10
+ import axios from "axios";
11
+ import { redirect } from "next/navigation";
12
+ import Link from "next/link";
13
13
  import { jwtDecode } from "jwt-decode";
14
- import { Icon } from '../icon';
15
- export const MainSidebar = ({ baseUrl, platformUrl }) => {
14
+ import { Icon } from "../icon";
15
+ import { useRefresh } from "./RefreshContext";
16
+ export const MainSidebar = ({ baseUrl, platformUrl, }) => {
16
17
  const [user, setUser] = React.useState();
17
18
  const [accounts, setAccounts] = React.useState([]);
18
19
  const [selectedAccount, setSelectedAccount] = React.useState();
19
20
  const [softwares, setSoftwares] = React.useState([]);
21
+ const { refreshCounter } = useRefresh();
20
22
  const getInitials = (name) => {
21
23
  return name
22
- .split(' ')
23
- .map(word => word[0])
24
- .join('')
24
+ .split(" ")
25
+ .map((word) => word[0])
26
+ .join("")
25
27
  .toUpperCase()
26
28
  .slice(0, 2);
27
29
  };
@@ -31,69 +33,51 @@ export const MainSidebar = ({ baseUrl, platformUrl }) => {
31
33
  .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
32
34
  .join("");
33
35
  }
36
+ // Fetch all data
34
37
  React.useEffect(() => {
35
- const fetchUser = async () => {
38
+ const fetchAllData = async () => {
36
39
  try {
37
40
  const accessToken = await getValidAccessToken(baseUrl, {
38
- platformUrl: platformUrl,
39
- isSetToken: true
41
+ platformUrl,
42
+ isSetToken: true,
40
43
  });
41
- const decoded = jwtDecode(accessToken !== null && accessToken !== void 0 ? accessToken : '');
42
- const response = await axios.get(`${baseUrl}/platform/user/${decoded.sub}`, {
43
- headers: {
44
- Authorization: `Bearer ${accessToken}`,
45
- },
46
- });
47
- setUser(response.data);
48
- }
49
- catch (error) {
50
- console.error(error);
51
- }
52
- };
53
- const fetchAccounts = async () => {
54
- try {
55
- const accessToken = await getValidAccessToken(baseUrl, {
56
- platformUrl: platformUrl,
57
- isSetToken: true
58
- });
59
- const response = await axios.get(`${baseUrl}/platform/account/all`, {
60
- headers: {
61
- Authorization: `Bearer ${accessToken}`,
62
- },
63
- });
64
- setAccounts(response.data);
65
- setSelectedAccount(response.data[0]);
66
- }
67
- catch (error) {
68
- console.error(error);
69
- }
70
- };
71
- const fetchSubscribedSoftwares = async () => {
72
- try {
73
- const accessToken = await getValidAccessToken(baseUrl, {
74
- platformUrl: platformUrl,
75
- isSetToken: true
76
- });
77
- const response = await axios.get(`${baseUrl}/platform/software/accessible/user`, {
78
- headers: {
79
- Authorization: `Bearer ${accessToken}`,
80
- },
81
- });
82
- setSoftwares(response.data);
44
+ const decoded = jwtDecode(accessToken !== null && accessToken !== void 0 ? accessToken : "");
45
+ // Fetch all data in parallel
46
+ const [userResponse, accountsResponse, softwaresResponse] = await Promise.all([
47
+ axios.get(`${baseUrl}/platform/user/${decoded.sub}`, {
48
+ headers: { Authorization: `Bearer ${accessToken}` },
49
+ }),
50
+ axios.get(`${baseUrl}/platform/user/account-membership`, {
51
+ headers: { Authorization: `Bearer ${accessToken}` },
52
+ }),
53
+ axios.get(`${baseUrl}/platform/software/accessible/user`, {
54
+ headers: { Authorization: `Bearer ${accessToken}` },
55
+ }),
56
+ ]);
57
+ setUser(userResponse.data);
58
+ setAccounts(accountsResponse.data);
59
+ // const primaryAccount = accountsResponse.data.find(
60
+ // (account) => account.primaryAccount === true
61
+ // );
62
+ // if (primaryAccount) {
63
+ // setSelectedAccount(primaryAccount);
64
+ // }
65
+ const activeAccount = accountsResponse.data.find((account) => account.accountId === decoded.activeAccountId);
66
+ setSelectedAccount(activeAccount);
67
+ const visibleSoftwares = softwaresResponse.data.filter((item) => item.visible);
68
+ setSoftwares(visibleSoftwares);
83
69
  }
84
70
  catch (error) {
85
- console.error(error);
71
+ console.error("Failed to fetch data:", error);
86
72
  }
87
73
  };
88
- fetchAccounts();
89
- fetchSubscribedSoftwares();
90
- fetchUser();
91
- }, []);
74
+ fetchAllData();
75
+ }, [baseUrl, platformUrl, refreshCounter]);
92
76
  const switchAccount = async (accountId, baseUrl) => {
93
77
  try {
94
78
  const accessToken = await getValidAccessToken(baseUrl, {
95
79
  platformUrl: platformUrl,
96
- isSetToken: true
80
+ isSetToken: true,
97
81
  });
98
82
  const response = await axios.post(`${baseUrl}/platform/auth/switch-account`, {
99
83
  targetAccountId: accountId,
@@ -104,29 +88,31 @@ export const MainSidebar = ({ baseUrl, platformUrl }) => {
104
88
  withCredentials: true,
105
89
  });
106
90
  console.log(response);
107
- return response.data;
91
+ await setCookieSession("accessToken", response.data.accessToken);
92
+ await setCookieSession("refreshToken", response.data.refreshToken);
108
93
  }
109
94
  catch (error) {
110
95
  console.error(error);
111
96
  throw error;
112
97
  }
113
98
  };
114
- return (_jsx(TooltipProvider, { delayDuration: 0, children: _jsxs("aside", { className: "fixed left-0 top-0 z-20 h-screen w-12 border-r border-border bg-sidebar text-sidebar-foreground flex flex-col items-center py-4 ", children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "default", className: "mb-4 h-8 w-8 rounded-lg p-0", disabled: !selectedAccount, children: _jsx("span", { className: "text-base font-medium text-accent-foreground", children: selectedAccount ? getInitials(selectedAccount.accountName) : '...' }) }) }), _jsxs(DropdownMenuContent, { className: "w-55", side: "right", sideOffset: 8, align: "start", children: [_jsx("div", { className: "px-2 py-1.5 text-xs font-semibold text-foreground", children: "Accounts" }), accounts.map((account) => (_jsxs(DropdownMenuItem, { className: "flex items-center justify-between cursor-pointer", onClick: async () => {
99
+ return (_jsx(TooltipProvider, { delayDuration: 0, children: _jsxs("aside", { className: "fixed left-0 top-0 z-20 h-screen w-12 border-r border-border bg-sidebar text-sidebar-foreground flex flex-col items-center py-4 ", children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "default", className: "mb-4 h-8 w-8 rounded-lg p-0", disabled: !selectedAccount, children: _jsx("span", { className: "text-base font-medium text-accent-foreground", children: selectedAccount
100
+ ? getInitials(selectedAccount.accountName)
101
+ : "..." }) }) }), _jsxs(DropdownMenuContent, { className: "w-55", side: "right", sideOffset: 8, align: "start", children: [_jsx("div", { className: "px-2 py-1.5 text-xs font-semibold text-foreground", children: "Accounts" }), accounts.map((account) => (_jsxs(DropdownMenuItem, { className: "flex items-center justify-between cursor-pointer", onClick: async () => {
115
102
  try {
116
103
  setSelectedAccount(account);
117
104
  console.log(account.accountId);
118
- const res = await switchAccount(account.accountId, baseUrl); // Pass baseUrl
119
- console.log(res);
120
- window.location.reload(); // Reload to apply new account context
105
+ await switchAccount(account.accountId, baseUrl);
106
+ window.location.reload();
121
107
  }
122
108
  catch (error) {
123
109
  console.error("Switch account failed", error);
124
110
  }
125
- }, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "h-6 w-6 rounded bg-primary/10 flex items-center justify-center", children: _jsx("span", { className: "text-xs font-medium text-primary", children: getInitials(account.accountName) }) }), _jsx("span", { className: "text-sm", children: account.accountName })] }), (selectedAccount === null || selectedAccount === void 0 ? void 0 : selectedAccount.accountId) === account.accountId && (_jsx(Check, { className: "h-4 w-4 text-primary" }))] }, account.accountId)))] })] }), _jsx("nav", { className: "flex flex-col gap-1", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: 'h-8 w-8', children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: `${platformUrl}/home`, children: [_jsx(Home, { className: "h-8 w-8" }), _jsx("span", { className: "sr-only", children: "Home" })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Home" })] }, "home") }), _jsx("nav", { className: "flex flex-col gap-1 flex-1", children: softwares.map((software) => {
111
+ }, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "h-6 w-6 rounded bg-primary/10 flex items-center justify-center", children: _jsx("span", { className: "text-xs font-medium text-primary", children: getInitials(account.accountName) }) }), _jsx("span", { className: "text-sm", children: account.accountName })] }), (selectedAccount === null || selectedAccount === void 0 ? void 0 : selectedAccount.accountId) === account.accountId && (_jsx(Check, { className: "h-4 w-4 text-primary" }))] }, account.accountId)))] })] }), _jsx("nav", { className: "flex flex-col gap-1", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: "h-8 w-8", children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: `${platformUrl}/home`, children: [_jsx(Home, { className: "h-8 w-8" }), _jsx("span", { className: "sr-only", children: "Home" })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Home" })] }, "home") }), _jsx("nav", { className: "flex flex-col gap-1 flex-1", children: softwares.map((software) => {
126
112
  var _a, _b;
127
113
  const hasIcon = Boolean(software.icon && software.icon.trim() !== "");
128
- return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: "h-8 w-8", children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: (_a = software.url) !== null && _a !== void 0 ? _a : "#", children: [hasIcon ? (_jsx(Icon, { name: toPascalCase((_b = software.icon) !== null && _b !== void 0 ? _b : ''), className: "h-8 w-8" })) : (_jsx(FolderCode, { className: "h-8 w-8" })), _jsx("span", { className: "sr-only", children: software.softwareName })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: software.softwareName })] }, software.softwareName));
129
- }) }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: 'h-8 w-8', children: _jsx(Button, { variant: "ghost", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: `${platformUrl}/settings`, children: [_jsx(Settings, { className: "h-8 w-8" }), _jsx("span", { className: "sr-only", children: "Settings" })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Settings" })] }, "settings"), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", children: _jsx(CircleUserRound, { className: "h-8 w-8" }) }) }), _jsxs(DropdownMenuContent, { className: "w-55 p-0", side: 'right', sideOffset: 8, children: [_jsxs("div", { className: "flex items-start gap-3 p-4 bg-card", children: [_jsx(CircleUserRound, { className: "h-8 w-8" }), _jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [_jsx("p", { className: "text-sm font-bold text-foreground blue-dark:text-muted-foreground truncate", children: user === null || user === void 0 ? void 0 : user.userName }), _jsx("p", { className: "text-xs text-muted-foreground truncate", children: user === null || user === void 0 ? void 0 : user.userEmail }), _jsx("p", { className: "text-sm text-muted-foreground font-semibold", children: selectedAccount === null || selectedAccount === void 0 ? void 0 : selectedAccount.accountName })] })] }), _jsx(DropdownMenuSeparator, { className: "my-0" }), _jsxs(DropdownMenuItem, { onClick: async () => {
114
+ return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: "h-8 w-8", children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: (_a = software.url) !== null && _a !== void 0 ? _a : "#", children: [hasIcon ? (_jsx(Icon, { name: toPascalCase((_b = software.icon) !== null && _b !== void 0 ? _b : ""), className: "h-8 w-8" })) : (_jsx(FolderCode, { className: "h-8 w-8" })), _jsx("span", { className: "sr-only", children: software.softwareName })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: software.softwareName })] }, software.softwareName));
115
+ }) }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: "h-8 w-8", children: _jsx(Button, { variant: "ghost", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: `${platformUrl}/settings`, children: [_jsx(Settings, { className: "h-8 w-8" }), _jsx("span", { className: "sr-only", children: "Settings" })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Settings" })] }, "settings"), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", children: _jsx(CircleUserRound, { className: "h-8 w-8" }) }) }), _jsxs(DropdownMenuContent, { className: "w-55 p-0", side: "right", sideOffset: 8, children: [_jsxs("div", { className: "flex items-start gap-3 p-4 bg-card", children: [_jsx(CircleUserRound, { className: "h-8 w-8" }), _jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [_jsx("p", { className: "text-sm font-bold text-foreground blue-dark:text-muted-foreground truncate", children: user === null || user === void 0 ? void 0 : user.userName }), _jsx("p", { className: "text-xs text-muted-foreground truncate", children: user === null || user === void 0 ? void 0 : user.userEmail }), _jsx("p", { className: "text-sm text-muted-foreground font-semibold", children: selectedAccount === null || selectedAccount === void 0 ? void 0 : selectedAccount.accountName })] })] }), _jsx(DropdownMenuSeparator, { className: "my-0" }), _jsxs(DropdownMenuItem, { onClick: async () => {
130
116
  await clearAllCookieSession();
131
117
  redirect(`${platformUrl}/login.html`);
132
118
  }, className: "flex items-center gap-2 px-4 py-3 cursor-pointer focus:bg-destructive dark:focus:bg-destructive blue-dark:focus:bg-destructive", children: [_jsx(LogOut, { className: "h-4 w-4 text-foreground" }), _jsx("span", { children: "Log out" })] })] })] })] }) }));
package/dist/index.d.ts CHANGED
@@ -135,3 +135,4 @@ export { setCookieSession, getCookieSession, clearCookieSession, clearAllCookieS
135
135
  export { getValidAccessToken, refreshAccessToken, decodeAccessToken, logOut, } from "./utils/token-management";
136
136
  export type { TokenResponse } from "./utils/token-management/types";
137
137
  export { useIsMobile } from "./hooks/use-mobile";
138
+ export { useRefresh } from "./ikoncomponents/main-layout/RefreshContext";
package/dist/index.js CHANGED
@@ -113,3 +113,4 @@ export { cn } from "./utils/cn";
113
113
  export { setCookieSession, getCookieSession, clearCookieSession, clearAllCookieSession, } from "./utils/session/cookieSession";
114
114
  export { getValidAccessToken, refreshAccessToken, decodeAccessToken, logOut, } from "./utils/token-management";
115
115
  export { useIsMobile } from "./hooks/use-mobile";
116
+ export { useRefresh } from "./ikoncomponents/main-layout/RefreshContext";
package/dist/styles.css CHANGED
@@ -4980,9 +4980,9 @@
4980
4980
  .custom-buttons {
4981
4981
  font-size: 14px;
4982
4982
  }
4983
- .rbc-date-cell.rbc-now,
4984
- .rbc-time-slot.rbc-now,
4985
- .rbc-show-more,
4983
+ .rbc-date-cell.rbc-now,
4984
+ .rbc-time-slot.rbc-now,
4985
+ .rbc-show-more,
4986
4986
  .rbc-header {
4987
4987
  font-weight: normal !important;
4988
4988
  }
@@ -5028,13 +5028,13 @@
5028
5028
  .rbc-h-full {
5029
5029
  height: 100%;
5030
5030
  }
5031
- .rbc-calendar *,
5032
- .rbc-calendar *:before,
5031
+ .rbc-calendar *,
5032
+ .rbc-calendar *:before,
5033
5033
  .rbc-calendar *:after {
5034
5034
  -webkit-box-sizing: inherit;
5035
5035
  box-sizing: inherit;
5036
5036
  }
5037
- .rbc-abs-full,
5037
+ .rbc-abs-full,
5038
5038
  .rbc-row-bg {
5039
5039
  overflow: hidden;
5040
5040
  position: absolute;
@@ -5043,9 +5043,9 @@
5043
5043
  right: 0;
5044
5044
  bottom: 0;
5045
5045
  }
5046
- .rbc-ellipsis,
5047
- .rbc-show-more,
5048
- .rbc-row-segment .rbc-event-content,
5046
+ .rbc-ellipsis,
5047
+ .rbc-show-more,
5048
+ .rbc-row-segment .rbc-event-content,
5049
5049
  .rbc-event-label {
5050
5050
  display: block;
5051
5051
  overflow: hidden;
@@ -5084,8 +5084,8 @@
5084
5084
  border-left-width: 0;
5085
5085
  border-right: 1px solid hsl(var(--border));
5086
5086
  }
5087
- .rbc-header>a,
5088
- .rbc-header>a:active,
5087
+ .rbc-header>a,
5088
+ .rbc-header>a:active,
5089
5089
  .rbc-header>a:visited {
5090
5090
  color: inherit;
5091
5091
  text-decoration: none;
@@ -5169,7 +5169,7 @@
5169
5169
  line-height: normal;
5170
5170
  white-space: nowrap;
5171
5171
  }
5172
- .rbc-toolbar button:active,
5172
+ .rbc-toolbar button:active,
5173
5173
  .rbc-toolbar button.rbc-active {
5174
5174
  background-image: none;
5175
5175
  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
@@ -5177,9 +5177,9 @@
5177
5177
  background-color: #e6e6e6;
5178
5178
  border-color: #adadad;
5179
5179
  }
5180
- .rbc-toolbar button:active:hover,
5181
- .rbc-toolbar button:active:focus,
5182
- .rbc-toolbar button.rbc-active:hover,
5180
+ .rbc-toolbar button:active:hover,
5181
+ .rbc-toolbar button:active:focus,
5182
+ .rbc-toolbar button.rbc-active:hover,
5183
5183
  .rbc-toolbar button.rbc-active:focus {
5184
5184
  color: #373a3c;
5185
5185
  background-color: #d4d4d4;
@@ -5227,7 +5227,7 @@
5227
5227
  margin-left: 0;
5228
5228
  margin-right: -1px;
5229
5229
  }
5230
- .rbc-btn-group+.rbc-btn-group,
5230
+ .rbc-btn-group+.rbc-btn-group,
5231
5231
  .rbc-btn-group+button {
5232
5232
  margin-left: 10px;
5233
5233
  }
@@ -5239,7 +5239,7 @@
5239
5239
  flex-direction: column;
5240
5240
  }
5241
5241
  }
5242
- .rbc-event,
5242
+ .rbc-event,
5243
5243
  .rbc-day-slot .rbc-background-event {
5244
5244
  border: none;
5245
5245
  -webkit-box-sizing: border-box;
@@ -5255,17 +5255,17 @@
5255
5255
  width: 100%;
5256
5256
  text-align: left;
5257
5257
  }
5258
- .rbc-slot-selecting .rbc-event,
5259
- .rbc-slot-selecting .rbc-day-slot .rbc-background-event,
5258
+ .rbc-slot-selecting .rbc-event,
5259
+ .rbc-slot-selecting .rbc-day-slot .rbc-background-event,
5260
5260
  .rbc-day-slot .rbc-slot-selecting .rbc-background-event {
5261
5261
  cursor: inherit;
5262
5262
  pointer-events: none;
5263
5263
  }
5264
- .rbc-event.rbc-selected,
5264
+ .rbc-event.rbc-selected,
5265
5265
  .rbc-day-slot .rbc-selected.rbc-background-event {
5266
5266
  background-color: #265985;
5267
5267
  }
5268
- .rbc-event:focus,
5268
+ .rbc-event:focus,
5269
5269
  .rbc-day-slot .rbc-background-event:focus {
5270
5270
  outline: 5px auto #3b99fc;
5271
5271
  }
@@ -5317,7 +5317,7 @@
5317
5317
  line-height: normal;
5318
5318
  color: hsl(var(--input));
5319
5319
  }
5320
- .rbc-show-more:hover,
5320
+ .rbc-show-more:hover,
5321
5321
  .rbc-show-more:focus {
5322
5322
  color: #265985;
5323
5323
  }
@@ -5381,8 +5381,8 @@
5381
5381
  .rbc-date-cell.rbc-now {
5382
5382
  font-weight: bold;
5383
5383
  }
5384
- .rbc-date-cell>a,
5385
- .rbc-date-cell>a:active,
5384
+ .rbc-date-cell>a,
5385
+ .rbc-date-cell>a:active,
5386
5386
  .rbc-date-cell>a:visited {
5387
5387
  color: inherit;
5388
5388
  text-decoration: none;
@@ -5485,7 +5485,7 @@
5485
5485
  .rbc-agenda-time-cell .rbc-continues-prior:before {
5486
5486
  content: "« ";
5487
5487
  }
5488
- .rbc-agenda-date-cell,
5488
+ .rbc-agenda-date-cell,
5489
5489
  .rbc-agenda-time-cell {
5490
5490
  white-space: nowrap;
5491
5491
  }
@@ -5518,7 +5518,7 @@
5518
5518
  -ms-flex-flow: column nowrap;
5519
5519
  flex-flow: column nowrap;
5520
5520
  }
5521
- .rbc-time-gutter,
5521
+ .rbc-time-gutter,
5522
5522
  .rbc-header-gutter {
5523
5523
  -webkit-box-flex: 0;
5524
5524
  -ms-flex: none;
@@ -5542,7 +5542,7 @@
5542
5542
  left: 10px;
5543
5543
  right: 0;
5544
5544
  }
5545
- .rbc-day-slot .rbc-event,
5545
+ .rbc-day-slot .rbc-event,
5546
5546
  .rbc-day-slot .rbc-background-event {
5547
5547
  border: 1px solid #265985;
5548
5548
  display: -webkit-box;
@@ -5583,7 +5583,7 @@
5583
5583
  .rbc-day-slot .rbc-time-slot {
5584
5584
  border-top: 1px solid hsl(var(--border));
5585
5585
  }
5586
- .rbc-time-view-resources .rbc-time-gutter,
5586
+ .rbc-time-view-resources .rbc-time-gutter,
5587
5587
  .rbc-time-view-resources .rbc-time-header-gutter {
5588
5588
  position: sticky;
5589
5589
  left: 0;
@@ -5609,7 +5609,7 @@
5609
5609
  .rbc-time-view-resources .rbc-day-slot {
5610
5610
  min-width: 140px;
5611
5611
  }
5612
- .rbc-time-view-resources .rbc-header,
5612
+ .rbc-time-view-resources .rbc-header,
5613
5613
  .rbc-time-view-resources .rbc-day-bg {
5614
5614
  width: 140px;
5615
5615
  -webkit-box-flex: 1;
package/package.json CHANGED
@@ -1,103 +1,103 @@
1
- {
2
- "name": "ikoncomponents",
3
- "version": "1.3.7",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "css": "dist/styles.css",
7
- "files": [
8
- "dist"
9
- ],
10
- "scripts": {
11
- "build": "npm run build:js && npm run build:css",
12
- "build:js": "tsc -p tsconfig.json",
13
- "build:css": "postcss src/styles.css -o dist/styles.css --config postcss.config.mjs --minify",
14
- "clean": "rimraf dist",
15
- "prepublishOnly": "npm run build"
16
- },
17
- "dependencies": {
18
- "@radix-ui/react-accordion": "^1.2.12",
19
- "@radix-ui/react-alert-dialog": "^1.1.15",
20
- "@radix-ui/react-aspect-ratio": "^1.1.7",
21
- "@radix-ui/react-avatar": "^1.1.10",
22
- "@radix-ui/react-checkbox": "^1.3.3",
23
- "@radix-ui/react-dialog": "^1.1.15",
24
- "@radix-ui/react-dropdown-menu": "^2.1.16",
25
- "@radix-ui/react-hover-card": "^1.1.15",
26
- "@radix-ui/react-icons": "^1.3.0",
27
- "@radix-ui/react-label": "^2.1.7",
28
- "@radix-ui/react-navigation-menu": "^1.2.14",
29
- "@radix-ui/react-popover": "^1.1.15",
30
- "@radix-ui/react-progress": "^1.1.7",
31
- "@radix-ui/react-radio-group": "^1.3.8",
32
- "@radix-ui/react-scroll-area": "^1.2.10",
33
- "@radix-ui/react-select": "^2.2.6",
34
- "@radix-ui/react-separator": "^1.1.7",
35
- "@radix-ui/react-slider": "^1.3.6",
36
- "@radix-ui/react-slot": "^1.2.3",
37
- "@radix-ui/react-switch": "^1.2.6",
38
- "@radix-ui/react-tabs": "^1.1.13",
39
- "@radix-ui/react-toggle": "^1.1.10",
40
- "@radix-ui/react-toggle-group": "^1.1.11",
41
- "@radix-ui/react-tooltip": "^1.2.8",
42
- "@tanstack/react-table": "^8.21.3",
43
- "axios": "^1.13.1",
44
- "class-variance-authority": "^0.7.1",
45
- "clsx": "^2.1.1",
46
- "cmdk": "^1.1.1",
47
- "countries-list": "^3.1.1",
48
- "country-flag-icons": "^1.5.21",
49
- "crypto-js": "^4.2.0",
50
- "date-fns": "^4.1.0",
51
- "echarts": "^6.0.0",
52
- "eslint": "^9",
53
- "framer-motion": "^12.23.22",
54
- "input-otp": "^1.4.2",
55
- "jwt-decode": "^4.0.0",
56
- "lucide-react": "^0.552.0",
57
- "motion": "^12.23.22",
58
- "next": "16.0.0",
59
- "next-themes": "^0.4.6",
60
- "react": "^18.2.0",
61
- "react-big-calendar": "^1.19.4",
62
- "react-cropper": "^2.3.3",
63
- "react-day-picker": "^9.9.0",
64
- "react-dom": "^18.2.0",
65
- "react-hook-form": "^7.64.0",
66
- "shadcn": "^3.5.0",
67
- "sonner": "^2.0.7",
68
- "tailwind-merge": "^3.3.1",
69
- "tailwindcss-animate": "^1.0.7",
70
- "uuid": "^13.0.0",
71
- "vaul": "^1.1.2",
72
- "zxcvbn": "^4.4.2"
73
- },
74
- "devDependencies": {
75
- "@tailwindcss/postcss": "^4",
76
- "@types/crypto-js": "^4.2.2",
77
- "@types/node": "^20",
78
- "@types/react": "^19",
79
- "@types/react-big-calendar": "^1.16.3",
80
- "@types/react-dom": "^19",
81
- "@types/zxcvbn": "^4.4.5",
82
- "autoprefixer": "^10.4.21",
83
- "eslint": "^9",
84
- "eslint-config-next": "16.0.0",
85
- "next": "^14.0.0",
86
- "postcss": "^8.5.6",
87
- "postcss-cli": "^11.0.1",
88
- "postcss-import": "^16.1.1",
89
- "postcss-preset-env": "^10.4.0",
90
- "rimraf": "^6.0.1",
91
- "tailwindcss": "^4",
92
- "tw-animate-css": "^1.4.0",
93
- "typescript": "^5"
94
- },
95
- "peerDependencies": {
96
- "clsx": "^2.1.1",
97
- "next": "16.0.0",
98
- "next-themes": "^0.4.6",
99
- "react": "^18.2.0",
100
- "react-dom": "^18.2.0",
101
- "tailwind-merge": "^3.3.1"
102
- }
103
- }
1
+ {
2
+ "name": "ikoncomponents",
3
+ "version": "1.3.8",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "css": "dist/styles.css",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "npm run build:js && npm run build:css",
12
+ "build:js": "tsc -p tsconfig.json",
13
+ "build:css": "postcss src/styles.css -o dist/styles.css --config postcss.config.mjs --minify",
14
+ "clean": "rimraf dist",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "dependencies": {
18
+ "@radix-ui/react-accordion": "^1.2.12",
19
+ "@radix-ui/react-alert-dialog": "^1.1.15",
20
+ "@radix-ui/react-aspect-ratio": "^1.1.7",
21
+ "@radix-ui/react-avatar": "^1.1.10",
22
+ "@radix-ui/react-checkbox": "^1.3.3",
23
+ "@radix-ui/react-dialog": "^1.1.15",
24
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
25
+ "@radix-ui/react-hover-card": "^1.1.15",
26
+ "@radix-ui/react-icons": "^1.3.0",
27
+ "@radix-ui/react-label": "^2.1.7",
28
+ "@radix-ui/react-navigation-menu": "^1.2.14",
29
+ "@radix-ui/react-popover": "^1.1.15",
30
+ "@radix-ui/react-progress": "^1.1.7",
31
+ "@radix-ui/react-radio-group": "^1.3.8",
32
+ "@radix-ui/react-scroll-area": "^1.2.10",
33
+ "@radix-ui/react-select": "^2.2.6",
34
+ "@radix-ui/react-separator": "^1.1.7",
35
+ "@radix-ui/react-slider": "^1.3.6",
36
+ "@radix-ui/react-slot": "^1.2.3",
37
+ "@radix-ui/react-switch": "^1.2.6",
38
+ "@radix-ui/react-tabs": "^1.1.13",
39
+ "@radix-ui/react-toggle": "^1.1.10",
40
+ "@radix-ui/react-toggle-group": "^1.1.11",
41
+ "@radix-ui/react-tooltip": "^1.2.8",
42
+ "@tanstack/react-table": "^8.21.3",
43
+ "axios": "^1.13.1",
44
+ "class-variance-authority": "^0.7.1",
45
+ "clsx": "^2.1.1",
46
+ "cmdk": "^1.1.1",
47
+ "countries-list": "^3.1.1",
48
+ "country-flag-icons": "^1.5.21",
49
+ "crypto-js": "^4.2.0",
50
+ "date-fns": "^4.1.0",
51
+ "echarts": "^6.0.0",
52
+ "eslint": "^9",
53
+ "framer-motion": "^12.23.22",
54
+ "input-otp": "^1.4.2",
55
+ "jwt-decode": "^4.0.0",
56
+ "lucide-react": "^0.552.0",
57
+ "motion": "^12.23.22",
58
+ "next": "16.0.0",
59
+ "next-themes": "^0.4.6",
60
+ "react": "^18.2.0",
61
+ "react-big-calendar": "^1.19.4",
62
+ "react-cropper": "^2.3.3",
63
+ "react-day-picker": "^9.9.0",
64
+ "react-dom": "^18.2.0",
65
+ "react-hook-form": "^7.64.0",
66
+ "shadcn": "^3.5.0",
67
+ "sonner": "^2.0.7",
68
+ "tailwind-merge": "^3.3.1",
69
+ "tailwindcss-animate": "^1.0.7",
70
+ "uuid": "^13.0.0",
71
+ "vaul": "^1.1.2",
72
+ "zxcvbn": "^4.4.2"
73
+ },
74
+ "devDependencies": {
75
+ "@tailwindcss/postcss": "^4",
76
+ "@types/crypto-js": "^4.2.2",
77
+ "@types/node": "^20",
78
+ "@types/react": "^19",
79
+ "@types/react-big-calendar": "^1.16.3",
80
+ "@types/react-dom": "^19",
81
+ "@types/zxcvbn": "^4.4.5",
82
+ "autoprefixer": "^10.4.21",
83
+ "eslint": "^9",
84
+ "eslint-config-next": "16.0.0",
85
+ "next": "^14.0.0",
86
+ "postcss": "^8.5.6",
87
+ "postcss-cli": "^11.0.1",
88
+ "postcss-import": "^16.1.1",
89
+ "postcss-preset-env": "^10.4.0",
90
+ "rimraf": "^6.0.1",
91
+ "tailwindcss": "^4",
92
+ "tw-animate-css": "^1.4.0",
93
+ "typescript": "^5"
94
+ },
95
+ "peerDependencies": {
96
+ "clsx": "^2.1.1",
97
+ "next": "16.0.0",
98
+ "next-themes": "^0.4.6",
99
+ "react": "^18.2.0",
100
+ "react-dom": "^18.2.0",
101
+ "tailwind-merge": "^3.3.1"
102
+ }
103
+ }