@openrails/contentkit-ui 0.85.1 → 0.86.0
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/README.md +7 -4
- package/dist/client/beacons.d.ts +13 -4
- package/dist/client/beacons.js +14 -7
- package/dist/client/beacons.js.map +1 -1
- package/dist/client/client.d.ts +3 -0
- package/dist/client/client.js +29 -27
- package/dist/client/client.js.map +1 -1
- package/dist/client/codes.d.ts +6 -1
- package/dist/client/codes.js +4 -1
- package/dist/client/codes.js.map +1 -1
- package/dist/client/generated/error-codes.js +1 -1
- package/dist/client/generated/error-codes.js.map +1 -1
- package/dist/client/generated/routes.d.ts +14 -1
- package/dist/client/generated/routes.js +17 -1
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +29 -0
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/media/queue.d.ts +4 -2
- package/dist/client/media/queue.js +18 -12
- package/dist/client/media/queue.js.map +1 -1
- package/dist/client/media/rules.d.ts +7 -1
- package/dist/client/media/rules.js +27 -21
- package/dist/client/media/rules.js.map +1 -1
- package/dist/client/stats.d.ts +32 -0
- package/dist/client/stats.js +35 -0
- package/dist/client/stats.js.map +1 -0
- package/dist/client.js +30 -29
- package/dist/components/admin/content-manager.js +206 -206
- package/dist/components/admin/content-manager.js.map +1 -1
- package/dist/components/admin/group-manager.js +71 -70
- package/dist/components/admin/group-manager.js.map +1 -1
- package/dist/components/admin/media-item-panel.d.ts +24 -7
- package/dist/components/admin/media-item-panel.js +209 -197
- package/dist/components/admin/media-item-panel.js.map +1 -1
- package/dist/components/admin/poll-manager.js +25 -25
- package/dist/components/admin/stats-dashboard.d.ts +22 -0
- package/dist/components/admin/stats-dashboard.js +257 -0
- package/dist/components/admin/stats-dashboard.js.map +1 -0
- package/dist/components/content/card.js +42 -42
- package/dist/components/content/card.js.map +1 -1
- package/dist/components/content/editors.js +455 -427
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/content/grid.js +47 -47
- package/dist/components/content/index.d.ts +2 -1
- package/dist/components/content/listing.js +34 -34
- package/dist/components/content/listing.js.map +1 -1
- package/dist/components/content/paywall.d.ts +17 -5
- package/dist/components/content/paywall.js +115 -100
- package/dist/components/content/paywall.js.map +1 -1
- package/dist/components/content/reader-stats.d.ts +12 -0
- package/dist/components/content/reader-stats.js +47 -0
- package/dist/components/content/reader-stats.js.map +1 -0
- package/dist/components/groups/banner.js +33 -33
- package/dist/components/groups/directory.js +11 -11
- package/dist/components/groups/editor.js +293 -293
- package/dist/components/groups/editor.js.map +1 -1
- package/dist/components/groups/header.js +27 -27
- package/dist/components/groups/header.js.map +1 -1
- package/dist/components/groups/memberships.js +180 -180
- package/dist/components/groups/parts.d.ts +0 -2
- package/dist/components/groups/parts.js +9 -27
- package/dist/components/groups/parts.js.map +1 -1
- package/dist/components/media-folder-editor.js +239 -189
- package/dist/components/media-folder-editor.js.map +1 -1
- package/dist/components/notifications.js +17 -17
- package/dist/components/slot-upload.d.ts +2 -2
- package/dist/components/slot-upload.js +84 -79
- package/dist/components/slot-upload.js.map +1 -1
- package/dist/components/social/bans.js +34 -34
- package/dist/components/social/moderation.js +52 -48
- package/dist/components/social/moderation.js.map +1 -1
- package/dist/components/video-player.d.ts +2 -0
- package/dist/components/video-player.js +318 -314
- package/dist/components/video-player.js.map +1 -1
- package/dist/i18n/context.d.ts +2 -0
- package/dist/i18n/context.js +23 -5
- package/dist/i18n/context.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -10
- package/dist/locales/admin/de.js +27 -0
- package/dist/locales/admin/de.js.map +1 -1
- package/dist/locales/admin/en.d.ts +27 -0
- package/dist/locales/admin/en.js +27 -0
- package/dist/locales/admin/en.js.map +1 -1
- package/dist/locales/admin/es.js +27 -0
- package/dist/locales/admin/es.js.map +1 -1
- package/dist/locales/admin/ja.js +27 -0
- package/dist/locales/admin/ja.js.map +1 -1
- package/dist/locales/admin/ko.js +27 -0
- package/dist/locales/admin/ko.js.map +1 -1
- package/dist/locales/admin/zh.js +27 -0
- package/dist/locales/admin/zh.js.map +1 -1
- package/dist/locales/content/de.js +6 -0
- package/dist/locales/content/de.js.map +1 -1
- package/dist/locales/content/en.d.ts +6 -0
- package/dist/locales/content/en.js +6 -0
- package/dist/locales/content/en.js.map +1 -1
- package/dist/locales/content/es.js +6 -0
- package/dist/locales/content/es.js.map +1 -1
- package/dist/locales/content/ja.js +6 -0
- package/dist/locales/content/ja.js.map +1 -1
- package/dist/locales/content/ko.js +6 -0
- package/dist/locales/content/ko.js.map +1 -1
- package/dist/locales/content/zh.js +6 -0
- package/dist/locales/content/zh.js.map +1 -1
- package/dist/locales/de.js +1 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +34 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +1 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +1 -0
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +1 -0
- package/dist/locales/zh.js.map +1 -1
- package/dist/react/admin.js +22 -23
- package/dist/react/admin.js.map +1 -1
- package/dist/react/canonical.d.ts +4 -3
- package/dist/react/canonical.js +34 -33
- package/dist/react/canonical.js.map +1 -1
- package/dist/react/contents.js +144 -144
- package/dist/react/contents.js.map +1 -1
- package/dist/react/detail.d.ts +12 -6
- package/dist/react/detail.js +31 -24
- package/dist/react/detail.js.map +1 -1
- package/dist/react/folder.d.ts +7 -2
- package/dist/react/folder.js +165 -147
- package/dist/react/folder.js.map +1 -1
- package/dist/react/groups.d.ts +0 -1
- package/dist/react/groups.js +13 -12
- package/dist/react/groups.js.map +1 -1
- package/dist/react/index.d.ts +4 -2
- package/dist/react/location.d.ts +11 -0
- package/dist/react/location.js +18 -0
- package/dist/react/location.js.map +1 -0
- package/dist/react/public.d.ts +8 -0
- package/dist/react/public.js +32 -27
- package/dist/react/public.js.map +1 -1
- package/dist/react/stats.d.ts +24 -0
- package/dist/react/stats.js +28 -0
- package/dist/react/stats.js.map +1 -0
- package/dist/react/use-resource.js +8 -7
- package/dist/react/use-resource.js.map +1 -1
- package/dist/react/versions.js +20 -20
- package/dist/react.js +26 -24
- package/dist/styles.css +1 -1
- package/dist/urls/index.d.ts +35 -10
- package/dist/urls.js +100 -70
- package/dist/urls.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,274 +1,277 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useContentKitClient as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
1
|
+
import { useLanguageName as e, useMessages as t } from "../../i18n/context.js";
|
|
2
|
+
import { useContentKitClient as n } from "../../react/context.js";
|
|
3
|
+
import { useKinds as r } from "../../react/groups.js";
|
|
4
|
+
import { useMediaRead as i } from "../../react/read.js";
|
|
5
|
+
import { Button as a } from "../../ui/button.js";
|
|
6
|
+
import { SortableList as o } from "../sortable-list.js";
|
|
7
|
+
import { MediaFolderEditor as s } from "../media-folder-editor.js";
|
|
8
|
+
import { Badge as c } from "../../ui/badge.js";
|
|
9
|
+
import { Input as l } from "../../ui/input.js";
|
|
10
|
+
import { Label as u } from "../../ui/label.js";
|
|
11
|
+
import { Select as d, SelectContent as f, SelectItem as p, SelectTrigger as m, SelectValue as h } from "../../ui/select.js";
|
|
12
|
+
import { Skeleton as g } from "../../ui/skeleton.js";
|
|
13
|
+
import { ErrorLine as _, useAction as v } from "../social/parts.js";
|
|
14
|
+
import { Switch as y } from "../../ui/switch.js";
|
|
15
|
+
import { fromLocalInput as b, parseAttributes as x, toLocalInput as S } from "../../client/group-fields.js";
|
|
16
|
+
import { GroupPicker as C, labelOf as w, useGroupNames as T } from "../groups/parts.js";
|
|
17
|
+
import { OfferFields as E } from "./offer-fields.js";
|
|
18
|
+
import { AttributeFields as D, formOf as O } from "../groups/fields.js";
|
|
19
|
+
import { MembershipEditor as k } from "../groups/memberships.js";
|
|
20
|
+
import { ReaderManifestEditor as A } from "../admin/reader-manifest.js";
|
|
21
|
+
import { VideoMediaEditor as j, videoPaths as M } from "../admin/media-item-panel.js";
|
|
22
|
+
import { useEffect as N, useId as P, useMemo as F, useState as I } from "react";
|
|
23
|
+
import { jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
24
|
+
import { cn as z } from "cn";
|
|
22
25
|
//#region src/components/content/editors.tsx
|
|
23
|
-
var
|
|
26
|
+
var B = "__none__", V = [
|
|
24
27
|
"listed",
|
|
25
28
|
"members",
|
|
26
29
|
"unlisted"
|
|
27
|
-
],
|
|
30
|
+
], H = [
|
|
28
31
|
"open",
|
|
29
32
|
"closed",
|
|
30
33
|
"hidden"
|
|
31
|
-
],
|
|
34
|
+
], U = [
|
|
32
35
|
"public",
|
|
33
36
|
"tier",
|
|
34
37
|
"ppv",
|
|
35
38
|
"group",
|
|
36
39
|
"group_ppv"
|
|
37
|
-
],
|
|
38
|
-
function
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
+
], W = (e) => e === "group" || e === "group_ppv";
|
|
41
|
+
function G({ title: e, ckui: t, children: n }) {
|
|
42
|
+
return /* @__PURE__ */ R("section", {
|
|
40
43
|
className: "grid gap-3 border-t border-border pt-4",
|
|
41
44
|
"data-ckui": t,
|
|
42
|
-
children: [/* @__PURE__ */
|
|
45
|
+
children: [/* @__PURE__ */ L("h3", {
|
|
43
46
|
className: "font-medium",
|
|
44
47
|
children: e
|
|
45
48
|
}), n]
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
|
-
function
|
|
49
|
-
let { t: n } =
|
|
50
|
-
return
|
|
51
|
+
function K({ show: e }) {
|
|
52
|
+
let { t: n } = t();
|
|
53
|
+
return e ? /* @__PURE__ */ L("span", {
|
|
51
54
|
role: "status",
|
|
52
55
|
className: "text-muted-foreground",
|
|
53
56
|
children: n("contentEditor.saved")
|
|
54
57
|
}) : null;
|
|
55
58
|
}
|
|
56
|
-
function
|
|
57
|
-
let { kinds: n } =
|
|
59
|
+
function q(e, t) {
|
|
60
|
+
let { kinds: n } = r({ client: t });
|
|
58
61
|
return {
|
|
59
62
|
model: n,
|
|
60
63
|
spec: n?.kinds[e]
|
|
61
64
|
};
|
|
62
65
|
}
|
|
63
|
-
function
|
|
64
|
-
let { t:
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
function J({ content: e, ...r }) {
|
|
67
|
+
let { t: i } = t(), o = n(r.client), { spec: s } = q(e.kind, r.client), c = F(() => s?.attributes ?? {}, [s]), [l, g] = I(e.listing), [y, b] = I(e.comments), [S, C] = I({});
|
|
68
|
+
N(() => {
|
|
69
|
+
g(e.listing), b(e.comments), C(O(c, e.attributes));
|
|
67
70
|
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
e.revision,
|
|
72
|
+
e.listing,
|
|
73
|
+
e.comments,
|
|
74
|
+
e.attributes,
|
|
75
|
+
c
|
|
73
76
|
]);
|
|
74
|
-
let [w,
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
title:
|
|
77
|
+
let [w, T] = I(null), [E, k] = I(!1), A = v("content.save", r.onError);
|
|
78
|
+
return /* @__PURE__ */ L(G, {
|
|
79
|
+
title: i("contentEditor.details"),
|
|
77
80
|
ckui: "content-details",
|
|
78
|
-
children: /* @__PURE__ */
|
|
81
|
+
children: /* @__PURE__ */ R("form", {
|
|
79
82
|
className: "grid gap-3",
|
|
80
|
-
onSubmit: (
|
|
81
|
-
|
|
82
|
-
let
|
|
83
|
+
onSubmit: (t) => {
|
|
84
|
+
t.preventDefault(), T(null), k(!1);
|
|
85
|
+
let n;
|
|
83
86
|
try {
|
|
84
|
-
|
|
87
|
+
n = x(c, S);
|
|
85
88
|
} catch (e) {
|
|
86
|
-
return
|
|
89
|
+
return T(e.message);
|
|
87
90
|
}
|
|
88
|
-
|
|
89
|
-
listing:
|
|
90
|
-
comments:
|
|
91
|
-
attributes:
|
|
92
|
-
revision:
|
|
93
|
-
})).then((e) => e &&
|
|
91
|
+
A.run(() => o.contents.update(e.id, {
|
|
92
|
+
listing: l,
|
|
93
|
+
comments: y,
|
|
94
|
+
attributes: n,
|
|
95
|
+
revision: e.revision
|
|
96
|
+
})).then((e) => e && k(!0));
|
|
94
97
|
},
|
|
95
98
|
children: [
|
|
96
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ R("div", {
|
|
97
100
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
98
|
-
children: [/* @__PURE__ */
|
|
99
|
-
value:
|
|
100
|
-
onValueChange: (e) =>
|
|
101
|
-
children: [/* @__PURE__ */
|
|
101
|
+
children: [/* @__PURE__ */ L(u, { children: i("contentEditor.listing") }), /* @__PURE__ */ R(d, {
|
|
102
|
+
value: l,
|
|
103
|
+
onValueChange: (e) => g(e),
|
|
104
|
+
children: [/* @__PURE__ */ L(m, {
|
|
102
105
|
size: "sm",
|
|
103
|
-
"aria-label":
|
|
104
|
-
children: /* @__PURE__ */
|
|
105
|
-
}), /* @__PURE__ */
|
|
106
|
+
"aria-label": i("contentEditor.listing"),
|
|
107
|
+
children: /* @__PURE__ */ L(h, { children: (e) => i(`contentEditor.listing_${e}`) })
|
|
108
|
+
}), /* @__PURE__ */ L(f, { children: V.map((e) => /* @__PURE__ */ L(p, {
|
|
106
109
|
value: e,
|
|
107
|
-
children:
|
|
110
|
+
children: i(`contentEditor.listing_${e}`)
|
|
108
111
|
}, e)) })]
|
|
109
112
|
})]
|
|
110
113
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ R("div", {
|
|
112
115
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
114
|
-
value:
|
|
115
|
-
onValueChange: (e) =>
|
|
116
|
-
children: [/* @__PURE__ */
|
|
116
|
+
children: [/* @__PURE__ */ L(u, { children: i("contentEditor.comments") }), /* @__PURE__ */ R(d, {
|
|
117
|
+
value: y,
|
|
118
|
+
onValueChange: (e) => b(e),
|
|
119
|
+
children: [/* @__PURE__ */ L(m, {
|
|
117
120
|
size: "sm",
|
|
118
|
-
"aria-label":
|
|
119
|
-
children: /* @__PURE__ */
|
|
120
|
-
}), /* @__PURE__ */
|
|
121
|
+
"aria-label": i("contentEditor.comments"),
|
|
122
|
+
children: /* @__PURE__ */ L(h, { children: (e) => i(`contentEditor.comments_${e}`) })
|
|
123
|
+
}), /* @__PURE__ */ L(f, { children: H.map((e) => /* @__PURE__ */ L(p, {
|
|
121
124
|
value: e,
|
|
122
|
-
children:
|
|
125
|
+
children: i(`contentEditor.comments_${e}`)
|
|
123
126
|
}, e)) })]
|
|
124
127
|
})]
|
|
125
128
|
}),
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
declared:
|
|
129
|
+
/* @__PURE__ */ L(D, {
|
|
130
|
+
declared: c,
|
|
128
131
|
form: S,
|
|
129
132
|
onChange: (e, t) => C((n) => ({
|
|
130
133
|
...n,
|
|
131
134
|
[e]: t
|
|
132
135
|
})),
|
|
133
|
-
labels:
|
|
136
|
+
labels: r.labels
|
|
134
137
|
}),
|
|
135
|
-
w && /* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
+
w && /* @__PURE__ */ L(_, { children: w }),
|
|
139
|
+
/* @__PURE__ */ L(_, { error: A.error }),
|
|
140
|
+
/* @__PURE__ */ R("div", {
|
|
138
141
|
className: "flex items-center gap-3",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
142
|
+
children: [/* @__PURE__ */ L(a, {
|
|
140
143
|
type: "submit",
|
|
141
144
|
size: "sm",
|
|
142
|
-
disabled:
|
|
143
|
-
children:
|
|
144
|
-
}), /* @__PURE__ */
|
|
145
|
+
disabled: A.pending,
|
|
146
|
+
children: A.pending ? i("common.saving") : i("common.save")
|
|
147
|
+
}), /* @__PURE__ */ L(K, { show: E })]
|
|
145
148
|
})
|
|
146
149
|
]
|
|
147
150
|
})
|
|
148
151
|
});
|
|
149
152
|
}
|
|
150
|
-
function
|
|
151
|
-
let { t:
|
|
152
|
-
...
|
|
153
|
-
...
|
|
154
|
-
}),
|
|
155
|
-
return /* @__PURE__ */
|
|
153
|
+
function Y({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, client: s }) {
|
|
154
|
+
let { t: c } = t(), g = P(), _ = r?.tiers ?? [], v = r?.kinds[i], x = Object.entries(r?.group_kinds ?? {}).filter(([, e]) => e.sellable || e.auth_scope).map(([e]) => e), [E, D] = I(), O = E ?? x[0] ?? "", k = T(e.group_id ? [e.group_id] : [], { client: s }), A = e.group_id ? k.get(e.group_id) : void 0, j = (t) => n({
|
|
155
|
+
...e,
|
|
156
|
+
...t
|
|
157
|
+
}), M = v?.presentation === "reader", N = !!v?.segments;
|
|
158
|
+
return /* @__PURE__ */ R("div", {
|
|
156
159
|
className: "grid gap-3",
|
|
157
160
|
"data-ckui": "rule-fields",
|
|
158
161
|
children: [
|
|
159
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ R("div", {
|
|
160
163
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
161
|
-
children: [/* @__PURE__ */
|
|
162
|
-
value:
|
|
163
|
-
onValueChange: (
|
|
164
|
-
let r =
|
|
164
|
+
children: [/* @__PURE__ */ L(u, { children: c("contentEditor.access") }), /* @__PURE__ */ R(d, {
|
|
165
|
+
value: e.level,
|
|
166
|
+
onValueChange: (t) => {
|
|
167
|
+
let r = t;
|
|
165
168
|
n({
|
|
166
169
|
level: r,
|
|
167
|
-
group_id:
|
|
168
|
-
preview:
|
|
169
|
-
free_after:
|
|
170
|
+
group_id: W(r) ? e.group_id || a : void 0,
|
|
171
|
+
preview: e.preview,
|
|
172
|
+
free_after: e.free_after
|
|
170
173
|
});
|
|
171
174
|
},
|
|
172
|
-
children: [/* @__PURE__ */
|
|
175
|
+
children: [/* @__PURE__ */ L(m, {
|
|
173
176
|
size: "sm",
|
|
174
|
-
"aria-label":
|
|
175
|
-
children: /* @__PURE__ */
|
|
176
|
-
}), /* @__PURE__ */
|
|
177
|
+
"aria-label": c("contentEditor.access"),
|
|
178
|
+
children: /* @__PURE__ */ L(h, { children: (e) => c(`contentEditor.level_${e}`) })
|
|
179
|
+
}), /* @__PURE__ */ L(f, { children: U.filter((e) => (e !== "tier" || _.length) && (!e.startsWith("group") || x.length)).map((e) => /* @__PURE__ */ L(p, {
|
|
177
180
|
value: e,
|
|
178
|
-
children:
|
|
181
|
+
children: c(`contentEditor.level_${e}`)
|
|
179
182
|
}, e)) })]
|
|
180
183
|
})]
|
|
181
184
|
}),
|
|
182
|
-
|
|
185
|
+
e.level === "tier" && /* @__PURE__ */ R("fieldset", {
|
|
183
186
|
className: "flex flex-wrap gap-3",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
187
|
+
children: [/* @__PURE__ */ L("legend", {
|
|
185
188
|
className: "sr-only",
|
|
186
|
-
children:
|
|
187
|
-
}),
|
|
189
|
+
children: c("contentEditor.tiers")
|
|
190
|
+
}), _.map((t) => /* @__PURE__ */ R("label", {
|
|
188
191
|
className: "flex items-center gap-2",
|
|
189
|
-
children: [/* @__PURE__ */
|
|
190
|
-
checked:
|
|
191
|
-
onCheckedChange: (n) =>
|
|
192
|
-
"aria-label":
|
|
193
|
-
}),
|
|
194
|
-
},
|
|
192
|
+
children: [/* @__PURE__ */ L(y, {
|
|
193
|
+
checked: e.tiers?.includes(t) ?? !1,
|
|
194
|
+
onCheckedChange: (n) => j({ tiers: n ? [...e.tiers ?? [], t] : (e.tiers ?? []).filter((e) => e !== t) }),
|
|
195
|
+
"aria-label": w(o, t)
|
|
196
|
+
}), w(o, t)]
|
|
197
|
+
}, t))]
|
|
195
198
|
}),
|
|
196
|
-
|
|
199
|
+
W(e.level) && /* @__PURE__ */ R("div", {
|
|
197
200
|
className: "flex flex-wrap items-end gap-2",
|
|
198
201
|
children: [
|
|
199
|
-
|
|
202
|
+
A || e.group_id ? /* @__PURE__ */ L("span", {
|
|
200
203
|
className: "rounded-md border border-border px-2 py-0.5",
|
|
201
204
|
"data-ckui": "rule-group",
|
|
202
|
-
children:
|
|
205
|
+
children: A ? A.name || A.slug : e.group_id
|
|
203
206
|
}) : null,
|
|
204
|
-
|
|
207
|
+
x.length > 1 && /* @__PURE__ */ R(d, {
|
|
205
208
|
value: O,
|
|
206
209
|
onValueChange: (e) => D(String(e)),
|
|
207
|
-
children: [/* @__PURE__ */
|
|
210
|
+
children: [/* @__PURE__ */ L(m, {
|
|
208
211
|
size: "sm",
|
|
209
|
-
"aria-label":
|
|
210
|
-
children: /* @__PURE__ */
|
|
211
|
-
}), /* @__PURE__ */
|
|
212
|
+
"aria-label": c("groupEditor.edgeKind"),
|
|
213
|
+
children: /* @__PURE__ */ L(h, { children: (e) => w(o, e) })
|
|
214
|
+
}), /* @__PURE__ */ L(f, { children: x.map((e) => /* @__PURE__ */ L(p, {
|
|
212
215
|
value: e,
|
|
213
|
-
children:
|
|
216
|
+
children: w(o, e)
|
|
214
217
|
}, e)) })]
|
|
215
218
|
}),
|
|
216
|
-
O && /* @__PURE__ */
|
|
219
|
+
O && /* @__PURE__ */ L(C, {
|
|
217
220
|
kind: O,
|
|
218
|
-
label:
|
|
219
|
-
client:
|
|
220
|
-
onPick: (e) =>
|
|
221
|
+
label: c("contentEditor.group"),
|
|
222
|
+
client: s,
|
|
223
|
+
onPick: (e) => j({ group_id: e.id })
|
|
221
224
|
}, O)
|
|
222
225
|
]
|
|
223
226
|
}),
|
|
224
|
-
|
|
227
|
+
e.level !== "public" && /* @__PURE__ */ R("div", {
|
|
225
228
|
className: "grid gap-3 sm:grid-cols-3",
|
|
226
229
|
children: [
|
|
227
|
-
|
|
230
|
+
M && /* @__PURE__ */ R("div", {
|
|
228
231
|
className: "grid gap-1.5",
|
|
229
|
-
children: [/* @__PURE__ */
|
|
230
|
-
htmlFor: `${
|
|
231
|
-
children:
|
|
232
|
-
}), /* @__PURE__ */
|
|
233
|
-
id: `${
|
|
232
|
+
children: [/* @__PURE__ */ L(u, {
|
|
233
|
+
htmlFor: `${g}-pages`,
|
|
234
|
+
children: c("contentEditor.previewPages")
|
|
235
|
+
}), /* @__PURE__ */ L(l, {
|
|
236
|
+
id: `${g}-pages`,
|
|
234
237
|
className: "h-8",
|
|
235
238
|
type: "number",
|
|
236
239
|
min: 0,
|
|
237
|
-
value:
|
|
238
|
-
onChange: (
|
|
239
|
-
...
|
|
240
|
-
pages:
|
|
240
|
+
value: e.preview?.pages ?? "",
|
|
241
|
+
onChange: (t) => j({ preview: {
|
|
242
|
+
...e.preview,
|
|
243
|
+
pages: t.target.value ? Math.max(0, Math.trunc(Number(t.target.value))) : void 0
|
|
241
244
|
} })
|
|
242
245
|
})]
|
|
243
246
|
}),
|
|
244
|
-
|
|
247
|
+
N && /* @__PURE__ */ R("div", {
|
|
245
248
|
className: "grid gap-1.5",
|
|
246
|
-
children: [/* @__PURE__ */
|
|
247
|
-
htmlFor: `${
|
|
248
|
-
children:
|
|
249
|
-
}), /* @__PURE__ */
|
|
250
|
-
id: `${
|
|
249
|
+
children: [/* @__PURE__ */ L(u, {
|
|
250
|
+
htmlFor: `${g}-segments`,
|
|
251
|
+
children: c("contentEditor.previewSegments")
|
|
252
|
+
}), /* @__PURE__ */ L(l, {
|
|
253
|
+
id: `${g}-segments`,
|
|
251
254
|
className: "h-8",
|
|
252
255
|
type: "number",
|
|
253
256
|
min: 0,
|
|
254
|
-
value:
|
|
255
|
-
onChange: (
|
|
256
|
-
...
|
|
257
|
-
segments:
|
|
257
|
+
value: e.preview?.segments ?? "",
|
|
258
|
+
onChange: (t) => j({ preview: {
|
|
259
|
+
...e.preview,
|
|
260
|
+
segments: t.target.value ? Math.max(0, Math.trunc(Number(t.target.value))) : void 0
|
|
258
261
|
} })
|
|
259
262
|
})]
|
|
260
263
|
}),
|
|
261
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ R("div", {
|
|
262
265
|
className: "grid gap-1.5",
|
|
263
|
-
children: [/* @__PURE__ */
|
|
264
|
-
htmlFor: `${
|
|
265
|
-
children:
|
|
266
|
-
}), /* @__PURE__ */
|
|
267
|
-
id: `${
|
|
266
|
+
children: [/* @__PURE__ */ L(u, {
|
|
267
|
+
htmlFor: `${g}-free`,
|
|
268
|
+
children: c("contentEditor.freeAfter")
|
|
269
|
+
}), /* @__PURE__ */ L(l, {
|
|
270
|
+
id: `${g}-free`,
|
|
268
271
|
className: "h-8",
|
|
269
272
|
type: "datetime-local",
|
|
270
|
-
value:
|
|
271
|
-
onChange: (e) =>
|
|
273
|
+
value: S(e.free_after),
|
|
274
|
+
onChange: (e) => j({ free_after: b(e.target.value) })
|
|
272
275
|
})]
|
|
273
276
|
})
|
|
274
277
|
]
|
|
@@ -276,8 +279,8 @@ function G({ value: t, onChange: n, model: r, kind: i, owner: a, labels: p, clie
|
|
|
276
279
|
]
|
|
277
280
|
});
|
|
278
281
|
}
|
|
279
|
-
var
|
|
280
|
-
function
|
|
282
|
+
var X = (e) => !W(e.level) || !!e.group_id;
|
|
283
|
+
function Z(e) {
|
|
281
284
|
let t = e.preview && (e.preview.pages || e.preview.segments) ? {
|
|
282
285
|
pages: e.preview.pages || void 0,
|
|
283
286
|
segments: e.preview.segments || void 0
|
|
@@ -290,430 +293,455 @@ function q(e) {
|
|
|
290
293
|
free_after: e.level === "public" ? void 0 : e.free_after
|
|
291
294
|
};
|
|
292
295
|
}
|
|
293
|
-
function
|
|
294
|
-
let { t:
|
|
295
|
-
|
|
296
|
-
let [u, d] =
|
|
297
|
-
return /* @__PURE__ */
|
|
298
|
-
title:
|
|
296
|
+
function ee({ content: e, ...r }) {
|
|
297
|
+
let { t: i } = t(), o = n(r.client), { model: s } = q(e.kind, r.client), [c, l] = I(e.access);
|
|
298
|
+
N(() => l(e.access), [e.revision, e.access]);
|
|
299
|
+
let [u, d] = I(!1), f = v("content.save", r.onError), p = v("offer.save", r.onError);
|
|
300
|
+
return /* @__PURE__ */ R(G, {
|
|
301
|
+
title: i("contentEditor.accessTitle"),
|
|
299
302
|
ckui: "access-editor",
|
|
300
303
|
children: [
|
|
301
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ R("form", {
|
|
302
305
|
className: "grid gap-3",
|
|
303
|
-
onSubmit: (
|
|
304
|
-
|
|
305
|
-
access:
|
|
306
|
-
revision:
|
|
306
|
+
onSubmit: (t) => {
|
|
307
|
+
t.preventDefault(), d(!1), f.run(() => o.contents.update(e.id, {
|
|
308
|
+
access: Z(c),
|
|
309
|
+
revision: e.revision
|
|
307
310
|
})).then((e) => e && d(!0));
|
|
308
311
|
},
|
|
309
312
|
children: [
|
|
310
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ L(Y, {
|
|
311
314
|
value: c,
|
|
312
315
|
onChange: l,
|
|
313
316
|
model: s,
|
|
314
|
-
kind:
|
|
315
|
-
owner:
|
|
316
|
-
labels:
|
|
317
|
+
kind: e.kind,
|
|
318
|
+
owner: e.owner_group_id,
|
|
319
|
+
labels: r.labels,
|
|
317
320
|
client: o
|
|
318
321
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
/* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ L(_, { error: f.error }),
|
|
323
|
+
/* @__PURE__ */ R("div", {
|
|
321
324
|
className: "flex items-center gap-3",
|
|
322
|
-
children: [/* @__PURE__ */
|
|
325
|
+
children: [/* @__PURE__ */ L(a, {
|
|
323
326
|
type: "submit",
|
|
324
327
|
size: "sm",
|
|
325
|
-
disabled: f.pending || !
|
|
326
|
-
children: f.pending ?
|
|
327
|
-
}), /* @__PURE__ */
|
|
328
|
+
disabled: f.pending || !X(c),
|
|
329
|
+
children: f.pending ? i("common.saving") : i("common.save")
|
|
330
|
+
}), /* @__PURE__ */ L(K, { show: u })]
|
|
328
331
|
})
|
|
329
332
|
]
|
|
330
333
|
}),
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
offer:
|
|
333
|
-
pending:
|
|
334
|
-
onSell: (
|
|
335
|
-
onWithdraw: () => void
|
|
334
|
+
/* @__PURE__ */ L(E, {
|
|
335
|
+
offer: e.offer,
|
|
336
|
+
pending: p.pending,
|
|
337
|
+
onSell: (t) => void p.run(() => o.offers.sell({ content: e.id }, t)),
|
|
338
|
+
onWithdraw: () => void p.run(() => o.offers.withdraw({ content: e.id }))
|
|
336
339
|
}),
|
|
337
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ L(_, { error: p.error })
|
|
338
341
|
]
|
|
339
342
|
});
|
|
340
343
|
}
|
|
341
|
-
function
|
|
342
|
-
return e.label || [...e.languages.map(t), ...e.traits.map((e) =>
|
|
344
|
+
function Q(e, t, n) {
|
|
345
|
+
return e.label || [...e.languages.map(t), ...e.traits.map((e) => w(n, e))].join(" · ");
|
|
343
346
|
}
|
|
344
|
-
function
|
|
345
|
-
let { t: l } =
|
|
346
|
-
if (!
|
|
347
|
-
if (
|
|
347
|
+
function te({ content: r, media: i = !0, ...s }) {
|
|
348
|
+
let { t: l } = t(), u = n(s.client), d = e(), { model: f, spec: p } = q(r.kind, s.client), m = v("content.save", s.onError), h = v("content.save", s.onError), [g, y] = I(null), b = F(() => [...r.versions].sort((e, t) => e.position - t.position), [r.versions]);
|
|
349
|
+
if (!p) return null;
|
|
350
|
+
if (p.versions.hidden) {
|
|
348
351
|
let e = b[0];
|
|
349
|
-
return !e || !
|
|
352
|
+
return !e || !i && !p.segments ? null : /* @__PURE__ */ R(G, {
|
|
350
353
|
title: l("contentEditor.media"),
|
|
351
354
|
ckui: "version-media",
|
|
352
|
-
children: [
|
|
353
|
-
content:
|
|
355
|
+
children: [p.segments && /* @__PURE__ */ L($, {
|
|
356
|
+
content: r,
|
|
354
357
|
version: e,
|
|
355
|
-
...
|
|
356
|
-
}),
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
},
|
|
362
|
-
label: l("contentEditor.media")
|
|
358
|
+
...s
|
|
359
|
+
}), i && /* @__PURE__ */ L(ae, {
|
|
360
|
+
content: r,
|
|
361
|
+
version: e,
|
|
362
|
+
model: f,
|
|
363
|
+
...s
|
|
363
364
|
})]
|
|
364
365
|
});
|
|
365
366
|
}
|
|
366
367
|
let x = f?.languages ?? [];
|
|
367
|
-
return /* @__PURE__ */
|
|
368
|
+
return /* @__PURE__ */ R(G, {
|
|
368
369
|
title: l("contentEditor.versions"),
|
|
369
370
|
ckui: "versions-editor",
|
|
370
371
|
children: [
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ L(o, {
|
|
372
373
|
items: b,
|
|
373
374
|
id: (e) => e.id,
|
|
374
|
-
name: (e) =>
|
|
375
|
+
name: (e) => Q(e, d, s.labels),
|
|
375
376
|
label: l("contentEditor.versions"),
|
|
376
|
-
disabled:
|
|
377
|
+
disabled: m.pending || b.length < 2,
|
|
377
378
|
onMove: (e, t) => {
|
|
378
|
-
let n = b.map((e) => e.id), [
|
|
379
|
-
n.splice(t, 0,
|
|
379
|
+
let n = b.map((e) => e.id), [i] = n.splice(e, 1);
|
|
380
|
+
n.splice(t, 0, i), m.run(() => u.contents.orderVersions(r.id, n));
|
|
380
381
|
},
|
|
381
|
-
children: (e, t) => /* @__PURE__ */
|
|
382
|
+
children: (e, t) => /* @__PURE__ */ R("div", {
|
|
382
383
|
className: "grid gap-2 rounded-md border border-border p-2",
|
|
383
384
|
"data-ckui": "version-row",
|
|
384
385
|
"data-version": e.id,
|
|
385
|
-
children: [/* @__PURE__ */
|
|
386
|
+
children: [/* @__PURE__ */ R("div", {
|
|
386
387
|
className: "flex flex-wrap items-center gap-2",
|
|
387
388
|
children: [
|
|
388
389
|
b.length > 1 && t,
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ L("span", {
|
|
390
391
|
className: "min-w-0 flex-1 font-medium break-words",
|
|
391
|
-
children:
|
|
392
|
+
children: Q(e, d, s.labels)
|
|
392
393
|
}),
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ L(c, {
|
|
394
395
|
variant: e.live ? "default" : "outline",
|
|
395
396
|
children: l(e.live ? "contentEditor.live" : e.state === "draft" ? "contentManager.draft" : "contentManager.scheduled")
|
|
396
397
|
}),
|
|
397
|
-
e.access && /* @__PURE__ */
|
|
398
|
+
e.access && /* @__PURE__ */ L(c, {
|
|
398
399
|
variant: "secondary",
|
|
399
400
|
children: l(`contentEditor.level_${e.access.level}`)
|
|
400
401
|
}),
|
|
401
|
-
e.pages ? /* @__PURE__ */
|
|
402
|
+
e.pages ? /* @__PURE__ */ L("span", {
|
|
402
403
|
className: "text-xs text-muted-foreground",
|
|
403
404
|
children: l("contentEditor.pageCount", { count: e.pages })
|
|
404
405
|
}) : null,
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ L(a, {
|
|
406
407
|
type: "button",
|
|
407
408
|
size: "xs",
|
|
408
409
|
variant: "ghost",
|
|
409
|
-
"aria-expanded":
|
|
410
|
-
onClick: () => y(
|
|
411
|
-
children: l(
|
|
410
|
+
"aria-expanded": g === e.id,
|
|
411
|
+
onClick: () => y(g === e.id ? null : e.id),
|
|
412
|
+
children: l(g === e.id ? "contentEditor.close" : "contentEditor.edit")
|
|
412
413
|
})
|
|
413
414
|
]
|
|
414
|
-
}),
|
|
415
|
-
content:
|
|
415
|
+
}), g === e.id && /* @__PURE__ */ L(ie, {
|
|
416
|
+
content: r,
|
|
416
417
|
version: e,
|
|
417
418
|
model: f,
|
|
418
|
-
media:
|
|
419
|
-
...
|
|
419
|
+
media: i,
|
|
420
|
+
...s
|
|
420
421
|
})]
|
|
421
422
|
})
|
|
422
423
|
}),
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ L(_, { error: m.error }),
|
|
425
|
+
/* @__PURE__ */ L(re, {
|
|
425
426
|
languages: x,
|
|
426
|
-
many:
|
|
427
|
-
pending:
|
|
428
|
-
onAdd: (e) => void
|
|
427
|
+
many: p?.versions.languages === "many",
|
|
428
|
+
pending: h.pending,
|
|
429
|
+
onAdd: (e) => void h.run(() => u.contents.addVersion(r.id, e)).then((e) => e && y(e.id))
|
|
429
430
|
}),
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ L(_, { error: h.error })
|
|
431
432
|
]
|
|
432
433
|
});
|
|
433
434
|
}
|
|
434
|
-
function
|
|
435
|
-
let { t:
|
|
436
|
-
return
|
|
435
|
+
function ne({ languages: n, value: r, many: i, onChange: a }) {
|
|
436
|
+
let { t: o } = t(), s = e();
|
|
437
|
+
return i ? /* @__PURE__ */ R("fieldset", {
|
|
437
438
|
className: "flex flex-wrap gap-3",
|
|
438
|
-
children: [/* @__PURE__ */
|
|
439
|
+
children: [/* @__PURE__ */ L("legend", {
|
|
439
440
|
className: "sr-only",
|
|
440
|
-
children:
|
|
441
|
-
}),
|
|
441
|
+
children: o("contentEditor.versionLanguages")
|
|
442
|
+
}), n.map((e) => /* @__PURE__ */ R("label", {
|
|
442
443
|
className: "flex items-center gap-1.5",
|
|
443
|
-
children: [/* @__PURE__ */
|
|
444
|
+
children: [/* @__PURE__ */ L(y, {
|
|
444
445
|
size: "sm",
|
|
445
|
-
checked:
|
|
446
|
-
onCheckedChange: (t) =>
|
|
447
|
-
"aria-label":
|
|
448
|
-
}),
|
|
446
|
+
checked: r.includes(e),
|
|
447
|
+
onCheckedChange: (t) => a(t ? [...r, e] : r.filter((t) => t !== e)),
|
|
448
|
+
"aria-label": s(e)
|
|
449
|
+
}), s(e)]
|
|
449
450
|
}, e))]
|
|
450
|
-
}) : /* @__PURE__ */
|
|
451
|
-
value:
|
|
452
|
-
onValueChange: (e) =>
|
|
453
|
-
children: [/* @__PURE__ */
|
|
451
|
+
}) : /* @__PURE__ */ R(d, {
|
|
452
|
+
value: r[0] ?? B,
|
|
453
|
+
onValueChange: (e) => a(e === B ? [] : [String(e)]),
|
|
454
|
+
children: [/* @__PURE__ */ L(m, {
|
|
454
455
|
size: "sm",
|
|
455
|
-
"aria-label":
|
|
456
|
-
children: /* @__PURE__ */
|
|
457
|
-
}), /* @__PURE__ */
|
|
456
|
+
"aria-label": o("contentEditor.versionLanguage"),
|
|
457
|
+
children: /* @__PURE__ */ L(h, { children: (e) => e === B ? o("contentEditor.chooseLanguage") : s(e) })
|
|
458
|
+
}), /* @__PURE__ */ L(f, { children: n.map((e) => /* @__PURE__ */ L(p, {
|
|
458
459
|
value: e,
|
|
459
|
-
children:
|
|
460
|
+
children: s(e)
|
|
460
461
|
}, e)) })]
|
|
461
462
|
});
|
|
462
463
|
}
|
|
463
|
-
function
|
|
464
|
-
let { t: o } =
|
|
465
|
-
return /* @__PURE__ */
|
|
464
|
+
function re({ languages: e, many: n, pending: r, onAdd: i }) {
|
|
465
|
+
let { t: o } = t(), [s, c] = I([]);
|
|
466
|
+
return /* @__PURE__ */ R("div", {
|
|
466
467
|
className: "flex flex-wrap items-center gap-2",
|
|
467
468
|
"data-ckui": "add-version",
|
|
468
|
-
children: [/* @__PURE__ */
|
|
469
|
-
languages:
|
|
469
|
+
children: [/* @__PURE__ */ L(ne, {
|
|
470
|
+
languages: e,
|
|
470
471
|
value: s,
|
|
471
|
-
many:
|
|
472
|
+
many: n,
|
|
472
473
|
onChange: c
|
|
473
|
-
}), /* @__PURE__ */
|
|
474
|
+
}), /* @__PURE__ */ L(a, {
|
|
474
475
|
type: "button",
|
|
475
476
|
size: "sm",
|
|
476
477
|
variant: "outline",
|
|
477
|
-
disabled:
|
|
478
|
+
disabled: r || !s.length,
|
|
478
479
|
onClick: () => {
|
|
479
|
-
|
|
480
|
+
i({ languages: s }), c([]);
|
|
480
481
|
},
|
|
481
482
|
children: o("contentEditor.addVersion")
|
|
482
483
|
})]
|
|
483
484
|
});
|
|
484
485
|
}
|
|
485
|
-
function
|
|
486
|
-
let { t:
|
|
487
|
-
return /* @__PURE__ */
|
|
486
|
+
function ie({ content: e, version: r, model: i, media: o, ...s }) {
|
|
487
|
+
let { t: c } = t(), d = P(), f = n(s.client), p = i?.kinds[e.kind], [m, h] = I(r.languages), [g, x] = I(r.traits), [C, T] = I(r.label ?? ""), [D, O] = I(r.state === "draft"), [k, j] = I(S(r.publish_at)), [M, N] = I(!!r.access), [F, z] = I(r.access ?? e.access), [B, V] = I(!1), H = v("content.save", s.onError), U = v("content.save", s.onError), W = v("offer.save", s.onError);
|
|
488
|
+
return /* @__PURE__ */ R("div", {
|
|
488
489
|
className: "grid gap-4 pt-2",
|
|
489
490
|
children: [
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ R("form", {
|
|
491
492
|
className: "grid gap-3",
|
|
492
|
-
onSubmit: (
|
|
493
|
-
|
|
494
|
-
languages:
|
|
495
|
-
traits:
|
|
496
|
-
label:
|
|
497
|
-
state:
|
|
498
|
-
publish_at:
|
|
499
|
-
...
|
|
500
|
-
})).then((e) => e &&
|
|
493
|
+
onSubmit: (t) => {
|
|
494
|
+
t.preventDefault(), V(!1), H.run(() => f.contents.updateVersion(e.id, r.id, {
|
|
495
|
+
languages: m,
|
|
496
|
+
traits: g,
|
|
497
|
+
label: C.trim(),
|
|
498
|
+
state: D ? "draft" : "published",
|
|
499
|
+
publish_at: b(k),
|
|
500
|
+
...M ? { access: Z(F) } : { clear_access: !!r.access }
|
|
501
|
+
})).then((e) => e && V(!0));
|
|
501
502
|
},
|
|
502
503
|
children: [
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
languages:
|
|
505
|
-
value:
|
|
506
|
-
many:
|
|
507
|
-
onChange:
|
|
504
|
+
/* @__PURE__ */ L(ne, {
|
|
505
|
+
languages: i?.languages ?? [],
|
|
506
|
+
value: m,
|
|
507
|
+
many: p?.versions.languages === "many",
|
|
508
|
+
onChange: h
|
|
508
509
|
}),
|
|
509
|
-
!!
|
|
510
|
+
!!p?.versions.traits?.length && /* @__PURE__ */ R("fieldset", {
|
|
510
511
|
className: "flex flex-wrap gap-3",
|
|
511
|
-
children: [/* @__PURE__ */
|
|
512
|
+
children: [/* @__PURE__ */ L("legend", {
|
|
512
513
|
className: "sr-only",
|
|
513
|
-
children:
|
|
514
|
-
}),
|
|
514
|
+
children: c("contentEditor.traits")
|
|
515
|
+
}), p.versions.traits.map((e) => /* @__PURE__ */ R("label", {
|
|
515
516
|
className: "flex items-center gap-1.5",
|
|
516
|
-
children: [/* @__PURE__ */
|
|
517
|
+
children: [/* @__PURE__ */ L(y, {
|
|
517
518
|
size: "sm",
|
|
518
|
-
checked:
|
|
519
|
-
onCheckedChange: (t) =>
|
|
520
|
-
"aria-label":
|
|
521
|
-
}),
|
|
519
|
+
checked: g.includes(e),
|
|
520
|
+
onCheckedChange: (t) => x(t ? [...g, e] : g.filter((t) => t !== e)),
|
|
521
|
+
"aria-label": w(s.labels, e)
|
|
522
|
+
}), w(s.labels, e)]
|
|
522
523
|
}, e))]
|
|
523
524
|
}),
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ R("div", {
|
|
525
526
|
className: "grid gap-3 sm:grid-cols-2",
|
|
526
|
-
children: [/* @__PURE__ */
|
|
527
|
+
children: [/* @__PURE__ */ R("div", {
|
|
527
528
|
className: "grid gap-1.5",
|
|
528
|
-
children: [/* @__PURE__ */
|
|
529
|
-
htmlFor: `${
|
|
530
|
-
children:
|
|
531
|
-
}), /* @__PURE__ */
|
|
532
|
-
id: `${
|
|
529
|
+
children: [/* @__PURE__ */ L(u, {
|
|
530
|
+
htmlFor: `${d}-label`,
|
|
531
|
+
children: c("contentEditor.versionLabel")
|
|
532
|
+
}), /* @__PURE__ */ L(l, {
|
|
533
|
+
id: `${d}-label`,
|
|
533
534
|
className: "h-8",
|
|
534
|
-
value:
|
|
535
|
-
onChange: (e) =>
|
|
535
|
+
value: C,
|
|
536
|
+
onChange: (e) => T(e.target.value)
|
|
536
537
|
})]
|
|
537
|
-
}), /* @__PURE__ */
|
|
538
|
+
}), /* @__PURE__ */ R("div", {
|
|
538
539
|
className: "grid gap-1.5",
|
|
539
|
-
children: [/* @__PURE__ */
|
|
540
|
-
htmlFor: `${
|
|
541
|
-
children:
|
|
542
|
-
}), /* @__PURE__ */
|
|
543
|
-
id: `${
|
|
540
|
+
children: [/* @__PURE__ */ L(u, {
|
|
541
|
+
htmlFor: `${d}-at`,
|
|
542
|
+
children: c("contentEditor.versionPublishAt")
|
|
543
|
+
}), /* @__PURE__ */ L(l, {
|
|
544
|
+
id: `${d}-at`,
|
|
544
545
|
className: "h-8",
|
|
545
546
|
type: "datetime-local",
|
|
546
|
-
value:
|
|
547
|
-
onChange: (e) =>
|
|
547
|
+
value: k,
|
|
548
|
+
onChange: (e) => j(e.target.value)
|
|
548
549
|
})]
|
|
549
550
|
})]
|
|
550
551
|
}),
|
|
551
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ R("label", {
|
|
552
553
|
className: "flex items-center gap-2",
|
|
553
|
-
children: [/* @__PURE__ */
|
|
554
|
+
children: [/* @__PURE__ */ L(y, {
|
|
554
555
|
size: "sm",
|
|
555
|
-
checked:
|
|
556
|
-
onCheckedChange:
|
|
557
|
-
}),
|
|
556
|
+
checked: D,
|
|
557
|
+
onCheckedChange: O
|
|
558
|
+
}), c("contentEditor.versionDraft")]
|
|
558
559
|
}),
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ R("label", {
|
|
560
561
|
className: "flex items-center gap-2",
|
|
561
|
-
children: [/* @__PURE__ */
|
|
562
|
+
children: [/* @__PURE__ */ L(y, {
|
|
562
563
|
size: "sm",
|
|
563
|
-
checked:
|
|
564
|
-
onCheckedChange:
|
|
565
|
-
}),
|
|
564
|
+
checked: M,
|
|
565
|
+
onCheckedChange: N
|
|
566
|
+
}), c("contentEditor.ownAccess")]
|
|
566
567
|
}),
|
|
567
|
-
|
|
568
|
-
value:
|
|
569
|
-
onChange:
|
|
570
|
-
model:
|
|
571
|
-
kind:
|
|
572
|
-
owner:
|
|
573
|
-
labels:
|
|
574
|
-
client:
|
|
568
|
+
M && /* @__PURE__ */ L(Y, {
|
|
569
|
+
value: F,
|
|
570
|
+
onChange: z,
|
|
571
|
+
model: i,
|
|
572
|
+
kind: e.kind,
|
|
573
|
+
owner: e.owner_group_id,
|
|
574
|
+
labels: s.labels,
|
|
575
|
+
client: f
|
|
575
576
|
}),
|
|
576
|
-
/* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
577
|
+
/* @__PURE__ */ L(_, { error: H.error }),
|
|
578
|
+
/* @__PURE__ */ R("div", {
|
|
578
579
|
className: "flex flex-wrap items-center gap-3",
|
|
579
580
|
children: [
|
|
580
|
-
/* @__PURE__ */
|
|
581
|
+
/* @__PURE__ */ L(a, {
|
|
581
582
|
type: "submit",
|
|
582
583
|
size: "sm",
|
|
583
|
-
disabled:
|
|
584
|
-
children:
|
|
584
|
+
disabled: H.pending || !m.length || M && !X(F),
|
|
585
|
+
children: H.pending ? c("common.saving") : c("common.save")
|
|
585
586
|
}),
|
|
586
|
-
/* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ L(K, { show: B }),
|
|
588
|
+
/* @__PURE__ */ L(a, {
|
|
588
589
|
type: "button",
|
|
589
590
|
size: "sm",
|
|
590
591
|
variant: "destructive",
|
|
591
592
|
className: "ms-auto",
|
|
592
|
-
disabled:
|
|
593
|
-
onClick: () => void
|
|
594
|
-
children:
|
|
593
|
+
disabled: U.pending,
|
|
594
|
+
onClick: () => void U.run(() => f.contents.removeVersion(e.id, r.id)),
|
|
595
|
+
children: c("contentEditor.deleteVersion")
|
|
595
596
|
})
|
|
596
597
|
]
|
|
597
598
|
}),
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ L(_, { error: U.error })
|
|
599
600
|
]
|
|
600
601
|
}),
|
|
601
|
-
/* @__PURE__ */
|
|
602
|
-
offer:
|
|
603
|
-
pending:
|
|
604
|
-
onSell: (
|
|
605
|
-
content:
|
|
606
|
-
version:
|
|
607
|
-
},
|
|
608
|
-
onWithdraw: () => void
|
|
609
|
-
content:
|
|
610
|
-
version:
|
|
602
|
+
/* @__PURE__ */ L(E, {
|
|
603
|
+
offer: r.offer,
|
|
604
|
+
pending: W.pending,
|
|
605
|
+
onSell: (t) => void W.run(() => f.offers.sell({
|
|
606
|
+
content: e.id,
|
|
607
|
+
version: r.id
|
|
608
|
+
}, t)),
|
|
609
|
+
onWithdraw: () => void W.run(() => f.offers.withdraw({
|
|
610
|
+
content: e.id,
|
|
611
|
+
version: r.id
|
|
611
612
|
}))
|
|
612
613
|
}),
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
|
|
615
|
-
content:
|
|
616
|
-
version:
|
|
617
|
-
...
|
|
614
|
+
/* @__PURE__ */ L(_, { error: W.error }),
|
|
615
|
+
p?.segments && /* @__PURE__ */ L($, {
|
|
616
|
+
content: e,
|
|
617
|
+
version: r,
|
|
618
|
+
...s
|
|
618
619
|
}),
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
},
|
|
625
|
-
label: d("contentEditor.media")
|
|
620
|
+
o && /* @__PURE__ */ L(ae, {
|
|
621
|
+
content: e,
|
|
622
|
+
version: r,
|
|
623
|
+
model: i,
|
|
624
|
+
...s
|
|
626
625
|
}),
|
|
627
|
-
|
|
628
|
-
content:
|
|
629
|
-
version:
|
|
630
|
-
client:
|
|
631
|
-
onError:
|
|
626
|
+
o && p?.presentation === "reader" && /* @__PURE__ */ L(A, {
|
|
627
|
+
content: e.id,
|
|
628
|
+
version: r.id,
|
|
629
|
+
client: s.client,
|
|
630
|
+
onError: s.onError
|
|
632
631
|
})
|
|
633
632
|
]
|
|
634
633
|
});
|
|
635
634
|
}
|
|
636
|
-
function
|
|
637
|
-
let { t:
|
|
635
|
+
function ae({ content: n, version: r, model: a, ...o }) {
|
|
636
|
+
let { t: c } = t(), l = e(), u = F(() => ({
|
|
637
|
+
kind: n.kind,
|
|
638
|
+
id: n.id,
|
|
639
|
+
version: r.id
|
|
640
|
+
}), [
|
|
641
|
+
n.kind,
|
|
642
|
+
n.id,
|
|
643
|
+
r.id
|
|
644
|
+
]), d = i(u, {
|
|
645
|
+
editor: !0,
|
|
646
|
+
client: o.client
|
|
647
|
+
}), f = F(() => (a?.languages ?? []).map((e) => ({
|
|
648
|
+
value: e,
|
|
649
|
+
label: l(e)
|
|
650
|
+
})), [a, l]);
|
|
651
|
+
return !d.read && d.loading ? /* @__PURE__ */ L(g, { className: "h-24 w-full" }) : d.read?.uploads && M(d.read.uploads).source ? /* @__PURE__ */ L(j, {
|
|
652
|
+
item: u,
|
|
653
|
+
languages: f,
|
|
654
|
+
client: o.client,
|
|
655
|
+
onError: o.onError
|
|
656
|
+
}) : /* @__PURE__ */ L(s, {
|
|
657
|
+
item: u,
|
|
658
|
+
commit: r.live ? "manual" : "auto",
|
|
659
|
+
label: c("contentEditor.media"),
|
|
660
|
+
client: o.client,
|
|
661
|
+
onError: o.onError
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
function $({ content: e, version: r, ...i }) {
|
|
665
|
+
let { t: o } = t(), s = n(i.client), c = () => r.segments.map((e) => ({
|
|
638
666
|
title: e.title ?? "",
|
|
639
667
|
start: String(e.start),
|
|
640
668
|
end: String(e.end),
|
|
641
|
-
release:
|
|
642
|
-
})), [u, d] =
|
|
643
|
-
|
|
644
|
-
let [f,
|
|
645
|
-
|
|
669
|
+
release: S(e.release_at)
|
|
670
|
+
})), [u, d] = I(c);
|
|
671
|
+
N(() => d(c()), [JSON.stringify(r.segments)]);
|
|
672
|
+
let [f, p] = I(!1), m = v("content.save", i.onError), h = (e, t) => {
|
|
673
|
+
p(!1), d((n) => n.map((n, r) => r === e ? {
|
|
646
674
|
...n,
|
|
647
675
|
...t
|
|
648
676
|
} : n));
|
|
649
|
-
},
|
|
650
|
-
return /* @__PURE__ */
|
|
677
|
+
}, g = u.every((e) => /^\d+$/.test(e.start) && /^\d+$/.test(e.end) && Number(e.end) > Number(e.start));
|
|
678
|
+
return /* @__PURE__ */ R("div", {
|
|
651
679
|
className: "grid gap-2",
|
|
652
680
|
"data-ckui": "segments-editor",
|
|
653
681
|
children: [
|
|
654
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ L("h4", {
|
|
655
683
|
className: "text-sm font-medium",
|
|
656
|
-
children:
|
|
684
|
+
children: o("contentEditor.segments")
|
|
657
685
|
}),
|
|
658
|
-
u.length === 0 && /* @__PURE__ */
|
|
686
|
+
u.length === 0 && /* @__PURE__ */ L("p", {
|
|
659
687
|
className: "text-muted-foreground",
|
|
660
|
-
children:
|
|
688
|
+
children: o("contentEditor.noSegments")
|
|
661
689
|
}),
|
|
662
|
-
u.map((e, t) => /* @__PURE__ */
|
|
690
|
+
u.map((e, t) => /* @__PURE__ */ R("div", {
|
|
663
691
|
className: "flex flex-wrap items-center gap-2",
|
|
664
692
|
"data-ckui": "segment-row",
|
|
665
693
|
children: [
|
|
666
|
-
/* @__PURE__ */
|
|
694
|
+
/* @__PURE__ */ L("span", {
|
|
667
695
|
className: "w-6 text-xs text-muted-foreground tabular-nums",
|
|
668
696
|
children: t + 1
|
|
669
697
|
}),
|
|
670
|
-
/* @__PURE__ */
|
|
698
|
+
/* @__PURE__ */ L(l, {
|
|
671
699
|
className: "h-8 w-40",
|
|
672
|
-
"aria-label":
|
|
673
|
-
placeholder:
|
|
700
|
+
"aria-label": o("contentEditor.segmentTitle", { n: t + 1 }),
|
|
701
|
+
placeholder: o("contentEditor.segmentTitlePlaceholder"),
|
|
674
702
|
value: e.title,
|
|
675
|
-
onChange: (e) =>
|
|
703
|
+
onChange: (e) => h(t, { title: e.target.value })
|
|
676
704
|
}),
|
|
677
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ L(l, {
|
|
678
706
|
className: "h-8 w-20",
|
|
679
707
|
type: "number",
|
|
680
708
|
min: 0,
|
|
681
|
-
"aria-label":
|
|
709
|
+
"aria-label": o("contentEditor.segmentStart", { n: t + 1 }),
|
|
682
710
|
value: e.start,
|
|
683
|
-
onChange: (e) =>
|
|
711
|
+
onChange: (e) => h(t, { start: e.target.value })
|
|
684
712
|
}),
|
|
685
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ L("span", {
|
|
686
714
|
"aria-hidden": !0,
|
|
687
715
|
children: "–"
|
|
688
716
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
717
|
+
/* @__PURE__ */ L(l, {
|
|
690
718
|
className: "h-8 w-20",
|
|
691
719
|
type: "number",
|
|
692
720
|
min: 1,
|
|
693
|
-
"aria-label":
|
|
721
|
+
"aria-label": o("contentEditor.segmentEnd", { n: t + 1 }),
|
|
694
722
|
value: e.end,
|
|
695
|
-
onChange: (e) =>
|
|
723
|
+
onChange: (e) => h(t, { end: e.target.value })
|
|
696
724
|
}),
|
|
697
|
-
/* @__PURE__ */
|
|
725
|
+
/* @__PURE__ */ L(l, {
|
|
698
726
|
className: "h-8 w-48",
|
|
699
727
|
type: "datetime-local",
|
|
700
|
-
"aria-label":
|
|
728
|
+
"aria-label": o("contentEditor.segmentRelease", { n: t + 1 }),
|
|
701
729
|
value: e.release,
|
|
702
|
-
onChange: (e) =>
|
|
730
|
+
onChange: (e) => h(t, { release: e.target.value })
|
|
703
731
|
}),
|
|
704
|
-
/* @__PURE__ */
|
|
732
|
+
/* @__PURE__ */ L(a, {
|
|
705
733
|
type: "button",
|
|
706
734
|
size: "xs",
|
|
707
735
|
variant: "ghost",
|
|
708
736
|
onClick: () => d((e) => e.filter((e, n) => n !== t)),
|
|
709
|
-
children:
|
|
737
|
+
children: o("common.remove")
|
|
710
738
|
})
|
|
711
739
|
]
|
|
712
740
|
}, t)),
|
|
713
|
-
/* @__PURE__ */
|
|
741
|
+
/* @__PURE__ */ R("div", {
|
|
714
742
|
className: "flex flex-wrap items-center gap-2",
|
|
715
743
|
children: [
|
|
716
|
-
/* @__PURE__ */
|
|
744
|
+
/* @__PURE__ */ L(a, {
|
|
717
745
|
type: "button",
|
|
718
746
|
size: "sm",
|
|
719
747
|
variant: "outline",
|
|
@@ -726,74 +754,74 @@ function $({ content: r, version: i, ...a }) {
|
|
|
726
754
|
release: ""
|
|
727
755
|
}]);
|
|
728
756
|
},
|
|
729
|
-
children:
|
|
757
|
+
children: o("contentEditor.addSegment")
|
|
730
758
|
}),
|
|
731
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ L(a, {
|
|
732
760
|
type: "button",
|
|
733
761
|
size: "sm",
|
|
734
|
-
disabled:
|
|
762
|
+
disabled: m.pending || !g,
|
|
735
763
|
onClick: () => {
|
|
736
|
-
|
|
737
|
-
let
|
|
764
|
+
p(!1);
|
|
765
|
+
let t = u.map((e, t) => ({
|
|
738
766
|
position: t + 1,
|
|
739
767
|
title: e.title.trim() || void 0,
|
|
740
768
|
start: Number(e.start),
|
|
741
769
|
end: Number(e.end),
|
|
742
|
-
release_at:
|
|
770
|
+
release_at: b(e.release),
|
|
743
771
|
released: !1
|
|
744
772
|
}));
|
|
745
|
-
|
|
773
|
+
m.run(() => s.contents.setSegments(e.id, r.id, t)).then((e) => e && p(!0));
|
|
746
774
|
},
|
|
747
|
-
children:
|
|
775
|
+
children: o("contentEditor.saveSegments")
|
|
748
776
|
}),
|
|
749
|
-
/* @__PURE__ */
|
|
777
|
+
/* @__PURE__ */ L(K, { show: f })
|
|
750
778
|
]
|
|
751
779
|
}),
|
|
752
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ L(_, { error: m.error })
|
|
753
781
|
]
|
|
754
782
|
});
|
|
755
783
|
}
|
|
756
|
-
function
|
|
757
|
-
let
|
|
784
|
+
function oe({ content: t, ...n }) {
|
|
785
|
+
let r = e(), i = F(() => t.versions.map((e) => ({
|
|
758
786
|
id: e.id,
|
|
759
|
-
label:
|
|
787
|
+
label: Q(e, r, n.labels)
|
|
760
788
|
})), [
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
]), { spec:
|
|
765
|
-
return /* @__PURE__ */
|
|
766
|
-
className:
|
|
789
|
+
t.versions,
|
|
790
|
+
r,
|
|
791
|
+
n.labels
|
|
792
|
+
]), { spec: a } = q(t.kind, n.client);
|
|
793
|
+
return /* @__PURE__ */ R("div", {
|
|
794
|
+
className: z("grid gap-6", n.className),
|
|
767
795
|
"data-ckui": "content-sections",
|
|
768
796
|
children: [
|
|
769
|
-
/* @__PURE__ */
|
|
770
|
-
content:
|
|
771
|
-
...
|
|
797
|
+
/* @__PURE__ */ L(J, {
|
|
798
|
+
content: t,
|
|
799
|
+
...n
|
|
772
800
|
}),
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
content:
|
|
775
|
-
...
|
|
801
|
+
/* @__PURE__ */ L(ee, {
|
|
802
|
+
content: t,
|
|
803
|
+
...n
|
|
776
804
|
}),
|
|
777
|
-
/* @__PURE__ */
|
|
778
|
-
content:
|
|
779
|
-
...
|
|
805
|
+
/* @__PURE__ */ L(te, {
|
|
806
|
+
content: t,
|
|
807
|
+
...n
|
|
780
808
|
}),
|
|
781
|
-
!!
|
|
809
|
+
!!a?.groups?.length && /* @__PURE__ */ L("section", {
|
|
782
810
|
className: "grid gap-3 border-t border-border pt-4",
|
|
783
811
|
"data-ckui": "content-groups",
|
|
784
|
-
children: /* @__PURE__ */
|
|
785
|
-
content:
|
|
786
|
-
contentKind:
|
|
787
|
-
versions:
|
|
788
|
-
labels:
|
|
789
|
-
client:
|
|
790
|
-
onError:
|
|
812
|
+
children: /* @__PURE__ */ L(k, {
|
|
813
|
+
content: t.id,
|
|
814
|
+
contentKind: t.kind,
|
|
815
|
+
versions: a.versions.hidden ? void 0 : i,
|
|
816
|
+
labels: n.labels,
|
|
817
|
+
client: n.client,
|
|
818
|
+
onError: n.onError
|
|
791
819
|
})
|
|
792
820
|
})
|
|
793
821
|
]
|
|
794
822
|
});
|
|
795
823
|
}
|
|
796
824
|
//#endregion
|
|
797
|
-
export {
|
|
825
|
+
export { ee as AccessEditor, J as ContentDetailsEditor, oe as ContentSections, $ as SegmentsEditor, te as VersionsEditor, Q as versionLabel };
|
|
798
826
|
|
|
799
827
|
//# sourceMappingURL=editors.js.map
|