@gen3/frontend 0.11.16 → 0.11.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/cjs/index.js +454 -299
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/Content/TextContent.d.ts.map +1 -1
  4. package/dist/dts/components/Content/TextContent.js +7 -8
  5. package/dist/dts/components/Content/TextContent.js.map +1 -1
  6. package/dist/dts/components/Layout/TexturedSidePanel.js +1 -1
  7. package/dist/dts/components/Layout/TexturedSidePanel.js.map +1 -1
  8. package/dist/dts/components/Protected/ProtectedContent.d.ts.map +1 -1
  9. package/dist/dts/components/Protected/ProtectedContent.js +11 -3
  10. package/dist/dts/components/Protected/ProtectedContent.js.map +1 -1
  11. package/dist/dts/components/Providers/Gen3Provider.d.ts +21 -21
  12. package/dist/dts/components/charts/utils.d.ts +16 -0
  13. package/dist/dts/components/charts/utils.d.ts.map +1 -1
  14. package/dist/dts/components/charts/utils.js +28 -1
  15. package/dist/dts/components/charts/utils.js.map +1 -1
  16. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +6 -6
  17. package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts +2 -1
  18. package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts.map +1 -1
  19. package/dist/dts/features/CohortBuilder/CohortBuilder.js +5 -3
  20. package/dist/dts/features/CohortBuilder/CohortBuilder.js.map +1 -1
  21. package/dist/dts/features/CohortBuilder/CohortPanel.d.ts.map +1 -1
  22. package/dist/dts/features/CohortBuilder/CohortPanel.js +24 -2
  23. package/dist/dts/features/CohortBuilder/CohortPanel.js.map +1 -1
  24. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.d.ts.map +1 -1
  25. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.js +58 -26
  26. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.js.map +1 -1
  27. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/types.d.ts +3 -0
  28. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/types.d.ts.map +1 -1
  29. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.d.ts.map +1 -1
  30. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.js +39 -26
  31. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.js.map +1 -1
  32. package/dist/dts/features/CohortBuilder/index.d.ts +1 -1
  33. package/dist/dts/features/CohortBuilder/index.d.ts.map +1 -1
  34. package/dist/dts/features/CohortBuilder/index.js +1 -1
  35. package/dist/dts/features/CohortBuilder/index.js.map +1 -1
  36. package/dist/dts/features/CohortBuilder/types.d.ts +1 -0
  37. package/dist/dts/features/CohortBuilder/types.d.ts.map +1 -1
  38. package/dist/dts/features/CohortBuilder/types.js.map +1 -1
  39. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.d.ts +1 -1
  40. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.d.ts.map +1 -1
  41. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js +21 -14
  42. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js.map +1 -1
  43. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.d.ts.map +1 -1
  44. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.js +1 -0
  45. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.js.map +1 -1
  46. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts +11 -10
  47. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts.map +1 -1
  48. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.js +9 -5
  49. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.js.map +1 -1
  50. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.d.ts +1 -0
  51. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.d.ts.map +1 -1
  52. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.js +21 -6
  53. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.js.map +1 -1
  54. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.d.ts.map +1 -1
  55. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js +1 -1
  56. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js.map +1 -1
  57. package/dist/dts/features/CohortDiscovery/appApi.js +1 -1
  58. package/dist/dts/features/CohortDiscovery/appApi.js.map +1 -1
  59. package/dist/dts/features/CohortDiscovery/constants.d.ts +2 -0
  60. package/dist/dts/features/CohortDiscovery/constants.d.ts.map +1 -1
  61. package/dist/dts/features/CohortDiscovery/constants.js +11 -0
  62. package/dist/dts/features/CohortDiscovery/constants.js.map +1 -1
  63. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts.map +1 -1
  64. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js +4 -2
  65. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js.map +1 -1
  66. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.d.ts.map +1 -1
  67. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.js +2 -1
  68. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.js.map +1 -1
  69. package/dist/dts/features/Dictionary/metadata/types.d.ts +1 -0
  70. package/dist/dts/features/Dictionary/metadata/types.d.ts.map +1 -1
  71. package/dist/dts/features/Discovery/Discovery.d.ts.map +1 -1
  72. package/dist/dts/features/Discovery/Discovery.js +3 -2
  73. package/dist/dts/features/Discovery/Discovery.js.map +1 -1
  74. package/dist/dts/features/Discovery/types.d.ts +1 -0
  75. package/dist/dts/features/Discovery/types.d.ts.map +1 -1
  76. package/dist/dts/features/Discovery/types.js.map +1 -1
  77. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.d.ts.map +1 -1
  78. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.js +28 -1
  79. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.js.map +1 -1
  80. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.d.ts.map +1 -1
  81. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.js +7 -0
  82. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.js.map +1 -1
  83. package/dist/dts/lib/common/staticProps.d.ts.map +1 -1
  84. package/dist/dts/lib/common/staticProps.js +11 -23
  85. package/dist/dts/lib/common/staticProps.js.map +1 -1
  86. package/dist/dts/lib/content/filesystem.js +1 -1
  87. package/dist/dts/lib/content/filesystem.js.map +1 -1
  88. package/dist/dts/pages/Explorer/Explorer.d.ts.map +1 -1
  89. package/dist/dts/pages/Explorer/Explorer.js +4 -1
  90. package/dist/dts/pages/Explorer/Explorer.js.map +1 -1
  91. package/dist/esm/index.js +454 -300
  92. package/dist/esm/index.js.map +1 -1
  93. package/dist/index.d.ts +220 -200
  94. package/dist/tsconfig.tsbuildinfo +1 -1
  95. package/package.json +3 -3
package/dist/cjs/index.js CHANGED
@@ -1305,11 +1305,11 @@ const LoginProvidersPanel = ({ handleLoginSelected })=>{
1305
1305
 
1306
1306
  const TexturedSidePanel = ({ url })=>{
1307
1307
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
1308
- "aria-label": 'background image',
1308
+ "aria-hidden": "true",
1309
1309
  style: {
1310
1310
  backgroundImage: `url(${url})`
1311
1311
  },
1312
- className: "flex h-screen w-full bg-left bg-repeat-y last:-scale-x-100"
1312
+ className: "bg-contain flex h-full w-full bg-repeat-y last:-scale-x-100"
1313
1313
  });
1314
1314
  };
1315
1315
 
@@ -1479,8 +1479,7 @@ function hashCode(str) {
1479
1479
  className: className,
1480
1480
  dangerouslySetInnerHTML: {
1481
1481
  __html: textString
1482
- },
1483
- "aria-label": "HTML content"
1482
+ }
1484
1483
  });
1485
1484
  }
1486
1485
  case "textArray":
@@ -1488,22 +1487,29 @@ function hashCode(str) {
1488
1487
  const textArray = !Array.isArray(text) ? [
1489
1488
  text
1490
1489
  ] : text;
1491
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
1490
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
1492
1491
  className: className,
1493
1492
  role: "list",
1494
- "aria-label": "Text array",
1495
- children: textArray.map((item)=>/*#__PURE__*/ jsxRuntime.jsx("p", {
1496
- className: "my-2",
1497
- role: "listitem",
1498
- children: item
1499
- }, hashCode(item)))
1493
+ children: [
1494
+ /*#__PURE__*/ jsxRuntime.jsxs("style", {
1495
+ children: [
1496
+ "@source inline(",
1497
+ className,
1498
+ ");"
1499
+ ]
1500
+ }),
1501
+ textArray.map((item)=>/*#__PURE__*/ jsxRuntime.jsx("p", {
1502
+ className: "my-2",
1503
+ role: "listitem",
1504
+ children: item
1505
+ }, hashCode(item)))
1506
+ ]
1500
1507
  });
1501
1508
  }
1502
1509
  case "markdown":
1503
1510
  {
1504
1511
  const textString = Array.isArray(text) ? text.join('') : text;
1505
1512
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
1506
- "aria-label": "Markdown content",
1507
1513
  children: /*#__PURE__*/ jsxRuntime.jsx(Markdown, {
1508
1514
  remarkPlugins: [
1509
1515
  remarkGfm
@@ -1547,21 +1553,29 @@ function hashCode(str) {
1547
1553
  const DEFAULT_STYLE = 'inline text-base-contrast-max font-medium margin-block-start-1 margin-block-end-1';
1548
1554
  const mergedClassname = className ? tailwindMerge.twMerge(DEFAULT_STYLE, className) : DEFAULT_STYLE;
1549
1555
  const textString = Array.isArray(text) ? text.join('') : text;
1550
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
1556
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
1551
1557
  className: mergedClassname,
1552
- children: /*#__PURE__*/ jsxRuntime.jsxs("span", {
1553
- children: [
1554
- textString,
1555
- email && /*#__PURE__*/ jsxRuntime.jsx(core$1.Anchor, {
1556
- classNames: {
1557
- root: mergedClassname
1558
- },
1559
- href: `mailto:${email}`,
1560
- "aria-label": `Send an email to ${email}`,
1561
- children: ` ${email}.`
1562
- })
1563
- ]
1564
- })
1558
+ children: [
1559
+ /*#__PURE__*/ jsxRuntime.jsxs("style", {
1560
+ children: [
1561
+ "@source inline(",
1562
+ className,
1563
+ ");"
1564
+ ]
1565
+ }),
1566
+ /*#__PURE__*/ jsxRuntime.jsxs("span", {
1567
+ children: [
1568
+ textString,
1569
+ email && /*#__PURE__*/ jsxRuntime.jsx(core$1.Anchor, {
1570
+ classNames: {
1571
+ root: mergedClassname
1572
+ },
1573
+ href: `mailto:${email}`,
1574
+ children: ` ${email}.`
1575
+ })
1576
+ ]
1577
+ })
1578
+ ]
1565
1579
  });
1566
1580
  }
1567
1581
  case "textWithLink":
@@ -1572,35 +1586,50 @@ function hashCode(str) {
1572
1586
  if (!link) {
1573
1587
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
1574
1588
  className: mergedClassname,
1575
- "aria-label": "No link defined",
1576
1589
  children: "Link is not defined."
1577
1590
  });
1578
1591
  }
1579
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
1592
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
1580
1593
  className: mergedClassname,
1581
- children: /*#__PURE__*/ jsxRuntime.jsxs("span", {
1582
- children: [
1583
- textString,
1584
- link && /*#__PURE__*/ jsxRuntime.jsx(core$1.Anchor, {
1585
- classNames: {
1586
- root: mergedClassname
1587
- },
1588
- href: link,
1589
- "aria-label": `Visit the link: ${linkText || link}`,
1590
- children: ` ${linkText ?? link}.`
1591
- })
1592
- ]
1593
- })
1594
+ children: [
1595
+ /*#__PURE__*/ jsxRuntime.jsxs("style", {
1596
+ children: [
1597
+ "@source inline(",
1598
+ className,
1599
+ ");"
1600
+ ]
1601
+ }),
1602
+ /*#__PURE__*/ jsxRuntime.jsxs("span", {
1603
+ children: [
1604
+ textString,
1605
+ link && /*#__PURE__*/ jsxRuntime.jsx(core$1.Anchor, {
1606
+ classNames: {
1607
+ root: mergedClassname
1608
+ },
1609
+ href: link,
1610
+ children: ` ${linkText ?? link}.`
1611
+ })
1612
+ ]
1613
+ })
1614
+ ]
1594
1615
  });
1595
1616
  }
1596
1617
  case "text":
1597
1618
  default:
1598
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
1619
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
1599
1620
  className: className,
1600
- "aria-label": "Plain text content",
1601
- children: /*#__PURE__*/ jsxRuntime.jsx("p", {
1602
- children: text.toString()
1603
- })
1621
+ children: [
1622
+ /*#__PURE__*/ jsxRuntime.jsxs("style", {
1623
+ children: [
1624
+ "@source inline(",
1625
+ className,
1626
+ ");"
1627
+ ]
1628
+ }),
1629
+ /*#__PURE__*/ jsxRuntime.jsx("p", {
1630
+ children: text.toString()
1631
+ })
1632
+ ]
1604
1633
  });
1605
1634
  }
1606
1635
  };
@@ -2094,7 +2123,6 @@ const Gen3ModalsProvider = ({ config, children })=>{
2094
2123
  });
2095
2124
  };
2096
2125
 
2097
- // import { BinGuru } from 'binguru';
2098
2126
  const capitalize = (original)=>{
2099
2127
  if (original === undefined) {
2100
2128
  throw new Error('capitalize: original is undefined');
@@ -2133,6 +2161,30 @@ const processRangeKeyLabel = (key)=>{
2133
2161
  spans = spans.concat(new Array(numLastRow).fill(Math.floor(12 / numLastRow)));
2134
2162
  return spans;
2135
2163
  };
2164
+ /**
2165
+ * Filters the keys from the provided aggregation data based on a given list of keys to remove.
2166
+ *
2167
+ * This function processes an `AggregationsData` object by iterating through its properties.
2168
+ * It removes elements from the data that match any of the keys specified in the `keysToRemove` array.
2169
+ * The filtering applies specifically to elements with a valid `key` property of type == string.
2170
+ * If the `key` is empty or matches one of the `keysToRemove`, it is excluded from the resulting object.
2171
+ *
2172
+ * @param {AggregationsData} data - The aggregation data object to filter. Expected to have properties that
2173
+ * are arrays of items containing a `key` property.
2174
+ * @param {Array<string>} keysToRemove - Array of string keys that should be removed from the aggregation data.
2175
+ * @returns {AggregationsData} A new `AggregationsData` object with filtered entries,
2176
+ * omitting the specified keys.
2177
+ */ const filterAggregationsDataKeys = (data, keysToRemove)=>{
2178
+ if (!data || typeof data !== 'object') {
2179
+ return {};
2180
+ }
2181
+ return Object.entries(data).reduce((acc, [key, chartData])=>{
2182
+ if (Array.isArray(chartData)) {
2183
+ acc[key] = chartData.filter((x)=>x && typeof x.key === 'string' && !keysToRemove.includes(x.key));
2184
+ }
2185
+ return acc;
2186
+ }, {});
2187
+ };
2136
2188
 
2137
2189
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2138
2190
  function DefaultItemRenderer(_props) {
@@ -5634,8 +5686,19 @@ const ProtectedContent = ({ children, referer })=>{
5634
5686
  onUnauthenticated();
5635
5687
  }, 2000);
5636
5688
  };
5689
+ const [stableStatus, setStableStatus] = React.useState();
5637
5690
  const { status, pending } = useSession(true, delayRedirect);
5638
- if (status !== 'issued') {
5691
+ React.useEffect(()=>{
5692
+ if (!pending && stableStatus !== status) {
5693
+ // only update stableStatus if session is not pending
5694
+ // this prevents flickering of the status
5695
+ setStableStatus(status);
5696
+ }
5697
+ }, [
5698
+ status,
5699
+ pending
5700
+ ]);
5701
+ if (stableStatus !== 'issued') {
5639
5702
  // not logged in
5640
5703
  if (pending) return /*#__PURE__*/ jsxRuntime.jsx("div", {
5641
5704
  className: "flex justify-center w-full mt-10",
@@ -11310,160 +11373,6 @@ const CohortManager$1 = ({ index })=>{
11310
11373
  });
11311
11374
  };
11312
11375
 
11313
- function isQueryResponse(obj) {
11314
- // Considering that the data property can be optional
11315
- return typeof obj === 'object' && (obj.data === undefined || typeof obj.data === 'object');
11316
- }
11317
- const ExtractData = (data, index)=>{
11318
- if (data === undefined || data === null) return {};
11319
- if (data.data === undefined || data.data === null) return {};
11320
- return Array.isArray(data.data[index]) && data.data[index].length > 0 ? data.data[index][0] : {};
11321
- };
11322
- const QueryRowDetailsPanel = ({ id, index, tableConfig, accessibility })=>{
11323
- //const [queryGuppy, { data, isLoading, isError }] = useLazyGeneralGQLQuery();
11324
- const idField = tableConfig.detailsConfig?.idField;
11325
- const { data, isLoading, isError } = core.useGeneralGQLQuery({
11326
- query: `query ($filter: JSON) {
11327
- ${index} (filter: $filter, accessibility: all) {
11328
- ${tableConfig.fields}
11329
- }
11330
- }`,
11331
- variables: {
11332
- filter: {
11333
- AND: [
11334
- {
11335
- IN: {
11336
- [idField ?? 0]: [
11337
- id
11338
- ]
11339
- }
11340
- }
11341
- ]
11342
- }
11343
- }
11344
- });
11345
- if (!idField) {
11346
- return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
11347
- message: 'idField not configure in Tables Details Config'
11348
- });
11349
- }
11350
- if (isError) {
11351
- return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
11352
- message: 'Error occurred while fetching data'
11353
- });
11354
- }
11355
- const queryData = isQueryResponse(data) ? ExtractData(data, index) : {};
11356
- const rows = Object.entries(queryData).map(([field, value])=>/*#__PURE__*/ jsxRuntime.jsxs("tr", {
11357
- children: [
11358
- /*#__PURE__*/ jsxRuntime.jsx("td", {
11359
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
11360
- fw: "bold",
11361
- children: field
11362
- })
11363
- }),
11364
- /*#__PURE__*/ jsxRuntime.jsx("td", {
11365
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
11366
- children: value ? value : ''
11367
- })
11368
- })
11369
- ]
11370
- }, field));
11371
- return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
11372
- children: [
11373
- /*#__PURE__*/ jsxRuntime.jsx(core$1.LoadingOverlay, {
11374
- visible: isLoading
11375
- }),
11376
- /*#__PURE__*/ jsxRuntime.jsxs(core$1.Text, {
11377
- c: "primary.4",
11378
- children: [
11379
- "Results for ",
11380
- id
11381
- ]
11382
- }),
11383
- /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table, {
11384
- withTableBorder: true,
11385
- withColumnBorders: true,
11386
- children: [
11387
- /*#__PURE__*/ jsxRuntime.jsx("thead", {
11388
- children: /*#__PURE__*/ jsxRuntime.jsxs("tr", {
11389
- children: [
11390
- /*#__PURE__*/ jsxRuntime.jsx("th", {
11391
- children: "Field"
11392
- }),
11393
- /*#__PURE__*/ jsxRuntime.jsx("th", {
11394
- children: "Value"
11395
- })
11396
- ]
11397
- })
11398
- }),
11399
- /*#__PURE__*/ jsxRuntime.jsx("tbody", {
11400
- children: rows
11401
- })
11402
- ]
11403
- })
11404
- ]
11405
- });
11406
- };
11407
-
11408
- const RowTableDetailsPanel = ({ row })=>{
11409
- const rowData = row?.original ?? {};
11410
- const rows = Object.entries(rowData).map(([field, value])=>/*#__PURE__*/ jsxRuntime.jsxs(core$1.Table.Tr, {
11411
- children: [
11412
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Td, {
11413
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
11414
- fw: "bold",
11415
- children: field
11416
- })
11417
- }),
11418
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Td, {
11419
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
11420
- children: value ? value : ''
11421
- })
11422
- })
11423
- ]
11424
- }, field));
11425
- return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table, {
11426
- striped: true,
11427
- highlightOnHover: true,
11428
- withTableBorder: true,
11429
- withColumnBorders: true,
11430
- children: [
11431
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Thead, {
11432
- children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table.Tr, {
11433
- children: [
11434
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Th, {
11435
- children: "Field"
11436
- }),
11437
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Th, {
11438
- children: "Value"
11439
- })
11440
- ]
11441
- })
11442
- }),
11443
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Tbody, {
11444
- children: rows
11445
- })
11446
- ]
11447
- });
11448
- };
11449
-
11450
- let instance$2;
11451
- const DefaultRendererCatalog$1 = {
11452
- tableDetails: {
11453
- default: RowTableDetailsPanel,
11454
- queryRowDetails: QueryRowDetailsPanel
11455
- }
11456
- };
11457
- const ExplorerTableDetailsPanelFactory = ()=>{
11458
- if (!instance$2) {
11459
- instance$2 = new RenderFactoryTypedInstance();
11460
- }
11461
- return instance$2;
11462
- };
11463
- const registerCohortBuilderDefaultPreviewRenderers = ()=>{
11464
- ExplorerTableDetailsPanelFactory().registerRendererCatalog(DefaultRendererCatalog$1);
11465
- };
11466
-
11467
11376
  const DEFAULT_PROPS = {
11468
11377
  body: 'bg-base-max',
11469
11378
  header: '!bg-primary !pb-9 !mb-9',
@@ -11606,12 +11515,12 @@ const LinkCellFunctionCatalog = {
11606
11515
  default: RenderLinkCell,
11607
11516
  linkWithValueMap: RenderLinkCellUsingValueMap
11608
11517
  };
11609
- let instance$1;
11518
+ let instance$2;
11610
11519
  const ExplorerTableCellRendererFactory = ()=>{
11611
- if (!instance$1) {
11612
- instance$1 = new RenderFactoryTypedInstance();
11520
+ if (!instance$2) {
11521
+ instance$2 = new RenderFactoryTypedInstance();
11613
11522
  }
11614
- return instance$1;
11523
+ return instance$2;
11615
11524
  };
11616
11525
  // register default cell renderers
11617
11526
  const registerExplorerDefaultCellRenderers = ()=>{
@@ -11878,6 +11787,91 @@ const SubtableStack = ({ subTables, data })=>{
11878
11787
  });
11879
11788
  };
11880
11789
 
11790
+ function isQueryResponse(obj) {
11791
+ // Considering that the data property can be optional
11792
+ return typeof obj === 'object' && (obj.data === undefined || typeof obj.data === 'object');
11793
+ }
11794
+ const ExtractData = (data, index, path)=>{
11795
+ if (data === undefined || data === null) return {};
11796
+ if (data.data === undefined || data.data === null) return {};
11797
+ if (!lodash.isArray(data.data[index])) return {};
11798
+ let rowData = data.data[index][0];
11799
+ if (path) {
11800
+ const tmp = jsonpathPlus.JSONPath({
11801
+ path: path,
11802
+ json: data.data[index][0]
11803
+ });
11804
+ if (!lodash.isArray(tmp)) {
11805
+ return {};
11806
+ }
11807
+ if (tmp.length > 0) {
11808
+ rowData = tmp[0];
11809
+ }
11810
+ }
11811
+ return rowData;
11812
+ };
11813
+ const QueryRowDetailsPanel = ({ id, index, tableConfig, accessibility })=>{
11814
+ //const [queryGuppy, { data, isLoading, isError }] = useLazyGeneralGQLQuery();
11815
+ const idField = tableConfig.detailsConfig?.idField;
11816
+ const simpleDetailsView = tableConfig.detailsConfig?.simpleDetailsView;
11817
+ const { setStudyDetails } = useStudyContext();
11818
+ const [opened, { open, close }] = hooks.useDisclosure(false);
11819
+ const { data, isError, isFetching } = core.useGetRawDataAndTotalCountsQuery({
11820
+ type: index,
11821
+ fields: tableConfig.fields,
11822
+ filters: {
11823
+ mode: 'and',
11824
+ root: {
11825
+ [idField]: buildNested(idField, {
11826
+ operator: '=',
11827
+ field: idField,
11828
+ operand: id
11829
+ })
11830
+ }
11831
+ },
11832
+ offset: 0,
11833
+ size: 1,
11834
+ accessibility: accessibility
11835
+ }, {
11836
+ skip: !idField || !id
11837
+ });
11838
+ const queryData = React.useMemo(()=>isQueryResponse(data) ? ExtractData(data, index, tableConfig?.detailsConfig?.dataPath) : {}, [
11839
+ data,
11840
+ index,
11841
+ tableConfig?.detailsConfig?.dataPath
11842
+ ]);
11843
+ React.useEffect(()=>{
11844
+ setStudyDetails(queryData);
11845
+ }, [
11846
+ queryData,
11847
+ setStudyDetails
11848
+ ]);
11849
+ if (!idField) {
11850
+ return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
11851
+ message: 'idField not configure in Tables Details Config'
11852
+ });
11853
+ }
11854
+ if (isError) {
11855
+ return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
11856
+ message: 'Error occurred while fetching data'
11857
+ });
11858
+ }
11859
+ // Inital attempt at using Study Details component
11860
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
11861
+ children: [
11862
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.LoadingOverlay, {
11863
+ visible: isFetching
11864
+ }),
11865
+ simpleDetailsView ? /*#__PURE__*/ jsxRuntime.jsx(SinglePageStudyDetailsPanel, {
11866
+ data: queryData ?? {},
11867
+ studyConfig: simpleDetailsView
11868
+ }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
11869
+ children: "Study Details Panel not configured"
11870
+ })
11871
+ ]
11872
+ });
11873
+ };
11874
+
11881
11875
  const DEFAULT_PAGE_LIMIT_LABEL = 'Rows per Page (Limited to 10,0000):';
11882
11876
  const DEFAULT_PAGE_LIMIT = 10000;
11883
11877
  /**
@@ -11896,9 +11890,15 @@ const DEFAULT_PAGE_LIMIT = 10000;
11896
11890
  const [sorting, setSorting] = React.useState([]);
11897
11891
  const [rowSelection, setRowSelection] = React.useState({});
11898
11892
  const [selectedRow, setSelectedRow] = React.useState(undefined);
11899
- const DetailsPanel = React.useMemo(()=>ExplorerTableDetailsPanelFactory().getRenderer('tableDetails', tableConfig?.detailsConfig?.panel ?? 'default'), [
11900
- tableConfig?.detailsConfig?.panel
11901
- ]);
11893
+ // const DetailsPanel = useMemo(
11894
+ // () =>
11895
+ // ExplorerTableDetailsPanelFactory().getRenderer(
11896
+ // 'tableDetails',
11897
+ // tableConfig?.detailsConfig?.panel ?? 'default',
11898
+ // ),
11899
+ // [tableConfig?.detailsConfig?.panel],
11900
+ // );
11901
+ const DetailsPanel = React.useMemo(()=>QueryRowDetailsPanel, []);
11902
11902
  const tableColumns = useDeepCompare.useDeepCompareMemo(()=>{
11903
11903
  return createTableColumns(tableConfig);
11904
11904
  }, [
@@ -11911,7 +11911,18 @@ const DEFAULT_PAGE_LIMIT = 10000;
11911
11911
  const getRowId = React.useCallback((tableConfig)=>{
11912
11912
  const { detailsConfig } = tableConfig || {};
11913
11913
  const idField = detailsConfig?.idField;
11914
- return (originalRow)=>idField && Object.keys(originalRow).includes(idField) ? originalRow[idField] : undefined;
11914
+ if (!idField) return undefined;
11915
+ return (originalRow)=>{
11916
+ const id = jsonpathPlus.JSONPath({
11917
+ json: originalRow,
11918
+ path: idField
11919
+ });
11920
+ if (id.length > 0) {
11921
+ return id[0];
11922
+ } else {
11923
+ return undefined;
11924
+ }
11925
+ };
11915
11926
  }, []);
11916
11927
  const cohortFilters = core.useCoreSelector((state)=>core.selectIndexFilters(state, index));
11917
11928
  const { data, isLoading, isError, isFetching } = core.useGetRawDataAndTotalCountsQuery({
@@ -12040,29 +12051,31 @@ const DEFAULT_PAGE_LIMIT = 10000;
12040
12051
  } else return null;
12041
12052
  } : undefined
12042
12053
  });
12043
- return /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
12044
- children: [
12045
- Object.keys(rowSelection).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(DetailsComponent, {
12046
- title: tableConfig?.detailsConfig?.title,
12047
- id: Object.keys(rowSelection).length > 0 ? Object.keys(rowSelection).at(0) : undefined,
12048
- row: selectedRow,
12049
- onClose: ()=>setRowSelection({}),
12050
- panel: DetailsPanel,
12051
- classNames: tableConfig?.detailsConfig?.classNames,
12052
- panelProps: {
12053
- index,
12054
- tableConfig,
12055
- ...tableConfig?.detailsConfig?.params ?? {},
12056
- accessibility
12057
- }
12058
- }) : null,
12059
- /*#__PURE__*/ jsxRuntime.jsx("div", {
12060
- className: "inline-block overflow-x-scroll",
12061
- children: /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
12062
- table: table
12054
+ return /*#__PURE__*/ jsxRuntime.jsx(React.Fragment, {
12055
+ children: /*#__PURE__*/ jsxRuntime.jsxs(StudyProvider, {
12056
+ children: [
12057
+ Object.keys(rowSelection).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(DetailsComponent, {
12058
+ title: tableConfig?.detailsConfig?.title,
12059
+ id: Object.keys(rowSelection).length > 0 ? Object.keys(rowSelection).at(0) : undefined,
12060
+ row: selectedRow,
12061
+ onClose: ()=>setRowSelection({}),
12062
+ panel: DetailsPanel,
12063
+ classNames: tableConfig?.detailsConfig?.classNames,
12064
+ panelProps: {
12065
+ index,
12066
+ tableConfig,
12067
+ ...tableConfig?.detailsConfig?.params ?? {},
12068
+ accessibility
12069
+ }
12070
+ }) : null,
12071
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
12072
+ className: "inline-block overflow-x-scroll",
12073
+ children: /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
12074
+ table: table
12075
+ })
12063
12076
  })
12064
- })
12065
- ]
12077
+ ]
12078
+ })
12066
12079
  });
12067
12080
  };
12068
12081
 
@@ -12737,6 +12750,25 @@ const EmptyData = {};
12737
12750
  }, {
12738
12751
  skip: chartKeys.length === 0
12739
12752
  });
12753
+ const cleanChartData = useDeepCompare.useDeepCompareMemo(()=>{
12754
+ if (isChartSuccess && chartData) {
12755
+ const cleanedData = {};
12756
+ Object.keys(summaryCharts).forEach((key)=>{
12757
+ // remove empty keys
12758
+ cleanedData[key] = chartData[key].filter((x)=>typeof x.key !== 'string' ? true : x.key !== '');
12759
+ const facetDef = facetDefinitions?.[key];
12760
+ if (facetDef?.excludeValues) {
12761
+ cleanedData[key] = cleanedData[key].filter((x)=>typeof x.key !== 'string' ? true : facetDef?.excludeValues?.includes(String(x.key)) === false);
12762
+ }
12763
+ });
12764
+ return cleanedData;
12765
+ }
12766
+ return chartData;
12767
+ }, [
12768
+ chartData,
12769
+ isChartSuccess,
12770
+ summaryCharts
12771
+ ]);
12740
12772
  const getEnumFacetData = useDeepCompare.useDeepCompareCallback((field)=>{
12741
12773
  let filters = undefined;
12742
12774
  let combineMode = 'or';
@@ -12877,7 +12909,7 @@ const EmptyData = {};
12877
12909
  }); // TODO: replace with configurable message
12878
12910
  }
12879
12911
  return /*#__PURE__*/ jsxRuntime.jsxs("div", {
12880
- className: "flex flex-col mt-3 relative px-4 bg-base-light w-full",
12912
+ className: "flex flex-col mt-3 relative px-4 bg-base-lightest w-full",
12881
12913
  children: [
12882
12914
  /*#__PURE__*/ jsxRuntime.jsx(CohortManager$1, {
12883
12915
  index: index
@@ -12927,24 +12959,21 @@ const EmptyData = {};
12927
12959
  ...chartsSection,
12928
12960
  charts: summaryCharts
12929
12961
  },
12930
- data: chartData ?? EmptyData,
12962
+ data: cleanChartData ?? EmptyData,
12931
12963
  isSuccess: isChartSuccess
12932
12964
  }) : /*#__PURE__*/ jsxRuntime.jsx(Charts, {
12933
12965
  charts: summaryCharts,
12934
- data: chartData ?? EmptyData,
12966
+ data: cleanChartData ?? EmptyData,
12935
12967
  counts: counts,
12936
12968
  isSuccess: isChartSuccess,
12937
12969
  numCols: numCols
12938
12970
  }),
12939
12971
  table?.enabled && /*#__PURE__*/ jsxRuntime.jsx("div", {
12940
12972
  className: "mt-2 flex flex-col",
12941
- children: /*#__PURE__*/ jsxRuntime.jsx("div", {
12942
- className: "grid",
12943
- children: /*#__PURE__*/ jsxRuntime.jsx(ExplorerTable, {
12944
- index: index,
12945
- tableConfig: table,
12946
- accessibility: accessLevel
12947
- })
12973
+ children: /*#__PURE__*/ jsxRuntime.jsx(ExplorerTable, {
12974
+ index: index,
12975
+ tableConfig: table,
12976
+ accessibility: accessLevel
12948
12977
  })
12949
12978
  })
12950
12979
  ]
@@ -12979,16 +13008,20 @@ const TabsLayoutToComponentProp = (tabsLayout)=>{
12979
13008
  }
12980
13009
  };
12981
13010
 
12982
- const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = 'left' })=>{
13011
+ const useGetCurrentCohort = ()=>{
13012
+ return core.useCoreSelector((state)=>core.selectCurrentCohortId(state));
13013
+ };
13014
+ const CohortBuilder$1 = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = 'left' })=>{
12983
13015
  const dispatch = core.useCoreDispatch();
12984
13016
  dispatch(core.setSharedFilters(sharedFiltersMap ?? {}));
12985
13017
  const configuration = useDeepCompare.useDeepCompareMemo(()=>explorerConfig, [
12986
13018
  explorerConfig
12987
13019
  ]);
12988
13020
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
12989
- className: "w-full",
13021
+ className: "w-full mt-2",
12990
13022
  children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Tabs, {
12991
13023
  color: "primary.4",
13024
+ variant: explorerConfig[0]?.tabType,
12992
13025
  keepMounted: true,
12993
13026
  defaultValue: explorerConfig[0].tabTitle,
12994
13027
  children: [
@@ -13019,6 +13052,71 @@ const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = '
13019
13052
  });
13020
13053
  };
13021
13054
 
13055
+ var CohortBuilder$2 = /*#__PURE__*/Object.freeze({
13056
+ __proto__: null,
13057
+ default: CohortBuilder$1,
13058
+ useGetCurrentCohort: useGetCurrentCohort
13059
+ });
13060
+
13061
+ const RowTableDetailsPanel = ({ row })=>{
13062
+ const rowData = row?.original ?? {};
13063
+ const rows = Object.entries(rowData).map(([field, value])=>/*#__PURE__*/ jsxRuntime.jsxs(core$1.Table.Tr, {
13064
+ children: [
13065
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Td, {
13066
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
13067
+ fw: "bold",
13068
+ children: field
13069
+ })
13070
+ }),
13071
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Td, {
13072
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
13073
+ children: value ? value : ''
13074
+ })
13075
+ })
13076
+ ]
13077
+ }, field));
13078
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table, {
13079
+ striped: true,
13080
+ highlightOnHover: true,
13081
+ withTableBorder: true,
13082
+ withColumnBorders: true,
13083
+ children: [
13084
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Thead, {
13085
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table.Tr, {
13086
+ children: [
13087
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Th, {
13088
+ children: "Field"
13089
+ }),
13090
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Th, {
13091
+ children: "Value"
13092
+ })
13093
+ ]
13094
+ })
13095
+ }),
13096
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Tbody, {
13097
+ children: rows
13098
+ })
13099
+ ]
13100
+ });
13101
+ };
13102
+
13103
+ let instance$1;
13104
+ const DefaultRendererCatalog$1 = {
13105
+ tableDetails: {
13106
+ default: RowTableDetailsPanel,
13107
+ queryRowDetails: QueryRowDetailsPanel
13108
+ }
13109
+ };
13110
+ const ExplorerTableDetailsPanelFactory = ()=>{
13111
+ if (!instance$1) {
13112
+ instance$1 = new RenderFactoryTypedInstance();
13113
+ }
13114
+ return instance$1;
13115
+ };
13116
+ const registerCohortBuilderDefaultPreviewRenderers = ()=>{
13117
+ ExplorerTableDetailsPanelFactory().registerRendererCatalog(DefaultRendererCatalog$1);
13118
+ };
13119
+
13022
13120
  const useCustomFacets = ()=>({
13023
13121
  data: [],
13024
13122
  isSuccess: true
@@ -14523,12 +14621,39 @@ const StaticNotebookViewer = ({ notebook })=>{
14523
14621
 
14524
14622
  const StaticNotebookIFrame = ({ notebook })=>{
14525
14623
  const router = router$1.useRouter();
14624
+ const iframeRef = React.useRef(null);
14625
+ React.useEffect(()=>{
14626
+ const iframe = iframeRef.current;
14627
+ const handleLoad = ()=>{
14628
+ try {
14629
+ // Access iframe document
14630
+ if (iframe) {
14631
+ const iframeDoc = iframe.contentDocument || iframe?.contentWindow?.document;
14632
+ // Find all anchor tags and add target="_blank"
14633
+ const links = iframeDoc?.querySelectorAll('a');
14634
+ links?.forEach((link)=>{
14635
+ link.setAttribute('target', '_blank');
14636
+ link.setAttribute('rel', 'noreferrer');
14637
+ });
14638
+ }
14639
+ } catch (error) {
14640
+ console.error('Cannot access iframe content:', error);
14641
+ }
14642
+ };
14643
+ if (iframe) {
14644
+ iframe.addEventListener('load', handleLoad);
14645
+ return ()=>iframe.removeEventListener('load', handleLoad);
14646
+ }
14647
+ }, []);
14526
14648
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
14527
14649
  className: "flex w-full h-full",
14528
14650
  children: /*#__PURE__*/ jsxRuntime.jsx("div", {
14529
14651
  className: "flex justify-items-center w-full",
14530
14652
  children: /*#__PURE__*/ jsxRuntime.jsx("iframe", {
14531
- allow: "cross-origin",
14653
+ ref: iframeRef,
14654
+ sandbox: "allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",
14655
+ referrerPolicy: "strict-origin-when-cross-origin",
14656
+ allow: "geolocation 'none'; microphone 'none'; camera 'none'",
14532
14657
  src: `${router.basePath}/${GEN3_STATIC_NOTEBOOK_DIR}/${notebook}`,
14533
14658
  width: "100%",
14534
14659
  height: "100%",
@@ -14562,7 +14687,7 @@ class FilesystemContent {
14562
14687
  try {
14563
14688
  const files = myGlob(path.join(this.rootPath, filepath), filter);
14564
14689
  return Promise.all(files.map((file)=>this.get(path.join(filepath, file))));
14565
- } catch (err) {
14690
+ } catch (_err) {
14566
14691
  throw new Error(`getAllCannot process ${path.join(this.rootPath, filepath)}/${filter}`);
14567
14692
  }
14568
14693
  }
@@ -14617,12 +14742,18 @@ var ContentSource$1 = ContentSource.getInstance();
14617
14742
  * @returns A Promise resolving to an object containing header and footer props.
14618
14743
  */ const getNavPageLayoutPropsFromConfig = async ()=>{
14619
14744
  const navigationConfigJSON = await ContentSource$1.getContentDatabase().get(`${core.GEN3_COMMONS_NAME}/navigation.json`);
14620
- let bannerConfigJSON = [];
14621
- try {
14622
- bannerConfigJSON = await ContentSource$1.getContentDatabase().get(`${core.GEN3_COMMONS_NAME}/banner.json`);
14623
- } catch (error) {
14624
- console.warn('No banner config found at: ', `${core.GEN3_COMMONS_NAME}/banner.json`);
14625
- }
14745
+ const bannerConfigJSON = [];
14746
+ // TODO: enable later
14747
+ // try {
14748
+ // bannerConfigJSON = await ContentSource.getContentDatabase().get(
14749
+ // `${GEN3_COMMONS_NAME}/banner.json`,
14750
+ // );
14751
+ // } catch (error: unknown) {
14752
+ // console.warn(
14753
+ // 'No banner config found at: ',
14754
+ // `${GEN3_COMMONS_NAME}/banner.json`,
14755
+ // );
14756
+ // }
14626
14757
  const { topBar, navigation, type = 'original' } = navigationConfigJSON;
14627
14758
  let headerMetadata = {
14628
14759
  title: 'Gen3 Frontend Framework Page',
@@ -15208,8 +15339,9 @@ const cohortsAdapter = toolkit.createEntityAdapter({
15208
15339
  const DEFAULT_COHORT_NAME = 'Default';
15209
15340
  const loadCohortsFromStorage = toolkit.createAsyncThunk('cohorts/loadFromStorage', async ()=>{
15210
15341
  try {
15211
- const cohortsMap = await cohortStorage.getAllCohorts();
15212
- return Object(cohortsMap).values();
15342
+ const results = await cohortStorage.getAllCohorts();
15343
+ if (results.data) return Object.values(results.data);
15344
+ else return [];
15213
15345
  } catch (error) {
15214
15346
  console.error('Failed to load cohorts:', error);
15215
15347
  return [];
@@ -15251,11 +15383,13 @@ const deleteCohortFromStorage = toolkit.createAsyncThunk('cohorts/deleteFromStor
15251
15383
  return cohortId;
15252
15384
  });
15253
15385
  const emptyInitialState = cohortsAdapter.getInitialState({
15254
- currentCohortId: 'empty',
15386
+ currentCohortId: 'uninitialized',
15255
15387
  loading: false,
15388
+ uninitialized: true,
15256
15389
  error: null,
15257
15390
  autoSaveInProgress: []
15258
15391
  });
15392
+ // const initialState = emptyInitialState;
15259
15393
  const initialState = cohortsAdapter.addOne(emptyInitialState, createDefaultCohort());
15260
15394
  const updateAutoSave = (cohortId, state)=>{
15261
15395
  // Add to auto-save queue if not already present
@@ -15436,16 +15570,24 @@ const cohortManagerSlice = toolkit.createSlice({
15436
15570
  extraReducers: (builder)=>{
15437
15571
  builder.addCase(loadCohortsFromStorage.pending, (state)=>{
15438
15572
  state.loading = true;
15573
+ state.uninitialized = false;
15439
15574
  state.error = null;
15575
+ console.log('loadCohortsFromStorage.pending');
15440
15576
  }).addCase(loadCohortsFromStorage.fulfilled, (state, action)=>{
15441
15577
  state.loading = false;
15578
+ console.log('loadCohortsFromStorage.fulfilled', action.payload);
15442
15579
  if (action.payload.length > 0) {
15443
- if (Object.keys(state.entities).length === 1) {
15444
- cohortsAdapter.removeOne(state, state.entities[0].id);
15580
+ if (Object.keys(state.entities).length >= 0) {
15581
+ cohortsAdapter.removeAll(state);
15445
15582
  }
15446
15583
  cohortsAdapter.addMany(state, action.payload);
15447
15584
  const sortedCohorts = action.payload.sort((a, b)=>b.modifiedDatetime.localeCompare(a.modifiedDatetime));
15448
15585
  state.currentCohortId = sortedCohorts[0].id;
15586
+ } else {
15587
+ // No cohorts in storage, create default cohort
15588
+ const defaultCohort = createDefaultCohort();
15589
+ cohortsAdapter.addOne(state, defaultCohort);
15590
+ state.currentCohortId = defaultCohort.id;
15449
15591
  }
15450
15592
  }).addCase(loadCohortsFromStorage.rejected, (state, action)=>{
15451
15593
  state.loading = false;
@@ -15502,6 +15644,7 @@ const cohortManagerReducer = cohortManagerSlice.reducer;
15502
15644
  const getCurrentCohort = (state)=>{
15503
15645
  const cohort = state.entities[state.currentCohortId];
15504
15646
  if (!cohort) {
15647
+ console.log('creating default cohort');
15505
15648
  return createDefaultCohort();
15506
15649
  }
15507
15650
  return cohort;
@@ -15611,7 +15754,6 @@ const reducers = redux.combineReducers({
15611
15754
  filtersExpandedState: filtersExpandedReducer,
15612
15755
  facetDefinitionState: facetDefinitionsReducer,
15613
15756
  cohorts: cohortManagerReducer,
15614
- // savedCohorts: saveCohortPersistenceReducer,
15615
15757
  dataAccessRequests: dataAccessRequestsReducer
15616
15758
  });
15617
15759
  const persistedReducers = reduxPersist.persistReducer(persistConfig, reducers);
@@ -15622,6 +15764,10 @@ const { id, AppStore, AppContext, useAppSelector, useAppDispatch } = core.create
15622
15764
  version: '0.0.1'
15623
15765
  });
15624
15766
 
15767
+ process.env.GEN3_COHORT_DISCOVERY_API || `${core.GEN3_API}/api/auth/analysis/cohortDiscovery`;
15768
+ const UninitializeCohort = {
15769
+ filters: {}};
15770
+
15625
15771
  // Selectors
15626
15772
  const { selectAll: selectAllCohorts, selectTotal: selectTotalCohorts, selectById: selectCohortById, selectIds: selectCohortIds } = cohortsAdapter.getSelectors((state)=>state.cohorts);
15627
15773
  const selectCurrentCohortId = (state)=>state.cohorts.currentCohortId;
@@ -15629,7 +15775,7 @@ const selectCurrentCohort = (state)=>{
15629
15775
  const { currentCohortId, entities } = state.cohorts;
15630
15776
  const cohort = entities[currentCohortId];
15631
15777
  if (!cohort) {
15632
- return createDefaultCohort();
15778
+ return null;
15633
15779
  }
15634
15780
  return cohort;
15635
15781
  };
@@ -15651,15 +15797,15 @@ toolkit.createSelector([
15651
15797
  ], (autoSaveArray, cohortId)=>autoSaveArray.includes(cohortId));
15652
15798
  const selectCurrentCohortName = toolkit.createSelector([
15653
15799
  selectCurrentCohort
15654
- ], (cohort)=>cohort.name);
15800
+ ], (cohort)=>cohort?.name ?? 'No Cohort Defined');
15655
15801
  const selectCurrentCohortFilters = toolkit.createSelector([
15656
15802
  selectCurrentCohort
15657
- ], (cohort)=>cohort.filters);
15803
+ ], (cohort)=>cohort ? cohort.filters : UninitializeCohort.filters);
15658
15804
  const selectCurrentCohortIndexFilters = toolkit.createSelector([
15659
15805
  selectCurrentCohort,
15660
15806
  (state, index)=>index
15661
15807
  ], (cohort, index)=>{
15662
- return cohort.filters?.[index] ?? EmptyFilterSet;
15808
+ return cohort?.filters?.[index] ?? EmptyFilterSet;
15663
15809
  });
15664
15810
  toolkit.createSelector([
15665
15811
  selectAllCohorts,
@@ -15671,7 +15817,6 @@ toolkit.createSelector([
15671
15817
  const trimmedName = params.name.trim().toLowerCase();
15672
15818
  return cohorts.some((cohort)=>cohort.id !== params.excludeId && cohort.name.trim().toLowerCase() === trimmedName);
15673
15819
  });
15674
- const selectCohortManagerLoading = (state)=>state.cohorts.loading;
15675
15820
  const selectCohortIdToNameMap = toolkit.createSelector([
15676
15821
  selectAllCohorts
15677
15822
  ], (cohorts)=>{
@@ -16138,14 +16283,12 @@ const submitCohortRequestAction = async (cohort, values, user, indexResources, r
16138
16283
  }
16139
16284
  };
16140
16285
 
16141
- const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16142
- const dispatch = useAppDispatch();
16286
+ const CohortManagerPanel = ({ indexResources, remoteSupportService, size = 'md' })=>{
16287
+ const appDispatch = useAppDispatch();
16143
16288
  const [isEditing, setIsEditing] = React.useState(false);
16144
16289
  const [editingLabel, setEditingLabel] = React.useState('');
16145
16290
  const allCohorts = useAppSelector(selectAllCohorts);
16146
16291
  const currentCohort = useAppSelector(selectCurrentCohort);
16147
- const loading = useAppSelector(selectCohortManagerLoading);
16148
- const appDispatch = useAppDispatch();
16149
16292
  const [getGetAggs] = core.useLazyGetAggsNoFilterSelfQuery();
16150
16293
  const [requestQuery] = core.useCreateRequestMutation();
16151
16294
  const user = core.useCoreSelector(core.selectUserDetails);
@@ -16162,7 +16305,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16162
16305
  };
16163
16306
  const saveEdit = ()=>{
16164
16307
  if (editingLabel.trim() === '' || !currentCohort.name) return;
16165
- dispatch(updateCohortName({
16308
+ appDispatch(updateCohortName({
16166
16309
  id: currentCohort.id,
16167
16310
  name: editingLabel
16168
16311
  }));
@@ -16170,7 +16313,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16170
16313
  setEditingLabel('');
16171
16314
  };
16172
16315
  const handleCreateNew = ()=>{
16173
- dispatch(createNewCohort({
16316
+ appDispatch(createNewCohort({
16174
16317
  name: 'New Cohort'
16175
16318
  }));
16176
16319
  };
@@ -16182,22 +16325,26 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16182
16325
  }, [
16183
16326
  allCohorts
16184
16327
  ]);
16328
+ useDeepCompare.useDeepCompareEffect(()=>{
16329
+ if (!currentCohort) {
16330
+ setCurrentCohortId(allCohorts[0].id);
16331
+ }
16332
+ }, [
16333
+ allCohorts,
16334
+ currentCohort,
16335
+ setCurrentCohortId
16336
+ ]);
16185
16337
  const onSelectCohort = React.useCallback((_value, option)=>{
16186
16338
  if (option) {
16187
- dispatch(setCurrentCohortId(option.value));
16339
+ appDispatch(setCurrentCohortId(option.value));
16188
16340
  }
16189
16341
  }, [
16190
- dispatch
16342
+ appDispatch
16191
16343
  ]);
16192
16344
  const handleCohortAccessRequest = async (cohortId, values)=>{
16193
16345
  const cohort = allCohorts.find((obj)=>obj.id === cohortId);
16194
16346
  if (cohort) await submitCohortRequestAction(cohort, values, user, indexResources, remoteSupportService, appDispatch, getGetAggs, requestQuery);
16195
16347
  };
16196
- if (loading) {
16197
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
16198
- children: "Loading cohorts..."
16199
- });
16200
- }
16201
16348
  return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
16202
16349
  gap: "xs",
16203
16350
  className: "flex pt-4 pl-2",
@@ -16255,7 +16402,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16255
16402
  onClick: saveEdit,
16256
16403
  "data-testid": "completeCohortRenameButton",
16257
16404
  "aria-label": "Complete rename cohort",
16258
- disabled: editingLabel.trim() === '' || editingLabel.trim() === currentCohort.name,
16405
+ disabled: editingLabel.trim() === '' || editingLabel.trim() === currentCohort?.name,
16259
16406
  size: `compact-${size}`,
16260
16407
  children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
16261
16408
  icon: "gen3:check",
@@ -16330,7 +16477,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16330
16477
  color: theme.colors.accent[4]
16331
16478
  },
16332
16479
  onConfirm: ()=>{
16333
- dispatch(removeCohort(currentCohort.id));
16480
+ appDispatch(removeCohort(currentCohort.id));
16334
16481
  }
16335
16482
  });
16336
16483
  },
@@ -16372,8 +16519,15 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16372
16519
  ]
16373
16520
  });
16374
16521
  };
16375
-
16376
- process.env.GEN3_COHORT_DISCOVERY_API || `${core.GEN3_API}/api/auth/analysis/cohortDiscovery`;
16522
+ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16523
+ // TODO: initialize and load cohorts from cohort storage
16524
+ // as right now the redux-persist is handling cohorts
16525
+ return /*#__PURE__*/ jsxRuntime.jsx(CohortManagerPanel, {
16526
+ indexResources: indexResources,
16527
+ remoteSupportService: remoteSupportService,
16528
+ size: size
16529
+ });
16530
+ };
16377
16531
 
16378
16532
  const useGraphQLData = (url, body, skip)=>{
16379
16533
  // Create a fetcher function that handles the GraphQL POST request
@@ -16842,22 +16996,6 @@ const SavedCohortsTable = ({ indexResources, remoteSupportService, size = 'md' }
16842
16996
  })
16843
16997
  })
16844
16998
  }),
16845
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
16846
- label: "Select Cohort",
16847
- withArrow: true,
16848
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
16849
- color: "accent.4",
16850
- variant: "transparent",
16851
- "aria-label": "Select cohort",
16852
- onClick: ()=>{},
16853
- children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
16854
- icon: "gen3:cohort",
16855
- height: iconSize,
16856
- width: iconSize,
16857
- color: theme.colors.secondary[4]
16858
- })
16859
- })
16860
- }),
16861
16999
  /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
16862
17000
  label: "Delete Cohort",
16863
17001
  withArrow: true,
@@ -19385,6 +19523,7 @@ const MetadataDictionary = ({ schemas })=>{
19385
19523
  }
19386
19524
  return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Tabs, {
19387
19525
  defaultValue: schemas[0].schemaID,
19526
+ variant: schemas[0]?.tabType,
19388
19527
  className: "w-full",
19389
19528
  keepMounted: false,
19390
19529
  children: [
@@ -19724,6 +19863,7 @@ const Discovery = ({ discoveryConfig })=>{
19724
19863
  children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Tabs, {
19725
19864
  className: "w-full",
19726
19865
  defaultValue: metadataIndex,
19866
+ variant: discoveryConfig.metadataConfig[0]?.tabType,
19727
19867
  onChange: (v)=>{
19728
19868
  setMetadataIndex(v ?? '0');
19729
19869
  },
@@ -20025,6 +20165,9 @@ const LandingPageGetServerSideProps = async ()=>{
20025
20165
  };
20026
20166
  };
20027
20167
 
20168
+ const CohortBuilder = dynamic(()=>Promise.resolve().then(function () { return CohortBuilder$2; }), {
20169
+ ssr: false
20170
+ });
20028
20171
  const ExplorerPage = ({ headerProps, footerProps, explorerConfig, headerMetadata, tabsLayout, sharedFiltersMap })=>{
20029
20172
  if (explorerConfig === undefined) {
20030
20173
  return /*#__PURE__*/ jsxRuntime.jsx(core$1.Center, {
@@ -23642,15 +23785,16 @@ const SelectedItemsTable = ({ validatedItems, rowSelection, setRowSelection, siz
23642
23785
  const table = mantineReactTable.useMantineReactTable({
23643
23786
  columns,
23644
23787
  data: tableRows.rows,
23645
- enableColumnResizing: false,
23646
23788
  icons: TableIcons,
23647
23789
  enableTopToolbar: false,
23648
23790
  enableRowSelection: true,
23649
23791
  enableBottomToolbar: tableRows.rows.length > 10,
23650
23792
  enablePagination: tableRows.rows.length > 10,
23651
23793
  enableRowActions: false,
23652
- enableStickyFooter: true,
23794
+ enableColumnResizing: true,
23795
+ enableGrouping: true,
23653
23796
  enableStickyHeader: true,
23797
+ enableStickyFooter: true,
23654
23798
  enableHiding: true,
23655
23799
  onRowSelectionChange: handleRowSelectionChange,
23656
23800
  state: {
@@ -23658,6 +23802,9 @@ const SelectedItemsTable = ({ validatedItems, rowSelection, setRowSelection, siz
23658
23802
  },
23659
23803
  initialState: {
23660
23804
  density: 'xs',
23805
+ grouping: [
23806
+ 'datasetId'
23807
+ ],
23661
23808
  columnPinning: {
23662
23809
  left: [
23663
23810
  'mrt-row-select',
@@ -25918,6 +26065,13 @@ const staticNotebookAPI = async (req, res)=>{
25918
26065
  });
25919
26066
  }
25920
26067
  const rawContent = fs.readFileSync(fullPath, 'utf8');
26068
+ DOMPurify.addHook('afterSanitizeAttributes', function(node) {
26069
+ if (node.tagName === 'a' || node.tagName === 'A') {
26070
+ // Check for anchor tags and target attribute
26071
+ node.setAttribute('target', '_blank');
26072
+ node.setAttribute('rel', 'noopener'); // Prevent window.opener vulnerability
26073
+ }
26074
+ });
25921
26075
  const sanitizedContent = DOMPurify.sanitize(rawContent, {
25922
26076
  ALLOWED_TAGS: [
25923
26077
  'p',
@@ -25985,7 +26139,7 @@ exports.BAD_DATA_MESSAGE = BAD_DATA_MESSAGE;
25985
26139
  exports.Banner = Banner;
25986
26140
  exports.BaseModal = BaseModal;
25987
26141
  exports.Charts = Charts;
25988
- exports.CohortBuilder = CohortBuilder;
26142
+ exports.CohortBuilder = CohortBuilder$1;
25989
26143
  exports.CohortManager = CohortManager$1;
25990
26144
  exports.CollapsableCharts = CollapsableCharts;
25991
26145
  exports.CollapsableSidebar = CollapsableSidebar;
@@ -26112,6 +26266,7 @@ exports.credentialsLogin = credentialsLogin;
26112
26266
  exports.credentialsLogout = credentialsLogout;
26113
26267
  exports.extractObjectKey = extractObjectKey;
26114
26268
  exports.extractRangeValues = extractRangeValues;
26269
+ exports.filterAggregationsDataKeys = filterAggregationsDataKeys;
26115
26270
  exports.focusStyles = focusStyles;
26116
26271
  exports.getAllFieldsFromFilterConfigs = getAllFieldsFromFilterConfigs;
26117
26272
  exports.getCurrentUnixTimestamp = getCurrentUnixTimestamp;