Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShopperExperience<ConfigParameters>

*Use the Shopper Experience API to look up page information for pages that are created in Page Designer.

Responses include the following:

  • The entire component hierarchy of the page at design time.
  • All merchant data provided at design time.
  • Server-side scripting data provided at run time.

Both the page and components contain the values of all native and custom attributes that have been populated during page authoring.

Only visible pages are returned. Because the visibility of components is driven by rules (scheduling or customer groups, for example), these rules are subject to evaluation when assembling the component hierarchy in the response. Only components that are visible for the current customer context appear in the response. The same rules apply to the page itself, which is only be processed and returned if it is visible.

Important*: Currently, the Shopper Experience API can’t be used when the storefront password protection feature is enabled.

Authentication & Authorization

The Shopper Experience API requires a shopper access token from the Shopper Login and API Access Service (SLAS).

For details on how to request a shopper access token from SLAS, see the guest user flows for public clients and private clients in the SLAS guides.

You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see the Authorization Scopes Catalog..*

Simple example:

  import { ShopperExperience } from "commerce-sdk-isomorphic";

  const clientConfig = {
    parameters: {
      clientId: "XXXXXX",
      organizationId: "XXXX",
      shortCode: "XXX",
      siteId: "XX"
    }
  };
  const shopperExperienceClient = new ShopperExperience(clientConfig);
API Version: 0.0.33
Last Updated:

Type parameters

Hierarchy

  • ShopperExperience

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

Properties

clientConfig

clientConfig: ClientConfig<ConfigParameters> & { baseUri: string }

Static Readonly defaultBaseUri

defaultBaseUri: "https://{shortCode}.api.commercecloud.salesforce.com/experience/shopper-experience/v1" = currentBaseUri

Static Readonly paramKeys

paramKeys: { getPage: ["pageId", "organizationId", "siteId", "aspectAttributes", "parameters", "locale"]; getPageRequired: ["pageId", "organizationId", "siteId"]; getPages: ["organizationId", "aspectTypeId", "siteId", "categoryId", "productId", "aspectAttributes", "parameters", "locale"]; getPagesRequired: ["organizationId", "aspectTypeId", "siteId"] } = {getPage: ['pageId','organizationId','siteId','aspectAttributes','parameters','locale',],getPageRequired: ['pageId','organizationId','siteId',],getPages: ['organizationId','aspectTypeId','siteId','categoryId','productId','aspectAttributes','parameters','locale',],getPagesRequired: ['organizationId','aspectTypeId','siteId',],} as const

Type declaration

  • getPage: ["pageId", "organizationId", "siteId", "aspectAttributes", "parameters", "locale"]
  • getPageRequired: ["pageId", "organizationId", "siteId"]
  • getPages: ["organizationId", "aspectTypeId", "siteId", "categoryId", "productId", "aspectAttributes", "parameters", "locale"]
  • getPagesRequired: ["organizationId", "aspectTypeId", "siteId"]

Methods

getPage

  • Get a Page Designer page for a specific page ID. The results apply the visibility rules for the page's components, such as personalization or scheduled visibility.

    Important*:

    • Currently, you can't use the Shopper Experience API when the storefront password protection feature is enabled.
    • Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
    • Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the Page Designer Caching Guide.

    If you would like to get a raw Response object use the other getPage function.

    Parameters

    Returns Promise<Page>

    A promise of type Page.

  • Get a Page Designer page for a specific page ID. The results apply the visibility rules for the page's components, such as personalization or scheduled visibility.

    Important*:

    • Currently, you can't use the Shopper Experience API when the storefront password protection feature is enabled.
    • Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
    • Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the Page Designer Caching Guide.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ aspectAttributes?: undefined | string; locale?: LocaleCode; organizationId: string; pageId: string; parameters?: undefined | string; siteId: string } & QueryParameters, ConfigParameters> }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Page>

    A promise of type Response if rawResponse is true, a promise of type Page otherwise.

getPages

  • Get Page Designer pages. The results apply the visibility rules for each page's components, such as personalization or scheduled visibility.

    You must provide the aspectTypeId along with either a categoryId or a productId. Since you can only create one page-to-product or page-to-category assignment per aspect type, the result contains at most one element.

    Important*:

    • Currently, you can't use the Shopper Experience API when the storefront password protection feature is enabled.
    • Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
    • Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the Page Designer Caching Guide.

    If you would like to get a raw Response object use the other getPages function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ aspectAttributes?: undefined | string; aspectTypeId: string; categoryId?: undefined | string; locale?: LocaleCode; organizationId: string; parameters?: undefined | string; productId?: undefined | string; siteId: string } & QueryParameters, ConfigParameters> }>

      An object containing the options for this method.

    Returns Promise<PageResult>

    A promise of type PageResult.

  • Get Page Designer pages. The results apply the visibility rules for each page's components, such as personalization or scheduled visibility.

    You must provide the aspectTypeId along with either a categoryId or a productId. Since you can only create one page-to-product or page-to-category assignment per aspect type, the result contains at most one element.

    Important*:

    • Currently, you can't use the Shopper Experience API when the storefront password protection feature is enabled.
    • Because this resource uses the GET method, you must not pass sensitive data, for example: payment card information, and must not perform transactional processes within the server-side scripts that are run for the page and components.
    • Be aware that pagecache during fingerprint calculation will only be leveraged for pages and their components that don't use visibility rules. Furthermore the pagecaching of the actual response assembly solely depends on the response instrumentation with the serverside page type and component type script implementations. For more details also see the Page Designer Caching Guide.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ aspectAttributes?: undefined | string; aspectTypeId: string; categoryId?: undefined | string; locale?: LocaleCode; organizationId: string; parameters?: undefined | string; productId?: undefined | string; siteId: string } & QueryParameters, ConfigParameters> }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : PageResult>

    A promise of type Response if rawResponse is true, a promise of type PageResult otherwise.

Object literals

Static Readonly apiPaths

apiPaths: object

getPage

getPage: string = "/organizations/{organizationId}/pages/{pageId}"

getPages

getPages: string = "/organizations/{organizationId}/pages"

Generated using TypeDoc