@vio-live/web-sdk 0.1.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/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/chunk-4CCGE7DE.js +3284 -0
- package/dist/chunk-4CCGE7DE.js.map +1 -0
- package/dist/chunk-5SPY7TH6.js +1618 -0
- package/dist/chunk-5SPY7TH6.js.map +1 -0
- package/dist/chunk-GGM2AIK5.js +3 -0
- package/dist/chunk-GGM2AIK5.js.map +1 -0
- package/dist/core/index.d.ts +748 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/ui/index.d.ts +98 -0
- package/dist/ui/index.js +4 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/vio-checkout-D8B4Upk8.d.ts +301 -0
- package/package.json +76 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '../chunk-GGM2AIK5.js';
|
|
2
|
+
export { CartManager, CheckoutManager, CommerceClient, Configuration, Vio, VioApi, VioApiError, checkApplePayAvailability, createCommerceClient, createVioApi, displayPrice, formatPrice, primaryImageUrl, showApplePaySheet } from '../chunk-5SPY7TH6.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AddManualOptions, AddProductOptions, ApplePayConfig, ApplePayResult, BootstrapResponse, CartChangeDetail, CartLineItem, CartManager, CheckoutAddress, CheckoutChangeDetail, CheckoutManager, CheckoutState, CommerceClient, Configuration, Environment, ImageSize, PaymentCompleteDetail, PaymentMethod, PaymentSelectDetail, PlacementComponent, Product, ProductCategory, ProductImage, ProductOption, ProductPrice, ProductVariant, ResolvedConfig, Sponsor, SponsorCartState, SponsorCommerceBlock, Vio, VioApi, VioApiError, VioConfig, checkApplePayAvailability, createCommerceClient, createVioApi, displayPrice, formatPrice, primaryImageUrl, showApplePaySheet } from './core/index.js';
|
|
2
|
+
import './vio-checkout-D8B4Upk8.js';
|
|
3
|
+
import 'graphql-request';
|
|
4
|
+
import 'lit-html';
|
|
5
|
+
import 'lit';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './chunk-GGM2AIK5.js';
|
|
2
|
+
import './chunk-4CCGE7DE.js';
|
|
3
|
+
export { CartManager, CheckoutManager, CommerceClient, Configuration, Vio, VioApi, VioApiError, checkApplePayAvailability, createCommerceClient, createVioApi, displayPrice, formatPrice, primaryImageUrl, showApplePaySheet } from './chunk-5SPY7TH6.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export { V as VioCart, a as VioCheckout, b as VioProduct, c as VioProductCarousel, d as VioProductDetail } from '../vio-checkout-D8B4Upk8.js';
|
|
2
|
+
import 'lit-html';
|
|
3
|
+
import 'lit';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Vio Design Tokens — editorial commerce aesthetic.
|
|
7
|
+
*
|
|
8
|
+
* Extracted from the Allermedia "Mote & Livsstil" reference (the target
|
|
9
|
+
* pilot site). Mood: Vogue-like fashion magazine — serif headlines,
|
|
10
|
+
* sans-serif body, near-monochrome palette, terracotta accent for
|
|
11
|
+
* editorial labels ("REDAKSJONENS FAVORITTER").
|
|
12
|
+
*
|
|
13
|
+
* Tokens are exposed both as a typed TS object (`VioTokens`) and as
|
|
14
|
+
* CSS custom properties on `:root` (auto-injected when this module is
|
|
15
|
+
* imported in a browser). Consumers can override individual variables
|
|
16
|
+
* to re-skin without touching SDK source.
|
|
17
|
+
*/
|
|
18
|
+
declare const VioTokens: {
|
|
19
|
+
readonly color: {
|
|
20
|
+
readonly text: {
|
|
21
|
+
readonly primary: "#0a0a0a";
|
|
22
|
+
readonly secondary: "#666666";
|
|
23
|
+
readonly tertiary: "#999999";
|
|
24
|
+
readonly onPrimary: "#ffffff";
|
|
25
|
+
};
|
|
26
|
+
readonly accent: {
|
|
27
|
+
readonly editorial: "#c14a3b";
|
|
28
|
+
};
|
|
29
|
+
readonly surface: {
|
|
30
|
+
readonly base: "#ffffff";
|
|
31
|
+
readonly muted: "#f2f2f2";
|
|
32
|
+
readonly hover: "#fafafa";
|
|
33
|
+
};
|
|
34
|
+
readonly border: {
|
|
35
|
+
readonly subtle: "#e5e5e5";
|
|
36
|
+
readonly default: "#cccccc";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
readonly font: {
|
|
40
|
+
readonly serif: "\"Tinos\", \"Playfair Display\", Georgia, serif";
|
|
41
|
+
readonly sans: "\"Inter\", -apple-system, \"Helvetica Neue\", Arial, sans-serif";
|
|
42
|
+
};
|
|
43
|
+
readonly size: {
|
|
44
|
+
readonly xs: "12px";
|
|
45
|
+
readonly sm: "14px";
|
|
46
|
+
readonly md: "16px";
|
|
47
|
+
readonly lg: "20px";
|
|
48
|
+
readonly xl: "24px";
|
|
49
|
+
readonly '2xl': "32px";
|
|
50
|
+
readonly '3xl': "40px";
|
|
51
|
+
};
|
|
52
|
+
readonly weight: {
|
|
53
|
+
readonly regular: 400;
|
|
54
|
+
readonly medium: 500;
|
|
55
|
+
readonly semibold: 600;
|
|
56
|
+
readonly bold: 700;
|
|
57
|
+
};
|
|
58
|
+
readonly tracking: {
|
|
59
|
+
readonly label: "0.1em";
|
|
60
|
+
readonly title: "0";
|
|
61
|
+
};
|
|
62
|
+
readonly lineHeight: {
|
|
63
|
+
readonly tight: 1.1;
|
|
64
|
+
readonly snug: 1.3;
|
|
65
|
+
readonly normal: 1.5;
|
|
66
|
+
};
|
|
67
|
+
readonly space: {
|
|
68
|
+
readonly xs: "4px";
|
|
69
|
+
readonly sm: "8px";
|
|
70
|
+
readonly md: "16px";
|
|
71
|
+
readonly lg: "24px";
|
|
72
|
+
readonly xl: "32px";
|
|
73
|
+
readonly '2xl': "48px";
|
|
74
|
+
readonly '3xl': "64px";
|
|
75
|
+
};
|
|
76
|
+
readonly radius: {
|
|
77
|
+
readonly none: "0";
|
|
78
|
+
readonly sm: "2px";
|
|
79
|
+
readonly md: "4px";
|
|
80
|
+
readonly lg: "8px";
|
|
81
|
+
readonly full: "9999px";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Vio UI — Web Components + design tokens.
|
|
87
|
+
*
|
|
88
|
+
* Importing this file (directly or via the main `vio` entry) has two
|
|
89
|
+
* side-effects:
|
|
90
|
+
* 1. Injects design tokens as CSS custom properties on `:root`
|
|
91
|
+
* 2. Registers all `<vio-*>` custom elements
|
|
92
|
+
*
|
|
93
|
+
* SSR-safe: every side-effect guards on `typeof document !== 'undefined'`.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
declare const VIO_UI_VERSION = "0.1.0";
|
|
97
|
+
|
|
98
|
+
export { VIO_UI_VERSION, VioTokens };
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import * as lit_html from 'lit-html';
|
|
2
|
+
import * as lit from 'lit';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
|
|
5
|
+
declare class VioProduct extends LitElement {
|
|
6
|
+
/** Brand label shown at the top (uppercase, gray, small). */
|
|
7
|
+
brand: string;
|
|
8
|
+
/** Product display name. Two-line truncation. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Pre-formatted price string (e.g. "990 kr"). Bold. */
|
|
11
|
+
price: string;
|
|
12
|
+
/** Retailer / sponsor name shown at the bottom (uppercase, gray). */
|
|
13
|
+
retailer: string;
|
|
14
|
+
/** Product image URL. Square aspect, gray bg if missing. */
|
|
15
|
+
imageUrl: string;
|
|
16
|
+
/** Vio product id, propagated to click event. */
|
|
17
|
+
productId: string;
|
|
18
|
+
/** Vio sponsor id, propagated to click event. */
|
|
19
|
+
sponsorId: string;
|
|
20
|
+
/** Whether the product has selectable variants — the quick-add button then
|
|
21
|
+
* opens the detail to pick one instead of adding directly. */
|
|
22
|
+
hasVariants: boolean;
|
|
23
|
+
/** True when this product currently sits in the cart (persistent mark). */
|
|
24
|
+
private inCart;
|
|
25
|
+
/** Total units of this product in the cart (shown as a count when > 1). */
|
|
26
|
+
private cartQty;
|
|
27
|
+
/** Transient flag driving the add "pop" animation. */
|
|
28
|
+
private justAdded;
|
|
29
|
+
private boundCartChange;
|
|
30
|
+
static styles: lit.CSSResult;
|
|
31
|
+
connectedCallback(): void;
|
|
32
|
+
disconnectedCallback(): void;
|
|
33
|
+
updated(changed: Map<string, unknown>): void;
|
|
34
|
+
/** Reflect whether (and how many units of) this product sit in the cart. */
|
|
35
|
+
private updateInCart;
|
|
36
|
+
private onClick;
|
|
37
|
+
private onKeydown;
|
|
38
|
+
/** Quick add-to-cart. If the product has selectable variants, open the detail
|
|
39
|
+
* to pick one instead (the host can't choose for the user). Otherwise emit
|
|
40
|
+
* `vio:product-add` so the host adds it (bumping quantity on repeat taps). */
|
|
41
|
+
private onAdd;
|
|
42
|
+
render(): lit_html.TemplateResult<1>;
|
|
43
|
+
}
|
|
44
|
+
declare global {
|
|
45
|
+
interface HTMLElementTagNameMap {
|
|
46
|
+
'vio-product': VioProduct;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare class VioProductCarousel extends LitElement {
|
|
51
|
+
/** Small uppercase label in accent color (e.g. "REDAKSJONENS FAVORITTER"). */
|
|
52
|
+
label: string;
|
|
53
|
+
/** Big serif heading (e.g. "Shop Favorittene"). */
|
|
54
|
+
heading: string;
|
|
55
|
+
/** Inline gray disclaimer next to the heading (e.g. "annonselenker"). */
|
|
56
|
+
disclaimer: string;
|
|
57
|
+
/** URL for the "Se alle" link. Hidden if empty. */
|
|
58
|
+
seeAllHref: string;
|
|
59
|
+
/** Label for the see-all link. Defaults to Norwegian. */
|
|
60
|
+
seeAllLabel: string;
|
|
61
|
+
/** Auto-fetch mode: comma-separated product ids (e.g. "408895,408896"). */
|
|
62
|
+
productIds: string;
|
|
63
|
+
/** Auto-fetch mode option A: explicit per-sponsor commerce apiKey. */
|
|
64
|
+
commerceKey: string;
|
|
65
|
+
/** Auto-fetch mode option B: sponsor id looked up via Vio.bootstrap. */
|
|
66
|
+
sponsorId: number;
|
|
67
|
+
/**
|
|
68
|
+
* Multi-sponsor mode: `"sponsorId:productId,sponsorId:productId,…"`. Each
|
|
69
|
+
* pair resolves its own commerce client via `Vio.commerceFor(sponsorId)`;
|
|
70
|
+
* fetches run in parallel and results are merged preserving input order.
|
|
71
|
+
* Each rendered <vio-product> carries the per-item sponsor-id so taps go
|
|
72
|
+
* to <vio-product-detail> with the right commerce context.
|
|
73
|
+
*
|
|
74
|
+
* Takes precedence over `product-ids` if both are set.
|
|
75
|
+
*/
|
|
76
|
+
productRefs: string;
|
|
77
|
+
/** Currency for product prices. */
|
|
78
|
+
currency: string;
|
|
79
|
+
private scroller;
|
|
80
|
+
private fetched;
|
|
81
|
+
private isLoading;
|
|
82
|
+
private fetchError;
|
|
83
|
+
static styles: lit.CSSResult;
|
|
84
|
+
connectedCallback(): void;
|
|
85
|
+
updated(changed: Map<string, unknown>): void;
|
|
86
|
+
private autoFetch;
|
|
87
|
+
private parseRefs;
|
|
88
|
+
private scrollByDirection;
|
|
89
|
+
private renderScrollerContent;
|
|
90
|
+
render(): lit_html.TemplateResult<1>;
|
|
91
|
+
}
|
|
92
|
+
declare global {
|
|
93
|
+
interface HTMLElementTagNameMap {
|
|
94
|
+
'vio-product-carousel': VioProductCarousel;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
declare class VioProductDetail extends LitElement {
|
|
99
|
+
open: boolean;
|
|
100
|
+
productId: string;
|
|
101
|
+
sponsorId: number;
|
|
102
|
+
/** Subscribe to `vio:product-click` on the document and auto-open. */
|
|
103
|
+
autoOpen: boolean;
|
|
104
|
+
currency: string;
|
|
105
|
+
private product;
|
|
106
|
+
private isLoading;
|
|
107
|
+
private fetchError;
|
|
108
|
+
private selectedOptions;
|
|
109
|
+
private quantity;
|
|
110
|
+
private activeImageIndex;
|
|
111
|
+
private adding;
|
|
112
|
+
/** Apple Pay actually usable (real Stripe + registered domain) — set on load. */
|
|
113
|
+
private applePayOk;
|
|
114
|
+
/** Pre-prepared Apple Pay handle — show() fires synchronously on tap. */
|
|
115
|
+
private applePayHandle;
|
|
116
|
+
private boundProductClick;
|
|
117
|
+
static styles: lit.CSSResult;
|
|
118
|
+
connectedCallback(): void;
|
|
119
|
+
disconnectedCallback(): void;
|
|
120
|
+
show(): void;
|
|
121
|
+
close(): void;
|
|
122
|
+
private fetchProduct;
|
|
123
|
+
/** Resolve the active variant from the selected option values. */
|
|
124
|
+
private selectedVariant;
|
|
125
|
+
private get unitPrice();
|
|
126
|
+
private get compareAt();
|
|
127
|
+
private get availableQuantity();
|
|
128
|
+
private stockLabel;
|
|
129
|
+
private selectOption;
|
|
130
|
+
private allImages;
|
|
131
|
+
private get activeImage();
|
|
132
|
+
/** Add the current product + selected variant + qty to the cart. Returns the variant id used. */
|
|
133
|
+
private addCurrentToCart;
|
|
134
|
+
private addToCart;
|
|
135
|
+
/**
|
|
136
|
+
* Express buy: add to cart, then open the checkout overlay with Klarna
|
|
137
|
+
* preselected. The host app handles `vio:checkout-open` (same event the cart
|
|
138
|
+
* uses) — the `paymentMethod` hint tells it to preselect Klarna so its widget
|
|
139
|
+
* loads immediately. Reuses the working Klarna Payments flow (no express SDK).
|
|
140
|
+
*/
|
|
141
|
+
private buyWithKlarna;
|
|
142
|
+
/**
|
|
143
|
+
* Express buy with Apple Pay. Runs synchronously inside the click so the
|
|
144
|
+
* Apple Pay sheet keeps the user gesture: add to cart → open checkout (sets
|
|
145
|
+
* state) → launch the sheet. On authorize, `payment-complete` drives the
|
|
146
|
+
* confirmation drawer (same path as the in-checkout Apple Pay button).
|
|
147
|
+
*/
|
|
148
|
+
private buyWithApplePay;
|
|
149
|
+
render(): lit_html.TemplateResult<1>;
|
|
150
|
+
private renderBody;
|
|
151
|
+
private renderOptionPickers;
|
|
152
|
+
/** Best-effort HTML strip for description. */
|
|
153
|
+
private stripHtml;
|
|
154
|
+
}
|
|
155
|
+
declare global {
|
|
156
|
+
interface HTMLElementTagNameMap {
|
|
157
|
+
'vio-product-detail': VioProductDetail;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare class VioCart extends LitElement {
|
|
162
|
+
/** Drawer visibility. Reflects to attribute for `:host([open])`. */
|
|
163
|
+
open: boolean;
|
|
164
|
+
heading: string;
|
|
165
|
+
checkoutLabel: string;
|
|
166
|
+
emptyLabel: string;
|
|
167
|
+
subtotalLabel: string;
|
|
168
|
+
private carts;
|
|
169
|
+
private itemCount;
|
|
170
|
+
/** True when Apple Pay is usable (Safari + device + Stripe configured). */
|
|
171
|
+
private applePayAvailable;
|
|
172
|
+
/** Set after an Apple Pay express purchase — switches the drawer to the
|
|
173
|
+
* confirmation screen (so the rest of the cart/checkout is not shown). */
|
|
174
|
+
private confirmedOrder;
|
|
175
|
+
/** Pre-resolved Apple Pay handle; `show()` fires the sheet synchronously. */
|
|
176
|
+
private applePayHandle;
|
|
177
|
+
/** Cart total Apple Pay was last prepared for (avoids redundant prep). */
|
|
178
|
+
private preparedTotal;
|
|
179
|
+
private boundOnCartChange;
|
|
180
|
+
static styles: lit.CSSResult;
|
|
181
|
+
connectedCallback(): void;
|
|
182
|
+
disconnectedCallback(): void;
|
|
183
|
+
close(): void;
|
|
184
|
+
show(): void;
|
|
185
|
+
updated(changed: Map<string, unknown>): void;
|
|
186
|
+
/** Pre-resolve the Apple Pay sheet for the current cart total. */
|
|
187
|
+
private refreshApplePay;
|
|
188
|
+
/** Apple Pay express — pay the whole cart, then show the confirmation. */
|
|
189
|
+
private onApplePay;
|
|
190
|
+
private buildConfirmation;
|
|
191
|
+
private closeConfirmation;
|
|
192
|
+
/** Klarna express — opens the side-drawer Klarna checkout for the whole cart,
|
|
193
|
+
* skipping the address form (leveringsadresse) and method picker
|
|
194
|
+
* (betalingsmetode). The host's checkout-open handler closes this cart and
|
|
195
|
+
* opens <vio-checkout> in express mode with Klarna preselected. */
|
|
196
|
+
private onKlarnaExpress;
|
|
197
|
+
private get totalAcrossSponsors();
|
|
198
|
+
private get primaryCurrency();
|
|
199
|
+
private onIncrement;
|
|
200
|
+
private onDecrement;
|
|
201
|
+
private onRemove;
|
|
202
|
+
render(): lit_html.TemplateResult<1>;
|
|
203
|
+
private renderConfirmation;
|
|
204
|
+
}
|
|
205
|
+
declare global {
|
|
206
|
+
interface HTMLElementTagNameMap {
|
|
207
|
+
'vio-cart': VioCart;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare class VioCheckout extends LitElement {
|
|
212
|
+
open: boolean;
|
|
213
|
+
heading: string;
|
|
214
|
+
shippingLabel: string;
|
|
215
|
+
/** Express mode — render only the Klarna widget (no address form / method grid). */
|
|
216
|
+
express: boolean;
|
|
217
|
+
private checkoutState;
|
|
218
|
+
private items;
|
|
219
|
+
private applePayAvailable;
|
|
220
|
+
private applePayInProgress;
|
|
221
|
+
private klarnaAvailable;
|
|
222
|
+
private orderConfirmed;
|
|
223
|
+
private confirmedMethod;
|
|
224
|
+
private paymentError;
|
|
225
|
+
/** Snapshot of the placed order, for the confirmation screen. */
|
|
226
|
+
private confirmedOrder;
|
|
227
|
+
/** Active Klarna Payments widget handle + the subtotal it was mounted for. */
|
|
228
|
+
private klarnaHandle;
|
|
229
|
+
private klarnaMountedAmount;
|
|
230
|
+
private klarnaMountedShipping;
|
|
231
|
+
private klarnaMounting;
|
|
232
|
+
/** Categories offered by the active Klarna session + the selected one. */
|
|
233
|
+
private klarnaCategories;
|
|
234
|
+
private klarnaSelectedCat;
|
|
235
|
+
private klarnaAuthorizing;
|
|
236
|
+
/** Chosen shipping option id (express flow) — drives the Klarna order total. */
|
|
237
|
+
private selectedShipping;
|
|
238
|
+
private form;
|
|
239
|
+
private boundOnCheckoutChange;
|
|
240
|
+
private boundOnPaymentComplete;
|
|
241
|
+
private boundOnPaymentError;
|
|
242
|
+
static styles: lit.CSSResult;
|
|
243
|
+
connectedCallback(): void;
|
|
244
|
+
disconnectedCallback(): void;
|
|
245
|
+
updated(): void;
|
|
246
|
+
close(): void;
|
|
247
|
+
show(): void;
|
|
248
|
+
private refreshApplePay;
|
|
249
|
+
private refreshKlarna;
|
|
250
|
+
/** Mount (or re-mount on amount change) the Klarna Payments widget. */
|
|
251
|
+
private mountKlarnaIfNeeded;
|
|
252
|
+
private unmountKlarna;
|
|
253
|
+
/** Selected shipping option (express flow). */
|
|
254
|
+
private get shippingOption();
|
|
255
|
+
/** Pick a shipping option → re-mounts the Klarna widget with the new total. */
|
|
256
|
+
private onSelectShipping;
|
|
257
|
+
/** Switch the Klarna widget to a different payment_method_category. */
|
|
258
|
+
private onKlarnaCategory;
|
|
259
|
+
/** Authorize the selected Klarna method → backend creates the order. */
|
|
260
|
+
private onKlarnaAuthorize;
|
|
261
|
+
private onFieldChange;
|
|
262
|
+
private onApplePay;
|
|
263
|
+
private onPay;
|
|
264
|
+
/**
|
|
265
|
+
* Complete the order for the selected method (Vipps / Card / plain Klarna).
|
|
266
|
+
* Apple Pay and Klarna Express finish inside their own sheet/popup, so they
|
|
267
|
+
* never reach here. No real PSP is wired for Vipps/Card in this iteration —
|
|
268
|
+
* the capture happens backend-side in the full flow — so this confirms the
|
|
269
|
+
* order state-only and shows the confirmation screen.
|
|
270
|
+
*/
|
|
271
|
+
private onCompleteOrder;
|
|
272
|
+
/**
|
|
273
|
+
* Shared order confirmation — reached from both the plain "Betal" CTA
|
|
274
|
+
* (Vipps/Card/Klarna) and the Klarna Express authorize callback. Shows
|
|
275
|
+
* the confirmation screen, emits `vio:payment-success`, and clears the
|
|
276
|
+
* paid sponsor's cart so the badge + drawer reflect the purchase.
|
|
277
|
+
*/
|
|
278
|
+
private confirmOrder;
|
|
279
|
+
private methodLabel;
|
|
280
|
+
/** True for methods that complete via a separate sheet/widget, not the CTA. */
|
|
281
|
+
private isExpressMethod;
|
|
282
|
+
private orderTotal;
|
|
283
|
+
/** Shipping cost (major units) applied in express mode, else 0. */
|
|
284
|
+
private shippingMajor;
|
|
285
|
+
/** Total to charge — items + shipping (express). */
|
|
286
|
+
private payTotalLabel;
|
|
287
|
+
render(): lit_html.TemplateResult<1>;
|
|
288
|
+
private renderConfirmation;
|
|
289
|
+
/** Klarna Payments widget panel: shipping + category chips + widget + pay button. */
|
|
290
|
+
private renderKlarnaPanel;
|
|
291
|
+
/** Express layout — only the Klarna widget + a compact order summary. */
|
|
292
|
+
private renderKlarnaExpress;
|
|
293
|
+
private renderCheckoutBody;
|
|
294
|
+
}
|
|
295
|
+
declare global {
|
|
296
|
+
interface HTMLElementTagNameMap {
|
|
297
|
+
'vio-checkout': VioCheckout;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export { VioCart as V, VioCheckout as a, VioProduct as b, VioProductCarousel as c, VioProductDetail as d };
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vio-live/web-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vio Web SDK — in-site shoppable + native checkout, designed for editorial commerce sites",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"sideEffects": [
|
|
10
|
+
"./dist/**"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./core": {
|
|
18
|
+
"types": "./dist/core/index.d.ts",
|
|
19
|
+
"import": "./dist/core/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./ui": {
|
|
22
|
+
"types": "./dist/ui/index.d.ts",
|
|
23
|
+
"import": "./dist/ui/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"dev": "vite",
|
|
34
|
+
"typecheck": "tsc --noEmit",
|
|
35
|
+
"test": "vitest run",
|
|
36
|
+
"test:watch": "vitest",
|
|
37
|
+
"prepublishOnly": "npm run build"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"graphql-request": "^7.1.0",
|
|
41
|
+
"lit": "^3.2.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^22.10.0",
|
|
45
|
+
"tsup": "^8.5.1",
|
|
46
|
+
"typescript": "^5.6.3",
|
|
47
|
+
"vite": "^6.0.0",
|
|
48
|
+
"vitest": "^2.1.0"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18"
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/vio-live/vio-web-sdk.git"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/vio-live/vio-web-sdk#readme",
|
|
58
|
+
"bugs": {
|
|
59
|
+
"url": "https://github.com/vio-live/vio-web-sdk/issues"
|
|
60
|
+
},
|
|
61
|
+
"keywords": [
|
|
62
|
+
"vio",
|
|
63
|
+
"commerce",
|
|
64
|
+
"shoppable",
|
|
65
|
+
"checkout",
|
|
66
|
+
"web-components",
|
|
67
|
+
"lit",
|
|
68
|
+
"klarna",
|
|
69
|
+
"editorial-commerce"
|
|
70
|
+
],
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
},
|
|
74
|
+
"license": "MIT",
|
|
75
|
+
"private": false
|
|
76
|
+
}
|