@gen3/frontend 0.11.17 → 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 (90) hide show
  1. package/dist/cjs/index.js +436 -296
  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/Providers/Gen3Provider.d.ts +21 -21
  9. package/dist/dts/components/charts/utils.d.ts +16 -0
  10. package/dist/dts/components/charts/utils.d.ts.map +1 -1
  11. package/dist/dts/components/charts/utils.js +28 -1
  12. package/dist/dts/components/charts/utils.js.map +1 -1
  13. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +6 -6
  14. package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts +2 -1
  15. package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts.map +1 -1
  16. package/dist/dts/features/CohortBuilder/CohortBuilder.js +5 -3
  17. package/dist/dts/features/CohortBuilder/CohortBuilder.js.map +1 -1
  18. package/dist/dts/features/CohortBuilder/CohortPanel.d.ts.map +1 -1
  19. package/dist/dts/features/CohortBuilder/CohortPanel.js +24 -2
  20. package/dist/dts/features/CohortBuilder/CohortPanel.js.map +1 -1
  21. package/dist/dts/features/CohortBuilder/ExplorerTable/ArrayCellRenderer.d.ts +1 -1
  22. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.d.ts.map +1 -1
  23. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.js +58 -26
  24. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/QueryRowDetailsPanel.js.map +1 -1
  25. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/types.d.ts +3 -0
  26. package/dist/dts/features/CohortBuilder/ExplorerTable/ExploreTableDetails/types.d.ts.map +1 -1
  27. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.d.ts.map +1 -1
  28. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.js +39 -26
  29. package/dist/dts/features/CohortBuilder/ExplorerTable/ExplorerTable.js.map +1 -1
  30. package/dist/dts/features/CohortBuilder/index.d.ts +1 -1
  31. package/dist/dts/features/CohortBuilder/index.d.ts.map +1 -1
  32. package/dist/dts/features/CohortBuilder/index.js +1 -1
  33. package/dist/dts/features/CohortBuilder/index.js.map +1 -1
  34. package/dist/dts/features/CohortBuilder/types.d.ts +1 -0
  35. package/dist/dts/features/CohortBuilder/types.d.ts.map +1 -1
  36. package/dist/dts/features/CohortBuilder/types.js.map +1 -1
  37. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.d.ts +1 -1
  38. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.d.ts.map +1 -1
  39. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js +21 -14
  40. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js.map +1 -1
  41. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.d.ts.map +1 -1
  42. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.js +1 -0
  43. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerMiddleware.js.map +1 -1
  44. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts +11 -10
  45. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts.map +1 -1
  46. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.js +9 -5
  47. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.js.map +1 -1
  48. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.d.ts +1 -0
  49. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.d.ts.map +1 -1
  50. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.js +21 -6
  51. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSlice.js.map +1 -1
  52. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.d.ts.map +1 -1
  53. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js +1 -1
  54. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js.map +1 -1
  55. package/dist/dts/features/CohortDiscovery/appApi.js +1 -1
  56. package/dist/dts/features/CohortDiscovery/appApi.js.map +1 -1
  57. package/dist/dts/features/CohortDiscovery/constants.d.ts +2 -0
  58. package/dist/dts/features/CohortDiscovery/constants.d.ts.map +1 -1
  59. package/dist/dts/features/CohortDiscovery/constants.js +11 -0
  60. package/dist/dts/features/CohortDiscovery/constants.js.map +1 -1
  61. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.d.ts.map +1 -1
  62. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.js +2 -1
  63. package/dist/dts/features/Dictionary/metadata/MetadataDictionary.js.map +1 -1
  64. package/dist/dts/features/Dictionary/metadata/types.d.ts +1 -0
  65. package/dist/dts/features/Dictionary/metadata/types.d.ts.map +1 -1
  66. package/dist/dts/features/Discovery/Discovery.d.ts.map +1 -1
  67. package/dist/dts/features/Discovery/Discovery.js +3 -2
  68. package/dist/dts/features/Discovery/Discovery.js.map +1 -1
  69. package/dist/dts/features/Discovery/types.d.ts +1 -0
  70. package/dist/dts/features/Discovery/types.d.ts.map +1 -1
  71. package/dist/dts/features/Discovery/types.js.map +1 -1
  72. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.d.ts.map +1 -1
  73. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.js +28 -1
  74. package/dist/dts/features/StaticNotebook/StaticNotebookIFrame.js.map +1 -1
  75. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.d.ts.map +1 -1
  76. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.js +7 -0
  77. package/dist/dts/features/StaticNotebook/api/staticNotebookAPI.js.map +1 -1
  78. package/dist/dts/lib/common/staticProps.d.ts.map +1 -1
  79. package/dist/dts/lib/common/staticProps.js +11 -23
  80. package/dist/dts/lib/common/staticProps.js.map +1 -1
  81. package/dist/dts/lib/content/filesystem.js +1 -1
  82. package/dist/dts/lib/content/filesystem.js.map +1 -1
  83. package/dist/dts/pages/Explorer/Explorer.d.ts.map +1 -1
  84. package/dist/dts/pages/Explorer/Explorer.js +4 -1
  85. package/dist/dts/pages/Explorer/Explorer.js.map +1 -1
  86. package/dist/esm/index.js +436 -297
  87. package/dist/esm/index.js.map +1 -1
  88. package/dist/index.d.ts +220 -200
  89. package/dist/tsconfig.tsbuildinfo +1 -1
  90. 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) {
@@ -11321,160 +11373,6 @@ const CohortManager$1 = ({ index })=>{
11321
11373
  });
11322
11374
  };
11323
11375
 
11324
- function isQueryResponse(obj) {
11325
- // Considering that the data property can be optional
11326
- return typeof obj === 'object' && (obj.data === undefined || typeof obj.data === 'object');
11327
- }
11328
- const ExtractData = (data, index)=>{
11329
- if (data === undefined || data === null) return {};
11330
- if (data.data === undefined || data.data === null) return {};
11331
- return Array.isArray(data.data[index]) && data.data[index].length > 0 ? data.data[index][0] : {};
11332
- };
11333
- const QueryRowDetailsPanel = ({ id, index, tableConfig, accessibility })=>{
11334
- //const [queryGuppy, { data, isLoading, isError }] = useLazyGeneralGQLQuery();
11335
- const idField = tableConfig.detailsConfig?.idField;
11336
- const { data, isLoading, isError } = core.useGeneralGQLQuery({
11337
- query: `query ($filter: JSON) {
11338
- ${index} (filter: $filter, accessibility: all) {
11339
- ${tableConfig.fields}
11340
- }
11341
- }`,
11342
- variables: {
11343
- filter: {
11344
- AND: [
11345
- {
11346
- IN: {
11347
- [idField ?? 0]: [
11348
- id
11349
- ]
11350
- }
11351
- }
11352
- ]
11353
- }
11354
- }
11355
- });
11356
- if (!idField) {
11357
- return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
11358
- message: 'idField not configure in Tables Details Config'
11359
- });
11360
- }
11361
- if (isError) {
11362
- return /*#__PURE__*/ jsxRuntime.jsx(ErrorCard, {
11363
- message: 'Error occurred while fetching data'
11364
- });
11365
- }
11366
- const queryData = isQueryResponse(data) ? ExtractData(data, index) : {};
11367
- const rows = Object.entries(queryData).map(([field, value])=>/*#__PURE__*/ jsxRuntime.jsxs("tr", {
11368
- children: [
11369
- /*#__PURE__*/ jsxRuntime.jsx("td", {
11370
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
11371
- fw: "bold",
11372
- children: field
11373
- })
11374
- }),
11375
- /*#__PURE__*/ jsxRuntime.jsx("td", {
11376
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
11377
- children: value ? value : ''
11378
- })
11379
- })
11380
- ]
11381
- }, field));
11382
- return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
11383
- children: [
11384
- /*#__PURE__*/ jsxRuntime.jsx(core$1.LoadingOverlay, {
11385
- visible: isLoading
11386
- }),
11387
- /*#__PURE__*/ jsxRuntime.jsxs(core$1.Text, {
11388
- c: "primary.4",
11389
- children: [
11390
- "Results for ",
11391
- id
11392
- ]
11393
- }),
11394
- /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table, {
11395
- withTableBorder: true,
11396
- withColumnBorders: true,
11397
- children: [
11398
- /*#__PURE__*/ jsxRuntime.jsx("thead", {
11399
- children: /*#__PURE__*/ jsxRuntime.jsxs("tr", {
11400
- children: [
11401
- /*#__PURE__*/ jsxRuntime.jsx("th", {
11402
- children: "Field"
11403
- }),
11404
- /*#__PURE__*/ jsxRuntime.jsx("th", {
11405
- children: "Value"
11406
- })
11407
- ]
11408
- })
11409
- }),
11410
- /*#__PURE__*/ jsxRuntime.jsx("tbody", {
11411
- children: rows
11412
- })
11413
- ]
11414
- })
11415
- ]
11416
- });
11417
- };
11418
-
11419
- const RowTableDetailsPanel = ({ row })=>{
11420
- const rowData = row?.original ?? {};
11421
- const rows = Object.entries(rowData).map(([field, value])=>/*#__PURE__*/ jsxRuntime.jsxs(core$1.Table.Tr, {
11422
- children: [
11423
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Td, {
11424
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
11425
- fw: "bold",
11426
- children: field
11427
- })
11428
- }),
11429
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Td, {
11430
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
11431
- children: value ? value : ''
11432
- })
11433
- })
11434
- ]
11435
- }, field));
11436
- return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table, {
11437
- striped: true,
11438
- highlightOnHover: true,
11439
- withTableBorder: true,
11440
- withColumnBorders: true,
11441
- children: [
11442
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Thead, {
11443
- children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Table.Tr, {
11444
- children: [
11445
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Th, {
11446
- children: "Field"
11447
- }),
11448
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Th, {
11449
- children: "Value"
11450
- })
11451
- ]
11452
- })
11453
- }),
11454
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Table.Tbody, {
11455
- children: rows
11456
- })
11457
- ]
11458
- });
11459
- };
11460
-
11461
- let instance$2;
11462
- const DefaultRendererCatalog$1 = {
11463
- tableDetails: {
11464
- default: RowTableDetailsPanel,
11465
- queryRowDetails: QueryRowDetailsPanel
11466
- }
11467
- };
11468
- const ExplorerTableDetailsPanelFactory = ()=>{
11469
- if (!instance$2) {
11470
- instance$2 = new RenderFactoryTypedInstance();
11471
- }
11472
- return instance$2;
11473
- };
11474
- const registerCohortBuilderDefaultPreviewRenderers = ()=>{
11475
- ExplorerTableDetailsPanelFactory().registerRendererCatalog(DefaultRendererCatalog$1);
11476
- };
11477
-
11478
11376
  const DEFAULT_PROPS = {
11479
11377
  body: 'bg-base-max',
11480
11378
  header: '!bg-primary !pb-9 !mb-9',
@@ -11617,12 +11515,12 @@ const LinkCellFunctionCatalog = {
11617
11515
  default: RenderLinkCell,
11618
11516
  linkWithValueMap: RenderLinkCellUsingValueMap
11619
11517
  };
11620
- let instance$1;
11518
+ let instance$2;
11621
11519
  const ExplorerTableCellRendererFactory = ()=>{
11622
- if (!instance$1) {
11623
- instance$1 = new RenderFactoryTypedInstance();
11520
+ if (!instance$2) {
11521
+ instance$2 = new RenderFactoryTypedInstance();
11624
11522
  }
11625
- return instance$1;
11523
+ return instance$2;
11626
11524
  };
11627
11525
  // register default cell renderers
11628
11526
  const registerExplorerDefaultCellRenderers = ()=>{
@@ -11889,6 +11787,91 @@ const SubtableStack = ({ subTables, data })=>{
11889
11787
  });
11890
11788
  };
11891
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
+
11892
11875
  const DEFAULT_PAGE_LIMIT_LABEL = 'Rows per Page (Limited to 10,0000):';
11893
11876
  const DEFAULT_PAGE_LIMIT = 10000;
11894
11877
  /**
@@ -11907,9 +11890,15 @@ const DEFAULT_PAGE_LIMIT = 10000;
11907
11890
  const [sorting, setSorting] = React.useState([]);
11908
11891
  const [rowSelection, setRowSelection] = React.useState({});
11909
11892
  const [selectedRow, setSelectedRow] = React.useState(undefined);
11910
- const DetailsPanel = React.useMemo(()=>ExplorerTableDetailsPanelFactory().getRenderer('tableDetails', tableConfig?.detailsConfig?.panel ?? 'default'), [
11911
- tableConfig?.detailsConfig?.panel
11912
- ]);
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, []);
11913
11902
  const tableColumns = useDeepCompare.useDeepCompareMemo(()=>{
11914
11903
  return createTableColumns(tableConfig);
11915
11904
  }, [
@@ -11922,7 +11911,18 @@ const DEFAULT_PAGE_LIMIT = 10000;
11922
11911
  const getRowId = React.useCallback((tableConfig)=>{
11923
11912
  const { detailsConfig } = tableConfig || {};
11924
11913
  const idField = detailsConfig?.idField;
11925
- 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
+ };
11926
11926
  }, []);
11927
11927
  const cohortFilters = core.useCoreSelector((state)=>core.selectIndexFilters(state, index));
11928
11928
  const { data, isLoading, isError, isFetching } = core.useGetRawDataAndTotalCountsQuery({
@@ -12051,29 +12051,31 @@ const DEFAULT_PAGE_LIMIT = 10000;
12051
12051
  } else return null;
12052
12052
  } : undefined
12053
12053
  });
12054
- return /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
12055
- children: [
12056
- Object.keys(rowSelection).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(DetailsComponent, {
12057
- title: tableConfig?.detailsConfig?.title,
12058
- id: Object.keys(rowSelection).length > 0 ? Object.keys(rowSelection).at(0) : undefined,
12059
- row: selectedRow,
12060
- onClose: ()=>setRowSelection({}),
12061
- panel: DetailsPanel,
12062
- classNames: tableConfig?.detailsConfig?.classNames,
12063
- panelProps: {
12064
- index,
12065
- tableConfig,
12066
- ...tableConfig?.detailsConfig?.params ?? {},
12067
- accessibility
12068
- }
12069
- }) : null,
12070
- /*#__PURE__*/ jsxRuntime.jsx("div", {
12071
- className: "inline-block overflow-x-scroll",
12072
- children: /*#__PURE__*/ jsxRuntime.jsx(mantineReactTable.MantineReactTable, {
12073
- 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
+ })
12074
12076
  })
12075
- })
12076
- ]
12077
+ ]
12078
+ })
12077
12079
  });
12078
12080
  };
12079
12081
 
@@ -12748,6 +12750,25 @@ const EmptyData = {};
12748
12750
  }, {
12749
12751
  skip: chartKeys.length === 0
12750
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
+ ]);
12751
12772
  const getEnumFacetData = useDeepCompare.useDeepCompareCallback((field)=>{
12752
12773
  let filters = undefined;
12753
12774
  let combineMode = 'or';
@@ -12888,7 +12909,7 @@ const EmptyData = {};
12888
12909
  }); // TODO: replace with configurable message
12889
12910
  }
12890
12911
  return /*#__PURE__*/ jsxRuntime.jsxs("div", {
12891
- 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",
12892
12913
  children: [
12893
12914
  /*#__PURE__*/ jsxRuntime.jsx(CohortManager$1, {
12894
12915
  index: index
@@ -12938,24 +12959,21 @@ const EmptyData = {};
12938
12959
  ...chartsSection,
12939
12960
  charts: summaryCharts
12940
12961
  },
12941
- data: chartData ?? EmptyData,
12962
+ data: cleanChartData ?? EmptyData,
12942
12963
  isSuccess: isChartSuccess
12943
12964
  }) : /*#__PURE__*/ jsxRuntime.jsx(Charts, {
12944
12965
  charts: summaryCharts,
12945
- data: chartData ?? EmptyData,
12966
+ data: cleanChartData ?? EmptyData,
12946
12967
  counts: counts,
12947
12968
  isSuccess: isChartSuccess,
12948
12969
  numCols: numCols
12949
12970
  }),
12950
12971
  table?.enabled && /*#__PURE__*/ jsxRuntime.jsx("div", {
12951
12972
  className: "mt-2 flex flex-col",
12952
- children: /*#__PURE__*/ jsxRuntime.jsx("div", {
12953
- className: "grid",
12954
- children: /*#__PURE__*/ jsxRuntime.jsx(ExplorerTable, {
12955
- index: index,
12956
- tableConfig: table,
12957
- accessibility: accessLevel
12958
- })
12973
+ children: /*#__PURE__*/ jsxRuntime.jsx(ExplorerTable, {
12974
+ index: index,
12975
+ tableConfig: table,
12976
+ accessibility: accessLevel
12959
12977
  })
12960
12978
  })
12961
12979
  ]
@@ -12990,16 +13008,20 @@ const TabsLayoutToComponentProp = (tabsLayout)=>{
12990
13008
  }
12991
13009
  };
12992
13010
 
12993
- 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' })=>{
12994
13015
  const dispatch = core.useCoreDispatch();
12995
13016
  dispatch(core.setSharedFilters(sharedFiltersMap ?? {}));
12996
13017
  const configuration = useDeepCompare.useDeepCompareMemo(()=>explorerConfig, [
12997
13018
  explorerConfig
12998
13019
  ]);
12999
13020
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
13000
- className: "w-full",
13021
+ className: "w-full mt-2",
13001
13022
  children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Tabs, {
13002
13023
  color: "primary.4",
13024
+ variant: explorerConfig[0]?.tabType,
13003
13025
  keepMounted: true,
13004
13026
  defaultValue: explorerConfig[0].tabTitle,
13005
13027
  children: [
@@ -13030,6 +13052,71 @@ const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = '
13030
13052
  });
13031
13053
  };
13032
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
+
13033
13120
  const useCustomFacets = ()=>({
13034
13121
  data: [],
13035
13122
  isSuccess: true
@@ -14534,12 +14621,39 @@ const StaticNotebookViewer = ({ notebook })=>{
14534
14621
 
14535
14622
  const StaticNotebookIFrame = ({ notebook })=>{
14536
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
+ }, []);
14537
14648
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
14538
14649
  className: "flex w-full h-full",
14539
14650
  children: /*#__PURE__*/ jsxRuntime.jsx("div", {
14540
14651
  className: "flex justify-items-center w-full",
14541
14652
  children: /*#__PURE__*/ jsxRuntime.jsx("iframe", {
14542
- 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'",
14543
14657
  src: `${router.basePath}/${GEN3_STATIC_NOTEBOOK_DIR}/${notebook}`,
14544
14658
  width: "100%",
14545
14659
  height: "100%",
@@ -14573,7 +14687,7 @@ class FilesystemContent {
14573
14687
  try {
14574
14688
  const files = myGlob(path.join(this.rootPath, filepath), filter);
14575
14689
  return Promise.all(files.map((file)=>this.get(path.join(filepath, file))));
14576
- } catch (err) {
14690
+ } catch (_err) {
14577
14691
  throw new Error(`getAllCannot process ${path.join(this.rootPath, filepath)}/${filter}`);
14578
14692
  }
14579
14693
  }
@@ -14628,12 +14742,18 @@ var ContentSource$1 = ContentSource.getInstance();
14628
14742
  * @returns A Promise resolving to an object containing header and footer props.
14629
14743
  */ const getNavPageLayoutPropsFromConfig = async ()=>{
14630
14744
  const navigationConfigJSON = await ContentSource$1.getContentDatabase().get(`${core.GEN3_COMMONS_NAME}/navigation.json`);
14631
- let bannerConfigJSON = [];
14632
- try {
14633
- bannerConfigJSON = await ContentSource$1.getContentDatabase().get(`${core.GEN3_COMMONS_NAME}/banner.json`);
14634
- } catch (error) {
14635
- console.warn('No banner config found at: ', `${core.GEN3_COMMONS_NAME}/banner.json`);
14636
- }
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
+ // }
14637
14757
  const { topBar, navigation, type = 'original' } = navigationConfigJSON;
14638
14758
  let headerMetadata = {
14639
14759
  title: 'Gen3 Frontend Framework Page',
@@ -15219,8 +15339,9 @@ const cohortsAdapter = toolkit.createEntityAdapter({
15219
15339
  const DEFAULT_COHORT_NAME = 'Default';
15220
15340
  const loadCohortsFromStorage = toolkit.createAsyncThunk('cohorts/loadFromStorage', async ()=>{
15221
15341
  try {
15222
- const cohortsMap = await cohortStorage.getAllCohorts();
15223
- return Object(cohortsMap).values();
15342
+ const results = await cohortStorage.getAllCohorts();
15343
+ if (results.data) return Object.values(results.data);
15344
+ else return [];
15224
15345
  } catch (error) {
15225
15346
  console.error('Failed to load cohorts:', error);
15226
15347
  return [];
@@ -15262,11 +15383,13 @@ const deleteCohortFromStorage = toolkit.createAsyncThunk('cohorts/deleteFromStor
15262
15383
  return cohortId;
15263
15384
  });
15264
15385
  const emptyInitialState = cohortsAdapter.getInitialState({
15265
- currentCohortId: 'empty',
15386
+ currentCohortId: 'uninitialized',
15266
15387
  loading: false,
15388
+ uninitialized: true,
15267
15389
  error: null,
15268
15390
  autoSaveInProgress: []
15269
15391
  });
15392
+ // const initialState = emptyInitialState;
15270
15393
  const initialState = cohortsAdapter.addOne(emptyInitialState, createDefaultCohort());
15271
15394
  const updateAutoSave = (cohortId, state)=>{
15272
15395
  // Add to auto-save queue if not already present
@@ -15447,16 +15570,24 @@ const cohortManagerSlice = toolkit.createSlice({
15447
15570
  extraReducers: (builder)=>{
15448
15571
  builder.addCase(loadCohortsFromStorage.pending, (state)=>{
15449
15572
  state.loading = true;
15573
+ state.uninitialized = false;
15450
15574
  state.error = null;
15575
+ console.log('loadCohortsFromStorage.pending');
15451
15576
  }).addCase(loadCohortsFromStorage.fulfilled, (state, action)=>{
15452
15577
  state.loading = false;
15578
+ console.log('loadCohortsFromStorage.fulfilled', action.payload);
15453
15579
  if (action.payload.length > 0) {
15454
- if (Object.keys(state.entities).length === 1) {
15455
- cohortsAdapter.removeOne(state, state.entities[0].id);
15580
+ if (Object.keys(state.entities).length >= 0) {
15581
+ cohortsAdapter.removeAll(state);
15456
15582
  }
15457
15583
  cohortsAdapter.addMany(state, action.payload);
15458
15584
  const sortedCohorts = action.payload.sort((a, b)=>b.modifiedDatetime.localeCompare(a.modifiedDatetime));
15459
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;
15460
15591
  }
15461
15592
  }).addCase(loadCohortsFromStorage.rejected, (state, action)=>{
15462
15593
  state.loading = false;
@@ -15513,6 +15644,7 @@ const cohortManagerReducer = cohortManagerSlice.reducer;
15513
15644
  const getCurrentCohort = (state)=>{
15514
15645
  const cohort = state.entities[state.currentCohortId];
15515
15646
  if (!cohort) {
15647
+ console.log('creating default cohort');
15516
15648
  return createDefaultCohort();
15517
15649
  }
15518
15650
  return cohort;
@@ -15622,7 +15754,6 @@ const reducers = redux.combineReducers({
15622
15754
  filtersExpandedState: filtersExpandedReducer,
15623
15755
  facetDefinitionState: facetDefinitionsReducer,
15624
15756
  cohorts: cohortManagerReducer,
15625
- // savedCohorts: saveCohortPersistenceReducer,
15626
15757
  dataAccessRequests: dataAccessRequestsReducer
15627
15758
  });
15628
15759
  const persistedReducers = reduxPersist.persistReducer(persistConfig, reducers);
@@ -15633,6 +15764,10 @@ const { id, AppStore, AppContext, useAppSelector, useAppDispatch } = core.create
15633
15764
  version: '0.0.1'
15634
15765
  });
15635
15766
 
15767
+ process.env.GEN3_COHORT_DISCOVERY_API || `${core.GEN3_API}/api/auth/analysis/cohortDiscovery`;
15768
+ const UninitializeCohort = {
15769
+ filters: {}};
15770
+
15636
15771
  // Selectors
15637
15772
  const { selectAll: selectAllCohorts, selectTotal: selectTotalCohorts, selectById: selectCohortById, selectIds: selectCohortIds } = cohortsAdapter.getSelectors((state)=>state.cohorts);
15638
15773
  const selectCurrentCohortId = (state)=>state.cohorts.currentCohortId;
@@ -15640,7 +15775,7 @@ const selectCurrentCohort = (state)=>{
15640
15775
  const { currentCohortId, entities } = state.cohorts;
15641
15776
  const cohort = entities[currentCohortId];
15642
15777
  if (!cohort) {
15643
- return createDefaultCohort();
15778
+ return null;
15644
15779
  }
15645
15780
  return cohort;
15646
15781
  };
@@ -15662,15 +15797,15 @@ toolkit.createSelector([
15662
15797
  ], (autoSaveArray, cohortId)=>autoSaveArray.includes(cohortId));
15663
15798
  const selectCurrentCohortName = toolkit.createSelector([
15664
15799
  selectCurrentCohort
15665
- ], (cohort)=>cohort.name);
15800
+ ], (cohort)=>cohort?.name ?? 'No Cohort Defined');
15666
15801
  const selectCurrentCohortFilters = toolkit.createSelector([
15667
15802
  selectCurrentCohort
15668
- ], (cohort)=>cohort.filters);
15803
+ ], (cohort)=>cohort ? cohort.filters : UninitializeCohort.filters);
15669
15804
  const selectCurrentCohortIndexFilters = toolkit.createSelector([
15670
15805
  selectCurrentCohort,
15671
15806
  (state, index)=>index
15672
15807
  ], (cohort, index)=>{
15673
- return cohort.filters?.[index] ?? EmptyFilterSet;
15808
+ return cohort?.filters?.[index] ?? EmptyFilterSet;
15674
15809
  });
15675
15810
  toolkit.createSelector([
15676
15811
  selectAllCohorts,
@@ -15682,7 +15817,6 @@ toolkit.createSelector([
15682
15817
  const trimmedName = params.name.trim().toLowerCase();
15683
15818
  return cohorts.some((cohort)=>cohort.id !== params.excludeId && cohort.name.trim().toLowerCase() === trimmedName);
15684
15819
  });
15685
- const selectCohortManagerLoading = (state)=>state.cohorts.loading;
15686
15820
  const selectCohortIdToNameMap = toolkit.createSelector([
15687
15821
  selectAllCohorts
15688
15822
  ], (cohorts)=>{
@@ -16149,14 +16283,12 @@ const submitCohortRequestAction = async (cohort, values, user, indexResources, r
16149
16283
  }
16150
16284
  };
16151
16285
 
16152
- const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16153
- const dispatch = useAppDispatch();
16286
+ const CohortManagerPanel = ({ indexResources, remoteSupportService, size = 'md' })=>{
16287
+ const appDispatch = useAppDispatch();
16154
16288
  const [isEditing, setIsEditing] = React.useState(false);
16155
16289
  const [editingLabel, setEditingLabel] = React.useState('');
16156
16290
  const allCohorts = useAppSelector(selectAllCohorts);
16157
16291
  const currentCohort = useAppSelector(selectCurrentCohort);
16158
- const loading = useAppSelector(selectCohortManagerLoading);
16159
- const appDispatch = useAppDispatch();
16160
16292
  const [getGetAggs] = core.useLazyGetAggsNoFilterSelfQuery();
16161
16293
  const [requestQuery] = core.useCreateRequestMutation();
16162
16294
  const user = core.useCoreSelector(core.selectUserDetails);
@@ -16173,7 +16305,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16173
16305
  };
16174
16306
  const saveEdit = ()=>{
16175
16307
  if (editingLabel.trim() === '' || !currentCohort.name) return;
16176
- dispatch(updateCohortName({
16308
+ appDispatch(updateCohortName({
16177
16309
  id: currentCohort.id,
16178
16310
  name: editingLabel
16179
16311
  }));
@@ -16181,7 +16313,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16181
16313
  setEditingLabel('');
16182
16314
  };
16183
16315
  const handleCreateNew = ()=>{
16184
- dispatch(createNewCohort({
16316
+ appDispatch(createNewCohort({
16185
16317
  name: 'New Cohort'
16186
16318
  }));
16187
16319
  };
@@ -16193,22 +16325,26 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16193
16325
  }, [
16194
16326
  allCohorts
16195
16327
  ]);
16328
+ useDeepCompare.useDeepCompareEffect(()=>{
16329
+ if (!currentCohort) {
16330
+ setCurrentCohortId(allCohorts[0].id);
16331
+ }
16332
+ }, [
16333
+ allCohorts,
16334
+ currentCohort,
16335
+ setCurrentCohortId
16336
+ ]);
16196
16337
  const onSelectCohort = React.useCallback((_value, option)=>{
16197
16338
  if (option) {
16198
- dispatch(setCurrentCohortId(option.value));
16339
+ appDispatch(setCurrentCohortId(option.value));
16199
16340
  }
16200
16341
  }, [
16201
- dispatch
16342
+ appDispatch
16202
16343
  ]);
16203
16344
  const handleCohortAccessRequest = async (cohortId, values)=>{
16204
16345
  const cohort = allCohorts.find((obj)=>obj.id === cohortId);
16205
16346
  if (cohort) await submitCohortRequestAction(cohort, values, user, indexResources, remoteSupportService, appDispatch, getGetAggs, requestQuery);
16206
16347
  };
16207
- if (loading) {
16208
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
16209
- children: "Loading cohorts..."
16210
- });
16211
- }
16212
16348
  return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
16213
16349
  gap: "xs",
16214
16350
  className: "flex pt-4 pl-2",
@@ -16266,7 +16402,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16266
16402
  onClick: saveEdit,
16267
16403
  "data-testid": "completeCohortRenameButton",
16268
16404
  "aria-label": "Complete rename cohort",
16269
- disabled: editingLabel.trim() === '' || editingLabel.trim() === currentCohort.name,
16405
+ disabled: editingLabel.trim() === '' || editingLabel.trim() === currentCohort?.name,
16270
16406
  size: `compact-${size}`,
16271
16407
  children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
16272
16408
  icon: "gen3:check",
@@ -16341,7 +16477,7 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16341
16477
  color: theme.colors.accent[4]
16342
16478
  },
16343
16479
  onConfirm: ()=>{
16344
- dispatch(removeCohort(currentCohort.id));
16480
+ appDispatch(removeCohort(currentCohort.id));
16345
16481
  }
16346
16482
  });
16347
16483
  },
@@ -16383,8 +16519,15 @@ const CohortManager = ({ indexResources, remoteSupportService, size = 'md' })=>{
16383
16519
  ]
16384
16520
  });
16385
16521
  };
16386
-
16387
- 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
+ };
16388
16531
 
16389
16532
  const useGraphQLData = (url, body, skip)=>{
16390
16533
  // Create a fetcher function that handles the GraphQL POST request
@@ -16853,22 +16996,6 @@ const SavedCohortsTable = ({ indexResources, remoteSupportService, size = 'md' }
16853
16996
  })
16854
16997
  })
16855
16998
  }),
16856
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
16857
- label: "Select Cohort",
16858
- withArrow: true,
16859
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
16860
- color: "accent.4",
16861
- variant: "transparent",
16862
- "aria-label": "Select cohort",
16863
- onClick: ()=>{},
16864
- children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
16865
- icon: "gen3:cohort",
16866
- height: iconSize,
16867
- width: iconSize,
16868
- color: theme.colors.secondary[4]
16869
- })
16870
- })
16871
- }),
16872
16999
  /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
16873
17000
  label: "Delete Cohort",
16874
17001
  withArrow: true,
@@ -19396,6 +19523,7 @@ const MetadataDictionary = ({ schemas })=>{
19396
19523
  }
19397
19524
  return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Tabs, {
19398
19525
  defaultValue: schemas[0].schemaID,
19526
+ variant: schemas[0]?.tabType,
19399
19527
  className: "w-full",
19400
19528
  keepMounted: false,
19401
19529
  children: [
@@ -19735,6 +19863,7 @@ const Discovery = ({ discoveryConfig })=>{
19735
19863
  children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Tabs, {
19736
19864
  className: "w-full",
19737
19865
  defaultValue: metadataIndex,
19866
+ variant: discoveryConfig.metadataConfig[0]?.tabType,
19738
19867
  onChange: (v)=>{
19739
19868
  setMetadataIndex(v ?? '0');
19740
19869
  },
@@ -20036,6 +20165,9 @@ const LandingPageGetServerSideProps = async ()=>{
20036
20165
  };
20037
20166
  };
20038
20167
 
20168
+ const CohortBuilder = dynamic(()=>Promise.resolve().then(function () { return CohortBuilder$2; }), {
20169
+ ssr: false
20170
+ });
20039
20171
  const ExplorerPage = ({ headerProps, footerProps, explorerConfig, headerMetadata, tabsLayout, sharedFiltersMap })=>{
20040
20172
  if (explorerConfig === undefined) {
20041
20173
  return /*#__PURE__*/ jsxRuntime.jsx(core$1.Center, {
@@ -25933,6 +26065,13 @@ const staticNotebookAPI = async (req, res)=>{
25933
26065
  });
25934
26066
  }
25935
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
+ });
25936
26075
  const sanitizedContent = DOMPurify.sanitize(rawContent, {
25937
26076
  ALLOWED_TAGS: [
25938
26077
  'p',
@@ -26000,7 +26139,7 @@ exports.BAD_DATA_MESSAGE = BAD_DATA_MESSAGE;
26000
26139
  exports.Banner = Banner;
26001
26140
  exports.BaseModal = BaseModal;
26002
26141
  exports.Charts = Charts;
26003
- exports.CohortBuilder = CohortBuilder;
26142
+ exports.CohortBuilder = CohortBuilder$1;
26004
26143
  exports.CohortManager = CohortManager$1;
26005
26144
  exports.CollapsableCharts = CollapsableCharts;
26006
26145
  exports.CollapsableSidebar = CollapsableSidebar;
@@ -26127,6 +26266,7 @@ exports.credentialsLogin = credentialsLogin;
26127
26266
  exports.credentialsLogout = credentialsLogout;
26128
26267
  exports.extractObjectKey = extractObjectKey;
26129
26268
  exports.extractRangeValues = extractRangeValues;
26269
+ exports.filterAggregationsDataKeys = filterAggregationsDataKeys;
26130
26270
  exports.focusStyles = focusStyles;
26131
26271
  exports.getAllFieldsFromFilterConfigs = getAllFieldsFromFilterConfigs;
26132
26272
  exports.getCurrentUnixTimestamp = getCurrentUnixTimestamp;