@vio-live/web-sdk 0.8.0 → 0.9.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/dist/{chunk-YNKOGPTE.js → chunk-OTL6QM3G.js} +145 -5
- package/dist/chunk-OTL6QM3G.js.map +1 -0
- package/dist/{chunk-4ZEN4J7I.js → chunk-SNIF67UB.js} +99 -3
- package/dist/chunk-SNIF67UB.js.map +1 -0
- package/dist/core/index.d.ts +50 -2
- 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-DtqqmAiG.d.ts → tokens-CrO2ciCS.d.ts} +11 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-4ZEN4J7I.js.map +0 -1
- package/dist/chunk-YNKOGPTE.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vio, __decorateClass, primaryImageUrl, displayPrice, getGlobalCurrency, formatPrice } from './chunk-
|
|
1
|
+
import { Vio, __decorateClass, primaryImageUrl, displayPrice, getGlobalCurrency, formatPrice } from './chunk-SNIF67UB.js';
|
|
2
2
|
import { LitElement, css, html } from 'lit';
|
|
3
3
|
import { property, state, query } from 'lit/decorators.js';
|
|
4
4
|
|
|
@@ -2838,6 +2838,8 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
2838
2838
|
this.kustomMountedOrderId = null;
|
|
2839
2839
|
this.qliroMounting = false;
|
|
2840
2840
|
this.qliroMountedOrderId = null;
|
|
2841
|
+
this.walleyMounting = false;
|
|
2842
|
+
this.walleyMountedOrderId = null;
|
|
2841
2843
|
this.stripeLoading = false;
|
|
2842
2844
|
this.vippsLoading = false;
|
|
2843
2845
|
this.form = {
|
|
@@ -3629,6 +3631,63 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
3629
3631
|
this.cleanReturnQueryParams(["checkout_id", "payment_processor"]);
|
|
3630
3632
|
return;
|
|
3631
3633
|
}
|
|
3634
|
+
if (urlParams.get("payment_processor") === "WALLEY" && checkoutId) {
|
|
3635
|
+
if (!this.checkoutState) {
|
|
3636
|
+
const spIdToUse = sponsorId || [...Vio.cart.getAllCarts().keys()][0] || 0;
|
|
3637
|
+
if (spIdToUse) {
|
|
3638
|
+
try {
|
|
3639
|
+
Vio.checkout.open(spIdToUse);
|
|
3640
|
+
} catch {
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
try {
|
|
3645
|
+
Vio.checkout.selectPaymentMethod("walley");
|
|
3646
|
+
} catch {
|
|
3647
|
+
}
|
|
3648
|
+
this.open = true;
|
|
3649
|
+
this.paymentNotice = "Bekrefter betalingen\u2026";
|
|
3650
|
+
try {
|
|
3651
|
+
const order = await Vio.checkout.getWalleyOrder(
|
|
3652
|
+
checkoutId,
|
|
3653
|
+
this.checkoutState?.sponsorId
|
|
3654
|
+
);
|
|
3655
|
+
this.paymentNotice = null;
|
|
3656
|
+
if (order?.html_snippet) {
|
|
3657
|
+
this.walleyMountedOrderId = order.order_id;
|
|
3658
|
+
await this.updateComplete;
|
|
3659
|
+
const container = this.renderRoot?.querySelector(
|
|
3660
|
+
"#vio-walley-checkout-container"
|
|
3661
|
+
);
|
|
3662
|
+
if (container) {
|
|
3663
|
+
Vio.checkout.renderKustomSnippet(container, order.html_snippet);
|
|
3664
|
+
}
|
|
3665
|
+
if (order.status === "PurchaseCompleted") {
|
|
3666
|
+
this.dispatchEvent(
|
|
3667
|
+
new CustomEvent("vio:payment-success", {
|
|
3668
|
+
detail: { method: "walley", orderId: order.order_id },
|
|
3669
|
+
bubbles: true,
|
|
3670
|
+
composed: true
|
|
3671
|
+
})
|
|
3672
|
+
);
|
|
3673
|
+
const spId = this.checkoutState?.sponsorId;
|
|
3674
|
+
if (spId) {
|
|
3675
|
+
try {
|
|
3676
|
+
Vio.cart.clearSponsorCart(spId);
|
|
3677
|
+
} catch {
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
} catch (err) {
|
|
3683
|
+
this.paymentNotice = null;
|
|
3684
|
+
if (typeof console !== "undefined") {
|
|
3685
|
+
console.warn("[VioCheckout] Walley confirmation read failed:", err);
|
|
3686
|
+
}
|
|
3687
|
+
}
|
|
3688
|
+
this.cleanReturnQueryParams(["checkout_id", "payment_processor"]);
|
|
3689
|
+
return;
|
|
3690
|
+
}
|
|
3632
3691
|
if (vioMethod === "klarna" && typeof sessionStorage !== "undefined" && sessionStorage.getItem("vio.klarna.pending.v1")) {
|
|
3633
3692
|
this.cleanReturnQueryParams(["vio_payment", "vio_method", "vio_sponsor", "checkout_id"]);
|
|
3634
3693
|
return;
|
|
@@ -3725,6 +3784,7 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
3725
3784
|
void this.mountKlarnaIfNeeded();
|
|
3726
3785
|
void this.mountKustomIfNeeded();
|
|
3727
3786
|
void this.mountQliroIfNeeded();
|
|
3787
|
+
void this.mountWalleyIfNeeded();
|
|
3728
3788
|
}
|
|
3729
3789
|
close() {
|
|
3730
3790
|
this.open = false;
|
|
@@ -3969,6 +4029,10 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
3969
4029
|
Vio.checkout.selectPaymentMethod("qliro");
|
|
3970
4030
|
return;
|
|
3971
4031
|
}
|
|
4032
|
+
if (method === "walley") {
|
|
4033
|
+
Vio.checkout.selectPaymentMethod("walley");
|
|
4034
|
+
return;
|
|
4035
|
+
}
|
|
3972
4036
|
if (method === "vipps") {
|
|
3973
4037
|
const email = String(this.form.email ?? "").trim();
|
|
3974
4038
|
if (!email || !email.includes("@")) {
|
|
@@ -4074,6 +4138,8 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
4074
4138
|
return "Kustom";
|
|
4075
4139
|
case "qliro":
|
|
4076
4140
|
return "Qliro";
|
|
4141
|
+
case "walley":
|
|
4142
|
+
return "Walley";
|
|
4077
4143
|
case "vipps":
|
|
4078
4144
|
return "Vipps";
|
|
4079
4145
|
case "stripe":
|
|
@@ -4086,7 +4152,7 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
4086
4152
|
}
|
|
4087
4153
|
/** True for methods that complete via a separate sheet/widget, not the CTA. */
|
|
4088
4154
|
isExpressMethod(method) {
|
|
4089
|
-
return method === "apple-pay" || method === "klarna" || method === "kustom" || method === "qliro";
|
|
4155
|
+
return method === "apple-pay" || method === "klarna" || method === "kustom" || method === "qliro" || method === "walley";
|
|
4090
4156
|
}
|
|
4091
4157
|
orderTotal() {
|
|
4092
4158
|
const s = this.checkoutState;
|
|
@@ -4244,6 +4310,70 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
4244
4310
|
</div>
|
|
4245
4311
|
`;
|
|
4246
4312
|
}
|
|
4313
|
+
/**
|
|
4314
|
+
* Mount the Walley embedded checkout once it's the chosen method. Unlike
|
|
4315
|
+
* Kustom/Qliro, success is signalled INLINE by Walley's own DOM event
|
|
4316
|
+
* (`walleyCheckoutPurchaseCompleted`) — no redirect round-trip needed, so
|
|
4317
|
+
* we handle it here instead of only in the confirmation-return branch.
|
|
4318
|
+
*/
|
|
4319
|
+
async mountWalleyIfNeeded() {
|
|
4320
|
+
if (!this.open || !this.checkoutState) return;
|
|
4321
|
+
if (this.checkoutState.paymentMethod !== "walley") return;
|
|
4322
|
+
if (this.walleyMounting) return;
|
|
4323
|
+
const container = this.renderRoot?.querySelector(
|
|
4324
|
+
"#vio-walley-checkout-container"
|
|
4325
|
+
);
|
|
4326
|
+
if (!container) return;
|
|
4327
|
+
if (this.walleyMountedOrderId && container.childElementCount > 0) return;
|
|
4328
|
+
this.walleyMounting = true;
|
|
4329
|
+
container.innerHTML = "";
|
|
4330
|
+
try {
|
|
4331
|
+
const order = await Vio.checkout.mountWalleyCheckout(
|
|
4332
|
+
container,
|
|
4333
|
+
this.checkoutState.sponsorId,
|
|
4334
|
+
() => {
|
|
4335
|
+
this.dispatchEvent(
|
|
4336
|
+
new CustomEvent("vio:payment-success", {
|
|
4337
|
+
detail: { method: "walley", orderId: order.order_id },
|
|
4338
|
+
bubbles: true,
|
|
4339
|
+
composed: true
|
|
4340
|
+
})
|
|
4341
|
+
);
|
|
4342
|
+
const spId = this.checkoutState?.sponsorId;
|
|
4343
|
+
if (spId) {
|
|
4344
|
+
try {
|
|
4345
|
+
Vio.cart.clearSponsorCart(spId);
|
|
4346
|
+
} catch {
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
);
|
|
4351
|
+
this.walleyMountedOrderId = order.order_id;
|
|
4352
|
+
} catch (err) {
|
|
4353
|
+
if (typeof console !== "undefined") {
|
|
4354
|
+
console.warn("[VioCheckout] Walley mount failed:", err);
|
|
4355
|
+
}
|
|
4356
|
+
this.paymentError = `Kunne ikke laste Walley: ${err instanceof Error ? err.message : String(err)}`;
|
|
4357
|
+
Vio.checkout.selectPaymentMethod("");
|
|
4358
|
+
} finally {
|
|
4359
|
+
this.walleyMounting = false;
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
unmountWalley() {
|
|
4363
|
+
this.walleyMountedOrderId = null;
|
|
4364
|
+
const container = this.renderRoot?.querySelector(
|
|
4365
|
+
"#vio-walley-checkout-container"
|
|
4366
|
+
);
|
|
4367
|
+
if (container) container.innerHTML = "";
|
|
4368
|
+
}
|
|
4369
|
+
renderWalleyPanel() {
|
|
4370
|
+
return html`
|
|
4371
|
+
<div class="walley-panel">
|
|
4372
|
+
${this.walleyMounting ? html`<div style="font-size:13px;opacity:0.7;padding:8px 0;">Laster Walley…</div>` : ""}
|
|
4373
|
+
<div id="vio-walley-checkout-container"></div>
|
|
4374
|
+
</div>
|
|
4375
|
+
`;
|
|
4376
|
+
}
|
|
4247
4377
|
renderKlarnaPanel() {
|
|
4248
4378
|
const currency = this.checkoutState?.currency || getGlobalCurrency();
|
|
4249
4379
|
return html`
|
|
@@ -4353,7 +4483,7 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
4353
4483
|
const method = this.checkoutState?.paymentMethod;
|
|
4354
4484
|
const showCompleteCta = !!method && !this.isExpressMethod(method);
|
|
4355
4485
|
const isVipps = method === "vipps";
|
|
4356
|
-
const isKustom = method === "kustom" || method === "qliro";
|
|
4486
|
+
const isKustom = method === "kustom" || method === "qliro" || method === "walley";
|
|
4357
4487
|
return html`
|
|
4358
4488
|
${!isVipps && !isKustom ? html`
|
|
4359
4489
|
<section class="section">
|
|
@@ -4485,6 +4615,7 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
4485
4615
|
this.unmountKlarna();
|
|
4486
4616
|
this.unmountKustom();
|
|
4487
4617
|
this.unmountQliro();
|
|
4618
|
+
this.unmountWalley();
|
|
4488
4619
|
Vio.checkout.selectPaymentMethod("");
|
|
4489
4620
|
}}
|
|
4490
4621
|
>
|
|
@@ -4495,6 +4626,7 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
4495
4626
|
${method === "klarna" ? this.renderKlarnaPanel() : ""}
|
|
4496
4627
|
${method === "kustom" ? this.renderKustomPanel() : ""}
|
|
4497
4628
|
${method === "qliro" ? this.renderQliroPanel() : ""}
|
|
4629
|
+
${method === "walley" ? this.renderWalleyPanel() : ""}
|
|
4498
4630
|
${method === "stripe" ? html`
|
|
4499
4631
|
<button
|
|
4500
4632
|
class="payment-btn primary complete-cta"
|
|
@@ -4579,6 +4711,11 @@ var _VioCheckout = class _VioCheckout extends LitElement {
|
|
|
4579
4711
|
<span style="font-weight:800;font-size:16px;letter-spacing:-0.01em">Qliro</span>
|
|
4580
4712
|
</button>
|
|
4581
4713
|
` : ""}
|
|
4714
|
+
${this.methodEnabled("walley") ? html`
|
|
4715
|
+
<button class="payment-btn" @click=${() => this.onPay("walley")}>
|
|
4716
|
+
<span style="font-weight:800;font-size:16px;letter-spacing:-0.01em">Walley</span>
|
|
4717
|
+
</button>
|
|
4718
|
+
` : ""}
|
|
4582
4719
|
${this.methodEnabled("vipps") ? html`
|
|
4583
4720
|
<button class="payment-btn" @click=${() => this.onPay("vipps")}>
|
|
4584
4721
|
<span style="color:#ff5b24;font-weight:800;font-size:17px;letter-spacing:-0.02em">vipps</span>
|
|
@@ -4697,6 +4834,9 @@ __decorateClass([
|
|
|
4697
4834
|
__decorateClass([
|
|
4698
4835
|
state()
|
|
4699
4836
|
], _VioCheckout.prototype, "qliroMounting", 2);
|
|
4837
|
+
__decorateClass([
|
|
4838
|
+
state()
|
|
4839
|
+
], _VioCheckout.prototype, "walleyMounting", 2);
|
|
4700
4840
|
__decorateClass([
|
|
4701
4841
|
state()
|
|
4702
4842
|
], _VioCheckout.prototype, "stripeLoading", 2);
|
|
@@ -4725,5 +4865,5 @@ function registerVioElements() {
|
|
|
4725
4865
|
}
|
|
4726
4866
|
|
|
4727
4867
|
export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements };
|
|
4728
|
-
//# sourceMappingURL=chunk-
|
|
4729
|
-
//# sourceMappingURL=chunk-
|
|
4868
|
+
//# sourceMappingURL=chunk-OTL6QM3G.js.map
|
|
4869
|
+
//# sourceMappingURL=chunk-OTL6QM3G.js.map
|