A builder interface for the VSC component. This allows to set up default settings for the VSC instance.

For the full documentation on the VSC component please take a look into our docs VSC documentation

See IGarmentInformationProvider on how to provide garment information to the VSC component.

See ICommerceProvider on how to provide e-commerce information and actions to the VSC component.

See hostAdaptors.SharingProvider on how to implement sharing functionality in the VSC component.

interface IVirtualStylingBuilder {
    addConsentCallback(cb: (() => {
        consent?: ConsentState;
        internalAnalytics?: boolean;
    })): void;
    addGoogleAnalytics(ga?: string): IVirtualStylingBuilder;
    build(): Promise<{
        api: IVirtualStylingApi;
        opened: boolean;
    }>;
    forOrganisation(org: string): IVirtualStylingBuilder;
    getCollection(collectionId: string, organizationId?: string): Promise<null | Collection>;
    setAnalytics(analytics: Partial<IAnalyticProvider>[]): IVirtualStylingBuilder;
    setAvatarPosition(position: TopBottomPosition): IVirtualStylingBuilder;
    setCustomStyle(style: string): IVirtualStylingBuilder;
    setECommerceProvider(commerceProvider: ICommerceProvider): IVirtualStylingBuilder;
    setGarmentInformationProvider(informationProvider: Partial<IGarmentInformationProvider>): IVirtualStylingBuilder;
    setSharingProvider(provider: ISharingProvider): IVirtualStylingBuilder;
}

Methods

  • Add a consent callback that can be used to query the consent state of the user.

    Parameters

    • cb: (() => {
          consent?: ConsentState;
          internalAnalytics?: boolean;
      })

      The callback

        • (): {
              consent?: ConsentState;
              internalAnalytics?: boolean;
          }
        • Returns {
              consent?: ConsentState;
              internalAnalytics?: boolean;
          }

          • Optionalconsent?: ConsentState
          • OptionalinternalAnalytics?: boolean

    Returns void

  • Fetch a collection based in the received reference id and organization id

    Parameters

    • collectionId: string

      The collection reference

    • OptionalorganizationId: string

      The organization id

    Returns Promise<null | Collection>