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AAM,UAAY,MAAQA,IAAM,SAAW,SAAW,OAmB1CC,EAAeC,GAAc,KAAKA,CAAC,GACnCC,EAAcD,GAAc,sBAAsBA,CAAC,GAGzD,SAASE,EAAcJ,EAA0B,CACvD,MAAMK,EAAI,mBAAmB,KAAKL,EAAE,MAAM,GAAK,eAAe,KAAKA,EAAE,KAAA,CAAM,EACrEE,EAAIG,EAAI,OAAOA,EAAE,CAAC,CAAC,EAAI,IAC7B,OAAO,OAAO,cAAcH,CAAC,GAAKA,EAAI,EAAIA,EAAI,IAC/C","names":["TOPICS","msg","topicOf","k","t","TOPIC_STANDING","TEAM_NAME","DESK_LABEL","SUBJECT_MIN","SUBJECT_MAX","NEW_BODY_MIN","BODY_MAX","COUNTER_FROM","FILES_MAX","FILE_MAX_BYTES","ACTIVE_CAP","REOPEN_DAYS","USER_STATUS_LABEL","groupOf","s","ticketLabel","n","ticketHref","parseTicketNo","m"],"sources":["../../../../../../src/lib/support/tickets.ts"],"sourcesContent":["// Support tickets (S11): the user-facing vocabulary, limits and the status\n// mapping. Client-safe: the staff console, the user pages (S11b) and the\n// server share it. Topics and their copy are the signed-off mock's TOPICS.\n// The user pages show the copy through t(); msg() marks it for the catalogs.\n\nimport { msg } from '$lib/i18n/mark';\n\nexport type TicketDesk = 'trust' | 'support';\nexport type TopicKey = 'billing' | 'login' | 'payout' | 'problem' | 'other';\n\nexport type Topic = {\n\tkey: TopicKey;\n\ticon: string;\n\tlabel: string;\n\tsub: string;\n\t/** shown under the form once the topic is picked (plain text) */\n\thint: string;\n};\n\nexport const TOPICS: readonly Topic[] = [\n\t{\n\t\tkey: 'billing',\n\t\ticon: 'card',\n\t\tlabel: msg('Payment & billing'),\n\t\tsub: msg('Charges, refunds, Pro, token packs'),\n\t\thint: msg(\n\t\t\t'Add the date and the amount. Never send a full card number; the last 4 digits are enough.'\n\t\t)\n\t},\n\t{\n\t\tkey: 'login',\n\t\ticon: 'key',\n\t\tlabel: msg('Account & login'),\n\t\tsub: msg('Sign-in, email change, deleting your account'),\n\t\thint: msg('Tell us how you sign in (Google, Apple, email link) and on which device.')\n\t},\n\t{\n\t\tkey: 'payout',\n\t\ticon: 'wallet',\n\t\tlabel: msg('Rater earnings & payout'),\n\t\tsub: msg('Earned tokens, cash out, wire status'),\n\t\thint: msg('Add the cash-out date and amount. We never ask for your bank login.')\n\t},\n\t{\n\t\tkey: 'problem',\n\t\ticon: 'flag',\n\t\tlabel: msg('Report a problem'),\n\t\tsub: msg('Something broken, stuck or not loading'),\n\t\thint: msg(\n\t\t\t'Reporting a person or a post? Use Report on it, that reaches moderators faster than a ticket.'\n\t\t)\n\t},\n\t{\n\t\tkey: 'other',\n\t\ticon: 'dots',\n\t\tlabel: msg('Other'),\n\t\tsub: msg('Anything that doesn’t fit above'),\n\t\thint: ''\n\t}\n];\n\nexport const TOPIC_KEYS = TOPICS.map((t) => t.key);\nexport const isTopic = (k: unknown): k is TopicKey => TOPIC_KEYS.includes(k as TopicKey);\nexport const topicOf = (k: string | null | undefined): Topic | null =>\n\tTOPICS.find((t) => t.key === k) ?? null;\n\n/** The standing (sanction) ticket's row in the user list. */\nexport const TOPIC_STANDING = { label: msg('Account standing'), icon: 'shield' } as const;\n\n/** How staff show to users: never a name. */\nexport const TEAM_NAME = 'ratemyd. team';\nexport const DESK_LABEL: Record<TicketDesk, string> = {\n\tsupport: msg('Support'),\n\ttrust: msg('Trust & Safety')\n};\n\nexport const SUBJECT_MIN = 4;\nexport const SUBJECT_MAX = 80;\nexport const NEW_BODY_MIN = 20;\nexport const BODY_MAX = 4000;\n/** the composer shows a counter from here */\nexport const COUNTER_FROM = 3600;\nexport const FILES_MAX = 3;\nexport const FILE_MAX_BYTES = 8 * 1024 * 1024;\n/** active user-opened support tickets per user (the standing one doesn't count) */\nexport const ACTIVE_CAP = 3;\n/** waiting on the user, or answered, this long → decided / closed */\nexport const SILENCE_DAYS = 7;\n/** a closed ticket reopens on a reply within this many days */\nexport const REOPEN_DAYS = 14;\n\n/** The four statuses a user ever sees (§4.4). */\nexport type UserStatus = 'waiting' | 'open' | 'answered' | 'closed';\n\nexport const USER_STATUS_LABEL: Record<UserStatus, string> = {\n\twaiting: msg('Waiting on you'),\n\topen: msg('Open'),\n\tanswered: msg('Answered'),\n\tclosed: msg('Closed')\n};\n\n/** Internal status → what the user sees. A trust case waits on the user only\n *  with an open question (an imported legacy hold waits with none: Open). */\nexport function userStatus(desk: TicketDesk, status: string, hasOpenQuestion: boolean): UserStatus {\n\tswitch (status) {\n\t\tcase 'waiting_user':\n\t\t\treturn desk === 'support' || hasOpenQuestion ? 'waiting' : 'open';\n\t\tcase 'answered':\n\t\t\treturn 'answered';\n\t\tcase 'resolved':\n\t\tcase 'dismissed':\n\t\t\treturn 'closed';\n\t\tdefault:\n\t\t\treturn 'open';\n\t}\n}\n\n/** The list group: Waiting on you, Open (answered included), Closed. */\nexport type TicketGroup = 'due' | 'open' | 'closed';\nexport const groupOf = (s: UserStatus): TicketGroup =>\n\ts === 'waiting' ? 'due' : s === 'closed' ? 'closed' : 'open';\n\nconst DAY_MS = 86_400_000;\nconst plus = (at: number | null | undefined, days: number) =>\n\tat == null ? null : at + days * DAY_MS;\n\n/** The dates the user is shown (epoch ms, null when not applicable). */\nexport function deadlines(row: {\n\twaitingSince?: number | null;\n\tansweredAt?: number | null;\n\tclosedAt?: number | null;\n}): { waitingUntil: number | null; closesOn: number | null; reopenUntil: number | null } {\n\treturn {\n\t\twaitingUntil: plus(row.waitingSince, SILENCE_DAYS),\n\t\tclosesOn: plus(row.answeredAt, SILENCE_DAYS),\n\t\treopenUntil: plus(row.closedAt, REOPEN_DAYS)\n\t};\n}\n\nexport const ticketLabel = (n: number) => `K-${n}`;\nexport const ticketHref = (n: number) => `/account/support/K-${n}`;\n\n/** \"K-2231\" / \"k2231\" / \"2231\" → 2231, else null (the ticket URL segment). */\nexport function parseTicketNo(s: string): number | null {\n\tconst m = /^k-?(\\d{1,12})$/i.exec(s.trim()) ?? /^(\\d{1,12})$/.exec(s.trim());\n\tconst n = m ? Number(m[1]) : NaN;\n\treturn Number.isSafeInteger(n) && n > 0 ? n : null;\n}\n"],"version":3}