@vio-live/web-sdk 0.33.0 → 0.35.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.
- package/CHANGELOG.md +75 -0
- package/README.md +137 -13
- package/dist/chunk-3YFJFDSN.js +3 -0
- package/dist/{chunk-QGJUBVH3.js.map → chunk-3YFJFDSN.js.map} +1 -1
- package/dist/{chunk-T5B74YBQ.js → chunk-F7LE5AZY.js} +315 -51
- package/dist/chunk-F7LE5AZY.js.map +1 -0
- package/dist/{chunk-ZORYG4W3.js → chunk-QA5R4VYF.js} +279 -40
- package/dist/chunk-QA5R4VYF.js.map +1 -0
- package/dist/core/index.d.ts +64 -3
- package/dist/core/index.js +2 -2
- package/dist/detail-layout-BI556w8p.d.ts +76 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.js +5 -4
- package/dist/react/index.js.map +1 -1
- package/dist/{tokens-B7GVA_qB.d.ts → tokens-C-LsqKQH.d.ts} +116 -11
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-QGJUBVH3.js +0 -3
- package/dist/chunk-T5B74YBQ.js.map +0 -1
- package/dist/chunk-ZORYG4W3.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/tokens.ts","../src/ui/slot-registration.ts","../src/ui/components/vio-product.ts","../src/ui/sponsor-identity.ts","../src/ui/components/vio-product-carousel.ts","../src/ui/payment-redirect.ts","../src/ui/vipps-cart-payment.ts","../src/core/checkout/method-taxonomy.ts","../src/ui/dialog-focus.ts","../src/ui/bottom-sheet.ts","../src/ui/components/vio-product-detail.ts","../src/ui/components/vio-cart.ts","../src/ui/checkout-errors.ts","../src/ui/components/vio-checkout.ts","../src/ui/elements.ts"],"names":["campaignCandidates","html","LitElement","css","sponsorId","property","state","v","nothing","current","STRIPE_LOGO_SRC","EM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E,OAAO,mBAAmB,WAAA,IAC1B,OAAO,eAAe,GAAA,KAAQ,UAAA,IAC9B,OAAO,cAAA,CAAe,MAAA,KAAW,UAAA;AAEjC,IAAA;AACF,EAAA,MAAM,IAAA,GAAkD;AAAA,IACtD,CAAC,eAAe,UAAU,CAAA;AAAA,IAC1B,CAAC,wBAAwB,kBAAkB,CAAA;AAAA,IAC3C,CAAC,sBAAsB,gBAAgB,CAAA;AAAA,IACvC,CAAC,YAAY,OAAO,CAAA;AAAA,IACpB,CAAC,gBAAgB,WAAW;AAAA,GAC9B;AACA,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,IAAI,CAAA,IAAK,IAAA,EAAM;AAC9B,IAAA,IAAI,CAAC,eAAe,GAAA,CAAI,GAAG,GAAG,cAAA,CAAe,MAAA,CAAO,KAAK,IAAI,CAAA;AAAA,EAC/D;AACF","file":"chunk-F7LE5AZY.js","sourcesContent":["/**\n * Vio Design Tokens — editorial commerce aesthetic.\n *\n * Extracted from the Allermedia \"Mote & Livsstil\" reference (the target\n * pilot site). Mood: Vogue-like fashion magazine — serif headlines,\n * sans-serif body, near-monochrome palette, terracotta accent for\n * editorial labels (\"REDAKSJONENS FAVORITTER\").\n *\n * Tokens are exposed both as a typed TS object (`VioTokens`) and as\n * CSS custom properties on `:root` (auto-injected when this module is\n * imported in a browser). Consumers can override individual variables\n * to re-skin without touching SDK source.\n */\n\nexport const VioTokens = {\n color: {\n text: {\n primary: '#0a0a0a',\n secondary: '#666666',\n tertiary: '#999999',\n onPrimary: '#ffffff',\n },\n accent: {\n editorial: '#c14a3b', // \"REDAKSJONENS FAVORITTER\" red\n },\n surface: {\n base: '#ffffff',\n muted: '#f2f2f2', // product image background\n hover: '#fafafa',\n },\n border: {\n subtle: '#e5e5e5',\n default: '#cccccc',\n },\n },\n font: {\n serif: '\"Tinos\", \"Playfair Display\", Georgia, serif',\n sans: '\"Inter\", -apple-system, \"Helvetica Neue\", Arial, sans-serif',\n },\n size: {\n xs: '12px',\n sm: '14px',\n md: '16px',\n lg: '20px',\n xl: '24px',\n '2xl': '32px',\n '3xl': '40px',\n },\n weight: {\n regular: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n tracking: {\n label: '0.1em', // uppercase labels (BRAND, RETAILER, REDAKSJONENS FAVORITTER)\n title: '0',\n },\n lineHeight: {\n tight: 1.1,\n snug: 1.3,\n normal: 1.5,\n },\n space: {\n xs: '4px',\n sm: '8px',\n md: '16px',\n lg: '24px',\n xl: '32px',\n '2xl': '48px',\n '3xl': '64px',\n },\n radius: {\n none: '0',\n sm: '2px',\n md: '4px',\n lg: '8px',\n /** Sheet/drawer corners — the largest surface radius in the checkout. */\n xl: '16px',\n full: '9999px',\n },\n} as const\n\n/**\n * CSS Custom Properties — generated from VioTokens. Injected once into\n * the document head on first import. Consumers can override any\n * `--vio-*` var on their root or component selector to customise.\n */\nconst VIO_TOKENS_CSS = `\n :root {\n /* color — text */\n --vio-color-text: ${VioTokens.color.text.primary};\n --vio-color-text-secondary: ${VioTokens.color.text.secondary};\n --vio-color-text-tertiary: ${VioTokens.color.text.tertiary};\n --vio-color-text-on-primary:${VioTokens.color.text.onPrimary};\n\n /* color — accent */\n --vio-color-accent: ${VioTokens.color.accent.editorial};\n\n /* color — surface */\n --vio-color-surface: ${VioTokens.color.surface.base};\n --vio-color-surface-muted: ${VioTokens.color.surface.muted};\n --vio-color-surface-hover: ${VioTokens.color.surface.hover};\n\n /* color — border */\n --vio-color-border: ${VioTokens.color.border.subtle};\n --vio-color-border-default: ${VioTokens.color.border.default};\n\n /* font */\n --vio-font-serif: ${VioTokens.font.serif};\n --vio-font-sans: ${VioTokens.font.sans};\n\n /* size */\n --vio-size-xs: ${VioTokens.size.xs};\n --vio-size-sm: ${VioTokens.size.sm};\n --vio-size-md: ${VioTokens.size.md};\n --vio-size-lg: ${VioTokens.size.lg};\n --vio-size-xl: ${VioTokens.size.xl};\n\n /* tracking (uppercase letterspacing) */\n --vio-tracking-label: ${VioTokens.tracking.label};\n\n /* space */\n --vio-space-xs: ${VioTokens.space.xs};\n --vio-space-sm: ${VioTokens.space.sm};\n --vio-space-md: ${VioTokens.space.md};\n --vio-space-lg: ${VioTokens.space.lg};\n --vio-space-xl: ${VioTokens.space.xl};\n\n /* radius */\n --vio-radius-sm: ${VioTokens.radius.sm};\n --vio-radius-md: ${VioTokens.radius.md};\n --vio-radius-lg: ${VioTokens.radius.lg};\n --vio-radius-xl: ${VioTokens.radius.xl};\n }\n`\n\nfunction injectTokens(): void {\n if (typeof document === 'undefined') return\n if (document.querySelector('style[data-vio=\"tokens\"]') !== null) return\n const style = document.createElement('style')\n style.setAttribute('data-vio', 'tokens')\n style.textContent = VIO_TOKENS_CSS\n document.head.appendChild(style)\n}\n\ninjectTokens()\n\n/**\n * Theming — override design tokens without touching SDK source.\n *\n * Every `<vio-*>` component reads colors/fonts via `var(--vio-color-accent,\n * …)` etc. (shadow DOM inherits CSS custom properties from the light DOM,\n * so this reaches every component including Apple Pay/Klarna/Vipps panels).\n * `applyVioTheme` is the one supported way to set them: an inline style on\n * `:root` (or a scoped element) always wins over the stylesheet rule\n * `injectTokens` installs above, regardless of import/injection order — no\n * specificity fights, no reaching for `!important`.\n *\n * A curated subset on purpose — colors, fonts, corner radius and the spacing\n * steps the checkout actually uses. Radius and spacing were added once the\n * need was real (brand panels in Vev/Replit): corner shape is the strongest\n * identity lever after colour, and the spacing steps drive comfortable-vs-\n * compact density. The rest of the token set (sizes, tracking, line heights)\n * stays internal — don't speculatively surface it as public API.\n *\n * Panels are expected to present these as a few opinionated choices (e.g.\n * \"Sharp / Default / Rounded\") rather than four raw pixel inputs; the API\n * stays per-token so a panel can compose whatever presets it wants.\n *\n * Host integrations (the Vio Config panel in Vev, a future Replit CMS\n * panel, anything else) should call this ONE function — never set\n * `--vio-*` custom properties by hand. If the injection mechanism changes\n * later, only this function needs updating, not every panel that theme.\n */\nexport interface VioThemeOverrides {\n colorText?: string\n colorTextSecondary?: string\n colorTextTertiary?: string\n colorTextOnPrimary?: string\n colorAccent?: string\n colorSurface?: string\n colorSurfaceMuted?: string\n colorSurfaceHover?: string\n colorBorder?: string\n colorBorderDefault?: string\n fontSerif?: string\n fontSans?: string\n /** Corner radius. `sm` = drag handles, `lg` = controls (chips, notices,\n * shipping options), `xl` = the sheet/drawer itself. Set all three to `0`\n * for a square look, or raise `xl` for a softer one. */\n radiusSm?: string\n radiusMd?: string\n radiusLg?: string\n radiusXl?: string\n /** Spacing steps — drive checkout density (compact vs comfortable). */\n spaceSm?: string\n spaceMd?: string\n spaceLg?: string\n spaceXl?: string\n /* Product detail, cart, checkout, confirmation and the hand-over to a\n * payment page (0.28) — layout knobs a host needs to fit its own design.\n * Every one is a `--vio-*` custom property too (README → Styling). */\n /** Product detail panel width on desktop (default `440px`). */\n detailWidth?: string\n /** Side padding of the detail (default the `lg` space, `24px`). */\n detailPaddingX?: string\n /** Height of the selling brand's logo in the detail's top bar (default `44px`; width follows its proportions). A square logo gets the brand's name beside it. */\n detailLogoHeight?: string\n /** Zoom on that logo inside its box (default `1`); e.g. `1.8` crops the white around a mark in a square file. */\n detailLogoZoom?: string\n /** Product name size in the detail. */\n detailTitleSize?: string\n /** Price size in the detail (default `24px`). */\n detailPriceSize?: string\n /** How the main image fits its box: `cover` (fills it, crops the overflow — default) or `contain` (whole image, bars where the shapes differ). */\n detailImageFit?: string\n /** Main image box proportion, the same for every image so the panel never jumps: `4 / 5` (default), `1 / 1`, `3 / 4`, or `auto` (each image its own). */\n detailImageAspect?: string\n /** Cap on the main image's height (default `85vh`). */\n detailImageMaxHeight?: string\n /** Zoom on the main image (default `1`); e.g. `1.15` to crop a white margin baked into the file. */\n detailImageZoom?: string\n /** Side margin of the main image (default: the panel's padding, aligned with the text); `0` = edge to edge. */\n detailImageInset?: string\n /** Background behind the main image (default the muted surface). */\n detailImageBg?: string\n /** `thumbs` (default: one image, thumbnails under it) or `carousel` (every image in one swipeable row with a dot per photo, no thumbnails — less height). An element's `gallery` attribute wins over it. */\n detailGallery?: string\n /** In the carousel, how much of the next photo shows at the edge (default `0px`), e.g. `32px`. */\n detailCarouselPeek?: string\n /** «Beskrivelse»: `preview` (default — first lines + «Les mer»), `folded` (heading only until a tap) or `open`. An element's `description-mode` wins. */\n detailDescriptionMode?: string\n /** Lines the «Beskrivelse» preview shows (default `3`). */\n detailDescriptionPreviewLines?: string\n /** The brand's promises under the buy zone: `grid` (default, shown when the brand has some) or `none` (hidden). */\n detailHighlightsDisplay?: string\n /** «Frakt & retur» in the detail: `block` (default) or `none` (hidden). */\n detailShippingReturnsDisplay?: string\n /** `<vio-product-carousel>`: `carousel` (default, one row) or `list` (cards one under the other). Its `layout` attribute wins. */\n carouselLayout?: string\n /** Thumbnail size (default `64px`). One row, scrolls sideways. */\n detailThumbSize?: string\n /** Space between thumbnails (default `8px`). */\n detailThumbGap?: string\n /** Thumbnail corners (default `0`). */\n detailThumbRadius?: string\n /** Border of the selected thumbnail (default the text colour). */\n detailThumbActiveColor?: string\n /** Height (and min width) of a size / option button (default `36px`). */\n detailOptionHeight?: string\n /** Space between option buttons (default `6px`). */\n detailOptionGap?: string\n /** Option button corners (default `0`). */\n detailOptionRadius?: string\n /** `wrap` (default, several lines) or `nowrap` (one line that scrolls). */\n detailOptionWrap?: string\n /** Height of the quantity stepper and «Legg i handlekurv» (default `52px`). */\n detailButtonHeight?: string\n /** Corners of «Legg i handlekurv» (default `0`). */\n detailButtonRadius?: string\n /** `sticky` or `static`: whether the buy zone (Vipps, quantity, add to cart) stays at the bottom of the panel while scrolling. Default: `static` on phones, `sticky` on desktop (with the description above it). */\n detailBuyPosition?: string\n /** Shadow over a sticky buy zone, e.g. `0 -8px 16px rgba(0,0,0,.06)`. */\n detailBuyShadow?: string\n /* Product cards (<vio-product>, the carousel's and the list's) — 0.32. Each\n * defaults to the card's look before 0.32; see README → Styling for the rest\n * of the --vio-card-* properties. */\n /** Font of the card (default the SDK's sans). */\n cardFont?: string\n /** Frame around the card, e.g. `1px solid rgba(230,230,230,.6)` (default none). */\n cardBorder?: string\n /** Image box proportion (default `1 / 1`), e.g. `3 / 4`. */\n cardImageAspect?: string\n /** `cover` (default, fills and crops) or `contain` (whole image). */\n cardImageFit?: string\n /** Background behind the card image (default the muted surface). */\n cardImageBg?: string\n /** Space around the image inside its box (default `0`). */\n cardImagePadding?: string\n /** Padding of the text under the image (default `14px 0 0`), e.g. `16px` in a framed card. */\n cardMetaPadding?: string\n /** Font of the price (default the card's), e.g. a serif. */\n cardPriceFont?: string\n /** Colour of the `bar` buy button (default the text colour). */\n cardAccent?: string\n /** Corners of the `bar` buy button (default `6px`). */\n cardBarRadius?: string\n /** Lines of the description a card shows (default `4`). */\n cardDescriptionLines?: string\n /** `-1` lifts the seller line above the name (where a brand line goes); default `0` (at the bottom). */\n cardRetailerOrder?: string\n /** Cart drawer width on desktop (default `440px`). */\n cartWidth?: string\n /** Checkout panel width on desktop (default `440px`). */\n checkoutWidth?: string\n /** Height of the brand's logo on the confirmation (default `40px`). */\n confirmLogoHeight?: string\n /** «Takk for bestillingen!» size (default `24px`). */\n confirmTitleSize?: string\n /** Background of the confirmation's check mark (default green). */\n confirmCheckBg?: string\n /** Background of the «Åpner Vipps …» overlay (default translucent white). */\n redirectBg?: string\n /** Spinner colour of that overlay (default Vipps orange). */\n redirectSpinner?: string\n /**\n * What the Vipps button pays when the cart has lines: `express` (default —\n * Vipps Express for the sponsor's whole cart, from `<vio-cart>` and from\n * `<vio-product-detail>`) or `checkout` (opens our checkout with Vipps\n * preselected, as in 0.31–0.34). An element's `vipps-cart-payment` wins.\n */\n vippsCartPayment?: 'express' | 'checkout' | string\n}\n\nconst THEME_KEY_TO_CSS_VAR: Record<keyof VioThemeOverrides, string> = {\n colorText: '--vio-color-text',\n colorTextSecondary: '--vio-color-text-secondary',\n colorTextTertiary: '--vio-color-text-tertiary',\n colorTextOnPrimary: '--vio-color-text-on-primary',\n colorAccent: '--vio-color-accent',\n colorSurface: '--vio-color-surface',\n colorSurfaceMuted: '--vio-color-surface-muted',\n colorSurfaceHover: '--vio-color-surface-hover',\n colorBorder: '--vio-color-border',\n colorBorderDefault: '--vio-color-border-default',\n fontSerif: '--vio-font-serif',\n fontSans: '--vio-font-sans',\n radiusSm: '--vio-radius-sm',\n radiusMd: '--vio-radius-md',\n radiusLg: '--vio-radius-lg',\n radiusXl: '--vio-radius-xl',\n spaceSm: '--vio-space-sm',\n spaceMd: '--vio-space-md',\n spaceLg: '--vio-space-lg',\n spaceXl: '--vio-space-xl',\n detailWidth: '--vio-detail-width',\n detailPaddingX: '--vio-detail-padding-x',\n detailLogoHeight: '--vio-detail-logo-height',\n detailLogoZoom: '--vio-detail-logo-zoom',\n detailTitleSize: '--vio-detail-title-size',\n detailPriceSize: '--vio-detail-price-size',\n detailImageFit: '--vio-detail-image-fit',\n detailImageAspect: '--vio-detail-image-aspect',\n detailImageMaxHeight: '--vio-detail-image-max-height',\n detailImageZoom: '--vio-detail-image-zoom',\n detailImageInset: '--vio-detail-image-inset',\n detailImageBg: '--vio-detail-image-bg',\n detailGallery: '--vio-detail-gallery',\n carouselLayout: '--vio-carousel-layout',\n detailCarouselPeek: '--vio-detail-carousel-peek',\n detailDescriptionMode: '--vio-detail-description-mode',\n detailDescriptionPreviewLines: '--vio-detail-description-preview-lines',\n detailHighlightsDisplay: '--vio-detail-highlights-display',\n detailShippingReturnsDisplay: '--vio-detail-shipping-returns-display',\n detailThumbSize: '--vio-detail-thumb-size',\n detailThumbGap: '--vio-detail-thumb-gap',\n detailThumbRadius: '--vio-detail-thumb-radius',\n detailThumbActiveColor: '--vio-detail-thumb-active-color',\n detailOptionHeight: '--vio-detail-option-height',\n detailOptionGap: '--vio-detail-option-gap',\n detailOptionRadius: '--vio-detail-option-radius',\n detailOptionWrap: '--vio-detail-option-wrap',\n detailButtonHeight: '--vio-detail-button-height',\n detailButtonRadius: '--vio-detail-button-radius',\n detailBuyPosition: '--vio-detail-buy-position',\n detailBuyShadow: '--vio-detail-buy-shadow',\n cardFont: '--vio-card-font',\n cardBorder: '--vio-card-border',\n cardImageAspect: '--vio-card-image-aspect',\n cardImageFit: '--vio-card-image-fit',\n cardImageBg: '--vio-card-image-bg',\n cardImagePadding: '--vio-card-image-padding',\n cardMetaPadding: '--vio-card-meta-padding',\n cardPriceFont: '--vio-card-price-font',\n cardAccent: '--vio-card-accent',\n cardBarRadius: '--vio-card-bar-radius',\n cardDescriptionLines: '--vio-card-description-lines',\n cardRetailerOrder: '--vio-card-retailer-order',\n cartWidth: '--vio-cart-width',\n checkoutWidth: '--vio-checkout-width',\n confirmLogoHeight: '--vio-confirm-logo-height',\n confirmTitleSize: '--vio-confirm-title-size',\n confirmCheckBg: '--vio-confirm-check-bg',\n redirectBg: '--vio-redirect-bg',\n redirectSpinner: '--vio-redirect-spinner',\n vippsCartPayment: '--vio-vipps-cart-payment',\n}\n\n/**\n * Apply (or clear) theme overrides. Pass `null`/`undefined` for a key to\n * revert it to the SDK default instead of leaving a stale override behind\n * — lets a host re-apply a full overrides object on every save without\n * having to track which keys it previously set.\n *\n * `target` defaults to `document.documentElement` (`:root`, matching where\n * `injectTokens` installs the defaults). Pass a specific element to scope\n * the theme to one subtree instead of the whole page — e.g. multiple\n * differently-branded sponsors on the same page.\n */\nexport function applyVioTheme(\n overrides: VioThemeOverrides,\n target: HTMLElement | null = typeof document !== 'undefined' ? document.documentElement : null,\n): void {\n if (!target) return\n for (const key of Object.keys(THEME_KEY_TO_CSS_VAR) as Array<keyof VioThemeOverrides>) {\n const cssVar = THEME_KEY_TO_CSS_VAR[key]\n const value = overrides[key]\n if (value) {\n target.style.setProperty(cssVar, value)\n } else if (key in overrides) {\n target.style.removeProperty(cssVar)\n }\n }\n}\n","/**\n * The slot identity of a `<vio-*>` element and its ONE `Vio.registerSlot()`\n * registration (ADR-0027 / ADR-0034).\n *\n * The editor types nothing: every element registers itself. Identity, in\n * order:\n * 1. `vio-slot` — the host's own id (also how several elements share one\n * slot: the cards a carousel renders carry the carousel's id);\n * 2. otherwise an auto id, `${scope ? scope + '-' : ''}${kind}-${n}`, with\n * `n` the first number not held by another live element of the same\n * kind and scope ANYWHERE in the document (shadow roots included). On a\n * fresh load elements connect in document order, so `n` is the document\n * position (`carousel-1`, `carousel-2`, `article-123-card-3`); in a\n * dynamic DOM an element added later takes the first free number and an\n * id a removed element freed is reused by the next one — two live\n * elements never share an auto id.\n * The scope is inherited from the DOM: the element's `vio-scope`, else the\n * nearest ancestor's `data-vio-scope` (through shadow hosts), else none. Its\n * human label the same way: `vio-scope-name` / `data-vio-scope-name`. This is\n * THE standard shared with Vev and Replit: a page sets\n * `<body data-vio-scope=\"article-123\" data-vio-scope-name=\"Title\">` and every\n * block in it gets a per-page slot with no naming; a template that wants slots\n * shared across pages sets no scope.\n *\n * Every id is capped at the server's 100 characters HERE, so the declared id,\n * `effectiveSlot`, the events' `slot` / `location_id` and the dashboard's\n * assignment are the same string.\n *\n * The display name is `vio-slot-name` when set; for an auto id it defaults to\n * `Carousel 1` (` · ${scopeName}` when the scope has a label); for a host id\n * without a name it is left undefined (the server keeps whatever it has).\n *\n * The attributes are not always there at `connectedCallback`: the React\n * wrappers set properties after the element is mounted, and a host may change\n * them later (the Vev editor, as the designer types). So the elements call\n * `connect()` on connect, `sync()` from `updated()`, and `clear()` on\n * disconnect. Registering never throws into the element — a slot is\n * attribution, not rendering — and tolerates a page whose `Vio` singleton\n * comes from an older bundle without `registerSlot`.\n */\n\nimport { Vio } from '../core/client.js'\nimport {\n autoSlotDisplayName,\n autoSlotId,\n campaignCandidates,\n normalizeScope,\n normalizeSlotId,\n type SlotKind,\n} from '../core/slots.js'\n\nexport interface SlotIdentity {\n id: string\n displayName?: string\n /** The element's own page campaign (`vio-campaign` / ancestor `data-vio-campaign`), if any — the first candidate. */\n campaignId?: number\n /** All of the element's page-campaign candidates, own first (an unusable one falls through to the next). */\n campaignCandidates: number[]\n}\n\nexport interface SlotAttributes {\n vioSlot?: string | null\n vioSlotName?: string | null\n vioScope?: string | null\n vioScopeName?: string | null\n vioCampaign?: string | number | null\n}\n\n/** Attribute names, shared by the elements and the ancestor lookup. */\nexport const SCOPE_ATTR = 'vio-scope'\nexport const SCOPE_NAME_ATTR = 'vio-scope-name'\nexport const SCOPE_DATA_ATTR = 'data-vio-scope'\nexport const SCOPE_NAME_DATA_ATTR = 'data-vio-scope-name'\nexport const CAMPAIGN_ATTR = 'vio-campaign'\nexport const CAMPAIGN_DATA_ATTR = 'data-vio-campaign'\n\n/**\n * Live elements per auto id, document-wide. Anchored on `globalThis` like the\n * Vio facade: a page with several bundle copies (Vev chunks) must share ONE\n * map, or two copies would both hand out `carousel-1`. Only auto ids: a host\n * id may be shared on purpose.\n */\nconst liveAutoIds: Map<string, Set<Element>> = (() => {\n const g = globalThis as unknown as { __VIO_LIVE_SLOT_IDS__?: Map<string, Set<Element>> }\n return g.__VIO_LIVE_SLOT_IDS__ ?? (g.__VIO_LIVE_SLOT_IDS__ = new Map())\n})()\n\nexport class SlotRegistration {\n private identity: SlotIdentity | null = null\n private release: (() => void) | null = null\n /** The auto identity held (its number is kept while the element lives). */\n private auto: { id: string; scope: string; number: number } | null = null\n /** Set by connect(); the scope label is read then too. */\n private connected = false\n private scope = ''\n private scopeName = ''\n\n constructor(\n private readonly host: HTMLElement,\n private readonly kind: SlotKind,\n ) {}\n\n /** The effective slot id ('' before connect / after disconnect). */\n get effective(): string {\n return this.identity?.id ?? ''\n }\n\n /** The element's own page campaign (`vio-campaign` / ancestor `data-vio-campaign`); undefined → `Vio.init`'s applies. */\n get campaignId(): number | undefined {\n return this.identity?.campaignId\n }\n\n /** The element's page-campaign candidates in order (own, ancestor) — the hint for `Vio.attribution` / `campaignForSlot`. */\n get campaignHint(): number[] {\n return this.identity?.campaignCandidates ?? []\n }\n\n /** On connect: read the scope from the DOM, then register. */\n connect(attrs: SlotAttributes): void {\n this.connected = true\n this.scope = scopeOf(this.host, attrs)\n this.scopeName = scopeNameOf(this.host, attrs)\n this.sync(attrs)\n }\n\n /** (Re)register when the attributes changed the identity. */\n sync(attrs: SlotAttributes): void {\n if (!this.connected) return\n // A scope set after connect (React) changes the identity too.\n const scope = scopeOf(this.host, attrs)\n if (scope !== this.scope) {\n this.scope = scope\n this.scopeName = scopeNameOf(this.host, attrs)\n this.releaseAuto()\n } else {\n const scopeName = scopeNameOf(this.host, attrs)\n if (scopeName !== this.scopeName) this.scopeName = scopeName\n }\n const next = this.resolve(attrs)\n if (sameIdentity(next, this.identity)) return\n this.unregister()\n if (!next) return\n try {\n // The campaign stays positional (third argument) and the kind goes in a\n // fourth options object: a facade from an older bundle (0.24) reads the\n // campaign as it always did and ignores the fourth; one older still\n // (0.23) ignores both and registers the id and name.\n this.release =\n typeof Vio.registerSlot !== 'function'\n ? null\n : next.campaignId !== undefined\n ? Vio.registerSlot(next.id, next.displayName, next.campaignId, { kind: this.kind })\n : Vio.registerSlot(next.id, next.displayName, { kind: this.kind })\n this.identity = next\n } catch {\n this.release = null\n this.identity = null\n }\n }\n\n /** What the identity is for these attributes (null before connect without a host id). */\n resolve(attrs: SlotAttributes): SlotIdentity | null {\n const explicit = normalizeSlotId(attrs.vioSlot)\n const name =\n typeof attrs.vioSlotName === 'string' && attrs.vioSlotName.trim() ? attrs.vioSlotName.trim() : undefined\n const campaignCandidates = campaignCandidatesOf(this.host, attrs)\n const campaignId = campaignCandidates[0]\n if (explicit) {\n // A host id frees the auto number for the next element.\n this.releaseAuto()\n return { id: explicit, displayName: name, campaignId, campaignCandidates }\n }\n if (!this.connected) return null\n const auto = this.claimAuto()\n return {\n id: auto.id,\n displayName: name ?? autoSlotDisplayName(this.kind, auto.number - 1, this.scopeName),\n campaignId,\n campaignCandidates,\n }\n }\n\n /** Unregister whatever is registered and free the auto number. */\n clear(): void {\n this.unregister()\n this.releaseAuto()\n this.connected = false\n }\n\n private unregister(): void {\n try {\n this.release?.()\n } catch {\n /* never break the element */\n }\n this.release = null\n this.identity = null\n }\n\n /** The element's auto id: the one it already holds, else the first free number. */\n private claimAuto(): { id: string; scope: string; number: number } {\n if (this.auto && this.auto.scope === this.scope) return this.auto\n this.releaseAuto()\n for (let number = 1; ; number++) {\n const id = autoSlotId(this.kind, number - 1, this.scope)\n const holders = liveAutoIds.get(id)\n if (!holders || holders.size === 0 || (holders.size === 1 && holders.has(this.host))) {\n const set = holders ?? new Set<Element>()\n set.add(this.host)\n liveAutoIds.set(id, set)\n this.auto = { id, scope: this.scope, number }\n return this.auto\n }\n }\n }\n\n private releaseAuto(): void {\n if (!this.auto) return\n const holders = liveAutoIds.get(this.auto.id)\n holders?.delete(this.host)\n if (holders && holders.size === 0) liveAutoIds.delete(this.auto.id)\n this.auto = null\n }\n}\n\nfunction sameIdentity(a: SlotIdentity | null, b: SlotIdentity | null): boolean {\n if (!a || !b) return a === b\n return a.id === b.id && a.displayName === b.displayName && a.campaignId === b.campaignId\n}\n\n/**\n * The element's page-campaign candidates, in precedence order: its own\n * `vio-campaign` (property or attribute), then the nearest ancestor's\n * `data-vio-campaign` (through shadow hosts); `Vio.init`'s is appended by\n * `Vio.*` itself. Invalid values (not a positive safe integer) are skipped,\n * so an unusable level falls through to the next. Read at mount / on\n * attribute change — there is no observer on the ancestors.\n */\nexport function campaignCandidatesOf(el: Element, attrs?: SlotAttributes): number[] {\n const own =\n attrs && attrs.vioCampaign !== undefined && attrs.vioCampaign !== null\n ? attrs.vioCampaign\n : (el as { vioCampaign?: unknown }).vioCampaign !== undefined\n ? (el as { vioCampaign?: unknown }).vioCampaign\n : el.getAttribute(CAMPAIGN_ATTR)\n const ancestor = closestAcrossShadow(el, `[${CAMPAIGN_DATA_ATTR}]`)?.getAttribute(CAMPAIGN_DATA_ATTR)\n return campaignCandidates([own as number | string | null | undefined, ancestor])\n}\n\n/** The element's own page campaign — the first usable candidate; see `campaignCandidatesOf`. */\nexport function campaignOf(el: Element, attrs?: SlotAttributes): number | undefined {\n return campaignCandidatesOf(el, attrs)[0]\n}\n\n/** The scope of an element: its own `vio-scope` (property or attribute), else the nearest `data-vio-scope`. */\nexport function scopeOf(el: Element, attrs?: SlotAttributes): string {\n const own =\n attrs && typeof attrs.vioScope === 'string'\n ? attrs.vioScope\n : typeof (el as { vioScope?: unknown }).vioScope === 'string'\n ? ((el as { vioScope?: string }).vioScope ?? '')\n : (el.getAttribute(SCOPE_ATTR) ?? '')\n return (\n normalizeScope(own) ||\n normalizeScope(closestAcrossShadow(el, `[${SCOPE_DATA_ATTR}]`)?.getAttribute(SCOPE_DATA_ATTR))\n )\n}\n\n/** The human label of the scope, looked up the same way as the scope. */\nexport function scopeNameOf(el: Element, attrs?: SlotAttributes): string {\n const own =\n attrs && typeof attrs.vioScopeName === 'string'\n ? attrs.vioScopeName\n : typeof (el as { vioScopeName?: unknown }).vioScopeName === 'string'\n ? ((el as { vioScopeName?: string }).vioScopeName ?? '')\n : (el.getAttribute(SCOPE_NAME_ATTR) ?? '')\n return (\n own.trim() ||\n (closestAcrossShadow(el, `[${SCOPE_NAME_DATA_ATTR}]`)?.getAttribute(SCOPE_NAME_DATA_ATTR) ?? '').trim()\n )\n}\n\n/** `closest()` that keeps walking up through shadow hosts. */\nfunction closestAcrossShadow(start: Element, selector: string): Element | null {\n try {\n let node: Element | null = start\n while (node) {\n const found = typeof node.closest === 'function' ? node.closest(selector) : null\n if (found) return found\n const root = node.getRootNode() as Node & { host?: Element }\n node =\n root && root !== node && typeof (root as ShadowRoot).host === 'object'\n ? ((root as ShadowRoot).host ?? null)\n : null\n }\n } catch {\n /* no DOM, detached */\n }\n return null\n}\n","/**\n * <vio-product> — single product card matching the editorial style of the\n * Allermedia \"Shop Favorittene\" carousel. Image-forward, brand top,\n * sans-serif body, bold price, retailer at the bottom. Whole card is\n * clickable; emits `vio:product-click` with productId/sponsorId for the\n * host site to drive checkout opening.\n */\n\nimport { LitElement, css, html } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { Vio } from '../../core/client.js'\nimport { SlotRegistration } from '../slot-registration.js'\n\nexport class VioProduct extends LitElement {\n /** Brand label shown at the top (uppercase, gray, small). */\n @property({ type: String }) brand = ''\n /** Product display name. Two-line truncation. */\n @property({ type: String }) name = ''\n /** Pre-formatted price string (e.g. \"990 kr\"). Bold. */\n @property({ type: String }) price = ''\n /** Short text under the name (plain text, cut after --vio-card-description-lines, 4). Shown only with `show-description`. */\n @property({ type: String }) description = ''\n /** Show `description` under the name. Off by default. */\n @property({ type: Boolean, attribute: 'show-description' }) showDescription = false\n /**\n * The buy button, as in the Vev card: `icon` (the round bag on the image —\n * default), `bar` (a full-width button under the price) or `hidden`. Both\n * add to the cart, or open the product when it has sizes to pick.\n */\n @property({ type: String, attribute: 'button-style' }) buttonStyle: 'icon' | 'bar' | 'hidden' = 'icon'\n /** Text of the `bar` button (default «Kjøp»); «Kjøp · 2» once two are in the cart. */\n @property({ type: String, attribute: 'button-label' }) buttonLabel = 'Kjøp'\n /** Retailer / sponsor name shown at the bottom (uppercase, gray). */\n @property({ type: String }) retailer = ''\n /** Product image URL. Square aspect, gray bg if missing. */\n @property({ type: String, attribute: 'image-url' }) imageUrl = ''\n /** Vio product id, propagated to click event. */\n @property({ type: String, attribute: 'product-id' }) productId = ''\n /** Vio sponsor id, propagated to click event. */\n @property({ type: String, attribute: 'sponsor-id' }) sponsorId = ''\n /**\n * Slot this card sits in (ADR-0027). Optional: without it the card registers\n * itself as `card-N` (its position among the cards on the page). Set it to\n * name the place yourself or to make several elements share one slot. It is\n * carried by every event the card emits, so attribution goes to the campaign\n * assigned to the slot. The attribute is `vio-slot`, not `slot` — that one\n * is HTML's own (shadow DOM slotting).\n */\n @property({ type: String, attribute: 'vio-slot' }) vioSlot = ''\n /** Human name of the slot for the dashboard (`vio-slot-name`). Optional. */\n @property({ type: String, attribute: 'vio-slot-name' }) vioSlotName = ''\n /**\n * Scope of the auto id (`article-123-card-1`). Inherited: this attribute,\n * else the nearest ancestor's `data-vio-scope` (a page sets it ONCE on\n * `<body>` and every block gets a per-page slot). Optional.\n */\n @property({ type: String, attribute: 'vio-scope' }) vioScope = ''\n /** Human label of the scope (` · Title` in the slot name); inherited from `data-vio-scope-name`. */\n @property({ type: String, attribute: 'vio-scope-name' }) vioScopeName = ''\n /**\n * The campaign this element's PAGE belongs to (ADR-0034, amendment 3).\n * Inherited: this attribute, else the nearest ancestor's `data-vio-campaign`,\n * else `Vio.init({ campaignId })`. A dashboard assignment of the slot wins\n * over it. Optional.\n */\n @property({ type: String, attribute: 'vio-campaign' }) vioCampaign = ''\n /** Per-element override of the content (article) id the events carry; see `Vio.content()`. */\n @property({ type: String, attribute: 'vio-content-id' }) vioContentId = ''\n /** Per-element override of the content title. */\n @property({ type: String, attribute: 'vio-content-title' }) vioContentTitle = ''\n /**\n * What kind of SDK element this card stands for in analytics\n * (`component_template_id`): `product-card` on its own; a carousel sets\n * `product-carousel` on the cards it renders, so its impressions and its\n * clicks count under one component type.\n */\n @property({ type: String, attribute: 'component-template-id' }) componentTemplateId = ''\n private readonly slotRegistration = new SlotRegistration(this, 'card')\n\n /** The slot id in effect: `vio-slot`, else the auto id (`card-N`). Read-only. */\n get effectiveSlot(): string {\n return this.slotRegistration.effective\n }\n\n /** The element's own page campaign (`vio-campaign` / ancestor), if any; `Vio.init`'s applies otherwise. */\n get effectiveCampaignId(): number | undefined {\n return this.slotRegistration.campaignId\n }\n\n /** The slot campaign's sponsor as the string the attributes use ('' when unknown). */\n private sponsorFromAttribution(): string {\n const id =\n typeof Vio.attribution === 'function'\n ? Vio.attribution(this.effectiveSlot, { campaignId: this.slotRegistration.campaignHint }).sponsorId\n : undefined\n return id !== undefined ? String(id) : ''\n }\n\n private slotAttributes() {\n return {\n vioSlot: this.vioSlot,\n vioSlotName: this.vioSlotName,\n vioScope: this.vioScope,\n vioScopeName: this.vioScopeName,\n vioCampaign: this.vioCampaign,\n }\n }\n\n /**\n * What every event carries for attribution (`Vio.attribution`): the place,\n * its campaign and sponsor, and the content — overridden here when the host\n * set `vio-content-id` / `vio-content-title` on this card.\n */\n private attribution() {\n // A page whose `Vio` singleton comes from an older bundle has no attribution().\n const base =\n typeof Vio.attribution === 'function'\n ? Vio.attribution(this.effectiveSlot, {\n sponsorId: this.sponsorId || undefined,\n campaignId: this.slotRegistration.campaignHint,\n })\n : { slot: this.effectiveSlot || undefined }\n return {\n ...base,\n componentTemplateId: this.componentTemplateId || 'product-card',\n ...(this.vioContentId ? { contentId: this.vioContentId } : {}),\n ...(this.vioContentTitle ? { contentTitle: this.vioContentTitle } : {}),\n }\n }\n /** Whether the product has selectable variants — the quick-add button then\n * opens the detail to pick one instead of adding directly. */\n @property({ type: Boolean, attribute: 'has-variants' }) hasVariants = false\n /** Optional raw variants/options from the host — extra signal that a\n * variant must be picked before adding (selection is mandatory). */\n @property({ attribute: false }) variants: unknown[] | undefined = undefined\n @property({ attribute: false }) options: unknown[] | undefined = undefined\n\n /** Image-only mode: hide the meta block (brand / name / price / retailer)\n * and show just the image + the quick-add button. Click still opens the\n * detail. */\n @property({ type: Boolean, attribute: 'hide-meta' }) hideMeta = false\n\n /** True when this product currently sits in the cart (persistent mark). */\n @state() private inCart = false\n /** Total units of this product in the cart (shown as a count when > 1). */\n @state() private cartQty = 0\n /** Transient flag driving the add \"pop\" animation. */\n @state() private justAdded = false\n\n private boundCartChange = (): void => this.updateInCart()\n\n static override styles = css`\n :host {\n display: block;\n box-sizing: border-box;\n width: 100%;\n cursor: pointer;\n font-family: var(--vio-card-font, var(--vio-font-sans, -apple-system, sans-serif));\n color: var(--vio-color-text, #0a0a0a);\n -webkit-tap-highlight-color: transparent;\n }\n /* Every --vio-card-* below defaults to the look the card always had; a\n host restyles the card with them (they cross the carousel's shadow\n root, ::part would not). E.g. a framed card with a buy button:\n --vio-card-border, --vio-card-meta-padding, --vio-card-image-fit: contain. */\n .card {\n display: flex;\n flex-direction: column;\n height: 100%;\n box-sizing: border-box;\n border: var(--vio-card-border, none);\n background: var(--vio-card-bg, transparent);\n transition: border-color 0.2s ease;\n }\n :host(:hover) .card { border-color: var(--vio-card-border-hover-color, var(--vio-color-border, #e5e5e5)); }\n .image {\n position: relative;\n aspect-ratio: var(--vio-card-image-aspect, 1 / 1);\n width: 100%;\n background-color: var(--vio-card-image-bg, var(--vio-color-surface-muted, #f2f2f2));\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: opacity 0.2s ease;\n }\n :host(:hover) .image img { opacity: 0.92; }\n\n /* Quick add-to-cart button — overlaid bottom-right of the image, like the\n reference card's wishlist heart but wired to add the product to the cart. */\n .add-btn {\n position: absolute;\n right: 10px;\n bottom: 10px;\n width: var(--vio-card-add-size, 40px);\n height: var(--vio-card-add-size, 40px);\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.96);\n border: none;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: #0a0a0a;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);\n transition: transform 0.14s ease, background 0.14s ease, color 0.14s ease;\n padding: 0;\n z-index: 2;\n }\n .add-btn:hover { background: #fff; transform: scale(1.08); }\n .add-btn:active { transform: scale(0.95); }\n /* In cart → black circle with a white tick (matches the floating cart). */\n .add-btn.in-cart { background: #0a0a0a; color: #fff; }\n .add-btn.in-cart:hover { background: #222; }\n .add-btn.pop { animation: vio-add-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1); }\n .add-btn svg { width: var(--vio-card-add-icon-size, 18px); height: var(--vio-card-add-icon-size, 18px); }\n .add-btn .add-count { font-size: 15px; font-weight: 700; line-height: 1; }\n @keyframes vio-add-pop {\n 0% { transform: scale(1); }\n 35% { transform: scale(1.32); }\n 60% { transform: scale(0.9); }\n 100% { transform: scale(1); }\n }\n .image img {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n padding: var(--vio-card-image-padding, 0);\n object-fit: var(--vio-card-image-fit, cover);\n display: block;\n }\n .meta {\n padding: var(--vio-card-meta-padding, 14px 0 0);\n display: flex;\n flex-direction: column;\n flex: 1;\n }\n .brand {\n font-size: var(--vio-card-brand-size, var(--vio-size-xs, 12px));\n letter-spacing: var(--vio-card-brand-tracking, var(--vio-tracking-label, 0.1em));\n text-transform: uppercase;\n color: var(--vio-card-brand-color, var(--vio-color-text-secondary, #666));\n font-weight: var(--vio-card-brand-weight, 500);\n margin-bottom: var(--vio-card-brand-gap, 6px);\n }\n .name {\n font-family: var(--vio-card-name-font, inherit);\n font-size: var(--vio-card-name-size, var(--vio-size-md, 16px));\n font-weight: var(--vio-card-name-weight, 500);\n line-height: 1.3;\n margin: 0 0 var(--vio-card-name-gap, 10px);\n display: -webkit-box;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n /* show-description: cut after --vio-card-description-lines (4). */\n .description {\n display: -webkit-box;\n -webkit-line-clamp: var(--vio-card-description-lines, 4);\n line-clamp: var(--vio-card-description-lines, 4);\n -webkit-box-orient: vertical;\n overflow: hidden;\n font-size: var(--vio-card-description-size, 14px);\n line-height: 1.45;\n color: var(--vio-card-description-color, var(--vio-color-text-secondary, #737373));\n margin: 0 0 var(--vio-card-description-gap, 12px);\n }\n .price {\n font-family: var(--vio-card-price-font, inherit);\n font-size: var(--vio-card-price-size, var(--vio-size-md, 16px));\n font-weight: var(--vio-card-price-weight, 700);\n margin-bottom: var(--vio-card-price-gap, 16px);\n }\n /* Who sells it. --vio-card-retailer-order: -1 lifts it above the name\n (where a brand line goes), for catalogues without a brand of their own. */\n .retailer {\n display: var(--vio-card-retailer-display, block);\n order: var(--vio-card-retailer-order, 0);\n font-size: var(--vio-card-retailer-size, var(--vio-size-xs, 12px));\n letter-spacing: var(--vio-card-retailer-tracking, var(--vio-tracking-label, 0.1em));\n text-transform: uppercase;\n color: var(--vio-card-retailer-color, var(--vio-color-text-tertiary, #999));\n font-weight: var(--vio-card-retailer-weight, 500);\n margin: var(--vio-card-retailer-margin, auto 0 0);\n }\n /* button-style=\"bar\": the Vev card's bar — full width under the price,\n uppercase, the accent colour, 6px corners (--vio-card-bar-radius). */\n .bar-btn {\n width: 100%;\n margin-top: auto;\n padding: 14px;\n border: none;\n border-radius: var(--vio-card-bar-radius, 6px);\n background: var(--vio-card-accent, var(--vio-color-text, #0a0a0a));\n color: var(--vio-card-accent-text, #fff);\n font-family: inherit;\n font-size: 13px;\n font-weight: 600;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n cursor: pointer;\n transition: opacity 0.15s ease;\n }\n .bar-btn:hover { opacity: 0.88; }\n .bar-btn.pop { animation: vio-add-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1); }\n `\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.updateInCart()\n this.slotRegistration.connect(this.slotAttributes())\n Vio.cart.addEventListener('change', this.boundCartChange)\n }\n\n override disconnectedCallback(): void {\n Vio.cart.removeEventListener('change', this.boundCartChange)\n this.slotRegistration.clear()\n super.disconnectedCallback()\n }\n\n override updated(changed: Map<string, unknown>): void {\n // product-id / sponsor-id are set as attributes after construction.\n if (changed.has('productId') || changed.has('sponsorId')) this.updateInCart()\n // The slot attributes too (the React wrappers set properties after mount).\n if (changed.has('vioSlot') || changed.has('vioSlotName') || changed.has('vioScope') || changed.has('vioScopeName') || changed.has('vioCampaign')) {\n this.slotRegistration.sync(this.slotAttributes())\n }\n }\n\n /** Reflect whether (and how many units of) this product sit in the cart. */\n private updateInCart(): void {\n const pid = Number(this.productId)\n if (!Number.isFinite(pid) || pid <= 0) {\n this.inCart = false\n this.cartQty = 0\n return\n }\n const sid = Number(this.sponsorId)\n let qty = 0\n for (const cart of Vio.cart.getAllCarts().values()) {\n if (Number.isFinite(sid) && sid > 0 && cart.sponsorId !== sid) continue\n for (const i of cart.items) if (Number(i.productId) === pid) qty += i.quantity\n }\n this.inCart = qty > 0\n this.cartQty = qty\n }\n\n private onClick(): void {\n this.dispatchEvent(\n new CustomEvent('vio:product-click', {\n bubbles: true,\n composed: true,\n detail: {\n productId: this.productId,\n brand: this.brand,\n name: this.name,\n price: this.price,\n retailer: this.retailer,\n imageUrl: this.imageUrl,\n ...this.attribution(),\n // The host's sponsor-id wins; without one, the slot's campaign sponsor.\n sponsorId: this.sponsorId || this.sponsorFromAttribution(),\n },\n }),\n )\n }\n\n private onKeydown(e: KeyboardEvent): void {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n this.onClick()\n }\n }\n\n /** Quick add-to-cart. If the product has selectable variants, open the detail\n * to pick one instead (the host can't choose for the user). Otherwise emit\n * `vio:product-add` so the host adds it (bumping quantity on repeat taps). */\n private onAdd(e: Event): void {\n e.stopPropagation()\n if (\n this.hasVariants ||\n (Array.isArray(this.variants) && this.variants.length > 1) ||\n (Array.isArray(this.options) && this.options.length > 0)\n ) {\n this.onClick()\n return\n }\n const attribution = this.attribution()\n this.dispatchEvent(\n new CustomEvent('vio:product-add', {\n bubbles: true,\n composed: true,\n detail: {\n productId: this.productId,\n brand: this.brand,\n name: this.name,\n price: this.price,\n retailer: this.retailer,\n imageUrl: this.imageUrl,\n ...attribution,\n // The host's sponsor-id wins; without one, the slot's campaign sponsor.\n sponsorId: this.sponsorId || this.sponsorFromAttribution(),\n // The host adds to the cart: pass this through as `origin` so the\n // purchase is attributed to this place, campaign, kind of element\n // and page — the cart keeps it and Commerce receives it (ADR-0035).\n origin: {\n campaignId: attribution.campaignId,\n slot: attribution.slot,\n contentId: attribution.contentId,\n componentKind: attribution.componentTemplateId,\n contentUrl: attribution.contentUrl,\n contentTitle: attribution.contentTitle,\n },\n },\n }),\n )\n // Optimistic pop; the persistent \"in cart\" mark follows from the cart event.\n this.justAdded = true\n setTimeout(() => {\n this.justAdded = false\n }, 450)\n }\n\n override render() {\n return html`\n <div\n class=\"card\"\n @click=${this.onClick}\n @keydown=${this.onKeydown}\n role=\"button\"\n tabindex=\"0\"\n aria-label=${`${this.brand} ${this.name} ${this.price}`}\n >\n <div class=\"image\">\n ${this.imageUrl\n ? html`<img src=${this.imageUrl} alt=${this.name || this.brand} loading=\"lazy\" />`\n : ''}\n ${this.buttonStyle === 'icon'\n ? html`<button\n class=\"add-btn ${this.inCart ? 'in-cart' : ''} ${this.justAdded ? 'pop' : ''}\"\n @click=${this.onAdd}\n aria-label=${this.inCart ? 'I handlekurven – legg til en til' : 'Legg i kurv'}\n title=${this.inCart ? 'I handlekurven' : 'Legg i kurv'}\n >\n ${this.inCart\n ? this.cartQty > 1\n ? html`<span class=\"add-count\">${this.cartQty}</span>`\n : html`<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\">\n <polyline points=\"20 6 9 17 4 12\"></polyline>\n </svg>`\n : html`<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.7\">\n <path d=\"M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z\"></path>\n <line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"></line>\n <path d=\"M16 10a4 4 0 0 1-8 0\"></path>\n </svg>`}\n </button>`\n : ''}\n </div>\n ${this.hideMeta\n ? ''\n : html`\n <div class=\"meta\">\n ${this.brand ? html`<div class=\"brand\">${this.brand}</div>` : ''}\n ${this.name ? html`<div class=\"name\">${this.name}</div>` : ''}\n ${this.showDescription && this.description ? html`<p class=\"description\">${this.description}</p>` : ''}\n ${this.price ? html`<div class=\"price\">${this.price}</div>` : ''}\n ${this.retailer ? html`<div class=\"retailer\">${this.retailer}</div>` : ''}\n ${this.buttonStyle === 'bar'\n ? html`<button class=\"bar-btn ${this.justAdded ? 'pop' : ''}\" @click=${this.onAdd}>\n ${this.inCart ? `${this.buttonLabel} · ${this.cartQty}` : this.buttonLabel}\n </button>`\n : ''}\n </div>`}\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vio-product': VioProduct\n }\n}\n","/**\n * The sponsor's (brand's) name and logo in the elements — one resolver\n * (`Vio.sponsorIdentity`, see core/sponsor-identity.ts) and one way to draw it:\n * the logo with the name as its `alt`, or the name as text when there is no\n * logo — or when the logo fails to load.\n */\n\nimport { html, nothing, type TemplateResult } from 'lit'\nimport { Vio } from '../core/client.js'\nimport { Configuration } from '../core/configuration.js'\nimport {\n checkoutSponsorOf,\n sponsorIdentityFrom,\n type CheckoutSponsor,\n type SponsorIdentity,\n} from '../core/sponsor-identity.js'\n\n/**\n * `Vio.sponsorIdentity(sponsorId, { checkoutId })`; on a facade from an older\n * bundle that predates it (the facade is shared on `globalThis`), the same\n * rule over its bootstrap. `null` when nothing names it; never throws.\n */\nexport function resolveSponsorIdentity(\n sponsorId: number | string | null | undefined,\n checkoutId?: string | null,\n): SponsorIdentity | null {\n try {\n if (typeof Vio.sponsorIdentity === 'function') return Vio.sponsorIdentity(sponsorId, { checkoutId })\n return sponsorIdentityFrom(Vio.bootstrapCache, sponsorId)\n } catch {\n return null\n }\n}\n\n/** `{ sponsor }` for an event detail — the `{ id, name, logoUrl }` of the sponsor — or `{}` when it cannot be named. */\nexport function sponsorDetail(\n sponsorId: number | string | null | undefined,\n checkoutId?: string | null,\n): { sponsor?: CheckoutSponsor } {\n const sponsor = checkoutSponsorOf(resolveSponsorIdentity(sponsorId, checkoutId))\n return sponsor ? { sponsor } : {}\n}\n\n/** Logos that failed to load on this page: shown as the name from then on. */\nconst failedLogos = new Set<string>()\n\n/** The logo to draw for an identity: its URL, unless it is missing or failed to load here. */\nexport function usableLogo(identity: Pick<SponsorIdentity, 'logoUrl'> | null | undefined): string | null {\n const url = identity?.logoUrl\n return url && !failedLogos.has(url) ? url : null\n}\n\n/**\n * The sponsor as a mark: `<img class=logoClass alt=name>` when it has a logo\n * that loads, else `<span class=nameClass>name</span>`, else nothing. A logo\n * that fails to load is remembered as failed and the host re-renders with the\n * name.\n */\nexport function renderSponsorMark(\n host: { requestUpdate(): void },\n identity: Pick<SponsorIdentity, 'name' | 'logoUrl'> | null | undefined,\n classes: { logo: string; name: string },\n): TemplateResult | typeof nothing {\n if (!identity) return nothing\n const logo = usableLogo(identity)\n if (logo) {\n return html`<img\n class=${classes.logo}\n src=${logo}\n alt=${identity.name}\n decoding=\"async\"\n @error=${() => {\n failedLogos.add(logo)\n host.requestUpdate()\n }}\n />`\n }\n return identity.name ? html`<span class=${classes.name}>${identity.name}</span>` : nothing\n}\n\n/** How long a return waits for `Vio.init()` before it stops waiting for the bootstrap. */\nconst INIT_WAIT_MS = 10_000\n\n/**\n * Resolves once the bootstrap is cached — waiting for `Vio.init()` (up to\n * 10 s) and then joining (or starting) `Vio.bootstrap()`, which is deduped.\n * `false` when it could not be had; never throws. For a confirmation that\n * must name the sponsor once the bootstrap lands (a redirect return).\n */\nexport async function whenBootstrapped(): Promise<boolean> {\n try {\n if (Vio.bootstrapCache) return true\n if (!Configuration.isInitialized) await Configuration.whenReady(INIT_WAIT_MS)\n if (!Configuration.isInitialized || typeof Vio.bootstrap !== 'function') return false\n await Vio.bootstrap()\n return !!Vio.bootstrapCache\n } catch {\n return false\n }\n}\n\n/** For tests: forget the logos that failed. */\nexport function resetFailedLogos(): void {\n failedLogos.clear()\n}\n","/**\n * <vio-product-carousel> — horizontal product carousel matching the\n * Allermedia \"Shop Favorittene\" pattern.\n *\n * Two render modes:\n * 1. Slotted — the consumer puts <vio-product> children inside the tag\n * (manual / SSR-friendly).\n * 2. Auto-fetch — set `product-ids=\"123,456,789\"` plus either\n * `commerce-key=\"...\"` (explicit per-sponsor commerce apiKey) or\n * `sponsor-id=\"3\"` (looked up via Vio.bootstrap). The carousel\n * fetches products from Vio Commerce GraphQL and renders them.\n *\n * Visual layout in both modes:\n * - Editorial label (red, uppercase) above the heading\n * - Serif heading + inline gray disclaimer\n * - \"Se alle\" link right-aligned\n * - Snap-scroll viewport with round white chevron nav buttons\n */\n\nimport { LitElement, css, html } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\nimport { Vio } from '../../core/client.js'\nimport type { AnalyticsCommerce } from '../../core/analytics/analytics-manager.js'\nimport {\n displayPrice,\n primaryImageUrl,\n type Product,\n} from '../../core/types.js'\nimport { SlotRegistration } from '../slot-registration.js'\nimport { resolveSponsorIdentity } from '../sponsor-identity.js'\n\nexport class VioProductCarousel extends LitElement {\n /** Small uppercase label in accent color (e.g. \"REDAKSJONENS FAVORITTER\"). */\n @property({ type: String }) label = ''\n /** Big serif heading (e.g. \"Shop Favorittene\"). */\n @property({ type: String }) heading = ''\n /** Inline gray disclaimer next to the heading (e.g. \"annonselenker\"). */\n @property({ type: String }) disclaimer = ''\n /** URL for the \"Se alle\" link. Hidden if empty. */\n @property({ type: String, attribute: 'see-all-href' }) seeAllHref = ''\n /** Label for the see-all link. Defaults to Norwegian. */\n @property({ type: String, attribute: 'see-all-label' }) seeAllLabel = 'Se alle'\n\n /** Auto-fetch mode: comma-separated product ids (e.g. \"408895,408896\"). */\n @property({ type: String, attribute: 'product-ids' }) productIds = ''\n /** Auto-fetch mode option A: explicit per-sponsor commerce apiKey. */\n @property({ type: String, attribute: 'commerce-key' }) commerceKey = ''\n /** Auto-fetch mode option B: sponsor id looked up via Vio.bootstrap. */\n @property({ type: Number, attribute: 'sponsor-id' }) sponsorId = 0\n /**\n * Multi-sponsor mode: `\"sponsorId:productId,sponsorId:productId,…\"`. Each\n * pair resolves its own commerce client via `Vio.commerceFor(sponsorId)`;\n * fetches run in parallel and results are merged preserving input order.\n * Each rendered <vio-product> carries the per-item sponsor-id so taps go\n * to <vio-product-detail> with the right commerce context.\n *\n * Takes precedence over `product-ids` if both are set.\n */\n @property({ type: String, attribute: 'product-refs' }) productRefs = ''\n /** Currency for product prices. */\n @property({ type: String }) currency = 'NOK'\n /**\n * `carousel` (default: one row that scrolls sideways) or `list` (the cards\n * one under the other, full width, like products inside an article). Unset\n * = the theme's `carouselLayout` (`--vio-carousel-layout`).\n */\n @property({ type: String, reflect: true }) layout = ''\n /** Every card shows its product's description (see `descriptions` to write your own). Off by default. */\n @property({ type: Boolean, attribute: 'show-description' }) showDescription = false\n /**\n * The editor's own text per product, over the catalogue's: `{ \"<productId>\": \"text\" }`\n * (attribute: the same as JSON). Shown even without `show-description`; `\"\"`\n * hides that product's description.\n */\n @property({ type: Object }) descriptions: Record<string, string> = {}\n /** The cards' buy button: `icon` (default), `bar` or `hidden` — see `<vio-product>`. */\n @property({ type: String, attribute: 'button-style' }) buttonStyle: 'icon' | 'bar' | 'hidden' = 'icon'\n /** Text of the `bar` button (default «Kjøp»). */\n @property({ type: String, attribute: 'button-label' }) buttonLabel = 'Kjøp'\n /** `layout` resolved against the theme on connect. */\n @state() private resolvedLayout: 'carousel' | 'list' = 'carousel'\n /**\n * Slot this carousel sits in (ADR-0027). Optional: without it the carousel\n * registers itself as `carousel-N` (its position among the carousels on the\n * page). Set it to name the place yourself or to share one slot between\n * elements. Passed to every card it renders, carried by its analytics, and\n * — without a `sponsor-id` — the source of the sponsor (the primary of the\n * campaign assigned to the slot). The attribute is `vio-slot`, not `slot`\n * (that one is HTML's own, shadow DOM slotting).\n */\n @property({ type: String, attribute: 'vio-slot' }) vioSlot = ''\n /** Human name of the slot for the dashboard (`vio-slot-name`). Optional. */\n @property({ type: String, attribute: 'vio-slot-name' }) vioSlotName = ''\n /**\n * Scope of the auto id (`article-123-carousel-1`). Inherited: this attribute,\n * else the nearest ancestor's `data-vio-scope` (a page sets it ONCE on\n * `<body>` and every block gets a per-page slot). Optional.\n */\n @property({ type: String, attribute: 'vio-scope' }) vioScope = ''\n /** Human label of the scope (` · Title` in the slot name); inherited from `data-vio-scope-name`. */\n @property({ type: String, attribute: 'vio-scope-name' }) vioScopeName = ''\n /**\n * The campaign this element's PAGE belongs to (ADR-0034, amendment 3).\n * Inherited: this attribute, else the nearest ancestor's `data-vio-campaign`,\n * else `Vio.init({ campaignId })`. A dashboard assignment of the slot wins\n * over it. Optional.\n */\n @property({ type: String, attribute: 'vio-campaign' }) vioCampaign = ''\n /** Per-element override of the content (article) id the events carry; see `Vio.content()`. */\n @property({ type: String, attribute: 'vio-content-id' }) vioContentId = ''\n /** Per-element override of the content title. */\n @property({ type: String, attribute: 'vio-content-title' }) vioContentTitle = ''\n private readonly slotRegistration = new SlotRegistration(this, 'carousel')\n\n /** The slot id in effect: `vio-slot`, else the auto id (`carousel-N`). Read-only. */\n get effectiveSlot(): string {\n return this.slotRegistration.effective\n }\n\n /** The element's own page campaign (`vio-campaign` / ancestor), if any; `Vio.init`'s applies otherwise. */\n get effectiveCampaignId(): number | undefined {\n return this.slotRegistration.campaignId\n }\n\n private slotAttributes() {\n return {\n vioSlot: this.vioSlot,\n vioSlotName: this.vioSlotName,\n vioScope: this.vioScope,\n vioScopeName: this.vioScopeName,\n vioCampaign: this.vioCampaign,\n }\n }\n\n /** Attribution every analytics event of this carousel carries (`Vio.attribution` + the content overrides). */\n private attribution() {\n const base =\n typeof Vio.attribution === 'function'\n ? Vio.attribution(this.effectiveSlot, {\n sponsorId: this.sponsorId > 0 ? this.sponsorId : undefined,\n campaignId: this.slotRegistration.campaignHint,\n })\n : { slot: this.effectiveSlot || undefined }\n return {\n ...base,\n componentTemplateId: 'product-carousel',\n ...(this.vioContentId ? { contentId: this.vioContentId } : {}),\n ...(this.vioContentTitle ? { contentTitle: this.vioContentTitle } : {}),\n }\n }\n\n @query('.scroller') private scroller!: HTMLElement\n @state() private fetched: Array<{ product: Product; sponsorId: number }> | null = null\n @state() private isLoading = false\n @state() private fetchError = ''\n\n static override styles = css`\n :host {\n display: block;\n box-sizing: border-box;\n width: 100%;\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n color: var(--vio-color-text, #0a0a0a);\n padding: var(--vio-space-xl, 32px) 0;\n }\n .header {\n display: flex;\n align-items: flex-end;\n justify-content: space-between;\n gap: var(--vio-space-md, 16px);\n margin-bottom: var(--vio-space-lg, 24px);\n padding: 0 var(--vio-space-lg, 24px);\n }\n .header-text { flex: 1; min-width: 0; }\n .label {\n font-size: var(--vio-size-xs, 12px);\n letter-spacing: var(--vio-tracking-label, 0.1em);\n text-transform: uppercase;\n color: var(--vio-color-accent, #c14a3b);\n font-weight: 500;\n margin-bottom: var(--vio-space-sm, 8px);\n }\n .heading-row {\n display: flex;\n align-items: baseline;\n gap: var(--vio-space-sm, 8px);\n flex-wrap: wrap;\n }\n .heading {\n font-family: var(--vio-font-serif, Georgia, serif);\n font-size: clamp(28px, 4vw, 40px);\n font-weight: 400;\n line-height: 1.1;\n margin: 0;\n }\n .disclaimer {\n color: var(--vio-color-text-tertiary, #999);\n font-size: var(--vio-size-sm, 14px);\n font-style: italic;\n }\n .see-all {\n font-size: var(--vio-size-sm, 14px);\n color: var(--vio-color-text, #0a0a0a);\n text-decoration: underline;\n text-underline-offset: 4px;\n white-space: nowrap;\n font-weight: 500;\n }\n .see-all:hover { color: var(--vio-color-text-secondary, #666); }\n\n .viewport {\n position: relative;\n }\n .scroller {\n display: flex;\n gap: var(--vio-space-md, 16px);\n /* Extra left padding so the first card clears the prev chevron. */\n padding: 0 var(--vio-space-lg, 24px) 8px 72px;\n overflow-x: auto;\n scroll-snap-type: x mandatory;\n scrollbar-width: none;\n -ms-overflow-style: none;\n -webkit-overflow-scrolling: touch;\n }\n @media (max-width: 600px) {\n .scroller { padding: 0 var(--vio-space-lg, 24px) 8px; }\n }\n .scroller::-webkit-scrollbar { display: none; }\n /* layout=\"list\": one card under the other, as wide as the column. */\n .viewport.list .scroller {\n flex-direction: column;\n align-items: stretch;\n gap: var(--vio-carousel-list-gap, 32px);\n max-width: var(--vio-carousel-list-max-width, 480px);\n margin: 0 auto;\n padding: 0 var(--vio-space-lg, 24px);\n overflow: visible;\n scroll-snap-type: none;\n }\n .viewport.list .scroller vio-product,\n .viewport.list ::slotted(*),\n .viewport.list .skeleton { flex: 0 0 auto; width: 100%; }\n .viewport.list .nav-btn { display: none; }\n ::slotted(*),\n vio-product {\n flex: 0 0 240px;\n scroll-snap-align: start;\n }\n @media (max-width: 600px) {\n ::slotted(*),\n vio-product {\n /* Two complete cards per screen (+ a sliver of the next), matching the\n reference: card = (viewport − side padding − gap) / 2. */\n flex: 0 0 calc((100vw - 64px) / 2);\n }\n }\n\n .nav-btn {\n position: absolute;\n top: 30%;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n background: #fff;\n border: none;\n box-shadow: 0 2px 14px rgba(0, 0, 0, 0.1);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n color: #0a0a0a;\n z-index: 2;\n transition: background 0.15s, transform 0.15s;\n font-family: inherit;\n padding: 0;\n }\n .nav-btn:hover { background: #fafafa; transform: scale(1.05); }\n .nav-btn:active { transform: scale(0.98); }\n .nav-btn.prev { left: 8px; }\n .nav-btn.next { right: 8px; }\n @media (max-width: 600px) {\n .nav-btn { display: none; }\n }\n\n .state {\n padding: 60px var(--vio-space-lg, 24px);\n text-align: center;\n color: var(--vio-color-text-secondary, #666);\n font-size: 14px;\n }\n .state.error { color: var(--vio-color-accent, #c14a3b); }\n .skeleton {\n flex: 0 0 240px;\n scroll-snap-align: start;\n }\n .skeleton-image {\n aspect-ratio: 1 / 1;\n background: var(--vio-color-surface-muted, #f2f2f2);\n animation: vio-pulse 1.6s ease-in-out infinite;\n }\n .skeleton-text {\n height: 12px;\n background: var(--vio-color-surface-muted, #f2f2f2);\n margin-top: 12px;\n animation: vio-pulse 1.6s ease-in-out infinite;\n }\n .skeleton-text.shorter { width: 60%; }\n @keyframes vio-pulse {\n 0%,\n 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n `\n\n private overrideFor(p: Product): string | undefined {\n const own = this.descriptions?.[String(p.id)]\n return typeof own === 'string' ? own : undefined\n }\n\n private descriptionFor(p: Product): string {\n return this.overrideFor(p) ?? cardDescription(p.description)\n }\n\n /** The editor's text always shows (unless empty); the catalogue's only with show-description. */\n private showsDescription(p: Product): boolean {\n const own = this.overrideFor(p)\n return own !== undefined ? own.trim() !== '' : this.showDescription\n }\n\n override willUpdate(changed: Map<string, unknown>): void {\n if (changed.has('layout') || !this.hasUpdated) {\n const fromTheme = typeof getComputedStyle === 'function' ? getComputedStyle(this).getPropertyValue('--vio-carousel-layout') : ''\n const value = (this.layout || fromTheme).trim().replace(/^[\"']|[\"']$/g, '').toLowerCase()\n this.resolvedLayout = value === 'list' ? 'list' : 'carousel'\n }\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.slotRegistration.connect(this.slotAttributes())\n if (this.productRefs.trim() || this.productIds.trim()) {\n void this.autoFetch()\n }\n // After the fetch has started: while products load, the impression waits for them.\n this.observeForAnalytics()\n }\n\n override disconnectedCallback(): void {\n this.unobserveImpression?.()\n this.unobserveImpression = null\n this.slotRegistration.clear()\n super.disconnectedCallback()\n }\n\n override updated(changed: Map<string, unknown>): void {\n // The React wrappers set properties after mount; the Vev editor changes them live.\n if (changed.has('vioSlot') || changed.has('vioSlotName') || changed.has('vioScope') || changed.has('vioScopeName') || changed.has('vioCampaign')) {\n this.slotRegistration.sync(this.slotAttributes())\n }\n const propChanged =\n changed.has('productRefs') ||\n changed.has('productIds') ||\n changed.has('commerceKey') ||\n changed.has('sponsorId') ||\n changed.has('vioSlot') ||\n changed.has('vioCampaign') // another campaign → another sponsor → refetch\n if (propChanged && (this.productRefs.trim() || this.productIds.trim())) {\n void this.autoFetch()\n }\n }\n\n /**\n * The sponsor of this carousel: the host's `sponsor-id`, else the primary\n * sponsor of the campaign the slot shows (ADR-0034 — \"the campaign of the\n * block is its sponsor\"), else 0 (unknown).\n */\n /**\n * The campaign whose channel sells a sponsor's products here (one article =\n * one campaign = one channel): the campaign this slot credits for that\n * sponsor (`Vio.attribution`), then the element's own (`vio-campaign`, an\n * ancestor's `data-vio-campaign`).\n */\n private commerceCampaigns(sponsorId: number): number[] {\n const own = this.slotRegistration.campaignHint\n try {\n const resolved =\n typeof Vio.attribution === 'function'\n ? Vio.attribution(this.effectiveSlot || null, { sponsorId, campaignId: own }).campaignId\n : undefined\n return resolved !== undefined ? [resolved, ...own] : own\n } catch {\n return own\n }\n }\n\n private effectiveSponsorId(): number {\n if (this.sponsorId > 0) return this.sponsorId\n const fromSlot =\n typeof Vio.campaignForSlot === 'function'\n ? Number(Vio.campaignForSlot(this.effectiveSlot || null, { campaignId: this.slotRegistration.campaignHint })?.primarySponsor?.id)\n : NaN\n return Number.isFinite(fromSlot) && fromSlot > 0 ? fromSlot : 0\n }\n\n private async autoFetch(): Promise<void> {\n if (!Vio.isInitialized) {\n this.fetchError = 'Vio not initialized — call Vio.init({ apiKey }) first'\n return\n }\n this.isLoading = true\n this.fetchError = ''\n // The impression carries the products shown: one not counted yet starts\n // again once they are here (the dwell counts on what the reader sees).\n if (!this.impressed) {\n this.unobserveImpression?.()\n this.unobserveImpression = null\n }\n try {\n // Without a sponsor-id the slot's campaign supplies the sponsor — that\n // needs the bootstrap, which the host may still be fetching.\n if (this.productRefs.trim() === '' && !this.commerceKey && this.sponsorId <= 0 && !Vio.bootstrapCache) {\n try {\n await Vio.bootstrap()\n } catch {\n /* commerceFor() below reports the missing sponsor as before */\n }\n }\n const sponsorId = this.effectiveSponsorId()\n const refs = this.productRefs.trim()\n ? this.parseRefs(this.productRefs)\n : this.productIds\n .split(',')\n .map((s) => parseInt(s.trim(), 10))\n .filter((n) => !Number.isNaN(n))\n .map((id) => ({ sponsorId, productId: id }))\n\n if (refs.length === 0) {\n this.fetched = []\n return\n }\n\n // Group by sponsorId so we can issue one GraphQL request per sponsor.\n const bySponsor = new Map<number, number[]>()\n for (const r of refs) {\n const arr = bySponsor.get(r.sponsorId) ?? []\n arr.push(r.productId)\n bySponsor.set(r.sponsorId, arr)\n }\n\n const fetched = await Promise.all(\n Array.from(bySponsor.entries()).map(async ([sponsorId, ids]) => {\n const commerce =\n this.commerceKey && this.productRefs.trim() === ''\n ? Vio.commerceWithKey(this.commerceKey)\n : Vio.commerceFor(sponsorId, { campaignId: this.commerceCampaigns(sponsorId) })\n const products = await commerce.channel.product.getByIds({\n product_ids: ids,\n currency: this.currency,\n image_size: 'large',\n })\n return { sponsorId, products }\n }),\n )\n\n // Index for O(1) lookup, then re-emit in original ref order.\n const lookup = new Map<string, Product>()\n for (const { sponsorId, products } of fetched) {\n for (const p of products) lookup.set(`${sponsorId}:${p.id}`, p)\n }\n this.fetched = refs\n .map(({ sponsorId, productId }) => {\n const product = lookup.get(`${sponsorId}:${productId}`)\n return product ? { product, sponsorId } : null\n })\n .filter((x): x is { product: Product; sponsorId: number } => x !== null)\n this.maybeTrackList()\n } catch (err) {\n this.fetchError = err instanceof Error ? err.message : String(err)\n // Keep `fetched` null so slotted fallback can still render.\n } finally {\n this.isLoading = false\n this.observeForAnalytics()\n }\n }\n\n // ── Analytics (auto) ──────────────────────────────────────────────\n // component_impression on the contract rule (≥50% visible ≥1s, once per\n // session) with the products shown in `commerce.items` (ADR-0041: the\n // collector counts per-product impressions from them) + view_item_list with\n // the rendered products. While products load the impression is not\n // observed: it starts once they are here (or the fetch failed — slotted\n // fallback is still an impression, without items). No-ops unless\n // Vio.analytics.start() ran.\n private unobserveImpression: (() => void) | null = null\n private impressed = false\n private listTracked = false\n\n private observeForAnalytics(): void {\n if (this.unobserveImpression || this.isLoading || !this.isConnected) return\n try {\n this.unobserveImpression = Vio.analytics.observeImpression(\n this,\n {\n sponsorId: this.sponsorId > 0 ? this.sponsorId : undefined,\n // The slot is the real location id; the label only stands in for it.\n locationId: this.effectiveSlot || this.label || undefined,\n ...this.attribution(),\n },\n {\n key: `carousel:${this.effectiveSlot || this.label || this.productIds || this.productRefs || 'default'}`,\n onImpression: () => {\n this.impressed = true\n this.maybeTrackList()\n },\n commerce: () => this.listCommerce(),\n },\n )\n } catch {\n /* analytics must never break rendering */\n }\n }\n\n /** view_item_list needs BOTH the viewport dwell and loaded products —\n * whichever lands last fires it (once). */\n private maybeTrackList(): void {\n if (!this.impressed || this.listTracked) return\n const entries = this.fetched ?? []\n if (entries.length === 0) return\n this.listTracked = true\n try {\n const sponsorId = this.effectiveSponsorId()\n Vio.analytics.track('view_item_list', {\n context: {\n sponsorId: sponsorId > 0 ? sponsorId : undefined,\n locationId: this.effectiveSlot || this.label || undefined,\n ...this.attribution(),\n },\n commerce: this.listCommerce() ?? undefined,\n props: this.label ? { list_name: this.label } : undefined,\n })\n } catch {\n /* never break rendering */\n }\n }\n\n /** The products on show as analytics lines (impression and view_item_list); null before they load. */\n private listCommerce(): AnalyticsCommerce | null {\n const entries = this.fetched ?? []\n if (entries.length === 0) return null\n return {\n items: entries.map(({ product }) => ({\n productId: product.id,\n name: product.title,\n price: Number(product.price?.amount_incl_taxes ?? product.price?.amount) || undefined,\n })),\n currency: entries[0]?.product.price?.currency_code,\n }\n }\n\n private parseRefs(raw: string): Array<{ sponsorId: number; productId: number }> {\n return raw\n .split(',')\n .map((pair) => pair.trim())\n .filter((s) => s.length > 0)\n .map((pair) => {\n const [sidStr, pidStr] = pair.split(':')\n const sid = parseInt((sidStr ?? '').trim(), 10)\n const pid = parseInt((pidStr ?? '').trim(), 10)\n if (Number.isNaN(sid) || Number.isNaN(pid)) return null\n return { sponsorId: sid, productId: pid }\n })\n .filter((x): x is { sponsorId: number; productId: number } => x !== null)\n }\n\n private scrollByDirection(direction: 1 | -1): void {\n if (!this.scroller) return\n const item = this.scroller.querySelector(':scope > *') as HTMLElement | null\n const step = (item?.offsetWidth ?? 240) + 16\n this.scroller.scrollBy({ left: direction * step * 2, behavior: 'smooth' })\n }\n\n private renderScrollerContent() {\n if (this.isLoading && !this.fetched) {\n // Skeleton cards while fetching.\n return html`${Array.from({ length: 5 }).map(\n () => html`\n <div class=\"skeleton\">\n <div class=\"skeleton-image\"></div>\n <div class=\"skeleton-text\"></div>\n <div class=\"skeleton-text shorter\"></div>\n </div>\n `,\n )}`\n }\n if (this.fetched && this.fetched.length > 0) {\n return html`${this.fetched.map(({ product: p, sponsorId }) => {\n const img = primaryImageUrl(p) ?? ''\n const retailer = resolveSponsorIdentity(sponsorId)?.name || p.brand || ''\n return html`\n <vio-product\n product-id=${String(p.id)}\n sponsor-id=${String(sponsorId)}\n brand=${p.brand ?? ''}\n name=${p.title}\n price=${displayPrice(p)}\n retailer=${retailer}\n description=${this.descriptionFor(p)}\n ?show-description=${this.showsDescription(p)}\n button-style=${this.buttonStyle}\n button-label=${this.buttonLabel}\n image-url=${img}\n ?has-variants=${(p.variants?.length ?? 0) > 1}\n .vioSlot=${this.effectiveSlot}\n .componentTemplateId=${'product-carousel'}\n .vioCampaign=${this.effectiveCampaignId !== undefined ? String(this.effectiveCampaignId) : ''}\n .vioContentId=${this.vioContentId}\n .vioContentTitle=${this.vioContentTitle}\n ></vio-product>\n `\n })}`\n }\n // Fallback to slotted children (manual mode) — also used when fetch fails.\n return html`<slot></slot>`\n }\n\n override render() {\n return html`\n <div class=\"header\">\n <div class=\"header-text\">\n ${this.label ? html`<div class=\"label\">${this.label}</div>` : ''}\n <div class=\"heading-row\">\n ${this.heading ? html`<h2 class=\"heading\">${this.heading}</h2>` : ''}\n ${this.disclaimer ? html`<span class=\"disclaimer\">(${this.disclaimer})</span>` : ''}\n </div>\n </div>\n ${this.seeAllHref\n ? html`<a class=\"see-all\" href=${this.seeAllHref}>${this.seeAllLabel}</a>`\n : ''}\n </div>\n <div class=\"viewport ${this.resolvedLayout}\">\n <button\n class=\"nav-btn prev\"\n @click=${() => this.scrollByDirection(-1)}\n aria-label=\"Forrige\"\n >\n ‹\n </button>\n <div class=\"scroller\">${this.renderScrollerContent()}</div>\n <button\n class=\"nav-btn next\"\n @click=${() => this.scrollByDirection(1)}\n aria-label=\"Neste\"\n >\n ›\n </button>\n </div>\n ${this.fetchError && !this.fetched\n ? html`<div class=\"state error\">${this.fetchError}</div>`\n : ''}\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vio-product-carousel': VioProductCarousel\n }\n}\n\n/** The product's description as one plain-text paragraph for a card (the card clamps it). */\nfunction cardDescription(description: string | null | undefined): string {\n if (!description) return ''\n return description\n .replace(/<[^>]+>/g, ' ')\n .replace(/ /g, ' ')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\\s+/g, ' ')\n .trim()\n}\n","/**\n * The hand-over to a payment page (Vipps today) — what the shopper sees\n * between the tap and the provider, and what the host hears.\n *\n * The detail, the cart and the checkout close or wait while the SDK asks the\n * backend for the provider's URL; on a phone that used to be an empty\n * moment, and a second tap could start a second payment (Mote & Livsstil,\n * 2026-10-22). Now, at the tap:\n *\n * - `vio:payment-redirect-start` — `{ method, sponsorId, source }`, on\n * `document`, **cancelable**: a host that calls `preventDefault()` draws\n * its own loader and the SDK draws none.\n * - otherwise the SDK's overlay: full screen, «Åpner Vipps …», a soft fade,\n * and it takes every tap (no double start). Styled with\n * `--vio-redirect-bg`, `--vio-redirect-color`, `--vio-redirect-spinner`\n * and `--vio-redirect-font`; class `vio-redirect-overlay`.\n *\n * Then exactly one of:\n * - the page leaves for the provider — the overlay stays until it does;\n * - `vio:payment-redirect-error` — `{ method, sponsorId, source, reason }`:\n * the payment could not start; the overlay goes and the caller shows a\n * usable view (the checkout with the method preselected);\n * - `vio:payment-redirect-cancel` — `{ method, sponsorId, source, reason }`:\n * the caller stopped without an error (`'not-started'`, e.g. Express off\n * for that seller, so the checkout opens instead), or the shopper came\n * back from the provider with the browser's back button (`'back'`; the\n * page is restored from the back-forward cache with the overlay still\n * on). A return through the provider's own cancel is the checkout's\n * (`returnCancelled`, below).\n */\n\nexport type PaymentRedirectSource = 'detail' | 'cart' | 'checkout'\n\nexport interface PaymentRedirectDetail {\n method: string\n sponsorId?: number\n source: PaymentRedirectSource\n}\n\nexport interface PaymentRedirectHandle {\n /** The payment could not start: error event, overlay removed. */\n fail(reason: string): void\n /** Stopped on purpose (another way in follows): cancel event, overlay removed. */\n abort(reason?: string): void\n}\n\nconst OVERLAY_CLASS = 'vio-redirect-overlay'\nconst STYLE_ID = 'vio-redirect-overlay-style'\n\nconst LABEL: Record<string, string> = { vipps: 'Vipps', stripe: 'Stripe', klarna: 'Klarna' }\n\nfunction emit(name: string, detail: object, cancelable = false): boolean {\n if (typeof document === 'undefined') return true\n return document.dispatchEvent(new CustomEvent(name, { detail, cancelable }))\n}\n\nfunction injectStyle(): void {\n if (document.getElementById(STYLE_ID)) return\n const style = document.createElement('style')\n style.id = STYLE_ID\n style.textContent = `\n.${OVERLAY_CLASS} {\n position: fixed; inset: 0; z-index: 2147483000;\n display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;\n background: var(--vio-redirect-bg, rgba(255, 255, 255, 0.94));\n color: var(--vio-redirect-color, var(--vio-color-text, #0a0a0a));\n font: 600 16px/1.3 var(--vio-redirect-font, var(--vio-font-sans, -apple-system, sans-serif));\n opacity: 0; transition: opacity 0.18s ease; cursor: progress;\n}\n.${OVERLAY_CLASS}.is-shown { opacity: 1; }\n.${OVERLAY_CLASS} .vio-redirect-spinner {\n width: 36px; height: 36px; border-radius: 50%;\n border: 3px solid rgba(0, 0, 0, 0.1); border-top-color: var(--vio-redirect-spinner, #ff5b24);\n animation: vio-redirect-spin 0.8s linear infinite;\n}\n@keyframes vio-redirect-spin { to { transform: rotate(360deg); } }\n@media (prefers-reduced-motion: reduce) {\n .${OVERLAY_CLASS} { transition: none; }\n .${OVERLAY_CLASS} .vio-redirect-spinner { animation: none; }\n}`\n document.head.appendChild(style)\n}\n\nlet current: { el: HTMLElement | null; detail: PaymentRedirectDetail; settled: boolean } | null = null\n\nfunction removeOverlay(): void {\n const el = current?.el\n if (!el) return\n el.classList.remove('is-shown')\n setTimeout(() => el.remove(), 200)\n current!.el = null\n}\n\n/** Back from the provider with the browser's back button: the page comes back from the bfcache as it was left. */\nfunction onPageShow(e: PageTransitionEvent): void {\n if (!e.persisted || !current || current.settled) return\n current.settled = true\n removeOverlay()\n emit('vio:payment-redirect-cancel', { ...current.detail, reason: 'back' })\n current = null\n}\n\n/**\n * The tap that will leave for a payment page. Emits the start event and,\n * unless the host took over, shows the overlay. Call `fail` or `abort` on the\n * handle when the page is not going to leave after all; leaving needs nothing.\n */\nexport function beginPaymentRedirect(detail: PaymentRedirectDetail): PaymentRedirectHandle {\n if (current && !current.settled) {\n // A second hand-over replaces the first (the first is over: same page, one payment).\n current.settled = true\n removeOverlay()\n }\n const hostTookOver = !emit('vio:payment-redirect-start', detail, true)\n const state = { el: null as HTMLElement | null, detail, settled: false }\n current = state\n if (!hostTookOver && typeof document !== 'undefined' && document.body) {\n injectStyle()\n const el = document.createElement('div')\n el.className = OVERLAY_CLASS\n el.setAttribute('role', 'status')\n el.setAttribute('aria-live', 'polite')\n const spinner = document.createElement('div')\n spinner.className = 'vio-redirect-spinner'\n spinner.setAttribute('aria-hidden', 'true')\n const text = document.createElement('div')\n text.className = 'vio-redirect-text'\n text.textContent = `Åpner ${LABEL[detail.method] ?? detail.method} …`\n el.append(spinner, text)\n // Every tap lands here and goes nowhere: no second payment.\n el.addEventListener('click', (e) => e.stopPropagation())\n document.body.appendChild(el)\n requestAnimationFrame(() => el.classList.add('is-shown'))\n state.el = el\n }\n if (typeof window !== 'undefined') window.addEventListener('pageshow', onPageShow)\n const settle = (event: string, reason: string) => {\n if (state.settled) return\n state.settled = true\n if (current === state) {\n removeOverlay()\n current = null\n } else if (state.el) {\n state.el.remove()\n }\n emit(event, { ...detail, reason })\n }\n return {\n fail: (reason) => settle('vio:payment-redirect-error', reason),\n abort: (reason = 'not-started') => settle('vio:payment-redirect-cancel', reason),\n }\n}\n\n/** The shopper came back through the provider's own cancel (the checkout's return path). */\nexport function returnCancelled(detail: PaymentRedirectDetail & { checkoutId?: string }): void {\n emit('vio:payment-redirect-cancel', { ...detail, reason: 'cancelled' })\n}\n","/**\n * How the Vipps buttons of `<vio-cart>` and `<vio-product-detail>` pay a\n * cart that has (or will have) lines in it:\n *\n * - `'express'` (default, 2026-10-29): Vipps Express for the sponsor's WHOLE\n * cart — the app fills in name, address and delivery. The cart's black\n * «Til kassen» button is the way into our checkout.\n * - `'checkout'`: the behaviour of 0.31–0.34 — the cart's Vipps button, and\n * the detail's when the cart already has lines, open our checkout with\n * Vipps preselected (`vio:checkout-open`, the standard Vipps payment).\n *\n * The element's `vipps-cart-payment` attribute wins; else the theme's\n * `vippsCartPayment` (`--vio-vipps-cart-payment`); else `'express'`.\n */\n\nexport type VippsCartPayment = 'express' | 'checkout'\n\nexport const VIPPS_CART_PAYMENT_VAR = '--vio-vipps-cart-payment'\n\nexport function resolveVippsCartPayment(el: Element, own: string | null | undefined): VippsCartPayment {\n let fromTheme = ''\n if (!own) {\n try {\n fromTheme = typeof getComputedStyle === 'function' ? getComputedStyle(el).getPropertyValue(VIPPS_CART_PAYMENT_VAR) : ''\n } catch {\n fromTheme = ''\n }\n }\n const value = String(own || fromTheme || '')\n .trim()\n .replace(/^[\"']|[\"']$/g, '')\n .toLowerCase()\n return value === 'checkout' ? 'checkout' : 'express'\n}\n","/**\n * What kind of thing each payment method is — in ONE place.\n *\n * This exists because the answer used to be spelled out by hand wherever it\n * was needed: `methodEnabled` was reimplemented in three components with three\n * slightly different signatures, and the list `kustom | qliro | walley`\n * appeared in five separate places in the checkout alone plus the product\n * page. Adding a method meant remembering all of them.\n *\n * Nobody remembered. On 2026-09-08 the same omission produced two separate\n * defects: the cart footer had no button at all for a channel offering only an\n * embedded checkout, and the product page had no buy button for the same\n * reason — the same mistake, twice, in two files. A code review the same day\n * named this as the mechanism.\n *\n * So: adding a payment method should mean editing this file, and the type\n * checker should find the rest.\n */\n\n/** Backend names arrive as \"Apple Pay\", \"Qliro\", \"STRIPE\" — compare letters. */\nexport function normalizeMethodName(name: string): string {\n return String(name ?? '')\n .toLowerCase()\n .replace(/[^a-z]/g, '')\n}\n\n/**\n * Methods whose provider runs the whole purchase inside its own widget:\n * address, shipping, email AND payment.\n *\n * Two consequences follow, and both were defects before this list existed:\n * they have no branded express button, so a page offering only these needs a\n * generic \"go to checkout\" CTA; and our delivery-address form is pointless\n * when every offered method is one of them.\n */\nexport const EMBEDDED_METHODS = ['kustom', 'qliro', 'walley', 'nexi'] as const\n\n/**\n * Methods whose provider renders ONLY the payment inside our page, after the\n * shopper filled our own form and picked our shipping. Adyen's Drop-in lists\n * cards, Vipps, Klarna… and charges; it collects no email, address or\n * shipping. So these are NOT embedded checkouts: the delivery-address form\n * stays, and the widget is created with the final amount.\n */\nexport const FORM_FIRST_WIDGET_METHODS = ['adyen'] as const\n\n/**\n * Methods with no branded express button of their own. A page offering only\n * these needs the generic \"buy now\" / \"go to checkout\" CTA, or it has no way\n * into the checkout at all (the defect of 2026-09-08, for every new method).\n */\nexport const NO_EXPRESS_BUTTON_METHODS = [\n ...EMBEDDED_METHODS,\n ...FORM_FIRST_WIDGET_METHODS,\n] as const\n\n/**\n * Methods that collect the shipping address themselves: the embedded ones.\n *\n * Vipps is NOT among them in the checkout (Mote & Livsstil, 2026-10-28): the\n * checkout is the standard Vipps path — our form collects name, address,\n * mobile and the delivery (with its price) before paying, and the payment is\n * a plain one (`express: false`). Vipps Express — the app filling in name and\n * address — is the product detail's «Kjøp nå med Vipps» only. Express is a\n * mode of Vipps, announced by Vio Commerce as `config.express` on the method\n * (`Vio.checkout.getVippsExpressEnabled()`), not a method of its own.\n */\nexport const COLLECTS_OWN_ADDRESS = [...EMBEDDED_METHODS] as const\n\n/** Runs inside its own widget in our page (no branded express button). */\nexport const isEmbeddedMethod = (name: string): boolean =>\n (EMBEDDED_METHODS as readonly string[]).includes(normalizeMethodName(name))\n\n/** Renders only the payment, after our own form (no address of its own). */\nexport const isFormFirstWidgetMethod = (name: string): boolean =>\n (FORM_FIRST_WIDGET_METHODS as readonly string[]).includes(normalizeMethodName(name))\n\n/** Asks the shopper for their address itself, so our form would ask twice. */\nexport const collectsOwnAddress = (name: string): boolean =>\n (COLLECTS_OWN_ADDRESS as readonly string[]).includes(normalizeMethodName(name))\n\n/**\n * Is `name` among the methods the channel offers?\n *\n * `available === null` means \"we do not know\" — either not asked yet or the\n * lookup failed — and answers `true` for everything, so a backend blip shows\n * too many methods rather than none and nobody is blocked from paying. The\n * caller decides whether \"do not know\" should render a spinner instead; see\n * `paymentMethodsResolved` in vio-checkout.\n *\n * Several names match if any of them does: some call sites pass both spellings\n * of a method (`'apple-pay'`, `'applepay'`).\n */\nexport function isMethodEnabled(\n available: string[] | null,\n ...names: string[]\n): boolean {\n if (available === null) return true\n return available.some((m) =>\n names.some((n) => normalizeMethodName(m) === normalizeMethodName(n)),\n )\n}\n","/**\n * Keyboard and focus for the SDK's dialogs — <vio-product-detail>, <vio-cart>\n * and <vio-checkout>.\n *\n * Each renders a `role=\"dialog\"` with a close button, and until 2026-10-09\n * nothing managed focus: a keyboard user pressed Enter on a product card, the\n * detail opened, and focus stayed on the page behind — Tab never entered the\n * dialog, Escape did nothing. A QA tester could not complete a purchase by\n * keyboard.\n *\n * One instance per component, driven from its `updated()` whenever `open`\n * changed:\n *\n * - opening remembers the element that had focus (the opener) and moves\n * focus into the dialog: its first tabbable element, which is the close\n * button — or the container itself (`tabindex=\"-1\"`) when there is none;\n * - while open, a `keydown` listener on the host closes on Escape (unless\n * the component says it cannot close right now: a payment in flight) and\n * keeps Tab / Shift+Tab cycling inside the dialog;\n * - closing removes the listener and gives focus back to the opener, if it\n * is still in the document.\n *\n * \"Inside the dialog\" is the COMPOSED tree: the components render into a\n * shadow root, the checkout projects the third-party widgets from its light\n * DOM through named slots (see `lightContainer` there), and Vipps' own button\n * is a web component of its own. Slots are followed into their assigned\n * elements, and open shadow roots are walked.\n *\n * Two document-level guards complete the trap, both for Safari (QA\n * 2026-10-12): its native Tab order skips buttons, so focus leaving a\n * third-party iframe (Stripe's payment element) landed on the page's next\n * text field instead of our pay button, and a re-render that dropped focus\n * on the body left Tab wandering the page. `focusin` outside the host pulls\n * focus back to the element next to the one that had it; Tab pressed outside\n * the host enters the dialog. Another OPEN Vio dialog is left alone: in Vev\n * the cart view opens on top of the checkout, outside this component.\n */\n\nexport interface DialogFocusOptions {\n /** The component. The keydown listener lives on it; its render root holds the dialog. */\n host: HTMLElement\n /** The dialog container (`role=\"dialog\"`), looked up on every use — Lit re-renders it. */\n container: () => HTMLElement | null\n /** What Escape does: the component's `close()`. */\n close: () => void\n /** Answer false while the dialog must stay open (a payment in flight): Escape is then ignored. */\n canClose?: () => boolean\n}\n\nexport class DialogFocus {\n private opener: Element | null = null\n private active = false\n /** The element inside the dialog that had focus last — where a pull-back continues from. */\n private lastInside: HTMLElement | null = null\n\n constructor(private readonly opts: DialogFocusOptions) {}\n\n /**\n * Call from `updated()` when `open` changed. Lit reports `open` as changed\n * on the first render too (from undefined to its initial value): with the\n * same value twice this is a no-op, so that first call does nothing.\n */\n update(open: boolean): void {\n if (open === this.active) return\n this.active = open\n if (open) this.opened()\n else this.closed()\n }\n\n private opened(): void {\n this.opener = deepActiveElement()\n this.lastInside = null\n this.opts.host.addEventListener('keydown', this.onKeydown)\n document.addEventListener('focusin', this.onFocusIn, true)\n document.addEventListener('keydown', this.onDocumentKeydown, true)\n const container = this.opts.container()\n if (container) focusInto(container)\n }\n\n private closed(): void {\n this.opts.host.removeEventListener('keydown', this.onKeydown)\n document.removeEventListener('focusin', this.onFocusIn, true)\n document.removeEventListener('keydown', this.onDocumentKeydown, true)\n const opener = this.opener\n this.opener = null\n // The shopper may have moved on already (another dialog, the page): then\n // focus is theirs. Otherwise it sits on an element about to leave the\n // screen — give it back to the opener, or at least let go of it.\n const active = deepActiveElement()\n if (!active || !isWithin(active, this.opts.host)) return\n if (opener && opener.isConnected && isRestorable(opener)) {\n focusElement(opener)\n } else if (active instanceof HTMLElement) {\n active.blur()\n }\n }\n\n private onKeydown = (e: KeyboardEvent): void => {\n if (e.defaultPrevented) return\n if (e.key === 'Escape' || e.key === 'Esc') {\n if (this.opts.canClose && !this.opts.canClose()) return\n e.preventDefault()\n e.stopPropagation()\n this.opts.close()\n return\n }\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) return\n const container = this.opts.container()\n if (!container) return\n const items = tabbableIn(container)\n if (items.length === 0) {\n e.preventDefault()\n focusElement(container)\n return\n }\n const active = deepActiveElement()\n const index = active ? items.indexOf(active as HTMLElement) : -1\n // Every Tab is ours, not only the wrap at the ends. Safari does not put\n // buttons and links in its Tab order unless the shopper switched on\n // \"Press Tab to highlight each item\" (off by default): left to the\n // browser, Tab from the close button skipped the whole dialog and landed\n // on the page's next text field (QA, 2026-10-12). Chrome and Edge visit\n // buttons natively, so there it looked fine.\n e.preventDefault()\n const count = items.length\n const next =\n index === -1\n ? e.shiftKey\n ? count - 1\n : 0\n : (index + (e.shiftKey ? -1 : 1) + count) % count\n focusElement(items[next]!)\n }\n\n /**\n * Focus moved somewhere. Inside the dialog: remember where. Into another\n * open Vio dialog: theirs. Onto the page: the browser walked out of the\n * dialog on its own (Safari leaving a widget iframe) — continue from the\n * element that had focus, backwards when the page element sits before\n * the host in document order.\n */\n private onFocusIn = (e: FocusEvent): void => {\n // A host that left the document without closing (torn down) must not keep pulling.\n if (!this.opts.host.isConnected) return\n const path = e.composedPath()\n if (path.includes(this.opts.host)) {\n const active = deepActiveElement()\n this.lastInside = active instanceof HTMLElement ? active : null\n return\n }\n if (path.some((n) => isOpenVioDialog(n, this.opts.host))) return\n const container = this.opts.container()\n if (!container) return\n const items = tabbableIn(container)\n if (items.length === 0) {\n focusElement(container)\n return\n }\n const target = e.target instanceof Node ? e.target : null\n const backwards = !!target && precedes(target, this.opts.host)\n const index = this.lastInside ? items.indexOf(this.lastInside) : -1\n const count = items.length\n const next = backwards\n ? index <= 0\n ? count - 1\n : index - 1\n : index === -1 || index === count - 1\n ? 0\n : index + 1\n focusElement(items[next]!)\n }\n\n /** Tab pressed while focus is on the page (or the body): enter the dialog. */\n private onDocumentKeydown = (e: KeyboardEvent): void => {\n if (!this.opts.host.isConnected) return\n if (e.defaultPrevented || e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) return\n const active = deepActiveElement()\n if (active && isWithin(active, this.opts.host)) return\n if (active && hasOpenVioDialogAbove(active, this.opts.host)) return\n const container = this.opts.container()\n if (!container) return\n e.preventDefault()\n e.stopPropagation()\n const items = tabbableIn(container)\n focusElement(items.length === 0 ? container : e.shiftKey ? items[items.length - 1]! : items[0]!)\n }\n}\n\n/** One of our dialogs, open, other than `host`. */\nfunction isOpenVioDialog(node: EventTarget, host: Element): boolean {\n return node instanceof Element && node !== host && node.tagName.startsWith('VIO-') && node.hasAttribute('open')\n}\n\nfunction hasOpenVioDialogAbove(node: Node, host: Element): boolean {\n let n: Node | null = node\n while (n) {\n if (isOpenVioDialog(n, host)) return true\n n = n.parentNode ?? (n instanceof ShadowRoot ? n.host : null)\n }\n return false\n}\n\n/** Does `a` come before `b` in document order? (Disconnected trees count as after.) */\nfunction precedes(a: Node, b: Node): boolean {\n return (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0\n}\n\n/**\n * The element that really has focus: `document.activeElement` stops at a\n * shadow host, this follows it down through open shadow roots.\n */\nexport function deepActiveElement(): Element | null {\n if (typeof document === 'undefined') return null\n let el: Element | null = document.activeElement\n while (el?.shadowRoot?.activeElement) el = el.shadowRoot.activeElement\n return el\n}\n\nconst TABBABLE_CANDIDATES =\n 'a[href], area[href], button, input, select, textarea, iframe, summary, [tabindex], [contenteditable]'\n\n/**\n * The elements Tab can reach inside `container`, in the order the browser\n * visits them: the composed tree, so slotted content is taken where its slot\n * is and open shadow roots are looked into.\n */\nexport function tabbableIn(container: Element): HTMLElement[] {\n const out: HTMLElement[] = []\n walkChildren(container, out)\n return out\n}\n\nfunction walkChildren(parent: Element | ShadowRoot, out: HTMLElement[]): void {\n for (const child of Array.from(parent.children)) {\n if (child instanceof HTMLSlotElement) {\n // What a slot shows is its assigned elements; its own children only\n // when nothing is assigned (fallback content).\n const assigned = child.assignedElements({ flatten: true })\n if (assigned.length > 0) {\n for (const el of assigned) visit(el, out)\n continue\n }\n }\n visit(child, out)\n }\n}\n\nfunction visit(el: Element, out: HTMLElement[]): void {\n if (isTabbable(el)) out.push(el)\n // A shadow root replaces the light children on screen — they only show\n // through its slots, which walkChildren follows.\n if (el.shadowRoot) walkChildren(el.shadowRoot, out)\n else walkChildren(el, out)\n}\n\nfunction isTabbable(el: Element): el is HTMLElement {\n if (!(el instanceof HTMLElement) || !el.matches(TABBABLE_CANDIDATES)) return false\n const tabindex = el.getAttribute('tabindex')\n if (tabindex !== null && Number(tabindex) < 0) return false\n if (el.hasAttribute('disabled')) return false\n if (el instanceof HTMLInputElement && el.type === 'hidden') return false\n if (el.getAttribute('contenteditable') === 'false' && !el.matches('a[href], button, input, select, textarea, iframe, [tabindex]')) return false\n if (el.hidden || el.getAttribute('aria-hidden') === 'true') return false\n // Not rendered (display: none somewhere up the tree). jsdom has no layout\n // and no checkVisibility: there everything counts, which is fine for tests.\n if (typeof el.checkVisibility === 'function' && !el.checkVisibility()) return false\n return true\n}\n\nfunction focusInto(container: HTMLElement): void {\n const first = tabbableIn(container)[0]\n focusElement(first ?? container)\n}\n\nfunction focusElement(el: HTMLElement): void {\n // The dialog is a fixed panel sliding in: nothing to scroll the page for.\n el.focus({ preventScroll: true })\n}\n\n/** The opener is worth focusing again — the page's body is not. */\nfunction isRestorable(el: Element): el is HTMLElement {\n return el instanceof HTMLElement && el !== document.body && el !== document.documentElement\n}\n\n/** Is `node` inside `ancestor` in the composed tree (through shadow roots and slots)? */\nfunction isWithin(node: Node, ancestor: Node): boolean {\n let n: Node | null = node\n while (n) {\n if (n === ancestor) return true\n n = n.parentNode ?? (n instanceof ShadowRoot ? n.host : null)\n }\n return false\n}\n","/**\n * The phone behaviour of the SDK's sheets — <vio-product-detail>, <vio-cart>\n * and <vio-checkout> — while they are bottom sheets (≤ 600px wide).\n *\n * Two things the shopper expects from a sheet and did not get (Angelo,\n * 2026-10-22):\n *\n * - **The page behind stays put.** With the sheet open, a swipe that ran\n * past the end of the sheet scrolled the article underneath. While any\n * sheet is open the page is locked: `position: fixed` on the body at the\n * current offset (`overflow: hidden` alone does not stop iOS Safari), and\n * on release the body gets its own styles back and the page returns to\n * the same place. The lock is counted: the detail and the checkout can be\n * open at once, and the page unlocks when the last one closes.\n * - **Pull down to close.** The grab bar on top of the sheet only answered\n * a tap: pulling it scrolled the sheet instead. Now a drag that starts on\n * the grab bar or the sheet's top bar (logo / title and ✕) moves the\n * sheet with the finger; let go far enough down — or with a quick flick —\n * and it closes, otherwise it springs back. Those zones need\n * `touch-action: none` in the component's CSS, or the browser keeps the\n * gesture for scrolling. A drag never turns into a tap on ✕.\n * - **…and from anywhere, at the top.** The grab bar scrolls away with the\n * content and nobody aims for it (Angelo, 2026-10-28): with the content\n * scrolled to the top, a finger pulling DOWN on the image or the text\n * moves the sheet too, like the system's own sheets. Sideways (a photo\n * carousel), upwards, or with the content scrolled, it stays a scroll.\n * This one runs on touch events: only a non-passive `touchmove` can keep\n * the browser from taking the pull for its overscroll.\n *\n * Desktop (the side drawers) is untouched: nothing locks, nothing drags.\n * One instance per component, driven from its `updated()` like `DialogFocus`.\n */\n\nexport interface BottomSheetOptions {\n /** The component. The drag listener lives on it; its render root holds the sheet. */\n host: HTMLElement\n /** The panel that moves (looked up on every use — Lit re-renders it). */\n sheet: () => HTMLElement | null\n /** The dimmed page behind, faded while dragging. */\n backdrop?: () => HTMLElement | null\n /** Where a drag can start, inside the sheet: e.g. `'.handle, .topbar'`. */\n dragZones: string\n /** What a drag past the threshold does: the component's `close()`. */\n close: () => void\n /** Answer false while the sheet must stay open (a payment in flight): it springs back. */\n canClose?: () => boolean\n /** What scrolls inside the sheet (default the sheet itself): a pull from the content closes only when it is at the top. */\n scroller?: () => HTMLElement | null\n}\n\n/** Same breakpoint as the components' CSS: below it they are bottom sheets. */\nconst PHONE = '(max-width: 600px)'\n/** Movement before a press becomes a drag (a tap on ✕ wiggles a little). */\nconst SLOP = 6\n/** Let go this far down (px, or a quarter of the sheet if shorter) and it closes. */\nconst CLOSE_DISTANCE = 120\n/** …or flick faster than this (px/ms) after at least FLICK_MIN px. */\nconst FLICK_VELOCITY = 0.5\nconst FLICK_MIN = 24\n/** A click this soon after a drag ends is the drag's own, not a tap. */\nconst CLICK_AFTER_DRAG_MS = 400\n\nexport function isPhoneSheet(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(PHONE).matches\n}\n\ninterface Drag {\n pointerId: number\n startY: number\n lastY: number\n lastT: number\n velocity: number\n moving: boolean\n offset: number\n}\n\nexport class BottomSheet {\n private active = false\n private locked = false\n private drag: Drag | null = null\n private dragEndedAt = -Infinity\n /** A finger down in the content, not yet known to be a pull (down) or a scroll. */\n private pull: { startX: number; startY: number } | null = null\n\n constructor(private readonly opts: BottomSheetOptions) {}\n\n /** Call from `updated()` when `open` changed. Same value twice is a no-op. */\n update(open: boolean): void {\n if (open === this.active) return\n this.active = open\n if (open) this.opened()\n else this.closed()\n }\n\n /** Call from `disconnectedCallback()`: a sheet torn down while open must not keep the page locked. */\n disconnect(): void {\n if (this.active) {\n this.active = false\n this.closed()\n }\n }\n\n private opened(): void {\n if (isPhoneSheet()) {\n lockPageScroll()\n this.locked = true\n }\n this.opts.host.addEventListener('pointerdown', this.onPointerDown)\n this.opts.host.addEventListener('click', this.onClickCapture, true)\n this.opts.host.addEventListener('touchstart', this.onTouchStart, { passive: true })\n this.opts.host.addEventListener('touchmove', this.onTouchMove, { passive: false })\n this.opts.host.addEventListener('touchend', this.onTouchEnd)\n this.opts.host.addEventListener('touchcancel', this.onTouchCancel)\n }\n\n private closed(): void {\n this.opts.host.removeEventListener('pointerdown', this.onPointerDown)\n this.opts.host.removeEventListener('click', this.onClickCapture, true)\n this.opts.host.removeEventListener('touchstart', this.onTouchStart)\n this.opts.host.removeEventListener('touchmove', this.onTouchMove)\n this.opts.host.removeEventListener('touchend', this.onTouchEnd)\n this.opts.host.removeEventListener('touchcancel', this.onTouchCancel)\n this.stopTracking()\n this.drag = null\n this.pull = null\n // The close animation runs from wherever the finger left the sheet to the\n // CSS's closed position; dropping the inline transform now keeps that\n // animation going (same end value) and leaves the next open clean.\n const sheet = this.opts.sheet()\n if (sheet) {\n sheet.style.transform = ''\n sheet.style.transition = ''\n }\n const backdrop = this.opts.backdrop?.()\n if (backdrop) {\n backdrop.style.opacity = ''\n backdrop.style.transition = ''\n }\n if (this.locked) {\n this.locked = false\n unlockPageScroll()\n }\n }\n\n private onPointerDown = (e: PointerEvent): void => {\n if (!e.isPrimary || (e.pointerType === 'mouse' && e.button !== 0)) return\n if (this.drag || !isPhoneSheet()) return\n const sheet = this.opts.sheet()\n if (!sheet || !inZone(e, sheet, this.opts.dragZones)) return\n this.drag = {\n pointerId: e.pointerId,\n startY: e.clientY,\n lastY: e.clientY,\n lastT: e.timeStamp,\n velocity: 0,\n moving: false,\n offset: 0,\n }\n window.addEventListener('pointermove', this.onPointerMove)\n window.addEventListener('pointerup', this.onPointerUp)\n window.addEventListener('pointercancel', this.onPointerCancel)\n }\n\n private onPointerMove = (e: PointerEvent): void => {\n const drag = this.drag\n if (!drag || e.pointerId !== drag.pointerId) return\n const dy = e.clientY - drag.startY\n if (!drag.moving) {\n if (dy < -SLOP) return this.abandon() // upwards: not ours\n if (dy <= SLOP) return\n this.startMoving(drag)\n }\n this.follow(drag, e.clientY, e.timeStamp)\n if (e.cancelable) e.preventDefault()\n }\n\n private onPointerUp = (e: PointerEvent): void => {\n const drag = this.drag\n if (!drag || e.pointerId !== drag.pointerId) return\n this.stopTracking()\n this.finish(drag)\n }\n\n // ── Pull from the content (touch) ─────────────────────────────────────────\n\n private onTouchStart = (e: TouchEvent): void => {\n this.pull = null\n if (this.drag || e.touches.length !== 1 || !isPhoneSheet()) return\n const sheet = this.opts.sheet()\n if (!sheet || !e.composedPath().includes(sheet)) return\n if (inZone(e, sheet, this.opts.dragZones)) return // the pointer path has it\n const t = e.touches[0]\n if (t) this.pull = { startX: t.clientX, startY: t.clientY }\n }\n\n private onTouchMove = (e: TouchEvent): void => {\n const t = e.touches[0]\n if (!t) return\n if (this.pull) {\n const dx = t.clientX - this.pull.startX\n const dy = t.clientY - this.pull.startY\n if (Math.max(Math.abs(dx), Math.abs(dy)) <= SLOP) return\n const startY = this.pull.startY\n this.pull = null\n // Sideways (a carousel), upwards, or content not at its top: a scroll.\n if (Math.abs(dx) >= Math.abs(dy) || dy < 0 || this.scrolledDown(e)) return\n this.drag = { pointerId: -1, startY, lastY: startY, lastT: e.timeStamp, velocity: 0, moving: false, offset: 0 }\n this.startMoving(this.drag)\n }\n const drag = this.drag\n if (!drag || drag.pointerId !== -1) return\n this.follow(drag, t.clientY, e.timeStamp)\n if (e.cancelable) e.preventDefault()\n }\n\n private onTouchEnd = (e: TouchEvent): void => {\n this.pull = null\n const drag = this.drag\n if (!drag || drag.pointerId !== -1 || e.touches.length > 0) return\n this.finish(drag)\n }\n\n private onTouchCancel = (): void => {\n this.pull = null\n if (this.drag?.pointerId === -1) this.abandon()\n }\n\n /** Is the content under the finger scrolled away from its top (the sheet's scroller, or one inside it)? */\n private scrolledDown(e: Event): boolean {\n const sheet = this.opts.sheet()\n const scroller = this.opts.scroller?.() ?? sheet\n if (scroller && scroller.scrollTop > 0) return true\n for (const node of e.composedPath()) {\n if (node === sheet) break\n if (node instanceof HTMLElement && node.scrollTop > 0 && node.scrollHeight > node.clientHeight) return true\n }\n return false\n }\n\n // ── Shared by both ────────────────────────────────────────────────────────\n\n /** The press is a drag now: the sheet and backdrop follow the finger without easing. */\n private startMoving(drag: Drag): void {\n drag.moving = true\n const sheet = this.opts.sheet()\n if (sheet) sheet.style.transition = 'none'\n const backdrop = this.opts.backdrop?.()\n if (backdrop) backdrop.style.transition = 'none'\n }\n\n private follow(drag: Drag, y: number, timeStamp: number): void {\n const dt = timeStamp - drag.lastT\n if (dt > 0) drag.velocity = 0.8 * ((y - drag.lastY) / dt) + 0.2 * drag.velocity\n drag.lastY = y\n drag.lastT = timeStamp\n drag.offset = Math.max(0, y - drag.startY)\n const sheet = this.opts.sheet()\n if (sheet) sheet.style.transform = `translateY(${drag.offset}px)`\n const backdrop = this.opts.backdrop?.()\n if (backdrop && sheet) {\n const height = sheet.getBoundingClientRect().height || window.innerHeight\n backdrop.style.opacity = String(Math.max(0, 1 - drag.offset / height))\n }\n }\n\n /** Let go: close if far or fast enough (and allowed), else spring back. */\n private finish(drag: Drag): void {\n this.drag = null\n if (!drag.moving) return // a tap: the click goes through\n this.dragEndedAt = performance.now()\n const sheet = this.opts.sheet()\n const height = sheet?.getBoundingClientRect().height || window.innerHeight\n const far = drag.offset >= Math.min(CLOSE_DISTANCE, height / 4)\n const flick = drag.velocity >= FLICK_VELOCITY && drag.offset >= FLICK_MIN\n const allowed = !this.opts.canClose || this.opts.canClose()\n this.release()\n if ((far || flick) && allowed) {\n // Animate on from here to fully down, then close (closed() drops the inline style).\n if (sheet) sheet.style.transform = 'translateY(100%)'\n this.opts.close()\n } else if (sheet) {\n sheet.style.transform = ''\n }\n }\n\n private onPointerCancel = (e: PointerEvent): void => {\n if (!this.drag || e.pointerId !== this.drag.pointerId) return\n this.abandon()\n }\n\n /** The press that ended a drag also fires a click on ✕ or the grab bar: swallow it. */\n private onClickCapture = (e: MouseEvent): void => {\n if (performance.now() - this.dragEndedAt > CLICK_AFTER_DRAG_MS) return\n this.dragEndedAt = -Infinity\n e.stopPropagation()\n e.preventDefault()\n }\n\n /** Give up on this press and put the sheet back where it was. */\n private abandon(): void {\n const moving = this.drag?.moving\n this.stopTracking()\n this.drag = null\n if (!moving) return\n this.release()\n const sheet = this.opts.sheet()\n if (sheet) sheet.style.transform = ''\n }\n\n /** Hand the sheet and backdrop back to their CSS transitions. */\n private release(): void {\n const sheet = this.opts.sheet()\n if (sheet) sheet.style.transition = ''\n const backdrop = this.opts.backdrop?.()\n if (backdrop) {\n backdrop.style.transition = ''\n backdrop.style.opacity = ''\n }\n }\n\n private stopTracking(): void {\n window.removeEventListener('pointermove', this.onPointerMove)\n window.removeEventListener('pointerup', this.onPointerUp)\n window.removeEventListener('pointercancel', this.onPointerCancel)\n }\n}\n\n/** Did the press start on one of the drag zones of this sheet? (Composed path: the sheet is in a shadow root.) */\nfunction inZone(e: Event, sheet: HTMLElement, zones: string): boolean {\n for (const node of e.composedPath()) {\n if (node === sheet) return false\n if (node instanceof Element && node.matches(zones)) return sheet.contains(node)\n }\n return false\n}\n\n// ── Page scroll lock, shared by every open sheet ────────────────────────────\n\nlet locks = 0\nlet saved: { scrollY: number; body: Partial<Record<LockedProperty, string>> } | null = null\nconst LOCKED = ['position', 'top', 'left', 'right', 'width', 'overflow'] as const\ntype LockedProperty = (typeof LOCKED)[number]\n\nexport function lockPageScroll(): void {\n if (typeof document === 'undefined') return\n locks += 1\n if (locks > 1) return\n const body = document.body\n const scrollY = window.scrollY || document.documentElement.scrollTop || 0\n saved = { scrollY, body: {} }\n for (const p of LOCKED) saved.body[p] = body.style[p]\n body.style.position = 'fixed'\n body.style.top = `-${scrollY}px`\n body.style.left = '0'\n body.style.right = '0'\n body.style.width = '100%'\n body.style.overflow = 'hidden'\n}\n\nexport function unlockPageScroll(): void {\n if (typeof document === 'undefined' || locks === 0) return\n locks -= 1\n if (locks > 0 || !saved) return\n const { scrollY, body } = saved\n saved = null\n for (const p of LOCKED) document.body.style[p] = body[p] ?? ''\n // Back to the same place, instantly — a page with `scroll-behavior: smooth`\n // would otherwise glide there from the top.\n const root = document.documentElement\n const behavior = root.style.scrollBehavior\n root.style.scrollBehavior = 'auto'\n window.scrollTo(0, scrollY)\n root.style.scrollBehavior = behavior\n}\n\n/** Tests only: how many sheets hold the lock. */\nexport function pageScrollLocks(): number {\n return locks\n}\n","/**\n * <vio-product-detail> — full-screen product detail modal.\n *\n * Auto-opens when `vio:product-click` fires anywhere in the document\n * (delegated). Fetches the full Product DTO via `Vio.commerceFor(sponsorId)`,\n * shows brand + name + price + description + image gallery + variant\n * pickers + stock indicator + add-to-cart CTA.\n *\n * For affiliate products (non-numeric productId), the modal skips —\n * those are handled by the host page's direct cart logic.\n */\n\nimport { LitElement, css, html, nothing } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { ensureVippsButton } from '../../core/checkout/payments/vipps-button.js'\nimport { beginPaymentRedirect, type PaymentRedirectHandle } from '../payment-redirect.js'\nimport { resolveVippsCartPayment } from '../vipps-cart-payment.js'\nimport { Vio } from '../../core/client.js'\nimport { shippingDescriptionOf } from '../../core/api/commerce.js'\nimport {\n formatPrice,\n getGlobalCurrency,\n type Product,\n type ProductImage,\n type ProductOption,\n type ProductVariant,\n} from '../../core/types.js'\nimport { isMethodEnabled, NO_EXPRESS_BUTTON_METHODS } from '../../core/checkout/method-taxonomy.js'\nimport { DialogFocus } from '../dialog-focus.js'\nimport { BottomSheet } from '../bottom-sheet.js'\nimport { SlotRegistration } from '../slot-registration.js'\nimport { toCampaignId } from '../../core/slots.js'\nimport { renderSponsorMark, resolveSponsorIdentity, sponsorDetail, usableLogo } from '../sponsor-identity.js'\nimport {\n copyAppliedLayout,\n layoutOriginOf,\n layoutSignature,\n onGlobalDetailLayoutChange,\n resolveDetailLayout,\n type AppliedDetailLayout,\n type DetailLayout,\n type DetailSectionId,\n} from '../../core/detail-layout.js'\n\n/** The `layout` attribute: JSON; anything unreadable is no layout (warned once by the resolver). */\nconst layoutAttribute = {\n fromAttribute(value: string | null): unknown {\n if (value === null || value.trim() === '') return null\n try {\n return JSON.parse(value)\n } catch {\n // Not JSON: handed on as is, so the resolver says why it is ignored.\n return value\n }\n },\n toAttribute(value: unknown): string | null {\n return value === null || value === undefined ? null : JSON.stringify(value)\n },\n}\n\n/** How long «Lagt i handlekurven» stays without a tap. */\nconst ADDED_TOAST_MS = 8000\n\ninterface SelectedOptions {\n [optionName: string]: string\n}\n\n/** Stripe wordmark, inlined so the published article needs no asset path.\n * (Also in vio-cart.ts / vio-checkout.ts — tiny constant, no shared module.) */\nconst STRIPE_LOGO_SRC =\n 'data:image/svg+xml;utf8,' +\n encodeURIComponent(\n '<svg width=\"360\" height=\"150\" viewBox=\"0 0 360 150\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M360 77.4001C360 51.8001 347.6 31.6001 323.9 31.6001C300.1 31.6001 285.7 51.8001 285.7 77.2001C285.7 107.3 302.7 122.5 327.1 122.5C339 122.5 348 119.8 354.8 116V96.0001C348 99.4001 340.2 101.5 330.3 101.5C320.6 101.5 312 98.1001 310.9 86.3001H359.8C359.8 85.0001 360 79.8001 360 77.4001ZM310.6 67.9001C310.6 56.6001 317.5 51.9001 323.8 51.9001C329.9 51.9001 336.4 56.6001 336.4 67.9001H310.6Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M247.1 31.6001C237.3 31.6001 231 36.2001 227.5 39.4001L226.2 33.2001H204.2V149.8L229.2 144.5L229.3 116.2C232.9 118.8 238.2 122.5 247 122.5C264.9 122.5 281.2 108.1 281.2 76.4001C281.1 47.4001 264.6 31.6001 247.1 31.6001ZM241.1 100.5C235.2 100.5 231.7 98.4001 229.3 95.8001L229.2 58.7001C231.8 55.8001 235.4 53.8001 241.1 53.8001C250.2 53.8001 256.5 64.0001 256.5 77.1001C256.5 90.5001 250.3 100.5 241.1 100.5Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M169.8 25.7L194.9 20.3V0L169.8 5.3V25.7Z\" fill=\"#533AFD\"/><path d=\"M194.9 33.3H169.8V120.8H194.9V33.3Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M142.9 40.7L141.3 33.3H119.7V120.8H144.7V61.5C150.6 53.8 160.6 55.2 163.7 56.3V33.3C160.5 32.1 148.8 29.9 142.9 40.7Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M92.8999 11.6001L68.4999 16.8001L68.3999 96.9001C68.3999 111.7 79.4999 122.6 94.2999 122.6C102.5 122.6 108.5 121.1 111.8 119.3V99.0001C108.6 100.3 92.7999 104.9 92.7999 90.1001V54.6001H111.8V33.3001H92.7999L92.8999 11.6001Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M25.3 58.7001C25.3 54.8001 28.5 53.3001 33.8 53.3001C41.4 53.3001 51 55.6001 58.6 59.7001V36.2001C50.3 32.9001 42.1 31.6001 33.8 31.6001C13.5 31.6001 0 42.2001 0 59.9001C0 87.5001 38 83.1001 38 95.0001C38 99.6001 34 101.1 28.4 101.1C20.1 101.1 9.5 97.7001 1.1 93.1001V116.9C10.4 120.9 19.8 122.6 28.4 122.6C49.2 122.6 63.5 112.3 63.5 94.4001C63.4 64.6001 25.3 69.9001 25.3 58.7001Z\" fill=\"#533AFD\"/></svg>',\n )\n\n/** One of the brand's promises under the buy zone («Rask levering», «Designet i Norge»). */\nexport interface VioDetailHighlight {\n /** A built-in line icon (see HIGHLIGHT_ICONS: plane, heart, shirt, truck, return, leaf, star, shield) or an image URL. */\n icon?: string\n title: string\n text?: string\n}\n\n/** Line icons in the brand-strip style: 24×24, stroke = the text colour. */\nconst HIGHLIGHT_ICONS: Record<string, string> = {\n plane: 'M21.5 2.5 2.5 10l7 3m12-10.5-12 10.5m12-10.5L17 21l-7.5-8m0 0V20l3-4M5 17l-2.5 2.5M7.5 18.5 6 20',\n heart: 'M12 20.5s-8.5-5-8.5-11A4.75 4.75 0 0 1 12 6.75 4.75 4.75 0 0 1 20.5 9.5c0 6-8.5 11-8.5 11Z',\n shirt: 'M8.5 3.5 3 6l1.75 4.25L7 9.5v11h10v-11l2.25.75L21 6l-5.5-2.5a3.5 3.5 0 0 1-7 0Z',\n truck: 'M2.5 5.5h11v10h-11zM13.5 9.5h4l3 3.5v2.5h-7M6.5 18.5a2 2 0 1 0 0-.01M17 18.5a2 2 0 1 0 0-.01',\n return: 'M4 9h11.5a4.5 4.5 0 0 1 0 9H8M4 9l4-4M4 9l4 4',\n leaf: 'M5 19C5 10 10 4.5 20 4.5c0 10-5.5 15-14 15M5 19l7-7',\n star: 'm12 3.5 2.6 5.4 5.9.8-4.3 4.1 1 5.9L12 17l-5.2 2.7 1-5.9-4.3-4.1 5.9-.8Z',\n shield: 'M12 3 4.5 6v5.5c0 4.5 3.2 8.2 7.5 9.5 4.3-1.3 7.5-5 7.5-9.5V6Z',\n mailbox: 'M3 19v-8a4 4 0 0 1 8 0v8m-8 0h18v-7a4 4 0 0 0-4-4H7m8 0V4h3M6 12h2',\n home: 'M3 11 12 4l9 7M5.5 9.5V20h13V9.5M10 20v-5h4v5',\n pin: 'M12 21s-6.5-6-6.5-11a6.5 6.5 0 0 1 13 0c0 5-6.5 11-6.5 11Zm0-8.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z',\n clock: 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l3 2',\n}\n\n/** The icon for a way of delivering, from the words the brand used for it. */\nfunction rateIcon(method: string): string {\n const m = method.toLowerCase()\n if (/postkasse|mailbox|brevkasse/.test(m)) return 'mailbox'\n if (/hente|pakkeboks|automat|postkontor|pickup|utlever/.test(m)) return 'pin'\n if (/dør|hjem|home|door/.test(m)) return 'home'\n return 'truck'\n}\n\n/** The logo the host gave for this carrier (case-insensitive), or ''. */\nfunction carrierLogo(logos: Record<string, string> | null | undefined, carrier: string): string {\n if (!logos || !carrier) return ''\n const want = carrier.trim().toLowerCase()\n for (const [name, url] of Object.entries(logos)) if (name.trim().toLowerCase() === want && url) return url\n return ''\n}\n\n/** A small line icon from HIGHLIGHT_ICONS (the brand strip's set). */\nfunction lineIcon(name: string, cls = 'line-icon') {\n return html`<svg class=${cls} viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=${HIGHLIGHT_ICONS[name] ?? ''}></path></svg>`\n}\n\nexport class VioProductDetail extends LitElement {\n @property({ type: Boolean, reflect: true }) open = false\n @property({ type: String, attribute: 'product-id' }) productId = ''\n @property({ type: Number, attribute: 'sponsor-id' }) sponsorId = 0\n /** Subscribe to `vio:product-click` on the document and auto-open. */\n @property({ type: Boolean, attribute: 'auto-open' }) autoOpen = true\n @property({ type: String }) currency = 'NOK'\n /**\n * Slot this detail belongs to (ADR-0027). Optional: without it the detail\n * registers itself as `detail-N`. Carried by every event it emits. A\n * `vio:product-click` that names a slot (every card does — its own or the\n * carousel's) takes precedence while that product is open. The attribute is\n * `vio-slot`, not `slot` (HTML's own).\n */\n @property({ type: String, attribute: 'vio-slot' }) vioSlot = ''\n /** Human name of the slot for the dashboard (`vio-slot-name`). Optional. */\n @property({ type: String, attribute: 'vio-slot-name' }) vioSlotName = ''\n /**\n * Scope of the auto id (`article-123-detail-1`). Inherited: this attribute,\n * else the nearest ancestor's `data-vio-scope` (a page sets it ONCE on\n * `<body>` and every block gets a per-page slot). Optional.\n */\n @property({ type: String, attribute: 'vio-scope' }) vioScope = ''\n /** Human label of the scope (` · Title` in the slot name); inherited from `data-vio-scope-name`. */\n @property({ type: String, attribute: 'vio-scope-name' }) vioScopeName = ''\n /**\n * The campaign this element's PAGE belongs to (ADR-0034, amendment 3).\n * Inherited: this attribute, else the nearest ancestor's `data-vio-campaign`,\n * else `Vio.init({ campaignId })`. A dashboard assignment of the slot wins\n * over it. Optional.\n */\n @property({ type: String, attribute: 'vio-campaign' }) vioCampaign = ''\n /** Per-element override of the content (article) id the events carry; see `Vio.content()`. */\n @property({ type: String, attribute: 'vio-content-id' }) vioContentId = ''\n /** Per-element override of the content title. */\n @property({ type: String, attribute: 'vio-content-title' }) vioContentTitle = ''\n /**\n * No «Lagt i handlekurven» toast after «Legg i handlekurv» — for a host\n * that answers `vio:added-to-cart` with its own (opening its cart drawer,\n * say). Off by default: the toast shows.\n */\n @property({ type: Boolean, attribute: 'no-added-toast' }) noAddedToast = false\n /**\n * «Kjøp nå med Vipps» when the brand's cart already has lines: `express`\n * (default) adds the product and pays the WHOLE cart with Vipps Express —\n * the line under the button says how many items and what total — or\n * `checkout`: adds it and opens our checkout with Vipps preselected (as in\n * 0.31–0.34). An empty cart is Express either way. Unset = the theme's\n * `vippsCartPayment` (`--vio-vipps-cart-payment`).\n */\n @property({ type: String, attribute: 'vipps-cart-payment' }) vippsCartPayment = ''\n /**\n * How the images show: `thumbs` (one image, thumbnails under it — the\n * default) or `carousel` (every image in one swipeable row, no thumbnails:\n * less height). Unset = the theme's `detailGallery` (`--vio-detail-gallery`),\n * so a host sets it once for every detail on the page.\n */\n @property({ type: String }) gallery = ''\n /**\n * «Beskrivelse»: `preview` (default — the first lines fading out and «Les\n * mer»), `folded` (only the heading until a tap) or `open` (all of it).\n * Unset = the theme's `detailDescriptionMode` (`--vio-detail-description-mode`).\n */\n @property({ type: String, attribute: 'description-mode' }) descriptionMode = ''\n /**\n * The brand's promises, shown in a row under the buy zone. By default the\n * brand's own (dashboard Settings → Brand, in the bootstrap); this list\n * replaces them on this page — e.g.\n * `[{ icon: 'plane', title: 'Rask levering', text: '2-5 virkedager' }]`\n * (attribute: the same as JSON). Up to three read well. None by default.\n */\n @property({ type: Array }) highlights: VioDetailHighlight[] = []\n /**\n * How long delivery takes (`2-5 virkedager`), for a brand whose rates do not\n * say it: Commerce's own text on each rate («Leveringstid 1-5 dager») wins.\n * Shown under the rates in «Frakt & retur». None by default.\n */\n @property({ type: String, attribute: 'delivery-time' }) deliveryTime = ''\n /**\n * Carrier logos for «Frakt & retur», by the carrier's name as the rate\n * starts (`{ \"Bring\": \"https://…/bring.svg\", \"Helthjem\": \"…\" }`, any case;\n * attribute: the same as JSON), for rates without their own logo in\n * Commerce (which wins). A carrier with neither gets the line icon.\n */\n @property({ type: Object, attribute: 'carrier-logos' }) carrierLogos: Record<string, string> = {}\n /**\n * The order of the sections below the gallery (0.34): `{ id, revision,\n * sections, experimentId?, variantId? }` (attribute: the same as JSON). Wins\n * over `Vio.configureDetail({ layout })`; unset = the page's, else the\n * default. Section ids: `brand`, `title`, `stock`, `price`, `options`,\n * `purchase`, `highlights`, `description`, `shippingReturns`. See README\n * «Section order and layout tracking».\n */\n @property({ attribute: 'layout', converter: layoutAttribute }) layout: DetailLayout | null = null\n /** The layout the detail renders with now (resolved before each render). */\n private layoutNow: AppliedDetailLayout = resolveDetailLayout(null)\n /** The product and layout `vio:detail-layout-applied` was last said for. */\n private appliedFor: { product: Product; signature: string } | null = null\n private unsubscribeLayout: (() => void) | null = null\n\n /**\n * The layout this detail applies (0.34): `{ id, revision, experimentId?,\n * variantId?, sections, adjusted, source }` — `source` is `element` (its own\n * `layout`), `global` (`Vio.configureDetail`) or `default`. A copy.\n */\n get appliedLayout(): AppliedDetailLayout {\n // What the next render uses — after a render, what it used.\n return copyAppliedLayout(resolveDetailLayout(this.layout))\n }\n private readonly slotRegistration = new SlotRegistration(this, 'detail')\n /** What the click that opened the detail carried ('' when nothing), and for which product. */\n private eventSlot = ''\n private eventContentId = ''\n private eventContentTitle = ''\n private eventCampaignId: number | undefined = undefined\n private eventProductId = ''\n\n /** The card's context applies to the product it opened — not to one the host opened by hand later. */\n private get fromCard(): boolean {\n return this.eventProductId !== '' && this.eventProductId === String(this.productId)\n }\n\n /** The slot id in effect for this element: `vio-slot`, else the auto id (`detail-N`). Read-only. */\n get effectiveSlot(): string {\n return this.slotRegistration.effective\n }\n\n /** The element's own page campaign (`vio-campaign` / ancestor), if any; `Vio.init`'s applies otherwise. */\n get effectiveCampaignId(): number | undefined {\n return this.slotRegistration.campaignId\n }\n\n /** The slot the open product is attributed to: the opening card's, else this element's. */\n private get activeSlot(): string {\n return (this.fromCard && this.eventSlot) || this.effectiveSlot\n }\n\n /** The page-campaign candidates of the open product: the opening card's, then this element's own and its ancestor's. */\n private get activeCampaignHint(): number[] {\n const own = this.slotRegistration.campaignHint\n return this.fromCard && this.eventCampaignId !== undefined ? [this.eventCampaignId, ...own] : own\n }\n\n /**\n * The campaign whose channel sells the open product (one article = one\n * campaign = one channel): the campaign its events credit, then the opening\n * click's and this element's own — so the product, its rates and its\n * seller are read with that channel's key, the one the cart is created on.\n */\n private commerceCampaigns(): number[] {\n const hint = this.activeCampaignHint\n try {\n const resolved = this.attribution().campaignId\n return typeof resolved === 'number' ? [resolved, ...hint] : hint\n } catch {\n return hint\n }\n }\n\n private slotAttributes() {\n return {\n vioSlot: this.vioSlot,\n vioSlotName: this.vioSlotName,\n vioScope: this.vioScope,\n vioScopeName: this.vioScopeName,\n vioCampaign: this.vioCampaign,\n }\n }\n\n /** Attribution every event of the open product carries (`Vio.attribution` of the opening card's slot, else this element's). */\n private attribution() {\n const base =\n typeof Vio.attribution === 'function'\n ? Vio.attribution(this.activeSlot, {\n sponsorId: this.sponsorId > 0 ? this.sponsorId : undefined,\n campaignId: this.activeCampaignHint,\n })\n : { slot: this.activeSlot || undefined }\n const contentId = (this.fromCard && this.eventContentId) || this.vioContentId\n const contentTitle = (this.fromCard && this.eventContentTitle) || this.vioContentTitle\n return {\n ...base,\n componentTemplateId: 'product-detail',\n ...(contentId ? { contentId } : {}),\n ...(contentTitle ? { contentTitle } : {}),\n }\n }\n\n @state() private product: Product | null = null\n /**\n * The header: the seller's Company name (Settings → Company), not the\n * product's brand, which the body already shows (Angelo, 2026-10-08).\n * Asked on its own after the product; until it answers the header waits,\n * and if there is none it falls back to the brand.\n */\n @state() private sellerName: string | null = null\n @state() private sellerSettled = false\n /**\n * The cheapest shipping rate of the product for the page's market, in the\n * product's currency — under the price as «Frakt fra X» («Gratis frakt» at\n * 0). null = not known (not asked yet, none, or another currency): only the\n * right of withdrawal is said then.\n */\n @state() private shippingFrom: { price: number; currency: string } | null = null\n /** Every rate for the page's country, cheapest first — for «Frakt & retur». */\n @state() private shippingRates: Array<{ name: string; price: number; currency: string; description: string; logoUrl: string }> = []\n @state() private isLoading = false\n @state() private fetchError = ''\n @state() private selectedOptions: SelectedOptions = {}\n /** The option a buy button asked for and the shopper has not chosen yet ('' = none asked). */\n @state() private selectionPrompt = ''\n @state() private quantity = 1\n @state() private activeImageIndex = 0\n /** The thumbnail row is wider than its box (arrows shown with a mouse). */\n @state() private thumbsOverflow = false\n @state() private thumbsAtStart = true\n @state() private thumbsAtEnd = false\n /** «Beskrivelse» shows a preview until a tap opens it all. */\n @state() private descriptionOpen = false\n /** The description is longer than its preview (otherwise there is nothing to open). */\n @state() private descriptionClipped = false\n /** `gallery` resolved against the theme when the detail opens. */\n @state() private galleryMode: 'thumbs' | 'carousel' = 'thumbs'\n /** `description-mode` resolved against the theme when the detail opens. */\n @state() private resolvedDescriptionMode: 'preview' | 'folded' | 'open' = 'preview'\n /** The top bar's logo file is square-ish: a mark, so its name goes beside it. */\n @state() private logoSquare = false\n @state() private adding = false\n /**\n * «Lagt i handlekurven» after an add, with «Til kassen» and «Fortsett å\n * handle» (Mote & Livsstil, 2026-10-28: an add closed the detail and said\n * nothing). Outlives the detail: the brand and attribution of the add.\n */\n @state() private addedToast: { sponsorId: number; detail: Record<string, unknown> } | null = null\n private addedToastTimer: ReturnType<typeof setTimeout> | null = null\n /** Apple Pay actually usable (real Stripe + registered domain) — set on load. */\n @state() private applePayOk = false\n /** Payment method names enabled for the sponsor (backend-configured).\n * null = not loaded yet → all buy buttons render; [] = none enabled. */\n @state() private availableMethods: string[] | null = null\n /**\n * The brand's methods are being asked for. Meanwhile the buy zone shows a\n * neutral placeholder, never the buttons of every method: «null = render\n * all» painted Stripe and Klarna for a Vipps-only brand until the answer\n * came (Mote & Livsstil, 2026-10-28).\n */\n @state() private methodsLoading = false\n /**\n * The brand's Vipps is KNOWN to run Express: its method list came back,\n * with Vipps and no `config.express: false`. Only then does the line under\n * the button say the app fills in name and address — never on a guess\n * after a failed lookup.\n */\n @state() private vippsExpress = false\n /** Whose methods `availableMethods` are — another brand's are not shown while its own load. */\n private methodsSponsorId = 0\n @state() private vippsOfficial = false\n /** Race guard: only the latest fetch may write state (two quick taps on\n * different cards would otherwise let the slow response win). */\n private fetchSeq = 0\n /** Memoised option maps per variant object (recomputed per product). */\n private optMapCache = new WeakMap<object, { map: Record<string, string>; titleParts: string[] }>()\n /** Pre-prepared Apple Pay handle — show() fires synchronously on tap. */\n private applePayHandle: { show: () => Promise<void> } | null = null\n /** The amount `applePayHandle`'s sheet shows (product × quantity when it was prepared). */\n private applePayAmount: number | null = null\n /** The amount the latest preparation was asked for — a newer one supersedes it. */\n private applePayAskedFor: number | null = null\n /** Keyboard and focus while open: Escape closes, Tab stays inside, focus returns to the opener. */\n private readonly dialogFocus = new DialogFocus({\n host: this,\n container: () => this.renderRoot.querySelector<HTMLElement>('.modal'),\n close: () => this.close(),\n })\n /** Phones: the page behind is locked, and the sheet closes by pulling the bar or the top bar down. */\n private readonly bottomSheet = new BottomSheet({\n host: this,\n sheet: () => this.renderRoot.querySelector<HTMLElement>('.modal'),\n backdrop: () => this.renderRoot.querySelector<HTMLElement>('.backdrop'),\n dragZones: '.handle, .topbar',\n close: () => this.close(),\n })\n\n private boundProductClick = (e: Event): void => {\n if (!this.autoOpen) return\n const ev = e as CustomEvent<{\n productId: string\n sponsorId: string\n currency?: string\n slot?: string\n campaignId?: number | string\n contentId?: string | number\n contentTitle?: string\n }>\n const productIdNum = parseInt(ev.detail.productId, 10)\n // Skip non-numeric IDs (affiliate products) — host handles those.\n if (Number.isNaN(productIdNum)) return\n const slot = typeof ev.detail.slot === 'string' ? ev.detail.slot.trim() : ''\n let sponsorIdNum = parseInt(ev.detail.sponsorId, 10)\n if (Number.isNaN(sponsorIdNum) || sponsorIdNum <= 0) {\n // A card without a sponsor: the primary of the campaign its slot shows.\n const fromSlot =\n typeof Vio.campaignForSlot === 'function'\n ? Number(\n Vio.campaignForSlot(slot || this.effectiveSlot || null, {\n campaignId: [ev.detail.campaignId, ...this.slotRegistration.campaignHint],\n })?.primarySponsor?.id,\n )\n : NaN\n if (!Number.isFinite(fromSlot) || fromSlot <= 0) return\n sponsorIdNum = fromSlot\n }\n this.eventSlot = slot\n this.eventCampaignId = toCampaignId(ev.detail.campaignId)\n this.eventProductId = String(ev.detail.productId)\n this.eventContentId =\n ev.detail.contentId !== undefined && ev.detail.contentId !== null ? String(ev.detail.contentId).trim() : ''\n this.eventContentTitle = typeof ev.detail.contentTitle === 'string' ? ev.detail.contentTitle.trim() : ''\n this.productId = ev.detail.productId\n this.sponsorId = sponsorIdNum\n // The event may carry the page currency; otherwise use the global one.\n this.currency = ev.detail.currency || getGlobalCurrency()\n this.show()\n void this.fetchProduct()\n }\n\n static override styles = css`\n :host { display: contents; }\n\n .backdrop {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.5);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.25s ease;\n z-index: 1100;\n }\n :host([open]) .backdrop { opacity: 1; pointer-events: auto; }\n\n .modal {\n position: fixed;\n inset: 0;\n background: var(--vio-color-surface, #fff);\n transform: translateY(100%);\n transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);\n display: flex;\n flex-direction: column;\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n color: var(--vio-color-text, #0a0a0a);\n z-index: 1101;\n overflow-y: auto;\n }\n :host([open]) .modal { transform: translateY(0); }\n /* Focus lands on the panel itself only as a fallback — no ring for it. */\n .modal:focus { outline: none; }\n\n .handle { display: none; }\n\n /* Mobile: bottom sheet (not fullscreen), rounded top, drag handle. */\n @media (max-width: 600px) {\n .modal {\n top: auto;\n height: 92vh;\n border-radius: var(--vio-radius-xl, 16px) var(--vio-radius-xl, 16px) 0 0;\n box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);\n overscroll-behavior: contain;\n }\n /* Pulled down to close (bottom-sheet.ts): the browser must not take the gesture for a scroll. */\n .handle, .topbar { touch-action: none; }\n .handle {\n display: flex;\n justify-content: center;\n padding: 10px 0 4px;\n flex-shrink: 0;\n }\n .handle::before {\n content: '';\n width: 40px;\n height: 4px;\n background: var(--vio-color-border, #e5e5e5);\n border-radius: var(--vio-radius-sm, 2px);\n }\n }\n\n /* Desktop: right-side drawer (matches the cart/checkout), so the product\n shows \"al lado\" instead of a centered modal. Info stacks in one column. */\n @media (min-width: 601px) {\n .modal {\n inset: 0 0 0 auto;\n width: min(var(--vio-detail-width, 440px), 100%);\n max-width: var(--vio-detail-width, 440px);\n border-radius: 0;\n box-shadow: -8px 0 24px rgba(0, 0, 0, 0.1);\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);\n }\n :host([open]) .modal { transform: translateX(0); }\n /* Content overrides are prefixed with .modal so they beat the base\n .body / .name / .gallery-main rules defined LATER in this stylesheet\n (equal specificity, later wins; the extra class tips the cascade). */\n .modal .body {\n max-width: none;\n grid-template-columns: 1fr;\n gap: 20px;\n padding: var(--vio-detail-padding-top, 0px) var(--vio-detail-padding-x, var(--vio-space-lg, 24px)) 40px;\n }\n .modal .name { font-size: var(--vio-detail-title-size, 26px); line-height: 1.2; }\n .modal .gallery-main { width: auto; }\n }\n\n .topbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 16px;\n min-height: var(--vio-detail-topbar-height, 64px);\n box-sizing: border-box;\n padding: 10px var(--vio-detail-padding-x, var(--vio-space-lg, 24px));\n position: sticky;\n top: 0;\n background: var(--vio-color-surface, #fff);\n border-bottom: 1px solid var(--vio-color-border, #e5e5e5);\n z-index: 1;\n }\n /* Who sells it, top left beside the close: the sponsor's logo, else its name. */\n .topbar-sponsor { flex: 1 1 auto; display: flex; align-items: center; gap: 10px; min-width: 0; }\n /* The logo box clips, so --vio-detail-logo-zoom can crop the white a\n square file carries around its mark. */\n .topbar-logo-box {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n height: var(--vio-detail-logo-height, 44px);\n max-width: var(--vio-detail-logo-max-width, 220px);\n overflow: hidden;\n }\n .topbar-logo {\n display: block;\n width: auto;\n height: 100%;\n max-width: var(--vio-detail-logo-max-width, 220px);\n object-fit: contain;\n object-position: left center;\n transform: scale(var(--vio-detail-logo-zoom, 1));\n transform-origin: center;\n }\n /* A square (or near) logo is a mark, not a wordmark: say whose it is. */\n .topbar-sponsor:not(.is-square) .topbar-mark-name { display: none; }\n .topbar-name {\n font-size: var(--vio-detail-logo-name-size, 13px);\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .close {\n background: none;\n border: none;\n cursor: pointer;\n font-size: 28px;\n line-height: 1;\n padding: 0;\n color: var(--vio-color-text, #0a0a0a);\n font-family: inherit;\n }\n .close:hover { color: var(--vio-color-text-secondary, #666); }\n\n .body {\n flex: 1;\n max-width: 1200px;\n width: 100%;\n margin: 0 auto;\n padding: 48px var(--vio-space-lg, 24px) 80px;\n box-sizing: border-box;\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 64px;\n }\n @media (max-width: 800px) {\n .body {\n grid-template-columns: 1fr;\n gap: 24px;\n padding: var(--vio-detail-padding-top, 0px) var(--vio-detail-padding-x, var(--vio-space-lg, 24px)) 64px;\n }\n }\n\n /* Gallery. One fixed proportion for every image (4:5 by default) that the\n image fills (cover): no white bars, and the panel never jumps between\n photos of different shapes (Angelo, 2026-10-22). Its side margin is\n --vio-detail-image-inset (the panel's padding by default; 0 = edge to\n edge). Fit, proportion, a height cap and a zoom (to crop a white margin\n baked into the file) are the host's to set. */\n .gallery { display: flex; flex-direction: column; gap: var(--vio-detail-gallery-gap, 12px); min-width: 0; }\n .gallery-main {\n position: relative;\n margin-inline: calc(\n var(--vio-detail-image-inset, var(--vio-detail-padding-x, var(--vio-space-lg, 24px))) -\n var(--vio-detail-padding-x, var(--vio-space-lg, 24px))\n );\n aspect-ratio: var(--vio-detail-image-aspect, 4 / 5);\n max-height: var(--vio-detail-image-max-height, 85vh);\n background: var(--vio-detail-image-bg, var(--vio-color-surface-muted, #f2f2f2));\n border-radius: var(--vio-detail-image-radius, 0);\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n }\n .gallery-main img {\n display: block;\n width: 100%;\n height: 100%;\n max-height: var(--vio-detail-image-max-height, 85vh);\n object-fit: var(--vio-detail-image-fit, cover);\n object-position: var(--vio-detail-image-position, center);\n transform: scale(var(--vio-detail-image-zoom, 1));\n }\n /* Thumbnails: one row, never a second line — swipe on touch, arrows with a\n mouse; the selected one scrolls into view by itself. */\n .thumbs { position: relative; min-width: 0; }\n .gallery-thumbs {\n display: flex;\n flex-wrap: nowrap;\n gap: var(--vio-detail-thumb-gap, 8px);\n overflow-x: auto;\n scroll-snap-type: x proximity;\n scroll-behavior: smooth;\n scrollbar-width: none;\n -webkit-overflow-scrolling: touch;\n }\n .gallery-thumbs::-webkit-scrollbar { display: none; }\n .gallery-thumb {\n flex: 0 0 auto;\n width: var(--vio-detail-thumb-size, 64px);\n height: var(--vio-detail-thumb-size, 64px);\n background: var(--vio-color-surface-muted, #f2f2f2);\n border: var(--vio-detail-thumb-border-width, 1px) solid transparent;\n border-radius: var(--vio-detail-thumb-radius, 0);\n cursor: pointer;\n padding: 0;\n overflow: hidden;\n scroll-snap-align: start;\n box-sizing: border-box;\n opacity: var(--vio-detail-thumb-opacity, 1);\n }\n .gallery-thumb img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--vio-detail-thumb-fit, cover);\n }\n .gallery-thumb.active {\n border-color: var(--vio-detail-thumb-active-color, var(--vio-color-text, #0a0a0a));\n opacity: 1;\n }\n .thumbs-arrow {\n display: none;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 1;\n width: 28px;\n height: 28px;\n border-radius: 50%;\n border: 1px solid var(--vio-color-border, #e5e5e5);\n background: var(--vio-color-surface, #fff);\n color: var(--vio-color-text, #0a0a0a);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);\n cursor: pointer;\n align-items: center;\n justify-content: center;\n padding: 0;\n font: 16px/1 sans-serif;\n }\n .thumbs-arrow.prev { left: -6px; }\n .thumbs-arrow.next { right: -6px; }\n .thumbs-arrow:disabled { visibility: hidden; }\n @media (hover: hover) and (pointer: fine) {\n .thumbs.overflows .thumbs-arrow { display: flex; }\n }\n\n /* Carousel (gallery=\"carousel\" / theme detailGallery): the same box as the\n main image — proportion, fit, background, inset — one per photo, in a\n row that snaps. --vio-detail-carousel-peek shows the edge of the next. */\n .carousel {\n position: relative;\n margin-inline: calc(\n var(--vio-detail-image-inset, var(--vio-detail-padding-x, var(--vio-space-lg, 24px))) -\n var(--vio-detail-padding-x, var(--vio-space-lg, 24px))\n );\n }\n .carousel-track {\n display: flex;\n gap: var(--vio-detail-carousel-gap, 0px);\n overflow-x: auto;\n scroll-snap-type: x mandatory;\n scroll-behavior: smooth;\n scrollbar-width: none;\n -webkit-overflow-scrolling: touch;\n overscroll-behavior-x: contain;\n /* Sideways is the carousel's, up and down the panel's; no double-tap\n zoom delay. The sheet only drags from its top bar, never from here. */\n touch-action: pan-x pan-y;\n border-radius: var(--vio-detail-image-radius, 0);\n }\n .carousel-track::-webkit-scrollbar { display: none; }\n .carousel-slide {\n flex: 0 0 calc(100% - var(--vio-detail-carousel-peek, 0px));\n aspect-ratio: var(--vio-detail-image-aspect, 4 / 5);\n max-height: var(--vio-detail-image-max-height, 85vh);\n background: var(--vio-detail-image-bg, var(--vio-color-surface-muted, #f2f2f2));\n scroll-snap-align: start;\n scroll-snap-stop: always;\n overflow: hidden;\n }\n .carousel-slide img {\n display: block;\n /* A press on a photo is a swipe: no image drag, no long-press menu, no selection. */\n pointer-events: none;\n user-select: none;\n -webkit-user-select: none;\n -webkit-user-drag: none;\n -webkit-touch-callout: none;\n width: 100%;\n height: 100%;\n object-fit: var(--vio-detail-image-fit, cover);\n object-position: var(--vio-detail-image-position, center);\n transform: scale(var(--vio-detail-image-zoom, 1));\n }\n /* One dot per photo over the bottom of the image: there is more than one,\n and which one this is. White with a shadow reads on light and dark photos. */\n .carousel-dots {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 12px;\n display: flex;\n justify-content: center;\n gap: 6px;\n pointer-events: none;\n }\n .carousel-dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--vio-detail-dot-color, rgba(255, 255, 255, 0.6));\n box-shadow: 0 0 2px rgba(0, 0, 0, 0.35);\n transition: background 0.2s ease, transform 0.2s ease;\n }\n .carousel-dot.active {\n background: var(--vio-detail-dot-active-color, #fff);\n transform: scale(1.35);\n }\n .carousel-arrow {\n display: none;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 36px;\n height: 36px;\n border-radius: 50%;\n border: 1px solid var(--vio-color-border, #e5e5e5);\n background: var(--vio-color-surface, #fff);\n color: var(--vio-color-text, #0a0a0a);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);\n cursor: pointer;\n align-items: center;\n justify-content: center;\n padding: 0;\n font: 18px/1 sans-serif;\n }\n .carousel-arrow.prev { left: 12px; }\n .carousel-arrow.next { right: 12px; }\n .carousel-arrow:disabled { visibility: hidden; }\n @media (hover: hover) and (pointer: fine) {\n .carousel-arrow { display: flex; }\n }\n\n /* Info column */\n .info { display: flex; flex-direction: column; gap: var(--vio-detail-info-gap, 20px); min-width: 0; }\n .brand {\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n font-weight: 500;\n }\n .name {\n font-family: var(--vio-font-serif, Georgia, serif);\n font-size: var(--vio-detail-title-size, clamp(28px, 4vw, 40px));\n font-weight: var(--vio-detail-title-weight, 400);\n line-height: 1.15;\n margin: 0;\n letter-spacing: -0.01em;\n }\n /* The brand's promises: one row, an icon over a title and a line of text,\n centred like a shop's own trust strip. */\n .highlights {\n list-style: none;\n /* --vio-detail-highlights-display: none hides the strip (theme detailHighlightsDisplay). */\n margin: 0;\n padding: var(--vio-detail-highlights-padding, 16px 0 2px);\n display: var(--vio-detail-highlights-display, grid);\n grid-auto-flow: column;\n grid-auto-columns: 1fr;\n gap: 10px;\n border-top: 1px solid var(--vio-color-border, #e5e5e5);\n }\n /* Like a shop's trust strip: a thin icon, the promise in regular weight,\n a smaller line under it — nothing bold. */\n .hl { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }\n .hl-icon {\n width: var(--vio-detail-highlight-icon-size, 22px);\n height: var(--vio-detail-highlight-icon-size, 22px);\n margin-bottom: 8px;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.2;\n stroke-linecap: round;\n stroke-linejoin: round;\n object-fit: contain;\n }\n .hl-title { font-size: 12px; font-weight: 400; line-height: 1.3; letter-spacing: 0.01em; color: var(--vio-color-text, #0a0a0a); }\n .hl-text { font-size: 10.5px; line-height: 1.35; letter-spacing: 0.01em; color: var(--vio-color-text-secondary, #666); }\n /* «Frakt & retur»: same fold as «Beskrivelse», with a small list of rates.\n --vio-detail-shipping-returns-display: none hides it (theme detailShippingReturnsDisplay). */\n .shipping-returns { display: var(--vio-detail-shipping-returns-display, block); }\n .description.shipping-returns-body { white-space: normal; }\n .shipping-returns-body p { margin: 0 0 10px; }\n .sr-title {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n font-weight: 600;\n margin: 4px 0 6px;\n }\n .sr-rates { list-style: none; margin: 0 0 10px; padding: 0; }\n /* One row per carrier: «Helthjem» over «Til postkasse/dørmatte», price right. */\n .sr-rates li {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 8px 0;\n border-bottom: 1px solid var(--vio-color-border, #eee);\n }\n .sr-rates li:last-child { border-bottom: none; }\n .sr-rate { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }\n .line-icon { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }\n .sr-icon { flex: 0 0 auto; width: 20px; height: 20px; color: var(--vio-color-text, #0a0a0a); }\n .sr-line { display: flex; align-items: center; gap: 12px; }\n /* A carrier's logo in a fixed box, so rows line up whatever its shape. */\n .sr-logo { flex: 0 0 auto; width: var(--vio-detail-carrier-logo-width, 56px); height: 24px; object-fit: contain; object-position: left center; }\n .sr-carrier { font-weight: 600; color: var(--vio-color-text, #0a0a0a); }\n .sr-method { font-size: 13px; }\n .sr-time { margin: 0 0 14px; }\n .sr-price { font-weight: 600; color: var(--vio-color-text, #0a0a0a); white-space: nowrap; }\n .sr-links { display: flex; gap: 16px; padding-left: 32px; }\n .sr-links a { color: inherit; }\n /* Name and price read as one block (stock on the name's line, right);\n the sizes come after a wider gap, then shipping/returns by the buttons. */\n .headline { display: flex; flex-direction: column; gap: var(--vio-detail-headline-gap, 8px); }\n .title-row {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 16px;\n }\n .title-row .name { min-width: 0; }\n .title-row .stock { flex: 0 0 auto; white-space: nowrap; }\n .price-row {\n display: flex;\n align-items: baseline;\n gap: 16px;\n }\n /* The sizes follow the price closely: they are the next thing to do. */\n .headline + .purchase { margin-top: calc(var(--vio-detail-sizes-gap, 2px) - var(--vio-detail-info-gap, 20px)); }\n /* A layout with the sizes apart from the buy zone (0.34): they follow the\n price closely instead, and the buy zone keeps the normal gap. */\n .headline + .buy-options.options-apart { margin-top: calc(var(--vio-detail-sizes-gap, 2px) - var(--vio-detail-info-gap, 20px)); }\n .headline + .purchase.options-apart { margin-top: 0; }\n .price {\n font-size: var(--vio-detail-price-size, 24px);\n font-weight: var(--vio-detail-price-weight, 700);\n }\n .compare-at {\n font-size: 16px;\n color: var(--vio-color-text-tertiary, #999);\n text-decoration: line-through;\n }\n .delivery-note {\n margin-top: calc(var(--vio-detail-info-gap, 20px) * -0.6);\n font-size: 13px;\n color: var(--vio-color-text-secondary, #666);\n }\n .stock {\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n font-weight: 500;\n }\n .stock.in-stock { color: #2e7d32; }\n .stock.low-stock { color: #ed6c02; }\n .stock.out-of-stock { color: var(--vio-color-text-tertiary, #999); }\n\n /* Option pickers */\n .option-group { display: flex; flex-direction: column; gap: 8px; }\n /* The prompt sits on the label's own line: tapping a buy button before\n choosing must not push the pills down under the shopper's finger. */\n .option-label {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 12px;\n min-height: 1.4em;\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n font-weight: 500;\n }\n /* Sizes: compact, still comfortable to tap. wrap → several lines;\n nowrap → one line that scrolls sideways. */\n .option-values {\n display: flex;\n flex-wrap: var(--vio-detail-option-wrap, wrap);\n gap: var(--vio-detail-option-gap, 6px);\n overflow-x: auto;\n scrollbar-width: none;\n }\n .option-values::-webkit-scrollbar { display: none; }\n .option-pill {\n flex: 0 0 auto;\n box-sizing: border-box;\n min-height: var(--vio-detail-option-height, 36px);\n min-width: var(--vio-detail-option-height, 36px);\n padding: 0 var(--vio-detail-option-padding-x, 12px);\n border-radius: var(--vio-detail-option-radius, 0);\n background: #fff;\n border: 1px solid var(--vio-color-border, #e5e5e5);\n cursor: pointer;\n font-family: inherit;\n font-size: var(--vio-detail-option-font-size, 13px);\n font-weight: 500;\n color: inherit;\n transition: border-color 0.15s, background 0.15s;\n }\n .option-pill:hover { border-color: var(--vio-color-text, #0a0a0a); }\n .option-pill[aria-pressed='true'] {\n border-color: var(--vio-color-text, #0a0a0a);\n background: var(--vio-color-text, #0a0a0a);\n color: var(--vio-color-text-on-primary, #fff);\n }\n .option-pill.unavailable {\n opacity: 0.4;\n cursor: not-allowed;\n text-decoration: line-through;\n background: repeating-linear-gradient(-45deg, #fafafa, #fafafa 5px, #f0f0f0 5px, #f0f0f0 10px);\n }\n .option-pill.unavailable:hover { border-color: var(--vio-color-border, #e5e5e5); }\n /* The value chosen, beside the option's name: «Størrelse: M». */\n .option-chosen { color: var(--vio-color-text, #0a0a0a); font-weight: 700; }\n /* A buy button was tapped before choosing: say what is missing. */\n .option-prompt {\n text-transform: none;\n letter-spacing: normal;\n font-size: 13px;\n font-weight: 600;\n color: var(--vio-color-accent, #c14a3b);\n }\n .option-group.needs-choice .option-pill:not(.unavailable) {\n border-color: var(--vio-color-accent, #c14a3b);\n }\n\n /* The buy zone: Vipps first, then quantity + add to cart, then the other\n ways to pay. --vio-detail-buy-position: sticky pins it to the bottom of\n the panel while the shopper scrolls (mobile, mostly). */\n .buy {\n display: flex;\n flex-direction: column;\n gap: var(--vio-detail-buy-gap, 10px);\n position: var(--vio-detail-buy-position, static);\n bottom: 0;\n z-index: 2;\n background: var(--vio-detail-buy-bg, var(--vio-color-surface, #fff));\n padding: var(--vio-detail-buy-padding, 0);\n box-shadow: var(--vio-detail-buy-shadow, none);\n }\n .buy > * { margin-top: 0 !important; }\n /* The buy zone and the description, apart from the name, price and stock:\n a pinned buy zone can slide up over what is in this box (the\n description) but never above it — never over the name, the price or\n the stock line (Mote & Livsstil, 2026-10-28). */\n .purchase { display: flex; flex-direction: column; gap: var(--vio-detail-info-gap, 20px); }\n /* The pickers live in the buy zone: when it is pinned to the bottom of the\n panel (desktop, or a host's sticky), it can never cover them — they\n travel with the buttons they gate (Mote & Livsstil, 2026-10-28). */\n .buy-options {\n display: flex;\n flex-direction: column;\n gap: var(--vio-detail-info-gap, 20px);\n padding-bottom: 4px;\n }\n /* Where the express buttons go while the brand's methods load: neutral,\n the height of one button, no method named. */\n .buy-pending {\n height: var(--vio-detail-button-height, 52px);\n border-radius: var(--vio-detail-button-radius, 0);\n background: linear-gradient(\n 100deg,\n var(--vio-color-surface-muted, #f1f1f1) 30%,\n rgba(255, 255, 255, 0.65) 50%,\n var(--vio-color-surface-muted, #f1f1f1) 70%\n );\n background-size: 200% 100%;\n animation: vio-skeleton-shimmer 1.4s ease-in-out infinite;\n }\n @media (prefers-reduced-motion: reduce) {\n .buy-pending { animation: none; background: var(--vio-color-surface-muted, #f1f1f1); }\n }\n /* Under the buttons: who the shopper is buying from. */\n .seller-note {\n margin: 2px 0 0;\n font-size: var(--vio-detail-seller-note-size, 12px);\n line-height: 1.4;\n color: var(--vio-color-text-secondary, #666);\n text-align: var(--vio-detail-seller-note-align, center);\n }\n .seller-note strong { font-weight: 600; color: var(--vio-color-text, #0a0a0a); }\n .seller-links { display: block; margin-top: 2px; }\n .seller-links a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }\n .seller-links a + a::before { content: '·'; display: inline-block; margin: 0 6px; text-decoration: none; }\n\n /* Qty + CTA row */\n .qty-cta-row {\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 16px;\n align-items: stretch;\n }\n .qty-stepper {\n display: flex;\n align-items: center;\n border: 1px solid var(--vio-color-border, #e5e5e5);\n }\n .qty-btn {\n width: 44px;\n height: var(--vio-detail-button-height, 52px);\n background: #fff;\n border: none;\n cursor: pointer;\n font-size: 18px;\n color: var(--vio-color-text, #0a0a0a);\n font-family: inherit;\n }\n .qty-btn:hover { background: var(--vio-color-surface-hover, #fafafa); }\n .qty-value {\n width: 40px;\n text-align: center;\n font-weight: 600;\n }\n .add-to-cart {\n background: var(--vio-color-text, #0a0a0a);\n color: var(--vio-color-text-on-primary, #fff);\n border: none;\n min-height: var(--vio-detail-button-height, 52px);\n border-radius: var(--vio-detail-button-radius, 0);\n padding: 0 24px;\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.15s;\n }\n .add-to-cart:hover:not(:disabled) { background: #222; }\n .add-to-cart:disabled {\n background: var(--vio-color-text-tertiary, #999);\n cursor: not-allowed;\n }\n /* Klarna express button — sits full-width below the add-to-cart row. */\n /* Generic buy-now for the embedded checkouts, which have no branded\n express button of their own. */\n .buy-now {\n width: 100%;\n margin-top: 10px;\n padding: 14px 24px;\n background: var(--vio-color-text, #0a0a0a);\n color: var(--vio-color-text-on-primary, #fff);\n border: none;\n border-radius: var(--vio-radius-md, 4px);\n font-family: var(--vio-font-sans, inherit);\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n font-weight: 700;\n cursor: pointer;\n }\n .buy-now:hover:not(:disabled) { opacity: 0.9; }\n .buy-now:disabled { opacity: 0.5; cursor: not-allowed; }\n .buy-klarna {\n width: 100%;\n margin-top: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: #ffb3c7; /* Klarna pink */\n color: #0b051d;\n border: none;\n padding: 14px 24px;\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n font-weight: 700;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.15s;\n }\n .buy-klarna .klarna-badge { height: 22px; width: auto; display: block; }\n .buy-klarna:hover:not(:disabled) { background: #ffa0b9; }\n .buy-klarna:disabled { opacity: 0.5; cursor: not-allowed; }\n .buy-applepay .ap-logo { width: 20px; height: 20px; }\n /* Vipps — brand orange buy button. */\n .buy-vipps {\n width: 100%;\n margin-top: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: #ff5b24;\n color: #fff;\n border: none;\n padding: 14px 24px;\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n font-weight: 700;\n cursor: pointer;\n font-family: inherit;\n transition: background 0.15s;\n }\n .buy-vipps .vipps-badge {\n font-size: 20px;\n font-weight: 800;\n letter-spacing: -0.02em;\n text-transform: none;\n }\n .buy-vipps:hover:not(:disabled) { background: #ec4f1c; }\n .buy-vipps:disabled { opacity: 0.5; cursor: not-allowed; }\n /* Under the Express button: what happens in the app. */\n .vipps-note {\n margin: 0;\n font-size: 12px;\n line-height: 1.4;\n color: var(--vio-color-text-secondary, #666);\n text-align: center;\n }\n /* Vipps' own button (web component) — same slot, their drawing. */\n .buy-vipps-official { display: block; width: 100%; margin-top: 10px; cursor: pointer; }\n /* Apple Pay express button — black, per Apple's button guidelines. Only\n shown in Safari (canApplePay). The glyph is the Apple logo (Safari). */\n .buy-applepay {\n width: 100%;\n margin-top: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n background: #000;\n color: #fff;\n border: none;\n padding: 15px 24px;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n letter-spacing: 0.01em;\n }\n .buy-applepay:hover:not(:disabled) { background: #1a1a1a; }\n .buy-applepay:disabled { opacity: 0.5; cursor: not-allowed; }\n\n /* Description */\n /* The description folds: a tap opens it, so it does not take the page. */\n .description-block { border-top: 1px solid var(--vio-color-border, #e5e5e5); }\n .description-block > summary {\n list-style: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 14px 0;\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n font-weight: 600;\n }\n .description-block > summary::-webkit-details-marker { display: none; }\n .description-block > summary::after {\n content: '';\n width: 8px;\n height: 8px;\n border-right: 1.5px solid currentColor;\n border-bottom: 1.5px solid currentColor;\n transform: rotate(45deg) translateY(-2px);\n transition: transform 0.15s ease;\n }\n .description-block[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }\n /* «Beskrivelse» with a preview: the same heading as the folds, then the\n first lines fading out, then «Les mer». */\n .desc-head {\n all: unset;\n box-sizing: border-box;\n width: 100%;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 14px 0 6px;\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n font-weight: 600;\n font-family: inherit;\n }\n .description-preview.clipped .desc-head::after {\n content: '';\n width: 8px;\n height: 8px;\n border-right: 1.5px solid currentColor;\n border-bottom: 1.5px solid currentColor;\n transform: rotate(45deg) translateY(-2px);\n transition: transform 0.15s ease;\n }\n .description-preview.open .desc-head::after { transform: rotate(-135deg) translateY(-2px); }\n .description-preview .description { padding-bottom: 6px; }\n .description-preview.folded .desc-head, .description-preview.open:not(.clipped) .desc-head { padding-bottom: 14px; }\n .description-preview.folded.open .desc-head { padding-bottom: 6px; }\n .description-preview.folded .description { padding-bottom: 14px; }\n .description-preview:not(.clipped) .description { padding-bottom: 14px; }\n .description.collapsed {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: var(--vio-detail-description-preview-lines, 3);\n line-clamp: var(--vio-detail-description-preview-lines, 3);\n overflow: hidden;\n cursor: pointer;\n -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent);\n mask-image: linear-gradient(to bottom, #000 45%, transparent);\n }\n .desc-more {\n all: unset;\n cursor: pointer;\n display: inline-block;\n margin: 0 0 14px;\n font-size: 13px;\n font-weight: 600;\n color: var(--vio-color-text, #0a0a0a);\n text-decoration: underline;\n text-underline-offset: 3px;\n font-family: inherit;\n }\n .description {\n font-size: 14px;\n line-height: 1.6;\n color: var(--vio-color-text-secondary, #444);\n padding-bottom: 14px;\n white-space: pre-line;\n }\n /* Same order on every screen: buy, then the description at the very\n bottom (folded). Hosts that want the buy zone pinned can still set\n --vio-detail-buy-position: sticky. */\n @media (min-width: 601px) {\n .buy {\n position: var(--vio-detail-buy-position, static);\n padding: var(--vio-detail-buy-padding, 12px 0 16px);\n }\n }\n\n /* Skeleton loader: shimmer placeholders mirroring the product layout\n (image, brand, title, price, CTA) for a smooth load-in. */\n .skeleton {\n display: flex;\n flex-direction: column;\n gap: 14px;\n padding: 20px 24px 40px;\n }\n .skeleton > * {\n background: linear-gradient(\n 100deg,\n var(--vio-color-surface-muted, #f1f1f1) 30%,\n rgba(255, 255, 255, 0.65) 50%,\n var(--vio-color-surface-muted, #f1f1f1) 70%\n );\n background-size: 200% 100%;\n animation: vio-skeleton-shimmer 1.4s ease-in-out infinite;\n border-radius: var(--vio-radius-lg, 8px);\n }\n .sk-image { width: 100%; aspect-ratio: 1; border-radius: var(--vio-radius-lg, 12px); }\n .sk-line { height: 14px; }\n .sk-brand { width: 38%; height: 10px; margin-top: 6px; }\n .sk-title { width: 85%; height: 26px; }\n .sk-title-2 { width: 55%; height: 26px; }\n .sk-price { width: 30%; height: 20px; margin-top: 6px; }\n .sk-button { width: 100%; height: 54px; border-radius: 0; margin-top: 10px; }\n @keyframes vio-skeleton-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n @media (prefers-reduced-motion: reduce) {\n .skeleton > * {\n animation: none;\n background: var(--vio-color-surface-muted, #f1f1f1);\n }\n }\n /* «Lagt i handlekurven»: above the page, below where a thumb reaches. */\n .added-toast {\n position: fixed;\n left: 50%;\n bottom: max(16px, env(safe-area-inset-bottom));\n transform: translateX(-50%);\n z-index: 1102;\n width: min(420px, calc(100vw - 32px));\n box-sizing: border-box;\n padding: 14px 16px;\n background: var(--vio-color-surface, #fff);\n color: var(--vio-color-text, #0a0a0a);\n border: 1px solid var(--vio-color-border, #e5e5e5);\n border-radius: var(--vio-radius-lg, 8px);\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n .added-toast-text { font-size: 14px; font-weight: 600; }\n .added-toast-text::before { content: '✓ '; color: #2e7d32; }\n .added-toast-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }\n .added-toast-actions button {\n min-height: 44px;\n padding: 0 12px;\n font-family: inherit;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n border-radius: var(--vio-detail-button-radius, 0);\n }\n .added-toast-checkout {\n background: var(--vio-color-text, #0a0a0a);\n color: var(--vio-color-text-on-primary, #fff);\n border: 1px solid var(--vio-color-text, #0a0a0a);\n }\n .added-toast-continue {\n background: transparent;\n color: var(--vio-color-text, #0a0a0a);\n border: 1px solid var(--vio-color-border, #e5e5e5);\n }\n\n .error {\n padding: 80px 24px;\n text-align: center;\n color: var(--vio-color-accent, #c14a3b);\n font-size: 14px;\n }\n `\n\n /** The cart changed (another tab, the drawer): the line under Vipps counts it again. */\n private boundCartChange = (): void => {\n if (this.open) this.requestUpdate()\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n Vio.cart.addEventListener('change', this.boundCartChange)\n // The page's layout changed: open (and later) details render with it.\n this.unsubscribeLayout?.()\n this.unsubscribeLayout = onGlobalDetailLayoutChange(() => this.requestUpdate())\n this.slotRegistration.connect(this.slotAttributes())\n void this.loadVippsButton()\n document.addEventListener('vio:product-click', this.boundProductClick)\n }\n\n override disconnectedCallback(): void {\n if (this.addedToastTimer) clearTimeout(this.addedToastTimer)\n this.addedToastTimer = null\n document.removeEventListener('vio:product-click', this.boundProductClick)\n Vio.cart.removeEventListener('change', this.boundCartChange)\n this.slotRegistration.clear()\n this.bottomSheet.disconnect()\n this.unsubscribeLayout?.()\n this.unsubscribeLayout = null\n super.disconnectedCallback()\n }\n\n override updated(changed: Map<string, unknown>): void {\n if (changed.has('open')) {\n this.dialogFocus.update(this.open)\n this.bottomSheet.update(this.open)\n }\n if (changed.has('product') || changed.has('open')) {\n this.measureThumbs()\n this.measureDescription()\n }\n // The sheet shows an amount fixed when it is prepared: another quantity or\n // variant (another price) prepares it again, so it shows what is bought.\n if ((changed.has('quantity') || changed.has('selectedOptions')) && this.product && this.applePayAskedFor !== null) {\n if (this.unitPrice * this.quantity !== this.applePayAskedFor) this.prepareApplePaySheet()\n }\n if (changed.has('activeImageIndex')) {\n this.revealActiveThumb()\n this.revealActiveSlide()\n }\n // A variant with its own photos starts the carousel over.\n if (changed.has('selectedOptions') && this.galleryMode === 'carousel') {\n if (this.activeImageIndex !== 0) this.activeImageIndex = 0\n else this.revealActiveSlide()\n }\n this.measureLogo()\n this.announceLayout()\n // The React wrappers set properties after mount.\n if (changed.has('vioSlot') || changed.has('vioSlotName') || changed.has('vioScope') || changed.has('vioScopeName') || changed.has('vioCampaign')) {\n this.slotRegistration.sync(this.slotAttributes())\n }\n }\n\n override willUpdate(changed: Map<string, unknown>): void {\n // Every update: the element's own layout or the page's may have changed.\n this.layoutNow = resolveDetailLayout(this.layout)\n if (changed.has('gallery') || (changed.has('open') && this.open)) this.galleryMode = this.resolveGalleryMode()\n if (changed.has('descriptionMode') || (changed.has('open') && this.open)) {\n const value = this.themeChoice(this.descriptionMode, '--vio-detail-description-mode')\n this.resolvedDescriptionMode = value === 'folded' || value === 'open' ? value : 'preview'\n }\n }\n\n /**\n * `vio:detail-layout-applied` (bubbles, composed), with the applied layout,\n * each time a product renders with a layout it has not been shown with yet:\n * every open of a product, and every change of layout while it is open.\n */\n private announceLayout(): void {\n const product = this.product\n if (!product || this.fetchError) return\n const signature = layoutSignature(this.layoutNow)\n if (this.appliedFor && this.appliedFor.product === product && this.appliedFor.signature === signature) return\n this.appliedFor = { product, signature }\n this.dispatchEvent(\n new CustomEvent('vio:detail-layout-applied', {\n bubbles: true,\n composed: true,\n detail: { ...copyAppliedLayout(this.layoutNow), productId: product.id, sponsorId: this.sponsorId },\n }),\n )\n }\n\n /** An option as the element says it, else as the theme's custom property says it (lower case, unquoted). */\n private themeChoice(own: string, cssVar: string): string {\n const fromTheme = typeof getComputedStyle === 'function' ? getComputedStyle(this).getPropertyValue(cssVar) : ''\n return (own || fromTheme).trim().replace(/^[\"']|[\"']$/g, '').toLowerCase()\n }\n\n /** The attribute wins; else the theme's `--vio-detail-gallery`; else thumbnails. */\n private resolveGalleryMode(): 'thumbs' | 'carousel' {\n return this.themeChoice(this.gallery, '--vio-detail-gallery') === 'carousel' ? 'carousel' : 'thumbs'\n }\n\n private carouselTrack(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>('.carousel-track')\n }\n\n /** The photo in view is the active one (dots, Apple Pay sheet, events). */\n private onCarouselScroll = (): void => {\n const track = this.carouselTrack()\n const step = this.carouselStep(track)\n if (!track || !step) return\n const last = track.children.length - 1\n const idx = Math.min(last, Math.max(0, Math.round(track.scrollLeft / step)))\n if (idx !== this.activeImageIndex) this.activeImageIndex = idx\n }\n\n /** One photo's width plus the gap (with a peek a photo is narrower than the row). */\n private carouselStep(track: HTMLElement | null): number {\n const slide = track?.firstElementChild as HTMLElement | null\n if (!track || !slide || slide.offsetWidth === 0) return 0\n return slide.offsetWidth + (parseFloat(getComputedStyle(track).columnGap) || 0)\n }\n\n /** Bring the active photo into view — only when it is not already the one a swipe is on. */\n private revealActiveSlide(): void {\n const track = this.carouselTrack()\n const step = this.carouselStep(track)\n if (!track || !step) return\n const target = Math.min(this.activeImageIndex * step, track.scrollWidth - track.clientWidth)\n if (Math.abs(track.scrollLeft - target) > step / 2) track.scrollTo({ left: target })\n }\n\n private stepCarousel(direction: 1 | -1): void {\n const last = this.allImages().length - 1\n this.activeImageIndex = Math.min(last, Math.max(0, this.activeImageIndex + direction))\n }\n\n private thumbRow(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>('.gallery-thumbs')\n }\n\n /** Arrows only when the row overflows; each one off at its own end. */\n private measureThumbs(): void {\n const row = this.thumbRow()\n if (!row) return\n const overflow = row.scrollWidth > row.clientWidth + 1\n if (overflow !== this.thumbsOverflow) this.thumbsOverflow = overflow\n this.onThumbsScroll()\n }\n\n private onThumbsScroll = (): void => {\n const row = this.thumbRow()\n if (!row) return\n const atStart = row.scrollLeft <= 1\n const atEnd = row.scrollLeft + row.clientWidth >= row.scrollWidth - 1\n if (atStart !== this.thumbsAtStart) this.thumbsAtStart = atStart\n if (atEnd !== this.thumbsAtEnd) this.thumbsAtEnd = atEnd\n }\n\n /** One arrow press moves most of a visible row. */\n private scrollThumbs(direction: 1 | -1): void {\n const row = this.thumbRow()\n if (row) row.scrollBy({ left: direction * row.clientWidth * 0.8 })\n }\n\n /** The selected thumbnail is always visible: the row scrolls to it, the page never does. */\n private revealActiveThumb(): void {\n const row = this.thumbRow()\n const thumb = row?.querySelectorAll<HTMLElement>('.gallery-thumb')[this.activeImageIndex]\n if (!row || !thumb) return\n const left = thumb.offsetLeft - row.offsetLeft\n if (left < row.scrollLeft || left + thumb.offsetWidth > row.scrollLeft + row.clientWidth) {\n row.scrollTo({ left: Math.max(0, left - (row.clientWidth - thumb.offsetWidth) / 2) })\n }\n }\n\n show(): void {\n this.open = true\n this.hideAddedToast()\n }\n close(): void {\n this.open = false\n // Reset state after the slide-out animation completes.\n setTimeout(() => {\n if (!this.open) {\n // What the opening card said belongs to that product, not the next.\n this.eventSlot = ''\n this.eventContentId = ''\n this.eventContentTitle = ''\n this.eventCampaignId = undefined\n this.eventProductId = ''\n this.product = null\n this.sellerName = null\n this.sellerSettled = false\n this.shippingFrom = null\n this.selectedOptions = {}\n this.selectionPrompt = ''\n this.quantity = 1\n this.activeImageIndex = 0\n this.descriptionOpen = false\n this.fetchError = ''\n }\n }, 400)\n }\n\n private async fetchProduct(): Promise<void> {\n const productIdNum = parseInt(this.productId, 10)\n if (Number.isNaN(productIdNum) || !this.sponsorId) {\n this.product = null\n return\n }\n // Race guard: two quick taps on different cards → only the LATEST\n // request may write state (else the slow response paints product A\n // under product B's id).\n const seq = ++this.fetchSeq\n this.isLoading = true\n this.fetchError = ''\n this.sellerName = null\n this.sellerSettled = false\n this.shippingFrom = null\n\n // Fetch with retry: the commerce backend intermittently returns\n // \"Authentication failed\" under concurrent requests (many cards + the\n // detail firing at once). Retry a few times before surfacing the error.\n let products: Product[] | null = null\n let lastError: unknown = null\n for (let attempt = 0; attempt < 4; attempt++) {\n try {\n // Re-resolve the page currency on every fetch — the host may have\n // switched it since this element was mounted.\n const activeCurrency = getGlobalCurrency() || this.currency\n this.currency = activeCurrency\n const commerce = Vio.commerceFor(this.sponsorId, { campaignId: this.commerceCampaigns() })\n products = await commerce.channel.product.getByIds({\n product_ids: [productIdNum],\n currency: activeCurrency,\n image_size: 'large',\n })\n lastError = null\n break\n } catch (err) {\n lastError = err\n await new Promise((resolve) => setTimeout(resolve, 300))\n }\n }\n\n if (seq !== this.fetchSeq) return // superseded by a newer open\n\n if (lastError) {\n this.fetchError = lastError instanceof Error ? lastError.message : String(lastError)\n console.warn('[VioDetail] fetch failed after retries →', this.fetchError)\n this.isLoading = false\n return\n }\n\n this.optMapCache = new WeakMap()\n this.product = products?.[0] ?? null\n if (this.product) void this.loadSeller(productIdNum, seq)\n if (this.product) void this.loadShippingFrom(productIdNum, seq)\n if (this.product) {\n // Analytics (auto): the detail opened with a concrete product.\n try {\n const price = Number(\n this.product.price?.amount_incl_taxes ?? this.product.price?.amount,\n )\n // The layout it is shown with (0.34) — only a non-default one says so.\n const shown = layoutOriginOf(resolveDetailLayout(this.layout))\n Vio.analytics.track('view_item', {\n context: {\n sponsorId: this.sponsorId > 0 ? Number(this.sponsorId) : undefined,\n ...this.attribution(),\n ...(shown.layoutId\n ? {\n layoutId: shown.layoutId,\n layoutRevision: shown.layoutRevision ?? '',\n experimentId: shown.experimentId,\n variantId: shown.variantId,\n }\n : {}),\n },\n commerce: {\n items: [\n {\n productId: this.product.id,\n name: this.product.title,\n price: Number.isFinite(price) ? price : undefined,\n },\n ],\n value: Number.isFinite(price) ? price : undefined,\n currency: this.product.price?.currency_code,\n },\n })\n } catch {\n /* never break rendering */\n }\n }\n if (!this.product) {\n // Empty response without an exception — never leave a blank open modal.\n this.fetchError = 'Fant ikke produktet.'\n }\n\n if (this.product) {\n // Nothing is chosen for the shopper: an option with a single value is\n // the only one preselected (there is nothing to choose). A size picked\n // for them was bought without being looked at — the first size, the\n // wrong one (Mote & Livsstil, 2026-10-28). The buy buttons ask for the\n // missing choice instead (requireSelection).\n const initial: SelectedOptions = {}\n for (const opt of this.product.options ?? []) {\n const values = normalizeValues(opt.values)\n if (values.length === 1) initial[opt.name] = values[0]!\n }\n this.selectedOptions = initial\n this.selectionPrompt = ''\n // Pre-prepare Apple Pay so its sheet can open synchronously on tap\n // (Apple blocks it otherwise). The button only shows if Apple Pay actually\n // works (real Stripe account + domain registered for Apple Pay).\n this.prepareApplePaySheet()\n void this.loadAvailablePaymentMethods()\n }\n this.isLoading = false\n }\n\n /** Which buy buttons to render — backend-configured per sponsor. */\n private async loadAvailablePaymentMethods(): Promise<void> {\n const spId =\n this.sponsorId ||\n (typeof Vio.campaignForSlot === 'function'\n ? Number(Vio.campaignForSlot(this.activeSlot || null, { campaignId: this.activeCampaignHint })?.primarySponsor?.id)\n : 0) ||\n (globalThis as { __VIO_SPONSOR_ID__?: number }).__VIO_SPONSOR_ID__\n if (!spId) return\n if (spId !== this.methodsSponsorId) {\n this.availableMethods = null\n this.vippsExpress = false\n }\n this.methodsSponsorId = spId\n this.methodsLoading = true\n try {\n const methods = (await Vio.checkout.getAvailablePaymentMethods(spId)) as\n | Array<{ name: string }>\n | unknown\n if (Array.isArray(methods)) {\n this.availableMethods = methods.map((m) => m.name)\n // Read from the list itself (getVippsExpressEnabled answers «yes»\n // when it cannot tell; the line must not).\n const vipps = (methods as Array<{ name?: string; config?: Array<{ name?: string; value?: string }> }>).find(\n (m) => String(m?.name ?? '').toLowerCase() === 'vipps',\n )\n this.vippsExpress = !!vipps && vipps.config?.find((c) => c?.name === 'express')?.value !== 'false'\n } else {\n this.availableMethods = null\n this.vippsExpress = false\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioProductDetail] Failed to load payment methods:', err)\n }\n // Unknown (not \"none\") — render everything rather than nothing.\n this.availableMethods = null\n this.vippsExpress = false\n } finally {\n this.methodsLoading = false\n }\n }\n\n /** The methods are still on their way: a placeholder stands where the buttons go. */\n private get methodsPending(): boolean {\n return this.methodsLoading && this.availableMethods === null\n }\n\n /** Backend names arrive as e.g. \"Apple Pay\" — compare letters only. */\n private methodEnabled(...names: string[]): boolean {\n if (this.methodsPending) return false\n return isMethodEnabled(this.availableMethods, ...names)\n }\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n\n /**\n * Build an option-name → value map for a variant, from every shape the feeds\n * ship: option1/2/3 columns, options/selected_options/variant arrays, plain\n * object maps, and finally the title (value scan first, position fallback).\n */\n private getVariantOptionMap(\n v: ProductVariant | any,\n productOptions: ProductOption[] | undefined,\n ): { map: Record<string, string>; titleParts: string[] } {\n // Memoised per variant object — this runs per variant × option × render\n // (a 20-variant product recomputed it ~700× per render otherwise).\n if (v && typeof v === 'object') {\n const cached = this.optMapCache.get(v)\n if (cached) return cached\n }\n const map: Record<string, string> = {}\n if (!v) return { map, titleParts: [] }\n\n if (v.option1 != null && productOptions?.[0]) {\n map[productOptions[0].name.toLowerCase()] = String(v.option1).trim().toLowerCase()\n }\n if (v.option2 != null && productOptions?.[1]) {\n map[productOptions[1].name.toLowerCase()] = String(v.option2).trim().toLowerCase()\n }\n if (v.option3 != null && productOptions?.[2]) {\n map[productOptions[2].name.toLowerCase()] = String(v.option3).trim().toLowerCase()\n }\n\n const optArray = Array.isArray(v.options)\n ? v.options\n : Array.isArray(v.selected_options)\n ? v.selected_options\n : Array.isArray(v.variant)\n ? v.variant\n : null\n if (optArray) {\n for (const item of optArray) {\n const key = (item.name || item.option || '').trim().toLowerCase()\n const val = (item.value || '').trim().toLowerCase()\n if (key && val) map[key] = val\n }\n } else if (v.options && typeof v.options === 'object') {\n for (const [k, val] of Object.entries(v.options)) {\n map[k.trim().toLowerCase()] = String(val).trim().toLowerCase()\n }\n }\n\n const title = String(v.title ?? '').trim()\n const titleLower = title.toLowerCase()\n\n if (Array.isArray(productOptions)) {\n for (const opt of productOptions) {\n const key = opt.name.toLowerCase()\n if (!map[key]) {\n // Skip values that exist in ANOTHER option too — a title scan can't\n // tell which option \"30\" belongs to when Midje and Lengde both have\n // it, and guessing corrupts the whole map (wrong-variant purchases).\n // Ambiguous values are resolved by the positional fallback below.\n const rawValues = normalizeValues(opt.values).filter(\n (val) =>\n !productOptions.some(\n (other) =>\n other !== opt &&\n normalizeValues(other.values).some(\n (ov) => ov.trim().toLowerCase() === val.trim().toLowerCase(),\n ),\n ),\n )\n const sortedVals = [...rawValues].sort((a, b) => b.length - a.length)\n for (const valStr of sortedVals) {\n const valLower = valStr.trim().toLowerCase()\n const escaped = valLower.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n const regex = new RegExp(`(?:^|[/|\\\\-,;\\\\s])${escaped}(?:$|[/|\\\\-,;\\\\s])`, 'i')\n if (regex.test(titleLower) || titleLower === valLower) {\n map[key] = valLower\n break\n }\n }\n }\n }\n }\n\n const titleParts = title\n .split(/\\s*[/|,]\\s*|\\s+-\\s+/)\n .map((s) => s.trim())\n .filter(Boolean)\n\n if (Array.isArray(productOptions)) {\n productOptions.forEach((opt, idx) => {\n const key = opt.name.toLowerCase()\n if (!map[key] && titleParts[idx] != null) {\n map[key] = titleParts[idx]!.toLowerCase()\n }\n })\n }\n\n const result = { map, titleParts }\n if (v && typeof v === 'object') this.optMapCache.set(v, result)\n return result\n }\n\n /** Option values a variant represents (map values ∪ title parts). */\n private variantOptionValues(v: ProductVariant): string[] {\n const { map, titleParts } = this.getVariantOptionMap(v, this.product?.options)\n const set = new Set(titleParts.map((s) => s.toLowerCase()))\n for (const val of Object.values(map)) set.add(val)\n return Array.from(set)\n }\n\n /** Does a variant part represent this option value? Exact match, plus a\n * whole-token match ONLY for numeric values (\"30\" matches \"30 ml\") — word\n * subsets of text values are not matches (\"Large\" must NOT match\n * \"Extra Large\"). */\n private partMatchesValue(part: string, value: string): boolean {\n if (!part || !value) return false\n const p = String(part).trim().toLowerCase()\n const v = String(value).trim().toLowerCase()\n if (p === v) return true\n if (!/^[\\d.,]+$/.test(v)) return false\n return p.split(/\\s+/).includes(v)\n }\n\n /** Does a variant satisfy every currently-selected option value? */\n private variantMatchesSelection(v: ProductVariant, selection: SelectedOptions): boolean {\n if (!v || !selection) return false\n const entries = Object.entries(selection)\n if (entries.length === 0) return true\n\n const { map, titleParts } = this.getVariantOptionMap(v, this.product?.options)\n const titlePartsLower = titleParts.map((t) => t.toLowerCase())\n\n return entries.every(([optName, val]) => {\n const key = optName.trim().toLowerCase()\n const targetVal = String(val).trim().toLowerCase()\n if (map[key]) {\n return this.partMatchesValue(map[key]!, targetVal)\n }\n return titlePartsLower.some((part) => this.partMatchesValue(part, targetVal))\n })\n }\n\n /** Sellable quantity for a variant, across the stock field zoo. Boolean\n * availability flags win; a numeric field wins next; `null` = the feed does\n * not report stock for this variant (callers fall back to product stock —\n * never assume \"in stock\" from absent data). */\n private getVariantQty(v: ProductVariant | any): number | null {\n if (!v) return 0\n if (v.available === false || v.in_stock === false || v.is_available === false) return 0\n if (v.available === true || v.in_stock === true || v.is_available === true) return 999\n\n const rawQty =\n v.quantity ?? v.inventory_quantity ?? v.stock ?? v.available_quantity ?? v.stock_quantity\n if (rawQty !== null && rawQty !== undefined && rawQty !== '') {\n const parsed = Number(rawQty)\n if (!Number.isNaN(parsed)) return parsed\n }\n\n return null\n }\n\n /** Variant stock with the product-level fallback applied (0 = not sellable). */\n private variantSellableQty(v: ProductVariant | any): number {\n const q = this.getVariantQty(v)\n if (q !== null) return q\n return this.product?.quantity ?? 0\n }\n\n /** Resolve the active variant: full in-stock match → full match → best score\n * (2 per mapped option match, 1 per title match, +0.5 if in stock). */\n private selectedVariant(): ProductVariant | null {\n if (!this.product || !Array.isArray(this.product.variants) || this.product.variants.length === 0) {\n return null\n }\n const sel = this.selectedOptions\n const entries = Object.entries(sel)\n if (entries.length === 0) return this.product.variants[0] ?? null\n\n const fullInStock = this.product.variants.find(\n (v) => this.variantMatchesSelection(v, sel) && this.variantSellableQty(v) > 0,\n )\n if (fullInStock) return fullInStock\n\n const full = this.product.variants.find((v) => this.variantMatchesSelection(v, sel))\n if (full) return full\n\n let bestVariant: ProductVariant | null = null\n let maxScore = -1\n\n for (const v of this.product.variants) {\n const { map, titleParts } = this.getVariantOptionMap(v, this.product?.options)\n const titlePartsLower = titleParts.map((t) => t.toLowerCase())\n let score = 0\n\n for (const [optName, val] of entries) {\n const key = optName.trim().toLowerCase()\n const targetVal = String(val).trim().toLowerCase()\n if (map[key] && this.partMatchesValue(map[key]!, targetVal)) {\n score += 2\n } else if (titlePartsLower.some((part) => this.partMatchesValue(part, targetVal))) {\n score += 1\n }\n }\n\n if (this.variantSellableQty(v) > 0) score += 0.5\n\n if (score > maxScore) {\n maxScore = score\n bestVariant = v\n }\n }\n\n return bestVariant ?? this.product.variants[0] ?? null\n }\n\n /** True if some in-stock variant carries this option value. */\n private isValueAvailable(optionName: string, value: string): boolean {\n if (!this.product || !Array.isArray(this.product.variants) || this.product.variants.length === 0) {\n return true\n }\n const valLower = String(value).trim().toLowerCase()\n const key = optionName.trim().toLowerCase()\n\n return this.product.variants.some((v) => {\n const { map, titleParts } = this.getVariantOptionMap(v, this.product?.options)\n if (this.variantSellableQty(v) <= 0) return false\n if (map[key]) return this.partMatchesValue(map[key]!, valLower)\n return titleParts.some((part) => this.partMatchesValue(part.toLowerCase(), valLower))\n })\n }\n\n private get unitPrice(): number {\n const v = this.selectedVariant()\n const price = v?.price ?? this.product?.price\n // Tax-inclusive is the consumer-facing price (NO convention); `amount` is the\n // fallback when the feed doesn't ship it.\n return price?.amount_incl_taxes ?? price?.amount ?? 0\n }\n\n /**\n * There is something to pay for — whether the express buttons show. With\n * every option chosen, the chosen variant's price; before that, the\n * product's or any variant's: the first variant (what `unitPrice` falls\n * back to) at 0 must not hide Vipps for a size that costs 699.\n */\n private get hasPrice(): boolean {\n if (!this.missingOption()) return this.unitPrice > 0\n const priceOf = (p: { amount_incl_taxes?: number | null; amount?: number } | null | undefined) =>\n Number(p?.amount_incl_taxes ?? p?.amount ?? 0)\n return (\n priceOf(this.product?.price) > 0 ||\n (this.product?.variants ?? []).some((v) => priceOf(v.price) > 0)\n )\n }\n\n private get compareAt(): number | null {\n const v = this.selectedVariant()\n const price = v?.price ?? this.product?.price\n return price?.compare_at_incl_taxes ?? price?.compare_at ?? null\n }\n\n /** The options the shopper has to choose (those with values), in order. */\n private choosableOptions(): ProductOption[] {\n return (this.product?.options ?? []).filter((o) => normalizeValues(o.values).length > 0)\n }\n\n /** The first option still without a value, or null when every one is chosen. */\n private missingOption(): ProductOption | null {\n return this.choosableOptions().find((o) => !String(this.selectedOptions[o.name] ?? '').trim()) ?? null\n }\n\n /**\n * Units that can be sold. With every option chosen, the chosen variant's;\n * before that, the most any variant still matching the partial choice has\n * — so the stepper and «Utsolgt» do not speak for a variant (the first\n * one) the shopper never picked.\n */\n private get availableQuantity(): number {\n if (this.missingOption() && Array.isArray(this.product?.variants) && this.product!.variants.length > 0) {\n const sel = this.selectedOptions\n const qtys = this.product!.variants\n .filter((v) => this.variantMatchesSelection(v, sel))\n .map((v) => this.variantSellableQty(v))\n return qtys.length > 0 ? Math.max(0, ...qtys) : 0\n }\n const v = this.selectedVariant()\n if (v) return this.variantSellableQty(v)\n return this.product?.quantity ?? 0\n }\n\n /**\n * «Få igjen — N stk» only for the variant actually chosen: before a size is\n * picked the count belonged to the first variant, which said «Få igjen» of\n * a product with plenty of other sizes.\n */\n private stockLabel(): { text: string; cls: 'in-stock' | 'low-stock' | 'out-of-stock' } {\n const qty = this.availableQuantity\n if (qty <= 0) return { text: 'Utsolgt', cls: 'out-of-stock' }\n if (qty <= 3 && !this.missingOption()) return { text: `Få igjen — ${qty} stk`, cls: 'low-stock' }\n return { text: 'På lager', cls: 'in-stock' }\n }\n\n /** «Velg størrelse» for a size, «Velg farge» for a colour… */\n private promptFor(option: ProductOption): string {\n const name = String(option.name ?? '').trim()\n if (!name || /^(st(ø|o)rrelse|str\\.?|size)$/i.test(name)) return 'Velg størrelse'\n return `Velg ${name.toLowerCase()}`\n }\n\n /**\n * Every buy button goes through here first: with an option not chosen yet,\n * nothing is added or paid — the picker says what is missing and comes\n * into view (it sits right above the buttons, inside the buy zone).\n */\n private requireSelection(): boolean {\n const missing = this.missingOption()\n if (!missing) {\n this.selectionPrompt = ''\n return true\n }\n this.selectionPrompt = missing.name\n void this.updateComplete.then(() => {\n const group = this.renderRoot.querySelector<HTMLElement>('.option-group.needs-choice')\n // In the buy zone the picker is right above the buttons; apart from it\n // (a layout, 0.34) it may be far away — brought to the middle then.\n const apart = !!group?.closest('.options-apart')\n group?.scrollIntoView?.({ behavior: 'smooth', block: apart ? 'center' : 'nearest' })\n })\n return false\n }\n\n /** Pick an option value. If the exact combination doesn't exist, jump to an\n * in-stock variant that carries the value and adopt its full option map\n * (keeps the selection always resolvable to a real variant). */\n private selectOption(optionName: string, value: string): void {\n this.applyOption(optionName, value)\n if (this.selectionPrompt && !this.missingOption()) this.selectionPrompt = ''\n else if (this.selectionPrompt) this.selectionPrompt = this.missingOption()?.name ?? ''\n // The chosen variant may have fewer units than the stepper shows.\n const max = this.availableQuantity\n if (max > 0 && this.quantity > max) this.quantity = max\n }\n\n private applyOption(optionName: string, value: string): void {\n const newSelection = { ...this.selectedOptions, [optionName]: value }\n const exactInStock = this.product?.variants?.find(\n (v) => this.variantMatchesSelection(v, newSelection) && this.variantSellableQty(v) > 0,\n )\n if (exactInStock) {\n this.selectedOptions = newSelection\n return\n }\n const exactAnyStock = this.product?.variants?.find((v) =>\n this.variantMatchesSelection(v, newSelection),\n )\n if (exactAnyStock) {\n this.selectedOptions = newSelection\n return\n }\n\n const valLower = String(value).trim().toLowerCase()\n const key = optionName.trim().toLowerCase()\n const anyInStockWithVal = this.product?.variants?.find((v) => {\n const { map, titleParts } = this.getVariantOptionMap(v, this.product?.options)\n if (this.variantSellableQty(v) <= 0) return false\n if (map[key]) return this.partMatchesValue(map[key]!, valLower)\n return titleParts.some((p) => this.partMatchesValue(p.toLowerCase(), valLower))\n })\n\n if (anyInStockWithVal) {\n const { map } = this.getVariantOptionMap(anyInStockWithVal, this.product?.options)\n const updated = { ...newSelection }\n for (const opt of this.product?.options ?? []) {\n const k = opt.name.toLowerCase()\n if (map[k]) {\n const optValues = normalizeValues(opt.values)\n const origCase = optValues.find((val) => val.toLowerCase() === map[k]) || map[k]!\n updated[opt.name] = origCase\n }\n }\n this.selectedOptions = updated\n } else {\n this.selectedOptions = newSelection\n }\n }\n\n /* eslint-enable @typescript-eslint/no-explicit-any */\n\n private allImages(): ProductImage[] {\n if (!this.product) return []\n const variantImages = this.selectedVariant()?.images ?? []\n if (variantImages.length > 0) return variantImages\n return this.product.images\n }\n\n private get activeImage(): ProductImage | undefined {\n return this.allImages()[this.activeImageIndex]\n }\n\n /** Add the current product + selected variant + qty to the cart. Returns the variant id used. */\n private addCurrentToCart(): number | undefined {\n if (!this.product) return undefined\n const variant = this.selectedVariant()\n // The brand's display name by the one rule (config and campaigns[] sponsors).\n const sponsorName = resolveSponsorIdentity(this.sponsorId)?.name || undefined\n // Where these units come from: the campaign the place showed, the place,\n // this element and the article — the purchase is split per campaign from\n // it, and Commerce writes it on the order (ADR-0035).\n const { campaignId, slot, contentId, componentTemplateId, contentUrl, contentTitle } = this.attribution()\n // …and the layout the shopper saw (0.34), as shown now: a later change of\n // the page's layout never rewrites these units.\n const layout = layoutOriginOf(this.layoutNow)\n Vio.cart.addProduct({\n product: this.product,\n sponsorId: this.sponsorId,\n sponsorName,\n quantity: this.quantity,\n variantId: variant?.id,\n origin: { campaignId, slot, contentId, componentKind: componentTemplateId, contentUrl, contentTitle, ...layout },\n })\n return variant?.id\n }\n\n private async addToCart(): Promise<void> {\n if (!this.product || this.availableQuantity <= 0 || this.adding) return\n if (!this.requireSelection()) return\n this.adding = true\n try {\n const variantId = this.addCurrentToCart()\n this.dispatchEvent(\n new CustomEvent('vio:added-to-cart', {\n bubbles: true,\n composed: true,\n detail: {\n productId: this.product.id,\n sponsorId: this.sponsorId,\n quantity: this.quantity,\n variantId,\n ...this.attribution(),\n // The detail layout of the add (0.34) — `variantId` above is the product's.\n ...(this.layoutNow.source !== 'default' ? { layout: layoutOriginOf(this.layoutNow) } : {}),\n },\n }),\n )\n this.showAddedToast()\n this.close()\n } finally {\n this.adding = false\n }\n }\n\n /** The toast after an add; it goes by itself after a while. */\n private showAddedToast(): void {\n if (this.noAddedToast) return\n this.addedToast = {\n sponsorId: this.sponsorId,\n detail: { sponsorId: this.sponsorId, express: false, ...this.attribution(), ...sponsorDetail(this.sponsorId) },\n }\n if (this.addedToastTimer) clearTimeout(this.addedToastTimer)\n this.addedToastTimer = setTimeout(() => this.hideAddedToast(), ADDED_TOAST_MS)\n }\n\n private hideAddedToast(): void {\n if (this.addedToastTimer) clearTimeout(this.addedToastTimer)\n this.addedToastTimer = null\n this.addedToast = null\n }\n\n /** «Til kassen»: the checkout of the brand just added to — the host opens it on `vio:checkout-open`, as from the cart. */\n private toastToCheckout(): void {\n const toast = this.addedToast\n this.hideAddedToast()\n if (!toast) return\n const cart = Vio.cart.getCart(toast.sponsorId)\n const total = (cart?.items ?? []).reduce((sum, i) => sum + i.unitPrice * i.quantity, 0)\n // Nothing to pay for (removed meanwhile, or 0 kr): no checkout.\n if (!cart || cart.items.length === 0 || !(total > 0)) return\n this.dispatchEvent(new CustomEvent('vio:checkout-open', { bubbles: true, composed: true, detail: toast.detail }))\n }\n\n private renderAddedToast() {\n if (!this.addedToast) return nothing\n return html`\n <div class=\"added-toast\" part=\"added-toast\" role=\"status\" aria-live=\"polite\">\n <div class=\"added-toast-text\">Lagt i handlekurven</div>\n <div class=\"added-toast-actions\">\n <button class=\"added-toast-checkout\" part=\"added-toast-checkout\" @click=${this.toastToCheckout}>Til kassen</button>\n <button class=\"added-toast-continue\" part=\"added-toast-continue\" @click=${this.hideAddedToast}>Fortsett å handle</button>\n </div>\n </div>\n `\n }\n\n /**\n * Express buy: add to cart, then open the checkout overlay with Klarna\n * preselected. The host app handles `vio:checkout-open` (same event the cart\n * uses) — the `paymentMethod` hint tells it to preselect Klarna so its widget\n * loads immediately. Reuses the working Klarna Payments flow (no express SDK).\n */\n private async buyWithKlarna(): Promise<void> {\n if (!this.product || this.availableQuantity <= 0 || this.adding) return\n if (!this.requireSelection()) return\n this.adding = true\n try {\n this.addCurrentToCart()\n this.close()\n this.dispatchEvent(\n new CustomEvent('vio:checkout-open', {\n bubbles: true,\n composed: true,\n detail: { sponsorId: this.sponsorId, paymentMethod: 'klarna', express: true, ...this.attribution(), ...sponsorDetail(this.sponsorId) },\n }),\n )\n } finally {\n this.adding = false\n }\n }\n\n /** Buy with Vipps — opens the checkout with Vipps preselected. */\n /**\n * Buy now with an embedded checkout (Kustom, Qliro, Walley).\n *\n * Those three have no express path of their own, so the product page showed\n * a \"Kjøp nå\" for Apple Pay, Stripe, Klarna and Vipps and nothing at all for\n * them — the same structural gap the cart footer had. Opens the checkout\n * without preselecting: with a single method the checkout selects it itself,\n * with several the shopper picks.\n *\n * Like every other \"Kjøp nå\" here, it adds to the cart first — so a cart\n * that already had items buys those too. Isolating a single-product purchase\n * needs a checkout that is not bound to the sponsor's cart, which is a\n * separate piece of work and deliberately not done here.\n */\n private buyNow(): void {\n if (!this.product || this.availableQuantity <= 0 || this.adding) return\n if (!this.requireSelection()) return\n this.addCurrentToCart()\n this.close()\n this.dispatchEvent(\n new CustomEvent('vio:checkout-open', {\n bubbles: true,\n composed: true,\n detail: { sponsorId: this.sponsorId, express: false, ...this.attribution(), ...sponsorDetail(this.sponsorId) },\n }),\n )\n }\n\n /**\n * Buy with Vipps — Express: the app opens with address and delivery\n * already there, nothing to fill in here (Vipps' own recommendation,\n * 2026-09-29). When this cart cannot have Express, or Vipps cannot be\n * started, the checkout opens with Vipps preselected, as before.\n */\n /** Vipps' own button when its script answers; our orange one otherwise. */\n private async loadVippsButton(): Promise<void> {\n this.vippsOfficial = await ensureVippsButton()\n }\n\n private buyWithVipps(): void {\n if (!this.product || this.availableQuantity <= 0 || this.adding) return\n if (!this.requireSelection()) return\n // Nothing to pay for: no Vipps payment of 0 kr (CheckoutManager refuses it too).\n if (!(this.unitPrice > 0)) return\n // Vipps pays the sponsor's WHOLE cart — the payment is built on the cart,\n // not on this product (see buyNow). With lines already in it, the line\n // under the button says so before the tap: «Betaler hele handlekurven ·\n // n varer · total» (2026-10-29), and the product is added and the whole\n // cart goes to Vipps Express. `vipps-cart-payment=\"checkout\"` opens our\n // checkout first instead, every line and the total on screen, Vipps\n // preselected (0.31–0.34; Mote & Livsstil, 2026-10-23: a jumper left in\n // the cart was paid along with the product bought «nå», and only Vipps'\n // page had said so).\n if (this.cartHasLines() && this.vippsCartMode() === 'checkout') {\n this.addCurrentToCart()\n this.close()\n this.openCheckoutWithVipps()\n return\n }\n // The overlay first, then the close: no empty moment, no second tap.\n const redirect = beginPaymentRedirect({ method: 'vipps', sponsorId: this.sponsorId, source: 'detail' })\n this.addCurrentToCart()\n this.close()\n void this.startVippsExpressOrCheckout(redirect)\n }\n\n /**\n * The Vipps button will open the app with Express for this product alone\n * (see buyWithVipps): the brand has Express on, and this brand's cart is\n * empty.\n */\n private vippsGoesStraightToApp(): boolean {\n return this.vippsExpress && !this.cartHasLines()\n }\n\n /** This brand's cart already has lines. */\n private cartHasLines(): boolean {\n return (Vio.cart.getCart(this.sponsorId)?.items.length ?? 0) > 0\n }\n\n /** `vipps-cart-payment`, else the theme's, else `express`. */\n private vippsCartMode(): 'express' | 'checkout' {\n return resolveVippsCartPayment(this, this.vippsCartPayment)\n }\n\n /**\n * What the Vipps button will pay when the brand's cart already has lines\n * (`express` mode): every unit in the cart plus this product at the chosen\n * quantity, and their total, as the cart sums it (shipping is chosen in\n * Vipps). null with an empty cart, or in `checkout` mode.\n */\n private wholeCartToPay(): { units: number; total: number; currency: string } | null {\n if (this.vippsCartMode() !== 'express') return null\n const cart = Vio.cart.getCart(this.sponsorId)\n const items = cart?.items ?? []\n if (items.length === 0) return null\n const units = items.reduce((n, i) => n + (Number(i.quantity) || 0), 0) + this.quantity\n const total =\n items.reduce((sum, i) => sum + (Number(i.unitPrice) || 0) * (Number(i.quantity) || 0), 0) +\n this.unitPrice * this.quantity\n return { units, total, currency: cart?.currency || this.currency }\n }\n\n /** The line under the Vipps button: what is paid (a cart with lines) or what happens in the app (Express, empty cart). */\n private renderVippsNote() {\n const whole = this.wholeCartToPay()\n if (whole) {\n return html`<p class=\"vipps-note vipps-note-cart\" part=\"vipps-note\">Betaler hele handlekurven · ${whole.units} varer · ${formatPrice(whole.total, whole.currency)}</p>`\n }\n if (this.vippsGoesStraightToApp()) {\n return html`<p class=\"vipps-note\" part=\"vipps-note\">Vipps fyller inn navn og adresse – du godkjenner og betaler i appen</p>`\n }\n return ''\n }\n\n private async startVippsExpressOrCheckout(redirect: PaymentRedirectHandle): Promise<void> {\n let fallback = true\n try {\n // The seller may have switched Express off on its Vipps row: then the\n // button is an ordinary way into the checkout, with Vipps preselected.\n if (!(await Vio.checkout.getVippsExpressEnabled(this.sponsorId))) {\n redirect.abort('express-off')\n } else {\n const res = await Vio.checkout.startVippsExpress(this.sponsorId)\n // A redirect is on its way; anything else opens the checkout.\n fallback = !res?.payment_url\n if (fallback) redirect.abort('not-started')\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioProductDetail] Vipps Express not started:', err)\n }\n redirect.fail(err instanceof Error ? err.message : String(err))\n }\n if (!fallback) return\n this.openCheckoutWithVipps()\n }\n\n /** The ordinary way in, Vipps preselected: the host opens the checkout on `vio:checkout-open`. */\n private openCheckoutWithVipps(): void {\n this.openCheckoutWith('vipps')\n }\n\n /** The ordinary way in with a method preselected: the host opens the checkout on `vio:checkout-open`. */\n private openCheckoutWith(paymentMethod: 'vipps' | 'apple-pay'): void {\n this.dispatchEvent(\n new CustomEvent('vio:checkout-open', {\n bubbles: true,\n composed: true,\n detail: { sponsorId: this.sponsorId, paymentMethod, express: false, ...this.attribution(), ...sponsorDetail(this.sponsorId) },\n }),\n )\n }\n\n /** Buy with Stripe — opens the checkout with Stripe preselected. */\n private buyWithStripe(): void {\n if (!this.product || this.availableQuantity <= 0 || this.adding) return\n if (!this.requireSelection()) return\n this.addCurrentToCart()\n this.close()\n this.dispatchEvent(\n new CustomEvent('vio:checkout-open', {\n bubbles: true,\n composed: true,\n detail: { sponsorId: this.sponsorId, paymentMethod: 'stripe', express: false, ...this.attribution(), ...sponsorDetail(this.sponsorId) },\n }),\n )\n }\n\n /** Prepare the Apple Pay sheet for this product × quantity; the newest preparation wins. */\n private prepareApplePaySheet(): void {\n const amount = this.unitPrice * this.quantity\n this.applePayAskedFor = amount\n void Vio.checkout\n .prepareApplePayFor(amount, this.currency)\n .then((handle) => {\n if (this.applePayAskedFor !== amount) return\n this.applePayHandle = handle\n this.applePayAmount = amount\n this.applePayOk = handle.available\n })\n .catch(() => {\n if (this.applePayAskedFor !== amount) return\n this.applePayHandle = null\n this.applePayAmount = null\n this.applePayOk = false\n })\n }\n\n /**\n * Express buy with Apple Pay. Runs synchronously inside the click so the\n * Apple Pay sheet keeps the user gesture: add to cart → open checkout (sets\n * state) → launch the sheet. On authorize, `payment-complete` drives the\n * confirmation drawer (same path as the in-checkout Apple Pay button).\n *\n * The sheet's amount is fixed before the tap (Apple blocks a sheet opened\n * after an await, so it cannot wait for the server's cart), while the\n * charge is the sponsor's WHOLE cart. So the sheet opens only when it shows\n * what will be charged: an empty cart, and a sheet prepared for this\n * product × quantity. Otherwise — lines already in the cart, or a quantity\n * whose sheet is still being prepared —\n * the product is added and the checkout opens with Apple Pay preselected:\n * every line and the total on screen, and its own Apple Pay button pays\n * that total.\n */\n private buyWithApplePay(): void {\n if (!this.product || this.availableQuantity <= 0 || !this.applePayHandle) return\n if (!this.requireSelection()) return\n if (!(this.unitPrice > 0)) return\n const cartHasLines = (Vio.cart.getCart(this.sponsorId)?.items.length ?? 0) > 0\n if (cartHasLines || this.applePayAmount !== this.unitPrice * this.quantity) {\n this.addCurrentToCart()\n this.close()\n this.openCheckoutWith('apple-pay')\n return\n }\n this.addCurrentToCart()\n try {\n Vio.checkout.open(this.sponsorId)\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioProductDetail] checkout open failed:', err)\n }\n return\n }\n // Fire the pre-prepared Apple Pay sheet SYNCHRONOUSLY (no await before it)\n // so it stays inside the tap gesture — Apple blocks the sheet otherwise.\n // On approval, show() dispatches payment-complete → the confirmation drawer.\n void this.applePayHandle.show()\n this.close()\n }\n\n /**\n * The product's cheapest rate for the page's market — the rates the\n * backend cart offers for its line. A rate in another currency than the\n * product's price is not shown (never a price the shopper would not pay).\n */\n private async loadShippingFrom(productId: number, seq: number): Promise<void> {\n let rates: Array<{ name?: string; price: number; currency: string; description?: string; logoUrl?: string }> | null = null\n try {\n const product = Vio.commerceFor(this.sponsorId, { campaignId: this.commerceCampaigns() }).channel.product as {\n getShippingRates?: (\n id: number,\n o?: { currency?: string },\n ) => Promise<Array<{ name?: string; price: number; currency: string; description?: string; logoUrl?: string }> | null>\n }\n rates = typeof product.getShippingRates === 'function'\n ? await product.getShippingRates(productId, { currency: this.currency })\n : null\n } catch {\n rates = null\n }\n if (seq !== this.fetchSeq) return // another product opened meanwhile\n const currency = String(this.product?.price?.currency_code ?? this.currency ?? '').toUpperCase()\n const usable = (rates ?? []).filter((r) => !r.currency || r.currency.toUpperCase() === currency)\n const cheapest = usable[0]\n this.shippingFrom = cheapest ? { price: cheapest.price, currency: cheapest.currency || currency } : null\n this.shippingRates = usable.map((r) => ({\n name: String(r.name ?? ''),\n price: r.price,\n currency: r.currency || currency,\n description: String(r.description ?? '').trim(),\n logoUrl: String(r.logoUrl ?? ''),\n }))\n }\n\n /**\n * `gallery=\"carousel\"`: every photo in one row that snaps one at a time —\n * swipe on touch, arrows with a mouse — and a dot per photo over it\n * instead of thumbnails, so the name, price and sizes come up higher.\n */\n private renderCarousel(images: ProductImage[], title: string) {\n const count = images.length\n const current = Math.min(this.activeImageIndex, Math.max(0, count - 1))\n return html`\n <div class=\"gallery carousel\" part=\"gallery\">\n <div class=\"carousel-track\" part=\"image\" @scroll=${this.onCarouselScroll}>\n ${images.map(\n (img, idx) => html`\n <div class=\"carousel-slide\" part=\"slide\" aria-label=${`Bilde ${idx + 1} av ${count}`}>\n <img src=${img.url} alt=${idx === 0 ? title : ''} loading=${idx === 0 ? 'eager' : 'lazy'} />\n </div>\n `,\n )}\n </div>\n ${count > 1\n ? html`\n <button\n class=\"carousel-arrow prev\"\n part=\"carousel-arrow\"\n aria-label=\"Forrige bilde\"\n ?disabled=${current === 0}\n @click=${() => this.stepCarousel(-1)}\n >‹</button>\n <button\n class=\"carousel-arrow next\"\n part=\"carousel-arrow\"\n aria-label=\"Neste bilde\"\n ?disabled=${current === count - 1}\n @click=${() => this.stepCarousel(1)}\n >›</button>\n <div class=\"carousel-dots\" part=\"image-dots\" aria-hidden=\"true\">\n ${images.map((_, idx) => html`<span class=\"carousel-dot ${idx === current ? 'active' : ''}\"></span>`)}\n </div>\n `\n : ''}\n </div>\n `\n }\n\n /**\n * «Beskrivelse», not shut: the first lines show, fading out, and a tap on\n * the heading, the text or «Les mer» opens the rest (Angelo, 2026-10-28).\n * A description that fits in the preview has nothing to open.\n */\n private renderDescription(text: string) {\n const mode = this.resolvedDescriptionMode\n if (mode === 'open') {\n return html`<div class=\"description-block description-preview open\" part=\"description\">\n <div class=\"desc-head\">Beskrivelse</div>\n <div class=\"description\">${text}</div>\n </div>`\n }\n // folded: only the heading until a tap, like the other folds. preview:\n // the first lines; only a description longer than them has a fold at all.\n const foldable = mode === 'folded' || this.descriptionClipped\n const open = this.descriptionOpen || !foldable\n const toggle = () => {\n if (foldable) this.descriptionOpen = !this.descriptionOpen\n }\n return html`<div class=\"description-block description-preview ${open ? 'open' : ''} ${foldable ? 'clipped' : ''} ${mode}\" part=\"description\">\n <button class=\"desc-head\" type=\"button\" aria-expanded=${open ? 'true' : 'false'} @click=${toggle}>Beskrivelse</button>\n ${mode === 'folded' && !open\n ? nothing\n : html`<div class=\"description ${open ? '' : 'collapsed'}\" @click=${() => !this.descriptionOpen && toggle()}>${text}</div>`}\n ${mode === 'preview' && this.descriptionClipped\n ? html`<button class=\"desc-more\" type=\"button\" @click=${toggle}>${this.descriptionOpen ? 'Vis mindre' : 'Les mer'}</button>`\n : nothing}\n </div>`\n }\n\n /** Is the preview hiding part of the text? Measured with the preview applied. */\n private measureDescription(): void {\n const el = this.renderRoot.querySelector<HTMLElement>('.description-preview .description')\n if (!el || this.descriptionOpen) return\n const wasCollapsed = el.classList.contains('collapsed')\n el.classList.add('collapsed')\n const clipped = el.scrollHeight > el.clientHeight + 1\n if (!wasCollapsed) el.classList.remove('collapsed')\n if (clipped !== this.descriptionClipped) this.descriptionClipped = clipped\n }\n\n private renderHighlights() {\n // The host's list when it gives one; otherwise the brand's own (Settings → Brand).\n const own = (Array.isArray(this.highlights) ? this.highlights : []).filter((h) => h && h.title)\n const items = own.length ? own : resolveSponsorIdentity(this.sponsorId)?.highlights ?? []\n if (items.length === 0) return nothing\n return html`<ul class=\"highlights\" part=\"highlights\">\n ${items.map((h) => {\n const path = h.icon ? HIGHLIGHT_ICONS[h.icon] : undefined\n const icon = path\n ? html`<svg class=\"hl-icon\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=${path}></path></svg>`\n : h.icon\n ? html`<img class=\"hl-icon\" src=${h.icon} alt=\"\" />`\n : nothing\n return html`<li class=\"hl\" part=\"highlight\">\n ${icon}\n <span class=\"hl-title\">${h.title}</span>\n ${h.text ? html`<span class=\"hl-text\">${h.text}</span>` : nothing}\n </li>`\n })}\n </ul>`\n }\n\n /**\n * «Frakt & retur», folded like «Beskrivelse»: the delivery options for the\n * page's country with their price, and the right of withdrawal with the\n * brand's own terms and returns pages when it gave them.\n */\n private renderShippingReturns() {\n const identity = resolveSponsorIdentity(this.sponsorId)\n // A description that only repeats the product, the brand or the seller\n // (products writes those as defaults on imports) is no delivery time.\n const rates = shippingRatesShown(this.shippingRates, [\n this.product?.title,\n this.product?.brand,\n this.sellerName,\n identity?.name,\n ])\n // The delivery time is what the brand wrote on each rate («Leveringstid\n // 1-5 dager»): once under the list when every rate says the same, on each\n // row when they differ; the host's delivery-time when no rate says any.\n const times = [...new Set(rates.map((r) => r.description).filter(Boolean))]\n const perRateTime = times.length > 1\n const sharedTime =\n times.length === 1 ? times[0] : times.length === 0 && this.deliveryTime.trim() ? `Leveringstid: ${this.deliveryTime.trim()}` : ''\n const links = [\n identity?.refundPolicyUrl\n ? html`<a href=${identity.refundPolicyUrl} target=\"_blank\" rel=\"noopener noreferrer\">Angrerett og retur</a>`\n : null,\n identity?.termsUrl ? html`<a href=${identity.termsUrl} target=\"_blank\" rel=\"noopener noreferrer\">Kjøpsvilkår</a>` : null,\n ].filter(Boolean)\n return html`<details class=\"description-block shipping-returns\" part=\"shipping-returns\">\n <summary>Frakt & retur</summary>\n <div class=\"description shipping-returns-body\">\n <div class=\"sr-title\">Frakt</div>\n ${rates.length\n ? html`<ul class=\"sr-rates\">\n ${rates.map((r) => {\n const { carrier, method } = splitRateName(r.name)\n const logo = r.logoUrl || carrierLogo(this.carrierLogos, carrier)\n return html`<li>\n ${logo\n ? html`<img class=\"sr-logo\" src=${logo} alt=${carrier} />`\n : lineIcon(rateIcon(r.name ?? ''), 'line-icon sr-icon')}\n <span class=\"sr-rate\">\n <span class=\"sr-carrier\">${carrier || method || 'Frakt'}</span>\n ${carrier && method ? html`<span class=\"sr-method\">${method}</span>` : nothing}\n ${perRateTime && r.description ? html`<span class=\"sr-method\">${r.description}</span>` : nothing}\n </span>\n <span class=\"sr-price\">${r.price <= 0 ? 'Gratis' : formatPrice(r.price, r.currency)}</span>\n </li>`\n })}\n </ul>`\n : html`<p>Fraktprisen vises i kassen.</p>`}\n ${sharedTime\n ? html`<p class=\"sr-line sr-time\">${lineIcon('clock', 'line-icon sr-icon')}<span>${sharedTime}</span></p>`\n : nothing}\n <div class=\"sr-title\">Retur</div>\n <p class=\"sr-line\">${lineIcon('return', 'line-icon sr-icon')}<span>Du har 14 dagers angrerett fra du mottar varen.</span></p>\n ${links.length ? html`<p class=\"sr-links\">${links}</p>` : nothing}\n </div>\n </details>`\n }\n\n /** Under the price: «Frakt fra X · 14 dagers angrerett» (or «Gratis frakt · …»). */\n private renderDeliveryNote() {\n const ship = this.shippingFrom\n const shipping = ship ? (ship.price <= 0 ? 'Gratis frakt' : `Frakt fra ${formatPrice(ship.price, ship.currency)}`) : ''\n return html`<div class=\"delivery-note\" part=\"delivery-note\">\n ${shipping ? html`<span part=\"delivery-shipping\">${shipping}</span><span aria-hidden=\"true\"> · </span>` : ''}<span\n part=\"delivery-withdrawal\"\n >14 dagers angrerett</span\n >\n </div>`\n }\n\n /** The seller's Company name; the brand when there is none; nothing while asking. */\n private headerName(): string {\n if (this.sellerName) return this.sellerName\n return this.sellerSettled ? (this.product?.brand ?? '') : ''\n }\n\n private async loadSeller(productId: number, seq: number): Promise<void> {\n let name: string | null = null\n try {\n name = await Vio.commerceFor(this.sponsorId, { campaignId: this.commerceCampaigns() }).channel.product.getSellerCompany(productId)\n } catch {\n name = null\n }\n if (seq !== this.fetchSeq) return // another product opened meanwhile\n this.sellerName = name\n this.sellerSettled = true\n }\n\n /**\n * Who sells the product, top left beside the close (Mote & Livsstil,\n * 2026-10-22): the logo of the sponsor the product was fetched with — the\n * product's brand, never the article's — with its name as `alt`; without a\n * logo that loads, its name; without an identity, the seller's Company name\n * (or the product's brand) once known. Size: --vio-detail-logo-height.\n */\n private renderTopbarSponsor() {\n const identity = resolveSponsorIdentity(this.sponsorId)\n const mark = identity ? renderSponsorMark(this, identity, { logo: 'topbar-logo', name: 'topbar-name' }) : nothing\n if (mark !== nothing) {\n // A logo: in a clipping box (for the zoom), and — when the file turns\n // out square, a mark rather than a wordmark — with the name beside it,\n // so the shopper can tell whose it is.\n if (identity && usableLogo(identity)) {\n return html`<span class=\"topbar-logo-box\">${mark}</span\n ><span class=\"topbar-name topbar-mark-name\">${identity.name}</span>`\n }\n return mark\n }\n const name = this.headerName()\n return name ? html`<span class=\"topbar-name\">${name}</span>` : nothing\n }\n\n /**\n * Under the buy buttons: «Du handler direkte hos {brand}.» — the brand the\n * product was fetched with (the sponsor; its Company name or the product's\n * brand when no identity is known), never the article's. Nothing when no\n * name is known.\n */\n private renderSellerNote() {\n const identity = resolveSponsorIdentity(this.sponsorId)\n const name = identity?.name || this.headerName()\n if (!name) return nothing\n // The brand's own pages, when it gave them (Settings → Brand): its terms\n // and its returns policy, opened in a new tab.\n const links = [\n identity?.termsUrl ? html`<a href=${identity.termsUrl} target=\"_blank\" rel=\"noopener noreferrer\" part=\"seller-terms\">Kjøpsvilkår</a>` : null,\n identity?.refundPolicyUrl ? html`<a href=${identity.refundPolicyUrl} target=\"_blank\" rel=\"noopener noreferrer\" part=\"seller-refund\">Angrerett og retur</a>` : null,\n ].filter(Boolean)\n return html`<p class=\"seller-note\" part=\"seller-note\">\n Du handler direkte hos <strong>${name}</strong>.${links.length ? html`<span class=\"seller-links\">${links}</span>` : nothing}\n </p>`\n }\n\n /** Square-ish logo (4:5 to 5:4) → the top bar shows the name beside it. */\n private measureLogo(): void {\n const img = this.renderRoot.querySelector<HTMLImageElement>('.topbar-logo')\n if (!img) {\n if (this.logoSquare) this.logoSquare = false\n return\n }\n const decide = () => {\n if (!img.naturalWidth || !img.naturalHeight) return\n const ratio = img.naturalWidth / img.naturalHeight\n const square = ratio >= 0.8 && ratio <= 1.25\n if (square !== this.logoSquare) this.logoSquare = square\n }\n if (img.complete) decide()\n else img.addEventListener('load', decide, { once: true })\n }\n\n override render() {\n return html`\n <div class=\"backdrop\" @click=${this.close}></div>\n <div class=\"modal\" role=\"dialog\" aria-modal=\"true\" aria-label=\"Produkt\" tabindex=\"-1\">\n <div class=\"handle\" @click=${this.close} aria-hidden=\"true\"></div>\n <div class=\"topbar\" part=\"topbar\">\n <div class=\"topbar-sponsor ${this.logoSquare ? 'is-square' : ''}\" part=\"sponsor\">${this.renderTopbarSponsor()}</div>\n <button class=\"close\" part=\"close\" @click=${this.close} aria-label=\"Lukk\">×</button>\n </div>\n\n ${this.renderBody()}\n </div>\n ${this.renderAddedToast()}\n `\n }\n\n private renderBody() {\n if (this.isLoading && !this.product) {\n return html`\n <div class=\"skeleton\" role=\"status\" aria-busy=\"true\" aria-label=\"Laster produkt\">\n <div class=\"sk-image\"></div>\n <div class=\"sk-line sk-brand\"></div>\n <div class=\"sk-line sk-title\"></div>\n <div class=\"sk-line sk-title-2\"></div>\n <div class=\"sk-line sk-price\"></div>\n <div class=\"sk-button\"></div>\n </div>\n `\n }\n if (this.fetchError) {\n return html`<div class=\"error\">Kunne ikke laste produkt: ${this.fetchError}</div>`\n }\n if (!this.product) return html``\n\n const p = this.product\n const images = this.allImages()\n const activeImage = this.activeImage\n\n return html`\n <div class=\"body\">\n ${this.galleryMode === 'carousel' ? this.renderCarousel(images, p.title) : html`<div class=\"gallery\" part=\"gallery\">\n <div class=\"gallery-main\" part=\"image\">\n ${activeImage?.url\n ? html`<img src=${activeImage.url} alt=${p.title} />`\n : ''}\n </div>\n ${images.length > 1\n ? html`\n <div class=\"thumbs ${this.thumbsOverflow ? 'overflows' : ''}\">\n <button\n class=\"thumbs-arrow prev\"\n part=\"thumbs-arrow\"\n aria-label=\"Forrige bilder\"\n ?disabled=${this.thumbsAtStart}\n @click=${() => this.scrollThumbs(-1)}\n >‹</button>\n <div class=\"gallery-thumbs\" part=\"thumbs\" @scroll=${this.onThumbsScroll}>\n ${images.map(\n (img, idx) => html`\n <button\n class=\"gallery-thumb ${idx === this.activeImageIndex ? 'active' : ''}\"\n part=${idx === this.activeImageIndex ? 'thumb thumb-active' : 'thumb'}\n @click=${() => (this.activeImageIndex = idx)}\n aria-label=${`Bilde ${idx + 1}`}\n aria-current=${idx === this.activeImageIndex ? 'true' : 'false'}\n >\n <img src=${img.url} alt=\"\" loading=\"lazy\" />\n </button>\n `,\n )}\n </div>\n <button\n class=\"thumbs-arrow next\"\n part=\"thumbs-arrow\"\n aria-label=\"Neste bilder\"\n ?disabled=${this.thumbsAtEnd}\n @click=${() => this.scrollThumbs(1)}\n >›</button>\n </div>\n `\n : ''}\n </div>`}\n\n <div class=\"info\" part=\"info\">\n ${this.renderSections(this.layoutNow.sections)}\n </div>\n </div>\n `\n }\n\n /**\n * The info column in the applied layout's order (0.34) — the real DOM in\n * that order, never CSS `order`, the same on every screen. The default\n * order renders exactly the column before 0.34: brand, `.headline` (the\n * title row with the stock, the price row), then `.purchase` — `.buy` with\n * the options first — and highlights, description, «Frakt & retur» in it.\n *\n * A run of `title` / `stock` / `price` is one `.headline`; `title`\n * right before `stock` share the title row. `options` right before\n * `purchase` live in `.buy` (a pinned buy zone keeps them); elsewhere they\n * are a block of their own. Everything after `purchase` goes in\n * `.purchase`, as the description does by default: a pinned buy zone may\n * slide over it, never over what comes before.\n */\n private renderSections(sections: ReadonlyArray<DetailSectionId>): unknown[] {\n const out: unknown[] = []\n for (let i = 0; i < sections.length; i++) {\n const s = sections[i]!\n if (s === 'title' || s === 'stock' || s === 'price') {\n let j = i\n while (j < sections.length && ['title', 'stock', 'price'].includes(sections[j]!)) j++\n out.push(this.renderHeadline(sections.slice(i, j)))\n i = j - 1\n continue\n }\n if (s === 'options' && sections[i + 1] === 'purchase') continue\n if (s === 'purchase') {\n const optionsInBuy = sections[i - 1] === 'options'\n out.push(this.renderPurchase(optionsInBuy, sections.slice(i + 1)))\n break\n }\n out.push(this.renderSection(s))\n }\n return out\n }\n\n /** A run of title / stock / price: one `.headline`. */\n private renderHeadline(run: ReadonlyArray<DetailSectionId>) {\n const p = this.product!\n const stock = this.stockLabel()\n const compare = this.compareAt\n const showCompare = compare !== null && compare > this.unitPrice\n const name = html`<h2 class=\"name\" part=\"title\">${p.title}</h2>`\n const stockLine = html`<div class=\"stock ${stock.cls}\" part=\"stock\">${stock.text}</div>`\n const parts: unknown[] = []\n for (let i = 0; i < run.length; i++) {\n const s = run[i]\n if (s === 'title' && run[i + 1] === 'stock') {\n parts.push(html`<div class=\"title-row\">\n ${name}\n ${stockLine}\n </div>`)\n i++\n } else if (s === 'title') {\n parts.push(html`<div class=\"title-row\">${name}</div>`)\n } else if (s === 'stock') {\n parts.push(stockLine)\n } else {\n parts.push(html`<div class=\"price-row\">\n <span class=\"price\" part=\"price\">${formatPrice(this.unitPrice, p.price.currency_code)}</span>\n ${showCompare\n ? html`<span class=\"compare-at\">${formatPrice(\n compare,\n p.price.currency_code,\n )}</span>`\n : ''}\n </div>`)\n }\n }\n return html`<div class=\"headline\">\n ${parts}\n </div>`\n }\n\n /** One section that is not the headline nor the purchase group. */\n private renderSection(section: DetailSectionId) {\n const p = this.product!\n switch (section) {\n case 'brand':\n return p.brand ? html`<div class=\"brand\" part=\"brand\">${p.brand}</div>` : ''\n case 'options':\n // Apart from the buttons: they still ask for the choice (requireSelection).\n return p.options.length > 0\n ? html`<div class=\"buy-options options-apart\" part=\"buy-options\">${this.renderOptionPickers(p.options)}</div>`\n : ''\n case 'highlights':\n return this.renderHighlights()\n case 'description':\n return p.description ? this.renderDescription(this.stripHtml(p.description)) : ''\n case 'shippingReturns':\n return this.renderShippingReturns()\n default:\n return ''\n }\n }\n\n /**\n * The SDK-managed buy group, never split: «Frakt fra…», Vipps / Apple Pay /\n * the other ways to pay, quantity + «Legg i handlekurv», «Du handler direkte\n * hos …». The options when they come right before it; then what follows it.\n */\n private renderPurchase(optionsInBuy: boolean, rest: ReadonlyArray<DetailSectionId>) {\n const p = this.product!\n const optionsApart = !optionsInBuy && p.options.length > 0\n return html`<div class=${optionsApart ? 'purchase options-apart' : 'purchase'}>\n <div class=\"buy\" part=\"buy\">\n ${optionsInBuy && p.options.length > 0\n ? html`<div class=\"buy-options\" part=\"buy-options\">${this.renderOptionPickers(p.options)}</div>`\n : ''}\n ${this.renderDeliveryNote()}\n ${this.methodsPending && this.availableQuantity > 0\n ? html`<div class=\"buy-pending\" part=\"buy-pending\" role=\"status\" aria-label=\"Laster betalingsmåter\"></div>`\n : ''}\n ${this.availableQuantity > 0 && this.hasPrice && this.methodEnabled('vipps')\n ? this.vippsOfficial\n ? html`\n <vipps-mobilepay-button\n class=\"buy-vipps-official\"\n part=\"buy-vipps\"\n brand=\"vipps\"\n language=\"no\"\n verb=\"buy\"\n variant=\"primary\"\n rounded=\"true\"\n stretched=\"true\"\n role=\"button\"\n aria-label=\"Kjøp nå med Vipps\"\n @click=${this.buyWithVipps}\n ></vipps-mobilepay-button>\n `\n : html`\n <button\n class=\"buy-vipps\"\n part=\"buy-vipps\"\n @click=${this.buyWithVipps}\n ?disabled=${this.adding}\n aria-label=\"Kjøp nå med Vipps\"\n >\n <span>Kjøp nå med</span>\n <span class=\"vipps-badge\">vipps</span>\n </button>\n `\n : ''}\n ${this.availableQuantity > 0 && this.hasPrice && this.methodEnabled('vipps')\n ? this.renderVippsNote()\n : ''}\n\n <div class=\"qty-cta-row\" part=\"quantity-row\">\n <div class=\"qty-stepper\">\n <button\n class=\"qty-btn\"\n @click=${() => (this.quantity = Math.max(1, this.quantity - 1))}\n aria-label=\"Reduser antall\"\n >\n −\n </button>\n <span class=\"qty-value\">${this.quantity}</span>\n <button\n class=\"qty-btn\"\n @click=${() =>\n (this.quantity = Math.min(this.availableQuantity, this.quantity + 1))}\n aria-label=\"Øk antall\"\n ?disabled=${this.quantity >= this.availableQuantity}\n >\n +\n </button>\n </div>\n <button\n class=\"add-to-cart\"\n part=\"add-to-cart\"\n @click=${this.addToCart}\n ?disabled=${this.availableQuantity <= 0 || this.adding}\n >\n ${this.adding\n ? 'Legger til…'\n : this.availableQuantity <= 0\n ? 'Utsolgt'\n : 'Legg i handlekurv'}\n </button>\n </div>\n\n ${this.availableQuantity > 0 &&\n this.methodEnabled(...NO_EXPRESS_BUTTON_METHODS)\n ? html`\n <button\n class=\"buy-now\"\n @click=${this.buyNow}\n ?disabled=${this.adding}\n aria-label=\"Kjøp nå\"\n >\n Kjøp nå\n </button>\n `\n : ''}\n\n ${this.availableQuantity > 0 &&\n this.hasPrice &&\n this.applePayOk &&\n this.methodEnabled('apple-pay', 'applepay')\n ? html`\n <button\n class=\"buy-applepay\"\n @click=${this.buyWithApplePay}\n ?disabled=${this.adding}\n aria-label=\"Kjøp nå med Apple Pay\"\n >\n <span>Kjøp nå med</span>\n <svg class=\"ap-logo\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z\"/></svg>\n <span>Apple Pay</span>\n </button>\n `\n : ''}\n ${this.availableQuantity > 0 && this.methodEnabled('stripe')\n ? html`\n <button\n class=\"buy-stripe\"\n @click=${this.buyWithStripe}\n ?disabled=${this.adding}\n aria-label=\"Kjøp nå med Stripe\"\n style=\"width: 100%; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; background: #635bff; color: #fff; border: none; padding: 14px 24px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;\"\n >\n <span>Kjøp nå med</span>\n <img\n src=${STRIPE_LOGO_SRC}\n style=\"height: 20px; display: block; filter: brightness(0) invert(1);\"\n alt=\"Stripe\"\n />\n </button>\n `\n : ''}\n ${this.availableQuantity > 0 && this.methodEnabled('klarna')\n ? html`\n <button\n class=\"buy-klarna\"\n @click=${this.buyWithKlarna}\n ?disabled=${this.adding}\n >\n <span>Kjøp nå med</span>\n <img\n class=\"klarna-badge\"\n src=\"https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg\"\n alt=\"Klarna\"\n />\n </button>\n `\n : ''}\n\n ${this.renderSellerNote()}\n </div>\n\n ${this.renderSections(rest)}\n </div>`\n }\n\n private renderOptionPickers(options: ProductOption[]) {\n if (options.length === 0) return ''\n return html`${options.map((opt) => {\n const values = normalizeValues(opt.values)\n if (values.length === 0) return ''\n const chosen = String(this.selectedOptions[opt.name] ?? '').trim()\n const asked = this.selectionPrompt === opt.name && !chosen\n return html`\n <div class=\"option-group ${asked ? 'needs-choice' : ''}\" part=\"option-group\">\n <div class=\"option-label\" part=\"option-label\">\n <span\n >${opt.name}${chosen ? html`: <span class=\"option-chosen\" part=\"option-chosen\">${chosen}</span>` : ''}</span\n >\n ${asked\n ? html`<span class=\"option-prompt\" part=\"option-prompt\" role=\"alert\">${this.promptFor(opt)}</span>`\n : ''}\n </div>\n <div class=\"option-values\" part=\"options\">\n ${values.map((val) => {\n const available = this.isValueAvailable(opt.name, val)\n const currentVal = this.selectedOptions[opt.name] ?? ''\n const isSelected =\n String(currentVal).trim().toLowerCase() === String(val).trim().toLowerCase()\n return html`\n <button\n class=\"option-pill ${available ? '' : 'unavailable'}\"\n part=${isSelected ? 'option option-selected' : 'option'}\n @click=${() => this.selectOption(opt.name, val)}\n aria-pressed=${isSelected}\n ?disabled=${!available}\n title=${available ? '' : 'Utsolgt'}\n >\n ${val}\n </button>\n `\n })}\n </div>\n </div>\n `\n })}`\n }\n\n /** Best-effort HTML strip for description. */\n private stripHtml(html: string): string {\n return html\n .replace(/<br\\s*\\/?>/gi, '\\n')\n .replace(/<\\/p>/gi, '\\n\\n')\n .replace(/<[^>]+>/g, '')\n .replace(/ /g, ' ')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .trim()\n }\n}\n\n/**\n * GraphQL sometimes returns `ProductOption.values` as a comma-joined string\n * (\"S,M,L,XL\") instead of an array. Normalize defensively.\n */\nfunction normalizeValues(raw: unknown): string[] {\n if (Array.isArray(raw)) {\n return raw.map((v) => String(v).trim()).filter((v) => v.length > 0)\n }\n if (typeof raw === 'string') {\n return raw\n .split(',')\n .map((v) => v.trim())\n .filter((v) => v.length > 0)\n }\n return []\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vio-product-detail': VioProductDetail\n }\n}\n\n/**\n * The rates «Frakt & retur» shows: each description through\n * `shippingDescriptionOf` — filler, a repeat of the rate's own name, or of\n * any of `repeats` (the product's title, its brand, the seller's and the\n * sponsor's display names) is no description (''). Pure; copies.\n */\nexport function shippingRatesShown<T extends { name: string; description: string }>(\n rates: ReadonlyArray<T>,\n repeats: ReadonlyArray<unknown> = [],\n): T[] {\n return rates.map((r) => ({ ...r, description: shippingDescriptionOf(r.description, [r.name, ...repeats]) }))\n}\n\n/**\n * A rate name as the brand typed it, «Carrier - how» («Helthjem - til\n * postkasse/dørmatte», «Bring - Pakke i postkasse»): the carrier, and the way\n * it delivers with a capital. A name without the dash is all `method`.\n */\nexport function splitRateName(name: string | undefined): { carrier: string; method: string } {\n const text = String(name ?? '').trim()\n const m = text.match(/^(.+?)\\s+[-–—]\\s+(.+)$/)\n if (!m?.[1] || !m[2]) return { carrier: '', method: text }\n const method = m[2].trim()\n return { carrier: m[1].trim(), method: method.charAt(0).toUpperCase() + method.slice(1) }\n}\n","/**\n * <vio-cart> — slide-in cart drawer, reactively bound to `Vio.cart`.\n *\n * Subscribes to CartManager's `change` events on connect; auto-renders\n * the current multi-sponsor state. «Til kassen» dispatches `vio:checkout-open`\n * for the host to open <vio-checkout>; Apple Pay pays the whole cart\n * in-drawer; Vipps pays the sponsor's whole cart with Vipps Express\n * (`vipps-cart-payment=\"checkout\"` opens the checkout instead); the Klarna\n * button dispatches `vio:checkout-open` (express).\n *\n * For the visual demo without `Vio.init`, the CartManager works standalone\n * (state is purely local + localStorage).\n */\n\nimport { LitElement, css, html } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { ensureVippsButton } from '../../core/checkout/payments/vipps-button.js'\nimport { beginPaymentRedirect, type PaymentRedirectHandle } from '../payment-redirect.js'\nimport { resolveVippsCartPayment } from '../vipps-cart-payment.js'\nimport { Vio } from '../../core/client.js'\nimport { formatPrice } from '../../core/types.js'\nimport { buyerRefOf, type PaymentSuccessResult } from '../../core/analytics/analytics-manager.js'\nimport type { CartChangeDetail } from '../../core/cart/cart-manager.js'\nimport type { SponsorCartState } from '../../core/cart/types.js'\nimport { isMethodEnabled, isEmbeddedMethod } from '../../core/checkout/method-taxonomy.js'\nimport { DialogFocus } from '../dialog-focus.js'\nimport { BottomSheet } from '../bottom-sheet.js'\nimport { resolveSponsorIdentity, sponsorDetail } from '../sponsor-identity.js'\n\n/** Stripe wordmark, inlined so the published article needs no asset path. */\nconst STRIPE_LOGO_SRC =\n 'data:image/svg+xml;utf8,' +\n encodeURIComponent(\n '<svg width=\"360\" height=\"150\" viewBox=\"0 0 360 150\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M360 77.4001C360 51.8001 347.6 31.6001 323.9 31.6001C300.1 31.6001 285.7 51.8001 285.7 77.2001C285.7 107.3 302.7 122.5 327.1 122.5C339 122.5 348 119.8 354.8 116V96.0001C348 99.4001 340.2 101.5 330.3 101.5C320.6 101.5 312 98.1001 310.9 86.3001H359.8C359.8 85.0001 360 79.8001 360 77.4001ZM310.6 67.9001C310.6 56.6001 317.5 51.9001 323.8 51.9001C329.9 51.9001 336.4 56.6001 336.4 67.9001H310.6Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M247.1 31.6001C237.3 31.6001 231 36.2001 227.5 39.4001L226.2 33.2001H204.2V149.8L229.2 144.5L229.3 116.2C232.9 118.8 238.2 122.5 247 122.5C264.9 122.5 281.2 108.1 281.2 76.4001C281.1 47.4001 264.6 31.6001 247.1 31.6001ZM241.1 100.5C235.2 100.5 231.7 98.4001 229.3 95.8001L229.2 58.7001C231.8 55.8001 235.4 53.8001 241.1 53.8001C250.2 53.8001 256.5 64.0001 256.5 77.1001C256.5 90.5001 250.3 100.5 241.1 100.5Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M169.8 25.7L194.9 20.3V0L169.8 5.3V25.7Z\" fill=\"#533AFD\"/><path d=\"M194.9 33.3H169.8V120.8H194.9V33.3Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M142.9 40.7L141.3 33.3H119.7V120.8H144.7V61.5C150.6 53.8 160.6 55.2 163.7 56.3V33.3C160.5 32.1 148.8 29.9 142.9 40.7Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M92.8999 11.6001L68.4999 16.8001L68.3999 96.9001C68.3999 111.7 79.4999 122.6 94.2999 122.6C102.5 122.6 108.5 121.1 111.8 119.3V99.0001C108.6 100.3 92.7999 104.9 92.7999 90.1001V54.6001H111.8V33.3001H92.7999L92.8999 11.6001Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M25.3 58.7001C25.3 54.8001 28.5 53.3001 33.8 53.3001C41.4 53.3001 51 55.6001 58.6 59.7001V36.2001C50.3 32.9001 42.1 31.6001 33.8 31.6001C13.5 31.6001 0 42.2001 0 59.9001C0 87.5001 38 83.1001 38 95.0001C38 99.6001 34 101.1 28.4 101.1C20.1 101.1 9.5 97.7001 1.1 93.1001V116.9C10.4 120.9 19.8 122.6 28.4 122.6C49.2 122.6 63.5 112.3 63.5 94.4001C63.4 64.6001 25.3 69.9001 25.3 58.7001Z\" fill=\"#533AFD\"/></svg>',\n )\n\n/** A backend shipping rate's price (tax included when given) in `currency`, or null. */\nfunction ratePrice(rate: unknown, currency: string): number | null {\n const price = (rate as { price?: { amount?: number; amount_incl_taxes?: number | null; currency_code?: string } } | null)?.price\n if (!price) return null\n const amount = typeof price.amount_incl_taxes === 'number' ? price.amount_incl_taxes : price.amount\n if (typeof amount !== 'number' || !Number.isFinite(amount) || amount < 0) return null\n if (price.currency_code && currency && price.currency_code.toUpperCase() !== currency.toUpperCase()) return null\n return amount\n}\n\n/**\n * One cart's shipping from its lines (shipping is per supplier, and a\n * sponsor's cart is one supplier): the rate chosen on a line, else the\n * cheapest offered. null when no line says.\n */\nfunction cartShipping(\n items: ReadonlyArray<{ shipping?: unknown; availableShippings?: unknown[] }>,\n currency: string,\n): number | null {\n for (const item of items) {\n const chosen = ratePrice(item.shipping, currency)\n if (chosen !== null) return chosen\n }\n for (const item of items) {\n const offered = (item.availableShippings ?? [])\n .map((r) => ratePrice(r, currency))\n .filter((p): p is number => p !== null)\n if (offered.length > 0) return Math.min(...offered)\n }\n return null\n}\n\nexport class VioCart extends LitElement {\n /** Drawer visibility. Reflects to attribute for `:host([open])`. */\n @property({ type: Boolean, reflect: true }) open = false\n @property({ type: String }) heading = 'Handlekurv'\n @property({ type: String, attribute: 'empty-label' }) emptyLabel = 'Handlekurven er tom'\n @property({ type: String, attribute: 'subtotal-label' }) subtotalLabel = 'Sum'\n /**\n * What the Vipps button does: `express` (default) — Vipps Express for the\n * sponsor's whole cart, straight to the app — or `checkout` — our checkout\n * with Vipps preselected (`vio:checkout-open`, as in 0.31–0.34). Unset =\n * the theme's `vippsCartPayment` (`--vio-vipps-cart-payment`).\n */\n @property({ type: String, attribute: 'vipps-cart-payment' }) vippsCartPayment = ''\n\n @state() private carts: Map<number, SponsorCartState> = new Map()\n @state() private itemCount = 0\n /** True when Apple Pay is usable (Safari + device + Stripe configured). */\n @state() private applePayAvailable = false\n /** Payment method names enabled for the sponsor (backend-configured).\n * null = not loaded yet → all buttons render; [] = none enabled. */\n @state() private availableMethods: string[] | null = null\n /** Asking for the brand's methods: a neutral placeholder instead of every method's button (see methodEnabled). */\n @state() private methodsLoading = false\n @state() private vippsOfficial = false\n /** A Vipps payment is being started from here: one at a time. */\n private vippsStarting = false\n /** Whether the method lookup has been attempted — see boundOnCartChange. */\n private paymentMethodsAttempted = false\n /** Set after an Apple Pay express purchase — switches the drawer to the\n * confirmation screen (so the rest of the cart/checkout is not shown). */\n @state() private confirmedOrder: {\n items: Array<{\n brand?: string\n name: string\n quantity: number\n unitPrice: number\n currency: string\n }>\n total: number\n currency: string\n } | null = null\n\n /** Pre-resolved Apple Pay handle; `show()` fires the sheet synchronously. */\n private applePayHandle: { available: boolean; show: () => Promise<unknown> } | null = null\n /** Cart total Apple Pay was last prepared for (avoids redundant prep). */\n private preparedTotal = -1\n /** In-flight guard for loadAvailablePaymentMethods. */\n private loadingPaymentMethods = false\n /** Keyboard and focus while open: Escape closes, Tab stays inside, focus returns to the opener. */\n private readonly dialogFocus = new DialogFocus({\n host: this,\n container: () => this.renderRoot.querySelector<HTMLElement>('.drawer'),\n close: () => this.close(),\n })\n /** Phones: the page behind is locked, and the sheet closes by pulling the bar or the header down. */\n private readonly bottomSheet = new BottomSheet({\n host: this,\n sheet: () => this.renderRoot.querySelector<HTMLElement>('.drawer'),\n backdrop: () => this.renderRoot.querySelector<HTMLElement>('.backdrop'),\n dragZones: '.handle, .header',\n scroller: () => this.renderRoot.querySelector<HTMLElement>('.body'),\n close: () => this.close(),\n })\n\n private boundOnCartChange = (e: Event): void => {\n const detail = (e as CustomEvent<CartChangeDetail>).detail\n this.carts = detail.cartsBySponsor\n this.itemCount = detail.itemCount\n // Cart changes fire often, so ask ONCE. The condition is \"not attempted\",\n // not \"availableMethods is null\": null also means \"asked and failed\", and\n // retrying on every cart mutation turns one bad response into a refetch\n // per click for the rest of the session.\n if (!this.paymentMethodsAttempted) {\n this.paymentMethodsAttempted = true\n void this.loadAvailablePaymentMethods()\n }\n }\n\n static override styles = css`\n :host { display: contents; }\n\n .backdrop {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.4);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.25s ease;\n z-index: 998;\n }\n :host([open]) .backdrop { opacity: 1; pointer-events: auto; }\n\n .drawer {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n width: min(var(--vio-cart-width, 440px), 100%);\n background: var(--vio-color-surface, #fff);\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);\n display: flex;\n flex-direction: column;\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n color: var(--vio-color-text, #0a0a0a);\n z-index: 999;\n box-shadow: -8px 0 24px rgba(0, 0, 0, 0.06);\n }\n :host([open]) .drawer { transform: translateX(0); }\n /* Focus lands on the drawer itself only as a fallback — no ring for it. */\n .drawer:focus { outline: none; }\n\n .handle { display: none; }\n\n /* Mobile: bottom sheet (slide up, rounded top, drag handle). */\n @media (max-width: 600px) {\n .drawer {\n top: auto;\n right: 0;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 88vh;\n border-radius: var(--vio-radius-xl, 16px) var(--vio-radius-xl, 16px) 0 0;\n transform: translateY(100%);\n box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);\n overscroll-behavior: contain;\n }\n :host([open]) .drawer { transform: translateY(0); }\n /* Pulled down to close (bottom-sheet.ts): the browser must not take the gesture for a scroll. */\n .handle, .header { touch-action: none; }\n .handle {\n display: flex;\n justify-content: center;\n padding: 10px 0 4px;\n }\n .handle::before {\n content: '';\n width: 40px;\n height: 4px;\n background: var(--vio-color-border, #e5e5e5);\n border-radius: var(--vio-radius-sm, 2px);\n }\n }\n\n .header {\n padding: var(--vio-space-lg, 24px);\n border-bottom: 1px solid var(--vio-color-border, #e5e5e5);\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .heading {\n font-family: var(--vio-font-serif, Georgia, serif);\n font-size: 24px;\n font-weight: 400;\n margin: 0;\n }\n .close {\n background: none;\n border: none;\n cursor: pointer;\n font-size: 28px;\n line-height: 1;\n padding: 0;\n color: var(--vio-color-text, #0a0a0a);\n font-family: inherit;\n }\n .close:hover { color: var(--vio-color-text-secondary, #666); }\n\n .body {\n flex: 1;\n overflow-y: auto;\n }\n\n .sponsor-group {\n padding: var(--vio-space-md, 16px) var(--vio-space-lg, 24px);\n border-bottom: 1px solid var(--vio-color-border, #e5e5e5);\n }\n .sponsor-group:last-child { border-bottom: none; }\n .sponsor-label {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-tertiary, #999);\n font-weight: 500;\n margin: 0 0 var(--vio-space-md, 16px);\n }\n\n .item {\n display: grid;\n grid-template-columns: 80px 1fr;\n gap: var(--vio-space-md, 16px);\n padding: var(--vio-space-md, 16px) 0;\n border-bottom: 1px solid var(--vio-color-border, #e5e5e5);\n }\n .item:last-child { border-bottom: none; }\n .item-image {\n aspect-ratio: 1;\n background: var(--vio-color-surface-muted, #f2f2f2);\n overflow: hidden;\n }\n .item-image img { width: 100%; height: 100%; object-fit: cover; display: block; }\n .item-brand {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n font-weight: 500;\n }\n .item-name {\n font-size: 14px;\n margin: 4px 0;\n font-weight: 500;\n line-height: 1.3;\n }\n .item-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-top: var(--vio-space-sm, 8px);\n }\n .item-qty {\n display: flex;\n align-items: center;\n gap: 6px;\n color: var(--vio-color-text-secondary, #666);\n font-size: 12px;\n }\n .qty-btn {\n width: 24px;\n height: 24px;\n border: 1px solid var(--vio-color-border, #e5e5e5);\n background: #fff;\n border-radius: var(--vio-radius-sm, 2px);\n cursor: pointer;\n font-size: 12px;\n color: var(--vio-color-text, #0a0a0a);\n line-height: 1;\n padding: 0;\n font-family: inherit;\n }\n .qty-btn:hover { border-color: var(--vio-color-text, #0a0a0a); }\n .item-price { font-size: 14px; font-weight: 700; }\n\n .empty {\n padding: 80px var(--vio-space-lg, 24px);\n text-align: center;\n color: var(--vio-color-text-secondary, #666);\n font-size: 14px;\n }\n\n /* Always present: the express buttons below are shortcuts, not the only\n way out of the cart. Without this a channel offering only an embedded\n checkout (Kustom, Qliro, Walley) had no button at all. */\n .checkout-btn {\n width: 100%;\n padding: 14px;\n margin-bottom: var(--vio-space-sm, 8px);\n background: var(--vio-color-text, #0a0a0a);\n color: var(--vio-color-text-on-primary, #fff);\n border: none;\n border-radius: var(--vio-radius-md, 4px);\n font-family: var(--vio-font-sans, inherit);\n font-size: var(--vio-size-sm, 14px);\n font-weight: 600;\n cursor: pointer;\n }\n .checkout-btn:hover { opacity: 0.9; }\n .checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }\n /* Where the express buttons go while the brand's methods load. */\n .methods-pending {\n height: 48px;\n margin-bottom: 10px;\n border-radius: var(--vio-radius-lg, 8px);\n background: var(--vio-color-surface-muted, #f1f1f1);\n }\n .footer {\n padding: var(--vio-space-lg, 24px);\n border-top: 1px solid var(--vio-color-border, #e5e5e5);\n background: var(--vio-color-surface, #fff);\n }\n .subtotal-row {\n display: flex;\n justify-content: space-between;\n margin-bottom: var(--vio-space-md, 16px);\n font-size: 14px;\n }\n .subtotal-label { color: var(--vio-color-text-secondary, #666); }\n .shipping-row,\n .total-row {\n display: flex;\n justify-content: space-between;\n margin: calc(var(--vio-space-md, 16px) * -0.5) 0 var(--vio-space-md, 16px);\n font-size: 14px;\n }\n .total-row { font-weight: 700; font-size: 16px; margin-top: 0; }\n .subtotal-value { font-weight: 700; font-size: 16px; }\n\n /* Apple Pay express — pay the whole cart directly. */\n .applepay-btn {\n width: 100%;\n padding: 15px;\n margin-bottom: 10px;\n background: #000;\n color: #fff;\n border: none;\n border-radius: var(--vio-radius-lg, 8px);\n font-size: 19px;\n font-weight: 500;\n line-height: 1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n transition: opacity 0.15s;\n }\n .applepay-btn:hover { opacity: 0.86; }\n .applepay-btn .ap-logo { width: 20px; height: 20px; }\n /* Klarna express — pink brand button, same express row as Apple Pay. */\n .klarna-btn {\n width: 100%;\n padding: 15px;\n margin-bottom: 10px;\n background: #ffb3c7;\n color: #0a0a0a;\n border: none;\n border-radius: var(--vio-radius-lg, 8px);\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n transition: background 0.15s;\n }\n .klarna-btn:hover { background: #ffa1ba; }\n .klarna-btn .klarna-logo { height: 15px; width: auto; display: inline-block; }\n /* Vipps — brand orange button, same express row. */\n .vipps-btn {\n width: 100%;\n padding: 15px;\n margin-bottom: 10px;\n background: #ff5b24;\n color: #fff;\n border: none;\n border-radius: var(--vio-radius-lg, 8px);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n transition: background 0.15s;\n }\n .vipps-btn:hover { background: #ec4f1c; }\n .vipps-btn-official { display: block; width: 100%; margin-bottom: 10px; cursor: pointer; }\n .vipps-btn .vipps-logo {\n font-size: 20px;\n font-weight: 800;\n letter-spacing: -0.02em;\n line-height: 1;\n }\n /* Stripe — brand blurple button, same express row. */\n .stripe-btn {\n width: 100%;\n padding: 15px;\n margin-bottom: 10px;\n background: #635bff;\n color: #fff;\n border: none;\n border-radius: var(--vio-radius-lg, 8px);\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n transition: background 0.15s;\n }\n .stripe-btn:hover { background: #5248ff; }\n .stripe-btn .stripe-logo { height: 20px; width: auto; display: inline-block; filter: brightness(0) invert(1); }\n\n /* In-drawer confirmation after Apple Pay (nothing else is shown). */\n .confirm {\n padding: 56px var(--vio-space-lg, 24px) 40px;\n text-align: center;\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n .confirm-check {\n width: 64px;\n height: 64px;\n border-radius: 50%;\n background: #0a8a3f;\n color: #fff;\n font-size: 34px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 20px;\n }\n .confirm h3 {\n font-family: var(--vio-font-serif, Georgia, serif);\n font-size: 24px;\n font-weight: 400;\n margin: 0 0 8px;\n }\n .confirm p {\n color: var(--vio-color-text-secondary, #666);\n font-size: 14px;\n margin: 0 0 24px;\n }\n .confirm-summary {\n width: 100%;\n border-top: 1px solid var(--vio-color-border, #e5e5e5);\n padding-top: 16px;\n margin-bottom: 28px;\n text-align: left;\n }\n .order-row {\n display: flex;\n justify-content: space-between;\n gap: 12px;\n font-size: 14px;\n margin-bottom: 10px;\n color: var(--vio-color-text, #0a0a0a);\n }\n .order-row.total {\n border-top: 1px solid var(--vio-color-border, #e5e5e5);\n padding-top: 12px;\n margin-top: 4px;\n font-weight: 700;\n }\n .confirm-close {\n width: 100%;\n padding: 16px;\n background: var(--vio-color-text, #0a0a0a);\n color: #fff;\n border: none;\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n cursor: pointer;\n font-weight: 600;\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n }\n .confirm-close:hover { background: #222; }\n `\n\n override connectedCallback(): void {\n super.connectedCallback()\n void this.loadVippsButton()\n // Seed initial state from manager.\n this.carts = Vio.cart.getAllCarts()\n this.itemCount = Vio.cart.itemCount\n Vio.cart.addEventListener('change', this.boundOnCartChange)\n void this.loadAvailablePaymentMethods()\n }\n\n override disconnectedCallback(): void {\n Vio.cart.removeEventListener('change', this.boundOnCartChange)\n this.bottomSheet.disconnect()\n super.disconnectedCallback()\n }\n\n close(): void { this.open = false }\n show(): void {\n // `vio:open-cart` es un COMANDO (\"abrí el carrito\") y varios hosts lo\n // escuchan para llamar a este show() — Vev entre ellos. Si show()\n // reemitiera el mismo evento siempre, se arma un lazo: comando → show →\n // comando → … Cada vuelta disparaba un `view_cart` (24.172 en 12\n // sesiones el 2026-09-07 en staging, ~2.000 por sesión).\n //\n // Notificar solo en la TRANSICIÓN cerrado→abierto rompe el lazo: la\n // segunda vuelta encuentra `open` en true y no reemite.\n const wasClosed = !this.open\n this.open = true\n if (wasClosed) {\n // Hook de analytics/host — `view_cart` en cualquier host, no solo Vev.\n this.dispatchEvent(\n new CustomEvent('vio:open-cart', { bubbles: true, composed: true }),\n )\n }\n void this.loadAvailablePaymentMethods()\n }\n\n /** Which payment buttons to render — backend-configured per sponsor.\n * Falls back to showing everything if the query fails or none is set. */\n private async loadAvailablePaymentMethods(): Promise<void> {\n if (this.loadingPaymentMethods) return\n this.loadingPaymentMethods = true\n const firstSponsorId =\n [...this.carts.keys()][0] ??\n (globalThis as { __VIO_SPONSOR_ID__?: number }).__VIO_SPONSOR_ID__\n if (firstSponsorId === undefined) {\n this.loadingPaymentMethods = false\n return\n }\n this.methodsLoading = true\n try {\n const methods = (await Vio.checkout.getAvailablePaymentMethods(firstSponsorId)) as\n | Array<{ name: string }>\n | unknown\n if (Array.isArray(methods)) {\n this.availableMethods = methods.map((m) => m.name)\n } else {\n this.availableMethods = null\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCart] Failed to load payment methods:', err)\n }\n // Unknown (not \"none\") — render everything rather than nothing.\n this.availableMethods = null\n } finally {\n this.loadingPaymentMethods = false\n this.methodsLoading = false\n }\n }\n\n /** The methods are on their way and none is known yet. */\n private get methodsPending(): boolean {\n return this.methodsLoading && this.availableMethods === null\n }\n\n /**\n * Backend names arrive as e.g. \"Apple Pay\" — compare letters only. While\n * the list loads, no method's button is drawn: «unknown = all» painted\n * Stripe and Klarna for a Vipps-only brand until it came.\n */\n private methodEnabled(...names: string[]): boolean {\n if (this.methodsPending) return false\n return isMethodEnabled(this.availableMethods, ...names)\n }\n\n override updated(changed: Map<string, unknown>): void {\n if (changed.has('open')) {\n this.dialogFocus.update(this.open)\n this.bottomSheet.update(this.open)\n }\n // Fresh open → drop any previous confirmation, force an Apple Pay re-prep.\n if (changed.has('open') && this.open) {\n this.confirmedOrder = null\n this.preparedTotal = -1\n // The lines on screen are the server's: a line another tab added, a\n // cart another tab paid. Asked on every opening — the `change` it\n // emits redraws the lines (CartManager.refreshFromServer).\n for (const cart of this.carts.values()) {\n if (cart.cartId) void Vio.cart.refreshFromServer(cart.sponsorId)\n }\n }\n // (Re)prepare Apple Pay whenever the open cart's total changes.\n if (this.open && this.itemCount > 0) {\n const total = this.totalAcrossSponsors\n if (total !== this.preparedTotal) {\n this.preparedTotal = total\n void this.refreshApplePay(total)\n }\n }\n }\n\n /** Pre-resolve the Apple Pay sheet for the current cart total. */\n private async refreshApplePay(total: number): Promise<void> {\n if (total <= 0) {\n this.applePayHandle = null\n this.applePayAvailable = false\n return\n }\n try {\n const handle = await Vio.checkout.prepareApplePayExpress(total, this.primaryCurrency)\n // A newer prep may have superseded this one while awaiting.\n if (this.preparedTotal !== total) return\n this.applePayHandle = handle\n this.applePayAvailable = handle.available\n } catch {\n this.applePayHandle = null\n this.applePayAvailable = false\n }\n }\n\n /** Apple Pay express — pay the whole cart, then show the confirmation. */\n private onApplePay(): void {\n const handle = this.applePayHandle\n if (!handle || !handle.available || !this.payable) return\n // Snapshot items + total BEFORE clearing the cart (confirmation needs them).\n const snapshot = this.buildConfirmation()\n // Who the order is with, while the cart still names it — only when one\n // sponsor's cart is paid (the event carries no sponsorId otherwise).\n const sponsorIds = [...this.carts.keys()]\n const sponsor = sponsorIds.length === 1 ? sponsorDetail(sponsorIds[0]) : {}\n // Fire the sheet synchronously inside the tap (Apple gesture rule); handle\n // the result asynchronously.\n void handle.show().then((result) => {\n if (!result) return // user cancelled / failed — keep the cart as-is\n this.confirmedOrder = snapshot\n for (const sponsorId of [...this.carts.keys()]) {\n Vio.cart.clearSponsorCart(sponsorId)\n }\n // The buyer reference came with the backend's confirmation\n // (`result.confirmation.buyerRef`); hoisted so the host reads one key.\n const buyerRef = buyerRefOf({ result: result as unknown as PaymentSuccessResult })\n this.dispatchEvent(\n new CustomEvent('vio:payment-success', {\n bubbles: true,\n composed: true,\n detail: { method: 'apple-pay', result, ...(buyerRef ? { buyerRef } : {}), ...sponsor },\n }),\n )\n })\n }\n\n private buildConfirmation(): NonNullable<VioCart['confirmedOrder']> {\n const items: NonNullable<VioCart['confirmedOrder']>['items'] = []\n for (const cart of this.carts.values()) {\n for (const it of cart.items) {\n items.push({\n brand: it.brand,\n name: it.name,\n quantity: it.quantity,\n unitPrice: it.unitPrice,\n currency: it.currency,\n })\n }\n }\n return { items, total: this.totalAcrossSponsors, currency: this.primaryCurrency }\n }\n\n private closeConfirmation(): void {\n this.confirmedOrder = null\n this.close()\n }\n\n /** Klarna express — opens the side-drawer Klarna checkout for the whole cart,\n * skipping the address form (leveringsadresse) and method picker\n * (betalingsmetode). The host's checkout-open handler closes this cart and\n * opens <vio-checkout> in express mode with Klarna preselected. */\n private onKlarnaExpress(): void {\n if (!this.payable) return\n const firstSponsorId = [...this.carts.keys()][0]\n if (firstSponsorId === undefined) return\n this.dispatchEvent(\n new CustomEvent('vio:checkout-open', {\n bubbles: true,\n composed: true,\n detail: { sponsorId: firstSponsorId, paymentMethod: 'klarna', express: true, ...sponsorDetail(firstSponsorId) },\n }),\n )\n }\n\n /**\n * Open the checkout without preselecting a method.\n *\n * The footer used to be express-only — Apple Pay, Stripe, Klarna, Vipps —\n * so a channel offering just an embedded checkout (Kustom, Qliro, Walley)\n * had NO button at all and the cart was a dead end. Even with an express\n * method present the others were unreachable from here.\n */\n private onCheckout(): void {\n if (!this.payable) return\n const firstSponsorId = [...this.carts.keys()][0]\n if (firstSponsorId === undefined) return\n this.dispatchEvent(\n new CustomEvent('vio:checkout-open', {\n bubbles: true,\n composed: true,\n detail: { sponsorId: firstSponsorId, express: false, ...sponsorDetail(firstSponsorId) },\n }),\n )\n }\n\n /**\n * Vipps from the cart (2026-10-29: «el botón negro va con el nuestro y el\n * botón de Vipps paga el carrito entero»): Vipps Express for the sponsor's\n * WHOLE cart — the same Express as the detail's «Kjøp nå med Vipps»: the\n * hand-over overlay, `vio:payment-redirect-*` with source `'cart'`, the\n * return and its confirmation. «Til kassen» is the way into our checkout.\n * When the brand has Express off, or this cart cannot have it (several\n * suppliers, no rate), the checkout opens with Vipps preselected.\n *\n * `vipps-cart-payment=\"checkout\"` keeps the 0.31–0.34 behaviour: the\n * checkout opens with Vipps preselected, the standard payment.\n */\n private onVipps(): void {\n if (!this.payable) return\n if (resolveVippsCartPayment(this, this.vippsCartPayment) === 'checkout') {\n const firstSponsorId = [...this.carts.keys()][0]\n if (firstSponsorId === undefined) return\n this.openCheckoutWithVipps(firstSponsorId)\n return\n }\n if (this.vippsStarting) return\n const sponsorId = this.vippsSponsorId()\n if (sponsorId === undefined) return\n this.vippsStarting = true\n const redirect = beginPaymentRedirect({ method: 'vipps', sponsorId, source: 'cart' })\n void this.startVippsExpressOrCheckout(sponsorId, redirect).finally(() => {\n this.vippsStarting = false\n })\n }\n\n /**\n * The one sponsor whose cart the Vipps button pays: the first with\n * something to pay for. Express is built on THAT sponsor's backend cart\n * only — another sponsor's lines are never in it.\n */\n private vippsSponsorId(): number | undefined {\n for (const cart of this.carts.values()) {\n const total = cart.items.reduce((sum, i) => sum + i.unitPrice * i.quantity, 0)\n if (cart.items.length > 0 && total > 0) return cart.sponsorId\n }\n return undefined\n }\n\n private async startVippsExpressOrCheckout(sponsorId: number, redirect: PaymentRedirectHandle): Promise<void> {\n let fallback = true\n try {\n // A +/− a moment ago may still be syncing: Vipps must get the cart it produced.\n await Vio.cart.waitForCartMutations(sponsorId)\n // The seller may have switched Express off on its Vipps row: then the\n // button is an ordinary way into the checkout, with Vipps preselected.\n if (!(await Vio.checkout.getVippsExpressEnabled(sponsorId))) {\n redirect.abort('express-off')\n } else {\n const res = await Vio.checkout.startVippsExpress(sponsorId)\n // A redirect is on its way; anything else opens the checkout.\n fallback = !res?.payment_url\n if (fallback) redirect.abort('not-started')\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCart] Vipps Express not started:', err)\n }\n redirect.fail(err instanceof Error ? err.message : String(err))\n }\n if (!fallback) return\n this.openCheckoutWithVipps(sponsorId)\n }\n\n /** Our checkout with Vipps preselected: the host opens it on `vio:checkout-open`. */\n private openCheckoutWithVipps(sponsorId: number): void {\n this.dispatchEvent(\n new CustomEvent('vio:checkout-open', {\n bubbles: true,\n composed: true,\n detail: { sponsorId, paymentMethod: 'vipps', express: false, ...sponsorDetail(sponsorId) },\n }),\n )\n }\n\n /** Vipps' own button when its script answers; our orange one otherwise. */\n private async loadVippsButton(): Promise<void> {\n this.vippsOfficial = await ensureVippsButton()\n }\n\n /** Stripe — opens the checkout with Stripe preselected. */\n private onStripe(): void {\n if (!this.payable) return\n const firstSponsorId = [...this.carts.keys()][0]\n if (firstSponsorId === undefined) return\n this.dispatchEvent(\n new CustomEvent('vio:checkout-open', {\n bubbles: true,\n composed: true,\n detail: { sponsorId: firstSponsorId, paymentMethod: 'stripe', express: false, ...sponsorDetail(firstSponsorId) },\n }),\n )\n }\n\n /** The name over a sponsor's lines: the brand's display name by the one rule, else what the cart kept. */\n private sponsorLabel(cart: { sponsorId: number; sponsorName?: string }): string {\n return resolveSponsorIdentity(cart.sponsorId)?.name || cart.sponsorName || ''\n }\n\n /** Something to pay for: lines, and a total above 0. No button opens a checkout or a payment otherwise. */\n private get payable(): boolean {\n return this.itemCount > 0 && this.totalAcrossSponsors > 0\n }\n\n private get totalAcrossSponsors(): number {\n let sum = 0\n for (const cart of this.carts.values()) {\n for (const item of cart.items) sum += item.unitPrice * item.quantity\n }\n return sum\n }\n\n /**\n * Shipping across the carts, from what the server cart says of its lines:\n * the rate chosen for them, else the cheapest one offered (the one the\n * checkout preselects). null when some cart has no known rate — the footer\n * says it is worked out in the checkout then.\n */\n private get shippingAcrossSponsors(): number | null {\n let sum = 0\n let any = false\n for (const cart of this.carts.values()) {\n if (cart.items.length === 0) continue\n const rate = cartShipping(cart.items, cart.currency)\n if (rate === null) return null\n sum += rate\n any = true\n }\n return any ? sum : null\n }\n\n private get primaryCurrency(): string {\n for (const cart of this.carts.values()) return cart.currency\n return 'NOK'\n }\n\n // A delta on the manager's live quantity, not a target computed from this\n // render's snapshot: two clicks before Lit re-renders used to ask for the\n // same quantity twice (Alan, 2026-10-15).\n private onIncrement(item: { id: string; sponsorId: number }): void {\n Vio.cart.adjustQuantity(item.id, item.sponsorId, +1)\n }\n\n private onDecrement(item: { id: string; sponsorId: number }): void {\n Vio.cart.adjustQuantity(item.id, item.sponsorId, -1)\n }\n\n private onRemove(item: { id: string; sponsorId: number }): void {\n Vio.cart.removeItem(item.id, item.sponsorId)\n }\n\n override render() {\n const isEmpty = this.itemCount === 0\n const sponsorCarts = [...this.carts.values()].filter((c) => c.items.length > 0)\n\n return html`\n <div class=\"backdrop\" @click=${this.close}></div>\n <aside class=\"drawer\" role=\"dialog\" aria-modal=\"true\" aria-label=${this.heading} tabindex=\"-1\">\n <div class=\"handle\" @click=${this.close} aria-hidden=\"true\"></div>\n <div class=\"header\">\n <h2 class=\"heading\">${this.confirmedOrder ? 'Takk!' : this.heading}</h2>\n <button class=\"close\" @click=${this.close} aria-label=\"Lukk\">×</button>\n </div>\n\n ${this.confirmedOrder\n ? this.renderConfirmation()\n : isEmpty\n ? html`<div class=\"empty\">${this.emptyLabel}</div>`\n : html`\n <div class=\"body\">\n ${sponsorCarts.map(\n (cart) => html`\n <div class=\"sponsor-group\">\n ${this.sponsorLabel(cart)\n ? html`<div class=\"sponsor-label\">${this.sponsorLabel(cart)}</div>`\n : ''}\n ${cart.items.map(\n (item) => html`\n <div class=\"item\">\n <div class=\"item-image\">\n ${item.imageUrl\n ? html`<img src=${item.imageUrl} alt=${item.name} />`\n : ''}\n </div>\n <div>\n <div class=\"item-brand\">${item.brand}</div>\n <div class=\"item-name\">${item.name}</div>\n <div class=\"item-row\">\n <span class=\"item-qty\">\n <button\n class=\"qty-btn\"\n @click=${() => this.onDecrement(item)}\n aria-label=\"Reduser\"\n >\n −\n </button>\n ${item.quantity}\n <button\n class=\"qty-btn\"\n @click=${() => this.onIncrement(item)}\n aria-label=\"Øk\"\n >\n +\n </button>\n <button\n class=\"qty-btn\"\n @click=${() => this.onRemove(item)}\n aria-label=\"Fjern\"\n style=\"margin-left: 8px;\"\n >\n ×\n </button>\n </span>\n <span class=\"item-price\">\n ${formatPrice(\n item.unitPrice * item.quantity,\n item.currency,\n )}\n </span>\n </div>\n </div>\n </div>\n `,\n )}\n </div>\n `,\n )}\n </div>\n <div class=\"footer\">\n <div class=\"subtotal-row\">\n <span class=\"subtotal-label\">${this.subtotalLabel}</span>\n <span class=\"subtotal-value\">\n ${formatPrice(this.totalAcrossSponsors, this.primaryCurrency)}\n </span>\n </div>\n ${this.renderShippingRows()}\n <button\n class=\"checkout-btn\"\n @click=${this.onCheckout}\n ?disabled=${!this.payable}\n aria-label=\"Til kassen\"\n >\n Til kassen\n </button>\n ${this.methodsPending\n ? html`<div class=\"methods-pending\" role=\"status\" aria-label=\"Laster betalingsmåter\"></div>`\n : ''}\n ${this.methodEnabled('apple-pay') && this.applePayAvailable\n ? html`\n <button\n class=\"applepay-btn\"\n @click=${this.onApplePay}\n aria-label=\"Betal med Apple Pay\"\n >\n <svg class=\"ap-logo\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z\"/></svg>\n Apple Pay\n </button>\n `\n : ''}\n ${this.methodEnabled('stripe')\n ? html`\n <button\n class=\"stripe-btn\"\n @click=${this.onStripe}\n aria-label=\"Betal med Stripe\"\n >\n <img class=\"stripe-logo\" src=${STRIPE_LOGO_SRC} alt=\"Stripe\" />\n </button>\n `\n : ''}\n ${this.methodEnabled('klarna')\n ? html`\n <button\n class=\"klarna-btn\"\n @click=${this.onKlarnaExpress}\n aria-label=\"Betal med Klarna\"\n >\n Kjøp med\n <img\n class=\"klarna-logo\"\n src=\"https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg\"\n alt=\"Klarna\"\n />\n </button>\n `\n : ''}\n ${this.methodEnabled('vipps')\n ? this.vippsOfficial\n ? html`\n <vipps-mobilepay-button\n class=\"vipps-btn-official\"\n brand=\"vipps\"\n language=\"no\"\n verb=\"pay\"\n variant=\"primary\"\n rounded=\"true\"\n stretched=\"true\"\n role=\"button\"\n aria-label=\"Betal med Vipps\"\n @click=${this.onVipps}\n ></vipps-mobilepay-button>\n `\n : html`\n <button\n class=\"vipps-btn\"\n @click=${this.onVipps}\n aria-label=\"Betal med Vipps\"\n >\n <span class=\"vipps-logo\">vipps</span>\n </button>\n `\n : ''}\n </div>\n `}\n </aside>\n `\n }\n\n /** «Frakt» (the chosen or cheapest rate) and «Totalt» with it; «Beregnes i kassen» when unknown. */\n private renderShippingRows() {\n const shipping = this.shippingAcrossSponsors\n return html`\n <div class=\"shipping-row\" part=\"cart-shipping\">\n <span class=\"subtotal-label\">Frakt</span>\n <span>${shipping === null\n ? 'Beregnes i kassen'\n : shipping <= 0\n ? 'Gratis'\n : formatPrice(shipping, this.primaryCurrency)}</span>\n </div>\n ${shipping !== null\n ? html`<div class=\"total-row\" part=\"cart-total\">\n <span>Totalt</span>\n <span>${formatPrice(this.totalAcrossSponsors + shipping, this.primaryCurrency)}</span>\n </div>`\n : ''}\n `\n }\n\n private renderConfirmation() {\n const o = this.confirmedOrder\n if (!o) return html``\n return html`\n <div class=\"confirm\">\n <div class=\"confirm-check\" aria-hidden=\"true\">✓</div>\n <h3>Takk for handelen!</h3>\n <p>Betaling med Apple Pay er bekreftet.</p>\n <div class=\"confirm-summary\">\n ${o.items.map(\n (it) => html`\n <div class=\"order-row\">\n <span>${it.brand ? `${it.brand} ` : ''}${it.name} ×${it.quantity}</span>\n <span>${formatPrice(it.unitPrice * it.quantity, it.currency)}</span>\n </div>\n `,\n )}\n <div class=\"order-row total\">\n <span>Totalt</span>\n <span>${formatPrice(o.total, o.currency)}</span>\n </div>\n </div>\n <button class=\"confirm-close\" @click=${this.closeConfirmation}>Lukk</button>\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vio-cart': VioCart\n }\n}\n","/**\n * What the shopper reads when a payment cannot be STARTED.\n *\n * Until 2026-10-09 the gateway's own text went straight to the screen:\n * \"Kunne ikke starte Vipps-betaling: Payment Vipps not initialize: [vipps]\n * amount must be a positive integer in minor units, got 0\" (a cart emptied\n * from another tab), or \"Kunne ikke laste betaling: Payment Stripe not intent\n * execute: : Cannot read properties of undefined (reading 'id')\". The known\n * causes map to a short Norwegian sentence that says what to do; anything\n * else gets a generic one. The raw text is for `console.warn`, never the\n * panel.\n *\n * Return-flow messages (\"Betalingen ble avbrutt eller feilet…\", the\n * unverified-return text) are not this: they are already written for the\n * shopper and stay where they are.\n */\n\n/** The cart has no lines: the gateway refuses a zero amount. */\nexport const EMPTY_CART_MESSAGE = 'Handlekurven er tom. Legg til et produkt og prøv igjen.'\n/** A newer checkout replaced this one — the cart changed in another tab. */\nexport const CART_CHANGED_MESSAGE =\n 'Handlekurven ble endret i en annen fane. Last siden på nytt og prøv igjen.'\n/** This cart was already paid for. */\nexport const CART_PAID_MESSAGE = 'Denne handlekurven er allerede betalt. Start en ny handlekurv.'\n/** Everything else. */\nexport const PAYMENT_START_FAILED_MESSAGE =\n 'Betalingen kunne ikke startes. Prøv igjen, eller velg en annen betalingsmåte.'\n\n/** The one backend message that is already written for the shopper. */\nconst SHIPS_APART = 'kan ikke sendes sammen'\n\n/**\n * The sentence to show for a payment that could not start.\n *\n * `raw` is the gateway's or the backend's text, as thrown. `method` is the\n * Vio payment method the start was for (`stripe`, `vipps`, …): the texts are\n * the same for every method today, it is here so a call site says which one\n * failed and a method-specific text can be added without touching them.\n */\nexport function friendlyPaymentError(raw: string, method: string): string {\n void method\n const text = String(raw ?? '')\n const lower = text.toLowerCase()\n if (lower.includes('got 0') || lower.includes('amount must be a positive')) {\n return EMPTY_CART_MESSAGE\n }\n if (lower.includes('replaced by a newer') || text.includes('CHECKOUT_SUPERSEDED')) {\n return CART_CHANGED_MESSAGE\n }\n if (lower.includes('already been paid') || text.includes('CART_ALREADY_PAID')) {\n return CART_PAID_MESSAGE\n }\n if (text.includes(SHIPS_APART)) return norwegianSentence(text)\n return PAYMENT_START_FAILED_MESSAGE\n}\n\n/**\n * The Norwegian sentence inside a gateway message, without the technical\n * prefix in front of it (\"Payment Vipps not initialize: Produktene …\").\n */\nfunction norwegianSentence(text: string): string {\n const at = text.indexOf(SHIPS_APART)\n const prefixEnd = text.lastIndexOf(': ', at)\n return (prefixEnd === -1 ? text : text.slice(prefixEnd + 2)).trim()\n}\n\n/** A thrown value as text — what the call sites used to build the message from. */\nexport function errorText(err: unknown): string {\n return err instanceof Error ? err.message : String(err)\n}\n","/**\n * <vio-checkout> — full-screen native checkout overlay, reactively bound\n * to `Vio.checkout` (CheckoutManager).\n *\n * Subscribes to checkout state on connect, renders address form + payment\n * method buttons + order summary. Apple Pay is auto-detected via Stripe\n * Payment Request — button is hidden when unavailable (e.g. Chrome on\n * non-Apple device, or no Stripe key configured).\n */\n\nimport { LitElement, css, html, nothing } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { ensureVippsButton } from '../../core/checkout/payments/vipps-button.js'\nimport { beginPaymentRedirect, returnCancelled } from '../payment-redirect.js'\nimport { Vio } from '../../core/client.js'\nimport { formatPrice, getGlobalCountryCode, getGlobalCurrency } from '../../core/types.js'\nimport {\n buyerRefOf,\n type PaymentSuccessDetail,\n type PaymentSuccessResult,\n} from '../../core/analytics/analytics-manager.js'\nimport { gatewayHasBuyerRef } from '../../core/api/cart-queries.js'\nimport type { CartLineItem } from '../../core/cart/types.js'\nimport type {\n CheckoutChangeDetail,\n KlarnaPaymentsHandle,\n KlarnaShippingOption,\n} from '../../core/checkout/checkout-manager.js'\nimport type {\n CheckoutAddress,\n CheckoutState,\n PaymentMethod,\n} from '../../core/checkout/types.js'\nimport {\n isMethodEnabled,\n isEmbeddedMethod,\n isFormFirstWidgetMethod,\n collectsOwnAddress,\n} from '../../core/checkout/method-taxonomy.js'\nimport { KUSTOM_RETURN_QUERY_KEYS, kustomReturnOutcome } from '../../core/checkout/payments/kustom.js'\nimport {\n nexiReturnPaymentId,\n readNexiPending,\n type NexiShippingUpdate,\n} from '../../core/checkout/payments/nexi.js'\nimport {\n ADYEN_RETURN_METHOD,\n ADYEN_RETURN_QUERY_KEYS,\n AdyenOriginError,\n adyenReturnOutcome,\n adyenReturnParams,\n type AdyenPayment,\n type AdyenSession,\n} from '../../core/checkout/payments/adyen.js'\nimport type { StripeElementHandle } from '../../core/checkout/payments/stripe-embedded.js'\nimport { isValidPhone } from '../../core/checkout/phone.js'\nimport { storageGet } from '../../core/safe-storage.js'\nimport { DialogFocus } from '../dialog-focus.js'\nimport { BottomSheet } from '../bottom-sheet.js'\nimport { errorText, friendlyPaymentError, CART_PAID_MESSAGE } from '../checkout-errors.js'\nimport { checkoutSponsorOf, rememberedCheckoutSponsor, type CheckoutSponsor } from '../../core/sponsor-identity.js'\nimport {\n renderSponsorMark,\n resolveSponsorIdentity,\n sponsorDetail,\n usableLogo,\n whenBootstrapped,\n} from '../sponsor-identity.js'\n\n/** Stripe wordmark, inlined so the published article needs no asset path.\n * (Duplicated in vio-cart.ts — tiny constant, avoids a shared-module dance.) */\nconst STRIPE_LOGO_SRC =\n 'data:image/svg+xml;utf8,' +\n encodeURIComponent(\n '<svg width=\"360\" height=\"150\" viewBox=\"0 0 360 150\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M360 77.4001C360 51.8001 347.6 31.6001 323.9 31.6001C300.1 31.6001 285.7 51.8001 285.7 77.2001C285.7 107.3 302.7 122.5 327.1 122.5C339 122.5 348 119.8 354.8 116V96.0001C348 99.4001 340.2 101.5 330.3 101.5C320.6 101.5 312 98.1001 310.9 86.3001H359.8C359.8 85.0001 360 79.8001 360 77.4001ZM310.6 67.9001C310.6 56.6001 317.5 51.9001 323.8 51.9001C329.9 51.9001 336.4 56.6001 336.4 67.9001H310.6Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M247.1 31.6001C237.3 31.6001 231 36.2001 227.5 39.4001L226.2 33.2001H204.2V149.8L229.2 144.5L229.3 116.2C232.9 118.8 238.2 122.5 247 122.5C264.9 122.5 281.2 108.1 281.2 76.4001C281.1 47.4001 264.6 31.6001 247.1 31.6001ZM241.1 100.5C235.2 100.5 231.7 98.4001 229.3 95.8001L229.2 58.7001C231.8 55.8001 235.4 53.8001 241.1 53.8001C250.2 53.8001 256.5 64.0001 256.5 77.1001C256.5 90.5001 250.3 100.5 241.1 100.5Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M169.8 25.7L194.9 20.3V0L169.8 5.3V25.7Z\" fill=\"#533AFD\"/><path d=\"M194.9 33.3H169.8V120.8H194.9V33.3Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M142.9 40.7L141.3 33.3H119.7V120.8H144.7V61.5C150.6 53.8 160.6 55.2 163.7 56.3V33.3C160.5 32.1 148.8 29.9 142.9 40.7Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M92.8999 11.6001L68.4999 16.8001L68.3999 96.9001C68.3999 111.7 79.4999 122.6 94.2999 122.6C102.5 122.6 108.5 121.1 111.8 119.3V99.0001C108.6 100.3 92.7999 104.9 92.7999 90.1001V54.6001H111.8V33.3001H92.7999L92.8999 11.6001Z\" fill=\"#533AFD\"/><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M25.3 58.7001C25.3 54.8001 28.5 53.3001 33.8 53.3001C41.4 53.3001 51 55.6001 58.6 59.7001V36.2001C50.3 32.9001 42.1 31.6001 33.8 31.6001C13.5 31.6001 0 42.2001 0 59.9001C0 87.5001 38 83.1001 38 95.0001C38 99.6001 34 101.1 28.4 101.1C20.1 101.1 9.5 97.7001 1.1 93.1001V116.9C10.4 120.9 19.8 122.6 28.4 122.6C49.2 122.6 63.5 112.3 63.5 94.4001C63.4 64.6001 25.3 69.9001 25.3 58.7001Z\" fill=\"#533AFD\"/></svg>',\n )\n\n/** Said when a pay button is pressed on a cart with nothing to pay for. */\nconst EMPTY_CART_MESSAGE = 'Handlekurven er tom.'\n/** Said when the chosen delivery could not be saved on the cart before a hosted payment. */\nconst SHIPPING_NOT_SAVED_MESSAGE = 'Kunne ikke lagre fraktmetoden. Prøv igjen.'\n\nexport class VioCheckout extends LitElement {\n @property({ type: Boolean, reflect: true }) open = false\n @property({ type: String }) heading = 'Kasse'\n @property({ type: String, attribute: 'shipping-label' })\n shippingLabel = 'Beregnes ved kasse'\n /** Express mode — render only the Klarna widget (no address form / method grid). */\n @property({ type: Boolean, reflect: true }) express = false\n\n @state() private checkoutState: CheckoutState | null = null\n @state() private items: CartLineItem[] = []\n @state() private applePayAvailable = false\n @state() private applePayInProgress = false\n @state() private klarnaAvailable = false\n @state() private orderConfirmed = false\n /**\n * The embedded provider whose OWN receipt is on screen after a completed\n * purchase (Qliro, Walley). Set instead of `orderConfirmed`: when the\n * provider renders a receipt, that is the one the shopper sees, not ours\n * (Angelo, 2026-09-15). See showProviderReceipt.\n */\n @state() private providerReceipt: 'qliro' | 'walley' | 'kustom' | null = null\n @state() private confirmedMethod: PaymentMethod | null = null\n @state() private paymentError: string | null = null\n /** Neutral (non-error) status line: \"verifying payment…\" / \"still processing\". */\n @state() private paymentNotice: string | null = null\n /**\n * Back from a payment page and asking whether it was paid. While set, the\n * drawer shows only this — never the checkout behind it: a form you can\n * type into, and a \"Betal\" you can press, for a purchase that may already\n * be paid (Angelo, 2026-10-08; Vipps can take two minutes to answer).\n */\n @state() private verifyingReturn: string | null = null\n /** The checkout whose confirmation is on screen — see fillOrderNumber. */\n private confirmedCheckoutId: string | null = null\n /**\n * Whose order is being confirmed (or verified, back from a payment page):\n * the CHECKOUT's sponsor — from the return URL (`vio_sponsor`,\n * `checkout_id`) or the state it was paid in — and how it was named before\n * the cart was cleared. The header and the confirmation name it; never the\n * page's attribution. See checkoutSponsorIdentity.\n */\n @state() private orderSponsor: { sponsorId: number; checkoutId?: string; snapshot?: CheckoutSponsor } | null = null\n /** The bootstrap that names the checkout's sponsor was asked for (once per checkout) — see watchSponsorBootstrap. */\n private sponsorBootstrapAsked = false\n /** Snapshot of the placed order, for the confirmation screen. */\n @state() private confirmedOrder: {\n items: CartLineItem[]\n currency: string\n total: number\n /** The Vio order number, digits only (#4497) — never the checkout's\n * uuid, which is no order number. Often arrives a moment after the\n * confirmation: see fillOrderNumber. */\n orderId?: string\n /** The shipping charged, when there was one. */\n shipping?: { name: string; price: number }\n /** The provider's own reference for the payment (e.g. Nexi's paymentId). */\n providerRef?: { label: string; value: string }\n /** \"Visa •••• 4847\", once the provider says. */\n paidWith?: string\n /** Where the receipt goes. */\n email?: string\n } | null = null\n\n /** Active Klarna Payments widget handle + the subtotal it was mounted for. */\n private klarnaHandle: KlarnaPaymentsHandle | null = null\n private klarnaMountedAmount: number | null = null\n private klarnaMountedShipping: string | null = null\n private klarnaMounting = false\n /** Categories offered by the active Klarna session + the selected one. */\n @state() private klarnaCategories: KlarnaPaymentsHandle['categories'] = []\n @state() private klarnaSelectedCat = ''\n @state() private klarnaAuthorizing = false\n /** Chosen shipping option id (express flow) — drives the Klarna order total. */\n @state() private selectedShipping = ''\n /** Real per-supplier shippings from the backend. */\n @state() private availableShippingsList: KlarnaShippingOption[] = []\n /** Payment method names enabled for the sponsor (backend-configured).\n * null = not loaded yet → all buttons render; [] = none enabled. */\n @state() private availableMethods: string[] | null = null\n @state() private vippsOfficial = false\n @state() private kustomMounting = false\n /** The widget is being told about a cart change (suspend → sync → resume). */\n @state() private kustomSyncing = false\n /** What the widget shows: the rate picked inside it and its total (major). */\n @state() private kustomShipping: { name?: string; price?: number } | null = null\n @state() private kustomTotal: number | null = null\n @state() private kustomNotice: string | null = null\n /** The cart the mounted Kustom order describes — see kustomCartKey. */\n private kustomMountedKey: string | null = null\n private kustomMountedOrderId: string | null = null\n /** The checkout session (see embedSession) each embedded widget's order belongs to. */\n private kustomMountedFor: string | null = null\n private qliroMountedFor: string | null = null\n private walleyMountedFor: string | null = null\n private nexiMountedFor: string | null = null\n @state() private qliroMounting = false\n private qliroMountedOrderId: string | null = null\n @state() private walleyMounting = false\n private walleyMountedOrderId: string | null = null\n @state() private nexiMounting = false\n private nexiMountedOrderId: string | null = null\n /** What Nexi's shipping re-pricing last said, shown under the widget. */\n @state() private nexiShippingNotice: string | null = null\n /** Nexi's last re-pricing: the rate on the payment and the ones to pick from. */\n @state() private nexiShipping: NexiShippingUpdate | null = null\n /** A picked rate is being pushed to the payment. */\n @state() private nexiPicking = false\n /** The Nexi payment to resume on the next mount — set only by the ?paymentId= return. */\n private nexiResumePaymentId: string | null = null\n @state() private adyenMounting = false\n /**\n * The shopper ASKED for the payment step (chose the method, or pressed the\n * panel's button). Adyen needs our form first, so nothing creates a session\n * while they are still typing: a session is a photo of a finished form.\n */\n @state() private adyenRequested = false\n /** Drop-in is on screen. */\n @state() private adyenMounted = false\n /** The form, the shipping or the cart changed under a mounted session. */\n @state() private adyenStale = false\n /** Paid or pending in this opening: never offer to pay again. */\n @state() private adyenSettled = false\n /** The checkout session (see embedSession) and the purchase the mounted photo is of. */\n private adyenMountedFor: string | null = null\n private adyenMountedKey: string | null = null\n /**\n * Which Stripe this channel offers: `native` pays with Stripe's Payment\n * Element on THIS page, `link` sends the shopper to a page hosted by\n * Stripe. It travels in the method's config and is resolved with the\n * method list; null means \"not known yet\", and the pay button asks.\n */\n @state() private stripeMode: 'native' | 'link' | null = null\n /** The shopper asked for the payment step (see adyenRequested). */\n @state() private stripeRequested = false\n @state() private stripeMounting = false\n /** The Payment Element is on screen. */\n @state() private stripeMounted = false\n /** The form, the shipping or the cart changed under a mounted Element. */\n @state() private stripeStale = false\n /** Paid or pending in this opening: never offer to pay again. */\n @state() private stripeSettled = false\n /** Stripe is confirming right now — one press, not two. */\n @state() private stripePaying = false\n /** Stripe has PAINTED its form: until then the panel says it is loading. */\n @state() private stripeReady = false\n private stripeMountedFor: string | null = null\n private stripeMountedKey: string | null = null\n /** The checkout the mounted PaymentIntent pays for. */\n private stripeCheckoutId: string | null = null\n private stripeElement: StripeElementHandle | null = null\n /**\n * The shipping the customer picked INSIDE the Qliro widget, as Qliro\n * reports it. Qliro owns that choice in the modes where it shows a picker,\n * so while Qliro is the method the summary follows it instead of our own\n * preselected rate. Null until Qliro reports one — in `Vio rate as an order\n * line` it never does, and our rate is the one Qliro charges.\n */\n @state() private qliroShipping: { ref?: string; price?: number } | null = null\n /**\n * Set while this page load is showing the outcome of an embedded checkout's\n * confirmation redirect (Kustom, Qliro, Walley). While set, nothing may start\n * a new payment.\n *\n * The return handler selects the method so the panel has something to show,\n * and only THEN asks the provider whether the order was paid. Selecting is a\n * state change; the render it schedules runs `updated()` → `mount*IfNeeded()`\n * long before the provider answers, and in a fresh page load there is no\n * mounted order to stop it — so every return created a new backend checkout\n * and a new provider order for a cart that had just been paid. Not a race\n * that needs a slow network: a microtask always beats a round trip.\n * Reproduced in `vio-checkout.return.dom.test.ts` before this existed.\n *\n * Cleared when the checkout closes: reopening it is a fresh checkout.\n */\n private returningFrom: PaymentMethod | null = null\n /** Redirecting to the Stripe / Vipps hosted page. */\n @state() private stripeLoading = false\n @state() private vippsLoading = false\n @state() private form: CheckoutAddress = {\n firstName: '',\n lastName: '',\n email: '',\n phone: '',\n address: '',\n postalCode: '',\n city: '',\n }\n /** In-flight guard for loadAvailablePaymentMethods. */\n private loadingPaymentMethods = false\n /**\n * Keyboard and focus while open: Escape closes — not while a payment is\n * in flight — Tab stays inside, focus returns to the opener.\n */\n private readonly dialogFocus = new DialogFocus({\n host: this,\n container: () => this.renderRoot.querySelector<HTMLElement>('.modal'),\n close: () => this.close(),\n canClose: () => !this.paymentInFlight,\n })\n /** Phones: the page behind is locked, and the sheet closes by pulling the bar or the top bar down — not mid-payment. */\n private readonly bottomSheet = new BottomSheet({\n host: this,\n sheet: () => this.renderRoot.querySelector<HTMLElement>('.modal'),\n backdrop: () => this.renderRoot.querySelector<HTMLElement>('.backdrop'),\n dragZones: '.handle, .topbar',\n close: () => this.close(),\n canClose: () => !this.paymentInFlight,\n })\n /** A payment is being started or confirmed right now: the overlay must not close under it. */\n private get paymentInFlight(): boolean {\n return (\n this.stripePaying ||\n this.stripeLoading ||\n this.vippsLoading ||\n this.klarnaAuthorizing ||\n this.applePayInProgress\n )\n }\n /**\n * Whether a load has COMPLETED, either way. `availableMethods === null`\n * cannot tell \"not asked yet\" from \"asked and failed\", and rendering every\n * button while we still do not know shows methods the channel may not have\n * enabled — a shopper can click one that is not there.\n */\n @state() private paymentMethodsResolved = false\n /** Guards `autoSelectSoleMethod` to ONE attempt per opening — see there. */\n private autoSelectAttempted = false\n /** In-flight + attempted guards for loadAvailableShippings (change events\n * fire per keystroke — without these, typing an address hammers the API). */\n private loadingShippings = false\n private shippingsAttempted = false\n /**\n * The cart's products cannot ship together (see `someLineShipsOnItsOwn`).\n * While set, no payment can start and the payment step says why.\n */\n @state() private shippingBlocked = false\n /** The opening whose shippings have been answered for — see\n * `shippingsSettled`. */\n @state() private shippingsReadyFor: string | null = null\n\n private boundOnQliroEvent = (e: Event): void => {\n const event = (e as CustomEvent<any>).detail\n if (!event) return\n if (event.type === 'shipping-price-changed' && typeof event.price === 'number') {\n this.qliroShipping = { ...(this.qliroShipping ?? {}), price: event.price }\n } else if (event.type === 'shipping-changed') {\n const shipping = event.shipping ?? {}\n const ref = shipping.method ?? shipping.merchantReference ?? shipping.MerchantReference\n const price =\n typeof shipping.price === 'number'\n ? shipping.price\n : this.availableShippingsList.find((o) => o.id === String(ref))?.priceMajor\n this.qliroShipping = {\n ...(this.qliroShipping ?? {}),\n ...(ref != null ? { ref: String(ref) } : {}),\n ...(typeof price === 'number' ? { price } : {}),\n }\n }\n }\n\n private boundOnCheckoutChange = (e: Event): void => {\n const detail = (e as CustomEvent<CheckoutChangeDetail>).detail\n const prevSponsorId = this.checkoutState?.sponsorId\n const sponsorChanged = !prevSponsorId || prevSponsorId !== detail.state?.sponsorId\n this.checkoutState = detail.state\n this.items = Vio.checkout.items\n // Re-check vendor availability when the sponsor changes (state changes fire\n // on every selection — refetching each time hammers the backend).\n //\n // The condition is \"not resolved yet\", NOT \"availableMethods is null\":\n // null also means \"asked and failed\", and `setAddress` emits on every\n // KEYSTROKE in the address form. One transient failure of the methods\n // lookup used to turn every subsequent keypress into a full refresh of\n // methods, shippings, Apple Pay and Klarna — for the rest of the session.\n // Same hammering shape as the mount loop of 2026-09-08, one layer up.\n if (this.checkoutState) {\n if (sponsorChanged || !this.paymentMethodsResolved) {\n // A different sponsor is a different channel: what it offers has to be\n // asked again, so the previous answer stops counting as resolved.\n if (sponsorChanged) this.paymentMethodsResolved = false\n void this.refreshApplePay()\n void this.refreshKlarna()\n void this.loadAvailablePaymentMethods()\n void this.loadAvailableShippings()\n } else if (!this.shippingsAttempted) {\n void this.loadAvailableShippings()\n }\n } else {\n this.applePayAvailable = false\n this.klarnaAvailable = false\n this.orderConfirmed = false\n this.providerReceipt = null\n this.confirmedMethod = null\n this.confirmedOrder = null\n this.paymentError = null\n this.paymentNotice = null\n this.verifyingReturn = null\n this.confirmedCheckoutId = null\n this.orderSponsor = null\n this.sponsorBootstrapAsked = false\n this.express = false\n this.availableMethods = null\n this.paymentMethodsResolved = false\n this.autoSelectAttempted = false\n this.returningFrom = null\n // The next opening asks again: the cart may have changed meanwhile.\n this.shippingBlocked = false\n this.unmountKlarna()\n // The embedded widgets go with the checkout they were opened for, as\n // \"Endre\" already does. Kept, the \"already mounted\" guard reused them on\n // the next open — with the order they were created for: Alan\n // (2026-09-14) closed with the X, changed the cart, reopened, and Qliro\n // still asked for the old total. Paying there charges the old cart.\n this.unmountKustom()\n this.unmountQliro()\n this.unmountWalley()\n this.unmountNexi()\n this.unmountAdyen()\n this.adyenSettled = false\n this.unmountStripe()\n this.stripeSettled = false\n }\n }\n\n private boundOnPaymentComplete = (e: Event): void => {\n const detail = (\n e as CustomEvent<{ method: string; state?: { sponsorId: number }; result: unknown }>\n ).detail\n // Klarna (after server order creation) and Apple Pay (after the sheet\n // authorizes) both reach the same confirmation drawer. Other methods\n // (Vipps/Card) confirm via the plain CTA, not this event.\n if (detail.method !== 'klarna' && detail.method !== 'apple-pay') return\n const sponsorId = detail.state?.sponsorId ?? this.checkoutState?.sponsorId\n if (sponsorId == null) return\n this.confirmOrder(detail.method as PaymentMethod, sponsorId, detail.result)\n }\n\n private boundOnPaymentError = (e: Event): void => {\n const detail = (e as CustomEvent<{ method: string; error: string }>).detail\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] payment-error:', detail.method, detail.error)\n }\n // Klarna's own reason stays on screen while that flow is being\n // stabilised (see the manager). The others — Apple Pay's sheet failing\n // to start — get the shopper's sentence; the raw text is above.\n this.paymentError =\n detail.method === 'klarna'\n ? `Klarna-betalingen kunne ikke fullføres: ${detail.error}`\n : friendlyPaymentError(detail.error, detail.method)\n // A redirect failure lands with the overlay closed — open it so the error\n // is visible rather than silently dropping the user on the home page.\n this.open = true\n }\n\n static override styles = css`\n :host { display: contents; }\n .backdrop {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.5);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.25s ease;\n z-index: 999;\n }\n :host([open]) .backdrop { opacity: 1; pointer-events: auto; }\n\n .modal {\n position: fixed;\n inset: 0;\n background: var(--vio-color-surface, #fff);\n transform: translateY(100%);\n transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);\n display: flex;\n flex-direction: column;\n font-family: var(--vio-font-sans, -apple-system, sans-serif);\n color: var(--vio-color-text, #0a0a0a);\n z-index: 1000;\n overflow-y: auto;\n }\n :host([open]) .modal { transform: translateY(0); }\n /* Focus lands on the panel itself only as a fallback — no ring for it. */\n .modal:focus { outline: none; }\n\n /* Confirmation drawer — compact bottom sheet, not the full-screen overlay. */\n .modal.as-drawer {\n inset: auto 0 0 0;\n height: auto;\n max-height: 88vh;\n max-width: 460px;\n margin: 0 auto;\n border-radius: var(--vio-radius-xl, 16px) var(--vio-radius-xl, 16px) 0 0;\n box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);\n }\n .modal.as-drawer .handle {\n display: flex;\n justify-content: center;\n padding: 10px 0 4px;\n flex-shrink: 0;\n }\n .modal.as-drawer .handle::before {\n content: '';\n width: 40px;\n height: 4px;\n background: var(--vio-color-border, #e5e5e5);\n border-radius: var(--vio-radius-sm, 2px);\n }\n\n /* Express (Apple Pay-style): right-side drawer, like the cart. Slides in\n from the right instead of the full-screen overlay. */\n .modal.as-side {\n inset: 0 0 0 auto;\n width: min(var(--vio-checkout-width, 440px), 100%);\n max-width: var(--vio-checkout-width, 440px);\n transform: translateX(100%);\n border-radius: 0;\n box-shadow: -8px 0 24px rgba(0, 0, 0, 0.1);\n }\n :host([open]) .modal.as-side { transform: translateX(0); }\n\n /* Desktop: the checkout ALWAYS lives as a right-side panel (like the cart,\n product detail and express drawer) — never a full-width overlay. The\n confirmation stays in that panel too: a centered card jumped out of the\n panel the shopper was in and looked like the phone layout (Angelo,\n 2026-09-16). */\n @media (min-width: 601px) {\n .modal {\n inset: 0 0 0 auto;\n width: min(var(--vio-checkout-width, 440px), 100%);\n max-width: var(--vio-checkout-width, 440px);\n transform: translateX(100%);\n border-radius: 0;\n box-shadow: -8px 0 24px rgba(0, 0, 0, 0.1);\n }\n :host([open]) .modal { transform: translateX(0); }\n }\n @media (max-width: 600px) {\n /* On phones, keep it a bottom sheet for reachability. */\n .modal.as-side {\n inset: auto 0 0 0;\n width: 100%;\n max-width: none;\n height: 92vh;\n transform: translateY(100%);\n border-radius: var(--vio-radius-xl, 16px) var(--vio-radius-xl, 16px) 0 0;\n }\n :host([open]) .modal.as-side { transform: translateY(0); }\n }\n\n /* Phones: the confirmation is a compact bottom sheet, as tall as it needs. */\n @media (max-width: 600px) {\n .modal.as-confirm {\n height: auto;\n max-height: 88vh;\n }\n }\n\n .handle { display: none; }\n\n /* Mobile: bottom sheet with rounded top + drag handle. */\n @media (max-width: 600px) {\n .modal {\n top: auto;\n height: 92vh;\n border-radius: var(--vio-radius-xl, 16px) var(--vio-radius-xl, 16px) 0 0;\n box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);\n overscroll-behavior: contain;\n }\n /* Pulled down to close (bottom-sheet.ts): the browser must not take the gesture for a scroll. */\n .handle, .topbar { touch-action: none; }\n .handle {\n display: flex;\n justify-content: center;\n padding: 10px 0 4px;\n flex-shrink: 0;\n }\n .handle::before {\n content: '';\n width: 40px;\n height: 4px;\n background: var(--vio-color-border, #e5e5e5);\n border-radius: var(--vio-radius-sm, 2px);\n }\n }\n\n .topbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 20px var(--vio-space-lg, 24px);\n border-bottom: 1px solid var(--vio-color-border, #e5e5e5);\n position: sticky;\n top: 0;\n background: var(--vio-color-surface, #fff);\n z-index: 1;\n }\n .heading {\n font-family: var(--vio-font-serif, Georgia, serif);\n font-size: 24px;\n font-weight: 400;\n margin: 0;\n }\n .topbar-title {\n display: flex;\n flex-direction: column;\n gap: 4px;\n min-width: 0;\n }\n /* Who the shopper buys from — the checkout's sponsor, compact under the heading. */\n .topbar-sponsor {\n margin: 0;\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n line-height: 1.3;\n color: var(--vio-color-text-secondary, #666);\n }\n .topbar-sponsor-logo {\n display: block;\n width: auto;\n height: 18px;\n max-width: 120px;\n object-fit: contain;\n }\n .topbar-sponsor-name {\n color: var(--vio-color-text, #0a0a0a);\n font-weight: 600;\n }\n .close {\n background: none;\n border: none;\n cursor: pointer;\n font-size: 28px;\n line-height: 1;\n padding: 0;\n color: var(--vio-color-text, #0a0a0a);\n font-family: inherit;\n }\n .close:hover { color: var(--vio-color-text-secondary, #666); }\n\n .body {\n max-width: 720px;\n margin: 0 auto;\n width: 100%;\n padding: 56px var(--vio-space-lg, 24px) 80px;\n box-sizing: border-box;\n }\n .section { margin-bottom: 56px; }\n .section-label {\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-accent, #c14a3b);\n margin-bottom: 12px;\n font-weight: 500;\n }\n .section-heading {\n font-family: var(--vio-font-serif, Georgia, serif);\n font-size: 28px;\n margin: 0 0 var(--vio-space-lg, 24px);\n font-weight: 400;\n line-height: 1.2;\n }\n\n .form-row {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: var(--vio-space-md, 16px);\n }\n .field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-bottom: var(--vio-space-md, 16px);\n }\n .field label {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n font-weight: 500;\n }\n .field input {\n padding: 12px 0;\n border: none;\n border-bottom: 1px solid var(--vio-color-border, #e5e5e5);\n font-size: 16px;\n font-family: inherit;\n color: inherit;\n background: transparent;\n outline: none;\n transition: border-color 0.15s;\n }\n .field input:focus { border-bottom-color: var(--vio-color-text, #0a0a0a); }\n .field input[aria-invalid='true'] { border-bottom-color: var(--vio-color-accent, #c14a3b); }\n .field-error { margin-top: 4px; font-size: 12px; color: var(--vio-color-accent, #c14a3b); }\n\n .payment-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: var(--vio-space-md, 16px);\n }\n /* Shown until we know which methods the channel offers. Rendering every\n button meanwhile would let a shopper click one that is not enabled. */\n .payment-loading {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 20px 0;\n font-size: 13px;\n color: var(--vio-color-text-secondary, #666);\n }\n .payment-spinner {\n width: 14px;\n height: 14px;\n border: 2px solid var(--vio-color-border, #e5e5e5);\n border-top-color: var(--vio-color-text-secondary, #666);\n border-radius: 50%;\n animation: vio-payment-spin 0.7s linear infinite;\n }\n @keyframes vio-payment-spin {\n to { transform: rotate(360deg); }\n }\n @media (prefers-reduced-motion: reduce) {\n .payment-spinner { animation: none; }\n }\n /* Back from a payment page: only this until we know. */\n .verifying {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n gap: 10px;\n padding: 56px 16px;\n }\n .verifying-spinner {\n width: 28px;\n height: 28px;\n border: 3px solid var(--vio-color-border, #e5e5e5);\n border-top-color: var(--vio-color-accent, #c14a3b);\n border-radius: 50%;\n animation: vio-payment-spin 0.8s linear infinite;\n }\n .verifying-text {\n margin: 6px 0 0;\n font-size: 15px;\n font-weight: 600;\n color: var(--vio-color-text, #1a1a1a);\n }\n .verifying-hint {\n margin: 0;\n font-size: 13px;\n color: var(--vio-color-text-secondary, #666);\n }\n @media (prefers-reduced-motion: reduce) {\n .verifying-spinner { animation: none; }\n }\n .payment-btn {\n padding: 20px;\n background: #fff;\n border: 1px solid var(--vio-color-border, #e5e5e5);\n cursor: pointer;\n font-family: inherit;\n font-size: 14px;\n font-weight: 500;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n transition: border-color 0.15s, background 0.15s;\n color: var(--vio-color-text, #0a0a0a);\n }\n .payment-btn:hover:not(:disabled) {\n border-color: var(--vio-color-text, #0a0a0a);\n background: var(--vio-color-surface-hover, #fafafa);\n }\n .payment-btn:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n pointer-events: none;\n }\n .payment-btn.primary {\n background: var(--vio-color-text, #0a0a0a);\n color: var(--vio-color-text-on-primary, #fff);\n grid-column: 1 / -1;\n border-color: var(--vio-color-text, #0a0a0a);\n padding: 22px;\n font-weight: 600;\n }\n .payment-btn.primary:hover:not(:disabled) { background: #222; border-color: #222; }\n .payment-btn[aria-pressed='true'] {\n border-color: var(--vio-color-accent, #c14a3b);\n }\n /* Klarna Payments — inline widget panel, shown once Klarna is selected. */\n .klarna-panel {\n grid-column: 1 / -1;\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin-top: 4px;\n }\n /* Klarna remembers the customer's preferred payment_method_category\n * server-side across sessions/browsers — exposing a category-switcher\n * chip UI on top of that just confuses users. Hidden per Alan's\n * 2026-08-18 cross-browser investigation; the switching logic (onKlarnaCategory)\n * stays wired for when/if this becomes configurable again. */\n .klarna-cats {\n display: none !important;\n }\n .klarna-cat {\n flex: 1 1 auto;\n padding: 8px 12px;\n border: 1px solid var(--vio-color-border, #ddd);\n border-radius: var(--vio-radius-lg, 8px);\n background: #fff;\n font-size: 13px;\n cursor: pointer;\n }\n .klarna-cat.active {\n border-color: var(--vio-color-text, #111);\n background: var(--vio-color-surface-2, #f6f6f6);\n font-weight: 600;\n }\n .klarna-widget {\n min-height: 48px;\n }\n .express-summary {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-bottom: 16px;\n }\n /* Shipping selector (express) — Standard / Express options. */\n .ship-select { display: flex; flex-direction: column; gap: 8px; }\n .nexi-ship { margin-bottom: 12px; }\n .ship-opt {\n display: flex; align-items: center; justify-content: space-between; gap: 12px;\n padding: 12px 14px; border: 1px solid var(--vio-color-border, #ddd);\n border-radius: var(--vio-radius-lg, 8px); background: #fff; cursor: pointer; font-family: inherit;\n text-align: left;\n }\n .ship-opt.active {\n border-color: var(--vio-color-text, #111);\n background: var(--vio-color-surface-2, #f6f6f6);\n }\n .ship-opt:disabled { opacity: 0.6; cursor: default; }\n .ship-meta { display: flex; flex-direction: column; gap: 2px; }\n .ship-meta b { font-weight: 600; font-size: 13px; }\n .ship-meta span { color: var(--vio-color-text-secondary, #666); font-size: 12px; }\n .ship-price { font-weight: 600; font-size: 13px; }\n .payment-error {\n grid-column: 1 / -1;\n padding: 12px 16px;\n background: #fdecea;\n border: 1px solid var(--vio-color-accent, #c14a3b);\n border-radius: var(--vio-radius-lg, 8px);\n font-size: 13px;\n color: var(--vio-color-accent, #c14a3b);\n text-align: center;\n }\n .payment-notice {\n grid-column: 1 / -1;\n padding: 12px 16px;\n background: #f4f4f2;\n border: 1px solid var(--vio-color-border, #ddd);\n border-radius: var(--vio-radius-lg, 8px);\n font-size: 13px;\n color: var(--vio-color-text, #1a1a1a);\n text-align: center;\n }\n /* \"Betal\" CTA — sits full-width below the method grid once a method is\n picked. Reuses .payment-btn.primary (its grid-column spans the row). */\n .complete-cta {\n width: 100% !important;\n box-sizing: border-box !important;\n margin-top: 8px;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n text-align: center !important;\n }\n\n /* Order confirmation — compact, shown inside the drawer. */\n .confirmation {\n padding: 8px 0 28px;\n display: flex;\n flex-direction: column;\n gap: 20px;\n }\n .confirm-head {\n display: flex;\n align-items: center;\n gap: 16px;\n }\n .confirm-details {\n margin: 0;\n display: flex;\n flex-direction: column;\n border: 1px solid var(--vio-color-border, #eee);\n border-radius: var(--vio-radius-lg, 8px);\n }\n .confirm-details > div {\n display: flex;\n justify-content: space-between;\n gap: 16px;\n padding: 10px 14px;\n font-size: 13px;\n }\n .confirm-details > div + div { border-top: 1px solid var(--vio-color-border, #eee); }\n .confirm-details dt { color: var(--vio-color-text-secondary, #666); white-space: nowrap; }\n .confirm-details dd.ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 500; font-size: 12px; }\n .confirm-details dd {\n margin: 0;\n font-weight: 600;\n text-align: right;\n font-variant-numeric: tabular-nums;\n word-break: break-all;\n }\n .confirm-label {\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n color: var(--vio-color-text-secondary, #666);\n }\n .confirm-line {\n display: grid;\n grid-template-columns: 56px 1fr auto;\n gap: 12px;\n align-items: center;\n }\n .confirm-thumb {\n width: 56px;\n height: 56px;\n object-fit: cover;\n background: var(--vio-color-surface-muted, #f2f2f2);\n display: block;\n }\n .confirm-line-name { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }\n .confirm-line-name small { font-size: 11px; color: var(--vio-color-text-secondary, #666); }\n .confirm-line-price { font-size: 14px; font-weight: 600; }\n .confirm-check {\n flex-shrink: 0;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n background: var(--vio-confirm-check-bg, #2e7d32);\n color: #fff;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 24px;\n line-height: 1;\n }\n .confirm-title {\n font-family: var(--vio-font-serif, Georgia, serif);\n font-size: var(--vio-confirm-title-size, 24px);\n font-weight: var(--vio-confirm-title-weight, 400);\n margin: 0;\n }\n /* The brand the order is with: its logo over the thanks, its name in it. */\n .confirm-brand { display: flex; align-items: center; }\n .confirm-brand-logo {\n display: block;\n width: auto;\n height: var(--vio-confirm-logo-height, 40px);\n max-width: var(--vio-confirm-logo-max-width, 220px);\n object-fit: contain;\n }\n .confirm-sponsor {\n font-size: var(--vio-confirm-text-size, 14px);\n line-height: 1.4;\n color: var(--vio-color-text, #0a0a0a);\n margin: 4px 0 0;\n }\n .confirm-sponsor strong { font-weight: 600; }\n .confirm-text {\n font-size: 14px;\n color: var(--vio-color-text-secondary, #666);\n line-height: 1.5;\n margin: 4px 0 0;\n }\n .confirm-order-id {\n font-size: 13px;\n color: var(--vio-color-text-secondary, #666);\n }\n .confirm-order-id b {\n color: var(--vio-color-text, #0a0a0a);\n font-variant-numeric: tabular-nums;\n }\n .confirm-summary {\n display: flex;\n flex-direction: column;\n gap: 12px;\n font-size: 13px;\n }\n .confirm-close {\n width: 100%;\n border: none;\n background: var(--vio-color-text, #0a0a0a);\n color: var(--vio-color-text-on-primary, #fff);\n padding: 16px 48px;\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n font-weight: 600;\n cursor: pointer;\n font-family: inherit;\n margin-top: 16px;\n }\n .confirm-close:hover { background: #222; }\n\n .order-summary {\n background: var(--vio-color-surface-muted, #f2f2f2);\n padding: var(--vio-space-lg, 24px);\n margin-top: var(--vio-space-xl, 32px);\n }\n .order-line {\n display: grid;\n grid-template-columns: 56px 1fr auto;\n gap: 12px;\n padding: 8px 0;\n align-items: center;\n }\n .order-line-img {\n aspect-ratio: 1;\n background: #fff;\n overflow: hidden;\n }\n .order-line-img img { width: 100%; height: 100%; object-fit: cover; display: block; }\n .order-line-meta { font-size: 13px; }\n .order-line-meta b { display: block; }\n .order-line-meta span {\n color: var(--vio-color-text-secondary, #666);\n font-size: 11px;\n text-transform: uppercase;\n letter-spacing: var(--vio-tracking-label, 0.1em);\n }\n .order-line-price { font-weight: 700; font-size: 14px; }\n .order-row {\n display: flex;\n justify-content: space-between;\n padding: 8px 0;\n font-size: 14px;\n }\n .order-row.total {\n border-top: 1px solid var(--vio-color-border-default, #ccc);\n margin-top: var(--vio-space-sm, 8px);\n padding-top: var(--vio-space-md, 16px);\n font-weight: 700;\n font-size: 16px;\n }\n\n @media (max-width: 600px) {\n .form-row { grid-template-columns: 1fr; gap: 0; }\n .payment-grid { grid-template-columns: 1fr; }\n .body { padding: 32px var(--vio-space-lg, 24px) 64px; }\n }\n `\n\n override connectedCallback(): void {\n super.connectedCallback()\n void this.loadVippsButton()\n this.checkoutState = Vio.checkout.currentState\n this.items = Vio.checkout.items\n Vio.checkout.addEventListener('change', this.boundOnCheckoutChange)\n Vio.checkout.addEventListener('payment-complete', this.boundOnPaymentComplete)\n Vio.checkout.addEventListener('payment-error', this.boundOnPaymentError)\n Vio.checkout.addEventListener('qliro-event', this.boundOnQliroEvent)\n if (this.checkoutState) {\n void this.refreshApplePay()\n void this.refreshKlarna()\n void this.loadAvailablePaymentMethods()\n }\n // Klarna redirect-return first: it must consume its pending context and\n // create the order BEFORE the generic return check runs.\n void Vio.checkout.resumeKlarnaReturn()\n // Landing back from a Stripe/Vipps/Klarna redirect? Verify, then confirm.\n void this.checkReturnPaymentStatus()\n // Reattached after a removal: disconnectedCallback unmounted the widgets\n // and updated() skips mounting while detached, so look again now.\n this.requestUpdate()\n }\n\n /**\n * Detect the redirect return from a hosted payment page (Stripe / Vipps /\n * Klarna): the return URL carries vio_payment/vio_method/vio_sponsor. On\n * success: clear that sponsor's cart, show the confirmation drawer, emit\n * vio:payment-success (analytics/host hooks) and scrub the URL params.\n */\n /** Backend checkout statuses that mean the payment went through. */\n private static readonly PAID_STATUSES = new Set([\n 'paid', 'completed', 'complete', 'success', 'succeeded', 'confirmed', 'captured',\n ])\n\n /** Statuses that mean the payment definitively did NOT go through. */\n private static readonly FAILED_STATUSES = new Set([\n 'failed', 'cancelled', 'canceled', 'rejected', 'declined', 'expired', 'aborted',\n 'terminated', 'error', 'voided', 'unpaid',\n ])\n\n /**\n * Shown instead of the payment step when the cart's products cannot ship\n * together. Angelo, 2026-09-16: block the purchase rather than sell it\n * without shipping, or with a rate that does not fit every product.\n */\n private static readonly SHIPPING_BLOCKED_MESSAGE =\n 'Produktene i handlekurven kan ikke sendes sammen. Fjern ett av dem for å fullføre kjøpet.'\n\n /** The payment may or may not have gone through, and we could not find out. */\n private static readonly RETURN_UNVERIFIED_MESSAGE =\n 'Vi kunne ikke bekrefte betalingen. Handlekurven er uendret — prøv igjen, eller kontakt support hvis du ble belastet.'\n\n /** Waits between GetCheckout attempts — PSP webhooks (Vipps especially) can\n * land seconds after the shopper is redirected back, so a single immediate\n * check misreads a successful charge as unpaid. ~20s total. */\n private static readonly RETURN_VERIFY_DELAYS_MS = [0, 2000, 4000, 6000, 8000]\n\n /** Vipps polling cadence — up to 2 minutes. Its webhook can lag well behind\n * the redirect; this window was verified against a live checkout. */\n private static readonly VIPPS_STATUS_MAX_ATTEMPTS = 24\n private static readonly VIPPS_STATUS_DELAY_MS = 5000\n\n /**\n * Vipps redirects to our return URL the same way on cancel as on success —\n * the URL alone can't tell them apart, and the generic checkout status can\n * lag behind Vipps' own webhook. Poll Vipps' own state directly instead:\n * AUTHORIZED confirms, CREATED means still processing (keep polling),\n * anything else (including an unrecognized state) is treated as failed —\n * fail-closed by default rather than guessing.\n */\n /** Vipps' own button when its script answers; our orange one otherwise. */\n private async loadVippsButton(): Promise<void> {\n this.vippsOfficial = await ensureVippsButton()\n }\n\n private async pollVippsStatus(\n checkoutId: string,\n sponsorId: number,\n ): Promise<{ outcome: 'paid' | 'failed' | 'pending' | 'duplicate'; sawStatus: boolean }> {\n let sawStatus = false\n for (let attempt = 0; attempt < VioCheckout.VIPPS_STATUS_MAX_ATTEMPTS; attempt++) {\n if (attempt > 0) {\n await new Promise((r) => setTimeout(r, VioCheckout.VIPPS_STATUS_DELAY_MS))\n }\n try {\n const vippsStatus = await Vio.checkout.getVippsStatus(checkoutId, sponsorId || undefined)\n const state = String(vippsStatus?.state ?? '').toUpperCase()\n sawStatus = true\n // The cart was paid through another checkout (another tab): not a failure.\n if (vippsStatus?.duplicate_of) return { outcome: 'duplicate', sawStatus }\n if (state === 'AUTHORIZED') return { outcome: 'paid', sawStatus }\n if (state === 'CREATED') continue\n return { outcome: 'failed', sawStatus }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] GetVippsStatus attempt failed:', err)\n }\n }\n }\n // Exhausted every attempt without a definitive state — honestly \"still\n // processing\", not a fabricated failure (Vipps' webhook may still land\n // and the backend order still get created).\n return { outcome: 'pending', sawStatus }\n }\n\n /** Shared outcome handler for both the generic (GetCheckout) and the\n * Vipps-specific (GetVippsStatus) return-verification paths. */\n private applyReturnOutcome(\n outcome: 'paid' | 'failed' | 'pending' | 'duplicate',\n sawStatus: boolean,\n vioMethod: string,\n sponsorId: number,\n checkoutId: string,\n ): void {\n if (outcome === 'paid') {\n // Named while the cart still can: clearing it takes its sponsorName.\n this.setOrderSponsor(sponsorId, checkoutId)\n if (sponsorId > 0) Vio.cart.clearSponsorCart(sponsorId)\n this.confirmedOrder = {\n items: [],\n currency: getGlobalCurrency(),\n total: 0,\n }\n this.confirmedMethod = vioMethod as PaymentMethod\n this.orderConfirmed = true\n this.open = true\n void this.fillOrderNumber(checkoutId, sponsorId)\n void this.emitPaymentSuccess({ method: vioMethod, sponsorId, orderId: checkoutId }, checkoutId, sponsorId)\n } else if (outcome === 'duplicate') {\n this.paymentError = CART_PAID_MESSAGE\n this.open = true\n } else if (outcome === 'failed') {\n this.paymentError = 'Betalingen ble avbrutt eller feilet. Vennligst prøv igjen.'\n this.open = true\n returnCancelled({ method: vioMethod, sponsorId, source: 'checkout', checkoutId })\n } else if (sawStatus) {\n // Backend reachable but the checkout is still processing (webhook not\n // landed yet). Fail-closed: keep the cart, set expectations.\n this.paymentNotice =\n 'Betalingen behandles fortsatt. Du får ordrebekreftelse på e-post når den er gjennomført. Handlekurven er uendret.'\n this.open = true\n } else {\n // Never got an answer from the backend: keep the cart, tell the user.\n this.paymentError = VioCheckout.RETURN_UNVERIFIED_MESSAGE\n this.open = true\n }\n }\n\n private async checkReturnPaymentStatus(): Promise<void> {\n if (typeof window === 'undefined' || !window.location || !window.location.search) return\n try {\n const urlParams = new URLSearchParams(window.location.search)\n // ONLY our own vio_* params — generic names like ?payment= belong to the\n // publisher's page and must never trigger our confirmation flow.\n const vioPayment = urlParams.get('vio_payment')\n const vioMethod = urlParams.get('vio_method') || 'stripe'\n const sponsorId = Number(urlParams.get('vio_sponsor') || 0)\n const checkoutId = urlParams.get('checkout_id') || ''\n // Vipps is handled below without needing vioPayment at all (it\n // re-verifies against Vipps directly, never trusts the URL) — so only\n // bail here when there's neither a payment param NOR a checkout to\n // check.\n // Nexi's third-party return (Vipps/Swish/MobilePay inside the widget):\n // Nexi sends the shopper back to the SAME page with ?paymentId=…. If it\n // is the session we remembered, re-open and re-mount on it — the widget\n // then finishes and fires payment-completed.\n const nexiPaymentId = nexiReturnPaymentId()\n const nexiPending = readNexiPending()\n if (nexiPaymentId && nexiPending && nexiPending.paymentId === nexiPaymentId) {\n this.nexiResumePaymentId = nexiPaymentId\n this.cleanReturnQueryParams(['paymentId'])\n if (!this.checkoutState && nexiPending.sponsorId) {\n try {\n Vio.checkout.open(nexiPending.sponsorId)\n } catch {\n /* noop */\n }\n }\n try {\n Vio.checkout.selectPaymentMethod('nexi')\n } catch {\n /* noop */\n }\n this.open = true\n return\n }\n\n // Kustom's round trip. The confirmation URL is\n // ?order_id=…&payment_processor=KUSTOM&checkout_id=… (the href is\n // query-less by contract); a purchase our validation callback refused\n // comes back as ?vio_payment=rejected&vio_method=kustom. The backend\n // completes a paid order as we read it; the browser confirms nothing.\n const kustomReturn = kustomReturnOutcome(urlParams)\n if (kustomReturn?.kind === 'rejected') {\n // The widget already told the shopper why. Cleaning the URL FIRST:\n // a reload must not repeat the notice as if it just happened.\n this.cleanReturnQueryParams([...KUSTOM_RETURN_QUERY_KEYS])\n this.kustomNotice = 'Bestillingen ble endret. Betalingen ble ikke gjennomført — prøv igjen.'\n return\n }\n if (kustomReturn?.kind === 'confirmation') {\n const kustomOrderId = kustomReturn.orderId\n // BEFORE open()/selectPaymentMethod(): both emit, and the render they\n // schedule must already see it — see `returningFrom`.\n this.returningFrom = 'kustom'\n this.setOrderSponsor(sponsorId, kustomReturn.checkoutId)\n if (!this.checkoutState) {\n const spIdToUse = sponsorId || [...Vio.cart.getAllCarts().keys()][0] || 0\n if (spIdToUse) {\n try {\n Vio.checkout.open(spIdToUse)\n } catch {\n /* noop */\n }\n }\n }\n try {\n Vio.checkout.selectPaymentMethod('kustom')\n } catch {\n /* noop */\n }\n this.open = true\n this.verifyingReturn = 'Bekrefter betalingen…'\n // A reload must not read a used return twice.\n this.cleanReturnQueryParams([...KUSTOM_RETURN_QUERY_KEYS])\n try {\n const order = await Vio.checkout.getKustomOrder(\n kustomOrderId,\n this.checkoutState?.sponsorId,\n )\n this.verifyingReturn = null\n if (order?.status === 'checkout_complete' && order.html_snippet) {\n // Kustom's own receipt, in the light DOM, projected into the\n // receipt view — which does not depend on the cart we clear.\n const spId = this.checkoutState?.sponsorId ?? 0\n // Kustom's `order` is its own (order_id, checkout_id are Kustom's):\n // Vio's checkout id comes from the return URL.\n this.showProviderReceipt('kustom', spId, order, kustomReturn.checkoutId)\n await this.updateComplete\n const container = this.lightContainer('vio-kustom-checkout-container', 'vio-kustom')\n Vio.checkout.renderKustomSnippet(container, order.html_snippet)\n } else {\n // Sent back, but Kustom does not call it paid: nothing to show\n // as a receipt, and nothing to charge again from here.\n this.paymentError = VioCheckout.RETURN_UNVERIFIED_MESSAGE\n }\n } catch (err) {\n this.verifyingReturn = null\n // The order may well be paid — offering to pay again is the one\n // thing this must not do. Same wording as the redirect methods.\n this.paymentError = VioCheckout.RETURN_UNVERIFIED_MESSAGE\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Kustom confirmation read failed:', err)\n }\n }\n return\n }\n\n if (!vioPayment && !checkoutId) return\n\n // Qliro's confirmation return: ?checkout_id=…&payment_processor=QLIRO\n // (the href is query-less by contract). Re-read the order BY CHECKOUT\n // and render Qliro's own receipt; the Commerce order is created\n // server-side by the push webhook, never from the browser.\n if (urlParams.get('payment_processor') === 'QLIRO' && checkoutId) {\n // BEFORE open()/selectPaymentMethod(): both emit, and the render they\n // schedule must already see it — see `returningFrom`.\n this.returningFrom = 'qliro'\n this.setOrderSponsor(sponsorId, checkoutId)\n if (!this.checkoutState) {\n const spIdToUse = sponsorId || [...Vio.cart.getAllCarts().keys()][0] || 0\n if (spIdToUse) {\n try {\n Vio.checkout.open(spIdToUse)\n } catch {\n /* noop */\n }\n }\n }\n try {\n Vio.checkout.selectPaymentMethod('qliro')\n } catch {\n /* noop */\n }\n // A return is not a fresh checkout: whatever the order turns out to be,\n // nothing here should offer to start paying again.\n this.autoSelectAttempted = true\n this.open = true\n this.verifyingReturn = 'Bekrefter betalingen…'\n try {\n const order = await Vio.checkout.getQliroOrder(\n checkoutId,\n this.checkoutState?.sponsorId,\n )\n this.verifyingReturn = null\n if (order?.status === 'Completed') {\n // Qliro's own receipt is the one shown, not ours (Angelo,\n // 2026-09-15). It goes through showProviderReceipt, whose view does\n // not depend on the cart — clearing the cart is what took the\n // receipt away on 2026-09-08 and brought back the payment step.\n // No order is created meanwhile: mayStartEmbeddedPayment() is false\n // while a receipt is on screen. If Qliro sends no receipt, ours.\n const spId = this.checkoutState?.sponsorId ?? sponsorId ?? 0\n const result = { order: { orderId: order.order_id }, chargedTotal: order.total_price }\n this.qliroMountedOrderId = order.order_id\n if (order.html_snippet) {\n this.showProviderReceipt('qliro', spId, result, checkoutId)\n await this.updateComplete\n const container = this.lightContainer('vio-qliro-checkout-container', 'vio-qliro')\n Vio.checkout.renderKustomSnippet(container, order.html_snippet)\n } else {\n this.confirmOrder('qliro', spId, result, checkoutId)\n }\n } else if (order?.html_snippet) {\n // Not completed (OnHold, still InProcess): Qliro's own screen explains\n // that state better than we could.\n this.qliroMountedOrderId = order.order_id\n await this.updateComplete\n const container = this.lightContainer('vio-qliro-checkout-container', 'vio-qliro')\n if (container) {\n Vio.checkout.renderKustomSnippet(container, order.html_snippet)\n }\n }\n } catch (err) {\n this.verifyingReturn = null\n // The order may well be paid — offering to pay again is the one\n // thing this must not do. Same wording as the redirect methods.\n this.paymentError = VioCheckout.RETURN_UNVERIFIED_MESSAGE\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Qliro confirmation read failed:', err)\n }\n }\n this.cleanReturnQueryParams(['checkout_id', 'payment_processor'])\n return\n }\n\n // Walley's confirmation return: ?checkout_id=…&payment_processor=WALLEY\n // — the SAFETY-NET path (the primary success signal is the DOM event\n // handled inline by mountWalleyIfNeeded; this only fires if that event\n // was missed — tab backgrounded, page reload). Re-read the session BY\n // CHECKOUT and render Walley's own receipt.\n if (urlParams.get('payment_processor') === 'WALLEY' && checkoutId) {\n // BEFORE open()/selectPaymentMethod(): both emit, and the render they\n // schedule must already see it — see `returningFrom`.\n this.returningFrom = 'walley'\n this.setOrderSponsor(sponsorId, checkoutId)\n if (!this.checkoutState) {\n const spIdToUse = sponsorId || [...Vio.cart.getAllCarts().keys()][0] || 0\n if (spIdToUse) {\n try {\n Vio.checkout.open(spIdToUse)\n } catch {\n /* noop */\n }\n }\n }\n try {\n Vio.checkout.selectPaymentMethod('walley')\n } catch {\n /* noop */\n }\n this.open = true\n this.verifyingReturn = 'Bekrefter betalingen…'\n try {\n const order = await Vio.checkout.getWalleyOrder(\n checkoutId,\n this.checkoutState?.sponsorId,\n )\n this.verifyingReturn = null\n if (order?.html_snippet) {\n this.walleyMountedOrderId = order.order_id\n await this.updateComplete\n const container = this.lightContainer('vio-walley-checkout-container', 'vio-walley')\n if (container) {\n Vio.checkout.renderKustomSnippet(container, order.html_snippet)\n }\n if (order.status === 'PurchaseCompleted') {\n // Walley's receipt stays on screen — see showProviderReceipt.\n this.showProviderReceipt(\n 'walley',\n this.checkoutState?.sponsorId ?? 0,\n { orderId: order.order_id },\n checkoutId,\n )\n }\n }\n } catch (err) {\n this.verifyingReturn = null\n // The order may well be paid — offering to pay again is the one\n // thing this must not do. Same wording as the redirect methods.\n this.paymentError = VioCheckout.RETURN_UNVERIFIED_MESSAGE\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Walley confirmation read failed:', err)\n }\n }\n this.cleanReturnQueryParams(['checkout_id', 'payment_processor'])\n return\n }\n\n // Klarna's own return path (resumeKlarnaReturn) creates the order and\n // fires payment-complete — don't double-handle while it's pending.\n if (\n vioMethod === 'klarna' &&\n storageGet('session', 'vio.klarna.pending.v1')\n ) {\n this.cleanReturnQueryParams(['vio_payment', 'vio_method', 'vio_sponsor', 'checkout_id'])\n return\n }\n\n // Adyen's return (Vipps, Klarna, Trustly, redirect-3DS): OUR return URL\n // names the checkout and Adyen appended `redirectResult`. It is\n // finalised on the SERVER, so it works in a browser that never saw the\n // session. The query is cleaned FIRST: a reload must not submit a used\n // redirectResult again.\n if (vioMethod === ADYEN_RETURN_METHOD && checkoutId) {\n const adyenReturn = adyenReturnParams(window.location.search)\n this.cleanReturnQueryParams(ADYEN_RETURN_QUERY_KEYS)\n if (!adyenReturn) return\n this.returningFrom = 'adyen'\n this.setOrderSponsor(sponsorId, checkoutId)\n this.adyenSettled = true\n this.autoSelectAttempted = true\n if (!this.checkoutState) {\n const spIdToUse = sponsorId || [...Vio.cart.getAllCarts().keys()][0] || 0\n if (spIdToUse) {\n try {\n Vio.checkout.open(spIdToUse)\n Vio.checkout.selectPaymentMethod('adyen')\n } catch {\n /* noop */\n }\n }\n }\n this.open = true\n this.verifyingReturn = 'Bekrefter betalingen…'\n let payment: AdyenPayment | null = null\n let sawStatus = false\n try {\n payment = await Vio.checkout.getAdyenPayment(\n checkoutId,\n { redirectResult: adyenReturn.redirectResult },\n sponsorId || undefined,\n )\n sawStatus = !!payment\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Adyen return could not be verified:', err)\n }\n }\n this.verifyingReturn = null\n const outcome = sawStatus ? adyenReturnOutcome(payment) : 'pending'\n this.applyReturnOutcome(outcome, sawStatus, 'adyen', sponsorId, checkoutId)\n if (outcome === 'paid' && this.confirmedOrder) {\n this.confirmedOrder = {\n ...this.confirmedOrder,\n currency: payment?.purchase_currency ?? this.confirmedOrder.currency,\n total: payment?.total_price ?? this.confirmedOrder.total,\n }\n this.addAdyenPaymentDetails(payment)\n }\n if (outcome === 'failed') {\n // Nothing was charged: the shopper may pay again, on a new session.\n this.returningFrom = null\n this.adyenSettled = false\n }\n return\n }\n\n if (vioMethod === 'vipps' && checkoutId) {\n // Vipps-specific path: check Vipps' own state instead of the generic\n // checkout status (see pollVippsStatus for why) — deliberately\n // ignores vioPayment's value entirely (not just 'success'), since\n // that URL param can't be trusted either way for Vipps.\n //\n // A fresh page load (redirect back from Vipps) never called\n // Vio.checkout.open() this session, so checkoutState is still null —\n // populate it before showing the notice so the overlay has a\n // coherent state to render instead of a blank/broken shell.\n if (!this.checkoutState) {\n const spIdToUse =\n sponsorId || [...Vio.cart.getAllCarts().keys()][0] || 0\n if (spIdToUse) {\n try {\n Vio.checkout.open(spIdToUse)\n Vio.checkout.selectPaymentMethod('vipps')\n } catch {\n /* noop */\n }\n }\n }\n // Whose checkout this is: the return URL's sponsor and checkout — not\n // the page's, and not whichever cart happens to be first here.\n this.setOrderSponsor(sponsorId, checkoutId)\n this.open = true\n this.verifyingReturn = 'Bekrefter betalingen med Vipps…'\n const { outcome, sawStatus } = await this.pollVippsStatus(checkoutId, sponsorId)\n this.verifyingReturn = null\n this.applyReturnOutcome(outcome, sawStatus, vioMethod, sponsorId, checkoutId)\n this.cleanReturnQueryParams(['vio_payment', 'vio_method', 'vio_sponsor', 'checkout_id'])\n } else if (vioPayment === 'success') {\n // The URL is forgeable (and some PSPs reuse one return URL for\n // cancellations) — the BACKEND decides whether this checkout is paid.\n // Webhooks can lag the redirect, so poll a few times before deciding;\n // a genuinely-pending checkout gets a neutral \"processing\" notice, never\n // a fabricated success.\n let outcome: 'paid' | 'failed' | 'pending' | 'duplicate' = 'pending'\n let sawStatus = false\n if (checkoutId) {\n this.setOrderSponsor(sponsorId, checkoutId)\n this.open = true\n this.verifyingReturn = 'Bekrefter betalingen…'\n for (const delayMs of VioCheckout.RETURN_VERIFY_DELAYS_MS) {\n if (delayMs > 0) await new Promise((r) => setTimeout(r, delayMs))\n try {\n const checkout = await Vio.checkout.getCheckout(checkoutId, sponsorId || undefined)\n const status = String(checkout?.status ?? '').toLowerCase()\n sawStatus = true\n if (checkout?.duplicate_of) {\n outcome = 'duplicate'\n break\n }\n if (VioCheckout.FAILED_STATUSES.has(status)) {\n outcome = 'failed'\n break\n }\n if (\n VioCheckout.PAID_STATUSES.has(status) ||\n // A Stripe checkout carries `origin_payment_id` from the\n // moment the link or the intent is CREATED (shopcart), so for\n // Stripe that pointer says nothing about who paid. Only the\n // status does, and it is the webhook that sets it.\n (vioMethod !== 'stripe' && Boolean(checkout?.origin_payment_id))\n ) {\n outcome = 'paid'\n break\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] return verification attempt failed:', err)\n }\n }\n }\n this.verifyingReturn = null\n }\n\n this.applyReturnOutcome(outcome, sawStatus, vioMethod, sponsorId, checkoutId)\n this.cleanReturnQueryParams(['vio_payment', 'vio_method', 'vio_sponsor', 'checkout_id'])\n } else if (vioPayment === 'cancel' || vioPayment === 'error') {\n this.paymentError = 'Betalingen ble avbrutt eller feilet. Vennligst prøv igjen.'\n this.open = true\n this.cleanReturnQueryParams(['vio_payment', 'vio_method', 'vio_sponsor', 'checkout_id'])\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] checkReturnPaymentStatus failed:', err)\n }\n }\n }\n\n /** Remove our payment-return params from the URL without a reload. */\n private cleanReturnQueryParams(keys: string[]): void {\n try {\n if (typeof window === 'undefined' || !window.history || !window.location) return\n const url = new URL(window.location.href)\n let changed = false\n keys.forEach((k) => {\n if (url.searchParams.has(k)) {\n url.searchParams.delete(k)\n changed = true\n }\n })\n if (changed) {\n const newSearch = url.searchParams.toString()\n const newUrl = url.pathname + (newSearch ? '?' + newSearch : '') + url.hash\n window.history.replaceState({}, document.title, newUrl)\n }\n } catch {\n // Ignore URL cleanup failures.\n }\n }\n\n override disconnectedCallback(): void {\n Vio.checkout.removeEventListener('change', this.boundOnCheckoutChange)\n Vio.checkout.removeEventListener('payment-complete', this.boundOnPaymentComplete)\n Vio.checkout.removeEventListener('payment-error', this.boundOnPaymentError)\n Vio.checkout.removeEventListener('qliro-event', this.boundOnQliroEvent)\n this.unmountKlarna()\n this.unmountNexi()\n this.unmountAdyen()\n // A payment event still waiting for its buyer reference goes out now, without it.\n for (const settle of [...this.pendingSuccessEmits]) settle()\n this.bottomSheet.disconnect()\n super.disconnectedCallback()\n }\n\n override updated(changed: Map<string, unknown>): void {\n if (changed.has('open')) {\n this.dialogFocus.update(this.open)\n this.bottomSheet.update(this.open)\n }\n // Opening the overlay: make sure the real shippings are loaded. Gated on\n // items.length — fetching shippings for an empty cart is wasted work and\n // can race the cart's own in-flight mutations.\n if (\n changed.has('open') &&\n this.open &&\n this.items.length > 0 &&\n this.availableShippingsList.length === 0\n ) {\n void this.loadAvailableShippings()\n }\n // The list may have resolved while the overlay was closed, in which case\n // the auto-selection at load time was skipped on purpose.\n if (changed.has('open') && this.open) {\n this.autoSelectSoleMethod()\n }\n // Opening on a cart: the lines and the total are the SERVER's — a line\n // another tab added, a cart another tab paid — before the shopper reads\n // them and pays (CartManager.refreshFromServer; the manager follows the\n // cart and emits, which re-reads `items` and the subtotal here).\n if (changed.has('open') && this.open && this.checkoutState?.sponsorId && !this.orderConfirmed) {\n void Vio.cart.refreshFromServer(this.checkoutState.sponsorId)\n }\n // A sole Klarna or Apple Pay can turn usable after the list resolved (its\n // script loads, the browser answers). One more try, only on that flip —\n // the once-per-opening guard exists to stop a livelock, not this.\n if (\n ((changed.has('klarnaAvailable') && this.klarnaAvailable) ||\n (changed.has('applePayAvailable') && this.applePayAvailable)) &&\n this.paymentMethodsResolved &&\n !this.checkoutState?.paymentMethod\n ) {\n this.autoSelectAttempted = false\n this.autoSelectSoleMethod()\n }\n // A cart that cannot ship takes down whatever payment is already on\n // screen: a widget mounted before the shippings answered must not stay\n // payable, and its load error is superseded by the reason.\n if (changed.has('shippingBlocked') && this.shippingBlocked) {\n this.unmountKlarna()\n this.unmountKustom()\n this.unmountQliro()\n this.unmountWalley()\n this.unmountNexi()\n this.unmountAdyen()\n this.unmountStripe()\n this.paymentError = null\n }\n // A return lands before the bootstrap: ask for it once, so the header\n // and the confirmation name the sponsor when it arrives.\n this.watchSponsorBootstrap()\n // A checkout taken out of the page (a route change, the host re-rendering\n // it) creates no payment sessions. Its own teardown unmounts the widgets,\n // and the update that follows would otherwise mount them again, detached —\n // a new Klarna, Nexi or Adyen session for a checkout nobody can see.\n // Reattached, it mounts them again (connectedCallback asks for an update).\n if (!this.isConnected) return\n // Mount the Klarna Express button once its slot is in the DOM, the\n // express flow is available, and the overlay is open. Re-mount when the\n // amount changes (the payment request is captured at mount time).\n void this.mountKlarnaIfNeeded()\n void this.mountKustomIfNeeded()\n this.syncKustomIfStale()\n void this.mountQliroIfNeeded()\n void this.mountWalleyIfNeeded()\n void this.mountNexiIfNeeded()\n this.dropStaleAdyen()\n void this.mountAdyenIfNeeded()\n this.dropStaleStripe()\n void this.mountStripeIfNeeded()\n }\n\n close(): void {\n this.open = false\n this.express = false\n Vio.checkout.close()\n }\n\n show(): void {\n this.open = true\n if (this.items.length > 0 && this.availableShippingsList.length === 0) {\n void this.loadAvailableShippings()\n }\n }\n\n /**\n * Fetch the real per-supplier shippings and preselect + persist the first.\n *\n * Also decides whether the cart can ship at all (`shippingBlocked`), and\n * records which opening the answer belongs to (`shippingsReadyFor`).\n */\n private async loadAvailableShippings(): Promise<void> {\n const spId = this.checkoutState?.sponsorId\n if (!spId) return\n if (this.items.length === 0) return\n if (this.loadingShippings) return\n const session = this.embedSession()\n this.loadingShippings = true\n this.shippingsAttempted = true\n try {\n const shippings = await Vio.checkout.fetchAvailableShippings(spId)\n // A newer opening owns the list now; its own load answers for it.\n if (session !== this.embedSession()) return\n if (!Array.isArray(shippings) || shippings.length === 0) {\n if (Vio.checkout.lastShippingsResolved) {\n // The backend answered: nothing ships this cart. A failed lookup\n // keeps the list, and blocks nothing.\n this.availableShippingsList = []\n this.shippingBlocked = this.someLineShipsOnItsOwn()\n }\n } else {\n this.shippingBlocked = false\n this.availableShippingsList = shippings\n if (!this.selectedShipping || !shippings.some((s) => s.id === this.selectedShipping)) {\n const firstOpt = shippings[0]!\n this.selectedShipping = firstOpt.id\n if (firstOpt.supplierId) {\n void Vio.checkout.updateShippingsBySupplier(\n [{ shipping_id: firstOpt.id, supplier_id: Number(firstOpt.supplierId) }],\n spId,\n )\n }\n }\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] loadAvailableShippings failed:', err)\n }\n } finally {\n this.loadingShippings = false\n if (session === this.embedSession()) {\n this.shippingsReadyFor = session\n } else if (this.checkoutState && this.items.length > 0) {\n // This answer came too late for its opening, and it held the guard\n // while the new opening asked. Ask again for the one on screen.\n void this.loadAvailableShippings()\n }\n }\n }\n\n /**\n * Whether some product in the cart has shipping rates of its own. With no\n * rate shared by all of them, that means they cannot ship TOGETHER. A cart\n * where no line has rates is left alone: digital products have none, and\n * shopcart refuses the physical case on its side.\n */\n private someLineShipsOnItsOwn(): boolean {\n return this.items.some(\n (i) => Array.isArray(i.availableShippings) && i.availableShippings.length > 0,\n )\n }\n\n /** The shipping country the mobile's calling code defaults to (no +prefix typed). */\n private get phoneCountry(): string {\n return String(this.form.country || getGlobalCountryCode())\n }\n\n /**\n * The mobile is required only for the standard Vipps payment — shopcart\n * does not ask Vipps for the profile there. Every other method takes it\n * when given and never waits for it (a host that pre-fills the form with\n * `setAddress()` and no phone keeps working).\n */\n private get phoneRequired(): boolean {\n return this.checkoutState?.paymentMethod === 'vipps'\n }\n\n /** A number typed that is not usable (nothing said while the field is empty). */\n private get phoneError(): boolean {\n const raw = String(this.form.phone ?? '').trim()\n return raw.length > 0 && !isValidPhone(raw, this.phoneCountry)\n }\n\n /** The mobile as the chosen method needs it: valid when required, else anything. */\n private get phoneReady(): boolean {\n return !this.phoneRequired || isValidPhone(this.form.phone, this.phoneCountry)\n }\n\n /** Whether all mandatory Leveringsadresse fields are filled (the mobile only for Vipps). */\n private get isAddressValid(): boolean {\n const f = this.form\n if (!f) return false\n return Boolean(\n f.firstName && String(f.firstName).trim().length > 0 &&\n f.lastName && String(f.lastName).trim().length > 0 &&\n f.email && String(f.email).trim().length > 0 && String(f.email).includes('@') &&\n f.address && String(f.address).trim().length > 0 &&\n f.postalCode && String(f.postalCode).trim().length > 0 &&\n f.city && String(f.city).trim().length > 0 &&\n this.phoneReady,\n )\n }\n\n /** Whether a valid shipping option is selected (when shippings exist). */\n private get hasSelectedShipping(): boolean {\n if (this.availableShippingsList.length === 0) return true\n return Boolean(\n this.selectedShipping && this.shippingList.some((s) => s.id === this.selectedShipping),\n )\n }\n\n /** Which payment buttons to render — backend-configured per sponsor. */\n private async loadAvailablePaymentMethods(): Promise<void> {\n if (!this.checkoutState) return\n if (this.loadingPaymentMethods) return\n this.loadingPaymentMethods = true\n try {\n const spId = this.checkoutState.sponsorId\n const methods = (await Vio.checkout.getAvailablePaymentMethods(\n spId,\n )) as Array<{ name: string }> | unknown\n if (Array.isArray(methods)) {\n this.availableMethods = methods.map((m) => m.name)\n // Which Stripe: the flow travels in the method's own config, and the\n // list is memoised, so this costs nothing extra. (Vipps here is always\n // the standard payment — see startVippsFromCheckout — whatever the\n // brand's Express switch says.)\n this.stripeMode = await Vio.checkout.getStripeMode(spId)\n } else {\n this.availableMethods = null\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Failed to load payment methods:', err)\n }\n // Unknown (not \"none\") — render everything rather than an empty grid.\n this.availableMethods = null\n } finally {\n this.loadingPaymentMethods = false\n this.paymentMethodsResolved = true\n this.autoSelectSoleMethod()\n }\n }\n\n /**\n * With exactly one payment method there is no choice to make, so making the\n * shopper click it is a step that can only have one outcome. Select it —\n * and since the checkout asks for the method first (2026-09-22), this is\n * what skips that step: the form, or the provider's widget, comes straight\n * up.\n *\n * Deliberately narrow:\n * - never overrides a method the shopper already picked;\n * - only for methods usable RIGHT NOW — Apple Pay and Klarna depend on the\n * browser and on their script loading, and auto-selecting an unusable one\n * would strand the shopper on a panel that cannot pay (see `updated`: a\n * late \"available\" gets one more try);\n * - selecting never pays: Stripe and Vipps still wait for their own button.\n */\n private autoSelectSoleMethod(): void {\n if (!this.open) return\n // Nothing to decide before the list is in, and returning here must not\n // use up the one attempt: on a first opening the list answers AFTER the\n // overlay opens, and the attempt spent by the opening left a sole method\n // unselected for good (found writing the method-first tests, 2026-09-22).\n if (!this.paymentMethodsResolved) return\n // ONCE per opening, whatever the outcome. `selectPaymentMethod` is a\n // request, not a guarantee: if it does not stick, the resulting state\n // change reloads the method list, which calls this again, selects again,\n // and spins — remounting the provider's widget on every pass. Observed\n // hammering Qliro's orders endpoint with hundreds of requests. A\n // convenience must never be able to livelock the checkout.\n if (this.autoSelectAttempted) return\n this.autoSelectAttempted = true\n if (this.checkoutState?.paymentMethod) return\n const methods = this.offeredMethods()\n if (!Array.isArray(methods) || methods.length !== 1) return\n const id = String(methods[0] ?? '').toLowerCase().replace(/[^a-z]/g, '')\n const usable: Record<string, PaymentMethod | undefined> = {\n kustom: 'kustom',\n qliro: 'qliro',\n walley: 'walley',\n nexi: 'nexi',\n // Selected, not mounted: Adyen waits for the form (see adyenRequested).\n adyen: 'adyen',\n vipps: 'vipps',\n stripe: 'stripe',\n klarna: this.klarnaAvailable ? 'klarna' : undefined,\n applepay: this.applePayAvailable ? 'apple-pay' : undefined,\n }\n const only = usable[id]\n if (!only) return\n Vio.checkout.selectPaymentMethod(only)\n }\n\n /** Backend names arrive as e.g. \"Apple Pay\" — compare letters only. */\n private methodEnabled(...names: string[]): boolean {\n return isMethodEnabled(this.availableMethods, ...names)\n }\n\n /**\n * Stripe's Payment Element shows the wallets of the account that charges —\n * Apple Pay and Google Pay among them. Offering our own Apple Pay button\n * next to it is the same wallet twice, on the same screen, paying through\n * the same account: when Stripe pays on our page, Stripe owns the wallets\n * (Angelo, 2026-09-24). The cart's express button is another surface and\n * keeps its own Apple Pay — the Element does not exist there.\n */\n private stripeOwnsWallets(): boolean {\n return this.stripeMode === 'native' && this.methodEnabled('stripe')\n }\n\n /** The methods the shopper actually sees (see stripeOwnsWallets). */\n private offeredMethods(): string[] | null {\n const methods = this.availableMethods\n if (!Array.isArray(methods) || !this.stripeOwnsWallets()) return methods\n return methods.filter((m) => !isMethodEnabled([m], 'apple-pay'))\n }\n\n private async refreshApplePay(): Promise<void> {\n Vio.checkout.clearApplePayCache()\n this.applePayAvailable = await Vio.checkout.isApplePayAvailable('NO')\n }\n\n private async refreshKlarna(): Promise<void> {\n // Klarna Payments (classic widget) is available if its lib can load — it\n // uses a server-minted client_token, no public clientId / origin handshake.\n const available = await Vio.checkout.klarnaPaymentsAvailable()\n if (available !== this.klarnaAvailable) {\n if (!available) this.unmountKlarna()\n this.klarnaAvailable = available\n }\n }\n\n /** Mount (or re-mount on amount change) the Klarna Payments widget. */\n private async mountKlarnaIfNeeded(): Promise<void> {\n if (!this.klarnaAvailable || !this.open || !this.checkoutState) return\n // Only mount once Klarna is the chosen method — creating a session is a\n // backend call, so don't fire it until the user picks Klarna (or we're in\n // express mode, which is Klarna-only).\n if (this.checkoutState.paymentMethod !== 'klarna' && !this.express) return\n // Method first: Klarna can now be chosen before the form is filled. Its\n // session is still created only once the form is complete, as before.\n if (!this.express && (!this.isAddressValid || !this.hasSelectedShipping)) return\n if (this.klarnaMounting) return\n // Make sure the real shippings are in before mounting — Klarna's total\n // needs to reflect them, not the (removed) static fallback.\n if (this.items.length > 0 && this.availableShippingsList.length === 0 && !this.shippingsAttempted) {\n await this.loadAvailableShippings()\n }\n if (this.shippingBlocked) return\n const amount = this.checkoutState.subtotal\n // Re-mount when the amount OR the chosen shipping changes (a new shipping\n // option means a new session/total — Klarna's widget can't be updated live).\n if (\n this.klarnaHandle &&\n this.klarnaMountedAmount === amount &&\n this.klarnaMountedShipping === this.selectedShipping\n ) {\n return\n }\n const container = this.renderRoot?.querySelector(\n '#vio-klarna-payments-container',\n ) as HTMLElement | null\n if (!container) return\n\n this.klarnaMounting = true\n this.unmountKlarna()\n container.innerHTML = ''\n try {\n const handle = await Vio.checkout.mountKlarnaPayments(container, {\n withShipping: this.express,\n shippingId: this.selectedShipping,\n })\n this.klarnaHandle = handle\n this.klarnaMountedAmount = amount\n this.klarnaMountedShipping = this.selectedShipping\n this.klarnaCategories = handle.categories\n this.klarnaSelectedCat = handle.selected\n // Adopt the backend shippings the mount resolved; keep the selection valid.\n if (Array.isArray(handle.shippings) && handle.shippings.length > 0) {\n this.availableShippingsList = handle.shippings\n if (\n !this.selectedShipping ||\n !handle.shippings.some((s) => s.id === this.selectedShipping)\n ) {\n this.selectedShipping = handle.shippings[0]!.id\n }\n }\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Klarna Payments mount failed:', err)\n }\n this.paymentError = friendlyPaymentError(errorText(err), 'klarna')\n } finally {\n this.klarnaMounting = false\n }\n }\n\n private unmountKlarna(): void {\n if (this.klarnaHandle) {\n this.klarnaHandle.unmount()\n this.klarnaHandle = null\n }\n this.klarnaMountedAmount = null\n this.klarnaMountedShipping = null\n // A fresh [] is a change to Lit even when the list is already empty: every\n // mount attempt would schedule another update, and a mount that fails\n // fast would retry forever.\n if (this.klarnaCategories.length > 0) this.klarnaCategories = []\n this.klarnaSelectedCat = ''\n this.klarnaAuthorizing = false\n }\n\n /** Shippings in effect: backend per-supplier when loaded. */\n private get shippingList(): KlarnaShippingOption[] {\n return this.availableShippingsList\n }\n\n /** Selected shipping option (express flow). */\n private get shippingOption() {\n const list = this.shippingList\n return list.find((o) => o.id === this.selectedShipping) ?? list[0] ?? null\n }\n\n /** Pick a shipping option → re-mounts the Klarna widget with the new total.\n * Also persists the choice on the backend cart (per supplier). */\n private async onSelectShipping(id: string): Promise<void> {\n if (this.selectedShipping === id || this.klarnaMounting) return\n this.selectedShipping = id\n const selectedOpt = this.shippingList.find((s) => s.id === id)\n if (selectedOpt?.supplierId) {\n try {\n await Vio.checkout.updateShippingsBySupplier(\n [{ shipping_id: selectedOpt.id, supplier_id: Number(selectedOpt.supplierId) }],\n this.checkoutState?.sponsorId,\n )\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] updateShippingsBySupplier failed:', err)\n }\n }\n }\n }\n\n /** Switch the Klarna widget to a different payment_method_category. */\n private async onKlarnaCategory(identifier: string): Promise<void> {\n if (!this.klarnaHandle) return\n this.klarnaSelectedCat = identifier\n if (typeof console !== 'undefined') {\n console.log('[VioCheckout] User selected payment_method_category:', identifier)\n }\n try {\n await this.klarnaHandle.load(identifier)\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Klarna category switch failed:', err)\n }\n }\n }\n\n /** Authorize the selected Klarna method → backend creates the order. */\n private async onKlarnaAuthorize(): Promise<void> {\n if (!this.klarnaHandle || this.klarnaAuthorizing || this.shippingBlocked) return\n this.paymentError = null\n this.paymentNotice = null\n this.klarnaAuthorizing = true\n const cat = this.klarnaSelectedCat || this.klarnaHandle.selected || 'pay_now'\n if (typeof console !== 'undefined') {\n console.log('[VioCheckout] Authorizing Klarna with payment_method_category:', cat)\n }\n try {\n // Resolves once the order is created (payment-complete) or surfaces a\n // payment-error event handled by boundOnPaymentError.\n await this.klarnaHandle.authorize(cat)\n } finally {\n this.klarnaAuthorizing = false\n }\n }\n\n private onFieldChange<K extends keyof CheckoutAddress>(field: K, value: string): void {\n this.form = { ...this.form, [field]: value }\n Vio.checkout.setAddress(this.form)\n }\n\n /** After choosing a method that needs our form, bring the form into view. */\n private revealAddressForm(): void {\n void this.updateComplete.then(() => {\n const form = this.renderRoot?.querySelector<HTMLElement>('.address-section')\n if (!form) return\n // The topbar is sticky inside the scrolling modal: aligned to the top,\n // the form's \"Steg 1 · Leveringsadresse\" heading would land under it.\n const bar = this.renderRoot?.querySelector<HTMLElement>('.topbar')\n form.style.scrollMarginTop = `${(bar?.offsetHeight ?? 0) + 8}px`\n form.scrollIntoView?.({ behavior: 'smooth', block: 'start' })\n })\n }\n\n /**\n * Vipps from the checkout: the STANDARD payment, always (Mote & Livsstil,\n * 2026-10-28). The shopper filled our form — name, address, mobile — and\n * chose the delivery with its price here; the payment carries that address\n * and the rate on the cart, and Vipps only approves and pays. Express (the\n * app filling in name and address) is the product detail's «Kjøp nå med\n * Vipps» alone, even when the brand has Express on.\n */\n private async startVippsFromCheckout(): Promise<void> {\n const sponsorId = this.checkoutState?.sponsorId\n await Vio.checkout.startVippsPayment(sponsorId, this.form, { express: false })\n }\n\n /**\n * The chosen delivery on the cart before a hosted payment is minted (its\n * total depends on it). False — and the payment must not start — when it\n * could not be saved: the selected rate has no supplier to save it under,\n * or the backend refused. A cart with no rates at all has nothing to save.\n */\n private async persistSelectedShipping(method: string): Promise<boolean> {\n if (this.availableShippingsList.length === 0) return true\n const selectedOpt = this.shippingList.find((s) => s.id === this.selectedShipping)\n if (!selectedOpt?.supplierId) {\n if (typeof console !== 'undefined') {\n console.warn(`[VioCheckout] no supplier for the selected shipping — ${method} not started`)\n }\n return false\n }\n try {\n const updated = await Vio.checkout.updateShippingsBySupplier(\n [{ shipping_id: selectedOpt.id, supplier_id: Number(selectedOpt.supplierId) }],\n this.checkoutState?.sponsorId,\n )\n return updated != null\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn(`[VioCheckout] updateShippingsBySupplier on ${method} pay failed:`, err)\n }\n return false\n }\n }\n\n private async onApplePay(): Promise<void> {\n if (this.applePayInProgress) return\n this.applePayInProgress = true\n try {\n // On authorize, startApplePay dispatches `payment-complete` →\n // boundOnPaymentComplete → confirmOrder shows the confirmation drawer\n // (and emits vio:payment-success). No manual close/emit here.\n await Vio.checkout.startApplePay({ country: 'NO', label: 'Vio' })\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Apple Pay flow ended:', err)\n }\n } finally {\n this.applePayInProgress = false\n }\n }\n\n private async onPay(method: PaymentMethod): Promise<void> {\n // The payment step already says why nothing can be paid.\n if (this.shippingBlocked) return\n this.paymentError = null\n this.paymentNotice = null\n // Never a payment for an empty cart or one of 0 kr (another tab may have\n // paid or emptied it while this one was open).\n if (!this.cartPayable) {\n this.paymentError = EMPTY_CART_MESSAGE\n return\n }\n // Apple Pay collects address, shipping AND email inside its own sheet —\n // skip the manual form validation entirely.\n if (method === 'apple-pay') {\n void this.onApplePay()\n return\n }\n // Kustom's embedded checkout collects address, shipping, email AND\n // payment — nothing to validate before mounting it.\n if (method === 'kustom') {\n Vio.checkout.selectPaymentMethod('kustom')\n return\n }\n // Qliro: same widget-does-everything category as Kustom.\n if (method === 'qliro') {\n Vio.checkout.selectPaymentMethod('qliro')\n return\n }\n // Walley: same widget-does-everything category as Kustom/Qliro.\n if (method === 'walley') {\n Vio.checkout.selectPaymentMethod('walley')\n return\n }\n // Nexi: same widget-does-everything category.\n if (method === 'nexi') {\n Vio.checkout.selectPaymentMethod('nexi')\n return\n }\n // Every method that pays after our form needs it complete — Vipps too\n // (2026-10-28: the checkout's Vipps is the standard payment, it carries\n // our address and delivery; Express lives on the product detail).\n {\n // The mobile counts for the method being paid with (Vipps), even before\n // the state says it is the selected one.\n const phoneMissing = method === 'vipps' && !isValidPhone(this.form.phone, this.phoneCountry)\n const missing = !this.isAddressValid || phoneMissing\n ? 'Vennligst fyll ut alle feltene i leveringsadresse.'\n : !this.hasSelectedShipping\n ? 'Vennligst velg en fraktmetode.'\n : null\n if (missing) {\n // Method first (Angelo, 2026-09-22): our delivery form appears only\n // once a method that needs it is chosen, so choosing the method IS\n // the way to the form. Refusing before selecting would leave the\n // shopper with an error and no form — the Vipps dead end again.\n if (this.checkoutState?.paymentMethod !== method) {\n Vio.checkout.selectPaymentMethod(method)\n this.revealAddressForm()\n return\n }\n this.paymentError = missing\n return\n }\n }\n Vio.checkout.selectPaymentMethod(method)\n // Adyen: the form and the shipping are valid (checked above), and choosing\n // the method is asking for the payment step — mountAdyenIfNeeded takes over.\n if (method === 'adyen') {\n this.adyenRequested = true\n return\n }\n // Stripe / Vipps: hosted payment pages — mint the link and redirect. The\n // return trip lands in checkReturnPaymentStatus().\n if (method === 'stripe') {\n // …unless this channel offers the native flow, where the shopper pays\n // here (Angelo, 2026-09-24). Asking is what mints the PaymentIntent:\n // mountStripeIfNeeded takes over, exactly as Adyen does.\n if (this.stripeMode === null) {\n this.stripeMode = await Vio.checkout.getStripeMode(this.checkoutState?.sponsorId)\n }\n if (this.stripeMode === 'native') {\n this.stripeRequested = true\n return\n }\n // Persist the chosen shipping before the link is minted (total depends\n // on it); a delivery that could not be saved starts no payment.\n this.stripeLoading = true\n if (!(await this.persistSelectedShipping('stripe'))) {\n this.stripeLoading = false\n this.paymentError = SHIPPING_NOT_SAVED_MESSAGE\n return\n }\n void Vio.checkout\n .startStripePayment(this.checkoutState?.sponsorId, this.form)\n .catch((err: unknown) => {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Stripe payment could not start:', err)\n }\n this.paymentError = friendlyPaymentError(errorText(err), 'stripe')\n })\n .finally(() => {\n this.stripeLoading = false\n })\n }\n if (method === 'vipps') {\n this.vippsLoading = true\n // The delivery Vipps will charge for is the one saved on the cart: not\n // saved, no payment.\n if (!(await this.persistSelectedShipping('vipps'))) {\n this.vippsLoading = false\n this.paymentError = SHIPPING_NOT_SAVED_MESSAGE\n return\n }\n const redirect = beginPaymentRedirect({ method: 'vipps', sponsorId: this.checkoutState?.sponsorId, source: 'checkout' })\n void this.startVippsFromCheckout()\n .catch((err: unknown) => {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Vipps payment could not start:', err)\n }\n redirect.fail(errorText(err))\n this.paymentError = friendlyPaymentError(errorText(err), 'vipps')\n })\n .finally(() => {\n this.vippsLoading = false\n })\n }\n }\n\n /**\n * Complete the order for the selected method. Apple Pay and Klarna Express\n * finish inside their own sheet/popup; Stripe and Vipps redirect to their\n * hosted pages (via onPay). Anything else confirms state-only.\n */\n private onCompleteOrder(): void {\n const s = this.checkoutState\n if (!s || !s.paymentMethod) return\n if (this.shippingBlocked) return\n if (!this.cartPayable) {\n this.paymentError = EMPTY_CART_MESSAGE\n return\n }\n if (!this.isAddressValid) {\n this.paymentError = 'Vennligst fyll ut alle feltene i leveringsadresse.'\n return\n }\n if (s.paymentMethod === 'stripe' || s.paymentMethod === 'vipps') {\n void this.onPay(s.paymentMethod)\n return\n }\n // Only methods with a real payment flow may confirm. 'card' has no PSP\n // wired — confirming would show success without charging.\n if (s.paymentMethod !== 'klarna' && s.paymentMethod !== 'apple-pay') {\n this.paymentError = 'Betalingsmetoden er ikke tilgjengelig ennå.'\n return\n }\n this.confirmOrder(s.paymentMethod, s.sponsorId)\n }\n\n /**\n * Shared order confirmation — reached from both the plain \"Betal\" CTA\n * (Vipps/Card/Klarna) and the Klarna Express authorize callback. Shows\n * the confirmation screen, emits `vio:payment-success`, and clears the\n * paid sponsor's cart so the badge + drawer reflect the purchase.\n */\n private confirmOrder(\n method: PaymentMethod,\n sponsorId: number,\n result?: unknown,\n returnCheckoutId?: string,\n ): void {\n // Snapshot the order BEFORE clearing the cart — the confirmation needs it.\n const r = (result ?? {}) as { order?: { orderId?: string }; chargedTotal?: number }\n const shippingPrice = this.shippingMajor()\n const email = String(this.form.email ?? '').trim()\n // Before the cart is cleared: the checkout id goes with it. Back from a\n // redirect the state was re-opened without one, so the return URL's id\n // is passed in explicitly.\n const checkoutId = returnCheckoutId || this.checkoutState?.checkoutId\n // An id a provider hands back is ITS order (Qliro's, say), not Vio's: it\n // is the provider's reference, under the provider's name.\n const providerOrderId = r.order?.orderId != null ? String(r.order.orderId) : ''\n // Who the order is with, named before the cart is cleared.\n this.setOrderSponsor(sponsorId, checkoutId)\n this.confirmedOrder = {\n items: [...this.items],\n currency: this.checkoutState?.currency ?? '',\n total:\n typeof r.chargedTotal === 'number' ? r.chargedTotal : (this.checkoutState?.subtotal ?? 0),\n ...(providerOrderId\n ? { providerRef: { label: `Ordre hos ${this.methodLabel(method)}`, value: providerOrderId } }\n : {}),\n ...(shippingPrice > 0\n ? { shipping: { name: this.summaryShippingName() || 'Frakt', price: shippingPrice } }\n : {}),\n ...(email ? { email } : {}),\n }\n this.confirmedMethod = method\n this.orderConfirmed = true\n // A redirect completion lands with the overlay closed — open it so the\n // confirmation screen is visible.\n this.open = true\n void this.fillOrderNumber(checkoutId, sponsorId)\n // `checkoutId` is Vio's own reference for the purchase — what the\n // redirect path already sends as `orderId`; analytics falls back to it\n // when the provider's result carries no order id. The cart is cleared\n // after the event, as always (analytics reads it from the event).\n void this.emitPaymentSuccess(\n { method, sponsorId, result: result as PaymentSuccessResult | null | undefined, checkoutId },\n checkoutId,\n sponsorId,\n () => Vio.cart.clearSponsorCart(sponsorId),\n )\n }\n\n /** Longest `vio:payment-success` waits for the checkout's buyer reference, and when it asks a second time. */\n private static readonly BUYER_REF_WAIT_MS = 2_500\n private static readonly BUYER_REF_RETRY_AT_MS = 1_200\n\n /** Payment events still waiting for their buyer reference: settled early (without it) when the page hides or the element leaves. */\n private readonly pendingSuccessEmits = new Set<() => void>()\n\n /**\n * `vio:payment-success` for the host and analytics — with the buyer\n * reference (`buyerRef`: shopcart's keyed hash of the email → analytics\n * `buyer_id`) when the checkout can say it. An emitter whose own answer\n * carried it (Apple Pay, Klarna native) sends at once; the others (a\n * redirect return, Stripe / Adyen / Nexi in the drawer, a provider's\n * receipt) ask the checkout — at once and, while it has neither order nor\n * reference, again at 1.2 s, since a webhook may write the checkout a\n * moment after the redirect — within 2.5 s, and\n * send without it when the answer is late or empty. Nothing is asked when\n * it cannot help (the gateway has no `buyer_ref` yet; a confirmation that\n * already answered). Only the event waits — the screen is already the\n * confirmation — and not past the page: when the page hides (`pagehide`,\n * `visibilitychange`) or the element leaves, the event goes out at once\n * without the reference. Exactly one event per call. `afterwards` runs\n * right after the event, so a path keeps the order it always had (the cart\n * is cleared after the event). When that answer already has Vio's order\n * number, the event carries it too (`orderNumber`): it is the purchase's\n * `order_id`, and analytics need not ask again.\n */\n private async emitPaymentSuccess(\n detail: PaymentSuccessDetail,\n checkoutId: string | undefined,\n sponsorId: number,\n afterwards?: () => void,\n ): Promise<void> {\n let done = false\n // The order's sponsor as named now (the cart may be cleared by the time\n // the event goes out), and again when it does (the bootstrap may land).\n const sponsorAtStart = this.sponsorOfOrder(sponsorId, checkoutId)\n const finish = (found: { buyerRef?: string; orderNumber?: number } = {}) => {\n if (done) return\n done = true\n const named = this.sponsorOfOrder(sponsorId, checkoutId)\n const sponsor = named.sponsor ? named : sponsorAtStart\n const withSponsor: PaymentSuccessDetail = sponsor.sponsor ? { ...detail, ...sponsor } : detail\n const event = new CustomEvent('vio:payment-success', {\n bubbles: true,\n composed: true,\n detail:\n found.buyerRef || found.orderNumber\n ? {\n ...withSponsor,\n ...(found.buyerRef ? { buyerRef: found.buyerRef } : {}),\n ...(found.orderNumber ? { orderNumber: found.orderNumber } : {}),\n }\n : withSponsor,\n })\n this.dispatchEvent(event)\n // Detached while waiting (the host removed the drawer): the event cannot\n // bubble up to the window, where analytics listens — hand it over there.\n if (!this.isConnected && typeof window !== 'undefined') {\n window.dispatchEvent(new CustomEvent('vio:payment-success', { detail: event.detail }))\n }\n try {\n afterwards?.()\n } catch {\n /* never break the confirmation */\n }\n }\n const known = buyerRefOf(detail)\n if (known || !checkoutId || !this.shouldAskBuyerRef(detail)) {\n finish({ buyerRef: known })\n return\n }\n const settleEarly = () => finish()\n const onVisibility = () => {\n if (typeof document !== 'undefined' && document.visibilityState === 'hidden') settleEarly()\n }\n this.pendingSuccessEmits.add(settleEarly)\n window.addEventListener('pagehide', settleEarly)\n document.addEventListener('visibilitychange', onVisibility)\n try {\n finish(await this.askBuyerRef(checkoutId, sponsorId, () => done))\n } catch {\n finish()\n } finally {\n this.pendingSuccessEmits.delete(settleEarly)\n window.removeEventListener('pagehide', settleEarly)\n document.removeEventListener('visibilitychange', onVisibility)\n }\n }\n\n /** Whether asking the checkout for the buyer reference can still help. */\n private shouldAskBuyerRef(detail: PaymentSuccessDetail): boolean {\n if (typeof Vio.checkout.getOrderReference !== 'function') return false\n // The gateway refused `buyer_ref` on this page load: asking cannot answer it.\n if (!gatewayHasBuyerRef()) return false\n // Apple Pay and Klarna native confirmations select `buyer_ref` themselves: what they did not bring, nobody has.\n if ((detail.method === 'apple-pay' || detail.method === 'klarna') && detail.result) return false\n return true\n }\n\n /**\n * The buyer reference of a checkout: asked at once and, when that answer\n * failed or has neither the reference nor an order yet (the webhook has not\n * written the checkout), again at 1.2 s — all within 2.5 s. An order\n * without a reference is a settled answer: the backend has none, asking\n * again cannot help. Whatever the answer said of the order number comes\n * back with it. `{}` when the time is up, when the answer stopped mattering\n * (`stopped()`) or on failure.\n */\n private async askBuyerRef(\n checkoutId: string,\n sponsorId: number,\n stopped: () => boolean,\n ): Promise<{ buyerRef?: string; orderNumber?: number }> {\n const started = Date.now()\n const remaining = () => VioCheckout.BUYER_REF_WAIT_MS - (Date.now() - started)\n let deadline: ReturnType<typeof setTimeout> | undefined\n const timeUp = new Promise<null>((resolve) => {\n deadline = setTimeout(() => resolve(null), VioCheckout.BUYER_REF_WAIT_MS)\n })\n try {\n for (const at of [0, VioCheckout.BUYER_REF_RETRY_AT_MS]) {\n const wait = Math.min(at - (Date.now() - started), remaining())\n if (wait > 0) await Promise.race([new Promise((resolve) => setTimeout(resolve, wait)), timeUp])\n if (stopped() || remaining() <= 0) return {}\n try {\n const reference = await Promise.race([\n Vio.checkout.getOrderReference(checkoutId, sponsorId || undefined),\n timeUp,\n ])\n if (reference === null) return {} // time is up\n const order = reference.orderNumber ? { orderNumber: reference.orderNumber } : {}\n if (reference.buyerRef) return { buyerRef: reference.buyerRef, ...order }\n if (reference.orderNumber !== null) return order // settled without one\n } catch {\n /* ask again, or give up */\n }\n }\n return {}\n } finally {\n clearTimeout(deadline)\n }\n }\n\n /** Waits between asks for the Vio order number: the order is often born a\n * moment after the payment (Vipps and Stripe through their webhook). */\n private static readonly ORDER_NUMBER_DELAYS_MS = [0, 1500, 3000, 5000, 8000]\n\n /**\n * Puts the Vio order number (#4497) on the confirmation once the order\n * exists. Until then the line is simply not there — never the checkout's\n * uuid in its place, which is what it used to print. Stops if the shopper\n * closes the drawer or another confirmation takes its place.\n */\n private async fillOrderNumber(checkoutId: string | undefined, sponsorId: number): Promise<void> {\n this.confirmedCheckoutId = checkoutId || null\n if (!checkoutId) return\n const stillShowing = () => this.orderConfirmed && this.confirmedCheckoutId === checkoutId\n for (const delayMs of VioCheckout.ORDER_NUMBER_DELAYS_MS) {\n if (delayMs > 0) await new Promise((r) => setTimeout(r, delayMs))\n if (!stillShowing()) return\n const n = await Vio.checkout.getOrderNumber(checkoutId, sponsorId || undefined)\n if (!stillShowing()) return\n if (n && this.confirmedOrder) {\n this.confirmedOrder = { ...this.confirmedOrder, orderId: String(n) }\n return\n }\n }\n }\n\n private methodLabel(method: PaymentMethod | null): string {\n switch (method) {\n case 'apple-pay':\n return 'Apple Pay'\n case 'klarna':\n return 'Klarna'\n case 'kustom':\n return 'Kustom'\n case 'qliro':\n return 'Qliro'\n case 'walley':\n return 'Walley'\n case 'nexi':\n return 'Nexi'\n // Adyen is not a name shoppers know; what they pick from is inside it.\n case 'adyen':\n return 'Kort, Vipps og flere'\n case 'vipps':\n return 'Vipps'\n case 'stripe':\n return 'Stripe'\n case 'card':\n return 'Kort'\n default:\n return ''\n }\n }\n\n /** True for methods that complete via a separate sheet/widget, not the CTA. */\n private isExpressMethod(method: PaymentMethod | undefined): boolean {\n // Apple Pay finishes in its sheet; Klarna finishes via its widget's\n // authorize() button; Kustom's embedded checkout has its own buy button —\n // none of them uses the generic \"Betal\" CTA.\n return (\n method === 'apple-pay' ||\n method === 'klarna' ||\n isEmbeddedMethod(method ?? '') ||\n // Adyen's Drop-in brings its own Pay button.\n isFormFirstWidgetMethod(method ?? '')\n )\n }\n\n /**\n * A total above 0 — every pay button needs it. The state's subtotal follows\n * the cart (CheckoutManager.onCartChange): a cart emptied or paid in\n * another tab drops it to 0 here.\n */\n private get cartPayable(): boolean {\n return (this.checkoutState?.subtotal ?? 0) > 0\n }\n\n private orderTotal(): string {\n const s = this.checkoutState\n if (!s) return ''\n return formatPrice(s.subtotal, s.currency)\n }\n\n /** Shipping cost (major units) whenever a shipping option is in effect —\n * express always has one; the normal flow has one once the backend\n * shippings loaded (the choice IS persisted on the cart and charged). */\n private shippingMajor(): number {\n if (this.checkoutState?.paymentMethod === 'qliro' && typeof this.qliroShipping?.price === 'number') {\n return this.qliroShipping.price\n }\n if (this.checkoutState?.paymentMethod === 'nexi' && typeof this.nexiShipping?.shipping_price === 'number') {\n return this.nexiShipping.shipping_price\n }\n if (this.checkoutState?.paymentMethod === 'kustom' && typeof this.kustomShipping?.price === 'number') {\n return this.kustomShipping.price\n }\n if (!this.express && this.availableShippingsList.length === 0) return 0\n const o = this.shippingOption\n if (!o) return 0\n return o.priceMajor ?? o.price / 100\n }\n\n /** The rate the summary names — Qliro's own pick while Qliro is the method. */\n private summaryShippingName(): string {\n if (this.checkoutState?.paymentMethod === 'qliro' && this.qliroShipping) {\n const ref = this.qliroShipping.ref\n const picked = ref ? this.availableShippingsList.find((o) => o.id === ref) : undefined\n // A price with no rate we recognise: show the price, never another name.\n return picked ? picked.method || picked.name || '' : ''\n }\n if (this.checkoutState?.paymentMethod === 'nexi' && this.nexiShipping) {\n return this.nexiShipping.shipping_name ?? ''\n }\n const o = this.shippingOption\n return o ? o.method || o.name || '' : ''\n }\n\n /** Total to charge — items + shipping (express). */\n private payTotalLabel(): string {\n const s = this.checkoutState\n if (!s) return ''\n return formatPrice(s.subtotal + this.shippingMajor(), s.currency)\n }\n\n override render() {\n return html`\n <div class=\"backdrop\" @click=${this.close}></div>\n <div\n class=\"modal ${this.express ? 'as-side' : this.orderConfirmed ? 'as-confirm' : ''}\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=${this.heading}\n tabindex=\"-1\"\n >\n <div class=\"handle\" @click=${this.close} aria-hidden=\"true\"></div>\n <div class=\"topbar\">\n <div class=\"topbar-title\">\n <h2 class=\"heading\">${this.orderConfirmed ? 'Takk!' : this.heading}</h2>\n ${this.renderTopbarSponsor()}\n </div>\n <button class=\"close\" @click=${this.close} aria-label=\"Lukk\">×</button>\n </div>\n\n <div class=\"body\">\n ${this.providerReceipt\n ? this.renderProviderReceipt()\n : this.orderConfirmed\n ? this.renderConfirmation()\n : this.verifyingReturn\n ? this.renderVerifying()\n : this.express\n ? this.renderKlarnaExpress()\n : this.renderCheckoutBody()}\n </div>\n </div>\n `\n }\n\n /**\n * Remember whose order this is and how it is named right now, before the\n * cart that names it is cleared. Whose: the sponsor this tab remembered for\n * the checkout when it was created (exact for that checkout id), else the\n * one given (the return URL's `vio_sponsor`, the state it was paid in),\n * else the open state's — a return without `vio_sponsor` (Qliro, Walley)\n * re-opens the state with whichever cart comes first, which is a guess.\n */\n private setOrderSponsor(sponsorId: number | undefined, checkoutId: string | undefined): void {\n try {\n const checkout = checkoutId || undefined\n const id =\n rememberedCheckoutSponsor(checkout)?.sponsorId ??\n (sponsorId && sponsorId > 0 ? sponsorId : undefined) ??\n this.checkoutState?.sponsorId\n if (!id) return\n const named = checkoutSponsorOf(resolveSponsorIdentity(id, checkout))\n const previous = this.orderSponsor\n const snapshot = named ?? (previous && previous.sponsorId === id ? previous.snapshot : undefined)\n this.orderSponsor = { sponsorId: id, ...(checkout ? { checkoutId: checkout } : {}), ...(snapshot ? { snapshot } : {}) }\n } catch {\n /* naming the sponsor never costs a confirmation */\n }\n }\n\n /**\n * Who this checkout is with, as a shopper sees it: the order being\n * confirmed / verified (`orderSponsor`), else the open checkout's own\n * sponsor (`checkoutState.sponsorId`) — named by `Vio.sponsorIdentity`,\n * which falls back to this tab's memory of the checkout and the cart; the\n * name taken before the cart was cleared last. Never the page's\n * attribution. `null` when nothing names it.\n */\n private checkoutSponsorIdentity(): CheckoutSponsor | null {\n const o = this.orderSponsor\n if (o) return checkoutSponsorOf(resolveSponsorIdentity(o.sponsorId, o.checkoutId)) ?? o.snapshot ?? null\n const s = this.checkoutState\n return s?.sponsorId ? (checkoutSponsorOf(resolveSponsorIdentity(s.sponsorId, s.checkoutId)) ?? null) : null\n }\n\n /**\n * `{ sponsor }` for the payment event — the same sponsor the screen names\n * (`orderSponsor`, set by every path right before it emits): named now, else\n * as named before the cart was cleared; `{}` when nothing names it.\n */\n private sponsorOfOrder(sponsorId: number, checkoutId: string | undefined): { sponsor?: CheckoutSponsor } {\n try {\n const o = this.orderSponsor\n const sameOrder = !!o && (o.checkoutId ?? undefined) === (checkoutId || undefined)\n const id = sameOrder ? o!.sponsorId : sponsorId > 0 ? sponsorId : undefined\n const live = sponsorDetail(id, checkoutId)\n if (live.sponsor) return live\n if (sameOrder && o!.snapshot) return { sponsor: o!.snapshot }\n } catch {\n /* the event goes out without it */\n }\n return {}\n }\n\n /**\n * Ask once per checkout for the bootstrap when it is not there yet and a\n * sponsor has to be named (a redirect return renders before it), then\n * render again — the name and the logo appear when it lands.\n */\n private watchSponsorBootstrap(): void {\n if (this.sponsorBootstrapAsked || !this.open || Vio.bootstrapCache) return\n if (!this.orderSponsor && !this.checkoutState?.sponsorId) return\n this.sponsorBootstrapAsked = true\n void whenBootstrapped().then(() => this.requestUpdate())\n }\n\n /**\n * The checkout's sponsor in the header — «Du handler hos <logo|name>»\n * («Du har handlet hos» on a provider's receipt). Not on our own\n * confirmation, which says it in its body.\n */\n private renderTopbarSponsor() {\n if (this.orderConfirmed) return nothing\n const sponsor = this.checkoutSponsorIdentity()\n const mark = renderSponsorMark(this, sponsor, { logo: 'topbar-sponsor-logo', name: 'topbar-sponsor-name' })\n if (mark === nothing) return nothing\n return html`<p class=\"topbar-sponsor\" part=\"sponsor\">\n <span>${this.providerReceipt ? 'Du har handlet hos' : 'Du handler hos'}</span> ${mark}\n </p>`\n }\n\n /**\n * The provider's receipt on its own. It must not depend on the cart: the\n * payment step is rendered from the cart, and clearing the cart after a\n * purchase is what took Qliro's receipt away on 2026-09-08 and brought back\n * \"how do you want to pay\". The provider's container lives in the light DOM\n * and is projected here, untouched.\n */\n private renderProviderReceipt() {\n const slot =\n this.providerReceipt === 'walley'\n ? 'vio-walley'\n : this.providerReceipt === 'kustom'\n ? 'vio-kustom'\n : 'vio-qliro'\n return html`\n <section class=\"section provider-receipt\">\n <slot name=${slot}></slot>\n <button class=\"confirm-close\" @click=${this.close}>Lukk</button>\n </section>\n `\n }\n\n /**\n * A completed purchase whose receipt the PROVIDER shows. Same side effects as\n * confirmOrder — `vio:payment-success` for the host and analytics, the\n * sponsor's cart cleared — but the screen is the provider's receipt, not our\n * \"Takk!\": two receipts for one purchase is one too many.\n */\n private showProviderReceipt(\n method: 'qliro' | 'walley' | 'kustom',\n sponsorId: number,\n result?: unknown,\n returnCheckoutId?: string,\n ): void {\n this.providerReceipt = method\n this.confirmedMethod = method\n this.open = true\n // Before the cart is cleared below: the checkout id goes with it. Back\n // from a redirect the state was re-opened without one (`Vio.checkout.open`\n // knows no checkout yet), so the return URL's id is passed in explicitly.\n const checkoutId = returnCheckoutId || this.checkoutState?.checkoutId\n this.setOrderSponsor(sponsorId, checkoutId)\n void this.emitPaymentSuccess(\n { method, sponsorId, result: result as PaymentSuccessResult | null | undefined, checkoutId },\n checkoutId,\n sponsorId,\n () => {\n if (sponsorId) Vio.cart.clearSponsorCart(sponsorId)\n },\n )\n }\n\n /** Back from the payment page, asking whether it was paid — and nothing\n * else on screen while we do. */\n private renderVerifying() {\n return html`\n <section class=\"verifying\" role=\"status\" aria-live=\"polite\">\n <span class=\"verifying-spinner\" aria-hidden=\"true\"></span>\n <p class=\"verifying-text\">${this.verifyingReturn}</p>\n <p class=\"verifying-hint\">Dette kan ta litt tid. Ikke lukk siden.</p>\n </section>\n `\n }\n\n private renderConfirmation() {\n const o = this.confirmedOrder\n const email = o?.email || String(this.form.email ?? '').trim()\n const details: Array<[string, string]> = []\n if (o?.orderId) details.push(['Ordrenummer', `#${o.orderId}`])\n details.push(['Betalingsmåte', o?.paidWith || this.methodLabel(this.confirmedMethod)])\n if (o?.providerRef) details.push([o.providerRef.label, o.providerRef.value])\n if (email) details.push(['Kvittering til', email])\n // Who the order is with: the checkout's sponsor (see checkoutSponsorIdentity).\n const sponsor = this.checkoutSponsorIdentity()\n return html`\n <section class=\"confirmation\" part=\"confirmation\">\n ${usableLogo(sponsor)\n ? html`<div class=\"confirm-brand\" part=\"sponsor\">\n ${renderSponsorMark(this, sponsor, { logo: 'confirm-brand-logo', name: 'confirm-brand-name' })}\n </div>`\n : ''}\n <header class=\"confirm-head\">\n <div class=\"confirm-check\" aria-hidden=\"true\">✓</div>\n <div>\n <h3 class=\"confirm-title\" part=\"confirm-title\">Takk for bestillingen!</h3>\n ${sponsor?.name\n ? html`<p class=\"confirm-sponsor\" part=\"confirm-sponsor\">Du har handlet hos <strong>${sponsor.name}</strong>.</p>`\n : ''}\n <p class=\"confirm-text\">\n Betalingen er bekreftet.${email\n ? html` Du får en ordrebekreftelse på e-post.`\n : ''}\n </p>\n </div>\n </header>\n\n <dl class=\"confirm-details\" part=\"confirm-details\">\n ${details.map(\n ([k, v]) =>\n html`<div><dt>${k}</dt><dd class=${k === o?.providerRef?.label ? 'ref' : ''}>${v}</dd></div>`,\n )}\n </dl>\n\n ${o && o.items.length > 0\n ? html`\n <div class=\"confirm-summary\">\n <div class=\"confirm-label\">Din bestilling</div>\n ${o.items.map(\n (it) => html`\n <div class=\"confirm-line\">\n ${it.imageUrl\n ? html`<img class=\"confirm-thumb\" src=${it.imageUrl} alt=\"\" loading=\"lazy\" />`\n : html`<span class=\"confirm-thumb\" aria-hidden=\"true\"></span>`}\n <span class=\"confirm-line-name\">\n ${it.brand ? html`<small>${it.brand}</small>` : ''}\n <span>${it.name}</span>\n <small>Antall: ${it.quantity}</small>\n </span>\n <span class=\"confirm-line-price\">\n ${formatPrice(it.unitPrice * it.quantity, it.currency)}\n </span>\n </div>\n `,\n )}\n ${o.shipping\n ? html`\n <div class=\"order-row\">\n <span>Frakt – ${o.shipping.name}</span>\n <span>${formatPrice(o.shipping.price, o.currency)}</span>\n </div>\n `\n : ''}\n <div class=\"order-row total\">\n <span>Totalt</span><span>${formatPrice(o.total, o.currency)}</span>\n </div>\n </div>\n `\n : ''}\n <button class=\"confirm-close\" @click=${this.close}>Fortsett å handle</button>\n </section>\n `\n }\n\n /**\n * Whether mounting an embedded checkout now would be starting a payment the\n * shopper asked for. Mounting CREATES an order at the provider (and a backend\n * checkout if there is none), so it must not happen on a confirmation return,\n * once this checkout's order is confirmed, or for a cart that cannot ship.\n */\n private mayStartEmbeddedPayment(): boolean {\n return (\n !this.returningFrom &&\n !this.orderConfirmed &&\n !this.providerReceipt &&\n !this.shippingBlocked &&\n this.shippingsSettled()\n )\n }\n\n /**\n * Whether we know enough about shipping to create an order. The provider\n * prices the order when it is created, so a first opening waits for the\n * shippings to answer: the cart may turn out unable to ship at all. A list\n * already on screen counts, and a later answer that blocks the cart takes\n * the widget down again (see `updated`).\n */\n private shippingsSettled(): boolean {\n return (\n this.items.length === 0 ||\n this.availableShippingsList.length > 0 ||\n this.shippingsReadyFor === this.embedSession()\n )\n }\n\n /** Why nothing can be paid: the cart's products cannot ship together. */\n private renderShippingBlocked() {\n return html`<div class=\"payment-error\" role=\"alert\">${VioCheckout.SHIPPING_BLOCKED_MESSAGE}</div>`\n }\n\n /**\n * The checkout an embedded widget's order belongs to. Kustom, Qliro and\n * Walley price the order when it is created, so a widget kept into a NEW\n * checkout shows — and charges — the cart it was created for.\n *\n * Closing drops the widgets, but a checkout can start again without a\n * close: in Vev the cart view opens on top of the checkout and \"Til kassen\"\n * calls `Vio.checkout.open()` again (Angelo, 2026-09-14: quantities raised\n * in the cart view, Qliro kept the old total). Every `open()` is a new\n * session, so a widget from an earlier one starts over.\n *\n * 0.11.3 compared the cart LINES instead, and that was wrong: within one\n * session the backend rewrites them (saving the shipping re-reads the cart),\n * so the first Qliro event after that — the customer picking a shipping —\n * tore the widget down mid-purchase (Alan, 2026-09-14). The session does\n * not change under the customer's hands.\n */\n private embedSession(): string {\n const s = this.checkoutState\n return `${s?.sponsorId ?? ''}|${s?.session ?? ''}`\n }\n\n /** Klarna Payments widget panel: shipping + category chips + widget + pay button. */\n /**\n * The cart a Kustom order describes. When it changes under a mounted\n * widget, the order is UPDATED in place (Kustom's rule) — see\n * syncKustomIfStale. The order is a photo of the lines, not of the form:\n * address and shipping live inside the widget.\n */\n private kustomCartKey(): string {\n return JSON.stringify([\n this.items.map((i) => [i.productId, i.variantId ?? '', i.quantity]),\n this.checkoutState?.subtotal ?? 0,\n ])\n }\n\n /** Mount the Kustom embedded checkout once it's the chosen method. */\n private async mountKustomIfNeeded(): Promise<void> {\n if (!this.open || !this.checkoutState) return\n if (this.checkoutState.paymentMethod !== 'kustom') return\n if (!this.mayStartEmbeddedPayment()) return\n if (this.kustomMounting || this.kustomSyncing) return\n // Already mounted for THIS checkout session — the KCO iframe manages\n // itself (address, shipping and totals live inside it). A new session\n // (closed and reopened) asks the backend again, which updates the same\n // order if it is still open.\n if (this.kustomMountedOrderId) {\n if (this.kustomMountedFor === this.embedSession()) return\n this.unmountKustom()\n }\n // Kustom's snippet resolves its mount point from the document: the\n // container lives in the light DOM and is projected into the panel\n // through a named slot, like every other third-party embed here.\n const container = this.lightContainer('vio-kustom-checkout-container', 'vio-kustom')\n\n const mountedFor = this.embedSession()\n const mountedKey = this.kustomCartKey()\n this.kustomMounting = true\n this.kustomNotice = null\n this.paymentError = null\n container.innerHTML = ''\n try {\n const order = await Vio.checkout.mountKustomCheckout(\n container,\n this.checkoutState.sponsorId,\n this.kustomHandlers(),\n )\n this.kustomMountedOrderId = order.order_id\n this.kustomMountedFor = mountedFor\n this.kustomMountedKey = mountedKey\n this.kustomShipping =\n order.shipping_name !== undefined || order.shipping_price !== undefined\n ? { name: order.shipping_name, price: order.shipping_price }\n : null\n this.kustomTotal = typeof order.total_price === 'number' ? order.total_price : null\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Kustom mount failed:', err)\n }\n this.paymentError = friendlyPaymentError(errorText(err), 'kustom')\n Vio.checkout.selectPaymentMethod('' as PaymentMethod)\n } finally {\n this.kustomMounting = false\n }\n }\n\n /** What the widget tells us, kept only to show — never acted on server-side. */\n private kustomHandlers() {\n return {\n onOrderTotalChange: (minor: number) => {\n this.kustomTotal = minor / 100\n },\n onShippingOptionChange: (o: { name?: string; price?: number }) => {\n this.kustomShipping = {\n name: o?.name,\n price: typeof o?.price === 'number' ? o.price / 100 : undefined,\n }\n },\n onCannotComplete: () => {\n this.kustomNotice = 'Betalingen kunne ikke gjennomføres med valgt metode. Velg en annen betalingsmåte.'\n },\n onNetworkError: () => {\n this.kustomNotice = 'Mistet kontakt med betalingsvinduet. Last inn siden på nytt.'\n },\n }\n }\n\n /**\n * The cart changed under a mounted Kustom widget: suspend it, push the\n * cart into the same order, resume it. Never a second order, never a\n * widget showing a total the backend will not charge (the validation\n * callback would refuse it). A failed sync takes the widget down.\n */\n private syncKustomIfStale(): void {\n if (!this.kustomMountedOrderId || this.kustomMounting || this.kustomSyncing) return\n if (this.providerReceipt || this.returningFrom) return\n const key = this.kustomCartKey()\n if (key === this.kustomMountedKey) return\n this.kustomSyncing = true\n this.kustomMountedKey = key\n void Vio.checkout.syncKustomOrder(this.checkoutState?.sponsorId)\n .then((order) => {\n if (!order) throw new Error('no order')\n this.kustomMountedOrderId = order.order_id\n this.kustomTotal = typeof order.total_price === 'number' ? order.total_price : this.kustomTotal\n })\n .catch((err) => {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Kustom sync failed:', err)\n }\n this.unmountKustom()\n this.kustomNotice = 'Bestillingen ble endret. Last inn betalingen på nytt.'\n })\n .finally(() => {\n this.kustomSyncing = false\n })\n }\n\n private unmountKustom(): void {\n this.kustomMountedOrderId = null\n this.kustomMountedFor = null\n this.kustomMountedKey = null\n this.kustomShipping = null\n this.kustomTotal = null\n Vio.checkout.destroyKustomListeners()\n this.querySelector<HTMLElement>('#vio-kustom-checkout-container')?.remove()\n }\n\n private renderKustomPanel() {\n return html`\n <div class=\"kustom-panel\">\n ${this.kustomMounting\n ? html`<div style=\"font-size:13px;opacity:0.7;padding:8px 0;\">Laster Kustom…</div>`\n : ''}\n ${this.kustomSyncing\n ? html`<div style=\"font-size:13px;opacity:0.7;padding:8px 0;\">Oppdaterer bestillingen…</div>`\n : ''}\n ${this.kustomNotice\n ? html`<div class=\"payment-notice\">${this.kustomNotice}</div>`\n : ''}\n <slot name=\"vio-kustom\"></slot>\n </div>\n `\n }\n\n /** Mount the Qliro embedded checkout once it's the chosen method. */\n\n /**\n * Container for a third-party embed, living in the LIGHT DOM.\n *\n * Qliro's (and Walley's) bootstrap script resolves its mount point from the\n * document, so a container inside this component's shadow root is invisible\n * to it and the widget silently never renders — verified against Qliro's\n * staging widget: identical snippet, light DOM renders the iframe, shadow\n * DOM renders nothing at all. The element is a child of the host (light DOM)\n * and is projected back into the panel through a named slot, so the layout\n * is unchanged. Kustom's KCO snippet resolves its own script's parent, so it\n * works either way and keeps using the shadow-root container.\n */\n private lightContainer(id: string, slotName: string): HTMLElement {\n let el = this.querySelector<HTMLElement>(`#${id}`)\n if (!el) {\n el = document.createElement('div')\n el.id = id\n el.setAttribute('slot', slotName)\n this.appendChild(el)\n }\n return el\n }\n\n private async mountQliroIfNeeded(): Promise<void> {\n if (!this.open || !this.checkoutState) return\n if (this.checkoutState.paymentMethod !== 'qliro') return\n if (!this.mayStartEmbeddedPayment()) return\n if (this.qliroMounting) return\n let container = this.lightContainer('vio-qliro-checkout-container', 'vio-qliro')\n if (this.qliroMountedOrderId && container.childElementCount > 0) {\n if (this.qliroMountedFor === this.embedSession()) return\n this.unmountQliro()\n container = this.lightContainer('vio-qliro-checkout-container', 'vio-qliro')\n }\n\n const mountedFor = this.embedSession()\n this.qliroMounting = true\n container.innerHTML = ''\n try {\n const order = await Vio.checkout.mountQliroCheckout(\n container,\n this.checkoutState.sponsorId,\n )\n this.qliroMountedOrderId = order.order_id\n this.qliroMountedFor = mountedFor\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Qliro mount failed:', err)\n }\n this.paymentError = friendlyPaymentError(errorText(err), 'qliro')\n Vio.checkout.selectPaymentMethod('' as PaymentMethod)\n } finally {\n this.qliroMounting = false\n }\n }\n\n private unmountQliro(): void {\n this.qliroMountedOrderId = null\n this.qliroMountedFor = null\n this.qliroShipping = null\n // Release the q1 listeners with the widget they belong to — and any lock\n // still held, which would otherwise outlive the iframe.\n Vio.checkout.destroyQliroListeners()\n this.querySelector<HTMLElement>('#vio-qliro-checkout-container')?.remove()\n }\n\n private renderQliroPanel() {\n return html`\n <div class=\"qliro-panel\">\n ${this.qliroMounting\n ? html`<div style=\"font-size:13px;opacity:0.7;padding:8px 0;\">Laster Qliro…</div>`\n : ''}\n <slot name=\"vio-qliro\"></slot>\n </div>\n `\n }\n\n /**\n * Mount the Walley embedded checkout once it's the chosen method. Unlike\n * Kustom/Qliro, success is signalled INLINE by Walley's own DOM event\n * (`walleyCheckoutPurchaseCompleted`) — no redirect round-trip needed, so\n * we handle it here instead of only in the confirmation-return branch.\n */\n private async mountWalleyIfNeeded(): Promise<void> {\n if (!this.open || !this.checkoutState) return\n if (this.checkoutState.paymentMethod !== 'walley') return\n if (!this.mayStartEmbeddedPayment()) return\n if (this.walleyMounting) return\n let container = this.lightContainer('vio-walley-checkout-container', 'vio-walley')\n if (this.walleyMountedOrderId && container.childElementCount > 0) {\n if (this.walleyMountedFor === this.embedSession()) return\n this.unmountWalley()\n container = this.lightContainer('vio-walley-checkout-container', 'vio-walley')\n }\n\n const mountedFor = this.embedSession()\n this.walleyMounting = true\n container.innerHTML = ''\n try {\n const order = await Vio.checkout.mountWalleyCheckout(\n container,\n this.checkoutState.sponsorId,\n () => {\n // The widget confirmed the purchase inline and shows its own\n // receipt — keep it on screen, as the confirmation-URL path does.\n this.showProviderReceipt('walley', this.checkoutState?.sponsorId ?? 0, {\n orderId: order.order_id,\n })\n },\n )\n this.walleyMountedOrderId = order.order_id\n this.walleyMountedFor = mountedFor\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Walley mount failed:', err)\n }\n this.paymentError = friendlyPaymentError(errorText(err), 'walley')\n Vio.checkout.selectPaymentMethod('' as PaymentMethod)\n } finally {\n this.walleyMounting = false\n }\n }\n\n private unmountWalley(): void {\n this.walleyMountedOrderId = null\n this.walleyMountedFor = null\n this.querySelector<HTMLElement>('#vio-walley-checkout-container')?.remove()\n }\n\n private renderWalleyPanel() {\n return html`\n <div class=\"walley-panel\">\n ${this.walleyMounting\n ? html`<div style=\"font-size:13px;opacity:0.7;padding:8px 0;\">Laster Walley…</div>`\n : ''}\n <slot name=\"vio-walley\"></slot>\n </div>\n `\n }\n\n /**\n * Mount the Nexi embedded checkout once it's the chosen method. Nexi's own\n * JS SDK renders into a LIGHT-DOM container (it refuses a shadow root);\n * completion is its `payment-completed` event — Nexi neither redirects nor\n * shows a receipt, so success lands in Vio's confirmation drawer. Shipping\n * is re-priced on `address-changed` (see the manager).\n */\n private async mountNexiIfNeeded(): Promise<void> {\n if (!this.open || !this.checkoutState) return\n if (this.checkoutState.paymentMethod !== 'nexi') return\n if (!this.mayStartEmbeddedPayment()) return\n if (this.nexiMounting) return\n let container = this.lightContainer('vio-nexi-checkout-container', 'vio-nexi')\n if (this.nexiMountedOrderId && container.childElementCount > 0) {\n if (this.nexiMountedFor === this.embedSession()) return\n this.unmountNexi()\n container = this.lightContainer('vio-nexi-checkout-container', 'vio-nexi')\n }\n\n const mountedFor = this.embedSession()\n const resumePaymentId = this.nexiResumePaymentId\n this.nexiResumePaymentId = null\n this.nexiMounting = true\n this.nexiShippingNotice = null\n container.innerHTML = ''\n try {\n const order = await Vio.checkout.mountNexiCheckout(container, this.checkoutState.sponsorId, {\n onCompleted: (paid) => this.onNexiCompleted(paid.order_id),\n onShipping: (result, err) => {\n const wanted = this.nexiShipping?.shipping_id\n const pickedNow = this.nexiPicking\n this.nexiPicking = false\n if (err || !result) {\n this.nexiShipping = null\n this.nexiShippingNotice = 'Kunne ikke beregne frakt. Prøv å endre adressen.'\n } else if (result.reason === 'AWAITING_ADDRESS') {\n // The rates of the market, shown before any address; nothing charged.\n this.nexiShipping = result\n this.nexiShippingNotice = null\n } else if (!result.ok) {\n this.nexiShipping = null\n this.nexiShippingNotice = 'Vi kan dessverre ikke sende til dette landet.'\n } else {\n this.nexiShipping = result\n if (result.repriced_at_pay) {\n // The payment was stopped: the total changed as the shopper pressed pay.\n this.nexiShippingNotice =\n 'Frakten er oppdatert for leveringsadressen din. Sjekk totalen og trykk «Betal» igjen.'\n } else {\n // The address changed and the rate the shopper had does not reach it.\n this.nexiShippingNotice =\n !pickedNow && wanted && result.shipping_id !== wanted\n ? `Valgt frakt leveres ikke til denne adressen. Vi har valgt ${result.shipping_name ?? 'en annen'}.`\n : null\n }\n }\n },\n }, resumePaymentId ? { paymentId: resumePaymentId } : undefined)\n this.nexiMountedOrderId = order.order_id\n this.nexiMountedFor = mountedFor\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Nexi mount failed:', err)\n }\n this.paymentError = friendlyPaymentError(errorText(err), 'nexi')\n Vio.checkout.selectPaymentMethod('' as PaymentMethod)\n } finally {\n this.nexiMounting = false\n }\n }\n\n /** payment-completed: the reservation exists — confirm like the redirect methods do. */\n private onNexiCompleted(paymentId: string): void {\n const spId = this.checkoutState?.sponsorId ?? 0\n const checkoutId = this.checkoutState?.checkoutId ?? ''\n // Nexi shows no receipt of its own (its docs leave the confirmation to the\n // merchant), so ours says what was bought. Snapshot BEFORE unmounting:\n // the charged total and the shipping live in Nexi's last re-pricing.\n const charged = this.nexiShipping?.ok ? this.nexiShipping.total_price : undefined\n this.confirmOrder('nexi', spId, { chargedTotal: charged })\n if (this.confirmedOrder) {\n this.confirmedOrder = {\n ...this.confirmedOrder,\n providerRef: { label: 'Nexi betalings-ID', value: paymentId },\n }\n }\n this.unmountNexi()\n if (checkoutId) void this.addNexiPaymentDetails(checkoutId, spId, paymentId)\n }\n\n /**\n * How it was paid and where the receipt goes — Nexi knows, we ask. Its\n * payment details can lag the completion event by a moment, hence the\n * few retries. Best effort: the confirmation stands without them.\n */\n private async addNexiPaymentDetails(\n checkoutId: string,\n sponsorId: number,\n paymentId: string,\n ): Promise<void> {\n for (const delay of VioCheckout.NEXI_DETAILS_DELAYS_MS) {\n if (delay) await new Promise((r) => setTimeout(r, delay))\n const o = await Vio.checkout.getNexiOrder(checkoutId, sponsorId).catch(() => null)\n const current = this.confirmedOrder\n // The shopper may have closed it, or started another purchase.\n if (!current || current.providerRef?.value !== paymentId) return\n if (!o) continue\n const paidWith = o.payment_method\n ? o.card_last4\n ? `${o.payment_method} •••• ${o.card_last4}`\n : o.payment_method\n : undefined\n this.confirmedOrder = {\n ...current,\n ...(paidWith ? { paidWith } : {}),\n ...(o.email ? { email: o.email } : {}),\n }\n if (paidWith) return\n }\n }\n\n private static readonly NEXI_DETAILS_DELAYS_MS = [0, 1500, 3000]\n\n private unmountNexi(): void {\n this.nexiMountedOrderId = null\n this.nexiMountedFor = null\n this.nexiShippingNotice = null\n this.nexiShipping = null\n this.nexiPicking = false\n Vio.checkout.destroyNexi()\n this.querySelector<HTMLElement>('#vio-nexi-checkout-container')?.remove()\n }\n\n /**\n * Nexi has no shipping picker: once an address is typed in the widget, the\n * rates that reach it are listed here and the pick is pushed to the payment.\n * With a single rate there is nothing to choose, so nothing is shown.\n */\n private renderNexiShippingChoice() {\n const options = this.nexiShipping?.options ?? []\n if (options.length < 2) return ''\n const currency = this.checkoutState?.currency || getGlobalCurrency()\n const current = this.nexiShipping?.shipping_id\n return html`\n <div class=\"ship-select nexi-ship\" role=\"radiogroup\" aria-label=\"Frakt\">\n ${options.map(\n (o) => html`\n <button\n class=\"ship-opt ${current === o.id ? 'active' : ''}\"\n role=\"radio\"\n aria-checked=${current === o.id}\n ?disabled=${this.nexiPicking}\n @click=${() => void this.onPickNexiShipping(o.id)}\n >\n <span class=\"ship-meta\"><b>${o.name}</b></span>\n <span class=\"ship-price\">${formatPrice(o.price, currency)}</span>\n </button>\n `,\n )}\n </div>\n `\n }\n\n private async onPickNexiShipping(id: string): Promise<void> {\n if (this.nexiPicking || id === this.nexiShipping?.shipping_id) return\n this.nexiPicking = true\n try {\n // The answer arrives through onShipping, which clears nexiPicking.\n await Vio.checkout.pickNexiShipping(id)\n } finally {\n this.nexiPicking = false\n }\n }\n\n /* ── Adyen: our form first, then Adyen's Drop-in on a session ─────────── */\n\n /**\n * What an embedded payment is a photo OF — an Adyen session, a Stripe\n * PaymentIntent. When any of it changes underneath, that photo no longer\n * describes the purchase: it is dropped, and the shopper asks for the\n * payment step again.\n */\n private embedPurchaseKey(): string {\n return JSON.stringify([\n this.embedFormKey(),\n this.items.map((i) => [i.productId, i.variantId ?? '', i.quantity]),\n this.checkoutState?.subtotal ?? 0,\n ])\n }\n\n /** The part of the photo the shopper types and picks. */\n private embedFormKey(): string {\n const f = this.form\n return JSON.stringify([\n f.firstName, f.lastName, f.email, f.address, f.postalCode, f.city, f.country ?? '',\n this.selectedShipping,\n ])\n }\n\n /** A mounted session whose purchase changed is taken down — never patched. */\n private dropStaleAdyen(): void {\n if (!this.adyenMounted || this.adyenMounting) return\n if (this.adyenMountedKey === this.embedPurchaseKey()) return\n this.unmountAdyen()\n this.adyenStale = true\n }\n\n private async mountAdyenIfNeeded(): Promise<void> {\n if (!this.open || !this.checkoutState) return\n if (this.checkoutState.paymentMethod !== 'adyen') return\n if (!this.mayStartEmbeddedPayment() || this.adyenSettled) return\n if (this.adyenMounting) return\n if (this.adyenMounted) {\n if (this.adyenMountedFor === this.embedSession()) return\n // A new checkout session: the photo belongs to the previous one.\n this.unmountAdyen()\n }\n // Only on the shopper's request, and only with a finished form.\n if (!this.adyenRequested || !this.isAddressValid || !this.hasSelectedShipping) return\n this.adyenRequested = false\n this.adyenMounting = true\n this.adyenStale = false\n this.paymentError = null\n const spId = this.checkoutState.sponsorId\n const mountedFor = this.embedSession()\n const formKey = this.embedFormKey()\n try {\n // The total depends on the shipping: persist the pick before the photo.\n const selectedOpt = this.shippingList.find((o) => o.id === this.selectedShipping)\n if (selectedOpt?.supplierId) {\n await Vio.checkout.updateShippingsBySupplier(\n [{ shipping_id: selectedOpt.id, supplier_id: Number(selectedOpt.supplierId) }],\n spId,\n )\n }\n await this.updateComplete\n const container = this.lightContainer('vio-adyen-checkout-container', 'vio-adyen')\n container.innerHTML = ''\n await Vio.checkout.mountAdyenCheckout(container, spId, this.form, {\n onCompleted: (payment, session) => this.onAdyenCompleted(spId, payment, session),\n onFailed: () => {\n // Refused or cancelled inside Drop-in. The session may be spent, so\n // the next attempt starts on a new one — on the shopper's request.\n this.unmountAdyen()\n this.paymentError = 'Betalingen ble ikke gjennomført. Prøv igjen, eller velg en annen betalingsmåte.'\n },\n onReplaced: (reason) => {\n // \"Pay\" was pressed on a session that no longer pays for this\n // checkout: nothing was charged. Take it down and say why.\n this.unmountAdyen()\n this.adyenStale = true\n if (reason === 'ALREADY_PAID') {\n this.adyenSettled = true\n this.paymentNotice = 'Denne bestillingen er allerede betalt.'\n }\n },\n onError: (error) => {\n if (typeof console !== 'undefined') console.warn('[VioCheckout] Adyen error:', error)\n },\n })\n // The shopper may have moved on while the session was being created.\n if (this.embedSession() !== mountedFor || this.checkoutState?.paymentMethod !== 'adyen' || !this.open) {\n this.unmountAdyen()\n return\n }\n // …or kept typing: the session was created from the form as it was.\n if (this.embedFormKey() !== formKey) {\n this.unmountAdyen()\n this.adyenStale = true\n return\n }\n this.adyenMounted = true\n this.adyenMountedFor = mountedFor\n // Taken NOW, not before: saving the shipping makes the backend rewrite\n // the cart lines, and that refresh is not a change by the shopper.\n this.adyenMountedKey = this.embedPurchaseKey()\n } catch (err) {\n this.unmountAdyen()\n this.paymentError =\n err instanceof AdyenOriginError\n ? 'Betaling er ikke aktivert for denne siden ennå. Ta kontakt med butikken.'\n : friendlyPaymentError(errorText(err), 'adyen')\n if (typeof console !== 'undefined') console.warn('[VioCheckout] Adyen mount failed:', err)\n } finally {\n this.adyenMounting = false\n }\n }\n\n private onAdyenCompleted(sponsorId: number, payment: AdyenPayment | null, session: AdyenSession): void {\n const outcome = adyenReturnOutcome(payment)\n // Whatever Adyen said, this session is spent.\n this.unmountAdyen()\n if (outcome === 'paid') {\n this.adyenSettled = true\n this.confirmOrder('adyen', sponsorId, {\n chargedTotal: payment?.total_price ?? session.total_price,\n })\n this.addAdyenPaymentDetails(payment)\n } else if (outcome === 'pending') {\n // Swish, Trustly…: Adyen confirms later, through its webhook. Same\n // promise the redirect methods make, and the cart stays as it is.\n this.adyenSettled = true\n this.paymentNotice =\n 'Betalingen behandles fortsatt. Du får ordrebekreftelse på e-post når den er gjennomført. Handlekurven er uendret.'\n } else {\n this.paymentError = 'Betalingen ble ikke gjennomført. Prøv igjen, eller velg en annen betalingsmåte.'\n }\n }\n\n /** What Adyen told us about the payment, on Vio's confirmation. */\n private addAdyenPaymentDetails(payment: AdyenPayment | null): void {\n if (!this.confirmedOrder || !payment) return\n this.confirmedOrder = {\n ...this.confirmedOrder,\n ...(payment.psp_reference\n ? { providerRef: { label: 'Betalingsreferanse', value: payment.psp_reference } }\n : {}),\n ...(payment.payment_method ? { paidWith: payment.payment_method } : {}),\n ...(payment.email && !this.confirmedOrder.email ? { email: payment.email } : {}),\n ...(payment.shipping_name && !this.confirmedOrder.shipping\n ? { shipping: { name: payment.shipping_name, price: payment.shipping_price ?? 0 } }\n : {}),\n }\n }\n\n private unmountAdyen(): void {\n Vio.checkout.destroyAdyen()\n this.adyenMounted = false\n this.adyenMountedFor = null\n this.adyenMountedKey = null\n this.adyenRequested = false\n this.adyenStale = false\n this.querySelector('#vio-adyen-checkout-container')?.remove()\n }\n\n private renderAdyenPanel() {\n const ready = this.isAddressValid && this.hasSelectedShipping\n const showButton = !this.adyenMounted && !this.adyenMounting && !this.adyenSettled\n return html`\n <div class=\"adyen-panel\">\n ${this.adyenMounting\n ? html`<div style=\"font-size:13px;opacity:0.7;padding:8px 0;\">Laster betaling…</div>`\n : ''}\n ${this.adyenStale && showButton\n ? html`<div class=\"payment-notice\">Bestillingen ble endret. Oppdater betalingen for å fortsette.</div>`\n : ''}\n ${showButton\n ? html`\n <button\n class=\"payment-btn primary complete-cta\"\n ?disabled=${!ready}\n title=${!this.isAddressValid\n ? 'Vennligst fyll ut leveringsadresse'\n : !this.hasSelectedShipping\n ? 'Vennligst velg en fraktmetode'\n : ''}\n @click=${() => {\n this.adyenRequested = true\n }}\n >\n ${this.adyenStale ? 'Oppdater betaling' : `Gå til betaling · ${this.payTotalLabel()}`}\n </button>\n `\n : ''}\n <slot name=\"vio-adyen\"></slot>\n </div>\n `\n }\n\n /* ── Stripe, native: the Payment Element on our own page ──────────────── */\n\n /** A mounted Element whose purchase changed is taken down — never patched. */\n private dropStaleStripe(): void {\n if (!this.stripeMounted || this.stripeMounting) return\n if (this.stripeMountedKey === this.embedPurchaseKey()) return\n this.unmountStripe()\n this.stripeStale = true\n }\n\n private async mountStripeIfNeeded(): Promise<void> {\n if (!this.open || !this.checkoutState) return\n if (this.checkoutState.paymentMethod !== 'stripe' || this.stripeMode !== 'native') return\n if (!this.mayStartEmbeddedPayment() || this.stripeSettled) return\n if (this.stripeMounting) return\n if (this.stripeMounted) {\n if (this.stripeMountedFor === this.embedSession()) return\n // A new checkout session: the PaymentIntent belongs to the previous one.\n this.unmountStripe()\n }\n // Only on the shopper's request, and only with a finished form: creating\n // the Element mints a PaymentIntent for the total as it stands.\n if (!this.stripeRequested || !this.isAddressValid || !this.hasSelectedShipping) return\n this.stripeRequested = false\n this.stripeMounting = true\n this.stripeStale = false\n this.paymentError = null\n const spId = this.checkoutState.sponsorId\n const mountedFor = this.embedSession()\n const formKey = this.embedFormKey()\n try {\n // The total depends on the shipping: persist the pick before the photo.\n const selectedOpt = this.shippingList.find((o) => o.id === this.selectedShipping)\n if (selectedOpt?.supplierId) {\n await Vio.checkout.updateShippingsBySupplier(\n [{ shipping_id: selectedOpt.id, supplier_id: Number(selectedOpt.supplierId) }],\n spId,\n )\n }\n await this.updateComplete\n const container = this.lightContainer('vio-stripe-checkout-container', 'vio-stripe')\n container.innerHTML = ''\n this.stripeReady = false\n const mounted = await Vio.checkout.mountStripeCheckout(container, spId, this.form, {\n // `mount()` resolves before Stripe paints anything — seconds before,\n // on a cold cache. Its own \"ready\" is what turns the spinner off.\n onReady: () => {\n this.stripeReady = true\n },\n onLoadError: (message) => {\n this.unmountStripe()\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Stripe Payment Element failed to load:', message)\n }\n this.paymentError = friendlyPaymentError(message, 'stripe')\n },\n })\n // The shopper may have moved on while the intent was being created.\n if (\n this.embedSession() !== mountedFor ||\n this.checkoutState?.paymentMethod !== 'stripe' ||\n !this.open\n ) {\n this.unmountStripe()\n return\n }\n // …or kept typing: the intent was minted from the form as it was.\n if (this.embedFormKey() !== formKey) {\n this.unmountStripe()\n this.stripeStale = true\n return\n }\n this.stripeElement = mounted.handle\n this.stripeCheckoutId = mounted.checkoutId\n this.stripeMounted = true\n this.stripeMountedFor = mountedFor\n // Taken NOW: saving the shipping makes the backend rewrite the cart\n // lines, and that refresh is not a change by the shopper.\n this.stripeMountedKey = this.embedPurchaseKey()\n } catch (err) {\n this.unmountStripe()\n this.paymentError = friendlyPaymentError(errorText(err), 'stripe')\n if (typeof console !== 'undefined') console.warn('[VioCheckout] Stripe mount failed:', err)\n } finally {\n this.stripeMounting = false\n }\n }\n\n /**\n * Pay with the mounted Element. Stripe answers the BROWSER; the order is\n * created server-side by the `payment_intent.succeeded` webhook, so a\n * success is then waited for on the checkout itself.\n */\n private async onStripePay(): Promise<void> {\n if (!this.stripeElement || this.stripePaying) return\n const spId = this.checkoutState?.sponsorId ?? 0\n const checkoutId = this.stripeCheckoutId\n // Taken before the Element goes away: the receipt prints what was charged.\n const charged = (this.checkoutState?.subtotal ?? 0) + this.shippingMajor()\n this.stripePaying = true\n this.paymentError = null\n try {\n const outcome = await this.stripeElement.confirm()\n if (outcome.status === 'failed') {\n // Nothing was charged and the Element is still usable: a declined\n // card or a wrong CVC is fixed in place, without a new intent.\n this.paymentError =\n outcome.message ||\n 'Betalingen ble ikke gjennomført. Prøv igjen, eller velg en annen betalingsmåte.'\n return\n }\n // Authorised. Whatever happens next, this intent is spent.\n this.stripeSettled = true\n this.unmountStripe()\n const settled = checkoutId\n ? await this.waitForStripeOrder(checkoutId, spId)\n : ('pending' as const)\n if (settled === 'paid') {\n // What Stripe charged is the total WITH shipping — the subtotal alone\n // would print a receipt for less than the shopper paid.\n this.confirmOrder('stripe', spId, { chargedTotal: charged })\n } else if (settled === 'duplicate') {\n // The cart was paid in another tab; the server gives Stripe's charge back.\n this.stripeSettled = false\n this.paymentError = CART_PAID_MESSAGE\n } else if (settled === 'failed') {\n this.stripeSettled = false\n this.paymentError = 'Betalingen ble avbrutt eller feilet. Vennligst prøv igjen.'\n } else {\n // The charge went through but the order has not landed yet (or Stripe\n // is still processing). Same promise the redirect methods make.\n this.paymentNotice =\n 'Betalingen behandles fortsatt. Du får ordrebekreftelse på e-post når den er gjennomført. Handlekurven er uendret.'\n }\n } catch (err) {\n this.paymentError = `Betalingen kunne ikke fullføres: ${\n err instanceof Error ? err.message : String(err)\n }`\n if (typeof console !== 'undefined') console.warn('[VioCheckout] Stripe confirm failed:', err)\n } finally {\n this.stripePaying = false\n }\n }\n\n /**\n * Wait for Stripe's webhook to make the checkout paid — the same window the\n * redirect return uses, and ONLY the status: a Stripe checkout carries\n * `origin_payment_id` from the moment the intent is created, so that\n * pointer would read as paid before anyone paid.\n */\n private async waitForStripeOrder(\n checkoutId: string,\n sponsorId: number,\n ): Promise<'paid' | 'failed' | 'pending' | 'duplicate'> {\n for (const delayMs of VioCheckout.RETURN_VERIFY_DELAYS_MS) {\n if (delayMs > 0) await new Promise((r) => setTimeout(r, delayMs))\n try {\n const checkout = await Vio.checkout.getCheckout(checkoutId, sponsorId || undefined)\n const status = String(checkout?.status ?? '').toLowerCase()\n if (checkout?.duplicate_of) return 'duplicate'\n if (VioCheckout.FAILED_STATUSES.has(status)) return 'failed'\n if (VioCheckout.PAID_STATUSES.has(status)) return 'paid'\n } catch (err) {\n if (typeof console !== 'undefined') {\n console.warn('[VioCheckout] Stripe order check failed:', err)\n }\n }\n }\n return 'pending'\n }\n\n private unmountStripe(): void {\n Vio.checkout.destroyStripe()\n this.stripeReady = false\n this.stripeElement = null\n this.stripeCheckoutId = null\n this.stripeMounted = false\n this.stripeMountedFor = null\n this.stripeMountedKey = null\n this.stripeRequested = false\n this.stripeStale = false\n this.querySelector('#vio-stripe-checkout-container')?.remove()\n }\n\n private renderStripePanel() {\n const ready = this.isAddressValid && this.hasSelectedShipping\n const showButton = !this.stripeMounted && !this.stripeMounting && !this.stripeSettled\n return html`\n <div class=\"stripe-panel\">\n ${this.stripeMounting || (this.stripeMounted && !this.stripeReady)\n ? html`<div style=\"font-size:13px;opacity:0.7;padding:8px 0;\">Laster betaling…</div>`\n : ''}\n ${this.stripeStale && showButton\n ? html`<div class=\"payment-notice\">Bestillingen ble endret. Oppdater betalingen for å fortsette.</div>`\n : ''}\n ${showButton\n ? html`\n <button\n class=\"payment-btn primary complete-cta\"\n ?disabled=${!ready}\n title=${!this.isAddressValid\n ? 'Vennligst fyll ut leveringsadresse'\n : !this.hasSelectedShipping\n ? 'Vennligst velg en fraktmetode'\n : ''}\n @click=${() => {\n this.stripeRequested = true\n }}\n >\n ${this.stripeStale ? 'Oppdater betaling' : `Gå til betaling · ${this.payTotalLabel()}`}\n </button>\n `\n : ''}\n <slot name=\"vio-stripe\"></slot>\n ${this.stripeMounted\n ? html`\n <button\n class=\"payment-btn primary complete-cta\"\n ?disabled=${this.stripePaying || !this.stripeReady}\n @click=${() => void this.onStripePay()}\n >\n ${this.stripePaying ? 'Betaler…' : `Betal ${this.payTotalLabel()}`}\n </button>\n `\n : ''}\n </div>\n `\n }\n\n private renderNexiPanel() {\n return html`\n <div class=\"nexi-panel\">\n ${this.nexiMounting\n ? html`<div style=\"font-size:13px;opacity:0.7;padding:8px 0;\">Laster Nexi…</div>`\n : ''}\n ${this.renderNexiShippingChoice()}\n <slot name=\"vio-nexi\"></slot>\n ${this.nexiShippingNotice\n ? html`<div class=\"payment-notice\">${this.nexiShippingNotice}</div>`\n : ''}\n </div>\n `\n }\n\n private renderKlarnaPanel() {\n const currency = this.checkoutState?.currency || getGlobalCurrency()\n return html`\n <div class=\"klarna-panel\">\n ${this.express\n ? html`\n <div class=\"ship-select\" role=\"radiogroup\" aria-label=\"Frakt\">\n ${this.shippingList.map(\n (o) => html`\n <button\n class=\"ship-opt ${this.selectedShipping === o.id ? 'active' : ''}\"\n role=\"radio\"\n aria-checked=${this.selectedShipping === o.id}\n ?disabled=${this.klarnaMounting}\n @click=${() => void this.onSelectShipping(o.id)}\n >\n <span class=\"ship-meta\">\n <b>${o.method || o.name}</b><span>${o.description}</span>\n </span>\n <span class=\"ship-price\">\n ${formatPrice(o.priceMajor ?? o.price / 100, o.currency || currency)}\n </span>\n </button>\n `,\n )}\n </div>\n `\n : ''}\n ${this.klarnaCategories.length > 1\n ? html`\n <div class=\"klarna-cats\">\n ${this.klarnaCategories.map(\n (c) => html`\n <button\n class=\"klarna-cat ${this.klarnaSelectedCat === c.identifier ? 'active' : ''}\"\n @click=${() => void this.onKlarnaCategory(c.identifier)}\n >\n ${c.name}\n </button>\n `,\n )}\n </div>\n `\n : ''}\n ${this.klarnaMounting\n ? html`\n <div style=\"padding: 20px; text-align: center; color: var(--vio-color-text-secondary, #666); font-size: 14px;\">\n Klargjør Klarna-betaling…\n </div>\n `\n : ''}\n <div class=\"klarna-widget\" id=\"vio-klarna-payments-container\"></div>\n <button\n class=\"payment-btn primary complete-cta\"\n @click=${() => void this.onKlarnaAuthorize()}\n ?disabled=${this.klarnaAuthorizing ||\n !this.klarnaHandle ||\n this.klarnaMounting ||\n (!this.express && (!this.isAddressValid || !this.hasSelectedShipping))}\n >\n ${this.klarnaAuthorizing\n ? 'Behandler…'\n : this.klarnaMounting\n ? 'Klargjør Klarna…'\n : `Betal ${this.payTotalLabel()} med Klarna`}\n </button>\n </div>\n `\n }\n\n /** Express layout — only the Klarna widget + a compact order summary. */\n private renderKlarnaExpress() {\n const currency = this.checkoutState?.currency || getGlobalCurrency()\n if (!this.klarnaAvailable) {\n // Klarna's script can be blocked (adblocker / CSP) — never leave the\n // buyer in a dead end with a permanently disabled button.\n return html`\n <section class=\"section\">\n <h3 class=\"section-heading\">Kjøp med Klarna</h3>\n <div class=\"payment-error\">\n Klarna er ikke tilgjengelig akkurat nå (kan være blokkert av nettleseren).\n </div>\n <button\n class=\"payment-btn primary complete-cta\"\n @click=${() => {\n this.express = false\n }}\n >\n Gå til vanlig kasse\n </button>\n </section>\n `\n }\n return html`\n <section class=\"section\">\n <h3 class=\"section-heading\">Kjøp med Klarna</h3>\n ${this.items.length > 0\n ? html`\n <div class=\"express-summary\">\n ${this.items.map(\n (item) => html`\n <div class=\"order-row\">\n <span>${item.brand ? `${item.brand} ` : ''}${item.name} ×${item.quantity}</span>\n <span>${formatPrice(item.unitPrice * item.quantity, item.currency || currency)}</span>\n </div>\n `,\n )}\n <div class=\"order-row\">\n <span>Frakt${this.shippingOption ? ` – ${this.shippingOption.method}` : ''}</span>\n <span>${formatPrice(this.shippingMajor(), currency)}</span>\n </div>\n <div class=\"order-row total\">\n <span>Totalt</span><span>${this.payTotalLabel()}</span>\n </div>\n </div>\n `\n : ''}\n ${this.shippingBlocked ? this.renderShippingBlocked() : this.renderKlarnaPanel()}\n ${this.paymentNotice\n ? html`<div class=\"payment-notice\">${this.paymentNotice}</div>`\n : ''}\n ${this.paymentError\n ? html`<div class=\"payment-error\">${this.paymentError}</div>`\n : ''}\n </section>\n `\n }\n\n private renderCheckoutBody() {\n const method = this.checkoutState?.paymentMethod\n const showCompleteCta = !!method && !this.isExpressMethod(method)\n // Method first (Angelo, 2026-09-22): our delivery form is asked only once\n // the shopper has chosen a method that needs it. Asking it up front made\n // anyone who then chose Nexi, Qliro, Kustom or Walley type it all again\n // in the provider's widget (Alan, QA 2026-09-21). With a single method\n // there is no choice to make: it is selected on opening\n // (autoSelectSoleMethod), so the form — or the widget — comes straight up.\n const needsOurForm = !!method && !collectsOwnAddress(method)\n return html`\n ${needsOurForm\n ? html`\n <section class=\"section address-section\">\n <div class=\"section-label\">Steg 1</div>\n <h3 class=\"section-heading\">Leveringsadresse</h3>\n <div class=\"form-row\">\n <div class=\"field\">\n <label>Fornavn *</label>\n <input\n type=\"text\"\n required\n autocomplete=\"given-name\"\n .value=${this.form.firstName}\n @input=${(e: InputEvent) =>\n this.onFieldChange('firstName', (e.target as HTMLInputElement).value)}\n />\n </div>\n <div class=\"field\">\n <label>Etternavn *</label>\n <input\n type=\"text\"\n required\n autocomplete=\"family-name\"\n .value=${this.form.lastName}\n @input=${(e: InputEvent) =>\n this.onFieldChange('lastName', (e.target as HTMLInputElement).value)}\n />\n </div>\n </div>\n <div class=\"field\">\n <label>E-post *</label>\n <input\n type=\"email\"\n required\n autocomplete=\"email\"\n .value=${this.form.email}\n @input=${(e: InputEvent) =>\n this.onFieldChange('email', (e.target as HTMLInputElement).value)}\n />\n </div>\n <div class=\"field\">\n <label for=\"vio-checkout-phone\">${this.phoneRequired ? 'Mobilnummer *' : 'Mobilnummer (valgfritt)'}</label>\n <input\n id=\"vio-checkout-phone\"\n class=\"phone-input\"\n type=\"tel\"\n ?required=${this.phoneRequired}\n inputmode=\"tel\"\n autocomplete=\"tel\"\n placeholder=${this.phoneCountry.toUpperCase() === 'NO' ? '8 siffer' : '+46 70 123 45 67'}\n aria-invalid=${this.phoneError ? 'true' : 'false'}\n .value=${this.form.phone ?? ''}\n @input=${(e: InputEvent) =>\n this.onFieldChange('phone', (e.target as HTMLInputElement).value)}\n />\n ${this.phoneError\n ? html`<div class=\"field-error\" role=\"alert\">Skriv et gyldig mobilnummer (med landskode, f.eks. +46, hvis det ikke er norsk)</div>`\n : ''}\n </div>\n <div class=\"field\">\n <label>Adresse *</label>\n <input\n type=\"text\"\n required\n autocomplete=\"street-address\"\n .value=${this.form.address}\n @input=${(e: InputEvent) =>\n this.onFieldChange('address', (e.target as HTMLInputElement).value)}\n />\n </div>\n <div class=\"form-row\">\n <div class=\"field\">\n <label>Postnummer *</label>\n <input\n type=\"text\"\n required\n autocomplete=\"postal-code\"\n .value=${this.form.postalCode}\n @input=${(e: InputEvent) =>\n this.onFieldChange('postalCode', (e.target as HTMLInputElement).value)}\n />\n </div>\n <div class=\"field\">\n <label>Sted *</label>\n <input\n type=\"text\"\n required\n autocomplete=\"address-level2\"\n .value=${this.form.city}\n @input=${(e: InputEvent) =>\n this.onFieldChange('city', (e.target as HTMLInputElement).value)}\n />\n </div>\n </div>\n ${this.availableShippingsList.length > 0\n ? html`\n <div style=\"margin-top: 16px;\">\n <label style=\"display: block; font-weight: 600; font-size: 13px; margin-bottom: 8px;\">\n Fraktmetode *\n </label>\n <div class=\"ship-select\">\n ${this.availableShippingsList.map(\n (o) => html`\n <button\n type=\"button\"\n class=\"ship-opt ${this.selectedShipping === o.id ? 'active' : ''}\"\n @click=${() => void this.onSelectShipping(o.id)}\n >\n <span class=\"ship-meta\">\n <b>${o.method || o.name}</b>\n ${o.description ? html`<span>${o.description}</span>` : ''}\n </span>\n <span class=\"ship-price\">\n ${formatPrice(\n o.priceMajor ?? o.price / 100,\n o.currency || this.checkoutState?.currency || 'NOK',\n )}\n </span>\n </button>\n `,\n )}\n </div>\n </div>\n `\n : ''}\n </section>\n `\n : ''}\n\n <section class=\"section\">\n <div class=\"section-label\">\n ${needsOurForm ? 'Steg 2' : 'Betaling'}\n </div>\n ${this.shippingBlocked\n ? this.renderShippingBlocked()\n : method\n ? html`\n <div style=\"display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;\">\n <h3 class=\"section-heading\" style=\"margin:0;\">\n Betalingsmåte: <b>${this.methodLabel(method)}</b>\n </h3>\n ${(this.availableMethods?.length ?? 2) > 1\n ? html`\n <button\n type=\"button\"\n style=\"background:none; border:none; color:var(--vio-color-accent, #c14a3b); text-decoration:underline; font-size:13px; cursor:pointer;\"\n @click=${() => {\n this.unmountKlarna()\n this.unmountKustom()\n this.unmountQliro()\n this.unmountWalley()\n this.unmountNexi()\n this.unmountAdyen()\n Vio.checkout.selectPaymentMethod('' as PaymentMethod)\n }}\n >\n Endre\n </button>\n `\n : ''}\n </div>\n\n ${method === 'klarna' ? this.renderKlarnaPanel() : ''}\n ${method === 'kustom' ? this.renderKustomPanel() : ''}\n ${method === 'qliro' ? this.renderQliroPanel() : ''}\n ${method === 'walley' ? this.renderWalleyPanel() : ''}\n ${method === 'nexi' ? this.renderNexiPanel() : ''}\n ${method === 'adyen' ? this.renderAdyenPanel() : ''}\n ${method === 'stripe' && this.stripeMode === 'native'\n ? this.renderStripePanel()\n : ''}\n ${method === 'stripe' && this.stripeMode !== 'native'\n ? html`\n <button\n class=\"payment-btn primary complete-cta\"\n @click=${() => void this.onPay('stripe')}\n ?disabled=${this.stripeLoading || !this.cartPayable || !this.isAddressValid || !this.hasSelectedShipping}\n title=${!this.isAddressValid\n ? 'Vennligst fyll ut leveringsadresse'\n : !this.hasSelectedShipping\n ? 'Vennligst velg en fraktmetode'\n : ''}\n >\n ${this.stripeLoading\n ? 'Går til Stripe…'\n : `Betal ${this.payTotalLabel()} med Stripe`}\n </button>\n `\n : ''}\n ${method === 'vipps'\n ? html`\n <button\n class=\"payment-btn primary complete-cta\"\n @click=${() => void this.onPay('vipps')}\n ?disabled=${this.vippsLoading || !this.cartPayable || !this.isAddressValid || !this.hasSelectedShipping}\n title=${!this.isAddressValid\n ? 'Vennligst fyll ut leveringsadresse'\n : !this.hasSelectedShipping\n ? 'Vennligst velg en fraktmetode'\n : ''}\n >\n ${this.vippsLoading\n ? 'Går til Vipps…'\n : `Betal ${this.payTotalLabel()} med Vipps`}\n </button>\n `\n : ''}\n ${method === 'apple-pay'\n ? html`\n <button\n class=\"payment-btn primary complete-cta\"\n @click=${() => void this.onPay('apple-pay')}\n ?disabled=${this.applePayInProgress || !this.cartPayable || !this.isAddressValid || !this.hasSelectedShipping}\n title=${!this.isAddressValid\n ? 'Vennligst fyll ut leveringsadresse'\n : !this.hasSelectedShipping\n ? 'Vennligst velg en fraktmetode'\n : ''}\n >\n ${this.applePayInProgress\n ? 'Åpner…'\n : `Betal ${this.payTotalLabel()} med Apple Pay`}\n </button>\n `\n : ''}\n ${showCompleteCta && method !== 'stripe' && method !== 'vipps'\n ? html`\n <button\n class=\"payment-btn primary complete-cta\"\n @click=${this.onCompleteOrder}\n ?disabled=${!this.cartPayable || !this.isAddressValid || !this.hasSelectedShipping}\n title=${!this.isAddressValid\n ? 'Vennligst fyll ut leveringsadresse'\n : !this.hasSelectedShipping\n ? 'Vennligst velg en fraktmetode'\n : ''}\n >\n Betal ${this.payTotalLabel()} med ${this.methodLabel(method ?? null)}\n </button>\n `\n : ''}\n ${needsOurForm && !this.isAddressValid\n ? html`\n <div style=\"font-size: 12px; color: var(--vio-color-accent, #c14a3b); text-align: center; margin-top: 8px;\">\n Vennligst fyll ut leveringsadresse for å fullføre betalingen\n </div>\n `\n : needsOurForm && !this.hasSelectedShipping\n ? html`\n <div style=\"font-size: 12px; color: var(--vio-color-accent, #c14a3b); text-align: center; margin-top: 8px;\">\n Vennligst velg en fraktmetode for å fullføre betalingen\n </div>\n `\n : ''}\n `\n : !this.paymentMethodsResolved\n ? html`\n <h3 class=\"section-heading\">Velg betalingsmåte</h3>\n <div class=\"payment-loading\">\n <span class=\"payment-spinner\" aria-hidden=\"true\"></span>\n <span>Henter betalingsmåter…</span>\n </div>\n `\n : html`\n <h3 class=\"section-heading\">Velg betalingsmåte</h3>\n <div class=\"payment-grid\">\n ${this.methodEnabled('apple-pay') &&\n this.applePayAvailable &&\n !this.stripeOwnsWallets()\n ? html`\n <button\n class=\"payment-btn primary\"\n @click=${() => this.onPay('apple-pay')}\n ?disabled=${this.applePayInProgress}\n >\n ${this.applePayInProgress\n ? 'Åpner…'\n : html`<span style=\"display:inline-flex;align-items:center;gap:6px\"><svg viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\" style=\"width:18px;height:18px\"><path d=\"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z\"/></svg>Apple Pay</span>`}\n </button>\n `\n : ''}\n ${this.methodEnabled('stripe')\n ? html`\n <button\n class=\"payment-btn\"\n @click=${() => this.onPay('stripe')}\n ?disabled=${this.stripeLoading}\n >\n <img src=${STRIPE_LOGO_SRC} style=\"height: 20px; display: block;\" alt=\"Stripe\" />\n </button>\n `\n : ''}\n ${this.methodEnabled('klarna') && this.klarnaAvailable\n ? html`\n <button class=\"payment-btn\" @click=${() => this.onPay('klarna')}>\n Klarna\n </button>\n `\n : ''}\n ${this.methodEnabled('kustom')\n ? html`\n <button class=\"payment-btn\" @click=${() => this.onPay('kustom')}>\n <span style=\"font-weight:800;font-size:16px;letter-spacing:-0.01em\">Kustom</span>\n </button>\n `\n : ''}\n ${this.methodEnabled('qliro')\n ? html`\n <button class=\"payment-btn\" @click=${() => this.onPay('qliro')}>\n <span style=\"font-weight:800;font-size:16px;letter-spacing:-0.01em\">Qliro</span>\n </button>\n `\n : ''}\n ${this.methodEnabled('walley')\n ? html`\n <button class=\"payment-btn\" @click=${() => this.onPay('walley')}>\n <span style=\"font-weight:800;font-size:16px;letter-spacing:-0.01em\">Walley</span>\n </button>\n `\n : ''}\n ${this.methodEnabled('nexi')\n ? html`\n <button class=\"payment-btn\" @click=${() => this.onPay('nexi')}>\n <span style=\"font-weight:800;font-size:16px;letter-spacing:-0.01em\">Nexi</span>\n </button>\n `\n : ''}\n ${this.methodEnabled('adyen')\n ? html`\n <button class=\"payment-btn\" @click=${() => this.onPay('adyen')}>\n <span style=\"font-weight:700;font-size:15px;letter-spacing:-0.01em\">${this.methodLabel('adyen')}</span>\n </button>\n `\n : ''}\n ${this.methodEnabled('vipps')\n ? html`\n <button class=\"payment-btn\" @click=${() => this.onPay('vipps')} aria-label=\"Vipps\">\n ${this.vippsOfficial\n ? html`<vipps-mobilepay-button\n brand=\"vipps\"\n variant=\"primary\"\n rounded=\"true\"\n compact=\"true\"\n style=\"pointer-events:none\"\n ></vipps-mobilepay-button>`\n : html`<span style=\"color:#ff5b24;font-weight:800;font-size:17px;letter-spacing:-0.02em\">vipps</span>`}\n </button>\n `\n : ''}\n </div>\n `}\n ${this.paymentNotice\n ? html`<div class=\"payment-notice\">${this.paymentNotice}</div>`\n : ''}\n ${this.paymentError\n ? html`<div class=\"payment-error\">${this.paymentError}</div>`\n : ''}\n </section>\n\n ${this.items.length > 0\n ? html`\n <section class=\"order-summary\">\n ${this.items.map(\n (item) => html`\n <div class=\"order-line\">\n <div class=\"order-line-img\">\n ${item.imageUrl\n ? html`<img src=${item.imageUrl} alt=${item.name} />`\n : ''}\n </div>\n <div class=\"order-line-meta\">\n <span>${item.brand}</span>\n <b>${item.name}</b>\n <span>×${item.quantity}</span>\n </div>\n <div class=\"order-line-price\">\n ${formatPrice(item.unitPrice * item.quantity, item.currency)}\n </div>\n </div>\n `,\n )}\n <div class=\"order-row\" style=\"margin-top: 16px;\">\n <span>Sum</span><span>${this.orderTotal()}</span>\n </div>\n <div class=\"order-row\">\n <span>Frakt${this.shippingMajor() > 0 && this.summaryShippingName() ? ` – ${this.summaryShippingName()}` : ''}</span>\n <span>${this.shippingMajor() > 0\n ? formatPrice(this.shippingMajor(), this.checkoutState?.currency)\n : this.shippingLabel}</span>\n </div>\n <div class=\"order-row total\">\n <span>Totalt</span><span>${this.payTotalLabel()}</span>\n </div>\n </section>\n `\n : ''}\n </div>\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vio-checkout': VioCheckout\n }\n}\n","/**\n * Vio elements — owns the `<vio-*>` custom-element classes and their registration.\n *\n * WHY REGISTRATION IS A FUNCTION (not `@customElement` module side-effects):\n * Both `./ui` and `./react` need the component classes, so the bundler hoists\n * them into a *hashed* shared chunk that package.json `sideEffects` can't name.\n * If registration were a module-eval side-effect (`@customElement`), a\n * consumer's tree-shaker would drop that chunk on a bare `import '.../ui'` and\n * the elements would never `define`. Instead, `registerVioElements()` is a\n * *called value*: any sideEffects-listed entry that calls it (see ui/index +\n * react/index) keeps the function and the classes it references — regardless of\n * chunking — while `./core` stays free of these side-effects and remains\n * tree-shakeable. See lessons/web-sdk-tsup-singleton-and-build.\n */\n\nimport { VioProduct } from './components/vio-product.js'\nimport { VioProductCarousel } from './components/vio-product-carousel.js'\nimport { VioProductDetail } from './components/vio-product-detail.js'\nimport { VioCart } from './components/vio-cart.js'\nimport { VioCheckout } from './components/vio-checkout.js'\n\nexport { VioProduct, VioProductCarousel, VioProductDetail, VioCart, VioCheckout }\n\n/**\n * Register every `<vio-*>` custom element. Idempotent (skips already-defined\n * tags, so calling it from both `./ui` and `./react` is safe) and SSR-safe\n * (no-op when `customElements` is undefined).\n */\nexport function registerVioElements(): void {\n if (\n typeof customElements === 'undefined' ||\n typeof customElements.get !== 'function' ||\n typeof customElements.define !== 'function'\n )\n return\n const defs: Array<[string, CustomElementConstructor]> = [\n ['vio-product', VioProduct],\n ['vio-product-carousel', VioProductCarousel],\n ['vio-product-detail', VioProductDetail],\n ['vio-cart', VioCart],\n ['vio-checkout', VioCheckout],\n ]\n for (const [tag, ctor] of defs) {\n if (!customElements.get(tag)) customElements.define(tag, ctor)\n }\n}\n"]}
|