1function UserCouponsFactory(container){let UserCoupons=class{constructor(container2){this.api,this.target=container2,this.target_validation,this._init()}_init(){this._setEvents()}async _setEvents(){document.addEventListener("so.coupon:copy_code",async e=>{e.preventDefault(),this.copyCoupon(e.detail.couponCode),e.detail.input.innerHTML="Copiado",await window.SimpleCore._helpers.sleep(2500),e.detail.input.innerHTML="Copiar C\xF3digo"});for(const authModalTrigger of[...this.target.querySelectorAll('[data-action="open-auth-modal"]')])authModalTrigger.addEventListener("click",async e=>{e.preventDefault(),window.SimpleCore._helpers.triggerEvent("modal:close",{target:document.querySelector('[aria-controls="modal-user_coupons"]')}),await window.SimpleCore._helpers.sleep(500),window.SimpleCore._helpers.triggerEvent("modal:open",{target:document.querySelector('[aria-controls="modal-user_auth"]')})})}async redeemUserCoupon(coupon_id){if(!coupon_id)throw new Error("coupon_id is not defined");const couponCode=await this.user_coupons.redeeem(coupon_id);let selected_coupon_index=this.coupons.findIndex(c=>c._id===coupon_id),selected_coupon=this.coupons.find(c=>c._id===coupon_id);this.coupons[selected_coupon_index]={...selected_coupon,code:couponCode.code}}async copyCoupon(coupon_code){if(!coupon_code)throw new Error("coupon_code is not defined");try{await navigator.clipboard.writeText(coupon_code),window.SimpleCore._helpers.setCookie("discount_code",coupon_code),this.coupon_copied=coupon_code}catch(err){console.error("Failed to copy text: ",err)}}};return new UserCoupons(container)} 2//# sourceMappingURL=/cdn/shop/t/275/assets/services.user-coupons.js.map?v=103752434320995876111746811430
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.