ikoncomponents 1.2.1 → 1.2.2

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.
Files changed (61) hide show
  1. package/dist/ikoncomponents/activity-sheet/index.d.ts +11 -0
  2. package/dist/ikoncomponents/activity-sheet/index.js +23 -0
  3. package/dist/ikoncomponents/big-calendar/big-calender-event/index.d.ts +5 -0
  4. package/dist/ikoncomponents/big-calendar/big-calender-event/index.js +16 -0
  5. package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.d.ts +2 -0
  6. package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.js +39 -0
  7. package/dist/ikoncomponents/big-calendar/index.d.ts +4 -0
  8. package/dist/ikoncomponents/big-calendar/index.js +35 -0
  9. package/dist/ikoncomponents/big-calendar/type.d.ts +31 -0
  10. package/dist/ikoncomponents/big-calendar/type.js +1 -0
  11. package/dist/ikoncomponents/form-fields/combobox-input-value/index.js +1 -0
  12. package/dist/ikoncomponents/image-cropper-upload/components/newCropper.d.ts +15 -0
  13. package/dist/ikoncomponents/image-cropper-upload/components/newCropper.js +85 -0
  14. package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.d.ts +7 -0
  15. package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.js +145 -0
  16. package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.d.ts +6 -0
  17. package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.js +92 -0
  18. package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.d.ts +6 -0
  19. package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.js +14 -0
  20. package/dist/ikoncomponents/image-cropper-upload/image-cropper/index.d.ts +14 -0
  21. package/dist/ikoncomponents/image-cropper-upload/image-cropper/index.js +87 -0
  22. package/dist/ikoncomponents/image-cropper-upload/index.d.ts +27 -0
  23. package/dist/ikoncomponents/image-cropper-upload/index.js +49 -0
  24. package/dist/ikoncomponents/image-cropper-upload/utils/index.d.ts +16 -0
  25. package/dist/ikoncomponents/image-cropper-upload/utils/index.js +73 -0
  26. package/dist/ikoncomponents/main-layout/main-sidebar.d.ts +5 -9
  27. package/dist/ikoncomponents/main-layout/main-sidebar.js +2 -2
  28. package/dist/ikoncomponents/resource-spreadsheet/index.d.ts +21 -21
  29. package/dist/ikoncomponents/resource-spreadsheet/index.js +36 -36
  30. package/dist/index.d.ts +14 -0
  31. package/dist/index.js +8 -0
  32. package/dist/styles.css +95 -0
  33. package/dist/utils/actions/account/index.d.ts +5 -0
  34. package/dist/utils/actions/account/index.js +28 -0
  35. package/dist/utils/actions/account/type.d.ts +4 -0
  36. package/dist/utils/actions/account/type.js +1 -0
  37. package/dist/utils/actions/auth/index.d.ts +7 -0
  38. package/dist/utils/actions/auth/index.js +58 -0
  39. package/dist/utils/actions/common/utils.d.ts +5 -0
  40. package/dist/utils/actions/common/utils.js +25 -0
  41. package/dist/utils/actions/software/index.d.ts +11 -0
  42. package/dist/utils/actions/software/index.js +75 -0
  43. package/dist/utils/api/accountService/index.d.ts +23 -0
  44. package/dist/utils/api/accountService/index.js +64 -0
  45. package/dist/utils/api/accountService/type.d.ts +4 -0
  46. package/dist/utils/api/accountService/type.js +1 -0
  47. package/dist/utils/api/file-upload/index.d.ts +5 -0
  48. package/dist/utils/api/file-upload/index.js +80 -0
  49. package/dist/utils/api/file-upload/type.d.ts +6 -0
  50. package/dist/utils/api/file-upload/type.js +1 -0
  51. package/dist/utils/api/ikonBaseApi.d.ts +12 -0
  52. package/dist/utils/api/ikonBaseApi.js +104 -0
  53. package/dist/utils/api/loginService/index.d.ts +12 -0
  54. package/dist/utils/api/loginService/index.js +72 -0
  55. package/dist/utils/api/loginService/type.d.ts +31 -0
  56. package/dist/utils/api/loginService/type.js +1 -0
  57. package/dist/utils/api/softwareService/index.d.ts +64 -0
  58. package/dist/utils/api/softwareService/index.js +212 -0
  59. package/dist/utils/api/softwareService/type.d.ts +54 -0
  60. package/dist/utils/api/softwareService/type.js +1 -0
  61. package/package.json +6 -2
package/dist/styles.css CHANGED
@@ -8,6 +8,8 @@
8
8
  --color-blue-400: oklch(70.7% 0.165 254.624);
9
9
  --color-blue-500: oklch(62.3% 0.214 259.815);
10
10
  --color-blue-600: oklch(54.6% 0.245 262.881);
11
+ --color-slate-400: oklch(70.4% 0.04 256.788);
12
+ --color-gray-100: oklch(96.7% 0.003 264.542);
11
13
  --color-gray-300: oklch(87.2% 0.01 258.338);
12
14
  --color-gray-400: oklch(70.7% 0.022 261.325);
13
15
  --color-gray-500: oklch(55.1% 0.027 264.364);
@@ -28,6 +30,7 @@
28
30
  --container-md: 28rem;
29
31
  --container-lg: 32rem;
30
32
  --container-3xl: 48rem;
33
+ --container-5xl: 64rem;
31
34
  --text-xs: 0.75rem;
32
35
  --text-xs--line-height: calc(1 / 0.75);
33
36
  --text-sm: 0.875rem;
@@ -413,6 +416,9 @@
413
416
  .mb-2 {
414
417
  margin-bottom: calc(var(--spacing) * 2);
415
418
  }
419
+ .mb-3 {
420
+ margin-bottom: calc(var(--spacing) * 3);
421
+ }
416
422
  .mb-4 {
417
423
  margin-bottom: calc(var(--spacing) * 4);
418
424
  }
@@ -578,6 +584,15 @@
578
584
  .h-\[1\.15rem\] {
579
585
  height: 1.15rem;
580
586
  }
587
+ .h-\[120px\] {
588
+ height: 120px;
589
+ }
590
+ .h-\[200px\] {
591
+ height: 200px;
592
+ }
593
+ .h-\[220px\] {
594
+ height: 220px;
595
+ }
581
596
  .h-\[calc\(100\%-1px\)\] {
582
597
  height: calc(100% - 1px);
583
598
  }
@@ -620,6 +635,9 @@
620
635
  .max-h-\[400px\] {
621
636
  max-height: 400px;
622
637
  }
638
+ .max-h-full {
639
+ max-height: 100%;
640
+ }
623
641
  .min-h-0 {
624
642
  min-height: calc(var(--spacing) * 0);
625
643
  }
@@ -647,24 +665,42 @@
647
665
  .w-0\.5 {
648
666
  width: calc(var(--spacing) * 0.5);
649
667
  }
668
+ .w-1\/2 {
669
+ width: calc(1/2 * 100%);
670
+ }
671
+ .w-1\/3 {
672
+ width: calc(1/3 * 100%);
673
+ }
650
674
  .w-2 {
651
675
  width: calc(var(--spacing) * 2);
652
676
  }
653
677
  .w-2\.5 {
654
678
  width: calc(var(--spacing) * 2.5);
655
679
  }
680
+ .w-2\/5 {
681
+ width: calc(2/5 * 100%);
682
+ }
656
683
  .w-3 {
657
684
  width: calc(var(--spacing) * 3);
658
685
  }
659
686
  .w-3\/4 {
660
687
  width: calc(3/4 * 100%);
661
688
  }
689
+ .w-3\/5 {
690
+ width: calc(3/5 * 100%);
691
+ }
662
692
  .w-4 {
663
693
  width: calc(var(--spacing) * 4);
664
694
  }
695
+ .w-4\/5 {
696
+ width: calc(4/5 * 100%);
697
+ }
665
698
  .w-5 {
666
699
  width: calc(var(--spacing) * 5);
667
700
  }
701
+ .w-5\/5 {
702
+ width: calc(5/5 * 100%);
703
+ }
668
704
  .w-6 {
669
705
  width: calc(var(--spacing) * 6);
670
706
  }
@@ -949,6 +985,9 @@
949
985
  .flex-row {
950
986
  flex-direction: row;
951
987
  }
988
+ .flex-row-reverse {
989
+ flex-direction: row-reverse;
990
+ }
952
991
  .flex-wrap {
953
992
  flex-wrap: wrap;
954
993
  }
@@ -1038,6 +1077,9 @@
1038
1077
  .gap-y-0\.5 {
1039
1078
  row-gap: calc(var(--spacing) * 0.5);
1040
1079
  }
1080
+ .self-end {
1081
+ align-self: flex-end;
1082
+ }
1041
1083
  .self-start {
1042
1084
  align-self: flex-start;
1043
1085
  }
@@ -1140,6 +1182,10 @@
1140
1182
  border-style: var(--tw-border-style) !important;
1141
1183
  border-width: 2px !important;
1142
1184
  }
1185
+ .border-x-0 {
1186
+ border-inline-style: var(--tw-border-style);
1187
+ border-inline-width: 0px;
1188
+ }
1143
1189
  .border-y {
1144
1190
  border-block-style: var(--tw-border-style);
1145
1191
  border-block-width: 1px;
@@ -1148,6 +1194,10 @@
1148
1194
  border-inline-start-style: var(--tw-border-style);
1149
1195
  border-inline-start-width: 0px;
1150
1196
  }
1197
+ .border-e-0 {
1198
+ border-inline-end-style: var(--tw-border-style);
1199
+ border-inline-end-width: 0px;
1200
+ }
1151
1201
  .border-t {
1152
1202
  border-top-style: var(--tw-border-style);
1153
1203
  border-top-width: 1px;
@@ -1195,6 +1245,9 @@
1195
1245
  .border-border {
1196
1246
  border-color: var(--border);
1197
1247
  }
1248
+ .border-gray-400 {
1249
+ border-color: var(--color-gray-400);
1250
+ }
1198
1251
  .border-input {
1199
1252
  border-color: var(--input);
1200
1253
  }
@@ -1300,6 +1353,9 @@
1300
1353
  .bg-foreground {
1301
1354
  background-color: var(--foreground);
1302
1355
  }
1356
+ .bg-gray-100 {
1357
+ background-color: var(--color-gray-100);
1358
+ }
1303
1359
  .bg-gray-300 {
1304
1360
  background-color: var(--color-gray-300);
1305
1361
  }
@@ -1333,6 +1389,9 @@
1333
1389
  .bg-sidebar-border {
1334
1390
  background-color: var(--sidebar-border);
1335
1391
  }
1392
+ .bg-slate-400 {
1393
+ background-color: var(--color-slate-400);
1394
+ }
1336
1395
  .bg-transparent {
1337
1396
  background-color: transparent;
1338
1397
  }
@@ -1459,6 +1518,12 @@
1459
1518
  .pr-8 {
1460
1519
  padding-right: calc(var(--spacing) * 8);
1461
1520
  }
1521
+ .pr-10 {
1522
+ padding-right: calc(var(--spacing) * 10);
1523
+ }
1524
+ .pb-1 {
1525
+ padding-bottom: calc(var(--spacing) * 1);
1526
+ }
1462
1527
  .pb-2 {
1463
1528
  padding-bottom: calc(var(--spacing) * 2);
1464
1529
  }
@@ -1624,6 +1689,9 @@
1624
1689
  .text-gray-600 {
1625
1690
  color: var(--color-gray-600);
1626
1691
  }
1692
+ .text-gray-700 {
1693
+ color: var(--color-gray-700);
1694
+ }
1627
1695
  .text-input {
1628
1696
  color: var(--input);
1629
1697
  }
@@ -2509,6 +2577,13 @@
2509
2577
  }
2510
2578
  }
2511
2579
  }
2580
+ .hover\:bg-transparent\! {
2581
+ &:hover {
2582
+ @media (hover: hover) {
2583
+ background-color: transparent !important;
2584
+ }
2585
+ }
2586
+ }
2512
2587
  .hover\:text-accent-foreground {
2513
2588
  &:hover {
2514
2589
  @media (hover: hover) {
@@ -3942,6 +4017,26 @@
3942
4017
  display: none;
3943
4018
  }
3944
4019
  }
4020
+ .lg\:w-48 {
4021
+ @media (width >= 64rem) {
4022
+ width: calc(var(--spacing) * 48);
4023
+ }
4024
+ }
4025
+ .lg\:max-w-5xl {
4026
+ @media (width >= 64rem) {
4027
+ max-width: var(--container-5xl);
4028
+ }
4029
+ }
4030
+ .lg\:flex-col {
4031
+ @media (width >= 64rem) {
4032
+ flex-direction: column;
4033
+ }
4034
+ }
4035
+ .lg\:flex-row {
4036
+ @media (width >= 64rem) {
4037
+ flex-direction: row;
4038
+ }
4039
+ }
3945
4040
  .lg\:justify-start {
3946
4041
  @media (width >= 64rem) {
3947
4042
  justify-content: flex-start;
@@ -0,0 +1,5 @@
1
+ import { AccountTreeProps } from "./type";
2
+ export declare const getAccount: () => Promise<AccountTreeProps>;
3
+ export declare const getActiveAccountId: () => Promise<string>;
4
+ export declare const getOrSetActiveAccountId: () => Promise<string>;
5
+ export declare const setActiveAccountId: (accountId: string) => Promise<void>;
@@ -0,0 +1,28 @@
1
+ "use server";
2
+ import { cache } from "react";
3
+ import { getAccountTree } from "../../api/accountService";
4
+ import { getCookieSession, setCookieSession } from "../../session/cookieSession";
5
+ export const getAccount = cache(async () => {
6
+ return await getAccountTree();
7
+ });
8
+ export const getActiveAccountId = async () => {
9
+ const activeAccountId = await getCookieSession("activeAccountId");
10
+ return activeAccountId || "";
11
+ };
12
+ export const getOrSetActiveAccountId = async () => {
13
+ let activeAccountId = await getCookieSession("activeAccountId");
14
+ if (!activeAccountId) {
15
+ try {
16
+ const account = await getAccount();
17
+ activeAccountId = account.ACCOUNT_ID;
18
+ await setActiveAccountId(activeAccountId);
19
+ }
20
+ catch (error) {
21
+ console.error(error);
22
+ }
23
+ }
24
+ return activeAccountId || "";
25
+ };
26
+ export const setActiveAccountId = async (accountId) => {
27
+ await setCookieSession("activeAccountId", accountId);
28
+ };
@@ -0,0 +1,4 @@
1
+ export interface AccountTreeProps {
2
+ ACCOUNT_ID: string;
3
+ ACCOUNT_NAME: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { GetLoggedInUserProfileDetailsReturnProps, GetLoggedInUserProfileReturnProps } from "../../api/loginService/type";
2
+ export declare const setTicket: (ticket: string) => Promise<void>;
3
+ export declare const getTicket: () => Promise<string | undefined>;
4
+ export declare const getProfileData: () => Promise<GetLoggedInUserProfileReturnProps & GetLoggedInUserProfileDetailsReturnProps>;
5
+ export declare function signOut(): Promise<void>;
6
+ export declare const getCurrentUserId: () => Promise<string>;
7
+ export declare const setCurrentUserId: (userId: string) => Promise<void>;
@@ -0,0 +1,58 @@
1
+ "use server";
2
+ import { redirect } from "next/navigation";
3
+ import { logout } from "../../api/loginService";
4
+ import { clearAllCookieSession, getCookieSession, setCookieSession } from "../../session/cookieSession";
5
+ import { cookies } from "next/headers";
6
+ export const setTicket = async (ticket) => {
7
+ await setCookieSession("ticket", ticket);
8
+ };
9
+ export const getTicket = async () => {
10
+ return await getCookieSession("ticket");
11
+ };
12
+ export const getProfileData = async () => {
13
+ const cookieStore = await cookies();
14
+ const cookieHeader = cookieStore.getAll()
15
+ .map(({ name, value }) => `${name}=${value}`)
16
+ .join("; "); // Convert to a valid Cookie header string
17
+ // Fetch API with cookies
18
+ const resp = await fetch(`${process.env.NEXT_BASE_PATH_URL}/api/profile`, {
19
+ method: "GET",
20
+ headers: {
21
+ "Content-Type": "application/json",
22
+ "Accept": "application/json",
23
+ "Cookie": cookieHeader, // ✅ Send all cookies
24
+ },
25
+ cache: "force-cache",
26
+ });
27
+ return resp.json();
28
+ // let data1: GetLoggedInUserProfileReturnProps = {} as GetLoggedInUserProfileReturnProps;
29
+ // try {
30
+ // data1 = await getLoggedInUserProfile();
31
+ // } catch (error) {
32
+ // console.error(error)
33
+ // }
34
+ // let data2: GetLoggedInUserProfileDetailsReturnProps = {} as GetLoggedInUserProfileDetailsReturnProps;
35
+ // try {
36
+ // data2 = await getLoggedInUserProfileDetails();
37
+ // } catch (error) {
38
+ // console.error(error)
39
+ // }
40
+ // return { ...data1, ...data2 };
41
+ };
42
+ export async function signOut() {
43
+ try {
44
+ await logout();
45
+ }
46
+ catch (error) {
47
+ console.error(error);
48
+ }
49
+ await clearAllCookieSession();
50
+ redirect("/login");
51
+ }
52
+ export const getCurrentUserId = async () => {
53
+ const currentUserId = await getCookieSession("currentUserId");
54
+ return currentUserId || "";
55
+ };
56
+ export const setCurrentUserId = async (userId) => {
57
+ await setCookieSession("currentUserId", userId);
58
+ };
@@ -0,0 +1,5 @@
1
+ import { FileinfoProps } from "../../api/file-upload/type";
2
+ export declare function getSrcFromBase64String(imgString?: string | null, type?: string): string;
3
+ export declare function getResourceUrl(fileInfo: FileinfoProps): Promise<string>;
4
+ export declare function downloadResource(fileInfo: FileinfoProps): Promise<void>;
5
+ export declare function openFileInNewTab(url: string): Promise<void>;
@@ -0,0 +1,25 @@
1
+ import { getTicket } from "../auth";
2
+ export function getSrcFromBase64String(imgString, type) {
3
+ return imgString ? `data:${type || "image/webp"};base64,${imgString}` : "";
4
+ }
5
+ export async function getResourceUrl(fileInfo) {
6
+ const globalTicket = await getTicket();
7
+ return "https://ikoncloud-dev.keross.com/ikon-api/download" + "?ticket=" + globalTicket + "&resourceId=" + fileInfo.resourceId + "&resourceName=" + fileInfo.resourceName + "&resourceType=" + fileInfo.resourceType;
8
+ }
9
+ export async function downloadResource(fileInfo) {
10
+ const resourceUrl = await getResourceUrl(fileInfo);
11
+ window.open(encodeURI(resourceUrl));
12
+ }
13
+ export async function openFileInNewTab(url) {
14
+ const encodedLink = encodeURI(url);
15
+ try {
16
+ const response = await fetch(encodedLink);
17
+ const blob = await response.blob();
18
+ const blobUrl = URL.createObjectURL(blob);
19
+ window.open(blobUrl, '_blank');
20
+ }
21
+ catch (err) {
22
+ console.error('Failed to open file in new tab:', err);
23
+ }
24
+ }
25
+ ;
@@ -0,0 +1,11 @@
1
+ import { SubscribeSoftwareProps } from "../../api/softwareService/type";
2
+ export declare const getBaseSoftwareId: () => Promise<string | undefined>;
3
+ export declare const getOrSetBaseSoftwareId: () => Promise<string | undefined>;
4
+ export declare const setBaseSoftwareId: (softwareId: string) => Promise<void>;
5
+ export declare const getCurrentSoftwareId: () => Promise<string>;
6
+ export declare const getCurrentAppName: () => Promise<string>;
7
+ export declare const setCurrentSoftwareId: (softwareId: string) => Promise<void>;
8
+ export declare const getSoftwareIdByNameVersion: (softwareName: string, version: string) => Promise<string>;
9
+ export declare const setCurrentSoftwareIdByNameVersion: (softwareName: string, version: string) => Promise<void>;
10
+ export declare const getAccessibleSoftware: (accountId: string, userId: string) => Promise<any>;
11
+ export declare const getAllSubscribedSoftwares: (accountId?: string) => Promise<SubscribeSoftwareProps[]>;
@@ -0,0 +1,75 @@
1
+ "use server";
2
+ import { cache } from "react";
3
+ import { getAccessibleSoftwareForUser, mapSoftwareName, } from "../../api/softwareService";
4
+ import { getCookieSession, setCookieSession, } from "../../session/cookieSession";
5
+ import { cookies } from "next/headers";
6
+ export const getBaseSoftwareId = async () => {
7
+ return await getCookieSession("baseSoftwareId");
8
+ };
9
+ export const getOrSetBaseSoftwareId = async () => {
10
+ let baseSoftwareId = await getCookieSession("baseSoftwareId");
11
+ if (!baseSoftwareId) {
12
+ try {
13
+ baseSoftwareId = await getSoftwareIdByNameVersion("Base App", "1");
14
+ await setBaseSoftwareId(baseSoftwareId);
15
+ }
16
+ catch (error) {
17
+ console.error(error);
18
+ }
19
+ }
20
+ return baseSoftwareId;
21
+ };
22
+ export const setBaseSoftwareId = async (softwareId) => {
23
+ await setCookieSession("baseSoftwareId", softwareId);
24
+ };
25
+ export const getCurrentSoftwareId = async () => {
26
+ return (await getCookieSession("currentSoftwareId")) || "";
27
+ };
28
+ export const getCurrentAppName = async () => {
29
+ return (await getCookieSession("currentAppName")) || "";
30
+ };
31
+ export const setCurrentSoftwareId = async (softwareId) => {
32
+ await setCookieSession("currentSoftwareId", softwareId);
33
+ };
34
+ export const getSoftwareIdByNameVersion = cache(async (softwareName, version) => {
35
+ return await mapSoftwareName({ softwareName, version });
36
+ });
37
+ export const setCurrentSoftwareIdByNameVersion = async (softwareName, version) => {
38
+ const softwareId = await getSoftwareIdByNameVersion(softwareName, version);
39
+ await setCurrentSoftwareId(softwareId);
40
+ };
41
+ export const getAccessibleSoftware = cache(async (accountId, userId) => {
42
+ return await getAccessibleSoftwareForUser({ accountId, userId });
43
+ });
44
+ // export const getAllSubscribedSoftwares = cache(async (accountId: string) => {
45
+ // return await getAllSubscribedSoftwaresForClient({ accountId });
46
+ // });
47
+ export const getAllSubscribedSoftwares = async (accountId) => {
48
+ try {
49
+ const cookieStore = await cookies();
50
+ const cookieHeader = cookieStore
51
+ .getAll()
52
+ .map(({ name, value }) => `${name}=${value}`)
53
+ .join("; "); // Convert to a valid Cookie header string
54
+ // Fetch API with cookies
55
+ const resp = await fetch(`${process.env.NEXT_BASE_PATH_URL}/api/software/subscribe`, {
56
+ method: "GET",
57
+ headers: {
58
+ "Content-Type": "application/json",
59
+ Accept: "application/json",
60
+ Cookie: cookieHeader, // ✅ Send all cookies
61
+ body: JSON.stringify({
62
+ accountId,
63
+ }),
64
+ },
65
+ cache: "force-cache",
66
+ });
67
+ if (!resp.ok)
68
+ throw new Error("Failed to fetch subscribe softwares");
69
+ return resp.json();
70
+ }
71
+ catch (error) {
72
+ console.error(error);
73
+ return [];
74
+ }
75
+ };
@@ -0,0 +1,23 @@
1
+ import { GetAccountTreeProps } from "./type";
2
+ export declare const getAccountTree: () => Promise<GetAccountTreeProps>;
3
+ export declare const checkExistingAccount: ({ accountName, }: {
4
+ accountName: string;
5
+ }) => Promise<boolean>;
6
+ export declare const getFullAccountTree: () => Promise<any>;
7
+ export declare const getAllInvitedAccountsForUser: (userId: string) => Promise<any>;
8
+ export declare const acceptAccountInvitationRequest: ({ userId, requestId, }: {
9
+ userId: string;
10
+ requestId: string;
11
+ }) => Promise<any>;
12
+ export declare const rejectAccountInvitationRequest: ({ userId, requestId, }: {
13
+ userId: string;
14
+ requestId: string;
15
+ }) => Promise<any>;
16
+ export declare const cancelAccountInvitationRequest: ({ userId, requestId, }: {
17
+ userId: string;
18
+ requestId: string;
19
+ }) => Promise<any>;
20
+ export declare const deactivateInvitedUserFromAccount: ({ userId, invitationId, }: {
21
+ userId: string;
22
+ invitationId: string;
23
+ }) => Promise<any>;
@@ -0,0 +1,64 @@
1
+ "use server";
2
+ import ikonBaseApi from "../ikonBaseApi";
3
+ export const getAccountTree = async () => {
4
+ const result = await ikonBaseApi({
5
+ service: "accountService",
6
+ operation: "getAccountTree",
7
+ });
8
+ return result.data;
9
+ };
10
+ export const checkExistingAccount = async ({ accountName, }) => {
11
+ const result = await ikonBaseApi({
12
+ service: "accountService",
13
+ operation: "checkExistingAccount",
14
+ arguments_: [accountName],
15
+ });
16
+ return result.data;
17
+ };
18
+ export const getFullAccountTree = async () => {
19
+ const result = await ikonBaseApi({
20
+ service: "accountService",
21
+ operation: "getFullAccountTree",
22
+ });
23
+ return result.data;
24
+ };
25
+ export const getAllInvitedAccountsForUser = async (userId) => {
26
+ const result = await ikonBaseApi({
27
+ service: "userInvitationService",
28
+ operation: "getAllInvitedAccountsForUser",
29
+ arguments_: [userId],
30
+ });
31
+ return result.data;
32
+ };
33
+ export const acceptAccountInvitationRequest = async ({ userId, requestId, }) => {
34
+ const result = await ikonBaseApi({
35
+ service: "userInvitationService",
36
+ operation: "acceptAccountInvitationRequest",
37
+ arguments_: [userId, requestId],
38
+ });
39
+ return result.data;
40
+ };
41
+ export const rejectAccountInvitationRequest = async ({ userId, requestId, }) => {
42
+ const result = await ikonBaseApi({
43
+ service: "userInvitationService",
44
+ operation: "rejectAccountInvitationRequest",
45
+ arguments_: [userId, requestId],
46
+ });
47
+ return result.data;
48
+ };
49
+ export const cancelAccountInvitationRequest = async ({ userId, requestId, }) => {
50
+ const result = await ikonBaseApi({
51
+ service: "userInvitationService",
52
+ operation: "cancelAccountInvitationRequest",
53
+ arguments_: [userId, requestId],
54
+ });
55
+ return result.data;
56
+ };
57
+ export const deactivateInvitedUserFromAccount = async ({ userId, invitationId, }) => {
58
+ const result = await ikonBaseApi({
59
+ service: "userInvitationService",
60
+ operation: "deactivateInvitedUserFromAccount",
61
+ arguments_: [userId, invitationId],
62
+ });
63
+ return result.data;
64
+ };
@@ -0,0 +1,4 @@
1
+ export interface GetAccountTreeProps {
2
+ ACCOUNT_ID: string;
3
+ ACCOUNT_NAME: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { FileinfoProps } from "./type";
2
+ export declare function singleFileUpload(file: File, resourceId?: string): Promise<FileinfoProps>;
3
+ export declare function multipleFileUpload(files: File[], resourceId?: string): Promise<FileinfoProps[]>;
4
+ export declare function base64FileUpload(base64File: string, resourceName: string, resourceType: string, resourceId?: string): Promise<FileinfoProps>;
5
+ export declare function singleUAResourceUpload(file: File, folder: string): Promise<any>;
@@ -0,0 +1,80 @@
1
+ "use server";
2
+ import { axiosInstance } from "../ikonBaseApi";
3
+ import { v4 } from "uuid";
4
+ import { getTicket } from "../../actions/auth";
5
+ export async function singleFileUpload(file, resourceId) {
6
+ const formData = new FormData();
7
+ formData.append("file", file);
8
+ const fileInfo = {};
9
+ fileInfo["resourceId"] = resourceId || v4();
10
+ fileInfo["resourceName"] = file.name;
11
+ fileInfo["resourceSize"] = file.size;
12
+ fileInfo["resourceType"] = file.type;
13
+ const globalTicket = (await getTicket()) || "";
14
+ const queryParams = new URLSearchParams({
15
+ ticket: globalTicket,
16
+ resourceId: fileInfo["resourceId"],
17
+ });
18
+ try {
19
+ const result = await axiosInstance({
20
+ method: "POST",
21
+ url: `https://ikoncloud-dev.keross.com/ikon-api/upload?${queryParams.toString()}`,
22
+ data: formData,
23
+ responseType: "json",
24
+ headers: { "Content-Type": "multipart/form-data" },
25
+ });
26
+ console.log("File upload result:", result);
27
+ }
28
+ catch (error) {
29
+ throw error;
30
+ }
31
+ return fileInfo;
32
+ }
33
+ export async function multipleFileUpload(files, resourceId) {
34
+ const fileInfos = [];
35
+ for (const file of files) {
36
+ const fileInfo = await singleFileUpload(file, resourceId);
37
+ fileInfos.push(fileInfo);
38
+ }
39
+ return fileInfos;
40
+ }
41
+ export async function base64FileUpload(base64File, resourceName, resourceType, resourceId) {
42
+ const base64 = base64File.split(",")[1];
43
+ const byteCharacters = atob(base64);
44
+ const byteNumbers = new Array(byteCharacters.length);
45
+ for (let i = 0; i < byteCharacters.length; i++) {
46
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
47
+ }
48
+ const byteArray = new Uint8Array(byteNumbers);
49
+ const blob = new Blob([byteArray], { type: resourceType });
50
+ const file = new File([blob], resourceName, { type: resourceType });
51
+ return await singleFileUpload(file, resourceId);
52
+ }
53
+ export async function singleUAResourceUpload(file, folder) {
54
+ const formData = new FormData();
55
+ formData.append("file", file);
56
+ const fileInfo = {};
57
+ fileInfo["folder"] = folder || "ikon";
58
+ fileInfo["resourceName"] = file.name;
59
+ fileInfo["resourceSize"] = file.size;
60
+ fileInfo["resourceType"] = file.type;
61
+ const globalTicket = (await getTicket()) || "";
62
+ const queryParams = new URLSearchParams({
63
+ ticket: globalTicket,
64
+ folder: fileInfo["folder"],
65
+ });
66
+ try {
67
+ const result = await axiosInstance({
68
+ method: "POST",
69
+ url: `https://ikoncloud-dev.keross.com/ikon-api//uaresourceupload?${queryParams.toString()}`,
70
+ data: formData,
71
+ responseType: "json",
72
+ headers: { "Content-Type": "multipart/form-data" },
73
+ });
74
+ console.log("File upload result:", result);
75
+ }
76
+ catch (error) {
77
+ throw error;
78
+ }
79
+ return fileInfo;
80
+ }
@@ -0,0 +1,6 @@
1
+ export interface FileinfoProps {
2
+ resourceId: string;
3
+ resourceName?: string;
4
+ resourceSize?: number;
5
+ resourceType?: string;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ interface IkonBaseApiProps {
2
+ service: string;
3
+ operation: string;
4
+ arguments_?: any | null;
5
+ accountId?: string | null;
6
+ softwareId?: string | null;
7
+ isTicketRequried?: boolean;
8
+ isServerApi?: boolean;
9
+ }
10
+ export declare const axiosInstance: import("axios").AxiosInstance;
11
+ declare function ikonBaseApi({ service, operation, arguments_, accountId, softwareId, isTicketRequried, isServerApi }: IkonBaseApiProps): Promise<any>;
12
+ export default ikonBaseApi;