@juv/codego-react-ui 3.5.21 → 3.6.1
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 +55 -0
- package/dist/index.cjs +139 -178
- package/dist/index.d.cts +41 -23
- package/dist/index.d.ts +41 -23
- package/dist/index.global.js +132 -177
- package/dist/index.js +143 -186
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ function FloatingPortal({ children }) {
|
|
|
27
27
|
|
|
28
28
|
// src/components/ui/button.tsx
|
|
29
29
|
import * as React from "react";
|
|
30
|
+
import * as ReactDOM2 from "react-dom";
|
|
30
31
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
31
32
|
var Button = React.forwardRef(
|
|
32
33
|
({
|
|
@@ -105,6 +106,8 @@ var Button = React.forwardRef(
|
|
|
105
106
|
confirmBeforeClickModalTitle,
|
|
106
107
|
confirmBeforeClickModalContent,
|
|
107
108
|
confirmBeforeClickFooterAction,
|
|
109
|
+
onConfirm,
|
|
110
|
+
onCancel,
|
|
108
111
|
href,
|
|
109
112
|
target,
|
|
110
113
|
as = "button",
|
|
@@ -200,11 +203,13 @@ var Button = React.forwardRef(
|
|
|
200
203
|
};
|
|
201
204
|
function handleConfirmProceed() {
|
|
202
205
|
setConfirmOpen(false);
|
|
206
|
+
onConfirm?.();
|
|
203
207
|
onClick?.(pendingEvent.current ?? void 0);
|
|
204
208
|
pendingEvent.current = null;
|
|
205
209
|
}
|
|
206
210
|
function handleConfirmCancel() {
|
|
207
211
|
setConfirmOpen(false);
|
|
212
|
+
onCancel?.();
|
|
208
213
|
pendingEvent.current = null;
|
|
209
214
|
}
|
|
210
215
|
const buttonContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -232,46 +237,49 @@ var Button = React.forwardRef(
|
|
|
232
237
|
tabIndex,
|
|
233
238
|
"data-testid": testID
|
|
234
239
|
};
|
|
235
|
-
const confirmModal = confirmBeforeClick && confirmOpen ?
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
/* @__PURE__ */ jsx(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
240
|
+
const confirmModal = confirmBeforeClick && confirmOpen ? ReactDOM2.createPortal(
|
|
241
|
+
/* @__PURE__ */ jsxs(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
className: "fixed inset-0 z-[9999] flex items-center justify-center",
|
|
245
|
+
onClick: handleConfirmCancel,
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/50 backdrop-blur-sm" }),
|
|
248
|
+
/* @__PURE__ */ jsxs(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
className: "relative z-10 w-full max-w-sm rounded-2xl border border-border bg-card p-6 shadow-2xl",
|
|
252
|
+
onClick: (e) => e.stopPropagation(),
|
|
253
|
+
children: [
|
|
254
|
+
/* @__PURE__ */ jsx("p", { className: "text-base font-semibold text-foreground mb-2", children: confirmBeforeClickModalTitle ?? "Are you sure?" }),
|
|
255
|
+
confirmBeforeClickModalContent && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground mb-5", children: confirmBeforeClickModalContent }),
|
|
256
|
+
/* @__PURE__ */ jsx("div", { className: "flex justify-end gap-2 mt-4", children: confirmBeforeClickFooterAction ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
257
|
+
/* @__PURE__ */ jsx(
|
|
258
|
+
"button",
|
|
259
|
+
{
|
|
260
|
+
type: "button",
|
|
261
|
+
onClick: handleConfirmCancel,
|
|
262
|
+
className: "inline-flex items-center justify-center rounded-md border border-border bg-background px-4 py-2 text-sm font-medium text-foreground hover:bg-accent transition-colors",
|
|
263
|
+
children: "Cancel"
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
/* @__PURE__ */ jsx(
|
|
267
|
+
"button",
|
|
268
|
+
{
|
|
269
|
+
type: "button",
|
|
270
|
+
onClick: handleConfirmProceed,
|
|
271
|
+
className: "inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary-hover transition-colors",
|
|
272
|
+
children: "Proceed"
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
] }) })
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
document.body
|
|
275
283
|
) : null;
|
|
276
284
|
if (Element === "a") {
|
|
277
285
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1435,69 +1443,9 @@ function Breadcrumb({
|
|
|
1435
1443
|
|
|
1436
1444
|
// src/components/ui/bulletin-board.tsx
|
|
1437
1445
|
import * as React8 from "react";
|
|
1438
|
-
import { createPortal as
|
|
1446
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
1439
1447
|
import axios2 from "axios";
|
|
1440
1448
|
import { Search, Pin, Tag, MoreHorizontal as MoreHorizontal2, AlertCircle, AlertTriangle, Info, X, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3, Pencil, Trash, Loader2 } from "lucide-react";
|
|
1441
|
-
|
|
1442
|
-
// src/components/tools/decryptPayload.ts
|
|
1443
|
-
import CryptoJS from "crypto-js";
|
|
1444
|
-
function getLaravelSecretKey() {
|
|
1445
|
-
const viteKey = (() => {
|
|
1446
|
-
try {
|
|
1447
|
-
return new Function("return import.meta.env")();
|
|
1448
|
-
} catch {
|
|
1449
|
-
return void 0;
|
|
1450
|
-
}
|
|
1451
|
-
})()?.VITE_LARAVEL_KEY;
|
|
1452
|
-
const legacyKey = globalThis?.process?.env?.REACT_APP_LARAVEL_KEY;
|
|
1453
|
-
const windowKey = globalThis?.__LARAVEL_KEY__;
|
|
1454
|
-
const key = viteKey || legacyKey || windowKey;
|
|
1455
|
-
if (!key) {
|
|
1456
|
-
throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env or inject window.__LARAVEL_KEY__ via Blade.");
|
|
1457
|
-
}
|
|
1458
|
-
return key;
|
|
1459
|
-
}
|
|
1460
|
-
function parseLaravelKey(secretKey) {
|
|
1461
|
-
if (secretKey.startsWith("base64:")) {
|
|
1462
|
-
return CryptoJS.enc.Base64.parse(secretKey.slice("base64:".length));
|
|
1463
|
-
}
|
|
1464
|
-
return CryptoJS.enc.Utf8.parse(secretKey);
|
|
1465
|
-
}
|
|
1466
|
-
function parseLaravelEncryptedPayload(payload) {
|
|
1467
|
-
let jsonStr = payload;
|
|
1468
|
-
try {
|
|
1469
|
-
jsonStr = atob(payload);
|
|
1470
|
-
} catch {
|
|
1471
|
-
}
|
|
1472
|
-
return JSON.parse(jsonStr);
|
|
1473
|
-
}
|
|
1474
|
-
function decryptLaravelPayload(payload, secretKey) {
|
|
1475
|
-
const resolvedKey = secretKey ?? getLaravelSecretKey();
|
|
1476
|
-
const parsed = parseLaravelEncryptedPayload(payload);
|
|
1477
|
-
if (parsed.tag) {
|
|
1478
|
-
throw new Error("Unsupported Laravel cipher (AEAD tag present). Expected AES-*-CBC payload.");
|
|
1479
|
-
}
|
|
1480
|
-
const key = parseLaravelKey(resolvedKey);
|
|
1481
|
-
const expectedMac = CryptoJS.HmacSHA256(parsed.iv + parsed.value, key).toString(CryptoJS.enc.Hex);
|
|
1482
|
-
if (expectedMac !== parsed.mac) {
|
|
1483
|
-
throw new Error("Invalid payload MAC (wrong key or tampered payload).");
|
|
1484
|
-
}
|
|
1485
|
-
const iv = CryptoJS.enc.Base64.parse(parsed.iv);
|
|
1486
|
-
const ciphertext = CryptoJS.enc.Base64.parse(parsed.value);
|
|
1487
|
-
const cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext });
|
|
1488
|
-
const decrypted = CryptoJS.AES.decrypt(cipherParams, key, {
|
|
1489
|
-
iv,
|
|
1490
|
-
mode: CryptoJS.mode.CBC,
|
|
1491
|
-
padding: CryptoJS.pad.Pkcs7
|
|
1492
|
-
});
|
|
1493
|
-
const plaintext = decrypted.toString(CryptoJS.enc.Utf8);
|
|
1494
|
-
if (!plaintext) {
|
|
1495
|
-
throw new Error("Decryption produced empty plaintext (wrong key/cipher).");
|
|
1496
|
-
}
|
|
1497
|
-
return JSON.parse(plaintext);
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
// src/components/ui/bulletin-board.tsx
|
|
1501
1449
|
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1502
1450
|
var PRIORITY_CONFIG = {
|
|
1503
1451
|
urgent: { label: "Urgent", icon: /* @__PURE__ */ jsx10(AlertCircle, { className: "h-3 w-3" }), badge: "error" },
|
|
@@ -1527,82 +1475,13 @@ function AuthorAvatar({ item }) {
|
|
|
1527
1475
|
}
|
|
1528
1476
|
return null;
|
|
1529
1477
|
}
|
|
1530
|
-
function
|
|
1531
|
-
url,
|
|
1532
|
-
params,
|
|
1533
|
-
encrypt,
|
|
1534
|
-
key,
|
|
1535
|
-
decryptPayloadLog,
|
|
1536
|
-
transform
|
|
1537
|
-
}) {
|
|
1538
|
-
const [items, setItems] = React8.useState([]);
|
|
1539
|
-
const [currentPage, setCurrentPage] = React8.useState(1);
|
|
1540
|
-
const [pagination, setPagination] = React8.useState(null);
|
|
1541
|
-
const [loading, setLoading] = React8.useState(false);
|
|
1542
|
-
const [error, setError] = React8.useState(null);
|
|
1543
|
-
const [tick, setTick] = React8.useState(0);
|
|
1544
|
-
React8.useEffect(() => {
|
|
1545
|
-
let cancelled = false;
|
|
1546
|
-
setLoading(true);
|
|
1547
|
-
setError(null);
|
|
1548
|
-
axios2.get(url, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
|
|
1549
|
-
if (cancelled) return;
|
|
1550
|
-
let payload;
|
|
1551
|
-
try {
|
|
1552
|
-
payload = encrypt ? decryptLaravelPayload(res, key) : res;
|
|
1553
|
-
} catch (decryptErr) {
|
|
1554
|
-
console.error("[useServerBulletin] decryption failed:", decryptErr?.message ?? decryptErr);
|
|
1555
|
-
if (!cancelled) setError(decryptErr?.message ?? "Decryption failed");
|
|
1556
|
-
return;
|
|
1557
|
-
}
|
|
1558
|
-
if (encrypt && decryptPayloadLog) console.log("[useServerBulletin] decrypted:", payload);
|
|
1559
|
-
const rows = Array.isArray(payload) ? payload : payload.data ?? [];
|
|
1560
|
-
setItems(transform ? rows.map(transform) : rows);
|
|
1561
|
-
if (!Array.isArray(payload)) {
|
|
1562
|
-
const rawTotal = payload.total;
|
|
1563
|
-
const rawPerPage = payload.per_page;
|
|
1564
|
-
const rawLastPage = payload.last_page;
|
|
1565
|
-
const lastPage = rawLastPage ?? Math.ceil(rawTotal / rawPerPage);
|
|
1566
|
-
const pg = payload.pagination ?? {
|
|
1567
|
-
first_page_url: payload.first_page_url ?? `${url}?page=1`,
|
|
1568
|
-
last_page_url: payload.last_page_url ?? `${url}?page=${lastPage}`,
|
|
1569
|
-
last_page: lastPage,
|
|
1570
|
-
next_page_url: payload.next_page_url !== void 0 ? payload.next_page_url : currentPage < lastPage ? `${url}?page=${currentPage + 1}` : null,
|
|
1571
|
-
prev_page_url: payload.prev_page_url !== void 0 ? payload.prev_page_url : currentPage > 1 ? `${url}?page=${currentPage - 1}` : null,
|
|
1572
|
-
per_page: rawPerPage,
|
|
1573
|
-
total: rawTotal,
|
|
1574
|
-
links: payload.links ?? []
|
|
1575
|
-
};
|
|
1576
|
-
setPagination(pg);
|
|
1577
|
-
}
|
|
1578
|
-
}).catch((err) => {
|
|
1579
|
-
if (cancelled) return;
|
|
1580
|
-
setError(err?.response?.data?.message ?? err.message ?? "Request failed");
|
|
1581
|
-
}).finally(() => {
|
|
1582
|
-
if (!cancelled) setLoading(false);
|
|
1583
|
-
});
|
|
1584
|
-
return () => {
|
|
1585
|
-
cancelled = true;
|
|
1586
|
-
};
|
|
1587
|
-
}, [url, currentPage, tick, JSON.stringify(params), encrypt, decryptPayloadLog]);
|
|
1588
|
-
return {
|
|
1589
|
-
items,
|
|
1590
|
-
currentPage,
|
|
1591
|
-
pagination,
|
|
1592
|
-
serverPagination: pagination ? { pagination, currentPage, goToPage: (p) => setCurrentPage(p) } : null,
|
|
1593
|
-
loading,
|
|
1594
|
-
error,
|
|
1595
|
-
goToPage: (p) => setCurrentPage(p),
|
|
1596
|
-
reload: () => setTick((t) => t + 1)
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1599
|
-
function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions }) {
|
|
1478
|
+
function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customActions, headerAction, footerAction }) {
|
|
1600
1479
|
const priority = item.priority ? PRIORITY_CONFIG[item.priority] : null;
|
|
1601
|
-
return
|
|
1480
|
+
return createPortal3(
|
|
1602
1481
|
/* @__PURE__ */ jsx10(
|
|
1603
1482
|
"div",
|
|
1604
1483
|
{
|
|
1605
|
-
className: "fixed inset-0 z-50 flex items-center justify-center p-4",
|
|
1484
|
+
className: "fixed inset-0 z-50 flex glass items-center justify-center p-4",
|
|
1606
1485
|
style: { background: "rgba(0,0,0,0.55)" },
|
|
1607
1486
|
onMouseDown: (e) => {
|
|
1608
1487
|
if (e.target === e.currentTarget) onClose();
|
|
@@ -1615,7 +1494,8 @@ function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customAction
|
|
|
1615
1494
|
" Pinned"
|
|
1616
1495
|
] }),
|
|
1617
1496
|
priority && /* @__PURE__ */ jsx10(Badge, { variant: priority.badge, size: "sm", icon: priority.icon ?? void 0, children: priority.label }),
|
|
1618
|
-
item.category && /* @__PURE__ */ jsx10(Badge, { variant: "outline", size: "sm", children: item.category })
|
|
1497
|
+
item.category && /* @__PURE__ */ jsx10(Badge, { variant: "outline", size: "sm", children: item.category }),
|
|
1498
|
+
headerAction
|
|
1619
1499
|
] }),
|
|
1620
1500
|
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1621
1501
|
onEdit && /* @__PURE__ */ jsx10(
|
|
@@ -1714,6 +1594,7 @@ function BulletinPreview({ item, onClose, onEdit, onDelete, onView, customAction
|
|
|
1714
1594
|
] })
|
|
1715
1595
|
] }) }),
|
|
1716
1596
|
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
1597
|
+
footerAction,
|
|
1717
1598
|
onEdit && /* @__PURE__ */ jsxs9(
|
|
1718
1599
|
"button",
|
|
1719
1600
|
{
|
|
@@ -1775,7 +1656,7 @@ function BulletinDeleteConfirm({
|
|
|
1775
1656
|
setLoading(false);
|
|
1776
1657
|
}
|
|
1777
1658
|
};
|
|
1778
|
-
return
|
|
1659
|
+
return createPortal3(
|
|
1779
1660
|
/* @__PURE__ */ jsx10(
|
|
1780
1661
|
"div",
|
|
1781
1662
|
{
|
|
@@ -1845,7 +1726,7 @@ function BulletinEditModal({
|
|
|
1845
1726
|
setLoading(false);
|
|
1846
1727
|
}
|
|
1847
1728
|
};
|
|
1848
|
-
return
|
|
1729
|
+
return createPortal3(
|
|
1849
1730
|
/* @__PURE__ */ jsx10(
|
|
1850
1731
|
"div",
|
|
1851
1732
|
{
|
|
@@ -2108,6 +1989,9 @@ function BulletinBoard({
|
|
|
2108
1989
|
deleteBaseUrl,
|
|
2109
1990
|
deleteIdKey = "id",
|
|
2110
1991
|
serverPagination,
|
|
1992
|
+
footerAction,
|
|
1993
|
+
headerPreviewAction,
|
|
1994
|
+
footerPreviewAction,
|
|
2111
1995
|
className
|
|
2112
1996
|
}) {
|
|
2113
1997
|
const [previewItem, setPreviewItem] = React8.useState(null);
|
|
@@ -2192,6 +2076,7 @@ function BulletinBoard({
|
|
|
2192
2076
|
/* @__PURE__ */ jsx10(Pin, { className: "h-8 w-8 opacity-20" }),
|
|
2193
2077
|
emptyMessage
|
|
2194
2078
|
] }) : layout === "list" ? /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-3", children: filtered.map((item) => /* @__PURE__ */ jsx10(BulletinCard, { item, variant, layout: "list", onClick: handleCardClick }, item.id)) }) : layout === "masonry" ? /* @__PURE__ */ jsx10("div", { className: cn("gap-4", COLS_CLASS[columns]), style: { display: "grid", gridTemplateRows: "masonry" }, children: filtered.map((item) => /* @__PURE__ */ jsx10(BulletinCard, { item, variant, layout: "masonry", onClick: handleCardClick }, item.id)) }) : /* @__PURE__ */ jsx10("div", { className: cn("grid gap-4", COLS_CLASS[columns]), children: filtered.map((item) => /* @__PURE__ */ jsx10(BulletinCard, { item, variant, layout: "grid", onClick: handleCardClick }, item.id)) }),
|
|
2079
|
+
footerAction && /* @__PURE__ */ jsx10("div", { children: footerAction }),
|
|
2195
2080
|
serverPagination && (() => {
|
|
2196
2081
|
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
2197
2082
|
const totalPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
|
|
@@ -2268,7 +2153,9 @@ function BulletinBoard({
|
|
|
2268
2153
|
setDeleteItem(item);
|
|
2269
2154
|
} : onDelete ? (item) => {
|
|
2270
2155
|
onDelete(item);
|
|
2271
|
-
} : void 0
|
|
2156
|
+
} : void 0,
|
|
2157
|
+
footerAction: footerPreviewAction ? footerPreviewAction(previewItem) : void 0,
|
|
2158
|
+
headerAction: headerPreviewAction
|
|
2272
2159
|
}
|
|
2273
2160
|
),
|
|
2274
2161
|
editItem && editBaseUrl && editFields && /* @__PURE__ */ jsx10(
|
|
@@ -3741,7 +3628,67 @@ function MetricRow({ items, divided = true, className }) {
|
|
|
3741
3628
|
|
|
3742
3629
|
// src/components/ui/data-grid.tsx
|
|
3743
3630
|
import * as React29 from "react";
|
|
3744
|
-
import { createPortal as
|
|
3631
|
+
import { createPortal as createPortal5 } from "react-dom";
|
|
3632
|
+
|
|
3633
|
+
// src/components/tools/decryptPayload.ts
|
|
3634
|
+
import CryptoJS from "crypto-js";
|
|
3635
|
+
function getLaravelSecretKey() {
|
|
3636
|
+
const viteKey = (() => {
|
|
3637
|
+
try {
|
|
3638
|
+
return new Function("return import.meta.env")();
|
|
3639
|
+
} catch {
|
|
3640
|
+
return void 0;
|
|
3641
|
+
}
|
|
3642
|
+
})()?.VITE_LARAVEL_KEY;
|
|
3643
|
+
const legacyKey = globalThis?.process?.env?.REACT_APP_LARAVEL_KEY;
|
|
3644
|
+
const windowKey = globalThis?.__LARAVEL_KEY__;
|
|
3645
|
+
const key = viteKey || legacyKey || windowKey;
|
|
3646
|
+
if (!key) {
|
|
3647
|
+
throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env or inject window.__LARAVEL_KEY__ via Blade.");
|
|
3648
|
+
}
|
|
3649
|
+
return key;
|
|
3650
|
+
}
|
|
3651
|
+
function parseLaravelKey(secretKey) {
|
|
3652
|
+
if (secretKey.startsWith("base64:")) {
|
|
3653
|
+
return CryptoJS.enc.Base64.parse(secretKey.slice("base64:".length));
|
|
3654
|
+
}
|
|
3655
|
+
return CryptoJS.enc.Utf8.parse(secretKey);
|
|
3656
|
+
}
|
|
3657
|
+
function parseLaravelEncryptedPayload(payload) {
|
|
3658
|
+
let jsonStr = payload;
|
|
3659
|
+
try {
|
|
3660
|
+
jsonStr = atob(payload);
|
|
3661
|
+
} catch {
|
|
3662
|
+
}
|
|
3663
|
+
return JSON.parse(jsonStr);
|
|
3664
|
+
}
|
|
3665
|
+
function decryptLaravelPayload(payload, secretKey) {
|
|
3666
|
+
const resolvedKey = secretKey ?? getLaravelSecretKey();
|
|
3667
|
+
const parsed = parseLaravelEncryptedPayload(payload);
|
|
3668
|
+
if (parsed.tag) {
|
|
3669
|
+
throw new Error("Unsupported Laravel cipher (AEAD tag present). Expected AES-*-CBC payload.");
|
|
3670
|
+
}
|
|
3671
|
+
const key = parseLaravelKey(resolvedKey);
|
|
3672
|
+
const expectedMac = CryptoJS.HmacSHA256(parsed.iv + parsed.value, key).toString(CryptoJS.enc.Hex);
|
|
3673
|
+
if (expectedMac !== parsed.mac) {
|
|
3674
|
+
throw new Error("Invalid payload MAC (wrong key or tampered payload).");
|
|
3675
|
+
}
|
|
3676
|
+
const iv = CryptoJS.enc.Base64.parse(parsed.iv);
|
|
3677
|
+
const ciphertext = CryptoJS.enc.Base64.parse(parsed.value);
|
|
3678
|
+
const cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext });
|
|
3679
|
+
const decrypted = CryptoJS.AES.decrypt(cipherParams, key, {
|
|
3680
|
+
iv,
|
|
3681
|
+
mode: CryptoJS.mode.CBC,
|
|
3682
|
+
padding: CryptoJS.pad.Pkcs7
|
|
3683
|
+
});
|
|
3684
|
+
const plaintext = decrypted.toString(CryptoJS.enc.Utf8);
|
|
3685
|
+
if (!plaintext) {
|
|
3686
|
+
throw new Error("Decryption produced empty plaintext (wrong key/cipher).");
|
|
3687
|
+
}
|
|
3688
|
+
return JSON.parse(plaintext);
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
// src/components/ui/data-grid.tsx
|
|
3745
3692
|
import axios4 from "axios";
|
|
3746
3693
|
import { ChevronUp as ChevronUp2, ChevronDown as ChevronDown5, ChevronsUpDown as ChevronsUpDown2, ChevronLeft as ChevronLeft7, ChevronRight as ChevronRight9, Search as Search6, Settings2, Check as Check5, Eye as Eye3, Pencil as Pencil3, Trash as Trash4, Loader2 as Loader23, X as X10 } from "lucide-react";
|
|
3747
3694
|
|
|
@@ -6364,7 +6311,7 @@ function NotificationBanner({
|
|
|
6364
6311
|
|
|
6365
6312
|
// src/components/ui/table.tsx
|
|
6366
6313
|
import * as React28 from "react";
|
|
6367
|
-
import { createPortal as
|
|
6314
|
+
import { createPortal as createPortal4 } from "react-dom";
|
|
6368
6315
|
import axios3 from "axios";
|
|
6369
6316
|
import { ChevronLeft as ChevronLeft6, ChevronRight as ChevronRight8, Search as Search5, Trash2 as Trash22, ChevronsUpDown, ChevronUp, ChevronDown as ChevronDown4, X as X9, Eye as Eye2, Pencil as Pencil2, Trash as Trash3, Loader2 as Loader22 } from "lucide-react";
|
|
6370
6317
|
import { Fragment as Fragment12, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
@@ -6681,11 +6628,11 @@ var MODAL_WIDTH = {
|
|
|
6681
6628
|
full: "max-w-full"
|
|
6682
6629
|
};
|
|
6683
6630
|
function ModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
6684
|
-
return
|
|
6631
|
+
return createPortal4(
|
|
6685
6632
|
/* @__PURE__ */ jsx32(
|
|
6686
6633
|
"div",
|
|
6687
6634
|
{
|
|
6688
|
-
className: "fixed inset-0 z-50 flex items-center justify-center p-4",
|
|
6635
|
+
className: "fixed inset-0 z-50 flex glass items-center justify-center p-4",
|
|
6689
6636
|
style: { background: "rgba(0,0,0,0.5)" },
|
|
6690
6637
|
onMouseDown: (e) => {
|
|
6691
6638
|
if (e.target === e.currentTarget) onClose();
|
|
@@ -8096,7 +8043,7 @@ function Table({
|
|
|
8096
8043
|
}
|
|
8097
8044
|
}
|
|
8098
8045
|
),
|
|
8099
|
-
bulkConfirm &&
|
|
8046
|
+
bulkConfirm && createPortal4(
|
|
8100
8047
|
/* @__PURE__ */ jsx32(
|
|
8101
8048
|
"div",
|
|
8102
8049
|
{
|
|
@@ -8236,7 +8183,7 @@ function ActionBtn2({
|
|
|
8236
8183
|
);
|
|
8237
8184
|
}
|
|
8238
8185
|
function DGModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
8239
|
-
return
|
|
8186
|
+
return createPortal5(
|
|
8240
8187
|
/* @__PURE__ */ jsx33(
|
|
8241
8188
|
"div",
|
|
8242
8189
|
{
|
|
@@ -11042,7 +10989,7 @@ import { PanelLeftClose, PanelLeftOpen, Sun as Sun3, Moon as Moon2, Loader2 as L
|
|
|
11042
10989
|
|
|
11043
10990
|
// src/components/ui/tooltip.tsx
|
|
11044
10991
|
import * as React38 from "react";
|
|
11045
|
-
import * as
|
|
10992
|
+
import * as ReactDOM3 from "react-dom";
|
|
11046
10993
|
import { Fragment as Fragment17, jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11047
10994
|
function Tooltip({
|
|
11048
10995
|
content,
|
|
@@ -11097,7 +11044,7 @@ function Tooltip({
|
|
|
11097
11044
|
onBlur: () => setVisible(false),
|
|
11098
11045
|
children: [
|
|
11099
11046
|
children,
|
|
11100
|
-
visible &&
|
|
11047
|
+
visible && ReactDOM3.createPortal(
|
|
11101
11048
|
/* @__PURE__ */ jsx44(
|
|
11102
11049
|
"div",
|
|
11103
11050
|
{
|
|
@@ -13696,6 +13643,12 @@ function createStore(initialValue, sessionName, expireInterval) {
|
|
|
13696
13643
|
};
|
|
13697
13644
|
return { store, getStore };
|
|
13698
13645
|
}
|
|
13646
|
+
|
|
13647
|
+
// src/core/decryption/decode.ts
|
|
13648
|
+
function decryptResponse(response, key) {
|
|
13649
|
+
const payload = typeof response === "string" ? response : response.data;
|
|
13650
|
+
return decryptLaravelPayload(payload, key);
|
|
13651
|
+
}
|
|
13699
13652
|
export {
|
|
13700
13653
|
Accordion,
|
|
13701
13654
|
Authentication,
|
|
@@ -13795,7 +13748,11 @@ export {
|
|
|
13795
13748
|
Wizard,
|
|
13796
13749
|
api,
|
|
13797
13750
|
createStore,
|
|
13798
|
-
|
|
13751
|
+
decryptLaravelPayload,
|
|
13752
|
+
decryptResponse,
|
|
13753
|
+
getLaravelSecretKey,
|
|
13754
|
+
parseLaravelEncryptedPayload,
|
|
13755
|
+
parseLaravelKey,
|
|
13799
13756
|
useServerDataGrid,
|
|
13800
13757
|
useServerTable,
|
|
13801
13758
|
useTheme,
|