PersonalizationHostApi class
Methods
-
beginStoriesAudio()
→ Future<void>
-
Remembers the app's audio session before the stories viewer plays its first video,
so endStoriesAudio can put it back. iOS only; a no-op on Android, where a muted
video never takes the audio focus (
mixWithOthers).
-
endStoriesAudio()
→ Future<void>
-
The viewer closed: restores the session saved by beginStoriesAudio and stops
watching the volume. iOS only; a no-op on Android.
-
getCacheDirectory()
→ Future<String>
-
The app's cache directory: Android
Context.cacheDir, iOS Library/Caches. The
stories viewer keeps its video cache under it.
-
getCategory(String category, int? limit, int? page, String? paramsJson, String? shopId)
→ Future<String>
-
Returns a category product listing as a JSON string.
limit and page paginate the result; both are optional.
paramsJson is a JSON object string with the optional filters: "brands" and
"locations" (comma-separated strings), "filters" (facet name → values),
"price_min" / "price_max" (numbers), "sort_by" / "sort_dir" (strings). A bridge
passes on only what its native SDK takes for a category.
Dart layer parses the result into CategoryResponse.
-
getCollection(String collectionId, String? shopId)
→ Future<String>
-
Returns a merchandised collection's products as a JSON string.
Dart layer parses the result into CollectionResponse.
-
getDid(String? shopId)
→ Future<String?>
-
Returns the device ID assigned by the native SDK, or null before first sync.
-
getLoyaltyStatus(String identifier, String? shopId)
→ Future<String>
-
Returns the loyalty membership status (
loyalty/members/status) as a JSON
string { "status": ..., "payload": { "member": ..., "level": { ... } } }.
identifier is the member identifier (phone).
Dart layer parses the result into LoyaltyStatusResponse.
-
getPlatformVersion()
→ Future<String>
-
-
getProductCounters(String item, String? shopId)
→ Future<String>
-
Returns view / cart / purchase counters for
item as a JSON string.
Dart layer parses the result into ProductCountersResponse.
-
getProductInfo(String itemId, String? shopId)
→ Future<String>
-
Returns a single product's details as a JSON string.
Dart layer parses the result into Product.
-
getProductsList(String? paramsJson, String? shopId)
→ Future<String>
-
Returns a paginated product catalog list as a JSON string.
paramsJson is a JSON object with optional filter fields.
Dart layer parses the result into ProductsListResponse.
-
getProfile(String? shopId)
→ Future<String>
-
Returns the current user's profile as a JSON string.
Dart layer parses the result into ProfileResponse.
-
getRecommendation(String code, String? paramsJson, String? shopId)
→ Future<String>
-
Returns the recommendation block as a JSON string.
paramsJson is a JSON object string with optional filter parameters.
Dart layer parses the result into RecommendationResponse.
-
getSid(String? shopId)
→ Future<String>
-
Returns the current session ID from the native SDK.
-
getStoredPushToken(String? shopId)
→ Future<String?>
-
Returns the push token stored by the native SDK (if any).
-
getStories(String code, String? shopId)
→ Future<String>
-
Returns the stories block
code (stories/{code}) as the server's JSON string,
untouched: { "id": ..., "stories": [...], "settings": {...} }. Both platforms hand
over the same raw payload, so Dart parses one shape.
Dart layer parses the result into StoriesBlock.
-
getStoriesSeen(String shop)
→ Future<Map<String, List<Object?>>>
-
The slide ids seen per story id for
shop — the plugin's own store
(SharedPreferences on Android, UserDefaults on iOS), not the native SDK's. It
survives app restarts. The inner lists are untyped on purpose: the channel
hands nested lists over as List<Object?>, and a typed List<String> here
generates a lazy cast that throws on the first read.
-
handlePush(Map<String, String> payload, int event)
→ Future<void>
-
Routes a push to the shop it belongs to (payload
shop_id) and tracks it
via the native REES46.handlePush. event is the index of the Dart
PushEvent enum: 0 = received, 1 = delivered, 2 = clicked. The native side
maps it to its own vocabulary (Android PushEventType, iOS PushEvent).
-
initialize(InitConfig config)
→ Future<void>
-
-
joinLoyalty(String phone, String? email, String? firstName, String? lastName, String? shopId)
→ Future<String>
-
Joins the loyalty program (
loyalty/members/join) and returns the
response envelope as a JSON string { "status": ..., "payload": { ... } }.
The shop is identified by the SDK's configured shop_id; phone is required.
Dart layer parses the result into LoyaltyJoinResponse.
-
manageSubscription(ManageSubscriptionParamsWire params, String? shopId)
→ Future<void>
-
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
openNotificationSettings()
→ Future<void>
-
Opens the system settings where the user turns notifications on for the app: the
app's notification settings on Android, the app's page in Settings on iOS. What the
native popups do for their push-subscription button.
-
openUrl(String url)
→ Future<bool>
-
Opens
url with the system handler (browser or the app that claims the link).
Returns false when nothing could open it.
-
searchBlank(String? shopId)
→ Future<String>
-
Returns blank search results (trending/popular) as a JSON string.
No parameters — the native SDK decides what to return based on shop config.
Dart layer parses the result into SearchBlankResponse.
-
searchFull(String query, String? paramsJson, String? shopId)
→ Future<String>
-
Returns full search results as a JSON string.
paramsJson is a JSON object string with optional search parameters.
Dart layer parses the result into SearchFullResponse.
-
searchInstant(String query, String? paramsJson, String? shopId)
→ Future<String>
-
Returns instant (typeahead) search results as a JSON string.
paramsJson may contain optional "locations" (String) and "excluded_brands" (String).
Dart layer parses the result into SearchInstantResponse.
-
setProfile(ProfileParamsWire params, String? shopId)
→ Future<void>
-
-
setStorySlideSeen(String shop, String storyId, String slideId)
→ Future<void>
-
Records
slideId of story storyId as seen for shop.
-
shareUrl(String url, double anchorX, double anchorY, double anchorWidth, double anchorHeight)
→ Future<void>
-
Shows the system share sheet with one link
url — the "Share" button of the stories
viewer. Completes when the sheet is gone: iOS — completionWithItemsHandler of
UIActivityViewController; Android — the window got its focus back after the
chooser (Intent.createChooser of ACTION_SEND). The anchor is the button in
logical pixels of the Flutter view: the popover of the sheet points at it on iPad.
-
toString()
→ String
-
A string representation of this object.
inherited
-
trackAddToCart(TrackingItemWire item, TrackingSourceWire? source, String? shopId)
→ Future<void>
-
-
trackAddToFavorites(String itemId, TrackingSourceWire? source, String? shopId)
→ Future<void>
-
-
trackCategoryView(String categoryId, String? shopId)
→ Future<void>
-
-
trackEvent(String event, int? time, String? category, String? label, int? value, String? customFieldsJson, String? shopId)
→ Future<void>
-
customFieldsJson is JSON object string or null (maps to native custom fields map).
-
Reports popup
popupId as shown (popup/showed) — native tracking.popupShown
(Android) / trackPopupShown (iOS). The native SDKs never show a popup themselves
under the plugin, so they never report one either: Dart does, once it is on screen.
-
trackProductView(String itemId, TrackingSourceWire? source, String? shopId)
→ Future<void>
-
-
trackPurchase(String orderId, double orderPrice, List<PurchaseLineItemWire> items, String? deliveryType, String? deliveryAddress, String? paymentType, bool isTaxFree, bool isGiftPackage, String? promocode, double? orderCash, double? orderBonuses, double? orderDelivery, double? orderDiscount, String? channel, String? customJson, String? recommendedSourceJson, String? stream, String? segment, String? shopId)
→ Future<void>
-
customJson and recommendedSourceJson are JSON object strings or null.
-
trackRemoveFromCart(String itemId, String? shopId)
→ Future<void>
-
-
trackRemoveFromFavorites(String itemId, String? shopId)
→ Future<void>
-
-
trackSearch(String query, List<String>? results, String? shopId)
→ Future<void>
-
-
trackSetSource(TrackingSourceWire source, String? shopId)
→ Future<void>
-
Stores the attribution source natively for the next event.
-
trackStoryClick(String storyId, String slideId, String? code, String? shopId)
→ Future<void>
-
-
trackStoryView(String storyId, String slideId, String? code, String? shopId)
→ Future<void>
-
-
trackSyncCart(List<TrackingItemWire> items, String? shopId)
→ Future<void>
-
-
trackSyncFavorites(List<String> itemIds, String? shopId)
→ Future<void>
-
-
updateStoriesAudio(bool muted)
→ Future<void>
-
While the viewer plays video: muted — the
ambient category, which never
interrupts other apps' audio; unmuted — playback. Also starts watching the
hardware volume (see PersonalizationStoriesFlutterApi.onStoriesVolumeUp). iOS
only; a no-op on Android.