@vio-live/web-sdk 0.9.0 → 0.10.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.
@@ -802,6 +802,37 @@ interface QliroOrder {
802
802
  total_price?: number;
803
803
  }
804
804
 
805
+ /**
806
+ * Qliro's browser-side protocol (`q1`).
807
+ *
808
+ * The embedded widget publishes a `q1` object on the window and calls a
809
+ * globally-defined `q1Ready` once it has rendered. Everything the customer
810
+ * does inside the iframe — picking a shipping method, changing their address,
811
+ * having a payment declined — is only observable through these listeners.
812
+ * Without them the widget is a black box: the customer can change the
813
+ * shipping and our own summary keeps showing the old total.
814
+ *
815
+ * Two rules from Qliro's documentation shape this module:
816
+ *
817
+ * 1. **Lock before touching the backend.** Otherwise the customer can
818
+ * complete the purchase while the order is still being synchronized.
819
+ * 2. **Compare before unlocking.** Otherwise a second change interrupts the
820
+ * synchronization of the first.
821
+ *
822
+ * We compare on `MerchantUpdateVersion`, the token Qliro echoes back through
823
+ * `onOrderUpdated`, rather than on totals. Totals cannot be the test here: in
824
+ * the modes where Qliro owns the shipping amount our total and Qliro's
825
+ * legitimately differ, and the customer would sit locked out of a checkout
826
+ * that is in fact up to date.
827
+ */
828
+
829
+ interface QliroSyncResult {
830
+ order_id: string;
831
+ /** Token to wait for in `onOrderUpdated` before unlocking. */
832
+ update_version: string;
833
+ total_price: number;
834
+ }
835
+
805
836
  /**
806
837
  * Walley (former Collector) — embedded checkout via Vio Commerce.
807
838
  *
@@ -951,6 +982,8 @@ declare class CheckoutManager extends EventTarget {
951
982
  private applePayPublishableKey;
952
983
  private applePayConnectedAccount;
953
984
  private klarnaAvailableCache;
985
+ /** Live q1 listeners while a Qliro widget is mounted. */
986
+ private qliroController;
954
987
  private klarnaOrderInFlight;
955
988
  /** Last backend shippings fetched (per-supplier), for UI reuse. */
956
989
  private lastFetchedShippings;
@@ -1025,6 +1058,21 @@ declare class CheckoutManager extends EventTarget {
1025
1058
  * html_snippet into `container` (widget-does-everything, like Kustom).
1026
1059
  */
1027
1060
  mountQliroCheckout(container: HTMLElement, sponsorId?: number): Promise<QliroOrder>;
1061
+ /**
1062
+ * Everything the customer does inside the Qliro iframe, re-published as a
1063
+ * DOM event so a host page can follow a checkout it cannot see into.
1064
+ */
1065
+ private onQliroEvent;
1066
+ /**
1067
+ * Push the current cart onto the open Qliro order.
1068
+ *
1069
+ * Call it after changing the cart while the widget is open: it holds
1070
+ * `q1.lock()` across the round trip and unlocks once Qliro confirms it is
1071
+ * showing the new version. A no-op when no Qliro widget is mounted.
1072
+ */
1073
+ syncQliroOrder(): Promise<QliroSyncResult | null>;
1074
+ /** Drop the Qliro listeners and release any lock still held. */
1075
+ destroyQliroListeners(): void;
1028
1076
  /** Re-read the Qliro order owned by a checkout — the confirmation trip. */
1029
1077
  getQliroOrder(checkoutId: string, sponsorId?: number): Promise<QliroOrder | null>;
1030
1078
  /**
@@ -1384,6 +1432,6 @@ declare const Vio: VioFacade;
1384
1432
  *
1385
1433
  * RELEASE CHECKLIST: bump together with package.json (see CONTRIBUTING).
1386
1434
  */
1387
- declare const SDK_VERSION = "0.9.0";
1435
+ declare const SDK_VERSION = "0.9.1";
1388
1436
 
1389
1437
  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
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-SNIF67UB.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-PX27CQGX.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
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-SNIF67UB.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-PX27CQGX.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-CrO2ciCS.js';
3
- export { e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-CrO2ciCS.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-D6PBisUm.js';
3
+ export { e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-D6PBisUm.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-OTL6QM3G.js';
2
- export { VioTokens, applyVioTheme } from '../chunk-OTL6QM3G.js';
3
- import '../chunk-SNIF67UB.js';
1
+ import { registerVioElements, VioProduct, VioProductCarousel, VioProductDetail, VioCart, VioCheckout } from '../chunk-WIQ53CCM.js';
2
+ export { VioTokens, applyVioTheme } from '../chunk-WIQ53CCM.js';
3
+ import '../chunk-PX27CQGX.js';
4
4
  import * as React from 'react';
5
5
 
6
6
  // node_modules/@lit/react/node/create-component.js
@@ -433,6 +433,19 @@ declare class VioCheckout extends LitElement {
433
433
  private unmountKustom;
434
434
  private renderKustomPanel;
435
435
  /** Mount the Qliro embedded checkout once it's the chosen method. */
436
+ /**
437
+ * Container for a third-party embed, living in the LIGHT DOM.
438
+ *
439
+ * Qliro's (and Walley's) bootstrap script resolves its mount point from the
440
+ * document, so a container inside this component's shadow root is invisible
441
+ * to it and the widget silently never renders — verified against Qliro's
442
+ * staging widget: identical snippet, light DOM renders the iframe, shadow
443
+ * DOM renders nothing at all. The element is a child of the host (light DOM)
444
+ * and is projected back into the panel through a named slot, so the layout
445
+ * is unchanged. Kustom's KCO snippet resolves its own script's parent, so it
446
+ * works either way and keeps using the shadow-root container.
447
+ */
448
+ private lightContainer;
436
449
  private mountQliroIfNeeded;
437
450
  private unmountQliro;
438
451
  private renderQliroPanel;
@@ -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-CrO2ciCS.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-D6PBisUm.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-OTL6QM3G.js';
2
- export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-OTL6QM3G.js';
3
- import '../chunk-SNIF67UB.js';
1
+ import { registerVioElements } from '../chunk-WIQ53CCM.js';
2
+ export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-WIQ53CCM.js';
3
+ import '../chunk-PX27CQGX.js';
4
4
 
5
5
  // src/ui/index.ts
6
6
  registerVioElements();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vio-live/web-sdk",
3
- "version": "0.9.0",
4
- "description": "Vio Web SDK \u2014 in-site shoppable + native checkout, designed for editorial commerce sites",
3
+ "version": "0.10.0",
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",
7
7
  "module": "./dist/index.js",