@openrails/contentkit-ui 0.103.1 → 0.104.0-rc.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 +105 -43
- package/dist/client/beacons.d.ts +3 -13
- package/dist/client/beacons.js +4 -45
- package/dist/client/beacons.js.map +1 -1
- package/dist/client/client.d.ts +3 -0
- package/dist/client/client.js +45 -43
- package/dist/client/client.js.map +1 -1
- package/dist/client/content/favorites.d.ts +2 -0
- package/dist/client/content/favorites.js.map +1 -1
- package/dist/client/content/types.d.ts +3 -0
- package/dist/client/content/types.js.map +1 -1
- package/dist/client/discovery.d.ts +28 -3
- package/dist/client/discovery.js +22 -1
- package/dist/client/discovery.js.map +1 -1
- package/dist/client/engagement.d.ts +70 -0
- package/dist/client/engagement.js +191 -0
- package/dist/client/engagement.js.map +1 -0
- package/dist/client/generated/routes.d.ts +35 -9
- package/dist/client/generated/routes.js +59 -2
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +53 -12
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/client/guest-reading-history.d.ts +40 -0
- package/dist/client/guest-reading-history.js +144 -0
- package/dist/client/guest-reading-history.js.map +1 -0
- package/dist/client/index.d.ts +4 -2
- package/dist/client/stats.d.ts +5 -5
- package/dist/client/stats.js.map +1 -1
- package/dist/client.js +24 -22
- package/dist/components/admin/content-manager.d.ts +1 -1
- package/dist/components/admin/content-manager.js +342 -302
- package/dist/components/admin/content-manager.js.map +1 -1
- package/dist/components/admin/page-review.js +106 -97
- package/dist/components/admin/page-review.js.map +1 -1
- package/dist/components/admin/quick-search.d.ts +14 -0
- package/dist/components/admin/quick-search.js +60 -0
- package/dist/components/admin/quick-search.js.map +1 -0
- package/dist/components/admin/reader-content-editor.d.ts +6 -0
- package/dist/components/admin/reader-content-editor.js +733 -0
- package/dist/components/admin/reader-content-editor.js.map +1 -0
- package/dist/components/admin/reader-manifest.js +120 -105
- package/dist/components/admin/reader-manifest.js.map +1 -1
- package/dist/components/admin/stats-dashboard.d.ts +4 -4
- package/dist/components/admin/stats-dashboard.js +132 -134
- package/dist/components/admin/stats-dashboard.js.map +1 -1
- package/dist/components/content/daily-releases.js +143 -191
- package/dist/components/content/daily-releases.js.map +1 -1
- package/dist/components/content/editor-save.d.ts +32 -0
- package/dist/components/content/editor-save.js +51 -0
- package/dist/components/content/editor-save.js.map +1 -0
- package/dist/components/content/editors.d.ts +17 -2
- package/dist/components/content/editors.js +359 -328
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/content/favorites.d.ts +6 -0
- package/dist/components/content/favorites.js +33 -0
- package/dist/components/content/favorites.js.map +1 -0
- package/dist/components/content/filter-dialog.js +19 -15
- package/dist/components/content/filter-dialog.js.map +1 -1
- package/dist/components/content/filters.d.ts +2 -0
- package/dist/components/content/filters.js +5 -1
- package/dist/components/content/filters.js.map +1 -1
- package/dist/components/content/grid.d.ts +34 -13
- package/dist/components/content/grid.js +300 -271
- package/dist/components/content/grid.js.map +1 -1
- package/dist/components/content/history.d.ts +6 -0
- package/dist/components/content/history.js +91 -0
- package/dist/components/content/history.js.map +1 -0
- package/dist/components/content/index.d.ts +1 -0
- package/dist/components/content/offer-fields.d.ts +1 -1
- package/dist/components/content/offer-fields.js +86 -64
- package/dist/components/content/offer-fields.js.map +1 -1
- package/dist/components/content/search.d.ts +11 -4
- package/dist/components/content/search.js +22 -11
- package/dist/components/content/search.js.map +1 -1
- package/dist/components/content/summary-tile.d.ts +14 -0
- package/dist/components/content/summary-tile.js +63 -0
- package/dist/components/content/summary-tile.js.map +1 -0
- package/dist/components/groups/memberships.d.ts +11 -1
- package/dist/components/groups/memberships.js +1 -1
- package/dist/components/groups/memberships.js.map +1 -1
- package/dist/components/media-folder-editor.d.ts +4 -0
- package/dist/components/media-folder-editor.js +178 -168
- package/dist/components/media-folder-editor.js.map +1 -1
- package/dist/components/video-mini-player.d.ts +4 -1
- package/dist/components/video-mini-player.js +77 -71
- package/dist/components/video-mini-player.js.map +1 -1
- package/dist/components/video-player.d.ts +4 -1
- package/dist/components/video-player.js +280 -276
- package/dist/components/video-player.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -14
- package/dist/locales/admin/de.js +33 -8
- package/dist/locales/admin/de.js.map +1 -1
- package/dist/locales/admin/en.d.ts +29 -4
- package/dist/locales/admin/en.js +33 -8
- package/dist/locales/admin/en.js.map +1 -1
- package/dist/locales/admin/es.js +33 -8
- package/dist/locales/admin/es.js.map +1 -1
- package/dist/locales/admin/ja.js +33 -8
- package/dist/locales/admin/ja.js.map +1 -1
- package/dist/locales/admin/ko.js +33 -8
- package/dist/locales/admin/ko.js.map +1 -1
- package/dist/locales/admin/zh.js +33 -8
- package/dist/locales/admin/zh.js.map +1 -1
- package/dist/locales/discovery/de.js +0 -1
- package/dist/locales/discovery/de.js.map +1 -1
- package/dist/locales/discovery/en.d.ts +0 -1
- package/dist/locales/discovery/en.js +0 -1
- package/dist/locales/discovery/en.js.map +1 -1
- package/dist/locales/discovery/es.js +0 -1
- package/dist/locales/discovery/es.js.map +1 -1
- package/dist/locales/discovery/ja.js +0 -1
- package/dist/locales/discovery/ja.js.map +1 -1
- package/dist/locales/discovery/ko.js +0 -1
- package/dist/locales/discovery/ko.js.map +1 -1
- package/dist/locales/discovery/zh.js +0 -1
- package/dist/locales/discovery/zh.js.map +1 -1
- package/dist/locales/en.d.ts +29 -5
- package/dist/react/discovery.d.ts +20 -17
- package/dist/react/discovery.js +273 -221
- package/dist/react/discovery.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/page-review.d.ts +1 -1
- package/dist/react/page-review.js +6 -5
- package/dist/react/page-review.js.map +1 -1
- package/dist/react/resources.d.ts +3 -1
- package/dist/react/resources.js +4 -0
- package/dist/react/resources.js.map +1 -1
- package/dist/react/stats.d.ts +2 -2
- package/dist/react/stats.js.map +1 -1
- package/dist/react/use-draft.d.ts +8 -0
- package/dist/react/use-draft.js +35 -0
- package/dist/react/use-draft.js.map +1 -0
- package/dist/react/use-engagement.d.ts +26 -0
- package/dist/react/use-engagement.js +221 -0
- package/dist/react/use-engagement.js.map +1 -0
- package/dist/react/use-resource.d.ts +4 -3
- package/dist/react/use-resource.js +2 -1
- package/dist/react/use-resource.js.map +1 -1
- package/dist/react.js +12 -11
- package/dist/styles.css +1 -1
- package/dist/ui/dialog.d.ts +2 -1
- package/dist/ui/dialog.js +23 -20
- package/dist/ui/dialog.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,85 +16,60 @@ import { ErrorLine as y, useAction as b } from "../social/parts.js";
|
|
|
16
16
|
import { Switch as x } from "../../ui/switch.js";
|
|
17
17
|
import { fromLocalInput as S, parseAttributes as C, toLocalInput as w } from "../../client/group-fields.js";
|
|
18
18
|
import { GroupPicker as T, labelOf as E, useGroupNames as D } from "../groups/parts.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
19
|
+
import { useDraft as O } from "../../react/use-draft.js";
|
|
20
|
+
import { readerMediaReady as ee, useEditorSaveTask as k } from "./editor-save.js";
|
|
21
|
+
import { OfferFields as A } from "./offer-fields.js";
|
|
22
|
+
import { AttributeFields as j, formOf as M } from "../groups/fields.js";
|
|
23
|
+
import { MembershipEditor as N } from "../groups/memberships.js";
|
|
24
|
+
import { ReaderManifestEditor as te } from "../admin/reader-manifest.js";
|
|
25
|
+
import { PageReview as P } from "../admin/page-review.js";
|
|
26
|
+
import { VideoMediaEditor as ne, videoPaths as F } from "../admin/media-item-panel.js";
|
|
27
|
+
import { useCallback as re, useEffect as I, useId as ie, useMemo as L, useRef as R, useState as z } from "react";
|
|
28
|
+
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
29
|
+
import { cn as U } from "cn";
|
|
28
30
|
//#region src/components/content/editors.tsx
|
|
29
|
-
var
|
|
31
|
+
var W = "__none__", ae = [
|
|
30
32
|
"listed",
|
|
31
33
|
"members",
|
|
32
34
|
"unlisted"
|
|
33
|
-
],
|
|
35
|
+
], oe = [
|
|
34
36
|
"open",
|
|
35
37
|
"closed",
|
|
36
38
|
"hidden"
|
|
37
|
-
],
|
|
39
|
+
], se = [
|
|
38
40
|
"public",
|
|
39
41
|
"tier",
|
|
40
42
|
"ppv",
|
|
41
43
|
"group",
|
|
42
44
|
"group_ppv"
|
|
43
|
-
],
|
|
44
|
-
function
|
|
45
|
-
return /* @__PURE__ */
|
|
45
|
+
], G = (e) => e === "group" || e === "group_ppv";
|
|
46
|
+
function K({ title: e, ckui: t, children: n }) {
|
|
47
|
+
return /* @__PURE__ */ H("section", {
|
|
46
48
|
className: "grid gap-3 border-t border-border pt-4",
|
|
47
49
|
"data-ckui": t,
|
|
48
|
-
children: [/* @__PURE__ */
|
|
50
|
+
children: [/* @__PURE__ */ V("h3", {
|
|
49
51
|
className: "font-medium",
|
|
50
52
|
children: e
|
|
51
53
|
}), n]
|
|
52
54
|
});
|
|
53
55
|
}
|
|
54
|
-
function
|
|
56
|
+
function q({ show: e }) {
|
|
55
57
|
let { t: n } = t();
|
|
56
|
-
return e ? /* @__PURE__ */
|
|
58
|
+
return e ? /* @__PURE__ */ V("span", {
|
|
57
59
|
role: "status",
|
|
58
60
|
className: "text-muted-foreground",
|
|
59
61
|
children: n("contentEditor.saved")
|
|
60
62
|
}) : null;
|
|
61
63
|
}
|
|
62
|
-
function
|
|
64
|
+
function J(e, t) {
|
|
63
65
|
let { kinds: n } = i({ client: t });
|
|
64
66
|
return {
|
|
65
67
|
model: n,
|
|
66
68
|
spec: n?.kinds[e]
|
|
67
69
|
};
|
|
68
70
|
}
|
|
69
|
-
function
|
|
70
|
-
let [
|
|
71
|
-
value: e,
|
|
72
|
-
dirty: /* @__PURE__ */ new Set(),
|
|
73
|
-
edits: /* @__PURE__ */ new Map()
|
|
74
|
-
});
|
|
75
|
-
return P(() => {
|
|
76
|
-
let t = { ...e };
|
|
77
|
-
for (let e of r.current.dirty) t[e] = r.current.value[e];
|
|
78
|
-
r.current.value = t, n(t);
|
|
79
|
-
}, [e]), {
|
|
80
|
-
value: t,
|
|
81
|
-
edit: (e) => {
|
|
82
|
-
let t = r.current, i = typeof e == "function" ? e(t.value) : e;
|
|
83
|
-
for (let e of /* @__PURE__ */ new Set([...Object.keys(t.value), ...Object.keys(i)])) Object.is(t.value[e], i[e]) || (t.dirty.add(e), t.edits.set(e, (t.edits.get(e) ?? 0) + 1));
|
|
84
|
-
t.value = i, n(i);
|
|
85
|
-
},
|
|
86
|
-
checkpoint: () => {
|
|
87
|
-
let e = new Map(r.current.edits);
|
|
88
|
-
return (t) => {
|
|
89
|
-
let i = r.current, a = { ...t };
|
|
90
|
-
for (let n of /* @__PURE__ */ new Set([...Object.keys(i.value), ...Object.keys(t)])) i.edits.get(n) === e.get(n) ? i.dirty.delete(n) : a[n] = i.value[n];
|
|
91
|
-
return i.value = a, n(a), i.dirty.size === 0;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function J(e, t, n) {
|
|
97
|
-
let [r, i] = L({
|
|
71
|
+
function ce(e, t, n) {
|
|
72
|
+
let [r, i] = z({
|
|
98
73
|
id: e,
|
|
99
74
|
client: t,
|
|
100
75
|
scope: n,
|
|
@@ -111,31 +86,31 @@ function J(e, t, n) {
|
|
|
111
86
|
}
|
|
112
87
|
return r.key;
|
|
113
88
|
}
|
|
114
|
-
function
|
|
115
|
-
let { client: n, store: i, scope: a, language: o } = r(t), s =
|
|
116
|
-
return
|
|
89
|
+
function le(e, t) {
|
|
90
|
+
let { client: n, store: i, scope: a, language: o } = r(t), s = R(!0);
|
|
91
|
+
return I(() => (s.current = !0, () => {
|
|
117
92
|
s.current = !1;
|
|
118
93
|
}), []), async () => {
|
|
119
94
|
let t = await n.contents.get(e.id, o ?? e.language);
|
|
120
95
|
return s.current && i.patch((t) => t.type === "content" && t.id === e.id && (t.readScope ?? "{}") === a, (e) => (e && e.revision > t.revision && (t = e), t)), t;
|
|
121
96
|
};
|
|
122
97
|
}
|
|
123
|
-
function
|
|
124
|
-
let { client: t, scope: n } = r(e.client), i =
|
|
125
|
-
return /* @__PURE__ */
|
|
98
|
+
function ue(e) {
|
|
99
|
+
let { client: t, scope: n } = r(e.client), i = ce(e.content.id, t, n);
|
|
100
|
+
return /* @__PURE__ */ V(de, {
|
|
126
101
|
...e,
|
|
127
102
|
client: t
|
|
128
103
|
}, i);
|
|
129
104
|
}
|
|
130
|
-
function
|
|
131
|
-
let { t: i } = t(), a = n(r.client), { spec: o } =
|
|
105
|
+
function de({ content: e, ...r }) {
|
|
106
|
+
let { t: i } = t(), a = n(r.client), { spec: o } = J(e.kind, r.client), c = L(() => o?.attributes ?? {}, [o]), l = O(L(() => ({
|
|
132
107
|
listing: e.listing,
|
|
133
108
|
comments: e.comments
|
|
134
|
-
}), [e.listing, e.comments])), u =
|
|
135
|
-
return /* @__PURE__ */
|
|
109
|
+
}), [e.listing, e.comments])), u = O(L(() => M(c, e.attributes), [c, e.attributes])), { listing: d, comments: v } = l.value, x = le(e, r.client), [S, w] = z(null), [T, E] = z(!1), D = b("content.save", r.onError);
|
|
110
|
+
return /* @__PURE__ */ V(K, {
|
|
136
111
|
title: i("contentEditor.details"),
|
|
137
112
|
ckui: "content-details",
|
|
138
|
-
children: /* @__PURE__ */
|
|
113
|
+
children: /* @__PURE__ */ H("form", {
|
|
139
114
|
className: "grid gap-3",
|
|
140
115
|
onSubmit: (t) => {
|
|
141
116
|
t.preventDefault(), w(null), E(!1);
|
|
@@ -156,14 +131,14 @@ function oe({ content: e, ...r }) {
|
|
|
156
131
|
let t = r({
|
|
157
132
|
listing: e.listing,
|
|
158
133
|
comments: e.comments
|
|
159
|
-
}), n = i(
|
|
134
|
+
}), n = i(M(c, e.attributes));
|
|
160
135
|
E(t && n);
|
|
161
136
|
});
|
|
162
137
|
},
|
|
163
138
|
children: [
|
|
164
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ H("div", {
|
|
165
140
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
166
|
-
children: [/* @__PURE__ */
|
|
141
|
+
children: [/* @__PURE__ */ V(f, { children: i("contentEditor.listing") }), /* @__PURE__ */ H(p, {
|
|
167
142
|
value: d,
|
|
168
143
|
onValueChange: (e) => {
|
|
169
144
|
l.edit((t) => ({
|
|
@@ -171,19 +146,19 @@ function oe({ content: e, ...r }) {
|
|
|
171
146
|
listing: e
|
|
172
147
|
})), E(!1);
|
|
173
148
|
},
|
|
174
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ V(g, {
|
|
175
150
|
size: "sm",
|
|
176
151
|
"aria-label": i("contentEditor.listing"),
|
|
177
|
-
children: /* @__PURE__ */
|
|
178
|
-
}), /* @__PURE__ */
|
|
152
|
+
children: /* @__PURE__ */ V(_, { children: (e) => i(`contentEditor.listing_${e}`) })
|
|
153
|
+
}), /* @__PURE__ */ V(m, { children: ae.map((e) => /* @__PURE__ */ V(h, {
|
|
179
154
|
value: e,
|
|
180
155
|
children: i(`contentEditor.listing_${e}`)
|
|
181
156
|
}, e)) })]
|
|
182
157
|
})]
|
|
183
158
|
}),
|
|
184
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ H("div", {
|
|
185
160
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
186
|
-
children: [/* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ V(f, { children: i("contentEditor.comments") }), /* @__PURE__ */ H(p, {
|
|
187
162
|
value: v,
|
|
188
163
|
onValueChange: (e) => {
|
|
189
164
|
l.edit((t) => ({
|
|
@@ -191,17 +166,17 @@ function oe({ content: e, ...r }) {
|
|
|
191
166
|
comments: e
|
|
192
167
|
})), E(!1);
|
|
193
168
|
},
|
|
194
|
-
children: [/* @__PURE__ */
|
|
169
|
+
children: [/* @__PURE__ */ V(g, {
|
|
195
170
|
size: "sm",
|
|
196
171
|
"aria-label": i("contentEditor.comments"),
|
|
197
|
-
children: /* @__PURE__ */
|
|
198
|
-
}), /* @__PURE__ */
|
|
172
|
+
children: /* @__PURE__ */ V(_, { children: (e) => i(`contentEditor.comments_${e}`) })
|
|
173
|
+
}), /* @__PURE__ */ V(m, { children: oe.map((e) => /* @__PURE__ */ V(h, {
|
|
199
174
|
value: e,
|
|
200
175
|
children: i(`contentEditor.comments_${e}`)
|
|
201
176
|
}, e)) })]
|
|
202
177
|
})]
|
|
203
178
|
}),
|
|
204
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ V(j, {
|
|
205
180
|
declared: c,
|
|
206
181
|
form: u.value,
|
|
207
182
|
onChange: (e, t) => {
|
|
@@ -212,18 +187,18 @@ function oe({ content: e, ...r }) {
|
|
|
212
187
|
},
|
|
213
188
|
labels: r.labels
|
|
214
189
|
}),
|
|
215
|
-
S && /* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
/* @__PURE__ */
|
|
190
|
+
S && /* @__PURE__ */ V(y, { children: S }),
|
|
191
|
+
/* @__PURE__ */ V(y, { error: D.error }),
|
|
192
|
+
/* @__PURE__ */ H("div", {
|
|
218
193
|
className: "flex items-center gap-3",
|
|
219
194
|
children: [
|
|
220
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ V(s, {
|
|
221
196
|
type: "submit",
|
|
222
197
|
size: "sm",
|
|
223
198
|
disabled: D.pending,
|
|
224
199
|
children: D.pending ? i("common.saving") : i("common.save")
|
|
225
200
|
}),
|
|
226
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ V(s, {
|
|
227
202
|
type: "button",
|
|
228
203
|
variant: "ghost",
|
|
229
204
|
size: "sm",
|
|
@@ -234,140 +209,140 @@ function oe({ content: e, ...r }) {
|
|
|
234
209
|
n && (e({
|
|
235
210
|
listing: n.listing,
|
|
236
211
|
comments: n.comments
|
|
237
|
-
}), t(
|
|
212
|
+
}), t(M(c, n.attributes)), w(null), E(!1));
|
|
238
213
|
});
|
|
239
214
|
},
|
|
240
215
|
children: i("common.cancel")
|
|
241
216
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ V(q, { show: T })
|
|
243
218
|
]
|
|
244
219
|
})
|
|
245
220
|
]
|
|
246
221
|
})
|
|
247
222
|
});
|
|
248
223
|
}
|
|
249
|
-
function
|
|
250
|
-
let { t: c } = t(), l =
|
|
224
|
+
function Y({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, client: s }) {
|
|
225
|
+
let { t: c } = t(), l = ie(), u = r?.tiers ?? [], v = r?.kinds[i], y = Object.entries(r?.entity_kinds ?? {}).filter(([, e]) => e.sellable || e.auth_scope).map(([e]) => e), [b, C] = z(), O = b ?? y[0] ?? "", ee = D(e.group_id ? [e.group_id] : [], { client: s }), k = e.group_id ? ee.get(e.group_id) : void 0, A = (t) => n({
|
|
251
226
|
...e,
|
|
252
227
|
...t
|
|
253
|
-
}),
|
|
254
|
-
return /* @__PURE__ */
|
|
228
|
+
}), j = v?.presentation === "reader", M = !!v?.segments;
|
|
229
|
+
return /* @__PURE__ */ H("div", {
|
|
255
230
|
className: "grid gap-3",
|
|
256
231
|
"data-ckui": "rule-fields",
|
|
257
232
|
children: [
|
|
258
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ H("div", {
|
|
259
234
|
className: "grid gap-1.5 sm:max-w-xs",
|
|
260
|
-
children: [/* @__PURE__ */
|
|
235
|
+
children: [/* @__PURE__ */ V(f, { children: c("contentEditor.access") }), /* @__PURE__ */ H(p, {
|
|
261
236
|
value: e.level,
|
|
262
237
|
onValueChange: (t) => {
|
|
263
238
|
let r = t;
|
|
264
239
|
n({
|
|
265
240
|
level: r,
|
|
266
|
-
group_id:
|
|
241
|
+
group_id: G(r) ? e.group_id || a : void 0,
|
|
267
242
|
preview: e.preview,
|
|
268
243
|
free_after: e.free_after
|
|
269
244
|
});
|
|
270
245
|
},
|
|
271
|
-
children: [/* @__PURE__ */
|
|
246
|
+
children: [/* @__PURE__ */ V(g, {
|
|
272
247
|
size: "sm",
|
|
273
248
|
"aria-label": c("contentEditor.access"),
|
|
274
|
-
children: /* @__PURE__ */
|
|
275
|
-
}), /* @__PURE__ */
|
|
249
|
+
children: /* @__PURE__ */ V(_, { children: (e) => c(`contentEditor.level_${e}`) })
|
|
250
|
+
}), /* @__PURE__ */ V(m, { children: se.filter((e) => (e !== "tier" || u.length) && (!e.startsWith("group") || y.length)).map((e) => /* @__PURE__ */ V(h, {
|
|
276
251
|
value: e,
|
|
277
252
|
children: c(`contentEditor.level_${e}`)
|
|
278
253
|
}, e)) })]
|
|
279
254
|
})]
|
|
280
255
|
}),
|
|
281
|
-
e.level === "tier" && /* @__PURE__ */
|
|
256
|
+
e.level === "tier" && /* @__PURE__ */ H("fieldset", {
|
|
282
257
|
className: "flex flex-wrap gap-3",
|
|
283
|
-
children: [/* @__PURE__ */
|
|
258
|
+
children: [/* @__PURE__ */ V("legend", {
|
|
284
259
|
className: "sr-only",
|
|
285
260
|
children: c("contentEditor.tiers")
|
|
286
|
-
}), u.map((t) => /* @__PURE__ */
|
|
261
|
+
}), u.map((t) => /* @__PURE__ */ H("label", {
|
|
287
262
|
className: "flex items-center gap-2",
|
|
288
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ V(x, {
|
|
289
264
|
checked: e.tiers?.includes(t) ?? !1,
|
|
290
|
-
onCheckedChange: (n) =>
|
|
265
|
+
onCheckedChange: (n) => A({ tiers: n ? [...e.tiers ?? [], t] : (e.tiers ?? []).filter((e) => e !== t) }),
|
|
291
266
|
"aria-label": E(o, t)
|
|
292
267
|
}), E(o, t)]
|
|
293
268
|
}, t))]
|
|
294
269
|
}),
|
|
295
|
-
|
|
270
|
+
G(e.level) && /* @__PURE__ */ H("div", {
|
|
296
271
|
className: "flex flex-wrap items-end gap-2",
|
|
297
272
|
children: [
|
|
298
|
-
|
|
273
|
+
k || e.group_id ? /* @__PURE__ */ V("span", {
|
|
299
274
|
className: "rounded-md border border-border px-2 py-0.5",
|
|
300
275
|
"data-ckui": "rule-group",
|
|
301
|
-
children:
|
|
276
|
+
children: k ? k.name || k.slug : e.group_id
|
|
302
277
|
}) : null,
|
|
303
|
-
y.length > 1 && /* @__PURE__ */
|
|
278
|
+
y.length > 1 && /* @__PURE__ */ H(p, {
|
|
304
279
|
value: O,
|
|
305
280
|
onValueChange: (e) => C(String(e)),
|
|
306
|
-
children: [/* @__PURE__ */
|
|
281
|
+
children: [/* @__PURE__ */ V(g, {
|
|
307
282
|
size: "sm",
|
|
308
283
|
"aria-label": c("groupEditor.edgeKind"),
|
|
309
|
-
children: /* @__PURE__ */
|
|
310
|
-
}), /* @__PURE__ */
|
|
284
|
+
children: /* @__PURE__ */ V(_, { children: (e) => E(o, e) })
|
|
285
|
+
}), /* @__PURE__ */ V(m, { children: y.map((e) => /* @__PURE__ */ V(h, {
|
|
311
286
|
value: e,
|
|
312
287
|
children: E(o, e)
|
|
313
288
|
}, e)) })]
|
|
314
289
|
}),
|
|
315
|
-
O && /* @__PURE__ */
|
|
290
|
+
O && /* @__PURE__ */ V(T, {
|
|
316
291
|
kind: O,
|
|
317
292
|
label: c("contentEditor.group"),
|
|
318
293
|
client: s,
|
|
319
|
-
onPick: (e) =>
|
|
294
|
+
onPick: (e) => A({ group_id: e.id })
|
|
320
295
|
}, O)
|
|
321
296
|
]
|
|
322
297
|
}),
|
|
323
|
-
e.level !== "public" && /* @__PURE__ */
|
|
298
|
+
e.level !== "public" && /* @__PURE__ */ H("div", {
|
|
324
299
|
className: "grid gap-3 sm:grid-cols-3",
|
|
325
300
|
children: [
|
|
326
|
-
|
|
301
|
+
j && /* @__PURE__ */ H("div", {
|
|
327
302
|
className: "grid gap-1.5",
|
|
328
|
-
children: [/* @__PURE__ */
|
|
303
|
+
children: [/* @__PURE__ */ V(f, {
|
|
329
304
|
htmlFor: `${l}-pages`,
|
|
330
305
|
children: c("contentEditor.previewPages")
|
|
331
|
-
}), /* @__PURE__ */
|
|
306
|
+
}), /* @__PURE__ */ V(d, {
|
|
332
307
|
id: `${l}-pages`,
|
|
333
308
|
className: "h-8",
|
|
334
309
|
type: "number",
|
|
335
310
|
min: 0,
|
|
336
311
|
value: e.preview?.pages ?? "",
|
|
337
|
-
onChange: (t) =>
|
|
312
|
+
onChange: (t) => A({ preview: {
|
|
338
313
|
...e.preview,
|
|
339
314
|
pages: t.target.value ? Math.max(0, Math.trunc(Number(t.target.value))) : void 0
|
|
340
315
|
} })
|
|
341
316
|
})]
|
|
342
317
|
}),
|
|
343
|
-
M && /* @__PURE__ */
|
|
318
|
+
M && /* @__PURE__ */ H("div", {
|
|
344
319
|
className: "grid gap-1.5",
|
|
345
|
-
children: [/* @__PURE__ */
|
|
320
|
+
children: [/* @__PURE__ */ V(f, {
|
|
346
321
|
htmlFor: `${l}-segments`,
|
|
347
322
|
children: c("contentEditor.previewSegments")
|
|
348
|
-
}), /* @__PURE__ */
|
|
323
|
+
}), /* @__PURE__ */ V(d, {
|
|
349
324
|
id: `${l}-segments`,
|
|
350
325
|
className: "h-8",
|
|
351
326
|
type: "number",
|
|
352
327
|
min: 0,
|
|
353
328
|
value: e.preview?.segments ?? "",
|
|
354
|
-
onChange: (t) =>
|
|
329
|
+
onChange: (t) => A({ preview: {
|
|
355
330
|
...e.preview,
|
|
356
331
|
segments: t.target.value ? Math.max(0, Math.trunc(Number(t.target.value))) : void 0
|
|
357
332
|
} })
|
|
358
333
|
})]
|
|
359
334
|
}),
|
|
360
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ H("div", {
|
|
361
336
|
className: "grid gap-1.5",
|
|
362
|
-
children: [/* @__PURE__ */
|
|
337
|
+
children: [/* @__PURE__ */ V(f, {
|
|
363
338
|
htmlFor: `${l}-free`,
|
|
364
339
|
children: c("contentEditor.freeAfter")
|
|
365
|
-
}), /* @__PURE__ */
|
|
340
|
+
}), /* @__PURE__ */ V(d, {
|
|
366
341
|
id: `${l}-free`,
|
|
367
342
|
className: "h-8",
|
|
368
343
|
type: "datetime-local",
|
|
369
344
|
value: w(e.free_after),
|
|
370
|
-
onChange: (e) =>
|
|
345
|
+
onChange: (e) => A({ free_after: S(e.target.value) })
|
|
371
346
|
})]
|
|
372
347
|
})
|
|
373
348
|
]
|
|
@@ -375,8 +350,8 @@ function se({ value: e, onChange: n, model: r, kind: i, owner: a, labels: o, cli
|
|
|
375
350
|
]
|
|
376
351
|
});
|
|
377
352
|
}
|
|
378
|
-
var
|
|
379
|
-
function
|
|
353
|
+
var X = (e) => !G(e.level) || !!e.group_id;
|
|
354
|
+
function Z(e) {
|
|
380
355
|
let t = e.preview && (e.preview.pages || e.preview.segments) ? {
|
|
381
356
|
pages: e.preview.pages || void 0,
|
|
382
357
|
segments: e.preview.segments || void 0
|
|
@@ -389,31 +364,31 @@ function le(e) {
|
|
|
389
364
|
free_after: e.level === "public" ? void 0 : e.free_after
|
|
390
365
|
};
|
|
391
366
|
}
|
|
392
|
-
function
|
|
393
|
-
let { client: t, scope: n } = r(e.client), i =
|
|
394
|
-
return /* @__PURE__ */
|
|
367
|
+
function fe(e) {
|
|
368
|
+
let { client: t, scope: n } = r(e.client), i = ce(e.content.id, t, n);
|
|
369
|
+
return /* @__PURE__ */ V(pe, {
|
|
395
370
|
...e,
|
|
396
371
|
client: t
|
|
397
372
|
}, i);
|
|
398
373
|
}
|
|
399
|
-
function
|
|
400
|
-
let { t: i } = t(), a = n(r.client), { model: o } =
|
|
401
|
-
return /* @__PURE__ */
|
|
374
|
+
function pe({ content: e, ...r }) {
|
|
375
|
+
let { t: i } = t(), a = n(r.client), { model: o } = J(e.kind, r.client), c = O(e.access), l = le(e, r.client), [u, d] = z(!1), f = b("content.save", r.onError), p = b("offer.save", r.onError);
|
|
376
|
+
return /* @__PURE__ */ H(K, {
|
|
402
377
|
title: i("contentEditor.accessTitle"),
|
|
403
378
|
ckui: "access-editor",
|
|
404
379
|
children: [
|
|
405
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ H("form", {
|
|
406
381
|
className: "grid gap-3",
|
|
407
382
|
onSubmit: (t) => {
|
|
408
383
|
t.preventDefault(), d(!1);
|
|
409
384
|
let n = c.checkpoint();
|
|
410
385
|
f.run(() => a.contents.update(e.id, {
|
|
411
|
-
access:
|
|
386
|
+
access: Z(c.value),
|
|
412
387
|
revision: e.revision
|
|
413
388
|
})).then((e) => e && d(n(e.access)));
|
|
414
389
|
},
|
|
415
390
|
children: [
|
|
416
|
-
/* @__PURE__ */
|
|
391
|
+
/* @__PURE__ */ V(Y, {
|
|
417
392
|
value: c.value,
|
|
418
393
|
onChange: (e) => {
|
|
419
394
|
c.edit(e), d(!1);
|
|
@@ -424,17 +399,17 @@ function de({ content: e, ...r }) {
|
|
|
424
399
|
labels: r.labels,
|
|
425
400
|
client: a
|
|
426
401
|
}),
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ V(y, { error: f.error }),
|
|
403
|
+
/* @__PURE__ */ H("div", {
|
|
429
404
|
className: "flex items-center gap-3",
|
|
430
405
|
children: [
|
|
431
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ V(s, {
|
|
432
407
|
type: "submit",
|
|
433
408
|
size: "sm",
|
|
434
|
-
disabled: f.pending || !
|
|
409
|
+
disabled: f.pending || !X(c.value),
|
|
435
410
|
children: f.pending ? i("common.saving") : i("common.save")
|
|
436
411
|
}),
|
|
437
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ V(s, {
|
|
438
413
|
type: "button",
|
|
439
414
|
variant: "ghost",
|
|
440
415
|
size: "sm",
|
|
@@ -447,152 +422,167 @@ function de({ content: e, ...r }) {
|
|
|
447
422
|
},
|
|
448
423
|
children: i("common.cancel")
|
|
449
424
|
}),
|
|
450
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ V(q, { show: u })
|
|
451
426
|
]
|
|
452
427
|
})
|
|
453
428
|
]
|
|
454
429
|
}),
|
|
455
|
-
/* @__PURE__ */
|
|
430
|
+
/* @__PURE__ */ V(A, {
|
|
456
431
|
offer: e.offer,
|
|
457
432
|
pending: p.pending,
|
|
458
|
-
onSell: (t) =>
|
|
433
|
+
onSell: (t) => p.run(() => a.offers.sell({ content: e.id }, t)),
|
|
459
434
|
onWithdraw: () => void p.run(() => a.offers.withdraw({ content: e.id }))
|
|
460
435
|
}),
|
|
461
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ V(y, { error: p.error })
|
|
462
437
|
]
|
|
463
438
|
});
|
|
464
439
|
}
|
|
465
|
-
function
|
|
440
|
+
function Q(e, t, n) {
|
|
466
441
|
return e.label || [...e.languages.map(t), ...e.traits.map((e) => E(n, e))].join(" · ");
|
|
467
442
|
}
|
|
468
|
-
function
|
|
469
|
-
let { t:
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
443
|
+
function me({ content: r, media: i = !0, activeVersion: a, ...o }) {
|
|
444
|
+
let { t: l } = t(), d = n(o.client), f = e(), { model: p, spec: m } = J(r.kind, o.client), h = b("content.save", o.onError), g = b("content.save", o.onError), [_, v] = z(null), [x, S] = z([]), C = (e) => {
|
|
445
|
+
v(e), S((t) => t.includes(e) ? t : [...t, e]);
|
|
446
|
+
};
|
|
447
|
+
I(() => {
|
|
448
|
+
a && (v(a), S((e) => e.includes(a) ? e : [...e, a]));
|
|
449
|
+
}, [a]), k(`versions:${r.id}`, {
|
|
450
|
+
label: l("contentEditor.versions"),
|
|
451
|
+
dirty: !1,
|
|
452
|
+
pending: h.pending || g.pending,
|
|
453
|
+
valid: !0,
|
|
454
|
+
save: async () => !0
|
|
455
|
+
});
|
|
456
|
+
let w = L(() => [...r.versions].sort((e, t) => e.position - t.position), [r.versions]);
|
|
457
|
+
if (!m) return null;
|
|
458
|
+
if (m.versions.hidden) {
|
|
459
|
+
let e = w[0];
|
|
460
|
+
return !e || !i && !m.segments ? null : /* @__PURE__ */ H(K, {
|
|
461
|
+
title: l("contentEditor.media"),
|
|
475
462
|
ckui: "version-media",
|
|
476
|
-
children: [
|
|
463
|
+
children: [m.segments && /* @__PURE__ */ V($, {
|
|
477
464
|
content: r,
|
|
478
465
|
version: e,
|
|
479
|
-
...
|
|
480
|
-
}), i && /* @__PURE__ */
|
|
466
|
+
...o
|
|
467
|
+
}), i && /* @__PURE__ */ V(ye, {
|
|
481
468
|
content: r,
|
|
482
469
|
version: e,
|
|
483
|
-
model:
|
|
484
|
-
...
|
|
470
|
+
model: p,
|
|
471
|
+
...o
|
|
485
472
|
})]
|
|
486
473
|
});
|
|
487
474
|
}
|
|
488
|
-
let
|
|
489
|
-
return /* @__PURE__ */
|
|
490
|
-
title:
|
|
475
|
+
let T = p?.languages ?? [];
|
|
476
|
+
return /* @__PURE__ */ H(K, {
|
|
477
|
+
title: l("contentEditor.versions"),
|
|
491
478
|
ckui: "versions-editor",
|
|
492
479
|
children: [
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
items:
|
|
480
|
+
/* @__PURE__ */ V(c, {
|
|
481
|
+
items: w,
|
|
495
482
|
id: (e) => e.id,
|
|
496
|
-
name: (e) =>
|
|
497
|
-
label:
|
|
498
|
-
disabled:
|
|
483
|
+
name: (e) => Q(e, f, o.labels),
|
|
484
|
+
label: l("contentEditor.versions"),
|
|
485
|
+
disabled: h.pending || w.length < 2,
|
|
499
486
|
onMove: (e, t) => {
|
|
500
|
-
let n =
|
|
501
|
-
n.splice(t, 0, i),
|
|
487
|
+
let n = w.map((e) => e.id), [i] = n.splice(e, 1);
|
|
488
|
+
n.splice(t, 0, i), h.run(() => d.contents.orderVersions(r.id, n));
|
|
502
489
|
},
|
|
503
|
-
children: (e, t) => /* @__PURE__ */
|
|
490
|
+
children: (e, t) => /* @__PURE__ */ H("div", {
|
|
504
491
|
className: "grid gap-2 rounded-md border border-border p-2",
|
|
505
492
|
"data-ckui": "version-row",
|
|
506
493
|
"data-version": e.id,
|
|
507
|
-
children: [/* @__PURE__ */
|
|
494
|
+
children: [/* @__PURE__ */ H("div", {
|
|
508
495
|
className: "flex flex-wrap items-center gap-2",
|
|
509
496
|
children: [
|
|
510
|
-
|
|
511
|
-
/* @__PURE__ */
|
|
497
|
+
w.length > 1 && t,
|
|
498
|
+
/* @__PURE__ */ V("span", {
|
|
512
499
|
className: "min-w-0 flex-1 font-medium break-words",
|
|
513
|
-
children:
|
|
500
|
+
children: Q(e, f, o.labels)
|
|
514
501
|
}),
|
|
515
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ V(u, {
|
|
516
503
|
variant: e.live ? "default" : "outline",
|
|
517
|
-
children:
|
|
504
|
+
children: l(e.live ? "contentEditor.live" : e.state === "draft" ? "contentManager.draft" : "contentManager.scheduled")
|
|
518
505
|
}),
|
|
519
|
-
e.access && /* @__PURE__ */
|
|
506
|
+
e.access && /* @__PURE__ */ V(u, {
|
|
520
507
|
variant: "secondary",
|
|
521
|
-
children:
|
|
508
|
+
children: l(`contentEditor.level_${e.access.level}`)
|
|
522
509
|
}),
|
|
523
|
-
e.pages ? /* @__PURE__ */
|
|
510
|
+
e.pages ? /* @__PURE__ */ V("span", {
|
|
524
511
|
className: "text-xs text-muted-foreground",
|
|
525
|
-
children:
|
|
512
|
+
children: l("contentEditor.pageCount", { count: e.pages })
|
|
526
513
|
}) : null,
|
|
527
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ V(s, {
|
|
528
515
|
type: "button",
|
|
529
516
|
size: "xs",
|
|
530
517
|
variant: "ghost",
|
|
531
|
-
"aria-expanded":
|
|
532
|
-
onClick: () => _
|
|
533
|
-
children:
|
|
518
|
+
"aria-expanded": _ === e.id,
|
|
519
|
+
onClick: () => _ === e.id ? v(null) : C(e.id),
|
|
520
|
+
children: l(_ === e.id ? "contentEditor.close" : "contentEditor.edit")
|
|
534
521
|
})
|
|
535
522
|
]
|
|
536
|
-
}),
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
523
|
+
}), x.includes(e.id) && /* @__PURE__ */ V("div", {
|
|
524
|
+
hidden: _ !== e.id,
|
|
525
|
+
children: /* @__PURE__ */ V(_e, {
|
|
526
|
+
content: r,
|
|
527
|
+
version: e,
|
|
528
|
+
model: p,
|
|
529
|
+
media: i,
|
|
530
|
+
...o
|
|
531
|
+
})
|
|
542
532
|
})]
|
|
543
533
|
})
|
|
544
534
|
}),
|
|
545
|
-
/* @__PURE__ */
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
languages:
|
|
548
|
-
many:
|
|
549
|
-
pending:
|
|
550
|
-
onAdd: (e) => void
|
|
535
|
+
/* @__PURE__ */ V(y, { error: h.error }),
|
|
536
|
+
/* @__PURE__ */ V(ge, {
|
|
537
|
+
languages: T,
|
|
538
|
+
many: m?.versions.languages === "many",
|
|
539
|
+
pending: g.pending,
|
|
540
|
+
onAdd: (e) => void g.run(() => d.contents.addVersion(r.id, e)).then((e) => e && C(e.id))
|
|
551
541
|
}),
|
|
552
|
-
/* @__PURE__ */
|
|
542
|
+
/* @__PURE__ */ V(y, { error: g.error })
|
|
553
543
|
]
|
|
554
544
|
});
|
|
555
545
|
}
|
|
556
|
-
function
|
|
546
|
+
function he({ languages: n, value: r, many: i, onChange: a }) {
|
|
557
547
|
let { t: o } = t(), s = e();
|
|
558
|
-
return i ? /* @__PURE__ */
|
|
548
|
+
return i ? /* @__PURE__ */ H("fieldset", {
|
|
559
549
|
className: "flex flex-wrap gap-3",
|
|
560
|
-
children: [/* @__PURE__ */
|
|
550
|
+
children: [/* @__PURE__ */ V("legend", {
|
|
561
551
|
className: "sr-only",
|
|
562
552
|
children: o("contentEditor.versionLanguages")
|
|
563
|
-
}), n.map((e) => /* @__PURE__ */
|
|
553
|
+
}), n.map((e) => /* @__PURE__ */ H("label", {
|
|
564
554
|
className: "flex items-center gap-1.5",
|
|
565
|
-
children: [/* @__PURE__ */
|
|
555
|
+
children: [/* @__PURE__ */ V(x, {
|
|
566
556
|
size: "sm",
|
|
567
557
|
checked: r.includes(e),
|
|
568
558
|
onCheckedChange: (t) => a(t ? [...r, e] : r.filter((t) => t !== e)),
|
|
569
559
|
"aria-label": s(e)
|
|
570
560
|
}), s(e)]
|
|
571
561
|
}, e))]
|
|
572
|
-
}) : /* @__PURE__ */
|
|
573
|
-
value: r[0] ??
|
|
574
|
-
onValueChange: (e) => a(e ===
|
|
575
|
-
children: [/* @__PURE__ */
|
|
562
|
+
}) : /* @__PURE__ */ H(p, {
|
|
563
|
+
value: r[0] ?? W,
|
|
564
|
+
onValueChange: (e) => a(e === W ? [] : [String(e)]),
|
|
565
|
+
children: [/* @__PURE__ */ V(g, {
|
|
576
566
|
size: "sm",
|
|
577
567
|
"aria-label": o("contentEditor.versionLanguage"),
|
|
578
|
-
children: /* @__PURE__ */
|
|
579
|
-
}), /* @__PURE__ */
|
|
568
|
+
children: /* @__PURE__ */ V(_, { children: (e) => e === W ? o("contentEditor.chooseLanguage") : s(e) })
|
|
569
|
+
}), /* @__PURE__ */ V(m, { children: n.map((e) => /* @__PURE__ */ V(h, {
|
|
580
570
|
value: e,
|
|
581
571
|
children: s(e)
|
|
582
572
|
}, e)) })]
|
|
583
573
|
});
|
|
584
574
|
}
|
|
585
|
-
function
|
|
586
|
-
let { t: a } = t(), [o, c] =
|
|
587
|
-
return /* @__PURE__ */
|
|
575
|
+
function ge({ languages: e, many: n, pending: r, onAdd: i }) {
|
|
576
|
+
let { t: a } = t(), [o, c] = z([]);
|
|
577
|
+
return /* @__PURE__ */ H("div", {
|
|
588
578
|
className: "flex flex-wrap items-center gap-2",
|
|
589
579
|
"data-ckui": "add-version",
|
|
590
|
-
children: [/* @__PURE__ */
|
|
580
|
+
children: [/* @__PURE__ */ V(he, {
|
|
591
581
|
languages: e,
|
|
592
582
|
value: o,
|
|
593
583
|
many: n,
|
|
594
584
|
onChange: c
|
|
595
|
-
}), /* @__PURE__ */
|
|
585
|
+
}), /* @__PURE__ */ V(s, {
|
|
596
586
|
type: "button",
|
|
597
587
|
size: "sm",
|
|
598
588
|
variant: "outline",
|
|
@@ -604,109 +594,141 @@ function pe({ languages: e, many: n, pending: r, onAdd: i }) {
|
|
|
604
594
|
})]
|
|
605
595
|
});
|
|
606
596
|
}
|
|
607
|
-
function
|
|
608
|
-
let { t: c } = t(), l =
|
|
609
|
-
|
|
597
|
+
function _e({ content: e, version: r, model: i, media: a, ...o }) {
|
|
598
|
+
let { t: c } = t(), l = ie(), u = n(o.client), p = i?.kinds[e.kind], m = re((t) => ({
|
|
599
|
+
langs: t.languages,
|
|
600
|
+
traits: t.traits,
|
|
601
|
+
label: t.label ?? "",
|
|
602
|
+
draft: t.state === "draft",
|
|
603
|
+
at: w(t.publish_at),
|
|
604
|
+
own: !!t.access,
|
|
605
|
+
rule: t.access ?? e.access
|
|
606
|
+
}), [e.access]), h = O(L(() => m(r), [m, r])), { langs: g, traits: _, label: v, draft: C, at: T, own: D, rule: j } = h.value, M = (e) => {
|
|
607
|
+
h.edit((t) => ({
|
|
608
|
+
...t,
|
|
609
|
+
...e
|
|
610
|
+
})), F(!1);
|
|
611
|
+
}, [N, P] = z(null), [ne, F] = z(!1), I = b("content.save", o.onError), R = b("content.save", o.onError), B = b("offer.save", o.onError), U = g.length > 0 && (!D || X(j)), W = async () => {
|
|
612
|
+
if (!U) return !1;
|
|
613
|
+
if (P(null), F(!1), p?.presentation === "reader" && r.state === "draft" && !C && !await ee(u, {
|
|
614
|
+
kind: e.kind,
|
|
615
|
+
id: e.id,
|
|
616
|
+
version: r.id
|
|
617
|
+
})) return P(c("readerEditor.filesNotReady")), !1;
|
|
618
|
+
let t = h.checkpoint(), n = await I.run(() => u.contents.updateVersion(e.id, r.id, {
|
|
619
|
+
languages: g,
|
|
620
|
+
traits: _,
|
|
621
|
+
label: v.trim(),
|
|
622
|
+
state: C ? "draft" : "published",
|
|
623
|
+
publish_at: S(T),
|
|
624
|
+
...D ? { access: Z(j) } : { clear_access: !!r.access }
|
|
625
|
+
}));
|
|
626
|
+
if (!n) return !1;
|
|
627
|
+
let i = t(m(n));
|
|
628
|
+
return F(i), i;
|
|
629
|
+
};
|
|
630
|
+
return k(`version:${r.id}`, {
|
|
631
|
+
label: c("contentEditor.versions"),
|
|
632
|
+
dirty: h.dirty.length > 0,
|
|
633
|
+
pending: I.pending || R.pending,
|
|
634
|
+
valid: U,
|
|
635
|
+
save: W,
|
|
636
|
+
order: 10
|
|
637
|
+
}), /* @__PURE__ */ H("div", {
|
|
610
638
|
className: "grid gap-4 pt-2",
|
|
611
639
|
children: [
|
|
612
|
-
/* @__PURE__ */
|
|
640
|
+
/* @__PURE__ */ H("form", {
|
|
613
641
|
className: "grid gap-3",
|
|
614
|
-
onSubmit: (
|
|
615
|
-
|
|
616
|
-
languages: m,
|
|
617
|
-
traits: g,
|
|
618
|
-
label: v.trim(),
|
|
619
|
-
state: T ? "draft" : "published",
|
|
620
|
-
publish_at: S(k),
|
|
621
|
-
...j ? { access: le(N) } : { clear_access: !!r.access }
|
|
622
|
-
})).then((e) => e && F(!0));
|
|
642
|
+
onSubmit: (e) => {
|
|
643
|
+
e.preventDefault(), W();
|
|
623
644
|
},
|
|
624
645
|
children: [
|
|
625
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ V(he, {
|
|
626
647
|
languages: i?.languages ?? [],
|
|
627
|
-
value:
|
|
648
|
+
value: g,
|
|
628
649
|
many: p?.versions.languages === "many",
|
|
629
|
-
onChange:
|
|
650
|
+
onChange: (e) => M({ langs: e })
|
|
630
651
|
}),
|
|
631
|
-
!!p?.versions.traits?.length && /* @__PURE__ */
|
|
652
|
+
!!p?.versions.traits?.length && /* @__PURE__ */ H("fieldset", {
|
|
632
653
|
className: "flex flex-wrap gap-3",
|
|
633
|
-
children: [/* @__PURE__ */
|
|
654
|
+
children: [/* @__PURE__ */ V("legend", {
|
|
634
655
|
className: "sr-only",
|
|
635
656
|
children: c("contentEditor.traits")
|
|
636
|
-
}), p.versions.traits.map((e) => /* @__PURE__ */
|
|
657
|
+
}), p.versions.traits.map((e) => /* @__PURE__ */ H("label", {
|
|
637
658
|
className: "flex items-center gap-1.5",
|
|
638
|
-
children: [/* @__PURE__ */
|
|
659
|
+
children: [/* @__PURE__ */ V(x, {
|
|
639
660
|
size: "sm",
|
|
640
|
-
checked:
|
|
641
|
-
onCheckedChange: (t) =>
|
|
661
|
+
checked: _.includes(e),
|
|
662
|
+
onCheckedChange: (t) => M({ traits: t ? [..._, e] : _.filter((t) => t !== e) }),
|
|
642
663
|
"aria-label": E(o.labels, e)
|
|
643
664
|
}), E(o.labels, e)]
|
|
644
665
|
}, e))]
|
|
645
666
|
}),
|
|
646
|
-
/* @__PURE__ */
|
|
667
|
+
/* @__PURE__ */ H("div", {
|
|
647
668
|
className: "grid gap-3 sm:grid-cols-2",
|
|
648
|
-
children: [/* @__PURE__ */
|
|
669
|
+
children: [/* @__PURE__ */ H("div", {
|
|
649
670
|
className: "grid gap-1.5",
|
|
650
|
-
children: [/* @__PURE__ */
|
|
671
|
+
children: [/* @__PURE__ */ V(f, {
|
|
651
672
|
htmlFor: `${l}-label`,
|
|
652
673
|
children: c("contentEditor.versionLabel")
|
|
653
|
-
}), /* @__PURE__ */
|
|
674
|
+
}), /* @__PURE__ */ V(d, {
|
|
654
675
|
id: `${l}-label`,
|
|
655
676
|
className: "h-8",
|
|
656
677
|
value: v,
|
|
657
|
-
onChange: (e) =>
|
|
678
|
+
onChange: (e) => M({ label: e.target.value })
|
|
658
679
|
})]
|
|
659
|
-
}), /* @__PURE__ */
|
|
680
|
+
}), /* @__PURE__ */ H("div", {
|
|
660
681
|
className: "grid gap-1.5",
|
|
661
|
-
children: [/* @__PURE__ */
|
|
682
|
+
children: [/* @__PURE__ */ V(f, {
|
|
662
683
|
htmlFor: `${l}-at`,
|
|
663
684
|
children: c("contentEditor.versionPublishAt")
|
|
664
|
-
}), /* @__PURE__ */
|
|
685
|
+
}), /* @__PURE__ */ V(d, {
|
|
665
686
|
id: `${l}-at`,
|
|
666
687
|
className: "h-8",
|
|
667
688
|
type: "datetime-local",
|
|
668
|
-
value:
|
|
669
|
-
onChange: (e) =>
|
|
689
|
+
value: T,
|
|
690
|
+
onChange: (e) => M({ at: e.target.value })
|
|
670
691
|
})]
|
|
671
692
|
})]
|
|
672
693
|
}),
|
|
673
|
-
/* @__PURE__ */
|
|
694
|
+
/* @__PURE__ */ H("label", {
|
|
674
695
|
className: "flex items-center gap-2",
|
|
675
|
-
children: [/* @__PURE__ */
|
|
696
|
+
children: [/* @__PURE__ */ V(x, {
|
|
676
697
|
size: "sm",
|
|
677
|
-
checked:
|
|
678
|
-
onCheckedChange:
|
|
698
|
+
checked: C,
|
|
699
|
+
onCheckedChange: (e) => M({ draft: e })
|
|
679
700
|
}), c("contentEditor.versionDraft")]
|
|
680
701
|
}),
|
|
681
|
-
/* @__PURE__ */
|
|
702
|
+
/* @__PURE__ */ H("label", {
|
|
682
703
|
className: "flex items-center gap-2",
|
|
683
|
-
children: [/* @__PURE__ */
|
|
704
|
+
children: [/* @__PURE__ */ V(x, {
|
|
684
705
|
size: "sm",
|
|
685
|
-
checked:
|
|
686
|
-
onCheckedChange: M
|
|
706
|
+
checked: D,
|
|
707
|
+
onCheckedChange: (e) => M({ own: e })
|
|
687
708
|
}), c("contentEditor.ownAccess")]
|
|
688
709
|
}),
|
|
689
|
-
|
|
690
|
-
value:
|
|
691
|
-
onChange:
|
|
710
|
+
D && /* @__PURE__ */ V(Y, {
|
|
711
|
+
value: j,
|
|
712
|
+
onChange: (e) => M({ rule: e }),
|
|
692
713
|
model: i,
|
|
693
714
|
kind: e.kind,
|
|
694
715
|
owner: e.owner_group_id,
|
|
695
716
|
labels: o.labels,
|
|
696
717
|
client: u
|
|
697
718
|
}),
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
719
|
+
N && /* @__PURE__ */ V(y, { children: N }),
|
|
720
|
+
/* @__PURE__ */ V(y, { error: I.error }),
|
|
721
|
+
/* @__PURE__ */ H("div", {
|
|
700
722
|
className: "flex flex-wrap items-center gap-3",
|
|
701
723
|
children: [
|
|
702
|
-
/* @__PURE__ */
|
|
724
|
+
/* @__PURE__ */ V(s, {
|
|
703
725
|
type: "submit",
|
|
704
726
|
size: "sm",
|
|
705
|
-
disabled: I.pending || !
|
|
727
|
+
disabled: I.pending || !g.length || D && !X(j),
|
|
706
728
|
children: I.pending ? c("common.saving") : c("common.save")
|
|
707
729
|
}),
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
730
|
+
/* @__PURE__ */ V(q, { show: ne }),
|
|
731
|
+
/* @__PURE__ */ V(s, {
|
|
710
732
|
type: "button",
|
|
711
733
|
size: "sm",
|
|
712
734
|
variant: "destructive",
|
|
@@ -717,39 +739,39 @@ function me({ content: e, version: r, model: i, media: a, ...o }) {
|
|
|
717
739
|
})
|
|
718
740
|
]
|
|
719
741
|
}),
|
|
720
|
-
/* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ V(y, { error: R.error })
|
|
721
743
|
]
|
|
722
744
|
}),
|
|
723
|
-
/* @__PURE__ */
|
|
745
|
+
/* @__PURE__ */ V(A, {
|
|
724
746
|
offer: r.offer,
|
|
725
|
-
pending:
|
|
726
|
-
onSell: (t) =>
|
|
747
|
+
pending: B.pending,
|
|
748
|
+
onSell: (t) => B.run(() => u.offers.sell({
|
|
727
749
|
content: e.id,
|
|
728
750
|
version: r.id
|
|
729
751
|
}, t)),
|
|
730
|
-
onWithdraw: () => void
|
|
752
|
+
onWithdraw: () => void B.run(() => u.offers.withdraw({
|
|
731
753
|
content: e.id,
|
|
732
754
|
version: r.id
|
|
733
755
|
}))
|
|
734
756
|
}),
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
p?.segments && /* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ V(y, { error: B.error }),
|
|
758
|
+
p?.segments && /* @__PURE__ */ V($, {
|
|
737
759
|
content: e,
|
|
738
760
|
version: r,
|
|
739
761
|
...o
|
|
740
762
|
}),
|
|
741
|
-
a && /* @__PURE__ */
|
|
763
|
+
a && /* @__PURE__ */ V(ve, {
|
|
742
764
|
content: e,
|
|
743
765
|
version: r,
|
|
744
766
|
...o
|
|
745
767
|
}),
|
|
746
|
-
a && /* @__PURE__ */
|
|
768
|
+
a && /* @__PURE__ */ V(ye, {
|
|
747
769
|
content: e,
|
|
748
770
|
version: r,
|
|
749
771
|
model: i,
|
|
750
772
|
...o
|
|
751
773
|
}),
|
|
752
|
-
a && p?.presentation === "reader" && /* @__PURE__ */
|
|
774
|
+
a && p?.presentation === "reader" && /* @__PURE__ */ V(te, {
|
|
753
775
|
content: e.id,
|
|
754
776
|
version: r.id,
|
|
755
777
|
client: o.client,
|
|
@@ -758,9 +780,9 @@ function me({ content: e, version: r, model: i, media: a, ...o }) {
|
|
|
758
780
|
]
|
|
759
781
|
});
|
|
760
782
|
}
|
|
761
|
-
function
|
|
762
|
-
let { t: a } = t(), c = n(i.client), { presets: l } = o({ client: c }), u = b("content.save", i.onError), d =
|
|
763
|
-
if (
|
|
783
|
+
function ve({ content: e, version: r, ...i }) {
|
|
784
|
+
let { t: a } = t(), c = n(i.client), { presets: l } = o({ client: c }), u = b("content.save", i.onError), d = R(null), [f, p] = z(null);
|
|
785
|
+
if (I(() => () => void (f && URL.revokeObjectURL(f)), [f]), !l.some((t) => t.kind === e.kind && t.name === "cover")) return null;
|
|
764
786
|
let m = f ?? r.cover?.url, h = (t) => void u.run(async () => {
|
|
765
787
|
if (!t) return p(null), c.contents.setCover(e.id, r.id, null);
|
|
766
788
|
let n = {
|
|
@@ -770,26 +792,26 @@ function he({ content: e, version: r, ...i }) {
|
|
|
770
792
|
}, 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);
|
|
771
793
|
return typeof URL.createObjectURL == "function" && p(URL.createObjectURL(t)), a;
|
|
772
794
|
});
|
|
773
|
-
return /* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ H("div", {
|
|
774
796
|
className: "grid gap-1.5",
|
|
775
797
|
"data-ckui": "version-cover",
|
|
776
798
|
children: [
|
|
777
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ V("span", {
|
|
778
800
|
className: "text-sm font-medium",
|
|
779
801
|
children: a("contentManager.cover")
|
|
780
802
|
}),
|
|
781
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ H("div", {
|
|
782
804
|
className: "flex flex-wrap items-center gap-3",
|
|
783
805
|
children: [
|
|
784
|
-
m ? /* @__PURE__ */
|
|
806
|
+
m ? /* @__PURE__ */ V("img", {
|
|
785
807
|
src: m,
|
|
786
808
|
alt: "",
|
|
787
809
|
className: "h-20 w-36 rounded-md border border-border object-cover"
|
|
788
|
-
}) : /* @__PURE__ */
|
|
810
|
+
}) : /* @__PURE__ */ V("span", {
|
|
789
811
|
className: "text-muted-foreground",
|
|
790
812
|
children: a("contentManager.noCover")
|
|
791
813
|
}),
|
|
792
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ V(s, {
|
|
793
815
|
type: "button",
|
|
794
816
|
size: "sm",
|
|
795
817
|
variant: "outline",
|
|
@@ -797,7 +819,7 @@ function he({ content: e, version: r, ...i }) {
|
|
|
797
819
|
onClick: () => d.current?.click(),
|
|
798
820
|
children: a(m ? "pollEditor.replaceImage" : "contentManager.addCover")
|
|
799
821
|
}),
|
|
800
|
-
r.cover?.image && /* @__PURE__ */
|
|
822
|
+
r.cover?.image && /* @__PURE__ */ V(s, {
|
|
801
823
|
type: "button",
|
|
802
824
|
size: "sm",
|
|
803
825
|
variant: "ghost",
|
|
@@ -805,7 +827,7 @@ function he({ content: e, version: r, ...i }) {
|
|
|
805
827
|
onClick: () => h(null),
|
|
806
828
|
children: a("pollEditor.removeImage")
|
|
807
829
|
}),
|
|
808
|
-
/* @__PURE__ */
|
|
830
|
+
/* @__PURE__ */ V("input", {
|
|
809
831
|
ref: d,
|
|
810
832
|
type: "file",
|
|
811
833
|
accept: "image/*",
|
|
@@ -818,12 +840,12 @@ function he({ content: e, version: r, ...i }) {
|
|
|
818
840
|
})
|
|
819
841
|
]
|
|
820
842
|
}),
|
|
821
|
-
/* @__PURE__ */
|
|
843
|
+
/* @__PURE__ */ V(y, { error: u.error })
|
|
822
844
|
]
|
|
823
845
|
});
|
|
824
846
|
}
|
|
825
|
-
function
|
|
826
|
-
let { t: s } = t(), c = e(), u =
|
|
847
|
+
function ye({ content: n, version: r, model: i, ...o }) {
|
|
848
|
+
let { t: s } = t(), c = e(), u = L(() => ({
|
|
827
849
|
kind: n.kind,
|
|
828
850
|
id: n.id,
|
|
829
851
|
version: r.id
|
|
@@ -834,70 +856,90 @@ function ge({ content: n, version: r, model: i, ...o }) {
|
|
|
834
856
|
]), d = a(u, {
|
|
835
857
|
editor: !0,
|
|
836
858
|
client: o.client
|
|
837
|
-
}), f =
|
|
859
|
+
}), f = L(() => (i?.languages ?? []).map((e) => ({
|
|
838
860
|
value: e,
|
|
839
861
|
label: c(e)
|
|
840
862
|
})), [i, c]);
|
|
841
|
-
return !d.read && d.loading ? /* @__PURE__ */
|
|
863
|
+
return !d.read && d.loading ? /* @__PURE__ */ V(v, { className: "h-24 w-full" }) : d.read?.uploads && F(d.read.uploads).source ? /* @__PURE__ */ V(ne, {
|
|
842
864
|
item: u,
|
|
843
865
|
languages: f,
|
|
844
866
|
client: o.client,
|
|
845
867
|
onError: o.onError
|
|
846
|
-
}) : /* @__PURE__ */ B
|
|
868
|
+
}) : /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(l, {
|
|
847
869
|
item: u,
|
|
848
870
|
commit: r.live ? "manual" : "auto",
|
|
849
871
|
label: s("contentEditor.media"),
|
|
850
872
|
client: o.client,
|
|
851
873
|
onError: o.onError
|
|
852
|
-
}), i?.kinds[n.kind]?.presentation === "reader" && /* @__PURE__ */
|
|
874
|
+
}), i?.kinds[n.kind]?.presentation === "reader" && /* @__PURE__ */ V(P, {
|
|
853
875
|
content: n.id,
|
|
854
876
|
version: r.id,
|
|
855
877
|
client: o.client,
|
|
856
878
|
onError: o.onError
|
|
857
879
|
})] });
|
|
858
880
|
}
|
|
881
|
+
var be = (e) => e.segments.map((e) => ({
|
|
882
|
+
title: e.title ?? "",
|
|
883
|
+
start: String(e.start),
|
|
884
|
+
end: String(e.end),
|
|
885
|
+
release: w(e.release_at)
|
|
886
|
+
}));
|
|
859
887
|
function $({ content: e, version: r, ...i }) {
|
|
860
|
-
let { t: a } = t(), o = n(i.client), c = () => r.
|
|
861
|
-
title: e.title ?? "",
|
|
862
|
-
start: String(e.start),
|
|
863
|
-
end: String(e.end),
|
|
864
|
-
release: w(e.release_at)
|
|
865
|
-
})), [l, u] = L(c);
|
|
866
|
-
P(() => u(c()), [JSON.stringify(r.segments)]);
|
|
867
|
-
let [f, p] = L(!1), m = b("content.save", i.onError), h = (e, t) => {
|
|
888
|
+
let { t: a } = t(), o = n(i.client), c = O(L(() => ({ rows: be(r) }), [r])), l = c.value.rows, u = (e) => c.edit((t) => ({ rows: typeof e == "function" ? e(t.rows) : e })), [f, p] = z(!1), m = b("content.save", i.onError), h = (e, t) => {
|
|
868
889
|
p(!1), u((n) => n.map((n, r) => r === e ? {
|
|
869
890
|
...n,
|
|
870
891
|
...t
|
|
871
892
|
} : n));
|
|
872
|
-
}, g = l.every((e) => /^\d+$/.test(e.start) && /^\d+$/.test(e.end) && Number(e.end) > Number(e.start))
|
|
873
|
-
|
|
893
|
+
}, g = l.every((e) => /^\d+$/.test(e.start) && /^\d+$/.test(e.end) && Number(e.end) > Number(e.start)), _ = async () => {
|
|
894
|
+
if (!g) return !1;
|
|
895
|
+
p(!1);
|
|
896
|
+
let t = c.checkpoint(), n = l.map((e, t) => ({
|
|
897
|
+
position: t + 1,
|
|
898
|
+
title: e.title.trim() || void 0,
|
|
899
|
+
start: Number(e.start),
|
|
900
|
+
end: Number(e.end),
|
|
901
|
+
release_at: S(e.release),
|
|
902
|
+
released: !1
|
|
903
|
+
})), i = await m.run(() => o.contents.setSegments(e.id, r.id, n));
|
|
904
|
+
if (!i) return !1;
|
|
905
|
+
let a = t({ rows: be(i) });
|
|
906
|
+
return p(a), a;
|
|
907
|
+
};
|
|
908
|
+
return k(`segments:${r.id}`, {
|
|
909
|
+
label: a("contentEditor.segments"),
|
|
910
|
+
dirty: c.dirty.length > 0,
|
|
911
|
+
pending: m.pending,
|
|
912
|
+
valid: g,
|
|
913
|
+
save: _,
|
|
914
|
+
order: 20
|
|
915
|
+
}), /* @__PURE__ */ H("div", {
|
|
874
916
|
className: "grid gap-2",
|
|
875
917
|
"data-ckui": "segments-editor",
|
|
876
918
|
children: [
|
|
877
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ V("h4", {
|
|
878
920
|
className: "text-sm font-medium",
|
|
879
921
|
children: a("contentEditor.segments")
|
|
880
922
|
}),
|
|
881
|
-
l.length === 0 && /* @__PURE__ */
|
|
923
|
+
l.length === 0 && /* @__PURE__ */ V("p", {
|
|
882
924
|
className: "text-muted-foreground",
|
|
883
925
|
children: a("contentEditor.noSegments")
|
|
884
926
|
}),
|
|
885
|
-
l.map((e, t) => /* @__PURE__ */
|
|
927
|
+
l.map((e, t) => /* @__PURE__ */ H("div", {
|
|
886
928
|
className: "flex flex-wrap items-center gap-2",
|
|
887
929
|
"data-ckui": "segment-row",
|
|
888
930
|
children: [
|
|
889
|
-
/* @__PURE__ */
|
|
931
|
+
/* @__PURE__ */ V("span", {
|
|
890
932
|
className: "w-6 text-xs text-muted-foreground tabular-nums",
|
|
891
933
|
children: t + 1
|
|
892
934
|
}),
|
|
893
|
-
/* @__PURE__ */
|
|
935
|
+
/* @__PURE__ */ V(d, {
|
|
894
936
|
className: "h-8 w-40",
|
|
895
937
|
"aria-label": a("contentEditor.segmentTitle", { n: t + 1 }),
|
|
896
938
|
placeholder: a("contentEditor.segmentTitlePlaceholder"),
|
|
897
939
|
value: e.title,
|
|
898
940
|
onChange: (e) => h(t, { title: e.target.value })
|
|
899
941
|
}),
|
|
900
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ V(d, {
|
|
901
943
|
className: "h-8 w-20",
|
|
902
944
|
type: "number",
|
|
903
945
|
min: 0,
|
|
@@ -905,11 +947,11 @@ function $({ content: e, version: r, ...i }) {
|
|
|
905
947
|
value: e.start,
|
|
906
948
|
onChange: (e) => h(t, { start: e.target.value })
|
|
907
949
|
}),
|
|
908
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ V("span", {
|
|
909
951
|
"aria-hidden": !0,
|
|
910
952
|
children: "–"
|
|
911
953
|
}),
|
|
912
|
-
/* @__PURE__ */
|
|
954
|
+
/* @__PURE__ */ V(d, {
|
|
913
955
|
className: "h-8 w-20",
|
|
914
956
|
type: "number",
|
|
915
957
|
min: 1,
|
|
@@ -917,14 +959,14 @@ function $({ content: e, version: r, ...i }) {
|
|
|
917
959
|
value: e.end,
|
|
918
960
|
onChange: (e) => h(t, { end: e.target.value })
|
|
919
961
|
}),
|
|
920
|
-
/* @__PURE__ */
|
|
962
|
+
/* @__PURE__ */ V(d, {
|
|
921
963
|
className: "h-8 w-48",
|
|
922
964
|
type: "datetime-local",
|
|
923
965
|
"aria-label": a("contentEditor.segmentRelease", { n: t + 1 }),
|
|
924
966
|
value: e.release,
|
|
925
967
|
onChange: (e) => h(t, { release: e.target.value })
|
|
926
968
|
}),
|
|
927
|
-
/* @__PURE__ */
|
|
969
|
+
/* @__PURE__ */ V(s, {
|
|
928
970
|
type: "button",
|
|
929
971
|
size: "xs",
|
|
930
972
|
variant: "ghost",
|
|
@@ -933,10 +975,10 @@ function $({ content: e, version: r, ...i }) {
|
|
|
933
975
|
})
|
|
934
976
|
]
|
|
935
977
|
}, t)),
|
|
936
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ H("div", {
|
|
937
979
|
className: "flex flex-wrap items-center gap-2",
|
|
938
980
|
children: [
|
|
939
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ V(s, {
|
|
940
982
|
type: "button",
|
|
941
983
|
size: "sm",
|
|
942
984
|
variant: "outline",
|
|
@@ -951,60 +993,49 @@ function $({ content: e, version: r, ...i }) {
|
|
|
951
993
|
},
|
|
952
994
|
children: a("contentEditor.addSegment")
|
|
953
995
|
}),
|
|
954
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ V(s, {
|
|
955
997
|
type: "button",
|
|
956
998
|
size: "sm",
|
|
957
999
|
disabled: m.pending || !g,
|
|
958
|
-
onClick: () =>
|
|
959
|
-
p(!1);
|
|
960
|
-
let t = l.map((e, t) => ({
|
|
961
|
-
position: t + 1,
|
|
962
|
-
title: e.title.trim() || void 0,
|
|
963
|
-
start: Number(e.start),
|
|
964
|
-
end: Number(e.end),
|
|
965
|
-
release_at: S(e.release),
|
|
966
|
-
released: !1
|
|
967
|
-
}));
|
|
968
|
-
m.run(() => o.contents.setSegments(e.id, r.id, t)).then((e) => e && p(!0));
|
|
969
|
-
},
|
|
1000
|
+
onClick: () => void _(),
|
|
970
1001
|
children: a("contentEditor.saveSegments")
|
|
971
1002
|
}),
|
|
972
|
-
/* @__PURE__ */
|
|
1003
|
+
/* @__PURE__ */ V(q, { show: f })
|
|
973
1004
|
]
|
|
974
1005
|
}),
|
|
975
|
-
/* @__PURE__ */
|
|
1006
|
+
/* @__PURE__ */ V(y, { error: m.error })
|
|
976
1007
|
]
|
|
977
1008
|
});
|
|
978
1009
|
}
|
|
979
|
-
function
|
|
980
|
-
let r = e(), i =
|
|
1010
|
+
function xe({ content: t, ...n }) {
|
|
1011
|
+
let r = e(), i = L(() => t.versions.map((e) => ({
|
|
981
1012
|
id: e.id,
|
|
982
|
-
label:
|
|
1013
|
+
label: Q(e, r, n.labels)
|
|
983
1014
|
})), [
|
|
984
1015
|
t.versions,
|
|
985
1016
|
r,
|
|
986
1017
|
n.labels
|
|
987
|
-
]), { spec: a } =
|
|
988
|
-
return /* @__PURE__ */
|
|
989
|
-
className:
|
|
1018
|
+
]), { spec: a } = J(t.kind, n.client);
|
|
1019
|
+
return /* @__PURE__ */ H("div", {
|
|
1020
|
+
className: U("grid gap-6", n.className),
|
|
990
1021
|
"data-ckui": "content-sections",
|
|
991
1022
|
children: [
|
|
992
|
-
/* @__PURE__ */
|
|
1023
|
+
/* @__PURE__ */ V(ue, {
|
|
993
1024
|
content: t,
|
|
994
1025
|
...n
|
|
995
1026
|
}),
|
|
996
|
-
/* @__PURE__ */
|
|
1027
|
+
/* @__PURE__ */ V(fe, {
|
|
997
1028
|
content: t,
|
|
998
1029
|
...n
|
|
999
1030
|
}),
|
|
1000
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ V(me, {
|
|
1001
1032
|
content: t,
|
|
1002
1033
|
...n
|
|
1003
1034
|
}),
|
|
1004
|
-
!!a?.entities?.length && /* @__PURE__ */
|
|
1035
|
+
!!a?.entities?.length && /* @__PURE__ */ V("section", {
|
|
1005
1036
|
className: "grid gap-3 border-t border-border pt-4",
|
|
1006
1037
|
"data-ckui": "content-groups",
|
|
1007
|
-
children: /* @__PURE__ */
|
|
1038
|
+
children: /* @__PURE__ */ V(N, {
|
|
1008
1039
|
management: n.management,
|
|
1009
1040
|
content: t.id,
|
|
1010
1041
|
contentKind: t.kind,
|
|
@@ -1018,6 +1049,6 @@ function _e({ content: t, ...n }) {
|
|
|
1018
1049
|
});
|
|
1019
1050
|
}
|
|
1020
1051
|
//#endregion
|
|
1021
|
-
export {
|
|
1052
|
+
export { fe as AccessEditor, ue as ContentDetailsEditor, xe as ContentSections, Y as RuleFields, $ as SegmentsEditor, ve as VersionCover, me as VersionsEditor, Z as cleanRule, X as complete, Q as versionLabel };
|
|
1022
1053
|
|
|
1023
1054
|
//# sourceMappingURL=editors.js.map
|