@byline/host-tanstack-start 4.14.1 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/admin-shell/chrome/admin-menu-drawer.d.ts +4 -1
  2. package/dist/admin-shell/chrome/admin-menu-drawer.js +26 -2
  3. package/dist/admin-shell/chrome/admin-menu-drawer_module.css +1 -1
  4. package/dist/admin-shell/collections/edit.js +142 -2
  5. package/dist/admin-shell/scheduled-publications/list.d.ts +4 -0
  6. package/dist/admin-shell/scheduled-publications/list.js +295 -0
  7. package/dist/admin-shell/scheduled-publications/list.module.js +25 -0
  8. package/dist/admin-shell/scheduled-publications/list_module.css +97 -0
  9. package/dist/integrations/analytics-agent.d.ts +20 -0
  10. package/dist/integrations/analytics-agent.js +57 -0
  11. package/dist/integrations/analytics-events.d.ts +51 -0
  12. package/dist/integrations/analytics-events.js +129 -0
  13. package/dist/integrations/serve-analytics-agent.d.ts +8 -0
  14. package/dist/integrations/serve-analytics-agent.js +11 -0
  15. package/dist/routes/analytics-range.d.ts +12 -0
  16. package/dist/routes/analytics-range.js +35 -0
  17. package/dist/routes/create-admin-analytics-route.d.ts +8 -0
  18. package/dist/routes/create-admin-analytics-route.js +108 -0
  19. package/dist/routes/create-admin-layout-route.js +15 -4
  20. package/dist/routes/create-admin-scheduled-publications-route.d.ts +8 -0
  21. package/dist/routes/create-admin-scheduled-publications-route.js +66 -0
  22. package/dist/routes/index.d.ts +2 -0
  23. package/dist/routes/index.js +2 -0
  24. package/dist/server-fns/analytics/index.d.ts +9 -0
  25. package/dist/server-fns/analytics/index.js +2 -0
  26. package/dist/server-fns/analytics/maintenance.d.ts +22 -0
  27. package/dist/server-fns/analytics/maintenance.js +42 -0
  28. package/dist/server-fns/analytics/queries.d.ts +25 -0
  29. package/dist/server-fns/analytics/queries.js +54 -0
  30. package/dist/server-fns/collections/get.d.ts +5 -0
  31. package/dist/server-fns/collections/get.js +19 -3
  32. package/dist/server-fns/collections/index.d.ts +1 -0
  33. package/dist/server-fns/collections/index.js +1 -0
  34. package/dist/server-fns/collections/scheduled-publication-response.d.ts +11 -0
  35. package/dist/server-fns/collections/scheduled-publication-response.js +5 -0
  36. package/dist/server-fns/collections/scheduled-publication.d.ts +111 -0
  37. package/dist/server-fns/collections/scheduled-publication.js +157 -0
  38. package/dist/vite/analytics-dev.d.ts +22 -0
  39. package/dist/vite/analytics-dev.js +28 -0
  40. package/dist/vite/index.d.ts +1 -0
  41. package/dist/vite/index.js +1 -0
  42. package/package.json +14 -8
  43. package/src/admin-shell/chrome/admin-menu-drawer.module.css +7 -1
  44. package/src/admin-shell/chrome/admin-menu-drawer.tsx +37 -1
  45. package/src/admin-shell/collections/edit.tsx +140 -1
  46. package/src/admin-shell/scheduled-publications/list.module.css +105 -0
  47. package/src/admin-shell/scheduled-publications/list.tsx +292 -0
  48. package/src/integrations/analytics-agent.tsx +91 -0
  49. package/src/integrations/analytics-events.test.node.ts +245 -0
  50. package/src/integrations/analytics-events.ts +224 -0
  51. package/src/integrations/serve-analytics-agent.test.node.ts +20 -0
  52. package/src/integrations/serve-analytics-agent.ts +19 -0
  53. package/src/routes/analytics-range.ts +55 -0
  54. package/src/routes/create-admin-analytics-route.test.node.ts +46 -0
  55. package/src/routes/create-admin-analytics-route.tsx +109 -0
  56. package/src/routes/create-admin-layout-route.tsx +19 -7
  57. package/src/routes/create-admin-scheduled-publications-route.tsx +83 -0
  58. package/src/routes/index.ts +2 -0
  59. package/src/server-fns/analytics/index.ts +23 -0
  60. package/src/server-fns/analytics/maintenance.ts +54 -0
  61. package/src/server-fns/analytics/queries.ts +86 -0
  62. package/src/server-fns/collections/get.ts +30 -1
  63. package/src/server-fns/collections/index.ts +1 -0
  64. package/src/server-fns/collections/scheduled-publication-response.test.node.ts +45 -0
  65. package/src/server-fns/collections/scheduled-publication-response.ts +22 -0
  66. package/src/server-fns/collections/scheduled-publication.ts +270 -0
  67. package/src/vite/analytics-dev.test.node.ts +126 -0
  68. package/src/vite/analytics-dev.ts +56 -0
  69. package/src/vite/index.ts +1 -0
@@ -6,4 +6,7 @@
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
8
  import type React from 'react';
9
- export declare function AdminMenuDrawer(): React.JSX.Element | null;
9
+ export declare function AdminMenuDrawer({ analyticsEnabled, scheduledPublicationEnabled, }: {
10
+ analyticsEnabled?: boolean;
11
+ scheduledPublicationEnabled?: boolean;
12
+ }): React.JSX.Element | null;
@@ -4,8 +4,10 @@ import { ADMIN_ACTIVITY_ABILITIES } from "@byline/admin/admin-activity";
4
4
  import { ADMIN_PERMISSIONS_ABILITIES } from "@byline/admin/admin-permissions";
5
5
  import { ADMIN_ROLES_ABILITIES } from "@byline/admin/admin-roles";
6
6
  import { ADMIN_USERS_ABILITIES } from "@byline/admin/admin-users";
7
+ import { ANALYTICS_ABILITIES } from "@byline/admin/analytics";
8
+ import { collectionAbilityKey, getAdminConfig } from "@byline/core";
7
9
  import { useTranslation } from "@byline/i18n/react";
8
- import { ActivityIcon, HomeIcon, RolesIcon, SettingsSlidersIcon, Tooltip, UserIcon, UsersIcon } from "@byline/ui/react";
10
+ import { ActivityIcon, AnalyticsIcon, CalendarIcon, HomeIcon, RolesIcon, SettingsSlidersIcon, Tooltip, UserIcon, UsersIcon } from "@byline/ui/react";
9
11
  import clsx from "clsx";
10
12
  import { useSwipeable } from "react-swipeable";
11
13
  import { useAbilities } from "../../integrations/abilities.js";
@@ -45,7 +47,7 @@ function MenuItem({ to, label, icon, pathname, compact }) {
45
47
  })
46
48
  });
47
49
  }
48
- function AdminMenuDrawer() {
50
+ function AdminMenuDrawer({ analyticsEnabled = false, scheduledPublicationEnabled = false }) {
49
51
  const pathname = useRouterState({
50
52
  select: (s)=>s.location.pathname
51
53
  });
@@ -56,6 +58,8 @@ function AdminMenuDrawer() {
56
58
  const canReadRoles = has(ADMIN_ROLES_ABILITIES.read);
57
59
  const canReadPermissions = has(ADMIN_PERMISSIONS_ABILITIES.read);
58
60
  const canReadActivity = has(ADMIN_ACTIVITY_ABILITIES.read);
61
+ const canReadAnalytics = analyticsEnabled && has(ANALYTICS_ABILITIES.read);
62
+ const canSeeScheduledPublications = scheduledPublicationEnabled && getAdminConfig().collections.some((collection)=>has(collectionAbilityKey(collection.path, 'changeStatus')) && has(collectionAbilityKey(collection.path, 'publish')));
59
63
  const showAdminSection = canReadUsers || canReadRoles || canReadPermissions || canReadActivity;
60
64
  const handlers = useSwipeable({
61
65
  onSwipedLeft: ()=>{
@@ -94,6 +98,26 @@ function AdminMenuDrawer() {
94
98
  pathname: pathname,
95
99
  compact: compact
96
100
  }),
101
+ canSeeScheduledPublications && /*#__PURE__*/ jsx(MenuItem, {
102
+ to: getAdminRoutePath('scheduled-publications'),
103
+ label: t('chrome.menu.scheduledPublications'),
104
+ icon: /*#__PURE__*/ jsx(CalendarIcon, {
105
+ width: "18px",
106
+ height: "18px"
107
+ }),
108
+ pathname: pathname,
109
+ compact: compact
110
+ }),
111
+ canReadAnalytics && /*#__PURE__*/ jsx(MenuItem, {
112
+ to: getAdminRoutePath('analytics'),
113
+ label: t('chrome.menu.analytics'),
114
+ icon: /*#__PURE__*/ jsx(AnalyticsIcon, {
115
+ width: "20px",
116
+ height: "20px"
117
+ }),
118
+ pathname: pathname,
119
+ compact: compact
120
+ }),
97
121
  showAdminSection && /*#__PURE__*/ jsxs(Fragment, {
98
122
  children: [
99
123
  /*#__PURE__*/ jsx("li", {
@@ -71,7 +71,7 @@
71
71
  }
72
72
 
73
73
  :is(.nav-dDjqu7 ul li.menu-item .label, .byline-admin-menu-drawer ul li.menu-item .label) {
74
- line-height: 0;
74
+ line-height: 1.2;
75
75
  }
76
76
 
77
77
  :is(.nav-dDjqu7 ul li.menu-item.compact .label, .byline-admin-menu-drawer ul li.menu-item.compact .label) {
@@ -1,12 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { FormRenderer } from "@byline/admin/react";
4
- import { getDefaultStatus, getWorkflowStatuses } from "@byline/core";
4
+ import { getDefaultStatus, getWorkflow, getWorkflowStatuses, validateStatusTransition } from "@byline/core";
5
5
  import { useTranslation } from "@byline/i18n/react";
6
6
  import { Container, Section, useToastManager } from "@byline/ui/react";
7
7
  import { getAdminRoutePath } from "../../routes/admin-path.js";
8
8
  import { clearListReturnState } from "../../routes/list-return-storage.js";
9
- import { copyDocumentToLocale, deleteDocument, deleteDocumentLocale, duplicateCollectionDocument, hasDeleteSideEffectFailures, unpublishDocument, updateCollectionDocumentSystemFields, updateCollectionDocumentWithPatches, updateDocumentStatus } from "../../server-fns/collections/index.js";
9
+ import { cancelCollectionDocumentScheduledPublish, confirmCollectionDocumentScheduledPublish, copyDocumentToLocale, deleteDocument, deleteDocumentLocale, duplicateCollectionDocument, hasDeleteSideEffectFailures, scheduleCollectionDocumentPublish, unpublishDocument, updateCollectionDocumentSystemFields, updateCollectionDocumentWithPatches, updateDocumentStatus } from "../../server-fns/collections/index.js";
10
10
  import { useNavigate } from "../chrome/loose-router.js";
11
11
  import { useTanStackNavigationGuard } from "./tanstack-navigation-guard.js";
12
12
  import { ViewMenu } from "./view-menu.js";
@@ -25,6 +25,24 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
25
25
  const currentStatus = initialData?.status ?? getDefaultStatus(collectionDefinition);
26
26
  const currentIndex = workflowStatuses.findIndex((s)=>s.name === currentStatus);
27
27
  const nextStatus = -1 !== currentIndex && currentIndex < workflowStatuses.length - 1 ? workflowStatuses[currentIndex + 1] : void 0;
28
+ const scheduledPublicationEnabled = initialData?._scheduledPublicationEnabled === true;
29
+ const canSchedulePublication = initialData?._canSchedulePublication === true;
30
+ const scheduledPublication = initialData?._scheduledPublish ?? null;
31
+ const publishTransitionValid = 'published' !== currentStatus && getWorkflowStatuses(collectionDefinition).length > 1 && validateStatusTransition(getWorkflow(collectionDefinition), currentStatus, 'published').valid;
32
+ const canArmSchedule = scheduledPublicationEnabled && canSchedulePublication && publishTransitionValid;
33
+ const notifyScheduleSuspended = ()=>{
34
+ if (scheduledPublication?.state !== 'armed') return;
35
+ toastManager.add({
36
+ title: t('scheduledPublication.toast.suspendedTitle'),
37
+ description: t("scheduledPublication.toast.suspendedDescription"),
38
+ data: {
39
+ intent: 'warning',
40
+ iconType: 'warning',
41
+ icon: true,
42
+ close: true
43
+ }
44
+ });
45
+ };
28
46
  const handleLocaleChange = (newLocale)=>{
29
47
  navigate({
30
48
  to: getAdminRoutePath('collections', '$collection', '$id'),
@@ -99,6 +117,121 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
99
117
  });
100
118
  }
101
119
  };
120
+ const reloadDocument = ()=>{
121
+ navigate({
122
+ to: getAdminRoutePath('collections', '$collection', '$id'),
123
+ params: {
124
+ collection: path,
125
+ id: String(initialData.id)
126
+ },
127
+ search: (prev)=>({
128
+ ...prev
129
+ })
130
+ });
131
+ };
132
+ const handleSchedulePublication = async ({ publishAt })=>{
133
+ try {
134
+ await scheduleCollectionDocumentPublish({
135
+ data: {
136
+ collection: path,
137
+ id: String(initialData.id),
138
+ publishAt,
139
+ expectedVersionId: String(initialData.versionId)
140
+ }
141
+ });
142
+ toastManager.add({
143
+ title: t('scheduledPublication.toast.scheduledTitle'),
144
+ description: t("scheduledPublication.toast.scheduledDescription"),
145
+ data: {
146
+ intent: 'success',
147
+ iconType: 'success',
148
+ icon: true,
149
+ close: true
150
+ }
151
+ });
152
+ reloadDocument();
153
+ } catch (err) {
154
+ toastManager.add({
155
+ title: t('scheduledPublication.toast.failedTitle'),
156
+ description: err.message,
157
+ data: {
158
+ intent: 'danger',
159
+ iconType: 'danger',
160
+ icon: true,
161
+ close: true
162
+ }
163
+ });
164
+ throw err;
165
+ }
166
+ };
167
+ const handleConfirmScheduledPublication = async ()=>{
168
+ try {
169
+ await confirmCollectionDocumentScheduledPublish({
170
+ data: {
171
+ collection: path,
172
+ id: String(initialData.id),
173
+ expectedVersionId: String(initialData.versionId)
174
+ }
175
+ });
176
+ toastManager.add({
177
+ title: t('scheduledPublication.toast.confirmedTitle'),
178
+ description: t("scheduledPublication.toast.confirmedDescription"),
179
+ data: {
180
+ intent: 'success',
181
+ iconType: 'success',
182
+ icon: true,
183
+ close: true
184
+ }
185
+ });
186
+ reloadDocument();
187
+ } catch (err) {
188
+ toastManager.add({
189
+ title: t('scheduledPublication.toast.failedTitle'),
190
+ description: err.message,
191
+ data: {
192
+ intent: 'danger',
193
+ iconType: 'danger',
194
+ icon: true,
195
+ close: true
196
+ }
197
+ });
198
+ throw err;
199
+ }
200
+ };
201
+ const handleCancelScheduledPublication = async ()=>{
202
+ try {
203
+ const result = await cancelCollectionDocumentScheduledPublish({
204
+ data: {
205
+ collection: path,
206
+ id: String(initialData.id)
207
+ }
208
+ });
209
+ const cancelled = 'cancelled' === result.status;
210
+ toastManager.add({
211
+ title: cancelled ? t('scheduledPublication.toast.cancelledTitle') : t('scheduledPublication.toast.cancelLostTitle'),
212
+ description: cancelled ? t("scheduledPublication.toast.cancelledDescription") : t("scheduledPublication.toast.cancelLostDescription"),
213
+ data: {
214
+ intent: cancelled ? 'success' : 'warning',
215
+ iconType: cancelled ? 'success' : 'warning',
216
+ icon: true,
217
+ close: true
218
+ }
219
+ });
220
+ reloadDocument();
221
+ } catch (err) {
222
+ toastManager.add({
223
+ title: t('scheduledPublication.toast.failedTitle'),
224
+ description: err.message,
225
+ data: {
226
+ intent: 'danger',
227
+ iconType: 'danger',
228
+ icon: true,
229
+ close: true
230
+ }
231
+ });
232
+ throw err;
233
+ }
234
+ };
102
235
  const publishedVersion = initialData?._publishedVersion ?? null;
103
236
  const restoreWarnings = initialData?._restoreWarnings;
104
237
  const handleUnpublish = async ()=>{
@@ -256,6 +389,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
256
389
  close: true
257
390
  }
258
391
  });
392
+ notifyScheduleSuspended();
259
393
  setEditState({
260
394
  status: 'success',
261
395
  message: t('collections.edit.copiedSuccessMessage', {
@@ -323,6 +457,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
323
457
  close: true
324
458
  }
325
459
  });
460
+ notifyScheduleSuspended();
326
461
  setEditState({
327
462
  status: 'success',
328
463
  message: description
@@ -446,6 +581,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
446
581
  locale
447
582
  }
448
583
  });
584
+ if (contentDirty && scheduledPublication?.state === 'armed') notifyScheduleSuspended();
449
585
  const description = t("collections.edit.updatedDescription", {
450
586
  label: singularLower
451
587
  });
@@ -526,6 +662,10 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
526
662
  }),
527
663
  onStatusChange: handleStatusChange,
528
664
  onUnpublish: publishedVersion ? handleUnpublish : void 0,
665
+ scheduledPublication: scheduledPublication,
666
+ onSchedulePublication: canArmSchedule ? handleSchedulePublication : void 0,
667
+ onConfirmScheduledPublication: canArmSchedule && scheduledPublication?.state === 'needs_reconfirm' ? handleConfirmScheduledPublication : void 0,
668
+ onCancelScheduledPublication: null != scheduledPublication ? handleCancelScheduledPublication : void 0,
529
669
  onDelete: handleDelete,
530
670
  onDuplicate: handleDuplicate,
531
671
  onCopyToLocale: handleCopyToLocale,
@@ -0,0 +1,4 @@
1
+ import type { ScheduledPublicationListResponse } from '../../server-fns/collections/index.js';
2
+ export declare function ScheduledPublicationsView({ data }: {
3
+ data: ScheduledPublicationListResponse;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,295 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useState } from "react";
4
+ import { useRouterState } from "@tanstack/react-router";
5
+ import { deriveScheduledPublicationState } from "@byline/admin/react";
6
+ import { useTranslation } from "@byline/i18n/react";
7
+ import { Alert, Badge, Button, Container, Section, Select, Table, useToastManager } from "@byline/ui/react";
8
+ import clsx from "clsx";
9
+ import { getAdminRoutePath } from "../../routes/admin-path.js";
10
+ import { cancelCollectionDocumentScheduledPublish } from "../../server-fns/collections/index.js";
11
+ import { Link, useNavigate } from "../chrome/loose-router.js";
12
+ import { RouterPager } from "../chrome/router-pager.js";
13
+ import list_module from "./list.module.js";
14
+ const STATE_INTENT = {
15
+ none: 'noeffect',
16
+ armed: 'info',
17
+ needs_reconfirm: 'warning',
18
+ overdue: 'warning'
19
+ };
20
+ function ScheduledPublicationsView({ data }) {
21
+ const { t, locale } = useTranslation('byline-admin');
22
+ const now = Date.now();
23
+ const timeZone = useMemo(()=>Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC', []);
24
+ const instantFormat = useMemo(()=>new Intl.DateTimeFormat(locale, {
25
+ dateStyle: 'medium',
26
+ timeStyle: 'short',
27
+ timeZone
28
+ }), [
29
+ locale,
30
+ timeZone
31
+ ]);
32
+ const navigate = useNavigate();
33
+ const toastManager = useToastManager();
34
+ const location = useRouterState({
35
+ select: (state)=>state.location
36
+ });
37
+ const search = location.search;
38
+ const [cancelling, setCancelling] = useState(null);
39
+ const applySearch = (patch)=>{
40
+ navigate({
41
+ to: getAdminRoutePath('scheduled-publications'),
42
+ search: {
43
+ ...location.search,
44
+ ...patch,
45
+ page: void 0
46
+ }
47
+ });
48
+ };
49
+ const cancel = async (collection, documentId)=>{
50
+ setCancelling(documentId);
51
+ try {
52
+ const result = await cancelCollectionDocumentScheduledPublish({
53
+ data: {
54
+ collection,
55
+ id: documentId
56
+ }
57
+ });
58
+ const cancelled = 'cancelled' === result.status;
59
+ toastManager.add({
60
+ title: cancelled ? t('scheduledPublication.toast.cancelledTitle') : t('scheduledPublication.toast.cancelLostTitle'),
61
+ description: cancelled ? t("scheduledPublication.toast.cancelledDescription") : t("scheduledPublication.toast.cancelLostDescription"),
62
+ data: {
63
+ intent: cancelled ? 'success' : 'warning',
64
+ iconType: cancelled ? 'success' : 'warning',
65
+ icon: true,
66
+ close: true
67
+ }
68
+ });
69
+ navigate({
70
+ to: getAdminRoutePath('scheduled-publications'),
71
+ search: location.search
72
+ });
73
+ } catch (error) {
74
+ toastManager.add({
75
+ title: t('scheduledPublication.toast.failedTitle'),
76
+ description: error.message,
77
+ data: {
78
+ intent: 'danger',
79
+ iconType: 'danger',
80
+ icon: true,
81
+ close: true
82
+ }
83
+ });
84
+ } finally{
85
+ setCancelling(null);
86
+ }
87
+ };
88
+ const unhealthy = data.runtime.health?.status !== 'healthy';
89
+ return /*#__PURE__*/ jsx(Section, {
90
+ children: /*#__PURE__*/ jsxs(Container, {
91
+ children: [
92
+ /*#__PURE__*/ jsxs("div", {
93
+ className: clsx('byline-scheduled-list-head', list_module.head),
94
+ children: [
95
+ /*#__PURE__*/ jsx("h1", {
96
+ className: list_module.title,
97
+ children: t('scheduledPublication.list.title')
98
+ }),
99
+ /*#__PURE__*/ jsx("p", {
100
+ className: list_module.intro,
101
+ children: t('scheduledPublication.list.intro')
102
+ })
103
+ ]
104
+ }),
105
+ unhealthy && /*#__PURE__*/ jsx(Alert, {
106
+ className: list_module.health,
107
+ intent: "warning",
108
+ icon: true,
109
+ close: false,
110
+ title: t('scheduledPublication.list.schedulerWarningTitle'),
111
+ children: t('scheduledPublication.list.schedulerWarningBody', {
112
+ status: data.runtime.health?.status ?? 'not_started'
113
+ })
114
+ }),
115
+ /*#__PURE__*/ jsxs("div", {
116
+ className: list_module.controls,
117
+ children: [
118
+ /*#__PURE__*/ jsx("div", {
119
+ className: list_module.filters,
120
+ children: /*#__PURE__*/ jsx("div", {
121
+ className: list_module.filter,
122
+ children: /*#__PURE__*/ jsx(Select, {
123
+ id: "scheduled-publication-state",
124
+ name: "scheduled-publication-state",
125
+ ariaLabel: t('scheduledPublication.list.filters.state'),
126
+ size: "sm",
127
+ value: search.state ?? '_all',
128
+ items: [
129
+ {
130
+ value: '_all',
131
+ label: t('scheduledPublication.list.filters.allStates')
132
+ },
133
+ {
134
+ value: 'armed',
135
+ label: t('scheduledPublication.list.states.armed')
136
+ },
137
+ {
138
+ value: 'needs_reconfirm',
139
+ label: t('scheduledPublication.list.states.needsReconfirm')
140
+ }
141
+ ],
142
+ onValueChange: (value)=>applySearch({
143
+ state: '_all' === value ? void 0 : value
144
+ })
145
+ })
146
+ })
147
+ }),
148
+ /*#__PURE__*/ jsx(RouterPager, {
149
+ page: data.meta.page,
150
+ count: data.meta.totalPages,
151
+ showFirstButton: true,
152
+ showLastButton: true,
153
+ componentName: "scheduledPublicationsPagerTop",
154
+ "aria-label": t('scheduledPublication.list.pagerAriaLabel')
155
+ })
156
+ ]
157
+ }),
158
+ 0 === data.schedules.length ? /*#__PURE__*/ jsx("p", {
159
+ className: list_module.empty,
160
+ children: t('scheduledPublication.list.empty')
161
+ }) : /*#__PURE__*/ jsx(Table.Container, {
162
+ className: list_module.tableWrap,
163
+ children: /*#__PURE__*/ jsxs(Table, {
164
+ children: [
165
+ /*#__PURE__*/ jsx(Table.Header, {
166
+ children: /*#__PURE__*/ jsxs(Table.Row, {
167
+ children: [
168
+ /*#__PURE__*/ jsx(Table.HeadingCell, {
169
+ scope: "col",
170
+ children: t('scheduledPublication.list.columns.document')
171
+ }),
172
+ /*#__PURE__*/ jsx(Table.HeadingCell, {
173
+ scope: "col",
174
+ children: t('scheduledPublication.list.columns.publishAt')
175
+ }),
176
+ /*#__PURE__*/ jsx(Table.HeadingCell, {
177
+ scope: "col",
178
+ children: t('scheduledPublication.list.columns.state')
179
+ }),
180
+ /*#__PURE__*/ jsx(Table.HeadingCell, {
181
+ scope: "col",
182
+ children: t('scheduledPublication.list.columns.authorizer')
183
+ }),
184
+ /*#__PURE__*/ jsx(Table.HeadingCell, {
185
+ scope: "col",
186
+ children: t('scheduledPublication.list.columns.attempt')
187
+ }),
188
+ /*#__PURE__*/ jsx(Table.HeadingCell, {
189
+ scope: "col",
190
+ children: t('scheduledPublication.list.columns.actions')
191
+ })
192
+ ]
193
+ })
194
+ }),
195
+ /*#__PURE__*/ jsx(Table.Body, {
196
+ children: data.schedules.map((schedule)=>{
197
+ const state = deriveScheduledPublicationState(schedule, {
198
+ canSchedule: false,
199
+ canConfirm: false,
200
+ canCancel: true
201
+ }, now);
202
+ const publishAt = new Date(schedule.publishAt);
203
+ return /*#__PURE__*/ jsxs(Table.Row, {
204
+ children: [
205
+ /*#__PURE__*/ jsxs(Table.Cell, {
206
+ children: [
207
+ /*#__PURE__*/ jsx(Link, {
208
+ to: getAdminRoutePath('collections', '$collection', '$id'),
209
+ params: {
210
+ collection: schedule.collectionPath,
211
+ id: schedule.documentId
212
+ },
213
+ children: schedule.documentPath || schedule.documentId
214
+ }),
215
+ /*#__PURE__*/ jsx("span", {
216
+ className: list_module.collection,
217
+ children: schedule.collectionLabel
218
+ })
219
+ ]
220
+ }),
221
+ /*#__PURE__*/ jsxs(Table.Cell, {
222
+ children: [
223
+ /*#__PURE__*/ jsx("time", {
224
+ className: list_module.instant,
225
+ dateTime: publishAt.toISOString(),
226
+ children: instantFormat.format(publishAt)
227
+ }),
228
+ /*#__PURE__*/ jsx("span", {
229
+ className: list_module.zone,
230
+ children: timeZone
231
+ })
232
+ ]
233
+ }),
234
+ /*#__PURE__*/ jsx(Table.Cell, {
235
+ children: /*#__PURE__*/ jsx(Badge, {
236
+ intent: STATE_INTENT[state.kind],
237
+ children: 'needs_reconfirm' === state.kind ? t('scheduledPublication.list.states.needsReconfirm') : 'overdue' === state.kind ? t('scheduledPublication.list.states.overdue') : t('scheduledPublication.list.states.armed')
238
+ })
239
+ }),
240
+ /*#__PURE__*/ jsx(Table.Cell, {
241
+ children: null != schedule.lastAuthorizedByName ? /*#__PURE__*/ jsx("span", {
242
+ children: schedule.lastAuthorizedByName
243
+ }) : null != schedule.lastAuthorizedBy ? /*#__PURE__*/ jsx("span", {
244
+ className: list_module.authorizer,
245
+ title: t('scheduledPublication.list.authorizerMissing'),
246
+ children: schedule.lastAuthorizedBy
247
+ }) : /*#__PURE__*/ jsx("span", {
248
+ children: "—"
249
+ })
250
+ }),
251
+ /*#__PURE__*/ jsxs(Table.Cell, {
252
+ children: [
253
+ /*#__PURE__*/ jsx("span", {
254
+ children: schedule.attemptCount
255
+ }),
256
+ null != schedule.lastError && /*#__PURE__*/ jsx("span", {
257
+ className: list_module.error,
258
+ children: schedule.lastError
259
+ })
260
+ ]
261
+ }),
262
+ /*#__PURE__*/ jsx(Table.Cell, {
263
+ children: /*#__PURE__*/ jsx(Button, {
264
+ size: "xs",
265
+ type: "button",
266
+ intent: "danger",
267
+ disabled: cancelling === schedule.documentId,
268
+ "aria-label": t('scheduledPublication.actions.cancel'),
269
+ onClick: ()=>cancel(schedule.collectionPath, schedule.documentId),
270
+ children: t('common.actions.cancel')
271
+ })
272
+ })
273
+ ]
274
+ }, schedule.documentId);
275
+ })
276
+ })
277
+ ]
278
+ })
279
+ }),
280
+ /*#__PURE__*/ jsx("div", {
281
+ className: list_module.pagerBottom,
282
+ children: /*#__PURE__*/ jsx(RouterPager, {
283
+ page: data.meta.page,
284
+ count: data.meta.totalPages,
285
+ showFirstButton: true,
286
+ showLastButton: true,
287
+ componentName: "scheduledPublicationsPagerBottom",
288
+ "aria-label": t('scheduledPublication.list.pagerAriaLabel')
289
+ })
290
+ })
291
+ ]
292
+ })
293
+ });
294
+ }
295
+ export { ScheduledPublicationsView };
@@ -0,0 +1,25 @@
1
+ import "./list_module.css";
2
+ const list_module = {
3
+ head: "head-oj4QbV",
4
+ title: "title-lm1z74",
5
+ intro: "intro-clPFM7",
6
+ health: "health-KAg5x5",
7
+ controls: "controls-dRon5S",
8
+ "filters-help": "filters-help-DWQ3Wy",
9
+ filtersHelp: "filters-help-DWQ3Wy",
10
+ filters: "filters-x7PuG5",
11
+ filter: "filter-TXeSAI",
12
+ "filter-authorizer": "filter-authorizer-rDbHwh",
13
+ filterAuthorizer: "filter-authorizer-rDbHwh",
14
+ "filter-actions": "filter-actions-dbQWCO",
15
+ filterActions: "filter-actions-dbQWCO",
16
+ tableWrap: "tableWrap-wqdsOy",
17
+ collection: "collection-sBqska",
18
+ zone: "zone-ikRViN",
19
+ error: "error-frhrx4",
20
+ instant: "instant-PTgCBK",
21
+ authorizer: "authorizer-orWXlf",
22
+ empty: "empty-K7NcOV",
23
+ pagerBottom: "pagerBottom-Sf0_9J"
24
+ };
25
+ export default list_module;