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:

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

const context = PageController.getContext();

ProductEventModel

This object describes a product.

Property

Type

Description

sku

string

Required.

The stock keeping unit (SKU) of the product.

quantity

number

Optional.

Number of units of the product.

price

number

Optional.

Price used to calculate the order.

priceOriginal

number

Optional.

The originally posted price of the product.

UserEventModel

This object describes a user.

Property

Type

Description

email

string

Required.

The email address of the user.

id

string

Required.

ID of the user.

emailId

string

Optional.

ID for the email address of the user.

CheckoutEventModel

This object describes the checkout event.

Property

Type

Description

orderId

string

Required.

ID of the order.

total

number

Required.

Order total.

subtotal

number

Optional.

Subtotal of the order.

ContextUser

The ContextUser object contains information about the user.

Property

Type

Description

groups

array of strings

List of IDs of the groups the user belongs to.

order_id

array of strings

List of IDs of orders.

removePageProductGroup

The method removes the page product group.

Returns: IContext

Argument

Type

Description

value

string

Required. This object describes the page.

filter

function

Accepts any function in the following format: (v: any) => boolean.

Do you have some feedback for us?

If you have suggestions for improving this article,