@vio-live/web-sdk 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +2 -0
- package/dist/{chunk-QA5R4VYF.js → chunk-6PQFXUOW.js} +19 -4
- package/dist/chunk-6PQFXUOW.js.map +1 -0
- package/dist/{chunk-F7LE5AZY.js → chunk-DEREQRCM.js} +119 -69
- package/dist/chunk-DEREQRCM.js.map +1 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +3 -3
- package/dist/{tokens-C-LsqKQH.d.ts → tokens-BGzSC3vK.d.ts} +17 -2
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-F7LE5AZY.js.map +0 -1
- package/dist/chunk-QA5R4VYF.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vio, __decorateClass, primaryImageUrl, displayPrice, resolveDetailLayout, toCampaignId, getGlobalCurrency, copyAppliedLayout, onGlobalDetailLayoutChange, layoutSignature, layoutOriginOf, ensureVippsButton, formatPrice, shippingDescriptionOf, buyerRefOf, nexiReturnPaymentId, readNexiPending, kustomReturnOutcome, KUSTOM_RETURN_QUERY_KEYS, storageGet, ADYEN_RETURN_METHOD, adyenReturnParams, ADYEN_RETURN_QUERY_KEYS, adyenReturnOutcome, getGlobalCountryCode, isValidPhone, gatewayHasBuyerRef, rememberedCheckoutSponsor, checkoutSponsorOf, AdyenOriginError, normalizeSlotId, autoSlotDisplayName, autoSlotId, sponsorIdentityFrom, Configuration, normalizeScope, campaignCandidates } from './chunk-
|
|
1
|
+
import { Vio, __decorateClass, primaryImageUrl, displayPrice, resolveDetailLayout, toCampaignId, getGlobalCurrency, copyAppliedLayout, onGlobalDetailLayoutChange, layoutSignature, layoutOriginOf, ensureVippsButton, formatPrice, currentGlobalDescriptionLabel, shippingDescriptionOf, buyerRefOf, nexiReturnPaymentId, readNexiPending, kustomReturnOutcome, KUSTOM_RETURN_QUERY_KEYS, storageGet, ADYEN_RETURN_METHOD, adyenReturnParams, ADYEN_RETURN_QUERY_KEYS, adyenReturnOutcome, getGlobalCountryCode, isValidPhone, gatewayHasBuyerRef, rememberedCheckoutSponsor, checkoutSponsorOf, AdyenOriginError, normalizeSlotId, autoSlotDisplayName, autoSlotId, sponsorIdentityFrom, Configuration, normalizeScope, campaignCandidates } from './chunk-6PQFXUOW.js';
|
|
2
2
|
import { LitElement, css, html, nothing } from 'lit';
|
|
3
3
|
import { property, state, query } from 'lit/decorators.js';
|
|
4
4
|
|
|
@@ -171,6 +171,7 @@ var THEME_KEY_TO_CSS_VAR = {
|
|
|
171
171
|
detailDescriptionPreviewLines: "--vio-detail-description-preview-lines",
|
|
172
172
|
detailHighlightsDisplay: "--vio-detail-highlights-display",
|
|
173
173
|
detailShippingReturnsDisplay: "--vio-detail-shipping-returns-display",
|
|
174
|
+
cartHighlightsDisplay: "--vio-cart-highlights-display",
|
|
174
175
|
detailThumbSize: "--vio-detail-thumb-size",
|
|
175
176
|
detailThumbGap: "--vio-detail-thumb-gap",
|
|
176
177
|
detailThumbRadius: "--vio-detail-thumb-radius",
|
|
@@ -2051,6 +2052,67 @@ function unlockPageScroll() {
|
|
|
2051
2052
|
window.scrollTo(0, scrollY);
|
|
2052
2053
|
root.style.scrollBehavior = behavior;
|
|
2053
2054
|
}
|
|
2055
|
+
var HIGHLIGHT_ICONS = {
|
|
2056
|
+
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",
|
|
2057
|
+
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",
|
|
2058
|
+
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",
|
|
2059
|
+
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",
|
|
2060
|
+
return: "M4 9h11.5a4.5 4.5 0 0 1 0 9H8M4 9l4-4M4 9l4 4",
|
|
2061
|
+
leaf: "M5 19C5 10 10 4.5 20 4.5c0 10-5.5 15-14 15M5 19l7-7",
|
|
2062
|
+
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",
|
|
2063
|
+
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",
|
|
2064
|
+
mailbox: "M3 19v-8a4 4 0 0 1 8 0v8m-8 0h18v-7a4 4 0 0 0-4-4H7m8 0V4h3M6 12h2",
|
|
2065
|
+
home: "M3 11 12 4l9 7M5.5 9.5V20h13V9.5M10 20v-5h4v5",
|
|
2066
|
+
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",
|
|
2067
|
+
clock: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l3 2"
|
|
2068
|
+
};
|
|
2069
|
+
function renderHighlights(items) {
|
|
2070
|
+
const list = (Array.isArray(items) ? items : []).filter((h) => h && h.title);
|
|
2071
|
+
if (list.length === 0) return nothing;
|
|
2072
|
+
return html`<ul class="highlights" part="highlights">
|
|
2073
|
+
${list.map((h) => {
|
|
2074
|
+
const path = h.icon ? HIGHLIGHT_ICONS[h.icon] : void 0;
|
|
2075
|
+
const icon = path ? html`<svg class="hl-icon" viewBox="0 0 24 24" aria-hidden="true"><path d=${path}></path></svg>` : h.icon ? html`<img class="hl-icon" src=${h.icon} alt="" />` : nothing;
|
|
2076
|
+
return html`<li class="hl" part="highlight">
|
|
2077
|
+
${icon}
|
|
2078
|
+
<span class="hl-title">${h.title}</span>
|
|
2079
|
+
${h.text ? html`<span class="hl-text">${h.text}</span>` : nothing}
|
|
2080
|
+
</li>`;
|
|
2081
|
+
})}
|
|
2082
|
+
</ul>`;
|
|
2083
|
+
}
|
|
2084
|
+
function highlightsStyles(scope) {
|
|
2085
|
+
const display = scope === "detail" ? css`var(--vio-detail-highlights-display, grid)` : css`var(--vio-cart-highlights-display, grid)`;
|
|
2086
|
+
const padding = scope === "detail" ? css`var(--vio-detail-highlights-padding, 16px 0 2px)` : css`var(--vio-cart-highlights-padding, 14px 0 2px)`;
|
|
2087
|
+
return css`
|
|
2088
|
+
/* Like a shop's trust strip: a thin icon, the promise in regular weight,
|
|
2089
|
+
a smaller line under it — nothing bold. */
|
|
2090
|
+
.highlights {
|
|
2091
|
+
list-style: none;
|
|
2092
|
+
margin: 0;
|
|
2093
|
+
padding: ${padding};
|
|
2094
|
+
display: ${display};
|
|
2095
|
+
grid-auto-flow: column;
|
|
2096
|
+
grid-auto-columns: 1fr;
|
|
2097
|
+
gap: 10px;
|
|
2098
|
+
border-top: 1px solid var(--vio-color-border, #e5e5e5);
|
|
2099
|
+
}
|
|
2100
|
+
.hl { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
|
|
2101
|
+
.hl-icon {
|
|
2102
|
+
width: var(--vio-detail-highlight-icon-size, 22px);
|
|
2103
|
+
height: var(--vio-detail-highlight-icon-size, 22px);
|
|
2104
|
+
margin-bottom: 8px;
|
|
2105
|
+
fill: none;
|
|
2106
|
+
stroke: currentColor;
|
|
2107
|
+
stroke-width: 1.2;
|
|
2108
|
+
stroke-linecap: round;
|
|
2109
|
+
stroke-linejoin: round;
|
|
2110
|
+
object-fit: contain;
|
|
2111
|
+
}
|
|
2112
|
+
.hl-title { font-size: 12px; font-weight: 400; line-height: 1.3; letter-spacing: 0.01em; color: var(--vio-color-text, #0a0a0a); }
|
|
2113
|
+
.hl-text { font-size: 10.5px; line-height: 1.35; letter-spacing: 0.01em; color: var(--vio-color-text-secondary, #666); }
|
|
2114
|
+
`;
|
|
2115
|
+
}
|
|
2054
2116
|
|
|
2055
2117
|
// src/ui/components/vio-product-detail.ts
|
|
2056
2118
|
var layoutAttribute = {
|
|
@@ -2070,20 +2132,6 @@ var ADDED_TOAST_MS = 8e3;
|
|
|
2070
2132
|
var STRIPE_LOGO_SRC = "data:image/svg+xml;utf8," + encodeURIComponent(
|
|
2071
2133
|
'<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>'
|
|
2072
2134
|
);
|
|
2073
|
-
var HIGHLIGHT_ICONS = {
|
|
2074
|
-
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",
|
|
2075
|
-
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",
|
|
2076
|
-
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",
|
|
2077
|
-
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",
|
|
2078
|
-
return: "M4 9h11.5a4.5 4.5 0 0 1 0 9H8M4 9l4-4M4 9l4 4",
|
|
2079
|
-
leaf: "M5 19C5 10 10 4.5 20 4.5c0 10-5.5 15-14 15M5 19l7-7",
|
|
2080
|
-
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",
|
|
2081
|
-
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",
|
|
2082
|
-
mailbox: "M3 19v-8a4 4 0 0 1 8 0v8m-8 0h18v-7a4 4 0 0 0-4-4H7m8 0V4h3M6 12h2",
|
|
2083
|
-
home: "M3 11 12 4l9 7M5.5 9.5V20h13V9.5M10 20v-5h4v5",
|
|
2084
|
-
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",
|
|
2085
|
-
clock: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-13.5V12l3 2"
|
|
2086
|
-
};
|
|
2087
2135
|
function rateIcon(method) {
|
|
2088
2136
|
const m = method.toLowerCase();
|
|
2089
2137
|
if (/postkasse|mailbox|brevkasse/.test(m)) return "mailbox";
|
|
@@ -2119,6 +2167,7 @@ var VioProductDetail = class extends LitElement {
|
|
|
2119
2167
|
this.vippsCartPayment = "";
|
|
2120
2168
|
this.gallery = "";
|
|
2121
2169
|
this.descriptionMode = "";
|
|
2170
|
+
this.descriptionLabel = "";
|
|
2122
2171
|
this.highlights = [];
|
|
2123
2172
|
this.deliveryTime = "";
|
|
2124
2173
|
this.carrierLogos = {};
|
|
@@ -2307,7 +2356,8 @@ var VioProductDetail = class extends LitElement {
|
|
|
2307
2356
|
};
|
|
2308
2357
|
}
|
|
2309
2358
|
static {
|
|
2310
|
-
this.styles =
|
|
2359
|
+
this.styles = [
|
|
2360
|
+
css`
|
|
2311
2361
|
:host { display: contents; }
|
|
2312
2362
|
|
|
2313
2363
|
.backdrop {
|
|
@@ -2680,35 +2730,6 @@ var VioProductDetail = class extends LitElement {
|
|
|
2680
2730
|
margin: 0;
|
|
2681
2731
|
letter-spacing: -0.01em;
|
|
2682
2732
|
}
|
|
2683
|
-
/* The brand's promises: one row, an icon over a title and a line of text,
|
|
2684
|
-
centred like a shop's own trust strip. */
|
|
2685
|
-
.highlights {
|
|
2686
|
-
list-style: none;
|
|
2687
|
-
/* --vio-detail-highlights-display: none hides the strip (theme detailHighlightsDisplay). */
|
|
2688
|
-
margin: 0;
|
|
2689
|
-
padding: var(--vio-detail-highlights-padding, 16px 0 2px);
|
|
2690
|
-
display: var(--vio-detail-highlights-display, grid);
|
|
2691
|
-
grid-auto-flow: column;
|
|
2692
|
-
grid-auto-columns: 1fr;
|
|
2693
|
-
gap: 10px;
|
|
2694
|
-
border-top: 1px solid var(--vio-color-border, #e5e5e5);
|
|
2695
|
-
}
|
|
2696
|
-
/* Like a shop's trust strip: a thin icon, the promise in regular weight,
|
|
2697
|
-
a smaller line under it — nothing bold. */
|
|
2698
|
-
.hl { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
|
|
2699
|
-
.hl-icon {
|
|
2700
|
-
width: var(--vio-detail-highlight-icon-size, 22px);
|
|
2701
|
-
height: var(--vio-detail-highlight-icon-size, 22px);
|
|
2702
|
-
margin-bottom: 8px;
|
|
2703
|
-
fill: none;
|
|
2704
|
-
stroke: currentColor;
|
|
2705
|
-
stroke-width: 1.2;
|
|
2706
|
-
stroke-linecap: round;
|
|
2707
|
-
stroke-linejoin: round;
|
|
2708
|
-
object-fit: contain;
|
|
2709
|
-
}
|
|
2710
|
-
.hl-title { font-size: 12px; font-weight: 400; line-height: 1.3; letter-spacing: 0.01em; color: var(--vio-color-text, #0a0a0a); }
|
|
2711
|
-
.hl-text { font-size: 10.5px; line-height: 1.35; letter-spacing: 0.01em; color: var(--vio-color-text-secondary, #666); }
|
|
2712
2733
|
/* «Frakt & retur»: same fold as «Beskrivelse», with a small list of rates.
|
|
2713
2734
|
--vio-detail-shipping-returns-display: none hides it (theme detailShippingReturnsDisplay). */
|
|
2714
2735
|
.shipping-returns { display: var(--vio-detail-shipping-returns-display, block); }
|
|
@@ -3253,7 +3274,9 @@ var VioProductDetail = class extends LitElement {
|
|
|
3253
3274
|
color: var(--vio-color-accent, #c14a3b);
|
|
3254
3275
|
font-size: 14px;
|
|
3255
3276
|
}
|
|
3256
|
-
|
|
3277
|
+
`,
|
|
3278
|
+
highlightsStyles("detail")
|
|
3279
|
+
];
|
|
3257
3280
|
}
|
|
3258
3281
|
connectedCallback() {
|
|
3259
3282
|
super.connectedCallback();
|
|
@@ -4237,11 +4260,16 @@ var VioProductDetail = class extends LitElement {
|
|
|
4237
4260
|
* the heading, the text or «Les mer» opens the rest (Angelo, 2026-10-28).
|
|
4238
4261
|
* A description that fits in the preview has nothing to open.
|
|
4239
4262
|
*/
|
|
4263
|
+
/** The description fold's heading: this element's, else the page's, else «Beskrivelse». */
|
|
4264
|
+
descriptionHeading() {
|
|
4265
|
+
const own = this.descriptionLabel.trim();
|
|
4266
|
+
return (own && own.length <= 40 ? own : "") || currentGlobalDescriptionLabel() || "Beskrivelse";
|
|
4267
|
+
}
|
|
4240
4268
|
renderDescription(text) {
|
|
4241
4269
|
const mode = this.resolvedDescriptionMode;
|
|
4242
4270
|
if (mode === "open") {
|
|
4243
4271
|
return html`<div class="description-block description-preview open" part="description">
|
|
4244
|
-
<div class="desc-head"
|
|
4272
|
+
<div class="desc-head">${this.descriptionHeading()}</div>
|
|
4245
4273
|
<div class="description">${text}</div>
|
|
4246
4274
|
</div>`;
|
|
4247
4275
|
}
|
|
@@ -4251,7 +4279,7 @@ var VioProductDetail = class extends LitElement {
|
|
|
4251
4279
|
if (foldable) this.descriptionOpen = !this.descriptionOpen;
|
|
4252
4280
|
};
|
|
4253
4281
|
return html`<div class="description-block description-preview ${open ? "open" : ""} ${foldable ? "clipped" : ""} ${mode}" part="description">
|
|
4254
|
-
<button class="desc-head" type="button" aria-expanded=${open ? "true" : "false"} @click=${toggle}
|
|
4282
|
+
<button class="desc-head" type="button" aria-expanded=${open ? "true" : "false"} @click=${toggle}>${this.descriptionHeading()}</button>
|
|
4255
4283
|
${mode === "folded" && !open ? nothing : html`<div class="description ${open ? "" : "collapsed"}" @click=${() => !this.descriptionOpen && toggle()}>${text}</div>`}
|
|
4256
4284
|
${mode === "preview" && this.descriptionClipped ? html`<button class="desc-more" type="button" @click=${toggle}>${this.descriptionOpen ? "Vis mindre" : "Les mer"}</button>` : nothing}
|
|
4257
4285
|
</div>`;
|
|
@@ -4268,19 +4296,7 @@ var VioProductDetail = class extends LitElement {
|
|
|
4268
4296
|
}
|
|
4269
4297
|
renderHighlights() {
|
|
4270
4298
|
const own = (Array.isArray(this.highlights) ? this.highlights : []).filter((h) => h && h.title);
|
|
4271
|
-
|
|
4272
|
-
if (items.length === 0) return nothing;
|
|
4273
|
-
return html`<ul class="highlights" part="highlights">
|
|
4274
|
-
${items.map((h) => {
|
|
4275
|
-
const path = h.icon ? HIGHLIGHT_ICONS[h.icon] : void 0;
|
|
4276
|
-
const icon = path ? html`<svg class="hl-icon" viewBox="0 0 24 24" aria-hidden="true"><path d=${path}></path></svg>` : h.icon ? html`<img class="hl-icon" src=${h.icon} alt="" />` : nothing;
|
|
4277
|
-
return html`<li class="hl" part="highlight">
|
|
4278
|
-
${icon}
|
|
4279
|
-
<span class="hl-title">${h.title}</span>
|
|
4280
|
-
${h.text ? html`<span class="hl-text">${h.text}</span>` : nothing}
|
|
4281
|
-
</li>`;
|
|
4282
|
-
})}
|
|
4283
|
-
</ul>`;
|
|
4299
|
+
return renderHighlights(own.length ? own : resolveSponsorIdentity(this.sponsorId)?.highlights ?? []);
|
|
4284
4300
|
}
|
|
4285
4301
|
/**
|
|
4286
4302
|
* «Frakt & retur», folded like «Beskrivelse»: the delivery options for the
|
|
@@ -4748,8 +4764,8 @@ var VioProductDetail = class extends LitElement {
|
|
|
4748
4764
|
})}`;
|
|
4749
4765
|
}
|
|
4750
4766
|
/** Best-effort HTML strip for description. */
|
|
4751
|
-
stripHtml(
|
|
4752
|
-
return
|
|
4767
|
+
stripHtml(html8) {
|
|
4768
|
+
return html8.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n\n").replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").trim();
|
|
4753
4769
|
}
|
|
4754
4770
|
};
|
|
4755
4771
|
__decorateClass([
|
|
@@ -4800,6 +4816,9 @@ __decorateClass([
|
|
|
4800
4816
|
__decorateClass([
|
|
4801
4817
|
property({ type: String, attribute: "description-mode" })
|
|
4802
4818
|
], VioProductDetail.prototype, "descriptionMode", 2);
|
|
4819
|
+
__decorateClass([
|
|
4820
|
+
property({ type: String, attribute: "description-label" })
|
|
4821
|
+
], VioProductDetail.prototype, "descriptionLabel", 2);
|
|
4803
4822
|
__decorateClass([
|
|
4804
4823
|
property({ type: Array })
|
|
4805
4824
|
], VioProductDetail.prototype, "highlights", 2);
|
|
@@ -4931,6 +4950,12 @@ function cartShipping(items, currency) {
|
|
|
4931
4950
|
}
|
|
4932
4951
|
return null;
|
|
4933
4952
|
}
|
|
4953
|
+
function cartShippingIsFrom(items, currency) {
|
|
4954
|
+
if (items.some((item) => ratePrice(item.shipping, currency) !== null)) return false;
|
|
4955
|
+
return items.some(
|
|
4956
|
+
(item) => (item.availableShippings ?? []).filter((r) => ratePrice(r, currency) !== null).length > 1
|
|
4957
|
+
);
|
|
4958
|
+
}
|
|
4934
4959
|
var VioCart = class extends LitElement {
|
|
4935
4960
|
constructor() {
|
|
4936
4961
|
super(...arguments);
|
|
@@ -4982,7 +5007,8 @@ var VioCart = class extends LitElement {
|
|
|
4982
5007
|
};
|
|
4983
5008
|
}
|
|
4984
5009
|
static {
|
|
4985
|
-
this.styles =
|
|
5010
|
+
this.styles = [
|
|
5011
|
+
css`
|
|
4986
5012
|
:host { display: contents; }
|
|
4987
5013
|
|
|
4988
5014
|
.backdrop {
|
|
@@ -5201,6 +5227,12 @@ var VioCart = class extends LitElement {
|
|
|
5201
5227
|
font-size: 14px;
|
|
5202
5228
|
}
|
|
5203
5229
|
.total-row { font-weight: 700; font-size: 16px; margin-top: 0; }
|
|
5230
|
+
/* Where the shipping method is chosen: in Vipps, or in the checkout. */
|
|
5231
|
+
.shipping-hint {
|
|
5232
|
+
margin: calc(var(--vio-space-md, 16px) * -0.5) 0 var(--vio-space-md, 16px);
|
|
5233
|
+
font-size: 12px;
|
|
5234
|
+
color: var(--vio-color-text-secondary, #666);
|
|
5235
|
+
}
|
|
5204
5236
|
.subtotal-value { font-weight: 700; font-size: 16px; }
|
|
5205
5237
|
|
|
5206
5238
|
/* Apple Pay express — pay the whole cart directly. */
|
|
@@ -5358,7 +5390,9 @@ var VioCart = class extends LitElement {
|
|
|
5358
5390
|
font-family: var(--vio-font-sans, -apple-system, sans-serif);
|
|
5359
5391
|
}
|
|
5360
5392
|
.confirm-close:hover { background: #222; }
|
|
5361
|
-
|
|
5393
|
+
`,
|
|
5394
|
+
highlightsStyles("cart")
|
|
5395
|
+
];
|
|
5362
5396
|
}
|
|
5363
5397
|
connectedCallback() {
|
|
5364
5398
|
super.connectedCallback();
|
|
@@ -5819,23 +5853,39 @@ var VioCart = class extends LitElement {
|
|
|
5819
5853
|
<span class="vipps-logo">vipps</span>
|
|
5820
5854
|
</button>
|
|
5821
5855
|
` : ""}
|
|
5856
|
+
${this.renderBrandHighlights()}
|
|
5822
5857
|
</div>
|
|
5823
5858
|
`}
|
|
5824
5859
|
</aside>
|
|
5825
5860
|
`;
|
|
5826
5861
|
}
|
|
5862
|
+
/**
|
|
5863
|
+
* The selling brand's promises under the ways to pay, as in the product
|
|
5864
|
+
* detail (one article = one brand: the cart's brand). Hidden with the theme's
|
|
5865
|
+
* `cartHighlightsDisplay: 'none'`; nothing when the brand has none.
|
|
5866
|
+
*/
|
|
5867
|
+
renderBrandHighlights() {
|
|
5868
|
+
const sponsorId = [...this.carts.keys()].find((id) => (this.carts.get(id)?.items.length ?? 0) > 0);
|
|
5869
|
+
if (sponsorId === void 0) return "";
|
|
5870
|
+
return renderHighlights(resolveSponsorIdentity(sponsorId)?.highlights ?? []);
|
|
5871
|
+
}
|
|
5827
5872
|
/** «Frakt» (the chosen or cheapest rate) and «Totalt» with it; «Beregnes i kassen» when unknown. */
|
|
5828
5873
|
renderShippingRows() {
|
|
5829
5874
|
const shipping = this.shippingAcrossSponsors;
|
|
5875
|
+
const from = shipping !== null && shipping > 0 && [...this.carts.values()].some(
|
|
5876
|
+
(cart) => cart.items.length > 0 && cartShippingIsFrom(cart.items, cart.currency)
|
|
5877
|
+
);
|
|
5878
|
+
const fra = from ? "fra " : "";
|
|
5830
5879
|
return html`
|
|
5831
5880
|
<div class="shipping-row" part="cart-shipping">
|
|
5832
5881
|
<span class="subtotal-label">Frakt</span>
|
|
5833
|
-
<span>${shipping === null ? "Beregnes i kassen" : shipping <= 0 ? "Gratis" : formatPrice(shipping, this.primaryCurrency)}</span>
|
|
5882
|
+
<span>${shipping === null ? "Beregnes i kassen" : shipping <= 0 ? "Gratis" : `${fra}${formatPrice(shipping, this.primaryCurrency)}`}</span>
|
|
5834
5883
|
</div>
|
|
5835
5884
|
${shipping !== null ? html`<div class="total-row" part="cart-total">
|
|
5836
5885
|
<span>Totalt</span>
|
|
5837
|
-
<span>${formatPrice(this.totalAcrossSponsors + shipping, this.primaryCurrency)}</span>
|
|
5886
|
+
<span>${fra}${formatPrice(this.totalAcrossSponsors + shipping, this.primaryCurrency)}</span>
|
|
5838
5887
|
</div>` : ""}
|
|
5888
|
+
<p class="shipping-hint" part="cart-shipping-hint">Frakt velger du i Vipps eller i neste steg.</p>
|
|
5839
5889
|
`;
|
|
5840
5890
|
}
|
|
5841
5891
|
renderConfirmation() {
|
|
@@ -9655,5 +9705,5 @@ function registerVioElements() {
|
|
|
9655
9705
|
}
|
|
9656
9706
|
|
|
9657
9707
|
export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements };
|
|
9658
|
-
//# sourceMappingURL=chunk-
|
|
9659
|
-
//# sourceMappingURL=chunk-
|
|
9708
|
+
//# sourceMappingURL=chunk-DEREQRCM.js.map
|
|
9709
|
+
//# sourceMappingURL=chunk-DEREQRCM.js.map
|