jett.admin.npmpackage 2.0.18 → 2.0.19
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.css +32 -39
- package/dist/index.js +42 -18
- package/dist/index.mjs +58 -33
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
monospace;
|
|
24
24
|
--color-red-50: oklch(97.1% 0.013 17.38);
|
|
25
25
|
--color-red-100: oklch(93.6% 0.032 17.717);
|
|
26
|
+
--color-red-200: oklch(88.5% 0.062 18.334);
|
|
26
27
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
|
27
28
|
--color-red-600: oklch(57.7% 0.245 27.325);
|
|
28
29
|
--color-red-700: oklch(50.5% 0.213 27.518);
|
|
29
30
|
--color-red-800: oklch(44.4% 0.177 26.899);
|
|
30
31
|
--color-red-900: oklch(39.6% 0.141 25.723);
|
|
32
|
+
--color-red-950: oklch(25.8% 0.092 26.042);
|
|
31
33
|
--color-yellow-100: oklch(97.3% 0.071 103.193);
|
|
32
34
|
--color-yellow-800: oklch(47.6% 0.114 61.907);
|
|
33
35
|
--color-yellow-900: oklch(42.1% 0.095 57.708);
|
|
@@ -35,7 +37,6 @@
|
|
|
35
37
|
--color-green-800: oklch(44.8% 0.119 151.328);
|
|
36
38
|
--color-green-900: oklch(39.3% 0.095 152.535);
|
|
37
39
|
--color-blue-50: oklch(97% 0.014 254.604);
|
|
38
|
-
--color-blue-400: oklch(70.7% 0.165 254.624);
|
|
39
40
|
--color-blue-600: oklch(54.6% 0.245 262.881);
|
|
40
41
|
--color-blue-950: oklch(28.2% 0.091 267.935);
|
|
41
42
|
--color-gray-50: oklch(98.5% 0.002 247.839);
|
|
@@ -357,6 +358,9 @@
|
|
|
357
358
|
.mb-2 {
|
|
358
359
|
margin-bottom: calc(var(--spacing) * 2);
|
|
359
360
|
}
|
|
361
|
+
.mb-3 {
|
|
362
|
+
margin-bottom: calc(var(--spacing) * 3);
|
|
363
|
+
}
|
|
360
364
|
.mb-4 {
|
|
361
365
|
margin-bottom: calc(var(--spacing) * 4);
|
|
362
366
|
}
|
|
@@ -492,9 +496,6 @@
|
|
|
492
496
|
.w-\[360px\] {
|
|
493
497
|
width: 360px;
|
|
494
498
|
}
|
|
495
|
-
.w-\[370px\] {
|
|
496
|
-
width: 370px;
|
|
497
|
-
}
|
|
498
499
|
.w-full {
|
|
499
500
|
width: 100%;
|
|
500
501
|
}
|
|
@@ -692,12 +693,18 @@
|
|
|
692
693
|
.border-primary {
|
|
693
694
|
border-color: var(--color-primary);
|
|
694
695
|
}
|
|
696
|
+
.border-red-200 {
|
|
697
|
+
border-color: var(--color-red-200);
|
|
698
|
+
}
|
|
695
699
|
.border-red-500 {
|
|
696
700
|
border-color: var(--color-red-500);
|
|
697
701
|
}
|
|
698
702
|
.border-transparent {
|
|
699
703
|
border-color: transparent;
|
|
700
704
|
}
|
|
705
|
+
.border-white {
|
|
706
|
+
border-color: var(--color-white);
|
|
707
|
+
}
|
|
701
708
|
.bg-\[\#F7FAFC\] {
|
|
702
709
|
background-color: #F7FAFC;
|
|
703
710
|
}
|
|
@@ -815,18 +822,12 @@
|
|
|
815
822
|
.py-3 {
|
|
816
823
|
padding-block: calc(var(--spacing) * 3);
|
|
817
824
|
}
|
|
818
|
-
.pt-3 {
|
|
819
|
-
padding-top: calc(var(--spacing) * 3);
|
|
820
|
-
}
|
|
821
825
|
.pt-5 {
|
|
822
826
|
padding-top: calc(var(--spacing) * 5);
|
|
823
827
|
}
|
|
824
828
|
.pt-20 {
|
|
825
829
|
padding-top: calc(var(--spacing) * 20);
|
|
826
830
|
}
|
|
827
|
-
.pb-2 {
|
|
828
|
-
padding-bottom: calc(var(--spacing) * 2);
|
|
829
|
-
}
|
|
830
831
|
.pb-4 {
|
|
831
832
|
padding-bottom: calc(var(--spacing) * 4);
|
|
832
833
|
}
|
|
@@ -858,8 +859,8 @@
|
|
|
858
859
|
font-size: var(--text-xs);
|
|
859
860
|
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
860
861
|
}
|
|
861
|
-
.\!text-\[
|
|
862
|
-
font-size:
|
|
862
|
+
.\!text-\[10px\] {
|
|
863
|
+
font-size: 10px !important;
|
|
863
864
|
}
|
|
864
865
|
.\!text-\[14px\] {
|
|
865
866
|
font-size: 14px !important;
|
|
@@ -873,6 +874,9 @@
|
|
|
873
874
|
.\!text-\[22px\] {
|
|
874
875
|
font-size: 22px !important;
|
|
875
876
|
}
|
|
877
|
+
.text-\[9px\] {
|
|
878
|
+
font-size: 9px;
|
|
879
|
+
}
|
|
876
880
|
.text-\[10px\] {
|
|
877
881
|
font-size: 10px;
|
|
878
882
|
}
|
|
@@ -952,6 +956,9 @@
|
|
|
952
956
|
.\!text-\[\#3f3f46cc\] {
|
|
953
957
|
color: #3f3f46cc !important;
|
|
954
958
|
}
|
|
959
|
+
.text-\[\#0A0A0A\] {
|
|
960
|
+
color: #0A0A0A;
|
|
961
|
+
}
|
|
955
962
|
.text-\[\#3f3f46cc\] {
|
|
956
963
|
color: #3f3f46cc;
|
|
957
964
|
}
|
|
@@ -1003,9 +1010,6 @@
|
|
|
1003
1010
|
.uppercase {
|
|
1004
1011
|
text-transform: uppercase;
|
|
1005
1012
|
}
|
|
1006
|
-
.opacity-0 {
|
|
1007
|
-
opacity: 0%;
|
|
1008
|
-
}
|
|
1009
1013
|
.opacity-50 {
|
|
1010
1014
|
opacity: 50%;
|
|
1011
1015
|
}
|
|
@@ -1111,11 +1115,6 @@
|
|
|
1111
1115
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
1112
1116
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
1113
1117
|
}
|
|
1114
|
-
.transition-opacity {
|
|
1115
|
-
transition-property: opacity;
|
|
1116
|
-
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
1117
|
-
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
1118
|
-
}
|
|
1119
1118
|
.transition-transform {
|
|
1120
1119
|
transition-property:
|
|
1121
1120
|
transform,
|
|
@@ -1147,13 +1146,6 @@
|
|
|
1147
1146
|
-webkit-user-select: none;
|
|
1148
1147
|
user-select: none;
|
|
1149
1148
|
}
|
|
1150
|
-
.group-hover\:opacity-100 {
|
|
1151
|
-
&:is(:where(.group):hover *) {
|
|
1152
|
-
@media (hover: hover) {
|
|
1153
|
-
opacity: 100%;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
1149
|
.peer-checked\:border-primary {
|
|
1158
1150
|
&:is(:where(.peer):checked ~ *) {
|
|
1159
1151
|
border-color: var(--color-primary);
|
|
@@ -1236,13 +1228,6 @@
|
|
|
1236
1228
|
}
|
|
1237
1229
|
}
|
|
1238
1230
|
}
|
|
1239
|
-
.hover\:underline {
|
|
1240
|
-
&:hover {
|
|
1241
|
-
@media (hover: hover) {
|
|
1242
|
-
text-decoration-line: underline;
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
1231
|
.focus\:border-black {
|
|
1247
1232
|
&:focus {
|
|
1248
1233
|
border-color: var(--color-black);
|
|
@@ -1371,6 +1356,11 @@
|
|
|
1371
1356
|
border-color: #303036;
|
|
1372
1357
|
}
|
|
1373
1358
|
}
|
|
1359
|
+
.dark\:border-red-900 {
|
|
1360
|
+
&:where(.dark, .dark *) {
|
|
1361
|
+
border-color: var(--color-red-900);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1374
1364
|
.dark\:border-white {
|
|
1375
1365
|
&:where(.dark, .dark *) {
|
|
1376
1366
|
border-color: var(--color-white);
|
|
@@ -1429,6 +1419,14 @@
|
|
|
1429
1419
|
background-color: var(--color-red-900);
|
|
1430
1420
|
}
|
|
1431
1421
|
}
|
|
1422
|
+
.dark\:bg-red-950\/40 {
|
|
1423
|
+
&:where(.dark, .dark *) {
|
|
1424
|
+
background-color: color-mix(in srgb, oklch(25.8% 0.092 26.042) 40%, transparent);
|
|
1425
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1426
|
+
background-color: color-mix(in oklab, var(--color-red-950) 40%, transparent);
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1432
1430
|
.dark\:bg-transparent {
|
|
1433
1431
|
&:where(.dark, .dark *) {
|
|
1434
1432
|
background-color: transparent;
|
|
@@ -1459,11 +1457,6 @@
|
|
|
1459
1457
|
color: #f4f4f5cc;
|
|
1460
1458
|
}
|
|
1461
1459
|
}
|
|
1462
|
-
.dark\:text-blue-400 {
|
|
1463
|
-
&:where(.dark, .dark *) {
|
|
1464
|
-
color: var(--color-blue-400);
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
1460
|
.dark\:text-gray-400 {
|
|
1468
1461
|
&:where(.dark, .dark *) {
|
|
1469
1462
|
color: var(--color-gray-400);
|
package/dist/index.js
CHANGED
|
@@ -907,12 +907,13 @@ var SwitchProfileSection = ({
|
|
|
907
907
|
const [position, setPosition] = (0, import_react13.useState)(null);
|
|
908
908
|
const [showLogoutConfirm, setShowLogoutConfirm] = (0, import_react13.useState)(false);
|
|
909
909
|
const [switchingProfileId, setSwitchingProfileId] = (0, import_react13.useState)(null);
|
|
910
|
+
const [switchError, setSwitchError] = (0, import_react13.useState)(null);
|
|
910
911
|
(0, import_react13.useLayoutEffect)(() => {
|
|
911
912
|
if (!open || !(anchorRef == null ? void 0 : anchorRef.current)) return;
|
|
912
913
|
const updatePosition = () => {
|
|
913
914
|
const rect = anchorRef.current.getBoundingClientRect();
|
|
914
915
|
setPosition({
|
|
915
|
-
left: rect.right +
|
|
916
|
+
left: rect.right + 2,
|
|
916
917
|
bottom: window.innerHeight - rect.bottom
|
|
917
918
|
});
|
|
918
919
|
};
|
|
@@ -924,6 +925,14 @@ var SwitchProfileSection = ({
|
|
|
924
925
|
window.removeEventListener("scroll", updatePosition, true);
|
|
925
926
|
};
|
|
926
927
|
}, [open, anchorRef]);
|
|
928
|
+
(0, import_react13.useEffect)(() => {
|
|
929
|
+
if (!open) setSwitchError(null);
|
|
930
|
+
}, [open]);
|
|
931
|
+
(0, import_react13.useEffect)(() => {
|
|
932
|
+
if (!switchError) return;
|
|
933
|
+
const timer = setTimeout(() => setSwitchError(null), 5e3);
|
|
934
|
+
return () => clearTimeout(timer);
|
|
935
|
+
}, [switchError]);
|
|
927
936
|
if (!open && !showLogoutConfirm || typeof document === "undefined") return null;
|
|
928
937
|
const jettIdData = getJettIdCookieData();
|
|
929
938
|
const userName = (jettIdData == null ? void 0 : jettIdData.UserName) || "";
|
|
@@ -944,9 +953,10 @@ var SwitchProfileSection = ({
|
|
|
944
953
|
// Client IP cannot be retrieved from browser
|
|
945
954
|
});
|
|
946
955
|
const handleProfileSwitch = async (profile) => {
|
|
947
|
-
var _a;
|
|
956
|
+
var _a, _b, _c;
|
|
948
957
|
if (switchingProfileId) return;
|
|
949
958
|
setSwitchingProfileId(profile.ProfileId);
|
|
959
|
+
setSwitchError(null);
|
|
950
960
|
try {
|
|
951
961
|
const encryptedRequest = encryptForSwitchProfile(
|
|
952
962
|
JSON.stringify({
|
|
@@ -963,7 +973,14 @@ var SwitchProfileSection = ({
|
|
|
963
973
|
Request: encryptedRequest
|
|
964
974
|
})
|
|
965
975
|
}).then((res) => res.json());
|
|
966
|
-
|
|
976
|
+
const statusCode = (_a = response == null ? void 0 : response.Context) == null ? void 0 : _a.StatusCode;
|
|
977
|
+
const isSuccess = !statusCode || statusCode === 200;
|
|
978
|
+
if (!isSuccess) {
|
|
979
|
+
setSwitchError(((_b = response == null ? void 0 : response.Context) == null ? void 0 : _b.Message) || "Unable to switch profile. Please try again.");
|
|
980
|
+
setSwitchingProfileId(null);
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
if ((_c = response == null ? void 0 : response.Response) == null ? void 0 : _c.RedirectUrl) {
|
|
967
984
|
window.location.href = response.Response.RedirectUrl;
|
|
968
985
|
return;
|
|
969
986
|
}
|
|
@@ -971,30 +988,37 @@ var SwitchProfileSection = ({
|
|
|
971
988
|
onProfileSwitch == null ? void 0 : onProfileSwitch(profile);
|
|
972
989
|
} catch (error) {
|
|
973
990
|
console.error("Switch profile request failed:", error);
|
|
991
|
+
setSwitchError("Something went wrong while switching profile. Please try again.");
|
|
974
992
|
setSwitchingProfileId(null);
|
|
975
|
-
onProfileSwitch == null ? void 0 : onProfileSwitch(profile);
|
|
976
993
|
}
|
|
977
994
|
};
|
|
978
995
|
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, open && (0, import_react_dom2.createPortal)(
|
|
979
996
|
/* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("div", { className: "fixed inset-0 z-[9999]", onClick: onClose, id: `${id}-backdrop` }), /* @__PURE__ */ import_react13.default.createElement(
|
|
980
997
|
"div",
|
|
981
998
|
{
|
|
982
|
-
className: "fixed w-[
|
|
999
|
+
className: "fixed w-[320px] max-h-[75vh] flex p-4 flex-col overflow-hidden bg-white dark:bg-[#18181b] rounded-xl shadow-xl border border-gray-200 dark:border-[#303036] z-[9999]",
|
|
983
1000
|
style: position ? { left: position.left, bottom: position.bottom } : { left: -9999, bottom: 0 },
|
|
984
1001
|
id: `${id}-panel`
|
|
985
1002
|
},
|
|
986
|
-
/* @__PURE__ */ import_react13.default.createElement("div", { className: "flex items-center justify-between gap-3
|
|
1003
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "flex items-center justify-between gap-3 pb-4", id: `${id}-header` }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "flex items-center gap-3 min-w-0", id: `${id}-header-user` }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10", id: `${id}-avatar` }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border-2 border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white" }, userName ? userName.charAt(0) : "40 * 40")), /* @__PURE__ */ import_react13.default.createElement("div", { className: "min-w-0", id: `${id}-header-text` }, /* @__PURE__ */ import_react13.default.createElement("p", { className: "!font-semibold dark:text-white !text-[14px] truncate" }, userName || "Admin"), /* @__PURE__ */ import_react13.default.createElement("p", { className: "!text-[10px] !font-normal text-gray-500 dark:text-[#f4f4f5cc] truncate" }, userEmail))), /* @__PURE__ */ import_react13.default.createElement(
|
|
987
1004
|
"button",
|
|
988
1005
|
{
|
|
989
1006
|
type: "button",
|
|
990
1007
|
onClick: onManageProfile,
|
|
991
|
-
className: "shrink-0 whitespace-nowrap rounded-md border border-gray-300 dark:border-[#303036] px-3 py-1.5 text-[
|
|
1008
|
+
className: "shrink-0 whitespace-nowrap rounded-md border border-gray-300 dark:border-[#303036] px-3 py-1.5 text-[10px] font-bold uppercase tracking-wide text-[#0A0A0A] dark:text-[#f4f4f5cc] cursor-pointer hover:bg-gray-50 dark:hover:bg-[#27272a] transition-colors duration-200",
|
|
992
1009
|
id: `${id}-manage-profile-button`
|
|
993
1010
|
},
|
|
994
1011
|
"Manage Profile"
|
|
995
1012
|
)),
|
|
996
|
-
/* @__PURE__ */ import_react13.default.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036]" }),
|
|
997
|
-
/* @__PURE__ */ import_react13.default.createElement("div", { className: "overflow-y-auto scrollbar-hide", id: `${id}-body` }, /* @__PURE__ */ import_react13.default.createElement("p", { className: "
|
|
1013
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036] mb-4" }),
|
|
1014
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "overflow-y-auto scrollbar-hide", id: `${id}-body` }, /* @__PURE__ */ import_react13.default.createElement("p", { className: "pb-4 text-[10px] font-bold tracking-wider text-[#737373] uppercase", id: `${id}-markets-label` }, "Your Markets"), switchError && /* @__PURE__ */ import_react13.default.createElement(
|
|
1015
|
+
"div",
|
|
1016
|
+
{
|
|
1017
|
+
className: "mb-3 rounded-lg border border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-950/40 px-3 py-2 text-[12px] font-medium text-red-600",
|
|
1018
|
+
id: `${id}-switch-error`
|
|
1019
|
+
},
|
|
1020
|
+
switchError
|
|
1021
|
+
), /* @__PURE__ */ import_react13.default.createElement("div", { className: "flex flex-col gap-1 pb-4", id: `${id}-markets-list` }, markets.length === 0 && /* @__PURE__ */ import_react13.default.createElement("p", { className: "px-2 py-2 text-[13px] text-gray-400", id: `${id}-markets-empty` }, "No markets available"), markets.map((profile) => {
|
|
998
1022
|
const isCurrent = profile.ProfileId === currentProfileId;
|
|
999
1023
|
const isSwitching = switchingProfileId === profile.ProfileId;
|
|
1000
1024
|
return /* @__PURE__ */ import_react13.default.createElement(
|
|
@@ -1003,27 +1027,27 @@ var SwitchProfileSection = ({
|
|
|
1003
1027
|
key: profile.ProfileId,
|
|
1004
1028
|
onClick: () => !isCurrent && handleProfileSwitch(profile),
|
|
1005
1029
|
"aria-disabled": isSwitching,
|
|
1006
|
-
className: `flex items-center justify-between gap-2 rounded-lg p-3 cursor-pointer hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] transition-colors duration-200 ${isCurrent ? "border border-gray-800 dark:border-white" : "border border-transparent"} ${isSwitching ? "opacity-50 pointer-events-none" : ""}`,
|
|
1030
|
+
className: `flex items-center justify-between gap-2 rounded-lg p-3 cursor-pointer hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] transition-colors duration-200 ${isCurrent ? "border border-gray-800 dark:border-white bg-[#f4f4f5] text-[#0A0A0A]" : "border border-transparent"} ${isSwitching ? "opacity-50 pointer-events-none" : ""}`,
|
|
1007
1031
|
id: `${id}-market-${profile.ProfileId}`
|
|
1008
1032
|
},
|
|
1009
|
-
/* @__PURE__ */ import_react13.default.createElement("span", { className: "!font-
|
|
1010
|
-
isCurrent && /* @__PURE__ */ import_react13.default.createElement("span", { className: "shrink-0 rounded-full bg-blue-600 px-2.5 py-0.5 text-[
|
|
1033
|
+
/* @__PURE__ */ import_react13.default.createElement("span", { className: "!font-bold !text-[14px] text-gray-900 dark:text-[#f4f4f5cc] truncate" }, profile.EntityName),
|
|
1034
|
+
isCurrent && /* @__PURE__ */ import_react13.default.createElement("span", { className: "shrink-0 rounded-full bg-blue-600 px-2.5 py-0.5 border-2 border-white text-[9px] font-bold uppercase tracking-wide text-white" }, "Logged In"),
|
|
1011
1035
|
isSwitching && /* @__PURE__ */ import_react13.default.createElement("span", { className: "shrink-0 text-[11px] text-gray-400" }, "Switching...")
|
|
1012
1036
|
);
|
|
1013
1037
|
}))),
|
|
1014
|
-
/* @__PURE__ */ import_react13.default.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036]" }),
|
|
1015
|
-
/* @__PURE__ */ import_react13.default.createElement("div", { className: "
|
|
1038
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036] mb-4" }),
|
|
1039
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "", id: `${id}-footer` }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1016
1040
|
"div",
|
|
1017
1041
|
{
|
|
1018
1042
|
onClick: () => {
|
|
1019
1043
|
onClose == null ? void 0 : onClose();
|
|
1020
1044
|
setShowLogoutConfirm(true);
|
|
1021
1045
|
},
|
|
1022
|
-
className: "flex items-center gap-3 rounded-lg
|
|
1046
|
+
className: "flex items-center gap-3 p-3 rounded-lg cursor-pointer text-red-600 hover:bg-red-50 dark:hover:bg-[#27272a] transition-colors duration-200",
|
|
1023
1047
|
id: `${id}-logout`
|
|
1024
1048
|
},
|
|
1025
1049
|
/* @__PURE__ */ import_react13.default.createElement(import_lucide_react7.LogOut, { width: 18, height: 18 }),
|
|
1026
|
-
/* @__PURE__ */ import_react13.default.createElement("span", { className: "!font-
|
|
1050
|
+
/* @__PURE__ */ import_react13.default.createElement("span", { className: "!font-bold !text-[14px]" }, "Logout")
|
|
1027
1051
|
))
|
|
1028
1052
|
)),
|
|
1029
1053
|
document.body
|
|
@@ -1498,10 +1522,10 @@ var AppSideBar = ({
|
|
|
1498
1522
|
/* @__PURE__ */ import_react14.default.createElement(
|
|
1499
1523
|
"span",
|
|
1500
1524
|
{
|
|
1501
|
-
className: "
|
|
1525
|
+
className: "text-gray-600 dark:text-gray-400",
|
|
1502
1526
|
id: `${id}-span-switch`
|
|
1503
1527
|
},
|
|
1504
|
-
|
|
1528
|
+
/* @__PURE__ */ import_react14.default.createElement(import_lucide_react8.ChevronRight, { width: 20, height: 22 })
|
|
1505
1529
|
)
|
|
1506
1530
|
), /* @__PURE__ */ import_react14.default.createElement(
|
|
1507
1531
|
SwitchProfileSection,
|
package/dist/index.mjs
CHANGED
|
@@ -422,13 +422,14 @@ var CustomUpload = ({
|
|
|
422
422
|
// src/sideBar/SideBar.jsx
|
|
423
423
|
import {
|
|
424
424
|
ChevronDown as ChevronDown3,
|
|
425
|
+
ChevronRight,
|
|
425
426
|
CircleSlash,
|
|
426
427
|
Globe,
|
|
427
428
|
LogOut as LogOut3,
|
|
428
429
|
Menu,
|
|
429
430
|
X
|
|
430
431
|
} from "lucide-react";
|
|
431
|
-
import React14, { useEffect, useState as useState4, useCallback, useRef as useRef4 } from "react";
|
|
432
|
+
import React14, { useEffect as useEffect2, useState as useState4, useCallback, useRef as useRef4 } from "react";
|
|
432
433
|
|
|
433
434
|
// ConstantUI.js
|
|
434
435
|
import {
|
|
@@ -781,9 +782,9 @@ function buildLogoUrl(CDNBasePath, logoPath) {
|
|
|
781
782
|
}
|
|
782
783
|
|
|
783
784
|
// src/sideBar/SwitchProfileSection.jsx
|
|
784
|
-
import React13, { useLayoutEffect, useState as useState3 } from "react";
|
|
785
|
+
import React13, { useEffect, useLayoutEffect, useState as useState3 } from "react";
|
|
785
786
|
import { createPortal as createPortal2 } from "react-dom";
|
|
786
|
-
import { LogOut as LogOut2,
|
|
787
|
+
import { LogOut as LogOut2, SlidersHorizontal } from "lucide-react";
|
|
787
788
|
|
|
788
789
|
// src/sideBar/LogoutConfirmModal.jsx
|
|
789
790
|
import React12 from "react";
|
|
@@ -874,12 +875,13 @@ var SwitchProfileSection = ({
|
|
|
874
875
|
const [position, setPosition] = useState3(null);
|
|
875
876
|
const [showLogoutConfirm, setShowLogoutConfirm] = useState3(false);
|
|
876
877
|
const [switchingProfileId, setSwitchingProfileId] = useState3(null);
|
|
878
|
+
const [switchError, setSwitchError] = useState3(null);
|
|
877
879
|
useLayoutEffect(() => {
|
|
878
880
|
if (!open || !(anchorRef == null ? void 0 : anchorRef.current)) return;
|
|
879
881
|
const updatePosition = () => {
|
|
880
882
|
const rect = anchorRef.current.getBoundingClientRect();
|
|
881
883
|
setPosition({
|
|
882
|
-
left: rect.right +
|
|
884
|
+
left: rect.right + 2,
|
|
883
885
|
bottom: window.innerHeight - rect.bottom
|
|
884
886
|
});
|
|
885
887
|
};
|
|
@@ -891,6 +893,14 @@ var SwitchProfileSection = ({
|
|
|
891
893
|
window.removeEventListener("scroll", updatePosition, true);
|
|
892
894
|
};
|
|
893
895
|
}, [open, anchorRef]);
|
|
896
|
+
useEffect(() => {
|
|
897
|
+
if (!open) setSwitchError(null);
|
|
898
|
+
}, [open]);
|
|
899
|
+
useEffect(() => {
|
|
900
|
+
if (!switchError) return;
|
|
901
|
+
const timer = setTimeout(() => setSwitchError(null), 5e3);
|
|
902
|
+
return () => clearTimeout(timer);
|
|
903
|
+
}, [switchError]);
|
|
894
904
|
if (!open && !showLogoutConfirm || typeof document === "undefined") return null;
|
|
895
905
|
const jettIdData = getJettIdCookieData();
|
|
896
906
|
const userName = (jettIdData == null ? void 0 : jettIdData.UserName) || "";
|
|
@@ -911,9 +921,10 @@ var SwitchProfileSection = ({
|
|
|
911
921
|
// Client IP cannot be retrieved from browser
|
|
912
922
|
});
|
|
913
923
|
const handleProfileSwitch = async (profile) => {
|
|
914
|
-
var _a;
|
|
924
|
+
var _a, _b, _c;
|
|
915
925
|
if (switchingProfileId) return;
|
|
916
926
|
setSwitchingProfileId(profile.ProfileId);
|
|
927
|
+
setSwitchError(null);
|
|
917
928
|
try {
|
|
918
929
|
const encryptedRequest = encryptForSwitchProfile(
|
|
919
930
|
JSON.stringify({
|
|
@@ -930,7 +941,14 @@ var SwitchProfileSection = ({
|
|
|
930
941
|
Request: encryptedRequest
|
|
931
942
|
})
|
|
932
943
|
}).then((res) => res.json());
|
|
933
|
-
|
|
944
|
+
const statusCode = (_a = response == null ? void 0 : response.Context) == null ? void 0 : _a.StatusCode;
|
|
945
|
+
const isSuccess = !statusCode || statusCode === 200;
|
|
946
|
+
if (!isSuccess) {
|
|
947
|
+
setSwitchError(((_b = response == null ? void 0 : response.Context) == null ? void 0 : _b.Message) || "Unable to switch profile. Please try again.");
|
|
948
|
+
setSwitchingProfileId(null);
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
if ((_c = response == null ? void 0 : response.Response) == null ? void 0 : _c.RedirectUrl) {
|
|
934
952
|
window.location.href = response.Response.RedirectUrl;
|
|
935
953
|
return;
|
|
936
954
|
}
|
|
@@ -938,30 +956,37 @@ var SwitchProfileSection = ({
|
|
|
938
956
|
onProfileSwitch == null ? void 0 : onProfileSwitch(profile);
|
|
939
957
|
} catch (error) {
|
|
940
958
|
console.error("Switch profile request failed:", error);
|
|
959
|
+
setSwitchError("Something went wrong while switching profile. Please try again.");
|
|
941
960
|
setSwitchingProfileId(null);
|
|
942
|
-
onProfileSwitch == null ? void 0 : onProfileSwitch(profile);
|
|
943
961
|
}
|
|
944
962
|
};
|
|
945
963
|
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, open && createPortal2(
|
|
946
964
|
/* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("div", { className: "fixed inset-0 z-[9999]", onClick: onClose, id: `${id}-backdrop` }), /* @__PURE__ */ React13.createElement(
|
|
947
965
|
"div",
|
|
948
966
|
{
|
|
949
|
-
className: "fixed w-[
|
|
967
|
+
className: "fixed w-[320px] max-h-[75vh] flex p-4 flex-col overflow-hidden bg-white dark:bg-[#18181b] rounded-xl shadow-xl border border-gray-200 dark:border-[#303036] z-[9999]",
|
|
950
968
|
style: position ? { left: position.left, bottom: position.bottom } : { left: -9999, bottom: 0 },
|
|
951
969
|
id: `${id}-panel`
|
|
952
970
|
},
|
|
953
|
-
/* @__PURE__ */ React13.createElement("div", { className: "flex items-center justify-between gap-3
|
|
971
|
+
/* @__PURE__ */ React13.createElement("div", { className: "flex items-center justify-between gap-3 pb-4", id: `${id}-header` }, /* @__PURE__ */ React13.createElement("div", { className: "flex items-center gap-3 min-w-0", id: `${id}-header-user` }, /* @__PURE__ */ React13.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10", id: `${id}-avatar` }, /* @__PURE__ */ React13.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border-2 border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white" }, userName ? userName.charAt(0) : "40 * 40")), /* @__PURE__ */ React13.createElement("div", { className: "min-w-0", id: `${id}-header-text` }, /* @__PURE__ */ React13.createElement("p", { className: "!font-semibold dark:text-white !text-[14px] truncate" }, userName || "Admin"), /* @__PURE__ */ React13.createElement("p", { className: "!text-[10px] !font-normal text-gray-500 dark:text-[#f4f4f5cc] truncate" }, userEmail))), /* @__PURE__ */ React13.createElement(
|
|
954
972
|
"button",
|
|
955
973
|
{
|
|
956
974
|
type: "button",
|
|
957
975
|
onClick: onManageProfile,
|
|
958
|
-
className: "shrink-0 whitespace-nowrap rounded-md border border-gray-300 dark:border-[#303036] px-3 py-1.5 text-[
|
|
976
|
+
className: "shrink-0 whitespace-nowrap rounded-md border border-gray-300 dark:border-[#303036] px-3 py-1.5 text-[10px] font-bold uppercase tracking-wide text-[#0A0A0A] dark:text-[#f4f4f5cc] cursor-pointer hover:bg-gray-50 dark:hover:bg-[#27272a] transition-colors duration-200",
|
|
959
977
|
id: `${id}-manage-profile-button`
|
|
960
978
|
},
|
|
961
979
|
"Manage Profile"
|
|
962
980
|
)),
|
|
963
|
-
/* @__PURE__ */ React13.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036]" }),
|
|
964
|
-
/* @__PURE__ */ React13.createElement("div", { className: "overflow-y-auto scrollbar-hide", id: `${id}-body` }, /* @__PURE__ */ React13.createElement("p", { className: "
|
|
981
|
+
/* @__PURE__ */ React13.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036] mb-4" }),
|
|
982
|
+
/* @__PURE__ */ React13.createElement("div", { className: "overflow-y-auto scrollbar-hide", id: `${id}-body` }, /* @__PURE__ */ React13.createElement("p", { className: "pb-4 text-[10px] font-bold tracking-wider text-[#737373] uppercase", id: `${id}-markets-label` }, "Your Markets"), switchError && /* @__PURE__ */ React13.createElement(
|
|
983
|
+
"div",
|
|
984
|
+
{
|
|
985
|
+
className: "mb-3 rounded-lg border border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-950/40 px-3 py-2 text-[12px] font-medium text-red-600",
|
|
986
|
+
id: `${id}-switch-error`
|
|
987
|
+
},
|
|
988
|
+
switchError
|
|
989
|
+
), /* @__PURE__ */ React13.createElement("div", { className: "flex flex-col gap-1 pb-4", id: `${id}-markets-list` }, markets.length === 0 && /* @__PURE__ */ React13.createElement("p", { className: "px-2 py-2 text-[13px] text-gray-400", id: `${id}-markets-empty` }, "No markets available"), markets.map((profile) => {
|
|
965
990
|
const isCurrent = profile.ProfileId === currentProfileId;
|
|
966
991
|
const isSwitching = switchingProfileId === profile.ProfileId;
|
|
967
992
|
return /* @__PURE__ */ React13.createElement(
|
|
@@ -970,27 +995,27 @@ var SwitchProfileSection = ({
|
|
|
970
995
|
key: profile.ProfileId,
|
|
971
996
|
onClick: () => !isCurrent && handleProfileSwitch(profile),
|
|
972
997
|
"aria-disabled": isSwitching,
|
|
973
|
-
className: `flex items-center justify-between gap-2 rounded-lg p-3 cursor-pointer hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] transition-colors duration-200 ${isCurrent ? "border border-gray-800 dark:border-white" : "border border-transparent"} ${isSwitching ? "opacity-50 pointer-events-none" : ""}`,
|
|
998
|
+
className: `flex items-center justify-between gap-2 rounded-lg p-3 cursor-pointer hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] transition-colors duration-200 ${isCurrent ? "border border-gray-800 dark:border-white bg-[#f4f4f5] text-[#0A0A0A]" : "border border-transparent"} ${isSwitching ? "opacity-50 pointer-events-none" : ""}`,
|
|
974
999
|
id: `${id}-market-${profile.ProfileId}`
|
|
975
1000
|
},
|
|
976
|
-
/* @__PURE__ */ React13.createElement("span", { className: "!font-
|
|
977
|
-
isCurrent && /* @__PURE__ */ React13.createElement("span", { className: "shrink-0 rounded-full bg-blue-600 px-2.5 py-0.5 text-[
|
|
1001
|
+
/* @__PURE__ */ React13.createElement("span", { className: "!font-bold !text-[14px] text-gray-900 dark:text-[#f4f4f5cc] truncate" }, profile.EntityName),
|
|
1002
|
+
isCurrent && /* @__PURE__ */ React13.createElement("span", { className: "shrink-0 rounded-full bg-blue-600 px-2.5 py-0.5 border-2 border-white text-[9px] font-bold uppercase tracking-wide text-white" }, "Logged In"),
|
|
978
1003
|
isSwitching && /* @__PURE__ */ React13.createElement("span", { className: "shrink-0 text-[11px] text-gray-400" }, "Switching...")
|
|
979
1004
|
);
|
|
980
1005
|
}))),
|
|
981
|
-
/* @__PURE__ */ React13.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036]" }),
|
|
982
|
-
/* @__PURE__ */ React13.createElement("div", { className: "
|
|
1006
|
+
/* @__PURE__ */ React13.createElement("div", { className: "border-t border-gray-200 dark:border-[#303036] mb-4" }),
|
|
1007
|
+
/* @__PURE__ */ React13.createElement("div", { className: "", id: `${id}-footer` }, /* @__PURE__ */ React13.createElement(
|
|
983
1008
|
"div",
|
|
984
1009
|
{
|
|
985
1010
|
onClick: () => {
|
|
986
1011
|
onClose == null ? void 0 : onClose();
|
|
987
1012
|
setShowLogoutConfirm(true);
|
|
988
1013
|
},
|
|
989
|
-
className: "flex items-center gap-3 rounded-lg
|
|
1014
|
+
className: "flex items-center gap-3 p-3 rounded-lg cursor-pointer text-red-600 hover:bg-red-50 dark:hover:bg-[#27272a] transition-colors duration-200",
|
|
990
1015
|
id: `${id}-logout`
|
|
991
1016
|
},
|
|
992
1017
|
/* @__PURE__ */ React13.createElement(LogOut2, { width: 18, height: 18 }),
|
|
993
|
-
/* @__PURE__ */ React13.createElement("span", { className: "!font-
|
|
1018
|
+
/* @__PURE__ */ React13.createElement("span", { className: "!font-bold !text-[14px]" }, "Logout")
|
|
994
1019
|
))
|
|
995
1020
|
)),
|
|
996
1021
|
document.body
|
|
@@ -1032,7 +1057,7 @@ var AppSideBar = ({
|
|
|
1032
1057
|
const [openMenus, setOpenMenus] = useState4(/* @__PURE__ */ new Set());
|
|
1033
1058
|
const [activeMenuPath, setActiveMenuPath] = useState4(null);
|
|
1034
1059
|
const [currAppearance, setCurrAppearance] = useState4("light");
|
|
1035
|
-
|
|
1060
|
+
useEffect2(() => {
|
|
1036
1061
|
setCurrAppearance("light");
|
|
1037
1062
|
}, []);
|
|
1038
1063
|
const countryOptions = [
|
|
@@ -1104,14 +1129,14 @@ var AppSideBar = ({
|
|
|
1104
1129
|
}
|
|
1105
1130
|
closeMobileMenu();
|
|
1106
1131
|
};
|
|
1107
|
-
|
|
1132
|
+
useEffect2(() => {
|
|
1108
1133
|
const storedAuthData = localStorage.getItem("authData");
|
|
1109
1134
|
if (storedAuthData) {
|
|
1110
1135
|
let parseData = JSON.parse(storedAuthData);
|
|
1111
1136
|
setAuthData(parseData);
|
|
1112
1137
|
}
|
|
1113
1138
|
}, [localStorage.getItem("authData")]);
|
|
1114
|
-
|
|
1139
|
+
useEffect2(() => {
|
|
1115
1140
|
const jettIdData = getJettIdCookieData();
|
|
1116
1141
|
if (jettIdData == null ? void 0 : jettIdData.UserName) {
|
|
1117
1142
|
setCookieUserName(jettIdData.UserName);
|
|
@@ -1304,11 +1329,11 @@ var AppSideBar = ({
|
|
|
1304
1329
|
const [currentUrl, setCurrentUrl] = useState4(
|
|
1305
1330
|
() => window.location.pathname + window.location.search
|
|
1306
1331
|
);
|
|
1307
|
-
|
|
1332
|
+
useEffect2(() => {
|
|
1308
1333
|
detectAndSetActiveMenu();
|
|
1309
1334
|
setCurrentUrl(window.location.pathname + window.location.search);
|
|
1310
1335
|
}, [detectAndSetActiveMenu]);
|
|
1311
|
-
|
|
1336
|
+
useEffect2(() => {
|
|
1312
1337
|
let lastUrl = window.location.pathname + window.location.search;
|
|
1313
1338
|
const handleLocationChange = () => {
|
|
1314
1339
|
const newUrl = window.location.pathname + window.location.search;
|
|
@@ -1330,7 +1355,7 @@ var AppSideBar = ({
|
|
|
1330
1355
|
clearInterval(checkInterval);
|
|
1331
1356
|
};
|
|
1332
1357
|
}, [detectAndSetActiveMenu]);
|
|
1333
|
-
|
|
1358
|
+
useEffect2(() => {
|
|
1334
1359
|
detectAndSetActiveMenu();
|
|
1335
1360
|
}, [currentUrl, detectAndSetActiveMenu]);
|
|
1336
1361
|
const toggleMobileMenu = () => {
|
|
@@ -1465,10 +1490,10 @@ var AppSideBar = ({
|
|
|
1465
1490
|
/* @__PURE__ */ React14.createElement(
|
|
1466
1491
|
"span",
|
|
1467
1492
|
{
|
|
1468
|
-
className: "
|
|
1493
|
+
className: "text-gray-600 dark:text-gray-400",
|
|
1469
1494
|
id: `${id}-span-switch`
|
|
1470
1495
|
},
|
|
1471
|
-
|
|
1496
|
+
/* @__PURE__ */ React14.createElement(ChevronRight, { width: 20, height: 22 })
|
|
1472
1497
|
)
|
|
1473
1498
|
), /* @__PURE__ */ React14.createElement(
|
|
1474
1499
|
SwitchProfileSection,
|
|
@@ -1503,7 +1528,7 @@ var AppSideBar = ({
|
|
|
1503
1528
|
};
|
|
1504
1529
|
|
|
1505
1530
|
// src/RightSheet/RightSheet.jsx
|
|
1506
|
-
import React15, { useEffect as
|
|
1531
|
+
import React15, { useEffect as useEffect3, useState as useState5 } from "react";
|
|
1507
1532
|
var RightSheet = ({
|
|
1508
1533
|
id = "right-sheet",
|
|
1509
1534
|
open,
|
|
@@ -1515,7 +1540,7 @@ var RightSheet = ({
|
|
|
1515
1540
|
}
|
|
1516
1541
|
}) => {
|
|
1517
1542
|
const [visible, setVisible] = useState5(open);
|
|
1518
|
-
|
|
1543
|
+
useEffect3(() => {
|
|
1519
1544
|
if (open) {
|
|
1520
1545
|
document.body.style.overflow = "hidden";
|
|
1521
1546
|
setVisible(true);
|
|
@@ -1598,8 +1623,8 @@ var CustomTable = ({
|
|
|
1598
1623
|
};
|
|
1599
1624
|
|
|
1600
1625
|
// src/Pagination/Pagination.jsx
|
|
1601
|
-
import React17, { useMemo, useState as useState6, useEffect as
|
|
1602
|
-
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from "lucide-react";
|
|
1626
|
+
import React17, { useMemo, useState as useState6, useEffect as useEffect4 } from "react";
|
|
1627
|
+
import { ChevronLeft, ChevronRight as ChevronRight2, ChevronsLeft, ChevronsRight } from "lucide-react";
|
|
1603
1628
|
var Pagination = ({
|
|
1604
1629
|
id = "pagination",
|
|
1605
1630
|
data = [],
|
|
@@ -1642,7 +1667,7 @@ var Pagination = ({
|
|
|
1642
1667
|
const endIndex = startIndex + activeItemsPerPage;
|
|
1643
1668
|
return data.slice(startIndex, endIndex);
|
|
1644
1669
|
}, [data, currentPage, activeItemsPerPage]);
|
|
1645
|
-
|
|
1670
|
+
useEffect4(() => {
|
|
1646
1671
|
if (!isControlled && currentPage > calculatedTotalPages && calculatedTotalPages > 0) {
|
|
1647
1672
|
setInternalCurrentPage(1);
|
|
1648
1673
|
}
|
|
@@ -1788,7 +1813,7 @@ var Pagination = ({
|
|
|
1788
1813
|
title: "Next page",
|
|
1789
1814
|
id: `${id}-button-4`
|
|
1790
1815
|
},
|
|
1791
|
-
/* @__PURE__ */ React17.createElement(
|
|
1816
|
+
/* @__PURE__ */ React17.createElement(ChevronRight2, { size: 16 })
|
|
1792
1817
|
), /* @__PURE__ */ React17.createElement(
|
|
1793
1818
|
"button",
|
|
1794
1819
|
{
|