export type StorefrontSnackVideoConversionEventProperties = {content_type?: (string | null) | undefined, content_category?: (string | null) | undefined, content_name?: (string | null) | undefined, currency?: (string | null) | undefined, value?: (number | null) | undefined, quantity?: (number | null) | undefined, price?: (number | null) | undefined, query?: (string | null) | undefined, mapping_id?: (string | null) | undefined} | {[key: string]: unknown}; export type StorefrontSnackVideoConversionEvent = {event_name: string, properties?: StorefrontSnackVideoConversionEventProperties | undefined}; export type StorefrontAnalyticsVariantItem = {variant_unique_id: string, quantity: number}; export type StorefrontAnalyticsBundlePriceOptionItem = {bundle_price_option_unique_id: string, quantity: number}; export type StorefrontSnackVideoConversionEventRequest = {tracking_context?: string | undefined, tracking_trigger?: string | undefined, tracking_asset_id?: number | undefined, tracking_token?: string | undefined, tracking_renderer?: ('vue' | 'html') | undefined, click_id: string, event_source_url?: (string | null) | undefined, referrer_url?: (string | null) | undefined, events: Array, variants?: Array | undefined, bundle_price_options?: Array | undefined} | {[key: string]: unknown}; export type CreateApiV3PagesPageUniqueIdAnalyticsSnackvideoEventsArgs = {body: StorefrontSnackVideoConversionEventRequest}; export type CreateApiV3PagesPageUniqueIdAnalyticsSnackvideoEventsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send a landing page SnackVideo event * * POST /v3/pages/{page_unique_id}/analytics/snackvideo/events */ export const createApiV3PagesPageUniqueIdAnalyticsSnackvideoEvents = async (args: CreateApiV3PagesPageUniqueIdAnalyticsSnackvideoEventsArgs, options?: CreateApiV3PagesPageUniqueIdAnalyticsSnackvideoEventsOptions) => { const {baseUrl = "https://api.scalev.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v3/pages/${encodeURIComponent(String(args.page_unique_id))}/analytics/snackvideo/events${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };