@raystack/frontier 0.115.0 → 0.116.0

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.
@@ -105,8 +105,8 @@ function convertBillingAddressToString(address) {
105
105
  // admin/views/roles/columns.tsx
106
106
  var import_apsara = require("@raystack/apsara");
107
107
 
108
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-G6S4ETkbGQKB/sdk/admin/views/roles/roles.module.css.js
109
- var digest = "24f99403ae2ed1c125c2d14b7b2d9156bdb4606905ade113fffcef934bf77bc2";
108
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-wWZzz6wyIv4f/sdk/admin/views/roles/roles.module.css.js
109
+ var digest = "ca86a8f6a016fea34e8a438243395404d432f13dbbb6fa6a29b5c46c35f95359";
110
110
  var css = `._tableRoot_1d549_1 {
111
111
  width: 100%;
112
112
  }
@@ -573,8 +573,8 @@ var UploadIcon = /* @__PURE__ */ (0, import_react.forwardRef)(function(_ref, for
573
573
  // admin/components/PageHeader.tsx
574
574
  var import_apsara2 = require("@raystack/apsara");
575
575
 
576
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-IrUwHKHyyYDG/sdk/admin/components/page-header.module.css.js
577
- var digest2 = "d0f9adae50d8488266fbe69769185cec58660bbfc1aaaba2034546dbfaf9f526";
576
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-rrqib9CeTiQ8/sdk/admin/components/page-header.module.css.js
577
+ var digest2 = "35bfc033b4e67da85d365a72ae879a83ff774fef73c3fb082518c09ecbee03cd";
578
578
  var css2 = `._breadcrumb_1kaun_1 {
579
579
  list-style: none;
580
580
  padding: 0;
@@ -696,8 +696,8 @@ function PageTitle({ title, appName }) {
696
696
  return null;
697
697
  }
698
698
 
699
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-u5CgLnZl1Hdb/sdk/admin/views/roles/roles.module.css.js
700
- var digest3 = "771921674bf992a93467ee20484589486b4fd06034c0c4d37277cc3551672f10";
699
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-DZbeJS3cWxBw/sdk/admin/views/roles/roles.module.css.js
700
+ var digest3 = "301d8859373fdb447850f3ee18183a241ecdbb0389790a12866fdc8b483b5e1f";
701
701
  var css3 = `._tableRoot_1d549_1 {
702
702
  width: 100%;
703
703
  }
@@ -884,13 +884,12 @@ var noDataChildren = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_apsara5
884
884
 
885
885
  // admin/views/invoices/index.tsx
886
886
  var import_apsara8 = require("@raystack/apsara");
887
- var import_react6 = require("react");
888
887
 
889
888
  // admin/views/invoices/navbar.tsx
890
889
  var import_apsara6 = require("@raystack/apsara");
891
890
 
892
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-16GhaEwTY3Gd/sdk/admin/components/navbar.module.css.js
893
- var digest4 = "4d2194395d1a86f77c6abd170c239313e85fc72412e11e319881f25352b51cb5";
891
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-IfDhcJAecQgK/sdk/admin/components/navbar.module.css.js
892
+ var digest4 = "c735f91843056bcb2047da0a6407046ee897b5eb7fb48267f6fe8b85fb2e8b0e";
894
893
  var css4 = `._navbar_641ya_1 {
895
894
  padding: var(--rs-space-4) var(--rs-space-7);
896
895
  border-bottom: 0.5px solid var(--rs-color-border-base-primary);
@@ -984,8 +983,8 @@ var InvoicesNavabar = ({ searchQuery }) => {
984
983
  ] });
985
984
  };
986
985
 
987
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-xG72iokrk3Hg/sdk/admin/views/invoices/invoices.module.css.js
988
- var digest5 = "8c9d800be6cad5e0d24d94e1d3344d3bd33855e1c368e62e2746e89c33a37dc1";
986
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-46UV2QlO3ABf/sdk/admin/views/invoices/invoices.module.css.js
987
+ var digest5 = "7e6c543b79e1c9bc12e5db75166cefdd493149fdd81f644a3d720b5e3a952653";
989
988
  var css5 = `._table_xk3nj_1 {
990
989
  height: auto;
991
990
  }
@@ -1066,8 +1065,8 @@ function formatInviteExpiry(expiresAt) {
1066
1065
  };
1067
1066
  }
1068
1067
 
1069
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-X7qt8NXzZ7dg/sdk/admin/views/invoices/invoices.module.css.js
1070
- var digest6 = "b89d4d5309e41ceafb2a822ac3df8d1afffd394162f12901a84182eed1142577";
1068
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-r5xDEoZvbK2X/sdk/admin/views/invoices/invoices.module.css.js
1069
+ var digest6 = "bc60ad52de407cce247be9ec9bdecfc7087105fdc42901d282dee95d46489f02";
1071
1070
  var css6 = `._table_xk3nj_1 {
1072
1071
  height: auto;
1073
1072
  }
@@ -1166,8 +1165,8 @@ var getColumns2 = ({ t }) => {
1166
1165
  };
1167
1166
 
1168
1167
  // admin/views/invoices/index.tsx
1169
- var import_connect_query2 = require("@connectrpc/connect-query");
1170
- var import_frontier3 = require("@raystack/proton/frontier");
1168
+ var import_connect_query3 = require("@connectrpc/connect-query");
1169
+ var import_frontier4 = require("@raystack/proton/frontier");
1171
1170
 
1172
1171
  // utils/connect-pagination.ts
1173
1172
  var DEFAULT_PAGE_SIZE = 50;
@@ -1207,6 +1206,113 @@ function getGroupCountMapFromFirstPage(infiniteData) {
1207
1206
  return { [groupKey]: groupCount };
1208
1207
  }
1209
1208
 
1209
+ // shared/terminology.tsx
1210
+ var import_react5 = require("react");
1211
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1212
+ var applyCase = (text, caseType) => {
1213
+ switch (caseType) {
1214
+ case "lower":
1215
+ return text.toLowerCase();
1216
+ case "upper":
1217
+ return text.toUpperCase();
1218
+ case "capital":
1219
+ return text.charAt(0).toUpperCase() + text.slice(1);
1220
+ default:
1221
+ return text;
1222
+ }
1223
+ };
1224
+ var createEntity = (singular, plural) => {
1225
+ return ({
1226
+ plural: isPlural = false,
1227
+ case: caseType
1228
+ } = {}) => {
1229
+ const text = isPlural ? plural : singular;
1230
+ return applyCase(text, caseType);
1231
+ };
1232
+ };
1233
+ var DEFAULT_TERMINOLOGY = {
1234
+ organization: { singular: "Organization", plural: "Organizations" },
1235
+ project: { singular: "Project", plural: "Projects" },
1236
+ team: { singular: "Team", plural: "Teams" },
1237
+ member: { singular: "Member", plural: "Members" },
1238
+ user: { singular: "User", plural: "Users" },
1239
+ appName: "Frontier"
1240
+ };
1241
+ function createTerminologyMap(terminology, defaults = DEFAULT_TERMINOLOGY) {
1242
+ const t = terminology || defaults;
1243
+ return {
1244
+ organization: createEntity(
1245
+ t.organization?.singular || defaults.organization.singular,
1246
+ t.organization?.plural || defaults.organization.plural
1247
+ ),
1248
+ project: createEntity(
1249
+ t.project?.singular || defaults.project.singular,
1250
+ t.project?.plural || defaults.project.plural
1251
+ ),
1252
+ team: createEntity(
1253
+ t.team?.singular || defaults.team.singular,
1254
+ t.team?.plural || defaults.team.plural
1255
+ ),
1256
+ member: createEntity(
1257
+ t.member?.singular || defaults.member.singular,
1258
+ t.member?.plural || defaults.member.plural
1259
+ ),
1260
+ user: createEntity(
1261
+ t.user?.singular || defaults.user.singular,
1262
+ t.user?.plural || defaults.user.plural
1263
+ ),
1264
+ appName: createEntity(
1265
+ t.appName || defaults.appName,
1266
+ t.appName || defaults.appName
1267
+ )
1268
+ };
1269
+ }
1270
+ var TerminologyContext = (0, import_react5.createContext)(
1271
+ createTerminologyMap()
1272
+ );
1273
+ var TerminologyProvider = ({
1274
+ children,
1275
+ terminology,
1276
+ defaults
1277
+ }) => {
1278
+ const map = (0, import_react5.useMemo)(
1279
+ () => createTerminologyMap(terminology, defaults),
1280
+ [terminology, defaults]
1281
+ );
1282
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TerminologyContext.Provider, { value: map, children });
1283
+ };
1284
+ var useTerminology = () => {
1285
+ return (0, import_react5.useContext)(TerminologyContext);
1286
+ };
1287
+
1288
+ // admin/hooks/useLoadMore.ts
1289
+ var import_react6 = require("react");
1290
+ var useLoadMore = ({
1291
+ hasNextPage,
1292
+ isFetchingNextPage,
1293
+ fetchNextPage,
1294
+ isError,
1295
+ label
1296
+ }) => {
1297
+ const isLoadingMoreRef = (0, import_react6.useRef)(false);
1298
+ return (0, import_react6.useCallback)(async () => {
1299
+ if (!hasNextPage || isFetchingNextPage || isError || isLoadingMoreRef.current) {
1300
+ return;
1301
+ }
1302
+ isLoadingMoreRef.current = true;
1303
+ try {
1304
+ await fetchNextPage();
1305
+ } catch (error) {
1306
+ console.error(`Error loading more ${label}:`, error);
1307
+ } finally {
1308
+ isLoadingMoreRef.current = false;
1309
+ }
1310
+ }, [hasNextPage, isFetchingNextPage, isError, fetchNextPage, label]);
1311
+ };
1312
+
1313
+ // admin/hooks/useServerTableQuery.ts
1314
+ var import_react8 = require("react");
1315
+
1210
1316
  // utils/transform-query.ts
1211
1317
  var import_frontier2 = require("@raystack/proton/frontier");
1212
1318
  var import_protobuf = require("@bufbuild/protobuf");
@@ -1300,84 +1406,90 @@ function transformDataTableQueryToRQLRequest(query, options = {}) {
1300
1406
  return rqlRequest;
1301
1407
  }
1302
1408
 
1303
- // shared/terminology.tsx
1304
- var import_react5 = require("react");
1305
- var import_jsx_runtime9 = require("react/jsx-runtime");
1306
- var applyCase = (text, caseType) => {
1307
- switch (caseType) {
1308
- case "lower":
1309
- return text.toLowerCase();
1310
- case "upper":
1311
- return text.toUpperCase();
1312
- case "capital":
1313
- return text.charAt(0).toUpperCase() + text.slice(1);
1409
+ // hooks/index.ts
1410
+ var import_connect_query2 = require("@connectrpc/connect-query");
1411
+ var import_connect2 = require("@connectrpc/connect");
1412
+
1413
+ // utils/error.ts
1414
+ var import_connect = require("@connectrpc/connect");
1415
+ var DEFAULT_ERROR_MESSAGE = "Something went wrong";
1416
+ function handleConnectError(error, handlers) {
1417
+ const connectError = error instanceof import_connect.ConnectError ? error : new import_connect.ConnectError(
1418
+ typeof error === "string" ? error : error instanceof Error ? error.message : DEFAULT_ERROR_MESSAGE
1419
+ );
1420
+ const defaultHandler = handlers?.Default ?? ((err) => console.error(err.message));
1421
+ switch (connectError.code) {
1422
+ case import_connect.Code.AlreadyExists:
1423
+ handlers?.AlreadyExists ? handlers.AlreadyExists(connectError) : defaultHandler(connectError);
1424
+ break;
1425
+ case import_connect.Code.InvalidArgument:
1426
+ handlers?.InvalidArgument ? handlers.InvalidArgument(connectError) : defaultHandler(connectError);
1427
+ break;
1428
+ case import_connect.Code.PermissionDenied:
1429
+ handlers?.PermissionDenied ? handlers.PermissionDenied(connectError) : defaultHandler(connectError);
1430
+ break;
1431
+ case import_connect.Code.NotFound:
1432
+ handlers?.NotFound ? handlers.NotFound(connectError) : defaultHandler(connectError);
1433
+ break;
1434
+ case import_connect.Code.FailedPrecondition:
1435
+ handlers?.FailedPrecondition ? handlers.FailedPrecondition(connectError) : defaultHandler(connectError);
1436
+ break;
1314
1437
  default:
1315
- return text;
1438
+ defaultHandler(connectError);
1316
1439
  }
1317
- };
1318
- var createEntity = (singular, plural) => {
1319
- return ({
1320
- plural: isPlural = false,
1321
- case: caseType
1322
- } = {}) => {
1323
- const text = isPlural ? plural : singular;
1324
- return applyCase(text, caseType);
1325
- };
1326
- };
1327
- var DEFAULT_TERMINOLOGY = {
1328
- organization: { singular: "Organization", plural: "Organizations" },
1329
- project: { singular: "Project", plural: "Projects" },
1330
- team: { singular: "Team", plural: "Teams" },
1331
- member: { singular: "Member", plural: "Members" },
1332
- user: { singular: "User", plural: "Users" },
1333
- appName: "Frontier"
1334
- };
1335
- function createTerminologyMap(terminology, defaults = DEFAULT_TERMINOLOGY) {
1336
- const t = terminology || defaults;
1337
- return {
1338
- organization: createEntity(
1339
- t.organization?.singular || defaults.organization.singular,
1340
- t.organization?.plural || defaults.organization.plural
1341
- ),
1342
- project: createEntity(
1343
- t.project?.singular || defaults.project.singular,
1344
- t.project?.plural || defaults.project.plural
1345
- ),
1346
- team: createEntity(
1347
- t.team?.singular || defaults.team.singular,
1348
- t.team?.plural || defaults.team.plural
1349
- ),
1350
- member: createEntity(
1351
- t.member?.singular || defaults.member.singular,
1352
- t.member?.plural || defaults.member.plural
1353
- ),
1354
- user: createEntity(
1355
- t.user?.singular || defaults.user.singular,
1356
- t.user?.plural || defaults.user.plural
1357
- ),
1358
- appName: createEntity(
1359
- t.appName || defaults.appName,
1360
- t.appName || defaults.appName
1361
- )
1362
- };
1363
1440
  }
1364
- var TerminologyContext = (0, import_react5.createContext)(
1365
- createTerminologyMap()
1366
- );
1367
- var TerminologyProvider = ({
1368
- children,
1369
- terminology,
1370
- defaults
1371
- }) => {
1372
- const map = (0, import_react5.useMemo)(
1373
- () => createTerminologyMap(terminology, defaults),
1374
- [terminology, defaults]
1375
- );
1376
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TerminologyContext.Provider, { value: map, children });
1377
- };
1378
- var useTerminology = () => {
1379
- return (0, import_react5.useContext)(TerminologyContext);
1380
- };
1441
+
1442
+ // hooks/index.ts
1443
+ var import_frontier3 = require("@raystack/proton/frontier");
1444
+ var import_react_query = require("@tanstack/react-query");
1445
+ var import_protobuf2 = require("@bufbuild/protobuf");
1446
+
1447
+ // hooks/useDebouncedValue.ts
1448
+ var import_react7 = require("react");
1449
+ function useDebouncedValue(value, delay) {
1450
+ const [debouncedValue, setDebouncedValue] = (0, import_react7.useState)(value);
1451
+ (0, import_react7.useEffect)(() => {
1452
+ const timer = setTimeout(() => setDebouncedValue(value), delay);
1453
+ return () => clearTimeout(timer);
1454
+ }, [value, delay]);
1455
+ return debouncedValue;
1456
+ }
1457
+
1458
+ // admin/hooks/useServerTableQuery.ts
1459
+ function useServerTableQuery({
1460
+ defaultSort,
1461
+ transformOptions,
1462
+ search,
1463
+ mapQuery,
1464
+ debounceMs = 200
1465
+ } = {}) {
1466
+ const [tableQuery, setTableQuery] = (0, import_react8.useState)(() => ({
1467
+ offset: 0,
1468
+ limit: DEFAULT_PAGE_SIZE,
1469
+ sort: defaultSort ? [defaultSort] : []
1470
+ }));
1471
+ const transformOptionsRef = (0, import_react8.useRef)(transformOptions);
1472
+ transformOptionsRef.current = transformOptions;
1473
+ const mapQueryRef = (0, import_react8.useRef)(mapQuery);
1474
+ mapQueryRef.current = mapQuery;
1475
+ const computedQuery = (0, import_react8.useMemo)(() => {
1476
+ const mapped = mapQueryRef.current ? mapQueryRef.current(tableQuery) : tableQuery;
1477
+ const rql = transformDataTableQueryToRQLRequest(
1478
+ mapped,
1479
+ transformOptionsRef.current
1480
+ );
1481
+ return search === void 0 ? rql : { ...rql, search };
1482
+ }, [tableQuery, search]);
1483
+ const rqlQuery = useDebouncedValue(computedQuery, debounceMs);
1484
+ const onTableQueryChange = (0, import_react8.useCallback)((query) => {
1485
+ setTableQuery({
1486
+ ...query,
1487
+ offset: 0,
1488
+ limit: query.limit || DEFAULT_PAGE_SIZE
1489
+ });
1490
+ }, []);
1491
+ return { tableQuery, rqlQuery, onTableQueryChange };
1492
+ }
1381
1493
 
1382
1494
  // admin/views/invoices/index.tsx
1383
1495
  var import_jsx_runtime10 = require("react/jsx-runtime");
@@ -1397,16 +1509,18 @@ var NoInvoices = () => {
1397
1509
  );
1398
1510
  };
1399
1511
  var DEFAULT_SORT = { name: "createdAt", order: "desc" };
1400
- var INITIAL_QUERY = {
1401
- offset: 0,
1402
- limit: DEFAULT_PAGE_SIZE
1403
- };
1404
1512
  function InvoicesView({ appName } = {}) {
1405
1513
  const t = useTerminology();
1406
- const [tableQuery, setTableQuery] = (0, import_react6.useState)(INITIAL_QUERY);
1407
- const query = transformDataTableQueryToRQLRequest(tableQuery, {
1408
- fieldNameMapping: {
1409
- createdAt: "created_at"
1514
+ const {
1515
+ tableQuery,
1516
+ rqlQuery: query,
1517
+ onTableQueryChange
1518
+ } = useServerTableQuery({
1519
+ defaultSort: DEFAULT_SORT,
1520
+ transformOptions: {
1521
+ fieldNameMapping: {
1522
+ createdAt: "created_at"
1523
+ }
1410
1524
  }
1411
1525
  });
1412
1526
  const {
@@ -1417,8 +1531,8 @@ function InvoicesView({ appName } = {}) {
1417
1531
  error,
1418
1532
  isError,
1419
1533
  hasNextPage
1420
- } = (0, import_connect_query2.useInfiniteQuery)(
1421
- import_frontier3.AdminServiceQueries.searchInvoices,
1534
+ } = (0, import_connect_query3.useInfiniteQuery)(
1535
+ import_frontier4.AdminServiceQueries.searchInvoices,
1422
1536
  { query },
1423
1537
  {
1424
1538
  pageParamKey: "query",
@@ -1430,22 +1544,13 @@ function InvoicesView({ appName } = {}) {
1430
1544
  }
1431
1545
  );
1432
1546
  const data = infiniteData?.pages?.flatMap((page) => page?.invoices || []) || [];
1433
- const onTableQueryChange = (newQuery) => {
1434
- setTableQuery({
1435
- ...newQuery,
1436
- offset: 0,
1437
- limit: newQuery.limit || DEFAULT_PAGE_SIZE
1438
- });
1439
- };
1440
- const handleLoadMore = async () => {
1441
- try {
1442
- if (!hasNextPage)
1443
- return;
1444
- await fetchNextPage();
1445
- } catch (error2) {
1446
- console.error("Error loading more invoices:", error2);
1447
- }
1448
- };
1547
+ const handleLoadMore = useLoadMore({
1548
+ hasNextPage,
1549
+ isFetchingNextPage,
1550
+ isError,
1551
+ fetchNextPage,
1552
+ label: "invoices"
1553
+ });
1449
1554
  const columns = getColumns2({ t });
1450
1555
  const loading = isLoading || isFetchingNextPage;
1451
1556
  if (isError) {
@@ -1500,15 +1605,15 @@ function InvoicesView({ appName } = {}) {
1500
1605
 
1501
1606
  // admin/views/products/index.tsx
1502
1607
  var import_apsara11 = require("@raystack/apsara");
1503
- var import_react7 = require("react");
1504
- var import_connect_query3 = require("@connectrpc/connect-query");
1505
- var import_frontier4 = require("@raystack/proton/frontier");
1608
+ var import_react9 = require("react");
1609
+ var import_connect_query4 = require("@connectrpc/connect-query");
1610
+ var import_frontier5 = require("@raystack/proton/frontier");
1506
1611
 
1507
1612
  // admin/views/products/columns.tsx
1508
1613
  var import_apsara9 = require("@raystack/apsara");
1509
1614
 
1510
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-HSt3evYGvCnz/sdk/admin/views/products/products.module.css.js
1511
- var digest7 = "9848c90222c4dbf159cc2be839403357bead656ae8730d16c3267f49a209ae1d";
1615
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-jijzlNsb4Mhy/sdk/admin/views/products/products.module.css.js
1616
+ var digest7 = "9a95b467387d2f92a028759b0645514fa4d569c74c8debe0f6f355cf5d0d9a51";
1512
1617
  var css7 = `._tableRoot_3ccjp_1 {
1513
1618
  width: 100%;
1514
1619
  }
@@ -1660,8 +1765,8 @@ var getColumns3 = (onNavigateToPrices) => {
1660
1765
  ];
1661
1766
  };
1662
1767
 
1663
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-6zbg5SuM221q/sdk/admin/views/products/products.module.css.js
1664
- var digest8 = "c5a42d3e09e2b00ea6c4d1c9de209c8d67e9b76a3f6085af286746865012e222";
1768
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-j1udgwAHPxWs/sdk/admin/views/products/products.module.css.js
1769
+ var digest8 = "cf7d39c70012b0ce1559e1304a3f82a0554f92f8cd4d4268340c5a7fc6d65792";
1665
1770
  var css8 = `._tableRoot_3ccjp_1 {
1666
1771
  width: 100%;
1667
1772
  }
@@ -1718,8 +1823,8 @@ var products_module_css_default2 = { "tableRoot": "_tableRoot_3ccjp_1", "tableWr
1718
1823
  // admin/views/products/details.tsx
1719
1824
  var import_apsara10 = require("@raystack/apsara");
1720
1825
 
1721
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-AaePG70SHtnh/sdk/admin/views/products/products.module.css.js
1722
- var digest9 = "01e990b2a566689f5a9c54852697983ddf6eef4b36241dfbd29339e895c80208";
1826
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-uQL0tT4g9sH9/sdk/admin/views/products/products.module.css.js
1827
+ var digest9 = "39f381d040be0befaeaeb50920077b80a28df3b61f92974caabeef96e1ce2673";
1723
1828
  var css9 = `._tableRoot_3ccjp_1 {
1724
1829
  width: 100%;
1725
1830
  }
@@ -1830,13 +1935,13 @@ function ProductsView({
1830
1935
  isLoading: isProductsLoading,
1831
1936
  error,
1832
1937
  isError
1833
- } = (0, import_connect_query3.useQuery)(import_frontier4.FrontierServiceQueries.listProducts, {}, {
1938
+ } = (0, import_connect_query4.useQuery)(import_frontier5.FrontierServiceQueries.listProducts, {}, {
1834
1939
  staleTime: Infinity
1835
1940
  });
1836
1941
  const products = productsResponse?.products || [];
1837
1942
  const productMapById = reduceByKey(products ?? [], "id");
1838
1943
  const product = selectedProductId ? productMapById[selectedProductId] ?? null : null;
1839
- (0, import_react7.useEffect)(() => {
1944
+ (0, import_react9.useEffect)(() => {
1840
1945
  if (selectedProductId && !isProductsLoading && !isError && !product) {
1841
1946
  onCloseDetail?.();
1842
1947
  }
@@ -1915,14 +2020,14 @@ var noDataChildren2 = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1915
2020
 
1916
2021
  // admin/views/products/prices/index.tsx
1917
2022
  var import_apsara13 = require("@raystack/apsara");
1918
- var import_connect_query4 = require("@connectrpc/connect-query");
1919
- var import_frontier5 = require("@raystack/proton/frontier");
2023
+ var import_connect_query5 = require("@connectrpc/connect-query");
2024
+ var import_frontier6 = require("@raystack/proton/frontier");
1920
2025
 
1921
2026
  // admin/views/products/prices/columns.tsx
1922
2027
  var import_apsara12 = require("@raystack/apsara");
1923
2028
 
1924
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-7o43NuCUXRy5/sdk/admin/views/products/prices/prices.module.css.js
1925
- var digest10 = "76d3168774e6c97f09c2686bfdc906dad5a0c618949f33bac8f39a983a36a68f";
2029
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-dw4q13tEWCLw/sdk/admin/views/products/prices/prices.module.css.js
2030
+ var digest10 = "b0bd174acac3a76302ea601e1042a90d664ea1d3c0a9aaa73c4e383b1216108d";
1926
2031
  var css10 = `._first-column_6e56r_1 {
1927
2032
  padding-left: var(--rs-space-7);
1928
2033
  }
@@ -2013,8 +2118,8 @@ var getColumns4 = (prices) => {
2013
2118
  ];
2014
2119
  };
2015
2120
 
2016
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-BjXjKK5FsTqJ/sdk/admin/views/products/products.module.css.js
2017
- var digest11 = "71eb994e9f611cdc8b943204f0f6d8b85ec1f09834a76d182c11d85af3c69d38";
2121
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-imng42WGCAzY/sdk/admin/views/products/products.module.css.js
2122
+ var digest11 = "5fd27428027bc2c2c25134b9d2fc09bcc87e9bb6d96ec694e23a9cfffb1afc4a";
2018
2123
  var css11 = `._tableRoot_3ccjp_1 {
2019
2124
  width: 100%;
2020
2125
  }
@@ -2080,8 +2185,8 @@ function ProductPricesView({
2080
2185
  isLoading: isProductLoading,
2081
2186
  error,
2082
2187
  isError
2083
- } = (0, import_connect_query4.useQuery)(
2084
- import_frontier5.FrontierServiceQueries.getProduct,
2188
+ } = (0, import_connect_query5.useQuery)(
2189
+ import_frontier6.FrontierServiceQueries.getProduct,
2085
2190
  { id: productId ?? "" },
2086
2191
  { staleTime: Infinity }
2087
2192
  );
@@ -2140,8 +2245,7 @@ var noDataChildren3 = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_apsar
2140
2245
 
2141
2246
  // admin/views/audit-logs/index.tsx
2142
2247
  var import_apsara22 = require("@raystack/apsara");
2143
- var import_hooks = require("@raystack/apsara/hooks");
2144
- var import_react10 = require("react");
2248
+ var import_react12 = require("react");
2145
2249
 
2146
2250
  // admin/views/audit-logs/navbar.tsx
2147
2251
  var import_apsara14 = require("@raystack/apsara");
@@ -2172,8 +2276,8 @@ function CpuChipIcon(props) {
2172
2276
  );
2173
2277
  }
2174
2278
 
2175
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-HW7dvoN2jNT7/sdk/admin/components/navbar.module.css.js
2176
- var digest12 = "e6d293a0cbbc4cab39c1a476d369b9c7a0564921e3dd87dec44db10f9fd2f70c";
2279
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-Kgk55aEs7Ea5/sdk/admin/components/navbar.module.css.js
2280
+ var digest12 = "c288037022d849a84668e84c3b99e4d95c3e4d76656a65b04523a8ccdec28c26";
2177
2281
  var css12 = `._navbar_641ya_1 {
2178
2282
  padding: var(--rs-space-4) var(--rs-space-7);
2179
2283
  border-bottom: 0.5px solid var(--rs-color-border-base-primary);
@@ -2202,12 +2306,12 @@ var css12 = `._navbar_641ya_1 {
2202
2306
  var navbar_module_css_default2 = { "navbar": "_navbar_641ya_1", "nav-chip": "_nav-chip_641ya_11", "navChip": "_nav-chip_641ya_11" };
2203
2307
 
2204
2308
  // admin/views/audit-logs/navbar.tsx
2205
- var import_react8 = require("react");
2206
- var import_react_query = require("@tanstack/react-query");
2309
+ var import_react10 = require("react");
2310
+ var import_react_query2 = require("@tanstack/react-query");
2207
2311
 
2208
2312
  // admin/views/audit-logs/util.ts
2209
- var import_protobuf2 = require("@bufbuild/protobuf");
2210
- var import_frontier6 = require("@raystack/proton/frontier");
2313
+ var import_protobuf3 = require("@bufbuild/protobuf");
2314
+ var import_frontier7 = require("@raystack/proton/frontier");
2211
2315
  var getAuditLogActorName = (actor, maxLength = 15) => {
2212
2316
  if (actor?.type === ACTOR_TYPES.SYSTEM)
2213
2317
  return "System";
@@ -2238,25 +2342,25 @@ var ACTOR_TYPES = {
2238
2342
  };
2239
2343
  var AUDIT_LOG_QUERY_KEY = ["audit-logs", "table-query"];
2240
2344
  var auditLogToJson = (auditLog) => {
2241
- return (0, import_protobuf2.toJsonString)(import_frontier6.AuditRecordSchema, auditLog, { prettySpaces: 2 });
2345
+ return (0, import_protobuf3.toJsonString)(import_frontier7.AuditRecordSchema, auditLog, { prettySpaces: 2 });
2242
2346
  };
2243
2347
 
2244
2348
  // admin/views/audit-logs/navbar.tsx
2245
2349
  var import_jsx_runtime17 = require("react/jsx-runtime");
2246
2350
  var Navbar = ({ searchQuery, onExportCsv }) => {
2247
- const [showSearch, setShowSearch] = (0, import_react8.useState)(searchQuery ? true : false);
2248
- const [isDownloading, setIsDownloading] = (0, import_react8.useState)(false);
2249
- const queryClient = (0, import_react_query.useQueryClient)();
2250
- const toggleSearch = (0, import_react8.useCallback)(() => {
2351
+ const [showSearch, setShowSearch] = (0, import_react10.useState)(searchQuery ? true : false);
2352
+ const [isDownloading, setIsDownloading] = (0, import_react10.useState)(false);
2353
+ const queryClient = (0, import_react_query2.useQueryClient)();
2354
+ const toggleSearch = (0, import_react10.useCallback)(() => {
2251
2355
  setShowSearch((prev) => !prev);
2252
2356
  }, []);
2253
- const onSearchBlur = (0, import_react8.useCallback)((e) => {
2357
+ const onSearchBlur = (0, import_react10.useCallback)((e) => {
2254
2358
  const value = e.target.value;
2255
2359
  if (!value) {
2256
2360
  setShowSearch(false);
2257
2361
  }
2258
2362
  }, []);
2259
- const onDownloadClick = (0, import_react8.useCallback)(async () => {
2363
+ const onDownloadClick = (0, import_react10.useCallback)(async () => {
2260
2364
  if (!onExportCsv)
2261
2365
  return;
2262
2366
  try {
@@ -2311,8 +2415,8 @@ var Navbar = ({ searchQuery, onExportCsv }) => {
2311
2415
  };
2312
2416
  var navbar_default = Navbar;
2313
2417
 
2314
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-1Fbo6A61e9B1/sdk/admin/views/audit-logs/audit-logs.module.css.js
2315
- var digest13 = "2f7e239adede2cc845ef852cd21abf5bc056681b3423e226b20b77196fc39acf";
2418
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-2O13r39ALIYj/sdk/admin/views/audit-logs/audit-logs.module.css.js
2419
+ var digest13 = "c2b083e6b0ec2cc6d0cbef5a368eb18b40755339ce6462aa418e62c526ce70ca";
2316
2420
  var css13 = `._table_vb46j_1 {
2317
2421
  height: auto;
2318
2422
  }
@@ -2415,8 +2519,8 @@ var audit_logs_module_css_default = { "table": "_table_vb46j_1", "table-empty":
2415
2519
  // admin/views/audit-logs/columns.tsx
2416
2520
  var import_apsara16 = require("@raystack/apsara");
2417
2521
 
2418
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-j2255Uvx0G2G/sdk/admin/views/audit-logs/audit-logs.module.css.js
2419
- var digest14 = "3ecd385345bac53886b175b94fdb3823a8d6a5f937163c4ce67d2d80c8f274bc";
2522
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-MhB3F1c2udZc/sdk/admin/views/audit-logs/audit-logs.module.css.js
2523
+ var digest14 = "f1db9d9dd65fb0fc2c618f5b0d7046d30f1a0b8a01459002c28f2513735fda3d";
2420
2524
  var css14 = `._table_vb46j_1 {
2421
2525
  height: auto;
2422
2526
  }
@@ -2665,15 +2769,15 @@ var getColumns5 = ({
2665
2769
  };
2666
2770
 
2667
2771
  // admin/views/audit-logs/index.tsx
2668
- var import_connect_query6 = require("@connectrpc/connect-query");
2669
- var import_frontier8 = require("@raystack/proton/frontier");
2772
+ var import_connect_query7 = require("@connectrpc/connect-query");
2773
+ var import_frontier9 = require("@raystack/proton/frontier");
2670
2774
 
2671
2775
  // admin/views/audit-logs/sidepanel-details.tsx
2672
2776
  var import_apsara20 = require("@raystack/apsara");
2673
2777
  var import_apsara21 = require("@raystack/apsara");
2674
2778
 
2675
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-RuKru6dI1Ngt/sdk/admin/views/audit-logs/audit-logs.module.css.js
2676
- var digest15 = "94acb592aca446c000f221fbe2d0f0ed9f83fcf1b548d4f2a1ddd1bd012748cf";
2779
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-DSMzcwAWIh9B/sdk/admin/views/audit-logs/audit-logs.module.css.js
2780
+ var digest15 = "1fcdd9a964eabb5531ed05954bb21a5045128dbb723046c76a8bc0b20d20fc77";
2677
2781
  var css15 = `._table_vb46j_1 {
2678
2782
  height: auto;
2679
2783
  }
@@ -2801,8 +2905,8 @@ function MapIcon(props) {
2801
2905
  // admin/views/audit-logs/sidepanel-log-dialog.tsx
2802
2906
  var import_apsara17 = require("@raystack/apsara");
2803
2907
 
2804
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-IwdjGFLrgzNZ/sdk/admin/views/audit-logs/audit-logs.module.css.js
2805
- var digest16 = "6cb4eb6fb7f1a50cb6bdb063ab9d76874c008989c043f90dbbf8ac8bd4e580f6";
2908
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-G3oaRpfffpNF/sdk/admin/views/audit-logs/audit-logs.module.css.js
2909
+ var digest16 = "4463ac6f5af0bc5a10ba195706d96c3ee138c99a45094ac41f9d2ccbea01b339";
2806
2910
  var css16 = `._table_vb46j_1 {
2807
2911
  height: auto;
2808
2912
  }
@@ -3000,8 +3104,8 @@ function SidePanelLogDialog(props) {
3000
3104
  // admin/views/audit-logs/sidepanel-list-link.tsx
3001
3105
  var import_apsara18 = require("@raystack/apsara");
3002
3106
 
3003
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-mV19G6d9DqSo/sdk/admin/views/audit-logs/audit-logs.module.css.js
3004
- var digest17 = "fe88970a7d1dbdf2e366d8134ed70c05fb0c6104360ed27f432d96005c2d3f18";
3107
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-dMzmfO737qO1/sdk/admin/views/audit-logs/audit-logs.module.css.js
3108
+ var digest17 = "8b1b2c6f578fb142d40f1dbcb87a04e3dd8e904a5313349d110b330ea142f108";
3005
3109
  var css17 = `._table_vb46j_1 {
3006
3110
  height: auto;
3007
3111
  }
@@ -3137,8 +3241,8 @@ function SidepanelListItemLink({
3137
3241
  // admin/views/audit-logs/sidepanel-list-id.tsx
3138
3242
  var import_apsara19 = require("@raystack/apsara");
3139
3243
 
3140
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-5oOIts6Zmr03/sdk/admin/views/audit-logs/audit-logs.module.css.js
3141
- var digest18 = "84321f96cb417f7e7306185e2002022f64346d1fde6a70719e3d5d66d368a9a9";
3244
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-Rwoj7QzLooDC/sdk/admin/views/audit-logs/audit-logs.module.css.js
3245
+ var digest18 = "5d020d1d6472e6467ec3b7af59d9aeb35767e8fc3f533f5f07cf06728443929f";
3142
3246
  var css18 = `._table_vb46j_1 {
3143
3247
  height: auto;
3144
3248
  }
@@ -3256,7 +3360,7 @@ function SidepanelListId({ id = "-" }) {
3256
3360
  }
3257
3361
 
3258
3362
  // admin/contexts/AdminConfigContext.tsx
3259
- var import_react9 = require("react");
3363
+ var import_react11 = require("react");
3260
3364
  var import_lodash = require("lodash");
3261
3365
 
3262
3366
  // admin/utils/constants.ts
@@ -3273,6 +3377,7 @@ var DEFAULT_ROLES = {
3273
3377
  ORG_VIEWER: "app_organization_viewer",
3274
3378
  PROJECT_VIEWER: "app_project_viewer"
3275
3379
  };
3380
+ var SHARED_QUERY_STALE_TIME = 30 * 1e3;
3276
3381
  var defaultTerminology = {
3277
3382
  organization: { singular: "Organization", plural: "Organizations" },
3278
3383
  project: { singular: "Project", plural: "Projects" },
@@ -3291,7 +3396,7 @@ var defaultConfig = {
3291
3396
 
3292
3397
  // admin/contexts/AdminConfigContext.tsx
3293
3398
  var import_jsx_runtime26 = require("react/jsx-runtime");
3294
- var AdminConfigContext = (0, import_react9.createContext)(defaultConfig);
3399
+ var AdminConfigContext = (0, import_react11.createContext)(defaultConfig);
3295
3400
  var AdminConfigProvider = ({
3296
3401
  children,
3297
3402
  config = {}
@@ -3308,7 +3413,7 @@ var AdminConfigProvider = ({
3308
3413
  ) });
3309
3414
  };
3310
3415
  var useAdminConfig = () => {
3311
- const context = (0, import_react9.useContext)(AdminConfigContext);
3416
+ const context = (0, import_react11.useContext)(AdminConfigContext);
3312
3417
  return context || defaultConfig;
3313
3418
  };
3314
3419
 
@@ -3339,10 +3444,10 @@ var useAdminPaths = () => {
3339
3444
  };
3340
3445
 
3341
3446
  // admin/hooks/useOrganizationLookup.ts
3342
- var import_connect_query5 = require("@connectrpc/connect-query");
3343
- var import_frontier7 = require("@raystack/proton/frontier");
3344
- var useOrganizationLookup = (orgId) => (0, import_connect_query5.useQuery)(
3345
- import_frontier7.FrontierServiceQueries.getOrganization,
3447
+ var import_connect_query6 = require("@connectrpc/connect-query");
3448
+ var import_frontier8 = require("@raystack/proton/frontier");
3449
+ var useOrganizationLookup = (orgId) => (0, import_connect_query6.useQuery)(
3450
+ import_frontier8.FrontierServiceQueries.getOrganization,
3346
3451
  { id: orgId || "" },
3347
3452
  {
3348
3453
  enabled: !!orgId,
@@ -3487,7 +3592,7 @@ function SidePanelDetails({
3487
3592
  }
3488
3593
 
3489
3594
  // admin/views/audit-logs/index.tsx
3490
- var import_react_query2 = require("@tanstack/react-query");
3595
+ var import_react_query3 = require("@tanstack/react-query");
3491
3596
  var import_jsx_runtime28 = require("react/jsx-runtime");
3492
3597
  var NoAuditLogs = () => {
3493
3598
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -3504,10 +3609,6 @@ var NoAuditLogs = () => {
3504
3609
  );
3505
3610
  };
3506
3611
  var DEFAULT_SORT2 = { name: "occurredAt", order: "desc" };
3507
- var INITIAL_QUERY2 = {
3508
- offset: 0,
3509
- limit: DEFAULT_PAGE_SIZE
3510
- };
3511
3612
  var TRANSFORM_OPTIONS = {
3512
3613
  fieldNameMapping: {
3513
3614
  occurredAt: "occurred_at",
@@ -3521,19 +3622,20 @@ var TRANSFORM_OPTIONS = {
3521
3622
  };
3522
3623
  function AuditLogsView({ appName, onExportCsv, onNavigate } = {}) {
3523
3624
  const t = useTerminology();
3524
- const queryClient = (0, import_react_query2.useQueryClient)();
3525
- const [tableQuery, setTableQuery] = (0, import_hooks.useDebouncedState)(
3526
- {
3527
- query: INITIAL_QUERY2,
3528
- rqlRequest: transformDataTableQueryToRQLRequest(
3529
- INITIAL_QUERY2,
3530
- TRANSFORM_OPTIONS
3531
- )
3532
- },
3533
- 200
3534
- );
3535
- const [sidePanelOpen, setSidePanelOpen] = (0, import_react10.useState)(false);
3536
- const [selectedAuditLog, setSelectedAuditLog] = (0, import_react10.useState)(
3625
+ const queryClient = (0, import_react_query3.useQueryClient)();
3626
+ const {
3627
+ tableQuery,
3628
+ rqlQuery,
3629
+ onTableQueryChange
3630
+ } = useServerTableQuery({
3631
+ defaultSort: DEFAULT_SORT2,
3632
+ transformOptions: TRANSFORM_OPTIONS
3633
+ });
3634
+ (0, import_react12.useEffect)(() => {
3635
+ queryClient.setQueryData(AUDIT_LOG_QUERY_KEY, rqlQuery);
3636
+ }, [queryClient, rqlQuery]);
3637
+ const [sidePanelOpen, setSidePanelOpen] = (0, import_react12.useState)(false);
3638
+ const [selectedAuditLog, setSelectedAuditLog] = (0, import_react12.useState)(
3537
3639
  null
3538
3640
  );
3539
3641
  const {
@@ -3544,14 +3646,14 @@ function AuditLogsView({ appName, onExportCsv, onNavigate } = {}) {
3544
3646
  error,
3545
3647
  isError,
3546
3648
  hasNextPage
3547
- } = (0, import_connect_query6.useInfiniteQuery)(
3548
- import_frontier8.AdminServiceQueries.listAuditRecords,
3549
- { query: tableQuery.rqlRequest },
3649
+ } = (0, import_connect_query7.useInfiniteQuery)(
3650
+ import_frontier9.AdminServiceQueries.listAuditRecords,
3651
+ { query: rqlQuery },
3550
3652
  {
3551
3653
  pageParamKey: "query",
3552
3654
  getNextPageParam: (lastPage) => getConnectNextPageParam(
3553
3655
  lastPage,
3554
- { query: tableQuery.rqlRequest },
3656
+ { query: rqlQuery },
3555
3657
  "auditRecords"
3556
3658
  ),
3557
3659
  staleTime: 0,
@@ -3561,35 +3663,14 @@ function AuditLogsView({ appName, onExportCsv, onNavigate } = {}) {
3561
3663
  }
3562
3664
  );
3563
3665
  const data = infiniteData?.pages?.flatMap((page) => page?.auditRecords || []) || [];
3564
- const onTableQueryChange = (0, import_react10.useCallback)(
3565
- (query) => {
3566
- const updatedQuery = {
3567
- ...query,
3568
- offset: 0,
3569
- limit: query.limit || DEFAULT_PAGE_SIZE
3570
- };
3571
- const updatedRQLRequest = transformDataTableQueryToRQLRequest(
3572
- updatedQuery,
3573
- TRANSFORM_OPTIONS
3574
- );
3575
- queryClient.setQueryData(AUDIT_LOG_QUERY_KEY, updatedRQLRequest);
3576
- setTableQuery({
3577
- query: updatedQuery,
3578
- rqlRequest: updatedRQLRequest
3579
- });
3580
- },
3581
- [queryClient]
3582
- );
3583
- const handleLoadMore = async () => {
3584
- try {
3585
- if (!hasNextPage)
3586
- return;
3587
- await fetchNextPage();
3588
- } catch (error2) {
3589
- console.error("Error loading more audit logs:", error2);
3590
- }
3591
- };
3592
- const columns = (0, import_react10.useMemo)(
3666
+ const handleLoadMore = useLoadMore({
3667
+ hasNextPage,
3668
+ isFetchingNextPage,
3669
+ isError,
3670
+ fetchNextPage,
3671
+ label: "audit logs"
3672
+ });
3673
+ const columns = (0, import_react12.useMemo)(
3593
3674
  () => getColumns5({
3594
3675
  groupCountMap: infiniteData ? getGroupCountMapFromFirstPage(infiniteData) : {},
3595
3676
  t
@@ -3597,7 +3678,7 @@ function AuditLogsView({ appName, onExportCsv, onNavigate } = {}) {
3597
3678
  [infiniteData, t]
3598
3679
  );
3599
3680
  const loading = isLoading || isFetchingNextPage;
3600
- const onRowClick = (0, import_react10.useCallback)((row) => {
3681
+ const onRowClick = (0, import_react12.useCallback)((row) => {
3601
3682
  setSelectedAuditLog((_selectedLog) => {
3602
3683
  if (_selectedLog?.id === row.id)
3603
3684
  setSidePanelOpen((_value) => !_value);
@@ -3626,7 +3707,7 @@ function AuditLogsView({ appName, onExportCsv, onNavigate } = {}) {
3626
3707
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3627
3708
  import_apsara22.DataTable,
3628
3709
  {
3629
- query: tableQuery.query,
3710
+ query: tableQuery,
3630
3711
  columns,
3631
3712
  data,
3632
3713
  isLoading: loading,
@@ -3636,7 +3717,7 @@ function AuditLogsView({ appName, onExportCsv, onNavigate } = {}) {
3636
3717
  onLoadMore: handleLoadMore,
3637
3718
  onRowClick,
3638
3719
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_apsara22.Flex, { direction: "column", style: { width: "100%" }, children: [
3639
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(navbar_default, { searchQuery: tableQuery.query.search, onExportCsv }),
3720
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(navbar_default, { searchQuery: tableQuery.search, onExportCsv }),
3640
3721
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_apsara22.DataTable.Toolbar, {}),
3641
3722
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_apsara22.Flex, { className: audit_logs_module_css_default["table-content-container"], children: [
3642
3723
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -3673,8 +3754,8 @@ var import_apsara24 = require("@raystack/apsara");
3673
3754
  // admin/views/admins/columns.tsx
3674
3755
  var import_apsara23 = require("@raystack/apsara");
3675
3756
 
3676
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-jsXJY8S2dCsP/sdk/admin/views/admins/admins.module.css.js
3677
- var digest19 = "d503a7196f827932ef1d3e237f4dfca1b6bc0af0cdb029660b8a5e263d829ebd";
3757
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-nppaCd80ePLB/sdk/admin/views/admins/admins.module.css.js
3758
+ var digest19 = "950a77264f8f24d59f715e9f3b01bb37570741c8b78f69e4c8cb9133ef673cc5";
3678
3759
  var css19 = `._tableRoot_1tmha_1 {
3679
3760
  width: 100%;
3680
3761
  }
@@ -3769,7 +3850,7 @@ var getColumns6 = ({ onNavigateToOrg, t } = {}) => {
3769
3850
  ];
3770
3851
  };
3771
3852
 
3772
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-HwT7jBbko8dL/sdk/admin/views/admins/admins.module.css.js
3853
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-CxSct3QisjAE/sdk/admin/views/admins/admins.module.css.js
3773
3854
  var digest20 = "0059d048e18fb7aa718bc7304f9de3f76a2e9bc7bc3753b6d1c02052673a9557";
3774
3855
  var css20 = `._tableRoot_1tmha_1 {
3775
3856
  width: 100%;
@@ -3802,8 +3883,8 @@ var css20 = `._tableRoot_1tmha_1 {
3802
3883
  var admins_module_css_default2 = { "tableRoot": "_tableRoot_1tmha_1", "tableWrapper": "_tableWrapper_1tmha_5", "header": "_header_1tmha_9", "first-column": "_first-column_1tmha_14", "firstColumn": "_first-column_1tmha_14" };
3803
3884
 
3804
3885
  // admin/views/admins/index.tsx
3805
- var import_connect_query7 = require("@connectrpc/connect-query");
3806
- var import_frontier9 = require("@raystack/proton/frontier");
3886
+ var import_connect_query8 = require("@connectrpc/connect-query");
3887
+ var import_frontier10 = require("@raystack/proton/frontier");
3807
3888
  var import_jsx_runtime30 = require("react/jsx-runtime");
3808
3889
  var pageHeader = {
3809
3890
  title: "Super Admins",
@@ -3826,7 +3907,7 @@ function AdminsView({ onNavigateToOrg, icon } = {}) {
3826
3907
  isLoading,
3827
3908
  error,
3828
3909
  isError
3829
- } = (0, import_connect_query7.useQuery)(import_frontier9.AdminServiceQueries.listPlatformUsers, {}, {
3910
+ } = (0, import_connect_query8.useQuery)(import_frontier10.AdminServiceQueries.listPlatformUsers, {}, {
3830
3911
  staleTime: Infinity
3831
3912
  });
3832
3913
  const columns = getColumns6({ onNavigateToOrg, t });
@@ -3881,8 +3962,8 @@ var import_apsara27 = require("@raystack/apsara");
3881
3962
  // admin/views/plans/columns.tsx
3882
3963
  var import_apsara25 = require("@raystack/apsara");
3883
3964
 
3884
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-C2aITHuNOL4U/sdk/admin/views/plans/plans.module.css.js
3885
- var digest21 = "78aedcae0a952f0fe3f0715076a2a02d1ae0754baed0dd3ad2e1e149c8f6d32f";
3965
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-alTKbm6TPenq/sdk/admin/views/plans/plans.module.css.js
3966
+ var digest21 = "b13402798491b7543b0e970942a087e5605f1ec993684c1fb6f51e02d957cd46";
3886
3967
  var css21 = `._tableRoot_1akba_1 {
3887
3968
  width: 100%;
3888
3969
  }
@@ -3973,8 +4054,8 @@ var getColumns7 = ({ onSelectPlan } = {}) => {
3973
4054
  ];
3974
4055
  };
3975
4056
 
3976
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-qdG60EWgvr1H/sdk/admin/views/plans/plans.module.css.js
3977
- var digest22 = "ed76e23b0415c6d7f8bed58feff04a4afae244b87a754148f68a190f9f3b15ba";
4057
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-9EL4FoF4sxDF/sdk/admin/views/plans/plans.module.css.js
4058
+ var digest22 = "973d8f7fc8e67dbf4a5dfb68b6e33688d9824e2f88eae2168de599beadbac2a7";
3978
4059
  var css22 = `._tableRoot_1akba_1 {
3979
4060
  width: 100%;
3980
4061
  }
@@ -4018,8 +4099,8 @@ var css22 = `._tableRoot_1akba_1 {
4018
4099
  var plans_module_css_default2 = { "tableRoot": "_tableRoot_1akba_1", "tableWrapper": "_tableWrapper_1akba_4", "table": "_table_1akba_1", "header": "_header_1akba_12", "first-column": "_first-column_1akba_17", "firstColumn": "_first-column_1akba_17", "sheetContent": "_sheetContent_1akba_21", "sheetContentBody": "_sheetContentBody_1akba_26" };
4019
4100
 
4020
4101
  // admin/views/plans/index.tsx
4021
- var import_connect_query8 = require("@connectrpc/connect-query");
4022
- var import_frontier10 = require("@raystack/proton/frontier");
4102
+ var import_connect_query9 = require("@connectrpc/connect-query");
4103
+ var import_frontier11 = require("@raystack/proton/frontier");
4023
4104
 
4024
4105
  // admin/views/plans/details.tsx
4025
4106
  var import_apsara26 = require("@raystack/apsara");
@@ -4058,7 +4139,7 @@ function PlansView({
4058
4139
  isLoading: isPlansLoading,
4059
4140
  error,
4060
4141
  isError
4061
- } = (0, import_connect_query8.useQuery)(import_frontier10.FrontierServiceQueries.listPlans, {}, {
4142
+ } = (0, import_connect_query9.useQuery)(import_frontier11.FrontierServiceQueries.listPlans, {}, {
4062
4143
  staleTime: Infinity
4063
4144
  });
4064
4145
  const plans = plansResponse?.plans || [];
@@ -4126,8 +4207,8 @@ var import_apsara29 = require("@raystack/apsara");
4126
4207
  // admin/views/webhooks/webhooks/columns.tsx
4127
4208
  var import_apsara28 = require("@raystack/apsara");
4128
4209
 
4129
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-vmOIsjxqIHiN/sdk/admin/views/webhooks/webhooks/webhooks.module.css.js
4130
- var digest23 = "edf22719fb2ec3e86bb6351a127319e232c9d08d987c6f776b0e127b5a631aeb";
4210
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-J24w1Cm22KVX/sdk/admin/views/webhooks/webhooks/webhooks.module.css.js
4211
+ var digest23 = "cf591bf7ae1a01240cfed2f64302b63f8d10bfa198201fe917cfcd158ab62b25";
4131
4212
  var css23 = `._tableRoot_iq3pc_1 {
4132
4213
  width: 100%;
4133
4214
  }
@@ -4208,8 +4289,8 @@ var getColumns8 = () => {
4208
4289
  ];
4209
4290
  };
4210
4291
 
4211
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-Vq1IVdD1BzQH/sdk/admin/views/webhooks/webhooks/webhooks.module.css.js
4212
- var digest24 = "aa776fc40f26d0b28c1766b135522975384d5b3b55c2f5bc90202b63b584b7e2";
4292
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-QhF26coz1ev6/sdk/admin/views/webhooks/webhooks/webhooks.module.css.js
4293
+ var digest24 = "7dfb1e055a2463d614dd18a5cff0087892d6ae0a5139ea22d7a4d7e42ec8a001";
4213
4294
  var css24 = `._tableRoot_iq3pc_1 {
4214
4295
  width: 100%;
4215
4296
  }
@@ -4254,11 +4335,11 @@ var css24 = `._tableRoot_iq3pc_1 {
4254
4335
  var webhooks_module_css_default2 = { "tableRoot": "_tableRoot_iq3pc_1", "tableWrapper": "_tableWrapper_iq3pc_5", "table": "_table_iq3pc_1", "first-column": "_first-column_iq3pc_13", "firstColumn": "_first-column_iq3pc_13", "stateColumn": "_stateColumn_iq3pc_17", "dateColumn": "_dateColumn_iq3pc_21", "header": "_header_iq3pc_25" };
4255
4336
 
4256
4337
  // admin/views/webhooks/webhooks/hooks/useWebhookQueries.ts
4257
- var import_connect_query9 = require("@connectrpc/connect-query");
4258
- var import_frontier11 = require("@raystack/proton/frontier");
4338
+ var import_connect_query10 = require("@connectrpc/connect-query");
4339
+ var import_frontier12 = require("@raystack/proton/frontier");
4259
4340
  function useWebhookQueries() {
4260
- const listWebhooks = (0, import_connect_query9.useQuery)(
4261
- import_frontier11.AdminServiceQueries.listWebhooks,
4341
+ const listWebhooks = (0, import_connect_query10.useQuery)(
4342
+ import_frontier12.AdminServiceQueries.listWebhooks,
4262
4343
  {},
4263
4344
  {
4264
4345
  staleTime: 0,
@@ -4321,9 +4402,9 @@ function WebhooksView({ icon } = {}) {
4321
4402
 
4322
4403
  // admin/views/preferences/PreferencesView.tsx
4323
4404
  var import_apsara33 = require("@raystack/apsara");
4324
- var import_connect_query11 = require("@connectrpc/connect-query");
4325
- var import_frontier14 = require("@raystack/proton/frontier");
4326
- var import_react_query4 = require("@tanstack/react-query");
4405
+ var import_connect_query12 = require("@connectrpc/connect-query");
4406
+ var import_frontier15 = require("@raystack/proton/frontier");
4407
+ var import_react_query5 = require("@tanstack/react-query");
4327
4408
 
4328
4409
  // admin/views/preferences/index.tsx
4329
4410
  var import_apsara31 = require("@raystack/apsara");
@@ -4331,8 +4412,8 @@ var import_apsara31 = require("@raystack/apsara");
4331
4412
  // admin/views/preferences/columns.tsx
4332
4413
  var import_apsara30 = require("@raystack/apsara");
4333
4414
 
4334
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-89Bi1FPya4K6/sdk/admin/views/preferences/preferences.module.css.js
4335
- var digest25 = "4dd4f728e296be118bc929ebbf7e08a9591ea2309a9eb91d1d50fb3dfdde3f4f";
4415
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-dgdlWhCa0D1k/sdk/admin/views/preferences/preferences.module.css.js
4416
+ var digest25 = "011e739af3ba3bb06fb112e6d054078b3bc27c04b59e7cc9fd18a7d5c81a6e90";
4336
4417
  var css25 = `._tableRoot_hre5m_1 {
4337
4418
  width: 100%;
4338
4419
  }
@@ -4423,8 +4504,8 @@ var getColumns9 = ({
4423
4504
  ];
4424
4505
  };
4425
4506
 
4426
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-xl8brebOFwVW/sdk/admin/views/preferences/preferences.module.css.js
4427
- var digest26 = "75f2b5d8a34bf4c60aea8795e66be4e4d9c3a6147d5d87019e5dcbe75ce4caed";
4507
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-iwekBWtVJGu0/sdk/admin/views/preferences/preferences.module.css.js
4508
+ var digest26 = "8746ce2f93a3ed50bb4461b003ac0a1feda37745660dfc64fee6ad8daaa6173a";
4428
4509
  var css26 = `._tableRoot_hre5m_1 {
4429
4510
  width: 100%;
4430
4511
  }
@@ -4518,11 +4599,11 @@ var noDataChildren5 = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4518
4599
 
4519
4600
  // admin/views/preferences/details.tsx
4520
4601
  var import_apsara32 = require("@raystack/apsara");
4521
- var import_react12 = require("react");
4602
+ var import_react14 = require("react");
4522
4603
 
4523
4604
  // ../node_modules/.pnpm/react-loading-skeleton@3.5.0_react@19.2.4/node_modules/react-loading-skeleton/dist/index.js
4524
- var import_react11 = __toESM(require("react"), 1);
4525
- var SkeletonThemeContext = import_react11.default.createContext({});
4605
+ var import_react13 = __toESM(require("react"), 1);
4606
+ var SkeletonThemeContext = import_react13.default.createContext({});
4526
4607
  var defaultEnableAnimation = true;
4527
4608
  function styleOptionsToCssProperties({ baseColor, highlightColor, width, height, borderRadius, circle, direction, duration, enableAnimation = defaultEnableAnimation, customHighlightBackground }) {
4528
4609
  const style = {};
@@ -4550,7 +4631,7 @@ function styleOptionsToCssProperties({ baseColor, highlightColor, width, height,
4550
4631
  }
4551
4632
  function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp, ...originalPropsStyleOptions }) {
4552
4633
  var _a, _b, _c;
4553
- const contextStyleOptions = import_react11.default.useContext(SkeletonThemeContext);
4634
+ const contextStyleOptions = import_react13.default.useContext(SkeletonThemeContext);
4554
4635
  const propsStyleOptions = { ...originalPropsStyleOptions };
4555
4636
  for (const [key, value] of Object.entries(originalPropsStyleOptions)) {
4556
4637
  if (typeof value === "undefined") {
@@ -4580,61 +4661,30 @@ function Skeleton({ count = 1, wrapper: Wrapper, className: customClassName, con
4580
4661
  const fractionalWidth = typeof width === "number" ? width * fractionalPart : `calc(${width} * ${fractionalPart})`;
4581
4662
  thisStyle = { ...thisStyle, width: fractionalWidth };
4582
4663
  }
4583
- const skeletonSpan = import_react11.default.createElement("span", { className, style: thisStyle, key: i }, "\u200C");
4664
+ const skeletonSpan = import_react13.default.createElement("span", { className, style: thisStyle, key: i }, "\u200C");
4584
4665
  if (inline) {
4585
4666
  elements.push(skeletonSpan);
4586
4667
  } else {
4587
- elements.push(import_react11.default.createElement(
4588
- import_react11.default.Fragment,
4668
+ elements.push(import_react13.default.createElement(
4669
+ import_react13.default.Fragment,
4589
4670
  { key: i },
4590
4671
  skeletonSpan,
4591
- import_react11.default.createElement("br", null)
4672
+ import_react13.default.createElement("br", null)
4592
4673
  ));
4593
4674
  }
4594
4675
  }
4595
- return import_react11.default.createElement("span", { className: containerClassName, "data-testid": containerTestId, "aria-live": "polite", "aria-busy": (_c = styleOptions.enableAnimation) !== null && _c !== void 0 ? _c : defaultEnableAnimation }, Wrapper ? elements.map((el, i) => import_react11.default.createElement(Wrapper, { key: i }, el)) : elements);
4676
+ return import_react13.default.createElement("span", { className: containerClassName, "data-testid": containerTestId, "aria-live": "polite", "aria-busy": (_c = styleOptions.enableAnimation) !== null && _c !== void 0 ? _c : defaultEnableAnimation }, Wrapper ? elements.map((el, i) => import_react13.default.createElement(Wrapper, { key: i }, el)) : elements);
4596
4677
  }
4597
4678
 
4598
4679
  // admin/views/preferences/details.tsx
4599
- var import_connect_query10 = require("@connectrpc/connect-query");
4600
-
4601
- // utils/error.ts
4602
- var import_connect = require("@connectrpc/connect");
4603
- var DEFAULT_ERROR_MESSAGE = "Something went wrong";
4604
- function handleConnectError(error, handlers) {
4605
- const connectError = error instanceof import_connect.ConnectError ? error : new import_connect.ConnectError(
4606
- typeof error === "string" ? error : error instanceof Error ? error.message : DEFAULT_ERROR_MESSAGE
4607
- );
4608
- const defaultHandler = handlers?.Default ?? ((err) => console.error(err.message));
4609
- switch (connectError.code) {
4610
- case import_connect.Code.AlreadyExists:
4611
- handlers?.AlreadyExists ? handlers.AlreadyExists(connectError) : defaultHandler(connectError);
4612
- break;
4613
- case import_connect.Code.InvalidArgument:
4614
- handlers?.InvalidArgument ? handlers.InvalidArgument(connectError) : defaultHandler(connectError);
4615
- break;
4616
- case import_connect.Code.PermissionDenied:
4617
- handlers?.PermissionDenied ? handlers.PermissionDenied(connectError) : defaultHandler(connectError);
4618
- break;
4619
- case import_connect.Code.NotFound:
4620
- handlers?.NotFound ? handlers.NotFound(connectError) : defaultHandler(connectError);
4621
- break;
4622
- case import_connect.Code.FailedPrecondition:
4623
- handlers?.FailedPrecondition ? handlers.FailedPrecondition(connectError) : defaultHandler(connectError);
4624
- break;
4625
- default:
4626
- defaultHandler(connectError);
4627
- }
4628
- }
4629
-
4630
- // admin/views/preferences/details.tsx
4631
- var import_frontier12 = require("@raystack/proton/frontier");
4680
+ var import_connect_query11 = require("@connectrpc/connect-query");
4632
4681
  var import_frontier13 = require("@raystack/proton/frontier");
4633
- var import_react_query3 = require("@tanstack/react-query");
4634
- var import_protobuf3 = require("@bufbuild/protobuf");
4682
+ var import_frontier14 = require("@raystack/proton/frontier");
4683
+ var import_react_query4 = require("@tanstack/react-query");
4684
+ var import_protobuf4 = require("@bufbuild/protobuf");
4635
4685
  var import_jsx_runtime38 = require("react/jsx-runtime");
4636
4686
  function PreferenceValue({ value, trait, onChange }) {
4637
- if (trait.inputType === import_frontier13.PreferenceTrait_InputType.CHECKBOX) {
4687
+ if (trait.inputType === import_frontier14.PreferenceTrait_InputType.CHECKBOX) {
4638
4688
  const checked = value === "true";
4639
4689
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4640
4690
  import_apsara32.Switch,
@@ -4644,7 +4694,7 @@ function PreferenceValue({ value, trait, onChange }) {
4644
4694
  "data-test-id": "admin-preference-select"
4645
4695
  }
4646
4696
  );
4647
- } else if (trait.inputType === import_frontier13.PreferenceTrait_InputType.TEXT || trait.inputType === import_frontier13.PreferenceTrait_InputType.TEXTAREA) {
4697
+ } else if (trait.inputType === import_frontier14.PreferenceTrait_InputType.TEXT || trait.inputType === import_frontier14.PreferenceTrait_InputType.TEXTAREA) {
4648
4698
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4649
4699
  import_apsara32.Input,
4650
4700
  {
@@ -4664,16 +4714,16 @@ function PreferenceDetails({
4664
4714
  isLoading,
4665
4715
  onCloseDetail
4666
4716
  }) {
4667
- const [value, setValue] = (0, import_react12.useState)("");
4668
- const [originalValue, setOriginalValue] = (0, import_react12.useState)("");
4717
+ const [value, setValue] = (0, import_react14.useState)("");
4718
+ const [originalValue, setOriginalValue] = (0, import_react14.useState)("");
4669
4719
  const preference = preferences?.find((p) => p.name === name);
4670
4720
  const trait = traits?.find((t) => t.name === name);
4671
- const queryClient = (0, import_react_query3.useQueryClient)();
4672
- const transport = (0, import_connect_query10.useTransport)();
4673
- const { mutateAsync: createPreferences, isPending: isActionLoading } = (0, import_connect_query10.useMutation)(import_frontier12.AdminServiceQueries.createPreferences, {
4721
+ const queryClient = (0, import_react_query4.useQueryClient)();
4722
+ const transport = (0, import_connect_query11.useTransport)();
4723
+ const { mutateAsync: createPreferences, isPending: isActionLoading } = (0, import_connect_query11.useMutation)(import_frontier13.AdminServiceQueries.createPreferences, {
4674
4724
  onSuccess: (data) => {
4675
- const queryKey = (0, import_connect_query10.createConnectQueryKey)({
4676
- schema: import_frontier12.AdminServiceQueries.listPreferences,
4725
+ const queryKey = (0, import_connect_query11.createConnectQueryKey)({
4726
+ schema: import_frontier13.AdminServiceQueries.listPreferences,
4677
4727
  transport,
4678
4728
  input: {},
4679
4729
  cardinality: "finite"
@@ -4708,7 +4758,7 @@ function PreferenceDetails({
4708
4758
  { name: trait?.title ?? name }
4709
4759
  ]
4710
4760
  };
4711
- (0, import_react12.useEffect)(() => {
4761
+ (0, import_react14.useEffect)(() => {
4712
4762
  const v = preference?.value !== "" && preference?.value !== void 0 ? preference?.value : trait?.default;
4713
4763
  const newValue = v || "";
4714
4764
  setValue(newValue);
@@ -4749,9 +4799,9 @@ function PreferenceDetails({
4749
4799
  value: formatTimestamp(preference?.updatedAt, `${DATE_FORMAT} hh:mm:ss A`)
4750
4800
  }
4751
4801
  ];
4752
- const onSave = (0, import_react12.useCallback)(async () => {
4802
+ const onSave = (0, import_react14.useCallback)(async () => {
4753
4803
  try {
4754
- await createPreferences((0, import_protobuf3.create)(import_frontier12.CreatePreferencesRequestSchema, {
4804
+ await createPreferences((0, import_protobuf4.create)(import_frontier13.CreatePreferencesRequestSchema, {
4755
4805
  preferences: [
4756
4806
  {
4757
4807
  name,
@@ -4837,15 +4887,15 @@ function PreferencesView({
4837
4887
  onSelectPreference,
4838
4888
  icon
4839
4889
  } = {}) {
4840
- const transport = (0, import_connect_query11.useTransport)();
4841
- const [preferencesQuery, traitsQuery] = (0, import_react_query4.useQueries)({
4890
+ const transport = (0, import_connect_query12.useTransport)();
4891
+ const [preferencesQuery, traitsQuery] = (0, import_react_query5.useQueries)({
4842
4892
  queries: [
4843
4893
  {
4844
- ...(0, import_connect_query11.createQueryOptions)(import_frontier14.AdminServiceQueries.listPreferences, {}, { transport }),
4894
+ ...(0, import_connect_query12.createQueryOptions)(import_frontier15.AdminServiceQueries.listPreferences, {}, { transport }),
4845
4895
  staleTime: Infinity
4846
4896
  },
4847
4897
  {
4848
- ...(0, import_connect_query11.createQueryOptions)(import_frontier14.FrontierServiceQueries.describePreferences, {}, { transport }),
4898
+ ...(0, import_connect_query12.createQueryOptions)(import_frontier15.FrontierServiceQueries.describePreferences, {}, { transport }),
4849
4899
  staleTime: Infinity
4850
4900
  }
4851
4901
  ]
@@ -4896,8 +4946,8 @@ var import_apsara37 = require("@raystack/apsara");
4896
4946
  // admin/views/users/list/navbar.tsx
4897
4947
  var import_apsara35 = require("@raystack/apsara");
4898
4948
 
4899
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-Oq6USgz08mMT/sdk/admin/components/navbar.module.css.js
4900
- var digest27 = "9bd9130e5ab218d6536aceac812aa06c875e2d27e8acc656fa6e3f044dd277ab";
4949
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-DcujKS7Y90WC/sdk/admin/components/navbar.module.css.js
4950
+ var digest27 = "99c100db16f79a7e44fc405f871da2fcd9dea1695cc830ce9875da448edcc33d";
4901
4951
  var css27 = `._navbar_641ya_1 {
4902
4952
  padding: var(--rs-space-4) var(--rs-space-7);
4903
4953
  border-bottom: 0.5px solid var(--rs-color-border-base-primary);
@@ -4951,10 +5001,10 @@ function UsersIcon(props) {
4951
5001
  var UsersIcon_default = UsersIcon;
4952
5002
 
4953
5003
  // admin/views/users/list/navbar.tsx
4954
- var import_react14 = require("react");
5004
+ var import_react16 = require("react");
4955
5005
 
4956
5006
  // admin/views/users/list/invite-users.tsx
4957
- var import_react13 = require("react");
5007
+ var import_react15 = require("react");
4958
5008
  var import_apsara34 = require("@raystack/apsara");
4959
5009
 
4960
5010
  // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
@@ -9002,8 +9052,8 @@ var NEVER = INVALID;
9002
9052
  var import_react_hook_form = require("react-hook-form");
9003
9053
  var import_zod = require("@hookform/resolvers/zod");
9004
9054
 
9005
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-Iu1CtqEp40Q4/sdk/admin/views/users/list/invite-users.module.css.js
9006
- var digest28 = "071124e9456be397cfea823c984d14c191d7677d8f9a8a0d97b9dfc0bcf1d606";
9055
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-ygLjUxm3sIIJ/sdk/admin/views/users/list/invite-users.module.css.js
9056
+ var digest28 = "85708665b83165cbbca2a4cac220926d5493d83e04fb36b51b4e6e42fc451859";
9007
9057
  var css28 = `._invite-users-dialog-body_daxb4_1 {
9008
9058
  display: flex;
9009
9059
  flex-direction: column;
@@ -9030,9 +9080,9 @@ var css28 = `._invite-users-dialog-body_daxb4_1 {
9030
9080
  var invite_users_module_css_default = { "invite-users-dialog-body": "_invite-users-dialog-body_daxb4_1", "inviteUsersDialogBody": "_invite-users-dialog-body_daxb4_1", "invite-users-emails-textarea": "_invite-users-emails-textarea_daxb4_8", "inviteUsersEmailsTextarea": "_invite-users-emails-textarea_daxb4_8" };
9031
9081
 
9032
9082
  // admin/views/users/list/invite-users.tsx
9033
- var import_connect_query12 = require("@connectrpc/connect-query");
9034
- var import_frontier15 = require("@raystack/proton/frontier");
9035
- var import_protobuf4 = require("@bufbuild/protobuf");
9083
+ var import_connect_query13 = require("@connectrpc/connect-query");
9084
+ var import_frontier16 = require("@raystack/proton/frontier");
9085
+ var import_protobuf5 = require("@bufbuild/protobuf");
9036
9086
  var import_jsx_runtime41 = require("react/jsx-runtime");
9037
9087
  var createInviteSchema = (t) => objectType({
9038
9088
  role: stringType().min(1, { message: "Role is required" }),
@@ -9047,15 +9097,16 @@ var createInviteSchema = (t) => objectType({
9047
9097
  });
9048
9098
  var InviteUser = () => {
9049
9099
  const t = useTerminology();
9050
- const [open, onOpenChange] = (0, import_react13.useState)(false);
9100
+ const [open, onOpenChange] = (0, import_react15.useState)(false);
9051
9101
  const {
9052
9102
  data: organizations,
9053
9103
  isLoading: isOrganizationsLoading,
9054
9104
  error: organizationsError
9055
- } = (0, import_connect_query12.useQuery)(
9056
- import_frontier15.AdminServiceQueries.searchOrganizations,
9057
- (0, import_protobuf4.create)(import_frontier15.SearchOrganizationsRequestSchema, { query: {} }),
9105
+ } = (0, import_connect_query13.useQuery)(
9106
+ import_frontier16.AdminServiceQueries.searchOrganizations,
9107
+ (0, import_protobuf5.create)(import_frontier16.SearchOrganizationsRequestSchema, { query: {} }),
9058
9108
  {
9109
+ enabled: open,
9059
9110
  select: (data) => data?.organizations || []
9060
9111
  }
9061
9112
  );
@@ -9063,29 +9114,30 @@ var InviteUser = () => {
9063
9114
  data: roles,
9064
9115
  isLoading: isRolesLoading,
9065
9116
  error: rolesError
9066
- } = (0, import_connect_query12.useQuery)(
9067
- import_frontier15.FrontierServiceQueries.listRoles,
9068
- (0, import_protobuf4.create)(import_frontier15.ListRolesRequestSchema, { scopes: [SCOPES.ORG] }),
9117
+ } = (0, import_connect_query13.useQuery)(
9118
+ import_frontier16.FrontierServiceQueries.listRoles,
9119
+ (0, import_protobuf5.create)(import_frontier16.ListRolesRequestSchema, { scopes: [SCOPES.ORG] }),
9069
9120
  {
9121
+ enabled: open,
9070
9122
  select: (data) => data?.roles || []
9071
9123
  }
9072
9124
  );
9073
9125
  const isLoading = isRolesLoading || isOrganizationsLoading;
9074
- (0, import_react13.useEffect)(() => {
9126
+ (0, import_react15.useEffect)(() => {
9075
9127
  if (organizationsError) {
9076
9128
  console.error("Failed to fetch organizations:", organizationsError);
9077
9129
  }
9078
9130
  }, [organizationsError]);
9079
- (0, import_react13.useEffect)(() => {
9131
+ (0, import_react15.useEffect)(() => {
9080
9132
  if (rolesError) {
9081
9133
  console.error("Failed to fetch roles:", rolesError);
9082
9134
  }
9083
9135
  }, [rolesError]);
9084
- const defaultRoleId = (0, import_react13.useMemo)(
9136
+ const defaultRoleId = (0, import_react15.useMemo)(
9085
9137
  () => roles?.find((role) => role.name === DEFAULT_ROLES.ORG_VIEWER)?.id,
9086
9138
  [roles]
9087
9139
  );
9088
- const inviteSchema2 = (0, import_react13.useMemo)(() => createInviteSchema(t), [t]);
9140
+ const inviteSchema2 = (0, import_react15.useMemo)(() => createInviteSchema(t), [t]);
9089
9141
  const {
9090
9142
  formState: { errors, isSubmitting },
9091
9143
  handleSubmit,
@@ -9097,8 +9149,8 @@ var InviteUser = () => {
9097
9149
  role: defaultRoleId
9098
9150
  }
9099
9151
  });
9100
- const { mutateAsync: inviteUser } = (0, import_connect_query12.useMutation)(
9101
- import_frontier15.FrontierServiceQueries.createOrganizationInvitation,
9152
+ const { mutateAsync: inviteUser } = (0, import_connect_query13.useMutation)(
9153
+ import_frontier16.FrontierServiceQueries.createOrganizationInvitation,
9102
9154
  {
9103
9155
  onSuccess: (data) => {
9104
9156
  const invitedCount = data?.invitations?.length ?? 0;
@@ -9265,8 +9317,8 @@ var InviteUser = () => {
9265
9317
  // admin/views/users/list/navbar.tsx
9266
9318
  var import_jsx_runtime42 = require("react/jsx-runtime");
9267
9319
  var Navbar2 = ({ searchQuery, onExportUsers }) => {
9268
- const [showSearch, setShowSearch] = (0, import_react14.useState)(searchQuery ? true : false);
9269
- const [isDownloading, setIsDownloading] = (0, import_react14.useState)(false);
9320
+ const [showSearch, setShowSearch] = (0, import_react16.useState)(searchQuery ? true : false);
9321
+ const [isDownloading, setIsDownloading] = (0, import_react16.useState)(false);
9270
9322
  function toggleSearch() {
9271
9323
  setShowSearch((prev) => !prev);
9272
9324
  }
@@ -9332,8 +9384,8 @@ var Navbar2 = ({ searchQuery, onExportUsers }) => {
9332
9384
  };
9333
9385
  var navbar_default2 = Navbar2;
9334
9386
 
9335
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-bS7KxmmaBAMB/sdk/admin/views/users/list/list.module.css.js
9336
- var digest29 = "781f3e5bc9307d2144f3cc2587ff7c687873e7d9139b2f1059f3dfbd68512eb0";
9387
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-48bBY4gQOLsC/sdk/admin/views/users/list/list.module.css.js
9388
+ var digest29 = "46981cbe33d76e6d1d7550f68579d26aa9054212145f6103e030d09ab0704f74";
9337
9389
  var css29 = `._table_1jm7t_1 {
9338
9390
  height: auto;
9339
9391
  }
@@ -9387,8 +9439,8 @@ var list_module_css_default = { "table": "_table_1jm7t_1", "table-empty": "_tabl
9387
9439
  // admin/views/users/list/columns.tsx
9388
9440
  var import_apsara36 = require("@raystack/apsara");
9389
9441
 
9390
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-dx5ydVCfm4A2/sdk/admin/views/users/list/list.module.css.js
9391
- var digest30 = "350b7eadc21bd83c35ec9972ebe2cdfacad2b41f3e17f708d7338e9c276fa5ec";
9442
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-MHgjE0YU2hqb/sdk/admin/views/users/list/list.module.css.js
9443
+ var digest30 = "09b2978e0d28c9c068e9f945b84a463622842011a36e2b96f82bd0296fc2e288";
9392
9444
  var css30 = `._table_1jm7t_1 {
9393
9445
  height: auto;
9394
9446
  }
@@ -9530,9 +9582,8 @@ var getColumns10 = ({
9530
9582
  };
9531
9583
 
9532
9584
  // admin/views/users/list/list.tsx
9533
- var import_connect_query13 = require("@connectrpc/connect-query");
9534
- var import_frontier16 = require("@raystack/proton/frontier");
9535
- var import_hooks2 = require("@raystack/apsara/hooks");
9585
+ var import_connect_query14 = require("@connectrpc/connect-query");
9586
+ var import_frontier17 = require("@raystack/proton/frontier");
9536
9587
  var import_jsx_runtime44 = require("react/jsx-runtime");
9537
9588
  var NoUsers = () => {
9538
9589
  const t = useTerminology();
@@ -9550,20 +9601,19 @@ var NoUsers = () => {
9550
9601
  );
9551
9602
  };
9552
9603
  var DEFAULT_SORT3 = { name: "createdAt", order: "desc" };
9553
- var INITIAL_QUERY3 = {
9554
- offset: 0,
9555
- limit: DEFAULT_PAGE_SIZE
9556
- };
9557
9604
  var UsersList = ({ onExportUsers, onNavigateToUser }) => {
9558
9605
  const t = useTerminology();
9559
- const [tableQuery, setTableQuery] = (0, import_hooks2.useDebouncedState)(
9560
- INITIAL_QUERY3,
9561
- 200
9562
- );
9563
- const query = transformDataTableQueryToRQLRequest(tableQuery, {
9564
- fieldNameMapping: {
9565
- createdAt: "created_at",
9566
- updatedAt: "updated_at"
9606
+ const {
9607
+ tableQuery,
9608
+ rqlQuery: query,
9609
+ onTableQueryChange
9610
+ } = useServerTableQuery({
9611
+ defaultSort: DEFAULT_SORT3,
9612
+ transformOptions: {
9613
+ fieldNameMapping: {
9614
+ createdAt: "created_at",
9615
+ updatedAt: "updated_at"
9616
+ }
9567
9617
  }
9568
9618
  });
9569
9619
  const {
@@ -9571,10 +9621,11 @@ var UsersList = ({ onExportUsers, onNavigateToUser }) => {
9571
9621
  isLoading,
9572
9622
  isFetchingNextPage,
9573
9623
  fetchNextPage,
9624
+ hasNextPage,
9574
9625
  error,
9575
9626
  isError
9576
- } = (0, import_connect_query13.useInfiniteQuery)(
9577
- import_frontier16.AdminServiceQueries.searchUsers,
9627
+ } = (0, import_connect_query14.useInfiniteQuery)(
9628
+ import_frontier17.AdminServiceQueries.searchUsers,
9578
9629
  { query },
9579
9630
  {
9580
9631
  pageParamKey: "query",
@@ -9587,20 +9638,13 @@ var UsersList = ({ onExportUsers, onNavigateToUser }) => {
9587
9638
  );
9588
9639
  const data = infiniteData?.pages?.flatMap((page) => page?.users || []) || [];
9589
9640
  const groupCountMap = infiniteData ? getGroupCountMapFromFirstPage(infiniteData) : {};
9590
- const onTableQueryChange = (newQuery) => {
9591
- setTableQuery({
9592
- ...newQuery,
9593
- offset: 0,
9594
- limit: newQuery.limit || DEFAULT_PAGE_SIZE
9595
- });
9596
- };
9597
- const handleLoadMore = async () => {
9598
- try {
9599
- await fetchNextPage();
9600
- } catch (error2) {
9601
- console.error("Error loading more users:", error2);
9602
- }
9603
- };
9641
+ const handleLoadMore = useLoadMore({
9642
+ hasNextPage,
9643
+ isFetchingNextPage,
9644
+ isError,
9645
+ fetchNextPage,
9646
+ label: "users"
9647
+ });
9604
9648
  const columns = getColumns10({ groupCountMap, onNavigateToUser });
9605
9649
  const loading = isLoading || isFetchingNextPage;
9606
9650
  const onRowClick = (row) => {
@@ -9661,7 +9705,7 @@ var UsersList = ({ onExportUsers, onNavigateToUser }) => {
9661
9705
  var import_apsara53 = require("@raystack/apsara");
9662
9706
 
9663
9707
  // admin/views/users/details/layout/layout.tsx
9664
- var import_react20 = require("react");
9708
+ var import_react22 = require("react");
9665
9709
  var import_apsara46 = require("@raystack/apsara");
9666
9710
 
9667
9711
  // admin/views/users/details/layout/side-panel.tsx
@@ -9670,8 +9714,8 @@ var import_apsara44 = require("@raystack/apsara");
9670
9714
  // admin/views/users/details/layout/side-panel-details.tsx
9671
9715
  var import_apsara38 = require("@raystack/apsara");
9672
9716
 
9673
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-UKv1GR0gvbOj/sdk/admin/views/users/details/layout/side-panel.module.css.js
9674
- var digest31 = "37edd1ed084af0e88ab4e15849faf9be2b579cea8955560286e5a52d74641449";
9717
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-6GMqxL35rW1y/sdk/admin/views/users/details/layout/side-panel.module.css.js
9718
+ var digest31 = "a0f1a27cb8562406558229d0a172d3b581e54b0783fef99ce1ff19da691b6fef";
9675
9719
  var css31 = `._side-panel_cosj9_1 {
9676
9720
  transform: all 0.3s ease-in-out;
9677
9721
  padding-bottom: var(--rs-space-15);
@@ -9738,11 +9782,11 @@ var css31 = `._side-panel_cosj9_1 {
9738
9782
  var side_panel_module_css_default = { "side-panel": "_side-panel_cosj9_1", "sidePanel": "_side-panel_cosj9_1", "side-panel-label": "_side-panel-label_cosj9_6", "sidePanelLabel": "_side-panel-label_cosj9_6", "text-overflow": "_text-overflow_cosj9_10", "textOverflow": "_text-overflow_cosj9_10", "list-header": "_list-header_cosj9_18", "listHeader": "_list-header_cosj9_18", "loader-header": "_loader-header_cosj9_21", "loaderHeader": "_loader-header_cosj9_21", "dropdown-item": "_dropdown-item_cosj9_30", "dropdownItem": "_dropdown-item_cosj9_30", "dropdown-menu-trigger": "_dropdown-menu-trigger_cosj9_35", "dropdownMenuTrigger": "_dropdown-menu-trigger_cosj9_35", "listLabel": "_listLabel_cosj9_50" };
9739
9783
 
9740
9784
  // admin/views/users/details/user-context.tsx
9741
- var import_react15 = require("react");
9742
- var UserContext = (0, import_react15.createContext)(void 0);
9785
+ var import_react17 = require("react");
9786
+ var UserContext = (0, import_react17.createContext)(void 0);
9743
9787
  var UserProvider = UserContext.Provider;
9744
9788
  var useUser = () => {
9745
- const context = (0, import_react15.useContext)(UserContext);
9789
+ const context = (0, import_react17.useContext)(UserContext);
9746
9790
  if (context === void 0) {
9747
9791
  throw new Error("useUser must be used within a UserProvider");
9748
9792
  }
@@ -9791,8 +9835,8 @@ var SidePanelDetails2 = () => {
9791
9835
  // admin/views/users/details/layout/side-panel-membership.tsx
9792
9836
  var import_apsara42 = require("@raystack/apsara");
9793
9837
 
9794
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-FJtracXSKeHM/sdk/admin/views/users/details/layout/side-panel.module.css.js
9795
- var digest32 = "eee0c69de6ac4806eddd19ffef28e7343ff412b1bd675e6e33eee05a8e6b2702";
9838
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-r8doEuH4IrC5/sdk/admin/views/users/details/layout/side-panel.module.css.js
9839
+ var digest32 = "a8ec833f9666c00471763c2279a4a4c099ba2afbe2209e88b484692603aae92e";
9796
9840
  var css32 = `._side-panel_cosj9_1 {
9797
9841
  transform: all 0.3s ease-in-out;
9798
9842
  padding-bottom: var(--rs-space-15);
@@ -9861,8 +9905,8 @@ var side_panel_module_css_default2 = { "side-panel": "_side-panel_cosj9_1", "sid
9861
9905
  // admin/views/users/details/layout/membership-dropdown.tsx
9862
9906
  var import_apsara41 = require("@raystack/apsara");
9863
9907
 
9864
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-AfhG2aymH6IN/sdk/admin/views/users/details/layout/side-panel.module.css.js
9865
- var digest33 = "611d5407121990643d3e4991cbc50f7a512209680368bade1b9ba49fbec8e37d";
9908
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-6Vo2LBYGhdFn/sdk/admin/views/users/details/layout/side-panel.module.css.js
9909
+ var digest33 = "2ab122ef0f524003185f75457861a1468f318a89afdbe819db8c5135d880ffdf";
9866
9910
  var css33 = `._side-panel_cosj9_1 {
9867
9911
  transform: all 0.3s ease-in-out;
9868
9912
  padding-bottom: var(--rs-space-15);
@@ -9929,25 +9973,26 @@ var css33 = `._side-panel_cosj9_1 {
9929
9973
  var side_panel_module_css_default3 = { "side-panel": "_side-panel_cosj9_1", "sidePanel": "_side-panel_cosj9_1", "side-panel-label": "_side-panel-label_cosj9_6", "sidePanelLabel": "_side-panel-label_cosj9_6", "text-overflow": "_text-overflow_cosj9_10", "textOverflow": "_text-overflow_cosj9_10", "list-header": "_list-header_cosj9_18", "listHeader": "_list-header_cosj9_18", "loader-header": "_loader-header_cosj9_21", "loaderHeader": "_loader-header_cosj9_21", "dropdown-item": "_dropdown-item_cosj9_30", "dropdownItem": "_dropdown-item_cosj9_30", "dropdown-menu-trigger": "_dropdown-menu-trigger_cosj9_35", "dropdownMenuTrigger": "_dropdown-menu-trigger_cosj9_35", "listLabel": "_listLabel_cosj9_50" };
9930
9974
 
9931
9975
  // admin/views/users/details/layout/membership-dropdown.tsx
9932
- var import_react18 = require("react");
9933
- var import_frontier19 = require("@raystack/proton/frontier");
9934
- var import_protobuf7 = require("@bufbuild/protobuf");
9976
+ var import_react20 = require("react");
9977
+ var import_frontier20 = require("@raystack/proton/frontier");
9978
+ var import_protobuf8 = require("@bufbuild/protobuf");
9935
9979
 
9936
9980
  // admin/hooks/useOrganizationRoles.ts
9937
- var import_react16 = require("react");
9938
- var import_connect_query14 = require("@connectrpc/connect-query");
9939
- var import_protobuf5 = require("@bufbuild/protobuf");
9940
- var import_frontier17 = require("@raystack/proton/frontier");
9981
+ var import_react18 = require("react");
9982
+ var import_connect_query15 = require("@connectrpc/connect-query");
9983
+ var import_protobuf6 = require("@bufbuild/protobuf");
9984
+ var import_frontier18 = require("@raystack/proton/frontier");
9941
9985
  var useOrganizationRoles = (orgId, { enabled = true } = {}) => {
9942
9986
  const {
9943
9987
  data: defaultRoles = [],
9944
9988
  isLoading: isDefaultRolesLoading,
9945
9989
  error: defaultRolesError
9946
- } = (0, import_connect_query14.useQuery)(
9947
- import_frontier17.FrontierServiceQueries.listRoles,
9948
- (0, import_protobuf5.create)(import_frontier17.ListRolesRequestSchema, { scopes: [SCOPES.ORG] }),
9990
+ } = (0, import_connect_query15.useQuery)(
9991
+ import_frontier18.FrontierServiceQueries.listRoles,
9992
+ (0, import_protobuf6.create)(import_frontier18.ListRolesRequestSchema, { scopes: [SCOPES.ORG] }),
9949
9993
  {
9950
9994
  enabled,
9995
+ staleTime: SHARED_QUERY_STALE_TIME,
9951
9996
  select: (data) => data?.roles || []
9952
9997
  }
9953
9998
  );
@@ -9955,18 +10000,19 @@ var useOrganizationRoles = (orgId, { enabled = true } = {}) => {
9955
10000
  data: organizationRoles = [],
9956
10001
  isLoading: isOrgRolesLoading,
9957
10002
  error: orgRolesError
9958
- } = (0, import_connect_query14.useQuery)(
9959
- import_frontier17.FrontierServiceQueries.listOrganizationRoles,
9960
- (0, import_protobuf5.create)(import_frontier17.ListOrganizationRolesRequestSchema, {
10003
+ } = (0, import_connect_query15.useQuery)(
10004
+ import_frontier18.FrontierServiceQueries.listOrganizationRoles,
10005
+ (0, import_protobuf6.create)(import_frontier18.ListOrganizationRolesRequestSchema, {
9961
10006
  orgId: orgId || "",
9962
10007
  scopes: [SCOPES.ORG]
9963
10008
  }),
9964
10009
  {
9965
10010
  enabled: enabled && !!orgId,
10011
+ staleTime: SHARED_QUERY_STALE_TIME,
9966
10012
  select: (data) => data?.roles || []
9967
10013
  }
9968
10014
  );
9969
- (0, import_react16.useEffect)(() => {
10015
+ (0, import_react18.useEffect)(() => {
9970
10016
  if (defaultRolesError) {
9971
10017
  console.error("Failed to fetch default roles:", defaultRolesError);
9972
10018
  }
@@ -9974,11 +10020,11 @@ var useOrganizationRoles = (orgId, { enabled = true } = {}) => {
9974
10020
  console.error("Failed to fetch organization roles:", orgRolesError);
9975
10021
  }
9976
10022
  }, [defaultRolesError, orgRolesError]);
9977
- const roles = (0, import_react16.useMemo)(
10023
+ const roles = (0, import_react18.useMemo)(
9978
10024
  () => [...defaultRoles, ...organizationRoles],
9979
10025
  [defaultRoles, organizationRoles]
9980
10026
  );
9981
- const titleById = (0, import_react16.useMemo)(
10027
+ const titleById = (0, import_react18.useMemo)(
9982
10028
  () => new Map(roles.map((role) => [role.id, role.title || role.name])),
9983
10029
  [roles]
9984
10030
  );
@@ -9992,10 +10038,10 @@ var useOrganizationRoles = (orgId, { enabled = true } = {}) => {
9992
10038
 
9993
10039
  // admin/components/AssignRole.tsx
9994
10040
  var import_apsara39 = require("@raystack/apsara");
9995
- var import_frontier18 = require("@raystack/proton/frontier");
9996
- var import_protobuf6 = require("@bufbuild/protobuf");
9997
- var import_connect2 = require("@connectrpc/connect");
9998
- var import_connect_query15 = require("@connectrpc/connect-query");
10041
+ var import_frontier19 = require("@raystack/proton/frontier");
10042
+ var import_protobuf7 = require("@bufbuild/protobuf");
10043
+ var import_connect3 = require("@connectrpc/connect");
10044
+ var import_connect_query16 = require("@connectrpc/connect-query");
9999
10045
  var import_react_hook_form2 = require("react-hook-form");
10000
10046
  var import_zod2 = require("@hookform/resolvers/zod");
10001
10047
  var import_jsx_runtime46 = require("react/jsx-runtime");
@@ -10021,14 +10067,14 @@ var AssignRole = ({
10021
10067
  },
10022
10068
  resolver: (0, import_zod2.zodResolver)(formSchema)
10023
10069
  });
10024
- const { mutateAsync: setMemberRole } = (0, import_connect_query15.useMutation)(
10025
- import_frontier18.FrontierServiceQueries.setOrganizationMemberRole
10070
+ const { mutateAsync: setMemberRole } = (0, import_connect_query16.useMutation)(
10071
+ import_frontier19.FrontierServiceQueries.setOrganizationMemberRole
10026
10072
  );
10027
10073
  const selectedRoleId = watch("roleId");
10028
10074
  const onSubmit = async (data) => {
10029
10075
  try {
10030
10076
  await setMemberRole(
10031
- (0, import_protobuf6.create)(import_frontier18.SetOrganizationMemberRoleRequestSchema, {
10077
+ (0, import_protobuf7.create)(import_frontier19.SetOrganizationMemberRoleRequestSchema, {
10032
10078
  orgId: organizationId,
10033
10079
  userId: user?.id,
10034
10080
  roleId: data.roleId
@@ -10044,7 +10090,7 @@ var AssignRole = ({
10044
10090
  } catch (error) {
10045
10091
  import_apsara39.toastManager.add({
10046
10092
  title: "Failed to assign role",
10047
- description: error instanceof import_connect2.ConnectError ? error.message : void 0,
10093
+ description: error instanceof import_connect3.ConnectError ? error.message : void 0,
10048
10094
  type: "error"
10049
10095
  });
10050
10096
  console.error(error);
@@ -10113,7 +10159,7 @@ var AssignRole = ({
10113
10159
  };
10114
10160
 
10115
10161
  // admin/views/users/details/layout/suspend-user.tsx
10116
- var import_react17 = require("react");
10162
+ var import_react19 = require("react");
10117
10163
  var import_apsara40 = require("@raystack/apsara");
10118
10164
  var import_jsx_runtime47 = require("react/jsx-runtime");
10119
10165
  var SuspendUser = ({
@@ -10122,7 +10168,7 @@ var SuspendUser = ({
10122
10168
  onSubmit
10123
10169
  }) => {
10124
10170
  const t = useTerminology();
10125
- const [isSubmitting, setIsSubmitting] = (0, import_react17.useState)(false);
10171
+ const [isSubmitting, setIsSubmitting] = (0, import_react19.useState)(false);
10126
10172
  const handleSuspend = async () => {
10127
10173
  try {
10128
10174
  setIsSubmitting(true);
@@ -10186,8 +10232,8 @@ var MembershipDropdown = ({
10186
10232
  data,
10187
10233
  onReset
10188
10234
  }) => {
10189
- const [isAssignRoleDialogOpen, setIsAssignRoleDialogOpen] = (0, import_react18.useState)(false);
10190
- const [isSuspendDialogOpen, setIsSuspendDialogOpen] = (0, import_react18.useState)(false);
10235
+ const [isAssignRoleDialogOpen, setIsAssignRoleDialogOpen] = (0, import_react20.useState)(false);
10236
+ const [isSuspendDialogOpen, setIsSuspendDialogOpen] = (0, import_react20.useState)(false);
10191
10237
  const { user } = useUser();
10192
10238
  const { roles, isLoading } = useOrganizationRoles(data?.orgId);
10193
10239
  const toggleAssignRoleDialog = () => {
@@ -10204,9 +10250,9 @@ var MembershipDropdown = ({
10204
10250
  toggleSuspendDialog();
10205
10251
  onReset?.();
10206
10252
  };
10207
- const memoizedUser = (0, import_react18.useMemo)(
10208
- () => (0, import_protobuf7.create)(
10209
- import_frontier19.SearchOrganizationUsersResponse_OrganizationUserSchema,
10253
+ const memoizedUser = (0, import_react20.useMemo)(
10254
+ () => (0, import_protobuf8.create)(
10255
+ import_frontier20.SearchOrganizationUsersResponse_OrganizationUserSchema,
10210
10256
  Object.assign(user ?? {}, {
10211
10257
  roleNames: data?.roleNames || [],
10212
10258
  roleTitles: data?.roleTitles || [],
@@ -10305,10 +10351,10 @@ var SidePanelMembership = ({
10305
10351
 
10306
10352
  // admin/views/users/details/layout/side-panel-invitation.tsx
10307
10353
  var import_apsara43 = require("@raystack/apsara");
10308
- var import_react19 = require("react");
10354
+ var import_react21 = require("react");
10309
10355
 
10310
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-P82B0JdNIziT/sdk/admin/views/users/details/layout/side-panel.module.css.js
10311
- var digest34 = "3a78d53aaa966a1985bc00d7da2444e6aca8067ea0560eec8c059de791c8b2c8";
10356
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-oqB9EaNzBges/sdk/admin/views/users/details/layout/side-panel.module.css.js
10357
+ var digest34 = "77e274f2a46d811336019974318584449f6745a30d8539de2eb7c6e8c8ec1908";
10312
10358
  var css34 = `._side-panel_cosj9_1 {
10313
10359
  transform: all 0.3s ease-in-out;
10314
10360
  padding-bottom: var(--rs-space-15);
@@ -10383,7 +10429,7 @@ var SidePanelInvitation = ({
10383
10429
  }) => {
10384
10430
  const { data: org } = useOrganizationLookup(data?.orgId);
10385
10431
  const { titleById } = useOrganizationRoles(data?.orgId);
10386
- const roleTitles = (0, import_react19.useMemo)(
10432
+ const roleTitles = (0, import_react21.useMemo)(
10387
10433
  () => (data?.roleIds || []).map((roleId) => titleById.get(roleId)).filter(Boolean).join(", "),
10388
10434
  [titleById, data?.roleIds]
10389
10435
  );
@@ -10429,8 +10475,8 @@ var SidePanelInvitation = ({
10429
10475
  ] });
10430
10476
  };
10431
10477
 
10432
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-6tF6iYJ42HhL/sdk/admin/views/users/details/layout/side-panel.module.css.js
10433
- var digest35 = "d0f5ac01facdc98f338e7f3cb07ed49efe3c7b5cb72a70c4f444e7848e5367bb";
10478
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-OWAGOD5VTEy7/sdk/admin/views/users/details/layout/side-panel.module.css.js
10479
+ var digest35 = "ebad531175d9c07551dd719bda3aadf0c5aae0163eabc3c29308b9d2679e731c";
10434
10480
  var css35 = `._side-panel_cosj9_1 {
10435
10481
  transform: all 0.3s ease-in-out;
10436
10482
  padding-bottom: var(--rs-space-15);
@@ -10497,8 +10543,8 @@ var css35 = `._side-panel_cosj9_1 {
10497
10543
  var side_panel_module_css_default5 = { "side-panel": "_side-panel_cosj9_1", "sidePanel": "_side-panel_cosj9_1", "side-panel-label": "_side-panel-label_cosj9_6", "sidePanelLabel": "_side-panel-label_cosj9_6", "text-overflow": "_text-overflow_cosj9_10", "textOverflow": "_text-overflow_cosj9_10", "list-header": "_list-header_cosj9_18", "listHeader": "_list-header_cosj9_18", "loader-header": "_loader-header_cosj9_21", "loaderHeader": "_loader-header_cosj9_21", "dropdown-item": "_dropdown-item_cosj9_30", "dropdownItem": "_dropdown-item_cosj9_30", "dropdown-menu-trigger": "_dropdown-menu-trigger_cosj9_35", "dropdownMenuTrigger": "_dropdown-menu-trigger_cosj9_35", "listLabel": "_listLabel_cosj9_50" };
10498
10544
 
10499
10545
  // admin/views/users/details/layout/side-panel.tsx
10500
- var import_frontier20 = require("@raystack/proton/frontier");
10501
- var import_connect_query16 = require("@connectrpc/connect-query");
10546
+ var import_frontier21 = require("@raystack/proton/frontier");
10547
+ var import_connect_query17 = require("@connectrpc/connect-query");
10502
10548
  var import_jsx_runtime51 = require("react/jsx-runtime");
10503
10549
  var UserDetailsSidePanel = () => {
10504
10550
  const { user } = useUser();
@@ -10507,8 +10553,8 @@ var UserDetailsSidePanel = () => {
10507
10553
  isLoading,
10508
10554
  refetch: onReset,
10509
10555
  error
10510
- } = (0, import_connect_query16.useQuery)(
10511
- import_frontier20.AdminServiceQueries.searchUserOrganizations,
10556
+ } = (0, import_connect_query17.useQuery)(
10557
+ import_frontier21.AdminServiceQueries.searchUserOrganizations,
10512
10558
  {
10513
10559
  id: user?.id || "",
10514
10560
  query: {}
@@ -10523,8 +10569,8 @@ var UserDetailsSidePanel = () => {
10523
10569
  data: invitationsResponse,
10524
10570
  isLoading: isInvitationsLoading,
10525
10571
  error: invitationsError
10526
- } = (0, import_connect_query16.useQuery)(
10527
- import_frontier20.FrontierServiceQueries.listUserInvitations,
10572
+ } = (0, import_connect_query17.useQuery)(
10573
+ import_frontier21.FrontierServiceQueries.listUserInvitations,
10528
10574
  // `id` is the user's email, not their uuid — invitations are keyed by email
10529
10575
  // since the invitee may not have an account yet.
10530
10576
  {
@@ -10573,8 +10619,8 @@ var UserDetailsSidePanel = () => {
10573
10619
  );
10574
10620
  };
10575
10621
 
10576
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-JeyNIghzKucI/sdk/admin/views/users/details/layout/layout.module.css.js
10577
- var digest36 = "5170f12c1e5a722114349fb89d3cbbe5e78a73005a89da280e30bfb2a6ef0699";
10622
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-423jM802WXhn/sdk/admin/views/users/details/layout/layout.module.css.js
10623
+ var digest36 = "c649b9449d4f517276dfceab8658c97d5e8032f58c27dfab369a5bfb0777cc31";
10578
10624
  var css36 = `._page_190wz_1 {
10579
10625
  height: 100vh;
10580
10626
  width: 100%;
@@ -10608,8 +10654,8 @@ var layout_module_css_default = { "page": "_page_190wz_1", "main_content": "_mai
10608
10654
  var import_apsara45 = require("@raystack/apsara");
10609
10655
  var import_icons = require("@raystack/apsara/icons");
10610
10656
 
10611
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-TYKm9MNU5yhc/sdk/admin/components/navbar.module.css.js
10612
- var digest37 = "ea4fe069e8cc91cd18f55784f80ed5e133b3162fe8912c585c047afa76138d17";
10657
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-J7eRffw8y2Hu/sdk/admin/components/navbar.module.css.js
10658
+ var digest37 = "faed435f5a1796cd6062bb80a10e8b971c7b7db6b0f73371d83754ebd3fdcd35";
10613
10659
  var css37 = `._navbar_641ya_1 {
10614
10660
  padding: var(--rs-space-4) var(--rs-space-7);
10615
10661
  border-bottom: 0.5px solid var(--rs-color-border-base-primary);
@@ -10710,7 +10756,7 @@ var UserDetailsNavbar = ({
10710
10756
  // admin/views/users/details/layout/layout.tsx
10711
10757
  var import_jsx_runtime53 = require("react/jsx-runtime");
10712
10758
  var UserDetailsLayout = ({ children, currentPath, onNavigate }) => {
10713
- const [showSidePanel, setShowSidePanel] = (0, import_react20.useState)(true);
10759
+ const [showSidePanel, setShowSidePanel] = (0, import_react22.useState)(true);
10714
10760
  function toggleSidePanel() {
10715
10761
  setShowSidePanel(!showSidePanel);
10716
10762
  }
@@ -10730,32 +10776,32 @@ var UserDetailsLayout = ({ children, currentPath, onNavigate }) => {
10730
10776
  };
10731
10777
 
10732
10778
  // admin/views/users/details/user-details.tsx
10733
- var import_connect_query19 = require("@connectrpc/connect-query");
10734
- var import_frontier23 = require("@raystack/proton/frontier");
10779
+ var import_connect_query20 = require("@connectrpc/connect-query");
10780
+ var import_frontier24 = require("@raystack/proton/frontier");
10735
10781
 
10736
10782
  // admin/views/users/details/security/security.tsx
10737
10783
  var import_apsara52 = require("@raystack/apsara");
10738
10784
 
10739
10785
  // admin/views/users/details/security/block-user.tsx
10740
- var import_react21 = require("react");
10786
+ var import_react23 = require("react");
10741
10787
  var import_apsara47 = require("@raystack/apsara");
10742
- var import_connect_query17 = require("@connectrpc/connect-query");
10743
- var import_frontier21 = require("@raystack/proton/frontier");
10744
- var import_react_query5 = require("@tanstack/react-query");
10788
+ var import_connect_query18 = require("@connectrpc/connect-query");
10789
+ var import_frontier22 = require("@raystack/proton/frontier");
10790
+ var import_react_query6 = require("@tanstack/react-query");
10745
10791
  var import_jsx_runtime54 = require("react/jsx-runtime");
10746
10792
  var BlockUserDialog = () => {
10747
10793
  const t = useTerminology();
10748
- const [isDialogOpen, setIsDialogOpen] = (0, import_react21.useState)(false);
10794
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react23.useState)(false);
10749
10795
  const { user, reset } = useUser();
10750
- const queryClient = (0, import_react_query5.useQueryClient)();
10751
- const transport = (0, import_connect_query17.useTransport)();
10796
+ const queryClient = (0, import_react_query6.useQueryClient)();
10797
+ const transport = (0, import_connect_query18.useTransport)();
10752
10798
  const isActive = user?.state === "enabled";
10753
10799
  const userName = getUserName(user);
10754
- const optimisticUpdateState = (0, import_react21.useCallback)(
10800
+ const optimisticUpdateState = (0, import_react23.useCallback)(
10755
10801
  (state) => {
10756
10802
  queryClient.setQueryData(
10757
- (0, import_connect_query17.createConnectQueryKey)({
10758
- schema: import_frontier21.FrontierServiceQueries.getUser,
10803
+ (0, import_connect_query18.createConnectQueryKey)({
10804
+ schema: import_frontier22.FrontierServiceQueries.getUser,
10759
10805
  transport,
10760
10806
  input: { id: user?.id || "" },
10761
10807
  cardinality: "finite"
@@ -10772,8 +10818,8 @@ var BlockUserDialog = () => {
10772
10818
  },
10773
10819
  [queryClient, transport, user?.id]
10774
10820
  );
10775
- const { mutateAsync: blockUser, isPending: isBlockingUser } = (0, import_connect_query17.useMutation)(
10776
- import_frontier21.FrontierServiceQueries.disableUser,
10821
+ const { mutateAsync: blockUser, isPending: isBlockingUser } = (0, import_connect_query18.useMutation)(
10822
+ import_frontier22.FrontierServiceQueries.disableUser,
10777
10823
  {
10778
10824
  onSuccess: () => {
10779
10825
  import_apsara47.toastManager.add({ title: `${t.user({ case: "capital" })} blocked successfully`, type: "success" });
@@ -10783,8 +10829,8 @@ var BlockUserDialog = () => {
10783
10829
  }
10784
10830
  }
10785
10831
  );
10786
- const { mutateAsync: unblockUser, isPending: isUnblockingUser } = (0, import_connect_query17.useMutation)(
10787
- import_frontier21.FrontierServiceQueries.enableUser,
10832
+ const { mutateAsync: unblockUser, isPending: isUnblockingUser } = (0, import_connect_query18.useMutation)(
10833
+ import_frontier22.FrontierServiceQueries.enableUser,
10788
10834
  {
10789
10835
  onSuccess: () => {
10790
10836
  import_apsara47.toastManager.add({ title: `${t.user({ case: "capital" })} unblocked successfully`, type: "success" });
@@ -10882,11 +10928,11 @@ var BlockUserDialog = () => {
10882
10928
  };
10883
10929
 
10884
10930
  // admin/views/users/details/security/sessions/index.tsx
10885
- var import_react23 = require("react");
10931
+ var import_react25 = require("react");
10886
10932
  var import_apsara51 = require("@raystack/apsara");
10887
10933
 
10888
10934
  // admin/views/users/details/security/sessions/revoke-session-confirm.tsx
10889
- var import_react22 = require("react");
10935
+ var import_react24 = require("react");
10890
10936
  var import_apsara49 = require("@raystack/apsara");
10891
10937
 
10892
10938
  // admin/views/users/details/security/sessions/revoke-session-final-confirm.tsx
@@ -10954,8 +11000,8 @@ var RevokeSessionFinalConfirm = ({
10954
11000
  ] }) });
10955
11001
  };
10956
11002
 
10957
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-5eOwKT4hf6pe/sdk/admin/views/users/details/security/sessions/sessions.module.css.js
10958
- var digest38 = "8984ee2cb5ca65fc356e292e5c5955ab5e63f95b82ce8891526cbb976a9c1f7f";
11003
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-YyJ3ILve6aMS/sdk/admin/views/users/details/security/sessions/sessions.module.css.js
11004
+ var digest38 = "94453ce0bf795a88e3756627c451fd285f4306d2c3d63182853bafa157014262";
10959
11005
  var css38 = `._sessionsContainer_jptao_1 {
10960
11006
  border: 1px solid var(--rs-color-border-base-primary);
10961
11007
  border-radius: var(--rs-radius-2);
@@ -11018,7 +11064,7 @@ var sessions_module_css_default = { "sessionsContainer": "_sessionsContainer_jpt
11018
11064
  // admin/views/users/details/security/sessions/revoke-session-confirm.tsx
11019
11065
  var import_jsx_runtime56 = require("react/jsx-runtime");
11020
11066
  var RevokeSessionConfirm = ({ isOpen, onOpenChange, sessionInfo, onRevokeConfirm, isLoading = false }) => {
11021
- const [isFinalConfirmOpen, setIsFinalConfirmOpen] = (0, import_react22.useState)(false);
11067
+ const [isFinalConfirmOpen, setIsFinalConfirmOpen] = (0, import_react24.useState)(false);
11022
11068
  const handleRevoke = () => {
11023
11069
  setIsFinalConfirmOpen(true);
11024
11070
  };
@@ -11092,8 +11138,8 @@ var RevokeSessionConfirm = ({ isOpen, onOpenChange, sessionInfo, onRevokeConfirm
11092
11138
  // admin/views/users/details/security/sessions/session-skeleton.tsx
11093
11139
  var import_apsara50 = require("@raystack/apsara");
11094
11140
 
11095
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-hGKaBJhm1eR2/sdk/admin/views/users/details/security/sessions/sessions.module.css.js
11096
- var digest39 = "c057e7fd189da1f4b6e48415fa23465eb2a969b141d5b6a0676e143a0f0a1a67";
11141
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-PFzLXs86gpDp/sdk/admin/views/users/details/security/sessions/sessions.module.css.js
11142
+ var digest39 = "3c8268937b6dd52353ddadd2fa8f15cb039a1d1c861dac976719b69b6605df7e";
11097
11143
  var css39 = `._sessionsContainer_jptao_1 {
11098
11144
  border: 1px solid var(--rs-color-border-base-primary);
11099
11145
  border-radius: var(--rs-radius-2);
@@ -11166,14 +11212,14 @@ var SessionSkeleton = ({ count = 3 }) => {
11166
11212
  };
11167
11213
 
11168
11214
  // admin/views/users/details/security/sessions/index.tsx
11169
- var import_connect_query18 = require("@connectrpc/connect-query");
11170
- var import_react_query6 = require("@tanstack/react-query");
11171
- var import_frontier22 = require("@raystack/proton/frontier");
11215
+ var import_connect_query19 = require("@connectrpc/connect-query");
11216
+ var import_react_query7 = require("@tanstack/react-query");
11217
+ var import_frontier23 = require("@raystack/proton/frontier");
11172
11218
  var import_dayjs3 = __toESM(require("dayjs"));
11173
11219
  var import_relativeTime2 = __toESM(require("dayjs/plugin/relativeTime"));
11174
11220
 
11175
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-Vh5VvIVnvyOv/sdk/admin/views/users/details/security/sessions/sessions.module.css.js
11176
- var digest40 = "cb14a0221a0d37fd92fc37e43f80026dd24173dfceb3c88678370f5d76382c09";
11221
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-GwWI57Xf5YJ9/sdk/admin/views/users/details/security/sessions/sessions.module.css.js
11222
+ var digest40 = "57a409e7af58d3024c7cb1aa9322eb56e9262113260c09e9b2d7061208e61a15";
11177
11223
  var css40 = `._sessionsContainer_jptao_1 {
11178
11224
  border: 1px solid var(--rs-color-border-base-primary);
11179
11225
  border-radius: var(--rs-radius-2);
@@ -11265,16 +11311,16 @@ var formatDeviceDisplay = (browser, operatingSystem) => {
11265
11311
  };
11266
11312
  var UserSessions = () => {
11267
11313
  const { user } = useUser();
11268
- const queryClient = (0, import_react_query6.useQueryClient)();
11269
- const transport = (0, import_connect_query18.useTransport)();
11270
- const [isRevokeDialogOpen, setIsRevokeDialogOpen] = (0, import_react23.useState)(false);
11271
- const [selectedSession, setSelectedSession] = (0, import_react23.useState)(null);
11314
+ const queryClient = (0, import_react_query7.useQueryClient)();
11315
+ const transport = (0, import_connect_query19.useTransport)();
11316
+ const [isRevokeDialogOpen, setIsRevokeDialogOpen] = (0, import_react25.useState)(false);
11317
+ const [selectedSession, setSelectedSession] = (0, import_react25.useState)(null);
11272
11318
  const {
11273
11319
  data: sessionsData,
11274
11320
  isLoading,
11275
11321
  error
11276
- } = (0, import_connect_query18.useQuery)(
11277
- import_frontier22.AdminServiceQueries.listUserSessions,
11322
+ } = (0, import_connect_query19.useQuery)(
11323
+ import_frontier23.AdminServiceQueries.listUserSessions,
11278
11324
  { userId: user?.id || "" },
11279
11325
  {
11280
11326
  enabled: !!user?.id
@@ -11283,11 +11329,11 @@ var UserSessions = () => {
11283
11329
  const {
11284
11330
  mutate: revokeUserSession,
11285
11331
  isPending: isRevokingSession
11286
- } = (0, import_connect_query18.useMutation)(import_frontier22.AdminServiceQueries.revokeUserSession, {
11332
+ } = (0, import_connect_query19.useMutation)(import_frontier23.AdminServiceQueries.revokeUserSession, {
11287
11333
  onSuccess: () => {
11288
11334
  queryClient.invalidateQueries({
11289
- queryKey: (0, import_connect_query18.createConnectQueryKey)({
11290
- schema: import_frontier22.AdminServiceQueries.listUserSessions,
11335
+ queryKey: (0, import_connect_query19.createConnectQueryKey)({
11336
+ schema: import_frontier23.AdminServiceQueries.listUserSessions,
11291
11337
  transport,
11292
11338
  input: { userId: user?.id || "" },
11293
11339
  cardinality: "finite"
@@ -11382,8 +11428,8 @@ var UserSessions = () => {
11382
11428
  ] });
11383
11429
  };
11384
11430
 
11385
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-CPXTLjfVPFWL/sdk/admin/views/users/details/security/security.module.css.js
11386
- var digest41 = "e05ebb8594be354f1419ae4e085a4280a87f991414e089cc5f6192643e6209c9";
11431
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-2chCIEfSmg3V/sdk/admin/views/users/details/security/security.module.css.js
11432
+ var digest41 = "94fbd21089191c478a0b8a88e552518d5ae411d2d951b595d0ecb67912445958";
11387
11433
  var css41 = `._container_4259p_1 {
11388
11434
  width: 100%;
11389
11435
  }
@@ -11439,8 +11485,8 @@ var UserDetailContent = ({ user, refetch, currentPath, onNavigate }) => {
11439
11485
  };
11440
11486
  var UserDetailsByUserId = ({ userId, currentPath, onNavigate }) => {
11441
11487
  const t = useTerminology();
11442
- const { data, isLoading, refetch } = (0, import_connect_query19.useQuery)(
11443
- import_frontier23.FrontierServiceQueries.getUser,
11488
+ const { data, isLoading, refetch } = (0, import_connect_query20.useQuery)(
11489
+ import_frontier24.FrontierServiceQueries.getUser,
11444
11490
  { id: userId },
11445
11491
  {
11446
11492
  enabled: !!userId,
@@ -11503,14 +11549,14 @@ function UsersView({
11503
11549
  // admin/views/organizations/list/index.tsx
11504
11550
  var import_apsara58 = require("@raystack/apsara");
11505
11551
  var import_icons3 = require("@raystack/apsara/icons");
11506
- var import_react27 = require("react");
11552
+ var import_react29 = require("react");
11507
11553
 
11508
11554
  // admin/views/organizations/list/navbar.tsx
11509
11555
  var import_apsara54 = require("@raystack/apsara");
11510
11556
  var import_icons2 = require("@raystack/apsara/icons");
11511
11557
 
11512
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-BkFJ1ZKLIUco/sdk/admin/components/navbar.module.css.js
11513
- var digest42 = "5572c28c28bec70211fb6a06ce4ed9fdfd82af38f42e25914d3858b1795acc07";
11558
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-DNk39H6Mh8UY/sdk/admin/components/navbar.module.css.js
11559
+ var digest42 = "5445ec656a0445bc69ff957b91c198f571632de5743ab9d4aedd0bd31ca9e9e2";
11514
11560
  var css42 = `._navbar_641ya_1 {
11515
11561
  padding: var(--rs-space-4) var(--rs-space-7);
11516
11562
  border-bottom: 0.5px solid var(--rs-color-border-base-primary);
@@ -11539,7 +11585,7 @@ var css42 = `._navbar_641ya_1 {
11539
11585
  var navbar_module_css_default5 = { "navbar": "_navbar_641ya_1", "nav-chip": "_nav-chip_641ya_11", "navChip": "_nav-chip_641ya_11" };
11540
11586
 
11541
11587
  // admin/views/organizations/list/navbar.tsx
11542
- var import_react24 = require("react");
11588
+ var import_react26 = require("react");
11543
11589
  var import_jsx_runtime62 = require("react/jsx-runtime");
11544
11590
  var OrganizationsNavabar = ({
11545
11591
  searchQuery,
@@ -11547,8 +11593,8 @@ var OrganizationsNavabar = ({
11547
11593
  onExportCsv
11548
11594
  }) => {
11549
11595
  const t = useTerminology();
11550
- const [showSearch, setShowSearch] = (0, import_react24.useState)(searchQuery ? true : false);
11551
- const [isDownloading, setIsDownloading] = (0, import_react24.useState)(false);
11596
+ const [showSearch, setShowSearch] = (0, import_react26.useState)(searchQuery ? true : false);
11597
+ const [isDownloading, setIsDownloading] = (0, import_react26.useState)(false);
11552
11598
  function toggleSearch() {
11553
11599
  setShowSearch((prev) => !prev);
11554
11600
  }
@@ -11626,8 +11672,8 @@ var OrganizationsNavabar = ({
11626
11672
  ] });
11627
11673
  };
11628
11674
 
11629
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-w2eBdsdRLx3W/sdk/admin/views/organizations/list/list.module.css.js
11630
- var digest43 = "5a3f5731cf83266ec9980196b8bf2b157df01d600986cab0b712806ac0dd10ce";
11675
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-iVeyxJneTg33/sdk/admin/views/organizations/list/list.module.css.js
11676
+ var digest43 = "8d1bdbe0bbd25665c9587be59a6efd7ad34d95bb1f636f71e7e9814b897c7674";
11631
11677
  var css43 = `._table_w4mi3_1 {
11632
11678
  height: auto;
11633
11679
  }
@@ -11725,8 +11771,8 @@ var list_module_css_default3 = { "table": "_table_w4mi3_1", "table-empty": "_tab
11725
11771
  // admin/views/organizations/list/columns.tsx
11726
11772
  var import_apsara55 = require("@raystack/apsara");
11727
11773
 
11728
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-OZ9RoCyftPuL/sdk/admin/views/organizations/list/list.module.css.js
11729
- var digest44 = "1a4087aeba3cbe0e72f78f1ea0a5c9c9a8ff28c6bf9d086777ca9fb183dd6374";
11774
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-R3qNrzZUvesu/sdk/admin/views/organizations/list/list.module.css.js
11775
+ var digest44 = "67b94c566659aca79201470d8307fbd40e7624a1ee5331f7d4c603cc7dc123f4";
11730
11776
  var css44 = `._table_w4mi3_1 {
11731
11777
  height: auto;
11732
11778
  }
@@ -11969,15 +12015,15 @@ var getColumns11 = ({
11969
12015
  };
11970
12016
 
11971
12017
  // admin/views/organizations/list/index.tsx
11972
- var import_connect_query21 = require("@connectrpc/connect-query");
11973
- var import_frontier25 = require("@raystack/proton/frontier");
11974
- var import_protobuf8 = require("@bufbuild/protobuf");
12018
+ var import_connect_query22 = require("@connectrpc/connect-query");
12019
+ var import_frontier26 = require("@raystack/proton/frontier");
12020
+ var import_protobuf9 = require("@bufbuild/protobuf");
11975
12021
 
11976
12022
  // admin/views/organizations/list/create.tsx
11977
- var import_react26 = require("react");
12023
+ var import_react28 = require("react");
11978
12024
 
11979
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-Vu1D5HtOhvLJ/sdk/admin/views/organizations/list/list.module.css.js
11980
- var digest45 = "1e09527888110e0cb9af0866f50e29380374776389b0c11f2d40d2479bf274c6";
12025
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-cmvInORGrAt5/sdk/admin/views/organizations/list/list.module.css.js
12026
+ var digest45 = "0a999de4539d894aca1b410401020bea3e16ea055ddee79880a7e71df479e51f";
11981
12027
  var css45 = `._table_w4mi3_1 {
11982
12028
  height: auto;
11983
12029
  }
@@ -12076,13 +12122,13 @@ var list_module_css_default5 = { "table": "_table_w4mi3_1", "table-empty": "_tab
12076
12122
  var import_apsara57 = require("@raystack/apsara");
12077
12123
 
12078
12124
  // client/components/image-upload/image-upload.tsx
12079
- var import_react25 = require("react");
12125
+ var import_react27 = require("react");
12080
12126
  var import_react_image_crop = __toESM(require("react-image-crop"));
12081
12127
  var import_apsara56 = require("@raystack/apsara");
12082
12128
  var import_ReactCrop = require("react-image-crop/dist/ReactCrop.css");
12083
12129
 
12084
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-tsz1dHhIUBCr/sdk/client/components/image-upload/image-upload.module.css.js
12085
- var digest46 = "230f185656e3d409f9c4aced6445a8a483072ff50f0d1443fa5654f59568438c";
12130
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-otigUegWWrC4/sdk/client/components/image-upload/image-upload.module.css.js
12131
+ var digest46 = "8969db89c7a50cc12cbb62920dd41ef3b8e234e036b0cf96fda29b3b4332bb68";
12086
12132
  var css46 = `._iconButton_1ifr2_1 {
12087
12133
  position: relative;
12088
12134
  width: var(--rs-space-14);
@@ -12176,8 +12222,8 @@ var image_upload_module_css_default = { "iconButton": "_iconButton_1ifr2_1", "av
12176
12222
  // client/components/image-upload/image-upload.tsx
12177
12223
  var import_jsx_runtime64 = require("react/jsx-runtime");
12178
12224
  function CropDialog({ open, onOpenChange, imgSrc, onSave }) {
12179
- const [crop, setCrop] = (0, import_react25.useState)();
12180
- const imgRef = (0, import_react25.useRef)(null);
12225
+ const [crop, setCrop] = (0, import_react27.useState)();
12226
+ const imgRef = (0, import_react27.useRef)(null);
12181
12227
  function onImageLoad(e) {
12182
12228
  const { naturalWidth: width, naturalHeight: height } = e.currentTarget;
12183
12229
  const newCrop = (0, import_react_image_crop.centerCrop)(
@@ -12294,9 +12340,9 @@ function ImageUpload({
12294
12340
  initials,
12295
12341
  ...rest
12296
12342
  }) {
12297
- const inputRef = (0, import_react25.useRef)(null);
12298
- const [imgSrc, setImgSrc] = (0, import_react25.useState)("");
12299
- const [showCropDialog, setShowCropDialog] = (0, import_react25.useState)(false);
12343
+ const inputRef = (0, import_react27.useRef)(null);
12344
+ const [imgSrc, setImgSrc] = (0, import_react27.useState)("");
12345
+ const [showCropDialog, setShowCropDialog] = (0, import_react27.useState)(false);
12300
12346
  function onUploadIconClick() {
12301
12347
  if (inputRef.current) {
12302
12348
  inputRef.current.value = "";
@@ -12385,9 +12431,9 @@ function ImageUpload({
12385
12431
  var import_lodash2 = require("lodash");
12386
12432
  var import_react_hook_form3 = require("react-hook-form");
12387
12433
  var import_zod5 = require("@hookform/resolvers/zod");
12388
- var import_connect_query20 = require("@connectrpc/connect-query");
12389
- var import_connect3 = require("@connectrpc/connect");
12390
- var import_frontier24 = require("@raystack/proton/frontier");
12434
+ var import_connect_query21 = require("@connectrpc/connect-query");
12435
+ var import_connect4 = require("@connectrpc/connect");
12436
+ var import_frontier25 = require("@raystack/proton/frontier");
12391
12437
  var import_jsx_runtime65 = require("react/jsx-runtime");
12392
12438
  var orgCreateSchema = external_exports.object({
12393
12439
  avatar: external_exports.string().optional(),
@@ -12407,8 +12453,8 @@ function CreateOrganizationPanel({
12407
12453
  onSuccess
12408
12454
  }) {
12409
12455
  const t = useTerminology();
12410
- const [countries, setCountries] = (0, import_react26.useState)(countriesProp);
12411
- (0, import_react26.useEffect)(() => {
12456
+ const [countries, setCountries] = (0, import_react28.useState)(countriesProp);
12457
+ (0, import_react28.useEffect)(() => {
12412
12458
  if (countriesProp.length > 0) {
12413
12459
  setCountries(countriesProp);
12414
12460
  }
@@ -12430,16 +12476,16 @@ function CreateOrganizationPanel({
12430
12476
  },
12431
12477
  resolver: (0, import_zod5.zodResolver)(orgCreateSchema)
12432
12478
  });
12433
- const uniqueSuffix = (0, import_react26.useMemo)(() => randomSuffix(), []);
12434
- const debouncedGenerateSlug = (0, import_react26.useMemo)(
12479
+ const uniqueSuffix = (0, import_react28.useMemo)(() => randomSuffix(), []);
12480
+ const debouncedGenerateSlug = (0, import_react28.useMemo)(
12435
12481
  () => (0, import_lodash2.debounce)((title) => {
12436
12482
  const baseSlug = generateSlug(title);
12437
12483
  setValue("name", baseSlug ? `${baseSlug}-${uniqueSuffix}` : "");
12438
12484
  }, 300),
12439
12485
  [setValue, uniqueSuffix]
12440
12486
  );
12441
- (0, import_react26.useEffect)(() => () => debouncedGenerateSlug.cancel(), [debouncedGenerateSlug]);
12442
- const handleTitleChange = (0, import_react26.useCallback)(
12487
+ (0, import_react28.useEffect)(() => () => debouncedGenerateSlug.cancel(), [debouncedGenerateSlug]);
12488
+ const handleTitleChange = (0, import_react28.useCallback)(
12443
12489
  (e) => {
12444
12490
  if (dirtyFields.name)
12445
12491
  return;
@@ -12447,11 +12493,11 @@ function CreateOrganizationPanel({
12447
12493
  },
12448
12494
  [debouncedGenerateSlug, dirtyFields.name]
12449
12495
  );
12450
- const { mutateAsync: createOrganization, isPending } = (0, import_connect_query20.useMutation)(
12451
- import_frontier24.AdminServiceQueries.adminCreateOrganization,
12496
+ const { mutateAsync: createOrganization, isPending } = (0, import_connect_query21.useMutation)(
12497
+ import_frontier25.AdminServiceQueries.adminCreateOrganization,
12452
12498
  {
12453
12499
  onError: (error) => {
12454
- if (error?.code === import_connect3.Code.AlreadyExists) {
12500
+ if (error?.code === import_connect4.Code.AlreadyExists) {
12455
12501
  setError("name", {
12456
12502
  message: `${t.organization({ case: "capital" })} URL is already taken`
12457
12503
  });
@@ -12639,7 +12685,6 @@ function CreateOrganizationPanel({
12639
12685
  }
12640
12686
 
12641
12687
  // admin/views/organizations/list/index.tsx
12642
- var import_hooks3 = require("@raystack/apsara/hooks");
12643
12688
  var import_jsx_runtime66 = require("react/jsx-runtime");
12644
12689
  var NoOrganizations = () => {
12645
12690
  const t = useTerminology();
@@ -12681,10 +12726,6 @@ var ZeroState = ({ openCreatePanel }) => {
12681
12726
  ) });
12682
12727
  };
12683
12728
  var DEFAULT_SORT4 = { name: "createdAt", order: "desc" };
12684
- var INITIAL_QUERY4 = {
12685
- offset: 0,
12686
- limit: DEFAULT_PAGE_SIZE
12687
- };
12688
12729
  var OrganizationListView = ({
12689
12730
  appName,
12690
12731
  onNavigateToOrg,
@@ -12694,19 +12735,22 @@ var OrganizationListView = ({
12694
12735
  countries = []
12695
12736
  } = {}) => {
12696
12737
  const t = useTerminology();
12697
- const [showCreatePanel, setShowCreatePanel] = (0, import_react27.useState)(false);
12698
- const [tableQuery, setTableQuery] = (0, import_hooks3.useDebouncedState)(
12699
- INITIAL_QUERY4,
12700
- 200
12701
- );
12702
- const query = transformDataTableQueryToRQLRequest(tableQuery, {
12703
- fieldNameMapping: {
12704
- createdBy: "created_by",
12705
- planName: "plan_name",
12706
- subscriptionCycleEndAt: "subscription_cycle_end_at",
12707
- paymentMode: "payment_mode",
12708
- subscriptionState: "subscription_state",
12709
- createdAt: "created_at"
12738
+ const [showCreatePanel, setShowCreatePanel] = (0, import_react29.useState)(false);
12739
+ const {
12740
+ tableQuery,
12741
+ rqlQuery: query,
12742
+ onTableQueryChange
12743
+ } = useServerTableQuery({
12744
+ defaultSort: DEFAULT_SORT4,
12745
+ transformOptions: {
12746
+ fieldNameMapping: {
12747
+ createdBy: "created_by",
12748
+ planName: "plan_name",
12749
+ subscriptionCycleEndAt: "subscription_cycle_end_at",
12750
+ paymentMode: "payment_mode",
12751
+ subscriptionState: "subscription_state",
12752
+ createdAt: "created_at"
12753
+ }
12710
12754
  }
12711
12755
  });
12712
12756
  const {
@@ -12714,10 +12758,11 @@ var OrganizationListView = ({
12714
12758
  isLoading,
12715
12759
  isFetchingNextPage,
12716
12760
  fetchNextPage,
12761
+ hasNextPage,
12717
12762
  error,
12718
12763
  isError
12719
- } = (0, import_connect_query21.useInfiniteQuery)(
12720
- import_frontier25.AdminServiceQueries.searchOrganizations,
12764
+ } = (0, import_connect_query22.useInfiniteQuery)(
12765
+ import_frontier26.AdminServiceQueries.searchOrganizations,
12721
12766
  { query },
12722
12767
  {
12723
12768
  pageParamKey: "query",
@@ -12728,34 +12773,27 @@ var OrganizationListView = ({
12728
12773
  retryDelay: 1e3
12729
12774
  }
12730
12775
  );
12731
- const { data: plans = [], isLoading: isPlansLoading, error: plansError } = (0, import_connect_query21.useQuery)(
12732
- import_frontier25.FrontierServiceQueries.listPlans,
12733
- (0, import_protobuf8.create)(import_frontier25.ListPlansRequestSchema, {}),
12776
+ const { data: plans = [], isLoading: isPlansLoading, error: plansError } = (0, import_connect_query22.useQuery)(
12777
+ import_frontier26.FrontierServiceQueries.listPlans,
12778
+ (0, import_protobuf9.create)(import_frontier26.ListPlansRequestSchema, {}),
12734
12779
  {
12735
12780
  select: (data2) => data2?.plans || []
12736
12781
  }
12737
12782
  );
12738
- (0, import_react27.useEffect)(() => {
12783
+ (0, import_react29.useEffect)(() => {
12739
12784
  if (plansError) {
12740
12785
  console.error("Failed to fetch plans:", plansError);
12741
12786
  }
12742
12787
  }, [plansError]);
12743
12788
  const data = infiniteData?.pages?.flatMap((page) => page?.organizations || []) || [];
12744
12789
  const groupCountMap = infiniteData ? getGroupCountMapFromFirstPage(infiniteData) : {};
12745
- const onTableQueryChange = (newQuery) => {
12746
- setTableQuery({
12747
- ...newQuery,
12748
- offset: 0,
12749
- limit: newQuery.limit || DEFAULT_PAGE_SIZE
12750
- });
12751
- };
12752
- const handleLoadMore = async () => {
12753
- try {
12754
- await fetchNextPage();
12755
- } catch (error2) {
12756
- console.error("Error loading more organizations:", error2);
12757
- }
12758
- };
12790
+ const handleLoadMore = useLoadMore({
12791
+ hasNextPage,
12792
+ isFetchingNextPage,
12793
+ isError,
12794
+ fetchNextPage,
12795
+ label: "organizations"
12796
+ });
12759
12797
  function closeCreateOrgPanel() {
12760
12798
  setShowCreatePanel(false);
12761
12799
  }
@@ -12841,17 +12879,17 @@ var OrganizationListView = ({
12841
12879
  };
12842
12880
 
12843
12881
  // admin/views/organizations/details/index.tsx
12844
- var import_react41 = require("react");
12845
- var import_connect_query30 = require("@connectrpc/connect-query");
12846
- var import_react_query11 = require("@tanstack/react-query");
12847
- var import_protobuf18 = require("@bufbuild/protobuf");
12882
+ var import_react43 = require("react");
12883
+ var import_connect_query31 = require("@connectrpc/connect-query");
12884
+ var import_react_query12 = require("@tanstack/react-query");
12885
+ var import_protobuf19 = require("@bufbuild/protobuf");
12848
12886
 
12849
12887
  // admin/views/organizations/details/layout/navbar.tsx
12850
12888
  var import_icons4 = require("@raystack/apsara/icons");
12851
12889
  var import_apsara61 = require("@raystack/apsara");
12852
12890
 
12853
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-zH26upTA0RSe/sdk/admin/views/organizations/details/layout/layout.module.css.js
12854
- var digest47 = "4d8c988930f59d198387c7cbb40fc9e8d3332ff1be15886aa3f54033b765788b";
12891
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-Lep0dz55pXSl/sdk/admin/views/organizations/details/layout/layout.module.css.js
12892
+ var digest47 = "f3243ae942370bf3bb5552170c3424dffc65364765f9c7816ce90d5795d6ad01";
12855
12893
  var css47 = `._page_1nlk4_1 {
12856
12894
  width: 100%;
12857
12895
  height: 100vh;
@@ -12931,8 +12969,8 @@ var css47 = `._page_1nlk4_1 {
12931
12969
  })();
12932
12970
  var layout_module_css_default2 = { "page": "_page_1nlk4_1", "main_content": "_main_content_1nlk4_7", "mainContent": "_main_content_1nlk4_7", "main_content_with_sidepanel": "_main_content_with_sidepanel_1nlk4_12", "mainContentWithSidepanel": "_main_content_with_sidepanel_1nlk4_12", "navbar-action-menu-content": "_navbar-action-menu-content_1nlk4_17", "navbarActionMenuContent": "_navbar-action-menu-content_1nlk4_17", "navbar-action-menu-item": "_navbar-action-menu-item_1nlk4_21", "navbarActionMenuItem": "_navbar-action-menu-item_1nlk4_21", "side-panel-section-item-label": "_side-panel-section-item-label_1nlk4_26", "sidePanelSectionItemLabel": "_side-panel-section-item-label_1nlk4_26", "invite-users-dialog-body": "_invite-users-dialog-body_1nlk4_30", "inviteUsersDialogBody": "_invite-users-dialog-body_1nlk4_30", "invite-users-dialog-label": "_invite-users-dialog-label_1nlk4_37", "inviteUsersDialogLabel": "_invite-users-dialog-label_1nlk4_37", "invite-users-dialog-roles-content": "_invite-users-dialog-roles-content_1nlk4_41", "inviteUsersDialogRolesContent": "_invite-users-dialog-roles-content_1nlk4_41", "form-error-message": "_form-error-message_1nlk4_46", "formErrorMessage": "_form-error-message_1nlk4_46", "invite-users-emails-textarea": "_invite-users-emails-textarea_1nlk4_50", "inviteUsersEmailsTextarea": "_invite-users-emails-textarea_1nlk4_50", "add-token-dialog-tokens-field": "_add-token-dialog-tokens-field_1nlk4_56", "addTokenDialogTokensField": "_add-token-dialog-tokens-field_1nlk4_56" };
12933
12971
 
12934
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-FFquISIXGYut/sdk/admin/components/navbar.module.css.js
12935
- var digest48 = "a972207f680fb2074d2437f96da67cae1dca6076f9a5a353975aea7d2d4d6a4f";
12972
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-1XaV9DvLbSxm/sdk/admin/components/navbar.module.css.js
12973
+ var digest48 = "a84e1d49182c3fab62dbe9d646ced0061d76a2ead0f8a5229fd86aff4e024b27";
12936
12974
  var css48 = `._navbar_641ya_1 {
12937
12975
  padding: var(--rs-space-4) var(--rs-space-7);
12938
12976
  border-bottom: 0.5px solid var(--rs-color-border-base-primary);
@@ -12962,10 +13000,10 @@ var navbar_module_css_default6 = { "navbar": "_navbar_641ya_1", "nav-chip": "_na
12962
13000
 
12963
13001
  // admin/views/organizations/details/layout/invite-users-dialog.tsx
12964
13002
  var import_apsara59 = require("@raystack/apsara");
12965
- var import_react29 = require("react");
13003
+ var import_react31 = require("react");
12966
13004
 
12967
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-5WTQFJNxLfxM/sdk/admin/views/organizations/details/layout/layout.module.css.js
12968
- var digest49 = "7b6ce718531888549e49ca8cf367fc2868fc4879cf5f085d23a6b3d9af016a44";
13005
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-m6aLBXZyook2/sdk/admin/views/organizations/details/layout/layout.module.css.js
13006
+ var digest49 = "69dfb0501fa41429d3054629d16be33799b85414afcde1d45b23313ce227beba";
12969
13007
  var css49 = `._page_1nlk4_1 {
12970
13008
  width: 100%;
12971
13009
  height: 100vh;
@@ -13046,12 +13084,12 @@ var css49 = `._page_1nlk4_1 {
13046
13084
  var layout_module_css_default3 = { "page": "_page_1nlk4_1", "main_content": "_main_content_1nlk4_7", "mainContent": "_main_content_1nlk4_7", "main_content_with_sidepanel": "_main_content_with_sidepanel_1nlk4_12", "mainContentWithSidepanel": "_main_content_with_sidepanel_1nlk4_12", "navbar-action-menu-content": "_navbar-action-menu-content_1nlk4_17", "navbarActionMenuContent": "_navbar-action-menu-content_1nlk4_17", "navbar-action-menu-item": "_navbar-action-menu-item_1nlk4_21", "navbarActionMenuItem": "_navbar-action-menu-item_1nlk4_21", "side-panel-section-item-label": "_side-panel-section-item-label_1nlk4_26", "sidePanelSectionItemLabel": "_side-panel-section-item-label_1nlk4_26", "invite-users-dialog-body": "_invite-users-dialog-body_1nlk4_30", "inviteUsersDialogBody": "_invite-users-dialog-body_1nlk4_30", "invite-users-dialog-label": "_invite-users-dialog-label_1nlk4_37", "inviteUsersDialogLabel": "_invite-users-dialog-label_1nlk4_37", "invite-users-dialog-roles-content": "_invite-users-dialog-roles-content_1nlk4_41", "inviteUsersDialogRolesContent": "_invite-users-dialog-roles-content_1nlk4_41", "form-error-message": "_form-error-message_1nlk4_46", "formErrorMessage": "_form-error-message_1nlk4_46", "invite-users-emails-textarea": "_invite-users-emails-textarea_1nlk4_50", "inviteUsersEmailsTextarea": "_invite-users-emails-textarea_1nlk4_50", "add-token-dialog-tokens-field": "_add-token-dialog-tokens-field_1nlk4_56", "addTokenDialogTokensField": "_add-token-dialog-tokens-field_1nlk4_56" };
13047
13085
 
13048
13086
  // admin/views/organizations/details/contexts/organization-context.tsx
13049
- var import_frontier26 = require("@raystack/proton/frontier");
13050
- var import_protobuf9 = require("@bufbuild/protobuf");
13051
- var import_react28 = require("react");
13087
+ var import_frontier27 = require("@raystack/proton/frontier");
13088
+ var import_protobuf10 = require("@bufbuild/protobuf");
13089
+ var import_react30 = require("react");
13052
13090
  var defaultOrganiztionContextValue = {
13053
13091
  roles: [],
13054
- organization: (0, import_protobuf9.create)(import_frontier26.OrganizationSchema),
13092
+ organization: (0, import_protobuf10.create)(import_frontier27.OrganizationSchema),
13055
13093
  updateOrganization: async () => {
13056
13094
  },
13057
13095
  isBillingAccountLoading: false,
@@ -13069,8 +13107,6 @@ var defaultOrganiztionContextValue = {
13069
13107
  onChange: () => {
13070
13108
  }
13071
13109
  },
13072
- orgMembersMap: {},
13073
- isOrgMembersMapLoading: false,
13074
13110
  updateKYCDetails: () => {
13075
13111
  },
13076
13112
  kycDetails: void 0,
@@ -13080,7 +13116,7 @@ var defaultOrganiztionContextValue = {
13080
13116
  countries: void 0,
13081
13117
  organizationTypes: void 0
13082
13118
  };
13083
- var OrganizationContext = (0, import_react28.createContext)(defaultOrganiztionContextValue);
13119
+ var OrganizationContext = (0, import_react30.createContext)(defaultOrganiztionContextValue);
13084
13120
 
13085
13121
  // admin/views/organizations/details/layout/invite-users-dialog.tsx
13086
13122
  var import_zod6 = require("@hookform/resolvers/zod");
@@ -13095,10 +13131,10 @@ var PROJECT_NAMESPACE = "app/project";
13095
13131
  var DEFAULT_INVITE_ROLE = "app_organization_viewer";
13096
13132
 
13097
13133
  // admin/views/organizations/details/layout/invite-users-dialog.tsx
13098
- var import_connect_query22 = require("@connectrpc/connect-query");
13099
- var import_react_query7 = require("@tanstack/react-query");
13100
- var import_frontier27 = require("@raystack/proton/frontier");
13101
- var import_protobuf10 = require("@bufbuild/protobuf");
13134
+ var import_connect_query23 = require("@connectrpc/connect-query");
13135
+ var import_react_query8 = require("@tanstack/react-query");
13136
+ var import_frontier28 = require("@raystack/proton/frontier");
13137
+ var import_protobuf11 = require("@bufbuild/protobuf");
13102
13138
  var import_jsx_runtime67 = require("react/jsx-runtime");
13103
13139
  var inviteSchema = objectType({
13104
13140
  role: stringType().min(1, { message: "Role is required" }),
@@ -13110,11 +13146,11 @@ var inviteSchema = objectType({
13110
13146
  });
13111
13147
  var InviteUsersDialog = ({ onOpenChange }) => {
13112
13148
  const t = useTerminology();
13113
- const { roles = [], organization } = (0, import_react29.useContext)(OrganizationContext);
13114
- const queryClient = (0, import_react_query7.useQueryClient)();
13115
- const transport = (0, import_connect_query22.useTransport)();
13149
+ const { roles = [], organization } = (0, import_react31.useContext)(OrganizationContext);
13150
+ const queryClient = (0, import_react_query8.useQueryClient)();
13151
+ const transport = (0, import_connect_query23.useTransport)();
13116
13152
  const organizationId = organization?.id || "";
13117
- const defaultRoleId = (0, import_react29.useMemo)(
13153
+ const defaultRoleId = (0, import_react31.useMemo)(
13118
13154
  () => roles?.find((role) => role.name === DEFAULT_INVITE_ROLE)?.id,
13119
13155
  [roles]
13120
13156
  );
@@ -13124,13 +13160,13 @@ var InviteUsersDialog = ({ onOpenChange }) => {
13124
13160
  role: defaultRoleId
13125
13161
  }
13126
13162
  });
13127
- const { mutateAsync: createInvitation } = (0, import_connect_query22.useMutation)(
13128
- import_frontier27.FrontierServiceQueries.createOrganizationInvitation,
13163
+ const { mutateAsync: createInvitation } = (0, import_connect_query23.useMutation)(
13164
+ import_frontier28.FrontierServiceQueries.createOrganizationInvitation,
13129
13165
  {
13130
13166
  onSuccess: (data) => {
13131
13167
  queryClient.invalidateQueries({
13132
- queryKey: (0, import_connect_query22.createConnectQueryKey)({
13133
- schema: import_frontier27.FrontierServiceQueries.listOrganizationInvitations,
13168
+ queryKey: (0, import_connect_query23.createConnectQueryKey)({
13169
+ schema: import_frontier28.FrontierServiceQueries.listOrganizationInvitations,
13134
13170
  transport,
13135
13171
  input: { orgId: organizationId },
13136
13172
  cardinality: "finite"
@@ -13150,7 +13186,7 @@ var InviteUsersDialog = ({ onOpenChange }) => {
13150
13186
  return;
13151
13187
  try {
13152
13188
  await createInvitation(
13153
- (0, import_protobuf10.create)(import_frontier27.CreateOrganizationInvitationRequestSchema, {
13189
+ (0, import_protobuf11.create)(import_frontier28.CreateOrganizationInvitationRequestSchema, {
13154
13190
  orgId: organizationId,
13155
13191
  userIds: data.emails,
13156
13192
  roleIds: data.role ? [data.role] : []
@@ -13242,11 +13278,11 @@ var InviteUsersDialog = ({ onOpenChange }) => {
13242
13278
 
13243
13279
  // admin/views/organizations/details/layout/add-tokens-dialog.tsx
13244
13280
  var import_apsara60 = require("@raystack/apsara");
13245
- var import_react30 = require("react");
13281
+ var import_react32 = require("react");
13246
13282
  var import_react_hook_form5 = require("react-hook-form");
13247
13283
 
13248
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-uiIR25lTPrMR/sdk/admin/views/organizations/details/layout/layout.module.css.js
13249
- var digest50 = "bbc6c039f3065ea29947d8bfc074b20de884ff185dd60c23b3e1b3ded823531d";
13284
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-gdP3i37UJAcd/sdk/admin/views/organizations/details/layout/layout.module.css.js
13285
+ var digest50 = "ce344d798fca19ef5bb9ff1416ea588011d97f4c2d578a9125155b0edd4d1e09";
13250
13286
  var css50 = `._page_1nlk4_1 {
13251
13287
  width: 100%;
13252
13288
  height: 100vh;
@@ -13328,10 +13364,10 @@ var layout_module_css_default4 = { "page": "_page_1nlk4_1", "main_content": "_ma
13328
13364
 
13329
13365
  // admin/views/organizations/details/layout/add-tokens-dialog.tsx
13330
13366
  var import_zod7 = require("@hookform/resolvers/zod");
13331
- var import_connect_query23 = require("@connectrpc/connect-query");
13332
- var import_react_query8 = require("@tanstack/react-query");
13333
- var import_frontier28 = require("@raystack/proton/frontier");
13334
- var import_protobuf11 = require("@bufbuild/protobuf");
13367
+ var import_connect_query24 = require("@connectrpc/connect-query");
13368
+ var import_react_query9 = require("@tanstack/react-query");
13369
+ var import_frontier29 = require("@raystack/proton/frontier");
13370
+ var import_protobuf12 = require("@bufbuild/protobuf");
13335
13371
  var import_jsx_runtime68 = require("react/jsx-runtime");
13336
13372
  var addTokensSchema = objectType({
13337
13373
  product: stringType(),
@@ -13341,9 +13377,14 @@ var addTokensSchema = objectType({
13341
13377
  }).min(1).transform((num) => num.toString())
13342
13378
  });
13343
13379
  var AddTokensDialog = ({ onOpenChange }) => {
13344
- const { organization, billingAccount, fetchTokenBalance, tokenProductId } = (0, import_react30.useContext)(OrganizationContext);
13345
- const queryClient = (0, import_react_query8.useQueryClient)();
13346
- const transport = (0, import_connect_query23.useTransport)();
13380
+ const {
13381
+ organization,
13382
+ billingAccount,
13383
+ fetchTokenBalance,
13384
+ tokenProductId
13385
+ } = (0, import_react32.useContext)(OrganizationContext);
13386
+ const queryClient = (0, import_react_query9.useQueryClient)();
13387
+ const transport = (0, import_connect_query24.useTransport)();
13347
13388
  const organisationId = organization?.id || "";
13348
13389
  const billingAccountId = billingAccount?.id || "";
13349
13390
  const methods = (0, import_react_hook_form5.useForm)({
@@ -13353,13 +13394,13 @@ var AddTokensDialog = ({ onOpenChange }) => {
13353
13394
  product: tokenProductId || defaultConfig.token_product_id || "token"
13354
13395
  }
13355
13396
  });
13356
- const { mutateAsync: delegatedCheckout } = (0, import_connect_query23.useMutation)(
13357
- import_frontier28.AdminServiceQueries.delegatedCheckout,
13397
+ const { mutateAsync: delegatedCheckout } = (0, import_connect_query24.useMutation)(
13398
+ import_frontier29.AdminServiceQueries.delegatedCheckout,
13358
13399
  {
13359
13400
  onSuccess: () => {
13360
13401
  queryClient.invalidateQueries({
13361
- queryKey: (0, import_connect_query23.createConnectQueryKey)({
13362
- schema: import_frontier28.FrontierServiceQueries.searchOrganizationTokens,
13402
+ queryKey: (0, import_connect_query24.createConnectQueryKey)({
13403
+ schema: import_frontier29.FrontierServiceQueries.searchOrganizationTokens,
13363
13404
  transport,
13364
13405
  input: { id: organisationId },
13365
13406
  cardinality: "infinite"
@@ -13379,14 +13420,15 @@ var AddTokensDialog = ({ onOpenChange }) => {
13379
13420
  }
13380
13421
  }
13381
13422
  );
13423
+ const canCheckout = !!organisationId && !!billingAccountId;
13382
13424
  const onSubmit = async (product_body) => {
13383
- if (!organisationId)
13425
+ if (!canCheckout)
13384
13426
  return;
13385
13427
  await delegatedCheckout(
13386
- (0, import_protobuf11.create)(import_frontier28.DelegatedCheckoutRequestSchema, {
13428
+ (0, import_protobuf12.create)(import_frontier29.DelegatedCheckoutRequestSchema, {
13387
13429
  orgId: organisationId,
13388
13430
  billingId: billingAccountId,
13389
- productBody: (0, import_protobuf11.create)(import_frontier28.CheckoutProductBodySchema, {
13431
+ productBody: (0, import_protobuf12.create)(import_frontier29.CheckoutProductBodySchema, {
13390
13432
  product: product_body.product,
13391
13433
  quantity: BigInt(product_body.quantity)
13392
13434
  })
@@ -13443,6 +13485,7 @@ var AddTokensDialog = ({ onOpenChange }) => {
13443
13485
  "data-test-id": "add-tokens-invite-button",
13444
13486
  type: "submit",
13445
13487
  loaderText: "Adding...",
13488
+ disabled: !canCheckout || isSubmitting,
13446
13489
  loading: isSubmitting,
13447
13490
  children: "Add"
13448
13491
  }
@@ -13452,7 +13495,7 @@ var AddTokensDialog = ({ onOpenChange }) => {
13452
13495
  };
13453
13496
 
13454
13497
  // admin/views/organizations/details/layout/navbar.tsx
13455
- var import_react31 = require("react");
13498
+ var import_react33 = require("react");
13456
13499
  var import_jsx_runtime69 = require("react/jsx-runtime");
13457
13500
  var DropdownItem = ({ item }) => {
13458
13501
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
@@ -13480,11 +13523,11 @@ var NavbarActionMenu = ({
13480
13523
  onExportTokens
13481
13524
  }) => {
13482
13525
  const t = useTerminology();
13483
- const [isInviteUsersDialogOpen, setIsInviteUsersDialogOpen] = (0, import_react31.useState)(false);
13484
- const [isAddTokensDialogOpen, setIsAddTokensDialogOpen] = (0, import_react31.useState)(false);
13485
- const [isMembersDownloading, setIsMembersDownloading] = (0, import_react31.useState)(false);
13486
- const [isProjectsDownloading, setIsProjectsDownloading] = (0, import_react31.useState)(false);
13487
- const [isTokensDownloading, setIsTokensDownloading] = (0, import_react31.useState)(false);
13526
+ const [isInviteUsersDialogOpen, setIsInviteUsersDialogOpen] = (0, import_react33.useState)(false);
13527
+ const [isAddTokensDialogOpen, setIsAddTokensDialogOpen] = (0, import_react33.useState)(false);
13528
+ const [isMembersDownloading, setIsMembersDownloading] = (0, import_react33.useState)(false);
13529
+ const [isProjectsDownloading, setIsProjectsDownloading] = (0, import_react33.useState)(false);
13530
+ const [isTokensDownloading, setIsTokensDownloading] = (0, import_react33.useState)(false);
13488
13531
  const openInviteUsersDialog = () => {
13489
13532
  setIsInviteUsersDialogOpen(true);
13490
13533
  };
@@ -13660,7 +13703,7 @@ var OrganizationsDetailsNavabar = ({
13660
13703
  }) => {
13661
13704
  const t = useTerminology();
13662
13705
  const adminPaths = useAdminPaths();
13663
- const { search } = (0, import_react31.useContext)(OrganizationContext);
13706
+ const { search } = (0, import_react33.useContext)(OrganizationContext);
13664
13707
  function handleSearchChange(e) {
13665
13708
  const value = e.target.value;
13666
13709
  search.onChange(value);
@@ -13753,8 +13796,8 @@ var OrganizationsDetailsNavabar = ({
13753
13796
  ] });
13754
13797
  };
13755
13798
 
13756
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-ns5GnyQ3LlGw/sdk/admin/views/organizations/details/layout/layout.module.css.js
13757
- var digest51 = "c9e92fd2f4ea21b7ce97b10c9b966c56b05e83e6d68e9adb6f668a7567c9114d";
13799
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-jmk8znOwRxc5/sdk/admin/views/organizations/details/layout/layout.module.css.js
13800
+ var digest51 = "04359e8dafb790efd0e78427878c394ba2e45a4a21b931f3319893d88c30cca3";
13758
13801
  var css51 = `._page_1nlk4_1 {
13759
13802
  width: 100%;
13760
13803
  height: 100vh;
@@ -13843,8 +13886,8 @@ var import_apsara67 = require("@raystack/apsara");
13843
13886
  // admin/views/organizations/details/side-panel/org-details-section.tsx
13844
13887
  var import_apsara62 = require("@raystack/apsara");
13845
13888
 
13846
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-Vzq4mRKVfBXd/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
13847
- var digest52 = "9deac5e8d4fba8f3224345b41d836ffc3a98147b8b9855fb77f020cf6cb6e52c";
13889
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-eASfC4W4VpD9/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
13890
+ var digest52 = "e4773ccf32925517863e87942eef3d29deff2b57139c7b98ba8dc82379b10d49";
13848
13891
  var css52 = `._side-panel-section-item-label_slrfc_1 {
13849
13892
  width: 120px;
13850
13893
  }
@@ -13908,12 +13951,12 @@ var css52 = `._side-panel-section-item-label_slrfc_1 {
13908
13951
  var side_panel_module_css_default6 = { "side-panel-section-item-label": "_side-panel-section-item-label_slrfc_1", "sidePanelSectionItemLabel": "_side-panel-section-item-label_slrfc_1", "org-details-section-org-id": "_org-details-section-org-id_slrfc_5", "orgDetailsSectionOrgId": "_org-details-section-org-id_slrfc_5", "kyc_link": "_kyc_link_slrfc_6", "kycLink": "_kyc_link_slrfc_6", "kyc-status-icon": "_kyc-status-icon_slrfc_13", "kycStatusIcon": "_kyc-status-icon_slrfc_13", "billing-header": "_billing-header_slrfc_18", "billingHeader": "_billing-header_slrfc_18", "billing-edit": "_billing-edit_slrfc_25", "billingEdit": "_billing-edit_slrfc_25", "billing-section": "_billing-section_slrfc_30", "billingSection": "_billing-section_slrfc_30", "billing-edit-disabled": "_billing-edit-disabled_slrfc_38", "billingEditDisabled": "_billing-edit-disabled_slrfc_38" };
13909
13952
 
13910
13953
  // admin/views/organizations/details/side-panel/org-details-section.tsx
13911
- var import_react32 = require("react");
13954
+ var import_react34 = require("react");
13912
13955
  var import_jsx_runtime70 = require("react/jsx-runtime");
13913
13956
  var OrganizationDetailsSection = ({
13914
13957
  organization
13915
13958
  }) => {
13916
- const { appUrl } = (0, import_react32.useContext)(OrganizationContext);
13959
+ const { appUrl } = (0, import_react34.useContext)(OrganizationContext);
13917
13960
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_apsara62.List, { children: [
13918
13961
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_apsara62.List.Header, { children: "Organization Details" }),
13919
13962
  /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_apsara62.List.Item, { children: [
@@ -13969,10 +14012,10 @@ var OrganizationDetailsSection = ({
13969
14012
 
13970
14013
  // admin/views/organizations/details/side-panel/kyc-section.tsx
13971
14014
  var import_apsara63 = require("@raystack/apsara");
13972
- var import_react33 = require("react");
14015
+ var import_react35 = require("react");
13973
14016
 
13974
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-mhr8CBEAbW50/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
13975
- var digest53 = "cbea9a7c44ff3cfcb9ca00118ed32e658f45e9acc47e3766dc13d050151a6d2e";
14017
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-1NCf5ie2Tu2v/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
14018
+ var digest53 = "4dec2ac5765088a6589ef71abef95d05722b9f49d7ad35a0567dd8e3095df335";
13976
14019
  var css53 = `._side-panel-section-item-label_slrfc_1 {
13977
14020
  width: 120px;
13978
14021
  }
@@ -14039,7 +14082,7 @@ var side_panel_module_css_default7 = { "side-panel-section-item-label": "_side-p
14039
14082
  var import_icons5 = require("@raystack/apsara/icons");
14040
14083
  var import_jsx_runtime71 = require("react/jsx-runtime");
14041
14084
  var KYCDetailsSection = () => {
14042
- const { isKYCLoading, kycDetails } = (0, import_react33.useContext)(OrganizationContext);
14085
+ const { isKYCLoading, kycDetails } = (0, import_react35.useContext)(OrganizationContext);
14043
14086
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_apsara63.List, { children: [
14044
14087
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_apsara63.List.Header, { children: "KYC Details" }),
14045
14088
  /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_apsara63.List.Item, { children: [
@@ -14092,11 +14135,11 @@ var KYCDetailsSection = () => {
14092
14135
  };
14093
14136
 
14094
14137
  // admin/views/organizations/details/side-panel/plan-details-section.tsx
14095
- var import_react34 = require("react");
14138
+ var import_react36 = require("react");
14096
14139
  var import_apsara64 = require("@raystack/apsara");
14097
14140
 
14098
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-a5YQHVPTg1Ox/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
14099
- var digest54 = "6c04dda328bb405db56a105ca652227f4b7cf56994922b0217df934eace88a8a";
14141
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-kS7fjDk2gdzo/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
14142
+ var digest54 = "c853b4823ebdaf6ab0398c3770f4ebf53bc132fbb1211e2b6d2c3b946a233226";
14100
14143
  var css54 = `._side-panel-section-item-label_slrfc_1 {
14101
14144
  width: 120px;
14102
14145
  }
@@ -14160,17 +14203,17 @@ var css54 = `._side-panel-section-item-label_slrfc_1 {
14160
14203
  var side_panel_module_css_default8 = { "side-panel-section-item-label": "_side-panel-section-item-label_slrfc_1", "sidePanelSectionItemLabel": "_side-panel-section-item-label_slrfc_1", "org-details-section-org-id": "_org-details-section-org-id_slrfc_5", "orgDetailsSectionOrgId": "_org-details-section-org-id_slrfc_5", "kyc_link": "_kyc_link_slrfc_6", "kycLink": "_kyc_link_slrfc_6", "kyc-status-icon": "_kyc-status-icon_slrfc_13", "kycStatusIcon": "_kyc-status-icon_slrfc_13", "billing-header": "_billing-header_slrfc_18", "billingHeader": "_billing-header_slrfc_18", "billing-edit": "_billing-edit_slrfc_25", "billingEdit": "_billing-edit_slrfc_25", "billing-section": "_billing-section_slrfc_30", "billingSection": "_billing-section_slrfc_30", "billing-edit-disabled": "_billing-edit-disabled_slrfc_38", "billingEditDisabled": "_billing-edit-disabled_slrfc_38" };
14161
14204
 
14162
14205
  // admin/views/organizations/details/side-panel/plan-details-section.tsx
14163
- var import_connect_query24 = require("@connectrpc/connect-query");
14164
- var import_frontier29 = require("@raystack/proton/frontier");
14165
- var import_protobuf12 = require("@bufbuild/protobuf");
14206
+ var import_connect_query25 = require("@connectrpc/connect-query");
14207
+ var import_frontier30 = require("@raystack/proton/frontier");
14208
+ var import_protobuf13 = require("@bufbuild/protobuf");
14166
14209
  var import_jsx_runtime72 = require("react/jsx-runtime");
14167
14210
  var PlanDetailsSection = () => {
14168
- const { billingAccount, organization } = (0, import_react34.useContext)(OrganizationContext);
14211
+ const { billingAccount, organization } = (0, import_react36.useContext)(OrganizationContext);
14169
14212
  const billingAccountId = billingAccount?.id || "";
14170
14213
  const organizationId = organization?.id || "";
14171
- const { data: activeSubscription, isLoading: isSubscriptionLoading, error: subscriptionsError } = (0, import_connect_query24.useQuery)(
14172
- import_frontier29.FrontierServiceQueries.listSubscriptions,
14173
- (0, import_protobuf12.create)(import_frontier29.ListSubscriptionsRequestSchema, {
14214
+ const { data: activeSubscription, isLoading: isSubscriptionLoading, error: subscriptionsError } = (0, import_connect_query25.useQuery)(
14215
+ import_frontier30.FrontierServiceQueries.listSubscriptions,
14216
+ (0, import_protobuf13.create)(import_frontier30.ListSubscriptionsRequestSchema, {
14174
14217
  orgId: organizationId
14175
14218
  }),
14176
14219
  {
@@ -14186,9 +14229,9 @@ var PlanDetailsSection = () => {
14186
14229
  if (subscriptionsError) {
14187
14230
  console.error("Error fetching subscriptions:", subscriptionsError);
14188
14231
  }
14189
- const { data: planData, isLoading: isPlanLoading, error: planError } = (0, import_connect_query24.useQuery)(
14190
- import_frontier29.FrontierServiceQueries.getPlan,
14191
- (0, import_protobuf12.create)(import_frontier29.GetPlanRequestSchema, {
14232
+ const { data: planData, isLoading: isPlanLoading, error: planError } = (0, import_connect_query25.useQuery)(
14233
+ import_frontier30.FrontierServiceQueries.getPlan,
14234
+ (0, import_protobuf13.create)(import_frontier30.GetPlanRequestSchema, {
14192
14235
  id: activeSubscription?.planId ?? ""
14193
14236
  }),
14194
14237
  {
@@ -14226,8 +14269,8 @@ var PlanDetailsSection = () => {
14226
14269
  var import_apsara65 = require("@raystack/apsara");
14227
14270
  var import_icons6 = require("@raystack/apsara/icons");
14228
14271
 
14229
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-etdtp809O6t7/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
14230
- var digest55 = "c686d82d84bbdf79111f02994874bf062ca912f78a69f1079a3db79d387fcba8";
14272
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-kqggvkMcmpe9/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
14273
+ var digest55 = "f9dad8cf49b194d7edf1ea0ae94a7e43b052cfcc04670e2d0c8e0bff1810ff0d";
14231
14274
  var css55 = `._side-panel-section-item-label_slrfc_1 {
14232
14275
  width: 120px;
14233
14276
  }
@@ -14291,10 +14334,10 @@ var css55 = `._side-panel-section-item-label_slrfc_1 {
14291
14334
  var side_panel_module_css_default9 = { "side-panel-section-item-label": "_side-panel-section-item-label_slrfc_1", "sidePanelSectionItemLabel": "_side-panel-section-item-label_slrfc_1", "org-details-section-org-id": "_org-details-section-org-id_slrfc_5", "orgDetailsSectionOrgId": "_org-details-section-org-id_slrfc_5", "kyc_link": "_kyc_link_slrfc_6", "kycLink": "_kyc_link_slrfc_6", "kyc-status-icon": "_kyc-status-icon_slrfc_13", "kycStatusIcon": "_kyc-status-icon_slrfc_13", "billing-header": "_billing-header_slrfc_18", "billingHeader": "_billing-header_slrfc_18", "billing-edit": "_billing-edit_slrfc_25", "billingEdit": "_billing-edit_slrfc_25", "billing-section": "_billing-section_slrfc_30", "billingSection": "_billing-section_slrfc_30", "billing-edit-disabled": "_billing-edit-disabled_slrfc_38", "billingEditDisabled": "_billing-edit-disabled_slrfc_38" };
14292
14335
 
14293
14336
  // admin/views/organizations/details/side-panel/tokens-details-section.tsx
14294
- var import_react35 = require("react");
14295
- var import_connect_query25 = require("@connectrpc/connect-query");
14296
- var import_frontier30 = require("@raystack/proton/frontier");
14297
- var import_protobuf13 = require("@bufbuild/protobuf");
14337
+ var import_react37 = require("react");
14338
+ var import_connect_query26 = require("@connectrpc/connect-query");
14339
+ var import_frontier31 = require("@raystack/proton/frontier");
14340
+ var import_protobuf14 = require("@bufbuild/protobuf");
14298
14341
  var import_jsx_runtime73 = require("react/jsx-runtime");
14299
14342
  var TokensDetailsSection = () => {
14300
14343
  const {
@@ -14302,13 +14345,14 @@ var TokensDetailsSection = () => {
14302
14345
  billingAccount,
14303
14346
  organization,
14304
14347
  isTokenBalanceLoading,
14348
+ isBillingAccountLoading,
14305
14349
  billingAccountDetails
14306
- } = (0, import_react35.useContext)(OrganizationContext);
14350
+ } = (0, import_react37.useContext)(OrganizationContext);
14307
14351
  const organizationId = organization?.id || "";
14308
14352
  const billingAccountId = billingAccount?.id || "";
14309
- const { data: tokensUsed = "0", isLoading: isTokensLoading, error } = (0, import_connect_query25.useQuery)(
14310
- import_frontier30.FrontierServiceQueries.totalDebitedTransactions,
14311
- (0, import_protobuf13.create)(import_frontier30.TotalDebitedTransactionsRequestSchema, {
14353
+ const { data: tokensUsed = "0", isLoading: isTokensLoading, error } = (0, import_connect_query26.useQuery)(
14354
+ import_frontier31.FrontierServiceQueries.totalDebitedTransactions,
14355
+ (0, import_protobuf14.create)(import_frontier31.TotalDebitedTransactionsRequestSchema, {
14312
14356
  orgId: organizationId,
14313
14357
  billingId: billingAccountId
14314
14358
  }),
@@ -14317,12 +14361,12 @@ var TokensDetailsSection = () => {
14317
14361
  select: (data) => String(data?.debited?.amount || "0")
14318
14362
  }
14319
14363
  );
14320
- (0, import_react35.useEffect)(() => {
14364
+ (0, import_react37.useEffect)(() => {
14321
14365
  if (error) {
14322
14366
  console.error("Error fetching debited transactions:", error);
14323
14367
  }
14324
14368
  }, [error]);
14325
- const isLoading = isTokensLoading;
14369
+ const isLoading = isBillingAccountLoading || isTokensLoading;
14326
14370
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_apsara65.List, { children: [
14327
14371
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_apsara65.List.Header, { children: "Tokens" }),
14328
14372
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_apsara65.List.Item, { children: [
@@ -14360,8 +14404,8 @@ var TokensDetailsSection = () => {
14360
14404
  // admin/views/organizations/details/side-panel/billing-details-section.tsx
14361
14405
  var import_apsara66 = require("@raystack/apsara");
14362
14406
 
14363
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-1Cltb6QIEV7V/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
14364
- var digest56 = "dcbbd2daa2e6c0f61eb5bbf397a0df029fbe5786490fc5b9f175b83618f71723";
14407
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-lvIVYCgz3QVz/sdk/admin/views/organizations/details/side-panel/side-panel.module.css.js
14408
+ var digest56 = "30237d5237a99bec57c3c4be25ae030ad5cf0e629f84fcf44899fa9a11d11287";
14365
14409
  var css56 = `._side-panel-section-item-label_slrfc_1 {
14366
14410
  width: 120px;
14367
14411
  }
@@ -14425,18 +14469,22 @@ var css56 = `._side-panel-section-item-label_slrfc_1 {
14425
14469
  var side_panel_module_css_default10 = { "side-panel-section-item-label": "_side-panel-section-item-label_slrfc_1", "sidePanelSectionItemLabel": "_side-panel-section-item-label_slrfc_1", "org-details-section-org-id": "_org-details-section-org-id_slrfc_5", "orgDetailsSectionOrgId": "_org-details-section-org-id_slrfc_5", "kyc_link": "_kyc_link_slrfc_6", "kycLink": "_kyc_link_slrfc_6", "kyc-status-icon": "_kyc-status-icon_slrfc_13", "kycStatusIcon": "_kyc-status-icon_slrfc_13", "billing-header": "_billing-header_slrfc_18", "billingHeader": "_billing-header_slrfc_18", "billing-edit": "_billing-edit_slrfc_25", "billingEdit": "_billing-edit_slrfc_25", "billing-section": "_billing-section_slrfc_30", "billingSection": "_billing-section_slrfc_30", "billing-edit-disabled": "_billing-edit-disabled_slrfc_38", "billingEditDisabled": "_billing-edit-disabled_slrfc_38" };
14426
14470
 
14427
14471
  // admin/views/organizations/details/side-panel/billing-details-section.tsx
14428
- var import_react36 = require("react");
14429
- var import_connect_query26 = require("@connectrpc/connect-query");
14430
- var import_frontier31 = require("@raystack/proton/frontier");
14431
- var import_protobuf14 = require("@bufbuild/protobuf");
14472
+ var import_react38 = require("react");
14473
+ var import_connect_query27 = require("@connectrpc/connect-query");
14474
+ var import_frontier32 = require("@raystack/proton/frontier");
14475
+ var import_protobuf15 = require("@bufbuild/protobuf");
14432
14476
  var import_jsx_runtime74 = require("react/jsx-runtime");
14433
14477
  var BillingDetailsSection = () => {
14434
- const { billingAccount, organization } = (0, import_react36.useContext)(OrganizationContext);
14478
+ const { billingAccount, organization, isBillingAccountLoading } = (0, import_react38.useContext)(OrganizationContext);
14435
14479
  const organizationId = organization?.id || "";
14436
14480
  const billingAccountId = billingAccount?.id || "";
14437
- const { data: upcomingInvoice, isLoading, error } = (0, import_connect_query26.useQuery)(
14438
- import_frontier31.FrontierServiceQueries.getUpcomingInvoice,
14439
- (0, import_protobuf14.create)(import_frontier31.GetUpcomingInvoiceRequestSchema, {
14481
+ const {
14482
+ data: upcomingInvoice,
14483
+ isLoading: isUpcomingInvoiceLoading,
14484
+ error
14485
+ } = (0, import_connect_query27.useQuery)(
14486
+ import_frontier32.FrontierServiceQueries.getUpcomingInvoice,
14487
+ (0, import_protobuf15.create)(import_frontier32.GetUpcomingInvoiceRequestSchema, {
14440
14488
  orgId: organizationId,
14441
14489
  billingId: billingAccountId
14442
14490
  }),
@@ -14445,14 +14493,15 @@ var BillingDetailsSection = () => {
14445
14493
  select: (data) => data?.invoice
14446
14494
  }
14447
14495
  );
14448
- (0, import_react36.useEffect)(() => {
14496
+ (0, import_react38.useEffect)(() => {
14449
14497
  if (error) {
14450
14498
  console.error("Error fetching upcoming invoice:", error);
14451
14499
  }
14452
14500
  }, [error]);
14501
+ const isLoading = isBillingAccountLoading || isUpcomingInvoiceLoading;
14453
14502
  const due_date = upcomingInvoice?.dueDate || upcomingInvoice?.periodEndAt;
14454
14503
  const stripeLink = billingAccount?.providerId ? "https://dashboard.stripe.com/customers/" + billingAccount?.providerId : "";
14455
- const { mutateAsync: createCheckout, isPending: isPortalLoading } = (0, import_connect_query26.useMutation)(import_frontier31.FrontierServiceQueries.createCheckout, {
14504
+ const { mutateAsync: createCheckout, isPending: isPortalLoading } = (0, import_connect_query27.useMutation)(import_frontier32.FrontierServiceQueries.createCheckout, {
14456
14505
  onError: (error2) => {
14457
14506
  import_apsara66.toastManager.add({
14458
14507
  title: "Something went wrong",
@@ -14469,7 +14518,7 @@ var BillingDetailsSection = () => {
14469
14518
  const returnUrl = window.location.href;
14470
14519
  try {
14471
14520
  const resp = await createCheckout(
14472
- (0, import_protobuf14.create)(import_frontier31.CreateCheckoutRequestSchema, {
14521
+ (0, import_protobuf15.create)(import_frontier32.CreateCheckoutRequestSchema, {
14473
14522
  orgId: organizationId,
14474
14523
  cancelUrl: returnUrl,
14475
14524
  successUrl: returnUrl,
@@ -14586,14 +14635,14 @@ function OrgSidePanel({ organization }) {
14586
14635
  }
14587
14636
 
14588
14637
  // admin/views/organizations/details/layout/index.tsx
14589
- var import_react40 = require("react");
14638
+ var import_react42 = require("react");
14590
14639
  var import_icons7 = require("@raystack/apsara/icons");
14591
14640
 
14592
14641
  // admin/views/organizations/details/edit/kyc.tsx
14593
14642
  var import_apsara68 = require("@raystack/apsara");
14594
14643
 
14595
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-0vbj5fDRIxTn/sdk/admin/views/organizations/details/edit/edit.module.css.js
14596
- var digest57 = "a83dc451e175bdb4b39202670aa4abd8b571839070c66b5edb1f9e2eb80bf060";
14644
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-ODISdqyuX4Bg/sdk/admin/views/organizations/details/edit/edit.module.css.js
14645
+ var digest57 = "067b9814d38e44ae784b305d30cb9b4e11c4134b816f52260ec1ba97405a0f3e";
14597
14646
  var css57 = `._drawer-content_18xgg_1 {
14598
14647
  min-width: 500px;
14599
14648
  padding: 0;
@@ -14642,13 +14691,13 @@ var css57 = `._drawer-content_18xgg_1 {
14642
14691
  var edit_module_css_default = { "drawer-content": "_drawer-content_18xgg_1", "drawerContent": "_drawer-content_18xgg_1", "side-panel": "_side-panel_18xgg_7", "sidePanel": "_side-panel_18xgg_7", "side-panel-form": "_side-panel-form_18xgg_15", "sidePanelForm": "_side-panel-form_18xgg_15", "side-panel-content": "_side-panel-content_18xgg_22", "sidePanelContent": "_side-panel-content_18xgg_22", "side-panel-footer": "_side-panel-footer_18xgg_26", "sidePanelFooter": "_side-panel-footer_18xgg_26", "select-content": "_select-content_18xgg_31", "selectContent": "_select-content_18xgg_31" };
14643
14692
 
14644
14693
  // admin/views/organizations/details/edit/kyc.tsx
14645
- var import_react37 = require("react");
14694
+ var import_react39 = require("react");
14646
14695
  var import_react_hook_form6 = require("react-hook-form");
14647
14696
  var import_zod9 = require("@hookform/resolvers/zod");
14648
- var import_connect_query27 = require("@connectrpc/connect-query");
14649
- var import_react_query9 = require("@tanstack/react-query");
14650
- var import_frontier32 = require("@raystack/proton/frontier");
14651
- var import_protobuf15 = require("@bufbuild/protobuf");
14697
+ var import_connect_query28 = require("@connectrpc/connect-query");
14698
+ var import_react_query10 = require("@tanstack/react-query");
14699
+ var import_frontier33 = require("@raystack/proton/frontier");
14700
+ var import_protobuf16 = require("@bufbuild/protobuf");
14652
14701
  var import_jsx_runtime76 = require("react/jsx-runtime");
14653
14702
  var kycUpdateSchema = external_exports.object({
14654
14703
  status: external_exports.boolean(),
@@ -14663,9 +14712,9 @@ var kycUpdateSchema = external_exports.object({
14663
14712
  }
14664
14713
  });
14665
14714
  function EditKYCPanel({ open = false, onClose }) {
14666
- const { organization, kycDetails, updateKYCDetails } = (0, import_react37.useContext)(OrganizationContext);
14667
- const queryClient = (0, import_react_query9.useQueryClient)();
14668
- const transport = (0, import_connect_query27.useTransport)();
14715
+ const { organization, kycDetails, updateKYCDetails } = (0, import_react39.useContext)(OrganizationContext);
14716
+ const queryClient = (0, import_react_query10.useQueryClient)();
14717
+ const transport = (0, import_connect_query28.useTransport)();
14669
14718
  const orgId = organization?.id || "";
14670
14719
  const {
14671
14720
  handleSubmit,
@@ -14680,15 +14729,15 @@ function EditKYCPanel({ open = false, onClose }) {
14680
14729
  });
14681
14730
  const {
14682
14731
  mutateAsync: setOrganizationKycMutation
14683
- } = (0, import_connect_query27.useMutation)(import_frontier32.AdminServiceQueries.setOrganizationKyc, {
14732
+ } = (0, import_connect_query28.useMutation)(import_frontier33.AdminServiceQueries.setOrganizationKyc, {
14684
14733
  onSuccess: (data) => {
14685
14734
  const newKycDetails = data.organizationKyc;
14686
14735
  if (newKycDetails) {
14687
14736
  updateKYCDetails(newKycDetails);
14688
14737
  }
14689
14738
  queryClient.invalidateQueries({
14690
- queryKey: (0, import_connect_query27.createConnectQueryKey)({
14691
- schema: import_frontier32.FrontierServiceQueries.getOrganizationKyc,
14739
+ queryKey: (0, import_connect_query28.createConnectQueryKey)({
14740
+ schema: import_frontier33.FrontierServiceQueries.getOrganizationKyc,
14692
14741
  transport,
14693
14742
  input: { orgId },
14694
14743
  cardinality: "finite"
@@ -14707,7 +14756,7 @@ function EditKYCPanel({ open = false, onClose }) {
14707
14756
  return;
14708
14757
  }
14709
14758
  await setOrganizationKycMutation(
14710
- (0, import_protobuf15.create)(import_frontier32.SetOrganizationKycRequestSchema, {
14759
+ (0, import_protobuf16.create)(import_frontier33.SetOrganizationKycRequestSchema, {
14711
14760
  orgId,
14712
14761
  status: data.status,
14713
14762
  link: data.link || ""
@@ -14817,10 +14866,10 @@ function EditKYCPanel({ open = false, onClose }) {
14817
14866
  }
14818
14867
 
14819
14868
  // admin/views/organizations/details/edit/organization.tsx
14820
- var import_react38 = require("react");
14869
+ var import_react40 = require("react");
14821
14870
 
14822
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-zYuDGQ3T9b0g/sdk/admin/views/organizations/details/edit/edit.module.css.js
14823
- var digest58 = "1c7040b4267711974e485b050609222e145438ae49df06f53ab291da69f355f7";
14871
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-ztyyeHOSWsxe/sdk/admin/views/organizations/details/edit/edit.module.css.js
14872
+ var digest58 = "2f172dbb6cd912a758e161ac5f284e7284a628b089b5a5236710cf38f82e34e6";
14824
14873
  var css58 = `._drawer-content_18xgg_1 {
14825
14874
  min-width: 500px;
14826
14875
  padding: 0;
@@ -14872,10 +14921,10 @@ var edit_module_css_default2 = { "drawer-content": "_drawer-content_18xgg_1", "d
14872
14921
  var import_apsara69 = require("@raystack/apsara");
14873
14922
  var import_react_hook_form7 = require("react-hook-form");
14874
14923
  var import_zod11 = require("@hookform/resolvers/zod");
14875
- var import_connect_query28 = require("@connectrpc/connect-query");
14876
- var import_react_query10 = require("@tanstack/react-query");
14877
- var import_frontier33 = require("@raystack/proton/frontier");
14878
- var import_protobuf16 = require("@bufbuild/protobuf");
14924
+ var import_connect_query29 = require("@connectrpc/connect-query");
14925
+ var import_react_query11 = require("@tanstack/react-query");
14926
+ var import_frontier34 = require("@raystack/proton/frontier");
14927
+ var import_protobuf17 = require("@bufbuild/protobuf");
14879
14928
  var import_jsx_runtime77 = require("react/jsx-runtime");
14880
14929
  var orgUpdateSchema = external_exports.object({
14881
14930
  avatar: external_exports.string().optional(),
@@ -14915,12 +14964,12 @@ function getDefaultValue(organization, industries) {
14915
14964
  }
14916
14965
  function EditOrganizationPanel({ open = false, onClose }) {
14917
14966
  const t = useTerminology();
14918
- const { organization, appUrl, countries: countriesFromContext = [], organizationTypes: industries = [] } = (0, import_react38.useContext)(OrganizationContext);
14919
- const [countries, setCountries] = (0, import_react38.useState)(countriesFromContext);
14920
- const queryClient = (0, import_react_query10.useQueryClient)();
14921
- const transport = (0, import_connect_query28.useTransport)();
14967
+ const { organization, appUrl, countries: countriesFromContext = [], organizationTypes: industries = [] } = (0, import_react40.useContext)(OrganizationContext);
14968
+ const [countries, setCountries] = (0, import_react40.useState)(countriesFromContext);
14969
+ const queryClient = (0, import_react_query11.useQueryClient)();
14970
+ const transport = (0, import_connect_query29.useTransport)();
14922
14971
  const orgId = organization?.id || "";
14923
- (0, import_react38.useEffect)(() => {
14972
+ (0, import_react40.useEffect)(() => {
14924
14973
  if (countriesFromContext.length > 0)
14925
14974
  setCountries(countriesFromContext);
14926
14975
  }, [countriesFromContext]);
@@ -14939,11 +14988,11 @@ function EditOrganizationPanel({ open = false, onClose }) {
14939
14988
  mutateAsync: updateOrganizationMutation,
14940
14989
  error: mutationError,
14941
14990
  isPending: isSubmitting
14942
- } = (0, import_connect_query28.useMutation)(import_frontier33.FrontierServiceQueries.updateOrganization, {
14991
+ } = (0, import_connect_query29.useMutation)(import_frontier34.FrontierServiceQueries.updateOrganization, {
14943
14992
  onSuccess: () => {
14944
14993
  queryClient.invalidateQueries({
14945
- queryKey: (0, import_connect_query28.createConnectQueryKey)({
14946
- schema: import_frontier33.FrontierServiceQueries.getOrganization,
14994
+ queryKey: (0, import_connect_query29.createConnectQueryKey)({
14995
+ schema: import_frontier34.FrontierServiceQueries.getOrganization,
14947
14996
  transport,
14948
14997
  input: { id: orgId },
14949
14998
  cardinality: "finite"
@@ -14952,7 +15001,7 @@ function EditOrganizationPanel({ open = false, onClose }) {
14952
15001
  onClose();
14953
15002
  }
14954
15003
  });
14955
- (0, import_react38.useEffect)(() => {
15004
+ (0, import_react40.useEffect)(() => {
14956
15005
  if (mutationError) {
14957
15006
  if (mutationError.message?.includes("already exists")) {
14958
15007
  setError("name", { message: `${t.organization({ case: "capital" })} name already exists` });
@@ -14973,7 +15022,7 @@ function EditOrganizationPanel({ open = false, onClose }) {
14973
15022
  country: data.country
14974
15023
  }
14975
15024
  };
14976
- await updateOrganizationMutation((0, import_protobuf16.create)(import_frontier33.UpdateOrganizationRequestSchema, {
15025
+ await updateOrganizationMutation((0, import_protobuf17.create)(import_frontier34.UpdateOrganizationRequestSchema, {
14977
15026
  id: orgId,
14978
15027
  body: payload
14979
15028
  }));
@@ -15175,8 +15224,8 @@ function EditOrganizationPanel({ open = false, onClose }) {
15175
15224
  // admin/views/organizations/details/edit/billing.tsx
15176
15225
  var import_apsara70 = require("@raystack/apsara");
15177
15226
 
15178
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-lDVIs58zg7Nd/sdk/admin/views/organizations/details/edit/edit.module.css.js
15179
- var digest59 = "2d3ce7a58f088ed9f0c77618e8e424a8aebddda0b31dd3433e407bcca8ed63d3";
15227
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-E2mc933D4G4F/sdk/admin/views/organizations/details/edit/edit.module.css.js
15228
+ var digest59 = "18d86e1a2b6db36b1de0b29dc2495a395bd891979680af60cd0f5c06fa41416a";
15180
15229
  var css59 = `._drawer-content_18xgg_1 {
15181
15230
  min-width: 500px;
15182
15231
  padding: 0;
@@ -15225,12 +15274,12 @@ var css59 = `._drawer-content_18xgg_1 {
15225
15274
  var edit_module_css_default3 = { "drawer-content": "_drawer-content_18xgg_1", "drawerContent": "_drawer-content_18xgg_1", "side-panel": "_side-panel_18xgg_7", "sidePanel": "_side-panel_18xgg_7", "side-panel-form": "_side-panel-form_18xgg_15", "sidePanelForm": "_side-panel-form_18xgg_15", "side-panel-content": "_side-panel-content_18xgg_22", "sidePanelContent": "_side-panel-content_18xgg_22", "side-panel-footer": "_side-panel-footer_18xgg_26", "sidePanelFooter": "_side-panel-footer_18xgg_26", "select-content": "_select-content_18xgg_31", "selectContent": "_select-content_18xgg_31" };
15226
15275
 
15227
15276
  // admin/views/organizations/details/edit/billing.tsx
15228
- var import_react39 = require("react");
15277
+ var import_react41 = require("react");
15229
15278
  var import_react_hook_form8 = require("react-hook-form");
15230
15279
  var import_zod13 = require("@hookform/resolvers/zod");
15231
- var import_connect_query29 = require("@connectrpc/connect-query");
15232
- var import_frontier34 = require("@raystack/proton/frontier");
15233
- var import_protobuf17 = require("@bufbuild/protobuf");
15280
+ var import_connect_query30 = require("@connectrpc/connect-query");
15281
+ var import_frontier35 = require("@raystack/proton/frontier");
15282
+ var import_protobuf18 = require("@bufbuild/protobuf");
15234
15283
  var import_jsx_runtime78 = require("react/jsx-runtime");
15235
15284
  var billingDetailsUpdateSchema = external_exports.object({
15236
15285
  tokenPaymentType: external_exports.enum(["prepaid", "postpaid"]),
@@ -15273,7 +15322,7 @@ function EditBillingPanel({ open = false, onClose }) {
15273
15322
  billingAccountDetails,
15274
15323
  isBillingAccountLoading: isLoading,
15275
15324
  fetchBillingAccountDetails
15276
- } = (0, import_react39.useContext)(OrganizationContext);
15325
+ } = (0, import_react41.useContext)(OrganizationContext);
15277
15326
  const organizationId = billingAccount?.orgId || "";
15278
15327
  const billingId = billingAccount?.id || "";
15279
15328
  const {
@@ -15286,7 +15335,7 @@ function EditBillingPanel({ open = false, onClose }) {
15286
15335
  } = (0, import_react_hook_form8.useForm)({
15287
15336
  resolver: (0, import_zod13.zodResolver)(billingDetailsUpdateSchema)
15288
15337
  });
15289
- const billingDetailsData = (0, import_react39.useMemo)(() => {
15338
+ const billingDetailsData = (0, import_react41.useMemo)(() => {
15290
15339
  const creditMin = billingAccountDetails?.creditMin || 0n;
15291
15340
  const absoluteCreditMin = creditMin < 0n ? creditMin * BigInt(-1) : creditMin;
15292
15341
  const dueInDays = billingAccountDetails?.dueInDays || 0n;
@@ -15297,13 +15346,13 @@ function EditBillingPanel({ open = false, onClose }) {
15297
15346
  dueInDays: dueInDays.toString()
15298
15347
  };
15299
15348
  }, [billingAccountDetails]);
15300
- (0, import_react39.useEffect)(() => {
15349
+ (0, import_react41.useEffect)(() => {
15301
15350
  if (billingDetailsData) {
15302
15351
  reset(billingDetailsData);
15303
15352
  }
15304
15353
  }, [billingDetailsData, reset]);
15305
- const { mutateAsync: updateBillingDetails } = (0, import_connect_query29.useMutation)(
15306
- import_frontier34.AdminServiceQueries.updateBillingAccountDetails,
15354
+ const { mutateAsync: updateBillingDetails } = (0, import_connect_query30.useMutation)(
15355
+ import_frontier35.AdminServiceQueries.updateBillingAccountDetails,
15307
15356
  {
15308
15357
  onError: (error) => {
15309
15358
  import_apsara70.toastManager.add({
@@ -15315,13 +15364,16 @@ function EditBillingPanel({ open = false, onClose }) {
15315
15364
  }
15316
15365
  }
15317
15366
  );
15367
+ const canSave = !!organizationId && !!billingId;
15318
15368
  const onSubmit = async (data) => {
15369
+ if (!canSave)
15370
+ return;
15319
15371
  try {
15320
15372
  const creditMinValue = data.tokenPaymentType === "prepaid" ? 0n : BigInt(data.creditMin);
15321
15373
  const dueInDaysValue = data.tokenPaymentType === "prepaid" ? 0n : BigInt(data.dueInDays);
15322
15374
  const creditMinForApi = data.tokenPaymentType === "postpaid" ? -creditMinValue : creditMinValue;
15323
15375
  await updateBillingDetails(
15324
- (0, import_protobuf17.create)(import_frontier34.UpdateBillingAccountDetailsRequestSchema, {
15376
+ (0, import_protobuf18.create)(import_frontier35.UpdateBillingAccountDetailsRequestSchema, {
15325
15377
  orgId: organizationId,
15326
15378
  id: billingId,
15327
15379
  creditMin: creditMinForApi,
@@ -15339,7 +15391,7 @@ function EditBillingPanel({ open = false, onClose }) {
15339
15391
  console.error("Failed to update billing details:", error);
15340
15392
  }
15341
15393
  };
15342
- const onValueChange = (0, import_react39.useCallback)((value) => {
15394
+ const onValueChange = (0, import_react41.useCallback)((value) => {
15343
15395
  const paymentType = value;
15344
15396
  setValue("tokenPaymentType", paymentType);
15345
15397
  if (paymentType === "prepaid") {
@@ -15448,7 +15500,7 @@ function EditBillingPanel({ open = false, onClose }) {
15448
15500
  {
15449
15501
  "data-test-id": "save-update-billing-details-button",
15450
15502
  type: "submit",
15451
- disabled: isLoading || isSubmitting,
15503
+ disabled: isLoading || !canSave || isSubmitting,
15452
15504
  loading: isSubmitting,
15453
15505
  loaderText: "Saving...",
15454
15506
  children: "Save"
@@ -15476,10 +15528,10 @@ var OrganizationDetailsLayout = ({
15476
15528
  onNavigate
15477
15529
  }) => {
15478
15530
  const t = useTerminology();
15479
- const [showSidePanel, setShowSidePanel] = (0, import_react40.useState)(true);
15480
- const [showKYCPanel, setShowKYCPanel] = (0, import_react40.useState)(false);
15481
- const [showEditOrgPanel, setShowEditOrgPanel] = (0, import_react40.useState)(false);
15482
- const [showEditBillingPanel, setShowEditBillingPanel] = (0, import_react40.useState)(false);
15531
+ const [showSidePanel, setShowSidePanel] = (0, import_react42.useState)(true);
15532
+ const [showKYCPanel, setShowKYCPanel] = (0, import_react42.useState)(false);
15533
+ const [showEditOrgPanel, setShowEditOrgPanel] = (0, import_react42.useState)(false);
15534
+ const [showEditBillingPanel, setShowEditBillingPanel] = (0, import_react42.useState)(false);
15483
15535
  function toggleSidePanel() {
15484
15536
  setShowSidePanel(!showSidePanel);
15485
15537
  }
@@ -15554,7 +15606,7 @@ var OrganizationDetailsLayout = ({
15554
15606
  };
15555
15607
 
15556
15608
  // admin/views/organizations/details/index.tsx
15557
- var import_frontier35 = require("@raystack/proton/frontier");
15609
+ var import_frontier36 = require("@raystack/proton/frontier");
15558
15610
  var import_jsx_runtime80 = require("react/jsx-runtime");
15559
15611
  var OrganizationDetailsView = ({
15560
15612
  organizationId,
@@ -15569,24 +15621,26 @@ var OrganizationDetailsView = ({
15569
15621
  onNavigate,
15570
15622
  children
15571
15623
  }) => {
15572
- const [isSearchVisible, setIsSearchVisible] = (0, import_react41.useState)(false);
15573
- const [searchQuery, setSearchQuery] = (0, import_react41.useState)("");
15574
- const queryClient = (0, import_react_query11.useQueryClient)();
15575
- const transport = (0, import_connect_query30.useTransport)();
15624
+ const [isSearchVisible, setIsSearchVisible] = (0, import_react43.useState)(false);
15625
+ const [searchQuery, setSearchQuery] = (0, import_react43.useState)("");
15626
+ const queryClient = (0, import_react_query12.useQueryClient)();
15627
+ const transport = (0, import_connect_query31.useTransport)();
15576
15628
  const {
15577
15629
  data: organization,
15578
15630
  isLoading: isOrganizationLoading,
15579
15631
  error: organizationError
15580
- } = (0, import_connect_query30.useQuery)(
15581
- import_frontier35.FrontierServiceQueries.getOrganization,
15632
+ } = (0, import_connect_query31.useQuery)(
15633
+ import_frontier36.FrontierServiceQueries.getOrganization,
15582
15634
  { id: organizationId },
15583
15635
  {
15584
15636
  enabled: !!organizationId,
15637
+ // Holds the page's seed; edit and block/unblock invalidate this key.
15638
+ staleTime: SHARED_QUERY_STALE_TIME,
15585
15639
  select: (data) => data?.organization
15586
15640
  }
15587
15641
  );
15588
15642
  const getOrganizationQueryKey = [
15589
- import_frontier35.FrontierServiceQueries.getOrganization,
15643
+ import_frontier36.FrontierServiceQueries.getOrganization,
15590
15644
  { id: organizationId }
15591
15645
  ];
15592
15646
  async function updateOrganization(org) {
@@ -15596,25 +15650,25 @@ var OrganizationDetailsView = ({
15596
15650
  data: kycData,
15597
15651
  isLoading: isKYCLoading,
15598
15652
  error: kycError
15599
- } = (0, import_connect_query30.useQuery)(
15600
- import_frontier35.FrontierServiceQueries.getOrganizationKyc,
15653
+ } = (0, import_connect_query31.useQuery)(
15654
+ import_frontier36.FrontierServiceQueries.getOrganizationKyc,
15601
15655
  { orgId: organizationId || "" },
15602
15656
  {
15603
15657
  enabled: !!organizationId
15604
15658
  }
15605
15659
  );
15606
- const kycDetails = (0, import_react41.useMemo)(() => kycData?.organizationKyc, [kycData]);
15660
+ const kycDetails = (0, import_react43.useMemo)(() => kycData?.organizationKyc, [kycData]);
15607
15661
  function updateKYCDetails(kyc) {
15608
15662
  if (!organizationId)
15609
15663
  return;
15610
15664
  queryClient.setQueryData(
15611
- (0, import_connect_query30.createConnectQueryKey)({
15612
- schema: import_frontier35.FrontierServiceQueries.getOrganizationKyc,
15665
+ (0, import_connect_query31.createConnectQueryKey)({
15666
+ schema: import_frontier36.FrontierServiceQueries.getOrganizationKyc,
15613
15667
  transport,
15614
15668
  input: { orgId: organizationId },
15615
15669
  cardinality: "finite"
15616
15670
  }),
15617
- (0, import_protobuf18.create)(import_frontier35.GetOrganizationKycResponseSchema, { organizationKyc: kyc })
15671
+ (0, import_protobuf19.create)(import_frontier36.GetOrganizationKycResponseSchema, { organizationKyc: kyc })
15618
15672
  );
15619
15673
  }
15620
15674
  const { roles, isLoading: isRolesLoading } = useOrganizationRoles(
@@ -15622,29 +15676,11 @@ var OrganizationDetailsView = ({
15622
15676
  { enabled: !!organizationId }
15623
15677
  );
15624
15678
  const {
15625
- data: orgMembersMap = {},
15626
- isLoading: isOrgMembersMapLoading,
15627
- error: orgMembersError
15628
- } = (0, import_connect_query30.useQuery)(
15629
- import_frontier35.FrontierServiceQueries.listOrganizationUsers,
15630
- { id: organizationId || "" },
15631
- {
15632
- enabled: !!organizationId,
15633
- select: (data) => {
15634
- const users = data?.users || [];
15635
- return users.reduce(
15636
- (acc, user) => {
15637
- const id = user.id || "";
15638
- acc[id] = user;
15639
- return acc;
15640
- },
15641
- {}
15642
- );
15643
- }
15644
- }
15645
- );
15646
- const { data: firstBillingAccountId = "", error: billingAccountsError } = (0, import_connect_query30.useQuery)(
15647
- import_frontier35.FrontierServiceQueries.listBillingAccounts,
15679
+ data: firstBillingAccountId = "",
15680
+ isLoading: isBillingAccountsLoading,
15681
+ error: billingAccountsError
15682
+ } = (0, import_connect_query31.useQuery)(
15683
+ import_frontier36.FrontierServiceQueries.listBillingAccounts,
15648
15684
  { orgId: organizationId || "" },
15649
15685
  {
15650
15686
  enabled: !!organizationId,
@@ -15656,9 +15692,9 @@ var OrganizationDetailsView = ({
15656
15692
  isLoading: isBillingAccountLoading,
15657
15693
  error: billingAccountError,
15658
15694
  refetch: fetchBillingAccountDetails
15659
- } = (0, import_connect_query30.useQuery)(
15660
- import_frontier35.FrontierServiceQueries.getBillingAccount,
15661
- (0, import_protobuf18.create)(import_frontier35.GetBillingAccountRequestSchema, {
15695
+ } = (0, import_connect_query31.useQuery)(
15696
+ import_frontier36.FrontierServiceQueries.getBillingAccount,
15697
+ (0, import_protobuf19.create)(import_frontier36.GetBillingAccountRequestSchema, {
15662
15698
  id: firstBillingAccountId,
15663
15699
  withBillingDetails: true
15664
15700
  }),
@@ -15672,14 +15708,15 @@ var OrganizationDetailsView = ({
15672
15708
  );
15673
15709
  const billingAccount = billingAccountData?.billingAccount;
15674
15710
  const billingAccountDetails = billingAccountData?.billingAccountDetails;
15711
+ const isBillingLoading = isBillingAccountsLoading || isBillingAccountLoading;
15675
15712
  const {
15676
15713
  data: tokenBalance = "0",
15677
15714
  isLoading: isTokenBalanceLoading,
15678
15715
  error: tokenBalanceError,
15679
15716
  refetch: fetchTokenBalance
15680
- } = (0, import_connect_query30.useQuery)(
15681
- import_frontier35.FrontierServiceQueries.getBillingBalance,
15682
- (0, import_protobuf18.create)(import_frontier35.GetBillingBalanceRequestSchema, {
15717
+ } = (0, import_connect_query31.useQuery)(
15718
+ import_frontier36.FrontierServiceQueries.getBillingBalance,
15719
+ (0, import_protobuf19.create)(import_frontier36.GetBillingBalanceRequestSchema, {
15683
15720
  id: firstBillingAccountId
15684
15721
  }),
15685
15722
  {
@@ -15687,16 +15724,13 @@ var OrganizationDetailsView = ({
15687
15724
  select: (data) => String(data?.balance?.amount || "0")
15688
15725
  }
15689
15726
  );
15690
- (0, import_react41.useEffect)(() => {
15727
+ (0, import_react43.useEffect)(() => {
15691
15728
  if (organizationError) {
15692
15729
  console.error("Failed to fetch organization:", organizationError);
15693
15730
  }
15694
15731
  if (kycError) {
15695
15732
  console.error("Failed to fetch KYC details:", kycError);
15696
15733
  }
15697
- if (orgMembersError) {
15698
- console.error("Failed to fetch organization members:", orgMembersError);
15699
- }
15700
15734
  if (billingAccountsError) {
15701
15735
  console.error("Failed to fetch billing accounts:", billingAccountsError);
15702
15736
  }
@@ -15712,12 +15746,11 @@ var OrganizationDetailsView = ({
15712
15746
  }, [
15713
15747
  organizationError,
15714
15748
  kycError,
15715
- orgMembersError,
15716
15749
  billingAccountsError,
15717
15750
  billingAccountError,
15718
15751
  tokenBalanceError
15719
15752
  ]);
15720
- const isLoading = isOrganizationLoading || isRolesLoading || isBillingAccountLoading;
15753
+ const isLoading = isOrganizationLoading || isRolesLoading;
15721
15754
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
15722
15755
  OrganizationContext.Provider,
15723
15756
  {
@@ -15727,13 +15760,11 @@ var OrganizationDetailsView = ({
15727
15760
  roles,
15728
15761
  billingAccount,
15729
15762
  billingAccountDetails,
15730
- isBillingAccountLoading,
15763
+ isBillingAccountLoading: isBillingLoading,
15731
15764
  fetchBillingAccountDetails,
15732
15765
  tokenBalance,
15733
- isTokenBalanceLoading,
15766
+ isTokenBalanceLoading: isBillingAccountsLoading || isTokenBalanceLoading,
15734
15767
  fetchTokenBalance,
15735
- orgMembersMap,
15736
- isOrgMembersMapLoading,
15737
15768
  updateKYCDetails,
15738
15769
  kycDetails,
15739
15770
  isKYCLoading,
@@ -15768,8 +15799,8 @@ var OrganizationDetailsView = ({
15768
15799
  // admin/views/organizations/details/security/index.tsx
15769
15800
  var import_apsara74 = require("@raystack/apsara");
15770
15801
 
15771
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-wTmusU7AFXRn/sdk/admin/views/organizations/details/security/security.module.css.js
15772
- var digest60 = "7cb6e79a056afeeb7bc6884ece6bfab9f4b4aee24efa987f798d26b70d448547";
15802
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-4zJL1tnuH9u8/sdk/admin/views/organizations/details/security/security.module.css.js
15803
+ var digest60 = "925b787cea090a0727fbd07a06f3cef20504ae140be351304fe059a1e077fbe4";
15773
15804
  var css60 = `._container_gfopt_1 {
15774
15805
  width: 100%;
15775
15806
  }
@@ -15820,29 +15851,29 @@ var css60 = `._container_gfopt_1 {
15820
15851
  var security_module_css_default2 = { "container": "_container_gfopt_1", "content": "_content_gfopt_5", "domains-list": "_domains-list_gfopt_11", "domainsList": "_domains-list_gfopt_11", "domains-list-status": "_domains-list-status_gfopt_18", "domainsListStatus": "_domains-list-status_gfopt_18", "domains-list-empty": "_domains-list-empty_gfopt_22", "domainsListEmpty": "_domains-list-empty_gfopt_22", "domains-list-item": "_domains-list-item_gfopt_28", "domainsListItem": "_domains-list-item_gfopt_28" };
15821
15852
 
15822
15853
  // admin/views/organizations/details/security/index.tsx
15823
- var import_react44 = require("react");
15854
+ var import_react46 = require("react");
15824
15855
 
15825
15856
  // admin/views/organizations/details/security/block-organization.tsx
15826
15857
  var import_apsara72 = require("@raystack/apsara");
15827
- var import_react42 = require("react");
15828
- var import_connect_query31 = require("@connectrpc/connect-query");
15829
- var import_frontier36 = require("@raystack/proton/frontier");
15830
- var import_protobuf19 = require("@bufbuild/protobuf");
15831
- var import_react_query12 = require("@tanstack/react-query");
15858
+ var import_react44 = require("react");
15859
+ var import_connect_query32 = require("@connectrpc/connect-query");
15860
+ var import_frontier37 = require("@raystack/proton/frontier");
15861
+ var import_protobuf20 = require("@bufbuild/protobuf");
15862
+ var import_react_query13 = require("@tanstack/react-query");
15832
15863
  var import_jsx_runtime81 = require("react/jsx-runtime");
15833
15864
  var BlockOrganizationDialog = () => {
15834
15865
  const t = useTerminology();
15835
- const { organization } = (0, import_react42.useContext)(OrganizationContext);
15836
- const queryClient = (0, import_react_query12.useQueryClient)();
15837
- const transport = (0, import_connect_query31.useTransport)();
15838
- const [isDialogOpen, setIsDialogOpen] = (0, import_react42.useState)(false);
15839
- const { mutateAsync: disableOrganization, isPending: isDisabling } = (0, import_connect_query31.useMutation)(
15840
- import_frontier36.FrontierServiceQueries.disableOrganization,
15866
+ const { organization } = (0, import_react44.useContext)(OrganizationContext);
15867
+ const queryClient = (0, import_react_query13.useQueryClient)();
15868
+ const transport = (0, import_connect_query32.useTransport)();
15869
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react44.useState)(false);
15870
+ const { mutateAsync: disableOrganization, isPending: isDisabling } = (0, import_connect_query32.useMutation)(
15871
+ import_frontier37.FrontierServiceQueries.disableOrganization,
15841
15872
  {
15842
15873
  onSuccess: async () => {
15843
15874
  await queryClient.invalidateQueries({
15844
- queryKey: (0, import_connect_query31.createConnectQueryKey)({
15845
- schema: import_frontier36.FrontierServiceQueries.getOrganization,
15875
+ queryKey: (0, import_connect_query32.createConnectQueryKey)({
15876
+ schema: import_frontier37.FrontierServiceQueries.getOrganization,
15846
15877
  transport,
15847
15878
  input: { id: organization?.id },
15848
15879
  cardinality: "finite"
@@ -15861,13 +15892,13 @@ var BlockOrganizationDialog = () => {
15861
15892
  }
15862
15893
  }
15863
15894
  );
15864
- const { mutateAsync: enableOrganization, isPending: isEnabling } = (0, import_connect_query31.useMutation)(
15865
- import_frontier36.FrontierServiceQueries.enableOrganization,
15895
+ const { mutateAsync: enableOrganization, isPending: isEnabling } = (0, import_connect_query32.useMutation)(
15896
+ import_frontier37.FrontierServiceQueries.enableOrganization,
15866
15897
  {
15867
15898
  onSuccess: async () => {
15868
15899
  await queryClient.invalidateQueries({
15869
- queryKey: (0, import_connect_query31.createConnectQueryKey)({
15870
- schema: import_frontier36.FrontierServiceQueries.getOrganization,
15900
+ queryKey: (0, import_connect_query32.createConnectQueryKey)({
15901
+ schema: import_frontier37.FrontierServiceQueries.getOrganization,
15871
15902
  transport,
15872
15903
  input: { id: organization?.id },
15873
15904
  cardinality: "finite"
@@ -15888,14 +15919,14 @@ var BlockOrganizationDialog = () => {
15888
15919
  );
15889
15920
  async function onBlockOrganization() {
15890
15921
  await disableOrganization(
15891
- (0, import_protobuf19.create)(import_frontier36.DisableOrganizationRequestSchema, {
15922
+ (0, import_protobuf20.create)(import_frontier37.DisableOrganizationRequestSchema, {
15892
15923
  id: organization?.id || ""
15893
15924
  })
15894
15925
  );
15895
15926
  }
15896
15927
  async function onUnblockOrganization() {
15897
15928
  await enableOrganization(
15898
- (0, import_protobuf19.create)(import_frontier36.EnableOrganizationRequestSchema, {
15929
+ (0, import_protobuf20.create)(import_frontier37.EnableOrganizationRequestSchema, {
15899
15930
  id: organization?.id || ""
15900
15931
  })
15901
15932
  );
@@ -15987,8 +16018,8 @@ var BlockOrganizationSection = () => {
15987
16018
  // admin/views/organizations/details/security/domains-list.tsx
15988
16019
  var import_apsara73 = require("@raystack/apsara");
15989
16020
 
15990
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-J7zgnqxJETzC/sdk/admin/views/organizations/details/security/security.module.css.js
15991
- var digest61 = "ec8e18c0e32afbd23cdad0195cc59ebf793bdb2b2c2d0cc2032a0a7df4a4f5cd";
16021
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-CKkBmYOalOu1/sdk/admin/views/organizations/details/security/security.module.css.js
16022
+ var digest61 = "77052f48426d3198240fc76276b6efc4b29b08a29c8c61c50f0e676225da530a";
15992
16023
  var css61 = `._container_gfopt_1 {
15993
16024
  width: 100%;
15994
16025
  }
@@ -16039,26 +16070,26 @@ var css61 = `._container_gfopt_1 {
16039
16070
  var security_module_css_default3 = { "container": "_container_gfopt_1", "content": "_content_gfopt_5", "domains-list": "_domains-list_gfopt_11", "domainsList": "_domains-list_gfopt_11", "domains-list-status": "_domains-list-status_gfopt_18", "domainsListStatus": "_domains-list-status_gfopt_18", "domains-list-empty": "_domains-list-empty_gfopt_22", "domainsListEmpty": "_domains-list-empty_gfopt_22", "domains-list-item": "_domains-list-item_gfopt_28", "domainsListItem": "_domains-list-item_gfopt_28" };
16040
16071
 
16041
16072
  // admin/views/organizations/details/security/domains-list.tsx
16042
- var import_react43 = require("react");
16043
- var import_connect_query32 = require("@connectrpc/connect-query");
16044
- var import_react_query13 = require("@tanstack/react-query");
16045
- var import_frontier37 = require("@raystack/proton/frontier");
16046
- var import_protobuf20 = require("@bufbuild/protobuf");
16073
+ var import_react45 = require("react");
16074
+ var import_connect_query33 = require("@connectrpc/connect-query");
16075
+ var import_react_query14 = require("@tanstack/react-query");
16076
+ var import_frontier38 = require("@raystack/proton/frontier");
16077
+ var import_protobuf21 = require("@bufbuild/protobuf");
16047
16078
  var import_jsx_runtime82 = require("react/jsx-runtime");
16048
16079
  var DeleteDomainDialog = ({
16049
16080
  domain
16050
16081
  }) => {
16051
- const { organization } = (0, import_react43.useContext)(OrganizationContext);
16052
- const [isDialogOpen, setIsDialogOpen] = (0, import_react43.useState)(false);
16053
- const queryClient = (0, import_react_query13.useQueryClient)();
16054
- const transport = (0, import_connect_query32.useTransport)();
16055
- const { mutateAsync: deleteDomain, isPending } = (0, import_connect_query32.useMutation)(
16056
- import_frontier37.FrontierServiceQueries.deleteOrganizationDomain,
16082
+ const { organization } = (0, import_react45.useContext)(OrganizationContext);
16083
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react45.useState)(false);
16084
+ const queryClient = (0, import_react_query14.useQueryClient)();
16085
+ const transport = (0, import_connect_query33.useTransport)();
16086
+ const { mutateAsync: deleteDomain, isPending } = (0, import_connect_query33.useMutation)(
16087
+ import_frontier38.FrontierServiceQueries.deleteOrganizationDomain,
16057
16088
  {
16058
16089
  onSuccess: () => {
16059
16090
  queryClient.invalidateQueries({
16060
- queryKey: (0, import_connect_query32.createConnectQueryKey)({
16061
- schema: import_frontier37.FrontierServiceQueries.listOrganizationDomains,
16091
+ queryKey: (0, import_connect_query33.createConnectQueryKey)({
16092
+ schema: import_frontier38.FrontierServiceQueries.listOrganizationDomains,
16062
16093
  transport,
16063
16094
  input: { orgId: organization?.id || "" },
16064
16095
  cardinality: "finite"
@@ -16079,7 +16110,7 @@ var DeleteDomainDialog = ({
16079
16110
  );
16080
16111
  const handleDelete = async () => {
16081
16112
  await deleteDomain(
16082
- (0, import_protobuf20.create)(import_frontier37.DeleteOrganizationDomainRequestSchema, {
16113
+ (0, import_protobuf21.create)(import_frontier38.DeleteOrganizationDomainRequestSchema, {
16083
16114
  orgId: domain?.orgId || "",
16084
16115
  id: domain?.id || ""
16085
16116
  })
@@ -16195,10 +16226,10 @@ var DomainsList = ({
16195
16226
  };
16196
16227
 
16197
16228
  // admin/views/organizations/details/security/index.tsx
16198
- var import_connect_query33 = require("@connectrpc/connect-query");
16199
- var import_frontier38 = require("@raystack/proton/frontier");
16200
- var import_protobuf21 = require("@bufbuild/protobuf");
16201
- var import_react45 = require("react");
16229
+ var import_connect_query34 = require("@connectrpc/connect-query");
16230
+ var import_frontier39 = require("@raystack/proton/frontier");
16231
+ var import_protobuf22 = require("@bufbuild/protobuf");
16232
+ var import_react47 = require("react");
16202
16233
  var import_jsx_runtime83 = require("react/jsx-runtime");
16203
16234
  var AddDomainSection = () => {
16204
16235
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_apsara74.Flex, { gap: 5, justify: "between", children: [
@@ -16224,10 +16255,10 @@ var AddDomainSection = () => {
16224
16255
  ] });
16225
16256
  };
16226
16257
  var OrganizationSecurity = () => {
16227
- const { organization } = (0, import_react44.useContext)(OrganizationContext);
16228
- const { data: domains, isLoading, error, refetch } = (0, import_connect_query33.useQuery)(
16229
- import_frontier38.FrontierServiceQueries.listOrganizationDomains,
16230
- (0, import_protobuf21.create)(import_frontier38.ListOrganizationDomainsRequestSchema, {
16258
+ const { organization } = (0, import_react46.useContext)(OrganizationContext);
16259
+ const { data: domains, isLoading, error, refetch } = (0, import_connect_query34.useQuery)(
16260
+ import_frontier39.FrontierServiceQueries.listOrganizationDomains,
16261
+ (0, import_protobuf22.create)(import_frontier39.ListOrganizationDomainsRequestSchema, {
16231
16262
  orgId: organization?.id
16232
16263
  }),
16233
16264
  {
@@ -16235,7 +16266,7 @@ var OrganizationSecurity = () => {
16235
16266
  select: (data) => data?.domains || []
16236
16267
  }
16237
16268
  );
16238
- (0, import_react45.useEffect)(() => {
16269
+ (0, import_react47.useEffect)(() => {
16239
16270
  if (error) {
16240
16271
  import_apsara74.toastManager.add({
16241
16272
  title: "Something went wrong",
@@ -16268,8 +16299,8 @@ var OrganizationSecurity = () => {
16268
16299
  // admin/views/organizations/details/members/index.tsx
16269
16300
  var import_apsara81 = require("@raystack/apsara");
16270
16301
 
16271
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-48qxHZqztQJz/sdk/admin/views/organizations/details/members/members.module.css.js
16272
- var digest62 = "809cf33dd58eddf224067e16f6ded470eb84aad301589c2e4a92eff1d414aa05";
16302
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-AXTxs753VG5k/sdk/admin/views/organizations/details/members/members.module.css.js
16303
+ var digest62 = "5a2615cc162d58232a109eb93b5fcd5427f76290e8f178c911187f47b0a1190b";
16273
16304
  var css62 = `._container_1865w_1 {
16274
16305
  width: 100%;
16275
16306
  }
@@ -16387,13 +16418,13 @@ var css62 = `._container_1865w_1 {
16387
16418
  var members_module_css_default = { "container": "_container_1865w_1", "name-column": "_name-column_1865w_5", "nameColumn": "_name-column_1865w_5", "empty-state": "_empty-state_1865w_9", "emptyState": "_empty-state_1865w_9", "empty-state-subheading": "_empty-state-subheading_1865w_13", "emptyStateSubheading": "_empty-state-subheading_1865w_13", "zero-state-container": "_zero-state-container_1865w_18", "zeroStateContainer": "_zero-state-container_1865w_18", "table": "_table_1865w_22", "table-wrapper": "_table-wrapper_1865w_27", "tableWrapper": "_table-wrapper_1865w_27", "table-header": "_table-header_1865w_33", "tableHeader": "_table-header_1865w_33", "table-action-column": "_table-action-column_1865w_38", "tableActionColumn": "_table-action-column_1865w_38", "toolbar": "_toolbar_1865w_43", "invites-dialog-content": "_invites-dialog-content_1865w_52", "invitesDialogContent": "_invites-dialog-content_1865w_52", "invites-dialog-body": "_invites-dialog-body_1865w_59", "invitesDialogBody": "_invites-dialog-body_1865w_59", "invites-table-wrapper": "_invites-table-wrapper_1865w_67", "invitesTableWrapper": "_invites-table-wrapper_1865w_67", "invites-table-scroll": "_invites-table-scroll_1865w_73", "invitesTableScroll": "_invites-table-scroll_1865w_73", "invites-action-column": "_invites-action-column_1865w_79", "invitesActionColumn": "_invites-action-column_1865w_79", "invites-remove-item": "_invites-remove-item_1865w_84", "invitesRemoveItem": "_invites-remove-item_1865w_84", "invites-email-column": "_invites-email-column_1865w_90", "invitesEmailColumn": "_invites-email-column_1865w_90" };
16388
16419
 
16389
16420
  // admin/views/organizations/details/members/index.tsx
16390
- var import_react48 = require("react");
16421
+ var import_react49 = require("react");
16391
16422
 
16392
16423
  // admin/views/organizations/details/members/columns.tsx
16393
16424
  var import_apsara75 = require("@raystack/apsara");
16394
16425
 
16395
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-Ir416WpdDsgc/sdk/admin/views/organizations/details/members/members.module.css.js
16396
- var digest63 = "fd92bf4087021d598b50d24d171049f48ace05ba03b7cb2189ec92ecc7aede14";
16426
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-8A0JYTlKI8RG/sdk/admin/views/organizations/details/members/members.module.css.js
16427
+ var digest63 = "af254d98b9ba072b55101d7c472ee0cf9a4d8c3ce7079a12aea378f213a7dc63";
16397
16428
  var css63 = `._container_1865w_1 {
16398
16429
  width: 100%;
16399
16430
  }
@@ -16694,11 +16725,11 @@ var import_connect_query38 = require("@connectrpc/connect-query");
16694
16725
  var import_react_query16 = require("@tanstack/react-query");
16695
16726
 
16696
16727
  // admin/views/organizations/details/members/update-role.tsx
16697
- var import_frontier39 = require("@raystack/proton/frontier");
16698
- var import_protobuf22 = require("@bufbuild/protobuf");
16699
- var import_connect_query34 = require("@connectrpc/connect-query");
16728
+ var import_frontier40 = require("@raystack/proton/frontier");
16729
+ var import_protobuf23 = require("@bufbuild/protobuf");
16730
+ var import_connect_query35 = require("@connectrpc/connect-query");
16700
16731
  var import_apsara76 = require("@raystack/apsara");
16701
- var import_connect4 = require("@connectrpc/connect");
16732
+ var import_connect5 = require("@connectrpc/connect");
16702
16733
  var import_jsx_runtime86 = require("react/jsx-runtime");
16703
16734
  var UpdateRole = ({
16704
16735
  handle,
@@ -16724,13 +16755,13 @@ function UpdateRoleContent({
16724
16755
  onClose,
16725
16756
  onRoleUpdate
16726
16757
  }) {
16727
- const { mutateAsync: setMemberRole, isPending } = (0, import_connect_query34.useMutation)(
16728
- import_frontier39.FrontierServiceQueries.setOrganizationMemberRole
16758
+ const { mutateAsync: setMemberRole, isPending } = (0, import_connect_query35.useMutation)(
16759
+ import_frontier40.FrontierServiceQueries.setOrganizationMemberRole
16729
16760
  );
16730
16761
  async function onSubmit() {
16731
16762
  try {
16732
16763
  await setMemberRole(
16733
- (0, import_protobuf22.create)(import_frontier39.SetOrganizationMemberRoleRequestSchema, {
16764
+ (0, import_protobuf23.create)(import_frontier40.SetOrganizationMemberRoleRequestSchema, {
16734
16765
  orgId: organizationId,
16735
16766
  userId: payload.user.id,
16736
16767
  roleId: payload.role.id
@@ -16745,7 +16776,7 @@ function UpdateRoleContent({
16745
16776
  } catch (error) {
16746
16777
  import_apsara76.toastManager.add({
16747
16778
  title: "Failed to assign role",
16748
- description: error instanceof import_connect4.ConnectError ? error.message : void 0,
16779
+ description: error instanceof import_connect5.ConnectError ? error.message : void 0,
16749
16780
  type: "error"
16750
16781
  });
16751
16782
  console.error(error);
@@ -16783,9 +16814,9 @@ function UpdateRoleContent({
16783
16814
  }
16784
16815
 
16785
16816
  // admin/views/organizations/details/members/remove-member.tsx
16786
- var import_frontier40 = require("@raystack/proton/frontier");
16787
- var import_protobuf23 = require("@bufbuild/protobuf");
16788
- var import_connect_query35 = require("@connectrpc/connect-query");
16817
+ var import_frontier41 = require("@raystack/proton/frontier");
16818
+ var import_protobuf24 = require("@bufbuild/protobuf");
16819
+ var import_connect_query36 = require("@connectrpc/connect-query");
16789
16820
  var import_apsara77 = require("@raystack/apsara");
16790
16821
  var import_jsx_runtime87 = require("react/jsx-runtime");
16791
16822
  var RemoveMember = ({
@@ -16795,15 +16826,15 @@ var RemoveMember = ({
16795
16826
  onClose
16796
16827
  }) => {
16797
16828
  const t = useTerminology();
16798
- const { mutateAsync: removeOrganizationMember, isPending } = (0, import_connect_query35.useMutation)(
16799
- import_frontier40.FrontierServiceQueries.removeOrganizationMember
16829
+ const { mutateAsync: removeOrganizationMember, isPending } = (0, import_connect_query36.useMutation)(
16830
+ import_frontier41.FrontierServiceQueries.removeOrganizationMember
16800
16831
  );
16801
16832
  async function onSubmit() {
16802
16833
  try {
16803
16834
  if (!user)
16804
16835
  return;
16805
16836
  await removeOrganizationMember(
16806
- (0, import_protobuf23.create)(import_frontier40.RemoveOrganizationMemberRequestSchema, {
16837
+ (0, import_protobuf24.create)(import_frontier41.RemoveOrganizationMemberRequestSchema, {
16807
16838
  orgId: organizationId,
16808
16839
  principalId: user?.id || "",
16809
16840
  principalType: "app/user"
@@ -16880,33 +16911,15 @@ var RemoveMember = ({
16880
16911
  ] }) });
16881
16912
  };
16882
16913
 
16883
- // hooks/index.ts
16884
- var import_connect_query36 = require("@connectrpc/connect-query");
16885
- var import_connect5 = require("@connectrpc/connect");
16886
- var import_frontier41 = require("@raystack/proton/frontier");
16887
- var import_react_query14 = require("@tanstack/react-query");
16888
- var import_protobuf24 = require("@bufbuild/protobuf");
16889
-
16890
- // hooks/useDebouncedValue.ts
16891
- var import_react46 = require("react");
16892
- function useDebouncedValue(value, delay) {
16893
- const [debouncedValue, setDebouncedValue] = (0, import_react46.useState)(value);
16894
- (0, import_react46.useEffect)(() => {
16895
- const timer = setTimeout(() => setDebouncedValue(value), delay);
16896
- return () => clearTimeout(timer);
16897
- }, [value, delay]);
16898
- return debouncedValue;
16899
- }
16900
-
16901
16914
  // admin/views/organizations/details/members/invited-members-dialog.tsx
16902
- var import_react47 = require("react");
16915
+ var import_react48 = require("react");
16903
16916
  var import_apsara80 = require("@raystack/apsara");
16904
16917
 
16905
16918
  // admin/views/organizations/details/members/invited-members-columns.tsx
16906
16919
  var import_apsara78 = require("@raystack/apsara");
16907
16920
 
16908
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-YWyLy1Dqa3C1/sdk/admin/views/organizations/details/members/members.module.css.js
16909
- var digest64 = "2fc97f550c4e2a0d012e8922af379af05aa8d7b9e3513ea562b7e44cabc2f724";
16921
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-Lz7ERDMEhfbP/sdk/admin/views/organizations/details/members/members.module.css.js
16922
+ var digest64 = "2f206bf5ec5cd3800c7f8f9c756ec76ee7219ee781e8cccf773d24692db6525f";
16910
16923
  var css64 = `._container_1865w_1 {
16911
16924
  width: 100%;
16912
16925
  }
@@ -17228,8 +17241,8 @@ function RemoveInviteContent({
17228
17241
  ] });
17229
17242
  }
17230
17243
 
17231
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-WHUZMZIaiiSP/sdk/admin/views/organizations/details/members/members.module.css.js
17232
- var digest65 = "ba76310ad2856c90a1f95dc1c08d4139e4d39dee543e6601f619c818ffc4f171";
17244
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-65wddRrfXj9o/sdk/admin/views/organizations/details/members/members.module.css.js
17245
+ var digest65 = "3c19f3a1ca25e80e1bd125fe9e32491690572e26866d682f46c4ed11bed71514";
17233
17246
  var css65 = `._container_1865w_1 {
17234
17247
  width: 100%;
17235
17248
  }
@@ -17369,9 +17382,9 @@ var InvitedMembersDialog = ({
17369
17382
  onClose
17370
17383
  }) => {
17371
17384
  const t = useTerminology();
17372
- const [isInviteDialogOpen, setIsInviteDialogOpen] = (0, import_react47.useState)(false);
17385
+ const [isInviteDialogOpen, setIsInviteDialogOpen] = (0, import_react48.useState)(false);
17373
17386
  const { titleById } = useOrganizationRoles(organizationId);
17374
- const columns = (0, import_react47.useMemo)(
17387
+ const columns = (0, import_react48.useMemo)(
17375
17388
  () => getInvitedMembersColumns({
17376
17389
  roleTitleById: titleById,
17377
17390
  removeInviteHandle
@@ -17456,10 +17469,6 @@ var import_jsx_runtime91 = require("react/jsx-runtime");
17456
17469
  var updateRoleDialogHandle = import_apsara81.AlertDialog.createHandle();
17457
17470
  var NO_INVITATIONS = [];
17458
17471
  var DEFAULT_SORT6 = { name: "orgJoinedAt", order: "desc" };
17459
- var INITIAL_QUERY5 = {
17460
- offset: 0,
17461
- limit: DEFAULT_PAGE_SIZE
17462
- };
17463
17472
  var TRANSFORM_OPTIONS2 = {
17464
17473
  fieldNameMapping: {
17465
17474
  orgJoinedAt: "org_joined_at",
@@ -17512,7 +17521,7 @@ var ErrorState = () => {
17512
17521
  };
17513
17522
  function OrganizationMembersView() {
17514
17523
  const t = useTerminology();
17515
- const { roles = [], organization, search } = (0, import_react48.useContext)(OrganizationContext);
17524
+ const { roles = [], organization, search } = (0, import_react49.useContext)(OrganizationContext);
17516
17525
  const {
17517
17526
  onChange: onSearchChange,
17518
17527
  setVisibility: setSearchVisibility,
@@ -17521,8 +17530,8 @@ function OrganizationMembersView() {
17521
17530
  const queryClient = (0, import_react_query16.useQueryClient)();
17522
17531
  const transport = (0, import_connect_query38.useTransport)();
17523
17532
  const organizationId = organization?.id || "";
17524
- const [removeMemberConfig, setRemoveMemberConfig] = (0, import_react48.useState)({ isOpen: false, user: null });
17525
- const [isInvitesDialogOpen, setIsInvitesDialogOpen] = (0, import_react48.useState)(false);
17533
+ const [removeMemberConfig, setRemoveMemberConfig] = (0, import_react49.useState)({ isOpen: false, user: null });
17534
+ const [isInvitesDialogOpen, setIsInvitesDialogOpen] = (0, import_react49.useState)(false);
17526
17535
  const {
17527
17536
  data: invitations = NO_INVITATIONS,
17528
17537
  isLoading: isInvitationsLoading,
@@ -17538,15 +17547,15 @@ function OrganizationMembersView() {
17538
17547
  }
17539
17548
  );
17540
17549
  const title = `${t.member({ plural: true, case: "capital" })} | ${organization?.title} | ${t.organization({ plural: true, case: "capital" })}`;
17541
- const [tableQuery, setTableQuery] = (0, import_react48.useState)(INITIAL_QUERY5);
17542
- const computedQuery = (0, import_react48.useMemo)(() => {
17543
- const tempQuery = transformDataTableQueryToRQLRequest(tableQuery, TRANSFORM_OPTIONS2);
17544
- return {
17545
- ...tempQuery,
17546
- search: searchQuery || ""
17547
- };
17548
- }, [tableQuery, searchQuery]);
17549
- const query = useDebouncedValue(computedQuery, 200);
17550
+ const {
17551
+ tableQuery,
17552
+ rqlQuery: query,
17553
+ onTableQueryChange
17554
+ } = useServerTableQuery({
17555
+ defaultSort: DEFAULT_SORT6,
17556
+ transformOptions: TRANSFORM_OPTIONS2,
17557
+ search: searchQuery || ""
17558
+ });
17550
17559
  const {
17551
17560
  data: infiniteData,
17552
17561
  isLoading,
@@ -17576,15 +17585,14 @@ function OrganizationMembersView() {
17576
17585
  const showZeroState = !isLoading && !isError && !hasActiveQuery && data.length === 0;
17577
17586
  const showToolbar = data.length > 0 || Boolean(tableQuery.filters?.length);
17578
17587
  const showInvitesBtn = invitations.length > 0;
17579
- const onTableQueryChange = (newQuery) => {
17580
- setTableQuery(newQuery);
17581
- };
17582
- const fetchMore = async () => {
17583
- if (hasNextPage && !isFetchingNextPage && !isError) {
17584
- await fetchNextPage();
17585
- }
17586
- };
17587
- (0, import_react48.useEffect)(() => {
17588
+ const fetchMore = useLoadMore({
17589
+ hasNextPage,
17590
+ isFetchingNextPage,
17591
+ isError,
17592
+ fetchNextPage,
17593
+ label: "members"
17594
+ });
17595
+ (0, import_react49.useEffect)(() => {
17588
17596
  if (invitationsError) {
17589
17597
  console.error(
17590
17598
  "Failed to fetch organization invitations:",
@@ -17592,7 +17600,7 @@ function OrganizationMembersView() {
17592
17600
  );
17593
17601
  }
17594
17602
  }, [invitationsError]);
17595
- (0, import_react48.useEffect)(() => {
17603
+ (0, import_react49.useEffect)(() => {
17596
17604
  setSearchVisibility(true);
17597
17605
  return () => {
17598
17606
  onSearchChange("");
@@ -17612,14 +17620,26 @@ function OrganizationMembersView() {
17612
17620
  handleRemoveMemberAction: openRemoveMemberDialog
17613
17621
  });
17614
17622
  async function invalidateMembersQuery() {
17615
- await queryClient.invalidateQueries({
17616
- queryKey: (0, import_connect_query38.createConnectQueryKey)({
17617
- schema: import_frontier43.AdminServiceQueries.searchOrganizationUsers,
17618
- transport,
17619
- input: {},
17620
- cardinality: "infinite"
17623
+ if (!organizationId)
17624
+ return;
17625
+ await Promise.all([
17626
+ queryClient.invalidateQueries({
17627
+ queryKey: (0, import_connect_query38.createConnectQueryKey)({
17628
+ schema: import_frontier43.AdminServiceQueries.searchOrganizationUsers,
17629
+ transport,
17630
+ input: { id: organizationId },
17631
+ cardinality: "infinite"
17632
+ })
17633
+ }),
17634
+ queryClient.invalidateQueries({
17635
+ queryKey: (0, import_connect_query38.createConnectQueryKey)({
17636
+ schema: import_frontier43.FrontierServiceQueries.listOrganizationUsers,
17637
+ transport,
17638
+ input: { id: organizationId },
17639
+ cardinality: "finite"
17640
+ })
17621
17641
  })
17622
- });
17642
+ ]);
17623
17643
  }
17624
17644
  async function updateMember() {
17625
17645
  await invalidateMembersQuery();
@@ -17716,8 +17736,8 @@ function OrganizationMembersView() {
17716
17736
  // admin/views/organizations/details/projects/index.tsx
17717
17737
  var import_apsara90 = require("@raystack/apsara");
17718
17738
 
17719
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-KG8ec3cmh9Gm/sdk/admin/views/organizations/details/projects/projects.module.css.js
17720
- var digest66 = "e5d5601765a320346b79e14f2dc0ff5e5518c35d3e01303474bf80fd1da6a0a3";
17739
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-FklCw9kdFW8M/sdk/admin/views/organizations/details/projects/projects.module.css.js
17740
+ var digest66 = "9e179573661998fc838740174588617f043240ab7b0cad4c3468301dd1f11bfc";
17721
17741
  var css66 = `._container_1ky10_1 {
17722
17742
  width: 100%;
17723
17743
  }
@@ -17793,13 +17813,13 @@ var css66 = `._container_1ky10_1 {
17793
17813
  var projects_module_css_default = { "container": "_container_1ky10_1", "title-column": "_title-column_1ky10_5", "titleColumn": "_title-column_1ky10_5", "empty-state": "_empty-state_1ky10_9", "emptyState": "_empty-state_1ky10_9", "empty-state-subheading": "_empty-state-subheading_1ky10_13", "emptyStateSubheading": "_empty-state-subheading_1ky10_13", "zero-state-container": "_zero-state-container_1ky10_18", "zeroStateContainer": "_zero-state-container_1ky10_18", "table": "_table_1ky10_22", "table-wrapper": "_table-wrapper_1ky10_27", "tableWrapper": "_table-wrapper_1ky10_27", "table-header": "_table-header_1ky10_33", "tableHeader": "_table-header_1ky10_33", "table-action-column": "_table-action-column_1ky10_38", "tableActionColumn": "_table-action-column_1ky10_38", "flex1": "_flex1_1ky10_58" };
17794
17814
 
17795
17815
  // admin/views/organizations/details/projects/index.tsx
17796
- var import_react53 = require("react");
17816
+ var import_react54 = require("react");
17797
17817
 
17798
17818
  // admin/views/organizations/details/projects/columns.tsx
17799
17819
  var import_apsara84 = require("@raystack/apsara");
17800
17820
 
17801
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-4oJ3F0Vxlw4Q/sdk/admin/views/organizations/details/projects/projects.module.css.js
17802
- var digest67 = "2a653e732282c17b8395842a6edb9966a6f6dcef64fffb5561354640a46a0196";
17821
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-pGRMBDtFeQMw/sdk/admin/views/organizations/details/projects/projects.module.css.js
17822
+ var digest67 = "9d2e97d0ed25d97ab3a447b451bbf5f67eea99ebe09cee821dade5d6b2a8ba87";
17803
17823
  var css67 = `._container_1ky10_1 {
17804
17824
  width: 100%;
17805
17825
  }
@@ -18003,28 +18023,51 @@ function RenameProjectDialog({
18003
18023
  }
18004
18024
 
18005
18025
  // admin/views/organizations/details/projects/columns.tsx
18006
- var import_react50 = require("react");
18026
+ var import_react51 = require("react");
18007
18027
 
18008
18028
  // admin/views/organizations/details/projects/use-add-project-members.tsx
18009
- var import_react49 = require("react");
18029
+ var import_react50 = require("react");
18010
18030
  var import_apsara83 = require("@raystack/apsara");
18031
+ var import_connect_query41 = require("@connectrpc/connect-query");
18032
+ var import_frontier46 = require("@raystack/proton/frontier");
18033
+ var import_protobuf28 = require("@bufbuild/protobuf");
18034
+
18035
+ // admin/hooks/useOrgMembersMap.ts
18011
18036
  var import_connect_query40 = require("@connectrpc/connect-query");
18012
18037
  var import_frontier45 = require("@raystack/proton/frontier");
18013
- var import_protobuf28 = require("@bufbuild/protobuf");
18038
+ var toMembersMap = (data) => (data?.users || []).reduce(
18039
+ (acc, user) => {
18040
+ acc[user.id || ""] = user;
18041
+ return acc;
18042
+ },
18043
+ {}
18044
+ );
18045
+ var useOrgMembersMap = (orgId) => (0, import_connect_query40.useQuery)(
18046
+ import_frontier45.FrontierServiceQueries.listOrganizationUsers,
18047
+ { id: orgId || "" },
18048
+ {
18049
+ enabled: !!orgId,
18050
+ staleTime: SHARED_QUERY_STALE_TIME,
18051
+ select: toMembersMap
18052
+ }
18053
+ );
18054
+
18055
+ // admin/views/organizations/details/projects/use-add-project-members.tsx
18014
18056
  function useAddProjectMembers({ projectId }) {
18015
18057
  const t = useTerminology();
18016
18058
  const memberLabel = t.member({ case: "capital" });
18017
- const { orgMembersMap } = (0, import_react49.useContext)(OrganizationContext);
18018
- const [searchQuery, setSearchQuery] = (0, import_react49.useState)("");
18019
- const { data: projectMembers, isLoading, refetch } = (0, import_connect_query40.useQuery)(
18020
- import_frontier45.FrontierServiceQueries.listProjectUsers,
18021
- (0, import_protobuf28.create)(import_frontier45.ListProjectUsersRequestSchema, { id: projectId }),
18059
+ const { organization } = (0, import_react50.useContext)(OrganizationContext);
18060
+ const { data: orgMembersMap = {} } = useOrgMembersMap(organization?.id);
18061
+ const [searchQuery, setSearchQuery] = (0, import_react50.useState)("");
18062
+ const { data: projectMembers, isLoading, refetch } = (0, import_connect_query41.useQuery)(
18063
+ import_frontier46.FrontierServiceQueries.listProjectUsers,
18064
+ (0, import_protobuf28.create)(import_frontier46.ListProjectUsersRequestSchema, { id: projectId }),
18022
18065
  {
18023
18066
  enabled: !!projectId,
18024
18067
  select: (data) => data?.users || []
18025
18068
  }
18026
18069
  );
18027
- const nonMembers = (0, import_react49.useMemo)(() => {
18070
+ const nonMembers = (0, import_react50.useMemo)(() => {
18028
18071
  if (!projectMembers)
18029
18072
  return [];
18030
18073
  const memberSet = new Set(projectMembers.map((member) => member.id));
@@ -18034,34 +18077,34 @@ function useAddProjectMembers({ projectId }) {
18034
18077
  return aName < bName ? -1 : 1;
18035
18078
  });
18036
18079
  }, [projectMembers, orgMembersMap]);
18037
- const eligibleMembers = (0, import_react49.useMemo)(() => {
18080
+ const eligibleMembers = (0, import_react50.useMemo)(() => {
18038
18081
  return searchQuery ? nonMembers.filter((member) => {
18039
18082
  const name = member.title || member.email || "";
18040
18083
  return name.toLowerCase().includes(searchQuery.toLowerCase());
18041
18084
  }) : nonMembers;
18042
18085
  }, [nonMembers, searchQuery]);
18043
- const { data: rolesData } = (0, import_connect_query40.useQuery)(
18044
- import_frontier45.FrontierServiceQueries.listRoles,
18045
- (0, import_protobuf28.create)(import_frontier45.ListRolesRequestSchema, {
18086
+ const { data: rolesData } = (0, import_connect_query41.useQuery)(
18087
+ import_frontier46.FrontierServiceQueries.listRoles,
18088
+ (0, import_protobuf28.create)(import_frontier46.ListRolesRequestSchema, {
18046
18089
  state: "enabled",
18047
18090
  scopes: [SCOPES.PROJECT]
18048
18091
  }),
18049
18092
  { enabled: !!projectId }
18050
18093
  );
18051
- const viewerRoleId = (0, import_react49.useMemo)(
18094
+ const viewerRoleId = (0, import_react50.useMemo)(
18052
18095
  () => rolesData?.roles?.find((r) => r.name === DEFAULT_ROLES.PROJECT_VIEWER)?.id ?? "",
18053
18096
  [rolesData]
18054
18097
  );
18055
- const { mutateAsync: setProjectMemberRole } = (0, import_connect_query40.useMutation)(
18056
- import_frontier45.FrontierServiceQueries.setProjectMemberRole
18098
+ const { mutateAsync: setProjectMemberRole } = (0, import_connect_query41.useMutation)(
18099
+ import_frontier46.FrontierServiceQueries.setProjectMemberRole
18057
18100
  );
18058
- const addMember = (0, import_react49.useCallback)(
18101
+ const addMember = (0, import_react50.useCallback)(
18059
18102
  async (userId) => {
18060
18103
  if (!userId || !projectId || !viewerRoleId)
18061
18104
  return;
18062
18105
  try {
18063
18106
  await setProjectMemberRole(
18064
- (0, import_protobuf28.create)(import_frontier45.SetProjectMemberRoleRequestSchema, {
18107
+ (0, import_protobuf28.create)(import_frontier46.SetProjectMemberRoleRequestSchema, {
18065
18108
  projectId,
18066
18109
  principalId: userId,
18067
18110
  principalType: SCOPES.USER,
@@ -18194,8 +18237,8 @@ function ProjectActions({
18194
18237
  handleProjectUpdate,
18195
18238
  canAddMember
18196
18239
  }) {
18197
- const [open, setOpen] = (0, import_react50.useState)(false);
18198
- const [isRenameDialogOpen, setIsRenameDialogOpen] = (0, import_react50.useState)(false);
18240
+ const [open, setOpen] = (0, import_react51.useState)(false);
18241
+ const [isRenameDialogOpen, setIsRenameDialogOpen] = (0, import_react51.useState)(false);
18199
18242
  const preventClickBubbling = (e) => {
18200
18243
  e.stopPropagation();
18201
18244
  };
@@ -18326,8 +18369,8 @@ var getColumns13 = ({
18326
18369
  };
18327
18370
 
18328
18371
  // admin/views/organizations/details/projects/index.tsx
18329
- var import_frontier49 = require("@raystack/proton/frontier");
18330
- var import_connect_query44 = require("@connectrpc/connect-query");
18372
+ var import_frontier50 = require("@raystack/proton/frontier");
18373
+ var import_connect_query45 = require("@connectrpc/connect-query");
18331
18374
 
18332
18375
  // admin/assets/icons/ProjectsIcon.tsx
18333
18376
  var import_jsx_runtime94 = require("react/jsx-runtime");
@@ -18365,14 +18408,13 @@ function ProjectsIcon(props) {
18365
18408
 
18366
18409
  // admin/views/organizations/details/projects/members/index.tsx
18367
18410
  var import_apsara89 = require("@raystack/apsara");
18368
- var import_react52 = require("react");
18369
- var import_frontier48 = require("@raystack/proton/frontier");
18411
+ var import_react53 = require("react");
18412
+ var import_frontier49 = require("@raystack/proton/frontier");
18370
18413
  var import_protobuf31 = require("@bufbuild/protobuf");
18371
- var import_connect_query43 = require("@connectrpc/connect-query");
18372
- var import_hooks5 = require("@raystack/apsara/hooks");
18414
+ var import_connect_query44 = require("@connectrpc/connect-query");
18373
18415
 
18374
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-AmE02zvhRU7w/sdk/admin/views/organizations/details/projects/members/members.module.css.js
18375
- var digest68 = "126b7ba1cba1f7f184debd5fae0942505b72409bd74ca9a7da0dc28f93292ea8";
18416
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-Nl1Xc0DDSjzP/sdk/admin/views/organizations/details/projects/members/members.module.css.js
18417
+ var digest68 = "88a28ea5dd888055c318a23c30de35c15a59085a8514392243f6bc550edbe7a3";
18376
18418
  var css68 = `._flex1_c0wok_1 {
18377
18419
  flex: 1;
18378
18420
  }
@@ -18480,8 +18522,8 @@ var css68 = `._flex1_c0wok_1 {
18480
18522
  })();
18481
18523
  var members_module_css_default5 = { "flex1": "_flex1_c0wok_1", "dialog-content": "_dialog-content_c0wok_5", "dialogContent": "_dialog-content_c0wok_5", "dialog-body": "_dialog-body_c0wok_10", "dialogBody": "_dialog-body_c0wok_10", "empty-state": "_empty-state_c0wok_14", "emptyState": "_empty-state_c0wok_14", "empty-state-subheading": "_empty-state-subheading_c0wok_18", "emptyStateSubheading": "_empty-state-subheading_c0wok_18", "table": "_table_c0wok_23", "table-wrapper": "_table-wrapper_c0wok_28", "tableWrapper": "_table-wrapper_c0wok_28", "table-header": "_table-header_c0wok_34", "tableHeader": "_table-header_c0wok_34", "table-search": "_table-search_c0wok_39", "tableSearch": "_table-search_c0wok_39", "table-content-wrapper": "_table-content-wrapper_c0wok_43", "tableContentWrapper": "_table-content-wrapper_c0wok_43", "table-action-column": "_table-action-column_c0wok_52", "tableActionColumn": "_table-action-column_c0wok_52", "table-action-dropdown": "_table-action-dropdown_c0wok_71", "tableActionDropdown": "_table-action-dropdown_c0wok_71", "action-dialog-content": "_action-dialog-content_c0wok_76", "actionDialogContent": "_action-dialog-content_c0wok_76", "add-member-dropdown": "_add-member-dropdown_c0wok_80", "addMemberDropdown": "_add-member-dropdown_c0wok_80", "add-member-dropdown-member": "_add-member-dropdown-member_c0wok_85", "addMemberDropdownMember": "_add-member-dropdown-member_c0wok_85", "add-member-dropdown-member-name": "_add-member-dropdown-member-name_c0wok_89", "addMemberDropdownMemberName": "_add-member-dropdown-member-name_c0wok_89" };
18482
18524
 
18483
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-1Eg4C6W5my7B/sdk/admin/views/organizations/details/projects/members/members.module.css.js
18484
- var digest69 = "ad59af0813f11ef2695f5a83c3ce2be1bd09cc5b42cfc0b559caa6b505f28fd2";
18525
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-Mzn0DHg7JeO3/sdk/admin/views/organizations/details/projects/members/members.module.css.js
18526
+ var digest69 = "4999f4fba3026c27a802e043011850ffc1ab6e0a6f8ea9b1c10546a2ff13b47e";
18485
18527
  var css69 = `._flex1_c0wok_1 {
18486
18528
  flex: 1;
18487
18529
  }
@@ -18723,8 +18765,8 @@ var getColumns14 = ({
18723
18765
  ];
18724
18766
  };
18725
18767
 
18726
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-LKGJNBUPUYF9/sdk/admin/views/organizations/details/projects/members/members.module.css.js
18727
- var digest70 = "2832cff330138e5c0ce6d3ea071a114407e8bcf4653ba20d466a48888d4cc0ea";
18768
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-CTsmnbJvZRPb/sdk/admin/views/organizations/details/projects/members/members.module.css.js
18769
+ var digest70 = "c9d99de8dcafb27d7521e0c8916308fd502e0c6447d5df40f5904533bffe5b3b";
18728
18770
  var css70 = `._flex1_c0wok_1 {
18729
18771
  flex: 1;
18730
18772
  }
@@ -18833,10 +18875,10 @@ var css70 = `._flex1_c0wok_1 {
18833
18875
  var members_module_css_default7 = { "flex1": "_flex1_c0wok_1", "dialog-content": "_dialog-content_c0wok_5", "dialogContent": "_dialog-content_c0wok_5", "dialog-body": "_dialog-body_c0wok_10", "dialogBody": "_dialog-body_c0wok_10", "empty-state": "_empty-state_c0wok_14", "emptyState": "_empty-state_c0wok_14", "empty-state-subheading": "_empty-state-subheading_c0wok_18", "emptyStateSubheading": "_empty-state-subheading_c0wok_18", "table": "_table_c0wok_23", "table-wrapper": "_table-wrapper_c0wok_28", "tableWrapper": "_table-wrapper_c0wok_28", "table-header": "_table-header_c0wok_34", "tableHeader": "_table-header_c0wok_34", "table-search": "_table-search_c0wok_39", "tableSearch": "_table-search_c0wok_39", "table-content-wrapper": "_table-content-wrapper_c0wok_43", "tableContentWrapper": "_table-content-wrapper_c0wok_43", "table-action-column": "_table-action-column_c0wok_52", "tableActionColumn": "_table-action-column_c0wok_52", "table-action-dropdown": "_table-action-dropdown_c0wok_71", "tableActionDropdown": "_table-action-dropdown_c0wok_71", "action-dialog-content": "_action-dialog-content_c0wok_76", "actionDialogContent": "_action-dialog-content_c0wok_76", "add-member-dropdown": "_add-member-dropdown_c0wok_80", "addMemberDropdown": "_add-member-dropdown_c0wok_80", "add-member-dropdown-member": "_add-member-dropdown-member_c0wok_85", "addMemberDropdownMember": "_add-member-dropdown-member_c0wok_85", "add-member-dropdown-member-name": "_add-member-dropdown-member-name_c0wok_89", "addMemberDropdownMemberName": "_add-member-dropdown-member-name_c0wok_89" };
18834
18876
 
18835
18877
  // admin/views/organizations/details/projects/members/update-role.tsx
18836
- var import_frontier46 = require("@raystack/proton/frontier");
18878
+ var import_frontier47 = require("@raystack/proton/frontier");
18837
18879
  var import_protobuf29 = require("@bufbuild/protobuf");
18838
18880
  var import_connect6 = require("@connectrpc/connect");
18839
- var import_connect_query41 = require("@connectrpc/connect-query");
18881
+ var import_connect_query42 = require("@connectrpc/connect-query");
18840
18882
  var import_apsara86 = require("@raystack/apsara");
18841
18883
  var import_jsx_runtime96 = require("react/jsx-runtime");
18842
18884
  var UpdateRole2 = ({
@@ -18863,13 +18905,13 @@ function UpdateRoleContent2({
18863
18905
  onClose,
18864
18906
  onRoleUpdate
18865
18907
  }) {
18866
- const { mutateAsync: setProjectMemberRole, isPending } = (0, import_connect_query41.useMutation)(
18867
- import_frontier46.FrontierServiceQueries.setProjectMemberRole
18908
+ const { mutateAsync: setProjectMemberRole, isPending } = (0, import_connect_query42.useMutation)(
18909
+ import_frontier47.FrontierServiceQueries.setProjectMemberRole
18868
18910
  );
18869
18911
  async function onSubmit() {
18870
18912
  try {
18871
18913
  await setProjectMemberRole(
18872
- (0, import_protobuf29.create)(import_frontier46.SetProjectMemberRoleRequestSchema, {
18914
+ (0, import_protobuf29.create)(import_frontier47.SetProjectMemberRoleRequestSchema, {
18873
18915
  projectId,
18874
18916
  principalId: payload.user.id || "",
18875
18917
  principalType: SCOPES.USER,
@@ -18930,13 +18972,13 @@ function UpdateRoleContent2({
18930
18972
  }
18931
18973
 
18932
18974
  // admin/views/organizations/details/projects/members/remove-member.tsx
18933
- var import_react51 = require("react");
18934
- var import_frontier47 = require("@raystack/proton/frontier");
18975
+ var import_react52 = require("react");
18976
+ var import_frontier48 = require("@raystack/proton/frontier");
18935
18977
  var import_protobuf30 = require("@bufbuild/protobuf");
18936
- var import_connect_query42 = require("@connectrpc/connect-query");
18978
+ var import_connect_query43 = require("@connectrpc/connect-query");
18937
18979
 
18938
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-kNZeLZjFmPnu/sdk/admin/views/organizations/details/projects/members/members.module.css.js
18939
- var digest71 = "e2c820b1155b7e60cb660022fa72c10d16444d43a580b9edca8e4a4bf6e8d888";
18980
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-f2WV8PjxXlUn/sdk/admin/views/organizations/details/projects/members/members.module.css.js
18981
+ var digest71 = "37b723666986deaa6bd249270732ecd6b142dd7ee1c76e423cd76cfe6d9270e6";
18940
18982
  var css71 = `._flex1_c0wok_1 {
18941
18983
  flex: 1;
18942
18984
  }
@@ -19054,9 +19096,9 @@ var RemoveMember2 = ({
19054
19096
  onClose
19055
19097
  }) => {
19056
19098
  const t = useTerminology();
19057
- const [isSubmitting, setIsSubmitting] = (0, import_react51.useState)(false);
19058
- const { mutateAsync: removeProjectMember } = (0, import_connect_query42.useMutation)(
19059
- import_frontier47.FrontierServiceQueries.removeProjectMember
19099
+ const [isSubmitting, setIsSubmitting] = (0, import_react52.useState)(false);
19100
+ const { mutateAsync: removeProjectMember } = (0, import_connect_query43.useMutation)(
19101
+ import_frontier48.FrontierServiceQueries.removeProjectMember
19060
19102
  );
19061
19103
  async function onSubmit() {
19062
19104
  try {
@@ -19064,7 +19106,7 @@ var RemoveMember2 = ({
19064
19106
  return;
19065
19107
  setIsSubmitting(true);
19066
19108
  await removeProjectMember(
19067
- (0, import_protobuf30.create)(import_frontier47.RemoveProjectMemberRequestSchema, {
19109
+ (0, import_protobuf30.create)(import_frontier48.RemoveProjectMemberRequestSchema, {
19068
19110
  projectId,
19069
19111
  principalId: user.id,
19070
19112
  principalType: "app/user"
@@ -19154,8 +19196,8 @@ var RemoveMember2 = ({
19154
19196
  // admin/views/organizations/details/projects/members/add-members-dropdown.tsx
19155
19197
  var import_apsara88 = require("@raystack/apsara");
19156
19198
 
19157
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-qz2Uhk5LS7ck/sdk/admin/views/organizations/details/projects/members/members.module.css.js
19158
- var digest72 = "d616775be108eb615bf1df362565ead3ce42ce98eb6adc2e3c858ba163528319";
19199
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-94qQqFX4GFWU/sdk/admin/views/organizations/details/projects/members/members.module.css.js
19200
+ var digest72 = "68ff8afdbb8091446aafc68319cabbaec444815f1225b34d35d284c2aec96ce3";
19159
19201
  var css72 = `._flex1_c0wok_1 {
19160
19202
  flex: 1;
19161
19203
  }
@@ -19345,35 +19387,32 @@ var NoMembers2 = () => {
19345
19387
  }
19346
19388
  );
19347
19389
  };
19348
- var INITIAL_QUERY6 = {
19349
- offset: 0,
19350
- limit: DEFAULT_PAGE_SIZE
19351
- };
19352
19390
  var updateRoleDialogHandle2 = import_apsara89.AlertDialog.createHandle();
19353
19391
  var ProjectMembersDialog = ({
19354
19392
  projectId,
19355
19393
  onClose,
19356
19394
  canAddMember
19357
19395
  }) => {
19358
- const [tableQuery, setTableQuery] = (0, import_hooks5.useDebouncedState)(
19359
- {
19360
- query: INITIAL_QUERY6,
19361
- rqlRequest: transformDataTableQueryToRQLRequest(INITIAL_QUERY6, {})
19362
- },
19363
- 200
19364
- );
19365
- const [removeMemberConfig, setRemoveMemberConfig] = (0, import_react52.useState)({ isOpen: false, user: null });
19366
- const { data: project, isLoading: isProjectLoading, error: projectError } = (0, import_connect_query43.useQuery)(
19367
- import_frontier48.FrontierServiceQueries.getProject,
19368
- (0, import_protobuf31.create)(import_frontier48.GetProjectRequestSchema, { id: projectId }),
19396
+ const {
19397
+ tableQuery,
19398
+ rqlQuery,
19399
+ onTableQueryChange
19400
+ } = useServerTableQuery({
19401
+ // This endpoint ignores sort, so keep it out of the request.
19402
+ mapQuery: (query) => ({ ...query, sort: void 0 })
19403
+ });
19404
+ const [removeMemberConfig, setRemoveMemberConfig] = (0, import_react53.useState)({ isOpen: false, user: null });
19405
+ const { data: project, isLoading: isProjectLoading, error: projectError } = (0, import_connect_query44.useQuery)(
19406
+ import_frontier49.FrontierServiceQueries.getProject,
19407
+ (0, import_protobuf31.create)(import_frontier49.GetProjectRequestSchema, { id: projectId }),
19369
19408
  {
19370
19409
  enabled: !!projectId,
19371
19410
  select: (data2) => data2?.project
19372
19411
  }
19373
19412
  );
19374
- const { data: projectRoles = [], isLoading: isProjectRolesLoading, error: rolesError } = (0, import_connect_query43.useQuery)(
19375
- import_frontier48.FrontierServiceQueries.listRoles,
19376
- (0, import_protobuf31.create)(import_frontier48.ListRolesRequestSchema, { scopes: [PROJECT_NAMESPACE] }),
19413
+ const { data: projectRoles = [], isLoading: isProjectRolesLoading, error: rolesError } = (0, import_connect_query44.useQuery)(
19414
+ import_frontier49.FrontierServiceQueries.listRoles,
19415
+ (0, import_protobuf31.create)(import_frontier49.ListRolesRequestSchema, { scopes: [PROJECT_NAMESPACE] }),
19377
19416
  {
19378
19417
  select: (data2) => data2?.roles || []
19379
19418
  }
@@ -19387,18 +19426,19 @@ var ProjectMembersDialog = ({
19387
19426
  const {
19388
19427
  data: infiniteData,
19389
19428
  isLoading: isMembersLoading,
19429
+ isError,
19390
19430
  isFetchingNextPage,
19391
19431
  fetchNextPage,
19392
19432
  hasNextPage,
19393
19433
  refetch
19394
- } = (0, import_connect_query43.useInfiniteQuery)(
19395
- import_frontier48.AdminServiceQueries.searchProjectUsers,
19396
- { id: projectId, query: tableQuery.rqlRequest },
19434
+ } = (0, import_connect_query44.useInfiniteQuery)(
19435
+ import_frontier49.AdminServiceQueries.searchProjectUsers,
19436
+ { id: projectId, query: rqlQuery },
19397
19437
  {
19398
19438
  pageParamKey: "query",
19399
19439
  getNextPageParam: (lastPage) => getConnectNextPageParam(
19400
19440
  lastPage,
19401
- { query: tableQuery.rqlRequest },
19441
+ { query: rqlQuery },
19402
19442
  "projectUsers"
19403
19443
  ),
19404
19444
  staleTime: 0,
@@ -19408,45 +19448,26 @@ var ProjectMembersDialog = ({
19408
19448
  }
19409
19449
  );
19410
19450
  const data = infiniteData?.pages?.flatMap((page) => page?.projectUsers || []) || [];
19411
- const onTableQueryChange = (0, import_react52.useCallback)((query) => {
19412
- const updatedQuery = {
19413
- ...query,
19414
- offset: 0,
19415
- limit: query.limit || DEFAULT_PAGE_SIZE,
19416
- sort: void 0
19417
- // Remove sort as it's not supported by this endpoint
19418
- };
19419
- const updatedRQLRequest = transformDataTableQueryToRQLRequest(
19420
- updatedQuery,
19421
- {}
19422
- );
19423
- setTableQuery({
19424
- query: updatedQuery,
19425
- rqlRequest: updatedRQLRequest
19426
- });
19427
- }, []);
19428
- const handleLoadMore = (0, import_react52.useCallback)(async () => {
19429
- try {
19430
- if (!hasNextPage)
19431
- return;
19432
- await fetchNextPage();
19433
- } catch (error) {
19434
- console.error("Error loading more project members:", error);
19435
- }
19436
- }, [hasNextPage, fetchNextPage]);
19451
+ const handleLoadMore = useLoadMore({
19452
+ hasNextPage,
19453
+ isFetchingNextPage,
19454
+ isError,
19455
+ fetchNextPage,
19456
+ label: "project members"
19457
+ });
19437
19458
  async function refetchMembers() {
19438
19459
  await refetch();
19439
19460
  }
19440
- const openRemoveMemberDialog = (0, import_react52.useCallback)(
19461
+ const openRemoveMemberDialog = (0, import_react53.useCallback)(
19441
19462
  (user) => {
19442
19463
  setRemoveMemberConfig({ isOpen: true, user });
19443
19464
  },
19444
19465
  []
19445
19466
  );
19446
- const closeRemoveMemberDialog = (0, import_react52.useCallback)(() => {
19467
+ const closeRemoveMemberDialog = (0, import_react53.useCallback)(() => {
19447
19468
  setRemoveMemberConfig({ isOpen: false, user: null });
19448
19469
  }, []);
19449
- const columns = (0, import_react52.useMemo)(
19470
+ const columns = (0, import_react53.useMemo)(
19450
19471
  () => getColumns14({
19451
19472
  roles: projectRoles,
19452
19473
  updateRoleHandle: updateRoleDialogHandle2,
@@ -19489,12 +19510,11 @@ var ProjectMembersDialog = ({
19489
19510
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_apsara89.Dialog.Body, { className: members_module_css_default5["dialog-body"], children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
19490
19511
  import_apsara89.DataTable,
19491
19512
  {
19492
- query: tableQuery.query,
19513
+ query: tableQuery,
19493
19514
  columns,
19494
19515
  data,
19495
19516
  isLoading,
19496
19517
  mode: "server",
19497
- defaultSort: { name: "", order: "desc" },
19498
19518
  onTableQueryChange,
19499
19519
  onLoadMore: handleLoadMore,
19500
19520
  children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
@@ -19538,10 +19558,6 @@ var ProjectMembersDialog = ({
19538
19558
  // admin/views/organizations/details/projects/index.tsx
19539
19559
  var import_jsx_runtime100 = require("react/jsx-runtime");
19540
19560
  var DEFAULT_SORT7 = { name: "createdAt", order: "desc" };
19541
- var INITIAL_QUERY7 = {
19542
- offset: 0,
19543
- limit: DEFAULT_PAGE_SIZE
19544
- };
19545
19561
  var TRANSFORM_OPTIONS3 = {
19546
19562
  fieldNameMapping: {
19547
19563
  createdAt: "created_at",
@@ -19593,27 +19609,32 @@ var ErrorState2 = () => {
19593
19609
  };
19594
19610
  function OrganizationProjectsView() {
19595
19611
  const t = useTerminology();
19596
- const { organization, search, orgMembersMap, isOrgMembersMapLoading } = (0, import_react53.useContext)(OrganizationContext);
19612
+ const { organization, search } = (0, import_react54.useContext)(OrganizationContext);
19613
+ const {
19614
+ data: orgMembersMap = {},
19615
+ isLoading: isOrgMembersMapLoading,
19616
+ error: orgMembersError
19617
+ } = useOrgMembersMap(organization?.id);
19597
19618
  const {
19598
19619
  onChange: onSearchChange,
19599
19620
  setVisibility: setSearchVisibility,
19600
19621
  query: searchQuery
19601
19622
  } = search;
19602
19623
  const organizationId = organization?.id || "";
19603
- const [memberDialogConfig, setMemberDialogConfig] = (0, import_react53.useState)({
19624
+ const [memberDialogConfig, setMemberDialogConfig] = (0, import_react54.useState)({
19604
19625
  open: false,
19605
19626
  projectId: ""
19606
19627
  });
19607
- const [tableQuery, setTableQuery] = (0, import_react53.useState)(INITIAL_QUERY7);
19608
19628
  const title = `${t.project({ plural: true, case: "capital" })} | ${organization?.title} | ${t.organization({ plural: true, case: "capital" })}`;
19609
- const computedQuery = (0, import_react53.useMemo)(() => {
19610
- const tempQuery = transformDataTableQueryToRQLRequest(tableQuery, TRANSFORM_OPTIONS3);
19611
- return {
19612
- ...tempQuery,
19613
- search: searchQuery || ""
19614
- };
19615
- }, [tableQuery, searchQuery]);
19616
- const query = useDebouncedValue(computedQuery, 200);
19629
+ const {
19630
+ tableQuery,
19631
+ rqlQuery: query,
19632
+ onTableQueryChange
19633
+ } = useServerTableQuery({
19634
+ defaultSort: DEFAULT_SORT7,
19635
+ transformOptions: TRANSFORM_OPTIONS3,
19636
+ search: searchQuery || ""
19637
+ });
19617
19638
  const {
19618
19639
  data: infiniteData,
19619
19640
  isLoading,
@@ -19622,8 +19643,8 @@ function OrganizationProjectsView() {
19622
19643
  hasNextPage,
19623
19644
  refetch: refetchOrgProjects,
19624
19645
  isError
19625
- } = (0, import_connect_query44.useInfiniteQuery)(
19626
- import_frontier49.AdminServiceQueries.searchOrganizationProjects,
19646
+ } = (0, import_connect_query45.useInfiniteQuery)(
19647
+ import_frontier50.AdminServiceQueries.searchOrganizationProjects,
19627
19648
  { id: organizationId, query },
19628
19649
  {
19629
19650
  enabled: !!organizationId,
@@ -19641,18 +19662,22 @@ function OrganizationProjectsView() {
19641
19662
  searchQuery?.trim() || tableQuery.filters?.length
19642
19663
  );
19643
19664
  const showZeroState = !isLoading && !isError && !hasActiveQuery && data.length === 0;
19644
- const onTableQueryChange = (newQuery) => {
19645
- setTableQuery(newQuery);
19646
- };
19647
- const fetchMore = async () => {
19648
- if (hasNextPage && !isFetchingNextPage && !isError) {
19649
- await fetchNextPage();
19650
- }
19651
- };
19665
+ const fetchMore = useLoadMore({
19666
+ hasNextPage,
19667
+ isFetchingNextPage,
19668
+ isError,
19669
+ fetchNextPage,
19670
+ label: "projects"
19671
+ });
19652
19672
  function handleProjectUpdate(project) {
19653
19673
  refetchOrgProjects();
19654
19674
  }
19655
- (0, import_react53.useEffect)(() => {
19675
+ (0, import_react54.useEffect)(() => {
19676
+ if (orgMembersError) {
19677
+ console.error("Failed to fetch organization members:", orgMembersError);
19678
+ }
19679
+ }, [orgMembersError]);
19680
+ (0, import_react54.useEffect)(() => {
19656
19681
  setSearchVisibility(true);
19657
19682
  return () => {
19658
19683
  onSearchChange("");
@@ -19720,8 +19745,8 @@ function OrganizationProjectsView() {
19720
19745
  // admin/views/organizations/details/invoices/index.tsx
19721
19746
  var import_apsara92 = require("@raystack/apsara");
19722
19747
 
19723
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-juOzmwqepN3Q/sdk/admin/views/organizations/details/invoices/invoices.module.css.js
19724
- var digest73 = "401f8f0fe24119891446b14aa4f18c7a782badefbd4b064f2c9534c67d5616d4";
19748
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-woQ519ZJ0CZ0/sdk/admin/views/organizations/details/invoices/invoices.module.css.js
19749
+ var digest73 = "ec64a950c93add8ecd6271bd3c976eda5b9ff494e0a948db9b7bb6894f74c32d";
19725
19750
  var css73 = `._empty-state_ptbbe_1 {
19726
19751
  height: 100%;
19727
19752
  }
@@ -19799,10 +19824,10 @@ function BanknotesIcon(props) {
19799
19824
  }
19800
19825
 
19801
19826
  // admin/views/organizations/details/invoices/index.tsx
19802
- var import_react54 = require("react");
19827
+ var import_react55 = require("react");
19803
19828
 
19804
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-TF5b5OSZ3D0B/sdk/admin/views/organizations/details/invoices/invoices.module.css.js
19805
- var digest74 = "438fd9b66cfa1d94e5a36f71233e02ebb27ecdc227cb7c171d81cc1476450e9f";
19829
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-0ZRqf8LOWjk5/sdk/admin/views/organizations/details/invoices/invoices.module.css.js
19830
+ var digest74 = "1dc306c0e62cd923f7780e4f767989fa18978a2ffe2628472d24c28a8eb964f3";
19806
19831
  var css74 = `._empty-state_ptbbe_1 {
19807
19832
  height: 100%;
19808
19833
  }
@@ -19929,14 +19954,10 @@ var getColumns15 = ({
19929
19954
  ];
19930
19955
 
19931
19956
  // admin/views/organizations/details/invoices/index.tsx
19932
- var import_frontier50 = require("@raystack/proton/frontier");
19933
- var import_connect_query45 = require("@connectrpc/connect-query");
19957
+ var import_frontier51 = require("@raystack/proton/frontier");
19958
+ var import_connect_query46 = require("@connectrpc/connect-query");
19934
19959
  var import_jsx_runtime103 = require("react/jsx-runtime");
19935
19960
  var DEFAULT_SORT8 = { name: "createdAt", order: "desc" };
19936
- var INITIAL_QUERY8 = {
19937
- offset: 0,
19938
- limit: DEFAULT_PAGE_SIZE
19939
- };
19940
19961
  var TRANSFORM_OPTIONS4 = {
19941
19962
  fieldNameMapping: {
19942
19963
  createdAt: "created_at",
@@ -20007,26 +20028,24 @@ var ErrorState3 = () => {
20007
20028
  };
20008
20029
  function OrganizationInvoicesView() {
20009
20030
  const t = useTerminology();
20010
- const { organization, search } = (0, import_react54.useContext)(OrganizationContext);
20031
+ const { organization, search } = (0, import_react55.useContext)(OrganizationContext);
20011
20032
  const organizationId = organization?.id || "";
20012
20033
  const {
20013
20034
  onChange: onSearchChange,
20014
20035
  setVisibility: setSearchVisibility,
20015
20036
  query: searchQuery
20016
20037
  } = search;
20017
- const [tableQuery, setTableQuery] = (0, import_react54.useState)(INITIAL_QUERY8);
20018
20038
  const title = `Invoices | ${organization?.title} | ${t.organization({ plural: true, case: "capital" })}`;
20019
- const computedQuery = (0, import_react54.useMemo)(() => {
20020
- const tempQuery = transformDataTableQueryToRQLRequest(
20021
- convertAmountFiltersToCents(tableQuery),
20022
- TRANSFORM_OPTIONS4
20023
- );
20024
- return {
20025
- ...tempQuery,
20026
- search: searchQuery || ""
20027
- };
20028
- }, [tableQuery, searchQuery]);
20029
- const query = useDebouncedValue(computedQuery, 200);
20039
+ const {
20040
+ tableQuery,
20041
+ rqlQuery: query,
20042
+ onTableQueryChange
20043
+ } = useServerTableQuery({
20044
+ defaultSort: DEFAULT_SORT8,
20045
+ transformOptions: TRANSFORM_OPTIONS4,
20046
+ search: searchQuery || "",
20047
+ mapQuery: convertAmountFiltersToCents
20048
+ });
20030
20049
  const {
20031
20050
  data: infiniteData,
20032
20051
  isLoading,
@@ -20034,8 +20053,8 @@ function OrganizationInvoicesView() {
20034
20053
  fetchNextPage,
20035
20054
  hasNextPage,
20036
20055
  isError
20037
- } = (0, import_connect_query45.useInfiniteQuery)(
20038
- import_frontier50.FrontierServiceQueries.searchOrganizationInvoices,
20056
+ } = (0, import_connect_query46.useInfiniteQuery)(
20057
+ import_frontier51.FrontierServiceQueries.searchOrganizationInvoices,
20039
20058
  { id: organizationId, query },
20040
20059
  {
20041
20060
  enabled: !!organizationId,
@@ -20058,15 +20077,14 @@ function OrganizationInvoicesView() {
20058
20077
  );
20059
20078
  const showZeroState = !isLoading && !isError && !hasActiveQuery && data.length === 0;
20060
20079
  const groupCountMap = infiniteData ? getGroupCountMapFromFirstPage(infiniteData) : {};
20061
- const onTableQueryChange = (newQuery) => {
20062
- setTableQuery(newQuery);
20063
- };
20064
- const fetchMore = async () => {
20065
- if (hasNextPage && !isFetchingNextPage && !isError) {
20066
- await fetchNextPage();
20067
- }
20068
- };
20069
- (0, import_react54.useEffect)(() => {
20080
+ const fetchMore = useLoadMore({
20081
+ hasNextPage,
20082
+ isFetchingNextPage,
20083
+ isError,
20084
+ fetchNextPage,
20085
+ label: "invoices"
20086
+ });
20087
+ (0, import_react55.useEffect)(() => {
20070
20088
  setSearchVisibility(true);
20071
20089
  return () => {
20072
20090
  onSearchChange("");
@@ -20109,8 +20127,8 @@ function OrganizationInvoicesView() {
20109
20127
  // admin/views/organizations/details/tokens/index.tsx
20110
20128
  var import_apsara94 = require("@raystack/apsara");
20111
20129
 
20112
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-5L6xrROfzg6x/sdk/admin/views/organizations/details/tokens/tokens.module.css.js
20113
- var digest75 = "5bd5fcf916da570aebe766a87b5a0a43646e9f41343ab8073db2d368b3e89fd9";
20130
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-7jFdY3oJnEag/sdk/admin/views/organizations/details/tokens/tokens.module.css.js
20131
+ var digest75 = "4a720f83c0f7915baf76116fabb11f2e7afdea84308685f0b5fdf7bc0609d656";
20114
20132
  var css75 = `._empty-state_sg42h_1 {
20115
20133
  height: 100%;
20116
20134
  }
@@ -20170,12 +20188,12 @@ var tokens_module_css_default = { "empty-state": "_empty-state_sg42h_1", "emptyS
20170
20188
 
20171
20189
  // admin/views/organizations/details/tokens/index.tsx
20172
20190
  var import_icons8 = require("@raystack/apsara/icons");
20173
- var import_react55 = require("react");
20174
- var import_frontier51 = require("@raystack/proton/frontier");
20175
- var import_connect_query46 = require("@connectrpc/connect-query");
20191
+ var import_react56 = require("react");
20192
+ var import_frontier52 = require("@raystack/proton/frontier");
20193
+ var import_connect_query47 = require("@connectrpc/connect-query");
20176
20194
 
20177
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-piJXPVwYjVFw/sdk/admin/views/organizations/details/tokens/tokens.module.css.js
20178
- var digest76 = "4e0b25576f1a479f365c3cf3091c58f9231ee58922213283f3f33afbf97fe8ad";
20195
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-iZEQ5X3ng7qI/sdk/admin/views/organizations/details/tokens/tokens.module.css.js
20196
+ var digest76 = "c1dd57c9e0d62cbf0b169cf3880e4a3f88c5465448a609d5dc43da0f27318137";
20179
20197
  var css76 = `._empty-state_sg42h_1 {
20180
20198
  height: 100%;
20181
20199
  }
@@ -20311,10 +20329,6 @@ var getColumns16 = ({ t }) => {
20311
20329
  // admin/views/organizations/details/tokens/index.tsx
20312
20330
  var import_jsx_runtime105 = require("react/jsx-runtime");
20313
20331
  var DEFAULT_SORT9 = { name: "createdAt", order: "desc" };
20314
- var INITIAL_QUERY9 = {
20315
- offset: 0,
20316
- limit: DEFAULT_PAGE_SIZE
20317
- };
20318
20332
  var TRANSFORM_OPTIONS5 = {
20319
20333
  fieldNameMapping: {
20320
20334
  createdAt: "created_at",
@@ -20368,23 +20382,23 @@ var ErrorState4 = () => {
20368
20382
  };
20369
20383
  function OrganizationTokensView() {
20370
20384
  const t = useTerminology();
20371
- const { organization, search } = (0, import_react55.useContext)(OrganizationContext);
20385
+ const { organization, search } = (0, import_react56.useContext)(OrganizationContext);
20372
20386
  const organizationId = organization?.id || "";
20373
20387
  const {
20374
20388
  onChange: onSearchChange,
20375
20389
  setVisibility: setSearchVisibility,
20376
20390
  query: searchQuery
20377
20391
  } = search;
20378
- const [tableQuery, setTableQuery] = (0, import_react55.useState)(INITIAL_QUERY9);
20379
20392
  const title = `Tokens | ${organization?.title} | ${t.organization({ plural: true, case: "capital" })}`;
20380
- const computedQuery = (0, import_react55.useMemo)(() => {
20381
- const tempQuery = transformDataTableQueryToRQLRequest(tableQuery, TRANSFORM_OPTIONS5);
20382
- return {
20383
- ...tempQuery,
20384
- search: searchQuery || ""
20385
- };
20386
- }, [tableQuery, searchQuery]);
20387
- const query = useDebouncedValue(computedQuery, 200);
20393
+ const {
20394
+ tableQuery,
20395
+ rqlQuery: query,
20396
+ onTableQueryChange
20397
+ } = useServerTableQuery({
20398
+ defaultSort: DEFAULT_SORT9,
20399
+ transformOptions: TRANSFORM_OPTIONS5,
20400
+ search: searchQuery || ""
20401
+ });
20388
20402
  const {
20389
20403
  data: infiniteData,
20390
20404
  isLoading,
@@ -20392,8 +20406,8 @@ function OrganizationTokensView() {
20392
20406
  fetchNextPage,
20393
20407
  hasNextPage,
20394
20408
  isError
20395
- } = (0, import_connect_query46.useInfiniteQuery)(
20396
- import_frontier51.FrontierServiceQueries.searchOrganizationTokens,
20409
+ } = (0, import_connect_query47.useInfiniteQuery)(
20410
+ import_frontier52.FrontierServiceQueries.searchOrganizationTokens,
20397
20411
  { id: organizationId, query },
20398
20412
  {
20399
20413
  enabled: !!organizationId,
@@ -20415,22 +20429,21 @@ function OrganizationTokensView() {
20415
20429
  searchQuery?.trim() || tableQuery.filters?.length
20416
20430
  );
20417
20431
  const showZeroState = !isLoading && !isError && !hasActiveQuery && data.length === 0;
20418
- const onTableQueryChange = (newQuery) => {
20419
- setTableQuery(newQuery);
20420
- };
20421
- const fetchMore = async () => {
20422
- if (hasNextPage && !isFetchingNextPage && !isError) {
20423
- await fetchNextPage();
20424
- }
20425
- };
20426
- (0, import_react55.useEffect)(() => {
20432
+ const fetchMore = useLoadMore({
20433
+ hasNextPage,
20434
+ isFetchingNextPage,
20435
+ isError,
20436
+ fetchNextPage,
20437
+ label: "tokens"
20438
+ });
20439
+ (0, import_react56.useEffect)(() => {
20427
20440
  setSearchVisibility(true);
20428
20441
  return () => {
20429
20442
  onSearchChange("");
20430
20443
  setSearchVisibility(false);
20431
20444
  };
20432
20445
  }, [setSearchVisibility, onSearchChange]);
20433
- const columns = (0, import_react55.useMemo)(() => getColumns16({ t }), [t]);
20446
+ const columns = (0, import_react56.useMemo)(() => getColumns16({ t }), [t]);
20434
20447
  return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_apsara94.Flex, { justify: "center", children: [
20435
20448
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(PageTitle, { title }),
20436
20449
  /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
@@ -20466,8 +20479,8 @@ function OrganizationTokensView() {
20466
20479
  // admin/views/organizations/details/apis/index.tsx
20467
20480
  var import_apsara97 = require("@raystack/apsara");
20468
20481
 
20469
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-IFVpEfq22qBn/sdk/admin/views/organizations/details/apis/apis.module.css.js
20470
- var digest77 = "b2804bd36e747bd955e51240124cb4f9cd0c72330dc743bd0c50a3b395fb520d";
20482
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-VhC5E19Quf54/sdk/admin/views/organizations/details/apis/apis.module.css.js
20483
+ var digest77 = "134b84acb00ff3d041879c5ca555692d7b28c191de55c9bd87c5b8e2c9bbead7";
20471
20484
  var css77 = `._empty-state_1819g_1 {
20472
20485
  height: 100%;
20473
20486
  }
@@ -20550,13 +20563,13 @@ var css77 = `._empty-state_1819g_1 {
20550
20563
  var apis_module_css_default = { "empty-state": "_empty-state_1819g_1", "emptyState": "_empty-state_1819g_1", "empty-state-subheading": "_empty-state-subheading_1819g_5", "emptyStateSubheading": "_empty-state-subheading_1819g_5", "zero-state-container": "_zero-state-container_1819g_10", "zeroStateContainer": "_zero-state-container_1819g_10", "table": "_table_1819g_14", "table-wrapper": "_table-wrapper_1819g_19", "tableWrapper": "_table-wrapper_1819g_19", "table-header": "_table-header_1819g_25", "tableHeader": "_table-header_1819g_25", "first-column": "_first-column_1819g_30", "firstColumn": "_first-column_1819g_30", "details-dialog": "_details-dialog_1819g_34", "detailsDialog": "_details-dialog_1819g_34", "skeleton": "_skeleton_1819g_42", "tab-root": "_tab-root_1819g_46", "tabRoot": "_tab-root_1819g_46", "tab-content": "_tab-content_1819g_51", "tabContent": "_tab-content_1819g_51", "list-item": "_list-item_1819g_56", "listItem": "_list-item_1819g_56", "dialog-body": "_dialog-body_1819g_64", "dialogBody": "_dialog-body_1819g_64" };
20551
20564
 
20552
20565
  // admin/views/organizations/details/apis/index.tsx
20553
- var import_react57 = require("react");
20566
+ var import_react58 = require("react");
20554
20567
 
20555
20568
  // admin/views/organizations/details/apis/columns.tsx
20556
20569
  var import_apsara95 = require("@raystack/apsara");
20557
20570
 
20558
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-rRHTlNO2RMQz/sdk/admin/views/organizations/details/apis/apis.module.css.js
20559
- var digest78 = "9a21d96a6867c304026e02c8aa1d49c6aa8f4bd63889546f23627182b444cbc7";
20571
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-FaqMFhX7ll3Y/sdk/admin/views/organizations/details/apis/apis.module.css.js
20572
+ var digest78 = "2675b2849ea38e193a214f8bc790aff39e3b2f956a3715376657f269db24a4ff";
20560
20573
  var css78 = `._empty-state_1819g_1 {
20561
20574
  height: 100%;
20562
20575
  }
@@ -20681,8 +20694,8 @@ function getColumns17(options) {
20681
20694
  // admin/views/organizations/details/apis/details-dialog.tsx
20682
20695
  var import_apsara96 = require("@raystack/apsara");
20683
20696
 
20684
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-OcJni0XgUTz4/sdk/admin/views/organizations/details/apis/apis.module.css.js
20685
- var digest79 = "f8e6cd6cd6ee005fe9e2dda920a526b628b7ed40724dac9fc3415b498881334d";
20697
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-0wF3sat7KI65/sdk/admin/views/organizations/details/apis/apis.module.css.js
20698
+ var digest79 = "2006b51df3538f01d927296ef13d0746da205298412db92f255d372537b6e866";
20686
20699
  var css79 = `._empty-state_1819g_1 {
20687
20700
  height: 100%;
20688
20701
  }
@@ -20765,9 +20778,9 @@ var css79 = `._empty-state_1819g_1 {
20765
20778
  var apis_module_css_default3 = { "empty-state": "_empty-state_1819g_1", "emptyState": "_empty-state_1819g_1", "empty-state-subheading": "_empty-state-subheading_1819g_5", "emptyStateSubheading": "_empty-state-subheading_1819g_5", "zero-state-container": "_zero-state-container_1819g_10", "zeroStateContainer": "_zero-state-container_1819g_10", "table": "_table_1819g_14", "table-wrapper": "_table-wrapper_1819g_19", "tableWrapper": "_table-wrapper_1819g_19", "table-header": "_table-header_1819g_25", "tableHeader": "_table-header_1819g_25", "first-column": "_first-column_1819g_30", "firstColumn": "_first-column_1819g_30", "details-dialog": "_details-dialog_1819g_34", "detailsDialog": "_details-dialog_1819g_34", "skeleton": "_skeleton_1819g_42", "tab-root": "_tab-root_1819g_46", "tabRoot": "_tab-root_1819g_46", "tab-content": "_tab-content_1819g_51", "tabContent": "_tab-content_1819g_51", "list-item": "_list-item_1819g_56", "listItem": "_list-item_1819g_56", "dialog-body": "_dialog-body_1819g_64", "dialogBody": "_dialog-body_1819g_64" };
20766
20779
 
20767
20780
  // admin/views/organizations/details/apis/details-dialog.tsx
20768
- var import_react56 = require("react");
20769
- var import_connect_query47 = require("@connectrpc/connect-query");
20770
- var import_frontier52 = require("@raystack/proton/frontier");
20781
+ var import_react57 = require("react");
20782
+ var import_connect_query48 = require("@connectrpc/connect-query");
20783
+ var import_frontier53 = require("@raystack/proton/frontier");
20771
20784
  var import_protobuf32 = require("@bufbuild/protobuf");
20772
20785
  var import_jsx_runtime107 = require("react/jsx-runtime");
20773
20786
  var ServiceUserDetailsDialog = ({
@@ -20776,15 +20789,15 @@ var ServiceUserDetailsDialog = ({
20776
20789
  }) => {
20777
20790
  const t = useTerminology();
20778
20791
  const { id = "", orgId = "", title = "" } = serviceUser || {};
20779
- const projectsRequest = (0, import_react56.useMemo)(
20780
- () => (0, import_protobuf32.create)(import_frontier52.ListServiceUserProjectsRequestSchema, {
20792
+ const projectsRequest = (0, import_react57.useMemo)(
20793
+ () => (0, import_protobuf32.create)(import_frontier53.ListServiceUserProjectsRequestSchema, {
20781
20794
  orgId,
20782
20795
  id
20783
20796
  }),
20784
20797
  [orgId, id]
20785
20798
  );
20786
- const tokensRequest = (0, import_react56.useMemo)(
20787
- () => (0, import_protobuf32.create)(import_frontier52.ListServiceUserTokensRequestSchema, {
20799
+ const tokensRequest = (0, import_react57.useMemo)(
20800
+ () => (0, import_protobuf32.create)(import_frontier53.ListServiceUserTokensRequestSchema, {
20788
20801
  orgId,
20789
20802
  id
20790
20803
  }),
@@ -20794,7 +20807,7 @@ var ServiceUserDetailsDialog = ({
20794
20807
  data: projects = [],
20795
20808
  isLoading: isProjectLoading,
20796
20809
  error: projectError
20797
- } = (0, import_connect_query47.useQuery)(import_frontier52.FrontierServiceQueries.listServiceUserProjects, projectsRequest, {
20810
+ } = (0, import_connect_query48.useQuery)(import_frontier53.FrontierServiceQueries.listServiceUserProjects, projectsRequest, {
20798
20811
  enabled: !!orgId && !!id,
20799
20812
  select: (data) => data?.projects || []
20800
20813
  });
@@ -20802,11 +20815,11 @@ var ServiceUserDetailsDialog = ({
20802
20815
  data: tokens = [],
20803
20816
  isLoading: isTokenLoading,
20804
20817
  error: tokenError
20805
- } = (0, import_connect_query47.useQuery)(import_frontier52.FrontierServiceQueries.listServiceUserTokens, tokensRequest, {
20818
+ } = (0, import_connect_query48.useQuery)(import_frontier53.FrontierServiceQueries.listServiceUserTokens, tokensRequest, {
20806
20819
  enabled: !!orgId && !!id,
20807
20820
  select: (data) => data?.tokens || []
20808
20821
  });
20809
- (0, import_react56.useEffect)(() => {
20822
+ (0, import_react57.useEffect)(() => {
20810
20823
  if (projectError) {
20811
20824
  import_apsara96.toastManager.add({
20812
20825
  title: "Something went wrong",
@@ -20824,7 +20837,7 @@ var ServiceUserDetailsDialog = ({
20824
20837
  console.error("Unable to fetch tokens:", tokenError);
20825
20838
  }
20826
20839
  }, [projectError, tokenError]);
20827
- const onOpenChange = (0, import_react56.useCallback)(
20840
+ const onOpenChange = (0, import_react57.useCallback)(
20828
20841
  (val) => {
20829
20842
  if (!val) {
20830
20843
  onClose();
@@ -20889,8 +20902,8 @@ var ServiceUserDetailsDialog = ({
20889
20902
  };
20890
20903
 
20891
20904
  // admin/views/organizations/details/apis/index.tsx
20892
- var import_connect_query48 = require("@connectrpc/connect-query");
20893
- var import_frontier53 = require("@raystack/proton/frontier");
20905
+ var import_connect_query49 = require("@connectrpc/connect-query");
20906
+ var import_frontier54 = require("@raystack/proton/frontier");
20894
20907
  var import_jsx_runtime108 = require("react/jsx-runtime");
20895
20908
  var NoCredentials = () => {
20896
20909
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
@@ -20932,10 +20945,6 @@ var ErrorState5 = () => {
20932
20945
  );
20933
20946
  };
20934
20947
  var DEFAULT_SORT10 = { name: "createdAt", order: "desc" };
20935
- var INITIAL_QUERY10 = {
20936
- offset: 0,
20937
- limit: DEFAULT_PAGE_SIZE
20938
- };
20939
20948
  var TRANSFORM_OPTIONS6 = {
20940
20949
  fieldNameMapping: {
20941
20950
  createdAt: "created_at"
@@ -20943,27 +20952,27 @@ var TRANSFORM_OPTIONS6 = {
20943
20952
  };
20944
20953
  function OrganizationApisView() {
20945
20954
  const t = useTerminology();
20946
- const { organization, search } = (0, import_react57.useContext)(OrganizationContext);
20955
+ const { organization, search } = (0, import_react58.useContext)(OrganizationContext);
20947
20956
  const organizationId = organization?.id || "";
20948
20957
  const {
20949
20958
  onChange: onSearchChange,
20950
20959
  setVisibility: setSearchVisibility,
20951
20960
  query: searchQuery
20952
20961
  } = search;
20953
- const [tableQuery, setTableQuery] = (0, import_react57.useState)(INITIAL_QUERY10);
20954
- const computedQuery = (0, import_react57.useMemo)(() => {
20955
- const tempQuery = transformDataTableQueryToRQLRequest(tableQuery, TRANSFORM_OPTIONS6);
20956
- return {
20957
- ...tempQuery,
20958
- search: searchQuery || ""
20959
- };
20960
- }, [tableQuery, searchQuery]);
20961
- const query = useDebouncedValue(computedQuery, 200);
20962
- const [selectedServiceUser, setSelectedServiceUser] = (0, import_react57.useState)(
20962
+ const {
20963
+ tableQuery,
20964
+ rqlQuery: query,
20965
+ onTableQueryChange
20966
+ } = useServerTableQuery({
20967
+ defaultSort: DEFAULT_SORT10,
20968
+ transformOptions: TRANSFORM_OPTIONS6,
20969
+ search: searchQuery || ""
20970
+ });
20971
+ const [selectedServiceUser, setSelectedServiceUser] = (0, import_react58.useState)(
20963
20972
  null
20964
20973
  );
20965
20974
  const title = `API | ${organization?.title} | ${t.organization({ plural: true, case: "capital" })}`;
20966
- (0, import_react57.useEffect)(() => {
20975
+ (0, import_react58.useEffect)(() => {
20967
20976
  setSearchVisibility(true);
20968
20977
  return () => {
20969
20978
  onSearchChange("");
@@ -20978,8 +20987,8 @@ function OrganizationApisView() {
20978
20987
  error,
20979
20988
  isError,
20980
20989
  hasNextPage
20981
- } = (0, import_connect_query48.useInfiniteQuery)(
20982
- import_frontier53.AdminServiceQueries.searchOrganizationServiceUsers,
20990
+ } = (0, import_connect_query49.useInfiniteQuery)(
20991
+ import_frontier54.AdminServiceQueries.searchOrganizationServiceUsers,
20983
20992
  { id: organizationId, query },
20984
20993
  {
20985
20994
  pageParamKey: "query",
@@ -20996,27 +21005,22 @@ function OrganizationApisView() {
20996
21005
  }
20997
21006
  );
20998
21007
  const data = infiniteData?.pages?.flatMap((page) => page?.organizationServiceUsers || []) || [];
20999
- const onTableQueryChange = (newQuery) => {
21000
- setTableQuery(newQuery);
21001
- };
21002
- const handleLoadMore = async () => {
21003
- try {
21004
- if (!hasNextPage)
21005
- return;
21006
- await fetchNextPage();
21007
- } catch (error2) {
21008
- console.error("Error loading more service users:", error2);
21009
- }
21010
- };
21008
+ const handleLoadMore = useLoadMore({
21009
+ hasNextPage,
21010
+ isFetchingNextPage,
21011
+ isError,
21012
+ fetchNextPage,
21013
+ label: "service users"
21014
+ });
21011
21015
  const loading = isLoading || isFetchingNextPage;
21012
21016
  const hasActiveQuery = Boolean(
21013
21017
  searchQuery?.trim() || tableQuery.filters?.length
21014
21018
  );
21015
21019
  const showZeroState = !isLoading && !isError && !hasActiveQuery && data.length === 0;
21016
- const onDialogClose = (0, import_react57.useCallback)(() => {
21020
+ const onDialogClose = (0, import_react58.useCallback)(() => {
21017
21021
  setSelectedServiceUser(null);
21018
21022
  }, []);
21019
- const onRowClick = (0, import_react57.useCallback)(
21023
+ const onRowClick = (0, import_react58.useCallback)(
21020
21024
  (row) => {
21021
21025
  setSelectedServiceUser(row);
21022
21026
  },
@@ -21025,7 +21029,7 @@ function OrganizationApisView() {
21025
21029
  if (isError) {
21026
21030
  console.error("ConnectRPC Error:", error);
21027
21031
  }
21028
- const columns = (0, import_react57.useMemo)(
21032
+ const columns = (0, import_react58.useMemo)(
21029
21033
  () => getColumns17({
21030
21034
  groupCountMap: infiniteData ? getGroupCountMapFromFirstPage(infiniteData) : {},
21031
21035
  t
@@ -21074,9 +21078,9 @@ function OrganizationApisView() {
21074
21078
 
21075
21079
  // admin/views/organizations/details/pat/index.tsx
21076
21080
  var import_apsara100 = require("@raystack/apsara");
21077
- var import_react59 = require("react");
21078
- var import_connect_query50 = require("@connectrpc/connect-query");
21079
- var import_frontier55 = require("@raystack/proton/frontier");
21081
+ var import_react60 = require("react");
21082
+ var import_connect_query51 = require("@connectrpc/connect-query");
21083
+ var import_frontier56 = require("@raystack/proton/frontier");
21080
21084
 
21081
21085
  // admin/views/organizations/details/pat/columns.tsx
21082
21086
  var import_apsara98 = require("@raystack/apsara");
@@ -21092,8 +21096,8 @@ var getInitials = function(name = "") {
21092
21096
  return initials;
21093
21097
  };
21094
21098
 
21095
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-tXlcnVlhmqPg/sdk/admin/views/organizations/details/pat/pat.module.css.js
21096
- var digest80 = "2d42163b89fe0ed2009592e21e4259e9d8aec97b28f206f7b3e7736a993f50f4";
21099
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-stKASHTaD5Y3/sdk/admin/views/organizations/details/pat/pat.module.css.js
21100
+ var digest80 = "40dc66809c587309c0411e3e1169fee543c21389ec1c2b40df47c1985621ab26";
21097
21101
  var css80 = `._empty-state_3m4sa_1 {
21098
21102
  height: 100%;
21099
21103
  }
@@ -21248,13 +21252,13 @@ function getColumns18({
21248
21252
  }
21249
21253
 
21250
21254
  // admin/views/organizations/details/pat/components/pat-details-dialog.tsx
21251
- var import_react58 = require("react");
21255
+ var import_react59 = require("react");
21252
21256
  var import_apsara99 = require("@raystack/apsara");
21253
- var import_connect_query49 = require("@connectrpc/connect-query");
21254
- var import_frontier54 = require("@raystack/proton/frontier");
21257
+ var import_connect_query50 = require("@connectrpc/connect-query");
21258
+ var import_frontier55 = require("@raystack/proton/frontier");
21255
21259
 
21256
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-eFNZ6XQ1Tea7/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.module.css.js
21257
- var digest81 = "b646987f675fe686fab7a788fe804172175b0c7f9419243df9abe2b364813b3a";
21260
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-1spB4WRqOlDu/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.module.css.js
21261
+ var digest81 = "b43a17e5dfa93e00008503136fa7fd9368ee950b5e4e8cc21185f06137541926";
21258
21262
  var css81 = `._details-dialog_1dwlo_1 {
21259
21263
  width: 100%;
21260
21264
  max-width: 400px;
@@ -21328,25 +21332,25 @@ function PatDetailsDialog({
21328
21332
  }) {
21329
21333
  const t = useTerminology();
21330
21334
  const open = pat !== null;
21331
- const projectScope = (0, import_react58.useMemo)(
21335
+ const projectScope = (0, import_react59.useMemo)(
21332
21336
  () => pat?.scopes?.find((s) => s.resourceType === SCOPES.PROJECT),
21333
21337
  [pat]
21334
21338
  );
21335
- const orgScope = (0, import_react58.useMemo)(
21339
+ const orgScope = (0, import_react59.useMemo)(
21336
21340
  () => pat?.scopes?.find((s) => s.resourceType === SCOPES.ORG),
21337
21341
  [pat]
21338
21342
  );
21339
- const scopeProjectIds = (0, import_react58.useMemo)(() => projectScope?.resourceIds ?? [], [projectScope]);
21340
- const scopeProjects = (0, import_react58.useMemo)(
21343
+ const scopeProjectIds = (0, import_react59.useMemo)(() => projectScope?.resourceIds ?? [], [projectScope]);
21344
+ const scopeProjects = (0, import_react59.useMemo)(
21341
21345
  () => scopeProjectIds.map((id) => projectsMap[id]).filter((p) => Boolean(p)),
21342
21346
  [scopeProjectIds, projectsMap]
21343
21347
  );
21344
- const { data: rolesData, isLoading: isRolesLoading } = (0, import_connect_query49.useQuery)(
21345
- import_frontier54.FrontierServiceQueries.listRolesForPAT,
21348
+ const { data: rolesData, isLoading: isRolesLoading } = (0, import_connect_query50.useQuery)(
21349
+ import_frontier55.FrontierServiceQueries.listRolesForPAT,
21346
21350
  { scopes: [SCOPES.ORG, SCOPES.PROJECT] },
21347
21351
  { enabled: open }
21348
21352
  );
21349
- const rolesMap = (0, import_react58.useMemo)(() => {
21353
+ const rolesMap = (0, import_react59.useMemo)(() => {
21350
21354
  const map = {};
21351
21355
  (rolesData?.roles ?? []).forEach((role) => {
21352
21356
  if (role.id)
@@ -21445,8 +21449,8 @@ function PatDetailsDialog({
21445
21449
  ] }) });
21446
21450
  }
21447
21451
 
21448
- // esbuild-css-modules-plugin-namespace:/tmp/tmp-2091-YbFJ5pJWgNG3/sdk/admin/views/organizations/details/pat/pat.module.css.js
21449
- var digest82 = "e8423d2c83d8daaaad033d824533df303a8f98352f1e3627e661663c1b08b5fd";
21452
+ // esbuild-css-modules-plugin-namespace:/tmp/tmp-2155-ALt1B91PnzHe/sdk/admin/views/organizations/details/pat/pat.module.css.js
21453
+ var digest82 = "b996fae00c41d56697d2bf8283972535598cb51bdcf1033757a6f670fc923ae5";
21450
21454
  var css82 = `._empty-state_3m4sa_1 {
21451
21455
  height: 100%;
21452
21456
  }
@@ -21507,10 +21511,6 @@ var pat_module_css_default2 = { "empty-state": "_empty-state_3m4sa_1", "emptySta
21507
21511
  // admin/views/organizations/details/pat/index.tsx
21508
21512
  var import_jsx_runtime111 = require("react/jsx-runtime");
21509
21513
  var DEFAULT_SORT11 = { name: "createdAt", order: "desc" };
21510
- var INITIAL_QUERY11 = {
21511
- offset: 0,
21512
- limit: DEFAULT_PAGE_SIZE
21513
- };
21514
21514
  var TRANSFORM_OPTIONS7 = {
21515
21515
  fieldNameMapping: {
21516
21516
  createdAt: "created_at",
@@ -21561,27 +21561,24 @@ var ErrorState6 = () => {
21561
21561
  };
21562
21562
  function OrganizationPatView() {
21563
21563
  const t = useTerminology();
21564
- const { organization, search } = (0, import_react59.useContext)(OrganizationContext);
21564
+ const { organization, search } = (0, import_react60.useContext)(OrganizationContext);
21565
21565
  const organizationId = organization?.id || "";
21566
21566
  const {
21567
21567
  onChange: onSearchChange,
21568
21568
  setVisibility: setSearchVisibility,
21569
21569
  query: searchQuery
21570
21570
  } = search;
21571
- const [tableQuery, setTableQuery] = (0, import_react59.useState)(INITIAL_QUERY11);
21572
- const [selectedPat, setSelectedPat] = (0, import_react59.useState)(null);
21571
+ const [selectedPat, setSelectedPat] = (0, import_react60.useState)(null);
21573
21572
  const title = `PAT | ${organization?.title} | ${t.organization({ plural: true, case: "capital" })}`;
21574
- const computedQuery = (0, import_react59.useMemo)(() => {
21575
- const tempQuery = transformDataTableQueryToRQLRequest(
21576
- tableQuery,
21577
- TRANSFORM_OPTIONS7
21578
- );
21579
- return {
21580
- ...tempQuery,
21581
- search: searchQuery || ""
21582
- };
21583
- }, [tableQuery, searchQuery]);
21584
- const query = useDebouncedValue(computedQuery, 200);
21573
+ const {
21574
+ tableQuery,
21575
+ rqlQuery: query,
21576
+ onTableQueryChange
21577
+ } = useServerTableQuery({
21578
+ defaultSort: DEFAULT_SORT11,
21579
+ transformOptions: TRANSFORM_OPTIONS7,
21580
+ search: searchQuery || ""
21581
+ });
21585
21582
  const {
21586
21583
  data: infiniteData,
21587
21584
  isLoading,
@@ -21589,8 +21586,8 @@ function OrganizationPatView() {
21589
21586
  fetchNextPage,
21590
21587
  hasNextPage,
21591
21588
  isError
21592
- } = (0, import_connect_query50.useInfiniteQuery)(
21593
- import_frontier55.AdminServiceQueries.searchOrganizationPATs,
21589
+ } = (0, import_connect_query51.useInfiniteQuery)(
21590
+ import_frontier56.AdminServiceQueries.searchOrganizationPATs,
21594
21591
  { orgId: organizationId, query },
21595
21592
  {
21596
21593
  enabled: !!organizationId,
@@ -21602,15 +21599,15 @@ function OrganizationPatView() {
21602
21599
  retryDelay: 1e3
21603
21600
  }
21604
21601
  );
21605
- const { data: projects = [] } = (0, import_connect_query50.useQuery)(
21606
- import_frontier55.FrontierServiceQueries.listOrganizationProjects,
21602
+ const { data: projects = [] } = (0, import_connect_query51.useQuery)(
21603
+ import_frontier56.FrontierServiceQueries.listOrganizationProjects,
21607
21604
  { id: organizationId, state: "", withMemberCount: false },
21608
21605
  {
21609
21606
  enabled: !!organizationId,
21610
21607
  select: (data2) => data2?.projects || []
21611
21608
  }
21612
21609
  );
21613
- const projectsMap = (0, import_react59.useMemo)(
21610
+ const projectsMap = (0, import_react60.useMemo)(
21614
21611
  () => projects.reduce(
21615
21612
  (acc, project) => {
21616
21613
  if (project.id)
@@ -21621,7 +21618,7 @@ function OrganizationPatView() {
21621
21618
  ),
21622
21619
  [projects]
21623
21620
  );
21624
- const data = (0, import_react59.useMemo)(
21621
+ const data = (0, import_react60.useMemo)(
21625
21622
  () => infiniteData?.pages?.flatMap((page) => page?.organizationPats ?? []) ?? [],
21626
21623
  [infiniteData]
21627
21624
  );
@@ -21630,32 +21627,31 @@ function OrganizationPatView() {
21630
21627
  searchQuery?.trim() || tableQuery.filters?.length
21631
21628
  );
21632
21629
  const showZeroState = !isLoading && !isError && !hasActiveQuery && data.length === 0;
21633
- const onTableQueryChange = (newQuery) => {
21634
- setTableQuery(newQuery);
21635
- };
21636
- const fetchMore = async () => {
21637
- if (hasNextPage && !isFetchingNextPage && !isError) {
21638
- await fetchNextPage();
21639
- }
21640
- };
21641
- (0, import_react59.useEffect)(() => {
21630
+ const fetchMore = useLoadMore({
21631
+ hasNextPage,
21632
+ isFetchingNextPage,
21633
+ isError,
21634
+ fetchNextPage,
21635
+ label: "personal access tokens"
21636
+ });
21637
+ (0, import_react60.useEffect)(() => {
21642
21638
  setSearchVisibility(true);
21643
21639
  return () => {
21644
21640
  onSearchChange("");
21645
21641
  setSearchVisibility(false);
21646
21642
  };
21647
21643
  }, [setSearchVisibility, onSearchChange]);
21648
- const columns = (0, import_react59.useMemo)(
21644
+ const columns = (0, import_react60.useMemo)(
21649
21645
  () => getColumns18({ projectsMap }),
21650
21646
  [projectsMap]
21651
21647
  );
21652
- const onRowClick = (0, import_react59.useCallback)(
21648
+ const onRowClick = (0, import_react60.useCallback)(
21653
21649
  (row) => {
21654
21650
  setSelectedPat(row);
21655
21651
  },
21656
21652
  []
21657
21653
  );
21658
- const onDialogClose = (0, import_react59.useCallback)(() => {
21654
+ const onDialogClose = (0, import_react60.useCallback)(() => {
21659
21655
  setSelectedPat(null);
21660
21656
  }, []);
21661
21657
  return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(import_apsara100.Flex, { justify: "center", children: [