SDK configuration and API reference

View Markdown

Look up SDK settings, their defaults, and the script-tag attributes or setters you can use. For the setup sequence, see SDK setup and configuration.

Setter Reference and Defaults

Setting Default Script-tag attribute Typical use

setEnvironment(env)

null

data-froomle-env

Always set to your environment.

setPageVisit(pageType)

null

data-froomle-page-visit

Always set for recommendation requests.

setConsent(level)

0 unless a higher-priority startup source applies

data-froomle-consent (startup fallback)

Forward the current CMP choice and changes. See Consent for the startup precedence and accepted values.

setDeviceId(id)

SDK-managed device ID

data-froomle-device-id

Optional override when your application owns device identity and its lifecycle.

setUserId(idOrNull)

null

data-froomle-user-id

Supply the current account ID; call setUserId(null) on logout. The SDK sends it only at level 2.

setRequestDomain(host)

europe-west1.froomle.com

data-froomle-request-domain

Override domain (custom API domain/proxy/local setup).

setRecommendationsBearer(token)

(none)

(none)

Add Authorization: Bearer …​ to recommendation requests only. Use when your backend already injected a short-lived token.

clearRecommendationsBearer()

(none)

(none)

Clear the cached recommendation bearer token, for example on logout or tenant switch.

setRecommendationsBearerProvider(provider)

(none)

(none)

Async provider for recommendation requests only. The SDK waits for it before the first request and retries once after a 401 with forceRefresh: true.

clearRecommendationsBearerProvider()

(none)

(none)

Remove the active recommendation token provider, for example on logout or tenant switch.

setChannel(channel)

www-desktop

data-froomle-channel

Force channel or set responsive channel in runtime code.

setSiteContext(siteContext)

window.location.hostname in browser integrations when available; otherwise null

data-froomle-site-context

Override the effective analytics context, for example example.com or specific.example.com. Pass an empty string (setSiteContext("")) before events are sent to disable the field. The SDK adds the effective non-empty value as site_context on event payloads.

setSubscriptionLevel(subscriptionLevel)

null

data-froomle-subscription-level

Set the current visitor entitlement for analytics. Accepted values are NONE, REGISTERED, TRIAL, and SUBSCRIPTION; the SDK adds it as subscription_level on event payloads.

setUtmTrackingEnabled(enabled)

true

data-froomle-utm-tracking="false"

Enable or disable URL UTM enrichment for browser event payloads. The SDK reads standard UTM parameters from the current URL at event-send time and never adds them to recommendation requests.

setReferrerTrackingEnabled(enabled)

true

data-froomle-referrer-tracking="false"

Enable or disable browser referrer enrichment for event payloads. The SDK reads window.location.href with the URL fragment removed and document.referrer, sends page_url, referrer_url, referrer_type, referrer_origin, and referrer_domain, and never adds them to recommendation requests. referrer_url is only as complete as the browser exposes through document.referrer.

setSafeRequest(bool)

true

data-froomle-safe-request

Set to false for non-HTTPS local/dev domains.

setContextItem(itemId)

null

data-froomle-context-item

Detail pages.

setContextItemType(type)

article

data-froomle-context-item-type

Detail pages with non-default type.

setCustomVariable(key, value)

(none)

(none)

Request-root variables and custom business data.

configureBenchmark(config?)

Groups: customer, froomle; show recommendations for froomle

data-froomle-benchmark-allowed-groups, data-froomle-benchmark-show-froomle-for, data-froomle-benchmark-current-group

Set the benchmark defaults before SDK initialization. See Benchmark configuration.

setCurrentGroup(group)

Unset (Froomle assigns the group)

data-froomle-benchmark-current-group

Register an external group’s string or promise before SDK initialization. Do not set per placement.

setBenchmarkControlIdentity(config | false)

disabled

data-froomle-benchmark-control-id-…​

Opt into declarative DOM control identity resolution from existing CMS markup. This affects only resolved control branches and never changes benchmark assignment.

getBenchmarkControlIdentity()

disabled

(none)

Read a defensive copy of the current DOM control identity selector configuration.

clearBenchmarkControlIdentity()

disabled

(none)

Remove the current DOM control identity selector configuration.

addHistories(histories, defaultItemType?)

empty

(none)

Add history IDs or typed history entries ({ id, item_type } or { id, itemType }).

addExclusions(exclusions, defaultItemType?)

empty

(none)

Persistently exclude item IDs from later recommendation responses by sending histories.exclude.

clearExclusions()

empty

(none)

Clear persistent SDK-managed exclusions.

setAutoExclusions(config | false)

disabled

data-froomle-auto-exclude="page"

Enable or configure per-request page item exclusion collection.

getAutoExclusions()

disabled

(none)

Read the current auto-exclusion config.

clearAutoExclusions()

disabled

(none)

Disable and clear the current auto-exclusion config.

Supported Inputs by Location

Location Runtime scope Inputs What This Is For

SDK script tag attributes

Script-tag/global bootstrap only

  • data-froomle-env

  • data-froomle-page-visit

  • data-froomle-context-item

  • data-froomle-context-item-type

  • data-froomle-request-domain

  • data-froomle-safe-request

  • data-froomle-channel

  • data-froomle-device-id

  • data-froomle-user-id

  • data-froomle-consent

  • data-froomle-site-context

  • data-froomle-subscription-level

  • data-froomle-utm-tracking="false"

  • data-froomle-referrer-tracking="false"

  • data-froomle-benchmark (optional explicit declaration)

  • data-froomle-benchmark-allowed-groups

  • data-froomle-benchmark-show-froomle-for

  • data-froomle-benchmark-current-group

  • data-froomle-benchmark-control-id-selector

  • data-froomle-benchmark-control-id-attribute

  • data-froomle-benchmark-control-item-type

  • data-froomle-benchmark-control-item-type-attribute

  • data-froomle-auto-exclude

  • data-froomle-auto-exclude-selector

  • data-froomle-auto-exclude-id-attribute

  • data-froomle-auto-exclude-id-regex

  • data-froomle-auto-exclude-item-type

  • data-froomle-auto-exclude-include-placement

Bootstraps SDK from HTML without imports. Only this whitelist is read from the SDK script tag as bootstrap input. The consent attribute is a startup fallback. An explicit consent setter or a valid saved choice takes priority; use the setter to forward later CMP changes. Recommendation auth is configured via JS setters, not script-tag attributes.

froomle:before-init hook

Script-tag/global before first automatic request

event.detail.sdk exposes the same public setters as the global SDK, including:

  • setConsent

  • trackCurrentPage

  • setEnvironment

  • setPageVisit

  • setRequestDomain

  • setSafeRequest

  • setChannel

  • setSiteContext

  • setSubscriptionLevel

  • setUtmTrackingEnabled

  • setReferrerTrackingEnabled

  • setRecommendationsBearer

  • setRecommendationsBearerProvider

  • setContextItem

  • setContextItemType

  • setCustomVariable

  • configureBenchmark

  • setCurrentGroup

  • addHistories

  • addExclusions

  • setAutoExclusions

Use this when a script-tag integration must set dynamic values before the first automatic DOM recommendation request or page event. This is the correct place for runtime consent, auth tokens, dynamic channel, histories, or custom variables that must affect first request.

Declarative recommendation placeholders

DOM integration only: script-tag auto-init or module init()

  • data-froomle-reco

  • data-froomle-reco-filter-<field>

  • data-froomle-variable-<key>

  • data-froomle-param-<target>

  • data-froomle-reco-show-froomle-for (optional list policy; also supported on a wrapper)

Declarative recommendation rendering in the DOM. Use this to map item fields into existing HTML placeholders. Regular recommendation placeholders are slot-based: request limit / list_size is derived from the number of compatible placeholders, not from per-placeholder sizing attributes. Module/import integrations must call init() explicitly before this markup is processed. React does not use this DOM filler path for React-owned recommendation components.

Recommendation feed container

Declarative DOM mode

data-froomle-reco-feed

Group dynamically inserted slots by their closest marked container. Later feed requests exclude filled cards still in that feed. Keep each slot’s list name and filters on the slot. See Load More and Infinite Scroll.

Original card identity

Declarative recommendation placements and Smart Sort candidates

  • data-froomle-id

  • data-froomle-item-type

Identifies the original item so the SDK can attribute events if it registers that card. Item identity and copied request metadata do not register finished cards. See original-card identity.

Declarative smart sorting

DOM integration only: script-tag auto-init or module init()

  • data-froomle-smart-sort

  • data-froomle-smart-sort-item

  • data-froomle-id

  • data-froomle-item-type

  • data-froomle-rank

  • data-froomle-limit

  • data-froomle-list-size

  • data-froomle-reco-show-froomle-for (optional list policy)

Sends existing DOM candidates as list_content, reranks them, and stamps matched recommendation metadata for tracking.

Declarative ordering

DOM integration only

  • data-froomle-order-<field> (for example, data-froomle-order-categories)

  • data-froomle-ordervalue

Reorders existing blocks according to the returned order/categories.

JS/TS module API

Module/import, programmatic browser integrations, and script-tag global object

  • setEnvironment

  • setPageVisit

  • setConsent

  • trackCurrentPage

  • setRequestDomain

  • setSafeRequest

  • setChannel

  • setDeviceId

  • setUserId

  • setSiteContext

  • setSubscriptionLevel

  • setUtmTrackingEnabled

  • setReferrerTrackingEnabled

  • setRecommendationsBearer

  • clearRecommendationsBearer

  • setRecommendationsBearerProvider

  • clearRecommendationsBearerProvider

  • setContextItem

  • setContextItemType

  • setCustomVariable

  • configureBenchmark

  • setCurrentGroup

  • addHistories

  • addExclusions

  • clearExclusions

  • setAutoExclusions

  • getAutoExclusions

  • clearAutoExclusions

  • init

  • getRecommendations

  • getListSlice

  • smartSort

  • proxyReco

  • fulfillRecommendations

  • trackEmailCampaignRecommendationClick

  • trackEmailCampaignRecommendationClickFromUrl

  • sendItemInteraction

  • sendUserInteraction

  • sendAddToCart

  • sendRemoveFromCart

  • sendPurchase

  • sendStartSubscription

  • sendCancelSubscription

  • sendEvent

Code-first integration. Use this for explicit runtime control, programmatic fetching, and manual event flows. If you also render declarative data-froomle-…​ placeholders from a module/import setup, call init() explicitly to start DOM placeholder mode.

Programmatic recommendation request options

getRecommendations(…​), smartSort(…​), and proxyReco(…​)

  • list identity: list_name / list

  • sizing: limit, list_size

  • filters as maps or tuples

  • custom list fields; shared custom variables via setCustomVariable(…​)

  • list_content for raw candidate mapping / smart sorting

  • showFroomleContentFor as a list policy override

  • exclusions

  • autoExclusions

Request-local inputs for code-owned recommendation fetching. Use getRecommendations(…​) when one call owns one or more full lists. Use proxyReco(…​) / fulfillRecommendations() when each rendered slot should be represented separately while compatible slots are batched underneath. Use smartSort(…​) when you provide the candidate set and want Froomle to rank/map it.

Programmatic events

Manual JS/TS or script-tag global calls

  • sendEvent(actionItem, actionItemType, eventType?, extras?, options?)

  • sendItemInteraction(…​)

  • sendUserInteraction(…​)

  • sendAddToCart(…​)

  • sendRemoveFromCart(…​)

  • sendPurchase(…​)

  • sendStartSubscription(…​)

  • sendCancelSubscription(…​)

  • options.source for source-based recommendation metadata inference

  • event extras such as site_context, subscription_level, UTM/referrer overrides, basket_content, amount, purchased_price, context_item, and context_item_type

Manual tracking when the SDK does not own rendering, or when the business event is not covered by automatic page/recommendation tracking. Prefer dedicated helpers for retail and subscription lifecycle events. Use sendEvent(…​) for custom or low-level flows.

Email campaign attribution URL/API

Browser integrations

  • URL payload: froomle_email_reco

  • URL fields: froomle_email_campaign_id, froomle_email_list_name, froomle_email_request_id, and optional item/channel overrides

  • trackEmailCampaignRecommendationClick(payload, options?)

  • trackEmailCampaignRecommendationClickFromUrl(url?, options?)

Sends email recommendation click attribution without bypassing SDK consent. Script-tag and React integrations process supported landing-page URL payloads automatically; SPA/router integrations can call the helpers explicitly.

React provider

React only

  • FroomleSdkInit

Initializes the React integration, enables page-level events, email campaign URL processing, and SDK runtime ownership for React-rendered recommendation components.

React recommendation hooks

React only

  • useCreateReco

  • useRecoList

  • useRecoEntry

  • useSmartSort

  • hook inputs: list, filters, limit, list_size, pass-through request fields

  • hook request options: showFroomleContentFor, customerItem (entry), customerItems (list), mapRecommendationItem, exclusions, excludeItems, autoExclusions

  • smart-sort candidate adapters: candidates, getId, getItemType, getRank

React-owned recommendation requests. Use useCreateReco(…​) for one returned recommendation, useRecoList(…​) for a list, useRecoEntry(…​) for one slot that can also show an original card, and useSmartSort(…​) for reranking. See React Bindings.

React recommendation rendering

React only

  • FroomleReco

  • useReco

  • FroomleReco reco={…​}

  • FroomleReco entry={…​}

  • asChild

  • FroomleOrder

  • FroomleOrderItem

  • FroomleCustomItem

React rendering and tracking bindings. Render resolved items/entries through FroomleReco to keep automatic impression and click_on_recommendation attribution. Use FroomleCustomItem only when custom React content should intentionally contribute explicit behavioral history.

Programmatic Method Quick Reference

Method Purpose

init()

Explicitly start declarative DOM placeholder mode for module/import integrations. Script-tag/global integrations still auto-init by default.

trackCurrentPage()

Explicitly track the current page without filling or reprocessing recommendations. Shares deduplication with automatic DOM/React page tracking for the active URL, context, and consent period. See Explicit current-page tracking.

getRecommendations(lists, options?)

Fetch recommendation lists directly in code. Set showFroomleContentFor on a list entry to override its content policy. options can carry request-local exclusions and autoExclusions. Each pageable list has pagination.getPage(pageNumber). See Programmatic Pagination.

getListSlice({ listKey, offset, limit })

Look up a rank range by list key, including a saved key after a reload. The offset is the first item’s 1-based rank, not a page number. Returns Recommendations without resolving a list experience or attaching a page helper. See Programmatic Pagination.

smartSort(request, options?)

Rerank caller-provided candidate items by sending them as list_content. With limit and pagination: true, the result has pagination.getPage(pageNumber) and keeps the mapped candidate objects. See Programmatic Pagination.

proxyReco(request)

Queue one slot. Its handle resolves to a recommendation item or null for customer content, or rejects if the slot cannot be filled. See Programmatic slot requests.

fulfillRecommendations()

Send queued proxy requests, batching compatible slots. A successful flush does not guarantee every handle has an item.

sendEvent(actionItem, actionItemType, eventType?, extras?, options?)

Low-level fallback for explicit custom/manual tracking events.

trackEmailCampaignRecommendationClick(payload, options?)

Queue or send email recommendation click attribution from an explicit payload.

trackEmailCampaignRecommendationClickFromUrl(url?, options?)

Parse supported email recommendation attribution parameters from a URL and queue/send the click attribution.

setUtmTrackingEnabled(enabled)

Enable or disable URL UTM enrichment for browser event payloads.

setReferrerTrackingEnabled(enabled)

Enable or disable browser referrer enrichment for event payloads.

configureBenchmark(config?)

Configure allowed groups, the default list policy, and optionally an external assignment before initialization.

setCurrentGroup(group)

Register the group or promise from your experimentation system before initialization. Leave it unset when Froomle owns assignment.

setBenchmarkControlIdentity(config | false)

Configure one or more selector sources that can supply missing identity for existing declarative DOM control content.

getBenchmarkControlIdentity()

Read a defensive copy of the current DOM control identity configuration.

clearBenchmarkControlIdentity()

Remove the DOM control identity configuration.

addHistories(histories, defaultItemType?)

Add explicit behavioral pageview history entries to later recommendation requests. String entries default to article; object entries may use item_type or itemType.

addExclusions(exclusions, defaultItemType?)

Persistently add item IDs to request-local histories.exclude entries. String entries default to article; object entries may use item_type or itemType. These exclusions may be sent on anonymous recommendation requests; they do not add pageview history.

clearExclusions()

Clear persistent exclusions added through addExclusions(…​).

setAutoExclusions(config | false)

Enable or configure opt-in automatic exclusion collection from page markup such as data-froomle-id.

getAutoExclusions()

Read the current auto-exclusion config.

clearAutoExclusions()

Disable and clear auto-exclusion collection.

sendItemInteraction(actionItem, actionItemType, interactionType, extras?) sendItemInteraction(interactionType, extras?)

Send item_interaction for flows such as wishlists, likes, or favorites. The one-argument form reuses the current context_item / context_item_type.

sendUserInteraction(interactionType, extras?)

Send user_interaction for non-item flows such as review submits or chat starts.

sendAddToCart(actionItem, actionItemType, amount, extras?) sendAddToCart(amount, extras?)

Send add_to_cart with required amount and optional basket_content. The short form reuses the current context_item / context_item_type.

sendRemoveFromCart(actionItem, actionItemType, amount, extras?) sendRemoveFromCart(amount, extras?)

Send remove_from_cart with required amount and optional basket_content. The short form reuses the current context_item / context_item_type.

sendPurchase(actionItem, actionItemType, amount, purchasedPrice, extras?) sendPurchase(amount, purchasedPrice, extras?)

Send purchase with required amount and purchased_price. The short form reuses the current context_item / context_item_type.

sendStartSubscription(subscriptionType, extras?)

Send start_subscription after a subscription has been confirmed. The helper requires subscriptionType, reuses configured context when available, and also works without item context.

sendCancelSubscription(subscriptionType, extras?)

Send cancel_subscription after a cancellation has been confirmed. The helper requires subscriptionType, reuses configured context when available, and also works without item context.

setRecommendationsBearer(token)

Configure a static recommendation bearer token.

setRecommendationsBearerProvider(provider)

Configure an async recommendation token provider.

clearRecommendationsBearer()

Clear the cached recommendation bearer token.

clearRecommendationsBearerProvider()

Clear the configured recommendation token provider.

TypeScript Types and Interfaces

The SDK publishes declaration files via package exports:

  • @froomle/frontend-sdk → dist/index.d.ts

  • @froomle/frontend-sdk/react → dist/react.d.ts

Typical TS imports:

import {
  addExclusions,
  addHistories,
  configureBenchmark,
  clearAutoExclusions,
  clearExclusions,
  clearRecommendationsBearer,
  clearRecommendationsBearerProvider,
  fulfillRecommendations,
  getAutoExclusions,
  getListSlice,
  getRecommendations,
  init,
  proxyReco,
  sendAddToCart,
  sendCancelSubscription,
  sendEvent,
  sendItemInteraction,
  sendPurchase,
  sendRemoveFromCart,
  sendStartSubscription,
  sendUserInteraction,
  setAutoExclusions,
  setCurrentGroup,
  setChannel,
  setConsent,
  setContextItem,
  setContextItemType,
  setCustomVariable,
  setDeviceId,
  setEnvironment,
  setPageVisit,
  setRecommendationsBearer,
  setRecommendationsBearerProvider,
  setReferrerTrackingEnabled,
  setRequestDomain,
  setSafeRequest,
  setSiteContext,
  setSubscriptionLevel,
  setUtmTrackingEnabled,
  smartSort,
  trackEmailCampaignRecommendationClick,
  trackEmailCampaignRecommendationClickFromUrl
} from '@froomle/frontend-sdk'
import type {
  BenchmarkConfigInput,
  ListSliceRequest,
  PaginatedSmartSortRequest,
  PaginatedSmartSortResult,
  RecommendationItem,
  RecommendationList,
  RecommendationListPagination,
  RecommendationRequestOptions,
  Recommendations,
  RecoFilter,
  RecoFilterMap,
  RecoFilterScalar,
  RecoFilterValue,
  RecoFilters,
  RecoListRequest,
  SmartSortEntry,
  SmartSortRequest,
  SmartSortResult,
  SubscriptionEventExtras
} from '@froomle/frontend-sdk'

import {
  FroomleReco,
  FroomleSdkInit,
  useCreateReco,
  useRecoEntry,
  useRecoList,
  useSmartSort
} from '@froomle/frontend-sdk/react'
import type {
  ExcludeItemsConfig,
  FroomleRecoEntry,
  RecoFilters as ReactRecoFilters,
  RecoList,
  RecoListResponse,
  UseRecoListResult,
  UseSmartSortResult
} from '@froomle/frontend-sdk/react'

The root package exports RecommendationItem and root helper types such as RecoFilter*, SmartSort*, and SubscriptionEventExtras. The React subpath exports the React components, hooks, and React-specific helper types.

The root package exports Recommendations, RecommendationList, and RecommendationListPagination as TypeScript types, but does not expose generated constructors for them. You can also infer the response type from getRecommendations(…​).

Use the exported request types such as RecoListRequest, RecommendationRequestOptions, and ProxyRecoRequest when you need to type a request separately. The following are selected input shapes:

type RecoFilterScalar = string | number | boolean

type RecoFilterValue = RecoFilterScalar | readonly RecoFilterScalar[]

type RecoFilter = { key: string; value: RecoFilterValue }

type RecoFilterMap = Record<string, RecoFilterValue>

type RecoFilters = readonly RecoFilter[] | RecoFilterMap

type RecoRequestShape = {
  list: string
  filters?: RecoFilters
  others?: Array<{ key: string; value: unknown }>
  exclusions?: ExclusionInput[]
  autoExclusions?: AutoExclusionsConfig | boolean
}

type ExclusionInput =
  | string
  | { id: string; item_type?: string; itemType?: string }

type ExcludeItemsConfig<TItem> = {
  items: readonly TItem[]
  getId: (item: TItem, index: number) => string | null | undefined
  getItemType?: (item: TItem, index: number) => string | null | undefined
  itemType?: string
}

type AutoExclusionsConfig = {
  enabled?: boolean
  scope?: 'page'
  includePlacement?: boolean
  selector?: string
  idAttribute?: string
  idRegex?: string
  idRegexGroup?: number | string
  itemType?: string
  itemTypeAttribute?: string
  visibleOnly?: boolean
  sources?: Array<{
    selector: string
    idAttribute?: string
    idRegex?: string
    idRegexGroup?: number | string
    itemType?: string
    itemTypeAttribute?: string
    visibleOnly?: boolean
  }>
}

type HistoryInputShape =
  | string
  | { id: string; item_type?: string | null; itemType?: string | null }

type SendEventExtrasShape = {
  [key: string]: string | number | object
}

type BasketContentItemShape = {
  id: string
  [key: string]: string | number | object | undefined
}

Selected signatures from the published declarations:

import type {
  BenchmarkConfigInput,
  BenchmarkControlIdentityConfig,
  BenchmarkExperience,
  EmailCampaignAttributionOptions,
  EmailCampaignAttributionPayload,
  ListSliceRequest,
  NormalizedBenchmarkControlIdentityConfig,
  PaginatedSmartSortRequest,
  PaginatedSmartSortResult,
  ProxyRecoRequest,
  RecommendationHandle,
  RecommendationItem,
  RecommendationRequestOptions,
  RecoListRequest,
  SmartSortRequest,
  SmartSortResult,
  SubscriptionEventExtras
} from '@froomle/frontend-sdk'

declare function setConsent(consent: number | "0" | "1" | "2"): void
declare function trackCurrentPage(): Promise<
  "sent" | "already-tracked" | "consent-required" | "missing-page-type"
>
declare function setUserId(userId: string | null): void
declare function setDeviceId(deviceId: string): void
declare function configureBenchmark(config?: BenchmarkConfigInput): void
declare function setCurrentGroup(group: string | PromiseLike<string>): void
declare function setBenchmarkControlIdentity(config: BenchmarkControlIdentityConfig): void
declare function getBenchmarkControlIdentity(): NormalizedBenchmarkControlIdentityConfig | false | null
declare function clearBenchmarkControlIdentity(): void
declare function init(): Promise<unknown>
declare function setRecommendationsBearer(token?: string | null): void
declare function setRecommendationsBearerProvider(
  provider: (options: { forceRefresh: boolean }) => string | Promise<string>
): void
declare function setCustomVariable(key: string, value: unknown): void

interface RecommendationListPagination<List extends RecommendationList = RecommendationList> {
  pageNumber: number
  pageSize: number
  offset: number
  listKey: string
  getPage(pageNumber: number): Promise<List>
}
interface RecommendationList {
  experience?: BenchmarkExperience
  limit: number
  list_key: string | null
  list_name: string
  list_size: number
  request_id?: string
  offset?: number | null
  items: RecommendationItem[]
  pagination?: RecommendationListPagination | null
}
interface Recommendations<List extends RecommendationList = RecommendationList> {
  request_id: string
  user_group: string
  user_id: string
  device_id: string
  lists(): List[]
  items(): RecommendationItem[]
}

// Inferred from getRecommendations(); not a separate public type export.
interface ResolvedRecommendationList extends RecommendationList {
  experience: BenchmarkExperience
  pagination?: RecommendationListPagination<ResolvedRecommendationList> | null
}

declare function getRecommendations(lists: RecoListRequest[], options?: RecommendationRequestOptions): Promise<Recommendations<ResolvedRecommendationList>>

declare function getListSlice(request: ListSliceRequest): Promise<Recommendations>

declare function proxyReco(request: ProxyRecoRequest): RecommendationHandle

declare function fulfillRecommendations(): Promise<void>

declare function smartSort<TCandidate>(request: PaginatedSmartSortRequest<TCandidate>, options?: RecommendationRequestOptions): Promise<PaginatedSmartSortResult<TCandidate>>
declare function smartSort<TCandidate>(request: SmartSortRequest<TCandidate>, options?: RecommendationRequestOptions): Promise<SmartSortResult<TCandidate>>

declare function sendEvent(
  actionItem: string | null | undefined,
  actionItemType: string | null | undefined,
  eventType?: string,
  extras?: { [key: string]: string | number | object | undefined },
  options?: { source?: Element | null }
): void

declare function trackEmailCampaignRecommendationClick(
  payload: EmailCampaignAttributionPayload,
  options?: EmailCampaignAttributionOptions
): void
declare function trackEmailCampaignRecommendationClickFromUrl(
  url?: string,
  options?: EmailCampaignAttributionOptions
): void

declare function sendItemInteraction(
  actionItem: string,
  actionItemType: string,
  interactionType: string,
  extras?: { [key: string]: string | number | object | undefined }
): void
declare function sendItemInteraction(
  interactionType: string,
  extras?: { [key: string]: string | number | object | undefined }
): void

declare function sendUserInteraction(
  interactionType: string,
  extras?: { [key: string]: string | number | object | undefined }
): void

type BasketContentItemShape = {
  id: string
  [key: string]: string | number | object | undefined
}

declare function sendAddToCart(
  actionItem: string,
  actionItemType: string,
  amount: number,
  extras?: {
    basket_content?: BasketContentItemShape[]
    [key: string]: string | number | object | undefined
  }
): void
declare function sendAddToCart(
  amount: number,
  extras?: {
    basket_content?: BasketContentItemShape[]
    [key: string]: string | number | object | undefined
  }
): void

declare function sendRemoveFromCart(
  actionItem: string,
  actionItemType: string,
  amount: number,
  extras?: {
    basket_content?: BasketContentItemShape[]
    [key: string]: string | number | object | undefined
  }
): void
declare function sendRemoveFromCart(
  amount: number,
  extras?: {
    basket_content?: BasketContentItemShape[]
    [key: string]: string | number | object | undefined
  }
): void

declare function sendPurchase(
  actionItem: string,
  actionItemType: string,
  amount: number,
  purchasedPrice: number,
  extras?: {
    original_price?: number
    [key: string]: string | number | object | undefined
  }
): void
declare function sendPurchase(
  amount: number,
  purchasedPrice: number,
  extras?: {
    original_price?: number
    [key: string]: string | number | object | undefined
  }
): void

declare function sendStartSubscription(
  subscriptionType: string,
  extras?: SubscriptionEventExtras
): void

declare function sendCancelSubscription(
  subscriptionType: string,
  extras?: SubscriptionEventExtras
): void

For React, import the hooks and types such as RecoQuery, RecommendationHandle, FroomleRecoEntry, UseRecoListResult, and UseSmartSortResult from @froomle/frontend-sdk/react. Let TypeScript infer the hook result to retain the types of your original and mapped items. See React Bindings for query options and examples.

unknown is intentional for pass-through/custom payload values (for example setCustomVariable values and extra list keys in getRecommendations list entries). This keeps SDK typings strict without guessing backend-specific business fields.

Behavior note:

  • filter maps are the recommended JS/TS/React form for hand-written code

  • tuple filters are also stable and not deprecated

  • repeated tuple filter keys merge into arrays

  • repeated setCustomVariable(…​) calls keep the last value

  • pass arrays explicitly for multi-value custom variables