1// Plain-English copy for the signing tablet. 2// 3// The tablet used to print the server's raw code to whoever was standing at it ("Could not save. 4// Please ask staff. (nonce_mismatch)"). A guest cannot act on that, and neither can the staffer they 5// show it to. Every code the /tv/d/:token/sign endpoint can return gets a sentence that says what 6// happened and what to do next. 7// 8// Shared by BOTH tablet controllers on purpose: signing_station_controller (the paired signing 9// station) and tv_display_controller (the lobby-TV fallback overlay). One map, so the two cannot 10// drift into telling the same guest different things. 11// 12// Codes come from DisplaysController#submit_signature, PublicBookingWaiverService#sign! and 13// GuardianWaiverSigningService. Anything unmapped falls back to a sentence that still tells the 14// person what to do, never a bare code. 15const SIGNING_ERROR_MESSAGES = { 16 // --- the session or the document is no longer the one on screen --- 17 not_found: "This tablet lost track of your documents. Please ask the front desk to send them again.", 18 session_not_signable: "These documents were already finished or cancelled. Please ask the front desk to send them again.", 19 document_not_in_session: "Something went wrong with this document. Please ask the front desk to send it again.", 20 document_not_found: "We could not open this document. Please ask the front desk for help.", 21 document_unavailable: "We could not open this document. Please ask the front desk for help.", 22 invalid_waiver: "We could not open this document. Please ask the front desk for help.", 23 24 // --- something about the signature itself --- 25 // NOT "you forgot to draw" -- submit_signature validates the drawing before any service runs, so the only 26 // way this reaches a guest is a user row with no name to stamp on the signature. 27 signature_required: "We are missing your name for this document. Please ask the front desk to add it and send this again.", 28 signature_data_invalid: "We could not read that signature. Please tap Clear and sign again.", 29 invalid_signature: "We could not save that signature. Please tap Clear and sign again.", 30 // NOT "please tick the box". The client checks that itself before it ever posts, so if the SERVER returns 31 // this, the tablet is running an older version that is not sending the confirmation -- and telling the 32 // guardian to do the thing they just did is an unbreakable loop on a minor's waiver. 33 guardian_affirmation_required: "This tablet needs to be refreshed before it can record this signature. Please ask the front desk.", 34 35 // --- the form went stale under the signer --- 36 nonce_mismatch: "This form expired while it was open. Please ask the front desk to send it again.", 37 intent_missing: "This form expired while it was open. Please ask the front desk to send it again.", 38 response_invalid: "This document needs more information than this tablet can collect. Please ask the front desk.", 39 40 // --- who is signing for whom --- 41 not_authorized: "This tablet cannot record a signature for that person. Please ask the front desk for help.", 42 not_a_minor: "This tablet cannot record a signature for that person. Please ask the front desk for help.", 43 invalid: "Something went wrong with this document. Please ask the front desk to send it again.", 44 // The default failure code on all three sign branches, so it is the one most likely to actually appear. 45 waiver_sign_failed: "We could not record that signature. Please ask the front desk for help." 46} 47 48const SIGNING_ERROR_FALLBACK = "We could not save that signature. Please ask the front desk for help." 49 50export function signingErrorMessage(code) { 51 const key = String(code || "").trim() 52 // hasOwnProperty, not a bare lookup: a code of "constructor" / "toString" / "valueOf" resolves an INHERITED 53 // property off Object.prototype and would print a stringified function to a guest instead of falling through 54 // to the fallback. On a screen whose entire job is "never show a person something they cannot read". 55 if (Object.prototype.hasOwnProperty.call(SIGNING_ERROR_MESSAGES, key)) return SIGNING_ERROR_MESSAGES[key]
56 return SIGNING_ERROR_FALLBACK 57} 58 59export default signingErrorMessage;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.