@scalemule/news-publication 0.0.31 → 0.0.33
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/dist/story-review.cjs +10 -5
- package/dist/story-review.js +10 -5
- package/package.json +1 -1
- package/story-review.css +13 -10
package/dist/story-review.cjs
CHANGED
|
@@ -452,7 +452,7 @@ function StoryReview({
|
|
|
452
452
|
}
|
|
453
453
|
setPanel("share");
|
|
454
454
|
}
|
|
455
|
-
async function send(action, success) {
|
|
455
|
+
async function send(action, success, consumeDraft = true) {
|
|
456
456
|
if (!review || busy) return;
|
|
457
457
|
if (action.action === "APPROVE" && file) {
|
|
458
458
|
setNotice("Your photo is not uploaded yet. Upload it or remove the selection before approving.");
|
|
@@ -464,7 +464,7 @@ function StoryReview({
|
|
|
464
464
|
setNotice("");
|
|
465
465
|
try {
|
|
466
466
|
const actionPanel = { ANSWER_QUESTIONS: "questions", REQUEST_CHANGES: "changes", COMMENT: "comment", PROPOSE_EDITS: "edits", EDIT_MEDIA_METADATA: "metadata", APPROVE: "approve", DECLINE: "decline" }[String(action.action)];
|
|
467
|
-
const receipt = actionPanel ? await drafts.receipt(actionPanel) : void 0;
|
|
467
|
+
const receipt = consumeDraft && actionPanel ? await drafts.receipt(actionPanel) : void 0;
|
|
468
468
|
const sent = await request("", { revision_id: review.revision.id, ...action, ...receipt ? { draft: receipt } : {} });
|
|
469
469
|
if (sent.cleared_draft) drafts.consumed(sent.cleared_draft);
|
|
470
470
|
try {
|
|
@@ -578,6 +578,7 @@ function StoryReview({
|
|
|
578
578
|
const selected = revisions.find((r) => r.id === compare), selectedAfter = revisions.find(
|
|
579
579
|
(r) => r.id === (compareTo || review?.revision.id)
|
|
580
580
|
);
|
|
581
|
+
const errorMessage = error ? /* @__PURE__ */ jsxRuntime.jsx("p", { ref: errorRef, tabIndex: -1, role: "alert", className: "sm-review-alert", children: error }) : null;
|
|
581
582
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `sm-review-frame${publicationHeader ? " sm-review-publication-frame" : ""}`, children: [
|
|
582
583
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sm-review-banner-wrap", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sm-review-private", children: [
|
|
583
584
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: review?.published ? "Private review" : "Private preview \xB7 Not published" }),
|
|
@@ -588,7 +589,7 @@ function StoryReview({
|
|
|
588
589
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: review?.publication.name || publicationName })
|
|
589
590
|
] }) }),
|
|
590
591
|
/* @__PURE__ */ jsxRuntime.jsxs("main", { className: `sm-story-review${celebration ? " sm-review-celebration" : ""}`, children: [
|
|
591
|
-
|
|
592
|
+
(!review || panel === "article" || verification) && errorMessage,
|
|
592
593
|
notice && !(approved && finalEditor && notice === approvalThanks) && /* @__PURE__ */ jsxRuntime.jsx("p", { ref: noticeRef, tabIndex: -1, role: "status", className: "sm-review-notice", children: notice }),
|
|
593
594
|
verification && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sm-review-form", children: [
|
|
594
595
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: "Verify your email" }),
|
|
@@ -799,7 +800,7 @@ function StoryReview({
|
|
|
799
800
|
className: `sm-review-actions${celebration ? " sm-review-concierge-actions" : ""}${panel !== "article" ? " sm-review-actions-editing" : ""}`,
|
|
800
801
|
"aria-label": "Review actions",
|
|
801
802
|
children: [
|
|
802
|
-
!can("APPROVE") && can("COMMENT") && (review.identity_required || review.participant) && /* @__PURE__ */ jsxRuntime.jsx("button", { disabled: busy, onClick: () => setPanel("feedback"), children: "Looks
|
|
803
|
+
!can("APPROVE") && can("COMMENT") && (review.identity_required || review.participant) && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "sm-review-primary", disabled: busy, onClick: () => setPanel("feedback"), children: "Looks Good \u2014 Send Feedback" }),
|
|
803
804
|
can("APPROVE") && !review.published && /* @__PURE__ */ jsxRuntime.jsx(
|
|
804
805
|
"button",
|
|
805
806
|
{
|
|
@@ -835,6 +836,7 @@ function StoryReview({
|
|
|
835
836
|
] }),
|
|
836
837
|
panel === "share" && /* @__PURE__ */ jsxRuntime.jsxs("section", { ref: responseRef, tabIndex: -1, className: "sm-review-form", "aria-label": "Share private preview", children: [
|
|
837
838
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: "Share with your family" }),
|
|
839
|
+
errorMessage,
|
|
838
840
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Anyone with this link can read the private preview. To send feedback or photos, they will enter their own name and verify their email. No account is needed." }),
|
|
839
841
|
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "review-share-url", children: "Private preview link" }),
|
|
840
842
|
/* @__PURE__ */ jsxRuntime.jsx("input", { id: "review-share-url", readOnly: true, value: shareUrl, onFocus: (e) => e.currentTarget.select() }),
|
|
@@ -850,6 +852,7 @@ function StoryReview({
|
|
|
850
852
|
] }),
|
|
851
853
|
panel === "identity" && /* @__PURE__ */ jsxRuntime.jsxs("section", { ref: responseRef, tabIndex: -1, className: "sm-review-form", "aria-label": "Introduce yourself", children: [
|
|
852
854
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: identityStep === "code" ? "Check your email" : "Who is helping with the story?" }),
|
|
855
|
+
errorMessage,
|
|
853
856
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Your name will accompany your feedback for the newsroom. Your email stays private. No password or account is needed." }),
|
|
854
857
|
identityStep === "name" ? /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: async (e) => {
|
|
855
858
|
e.preventDefault();
|
|
@@ -912,12 +915,13 @@ function StoryReview({
|
|
|
912
915
|
] }),
|
|
913
916
|
panel === "feedback" && /* @__PURE__ */ jsxRuntime.jsxs("section", { ref: responseRef, tabIndex: -1, className: "sm-review-form", "aria-label": "Family feedback", children: [
|
|
914
917
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: "Looks good to you?" }),
|
|
918
|
+
errorMessage,
|
|
915
919
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
916
920
|
"We'll send your feedback as ",
|
|
917
921
|
review.reviewer,
|
|
918
922
|
". The newsroom will request approval from the designated family reviewer separately. This will not publish the story."
|
|
919
923
|
] }),
|
|
920
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { disabled: busy, onClick: () => void send({ action: "COMMENT", message: "This draft looks good to me.", target: { kind: "STORY" } }, "Thank you. Your feedback has been sent to the newsroom. The story is still private."), children: "Send my feedback" }),
|
|
924
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "sm-review-primary", disabled: busy, onClick: () => void send({ action: "COMMENT", message: "This draft looks good to me.", target: { kind: "STORY" } }, "Thank you. Your feedback has been sent to the newsroom. The story is still private.", false), children: "Send my feedback" }),
|
|
921
925
|
/* @__PURE__ */ jsxRuntime.jsx("button", { disabled: busy, onClick: () => setPanel("article"), children: "Back to the story" })
|
|
922
926
|
] }),
|
|
923
927
|
!["article", "identity", "share", "feedback"].includes(panel) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -932,6 +936,7 @@ function StoryReview({
|
|
|
932
936
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: panel === "approve" ? "Approve this exact draft" : panel === "edits" ? "Propose changes" : panel === "media" ? photoToReplace ? "Change photo" : "Contribute a photograph" : panel === "questions" ? "Tell us a little more" : panel === "history" ? "Selected revision history" : panel === "decline" ? "Prefer not to publish" : panel === "changes" ? "Suggest a change" : "Message the newsroom" }),
|
|
933
937
|
/* @__PURE__ */ jsxRuntime.jsx("button", { disabled: busy, onClick: () => setPanel("article"), children: "Close" })
|
|
934
938
|
] }),
|
|
939
|
+
errorMessage,
|
|
935
940
|
panel !== "history" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sm-review-save-state", role: "status", "aria-live": "polite", children: [
|
|
936
941
|
currentDraft?.status === "conflict" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
937
942
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "A response was saved in another tab or device. Your writing here is still available. Choose which version to keep." }),
|
package/dist/story-review.js
CHANGED
|
@@ -450,7 +450,7 @@ function StoryReview({
|
|
|
450
450
|
}
|
|
451
451
|
setPanel("share");
|
|
452
452
|
}
|
|
453
|
-
async function send(action, success) {
|
|
453
|
+
async function send(action, success, consumeDraft = true) {
|
|
454
454
|
if (!review || busy) return;
|
|
455
455
|
if (action.action === "APPROVE" && file) {
|
|
456
456
|
setNotice("Your photo is not uploaded yet. Upload it or remove the selection before approving.");
|
|
@@ -462,7 +462,7 @@ function StoryReview({
|
|
|
462
462
|
setNotice("");
|
|
463
463
|
try {
|
|
464
464
|
const actionPanel = { ANSWER_QUESTIONS: "questions", REQUEST_CHANGES: "changes", COMMENT: "comment", PROPOSE_EDITS: "edits", EDIT_MEDIA_METADATA: "metadata", APPROVE: "approve", DECLINE: "decline" }[String(action.action)];
|
|
465
|
-
const receipt = actionPanel ? await drafts.receipt(actionPanel) : void 0;
|
|
465
|
+
const receipt = consumeDraft && actionPanel ? await drafts.receipt(actionPanel) : void 0;
|
|
466
466
|
const sent = await request("", { revision_id: review.revision.id, ...action, ...receipt ? { draft: receipt } : {} });
|
|
467
467
|
if (sent.cleared_draft) drafts.consumed(sent.cleared_draft);
|
|
468
468
|
try {
|
|
@@ -576,6 +576,7 @@ function StoryReview({
|
|
|
576
576
|
const selected = revisions.find((r) => r.id === compare), selectedAfter = revisions.find(
|
|
577
577
|
(r) => r.id === (compareTo || review?.revision.id)
|
|
578
578
|
);
|
|
579
|
+
const errorMessage = error ? /* @__PURE__ */ jsx("p", { ref: errorRef, tabIndex: -1, role: "alert", className: "sm-review-alert", children: error }) : null;
|
|
579
580
|
return /* @__PURE__ */ jsxs("div", { className: `sm-review-frame${publicationHeader ? " sm-review-publication-frame" : ""}`, children: [
|
|
580
581
|
/* @__PURE__ */ jsx("div", { className: "sm-review-banner-wrap", children: /* @__PURE__ */ jsxs("div", { className: "sm-review-private", children: [
|
|
581
582
|
/* @__PURE__ */ jsx("strong", { children: review?.published ? "Private review" : "Private preview \xB7 Not published" }),
|
|
@@ -586,7 +587,7 @@ function StoryReview({
|
|
|
586
587
|
/* @__PURE__ */ jsx("span", { children: review?.publication.name || publicationName })
|
|
587
588
|
] }) }),
|
|
588
589
|
/* @__PURE__ */ jsxs("main", { className: `sm-story-review${celebration ? " sm-review-celebration" : ""}`, children: [
|
|
589
|
-
|
|
590
|
+
(!review || panel === "article" || verification) && errorMessage,
|
|
590
591
|
notice && !(approved && finalEditor && notice === approvalThanks) && /* @__PURE__ */ jsx("p", { ref: noticeRef, tabIndex: -1, role: "status", className: "sm-review-notice", children: notice }),
|
|
591
592
|
verification && /* @__PURE__ */ jsxs("section", { className: "sm-review-form", children: [
|
|
592
593
|
/* @__PURE__ */ jsx("h2", { children: "Verify your email" }),
|
|
@@ -797,7 +798,7 @@ function StoryReview({
|
|
|
797
798
|
className: `sm-review-actions${celebration ? " sm-review-concierge-actions" : ""}${panel !== "article" ? " sm-review-actions-editing" : ""}`,
|
|
798
799
|
"aria-label": "Review actions",
|
|
799
800
|
children: [
|
|
800
|
-
!can("APPROVE") && can("COMMENT") && (review.identity_required || review.participant) && /* @__PURE__ */ jsx("button", { disabled: busy, onClick: () => setPanel("feedback"), children: "Looks
|
|
801
|
+
!can("APPROVE") && can("COMMENT") && (review.identity_required || review.participant) && /* @__PURE__ */ jsx("button", { className: "sm-review-primary", disabled: busy, onClick: () => setPanel("feedback"), children: "Looks Good \u2014 Send Feedback" }),
|
|
801
802
|
can("APPROVE") && !review.published && /* @__PURE__ */ jsx(
|
|
802
803
|
"button",
|
|
803
804
|
{
|
|
@@ -833,6 +834,7 @@ function StoryReview({
|
|
|
833
834
|
] }),
|
|
834
835
|
panel === "share" && /* @__PURE__ */ jsxs("section", { ref: responseRef, tabIndex: -1, className: "sm-review-form", "aria-label": "Share private preview", children: [
|
|
835
836
|
/* @__PURE__ */ jsx("h2", { children: "Share with your family" }),
|
|
837
|
+
errorMessage,
|
|
836
838
|
/* @__PURE__ */ jsx("p", { children: "Anyone with this link can read the private preview. To send feedback or photos, they will enter their own name and verify their email. No account is needed." }),
|
|
837
839
|
/* @__PURE__ */ jsx("label", { htmlFor: "review-share-url", children: "Private preview link" }),
|
|
838
840
|
/* @__PURE__ */ jsx("input", { id: "review-share-url", readOnly: true, value: shareUrl, onFocus: (e) => e.currentTarget.select() }),
|
|
@@ -848,6 +850,7 @@ function StoryReview({
|
|
|
848
850
|
] }),
|
|
849
851
|
panel === "identity" && /* @__PURE__ */ jsxs("section", { ref: responseRef, tabIndex: -1, className: "sm-review-form", "aria-label": "Introduce yourself", children: [
|
|
850
852
|
/* @__PURE__ */ jsx("h2", { children: identityStep === "code" ? "Check your email" : "Who is helping with the story?" }),
|
|
853
|
+
errorMessage,
|
|
851
854
|
/* @__PURE__ */ jsx("p", { children: "Your name will accompany your feedback for the newsroom. Your email stays private. No password or account is needed." }),
|
|
852
855
|
identityStep === "name" ? /* @__PURE__ */ jsxs("form", { onSubmit: async (e) => {
|
|
853
856
|
e.preventDefault();
|
|
@@ -910,12 +913,13 @@ function StoryReview({
|
|
|
910
913
|
] }),
|
|
911
914
|
panel === "feedback" && /* @__PURE__ */ jsxs("section", { ref: responseRef, tabIndex: -1, className: "sm-review-form", "aria-label": "Family feedback", children: [
|
|
912
915
|
/* @__PURE__ */ jsx("h2", { children: "Looks good to you?" }),
|
|
916
|
+
errorMessage,
|
|
913
917
|
/* @__PURE__ */ jsxs("p", { children: [
|
|
914
918
|
"We'll send your feedback as ",
|
|
915
919
|
review.reviewer,
|
|
916
920
|
". The newsroom will request approval from the designated family reviewer separately. This will not publish the story."
|
|
917
921
|
] }),
|
|
918
|
-
/* @__PURE__ */ jsx("button", { disabled: busy, onClick: () => void send({ action: "COMMENT", message: "This draft looks good to me.", target: { kind: "STORY" } }, "Thank you. Your feedback has been sent to the newsroom. The story is still private."), children: "Send my feedback" }),
|
|
922
|
+
/* @__PURE__ */ jsx("button", { className: "sm-review-primary", disabled: busy, onClick: () => void send({ action: "COMMENT", message: "This draft looks good to me.", target: { kind: "STORY" } }, "Thank you. Your feedback has been sent to the newsroom. The story is still private.", false), children: "Send my feedback" }),
|
|
919
923
|
/* @__PURE__ */ jsx("button", { disabled: busy, onClick: () => setPanel("article"), children: "Back to the story" })
|
|
920
924
|
] }),
|
|
921
925
|
!["article", "identity", "share", "feedback"].includes(panel) && /* @__PURE__ */ jsxs(
|
|
@@ -930,6 +934,7 @@ function StoryReview({
|
|
|
930
934
|
/* @__PURE__ */ jsx("h2", { children: panel === "approve" ? "Approve this exact draft" : panel === "edits" ? "Propose changes" : panel === "media" ? photoToReplace ? "Change photo" : "Contribute a photograph" : panel === "questions" ? "Tell us a little more" : panel === "history" ? "Selected revision history" : panel === "decline" ? "Prefer not to publish" : panel === "changes" ? "Suggest a change" : "Message the newsroom" }),
|
|
931
935
|
/* @__PURE__ */ jsx("button", { disabled: busy, onClick: () => setPanel("article"), children: "Close" })
|
|
932
936
|
] }),
|
|
937
|
+
errorMessage,
|
|
933
938
|
panel !== "history" && /* @__PURE__ */ jsxs("div", { className: "sm-review-save-state", role: "status", "aria-live": "polite", children: [
|
|
934
939
|
currentDraft?.status === "conflict" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
935
940
|
/* @__PURE__ */ jsx("p", { children: "A response was saved in another tab or device. Your writing here is still available. Choose which version to keep." }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalemule/news-publication",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"description": "Shared server framework for ScaleMule local news publications. Walnut Creek Times is the broadsheet default; each paper supplies its own identity and feature flags.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
package/story-review.css
CHANGED
|
@@ -15,10 +15,15 @@
|
|
|
15
15
|
margin: auto;
|
|
16
16
|
padding-inline: 32px;
|
|
17
17
|
}
|
|
18
|
-
.sm-review-
|
|
19
|
-
width:
|
|
18
|
+
.sm-review-frame .sm-review-banner-wrap {
|
|
19
|
+
width: 100%;
|
|
20
20
|
max-width: none;
|
|
21
|
-
padding-inline:
|
|
21
|
+
padding-inline: max(16px, calc((100% - 976px) / 2));
|
|
22
|
+
background: #fff3c4;
|
|
23
|
+
border-bottom: 2px solid #d5ac30;
|
|
24
|
+
}
|
|
25
|
+
.sm-review-publication-frame .sm-review-banner-wrap {
|
|
26
|
+
padding-inline: max(var(--pub-gutter, 16px), calc((100% - var(--pub-width, 1240px)) / 2));
|
|
22
27
|
}
|
|
23
28
|
.sm-review-publication-frame {
|
|
24
29
|
padding-bottom: 100px;
|
|
@@ -31,11 +36,10 @@
|
|
|
31
36
|
max-width: none;
|
|
32
37
|
}
|
|
33
38
|
.sm-review-publication-frame .sm-review-private {
|
|
34
|
-
color:
|
|
35
|
-
border-color: var(--pub-rule, #d7dcd7);
|
|
39
|
+
color: #5b4816;
|
|
36
40
|
}
|
|
37
41
|
.sm-review-publication-frame .sm-review-private strong {
|
|
38
|
-
color:
|
|
42
|
+
color: #382700;
|
|
39
43
|
}
|
|
40
44
|
.sm-story-review {
|
|
41
45
|
color-scheme: light;
|
|
@@ -51,8 +55,7 @@
|
|
|
51
55
|
}
|
|
52
56
|
.sm-review-private {
|
|
53
57
|
padding: 14px 0;
|
|
54
|
-
|
|
55
|
-
color: var(--pub-muted, #545c55);
|
|
58
|
+
color: #5b4816;
|
|
56
59
|
font:
|
|
57
60
|
13px/1.5 var(--font-inter),
|
|
58
61
|
Arial,
|
|
@@ -63,9 +66,9 @@
|
|
|
63
66
|
flex-wrap: wrap;
|
|
64
67
|
}
|
|
65
68
|
.sm-review-private strong {
|
|
66
|
-
color:
|
|
69
|
+
color: #382700;
|
|
67
70
|
text-transform: uppercase;
|
|
68
|
-
font-size:
|
|
71
|
+
font-size: 13px;
|
|
69
72
|
letter-spacing: 0.08em;
|
|
70
73
|
}
|
|
71
74
|
.sm-review-masthead {
|