@vio-live/web-sdk 0.9.0 → 0.10.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.
@@ -1,4 +1,4 @@
1
- import { Vio, __decorateClass, primaryImageUrl, displayPrice, getGlobalCurrency, formatPrice } from './chunk-SNIF67UB.js';
1
+ import { Vio, __decorateClass, primaryImageUrl, displayPrice, getGlobalCurrency, formatPrice } from './chunk-PX27CQGX.js';
2
2
  import { LitElement, css, html } from 'lit';
3
3
  import { property, state, query } from 'lit/decorators.js';
4
4
 
@@ -3599,9 +3599,7 @@ var _VioCheckout = class _VioCheckout extends LitElement {
3599
3599
  if (order?.html_snippet) {
3600
3600
  this.qliroMountedOrderId = order.order_id;
3601
3601
  await this.updateComplete;
3602
- const container = this.renderRoot?.querySelector(
3603
- "#vio-qliro-checkout-container"
3604
- );
3602
+ const container = this.lightContainer("vio-qliro-checkout-container", "vio-qliro");
3605
3603
  if (container) {
3606
3604
  Vio.checkout.renderKustomSnippet(container, order.html_snippet);
3607
3605
  }
@@ -3656,9 +3654,7 @@ var _VioCheckout = class _VioCheckout extends LitElement {
3656
3654
  if (order?.html_snippet) {
3657
3655
  this.walleyMountedOrderId = order.order_id;
3658
3656
  await this.updateComplete;
3659
- const container = this.renderRoot?.querySelector(
3660
- "#vio-walley-checkout-container"
3661
- );
3657
+ const container = this.lightContainer("vio-walley-checkout-container", "vio-walley");
3662
3658
  if (container) {
3663
3659
  Vio.checkout.renderKustomSnippet(container, order.html_snippet);
3664
3660
  }
@@ -4268,14 +4264,33 @@ var _VioCheckout = class _VioCheckout extends LitElement {
4268
4264
  `;
4269
4265
  }
4270
4266
  /** Mount the Qliro embedded checkout once it's the chosen method. */
4267
+ /**
4268
+ * Container for a third-party embed, living in the LIGHT DOM.
4269
+ *
4270
+ * Qliro's (and Walley's) bootstrap script resolves its mount point from the
4271
+ * document, so a container inside this component's shadow root is invisible
4272
+ * to it and the widget silently never renders — verified against Qliro's
4273
+ * staging widget: identical snippet, light DOM renders the iframe, shadow
4274
+ * DOM renders nothing at all. The element is a child of the host (light DOM)
4275
+ * and is projected back into the panel through a named slot, so the layout
4276
+ * is unchanged. Kustom's KCO snippet resolves its own script's parent, so it
4277
+ * works either way and keeps using the shadow-root container.
4278
+ */
4279
+ lightContainer(id, slotName) {
4280
+ let el = this.querySelector(`#${id}`);
4281
+ if (!el) {
4282
+ el = document.createElement("div");
4283
+ el.id = id;
4284
+ el.setAttribute("slot", slotName);
4285
+ this.appendChild(el);
4286
+ }
4287
+ return el;
4288
+ }
4271
4289
  async mountQliroIfNeeded() {
4272
4290
  if (!this.open || !this.checkoutState) return;
4273
4291
  if (this.checkoutState.paymentMethod !== "qliro") return;
4274
4292
  if (this.qliroMounting) return;
4275
- const container = this.renderRoot?.querySelector(
4276
- "#vio-qliro-checkout-container"
4277
- );
4278
- if (!container) return;
4293
+ const container = this.lightContainer("vio-qliro-checkout-container", "vio-qliro");
4279
4294
  if (this.qliroMountedOrderId && container.childElementCount > 0) return;
4280
4295
  this.qliroMounting = true;
4281
4296
  container.innerHTML = "";
@@ -4297,16 +4312,14 @@ var _VioCheckout = class _VioCheckout extends LitElement {
4297
4312
  }
4298
4313
  unmountQliro() {
4299
4314
  this.qliroMountedOrderId = null;
4300
- const container = this.renderRoot?.querySelector(
4301
- "#vio-qliro-checkout-container"
4302
- );
4303
- if (container) container.innerHTML = "";
4315
+ Vio.checkout.destroyQliroListeners();
4316
+ this.querySelector("#vio-qliro-checkout-container")?.remove();
4304
4317
  }
4305
4318
  renderQliroPanel() {
4306
4319
  return html`
4307
4320
  <div class="qliro-panel">
4308
4321
  ${this.qliroMounting ? html`<div style="font-size:13px;opacity:0.7;padding:8px 0;">Laster Qliro…</div>` : ""}
4309
- <div id="vio-qliro-checkout-container"></div>
4322
+ <slot name="vio-qliro"></slot>
4310
4323
  </div>
4311
4324
  `;
4312
4325
  }
@@ -4320,10 +4333,7 @@ var _VioCheckout = class _VioCheckout extends LitElement {
4320
4333
  if (!this.open || !this.checkoutState) return;
4321
4334
  if (this.checkoutState.paymentMethod !== "walley") return;
4322
4335
  if (this.walleyMounting) return;
4323
- const container = this.renderRoot?.querySelector(
4324
- "#vio-walley-checkout-container"
4325
- );
4326
- if (!container) return;
4336
+ const container = this.lightContainer("vio-walley-checkout-container", "vio-walley");
4327
4337
  if (this.walleyMountedOrderId && container.childElementCount > 0) return;
4328
4338
  this.walleyMounting = true;
4329
4339
  container.innerHTML = "";
@@ -4361,16 +4371,13 @@ var _VioCheckout = class _VioCheckout extends LitElement {
4361
4371
  }
4362
4372
  unmountWalley() {
4363
4373
  this.walleyMountedOrderId = null;
4364
- const container = this.renderRoot?.querySelector(
4365
- "#vio-walley-checkout-container"
4366
- );
4367
- if (container) container.innerHTML = "";
4374
+ this.querySelector("#vio-walley-checkout-container")?.remove();
4368
4375
  }
4369
4376
  renderWalleyPanel() {
4370
4377
  return html`
4371
4378
  <div class="walley-panel">
4372
4379
  ${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>
4380
+ <slot name="vio-walley"></slot>
4374
4381
  </div>
4375
4382
  `;
4376
4383
  }
@@ -4865,5 +4872,5 @@ function registerVioElements() {
4865
4872
  }
4866
4873
 
4867
4874
  export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements };
4868
- //# sourceMappingURL=chunk-OTL6QM3G.js.map
4869
- //# sourceMappingURL=chunk-OTL6QM3G.js.map
4875
+ //# sourceMappingURL=chunk-WIQ53CCM.js.map
4876
+ //# sourceMappingURL=chunk-WIQ53CCM.js.map