1import{a as e}from"./Tg6eheFi.js";import{g as t}from"./Ib1jYPSS.js";import{f as n}from"./DUcVQHuF.js";import"./ClewNHwF.js";import{t as r}from"./BWvQhbqt.js";import{t as i}from"./vv-wU3_Y.js";import{n as a}from"./CZ4bUvnS.js";import{t as o}from"./DLqxzgY32.js";import{T as s,t as c}from"./KLtl_-8s2.js";import{_ as l,c as u,s as d}from"./QyStSQlT2.js";import{t as f}from"./CX5zRWfG2.js";import{t as p}from"./Cr5PyoVC.js";import{t as m}from"./BOLi7ScJ.js";function h(){let e=window.location.host.split(`.`)[0];return{isExternalBuy:t(()=>e.includes(`externalbuy`))}}function g({orderId:e,revenue:t,subscriptionType:n,nonSubscribableType:r,formulaCode:i,quantity:a=1,name:s}){let c={ecommerce:`purchase`,event:`ecommerce`,name:s,quantity:a,price:t,transactionId:e,variant:i};r&&(c.nonSubscribableType=r),n&&(c.subscriptionType=n),o(c)}function _({proposition:e}){g({name:`${e.included.product.title} - ${e.formula.label} - ${s(e.duration)}`,orderId:`${e.uuid}-${Date.now()}`,revenue:e.duration.price,subscriptionType:e.type,formulaCode:e.formula.code})}function v(e){let t={};return e?.forEach(e=>{e.value&&e.flavour&&(t[e.flavour]=e.value)}),t}function y(e){let t=n(),{selectedProposition:r}=c(),{currentSubscription:i}=f(),{brandIsMagazine:a,brandLocale:o}=m();if(!r.value)throw Error(`No proposition selected`);if(!i.value?.subscription.idEncrypted)throw Error(`No currentSubscription.value.subscription.id_encrypted`);if(a.value&&!i.value?.subscription.subsId)throw Error(`No currentSubscription.value.subscription.subs_id`);if(typeof e.email!=`string`)throw TypeError(`No payload.email`);let s=i.value.customer;return d({customer:{gender:e.gender?.toUpperCase()||s.sex||`U`,initials:s.initials??null,middleName:e.middleName||null,firstName:e.firstName||s.firstName,lastName:e.lastName||s.lastName,email:e.email,phone:(e.phone??s.phone)||null,address:{countryCode:o.value.replace(`-formal`,``),street:(e.address?.street??s.address?.street)||null,town:(e.address?.city??s.address?.town)||null,zipCode:(e.address?.postalCode??s.address?.zipCode)||null,houseNumber:(e.address?.houseNumber??s.address?.houseNumber)||null,houseNumberAdd:(e.address?.houseNumberAddition??s.address?.houseNumberAdd)||null},iban:e.iban||null,ibanEncrypted:null},flavours:v(e.consentQuestions),subscriptionIdEncrypted:i.value.subscription.idEncrypted,subsId:i.value.subscription.subsId,title:r.value.included.brand.code,propositionUuid:r.value.uuid,offerNumber:null,touchpointUrl:window.location.origin+t.path,currentPropositionType:i.value.subscription.propositionType,currentPropositionFormula:i.value.subscription.propositionFormula,currentPropositionDiscountType:i.value.subscription.discountType})}function b(){let o=r(`subscriptionStartDate`,()=>``),{selectedProposition:s}=c(),{userinfo:d}=i(),{lead:f}=p(),{isExternalBuy:m}=h(),g=n(),{$logger:v}=e(),b=r(`checkoutMetadata`),x=r(`touchpointUrl`);async function S(e){try{let t=await u(e);b.value=t}catch(e){v.log({error:e,title:`Error fetching proposition checkout data [fetchCheckoutMetadata]`})}}let C=t(()=>b.value?.consents),w=t(()=>b.value?.contractDocuments),T=t(()=>b.value?.newsletter),E=t(()=>b.value?.startDates),D=t(()=>m.value?{...g.query,otag:`u73xpb`,utm_medium:`paygate`,utm_content:`digitale-krant-app`,productCode:s.value?.premiumCode,productType:s.value?.premiumCode,propositionId:s.value?.uuid}:g.query);function O(e){if(e===void 0)return;let t=e.toUpperCase();if(t===`F`||t===`M`||t===`U`)return t}async function k(e){if(!s.value)throw Error(`No proposition selected`);let t=(e.consentQuestions??[]).map(e=>({flavour:e.flavour,value:e.value??!0}));o.value=typeof e.date==`string`?e.date:``,delete e.date,delete e.consentQuestions;let n=e.differentAddress,r=e.differentAddress?.active;n&&delete n.disabled;let{queryAsString:i,partnerToken:c}=a(),u={address:{...e.address,firstName:e.firstName,lastName:e.lastName,email:e.email,gender:O(e.gender)??`U`,middleName:e.middleName||null,phone:e.phone||null,dateOfBirth:e.dateOfBirth||null},shippingAddress:r?{city:n.city,email:n.email,firstName:n.firstName,lastName:n.lastName,postalCode:n.postalCode,houseNumber:n.houseNumber,street:n.street,gender:`U`,houseNumberAddition:n.houseNumberAddition||null,middleName:n.middleName||null,phone:n.phone||null}:void 0,consents:t,url:{location:{ancestorOrigins:null,hash:window.location.hash||null,host:window.location.host||null,hostname:window.location.hostname||null,href:window.location.href||null,origin:window.location.origin||null,pathname:window.location.pathname||null,port:window.location.port||null,protocol:window.location.protocol||null,search:window.location.search||null},referrer:{currentVirtualReferrer:window.currentVirtualReferrer||null,previousVirtualPageUrl:window.previousVirtualPageUrl||null},search:D.value??null},touchPointUrl:x.value??`${window?.location?.origin}${window?.location?.pathname}`,startingDate:o.value||null,otag:i(D.value.otag),propositionUuid:s.value.uuid,snowplow:{steps:{description:`checkout-complete`,number:`5`}},iban:e.iban||null,ibanMasked:e.ibanMasked||null,consentAdult:null,consentStudent:null,promotionalCode:e.promotionalCode??void 0,password:e.password??null,accountId:d.value?.sub??null,parentLeadUuid:f.value?.leadI
1d??null,partnerToken:c.value??null,partnerId:c.value?`ORANGE`:null},p=await l(u);return _({proposition:s.value}),p}function A(e,{useStopStart:t=!1}={}){return t?y(e):k(e)}return{consents:C,contractDocuments:w,newsletter:T,startDates:E,subscribe:k,checkout:A,fetchCheckoutMetadata:S}}export{b as t}; 2//# sourceMappingURL=F33CICOe.js.map
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.