@vio-live/web-sdk 0.36.0 → 0.37.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 +24 -0
- package/README.md +97 -0
- package/dist/chunk-6HBX7GBJ.js +3 -0
- package/dist/{chunk-3YFJFDSN.js.map → chunk-6HBX7GBJ.js.map} +1 -1
- package/dist/{chunk-6PQFXUOW.js → chunk-KVI56NGO.js} +141 -13
- package/dist/chunk-KVI56NGO.js.map +1 -0
- package/dist/{chunk-DEREQRCM.js → chunk-LDA7RI43.js} +256 -33
- package/dist/chunk-LDA7RI43.js.map +1 -0
- package/dist/core/index.d.ts +121 -5
- package/dist/core/index.js +2 -2
- package/dist/{detail-layout-BI556w8p.d.ts → detail-layout-BfR20W_X.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/react/index.d.ts +7 -3
- package/dist/react/index.js +11 -7
- package/dist/react/index.js.map +1 -1
- package/dist/{tokens-BGzSC3vK.d.ts → tokens-ChbmD8wb.d.ts} +33 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-3YFJFDSN.js +0 -3
- package/dist/chunk-6PQFXUOW.js.map +0 -1
- package/dist/chunk-DEREQRCM.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,30 @@ How to keep this file: see [CONTRIBUTING → Changelog](CONTRIBUTING.md#changelo
|
|
|
14
14
|
The details of each feature live in the [README](README.md); this file says *what*
|
|
15
15
|
and *when*, and links there.
|
|
16
16
|
|
|
17
|
+
## 0.37.0 — 2026-10-29
|
|
18
|
+
|
|
19
|
+
> **Deploy the collector `89f2766` (vio-analytics#38) before using this version:** an older collector rejects
|
|
20
|
+
> `cta_click` (the rest of the batch is kept, those clicks are lost).
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- **Button tracking: `cta_click`** — which buttons shoppers use. Every tap on a button of
|
|
24
|
+
`<vio-product-detail>`, `<vio-cart>`, `<vio-product>` and `<vio-checkout>` sends one `cta_click`
|
|
25
|
+
(in `context`: `cta`, `cta_location`, `cta_label`, `option_value`, `product_id`,
|
|
26
|
+
`product_variant_id`, the detail's layout, and the usual attribution), on the tap, before the
|
|
27
|
+
action. Each tap also dispatches **`vio:cta-click`** (bubbles, composed; React `onCtaClick`).
|
|
28
|
+
**`Vio.trackCta({ cta, location, label, variant, … })`** sends the same event for a host's own
|
|
29
|
+
buttons (`location: 'host' | 'card' | 'block'`, `cta_variant` for the button option being
|
|
30
|
+
tested). Ids and fields: [README → Button tracking](README.md#button-tracking-cta_click-unreleased).
|
|
31
|
+
|
|
32
|
+
### ⚠️ Upgrade notes
|
|
33
|
+
- **The collector must know `cta_click`** (and its context fields) before this ships: an older
|
|
34
|
+
collector rejects the event — the rest of the batch is not affected.
|
|
35
|
+
- On `cta_click`, **`variant_id` is the layout's experiment variant** (as on `view_item`); the
|
|
36
|
+
product variant is **`product_variant_id`**.
|
|
37
|
+
- Hosts with `autoTrack: false` (Vev) get no `cta_click` from the SDK's buttons unless they forward
|
|
38
|
+
`vio:cta-click` themselves (`Vio.trackCta(e.detail)`).
|
|
39
|
+
- Nothing is sent before `Vio.analytics.start()`, `Vio.trackCta()` included.
|
|
40
|
+
|
|
17
41
|
## 0.36.0 — 2026-10-29
|
|
18
42
|
|
|
19
43
|
### Changed
|
package/README.md
CHANGED
|
@@ -577,6 +577,103 @@ To **undo** it, open any page with **`?vio_internal=0`**. Things to know:
|
|
|
577
577
|
(`Vio.analytics.isInternal` reads it). `resolveInternal()` / `INTERNAL_KEY` are
|
|
578
578
|
exported from `/core`.
|
|
579
579
|
|
|
580
|
+
### Button tracking (`cta_click`) (unreleased)
|
|
581
|
+
|
|
582
|
+
Which buttons shoppers use. Every tap on a button of the SDK's elements sends **one
|
|
583
|
+
`cta_click`**, through the same pipeline as every other event (consent,
|
|
584
|
+
`privateContent`, internal traffic, batching, attribution). A host's own buttons
|
|
585
|
+
send the same event with **`Vio.trackCta()`**, so the dashboard compares them on
|
|
586
|
+
one scale.
|
|
587
|
+
|
|
588
|
+
**When.** On the tap, before the button's own action runs (before any navigation
|
|
589
|
+
to Vipps, Stripe…) — it never blocks or delays the action, and one tap is one
|
|
590
|
+
event. Only once `Vio.analytics.start()` ran (with `autoTrack`, the default);
|
|
591
|
+
before that nothing is queued. A host with `autoTrack: false` hears the DOM event
|
|
592
|
+
(below) and decides itself.
|
|
593
|
+
|
|
594
|
+
**The wire** — everything in `context`, next to `campaign_id` / `location_id` /
|
|
595
|
+
`content_*` / `sponsor_id` as every event carries them:
|
|
596
|
+
|
|
597
|
+
| field | what |
|
|
598
|
+
|---|---|
|
|
599
|
+
| `cta` | the button id, `[a-z0-9_.:-]`, 1–64 chars (lists below) |
|
|
600
|
+
| `cta_location` | `detail` · `cart` · `card` · `checkout` · `host` · `block` |
|
|
601
|
+
| `cta_label` | the visible text of the button, trimmed, ≤ 64 (`Kjøp nå med Vipps`, `Til kassen`) |
|
|
602
|
+
| `cta_variant` | the host's name of the button option it is testing, `[A-Za-z0-9._:-]`, ≤ 64 (`bar-kjop`, `outline-velg`). The SDK's own buttons send none |
|
|
603
|
+
| `option_value` | the option value chosen, ≤ 64 (`size`: `M`, `42`) |
|
|
604
|
+
| `product_id` | the product (string) |
|
|
605
|
+
| `product_variant_id` | the **product** variant, when known (every option chosen, or a single variant) |
|
|
606
|
+
| `layout_id` · `layout_revision` · `experiment_id` · `variant_id` | the `<vio-product-detail>` layout shown — only a non-default one, as on `view_item`. **`variant_id` is the layout's experiment variant**, never the product's: that one is `product_variant_id` |
|
|
607
|
+
| `component_template_id` | `product-detail` / `product-card` (or the carousel's) for the SDK's elements |
|
|
608
|
+
|
|
609
|
+
No PII: ids, the button's own text and the option value. With
|
|
610
|
+
`start({ privateContent: true })` `cta_label` and `option_value` stay on the device
|
|
611
|
+
too (they can name the product), with `content_url` / `content_title` /
|
|
612
|
+
`content_id`; `cta`, `cta_location`, `cta_variant` and the ids still go. Without
|
|
613
|
+
consent (`requireConsent`) the event goes with the visit's ephemeral ids, as every
|
|
614
|
+
event. A browser marked as internal sends `client.internal: true`.
|
|
615
|
+
|
|
616
|
+
**The SDK's buttons.**
|
|
617
|
+
|
|
618
|
+
| element (`cta_location`) | `cta` ids |
|
|
619
|
+
|---|---|
|
|
620
|
+
| `<vio-product-detail>` (`detail`) | `vipps` (Kjøp nå med Vipps) · `apple_pay` · `stripe` · `klarna` · `buy_now` (Kjøp nå) · `add_to_cart` (Legg i handlekurv) · `size` (any option value chosen, with `option_value`) · `quantity_plus` · `quantity_minus` · `description_open` («Beskrivelse» / the text / «Les mer», when the tap opens it) · `shipping_returns_open` («Frakt & retur», when it opens) · `terms_link` (Kjøpsvilkår) · `refund_link` (Angrerett og retur) · `checkout` («Til kassen» in the added-to-cart toast) · `close` (×, the backdrop, the handle) · `gallery_swipe` (the first change of photo per open product: a swipe, an arrow or a thumbnail) |
|
|
621
|
+
| `<vio-cart>` (`cart`) | `checkout` (Til kassen) · `vipps` · `apple_pay` · `stripe` · `klarna` · `remove` · `quantity_plus` · `quantity_minus` · `close` |
|
|
622
|
+
| `<vio-product>` card (`card`) | `open` (a tap — or Enter — on the card or its image) · `add` (the bag or bar button) |
|
|
623
|
+
| `<vio-checkout>` (`checkout`) | `select_<method>` (a method of the list: `select_vipps`, `select_stripe`, `select_klarna`, `select_apple_pay`, `select_kustom`, `select_qliro`, `select_walley`, `select_nexi`, `select_adyen`) · `pay_<method>` (the pay button of the chosen method: `pay_vipps`, `pay_stripe`, `pay_klarna`, `pay_apple_pay`, `pay_adyen`, `pay_kustom`…) · `pay_stripe_confirm` («Betal» under Stripe's own payment form) · `close` (×, the backdrop, the handle, «Lukk» / «Fortsett å handle» on the receipt) |
|
|
624
|
+
|
|
625
|
+
A detail's buttons carry the open product (`product_id`, `product_variant_id`), its
|
|
626
|
+
sponsor, slot, campaign and article; a cart line's carry its product, variant,
|
|
627
|
+
sponsor and where its units came from; the cart's and the checkout's footer
|
|
628
|
+
buttons carry the sponsor they pay.
|
|
629
|
+
|
|
630
|
+
**The DOM event.** Each SDK button tap also dispatches **`vio:cta-click`**
|
|
631
|
+
(`bubbles`, `composed`) from the element, so a host can mirror it to its own
|
|
632
|
+
analytics. `detail` is the `Vio.trackCta` shape: `{ cta, location, label?,
|
|
633
|
+
optionValue?, productId?, productVariantId?, sponsorId?, campaignId?, slot?,
|
|
634
|
+
contentId?, contentTitle?, componentTemplateId?, layout? }`. React: `onCtaClick` on
|
|
635
|
+
`VioProduct`, `VioProductDetail`, `VioCart` and `VioCheckout`.
|
|
636
|
+
|
|
637
|
+
```js
|
|
638
|
+
window.addEventListener('vio:cta-click', (e) => myAnalytics.track('button', e.detail))
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
**A host's own buttons** (Replit's cards and article blocks):
|
|
642
|
+
|
|
643
|
+
```js
|
|
644
|
+
Vio.trackCta({
|
|
645
|
+
cta: 'choose_size', // required: [a-z0-9_.:-], ≤ 64 — invalid → ignored, one console.warn
|
|
646
|
+
location: 'block', // 'host' (default) | 'card' | 'block' | … — unknown → 'host', warned
|
|
647
|
+
label: 'Velg størrelse', // the button's visible text
|
|
648
|
+
variant: 'outline-velg', // the button option you are testing — invalid → left out, warned
|
|
649
|
+
optionValue: undefined, // the value chosen, for `size`
|
|
650
|
+
productId: 408948,
|
|
651
|
+
productVariantId: undefined,
|
|
652
|
+
sponsorId: 4,
|
|
653
|
+
campaignId: 31, // else resolved from slot / sponsor, as every event
|
|
654
|
+
slot: 'article-12-block-1',
|
|
655
|
+
contentId: 'art-12',
|
|
656
|
+
layout: undefined, // { layoutId, layoutRevision, experimentId, variantId } when it is a detail layout
|
|
657
|
+
})
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
It sends nothing before `Vio.analytics.start()` and never throws. It does not
|
|
661
|
+
dispatch `vio:cta-click` (the host already knows its own tap). Ids to use in the
|
|
662
|
+
blocks — the same as the SDK's where the button does the same thing:
|
|
663
|
+
|
|
664
|
+
| block button | `cta` |
|
|
665
|
+
|---|---|
|
|
666
|
+
| a size chosen | `size` (with `optionValue`) |
|
|
667
|
+
| add to the cart | `add_to_cart` |
|
|
668
|
+
| «Velg størrelse» — opens the detail to choose | `choose_size` |
|
|
669
|
+
| «Produktbeskrivelse» / «Vis mer» | `description_open` |
|
|
670
|
+
| Vipps directly | `vipps` |
|
|
671
|
+
| the image or the title (opens the detail) | `open` |
|
|
672
|
+
|
|
673
|
+
Name the button option you are testing with `variant` (`bar-kjop` vs
|
|
674
|
+
`outline-velg`) and keep `cta` the same for buttons that do the same thing: the
|
|
675
|
+
dashboard groups by `cta` and splits by `cta_variant` / `cta_label`.
|
|
676
|
+
|
|
580
677
|
## Sponsor identity — name and logo
|
|
581
678
|
|
|
582
679
|
The elements say **who sells**: the sponsor's (brand's) display name and logo.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-6HBX7GBJ.js"}
|
|
@@ -3969,7 +3969,7 @@ async function prepareApplePay(config) {
|
|
|
3969
3969
|
}
|
|
3970
3970
|
|
|
3971
3971
|
// src/core/version.ts
|
|
3972
|
-
var SDK_VERSION = "0.
|
|
3972
|
+
var SDK_VERSION = "0.37.0";
|
|
3973
3973
|
|
|
3974
3974
|
// src/core/checkout/payments/stripe-embedded.ts
|
|
3975
3975
|
var CREATE_PAYMENT_INTENT_STRIPE_MUTATION = `
|
|
@@ -7908,6 +7908,91 @@ function localStorageOrNull() {
|
|
|
7908
7908
|
}
|
|
7909
7909
|
}
|
|
7910
7910
|
|
|
7911
|
+
// src/core/analytics/cta.ts
|
|
7912
|
+
var CTA_LOCATIONS = ["detail", "cart", "card", "checkout", "host", "block"];
|
|
7913
|
+
var CTA_ID_PATTERN = /^[a-z0-9_.:-]{1,64}$/;
|
|
7914
|
+
var CTA_VARIANT_PATTERN = /^[A-Za-z0-9._:-]{1,64}$/;
|
|
7915
|
+
var CTA_TEXT_MAX_LENGTH = 64;
|
|
7916
|
+
var ID_MAX_LENGTH = 128;
|
|
7917
|
+
function isCtaId(value) {
|
|
7918
|
+
return typeof value === "string" && CTA_ID_PATTERN.test(value);
|
|
7919
|
+
}
|
|
7920
|
+
function ctaText(value, max = CTA_TEXT_MAX_LENGTH) {
|
|
7921
|
+
if (typeof value !== "string" && typeof value !== "number") return void 0;
|
|
7922
|
+
const clean = String(value).replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").replace(/\s+/g, " ").trim();
|
|
7923
|
+
if (!clean) return void 0;
|
|
7924
|
+
if (clean.length <= max) return clean;
|
|
7925
|
+
let cut4 = clean.slice(0, max);
|
|
7926
|
+
const last = cut4.charCodeAt(cut4.length - 1);
|
|
7927
|
+
if (last >= 55296 && last <= 56319) cut4 = cut4.slice(0, -1);
|
|
7928
|
+
return cut4.trimEnd() || void 0;
|
|
7929
|
+
}
|
|
7930
|
+
function idOf(value) {
|
|
7931
|
+
if (typeof value === "number") return Number.isFinite(value) ? String(value) : void 0;
|
|
7932
|
+
if (typeof value !== "string") return void 0;
|
|
7933
|
+
const v = value.trim();
|
|
7934
|
+
return v && v.length <= ID_MAX_LENGTH ? v : void 0;
|
|
7935
|
+
}
|
|
7936
|
+
function positive(value) {
|
|
7937
|
+
const n = toNumber(value);
|
|
7938
|
+
return n !== void 0 && Number.isInteger(n) && n > 0 ? n : void 0;
|
|
7939
|
+
}
|
|
7940
|
+
function warn(message) {
|
|
7941
|
+
try {
|
|
7942
|
+
console.warn(`[Vio.trackCta] ${message}`);
|
|
7943
|
+
} catch {
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
function ctaContextOf(input) {
|
|
7947
|
+
const cta = input?.cta;
|
|
7948
|
+
if (!isCtaId(cta)) {
|
|
7949
|
+
warn(`ignored: cta must be 1\u201364 chars of [a-z0-9_.:-], got ${JSON.stringify(cta)}`);
|
|
7950
|
+
return null;
|
|
7951
|
+
}
|
|
7952
|
+
let location2 = "host";
|
|
7953
|
+
if (input.location !== void 0 && input.location !== null && input.location !== "") {
|
|
7954
|
+
if (CTA_LOCATIONS.includes(String(input.location))) {
|
|
7955
|
+
location2 = input.location;
|
|
7956
|
+
} else {
|
|
7957
|
+
warn(`unknown location ${JSON.stringify(input.location)} \u2014 sent as 'host' (${CTA_LOCATIONS.join(" | ")})`);
|
|
7958
|
+
}
|
|
7959
|
+
}
|
|
7960
|
+
let variant;
|
|
7961
|
+
if (input.variant !== void 0 && input.variant !== null && input.variant !== "") {
|
|
7962
|
+
if (typeof input.variant === "string" && CTA_VARIANT_PATTERN.test(input.variant)) variant = input.variant;
|
|
7963
|
+
else warn(`variant left out: 1\u201364 chars of [A-Za-z0-9._:-], got ${JSON.stringify(input.variant)}`);
|
|
7964
|
+
}
|
|
7965
|
+
const i = input;
|
|
7966
|
+
const layout = normalizeLayoutOrigin(i.layout);
|
|
7967
|
+
const contentId = typeof i.contentId === "number" ? Number.isFinite(i.contentId) ? i.contentId : void 0 : idOf(i.contentId);
|
|
7968
|
+
const slot = typeof i.slot === "string" && i.slot.trim() ? i.slot.trim() : void 0;
|
|
7969
|
+
const ctx = {
|
|
7970
|
+
cta,
|
|
7971
|
+
ctaLocation: location2,
|
|
7972
|
+
ctaLabel: ctaText(i.label),
|
|
7973
|
+
ctaVariant: variant,
|
|
7974
|
+
optionValue: ctaText(i.optionValue),
|
|
7975
|
+
productId: idOf(i.productId),
|
|
7976
|
+
productVariantId: idOf(i.productVariantId),
|
|
7977
|
+
sponsorId: positive(i.sponsorId),
|
|
7978
|
+
campaignId: positive(i.campaignId),
|
|
7979
|
+
slot,
|
|
7980
|
+
contentId,
|
|
7981
|
+
contentTitle: typeof i.contentTitle === "string" && i.contentTitle.trim() ? i.contentTitle.trim() : void 0,
|
|
7982
|
+
componentTemplateId: idOf(i.componentTemplateId),
|
|
7983
|
+
...layout.layoutId ? {
|
|
7984
|
+
layoutId: layout.layoutId,
|
|
7985
|
+
layoutRevision: layout.layoutRevision ?? "",
|
|
7986
|
+
experimentId: layout.experimentId,
|
|
7987
|
+
variantId: layout.variantId
|
|
7988
|
+
} : {}
|
|
7989
|
+
};
|
|
7990
|
+
for (const key of Object.keys(ctx)) {
|
|
7991
|
+
if (ctx[key] === void 0) delete ctx[key];
|
|
7992
|
+
}
|
|
7993
|
+
return ctx;
|
|
7994
|
+
}
|
|
7995
|
+
|
|
7911
7996
|
// src/core/cart/slices.ts
|
|
7912
7997
|
function cartSlicesFrom(lines, resolveCampaign, fallbackCurrency) {
|
|
7913
7998
|
if (!Array.isArray(lines) || lines.length === 0) return [];
|
|
@@ -8222,6 +8307,20 @@ var AnalyticsManager = class extends EventTarget {
|
|
|
8222
8307
|
if (this.queue.length > MAX_QUEUE) this.queue.splice(0, this.queue.length - MAX_QUEUE);
|
|
8223
8308
|
if (this.queue.length >= FLUSH_AT_COUNT) void this.flush();
|
|
8224
8309
|
}
|
|
8310
|
+
/**
|
|
8311
|
+
* One `cta_click` — a tap on a button (README «Button tracking»). What
|
|
8312
|
+
* `Vio.trackCta()` calls for a host's own buttons; the SDK's elements reach
|
|
8313
|
+
* it through `vio:cta-click`. Only once `start()` ran — like the funnel
|
|
8314
|
+
* events of the elements, never queued before. An invalid `cta` is ignored
|
|
8315
|
+
* with one `console.warn`; consent, `privateContent`, internal traffic,
|
|
8316
|
+
* batching and attribution are those of every event.
|
|
8317
|
+
*/
|
|
8318
|
+
trackCta(input) {
|
|
8319
|
+
if (!hasDom() || !this.started) return;
|
|
8320
|
+
const context = ctaContextOf(input);
|
|
8321
|
+
if (!context) return;
|
|
8322
|
+
this.track("cta_click", { context });
|
|
8323
|
+
}
|
|
8225
8324
|
/**
|
|
8226
8325
|
* Impression helper: observes an element and tracks ONE
|
|
8227
8326
|
* `component_impression` per (session, campaignComponentId) when the
|
|
@@ -8344,7 +8443,16 @@ var AnalyticsManager = class extends EventTarget {
|
|
|
8344
8443
|
layout_id: ctx.layoutId,
|
|
8345
8444
|
layout_revision: ctx.layoutRevision,
|
|
8346
8445
|
experiment_id: ctx.experimentId,
|
|
8347
|
-
variant_id: ctx.variantId
|
|
8446
|
+
variant_id: ctx.variantId,
|
|
8447
|
+
// `cta_click` (./cta.ts). Con `privateContent` el texto del botón y el
|
|
8448
|
+
// valor elegido no salen del dispositivo: pueden nombrar el producto.
|
|
8449
|
+
cta: ctx.cta,
|
|
8450
|
+
cta_location: ctx.ctaLocation,
|
|
8451
|
+
cta_label: this.options.privateContent ? void 0 : ctx.ctaLabel,
|
|
8452
|
+
cta_variant: ctx.ctaVariant,
|
|
8453
|
+
option_value: this.options.privateContent ? void 0 : ctx.optionValue,
|
|
8454
|
+
product_id: ctx.productId,
|
|
8455
|
+
product_variant_id: ctx.productVariantId
|
|
8348
8456
|
});
|
|
8349
8457
|
const com = opts.commerce;
|
|
8350
8458
|
const commerce = com ? compact({
|
|
@@ -8581,6 +8689,10 @@ var AnalyticsManager = class extends EventTarget {
|
|
|
8581
8689
|
}
|
|
8582
8690
|
});
|
|
8583
8691
|
});
|
|
8692
|
+
on("vio:cta-click", (ev) => {
|
|
8693
|
+
const d = ev.detail;
|
|
8694
|
+
if (d) this.trackCta(d);
|
|
8695
|
+
});
|
|
8584
8696
|
on("vio:open-cart", () => {
|
|
8585
8697
|
const snap = this.cartCommerce();
|
|
8586
8698
|
this.track("view_cart", snap ? { commerce: snap } : {});
|
|
@@ -9350,6 +9462,22 @@ var VioFacade = class {
|
|
|
9350
9462
|
detailLayout() {
|
|
9351
9463
|
return copyAppliedLayout(resolveDetailLayout(null));
|
|
9352
9464
|
}
|
|
9465
|
+
/**
|
|
9466
|
+
* Report a tap on one of the host's own buttons (its cards, its article
|
|
9467
|
+
* blocks) as `cta_click`, the event the SDK's own buttons send — so the
|
|
9468
|
+
* dashboard compares them on one scale. `{ cta, location?, label?,
|
|
9469
|
+
* variant?, optionValue?, productId?, productVariantId?, sponsorId?,
|
|
9470
|
+
* campaignId?, slot?, contentId?, layout? }`; `location` is `host` by
|
|
9471
|
+
* default (`card` / `block` for the host's cards and article blocks). An
|
|
9472
|
+
* invalid `cta` is ignored with one `console.warn`. Nothing is sent before
|
|
9473
|
+
* `Vio.analytics.start()`. Never throws. See README «Button tracking».
|
|
9474
|
+
*/
|
|
9475
|
+
trackCta(input) {
|
|
9476
|
+
try {
|
|
9477
|
+
this.analytics.trackCta(input);
|
|
9478
|
+
} catch {
|
|
9479
|
+
}
|
|
9480
|
+
}
|
|
9353
9481
|
get isInitialized() {
|
|
9354
9482
|
return Configuration.isInitialized;
|
|
9355
9483
|
}
|
|
@@ -9677,7 +9805,7 @@ var VioFacade = class {
|
|
|
9677
9805
|
const all = normalizeSlotLocations(slots);
|
|
9678
9806
|
if (all.length === 0) return null;
|
|
9679
9807
|
if (!Configuration.isInitialized) {
|
|
9680
|
-
|
|
9808
|
+
warn2("declareSlots() before Vio.init() \u2014 nothing declared");
|
|
9681
9809
|
return null;
|
|
9682
9810
|
}
|
|
9683
9811
|
const cfg = Configuration.get();
|
|
@@ -9695,7 +9823,7 @@ var VioFacade = class {
|
|
|
9695
9823
|
if (locations.length > MAX_LOCATIONS_PER_DECLARATION) {
|
|
9696
9824
|
if (!this.warnedLocationCap) {
|
|
9697
9825
|
this.warnedLocationCap = true;
|
|
9698
|
-
|
|
9826
|
+
warn2(
|
|
9699
9827
|
`declareSlots(): ${locations.length} slots on one page \u2014 only the first ${MAX_LOCATIONS_PER_DECLARATION} are declared`
|
|
9700
9828
|
);
|
|
9701
9829
|
}
|
|
@@ -9705,7 +9833,7 @@ var VioFacade = class {
|
|
|
9705
9833
|
if (!opts.force && this.declarationsThisLoad >= MAX_DECLARATIONS_PER_LOAD) {
|
|
9706
9834
|
if (!this.warnedDeclarationCap) {
|
|
9707
9835
|
this.warnedDeclarationCap = true;
|
|
9708
|
-
|
|
9836
|
+
warn2(
|
|
9709
9837
|
`declareSlots(): already ${MAX_DECLARATIONS_PER_LOAD} manifests this page load \u2014 further ones are skipped (force: true to override)`
|
|
9710
9838
|
);
|
|
9711
9839
|
}
|
|
@@ -9727,7 +9855,7 @@ var VioFacade = class {
|
|
|
9727
9855
|
writeSlotDeclaration(storageKey, next);
|
|
9728
9856
|
} else {
|
|
9729
9857
|
writeSlotDeclaration(storageKey, rememberSlotKeys(memory2, keys, failedAt(now)));
|
|
9730
|
-
|
|
9858
|
+
warn2(
|
|
9731
9859
|
"slots declared but the server ignored mode=merge (old server); not caching, will retry next load"
|
|
9732
9860
|
);
|
|
9733
9861
|
}
|
|
@@ -9736,7 +9864,7 @@ var VioFacade = class {
|
|
|
9736
9864
|
if (storageKey && keys.length > 0) {
|
|
9737
9865
|
writeSlotDeclaration(storageKey, rememberSlotKeys(readSlotDeclaration(storageKey), keys, failedAt(now)));
|
|
9738
9866
|
}
|
|
9739
|
-
|
|
9867
|
+
warn2("declareSlots() failed \u2014", err);
|
|
9740
9868
|
return null;
|
|
9741
9869
|
}
|
|
9742
9870
|
}
|
|
@@ -10098,11 +10226,11 @@ var VioFacade = class {
|
|
|
10098
10226
|
if (sentCampaign === void 0) continue;
|
|
10099
10227
|
if (l.assignment === "dashboard" && !this.warnedDashboardSlots.has(l.locationId)) {
|
|
10100
10228
|
this.warnedDashboardSlots.add(l.locationId);
|
|
10101
|
-
|
|
10229
|
+
warn2(`slot ${l.locationId} is assigned from the dashboard; the page's campaign is ignored there`);
|
|
10102
10230
|
}
|
|
10103
10231
|
if (l.assignment === "replaced" && !this.warnedReplacedSlots.has(l.locationId)) {
|
|
10104
10232
|
this.warnedReplacedSlots.add(l.locationId);
|
|
10105
|
-
|
|
10233
|
+
warn2(`slot ${l.locationId} moved to campaign ${sentCampaign} by this page (it replaced an earlier page assignment)`);
|
|
10106
10234
|
}
|
|
10107
10235
|
}
|
|
10108
10236
|
}
|
|
@@ -10174,7 +10302,7 @@ function documentCampaignHints() {
|
|
|
10174
10302
|
return [];
|
|
10175
10303
|
}
|
|
10176
10304
|
}
|
|
10177
|
-
function
|
|
10305
|
+
function warn2(...args) {
|
|
10178
10306
|
if (typeof console !== "undefined") console.warn("[Vio]", ...args);
|
|
10179
10307
|
}
|
|
10180
10308
|
function failedAt(now) {
|
|
@@ -10232,6 +10360,6 @@ function vippsButtonAttributes(verb = "buy", opts = {}) {
|
|
|
10232
10360
|
};
|
|
10233
10361
|
}
|
|
10234
10362
|
|
|
10235
|
-
export { ADD_ITEM_MUTATION, ADYEN_RETURN_METHOD, ADYEN_RETURN_QUERY_KEYS, AdyenOriginError, AnalyticsManager, BUYER_REF_MAX_LENGTH, CHECKOUT_ATTRIBUTION_CAPS, CHECKOUT_SPONSOR_STORAGE_KEY, CLIENT_LANDING_URL_MAX_LENGTH, CONTENT_URL_MAX_LENGTH, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, DETAIL_SECTION_IDS, ESSENTIAL_DETAIL_SECTIONS, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, GRAPHQL_INT_MAX, INTERNAL_KEY, INTERNAL_PARAM, KUSTOM_RETURN_QUERY_KEYS, LINE_ORIGIN_CAPS, SDK_VERSION, UPDATE_CHECKOUT_MUTATION, UPDATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_ITEM_WITH_ORIGIN_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, VIPPS_BUTTON_SCRIPT, VIPPS_BUTTON_TAG, Vio, VioApi, VioApiError, __decorateClass, activeCampaignEntry, addItem, adyenReturnOutcome, adyenReturnParams, autoSlotDisplayName, autoSlotId, buyerRefOf, campaignCandidates, capContentUrl, cartSlicesFrom, checkApplePayAvailability, checkoutAttributionOf, checkoutSponsorOf, componentKindOf, copyAppliedLayout, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, currentGlobalDescriptionLabel, defaultDetailLayout, deleteItem, displayPrice, dominantCampaignOf, effectiveDetailSections, ensureVippsButton, entryContextOf, executeCartGraphQL, formatPrice, gatewayHas, gatewayHasBuyerRef, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCheckoutReference, getCustomerSessionId, getGlobalCountryCode, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, isUnknownFeatureError, isUnknownTokenError, isValidPhone, kustomReturnOutcome, landingUrl, layoutOriginOf, layoutSignature, lineOriginWire, lineOrigins, nexiReturnPaymentId, normalizeBuyerRef, normalizeDetailLayout, normalizeOrigin, normalizeScope, normalizeSlotId, normalizeSlotKind, onGlobalDetailLayoutChange, originAndPath, primaryImageUrl, purchaseFromPaymentSuccess, purchaseIdsOf, readInternal, readNexiPending, rememberedCheckoutSponsor, resetGatewayFeatures, resolveCampaignId, resolveClientContext, resolveContent, resolveDetailLayout, resolveInternal, resolveLanding, resolveSlotCampaign, sameOrigin, shippingDescriptionOf, showApplePaySheet, sponsorCampaignEntry, sponsorIdentityFrom, storageGet, storedLanding, toCampaignId, updateCheckout, updateItem, updateShippingsBySupplier, vippsButtonAttributes, withGatewayFeature, writeInternal };
|
|
10236
|
-
//# sourceMappingURL=chunk-
|
|
10237
|
-
//# sourceMappingURL=chunk-
|
|
10363
|
+
export { ADD_ITEM_MUTATION, ADYEN_RETURN_METHOD, ADYEN_RETURN_QUERY_KEYS, AdyenOriginError, AnalyticsManager, BUYER_REF_MAX_LENGTH, CHECKOUT_ATTRIBUTION_CAPS, CHECKOUT_SPONSOR_STORAGE_KEY, CLIENT_LANDING_URL_MAX_LENGTH, CONTENT_URL_MAX_LENGTH, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CTA_ID_PATTERN, CTA_LOCATIONS, CTA_TEXT_MAX_LENGTH, CTA_VARIANT_PATTERN, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, DETAIL_SECTION_IDS, ESSENTIAL_DETAIL_SECTIONS, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, GRAPHQL_INT_MAX, INTERNAL_KEY, INTERNAL_PARAM, KUSTOM_RETURN_QUERY_KEYS, LINE_ORIGIN_CAPS, SDK_VERSION, UPDATE_CHECKOUT_MUTATION, UPDATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_ITEM_WITH_ORIGIN_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, VIPPS_BUTTON_SCRIPT, VIPPS_BUTTON_TAG, Vio, VioApi, VioApiError, __decorateClass, activeCampaignEntry, addItem, adyenReturnOutcome, adyenReturnParams, autoSlotDisplayName, autoSlotId, buyerRefOf, campaignCandidates, capContentUrl, cartSlicesFrom, checkApplePayAvailability, checkoutAttributionOf, checkoutSponsorOf, componentKindOf, copyAppliedLayout, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, ctaContextOf, ctaText, currentGlobalDescriptionLabel, defaultDetailLayout, deleteItem, displayPrice, dominantCampaignOf, effectiveDetailSections, ensureVippsButton, entryContextOf, executeCartGraphQL, formatPrice, gatewayHas, gatewayHasBuyerRef, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCheckoutReference, getCustomerSessionId, getGlobalCountryCode, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, isCtaId, isUnknownFeatureError, isUnknownTokenError, isValidPhone, kustomReturnOutcome, landingUrl, layoutOriginOf, layoutSignature, lineOriginWire, lineOrigins, nexiReturnPaymentId, normalizeBuyerRef, normalizeDetailLayout, normalizeOrigin, normalizeScope, normalizeSlotId, normalizeSlotKind, onGlobalDetailLayoutChange, originAndPath, primaryImageUrl, purchaseFromPaymentSuccess, purchaseIdsOf, readInternal, readNexiPending, rememberedCheckoutSponsor, resetGatewayFeatures, resolveCampaignId, resolveClientContext, resolveContent, resolveDetailLayout, resolveInternal, resolveLanding, resolveSlotCampaign, sameOrigin, shippingDescriptionOf, showApplePaySheet, sponsorCampaignEntry, sponsorIdentityFrom, storageGet, storedLanding, toCampaignId, updateCheckout, updateItem, updateShippingsBySupplier, vippsButtonAttributes, withGatewayFeature, writeInternal };
|
|
10364
|
+
//# sourceMappingURL=chunk-KVI56NGO.js.map
|
|
10365
|
+
//# sourceMappingURL=chunk-KVI56NGO.js.map
|