import{a as T,b as P}from"./chunk-IO2MXSIA.js";import{h as c}from"./chunk-VDGDDK32.js";import{a as g,b as A,c as v,g as I,n as s,p as f}from"./chunk-XI2EB733.js";import{a as E}from"./chunk-JWAFQ6PQ.js";import{b as C}from"./chunk-E5SP5NNO.js";import{e as n,f as p,g as u}from"./chunk-VYUKN3XQ.js";var _=function(r){return r.LISTING="Listing",r.INSURANCE_IMEI_INFO="Insurance IMEI Info",r.QUICK_CART="Quick Cart",r.DELIVERED_TAB="Delivered Tab",r.INSURANCE_AVAILABILITY_POP_UP="Insurance Availability Pop Up",r}(_||{}),m=function(r){return r.LOGIN="Login",r.INFO_ICON="Info Icon",r.T_AND_C="T&C",r.ADD_INSURANCE="Add Insurance",r.PREMIUM_PLAN_UNAVAILABLE="Premium Plan Unavailable",r}(m||{});var o=class{static createNullDeviceInfo(){return{insured_device_name:null,insured_device_brand:null,insured_device_category:null}}static createKnownDeviceInfo(a,e,t){return{insured_device_name:a,insured_device_brand:e,insured_device_category:C[t]}}static createLoginButtonEvent(){return{event:v.MIKRO_USER_CLICK,event_category:I.USER_PROFILE,event_action:_.LISTING,event_label:m.LOGIN,event_value:s.ZERO}}static createIMEIInfoEvent(){return{event:v.MIKRO_USER_CLICK,event_category:I.PRODUCT_DETAIL,event_action:_.INSURANCE_IMEI_INFO,event_label:m.INFO_ICON,event_value:s.ZERO}}static createTermsConditionsEvent(){return{event:v.MIKRO_USER_CLICK,event_category:I.CHECKOUT,event_action:_.QUICK_CART,event_label:m.T_AND_C,event_value:s.ZERO}}static createAddInsuranceFromOrdersEvent(){return{event:v.MIKRO_USER_CLICK,event_category:I.ORDERS_HISTORY,event_action:_.DELIVERED_TAB,event_label:m.ADD_INSURANCE,event_value:s.ZERO}}static createPremiumPlanUnavailableEvent(){return{event:v.MIKRO_EVENT,event_category:I.PRODUCT_DETAIL,event_action:_.INSURANCE_AVAILABILITY_POP_UP,event_label:m.PREMIUM_PLAN_UNAVAILABLE}}static createEcommerceEvent(a,e,t){return{eventType:a,productData:e,additionalData:t}}static typeOfCartItemIsInsuranceOffering(a){return a.__typename==="PendingCartResource"&&a.items.some(e=>{var t;return(e==null?void 0:e.__typename)==="CartItemSubResource"&&((t=e.product)==null?void 0:t.__typename)==="InsuranceOfferingSubResource"})}static createAddToCartEvent(a,e,t,i){return{event:f.addToCart,page_type:P.insurance,page_section:T.main_offer,shop_type:"B2C",ecommerce:{currencyCode:E.EUR,add:{customerId:e==null?void 0:e.ssoId,products:this.mapAddToCartImpression(a,t,i)}}}}static mapAddToCartImpression(a,e,t){return a.map((i,l)=>({brand:i.insured_device_brand||c.brand,category:"asigurari",file:"insurance.tracking.helper",id:(e==null?void 0:e.insuranceId.toString())||(t==null?void 0:t.newInsuranceId.toString())||c.id,img_url:(e==null?void 0:e.productDetails.thumbnail)||c.img_url,item_name_full:c.name,list:void 0,name:c.name,position:l,price:void 0,reviews:null,color:c.color,memory:c.memory,base_price:void 0,period:void 0,installments:e==null?void 0:e.term.value,transactionSubType:void 0,transactionType:g.insurance,retail_price:void 0,promotion_name:void 0,abonamentAtasat:void 0,availability:A.inStock,quantity:1,gift:void 0,insured_device_category:i.insured_device_category,insured_device_brand:i.insured_device_brand,insured_device_name:i.insured_device_name}))}};var d=p({source:"Insurance Tracking",events:{"Category Page Loaded":n(),"Login Button Clicked":u(),"Product Page Loaded":n(),"IMEI Info Icon Clicked":u(),"Add Insurance Clicked":n(),"Premium Plan Unavailable Popup Shown":u(),"Cart Page Loaded":n(),"Premium Upgrade Added":n(),"Insurance Removed From Cart":n(),"Cart Reloaded After Product Change":n(),"Terms And Conditions Clicked":u(),"Complete OrderClicked":n(),"Add Insurance From Orders Clicked":u(),"Track Mikro Gtm Event":n(),"Track DataLayer Event":n(),"Track Ecommerce Event":n()}}),R=class{static categoryPageLoaded(){return d.categoryPageLoaded({productData:o.createNullDeviceInfo()})}static loginButtonClicked(){return d.trackMikroGtmEvent({eventData:o.createLoginButtonEvent()})}static productPageLoaded(){return d.productPageLoaded({productData:o.createNullDeviceInfo()})}static imeiInfoClicked(){return d.trackMikroGtmEvent({eventData:o.createIMEIInfoEvent()})}static addInsuranceClicked(a,e,t,i,l){return d.addInsuranceClicked({productData:o.createKnownDeviceInfo(a,e,t),insurance:i,userIdentity:l})}static premiumPlanUnavailablePopupShown(){return d.trackDataLayerEvent({eventData:o.createPremiumPlanUnavailableEvent()})}static premiumUpgradeAdded(a,e,t,i,l){return d.premiumUpgradeAdded({productData:o.createKnownDeviceInfo(a,e,t),upgradedInsurance:i,userIdentity:l})}static termsConditionsClicked(){return d.trackMikroGtmEvent({eventData:o.createTermsConditionsEvent()})}static completeOrderClicked(){return d.trackMikroGtmEvent({eventData:o.createAddInsuranceFromOrdersEvent()})}};export{o as a,d as b,R as c};