1"use strict";(self.webpackChunkmatkahuolto_web=self.webpackChunkmatkahuolto_web||[]).push([[8913],{65615:function(t,e,n){n.d(e,{A:function(){return Y}});var a=n(52531),o=n(66835),l=n(61225),i=n(96540),r=n(14549),c=n(69086),s=n(32555),u=n(32389),d=n(241),p=n(336);const m=t=>(0,a.Y)(o.so,Object.assign({as:d.A,partiallyActive:!0},t,{sx:{position:"relative",p:2,mx:-2,borderRadius:1,color:"text",":hover":{color:"primary"},'&[aria-current="page"]':{bg:"primary",color:"white","> svg":{color:"currentColor"}},"> svg":{mr:3,color:"primary"}}}),t.icon&&t.icon,t.children),g=t=>{let{children:e,...n}=t;return(0,a.Y)(o.az,Object.assign({sx:{fontWeight:"medium",mt:3,mb:2}},n),e)};var v=t=>{let{hideMenu:e}=t;const{t:n}=(0,u.Bd)(),{0:r,1:c}=(0,i.useState)(!1),s=(0,l.d4)((t=>Object.keys(t.shipments.archived).length>0)),{user:d,isLoading:v}=(0,l.d4)((t=>t.session));return!v&&e?null:(0,a.Y)(o.az,{sx:{width:["auto",null,320],pr:[3,null,4],pl:[3,null,0],mr:[-3,null,4],ml:[-3,null,0],borderRightStyle:[null,null,"solid"],borderRightWidth:[null,null,"1px"],borderBottomStyle:["solid",null,"none"],borderBottomWidth:["1px",null,"0"],borderColor:"border"}},(0,a.Y)(o.$n,{variant:"plain",onClick:()=>c(!r),sx:{width:"100%",display:["flex",null,"none"],justifyContent:"space-between",alignItems:"center",color:"text",py:3}},n("account.myPages.title"),(0,a.Y)(p.zp,{sx:{width:16,height:16,transform:`rotate(${r?"-90deg":"90deg"})`}})),(0,a.Y)(o.az,{sx:{display:[r?"block":"none",null,"block"],py:[3,4],borderTop:["1px solid",null,"none"],borderColor:"border"}},(0,a.Y)(g,{sx:{mt:0}},n("account.navigation.myParcels")),(0,a.Y)(m,{to:"/my-pages/incoming-parcels",icon:(0,a.Y)(p.an,null)},n("account.navigation.receivedParcels")),(0,a.Y)(m,{to:"/my-pages/sent-parcels",icon:(0,a.Y)(p.HM,null)},n("account.navigation.sentParcels")),(0,a.Y)(m,{to:"/my-pages/multi-parcels",icon:(0,a.Y)(p.yP,null)},n("account.navigation.multiParcels")),s&&(0,a.Y)(m,{to:"/my-pages/parcel-archive",icon:(0,a.Y)(p.uc,null)},n("account.navigation.archive")),(0,a.Y)(g,null,n("account.navigation.myTrips")),(0,a.Y)(m,{to:"/my-pages/my-tickets",icon:(0,a.Y)(p.cR,null)},n("account.navigation.tickets")),(0,a.Y)(m,{to:"/my-pages/travel-cards",icon:(0,a.Y)(p.MS,null)},n("account.navigation.travelCards")),(0,a.Y)(m,{to:"/my-pages/favorite-trips",icon:(0,a.Y)(p.hx,null)},n("account.navigation.favouriteRoutes")),(0,a.Y)(g,null,n("account.header")),(0,a.Y)(m,{to:"/my-account",icon:(0,a.Y)(p.EE,null)},n("account.navigation.settings")),(0,a.Y)(m,{to:"/change-password",icon:(0,a.Y)(p.Fw,null)},n("account.navigation.changePassword"))))};var Y=t=>{let{title:e,locale:n,paths:u,sidebar:d,hideMenu:p,...m}=t;const g=(0,l.wA)(),Y=(0,l.d4)((t=>!(!t.session||!t.session.user)));return(0,i.useEffect)((()=>{(async()=>{if(!Y){if(c.gf())return;{const t=window.location.pathname;g((0,r.I8)("/login",`?afterLogin=${t}`))}}})()}),[Y,g]),(0,a.Y)(s.A,Object.assign({title:e,locale:n,paths:u,darkMode:!0,showNavigation:!1,footer:!1},m),(0,a.Y)(o.mc,{variant:"wide"},(0,a.Y)(o.so,{sx:{flex:1,flexDirection:["column",null,"row"]}},(0,a.Y)(v,{hideMenu:p}),(0,a.Y)(o.so,{sx:{width:"100%",position:"relative",justifyContent:"space-between",flexWrap:["wrap",null,null,null,"nowrap"]}},(0,a.Y)(o.az,{sx:{mr:[null,null,null,null,4],flex:"auto"}},m.children),d&&(0,a.Y)(o.az,{sx:{flex:"none",py:[3,4],width:["100%",null,360,400]}},d)))))}},81939:function(t,e,n){n.r(e),n.d(e,{default:function(){return D}});var a=n(52531),o=n(66835),l=n(96540),i=(n(61225),n(32389)),r=n(45458),c=n(98993),s=n(58168),u=n(69346),d=n(52836),p=n(89379),m=n(80045),g=n(15777),v=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],Y=function(){var t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0,n=String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toLowerCase(),a=String(e.getOptionValue(t)).toLowerCase(),o=String(e.getOptionLabel(t)).toLowerCase();return a===n||o===n},f={formatCreateLabel:function(t){return'Create "'.concat(t,'"')},isValidNewOption:function(t,e,n,a){return!(!t||e.some((function(e){return Y(t,e,a)}))||n.some((function(e){return Y(t,e,a)})))},getNewOptionData:function(t,e){return{label:e,value:t,__isNew__:!0}}};n(12897),n(17383),n(34579),n(29511),n(81660),n(41132),n(85715),n(91847),n(73738),n(20166),n(43693),n(40961),n(27003);var h=(0,l.forwardRef)((function(t,e){var n,a,o,i,c,Y,h,y,b,C,w,x,O,k,A,L,M,S,P,N,V,j,z,R,D,E,G,I,W=(0,d.u)(t),B=(a=(n=W).allowCreateWhileLoading,o=void 0!==a&&a,i=n.createOptionPosition,c=void 0===i?"last":i,Y=n.formatCreateLabel,h=void 0===Y?f.formatCreateLabel:Y,y=n.isValidNewOption,b=void 0===y?f.isValidNewOption:y,C=n.getNewOptionData,w=void 0===C?f.getNewOptionData:C,x=n.onCreateOption,O=n.options,k=void 0===O?[]:O,A=n.onChange,L=(0,m.A)(n,v),M=L.getOptionValue,S=void 0===M?u.g:M,P=L.getOptionLabel,N=void 0===P?u.b:P,V=L.inputValue,j=L.isLoading,z
1=L.isMulti,R=L.value,D=L.name,E=(0,l.useMemo)((function(){return b(V,(0,g.H)(R),k,{getOptionValue:S,getOptionLabel:N})?w(V,h(V)):void 0}),[h,w,N,S,V,b,k,R]),G=(0,l.useMemo)((function(){return!o&&j||!E?k:"first"===c?[E].concat((0,r.A)(k)):[].concat((0,r.A)(k),[E])}),[o,c,j,E,k]),I=(0,l.useCallback)((function(t,e){if("select-option"!==e.action)return A(t,e);var n=Array.isArray(t)?t:[t];if(n[n.length-1]!==E)A(t,e);else if(x)x(V);else{var a=w(V,V),o={action:"create-option",name:D,option:a};A((0,g.D)(z,[].concat((0,r.A)((0,g.H)(R)),[a]),a),o)}}),[w,V,z,D,E,x,A,R]),(0,p.A)((0,p.A)({},L),{},{options:G,onChange:I}));return l.createElement(u.S,(0,s.A)({ref:e},B))})),y=n(69764),b=n(69086),C=n(95093),w=n(46431);function x(){if("undefined"==typeof window)return null;const t=navigator.userAgent||navigator.vendor||window.opera;return/android/i.test(t)?"android":/iPad|iPhone|iPod/.test(t)&&!window.MSStream?"ios":null}var O=n(42174);const k="https://play.google.com/store/apps/details?id=com.kyyti.ride.matkahuolto&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1",A="https://apps.apple.com/fi/app/reitit-ja-liput/id1496304929";var L=t=>{let{type:e}=t;const{t:n,i18n:r}=(0,i.Bd)(),c=r.language,s=(0,l.useMemo)((()=>"android"===x()),[]),u=(0,l.useMemo)((()=>"ios"===x()),[]);return(0,a.Y)(o.az,{sx:{bg:"blueLighter",p:3,pb:2,borderRadius:1}},(0,a.Y)("div",null,n(`account.${e}.seeInRL`)),!u&&!s&&(0,a.Y)(o.so,{sx:{mt:3,justifyContent:"center"}},(0,a.Y)("a",{href:k,onClick:t=>(0,O.G4)(t,k)},(0,a.Y)("img",{alt:n("account.myCards.downloadGooglePlay"),src:`/play_button/${c}.png`,sx:{maxHeight:"50px",mr:2}})),(0,a.Y)("a",{href:A,onClick:t=>(0,O.G4)(t,A)},(0,a.Y)("img",{alt:n("account.myCards.downloadAppStore"),src:`/app_store/${c}.svg`,sx:{maxHeight:"50px",p:1}}))),u&&(0,a.Y)("a",{sx:{display:"flex",alignItems:"center",textDecoration:"underline"},href:A,onClick:t=>(0,O.G4)(t,A)},n("account.myCards.downloadRl")),s&&(0,a.Y)("a",{sx:{display:"flex",alignItems:"center",textDecoration:"underline"},href:k,onClick:t=>(0,O.G4)(t,k)},n("account.myCards.downloadRl")))};const M=t=>{let{label:e,value:n}=t;return(0,a.Y)(l.Fragment,null,(0,a.Y)("div",{sx:{fontWeight:"medium",gridColumn:1}},e),(0,a.Y)("div",null,n))},S=t=>{let{children:e}=t;return(0,a.Y)(o.az,{sx:{my:4,display:"grid",gridTemplateColumns:"auto 1fr",columnGap:4,rowGap:1,textAlign:"left"}},e)},P=t=>{let{card:e}=t;const{cardNumber:n,product:o,productName:r,ticketCategory:c,travelLength:s,journeys:u,cardValidUntil:d,balance:p,validStart:m,validEnd:g}=e,{t:v}=(0,i.Bd)(),Y=!!o&&!!c;return(0,a.Y)(S,null,(0,a.Y)(M,{label:v("account.myCards.cardNumber"),value:V(n)}),(0,a.Y)(M,{label:v("account.myCards.cardValidUntil"),value:C(d).format("D.M.YYYY")}),Y?(0,a.Y)(l.Fragment,null,(0,a.Y)(M,{label:v("account.myCards.product"),value:r}),(0,a.Y)(M,{label:v("account.myCards.productValidUntil"),value:C(g).format("D.M.YYYY")}),"number"==typeof p?(0,a.Y)(M,{label:v("account.myCards.balance"),value:(0,w.$g)(p)}):null,!!s&&(0,a.Y)(M,{label:v("account.myCards.travelLength"),value:s+" km"}),!!u&&(0,a.Y)(M,{label:v("account.myCards.journeys"),value:u+" "+v("account.myCards.piece")})):(0,a.Y)("div",{sx:{fontWeight:"medium",gridColumn:"1 / span 2"}},v("account.myCards.noProduct")))};function N(t){if(!t)return!1;const e=t.replaceAll(" ","");return/^[MF]\d{18}$/.test(e)}const V=t=>{const e=t.length;let n="";for(let a=1;a<=e;a++)n=t[e-a]+n,a%3==0&&a<e-1&&(n=" "+n);return n};var j=()=>{const{t:t}=(0,i.Bd)(),{0:e,1:n}=(0,l.useState)([]),{0:s,1:u}=(0,l.useState)(),{0:d,1:p}=(0,l.useState)(),{0:m,1:g}=(0,l.useState)([]),v=(0,l.useCallback)((t=>{const{value:e}=t||{};p(),u(e)}),[u]);(0,l.useEffect)((()=>{(async()=>{if(!s)return;const t=await b.RI(s);p(t)})()}),[s]);const Y=(0,l.useMemo)((()=>[].concat((0,r.A)(m),(0,r.A)(e||[])).map((t=>({value:t,label:V(t)})))),[e,m]),f=(0,l.useCallback)((t=>{const e=t.replaceAll(" ","");""!==e&&(g([].concat((0,r.A)(m),[e])),p(),u(e))})),C=(0,l.useMemo)((()=>e=>{const n=e.replaceAll(" ","");return t("account.myCards.search")+" "+V(n)}),[t]);return(0,a.Y)(o.az,null,(0,a.Y)(c.IE.h1,null,t("account.myCards.title")),(0,a.Y)(c.IE.p,null,t("account.myCards.ingress")),!e&&(0,a.Y)("div",{sx:{position:"relative",height:"100px"}},(0,a.Y)(y.A,null)),(0,a.Y)("div",{sx:{maxWidth:"300px"}},(0,a.Y)(h,{isClearable:!0,options:Y,onChange:v,onCreateOption:f,value:Y.find((t=>t.value===s)),isValidNewOption:N,formatCreateLabel:C,placeholder:t("account.myCards.enter"),isOptionSelected:t=>t.value===s})),d&&!d.found&&(0,a.Y)(c.IE.p,{sx:{my:4}}
1,t("account.myCards.notFound")),(null==d?void 0:d.found)&&(0,a.Y)(P,{card:d}),(0,a.Y)(o.az,{sx:{mt:4}},(0,a.Y)(L,{type:"myCards"})))},z=n(71671),R=n(65615);var D=t=>{let{location:e,pageContext:n}=t;O.LM("matkustajat");const{t:l}=(0,i.Bd)(),r=l("account.myCards.title");return(0,a.Y)(R.A,{title:r,paths:n.paths,locale:n.locale||"en",sidebar:(0,a.Y)(o.az,null,(0,a.Y)(z.Gd,{sidebar:!0,sx:{mb:3}}),(0,a.Y)(z.GU,{sidebar:!0}))},(0,a.Y)(j,null))}}}]); 2//# sourceMappingURL=component---src-pages-my-pages-travel-cards-js-b97b4ac91d662136b22c.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.