PageSourceSearch

https://cellev8.com/cdn/shop/t/40/assets/wlsn-product-form-frequency.js?v=69438956823052503841786439136

js cellev8.com collected 2026-10-05 02:48:16 UTC 5,814 bytes, 2 lines download raw bytes

1if(!customElements.get("wlsn-product-form-frequency")){class WLSNProductFormFrequency extends HTMLElement{constructor(){super(),this.classes={inputSellingPlan:'input[name="selling_plan"]',inputPurchaseType:'input[name="purchase-type"]',subscriptionGroup:"js-wlsn-product-form-frequency-subscription",oneTimeGroup:"js-wlsn-product-form-frequency-one-time",subscriptionDiscount:"js-subscription-discount",labelGroup:"js-wlsn-product-form-frequency-label",optionsSelector:"wlsn-options-selector",active:"active",disabled:"disabled",selected:"selected"},this.purchaseType={OTP:"one-time",SUB:"subscription"},this.currentSellingPlan=""}get elements(){return{sellingPlanInput:this.querySelector(this.classes.inputSellingPlan),purchaseTypeInputs:this.querySelectorAll(this.classes.inputPurchaseType),subscriptionGroup:this.querySelector(`.${this.classes.subscriptionGroup}`),oneTimeGroup:this.querySelector(`.${this.classes.oneTimeGroup}`),optionsSelector:this.querySelector(this.classes.optionsSelector)}}connectedCallback(){this.bindEvents();const checkedInput=this.querySelector('input[name="purchase-type"]:checked');checkedInput&&this.emitPurchaseTypeChange(checkedInput.value)}disconnectedCallback(){this.unbindEvents()}bindEvents(){const{purchaseTypeInputs,optionsSelector,subscriptionGroup,oneTimeGroup}=this.elements;purchaseTypeInputs.forEach(input=>{input.addEventListener("change",this.handlePurchaseTypeChange.bind(this))}),optionsSelector&&optionsSelector.addEventListener("wlsn:selector:change",this.handleOptionsSelectorChange.bind(this)),subscriptionGroup&&subscriptionGroup.addEventListener("click",this.handleSubscriptionGroupClick.bind(this),!0),oneTimeGroup&&oneTimeGroup.addEventListener("click",this.handleOneTimeGroupClick.bind(this),!0)}unbindEvents(){const{purchaseTypeInputs,optionsSelector,subscriptionGroup,oneTimeGroup}=this.elements;purchaseTypeInputs.forEach(input=>{input.removeEventListener("change",this.handlePurchaseTypeChange.bind(this))}),optionsSelector&&optionsSelector.removeEventListener("wlsn:selector:change",this.handleOptionsSelectorChange.bind(this)),subscriptionGroup&&subscriptionGroup.removeEventListener("click",this.handleSubscriptionGroupClick.bind(this),!0),oneTimeGroup&&oneTimeGroup.removeEventListener("click",this.handleOneTimeGroupClick.bind(this),!0)}handlePurchaseTypeChange(event){const target=event.target,value=target.value,{purchaseTypeInputs}=this.elements;purchaseTypeInputs.forEach(input=>{input.checked=!1}),target.checked=!0,this.setSellingPlanInput(value),this.emitPurchaseTypeChange(value)}handleSubscriptionGroupClick(event){const{optionsSelector}=this.elements,clickedElement=event.target;if(optionsSelector&&optionsSelector.contains(clickedElement)||clickedElement.closest(`.${this.classes.labelGroup}`))return;const subscriptionRadio=this.querySelector(`input[value="${this.purchaseType.SUB}"]`);subscriptionRadio&&!subscriptionRadio.checked&&(subscriptionRadio.checked=!0,subscriptionRadio.dispatchEvent(new Event("change",{bubbles:!0})))}handleOneTimeGroupClick(event){if(event.target.closest(`.${this.classes.labelGroup}`))return;const oneTimeRadio=this.querySelector(`input[value="${this.purchaseType.OTP}"]`);oneTimeRadio&&!oneTimeRadio.checked&&(oneTimeRadio.checked=!0,oneTimeRadio.dispatchEvent(new Event("change",{bubbles:!0})))}handleOptionsSelectorChange(event){const{detail}=event,{value}=detail,{sellingPlanInput}=this.elements;sellingPlanInput.value=value,this.currentSellingPlan=value,this.updateSubscriptionDiscount()}setSellingPlanInput(value){const{subscriptionGroup,oneTimeGroup,sellingPlanInput,optionsSelector}=this.elements;if(value===this.purchaseType.SUB){let firstSellingPlanValue="";optionsSelector&&(firstSellingPlanValue=optionsSelector.querySelector("wlsn-options-selector-item.selected")?.getAttribute("data-option-value")||"",optionsSelector.removeAttribute("disabled"),optionsSelector.classList.remove(this.classes.disabled)),sellingPlanInput.value=firstSellingPlanValue,this.currentSellingPlan=firstSellingPlanValue,subscriptionGroup.classList.add(this.classes.active),oneTimeGroup.classList.remove(this.classes.active),this.updateSubscriptionDiscount()}value===this.purchaseType.OTP&&(sellingPlanInput.value="",this.currentSellingPlan="",subscriptionGroup.classList.remove(this.classes.active),oneTimeGroup.classList.add(this.classes.active),optionsSelector&&(optionsSelector.setAttribute("disabled",""),optionsSelector.classList.add(this.classes.disabled)))}updateSubscriptionDiscount(){const discountElement=this.querySelector(`.${this.classes.subscriptionDiscount}`);if(!discountElement||!this.currentSellingPlan)return;const{optionsSelector}=this.elements;if(!optionsSelector)return;const selectedItem=optionsSelector.querySelector(`wlsn-options-selector-item[data-option-value="${this.currentSellingPlan}"]`);if(!selectedItem)return;const priceAdjustments=selectedItem.getAttribute("data-price-adjustments");if(!priceAdjustments)return;let adjustments=[];try{adjustments=JSON.parse(priceAdjustments)}catch(e){console.warn("Invalid price adjustment JSON",e);return}const adjustment=adjustments[0];adjustment&&(adjustment.value_type==="percentage"?discountElement.textContent=` ${adjustment.value}%`:adjustment.value_type==="amount"?discountElement.textContent=` ${this.formatMoney(adjustment.value)}`:discountElement.textContent="")}formatMoney(cents){const moneyFormat=window.theme?.moneyFormat||"${{amount}}";return window.WLSNHelpers.formatMoney(cents,moneyFormat)||`$${(cents/100).toFixed(2)}`}emitPurchaseTypeChange(purchaseType){window.WLSNHelpers.triggerEvent(this,"wlsn:purchase-type:change",{purchaseType})}}customElements.define("wlsn-product-form-frequency",WLSNProductFormFrequency)}
2//# sourceMappingURL=/cdn/shop/t/40/assets/wlsn-product-form-frequency.js.map?v=69438956823052503841786439136

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.