@epam/ai-dial-chat-hooks 1.4.0-dev.173 → 1.4.0-dev.178
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/catalog/resource-save.d.ts.map +1 -1
- package/catalog/resource-save.js +36 -28
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +5 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +77 -77
- package/index.js +189 -189
- package/org-units/org-unit-guards.d.ts +38 -15
- package/org-units/org-unit-guards.d.ts.map +1 -1
- package/org-units/org-unit-guards.js +17 -19
- package/org-units/useOrgUnits/useOrgUnits.d.ts +2 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -1
- package/org-units/useOrgUnits/useOrgUnits.js +5 -2
- package/package.json +17 -17
- package/utils.js +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-save.d.ts","sourceRoot":"","sources":["../../src/catalog/resource-save.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resource-save.d.ts","sourceRoot":"","sources":["../../src/catalog/resource-save.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAEf,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,cAAc,yBAAyB,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,SAAS,MAAM,KACd,mBAAmB,GAAG,SAC4C,CAAC;AAEtE,6DAA6D;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C7B,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAiBD,sGAAsG;AACtG,eAAO,MAAM,0BAA0B,GAEnC,QAAQ,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,KACrD,oBAMF,CAAC;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,mBAAmB,EAC5B,QAAQ,kBAAkB,EAC1B,SAAS,oBAAoB,KAC5B,OAAO,CAAC,kBAAkB,CA0F5B,CAAC"}
|
package/catalog/resource-save.js
CHANGED
|
@@ -1,59 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { getApiErrorDetails as e, getApiErrorStatus as t } from "../api-error/api-error.js";
|
|
2
|
+
import { ResourceSaveError as n, isResourceCreateAdapter as r } from "./resource-save-adapter.js";
|
|
3
|
+
import { SaveDestinationRoot as i } from "./save-destination-root.js";
|
|
4
|
+
import { OrgUnitCopyErrorCode as a } from "@epam/ai-dial-chat-api-client";
|
|
5
|
+
import { SaveVersionMode as o, toFolderPathKey as s } from "@epam/ai-dial-publish-panel";
|
|
4
6
|
//#region src/catalog/resource-save.ts
|
|
5
|
-
var
|
|
7
|
+
var c = (e) => Object.values(i).find((t) => t === e), l = /* @__PURE__ */ function(e) {
|
|
6
8
|
return e.Saved = "saved", e.SavedButMoveFailed = "savedButMoveFailed", e.SavedButPublishFailed = "savedButPublishFailed", e.SavedButOrgUnitWriteFailed = "savedButOrgUnitWriteFailed", e;
|
|
7
|
-
}({}),
|
|
9
|
+
}({}), u = /* @__PURE__ */ function(e) {
|
|
8
10
|
return e.Invalid = "invalid", e.Unchanged = "unchanged", e.Exists = "exists", e;
|
|
9
|
-
}({}),
|
|
11
|
+
}({}), d = async (n) => {
|
|
12
|
+
if (t(n) !== 422) return !1;
|
|
13
|
+
let { code: r } = await e(n);
|
|
14
|
+
return r === a.FolderReferenceNeedsRequest;
|
|
15
|
+
}, f = (e, t) => s(e) === s(t), p = (e) => async (t, n, r, i) => {
|
|
10
16
|
await e.publishCatalogEntity(t, n, {
|
|
11
17
|
folderPath: r.join("/"),
|
|
12
18
|
...i ? { version: i } : {}
|
|
13
19
|
});
|
|
14
|
-
},
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
else if (
|
|
20
|
+
}, m = async (e, t, n) => {
|
|
21
|
+
let a = e.isVersioned && t.versionMode === o.New, s = t.destination.rootKey === i.Organization, c = s && t.isDirectWrite === !0 && e.saveIntoOrgUnit != null, l = s ? t.currentFolderPath : t.destination.path, u, p = !1;
|
|
22
|
+
if (r(e)) ({id: u} = await e.createIn(l));
|
|
23
|
+
else if (a) {
|
|
18
24
|
if (!e.saveAsNewVersion) throw Error("This resource cannot be saved as a new version");
|
|
19
|
-
({id:
|
|
20
|
-
} else ({id:
|
|
21
|
-
let
|
|
25
|
+
({id: u} = await e.saveAsNewVersion(t.newVersion, l));
|
|
26
|
+
} else ({id: u} = await e.saveInPlace()), p = !s && !f(l, t.currentFolderPath);
|
|
27
|
+
let m = {
|
|
22
28
|
outcome: "saved",
|
|
23
|
-
savedId:
|
|
24
|
-
isCreated:
|
|
25
|
-
isNewVersion:
|
|
29
|
+
savedId: u,
|
|
30
|
+
isCreated: r(e),
|
|
31
|
+
isNewVersion: a,
|
|
26
32
|
isPublished: !1,
|
|
27
33
|
isWrittenToOrgUnit: !1
|
|
28
34
|
};
|
|
29
|
-
if (
|
|
30
|
-
({id:
|
|
35
|
+
if (p && !r(e)) try {
|
|
36
|
+
({id: m.savedId} = await e.move(u, l));
|
|
31
37
|
} catch (e) {
|
|
32
38
|
return {
|
|
33
|
-
...
|
|
39
|
+
...m,
|
|
34
40
|
outcome: "savedButMoveFailed",
|
|
35
41
|
error: e
|
|
36
42
|
};
|
|
37
43
|
}
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
let h = !1;
|
|
45
|
+
if (s && c) try {
|
|
46
|
+
await e.saveIntoOrgUnit?.(m.savedId, t.destination.path), m.isWrittenToOrgUnit = !0;
|
|
40
47
|
} catch (e) {
|
|
41
|
-
return {
|
|
42
|
-
...
|
|
48
|
+
if (!await d(e)) return {
|
|
49
|
+
...m,
|
|
43
50
|
outcome: "savedButOrgUnitWriteFailed",
|
|
44
51
|
error: e
|
|
45
52
|
};
|
|
53
|
+
h = !0;
|
|
46
54
|
}
|
|
47
|
-
|
|
48
|
-
await
|
|
55
|
+
if (s && (!c || h)) try {
|
|
56
|
+
await n(e.publishEntityType, m.savedId, t.destination.path, a ? t.newVersion : t.currentVersion), m.isPublished = !0;
|
|
49
57
|
} catch (e) {
|
|
50
58
|
return {
|
|
51
|
-
...
|
|
59
|
+
...m,
|
|
52
60
|
outcome: "savedButPublishFailed",
|
|
53
61
|
error: e
|
|
54
62
|
};
|
|
55
63
|
}
|
|
56
|
-
return
|
|
64
|
+
return m;
|
|
57
65
|
};
|
|
58
66
|
//#endregion
|
|
59
|
-
export {
|
|
67
|
+
export { n as ResourceSaveError, l as ResourceSaveOutcome, u as ResourceSaveVersionError, i as SaveDestinationRoot, p as createPublishSavedResource, r as isResourceCreateAdapter, m as runResourceSave, c as toSaveDestinationRoot };
|
|
@@ -51,6 +51,10 @@ export interface UseResourceSavePanelParams {
|
|
|
51
51
|
getMissingNamespacesReason?: (missing: OrgUnitNamespace[]) => string;
|
|
52
52
|
/** 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. */
|
|
53
53
|
dependenciesNote?: string;
|
|
54
|
+
/** Whether the user is a DIAL admin, the only caller DIAL Core lets copy an application that refers to a folder of files; omit while the org-unit rule does not apply, which leaves the direct-write decision as it is. With it, a listed folder dependency of a user who is not a DIAL admin takes an Organization destination off the direct write and onto the publication request. */
|
|
55
|
+
hasAdminAccess?: boolean;
|
|
56
|
+
/** One sentence shown under the committed destination, instead of the icon notice, when a direct-write folder takes the publication request because the application refers to a folder of files; without it nothing is shown. */
|
|
57
|
+
folderReferenceNote?: string;
|
|
54
58
|
/** 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. */
|
|
55
59
|
iconNote?: string;
|
|
56
60
|
/** 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. */
|
|
@@ -76,5 +80,5 @@ export interface UseResourceSavePanelResult {
|
|
|
76
80
|
* with private dependencies it also reads them while an Organization
|
|
77
81
|
* destination is chosen and returns them as `panelProps.dependencies`.
|
|
78
82
|
*/
|
|
79
|
-
export declare const useResourceSavePanel: ({ isOpen, adapter, resourceId, currentFolderPath, currentVersion, versionPattern, listPersonalFolders, organizationFolders, publishClient, canSaveDirectlyTo, getDisabledReason: getFolderDisabledReason, loadDependencies, getMissingNamespaces, getMissingNamespacesReason, dependenciesNote, iconNote, getTargetTakenReason, labels, onSaved, }: UseResourceSavePanelParams) => UseResourceSavePanelResult;
|
|
83
|
+
export declare const useResourceSavePanel: ({ isOpen, adapter, resourceId, currentFolderPath, currentVersion, versionPattern, listPersonalFolders, organizationFolders, publishClient, canSaveDirectlyTo, getDisabledReason: getFolderDisabledReason, loadDependencies, getMissingNamespaces, getMissingNamespacesReason, dependenciesNote, hasAdminAccess, folderReferenceNote, iconNote, getTargetTakenReason, labels, onSaved, }: UseResourceSavePanelParams) => UseResourceSavePanelResult;
|
|
80
84
|
//# 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,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAIL,KAAK,iBAAiB,EAEtB,KAAK,gCAAgC,EACtC,MAAM,6BAA6B,CAAC;
|
|
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,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAIL,KAAK,iBAAiB,EAEtB,KAAK,gCAAgC,EACtC,MAAM,6BAA6B,CAAC;AAQrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAIL,wBAAwB,EAExB,mBAAmB,EAEnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAQtF,4GAA4G;AAC5G,MAAM,WAAW,0BAA0B;IACzC,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,gBAAgB,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,eAAe,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/E;AAED,mDAAmD;AACnD,MAAM,WAAW,0BAA0B;IACzC,wGAAwG;IACxG,MAAM,EAAE,OAAO,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wCAAwC;IAC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MAAM,EAAE,0BAA0B,CAAC;IACnC,0FAA0F;IAC1F,OAAO,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC3E;AAED,kIAAkI;AAClI,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,gCAAgC,EAC9B,UAAU,GACV,kBAAkB,GAClB,cAAc,GACd,aAAa,GACb,OAAO,GACP,aAAa,GACb,qBAAqB,GACrB,gBAAgB,GAChB,mBAAmB,GACnB,SAAS,GACT,4BAA4B,GAC5B,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,CACpB,CAAC;AAEF,8CAA8C;AAC9C,MAAM,WAAW,0BAA0B;IACzC,wDAAwD;IACxD,UAAU,EAAE,2BAA2B,CAAC;IACxC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,yXAsBlC,0BAA0B,KAAG,0BA+Z/B,CAAC"}
|
|
@@ -3,95 +3,95 @@ import { useResourceFolders as t } from "../useResourceFolders/useResourceFolder
|
|
|
3
3
|
import { ResourceSaveError as n, isResourceCreateAdapter as r } from "../resource-save-adapter.js";
|
|
4
4
|
import { SaveDestinationRoot as i } from "../save-destination-root.js";
|
|
5
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
|
|
8
|
-
import { useCallback as o, useEffect as s, useMemo as c, useRef as
|
|
6
|
+
import { getDependencyOrgUnitNamespaces as re, getOrgUnitNamespace as ie, hasBlockingFolderReference as ae } from "../../org-units/org-unit-guards.js";
|
|
7
|
+
import { OrgUnitNamespace as oe } from "@epam/ai-dial-chat-shared";
|
|
8
|
+
import { useCallback as o, useEffect as s, useMemo as c, useRef as se, useState as l } from "react";
|
|
9
9
|
import { SaveVersionMode as u } from "@epam/ai-dial-publish-panel";
|
|
10
10
|
//#region src/catalog/useResourceSavePanel/useResourceSavePanel.ts
|
|
11
|
-
var d = [],
|
|
11
|
+
var d = [], ce = 400, f = ({ isOpen: f, adapter: p, resourceId: m, currentFolderPath: h, currentVersion: g, versionPattern: _, listPersonalFolders: le, organizationFolders: v, publishClient: y, canSaveDirectlyTo: b, getDisabledReason: x, loadDependencies: S, getMissingNamespaces: C, getMissingNamespacesReason: w, dependenciesNote: ue, hasAdminAccess: de, folderReferenceNote: fe, iconNote: pe, getTargetTakenReason: T, labels: E, onSaved: me }) => {
|
|
12
12
|
let D = t({
|
|
13
|
-
listFolders:
|
|
13
|
+
listFolders: le,
|
|
14
14
|
isEnabled: f
|
|
15
|
-
}), { checkPublishTarget: O } = y,
|
|
15
|
+
}), { checkPublishTarget: O } = y, he = c(() => ee(y), [y]), ge = c(() => ({
|
|
16
16
|
rootKey: i.Personal,
|
|
17
17
|
path: h
|
|
18
|
-
}), [h]), [k,
|
|
19
|
-
|
|
18
|
+
}), [h]), [k, _e] = l(ge), [A, ve] = l(u.Keep), [j, M] = l(""), [N, P] = l(!1), [F, I] = l(), [ye, be] = l(!1), [xe, L] = l(), [Se, Ce] = l(!1), [we, Te] = l(), R = se(/* @__PURE__ */ new Set()), [z, Ee] = l(d), De = ie(p.publishEntityType), B = de != null && De != null && ae(De, z, de), V = o((e) => e.rootKey === i.Organization && p.saveIntoOrgUnit != null && b?.(e.path, i.Organization) === !0, [p.saveIntoOrgUnit, b]), H = o((e) => !B && V(e), [B, V]), Oe = o((e) => {
|
|
19
|
+
Ce(e?.rootKey === i.Organization);
|
|
20
20
|
}, []);
|
|
21
21
|
s(() => {
|
|
22
|
-
f && (
|
|
22
|
+
f && (Ce(!1), Te(void 0), R.current.clear(), _e(ge), ve(u.Keep), M(""), P(!1), I(void 0), L(void 0));
|
|
23
23
|
}, [f]);
|
|
24
|
-
let
|
|
24
|
+
let ke = se(S);
|
|
25
25
|
s(() => {
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
let
|
|
26
|
+
ke.current = S;
|
|
27
|
+
}, [S]);
|
|
28
|
+
let Ae = f && S != null && (k.rootKey === i.Organization || Se);
|
|
29
29
|
s(() => {
|
|
30
|
-
if (
|
|
30
|
+
if (Ee(d), !Ae) return;
|
|
31
31
|
let e = !1;
|
|
32
32
|
return (async () => {
|
|
33
33
|
try {
|
|
34
|
-
let t = await
|
|
35
|
-
!e && t &&
|
|
34
|
+
let t = await ke.current?.();
|
|
35
|
+
!e && t && Ee(t);
|
|
36
36
|
} catch {}
|
|
37
37
|
})(), () => {
|
|
38
38
|
e = !0;
|
|
39
39
|
};
|
|
40
|
-
}, [
|
|
40
|
+
}, [Ae]);
|
|
41
41
|
let U = p.isVersioned && A === u.New, W = j.trim(), G = c(() => {
|
|
42
42
|
if (U) {
|
|
43
43
|
if (!_.test(W)) return a.Invalid;
|
|
44
44
|
if (W === g) return a.Unchanged;
|
|
45
|
-
if (W ===
|
|
45
|
+
if (W === F) return a.Exists;
|
|
46
46
|
}
|
|
47
47
|
}, [
|
|
48
48
|
U,
|
|
49
49
|
_,
|
|
50
50
|
W,
|
|
51
51
|
g,
|
|
52
|
-
|
|
53
|
-
]),
|
|
52
|
+
F
|
|
53
|
+
]), je = r(p), K = k.path.join("/"), Me = [...R.current].some((e) => K === e || K.startsWith(`${e}/`)), Ne = _.test(W) && W !== g, q = U ? W : void 0, J = T != null && x != null && O != null && !je && H(k) && !Me && (!U || Ne) ? `${K}\u0000${q ?? ""}` : void 0, Pe = p.publishEntityType;
|
|
54
54
|
s(() => {
|
|
55
55
|
if (J == null || O == null) return;
|
|
56
56
|
let e = !1, t = async () => {
|
|
57
57
|
try {
|
|
58
|
-
let { taken: t } = await O(
|
|
58
|
+
let { taken: t } = await O(Pe, m, K, q);
|
|
59
59
|
if (e) return;
|
|
60
|
-
|
|
60
|
+
Te((e) => t ? J : e === J ? void 0 : e);
|
|
61
61
|
} catch {}
|
|
62
|
-
}, n = setTimeout(() => void t(), q == null ? 0 :
|
|
62
|
+
}, n = setTimeout(() => void t(), q == null ? 0 : ce);
|
|
63
63
|
return () => {
|
|
64
64
|
e = !0, clearTimeout(n);
|
|
65
65
|
};
|
|
66
66
|
}, [J]);
|
|
67
|
-
let
|
|
68
|
-
if (
|
|
67
|
+
let Fe = J != null && we === J, Y = c(() => re(z), [z]), Ie = c(() => {
|
|
68
|
+
if (x) return (e) => {
|
|
69
69
|
let t = ne(e.rootKey);
|
|
70
70
|
if (!t) return;
|
|
71
|
-
let n =
|
|
71
|
+
let n = x(e.path, t);
|
|
72
72
|
if (n != null) return n;
|
|
73
73
|
let r = e.rootKey === k.rootKey && e.path.join("/") === K;
|
|
74
|
-
if (
|
|
75
|
-
if (!
|
|
76
|
-
let i =
|
|
77
|
-
return i.length > 0 ?
|
|
74
|
+
if (Fe && r && T) return T(e.path, q);
|
|
75
|
+
if (!C || !w || Y.length === 0 || !H(e)) return;
|
|
76
|
+
let i = C(e.path, Y);
|
|
77
|
+
return i.length > 0 ? w(i) : void 0;
|
|
78
78
|
};
|
|
79
79
|
}, [
|
|
80
80
|
Y,
|
|
81
81
|
k.rootKey,
|
|
82
|
-
|
|
83
|
-
S,
|
|
82
|
+
x,
|
|
84
83
|
C,
|
|
84
|
+
w,
|
|
85
85
|
T,
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
H,
|
|
87
|
+
Fe,
|
|
88
88
|
K,
|
|
89
89
|
q
|
|
90
|
-
]), X =
|
|
91
|
-
|
|
92
|
-
}, []),
|
|
93
|
-
if (
|
|
94
|
-
|
|
90
|
+
]), X = Ie?.(k), Z = H(k), Le = k.rootKey === i.Organization, Re = pe != null && Z && C?.(k.path, [oe.Files]).length ? pe : void 0, ze = B && V(k) ? fe : Re, Be = o((e) => {
|
|
91
|
+
M(e), L(void 0);
|
|
92
|
+
}, []), Ve = o(() => P(!0), []), He = v?.rememberPublishFolder, { saveError: Q } = E, $ = o(async () => {
|
|
93
|
+
if (P(!0), G || X) return;
|
|
94
|
+
be(!0), L(void 0);
|
|
95
95
|
let t = {
|
|
96
96
|
resourceId: m,
|
|
97
97
|
currentFolderPath: h,
|
|
@@ -102,8 +102,8 @@ var d = [], oe = 400, f = ({ isOpen: f, adapter: p, resourceId: m, currentFolder
|
|
|
102
102
|
isDirectWrite: Z
|
|
103
103
|
};
|
|
104
104
|
try {
|
|
105
|
-
let e = await te(p, t,
|
|
106
|
-
e.isPublished &&
|
|
105
|
+
let e = await te(p, t, he);
|
|
106
|
+
e.isPublished && He?.(k.path), me(e, t);
|
|
107
107
|
} catch (t) {
|
|
108
108
|
if (t instanceof n) {
|
|
109
109
|
L(t.message);
|
|
@@ -111,12 +111,12 @@ var d = [], oe = 400, f = ({ isOpen: f, adapter: p, resourceId: m, currentFolder
|
|
|
111
111
|
}
|
|
112
112
|
let { message: r, status: i } = await e(t);
|
|
113
113
|
if (U && i === 409) {
|
|
114
|
-
|
|
114
|
+
I(W);
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
L(r ??
|
|
117
|
+
L(r ?? Q);
|
|
118
118
|
} finally {
|
|
119
|
-
|
|
119
|
+
be(!1);
|
|
120
120
|
}
|
|
121
121
|
}, [
|
|
122
122
|
p,
|
|
@@ -126,18 +126,18 @@ var d = [], oe = 400, f = ({ isOpen: f, adapter: p, resourceId: m, currentFolder
|
|
|
126
126
|
U,
|
|
127
127
|
Z,
|
|
128
128
|
X,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
me,
|
|
130
|
+
he,
|
|
131
|
+
He,
|
|
132
132
|
m,
|
|
133
|
-
|
|
133
|
+
Q,
|
|
134
134
|
W,
|
|
135
135
|
A,
|
|
136
136
|
G
|
|
137
|
-
]),
|
|
137
|
+
]), Ue = o(() => void $(), [$]), { personalRoot: We, organizationRoot: Ge } = E, Ke = c(() => {
|
|
138
138
|
let e = {
|
|
139
139
|
key: i.Personal,
|
|
140
|
-
label:
|
|
140
|
+
label: We,
|
|
141
141
|
items: D.folderItems,
|
|
142
142
|
expandedPaths: D.expandedPaths,
|
|
143
143
|
onExpandedPathsChange: D.onExpandedPathsChange,
|
|
@@ -145,7 +145,7 @@ var d = [], oe = 400, f = ({ isOpen: f, adapter: p, resourceId: m, currentFolder
|
|
|
145
145
|
};
|
|
146
146
|
return v ? [e, {
|
|
147
147
|
key: i.Organization,
|
|
148
|
-
label:
|
|
148
|
+
label: Ge,
|
|
149
149
|
items: v.folderItems,
|
|
150
150
|
expandedPaths: v.expandedPaths,
|
|
151
151
|
onExpandedPathsChange: v.onExpandedPathsChange,
|
|
@@ -153,54 +153,54 @@ var d = [], oe = 400, f = ({ isOpen: f, adapter: p, resourceId: m, currentFolder
|
|
|
153
153
|
}] : [e];
|
|
154
154
|
}, [
|
|
155
155
|
v,
|
|
156
|
-
|
|
156
|
+
Ge,
|
|
157
157
|
D.expandedPaths,
|
|
158
158
|
D.folderItems,
|
|
159
159
|
D.loadingPaths,
|
|
160
160
|
D.onExpandedPathsChange,
|
|
161
|
-
|
|
162
|
-
]), { onCreateFolder:
|
|
163
|
-
e === i.Organization ? (
|
|
164
|
-
}, [
|
|
161
|
+
We
|
|
162
|
+
]), { onCreateFolder: qe } = D, Je = v?.onCreatePublishFolder, Ye = o(async (e, t, n) => {
|
|
163
|
+
e === i.Organization ? (R.current.add([...t, n].join("/")), await Je?.(t, n)) : await qe(t, n);
|
|
164
|
+
}, [qe, Je]), { getVersionError: Xe } = E, Ze = c(() => p.isVersioned && g != null ? {
|
|
165
165
|
versionMode: A,
|
|
166
|
-
onVersionModeChange:
|
|
166
|
+
onVersionModeChange: ve,
|
|
167
167
|
currentVersion: g,
|
|
168
168
|
newVersion: j,
|
|
169
|
-
onNewVersionChange:
|
|
170
|
-
onNewVersionBlur:
|
|
171
|
-
newVersionError:
|
|
169
|
+
onNewVersionChange: Be,
|
|
170
|
+
onNewVersionBlur: Ve,
|
|
171
|
+
newVersionError: N && G ? Xe(G, W) : void 0
|
|
172
172
|
} : void 0, [
|
|
173
173
|
p.isVersioned,
|
|
174
174
|
g,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
Xe,
|
|
176
|
+
N,
|
|
177
|
+
Ve,
|
|
178
178
|
j,
|
|
179
|
-
|
|
179
|
+
Be,
|
|
180
180
|
W,
|
|
181
181
|
G,
|
|
182
182
|
A
|
|
183
183
|
]);
|
|
184
184
|
return {
|
|
185
185
|
panelProps: {
|
|
186
|
-
onSubmit:
|
|
186
|
+
onSubmit: Ue,
|
|
187
187
|
isSubmitDisabled: U && !!G || X != null,
|
|
188
|
-
isSubmitting:
|
|
189
|
-
submitError:
|
|
190
|
-
roots:
|
|
188
|
+
isSubmitting: ye,
|
|
189
|
+
submitError: xe,
|
|
190
|
+
roots: Ke,
|
|
191
191
|
destination: k,
|
|
192
|
-
onDestinationChange:
|
|
193
|
-
onCreateFolder:
|
|
194
|
-
getDisabledReason:
|
|
195
|
-
version:
|
|
196
|
-
onPendingDestinationChange:
|
|
192
|
+
onDestinationChange: _e,
|
|
193
|
+
onCreateFolder: Ye,
|
|
194
|
+
getDisabledReason: Ie,
|
|
195
|
+
version: Ze,
|
|
196
|
+
onPendingDestinationChange: Oe,
|
|
197
197
|
foldersError: D.hasError ? E.foldersLoadError : void 0,
|
|
198
198
|
onRetryFolders: D.retry,
|
|
199
|
-
dependencies:
|
|
200
|
-
dependenciesNote:
|
|
201
|
-
destinationNote:
|
|
199
|
+
dependencies: Le ? z : d,
|
|
200
|
+
dependenciesNote: Le ? ue : void 0,
|
|
201
|
+
destinationNote: ze
|
|
202
202
|
},
|
|
203
|
-
submit:
|
|
203
|
+
submit: $
|
|
204
204
|
};
|
|
205
205
|
};
|
|
206
206
|
//#endregion
|