@vio-live/web-sdk 0.11.1 → 0.21.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.
@@ -1,4 +1,4 @@
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-TJ43TE7H.js';
1
+ import '../chunk-PZUOMOLF.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, VIPPS_BUTTON_SCRIPT, VIPPS_BUTTON_TAG, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, ensureVippsButton, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, purchaseFromPaymentSuccess, resolveCampaignId, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier, vippsButtonAttributes } from '../chunk-WTVGVDZX.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, 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';
1
+ export { ADD_ITEM_MUTATION, AddManualOptions, AddProductOptions, AnalyticsCommerce, AnalyticsContext, AnalyticsEventName, AnalyticsItemInput, AnalyticsManager, AnalyticsStartOptions, ApplePayConfig, ApplePayResult, BootstrapCampaign, BootstrapCampaignEntry, BootstrapCampaignStatus, BootstrapResponse, BootstrapSlot, 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, PaymentSuccessDetail, PaymentSuccessResult, 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, VIPPS_BUTTON_SCRIPT, VIPPS_BUTTON_TAG, Vio, VioApi, VioApiError, VioConfig, VippsPaymentState, VippsStatusResult, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, ensureVippsButton, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, purchaseFromPaymentSuccess, resolveCampaignId, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier, vippsButtonAttributes } from './core/index.js';
2
2
  import 'graphql-request';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
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-TJ43TE7H.js';
1
+ import './chunk-PZUOMOLF.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, VIPPS_BUTTON_SCRIPT, VIPPS_BUTTON_TAG, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, ensureVippsButton, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, purchaseFromPaymentSuccess, resolveCampaignId, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier, vippsButtonAttributes } from './chunk-WTVGVDZX.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-D6PBisUm.js';
3
- export { e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-D6PBisUm.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-Dkbfcd1L.js';
3
+ export { e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-Dkbfcd1L.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-7TGCXO5J.js';
2
- export { VioTokens, applyVioTheme } from '../chunk-7TGCXO5J.js';
3
- import '../chunk-TJ43TE7H.js';
1
+ import { registerVioElements, VioProduct, VioProductCarousel, VioProductDetail, VioCart, VioCheckout } from '../chunk-MRJR6DG5.js';
2
+ export { VioTokens, applyVioTheme } from '../chunk-MRJR6DG5.js';
3
+ import '../chunk-WTVGVDZX.js';
4
4
  import * as React from 'react';
5
5
 
6
6
  // node_modules/@lit/react/node/create-component.js
@@ -119,6 +119,14 @@ declare class VioProductDetail extends LitElement {
119
119
  autoOpen: boolean;
120
120
  currency: string;
121
121
  private product;
122
+ /**
123
+ * The header: the seller's Company name (Settings → Company), not the
124
+ * product's brand, which the body already shows (Angelo, 2026-10-08).
125
+ * Asked on its own after the product; until it answers the header waits,
126
+ * and if there is none it falls back to the brand.
127
+ */
128
+ private sellerName;
129
+ private sellerSettled;
122
130
  private isLoading;
123
131
  private fetchError;
124
132
  private selectedOptions;
@@ -130,6 +138,7 @@ declare class VioProductDetail extends LitElement {
130
138
  /** Payment method names enabled for the sponsor (backend-configured).
131
139
  * null = not loaded yet → all buy buttons render; [] = none enabled. */
132
140
  private availableMethods;
141
+ private vippsOfficial;
133
142
  /** Race guard: only the latest fetch may write state (two quick taps on
134
143
  * different cards would otherwise let the slow response win). */
135
144
  private fetchSeq;
@@ -137,10 +146,13 @@ declare class VioProductDetail extends LitElement {
137
146
  private optMapCache;
138
147
  /** Pre-prepared Apple Pay handle — show() fires synchronously on tap. */
139
148
  private applePayHandle;
149
+ /** Keyboard and focus while open: Escape closes, Tab stays inside, focus returns to the opener. */
150
+ private readonly dialogFocus;
140
151
  private boundProductClick;
141
152
  static styles: lit.CSSResult;
142
153
  connectedCallback(): void;
143
154
  disconnectedCallback(): void;
155
+ updated(changed: Map<string, unknown>): void;
144
156
  show(): void;
145
157
  close(): void;
146
158
  private fetchProduct;
@@ -196,7 +208,31 @@ declare class VioProductDetail extends LitElement {
196
208
  */
197
209
  private buyWithKlarna;
198
210
  /** Buy with Vipps — opens the checkout with Vipps preselected. */
211
+ /**
212
+ * Buy now with an embedded checkout (Kustom, Qliro, Walley).
213
+ *
214
+ * Those three have no express path of their own, so the product page showed
215
+ * a "Kjøp nå" for Apple Pay, Stripe, Klarna and Vipps and nothing at all for
216
+ * them — the same structural gap the cart footer had. Opens the checkout
217
+ * without preselecting: with a single method the checkout selects it itself,
218
+ * with several the shopper picks.
219
+ *
220
+ * Like every other "Kjøp nå" here, it adds to the cart first — so a cart
221
+ * that already had items buys those too. Isolating a single-product purchase
222
+ * needs a checkout that is not bound to the sponsor's cart, which is a
223
+ * separate piece of work and deliberately not done here.
224
+ */
225
+ private buyNow;
226
+ /**
227
+ * Buy with Vipps — Express: the app opens with address and delivery
228
+ * already there, nothing to fill in here (Vipps' own recommendation,
229
+ * 2026-09-29). When this cart cannot have Express, or Vipps cannot be
230
+ * started, the checkout opens with Vipps preselected, as before.
231
+ */
232
+ /** Vipps' own button when its script answers; our orange one otherwise. */
233
+ private loadVippsButton;
199
234
  private buyWithVipps;
235
+ private startVippsExpressOrCheckout;
200
236
  /** Buy with Stripe — opens the checkout with Stripe preselected. */
201
237
  private buyWithStripe;
202
238
  /**
@@ -206,6 +242,9 @@ declare class VioProductDetail extends LitElement {
206
242
  * confirmation drawer (same path as the in-checkout Apple Pay button).
207
243
  */
208
244
  private buyWithApplePay;
245
+ /** The seller's Company name; the brand when there is none; nothing while asking. */
246
+ private headerName;
247
+ private loadSeller;
209
248
  render(): lit_html.TemplateResult<1>;
210
249
  private renderBody;
211
250
  private renderOptionPickers;
@@ -231,6 +270,9 @@ declare class VioCart extends LitElement {
231
270
  /** Payment method names enabled for the sponsor (backend-configured).
232
271
  * null = not loaded yet → all buttons render; [] = none enabled. */
233
272
  private availableMethods;
273
+ private vippsOfficial;
274
+ /** Whether the method lookup has been attempted — see boundOnCartChange. */
275
+ private paymentMethodsAttempted;
234
276
  /** Set after an Apple Pay express purchase — switches the drawer to the
235
277
  * confirmation screen (so the rest of the cart/checkout is not shown). */
236
278
  private confirmedOrder;
@@ -240,6 +282,8 @@ declare class VioCart extends LitElement {
240
282
  private preparedTotal;
241
283
  /** In-flight guard for loadAvailablePaymentMethods. */
242
284
  private loadingPaymentMethods;
285
+ /** Keyboard and focus while open: Escape closes, Tab stays inside, focus returns to the opener. */
286
+ private readonly dialogFocus;
243
287
  private boundOnCartChange;
244
288
  static styles: lit.CSSResult;
245
289
  connectedCallback(): void;
@@ -264,7 +308,25 @@ declare class VioCart extends LitElement {
264
308
  * opens <vio-checkout> in express mode with Klarna preselected. */
265
309
  private onKlarnaExpress;
266
310
  /** Vipps — opens the checkout with Vipps preselected. */
311
+ /**
312
+ * Open the checkout without preselecting a method.
313
+ *
314
+ * The footer used to be express-only — Apple Pay, Stripe, Klarna, Vipps —
315
+ * so a channel offering just an embedded checkout (Kustom, Qliro, Walley)
316
+ * had NO button at all and the cart was a dead end. Even with an express
317
+ * method present the others were unreachable from here.
318
+ */
319
+ private onCheckout;
320
+ /**
321
+ * Vipps — Express: the app collects address and delivery, so the cart
322
+ * goes straight to Vipps. When this cart cannot have Express (several
323
+ * suppliers, digital goods, no rate) or Vipps cannot be started, the
324
+ * checkout opens with Vipps preselected, as before.
325
+ */
267
326
  private onVipps;
327
+ /** Vipps' own button when its script answers; our orange one otherwise. */
328
+ private loadVippsButton;
329
+ private startVippsExpressOrCheckout;
268
330
  /** Stripe — opens the checkout with Stripe preselected. */
269
331
  private onStripe;
270
332
  private get totalAcrossSponsors();
@@ -293,10 +355,26 @@ declare class VioCheckout extends LitElement {
293
355
  private applePayInProgress;
294
356
  private klarnaAvailable;
295
357
  private orderConfirmed;
358
+ /**
359
+ * The embedded provider whose OWN receipt is on screen after a completed
360
+ * purchase (Qliro, Walley). Set instead of `orderConfirmed`: when the
361
+ * provider renders a receipt, that is the one the shopper sees, not ours
362
+ * (Angelo, 2026-09-15). See showProviderReceipt.
363
+ */
364
+ private providerReceipt;
296
365
  private confirmedMethod;
297
366
  private paymentError;
298
367
  /** Neutral (non-error) status line: "verifying payment…" / "still processing". */
299
368
  private paymentNotice;
369
+ /**
370
+ * Back from a payment page and asking whether it was paid. While set, the
371
+ * drawer shows only this — never the checkout behind it: a form you can
372
+ * type into, and a "Betal" you can press, for a purchase that may already
373
+ * be paid (Angelo, 2026-10-08; Vipps can take two minutes to answer).
374
+ */
375
+ private verifyingReturn;
376
+ /** The checkout whose confirmation is on screen — see fillOrderNumber. */
377
+ private confirmedCheckoutId;
300
378
  /** Snapshot of the placed order, for the confirmation screen. */
301
379
  private confirmedOrder;
302
380
  /** Active Klarna Payments widget handle + the subtotal it was mounted for. */
@@ -315,22 +393,137 @@ declare class VioCheckout extends LitElement {
315
393
  /** Payment method names enabled for the sponsor (backend-configured).
316
394
  * null = not loaded yet → all buttons render; [] = none enabled. */
317
395
  private availableMethods;
396
+ private vippsOfficial;
318
397
  private kustomMounting;
398
+ /** The widget is being told about a cart change (suspend → sync → resume). */
399
+ private kustomSyncing;
400
+ /** What the widget shows: the rate picked inside it and its total (major). */
401
+ private kustomShipping;
402
+ private kustomTotal;
403
+ private kustomNotice;
404
+ /** The cart the mounted Kustom order describes — see kustomCartKey. */
405
+ private kustomMountedKey;
319
406
  private kustomMountedOrderId;
407
+ /** The checkout session (see embedSession) each embedded widget's order belongs to. */
408
+ private kustomMountedFor;
409
+ private qliroMountedFor;
410
+ private walleyMountedFor;
411
+ private nexiMountedFor;
320
412
  private qliroMounting;
321
413
  private qliroMountedOrderId;
322
414
  private walleyMounting;
323
415
  private walleyMountedOrderId;
416
+ private nexiMounting;
417
+ private nexiMountedOrderId;
418
+ /** What Nexi's shipping re-pricing last said, shown under the widget. */
419
+ private nexiShippingNotice;
420
+ /** Nexi's last re-pricing: the rate on the payment and the ones to pick from. */
421
+ private nexiShipping;
422
+ /** A picked rate is being pushed to the payment. */
423
+ private nexiPicking;
424
+ /** The Nexi payment to resume on the next mount — set only by the ?paymentId= return. */
425
+ private nexiResumePaymentId;
426
+ private adyenMounting;
427
+ /**
428
+ * The shopper ASKED for the payment step (chose the method, or pressed the
429
+ * panel's button). Adyen needs our form first, so nothing creates a session
430
+ * while they are still typing: a session is a photo of a finished form.
431
+ */
432
+ private adyenRequested;
433
+ /** Drop-in is on screen. */
434
+ private adyenMounted;
435
+ /** The form, the shipping or the cart changed under a mounted session. */
436
+ private adyenStale;
437
+ /** Paid or pending in this opening: never offer to pay again. */
438
+ private adyenSettled;
439
+ /** The checkout session (see embedSession) and the purchase the mounted photo is of. */
440
+ private adyenMountedFor;
441
+ private adyenMountedKey;
442
+ /**
443
+ * Which Stripe this channel offers: `native` pays with Stripe's Payment
444
+ * Element on THIS page, `link` sends the shopper to a page hosted by
445
+ * Stripe. It travels in the method's config and is resolved with the
446
+ * method list; null means "not known yet", and the pay button asks.
447
+ */
448
+ private stripeMode;
449
+ /** The shopper asked for the payment step (see adyenRequested). */
450
+ private stripeRequested;
451
+ private stripeMounting;
452
+ /** The Payment Element is on screen. */
453
+ private stripeMounted;
454
+ /** The form, the shipping or the cart changed under a mounted Element. */
455
+ private stripeStale;
456
+ /** Paid or pending in this opening: never offer to pay again. */
457
+ private stripeSettled;
458
+ /** Stripe is confirming right now — one press, not two. */
459
+ private stripePaying;
460
+ /** Stripe has PAINTED its form: until then the panel says it is loading. */
461
+ private stripeReady;
462
+ private stripeMountedFor;
463
+ private stripeMountedKey;
464
+ /** The checkout the mounted PaymentIntent pays for. */
465
+ private stripeCheckoutId;
466
+ private stripeElement;
467
+ /**
468
+ * The shipping the customer picked INSIDE the Qliro widget, as Qliro
469
+ * reports it. Qliro owns that choice in the modes where it shows a picker,
470
+ * so while Qliro is the method the summary follows it instead of our own
471
+ * preselected rate. Null until Qliro reports one — in `Vio rate as an order
472
+ * line` it never does, and our rate is the one Qliro charges.
473
+ */
474
+ private qliroShipping;
475
+ /**
476
+ * Set while this page load is showing the outcome of an embedded checkout's
477
+ * confirmation redirect (Kustom, Qliro, Walley). While set, nothing may start
478
+ * a new payment.
479
+ *
480
+ * The return handler selects the method so the panel has something to show,
481
+ * and only THEN asks the provider whether the order was paid. Selecting is a
482
+ * state change; the render it schedules runs `updated()` → `mount*IfNeeded()`
483
+ * long before the provider answers, and in a fresh page load there is no
484
+ * mounted order to stop it — so every return created a new backend checkout
485
+ * and a new provider order for a cart that had just been paid. Not a race
486
+ * that needs a slow network: a microtask always beats a round trip.
487
+ * Reproduced in `vio-checkout.return.dom.test.ts` before this existed.
488
+ *
489
+ * Cleared when the checkout closes: reopening it is a fresh checkout.
490
+ */
491
+ private returningFrom;
324
492
  /** Redirecting to the Stripe / Vipps hosted page. */
325
493
  private stripeLoading;
326
494
  private vippsLoading;
327
495
  private form;
328
496
  /** In-flight guard for loadAvailablePaymentMethods. */
329
497
  private loadingPaymentMethods;
498
+ /**
499
+ * Keyboard and focus while open: Escape closes — not while a payment is
500
+ * in flight — Tab stays inside, focus returns to the opener.
501
+ */
502
+ private readonly dialogFocus;
503
+ /** A payment is being started or confirmed right now: the overlay must not close under it. */
504
+ private get paymentInFlight();
505
+ /**
506
+ * Whether a load has COMPLETED, either way. `availableMethods === null`
507
+ * cannot tell "not asked yet" from "asked and failed", and rendering every
508
+ * button while we still do not know shows methods the channel may not have
509
+ * enabled — a shopper can click one that is not there.
510
+ */
511
+ private paymentMethodsResolved;
512
+ /** Guards `autoSelectSoleMethod` to ONE attempt per opening — see there. */
513
+ private autoSelectAttempted;
330
514
  /** In-flight + attempted guards for loadAvailableShippings (change events
331
515
  * fire per keystroke — without these, typing an address hammers the API). */
332
516
  private loadingShippings;
333
517
  private shippingsAttempted;
518
+ /**
519
+ * The cart's products cannot ship together (see `someLineShipsOnItsOwn`).
520
+ * While set, no payment can start and the payment step says why.
521
+ */
522
+ private shippingBlocked;
523
+ /** The opening whose shippings have been answered for — see
524
+ * `shippingsSettled`. */
525
+ private shippingsReadyFor;
526
+ private boundOnQliroEvent;
334
527
  private boundOnCheckoutChange;
335
528
  private boundOnPaymentComplete;
336
529
  private boundOnPaymentError;
@@ -346,6 +539,14 @@ declare class VioCheckout extends LitElement {
346
539
  private static readonly PAID_STATUSES;
347
540
  /** Statuses that mean the payment definitively did NOT go through. */
348
541
  private static readonly FAILED_STATUSES;
542
+ /**
543
+ * Shown instead of the payment step when the cart's products cannot ship
544
+ * together. Angelo, 2026-09-16: block the purchase rather than sell it
545
+ * without shipping, or with a rate that does not fit every product.
546
+ */
547
+ private static readonly SHIPPING_BLOCKED_MESSAGE;
548
+ /** The payment may or may not have gone through, and we could not find out. */
549
+ private static readonly RETURN_UNVERIFIED_MESSAGE;
349
550
  /** Waits between GetCheckout attempts — PSP webhooks (Vipps especially) can
350
551
  * land seconds after the shopper is redirected back, so a single immediate
351
552
  * check misreads a successful charge as unpaid. ~20s total. */
@@ -362,6 +563,8 @@ declare class VioCheckout extends LitElement {
362
563
  * anything else (including an unrecognized state) is treated as failed —
363
564
  * fail-closed by default rather than guessing.
364
565
  */
566
+ /** Vipps' own button when its script answers; our orange one otherwise. */
567
+ private loadVippsButton;
365
568
  private pollVippsStatus;
366
569
  /** Shared outcome handler for both the generic (GetCheckout) and the
367
570
  * Vipps-specific (GetVippsStatus) return-verification paths. */
@@ -373,16 +576,55 @@ declare class VioCheckout extends LitElement {
373
576
  updated(changed: Map<string, unknown>): void;
374
577
  close(): void;
375
578
  show(): void;
376
- /** Fetch the real per-supplier shippings and preselect + persist the first. */
579
+ /**
580
+ * Fetch the real per-supplier shippings and preselect + persist the first.
581
+ *
582
+ * Also decides whether the cart can ship at all (`shippingBlocked`), and
583
+ * records which opening the answer belongs to (`shippingsReadyFor`).
584
+ */
377
585
  private loadAvailableShippings;
586
+ /**
587
+ * Whether some product in the cart has shipping rates of its own. With no
588
+ * rate shared by all of them, that means they cannot ship TOGETHER. A cart
589
+ * where no line has rates is left alone: digital products have none, and
590
+ * shopcart refuses the physical case on its side.
591
+ */
592
+ private someLineShipsOnItsOwn;
378
593
  /** Whether all mandatory Leveringsadresse fields are filled. */
379
594
  private get isAddressValid();
380
595
  /** Whether a valid shipping option is selected (when shippings exist). */
381
596
  private get hasSelectedShipping();
382
597
  /** Which payment buttons to render — backend-configured per sponsor. */
383
598
  private loadAvailablePaymentMethods;
599
+ /**
600
+ * With exactly one payment method there is no choice to make, so making the
601
+ * shopper click it is a step that can only have one outcome. Select it —
602
+ * and since the checkout asks for the method first (2026-09-22), this is
603
+ * what skips that step: the form, or the provider's widget, comes straight
604
+ * up.
605
+ *
606
+ * Deliberately narrow:
607
+ * - never overrides a method the shopper already picked;
608
+ * - only for methods usable RIGHT NOW — Apple Pay and Klarna depend on the
609
+ * browser and on their script loading, and auto-selecting an unusable one
610
+ * would strand the shopper on a panel that cannot pay (see `updated`: a
611
+ * late "available" gets one more try);
612
+ * - selecting never pays: Stripe and Vipps still wait for their own button.
613
+ */
614
+ private autoSelectSoleMethod;
384
615
  /** Backend names arrive as e.g. "Apple Pay" — compare letters only. */
385
616
  private methodEnabled;
617
+ /**
618
+ * Stripe's Payment Element shows the wallets of the account that charges —
619
+ * Apple Pay and Google Pay among them. Offering our own Apple Pay button
620
+ * next to it is the same wallet twice, on the same screen, paying through
621
+ * the same account: when Stripe pays on our page, Stripe owns the wallets
622
+ * (Angelo, 2026-09-24). The cart's express button is another surface and
623
+ * keeps its own Apple Pay — the Element does not exist there.
624
+ */
625
+ private stripeOwnsWallets;
626
+ /** The methods the shopper actually sees (see stripeOwnsWallets). */
627
+ private offeredMethods;
386
628
  private refreshApplePay;
387
629
  private refreshKlarna;
388
630
  /** Mount (or re-mount on amount change) the Klarna Payments widget. */
@@ -400,6 +642,17 @@ declare class VioCheckout extends LitElement {
400
642
  /** Authorize the selected Klarna method → backend creates the order. */
401
643
  private onKlarnaAuthorize;
402
644
  private onFieldChange;
645
+ /** After choosing a method that needs our form, bring the form into view. */
646
+ private revealAddressForm;
647
+ /**
648
+ * Vipps from the checkout: Express when the channel allows it, so the
649
+ * shopper picks the delivery inside the app — our rate on the cart is the
650
+ * one preselected there — and never silently keeps the default our form
651
+ * chose for them. When the cart cannot have Express (several suppliers)
652
+ * the backend says so without creating a payment, and the plain payment
653
+ * follows: profile shared, the rate already on the cart.
654
+ */
655
+ private startVippsFromCheckout;
403
656
  private onApplePay;
404
657
  private onPay;
405
658
  /**
@@ -415,6 +668,16 @@ declare class VioCheckout extends LitElement {
415
668
  * paid sponsor's cart so the badge + drawer reflect the purchase.
416
669
  */
417
670
  private confirmOrder;
671
+ /** Waits between asks for the Vio order number: the order is often born a
672
+ * moment after the payment (Vipps and Stripe through their webhook). */
673
+ private static readonly ORDER_NUMBER_DELAYS_MS;
674
+ /**
675
+ * Puts the Vio order number (#4497) on the confirmation once the order
676
+ * exists. Until then the line is simply not there — never the checkout's
677
+ * uuid in its place, which is what it used to print. Stops if the shopper
678
+ * closes the drawer or another confirmation takes its place.
679
+ */
680
+ private fillOrderNumber;
418
681
  private methodLabel;
419
682
  /** True for methods that complete via a separate sheet/widget, not the CTA. */
420
683
  private isExpressMethod;
@@ -423,13 +686,84 @@ declare class VioCheckout extends LitElement {
423
686
  * express always has one; the normal flow has one once the backend
424
687
  * shippings loaded (the choice IS persisted on the cart and charged). */
425
688
  private shippingMajor;
689
+ /** The rate the summary names — Qliro's own pick while Qliro is the method. */
690
+ private summaryShippingName;
426
691
  /** Total to charge — items + shipping (express). */
427
692
  private payTotalLabel;
428
693
  render(): lit_html.TemplateResult<1>;
694
+ /**
695
+ * The provider's receipt on its own. It must not depend on the cart: the
696
+ * payment step is rendered from the cart, and clearing the cart after a
697
+ * purchase is what took Qliro's receipt away on 2026-09-08 and brought back
698
+ * "how do you want to pay". The provider's container lives in the light DOM
699
+ * and is projected here, untouched.
700
+ */
701
+ private renderProviderReceipt;
702
+ /**
703
+ * A completed purchase whose receipt the PROVIDER shows. Same side effects as
704
+ * confirmOrder — `vio:payment-success` for the host and analytics, the
705
+ * sponsor's cart cleared — but the screen is the provider's receipt, not our
706
+ * "Takk!": two receipts for one purchase is one too many.
707
+ */
708
+ private showProviderReceipt;
709
+ /** Back from the payment page, asking whether it was paid — and nothing
710
+ * else on screen while we do. */
711
+ private renderVerifying;
429
712
  private renderConfirmation;
713
+ /**
714
+ * Whether mounting an embedded checkout now would be starting a payment the
715
+ * shopper asked for. Mounting CREATES an order at the provider (and a backend
716
+ * checkout if there is none), so it must not happen on a confirmation return,
717
+ * once this checkout's order is confirmed, or for a cart that cannot ship.
718
+ */
719
+ private mayStartEmbeddedPayment;
720
+ /**
721
+ * Whether we know enough about shipping to create an order. The provider
722
+ * prices the order when it is created, so a first opening waits for the
723
+ * shippings to answer: the cart may turn out unable to ship at all. A list
724
+ * already on screen counts, and a later answer that blocks the cart takes
725
+ * the widget down again (see `updated`).
726
+ */
727
+ private shippingsSettled;
728
+ /** Why nothing can be paid: the cart's products cannot ship together. */
729
+ private renderShippingBlocked;
730
+ /**
731
+ * The checkout an embedded widget's order belongs to. Kustom, Qliro and
732
+ * Walley price the order when it is created, so a widget kept into a NEW
733
+ * checkout shows — and charges — the cart it was created for.
734
+ *
735
+ * Closing drops the widgets, but a checkout can start again without a
736
+ * close: in Vev the cart view opens on top of the checkout and "Til kassen"
737
+ * calls `Vio.checkout.open()` again (Angelo, 2026-09-14: quantities raised
738
+ * in the cart view, Qliro kept the old total). Every `open()` is a new
739
+ * session, so a widget from an earlier one starts over.
740
+ *
741
+ * 0.11.3 compared the cart LINES instead, and that was wrong: within one
742
+ * session the backend rewrites them (saving the shipping re-reads the cart),
743
+ * so the first Qliro event after that — the customer picking a shipping —
744
+ * tore the widget down mid-purchase (Alan, 2026-09-14). The session does
745
+ * not change under the customer's hands.
746
+ */
747
+ private embedSession;
430
748
  /** Klarna Payments widget panel: shipping + category chips + widget + pay button. */
749
+ /**
750
+ * The cart a Kustom order describes. When it changes under a mounted
751
+ * widget, the order is UPDATED in place (Kustom's rule) — see
752
+ * syncKustomIfStale. The order is a photo of the lines, not of the form:
753
+ * address and shipping live inside the widget.
754
+ */
755
+ private kustomCartKey;
431
756
  /** Mount the Kustom embedded checkout once it's the chosen method. */
432
757
  private mountKustomIfNeeded;
758
+ /** What the widget tells us, kept only to show — never acted on server-side. */
759
+ private kustomHandlers;
760
+ /**
761
+ * The cart changed under a mounted Kustom widget: suspend it, push the
762
+ * cart into the same order, resume it. Never a second order, never a
763
+ * widget showing a total the backend will not charge (the validation
764
+ * callback would refuse it). A failed sync takes the widget down.
765
+ */
766
+ private syncKustomIfStale;
433
767
  private unmountKustom;
434
768
  private renderKustomPanel;
435
769
  /** Mount the Qliro embedded checkout once it's the chosen method. */
@@ -458,6 +792,67 @@ declare class VioCheckout extends LitElement {
458
792
  private mountWalleyIfNeeded;
459
793
  private unmountWalley;
460
794
  private renderWalleyPanel;
795
+ /**
796
+ * Mount the Nexi embedded checkout once it's the chosen method. Nexi's own
797
+ * JS SDK renders into a LIGHT-DOM container (it refuses a shadow root);
798
+ * completion is its `payment-completed` event — Nexi neither redirects nor
799
+ * shows a receipt, so success lands in Vio's confirmation drawer. Shipping
800
+ * is re-priced on `address-changed` (see the manager).
801
+ */
802
+ private mountNexiIfNeeded;
803
+ /** payment-completed: the reservation exists — confirm like the redirect methods do. */
804
+ private onNexiCompleted;
805
+ /**
806
+ * How it was paid and where the receipt goes — Nexi knows, we ask. Its
807
+ * payment details can lag the completion event by a moment, hence the
808
+ * few retries. Best effort: the confirmation stands without them.
809
+ */
810
+ private addNexiPaymentDetails;
811
+ private static readonly NEXI_DETAILS_DELAYS_MS;
812
+ private unmountNexi;
813
+ /**
814
+ * Nexi has no shipping picker: once an address is typed in the widget, the
815
+ * rates that reach it are listed here and the pick is pushed to the payment.
816
+ * With a single rate there is nothing to choose, so nothing is shown.
817
+ */
818
+ private renderNexiShippingChoice;
819
+ private onPickNexiShipping;
820
+ /**
821
+ * What an embedded payment is a photo OF — an Adyen session, a Stripe
822
+ * PaymentIntent. When any of it changes underneath, that photo no longer
823
+ * describes the purchase: it is dropped, and the shopper asks for the
824
+ * payment step again.
825
+ */
826
+ private embedPurchaseKey;
827
+ /** The part of the photo the shopper types and picks. */
828
+ private embedFormKey;
829
+ /** A mounted session whose purchase changed is taken down — never patched. */
830
+ private dropStaleAdyen;
831
+ private mountAdyenIfNeeded;
832
+ private onAdyenCompleted;
833
+ /** What Adyen told us about the payment, on Vio's confirmation. */
834
+ private addAdyenPaymentDetails;
835
+ private unmountAdyen;
836
+ private renderAdyenPanel;
837
+ /** A mounted Element whose purchase changed is taken down — never patched. */
838
+ private dropStaleStripe;
839
+ private mountStripeIfNeeded;
840
+ /**
841
+ * Pay with the mounted Element. Stripe answers the BROWSER; the order is
842
+ * created server-side by the `payment_intent.succeeded` webhook, so a
843
+ * success is then waited for on the checkout itself.
844
+ */
845
+ private onStripePay;
846
+ /**
847
+ * Wait for Stripe's webhook to make the checkout paid — the same window the
848
+ * redirect return uses, and ONLY the status: a Stripe checkout carries
849
+ * `origin_payment_id` from the moment the intent is created, so that
850
+ * pointer would read as paid before anyone paid.
851
+ */
852
+ private waitForStripeOrder;
853
+ private unmountStripe;
854
+ private renderStripePanel;
855
+ private renderNexiPanel;
461
856
  private renderKlarnaPanel;
462
857
  /** Express layout — only the Klarna widget + a compact order summary. */
463
858
  private renderKlarnaExpress;
@@ -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-D6PBisUm.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-Dkbfcd1L.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-7TGCXO5J.js';
2
- export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-7TGCXO5J.js';
3
- import '../chunk-TJ43TE7H.js';
1
+ import { registerVioElements } from '../chunk-MRJR6DG5.js';
2
+ export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-MRJR6DG5.js';
3
+ import '../chunk-WTVGVDZX.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.11.1",
3
+ "version": "0.21.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",
@@ -57,6 +57,7 @@
57
57
  "@lit/react": "^1.0.8",
58
58
  "@types/node": "^22.10.0",
59
59
  "@types/react": "^19.2.17",
60
+ "jsdom": "^25.0.1",
60
61
  "tsup": "^8.5.1",
61
62
  "typescript": "^5.6.3",
62
63
  "vite": "^6.0.0",