# SDK configuration and API reference

> Current Froomle documentation · [View canonical page](https://docs.froomle.com/froomle-doc-main/v2/js_lib/sdk-reference.html)

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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/configuration.html).

<a id="_setter_reference_and_defaults"></a>

## 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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/configuration.html#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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/benchmarking.html#BenchmarkConfig). |
| `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. |

<a id="InputLocations"></a>

## Supported Inputs by Location

| Location | Runtime scope | Inputs | What This Is For |
| --- | --- | --- | --- |
| SDK script tag attributes | Script-tag/global bootstrap only | -   `data-froomle-env`<br>-   `data-froomle-page-visit`<br>-   `data-froomle-context-item`<br>-   `data-froomle-context-item-type`<br>-   `data-froomle-request-domain`<br>-   `data-froomle-safe-request`<br>-   `data-froomle-channel`<br>-   `data-froomle-device-id`<br>-   `data-froomle-user-id`<br>-   `data-froomle-consent`<br>-   `data-froomle-site-context`<br>-   `data-froomle-subscription-level`<br>-   `data-froomle-utm-tracking="false"`<br>-   `data-froomle-referrer-tracking="false"`<br>-   `data-froomle-benchmark` (optional explicit declaration)<br>-   `data-froomle-benchmark-allowed-groups`<br>-   `data-froomle-benchmark-show-froomle-for`<br>-   `data-froomle-benchmark-current-group`<br>-   `data-froomle-benchmark-control-id-selector`<br>-   `data-froomle-benchmark-control-id-attribute`<br>-   `data-froomle-benchmark-control-item-type`<br>-   `data-froomle-benchmark-control-item-type-attribute`<br>-   `data-froomle-auto-exclude`<br>-   `data-froomle-auto-exclude-selector`<br>-   `data-froomle-auto-exclude-id-attribute`<br>-   `data-froomle-auto-exclude-id-regex`<br>-   `data-froomle-auto-exclude-item-type`<br>-   `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:<br>-   `setConsent`<br>-   `trackCurrentPage`<br>-   `setEnvironment`<br>-   `setPageVisit`<br>-   `setRequestDomain`<br>-   `setSafeRequest`<br>-   `setChannel`<br>-   `setSiteContext`<br>-   `setSubscriptionLevel`<br>-   `setUtmTrackingEnabled`<br>-   `setReferrerTrackingEnabled`<br>-   `setRecommendationsBearer`<br>-   `setRecommendationsBearerProvider`<br>-   `setContextItem`<br>-   `setContextItemType`<br>-   `setCustomVariable`<br>-   `configureBenchmark`<br>-   `setCurrentGroup`<br>-   `addHistories`<br>-   `addExclusions`<br>-   `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`<br>-   `data-froomle-reco-filter-<field>`<br>-   `data-froomle-variable-<key>`<br>-   `data-froomle-param-<target>`<br>-   `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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/declarative-html.html#recommendation-feeds). |
| Original card identity | Declarative recommendation placements and Smart Sort candidates | -   `data-froomle-id`<br>-   `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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/benchmarking.html#BenchmarkDeclarative). |
| Declarative smart sorting | DOM integration only: script-tag auto-init or module `init()` | -   `data-froomle-smart-sort`<br>-   `data-froomle-smart-sort-item`<br>-   `data-froomle-id`<br>-   `data-froomle-item-type`<br>-   `data-froomle-rank`<br>-   `data-froomle-limit`<br>-   `data-froomle-list-size`<br>-   `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`)<br>-   `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`<br>-   `setPageVisit`<br>-   `setConsent`<br>-   `trackCurrentPage`<br>-   `setRequestDomain`<br>-   `setSafeRequest`<br>-   `setChannel`<br>-   `setDeviceId`<br>-   `setUserId`<br>-   `setSiteContext`<br>-   `setSubscriptionLevel`<br>-   `setUtmTrackingEnabled`<br>-   `setReferrerTrackingEnabled`<br>-   `setRecommendationsBearer`<br>-   `clearRecommendationsBearer`<br>-   `setRecommendationsBearerProvider`<br>-   `clearRecommendationsBearerProvider`<br>-   `setContextItem`<br>-   `setContextItemType`<br>-   `setCustomVariable`<br>-   `configureBenchmark`<br>-   `setCurrentGroup`<br>-   `addHistories`<br>-   `addExclusions`<br>-   `clearExclusions`<br>-   `setAutoExclusions`<br>-   `getAutoExclusions`<br>-   `clearAutoExclusions`<br>-   `init`<br>-   `getRecommendations`<br>-   `getListSlice`<br>-   `smartSort`<br>-   `proxyReco`<br>-   `fulfillRecommendations`<br>-   `trackEmailCampaignRecommendationClick`<br>-   `trackEmailCampaignRecommendationClickFromUrl`<br>-   `sendItemInteraction`<br>-   `sendUserInteraction`<br>-   `sendAddToCart`<br>-   `sendRemoveFromCart`<br>-   `sendPurchase`<br>-   `sendStartSubscription`<br>-   `sendCancelSubscription`<br>-   `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`<br>-   sizing: `limit`, `list_size`<br>-   filters as maps or tuples<br>-   custom list fields; shared custom variables via `setCustomVariable(…​)`<br>-   `list_content` for raw candidate mapping / smart sorting<br>-   `showFroomleContentFor` as a list policy override<br>-   `exclusions`<br>-   `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?)`<br>-   `sendItemInteraction(…​)`<br>-   `sendUserInteraction(…​)`<br>-   `sendAddToCart(…​)`<br>-   `sendRemoveFromCart(…​)`<br>-   `sendPurchase(…​)`<br>-   `sendStartSubscription(…​)`<br>-   `sendCancelSubscription(…​)`<br>-   `options.source` for source-based recommendation metadata inference<br>-   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`<br>-   URL fields: `froomle_email_campaign_id`, `froomle_email_list_name`, `froomle_email_request_id`, and optional item/channel overrides<br>-   `trackEmailCampaignRecommendationClick(payload, options?)`<br>-   `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`<br>-   `useRecoList`<br>-   `useRecoEntry`<br>-   `useSmartSort`<br>-   hook inputs: `list`, `filters`, `limit`, `list_size`, pass-through request fields<br>-   hook request options: `showFroomleContentFor`, `customerItem` (entry), `customerItems` (list), `mapRecommendationItem`, `exclusions`, `excludeItems`, `autoExclusions`<br>-   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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/react.html#ReactBindings). |
| React recommendation rendering | React only | -   `FroomleReco`<br>-   `useReco`<br>-   `FroomleReco reco={…​}`<br>-   `FroomleReco entry={…​}`<br>-   `asChild`<br>-   `FroomleOrder`<br>-   `FroomleOrderItem`<br>-   `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. |

<a id="_programmatic_method_quick_reference"></a>

## 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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/sdk-events.html#track-current-page). |
| `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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/programmatic-pagination.html). |
| `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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/programmatic-pagination.html). |
| `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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/programmatic-pagination.html). |
| `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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/programmatic.html#programmatic-slots). |
| `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. |

<a id="_typescript_types_and_interfaces"></a>

## 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:

```ts
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:

```ts
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:

```ts
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](https://docs.froomle.com/froomle-doc-main/v2/js_lib/react.html#ReactBindings) for query options and examples.

> **NOTE:**
> 
> `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
>
