@e-llm-studio/instant-learning 1.3.31 → 1.3.33
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.
- package/dist/ILMarketplaceWrapper.js +12 -2
- package/dist/ILMarketplaceWrapper.js.map +1 -1
- package/dist/cjs/ILMarketplaceWrapper.js +12 -2
- package/dist/cjs/ILMarketplaceWrapper.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineCardMenu.js +8 -2
- package/dist/cjs/features/IL-marketplace/components/GuidelineCardMenu.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineCardMenu.module.css.js +2 -2
- package/dist/cjs/features/IL-marketplace/components/GuidelineIconButton.js +2 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineIconButton.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js +296 -46
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.module.css.js +2 -2
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryContent.js +4 -0
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryContent.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineStatusChip.js +26 -0
- package/dist/cjs/features/IL-marketplace/components/GuidelineStatusChip.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineStatusChip.module.css.js +2 -2
- package/dist/cjs/features/IL-marketplace/components/LearningManagementWrapper.js +4 -2
- package/dist/cjs/features/IL-marketplace/components/LearningManagementWrapper.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/constants.js +6 -0
- package/dist/cjs/features/IL-marketplace/constants.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/hooks/useAppAccess.js +65 -0
- package/dist/cjs/features/IL-marketplace/hooks/useAppAccess.js.map +1 -0
- package/dist/cjs/features/IL-marketplace/hooks/useResourcePermissions.js +33 -0
- package/dist/cjs/features/IL-marketplace/hooks/useResourcePermissions.js.map +1 -0
- package/dist/cjs/features/IL-marketplace/services/IL-marketplace.api.js +17 -2
- package/dist/cjs/features/IL-marketplace/services/IL-marketplace.api.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/services/instant-learning.api.js +33 -0
- package/dist/cjs/features/IL-marketplace/services/instant-learning.api.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/utils/appsecRoles.js +46 -0
- package/dist/cjs/features/IL-marketplace/utils/appsecRoles.js.map +1 -0
- package/dist/cjs/features/LearningManagement/LearningManagement.js +3 -1
- package/dist/cjs/features/LearningManagement/LearningManagement.js.map +1 -1
- package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js +4 -2
- package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js.map +1 -1
- package/dist/cjs/features/LearningManagement/Sidebar.js +13 -0
- package/dist/cjs/features/LearningManagement/Sidebar.js.map +1 -1
- package/dist/cjs/features/LearningManagement/SidebarWrapper.js +5 -2
- package/dist/cjs/features/LearningManagement/SidebarWrapper.js.map +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js.map +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js +12 -2
- package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js.map +1 -1
- package/dist/cjs/features/LearningManagement/styles/Sidebar.module.css.js +2 -2
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +3 -0
- package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js.map +1 -1
- package/dist/cjs/schema-driven/components/ConditionSectionField.js +1 -1
- package/dist/cjs/schema-driven/components/ConditionSectionField.js.map +1 -1
- package/dist/cjs/schema-driven/utils/conditionText.js +12 -0
- package/dist/cjs/schema-driven/utils/conditionText.js.map +1 -1
- package/dist/features/IL-marketplace/components/GuidelineCardMenu.js +9 -3
- package/dist/features/IL-marketplace/components/GuidelineCardMenu.js.map +1 -1
- package/dist/features/IL-marketplace/components/GuidelineCardMenu.module.css.js +2 -2
- package/dist/features/IL-marketplace/components/GuidelineIconButton.js +2 -1
- package/dist/features/IL-marketplace/components/GuidelineIconButton.js.map +1 -1
- package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js +300 -50
- package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js.map +1 -1
- package/dist/features/IL-marketplace/components/GuidelineLibraryCard.module.css.js +2 -2
- package/dist/features/IL-marketplace/components/GuidelineLibraryContent.js +4 -0
- package/dist/features/IL-marketplace/components/GuidelineLibraryContent.js.map +1 -1
- package/dist/features/IL-marketplace/components/GuidelineStatusChip.js +24 -1
- package/dist/features/IL-marketplace/components/GuidelineStatusChip.js.map +1 -1
- package/dist/features/IL-marketplace/components/GuidelineStatusChip.module.css.js +2 -2
- package/dist/features/IL-marketplace/components/LearningManagementWrapper.js +4 -2
- package/dist/features/IL-marketplace/components/LearningManagementWrapper.js.map +1 -1
- package/dist/features/IL-marketplace/constants.js +4 -1
- package/dist/features/IL-marketplace/constants.js.map +1 -1
- package/dist/features/IL-marketplace/hooks/useAppAccess.js +61 -0
- package/dist/features/IL-marketplace/hooks/useAppAccess.js.map +1 -0
- package/dist/features/IL-marketplace/hooks/useResourcePermissions.js +29 -0
- package/dist/features/IL-marketplace/hooks/useResourcePermissions.js.map +1 -0
- package/dist/features/IL-marketplace/services/IL-marketplace.api.js +16 -3
- package/dist/features/IL-marketplace/services/IL-marketplace.api.js.map +1 -1
- package/dist/features/IL-marketplace/services/instant-learning.api.js +32 -1
- package/dist/features/IL-marketplace/services/instant-learning.api.js.map +1 -1
- package/dist/features/IL-marketplace/utils/appsecRoles.js +36 -0
- package/dist/features/IL-marketplace/utils/appsecRoles.js.map +1 -0
- package/dist/features/LearningManagement/LearningManagement.js +3 -1
- package/dist/features/LearningManagement/LearningManagement.js.map +1 -1
- package/dist/features/LearningManagement/LearningTemplateLayout.js +4 -2
- package/dist/features/LearningManagement/LearningTemplateLayout.js.map +1 -1
- package/dist/features/LearningManagement/Sidebar.js +14 -1
- package/dist/features/LearningManagement/Sidebar.js.map +1 -1
- package/dist/features/LearningManagement/SidebarWrapper.js +5 -2
- package/dist/features/LearningManagement/SidebarWrapper.js.map +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModal.js.map +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js +12 -2
- package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js.map +1 -1
- package/dist/features/LearningManagement/styles/Sidebar.module.css.js +2 -2
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +3 -0
- package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js.map +1 -1
- package/dist/schema-driven/components/ConditionSectionField.js +2 -2
- package/dist/schema-driven/components/ConditionSectionField.js.map +1 -1
- package/dist/schema-driven/utils/conditionText.js +12 -1
- package/dist/schema-driven/utils/conditionText.js.map +1 -1
- package/dist/types/src/ILMarketplaceWrapper.d.ts +23 -1
- package/dist/types/src/ILMarketplaceWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineCardMenu.d.ts +8 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineCardMenu.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineIconButton.d.ts +1 -0
- package/dist/types/src/features/IL-marketplace/components/GuidelineIconButton.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts +65 -3
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryContent.d.ts +6 -2
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryContent.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineStatusChip.d.ts +15 -0
- package/dist/types/src/features/IL-marketplace/components/GuidelineStatusChip.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/LearningManagementWrapper.d.ts +3 -1
- package/dist/types/src/features/IL-marketplace/components/LearningManagementWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/constants.d.ts +12 -0
- package/dist/types/src/features/IL-marketplace/constants.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/hooks/useAppAccess.d.ts +29 -0
- package/dist/types/src/features/IL-marketplace/hooks/useAppAccess.d.ts.map +1 -0
- package/dist/types/src/features/IL-marketplace/hooks/useResourcePermissions.d.ts +15 -0
- package/dist/types/src/features/IL-marketplace/hooks/useResourcePermissions.d.ts.map +1 -0
- package/dist/types/src/features/IL-marketplace/index.d.ts +3 -1
- package/dist/types/src/features/IL-marketplace/index.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/services/IL-marketplace.api.d.ts +31 -1
- package/dist/types/src/features/IL-marketplace/services/IL-marketplace.api.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/services/instant-learning.api.d.ts +31 -0
- package/dist/types/src/features/IL-marketplace/services/instant-learning.api.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/types.d.ts +6 -0
- package/dist/types/src/features/IL-marketplace/types.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/utils/appsecRoles.d.ts +27 -0
- package/dist/types/src/features/IL-marketplace/utils/appsecRoles.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts +3 -1
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts +2 -0
- package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/Sidebar.d.ts +3 -0
- package/dist/types/src/features/LearningManagement/Sidebar.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/SidebarWrapper.d.ts +1 -0
- package/dist/types/src/features/LearningManagement/SidebarWrapper.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts +5 -0
- package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts +5 -0
- package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts.map +1 -1
- package/dist/types/src/schema-driven/utils/conditionText.d.ts +2 -0
- package/dist/types/src/schema-driven/utils/conditionText.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { Check, Plus, Share, Eye, ArrowUpRight, Pin, Share2, EllipsisVertical, Clock, Heart, Upload,
|
|
4
|
+
import { Check, Plus, Share, Eye, ArrowUpRight, Loader2, KeyRound, Pin, Share2, EllipsisVertical, Clock, Heart, Upload, Lock, ChevronDown } from 'lucide-react';
|
|
5
5
|
import cssStyles from './GuidelineLibraryCard.module.css.js';
|
|
6
6
|
import appsecStyles from '../../LearningManagement/RBAC/AccessPanel.module.css.js';
|
|
7
|
-
import { CONFIGURABLE_GUIDELINE_STATUSES, PUBLISHABLE_GUIDELINE_STATUSES, FALLBACK_RBAC_CONFIG } from '../constants.js';
|
|
7
|
+
import { ILKB_VIEW_PERMISSION, ILKB_SHARE_PERMISSION, ILKB_DELETE_PERMISSION, CONFIGURABLE_GUIDELINE_STATUSES, PUBLISHABLE_GUIDELINE_STATUSES, FALLBACK_RBAC_CONFIG } from '../constants.js';
|
|
8
8
|
import { getGuidelineId, getGuidelineTitle, getGuidelineDisplayDescription, getGuidelineDate, isInstantLearningGuideline, cx } from '../utils.js';
|
|
9
9
|
import { GuidelineIconButton } from './GuidelineIconButton.js';
|
|
10
10
|
import { GuidelineTooltip } from './GuidelineTooltip.js';
|
|
11
11
|
import { createGuidelineCardMenuItems, GuidelineCardMenu } from './GuidelineCardMenu.js';
|
|
12
12
|
import { GuidelineConfirmDialog } from './GuidelineConfirmDialog.js';
|
|
13
|
-
import { isUnderReviewStatus, GuidelineStatusChip } from './GuidelineStatusChip.js';
|
|
13
|
+
import { isUnderReviewStatus, isKnownApprovalStatus, isKnownGuidelineStatus, GuidelineStatusChip, GuidelineApprovalChip } from './GuidelineStatusChip.js';
|
|
14
14
|
import { VersionSelectDropdown } from './VersionSelectDropdown.js';
|
|
15
15
|
import useAuthStore from '../../LearningManagement/store/useAuthStore.js';
|
|
16
16
|
import { useMarketplaceApprovalStatus } from '../hooks/useMarketplaceApprovalStatus.js';
|
|
17
|
+
import { useResourcePermissions } from '../hooks/useResourcePermissions.js';
|
|
18
|
+
import { useAppAccess } from '../hooks/useAppAccess.js';
|
|
17
19
|
import { Toast } from 'primereact/toast';
|
|
18
20
|
import { RbacQueryProvider, AppsecProvider, ShareAccessModal } from 'appsec-ui';
|
|
19
21
|
import { fetchRBACConfig } from '../services/instant-learning.api.js';
|
|
22
|
+
import { createRoleFilterAxiosConfig, clearAppsecRoleLists } from '../utils/appsecRoles.js';
|
|
20
23
|
import ErrorToastContent from '../../LearningManagement/shared/ErrorToastContent.js';
|
|
21
24
|
import SuccessToastContent from '../../LearningManagement/shared/SuccessToastContent.js';
|
|
22
25
|
|
|
26
|
+
const DELETE_DISABLED_REASONS = {
|
|
27
|
+
checking: "Checking your permissions\u2026",
|
|
28
|
+
denied: "You don't have permission to delete this.",
|
|
29
|
+
error: "Couldn't verify your delete permission. Reopen the menu to try again."
|
|
30
|
+
};
|
|
31
|
+
const REQUEST_ACCESS_TOOLTIPS = {
|
|
32
|
+
idle: "Request access",
|
|
33
|
+
sending: "Sending your request\u2026",
|
|
34
|
+
sent: "Access requested"
|
|
35
|
+
};
|
|
36
|
+
const SHARE_TOOLTIPS = {
|
|
37
|
+
allowed: "Share",
|
|
38
|
+
checking: "Checking your access\u2026",
|
|
39
|
+
denied: "You don't have permission to share this.",
|
|
40
|
+
error: "Couldn't check your share permission. Click to try again."
|
|
41
|
+
};
|
|
23
42
|
function GuidelineLibraryCard({
|
|
24
43
|
guideline,
|
|
25
44
|
isSelected,
|
|
@@ -65,6 +84,7 @@ function GuidelineLibraryCard({
|
|
|
65
84
|
isShareEnabled = true,
|
|
66
85
|
shareableGuidelineStatuses,
|
|
67
86
|
externalShareRbacConfig,
|
|
87
|
+
marketplaceAccessControl,
|
|
68
88
|
handleViewButtonCallback,
|
|
69
89
|
handlePreviewButtonCallback,
|
|
70
90
|
handleCardClickCallback,
|
|
@@ -75,6 +95,7 @@ function GuidelineLibraryCard({
|
|
|
75
95
|
previewDisabledTooltip,
|
|
76
96
|
onApproveGuideline,
|
|
77
97
|
onRejectGuideline,
|
|
98
|
+
onRequestAccess,
|
|
78
99
|
waitingReviewLabel = "Waiting on your review",
|
|
79
100
|
approveLabel = "Approve",
|
|
80
101
|
rejectLabel = "Reject",
|
|
@@ -82,7 +103,7 @@ function GuidelineLibraryCard({
|
|
|
82
103
|
exploreHighlightConfig,
|
|
83
104
|
guidelinePinnedMessages
|
|
84
105
|
}) {
|
|
85
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
106
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H;
|
|
86
107
|
const guidelineId = getGuidelineId(guideline);
|
|
87
108
|
const title = getGuidelineTitle(guideline);
|
|
88
109
|
const description = getGuidelineDisplayDescription(guideline);
|
|
@@ -119,10 +140,33 @@ function GuidelineLibraryCard({
|
|
|
119
140
|
const guidelineStatus = guideline.status;
|
|
120
141
|
const isDraftGuideline = (guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase() === "draft";
|
|
121
142
|
const isUnderReview = isUnderReviewStatus(guidelineStatus);
|
|
143
|
+
const approvalStatus = guideline.approval_status;
|
|
144
|
+
const showApprovalChip = isKnownApprovalStatus(approvalStatus) && (guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase() !== "published";
|
|
145
|
+
const showStatusRow = isILMarketplace && ((_m = (_l = metadataConfig == null ? void 0 : metadataConfig.status) == null ? void 0 : _l.show) != null ? _m : false);
|
|
146
|
+
const statusFieldLabel = (_o = (_n = metadataConfig == null ? void 0 : metadataConfig.status) == null ? void 0 : _n.label) != null ? _o : "Status";
|
|
147
|
+
const hasStatusChip = showApprovalChip || isKnownGuidelineStatus(guidelineStatus);
|
|
148
|
+
const isPublishAwaitingApproval = isKnownApprovalStatus(approvalStatus) && approvalStatus.trim().toLowerCase() !== "approved";
|
|
122
149
|
const currentUserEmail = useAuthStore((state) => {
|
|
123
150
|
var _a2;
|
|
124
151
|
return (_a2 = state.user) == null ? void 0 : _a2.email;
|
|
125
152
|
});
|
|
153
|
+
const appsecRbacUrl = instantLearning == null ? void 0 : instantLearning.appsecGranularRbacUrl;
|
|
154
|
+
const rbacAppId = externalShareRbacConfig == null ? void 0 : externalShareRbacConfig.applicationId;
|
|
155
|
+
const ilkbModuleId = externalShareRbacConfig == null ? void 0 : externalShareRbacConfig.moduleId;
|
|
156
|
+
const accessControl = isILMarketplace ? marketplaceAccessControl : void 0;
|
|
157
|
+
const viewPermission = (_p = accessControl == null ? void 0 : accessControl.viewPermission) != null ? _p : ILKB_VIEW_PERMISSION;
|
|
158
|
+
const sharePermission = (_q = accessControl == null ? void 0 : accessControl.sharePermission) != null ? _q : ILKB_SHARE_PERMISSION;
|
|
159
|
+
const deletePermission = (_r = accessControl == null ? void 0 : accessControl.deletePermission) != null ? _r : ILKB_DELETE_PERMISSION;
|
|
160
|
+
const appAccess = useAppAccess({
|
|
161
|
+
appsecRbacUrl,
|
|
162
|
+
token: instantLearning == null ? void 0 : instantLearning.token,
|
|
163
|
+
appId: rbacAppId,
|
|
164
|
+
moduleId: accessControl == null ? void 0 : accessControl.appModuleId,
|
|
165
|
+
roles: accessControl == null ? void 0 : accessControl.appRoles,
|
|
166
|
+
userKey: currentUserEmail,
|
|
167
|
+
enabled: Boolean(accessControl)
|
|
168
|
+
});
|
|
169
|
+
const isAccessDenied = isILMarketplace && guideline.has_access === false && !appAccess.permissions.has(viewPermission);
|
|
126
170
|
const { data: approvalCompletionStatus } = useMarketplaceApprovalStatus(
|
|
127
171
|
guideline == null ? void 0 : guideline.instant_learning_id,
|
|
128
172
|
guideline == null ? void 0 : guideline.scope_id,
|
|
@@ -130,23 +174,23 @@ function GuidelineLibraryCard({
|
|
|
130
174
|
instantLearning == null ? void 0 : instantLearning.baseUrl,
|
|
131
175
|
isILMarketplace && isUnderReview
|
|
132
176
|
);
|
|
133
|
-
const approvers = (
|
|
177
|
+
const approvers = (_s = approvalCompletionStatus == null ? void 0 : approvalCompletionStatus.users) != null ? _s : [];
|
|
134
178
|
const isCurrentUserApprover = Boolean(currentUserEmail) && (approvers == null ? void 0 : approvers.some((approver) => approver.email.toLowerCase() === currentUserEmail.toLowerCase()));
|
|
135
|
-
const selectButtonIcon = isSelected ? (
|
|
136
|
-
const shareIcon = (
|
|
179
|
+
const selectButtonIcon = isSelected ? (_t = customIcons == null ? void 0 : customIcons.selectedIcon) != null ? _t : /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 flex-shrink-0", strokeWidth: 2.4 }) : (_u = customIcons == null ? void 0 : customIcons.unselectedIcon) != null ? _u : /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 flex-shrink-0", strokeWidth: 2.4 });
|
|
180
|
+
const shareIcon = (_v = customIcons == null ? void 0 : customIcons.shareIcon) != null ? _v : /* @__PURE__ */ jsx(Share, { className: "h-5 w-5", strokeWidth: 2.2 });
|
|
137
181
|
const activeAddLabel = isInstantLearningMode ? selectLabel : addToCartLabel;
|
|
138
182
|
const activeAddedLabel = isInstantLearningMode ? selectedLabel : addedToCartLabel;
|
|
139
183
|
const resolvedPinnedMessage = guideline.instant_learning_id ? guidelinePinnedMessages == null ? void 0 : guidelinePinnedMessages[guideline.instant_learning_id] : void 0;
|
|
140
184
|
const useStatusActions = Boolean(statusActions == null ? void 0 : statusActions.modeName);
|
|
141
|
-
const isConfigurableStatus = ((
|
|
142
|
-
const primaryActionLabel = useStatusActions ? isConfigurableStatus ? (
|
|
185
|
+
const isConfigurableStatus = ((_w = statusActions == null ? void 0 : statusActions.configurableStatuses) != null ? _w : CONFIGURABLE_GUIDELINE_STATUSES).includes((guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase());
|
|
186
|
+
const primaryActionLabel = useStatusActions ? isConfigurableStatus ? (_x = statusActions == null ? void 0 : statusActions.configureLabel) != null ? _x : "Configure" : (_y = statusActions == null ? void 0 : statusActions.testLabel) != null ? _y : "Test Template" : isSelected ? activeAddedLabel : activeAddLabel;
|
|
143
187
|
const isExploreHighlighted = Boolean(exploreHighlightGuidelineIds == null ? void 0 : exploreHighlightGuidelineIds.includes(guidelineId));
|
|
144
188
|
const displayedPrimaryActionLabel = isExploreHighlighted && (exploreHighlightConfig == null ? void 0 : exploreHighlightConfig.label) ? exploreHighlightConfig.label : primaryActionLabel;
|
|
145
189
|
const isPrimaryActionDisabled = useStatusActions && !(isConfigurableStatus ? statusActions == null ? void 0 : statusActions.onConfigure : statusActions == null ? void 0 : statusActions.onTest);
|
|
146
190
|
const shouldShowPrimaryAction = (statusActions == null ? void 0 : statusActions.showPrimaryAction) !== false;
|
|
147
191
|
const primaryActionDisabledTooltip = "Coming soon";
|
|
148
192
|
const canPublishGuideline = Boolean(handlePublishButtonCallback) && PUBLISHABLE_GUIDELINE_STATUSES.includes((guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase());
|
|
149
|
-
const ilInstanceMappingId = (
|
|
193
|
+
const ilInstanceMappingId = (_z = guideline.application_mapping_ids) == null ? void 0 : _z[0];
|
|
150
194
|
const isShareableStatus = !shareableGuidelineStatuses || shareableGuidelineStatuses.includes((guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase());
|
|
151
195
|
const canShareGuideline = Boolean(
|
|
152
196
|
isILMarketplace && isShareEnabled && isShareableStatus && ilInstanceMappingId && (instantLearning == null ? void 0 : instantLearning.token) && (instantLearning == null ? void 0 : instantLearning.baseUrl)
|
|
@@ -163,7 +207,7 @@ function GuidelineLibraryCard({
|
|
|
163
207
|
externalShareRbacConfig
|
|
164
208
|
);
|
|
165
209
|
}
|
|
166
|
-
const versionList = (
|
|
210
|
+
const versionList = (_A = guideline.version_list) != null ? _A : [];
|
|
167
211
|
const currentVersion = guideline == null ? void 0 : guideline.version;
|
|
168
212
|
const showVersionSelector = isILMarketplace && versionList.length > 0;
|
|
169
213
|
const moreButtonRef = useRef(null);
|
|
@@ -186,10 +230,74 @@ function GuidelineLibraryCard({
|
|
|
186
230
|
);
|
|
187
231
|
const [wishlistLoading, setWishlistLoading] = useState(false);
|
|
188
232
|
const [decisionLoading, setDecisionLoading] = useState(null);
|
|
233
|
+
const [requestAccessState, setRequestAccessState] = useState("idle");
|
|
189
234
|
const [whenToApplyOpen, setWhenToApplyOpen] = useState(false);
|
|
190
235
|
const [whenNotToApplyOpen, setWhenNotToApplyOpen] = useState(false);
|
|
191
236
|
const resolvedDuplicateDescription = duplicateConfirmDescription != null ? duplicateConfirmDescription : `Are you sure you want to duplicate "${title}"? A copy will be created with "(1)" appended to the title.`;
|
|
192
237
|
const resolvedDeleteDescription = deleteConfirmDescription != null ? deleteConfirmDescription : `Are you sure you want to delete "${title}"? This action cannot be undone.`;
|
|
238
|
+
const canCheckCardPermissions = Boolean(
|
|
239
|
+
appsecRbacUrl && (instantLearning == null ? void 0 : instantLearning.token) && rbacAppId && ilkbModuleId && guidelineId
|
|
240
|
+
);
|
|
241
|
+
const appAllowsShare = appAccess.permissions.has(sharePermission);
|
|
242
|
+
const appAllowsDelete = appAccess.permissions.has(deletePermission);
|
|
243
|
+
const shouldCheckCardPermissions = accessControl ? !isAccessDenied && !appAccess.isPending && !(appAllowsShare && appAllowsDelete) : isILMarketplace && guideline.has_access === true && canCheckCardPermissions;
|
|
244
|
+
const {
|
|
245
|
+
data: cardPermissions,
|
|
246
|
+
isError: isCardPermissionError,
|
|
247
|
+
refetch: refetchCardPermissions
|
|
248
|
+
} = useResourcePermissions({
|
|
249
|
+
appsecRbacUrl,
|
|
250
|
+
token: instantLearning == null ? void 0 : instantLearning.token,
|
|
251
|
+
appId: rbacAppId,
|
|
252
|
+
moduleId: ilkbModuleId,
|
|
253
|
+
resourceId: guidelineId,
|
|
254
|
+
userKey: currentUserEmail,
|
|
255
|
+
enabled: shouldCheckCardPermissions && (menuOpen || Boolean(accessControl) && canShareGuideline && !appAllowsShare)
|
|
256
|
+
});
|
|
257
|
+
const getPermissionState = (permission) => {
|
|
258
|
+
if (isAccessDenied) return "denied";
|
|
259
|
+
if (accessControl) {
|
|
260
|
+
if (appAccess.permissions.has(permission)) return "allowed";
|
|
261
|
+
if (appAccess.isPending) return "checking";
|
|
262
|
+
if (!canCheckCardPermissions) return "error";
|
|
263
|
+
if (cardPermissions) {
|
|
264
|
+
if (cardPermissions.includes(permission)) return "allowed";
|
|
265
|
+
return appAccess.isError ? "error" : "denied";
|
|
266
|
+
}
|
|
267
|
+
return isCardPermissionError ? "error" : "checking";
|
|
268
|
+
}
|
|
269
|
+
if (!shouldCheckCardPermissions) return "allowed";
|
|
270
|
+
if (cardPermissions) return cardPermissions.includes(permission) ? "allowed" : "denied";
|
|
271
|
+
return isCardPermissionError ? "error" : "checking";
|
|
272
|
+
};
|
|
273
|
+
const retryFailedPermissionChecks = () => {
|
|
274
|
+
if (appAccess.isError) appAccess.retry();
|
|
275
|
+
if (isCardPermissionError && canCheckCardPermissions) void refetchCardPermissions();
|
|
276
|
+
};
|
|
277
|
+
const deletePermissionState = getPermissionState(deletePermission);
|
|
278
|
+
const canDeleteGuideline = deletePermissionState === "allowed";
|
|
279
|
+
const deleteDisabledReason = deletePermissionState === "allowed" ? void 0 : DELETE_DISABLED_REASONS[deletePermissionState];
|
|
280
|
+
const sharePermissionState = accessControl ? getPermissionState(sharePermission) : "allowed";
|
|
281
|
+
const isShareBusy = shareConfigLoading || sharePermissionState === "checking";
|
|
282
|
+
const isShareLocked = !isAccessDenied && (sharePermissionState === "denied" || sharePermissionState === "error");
|
|
283
|
+
const shareRolesKey = (_C = (_B = accessControl == null ? void 0 : accessControl.shareRoles) == null ? void 0 : _B.join("\n")) != null ? _C : "";
|
|
284
|
+
const ilkbShareAxiosConfig = useMemo(
|
|
285
|
+
() => shareRolesKey ? createRoleFilterAxiosConfig(shareRolesKey.split("\n")) : void 0,
|
|
286
|
+
[shareRolesKey]
|
|
287
|
+
);
|
|
288
|
+
const ilkbShareTarget = ilkbShareAxiosConfig && ilkbModuleId && guidelineId ? {
|
|
289
|
+
appName: (_D = accessControl == null ? void 0 : accessControl.applicationName) != null ? _D : FALLBACK_RBAC_CONFIG.applicationName,
|
|
290
|
+
moduleId: ilkbModuleId,
|
|
291
|
+
resourceId: guidelineId,
|
|
292
|
+
axiosConfig: ilkbShareAxiosConfig
|
|
293
|
+
} : void 0;
|
|
294
|
+
const shareDialogTarget = ilkbShareTarget != null ? ilkbShareTarget : shareRbacConfig ? {
|
|
295
|
+
appName: shareRbacConfig.applicationId,
|
|
296
|
+
moduleId: shareRbacConfig.applicationModuleId,
|
|
297
|
+
resourceId: shareRbacConfig.resourceId,
|
|
298
|
+
external: externalShareTarget
|
|
299
|
+
} : void 0;
|
|
300
|
+
const isIlkbShareDialogOpen = shareDialogOpen && Boolean(ilkbShareTarget);
|
|
193
301
|
useEffect(() => {
|
|
194
302
|
setIsWishlisted(!!guideline.is_wishlisted);
|
|
195
303
|
}, [guideline.is_wishlisted]);
|
|
@@ -230,6 +338,10 @@ function GuidelineLibraryCard({
|
|
|
230
338
|
setShareRbacConfig(null);
|
|
231
339
|
setShareDialogOpen(false);
|
|
232
340
|
}, [ilInstanceMappingId]);
|
|
341
|
+
useEffect(() => {
|
|
342
|
+
if (!isIlkbShareDialogOpen) return void 0;
|
|
343
|
+
return clearAppsecRoleLists;
|
|
344
|
+
}, [isIlkbShareDialogOpen]);
|
|
233
345
|
const handleWishlistToggle = async (e) => {
|
|
234
346
|
e.stopPropagation();
|
|
235
347
|
if (!onWishlistToggle || !(instantLearning == null ? void 0 : instantLearning.token) || !ilInstanceMappingId) return;
|
|
@@ -274,7 +386,19 @@ function GuidelineLibraryCard({
|
|
|
274
386
|
const handleShareClick = async (event) => {
|
|
275
387
|
var _a2, _b2, _c2, _d2;
|
|
276
388
|
event.stopPropagation();
|
|
277
|
-
if (!canShareGuideline ||
|
|
389
|
+
if (!canShareGuideline || isShareBusy) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (sharePermissionState === "error") {
|
|
393
|
+
retryFailedPermissionChecks();
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (sharePermissionState !== "allowed") {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (ilkbShareTarget) {
|
|
400
|
+
clearAppsecRoleLists();
|
|
401
|
+
setShareDialogOpen(true);
|
|
278
402
|
return;
|
|
279
403
|
}
|
|
280
404
|
if (shareRbacConfig) {
|
|
@@ -312,7 +436,7 @@ function GuidelineLibraryCard({
|
|
|
312
436
|
}
|
|
313
437
|
};
|
|
314
438
|
const handleCardClick = (event) => {
|
|
315
|
-
if (!handleCardClickCallback) return;
|
|
439
|
+
if (!handleCardClickCallback || isAccessDenied) return;
|
|
316
440
|
if (event.target.closest('button, a, input, select, [role="menuitem"]')) {
|
|
317
441
|
return;
|
|
318
442
|
}
|
|
@@ -320,6 +444,7 @@ function GuidelineLibraryCard({
|
|
|
320
444
|
};
|
|
321
445
|
const handlePublish = (event) => {
|
|
322
446
|
event.stopPropagation();
|
|
447
|
+
if (isPublishAwaitingApproval) return;
|
|
323
448
|
handlePublishButtonCallback == null ? void 0 : handlePublishButtonCallback(guideline);
|
|
324
449
|
};
|
|
325
450
|
const handleDuplicateConfirm = async () => {
|
|
@@ -363,6 +488,42 @@ function GuidelineLibraryCard({
|
|
|
363
488
|
setDecisionLoading(null);
|
|
364
489
|
}
|
|
365
490
|
};
|
|
491
|
+
const handleRequestAccessClick = async (event) => {
|
|
492
|
+
var _a2, _b2;
|
|
493
|
+
event.stopPropagation();
|
|
494
|
+
if (!onRequestAccess || requestAccessState !== "idle") return;
|
|
495
|
+
setRequestAccessState("sending");
|
|
496
|
+
try {
|
|
497
|
+
await Promise.resolve(onRequestAccess(guideline));
|
|
498
|
+
setRequestAccessState("sent");
|
|
499
|
+
(_a2 = shareToastRef.current) == null ? void 0 : _a2.show({
|
|
500
|
+
severity: "success",
|
|
501
|
+
sticky: false,
|
|
502
|
+
life: 4e3,
|
|
503
|
+
content: /* @__PURE__ */ jsx(
|
|
504
|
+
SuccessToastContent,
|
|
505
|
+
{
|
|
506
|
+
title: "Access requested",
|
|
507
|
+
message: `Your request to access "${title}" has been sent.`
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
});
|
|
511
|
+
} catch (error) {
|
|
512
|
+
setRequestAccessState("idle");
|
|
513
|
+
(_b2 = shareToastRef.current) == null ? void 0 : _b2.show({
|
|
514
|
+
severity: "error",
|
|
515
|
+
sticky: false,
|
|
516
|
+
life: 4e3,
|
|
517
|
+
content: /* @__PURE__ */ jsx(
|
|
518
|
+
ErrorToastContent,
|
|
519
|
+
{
|
|
520
|
+
title: "Request not sent",
|
|
521
|
+
message: error instanceof Error && error.message ? error.message : "Couldn't send your access request. Please try again."
|
|
522
|
+
}
|
|
523
|
+
)
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
};
|
|
366
527
|
const handleRejectClick = async (event) => {
|
|
367
528
|
event.stopPropagation();
|
|
368
529
|
if (!onRejectGuideline) return;
|
|
@@ -393,11 +554,14 @@ function GuidelineLibraryCard({
|
|
|
393
554
|
// TODO: Temporarily hiding delete option in UI until deep research on deleteInstantLearningQuestion API is complete.
|
|
394
555
|
hideDelete: false,
|
|
395
556
|
// hideDeleteOption || !onDelete,
|
|
557
|
+
deleteDisabled: !canDeleteGuideline,
|
|
558
|
+
deleteLoading: deletePermissionState === "checking",
|
|
559
|
+
deleteDisabledReason,
|
|
396
560
|
onToggleVariant: handleToggleVariant,
|
|
397
561
|
isVariantEnabled,
|
|
398
562
|
enableVariantLabel,
|
|
399
563
|
disableVariantLabel,
|
|
400
|
-
hideToggleVariant: hideToggleVariantOption || !onToggleVariant || !((
|
|
564
|
+
hideToggleVariant: hideToggleVariantOption || !onToggleVariant || !((_E = guideline.variant_id) == null ? void 0 : _E.trim()),
|
|
401
565
|
toggleVariantDisabled: toggleVariantLoading
|
|
402
566
|
});
|
|
403
567
|
const hasMenuItems = menuItems.some((item) => !item.hidden);
|
|
@@ -434,6 +598,7 @@ function GuidelineLibraryCard({
|
|
|
434
598
|
{
|
|
435
599
|
type: "button",
|
|
436
600
|
onClick: onToggle2,
|
|
601
|
+
disabled: isAccessDenied,
|
|
437
602
|
"aria-expanded": isOpen,
|
|
438
603
|
className: cssStyles.accordionHeader,
|
|
439
604
|
children: [
|
|
@@ -457,7 +622,11 @@ function GuidelineLibraryCard({
|
|
|
457
622
|
type: "button",
|
|
458
623
|
onClick: () => !isDraftGuideline && handlePreview(),
|
|
459
624
|
"aria-disabled": isDraftGuideline,
|
|
460
|
-
className: cx(
|
|
625
|
+
className: cx(
|
|
626
|
+
cssStyles.previewButton,
|
|
627
|
+
cssStyles.cardPreviewButton,
|
|
628
|
+
isDraftGuideline && cssStyles.previewButtonDisabled
|
|
629
|
+
),
|
|
461
630
|
"aria-label": `Preview ${title}`,
|
|
462
631
|
children: /* @__PURE__ */ jsx(Eye, { className: cssStyles.previewIcon, strokeWidth: 2 })
|
|
463
632
|
}
|
|
@@ -473,7 +642,7 @@ function GuidelineLibraryCard({
|
|
|
473
642
|
const viewActionButton = (statusActions == null ? void 0 : statusActions.showView) !== false && (statusActions == null ? void 0 : statusActions.onView) ? /* @__PURE__ */ jsx(
|
|
474
643
|
GuidelineTooltip,
|
|
475
644
|
{
|
|
476
|
-
content: isViewActionDisabled ? (
|
|
645
|
+
content: isViewActionDisabled ? (_F = statusActions.viewDisabledTooltip) != null ? _F : primaryActionDisabledTooltip : "",
|
|
477
646
|
children: /* @__PURE__ */ jsx(
|
|
478
647
|
"button",
|
|
479
648
|
{
|
|
@@ -484,6 +653,7 @@ function GuidelineLibraryCard({
|
|
|
484
653
|
if (isViewActionDisabled) return;
|
|
485
654
|
(_a2 = statusActions.onView) == null ? void 0 : _a2.call(statusActions, guideline);
|
|
486
655
|
},
|
|
656
|
+
disabled: isAccessDenied,
|
|
487
657
|
"aria-disabled": isViewActionDisabled,
|
|
488
658
|
className: cx(
|
|
489
659
|
cssStyles.selectButton,
|
|
@@ -493,7 +663,7 @@ function GuidelineLibraryCard({
|
|
|
493
663
|
),
|
|
494
664
|
style: styles == null ? void 0 : styles.libraryCardViewButton,
|
|
495
665
|
"aria-label": `View ${title}`,
|
|
496
|
-
children: /* @__PURE__ */ jsx("span", { className: cssStyles.selectButtonLabel, children: (
|
|
666
|
+
children: /* @__PURE__ */ jsx("span", { className: cssStyles.selectButtonLabel, children: (_G = statusActions == null ? void 0 : statusActions.viewLabel) != null ? _G : "View" })
|
|
497
667
|
}
|
|
498
668
|
)
|
|
499
669
|
}
|
|
@@ -509,6 +679,7 @@ function GuidelineLibraryCard({
|
|
|
509
679
|
if (isPromoteActionDisabled) return;
|
|
510
680
|
(_a2 = statusActions.onPromote) == null ? void 0 : _a2.call(statusActions, guideline);
|
|
511
681
|
},
|
|
682
|
+
disabled: isAccessDenied,
|
|
512
683
|
"aria-disabled": isPromoteActionDisabled,
|
|
513
684
|
className: cx(
|
|
514
685
|
cssStyles.selectButton,
|
|
@@ -518,7 +689,7 @@ function GuidelineLibraryCard({
|
|
|
518
689
|
"aria-label": `Promote ${title}`,
|
|
519
690
|
children: [
|
|
520
691
|
/* @__PURE__ */ jsx(ArrowUpRight, { className: cssStyles.selectButtonIcon, strokeWidth: 2.2 }),
|
|
521
|
-
/* @__PURE__ */ jsx("span", { className: cssStyles.selectButtonLabel, children: (
|
|
692
|
+
/* @__PURE__ */ jsx("span", { className: cssStyles.selectButtonLabel, children: (_H = statusActions == null ? void 0 : statusActions.promoteLabel) != null ? _H : "Promote" })
|
|
522
693
|
]
|
|
523
694
|
}
|
|
524
695
|
) : null;
|
|
@@ -532,6 +703,7 @@ function GuidelineLibraryCard({
|
|
|
532
703
|
cssStyles.libraryCard,
|
|
533
704
|
isExploreHighlighted && cssStyles.libraryCardSelected,
|
|
534
705
|
isHighlighted && cssStyles.libraryCardHighlighted,
|
|
706
|
+
isAccessDenied && cssStyles.libraryCardNoAccess,
|
|
535
707
|
classNames == null ? void 0 : classNames.libraryCard
|
|
536
708
|
),
|
|
537
709
|
style: styles == null ? void 0 : styles.libraryCard,
|
|
@@ -561,7 +733,7 @@ function GuidelineLibraryCard({
|
|
|
561
733
|
children: title
|
|
562
734
|
}
|
|
563
735
|
),
|
|
564
|
-
isILMarketplace && /* @__PURE__ */ jsx(
|
|
736
|
+
isILMarketplace && !showStatusRow && !showApprovalChip && /* @__PURE__ */ jsx(
|
|
565
737
|
GuidelineStatusChip,
|
|
566
738
|
{
|
|
567
739
|
status: guidelineStatus,
|
|
@@ -569,6 +741,14 @@ function GuidelineLibraryCard({
|
|
|
569
741
|
style: styles == null ? void 0 : styles.libraryCardStatusChip
|
|
570
742
|
}
|
|
571
743
|
),
|
|
744
|
+
isILMarketplace && !showStatusRow && showApprovalChip && /* @__PURE__ */ jsx(
|
|
745
|
+
GuidelineApprovalChip,
|
|
746
|
+
{
|
|
747
|
+
approvalStatus,
|
|
748
|
+
className: classNames == null ? void 0 : classNames.libraryCardStatusChip,
|
|
749
|
+
style: styles == null ? void 0 : styles.libraryCardStatusChip
|
|
750
|
+
}
|
|
751
|
+
),
|
|
572
752
|
isILMarketplace && !isVariantEnabled && /* @__PURE__ */ jsx(
|
|
573
753
|
"span",
|
|
574
754
|
{
|
|
@@ -586,6 +766,27 @@ function GuidelineLibraryCard({
|
|
|
586
766
|
className: cx(cssStyles.libraryCardActions, classNames == null ? void 0 : classNames.libraryCardActions),
|
|
587
767
|
style: styles == null ? void 0 : styles.libraryCardActions,
|
|
588
768
|
children: [
|
|
769
|
+
isAccessDenied && /* @__PURE__ */ jsx(GuidelineTooltip, { content: REQUEST_ACCESS_TOOLTIPS[requestAccessState], children: /* @__PURE__ */ jsx(
|
|
770
|
+
"button",
|
|
771
|
+
{
|
|
772
|
+
type: "button",
|
|
773
|
+
onClick: handleRequestAccessClick,
|
|
774
|
+
"aria-disabled": requestAccessState !== "idle",
|
|
775
|
+
"aria-busy": requestAccessState === "sending",
|
|
776
|
+
className: cssStyles.requestAccessButton,
|
|
777
|
+
"aria-label": requestAccessState === "sent" ? `Access requested for ${title}` : `Request access to ${title}`,
|
|
778
|
+
children: requestAccessState === "sending" ? /* @__PURE__ */ jsx(
|
|
779
|
+
Loader2,
|
|
780
|
+
{
|
|
781
|
+
className: cx(
|
|
782
|
+
cssStyles.requestAccessIcon,
|
|
783
|
+
cssStyles.requestAccessIconSpinning
|
|
784
|
+
),
|
|
785
|
+
strokeWidth: 2
|
|
786
|
+
}
|
|
787
|
+
) : requestAccessState === "sent" ? /* @__PURE__ */ jsx(Check, { className: cssStyles.requestAccessIcon, strokeWidth: 2.4 }) : /* @__PURE__ */ jsx(KeyRound, { className: cssStyles.requestAccessIcon, strokeWidth: 2 })
|
|
788
|
+
}
|
|
789
|
+
) }),
|
|
589
790
|
resolvedPinnedMessage && /* @__PURE__ */ jsx(GuidelineTooltip, { content: resolvedPinnedMessage, side: "bottom", maxWidth: 320, children: /* @__PURE__ */ jsx("span", { "aria-label": resolvedPinnedMessage, className: cssStyles.pinnedMessageIcon, children: /* @__PURE__ */ jsx(Pin, { className: cssStyles.pinIcon, strokeWidth: 2 }) }) }),
|
|
590
791
|
isInstantLearningMode && !isTemplateLayout && !isILMarketplace && /* @__PURE__ */ jsx(
|
|
591
792
|
GuidelineIconButton,
|
|
@@ -606,7 +807,7 @@ function GuidelineLibraryCard({
|
|
|
606
807
|
{
|
|
607
808
|
versions: versionList,
|
|
608
809
|
currentVersion,
|
|
609
|
-
disabled: versionLoading,
|
|
810
|
+
disabled: versionLoading || isAccessDenied,
|
|
610
811
|
onSelect: handleVersionSelect,
|
|
611
812
|
triggerAriaLabel: `Select version for ${title}`
|
|
612
813
|
}
|
|
@@ -619,7 +820,12 @@ function GuidelineLibraryCard({
|
|
|
619
820
|
slot: "libraryCardMoreButton",
|
|
620
821
|
label: `More options for ${title}`,
|
|
621
822
|
title: "More options",
|
|
622
|
-
onClick: () =>
|
|
823
|
+
onClick: () => {
|
|
824
|
+
if (!hasMenuItems) return;
|
|
825
|
+
if (accessControl && !menuOpen) retryFailedPermissionChecks();
|
|
826
|
+
setMenuOpen((prev) => !prev);
|
|
827
|
+
},
|
|
828
|
+
disabled: isAccessDenied,
|
|
623
829
|
classNames,
|
|
624
830
|
styles,
|
|
625
831
|
ref: moreButtonRef,
|
|
@@ -653,6 +859,27 @@ function GuidelineLibraryCard({
|
|
|
653
859
|
children: description
|
|
654
860
|
}
|
|
655
861
|
),
|
|
862
|
+
showStatusRow && hasStatusChip && /* @__PURE__ */ jsxs("p", { className: cssStyles.topicLabel, children: [
|
|
863
|
+
/* @__PURE__ */ jsxs("span", { className: "flex-shrink-0", children: [
|
|
864
|
+
statusFieldLabel,
|
|
865
|
+
":"
|
|
866
|
+
] }),
|
|
867
|
+
showApprovalChip ? /* @__PURE__ */ jsx(
|
|
868
|
+
GuidelineApprovalChip,
|
|
869
|
+
{
|
|
870
|
+
approvalStatus,
|
|
871
|
+
className: classNames == null ? void 0 : classNames.libraryCardStatusChip,
|
|
872
|
+
style: styles == null ? void 0 : styles.libraryCardStatusChip
|
|
873
|
+
}
|
|
874
|
+
) : /* @__PURE__ */ jsx(
|
|
875
|
+
GuidelineStatusChip,
|
|
876
|
+
{
|
|
877
|
+
status: guidelineStatus,
|
|
878
|
+
className: classNames == null ? void 0 : classNames.libraryCardStatusChip,
|
|
879
|
+
style: styles == null ? void 0 : styles.libraryCardStatusChip
|
|
880
|
+
}
|
|
881
|
+
)
|
|
882
|
+
] }),
|
|
656
883
|
isTemplateLayout && showTopic && topicTitle && /* @__PURE__ */ jsxs("p", { className: cssStyles.topicLabel, children: [
|
|
657
884
|
/* @__PURE__ */ jsxs("span", { className: "flex-shrink-0", children: [
|
|
658
885
|
topicFieldLabel,
|
|
@@ -691,7 +918,7 @@ function GuidelineLibraryCard({
|
|
|
691
918
|
{
|
|
692
919
|
type: "button",
|
|
693
920
|
onClick: handleRejectClick,
|
|
694
|
-
disabled: decisionLoading !== null,
|
|
921
|
+
disabled: decisionLoading !== null || isAccessDenied,
|
|
695
922
|
className: cssStyles.reviewRejectButton,
|
|
696
923
|
children: decisionLoading === "reject" ? "Rejecting..." : rejectLabel
|
|
697
924
|
}
|
|
@@ -701,7 +928,7 @@ function GuidelineLibraryCard({
|
|
|
701
928
|
{
|
|
702
929
|
type: "button",
|
|
703
930
|
onClick: handleApproveClick,
|
|
704
|
-
disabled: decisionLoading !== null,
|
|
931
|
+
disabled: decisionLoading !== null || isAccessDenied,
|
|
705
932
|
className: cssStyles.reviewApproveButton,
|
|
706
933
|
children: decisionLoading === "approve" ? "Approving..." : approveLabel
|
|
707
934
|
}
|
|
@@ -720,7 +947,7 @@ function GuidelineLibraryCard({
|
|
|
720
947
|
{
|
|
721
948
|
type: "button",
|
|
722
949
|
onClick: handleWishlistToggle,
|
|
723
|
-
disabled: wishlistLoading,
|
|
950
|
+
disabled: wishlistLoading || isAccessDenied,
|
|
724
951
|
className: cx(
|
|
725
952
|
cssStyles.wishlistButton,
|
|
726
953
|
isWishlisted ? cssStyles.wishlistButtonWishlisted : cssStyles.wishlistButtonNotWishlisted,
|
|
@@ -738,30 +965,51 @@ function GuidelineLibraryCard({
|
|
|
738
965
|
}
|
|
739
966
|
) }),
|
|
740
967
|
previewButtonWithTooltip,
|
|
741
|
-
canPublishGuideline && /* @__PURE__ */ jsx(
|
|
742
|
-
|
|
968
|
+
canPublishGuideline && /* @__PURE__ */ jsx(
|
|
969
|
+
GuidelineTooltip,
|
|
743
970
|
{
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
971
|
+
content: isPublishAwaitingApproval ? "You can publish once this model is approved" : publishButtonLabel,
|
|
972
|
+
children: /* @__PURE__ */ jsx(
|
|
973
|
+
"button",
|
|
974
|
+
{
|
|
975
|
+
type: "button",
|
|
976
|
+
onClick: handlePublish,
|
|
977
|
+
disabled: isAccessDenied,
|
|
978
|
+
"aria-disabled": isPublishAwaitingApproval,
|
|
979
|
+
className: cx(
|
|
980
|
+
cssStyles.previewButton,
|
|
981
|
+
isPublishAwaitingApproval && cssStyles.previewButtonDisabled
|
|
982
|
+
),
|
|
983
|
+
"aria-label": `${publishButtonLabel}: ${title}`,
|
|
984
|
+
children: /* @__PURE__ */ jsx(Upload, { className: cssStyles.previewIcon, strokeWidth: 2 })
|
|
985
|
+
}
|
|
986
|
+
)
|
|
749
987
|
}
|
|
750
|
-
)
|
|
751
|
-
canShareGuideline && /* @__PURE__ */ jsx(
|
|
752
|
-
|
|
988
|
+
),
|
|
989
|
+
canShareGuideline && /* @__PURE__ */ jsx(
|
|
990
|
+
GuidelineTooltip,
|
|
753
991
|
{
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
992
|
+
content: shareConfigLoading ? "Loading share access" : SHARE_TOOLTIPS[sharePermissionState],
|
|
993
|
+
children: /* @__PURE__ */ jsx(
|
|
994
|
+
"button",
|
|
995
|
+
{
|
|
996
|
+
type: "button",
|
|
997
|
+
onClick: handleShareClick,
|
|
998
|
+
disabled: isAccessDenied,
|
|
999
|
+
"aria-disabled": isShareBusy || sharePermissionState === "denied",
|
|
1000
|
+
className: cx(
|
|
1001
|
+
cssStyles.previewButton,
|
|
1002
|
+
(isShareBusy || sharePermissionState === "denied") && cssStyles.previewButtonDisabled
|
|
1003
|
+
),
|
|
1004
|
+
"aria-label": isShareLocked ? `Share ${title} (locked)` : `Share ${title}`,
|
|
1005
|
+
children: isShareBusy ? /* @__PURE__ */ jsx(Loader2, { className: cssStyles.previewIconSpinner, strokeWidth: 2 }) : isShareLocked ? /* @__PURE__ */ jsxs("span", { className: cssStyles.lockedIcon, children: [
|
|
1006
|
+
/* @__PURE__ */ jsx(Share2, { className: cssStyles.previewIcon, strokeWidth: 2 }),
|
|
1007
|
+
/* @__PURE__ */ jsx(Lock, { className: cssStyles.lockedIconBadge, strokeWidth: 2.5 })
|
|
1008
|
+
] }) : /* @__PURE__ */ jsx(Share2, { className: cssStyles.previewIcon, strokeWidth: 2 })
|
|
1009
|
+
}
|
|
1010
|
+
)
|
|
763
1011
|
}
|
|
764
|
-
)
|
|
1012
|
+
),
|
|
765
1013
|
isTemplateLayout && !isILMarketplace && /* @__PURE__ */ jsx(
|
|
766
1014
|
"button",
|
|
767
1015
|
{
|
|
@@ -789,6 +1037,7 @@ function GuidelineLibraryCard({
|
|
|
789
1037
|
{
|
|
790
1038
|
type: "button",
|
|
791
1039
|
onClick: () => isPrimaryActionDisabled ? void 0 : handleButtonClick(guidelineId),
|
|
1040
|
+
disabled: isAccessDenied,
|
|
792
1041
|
"aria-pressed": isSelected,
|
|
793
1042
|
"aria-disabled": isPrimaryActionDisabled,
|
|
794
1043
|
className: cx(
|
|
@@ -904,27 +1153,28 @@ function GuidelineLibraryCard({
|
|
|
904
1153
|
pt: { root: { style: { zIndex: 9999 } } }
|
|
905
1154
|
}
|
|
906
1155
|
),
|
|
907
|
-
shareDialogOpen &&
|
|
1156
|
+
shareDialogOpen && shareDialogTarget && (instantLearning == null ? void 0 : instantLearning.token) && createPortal(
|
|
908
1157
|
/* @__PURE__ */ jsx("div", { className: cx(appsecStyles.accessPanel, cssStyles.shareModalHost), children: /* @__PURE__ */ jsx(RbacQueryProvider, { children: /* @__PURE__ */ jsx(
|
|
909
1158
|
AppsecProvider,
|
|
910
1159
|
{
|
|
911
|
-
appId:
|
|
1160
|
+
appId: shareDialogTarget.appName,
|
|
912
1161
|
baseUrl: instantLearning.appsecGranularRbacUrl || FALLBACK_RBAC_CONFIG.appsecRbacUrl,
|
|
913
1162
|
appsecUrl: instantLearning.appsecBaseUrl || FALLBACK_RBAC_CONFIG.appsecBaseUrl,
|
|
914
1163
|
mode: "manage",
|
|
915
1164
|
getAuthToken: () => instantLearning.token,
|
|
1165
|
+
axiosConfig: shareDialogTarget.axiosConfig,
|
|
916
1166
|
children: /* @__PURE__ */ jsx(
|
|
917
1167
|
ShareAccessModal,
|
|
918
1168
|
{
|
|
919
|
-
...
|
|
1169
|
+
...shareDialogTarget.external,
|
|
920
1170
|
open: shareDialogOpen,
|
|
921
1171
|
onClose: () => setShareDialogOpen(false),
|
|
922
1172
|
onSuccess: () => {
|
|
923
1173
|
setShareDialogOpen(false);
|
|
924
1174
|
setShareSuccessMessage(`Access to "${title}" has been successfully shared.`);
|
|
925
1175
|
},
|
|
926
|
-
resourceId:
|
|
927
|
-
moduleId:
|
|
1176
|
+
resourceId: shareDialogTarget.resourceId,
|
|
1177
|
+
moduleId: shareDialogTarget.moduleId,
|
|
928
1178
|
resourceName: title,
|
|
929
1179
|
title: "Share Access",
|
|
930
1180
|
description: "Grant access to this resource.",
|