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