mysampark_chat 1.2.2 copy "mysampark_chat: ^1.2.2" to clipboard
mysampark_chat: ^1.2.2 copied to clipboard

Official MySampark Chat Widget for Flutter. Add AI-powered live chat with human agent takeover, typing indicators, lead forms, and real-time WebSocket support.

1.2.2 #

  • Added a "Select" button to product cards, shown when the backend sends select_products: true on a reply (only for widgets that have a booking-style action/sequence which actually uses the id it sends back — a plain Q&A bot's cards are unaffected). Tapping it sends [ProductCard.id] back as selected_product_id on the next message, so the backend settles which item the conversation is about exactly, instead of guessing it back from the product name as plain text. Distinct from the existing "View product" button, which still opens the product itself (in-app via onProductTap, or the browser).
  • ChatService.sendMessage() takes an optional selectedProductId parameter, sent as selected_product_id.
  • Added MessagePayload.selectProducts, parsed from select_products. Requires a backend that sends it; older backends simply leave it false and no Select button renders.

1.2.1 #

  • Added ProductCard.features — vendor/sku/barcode/attributes as synced from Shopify/WooCommerce/the push API. Null for a manually-entered product or one with no synced attributes. Requires a backend that sends features on products_referenced cards; older backends simply leave it null.
  • Added ProductCard.raw — the card exactly as the backend sent it, so a host app can read a field this class doesn't model yet without waiting on a package update.

1.2.0 #

  • Added onProductTap to MySamparkChatScreen and MySamparkChatBubble — a product card can now open inside the host app instead of throwing the visitor out to a browser. Return true from the callback and the package does nothing further; return false, or leave it unset, and the card's URL opens exactly as before, so an app only writes code for the products it actually stocks. The BuildContext passed in is the chat's own, which is what pops the bubble's bottom sheet — the host app's context can't, and pushing from it leaves the product page hidden behind the sheet.
  • Added ProductCard.externalId and ProductCard.source — the merchant's own id for the product and which catalogue it came from (api, shopify, woocommerce). ProductCard.id has always been MySampark's internal id, which a host app can't match against its own catalogue; externalId is the one to look up. Null for products the merchant typed in by hand, and for cards restored from conversations that predate this release, both of which fall back to the browser on their own.
  • A product card with no URL is now tappable when onProductTap is set, so an app-only listing can still open — previously the whole card and its button were hidden without a link.
  • Requires a backend that sends external_product_id on products_referenced. Older backends simply leave it null.
  • Fixed: every non-INR price rendered with a bare $. ProductCard.formattedPrice had one branch — ₹ for INR, $ for everything else — so a Singapore merchant's SGD 48 card read as US dollars, and so did AUD, CAD, HKD and NZD. Prices now carry their regional prefix (S$, A$, C$, NZ$, HK$, NT$, R$, MX$), the major non-dollar symbols are listed too, and an unlisted currency falls back to its ISO code (MYR 48) rather than guessing. intl's NumberFormat.simpleCurrency is not used for this — its own table maps SGD, AUD, CAD, HKD and NZD all to a bare $.
  • Fixed: the header ignored the merchant's support hours. support_online has always arrived on init() and been parsed into WidgetConfig.supportOnline, but nothing read it — the status dot reflected only whether the WebSocket was connected. A merchant who marked Sundays closed saw "Offline" on their own website widget and "Online" here. The status now combines both, exactly as the web widget does.
  • Fixed: "talk to a human" buttons appeared outside support hours. A confirm_escalation reply rendered its Yes/No buttons whenever it was on screen, including when replayed from history after closing time — offering the visitor a handoff nobody was there to take. They now render only while support is online.

1.1.8 #

  • Fixed: product cards never rendered in chat. The backend sends products_referenced alongside a product_list / product_detail reply, and the reply text is only an introduction — "Here are some products currently available: A, B, C." — so the app showed that sentence and nothing else, with no picture, price or link. Cards now render under the reply as a horizontal carousel, matching the web widget.
  • Fixed: offer cards never rendered in chat. Same cause, worse symptom: an offer_list reply's text is "Here are our current offers:" and the cards were dropped, leaving a bubble that ended on a colon. In-chat offers now use the same tile as the Offers tab. (The Offers tab itself was unaffected — it loads from /offers separately.)
  • Fixed: merchant-defined Track Order fields were ignored. order_tracking_extra_fields arrives on init() and the web widget renders one input per entry, sending them back under params. This package rendered none and sent none, so a merchant whose order API requires an extra field (a postcode, a phone number) got an incomplete request and the visitor got "we couldn't find that order" for a correctly filled form. Shopify-backed order tracking was never affected — that path takes no extra parameters.
  • Added ProductCard and OrderTrackingField models, and exported MessagePayload, MessageHighlight, MessageSection and MessageCta — all four were already reachable through ChatMessage.payload without being nameable.
  • ChatService.trackOrder() takes an optional params map.

1.1.7 #

  • pub.dev score maintenance, no behavior changes:
    • Added dartdoc comments across the public API (MySamparkChatBubble, MySamparkChatScreen, ChatService, and all exported models) for the pub.dev "Provide documentation" score.
    • Bumped intl to ^0.20.3 and flutter_lints to ^6.0.0 (up-to-date dependencies score).
    • Fixed all analyzer lints flagged by flutter_lints 6.0.0 (withOpacity → withValues, unnecessary_library_name, curly_braces_in_flow_control_structures, string concatenation → interpolation) and applied dart format.

1.1.6 #

  • Fixed: MySamparkChatBubble's in-app notification banner could pop up on top of a MySamparkChatScreen the visitor already had open, if that screen was opened some other way than the bubble's own _openChat() (e.g. a host app's own "Support" tab doing its own Navigator.push) — the bubble only tracked whether it had opened the chat, with no way to know a different screen instance was already showing that exact message live.
  • Added MySamparkChatScreen.isAnyScreenOpen — tracks whether any instance is currently mounted, regardless of how it was opened. The bubble now checks this alongside its own state before showing the banner or incrementing the unread badge.

1.1.5 #

  • Fixed: conversation starters now render on the Home tab (a card-style list above Offers/Chat/Track, matching the web widget), instead of only as chips inside an already-empty chat view. Tapping one switches to the Chat tab and sends it immediately, going through the same pre-chat survey gate as a normal message.
  • Removed the old chat-view starter chips row — the web widget never had this either; starters live on Home only.

1.1.4 #

  • Guest-to-login merge: a visitor's session_id is no longer cached per-identity, so a guest who logs in mid-session keeps the same session_id and the backend now merges their guest conversation into their identified thread instead of starting a disconnected second one.
  • Backend: init(), message(), and trackOrder() all guard this merge against a shared/reused device — a session_id match is only adopted if it isn't already a different identity's conversation, so logging out and having someone else use the same device (or a plain anonymous visitor after that) can never inherit the previous person's thread, name, or email. submitLead() got the equivalent guard against overwriting an already-identified visitor's details.

1.1.3 #

  • Fixed: is_identified from the backend now also reflects this request's own HMAC verification, not just an existing conversation's persisted flag — a first-time logged-in visitor (verified but with no conversation yet, since those are only created lazily) was incorrectly treated as anonymous, so they'd see the pre-chat survey and the order-tracking email field even though they were already identified.
  • Fixed: trackOrder() now sends session_id and the visitor's identity params (user_id/user_hash/user_name/user_email) — required by the backend's /track-order fallback path for visitors who reach "Track your order" before ever sending a chat message. Without this, that path could never be reached (missing session_id failed validation first), and even once reached, an identified visitor's freshly-created conversation had no email attached, causing a dead-end "Email is required" error with no visible field to fix it.

1.1.2 #

  • MySamparkChatScreen now mirrors the web widget's close behaviour: if a conversation was started, its WebSocket stays open for a 5-minute grace period after the screen closes instead of disconnecting immediately (ChatService.scheduleGraceClose()). Screens with no started conversation still disconnect right away.
  • Redesigned the Offers card: tinted header, a highlight badge, and the description's meta facts (min order, usage limit, etc.) now render as scannable pill badges instead of stacked plain-text lines.
  • OfferItem gained a badge field (e.g. "10% OFF", "FREE SHIPPING") — set by the backend from the actual discount data, not guessed from free text on the client.

1.1.1 #

  • ChatService WebSocket connection now matches the web widget's resilience pattern: capped auto-reconnect (max 5 attempts, exponential backoff up to 16s) instead of giving up permanently on onDone/onError.
  • Added a 25s ping keepalive while connected.
  • Added a manual-close flag so an intentional disconnectWebSocket()/dispose() doesn't trigger a reconnect attempt.
  • Fixes MySamparkChatBubble's in-app notification banner going silent after the first WebSocket drop (app backgrounded, network blip, etc).

1.1.0 #

  • Home tab — MySamparkChatScreen now opens on a branded greeting screen with Offers / Chat / Track Order cards, matching the web widget's layout.
  • Offers card — fetches live deals/discount codes from GET /api/chatbot/offers, tap-to-copy code.
  • Order tracking card — order lookup form (POST /api/chatbot/track-order) showing status, carrier, and tracking link; skips the email prompt for HMAC-identified users.
  • WidgetConfig gained homeGreetingTitle, homeGreetingSubtitle, showOffers, showOrderTracking, and now correctly reads action_color from the backend instead of always falling back to primary_color.
  • New exported models: OfferItem, OrderTrackResult.
  • Home / Chat bottom navigation; hidden while the pre-chat survey or an Offers/Order-Track sheet is open so it can't be used to bypass a non-skippable survey.

1.0.1 #

  • Simplified documentation for cleaner Flutter integration.

1.0.0 #

  • Initial release
  • Full-screen chat screen (MySamparkChatScreen)
  • Floating bubble launcher (MySamparkChatBubble)
  • AI-powered replies with human agent takeover
  • Real-time WebSocket support for live agent messages
  • Pre-chat survey gate (admin controlled)
  • In-chat lead form (name/email/phone)
  • Conversation starters / quick-reply chips
  • Typing indicator with 3-dot bounce animation
  • Chat history with scroll-up pagination
  • Online/Offline status display
  • Logo, colors, and all settings synced from admin dashboard
  • HMAC-SHA256 identity verification for logged-in users
  • Session persistence via SharedPreferences
0
likes
0
points
701
downloads

Publisher

unverified uploader

Weekly Downloads

Official MySampark Chat Widget for Flutter. Add AI-powered live chat with human agent takeover, typing indicators, lead forms, and real-time WebSocket support.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

crypto, emoji_picker_flutter, flutter, http, image_picker, intl, shared_preferences, url_launcher, uuid, web_socket_channel

More

Packages that depend on mysampark_chat