1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7523],{57181:(e,t,r)=>{let a,n,i,o;r.r(t),r.d(t,{ShoppingUI:()=>ia,ShoppingUIClaim:()=>io,ShoppingUIStandalone:()=>ii});var s=r(37876),l=r(18056),d=r(81389),c=r(30478),u=r(45579),m=r(10397),p=r(14232),f=r(29454),h=r(4241),g=r(60863),b=r(54740),y=r(70864),x=r(87485),v=r(96038),_=r(92748),j=r(86480),S=r(72051),E=r(65168),I=r(52489),k=r(24989),N=r(48539),D=r(48167),P=r(88992),w=r(33981),C=r(64577),L=r(31672),O=r(1334),T=r(7894),A=r(64271),M=r(79884),$=r(46986),F=r(33404),K=r(93205),R=r(98011),V=r(39742),B=r(81256),U=r(16494),W=Object.create,G=Object.defineProperty,z=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyNames,q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,Z=((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,n=H(t),i=0,o=n.length;i<o;i++)a=n[i],Y.call(e,a)||void 0===a||G(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(r=z(t,a))||r.enumerable});return e})(G(null==(i=(a=(e,t)=>{var r={}.hasOwnProperty;function a(){for(var e="",t=0;t<arguments.length;t++){var i=arguments[t];i&&(e=n(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var i in e)r.call(e,i)&&e[i]&&(t=n(t,i));return t}(i)))}return e}function n(e,t){return t?e?e+" "+t:e+t:e}void 0!==t&&t.exports?(a.default=a,t.exports=a):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return a}):window.classNames=a},()=>(n||(a((n={exports:{}}).exports,n),a=null),n.exports))())?{}:W(q(i)),"default",{value:i,enumerable:!0}),i),J=(o={},[{general_error:{title:"Valitettavasti jotain meni vikaan",description:"Tilauslomakkeen lataamisessa tapahtui virhe. Kokeile my\xf6hemmin uudelleen."}},{campaign_ended_error:{title:"Tarjous on p\xe4\xe4ttynyt",description:"Valitettavasti t\xe4m\xe4 tarjous on p\xe4\xe4ttynyt. Voit katsoa ajankohtaiset tarjoukset ja muut tilausvaihtoehtomme alta."}}].forEach(e=>{let t=Object.keys(e)[0],{title:r,description:a}=e[t];o[t]={title:r,description:{json:{type:"document",content:[{type:"paragraph",content:[{paragraph:a,type:"text"}]}]}}}}),o),Q="SET_DICTIONARY",X="SET_ERROR_DICTIONARY",ee=(e,t)=>{if(t.type===Q)return{...e,buttonLabel:t.payload.buttonLabel,confirmation:t.payload.confirmation,errorMessages:t.payload.errorMessages,formErrors:t.payload.formErrors,login:t.payload.login,tabLabel:t.payload.tabLabel,formSectionTitle:t.payload.formSectionTitle,subscriptionKindLabels:t.payload.subscriptionKindLabels,orderConfirmDesc:t.payload.orderConfirmDesc,orderInfoTitle:t.payload.orderInfoTitle,misc:t.payload.misc,paragraph:t.payload.paragraph,customerFormLabel:t.payload.customerFormLabel,paymentTypeDesc:t.payload.paymentTypeDesc,paymentTypeLabel:t.payload.paymentTypeLabel,infoHighlights:t.payload.infoHighlights,legal:t.payload.legal,links:t.payload.links,altOrders:t.payload.altOrders,defaultOfferDescription:t.payload.defaultOfferDescription,defaultCycloneDescription:t.payload.defaultCycloneDescription};if(t.type===X)return{...e,errorMessages:t.payload.errorMessages,buttonLabel:t.payload.buttonLabel};throw Error("Unknown dictionary reducer action")},et={label:""},er={paragraph:{json:{}}},ea={url:"string",externalLink:!1},en={buttonLabel:{initialDictionaryObject:et},confirmation:{initialDictionaryParagraph:er},errorMessages:J,formErrors:{initialDictionaryObject:et},login:{initialDictionaryObject:et},tabLabel:{initialDictionaryObject:et},formSectionTitle:{initialDictionaryObject:et},subscriptionKindLabels:{initialDictionaryObject:et},orderInfoTitle:{initialDictionaryObject:et},misc:{initialDictionaryObject:et},paragraph:{initialDictionaryObject:et},customerFormLabel:{initialDictionaryObject:et},orderConfirmDesc:{initialDictionaryObject:et},paymentTypeDesc:{initialDictionaryParagraph:er},paymentTypeLabel:{initialDictionaryObject:et},infoHighlights:{initialDictionaryObject:et},legal:{initialDictionaryParagraph:er},links:{initialDictionaryLink:ea},altOrders:{initialDictionaryParagraph:er},defaultOfferDescription:{json:{}},defaultCycloneDescription:{json:{}}},ei=(0,p.createContext)(void 0),eo=({children:e})=>{let[t,r]=(0,p.useReducer)(ee,en),a=(0,p.useMemo)(()=>({store:t,dispatch:r}),[t,r]);return(0,s.jsx)(ei.Provider,{value:a,children:e})},es=()=>{let e=(0,p.useContext)(ei);if(void 0===e)throw Error("useDictionary must be used within a DictionaryProvider");return{...e}},el="SET_MODAL_ERROR",ed="SET_VIEW_ERROR",ec=(e,t)=>{switch(t.type){case el:return{...e,modalError:t.modalError};case ed:return{...e,viewError:t.viewError};default:throw Error("Unknown error reducer action")}},eu={modalError:null,viewError:null},em=(0,p.createContext)(void 0),ep=({children:e})=>{let[t,r]=(0,p.useReducer)(ec,{...eu}),a=(0,p.useMemo)(()=>({store:t,dispatch:r}),[t,r]);return(0,s.jsx)(em.Provider,{value:a,children:e})},ef=()=>{let e=(0,p.useContext)(em);if(void 0===e)throw Error("useErrors must be used within a ErrorProvider");return e},eh="SET_SAMPLE_DICTIONARY",eg=(e,t)=>{if(t.type===eh)return{...e,customerFormLabel:t.payload.customerFormLabel,sampleC
1onfirmation:t.payload.sampleConfirmation,sampleProduct:t.payload.sampleProduct,sampleLabels:t.payload.sampleLabels,sampleButtons:t.payload.sampleButtons,sampleMisc:t.payload.sampleMisc,login:t.payload.login,sampleFormErrors:t.payload.sampleFormErrors,sampleParagraphs:t.payload.sampleParagraphs,sampleLegal:t.payload.sampleLegal,errorMessages:t.payload.errorMessages,links:t.payload.links};throw Error("Unknown sample dictionary reducer action")},eb={customerFormLabel:{initialDictionaryObject:et},sampleConfirmation:{initialDictionaryObject:et},sampleProduct:{initialDictionaryObject:et},sampleLabels:{initialDictionaryObject:et},sampleButtons:{initialDictionaryObject:et},sampleMisc:{initialDictionaryObject:et},sampleFormErrors:{initialDictionaryObject:et},sampleParagraphs:{initialDictionaryParagraph:er},sampleLegal:{initialDictionaryParagraph:er},login:{initialDictionaryObject:et},errorMessages:J,links:{initialDictionaryLink:ea}},ey=(0,p.createContext)(void 0),ex=({children:e})=>{let[t,r]=(0,p.useReducer)(eg,eb),a=(0,p.useMemo)(()=>({store:t,dispatch:r}),[t,r]);return(0,s.jsx)(ey.Provider,{value:a,children:e})},ev=()=>{let e=(0,p.useContext)(ey);if(void 0===e)throw Error("useSampleDictionary must be used within a SampleDictionaryProvider");return{...e}},e_={al:"al",hs:"hs",is:"is",jan:"jan",js:"js",kmv:"kmv",ks:"ks",mk:"mk",nu:"nu",rks:"rks",sk:"sk",ss:"ss",suk:"suk",tyr:"tyr",vs:"vs"},ej={al:"aamulehti",hs:"hs",is:"is",jan:"janakkalansanomat",js:"jamsanseutu",kmv:"kmvlehti",ks:"kankaanpaanseutu",mk:"merikarvialehti",nu:"nokianuutiset",rks:"rannikkoseutu",sk:"satakunnankansa",ss:"sydansatakunta",suk:"suurkeuruu",tyr:"tyrvaansanomat",vs:"valkeakoskensanomat"},eS={al:"Aamulehti",hs:"Helsingin Sanomat",is:"Ilta-Sanomat",jan:"Janakkalan Sanomat",js:"J\xe4ms\xe4n Seutu",kmv:"KMV-lehti",ks:"Kankaanp\xe4\xe4n Seutu",mk:"Merikarvia-lehti",nu:"Nokian Uutiset",rks:"Rannikkoseutu",sk:"Satakunnan Kansa",ss:"Syd\xe4n-Satakunta",suk:"Suur-Keuruu",tyr:"Tyrv\xe4\xe4n Sanomat",vs:"Valkeakosken Sanomat"},eE=[];for(let e=0;e<256;++e)eE.push((e+256).toString(16).slice(1));var eI=new Uint8Array(16);function ek(e,t,r){return t||e||!crypto.randomUUID?function(e,t,r){let a=(e||={}).random??e.rng?.()??crypto.getRandomValues(eI);if(a.length<16)throw Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r||=0)<0||r+16>t.length)throw RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e,t=0){return(eE[e[t+0]]+eE[e[t+1]]+eE[e[t+2]]+eE[e[t+3]]+"-"+eE[e[t+4]]+eE[e[t+5]]+"-"+eE[e[t+6]]+eE[e[t+7]]+"-"+eE[e[t+8]]+eE[e[t+9]]+"-"+eE[e[t+10]]+eE[e[t+11]]+eE[e[t+12]]+eE[e[t+13]]+eE[e[t+14]]+eE[e[t+15]]).toLowerCase()}(a)}(e,t,r):crypto.randomUUID()}var eN=e=>Object.entries(e).map(([e,t])=>{if(null!=t)return[e,t].map(encodeURIComponent).join("=")}).filter(e=>!!e).join("&"),eD=async e=>{try{let t=e.headers.get("Content-Type");return t&&t.toLowerCase().startsWith("application/json")?await e.json():await e.text()}catch(e){console.error(e)}return null},eP=async(e,t,r)=>{let a={method:e.method,headers:{...e.headers,...r&&{"SNDP-Authorization":r}},body:(e=>{if(e.formData){var t;let r;return t=e.formData,r=new FormData,Object.keys(t).forEach(e=>{let a=t[e];null!=a&&("string"==typeof a||a instanceof Blob)&&r.append(e,a)}),r}if(e.body)return"string"==typeof e.body||e.body instanceof Blob?e.body:JSON.stringify(e.body)})(e)},n=await fetch(t,a),i=e.retries??0;return n.status>=500&&i>0?eP({...e,retries:i-1},t,r):n},ew=class e extends Error{knownErrorCode=void 0;body=void 0;constructor(t,r,a){super(t),this.knownErrorCode=r,this.body=a,Object.setPrototypeOf(this,e.prototype)}},eC=async(e,t,r,a)=>{let n,i,o=(n=e.path.replaceAll(":","_"),i=`${"local"===r?"http://localhost:3001":`https://api${"prod"===r?"":"-"+r}.sanoma-sndp.fi`}/shopping-api/v1/${t}${n}`,e.query?`${i}?${eN(e.query)}`:i),s=await eP(e,o,a&&await a()),l=await eD(s),d=((e,t)=>{if(t){let r=e.headers.get(t);if("string"==typeof r)return r}return null})(s,e.responseHeader),c={url:o,ok:s.ok,status:s.status,statusText:s.statusText,body:d??l};return(e=>{let t;if(e.ok)return;if("object"!=typeof e.body||null===e.body)throw Error("Unknown error");
1let{message:r,knownErrorCode:a}=e.body;throw"string"==typeof r?(t=Object.values(m.LW),"string"==typeof a&&t.includes(a))?new ew(r,a,e.body):new ew(r):Error("Unknown error")})(c),c},eL=e=>(e=Number(e))>0?e-1:0,eO=e=>e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`),eT=/^[- a-zA-ZåäöÃ
ÃÃÃüÃéÃà ÃèÃùÃâÃêÃîÃôÃûÃëÃïÃüÃÿŸçÃÅÅæÃñÃãÃõÃøÃ']+$/,eA=/^[- a-zA-ZåäöÃ
ÃÃÃüÃéÃà ÃèÃùÃâÃêÃîÃôÃûÃëÃïÃüÃÿŸçÃÅÅæÃñÃãÃõÃøÃ/'\d.]+$/,eM=/^\+[1-9]\d{6,16}$/,e$=()=>{let e=new Date;return`${e.getDate()}.${e.getMonth()+1}.${e.getFullYear()}`},eF=(e,t,r,a)=>{let n=new URLSearchParams(window.location.search),i="true"===n.get("cop"),o=n.get("platform"),s=new URLSearchParams({...t&&{aid:t},...r&&{offer:r},...a&&{redirectPath:a},...i&&{cop:"true"},...o&&{platform:o}}).toString();return`${window.location.origin}/tilaus/${e}/kiitos${s?`?${s}`:""}`},eK=e=>e.toISOString().split("T")[0],eR=e=>0===e?`${e}`:e.toFixed(2).replace(".",","),eV=e=>"kk"==e.unit?e.amount>1?"kuukautta":"kuukausi":e.unit,eB=e=>`${e.amount} ${e.unit}`,eU=e=>e.packagePrice.priceWithVat/e.periodLength.amount,eW=e=>{let t="periodExtraLength"in e?e.periodExtraLength:void 0;if(t&&t.unit!==e.periodLength.unit)throw Error("Extra length unit does not match period unit");return t?t.amount:0},eG=e=>e.periodLength.amount+eW(e),ez=e=>{let t=e.periodLength.amount*e.periodCount,r=eW(e);return`${t}${r?`+${r}`:""} ${e.periodLength.unit}`},eH=e=>{e&&window.scrollTo({behavior:"smooth",top:e.getBoundingClientRect().top-document.body.getBoundingClientRect().top-75})},eq=e=>e?.accountIdEncoded!==void 0,eY=e=>eT.test(e)?e:"-",eZ=e=>e&&{...e,firstName:void 0===e.firstName?void 0:eY(e.firstName.trim()),lastName:void 0===e.lastName?void 0:eY(e.lastName.trim())},eJ=e=>e.packagePrice.priceWithVat/eG(e)*12/52;m.CO.WaitForShogun;var eQ="2024-09-30.2024-10-01.2024-10-02.2024-10-03.2024-10-04.2024-10-05.2024-10-06.2024-10-07.2024-10-08.2024-10-09.2024-10-10.2024-10-11.2024-10-12.2024-10-13.2024-10-14.2024-10-15.2024-10-16.2024-10-17.2024-10-18.2024-10-19.2024-10-20.2024-10-21.2024-10-22.2024-10-23.2024-10-24.2024-10-25.2024-10-26.2024-10-27.2024-10-28.2024-10-29.2024-10-30".split(".");Object.values(e_).reduce((e,t)=>({...e,[t]:[]}),{}),m.Ew.Recurring,m.Dm.Cheap,m.Ew.Recurring,m.Dm.Cheap,m.Ew.Recurring,m.Dm.Cheap,m.Ew.Recurring,m.Dm.Cheap,m.Ew.Fixed,m.Dm.Cheap;var eX=[{index:0,id:"selector-0",checked:!0,offer:{offerId:"O-85PZM95",productId:"K-HS_DI",pricing:{priceSteps:[{product:{productId:"K-HS_DI",productName:"HS Digi"},packagePrice:{priceWithVat:0,priceWithoutVat:0},startDate:"2023-06-20",endDate:"2023-07-20",periodCount:1,periodLength:{unit:"kk",amount:1},discountPercent:100,normalPricing:!1}],recurringPrice:{product:{productId:"K-HS_DI",productName:"HS Digi"},packagePrice:{priceWithVat:19.5,priceWithoutVat:17.7,vat:[{percent:10,amount:1.77}]},startDate:"2023-06-20",periodLength:{unit:"kk",amount:1},discountPercent:0,normalPricing:!1}},publicationDays:eQ,subscriptionKind:m.Ew.Recurring,subscriptionMode:m.Dm.Cheap}},{index:1,id:"selector-1",checked:!1,offer:{offerId:"O-VDM6DK9",productId:"K-HS_DI",pricing:{priceSteps:[{product:{productId:"K-HS_DI",productName:"HS Digi"},packagePrice:{priceWithVat:41.7,priceWithoutVat:37.9,vat:[{percent:10,amount:3.79}]},startDate:"2023-06-20",endDate:"2023-07-20",periodCount:1,periodLength:{unit:"kk",amount:3},discountPercent:0,normalPricing:!1}],recurringPrice:{product:{productId:"K-HS_DI",productName:"HS Digi"},packagePrice:{priceWithVat:58.5,priceWithoutVat:53.2,vat:[{percent:10,amount:5.32}]},startDate:"2023-06-20",periodLength:{unit:"kk",amount:3},discountPercent:0,normalPricing:!0}},publicationDays:eQ,subscriptionKind:m.Ew.Recurring,subscriptionMode:m.Dm.Cheap}},{index:2,id:"selector-2",checked:!1,offer:{offerId:"O-5R748KL",productId:"K-HS_DI",pricing:{priceSteps:[{product:{productId:"K-HS_DI",productName:"HS Digi"},packagePrice:{priceWithVat:83.4,priceWithoutVat:75.82,vat:[{percent:10,amount:7.58}]},startDate:"2023-06-20",endDate:"2023-07-20",periodCount:1,periodLength:{unit:"kk",amount:6},discountPercent:0,normalPricing:!1}],recurringPrice:{product:{productId:"K-HS_DI",productName:"HS Digi"},packagePrice:{priceWithVat:117,priceWithoutVat:106.36,vat:[{percent:10,amount:10.64}]},startDate:"2023-06-20",periodLength:{unit:"kk",amount:6},discountPercent:0,normalPricing:!0}},publicationDays:eQ,subscriptionKind:m.Ew.Recurring,subscriptionMode:m.Dm.Paid},...void 0}];m.Ew.Recurring,m.Dm.Cheap,m.Ew.Recurring,m.Dm.Cheap,eX[0].offer.pricing.priceSteps,m.$f.Credit,m.Ew.Recurring,m.Dm.Cheap;var e0={paymentMethodId:"MOCK-ID-INVOICE-EMAIL",paymentType:m.$f.EmailInvoice},e1={paymentMethodId:"MOCK-ID-INVOICE-LETTER",paymentType:m.$f.LetterInvoice,extraCh
1arge:999999},e2={paymentMethodId:"MOCK-ID-E-INVOICE",paymentType:m.$f.EInvoice,eInvoiceProviders:[{code:"e-mock",name:"MockedEInvoiceBank",description:"Mocked e-invoice bank description"}]},e4={selectedSelector:{id:"mock-selector-id",checked:!0,offer:{offerId:"MOCK_OFFER_ID",productId:"MOCK_PRODUCT_ID",pricing:{priceSteps:eX[0].offer.pricing.priceSteps},paymentMethods:[{paymentMethodId:"MOCK-ID-BANK",paymentType:m.$f.Bank,bankProviders:[{providerCode:"p-mock",name:"MockedProvider"}],recurringPaymentMethods:[e0,e1]},{paymentMethodId:"MOCK-ID-CREDIT",paymentType:m.$f.Credit},e2,e0,e1],publicationDays:eQ,subscriptionKind:m.Ew.Recurring,subscriptionMode:m.Dm.Cheap}}};e4.selectedSelector,e4.selectedSelector.offer,e4.selectedSelector.offer.paymentMethods.map(e=>{let{bankProviders:t,...r}=e;return r}),e4.selectedSelector,e4.selectedSelector.offer,e4.selectedSelector.offer.paymentMethods.map(e=>{let{recurringPaymentMethods:t,...r}=e;return r}),ek(),ek();var e6=(e={})=>({label:"",...e}),e3=(e={})=>({paragraph:{json:{}},...e}),e8=({title:e,description:t}={})=>({description:{json:{type:"document",content:[{type:"paragraph",content:[{paragraph:t,type:"text"}]}]}},title:e}),e5=(e={})=>({url:ek(),externalLink:!1,...e});e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e8(),e8(),e8(),e8(),e8(),e8(),e8(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6({label:"Fake invoice letter description"}),e6({label:"Fake VAT description"}),e6(),e6(),e6(),e6({label:"Card ends with"}),e6({label:"Mock label for order payment amount"}),e6({label:"Card expiration"}),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e3(),e3(),e6({label:"bank"}),e6({label:"credit"}),e6({label:"invoice"}),e6({label:"email_invoice"}),e6({label:"letter_invoice"}),e6({label:"e_invoice"}),e6({label:"Fake e-invoice confirm description"}),e6(),e6(),e6({label:"Fake age verification relogin error"}),e6({label:"Fake age verification retry error"}),e3(),e3(),e3(),e3(),e5(),e5(),e5(),e5(),e5(),e5(),e3(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e6(),e3(),e3(),e3(),e3(),e3();var e7=(e,t={})=>({ctaText:ek(),ctaUrl:ek(),subscriptionMode:e,message:ek(),...t}),e9=[e7(m.SC.Cheap),e7(m.SC.Active90)],te=((e={})=>({url:ek(),externalLink:!1,key:ek(),...e}))({url:"https://fake.url",key:"fake-link-key",label:"Fake link label"}),tt={productId:"K-HS_DI",productType:m.ch.DigiOnly,descriptionTitle:"HS Digi+",descriptionList:["Kaikki Hesarin jutut digitaalisessa muodossa","Digitaalisen p\xe4iv\xe4n lehden ja n\xe4k\xf6islehdet","Lukuoikeuden jaon Hesarin sis\xe4lt\xf6ihin kolmelle perheenj\xe4senelle"],offerUsedErrors:e9,readMoreHeader:"Kaikki palvelut",productPurchaseNotAllowedError:{entryTitle:"Fake title when product purchase is not allowed",errorMessage:(({value:e,type:t="text",key:r="paragraph",secondKey:a,secondValue:n})=>({json:{content:[{type:"paragraph",content:[{type:t,[r]:e,[a]:n}]}]}}))({value:"Fake message when product purchase is not allowed"}),ctaLink:te,...void 0},readMoreContent:[{heading:"Uutismediat:",body:{json:{type:"document",content:[{type:"paragraph",content:[{paragraph:"HS Digi+, IS Extra+, Aamulehti Digi+ etc.",type:"text"}]}]}}}]};m.$f.EmailInvoice,m.Ew.Sample,m.Dm.Sample,m.$f.LetterInvoice,((e={})=>({subscriptionKind:m.Ew.Recurring,subscriptionMode:m.Dm.Cheap,pricing:{priceSteps:[{product:{productId:"K-HS_DI",productName:"HS Digi"},packagePrice:{priceWithVat:0,priceWithoutVat:0,vat:[{percent:10,amount:0}]},startDate:"2023-06-20",endDate:"2023-07-20",periodCount:1,periodLength:{unit:"kk",amount:1},discountPercent:0,normalPricing:!1}],recurringPrice:{product:{productId:"K-HS_DI",productName:"HS Digi"},packagePrice:{priceWithVat:19.5,priceWithoutVat:17.7,vat:[{percent:10,amount:1.77}]},startDate:"2023-06-20",periodLength:{unit:"kk",amount:1},discountPercent:0,normalPricing:!0}},...e}
1))(),m.Ew.Recurring,m.Dm.Cheap,m.Ew.Recurring,m.Dm.Paid,m.$f.Credit,m.Ew.Fixed,m.Dm.Paid;var tr="customerTab",ta="giftTab",tn="companyTab",ti="ADD_ACCOUNT_DETAILS",to="ADD_ACCOUNT_TYPE",ts="ADD_CAMPAIGN_DATA",tl="ADD_SAMPLE_SUCCESSFUL_ORDER_ID",td="ADD_PRE_SELECTED_OFFER",tc="ADD_QUALIFYING_SUBSCRIPTION",tu="SET_INITIAL_MODULAR_OFFER_SELECTORS",tm="SET_ORDER_CONFIRMATION_DATA",tp="SET_SELECTED_PRODUCT",tf="SET_SELECTED_TAB",th="SET_SELECTED_SELECTOR",tg="SET_SELECTORS",tb="SET_STRIPE_PAYMENT_METHOD",ty="SET_SUBSCRIPTION_KIND_STATE",tx=(e,t)=>{switch(t.type){case ti:return{...e,userProfile:t.userProfile};case to:return{...e,accountType:t.accountType};case ts:return{...e,campaignData:t.campaignData};case tl:return{...e,sampleSuccessfulOrderId:t.orderId};case td:return{...e,preSelectedOffer:t.preSelectedOffer};case tp:return{...e,selectedProduct:t.selectedProduct};case tc:return{...e,qualifyingSubscription:t.qualifyingSubscription};case tm:return{...e,orderConfirmationData:t.orderConfirmationData};case tf:return{...e,selectedTab:t.selectedTab};case th:return{...e,selectedSelector:t.selectedSelector};case tg:return{...e,selectors:t.selectors,initialModularOfferSelectors:void 0};case tu:return{...e,initialModularOfferSelectors:t.selectors};case tb:return{...e,stripePaymentMethod:t.stripePaymentMethod};case ty:return{...e,subscriptionKindState:t.subscriptionKindState};default:throw Error("Unknown action")}},tv={sampleSuccessfulOrderId:"",accountType:void 0,campaignData:void 0,selectedProduct:tt,selectedTab:tr,selectors:eX,selectedSelector:eX[0],qualifyingSubscription:void 0,generatedOrderId:Date.now().toString()},t_=(0,p.createContext)(void 0),tj=()=>{let e=(0,p.useContext)(t_);if(void 0===e)throw Error("useShoppingContext must be used within a ShoppingProvider");return e},tS=({children:e})=>{let[t,r]=(0,p.useReducer)(tx,tv),a=(0,p.useMemo)(()=>({store:t,dispatch:r}),[t,r]);return(0,s.jsx)(t_.Provider,{value:a,children:e})},tE=(0,p.createContext)(void 0),tI=({children:e,isStandalone:t,shoppingProps:r})=>{let a=(0,p.useMemo)(()=>({...r,isStandalone:t}),[r,t]);return(0,s.jsx)(tE.Provider,{value:a,children:e})},tk=()=>{let e=(0,p.useContext)(tE);if(void 0===e)throw Error("useShoppingProps must be used within a ShoppingPropsProvider");return e},tN=({className:e,dataAb:t,children:r})=>(0,s.jsx)("p",{className:(0,Z.default)({"text-nof-foreground-primary nof-ui-body-medium":!e},e),"data-ab":t,children:r}),tD=()=>(0,s.jsx)("br",{}),tP=(e,t)=>{if(!t)return null;let r=eU(t)*t.periodLength.amount-eU(e)*e.periodLength.amount;return 0===r?null:eR(r)},tw=({text:e,content:t,className:r,dataAb:a})=>{let{store:{userProfile:n,selectedSelector:i}}=tj(),o=i.offer,l=e=>{if(e&&"object"==typeof e){if(Array.isArray(e))return d(e);if("type"in e&&"content"in e)switch(e.type){case"paragraph":return c(e.content);case"unorderedList":return p(e.content)}return null}},d=e=>e.map(e=>l(e)).filter(e=>!!e),c=(e,t)=>(0,s.jsx)(tN,{className:void 0===t?r:"",dataAb:a,children:e.map(e=>{switch(e.type){case"text":{let t=e.paragraph.split("\n"),r=[];return t.forEach((a,n)=>{r.push((0,s.jsx)("span",{children:a},`${ek()}_${e.type}`)),n!==t.length-1&&r.push((0,s.jsx)(tD,{},`${ek()}_lb`))}),r}case"internalLink":{let t=new URL(window.location.href).hostname!==new URL(e.href,window.location.href).hostname;return(0,s.jsx)(u.b,{text:e.label,href:e.href,external:t},`${ek()}_${e.type}`)}case"inlineEntry":{let r=o.pricing.priceSteps[t??0],a=o.pricing.recurringPrice;return(0,s.jsx)("span",{children:m(e,n,r,a)},`${ek()}_${e.type}`)}case"lineBreak":return(0,s.jsx)(tD,{},`${ek()}_lb`);default:return null}})},ek()),m=(e,t,r,a)=>{switch(e.dynamicValue){case"account_email":return t.email;case"account_firstname":return t.firstName;case"account_surname":return t.lastName;case"offer_length":{let e=a??r;return e?eB(e.periodLength):null}case"offer_amount":return a?eR(a.packagePrice.priceWithVat):null;case"offer_discount_amount":return tP(r,a);case"offer_amount_per_period":return a&&eR(eU(a));case"offer_discount_length_text":return r?eB({amount:eG(r),unit:eV(r.periodLength)}):null;case"offer_free_extra_period":return r?eB({amount:eW(r),unit:eV(r.periodLength)}):null;case"offer_discount_percentage":return r&&a&&0!==r.discountPercent?` (-${r.discountPercent} %) `:null;default:return null}},p=e=>(0,s.jsx)("ul",{"data-testid":"ul",className:"list-disc px-24 pb-16 mx-16",children:e.map((e,t)=>(0,s.jsx)("li",{"data-testid":`li-${t}`,className:"leading-4",children:c(e.content,t)}
1,ek()))});return e||t?(0,s.jsx)(s.Fragment,{children:l(e?.json.content??t)}):null},tC="CREATE_ORDER",tL="OFFER_USED",tO="ORDER_BLOCKED",tT="ACCOUNT_LOCKED",tA="ORDER_CLAIM",tM="STRIPE",t$={FUNNELS_DISABLED:"FUNNELS_DISABLED",PAYMENT_CANCELED:"PAYMENT_CANCELED",PAYMENT_FAILED:"PAYMENT_FAILED",PAYMENT_NOT_BILLED:"PAYMENT_NOT_BILLED",GET_CAMPAIGN:"GET_CAMPAIGN",CAMPAIGN_ENDED:"CAMPAIGN_ENDED",CREATE_PAYMENT_AGREEMENT:"CREATE_PAYMENT_AGREEMENT",STRIPE:"STRIPE",STRIPE_DID_NOT_LOAD:"STRIPE_DID_NOT_LOAD",UPSELL_FETCH_FAILED:"UPSELL_FETCH_FAILED",UPSELL_NOT_ALLOWED:"UPSELL_NOT_ALLOWED"},tF=e=>({title:e?.title,description:e?.description}),tK=(e,t,r=!1)=>{let{title:a,description:n}=tF(e);return{title:a,description:(0,s.jsx)(tw,{text:n}),...t&&{[r?"withButton":"withLink"]:t}}},tR=(e,t,r=!1)=>({...tK(e,t),renderLoginLink:r}),tV=(e,t)=>{if("invalid_request_error"===e.type&&e.message?.includes("To use a PaymentMethod multiple times")){let{title:e,description:r}=tF(t?.purchase_interrupted_error);return{title:e??"Ostotapahtuma keskeytyi",description:r?(0,s.jsx)(tw,{text:r}):"Ostotapahtuma keskeytyi aiemman virheen tai peruutuksen takia."}}switch(e.code){case"payment_intent_authentication_failure":case"setup_intent_authentication_failure":{let{title:e,description:r}=tF(t?.authentication_failed_error);return{title:e??"Tunnistautuminen ep\xe4onnistui",description:r?(0,s.jsx)(tw,{text:r}):"Ole hyv\xe4 ja yrit\xe4 uudelleen."}}default:{let{title:e,description:r}=tF(t?.card_payment_failed_error);return{title:e??"Korttimaksu ep\xe4onnistui",description:r?(0,s.jsx)(tw,{text:r}):"Ole hyv\xe4 ja yrit\xe4 uudelleen."}}}},tB=(e,t,r,a)=>"required"===t.type?tU(e,r.inputLabels,r.requiredError):"pattern"===t.type||"maxLength"===t.type?tW(e,r.inputLabels,r.faultyError,a):t.message??"",tU=(e,t,r)=>`${t[eO(e)]?.label} ${r}`,tW=(e,t,r,a)=>`${r} ${t[eO(e)]?.label.toLowerCase()}${a??""}`,tG="confirmation",tz="form",tH="paymenterror",tq="restricted",tY="login",tZ="org-user",tJ="age-restricted",tQ="age-unverified",tX="customerinfo",t0="error",t1="paid-subscription",t2="sample",t4=async(e,t,r,a)=>{if(!e)throw Error("An unknown error occurred");try{let n={paymentReferenceNumber:Date.now().toString(),paymentMessage:"stripe card payment - sndp",providerCode:m.zP.Card};return(await eC({method:"POST",path:"/createPaymentAgreement",query:{accountId:e},body:n},t,r,a)).body}catch(e){throw e instanceof Error?e:Error("An unknown error occurred",{cause:e})}},t6=e=>`${e.getFullYear()}-${`${e.getMonth()+1}`.padStart(2,"0")}-${`${e.getDate()}`.padStart(2,"0")}`,t3=e=>e.toISOString().replace(/\.\d{3}Z$/,"Z"),t8=e=>{let[t,r,a]=new Intl.DateTimeFormat("sv-SE",{timeZone:"Europe/Helsinki"}).format(Date.now()).split("-").map(Number),n=new Date(e),i=n.getUTCMonth()+1,o=n.getUTCDate();return t-n.getUTCFullYear()-!(r>i||r===i&&a>=o)},t5=(e,t)=>{let{minAge:r,maxAge:a}=t??{};if(!e||!eq(e))return tY;if("CORPORATE"===e.userType||"SCHOOL"===e.userType)return tZ;if(void 0!==r||void 0!==a){let t=t8(e.dateOfBirth??"");if(Number.isNaN(t))return tQ;if(t<(r??0)||t>=(a??1/0))return tJ}},t7=async(e,t,r,a,n,i)=>{try{let a=await t4(e,t,r,n);if(a)return{stamp:a.stamp,saveAgreementToken:a.stripe.saveAgreementToken,publicApiKey:a.stripe.publicApiKey}}catch{a({type:ed,viewError:{type:t$.CREATE_PAYMENT_AGREEMENT}}),i(t0)}},t9=e=>e.offers[eL(e.funnelData.defaultOfferIndex??1)]??e.offers[0],re=e=>{let t=t6(new Date);return e&&/^\d{4}-\d{2}-\d{2}$/.test(e)&&e>t?e:t},rt=(e,t)=>{let r=re(t);return e.filter(e=>e>=r)},rr=(e,t)=>{let r=re(t);return e.find(e=>e>=r)??r},ra="success",rn="session-error",ri="unknown-error",ro=["prod","qa","preview-prod"],rs="fromStrongAuth",rl=["no_session","session_mismatch"],rd=()=>{let e=new URLSearchParams(window.location.search);if(e.has(rs))return e.has("error")?rl.includes(e.get("error")??"")?rn:ri:ra},rc=()=>new URLSearchParams(window.location.search).get("error")??void 0,ru=e=>{let t=new URLSearchParams(e.split("?")[1]).get("redirectUri");return t?new URL(t):void 0},rm=(e,t)=>{let[r,a]=e.split("?"),n=new URLSearchParams(a);return n.set("redirectUri",t.toString()),`${r}?${n.toString()}`},rp=(e,t)=>{if(!t)return e;try{let r=new URL(e);return r.searchParams.set("T_cid",t),r.toString()}catch{return e}},rf=e=>Object.values(t$).includes(e),rh=({overrides:e})=>{let{store:{userProfile:t,selectedProduct:r,campaignData:a}}=tj(),{store:{viewError:n}}=ef(),{store:{errorMessages:i,links:o,buttonLabel:l}}=es(),{store:{errorMessages:p,sampleButtons:f}}=ev(),{brand:h,urls:g}=tk(),b=a?.funnelData.funnelType===m.t.Sample?p:i,y=a?.funnelData.funnelType===m.t.Sample?f:l,x=n?(({type:e,stripeError:t,errorMessages:r,links:a,buttonLabel:n,brand:i,product:o})=>{switch(e){case t$.PAYMENT_FAILED:case t$.PAYMENT_CANCELED:return tR(r.purchase_interrupted_error);case t$.PAYMENT_NOT_BILLED:return tR(r.timeout_exit_error);case t$.CREATE_PAYMENT_AGREEMENT:return{...tR(r.create_payment_agreement_error),withLink:{url:window.location.href,externalLink:!1,label:n?.reload_page?.label,ariaLabel:n?.reload_page?.ariaLabel},renderLoginLink:!1};case t$.UPSELL_NOT_ALLOWED:{let e=o?.productPurchaseNotAllowedError;
1return e?{title:e.entryTitle,description:(0,s.jsx)(tw,{text:e.errorMessage}),withLink:e.ctaLink,renderLoginLink:!1}:tR(r.default_product_purchase_not_allowed_error,a.all_subscriptions)}case t$.FUNNELS_DISABLED:return{...tR(r.funnels_disabled_error),withLink:{url:"/",externalLink:!1,label:n?.continue_to_frontpage?.label,ariaLabel:n?.continue_to_frontpage?.ariaLabel}};case t$.CAMPAIGN_ENDED:{let e=n?.campaign_ended_offers;return tR(r.campaign_ended_error,{url:`https://${ej[i]}.fi/tilaa`,externalLink:!0,label:e?.label,ariaLabel:e?.ariaLabel},!0)}case t$.STRIPE_DID_NOT_LOAD:case t$.GET_CAMPAIGN:case t$.UPSELL_FETCH_FAILED:return tR(r.general_error,a.all_subscriptions_hs,!0);case t$.STRIPE:return{...tV(t,r),renderLoginLink:!1};default:return tR(r.create_order_error)}})({type:n?.type,stripeError:n?.stripeError,errorMessages:b,links:o,buttonLabel:y,brand:h,product:r}):null,v=e?.withLink??x?.withLink,_=e?.renderLoginLink??x?.renderLoginLink;return(0,s.jsxs)("div",{className:"flex flex-col items-center nof-ui-body-medium text-center text-nof-foreground-primary gap-nof-16 py-nof-32 px-nof-16 max-w-[640px]","data-testid":"e2e-page-error-view",children:[(0,s.jsx)(c.X,{color:"var(--nof-semantic-color-cta-base)",size:57}),(0,s.jsx)("h3",{className:"nof-ui-title-medium",children:x?.title??"Valitettavasti jotain meni vikaan"}),(0,s.jsx)("span",{className:"mb-nof-24",children:x?.description??"Tilauslomakkeen lataamisessa tapahtui virhe. Kokeile my\xf6hemmin uudelleen tai tutustu muihin tuotteisiimme."}),v?.label&&(0,s.jsx)(d.z9,{"data-testid":"error-view-link-button",containerClassName:"mb-nof-8",label:v.label,"aria-label":v.ariaLabel,link:{href:v?.url}}),_&&!eq(t)&&(0,s.jsx)(u.b,{href:g.login,text:"Oletko jo tilaaja? Kirjaudu t\xe4st\xe4"})]})},rg=({children:e})=>(0,s.jsx)("div",{className:"flex justify-center items-center h-[350px] w-full",children:e}),rb="add_to_cart",ry="purchase",rx="view_item",rv="form_error",r_="subscription_error",rj="custom_event",rS="credit_card",rE="unknown",rI=e=>Math.round(100*e)/100,rk=(e,t)=>t.products.find(t=>t.productId===e.productId)?.descriptionTitle,rN=(e,t,r)=>({item_id:e.offerId,item_name:rk(e,t),item_brand:r,item_category:e.productId,item_category2:t?.offeringCode,item_category3:eB(e.pricing.priceSteps[0].periodLength),item_variant:e.subscriptionMode,price:rI(e.pricing.priceSteps[0].packagePrice.priceWithVat),quantity:1,coupon:e.subscriptionKind===m.Ew.Sample?m.Ew.Fixed:e.subscriptionKind}),rD=e=>{let{event:t,eventLabel:r,offer:a,campaignData:n,paymentMethod:i,brand:o,isGiftOrder:s}=e;return{event:t,ecommerce:{currency:"EUR",value:a.pricing.priceSteps[0].packagePrice.priceWithVat,aid:n.audienceId,anchor_subscription:e.anchorSubscription,items:[rN(a,n,eS[o])],..."boolean"==typeof s&&{is_gift:s},...i&&{payment_method:i}},...r&&{event_label:r}}},rP=({campaignData:e,brand:t,anchorSubscription:r})=>({event:rx,ecommerce:{currency:"EUR",value:0,aid:e.audienceId,anchor_subscription:r,funnel_id:e.funnelData.funnelId,funnel_type:e.funnelData.funnelType,items:e.offers.map(r=>rN(r,e,eS[t]))}}),rw=e=>{let t=rD({...e,event:ry}),r=e.offer.pricing.priceSteps[0].packagePrice.vat;return{...t,ecommerce:{...t.ecommerce,transaction_id:`${Date.now()}${Math.floor(900*Math.random()+100)}`,tax:rI(r?r.reduce((e,t)=>e+t.amount,0):0)}}},rC=e=>rD({...e,event:rb}),rL=e=>rD({...e,event:"confirm_purchase"}),rO=e=>window?.dataLayer?.some(t=>t.event===e)??!1,rT=e=>window?.dataLayer?.findLast(t=>t.event===rj?t.event_name===e:t.event===e),rA=e=>Object.entries(e).map(([e,t])=>`${e}: ${t.type}`).join(", "),rM=({stripePaymentMethod:e,shoppingPaymentMethod:t})=>e?e&&"card"===e.type?e.card?.wallet?.google_pay?"credit_card-google_pay":e.card?.wallet?.apple_pay?"credit_card-apple_pay":rS:rE:(e=>{switch(e){case m.$f.Bank:return"bank";case m.$f.Credit:return rS;case m.$f.EmailInvoice:return"email_invoice";case m.$f.LetterInvoice:return"letter_invoice";case m.$f.EInvoice:return"e_invoice";default:return rE}})(t),r$=e=>{window?.dataLayer?.push?.(e)},rF=(e,t=!0)=>{t&&r$({ecommerce:null}),r$(e)},rK=({eventName:e,eventLabel:t})=>{r$({event:rj,event_name:e,event_label:t})},rR=({errorMessages:e,links:t,offerUsedErrors:r,articleId:a})=>{let{store:{modalError:n},dispatch:i}=ef(),o=(0,p.useMemo)(()=>n&&(({modalError:e,offerUsedErrors:t,errorMessages:r,links:a,articleId:n})=>{switch(e.type){case tM:return tV(e.stripeError,r);case tL:{let{subscriptionMode:i,daysSubscriptionConsideredActive:o}=e,s=i===m.Dm.Active?`${i}_${o}`:i,l=t.find(e=>e.subscriptionMode===s);if(l)return{description:l.message,withButton:{externalLink:!1,url:rp(l.ctaUrl,n),label:l.ctaText}};let d=tK(r?.default_offer_used_error,a?.default_offer_used_error_link,!0);return d.withButton?{...d,withButton:{...d.withButton,url:rp(d.withButton.url,n)}}:d}case tO:return tK(r?.order_blocked_error,a?.customer_service_hs);case tT:return tK(r?.account_locked_error,a?.customer_service_hs);case tA:return tK(r?.order_claim_subscription_error,a?.customer_service_hs,!0);default:return tK(r?.general_error,a?.customer_service_hs)}})({modalError:n,offerUsedErrors:r,errorMessages:e,links:t,articleId:a}),[e,t,n,r,a]),l=n?.type===tL;return(0,s.jsxs)(g.a,{containerClassName:"shopping-modal",overlayClassName:"shopping-modal",isOpen:!!n,onClose:()=>{i?.({type:el,modalError:null})},title:o?.title,buttons:o?.withButton&&{primary:{label:o?.withButton?.label??"",link:{href:o?.withButton?.url,external:o?.withButton?.externalLink},"data-ab":l?"offer-used-error-modal-button":void 0}},dataAttributes:l?{ab:"offer-used-error-modal"}:void 0,children:[(0,s.jsx)("div",{className:"nof-ui-body-medium text-nof-foreground-primary mb-nof-16","data-testid":"error-modal-description","data-ab":l?"offer-used-error-modal-description":void 0,children:o?.description}),o?.withLink&&(0,s.jsx)("span",{className:"nof-ui-body-medium text-nof-foreground-primary",children:(0,s.jsx)("a",{href:o?.withLink?.url,className:"nof-ui-subtitle-small text-nof-foreground-primary underline",children:o?.withLink?.label??o?.withLink?.url})})]})},rV=({color:e="black"})=>(0,s.jsx)("span",{className:"confirmed__animation",children:(0,s.jsxs)("svg",{width:"44",height:"44",viewBox:"0 0 54 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,s.jsx)("path",{d:"M13.3 27.3C16.6678 30.4958 22.4 36 22.4 36L39.9 18.5",stroke:e,strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("circle",{cx:"27",cy:"27",r:"25.2",stroke:e,strokeWidth:"4"})]})}),rB=({label:e,children:t})=>{let[r,a]=(0,p.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex justify-center my-nof-16",children:(0,s.jsxs)("button",{className:"nof-ui-body-medium flex cursor-pointer items-center gap-nof-6 p-nof-8 text-nof-foreground-primary",onClick:()=>{a(!r)},"aria-label":e,children:[(0,s.jsx)("span",{children:e}),!r&&(0,s.jsx)(y.Z,{color:"var(--nof-semantic-color-foreground-primary)",size:16}),r&&(0,s.jsx)(x.K,{color:"var(--nof-semantic-color-foreground-primary)",size:16})]})}),r&&t]})},rU=(e,t)=>{switch(t){case m.Ew.Fixed:return e.fixed_paragraph.label;case m.Ew.Sample:return e.sample_paragraph.label;case m.Ew.Recurring:default:return e.recurring_paragraph.label}},rW=e=>e.subscriptionMode===m.Dm.FreeSubscription,rG=e=>e?.some(e=>e.productId.endsWith("_COP"))??!1,rz=(e,t)=>Math.round((1-eU(e)/eU(t))*100),rH=(e,t)=>{let r=e.pricing.priceSteps[0],a=rq(e,t);return`${eR(r.packagePrice.priceWithVat+a)} â¬`},rq=(e,t)=>
1t===m.$f.LetterInvoice?e.paymentMethods?.find(e=>e.paymentType===m.$f.LetterInvoice)?.extraCharge??0:0,rY=({limitedInfo:e=!1,offer:t,paymentDetails:r,customerInfo:a,deliveryAddress:n,isGiftOrder:i,showOrderPaymentAmount:o,startDate:l})=>{var d,c,u;let p,f,h,g,b,y,x,v,_,j,S,{store:{campaignData:E,selectedProduct:I}}=tj(),{store:{paymentTypeLabel:k,orderInfoTitle:N,orderConfirmDesc:D,subscriptionKindLabels:P}}=es(),w=E?.products.find(e=>e.productId===t.productId)??I,C=e&&r.paymentMethod===m.$f.LetterInvoice?D?.invoice_letter_desc?.label:void 0,L=t.subscriptionKind===m.Ew.Fixed?(d=P?.fixed_subscription?.label,h=t.pricing.priceSteps[0],g=I?[I.descriptionTitle]:[],b=`${d??""} ${eB(h.periodLength)}`.trim(),y=eR(h.packagePrice.priceWithVat),g.push(b,`${y} â¬`),[...g,"Alkaa heti"]):(c=P?.recurring_subscription?.label,x=[`${w.descriptionTitle}${i?" lahjatilaus":""}`],v=t.pricing.priceSteps[0],_=t.pricing.recurringPrice,c&&x.push(c),j=l??new Date().toISOString(),x.push(`Alkaa ${(u=j,f=new Date,eK(new Date(u))===eK(f)?"Heti":(p=new Date(u),`${p.getDate()}.${p.getMonth()+1}.${p.getFullYear()}`)).toLowerCase()}`,(S=eG(v),`${S>1?"Ensimm\xe4iset":"Ensimm\xe4inen"} ${S} ${v.periodLength.unit} ${eR(v.packagePrice.priceWithVat)} â¬`)),t.continuationCampaignId&&_&&t.pricing.priceSteps.length>1&&x.push(...t.pricing.priceSteps.slice(1).map(e=>{let t,r,a,n,i;return t=e.periodLength.amount*e.periodCount,r=`${eR(e.packagePrice.priceWithVat)} â¬/${eB(e.periodLength)} v\xe4lein`,n=(a=rz(e,_))>0?`-${a} %, `:"",i=eW(e)>0?` + ${eB(e.periodExtraLength)} kaupan p\xe4\xe4lle`:"",`${t>1?"Seuraavat":"Seuraava"} ${t} ${e.periodLength.unit} ${n}${r}${i}`})),_&&x.push(`Tilaus jatkuu ${eR(_.packagePrice.priceWithVat)} â¬/${eB(_.periodLength)} v\xe4lein`),[...x,...C?[C]:[]]),O=!!E?.modularOffering,T=rW(t)?void 0:(0,s.jsx)(rX,{paymentInfoTitle:N?.payment_method_info?.label,paymentDetails:r,paymentTypeLabel:k,orderConfirmDesc:D,orderInfoTitle:N}),A=i?N?.payer_info?.label:N?.customer_info?.label;return O?(0,s.jsxs)(s.Fragment,{children:[a&&(0,s.jsx)(rQ,{orderInfoTitle:A,customerInfo:a}),i&&n&&(0,s.jsx)(rQ,{orderInfoTitle:N?.receiver_info?.label,customerInfo:n}),(0,s.jsx)(rJ,{orderInfoTitle:N?.order_info?.label,orderInfoText:L,limitedInfo:e,orderConfirmDesc:D}),T,(0,s.jsx)(r0,{showOrderPaymentAmount:o,orderPaymentAmount:N?.order_payment_amount?.label,paymentMethod:r.paymentMethod,offer:t}),(0,s.jsx)(r1,{label:D?.vat_description?.label})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(rJ,{orderInfoTitle:N?.order_info?.label,orderInfoText:L,limitedInfo:e,orderConfirmDesc:D}),!e&&(0,s.jsxs)(s.Fragment,{children:[a&&(0,s.jsx)(rQ,{orderInfoTitle:A,customerInfo:a}),i&&n&&(0,s.jsx)(rQ,{orderInfoTitle:N?.receiver_info?.label,customerInfo:n}),T,(0,s.jsx)(r0,{showOrderPaymentAmount:o,orderPaymentAmount:N?.order_payment_amount?.label,paymentMethod:r.paymentMethod,offer:t}),(0,s.jsx)(r1,{label:D?.vat_description?.label})]})]})},rZ=({title:e,text:t,bottomText:r})=>{let a=t.filter(e=>!!e);return 0===a.length?null:(0,s.jsx)("div",{className:"flex flex-col justify-between p-nof-0 rounded-nof-small border-solid border-[1px] border-nof-neutral-contrast-default gap-nof-0 md:flex-row md:gap-nof-12 md:py-nof-16 md:pl-nof-16 mb-nof-16 text-nof-foreground-primary","data-testid":e,children:(0,s.jsxs)("dl",{className:"p-nof-16 md:p-nof-0 m-[0]",children:[(0,s.jsx)("dt",{className:"nof-ui-subtitle-small mb-nof-8",children:e}),a.map((e,t)=>(0,s.jsx)("dd",{className:"nof-ui-body-medium mb-nof-0 ml-[0]",children:e},`${t}_orderinfo_paragraph`)),r&&(0,s.jsx)("dd",{className:"nof-ui-body-medium mb-nof-0 mt-nof-16 ml-[0]",children:r})]})})},rJ=({orderInfoTitle:e,orderInfoText:t,limitedInfo:r,orderConfirmDesc:a})=>(0,s.jsx)(rZ,{title:e,text:t,bottomText:r?a?.vat_description?.label:void 0}),rQ=({orderInfoTitle:e,customerInfo:t})=>(0,s.jsx)(rZ,{title:e,text:(e=>{let t,r,{firstName:a,lastName:n,email:i,phoneNumber:o,streetAddress:s,zipCode:l,postOffice:d}=e,c=s&&l&&d?`${s}, ${l} ${d}`:"";return[(t=a,r=n,t&&r?`${t} ${r}`:t||r||""),i,o??"",c]})(t)}),rX=({paymentInfoTitle:e,paymentDetails:t,paymentTypeLabel:r,orderConfirmDesc:a,orderInfoTitle:n})=>(0,s.jsx)(rZ,{title:e,text:((e,t,r,a)=>
1{if(e.creditCardDetails){let t,{expireDate:r,name:n}=e.creditCardDetails,i=`${(t=r.month)<10?`0${t}`:t.toString()}/${r.year}`;return[`${a.card_ends_with?.label} **** ${n.slice(-4)}`,`${a.expires?.label}: ${i}`]}switch(e.paymentMethod){case m.$f.Bank:return[t.bank?.label];case m.$f.Credit:return[t.credit?.label];case m.$f.EmailInvoice:return[t.email_invoice?.label];case m.$f.LetterInvoice:return[t.letter_invoice?.label,r.invoice_letter_desc?.label];case m.$f.EInvoice:return[t.einvoice_confirm_desc?.label];default:return["Ei maksutapaa valittu"]}})(t,r,a,n)}),r0=({showOrderPaymentAmount:e,orderPaymentAmount:t,paymentMethod:r,offer:a})=>e&&t&&r&&(0,s.jsx)(rZ,{title:t,text:[rH(a,r)]}),r1=({label:e})=>(0,s.jsx)("div",{className:"flex justify-center mb-nof-24",children:(0,s.jsx)("p",{className:"text-nof-foreground-primary nof-ui-body-medium",children:e})}),r2="order_confirmation",r4="analytics_payment_method",r6=({offer:e,campaignData:t,brand:r,anchorSubscription:a})=>rD({event:rx,offer:e,campaignData:t,brand:r,anchorSubscription:a}).ecommerce,r3=({offer:e,campaignData:t,brand:r,orderID:a,anchorSubscription:n})=>({event:"funnel-click-order",orderID:a,items:{ecommerce:r6({offer:e,campaignData:t,brand:r,anchorSubscription:n})}}),r8=({offer:e,campaignData:t,brand:r,orderID:a,errorType:n,anchorSubscription:i})=>({event:"funnel-subscription-error",orderID:a,errorType:n,items:{ecommerce:r6({offer:e,campaignData:t,brand:r,anchorSubscription:i})}}),r5=({offer:e,campaignData:t,brand:r,orderID:a,anchorSubscription:n})=>({event:"funnel-order-completed",orderID:a,items:{ecommerce:r6({offer:e,campaignData:t,brand:r,anchorSubscription:n})}}),r7=e=>{let t=r9(e),r=t.includes("?"),a=encodeURIComponent(window.location.href);return`${t}${r?"&":"?"}redirect_status=$status$&redirectUri=${a}`},r9=e=>{let{funnelId:t,campaignData:r,preSelectedOffer:a,articlePath:n}=e;return eF(t,r?.audienceId,a,n)},ae=async(e,t,r)=>{try{return(await eC({method:"POST",path:"/orderCreate",body:e},t,r)).body}catch(e){throw e instanceof Error?e:Error("An unknown error occurred",{cause:e})}},at=async(e,t,r,a)=>{try{return(await eC({method:"POST",path:"/createModularOrder",body:e},t,r,a)).body}catch(e){throw e instanceof Error?e:Error("An unknown error occurred",{cause:e})}},ar=async(e,t,r)=>{try{return(await eC({method:"GET",path:"/addressValidate",query:e,retries:1},t,r)).body}catch(e){throw e instanceof Error?e:Error("An unknown error occurred",{cause:e})}},aa={FirstName:"firstName",LastName:"lastName",Email:"email",StreetAddress:"streetAddress",ZipCode:"zipCode",PostOffice:"postOffice",PhoneNumber:"phoneNumber"},an="startTime",ai={FirstName:"gift.firstName",LastName:"gift.lastName",Email:"gift.email",StreetAddress:"gift.streetAddress",ZipCode:"gift.zipCode",PostOffice:"gift.postOffice",PhoneNumber:"gift.phoneNumber"},ao={PhoneNumber:"abroad.phoneNumber",Country:"abroad.country"},as=(e,t,r,a)=>({accountType:r?.accountIdEncoded?m.CO.Shogun:m.CO.WaitForShogun,accountId:r?.accountIdEncoded??"<create>",meta:{channel:a??"sndp",application:e,orderId:t}}),al="SET_REQUEST_PROCESSING",ad=async({formMethods:e})=>{let t=Object.values(ao).filter(t=>e.getFieldState(t).invalid);if(t.length>0){for(let e of t)rK({eventName:rv,eventLabel:`${e}.invalid`});return{success:!1}}return{success:!0}},ac=async({brand:e,env:t,formErrorsDictionary:r,formMethods:a,cachedAddressInfo:n})=>{let i=Object.values(aa).filter(e=>a.getFieldState(e).invalid);if(a.getFieldState(aa.StreetAddress).invalid||a.getFieldState(aa.ZipCode).invalid){for(let e of[a.getFieldState(aa.StreetAddress).invalid&&aa.StreetAddress,a.getFieldState(aa.ZipCode).invalid&&aa.ZipCode].filter(Boolean))rK({eventName:rv,eventLabel:`${e}.invalid`});return{success:!1}}let{success:o}=await am({streetAddressName:aa.StreetAddress,zipCodeName:aa.ZipCode,brand:e,env:t,formMethods:a,formErrorsDictionary:r,cachedAddressInfo:n});if(i.length>0){for(let e of i)rK({eventName:rv,eventLabel:`${e}.invalid`});return{success:!1}}return{success:o}},au=async({brand:e,env:t,formErrorsDictionary:r,formMethods:a,cachedAddressInfo:n})=>{let i=Object.values(ai).filter(e=>a.getFieldState(e).invalid);if(a.getFieldState(ai.StreetAddress).invalid||a.getFieldState(ai.ZipCode).invalid){for(let e of i)rK({eventName:rv,eventLabel:`${e}.invalid`});return{success:!1}}let{success:o}=await am({streetAddressName:ai.StreetAddress,zipCodeName:ai.ZipCode,brand:e,env:t,formMethods:a,formErrorsDictionary:r,cachedAddressInfo:n});if(i.length>0){for(let e of i)rK({eventName:rv,eventLabel:`${e}.invalid`});return{success:!1}}return{success:o}},am=async({streetAddressName:e,zipCodeName:t,brand:r,env:a,formMethods:n,formErrorsDictionary:i,cachedAddressInfo:o})=>{let s=n.getValues(e),l=n.getValues(t);if("string"!=typeof s||"string"!=typeof l)return{success:!1};try{let{isValid:t}=o??await ar({streetAddress:s,zipCode:l},r,a);if(t)return{success:!0};n.setError(e,{type:"manual",message:i?.address_not_found?.label}),rK({eventName:rv,eventLabel:"invalid address"})}catch{n.setError(e,{type:"manual",message:i?.address_validation?.label}),rK({eventName:r_,eventLabel:"fetch address validation failed"})}return{success:!1}},ap=async({elements:e,stripe:t,shoppingDispatch:r,errorDispatch:a})=>e?e.submit().then(async n=>n.error?(rK({eventName:rv,eventLabel:n.error.message??"stripe form submit error"}),{success:!1}):t.createPaymentMethod({elements:e,params:{billing_details:{address:{country:"FI"}}}}).then(e=>(r({type:tb,stripePaymentMethod:e.paymentMethod}),{success:!0,paymentMethod:e.paymentMethod})).catch(e=>(rK({eventName:r_,eventLabel:e}),a({type:el,modalError:{type:tM,stripeError:e}}),{success:!1}))).catch(e=>(rK({eventName:r_,eventLabel:e}),a({type:el,modalError:{type:tM,stripeError:e}}),{success:!1})):(a({type:el,modalError:{type:tC}}),{success:!1}
1),af=async({order:e,pageFeaturesDispatch:t,shoppingDispatch:r,errorDispatch:a,getJwtToken:n,stripe:i,onEventRelayEvent:o})=>{let{campaignData:s,funnelId:l,articlePath:d,selectedOffer:c,selectedPaymentMethod:u,isGiftOrder:p,isStandalone:h,brand:g,preSelectedOffer:b,stripePaymentMethod:y,setupIntentClientSecret:x,qualifyingSubscription:v}=e,_=v?.product.productName;s&&o?.(r3({offer:c,campaignData:s,brand:g,orderID:e.generatedOrderId,anchorSubscription:_}));try{let o=await (s?.modularOffering?ab(e,n):ag(e));if(!o.success)throw Error(o.errorText??"Order creation failed");let v={secureOrderId:o.secureOrderId,articlePath:d??(h?void 0:window.location.pathname),offerId:c.offerId,aid:s?.audienceId};f.A.set(r2,JSON.stringify(v));let j=rM({shoppingPaymentMethod:u,stripePaymentMethod:y});f.A.set(r4,j,{expires:new Date(Date.now()+3e5)}),r({type:to,accountType:o.accountType}),rF(rL({offer:c,campaignData:s,brand:g,paymentMethod:j,isGiftOrder:p,anchorSubscription:_}));let S=eF(l,s?.audienceId,b,d),E=o.guaranteedRedirectUri??void 0;if(rW(c)){t({type:al,requestProcessing:!1}),window.location.href=S;return}switch(u){case m.$f.Credit:if(!o.payment||!i)return void a({type:el,modalError:{type:tC}});await ay(o.payment,{stripe:i,stripePaymentMethodId:y?.id,setupIntentClientSecret:x},S,t,a);break;case m.$f.Bank:case m.$f.EmailInvoice:case m.$f.LetterInvoice:case m.$f.EInvoice:ax({pageFeaturesDispatch:t,errorDispatch:a,orderData:{selectedOffer:c,campaignData:s,brand:g},guaranteedRedirectUri:E});break;default:t({type:al,requestProcessing:!1})}}catch(r){t({type:al,requestProcessing:!1}),ah({error:r,selectedOffer:c,campaignData:s,brand:g,generatedOrderId:e.generatedOrderId,errorDispatch:a,onEventRelayEvent:o,anchorSubscription:_})}},ah=({error:e,selectedOffer:t,campaignData:r,brand:a,generatedOrderId:n,errorDispatch:i,onEventRelayEvent:o,anchorSubscription:s})=>{switch(e instanceof ew?e.knownErrorCode:void 0){case m.LW.OFFER_USED:i({type:el,modalError:{type:tL,subscriptionMode:t.subscriptionMode,daysSubscriptionConsideredActive:t.daysSubscriptionConsideredActive}}),rK({eventName:r_,eventLabel:"offer already used"}),o?.(r8({offer:t,campaignData:r,brand:a,orderID:n,errorType:t.subscriptionMode.toLowerCase(),anchorSubscription:s}));break;case m.LW.ORDER_BLOCKED:i({type:el,modalError:{type:tO}}),rK({eventName:r_,eventLabel:"order blocked"});break;case m.LW.ACCOUNT_LOCKED:i({type:el,modalError:{type:tT}}),rK({eventName:r_,eventLabel:"account locked"});break;default:{i({type:el,modalError:{type:tC}});let t=e instanceof Error?` (${e.message})`:"";rK({eventName:r_,eventLabel:`create order request failed${t}`})}}},ag=({userProfile:e,campaignData:t,generatedOrderId:r,formData:a,funnelId:n,selectedProduct:i,articleId:o,selectedOffer:s,selectedPaymentMethod:l,orderPeriodDescription:d,domain:c,stamp:u,channel:p,externalPurchaseToken:f,applicationId:h,brand:g,env:b,selectedBankProvider:y,selectedEInvoiceProvider:x,selectedInvoicingMethod:v,articlePath:_})=>ae((({storeData:e,orderPeriodDescription:t,domain:r,channel:a,externalPurchaseToken:n,applicationId:i,paymentAgreementStamp:o,selectedPaymentMethod:s,selectedBankProvider:l,selectedEInvoiceProvider:d,selectedInvoicingMethod:c})=>{var u;let p,f={...as(r,e.generatedOrderId,e.userProfile,a),payment:{message:e.selectedProduct.descriptionTitle,address:(p={firstName:(u=e.formData).firstName,lastName:u.lastName,email:u.email},u.abroad?.country&&u.abroad?.phoneNumber?{...p,phoneNumber:u.abroad.phoneNumber,countryCode:u.abroad.country}:{...p,phoneNumber:u.phoneNumber,street:u.streetAddress,zip:u.zipCode,city:u.postOffice})},entries:[{productId:e.selectedOffer.productId,modifiers:[e.selectedOffer.offerId],attributes:{subscriptionInfoText:t,T_cid:e.articleId??"",kayakStrongAuth:"true",externalPurchaseToken:n,applicationId:i},parameters:{audienceId:e.campaignData?.audienceId??"",offeringVariant:e.campaignData?.variant,startTime:t3(new Date(e.formData.startTime))}}]};if(e.formData.gift&&e.formData.startTime&&(f.entries[0].attributes.directGift=!0,f.entries[0].parameters.deliveryAddress={firstName:e.formData.gift.firstName,lastName:e.formData.gift.lastName,email:e.formData.gift.email,street:e.formData.gift.streetAddress,zip:e.formData.gift.zipCode,city:e.formData.gift.postOffice,phoneNumber:e.formData.gift.phoneNumber}),rW(e.selectedOffer))return{...f,payment:{...f.payment,provider:m.zP.Voucher}};let h=r7(e);switch(s){case m.$f.Credit:return{...f,stamp:o};case m.$f.Bank:return{...f,payment:{...f.payment,provider:l,recurringPayment:{provider:m.zP.Invoice,invoicingMethod:c},returnUri:h}};case m.$f.EmailInvoice:return{...f,payment:{...f.payment,provider:m.zP.Invoice,returnUri:h,invoicingMethod:m.Cl.Email}};case m.$f.LetterInvoice:return{...f,payment:{...f.payment,provider:m.zP.Invoice,returnUri:h,invoicingMethod:m.Cl.Letter}};case m.$f.EInvoice:return f.entries[0].attributes.bankId=d,{...f,payment:{...f.payment,provider:m.zP.Invoice,returnUri:h}};default:throw Error("Unsupported payment method")}})({storeData:{userProfile:e,campaignData:t,generatedOrderId:r,formData:a,selectedProduct:i,articleId:o,selectedOffer:s,funnelId:n,articlePath:_},orderPeriodDescription:d,domain:c,channel:p,externalPurchaseToken:f,applicationId:h,paymentAgreementStamp:u,selectedPaymentMethod:l,selectedBankProvider:y,selectedEInvoiceProvider:x,selectedInvoicingMethod:v}),g,b),ab=({userProfile:e,campaignData:t,generatedOrderId:r,formData:a,funnelId:n,selectedProduct:i,articleId:o,selectedOffer:s,selectedPaymentMethod:l,orderPeriodDescription:d,domain:c,stamp:u,channel:p,externalPurchaseToken:f,applicationId:h,brand:g,env:b,selectedBankProvider:y,selectedEInvoiceProvider:x,selectedInvoicingMethod:v,qualifyingSubscription:_},j)=>at((({storeData:e,domain:t,channel:r,externalPurchaseToken:a,applicationId:n,paymentAgreementStamp:i,selectedPaymentMethod:o,selectedBankProvider:s,selectedEInvoiceProvider:l,selectedInvoicingMethod:d})=>{let c=as(t,e.generatedOrderId,e.userProfile,r),u=e.userProfile?.email;if(!u)throw Error("Account or account email is missing. User must be logged in for modular order creation to work");let p={...c,payment:{message:e.selectedProduct.descriptionTitle,invoicingEmail:u},productId:e.selectedOffer.productId,modifiers:[e.selectedOffer.offerId],attributes:{campaign:e.campaignData?.funnelData.funnelId??"",kayakStrongAuth:"true",T_cid:e.articleId??"",externalPurchaseToken:a,applicationId:n},audienceId:e.campaignData?.audienceId??"",startTime:t3(new Date(e.formData.startTime)),anchorSubscriptionid:(e=>{if(!e)throw Error("Could not resolve anchor subscription id. Qualifying subscription is not set in context, even though it should always be available at this stage.");return e.subscriptionId})(e.qualifyingSubscription)};if(e.campaignData?.funnelData.allowGiftSubscription&&e.formData.gift&&(p.attributes.directGift=!0,p.subscriber={firstName:e.formData.gift.firstName,lastName:e.formData.gift.lastName,email:e.formData.gift.email,phone:e.formData.gift.phoneNumber,street:e.formData.gift.streetAddress,postalCode:e.formData.gift.zipCode,city:e.formData.gift.postOffice}),rW(e.selectedOffer))return{...p,payment:{...p.payment,provider:m.zP.Voucher}};let f=r7(e);switch(o){case m.$f.Credit:return{...p,stamp:i};case m.$f.Bank:if(!s)throw Error("Provider is not selected for bank payment. Can not create order.");switch(d){case m.Cl.Email:case m.Cl.Letter:return{...p,payment:{...p.payment,provider:s,recurringPayment:{provider:m.zP.Invoice,invoicingMethod:d},returnUri:f}};default:throw Error("Recurring payment invoicing method is not selected for bank payment. Can not create order.")}case m.$f.EmailInvoice:return{...p,payment:{...p.payment,provider:m.zP.Invoice,returnUri:f,invoicingMethod:m.Cl.Email}};case m.$f.LetterInvoice:return{...p,payment:{...p.payment,provider:m.zP.Invoice,returnUri:f,invoicingMethod:m.Cl.Letter}};case m.$f.EInvoice:return p.attributes.bankId=l,{...p,payment:{...p.payment,provider:m.zP.Invoice,returnUri:f}};default:throw Error("Unsupported payment method")}})({storeData:{userProfile:e,campaignData:t,generatedOrderId:r,formData:a,selectedProduct:i,articleId:o,selectedOffer:s,funnelId:n,qualifyingSubscription:_},orderPeriodDescription:d,domain:c,channel:p,externalPurchaseToken:f,applicationId:h,paymentAgreementStamp:u,selectedPaymentMethod:l,selectedBankProvider:y,selectedEInvoiceProvider:x,selectedInvoicingMethod:v}),g,b,j),ay=async(e,t,r,a,n)=>{e.stripe?.paymentToken?await t.stripe.confirmPayment({clientSecret:e.stripe.paymentToken,confirmParams:{return_url:r,payment_method:t.stripePaymentMethodId}}).then(e=>{e?.error&&(n({type:el,modalError:{type:tM,stripeError:e?.error}}),n({type:el,modalError:{type:tM,stripeError:e?.error}}),f.A.remove(r2),f.A.remove(r4)),a({type:al,requestProcessing:!1})}):await t.stripe.confirmSetup({clientSecret:t.setupIntentClientSecret,confirmParams:{return_url:r,payment_method:t.stripePaymentMethodId}}).then(e=>{e?.error&&(n({type:el,modalError:{type:tM,stripeError:e?.error}}),n({type:el,modalError:{type:tM,stripeError:e?.error}}),f.A.remove(r2),f.A.remove(r4)),a({type:al,requestProcessing:!1})})}
1,ax=async({pageFeaturesDispatch:e,errorDispatch:t,guaranteedRedirectUri:r})=>{r?(e({type:al,requestProcessing:!1}),window.location.href=r):t({type:el,modalError:{type:tC}})},av=(e,t,r)=>{if(r?.useAccountInfo&&e?.firstName&&e.lastName&&e.email)return{firstName:e.firstName,lastName:e.lastName,email:e.email};if(t){let e={firstName:t.firstName,lastName:t.lastName,email:t.email,phoneNumber:t.phoneNumber};return r?.hideAddress?e:{...e,streetAddress:t.street,zipCode:t.zip,postOffice:t.city}}},a_=({subscribedOffer:e,onContinueReading:t})=>{let{store:{campaignData:r,generatedOrderId:a,orderConfirmationData:n,qualifyingSubscription:i,selectedProduct:o}}=tj(),{store:{buttonLabel:l,formSectionTitle:c,confirmation:u,misc:h,links:g}}=es(),{userProfile:y,brand:x,isStandalone:v,handleBrazeCustomEvent:_,articlePath:j,renderBrazeBanner:S,onEventRelayEvent:E}=tk(),I=n?.orderUserData,k=!!n?.meta?.isAbroadOrder,N=!!n?.purchasedProducts?.[0]?.isGift,D=n?.purchasedProducts?.[0]?.startTime,P=n?.purchasedProducts?.[0]?.deliveryAddress,w=av(y,I,{useAccountInfo:r?.modularOffering,hideAddress:k}),C=N?av(y,P):void 0,L=r?.offers.find(t=>t.offerId===e),O=(e=>{if(!e)return{};let{paymentMethod:t,paymentTypeDetails:{paymentType:r}}=e;return r===m.$f.Credit&&t?{paymentMethod:r,creditCardDetails:{expireDate:{month:t.expireMonth,year:t.expireYear},name:t.paymentMethodNumber}}:{paymentMethod:r}})(n),T=O.paymentMethod===m.$f.LetterInvoice,A=i?.product.productName,M=r?.funnelData?.confirmationTitle??(N?h?.confirmation_title_gift?.label:h?.confirmation_title?.label),$=r?.funnelData?.confirmationDescription??(N?u?.confirmation_description_gift?.paragraph:u?.confirmation_description?.paragraph);(0,p.useEffect)(()=>{if(r&&L){let e=f.A.get(r4);f.A.remove(r4),rF(rw({offer:L,campaignData:r,brand:x,isGiftOrder:N,paymentMethod:e??rM({shoppingPaymentMethod:O.paymentMethod}),anchorSubscription:A})),E?.(r5({offer:L,campaignData:r,brand:x,orderID:a,anchorSubscription:A}))}},[x,r,a,L,O.paymentMethod,A,N,E]),(0,p.useEffect)(()=>{L&&_&&r&&_({type:"completed_checkout",payload:{product_id:L.productId.replace(/^[KS]-/,""),payment_requirement:L.subscriptionMode,product_name:o.descriptionTitle,aid:r.audienceId,funnel_id:r.funnelData.funnelId,offering_code:r.offeringCode,is_module:r.modularOffering,is_gift:N,offer_length:eB(L.pricing.priceSteps[0].periodLength)}})},[L,_,o,r,N]);let F=v&&r?.funnelData?.redirectUrl?r.funnelData.redirectUrl:g.standalone_continue?.url??j??"/",K=e?l?.continue_reading?.label:l?.start_reading?.label,R=v&&r?.funnelData?.redirectUrlLabel?r.funnelData.redirectUrlLabel:K,V=rG(n?.purchasedProducts);return(0,s.jsxs)("div",{className:"max-w-[640px] mb-nof-24",children:[(0,s.jsxs)("div",{className:"p-nof-32 flex flex-col items-center text-center gap-nof-16",children:[(0,s.jsx)(rV,{color:"var(--confirmed-animation-icon-color)"}),(0,s.jsx)("h2",{className:"m-nof-0 text-nof-foreground-primary nof-ui-title-large","data-ab":"shopping-confirmation-title",children:M}),(0,s.jsx)(tw,{text:$,dataAb:"shopping-confimation-description"}),(0,s.jsx)(d.z9,{label:R,link:{href:F},onClick:e=>{e.preventDefault(),t({isCop:V,redirectUrl:F})},containerClassName:"mt-nof-16","data-testid":"continue-reading-button"})]}),(0,s.jsx)(b.c,{}),L&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(rB,{label:c?.order_info?.label,children:(0,s.jsx)("div",{className:"mx-nof-16",children:(0,s.jsx)(rY,{offer:L,paymentDetails:O,showOrderPaymentAmount:T,customerInfo:w,deliveryAddress:C,isGiftOrder:N,startDate:D})})}),S?.(L.productId.replace(/^[KS]-/,""))]})]})},aj=()=>{let{brand:e,isDarkMode:t}=tk(),r=((e,t)=>{if(e===e_.hs){let e=t?S.n.Negative:S.n.Positive;return(0,s.jsxs)("div",{className:"flex w-full justify-center overflow-hidden","data-testid":"hero-logo",children:[(0,s.jsx)("span",{className:"block w-[250%] max-w-none shrink-0 sm:hidden [&>svg]:h-auto [&>svg]:w-full",children:(0,s.jsx)(j.H,{colorVariant:e,size:84})}),(0,s.jsx)("span",{className:"hidden w-[250%] max-w-none shrink-0 sm:block [&>svg]:h-auto [&>svg]:w-full",children:(0,s.jsx)(_.V,{colorVariant:e,size:118})})]})}let r=e===e_.is?S.n.Positive:S.n.Negative;return(0,s.jsx)(v.gu,{variant:v.tv.Circle,brand:e,colorVariant:r,size:72,"data-testid":"hero-logo"})})(e,t),{store:{campaignData:a}}=tj();return(0,p.useEffect)(()=>{rK({eventName:"funnel_hero_shown",eventLabel:"shopping funnel"})},[]),(0,s.jsxs)("div",{className:"flex w-full flex-col items-center justify-center",children:[(0,s.jsx)("div",{className:"flex w-full flex-col items-center justify-center",children:r}),(0,s.jsxs)("div",{className:"mt-nof-40 flex flex-col text-center gap-nof-16 px-nof-16",children:[(0,s.jsx)("h2",{className:"nof-ui-title-large text-nof-foreground-primary my-nof-0 mx-nof-8","data-ab":"shopping-funnel-title",children:a?.funnelData.title}),a?.funnelData.description&&(0,s.jsx)(tw,{text:a.funnelData.description,dataAb:"shopping-funnel-description"})]})]})},aS=()=>(0,s.jsx)("div",{className:"absolute flex flex-col justify-end items-center top-nof-0 h-full w-full bg-nof-grayscale-0 opacity-90 gap-nof-16 z-[1] pb-[500px]",children:(0,s.jsx)(l.y,{})}),aE=({title:e,showTopBorder:t,hideBottomBorder:r,children:a,id:n,dataAb:i,formReference:o})=>(0,s.jsxs)("div",{className:"px-nof-16 md:px-nof-32",children:[t&&(0,s.jsx)(b.c,{variant:b.K.LowContrast}),(0,s.jsxs)("div",{className:"py-nof-32","data-testid":`single-section-${n}`,"data-ab":`${i}-container`,ref:o,children:[(0,s.jsx)("h3",{className:"nof-ui-title-medium text-nof-foreground-primary mb-nof-24","data-ab":`${i}-title`,children:e}),a]}),!r&&(0,s.jsx)(b.c,{variant:b.K.LowContrast})]}),aI=(e,t)=>{if(!e||!window)return;let r=t?.offsetInPx??0;if((t?.withElementMarginTop??!0)&&(r+=parseInt(getComputedStyle(e).marginTop)),t?.withStickyHeaderHeight??!0){let e=document.querySelector(".sticky-header-content");e&&(r+=parseInt(getComputedStyle(e).height))}let a={behavior:"smooth",top:e.getBoundingClientRect().top-document.body.getBoundingClientRect().top-r};window.scrollTo({...a,...t?.scrollToOptions})},ak={"K-AM_SKK":"sk","K-SKK":"sk","K-AM_KAS":"ks","K-KAS":"ks","K-AM_TYR":"t
1yr","K-TYR":"tyr","K-AM_RKS":"rks","K-RKS":"rks","K-AM_SYS":"ss","K-SYS":"ss","K-AM_SUK":"suk","K-SUK":"suk","K-AM_MK":"mk","K-MK":"mk","K-AM_JS":"js","K-JS":"js","K-IS":"is","K-AM_JAN":"jan","K-JAN":"jan","K-AM_NU":"nu","K-NU":"nu","K-AM_KMV":"kmv","K-KMV":"kmv","K-AM_VS":"vs","K-VS":"vs","K-HS":"hs","K-AM_AL":"al","K-AL":"al","K-EXTPL":"is"},aN=()=>{let{store:{userProfile:e,qualifyingSubscription:t}}=tj(),{store:{customerFormLabel:r,formSectionTitle:a}}=es(),{isDarkMode:n}=tk(),i=(0,p.useCallback)(e=>{null!==e&&f.A.get("campaignIds")&&(aI(e),f.A.remove("campaignIds"))},[]),o=!!e?.firstName&&!!e?.lastName&&!!e?.email;return t&&o?(0,s.jsxs)(aE,{id:tX,title:a?.customer_info?.label,formReference:i,showTopBorder:!0,hideBottomBorder:!0,children:[e?.firstName&&e.lastName&&(0,s.jsx)(E.U,{email:e.email,firstName:e.firstName,lastName:e.lastName,fullWidth:!0}),(0,s.jsx)(aD,{customerFormLabel:r,qualifyingSubscription:t,isDarkMode:n})]}):null},aD=({customerFormLabel:e,qualifyingSubscription:t,isDarkMode:r})=>{let a=e?.base_order_list_title?.label;return(0,s.jsxs)("div",{"data-testid":"e2e-modular-offer-customer-info",children:[(0,s.jsx)("h4",{className:"m-nof-0 mt-nof-24 nof-ui-subtitle-small text-nof-foreground-primary",children:a}),(0,s.jsx)("ul",{className:"m-nof-0 p-nof-0",children:(0,s.jsx)(aP,{subscription:t,isDarkMode:r},t.product.productId)})]})},aP=({subscription:e,isDarkMode:t})=>{let{brand:r,colorVariant:a}=((e,t)=>{let r,a=(r=e,Object.entries(ak).find(([e])=>r.startsWith(e))?.[1]),n=((e,t)=>{if(t)switch(t){case"is":return S.n.Positive;case"hs":return e?S.n.Positive:S.n.Negative;default:return S.n.Negative}})(t,a);if(a&&n)return{brand:a,colorVariant:n}})(e.product.productId,t)??{};return(0,s.jsxs)("li",{className:"flex pt-nof-12 items-center nof-ui-subtitle-small text-nof-foreground-primary",children:[r&&a&&(0,s.jsx)("div",{className:"flex flex-col items-center justify-center mr-nof-12",children:(0,s.jsx)(v.gu,{variant:v.tv.Square,brand:r,colorVariant:a,size:40})}),e.product.productName]})},aw=({listItems:e,containerProps:t,fillIcon:r=!0})=>(0,s.jsx)("div",{className:"flex flex-col gap-nof-12",...t,children:e.map(e=>(0,s.jsxs)("div",{className:"flex flex-row items-top",children:[(0,s.jsx)("div",{className:"flex mr-nof-8 pt-[1px]",children:(0,s.jsx)(r?I._:k.C,{color:"var(--nof-semantic-color-foreground-primary)",size:16})}),(0,s.jsx)("div",{className:"nof-ui-body-medium text-nof-foreground-primary",children:e})]},`checkmarklist_item_${e.replaceAll(" ","_")}`))}),aC=()=>{let{store:e}=tj(),{descriptionList:t,descriptionTitle:r,productImage:{url:a}={},readMoreHeader:n,readMoreContent:i}=e.selectedProduct,[o,l]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{rK({eventName:"funnel_product_card_shown",eventLabel:"shopping funnel"})},[]),(0,s.jsxs)("div",{className:"flex flex-col text-nof-foreground-primary m-nof-16 md:m-nof-32 pt-nof-16 pb-nof-24 px-nof-16 md:px-nof-24 md:pb-nof-32\n border border-solid border-nof-neutral-contrast-low bg-nof-neutral-contrast-very-low rounded-nof-small",children:[(0,s.jsxs)("div",{className:"flex flex-row mb-nof-24","data-ab":"shopping-product-card-title",children:[(0,s.jsx)("h3",{className:(0,Z.default)("nof-ui-title-medium","self-center",{"mr-nof-8":!!a}),children:r}),a&&(0,s.jsx)("img",{src:a,alt:"Tuotekuva",className:"h-[80px] ml-auto self-center"})]}),(0,s.jsx)(aw,{listItems:t,fillIcon:!1,containerProps:{"data-ab":"shopping-product-card-description"}}),n&&i?.length&&(0,s.jsxs)("div",{className:"mt-nof-16",children:[(0,s.jsx)("div",{className:"nof-ui-cta-medium flex justify-center items-center w-full",children:(0,s.jsx)(d.$n,{onClick:()=>{l(!o),rK({eventName:o?"subscription_show_less":"subscription_show_more",eventLabel:"product card"})},variant:d.KT.Text,label:n,icon:(0,s.jsx)(o?x.K:y.Z,{})})}),(0,s.jsx)("div",{"aria-hidden":!o,className:(0,Z.default)("grid","overflow-hidden","transition-all","ease-in-out","duration-300",...o?["grid-rows-[1fr]","opacity-100","pt-nof-16"]:["grid-rows-[0fr]","opacity-0"]),children:(0,s.jsx)("div",{className:"flex flex-col gap-nof-24 min-h-nof-0",children:i?.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("h5",{className:"nof-ui-subtitle-small",children:e.heading}),(0,s.jsx)(tw,{className:"nof-ui-body-medium",text:e.body})]},e.heading))})})]})]})},aL=()=>{let{store:{selectedProduct:e,campaignData:t},dispatch:r}=tj(),{store:{misc:a}}=es(),n=t?.products.map(e=>{let r=t?.offers.find(t=>t.productId===e.productId);if(!r)return null;let a=r.pricing.priceSteps[0]??r.pricing.recurringPrice,n=eR(a.packagePrice.priceWithVat/eG(a)),i=(0,s.jsxs)("div",{className:"nof-ui-body-medium flex flex-col gap-nof-2",children:[(0,s.jsx)("span",{className:"nof-ui-subtitle-small",children:e.descriptionTitle}),(0,s.jsxs)("span",{className:"text-nof-sales-default",children:["alk. ",n," â¬/",a.periodLength.unit]})]});return(0,s.jsx)(N.s4,{id:e.productId,ariaLabel:e.descriptionTitle,title:i,children:(0,s.jsx)("div",{className:"mt-nof-0 mx-nof-12 mb-nof-12",children:(0,s.jsx)(aw,{listItems:e.descriptionList,fillIcon:!1})})},e.productId)});return(0,s.jsx)("div",{className:"text-nof-foreground-primary py-nof-32 px-nof-16 md:px-nof-32","data-ab":"shopping-product-selector",children:(0,s.jsx)(N.Dv,{value:e.productId,onChange:a=>{let n=t?.products.find(e=>e.productId===a);n&&n.productId!==e.productId&&r({type:tp,selectedProduct:n})},ariaLabel:a.product_selector?.ariaLabel,containerClassName:"mt-nof-16",children:n})})},aO=()=>{let{store:{campaignData:e,selectedProduct:t,selectedSelector:r,qualifyingSubscription:a,selectedTab:n}}=tj(),{brand:i,userProfile:o}=tk(),{control:l,watch:d,getValues:c}=(0,P.xW)(),{store:{legal:m,formErrors:p,links:f}}=es(),h=c("paymentMethod"),g=d(),b=e?.funnelData.isAbroadSubscription,y=r.offer,x={href:t.termsLink?.url??f?.terms_hs?.url,text:t.termsLink?.label??f?.terms_hs?.label??f?.terms_hs?.url},v=av(o,{firstName:g.firstName,lastName:g.lastName,email:g.email,phoneNumber:g.phoneNumber,street:g.streetAddress,zip:g.zipCode,city:g.zipCode},{hideAddress:b});return(0,s.jsxs)("div",{className:"flex flex-col mt-nof-24 mx-nof-0",children:[(0,s.jsx)(rY,{offer:y,paymentDetails:{paymentMethod:h},customerInfo:v,startDate:g.startTime,isGiftOrder:n===ta,limitedInfo:!0,showOrderPaymentAmount:!1}),(0,s.jsx)(P.xI,{name:"terms",control:l,rules:{required:!0}
1,render:({field:{onChange:n,value:o},fieldState:{error:l}})=>(0,s.jsx)(D.S,{label:aT(m,t),error:l&&p?.invalid_order_section?.label,checked:o,onChange:t=>{e&&t.target.checked&&!rO(rb)&&rF(rC({offer:r.offer,campaignData:e,brand:i,anchorSubscription:a?.product.productName})),n(t)}})}),(0,s.jsxs)("div",{className:"flex gap-nof-16 my-nof-24 mx-nof-0",children:[(0,s.jsx)(u.b,{href:x.href,text:x.text,external:!0}),(0,s.jsx)(u.b,{href:f?.rates_hs?.url,text:f?.rates_hs?.label??f?.rates_hs?.url,external:!0})]})]})},aT=(e,t)=>(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsx)(tw,{text:(()=>{switch(t?.productType){case m.ch.DigiOnly:return e.terms_digionly?.paragraph;case m.ch.PrintOnly:return e.terms_printonly?.paragraph;case m.ch.Hybrid:default:return e.terms_non_digionly?.paragraph}})()})}),aA=({children:e})=>(0,s.jsx)("div",{className:"grid grid-cols-2 gap-nof-12",children:e}),aM=({children:e})=>(0,s.jsx)("div",{className:"flex flex-col gap-nof-12 my-nof-24",children:e}),a$=[{code:"AF",name:"Afganistan"},{code:"AX",name:"Ahvenanmaa"},{code:"NL",name:"Alankomaat"},{code:"AN",name:"Alankomaiden Antillit"},{code:"AL",name:"Albania"},{code:"DZ",name:"Algeria"},{code:"AS",name:"Amerikan Samoa"},{code:"AD",name:"Andorra"},{code:"AO",name:"Angola"},{code:"AI",name:"Anguilla"},{code:"AG",name:"Antigua ja Barbuda"},{code:"AE",name:"Arabiemiirikunnat"},{code:"AR",name:"Argentiina"},{code:"AM",name:"Armenia"},{code:"AW",name:"Aruba"},{code:"AC",name:"Ascension Island"},{code:"AU",name:"Australia"},{code:"AZ",name:"Azerbaidžan"},{code:"BS",name:"Bahama"},{code:"BH",name:"Bahrain"},{code:"BD",name:"Bangladesh"},{code:"BB",name:"Barbados"},{code:"BE",name:"Belgia"},{code:"BZ",name:"Belize"},{code:"BJ",name:"Benin"},{code:"BM",name:"Bermuda"},{code:"BT",name:"Bhutan"},{code:"BO",name:"Bolivia"},{code:"BA",name:"Bosnia ja Hertsegovina"},{code:"BW",name:"Botswana"},{code:"BV",name:"Bouvet'nsaari"},{code:"BR",name:"Brasilia"},{code:"IO",name:"Brittil\xe4inen Intian valtameren alue"},{code:"VG",name:"Brittil\xe4iset Neitsytsaaret"},{code:"BN",name:"Brunei"},{code:"BG",name:"Bulgaria"},{code:"BF",name:"Burkina Faso"},{code:"BI",name:"Burundi"},{code:"KY",name:"Caymansaaret"},{code:"EA",name:"Ceuta, Melilla"},{code:"CL",name:"Chile"},{code:"CP",name:"Clippertoninsaari"},{code:"CK",name:"Cookinsaaret"},{code:"CR",name:"Costa Rica"},{code:"DG",name:"Diego Garcia"},{code:"DJ",name:"Djibouti"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominikaaninen tasavalta"},{code:"EC",name:"Ecuador"},{code:"EG",name:"Egypti"},{code:"SV",name:"El Salvador"},{code:"ER",name:"Eritrea"},{code:"ES",name:"Espanja"},{code:"ET",name:"Etiopia"},{code:"ZA",name:"Etel\xe4-Afrikka"},{code:"GS",name:"Etel\xe4-Georgia ja Etel\xe4iset Sandwichsaaret"},{code:"FK",name:"Falklandinsaaret"},{code:"FO",name:"F\xe4rsaaret"},{code:"FJ",name:"Fidži"},{code:"PH",name:"Filippiinit"},{code:"GA",name:"Gabon"},{code:"GM",name:"Gambia"},{code:"GE",name:"Georgia"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GD",name:"Grenada"},{code:"GL",name:"Gr\xf6nlanti"},{code:"GP",name:"Guadeloupe"},{code:"GU",name:"Guam"},{code:"GT",name:"Guatemala"},{code:"GG",name:"Guernsey"},{code:"GN",name:"Guinea"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HT",name:"Haiti"},{code:"HM",name:"Heard ja McDonaldinsaaret"},{code:"HN",name:"Honduras"},{code:"HK",name:"Hongkong"},{code:"ID",name:"Indonesia"},{code:"IN",name:"Intia"},{code:"IQ",name:"Irak"},{code:"IR",name:"Iran"},{code:"IE",name:"Irlanti"},{code:"IS",name:"Islanti"},{code:"IL",name:"Israel"},{code:"IT",name:"Italia"},{code:"TL",name:"It\xe4-Timor"},{code:"AT",name:"It\xe4valta"},{code:"JM",name:"Jamaika"},{code:"JP",name:"Japani"},{code:"YE",name:"Jemen"},{code:"JE",name:"Jersey"},{code:"JO",name:"Jordania"},{code:"CX",name:"Joulusaari"},{code:"KH",name:"Kambodža"},{code:"CM",name:"Kamerun"},{code:"CA",name:"Kanada"},{code:"IC",name:"Kanariansaaret"},{code:"CV",name:"Kap Verde"},{code:"KZ",name:"Kazakstan"},{code:"KE",name:"Kenia"},{code:"CF",name:"Keski-Afrikan tasavalta"},{code:"CN",name:"Kiina"},{code:"KG",name:"Kirgisia"},{code:"KI",name:"Kiribati"},{code:"CO",name:"Kolumbia"},{code:"KM",name:"Komorit"},{code:"CD",name:"Kongon demokraattinen tasavalta"},{code:"CG",name:"Kongon tasavalta"},{code:"CC",name:"Kookossaaret"},{code:"KP",name:"Korean demokraattinen kansantasavalta"},{code:"KR",name:"Korean tasavalta"},{code:"GR",name:"Kreikka"},{code:"HR",name:"Kroatia"},{code:"CU",name:"Kuuba"},{code:"KW",name:"Kuwait"},{code:"CY",name:"Kypros"},{code:"LA",name:"Laos"},{code:"LV",name:"Latvia"},{code:"LS",name:"Lesotho"},{code:"LB",name:"Libanon"},{code:"LR",name:"Liberia"},{code:"LY",name:"Libya"},{code:"LI",name:"Liechtenstein"},{code:"LT",name:"Liettua"},{code:"LU",name:"Luxemburg"},{code:"EH",name:"L\xe4nsi-Sahara"},{code:"MO",name:"Macao"},{code:"MG",name:"Madagaskar"},{code:"MK",name:"Makedonia"},{code:"MW",name:"Malawi"},{code:"MV",name:"Malediivit"},{code:"MY",name:"Malesia"},{code:"ML",name:"Mali"},{code:"MT",name:"Malta"},{code:"IM",name:"Mansaari"},{code:"MA",name:"Marokko"},{code:"MH",name:"Marshallinsaaret"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MU",name:"Mauritius"},{code:"YT",name:"Mayotte"},{code:"MX",name:"Meksiko"},{code:"FM",name:"Mikronesian liittovaltio"},{code:"MD",name:"Moldova"},{code:"MC",name:"Monaco"},{code:"MN",name:"Mongolia"},{code:"ME",name:"Montenegro"},{code:"MS",name:"Montserrat"},{code:"MZ",name:"Mosambik"},{code:"MM",name:"Myanmar"},{code:"NA",name:"Namibia"},{code:"NR",name:"Nauru"},{code:"NP",name:"Nepal"},{code:"NI",name:"Nicaragua"},{code:"NE",name:"Niger"},{code:"NG",name:"Nigeria"},{code:"NU",name:"Niue"},{code:"NF",name:"Norfolkinsaari"},{code:"NO",name:"Norja"},{code:"CI",name:"Norsunluurannikko"},{code:"OM",name:"Oman"},{code:"PK",name:"Pakistan"},{code:"PW",name:"Palau"},{code:"PS",name:"Palestiina"},{code:"PA",name:"Panama"},{code:"PG",name:"Papua-Uusi-Guinea"},{code:"PY",name:"Paraguay"},{code:"PE",name:"Peru"},{code:"MP",name:"Pohjois-Mariaanit"},{code:"PN",name:"Pitcairn"},{code:"PT",name:"Portugali"},{code:"PR",name:"Puerto Rico"},{code:"PL",name:"Puola"},{code:"GQ",name:"P\xe4iv\xe4ntasaajan Guinea"},{code:"QA",name:"Qatar"},{code:"FR",name:"Ranska"},{code:"FX",name:"Ranska (Eurooppaan kuuluvat osat)"},{code:"TF",name:"Ranskan etel\xe4iset alueet"},{code:"GF",name:"Ranskan Guayana"},{code:"PF",name:"Ranskan Polynesia"},{code:"RE",name:"R\xe9union"},{code:"RO",name:"Romania"},{code:"RW",name:"Ruanda"},{code:"SE",name:"Ruotsi"},{code:"SH",name:"Saint Helena"},{code:"KN",name:"Saint Kitts ja Nevis"},{code:"LC",name:"Saint Lucia"},{code:"PM",name:"Saint-Pierre ja Miquelon"},{code:"VC",name:"Saint Vincent ja Grenadiinit"},{code:"DE",name:"Saksa"}
1,{code:"SB",name:"Salomonsaaret"},{code:"ZM",name:"Sambia"},{code:"WS",name:"Samoa"},{code:"SM",name:"San Marino"},{code:"ST",name:"S\xe3o Tom\xe9 ja Pr\xedncipe"},{code:"SA",name:"Saudi-Arabia"},{code:"SN",name:"Senegal"},{code:"RS",name:"Serbia"},{code:"SC",name:"Seychellit"},{code:"SL",name:"Sierra Leone"},{code:"SG",name:"Singapore"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"SO",name:"Somalia"},{code:"LK",name:"Sri Lanka"},{code:"SD",name:"Sudan"},{code:"SR",name:"Suriname"},{code:"SJ",name:"Svalbard ja Jan Mayen"},{code:"SZ",name:"Swazimaa"},{code:"CH",name:"Sveitsi"},{code:"SY",name:"Syyria"},{code:"TJ",name:"Tadžikistan"},{code:"TW",name:"Taiwan"},{code:"TZ",name:"Tansania"},{code:"DK",name:"Tanska"},{code:"TH",name:"Thaimaa"},{code:"TG",name:"Togo"},{code:"TK",name:"Tokelau"},{code:"TO",name:"Tonga"},{code:"TT",name:"Trinidad ja Tobago"},{code:"TA",name:"Tristan da Cunha"},{code:"TD",name:"Tšad"},{code:"CZ",name:"Tšekki"},{code:"TN",name:"Tunisia"},{code:"TR",name:"Turkki"},{code:"TM",name:"Turkmenistan"},{code:"TC",name:"Turks- ja Caicossaaret"},{code:"TV",name:"Tuvalu"},{code:"UG",name:"Uganda"},{code:"UA",name:"Ukraina"},{code:"HU",name:"Unkari"},{code:"UY",name:"Uruguay"},{code:"NC",name:"Uusi-Kaledonia"},{code:"NZ",name:"Uusi-Seelanti"},{code:"UZ",name:"Uzbekistan"},{code:"BY",name:"Valko-Ven\xe4j\xe4"},{code:"VU",name:"Vanuatu"},{code:"VA",name:"Vatikaanivaltio"},{code:"VE",name:"Venezuela"},{code:"RU",name:"Ven\xe4j\xe4"},{code:"VN",name:"Vietnam"},{code:"EE",name:"Viro"},{code:"WF",name:"Wallis ja Futunasaaret"},{code:"GB",name:"Yhdistynyt kuningaskunta"},{code:"US",name:"Yhdysvallat"},{code:"VI",name:"Yhdysvaltain Neitsytsaaret"}],aF=()=>{let{store:{userProfile:e}}=tj(),{store:{customerFormLabel:t,formErrors:r}}=es(),{getFieldState:a,formState:{dirtyFields:n,errors:i},register:o}=(0,P.xW)(),l={requiredError:r?.field_is_required?.label,faultyError:r?.faulty?.label,inputLabels:t},d=r?.invalid_phone_number_format_error?.label?`. ${r?.invalid_phone_number_format_error?.label}`:"",c=e=>{let t=e.split(".");return t[t.length-1]},u=Object.values(ao).map(e=>{let t=a(e).error;return{key:e,text:t?tB(c(e),t,l):""}}).filter(e=>!!e.text);return(0,s.jsxs)("div",{children:[u.length>0&&(0,s.jsx)(aM,{children:u.map(e=>(0,s.jsx)(w.F,{text:e.text,variant:w.K.Warning},e.key))}),(0,s.jsxs)("div",{"data-testid":"abroad-info-wrapper",className:"p-nof-16 nof-ui-body-medium flex flex-col gap-nof-4 rounded-nof-small border-solid border-[1px] border-nof-neutral-contrast-default text-nof-foreground-primary",children:[e?.firstName&&e.lastName&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{children:[e.firstName," ",e.lastName]}),(0,s.jsx)("p",{children:e.email})]}),(0,s.jsx)("div",{className:"flex flex-col justify-start mt-nof-24 w-full",children:(0,s.jsx)("div",{className:"mb-nof-12",children:(0,s.jsxs)(aA,{children:[(0,s.jsx)(L.k,{label:t?.phone_number?.label,type:L.N.Tel,defaultValue:"+358",autoComplete:"tel",activated:!!n.abroad?.phoneNumber,error:i.abroad?.phoneNumber&&tB(aa.PhoneNumber,i.abroad?.phoneNumber,l,d),...o(ao.PhoneNumber,{required:!0,pattern:eM,setValueAs:e=>e.replace(/\s/g,"").trim()})}),(0,s.jsx)(C.l6,{label:t?.country?.label,placeholder:t?.country_placeholder?.label,error:i.abroad?.country?tB(c(ao.Country),i.abroad?.country,l):void 0,...o(ao.Country,{required:!0}),children:a$.map(e=>(0,s.jsx)(C.c$,{value:e.code,children:e.name},e.code))})]})})})]})]})},aK={FirstName:eT,LastName:eT,Email:/^(?=.{0,254}$)((?!\.)(?!.*\.@)(?!.*\.\.)(?=.{1,64}@)[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+)@([a-zA-Z0-9][a-zA-Z0-9-]{0,62}(?<!-)\.)+[a-zA-Z]{2,63}$/,StreetAddress:eA,ZipCode:/^\d{5}$/,PostOffice:eA},aR=({isEditMode:e,customerFormLabel:t,formErrorsResource:r,addressInfo:a,isGiftReceiver:n=!1})=>{let{store:{userProfile:i,selectedTab:o}}=tj(),{store:{buttonLabel:l,paragraph:c,infoHighlights:u}}=es(),{formState:{dirtyFields:m,errors:f},register:h,getValues:g,getFieldState:b}=(0,P.xW)(),y=n?ai:aa,x=[...n?[y.FirstName,y.LastName,y.Email]:[],y.PhoneNumber,y.StreetAddress,y.ZipCode,y.PostOffice],v=g(),{values:_,errors:j,dirtyFields:S,contact:E}=n?{values:v.gift,errors:f.gift,dirtyFields:m.gift,contact:v.gift}:{values:v,errors:f,dirtyFields:m,contact:i},I=j?.streetAddress?.type==="manual",{deliveryServiceDescription:k,isLoading:N}=a,{isEditMode:D,setIsEditMode:C,pendingSave:O,handleOnChange:T,onExitEditMode:A}=(({initialEditMode:e,fields:t,sectionFields:r,hasAddressValidationErrors:a,addressInfo:n,formErrorsResource:i})=>{let{clearErrors:o,trigger:s,setError:l,getValues:d,getFieldState:c}=(0,P.xW)(),{isInvalidAddress:u,isValidationError:m,isLoading:f,fetchAddressInfo:h,clearAddressInfo:g}=n,[b,y]=(0,p.useState)(e),[x,v]=(0,p.useState)(!1);return(0,p.useEffect)(()=>
1{if(x&&!f){if(v(!1),u||m)return void l(t.StreetAddress,{type:"manual",message:u?i?.address_not_found?.label:i?.address_validation?.label});y(!1)}},[x,f,u,m,l,t,i]),(0,p.useEffect)(()=>{!b&&a&&y(!0)},[b,a]),{isEditMode:b,setIsEditMode:y,pendingSave:x,handleOnChange:async e=>{(e===t.StreetAddress||e===t.ZipCode)&&(v(!1),g(),a&&o([t.StreetAddress,t.ZipCode,t.PostOffice]))},onExitEditMode:async()=>{a||(await s(r),r.some(e=>c(e).invalid)||(v(!0),h(d(t.StreetAddress)??"",d(t.ZipCode)??"")))}}})({initialEditMode:e,fields:y,sectionFields:x,hasAddressValidationErrors:I,addressInfo:a,formErrorsResource:r}),M=l?.save_changes?.label||"Tallenna muutokset",$=n||o!==ta,F={requiredError:r?.field_is_required?.label,faultyError:r?.faulty?.label,inputLabels:t},K=e=>tU(e,F.inputLabels,r?.field_is_required?.label),R=(e,t)=>tW(e,F.inputLabels,r?.faulty?.label,t),V=R(aa.PhoneNumber,r?.invalid_phone_number_format_error?.label?`. ${r.invalid_phone_number_format_error.label}`:""),B=e=>h(y[e],{required:K(aa[e]),pattern:{value:aK[e],message:R(aa[e])},maxLength:{value:250,message:R(aa[e])},setValueAs:e=>e.trim(),onChange:()=>{T(y[e])}}),U={[aa.PhoneNumber]:h(y.PhoneNumber,{required:K(aa.PhoneNumber),pattern:{value:eM,message:V},maxLength:{value:20,message:V},minLength:{value:3,message:V},setValueAs:e=>e.replaceAll(/\s/g,""),onChange:()=>{T(y.PhoneNumber)}}),[aa.StreetAddress]:B("StreetAddress"),[aa.ZipCode]:B("ZipCode"),[aa.PostOffice]:B("PostOffice")},W=n&&{[aa.FirstName]:B("FirstName"),[aa.LastName]:B("LastName"),[aa.Email]:B("Email")},G=x.map(e=>({key:e,text:b(e).error?.message??""})).filter(e=>!!e.text),z=E?.firstName&&E.lastName&&`${E.firstName} ${E.lastName}`,H=!n&&!!i?.phoneVerified&&!!i?.phone;return(0,s.jsxs)("div",{children:[G.length>0&&(0,s.jsx)(aM,{children:G.map(e=>(0,s.jsx)(w.F,{text:e.text,variant:w.K.Warning},e.key))}),(0,s.jsxs)("div",{"data-testid":n?"gift-receiver-info-wrapper":"customer-info-wrapper",className:"p-nof-16 nof-ui-body-medium flex flex-col gap-nof-4 rounded-nof-small border-solid border-[1px] border-nof-neutral-contrast-default text-nof-foreground-primary",children:[!(n&&D)&&z&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:z}),(0,s.jsx)("p",{children:E?.email})]}),D?(0,s.jsxs)("div",{className:"flex flex-col justify-start gap-nof-8 w-full",children:[W&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{children:(0,s.jsxs)(aA,{children:[(0,s.jsx)(L.k,{label:t?.first_name?.label,type:L.N.Text,autoComplete:"given-name",activated:!!S?.firstName,error:j?.firstName?.message,...W[aa.FirstName]}),(0,s.jsx)(L.k,{label:t?.last_name?.label,type:L.N.Text,autoComplete:"family-name",activated:!!S?.lastName,error:j?.lastName?.message,...W[aa.LastName]})]})}),(0,s.jsx)("div",{children:(0,s.jsx)(L.k,{label:t?.email?.label,type:L.N.Text,autoComplete:"email",activated:!!S?.email,helperText:c?.gift_email_helper?.label,error:j?.email?.message,...W[aa.Email]})})]}),H?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:i?.phone}),(0,s.jsx)(w.F,{variant:w.K.Info,fullWidth:!0,text:u?.phone_verified_notice?.label})]}):(0,s.jsx)("div",{className:"mt-nof-8",children:(0,s.jsx)(L.k,{label:t?.phone_number?.label,type:L.N.Tel,autoComplete:"tel",defaultValue:"+358",activated:!!S?.phoneNumber,error:j?.phoneNumber?.message,...U[aa.PhoneNumber]})}),(0,s.jsx)("div",{children:(0,s.jsx)(L.k,{label:t?.street_address?.label,type:L.N.Text,autoComplete:"address-line1",activated:!!S?.streetAddress,error:j?.streetAddress?.message,...U[aa.StreetAddress]})}),(0,s.jsx)("div",{className:"mb-nof-12",children:(0,s.jsxs)(aA,{children:[(0,s.jsx)(L.k,{label:t?.zip_code?.label,type:L.N.Text,autoComplete:"postal-code",inputMode:"numeric",activated:!!S?.zipCode,error:j?.zipCode?.message,...U[aa.ZipCode]}),(0,s.jsx)(L.k,{label:t?.post_office?.label,type:L.N.Text,autoComplete:"address-level2",activated:!!S?.postOffice,error:j?.postOffice?.message,...U[aa.PostOffice]})]})}),(0,s.jsx)(d.$n,{label:M,variant:d.KT.PrimarySmall,loading:O&&N,loadingLabel:M,onClick:async e=>{e.preventDefault(),await A()}})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:H?i?.phone:_?.phoneNumber}),(0,s.jsx)("p",{children:_?.streetAddress}),(0,s.jsxs)("p",{children:[_?.zipCode," ",_?.postOffice]}),$&&k&&(0,s.jsxs)("div",{className:"mt-nof-8 mb-nof-8 flex flex-col gap-nof-8",children:[(0,s.jsx)("p",{className:"nof-ui-subtitle-small",children:c?.delivery_service_title?.label}),(0,s.jsx)(w.F,{text:k,variant:w.K.Info,fullWidth:!0})]}),(0,s.jsx)(d.$n,{label:l?.edit_info?.label||"Muokkaa tietoja",icon:(0,s.jsx)(s.Fragment,{}),variant:d.KT.Text,containerClassName:"text-nof-cta-accent underline pointer p-nof-0 min-h-nof-0",onClick:e=>{e.preventDefault(),C(!0)}})]})]})]})},aV=()=>{let{store:{paragraph:e,links:t}}=es();return(0,s.jsxs)("div",{className:"flex flex-col items-center gap-nof-24 text-nof-foreground-primary",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center gap-nof-16",children:[(0,s.jsx)("h3",{className:"nof-ui-title-medium",children:e?.company_order_header?.label}),(0,s.jsx)("p",{className:"nof-ui-body-medium",children:e?.company_order_paragraph?.label})]}),(0,s.jsx)("div",{children:(0,s.jsx)(d.z9,{"aria-label":t?.company_
1subscription?.ariaLabel??t?.company_subscription?.label,fullWidth:!0,icon:(0,s.jsx)($.P,{}),label:t?.company_subscription?.label??"",link:{href:t?.company_subscription?.url}})})]})},aB=({name:e,label:t,allowedDates:r,description:a,onChange:n})=>{let{control:i}=(0,P.xW)(),{store:o}=es(),l={requiredError:o.formErrors?.field_is_required?.label,faultyError:o.formErrors?.faulty?.label,inputLabels:o.customerFormLabel},d=t6(new Date),c=e=>!r.filter(e=>e>=d).includes(e);return(0,s.jsx)(P.xI,{control:i,name:e,rules:{required:!0,validate:{isValidDate:t=>!t||!c(t)||tW(e,l.inputLabels,l.faultyError)}},render:({field:{value:r,onChange:i,...o},fieldState:{error:d}})=>(0,s.jsx)(F.l,{label:t,overlayClassName:"shopping-modal",value:r,onChange:e=>{e&&(n?.(e),i(e))},description:a,isDateUnavailable:c,error:d&&tB(e,d,l),...o})})},aU=({addressInfo:e})=>{let{store:{customerFormLabel:t,formErrors:r}}=es(),{earliestStartDate:a}=tk(),{store:n}=tj(),{publicationDays:i}=n.selectedSelector.offer,o=n.selectedProduct.productType===m.ch.PrintOnly;return(0,s.jsxs)("div",{className:"flex flex-col justify-start w-full",children:[(0,s.jsx)(aR,{isGiftReceiver:!0,isEditMode:!0,customerFormLabel:t,formErrorsResource:r,addressInfo:e}),!o&&(0,s.jsx)("div",{className:"mt-nof-12",children:(0,s.jsx)(aA,{children:(0,s.jsx)(aB,{name:"startTime",label:t?.start_time?.label,allowedDates:rt(i,a)})})})]})},aW=({showGiftTab:e,showCompanyTab:t,addressInfo:r,giftAddressInfo:a})=>{let{store:{tabLabel:n,customerFormLabel:i,formErrors:o}}=es(),{store:{selectedTab:l,userProfile:d},dispatch:c}=tj(),u=(0,p.useMemo)(()=>{if(!d)return!0;let{street:e,zipCode:t,city:r}=d.address??{};return!(d.phone&&e&&t&&r)},[d]),m=(0,p.useMemo)(()=>[tr,...e?[ta]:[],...t?[tn]:[]],[e,t]);return m.length<=1?(0,s.jsx)(aR,{isEditMode:u,customerFormLabel:i,formErrorsResource:o,addressInfo:r}):(0,s.jsxs)(M.oz,{value:l,onValueChange:e=>{c({type:tf,selectedTab:e}),rK({eventName:"subscription_type_select",eventLabel:e})},children:[(0,s.jsx)("div",{className:"mb-nof-24",children:(0,s.jsx)(M.wb,{"aria-label":n?.customer_tab_aria_label?.ariaLabel,children:m.map(e=>(0,s.jsx)(aG,{tabType:e,tabCount:m.length},e))})}),m.map(e=>(0,s.jsx)(az,{tabType:e,addressInfo:r,giftAddressInfo:a},e))]})},aG=({tabType:e,tabCount:t})=>{let{store:{tabLabel:r}}=es(),a=t>2?"hidden sm:flex items-center":"";switch(e){case tr:return(0,s.jsx)(M.tu,{value:tr,"aria-label":r?.tilaan_itselleni?.ariaLabel??r?.tilaan_
1itselleni?.label,children:(0,s.jsxs)("div",{className:"flex items-center gap-nof-8",children:[(0,s.jsx)("span",{"data-testid":`${tr}-icon`,className:a,children:(0,s.jsx)(O.V,{})}),(0,s.jsx)("span",{children:r?.tilaan_itselleni?.label})]})});case ta:return(0,s.jsx)(M.tu,{value:ta,"aria-label":r?.tilaa_lahjaksi?.ariaLabel??r?.tilaa_lahjaksi?.label,children:(0,s.jsxs)("div",{className:"flex items-center gap-nof-8",children:[(0,s.jsx)("span",{"data-testid":`${ta}-icon`,className:a,children:(0,s.jsx)(A.o,{})}),(0,s.jsx)("span",{children:r?.tilaa_lahjaksi?.label})]})});case tn:return(0,s.jsx)(M.tu,{value:tn,"aria-label":r?.yritystilaus?.ariaLabel??r?.yritystilaus?.label,children:(0,s.jsxs)("div",{className:"flex items-center gap-nof-8",children:[(0,s.jsx)("span",{"data-testid":`${tn}-icon`,className:a,children:(0,s.jsx)(T.n,{})}),(0,s.jsx)("span",{children:r?.yritystilaus?.label})]})});default:return null}},az=({tabType:e,addressInfo:t,giftAddressInfo:r})=>{let{store:{formSectionTitle:a,customerFormLabel:n,formErrors:i}}=es(),{store:{userProfile:o}}=tj(),l=(0,p.useMemo)(()=>{if(!o)return!0;let{street:e,zipCode:t,city:r}=o.address??{};return!(o.phone&&e&&t&&r)},[o]);switch(e){case tr:return(0,s.jsx)(M.JS,{value:tr,children:(0,s.jsx)(aR,{isEditMode:l,customerFormLabel:n,formErrorsResource:i,addressInfo:t})});case ta:return(0,s.jsx)(M.JS,{value:ta,children:(0,s.jsxs)("div",{className:"flex flex-col gap-nof-24",children:[(0,s.jsx)("h4",{className:"nof-ui-title-medium text-nof-foreground-primary",children:a?.payer_info?.label}),(0,s.jsx)(aR,{isEditMode:l,customerFormLabel:n,formErrorsResource:i,addressInfo:t}),(0,s.jsx)("h4",{className:"nof-ui-title-medium text-nof-foreground-primary",children:a?.gift_receiver_info?.label}),(0,s.jsx)(aU,{addressInfo:r})]})});case tn:return(0,s.jsx)(M.JS,{value:tn,children:(0,s.jsx)(aV,{})});default:return null}},aH=()=>{let{store:{selectedProduct:e,campaignData:t}}=tj(),{store:{legal:r}}=es(),a=e.productType===m.ch.PrintOnly?r.default_legal_print?.paragraph:r.default_legal?.paragraph;return(0,s.jsxs)("div",{className:"my-nof-32 mx-nof-16 md:mx-nof-32",children:[t?.funnelData.optionalFooter&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tw,{text:t?.funnelData.optionalFooter,className:"text-nof-foreground-muted nof-ui-body-small"}),(0,s.jsx)("br",{})]}),(0,s.jsx)(tw,{text:a,className:"text-nof-foreground-muted nof-ui-body-small"})]})},aq=(e,t)=>`${e}:${t}`,aY=({radioSelectionOnChangePrompt:e})=>{let{store:t}=tj(),{store:{misc:r,paragraph:a,paymentTypeLabel:n,defaultCycloneDescription:i}}=es(),o=t.selectors,l=t.subscriptionKindState?.active===m.Ew.Fixed,d=t.campaignData?.funnelData.spotlightOffer,c=t.campaignData?.funnelData.spotlightOffers,u=t.campaignData?.funnelData.displayOfferPeriodInfo,f=[...new Set(o.flatMap(({offer:e})=>e.paymentMethods?.map(({paymentType:e})=>e)))].length>1,[h,g]=(0,p.useState)({...t.subscriptionKindState?.active&&{[aq(t.selectedProduct.productId,t.subscriptionKindState.active)]:t.selectedSelector.id}}),b=(0,p.useCallback)(r=>{t.subscriptionKindState?.active&&g({...h,[aq(t.selectedProduct.productId,t.subscriptionKindState.active)]:r}),e(r)},[g,e,h,t.selectedProduct,t.subscriptionKindState?.active]);(0,p.useEffect)(()=>{if((t.selectedSelector.offer.subscriptionKind!==t.subscriptionKindState?.active||t.selectedSelector.offer.productId!==t.selectedProduct.productId)&&t.subscriptionKindState?.active){let e=h[aq(t.selectedProduct.productId,t.subscriptionKindState.active)]??o.find(e=>e.offer.subscriptionKind===t.subscriptionKindState?.active&&e.offer.productId===t.selectedProduct.productId)?.id;e&&b(e)}},[t.subscriptionKindState?.active,t.selectedProduct,t.selectedSelector.offer.subscriptionKind,t.selectedSelector.offer.productId,o,h,b]);let y=o.filter(e=>e.offer.subscriptionKind===t.subscriptionKindState?.active&&e.offer.productId===t.selectedProduct.productId).map(e=>{var t;let a,o,u,p,h,{id:g,index:b,offer:y}=e,x=y.paymentMethods,v=y.pricing.priceSteps[0],_=y.pricing.recurringPrice,j=eB(_?_.periodLength:v.periodLength),S=d&&eL(d.offerIndex)===b?d?.label:void 0;c&&c.length>0&&(S=c.find(e=>eL(e.offerIndex)===b)?.label??void 0);let E=`${r?.invoicing_period_label?.label} ${eB(v.periodLength)}, hinta ${eR(eU(v))} ⬠per ${v.periodLength.unit}`,I=(0,s.jsxs)("div",{className:"flex align-center gap-nof-8 w-full items-center",children:[(0,s.jsxs)("span",{className:"nof-ui-body-medium text-nof-foreground-primary",children:[j,!l&&" v\xe4lein"]}),(t=S,a=y.pricing.priceSteps[0],o=y.pricing.recurringPrice,u=y.pricing.priceSteps,p=y.continuationCampaignId&&u.length>1&&i?((e,t)=>
1{if(!t)return null;let r=0,a=e.reduce((e,t)=>{let a=t.periodLength.amount*t.periodCount,n=eU(t)*a;return r+=((e,t)=>{switch(t){case"pv":case"p\xe4iv\xe4":case"p\xe4iv\xe4\xe4":return 12/365*e;case"vko":case"viikko":case"viikkoa":return 12/52*e;case"vuosi":case"vuotta":return 12*e;default:return e}})(a,t.periodLength.unit),e+n},0),n=eU(t)*r-a;return n<=0?null:eR(n)})(u,o):tP(a,o),h=`${r?.saving?.label} ${p} â¬`,(0,s.jsxs)(s.Fragment,{children:[t&&(0,s.jsx)("span",{className:"nof-ui-body-medium text-nof-sales-default",children:t}),(()=>{if(a.periodExtraLength){let e=eB({amount:eW(a),unit:a.periodExtraLength.unit});return(0,s.jsxs)("span",{className:"nof-ui-body-medium text-nof-sales-default ml-auto",children:["+ ",e," ",r.free_period.label]})}return p?(0,s.jsx)("div",{className:"flex flex-col ml-auto items-end",children:(0,s.jsx)("span",{className:"nof-ui-body-medium text-nof-sales-default",id:`save-price-${g}`,children:h})}):null})()]}))]});return(0,s.jsx)(N.s4,{id:g,ariaLabel:E,title:I,ariaDescribedby:`save-price-${g} info-highlight-${g}`,children:f&&x?.length===1&&x[0].paymentType&&_&&(0,s.jsx)("div",{className:"mt-nof-0 mx-nof-12 mb-nof-12",children:(0,s.jsx)(w.F,{id:`info-highlight-${g}`,text:`${eB(_.periodLength)} ${r?.with_period_only_method?.label} ${((e,t)=>{switch(e){case m.$f.Bank:return t?.bank?.label?.toLowerCase();case m.$f.EmailInvoice:case m.$f.LetterInvoice:return t?.invoice?.label?.toLowerCase();case m.$f.EInvoice:return t?.e_invoice?.label?.toLowerCase();case m.$f.Credit:default:return t?.credit?.label?.toLowerCase()}})(x[0].paymentType??m.$f.Credit,n)}`,fullWidth:!0})})},g)}),x=l?r.duration?.label:r?.invoicing_period_label?.label;return(0,s.jsxs)("div",{className:"mt-nof-32 mb-nof-16","data-ab":"shopping-offer-selector",children:[(0,s.jsx)("h4",{className:"text-nof-foreground-primary mb-nof-8 nof-ui-subtitle-small",children:x}),u&&(0,s.jsxs)("div",{className:"flex items-center gap-nof-4 mb-nof-12",children:[(0,s.jsx)(K.e,{color:"var(--nof-semantic-color-foreground-accent)"}),(0,s.jsx)("span",{className:"nof-ui-body-small text-nof-foreground-muted",children:a?.offerselector_subtitle?.label})]}),(0,s.jsx)(N.Dv,{value:t.selectedSelector.id,onChange:e=>{b(e??"")},ariaLabel:r?.invoicing_period_label?.ariaLabel??r?.invoicing_period_label?.label,containerClassName:"mt-nof-16",children:y})]})},aZ=()=>{let{dispatch:e,store:t}=tj(),{store:{misc:r,paragraph:a}}=es(),[n,i]=(0,p.useState)(t.subscriptionKindState.display.map(e=>({checked:e.id===t.subscriptionKindState.active,id:e.id,label:e.label}))),o=n.length>1;(0,p.useEffect)(()=>{i(t.subscriptionKindState.display.map(e=>({checked:e.id===t.subscriptionKindState.active,id:e.id,label:e.label})))},[]),(0,p.useEffect)(()=>{i(n?.map(e=>e.id===t.subscriptionKindState.active?{...e,checked:!0}:{...e,checked:!1}))},[t.subscriptionKindState]);let l=(0,p.useCallback)(r=>{e({type:ty,subscriptionKindState:{...t.subscriptionKindState,active:r}})},[e]);return(0,s.jsxs)("div",{className:(0,Z.default)("flex flex-col",o?"gap-nof-8":"gap-nof-16"),children:[(0,s.jsxs)("h4",{className:"text-nof-foreground-primary nof-ui-subtitle-small",children:[r?.select_order_period_label?.label,!o&&(0,s.jsx)("span",{className:"nof-ui-body-medium text-nof-foreground-primary ml-nof-8",children:n[0].label})]}),o&&(0,s.jsx)(R.z6,{"aria-label":r?.select_order_period_label?.ariaLabel??"","aria-required":"true",label:"",name:"order-type",value:t.subscriptionKindState.active,onValueChange:l,variant:"box",children:n.map(e=>(0,s.jsx)(R.sx,{value:e.id,children:e.label},e.id))}),(0,s.jsx)("p",{className:"nof-ui-body-small text-nof-foreground-muted",children:rU(a,t.subscriptionKindState?.active)})]})},aJ=({pricing:e,priceDisplayStyle:t})=>{let r=e.priceSteps[0],a=a0(e,t===m.Zc.WeeklyPrice),n=eR(r.packagePrice.priceWithVat),i=`${r.periodLength.amount} ${r.periodLength.unit}`;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-end gap-nof-6 px-nof-16 pt-nof-6","data-ab":"shopping-offer-description-price",children:[(0,s.jsxs)("span",{className:"nof-ui-title-large text-nof-sales-default h-nof-32",children:[n," â¬"]}),(0,s.jsxs)("span",{className:"nof-ui-subtitle-small text-nof-sales-default",children:["/ ",i]})]}),(0,s.jsx)(tw,{content:a,dataAb:"shopping-offer-description-text",className:"px-nof-16 pb-nof-8 nof-ui-body-medium"})]})},aQ=e=>({type:"listItem",content:[{paragraph:e,type:"text"}]}),aX=(e,t=0)=>`(laskutetaan ${eR(e.packagePrice.priceWithVat)} â¬/${eB(e.periodLength)} v\xe4lein${t>0&&50!==t?`, -${t} %`:""})`,a0=(e,t)=>{let r=t=>0===t?1===eG(e.priceSteps[t])?"Ensimm\xe4inen":"Ensimm\xe4iset":1===eG(e.priceSteps[t])?"Seuraava":"Seuraavat",a=[];
1for(let[n,i]of e.priceSteps.entries()){let o=r(n),s=ez(i),l=eR(i.packagePrice.priceWithVat),d=eR(eJ(i)),c=e.recurringPrice?rz(i,e.recurringPrice):0,u=50===c?"puoleen hintaan ":"",m=c>0&&50!==c?` (-${c} %) `:"",p=eB(i.periodLength);0===i.packagePrice.priceWithVat?a.push(aQ(`${o} ${s} maksutta`)):0===n?a.push(aQ(t?`${o} ${s} ${d} â¬/vko ${aX(i)}`:`${o} ${s} ${l} â¬`)):a.push(aQ(t?`${o} ${s} ${u}${d} â¬/vko ${aX(i,c)}`:`${o} ${s} ${u}${l} â¬${m}/${p}`))}if(e.recurringPrice){let r=eR(e.recurringPrice.packagePrice.priceWithVat),n=eB(e.recurringPrice.periodLength),i=eR(eJ(e.recurringPrice));a.push(aQ(t?`Sen j\xe4lkeen tilaus jatkuu normaalihintaan ${i} â¬/vko ${aX(e.recurringPrice)}`:`Sen j\xe4lkeen tilaus jatkuu normaalihintaan ${r} â¬/${n} v\xe4lein`))}return{type:"unorderedList",content:a}},a1=({selectedOffer:e,priceDisplayStyle:t})=>{let{store:{campaignData:r}}=tj();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("section",{className:"flex flex-col gap-nof-6 text-nof-foreground-primary border-solid border-[1px] border-nof-foreground-primary rounded-nof-medium",children:e.offer.subscriptionKind===m.Ew.Fixed?(0,s.jsx)(a4,{selectedOffer:e,priceDisplayStyle:t}):(0,s.jsx)(a2,{selectedOffer:e,priceDisplayStyle:t})}),r?.maxAge!==void 0&&(0,s.jsx)("div",{className:"mt-nof-12",children:(0,s.jsx)(w.F,{text:`Alennus on voimassa kunnes t\xe4yt\xe4t ${r.maxAge}. Sen j\xe4lkeen tilaus jatkuu normaalihintaisena.`,fullWidth:!0})})]})},a2=({selectedOffer:e,priceDisplayStyle:t})=>{let{store:{defaultOfferDescription:r}}=es(),a=r?.json?.content?.[1],n=e.offer.pricing,i=n.priceSteps,o=i[0],l=e.offer.continuationCampaignId&&i.length>1,d=n.recurringPrice,c=tP(o,d),u=!!d&&o.packagePrice.priceWithVat===d.packagePrice.priceWithVat&&eB(o.periodLength)===eB(d.periodLength),p=t===m.Zc.WeeklyPrice,f=eR(p?eJ(o):o.packagePrice.priceWithVat/eG(o)),h=p?"vko":o.periodLength.unit,g=()=>eW(o)>0?{type:"paragraph",content:[{type:"text",paragraph:`${eB({amount:eW(o),unit:eV(o.periodLength)})} kaupan p\xe4\xe4lle!`}]}:c?r?.json?.content?.[0]:void 0;return l?(0,s.jsx)(aJ,{pricing:n,priceDisplayStyle:t}):(0,s.jsxs)("div",{className:"flex flex-col gap-nof-6 pb-nof-8",children:[g()&&(0,s.jsx)("div",{className:"flex flex-row",children:(0,s.jsx)(tw,{className:"bg-nof-foreground-accent nof-ui-subtitle-xsmall text-nof-foreground-inverted border border-solid border-r-nof-foreground-accent border-b-nof-foreground-accent border-l-nof-foreground-primary border-t-nof-foreground-primary rounded-br-nof-small rounded-tl-nof-small p-nof-8 m-[-1px]",content:g(),dataAb:"shopping-offer-description-header"})}),(0,s.jsxs)("div",{className:"flex items-end gap-nof-6 px-nof-16 pt-nof-6","data-ab":"shopping-offer-description-price",children:[(0,s.jsxs)("span",{className:"nof-ui-title-large text-nof-sales-default h-nof-32",children:[f," â¬"]}),(0,s.jsxs)("span",{className:"nof-ui-subtitle-small text-nof-sales-default",children:["/ ",h]}),o.periodLength.amount>1&&(0,s.jsxs)("span",{className:"text-nof-foreground-primary nof-ui-body-medium",children:["(yht. ",eR(o.packagePrice.priceWithVat)," ","â¬/",ez(o),")"]})]}),!u&&(0,s.jsx)(tw,{content:a,dataAb:"shopping-offer-description-text",className:"px-nof-16 nof-ui-body-medium"})]})},a4=({selectedOffer:e})=>{let t=e.offer.pricing.priceSteps[0];return(0,s.jsxs)("div",{className:"flex items-center gap-nof-6 p-nof-16",children:[(0,s.jsxs)("span",{className:"nof-ui-title-large text-nof-sales-default",children:[eR(t.packagePrice.priceWithVat)," â¬"]}),(0,s.jsxs)("span",{className:"text-nof-foreground-primary nof-ui-body-medium",children:["/",eB(t.periodLength)]})]})},a6=()=>{let{store:e,dispatch:t}=tj(),{store:{customerFormLabel:r,paragraph:a}}=es(),{brand:n,earliestStartDate:i}=tk(),{setValue:o,getValues:l}=(0,P.xW)(),d=void 0!==l("paymentMethod"),c=e.qualifyingSubscription?.product.productName,u=e.selectedSelector.offer.subscriptionMode===m.Dm.FreeSubscription&&1===e.selectors.filter(({offer:t})=>t.productId===e.selectedProduct.productId&&t.subscriptionKind===e.subscriptionKindState?.active).length;return(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(aZ,{}),e.selectedProduct.productType===m.ch.PrintOnly?(0,s.jsx)("div",{className:"mb-nof-32",children:(0,s.jsx)(aA,{children:(0,s.jsx)(aB,{name:an,description:a?.date_description_paper?.label,label:r?.start_time?.label,allowedDates:rt(e.selectedSelector.offer.publicationDays,i)})})}):null,!u&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(aY,{radioSelectionOnChangePrompt:r=>{let a=e.selectors.find(e=>e.id===r);a&&(t({type:th,selectedSelector:a}),e.campaignData&&rF(rC({offer:a.offer,campaignData:e.campaignData,brand:n,anchorSubscription:c})),d&&o("paymentMethod",void 0))}}),(0,s.jsx)(a1,{selectedOffer:e.selectedSelector,priceDisplayStyle:e.campaignData?.funnelData.priceDisplayStyle})]})]})},a3=({setStripeElements:e})=>{let{clearErrors:t}=(0,P.xW)(),r=(0,V.HH)();return(0,p.useEffect)(()=>{r&&e(r)},[e,r]),(0,s.jsx)(V.He,{options:{fields:{billingDetails:{address:{country:"never"}}},defaultValues:{billingDetails:{address:{country:"FI"}}},paymentMethodOrder:["apple_pay","google_pay","card"]},onChange:e=>{e.complete&&t("paymentMethod")}})},a8=()=>{let{store:{userProfile:e,selectedSelector:t}}=tj(),{store:{paymentTypeLabel:r,formErrors:a,paymentTypeDesc:n}}=es(),{getValues:i,setValue:o,watch:l,formState:{errors:d},control:c}=(0,P.xW)(),u=l("paymentMethod"),f=t.offer.paymentMethods?.find(e=>e.paymentType===m.$f.Bank),h=f?.recurringPaymentMethods?.find(e=>e.paymentType===m.$f.EmailInvoice),g=f?.recurringPaymentMethods?.find(e=>e.paymentType===m.$f.LetterInvoice),b=(0,p.useMemo)(()=>{let e=i("invoicingMethod");return e||(f?.recurringPaymentMethods?.length===1?f.recurringPaymentMethods[0].paymentType===m.$f.EmailInvoice?m.Cl.Email:m.Cl.Letter:void 0)},[f,i]);return(0,p.useEffect)(()=>{b&&!i("invoicingMethod")&&o("invoicingMethod",b,{shouldValidate:!1,shouldDirty:!1})},[b,i,o]),(0,s.jsxs)("div",{className:"flex flex-col gap-nof-32",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-nof-16",children:[(0,s.jsx)(P.xI,{control:c,name:"bankProvider",rules:{required:u===m.$f.Bank&&(a?.bank_provider_required?.label??!0)},render:({field:e})=>(0,s.jsx)(C.l6,{id:"bankProvider",...e,error:"string"==typeof d.bankProvider?.message?d.bankProvider.message:void 0,label:r?.bank_provider?.label,placeholder:r?.bank_provider_placeholder?.label,value:e.value,onChange:e.onChange,children:f?.bankProviders?.map(e=>(0,s.jsx)(C.c$,{value:e.providerCode,children:e.name},e.providerCode))})}),(0,s.jsx)(tw,{text:n?.bank_desc?.paragraph,className:"nof-ui-body-small text-nof-foreground-muted"})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-nof-16",children:[(0,s.jsx)(P.xI,{control:c,name:"invoicingMethod",rules:{required:u===m.$f.Bank&&(a?.bank_billing_method_required?.label??!0)},render:({field:e})=>(0,s.jsxs)(R.z6,{...e,"aria-required":u===m.$f.Bank,error:"string"==typeof d.invoicingMethod?.message?d.invoicingMethod.message:void 0,label:r?.bank_billing_method?.label,orientation:"horizontal",variant:"box",value:e.value,onValueChange:e.onChange,children:[h&&(0,s.jsx)(R.sx,{value:m.Cl.Email,children:r?.email_invoice?.label}),g&&(0,s.jsx)(R.sx,{value:m.Cl.Letter,children:r?.letter_invoice?.label})]})}),h&&i("invoicingMethod")===m.Cl.Email&&(0,s.jsxs)("div",{className:"nof-ui-body-medium",children:[(0,s.jsx)(tw,{text:n?.invoice_email_desc?.paragraph,className:"nof-ui-body-small text-nof-foreground-muted"}),(0,s.jsx)("span",{className:"nof-ui-body-small text-nof-foreground-muted",children:e?.email})]}),g&&i("invoicingMethod")===m.Cl.Letter&&(0,s.jsx)("div",{className:"nof-ui-body-medium",children:(0,s.jsx)(tw,{text:n?.invoice_letter_desc?.paragraph,className:"nof-ui-body-small text-nof-foreground-muted"})})]})]})},a5=()=>{let{store:{selectedSelector:e}}=tj(),{watch:t,formState:{errors:r},control:a}=(0,P.xW)(),{store:{paymentTypeLabel:n,formErrors:i,paymentTypeDesc:o}}=es(),l=t("paymentMethod"),d=e.offer.paymentMethods?.find(e=>e.paymentType===m.$f.EInvoice);return(0,s.jsxs)("div",{className:"flex flex-col gap-nof-16",children:[(0,s.jsx)(P.xI,{control:a,name:"eInvoiceProvider",rules:{required:l===m.$f.EInvoice&&i?.einvoice_provider_required?.label},render:({field:e})=>(0,s.jsx)(C.l6,{id:"eInvoiceProvider",...e,error:r.eInvoiceProvider?.message,label:n?.einvoice_provider?.label,placeholder:"Valitse",onChange:e.onChange,children:d?.eInvoiceProviders?.map(e=>(0,s.jsx)(C.c$,{value:e.code,children:e.description},e.code))})}),(0,s.jsx)(tw,{text:o?.einvoice_desc?.paragraph,className:"nof-ui-body-small text-nof-foreground-muted"})]})},a7=()=>{let{store:{userProfile:e}}=tj(),{store:{infoHighlights:t,paymentTypeDesc:r}}=es();return(0,s.jsxs)("div",{className:"flex flex-col gap-nof-16",children:[(0,s.jsxs)("div",{className:"nof-ui-body-medium",children:[(0,s.jsx)(tw,{text:r?.invoice_email_desc?.paragraph,className:"nof-ui-body-small text-nof-foreground-muted"}),(0,s.jsx)("span",{className:"nof-ui-body-small text-nof-foreground-muted",children:e?.email})]}),(0,s.jsx)(w.F,{text:t?.payment_by_invoice?.label})]})},a9=()=>{let{store:{infoHighlights:e,paymentTypeDesc:t}}=es();return(0,s.jsxs)("div",{className:"flex flex-col gap-nof-16",children:[(0,s.jsx)("div",{className:"nof-ui-body-medium",children:(0,s.jsx)(tw,{text:t?.invoice_letter_desc?.paragraph,className:"nof-ui-body-small text-nof-foreground-muted"})}),(0,s.jsx)(w.F,{text:e?.payment_by_invoice?.label})]})},ne={OFFER_INFO:"OFFER_INFO",CUSTOMER_INFO:"CUSTOMER_INFO",GIFT_RECEIVER_INFO:"GIFT_RECEIVER_INFO",ABROAD_INFO:"ABROAD_INFO",PAYMENT_INFO:"PAYMENT_INFO",CONFIRM_ORDER:"CONFIRM_ORDER"},nt="cardFailure",nr={[ne.OFFER_INFO]:[],[ne.CUSTOMER_INFO]:Object.values(aa),[ne.GIFT_RECEIVER_INFO]:["gift"],[ne.ABROAD_INFO]:["abroad"],[ne.PAYMENT_INFO]:["paymentMethod","bankProvider","invoicingMethod","eInvoiceProvider"],[ne.CONFIRM_ORDER]:["terms"]},na=[m.$f.Bank,m.$f.Credit,m.$f.EInvoice,m.$f.EmailInvoice,m.$f.LetterInvoice],nn=({setStripeElements:e,stripeElementProps:t})=>{let{store:{selectedSelector:r}}=tj(),{store:{misc:a,paymentTypeLabel:n,formErrors:i}}=es(),{getValues:o,setValue:l,watch:d,control:c,formState:{errors:u}}=(0,P.xW)(),f=d("paymentMethod"),h=u.paymentMethod?.type===nt?i?.invalid_payment_section_card?.label:u.paymentMethod?i?.payment_method_required?.label:f===m.$f.Bank&&(u.bankProvider??u.invoicingMethod)?i?.invalid_payment_section_bank?.label:void 0,g=!!t.stripeElementOptions&&!!t.stripe,b=(e=>{if(!e.offer.paymentMethods)return[];let t=e.offer.paymentMethods.filter(e=>e.paymentType!==m.$f.Credit||g);return na.filter(e=>t.filter(e=>{let t,r,a;
1return e.paymentType!==m.$f.Bank||(t=e?.recurringPaymentMethods,r=t?.find(e=>e.paymentType===m.$f.EmailInvoice),a=t?.find(e=>e.paymentType===m.$f.LetterInvoice),e.paymentType===m.$f.Bank&&e?.bankProviders&&e.bankProviders.length>0&&(r??a))}).map(e=>e.paymentType).includes(e)).map(e=>({paymentType:e,label:n[e.toLowerCase()]?.label}))})(r);if((0,p.useEffect)(()=>{1===b.length&&void 0===o("paymentMethod")&&l("paymentMethod",b[0].paymentType)},[l,o,b]),0===b.length)return null;let y=r=>{switch(r){case m.$f.Credit:return(0,s.jsx)(V.S8,{stripe:t.stripe,options:t.stripeElementOptions,children:(0,s.jsx)(a3,{setStripeElements:e})});case m.$f.EmailInvoice:return(0,s.jsx)(a7,{});case m.$f.LetterInvoice:return(0,s.jsx)(a9,{});case m.$f.Bank:return(0,s.jsx)(a8,{});case m.$f.EInvoice:return(0,s.jsx)(a5,{});default:return null}},x=b.map(e=>(0,s.jsx)(N.s4,{id:e.paymentType,title:e.label,children:(0,s.jsx)("div",{className:"mt-nof-0 mx-nof-12 mb-nof-12 p-nof-8",children:y(e.paymentType)})},e.paymentType));return(0,s.jsxs)("div",{children:[h&&(0,s.jsx)(aM,{children:(0,s.jsx)(w.F,{text:h,variant:w.K.Warning})}),(0,s.jsx)("div",{"data-ab":"shopping-payment-selector",children:x.length>1?(0,s.jsx)(P.xI,{name:"paymentMethod",control:c,rules:{required:i?.payment_method_required?.label??!0},render:({field:e})=>(0,s.jsx)(N.Dv,{...e,value:e.value??"",onChange:e.onChange,ariaLabel:a?.select_payment_method_label?.ariaLabel??"",containerClassName:"mt-nof-16",children:x})}):y(b[0]?.paymentType)})]})},ni=(e,t)=>{if(t.type===al)return{...e,requestProcessing:t.requestProcessing};throw Error("Unknown page feature reducer action")},no={requestProcessing:!1},ns=(0,p.createContext)(void 0),nl=({children:e})=>{let[t,r]=(0,p.useReducer)(ni,no),a=(0,p.useMemo)(()=>({store:t,dispatch:r}),[t,r]);return(0,s.jsx)(ns.Provider,{value:a,children:e})},nd=()=>{let e=(0,p.useContext)(ns);if(void 0===e)throw Error("usePageFeatures must be used within a PageFeatureProvider");return e},nc=e=>{let{brand:t,env:r}=tk(),{store:{selectedProduct:a}}=tj(),[n,i]=(0,p.useState)(()=>e),o=nu(n?.streetAddress,n?.zipCode,a.showDeliveryInfo?a.productId:void 0),{data:s,error:l,isLoading:d}=(0,B.A)(o,e=>ar(e,t,r)),c=(0,p.useCallback)((e,t)=>{i({streetAddress:e,zipCode:t})},[]),u=(0,p.useCallback)(()=>{i(void 0)},[]);return{data:s,deliveryServiceDescription:s?.deliveryServiceDescription,isInvalidAddress:s?.isValid===!1,isValidationError:!!l,isLoading:d,fetchAddressInfo:c,clearAddressInfo:u}},nu=(e,t,r)=>e&&t?{streetAddress:e,zipCode:t,productId:r}
1:void 0,nm=async({funnelId:e,brand:t,env:r,audienceId:a})=>{let n=`/getCampaign/${e}`;try{return(await eC({method:"GET",path:n,query:a?{audienceId:a}:void 0},t,r)).body}catch(e){throw e instanceof Error?e:Error("An unknown error occurred",{cause:e})}},np=async({brand:e,env:t,audienceId:r,getJwtToken:a,allowGiftSubscription:n})=>{let i=`/getUpsellCampaign/${r}`;try{return(await eC({method:"GET",path:i,query:n?{gift:"true"}:void 0},e,t,a)).body}catch(e){throw e instanceof Error?e:Error("An unknown error occurred while fetching upsell campaign data",{cause:e})}},nf=async({brand:e,env:t,audienceId:r,getJwtToken:a})=>(await eC({method:"GET",path:`/getOfferEligibility/${r}`},e,t,a)).body,nh=["local","dev","test"],ng=()=>{let{brand:e,env:t,getJwtToken:r}=tk(),{store:{userProfile:a,campaignData:n,selectedSelector:i}}=tj(),{dispatch:o}=ef(),{enableOfferEligibilityCheck:s}=(()=>{let{env:e}=tk();return{enableOfferEligibilityCheck:nh.includes(e)}})(),l=n?.audienceId,d=a?.accountIdEncoded,c=a?.phoneVerified?a.phone:void 0,{data:u}=(0,B.A)(s&&l&&d&&c?["offerEligibility",l,d,c]:void 0,([,a])=>nf({brand:e,env:t,audienceId:a,getJwtToken:r})),{offer:m}=i,f=!!u?.disallowedOfferCodes.includes(m.offerId);(0,p.useEffect)(()=>{f&&o({type:el,modalError:{type:tL,subscriptionMode:m.subscriptionMode,daysSubscriptionConsideredActive:m.daysSubscriptionConsideredActive}})},[f,m,o])},nb=()=>{let{brand:e,handleBrazeCustomEvent:t,onEventRelayEvent:r}=tk(),{store:{campaignData:a,qualifyingSubscription:n}}=tj(),i=n?.product.productName;(0,p.useEffect)(()=>{a&&!rO(rx)&&(rF(rP({campaignData:a,brand:e,anchorSubscription:i})),t&&t((({campaignData:e,brand:t})=>({type:"viewed_item",payload:{currency:"EUR",aid:e.audienceId,funnel_id:e.funnelData.funnelId,funnel_type:e.funnelData.funnelType,items:e.offers.map(r=>{let a,n,i;return a=r,n=e,i=eS[t],{item_id:a.offerId,product_name:rk(a,n)??"Unknown product",product_brand:i,product_id:a.productId.replace(/^[KS]-/,""),offering_code:n.offeringCode,period_length:eB(a.pricing.priceSteps[0].periodLength),item_variant:a.subscriptionMode,price:rI(a.pricing.priceSteps[0].packagePrice.priceWithVat),quantity:1,daysSubscriptionConsideredActive:a.daysSubscriptionConsideredActive,coupon:a.subscriptionKind===m.Ew.Sample?m.Ew.Fixed:a.subscriptionKind}})}}))({campaignData:a,brand:e})),r?.((({campaignData:e,brand:t,anchorSubscription:r})=>({event:"funnel-offer-view",items:{ecommerce:rP({campaignData:e,brand:t,anchorSubscription:r}).ecommerce}}))({campaignData:a,brand:e,anchorSubscription:i})))},[e,a,i,t,r])},ny=({processing:e,invalidSections:t})=>{let{store:{selectedSelector:r}}=tj(),{store:{buttonLabel:a,formErrors:n}}=es(),{getValues:i}=(0,P.xW)(),o=i("paymentMethod"),l=`${a?.accept_order?.label} ${rH(r.offer,o)}`;return(0,s.jsxs)("div",{"data-ab":"shopping-confirm-button",children:[!e&&t.length>0&&(0,s.jsx)(aM,{children:t.map(e=>{switch(e){case ne.OFFER_INFO:return(0,s.jsx)(w.F,{text:n?.invalid_offer_section?.label,variant:w.K.Warning},`${e}-error`);case ne.CUSTOMER_INFO:return(0,s.jsx)(w.F,{text:n?.invalid_customer_section?.label,variant:w.K.Warning},`${e}-error`);case ne.ABROAD_INFO:return(0,s.jsx)(w.F,{text:n?.invalid_abroad_section?.label,variant:w.K.Warning},`${e}-error`);case ne.GIFT_RECEIVER_INFO:return(0,s.jsx)(w.F,{text:n?.invalid_gift_section?.label,variant:w.K.Warning},`${e}-error`);case ne.PAYMENT_INFO:return(0,s.jsx)(w.F,{text:n?.invalid_payment_section?.label,variant:w.K.Warning},`${e}-error`);case ne.CONFIRM_ORDER:return(0,s.jsx)(w.F,{text:n?.invalid_order_section?.label,variant:w.K.Warning},`${e}-error`);default:return null}})}),(0,s.jsx)(d.$n,{"data-testid":"e2e-submit-create-order","aria-label":a?.accept_order?.ariaLabel,fullWidth:!0,form:"single-form",label:l,type:"submit",loading:e,loadingLabel:l})]})},nx=async(e,t,r,a,n,i,o,s)=>{let l=!0,d;if(e===m.$f.Credit&&s){if(!t)return[!1,void 0];let{success:e,paymentMethod:c}=await ap({elements:o,stripe:s,shoppingDispatch:r,errorDispatch:a});return e||i.setError("paymentMethod",{type:nt,message:n?.invalid_payment_section_card?.label}),[l=e,d=c]}return[l,d]},nv=({ref:e,defaultValues:t,stripeProps:r,stripeElementProps:a})=>{let n,i,{store:{userProfile:o,campaignData:l,generatedOrderId:d,preSelectedOffer:c,selectedProduct:u,selectedTab:f,selectedSelector:h,qualifyingSubscription:g},dispatch:b}=tj(),{dispatch:y}=nd(),{articleId:x,articlePath:v,earliestStartDate:_,brand:j,domain:S,env:E,funnelId:I,getJwtToken:k,isStandalone:N,channel:D,externalPurchaseToken:w,applicationId:C,refreshBrazeBanners:L,onEventRelayEvent:O}=tk(),{store:{paragraph:T,formSectionTitle:A,formErrors:M}}=es(),$=(0,P.mN)({mode:"onChange",defaultValues:t??(n=t9(l),i={firstName:o?.firstName,lastName:o?.lastName,email:o?.email,phoneNumber:o?.phone,terms:!1,startTime:rr(n.publicationDays,_)},l?.modularOffering?i:{...i,phoneNumber:o?.phone??"+358",streetAddress:o?.address?.street,zipCode:o?.address?.zipCode,postOffice:o?.address?.city})}),[F,K]=(0,p.useState)(!1),[R,V]=(0,p.useState)(void 0),{dispatch:B}=ef();ng();let U=rU(T,h.offer.subscriptionKind),{formState:W}=$;(0,p.useEffect)(()=>{let e=f===ta||u.productType===m.ch.PrintOnly,t=h.offer.publicationDays.includes($.getValues(an));e&&t||$.setValue(an,rr(h.offer.publicationDays,_))},[$,f,_,h,u]),(0,p.useEffect)(()=>
1{if(Object.keys(W.errors).length>0){let e=rA(W.errors);rT(rv)?.event_label!==e&&rK({eventName:rv,eventLabel:e})}},[W]);let G=W.isSubmitted?((e,{isGiftOrder:t,isPrintOnly:r})=>{let a=t&&!r?ne.GIFT_RECEIVER_INFO:ne.OFFER_INFO;return Object.values(ne).filter(t=>(t===a?[...nr[t],an]:nr[t]).some(t=>!!e[t]))})(W.errors,{isGiftOrder:f===ta,isPrintOnly:u.productType===m.ch.PrintOnly}):[],z=(()=>{let{store:{userProfile:e,campaignData:t,selectors:r}}=tj();if(t?.funnelData.allowGiftSubscription||t?.funnelData.allowCompanySubscription||t?.modularOffering||t?.funnelData.isAbroadSubscription||!e?.accountIdEncoded||1!==r.length)return!1;let a=r[0].offer.paymentMethods;return a?.length===1&&a[0].paymentType===m.$f.Credit})();nb();let H=f===tn,q=rW(h.offer),Y=!!l?.funnelData.isAbroadSubscription,Z=nc(l?.modularOffering||Y?void 0:{streetAddress:$.getValues("streetAddress"),zipCode:$.getValues("zipCode")}),J=nc(),Q=!!l?.modularOffering&&l.funnelData.allowGiftSubscription,X=Y?(0,s.jsx)(aF,{}):Q?(0,s.jsx)(aU,{addressInfo:J}):(0,s.jsx)(aW,{showGiftTab:!!l?.funnelData.allowGiftSubscription,showCompanyTab:!!l?.funnelData.allowCompanySubscription,addressInfo:Z,giftAddressInfo:J}),ee=async()=>{var e,t,n;let i,s,p,_=!!l?.funnelData.isAbroadSubscription,P=!!l?.modularOffering,T=f===ta,A=u.productType===m.ch.PrintOnly,F=$.getValues("paymentMethod");K(!0);let V=await $.trigger(),[[W,G],...z]=await Promise.all([nx(F,V,b,B,M,$,R,a.stripe),...((e,t,r,a,n)=>{let{isModularOffering:i,isGiftOrder:o,isAbroadSubscription:s,cachedAddressInfo:l,cachedGiftAddressInfo:d}=n,c=[];return i||s||c.push(ac({brand:e,env:t,formErrorsDictionary:r,formMethods:a,cachedAddressInfo:l})),o&&!s?c.push(au({brand:e,env:t,formErrorsDictionary:r,formMethods:a,cachedAddressInfo:d})):a.setValue("gift",void 0),s&&c.push(ad({formMethods:a})),c})(j,E,M,$,{isModularOffering:P,isGiftOrder:T,isAbroadSubscription:_,cachedAddressInfo:Z.data,cachedGiftAddressInfo:J.data})]),H=z.every(e=>e.success),Y=((e,t={})=>!t.isGiftOrder&&!t.isPrintOnly||!e.getFieldState(an).invalid)($,{isGiftOrder:T,isPrintOnly:A});q||F||rK({eventName:rv,eventLabel:"no payment method selected"});let Q=$.getValues(),X=(e=Q.paymentMethod,t=Q.bankProvider,n=Q.invoicingMethod,i=!1,e!==m.$f.Bank||t||(i=!0,rK({eventName:rv,eventLabel:"no bank provider selected when payment method is BANK"})),e!==m.$f.Bank||n||(i=!0,rK({eventName:rv,eventLabel:"no billing method selected when payment method is BANK"})),i),ee=(s=Q.paymentMethod,p=Q.eInvoiceProvider,s===m.$f.EInvoice&&!p&&(rK({eventName:rv,eventLabel:"no e-invoice provider selected when payment method is E_INVOICE"}),!0));(F||q)&&H&&!X&&!ee&&W&&Y&&Q.terms&&l&&(y({type:al,requestProcessing:!0}),L?.(),af({order:{userProfile:o,articleId:x,articlePath:v,brand:j,campaignData:l,generatedOrderId:d,domain:S,env:E,formData:Q,funnelId:I,isGiftOrder:T,isStandalone:N,orderPeriodDescription:U,preSelectedOffer:c,selectedProduct:u,selectedBankProvider:Q.bankProvider,selectedEInvoiceProvider:Q.eInvoiceProvider,selectedInvoicingMethod:Q.invoicingMethod,selectedPaymentMethod:Q.paymentMethod,selectedOffer:h.offer,setupIntentClientSecret:r.setupIntentClientSecret,stamp:r.stamp,stripePaymentMethod:G,qualifyingSubscription:g,channel:D,externalPurchaseToken:w,applicationId:C},pageFeaturesDispatch:y,shoppingDispatch:b,errorDispatch:B,getJwtToken:k,stripe:a.stripe,onEventRelayEvent:O})),K(!1)};return(0,s.jsx)("div",{ref:e,children:(0,s.jsx)(P.Op,{...$,children:(0,s.jsxs)("form",{id:"single-form",onSubmit:$.handleSubmit(()=>ee(),()=>ee()),noValidate:!0,children:[z?(0,s.jsx)("div",{className:"px-nof-16 md:px-nof-32 pb-nof-32",children:(0,s.jsx)(a1,{selectedOffer:h,priceDisplayStyle:l?.funnelData.priceDisplayStyle})}):(0,s.jsx)(aE,{id:"orderinfo",title:A?.order_info?.label,showTopBorder:!0,dataAb:"shopping-order-info",children:(0,s.jsx)(a6,{})}),(!l?.modularOffering||Q)&&(0,s.jsx)(aE,{id:Q?"giftreceiverinfo":tX,title:Q?A?.gift_receiver_info?.label:A?.customer_info?.label,showTopBorder:z,dataAb:"shopping-customer-info",children:X}),!H&&(0,s.jsxs)(s.Fragment,{children:[!q&&(0,s.jsx)(aE,{id:"paymentinfo",title:A?.payment_info?.label,dataAb:"shopping-payment-info",children:(0,s.jsx)(nn,{setStripeElements:V,stripeElementProps:a})}),(q||a.stripe&&a.stripeElementOptions)&&(0,s.jsxs)(aE,{id:"confirmorder",title:A?.confirm_order?.label,dataAb:"shopping-confirm-order",children:[(0,s.jsx)(aO,{}),(0,s.jsx)(ny,{processing:F,invalidSections:G})]}),(0,s.jsx)(aH,{})]})]})})})},n_=(0,p.createContext)(void 0),nj=({children:e})=>{let[t,r]=(0,p.useState)(void 0),a=(0,p.useMemo)(()=>({store:{activeView:t,setActiveView:r}}),[t,r]);return(0,s.jsx)(n_.Provider,{value:a,children:e})},nS=()=>{let e=(0,p.useContext)(n_);if(void 0===e)throw Error("useShoppingView must be used within a ShoppingViewProvider");return e},nE=({children:e,continueLoginLabel:t,includeSidePadding:r})=>(0,s.jsx)("div",{className:"bg-nof-background-content-default text-nof-foreground-primary",children:(0,s.jsxs)("div",{className:(0,Z.default)("relative py-nof-32",{"px-nof-16":r,"md:px-nof-32":r}),children:[t&&(0,s.jsx)("div",{className:"flex items-center mb-nof-16",children:(0,s.jsx)("h3",{className:"nof-ui-title-medium","data-ab":"shopping-continue-login-title",children:t})}),e]})}),nI=()=>{let{store:e}=tj(),{articleId:t,funnelId:r,urls:a}=tk(),{store:{login:n,infoHighlights:i}}=es(),{store:{login:o}}=ev(),l=e.campaignData?.funnelData.funnelType===m.t.Sample?o:n,c={audienceId:e.campaignData?.audienceId,articleId:t,funnelId:r,preSelectedOfferIndex:e.preSelectedOffer};(0,p.useEffect)(()=>{rK({eventName:"login_shown",eventLabel:"shopping funnel"})},[]);let u=e.campaignData?.modularOffering?l?.upsell_login_description?.label:l?.login_description?.label;return e.userProfile?.email?null:(0,s.jsxs)("div",{children:[rd()===rn&&(0,s.jsx)(w.F,{containerClassName:"mb-nof-24",variant:w.K.Warning,text:i?.age_verification_session_error?.label,fullWidth:!0}),(0,s.jsx)("p",{className:"nof-ui-body-medium text-nof-foreground-primary mb-nof-24",children:u}),(0,s.jsx)("div",{"data-ab":"shopping-continue-login-buttons",children:(0,s.jsx)(d.z9,{fullWidth:!0,label:l?.login?.label,link:{href:((e,t,r)=>{var a,n;
1let i,o,s=(a=[rs,"error"],(i=ru(e))?(a.forEach(e=>i.searchParams.delete(e)),rm(e,i)):e);if(!t||t.funnelData.funnelType===m.t.Sample)return s;let l=t9(t),d=t.offers.findIndex(e=>l.offerId===e.offerId),c=t.offers.findIndex(e=>r.productId===e.productId),u=eL(Number(ru(s)?.searchParams.get("offer"))),p=u?t.offers[u]:void 0,f=l.productId===r.productId,h=p?.productId===r.productId?u:f?d:c;return h<0?s:(n={offer:(h+1).toString()},(o=ru(s))?(Object.entries(n).forEach(([e,t])=>o.searchParams.set(e,t)),rm(s,o)):s)})(a.login,e.campaignData,e.selectedProduct)},onClick:()=>{let e;rK({eventName:"login_start",eventLabel:"shopping funnel"}),e=new Date(Date.now()+9e5),f.A.set("campaignIds",JSON.stringify(c),{expires:e})}})})]})},nk=e=>{let{minAge:t,maxAge:r}=e??{};return void 0!==t&&void 0!==r?`${t}â${r}`:void 0===t?void 0===r?"":`alle ${r}`:`yli ${t}`},nN=()=>{let{store:{paragraph:e,buttonLabel:t}}=es(),{store:{campaignData:r,userProfile:a}}=tj(),{minAge:n}=r??{},i=a?.dateOfBirth;return(0,p.useEffect)(()=>{i&&rK({eventName:"funnel_age_verification_wrong_age",eventLabel:t8(i)<(n??0)?"under age limit":"over age limit"})},[i,n]),(0,s.jsxs)("div",{className:"flex flex-col items-center text-center gap-nof-16",children:[(0,s.jsx)(c.A,{color:"var(--nof-semantic-color-cta-base)",size:57}),(0,s.jsx)("h3",{className:"nof-ui-title-medium",children:`Hinta on tarkoitettu vain ${nk(r)}-vuotiaille.`}),(0,s.jsx)("p",{className:"nof-ui-body-medium mb-nof-8",children:e?.age_restriction_title?.label??""}),(0,s.jsx)(d.z9,{variant:d.KT.Primary,label:t?.age_restriction_offers?.label??"",link:{href:"/tilaa",external:!1}}),(0,s.jsx)(d.z9,{variant:d.KT.Secondary,label:t?.age_restriction_frontpage?.label??"",link:{href:"/",external:!1}})]})},nD=()=>{let e,t,{store:{paragraph:r,buttonLabel:a,infoHighlights:n}}=es(),{store:{userProfile:i,campaignData:o}}=tj(),{env:c,refreshUserInfo:u,urls:m}=tk(),f=rd(),{hashedSub:h}=i??{},[g,b]=(0,p.useState)(f===ra),y=f===rn||!h;return(0,p.useEffect)(()=>{y&&(window.location.href=m.logout)},[y,m.logout]),(0,p.useEffect)(()=>{f===ra&&(async()=>{try{await u()}finally{b(!1)}})()},[u,f]),(0,p.useEffect)(()=>{f||rK({eventName:"funnel_age_verification_shown",eventLabel:""})},[f]),g||y?(0,s.jsx)(rg,{children:(0,s.jsx)("div",{className:"flex justify-center items-center w-full",children:(0,s.jsx)(l.y,{})})}):(0,s.jsxs)("div",{className:"flex flex-col items-start gap-nof-16",children:[(0,s.jsx)("h3",{className:"nof-ui-title-medium",children:r?.age_verification_title?.label??""}),(0,s.jsx)("div",{className:"nof-ui-body-medium flex flex-col gap-nof-8",children:(0,s.jsx)("p",{children:`Alennettu hinta on tarkoitettu ${nk(o)}-vuotiaille. Varmistamme tilaajan i\xe4n.`})}),f===ri&&(0,s.jsx)(w.F,{variant:w.K.Warning,text:n?.age_verification_unknown_error?.label,fullWidth:!0}),(0,s.jsx)(d.z9,{fullWidth:!0,variant:d.KT.Primary,label:a?.verify_age?.label??"",link:{href:((e=new URL(window.location.href)).searchParams.delete("error"),e.searchParams.set(rs,"true"),(t=new URL("/strong-auth",ro.includes(c)?"https://tili.sanoma.fi":"https://tili-staging.sanoma.fi")).searchParams.set("redirect_uri",e.toString()),t.searchParams.set("login_hint",h),t.toString()),external:!1},onClick:()=>{rK({eventName:"funnel_age_verification_clicked",eventLabel:""})}})]})},nP=({continueLoginLabel:e,includeSidePadding:t,orgUserWarningLabel:r,restrictionType:a})=>{let{store:{setActiveView:n}}=nS();nb();let i=a===tJ||a===tQ;return(0,p.useEffect)(()=>{a===tZ&&rK({eventName:r_,eventLabel:"User logged in with CORPORATE or SCHOOL account"})},[a]),(0,s.jsx)(nE,{continueLoginLabel:i?void 0:e,includeSidePadding:t,children:(e=>{switch(e){case tY:return(0,s.jsx)(nI,{});case tZ:return r?(0,s.jsx)(w.F,{text:r}):null;case tJ:return(0,s.jsx)(nN,{});case tQ:return(0,s.jsx)(nD,{});default:n(t0);return}})(a)})},nw=({onContinueReading:e,subscribedOfferState:t})=>{let{store:r}=nd(),{brand:a,funnelId:n}=tk(),{store:{userProfile:i,campaignData:o,orderConfirmationData:l,selectedProduct:d,selectedSelector:c}}=tj(),{store:{buttonLabel:u,errorMessages:g,infoHighlights:b,misc:y,links:x}}=es(),{dispatch:v}=ef(),{env:_,isDarkMode:j,getJwtToken:S,articleId:E}=tk();(0,p.useEffect)(()=>{l?.status&&(e=>{if(e!==m.OE.Success)switch(e){case m.OE.Cancelled:v({type:ed,viewError:{type:t$.PAYMENT_CANCELED}});break;case m.OE.NotBilled:v({type:ed,viewError:{type:t$.PAYMENT_NOT_BILLED}});break;case m.OE.Failed:default:v({type:ed,viewError:{type:t$.PAYMENT_FAILED}})}})(l?.status)},[v,l?.status]);let[I,k]=(0,p.useState)(),[N,D]=(0,p.useState)(),[P,w]=(0,p.useState)(),[C,L]=(0,p.useState)(null),[O,T]=(0,p.useState)(null),[A,M]=(0,p.useState)(null),{store:{setActiveView:$}}=nS(),F=t5(i,o),K=((e,t)=>{if(e)switch(e){case m.OE.Success:return tG;case m.OE.Cancelled:case m.OE.NotBilled:case m.OE.Failed:default:return tH}return t?tq:tz})(l?.status,F);(0,p.useEffect)(()=>{K===tz&&i?.accountIdEncoded&&!C&&!N&&!I&&(async e=>{let t=await t7(e,a,_,v,S,$);t&&(D(t.stamp),k(t.publicApiKey),w(t.saveAgreementToken))})(i?.accountIdEncoded)}
1,[i?.accountIdEncoded,K,a,_,I,v,S,$,N,C]),(0,p.useEffect)(()=>{I&&(0,h.c)(I).then(e=>{L(e)}).catch(e=>{v({type:ed,viewError:{type:t$.STRIPE_DID_NOT_LOAD,stripeError:e}}),$(t0)})},[I,v,$]),(0,p.useEffect)(()=>{let e=c.offer.pricing.priceSteps[0];a&&A&&T({mode:"subscription",amount:(e=>{let[t,r]=e.toString().split(".");return void 0===r?100*e:parseInt(t+r.slice(0,2).padEnd(2,"0"))})(e.packagePrice.priceWithVat),currency:"eur",locale:"fi",paymentMethodCreation:"manual",...{fonts:(e=>{switch(e){case e_.hs:return[{family:"Helsingin",weight:"400",style:"normal",display:"block",src:"url(https://fonts.sanoma-sndp.fi/helsingin-text-web-regular-v1.woff)"},{family:"Helsingin",weight:"500",style:"normal",display:"block",src:"url(https://fonts.sanoma-sndp.fi/helsingin-text-web-medium-v1.woff)"}];case e_.is:return[{family:"Source Sans 3",weight:"400",style:"normal",display:"block",src:"url(https://fonts.sanoma-sndp.fi/source-sans-3-latin-regular-v3046.woff)"},{family:"Source Sans 3",weight:"700",style:"normal",display:"block",src:"url(https://fonts.sanoma-sndp.fi/source-sans-3-latin-bold-v3046.woff2)"}];case e_.al:case e_.jan:case e_.js:case e_.kmv:case e_.ks:case e_.mk:case e_.nu:case e_.rks:case e_.sk:case e_.ss:case e_.suk:case e_.tyr:case e_.vs:return[{family:"Metric",weight:"400",style:"normal",display:"block",src:"url(https://fonts.sanoma-sndp.fi/Metric-Regular-v1.woff)"},{family:"Metric",weight:"600",style:"normal",display:"block",src:"url(https://fonts.sanoma-sndp.fi/Metric-Semibold-v1.woff)"}];default:throw Error("Stripe: brand fonts not supported")}})(a),appearance:{disableAnimations:!0,variables:{borderRadius:A.getPropertyValue("--nof-semantic-border-radius-small"),colorBackground:A.getPropertyValue("--nof-semantic-color-background-content-default"),colorDanger:A.getPropertyValue("--nof-semantic-color-status-alert-default"),iconCardCvcColor:"transparent",iconCardCvcErrorColor:"transparent",iconCardErrorColor:"transparent",colorText:A.getPropertyValue("--nof-semantic-color-foreground-primary"),colorTextPlaceholder:A.getPropertyValue("--nof-semantic-color-foreground-secondary"),focusBoxShadow:`0 0 0 2px ${A.getPropertyValue("--nof-semantic-color-foreground-primary")}`,focusOutline:A.getPropertyValue("--nof-semantic-color-foreground-primary"),fontFamily:A.getPropertyValue("--nof-ui-body-medium-font-family")},rules:{".Error":{fontFamily:A.getPropertyValue("--nof-ui-body-medium-font-family"),fontSize:A.getPropertyValue("--nof-ui-body-medium-font-size"),fontWeight:A.getPropertyValue("--nof-ui-body-medium-font-weight"),letterSpacing:A.getPropertyValue("--nof-ui-body-medium-letter-spacing"),lineHeight:A.getPropertyValue("--nof-ui-body-medium-line-height")},".Label":{fontFamily:A.getPropertyValue("--nof-ui-subtitle-small-font-family"),fontSize:A.getPropertyValue("--nof-ui-subtitle-small-font-size"),fontWeight:A.getPropertyValue("--nof-ui-subtitle-small-font-weight"),letterSpacing:A.getPropertyValue("--nof-ui-subtitle-small-letter-spacing"),lineHeight:A.getPropertyValue("--nof-ui-subtitle-small-line-height"),marginBottom:A.getPropertyValue("--nof-core-dimension-150")},".Input":{border:`1px solid ${A.getPropertyValue("--nof-semantic-color-foreground-primary")}`,boxShadow:"none",fontFamily:A.getPropertyValue("--nof-ui-body-medium-font-family"),fontSize:A.getPropertyValue("--nof-ui-body-medium-font-size"),fontWeight:A.getPropertyValue("--nof-ui-body-medium-font-weight"),letterSpacing:A.getPropertyValue("--nof-ui-body-medium-letter-spacing"),lineHeight:A.getPropertyValue("--nof-ui-body-medium-line-height"),marginBottom:A.getPropertyValue("--nof-core-dimension-150")},".Input--empty":{backgroundColor:A.getPropertyValue("--nof-semantic-color-background-content-lowered")},".Input:hover":{backgroundColor:A.getPropertyValue("--nof-semantic-color-background-content-default"),boxShadow:`0 0 0 1px ${A.getPropertyValue("--nof-semantic-color-foreground-primary")}`},".Input:focus":{backgroundColor:A.getPropertyValue("--nof-semantic-color-background-content-default"),borderColor:"unset",outline:"1px solid transparent",outlineOffset:A.getPropertyValue("--nof-core-dimension-25")},".TermsText":{color:A.getPropertyValue("--nof-semantic-color-foreground-muted"),fontFamily:A.getPropertyValue("--nof-ui-body-small-font-family"),fontSize:A.getPropertyValue("--nof-ui-body-small-font-size"),fontWeight:A.getPropertyValue("--nof-ui-body-small-font-we
1ight"),letterSpacing:A.getPropertyValue("--nof-ui-body-small-letter-spacing"),lineHeight:A.getPropertyValue("--nof-ui-body-small-line-height")},".AccordionItem":{backgroundColor:A.getPropertyValue("--nof-semantic-color-neutral-contrast-very-low"),border:"none",boxShadow:`inset 0 0 0 1px ${A.getPropertyValue("--nof-semantic-color-foreground-tertiary")}`},".AccordionItem--selected":{backgroundColor:A.getPropertyValue("--nof-semantic-color-background-content-default"),border:"none",boxShadow:`inset 0 0 0 2px ${A.getPropertyValue("--nof-semantic-color-foreground-primary")}`},".AccordionItem:hover":{backgroundColor:A.getPropertyValue("--nof-semantic-color-background-content-default"),border:"none",boxShadow:`inset 0 0 0 2px ${A.getPropertyValue("--nof-semantic-color-foreground-primary")}`}}}}})},[a,c.offer.pricing.priceSteps,A]),(0,p.useEffect)(()=>{{let e=document.getElementById("shopping");e&&M(getComputedStyle(e))}},[]),(0,p.useEffect)(()=>{K===tz&&rK({eventName:"funnel_full_paid_view_shown",eventLabel:"shopping funnel"})},[K]),(0,p.useEffect)(()=>{let e=rd(),t=rc();e===ra?rK({eventName:"funnel_age_verification_done",eventLabel:""}):t&&rK({eventName:"funnel_age_verification_failed",eventLabel:rc()??"unknown"})},[]),(0,p.useEffect)(()=>{{let e=document.getElementById("shopping");e&&M(getComputedStyle(e))}},[j]);let R=(0,p.useCallback)(e=>{null!==e&&f.A.get("campaignIds")&&(o?.products.length===1&&aI(e),f.A.remove("campaignIds"))},[o]);return(0,s.jsxs)("div",{className:"relative max-w-[640px] w-full","data-testid":"paid-view",inert:r.requestProcessing,children:[(0,s.jsx)(rR,{errorMessages:g,links:x,offerUsedErrors:d.offerUsedErrors,articleId:E}),K&&(({activeView:e,buttonLabel:t,infoHighlights:r,misc:a,modularOffering:n,multipleProducts:i,onContinueReading:o,subscribedOfferState:l,restrictionType:d,formRef:c,stripeProps:u,stripeElementProps:m})=>{switch(e){case tG:return(0,s.jsx)(a_,{onContinueReading:o,subscribedOffer:l?.offerId});case tH:{let e=l?.redirectUri??window.location.href;return(0,s.jsx)(rh,{overrides:{withLink:{label:t?.return_to_form?.label,url:e,externalLink:!1},renderLoginLink:!0}})}case tq:return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(aj,{}),(0,s.jsx)(i?aL:aC,{}),(0,s.jsx)(nP,{restrictionType:d??tY,orgUserWarningLabel:r?.org_login_warning?.label,continueLoginLabel:a?.continue_login?.label,includeSidePadding:!0})]});case tz:return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(aj,{}),(0,s.jsx)(i?aL:aC,{}),n&&(0,s.jsx)(aN,{}),(0,s.jsx)(nv,{ref:c,stripeElementProps:m,stripeProps:u})]})}})({activeView:K,buttonLabel:u,onContinueReading:e,formRef:R,infoHighlights:b,misc:y,modularOffering:o?.modularOffering,multipleProducts:!!o?.products.length&&o.products.length>1,subscribedOfferState:t,restrictionType:F,stripeProps:{stamp:N,setupIntentClientSecret:P,publishableKey:I},stripeElementProps:{stripeElementOptions:O,stripe:C},funnelId:n}),r.requestProcessing&&(0,s.jsx)(aS,{})]})},nC=async(e,t,r,a)=>{try{return(await eC({method:"POST",path:"/orderClaim",body:e,query:{secure:"true"}},t,r,a)).status}catch(e){throw e instanceof Error?e:Error("An unknown error occurred",{cause:e})}},nL=!0,nO=({userProfile:e,domain:t,brand:r,env:a,getJwtToken:n,onContinueReading:i,callback:o})=>{let{dispatch:s}=ef(),l=()=>{f.A.remove("secureOrderId"),s({type:el,modalError:{type:tA}}),"function"==typeof o&&o()};return(0,p.useEffect)(()=>{(async()=>{if(!e?.accountIdEncoded)return;let s=f.A.get("secureOrderId");if(s&&nL){nL=!1;let d={meta:{channel:"sndp",application:t,orderId:s},account:{accountId:e.accountIdEncoded},userAccount:{accountId:e.accountIdEncoded}};try{await nC(d,r,a,n)===200?(f.A.remove("secureOrderId"),"function"==typeof o&&o(),"function"!=typeof o&&i({isCop:!1})):l()}catch{l()}}})()},[e?.accountIdEncoded]),null},nT=({className:e,type:t})=>(0,s.jsxs)("div",{className:`flex items-center gap-nof-16 ${e}`,children:[(0,s.jsx)("hr",{className:"border-nof-neutral-contrast-low w-full"}),(0,s.jsxs)("div",{children:["checkmark"===t&&(0,s.jsx)(I._,{color:"var(--nof-semantic-color-foreground-accent)",size:40}),"profile"===t&&(0,s.jsx)(O.V,{color:"var(--nof-semantic-color-foreground-accent)",size:40})]}),(0,s.jsx)("hr",{className:"border-nof-neutral-contrast-low w-full"})]}),nA=({title:e,content:t})=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"nof-ui-subtitle-medium mb-nof-24",children:e}),(0,s.jsx)("div",{className:"flex flex-col gap-nof-12",children:t.map(e=>(0,s.jsxs)(p.Fragment,{children:[(0,s.jsx)("span",{className:"nof-ui-subtitle-small",children:e.label}),(0,s.jsx)("span",{className:"nof-ui-body-medium",children:e.value})]},e.label))})]}),nM=e=>e.pricing.priceSteps[0],n$=e=>{if(!e)return"";let{periodLength:t}=nM(e);return`${t.amount} ${t.unit}`},nF=e=>{if(!e)return"";let{packagePrice:{priceWithVat:t}}=nM(e);return`${eR(t)} â¬`},nK=({getValues:e,onContinueReading:t})=>{let r,a,n,i,[o,c]=(0,p.useState)(!1),{store:h}=tj(),{brand:g,isStandalone:b,urls:v,handleBrazeCustomEvent:_,getJwtToken:j,env:S,domain:E,articlePath:I,renderBrazeBanner:k,onEventRelayEvent:N}=tk(),{store:{sampleLabels:D,sampleConfirmation:P,sampleMisc:w,sampleButtons:C,customerFormLabel:L}}=ev(),[O,T]=(0,p.useState)(!0),A=h.selectedSelector.offer;(0,p.useEffect)(()=>
1{eH(document.getElementById("top-title")),!rO(ry)&&h.campaignData&&A&&(rF(rw({offer:A,campaignData:h.campaignData,brand:g})),N?.(r5({offer:A,campaignData:h.campaignData,brand:g,orderID:h.sampleSuccessfulOrderId})))},[g,h.campaignData,h.sampleSuccessfulOrderId,A,N]),(0,p.useEffect)(()=>{_&&A&&h.campaignData&&_({type:"completed_checkout",payload:{product_id:A.productId.replace(/^[KS]-/,""),payment_requirement:A.subscriptionMode,product_name:h.selectedProduct.descriptionTitle,aid:h.campaignData.audienceId,funnel_id:h.campaignData.funnelData.funnelId,offering_code:h.campaignData.offeringCode,is_module:!1,is_gift:!1,offer_length:eB(A.pricing.priceSteps[0].periodLength)}})},[_,h.selectedProduct,A,h.campaignData]);let M=e(),$={userProfile:h.userProfile,urls:v,domain:E,brand:g,env:S,getJwtToken:j,onContinueReading:t,callback:()=>{T(!1)}};if(f.A.get("secureOrderId")&&h.userProfile?.accountIdEncoded&&O)return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.y,{}),(0,s.jsx)(nO,{...$})]});let F=rG(h.orderConfirmationData?.purchasedProducts);return(0,s.jsx)("div",{className:"max-w-[640px] w-full",children:(0,s.jsxs)("div",{className:"flex flex-col nof-ui-body-medium text-nof-foreground-primary py-nof-40 px-nof-16 max-w-[612px] w-full",children:[(0,s.jsx)("h2",{id:"top-title",className:"text-center nof-ui-title-medium mb-nof-32",children:P?.confirmation_title?.label}),(0,s.jsxs)("div",{className:"flex flex-col mb-nof-32",children:[(0,s.jsx)("span",{className:"nof-ui-subtitle-small",children:P?.your_order?.label}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[h.selectedProduct&&(0,s.jsxs)("span",{children:[h.selectedProduct.descriptionTitle," /"," ",n$(A)," ",w?.sample?.label]}),(0,s.jsxs)("button",{type:"button",className:"flex text-center cursor-pointer p-nof-8 text-underline",onClick:()=>{c(!o)},"aria-label":o?w?.hide?.label:w?.show_more?.label,children:[(0,s.jsx)("span",{className:"mr-nof-6",children:o?w?.hide?.label:w?.show_more?.label}),!o&&(0,s.jsx)(y.Z,{color:"var(--nof-semantic-color-cta-base)",size:16}),o&&(0,s.jsx)(x.K,{color:"var(--nof-semantic-color-cta-base)",size:16})]})]})]}),o&&M&&(0,s.jsxs)("div",{className:"flex flex-col gap-nof-32",children:[(0,s.jsx)(nA,{title:D?.order_info?.label,content:(r=h.sampleSuccessfulOrderId,a=h.selectedProduct.descriptionTitle,[{label:P?.subscribed_order?.label,value:a},{label:P?.sample_subscription?.label,value:r},{label:P?.price?.label,value:`${nF(A)} / ${n$(A)} (${P?.sample_vat?.label} ${nF(A)})`},{label:P?.total_price?.label,value:nF(A)},{label:P?.subscription_starts?.label,value:e$()},{label:P?.order_specs?.label,value:w?.fixed_paragraph?.label}])}),(0,s.jsx)(nA,{title:D?.customer_info?.label,content:[{label:w?.name_label?.label,value:`${M.firstName} ${M.lastName}`},{label:L?.email?.label,value:M.email},{label:L?.phone_number?.label,value:M.phoneNumber},{label:L?.street_address?.label,value:M.streetAddress},{label:L?.zip_code?.label,value:M.zipCode},{label:L?.post_office?.label,value:M.postOffice}]}),(0,s.jsxs)("span",{className:"py-nof-16 mb-nof-32",children:[(0,s.jsx)("span",{className:"mr-nof-6",children:P?.need_help?.label}),(0,s.jsx)(u.b,{href:"https://oma.sanoma.fi/tuote/helsingin-sanomat",text:"Siirry asiakaspalveluun",external:!0})]})]}),(0,s.jsx)(nT,{className:"mb-nof-16",type:h.userProfile?.email||h.accountType!==m.CO.WaitForShogun?"checkmark":"profile"}),(0,s.jsxs)("div",{className:"flex flex-col items-center",children:[(0,s.jsx)("h3",{className:"nof-ui-subtitle-medium mb-nof-24",children:h.userProfile?.email||h.accountType!==m.CO.WaitForShogun?P?.account_found?.label:P?.activate_account?.label}),(0,s.jsx)("span",{className:"mb-nof-12",children:"K\xe4ytt\xe4j\xe4tunnuksesi on"}),(0,s.jsx)("span",{className:"nof-ui-subtitle-small mb-nof-32",children:M.email}),!h.userProfile?.email&&(0,s.jsx)(d.z9,{label:h.accountType===m.CO.WaitForShogun?C?.add_password?.label:C?.login?.label,link:{href:h.accountType===m.CO.WaitForShogun?(n=v.registration,h.accountType===m.CO.WaitForShogun&&f.A.set("orderId",h.sampleSuccessfulOrderId),`${n}&${eN({email:M.email,firstName:M.firstName,lastName:M.lastName,readOnlyEmail:"true",no_sso:"true",layouts:"hideLoginLinkInRegister,hideCancelIcon"})}`):(i=v.login,b&&f.A.set("confirmationLogin","true"),i)}}),h.userProfile?.email&&(0,s.jsx)(d.z9,{label:b&&!I?C?.continue_to_frontpage?.label:C?.continue_article_reading?.label,link:{href:I??"/"},onClick:e=>{e.preventDefault(),t({isCop:F})}})]}),k?.(A.productId.replace(/^[KS]-/,""))]})})},nR=()=>(0,s.jsxs)("div",{className:"nof-ui-body-medium flex flex-col my-nof-32",children:[(0,s.jsxs)("div",{className:"mb-nof-16",children:[(0,s.jsx)("span",{className:"nof-ui-subtitle-small",children:"Digipalvelun k\xe4ytt\xf6: "}),(0,s.jsx)("span",{children:"Helsingin Sanomien digipalvelu on k\xe4yt\xf6ss\xe4si kaikilla yleisimmill\xe4 tableteilla ja \xe4lypuhelimilla, uusimmilla k\xe4ytt\xf6j\xe4rjestelmill\xe4. Selaink\xe4yt\xf6ss\xe4 tuemme uusimpia selainversioita."})]}),(0,s.jsx)("div",{className:"mb-nof-16",children:(0,s.jsxs)("span",{children:["Sanoma voi l\xe4hett\xe4\xe4 sinulle markkinointiviestej\xe4, jos olet tilannut Sanoman tuotteita tai k\xe4yt\xe4t Sanoman palveluita, vaikka et olisi antanut nimenomaista lupaa s\xe4hk\xf6iseen markkinointiin. N\xe4m\xe4 viestit liittyv\xe4t Sanoman
1samankaltaisiin palveluihin tai tuotteisiin, joita olet tilannut tai k\xe4ytt\xe4nyt Sanomalta. Huomaathan, ett\xe4 voit aina kielt\xe4\xe4 markkinointiviestien l\xe4hett\xe4misen toimimalla viestin lopussa olevien ohjeiden mukaan ja yhteystietojesi k\xe4sittelyn suoramarkkinointia varten ilmoittamalla asiasta asiakaspalveluumme. Lis\xe4tietoa henkil\xf6tietojen k\xe4sittelyst\xe4:"," ",(0,s.jsx)(u.b,{"aria-label":"Sanoman tietosuojalauseke",href:"https://sanoma.fi/tietosuoja",text:"sanoma.fi/tietosuoja",external:!0})]})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"nof-ui-subtitle-small",children:"Tutustumistilaus: "}),(0,s.jsx)("span",{children:"Kun tilaat maksuttoman n\xe4ytetilauksen, Sanoma Media Finland Oy voi l\xe4hett\xe4\xe4 sinulle asiakkuuteen perustuvaa markkinointia kolmen kuukauden sis\xe4ll\xe4 n\xe4ytetilauksen p\xe4\xe4ttymisest\xe4. N\xe4ytetilausten m\xe4\xe4r\xe4 on rajoitettu yhteen n\xe4ytetilaukseen 3 kk:n sis\xe4ll\xe4 tilaajataloutta kohden. Etu koskee vain talouksia, joihin ei viel\xe4 tule Helsingin Sanomia."})]})]}),nV=({infoOnClickPrompt:e,offer:t})=>{let{store:{sampleButtons:r,sampleLabels:a,sampleProduct:n,sampleMisc:i}}=ev(),{store:{selectedProduct:o}}=tj();return(0,s.jsxs)("section",{"data-testid":"e2e-sample-form-offer",className:"flex flex-col items-start my-nof-24 w-full nof-ui-body-medium",children:[(0,s.jsxs)("div",{className:"flex flex-col mb-nof-16",children:[(0,s.jsx)("span",{className:"nof-ui-subtitle-small mb-nof-12",children:a?.product?.label}),(0,s.jsxs)("div",{className:"flex gap-nof-6 items-center",children:[(0,s.jsx)("span",{children:o.descriptionTitle}),(0,s.jsx)("button",{"aria-label":r?.info?.ariaLabel,className:"flex cursor-pointer",onClick:e,children:(0,s.jsx)(K.e,{color:"var(--nof-semantic-color-cta-base)",size:20})})]})]}),(0,s.jsxs)("div",{className:"flex flex-col mb-nof-16",children:[(0,s.jsx)("span",{className:"nof-ui-subtitle-small mb-nof-12",children:a?.duration?.label}),(0,s.jsx)("span",{children:n$(t)})]}),(0,s.jsxs)("div",{className:"flex flex-col mb-nof-16",children:[(0,s.jsx)("span",{className:"nof-ui-subtitle-small mb-nof-12",children:a?.subscription_kind?.label}),(0,s.jsx)("span",{children:n?.sample_subscription_kind?.label})]}),(0,s.jsxs)("p",{className:"text-nof-foreground-muted",children:[i?.fixed_paragraph?.label," "]})]})},nB=({offer:e})=>{let{store:{sampleProduct:t,sampleMisc:r}}=ev(),{store:{selectedProduct:a}}=tj();return(0,s.jsxs)("div",{className:"nof-ui-body-medium text-center mb-nof-32",children:[(0,s.jsxs)("span",{className:"nof-ui-subtitle-small",children:[a.descriptionTitle,","," "]}),(0,s.jsxs)("span",{children:[t?.sample_subscription_kind?.label," ",n$(e),","," "]}),(0,s.jsxs)("span",{children:[r?.starts?.label," ",e$()]})]})},nU=({offer:e})=>{let{store:{sampleMisc:t}}=ev();return(0,s.jsxs)("section",{className:"flex items-center justify-between w-full my-nof-32",children:[(0,s.jsx)("span",{className:"text-nof-sales-default nof-ui-subtitle-small",children:t?.price_title?.label}),(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("span",{className:"text-nof-sales-default nof-ui-title-medium mr-nof-6",children:nF(e)}),(0,s.jsxs)("span",{className:"nof-ui-body-medium",children:["/ ",n$(e)]})]})]})},nW=()=>{let{store:{campaignData:e}}=tj();return(0,s.jsxs)("div",{className:"flex flex-col text-center gap-nof-24 mb-nof-32",children:[(0,s.jsx)("h2",{id:"top-title",className:"nof-ui-title-medium",children:e?.funnelData.title}),(0,s.jsx)(tw,{text:e?.funnelData.description,className:"nof-ui-body-medium"})]})},nG="confirmation",nz=({formMethods:e,viewChange:t,onContinueReading:r})=>{let{register:a,watch:n,handleSubmit:i,formState:o,formState:{errors:c},reset:h}=e,[y,x]=(0,p.useState)(!1),[v,_]=(0,p.useState)(!1),[j,S]=(0,p.useState)(!0),[E,I]=(0,p.useState)(!1),{store:{errorMessages:k,links:N,sampleLabels:w,sampleMisc:C,sampleLegal:L,sampleFormErrors:O}}=ev(),{store:{userProfile:T,campaignData:A,selectedProduct:M,selectedSelector:$,generatedOrderId:F,orderConfirmationData:K},dispatch:R}=tj(),V=$.offer,{dispatch:B}=ef();ng();let{articleId:U,brand:W,domain:G,env:z,getJwtToken:H,refreshBrazeBanners:q,onEventRelayEvent:Y,urls:Z}=tk(),J=n("terms"),Q=ev().store.customerFormLabel,X=nc({streetAddress:e.getValues("streetAddress"),zipCode:e.getValues("zipCode")}),ee=(0,p.useMemo)(()=>
1{if(!T)return!0;let{street:e,zipCode:t,city:r}=T.address??{};return!(T.phone&&e&&t&&r)},[T]);(0,p.useEffect)(()=>{h({firstName:T?.firstName??"",lastName:T?.lastName??"",email:T?.email??"",phoneNumber:T?.phone??"+358",streetAddress:T?.address?.street??"",zipCode:T?.address?.zipCode??"",postOffice:T?.address?.city??""})},[T,h]),nb(),(0,p.useEffect)(()=>{J&&A&&rF(rC({offer:V,campaignData:A,brand:W}))},[W,A,V,J]);let et=async e=>{await er(e)},er=async t=>{x(!0);let{success:r}=await am({streetAddressName:aa.StreetAddress,zipCodeName:aa.ZipCode,brand:W,env:z,formErrorsDictionary:O,formMethods:e,cachedAddressInfo:X.data});r&&await ea(t,G,W),x(!1)},ea=async(e,r,a)=>{let n=rU(C,V.subscriptionMode),i={accountType:T?.accountIdEncoded?m.CO.Shogun:m.CO.WaitForShogun,accountId:T?.accountIdEncoded??"<create>",meta:{channel:"sndp",application:r,orderId:F},payment:{message:M.descriptionTitle,address:{firstName:e.firstName,lastName:e.lastName,email:e.email,street:e.streetAddress,zip:e.zipCode,city:e.postOffice,phoneNumber:e.phoneNumber},provider:m.zP.Voucher},entries:[{productId:V.productId,modifiers:[V.offerId],attributes:{subscriptionInfoText:n,T_cid:U??"",kayakStrongAuth:"true"},parameters:{audienceId:A.audienceId}}]};A&&(rF(rL({offer:V,campaignData:A,brand:a})),Y?.(r3({offer:V,campaignData:A,brand:a,orderID:F}))),q?.();try{let e=await ae(i,a,z);x(!1),e.success&&(R({type:tl,orderId:e.orderId.toString()}),R({type:to,accountType:e.accountType}),f.A.set("secureOrderId",e.secureOrderId),t(nG))}catch(e){switch(e instanceof ew?e.knownErrorCode:void 0){case m.LW.OFFER_USED:B({type:el,modalError:{type:tL,subscriptionMode:V.subscriptionMode,daysSubscriptionConsideredActive:V.daysSubscriptionConsideredActive}}),rK({eventName:r_,eventLabel:"sampleFunnel.offerAlreadyUsed"}),Y&&A&&Y(r8({offer:V,campaignData:A,brand:a,orderID:F,errorType:V.subscriptionMode.toLowerCase()}));break;case m.LW.ORDER_BLOCKED:B({type:el,modalError:{type:tO}}),rK({eventName:r_,eventLabel:"sampleFunnel.orderBlocked"});break;case m.LW.ACCOUNT_LOCKED:B({type:el,modalError:{type:tT}}),rK({eventName:r_,eventLabel:"sampleFunnel.accountLocked"});break;default:B({type:el,modalError:{type:tC}}),rK({eventName:r_,eventLabel:`create (sample) order request failed${e instanceof Error?` (${e.message})`:""}`})}x(!1)}};if((0,p.useEffect)(()=>{if(Object.keys(o.errors).length>0){let e=rA(o.errors);rT(rv)?.event_label!==e&&rK({eventName:rv,eventLabel:e})}},[o]),!A)return(0,s.jsx)(rh,{});let en=t5(T),ei=!!en;return f.A.get("secureOrderId")&&j&&T?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.y,{}),(0,s.jsx)(nO,{userProfile:T,urls:Z,domain:G,brand:W,env:z,getJwtToken:H,onContinueReading:r,callback:()=>{let e=rG(K?.purchasedProducts);I(!0),r({isCop:e}),S(!1)}})]}):E?(0,s.jsx)(l.y,{}):(0,s.jsxs)("div",{className:"text-nof-foreground-primary py-nof-40 px-nof-16 max-w-[640px]","data-testid":"sample-form",children:[(0,s.jsx)(rR,{errorMessages:k,links:N,offerUsedErrors:M.offerUsedErrors??[],articleId:U}),(0,s.jsx)(g.a,{containerClassName:"shopping-modal",overlayClassName:"shopping-modal",onClose:()=>{_(!1)},isOpen:v,title:M.descriptionTitle,children:(0,s.jsx)(aw,{listItems:M.descriptionList})}),(0,s.jsx)(nW,{}),(0,s.jsx)(b.c,{variant:b.K.LowContrast}),(0,s.jsx)(nV,{infoOnClickPrompt:()=>{_(!v)},offer:V}),(0,s.jsx)(b.c,{variant:b.K.LowContrast}),(0,s.jsx)(nU,{offer:V}),(0,s.jsx)(b.c,{variant:b.K.LowContrast}),ei&&(0,s.jsx)(nP,{restrictionType:en,continueLoginLabel:C?.continue_login?.label,orgUserWarningLabel:C?.org_login_warning?.label,includeSidePadding:!1}),!ei&&(0,s.jsxs)(P.Op,{...e,children:[(0,s.jsxs)("form",{name:"sample-form",className:"flex flex-col gap-nof-4 mt-nof-32 w-full",onSubmit:e=>void i(et)(e),noValidate:!0,children:[(0,s.jsx)("h3",{className:"nof-ui-title-medium mb-nof-24",children:w?.customer_info?.label}),(0,s.jsx)(aR,{isEditMode:ee,customerFormLabel:Q,formErrorsResource:O,addressInfo:X}),(0,s.jsx)("div",{className:"flex flex-row w-full mb-nof-16 mt-nof-16",children:(0,s.jsx)(D.S,{label:nH(L?.sample_terms?.paragraph),error:c.terms&&O?.invalid_order_section?.label,checked:J,...a("terms",{required:O?.invali
1d_order_section?.label})})}),(0,s.jsxs)("div",{className:"flex flex-row gap-nof-16 mb-nof-32",children:[(0,s.jsx)(u.b,{href:N?.terms_hs?.url,text:N?.terms_hs?.label??N?.terms_hs?.url,external:!0}),(0,s.jsx)(u.b,{href:N?.rates_hs?.url,text:N?.rates_hs?.label??N?.rates_hs?.url,external:!0})]}),(0,s.jsx)(nB,{offer:V}),(0,s.jsx)("div",{className:"flex justify-center mb-nof-32",children:(0,s.jsx)(d.$n,{"data-testid":"e2e-submit-create-order",label:`${C?.order?.label} ${nF(V)}`,type:"submit",loading:y,loadingLabel:`${C?.order?.label} ${nF(V)}`})})]}),(0,s.jsx)(b.c,{variant:b.K.LowContrast}),(0,s.jsx)(nR,{})]})]})},nH=e=>(0,s.jsx)("div",{className:"flex flex-col gap-nof-12",children:(0,s.jsx)(tw,{text:e})}),nq=({onContinueReading:e})=>{let[t,r]=(0,p.useState)("form"),a=(0,P.mN)({defaultValues:{firstName:"",lastName:"",email:"",streetAddress:"",zipCode:"",postOffice:"",phoneNumber:"+358"}});return t===nG?(0,s.jsx)(nK,{getValues:a.getValues,onContinueReading:e}):(0,s.jsx)(nz,{formMethods:a,viewChange:e=>{r(e)},onContinueReading:e})},nY=async({secureOrderId:e,brand:t,env:r,accountId:a})=>{try{return(await eC({method:"GET",path:"/getActivationStatus",query:{secureOrderId:e,...a&&{accountId:a}},retries:2},t,r)).body}catch(e){throw e instanceof Error?e:Error("An unknown error occurred",{cause:e})}},nZ=async({activationStatusProps:e,refreshUserInfo:t,onPurchaseSuccess:r,dispatch:a,errorDispatch:n,setActiveView:i})=>{let{secureOrderId:o,brand:s,env:l,accountId:d}=e;try{let e=await nY({secureOrderId:o,brand:s,env:l,accountId:d});e.status===m.OE.Success&&r?.({isCop:rG(e.purchasedProducts)}),await t?.(),a({type:tm,orderConfirmationData:e})}catch{n({type:ed,viewError:{type:t$.PAYMENT_FAILED}}),i(t0)}},nJ=e=>e?e.reduce((e,t)=>({...e,[t.key]:{label:t?.label,ariaLabel:t?.ariaLabel}}),{}):null,nQ=e=>e?e.reduce((e,t)=>({...e,[t.key]:{paragraph:t?.paragraph,link:t?.link}}),{}):null,nX=e=>e?e.reduce((e,t)=>({...e,[t.key]:{description:t?.description,title:t?.title}}),{}):null,n0=e=>e?e.reduce((e,t)=>({...e,[t.key]:{url:t?.url,externalLink:t?.externalLink,label:t?.label,ariaLabel:t?.ariaLabel}}),{}):null,n1=(e,t)=>{let r=n2(e);r&&t({type:th,selectedSelector:r})},n2=e=>e.find(e=>e.checked)??e[0],n4=(e,t)=>!!t?.modularOffering&&t?.globalFunnelConfiguration.areFunnelsEnabled&&!!e?.accountIdEncoded&&"REGULAR"===e.userType,n6=({onContinueReading:e,...t})=>{let{store:{activeView:r}}=nS(),{initializing:a}=(({userProfile:e,audienceIdForCampaignFetch:t,preSelectedOffer:r,orderConfirmationState:a,refreshUserInfo:n,onPurchaseSuccess:i})=>{let{store:{setActiveView:o}}=nS(),{store:{viewError:s},dispatch:l}=ef(),{articleId:d,brand:c,env:u,funnelId:f,getJwtToken:h}=tk(),[g,b]=(0,p.useState)(!1),y=(0,p.useRef)(!1),{dispatch:x,store:v}=tj(),{store:_,dispatch:j}=es(),{store:S,dispatch:E}=ev(),I=(0,p.useCallback)(async({getCampaignProps:e,dispatch:t,dictionaryDispatch:r,sampleDictionaryDispatch:a,preSelectedOffer:n})=>{let i,o;try{i=await nm(e)}catch(e){if(e instanceof ew&&e.knownErrorCode===m.LW.CAMPAIGN_ENDED){let t=e.body?.knownErrorCode===m.LW.CAMPAIGN_ENDED?e.body:void 0,a=nX(t?.errorSet),n=nJ(t?.buttonLabelSet);throw(a||n)&&r({type:X,payload:{errorMessages:a??{},buttonLabel:n??{}}}),rK({eventName:r_,eventLabel:"campaign ended"}),Error(t$.CAMPAIGN_ENDED)}throw Error(t$.GET_CAMPAIGN)}let s=(o=i,["audienceId","funnelData","globalFunnelConfiguration","products","offeringCode","offers","variant","modularOffering","minAge","maxAge"].reduce((e,t)=>(t in o&&(e[t]=o[t]),e),{}));t({type:ts,campaignData:s}),t({type:tf,selectedTab:((e,t=!1)=>{if(t&&e.allowGiftSubscription)return ta;switch(e.defaultTab?.toLowerCase()){case"gift":if(e.allowGiftSubscription)return ta;break;case"company":if(e.allowCompanySubscription)return tn}return tr})(s.funnelData,s.modularOffering)});let l=(({campaignData:e,dispatch:t,preSelectedOffer:r})=>{let a=(({offers:e,defaultOfferIndex:t,preSelectedOffer:r})=>{let a=r?eL(r):t?eL(t):0;return e.map((e,t)=>({index:t,id:`selector-${t}`,checked:t===a,offer:e}))})({offers:e.offers,defaultOfferIndex:e.funnelData.defaultOfferIndex,preSelectedOffer:r});return e.modularOffering?t({type:tu,selectors:a}):(t({type:tg,selectors:a}),n1(a,t)),a})({campaignData:s,dispatch:t,preSelectedOffer:n}
1),d=l.find(e=>e.checked)?.offer.productId;t({type:tp,selectedProduct:s.products.find(e=>e.productId===d)??s.products[0]}),i.funnelData.funnelType===m.t.Sample?((e,t)=>{let{dictionarySets:r,dictionaryParagraphSets:a,errorSet:n,linkSet:i}=e;r&&a&&(({dictionarySets:e,dictionaryParagraphSets:t,errorSet:r,linkSet:a,dispatch:n})=>{let i=nJ(e.find(e=>"customer_form_labels"===e.setKey)?.dictionaryItem),o=nJ(e.find(e=>"sample_confirmation"===e.setKey)?.dictionaryItem),s=nJ(e.find(e=>"sample_product"===e.setKey)?.dictionaryItem),l=nJ(e.find(e=>"sample_labels_set"===e.setKey)?.dictionaryItem),d=nJ(e.find(e=>"sample_button_set"===e.setKey)?.dictionaryItem),c=nJ(e.find(e=>"sample_misc"===e.setKey)?.dictionaryItem),u=nJ(e.find(e=>"sample_form_errors"===e.setKey)?.dictionaryItem),m=nQ(t.find(e=>"sample_paragraph_set"===e.setKey)?.dictionaryItem),p=nQ(t.find(e=>"sample_legal"===e.setKey)?.dictionaryItem);n({type:eh,payload:{customerFormLabel:i,sampleConfirmation:o,sampleProduct:s,sampleLabels:l,sampleButtons:d,sampleMisc:c,login:nJ(e.find(e=>"sample_login_set"===e.setKey)?.dictionaryItem),sampleFormErrors:u,sampleParagraphs:m,sampleLegal:p,errorMessages:nX(r),links:n0(a)}})})({dictionarySets:r,dictionaryParagraphSets:a,errorSet:n,linkSet:i,dispatch:t})})(i.dictionary,a):(({dictionaryData:e,dictionaryDispatch:t,dispatch:r,selectors:a,preSelectedOffer:n})=>{n&&r({type:td,preSelectedOffer:n}),((e,t,r,a)=>{let{dictionarySets:n,dictionaryParagraphSets:i,defaultOfferDescription:o,errorSet:s,linkSet:l}=e;if(n&&i&&o){let e,d,c,u;(({dictionarySets:e,dictionaryParagraphSets:t,errorSet:r,linkSet:a,defaultOfferDescription:n,dispatch:i})=>{let o=nJ(e.find(e=>"button_labels"===e.setKey)?.dictionaryItem),s=nJ(e.find(e=>"section_titles"===e.setKey)?.dictionaryItem),l=nJ(e.find(e=>"subscription_kind"===e.setKey)?.dictionaryItem),d=nJ(e.find(e=>"order_confirm_desc"===e.setKey)?.dictionaryItem),c=nJ(e.find(e=>"order_info_titles"===e.setKey)?.dictionaryItem),u=nJ(e.find(e=>"misc"===e.setKey)?.dictionaryItem),m=nJ(e.find(e=>"paragraphs"===e.setKey)?.dictionaryItem),p=nJ(e.find(e=>"customer_form_labels"===e.setKey)?.dictionaryItem),f=nJ(e.find(e=>"payment_type_labels"===e.setKey)?.dictionaryItem),h=nJ(e.find(e=>"info_highlights"===e.setKey)?.dictionaryItem),g=nJ(e.find(e=>"form_errors"===e.setKey)?.dictionaryItem),b=nJ(e.find(e=>"login_set"===e.setKey)?.dictionaryItem),y=nJ(e.find(e=>"tab_label_set"===e.setKey)?.dictionaryItem),x=nQ(t.find(e=>"confirmation_page"===e.setKey)?.dictionaryItem),v=nQ(t.find(e=>"legal"===e.setKey)?.dictionaryItem),_=nQ(t.find(e=>"alt_orders"===e.setKey)?.dictionaryItem),j=nQ(t.find(e=>"payment_type_desc"===e.setKey)?.dictionaryItem),S=nX(r),E=n0(a);i({type:Q,payload:{buttonLabel:o,formSectionTitle:s,subscriptionKindLabels:l,orderConfirmDesc:d,orderInfoTitle:c,misc:u,paragraph:m,customerFormLabel:p,paymentTypeLabel:f,infoHighlights:h,formErrors:g,login:b,tabLabel:y,confirmation:x,legal:v,altOrders:_,defaultOfferDescription:n.offerDescription,defaultCycloneDescription:n.cycloneDescription,paymentTypeDesc:j,errorMessages:S,links:E}})}
1)({dictionarySets:n,dictionaryParagraphSets:i,errorSet:s,linkSet:l,defaultOfferDescription:o,dispatch:t}),r({type:ty,subscriptionKindState:(e=nJ(n.find(e=>"subscription_kind"===e.setKey)?.dictionaryItem),d=a.some(e=>e.offer.subscriptionKind===m.Ew.Recurring),c=a.some(e=>e.offer.subscriptionKind===m.Ew.Fixed),u=a.find(e=>e.checked),d&&c?{active:u?.offer.subscriptionKind??m.Ew.Recurring,display:[{id:m.Ew.Recurring,label:e?.recurring_subscription?.label??m.Ew.Recurring},{id:m.Ew.Fixed,label:e?.fixed_subscription?.label??m.Ew.Fixed}]}:c?{active:m.Ew.Fixed,display:[{id:m.Ew.Fixed,label:e?.fixed_subscription?.label??m.Ew.Fixed}]}:{active:m.Ew.Recurring,display:[{id:m.Ew.Recurring,label:e?.recurring_subscription?.label??m.Ew.Recurring}]})})}})(e,t,r,a)})({dictionaryData:i.dictionary,dictionaryDispatch:r,dispatch:t,selectors:l,preSelectedOffer:n})},[]);return(0,p.useEffect)(()=>{!a&&n4(e,v.campaignData)&&void 0!==v.initialModularOfferSelectors&&(async(e,t)=>{try{let r=((e,t,r)=>{let a=new Set(e.offers.map(e=>e.offerId)),n=t.filter(e=>a.has(e.offer.offerId));if(0===n.length)throw Error(t$.UPSELL_NOT_ALLOWED);return r({type:tg,selectors:n}),n1(n,r),e.offers[0].qualifyingSubscriptions[0]})(await np({brand:c,env:u,audienceId:e.audienceId,getJwtToken:h,allowGiftSubscription:e.funnelData.allowGiftSubscription}),t,x);x({type:tc,qualifyingSubscription:r})}catch(e){e instanceof Error&&rf(e.message)?l({type:ed,viewError:{type:e.message}}):l({type:ed,viewError:{type:t$.UPSELL_FETCH_FAILED}}),o(t0)}})(v.campaignData,v.initialModularOfferSelectors)},[e,c,x,u,l,h,a,o,v.campaignData,v.initialModularOfferSelectors]),(0,p.useEffect)(()=>{y.current||g||s?.type||v.campaignData||(y.current=!0,(async()=>{b(!0),await I({getCampaignProps:{funnelId:f,brand:c,env:u,audienceId:t},dispatch:x,dictionaryDispatch:j,sampleDictionaryDispatch:E,preSelectedOffer:r}).then(async()=>{a&&!v.orderConfirmationData&&await nZ({activationStatusProps:{secureOrderId:a.secureOrderId,brand:c,env:u,accountId:e?.accountIdEncoded},refreshUserInfo:n,onPurchaseSuccess:i,dispatch:x,errorDispatch:l,setActiveView:o})}).catch(e=>{console.error("Funnel initialization failed",e),l({type:ed,viewError:{type:e instanceof Error&&rf(e.message)?e.message:t$.GET_CAMPAIGN}}),o(t0)})})())},[e?.accountIdEncoded,d,t,c,I,j,x,u,l,f,g,i,a,r,n,E,o,v.campaignData,v.orderConfirmationData,s?.type]),(0,p.useEffect)(()=>{if(v.campaignData){let t=v.campaignData?.funnelData.funnelType===m.t.Sample?S?.sampleMisc:_?.misc,r=!!a,n=!n4(e,v.campaignData)||n4(e,v.campaignData)&&!!v.qualifyingSubscription,i=v.campaignData.globalFunnelConfiguration.areFunnelsEnabled;t.initialDictionaryObject||r||!n||(i||(l({type:ed,viewError:{type:t$.FUNNELS_DISABLED}}),o(t0)),b(!1)),r&&v.orderConfirmationData&&b(!1)}},[e,_,l,a,S?.sampleMisc,o,v.campaignData,v.orderConfirmationData,v.qualifyingSubscription]),(0,p.useEffect)(()=>{s?.type&&b(!1)},[s]),(0,p.useEffect)(()=>{v.userProfile!==e&&x({type:ti,userProfile:e})},[e,x,v.userProfile]),(0,p.useEffect)(()=>{let e=v.campaignData?.globalFunnelConfiguration.areFunnelsEnabled===!0;v.campaignData&&e&&o((e=>{switch(e){case"single":return t1;case"sample":return t2;default:return t0}})(v.campaignData.funnelData.funnelType))},[o,v.campaignData]),{initializing:g}})(t),{isStandalone:n}=tk(),i=(0,p.useCallback)(e=>{null===e||f.A.get("campaignIds")||eH(e)},[]);return(0,s.jsx)("div",{id:"shopping","data-testid":n?"shopping_standalone":"shopping",ref:i,children:(0,s.jsxs)("div",{className:(0,Z.default)({"flex justify-center my-nof-32 mx-nof-0 xl:w-[980px]":n,"mx-auto max-w-[640px]":!n}),children:[a&&(0,s.jsx)(rg,{children:(0,s.jsx)(l.y,{})}),!a&&r&&(r=>{switch(r){case t2:return(0,s.jsx)(nq,{onContinueReading:e});case t1:return(0,s.jsx)(nw,{onContinueReading:e,subscribedOfferState:t.orderConfirmationState});default:return(0,s.jsx)(rh,{})}})(r)]})})},n3=class extends p.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error(e,t)}render(){return this.state.hasError?(0,s.jsx)("div",{"data-testid":"errorboundary",className:"mb-nof-16",children:(0,s.jsx)(U.A,{title:"Valitettavasti jotain meni vikaan",message:"Tilauslomakkeen lataamisessa tapahtui virhe. Kokeile my\xf6hemmin uudelleen tai tutustu muihin tuotteisiimme."})}):this.props.children}},n8=(0,p.lazy)(()=>r.e(6481).then(r.bind(r,6481))),n5=(0,p.lazy)(()=>r.e(4058).then(r.bind(r,4058))),n7=(0,p.lazy)(()=>r.e(2035).then(r.bind(r,2035))),n9=(0,p.lazy)(()=>r.e(7768).then(r.bind(r,7768))),ie=(0,p.lazy)(()=>r.e(701).then(r.bind(r,20701))),it=({designSystem:e,children:t})=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(p.Suspense,{fallback:(0,s.jsx)(s.Fragment,{}),children:[(0,s.jsx)(n8,{}),(()=>{switch(e){case"business":return(0,s.jsx)(ie,{});case"hs":return(0,s.jsx)(n5,{});case"is":case"mn":return(0,s.jsx)(n7,{});default:return(0,s.jsx)(n9,{})}})()]}),t]}),ir=({children:e,isStandalone:t,shoppingProps:r})=>(0,s.jsx)(it,{designSystem:r.designSystem,children:(0,s.jsx)(tI,{shoppingProps:r,isStandalone:t,children:(0,s.jsx)(nl,{children:(0,s.jsx)(eo,{children:(0,s.jsx)(ex,{children:(0,s.jsx)(tS,{children:(0,s.jsx)(nj,{children:(0,s.jsx)(ep,{children:e})})})})})})})}),ia=e=>{let{userProfile:t,audienceId:r,onContinueReading:a,preSelectedOffer:n}
1=e;return(0,s.jsx)(n3,{children:(0,s.jsx)(ir,{shoppingProps:e,isStandalone:!1,children:(0,s.jsx)(n6,{userProfile:eZ(t),audienceIdForCampaignFetch:r,onContinueReading:a,preSelectedOffer:n})})})},ii=e=>{let{userProfile:t,audienceId:r,onContinueReading:a,refreshUserInfo:n,orderConfirmationState:i,preSelectedOffer:o,onPurchaseSuccess:l}=e;return f.A.get("confirmationLogin")&&(f.A.remove("confirmationLogin"),a({isCop:!1})),(0,s.jsx)(n3,{children:(0,s.jsx)(ir,{shoppingProps:e,isStandalone:!0,children:(0,s.jsx)(n6,{userProfile:eZ(t),audienceIdForCampaignFetch:r,refreshUserInfo:n,onContinueReading:a,orderConfirmationState:i,preSelectedOffer:o,onPurchaseSuccess:l})})})},io=e=>f.A.get("secureOrderId")?(0,s.jsx)(n3,{children:(0,s.jsx)(it,{designSystem:e.designSystem,children:(0,s.jsx)(ep,{children:(0,s.jsx)(nO,{...e})})})}):null}}]);
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.