@finos/legend-application-marketplace 0.1.55 → 0.1.56

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 (53) hide show
  1. package/lib/__lib__/LegendMarketplaceAppEvent.d.ts +1 -0
  2. package/lib/__lib__/LegendMarketplaceAppEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendMarketplaceAppEvent.js +1 -0
  4. package/lib/__lib__/LegendMarketplaceAppEvent.js.map +1 -1
  5. package/lib/__lib__/LegendMarketplaceNavigation.d.ts +9 -2
  6. package/lib/__lib__/LegendMarketplaceNavigation.d.ts.map +1 -1
  7. package/lib/__lib__/LegendMarketplaceNavigation.js +7 -1
  8. package/lib/__lib__/LegendMarketplaceNavigation.js.map +1 -1
  9. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts +10 -0
  10. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts.map +1 -1
  11. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js +55 -1
  12. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js.map +1 -1
  13. package/lib/application/LegendMarketplaceWebApplication.d.ts.map +1 -1
  14. package/lib/application/LegendMarketplaceWebApplication.js +4 -1
  15. package/lib/application/LegendMarketplaceWebApplication.js.map +1 -1
  16. package/lib/components/SearchBar/LegendMarketplaceSearchBar.d.ts.map +1 -1
  17. package/lib/components/SearchBar/LegendMarketplaceSearchBar.js +4 -0
  18. package/lib/components/SearchBar/LegendMarketplaceSearchBar.js.map +1 -1
  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/Lakehouse/MarketplaceLakehouseHome.d.ts.map +1 -1
  23. package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js +3 -0
  24. package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js.map +1 -1
  25. package/lib/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.js +2 -2
  26. package/lib/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.js.map +1 -1
  27. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
  28. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +16 -6
  29. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js.map +1 -1
  30. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js +2 -2
  31. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
  32. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js +2 -2
  33. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js.map +1 -1
  34. package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.d.ts +17 -0
  35. package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.d.ts.map +1 -0
  36. package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.js +124 -0
  37. package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.js.map +1 -0
  38. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js +2 -2
  39. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js.map +1 -1
  40. package/package.json +8 -8
  41. package/src/__lib__/LegendMarketplaceAppEvent.ts +1 -0
  42. package/src/__lib__/LegendMarketplaceNavigation.ts +19 -3
  43. package/src/__lib__/LegendMarketplaceTelemetryHelper.ts +77 -1
  44. package/src/application/LegendMarketplaceWebApplication.tsx +15 -0
  45. package/src/components/SearchBar/LegendMarketplaceSearchBar.tsx +7 -0
  46. package/src/pages/Lakehouse/MarketplaceLakehouseHome.tsx +4 -0
  47. package/src/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.tsx +3 -3
  48. package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +23 -9
  49. package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +3 -3
  50. package/src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx +3 -3
  51. package/src/pages/Lakehouse/entitlements/LakehouseDataContract.tsx +284 -0
  52. package/src/stores/lakehouse/LegendMarketplaceProductViewerStore.ts +3 -3
  53. package/tsconfig.json +1 -0
@@ -69,7 +69,7 @@ import {
69
69
  EntitlementsDataContractViewerState,
70
70
  } from '@finos/legend-extension-dsl-data-product';
71
71
  import {
72
- generateLakehouseTaskPath,
72
+ generateContractPagePath,
73
73
  generateLakehouseDataProductPath,
74
74
  } from '../../../__lib__/LegendMarketplaceNavigation.js';
75
75
  import {
@@ -855,9 +855,9 @@ export const EntitlementsPendingTasksDashboard = observer(
855
855
  ),
856
856
  );
857
857
  }}
858
- getContractTaskUrl={(taskId: string) =>
858
+ getContractTaskUrl={(contractId: string, taskId: string) =>
859
859
  marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
860
- generateLakehouseTaskPath(taskId),
860
+ generateContractPagePath(contractId, taskId),
861
861
  )
862
862
  }
863
863
  getDataProductUrl={(dataProductId: string, deploymentId: number) =>
@@ -0,0 +1,284 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { observer } from 'mobx-react-lite';
18
+ import { withLegendMarketplaceProductViewerStore } from '../../../application/providers/LegendMarketplaceProductViewerStoreProvider.js';
19
+ import { useParams } from '@finos/legend-application/browser';
20
+ import {
21
+ generateContractPagePath,
22
+ generateLakehouseDataProductPath,
23
+ type LakehouseDataContractTaskPathParams,
24
+ LEGEND_MARKETPLACE_ROUTE_PATTERN_TOKEN,
25
+ } from '../../../__lib__/LegendMarketplaceNavigation.js';
26
+ import { assertErrorThrown, guaranteeNonNullable } from '@finos/legend-shared';
27
+ import { useAuth } from 'react-oidc-context';
28
+ import { LegendMarketplacePage } from '../../LegendMarketplacePage.js';
29
+ import {
30
+ EntitlementsDataContractContent,
31
+ EntitlementsDataContractViewerState,
32
+ } from '@finos/legend-extension-dsl-data-product';
33
+ import { useEffect, useState } from 'react';
34
+ import { useLegendMarketplaceBaseStore } from '../../../application/providers/LegendMarketplaceFrameworkProvider.js';
35
+ import {
36
+ GraphManagerState,
37
+ V1_dataContractsResponseModelSchema,
38
+ V1_TaskStatusChangeResponseModelSchema,
39
+ V1_transformDataContractToLiteDatacontract,
40
+ V1_UserApprovalStatus,
41
+ } from '@finos/legend-graph';
42
+ import { deserialize } from 'serializr';
43
+ import { Box, Button, Tooltip } from '@mui/material';
44
+ import {
45
+ CubesLoadingIndicator,
46
+ CubesLoadingIndicatorIcon,
47
+ } from '@finos/legend-art';
48
+
49
+ export const LakehouseDataContractTask =
50
+ withLegendMarketplaceProductViewerStore(
51
+ observer(() => {
52
+ const marketplaceBaseStore = useLegendMarketplaceBaseStore();
53
+ const params = useParams<LakehouseDataContractTaskPathParams>();
54
+ const auth = useAuth();
55
+ const currentUser =
56
+ marketplaceBaseStore.applicationStore.identityService.currentUser;
57
+ const [contractViewerState, setContractViewerState] = useState<
58
+ EntitlementsDataContractViewerState | undefined
59
+ >(undefined);
60
+ const [isLoading, setIsLoading] = useState(false);
61
+
62
+ const contractId = guaranteeNonNullable(
63
+ params[LEGEND_MARKETPLACE_ROUTE_PATTERN_TOKEN.DATA_CONTRACT_ID],
64
+ );
65
+ const taskId = guaranteeNonNullable(
66
+ params[LEGEND_MARKETPLACE_ROUTE_PATTERN_TOKEN.DATA_CONTRACT_TASK_ID],
67
+ );
68
+
69
+ const associatedTask = contractViewerState?.associatedTasks?.find(
70
+ (task) => task.rec.taskId === taskId,
71
+ );
72
+ const isTaskPending =
73
+ associatedTask?.rec.status === V1_UserApprovalStatus.PENDING;
74
+ const userCanApprove =
75
+ isTaskPending && associatedTask.assignees.includes(currentUser);
76
+ const initialUser = associatedTask?.rec.consumer;
77
+
78
+ useEffect(() => {
79
+ const fetchAndInitializeContract = async () => {
80
+ try {
81
+ const rawContract =
82
+ await marketplaceBaseStore.lakehouseContractServerClient.getDataContract(
83
+ contractId,
84
+ false,
85
+ auth.user?.access_token,
86
+ );
87
+
88
+ const contractResponse = deserialize(
89
+ V1_dataContractsResponseModelSchema(
90
+ marketplaceBaseStore.applicationStore.pluginManager.getPureProtocolProcessorPlugins(),
91
+ ),
92
+ rawContract,
93
+ );
94
+
95
+ const dataContracts = contractResponse.dataContracts;
96
+ if (dataContracts?.[0]?.dataContract) {
97
+ const dataContract = dataContracts[0]?.dataContract;
98
+ const liteDataContract =
99
+ V1_transformDataContractToLiteDatacontract(dataContract);
100
+
101
+ const viewerState = new EntitlementsDataContractViewerState(
102
+ liteDataContract,
103
+ undefined,
104
+ marketplaceBaseStore.applicationStore,
105
+ marketplaceBaseStore.lakehouseContractServerClient,
106
+ new GraphManagerState(
107
+ marketplaceBaseStore.applicationStore.pluginManager,
108
+ marketplaceBaseStore.applicationStore.logService,
109
+ ),
110
+ marketplaceBaseStore.userSearchService,
111
+ );
112
+
113
+ setContractViewerState(viewerState);
114
+ }
115
+ } catch (error) {
116
+ assertErrorThrown(error);
117
+ marketplaceBaseStore.applicationStore.notificationService.notifyError(
118
+ `Error fetching contract: ${error.message}`,
119
+ );
120
+ }
121
+ };
122
+ // eslint-disable-next-line no-void
123
+ void fetchAndInitializeContract();
124
+ }, [contractId, auth.user?.access_token, marketplaceBaseStore]);
125
+
126
+ const handleRefresh = async (): Promise<void> => {
127
+ if (contractViewerState) {
128
+ contractViewerState.init(auth.user?.access_token);
129
+ }
130
+ };
131
+
132
+ const handleApprove = async () => {
133
+ const response =
134
+ await marketplaceBaseStore.lakehouseContractServerClient.approveTask(
135
+ taskId,
136
+ auth.user?.access_token,
137
+ );
138
+ const change = deserialize(
139
+ V1_TaskStatusChangeResponseModelSchema,
140
+ response,
141
+ );
142
+
143
+ if (change.errorMessage) {
144
+ throw new Error(`Unable to approve task: ${change.errorMessage}`);
145
+ }
146
+
147
+ marketplaceBaseStore.applicationStore.notificationService.notifySuccess(
148
+ 'Task has been approved',
149
+ );
150
+
151
+ await handleRefresh();
152
+ };
153
+
154
+ const handleDeny = async () => {
155
+ const response =
156
+ await marketplaceBaseStore.lakehouseContractServerClient.denyTask(
157
+ taskId,
158
+ auth.user?.access_token,
159
+ );
160
+ const change = deserialize(
161
+ V1_TaskStatusChangeResponseModelSchema,
162
+ response,
163
+ );
164
+
165
+ if (change.errorMessage) {
166
+ throw new Error(`Unable to deny task: ${change.errorMessage}`);
167
+ }
168
+
169
+ marketplaceBaseStore.applicationStore.notificationService.notifySuccess(
170
+ 'Task has been denied',
171
+ );
172
+
173
+ await handleRefresh();
174
+ };
175
+
176
+ const handleApproveClick = () => {
177
+ if (!isLoading) {
178
+ setIsLoading(true);
179
+ handleApprove()
180
+ .catch((error) => {
181
+ assertErrorThrown(error);
182
+ marketplaceBaseStore.applicationStore.notificationService.notifyError(
183
+ `Error approving task: ${error.message}`,
184
+ );
185
+ })
186
+ .finally(() => {
187
+ setIsLoading(false);
188
+ });
189
+ }
190
+ };
191
+
192
+ const handleDenyClick = () => {
193
+ if (!isLoading) {
194
+ setIsLoading(true);
195
+ handleDeny()
196
+ .catch((error) => {
197
+ assertErrorThrown(error);
198
+ marketplaceBaseStore.applicationStore.notificationService.notifyError(
199
+ `Error denying task: ${error.message}`,
200
+ );
201
+ })
202
+ .finally(() => {
203
+ setIsLoading(false);
204
+ });
205
+ }
206
+ };
207
+
208
+ return (
209
+ <LegendMarketplacePage className="marketplace-lakehouse-single-contract-viewer">
210
+ <CubesLoadingIndicator isLoading={isLoading}>
211
+ <CubesLoadingIndicatorIcon />
212
+ </CubesLoadingIndicator>
213
+ {contractViewerState && (
214
+ <div className="marketplace-lakehouse-single-contract-viewer__container">
215
+ {associatedTask !== undefined && (
216
+ <Box className="marketplace-lakehouse-single-contract-viewer__action-btns">
217
+ <Tooltip
218
+ className="marketplace-lakehouse-single-contract-viewer__tooltip__icon"
219
+ title={
220
+ !isTaskPending
221
+ ? 'Task does not require review'
222
+ : userCanApprove
223
+ ? ''
224
+ : 'You are not assigned to review this task'
225
+ }
226
+ >
227
+ <Button
228
+ variant="contained"
229
+ color="success"
230
+ onClick={handleApproveClick}
231
+ disabled={!userCanApprove || isLoading}
232
+ >
233
+ Approve Task
234
+ </Button>
235
+ </Tooltip>
236
+ <Tooltip
237
+ className="marketplace-lakehouse-single-contract-viewer__tooltip__icon"
238
+ title={
239
+ !isTaskPending
240
+ ? 'Task does not require review'
241
+ : userCanApprove
242
+ ? ''
243
+ : 'You are not assigned to review this task'
244
+ }
245
+ >
246
+ <Button
247
+ variant="contained"
248
+ color="error"
249
+ onClick={handleDenyClick}
250
+ disabled={!userCanApprove || isLoading}
251
+ >
252
+ Deny Task
253
+ </Button>
254
+ </Tooltip>
255
+ </Box>
256
+ )}
257
+ <EntitlementsDataContractContent
258
+ currentViewer={contractViewerState}
259
+ getContractTaskUrl={() =>
260
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
261
+ generateContractPagePath(contractId, taskId),
262
+ )
263
+ }
264
+ getDataProductUrl={(
265
+ dataProductId: string,
266
+ deploymentId: number,
267
+ ) =>
268
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
269
+ generateLakehouseDataProductPath(
270
+ dataProductId,
271
+ deploymentId,
272
+ ),
273
+ )
274
+ }
275
+ initialSelectedUser={initialUser}
276
+ onRefresh={handleRefresh}
277
+ isReadOnly={true}
278
+ />
279
+ </div>
280
+ )}
281
+ </LegendMarketplacePage>
282
+ );
283
+ }),
284
+ );
@@ -73,7 +73,7 @@ import {
73
73
  EXTERNAL_APPLICATION_NAVIGATION__generateDataSpaceQueryEditorUrl,
74
74
  EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl,
75
75
  generateLakehouseDataProductPath,
76
- generateLakehouseTaskPath,
76
+ generateContractPagePath,
77
77
  } from '../../__lib__/LegendMarketplaceNavigation.js';
78
78
  import {
79
79
  DataSpaceViewerState,
@@ -418,9 +418,9 @@ export class LegendMarketplaceProductViewerStore {
418
418
  this.marketplaceBaseStore.lakehouseIngestServerClient,
419
419
  this.marketplaceBaseStore.applicationStore.pluginManager.getApplicationPlugins(),
420
420
  {
421
- getContractTaskUrl: (taskId: string) =>
421
+ getContractTaskUrl: (contractId: string, taskId: string) =>
422
422
  this.marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
423
- generateLakehouseTaskPath(taskId),
423
+ generateContractPagePath(contractId, taskId),
424
424
  ),
425
425
  getDataProductUrl: (_dataProductId: string, _deploymentId: number) =>
426
426
  this.marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
package/tsconfig.json CHANGED
@@ -122,6 +122,7 @@
122
122
  "./src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx",
123
123
  "./src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx",
124
124
  "./src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx",
125
+ "./src/pages/Lakehouse/entitlements/LakehouseDataContract.tsx",
125
126
  "./src/pages/Lakehouse/entitlements/LakehouseEntitlements.tsx",
126
127
  "./src/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.tsx",
127
128
  "./src/pages/Profile/LegendMarketplaceSubscriptions.tsx",