import { type Config, type NotificationConfig, resolveConfig, resolveNotificationConfig } from './config.ts'; import { Query } from './query.ts'; import { Notification } from './notification.ts'; /** * Initialization for interacting with the Elevate Storefront API * @see https://docs.elevate.voyado.cloud/elevate/4/api/storefront/v3/ */ export function elevate(config: Config) { const resolvedConfig = resolveConfig(config); return Object.freeze({ /** The base URL to the Elevate cluster hosting the API */ clusterUrl: resolvedConfig.clusterUrl, /** Send queries to retrieve products, facets and more */ query: new Query(resolvedConfig), /** Send notifications for clicks, add-to-carts and more */ notify: new Notification(resolvedConfig) }); } /** * @deprecated eSales has changed name to Elevate -> use {@linkcode elevate}. */ export const esales = elevate; /** * Initialization for interacting with the Elevate Storefront Queries API * @see https://docs.elevate.voyado.cloud/elevate/4/api/storefront/v3/#queries */ export function queries(config: Config) { return new Query(resolveConfig(config)); } /** * Initialization for interacting with the Elevate Storefront Notifications API * @see https://docs.elevate.voyado.cloud/elevate/4/api/storefront/v3/#notifications */ export function notifications(config: NotificationConfig) { return new Notification(resolveNotificationConfig(config)); } // Export Typescript interfaces/types export * from './models/mod.ts'; export type { Config, NotificationConfig, Session, UserContext, SessionMetadata, PersonalizedSession, Touchpoint } from './config.ts'; // Helper functions export { isTextFacet, isRangeFacet, isCheckboxFacet, isColorFacet, isSizeFacet } from './helpers/mod.ts'; export { type LocalStorageSession, localStorageBackedSession } from './session.ts';