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