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