PageSourceSearch

https://eshop.orange.eg/chunk-53.js

js orange.eg collected 2026-09-24 17:40:09 UTC 3,729 bytes, 1 lines download raw bytes

1import{u as m}from"./chunk-12.js";import{$c as r,Ga as u,a as n,b as s,ba as i,ga as l,va as c}from"./chunk-49.js";var h=class a{platformId=l(u);isBrowser=m(this.platformId);storageKey="orange_order_context";maxAge=1440*60*1e3;orderContextSignal=c(null);orderContext=r(()=>this.orderContextSignal());selectedAddressId=r(()=>this.orderContext()?.selectedAddressId??null);selectedPaymentMethod=r(()=>this.orderContext()?.selectedPaymentMethod??null);shippingMethod=r(()=>this.orderContext()?.shippingMethod??null);orderId=r(()=>this.orderContext()?.orderId??null);orderNumber=r(()=>this.orderContext()?.orderNumber??null);hasSelectedAddress=r(()=>{let e=this.selectedAddressId();return e!==null&&e>0});canProceedToPayment=r(()=>this.hasSelectedAddress());canProceedToConfirmation=r(()=>{let e=this.orderContext();return e&&e.selectedAddressId&&e.selectedAddressId>0});selectedPaymentRoute=r(()=>this.orderContext()?.selectedPaymentRoute??null);constructor(){this.loadFromStorage()}updateSelectedAddress(e){let t=this.orderContextSignal()||this.createDefaultContext(),o=s(n({},t),{selectedAddressId:e,timestamp:Date.now()});this.orderContextSignal.set(o),this.saveToStorage(o)}updatePaymentMethod(e,t){let o=this.orderContextSignal()||this.createDefaultContext(),d=s(n({},o),{selectedPaymentMethod:e,selectedPaymentRoute:t,timestamp:Date.now()});this.orderContextSignal.set(d),this.saveToStorage(d)}updateShippingMethod(e){let t=this.orderContextSignal()||this.createDefaultContext(),o=s(n({},t),{shippingMethod:e,timestamp:Date.now()});this.orderContextSignal.set(o),this.saveToStorage(o)}updateOrderId(e,t){let o=this.orderContextSignal()||this.createDefaultContext(),d=s(n({},o),{orderId:e,orderNumber:t||null,timestamp:Date.now()});this.orderContextSignal.set(d),this.saveToStorage(d)}setOrderContext(e){this.orderContextSignal.set(e)}clearOrderContext(){this.orderContextSignal.set(null),this.removeFromStorage()}resetForNewOrder(){let e=this.orderContextSignal();if(e&&e.selectedAddressId){let t={selectedAddressId:e.selectedAddressId,selectedPaymentMethod:null,selectedPaymentRoute:null,shippingMethod:null,orderId:0,orderNumber:null,timestamp:Date.now()};this.orderContextSignal.set(t),this.saveToStorage(t)}else this.clearOrderContext()}buildCheckoutRequest(e=!0){let t=this.orderContext();return!t||!t.selectedAddressId||t.selectedAddressId<=0?null:{ShippingAddressId:t.selectedAddressId,ShippingMethod:t.shippingMethod||"Standard Delivery",PaymentMethod:t.selectedPaymentMethod||"Credit Card",TermsAccepted:e,UseSpecialPoints:!1,VoucherCode:"",PromoCode:""}}isContextComplete(){let e=this.orderContext();return!!(e&&e.selectedAddressId&&e.selectedPaymentMethod&&e.shippingMethod)}getContextSummary(){let e=this.orderContext();return{hasAddress:!!(e&&(e.selectedAddressId??0)>0),hasPayment:!!(e&&e.selectedPaymentMethod),hasShipping:!!(e&&e.shippingMethod),totalAmount:e?.totalAmount||0}}loadFromStorage(){if(this.isBrowser)try{let e=localStorage.getItem(this.storageKey);if(!e)return;let t=JSON.parse(e);if(this.isContextExpired(t)){this.removeFromStorage();return}this.orderContextSignal.set(t)}catch{this.removeFromStorage()}}saveToStorage(e){if(this.isBrowser)try{localStorage.setItem(this.storageKey,JSON.stringify(e))}catch{}}removeFromStorage(){if(this.isBrowser)try{localStorage.removeItem(this.storageKey)}catch{}}isContextExpired(e){return e.timestamp?Date.now()-e.timestamp>this.maxAge:!0}
1createDefaultContext(){return{selectedAddressId:null,selectedPaymentMethod:null,selectedPaymentRoute:null,shippingMethod:null,orderId:0,orderNumber:null,timestamp:Date.now(),totalAmount:0}}static \u0275fac=function(t){return new(t||a)};static \u0275prov=i({token:a,factory:a.\u0275fac,providedIn:"root"})};export{h as a};

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.