hatang_chat 0.5.0
hatang_chat: ^0.5.0 copied to clipboard
Hatang live chat for Flutter apps: a native customer-support chat screen that talks to your Hatang site over REST and WebSocket, with identity, events, presence and push hooks.
Changelog #
All notable changes to hatang_chat are documented here. The format follows
Keep a Changelog and the package uses
Semantic Versioning.
[Unreleased] #
0.5.0 - 2026-10-14 #
Added #
- The chat screen follows more of the site's widget settings (dashboard:
Hỗ trợ → Kênh → choose the site); older gateways that omit them keep
today's behaviour.
- Header: the subtitle under the site name (current language only), and
the business logo (or the site name's first letter) instead of the
agents when the profile is
business. Agent avatars now show their pictures, falling back to initials. - Greeting: hidden when turned off or off on mobile (the SDK counts every platform as mobile); with the "online agent" sender, the first online agent's name shows under it.
- Contact buttons: a scrolling row of Zalo, Messenger, phone and email
pills under the header (only
https:,tel:andmailto:links), opened withurl_launcher.
- Header: the subtitle under the site name (current language only), and
the business logo (or the site name's first letter) instead of the
agents when the profile is
SiteConfig.header(HeaderConfig,HeaderProfile),SiteConfig.greetingOptions(GreetingOptions,GreetingSender) andSiteConfig.contactButtons(ContactButton,ContactKind).greetingRowFor(config, locale, online:)andGreetingRow.sender.HatangChatStrings.callUsandemailUs(required when building aHatangChatStringsby hand;copyWithis unaffected).
0.4.0 - 2026-10-13 #
Fixed #
- A paid payment card no longer stays pending (QR, transfer note and Pay
still showing) after the customer pays: the card message is not updated
live, so the card also counts as paid when the timeline has an
order_paidmessage for its order or anorder_paidevent for its payment or order. Paid and expired cards now also hide the transfer note. - Payment cards now show the VietQR code. The gateway serves
qr_image_urlas SVG (/pay/{id}/qr.svg), whichImage.networkcannot decode, so the code never appeared. The SDK now draws it natively from the EMVCo payload, taken from the card (qr_payload/qr.payload) or, for older cards, from the public checkout (GET /pay/{id}); a rasterqr_image_urlstill works. A failed lookup shows a QR icon and a Retry button instead of spinning. - Product, order and payment cards no longer repeat their plain-text summary
(the copy the gateway keeps for email, push and other channels) in a bubble
above the card; only the sender's intro line is kept (
metadata.intro, or parsed from the text), and with no intro the bubble is hidden. Quick replies, ratings and unknown card kinds still show the text.
Added #
PaidMarks,PaymentCard.statusPaid/isPaid(marks)andMessageRow.paid.PaymentCard.qrPayload,PaymentQr(resolve,checkoutUrlFor,isRaster),PaymentQrSource,PaymentQrException, andHatangChatController.resolvePaymentQr/ChatEngine.resolvePaymentQr.ProductCard.introandcardBubbleText(content, card, {intro}).- Dependency on
qr(pure Dart, by the Dart team's kevmoo) to encode the code.
0.3.2 - 2026-09-29 #
Added #
- "Chat by hatang.dev" (vi: "Chat bởi hatang.dev") under the composer, like
the web widget. It is plain text, not a link, and follows the
poweredBystring override.
0.3.1 - 2026-09-28 #
Added #
HatangChatLauncherfollows the site's launcher settings from the dashboard: the preset icon (chat, support headset, question mark, round message) or the site's image, and a per-language label that turns it into an extended button such as "Hỗ trợ".childstill overrides both.SiteConfig.launcher(LauncherConfig,LauncherIcon) exposes them.
0.3.0 - 2026-09-28 #
Changed (breaking, 0.x) #
- File attachments need a picker: pass
pickFiletoHatangChat.configure(orHatangAttachmentPicker(pickFile:)). The attach sheet offers "File" only when one is set; camera and photo library are unchanged. Thefile_picker13 picker moved topackage:hatang_chat/file_picker.dart(pickFile: hatangFilePicker), so the main library no longer importsfile_pickerand apps pinned to an older one can add the SDK.
Changed #
- Wider dependency ranges so existing apps resolve without upgrading native
plugins:
flutter_secure_storage>=10.0.0 <12.0.0,flutter_image_compress^2.3.0,image_picker^1.1.2.
Fixed #
reset()before the chat ever connected (autoConnect: false) did nothing, so signing out kept the previous user's visitor. It now forgets the stored visitor without opening a connection.
Added #
HatangAttachmentPicker,HatangAttachmentSourceandHatangFilePickare exported frompackage:hatang_chat/hatang_chat.dart.
0.2.4 - 2026-09-28 #
Fixed #
- "Load earlier messages" showed in a conversation an agent opened with a
greeting although nothing older existed: the first visible item is past
seq 1 because assignment events are hidden from the visitor. The SDK now
uses the gateway's
timeline_has_more(bootstrap andready), falling back to the old guess with gateways that do not send it.
Added #
- Example app on Android: push works with the public demo without any
build flags (the demo's Firebase client options are in
lib/demo.dart; the demo site holds the matching service account).
0.2.3 - 2026-09-28 #
Fixed #
handleNotification(data, context: …)waited until the chat screen was closed, so start-up code that awaited it (as in the README) hung while the chat was open. It now returns once the chat is pushed, like thenavigatorKeyand cold-start paths.
Added #
- Example app: a Push tab (FCM token, paste a token, simulate notification
taps) and optional Firebase Messaging wired to
setPushTokenandhandleNotification, enabled with--dart-define=FIREBASE_*values.
Documentation #
- iOS push checklist in the README (App ID matching the bundle ID exactly,
APNs key in Firebase, capabilities); a mismatched App ID shows up as APNs
TopicDisallowed. - Android: replies use the notification channel
hatang_messages; the README shows how to create it (otherwise Firebase's fallback channel is used). - Local development on the Android emulator uses
adb reverse tcp:3002 tcp:3002;10.0.2.2reached the REST API but not the WebSocket, whose URL the gateway builds from itsCHAT_URL.
0.2.2 - 2026-09-28 #
Added #
- Screenshots on pub.dev and in the README.
- The example app runs against Hatang's public demo inbox when started
without
--dart-definevalues (dart pub unpack hatang_chat, thenflutter runinexample/).
0.2.1 - 2026-09-27 #
Changed #
- Text on the site colour (your bubbles, filled buttons, badges) is now dark
or white, whichever has the higher contrast, instead of white for most
colours. With the default
#0ea5e9it becomes dark (7:1 instead of 2.8:1). Where the site colour is used as text (quick replies, outlined buttons, links, prices) it is darkened or lightened just enough to reach 4.5:1.HatangChatTheme.accentText,contrastRatioandreadableOnexpose the rule; setonMineBubbleto keep white bubble text.
Fixed #
- Card buttons and quick replies use the app's font (
labelLarge) instead of the platform default. - Accessibility: the offline and "connecting" banners meet 4.5:1 contrast, the composer is at least 48 px tall, and order and payment lines wrap instead of overflowing when the text size is doubled.
- The package is WebAssembly-compatible (
flutter build web --wasm): on the web the app version is read fromversion.jsonand the browser from the user agent instead ofpackage_info_plus/device_info_plus, and photos are sent as picked instead of going throughflutter_image_compress. Native platforms behave as before. - Flutter web could not connect: the SDK sent the whole browser user agent as
app.os_versionand the gateway rejected the bootstrap (over 40 characters). The web now reportsChrome 140/Chrome on macOS, and every app field is cut to the gateway's limits on all platforms (locale tags to language-region).
0.2.0 - 2026-09-27 #
Added #
- Cards under the team's messages: product carousel (View opens the product page, Buy prefills the composer), order summary, payment request (VietQR, copyable transfer note, Pay now; paid and expired states), quick replies (newest message only) and the 1–5 star rating with an optional comment.
HatangCommerce(configure(commerce:),HatangConversationView(commerce:)):onBuyProductandonPayhooks so an app can sell through App Store / Play in-app purchase, andshowExternalCheckout: falseto hide the QR code, the transfer note and the web checkout where store rules forbid external payment.- Attachments: an attach button in the composer (camera on phones, photo
library, any file), upload progress on the pending bubble, retry that resumes
an unfinished upload, HEIC/HEIF photos converted to JPEG and large photos
scaled to 2048 px before upload, 10 MB and file-type checks before sending.
Received pictures show as thumbnails cached by attachment id (re-signed links
do not re-download) and open in a full-screen viewer with pinch and
double-tap zoom; other files show name and size and open in the system
handler. Expired links are refreshed once per message.
HatangChatController.attach,pickAndSend,pickAndSendImage,pickAndSendFile;HatangAttachmentPickerfor hosts with their own UI. - History:
HatangChatInbox(andHatangChat.openInbox) lists the visitor's conversations with the agent, last message, time, unread count and resolved status, with pull to refresh and paging; tapping one opens it and "New message" returns to the current conversation.HatangChat.open(context, conversationId: …)now opens that conversation (also from a notification on a cold start). Writing into a resolved conversation reopens it; a closed one is read-only. Engine/controller:listConversations,openConversation,openActive. - Embedding:
setBottomPaddingnow moves a chat screen and launcher that are already shown (bottomPaddingListenable); the launcher uses the host's string overrides. The example app has an Embedded tab. - The User-Agent carries the OS version (
hatang-chat-flutter/0.2.0 (ios/18.1; protocol/1)), andsdkVersionis generated from pubspec.yaml by the release tooling so they cannot drift. ProductCardItem.appStoreProductId/googlePlayProductId(andhasStoreProduct): the in-app purchase ids a shop sets per product in the dashboard, soonBuyProductneeds no SKU mapping.
0.1.0 - 2026-09-28 #
Added #
HatangChat.configurewith a site id and app key; the SDK bootstraps a visitor, keeps its token in secure storage and connects to the Hatang gateway over WebSocket (protocol v1).HatangChatScreenandHatangChat.open(context): a full-screen text chat with greeting, away banner, day separators, typing indicator, read receipts, pending/failed bubbles with tap-to-retry and earlier-history paging.- Session API:
identify,setData,pushEvent,setLocale,setScreen,reset,restoreSession,linkTokenFromUri,session. - Streams:
events,unreadCount(+unreadCountListenable),availability,connectionState. - App lifecycle:
app.stateframes on background/foreground with a delayed socket close and a resume on return. - Push hooks (
setPushToken,clearPushToken,isHatangNotification,handleNotification); device registration is deferred until the gateway ships the/devicesendpoints. - Offline pre-chat form and email request gating, Vietnamese and English strings, light/dark theme derived from the site colour.
Coming #
- Rich cards (products, orders, payments, quick replies, CSAT), attachments and image viewer, inbox of earlier conversations, launcher bubble, embedded conversation view (0.2.0).
