@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
|
@@ -18,12 +18,31 @@ var GuidelineStatusChip = require('./GuidelineStatusChip.js');
|
|
|
18
18
|
var VersionSelectDropdown = require('./VersionSelectDropdown.js');
|
|
19
19
|
var useAuthStore = require('../../LearningManagement/store/useAuthStore.js');
|
|
20
20
|
var useMarketplaceApprovalStatus = require('../hooks/useMarketplaceApprovalStatus.js');
|
|
21
|
+
var useResourcePermissions = require('../hooks/useResourcePermissions.js');
|
|
22
|
+
var useAppAccess = require('../hooks/useAppAccess.js');
|
|
21
23
|
var toast = require('primereact/toast');
|
|
22
24
|
var appsecUi = require('appsec-ui');
|
|
23
25
|
var instantLearning_api = require('../services/instant-learning.api.js');
|
|
26
|
+
var appsecRoles = require('../utils/appsecRoles.js');
|
|
24
27
|
var ErrorToastContent = require('../../LearningManagement/shared/ErrorToastContent.js');
|
|
25
28
|
var SuccessToastContent = require('../../LearningManagement/shared/SuccessToastContent.js');
|
|
26
29
|
|
|
30
|
+
const DELETE_DISABLED_REASONS = {
|
|
31
|
+
checking: "Checking your permissions\u2026",
|
|
32
|
+
denied: "You don't have permission to delete this.",
|
|
33
|
+
error: "Couldn't verify your delete permission. Reopen the menu to try again."
|
|
34
|
+
};
|
|
35
|
+
const REQUEST_ACCESS_TOOLTIPS = {
|
|
36
|
+
idle: "Request access",
|
|
37
|
+
sending: "Sending your request\u2026",
|
|
38
|
+
sent: "Access requested"
|
|
39
|
+
};
|
|
40
|
+
const SHARE_TOOLTIPS = {
|
|
41
|
+
allowed: "Share",
|
|
42
|
+
checking: "Checking your access\u2026",
|
|
43
|
+
denied: "You don't have permission to share this.",
|
|
44
|
+
error: "Couldn't check your share permission. Click to try again."
|
|
45
|
+
};
|
|
27
46
|
function GuidelineLibraryCard({
|
|
28
47
|
guideline,
|
|
29
48
|
isSelected,
|
|
@@ -69,6 +88,7 @@ function GuidelineLibraryCard({
|
|
|
69
88
|
isShareEnabled = true,
|
|
70
89
|
shareableGuidelineStatuses,
|
|
71
90
|
externalShareRbacConfig,
|
|
91
|
+
marketplaceAccessControl,
|
|
72
92
|
handleViewButtonCallback,
|
|
73
93
|
handlePreviewButtonCallback,
|
|
74
94
|
handleCardClickCallback,
|
|
@@ -79,6 +99,7 @@ function GuidelineLibraryCard({
|
|
|
79
99
|
previewDisabledTooltip,
|
|
80
100
|
onApproveGuideline,
|
|
81
101
|
onRejectGuideline,
|
|
102
|
+
onRequestAccess,
|
|
82
103
|
waitingReviewLabel = "Waiting on your review",
|
|
83
104
|
approveLabel = "Approve",
|
|
84
105
|
rejectLabel = "Reject",
|
|
@@ -86,7 +107,7 @@ function GuidelineLibraryCard({
|
|
|
86
107
|
exploreHighlightConfig,
|
|
87
108
|
guidelinePinnedMessages
|
|
88
109
|
}) {
|
|
89
|
-
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;
|
|
110
|
+
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;
|
|
90
111
|
const guidelineId = utils.getGuidelineId(guideline);
|
|
91
112
|
const title = utils.getGuidelineTitle(guideline);
|
|
92
113
|
const description = utils.getGuidelineDisplayDescription(guideline);
|
|
@@ -123,10 +144,33 @@ function GuidelineLibraryCard({
|
|
|
123
144
|
const guidelineStatus = guideline.status;
|
|
124
145
|
const isDraftGuideline = (guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase() === "draft";
|
|
125
146
|
const isUnderReview = GuidelineStatusChip.isUnderReviewStatus(guidelineStatus);
|
|
147
|
+
const approvalStatus = guideline.approval_status;
|
|
148
|
+
const showApprovalChip = GuidelineStatusChip.isKnownApprovalStatus(approvalStatus) && (guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase() !== "published";
|
|
149
|
+
const showStatusRow = isILMarketplace && ((_m = (_l = metadataConfig == null ? void 0 : metadataConfig.status) == null ? void 0 : _l.show) != null ? _m : false);
|
|
150
|
+
const statusFieldLabel = (_o = (_n = metadataConfig == null ? void 0 : metadataConfig.status) == null ? void 0 : _n.label) != null ? _o : "Status";
|
|
151
|
+
const hasStatusChip = showApprovalChip || GuidelineStatusChip.isKnownGuidelineStatus(guidelineStatus);
|
|
152
|
+
const isPublishAwaitingApproval = GuidelineStatusChip.isKnownApprovalStatus(approvalStatus) && approvalStatus.trim().toLowerCase() !== "approved";
|
|
126
153
|
const currentUserEmail = useAuthStore["default"]((state) => {
|
|
127
154
|
var _a2;
|
|
128
155
|
return (_a2 = state.user) == null ? void 0 : _a2.email;
|
|
129
156
|
});
|
|
157
|
+
const appsecRbacUrl = instantLearning == null ? void 0 : instantLearning.appsecGranularRbacUrl;
|
|
158
|
+
const rbacAppId = externalShareRbacConfig == null ? void 0 : externalShareRbacConfig.applicationId;
|
|
159
|
+
const ilkbModuleId = externalShareRbacConfig == null ? void 0 : externalShareRbacConfig.moduleId;
|
|
160
|
+
const accessControl = isILMarketplace ? marketplaceAccessControl : void 0;
|
|
161
|
+
const viewPermission = (_p = accessControl == null ? void 0 : accessControl.viewPermission) != null ? _p : constants.ILKB_VIEW_PERMISSION;
|
|
162
|
+
const sharePermission = (_q = accessControl == null ? void 0 : accessControl.sharePermission) != null ? _q : constants.ILKB_SHARE_PERMISSION;
|
|
163
|
+
const deletePermission = (_r = accessControl == null ? void 0 : accessControl.deletePermission) != null ? _r : constants.ILKB_DELETE_PERMISSION;
|
|
164
|
+
const appAccess = useAppAccess.useAppAccess({
|
|
165
|
+
appsecRbacUrl,
|
|
166
|
+
token: instantLearning == null ? void 0 : instantLearning.token,
|
|
167
|
+
appId: rbacAppId,
|
|
168
|
+
moduleId: accessControl == null ? void 0 : accessControl.appModuleId,
|
|
169
|
+
roles: accessControl == null ? void 0 : accessControl.appRoles,
|
|
170
|
+
userKey: currentUserEmail,
|
|
171
|
+
enabled: Boolean(accessControl)
|
|
172
|
+
});
|
|
173
|
+
const isAccessDenied = isILMarketplace && guideline.has_access === false && !appAccess.permissions.has(viewPermission);
|
|
130
174
|
const { data: approvalCompletionStatus } = useMarketplaceApprovalStatus.useMarketplaceApprovalStatus(
|
|
131
175
|
guideline == null ? void 0 : guideline.instant_learning_id,
|
|
132
176
|
guideline == null ? void 0 : guideline.scope_id,
|
|
@@ -134,23 +178,23 @@ function GuidelineLibraryCard({
|
|
|
134
178
|
instantLearning == null ? void 0 : instantLearning.baseUrl,
|
|
135
179
|
isILMarketplace && isUnderReview
|
|
136
180
|
);
|
|
137
|
-
const approvers = (
|
|
181
|
+
const approvers = (_s = approvalCompletionStatus == null ? void 0 : approvalCompletionStatus.users) != null ? _s : [];
|
|
138
182
|
const isCurrentUserApprover = Boolean(currentUserEmail) && (approvers == null ? void 0 : approvers.some((approver) => approver.email.toLowerCase() === currentUserEmail.toLowerCase()));
|
|
139
|
-
const selectButtonIcon = isSelected ? (
|
|
140
|
-
const shareIcon = (
|
|
183
|
+
const selectButtonIcon = isSelected ? (_t = customIcons == null ? void 0 : customIcons.selectedIcon) != null ? _t : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4 flex-shrink-0", strokeWidth: 2.4 }) : (_u = customIcons == null ? void 0 : customIcons.unselectedIcon) != null ? _u : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4 flex-shrink-0", strokeWidth: 2.4 });
|
|
184
|
+
const shareIcon = (_v = customIcons == null ? void 0 : customIcons.shareIcon) != null ? _v : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Share, { className: "h-5 w-5", strokeWidth: 2.2 });
|
|
141
185
|
const activeAddLabel = isInstantLearningMode ? selectLabel : addToCartLabel;
|
|
142
186
|
const activeAddedLabel = isInstantLearningMode ? selectedLabel : addedToCartLabel;
|
|
143
187
|
const resolvedPinnedMessage = guideline.instant_learning_id ? guidelinePinnedMessages == null ? void 0 : guidelinePinnedMessages[guideline.instant_learning_id] : void 0;
|
|
144
188
|
const useStatusActions = Boolean(statusActions == null ? void 0 : statusActions.modeName);
|
|
145
|
-
const isConfigurableStatus = ((
|
|
146
|
-
const primaryActionLabel = useStatusActions ? isConfigurableStatus ? (
|
|
189
|
+
const isConfigurableStatus = ((_w = statusActions == null ? void 0 : statusActions.configurableStatuses) != null ? _w : constants.CONFIGURABLE_GUIDELINE_STATUSES).includes((guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase());
|
|
190
|
+
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;
|
|
147
191
|
const isExploreHighlighted = Boolean(exploreHighlightGuidelineIds == null ? void 0 : exploreHighlightGuidelineIds.includes(guidelineId));
|
|
148
192
|
const displayedPrimaryActionLabel = isExploreHighlighted && (exploreHighlightConfig == null ? void 0 : exploreHighlightConfig.label) ? exploreHighlightConfig.label : primaryActionLabel;
|
|
149
193
|
const isPrimaryActionDisabled = useStatusActions && !(isConfigurableStatus ? statusActions == null ? void 0 : statusActions.onConfigure : statusActions == null ? void 0 : statusActions.onTest);
|
|
150
194
|
const shouldShowPrimaryAction = (statusActions == null ? void 0 : statusActions.showPrimaryAction) !== false;
|
|
151
195
|
const primaryActionDisabledTooltip = "Coming soon";
|
|
152
196
|
const canPublishGuideline = Boolean(handlePublishButtonCallback) && constants.PUBLISHABLE_GUIDELINE_STATUSES.includes((guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase());
|
|
153
|
-
const ilInstanceMappingId = (
|
|
197
|
+
const ilInstanceMappingId = (_z = guideline.application_mapping_ids) == null ? void 0 : _z[0];
|
|
154
198
|
const isShareableStatus = !shareableGuidelineStatuses || shareableGuidelineStatuses.includes((guidelineStatus != null ? guidelineStatus : "").trim().toLowerCase());
|
|
155
199
|
const canShareGuideline = Boolean(
|
|
156
200
|
isILMarketplace && isShareEnabled && isShareableStatus && ilInstanceMappingId && (instantLearning == null ? void 0 : instantLearning.token) && (instantLearning == null ? void 0 : instantLearning.baseUrl)
|
|
@@ -167,7 +211,7 @@ function GuidelineLibraryCard({
|
|
|
167
211
|
externalShareRbacConfig
|
|
168
212
|
);
|
|
169
213
|
}
|
|
170
|
-
const versionList = (
|
|
214
|
+
const versionList = (_A = guideline.version_list) != null ? _A : [];
|
|
171
215
|
const currentVersion = guideline == null ? void 0 : guideline.version;
|
|
172
216
|
const showVersionSelector = isILMarketplace && versionList.length > 0;
|
|
173
217
|
const moreButtonRef = React.useRef(null);
|
|
@@ -190,10 +234,74 @@ function GuidelineLibraryCard({
|
|
|
190
234
|
);
|
|
191
235
|
const [wishlistLoading, setWishlistLoading] = React.useState(false);
|
|
192
236
|
const [decisionLoading, setDecisionLoading] = React.useState(null);
|
|
237
|
+
const [requestAccessState, setRequestAccessState] = React.useState("idle");
|
|
193
238
|
const [whenToApplyOpen, setWhenToApplyOpen] = React.useState(false);
|
|
194
239
|
const [whenNotToApplyOpen, setWhenNotToApplyOpen] = React.useState(false);
|
|
195
240
|
const resolvedDuplicateDescription = duplicateConfirmDescription != null ? duplicateConfirmDescription : `Are you sure you want to duplicate "${title}"? A copy will be created with "(1)" appended to the title.`;
|
|
196
241
|
const resolvedDeleteDescription = deleteConfirmDescription != null ? deleteConfirmDescription : `Are you sure you want to delete "${title}"? This action cannot be undone.`;
|
|
242
|
+
const canCheckCardPermissions = Boolean(
|
|
243
|
+
appsecRbacUrl && (instantLearning == null ? void 0 : instantLearning.token) && rbacAppId && ilkbModuleId && guidelineId
|
|
244
|
+
);
|
|
245
|
+
const appAllowsShare = appAccess.permissions.has(sharePermission);
|
|
246
|
+
const appAllowsDelete = appAccess.permissions.has(deletePermission);
|
|
247
|
+
const shouldCheckCardPermissions = accessControl ? !isAccessDenied && !appAccess.isPending && !(appAllowsShare && appAllowsDelete) : isILMarketplace && guideline.has_access === true && canCheckCardPermissions;
|
|
248
|
+
const {
|
|
249
|
+
data: cardPermissions,
|
|
250
|
+
isError: isCardPermissionError,
|
|
251
|
+
refetch: refetchCardPermissions
|
|
252
|
+
} = useResourcePermissions.useResourcePermissions({
|
|
253
|
+
appsecRbacUrl,
|
|
254
|
+
token: instantLearning == null ? void 0 : instantLearning.token,
|
|
255
|
+
appId: rbacAppId,
|
|
256
|
+
moduleId: ilkbModuleId,
|
|
257
|
+
resourceId: guidelineId,
|
|
258
|
+
userKey: currentUserEmail,
|
|
259
|
+
enabled: shouldCheckCardPermissions && (menuOpen || Boolean(accessControl) && canShareGuideline && !appAllowsShare)
|
|
260
|
+
});
|
|
261
|
+
const getPermissionState = (permission) => {
|
|
262
|
+
if (isAccessDenied) return "denied";
|
|
263
|
+
if (accessControl) {
|
|
264
|
+
if (appAccess.permissions.has(permission)) return "allowed";
|
|
265
|
+
if (appAccess.isPending) return "checking";
|
|
266
|
+
if (!canCheckCardPermissions) return "error";
|
|
267
|
+
if (cardPermissions) {
|
|
268
|
+
if (cardPermissions.includes(permission)) return "allowed";
|
|
269
|
+
return appAccess.isError ? "error" : "denied";
|
|
270
|
+
}
|
|
271
|
+
return isCardPermissionError ? "error" : "checking";
|
|
272
|
+
}
|
|
273
|
+
if (!shouldCheckCardPermissions) return "allowed";
|
|
274
|
+
if (cardPermissions) return cardPermissions.includes(permission) ? "allowed" : "denied";
|
|
275
|
+
return isCardPermissionError ? "error" : "checking";
|
|
276
|
+
};
|
|
277
|
+
const retryFailedPermissionChecks = () => {
|
|
278
|
+
if (appAccess.isError) appAccess.retry();
|
|
279
|
+
if (isCardPermissionError && canCheckCardPermissions) void refetchCardPermissions();
|
|
280
|
+
};
|
|
281
|
+
const deletePermissionState = getPermissionState(deletePermission);
|
|
282
|
+
const canDeleteGuideline = deletePermissionState === "allowed";
|
|
283
|
+
const deleteDisabledReason = deletePermissionState === "allowed" ? void 0 : DELETE_DISABLED_REASONS[deletePermissionState];
|
|
284
|
+
const sharePermissionState = accessControl ? getPermissionState(sharePermission) : "allowed";
|
|
285
|
+
const isShareBusy = shareConfigLoading || sharePermissionState === "checking";
|
|
286
|
+
const isShareLocked = !isAccessDenied && (sharePermissionState === "denied" || sharePermissionState === "error");
|
|
287
|
+
const shareRolesKey = (_C = (_B = accessControl == null ? void 0 : accessControl.shareRoles) == null ? void 0 : _B.join("\n")) != null ? _C : "";
|
|
288
|
+
const ilkbShareAxiosConfig = React.useMemo(
|
|
289
|
+
() => shareRolesKey ? appsecRoles.createRoleFilterAxiosConfig(shareRolesKey.split("\n")) : void 0,
|
|
290
|
+
[shareRolesKey]
|
|
291
|
+
);
|
|
292
|
+
const ilkbShareTarget = ilkbShareAxiosConfig && ilkbModuleId && guidelineId ? {
|
|
293
|
+
appName: (_D = accessControl == null ? void 0 : accessControl.applicationName) != null ? _D : constants.FALLBACK_RBAC_CONFIG.applicationName,
|
|
294
|
+
moduleId: ilkbModuleId,
|
|
295
|
+
resourceId: guidelineId,
|
|
296
|
+
axiosConfig: ilkbShareAxiosConfig
|
|
297
|
+
} : void 0;
|
|
298
|
+
const shareDialogTarget = ilkbShareTarget != null ? ilkbShareTarget : shareRbacConfig ? {
|
|
299
|
+
appName: shareRbacConfig.applicationId,
|
|
300
|
+
moduleId: shareRbacConfig.applicationModuleId,
|
|
301
|
+
resourceId: shareRbacConfig.resourceId,
|
|
302
|
+
external: externalShareTarget
|
|
303
|
+
} : void 0;
|
|
304
|
+
const isIlkbShareDialogOpen = shareDialogOpen && Boolean(ilkbShareTarget);
|
|
197
305
|
React.useEffect(() => {
|
|
198
306
|
setIsWishlisted(!!guideline.is_wishlisted);
|
|
199
307
|
}, [guideline.is_wishlisted]);
|
|
@@ -234,6 +342,10 @@ function GuidelineLibraryCard({
|
|
|
234
342
|
setShareRbacConfig(null);
|
|
235
343
|
setShareDialogOpen(false);
|
|
236
344
|
}, [ilInstanceMappingId]);
|
|
345
|
+
React.useEffect(() => {
|
|
346
|
+
if (!isIlkbShareDialogOpen) return void 0;
|
|
347
|
+
return appsecRoles.clearAppsecRoleLists;
|
|
348
|
+
}, [isIlkbShareDialogOpen]);
|
|
237
349
|
const handleWishlistToggle = async (e) => {
|
|
238
350
|
e.stopPropagation();
|
|
239
351
|
if (!onWishlistToggle || !(instantLearning == null ? void 0 : instantLearning.token) || !ilInstanceMappingId) return;
|
|
@@ -278,7 +390,19 @@ function GuidelineLibraryCard({
|
|
|
278
390
|
const handleShareClick = async (event) => {
|
|
279
391
|
var _a2, _b2, _c2, _d2;
|
|
280
392
|
event.stopPropagation();
|
|
281
|
-
if (!canShareGuideline ||
|
|
393
|
+
if (!canShareGuideline || isShareBusy) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (sharePermissionState === "error") {
|
|
397
|
+
retryFailedPermissionChecks();
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (sharePermissionState !== "allowed") {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
if (ilkbShareTarget) {
|
|
404
|
+
appsecRoles.clearAppsecRoleLists();
|
|
405
|
+
setShareDialogOpen(true);
|
|
282
406
|
return;
|
|
283
407
|
}
|
|
284
408
|
if (shareRbacConfig) {
|
|
@@ -316,7 +440,7 @@ function GuidelineLibraryCard({
|
|
|
316
440
|
}
|
|
317
441
|
};
|
|
318
442
|
const handleCardClick = (event) => {
|
|
319
|
-
if (!handleCardClickCallback) return;
|
|
443
|
+
if (!handleCardClickCallback || isAccessDenied) return;
|
|
320
444
|
if (event.target.closest('button, a, input, select, [role="menuitem"]')) {
|
|
321
445
|
return;
|
|
322
446
|
}
|
|
@@ -324,6 +448,7 @@ function GuidelineLibraryCard({
|
|
|
324
448
|
};
|
|
325
449
|
const handlePublish = (event) => {
|
|
326
450
|
event.stopPropagation();
|
|
451
|
+
if (isPublishAwaitingApproval) return;
|
|
327
452
|
handlePublishButtonCallback == null ? void 0 : handlePublishButtonCallback(guideline);
|
|
328
453
|
};
|
|
329
454
|
const handleDuplicateConfirm = async () => {
|
|
@@ -367,6 +492,42 @@ function GuidelineLibraryCard({
|
|
|
367
492
|
setDecisionLoading(null);
|
|
368
493
|
}
|
|
369
494
|
};
|
|
495
|
+
const handleRequestAccessClick = async (event) => {
|
|
496
|
+
var _a2, _b2;
|
|
497
|
+
event.stopPropagation();
|
|
498
|
+
if (!onRequestAccess || requestAccessState !== "idle") return;
|
|
499
|
+
setRequestAccessState("sending");
|
|
500
|
+
try {
|
|
501
|
+
await Promise.resolve(onRequestAccess(guideline));
|
|
502
|
+
setRequestAccessState("sent");
|
|
503
|
+
(_a2 = shareToastRef.current) == null ? void 0 : _a2.show({
|
|
504
|
+
severity: "success",
|
|
505
|
+
sticky: false,
|
|
506
|
+
life: 4e3,
|
|
507
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
508
|
+
SuccessToastContent["default"],
|
|
509
|
+
{
|
|
510
|
+
title: "Access requested",
|
|
511
|
+
message: `Your request to access "${title}" has been sent.`
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
});
|
|
515
|
+
} catch (error) {
|
|
516
|
+
setRequestAccessState("idle");
|
|
517
|
+
(_b2 = shareToastRef.current) == null ? void 0 : _b2.show({
|
|
518
|
+
severity: "error",
|
|
519
|
+
sticky: false,
|
|
520
|
+
life: 4e3,
|
|
521
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
522
|
+
ErrorToastContent["default"],
|
|
523
|
+
{
|
|
524
|
+
title: "Request not sent",
|
|
525
|
+
message: error instanceof Error && error.message ? error.message : "Couldn't send your access request. Please try again."
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
};
|
|
370
531
|
const handleRejectClick = async (event) => {
|
|
371
532
|
event.stopPropagation();
|
|
372
533
|
if (!onRejectGuideline) return;
|
|
@@ -397,11 +558,14 @@ function GuidelineLibraryCard({
|
|
|
397
558
|
// TODO: Temporarily hiding delete option in UI until deep research on deleteInstantLearningQuestion API is complete.
|
|
398
559
|
hideDelete: false,
|
|
399
560
|
// hideDeleteOption || !onDelete,
|
|
561
|
+
deleteDisabled: !canDeleteGuideline,
|
|
562
|
+
deleteLoading: deletePermissionState === "checking",
|
|
563
|
+
deleteDisabledReason,
|
|
400
564
|
onToggleVariant: handleToggleVariant,
|
|
401
565
|
isVariantEnabled,
|
|
402
566
|
enableVariantLabel,
|
|
403
567
|
disableVariantLabel,
|
|
404
|
-
hideToggleVariant: hideToggleVariantOption || !onToggleVariant || !((
|
|
568
|
+
hideToggleVariant: hideToggleVariantOption || !onToggleVariant || !((_E = guideline.variant_id) == null ? void 0 : _E.trim()),
|
|
405
569
|
toggleVariantDisabled: toggleVariantLoading
|
|
406
570
|
});
|
|
407
571
|
const hasMenuItems = menuItems.some((item) => !item.hidden);
|
|
@@ -438,6 +602,7 @@ function GuidelineLibraryCard({
|
|
|
438
602
|
{
|
|
439
603
|
type: "button",
|
|
440
604
|
onClick: onToggle2,
|
|
605
|
+
disabled: isAccessDenied,
|
|
441
606
|
"aria-expanded": isOpen,
|
|
442
607
|
className: GuidelineLibraryCard_module["default"].accordionHeader,
|
|
443
608
|
children: [
|
|
@@ -461,7 +626,11 @@ function GuidelineLibraryCard({
|
|
|
461
626
|
type: "button",
|
|
462
627
|
onClick: () => !isDraftGuideline && handlePreview(),
|
|
463
628
|
"aria-disabled": isDraftGuideline,
|
|
464
|
-
className: utils.cx(
|
|
629
|
+
className: utils.cx(
|
|
630
|
+
GuidelineLibraryCard_module["default"].previewButton,
|
|
631
|
+
GuidelineLibraryCard_module["default"].cardPreviewButton,
|
|
632
|
+
isDraftGuideline && GuidelineLibraryCard_module["default"].previewButtonDisabled
|
|
633
|
+
),
|
|
465
634
|
"aria-label": `Preview ${title}`,
|
|
466
635
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: GuidelineLibraryCard_module["default"].previewIcon, strokeWidth: 2 })
|
|
467
636
|
}
|
|
@@ -477,7 +646,7 @@ function GuidelineLibraryCard({
|
|
|
477
646
|
const viewActionButton = (statusActions == null ? void 0 : statusActions.showView) !== false && (statusActions == null ? void 0 : statusActions.onView) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
478
647
|
GuidelineTooltip.GuidelineTooltip,
|
|
479
648
|
{
|
|
480
|
-
content: isViewActionDisabled ? (
|
|
649
|
+
content: isViewActionDisabled ? (_F = statusActions.viewDisabledTooltip) != null ? _F : primaryActionDisabledTooltip : "",
|
|
481
650
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
482
651
|
"button",
|
|
483
652
|
{
|
|
@@ -488,6 +657,7 @@ function GuidelineLibraryCard({
|
|
|
488
657
|
if (isViewActionDisabled) return;
|
|
489
658
|
(_a2 = statusActions.onView) == null ? void 0 : _a2.call(statusActions, guideline);
|
|
490
659
|
},
|
|
660
|
+
disabled: isAccessDenied,
|
|
491
661
|
"aria-disabled": isViewActionDisabled,
|
|
492
662
|
className: utils.cx(
|
|
493
663
|
GuidelineLibraryCard_module["default"].selectButton,
|
|
@@ -497,7 +667,7 @@ function GuidelineLibraryCard({
|
|
|
497
667
|
),
|
|
498
668
|
style: styles == null ? void 0 : styles.libraryCardViewButton,
|
|
499
669
|
"aria-label": `View ${title}`,
|
|
500
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: GuidelineLibraryCard_module["default"].selectButtonLabel, children: (
|
|
670
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: GuidelineLibraryCard_module["default"].selectButtonLabel, children: (_G = statusActions == null ? void 0 : statusActions.viewLabel) != null ? _G : "View" })
|
|
501
671
|
}
|
|
502
672
|
)
|
|
503
673
|
}
|
|
@@ -513,6 +683,7 @@ function GuidelineLibraryCard({
|
|
|
513
683
|
if (isPromoteActionDisabled) return;
|
|
514
684
|
(_a2 = statusActions.onPromote) == null ? void 0 : _a2.call(statusActions, guideline);
|
|
515
685
|
},
|
|
686
|
+
disabled: isAccessDenied,
|
|
516
687
|
"aria-disabled": isPromoteActionDisabled,
|
|
517
688
|
className: utils.cx(
|
|
518
689
|
GuidelineLibraryCard_module["default"].selectButton,
|
|
@@ -522,7 +693,7 @@ function GuidelineLibraryCard({
|
|
|
522
693
|
"aria-label": `Promote ${title}`,
|
|
523
694
|
children: [
|
|
524
695
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpRight, { className: GuidelineLibraryCard_module["default"].selectButtonIcon, strokeWidth: 2.2 }),
|
|
525
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: GuidelineLibraryCard_module["default"].selectButtonLabel, children: (
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: GuidelineLibraryCard_module["default"].selectButtonLabel, children: (_H = statusActions == null ? void 0 : statusActions.promoteLabel) != null ? _H : "Promote" })
|
|
526
697
|
]
|
|
527
698
|
}
|
|
528
699
|
) : null;
|
|
@@ -536,6 +707,7 @@ function GuidelineLibraryCard({
|
|
|
536
707
|
GuidelineLibraryCard_module["default"].libraryCard,
|
|
537
708
|
isExploreHighlighted && GuidelineLibraryCard_module["default"].libraryCardSelected,
|
|
538
709
|
isHighlighted && GuidelineLibraryCard_module["default"].libraryCardHighlighted,
|
|
710
|
+
isAccessDenied && GuidelineLibraryCard_module["default"].libraryCardNoAccess,
|
|
539
711
|
classNames == null ? void 0 : classNames.libraryCard
|
|
540
712
|
),
|
|
541
713
|
style: styles == null ? void 0 : styles.libraryCard,
|
|
@@ -565,7 +737,7 @@ function GuidelineLibraryCard({
|
|
|
565
737
|
children: title
|
|
566
738
|
}
|
|
567
739
|
),
|
|
568
|
-
isILMarketplace && /* @__PURE__ */ jsxRuntime.jsx(
|
|
740
|
+
isILMarketplace && !showStatusRow && !showApprovalChip && /* @__PURE__ */ jsxRuntime.jsx(
|
|
569
741
|
GuidelineStatusChip.GuidelineStatusChip,
|
|
570
742
|
{
|
|
571
743
|
status: guidelineStatus,
|
|
@@ -573,6 +745,14 @@ function GuidelineLibraryCard({
|
|
|
573
745
|
style: styles == null ? void 0 : styles.libraryCardStatusChip
|
|
574
746
|
}
|
|
575
747
|
),
|
|
748
|
+
isILMarketplace && !showStatusRow && showApprovalChip && /* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
+
GuidelineStatusChip.GuidelineApprovalChip,
|
|
750
|
+
{
|
|
751
|
+
approvalStatus,
|
|
752
|
+
className: classNames == null ? void 0 : classNames.libraryCardStatusChip,
|
|
753
|
+
style: styles == null ? void 0 : styles.libraryCardStatusChip
|
|
754
|
+
}
|
|
755
|
+
),
|
|
576
756
|
isILMarketplace && !isVariantEnabled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
577
757
|
"span",
|
|
578
758
|
{
|
|
@@ -590,6 +770,27 @@ function GuidelineLibraryCard({
|
|
|
590
770
|
className: utils.cx(GuidelineLibraryCard_module["default"].libraryCardActions, classNames == null ? void 0 : classNames.libraryCardActions),
|
|
591
771
|
style: styles == null ? void 0 : styles.libraryCardActions,
|
|
592
772
|
children: [
|
|
773
|
+
isAccessDenied && /* @__PURE__ */ jsxRuntime.jsx(GuidelineTooltip.GuidelineTooltip, { content: REQUEST_ACCESS_TOOLTIPS[requestAccessState], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
774
|
+
"button",
|
|
775
|
+
{
|
|
776
|
+
type: "button",
|
|
777
|
+
onClick: handleRequestAccessClick,
|
|
778
|
+
"aria-disabled": requestAccessState !== "idle",
|
|
779
|
+
"aria-busy": requestAccessState === "sending",
|
|
780
|
+
className: GuidelineLibraryCard_module["default"].requestAccessButton,
|
|
781
|
+
"aria-label": requestAccessState === "sent" ? `Access requested for ${title}` : `Request access to ${title}`,
|
|
782
|
+
children: requestAccessState === "sending" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
783
|
+
lucideReact.Loader2,
|
|
784
|
+
{
|
|
785
|
+
className: utils.cx(
|
|
786
|
+
GuidelineLibraryCard_module["default"].requestAccessIcon,
|
|
787
|
+
GuidelineLibraryCard_module["default"].requestAccessIconSpinning
|
|
788
|
+
),
|
|
789
|
+
strokeWidth: 2
|
|
790
|
+
}
|
|
791
|
+
) : requestAccessState === "sent" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: GuidelineLibraryCard_module["default"].requestAccessIcon, strokeWidth: 2.4 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.KeyRound, { className: GuidelineLibraryCard_module["default"].requestAccessIcon, strokeWidth: 2 })
|
|
792
|
+
}
|
|
793
|
+
) }),
|
|
593
794
|
resolvedPinnedMessage && /* @__PURE__ */ jsxRuntime.jsx(GuidelineTooltip.GuidelineTooltip, { content: resolvedPinnedMessage, side: "bottom", maxWidth: 320, children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-label": resolvedPinnedMessage, className: GuidelineLibraryCard_module["default"].pinnedMessageIcon, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pin, { className: GuidelineLibraryCard_module["default"].pinIcon, strokeWidth: 2 }) }) }),
|
|
594
795
|
isInstantLearningMode && !isTemplateLayout && !isILMarketplace && /* @__PURE__ */ jsxRuntime.jsx(
|
|
595
796
|
GuidelineIconButton.GuidelineIconButton,
|
|
@@ -610,7 +811,7 @@ function GuidelineLibraryCard({
|
|
|
610
811
|
{
|
|
611
812
|
versions: versionList,
|
|
612
813
|
currentVersion,
|
|
613
|
-
disabled: versionLoading,
|
|
814
|
+
disabled: versionLoading || isAccessDenied,
|
|
614
815
|
onSelect: handleVersionSelect,
|
|
615
816
|
triggerAriaLabel: `Select version for ${title}`
|
|
616
817
|
}
|
|
@@ -623,7 +824,12 @@ function GuidelineLibraryCard({
|
|
|
623
824
|
slot: "libraryCardMoreButton",
|
|
624
825
|
label: `More options for ${title}`,
|
|
625
826
|
title: "More options",
|
|
626
|
-
onClick: () =>
|
|
827
|
+
onClick: () => {
|
|
828
|
+
if (!hasMenuItems) return;
|
|
829
|
+
if (accessControl && !menuOpen) retryFailedPermissionChecks();
|
|
830
|
+
setMenuOpen((prev) => !prev);
|
|
831
|
+
},
|
|
832
|
+
disabled: isAccessDenied,
|
|
627
833
|
classNames,
|
|
628
834
|
styles,
|
|
629
835
|
ref: moreButtonRef,
|
|
@@ -657,6 +863,27 @@ function GuidelineLibraryCard({
|
|
|
657
863
|
children: description
|
|
658
864
|
}
|
|
659
865
|
),
|
|
866
|
+
showStatusRow && hasStatusChip && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: GuidelineLibraryCard_module["default"].topicLabel, children: [
|
|
867
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex-shrink-0", children: [
|
|
868
|
+
statusFieldLabel,
|
|
869
|
+
":"
|
|
870
|
+
] }),
|
|
871
|
+
showApprovalChip ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
872
|
+
GuidelineStatusChip.GuidelineApprovalChip,
|
|
873
|
+
{
|
|
874
|
+
approvalStatus,
|
|
875
|
+
className: classNames == null ? void 0 : classNames.libraryCardStatusChip,
|
|
876
|
+
style: styles == null ? void 0 : styles.libraryCardStatusChip
|
|
877
|
+
}
|
|
878
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
879
|
+
GuidelineStatusChip.GuidelineStatusChip,
|
|
880
|
+
{
|
|
881
|
+
status: guidelineStatus,
|
|
882
|
+
className: classNames == null ? void 0 : classNames.libraryCardStatusChip,
|
|
883
|
+
style: styles == null ? void 0 : styles.libraryCardStatusChip
|
|
884
|
+
}
|
|
885
|
+
)
|
|
886
|
+
] }),
|
|
660
887
|
isTemplateLayout && showTopic && topicTitle && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: GuidelineLibraryCard_module["default"].topicLabel, children: [
|
|
661
888
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex-shrink-0", children: [
|
|
662
889
|
topicFieldLabel,
|
|
@@ -695,7 +922,7 @@ function GuidelineLibraryCard({
|
|
|
695
922
|
{
|
|
696
923
|
type: "button",
|
|
697
924
|
onClick: handleRejectClick,
|
|
698
|
-
disabled: decisionLoading !== null,
|
|
925
|
+
disabled: decisionLoading !== null || isAccessDenied,
|
|
699
926
|
className: GuidelineLibraryCard_module["default"].reviewRejectButton,
|
|
700
927
|
children: decisionLoading === "reject" ? "Rejecting..." : rejectLabel
|
|
701
928
|
}
|
|
@@ -705,7 +932,7 @@ function GuidelineLibraryCard({
|
|
|
705
932
|
{
|
|
706
933
|
type: "button",
|
|
707
934
|
onClick: handleApproveClick,
|
|
708
|
-
disabled: decisionLoading !== null,
|
|
935
|
+
disabled: decisionLoading !== null || isAccessDenied,
|
|
709
936
|
className: GuidelineLibraryCard_module["default"].reviewApproveButton,
|
|
710
937
|
children: decisionLoading === "approve" ? "Approving..." : approveLabel
|
|
711
938
|
}
|
|
@@ -724,7 +951,7 @@ function GuidelineLibraryCard({
|
|
|
724
951
|
{
|
|
725
952
|
type: "button",
|
|
726
953
|
onClick: handleWishlistToggle,
|
|
727
|
-
disabled: wishlistLoading,
|
|
954
|
+
disabled: wishlistLoading || isAccessDenied,
|
|
728
955
|
className: utils.cx(
|
|
729
956
|
GuidelineLibraryCard_module["default"].wishlistButton,
|
|
730
957
|
isWishlisted ? GuidelineLibraryCard_module["default"].wishlistButtonWishlisted : GuidelineLibraryCard_module["default"].wishlistButtonNotWishlisted,
|
|
@@ -742,30 +969,51 @@ function GuidelineLibraryCard({
|
|
|
742
969
|
}
|
|
743
970
|
) }),
|
|
744
971
|
previewButtonWithTooltip,
|
|
745
|
-
canPublishGuideline && /* @__PURE__ */ jsxRuntime.jsx(
|
|
746
|
-
|
|
972
|
+
canPublishGuideline && /* @__PURE__ */ jsxRuntime.jsx(
|
|
973
|
+
GuidelineTooltip.GuidelineTooltip,
|
|
747
974
|
{
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
975
|
+
content: isPublishAwaitingApproval ? "You can publish once this model is approved" : publishButtonLabel,
|
|
976
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
977
|
+
"button",
|
|
978
|
+
{
|
|
979
|
+
type: "button",
|
|
980
|
+
onClick: handlePublish,
|
|
981
|
+
disabled: isAccessDenied,
|
|
982
|
+
"aria-disabled": isPublishAwaitingApproval,
|
|
983
|
+
className: utils.cx(
|
|
984
|
+
GuidelineLibraryCard_module["default"].previewButton,
|
|
985
|
+
isPublishAwaitingApproval && GuidelineLibraryCard_module["default"].previewButtonDisabled
|
|
986
|
+
),
|
|
987
|
+
"aria-label": `${publishButtonLabel}: ${title}`,
|
|
988
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: GuidelineLibraryCard_module["default"].previewIcon, strokeWidth: 2 })
|
|
989
|
+
}
|
|
990
|
+
)
|
|
753
991
|
}
|
|
754
|
-
)
|
|
755
|
-
canShareGuideline && /* @__PURE__ */ jsxRuntime.jsx(
|
|
756
|
-
|
|
992
|
+
),
|
|
993
|
+
canShareGuideline && /* @__PURE__ */ jsxRuntime.jsx(
|
|
994
|
+
GuidelineTooltip.GuidelineTooltip,
|
|
757
995
|
{
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
996
|
+
content: shareConfigLoading ? "Loading share access" : SHARE_TOOLTIPS[sharePermissionState],
|
|
997
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
998
|
+
"button",
|
|
999
|
+
{
|
|
1000
|
+
type: "button",
|
|
1001
|
+
onClick: handleShareClick,
|
|
1002
|
+
disabled: isAccessDenied,
|
|
1003
|
+
"aria-disabled": isShareBusy || sharePermissionState === "denied",
|
|
1004
|
+
className: utils.cx(
|
|
1005
|
+
GuidelineLibraryCard_module["default"].previewButton,
|
|
1006
|
+
(isShareBusy || sharePermissionState === "denied") && GuidelineLibraryCard_module["default"].previewButtonDisabled
|
|
1007
|
+
),
|
|
1008
|
+
"aria-label": isShareLocked ? `Share ${title} (locked)` : `Share ${title}`,
|
|
1009
|
+
children: isShareBusy ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: GuidelineLibraryCard_module["default"].previewIconSpinner, strokeWidth: 2 }) : isShareLocked ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: GuidelineLibraryCard_module["default"].lockedIcon, children: [
|
|
1010
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Share2, { className: GuidelineLibraryCard_module["default"].previewIcon, strokeWidth: 2 }),
|
|
1011
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: GuidelineLibraryCard_module["default"].lockedIconBadge, strokeWidth: 2.5 })
|
|
1012
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Share2, { className: GuidelineLibraryCard_module["default"].previewIcon, strokeWidth: 2 })
|
|
1013
|
+
}
|
|
1014
|
+
)
|
|
767
1015
|
}
|
|
768
|
-
)
|
|
1016
|
+
),
|
|
769
1017
|
isTemplateLayout && !isILMarketplace && /* @__PURE__ */ jsxRuntime.jsx(
|
|
770
1018
|
"button",
|
|
771
1019
|
{
|
|
@@ -793,6 +1041,7 @@ function GuidelineLibraryCard({
|
|
|
793
1041
|
{
|
|
794
1042
|
type: "button",
|
|
795
1043
|
onClick: () => isPrimaryActionDisabled ? void 0 : handleButtonClick(guidelineId),
|
|
1044
|
+
disabled: isAccessDenied,
|
|
796
1045
|
"aria-pressed": isSelected,
|
|
797
1046
|
"aria-disabled": isPrimaryActionDisabled,
|
|
798
1047
|
className: utils.cx(
|
|
@@ -908,27 +1157,28 @@ function GuidelineLibraryCard({
|
|
|
908
1157
|
pt: { root: { style: { zIndex: 9999 } } }
|
|
909
1158
|
}
|
|
910
1159
|
),
|
|
911
|
-
shareDialogOpen &&
|
|
1160
|
+
shareDialogOpen && shareDialogTarget && (instantLearning == null ? void 0 : instantLearning.token) && reactDom.createPortal(
|
|
912
1161
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: utils.cx(AccessPanel_module["default"].accessPanel, GuidelineLibraryCard_module["default"].shareModalHost), children: /* @__PURE__ */ jsxRuntime.jsx(appsecUi.RbacQueryProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
913
1162
|
appsecUi.AppsecProvider,
|
|
914
1163
|
{
|
|
915
|
-
appId:
|
|
1164
|
+
appId: shareDialogTarget.appName,
|
|
916
1165
|
baseUrl: instantLearning.appsecGranularRbacUrl || constants.FALLBACK_RBAC_CONFIG.appsecRbacUrl,
|
|
917
1166
|
appsecUrl: instantLearning.appsecBaseUrl || constants.FALLBACK_RBAC_CONFIG.appsecBaseUrl,
|
|
918
1167
|
mode: "manage",
|
|
919
1168
|
getAuthToken: () => instantLearning.token,
|
|
1169
|
+
axiosConfig: shareDialogTarget.axiosConfig,
|
|
920
1170
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
921
1171
|
appsecUi.ShareAccessModal,
|
|
922
1172
|
{
|
|
923
|
-
...
|
|
1173
|
+
...shareDialogTarget.external,
|
|
924
1174
|
open: shareDialogOpen,
|
|
925
1175
|
onClose: () => setShareDialogOpen(false),
|
|
926
1176
|
onSuccess: () => {
|
|
927
1177
|
setShareDialogOpen(false);
|
|
928
1178
|
setShareSuccessMessage(`Access to "${title}" has been successfully shared.`);
|
|
929
1179
|
},
|
|
930
|
-
resourceId:
|
|
931
|
-
moduleId:
|
|
1180
|
+
resourceId: shareDialogTarget.resourceId,
|
|
1181
|
+
moduleId: shareDialogTarget.moduleId,
|
|
932
1182
|
resourceName: title,
|
|
933
1183
|
title: "Share Access",
|
|
934
1184
|
description: "Grant access to this resource.",
|