@openrails/contentkit-ui 0.85.1 → 0.87.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.
Files changed (211) hide show
  1. package/README.md +28 -7
  2. package/dist/client/beacons.d.ts +13 -4
  3. package/dist/client/beacons.js +14 -7
  4. package/dist/client/beacons.js.map +1 -1
  5. package/dist/client/client.d.ts +3 -0
  6. package/dist/client/client.js +29 -27
  7. package/dist/client/client.js.map +1 -1
  8. package/dist/client/codes.d.ts +6 -1
  9. package/dist/client/codes.js +4 -1
  10. package/dist/client/codes.js.map +1 -1
  11. package/dist/client/content/types.d.ts +4 -2
  12. package/dist/client/content/types.js.map +1 -1
  13. package/dist/client/discovery.js +3 -0
  14. package/dist/client/discovery.js.map +1 -1
  15. package/dist/client/errors.d.ts +6 -0
  16. package/dist/client/errors.js +6 -2
  17. package/dist/client/errors.js.map +1 -1
  18. package/dist/client/gallery.d.ts +3 -5
  19. package/dist/client/gallery.js +16 -20
  20. package/dist/client/gallery.js.map +1 -1
  21. package/dist/client/generated/error-codes.d.ts +1 -1
  22. package/dist/client/generated/error-codes.js +9 -1
  23. package/dist/client/generated/error-codes.js.map +1 -1
  24. package/dist/client/generated/routes.d.ts +29 -3
  25. package/dist/client/generated/routes.js +44 -3
  26. package/dist/client/generated/routes.js.map +1 -1
  27. package/dist/client/generated/wire.d.ts +60 -10
  28. package/dist/client/generated/wire.js.map +1 -1
  29. package/dist/client/index.d.ts +2 -1
  30. package/dist/client/media/queue.d.ts +4 -2
  31. package/dist/client/media/queue.js +18 -12
  32. package/dist/client/media/queue.js.map +1 -1
  33. package/dist/client/media/rules.d.ts +7 -1
  34. package/dist/client/media/rules.js +27 -21
  35. package/dist/client/media/rules.js.map +1 -1
  36. package/dist/client/media/windows.js +1 -1
  37. package/dist/client/media/windows.js.map +1 -1
  38. package/dist/client/stats.d.ts +32 -0
  39. package/dist/client/stats.js +35 -0
  40. package/dist/client/stats.js.map +1 -0
  41. package/dist/client/versions.d.ts +6 -4
  42. package/dist/client/versions.js +24 -26
  43. package/dist/client/versions.js.map +1 -1
  44. package/dist/client.js +30 -29
  45. package/dist/components/admin/content-manager.js +206 -206
  46. package/dist/components/admin/content-manager.js.map +1 -1
  47. package/dist/components/admin/group-manager.js +71 -70
  48. package/dist/components/admin/group-manager.js.map +1 -1
  49. package/dist/components/admin/media-item-panel.d.ts +24 -7
  50. package/dist/components/admin/media-item-panel.js +209 -197
  51. package/dist/components/admin/media-item-panel.js.map +1 -1
  52. package/dist/components/admin/poll-manager.js +25 -25
  53. package/dist/components/admin/stats-dashboard.d.ts +22 -0
  54. package/dist/components/admin/stats-dashboard.js +257 -0
  55. package/dist/components/admin/stats-dashboard.js.map +1 -0
  56. package/dist/components/content/card.d.ts +5 -3
  57. package/dist/components/content/card.js +155 -133
  58. package/dist/components/content/card.js.map +1 -1
  59. package/dist/components/content/download-button.d.ts +26 -0
  60. package/dist/components/content/download-button.js +51 -0
  61. package/dist/components/content/download-button.js.map +1 -0
  62. package/dist/components/content/editors.js +455 -427
  63. package/dist/components/content/editors.js.map +1 -1
  64. package/dist/components/content/grid.d.ts +8 -1
  65. package/dist/components/content/grid.js +153 -104
  66. package/dist/components/content/grid.js.map +1 -1
  67. package/dist/components/content/index.d.ts +4 -2
  68. package/dist/components/content/listing.d.ts +3 -1
  69. package/dist/components/content/listing.js +34 -34
  70. package/dist/components/content/listing.js.map +1 -1
  71. package/dist/components/content/paywall.d.ts +17 -5
  72. package/dist/components/content/paywall.js +115 -100
  73. package/dist/components/content/paywall.js.map +1 -1
  74. package/dist/components/content/reader-stats.d.ts +12 -0
  75. package/dist/components/content/reader-stats.js +47 -0
  76. package/dist/components/content/reader-stats.js.map +1 -0
  77. package/dist/components/groups/banner.js +33 -33
  78. package/dist/components/groups/directory.js +11 -11
  79. package/dist/components/groups/editor.js +293 -293
  80. package/dist/components/groups/editor.js.map +1 -1
  81. package/dist/components/groups/header.js +27 -27
  82. package/dist/components/groups/header.js.map +1 -1
  83. package/dist/components/groups/memberships.js +180 -180
  84. package/dist/components/groups/parts.d.ts +0 -2
  85. package/dist/components/groups/parts.js +9 -27
  86. package/dist/components/groups/parts.js.map +1 -1
  87. package/dist/components/media-folder-editor.js +239 -189
  88. package/dist/components/media-folder-editor.js.map +1 -1
  89. package/dist/components/media-gallery.d.ts +1 -4
  90. package/dist/components/media-gallery.js +19 -34
  91. package/dist/components/media-gallery.js.map +1 -1
  92. package/dist/components/notifications.js +17 -17
  93. package/dist/components/slot-upload.d.ts +2 -2
  94. package/dist/components/slot-upload.js +84 -79
  95. package/dist/components/slot-upload.js.map +1 -1
  96. package/dist/components/social/bans.js +34 -34
  97. package/dist/components/social/comments.js +1 -1
  98. package/dist/components/social/comments.js.map +1 -1
  99. package/dist/components/social/engagement.d.ts +2 -1
  100. package/dist/components/social/engagement.js +5 -3
  101. package/dist/components/social/engagement.js.map +1 -1
  102. package/dist/components/social/moderation.js +52 -48
  103. package/dist/components/social/moderation.js.map +1 -1
  104. package/dist/components/video-player.d.ts +2 -0
  105. package/dist/components/video-player.js +318 -314
  106. package/dist/components/video-player.js.map +1 -1
  107. package/dist/i18n/context.d.ts +2 -0
  108. package/dist/i18n/context.js +23 -5
  109. package/dist/i18n/context.js.map +1 -1
  110. package/dist/index.d.ts +2 -1
  111. package/dist/index.js +13 -10
  112. package/dist/locales/admin/de.js +27 -0
  113. package/dist/locales/admin/de.js.map +1 -1
  114. package/dist/locales/admin/en.d.ts +27 -0
  115. package/dist/locales/admin/en.js +27 -0
  116. package/dist/locales/admin/en.js.map +1 -1
  117. package/dist/locales/admin/es.js +27 -0
  118. package/dist/locales/admin/es.js.map +1 -1
  119. package/dist/locales/admin/ja.js +27 -0
  120. package/dist/locales/admin/ja.js.map +1 -1
  121. package/dist/locales/admin/ko.js +27 -0
  122. package/dist/locales/admin/ko.js.map +1 -1
  123. package/dist/locales/admin/zh.js +27 -0
  124. package/dist/locales/admin/zh.js.map +1 -1
  125. package/dist/locales/content/de.js +6 -0
  126. package/dist/locales/content/de.js.map +1 -1
  127. package/dist/locales/content/en.d.ts +6 -0
  128. package/dist/locales/content/en.js +6 -0
  129. package/dist/locales/content/en.js.map +1 -1
  130. package/dist/locales/content/es.js +6 -0
  131. package/dist/locales/content/es.js.map +1 -1
  132. package/dist/locales/content/ja.js +6 -0
  133. package/dist/locales/content/ja.js.map +1 -1
  134. package/dist/locales/content/ko.js +6 -0
  135. package/dist/locales/content/ko.js.map +1 -1
  136. package/dist/locales/content/zh.js +6 -0
  137. package/dist/locales/content/zh.js.map +1 -1
  138. package/dist/locales/de.js +14 -2
  139. package/dist/locales/de.js.map +1 -1
  140. package/dist/locales/discovery/de.js +3 -0
  141. package/dist/locales/discovery/de.js.map +1 -1
  142. package/dist/locales/discovery/en.d.ts +3 -0
  143. package/dist/locales/discovery/en.js +3 -0
  144. package/dist/locales/discovery/en.js.map +1 -1
  145. package/dist/locales/discovery/es.js +3 -0
  146. package/dist/locales/discovery/es.js.map +1 -1
  147. package/dist/locales/discovery/ja.js +3 -0
  148. package/dist/locales/discovery/ja.js.map +1 -1
  149. package/dist/locales/discovery/ko.js +3 -0
  150. package/dist/locales/discovery/ko.js.map +1 -1
  151. package/dist/locales/discovery/zh.js +3 -0
  152. package/dist/locales/discovery/zh.js.map +1 -1
  153. package/dist/locales/en.d.ts +50 -2
  154. package/dist/locales/en.js +14 -2
  155. package/dist/locales/en.js.map +1 -1
  156. package/dist/locales/es.js +14 -2
  157. package/dist/locales/es.js.map +1 -1
  158. package/dist/locales/ja.js +14 -2
  159. package/dist/locales/ja.js.map +1 -1
  160. package/dist/locales/ko.js +14 -2
  161. package/dist/locales/ko.js.map +1 -1
  162. package/dist/locales/zh.js +14 -2
  163. package/dist/locales/zh.js.map +1 -1
  164. package/dist/react/admin.js +22 -23
  165. package/dist/react/admin.js.map +1 -1
  166. package/dist/react/canonical.d.ts +4 -3
  167. package/dist/react/canonical.js +34 -33
  168. package/dist/react/canonical.js.map +1 -1
  169. package/dist/react/comments.d.ts +1 -1
  170. package/dist/react/comments.js +3 -2
  171. package/dist/react/comments.js.map +1 -1
  172. package/dist/react/contents.js +144 -144
  173. package/dist/react/contents.js.map +1 -1
  174. package/dist/react/context.d.ts +1 -1
  175. package/dist/react/context.js.map +1 -1
  176. package/dist/react/detail.d.ts +12 -6
  177. package/dist/react/detail.js +31 -24
  178. package/dist/react/detail.js.map +1 -1
  179. package/dist/react/discovery.d.ts +11 -0
  180. package/dist/react/discovery.js +49 -30
  181. package/dist/react/discovery.js.map +1 -1
  182. package/dist/react/engagement.d.ts +6 -2
  183. package/dist/react/engagement.js +2 -6
  184. package/dist/react/engagement.js.map +1 -1
  185. package/dist/react/folder.d.ts +7 -2
  186. package/dist/react/folder.js +165 -147
  187. package/dist/react/folder.js.map +1 -1
  188. package/dist/react/groups.d.ts +0 -1
  189. package/dist/react/groups.js +13 -12
  190. package/dist/react/groups.js.map +1 -1
  191. package/dist/react/index.d.ts +6 -4
  192. package/dist/react/location.d.ts +11 -0
  193. package/dist/react/location.js +18 -0
  194. package/dist/react/location.js.map +1 -0
  195. package/dist/react/public.d.ts +8 -0
  196. package/dist/react/public.js +32 -27
  197. package/dist/react/public.js.map +1 -1
  198. package/dist/react/stats.d.ts +24 -0
  199. package/dist/react/stats.js +28 -0
  200. package/dist/react/stats.js.map +1 -0
  201. package/dist/react/use-resource.js +8 -7
  202. package/dist/react/use-resource.js.map +1 -1
  203. package/dist/react/versions.d.ts +25 -5
  204. package/dist/react/versions.js +61 -40
  205. package/dist/react/versions.js.map +1 -1
  206. package/dist/react.js +26 -24
  207. package/dist/styles.css +1 -1
  208. package/dist/urls/index.d.ts +35 -10
  209. package/dist/urls.js +100 -70
  210. package/dist/urls.js.map +1 -1
  211. package/package.json +1 -1
@@ -1,28 +1,29 @@
1
1
  import { toContentKitError as e } from "../client/errors.js";
2
- import { useMediaRead as t } from "./read.js";
2
+ import { useMessages as t } from "../i18n/context.js";
3
3
  import { keyOf as n, useContentScope as r, useResource as i } from "./use-resource.js";
4
- import { isPending as a } from "../client/versions.js";
5
- import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
4
+ import { useMediaRead as a } from "./read.js";
5
+ import { isPending as o } from "../client/versions.js";
6
+ import { useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
6
7
  //#region src/react/versions.ts
7
- var u = 2 ** 31 - 1;
8
- function d(e, t = Date.now()) {
8
+ var d = 2 ** 31 - 1;
9
+ function f(e, t = Date.now()) {
9
10
  let n = (e?.segments ?? []).flatMap((e) => !e.released && e.release_at ? [Date.parse(e.release_at)] : []).filter((e) => e > t);
10
11
  return n.length ? Math.min(...n) : null;
11
12
  }
12
- function f(e, t, o = {}) {
13
- let { client: c, store: l, scope: f } = r(o.client), p = e && t ? n("reader-plan", f, e, t) : null, m = i(l, p, {
13
+ function p(e, t, a = {}) {
14
+ let { client: s, store: l, scope: u } = r(a.client), p = e && t ? n("reader-plan", u, e, t) : null, m = i(l, p, {
14
15
  type: "reader-plan",
15
16
  id: t ?? void 0
16
- }, (n) => c.versions.reader(e, t, n)), h = a(m.data), g = m.data && !h ? m.data : null, { data: _, reload: v } = m;
17
- return s(() => {
18
- let e = a(_) ? Date.now() + (o.poll ?? 5e3) : d(_ || null);
17
+ }, (n) => s.versions.reader(e, t, n)), h = o(m.data), g = m.data && !h ? m.data : null, { data: _, reload: v } = m;
18
+ return c(() => {
19
+ let e = o(_) ? Date.now() + (a.poll ?? 5e3) : f(_ || null);
19
20
  if (e === null) return;
20
- let t = setTimeout(v, Math.min(u, Math.max(0, e - Date.now()) + 500));
21
+ let t = setTimeout(v, Math.min(d, Math.max(0, e - Date.now()) + 500));
21
22
  return () => clearTimeout(t);
22
23
  }, [
23
24
  _,
24
25
  v,
25
- o.poll
26
+ a.poll
26
27
  ]), {
27
28
  plan: g,
28
29
  pending: h,
@@ -31,64 +32,84 @@ function f(e, t, o = {}) {
31
32
  reload: v
32
33
  };
33
34
  }
34
- function p(e, n, r = {}) {
35
- let i = e?.item ?? null, a = t(i ?? {
35
+ function m(e, t, n = {}) {
36
+ let r = e?.item ?? null, i = a(r ?? {
36
37
  kind: "",
37
38
  id: ""
38
39
  }, {
39
- window: r.window,
40
- read: i ? void 0 : null,
41
- client: r.client
40
+ window: n.window,
41
+ read: r ? void 0 : null,
42
+ client: n.client
42
43
  });
43
44
  return {
44
- pages: c(() => {
45
- let t = new Map((a.read?.files ?? []).flatMap((e) => e.url ? [[e.path, e.url]] : []));
45
+ pages: l(() => {
46
+ let n = new Map((i.read?.files ?? []).flatMap((e) => e.url ? [[e.path, e.url]] : []));
46
47
  return (e?.pages ?? []).map((e) => {
47
- let r = e.files[n];
48
+ let r = e.files[t];
48
49
  return {
49
50
  name: e.name,
50
51
  w: e.w,
51
52
  h: e.h,
52
- url: r ? t.get(r) : void 0
53
+ url: r ? n.get(r) : void 0
53
54
  };
54
55
  });
55
56
  }, [
56
57
  e,
57
- n,
58
- a.read
58
+ t,
59
+ i.read
59
60
  ]),
60
- loading: !!i && a.loading,
61
- error: a.error
61
+ loading: !!r && i.loading,
62
+ error: i.error
62
63
  };
63
64
  }
64
- function m(t, n, i = {}) {
65
- let { client: s } = r(i.client), [c, u] = l(!1), [d, f] = l();
65
+ function h(e) {
66
+ let t = document.createElement("a");
67
+ t.href = e.url, t.download = e.name, t.rel = "noopener", t.style.display = "none", document.body.appendChild(t), t.click(), t.remove();
68
+ }
69
+ function g(e, t, n = Date.now()) {
70
+ switch (t?.code) {
71
+ case void 0: return;
72
+ case "rate_limited": return e.t("versionDownload.limited", { minutes: Math.max(1, Math.ceil((t.retryAfter ?? 60) / 60)) });
73
+ case "download_unavailable": {
74
+ let r = t.availableAt ? Date.parse(t.availableAt) - n : NaN;
75
+ return r > 0 ? e.plural("versionDownload.availableIn", Math.max(1, Math.ceil(r / 864e5))) : e.t("versionDownload.unavailable");
76
+ }
77
+ case "forbidden": return e.t("versionDownload.locked");
78
+ case "no_download": return e.error(t);
79
+ default: return e.t("versionDownload.failed");
80
+ }
81
+ }
82
+ function _(n, i, a = {}) {
83
+ let { client: c } = r(a.client), l = t(), [d, f] = u(!1), [p, m] = u(), [_, v] = u(), y = a.start ?? h;
66
84
  return {
67
- download: o(async () => {
68
- f(void 0), u(!0);
85
+ download: s(async () => {
86
+ m(void 0), v(void 0), f(!0);
69
87
  try {
70
88
  for (;;) {
71
- let e = await s.versions.download(t, n);
72
- if (!a(e)) return e;
73
- await new Promise((e) => setTimeout(e, i.poll ?? 3e3));
89
+ let e = await c.versions.download(n, i);
90
+ if (!o(e)) return y(e), e;
91
+ await new Promise((e) => setTimeout(e, a.poll ?? 3e3));
74
92
  }
75
93
  } catch (t) {
76
94
  let n = e(t);
77
- throw f(n), n;
95
+ throw m(n), n.code === "rate_limited" && v(Date.now() + (n.retryAfter ?? 60) * 1e3), n;
78
96
  } finally {
79
- u(!1);
97
+ f(!1);
80
98
  }
81
99
  }, [
82
- s,
83
- t,
100
+ c,
84
101
  n,
85
- i.poll
102
+ i,
103
+ a.poll,
104
+ y
86
105
  ]),
87
- preparing: c,
88
- error: d
106
+ preparing: d,
107
+ error: p,
108
+ retryAt: _,
109
+ message: g(l, p)
89
110
  };
90
111
  }
91
112
  //#endregion
92
- export { d as nextRelease, f as useReaderPlan, p as useSegmentPages, m as useVersionDownload };
113
+ export { g as downloadMessage, f as nextRelease, h as startDownload, p as useReaderPlan, m as useSegmentPages, _ as useVersionDownload };
93
114
 
94
115
  //# sourceMappingURL=versions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","names":[],"sources":["../../src/react/versions.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { ContentKitClient } from \"../client/client.js\";\nimport { toContentKitError, type ContentKitError } from \"../client/errors.js\";\nimport type { Pending, PlanSegment, ReaderPlan } from \"../client/generated/wire.js\";\nimport { isPending } from \"../client/versions.js\";\nimport { useMediaRead, type ReadWindow } from \"./read.js\";\nimport { keyOf, useContentScope, useResource } from \"./use-resource.js\";\n\nexport interface UseReaderPlan {\n /** null while loading, pending or failed. */\n plan: ReaderPlan | null;\n /** The version has no current publication yet; the hook asks again. */\n pending: boolean;\n loading: boolean;\n error?: ContentKitError;\n reload: () => void;\n}\n\n// setTimeout's longest delay.\nconst MAX_DELAY = 2 ** 31 - 1;\n\n/** When the plan changes by itself: its next scheduled segment's release. */\nexport function nextRelease(plan: ReaderPlan | null, now = Date.now()): number | null {\n const at = (plan?.segments ?? []).flatMap((s) => (!s.released && s.release_at ? [Date.parse(s.release_at)] : [])).filter((t) => t > now);\n return at.length ? Math.min(...at) : null;\n}\n\n/**\n * A version's reader plan for this viewer: its segments (released or not,\n * open or locked), previews, playback item and reader metadata. It asks again\n * while the version is being published and when its next segment is released.\n */\nexport function useReaderPlan(content: string | null | undefined, version: string | null | undefined, o: { poll?: number; client?: ContentKitClient } = {}): UseReaderPlan {\n const { client, store, scope } = useContentScope(o.client);\n const key = content && version ? keyOf(\"reader-plan\", scope, content, version) : null;\n const r = useResource<ReaderPlan | Pending>(store, key, { type: \"reader-plan\", id: version ?? undefined }, (s) => client.versions.reader(content!, version!, s));\n const pending = isPending(r.data);\n const plan = r.data && !pending ? (r.data as ReaderPlan) : null;\n const { data, reload } = r;\n // Every answer schedules the next look: a pending one polls, a plan waits for its next release.\n useEffect(() => {\n const at = isPending(data) ? Date.now() + (o.poll ?? 5000) : nextRelease(data ? (data as ReaderPlan) : null);\n if (at === null) return;\n const t = setTimeout(reload, Math.min(MAX_DELAY, Math.max(0, at - Date.now()) + 500));\n return () => clearTimeout(t);\n }, [data, reload, o.poll]);\n return { plan, pending, loading: !!key && (r.loading || !r.loaded), error: r.error, reload };\n}\n\n/** A segment's page with the URL of one rendition, once its item's read signed it. */\nexport interface ReaderPage {\n name: string;\n w: number;\n h: number;\n /** undefined until read, or when the page lacks the rendition. */\n url?: string;\n}\n\nexport interface UseSegmentPages {\n pages: ReaderPage[];\n loading: boolean;\n error?: ContentKitError;\n}\n\n/**\n * An open segment's pages with URLs of one rendition, read through its\n * published item (windowed for long segments, refreshed before the URLs expire).\n */\nexport function useSegmentPages(segment: PlanSegment | null | undefined, rendition: string, o: { window?: ReadWindow; client?: ContentKitClient } = {}): UseSegmentPages {\n const item = segment?.item ?? null;\n const read = useMediaRead(item ?? { kind: \"\", id: \"\" }, { window: o.window, read: item ? undefined : null, client: o.client });\n const pages = useMemo(() => {\n const urls = new Map((read.read?.files ?? []).flatMap((f) => (f.url ? [[f.path, f.url] as const] : [])));\n return (segment?.pages ?? []).map((p) => {\n const path = p.files[rendition];\n return { name: p.name, w: p.w, h: p.h, url: path ? urls.get(path) : undefined };\n });\n }, [segment, rendition, read.read]);\n return { pages, loading: !!item && read.loading, error: read.error };\n}\n\nexport interface UseVersionDownload {\n /** Prepares the zip (asking again while it is prepared) and resolves with it. */\n download: () => Promise<Blob>;\n /** Prepared by the server, waiting. */\n preparing: boolean;\n error?: ContentKitError;\n}\n\n/** A version's pages as a zip, charged to the viewer's download quota. */\nexport function useVersionDownload(content: string, version: string, o: { poll?: number; client?: ContentKitClient } = {}): UseVersionDownload {\n const { client } = useContentScope(o.client);\n const [preparing, setPreparing] = useState(false);\n const [error, setError] = useState<ContentKitError>();\n const download = useCallback(async () => {\n setError(undefined);\n setPreparing(true);\n try {\n for (;;) {\n const out = await client.versions.download(content, version);\n if (!isPending(out)) return out;\n await new Promise((r) => setTimeout(r, o.poll ?? 3000));\n }\n } catch (e) {\n const err = toContentKitError(e);\n setError(err);\n throw err;\n } finally {\n setPreparing(false);\n }\n }, [client, content, version, o.poll]);\n return { download, preparing, error };\n}\n"],"mappings":";;;;;;AAmBA,IAAM,IAAY,KAAK,KAAK;AAG5B,SAAgB,EAAY,GAAyB,IAAM,KAAK,IAAI,GAAkB;CACpF,IAAM,KAAM,GAAM,YAAY,CAAC,EAAA,CAAG,SAAS,MAAO,CAAC,EAAE,YAAY,EAAE,aAAa,CAAC,KAAK,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,CAAE,CAAC,CAAC,QAAQ,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AC,EAAA,CAAG,SAAS,MAAO,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAU,IAAI,CAAC,CAAE,CAAC;GACvG,QAAQ,GAAS,SAAS,CAAC,EAAA,CAAG,KAAK,MAAM;IACvC,IAAM,IAAO,EAAE,MAAM;IACrB,OAAO;KAAE,MAAM,EAAE;KAAM,GAAG,EAAE;KAAG,GAAG,EAAE;KAAG,KAAK,IAAO,EAAK,IAAI,CAAI,IAAI,KAAA;IAAU;GAChF,CAAC;EACH,GAAG;GAAC;GAAS;GAAW,EAAK;EAAI,CACxB;EAAO,SAAS,CAAC,CAAC,KAAQ,EAAK;EAAS,OAAO,EAAK;CAAM;AACrE;AAWA,SAAgB,EAAmB,GAAiB,GAAiB,IAAkD,CAAC,GAAuB;CAC7I,IAAM,EAAE,cAAW,EAAgB,EAAE,MAAM,GACrC,CAAC,GAAW,KAAgB,EAAS,EAAK,GAC1C,CAAC,GAAO,KAAY,EAA0B;CAkBpD,OAAO;EAAE,UAjBQ,EAAY,YAAY;GAEvC,AADA,EAAS,KAAA,CAAS,GAClB,EAAa,EAAI;GACjB,IAAI;IACF,SAAS;KACP,IAAM,IAAM,MAAM,EAAO,SAAS,SAAS,GAAS,CAAO;KAC3D,IAAI,CAAC,EAAU,CAAG,GAAG,OAAO;KAC5B,MAAM,IAAI,SAAS,MAAM,WAAW,GAAG,EAAE,QAAQ,GAAI,CAAC;IACxD;GACF,SAAS,GAAG;IACV,IAAM,IAAM,EAAkB,CAAC;IAE/B,MADA,EAAS,CAAG,GACN;GACR,UAAU;IACR,EAAa,EAAK;GACpB;EACF,GAAG;GAAC;GAAQ;GAAS;GAAS,EAAE;EAAI,CAC3B;EAAU;EAAW;CAAM;AACtC"}
1
+ {"version":3,"file":"versions.js","names":[],"sources":["../../src/react/versions.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { ContentKitClient } from \"../client/client.js\";\nimport { toContentKitError, type ContentKitError } from \"../client/errors.js\";\nimport type { FileDownload, Pending, PlanSegment, ReaderPlan } from \"../client/generated/wire.js\";\nimport { isPending } from \"../client/versions.js\";\nimport { useMessages } from \"../i18n/context.js\";\nimport type { Translator } from \"../i18n/messages.js\";\nimport { useMediaRead, type ReadWindow } from \"./read.js\";\nimport { keyOf, useContentScope, useResource } from \"./use-resource.js\";\n\nexport interface UseReaderPlan {\n /** null while loading, pending or failed. */\n plan: ReaderPlan | null;\n /** The version has no current publication yet; the hook asks again. */\n pending: boolean;\n loading: boolean;\n error?: ContentKitError;\n reload: () => void;\n}\n\n// setTimeout's longest delay.\nconst MAX_DELAY = 2 ** 31 - 1;\n\n/** When the plan changes by itself: its next scheduled segment's release. */\nexport function nextRelease(plan: ReaderPlan | null, now = Date.now()): number | null {\n const at = (plan?.segments ?? []).flatMap((s) => (!s.released && s.release_at ? [Date.parse(s.release_at)] : [])).filter((t) => t > now);\n return at.length ? Math.min(...at) : null;\n}\n\n/**\n * A version's reader plan for this viewer: its segments (released or not,\n * open or locked), previews, playback item and reader metadata. It asks again\n * while the version is being published and when its next segment is released.\n */\nexport function useReaderPlan(content: string | null | undefined, version: string | null | undefined, o: { poll?: number; client?: ContentKitClient } = {}): UseReaderPlan {\n const { client, store, scope } = useContentScope(o.client);\n const key = content && version ? keyOf(\"reader-plan\", scope, content, version) : null;\n const r = useResource<ReaderPlan | Pending>(store, key, { type: \"reader-plan\", id: version ?? undefined }, (s) => client.versions.reader(content!, version!, s));\n const pending = isPending(r.data);\n const plan = r.data && !pending ? (r.data as ReaderPlan) : null;\n const { data, reload } = r;\n // Every answer schedules the next look: a pending one polls, a plan waits for its next release.\n useEffect(() => {\n const at = isPending(data) ? Date.now() + (o.poll ?? 5000) : nextRelease(data ? (data as ReaderPlan) : null);\n if (at === null) return;\n const t = setTimeout(reload, Math.min(MAX_DELAY, Math.max(0, at - Date.now()) + 500));\n return () => clearTimeout(t);\n }, [data, reload, o.poll]);\n return { plan, pending, loading: !!key && (r.loading || !r.loaded), error: r.error, reload };\n}\n\n/** A segment's page with the URL of one rendition, once its item's read signed it. */\nexport interface ReaderPage {\n name: string;\n w: number;\n h: number;\n /** undefined until read, or when the page lacks the rendition. */\n url?: string;\n}\n\nexport interface UseSegmentPages {\n pages: ReaderPage[];\n loading: boolean;\n error?: ContentKitError;\n}\n\n/**\n * An open segment's pages with URLs of one rendition, read through its\n * published item (windowed for long segments, refreshed before the URLs expire).\n */\nexport function useSegmentPages(segment: PlanSegment | null | undefined, rendition: string, o: { window?: ReadWindow; client?: ContentKitClient } = {}): UseSegmentPages {\n const item = segment?.item ?? null;\n const read = useMediaRead(item ?? { kind: \"\", id: \"\" }, { window: o.window, read: item ? undefined : null, client: o.client });\n const pages = useMemo(() => {\n const urls = new Map((read.read?.files ?? []).flatMap((f) => (f.url ? [[f.path, f.url] as const] : [])));\n return (segment?.pages ?? []).map((p) => {\n const path = p.files[rendition];\n return { name: p.name, w: p.w, h: p.h, url: path ? urls.get(path) : undefined };\n });\n }, [segment, rendition, read.read]);\n return { pages, loading: !!item && read.loading, error: read.error };\n}\n\nexport interface UseVersionDownload {\n /**\n * Grants the download (asking again while it is prepared), starts it in the\n * browser and resolves with the grant.\n */\n download: () => Promise<FileDownload>;\n /** Being prepared by the server, or granted and starting. */\n preparing: boolean;\n error?: ContentKitError;\n /** While a quota refused: when the viewer may download again (ms). */\n retryAt?: number;\n /**\n * What to tell the viewer about the last refusal: when a quota frees, when\n * a download the site holds back opens (\"available to download in N\n * days\"), a locked version, nothing to download, or a failure.\n */\n message?: string;\n}\n\n/** Starts a granted download: the browser fetches its URL, an attachment. */\nexport function startDownload(d: FileDownload): void {\n const a = document.createElement(\"a\");\n a.href = d.url;\n a.download = d.name;\n a.rel = \"noopener\";\n a.style.display = \"none\";\n document.body.appendChild(a);\n a.click();\n a.remove();\n}\n\n/** The viewer's line for a download refusal at now. */\nexport function downloadMessage(m: Translator, err: ContentKitError | undefined, now = Date.now()): string | undefined {\n switch (err?.code) {\n case undefined:\n return undefined;\n case \"rate_limited\":\n return m.t(\"versionDownload.limited\", { minutes: Math.max(1, Math.ceil((err.retryAfter ?? 60) / 60)) });\n case \"download_unavailable\": {\n const ms = err.availableAt ? Date.parse(err.availableAt) - now : NaN;\n return ms > 0 ? m.plural(\"versionDownload.availableIn\", Math.max(1, Math.ceil(ms / 86_400_000))) : m.t(\"versionDownload.unavailable\");\n }\n case \"forbidden\":\n return m.t(\"versionDownload.locked\");\n case \"no_download\":\n return m.error(err);\n default:\n return m.t(\"versionDownload.failed\");\n }\n}\n\n/**\n * A version's download, charged to the viewer's download quota: the\n * original or rendition its kind serves, or its pages as a zip.\n */\nexport function useVersionDownload(\n content: string,\n version: string,\n o: { poll?: number; client?: ContentKitClient; start?: (d: FileDownload) => void } = {},\n): UseVersionDownload {\n const { client } = useContentScope(o.client);\n const m = useMessages();\n const [preparing, setPreparing] = useState(false);\n const [error, setError] = useState<ContentKitError>();\n const [retryAt, setRetryAt] = useState<number>();\n const start = o.start ?? startDownload;\n const download = useCallback(async () => {\n setError(undefined);\n setRetryAt(undefined);\n setPreparing(true);\n try {\n for (;;) {\n const out = await client.versions.download(content, version);\n if (!isPending(out)) {\n start(out);\n return out;\n }\n await new Promise((r) => setTimeout(r, o.poll ?? 3000));\n }\n } catch (e) {\n const err = toContentKitError(e);\n setError(err);\n if (err.code === \"rate_limited\") setRetryAt(Date.now() + (err.retryAfter ?? 60) * 1000);\n throw err;\n } finally {\n setPreparing(false);\n }\n }, [client, content, version, o.poll, start]);\n return { download, preparing, error, retryAt, message: downloadMessage(m, error) };\n}\n"],"mappings":";;;;;;;AAqBA,IAAM,IAAY,KAAK,KAAK;AAG5B,SAAgB,EAAY,GAAyB,IAAM,KAAK,IAAI,GAAkB;CACpF,IAAM,KAAM,GAAM,YAAY,CAAC,EAAA,CAAG,SAAS,MAAO,CAAC,EAAE,YAAY,EAAE,aAAa,CAAC,KAAK,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,CAAE,CAAC,CAAC,QAAQ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BAAwB;CACvC;AACF;AAMA,SAAgB,EACd,GACA,GACA,IAAqF,CAAC,GAClE;CACpB,IAAM,EAAE,cAAW,EAAgB,EAAE,MAAM,GACrC,IAAI,EAAY,GAChB,CAAC,GAAW,KAAgB,EAAS,EAAK,GAC1C,CAAC,GAAO,KAAY,EAA0B,GAC9C,CAAC,GAAS,KAAc,EAAiB,GACzC,IAAQ,EAAE,SAAS;CAuBzB,OAAO;EAAE,UAtBQ,EAAY,YAAY;GAGvC,AAFA,EAAS,KAAA,CAAS,GAClB,EAAW,KAAA,CAAS,GACpB,EAAa,EAAI;GACjB,IAAI;IACF,SAAS;KACP,IAAM,IAAM,MAAM,EAAO,SAAS,SAAS,GAAS,CAAO;KAC3D,IAAI,CAAC,EAAU,CAAG,GAEhB,OADA,EAAM,CAAG,GACF;KAET,MAAM,IAAI,SAAS,MAAM,WAAW,GAAG,EAAE,QAAQ,GAAI,CAAC;IACxD;GACF,SAAS,GAAG;IACV,IAAM,IAAM,EAAkB,CAAC;IAG/B,MAFA,EAAS,CAAG,GACR,EAAI,SAAS,kBAAgB,EAAW,KAAK,IAAI,KAAK,EAAI,cAAc,MAAM,GAAI,GAChF;GACR,UAAU;IACR,EAAa,EAAK;GACpB;EACF,GAAG;GAAC;GAAQ;GAAS;GAAS,EAAE;GAAM;EAAK,CAClC;EAAU;EAAW;EAAO;EAAS,SAAS,EAAgB,GAAG,CAAK;CAAE;AACnF"}
package/dist/react.js CHANGED
@@ -1,27 +1,29 @@
1
1
  import { HOVER_DELAY as e, InlinePreviewContext as t, useInlinePreview as n, useReducedMotion as r } from "./react/inline-preview.js";
2
2
  import { GuardContext as i, useContentKit as a, useContentKitClient as o, useContentURLs as s, useErrorReporter as c, useGuarded as l, useOptionalContentKitClient as u } from "./react/context.js";
3
3
  import { useCrop as d, useEncodeProgress as f, useUpload as p, useUploadQueue as m } from "./react/upload.js";
4
- import { useMediaRead as h } from "./react/read.js";
5
- import { usePresets as g, usePublicImage as _ } from "./react/public.js";
6
- import { editOutput as v, useSlotCrop as y, useSlotImage as b } from "./react/slot.js";
7
- import { round3 as x, useFrameStrip as S, useVideoFrame as C, useVideoImages as w, useVideoPoster as T } from "./react/video.js";
8
- import { GALLERY_VIEW_KEY as E, PLAYER_QUALITY_KEY as D, useCarousel as O, useGalleryView as k, useHlsPlayer as A, useRefreshBeforeExpiry as j } from "./react/gallery.js";
9
- import { useEditorCrop as M } from "./react/crop.js";
10
- import { nameIn as N, thumbnailOf as P, useMediaFolder as F } from "./react/folder.js";
11
- import { useNearViewport as I } from "./react/viewport.js";
12
- import { ResourceStore as L, resourcesFor as R } from "./react/resources.js";
13
- import { useContentScope as z, usePaged as B } from "./react/use-resource.js";
14
- import { useAdminComments as V, useBannedWords as H, useCanComment as U, useCommentBans as W, useCommentReplies as G, useComments as K, useGlobalCommentBan as q, useIPBans as J, useLatestComments as Y, useModerationQueue as X, withReaction as Z } from "./react/comments.js";
15
- import { useContentConfig as Q } from "./react/config.js";
16
- import { useFavorite as $, useReaction as ee } from "./react/engagement.js";
17
- import { usePoll as te, usePollEditor as ne, usePolls as re, withVote as ie } from "./react/polls.js";
18
- import { useAdminLocation as ae, useFlowClient as oe, useStaffAccess as se } from "./react/admin.js";
19
- import { memberId as ce, useContentGroups as le, useGroup as ue, useGroupMembers as de, useGroups as fe, useKinds as pe, useMyGroups as me } from "./react/groups.js";
20
- import { beaconsFor as he, useBeacons as ge, useContentFilters as _e, useContents as ve, useExposure as ye, useHistory as be, useMyFavorites as xe, useMyReactions as Se, useRecentSearches as Ce, useRecommendations as we, useReleaseDates as Te, useSearch as Ee, useSimilar as De, useTypeahead as Oe, useViewSignal as ke } from "./react/discovery.js";
21
- import { nextRelease as Ae, useReaderPlan as je, useSegmentPages as Me, useVersionDownload as Ne } from "./react/versions.js";
22
- import { useContent as Pe, useManagedContents as Fe } from "./react/contents.js";
23
- import { useNotificationUnread as Ie, useNotifications as Le } from "./react/notifications.js";
24
- import { ContentKitProvider as Re } from "./react/provider.js";
25
- import { useCanonicalContent as ze } from "./react/canonical.js";
26
- import { defaultVersion as Be, liveVersions as Ve, useContentDetail as He } from "./react/detail.js";
27
- export { Re as ContentKitProvider, E as GALLERY_VIEW_KEY, i as GuardContext, e as HOVER_DELAY, t as InlinePreviewContext, D as PLAYER_QUALITY_KEY, L as ResourceStore, he as beaconsFor, Be as defaultVersion, v as editOutput, Ve as liveVersions, ce as memberId, N as nameIn, Ae as nextRelease, R as resourcesFor, x as round3, P as thumbnailOf, V as useAdminComments, ae as useAdminLocation, H as useBannedWords, ge as useBeacons, U as useCanComment, ze as useCanonicalContent, O as useCarousel, W as useCommentBans, G as useCommentReplies, K as useComments, Pe as useContent, Q as useContentConfig, He as useContentDetail, _e as useContentFilters, le as useContentGroups, a as useContentKit, o as useContentKitClient, z as useContentScope, s as useContentURLs, ve as useContents, d as useCrop, M as useEditorCrop, f as useEncodeProgress, c as useErrorReporter, ye as useExposure, $ as useFavorite, oe as useFlowClient, S as useFrameStrip, k as useGalleryView, q as useGlobalCommentBan, ue as useGroup, de as useGroupMembers, fe as useGroups, l as useGuarded, be as useHistory, A as useHlsPlayer, J as useIPBans, n as useInlinePreview, pe as useKinds, Y as useLatestComments, Fe as useManagedContents, F as useMediaFolder, h as useMediaRead, X as useModerationQueue, xe as useMyFavorites, me as useMyGroups, Se as useMyReactions, I as useNearViewport, Ie as useNotificationUnread, Le as useNotifications, u as useOptionalContentKitClient, B as usePaged, te as usePoll, ne as usePollEditor, re as usePolls, g as usePresets, _ as usePublicImage, ee as useReaction, je as useReaderPlan, Ce as useRecentSearches, we as useRecommendations, r as useReducedMotion, j as useRefreshBeforeExpiry, Te as useReleaseDates, Ee as useSearch, Me as useSegmentPages, De as useSimilar, y as useSlotCrop, b as useSlotImage, se as useStaffAccess, Oe as useTypeahead, p as useUpload, m as useUploadQueue, Ne as useVersionDownload, C as useVideoFrame, w as useVideoImages, T as useVideoPoster, ke as useViewSignal, Z as withReaction, ie as withVote };
4
+ import { ResourceStore as h, resourcesFor as g } from "./react/resources.js";
5
+ import { useContentScope as _, usePaged as v } from "./react/use-resource.js";
6
+ import { memberId as y, useContentGroups as b, useGroup as x, useGroupMembers as S, useGroups as C, useKinds as w, useMyGroups as T } from "./react/groups.js";
7
+ import { useMediaRead as E } from "./react/read.js";
8
+ import { useAvatar as D, usePresets as O, usePublicImage as k } from "./react/public.js";
9
+ import { editOutput as A, useSlotCrop as j, useSlotImage as M } from "./react/slot.js";
10
+ import { round3 as N, useFrameStrip as P, useVideoFrame as F, useVideoImages as I, useVideoPoster as L } from "./react/video.js";
11
+ import { GALLERY_VIEW_KEY as R, PLAYER_QUALITY_KEY as z, useCarousel as B, useGalleryView as V, useHlsPlayer as H, useRefreshBeforeExpiry as U } from "./react/gallery.js";
12
+ import { useEditorCrop as W } from "./react/crop.js";
13
+ import { nameIn as G, thumbnailOf as K, useMediaFolder as q } from "./react/folder.js";
14
+ import { useNearViewport as J } from "./react/viewport.js";
15
+ import { useAdminComments as Y, useBannedWords as X, useCanComment as Z, useCommentBans as Q, useCommentReplies as $, useComments as ee, useGlobalCommentBan as te, useIPBans as ne, useLatestComments as re, useModerationQueue as ie, withReaction as ae } from "./react/comments.js";
16
+ import { useContentConfig as oe } from "./react/config.js";
17
+ import { useFavorite as se, useReaction as ce } from "./react/engagement.js";
18
+ import { usePoll as le, usePollEditor as ue, usePolls as de, withVote as fe } from "./react/polls.js";
19
+ import { useVersionParam as pe } from "./react/location.js";
20
+ import { useAdminLocation as me, useFlowClient as he, useStaffAccess as ge } from "./react/admin.js";
21
+ import { beaconsFor as _e, useBeacons as ve, useContentFilters as ye, useContents as be, useExposure as xe, useHistory as Se, useLockedCount as Ce, useMyFavorites as we, useMyReactions as Te, useRecentSearches as Ee, useRecommendations as De, useReleaseDates as Oe, useSearch as ke, useSimilar as Ae, useTypeahead as je, useViewSignal as Me } from "./react/discovery.js";
22
+ import { defaultVersion as Ne, findVersion as Pe, liveVersions as Fe, useContentDetail as Ie } from "./react/detail.js";
23
+ import { downloadMessage as Le, nextRelease as Re, startDownload as ze, useReaderPlan as Be, useSegmentPages as Ve, useVersionDownload as He } from "./react/versions.js";
24
+ import { useActivity as Ue, useMyStats as We, useTopContents as Ge } from "./react/stats.js";
25
+ import { useContent as Ke, useManagedContents as qe } from "./react/contents.js";
26
+ import { useNotificationUnread as Je, useNotifications as Ye } from "./react/notifications.js";
27
+ import { ContentKitProvider as Xe } from "./react/provider.js";
28
+ import { useCanonicalContent as Ze } from "./react/canonical.js";
29
+ export { Xe as ContentKitProvider, R as GALLERY_VIEW_KEY, i as GuardContext, e as HOVER_DELAY, t as InlinePreviewContext, z as PLAYER_QUALITY_KEY, h as ResourceStore, _e as beaconsFor, Ne as defaultVersion, Le as downloadMessage, A as editOutput, Pe as findVersion, Fe as liveVersions, y as memberId, G as nameIn, Re as nextRelease, g as resourcesFor, N as round3, ze as startDownload, K as thumbnailOf, Ue as useActivity, Y as useAdminComments, me as useAdminLocation, D as useAvatar, X as useBannedWords, ve as useBeacons, Z as useCanComment, Ze as useCanonicalContent, B as useCarousel, Q as useCommentBans, $ as useCommentReplies, ee as useComments, Ke as useContent, oe as useContentConfig, Ie as useContentDetail, ye as useContentFilters, b as useContentGroups, a as useContentKit, o as useContentKitClient, _ as useContentScope, s as useContentURLs, be as useContents, d as useCrop, W as useEditorCrop, f as useEncodeProgress, c as useErrorReporter, xe as useExposure, se as useFavorite, he as useFlowClient, P as useFrameStrip, V as useGalleryView, te as useGlobalCommentBan, x as useGroup, S as useGroupMembers, C as useGroups, l as useGuarded, Se as useHistory, H as useHlsPlayer, ne as useIPBans, n as useInlinePreview, w as useKinds, re as useLatestComments, Ce as useLockedCount, qe as useManagedContents, q as useMediaFolder, E as useMediaRead, ie as useModerationQueue, we as useMyFavorites, T as useMyGroups, Te as useMyReactions, We as useMyStats, J as useNearViewport, Je as useNotificationUnread, Ye as useNotifications, u as useOptionalContentKitClient, v as usePaged, le as usePoll, ue as usePollEditor, de as usePolls, O as usePresets, k as usePublicImage, ce as useReaction, Be as useReaderPlan, Ee as useRecentSearches, De as useRecommendations, r as useReducedMotion, U as useRefreshBeforeExpiry, Oe as useReleaseDates, ke as useSearch, Ve as useSegmentPages, Ae as useSimilar, j as useSlotCrop, M as useSlotImage, ge as useStaffAccess, Ge as useTopContents, je as useTypeahead, p as useUpload, m as useUploadQueue, He as useVersionDownload, pe as useVersionParam, F as useVideoFrame, I as useVideoImages, L as useVideoPoster, Me as useViewSignal, ae as withReaction, fe as withVote };