Android · cartesian-ui
Cartesian
The entry point object in cartesian-ui. It initializes the SDK, holds the defaults and presents the assistant.
public object CartesiankotlinMethods
Creates the client (or reuses it if vertical and baseUrl haven't changed) and stores options as the default for every surface. Call it from Application.onCreate. The session token is saved in private SharedPreferences.
Starts CartesianChatActivity, a translucent Activity hosting the adaptive panel. If prompt is set, it is sent as soon as the panel opens. Adds FLAG_ACTIVITY_NEW_TASK when context isn't an Activity.
Properties
The single client. Throws IllegalStateException if initialize wasn't called.
The defaults passed to initialize. This is read-only; call initialize again to change it.
Host callbacks. This is settable at any time. See Events.
Your cart and saved state, for FeatureMode.Host: setCart(Map<productId, quantity>), setSaved(Set<productId>), cartQuantities, savedProductIds.
CartesianListener
public interface CartesianListener {
fun onAddToCart(product: Product, quantity: Int) {}
fun onOpenCart() {}
fun onToggleSaved(product: Product, saved: Boolean) {}
fun onOpenWishlist() {}
fun onProductSelected(product: Product) {}
fun onCheckout(cart: Cart): Boolean = false
fun onEvent(event: ChatEvent) {}
fun onSignInRequired() {}
}kotlin