diff --git a/libs/deps/merch-subscription-panel.js b/libs/deps/merch-subscription-panel.js index d89e59a410..af30d6d81a 100644 --- a/libs/deps/merch-subscription-panel.js +++ b/libs/deps/merch-subscription-panel.js @@ -1,5 +1,5 @@ -// branch: develop commit: 369516f3cda51fb1219ad0b3cf2c94c8f094c49b Tue, 21 May 2024 08:39:16 GMT -import{html as o,LitElement as E}from"/libs/deps/lit-all.min.js";var s=class{constructor(e,i){this.key=Symbol("match-media-key"),this.matches=!1,this.host=e,this.host.addController(this),this.media=window.matchMedia(i),this.matches=this.media.matches,this.onChange=this.onChange.bind(this),e.addController(this)}hostConnected(){var e;(e=this.media)==null||e.addEventListener("change",this.onChange)}hostDisconnected(){var e;(e=this.media)==null||e.removeEventListener("change",this.onChange)}onChange(e){this.matches!==e.matches&&(this.matches=e.matches,this.host.requestUpdate(this.key,!this.matches))}};import{css as m}from"/libs/deps/lit-all.min.js";var f=m` +// branch: develop commit: 7ff521873f6595e470276881ccfda07dbb8263ac Tue, 21 May 2024 09:37:12 GMT +import{html as o,LitElement as E}from"/libs/deps/lit-all.min.js";var s=class{constructor(t,i){this.key=Symbol("match-media-key"),this.matches=!1,this.host=t,this.host.addController(this),this.media=window.matchMedia(i),this.matches=this.media.matches,this.onChange=this.onChange.bind(this),t.addController(this)}hostConnected(){var t;(t=this.media)==null||t.addEventListener("change",this.onChange)}hostDisconnected(){var t;(t=this.media)==null||t.removeEventListener("change",this.onChange)}onChange(t){this.matches!==t.matches&&(this.matches=t.matches,this.host.requestUpdate(this.key,!this.matches))}};import{css as m}from"/libs/deps/lit-all.min.js";var f=m` :host { --merch-focused-outline: var(--merch-color-focus-ring) auto 1px; background-color: #f5f5f5; @@ -113,7 +113,7 @@ import{html as o,LitElement as E}from"/libs/deps/lit-all.min.js";var s=class{con a[is='checkout-link'] { display: none; } -`;var n="merch-offer-select:ready";var c="merch-offer:selected",a="merch-stock:change";var h="merch-quantity-selector:change";var p="(max-width: 1199px)";var l=class extends E{static styles=[f];static properties={continueText:{type:String,attribute:"continue-text"},quantity:{type:Number},ready:{type:Boolean,attribute:"ready",reflect:!0}};continueText="Continue";#e=new s(this,p);constructor(){super(),this.ready=!1}get listLayout(){return o` +`;var n="merch-offer-select:ready";var c="merch-offer:selected",a="merch-stock:change";var h="merch-quantity-selector:change";var p="(max-width: 1199px)";var l=class extends E{static styles=[f];static properties={continueText:{type:String,attribute:"continue-text"},quantity:{type:Number},ready:{type:Boolean,attribute:"ready",reflect:!0}};continueText="Continue";#t=new s(this,p);constructor(){super(),this.ready=!1}get listLayout(){return o` + + `}render(){return this.offerSelect?this.listLayout:this.waitLayout}connectedCallback(){super.connectedCallback(),this.#t.matches?this.setAttribute("layout","mobile"):this.setAttribute("layout","desktop"),this.addEventListener(n,this.handleOfferSelectReady),this.checkOfferSelectReady(),this.addEventListener(c,this.handleOfferSelect),this.addEventListener(a,this.handleStockChange),this.addEventListener(h,this.handleQuantitySelectChange)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(n,this.handleOfferSelectReady),this.removeEventListener(c,this.handleOfferSelect),this.removeEventListener(a,this.handleStockChange),this.removeEventListener(h,this.handleQuantitySelectChange)}handleSlotChange(){this.initOfferSelect(),this.initQuantitySelect(),this.initStock(),this.secureTransaction?.setAttribute("slot","footer")}async checkOfferSelectReady(){this.offerSelect&&(await this.offerSelect.updateComplete,this.offerSelect.planType&&this.handleOfferSelectReady())}handleOfferSelectReady(){this.ready=!0,this.initStock(),this.requestUpdate()}handleOfferSelect(t){this.offerSelect?.stock&&(this.stock.planType=t.detail.planType),this.requestUpdate()}handleQuantitySelectChange(t){this.quantity=t.detail.option}handleStockChange(){this.requestUpdate()}handleContinue(){this.shadowRoot.getElementById("checkoutLink").click()}async initOfferSelect(){this.offerSelect&&(this.offerSelect.querySelectorAll("merch-offer").forEach(t=>t.type="subscription-option"),this.ready=!!this.offerSelect.planType,this.offerSelect.setAttribute("slot","offers"),await this.offerSelect.selectOffer(this.offerSelect.querySelector("merch-offer[aria-selected]")),await this.offerSelect.selectedOffer.price.onceSettled(),this.requestUpdate())}initStock(){this.stock&&(this.stock.setAttribute("slot","footer"),this.offerSelect?.stock?this.stock.planType=this.offerSelect.planType:this.stock.planType=null)}initQuantitySelect(){this.quantitySelect&&this.quantitySelect.setAttribute("slot","footer")}get offerSelect(){return this.querySelector("merch-offer-select")}get quantitySelect(){return this.querySelector("merch-quantity-select")}get stock(){return this.querySelector("merch-stock")}get secureTransaction(){return this.querySelector("merch-secure-transaction")}get checkoutLink(){if(!this.offerSelect?.selectedOffer?.price?.value)return;let[{offerSelectorIds:[t]}]=this.offerSelect.selectedOffer.price?.value;if(!t)return;let i=[t];if(this.stock){let e=this.stock.osi;e&&i.push(e)}let d=i.join(","),r=this.offerSelect.selectedOffer.cta;if(r&&r.value){let e=r?.cloneNode(!0);return e.setAttribute("id","checkoutLink"),e.setAttribute("data-wcs-osi",d),e.setAttribute("data-quantity",this.quantity),e.removeAttribute("target"),o`${e}`}return o`