https://www.lettucegrow.com/cdn/shop/t/3/assets/navidium-standrad-…?v=171860391668679416281788350809
1sessionStorage.removeItem("navidiumProductVariants");function useConsole(...rest){sessionStorage.getItem("NVD_DEV")&&console.log("%c Navidium App:","color: #00a0e9; font-weight: bold;",...rest)}const nvdStyles=document.createElement("style");nvdStyles.innerHTML=` 2.nvd-cta-loader { 3 width: 14px; 4 height: 14px; 5 border-radius: 50%; 6 display: inline-block; 7 border-top: 4px solid #fff; 8 border-right: 4px solid transparent; 9 box-sizing: border-box; 10 animation: rotation 1s linear infinite; 11} 12.nvd-cta-loader::after { 13 content: ''; 14 box-sizing: border-box; 15 position: absolute; 16 left: 0; 17 top: 0; 18 width: 14px; 19 height: 14px; 20 border-radius: 50%; 21 border-bottom: 4px solid #000000; 22 border-left: 4px solid transparent; 23} 24@keyframes rotation { 25 0% { 26 transform: rotate(0deg); 27 } 28 100% { 29 transform: rotate(360deg); 30 } 31}`,document.head.appendChild(nvdStyles);function nvdFindClosest(arr,target,adjustment="rounding_down"){if(!arr||!arr.length)return null;let toMatch=parseFloat(target),finalOutput=0,n=arr.length;for(let i=0;i<n;i++){let current=arr[i],next=arr[i+1];if(toMatch>=current&&toMatch<=next){adjustment==="rounding_down"&&(finalOutput=current),adjustment==="rounding_up"&&(finalOutput=next);break}else if(toMatch<=current){finalOutput=current;break}}return finalOutput}async function removeNavidium(variantId){try{const headers={"Content-Type":"application/json",Accept:"application/json"};if(variantId)return await fetch("/cart/change.js",{method:"POST",headers,body:JSON.stringify({id:String(variantId),quantity:0})});const itemsToRemove=(await(await fetch(`/cart.js?t=${Date.now()}`,{cache:"no-cache"})).json()).items.filter(item=>item?.handle?.includes("shipping-protection")||item?.handle?.includes("navidium")||nvdWidgetHelpers.product_handle?.includes(item.handle));if(itemsToRemove.length===0)return;const updates={};itemsToRemove.forEach(item=>{updates[item.id]=0}),await fetch("/cart/update.js",{method:"POST",headers,body:JSON.stringify({updates})}),window.navadiumStopReload||location.reload()}catch(error){useConsole("ERROR Removing NVD",error)}}const getNavidiumMarketPrice=async apiVariant=>{try{const sessionKey="navidiumProductVariants",cachedData=sessionStorage.getItem(sessionKey);if(cachedData)return JSON.parse(cachedData)[String(apiVariant)];const handles=nvdWidgetHelpers?.product_handle?.split(",")||["navidium-shipping-protection"],variants=(await Promise.all(handles.map(async handle=>(await(await fetch(`/products/${handle}.js`)).json()).variants))).flat(),productVariants={};
31return variants.forEach(variant=>{const variantID=String(variant.id);productVariants[variantID]=variant.price}),sessionStorage.setItem(sessionKey,JSON.stringify(productVariants)),productVariants[String(apiVariant)]}catch(error){console.error("Error fetching Navidium Market Price:",error)}};getNavidiumMarketPrice();const nvdLocationFinder=location.pathname;nvdLocationFinder==="/account/login"||nvdLocationFinder==="/account/register"||window.keepNavidium?useConsole("Navidium Exist"):removeNavidium();function nvdFormatMoney(cents){try{let defaultOption2=function(opt,def){return typeof opt>"u"?def:opt},formatWithDelimiters2=function(number,precision,thousands,decimal){if(precision=defaultOption2(precision,2),thousands=defaultOption2(thousands,","),decimal=defaultOption2(decimal,"."),isNaN(number)||number==null)return 0;number=(number/100).toFixed(precision);const parts=number.split("."),dollars=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${thousands}`),cents2=parts[1]?decimal+parts[1]:"";return dollars+cents2};var defaultOption=defaultOption2,formatWithDelimiters=formatWithDelimiters2;typeof cents=="string"&&(cents=cents.replace(".",""));let value="";const placeholderRegex=/\{\{\s*(\w+)\s*\}\}/,formatString=nvdShopCurrency;switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters2(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters2(cents,0);break;case"amount_with_comma_separator":value=formatWithDelimiters2(cents,2,".",",");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters2(cents,0,".",",");break;default:value=formatWithDelimiters2(cents,2);break}return formatString.replace(placeholderRegex,value)}catch{const currency=Shopify?.currency?.active||"USD";return new Intl.NumberFormat(Shopify?.locale,{style:"currency",currency,currencyDisplay:"narrowSymbol"}).format(cents/100)}}const getNvdConfig=async()=>{try{const response=await fetch(`https://cdn.navidiumapp.com/navidium-widgets/json-files/${nvdShop}.json`);return response.status==200?await response.json():await(await fetch(`https://navidium-static-assets.s3.amazonaws.com/navidium-widgets/json-files/${nvdShop}.json`)).json()}catch{return{}}},getNvdVisitorCountry=async()=>{const fallbackUrl="https://geoip.apps.getjoy.ai/geo.json";try{const timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,response=await fetch(`https://5oy2nnjxatw6egeqhkwdcm76um0vvdig.lambda-url.us-east-1.on.aws/?timezone=${timezone}`,{signal:AbortSignal.timeout(2500)});if(response.ok)return await response.json()}catch{}try{return{country_name:(await(await fetch(fallbackUrl,{signal:AbortSignal.timeout(2e3)})).json()).country}}catch(error){return console.error("Both API calls failed:",error),{}}},nvdPrefetch=async callback=>{let nvdConfig=sessionStorage.getItem("nvdconfig")?JSON.parse(sessionStorage.getItem("nvdconfig")):null;if(nvdConfig)return useConsole("Navidium config avaialable in storage"),nvdConfig;useConsole("Navidium config not available in storage");try{const country=await getNvdVisitorCountry();country?.country_name&&sessionStorage.setItem("nvdVisitorCountry",country?.country_name);const nvdConfig2=await getNvdConfig();useConsole(nvdConfig2);const disclaimer_properties=nvdConfig2?.disclaimer_properties;disclaimer_properties&&sessionStorage.setItem("nvdDisclaimer",disclaimer_properties);const today=new Date,shopConfig={nvd_static_rules:nvdConfig2.nvd_static_rules?.sort((a,b)=>a?.from-b?.from),success:nvdConfig2.success,show_on_cart:nvdConfig2.nvd_show_cart,auto_insurance:nvdConfig2.nvd_auto_insurance,nvd_name:nvdConfig2.nvd_name,nvd_subtitle:nvdConfig2.nvd_subtitle,widget_icon:nvdConfig2.nvd_widget_icon,opt_out_icon:nvdConfig2.nvd_widget_icon_alt||nvdConfig2.nvd_widget_icon,learnMore:nvdConfig2?.nvd_learn_more,nvd_description:nvdConfig2.nvd_description,nvd_message:nvdConfig2.nvd_message,protection_variants:nvdConfig2.nvd_variants,product_exclusion:nvdConfig2.product_exclusion,min_protection_price:nvdConfig2.min_protection_value,max_protection_price:nvdConfig2.max_protection_value,protection_type:nvdConfig2.nvd_protection_type,protection_percentage:nvdConfig2.nvd_protection_type_value,min_protection_variant:nvdConfig2.min_variant_id,max_protection_variant:nvdConfig2.max_variant_id,expiration:today.setDate(today.getDate()+3),nvd_widget_style:nvdConfig2.nvd_widget_style,previewMode:nvdConfig2.nvd_preview_mode,rounding_value:nvdConfig2.rounding_value,maxThreshold:nvdConfig2.threshold_value,nvd_widget_template:nvdConfig2.nvd_widget_template,exclusion_action:nvdConfig2?.exclusion_action,nvd_international:nvdConfig2.nvd_international,nvd_international_fee:nvdConfig2.nvd_international_fee,nvd_international_fee_active:nvdConfig2.nvd_international_fee_active,nvd_nations:isValidJSON(nvdConfig2?.nvd_nations)?JSON.parse(nvdConfig2.nvd_nations):[]};if(sessionStorage.setItem("nvdconfig",JSON.stringify(shopConfig)),callback)return callback()}catch(error){useConsole("%c navidium error fetching config","color: yellow; background-color: red; font-size: 12px",error)}},calculateNvdCustomFee=(custom_setting_operator,custom_setting_price,convertedTotalInStoreCurrency)=>custom_setting_operator==="is_greater_than"&&convertedTotalInStoreCurrency>
31custom_setting_price?!0:custom_setting_operator==="is_less_than"&&convertedTotalInStoreCurrency<custom_setting_price;function nvdRoundUp(number){return Math.floor(number*100)/100}const nvdCalculateProtection=async(cartTotal,nvdConfig)=>{let conversionRate=parseFloat(Shopify.currency.rate),convertedTotal=cartTotal/conversionRate,protection_type=nvdConfig.protection_type,protection_percentage=nvdConfig.protection_percentage,protectionId,protectionPrice,minPrice=Shopify?.currency?.active==="GBP"?2:Number(nvdConfig.min_protection_price),maxPrice=Number(nvdConfig.max_protection_price),minId=nvdConfig.min_protection_variant,maxId=nvdConfig.max_protection_variant,protectionVariants=nvdConfig.protection_variants,PriceRounding=nvdConfig.rounding_value;const nvdInternationalFeeActive=nvdConfig?.nvd_international_fee_active,nvdInternationalFee=nvdConfig?.nvd_international_fee;protection_type=parseInt(protection_type);let{custom_setting_fee,custom_setting_operator,custom_setting_price,is_custom_setting}=nvdWidgetConfig;useConsole("113 protection_type",protection_type);const nvdVisitorCountry=sessionStorage.getItem("nvdVisitorCountry"),nvd_nations=nvdConfig.nvd_nations?.map(country=>country.name);useConsole(nvd_nations),nvd_nations?.includes(nvdVisitorCountry)||nvdInternationalFeeActive==1&&(protection_percentage=nvdInternationalFee,useConsole("International fee is activated, International fee percentage is",protection_percentage));const isCustomFeeRequired=is_custom_setting?calculateNvdCustomFee(custom_setting_operator,custom_setting_price,convertedTotal):!1;if(isCustomFeeRequired&&(protection_percentage=custom_setting_fee),protection_type==1||isCustomFeeRequired){let ourProtectionPrice=convertedTotal*protection_percentage/100;if(ourProtectionPrice=nvdRoundUp(ourProtectionPrice),useConsole({ourProtectionPrice}),ourProtectionPrice<minPrice)return useConsole("Our protection price is less than minimum"),protectionPrice=minPrice,protectionId=minId,{price:protectionPrice,variant_id:protectionId};if(ourProtectionPrice>maxPrice)return useConsole("Our protection price is greater than maximum"),protectionPrice=maxPrice,protectionId=maxId,{price:protectionPrice,variant_id:protectionId};{useConsole("calculating protection");const priceArray=Object.keys(protectionVariants);return priceArray.sort((a,b)=>a-b),nvdWidgetConfig?.nvd_single_variant==="1"?(useConsole("Single variant mode enabled"),protectionPrice=ourProtectionPrice,protectionId=minId):protectionPrice=nvdFindClosest(priceArray,ourProtectionPrice,PriceRounding),protectionPrice==0?{price:maxPrice,variant_id:maxId}:(protectionId=protectionVariants[protectionPrice]||minId,useConsole({price:protectionPrice,variant_id:protectionId}),{price:protectionPrice,variant_id:protectionId})}}else{useConsole("protection is static");const nvd_static_rules=nvdConfig.nvd_static_rules;if(nvd_static_rules.length){for(let i=0;i<nvd_static_rules.length;i++){let from=nvd_static_rules[i].from,to=nvd_static_rules[i].to;if(convertedTotal<from)return useConsole("Cart total is less than minimum static amount, widget hidden"),null;let next_from=null;if(nvd_static_rules[i+1]&&(next_from=nvd_static_rules[i+1].from),protectionId=nvd_static_rules[0].id,protectionPrice=nvd_static_rules[0].price,(next_from&&convertedTotal<from&&convertedTotal<next_from||convertedTotal>to&&!next_from)&&(protectionId=nvd_static_rules[i].id,protectionPrice=nvd_static_rules[i].price),from<=convertedTotal&&convertedTotal<=to){protectionId=nvd_static_rules[i].id,protectionPrice=nvd_static_rules[i].price;break}}return{price:protectionPrice,variant_id:protectionId}}}},nvd_init=async()=>{if(window.hideNavidium){console.log("Navidium is hidden for window.hideNavidium, skipping initialization");return}window.needToInjectNvd&&injectNvdToCart(),localStorage.setItem("nvd_running",!0);const shopConfig=sessionStorage.getItem("nvdconfig")?JSON.parse(sessionStorage.getItem("nvdconfig")):null;if(shopConfig)useConsole("Navidium config avaialable in storage");else{useConsole("Navidium config not avaialable in storage. nvdPrefetching now"),await nvdPrefetch(nvd_init);return}const cartProtectionVariant=localStorage.getItem("cart_protection"),isAgree=JSON.parse(sessionStorage.getItem("nvdAgree"));let showWidget=!0;if(shopConfig?.exclusion_action=="0"){const excluded=isValidJSON(shopConfig.product_exclusion)?JSON.parse(shopConfig.product_exclusion):{};(await getNvdCartCallback())?.items?.forEach(item=>{excluded?.sku?.forEach(sku=>{item.sku===sku&&(showWidget=!1,useConsole("Excluded product in cart, Widget hidden"))}),excluded?.types?.forEach(type=>{item.product_type===type&&(showWidget=!1,useConsole("Excluded product in cart, Widget hidden"))})}),excluded?.collections?.length>0&&window.nvdCartItems?.length>0&&window.nvdCartItems?.forEach(item=>{excluded?.collections?.forEach(collection=>{console.log({item,collection}),item?.collections?.includes(collection)&&(showWidget=!1,useConsole("Excluded product in cart, Widget hidden"))})})}const nvd_nations=shopConfig.nvd_nations?.map(country=>country?.name)||[],nvdVisitorCountry=sessionStorage.getItem("nvdVisitorCountry")==="undefined"||!sessionStorage.getItem("nvdVisitorCountry")?nvd_nations[0]:sessionStorage.getItem("nvdVisitorCountry");shopConfig.nvd_international==0&&(nvd_nations?.includes(nvdVisitorCountry)||(showWidget=!1,useConsole("Widget is disabled for international"))),shopConfig.show_on_cart==="0"&&(showWidget=!1),useConsole("showWidget",showWidget);const{success}=shopConfig;let checked;if(useConsole("in cart protection variant",cartProtectionVariant),showWidget&&success){const cart=await getNvdCartCallback(nvdCheckCart),cartTotal=await cart.total/100,originalCartTotal=await cart.originalCartTotal/100;useConsole("after exclusion total price is",cartTotal);const getProtection=await nvdCalculateProtection(cartTotal,shopConfig);if(!getProtection){useConsole("No variant found, widget hidden");return}useConsole({getProtection});const variantFromApi=await getProtection.variant_id,priceFromApi=await getProtection.price,marketPrice=await getNavidiumMarketPrice(variantFromApi),protectionPrice=marketPrice||priceFromApi*100*Shopify?.currency?.rate||1;let maxThresholdPrice=parseFloat(shopConfig.maxThreshold);maxThresholdPrice=(maxThresholdPrice*parseFloat(Shopify.currency.rate)).toFixed(2);const cartEmpty=cartTotal<=0;if(localStorage.setItem("nvdProtectionPrice",protectionPrice),localStorage.setItem("nvdVariant",variantFromApi),cartEmpty||maxThresholdPrice<=cartTotal){document.querySelectorAll(".nvd-mini").forEach(item=>item.innerHTML=""),document.querySelectorAll(nvdWidgetHelpers?.checkout_section).forEac
31h(elm=>elm.style.display=""),useConsole("cart total is zero or max threshold true. No need to add protection");return}isAgree?checked=!0:checked=!1,useConsole({isAgree}),useConsole("widget check status: ",checked),nvdVariant=variantFromApi;const storeAgreeCheckbox=window.nvdStoreCheckbox?document.querySelector(window.nvdStoreCheckbox):null;let widgetContent;isAgree?widgetContent=buildClassicWidget(protectionPrice,checked):widgetContent=buildStandardTemplate(protectionPrice,originalCartTotal,storeAgreeCheckbox),cartProtectionVariant?cartProtectionVariant===variantFromApi?(useConsole("1. cart variant is same as the api variant,stay idle and build widget",cartProtectionVariant,variantFromApi),nvdVariant=cartProtectionVariant,document.querySelector(".nvd-mini")&&document.querySelectorAll(".nvd-mini").forEach(item=>{item.innerHTML=widgetContent})):(useConsole("cart variant and api variant is not same.swapping them now"),nvdVariant=variantFromApi,document.querySelector(".nvd-mini")&&document.querySelectorAll(".nvd-mini").forEach(item=>{item.innerHTML=widgetContent})):checked?(useConsole("Protection Not available. Adding now.",cartProtectionVariant,variantFromApi),nvdVariant=variantFromApi,document.querySelector(".nvd-mini")&&document.querySelectorAll(".nvd-mini").forEach(item=>{item.innerHTML=widgetContent})):(nvdVariant=variantFromApi,useConsole("no protection available, just append snippet"),document.querySelector(".nvd-mini")&&document.querySelectorAll(".nvd-mini").forEach(item=>{item.innerHTML=widgetContent}));const checkoutSections=nvdWidgetHelpers?.checkout_section?document.querySelectorAll(nvdWidgetHelpers?.checkout_section):[];checkoutSections.length>0&&document.querySelectorAll(".nvd-mini").length&&checkoutSections.forEach(elm=>{elm.dataset.forcecheckout!=="true"&&(elm.style.display="none")})}else document.querySelectorAll(".nvd-mini").length&&document.querySelectorAll(".nvd-mini").forEach(elm=>elm.innerHTML=""),document.querySelectorAll(nvdWidgetHelpers?.checkout_section).forEach(elm=>elm.style.display=""),useConsole("%c Navidium Message:widget is shut off.Please turn on from your app settings","color: yellow; background-color: blue; font-size: 12px");localStorage.setItem("nvd_running",!1),nvdUpdateLiveCart()},getNvdCartCallback=async callback=>{const cartData=await(await fetch(`/cart.js?t=${Date.now()}`,{cache:"no-cache"})).json();return callback?callback(cartData):cartData},isValidJSON=data=>{try{return JSON.parse(data),!0}catch{return!1}},nvdCheckCart=async(cartData,callback=null)=>{const currency=await cartData.currency;
31if(useConsole("cart in check cart",cartData),cartData.items.length!=0){const{items}=cartData;let total=parseFloat(cartData.total_price),originalCartTotal=cartData.total_price;const nvdCounterArray=[];let recheck=!1,dupeVariant;const shopConfig=sessionStorage.getItem("nvdconfig")?JSON.parse(sessionStorage.getItem("nvdconfig")):null,excluded=isValidJSON(shopConfig.product_exclusion)?JSON.parse(shopConfig.product_exclusion):{};if(shopConfig||await nvdPrefetch(),useConsole("product exclusion",excluded),items.forEach(item=>{item.handle.includes("shipping-protection")||nvdWidgetHelpers.product_handle?.includes(item.handle)?(nvdCounterArray.push(item.variant_id),useConsole("protection available in cart"),localStorage.setItem("cart_protection",item.variant_id),total-=item.final_line_price,originalCartTotal-=item.final_line_price,useConsole("nvd1",total),item.quantity>1?(useConsole("Found duplicate protection in cart,decreasing now"),recheck=!0,dupeVariant=item.variant_id):useConsole("protection duplication test passed")):excluded?.length>=0?excluded?.forEach(sku=>{item.sku===sku&&(shopConfig.exclusion_action=="0"?localStorage.setItem("exclusion_action","hide_widget"):(useConsole("%c Navidium Message:Product is excluded","color: yellow; background-color: blue; font-size: 16px",item.sku,item.final_price),total-=item.final_line_price,useConsole("ex1",total)))}):(excluded?.sku?.forEach(sku=>{item.sku===sku&&(useConsole("%c Navidium Message:Product is excluded","color: yellow; background-color: blue; font-size: 16px",item.sku,item.final_price),total-=item.final_line_price,useConsole("ex1",total))}),excluded?.types?.forEach(type=>{item.product_type===type&&(useConsole("%c Navidium Message:Product is excluded","color: yellow; background-color: blue; font-size: 16px",item.sku,item.final_price),total-=item.final_line_price,useConsole("ex1",total))}))}),excluded?.collections?.length>0&&window.nvdCartItems?.length>0&&window.nvdCartItems?.forEach(item=>{excluded?.collections?.forEach(collection=>{item?.collections?.includes(collection)&&(total-=item.final_line_price)})}),recheck===!0){const mutateCart=adjustProtectionQuantity(dupeVariant,0,!1);useConsole("calling nvdCheckCart function recursively",mutateCart),getNvdCartCallback(nvdCheckCart)}return nvdCounterArray.length>1&&(useConsole("%cfound more than one variant of navidium protection in cart,removing all now","color:red"),nvdCounterArray.forEach(item=>{useConsole("removing variant",item),adjustProtectionQuantity(item,0),localStorage.removeItem("cart_protection"),recheck=!1})),nvdCounterArray.length==0&&(useConsole("No protection available in cart"),localStorage.removeItem("cart_protection")),nvdCounterArray.length==items.length&&(useConsole("no items in cart rather than protection"),fetch("/cart/clear.js").then(res=>{useConsole("cart cleared"),window.navadiumStopReload||location.reload(),localStorage.removeItem("cart_protection")})),{total:parseFloat(total),currency,originalCartTotal}}return{total:0,currency}},nvdRedirectToCheckout=()=>{try{const checkoutBtn=nvdWidgetHelpers?.store_checkout_button+", [name='checkout']";window.nvdStopRedirect&&document.querySelector(checkoutBtn)?document.querySelector(checkoutBtn).click():location.href="/checkout"}catch{location.href="/checkout"}},addProtection=async(variantId,quantity=1,reload=!1)=>{const{status,property_name,property_value}=sessionStorage.getItem("nvdDisclaimer")&&isValidJSON(sessionStorage.getItem("nvdDisclaimer"))?JSON.parse(sessionStorage.getItem("nvdDisclaimer")):{},properties={};status&&(properties[property_name]=property_value);const nvdStoreCredit=window.nvdStoreCredit;nvdStoreCredit?.store_credit&&(properties._nvd_sc_type=nvdStoreCredit?.choose_credit_type,properties._nvd_sc_value=nvdStoreCredit?.amount);const isSingleVariant=nvdWidgetConfig?.nvd_single_variant==="1",protectionPrice=localStorage.getItem("nvdProtectionPrice")/100;isSingleVariant&&protectionPrice&&(properties._nvd_protection_fee=protectionPrice);const request={method:"POST",headers:{"Content-Type":"application/json;",Accept:"application/json"},body:JSON.stringify({id:variantId,quantity,properties})};(await(await fetch("/cart/add.js",request)).json()).id&&(localStorage.setItem("nvd_opted_out",!1),localStorage.setItem("cart_protection",variantId),useConsole("%c Protection added successfully","color: white; background-color: green"))},adjustProtectionQuantity=async(variantId,quantity,reload=!1)=>{const request={method:"POST",headers:{"Content-Type":"application/json;",Accept:"application/json"},body:JSON.stringify({id:String(variantId),quantity:String(quantity)})},cartJson=await(await fetch("/cart/change.js",request)).json();if(useConsole("%cnew cart instance after duplicate protection quantity decrease","color:yellow",cartJson),console.dir(cartJson),nvdUpdateLiveCart(cartJson),reload)location.reload();else return cartJson},getShippingProtection=async e=>{const{checked}=e;checked?(useConsole("checked and adding protection"),sessionStorage.setItem("nvdAgree",!0),nvd_init(),nvdUpdateLiveCart()):(useConsole("unchecking and removing protection"),sessionStorage.setItem("nvdAgree",null),nvd_init(),nvdUpdateLiveCart())};async function getNvdCartDetails(){try{return await(await fetch("/cart?view=nvd-cart.json")).json()}catch{return null}}const nvdUpdateLiveCart=async(cartData=null)=>{if(!JSON.parse(sessionStorage.getItem("nvdAgree")))return;let cart=cartData;cart==null&&(cart=await getNvdCartCallback());let curRate=Shopify.currency.rate,cartTotal=cart.total_price;const protectionPrice=Number(localStorage.getItem("nvdProtectionPrice"));useConsole("protection price-->>",protectionPrice);let totalPrice;const cartItems=cart.items,totalCount=cart.item_count,optedOut=localStorage.getItem("nvd_opted_out")?!!JSON.parse(localStorage.getItem("nvd_opted_out")):null,totalElem=document.querySelectorAll(nvdWidgetHelpers?.subtotal_element);let currentCount,XtotalPrice;optedOut==!1&&(currentCount=totalCount,XtotalPrice=cartTotal+protectionPrice,totalPrice=nvdFormatMoney(XtotalPrice),useConsole("x total price",XtotalPrice)),(optedOut==!0||optedOut==null)&&(totalPrice=nvdFormatMoney(cart.total_price),currentCount=totalCount,useConsole(" total price",totalPrice)),useConsole("updating subtotal",totalPrice),cart.item_count==0&&(currentCount=0),useConsole("current and cart count",currentCount,totalCount),totalElem&&document.querySelector(".nvd-mini")?.innerHTML&&totalElem.forEach(elem=>elem.innerHTML=totalPrice)},isValidUrl=urlString=>!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;
31&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(urlString);function buildClassicWidget(protectionPrice,checked){const{id,section_content:{title,subtitle,img},section_style:{background_color,title_color,subtitle_color,icon_color,protection_amount_color}}=nvdConsentConfig.landing_popup.widget_settings;return` 32 <div style="width: 100%; max-width: 500px; background-color: ${background_color}; padding: 10px; margin: 10px auto; display: flex; flex-direction: column;"> 33 <div style="display: flex; align-items: center; gap: 10px;"> 34 <div style="position: relative;top: 4px;"> 35 <input ${checked?"checked":""} onchange="getShippingProtection(this)" type="checkbox" id="shippingProtectionCheckBox" style="width: 16px; height: 16px; display: inline-block; cursor: pointer;"> 36 </div> 37 <div style="display: flex; align-items: center; gap: 10px;"> 38 <h4 style="font-size: 16px; color: ${title_color}; margin: 0;">${title}</h4> 39 <strong style="color: ${protection_amount_color}; font-size: 12px;"> 40 ${nvdFormatMoney(protectionPrice)} 41 </strong> 42 </div> 43 </div> 44 45 <div style="display: flex; align-items: start; justify-content: space-between; gap: 5px;"> 46 <p style="color: ${subtitle_color}; font-size: 12px; margin: 0;line-height: 18px;"> 47 ${subtitle} 48 </p> 49 ${img?` <img 50 style="width: 70px; object-fit: contain;" 51 src="${img}" 52 />`:`<svg xmlns="http://www.w3.org/2000/svg" width="40" height="45" fill="${icon_color}" viewBox="0 0 55 65"><path fill="${icon_color}" d="m32.079 42.638 14.735-8.78v4.844L28.143 49.3V24.17l27.25-15.946V37.39s-.639 4.082-1.716 6.46c-1.056 2.33-1.97 3.505-3.633 5.45-2.217 2.592-3.952 3.578-6.661 5.651-5.578 4.268-15.341 9.386-15.341 9.386v-4.743s8.177-4.614 12.919-8.276c2.368-1.83 3.95-2.636 5.853-4.945 1.252-1.52 1.925-2.441 2.725-4.24.782-1.755 1.312-4.743 1.312-4.743V15.994L32.08 27.096v15.542Z"></path><path fill="${icon_color}" d="M28.041 64.334V59.59l-11.505-6.964s-4.458-2.775-6.661-5.248C8.52 45.86 7.859 44.904 6.847 43.14c-.887-1.544-1.475-2.412-1.918-4.137-.608-2.367 0-6.258 0-6.258L50.75 5.797l-4.743-2.523L.79 29.918s-.753 5.617 0 9.084c.538 2.474 1.098 3.837 2.321 6.055 1.264 2.292 2.235 3.452 4.038 5.35 2.28 2.4 6.66 5.247 6.66 5.247l14.231 8.68ZM32.889.652.896 19.525v5.248L41.468.653h-8.58ZM13.713.752.896 8.322v6.156L24.108.752H13.713Z"></path></svg>`} 53 </div> 54 </div> 55 `}function buildStandardTemplate(protectionPrice,cartTotal,storeAgreeCheckbox){switch(nvdConsentConfig?.standard_widget?.templateId){case 1:return standardWidgetTemplateOne(protectionPrice,cartTotal,storeAgreeCheckbox);case 2:return standardWidgetTemplateTwo(protectionPrice,cartTotal,storeAgreeCheckbox);case 3:return standardWidgetTemplateThree(protectionPrice,cartTotal,storeAgreeCheckbox);case 4:return standardWidgetTemplateFour(protectionPrice,cartTotal,storeAgreeCheckbox);default:return standardWidgetTemplateOne(protectionPrice,cartTotal,storeAgreeCheckbox)}}function standardWidgetTemplateOne(protectionPrice,cartTotal,storeAgreeCheckbox){const{general:{section_content:{logo},section_style:{background_color,border_color,icon_color,icon_background_color,protection_amount_color}},heading:{section_content:{title,subtitle,learn_more,learn_more_text,learn_more_destination},section_style:{title_color,subtitle_color,learn_more_color,title_font_size,title_font_weight,subtitle_font_size,subtitle_font_weight}},cta_button:{section_content:{img,button_text,is_secondary_button_enable,secondary_button_text,show_subtotal,show_additional_checkout_button},section_style:{button_color,button_background_color,secondary_button_color,secondary_button_background_color,button_font_size,secondary_button_font_size,button_font_weight,secondary_button_font_weight}}}=nvdConsentConfig?.standard_widget,cartSubTotal=cartTotal*100,isDisabled=storeAgreeCheckbox&&!storeAgreeCheckbox?.checked,totalWithProtection=cartSubTotal+protectionPrice,nvdTotal=nvdFormatMoney(totalWithProtection),buttonLabel=button_text.replaceAll("{price}",nvdTotal)?.replaceAll("{protection_price}",nvdFormatMoney(protectionPrice)),secondaryButtonLabel=secondary_button_text?.replaceAll("{price}",nvdFormatMoney(cartSubTotal));return` 56 <div class="nvd-standard-widget-t-one" id="nvd-standard-widget-container" style=" 57 background-color: ${background_color}; 58 max-width: 375px; 59 padding: 8px; 60 border: 2px solid ${border_color}; 61 display: flex; 62 gap:4px; 63 flex-direction: column; 64 justify-content: center; 65 "> 66 ${show_subtotal?`<div class="nvd-subtotal-area" style="display:flex;justify-content:space-between;align-items:center"> 67 <p style="margin:0;">Subtotal:</p> 68 <p class="nvd-subtotal-price" style="margin:0;">${nvdFormatMoney(cartSubTotal)}</p> 69 </div>`:""} 70 <div class="nvd-main-content-area"> 71 <div id="nvd-standard-widget-contents" style=" 72 display: flex; 73 align-items: center; 74 gap:10px; 75 " class="nvd-widget-contents"> 76 <div id="nvd-standard-widget-logo" style="max-width: 60px; max-height:60px; background-color:${icon_background_color};padding:10px"> 77 ${logo?` <img 78 style="width: 100%;height:100%;" 79 src="${logo}" 80 />`:`<svg class="nvd-std-widget-logo" xmlns="http://www.w3.org/2000/svg" width="40" height="45" fill="${icon_color}
80" viewBox="0 0 55 65"><path fill="${icon_color}" d="m32.079 42.638 14.735-8.78v4.844L28.143 49.3V24.17l27.25-15.946V37.39s-.639 4.082-1.716 6.46c-1.056 2.33-1.97 3.505-3.633 5.45-2.217 2.592-3.952 3.578-6.661 5.651-5.578 4.268-15.341 9.386-15.341 9.386v-4.743s8.177-4.614 12.919-8.276c2.368-1.83 3.95-2.636 5.853-4.945 1.252-1.52 1.925-2.441 2.725-4.24.782-1.755 1.312-4.743 1.312-4.743V15.994L32.08 27.096v15.542Z"></path><path fill="${icon_color}" d="M28.041 64.334V59.59l-11.505-6.964s-4.458-2.775-6.661-5.248C8.52 45.86 7.859 44.904 6.847 43.14c-.887-1.544-1.475-2.412-1.918-4.137-.608-2.367 0-6.258 0-6.258L50.75 5.797l-4.743-2.523L.79 29.918s-.753 5.617 0 9.084c.538 2.474 1.098 3.837 2.321 6.055 1.264 2.292 2.235 3.452 4.038 5.35 2.28 2.4 6.66 5.247 6.66 5.247l14.231 8.68ZM32.889.652.896 19.525v5.248L41.468.653h-8.58ZM13.713.752.896 8.322v6.156L24.108.752H13.713Z"></path></svg>`} 81 </div> 82 <div id="nvd-standard-widget-content" style="display: flex; flex-direction: column; text-align: left;"> 83 <h3 class="nvd-std-widget-title" style=" 84 margin:0px; 85 font-size: ${title_font_size||"16px"}; 86 font-weight: ${title_font_weight||600}; 87 color: ${title_color}; 88 ">${title?.replace("Navidium","")}</h3> 89 <div class="nvd-secondary-content"> 90 <p class="nvd-std-widget-subtitle" style=" 91 margin:0px; 92 font-size: ${subtitle_font_size||"12px"}; 93 font-weight: ${subtitle_font_weight||400}; 94 color: ${subtitle_color}; 95 "> 96 ${subtitle} 97 <span class="nvd-std-widget-price" style="color: ${protection_amount_color};"> 98 ${nvdFormatMoney(protectionPrice)}</span> 99 </p> 100 ${learn_more?`<a class="nvd-std-widget-learn-more" style="font-size:12px; display:flex;align-items:center;gap:3px; color:${learn_more_color}; text-decoration:underline;" href='${learn_more_destination}'>${learn_more_text}</a>`:""} 101 </div> 102 </div> 103 </div> 104 </div> 105 <button ${isDisabled?"disabled":""} id="nvd-with-checkout-btn" style=" 106 background-color: ${button_background_color}; 107 color: ${button_color}; 108 border-radius: 4px; 109 padding: 12px; 110 font-size:${button_font_size||"14px"}; 111 font-weight:${button_font_weight||600}; 112 border: none; 113 cursor: pointer; 114 width:100%; 115 display: flex; 116 justify-content: center; 117 align-items: center; 118 gap: 5px; 119 "> 120 ${img?`<img style="width: 17px;height:18px;" src="${img}" />`:""} 121 <span id="nvd-subtotal">${buttonLabel}</span> 122 </button> 123 ${is_secondary_button_enable?` <button ${isDisabled?"disabled":""} id="nvd-without-checkout-btn" style=" 124 background-color: ${secondary_button_background_color}; 125 color: ${secondary_button_color}; 126 border-radius: 4px; 127 padding: 12px; 128 font-size:${secondary_button_font_size||"14px"}; 129 font-weight:${secondary_button_font_weight||400}; 130 border: none; 131 cursor: pointer; 132 text-decoration:underline; 133 "> 134 <span id="nvd-subtotal">${secondaryButtonLabel}</span> 135 </button>`:""} 136 </div> 137 `}function standardWidgetTemplateTwo(protectionPrice,cartTotal,storeAgreeCheckbox){const{general:{section_content:{logo},section_style:{background_color,border_color,icon_color,icon_background_color,protection_amount_color}},heading:{section_content:{title,subtitle,learn_more,learn_more_text,learn_more_destination},section_style:{title_color,subtitle_color,learn_more_color,title_font_size,title_font_weight,subtitle_font_size,subtitle_font_weight}},cta_button:{section_content:{img,button_text,is_secondary_button_enable,secondary_button_text,show_subtotal,show_additional_checkout_button},section_style:{button_color,button_background_color,secondary_button_color,secondary_button_background_color,button_font_size,secondary_button_font_size,button_font_weight,secondary_button_font_weight}}}=nvdConsentConfig?.standard_widget,cartSubTotal=cartTotal*100,isDisabled=storeAgreeCheckbox&&!storeAgreeCheckbox?.checked,totalWithProtection=cartSubTotal+protectionPrice,nvdTotal=nvdFormatMoney(totalWithProtection),buttonLabel=button_text.replaceAll("{price}",nvdTotal),secondaryButtonLabel=secondary_button_text?.replaceAll("{price}",nvdFormatMoney(cartSubTotal));return` 138 <div class="nvd-standard-widget-t-two" id="nvd-standard-widget-container" style=" 139 background-color: ${background_color}; 140 max-width: 375px; 141 padding: 8px; 142 border: 2px solid ${border_color}; 143 display: flex; 144 gap:4px; 145 flex-direction: column; 146 justify-content: center; 147 "> 148 ${show_subtotal?`<div class="nvd-subtotal-area" style="display:flex;justify-content:space-between;align-items:center"> 149 <p style="margin:0;">Subtotal:</p> 150 <p class="nvd-subtotal-price" style="margin:0;">${nvdFormatMoney(cartSubTotal)}</p> 151 </div>`:""} 152 <div class="nvd-main-content-area"> 153 <button ${isDisabled?"disabled":""} id="nvd-with-checkout-btn" style=" 154 background-color: ${button_background_color}; 155 color: ${button_color}; 156 border-radius: 4px; 157 padding: 12px; 158 font-size:${button_font_size||"14px"}; 159 border: none; 160 cursor: pointer; 161 width:100%; 162 font-weight:${button_font_weight||800}; 163 display: flex; 164 justify-content: center; 165 align-items: center; 166 gap: 5px; 167 "> 168 ${img?`<img style="width: 17px;height:18px;" src="${img}" />`:""}
169 <span id="nvd-subtotal">${buttonLabel}</span> 170 </button> 171 <div id="nvd-standard-widget-contents" style=" 172 display: flex; 173 align-items: start; 174 margin-top:5px; 175 gap:5px; 176 " class="nvd-widget-contents"> 177 <div id="nvd-standard-widget-logo" style="max-width: 60px; max-height:60px; background-color:${icon_background_color};padding:10px;border-radius:8px;"> 178 ${logo?` <img 179 style="width: 100%;height:100%;" 180 src="${logo}" 181 />`:`<svg class="nvd-std-widget-logo" xmlns="http://www.w3.org/2000/svg" width="40" height="45" fill="${icon_color}" viewBox="0 0 55 65"><path fill="${icon_color}" d="m32.079 42.638 14.735-8.78v4.844L28.143 49.3V24.17l27.25-15.946V37.39s-.639 4.082-1.716 6.46c-1.056 2.33-1.97 3.505-3.633 5.45-2.217 2.592-3.952 3.578-6.661 5.651-5.578 4.268-15.341 9.386-15.341 9.386v-4.743s8.177-4.614 12.919-8.276c2.368-1.83 3.95-2.636 5.853-4.945 1.252-1.52 1.925-2.441 2.725-4.24.782-1.755 1.312-4.743 1.312-4.743V15.994L32.08 27.096v15.542Z"></path><path fill="${icon_color}" d="M28.041 64.334V59.59l-11.505-6.964s-4.458-2.775-6.661-5.248C8.52 45.86 7.859 44.904 6.847 43.14c-.887-1.544-1.475-2.412-1.918-4.137-.608-2.367 0-6.258 0-6.258L50.75 5.797l-4.743-2.523L.79 29.918s-.753 5.617 0 9.084c.538 2.474 1.098 3.837 2.321 6.055 1.264 2.292 2.235 3.452 4.038 5.35 2.28 2.4 6.66 5.247 6.66 5.247l14.231 8.68ZM32.889.652.896 19.525v5.248L41.468.653h-8.58ZM13.713.752.896 8.322v6.156L24.108.752H13.713Z"></path></svg>`} 182 </div> 183 <div id="nvd-standard-widget-content" style="display: flex; flex-direction: column; text-align: left;"> 184 <p class="nvd-title" style=" 185 margin:0px; 186 font-size: ${title_font_size||"12px"}; 187 font-weight: ${title_font_weight||600}; 188 color: ${title_color}; 189 line-height: normal; 190 ">${title?.replace("Navidium","")} <span style="color: ${protection_amount_color};"> 191 ${nvdFormatMoney(protectionPrice)}</span></p> 192 193 <div class="nvd-secondary-content"> 194 <p class="nvd-std-widget-subtitle" style=" 195 margin:0px; 196 font-size: ${subtitle_font_size||"12px"}; 197 font-weight: ${subtitle_font_weight||400}; 198 color: ${subtitle_color}; 199 line-height: normal; 200 "> 201 ${subtitle} 202 </p> 203 ${learn_more?`<a class="nvd-learn-more" style="font-size:12px; font-weight:500; display:flex;align-items:center;gap:3px; color:${learn_more_color};text-decoration:underline;" href='${learn_more_destination}'> <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke-miterlimit="10" stroke-width="32" d="M248 64C146.39 64 64 146.39 64 248s82.39 184 184 184 184-82.39 184-184S349.61 64 248 64z"></path><path fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M220 220h32v116"></path><path fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M208 340h88"></path><path d="M248 130a26 26 0 1026 26 26 26 0 00-26-26z"></path></svg><span>${learn_more_text}</span></a>`:""} 204 </div> 205 </div> 206 </div> 207 208 </div> 209 ${is_secondary_button_enable?` <button ${isDisabled?"disabled":""} id="nvd-without-checkout-btn" style=" 210 background-color: ${secondary_button_background_color}; 211 color: ${secondary_button_color}; 212 border-radius: 4px; 213 padding: 12px; 214 font-size:${secondary_button_font_size||"14px"}; 215 font-weight:${secondary_button_font_weight||400}; 216 border: none; 217 cursor: pointer; 218 text-decoration:underline; 219 "> 220 <span id="nvd-subtotal">${secondaryButtonLabel}</span> 221 </button>`:""} 222 </div> 223 `}function standardWidgetTemplateThree(protectionPrice,cartTotal,storeAgreeCheckbox){const{general:{section_content:{logo,hide_logo},section_style:{background_color,border_color,icon_color,icon_background_color,protection_amount_color}},heading:{section_content:{title,subtitle,learn_more,learn_more_text,learn_more_destination},section_style:{title_color,subtitle_color,learn_more_color,title_font_size,title_font_weight,subtitle_font_size,subtitle_font_weight}},cta_button:{section_content:{img,button_text,is_secondary_button_enable,secondary_button_text,show_subtotal,show_additional_checkout_button},section_style:{button_color,button_background_color,secondary_button_color,secondary_button_background_color,button_font_size,secondary_button_font_size,button_font_weight,secondary_button_font_weight}}}=nvdConsentConfig?.standard_widget,cartSubTotal=cartTotal*100,isDisabled=storeAgreeCheckbox&&!storeAgreeCheckbox?.checked,totalWithProtection=cartSubTotal+protectionPrice,nvdTotal=nvdFormatMoney(totalWithProtection),buttonLabel=button_text.replaceAll("{price}",nvdTotal),secondaryButtonLabel=secondary_button_text?.replaceAll("{price}",nvdFormatMoney(cartSubTotal));return` 224 <div class="nvd-standard-widget-t-three" id="nvd-standard-widget-container" style=" 225 background-color: ${background_color}; 226 max-width: 420px; 227 padding: 8px; 228 border: 2px solid ${border_color}; 229 display: flex; 230 gap:4px; 231 flex-direction: column; 232 justify-content: center; 233 "> 234 ${show_subtotal?`<div class="nvd-subtotal-area" style="display:flex;justify-content:space-between;align-items:center"> 235 <p style="margin:0;">Subtotal:</p> 236 <p class="nvd-subtotal-price" style="margin:0;">${nvdFormatMoney(cartSubTotal)}</p> 237 </div>`:""} 238 <div class="nvd-main-content-area" style=" 239 display: flex; 240 align-items: center; 241 justify-content: space-between; 242 " > 243 <div id="nvd-standard-widget-contents" class="nvd-widget-contents" style=" 244 display: flex; 245 align-items: start; 246 gap: 10px; 247 "> 248 ${hide_logo?"":`<div id="nvd-standard-widget-logo" style="background-color:${icon_background_color};margin-bottom: 7px; height: 14px;"> 249 ${logo?` <img 250 style="width: 16px;height:16px;" 251 src="${logo}" 252 />`:`<svg class="nvd-std-widget-logo" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="${icon_color}
252" viewBox="0 0 55 65"><path fill="${icon_color}" d="m32.079 42.638 14.735-8.78v4.844L28.143 49.3V24.17l27.25-15.946V37.39s-.639 4.082-1.716 6.46c-1.056 2.33-1.97 3.505-3.633 5.45-2.217 2.592-3.952 3.578-6.661 5.651-5.578 4.268-15.341 9.386-15.341 9.386v-4.743s8.177-4.614 12.919-8.276c2.368-1.83 3.95-2.636 5.853-4.945 1.252-1.52 1.925-2.441 2.725-4.24.782-1.755 1.312-4.743 1.312-4.743V15.994L32.08 27.096v15.542Z"></path><path fill="${icon_color}" d="M28.041 64.334V59.59l-11.505-6.964s-4.458-2.775-6.661-5.248C8.52 45.86 7.859 44.904 6.847 43.14c-.887-1.544-1.475-2.412-1.918-4.137-.608-2.367 0-6.258 0-6.258L50.75 5.797l-4.743-2.523L.79 29.918s-.753 5.617 0 9.084c.538 2.474 1.098 3.837 2.321 6.055 1.264 2.292 2.235 3.452 4.038 5.35 2.28 2.4 6.66 5.247 6.66 5.247l14.231 8.68ZM32.889.652.896 19.525v5.248L41.468.653h-8.58ZM13.713.752.896 8.322v6.156L24.108.752H13.713Z"></path></svg>`} 253 </div>`} 254 <div id="nvd-standard-widget-content" style="text-align: left;"> 255 <p class="nvd-title" style=" 256 margin:0px; 257 font-size: ${title_font_size||"12px"}; 258 font-weight: ${title_font_weight||600}; 259 color: ${title_color}; 260 line-height: 20px; 261 ">${title?.replace("Navidium","")} 262 <span style="color: ${protection_amount_color};"> 263 ${nvdFormatMoney(protectionPrice)} 264 </span> 265 </p> 266 </div> 267 </div> 268 <div class="nvd-secondary-content"> 269 ${learn_more?`<a class="nvd-learn-more" style="font-size:12px; font-weight:500; display:flex;align-items:center;gap:3px; color:${learn_more_color};text-decoration:underline;" href='${learn_more_destination}'> <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke-miterlimit="10" stroke-width="32" d="M248 64C146.39 64 64 146.39 64 248s82.39 184 184 184 184-82.39 184-184S349.61 64 248 64z"></path><path fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M220 220h32v116"></path><path fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M208 340h88"></path><path d="M248 130a26 26 0 1026 26 26 26 0 00-26-26z"></path></svg><span>${learn_more_text}</span></a>`:""} 270 </div> 271 </div> 272 <button ${isDisabled?"disabled":""} id="nvd-with-checkout-btn" style=" 273 background-color: ${button_background_color}; 274 color: ${button_color}; 275 border-radius: 4px; 276 padding: 12px; 277 font-size:${button_font_size||"14px"}; 278 border: none; 279 cursor: pointer; 280 width:100%; 281 font-weight:${button_font_weight||800}; 282 display: flex; 283 justify-content: center; 284 align-items: center; 285 gap: 5px; 286 "> 287 ${img?`<img style="width: 17px;height:18px;" src="${img}" />`:""} 288 <span id="nvd-subtotal">${buttonLabel}</span> 289 </button> 290 ${is_secondary_button_enable?` <button ${isDisabled?"disabled":""} id="nvd-without-checkout-btn" style=" 291 background-color: ${secondary_button_background_color}; 292 color: ${secondary_button_color}; 293 border-radius: 4px; 294 padding: 6px; 295 font-size:${secondary_button_font_size||"14px"}; 296 font-weight:${secondary_button_font_weight||400}; 297 border: none; 298 cursor: pointer; 299 text-decoration:underline; 300 "> 301 <span id="nvd-subtotal">${secondaryButtonLabel}</span> 302 </button>`:""} 303 <p class="nvd-std-widget-subtitle" style=" 304 margin:0px; 305 text-align:center; 306 font-size: ${subtitle_font_size||"12px"}; 307 font-weight: ${subtitle_font_weight||400}; 308 color: ${subtitle_color}; 309 line-height: normal; 310 "> 311 ${subtitle} 312 </p> 313 </div> 314 `}function standardWidgetTemplateFour(protectionPrice,cartTotal,storeAgreeCheckbox){const{general:{section_style:{background_color,border_color,border_radius,protection_amount_color}},heading:{section_content:{title,subtitle,learn_more,learn_more_text,learn_more_destination,hide_powered_by},section_style:{title_color,subtitle_color,learn_more_color,title_font_size,title_font_weight,subtitle_font_size,subtitle_font_weight}},cta_button:{section_content:{img,button_text,is_secondary_button_enable,secondary_button_text,show_subtotal,show_additional_checkout_button},section_style:{button_color,button_background_color,secondary_button_color,secondary_button_background_color,button_font_size,secondary_button_font_size,button_font_weight,secondary_button_font_weight}}}=nvdConsentConfig?.standard_widget,cartSubTotal=cartTotal*100,isDisabled=storeAgreeCheckbox&&!storeAgreeCheckbox?.checked,totalWithProtection=cartSubTotal+protectionPrice,nvdTotal=nvdFormatMoney(totalWithProtection),buttonLabel=button_text.replaceAll("{price}",nvdTotal),secondaryButtonLabel=secondary_button_text?.replaceAll("{price}",nvdFormatMoney(cartSubTotal));return` 315 <div 316 id="nvd-standard-widget-container" 317 class="nvd-standard-widget-t-four" 318 style=" 319 background-color: ${background_color}; 320 max-width: 480px; 321 padding: 12px; 322 border: 2px solid ${border_color}; 323 border-radius: ${border_radius}; 324 display: flex; 325 flex-direction: column; 326 gap: 8px; 327 justify-content: center; 328 text-align: center; 329 font-family: Arial, sans-serif; 330 " 331 > 332 ${show_subtotal?`<div class="nvd-subtotal-area" style="display:flex;justify-content:space-between;align-items:center"> 333 <p style="margin:0;">Subtotal:</p> 334 <p class="nvd-subtotal-price" style="margin:0;">${nvdFormatMoney(cartSubTotal)}</p> 335 </div>`:""} 336 <div class="nvd-title" style="color: ${title_color}; font-size: ${title_font_size||"11px"}; font-weight: ${title_font_weight||600}; display: flex; justify-content: center; align-items: center; gap: 6px;">
337 <span>${title?.replace("Navidium","")} 338 <span style="color: ${protection_amount_color};"> 339 ${nvdFormatMoney(protectionPrice)} 340 </span></span> 341 ${learn_more?`<a class="nvd-learn-more" href="${learn_more_destination}" target="_blank" style="text-decoration: none;"> 342 <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" > 343 <path d="M10 9.16667H10.8333V15H9.16667V10.8333C8.70667 10.8333 8.33333 10.46 8.33333 10C8.33333 9.54 8.70667 9.16667 9.16667 9.16667H10ZM10 20C4.4775 20 0 15.5225 0 10C0 4.4775 4.4775 0 10 0C15.5225 0 20 4.4775 20 10C20 15.5225 15.5225 20 10 20ZM10 18.3333C14.6025 18.3333 18.3333 14.6025 18.3333 10C18.3333 5.3975 14.6025 1.66667 10 1.66667C5.3975 1.66667 1.66667 5.3975 1.66667 10C1.66667 14.6025 5.3975 18.3333 10 18.3333ZM8.75 6.25C8.75 5.56 9.305 5 10 5C10.69 5 11.25 5.555 11.25 6.25C11.25 6.94 10.695 7.5 10 7.5C9.31 7.5 8.75 6.945 8.75 6.25Z" fill="#fff"> 344 </path></svg> 345 </a>`:""} 346 </div> 347 348 <button ${isDisabled?"disabled":""} id="nvd-with-checkout-btn" 349 style=" 350 font-weight: ${button_font_weight}; 351 font-size: ${button_font_size}; 352 background-color: ${button_background_color}; 353 color: ${button_color}; 354 padding: 8px 16px; 355 border: none; 356 border-radius: 4px; 357 cursor: pointer; 358 display: flex; 359 justify-content: center; 360 align-items: center; 361 gap: 5px; 362 width: 100% 363 " 364 > 365 ${img?`<img style="width: 17px;height:18px;" src="${img}" />`:`<svg class="nvd-button-icon" 366 xmlns="http://www.w3.org/2000/svg" 367 width="18px" 368 height="18px" 369 fill="none" 370 {...props} 371 > 372 <path 373 stroke="#fff" 374 strokeLinejoin="round" 375 d="M8.468 7.875V6.75a1.5 1.5 0 1 1 3 0v1.125M9.405 12h1.125c.88 0 1.32 0 1.623-.232.078-.06.147-.13.207-.208.233-.303.233-.743.233-1.623s0-1.319-.233-1.622a1.127 1.127 0 0 0-.207-.207c-.303-.233-.743-.233-1.623-.233H9.405c-.88 0-1.32 0-1.622.232-.078.06-.148.13-.208.208-.232.303-.232.743-.232 1.623s0 1.319.232 1.622c.06.078.13.148.208.207.303.233.743.233 1.622.233Z" 376 /> 377 <path 378 stroke="#fff" 379 strokeLinecap="round" 380 d="M16.718 8.387V6.21c0-1.23 0-1.845-.303-2.246s-.989-.596-2.36-.986a18.432 18.432 0 0 1-2.42-.88c-.9-.398-1.35-.598-1.667-.598-.318 0-.768.2-1.667.599-.66.292-1.485.613-2.421.88-1.37.389-2.056.584-2.36.985-.302.401-.302 1.016-.302 2.246v2.177c0 4.22 3.797 6.75 5.695 7.753.456.24.683.36 1.055.36.371 0 .599-.12 1.054-.36 1.899-1.002 5.696-3.534 5.696-7.753Z" 381 /> 382 </svg>`} 383 <span id="nvd-subtotal">${buttonLabel}</span> 384 </button> 385 386 ${hide_powered_by?"":`<div class="nvd-powered-by" 387 style=" 388 padding: 4px 8px; 389 border-radius: 40px; 390 width: fit-content; 391 margin-left: auto; 392 background: white; 393 display: flex; 394 align-items: center; 395 gap: 5px; 396 " 397 > 398 <span style="font-size: 11px;">Powered by </span> 399 <img src="https://cdn.navidiumapp.com/navidium-widgets/assets/icons/powered.png" alt="navidium-icon" height="12px"> 400 </div>`} 401 402 ${is_secondary_button_enable?` <button ${isDisabled?"disabled":""} id="nvd-without-checkout-btn" style=" 403 background-color: ${secondary_button_background_color}; 404 color: ${secondary_button_color}; 405 border-radius: 4px; 406 padding: 6px; 407 font-size:${secondary_button_font_size||"14px"}; 408 font-weight:${secondary_button_font_weight||400}; 409 border: none; 410 cursor: pointer; 411 text-decoration:underline; 412 "> 413 <span id="nvd-subtotal">${secondaryButtonLabel}</span> 414 </button>`:""} 415 </div> 416 `}const changeNvdCheckoutBtnStatus=checked=>{document.querySelectorAll("#nvd-with-checkout-btn, #nvd-without-checkout-btn").forEach(elm=>{checked?elm.removeAttribute("disabled"):elm.setAttribute("disabled","true")})};window.addEventListener("change",e=>{const checkboxes=window.nvdStoreCheckbox?document.querySelectorAll(window.nvdStoreCheckbox):null;
416checkboxes&&checkboxes.forEach(cb=>{cb===e.target&&changeNvdCheckoutBtnStatus(e.target.checked)})}),window.nvdInstantLoad&&(nvdPrefetch().then(()=>nvd_init),setTimeout(()=>{nvd_init()},500)),window.addEventListener("DOMContentLoaded",()=>{nvdPrefetch().then(()=>nvd_init),new Promise(resolve=>{setTimeout(()=>{nvd_init(),resolve()},2e3)}).then(()=>{nvdUpdateLiveCart(null)})}),document.readyState==="complete"?nvd_init():window.addEventListener("load",()=>{nvd_init()}),window.addEventListener("click",ev=>{const navidiumTriggers=Array.from(document.querySelectorAll(nvdWidgetHelpers?.click_triggers)),elm=ev.target;navidiumTriggers.includes(elm)&&(useConsole("navidium triggered slide cart"),setTimeout(()=>{nvd_init().then(()=>{nvdUpdateLiveCart()}).catch(err=>{})},2e3))},!0);const nvdUpdateProtection=async(currentVariant,newVariant)=>{try{const updates={[currentVariant]:0,[newVariant]:1};return(await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json;",Accept:"application/json"},body:JSON.stringify({updates})})).json()}catch(error){useConsole("Error on updating",error)}},nvdAddProtectionController=()=>{const variantId=localStorage.getItem("nvdVariant"),addedVariant=localStorage.getItem("cart_protection");addedVariant===variantId?nvdRedirectToCheckout():addedVariant&&addedVariant!==variantId?nvdUpdateProtection(addedVariant,variantId).then(()=>{nvdRedirectToCheckout()}):addedVariant||addProtection(variantId).then(()=>{nvdRedirectToCheckout()})};class NvdCartWatcher{init(){this.emitCartChanges().then(()=>{this.observeCartChanges()})}async fetchCart(){return(await fetch(`/cart.js?t=${Date.now()}`,{cache:"no-cache"})).json()}storeCart(cart){localStorage.setItem("nvdCart",JSON.stringify(cart))}storedCart(){return JSON.parse(localStorage.getItem("nvdCart"))||{items:[]}}findCartChanges(oldCart,newCart){const onlyInLeft=(l,r)=>l.filter(li=>!r.some(ri=>li.key==ri.key));let result={added:onlyInLeft(newCart.items,oldCart.items),removed:onlyInLeft(oldCart.items,newCart.items)};return oldCart.items.forEach(oldItem=>{const newItem=newCart.items.find(item2=>!item2.handle.includes("shipping-protection")&&item2.key==oldItem.key&&item2.quantity!=oldItem.quantity);if(!newItem)return;let quantity=newItem.quantity-oldItem.quantity,item={...newItem};item.quantity=Math.abs(quantity),quantity>0?result.added.push(item):result.removed.push(item)}),result}async emitCartChanges(){const newCart=await this.fetchCart(),oldCart=this.storedCart(),changes=this.findCartChanges(oldCart,newCart),event=new CustomEvent("nvd_cart_changed",{detail:changes});window.dispatchEvent(event),this.storeCart(newCart)}observeCartChanges(){new PerformanceObserver(list=>{list.getEntries().forEach(entry=>{const isValidRequestType=["xmlhttprequest","fetch"].includes(entry.initiatorType),isCartChangeRequest=/\/cart\//.test(entry.name);isValidRequestType&&isCartChangeRequest&&this.emitCartChanges()})}).observe({entryTypes:["resource"]})}}const myNvdCartWatcher=new NvdCartWatcher;myNvdCartWatcher.init(),window.addEventListener("nvd_cart_changed",e=>{(e.detail?.added?.length!=0||e?.detail?.removed?.length!=0)&&(useConsole("Cart changed::",e.detail),getNvdCartDetails().then(cart=>{cart&&cart?.items?.length&&(window.nvdCartItems=cart.items)}).finally(()=>{nvd_init()}))}),window.nvdStopRedirect&&!window.nvdStopJSTrigger&&window.addEventListener("click",e=>{Array.from(document.querySelectorAll("#nvd-with-checkout-btn, #nvd-with-checkout-btn *, #nvd-without-checkout-btn, #nvd-without-checkout-btn *")).includes(e.target)&&(e.preventDefault(),e.target.innerHTML="<span class='nvd-cta-loader'></span>",useConsole("PREVENRING FROM REDIRECTING"),nvdRedirectToCheckout())},!0),window.addEventListener("pageshow",function(event){event.persisted&&nvd_init()}),(function(){let checkoutLock=!1;function handleClick(e){const withProtection=e.target.closest("#nvd-with-checkout-btn"),withoutProtection=e.target.closest("#nvd-without-checkout-btn");if(!withProtection&&!withoutProtection||(e.preventDefault(),e.stopImmediatePropagation(),checkoutLock))return;checkoutLock=!0;const button=withProtection||withoutProtection;if(button.dataset.originalText=button.innerHTML,button.innerHTML="<span class='nvd-cta-loader'></span>",button.style.pointerEvents="none",console.log("[Navidium] Checkout intercepted"),withProtection){localStorage.getItem("nvdVariant")?nvdAddProtectionController():window.location.href="/checkout";return}document.querySelector("#nvd-reminder-modal")?.innerHTML?.length>0?(nvdReminderPopupOpen(),checkoutLock=!1,button.style.pointerEvents="",button.innerHTML=button.dataset.originalText):window.location.href="/checkout"}window.addEventListener("click",handleClick,!0)})(); 417//# sourceMappingURL=/cdn/shop/t/3/assets/navidium-standrad-widget-custom.js.map?v=171860391668679416281788350809
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.