@wral/report-it 0.1.4 → 0.2.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 +88 -3
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +2184 -1799
- package/dist/index.mjs +153 -91
- package/dist/{wral-code-input-DCemMj53.js → wral-code-input-BH_1EP8b.js} +1142 -522
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,66 @@
|
|
|
1
|
-
import { W as
|
|
2
|
-
const
|
|
3
|
-
formId:
|
|
4
|
-
title:
|
|
5
|
-
description:
|
|
6
|
-
flowVersion:
|
|
7
|
-
order:
|
|
8
|
-
enabled:
|
|
9
|
-
start:
|
|
10
|
-
budget:
|
|
11
|
-
nodes:
|
|
12
|
-
},
|
|
13
|
-
formId:
|
|
14
|
-
title:
|
|
15
|
-
description:
|
|
16
|
-
flowVersion:
|
|
17
|
-
order:
|
|
18
|
-
enabled:
|
|
19
|
-
start:
|
|
20
|
-
budget:
|
|
21
|
-
nodes:
|
|
22
|
-
}, P = {
|
|
1
|
+
import { W as Oe, b as Be, a as Ce, c as De, d as je, e as Me } from "./wral-code-input-BH_1EP8b.js";
|
|
2
|
+
const v = "news", _ = "News tip or story idea", I = "News tips and story ideas routed to the news desk queue; assignment editors are emailed. Breaking reports flag urgent. The 5 On Your Side and Investigates options hand off to those forms.", L = "2026-09-25.1", $ = 0, W = !0, A = "news_type", S = { maxFiles: 5, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime", "application/pdf"] }, R = [{ id: "news_type", type: "choice", prompt: "What kind of news?", options: [{ id: "breaking", label: "Breaking or happening now", flags: ["urgent"], next: "news_detail" }, { id: "idea", label: "Story idea", next: "news_detail" }, { id: "fiveoys", label: "5 On Your Side or consumer complaint", form: "consumer", path: ["consumer_kind:fiveoys"] }, { id: "investigates", label: "Something for WRAL Investigates", form: "investigates" }] }, { id: "news_detail", type: "collect", prompt: "Tell us what happened.", next: "verify", fields: [{ key: "description", kind: "textarea", label: "What happened? Include when and where.", required: !0, maxLength: 5e3 }, { key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }, { key: "address", kind: "text", label: "Address", autocomplete: "street-address", maxLength: 500 }, { key: "zip", kind: "text", label: "Zip code", inputMode: "numeric", autocomplete: "postal-code", pattern: "^\\d{5}(-\\d{4})?$", maxLength: 10 }, { key: "willing", kind: "select", label: "Are you willing to talk with a reporter?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "media", kind: "media", label: "Do you have video, photos or files to upload?" }, { key: "rights", kind: "consent", label: "Rights confirmation", requiredIf: "media", text: "I have obtained the attached materials in a lawful manner and have the necessary rights to submit them here. I give WRAL permission to use, copy, modify, and distribute the attached materials as WRAL sees fit, and to use my name in connection with the materials." }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:news", confirmation: { title: "Your tip is on its way to the newsroom.", body: "It goes to the news desk queue and the assignment editors are emailed.", urgentNote: "Breaking reports are pinned to the top of the queue." } }], T = {
|
|
3
|
+
formId: v,
|
|
4
|
+
title: _,
|
|
5
|
+
description: I,
|
|
6
|
+
flowVersion: L,
|
|
7
|
+
order: $,
|
|
8
|
+
enabled: W,
|
|
9
|
+
start: A,
|
|
10
|
+
budget: S,
|
|
11
|
+
nodes: R
|
|
12
|
+
}, q = "weather", Y = "Weather photo or report", F = "Weather reports routed to the weather desk queue; meteorologists are emailed.", O = "2026-09-25.1", B = 1, C = !0, D = "weather_detail", j = { maxFiles: 5, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime"] }, M = [{ id: "weather_detail", type: "collect", prompt: "Tell us about the weather.", next: "verify", fields: [{ key: "description", kind: "textarea", label: "What did you see?", required: !0, maxLength: 1e3 }, { key: "location", kind: "location", label: "Location of your weather report", required: !0 }, { key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Your phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }, { key: "willing", kind: "select", label: "Are you willing to talk with a reporter?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "media", kind: "media", label: "Do you have video or photos to upload?" }, { key: "rights", kind: "consent", label: "Rights confirmation", requiredIf: "media", text: "I have obtained the attached materials in a lawful manner and have the necessary rights to submit them here. I give WRAL permission to use, copy, modify, and distribute the attached materials as WRAL sees fit, and to use my name in connection with the materials." }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:weather", confirmation: { title: "Sent to the WRAL weather team.", body: "Your report goes to the weather desk queue and the meteorologists are emailed." } }], N = {
|
|
13
|
+
formId: q,
|
|
14
|
+
title: Y,
|
|
15
|
+
description: F,
|
|
16
|
+
flowVersion: O,
|
|
17
|
+
order: B,
|
|
18
|
+
enabled: C,
|
|
19
|
+
start: D,
|
|
20
|
+
budget: j,
|
|
21
|
+
nodes: M
|
|
22
|
+
}, V = "tech", E = "Technical issue", P = "Technical issues with structured platform, symptom and time fields. On-air problems go to broadcast engineering; digital problems go to tech support by email until Jira Service Management exists.", U = "2026-09-25.1", H = 2, z = !0, Z = "tech_platform", J = { maxFiles: 3, maxFileBytes: 26214400, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp"] }, K = [{ id: "tech_platform", type: "choice", prompt: "Where are you seeing the problem?", options: [{ id: "web", label: "wral.com", next: "tech_symptom" }, { id: "app", label: "iOS or Android app", next: "tech_symptom" }, { id: "ott", label: "Roku, Apple TV, Fire TV or Samsung TV Plus", next: "tech_symptom" }, { id: "onair", label: "On-air broadcast", next: "tech_symptom_onair" }] }, { id: "tech_symptom", type: "choice", prompt: "What is happening?", options: [{ id: "noaudio", label: "No audio", next: "tech_detail" }, { id: "blackscreen", label: "Black screen", next: "tech_detail" }, { id: "crash", label: "Crash or will not open", next: "tech_detail" }, { id: "buffering", label: "Buffering or freezing", next: "tech_detail" }, { id: "wrongcontent", label: "Wrong content playing", next: "tech_detail" }, { id: "other", label: "Something else", next: "tech_detail" }] }, { id: "tech_detail", type: "collect", prompt: "A few details help us reproduce it.", next: "verify", fields: [{ key: "observedAt", kind: "datetime", label: "When did you notice it?" }, { key: "description", kind: "textarea", label: "Describe the problem", placeholder: "What were you watching or doing when it happened?", required: !0, maxLength: 5e3 }, { key: "media", kind: "media", label: "Screenshot" }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "jsm:tech-support", confirmation: { title: "Sent to tech support.", body: "Tech support is emailed your platform, symptom and details." } }, { id: "tech_symptom_onair", type: "choice", prompt: "What is happening?", options: [{ id: "noaudio", label: "No audio", next: "tech_detail_onair" }, { id: "blackscreen", label: "Black screen", next: "tech_detail_onair" }, { id: "wrongcontent", label: "Wrong content playing", next: "tech_detail_onair" }, { id: "other", label: "Something else", next: "tech_detail_onair" }] }, { id: "tech_detail_onair", type: "collect", prompt: "A few details help us reproduce it.", next: "verify_onair", fields: [{ key: "observedAt", kind: "datetime", label: "When did you notice it?" }, { key: "description", kind: "textarea", label: "Describe the problem", placeholder: "What were you watching or doing when it happened?", required: !0, maxLength: 5e3 }, { key: "media", kind: "media", label: "Screenshot" }] }, { id: "verify_onair", type: "gate", next: "submit_onair" }, { id: "submit_onair", type: "terminal", route: "studio+email:tech-onair", confirmation: { title: "Sent to WRAL broadcast engineering.", body: "Broadcast engineering is emailed your symptom and details." } }], G = {
|
|
23
|
+
formId: V,
|
|
24
|
+
title: E,
|
|
25
|
+
description: P,
|
|
26
|
+
flowVersion: U,
|
|
27
|
+
order: H,
|
|
28
|
+
enabled: z,
|
|
29
|
+
start: Z,
|
|
30
|
+
budget: J,
|
|
31
|
+
nodes: K
|
|
32
|
+
}, Q = "consumer", X = "5 On Your Side or WRAL Investigates", ee = "The 5 On Your Side hub. Consumer complaints go to the 5 On Your Side queue and the consumer team is emailed; the Investigates option hands off to the investigates form.", te = "2026-09-25.1", ie = 3, oe = !0, ne = "consumer_kind", ae = { maxFiles: 5, maxFileBytes: 26214400, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime", "application/pdf"] }, se = [{ id: "consumer_kind", type: "choice", prompt: "What would you like to send?", options: [{ id: "fiveoys", label: "5 On Your Side or consumer complaint", next: "consumer_detail" }, { id: "investigates", label: "Something for WRAL Investigates", form: "investigates" }] }, { id: "consumer_detail", type: "collect", prompt: "Tell us about your complaint.", help: "This goes to the 5 On Your Side consumer team.", next: "consumer_company_q", fields: [{ key: "subject", kind: "text", label: "Subject of your complaint", role: "subject", required: !0, maxLength: 200 }, { key: "description", kind: "textarea", label: "Describe your complaint. Be specific and include when this happened.", required: !0, maxLength: 5e3 }] }, { id: "consumer_company_q", type: "choice", prompt: "Is your complaint about a company?", options: [{ id: "companyyes", label: "Yes", next: "consumer_company" }, { id: "companyno", label: "No", next: "consumer_resolution" }] }, { id: "consumer_company", type: "collect", prompt: "Tell us about the company.", next: "consumer_resolution", fields: [{ key: "company", kind: "text", label: "What is the company name?", required: !0 }, { key: "inbusiness", kind: "select", label: "Is the company still in business?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }, { id: "notsure", label: "Not sure" }] }, { key: "companysite", kind: "url", label: "Link to the company's website or social media pages" }] }, { id: "consumer_resolution", type: "collect", prompt: "What has happened since?", next: "consumer_contact", fields: [{ key: "tried", kind: "textarea", label: "What have you done to try to resolve the issue?", maxLength: 5e3 }, { key: "legal", kind: "select", label: "Have you pursued legal action, retained or consulted with an attorney?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "agency", kind: "select", label: "Have you filed a complaint with another agency or with the Better Business Bureau?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "fair", kind: "textarea", label: "What result do you think is fair?", maxLength: 5e3 }, { key: "media", kind: "media", label: "Do you have video, photos or files to upload?" }, { key: "rights", kind: "consent", label: "Rights confirmation", requiredIf: "media", text: "I have obtained the attached materials in a lawful manner and have the necessary rights to submit them here. I give WRAL permission to use, copy, modify, and distribute the attached materials as WRAL sees fit, and to use my name in connection with the materials." }] }, { id: "consumer_contact", type: "collect", prompt: "How can the team reach you?", next: "verify", fields: [{ key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }, { key: "address", kind: "text", label: "Address", autocomplete: "street-address", maxLength: 500 }, { key: "zip", kind: "text", label: "Zip code", inputMode: "numeric", autocomplete: "postal-code", pattern: "^\\d{5}(-\\d{4})?$", maxLength: 10 }, { key: "willing", kind: "select", label: "Are you willing to talk with a reporter?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:consumer", confirmation: { title: "Sent to 5 On Your Side.", body: "Your complaint goes to the 5 On Your Side consumer team. They read every complaint and follow up on the ones they pursue." } }], re = {
|
|
33
|
+
formId: Q,
|
|
34
|
+
title: X,
|
|
35
|
+
description: ee,
|
|
36
|
+
flowVersion: te,
|
|
37
|
+
order: ie,
|
|
38
|
+
enabled: oe,
|
|
39
|
+
start: ne,
|
|
40
|
+
budget: ae,
|
|
41
|
+
nodes: se
|
|
42
|
+
}, le = "investigates", de = "Something for WRAL Investigates", me = "Tips for WRAL Investigates, routed to the Investigates queue and emailed to the team. Unlisted: reached from the news and 5 On Your Side forms, or ?flow=investigates.", ce = "2026-09-25.1", ue = 4, pe = !0, he = !1, ye = "investigates_detail", ge = { maxFiles: 10, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime", "application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"] }, be = [{ id: "investigates_detail", type: "collect", prompt: "What should we look into?", help: "This goes to the WRAL Investigates team.", next: "investigates_material", fields: [{ key: "subject", kind: "text", label: "Subject of your investigation", role: "subject", required: !0, maxLength: 200 }, { key: "description", kind: "textarea", label: "Describe what we should look into. Be specific and include when this happened.", required: !0, maxLength: 5e3 }, { key: "legal", kind: "select", label: "Have you pursued legal action, retained or consulted with an attorney?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }, { key: "fair", kind: "textarea", label: "What result do you think is fair?", maxLength: 5e3 }] }, { id: "investigates_material", type: "collect", prompt: "Anything to share with us?", next: "investigates_contact", fields: [{ key: "media", kind: "media", label: "Documents, video or photos to upload, such as incident reports or legal paperwork" }, { key: "rights", kind: "consent", label: "Rights confirmation", requiredIf: "media", text: "I have obtained the attached materials in a lawful manner and have the necessary rights to submit them here. I give WRAL permission to use, copy, modify, and distribute the attached materials as WRAL sees fit, and to use my name in connection with the materials." }] }, { id: "investigates_contact", type: "collect", prompt: "How can the team reach you?", next: "verify", fields: [{ key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }, { key: "address", kind: "text", label: "Address", autocomplete: "street-address", maxLength: 500 }, { key: "zip", kind: "text", label: "Zip code", inputMode: "numeric", autocomplete: "postal-code", pattern: "^\\d{5}(-\\d{4})?$", maxLength: 10 }, { key: "willing", kind: "select", label: "Are you willing to talk with a reporter?", options: [{ id: "yes", label: "Yes" }, { id: "no", label: "No" }] }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio+email:investigates", confirmation: { title: "Sent to WRAL Investigates.", body: "Your tip goes to the WRAL Investigates team. They read every submission and follow up on the ones they pursue." } }], fe = {
|
|
43
|
+
formId: le,
|
|
44
|
+
title: de,
|
|
45
|
+
description: me,
|
|
46
|
+
flowVersion: ce,
|
|
47
|
+
order: ue,
|
|
48
|
+
enabled: pe,
|
|
49
|
+
listed: he,
|
|
50
|
+
start: ye,
|
|
51
|
+
budget: ge,
|
|
52
|
+
nodes: be
|
|
53
|
+
}, we = "community", ke = "Community event, photo or video", xe = "Community events, photos and video for the Studio community review queue (no email). Whether the event is upcoming or past is recorded in the path. Featured media is credited by name.", ve = "2026-09-25.1", _e = 5, Ie = !0, Le = "community_type", $e = { maxFiles: 5, maxFileBytes: 524288e3, allowedTypes: ["image/jpeg", "image/png", "image/heic", "image/webp", "video/mp4", "video/quicktime", "application/pdf"] }, We = [{ id: "community_type", type: "choice", prompt: "What would you like to share?", options: [{ id: "upcoming", label: "Something that's coming up", next: "community_upcoming" }, { id: "past", label: "Something that already happened", next: "community_past" }] }, { id: "community_upcoming", type: "collect", prompt: "Tell us about it.", next: "verify", fields: [{ key: "description", kind: "textarea", label: "Tell us about it. Please include a description, day, time and location.", required: !0, maxLength: 5e3 }, { key: "media", kind: "media", label: "Choose files: upload any photos, video or a press release to preview your event" }, { key: "rights", kind: "consent", label: "Rights confirmation", requiredIf: "media", text: "I have obtained the attached materials in a lawful manner and have the necessary rights to submit them here. I give WRAL permission to use, copy, modify, and distribute the attached materials as WRAL sees fit, and to use my name in connection with the materials." }, { key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Your phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }] }, { id: "community_past", type: "collect", prompt: "Tell us about it.", next: "verify", fields: [{ key: "description", kind: "textarea", label: "Tell us about it. Please include a description, day, time and location.", required: !0, maxLength: 5e3 }, { key: "media", kind: "media", label: "Choose files: upload any photos, video or a press release from your event" }, { key: "rights", kind: "consent", label: "Rights confirmation", requiredIf: "media", text: "I have obtained the attached materials in a lawful manner and have the necessary rights to submit them here. I give WRAL permission to use, copy, modify, and distribute the attached materials as WRAL sees fit, and to use my name in connection with the materials." }, { key: "name", kind: "text", label: "Your name", autocomplete: "name", maxLength: 200 }, { key: "phone", kind: "text", label: "Your phone number", inputMode: "tel", autocomplete: "tel", maxLength: 40 }] }, { id: "verify", type: "gate", next: "submit" }, { id: "submit", type: "terminal", route: "studio:community", confirmation: { title: "Shared with our editors.", body: "Community submissions go to the review queue. If we feature yours, we credit you by name." } }], Ae = {
|
|
54
|
+
formId: we,
|
|
55
|
+
title: ke,
|
|
56
|
+
description: xe,
|
|
57
|
+
flowVersion: ve,
|
|
58
|
+
order: _e,
|
|
59
|
+
enabled: Ie,
|
|
60
|
+
start: Le,
|
|
61
|
+
budget: $e,
|
|
62
|
+
nodes: We
|
|
63
|
+
}, Se = {
|
|
23
64
|
formId: "demo-redirect",
|
|
24
65
|
title: "Demo: a redirect path",
|
|
25
66
|
description: "Demonstrates the redirect dead-end card.",
|
|
@@ -64,119 +105,140 @@ const x = "weather", v = "Weather photo or report", q = "Weather reports routed
|
|
|
64
105
|
confirmation: { title: "Thanks!", body: "This demo submission went nowhere." }
|
|
65
106
|
}
|
|
66
107
|
]
|
|
67
|
-
},
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
for (let
|
|
72
|
-
|
|
73
|
-
|
|
108
|
+
}, k = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
109
|
+
function Re(u, m = []) {
|
|
110
|
+
const a = new Map((u?.nodes || []).map((r) => [r.id, r])), h = [...m];
|
|
111
|
+
let o = a.get(u?.start);
|
|
112
|
+
for (let r = 0; o && r < 50; r++) {
|
|
113
|
+
if (o.type === "terminal") return o;
|
|
114
|
+
if (o.type === "choice") {
|
|
115
|
+
const n = String(h.shift() || "").split(":")[1];
|
|
116
|
+
o = a.get((o.options || []).find((y) => y.id === n)?.next);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
o = a.get(o.next);
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
function Te() {
|
|
124
|
+
const u = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10).replace(/-/g, "");
|
|
125
|
+
let m = "";
|
|
126
|
+
for (let a = 0; a < 5; a++)
|
|
127
|
+
m += k[Math.floor(Math.random() * k.length)];
|
|
128
|
+
return `RI-${u}-${m}`;
|
|
74
129
|
}
|
|
75
|
-
function
|
|
76
|
-
const
|
|
77
|
-
let
|
|
78
|
-
const
|
|
130
|
+
function qe({ latency: u = 250, anonymous: m = null } = {}) {
|
|
131
|
+
const a = [T, N, G, re, fe, Ae, Se], h = /* @__PURE__ */ new Map();
|
|
132
|
+
let o = 0, r = !1, n = { email: null, verified: !1 }, y = null, f = !1;
|
|
133
|
+
const l = (e = u) => new Promise((t) => setTimeout(t, e)), g = (e) => {
|
|
79
134
|
try {
|
|
80
135
|
return new URLSearchParams(globalThis.location?.search || "").get(e) === "1";
|
|
81
136
|
} catch {
|
|
82
137
|
return !1;
|
|
83
138
|
}
|
|
84
|
-
},
|
|
139
|
+
}, x = () => g("demofail"), w = m === null ? g("anon") : !!m;
|
|
85
140
|
return {
|
|
86
141
|
demo: !0,
|
|
87
142
|
// ── api surface ─────────────────────────────────────────────
|
|
88
|
-
listForms: async () => (await
|
|
89
|
-
createUploads: async ({ formId: e, files:
|
|
90
|
-
await
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
const
|
|
94
|
-
throw
|
|
143
|
+
listForms: async () => (await l(), a),
|
|
144
|
+
createUploads: async ({ formId: e, files: t }) => {
|
|
145
|
+
await l();
|
|
146
|
+
const d = a.find((i) => i.formId === e)?.budget || {};
|
|
147
|
+
if (t.length > (d.maxFiles ?? 5)) {
|
|
148
|
+
const i = new Error("demo: too many files");
|
|
149
|
+
throw i.status = 400, i.body = [{ message: `This form accepts at most ${d.maxFiles} files` }], i;
|
|
95
150
|
}
|
|
96
|
-
return
|
|
97
|
-
const
|
|
151
|
+
return t.map(() => {
|
|
152
|
+
const i = crypto.randomUUID();
|
|
98
153
|
return {
|
|
99
|
-
assetId:
|
|
100
|
-
url: `demo:${
|
|
154
|
+
assetId: i,
|
|
155
|
+
url: `demo:${i}`,
|
|
101
156
|
method: "PUT",
|
|
102
157
|
expires: new Date(Date.now() + 6e5).toISOString(),
|
|
103
|
-
assetUrl: `https://report-it.assets.wral.com/${
|
|
158
|
+
assetUrl: `https://report-it.assets.wral.com/${i}`
|
|
104
159
|
};
|
|
105
160
|
});
|
|
106
161
|
},
|
|
107
|
-
uploadFile: ({ file: e, onProgress:
|
|
162
|
+
uploadFile: ({ file: e, onProgress: t = () => {
|
|
108
163
|
} }) => {
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
let
|
|
164
|
+
o += 1;
|
|
165
|
+
const s = o;
|
|
166
|
+
let d = !1;
|
|
112
167
|
return { promise: (async () => {
|
|
113
|
-
const
|
|
114
|
-
for (let
|
|
115
|
-
if (await
|
|
116
|
-
const
|
|
117
|
-
throw
|
|
168
|
+
const c = e.size || 1;
|
|
169
|
+
for (let b = 1; b <= 4; b++) {
|
|
170
|
+
if (await l(300), d) {
|
|
171
|
+
const p = new Error("aborted");
|
|
172
|
+
throw p.status = 0, p.body = { aborted: !0 }, p;
|
|
118
173
|
}
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
throw
|
|
174
|
+
if (x() && s === 2 && !r && b === 2) {
|
|
175
|
+
r = !0;
|
|
176
|
+
const p = new Error("demo: simulated upload failure");
|
|
177
|
+
throw p.status = 0, p;
|
|
123
178
|
}
|
|
124
|
-
|
|
179
|
+
t({ loaded: c * b / 4, total: c });
|
|
125
180
|
}
|
|
126
181
|
return { status: 200 };
|
|
127
182
|
})(), abort: () => {
|
|
128
|
-
|
|
183
|
+
d = !0;
|
|
129
184
|
} };
|
|
130
185
|
},
|
|
131
|
-
putRequest: async (e,
|
|
132
|
-
if (await
|
|
133
|
-
const
|
|
134
|
-
throw
|
|
186
|
+
putRequest: async (e, t) => {
|
|
187
|
+
if (await l(), !n.verified && y?.requestId !== e) {
|
|
188
|
+
const c = new Error("demo: not signed in");
|
|
189
|
+
throw c.status = 401, c;
|
|
135
190
|
}
|
|
136
|
-
if (
|
|
137
|
-
return
|
|
138
|
-
const
|
|
191
|
+
if (h.has(e))
|
|
192
|
+
return h.get(e);
|
|
193
|
+
const s = a.find((c) => c.formId === t.formId), d = Re(s, t.path), i = {
|
|
139
194
|
requestId: e,
|
|
140
|
-
reference:
|
|
141
|
-
confirmation:
|
|
142
|
-
routing: { destination:
|
|
195
|
+
reference: Te(),
|
|
196
|
+
confirmation: d?.confirmation || { title: "Report received.", body: "" },
|
|
197
|
+
routing: { destination: d?.route || "email:general", state: "delivered" }
|
|
143
198
|
};
|
|
144
|
-
return
|
|
199
|
+
return h.set(e, i), i;
|
|
145
200
|
},
|
|
146
201
|
// ── auth surface ────────────────────────────────────────────
|
|
147
|
-
isAuthenticated: async () =>
|
|
148
|
-
signedInEmail: () =>
|
|
149
|
-
sendCode: async (e) => (await
|
|
202
|
+
isAuthenticated: async () => n.verified,
|
|
203
|
+
signedInEmail: () => n.verified ? n.email : null,
|
|
204
|
+
sendCode: async (e) => (await l(), n = { email: e, verified: !1 }, { challengeRequired: !0, newAccount: !g("demoexisting") }),
|
|
150
205
|
verifyCode: async (e) => {
|
|
151
|
-
if (await
|
|
206
|
+
if (await l(), !/^\d{6}$/.test(e))
|
|
152
207
|
throw new Error("Please enter the 6-digit code.");
|
|
153
|
-
return
|
|
208
|
+
return n.verified = !0, { success: !0 };
|
|
154
209
|
},
|
|
155
210
|
signOut: () => {
|
|
156
|
-
|
|
211
|
+
n = { email: null, verified: !1 };
|
|
212
|
+
},
|
|
213
|
+
saveUserFacts: async (e) => {
|
|
214
|
+
if (await l(), !n.verified)
|
|
215
|
+
throw Object.assign(new Error("demo: not signed in"), { status: 401 });
|
|
216
|
+
if (g("demofactsfail") && !f)
|
|
217
|
+
throw f = !0, Object.assign(new Error("demo: simulated user-facts failure"), { status: 0 });
|
|
218
|
+
n.facts = Object.fromEntries(e.map(({ factName: t, value: s }) => [t, s]));
|
|
157
219
|
},
|
|
158
220
|
// ── anonymous surface (DEV-1270) ────────────────────────────
|
|
159
221
|
// The component reads this the way it reads a real server's
|
|
160
222
|
// GET /v1/forms block: dark unless advertised.
|
|
161
223
|
anonymousCapability: () => ({ enabled: w, humanCheck: null }),
|
|
162
|
-
createAnonSession: async ({ formId: e, requestId:
|
|
163
|
-
if (await
|
|
164
|
-
const
|
|
165
|
-
throw
|
|
224
|
+
createAnonSession: async ({ formId: e, requestId: t }) => {
|
|
225
|
+
if (await l(), !w) {
|
|
226
|
+
const s = new Error("demo: anonymous submission is not available");
|
|
227
|
+
throw s.status = 404, s;
|
|
166
228
|
}
|
|
167
|
-
return
|
|
229
|
+
return y = { formId: e, requestId: t }, { expiresIn: 900 };
|
|
168
230
|
},
|
|
169
231
|
endAnonSession: () => {
|
|
170
|
-
|
|
232
|
+
y = null;
|
|
171
233
|
}
|
|
172
234
|
};
|
|
173
235
|
}
|
|
174
236
|
export {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
237
|
+
Oe as WralCodeInput,
|
|
238
|
+
Be as WralReportIt,
|
|
239
|
+
Ce as WralReportMedia,
|
|
240
|
+
De as createAuthAdapter,
|
|
241
|
+
je as createClient,
|
|
242
|
+
qe as createDemoClient,
|
|
243
|
+
Me as createRealClient
|
|
182
244
|
};
|