import{b as l}from"./chunk-I6XJVXQ2.js";import{c as w,d as y}from"./chunk-THQR457X.js";import{a as L}from"./chunk-5L2Z4GZW.js";import{F as x,e as N}from"./chunk-Y3XMNJA5.js";import{f as M,i as u}from"./chunk-D75D27YU.js";import{d as n,e as o,s as b}from"./chunk-ALDBR463.js";import{c as T}from"./chunk-2G3AB74T.js";import{h as v}from"./chunk-VWCGOHBE.js";import{G as D,Ia as P,J as f,K as O,Oa as m,Z as U,ra as R}from"./chunk-V6BPA3D7.js";var A=function(e){return e.CanBuy="CAN_BUY",e.CannotBuy="CANNOT_BUY",e}(A||{}),p=function(e){return e.Basic="BASIC",e.Premium="PREMIUM",e}(p||{}),j=function(e){return e.ActionNotAllowed="ACTION_NOT_ALLOWED",e.AllMsisdnsNotEligible="ALL_MSISDNS_NOT_ELIGIBLE",e.CategoryNotEligible="CATEGORY_NOT_ELIGIBLE",e.CurrentMsisdnNotEligible="CURRENT_MSISDN_NOT_ELIGIBLE",e.FeatureNotAvailable="FEATURE_NOT_AVAILABLE",e.ImeiNotEligible="IMEI_NOT_ELIGIBLE",e.ImeiOrSerialNoNotValid="IMEI_OR_SERIAL_NO_NOT_VALID",e.InvalidProductDataFromTgw="INVALID_PRODUCT_DATA_FROM_TGW",e.NoEligibleCategories="NO_ELIGIBLE_CATEGORIES",e.NoExchangeRateAvailable="NO_EXCHANGE_RATE_AVAILABLE",e.NoInsuranceFound="NO_INSURANCE_FOUND",e.NoRequestedCategories="NO_REQUESTED_CATEGORIES",e.NoSaleProduct="NO_SALE_PRODUCT",e.NoTransactionData="NO_TRANSACTION_DATA",e.ProductNotEligible="PRODUCT_NOT_ELIGIBLE",e.RequestedTierNotAvailableForPurchase="REQUESTED_TIER_NOT_AVAILABLE_FOR_PURCHASE",e}(j||{}),I=u`
    fragment Money on Money {
  currency
  displayValue
  value
  valueWithoutVat
}
    `,H=u`
    fragment InsuranceProductOfferedTierItem on InsuranceProductOfferedTierItem {
  tier
  startingPrice {
    ...Money
  }
  state
  isRequested
}
    ${I}`,Y=u`
    fragment InsuranceOption on InsuranceOption {
  insuranceId
  tier
  fee {
    ...Money
  }
  state
}
    ${I}`,S=u`
    fragment InsuranceNotSellableReason on InsuranceNotSellableReason {
  reason
  message
}
    `,Q=u`
    fragment InsurableProductItem on InsurableProductItem {
  imei
  oaCode
  categoryId
  displayName
  imageHref
  state
  standardPriceNoVat {
    ...Money
  }
  options {
    ...InsuranceOption
  }
  notSellableReason {
    ...InsuranceNotSellableReason
  }
}
    ${I}
${Y}
${S}`,k=u`
    fragment InsuranceProductItem on InsuranceProductItem {
  deviceCategoryId
  requestedTier
  name
  insuranceId
  offeredTiers {
    ...InsuranceProductOfferedTierItem
  }
  insurableProducts {
    ...InsurableProductItem
  }
  price {
    ...Money
  }
  notSellableReason {
    ...InsuranceNotSellableReason
  }
}
    ${H}
${Q}
${I}
${S}`,W=u`
    fragment CategoryMappedProducts on InsuranceProductCategorizedDetails {
  categoryId
  state
  product {
    ...InsuranceProductItem
  }
}
    ${k}`,X=u`
    fragment InsuranceProductPersonalizedDetails on InsuranceProductPersonalizedDetails {
  categoryMappedProducts {
    ...CategoryMappedProducts
  }
  notSellableReason {
    ...InsuranceNotSellableReason
  }
}
    ${W}
${S}`,B=u`
    query GetInsuranceProductCustomDetails($request: InsuranceProductDetailsRequest) {
  getInsuranceProductCustomDetails(request: $request) {
    ...InsuranceProductPersonalizedDetails
  }
}
    ${X}`;var E=function(e){return e.Custom="custom",e}(E||{});var J=function(e){return e.Phone="Telefon",e.Tablet="Tableta",e.Smartwatch="Smartwatch",e.ConnectedObject="Obiect Conectat",e}(J||{}),K=function(e){return e.Phone="telefon",e.Tablet="tableta",e.Smartwatch="smartwatch",e.ConnectedObject="obiect-conectat",e}(K||{});var Z=[{title:"E necesar s\u0103 fiu abonat Orange pentru a \xEEncheia o asigurare?",category:"Asigurarea Orange",href:"https://www.orange.ro/servicii/asigurare/"},{title:"Ce trebuie s\u0103 fac \xEEn cazul unui accident sau al furtului?",category:"Asigurarea Orange",href:"https://www.orange.ro/help/ce-trebuie-sa-fac-in-cazul-unui-accident-sau-al-furtului-11388"},{title:"Ce trebuie s\u0103 fac dup\u0103 validarea dosarului de daun\u0103?",category:"Asigurarea Orange",href:"https://www.orange.ro/help/ce-trebuie-sa-fac-dupa-validarea-dosarului-11408"},{title:"Ce situa\u021Bii nu sunt acoperite de asigurare?",category:"Asigurarea Orange",href:"https://www.orange.ro/help/ce-situatii-nu-sunt-acoperite-de-asigurare-11428"},{title:"Ce fac dac\u0103 abonamentul are deja inclus serviciul de Asigurare?",category:"Asigurarea Orange",href:"https://www.orange.ro/help/ce-trebuie-sa-fac-daca-abonamentul-meu-are-deja-inclus-serviciul-de-asigurare-pentru-telefon-modem-sau-tableta-11468"},{title:"Ce se \xEEnt\xE2mpl\u0103 dac\u0103 device-ul meu nu poate fi reparat sau este furat?",category:"Asigurarea Orange",href:"https://www.orange.ro/help/ce-se-intampla-daca-dispozitivul-meu-nu-poate-fi-reparat-sau-este-furat-11448"},{title:"Cum pot \xEEnchide contractul de asigurare?",category:"Asigurarea Orange",href:"https://www.orange.ro/help/cum-pot-inchide-contractul-de-asigurare-11488"},{title:"\xCEn ce condi\u021Bii va \xEEnceta asigurarea f\u0103r\u0103 o notificare prealabil\u0103?",category:"Asigurarea Orange",href:"https://www.orange.ro/help/in-ce-conditii-va-inceta-asigurarea-fara-o-notificare-prealabila-din-partea-asiguratorului-sau-orange-11508"},{title:"\xCEntreab\u0103, r\u0103spunde, colaboreaz\u0103 \xEEn Comunitatea Orange",category:"Asigurarea Orange",href:"https://www.orange.ro/servicii/asigurare/"},{title:"Cum activez o poli\u021B\u0103 de asigurare pentru telefonul meu \xEEn magazinul online? ",category:"Asigurarea Orange",href:"https://www.orange.ro/servicii/asigurare/"}],ue={productBasicTierDescription:["Acoper\u0103 deteriorarea accidental\u0103 a echipamentului t\u0103u (c\u0103deri, sc\u0103p\u0103ri, loviri)","Contactul cu lichide"],productPremiumTierDescription:["Pe l\xE2ng\u0103 beneficiile ofertei Basic, Premium acoper\u0103:","Furtul echipamentului t\u0103u (cu excep\u021Bia consolelor), inclusiv prin t\xE2lh\u0103rie, furt din buzunare, furt prin efrac\u021Bie","Costurile suplimentare generate de o utilizare neautorizat\u0103 a echipamentului t\u0103u, p\xE2n\u0103 la suma maxim\u0103 de 500 EUR"],descriptionTitle:"Descriere general\u0103",descriptionSubTitle:"Alege tipul de asigurare care \u021Bi se potrive\u0219te:",descriptionBasic:["Deteriorarea accidental\u0103 a echipamentului t\u0103u, fie c\u0103 este utilizat de tine sau de o alt\u0103 persoan\u0103 cu permisiunea ta.","Deteriorarea echipamentului cu rea-voin\u021B\u0103 de c\u0103tre o persoan\u0103 care folose\u0219te echipamentul f\u0103r\u0103 permisiunea ta.","Contactul cu lichide."],descriptionPremium:["Furtul echipamentului t\u0103u (cu excep\u021Bia consolelor), inclusiv prin t\xE2lh\u0103rie, furt din buzunare, furt prin efrac\u021Bie.","\u0218i costurile suplimentare generate de o utilizare neautorizat\u0103 a echipamentului t\u0103u, p\xE2n\u0103 la suma maxim\u0103 de 500 EUR."],description:"Costul lunar al asigur\u0103rii \u0219i valoarea asigurat\u0103 depind de pre\u021Bul standard al device-ului cump\u0103rat. Tariful asigur\u0103rii alese, f\u0103r\u0103 TVA, va fi inclus pe factura ta Orange lunar\u0103.",selectionTitle:e=>e.toLowerCase().endsWith("a")?`${e} recent comandat\u0103 ce poate fi asigurat\u0103`:`${e} recent comandat ce poate fi asigurat`,selectionDescription:"Selecteaz\u0103 produsul pe care vrei s\u0103-l asiguri:",selectionImeiDescription:"sau adaug\u0103 codul ",faqsTitle:"\xCEntreb\u0103ri frecvente",faqs:Z,errorMessage:"Ne pare r\u0103u dar a intervenit o eroare, te rug\u0103m revii mai t\xE2rziu."},G="Orange";var i=function(e){return e.ADD_INSURANCE="[Cart] Add insurance",e.ADD_INSURANCE_ERROR="[Cart] Add insurance (error)",e.ADD_INSURANCE_SUCCESS="[Cart] Add insurance (success)",e.ADD_INSURANCE_PRODUCT="[Cart] Add insurance product",e.ADD_INSURANCE_PRODUCT_ERROR="[Cart] Add insurance product (error)",e.ADD_INSURANCE_PRODUCT_SUCCESS="[Cart] Add insurance product (success)",e.ADD_MULTIPLE_INSURANCE="[Cart] Add multiple insurance",e.ADD_MULTIPLE_INSURANCE_ERROR="[Cart] Add multiple insurance (error)",e.ADD_MULTIPLE_INSURANCE_SUCCESS="[Cart] Add multiple insurance (success)",e.CHANGE_INSURANCE_MSISDN="[Cart] Change insurance msisdn",e.CHANGE_INSURANCE_MSISDN_ERROR="[Cart] Change insurance msisdn (error)",e.CHANGE_INSURANCE_MSISDN_SUCCESS="[Cart] Change insurance msisdn (success)",e.REMOVE_INSURANCE="[Cart] Remove insurance",e.REMOVE_INSURANCE_ERROR="[Cart] Remove insurance (error)",e.REMOVE_INSURANCE_SUCCESS="[Cart] Remove insurance (success)",e.NO_ACTION_INSURANCE="[Cart] No action insurance",e.UPGRADE_INSURANCE="[Cart] Upgrade insurance",e.UPGRADE_INSURANCE_ERROR="[Cart] Upgrade insurance (error)",e.UPGRADE_INSURANCE_SUCCESS="[Cart] Upgrade insurance (success)",e}(i||{}),pe=n(i.ADD_INSURANCE,o()),me=n(i.ADD_INSURANCE_ERROR,o()),Ie=n(i.ADD_INSURANCE_SUCCESS,o()),q=n(i.ADD_INSURANCE_PRODUCT,o()),Ee=n(i.ADD_INSURANCE_PRODUCT_ERROR,o()),ge=n(i.ADD_INSURANCE_PRODUCT_SUCCESS,o()),Ce=n(i.ADD_MULTIPLE_INSURANCE,o()),fe=n(i.ADD_MULTIPLE_INSURANCE_ERROR,o()),Re=n(i.ADD_MULTIPLE_INSURANCE_SUCCESS,o()),Ne=n(i.CHANGE_INSURANCE_MSISDN,o()),Ae=n(i.CHANGE_INSURANCE_MSISDN_ERROR,o()),Se=n(i.CHANGE_INSURANCE_MSISDN_SUCCESS,o()),_e=n(i.REMOVE_INSURANCE,o()),he=n(i.REMOVE_INSURANCE_ERROR,o()),De=n(i.REMOVE_INSURANCE_SUCCESS,o()),Oe=n(i.NO_ACTION_INSURANCE),Ue=n(i.UPGRADE_INSURANCE,o()),Pe=n(i.UPGRADE_INSURANCE_ERROR,o()),ve=n(i.UPGRADE_INSURANCE_SUCCESS,o());var ke=(()=>{class e{constructor(){this.apollo=m(M),this.store=m(b),this.httpClient=m(v),this.insuranceCategoryOfferingsUrl=T.getInsuranceCategoryApi(),this.REQUEST_TIMEOUT=3e4,this.RETRY_COUNT=2}saveUserAgreement(t,r){let a=w(r.gdprConsents);this.store.dispatch(y({insuranceTermsAgreed:t,isAbove16:r.isAbove16,hasPaymentCommitment:r.hasPaymentCommitment,keepIdCard:r.keepIdCard,gdprConsents:a,notificationChannel:r.notificationChannel}))}fetchCategoryOfferings(){return this.httpClient.get(this.insuranceCategoryOfferingsUrl,{withCredentials:!0,headers:{Accept:"application/json","Content-Type":"application/json"}}).pipe(f(this.REQUEST_TIMEOUT),R(this.RETRY_COUNT),U(this.handleError))}buildInsuranceProductDetailsRequest(t,r,a,c,s,g,d){return r||console.error("Active MSISDN is required to build the insurance product details request."),{deviceCategoryId:void 0,deviceImei:t===E.Custom?s:void 0,deviceOaCode:g,msisdn:r,orderId:d,productCategoryIds:a?[a]:[],tier:c}}getInsuranceProductCustomDetails(t){return this.apollo.use(L).query({query:B,variables:{request:t},errorPolicy:"all",fetchPolicy:"cache-first"}).pipe(f(this.REQUEST_TIMEOUT),R(this.RETRY_COUNT),O(({data:r,errors:a,loading:c})=>{if(a&&a.length>0)return{success:!1,errors:a.map(d=>({message:d.message,code:d.extensions?.code||"GRAPHQL_ERROR",field:d.path?.join(".")||void 0})),metadata:{requestId:this.generateRequestId(),timestamp:new Date().toISOString()}};let s=r?.getInsuranceProductCustomDetails;return s?{success:!0,data:{getInsuranceProductCustomDetails:s},metadata:{requestId:this.generateRequestId(),timestamp:new Date().toISOString()}}:{success:!1,errors:[{message:"No product details returned from server",code:"EMPTY_RESPONSE"}],metadata:{requestId:this.generateRequestId(),timestamp:new Date().toISOString()}}}))}processInsuranceProductDetails(t){if(!t)return{categoryMappedProducts:[],notSellableReason:null,isAvailable:!1,availableProducts:[]};let r=(t.categoryMappedProducts||[]).filter(s=>s!=null),a=r.filter(s=>s.state===A.CanBuy),c=t.notSellableReason||null;return{categoryMappedProducts:r,notSellableReason:c,isAvailable:a.length>0&&!c,availableProducts:a}}addInsurance(t,r,a,c,s){if(!r||!a){console.error("Missing required fields: selectedProduct, selectedItem, or activeMsisdn");return}let d=t===E.Custom?c:r.imei,C=r.options?.[0]?.insuranceId,_=s===p.Basic?N.Basic:N.Premium,h=this.getInsuranceTerm(),F=this.getProductDetails(r,d),z=r.displayName||"",$=G;if(!C){console.error("Missing insuranceId");return}let V={productDetails:F,term:h,insuranceId:C,insuranceType:_,msisdn:a};this.dispatchAddInsuranceProduct(V,z,$)}calculateLoggedInInsurableProduct(t,r){if(r===p.Basic){let a=t.options||[];return l(a)?.fee?.value||0}else{let a=t.options||[];return l(a)?.fee?.value||0}}calculateLoggedInItemPrice(t,r){if(r===p.Basic){let a=t.options?.BASIC||t.children?.find(s=>s?.options?.BASIC&&s.options.BASIC.length>0)?.options?.BASIC||[];return l(a)?.optionFee?.value||0}else{let a=t.options?.PREMIUM||t.children?.find(s=>s?.options?.PREMIUM&&s.options.PREMIUM.length>0)?.options?.PREMIUM||[];return l(a)?.optionFee?.value||0}}getCategoryMappedProducts(t,r,a){if(t&&Array.isArray(r)&&r.length>0&&Array.isArray(a)&&a.length>0)return[...r,...a];if(t&&Array.isArray(r)&&r.length>0&&Array.isArray(a)&&a.length===0)return[...r];if(Array.isArray(a)&&a.length>0)return a}getProductDetails(t,r){return{oaCode:t.oaCode||"",imei:r||"",categoryId:t.categoryId||1,thumbnail:t.imageHref||""}}getInsuranceTerm(t=x.Months,r=24){return{unit:t,value:r}}dispatchAddInsuranceProduct(t,r,a){this.store.dispatch(q({insurance:t,deviceName:r,deviceBrand:a}))}handleError(t){return t.status===0?console.error("An error occurred:",t.error):console.error(`Backend returned code ${t.status}, body was: `,t.error),D(()=>new Error("Something bad happened; please try again later."))}generateRequestId(){return`req_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275prov=P({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();export{A as a,p as b,j as c,J as d,K as e,E as f,pe as g,me as h,Ie as i,q as j,Ee as k,ge as l,Ce as m,fe as n,Re as o,Ne as p,Ae as q,Se as r,_e as s,he as t,De as u,Oe as v,Ue as w,Pe as x,ve as y,ue as z,G as A,ke as B};