@epam/ai-dial-chat-hooks 1.4.0-dev.12 → 1.4.0-dev.126
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/api-error/map-api-error.d.ts +10 -0
- package/api-error/map-api-error.d.ts.map +1 -0
- package/api-error/map-api-error.js +11 -0
- package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
- package/catalog/create-publish-api.d.ts +28 -1
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +21 -1
- package/catalog/entity-details.d.ts +5 -2
- package/catalog/entity-details.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.d.ts +4 -0
- package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.js +15 -13
- package/catalog/publish-dependency-icons.d.ts +22 -0
- package/catalog/publish-dependency-icons.d.ts.map +1 -0
- package/catalog/publish-dependency-icons.js +11 -0
- package/catalog/publish-target-taken.d.ts +31 -0
- package/catalog/publish-target-taken.d.ts.map +1 -0
- package/catalog/publish-target-taken.js +14 -0
- package/catalog/publish.d.ts +15 -2
- package/catalog/publish.d.ts.map +1 -1
- package/catalog/publish.js +15 -4
- package/catalog/resource-name-conflict.d.ts.map +1 -1
- package/catalog/resource-name-conflict.js +19 -22
- package/catalog/resource-save-adapter.d.ts +7 -2
- package/catalog/resource-save-adapter.d.ts.map +1 -1
- package/catalog/resource-save-adapters.d.ts +32 -7
- package/catalog/resource-save-adapters.d.ts.map +1 -1
- package/catalog/resource-save-adapters.js +47 -41
- package/catalog/resource-save.d.ts +17 -9
- package/catalog/resource-save.d.ts.map +1 -1
- package/catalog/resource-save.js +34 -25
- package/catalog/save-destination-root.d.ts +12 -0
- package/catalog/save-destination-root.d.ts.map +1 -0
- package/catalog/save-destination-root.js +6 -0
- package/catalog/use-publish-dependencies.d.ts +19 -0
- package/catalog/use-publish-dependencies.d.ts.map +1 -0
- package/catalog/use-publish-dependencies.js +25 -0
- package/catalog/use-publish-target-guard.d.ts +45 -0
- package/catalog/use-publish-target-guard.d.ts.map +1 -0
- package/catalog/use-publish-target-guard.js +18 -0
- package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -2
- package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
- package/catalog/usePublishFolders/usePublishFolders.js +29 -29
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +27 -6
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +184 -118
- package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
- package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
- package/catalog/useVersionHistory/useVersionHistory.js +49 -0
- package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
- package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
- package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
- package/catalog/version-history.d.ts +42 -0
- package/catalog/version-history.d.ts.map +1 -0
- package/catalog/version-history.js +27 -0
- package/catalog.js +39 -31
- package/conversation/announcement-message.d.ts +12 -0
- package/conversation/announcement-message.d.ts.map +1 -1
- package/conversation/announcement-message.js +16 -10
- package/conversation/conversation-list.d.ts +7 -1
- package/conversation/conversation-list.d.ts.map +1 -1
- package/conversation/conversation-list.js +11 -2
- package/conversation/conversation-transfer/zip-export.d.ts +1 -1
- package/conversation/conversation-transfer/zip-export.d.ts.map +1 -1
- package/conversation/conversation-transfer/zip-export.js +7 -8
- package/conversation/conversation-transfer/zip-import.d.ts.map +1 -1
- package/conversation/conversation-transfer/zip-import.js +8 -9
- package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
- package/conversation/useConversationExport/useConversationExport.js +3 -1
- package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/generation-resume.js +119 -96
- package/conversation.js +44 -44
- package/entry-points/catalog.d.ts +7 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/file-manager.d.ts +1 -0
- package/entry-points/file-manager.d.ts.map +1 -1
- package/entry-points/project.d.ts +5 -0
- package/entry-points/project.d.ts.map +1 -1
- package/entry-points/scheduled-tasks.d.ts +2 -0
- package/entry-points/scheduled-tasks.d.ts.map +1 -1
- package/entry-points/usage-limits.d.ts +1 -0
- package/entry-points/usage-limits.d.ts.map +1 -1
- package/entry-points/utils.d.ts +7 -0
- package/entry-points/utils.d.ts.map +1 -1
- package/file-manager.js +33 -32
- package/files/annotation.d.ts +3 -3
- package/files/annotation.d.ts.map +1 -1
- package/files/annotation.js +12 -11
- package/files/attachment-canvas.d.ts +1 -1
- package/files/attachment-canvas.d.ts.map +1 -1
- package/files/attachment-canvas.js +135 -135
- package/files/attachment-type-labels.d.ts +3 -0
- package/files/attachment-type-labels.d.ts.map +1 -0
- package/files/attachment-type-labels.js +12 -0
- package/files/attachment-types.d.ts +0 -2
- package/files/attachment-types.d.ts.map +1 -1
- package/files/attachment-types.js +7 -14
- package/files/dial-file.d.ts +24 -0
- package/files/dial-file.d.ts.map +1 -1
- package/files/dial-file.js +35 -5
- package/index.d.ts +23 -0
- package/index.d.ts.map +1 -1
- package/index.js +266 -244
- package/org-units/models.d.ts +11 -0
- package/org-units/models.d.ts.map +1 -0
- package/org-units/org-unit-guards.d.ts +98 -0
- package/org-units/org-unit-guards.d.ts.map +1 -0
- package/org-units/org-unit-guards.js +41 -0
- package/org-units/types.d.ts +14 -0
- package/org-units/types.d.ts.map +1 -0
- package/org-units/types.js +6 -0
- package/org-units/useFolderGuards/useFolderGuards.d.ts +31 -0
- package/org-units/useFolderGuards/useFolderGuards.d.ts.map +1 -0
- package/org-units/useFolderGuards/useFolderGuards.js +50 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts +34 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
- package/org-units/useOrgUnits/useOrgUnits.js +54 -0
- package/package.json +19 -19
- package/project/project-conversation-data-source.js +4 -4
- package/project/project-sharing-client.d.ts +8 -0
- package/project/project-sharing-client.d.ts.map +1 -0
- package/project/project-sharing-client.js +11 -0
- package/project/project-sharing.d.ts +28 -0
- package/project/project-sharing.d.ts.map +1 -0
- package/project/project-sharing.js +22 -0
- package/project/use-pinned-project-chats.d.ts +4 -2
- package/project/use-pinned-project-chats.d.ts.map +1 -1
- package/project/use-pinned-project-chats.js +152 -96
- package/project/use-project-conversations.d.ts.map +1 -1
- package/project/use-project-conversations.js +2 -2
- package/project/use-project-remove-from-list.d.ts +30 -0
- package/project/use-project-remove-from-list.d.ts.map +1 -0
- package/project/use-project-remove-from-list.js +39 -0
- package/project/use-project-revoke-access.d.ts +15 -0
- package/project/use-project-revoke-access.d.ts.map +1 -0
- package/project/use-project-revoke-access.js +32 -0
- package/project/use-project-share-recipients.d.ts +7 -0
- package/project/use-project-share-recipients.d.ts.map +1 -0
- package/project/use-project-share-recipients.js +36 -0
- package/project/use-projects.d.ts +1 -0
- package/project/use-projects.d.ts.map +1 -1
- package/project/use-projects.js +2 -1
- package/project.js +7 -2
- package/scheduled-task/scheduled-task-description.d.ts +19 -13
- package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-description.js +39 -55
- package/scheduled-task/scheduled-task-display.d.ts +67 -6
- package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-display.js +55 -43
- package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -5
- package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-next-occurrence.js +16 -16
- package/scheduled-task/scheduled-task-time-format.d.ts +36 -0
- package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -0
- package/scheduled-task/scheduled-task-time-format.js +34 -0
- package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
- package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-trigger.js +92 -115
- package/scheduled-tasks.js +15 -13
- package/shared/timezones.d.ts +30 -0
- package/shared/timezones.d.ts.map +1 -0
- package/shared/timezones.js +102 -0
- package/skill/skill-archive.d.ts.map +1 -1
- package/skill/skill-archive.js +6 -7
- package/skill/skill.d.ts +2 -2
- package/skill/skill.d.ts.map +1 -1
- package/skill/skill.js +33 -34
- package/skill/useSkillEditorLoad.js +1 -1
- package/skill/useSkillEditorSubmit.d.ts +4 -1
- package/skill/useSkillEditorSubmit.d.ts.map +1 -1
- package/skill/useSkillEditorSubmit.js +125 -121
- package/usage/map-usage-data-to-dashboard.d.ts +22 -1
- package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
- package/usage/map-usage-data-to-dashboard.js +33 -2
- package/usage/spending-limits-mode.d.ts +37 -0
- package/usage/spending-limits-mode.d.ts.map +1 -0
- package/usage/spending-limits-mode.js +15 -0
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +6 -2
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +4 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.js +55 -47
- package/usage-limits.js +6 -5
- package/usage.js +3 -3
- package/utils.js +28 -22
- package/shared/cron-day-of-month.d.ts +0 -21
- package/shared/cron-day-of-month.d.ts.map +0 -1
- package/shared/cron-day-of-month.js +0 -13
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PublishApiClient } from './create-publish-api';
|
|
2
|
+
import { CatalogPublishEntityType } from './publish';
|
|
3
|
+
/** The catalog entity a published item stands for. */
|
|
4
|
+
export interface PublishTargetEntity {
|
|
5
|
+
/** Catalog entity kind. */
|
|
6
|
+
entityType: CatalogPublishEntityType;
|
|
7
|
+
/** Resource id of the entity. */
|
|
8
|
+
entityId: string;
|
|
9
|
+
}
|
|
10
|
+
/** Host inputs of {@link usePublishTargetGuard}. */
|
|
11
|
+
export interface UsePublishTargetGuardOptions<TItem extends {
|
|
12
|
+
version?: string;
|
|
13
|
+
}> {
|
|
14
|
+
/** The configured publish requests; only `checkPublishTarget` is used. Must be referentially stable. */
|
|
15
|
+
client: Pick<PublishApiClient, 'checkPublishTarget'>;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the entity behind a publish-flow item, or `undefined` for an item
|
|
18
|
+
* that is not publishable (it is then never reported as taken). Must be
|
|
19
|
+
* referentially stable.
|
|
20
|
+
*/
|
|
21
|
+
getEntity: (item: TItem) => PublishTargetEntity | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** What {@link usePublishTargetGuard} hands to `usePublishFlow` and the host's publish call. */
|
|
24
|
+
export interface PublishTargetGuard<TItem extends {
|
|
25
|
+
version?: string;
|
|
26
|
+
}> {
|
|
27
|
+
/** `usePublishFlow`'s `onCheckTargetExists`: asks the backend whether the published path is taken. */
|
|
28
|
+
onCheckTargetExists: (item: TItem, folderPath: string[]) => Promise<boolean>;
|
|
29
|
+
/** `usePublishFlow`'s `isTargetTakenError`: true for the error {@link PublishTargetGuard.wrapPublish} throws. */
|
|
30
|
+
isTargetTakenError: (error: unknown) => boolean;
|
|
31
|
+
/** Wraps the host's publish call so a taken-target `409` is rejected as a `PublishTargetTakenError`. */
|
|
32
|
+
wrapPublish: <Args extends unknown[], Result>(publish: (...args: Args) => Promise<Result>) => (...args: Args) => Promise<Result>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Wires the target check of a publish panel: the check request
|
|
36
|
+
* (folder segments joined with `/`, the item's version when it has one), the
|
|
37
|
+
* predicate that recognises a taken-target rejection, and the wrapper that
|
|
38
|
+
* produces it. The request and its mapping stay in {@link PublishApiClient};
|
|
39
|
+
* the panel and `usePublishFlow` only receive callbacks.
|
|
40
|
+
* @param options - the publish client and the lookup of an item's entity
|
|
41
|
+
*/
|
|
42
|
+
export declare const usePublishTargetGuard: <TItem extends {
|
|
43
|
+
version?: string;
|
|
44
|
+
}>({ client, getEntity, }: UsePublishTargetGuardOptions<TItem>) => PublishTargetGuard<TItem>;
|
|
45
|
+
//# sourceMappingURL=use-publish-target-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-publish-target-guard.d.ts","sourceRoot":"","sources":["../../src/catalog/use-publish-target-guard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAM1D,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,UAAU,EAAE,wBAAwB,CAAC;IACrC,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,oDAAoD;AACpD,MAAM,WAAW,4BAA4B,CAC3C,KAAK,SAAS;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;IAElC,wGAAwG;IACxG,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;IACrD;;;;OAIG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,mBAAmB,GAAG,SAAS,CAAC;CAC7D;AAED,gGAAgG;AAChG,MAAM,WAAW,kBAAkB,CAAC,KAAK,SAAS;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;IACpE,sGAAsG;IACtG,mBAAmB,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7E,iHAAiH;IACjH,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAChD,wGAAwG;IACxG,WAAW,EAAE,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,EAC1C,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,KACxC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAKD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAAI,KAAK,SAAS;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,wBAGvE,4BAA4B,CAAC,KAAK,CAAC,KAAG,kBAAkB,CAAC,KAAK,CAwBhE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PublishTargetTakenError as e, wrapPublishTargetTaken as t } from "./publish-target-taken.js";
|
|
2
|
+
import { useCallback as n, useMemo as r } from "react";
|
|
3
|
+
//#region src/catalog/use-publish-target-guard.ts
|
|
4
|
+
var i = (t) => t instanceof e, a = ({ client: e, getEntity: a }) => {
|
|
5
|
+
let o = n(async (t, n) => {
|
|
6
|
+
let r = a(t);
|
|
7
|
+
if (r == null) return !1;
|
|
8
|
+
let { taken: i } = await e.checkPublishTarget(r.entityType, r.entityId, n.join("/"), t.version || void 0);
|
|
9
|
+
return i;
|
|
10
|
+
}, [e, a]);
|
|
11
|
+
return r(() => ({
|
|
12
|
+
onCheckTargetExists: o,
|
|
13
|
+
isTargetTakenError: i,
|
|
14
|
+
wrapPublish: t
|
|
15
|
+
}), [o]);
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as usePublishTargetGuard };
|
|
@@ -26,6 +26,12 @@ export interface UsePublishFoldersParams {
|
|
|
26
26
|
* Omit it for a host that does not persist destinations.
|
|
27
27
|
*/
|
|
28
28
|
onRememberedFolderKeysChange?: (folderKeys: string[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Host rule for whether a destination accepts a publish, replacing the
|
|
31
|
+
* `Production` placeholder when given. Omit it while the rule is unknown
|
|
32
|
+
* (feature off, rights not loaded) so the placeholder stays the fallback.
|
|
33
|
+
*/
|
|
34
|
+
canPublishTo?: (folderPath: string[]) => boolean;
|
|
29
35
|
}
|
|
30
36
|
/** Result returned by {@link usePublishFolders}. */
|
|
31
37
|
export interface UsePublishFoldersResult {
|
|
@@ -57,7 +63,7 @@ export interface UsePublishFoldersResult {
|
|
|
57
63
|
* later publishes. Call it after a successful publish.
|
|
58
64
|
*/
|
|
59
65
|
rememberPublishFolder: (folderPath: string[]) => void;
|
|
60
|
-
/**
|
|
66
|
+
/** Write-access check for a folder path: the host's `canPublishTo` when given, otherwise the `Production` heuristic (see the TODO above). */
|
|
61
67
|
hasPublishWriteAccess: (folderPath: string[]) => boolean;
|
|
62
68
|
}
|
|
63
69
|
/**
|
|
@@ -77,5 +83,5 @@ export interface UsePublishFoldersResult {
|
|
|
77
83
|
* Takes `listPublicFiles` as a parameter and hands remembered destinations
|
|
78
84
|
* back through a callback, so it imports no app context and no storage API.
|
|
79
85
|
*/
|
|
80
|
-
export declare const usePublishFolders: ({ listPublicFiles, rememberedFolderKeys, onRememberedFolderKeysChange, }: UsePublishFoldersParams) => UsePublishFoldersResult;
|
|
86
|
+
export declare const usePublishFolders: ({ listPublicFiles, rememberedFolderKeys, onRememberedFolderKeysChange, canPublishTo, }: UsePublishFoldersParams) => UsePublishFoldersResult;
|
|
81
87
|
//# sourceMappingURL=usePublishFolders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePublishFolders.d.ts","sourceRoot":"","sources":["../../../src/catalog/usePublishFolders/usePublishFolders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAgBrC,gHAAgH;AAChH,eAAO,MAAM,2BAA2B,GAAI,YAAY,MAAM,EAAE,KAAG,OAClB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,OAAO,EACnB,WAAW,MAAM,KAChB,MAAM,EAAE,GAAG,SAUb,CAAC;AAyBF,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,eAAe,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9E;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"usePublishFolders.d.ts","sourceRoot":"","sources":["../../../src/catalog/usePublishFolders/usePublishFolders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAgBrC,gHAAgH;AAChH,eAAO,MAAM,2BAA2B,GAAI,YAAY,MAAM,EAAE,KAAG,OAClB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,OAAO,EACnB,WAAW,MAAM,KAChB,MAAM,EAAE,GAAG,SAUb,CAAC;AAyBF,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,eAAe,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9E;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC9D;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;CAClD;AAED,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,uDAAuD;IACvD,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,iEAAiE;IACjE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,gDAAgD;IAChD,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,0EAA0E;IAC1E,qBAAqB,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACpD;;;;;;;;;;OAUG;IACH,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E;;;;OAIG;IACH,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACtD,6IAA6I;IAC7I,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,GAAI,wFAK/B,uBAAuB,KAAG,uBAsH5B,CAAC"}
|
|
@@ -15,60 +15,60 @@ var c = "Production", l = 50, u = (e) => !e.includes(c), d = (e, t) => {
|
|
|
15
15
|
children: t.has(o) ? f(t, o, a) : void 0
|
|
16
16
|
};
|
|
17
17
|
});
|
|
18
|
-
}, p = ({ listPublicFiles: e, rememberedFolderKeys: c, onRememberedFolderKeysChange: l }) => {
|
|
19
|
-
let [
|
|
18
|
+
}, p = ({ listPublicFiles: e, rememberedFolderKeys: c, onRememberedFolderKeysChange: l, canPublishTo: p }) => {
|
|
19
|
+
let [m, h] = i(() => /* @__PURE__ */ new Map()), [g, _] = i(() => /* @__PURE__ */ new Set()), [v, y] = i(() => /* @__PURE__ */ new Set()), [b, x] = i([]), S = r(() => {
|
|
20
20
|
let e = /* @__PURE__ */ new Set();
|
|
21
|
-
return
|
|
21
|
+
return g.forEach((t) => {
|
|
22
22
|
let n = t ? `${t}/` : "";
|
|
23
|
-
|
|
23
|
+
m.has(n) && e.add(t);
|
|
24
24
|
}), e;
|
|
25
|
-
}, [
|
|
26
|
-
|
|
25
|
+
}, [g, m]), C = t(async (t) => {
|
|
26
|
+
y((e) => new Set(e).add(t));
|
|
27
27
|
try {
|
|
28
28
|
let { items: n } = await e({ path: t || void 0 });
|
|
29
|
-
|
|
29
|
+
h((e) => new Map(e).set(t, n));
|
|
30
30
|
} finally {
|
|
31
|
-
|
|
31
|
+
y((e) => {
|
|
32
32
|
let n = new Set(e);
|
|
33
33
|
return n.delete(t), n;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
}, [e]);
|
|
37
37
|
n(() => {
|
|
38
|
-
|
|
38
|
+
C("");
|
|
39
39
|
}, []);
|
|
40
|
-
let
|
|
41
|
-
|
|
40
|
+
let w = t((e) => {
|
|
41
|
+
_(e), e.forEach((e) => {
|
|
42
42
|
let t = `${e}/`;
|
|
43
|
-
!
|
|
43
|
+
!m.has(t) && !v.has(t) && C(t);
|
|
44
44
|
});
|
|
45
45
|
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]),
|
|
46
|
+
m,
|
|
47
|
+
v,
|
|
48
|
+
C
|
|
49
|
+
]), T = t((e, t) => {
|
|
50
50
|
let n = s([...e, t]);
|
|
51
|
-
return
|
|
52
|
-
}, []),
|
|
51
|
+
return x((e) => e.includes(n) ? e : [...e, n]), Promise.resolve();
|
|
52
|
+
}, []), E = t((e) => {
|
|
53
53
|
let t = d(c, s(e));
|
|
54
54
|
t && l?.(t);
|
|
55
|
-
}, [c, l]),
|
|
55
|
+
}, [c, l]), D = p ?? u;
|
|
56
56
|
return {
|
|
57
57
|
folderItems: r(() => {
|
|
58
58
|
let e = Array.isArray(c) ? c.filter((e) => typeof e == "string") : [];
|
|
59
|
-
return o(f(
|
|
59
|
+
return o(f(m, "", []), [...e.map(a), ...b.map(a)]);
|
|
60
60
|
}, [
|
|
61
|
-
|
|
61
|
+
m,
|
|
62
62
|
c,
|
|
63
|
-
|
|
63
|
+
b
|
|
64
64
|
]),
|
|
65
|
-
expandedPaths:
|
|
66
|
-
loadedPaths:
|
|
67
|
-
loadingPaths: r(() => new Set([...
|
|
68
|
-
onExpandedPathsChange:
|
|
69
|
-
onCreatePublishFolder:
|
|
70
|
-
rememberPublishFolder:
|
|
71
|
-
hasPublishWriteAccess:
|
|
65
|
+
expandedPaths: g,
|
|
66
|
+
loadedPaths: S,
|
|
67
|
+
loadingPaths: r(() => new Set([...v].map((e) => e.replace(/\/$/, ""))), [v]),
|
|
68
|
+
onExpandedPathsChange: w,
|
|
69
|
+
onCreatePublishFolder: T,
|
|
70
|
+
rememberPublishFolder: E,
|
|
71
|
+
hasPublishWriteAccess: D
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
//#endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ResourceFoldersResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
-
import {
|
|
2
|
+
import { OrgUnitNamespace } from '@epam/ai-dial-chat-shared';
|
|
3
|
+
import { PublishDependency, PublishAccessRulesLabels, StandaloneSaveToFolderPanelProps } from '@epam/ai-dial-publish-panel';
|
|
3
4
|
import { PublishApiClient } from '../create-publish-api';
|
|
4
|
-
import { ResourceSaveVersionError, ResourceSaveAdapter, ResourceSaveChoice, ResourceSaveResult } from '../resource-save';
|
|
5
|
+
import { ResourceSaveVersionError, SaveDestinationRoot, ResourceSaveAdapter, ResourceSaveChoice, ResourceSaveResult } from '../resource-save';
|
|
5
6
|
import { UsePublishFoldersResult } from '../usePublishFolders/usePublishFolders';
|
|
6
7
|
/** Translated copy the Save flow puts into the panel's state; the panel's own labels stay with the host. */
|
|
7
8
|
export interface UseResourceSavePanelLabels {
|
|
@@ -37,7 +38,25 @@ export interface UseResourceSavePanelParams {
|
|
|
37
38
|
/** The Organization folder tree state; omit when the user may not publish, which hides that root. */
|
|
38
39
|
organizationFolders?: UsePublishFoldersResult;
|
|
39
40
|
/** Publish operations used for an Organization destination. */
|
|
40
|
-
publishClient: Pick<PublishApiClient, 'publishCatalogEntity' | 'getPublishRules'
|
|
41
|
+
publishClient: Pick<PublishApiClient, 'publishCatalogEntity' | 'getPublishRules'> & Partial<Pick<PublishApiClient, 'checkPublishTarget'>>;
|
|
42
|
+
/** Whether an Organization destination takes a direct write into an org unit (the user may write there); omit while the org-unit rule does not apply, which keeps every Organization destination on the publish path. */
|
|
43
|
+
canSaveDirectlyTo?: (folderPath: string[], root: SaveDestinationRoot) => boolean;
|
|
44
|
+
/** Reason a folder is unavailable as a destination in the given root, or `undefined` when usable; omit while the org-unit rule does not apply. A committed destination with a reason shows it and disables Save. */
|
|
45
|
+
getDisabledReason?: (folderPath: string[], root: SaveDestinationRoot) => string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Reads the private dependencies of what is being saved, already mapped to the panel's model; omit for a resource that has none to list. Called when the panel is open and the destination is under the Organization root, whichever way the save then goes (a publication request or a direct write); the list is advisory, so a failed read leaves it empty. The host reads the values it saves when called, so it should return the form's state at that moment.
|
|
48
|
+
*/
|
|
49
|
+
loadDependencies?: () => Promise<PublishDependency[]>;
|
|
50
|
+
/** The namespaces, among those asked, in which the user may not write straight into the unit that owns the folder; omit while the org-unit rule does not apply. Used for the dependencies the panel lists and for the icon's `files` namespace, on a destination that takes a direct write. */
|
|
51
|
+
getMissingNamespaces?: (folderPath: string[], namespaces: OrgUnitNamespace[]) => OrgUnitNamespace[];
|
|
52
|
+
/** Reason shown for a folder where the dependencies' namespaces are missing; receives the missing namespaces. Without it a missing namespace disables nothing. */
|
|
53
|
+
getMissingNamespacesReason?: (missing: OrgUnitNamespace[]) => string;
|
|
54
|
+
/** One sentence for the dependencies section while the panel cannot list them (an application whose form state is inside an embedded editor); passed through only under the Organization root. */
|
|
55
|
+
dependenciesNote?: string;
|
|
56
|
+
/** Notice about the application's uploaded icon, shown under the committed destination when it is a unit folder where the user may not write `files`; pass it only when the saved resource has an uploaded icon. */
|
|
57
|
+
iconNote?: string;
|
|
58
|
+
/** Reason shown, and Save disabled, while the committed direct-write folder already holds the name this save would write; receives that folder and, for "Save as new version", the typed version. It is returned through `getDisabledReason`, so it needs that parameter too; without it, or without `publishClient.checkPublishTarget`, no target check is made. */
|
|
59
|
+
getTargetTakenReason?: (folderPath: string[], version?: string) => string;
|
|
41
60
|
/** Options offered in the access-rules editor's source picker. */
|
|
42
61
|
ruleSourceOptions: string[];
|
|
43
62
|
/** Translated copy. */
|
|
@@ -46,7 +65,7 @@ export interface UseResourceSavePanelParams {
|
|
|
46
65
|
onSaved: (result: ResourceSaveResult, choice: ResourceSaveChoice) => void;
|
|
47
66
|
}
|
|
48
67
|
/** The {@link StandaloneSaveToFolderPanelProps} the Save flow owns; the host adds the open state, resource summary and labels. */
|
|
49
|
-
export type ResourceSavePanelStateProps = Pick<StandaloneSaveToFolderPanelProps, 'onSubmit' | 'isSubmitDisabled' | 'isSubmitting' | 'submitError' | 'roots' | 'destination' | 'onDestinationChange' | 'onCreateFolder' | 'version' | 'accessRules' | 'onPendingDestinationChange' | 'foldersError' | 'onRetryFolders'>;
|
|
68
|
+
export type ResourceSavePanelStateProps = Pick<StandaloneSaveToFolderPanelProps, 'onSubmit' | 'isSubmitDisabled' | 'isSubmitting' | 'submitError' | 'roots' | 'destination' | 'onDestinationChange' | 'onCreateFolder' | 'getDisabledReason' | 'version' | 'accessRules' | 'onPendingDestinationChange' | 'foldersError' | 'onRetryFolders' | 'dependencies' | 'dependenciesNote' | 'destinationNote'>;
|
|
50
69
|
/** Result of {@link useResourceSavePanel}. */
|
|
51
70
|
export interface UseResourceSavePanelResult {
|
|
52
71
|
/** Props to spread on `StandaloneSaveToFolderPanel`. */
|
|
@@ -58,7 +77,9 @@ export interface UseResourceSavePanelResult {
|
|
|
58
77
|
* Owns the Save panel's flow for one resource — the Personal and
|
|
59
78
|
* Organization destination tree, the version choice, the Organization
|
|
60
79
|
* folder's access rules — and runs the choice through the resource's
|
|
61
|
-
* adapter. Notifications stay with the host through `onSaved`.
|
|
80
|
+
* adapter. Notifications stay with the host through `onSaved`. For a resource
|
|
81
|
+
* with private dependencies it also reads them while an Organization
|
|
82
|
+
* destination is chosen and returns them as `panelProps.dependencies`.
|
|
62
83
|
*/
|
|
63
|
-
export declare const useResourceSavePanel: ({ isOpen, adapter, resourceId, currentFolderPath, currentVersion, versionPattern, listPersonalFolders, organizationFolders, publishClient, ruleSourceOptions, labels, onSaved, }: UseResourceSavePanelParams) => UseResourceSavePanelResult;
|
|
84
|
+
export declare const useResourceSavePanel: ({ isOpen, adapter, resourceId, currentFolderPath, currentVersion, versionPattern, listPersonalFolders, organizationFolders, publishClient, canSaveDirectlyTo, getDisabledReason: getFolderDisabledReason, loadDependencies, getMissingNamespaces, getMissingNamespacesReason, dependenciesNote, iconNote, getTargetTakenReason, ruleSourceOptions, labels, onSaved, }: UseResourceSavePanelParams) => UseResourceSavePanelResult;
|
|
64
85
|
//# sourceMappingURL=useResourceSavePanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResourceSavePanel.d.ts","sourceRoot":"","sources":["../../../src/catalog/useResourceSavePanel/useResourceSavePanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAML,KAAK,wBAAwB,EAG7B,KAAK,gCAAgC,EACtC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"useResourceSavePanel.d.ts","sourceRoot":"","sources":["../../../src/catalog/useResourceSavePanel/useResourceSavePanel.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import { getApiErrorDetails as e } from "../../api-error/api-error.js";
|
|
2
2
|
import { useResourceFolders as t } from "../useResourceFolders/useResourceFolders.js";
|
|
3
|
-
import { ResourceSaveError as n } from "../resource-save-adapter.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { ResourceSaveError as n, isResourceCreateAdapter as r } from "../resource-save-adapter.js";
|
|
4
|
+
import { SaveDestinationRoot as i } from "../save-destination-root.js";
|
|
5
|
+
import { ResourceSaveVersionError as a, createPublishSavedResource as ee, runResourceSave as te, toSaveDestinationRoot as ne } from "../resource-save.js";
|
|
6
|
+
import { getDependencyOrgUnitNamespaces as re } from "../../org-units/org-unit-guards.js";
|
|
7
|
+
import { OrgUnitNamespace as ie } from "@epam/ai-dial-chat-shared";
|
|
8
|
+
import { useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
9
|
+
import { SaveVersionMode as d, toFolderPathKey as ae } from "@epam/ai-dial-publish-panel";
|
|
7
10
|
//#region src/catalog/useResourceSavePanel/useResourceSavePanel.ts
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
listFolders:
|
|
11
|
-
isEnabled:
|
|
12
|
-
}), { getPublishRules:
|
|
11
|
+
var f = [], oe = 400, p = ({ isOpen: p, adapter: m, resourceId: h, currentFolderPath: g, currentVersion: _, versionPattern: v, listPersonalFolders: se, organizationFolders: y, publishClient: b, canSaveDirectlyTo: ce, getDisabledReason: x, loadDependencies: S, getMissingNamespaces: C, getMissingNamespacesReason: w, dependenciesNote: le, iconNote: ue, getTargetTakenReason: T, ruleSourceOptions: de, labels: E, onSaved: fe }) => {
|
|
12
|
+
let D = t({
|
|
13
|
+
listFolders: se,
|
|
14
|
+
isEnabled: p
|
|
15
|
+
}), { getPublishRules: pe, checkPublishTarget: O } = b, me = c(() => ee(b), [b]), he = c(() => ({
|
|
13
16
|
rootKey: i.Personal,
|
|
14
|
-
path:
|
|
15
|
-
}), [
|
|
16
|
-
if (e?.rootKey !== i.Organization) return;
|
|
17
|
-
let t =
|
|
17
|
+
path: g
|
|
18
|
+
}), [g]), [k, ge] = u(he), [A, _e] = u(d.Keep), [j, ve] = u(""), [ye, M] = u(!1), [be, xe] = u(), [Se, Ce] = u(!1), [we, N] = u(), [Te, Ee] = u(!1), [De, Oe] = u(), P = l(/* @__PURE__ */ new Set()), [F, I] = u([]), [L, R] = u(!1), [z, B] = u(!1), V = l(void 0), H = o((e) => e.rootKey === i.Organization && m.saveIntoOrgUnit != null && ce?.(e.path, i.Organization) === !0, [m.saveIntoOrgUnit, ce]), ke = o((e) => {
|
|
19
|
+
if (Ee(e?.rootKey === i.Organization), e?.rootKey !== i.Organization || H(e)) return;
|
|
20
|
+
let t = ae(e.path);
|
|
18
21
|
t !== V.current && (V.current = t, I([]), B(!1), R(!0), (async () => {
|
|
19
22
|
try {
|
|
20
|
-
let n = await
|
|
23
|
+
let n = await pe(e.path.join("/"));
|
|
21
24
|
V.current === t && I(n);
|
|
22
25
|
} catch {
|
|
23
26
|
V.current === t && B(!0);
|
|
@@ -25,148 +28,211 @@ var l = ({ isOpen: l, adapter: u, resourceId: d, currentFolderPath: f, currentVe
|
|
|
25
28
|
V.current === t && R(!1);
|
|
26
29
|
}
|
|
27
30
|
})());
|
|
28
|
-
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
}, [pe, H]);
|
|
32
|
+
s(() => {
|
|
33
|
+
p && (V.current = void 0, I([]), R(!1), B(!1), Ee(!1), Oe(void 0), P.current.clear(), ge(he), _e(d.Keep), ve(""), M(!1), xe(void 0), N(void 0));
|
|
34
|
+
}, [p]);
|
|
35
|
+
let [U, Ae] = u(f), je = l(S);
|
|
36
|
+
s(() => {
|
|
37
|
+
je.current = S;
|
|
38
|
+
}, [S]);
|
|
39
|
+
let Me = p && S != null && (k.rootKey === i.Organization || Te);
|
|
40
|
+
s(() => {
|
|
41
|
+
if (Ae(f), !Me) return;
|
|
42
|
+
let e = !1;
|
|
43
|
+
return (async () => {
|
|
44
|
+
try {
|
|
45
|
+
let t = await je.current?.();
|
|
46
|
+
!e && t && Ae(t);
|
|
47
|
+
} catch {}
|
|
48
|
+
})(), () => {
|
|
49
|
+
e = !0;
|
|
50
|
+
};
|
|
51
|
+
}, [Me]);
|
|
52
|
+
let W = m.isVersioned && A === d.New, G = j.trim(), K = c(() => {
|
|
53
|
+
if (W) {
|
|
54
|
+
if (!v.test(G)) return a.Invalid;
|
|
55
|
+
if (G === _) return a.Unchanged;
|
|
56
|
+
if (G === be) return a.Exists;
|
|
37
57
|
}
|
|
38
58
|
}, [
|
|
59
|
+
W,
|
|
60
|
+
v,
|
|
61
|
+
G,
|
|
62
|
+
_,
|
|
63
|
+
be
|
|
64
|
+
]), Ne = r(m), q = k.path.join("/"), Pe = [...P.current].some((e) => q === e || q.startsWith(`${e}/`)), Fe = v.test(G) && G !== _, J = W ? G : void 0, Y = T != null && x != null && O != null && !Ne && H(k) && !Pe && (!W || Fe) ? `${q}\u0000${J ?? ""}` : void 0, Ie = m.publishEntityType;
|
|
65
|
+
s(() => {
|
|
66
|
+
if (Y == null || O == null) return;
|
|
67
|
+
let e = !1, t = async () => {
|
|
68
|
+
try {
|
|
69
|
+
let { taken: t } = await O(Ie, h, q, J);
|
|
70
|
+
if (e) return;
|
|
71
|
+
Oe((e) => t ? Y : e === Y ? void 0 : e);
|
|
72
|
+
} catch {}
|
|
73
|
+
}, n = setTimeout(() => void t(), J == null ? 0 : oe);
|
|
74
|
+
return () => {
|
|
75
|
+
e = !0, clearTimeout(n);
|
|
76
|
+
};
|
|
77
|
+
}, [Y]);
|
|
78
|
+
let Le = Y != null && De === Y, X = c(() => re(U), [U]), Re = c(() => {
|
|
79
|
+
if (x) return (e) => {
|
|
80
|
+
let t = ne(e.rootKey);
|
|
81
|
+
if (!t) return;
|
|
82
|
+
let n = x(e.path, t);
|
|
83
|
+
if (n != null) return n;
|
|
84
|
+
let r = e.rootKey === k.rootKey && e.path.join("/") === q;
|
|
85
|
+
if (Le && r && T) return T(e.path, J);
|
|
86
|
+
if (!C || !w || X.length === 0 || !H(e)) return;
|
|
87
|
+
let i = C(e.path, X);
|
|
88
|
+
return i.length > 0 ? w(i) : void 0;
|
|
89
|
+
};
|
|
90
|
+
}, [
|
|
91
|
+
X,
|
|
92
|
+
k.rootKey,
|
|
93
|
+
x,
|
|
94
|
+
C,
|
|
95
|
+
w,
|
|
96
|
+
T,
|
|
39
97
|
H,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
N(!0), P(void 0);
|
|
98
|
+
Le,
|
|
99
|
+
q,
|
|
100
|
+
J
|
|
101
|
+
]), Z = Re?.(k), Q = H(k), ze = k.rootKey === i.Organization, Be = ue != null && Q && C?.(k.path, [ie.Files]).length ? ue : void 0, $ = k.rootKey === i.Organization && !Q && (L || z), Ve = o((e) => {
|
|
102
|
+
ve(e), N(void 0);
|
|
103
|
+
}, []), He = o(() => M(!0), []), Ue = y?.rememberPublishFolder, { saveError: We } = E, Ge = o(async () => {
|
|
104
|
+
if (M(!0), K || $ || Z) return;
|
|
105
|
+
Ce(!0), N(void 0);
|
|
49
106
|
let t = {
|
|
50
|
-
resourceId:
|
|
51
|
-
currentFolderPath:
|
|
52
|
-
currentVersion:
|
|
53
|
-
destination:
|
|
54
|
-
versionMode:
|
|
55
|
-
newVersion:
|
|
56
|
-
rules: F
|
|
107
|
+
resourceId: h,
|
|
108
|
+
currentFolderPath: g,
|
|
109
|
+
currentVersion: _,
|
|
110
|
+
destination: k,
|
|
111
|
+
versionMode: A,
|
|
112
|
+
newVersion: G,
|
|
113
|
+
rules: F,
|
|
114
|
+
isDirectWrite: Q
|
|
57
115
|
};
|
|
58
116
|
try {
|
|
59
|
-
let e = await te(
|
|
60
|
-
e.isPublished &&
|
|
117
|
+
let e = await te(m, t, me);
|
|
118
|
+
e.isPublished && Ue?.(k.path), fe(e, t);
|
|
61
119
|
} catch (t) {
|
|
62
120
|
if (t instanceof n) {
|
|
63
|
-
|
|
121
|
+
N(t.message);
|
|
64
122
|
return;
|
|
65
123
|
}
|
|
66
124
|
let { message: r, status: i } = await e(t);
|
|
67
|
-
if (
|
|
68
|
-
|
|
125
|
+
if (W && i === 409) {
|
|
126
|
+
xe(G);
|
|
69
127
|
return;
|
|
70
128
|
}
|
|
71
|
-
|
|
129
|
+
N(r ?? We);
|
|
72
130
|
} finally {
|
|
73
|
-
|
|
131
|
+
Ce(!1);
|
|
74
132
|
}
|
|
75
133
|
}, [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
134
|
+
m,
|
|
135
|
+
g,
|
|
136
|
+
_,
|
|
137
|
+
k,
|
|
138
|
+
W,
|
|
139
|
+
Q,
|
|
140
|
+
$,
|
|
141
|
+
Z,
|
|
142
|
+
fe,
|
|
143
|
+
me,
|
|
144
|
+
Ue,
|
|
145
|
+
h,
|
|
86
146
|
F,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]),
|
|
147
|
+
We,
|
|
148
|
+
G,
|
|
149
|
+
A,
|
|
150
|
+
K
|
|
151
|
+
]), Ke = o(() => void Ge(), [Ge]), { personalRoot: qe, organizationRoot: Je } = E, Ye = c(() => {
|
|
92
152
|
let e = {
|
|
93
153
|
key: i.Personal,
|
|
94
|
-
label:
|
|
95
|
-
items:
|
|
96
|
-
expandedPaths:
|
|
97
|
-
onExpandedPathsChange:
|
|
98
|
-
loadingPaths:
|
|
154
|
+
label: qe,
|
|
155
|
+
items: D.folderItems,
|
|
156
|
+
expandedPaths: D.expandedPaths,
|
|
157
|
+
onExpandedPathsChange: D.onExpandedPathsChange,
|
|
158
|
+
loadingPaths: D.loadingPaths
|
|
99
159
|
};
|
|
100
|
-
return
|
|
160
|
+
return y ? [e, {
|
|
101
161
|
key: i.Organization,
|
|
102
|
-
label:
|
|
103
|
-
items:
|
|
104
|
-
expandedPaths:
|
|
105
|
-
onExpandedPathsChange:
|
|
106
|
-
loadingPaths:
|
|
162
|
+
label: Je,
|
|
163
|
+
items: y.folderItems,
|
|
164
|
+
expandedPaths: y.expandedPaths,
|
|
165
|
+
onExpandedPathsChange: y.onExpandedPathsChange,
|
|
166
|
+
loadingPaths: y.loadingPaths,
|
|
107
167
|
hasAccessRules: !0
|
|
108
168
|
}] : [e];
|
|
109
169
|
}, [
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
]), { onCreateFolder:
|
|
118
|
-
e === i.Organization ? await
|
|
119
|
-
}, [
|
|
120
|
-
versionMode:
|
|
121
|
-
onVersionModeChange:
|
|
122
|
-
currentVersion:
|
|
123
|
-
newVersion:
|
|
124
|
-
onNewVersionChange:
|
|
125
|
-
onNewVersionBlur:
|
|
126
|
-
newVersionError:
|
|
170
|
+
y,
|
|
171
|
+
Je,
|
|
172
|
+
D.expandedPaths,
|
|
173
|
+
D.folderItems,
|
|
174
|
+
D.loadingPaths,
|
|
175
|
+
D.onExpandedPathsChange,
|
|
176
|
+
qe
|
|
177
|
+
]), { onCreateFolder: Xe } = D, Ze = y?.onCreatePublishFolder, Qe = o(async (e, t, n) => {
|
|
178
|
+
e === i.Organization ? (P.current.add([...t, n].join("/")), await Ze?.(t, n)) : await Xe(t, n);
|
|
179
|
+
}, [Xe, Ze]), { getVersionError: $e } = E, et = c(() => m.isVersioned && _ != null ? {
|
|
180
|
+
versionMode: A,
|
|
181
|
+
onVersionModeChange: _e,
|
|
182
|
+
currentVersion: _,
|
|
183
|
+
newVersion: j,
|
|
184
|
+
onNewVersionChange: Ve,
|
|
185
|
+
onNewVersionBlur: He,
|
|
186
|
+
newVersionError: ye && K ? $e(K, G) : void 0
|
|
127
187
|
} : void 0, [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
188
|
+
m.isVersioned,
|
|
189
|
+
_,
|
|
190
|
+
$e,
|
|
191
|
+
ye,
|
|
192
|
+
He,
|
|
193
|
+
j,
|
|
194
|
+
Ve,
|
|
195
|
+
G,
|
|
134
196
|
K,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
E
|
|
138
|
-
]), { accessRules: ge } = v, _e = o(() => ({
|
|
197
|
+
A
|
|
198
|
+
]), { accessRules: tt } = E, nt = c(() => ({
|
|
139
199
|
rules: F,
|
|
140
200
|
onRulesChange: I,
|
|
141
|
-
sourceOptions:
|
|
201
|
+
sourceOptions: de,
|
|
142
202
|
isLoading: L,
|
|
143
203
|
hasLoadError: z,
|
|
144
|
-
labels:
|
|
204
|
+
labels: tt,
|
|
205
|
+
isHiddenFor: H
|
|
145
206
|
}), [
|
|
146
|
-
|
|
207
|
+
tt,
|
|
147
208
|
z,
|
|
209
|
+
H,
|
|
148
210
|
L,
|
|
149
|
-
|
|
211
|
+
de,
|
|
150
212
|
F
|
|
151
213
|
]);
|
|
152
214
|
return {
|
|
153
215
|
panelProps: {
|
|
154
|
-
onSubmit:
|
|
155
|
-
isSubmitDisabled:
|
|
156
|
-
isSubmitting:
|
|
157
|
-
submitError:
|
|
158
|
-
roots:
|
|
159
|
-
destination:
|
|
160
|
-
onDestinationChange:
|
|
161
|
-
onCreateFolder:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
216
|
+
onSubmit: Ke,
|
|
217
|
+
isSubmitDisabled: W && !!K || $ || Z != null,
|
|
218
|
+
isSubmitting: Se,
|
|
219
|
+
submitError: we,
|
|
220
|
+
roots: Ye,
|
|
221
|
+
destination: k,
|
|
222
|
+
onDestinationChange: ge,
|
|
223
|
+
onCreateFolder: Qe,
|
|
224
|
+
getDisabledReason: Re,
|
|
225
|
+
version: et,
|
|
226
|
+
accessRules: nt,
|
|
227
|
+
onPendingDestinationChange: ke,
|
|
228
|
+
foldersError: D.hasError ? E.foldersLoadError : void 0,
|
|
229
|
+
onRetryFolders: D.retry,
|
|
230
|
+
dependencies: ze ? U : f,
|
|
231
|
+
dependenciesNote: ze ? le : void 0,
|
|
232
|
+
destinationNote: Be
|
|
167
233
|
},
|
|
168
|
-
submit:
|
|
234
|
+
submit: Ge
|
|
169
235
|
};
|
|
170
236
|
};
|
|
171
237
|
//#endregion
|
|
172
|
-
export {
|
|
238
|
+
export { p as useResourceSavePanel };
|