@juv/codego-react-ui 3.1.2 → 3.1.4

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.cjs CHANGED
@@ -2131,13 +2131,19 @@ var import_react_dom = require("react-dom");
2131
2131
 
2132
2132
  // src/components/tools/decryptPayload.ts
2133
2133
  var import_crypto_js = __toESM(require("crypto-js"), 1);
2134
- var import_meta = {};
2135
2134
  function getLaravelSecretKey() {
2136
- const viteKey = import_meta.env["VITE_LARAVEL_KEY"];
2135
+ const viteKey = (() => {
2136
+ try {
2137
+ return new Function("return import.meta.env")();
2138
+ } catch {
2139
+ return void 0;
2140
+ }
2141
+ })()?.VITE_LARAVEL_KEY;
2137
2142
  const legacyKey = globalThis?.process?.env?.REACT_APP_LARAVEL_KEY;
2138
- const key = viteKey || legacyKey;
2143
+ const windowKey = globalThis?.__LARAVEL_KEY__;
2144
+ const key = viteKey || legacyKey || windowKey;
2139
2145
  if (!key) {
2140
- throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env.");
2146
+ throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env or inject window.__LARAVEL_KEY__ via Blade.");
2141
2147
  }
2142
2148
  return key;
2143
2149
  }
@@ -2155,13 +2161,13 @@ function parseLaravelEncryptedPayload(payload) {
2155
2161
  }
2156
2162
  return JSON.parse(jsonStr);
2157
2163
  }
2158
- function decryptLaravelPayload(payload) {
2159
- const secretKey = getLaravelSecretKey();
2164
+ function decryptLaravelPayload(payload, secretKey) {
2165
+ const resolvedKey = secretKey ?? getLaravelSecretKey();
2160
2166
  const parsed = parseLaravelEncryptedPayload(payload);
2161
2167
  if (parsed.tag) {
2162
2168
  throw new Error("Unsupported Laravel cipher (AEAD tag present). Expected AES-*-CBC payload.");
2163
2169
  }
2164
- const key = parseLaravelKey(secretKey);
2170
+ const key = parseLaravelKey(resolvedKey);
2165
2171
  const expectedMac = import_crypto_js.default.HmacSHA256(parsed.iv + parsed.value, key).toString();
2166
2172
  if (expectedMac !== parsed.mac) {
2167
2173
  throw new Error("Invalid payload MAC (wrong key or tampered payload).");
@@ -2178,7 +2184,6 @@ function decryptLaravelPayload(payload) {
2178
2184
  if (!plaintext) {
2179
2185
  throw new Error("Decryption produced empty plaintext (wrong key/cipher).");
2180
2186
  }
2181
- console.log("Decrypted payload:", plaintext);
2182
2187
  return JSON.parse(plaintext);
2183
2188
  }
2184
2189
 
@@ -4899,7 +4904,7 @@ Input.displayName = "Input";
4899
4904
 
4900
4905
  // src/components/ui/data-grid.tsx
4901
4906
  var import_jsx_runtime28 = require("react/jsx-runtime");
4902
- function useServerDataGrid({ url, params, encrypt }) {
4907
+ function useServerDataGrid({ url, params, encrypt, key }) {
4903
4908
  const [data, setData] = React24.useState([]);
4904
4909
  const [columns, setColumns] = React24.useState([]);
4905
4910
  const [currentPage, setCurrentPage] = React24.useState(1);
@@ -4913,7 +4918,7 @@ function useServerDataGrid({ url, params, encrypt }) {
4913
4918
  setError(null);
4914
4919
  import_axios.default.get(url, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
4915
4920
  if (cancelled) return;
4916
- const payload = encrypt ? decryptLaravelPayload(res) : res;
4921
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
4917
4922
  setData(payload.data);
4918
4923
  const rawTotal = payload.total;
4919
4924
  const rawPerPage = payload.per_page;
@@ -4932,9 +4937,9 @@ function useServerDataGrid({ url, params, encrypt }) {
4932
4937
  setPagination(pg);
4933
4938
  if (payload.data.length > 0) {
4934
4939
  setColumns(
4935
- Object.keys(payload.data[0]).map((key) => ({
4936
- key,
4937
- header: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
4940
+ Object.keys(payload.data[0]).map((key2) => ({
4941
+ key: key2,
4942
+ header: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
4938
4943
  }))
4939
4944
  );
4940
4945
  }
@@ -9563,7 +9568,7 @@ var import_react_dom2 = require("react-dom");
9563
9568
  var import_axios2 = __toESM(require("axios"), 1);
9564
9569
  var import_lucide_react28 = require("lucide-react");
9565
9570
  var import_jsx_runtime55 = require("react/jsx-runtime");
9566
- function useServerTable({ url, params, encrypt }) {
9571
+ function useServerTable({ url, params, encrypt, key }) {
9567
9572
  const [data, setData] = React44.useState([]);
9568
9573
  const [columns, setColumns] = React44.useState([]);
9569
9574
  const [currentPage, setCurrentPage] = React44.useState(1);
@@ -9579,7 +9584,7 @@ function useServerTable({ url, params, encrypt }) {
9579
9584
  params: { ...params, page: currentPage }
9580
9585
  }).then(({ data: res }) => {
9581
9586
  if (cancelled) return;
9582
- const payload = encrypt ? decryptLaravelPayload(res) : res;
9587
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
9583
9588
  setData(payload.data);
9584
9589
  const rawTotal = payload.total;
9585
9590
  const rawPerPage = payload.per_page;
@@ -9598,9 +9603,9 @@ function useServerTable({ url, params, encrypt }) {
9598
9603
  setPagination(pg);
9599
9604
  if (payload.data.length > 0) {
9600
9605
  setColumns(
9601
- Object.keys(payload.data[0]).map((key) => ({
9602
- key,
9603
- title: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
9606
+ Object.keys(payload.data[0]).map((key2) => ({
9607
+ key: key2,
9608
+ title: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
9604
9609
  }))
9605
9610
  );
9606
9611
  }
package/dist/index.d.cts CHANGED
@@ -361,8 +361,10 @@ interface UseServerTableOptions {
361
361
  url: string;
362
362
  /** Extra query params merged on every request */
363
363
  params?: Record<string, string | number>;
364
- /** If true, the response is expected to be a Laravel-encrypted payload and will be decrypted using VITE_LARAVEL_KEY */
364
+ /** If true, the response is expected to be a Laravel-encrypted payload */
365
365
  encrypt?: boolean;
366
+ /** Laravel APP_KEY used for decryption. Pass import.meta.env["VITE_LARAVEL_KEY"] */
367
+ key?: string;
366
368
  }
367
369
  interface UseServerTableReturn<T> {
368
370
  data: T[];
@@ -380,7 +382,7 @@ interface ServerPaginationProp {
380
382
  currentPage: number;
381
383
  goToPage: (page: number) => void;
382
384
  }
383
- declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt }: UseServerTableOptions): UseServerTableReturn<T>;
385
+ declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key }: UseServerTableOptions): UseServerTableReturn<T>;
384
386
  type ActionFieldType = "input" | "password" | "textarea" | "checkbox" | "toggle" | "select" | "radio" | "slider" | "tag-input" | "otp" | "combobox" | "color-picker" | "date-range" | "rich-text" | "file-upload" | "repeater";
385
387
  interface ActionField {
386
388
  key: string;
@@ -467,8 +469,10 @@ interface ServerDataGridProp {
467
469
  interface UseServerDataGridOptions {
468
470
  url: string;
469
471
  params?: Record<string, string | number>;
470
- /** If true, the response is expected to be a Laravel-encrypted payload and will be decrypted using VITE_LARAVEL_KEY */
472
+ /** If true, the response is expected to be a Laravel-encrypted payload */
471
473
  encrypt?: boolean;
474
+ /** Laravel APP_KEY used for decryption. Pass import.meta.env["VITE_LARAVEL_KEY"] */
475
+ key?: string;
472
476
  }
473
477
  interface UseServerDataGridReturn<T> {
474
478
  data: T[];
@@ -481,7 +485,7 @@ interface UseServerDataGridReturn<T> {
481
485
  goToPage: (page: number) => void;
482
486
  reload: () => void;
483
487
  }
484
- declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
488
+ declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt, key }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
485
489
  type SortDir = "asc" | "desc" | null;
486
490
  interface DataGridColumn<T> {
487
491
  key: keyof T | string;
package/dist/index.d.ts CHANGED
@@ -361,8 +361,10 @@ interface UseServerTableOptions {
361
361
  url: string;
362
362
  /** Extra query params merged on every request */
363
363
  params?: Record<string, string | number>;
364
- /** If true, the response is expected to be a Laravel-encrypted payload and will be decrypted using VITE_LARAVEL_KEY */
364
+ /** If true, the response is expected to be a Laravel-encrypted payload */
365
365
  encrypt?: boolean;
366
+ /** Laravel APP_KEY used for decryption. Pass import.meta.env["VITE_LARAVEL_KEY"] */
367
+ key?: string;
366
368
  }
367
369
  interface UseServerTableReturn<T> {
368
370
  data: T[];
@@ -380,7 +382,7 @@ interface ServerPaginationProp {
380
382
  currentPage: number;
381
383
  goToPage: (page: number) => void;
382
384
  }
383
- declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt }: UseServerTableOptions): UseServerTableReturn<T>;
385
+ declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key }: UseServerTableOptions): UseServerTableReturn<T>;
384
386
  type ActionFieldType = "input" | "password" | "textarea" | "checkbox" | "toggle" | "select" | "radio" | "slider" | "tag-input" | "otp" | "combobox" | "color-picker" | "date-range" | "rich-text" | "file-upload" | "repeater";
385
387
  interface ActionField {
386
388
  key: string;
@@ -467,8 +469,10 @@ interface ServerDataGridProp {
467
469
  interface UseServerDataGridOptions {
468
470
  url: string;
469
471
  params?: Record<string, string | number>;
470
- /** If true, the response is expected to be a Laravel-encrypted payload and will be decrypted using VITE_LARAVEL_KEY */
472
+ /** If true, the response is expected to be a Laravel-encrypted payload */
471
473
  encrypt?: boolean;
474
+ /** Laravel APP_KEY used for decryption. Pass import.meta.env["VITE_LARAVEL_KEY"] */
475
+ key?: string;
472
476
  }
473
477
  interface UseServerDataGridReturn<T> {
474
478
  data: T[];
@@ -481,7 +485,7 @@ interface UseServerDataGridReturn<T> {
481
485
  goToPage: (page: number) => void;
482
486
  reload: () => void;
483
487
  }
484
- declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
488
+ declare function useServerDataGrid<T extends Record<string, any>>({ url, params, encrypt, key }: UseServerDataGridOptions): UseServerDataGridReturn<T>;
485
489
  type SortDir = "asc" | "desc" | null;
486
490
  interface DataGridColumn<T> {
487
491
  key: keyof T | string;
@@ -59632,13 +59632,19 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
59632
59632
 
59633
59633
  // src/components/tools/decryptPayload.ts
59634
59634
  var import_crypto_js = __toESM(require_crypto_js(), 1);
59635
- var import_meta = {};
59636
59635
  function getLaravelSecretKey() {
59637
- const viteKey = import_meta.env["VITE_LARAVEL_KEY"];
59636
+ const viteKey = (() => {
59637
+ try {
59638
+ return new Function("return import.meta.env")();
59639
+ } catch {
59640
+ return void 0;
59641
+ }
59642
+ })()?.VITE_LARAVEL_KEY;
59638
59643
  const legacyKey = globalThis?.process?.env?.REACT_APP_LARAVEL_KEY;
59639
- const key = viteKey || legacyKey;
59644
+ const windowKey = globalThis?.__LARAVEL_KEY__;
59645
+ const key = viteKey || legacyKey || windowKey;
59640
59646
  if (!key) {
59641
- throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env.");
59647
+ throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env or inject window.__LARAVEL_KEY__ via Blade.");
59642
59648
  }
59643
59649
  return key;
59644
59650
  }
@@ -59656,13 +59662,13 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
59656
59662
  }
59657
59663
  return JSON.parse(jsonStr);
59658
59664
  }
59659
- function decryptLaravelPayload(payload) {
59660
- const secretKey = getLaravelSecretKey();
59665
+ function decryptLaravelPayload(payload, secretKey) {
59666
+ const resolvedKey = secretKey ?? getLaravelSecretKey();
59661
59667
  const parsed = parseLaravelEncryptedPayload(payload);
59662
59668
  if (parsed.tag) {
59663
59669
  throw new Error("Unsupported Laravel cipher (AEAD tag present). Expected AES-*-CBC payload.");
59664
59670
  }
59665
- const key = parseLaravelKey(secretKey);
59671
+ const key = parseLaravelKey(resolvedKey);
59666
59672
  const expectedMac = import_crypto_js.default.HmacSHA256(parsed.iv + parsed.value, key).toString();
59667
59673
  if (expectedMac !== parsed.mac) {
59668
59674
  throw new Error("Invalid payload MAC (wrong key or tampered payload).");
@@ -59679,7 +59685,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
59679
59685
  if (!plaintext) {
59680
59686
  throw new Error("Decryption produced empty plaintext (wrong key/cipher).");
59681
59687
  }
59682
- console.log("Decrypted payload:", plaintext);
59683
59688
  return JSON.parse(plaintext);
59684
59689
  }
59685
59690
 
@@ -68023,7 +68028,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68023
68028
 
68024
68029
  // src/components/ui/data-grid.tsx
68025
68030
  var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
68026
- function useServerDataGrid({ url: url2, params, encrypt }) {
68031
+ function useServerDataGrid({ url: url2, params, encrypt, key }) {
68027
68032
  const [data, setData] = React24.useState([]);
68028
68033
  const [columns, setColumns] = React24.useState([]);
68029
68034
  const [currentPage, setCurrentPage] = React24.useState(1);
@@ -68037,7 +68042,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68037
68042
  setError(null);
68038
68043
  axios_default.get(url2, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
68039
68044
  if (cancelled) return;
68040
- const payload = encrypt ? decryptLaravelPayload(res) : res;
68045
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
68041
68046
  setData(payload.data);
68042
68047
  const rawTotal = payload.total;
68043
68048
  const rawPerPage = payload.per_page;
@@ -68056,9 +68061,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
68056
68061
  setPagination(pg);
68057
68062
  if (payload.data.length > 0) {
68058
68063
  setColumns(
68059
- Object.keys(payload.data[0]).map((key) => ({
68060
- key,
68061
- header: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
68064
+ Object.keys(payload.data[0]).map((key2) => ({
68065
+ key: key2,
68066
+ header: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
68062
68067
  }))
68063
68068
  );
68064
68069
  }
@@ -73098,7 +73103,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73098
73103
  var React46 = __toESM(require_react(), 1);
73099
73104
  var import_react_dom3 = __toESM(require_react_dom(), 1);
73100
73105
  var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
73101
- function useServerTable({ url: url2, params, encrypt }) {
73106
+ function useServerTable({ url: url2, params, encrypt, key }) {
73102
73107
  const [data, setData] = React46.useState([]);
73103
73108
  const [columns, setColumns] = React46.useState([]);
73104
73109
  const [currentPage, setCurrentPage] = React46.useState(1);
@@ -73114,7 +73119,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73114
73119
  params: { ...params, page: currentPage }
73115
73120
  }).then(({ data: res }) => {
73116
73121
  if (cancelled) return;
73117
- const payload = encrypt ? decryptLaravelPayload(res) : res;
73122
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
73118
73123
  setData(payload.data);
73119
73124
  const rawTotal = payload.total;
73120
73125
  const rawPerPage = payload.per_page;
@@ -73133,9 +73138,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
73133
73138
  setPagination(pg);
73134
73139
  if (payload.data.length > 0) {
73135
73140
  setColumns(
73136
- Object.keys(payload.data[0]).map((key) => ({
73137
- key,
73138
- title: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
73141
+ Object.keys(payload.data[0]).map((key2) => ({
73142
+ key: key2,
73143
+ title: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
73139
73144
  }))
73140
73145
  );
73141
73146
  }
package/dist/index.js CHANGED
@@ -2001,11 +2001,18 @@ import { createPortal as createPortal2 } from "react-dom";
2001
2001
  // src/components/tools/decryptPayload.ts
2002
2002
  import CryptoJS from "crypto-js";
2003
2003
  function getLaravelSecretKey() {
2004
- const viteKey = import.meta.env["VITE_LARAVEL_KEY"];
2004
+ const viteKey = (() => {
2005
+ try {
2006
+ return new Function("return import.meta.env")();
2007
+ } catch {
2008
+ return void 0;
2009
+ }
2010
+ })()?.VITE_LARAVEL_KEY;
2005
2011
  const legacyKey = globalThis?.process?.env?.REACT_APP_LARAVEL_KEY;
2006
- const key = viteKey || legacyKey;
2012
+ const windowKey = globalThis?.__LARAVEL_KEY__;
2013
+ const key = viteKey || legacyKey || windowKey;
2007
2014
  if (!key) {
2008
- throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env.");
2015
+ throw new Error("Missing Laravel decryption key. Set VITE_LARAVEL_KEY in your .env or inject window.__LARAVEL_KEY__ via Blade.");
2009
2016
  }
2010
2017
  return key;
2011
2018
  }
@@ -2023,13 +2030,13 @@ function parseLaravelEncryptedPayload(payload) {
2023
2030
  }
2024
2031
  return JSON.parse(jsonStr);
2025
2032
  }
2026
- function decryptLaravelPayload(payload) {
2027
- const secretKey = getLaravelSecretKey();
2033
+ function decryptLaravelPayload(payload, secretKey) {
2034
+ const resolvedKey = secretKey ?? getLaravelSecretKey();
2028
2035
  const parsed = parseLaravelEncryptedPayload(payload);
2029
2036
  if (parsed.tag) {
2030
2037
  throw new Error("Unsupported Laravel cipher (AEAD tag present). Expected AES-*-CBC payload.");
2031
2038
  }
2032
- const key = parseLaravelKey(secretKey);
2039
+ const key = parseLaravelKey(resolvedKey);
2033
2040
  const expectedMac = CryptoJS.HmacSHA256(parsed.iv + parsed.value, key).toString();
2034
2041
  if (expectedMac !== parsed.mac) {
2035
2042
  throw new Error("Invalid payload MAC (wrong key or tampered payload).");
@@ -2046,7 +2053,6 @@ function decryptLaravelPayload(payload) {
2046
2053
  if (!plaintext) {
2047
2054
  throw new Error("Decryption produced empty plaintext (wrong key/cipher).");
2048
2055
  }
2049
- console.log("Decrypted payload:", plaintext);
2050
2056
  return JSON.parse(plaintext);
2051
2057
  }
2052
2058
 
@@ -4784,7 +4790,7 @@ Input.displayName = "Input";
4784
4790
 
4785
4791
  // src/components/ui/data-grid.tsx
4786
4792
  import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs27 } from "react/jsx-runtime";
4787
- function useServerDataGrid({ url, params, encrypt }) {
4793
+ function useServerDataGrid({ url, params, encrypt, key }) {
4788
4794
  const [data, setData] = React24.useState([]);
4789
4795
  const [columns, setColumns] = React24.useState([]);
4790
4796
  const [currentPage, setCurrentPage] = React24.useState(1);
@@ -4798,7 +4804,7 @@ function useServerDataGrid({ url, params, encrypt }) {
4798
4804
  setError(null);
4799
4805
  axios.get(url, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
4800
4806
  if (cancelled) return;
4801
- const payload = encrypt ? decryptLaravelPayload(res) : res;
4807
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
4802
4808
  setData(payload.data);
4803
4809
  const rawTotal = payload.total;
4804
4810
  const rawPerPage = payload.per_page;
@@ -4817,9 +4823,9 @@ function useServerDataGrid({ url, params, encrypt }) {
4817
4823
  setPagination(pg);
4818
4824
  if (payload.data.length > 0) {
4819
4825
  setColumns(
4820
- Object.keys(payload.data[0]).map((key) => ({
4821
- key,
4822
- header: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
4826
+ Object.keys(payload.data[0]).map((key2) => ({
4827
+ key: key2,
4828
+ header: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
4823
4829
  }))
4824
4830
  );
4825
4831
  }
@@ -9448,7 +9454,7 @@ import { createPortal as createPortal4 } from "react-dom";
9448
9454
  import axios2 from "axios";
9449
9455
  import { ChevronLeft as ChevronLeft6, ChevronRight as ChevronRight9, Search as Search5, Trash2 as Trash23, ChevronsUpDown as ChevronsUpDown2, ChevronUp as ChevronUp2, ChevronDown as ChevronDown7, X as X13, Eye as Eye2, Pencil as Pencil2, Trash as Trash3, Loader2 as Loader22 } from "lucide-react";
9450
9456
  import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs48 } from "react/jsx-runtime";
9451
- function useServerTable({ url, params, encrypt }) {
9457
+ function useServerTable({ url, params, encrypt, key }) {
9452
9458
  const [data, setData] = React44.useState([]);
9453
9459
  const [columns, setColumns] = React44.useState([]);
9454
9460
  const [currentPage, setCurrentPage] = React44.useState(1);
@@ -9464,7 +9470,7 @@ function useServerTable({ url, params, encrypt }) {
9464
9470
  params: { ...params, page: currentPage }
9465
9471
  }).then(({ data: res }) => {
9466
9472
  if (cancelled) return;
9467
- const payload = encrypt ? decryptLaravelPayload(res) : res;
9473
+ const payload = encrypt ? decryptLaravelPayload(res, key) : res;
9468
9474
  setData(payload.data);
9469
9475
  const rawTotal = payload.total;
9470
9476
  const rawPerPage = payload.per_page;
@@ -9483,9 +9489,9 @@ function useServerTable({ url, params, encrypt }) {
9483
9489
  setPagination(pg);
9484
9490
  if (payload.data.length > 0) {
9485
9491
  setColumns(
9486
- Object.keys(payload.data[0]).map((key) => ({
9487
- key,
9488
- title: key.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
9492
+ Object.keys(payload.data[0]).map((key2) => ({
9493
+ key: key2,
9494
+ title: key2.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())
9489
9495
  }))
9490
9496
  );
9491
9497
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "3.1.2",
7
+ "version": "3.1.4",
8
8
  "description": "Reusable React UI components",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",