@finos/legend-application-marketplace 0.2.13 → 0.2.15

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 (120) hide show
  1. package/lib/__lib__/LegendMarketplaceNavigation.d.ts +2 -0
  2. package/lib/__lib__/LegendMarketplaceNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/LegendMarketplaceNavigation.js +4 -0
  4. package/lib/__lib__/LegendMarketplaceNavigation.js.map +1 -1
  5. package/lib/application/LegendMarketplaceApplicationConfig.d.ts +9 -0
  6. package/lib/application/LegendMarketplaceApplicationConfig.d.ts.map +1 -1
  7. package/lib/application/LegendMarketplaceApplicationConfig.js +40 -22
  8. package/lib/application/LegendMarketplaceApplicationConfig.js.map +1 -1
  9. package/lib/application/LegendMarketplaceWebApplication.d.ts.map +1 -1
  10. package/lib/application/LegendMarketplaceWebApplication.js +4 -1
  11. package/lib/application/LegendMarketplaceWebApplication.js.map +1 -1
  12. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.d.ts.map +1 -1
  13. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.js +7 -0
  14. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.js.map +1 -1
  15. package/lib/application/providers/LegendMarketplaceAIChatStoreProvider.d.ts +21 -0
  16. package/lib/application/providers/LegendMarketplaceAIChatStoreProvider.d.ts.map +1 -0
  17. package/lib/application/providers/LegendMarketplaceAIChatStoreProvider.js +29 -0
  18. package/lib/application/providers/LegendMarketplaceAIChatStoreProvider.js.map +1 -0
  19. package/lib/index.css +2 -2
  20. package/lib/index.css.map +1 -1
  21. package/lib/package.json +1 -1
  22. package/lib/pages/Agents/LegendMarketplaceAgents.d.ts.map +1 -1
  23. package/lib/pages/Agents/LegendMarketplaceAgents.js +49 -17
  24. package/lib/pages/Agents/LegendMarketplaceAgents.js.map +1 -1
  25. package/lib/pages/Agents/MarketplaceAIChatView.d.ts +21 -0
  26. package/lib/pages/Agents/MarketplaceAIChatView.d.ts.map +1 -0
  27. package/lib/pages/Agents/MarketplaceAIChatView.js +141 -0
  28. package/lib/pages/Agents/MarketplaceAIChatView.js.map +1 -0
  29. package/lib/pages/Agents/MarketplaceAIInputBar.d.ts +22 -0
  30. package/lib/pages/Agents/MarketplaceAIInputBar.d.ts.map +1 -0
  31. package/lib/pages/Agents/MarketplaceAIInputBar.js +40 -0
  32. package/lib/pages/Agents/MarketplaceAIInputBar.js.map +1 -0
  33. package/lib/pages/Agents/MarketplaceAIProductAutosuggest.d.ts +25 -0
  34. package/lib/pages/Agents/MarketplaceAIProductAutosuggest.d.ts.map +1 -0
  35. package/lib/pages/Agents/MarketplaceAIProductAutosuggest.js +86 -0
  36. package/lib/pages/Agents/MarketplaceAIProductAutosuggest.js.map +1 -0
  37. package/lib/pages/Agents/MarketplaceAIProductCards.d.ts +23 -0
  38. package/lib/pages/Agents/MarketplaceAIProductCards.d.ts.map +1 -0
  39. package/lib/pages/Agents/MarketplaceAIProductCards.js +20 -0
  40. package/lib/pages/Agents/MarketplaceAIProductCards.js.map +1 -0
  41. package/lib/pages/Agents/MarketplaceAIScopeSelector.d.ts +19 -0
  42. package/lib/pages/Agents/MarketplaceAIScopeSelector.d.ts.map +1 -0
  43. package/lib/pages/Agents/MarketplaceAIScopeSelector.js +46 -0
  44. package/lib/pages/Agents/MarketplaceAIScopeSelector.js.map +1 -0
  45. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
  46. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +74 -63
  47. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js.map +1 -1
  48. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.d.ts.map +1 -1
  49. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js +85 -69
  50. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
  51. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts.map +1 -1
  52. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js +7 -11
  53. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js.map +1 -1
  54. package/lib/pages/Lakehouse/entitlements/PermitDataAccessRequest.d.ts +17 -0
  55. package/lib/pages/Lakehouse/entitlements/PermitDataAccessRequest.d.ts.map +1 -0
  56. package/lib/pages/Lakehouse/entitlements/PermitDataAccessRequest.js +126 -0
  57. package/lib/pages/Lakehouse/entitlements/PermitDataAccessRequest.js.map +1 -0
  58. package/lib/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.d.ts.map +1 -1
  59. package/lib/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.js +23 -65
  60. package/lib/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.js.map +1 -1
  61. package/lib/pages/Lakehouse/entitlements/showTaskActionAlert.d.ts +29 -0
  62. package/lib/pages/Lakehouse/entitlements/showTaskActionAlert.d.ts.map +1 -0
  63. package/lib/pages/Lakehouse/entitlements/showTaskActionAlert.js +60 -0
  64. package/lib/pages/Lakehouse/entitlements/showTaskActionAlert.js.map +1 -0
  65. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.d.ts.map +1 -1
  66. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.js +3 -8
  67. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.js.map +1 -1
  68. package/lib/stores/LegendMarketplaceBaseStore.d.ts +2 -1
  69. package/lib/stores/LegendMarketplaceBaseStore.d.ts.map +1 -1
  70. package/lib/stores/LegendMarketplaceBaseStore.js +8 -1
  71. package/lib/stores/LegendMarketplaceBaseStore.js.map +1 -1
  72. package/lib/stores/ai/LegendMarketplaceAIChatStore.d.ts +109 -0
  73. package/lib/stores/ai/LegendMarketplaceAIChatStore.d.ts.map +1 -0
  74. package/lib/stores/ai/LegendMarketplaceAIChatStore.js +1106 -0
  75. package/lib/stores/ai/LegendMarketplaceAIChatStore.js.map +1 -0
  76. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.d.ts.map +1 -1
  77. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js +3 -2
  78. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js.map +1 -1
  79. package/lib/stores/lakehouse/dataProducts/ProductCardState.d.ts +1 -1
  80. package/lib/stores/lakehouse/dataProducts/ProductCardState.d.ts.map +1 -1
  81. package/lib/stores/lakehouse/dataProducts/ProductCardState.js +1 -2
  82. package/lib/stores/lakehouse/dataProducts/ProductCardState.js.map +1 -1
  83. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +30 -3
  84. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
  85. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +94 -16
  86. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
  87. package/lib/utils/EntitlementsUtils.d.ts +36 -2
  88. package/lib/utils/EntitlementsUtils.d.ts.map +1 -1
  89. package/lib/utils/EntitlementsUtils.js +225 -46
  90. package/lib/utils/EntitlementsUtils.js.map +1 -1
  91. package/lib/utils/SearchUtils.d.ts.map +1 -1
  92. package/lib/utils/SearchUtils.js +7 -4
  93. package/lib/utils/SearchUtils.js.map +1 -1
  94. package/package.json +10 -10
  95. package/src/__lib__/LegendMarketplaceNavigation.ts +11 -0
  96. package/src/application/LegendMarketplaceApplicationConfig.ts +62 -24
  97. package/src/application/LegendMarketplaceWebApplication.tsx +15 -0
  98. package/src/application/__test-utils__/LegendMarketplaceApplicationTestUtils.ts +7 -0
  99. package/src/application/providers/LegendMarketplaceAIChatStoreProvider.tsx +47 -0
  100. package/src/pages/Agents/LegendMarketplaceAgents.tsx +145 -23
  101. package/src/pages/Agents/MarketplaceAIChatView.tsx +555 -0
  102. package/src/pages/Agents/MarketplaceAIInputBar.tsx +91 -0
  103. package/src/pages/Agents/MarketplaceAIProductAutosuggest.tsx +181 -0
  104. package/src/pages/Agents/MarketplaceAIProductCards.tsx +111 -0
  105. package/src/pages/Agents/MarketplaceAIScopeSelector.tsx +84 -0
  106. package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +131 -136
  107. package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +158 -165
  108. package/src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx +12 -17
  109. package/src/pages/Lakehouse/entitlements/PermitDataAccessRequest.tsx +245 -0
  110. package/src/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.tsx +25 -94
  111. package/src/pages/Lakehouse/entitlements/showTaskActionAlert.tsx +101 -0
  112. package/src/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.tsx +27 -31
  113. package/src/stores/LegendMarketplaceBaseStore.ts +12 -0
  114. package/src/stores/ai/LegendMarketplaceAIChatStore.ts +1720 -0
  115. package/src/stores/lakehouse/LegendMarketplaceProductViewerStore.ts +6 -0
  116. package/src/stores/lakehouse/dataProducts/ProductCardState.ts +3 -4
  117. package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +181 -48
  118. package/src/utils/EntitlementsUtils.tsx +341 -86
  119. package/src/utils/SearchUtils.tsx +7 -4
  120. package/tsconfig.json +9 -0
@@ -19,10 +19,20 @@ import {
19
19
  getOrganizationalScopeTypeDetails,
20
20
  UserRenderer,
21
21
  MultiUserRenderer,
22
+ stringifyOrganizationalScope,
23
+ DataContractViewerState,
24
+ PermitDataAccessRequestState,
22
25
  } from '@finos/legend-extension-dsl-data-product';
23
26
  import {
27
+ GraphManagerState,
24
28
  V1_LiteDataContractWithUserStatus,
25
29
  V1_ResourceType,
30
+ V1_AccessPointGroupReference,
31
+ V1_ContractState,
32
+ V1_RequestState,
33
+ V1_WorkflowTaskStatus,
34
+ type V1_DataRequestWithWorkflow,
35
+ V1_deserializeDataRequestsWithWorkflowResponse,
26
36
  } from '@finos/legend-graph';
27
37
  import type {
28
38
  DataGridCellRendererParams,
@@ -37,94 +47,222 @@ import { InfoCircleIcon } from '@finos/legend-art';
37
47
  import { Tooltip } from '@mui/material';
38
48
  import { observer } from 'mobx-react-lite';
39
49
  import type { LakehouseEntitlementsStore } from '../stores/lakehouse/entitlements/LakehouseEntitlementsStore.js';
50
+ import { useMemo } from 'react';
51
+ import { useLegendMarketplaceBaseStore } from '../application/providers/LegendMarketplaceFrameworkProvider.js';
52
+ import {
53
+ generateContractPagePath,
54
+ generateLakehouseDataProductPath,
55
+ generatePermitDataAccessRequestPagePath,
56
+ } from '../__lib__/LegendMarketplaceNavigation.js';
57
+
58
+ export const UNKNOWN = 'Unknown';
59
+ export const ROW_KIND_CONTRACT = 'contract';
60
+ export const ROW_KIND_REQUEST = 'request';
61
+
62
+ export enum EntitlementsColumnHeader {
63
+ TYPE = 'Type',
64
+ DATE_CREATED = 'Date Created',
65
+ CONSUMER_TYPE = 'Consumer Type',
66
+ TARGET_USERS = 'Target User(s)',
67
+ REQUESTER = 'Requester',
68
+ TARGET_DATA_PRODUCT = 'Target Data Product',
69
+ TARGET_ACCESS_POINT_GROUP = 'Target Access Point Group',
70
+ BUSINESS_JUSTIFICATION = 'Business Justification',
71
+ STATE = 'State',
72
+ ASSIGNEES = 'Assignees',
73
+ }
74
+
75
+ export const CONTRACT_STATE_DISPLAY_LABELS: Record<string, string> = {
76
+ [V1_ContractState.DRAFT]: 'Draft',
77
+ [V1_ContractState.PENDING_DATA_OWNER_APPROVAL]: 'Data Owner Approval',
78
+ [V1_ContractState.OPEN_FOR_PRIVILEGE_MANAGER_APPROVAL]:
79
+ 'Privilege Manager Approval',
80
+ [V1_ContractState.COMPLETED]: 'Completed',
81
+ [V1_ContractState.REJECTED]: 'Rejected',
82
+ [V1_ContractState.CLOSED]: 'Closed',
83
+ };
84
+
85
+ export const TERMINAL_DATA_REQUEST_STATES = new Set<string>([
86
+ V1_RequestState.COMPLETED,
87
+ V1_RequestState.REJECTED,
88
+ V1_RequestState.INVALIDATED,
89
+ V1_RequestState.OBSOLETE,
90
+ ]);
91
+
92
+ export const ENTITLEMENTS_DEFAULT_COL_DEF: DataGridColumnDefinition<EntitlementsRow> =
93
+ {
94
+ minWidth: 50,
95
+ sortable: true,
96
+ resizable: true,
97
+ flex: 1,
98
+ };
99
+
100
+ export type EntitlementsRow =
101
+ | {
102
+ kind: 'contract';
103
+ data: V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails;
104
+ }
105
+ | { kind: 'request'; data: V1_DataRequestWithWorkflow };
106
+
107
+ export const getContractData = (row: EntitlementsRow) =>
108
+ row.kind === ROW_KIND_CONTRACT ? row.data.contractResultLite : undefined;
109
+
110
+ export const getRequestData = (row: EntitlementsRow) =>
111
+ row.kind === ROW_KIND_REQUEST ? row.data.dataRequest : undefined;
112
+
113
+ export const getSelectedRowId = (
114
+ row: EntitlementsRow | undefined,
115
+ ): string | undefined =>
116
+ row ? (getContractData(row)?.guid ?? getRequestData(row)?.guid) : undefined;
117
+
118
+ export const getSelectedContractGuid = (
119
+ row: EntitlementsRow | undefined,
120
+ ): string | undefined => (row ? getContractData(row)?.guid : undefined);
121
+
122
+ export const getOpenTaskAssignees = (
123
+ data: V1_DataRequestWithWorkflow,
124
+ ): string[] => {
125
+ const openTask = data.workflows
126
+ .flatMap((w) => w.tasks)
127
+ .find((t) => t.status === V1_WorkflowTaskStatus.OPEN);
128
+ return openTask?.assignees.toSorted() ?? [];
129
+ };
130
+
131
+ export const getConsumer = (row: EntitlementsRow) =>
132
+ getContractData(row)?.consumer ?? getRequestData(row)?.consumer;
40
133
 
41
134
  const TargetUserCellRenderer = observer(
42
135
  (props: {
43
- dataContract:
44
- | V1_LiteDataContractWithUserStatus
45
- | ContractCreatedByUserDetails
46
- | undefined;
136
+ row: EntitlementsRow | undefined;
47
137
  entitlementsStore: LakehouseEntitlementsStore;
48
138
  }): React.ReactNode => {
49
- const { dataContract, entitlementsStore } = props;
50
-
51
- const userIds =
52
- dataContract instanceof V1_LiteDataContractWithUserStatus
53
- ? [dataContract.user]
54
- : (dataContract?.sortedMemberIds ?? []);
55
-
139
+ const { row, entitlementsStore } = props;
140
+ if (!row) {
141
+ return <>{UNKNOWN}</>;
142
+ }
143
+ if (row.kind === ROW_KIND_CONTRACT) {
144
+ const dataContract = row.data;
145
+ const userIds =
146
+ dataContract instanceof V1_LiteDataContractWithUserStatus
147
+ ? [dataContract.user]
148
+ : dataContract.sortedMemberIds;
149
+ return (
150
+ <MultiUserRenderer
151
+ userIds={userIds}
152
+ applicationStore={entitlementsStore.applicationStore}
153
+ userSearchService={
154
+ entitlementsStore.marketplaceBaseStore.userSearchService
155
+ }
156
+ disableOnClick={true}
157
+ singleUserClassName="marketplace-lakehouse-entitlements__grid__user-display"
158
+ />
159
+ );
160
+ }
161
+ const consumer = row.data.dataRequest.consumer;
56
162
  return (
57
- <MultiUserRenderer
58
- userIds={userIds}
59
- applicationStore={entitlementsStore.applicationStore}
60
- userSearchService={
61
- entitlementsStore.marketplaceBaseStore.userSearchService
62
- }
63
- disableOnClick={true}
64
- singleUserClassName="marketplace-lakehouse-entitlements__grid__user-display"
65
- />
163
+ <>
164
+ {stringifyOrganizationalScope(
165
+ consumer,
166
+ entitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
167
+ )}
168
+ </>
66
169
  );
67
170
  },
68
171
  );
69
172
 
70
173
  export const getCommonEntitlementsColDefs = (
71
174
  dashboardState: EntitlementsDashboardState,
72
- ): DataGridColumnDefinition<
73
- V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
74
- >[] => [
175
+ ): DataGridColumnDefinition<EntitlementsRow>[] => [
75
176
  {
76
- headerName: 'Date Created',
177
+ headerName: EntitlementsColumnHeader.TYPE,
178
+ colId: 'type',
179
+ valueGetter: (params) =>
180
+ params.data?.kind === ROW_KIND_CONTRACT
181
+ ? 'Data Contract'
182
+ : 'Data Request',
183
+ },
184
+ {
185
+ headerName: EntitlementsColumnHeader.DATE_CREATED,
77
186
  colId: 'dateCreated',
187
+ sort: 'desc',
188
+ comparator: (_, __, val1, val2) => {
189
+ const getTime = (row: EntitlementsRow | undefined): number => {
190
+ if (!row) {
191
+ return 0;
192
+ }
193
+ const contract = getContractData(row);
194
+ if (contract) {
195
+ return contract.createdAt
196
+ ? new Date(contract.createdAt).getTime()
197
+ : 0;
198
+ }
199
+ if (row.kind !== ROW_KIND_REQUEST) {
200
+ return 0;
201
+ }
202
+ const c = row.data.workflows[0]?.tasks[0]?.createdOn;
203
+ if (!c) {
204
+ return 0;
205
+ }
206
+ const dateStr = c instanceof Date ? c.toISOString() : String(c);
207
+ return new Date(dateStr).getTime();
208
+ };
209
+ return getTime(val1.data) - getTime(val2.data);
210
+ },
78
211
  valueGetter: (params) => {
212
+ if (!params.data) {
213
+ return UNKNOWN;
214
+ }
215
+ const contract = getContractData(params.data);
216
+ if (contract) {
217
+ return formatOrderDate(contract.createdAt) ?? UNKNOWN;
218
+ }
219
+ if (params.data.kind !== ROW_KIND_REQUEST) {
220
+ return UNKNOWN;
221
+ }
222
+ const createdOn = params.data.data.workflows[0]?.tasks[0]?.createdOn;
223
+ if (!createdOn) {
224
+ return UNKNOWN;
225
+ }
79
226
  return (
80
- formatOrderDate(params.data?.contractResultLite.createdAt) ?? 'Unknown'
227
+ formatOrderDate(
228
+ createdOn instanceof Date
229
+ ? createdOn.toISOString()
230
+ : String(createdOn),
231
+ ) ?? UNKNOWN
81
232
  );
82
233
  },
83
- sort: 'desc',
84
- comparator: (_, __, val1, val2) => {
85
- const dateA = val1.data?.contractResultLite.createdAt
86
- ? new Date(val1.data.contractResultLite.createdAt).getTime()
87
- : 0;
88
- const dateB = val2.data?.contractResultLite.createdAt
89
- ? new Date(val2.data.contractResultLite.createdAt).getTime()
90
- : 0;
91
- return dateA - dateB;
92
- },
93
234
  },
94
235
  {
95
236
  colId: 'consumerType',
96
- headerName: 'Consumer Type',
237
+ headerName: EntitlementsColumnHeader.CONSUMER_TYPE,
97
238
  valueGetter: (params) => {
98
- const consumer = params.data?.contractResultLite.consumer;
99
- const typeName = consumer
239
+ if (!params.data) {
240
+ return UNKNOWN;
241
+ }
242
+ const consumer = getConsumer(params.data);
243
+ return consumer
100
244
  ? getOrganizationalScopeTypeName(
101
245
  consumer,
102
246
  dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
103
247
  )
104
- : undefined;
105
- return typeName ?? 'Unknown';
248
+ : UNKNOWN;
106
249
  },
107
- cellRenderer: (
108
- params: DataGridCellRendererParams<
109
- V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
110
- >,
111
- ) => {
112
- const consumer = params.data?.contractResultLite.consumer;
250
+ cellRenderer: (params: DataGridCellRendererParams<EntitlementsRow>) => {
251
+ if (!params.data) {
252
+ return UNKNOWN;
253
+ }
254
+ const consumer = getConsumer(params.data);
255
+ const plugins =
256
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins();
113
257
  const typeName = consumer
114
- ? getOrganizationalScopeTypeName(
115
- consumer,
116
- dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
117
- )
258
+ ? getOrganizationalScopeTypeName(consumer, plugins)
118
259
  : undefined;
119
260
  const typeDetails = consumer
120
- ? getOrganizationalScopeTypeDetails(
121
- consumer,
122
- dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
123
- )
261
+ ? getOrganizationalScopeTypeDetails(consumer, plugins)
124
262
  : undefined;
125
263
  return (
126
264
  <>
127
- {typeName ?? 'Unknown'}
265
+ {typeName ?? UNKNOWN}
128
266
  {typeDetails !== undefined && (
129
267
  <Tooltip
130
268
  className="marketplace-lakehouse-entitlements__grid__consumer-type__tooltip__icon"
@@ -138,37 +276,52 @@ export const getCommonEntitlementsColDefs = (
138
276
  },
139
277
  },
140
278
  {
141
- headerName: 'Target User(s)',
279
+ headerName: EntitlementsColumnHeader.TARGET_USERS,
142
280
  colId: 'targetUser',
143
281
  valueGetter: (params) => {
144
- const userIds =
145
- params.data instanceof V1_LiteDataContractWithUserStatus
146
- ? [params.data.user]
147
- : (params.data?.sortedMemberIds ?? []);
148
- return userIds.length > 0 ? userIds.join(', ') : 'Unknown';
282
+ if (!params.data) {
283
+ return UNKNOWN;
284
+ }
285
+ if (params.data.kind === ROW_KIND_CONTRACT) {
286
+ const userIds =
287
+ params.data.data instanceof V1_LiteDataContractWithUserStatus
288
+ ? [params.data.data.user]
289
+ : params.data.data.sortedMemberIds;
290
+ return userIds.length > 0 ? userIds.join(', ') : UNKNOWN;
291
+ }
292
+ const consumer = params.data.data.dataRequest.consumer;
293
+ return stringifyOrganizationalScope(
294
+ consumer,
295
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
296
+ );
149
297
  },
150
- cellRenderer: (
151
- params: DataGridCellRendererParams<
152
- V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
153
- >,
154
- ) => (
298
+ cellRenderer: (params: DataGridCellRendererParams<EntitlementsRow>) => (
155
299
  <TargetUserCellRenderer
156
- dataContract={params.data}
300
+ row={params.data}
157
301
  entitlementsStore={dashboardState.lakehouseEntitlementsStore}
158
302
  />
159
303
  ),
160
304
  },
161
305
  {
162
- headerName: 'Requester',
306
+ headerName: EntitlementsColumnHeader.REQUESTER,
163
307
  colId: 'requester',
164
- valueGetter: (params) =>
165
- params.data?.contractResultLite.createdBy ?? 'Unknown',
166
- cellRenderer: (
167
- params: DataGridCellRendererParams<
168
- V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
169
- >,
170
- ) => {
171
- const requester = params.data?.contractResultLite.createdBy;
308
+ valueGetter: (params) => {
309
+ if (!params.data) {
310
+ return UNKNOWN;
311
+ }
312
+ return (
313
+ getContractData(params.data)?.createdBy ??
314
+ getRequestData(params.data)?.createdBy ??
315
+ UNKNOWN
316
+ );
317
+ },
318
+ cellRenderer: (params: DataGridCellRendererParams<EntitlementsRow>) => {
319
+ if (!params.data) {
320
+ return <>{UNKNOWN}</>;
321
+ }
322
+ const requester =
323
+ getContractData(params.data)?.createdBy ??
324
+ getRequestData(params.data)?.createdBy;
172
325
  return requester ? (
173
326
  <UserRenderer
174
327
  userId={requester}
@@ -183,25 +336,127 @@ export const getCommonEntitlementsColDefs = (
183
336
  className="marketplace-lakehouse-entitlements__grid__user-display"
184
337
  />
185
338
  ) : (
186
- <>Unknown</>
339
+ <>{UNKNOWN}</>
187
340
  );
188
341
  },
189
342
  },
190
343
  {
191
- headerName: 'Target Data Product',
344
+ headerName: EntitlementsColumnHeader.TARGET_DATA_PRODUCT,
345
+ valueGetter: (params) => {
346
+ if (!params.data) {
347
+ return UNKNOWN;
348
+ }
349
+ const contract = getContractData(params.data);
350
+ if (contract) {
351
+ return contract.resourceId;
352
+ }
353
+ const resource = getRequestData(params.data)?.resource;
354
+ return resource instanceof V1_AccessPointGroupReference
355
+ ? resource.dataProduct.name
356
+ : UNKNOWN;
357
+ },
358
+ },
359
+ {
360
+ headerName: EntitlementsColumnHeader.TARGET_ACCESS_POINT_GROUP,
192
361
  valueGetter: (params) => {
193
- return params.data?.contractResultLite.resourceId ?? 'Unknown';
362
+ if (!params.data) {
363
+ return UNKNOWN;
364
+ }
365
+ const contract = getContractData(params.data);
366
+ if (contract) {
367
+ const accessPointGroup =
368
+ contract.resourceType === V1_ResourceType.ACCESS_POINT_GROUP
369
+ ? contract.accessPointGroup
370
+ : `${contract.accessPointGroup ?? UNKNOWN} (${contract.resourceType})`;
371
+ return accessPointGroup ?? UNKNOWN;
372
+ }
373
+ const resource = getRequestData(params.data)?.resource;
374
+ return resource instanceof V1_AccessPointGroupReference
375
+ ? resource.accessPointGroup
376
+ : UNKNOWN;
194
377
  },
195
378
  },
196
379
  {
197
- headerName: 'Target Access Point Group',
380
+ headerName: EntitlementsColumnHeader.BUSINESS_JUSTIFICATION,
198
381
  valueGetter: (params) => {
199
- const accessPointGroup =
200
- params.data?.contractResultLite.resourceType ===
201
- V1_ResourceType.ACCESS_POINT_GROUP
202
- ? params.data.contractResultLite.accessPointGroup
203
- : `${params.data?.contractResultLite.accessPointGroup ?? 'Unknown'} (${params.data?.contractResultLite.resourceType ?? 'Unknown Type'})`;
204
- return accessPointGroup ?? 'Unknown';
382
+ if (!params.data) {
383
+ return UNKNOWN;
384
+ }
385
+ return (
386
+ getContractData(params.data)?.description ??
387
+ getRequestData(params.data)?.businessJustification ??
388
+ UNKNOWN
389
+ );
205
390
  },
206
391
  },
207
392
  ];
393
+
394
+ export const useSelectedViewerState = (
395
+ selectedRow: EntitlementsRow | undefined,
396
+ selectedRowId: string | undefined,
397
+ ) => {
398
+ const marketplaceBaseStore = useLegendMarketplaceBaseStore();
399
+ return useMemo(() => {
400
+ if (!selectedRow) {
401
+ return undefined;
402
+ }
403
+ if (selectedRow.kind === ROW_KIND_CONTRACT) {
404
+ const contract = selectedRow.data.contractResultLite;
405
+ return new DataContractViewerState(
406
+ contract,
407
+ (contractId: string, taskId: string) =>
408
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
409
+ generateContractPagePath(contractId, taskId),
410
+ ),
411
+ undefined,
412
+ marketplaceBaseStore.applicationStore,
413
+ marketplaceBaseStore.lakehouseContractServerClient,
414
+ new GraphManagerState(
415
+ marketplaceBaseStore.applicationStore.pluginManager,
416
+ marketplaceBaseStore.applicationStore.logService,
417
+ ),
418
+ marketplaceBaseStore.userSearchService,
419
+ );
420
+ }
421
+ const guid = selectedRow.data.dataRequest.guid;
422
+ const authClient = marketplaceBaseStore.lakehouseContractServerClient;
423
+ const pluginManager = marketplaceBaseStore.applicationStore.pluginManager;
424
+ return new PermitDataAccessRequestState(
425
+ guid,
426
+ marketplaceBaseStore.applicationStore,
427
+ marketplaceBaseStore.permitWorkflowServerClient,
428
+ marketplaceBaseStore.userSearchService,
429
+ {
430
+ authServerClient: authClient,
431
+ initialData: selectedRow.data,
432
+ fetchFresh: async (token) => {
433
+ const raw = await authClient.getDataAccessRequestWithWorkflow(
434
+ guid,
435
+ token,
436
+ );
437
+ return V1_deserializeDataRequestsWithWorkflowResponse(
438
+ raw,
439
+ pluginManager.getPureProtocolProcessorPlugins(),
440
+ )[0];
441
+ },
442
+ getTaskPageUrl: (id) =>
443
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
444
+ generatePermitDataAccessRequestPagePath(id),
445
+ ),
446
+ },
447
+ );
448
+ // Re-create only when the selected row changes (different guid)
449
+ // eslint-disable-next-line react-hooks/exhaustive-deps
450
+ }, [selectedRowId]);
451
+ };
452
+
453
+ export const useGetDataProductUrl = (): ((
454
+ dataProductId: string,
455
+ deploymentId: number,
456
+ ) => string) => {
457
+ const marketplaceBaseStore = useLegendMarketplaceBaseStore();
458
+ return (dataProductId: string, deploymentId: number) =>
459
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
460
+ generateLakehouseDataProductPath(dataProductId, deploymentId),
461
+ );
462
+ };
@@ -94,10 +94,9 @@ export const convertEntitlementsDataProductDetailsToSearchResult = (
94
94
  entitlementsDataProductDetails: V1_EntitlementsDataProductDetails,
95
95
  ): DataProductSearchResult => {
96
96
  const searchResult = new DataProductSearchResult();
97
- searchResult.dataProductTitle =
98
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
99
- entitlementsDataProductDetails.title ||
100
- entitlementsDataProductDetails.dataProduct.name;
97
+ searchResult.dataProductTitle = entitlementsDataProductDetails.title
98
+ ? entitlementsDataProductDetails.title
99
+ : entitlementsDataProductDetails.dataProduct.name;
101
100
  searchResult.dataProductDescription =
102
101
  entitlementsDataProductDetails.description ?? '';
103
102
 
@@ -159,6 +158,10 @@ export const convertAutosuggestResultToSearchResult = (
159
158
  searchResult.dataProductTitle = autosuggestResult.dataProductName;
160
159
  searchResult.dataProductDescription =
161
160
  autosuggestResult.dataProductDescription;
161
+ searchResult.tags1 = [];
162
+ searchResult.tags2 = [];
163
+ searchResult.tag_score = 0;
164
+ searchResult.similarity = 0;
162
165
 
163
166
  const details = autosuggestResult.dataProductDetails;
164
167
 
package/tsconfig.json CHANGED
@@ -68,6 +68,7 @@
68
68
  "./src/pages/__test-utils__/TEST_DATA__LakehouseDataProducts.ts",
69
69
  "./src/stores/LegendMarketplaceBaseStore.ts",
70
70
  "./src/stores/LegendMarketplaceEnvState.ts",
71
+ "./src/stores/ai/LegendMarketplaceAIChatStore.ts",
71
72
  "./src/stores/cart/CartStore.ts",
72
73
  "./src/stores/dataAPIs/LegendMarketplaceDataAPIsStore.ts",
73
74
  "./src/stores/lakehouse/LakehouseDataProductService.ts",
@@ -88,6 +89,7 @@
88
89
  "./src/application/extensions/Core_LegendMarketplaceApplicationPlugin.tsx",
89
90
  "./src/application/providers/LakehouseAdminStoreProvider.tsx",
90
91
  "./src/application/providers/LakehouseEntitlementsStoreProvider.tsx",
92
+ "./src/application/providers/LegendMarketplaceAIChatStoreProvider.tsx",
91
93
  "./src/application/providers/LegendMarketplaceDataAPIsStoreProvider.tsx",
92
94
  "./src/application/providers/LegendMarketplaceFieldSearchResultsStoreProvider.tsx",
93
95
  "./src/application/providers/LegendMarketplaceFrameworkProvider.tsx",
@@ -127,6 +129,11 @@
127
129
  "./src/components/orders/ProgressTracker.tsx",
128
130
  "./src/pages/LegendMarketplacePage.tsx",
129
131
  "./src/pages/Agents/LegendMarketplaceAgents.tsx",
132
+ "./src/pages/Agents/MarketplaceAIChatView.tsx",
133
+ "./src/pages/Agents/MarketplaceAIInputBar.tsx",
134
+ "./src/pages/Agents/MarketplaceAIProductAutosuggest.tsx",
135
+ "./src/pages/Agents/MarketplaceAIProductCards.tsx",
136
+ "./src/pages/Agents/MarketplaceAIScopeSelector.tsx",
130
137
  "./src/pages/DataAPIs/LegendMarketplaceDataAPIs.tsx",
131
138
  "./src/pages/Inventory/LegendMarketplaceInventory.tsx",
132
139
  "./src/pages/Lakehouse/DemoModal.tsx",
@@ -144,7 +151,9 @@
144
151
  "./src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx",
145
152
  "./src/pages/Lakehouse/entitlements/LakehouseDataContract.tsx",
146
153
  "./src/pages/Lakehouse/entitlements/LakehouseEntitlements.tsx",
154
+ "./src/pages/Lakehouse/entitlements/PermitDataAccessRequest.tsx",
147
155
  "./src/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.tsx",
156
+ "./src/pages/Lakehouse/entitlements/showTaskActionAlert.tsx",
148
157
  "./src/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.tsx",
149
158
  "./src/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.tsx",
150
159
  "./src/pages/Profile/LegendMarketplaceSubscriptions.tsx",