import { C as CartItemMapper, P as ProductMapper, O as OrderMapper } from '../types-DuZsYlDx.js'; import { a as ProductFields } from '../payloads-BYtydfZU.js'; /** * Cart Mapper * * Converts @shopkit/cart CartItem to ProductFields. * This mapper is the bridge between the cart package and the events package. * * CartItem shape (from @shopkit/cart/types.ts): * { * id: string; * productId: string; * variantId?: string; * sku?: string; * title: string; * price: { amount: number; currencyCode: string }; * compareAtPrice?: { amount: number; currencyCode: string }; * quantity: number; * image?: string; * vendor?: string; * } */ /** * CartItem interface matching @shopkit/cart's CartItem. * Defined here to avoid a build dependency on @shopkit/cart. */ interface CartItemLike { id: string; productId: string; variantId?: string; sku?: string; title: string; price: { amount: number; currencyCode: string; }; compareAtPrice?: { amount: number; currencyCode: string; }; quantity: number; image?: string; vendor?: string; } declare class CartMapper implements CartItemMapper { private defaultCurrency; private priceDivisor; constructor(defaultCurrency?: string, priceDivisor?: number); toProductFields(item: CartItemLike): ProductFields; toProductFieldsList(items: CartItemLike[]): ProductFields[]; calculateCartValue(items: CartItemLike[]): number; getCurrency(items: CartItemLike[], defaultCurrency?: string): string; } /** * Factory function for creating a cart mapper. */ declare function createCartMapper(defaultCurrency?: string, priceDivisor?: number): CartMapper; /** @deprecated Use CartMapper instead */ declare const ShopifyCartMapper: typeof CartMapper; /** @deprecated Use createCartMapper instead */ declare const createShopifyCartMapper: typeof createCartMapper; /** * Shopify Product Mapper * * Converts Shopify product GraphQL response to ProductFields. */ /** * Shopify product shape (from Storefront API GraphQL). */ interface ShopifyProduct { id: string; title: string; vendor?: string; productType?: string; handle: string; featuredImage?: { url: string; }; variants: Array<{ id: string; title: string; price: { amount: string; currencyCode: string; }; compareAtPrice?: { amount: string; currencyCode: string; } | null; sku?: string; }>; } declare class ShopifyProductMapper implements ProductMapper { private defaultCurrency; constructor(defaultCurrency?: string); toProductFields(product: ShopifyProduct, variantIndex?: number): ProductFields; } /** * Factory function for creating a Shopify product mapper. */ declare function createShopifyProductMapper(defaultCurrency?: string): ShopifyProductMapper; /** * Shopify Order Mapper * * Converts Shopify order data to purchase event payload. */ /** * Shopify order shape (from Admin/Storefront API). */ interface ShopifyOrder { id: string; totalPrice: { amount: string; currencyCode: string; }; totalTax?: { amount: string; currencyCode: string; }; totalShipping?: { amount: string; currencyCode: string; }; discountApplications?: Array<{ value: { amount: string; }; }>; lineItems: Array<{ productId: string; title: string; quantity: number; price: { amount: string; currencyCode: string; }; variant?: { id: string; title: string; sku?: string; }; vendor?: string; }>; discountCode?: string; } declare class ShopifyOrderMapper implements OrderMapper { private defaultCurrency; constructor(defaultCurrency?: string); toPurchasePayload(order: ShopifyOrder): { content_ids: string[]; content_type: "product"; currency: string; value: number; num_items: number; contents: { id: string; quantity: number; item_price: number; }[]; order_id: string; tax: number | undefined; shipping: number | undefined; coupon: string | undefined; }; } /** * Factory function for creating a Shopify order mapper. */ declare function createShopifyOrderMapper(defaultCurrency?: string): ShopifyOrderMapper; export { CartItemMapper, CartMapper, OrderMapper, ProductMapper, ShopifyCartMapper, ShopifyOrderMapper, ShopifyProductMapper, createCartMapper, createShopifyCartMapper, createShopifyOrderMapper, createShopifyProductMapper };