support_ui library

The Shotik Support widget: launcher, bottom sheet, conversation list and thread, built from plain Flutter widgets.

Classes

Attachment
Conversation
CustomAction
ErasableAnalytics
An install's analytics as Delete my data sees it: forget() asks the server to delete the install and starts a new one; reset() starts a new one when forget could not reach the server.
FileStorage
Friction
What the friction chip offers help for (PROTOCOL.md 3.12). kind: purchase_fail, rage, error.
HealthFilter
Tap and rage labels (after redaction) that contain a health term become "health". HEALTH_TERMS is always on; extra adds app terms under the same rules. Element ids are not touched.
HttpTransport
LocalAttachment
A picked image or screenshot before upload. Give bytes; the queue keeps them in a file until delivered.
MemoryStorage
Message
Offer
A save offer for one cancel reason as the device sees it: the founder's words only. SupportClient.askForOffer asks the founder, whose click sends the code or the plan change (nothing that touches money reaches the user without it).
ReviewRules
When reviewMoment may ask for a review (PROTOCOL.md 3.11): successes needed per moment, then the founder's limits.
Shotik
ShotikColors
Color overrides for one scheme; null keeps the default.
ShotikConfig
ShotikCopy
ShotikDevice
ShotikFrictionChip
The friction chip on its own, for hosts that place it (wrap it in Positioned or Align). Shows while state.friction is set and the sheet is closed.
ShotikNative
ShotikResponse
ShotikRoot
ShotikRootState
ShotikSocket
ShotikStorage
ShotikSupport
ShotikSupportTheme
ShotikSupportWidget
ShotikTransport
Subscription
The user's subscription as the host app knows it (RevenueCat customerInfo, Play Billing, in_app_purchase), PROTOCOL.md 3.8. status: trial, active, grace, billing_retry, cancelled, expired, refunded, none. period: P1W, P1M, P3M, P6M, P1Y, lifetime. store: app_store, play, stripe. Times are epoch ms.
SupportAction
A native button under a founder or AI message. kind: manage_subscription, restore, redeem_code (value = offer code), change_plan (value = product id), request_refund, open_url (value = https URL), write_review, custom (value = your action id), or anything newer.
SupportClient
SupportState
UserInfo
WidgetConfig
The founder's widget settings for this user (GET /support/v1/config): one save offer per cancel reason (too_expensive, not_using, bug, other; empty while the user is inside the offer cooldown), review rules, screens where the friction chip stays quiet, custom actions.

Enums

ActionResult
EraseResult
deleteMyData (PROTOCOL.md 3.13): done once the server confirmed, pending while the request waits on the device.
Pending
Receipt
SupportStatus

Constants

DEFAULT_SERVER → const String
HEALTH_TERMS → const List<String>

Functions

actionsOf(Message m) → List<SupportAction>
A message's actions (meta.actions): at most 3, each with a kind and a label.
attachmentsOf(Message m) → List<Map<String, Object?>>
A message's attachments: server ones carry path (signed, relative to serverUrl); optimistic ones carry bytes (Uint8List) or file (a local path).
flushInterval(int flushMs, int backoff) → Duration
Analytics flush interval: flushMs × 2^backoff, backoff capped at 5.
healthPattern([List<String> extra = const []]) → RegExp
The filter as one regex: HEALTH_TERMS plus the app's healthTerms, matched against the lowercased label.
localId(String prefix) → String
prefix + time in base 36 + 8 random characters, like the reference's localId().
receiptOf(Message m, List<Message> list, Conversation? conv, {bool offline = false}) → Receipt?
Receipt for one of your messages (PROTOCOL.md 3.5): failed, queued (waiting, or offline) or sending, then seen when it is not among the conversation's last founderUnread user messages, delivered when deliveredAt is set, else sent.
reconnectDelay(int n, [Random? random]) → Duration
Reconnect delay: min(30 s, 500 ms × 2^n) × uniform(0.8, 1.2), n = consecutive failures.
resolveServer(String? url, {bool release = kReleaseMode}) → String?
The base URL to use, or null when nothing may be sent. Trailing slashes are removed. An empty URL, or in a release build (not release == false) plain http to a host outside loopback, *.local, 10/8, 172.16/12, 192.168/16, 169.254/16 and fc00::/7, sends nothing and warns once. https is always allowed; debug builds allow anything.
retryAfter(int status, Map<String, String> headers, DateTime now) → Duration?
How long a 429 or 503 asks the client to wait (Retry-After in seconds or as an HTTP date), capped at 1 h; null when the status is another one or the header is missing or unreadable (the caller then uses its normal backoff).
retryDelay(int attempts) → Duration
Send retry delay: min(30 s, 500 ms × 2^attempts).

Exceptions / Errors

HttpError