Genesis

Packages

@marktiderman/genesis-support

0.13.0Module

Support and feedback for Genesis apps, in the app's own Supabase: a feedback record (bug, idea, question, praise) with the app's context and screenshots, collector and sink seams with a Supabase sink, a web feedback panel and launcher, a native feedback screen with screenshot capture, annotation and shake to report, the person's reports with staff replies (on genesis-chat with the support-chat block: live, with files, an assignee and internal notes), and an idea board with votes and "you asked, we shipped". Declared as a defineBlock block. Part of the Genesis framework.

Support and feedback for Genesis apps, kept in **the app's own Supabase**:

- a **feedback record** (bug, idea, question or praise; the message; the version signature, route, platform and device; screenshots) behind two seams, a `ContextCollector` and a `FeedbackSink`, with a Supabase sink; - **web**: a feedback panel and a floating launcher built from Genesis UI, a screenshot of the tab (the browser asks first) with pen marks and hidden areas, and pins on the page; - **native**: a feedback screen, screenshot capture with mark-up that can hide private parts, and **shake to report**; the person's reports as an inbox with staff replies and read receipts; an **idea board** with one vote per person, and "you asked, we shipped" tied to FeatureIds; - **diagnostics**: a context dump (`genesis.diagnostics/1`) to the app's own server, on demand, on a shake and with every piece of feedback, scrubbed on the device and again on the server, with a `/server` handler for apps with their own API; - a `defineBlock` declaration (`support-feedback`) that adds **Send feedback** and **Help** to Settings, names its routes and its migration.

genesis add support-feedback
pnpm add @marktiderman/genesis-support

READMEChangelognpm

@marktiderman/genesis-support

Other exports (178)

asksVerification · asksVerification · attachmentBytes · attachmentBytes · awaitsVerification · awaitsVerification · base64ToBytes · base64ToBytes · capReport · captureConsole · chooseDesk · cleanLabel · cleanLabel · cleanRoute · cleanRoute · composeCollectors · composeCollectors · CONTRACT_VERSION · CONTRACT_VERSION · CORE_SECTIONS · createContextCollector · createContextCollector · createDiagnostics · createHealthChecks · createIntakeClient · createIntakeClient · createIntakeSink · createIntakeSink · createOfflineQueue · createSupabaseSink · createSupabaseSink · createSupportClient · createSupportClient · cutToBytes · DEFAULT_QUEUE_KEY · defineDiagnosticSection · defineSupportBlock · defineSupportBlock · defineSupportChatBlock · defineSupportChatBlock · defineSupportEmailBlock · defineSupportEmailBlock · defineSupportHelpdeskBlock · defineSupportHelpdeskBlock · deskTenant · deskTitle · DEVICE_MAX_BYTES · DEVICE_MAX_BYTES · DIAGNOSTIC_TRIGGERS · DIAGNOSTICS_DEFAULTS · DIAGNOSTICS_SCHEMA · DIAGNOSTICS_SETTING_SPECS · DIAGNOSTICS_TABLE · DiagnosticsSendError · diagnosticsSettings · diagnosticsShortId · diagnosticsViewSections · emptyReport · EXTRA_MAX_BYTES · EXTRA_MAX_BYTES · FEEDBACK_FORM_FIELDS · FEEDBACK_REPORT_TYPES · FEEDBACK_REPORT_TYPES · FEEDBACK_STATUSES · FEEDBACK_STATUSES · FEEDBACK_TYPES · FEEDBACK_TYPES · fill · fill · HEALTH_CHECK_TIMEOUT_MS · HEALTH_RESULTS_MAX_AGE_MS · HEALTH_STATUSES · healthChecks · healthChecksSection · helpArticleDoc · helpArticleDoc · helpCenterPages · helpCenterPages · httpTransport · IntakeError · IntakeError · inZone · inZone · isMissingFunction · isMissingFunction · isRetryableError · isSitePath · isSitePath · isUnderPath · isUnderPath · isUnread · isUnread · isUuid · jsonByteLength · lastMoveLine · LIMITS · LIMITS · mailtoHref · memoryQueueStorage · officeHoursState · officeHoursState · pageOf · pageOf · pickerDesks · randomUuid · redactReport · reportHeading · reportHeading · reportVersionLine · requesterTenantsLabel · requesterTenantsLabel · resolveSupportCopy · resolveSupportCopy · resolveSupportSettings · sanitizeContext · sanitizeContext · sentryEventLink · SHAKE_SETTING_SPECS · shakeSettings · storedByteLength · stripZone · stripZone · supabaseHealthChecks · supabaseTransport · SUPPORT_BLOCK_ID · SUPPORT_BLOCK_ID · SUPPORT_BUCKET · SUPPORT_BUCKET · SUPPORT_CHAT_BLOCK_ID · SUPPORT_CHAT_BLOCK_ID · SUPPORT_CHAT_KIND · SUPPORT_CHAT_KIND · SUPPORT_CHAT_SUBJECT · SUPPORT_CHAT_SUBJECT · SUPPORT_EMAIL_BLOCK_ID · SUPPORT_EMAIL_BLOCK_ID · SUPPORT_HELPDESK_BLOCK_ID · SUPPORT_HELPDESK_BLOCK_ID · SUPPORT_NOTIFICATION_TYPES · SUPPORT_SETTING_SPECS · SUPPORT_SETTINGS_DECLARATIONS · SUPPORT_TO_CHAT_STATUS · SUPPORT_TO_CHAT_STATUS · supportContact · supportContributions · supportContributions · supportCopy · supportCopy · SupportError · SupportError · supportNotificationTypes · supportPaths · supportPaths · supportQueueSource · supportQueueSource · supportScreenOf · supportScreenOf · supportSettings · supportSettingsCatalogue · supportSettingValues · TICKET_STATUS_TONES · TICKET_STATUS_TONES · TICKET_SUBJECT · TICKET_SUBJECT · ticketInbox · ticketInbox · ticketSegments · ticketSegments · toDiagnosticCheck · validateSubmitInput · validateSubmitInput · waitingSinceOf · waitingSinceOf · WIDGET_HEADERS · WIDGET_HEADERS · workedDesks · zoneOf · zoneOf

And 130 types.

@marktiderman/genesis-support/web

Components (2)

  • FeedbackLauncher
  • FeedbackPanel

Hooks (2)

  • useFeedbackDraft

    A feedback draft for a host to hold outside the panel (see `FeedbackPanelProps.draft`).

  • useFeedbackShortcut

    Opens feedback from anywhere on the page with a key press (default ⌘⇧. / Ctrl+Shift+.). The press counts as the person's gesture, so the panel may ask to capture the tab right away.

Other exports (14)

annotateScreenshot · canCaptureScreenshot · captureScreenshot · createPinOverlay · FEEDBACK_SHORTCUT · flushDiagnosticsOnReconnect · matchesShortcut · mountSupportWidget · pickPin · resolvePin · stableLocator · undoMark · webContextCollector · webSections

And 12 types.

@marktiderman/genesis-support/web-chat

Components (17)

  • SupportAgentInbox

    A tenant's help desk inbox: its queues, the open ticket's thread and its details. Another tenant is a fresh inbox.

  • SupportAgentReports

    The help desk's numbers over a range of days: opened, closed, median first response and time to close, open now and by customer.

  • SupportAgentsAdmin

    A help desk's agents (`staffList`, with each one's role), for whoever manages them (`canManageAgents`): find someone in the desk's tenant (`searchPeople`) and add them as an agent or an admin, or remove a removable one (`setAgent`). Anyo...

  • SupportContact

    Email and support-page links, or nothing.

  • SupportDeskControls

    Where the ticket is, and moving it: a tenant desk's handler sends it up to the app's own desk; the app's own desk hands an escalated one back; either moves it to another desk its person belongs to. Nothing shows for a ticket that never m...

  • SupportDeskPicker

    A desk picker for someone who works more than one desk (the app's staff who also run a tenant's desk, an agent of two tenants). Renders nothing for one desk or none. Pair it with `chooseDesk(desks, asked)` for the desk the inbox opens.

  • SupportDeskSwitch

    A tenant's settings: whether its people's questions come to its own help desk, or go to the app's support. Its admins turn it on or off (`support_set_desk`, which keeps every change); anyone else sees it disabled. Renders nothing for som...

  • SupportHelpCenterAdmin

    A tenant's help center, for its agents.

  • SupportLinkRequester

    An email ticket with no login: find the person in the ticket's tenant (`searchPeople`) and, after a confirm that names both, link it to their login (`linkRequester`), so it shows in their app. It can't be undone here. For the desk's agen...

  • SupportMessenger

    The messenger: Home, Messages and Help, in whatever holds it. Another tenant is another messenger: nothing carries over.

  • SupportMessengerLauncher

    A button with the unread count that opens the messenger: in the chat dock when there is one, else a sheet.

  • SupportMyMentions

    Where the signed-in agent was mentioned in an internal note (`agentMentions`, migration 0014), newest first; each opens its ticket.

  • SupportReportThread

    The person's view of their report: the report, then the conversation with support, live.

  • SupportRequesterPanel

    Who wrote: their name and email (a mailto link), the tenants they belong to, and where they wrote from (migration 0022). Whoever manages the desk's agents (`canManageAgents`) also gets "Make an agent" (`setAgent`).

  • SupportSavedRepliesAdmin

    A tenant's saved replies, for its agents: the list, and the one open for editing.

  • SupportStaffThread

    A report for staff: status and assignee controls over the live conversation, with internal notes.

  • SupportTicketDiagnostics

    A ticket's dumps as text sections. Nothing when the client can't read them or there are none.

Hooks (2)

  • useSupportDesks

    The desks the signed-in person works (`support_my_desks`), or undefined while loading.

  • useSupportDeskScope

    A support client's scope for `supportDeskKeys`: the client and the signed-in login (null until it's known).

Other exports (9)

deskName · diagnosticsText · lastMoveLabel · supportAgentKeys · supportDeskKeys · supportDiagnosticsKeys · supportInboxKeys · supportMessengerKeys · supportWebKeys

And 4 types.

@marktiderman/genesis-support/web-boards

Components (6)

  • SupportHelpArticle

    One help article by its slug: its title, summary and body (plain text; blank lines part its paragraphs). A draft, an article the person can't read, or a client without a help center is "not found".

  • SupportIdeaBoard

    The idea board: anyone signed in suggests ideas and votes (one each); staff set an idea's status in its peek.

  • SupportIdeaStatusControl

    Staff: an idea's status, and the FeatureId that delivers it once shipped (blank clears it). Draws nothing when the client has no `setIdeaStatus`.

  • SupportMyReports

    The signed-in person's own reports: unread and status badges, delete with a confirm, and the thread in each peek.

  • SupportReportFeatureControl

    Staff: the FeatureId a report is about (blank clears it). Status is set in the report's thread; saving here reads the report fresh and keeps the status it has now.

  • SupportShippedIdeas

    "You asked, we shipped": shipped ideas the signed-in person suggested or voted for. Read only.

Other exports (3)

ideaVotable · ideaVotesLabel · supportBoardKeys

And 2 types.

@marktiderman/genesis-support/native

Components (8)

  • AgentDeskControls

    Where the ticket is and its last move; a tenant desk's handler sends it up to the app's own desk, the app's own desk hands an escalated one back, and either moves it to another desk its person belongs to. Nothing for a ticket that never ...

  • AgentDeskSwitch

    Whether a tenant's people's questions come to its own help desk or go to the app's support. Its admins turn it on or off (`setDesk`); its agents see it disabled; anyone else sees nothing.

  • AgentTicketDiagnostics

    A ticket's dumps, for an agent. Nothing when the client can't read them or there are none.

  • FeedbackForm
  • HelpAnswerCard

    The AI's answer, or that it has none, always with the way to a person.

  • ScreenshotAnnotator
  • SendDiagnosticsRow

    A "Send diagnostics" row for a Development or About screen: sends the dump, then shows the short id to quote to support, with "Copy id".

  • SupportRoute

    Every support screen, from one route file per zone. See the module's notes. Never throws for want of a support block.

Hooks (18)

  • useAgentInbox

    One queue of a help desk's tickets as `InboxPage` props: latest activity first, unread in bold, the requester, status, assignee and how long they've waited on each row, a switcher between the queues with their counts (`header`), and the ...

  • useAgentThread

    One ticket for an agent as `ThreadPage` props: what the requester wrote, then the conversation (live on genesis-chat, else re-read every `pollMs`); a composer that replies or, on chat, writes an internal note; the ticket's status and ass...

  • useAgentUnreadCount

    How many active tickets in the help desk hold a requester's message no agent has read (`client.agentUnreadCount`), for a badge. 0 for anyone who isn't an agent there, and while it's read.

  • useHelpArticle

    One article, by its slug.

  • useHelpCenter

    The help center: its collections and articles, or within one collection, with search. With the tenant's AI on and `askAi` given to `createSupport`, searching also asks it.

  • useIdeaBoard

    The idea board: most votes first, a vote button on each, and a field to suggest one.

  • useIsSupportAgent

    Does the signed-in person handle this help desk's tickets? `client.isAgent(tenantId)` for a business's, `client.isStaff()` for the app's own (null or left out). False while it's read, when signed out, and when the read fails.

  • useMessengerHome

    Home: a greeting, search, the way to send a message; the latest conversation and articles as rows.

  • useOptionalSupport

    The same block, or `null` when support is off (for a button that hides itself).

  • usePendingFeedback

    The pending feedback, re-rendering when it changes.

  • useSendDiagnostics

    "Send diagnostics": the dump from `diagnostics`, or the support block's (`createSupport({ diagnostics })`).

  • useShippedIdeas

    "You asked, we shipped": the shipped ideas the person suggested or voted for, with the FeatureId each shipped as.

  • useStartConversation

    Start a conversation: an empty thread whose first message becomes a ticket, then its thread opens. With `replyExpectation` or `officeHours` given to `createSupport`, it says how soon people hear back, or when someone's back.

  • useSupport

    The support block, from `GenesisNativeApp blocks` (or `SupportProvider`). Throws outside one.

  • useSupportConversation

    Where a report's thread lives: its genesis-chat conversation (the support-chat block, with a `chat` client given to `createSupport`), or support_replies. For a screen of your own that renders the conversation with `@marktiderman/genesis-...

  • useSupportInbox

    Help: the person's reports, newest first, with unread staff replies, and links to the idea board.

  • useSupportThread

    One report as a conversation: the report itself, then the replies. Marks it read as it opens and as replies arrive. On genesis-chat (the support-chat block) it updates live and shows the photos in replies; otherwise it re-reads support_r...

  • useUnreadReplies

    How many reports have a staff reply the person hasn't read.

Other exports (16)

AGENT_INBOX_VIEWS · AGENT_TICKET_STATUSES · boxOf · createSupport · dumpHeading · HelpArticleBody · listenForShake · nativeSections · observabilitySection · SendFeedbackButton · strokeDots · SUPPORT_QUERY_ROOT · supportAgentKeys · SupportContactRow · SupportProvider · VoteButton

And 27 types.

@marktiderman/genesis-support/email

Other exports (14)

claimsFromAddresses · createReplyToken · htmlToText · MAX_EMAIL_CHARS · MAX_REPLY_CHARS · REPLY_KEY_LABEL · REPLY_MARKER · replyAddress · replyKey · replyKeyring · runSupportEmail · stripReply · supportEmailRoute · verifyReplyToken

And 9 types.

@marktiderman/genesis-support/email-notifications

Other exports (10)

handleSupportInbound · senderAuthenticated · SUPPORT_REPLY_TYPES · supportEmailOptions · supportEmailTemplate · supportEmailTemplates · supportJobClaims · supportReplyConfig · supportReplyProvider · supportReplyRoute

And 5 types.

@marktiderman/genesis-support/ai

Other exports (5)

answerHelpQuestion · HELP_AI_REFUSALS · HELP_ANSWER_FEATURE · HELP_ANSWER_TASK · supportHelpAnswerTask

And 4 types.

@marktiderman/genesis-support/server

Other exports (28)

capReport · createDiagnosticsHandler · DIAGNOSTICS_DEFAULTS · DIAGNOSTICS_SCHEMA · DiagnosticsStoreError · eventSummaryLines · eventTitle · fenced · githubIssueNotifier · hmacSha256Hex · issueBody · issueDetail · looksLikeImage · memoryRateLimiter · messengerNotifier · neutralise · notificationsNotifier · parseDiagnosticReport · parseFeedbackSubmission · readBodyLimited · redactReport · supabaseAuthenticate · supabaseDiagnosticsFiles · supabaseDiagnosticsStore · supportNotifiersFromSettings · verifyWebhookSignature · WEBHOOK_HEADERS · webhookNotifier

And 24 types.