Collection of functions responsible for tracking commerce activity in an Eitri-App using the Flowbiz Onsite SDK (Mailbiz marketing platform).

Unlike the other tracking modules, Flowbiz consumes a typed event catalog: each event has a fixed payload shape with required fields, so this module exposes one method per event instead of a single free-form logEvent. Sending an incomplete payload rejects with eitri.flowbiz.<method>.error.invalid.parameters rather than delivering a partial event — an array of line items is rejected whole if any element is malformed, so a cart is never reported with items missing. Numbers may be sent as numbers or as numeric strings.

Every event reaches this SDK through the methods here — it does not receive the generic tracking.logEvent fan-out, since the catalog's required monetary totals cannot be inferred from an arbitrary event. Page views included: call pageView.

The wider Flowbiz integration also covers user identification and push, which have no dedicated bridge surface: identity is driven by session.notifyLogin / session.notifyLogout, and the push token relay is wired natively. The SDK does not render notifications — pushes are displayed by the app itself, so enabling Flowbiz does not change how notifications appear.

Requirements: This feature must be enabled in the Eitri Shopping App native configuration by providing the flowbiz configuration (appId and baseUri) in the app configuration file.

User identity is not set here, but in session.notifyLogin and session.notifyLogout.

Methods

  • Synchronizes the known attributes of the logged-in user without emitting a login event. Use it to refresh profile data mid-session; the login itself is reported by session.notifyLogin.

    user.userId and user.email are both required by the SDK.

    Example:

    const modules = await Eitri.modules();
    const accountSync = modules?.flowbiz?.accountSync;
    if (!accountSync) return;

    await accountSync({
    user: {
    userId: "cust-12345",
    email: "[email protected]",
    phone: "11987654321",
    name: "Ana Silva",
    plan: "gold"
    }
    });

    Parameters

    Returns Promise<void>

  • Tracks products added to the cart. Each item requires productId, sku, quantity and price.

    Example:

    const modules = await Eitri.modules();
    const addToCart = modules?.flowbiz?.addToCart;
    if (!addToCart) return;

    await addToCart({
    products: [
    { productId: "p-001", sku: "sku-001", quantity: 2, price: 299.9, name: "Tênis Runner" }
    ]
    });

    Parameters

    Returns Promise<void>

  • Updates the quantity of a single cart line.

    Example:

    const modules = await Eitri.modules();
    const cartItemUpdate = modules?.flowbiz?.cartItemUpdate;
    if (!cartItemUpdate) return;

    await cartItemUpdate({ cartId: "cart-001", productId: "p-001", sku: "sku-001", quantity: 3 });

    Parameters

    • __namedParameters: { cartId: string; productId: string; quantity: number; sku: string }

    Returns Promise<void>

  • Records a coupon applied to the cart.

    Example:

    const modules = await Eitri.modules();
    const cartSetCoupon = modules?.flowbiz?.cartSetCoupon;
    if (!cartSetCoupon) return;

    await cartSetCoupon({ cartId: "cart-001", coupon: "PRIMEIRACOMPRA" });

    Parameters

    • __namedParameters: { cartId: string; coupon: string }

    Returns Promise<void>

  • Records the postal code applied to the cart (freight calculation).

    Example:

    const modules = await Eitri.modules();
    const cartSetPostalCode = modules?.flowbiz?.cartSetPostalCode;
    if (!cartSetPostalCode) return;

    await cartSetPostalCode({ cartId: "cart-001", postalCode: "20510-000" });

    Parameters

    • __namedParameters: { cartId: string; postalCode: string }

    Returns Promise<void>

  • Sends the full current state of the cart. An empty-items cart is valid and meaningful — it is how the platform learns the cart was emptied.

    All five monetary totals (subtotal, total, freight, tax, discounts) are required.

    Example:

    const modules = await Eitri.modules();
    const cartSync = modules?.flowbiz?.cartSync;
    if (!cartSync) return;

    await cartSync({
    cart: {
    cartId: "cart-001",
    subtotal: 299.9,
    total: 319.9,
    freight: 20,
    tax: 0,
    discounts: 0,
    currency: "BRL",
    items: [
    { productId: "p-001", sku: "sku-001", quantity: 1, price: 299.9 }
    ]
    }
    });

    // An empty cart is valid — it is how the platform learns the cart was emptied.
    await cartSync({ cart: { cartId: "cart-001", subtotal: 0, total: 0, freight: 0, tax: 0, discounts: 0, items: [] } });

    Parameters

    Returns Promise<void>

  • Tracks progress through the checkout funnel.

    Example:

    const modules = await Eitri.modules();
    const checkoutStep = modules?.flowbiz?.checkoutStep;
    if (!checkoutStep) return;

    await checkoutStep({
    checkout: { cartId: "cart-001", step: 2, totalSteps: 4, stepName: "pagamento" }
    });

    Parameters

    Returns Promise<void>

  • Requests an immediate delivery attempt of the queued events. Delivery is otherwise handled by the SDK's own heartbeat schedule, so calling this is only useful before a foreseeable interruption.

    Example:

    const modules = await Eitri.modules();
    const flush = modules?.flowbiz?.flush;
    if (!flush) return;

    await flush();

    Returns Promise<void>

  • Decodes a Flowbiz cart-recovery link and returns the cart it points to, or undefined when the URL carries no Flowbiz recovery payload.

    Use it when the app opens from a marketing link and should restore the abandoned cart.

    Example:

    const modules = await Eitri.modules();
    const handleRecoveryLink = modules?.flowbiz?.handleRecoveryLink;
    if (!handleRecoveryLink) return;

    const recovered = await handleRecoveryLink({ url: deeplinkUrl });
    if (recovered) {
    // restore recovered.products into the local cart
    }

    Parameters

    • __namedParameters: { url: string }

    Returns Promise<undefined | FlowbizRecoveryPayload>

  • Tracks a cancelled order. At least one of orderId / cartId should be provided.

    Example:

    const modules = await Eitri.modules();
    const orderCancel = modules?.flowbiz?.orderCancel;
    if (!orderCancel) return;

    await orderCancel({ orderId: "ORD-789", cartId: "cart-001" });

    Parameters

    • __namedParameters: { cartId?: string; orderId?: string }

    Returns Promise<void>

  • Tracks a completed order. Requires the same five monetary totals as cartSync.

    Example:

    const modules = await Eitri.modules();
    const orderComplete = modules?.flowbiz?.orderComplete;
    if (!orderComplete) return;

    await orderComplete({
    order: {
    cartId: "cart-001",
    orderId: "ORD-789",
    subtotal: 299.9,
    total: 319.9,
    freight: 20,
    tax: 0,
    discounts: 0,
    currency: "BRL",
    items: [{ productId: "p-001", sku: "sku-001", quantity: 1, price: 299.9 }],
    paymentMethods: [{ type: "credit_card", amount: 319.9 }],
    deliveryMethods: [{ type: "standard", amount: 20 }]
    }
    });

    Parameters

    Returns Promise<void>

  • Tracks a page/screen view.

    Example:

    const modules = await Eitri.modules();
    const pageView = modules?.flowbiz?.pageView;
    if (!pageView) return;

    await pageView({ path: "/carrinho", title: "Carrinho" });

    Parameters

    • __namedParameters: { path?: string; title?: string }

    Returns Promise<void>

  • Tracks a product view. The product must carry at least one variant, and each variant requires sku and price.

    Example:

    const modules = await Eitri.modules();
    const productView = modules?.flowbiz?.productView;
    if (!productView) return;

    await productView({
    product: {
    productId: "p-001",
    category: "calcados",
    variants: [{ sku: "sku-001", price: 299.9 }]
    }
    });

    Parameters

    Returns Promise<void>

  • Enables or disables collection at runtime. While disabled the SDK drops events instead of queueing them, so use it to honour a consent decision taken inside the app.

    Example:

    const modules = await Eitri.modules();
    const setEnabled = modules?.flowbiz?.setEnabled;
    if (!setEnabled) return;

    // Honour a consent decision taken inside the app.
    await setEnabled({ enabled: false });

    Parameters

    • __namedParameters: { enabled: boolean }

    Returns Promise<void>