1(function(){const loadScript=function(url,callback){const script=document.createElement("script");script.type="text/javascript",script.readyState?script.onreadystatechange=function(){(script.readyState==="loaded"||script.readyState==="complete")&&(script.onreadystatechange=null,callback())}:script.onload=function(){callback()},script.src=url,document.getElementsByTagName("head")[0].appendChild(script)};timesactScriptNew=async function($){const style=document.createElement("style");style.id="TimesactCSS",style.innerHTML=`.timesact-badge-ribbon span::before { 2 content: ""; 3 position: absolute; left: 0px; top: 100%; 4 z-index: -1; 5 border-left: 3px solid #888888; 6 border-right: 3px solid transparent; 7 border-bottom: 3px solid transparent; 8 border-top: 3px solid #888888; 9 } 10 .timesact-badge-ribbon span::after { 11 content: ""; 12 position: absolute; right: 0px; top: 100%; 13 z-index: -1; 14 border-left: 3px solid transparent; 15 border-right: 3px solid #888888; 16 border-bottom: 3px solid transparent; 17 border-top: 3px solid #888888; 18 } 19 .md-modal { 20 position: fixed; 21 top: 50%; 22 left: 50%; 23 width: 40%; 24 height: auto; 25 z-index: 2000; 26 visibility: hidden; 27 transform: translateX(-50%) translateY(-50%); 28 } 29 .md-content { 30 background: #fff; 31 position: relative; 32 border-radius: 10px; 33 margin: 0 auto; 34 } 35 .md-show { 36 visibility: visible; 37 } 38 .md-show ~ .md-overlay { 39 opacity: 1; 40 visibility: visible; 41 display: block; 42 } 43 .popup-container { 44 min-height: 100%; 45 display: none; 46 } 47 .md-overlay { 48 position: fixed; 49 width: 100%; 50 height: 100%; 51 visibility: hidden; 52 top: 0; 53 left: 0; 54 z-index: 1000; 55 opacity: 0; 56 background: #c9c9c9c2; 57 -webkit-transition: all 0.3s; 58 -moz-transition: all 0.3s; 59 transition: all 0.3s; 60 } 61 .md-body { 62 text-align: center; 63 padding-top: 10%; 64 padding-bottom: 10%; 65 font-family: "Roboto"; 66 } 67 p.message { 68 padding: 20px; 69 } 70 .md-close { 71 background: #f70427; 72 border: none; 73 color: white; 74 padding: 10px; 75 border-radius: 4px; 76 cursor: pointer; 77 } 78 @media screen and (max-width: 32em) { 79 .md-modal { width: 80%; } 80 } 81 .timesact_bis_popup_overlay { 82 position: fixed; 83 top: 0; 84 left: 0; 85 z-index: 100040; 86 visibility: hidden; 87 width: 100vw; 88 height: 100vh; 89 background-color: #000; 90 opacity: .5; 91 display: block !important; 92 } 93 94 .timesact_bis_dialog { 95 display: inline-table; 96 position: fixed; 97 top: 0; 98 left: 0; 99 z-index: 100050; 100 visibility: hidden; 101 width: 100%; 102 height: 100%; 103 overflow-x: hidden; 104 overflow-y: auto; 105 outline: 0; 106 } 107 108 .timesact_bis_popup_overlay_show, 109 .timesact_bis_dialog_show { 110 visibility: visible; 111 } 112 113 .timesact_bis_popup { 114 z-index: 1000000; 115 background: #fff; 116 color: #000; 117 margin: auto; 118 pointer-events: none; 119 max-width: 460px; 120 width: 96%; 121 top: 50%; 122 left: 50%; 123 transform: translate(-50%, -50%); 124 position: fixed; 125 border-radius: 10px; 126 font-size: 14px; 127 /*add dynamic value*/ 128 } 129 130 .timesact_bis_popup_content { 131 pointer-events: auto; 132 position: relative 133 } 134 135 .timesact_bis_popup_body { 136 padding: 20px; 137 position: relative; 138 display: flex; 139 flex-direction: column; 140 width: 100%; 141 border-radius: .3rem 142 } 143 144 .timesact_bis_close_button { 145 padding: 5px; 146 background: 0 0; 147 font-size: 1.4rem; 148 font-weight: 700; 149 line-height: 1; 150 opacity: 1; 151 cursor: pointer; 152 outline: 0; 153 border-radius: 0; 154 position: absolute; 155 top: 0; 156 right: 0; 157 border: 0 158 } 159 160 .timesact_bis_close_span { 161 display: inline-block; 162 height: 20px;
163 width: 20px; 164 color: #000; 165 margin-top: 0; 166 } 167 168 .timesact_bis_heading { 169 margin-bottom: 0; 170 color: #000; 171 /*dynamic value*/ 172 margin-top: 0; 173 font-size: calc(2 * 1em); 174 /*dynamic value*/ 175 font-weight: 700 176 } 177 178 .timesact_bis_desc { 179 margin-bottom: 0; 180 color: #000; 181 /*dynamic value*/ 182 font-size: 14px; 183 /*dynamic value*/ 184 } 185 186 .timesact_bis_line { 187 margin: 10px 0 188 } 189 190 .timesact_bis_form_field { 191 margin-top: 10px 192 } 193 194 .timesact_bis_input { 195 padding: 8px 15px; 196 border: 1px solid #949494; 197 background-color: #fff; 198 color: #000; 199 max-width: 100%; 200 line-height: 1.2; 201 width: 100%; 202 outline: 0; 203 border-radius: 10px; 204 /*dynamic value*/ 205 } 206 207 .timesact_bis_submit_button { 208 width: 100%; 209 outline: 0; 210 border: 0; 211 padding: 10px; 212 display: flex; 213 align-items: center; 214 justify-content: center; 215 background: #000; 216 /*dynamic value*/ 217 color: #fff; 218 /*dynamic value*/ 219 border-radius: 10px; 220 /*dynamic value*/ 221 font-size: 14px; 222 cursor: pointer; 223 } 224 225 .timesact_bis_submit_button--disabled { 226 background: #ddd 227 } 228 229 .timesact_bis_loading_icon { 230 width: 15px !important; 231 height: 15px !important; 232 margin-right: 5px !important; 233 } 234 235 .timesact_bis_loading_icon:after { 236 content: " "; 237 display: block; 238 width: 15px !important; 239 height: 15px !important; 240 border-radius: 50%; 241 border: 2px solid #fff; 242 border-color: #fff transparent #fff transparent; 243 animation: timesact-bis-loading 1.2s linear infinite 244 } 245 246 @keyframes timesact-bis-loading { 247 0% { 248 transform: rotate(0) 249 } 250 251 100% { 252 transform: rotate(360deg) 253 } 254 } 255 256 .timesact_bis_note { 257 color: black; 258 font-size: 80%; 259 margin-bottom: 0 260 } 261 262 .timesact_bis_response { 263 margin-bottom: 0; 264 } 265 266 .timesact_bis_message_success { 267 width: 100%; 268 text-align: center; 269 font-weight: 600; 270 display: none; 271 color: #28a745; 272 } 273 274 .timesact_bis_message_error {
275 width: 100%; 276 text-align: center; 277 font-weight: 600; 278 display: none; 279 color: red; 280 } 281 282 .timesact_powered_by { 283 margin-top: 15px; 284 left: 0; 285 right: 0; 286 text-align: center; 287 } 288 289 .timesact_powered_by a { 290 text-decoration: none; 291 color: #000 !important; 292 font-weight: 700; 293 } 294 295 .timesact_bis_field_empty { 296 border: 1px solid red; 297 } 298 299 .timesact_bis_message_show { 300 display: block !important; 301 } 302 303 .timesact-button:after { 304 content: none 305 } 306 307 .timesact-button:before { 308 content: none 309 } 310 .timesact_bis_subscribe { 311 font-size: 80%; 312 } 313 `,document.getElementsByTagName("head")[0].appendChild(style),document.getElementsByTagName("body")[0].insertAdjacentHTML("afterbegin",'<div class="md-modal" id="mixed-modal"><div class="md-content"><div class="md-body"></div></div></div><div class="popup-container"><div class="column"><button class="md-trigger md-setperspective" data-modal="mixed-modal"></button></div></div><div class="md-overlay"></div>'),document.getElementsByTagName("body")[0].insertAdjacentHTML("afterbegin",`<div class="timesact_bis_popup_overlay"></div> 314 <div aria-modal="true" aria-hidden="true" tabindex="-1" role="dialog" class="timesact_bis_dialog"> 315 <div class="timesact_bis_popup"> 316 <div class="timesact_bis_popup_content"> 317 <div class="timesact_bis_popup_body"> 318 <button type="button" data-dismiss="modal" aria-label="Close" 319 class="timesact_bis_close_button"> 320 <span aria-hidden="true" class="timesact_bis_close_span">x</span> 321 </button> 322 <h3 class="timesact_bis_heading"></h3> 323 <p class="timesact_bis_desc"></p> 324 <p class="timesact_bis_response"> 325 <span class="timesact_bis_message_success"></span> 326 <span class="timesact_bis_message_error"></span> 327 328 </p> 329 <hr class="timesact_bis_line"> 330 <div id="subscriptionForm"> 331 <div class="timesact_bis_form_field"> 332 <input id="timesact_bis_email" class="timesact_bis_input " type="email" 333 placeholder="eg. [email protected]" name="email" value=""> 334 </div> 335 <div class="timesact_bis_form_field"> 336 <button type="button" class="timesact_bis_submit_button "> 337 <span class="timesact_bis_loading_icon"></span> 338 </button> 339 </div> 340 <div class="timesact_bis_form_field"> 341 <p class="timesact_bis_note"></p> 342 </div> 343 <div class="timesact_bis_form_field timesact_sub"> 344 <input type="checkbox" id="newsletter" name="newsletter" checked /> 345 <label class="timesact_bis_subscribe" for="newsletter"></label> 346 </div> 347 </div> 348 <div class="timesact_powered_by"> 349 <a href="https://timesact.com" target="_blank" rel="noreferrer"> 350 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
350<path d="M8 24l2.674-9h-9.674l16-15-2.674 9h8.674l-15 15zm-1.586-11h6.912l-1.326 4 5.739-6h-6.065l1.304-4-6.564 6z"></path></svg> 351 <span>by Timesact</span> 352 </a> 353 </div> 354 </div> 355 </div> 356 </div> 357 </div>`);const emailInputFieldSelector=document.querySelector("#timesact_bis_email"),newsletterCheckboxFieldSelector=document.querySelector("#newsletter");class Badge{add(selector,badgeType,value,settingType){if(badgeType==="RIBBON"){$(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-ribbon timesact-badge-ribbon-${settingType}'><span class='timesact-badge-ribbon-span-${settingType}'>`+value+"</span></div>");return}badgeType==="ROUNDED"&&($(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-common-${settingType}'><span class='timesact-badge-rounded-span-${settingType}'>`+value+"</span></div>")),badgeType==="SQUARE"&&($(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-common-${settingType}'><span class='timesact-badge-square-span-${settingType}'>`+value+"</span></div>")),badgeType==="CIRCLE"&&($(selector).remove(`.timesact-badge-common-${settingType}`),$(selector).remove(`.timesact-badge-ribbon-${settingType}`),$(selector).append(`<div class='timesact-badge-common-${settingType}'><span class='timesact-badge-circle-span-${settingType}'>`+value+"</span></div>"))}applyStyles(style2,settingType){$(".timesact-badge").css({position:"relative"}),$(`.timesact-badge-ribbon-${settingType}`).css({position:"absolute",right:"-5px",top:"-5px","z-index":"1",overflow:"hidden",width:"75px",height:"75px","text-align":"right"}),$(`.timesact-badge-ribbon-${settingType} span`).css({"font-size":`${style2.fontSize}px`,"font-weight":"bold",color:style2.fontColor,"text-transform":"uppercase","text-align":"center","line-height":"20px",transform:"rotate(45deg)","-webkit-transform":"rotate(45deg)",width:"100px",display:"block",position:"absolute",top:"19px",right:"-21px"}),$(`.timesact-badge-ribbon-span-${settingType}`).css({"background-color":style2.backgroundColor,"box-shadow":"0 3px 10px -5px rgba(0, 0, 0, 1)"}),$(`.timesact-badge-rounded-span-${settingType}`).css({border:"1px solid transparent","border-radius":"4rem",display:"inline-block","letter-spacing":".1rem","line-height":"1",padding:"0.6rem 1.3rem","text-align":"center","background-color":style2.backgroundColor,"border-color":style2.backgroundColor,"font-size":`${style2.fontSize}px`,color:style2.fontColor,"font-weight":"bold","word-break":"break-word"}),$(`.timesact-badge-square-span-${settingType}`).css({border:"1px solid transparent",display:"inline-block","letter-spacing":".1rem","line-height":"1","text-align":"center","background-color":style2.backgroundColor,"border-color":style2.backgroundColor,"font-size":`${style2.fontSize}px`,color:style2.fontColor,"font-weight":"bold","word-break":"break-word",height:"60px",width:"60px","padding-top":"15px"}),$(`.timesact-badge-circle-span-${settingType}`).css({border:"1px solid transparent","border-radius":"50%",display:"inline-block","letter-spacing":".1rem","line-height":"1","text-align":"center","background-color":style2.backgroundColor,"border-color":style2.backgroundColor,"font-size":`${style2.fontSize}px`,color:style2.fontColor,"font-weight":"bold","word-break":"break-word",height:"60px",width:"60px","padding-top":"15px"}),$(`.timesact-badge-common-${settingType}`).css({top:"1rem",display:"flex","flex-wrap":"wrap",right:"10px",position:"absolute","z-index":"1"})}}class Modal{display(settings){$(".md-body").append("<h3>"+settings.header+'</h3><p class="message">'+settings.body+'</p><button class="md-close">'+settings.button+'</button><p><input type="checkbox" id="md-stop" name="md-stop"><label for="md-stop">'+settings.stop+"</label></p>"),$("#mixed-modal").addClass("md-show"),$(".md-close, .md-overlay").click(function(){window.localStorage.setItem("showCartMixedAlert",!$("#md-stop").is(":checked")),$("#mixed-modal").removeClass("md-show")}),$(".md-close").attr("style",`
358 background: ${settings.buttonBackgroundColor}!important; 359 color: ${settings.buttonFontColor}!important;`)}}class Product{constructor(id,variants,title){this.id=id,this.variants=variants,this.title=title}setActiveVariant(variantId){this.variantId=variantId}setTimesactVariants(productConfig){if(!productConfig||!productConfig.variants){console.log("[ERROR 2002]: Product config is undefined.");return}this.timesactVariants=productConfig.variants}isPOEnabledForVariant(){return!this.timesactVariants[this.variantId]||!this.timesactVariants[this.variantId].config?!1:"isPOEnabled"in this.timesactVariants[this.variantId]?this.timesactVariants[this.variantId].isPOEnabled:this.timesactVariants[this.variantId].config.status==="ACTIVE"||this.timesactVariants[this.variantId].config.status==="NO_STOCK"}isBISEnabledForVariant(){return this.timesactVariants[this.variantId]?(window.ta.currentTimesactProductData.variantId=this.variantId,window.ta.currentTimesactProductData.productName=this.timesactVariants[this.variantId].displayName,this.timesactVariants[this.variantId].isBISEnabled):!1}isCSEnabledForVariant(){return this.timesactVariants[this.variantId]?this.timesactVariants[this.variantId].isCSEnabled:!1}getVariantSettings(settings,defaultSettingId,type){if(!this.timesactVariants[this.variantId].config.settingsTemplate){const defaultSettings=settings[defaultSettingId];if(!this.hasCustomSettings())return defaultSettings;const customSettings=this.timesactVariants[this.variantId].settings;return{button:{...defaultSettings.button,name:customSettings.buttonName||defaultSettings.button.name},message:{...defaultSettings.message,type:customSettings.messageType||defaultSettings.message.type,value:customSettings.messageValue||defaultSettings.message.value},cart:{...defaultSettings.cart,labelText:{key:customSettings.cartLabelTextKey||defaultSettings.cart.labelText.key,value:customSettings.cartLabelTextValue||defaultSettings.cart.labelText.value}},badge:defaultSettings.badge}}return type==="PO"?this.timesactVariants[this.variantId].config.settingsTemplate in settings?settings[this.timesactVariants[this.variantId].config.settingsTemplate]:settings[defaultSettingId]:type==="BIS"?this.timesactVariants[this.variantId].configBIS.settingsTemplate in settings?settings[this.timesactVariants[this.variantId].configBIS.settingsTemplate]:settings[defaultSettingId]:type==="CS"&&this.timesactVariants[this.variantId].configCS.settingsTemplate in settings?settings[this.timesactVariants[this.variantId].configCS.settingsTemplate]:settings[defaultSettingId]}hasCustomSettings(){return this.timesactVariants[this.variantId].settings?this.timesactVariants[this.variantId].settings.type==="CUSTOM":!1}isVariantOutOfStock(){if(!this.timesactVariants[this.variantId])return!1;const variant=this.timesactVariants[this.variantId];return variant.quantity>0?!1:variant.inventoryPolicy==="DENY"}}class ShopUtil{constructor(){}initTimesact(){if(typeof window.ta<"u")return;const products=localStorage.getItem("products")?JSON.parse(localStorage.getItem("products")):{},settings=localStorage.getItem("settings")?JSON.parse(localStorage.getItem("settings")):void 0,lastProductUpdate=this.computeLastProductUpdate(products),lastSettingsUpdate=localStorage.getItem("lastSettingsUpdate")?JSON.parse(localStorage.getItem("lastSettingsUpdate")):0;window.ta={products,settings,lastProductUpdate,lastSettingsUpdate,cart:{showMixedCartAlert:localStorage.getItem("showCartMixedAlert")?JSON.parse(localStorage.getItem("showCartMixedAlert")):!0},quickView:{selectors:{button:".quick_shop, .quick-add__submit, .productitem--action-qs, .boost-pfs-quickview-btn, .cc-quick-buy-btn, .button--quick-shop, .sca-qv-button, .quick-view-btn, .bc-quickview-btn-wrapper, .sca-qv-cartbtn, .js-quick-shop-link, .searchit-quick-view-button, .quick-view, .js-quickbuy-button, .quick-product__btn, .product-card-interaction-quickshop, .product-modal, .productitem--action button, a.quickview, .overlay, a.quickview, .has-quick-view .btn .v-b, .shop-now-button, .quick-buy, .quick_shop, a[data-action='show-product'], .trigger-quick-view, .quickview-button, .quick_view, .qview-button, button.btn-addToCart:last, .quick-shop, .fancybox.ajax, .quick-add-button-variants, .product-thumbnail__quickshop-button, .js-quickView-button",form:`.product-form-container, .product__form:visible, 360 #sca-qv-add-item-form:visible, 361 .shopify-product-form:visible, 362 .bc-modal-wrapper:visible 363 #bc-quickview-cart-form:visible, 364 .product_form:visible, 365 .searchit-quick-view-form-wrapper 366 form:visible, .product-form:visible, 367 .quick-buy__product-form:visible, 368 .product-single__form:visible, 369 form[action='/cart/add']:visible, 370 #AddToCartForm:visible, 371 form.module:visible, 372 #add-to-cart-quickview-form:visible`,addToCartButton:".wk-button--add, [type=submit]:visible:first span, .sca-qv-cartbtn:visible, #addToCart:visible, #bc-quickview-cart-btn:visible, .add_to_cart:visible, #searchit-quick-view-add-to-cart:visible, .product-form__cart-submit:visible, .quickbuy__submit:visible, .add-to-cart:visible, .product-submit:visible, .add:visible, .product-form--atc-button:visible, input.action-button.submit:visible, .addto.cart.sliding-cart:visible, #AddToCart:visible, .product-add:visible, .add-to-cart:visible, .product__submit__add:visible, .product-add-to-cart:visible, #add-to-cart:visible, .product-submit.action-button.product-submit, .product-form__add-button:visible, .add-to-cart-btn:visible, .qview-btn-addtocart:visible, button.btn-addToCart:last, .button--add-to-cart:visible",variant:"#sca-qv-variant-options select.single-option-selector, .bc-quickview-single-option-selector, .searchit-option-selector-wrapper select, .qview-variants select, select:visible, .radio-wrapper fieldset, input[type='radio']",quantity:"[name='quantity']",quickviewModalContainer:".js-quick-shop, .quick-add-modal, .theme-modal--quickbuy, .quickview-product .product-quickview:visible, .sca-fancybox-wrap:visible, .mfp-container:visible, .bc-modal-wrapper:visible, .quick-shop:visible, .searchit-modal:visible, #colorbox:visible, .modal--quick-shop:visible, .quickshop:visible, .fancybox-wrap:visible, .fancybox-container:visible, .modal-content:visible, .product-quick-view, section.quick-view, #ShopNowContainer, #ProductScreens, .product.preview, .modal__inner__wrapper:visible, .halo-modal-content:visible, #quickView:visible, .quickshop-content:visible, .modal__inner:visible, .quick-view .content:visible, .qview-product:visible"}}}}computeLastProductUpdate(products){let timestamp=parseInt(new Date().getTime()/1e3);
372for(let product of Object.values(products)){if(product.lastUpdate&&product.lastUpdate<timestamp){timestamp=product.lastUpdate;continue}product.lastUpdate||(timestamp=1)}return timestamp}isProductPage(){return-1<window.location.href.indexOf("/products/")||-1<window.location.href.indexOf("/products_preview?")}isCollectionPage(){return-1<window.location.href.indexOf("/collections/")}isSearchPage(){return-1<window.location.href.indexOf("/search?")}isPagesPage(){return-1<window.location.href.indexOf("/pages/")}isHomePage(){return document.location.pathname==="/"}isCartPage(){return-1<window.location.pathname.indexOf("/cart")}initQuickView(shop){this.shopData=shop,this.createQuickViewButtonListener()}createQuickViewButtonListener(){var thisShop=this;$(window.ta.quickView.selectors.button).click(function(target){const handle=thisShop.getProductHandle(target.currentTarget);if(!handle)return;const url=thisShop.getProductPageJsURL(handle);var product;$.getJSON(url,function(data){product=new Product(data.product.id,data.product.variants)}).done(function(){new ScriptRunner(thisShop.shopData,product).run(!0)}).fail(function(){console.log("[Error 1001]: Product could not be fetched.")})})}getProductHandle(target){return $(target).data("url").split("/").pop()}getProductPageJsURL(handle){return"https://"+window.location.hostname+"/products/"+handle}sleep(e){return new Promise(function(t){setTimeout(t,e)})}cleanupModal(){$(window.ta.quickView.selectors.quickviewModalContainer).find("#preorder-label").remove(),$(window.ta.quickView.selectors.quickviewModalContainer).find(".timesact-preorder-description").remove()}}class ProductUtil{extractVariantId(variants,formSelector){var productParams=window.location.search.match(/variant=([0-9]+)/);if(productParams!=null)return productParams[1];const variantIdFromForm=$(formSelector).find("select[name='id'], input[name='id'], select[name='id[]'], input[name='id[]']").attr("type")==="radio"?$(formSelector).find("input[name='id']:checked, input[name='id[]']:checked").val():$(formSelector).find("select[name='id'], input[name='id'], select[name='id[]'], input[name='id[]']").val();return variants.some(variant=>variant.id.toString()===variantIdFromForm)?variantIdFromForm:variants[0].id}}class TimesactBisModal{static createListeners(){$(".timesact_bis_input").focusout(function(){const timesactBisInput=$(".timesact_bis_input");timesactBisInput.val()&×actBisInput.hasClass("timesact_bis_field_empty")&&(timesactBisInput.removeClass("timesact_bis_field_empty"),$(".timesact_bis_message_success").removeClass("timesact_bis_message_show"),$(".timesact_bis_message_error").removeClass("timesact_bis_message_show"))}),$(".timesact_bis_close_button").click(TimesactBisModal.hidenBisModal),$(".timesact_bis_submit_button").click(TimesactBisModal.createSubscription)}static displayBisModal(){const{defaultSettings,productId,productVariants,variantId}=window.ta.currentTimesactProductData,product=new Product(productId,productVariants);product.setActiveVariant(variantId),product.setTimesactVariants({variants:productVariants});const{form}=product.getVariantSettings(window.ta.settings,defaultSettings.templates.BIS,"BIS");$("h3.timesact_bis_heading").attr("style",`color: ${form.headingFontColor} !important;`),$("#subscriptionForm .timesact_bis_submit_button").attr("style",` 373 background: ${form.buttonBackgroundColor} !important; 374 color: ${form.buttonFontColor} !important; 375 border-radius: ${form.fieldsBorderRadius}px !important; 376 font-size: ${form.fontSize}px !important;`),$("#subscriptionForm .timesact_bis_input").attr("style",` 377 border-radius: ${form.fieldsBorderRadius}px !important; 378 font-size: ${form.fontSize}px !important;`),$(".timesact_bis_popup").attr("style",`border-radius: ${form.popupBorderRadius}px !important;`),$(".timesact_bis_desc, .timesact_bis_note, .timesact_bis_subscribe").attr("style",`color: ${form.textFontColor} !important;`),$(".timesact_bis_email").attr("style",`border-radius: ${form.fieldsBorderRadius}px !important;`),$(".timesact_bis_heading").text(form.heading),$(".timesact_bis_desc").text(form.description),$(".timesact_bis_submit_button").text(form.buttonName),$(".timesact_bis_form_field .timesact_bis_note").text(form.note),$(".timesact_bis_form_field .timesact_bis_subscribe").text(form.messageNewsletter),$(".timesact_bis_message_success").text(form.messageSuccess),$(".timesact_bis_message_error").text(form.messageError),!form.isNewsletterEnabled&&$(".timesact_sub").attr("style","display: none;"),$(".timesact_bis_popup_overlay").addClass("timesact_bis_popup_overlay_show"),$(".timesact_bis_dialog").addClass("timesact_bis_dialog_show"),form.isBrandEnabled||$(".timesact_powered_by").hide()}static hidenBisModal(){$(".timesact_bis_popup_overlay").removeClass("timesact_bis_popup_overlay_show"),$(".timesact_bis_dialog").removeClass("timesact_bis_dialog_show"),$(".timesact_bis_message_success").removeClass("timesact_bis_message_show").html(""),$(".timesact_bis_message_error").removeClass("timesact_bis_message_show").html(""),emailInputFieldSelector.value=""}static async createSubscription(){const timesactBisMessageSuccess=$(".timesact_bis_message_success"),timesactBisMessageError=$(".timesact_bis_message_error"),timesactBisInput=$(".timesact_bis_input");if(!emailInputFieldSelector.value){timesactBisInput.addClass("timesact_bis_field_empty");return}const data={type:"EMAIL",status:"PENDING",value:emailInputFieldSelector.value,productId:window.ta.currentTimesactProductData.productId,variantId:window.ta.currentTimesactProductData.variantId,productName:window.ta.currentTimesactProductData.productName,isSubNewsletter:$("#newsletter").is(":checked")},created=await Api.createSubscription(data);created&×actBisMessageError.removeClass("timesact_bis_message_show")&×actBisMessageSuccess.addClass("timesact_bis_message_show")&&$("#timesact_bis_email").val(""),!created&×actBisMessageSuccess.removeClass("timesact_bis_message_show")&×actBisMessageError.addClass("timesact_bis_message_show")}}class TimesactButton{constructor(buttonSelector,className){this.addToCartButtonSelector=buttonSelector,this.hasInsideSpan=$(this.addToCartButtonSelector).first().prop("tagName").toLowerCase()==="span",className==="timesact-button-po"?this.button=buttonSelector:(this.button=$(`<button type="button" class="${className}" />`).attr("style","display: none !important;"),this.hasInsideSpan?$(this.addToCartButtonSelector).first().parent().after(this.button):$(this.addToCartButtonSelector).first().after(this.button))}showPO(settings){this.hasInsideSpan?$(this.button).parent().show():$(this.button).show(),$(this.button).val(settings.button.name),$(this.button).text(sett
378ings.button.name),$(this.button).prop("disabled",!1),settings.button.type!=="DEFAULT"&&(this.hasInsideSpan?$(this.button).first().parent().addClass("timesact-button"):$(this.button).first().addClass("timesact-button"),this.applyStyles(settings.button.style,"timesact-button"))}showBIS(settings){$(this.button).text(settings.button.name),this.applyStyles(settings.button.style,"timesact-button-bis"),$(this.button).click(TimesactBisModal.displayBisModal),$(this.button).show(),this.hasInsideSpan?$(this.addToCartButtonSelector).first().parent().attr("style","display: none !important;"):$(this.addToCartButtonSelector).first().attr("style","display: none !important;")}showCS(settings){$(this.button).text(settings.button.name),this.button.prop("disabled",!0),this.applyStyles(settings.button.style,"timesact-button-cs"),$(this.button).show(),this.hasInsideSpan?$(this.addToCartButtonSelector).first().parent().attr("style","display: none !important;"):$(this.addToCartButtonSelector).first().attr("style","display: none !important;")}showAddToCart(){this.hasInsideSpan?($(this.addToCartButtonSelector).first().parent().show(),$(this.addToCartButtonSelector).first().parent().removeClass("timesact-button"),$(this.addToCartButtonSelector).first().parent().removeAttr("style")):($(this.addToCartButtonSelector).first().show(),$(this.addToCartButtonSelector).first().removeClass("timesact-button"),$(this.addToCartButtonSelector).first().removeAttr("style")),$(this.addToCartButtonSelector).val(this.addToCartText),$(this.addToCartButtonSelector).text(this.addToCartText),$(this.addToCartButtonSelector).prop("disabled",!1)}showOutOfStock(){this.hasInsideSpan?($(this.addToCartButtonSelector).first().parent().show(),$(this.addToCartButtonSelector).first().parent().removeClass("timesact-button"),$(this.addToCartButtonSelector).first().parent().removeAttr("style")):($(this.addToCartButtonSelector).first().show(),$(this.addToCartButtonSelector).first().removeClass("timesact-button"),$(this.addToCartButtonSelector).first().removeAttr("style")),$(this.addToCartButtonSelector).val(this.soldOutText),$(this.addToCartButtonSelector).text(this.soldOutText),$(this.addToCartButtonSelector).prop("disabled",!0)}setAddToCartText(text){this.addToCartText=text||$(this.addToCartButtonSelector).text()}setSoldOutText(text){this.soldOutText=text}hide(){$(this.button).hide()}disable(){this.hasInsideSpan?$(this.button).parent().prop("disabled",!0):$(this.button).prop("disabled",!0),$(this.addToCartButtonSelector).prop("disabled",!0)}confirmButtonExists(){return $(this.button).closest("body").length>0}identifyButton(selectors){this.button=selectors.formSelector.find(selectors.ids.addToCartButton)}applyStyles(style2,className){$(`.${className}`).attr("style",` 379 width: ${style2.width}px !important; 380 height: ${style2.height}px !important; 381 background-color: ${style2.backgroundColor} !important; 382 border: ${style2.borderWidth}px solid ${style2.borderColor} !important; 383 border-color: ${style2.borderColor} !important; 384 border-radius: ${style2.borderRadius}px !important; 385 border-width: ${style2.borderWidth}px !important; 386 color: ${style2.fontColor} !important; 387 font-size: ${style2.fontSize}px !important; 388 font-style: ${style2.fontStyle} !important; 389 font-weight: ${style2.fontWeight} !important; 390 margin-bottom: 10px !important; 391 cursor: pointer;`)}}class Message{constructor(locale){this.locale=locale}addStylePreorderMessage(style2,type){$(`.timesact-${type}-description`).css({"font-size":`${style2.fontSize}px`,color:style2.fontColor,"text-align":style2.textAlign,"font-weight":style2.fontWeight,"font-style":style2.fontStyle})}populateDynamicValues(variant,value,isCartLabel){return value=value.replace("{{preorderQuantity}}",this.getQuantity(variant,isCartLabel)),value=value.replace("{{shippingDate}}",this.getShippingDate(variant.config.shippingDate,isCartLabel)),value=value.replace("{{daysLeftUntilShippingDate}}",this.getDaysLeftUntilShippingDate(variant.config.shippingDate,isCartLabel)),value=value.replace("{{daysLeftUntilPreorderEndDate}}",this.getDaysLeftUntilEndDate(variant.config,isCartLabel)),value}getQuantity(variant,isCartLabel){return variant.config.stock.option=="STOCK3"?variant.quantity:variant.config.stock.hasUnlimitedQuantity?isCartLabel?"VARIABLE_NOT_SET"
391:'<span style="color:red;">VARIABLE_NOT_SET</span>':variant.config.stock.quantity}getShippingDate(shippingDate,isCartLabel){if(!shippingDate||shippingDate.type==="NO_SET")return isCartLabel?"VARIABLE_NOT_SET":'<span style="color:red;">VARIABLE_NOT_SET</span>';if(shippingDate.type==="DATE")return new Date(shippingDate.date*1e3).toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"});if(shippingDate.type==="PERIOD"){var days=1;switch(shippingDate.periodType){case"DAY":days=shippingDate.periodValue;break;case"WEEK":days=shippingDate.periodValue*7;break;case"MONTH":days=shippingDate.periodValue*30;break}var date=new Date;return date.setDate(date.getDate()+days),date.toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"})}if(shippingDate.type==="INTERVAL"){var periodStartDays=1,periodEndDays=1;switch(shippingDate.periodStart.type){case"DAY":periodStartDays=shippingDate.periodStart.value;break;case"WEEK":periodStartDays=shippingDate.periodStart.value*7;break;case"MONTH":periodStartDays=shippingDate.periodStart.value*30;break}switch(shippingDate.periodEnd.type){case"DAY":periodEndDays=shippingDate.periodEnd.value;break;case"WEEK":periodEndDays=shippingDate.periodEnd.value*7;break;case"MONTH":periodEndDays=shippingDate.periodEnd.value*30;break}var dateStart=new Date;dateStart.setDate(dateStart.getDate()+periodStartDays);var dateEnd=new Date;return dateEnd.setDate(dateEnd.getDate()+periodEndDays),dateStart.toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"})+" - "+dateEnd.toLocaleDateString(this.locale,{day:"numeric",month:"long",year:"numeric"})}}getDaysLeftUntilShippingDate(shippingDate,isCartLabel){if(!shippingDate||shippingDate.type==="NO_SET")return isCartLabel?"VARIABLE_NOT_SET":'<span style="color:red;">VARIABLE_NOT_SET</span>';const today=new Date;if(shippingDate.type==="DATE"){const date=new Date(shippingDate.date*1e3);return Math.ceil((date.getTime()-today.getTime())/(1e3*3600*24))}if(shippingDate.type==="PERIOD")switch(shippingDate.periodType){case"DAY":return shippingDate.periodValue;case"WEEK":return shippingDate.periodValue*7;case"MONTH":return shippingDate.periodValue*30;default:return 1}if(shippingDate.type==="INTERVAL"){var periodStartDays=1,periodEndDays=1;switch(shippingDate.periodStart.type){case"DAY":periodStartDays=shippingDate.periodStart.value;break;case"WEEK":periodStartDays=shippingDate.periodStart.value*7;break;case"MONTH":periodStartDays=shippingDate.periodStart.value*30;break}switch(shippingDate.periodEnd.type){case"DAY":periodEndDays=shippingDate.periodEnd.value;break;case"WEEK":periodEndDays=shippingDate.periodEnd.value*7;break;case"MONTH":periodEndDays=shippingDate.periodEnd.value*30;break}return periodStartDays+" - "+periodEndDays}}getDaysLeftUntilEndDate(config,isCartLabel){if(!config.hasEndDate)return isCartLabel?"VARIABLE_NOT_SET":'<span style="color:red;">VARIABLE_NOT_SET</span>';const today=new Date,date=new Date(config.endDate*1e3);return Math.ceil((date.getTime()-today.getTime())/(1e3*3600*24))}}class Timesact{constructor(selectors,product,defaultSettingIds,shop){this.selectors=selectors,this.product=product,this.settings=window.ta.settings,this.defaultSettingIds=defaultSettingIds,this.buttonPO=new TimesactButton(this.selectors.buttonSelector,"timesact-button-po"),this.buttonBIS=new TimesactButton(this.selectors.buttonSelector,"timesact-button-bis"),this.buttonCS=new TimesactButton(this.selectors.buttonSelector,"timesact-button-cs"),this.uuid=Math.floor(1e8+Math.random()*9e8),$(this.selectors.variantSelector).addClass("timesact-variant-picker-"+this.uuid),this.shop=shop}init(){this.createWidget(),new TimesactEventListener().initVariantEventListener(this)}createWidget(){const variant=this.product.timesactVariants[this.product.variantId];if(this.product.isBISEnabledForVariant()){const settings=this.product.getVariantSettings(this.settings,this.defaultSettingIds.BIS,"BIS");this.buttonBIS.setAddToCartText(settings.button.addToCartText),this.buttonBIS.setSoldOutText(settings.button.soldOutText),variant.configBIS.status==="ACTIVE"&&(this.buttonBIS.showBIS(settings),this.addCommonElements(settings,variant))}if(this.product.isPOEnabledForVariant()){const settings=this.product.getVariantSettings(this.settings,this.defaultSettingIds.PO,"PO");
391if(this.buttonPO.setAddToCartText(settings.button.addToCartText),this.buttonPO.setSoldOutText(settings.button.soldOutText),variant.config.status==="NO_STOCK"&&(this.buttonPO.showOutOfStock(),$(this.selectors.formSelector).find(".shopify-payment-button").hide()),variant.config.status==="ACTIVE"){this.buttonPO.confirmButtonExists()||(this.buttonPO.identifyButton(this.selectors),this.selectors.buttonSelector=$(this.selectors.formSelector).find(this.selectors.ids.addToCartButton)),this.buttonPO.showPO(settings),this.shop.isDisabled&&this.buttonPO.disable(),this.addCommonElements(settings,variant);const message=new Message(settings.message.locale||"en-US"),cartLabelTextKey=message.populateDynamicValues(variant,settings.cart.labelText.key,!0),cartLabelTextValue=message.populateDynamicValues(variant,settings.cart.labelText.value,!0);this.showPreorderLineItemProperty(cartLabelTextKey,cartLabelTextValue),variant.config.stock.hasUnlimitedQuantity||this.addQuantityListener(variant.config.stock.quantity)}}if(this.product.isCSEnabledForVariant()){const settings=this.product.getVariantSettings(this.settings,this.defaultSettingIds.CS,"CS");this.buttonCS.setAddToCartText(settings.button.addToCartText),this.buttonCS.setSoldOutText(settings.button.soldOutText),variant.configCS.status==="ACTIVE"&&(this.buttonCS.showCS(settings),this.addCommonElements(settings,variant))}}resetDefault(){this.buttonBIS.hide(),this.buttonCS.hide(),this.buttonPO.confirmButtonExists()||(this.buttonPO.identifyButton(this.selectors),this.selectors.buttonSelector=$(this.selectors.formSelector).find(this.selectors.ids.addToCartButton)),this.product.isVariantOutOfStock()?(this.buttonPO.showOutOfStock(),$(this.selectors.formSelector).find(".shopify-payment-button").hide()):(this.buttonPO.showAddToCart(),$(this.selectors.formSelector).find(".shopify-payment-button").show()),this.removePreorderLineItemProperty(),this.removePreorderMessage(),this.removePreorderBadge(),this.removePreorderQuantity(),this.selectors.hideProductElements&&this.addHiddenElements()}addCommonElements(settings,variant){$(this.selectors.formSelector).find(".shopify-payment-button").hide();const type=settings.type==="BIS"?"bis":settings.type==="CS"?"cs":"preorder";this.addPreorderMessage(settings.message,variant,type),settings.badge.product&&this.addBadge(this.selectors.badgeSelector,settings.badge,type),this.selectors.hideProductElements&&$(this.selectors.hideProductElements).hide()}showPreorderLineItemProperty(key,value){$(this.selectors.formSelector).find("#preorder-label").length===0?$(this.selectors.formSelector).append('<input type="hidden" id="preorder-label" name="properties['+key+']" value="'+value+'" />'):$(this.selectors.formSelector).find("#preorder-label").val(value)}removePreorderLineItemProperty(){$(this.selectors.formSelector).find("#preorder-label").remove()}removePreorderBadge(){$(this.selectors.badgeSelector).find(".timesact-badge-ribbon-preorder, .timesact-badge-ribbon-bis, .timesact-badge-ribbon-cs").remove(),$(this.selectors.badgeSelector).find(".timesact-badge-common-preorder, .timesact-badge-common-bis, .timesact-badge-common-cs").remove()}addBadge(selector,settings,settingType){const badge=new Badge;badge.add(selector,settings.type,settings.value,settingType),badge.applyStyles(settings,settingType)}addPreorderMessage(settings,variant,type){const message=new Message(settings.locale||"en-US");if(settings.value!=""){const messageValue=message.populateDynamicValues(variant,settings.value,!1);this.showPreorderMessage(settings.type,messageValue,type),message.addStylePreorderMessage(settings,type)}}showPreorderMessage(placementType,value,type){if(this.selectors.messageSelector){$(this.selectors.formSelector).find(`.timesact-${type}-description`).length===0?placementType==="BELOW"?$(this.selectors.messageSelector).after(`<div class='timesact-${type}-description'>`+value+"</div>"):$(this.selectors.messageSelector).before(`<div class='timesact-${type}-description'>`+value+"</div>"):$(this.selectors.formSelector).find(`.timesact-${type}-description`).val(value);return}$(this.selectors.formSelector).find(`.timesact-${type}-description`).length===0?placementType==="BELOW"?$(this.selectors.buttonSelector).after(`<div class='timesact-${type}-description'>`+value+"</div>"):$(this.selectors.buttonSelector).before(`<div class='timesact-${type}-description'>`+value+"</div>"):$(this.selectors.formSelector).find(`.timesact-${type}-description`).val(value)}removePreorderMessage(){$(this.selectors.formSelector).find(".timesact-preorder-description, .timesact-bis-description, .timesact-cs-description").remove()}removePreorderQuantity(){$(".timesact-quantity-message").remove(),$(this.selectors.quantitySelector).off("
391change.quantityChange"),$(this.selectors.buttonSelector).off("click.quantityButtonClick")}addHiddenElements(){$(this.selectors.hideProductElements).show()}addQuantityListener(preorderQty){const selectors=this.selectors;$(this.selectors.quantitySelector).on("change.quantityChange",function(){preorderQty<parseInt($(this).val())?($(".timesact-quantity-message").length||(selectors.messageSelector?$(selectors.messageSelector).before(`<div class='timesact-quantity-message' style='color:red'>You can only pre-order ${preorderQty} items!</div>`):$(selectors.buttonSelector).before(`<div class='timesact-quantity-message' style='color:red'>You can only pre-order ${preorderQty} items!</div>`)),$(selectors.buttonSelector).prop("disabled",!0)):($(".timesact-quantity-message").remove(),$(selectors.buttonSelector).prop("disabled",!1))}),$(this.selectors.buttonSelector).on("click.quantityButtonClick",function(event){const qty=$(selectors.quantitySelector).val();preorderQty<parseInt(qty)?(event.preventDefault(),$(".timesact-quantity-message").length||(selectors.messageSelector?$(selectors.messageSelector).before(`<div class='timesact-quantity-message' style='color:red'>You can only pre-order ${preorderQty} items!</div>`):$(selectors.buttonSelector).before(`<div class='timesact-quantity-message' style='color:red'>You can only pre-order ${preorderQty} items!</div>`))):$(".timesact-quantity-message").remove()})}}class TimesactEventListener{initVariantEventListener(preorder){var event=this;$(document).on("change",".timesact-variant-picker-"+preorder.uuid,function(e){event.variantChangeHandler(preorder)}),event.setup(function(){event.variantChangeHandler(preorder)})}sleep(e){return new Promise(function(t){setTimeout(t,e)})}variantChangeHandler(preorder){const preorderEntry=preorder;this.sleep(preorder.selectors.variantChangingTime).then(function(){var selectedVariantId=window.location.search.replace(/.*variant=(\d+).*/,"$1");selectedVariantId||(selectedVariantId=$(preorderEntry.selectors.formSelector).find("select[name='id'], input[name='id'], select[name='id[]'], input[name='id[]']").attr("type")==="radio"?$(preorderEntry.selectors.formSelector).find("input[name='id']:checked, input[name='id[]']:checked").val():$(preorderEntry.selectors.formSelector).find("select[name='id'], input[name='id'], select[name='id[]'], input[name='id[]']").val()),preorderEntry.product.setActiveVariant(selectedVariantId),preorderEntry.resetDefault(),preorderEntry.createWidget()})}track(fn,handler,before){return function(){if(before)return handler.apply(this,arguments),fn.apply(this,arguments);var result=fn.apply(this,arguments);return handler.apply(this,arguments),result}}setup(handler){history.pushState=this.track(history.pushState,handler),history.replaceState=this.track(history.replaceState,handler),window.addEventListener("popstate",handler)}}class Api{static async createSubscription(data){try{return await $.ajax({url:"/apps/timesact/notifications/bis",type:"POST",contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(data)}),!0}catch(err){return console.log("Subscription no create",err),!1}}static async getProductPreOrderConfig(productId){try{return await $.ajax({url:`/apps/timesact/config?productId=${productId}`,type:"GET",contentType:"application/json; charset=utf-8",dataType:"json"})}catch{return console.log("Product is not active on pre-order."),null}}async getProducts(productIds=[]){try{return await $.ajax({url:`/apps/timesact/products?productIds=${productIds}`,type:"GET",contentType:"application/json; charset=utf-8",dataType:"json"})}catch{return console.log("Products config couldn't be fetched."),null}}async getShop(){try{return await $.ajax({url:"/apps/timesact/shop",type:"GET",contentType:"application/json; charset=utf-8",dataType:"json"})}catch{return console.log("Shop data couldn't be fetched."),null}}async getSettings(){try{return await $.ajax({url:"/apps/timesact/shop/settings",type:"GET",contentType:"application/json; charset=utf-8",dataType:"json"})}catch{return console.log("Settings data couldn't be fetched."),null}}}class Selectors{constructor(selectors){this.ids=selectors}setNormalSelectors(){this.formSelector=$(this.ids.form),this.buttonSelector=this.formSelector.find(this.ids.addToCartButton),this.buttonSelector.length===0&&(this.buttonSelector=this.formSelector.find('[type="submit"]:visible:first, [name="add"], .product-submit, .addtocart-button-active, .product-form--add-to-cart, .button--addToCart, .product-form__submit, .add-to-cart, .btn-addtocart, .single_add_to_cart_button, .product-form__cart-submit, .product-form--atc-button, .ProductForm__AddToCart, [type="button"]:visible:first').first()),this.variantSelector=this.formSelector.find(this.ids.variant),this.ids.quantity?this.quantitySelector=this.formSelector.find(this.ids.quantity):(this.quantitySelector=this.formSelector.find('[name="quantity"]'),this.quantitySelector.length===0&&(this.quantitySelector=$('[name="quantity"]'))),this.ids.badge?this.badgeSelector=$(this.ids.badge):this.badgeSelector=$(".timesact-badge"),this.ids.message&&(this.messageSelector=this.formSelector.find(this.ids.message)),this.ids.hide&&this.ids.hide.product&&(this.hideProductElements=this.ids.hide.product),this.variantChangingTime=this.ids.variantChangingTime||250,this.formSelector.find('[data-pf-type="ProductATC"], [data-pf-type="ProductATC2"]').length>0&&(this.buttonSelector=this.formSelector.find('[data-pf-type="ProductATC"] span:first, [data-pf-type="ProductATC2"] span:first'),this.messageSelector=this.formSelector.find('[data-pf-type="Timesact"]'),this.badgeSelector=$('[data-pf-type="MainMedia"]'))}setQuickViewSelectors(){this.formSelector=$(window.ta.quickView.selectors.quickviewModalContainer).find(window.ta.quickView.selectors.form),this.buttonSelector=$(window.ta.quickView.selectors.quickviewModalContainer).find(window.ta.quickView.selectors.addToCartButton),this.variantSelector=$(window.ta.quickView.selectors.quickviewModalContainer).find(window.ta.quickView.selectors.variant),this.quantitySelector=$(window.ta.quickView.selectors.quickviewModalContainer).find(window.ta.quickView.selectors.quantity),this.ids.message&&(this.messageSelector=this.formSelector.find(this.ids.message)),this.variantChangingTime=this.ids.variantChangingTime||250,this.ids.badge?this.badgeSelector=$(this.ids.badge):this.badgeSelector=$(".timesact-badge")}}class ScriptRunner{constructor(shop,product){this.shop=shop,this.product=product}async run(isQuickView){const timesactProduct=await Api.getProductPreOrderConfig(this.product.id);if(!timesactProduct){window.ta.products[this.product.id]={isPreorder:!1,isBIS:!1,isCS:!1,lastUpdate:parseInt(new Date().getTime()/1e3)},localStorage.setItem("products",JSON.stringify(window.ta.products));return}window.ta.currentTimesactProductData={defaultSettings:this.shop.settings,productId:this.product.id,productName:this.product.title,productVariants:timesactProduct.product.variants,variantId:null},this.selectors=new Selectors(this.shop.selectors),isQuickView?this.selectors.setQuickViewSelectors():this.selectors.setNormalSelectors(),this.product.setActiveVariant(new ProductUtil().extractVariantId(this.product.variants,this.selectors.formSelector)),this.product.setTimesactVariants(timesactProduct.product),new Timesact(this.selectors,this.product,this.shop.settings.templates,this.shop).init(),window.ta.products[this.product.id]={isPreorder:this.isActiveOnPreorder(timesactProduct.product.variants),isBIS:this.isActiveOnBIS(timesactProduct.product.variants),isCS:this.isActiveOnCS(timesactProduct.product.variants),variants:timesactProduct.product.variants,lastUpdate:parseInt(new Date().getTime()/1e3)},localStorage.setItem("products",JSON.stringify(window.ta.products))}async runCollection(){if(window.ta.settings[this.shop.settings.templates.PO].badge.collection||window.ta.settings[this.shop.settings.templates.BIS].badge.collection||window.ta.settings[this.shop.settings.templates.CS].badge.collection){this.shop.lastProductUpdate&&window.ta.lastProductUpdate<this.shop.lastProductUpdate&&(window.ta.products={});let possibleClasses=[".timesact-badge",".product-item",".card--standard",".card--card",".ProductItem",'[data-pf-type="ProductBox"]'];this.shop.selectors.collection&&this.shop.selectors.collection.badge&&(possibleClasses=[this.shop.selectors.collection.badge]);let items=[];for(let i=0;i<possibleClasses.length;i++)if($(possibleClasses[i]).length>0){items=$(possibleClasses[i]);break}this.enableBadgeOnCollection(items)}}async runMixedCartAlert(data){if(!window.ta.cart.showMixedCartAlert||!data.items.length)return;const defaultSettingsPO=window.ta.settings[this.shop.settings.templates.PO];if(!defaultSettingsPO.cart.mixed.isEnabled)return;let hasPreorderProduct=!1,hasNormalProduct=!1,products={};for(var item of data.items){if(window.ta.products[item.product_id]){if(window.ta.products[item.product_id].variants&&window.ta.products[item.product_id].variants[item.variant_id]&&window.ta.products[item.product_id].variants[item.variant_id].config.status==="ACTIVE"){hasPreorderProduct=!0;continue}hasNormalProduct=!0;continue}products[item.product_id]=products[item.product_id]||[],products[item.product_id].push(item.variant_id)}const modal=new Modal;
391if(hasPreorderProduct&&hasNormalProduct){modal.display(defaultSettingsPO.cart.mixed);return}if(!Object.keys(products).length)return;const timesact=await new Api().getProducts(Object.keys(products));if(!timesact){console.log("[Error] Timesact API getProducts.");return}for(let productId of Object.keys(products)){if(!(productId in timesact.products)){hasNormalProduct=!0,window.ta.products[productId]={isPreorder:!1,isBIS:!1,isCS:!1,lastUpdate:parseInt(new Date().getTime()/1e3)};continue}for(let variantId of products[productId]){if(timesact.products[productId].variants[variantId]&×act.products[productId].variants[variantId].config.status==="ACTIVE"){hasPreorderProduct=!0;continue}hasNormalProduct=!0}if(window.ta.products[productId]={isPreorder:this.isActiveOnPreorder(timesact.products[productId].variants),isBIS:this.isActiveOnBIS(timesact.products[productId].variants),isCS:this.isActiveOnCS(timesact.products[productId].variants),variants:timesact.products[productId].variants,lastUpdate:parseInt(new Date().getTime()/1e3)},hasNormalProduct&&hasPreorderProduct){modal.display(defaultSettingsPO.cart.mixed);break}}localStorage.setItem("products",JSON.stringify(window.ta.products))}isActiveOnPreorder(variants){return Object.values(variants).every(variant=>variant.config.status==="ACTIVE")}isActiveOnBIS(variants){return Object.values(variants).every(variant=>variant.configBIS&&variant.configBIS.status==="ACTIVE")}isActiveOnCS(variants){return Object.values(variants).every(variant=>variant.configCS&&variant.configCS.status==="ACTIVE")}async enableBadgeOnCollection(items){if(items.length===0){console.log("No items detected.");return}const products={},defaultSettingsPO=window.ta.settings[this.shop.settings.templates.PO],defaultSettingsBIS=window.ta.settings[this.shop.settings.templates.BIS],defaultSettingsCS=window.ta.settings[this.shop.settings.templates.CS];await Promise.all(Array.from(items).map(async item=>{var productId;if($(item).data("product-id"))productId=$(item).data("product-id");else{let href=$(item).find("a").attr("href");if(!href)return;let handle=href.split("/").pop().split("?")[0];if(!handle)return;console.log("Product handle: ",handle);const data=await $.getJSON(window.location.origin+href);if(!data||!data.product||!data.product.id)return;productId=String(data.product.id)}if(window.ta.products[productId]){let shouldHide=!1;window.ta.products[productId].isPreorder&&defaultSettingsPO.badge.collection&&(this.addBadge(item,defaultSettingsPO.badge,"preorder"),shouldHide=!0,defaultSettingsPO.button.collection&&defaultSettingsPO.button.collection.isEnabled&&this.enableButtonOnCollection(item,this.shop,window.ta.products[productId],defaultSettingsPO)),window.ta.products[productId].isBIS&&defaultSettingsBIS.badge.collection&&(this.addBadge(item,defaultSettingsBIS.badge,"bis"),shouldHide=!0),window.ta.products[productId].isCS&&defaultSettingsCS.badge.collection&&(this.addBadge(item,defaultSettingsCS.badge,"cs"),shouldHide=!0),shouldHide&&this.shop.selectors.hide&&this.shop.selectors.hide.collection&&$(item).find(this.shop.selectors.hide.collection).hide();return}products[productId]=item}));const timesact=await new Api().getProducts(Object.keys(products));if(!timesact){console.log("[Error] Timesact API getProducts.");return}for(const[productId,item]of Object.entries(products)){if(!(productId in timesact.products)){window.ta.products[productId]={isPreorder:!1,isBIS:!1,isCS:!1,lastUpdate:parseInt(new Date().getTime()/1e3)};continue}const isPreorder=this.isActiveOnPreorder(timesact.products[productId].variants),isBIS=this.isActiveOnBIS(timesact.products[productId].variants),isCS=this.isActiveOnCS(timesact.products[productId].variants);let shouldHide=!1;isPreorder&&defaultSettingsPO.badge.collection&&(this.addBadge(item,defaultSettingsPO.badge,"preorder"),shouldHide=!0,defaultSettingsPO.button.collection&&defaultSettingsPO.button.collection.isEnabled&&this.enableButtonOnCollection(item,this.shop,timesact.products[productId],defaultSettingsPO)),isBIS&&defaultSettingsBIS.badge.collection&&(this.addBadge(item,defaultSettingsBIS.badge,"bis"),shouldHide=!0),isCS&&defaultSettingsCS.badge.collection&&(this.addBadge(item,defaultSettingsCS.badge,"cs"),shouldHide=!0),shouldHide&&this.shop.selectors.hide&&this.shop.selectors.hide.collection&&$(item).find(this.shop.selectors.hide.collection).hide(),window.ta.products[productId]={isPreorder,isBIS,isCS,variants:timesact.products[productId].variants,lastUpdate:parseInt(new Date().getTime()/1e3)}}localStorage.setItem("products",JSON.stringify(window.ta.products))}enableButtonOnCollection(item,shop,product,defaultSettingsPO){let formCollectionSelector='form[action="/cart/add"]';shop.selectors.collection&&shop.selectors.collection.form&&(formCollectionSelector=shop.selectors.collection.form);let addToCartButtonCollectionSelector='[type=submit]:visible:first, [data-pf-type="ProductATC"] span:first, [data-pf-type="ProductATC2"] span:first';shop.selectors.collection&&shop.selectors.collection.addToCartButton&&(addToCartButtonCollectionSelector=shop.selectors.collection.addToCartButton);const productForm=$(item).find(formCollectionSelector);for(let variant in product.variants)if(product.variants[variant].config.status==="ACTIVE"){const buttonSelector=$(item).find(addToCartButtonCollectionSelector);let buttonName=window.ta.settings[product.variants[variant].config.settingsTemplate]?window.ta.settings[product.variants[variant].config.settingsTemplate].button.name:defaultSettingsPO.button.name;$(buttonSelector).val(buttonName),$(buttonSelector).text(buttonName),$(buttonSelector).prop("disabled",!1),$(item).find(".shopify-payment-button").hide();const message=new Message(defaultSettingsPO.message.locale||"en-US");let cartValue=window.ta.settings[product.variants[variant].config.settingsTemplate]?window.ta.settings[product.variants[variant].config.settingsTemplate].cart.labelText.value:defaultSettingsPO.cart.labelText.value,cartKey=window.ta.settings[product.variants[variant].config.settingsTemplate]?window.ta.settings[product.variants[variant].config.settingsTemplate].cart.labelText.key:defaultSettingsPO.cart.labelText.key;cartKey=message.populateDynamicValues(product.variants[variant],cartKey,!0),cartValue=message.populateDynamicValues(product.variants[variant],cartValue,!0),$(productForm).find("#preorder-label").length===0?$(productForm).append('<input type="hidden" id="preorder-label" name="properties['+cartKey+']" value="'+cartValue+'" />'):$(productForm).find("#preorder-label").val(cartValue)}}addBadge(selector,settings,settingType){$(selector).find('[data-pf-type="ProductMedia"], [data-pf-type="ProductMedia2"]').length>0&&(selector=$(selector).find('[data-pf-type="ProductMedia"], [data-pf-type="ProductMedia2"]'));const badge=new Badge;badge.add(selector,settings.type,settings.value,settingType),badge.applyStyles(settings,settingType)}}$(document).ready(async function(){const api=new Api,utils=new ShopUtil;if(TimesactBisModal.createListeners(),utils.initTimesact(),!utils.isProductPage()&&!utils.isCollectionPage()&&!utils.isSearchPage()&&!utils.isPagesPage()&&!utils.isHomePage()&&!utils.isCartPage())return;const shop=await api.getShop();if(!window.ta.settings||shop.lastSettingsUpdate&&window.ta.lastSettingsUpdate<shop.lastSettingsUpdate){const{settings}=await api.getSettings();window.ta.settings=settings,window.ta.lastSettingsUpdate=shop.lastSettingsUpdate||parseInt(new Date().getTime()/1e3),localStorage.setItem("settings",JSON.stringify(window.ta.settings)),localStorage.setItem("lastSettingsUpdate",JSON.stringify(window.ta.lastSettingsUpdate))}if(utils.isProductPage()){let product={};
391$.getJSON(window.location.href,function(data){product=new Product(data.product.id,data.product.variants,data.product.title)}).done(function(){new ScriptRunner(shop,product).run(!1)}).fail(function(){console.log("[Error 1001]: Product could not be fetched.")})}(utils.isCollectionPage()||utils.isHomePage()||utils.isSearchPage()||utils.isPagesPage())&&(utils.initQuickView(shop),new ScriptRunner(shop).runCollection()),utils.isCartPage()&&$.getJSON(window.location.href,function(data){new ScriptRunner(shop).runMixedCartAlert(data)}).fail(function(){console.log("[Error 1001]: Product could not be fetched.")})})},typeof jQuery>"u"||parseFloat(jQuery.fn.jquery)<100?loadScript("https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js",function(){jQuery191=jQuery.noConflict(!0),timesactScriptNew(jQuery191)}):timesactScriptNew(jQuery)})(); 392//# sourceMappingURL=/cdn/shop/t/59/assets/timesact.js.map?v=39210072729620823371692282593
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.