1. JS SDK Reference

Data objects

This topic lists the various object definitions included in Sitecore Discover JavaScript SDK for React.

Context

This object describes the widget, page, user, and many other attributes.

Extract the context object from the SDK, with the following method:

import { PageController } from '@sitecore-discover/react';

const context = PageController.getContext();

ProductEventModel

This object describes a product.

PropertyTypeDescription
skustringRequired.

The stock keeping unit (SKU) of the product.
quantitynumberOptional.

Number of units of the product.
pricenumberOptional.

Price used to calculate the order.
priceOriginalnumberOptional.

The originally posted price of the product.

UserEventModel

This object describes a user.

PropertyTypeDescription
emailstringRequired.

The email address of the user.
idstringRequired.

ID of the user.
emailIdstringOptional.

ID for the email address of the user.

CheckoutEventModel

This object describes the checkout event.

PropertyTypeDescription
orderIdstringRequired.

ID of the order.
totalnumberRequired.

Order total.
subtotalnumberOptional.

Subtotal of the order.

ContextUser

The ContextUser object contains information about the user.

PropertyTypeDescription
groupsarray of stringsList of IDs of the groups the user belongs to.
order_idarray of stringsList of IDs of orders.

removePageProductGroup

The method removes the page product group.

Returns: IContext

ArgumentTypeDescription
valuestringRequired. This object describes the page.
filterfunctionAccepts any function in the following format: (v: any) => boolean.
If you have suggestions for improving this article, let us know!