@vio-live/web-sdk 0.33.0 → 0.36.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,6 +1,7 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement } from 'lit';
4
+ import { D as DetailLayout, A as AppliedDetailLayout } from './detail-layout-BI556w8p.js';
4
5
 
5
6
  declare class VioProduct extends LitElement {
6
7
  /** Brand label shown at the top (uppercase, gray, small). */
@@ -302,6 +303,15 @@ declare class VioProductDetail extends LitElement {
302
303
  * say). Off by default: the toast shows.
303
304
  */
304
305
  noAddedToast: boolean;
306
+ /**
307
+ * «Kjøp nå med Vipps» when the brand's cart already has lines: `express`
308
+ * (default) adds the product and pays the WHOLE cart with Vipps Express —
309
+ * the line under the button says how many items and what total — or
310
+ * `checkout`: adds it and opens our checkout with Vipps preselected (as in
311
+ * 0.31–0.34). An empty cart is Express either way. Unset = the theme's
312
+ * `vippsCartPayment` (`--vio-vipps-cart-payment`).
313
+ */
314
+ vippsCartPayment: string;
305
315
  /**
306
316
  * How the images show: `thumbs` (one image, thumbnails under it — the
307
317
  * default) or `carousel` (every image in one swipeable row, no thumbnails:
@@ -315,6 +325,11 @@ declare class VioProductDetail extends LitElement {
315
325
  * Unset = the theme's `detailDescriptionMode` (`--vio-detail-description-mode`).
316
326
  */
317
327
  descriptionMode: string;
328
+ /**
329
+ * Heading of the description fold (default «Beskrivelse»), e.g.
330
+ * «Produktbeskrivelse». Unset = the page's `Vio.configureDetail({ descriptionLabel })`.
331
+ */
332
+ descriptionLabel: string;
318
333
  /**
319
334
  * The brand's promises, shown in a row under the buy zone. By default the
320
335
  * brand's own (dashboard Settings → Brand, in the bootstrap); this list
@@ -336,6 +351,26 @@ declare class VioProductDetail extends LitElement {
336
351
  * Commerce (which wins). A carrier with neither gets the line icon.
337
352
  */
338
353
  carrierLogos: Record<string, string>;
354
+ /**
355
+ * The order of the sections below the gallery (0.34): `{ id, revision,
356
+ * sections, experimentId?, variantId? }` (attribute: the same as JSON). Wins
357
+ * over `Vio.configureDetail({ layout })`; unset = the page's, else the
358
+ * default. Section ids: `brand`, `title`, `stock`, `price`, `options`,
359
+ * `purchase`, `highlights`, `description`, `shippingReturns`. See README
360
+ * «Section order and layout tracking».
361
+ */
362
+ layout: DetailLayout | null;
363
+ /** The layout the detail renders with now (resolved before each render). */
364
+ private layoutNow;
365
+ /** The product and layout `vio:detail-layout-applied` was last said for. */
366
+ private appliedFor;
367
+ private unsubscribeLayout;
368
+ /**
369
+ * The layout this detail applies (0.34): `{ id, revision, experimentId?,
370
+ * variantId?, sections, adjusted, source }` — `source` is `element` (its own
371
+ * `layout`), `global` (`Vio.configureDetail`) or `default`. A copy.
372
+ */
373
+ get appliedLayout(): AppliedDetailLayout;
339
374
  private readonly slotRegistration;
340
375
  /** What the click that opened the detail carried ('' when nothing), and for which product. */
341
376
  private eventSlot;
@@ -448,11 +483,19 @@ declare class VioProductDetail extends LitElement {
448
483
  /** Phones: the page behind is locked, and the sheet closes by pulling the bar or the top bar down. */
449
484
  private readonly bottomSheet;
450
485
  private boundProductClick;
451
- static styles: lit.CSSResult;
486
+ static styles: lit.CSSResult[];
487
+ /** The cart changed (another tab, the drawer): the line under Vipps counts it again. */
488
+ private boundCartChange;
452
489
  connectedCallback(): void;
453
490
  disconnectedCallback(): void;
454
491
  updated(changed: Map<string, unknown>): void;
455
492
  willUpdate(changed: Map<string, unknown>): void;
493
+ /**
494
+ * `vio:detail-layout-applied` (bubbles, composed), with the applied layout,
495
+ * each time a product renders with a layout it has not been shown with yet:
496
+ * every open of a product, and every change of layout while it is open.
497
+ */
498
+ private announceLayout;
456
499
  /** An option as the element says it, else as the theme's custom property says it (lower case, unquoted). */
457
500
  private themeChoice;
458
501
  /** The attribute wins; else the theme's `--vio-detail-gallery`; else thumbnails. */
@@ -592,11 +635,24 @@ declare class VioProductDetail extends LitElement {
592
635
  private loadVippsButton;
593
636
  private buyWithVipps;
594
637
  /**
595
- * The Vipps button will open the app with Express (see buyWithVipps): the
596
- * brand has Express on, and this brand's cart is empty — with lines in it
597
- * the checkout opens first.
638
+ * The Vipps button will open the app with Express for this product alone
639
+ * (see buyWithVipps): the brand has Express on, and this brand's cart is
640
+ * empty.
598
641
  */
599
642
  private vippsGoesStraightToApp;
643
+ /** This brand's cart already has lines. */
644
+ private cartHasLines;
645
+ /** `vipps-cart-payment`, else the theme's, else `express`. */
646
+ private vippsCartMode;
647
+ /**
648
+ * What the Vipps button will pay when the brand's cart already has lines
649
+ * (`express` mode): every unit in the cart plus this product at the chosen
650
+ * quantity, and their total, as the cart sums it (shipping is chosen in
651
+ * Vipps). null with an empty cart, or in `checkout` mode.
652
+ */
653
+ private wholeCartToPay;
654
+ /** The line under the Vipps button: what is paid (a cart with lines) or what happens in the app (Express, empty cart). */
655
+ private renderVippsNote;
600
656
  private startVippsExpressOrCheckout;
601
657
  /** The ordinary way in, Vipps preselected: the host opens the checkout on `vio:checkout-open`. */
602
658
  private openCheckoutWithVipps;
@@ -616,8 +672,8 @@ declare class VioProductDetail extends LitElement {
616
672
  * after an await, so it cannot wait for the server's cart), while the
617
673
  * charge is the sponsor's WHOLE cart. So the sheet opens only when it shows
618
674
  * what will be charged: an empty cart, and a sheet prepared for this
619
- * product × quantity. Otherwise — lines already in the cart (as with Vipps,
620
- * see buyWithVipps), or a quantity whose sheet is still being prepared —
675
+ * product × quantity. Otherwise — lines already in the cart, or a quantity
676
+ * whose sheet is still being prepared —
621
677
  * the product is added and the checkout opens with Apple Pay preselected:
622
678
  * every line and the total on screen, and its own Apple Pay button pays
623
679
  * that total.
@@ -640,6 +696,8 @@ declare class VioProductDetail extends LitElement {
640
696
  * the heading, the text or «Les mer» opens the rest (Angelo, 2026-10-28).
641
697
  * A description that fits in the preview has nothing to open.
642
698
  */
699
+ /** The description fold's heading: this element's, else the page's, else «Beskrivelse». */
700
+ private descriptionHeading;
643
701
  private renderDescription;
644
702
  /** Is the preview hiding part of the text? Measured with the preview applied. */
645
703
  private measureDescription;
@@ -674,6 +732,31 @@ declare class VioProductDetail extends LitElement {
674
732
  private measureLogo;
675
733
  render(): lit_html.TemplateResult<1>;
676
734
  private renderBody;
735
+ /**
736
+ * The info column in the applied layout's order (0.34) — the real DOM in
737
+ * that order, never CSS `order`, the same on every screen. The default
738
+ * order renders exactly the column before 0.34: brand, `.headline` (the
739
+ * title row with the stock, the price row), then `.purchase` — `.buy` with
740
+ * the options first — and highlights, description, «Frakt & retur» in it.
741
+ *
742
+ * A run of `title` / `stock` / `price` is one `.headline`; `title`
743
+ * right before `stock` share the title row. `options` right before
744
+ * `purchase` live in `.buy` (a pinned buy zone keeps them); elsewhere they
745
+ * are a block of their own. Everything after `purchase` goes in
746
+ * `.purchase`, as the description does by default: a pinned buy zone may
747
+ * slide over it, never over what comes before.
748
+ */
749
+ private renderSections;
750
+ /** A run of title / stock / price: one `.headline`. */
751
+ private renderHeadline;
752
+ /** One section that is not the headline nor the purchase group. */
753
+ private renderSection;
754
+ /**
755
+ * The SDK-managed buy group, never split: «Frakt fra…», Vipps / Apple Pay /
756
+ * the other ways to pay, quantity + «Legg i handlekurv», «Du handler direkte
757
+ * hos …». The options when they come right before it; then what follows it.
758
+ */
759
+ private renderPurchase;
677
760
  private renderOptionPickers;
678
761
  /** Best-effort HTML strip for description. */
679
762
  private stripHtml;
@@ -690,6 +773,13 @@ declare class VioCart extends LitElement {
690
773
  heading: string;
691
774
  emptyLabel: string;
692
775
  subtotalLabel: string;
776
+ /**
777
+ * What the Vipps button does: `express` (default) — Vipps Express for the
778
+ * sponsor's whole cart, straight to the app — or `checkout` — our checkout
779
+ * with Vipps preselected (`vio:checkout-open`, as in 0.31–0.34). Unset =
780
+ * the theme's `vippsCartPayment` (`--vio-vipps-cart-payment`).
781
+ */
782
+ vippsCartPayment: string;
693
783
  private carts;
694
784
  private itemCount;
695
785
  /** True when Apple Pay is usable (Safari + device + Stripe configured). */
@@ -700,6 +790,8 @@ declare class VioCart extends LitElement {
700
790
  /** Asking for the brand's methods: a neutral placeholder instead of every method's button (see methodEnabled). */
701
791
  private methodsLoading;
702
792
  private vippsOfficial;
793
+ /** A Vipps payment is being started from here: one at a time. */
794
+ private vippsStarting;
703
795
  /** Whether the method lookup has been attempted — see boundOnCartChange. */
704
796
  private paymentMethodsAttempted;
705
797
  /** Set after an Apple Pay express purchase — switches the drawer to the
@@ -716,7 +808,7 @@ declare class VioCart extends LitElement {
716
808
  /** Phones: the page behind is locked, and the sheet closes by pulling the bar or the header down. */
717
809
  private readonly bottomSheet;
718
810
  private boundOnCartChange;
719
- static styles: lit.CSSResult;
811
+ static styles: lit.CSSResult[];
720
812
  connectedCallback(): void;
721
813
  disconnectedCallback(): void;
722
814
  close(): void;
@@ -744,7 +836,6 @@ declare class VioCart extends LitElement {
744
836
  * (betalingsmetode). The host's checkout-open handler closes this cart and
745
837
  * opens <vio-checkout> in express mode with Klarna preselected. */
746
838
  private onKlarnaExpress;
747
- /** Vipps — opens the checkout with Vipps preselected. */
748
839
  /**
749
840
  * Open the checkout without preselecting a method.
750
841
  *
@@ -755,13 +846,27 @@ declare class VioCart extends LitElement {
755
846
  */
756
847
  private onCheckout;
757
848
  /**
758
- * Vipps from the cart: the checkout opens with Vipps preselected — the
759
- * standard path, where our form collects name, address, mobile and the
760
- * delivery (with its price) before paying (Mote & Livsstil, 2026-10-28).
761
- * It no longer starts Express from here: Express is the product detail's
762
- * «Kjøp nå med Vipps» only.
849
+ * Vipps from the cart (2026-10-29: «el botón negro va con el nuestro y el
850
+ * botón de Vipps paga el carrito entero»): Vipps Express for the sponsor's
851
+ * WHOLE cart — the same Express as the detail's «Kjøp nå med Vipps»: the
852
+ * hand-over overlay, `vio:payment-redirect-*` with source `'cart'`, the
853
+ * return and its confirmation. «Til kassen» is the way into our checkout.
854
+ * When the brand has Express off, or this cart cannot have it (several
855
+ * suppliers, no rate), the checkout opens with Vipps preselected.
856
+ *
857
+ * `vipps-cart-payment="checkout"` keeps the 0.31–0.34 behaviour: the
858
+ * checkout opens with Vipps preselected, the standard payment.
763
859
  */
764
860
  private onVipps;
861
+ /**
862
+ * The one sponsor whose cart the Vipps button pays: the first with
863
+ * something to pay for. Express is built on THAT sponsor's backend cart
864
+ * only — another sponsor's lines are never in it.
865
+ */
866
+ private vippsSponsorId;
867
+ private startVippsExpressOrCheckout;
868
+ /** Our checkout with Vipps preselected: the host opens it on `vio:checkout-open`. */
869
+ private openCheckoutWithVipps;
765
870
  /** Vipps' own button when its script answers; our orange one otherwise. */
766
871
  private loadVippsButton;
767
872
  /** Stripe — opens the checkout with Stripe preselected. */
@@ -783,6 +888,12 @@ declare class VioCart extends LitElement {
783
888
  private onDecrement;
784
889
  private onRemove;
785
890
  render(): lit_html.TemplateResult<1>;
891
+ /**
892
+ * The selling brand's promises under the ways to pay, as in the product
893
+ * detail (one article = one brand: the cart's brand). Hidden with the theme's
894
+ * `cartHighlightsDisplay: 'none'`; nothing when the brand has none.
895
+ */
896
+ private renderBrandHighlights;
786
897
  /** «Frakt» (the chosen or cheapest rate) and «Totalt» with it; «Beregnes i kassen» when unknown. */
787
898
  private renderShippingRows;
788
899
  private renderConfirmation;
@@ -1595,6 +1706,8 @@ interface VioThemeOverrides {
1595
1706
  detailHighlightsDisplay?: string;
1596
1707
  /** «Frakt & retur» in the detail: `block` (default) or `none` (hidden). */
1597
1708
  detailShippingReturnsDisplay?: string;
1709
+ /** The brand's promises in the cart, under the ways to pay: `grid` (default, shown when the brand has some) or `none`. */
1710
+ cartHighlightsDisplay?: string;
1598
1711
  /** `<vio-product-carousel>`: `carousel` (default, one row) or `list` (cards one under the other). Its `layout` attribute wins. */
1599
1712
  carouselLayout?: string;
1600
1713
  /** Thumbnail size (default `64px`). One row, scrolls sideways. */
@@ -1659,6 +1772,13 @@ interface VioThemeOverrides {
1659
1772
  redirectBg?: string;
1660
1773
  /** Spinner colour of that overlay (default Vipps orange). */
1661
1774
  redirectSpinner?: string;
1775
+ /**
1776
+ * What the Vipps button pays when the cart has lines: `express` (default —
1777
+ * Vipps Express for the sponsor's whole cart, from `<vio-cart>` and from
1778
+ * `<vio-product-detail>`) or `checkout` (opens our checkout with Vipps
1779
+ * preselected, as in 0.31–0.34). An element's `vipps-cart-payment` wins.
1780
+ */
1781
+ vippsCartPayment?: 'express' | 'checkout' | string;
1662
1782
  }
1663
1783
  /**
1664
1784
  * Apply (or clear) theme overrides. Pass `null`/`undefined` for a key to
@@ -1,6 +1,7 @@
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-B7GVA_qB.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-BGzSC3vK.js';
2
2
  import 'lit-html';
3
3
  import 'lit';
4
+ import '../detail-layout-BI556w8p.js';
4
5
 
5
6
  /**
6
7
  * Vio elements — owns the `<vio-*>` custom-element classes and their registration.
package/dist/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { registerVioElements } from '../chunk-T5B74YBQ.js';
2
- export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-T5B74YBQ.js';
3
- import '../chunk-ZORYG4W3.js';
1
+ import { registerVioElements } from '../chunk-DEREQRCM.js';
2
+ export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-DEREQRCM.js';
3
+ import '../chunk-6PQFXUOW.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.33.0",
3
+ "version": "0.36.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",
@@ -1,3 +0,0 @@
1
-
2
- //# sourceMappingURL=chunk-QGJUBVH3.js.map
3
- //# sourceMappingURL=chunk-QGJUBVH3.js.map