@vio-live/web-sdk 0.9.1 → 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
  /**
@@ -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-WKJRYYNI.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-WKJRYYNI.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
- import { registerVioElements, VioProduct, VioProductCarousel, VioProductDetail, VioCart, VioCheckout } from '../chunk-PRMVVF5C.js';
2
- export { VioTokens, applyVioTheme } from '../chunk-PRMVVF5C.js';
3
- import '../chunk-WKJRYYNI.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
package/dist/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { registerVioElements } from '../chunk-PRMVVF5C.js';
2
- export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-PRMVVF5C.js';
3
- import '../chunk-WKJRYYNI.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.1",
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",