@vio-live/web-sdk 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=chunk-QYQQ5J6E.js.map
3
+ //# sourceMappingURL=chunk-QYQQ5J6E.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-PBQSHIID.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-QYQQ5J6E.js"}
@@ -20,6 +20,11 @@ interface VioConfig {
20
20
  apiBase?: string;
21
21
  /** Override GraphQL base. Defaults are env-aware. */
22
22
  graphQLBase?: string;
23
+ /**
24
+ * Override the analytics collector base (vio-analytics service).
25
+ * Defaults are env-aware (`events-dev`/`events-staging`/`events.vio.live`).
26
+ */
27
+ eventsBase?: string;
23
28
  /**
24
29
  * Stripe **publishable** key (`pk_test_xxx` or `pk_live_xxx`). Used for
25
30
  * Apple Pay (via Payment Request) and Card flows. Public-safe — fine
@@ -45,6 +50,7 @@ interface ResolvedConfig {
45
50
  environment: Environment;
46
51
  apiBase: string;
47
52
  graphQLBase: string;
53
+ eventsBase: string;
48
54
  stripePublishableKey?: string;
49
55
  klarnaClientId?: string;
50
56
  klarnaEnvironment: 'playground' | 'production';
@@ -381,8 +387,18 @@ declare class CartManager extends EventTarget {
381
387
  * slow response can't overwrite the state of a newer one. */
382
388
  private mutationSeq;
383
389
  private appliedSeq;
390
+ /** In-flight AddItem/UpdateItem/DeleteItem per sponsor. Callers that need
391
+ * the backend cart to reflect a just-made change (e.g. fetching shippings
392
+ * right after an add) should `await waitForCartMutations(sponsorId)` first
393
+ * — otherwise they can race the mutation and see the cart from before it
394
+ * landed (Alan, 2026-08-18: shippings queried before AddItem settled,
395
+ * came back empty). */
396
+ private inFlightMutations;
384
397
  constructor();
385
398
  private nextSeq;
399
+ /** Resolves once any in-flight AddItem/UpdateItem/DeleteItem for this
400
+ * sponsor has settled (success or failure). No-op if nothing is pending. */
401
+ waitForCartMutations(sponsorId: number): Promise<void>;
386
402
  /** Apply a backend response only if no newer response was applied already. */
387
403
  private applyBackendCart;
388
404
  /** Surface a cart sync problem to hosts/UI (and the console). */
@@ -611,6 +627,8 @@ interface KlarnaPaymentsApi {
611
627
  payment_method_category?: string;
612
628
  auto_finalize?: boolean;
613
629
  }, data: Record<string, unknown>, cb?: (res: KpAuthorizeResult) => void): void;
630
+ /** Debug/lifecycle events — e.g. 'fullscreenOverlayShown'/'fullscreenOverlayHidden'. */
631
+ on?(event: string, cb: () => void): void;
614
632
  }
615
633
  interface KlarnaGlobal {
616
634
  Payments: KlarnaPaymentsApi;
@@ -716,8 +734,9 @@ interface KlarnaPaymentsHandle {
716
734
  load(category?: string): Promise<{
717
735
  showForm: boolean;
718
736
  }>;
719
- /** Authorize the selected method and (on approval) create the order. */
720
- authorize(): Promise<void>;
737
+ /** Authorize a category (defaults to whatever's currently selected) and,
738
+ * on approval, create the order. */
739
+ authorize(category?: string): Promise<void>;
721
740
  /** Tear down the mounted widget. */
722
741
  unmount(): void;
723
742
  }
@@ -753,8 +772,12 @@ declare class CheckoutManager extends EventTarget {
753
772
  clearPaymentMethodsCache(): void;
754
773
  /**
755
774
  * Real shipping options from the backend cart (per supplier), mapped to the
756
- * KlarnaShippingOption shape (minor units). Empty array on failure — callers
757
- * fall back to the static KLARNA_SHIPPING_OPTIONS.
775
+ * KlarnaShippingOption shape (minor units). Empty array on failure/no
776
+ * options — Klarna callers use that as-is (no static fallback anymore, see
777
+ * 2026-08-18: it only ever papered over a race, now fixed via
778
+ * `waitForCartMutations`). `KLARNA_SHIPPING_OPTIONS` is still used
779
+ * separately by Apple Pay's synchronous sheet setup, which can't await
780
+ * this at all.
758
781
  */
759
782
  fetchAvailableShippings(sponsorId?: number): Promise<KlarnaShippingOption[]>;
760
783
  /** Set the chosen shipping per supplier on the backend cart. */
@@ -912,6 +935,150 @@ declare class CheckoutManager extends EventTarget {
912
935
  private emit;
913
936
  }
914
937
 
938
+ /**
939
+ * Vio.analytics — the web SDK's half of the Vio Analytics pipeline.
940
+ *
941
+ * Events flow to the Vio collector (`POST <eventsBase>/v1/events`, repo
942
+ * vio-live/vio-analytics) which owns raw storage (ClickHouse) and vendor
943
+ * fan-out (Mixpanel today). THE SDK NEVER TALKS TO VENDORS — swapping or
944
+ * dropping a vendor is a server-side change, zero client releases.
945
+ * Wire contract: vio-analytics `docs/EVENTS_CONTRACT.md` (v1, snake_case).
946
+ *
947
+ * Design rules:
948
+ * - SIDE-EFFECT-FREE MODULE. Nothing runs at import time (tsup/tree-shaking
949
+ * contract, see lessons/web-sdk-tsup-singleton-and-build). Listeners are
950
+ * installed by an explicit `Vio.analytics.start()`.
951
+ * - `track()` works BEFORE `Vio.init()` — events queue and flush once the
952
+ * SDK is configured (transport resolves at flush time, not at track time).
953
+ * - SSR-safe: without `window` every call is a silent no-op.
954
+ * - Retries are safe: `event_id` is stable per event, the collector
955
+ * dedupes. Queue is bounded (drop-oldest) so a dead collector can never
956
+ * grow memory unbounded.
957
+ * - Anti-double-count: the SDK only reports what the server can't see.
958
+ * Votes/participations are server truth; `ad_activation`/`cart_intent`
959
+ * are mirrored server-side, never from here.
960
+ *
961
+ * Three sinks, matching the Vev precedent (vio-vev analytics.ts, which
962
+ * becomes an adapter over this in F3):
963
+ * 1. collector (default ON once started)
964
+ * 2. window.dataLayer — GA4/GTM (opt-in `start({ dataLayer: true })`,
965
+ * the publisher-facing feature; NOT part of the Vio pipeline)
966
+ * 3. `vio:analytics` DOM event — always when started (inspector/bridges)
967
+ */
968
+ declare const ANALYTICS_EVENT_NAMES: readonly ["view_item_list", "select_item", "view_item", "add_to_cart", "view_cart", "begin_checkout", "purchase", "component_impression", "component_click", "ad_impression", "ad_click", "poll_impression", "contest_impression", "session_start", "session_end"];
969
+ type AnalyticsEventName = (typeof ANALYTICS_EVENT_NAMES)[number];
970
+ /** Camel-case for DX; mapped to the snake_case wire format at build time. */
971
+ interface AnalyticsContext {
972
+ campaignId?: number;
973
+ broadcastId?: string;
974
+ campaignComponentId?: number;
975
+ appPlacementId?: number;
976
+ locationId?: string;
977
+ componentTemplateId?: string;
978
+ sponsorId?: number;
979
+ activationId?: number;
980
+ contentUrl?: string;
981
+ variant?: string;
982
+ }
983
+ interface AnalyticsItemInput {
984
+ productId: number | string;
985
+ name?: string;
986
+ brand?: string;
987
+ variantId?: number | string;
988
+ price?: number;
989
+ quantity?: number;
990
+ }
991
+ interface AnalyticsCommerce {
992
+ items?: AnalyticsItemInput[];
993
+ value?: number;
994
+ currency?: string;
995
+ orderId?: string;
996
+ paymentMethod?: string;
997
+ }
998
+ interface TrackOptions {
999
+ context?: AnalyticsContext;
1000
+ commerce?: AnalyticsCommerce;
1001
+ props?: Record<string, unknown>;
1002
+ }
1003
+ interface AnalyticsStartOptions {
1004
+ /** Where the SDK is embedded: 'vev' | 'replit' | 'custom' | … Default 'custom'. */
1005
+ host?: string;
1006
+ /**
1007
+ * Install the automatic funnel listeners (vio:added-to-cart,
1008
+ * vio:checkout-open, vio:open-cart, vio:payment-success). Default true.
1009
+ * Hosts with their OWN instrumentation choke point (e.g. the Vev module,
1010
+ * which forwards every event through trackEvent()) set false so the same
1011
+ * user action is never tracked twice — they keep the session/batching/
1012
+ * transport engine and call track() themselves.
1013
+ */
1014
+ autoTrack?: boolean;
1015
+ /** Send to the Vio collector. Default true. */
1016
+ collector?: boolean;
1017
+ /** Also push GA4 e-commerce events to window.dataLayer (publisher feature). */
1018
+ dataLayer?: boolean;
1019
+ /** console.debug every event. */
1020
+ debug?: boolean;
1021
+ }
1022
+ declare class AnalyticsManager extends EventTarget {
1023
+ private started;
1024
+ private options;
1025
+ private queue;
1026
+ private flushTimer;
1027
+ private retryAttempt;
1028
+ private retryNotBefore;
1029
+ private externalUserId;
1030
+ private sessionId;
1031
+ private sessionStartedAt;
1032
+ /** Impression once-per-(session, component) guard; reset on session rotation. */
1033
+ private impressedComponents;
1034
+ /** Last NON-EMPTY cart snapshot — `purchase` uses it because several flows
1035
+ * (Apple Pay) clear the cart BEFORE `vio:payment-success` fires. */
1036
+ private lastCartSnapshot;
1037
+ private teardown;
1038
+ /**
1039
+ * Install listeners + begin flushing. Explicit on purpose (no module
1040
+ * side-effects). Safe to call twice (second call only updates options).
1041
+ */
1042
+ start(options?: AnalyticsStartOptions): void;
1043
+ /** Stop timers + listeners (tests / SPA unmount). Queue survives. */
1044
+ stop(): void;
1045
+ /** Attach the partner's user id (opaque) to all subsequent events. */
1046
+ identify(externalUserId: string | null): void;
1047
+ /** Queue one event. Works pre-init and pre-start (SSR: no-op). */
1048
+ track(name: AnalyticsEventName, opts?: TrackOptions): void;
1049
+ /**
1050
+ * Impression helper: observes an element and tracks ONE
1051
+ * `component_impression` per (session, campaignComponentId) when the
1052
+ * contract's rule is met (≥50% visible, ≥1s dwell). Returns an
1053
+ * unobserve function.
1054
+ */
1055
+ observeImpression(element: Element, context?: AnalyticsContext, opts?: {
1056
+ name?: Extract<AnalyticsEventName, 'component_impression' | 'ad_impression'>;
1057
+ /** Dedupe key override. Defaults to the strongest id available:
1058
+ * campaignComponentId → locationId → componentTemplateId. */
1059
+ key?: string;
1060
+ /** Called the one time the impression is tracked (e.g. to fire a
1061
+ * companion view_item_list). */
1062
+ onImpression?: () => void;
1063
+ }): () => void;
1064
+ /** Force a flush (mostly for tests). */
1065
+ flush(): Promise<void>;
1066
+ private buildEvent;
1067
+ private anonId;
1068
+ /** Rolling session: renewed by activity, rotated after 30 min idle. */
1069
+ private ensureSession;
1070
+ private trackSessionEnd;
1071
+ private flushWithBeacon;
1072
+ /**
1073
+ * Auto-instrumentation over the SDK's own DOM events — the host app
1074
+ * writes ZERO tracking code for the commerce funnel.
1075
+ */
1076
+ private installAutoListeners;
1077
+ /** Current cart → commerce payload; falls back to the pre-clear snapshot. */
1078
+ private cartCommerce;
1079
+ private findLine;
1080
+ }
1081
+
915
1082
  declare class VioFacade {
916
1083
  private apiInstance;
917
1084
  private commerceClients;
@@ -922,6 +1089,7 @@ declare class VioFacade {
922
1089
  private bootstrapFailedAt;
923
1090
  private cartManager;
924
1091
  private checkoutManager;
1092
+ private analyticsManager;
925
1093
  init(config: VioConfig): void;
926
1094
  get isInitialized(): boolean;
927
1095
  get config(): ResolvedConfig;
@@ -929,6 +1097,11 @@ declare class VioFacade {
929
1097
  get cart(): CartManager;
930
1098
  /** Checkout flow manager. Subscribes to cart state via the CartManager. */
931
1099
  get checkout(): CheckoutManager;
1100
+ /**
1101
+ * Analytics — track() queues even pre-init; nothing is sent (and no
1102
+ * listeners are installed) until an explicit `Vio.analytics.start()`.
1103
+ */
1104
+ get analytics(): AnalyticsManager;
932
1105
  /** Lazy VioApi for REST endpoints on `api-dev.vio.live`. */
933
1106
  get api(): VioApi;
934
1107
  /**
@@ -1047,4 +1220,13 @@ declare function getAvailablePaymentMethods(options?: CartQueryOptions): Promise
1047
1220
  declare const CREATE_PAYMENT_STRIPE_MUTATION = "\nmutation CreatePaymentStripe($checkoutId: String!, $successUrl: String!, $paymentMethod: String!, $email: String!) {\n Payment {\n CreatePaymentStripe(checkout_id: $checkoutId, success_url: $successUrl, payment_method: $paymentMethod, email: $email) {\n order_id\n checkout_url\n }\n }\n}\n";
1048
1221
  declare function createPaymentStripe(variables: Record<string, unknown>, options?: CartQueryOptions): Promise<any>;
1049
1222
 
1050
- export { ADD_ITEM_MUTATION, type AddManualOptions, type AddProductOptions, type ApplePayConfig, type ApplePayResult, type BootstrapResponse, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, type CartChangeDetail, type CartLineItem, CartManager, type CartQueryOptions, type CheckoutAddress, type CheckoutChangeDetail, CheckoutManager, type CheckoutState, CommerceClient, Configuration, type CreatePaymentVippsResponse, type CreatePaymentVippsVariables, DELETE_ITEM_MUTATION, type Environment, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, type GetVippsStatusVariables, type ImageSize, type PaymentCompleteDetail, type PaymentMethod, type PaymentSelectDetail, type PlacementComponent, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductPrice, type ProductVariant, type ResolvedConfig, type Sponsor, type SponsorCartState, type SponsorCommerceBlock, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, type VioConfig, type VippsPaymentState, type VippsStatusResult, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier };
1223
+ /**
1224
+ * SDK version reported in analytics events (`sdk_version`) and available
1225
+ * to consumers. Kept as a constant (not a package.json import) so the
1226
+ * core stays bundler-agnostic.
1227
+ *
1228
+ * RELEASE CHECKLIST: bump together with package.json (see CONTRIBUTING).
1229
+ */
1230
+ declare const SDK_VERSION = "0.5.0";
1231
+
1232
+ export { ADD_ITEM_MUTATION, type AddManualOptions, type AddProductOptions, type AnalyticsCommerce, type AnalyticsContext, type AnalyticsEventName, type AnalyticsItemInput, AnalyticsManager, type AnalyticsStartOptions, type ApplePayConfig, type ApplePayResult, type BootstrapResponse, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, type CartChangeDetail, type CartLineItem, CartManager, type CartQueryOptions, type CheckoutAddress, type CheckoutChangeDetail, CheckoutManager, type CheckoutState, CommerceClient, Configuration, type CreatePaymentVippsResponse, type CreatePaymentVippsVariables, DELETE_ITEM_MUTATION, type Environment, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, type GetVippsStatusVariables, type ImageSize, type PaymentCompleteDetail, type PaymentMethod, type PaymentSelectDetail, type PlacementComponent, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductPrice, type ProductVariant, type ResolvedConfig, SDK_VERSION, type Sponsor, type SponsorCartState, type SponsorCommerceBlock, type TrackOptions, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, type VioConfig, type VippsPaymentState, type VippsStatusResult, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier };
@@ -1,4 +1,4 @@
1
- import '../chunk-PBQSHIID.js';
2
- export { ADD_ITEM_MUTATION, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from '../chunk-NP2KCM7X.js';
1
+ import '../chunk-QYQQ5J6E.js';
2
+ export { ADD_ITEM_MUTATION, AnalyticsManager, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, SDK_VERSION, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from '../chunk-HNQG56SD.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { ADD_ITEM_MUTATION, AddManualOptions, AddProductOptions, ApplePayConfig, ApplePayResult, BootstrapResponse, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartChangeDetail, CartLineItem, CartManager, CartQueryOptions, CheckoutAddress, CheckoutChangeDetail, CheckoutManager, CheckoutState, CommerceClient, Configuration, CreatePaymentVippsResponse, CreatePaymentVippsVariables, DELETE_ITEM_MUTATION, Environment, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, GetVippsStatusVariables, ImageSize, PaymentCompleteDetail, PaymentMethod, PaymentSelectDetail, PlacementComponent, Product, ProductCategory, ProductImage, ProductOption, ProductPrice, ProductVariant, ResolvedConfig, Sponsor, SponsorCartState, SponsorCommerceBlock, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, VioConfig, VippsPaymentState, VippsStatusResult, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from './core/index.js';
1
+ export { ADD_ITEM_MUTATION, AddManualOptions, AddProductOptions, AnalyticsCommerce, AnalyticsContext, AnalyticsEventName, AnalyticsItemInput, AnalyticsManager, AnalyticsStartOptions, ApplePayConfig, ApplePayResult, BootstrapResponse, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartChangeDetail, CartLineItem, CartManager, CartQueryOptions, CheckoutAddress, CheckoutChangeDetail, CheckoutManager, CheckoutState, CommerceClient, Configuration, CreatePaymentVippsResponse, CreatePaymentVippsVariables, DELETE_ITEM_MUTATION, Environment, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, GetVippsStatusVariables, ImageSize, PaymentCompleteDetail, PaymentMethod, PaymentSelectDetail, PlacementComponent, Product, ProductCategory, ProductImage, ProductOption, ProductPrice, ProductVariant, ResolvedConfig, SDK_VERSION, Sponsor, SponsorCartState, SponsorCommerceBlock, TrackOptions, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, VioConfig, VippsPaymentState, VippsStatusResult, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from './core/index.js';
2
2
  import 'graphql-request';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import './chunk-PBQSHIID.js';
2
- export { ADD_ITEM_MUTATION, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from './chunk-NP2KCM7X.js';
1
+ import './chunk-QYQQ5J6E.js';
2
+ export { ADD_ITEM_MUTATION, AnalyticsManager, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, SDK_VERSION, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from './chunk-HNQG56SD.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import * as _lit_react from '@lit/react';
2
- import { V as VioCart$1, a as VioCheckout$1, b as VioProduct$1, c as VioProductCarousel$1, d as VioProductDetail$1 } from '../tokens-CvqQYURw.js';
3
- export { e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-CvqQYURw.js';
2
+ import { V as VioCart$1, a as VioCheckout$1, b as VioProduct$1, c as VioProductCarousel$1, d as VioProductDetail$1 } from '../tokens-TIH4RkPl.js';
3
+ export { e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-TIH4RkPl.js';
4
4
  import 'lit-html';
5
5
  import 'lit';
6
6
 
@@ -1,6 +1,6 @@
1
- import { registerVioElements, VioProduct, VioProductCarousel, VioProductDetail, VioCart, VioCheckout } from '../chunk-V5ZQG2H5.js';
2
- export { VioTokens, applyVioTheme } from '../chunk-V5ZQG2H5.js';
3
- import '../chunk-NP2KCM7X.js';
1
+ import { registerVioElements, VioProduct, VioProductCarousel, VioProductDetail, VioCart, VioCheckout } from '../chunk-5CKG3F56.js';
2
+ export { VioTokens, applyVioTheme } from '../chunk-5CKG3F56.js';
3
+ import '../chunk-HNQG56SD.js';
4
4
  import * as React from 'react';
5
5
 
6
6
  // node_modules/@lit/react/node/create-component.js
@@ -90,8 +90,16 @@ declare class VioProductCarousel extends LitElement {
90
90
  private fetchError;
91
91
  static styles: lit.CSSResult;
92
92
  connectedCallback(): void;
93
+ disconnectedCallback(): void;
93
94
  updated(changed: Map<string, unknown>): void;
94
95
  private autoFetch;
96
+ private unobserveImpression;
97
+ private impressed;
98
+ private listTracked;
99
+ private observeForAnalytics;
100
+ /** view_item_list needs BOTH the viewport dwell and loaded products —
101
+ * whichever lands last fires it (once). */
102
+ private maybeTrackList;
95
103
  private parseRefs;
96
104
  private scrollByDirection;
97
105
  private renderScrollerContent;
@@ -302,7 +310,7 @@ declare class VioCheckout extends LitElement {
302
310
  private klarnaAuthorizing;
303
311
  /** Chosen shipping option id (express flow) — drives the Klarna order total. */
304
312
  private selectedShipping;
305
- /** Real per-supplier shippings from the backend (empty → static fallback). */
313
+ /** Real per-supplier shippings from the backend. */
306
314
  private availableShippingsList;
307
315
  /** Payment method names enabled for the sponsor (backend-configured).
308
316
  * null = not loaded yet → all buttons render; [] = none enabled. */
@@ -374,7 +382,7 @@ declare class VioCheckout extends LitElement {
374
382
  /** Mount (or re-mount on amount change) the Klarna Payments widget. */
375
383
  private mountKlarnaIfNeeded;
376
384
  private unmountKlarna;
377
- /** Shippings in effect: backend per-supplier when loaded, static otherwise. */
385
+ /** Shippings in effect: backend per-supplier when loaded. */
378
386
  private get shippingList();
379
387
  /** Selected shipping option (express flow). */
380
388
  private get shippingOption();
@@ -1,4 +1,4 @@
1
- export { V as VioCart, a as VioCheckout, b as VioProduct, c as VioProductCarousel, d as VioProductDetail, e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-CvqQYURw.js';
1
+ export { V as VioCart, a as VioCheckout, b as VioProduct, c as VioProductCarousel, d as VioProductDetail, e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-TIH4RkPl.js';
2
2
  import 'lit-html';
3
3
  import 'lit';
4
4
 
package/dist/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { registerVioElements } from '../chunk-V5ZQG2H5.js';
2
- export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-V5ZQG2H5.js';
3
- import '../chunk-NP2KCM7X.js';
1
+ import { registerVioElements } from '../chunk-5CKG3F56.js';
2
+ export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-5CKG3F56.js';
3
+ import '../chunk-HNQG56SD.js';
4
4
 
5
5
  // src/ui/index.ts
6
6
  registerVioElements();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vio-live/web-sdk",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Vio Web SDK — in-site shoppable + native checkout, designed for editorial commerce sites",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",