@wayke-se/components-react 4.6.4 → 4.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3266,7 +3266,7 @@ and ensure you are accounting for this risk.
|
|
|
3266
3266
|
margin-bottom: 0;
|
|
3267
3267
|
}
|
|
3268
3268
|
}
|
|
3269
|
-
`;var C8=({severity:e,icon:t,heading:r,children:i})=>{let n=br.createElement(Fr,{block:!0});return e==="error"?n=br.createElement(sm,{block:!0}):e==="warning"?n=br.createElement(um,{block:!0}):e==="success"&&(n=br.createElement(Hr,{block:!0})),br.createElement(of,{severity:e},t&&br.createElement(af,null,n),br.createElement(sf,null,r&&br.createElement(uf,null,r),br.createElement(cf,null,i)))},Xn=C8;import{useCallback as P8,useEffect as T8,useState as M8}from"react";var N8=e=>{let[t,r]=M8(()=>!!fe.isInitialized),i=P8(async n=>{await Xp(n),r(!0)},[]);return T8(()=>{fe.isInitialized||i(e)},[]),t},Zi=N8;var _8=[{filterName:"manufacturer"},{filterName:"modelSeries"},{filterName:"fuelType"},{filterName:"gearboxType"},{filterName:"branch"},{filterName:"color"},{filterName:"environmentClass"},{filterName:"properties.segment"},{filterName:"drivingWheel"},{filterName:"price"},{filterName:"leasingPrice"},{filterName:"businessLeasingPrice"},{filterName:"mileage"},{filterName:"odometerValueAsKm"},{filterName:"modelYear"}],L8=({marketCode:e,filterList:t,initialQueryParams:r,hashRoute:i,pathRoute:n,removeSearchBar:a,placeholderImage:s,removeFilterOptions:u,modifyDocumentTitleSearch:c,displayBranchName:f,onClickSearchItem:h})=>{let{error:k,documents:b,response:S,queryFilter:_,onFilterUpdate:P,onInitialize:w}=et(),I=Zi(e),E=df(()=>{if(t)return t;let g=[..._8];return!e||e==="SE"?g.filter(v=>v.filterName!=="odometerValueAsKm"):e==="NO"?g.filter(v=>v.filterName!=="mileage"):g},[t,e]);Lc(()=>{c&&(document.title=c),w(typeof r=="string"?new URLSearchParams(r):r)},[]),Lc(()=>{let g=new URLSearchParams(_.searchParams);Z.publish("SearchInitiated",{query:g.toString()})},[_]),Lc(()=>{if(b){let g=new URLSearchParams(_.searchParams);Z.publish("SearchCompleted",{query:g.toString(),hits:b.length,totalHits:S?.stats.totalHits||b.length})}},[b]);let o=lf(g=>{Z.publish("ItemClicked",g),h&&h(g)},[]),l=lf(()=>{let g=new URLSearchParams(_.searchParams),v=g.get("query");g.delete("query"),Z.publish("SearchClearQuery",{query:v}),P(g.toString())},[_.searchParams]),d=df(()=>_.searchParams.get("query"),[b]);return I?Le.createElement(Le.Fragment,null,Le.createElement(Or,null,!a&&Le.createElement(mt,null,Le.createElement(pt,null,Le.createElement(nf,null))),d&&Le.createElement(mt,null,Le.createElement(pt,null,Le.createElement(Wh,{onClear:l},d))),!u&&Le.createElement(mt,null,Le.createElement(pt,null,Le.createElement(Ah,{filterList:E,marketCode:e}))),Le.createElement(mt,{accent:!0,fillSpace:!0,className:"wayke__theme wayke__color--accent-bg"},Le.createElement(pt,null,Le.createElement(pm,null,Le.createElement(Le.Fragment,null,k&&Le.createElement(Xn,{severity:"error",icon:!0,heading:"Ett fel har intr\xE4ffat"},"V\xE4nligen f\xF6rs\xF6k igen."),!k&&b&&b.length>0&&Le.createElement(qh,{hashRoute:i,pathRoute:n,onClickItem:o,documents:b,placeholderImage:s,displayBranchName:f}),!k&&b&&b.length===0&&Le.createElement(Xn,{severity:"warning",icon:!0,heading:fe.t("search.snackbarNoSearchResults.heading")||void 0},fe.t("search.snackbarNoSearchResults.body"))))))),Le.createElement(qn,{id:er.DefaultPortal})):null},Dc=L8;import z,{useMemo as $B,useCallback as ux,useState as zB,useEffect as cx}from"react";import rr from"react";import _a from"styled-components";var pf=_a.ul`
|
|
3269
|
+
`;var C8=({severity:e,icon:t,heading:r,children:i})=>{let n=br.createElement(Fr,{block:!0});return e==="error"?n=br.createElement(sm,{block:!0}):e==="warning"?n=br.createElement(um,{block:!0}):e==="success"&&(n=br.createElement(Hr,{block:!0})),br.createElement(of,{severity:e},t&&br.createElement(af,null,n),br.createElement(sf,null,r&&br.createElement(uf,null,r),br.createElement(cf,null,i)))},Xn=C8;import{useCallback as P8,useEffect as T8,useState as M8}from"react";var N8=e=>{let[t,r]=M8(()=>!!fe.isInitialized),i=P8(async n=>{await Xp(n),r(!0)},[]);return T8(()=>{fe.isInitialized||i(e)},[]),t},Zi=N8;var _8=[{filterName:"manufacturer"},{filterName:"modelSeries"},{filterName:"fuelType"},{filterName:"gearboxType"},{filterName:"branch"},{filterName:"color"},{filterName:"environmentClass"},{filterName:"properties.segment"},{filterName:"drivingWheel"},{filterName:"price"},{filterName:"leasingPrice"},{filterName:"businessLeasingPrice"},{filterName:"mileage"},{filterName:"odometerValueAsKm"},{filterName:"modelYear"}],L8=({marketCode:e="SE",filterList:t,initialQueryParams:r,hashRoute:i,pathRoute:n,removeSearchBar:a,placeholderImage:s,removeFilterOptions:u,modifyDocumentTitleSearch:c,displayBranchName:f,onClickSearchItem:h})=>{let{error:k,documents:b,response:S,queryFilter:_,onFilterUpdate:P,onInitialize:w}=et(),I=Zi(e),E=df(()=>{if(t)return t;let g=[..._8];return!e||e==="SE"?g.filter(v=>v.filterName!=="odometerValueAsKm"):e==="NO"?g.filter(v=>v.filterName!=="mileage"):g},[t,e]);Lc(()=>{c&&(document.title=c),w(typeof r=="string"?new URLSearchParams(r):r)},[]),Lc(()=>{let g=new URLSearchParams(_.searchParams);Z.publish("SearchInitiated",{query:g.toString()})},[_]),Lc(()=>{if(b){let g=new URLSearchParams(_.searchParams);Z.publish("SearchCompleted",{query:g.toString(),hits:b.length,totalHits:S?.stats.totalHits||b.length})}},[b]);let o=lf(g=>{Z.publish("ItemClicked",g),h&&h(g)},[]),l=lf(()=>{let g=new URLSearchParams(_.searchParams),v=g.get("query");g.delete("query"),Z.publish("SearchClearQuery",{query:v}),P(g.toString())},[_.searchParams]),d=df(()=>_.searchParams.get("query"),[b]);return I?Le.createElement(Le.Fragment,null,Le.createElement(Or,null,!a&&Le.createElement(mt,null,Le.createElement(pt,null,Le.createElement(nf,null))),d&&Le.createElement(mt,null,Le.createElement(pt,null,Le.createElement(Wh,{onClear:l},d))),!u&&Le.createElement(mt,null,Le.createElement(pt,null,Le.createElement(Ah,{filterList:E,marketCode:e}))),Le.createElement(mt,{accent:!0,fillSpace:!0,className:"wayke__theme wayke__color--accent-bg"},Le.createElement(pt,null,Le.createElement(pm,null,Le.createElement(Le.Fragment,null,k&&Le.createElement(Xn,{severity:"error",icon:!0,heading:"Ett fel har intr\xE4ffat"},"V\xE4nligen f\xF6rs\xF6k igen."),!k&&b&&b.length>0&&Le.createElement(qh,{hashRoute:i,pathRoute:n,onClickItem:o,documents:b,placeholderImage:s,displayBranchName:f}),!k&&b&&b.length===0&&Le.createElement(Xn,{severity:"warning",icon:!0,heading:fe.t("search.snackbarNoSearchResults.heading")||void 0},fe.t("search.snackbarNoSearchResults.body"))))))),Le.createElement(qn,{id:er.DefaultPortal})):null},Dc=L8;import z,{useMemo as $B,useCallback as ux,useState as zB,useEffect as cx}from"react";import rr from"react";import _a from"styled-components";var pf=_a.ul`
|
|
3270
3270
|
list-style: none;
|
|
3271
3271
|
padding: 0;
|
|
3272
3272
|
margin: 0;
|
|
@@ -5566,7 +5566,7 @@ and ensure you are accounting for this risk.
|
|
|
5566
5566
|
`}
|
|
5567
5567
|
`,Nb=Ms.div``,_b=Ms.div.attrs(()=>({className:"wayke__theme wayke__font--bold"}))`
|
|
5568
5568
|
text-decoration: var(--price-text-decoration);
|
|
5569
|
-
`;var U6=({prices:e})=>Ns.createElement(Tb,null,e?.map((t,r)=>Ns.createElement(Mb,{key:`${t.label}-${r}`,$oldPrice:t.oldPrice},Ns.createElement(Nb,null,t.label),Ns.createElement(_b,null,t.price)))),Lb=U6;import{useTranslation as W6}from"react-i18next";var Q6=({accessory:e,onClose:t})=>{let{t:r}=W6(),i=[{label:r("item.accessories.price"),price:`${K(e.price)} ${r("currency.default")}`,oldPrice:!1}];return e.salePrice&&i.push({label:r("item.accessories.oldPrice"),price:`${K(e.salePrice)} ${r("currency.default")}`,oldPrice:!0}),e.assemblyPrice&&i.push({label:r("item.accessories.installationCost"),price:`${K(e.assemblyPrice)} ${r("currency.default")}`,oldPrice:!1}),ut.createElement(Me,{title:e.name,onClose:t},e.images?.[0]&&ut.createElement(H,null,ut.createElement(Pb,{src:`${e.images[0]}?w=632`,alt:`${e.name}`})),e.logotype&&ut.createElement(H,null,ut.createElement(ze,{logo:`${e.logotype}?w=160`,logo2x:`${e.logotype}?w=320`,alt:e.manufacturer||r("common.logotype")||"",wide:!0})),ut.createElement(H,null,ut.createElement(Lb,{prices:i})),ut.createElement(H,null,ut.createElement(ae,{dangerouslySetInnerHTML:{__html:V6(e.description)}})),e.articleNumber&&ut.createElement(H,null,ut.createElement(di,{as:"div"},r("item.accessories.articleNumberShort")),ut.createElement("div",null,e.articleNumber)),e.productPage&&e.productPage.url&&ut.createElement(H,null,ut.createElement(rs,{href:e.productPage.url,title:r("item.accessories.moreInformationAboutAccessory",{accessory:e.name})||"",target:"_blank",rel:"noopener noreferrer nofollow"},e.productPage.title||r("common.readMore")," (",r("common.opensInNewTab"),")")))},Db=Q6;var K6=({accessories:e})=>{let{t}=Y6(),[r,i]=J6(),n=s=>i(s),a=()=>i(void 0);return e?.length?_t.createElement(_t.Fragment,null,r&&_t.createElement(Db,{accessory:r,onClose:a}),_t.createElement(yt,null,_t.createElement(H,null,_t.createElement(Re,{noMargin:!0},t("item.accessories.accessories"))),_t.createElement(H,null,_t.createElement(ae,null,_t.createElement("p",null,t("item.accessories.accessoriesDescription")))),_t.createElement(H,null,_t.createElement(vs,{columns:1.05,columnsSm:2.1,columnsMd:2,spacing:2,items:e.map(s=>_t.createElement(Cb,{key:s.id,title:s.name,image:s.images?.[0]?{src:`${s.images?.[0]}?w=539&h=303`,alt:s.name}:void 0,price:`${K(s.price)} ${t("currency.default")}`,preamble:s.excerpt,readMoreCta:()=>n(s)}))})))):null},Ob=K6;import{useEffect as RB,useRef as ax}from"react";function jB(e,t,r){let i=ax(),n=ax(r);n.current=r;let a=async()=>{if(t)try{let s=await Promise.resolve().then(()=>(ox(),nx));s&&(i.current=new s.default({id:e,ecomSdkConfig:{api:{address:t.url},bankIdThumbprint:t?.bankIdThumbprint},logo:t.serviceLogotypeUrl,logoX2:t.serviceLogotypeUrl,onEvent:(u,c,f,h)=>{Z.publish("Ecom",{id:e,branchId:n.current?.id,branchName:n.current?.name,view:u,event:c,currentStep:f,data:h})}}))}catch{}};return RB(()=>(a(),()=>{i.current&&i.current.destroy()}),[]),i}var sx=jB;import{marked as qB}from"marked";var GB=({marketCode:e,id:t,hashRoute:r,pathRoute:i,disableResetScrollOnInit:n,placeholderImage:a,modifyDocumentTitleItem:s,displayBranchName:u,onClickSearchItem:c})=>{let f=Zi(e),{ecomSettings:h}=Es(),{loading:k,data:b}=N0(t),{vehicle:S,loading:_}=Ry(b?.vehicle),P=S?.contact,w=S?.branch,I=sx(t,h,w),[E,o]=zB(!1),l=ux(()=>o(!E),[E]);cx(()=>{n||window.scrollTo(0,0)},[]),cx(()=>{if(b?.vehicle?.data&&s){let{vehicle:Bt}=b,{registrationNumber:ia}=Bt.data;document.title=`${ia} | ${Bt.title} | ${Bt.shortDescription}`}},[b]);let d=$B(()=>b?.vehicle?.data?.options?.filter(jn).map(Bt=>({title:Bt})),[b?.vehicle?.data?.options]),g=ux(()=>Z.publish("OptionsClick",{id:t,branchId:w?.id,branchName:w?.name}),[w]);if(!f)return null;if(k)return z.createElement($y,null);if(!b?.vehicle?.data)return z.createElement(jy,null);let{vehicle:v}=b,{title:A,accessories:y,shortDescription:x,media:M,description:N,price:D,discount:F,financialOptions:p,manufacturer:C,ecommerce:T,packageOptions:B,publishedAt:J,documents:j,availableFrom:X,flags:Y}=v,Pe=S?.insuranceOptions?S.insuranceOptions:v.insuranceOptions,{fuelType:V,mileage:Q,gearboxType:xe,odometerReading:we,modelYear:We,propertySet:ci}=v.data,Ot=[{title:We}];return Y?.demoVersion&&Ot.push({title:fe.t("item.demoCar"),onClick:l}),Ot.push({title:`${K(we?.value||Q)} ${fe.t(`odometer.${we?.unit||"ScandinavianMile"}`)}`}),xe&&Ot.push({title:xe}),V&&Ot.push({title:V}),z.createElement(z.Fragment,null,z.createElement(Or,null,z.createElement(mt,{large:!0},z.createElement(pt,null,z.createElement(C0,null,z.createElement(P0,null,z.createElement(an,{mobileOrder:1},!i&&r?z.createElement(H,null,z.createElement(ua,null,z.createElement(Qp,{as:"a",href:"#",title:fe.t("navigation.backToSearch")},z.createElement(ce,null,z.createElement(Vi,{block:!0})),z.createElement(ce,null,fe.t("navigation.backToSearch"))))):null,C?.logotype&&z.createElement(H,null,z.createElement(ze,{logo:C.logotype,alt:C.name})),z.createElement(H,null,z.createElement(je,null,z.createElement(It,{noMargin:!0},A)),x&&z.createElement(je,null,z.createElement("div",null,x)),z.createElement(je,null,z.createElement(Kn,{small:!0,items:Ot})))),z.createElement(an,{mobileOrder:2},z.createElement(gf,{price:D,discount:F||void 0})),(p.length>0||Pe.length>0)&&z.createElement(an,{mobileOrder:4},p.length>0&&z.createElement(tg,{id:t,branch:w,financialOptions:p,marketCode:e}),Pe.length>0&&z.createElement(Hg,{id:t,branch:S?.branch,insuranceOptions:Pe})),z.createElement(an,{mobileOrder:5},z.createElement(sy,{id:t,marketCode:e,manufacturer:C,packageOptions:B,ecommerce:T,branch:w,contact:S?.contact,loadingCentralStorageVehicle:_,availableFrom:X,toggleEcomModal:()=>I.current?.start()}))),z.createElement(Wa,null,z.createElement(an,{mobileOrder:3},z.createElement(I0,{id:t,branch:w,media:M,placeholderImage:a})),z.createElement(yt,null,z.createElement(H,null,z.createElement(Re,{noMargin:!0},fe.t("item.carData"))),z.createElement(H,null,z.createElement(ae,null,z.createElement("p",null,fe.t("item.carDataDescription")))),z.createElement(H,null,z.createElement(ab,{propertySet:ci,vehicleData:v.data}))),N&&z.createElement(yt,null,z.createElement(Tf,{author:P&&P.name?P.name:null,date:J?Rn.format(J,Rn.DayMonth,e):void 0,avatar:P?.avatar||void 0},!!N&&z.createElement("div",{dangerouslySetInnerHTML:{__html:qB(N)}}))),(d?.length||0)>0&&z.createElement(yt,null,z.createElement(H,null,z.createElement(Re,{noMargin:!0},fe.t("item.equipment"))),z.createElement(H,null,z.createElement(ae,null,z.createElement("p",null,fe.t("item.equipmentDescription")))),z.createElement(H,null,z.createElement(La,{actionTitle:fe.t("common.showMore"),onClick:g},z.createElement(Kn,{items:d})))),z.createElement(fb,{documents:j}),z.createElement(Ob,{accessories:y}),z.createElement(yt,null,z.createElement(Oy,{branch:w,displayBranchName:u,loading:_}),T&&T.enabled&&z.createElement(H,null,z.createElement(Kt,{disabled:!!T.reserved,title:"K\xF6p bilen online",onClick:()=>I.current?.start()},"K\xF6p bilen online"))),z.createElement(Ay,{packageOptions:B}),z.createElement(Rg,{packageOption:C?.packageOption}))))),z.createElement(wy,{id:t,hashRoute:r,pathRoute:i,authorizedReseller:!!w?.flags?.authorizedReseller,displayBranchName:u,onClickSearchItem:c})),z.createElement(qn,{id:er.DefaultPortal}),E&&z.createElement(sb,{onClose:l}))},Sp=GB;import ui from"react";var Bu={name:"@wayke-se/components-react",version:"4.6.4",description:"",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",type:"module",files:["dist"],scripts:{prebuild:"npm run clean",test:"npm run lint",lint:"eslint --ext .tsx,.ts 'src' 'example'","lint:fix":"eslint --ext .tsx,.ts 'src' 'example' --fix",typecheck:"tsc --noEmit --skipLibCheck",prettify:"prettier --write 'src/**/*.{ts,tsx}'",gen:"graphql-codegen --config ./codegen.yml","generate-libphonenumber-metadata":"libphonenumber-metadata-generator src/utils/metadata.min.json --countries SE,NO --extended",prepare:"husky",start:"node ./esbuild/start.js",build:"npm run clean && node ./esbuild/lib.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn","build:types":"tsc --emitDeclarationOnly --declaration --project tsconfig.build.json"},repository:{type:"git",url:"git+https://github.com/wayke/components-react.git"},author:"Ourstudio",license:"MIT",peerDependencies:{react:"^16 || ^17 || ^18","react-dom":"^16 || ^17 || ^18","styled-components":"^5.1.0"},devDependencies:{"@graphql-codegen/cli":"^5.0.0","@graphql-codegen/typescript":"^4.0.1","@types/googlemaps":"^3.43.3","@types/react":"^18.0.20","@types/react-dom":"^18.0.6","@types/react-router-dom":"^5.3.2","@types/react-slick":"^0.23.7","@types/styled-components":"^5.1.15","@typescript-eslint/eslint-plugin":"^7.3.1","@typescript-eslint/parser":"^7.3.1","@wayke-se/ecom-web":"^1.7.5",dotenv:"^16.3.1",esbuild:"^0.20.2","esbuild-plugin-copy":"^2.1.1",eslint:"^8.23.1","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prettier":"^5.0.1","eslint-plugin-react":"^7.27.0",husky:"^9.0.11","libphonenumber-metadata-generator":"^1.0.1","lint-staged":"^15.2.2","npm-dts":"^1.3.12",prettier:"^3.0.3",react:"^18.2.0","react-dom":"^18.2.0","react-router-dom":"^6.0.2",rimraf:"^5.0.5","styled-components":"^5.3.11",typescript:"^5.3.3"},dependencies:{"@apollo/client":"^3.4.17","@wayke-se/pannellum-react":"^1.0.0","date-fns":"^3.6.0",graphql:"^16.0.1",i18next:"^23.6.0","libphonenumber-js":"^1.9.42",marked:"^12.0.1","react-compound-slider":"^3.3.1","react-i18next":"^14.1.0","react-slick":"^0.30.2","scroll-into-view-if-needed":"^3.1.0"}};import VB from"react";import{ApolloProvider as WB,ApolloClient as QB,InMemoryCache as JB}from"@apollo/client";var YB=({uri:e,children:t})=>{let r=new QB({uri:e,cache:new JB});return VB.createElement(WB,{client:r},t)},Fu=YB;import KB from"react";import{ThemeProvider as ZB}from"styled-components";var XB=({children:e})=>KB.createElement(ZB,{theme:Xe},e),ta=XB;import e9,{useState as Hu,useEffect as Ru,useCallback as Ip}from"react";var lx=()=>new URLSearchParams(window.location.search);var Cp=new URLSearchParams;Cp.set("hits","30");Cp.set("sort","published-desc");var t9=({url:e,apiKey:t,useQueryParamsFromUrl:r,pathRoute:i,children:n})=>{let{replaceState:a,pushState:s}=Yi(),[u,c]=Hu({searchParams:Cp}),[f,h]=Hu(),[k,b]=Hu(),[S,_]=Hu(!1),{data:P}=gi(`${e}?hits=0`,{headers:t?{"x-api-key":t}:{}},!!f),w=u.searchParams.toString(),{loading:I,data:E,error:o}=gi(`${e}${w?`?${w}`:""}`,{headers:t?{"x-api-key":t}:{}},!S||!!u?.block),l=y=>{let{currentTarget:x}=y;if(x){let M=new URLSearchParams(x.location.search);M.has("sort")||M.set("sort","published-desc"),c({searchParams:M})}};Ru(()=>{r&&window.addEventListener("popstate",l);let y={actionName:"onFilterUpdate",callback:d};return Z.subscribeAction(y),()=>{window.removeEventListener("popstate",l),Z.unsubscribeAction(y)}},[]),Ru(()=>{P&&h(P.facets)},[P]),Ru(()=>{if(r){let y=new URLSearchParams(u.searchParams);y.delete("hits"),y.delete("offset"),y.get("sort")==="published-desc"&&y.delete("sort");let x=y.toString()?`?${y}`:"";if(S&&window.location.search.localeCompare(x)!==0){let M=i?.replace(/^\/|\/$/g,""),N=M?`/${M}/`:"/",D=M?window.location.pathname.indexOf(N):-1,F=window.location.pathname;D>-1&&(F=F.substr(0,D)),s(`${F}${x}`)}}},[u,S,r]),Ru(()=>{if(E){if(!f&&!r&&h(E.facets),r&&E.query?.parameters){let y=new URLSearchParams(E.query.parameters);y.delete("hits"),y.delete("offset");let x=y.toString()?`?${y}`:"";window.location.search.localeCompare(x)!==0&&(a(`${window.location.pathname}${x}`),c({searchParams:new URLSearchParams(x),block:!0}))}u?.concatResult?b([...k||[],...E.documentList.documents||[]]):b(E.documentList.documents||[])}},[E,r]);let d=Ip(y=>{{S||_(!0);let x=new URLSearchParams(y);x.delete("offset"),c({searchParams:x})}},[S]),g=Ip(()=>{E&&c({searchParams:new URLSearchParams(E?.documentList.pagination.nextPage?.query),concatResult:!0})},[E]),v=Ip(y=>{if(!S){let x=lx(),M=r?x:y;if(r&&y&&y.forEach((N,D)=>{M?.getAll(D)?.some(F=>F===N)||M?.append(D,N)}),M){let N=new URLSearchParams(M);N.delete("hits"),N.delete("offset"),M.has("hits")||M.set("hits","30"),M.has("sort")||M.set("sort","published-desc");let D=N.toString()?`?${N}`:"";c({searchParams:M}),r&&a(`${window.location.pathname}${D}`)}_(!0)}},[S]),A={loading:I,error:o,response:E,documents:k,initialFacets:f,queryFilter:u,onFilterUpdate:d,onLoadMore:g,onInitialize:v};return e9.createElement(la.Provider,{value:A},n)},dx=t9;import r9 from"styled-components";var i9=r9.div.attrs(()=>({className:"wayke__theme wayke__font--regular"}))`
|
|
5569
|
+
`;var U6=({prices:e})=>Ns.createElement(Tb,null,e?.map((t,r)=>Ns.createElement(Mb,{key:`${t.label}-${r}`,$oldPrice:t.oldPrice},Ns.createElement(Nb,null,t.label),Ns.createElement(_b,null,t.price)))),Lb=U6;import{useTranslation as W6}from"react-i18next";var Q6=({accessory:e,onClose:t})=>{let{t:r}=W6(),i=[{label:r("item.accessories.price"),price:`${K(e.price)} ${r("currency.default")}`,oldPrice:!1}];return e.salePrice&&i.push({label:r("item.accessories.oldPrice"),price:`${K(e.salePrice)} ${r("currency.default")}`,oldPrice:!0}),e.assemblyPrice&&i.push({label:r("item.accessories.installationCost"),price:`${K(e.assemblyPrice)} ${r("currency.default")}`,oldPrice:!1}),ut.createElement(Me,{title:e.name,onClose:t},e.images?.[0]&&ut.createElement(H,null,ut.createElement(Pb,{src:`${e.images[0]}?w=632`,alt:`${e.name}`})),e.logotype&&ut.createElement(H,null,ut.createElement(ze,{logo:`${e.logotype}?w=160`,logo2x:`${e.logotype}?w=320`,alt:e.manufacturer||r("common.logotype")||"",wide:!0})),ut.createElement(H,null,ut.createElement(Lb,{prices:i})),ut.createElement(H,null,ut.createElement(ae,{dangerouslySetInnerHTML:{__html:V6(e.description)}})),e.articleNumber&&ut.createElement(H,null,ut.createElement(di,{as:"div"},r("item.accessories.articleNumberShort")),ut.createElement("div",null,e.articleNumber)),e.productPage&&e.productPage.url&&ut.createElement(H,null,ut.createElement(rs,{href:e.productPage.url,title:r("item.accessories.moreInformationAboutAccessory",{accessory:e.name})||"",target:"_blank",rel:"noopener noreferrer nofollow"},e.productPage.title||r("common.readMore")," (",r("common.opensInNewTab"),")")))},Db=Q6;var K6=({accessories:e})=>{let{t}=Y6(),[r,i]=J6(),n=s=>i(s),a=()=>i(void 0);return e?.length?_t.createElement(_t.Fragment,null,r&&_t.createElement(Db,{accessory:r,onClose:a}),_t.createElement(yt,null,_t.createElement(H,null,_t.createElement(Re,{noMargin:!0},t("item.accessories.accessories"))),_t.createElement(H,null,_t.createElement(ae,null,_t.createElement("p",null,t("item.accessories.accessoriesDescription")))),_t.createElement(H,null,_t.createElement(vs,{columns:1.05,columnsSm:2.1,columnsMd:2,spacing:2,items:e.map(s=>_t.createElement(Cb,{key:s.id,title:s.name,image:s.images?.[0]?{src:`${s.images?.[0]}?w=539&h=303`,alt:s.name}:void 0,price:`${K(s.price)} ${t("currency.default")}`,preamble:s.excerpt,readMoreCta:()=>n(s)}))})))):null},Ob=K6;import{useEffect as RB,useRef as ax}from"react";function jB(e,t,r){let i=ax(),n=ax(r);n.current=r;let a=async()=>{if(t)try{let s=await Promise.resolve().then(()=>(ox(),nx));s&&(i.current=new s.default({id:e,ecomSdkConfig:{api:{address:t.url},bankIdThumbprint:t?.bankIdThumbprint},logo:t.serviceLogotypeUrl,logoX2:t.serviceLogotypeUrl,onEvent:(u,c,f,h)=>{Z.publish("Ecom",{id:e,branchId:n.current?.id,branchName:n.current?.name,view:u,event:c,currentStep:f,data:h})}}))}catch{}};return RB(()=>(a(),()=>{i.current&&i.current.destroy()}),[]),i}var sx=jB;import{marked as qB}from"marked";var GB=({marketCode:e="SE",id:t,hashRoute:r,pathRoute:i,disableResetScrollOnInit:n,placeholderImage:a,modifyDocumentTitleItem:s,displayBranchName:u,onClickSearchItem:c})=>{let f=Zi(e),{ecomSettings:h}=Es(),{loading:k,data:b}=N0(t),{vehicle:S,loading:_}=Ry(b?.vehicle),P=S?.contact,w=S?.branch,I=sx(t,h,w),[E,o]=zB(!1),l=ux(()=>o(!E),[E]);cx(()=>{n||window.scrollTo(0,0)},[]),cx(()=>{if(b?.vehicle?.data&&s){let{vehicle:Bt}=b,{registrationNumber:ia}=Bt.data;document.title=`${ia} | ${Bt.title} | ${Bt.shortDescription}`}},[b]);let d=$B(()=>b?.vehicle?.data?.options?.filter(jn).map(Bt=>({title:Bt})),[b?.vehicle?.data?.options]),g=ux(()=>Z.publish("OptionsClick",{id:t,branchId:w?.id,branchName:w?.name}),[w]);if(!f)return null;if(k)return z.createElement($y,null);if(!b?.vehicle?.data)return z.createElement(jy,null);let{vehicle:v}=b,{title:A,accessories:y,shortDescription:x,media:M,description:N,price:D,discount:F,financialOptions:p,manufacturer:C,ecommerce:T,packageOptions:B,publishedAt:J,documents:j,availableFrom:X,flags:Y}=v,Pe=S?.insuranceOptions?S.insuranceOptions:v.insuranceOptions,{fuelType:V,mileage:Q,gearboxType:xe,odometerReading:we,modelYear:We,propertySet:ci}=v.data,Ot=[{title:We}];return Y?.demoVersion&&Ot.push({title:fe.t("item.demoCar"),onClick:l}),Ot.push({title:`${K(we?.value||Q)} ${fe.t(`odometer.${we?.unit||"ScandinavianMile"}`)}`}),xe&&Ot.push({title:xe}),V&&Ot.push({title:V}),z.createElement(z.Fragment,null,z.createElement(Or,null,z.createElement(mt,{large:!0},z.createElement(pt,null,z.createElement(C0,null,z.createElement(P0,null,z.createElement(an,{mobileOrder:1},!i&&r?z.createElement(H,null,z.createElement(ua,null,z.createElement(Qp,{as:"a",href:"#",title:fe.t("navigation.backToSearch")},z.createElement(ce,null,z.createElement(Vi,{block:!0})),z.createElement(ce,null,fe.t("navigation.backToSearch"))))):null,C?.logotype&&z.createElement(H,null,z.createElement(ze,{logo:C.logotype,alt:C.name})),z.createElement(H,null,z.createElement(je,null,z.createElement(It,{noMargin:!0},A)),x&&z.createElement(je,null,z.createElement("div",null,x)),z.createElement(je,null,z.createElement(Kn,{small:!0,items:Ot})))),z.createElement(an,{mobileOrder:2},z.createElement(gf,{price:D,discount:F||void 0})),(p.length>0||Pe.length>0)&&z.createElement(an,{mobileOrder:4},p.length>0&&z.createElement(tg,{id:t,branch:w,financialOptions:p,marketCode:e}),Pe.length>0&&z.createElement(Hg,{id:t,branch:S?.branch,insuranceOptions:Pe})),z.createElement(an,{mobileOrder:5},z.createElement(sy,{id:t,marketCode:e,manufacturer:C,packageOptions:B,ecommerce:T,branch:w,contact:S?.contact,loadingCentralStorageVehicle:_,availableFrom:X,toggleEcomModal:()=>I.current?.start()}))),z.createElement(Wa,null,z.createElement(an,{mobileOrder:3},z.createElement(I0,{id:t,branch:w,media:M,placeholderImage:a})),z.createElement(yt,null,z.createElement(H,null,z.createElement(Re,{noMargin:!0},fe.t("item.carData"))),z.createElement(H,null,z.createElement(ae,null,z.createElement("p",null,fe.t("item.carDataDescription")))),z.createElement(H,null,z.createElement(ab,{propertySet:ci,vehicleData:v.data}))),N&&z.createElement(yt,null,z.createElement(Tf,{author:P&&P.name?P.name:null,date:J?Rn.format(J,Rn.DayMonth,e):void 0,avatar:P?.avatar||void 0},!!N&&z.createElement("div",{dangerouslySetInnerHTML:{__html:qB(N)}}))),(d?.length||0)>0&&z.createElement(yt,null,z.createElement(H,null,z.createElement(Re,{noMargin:!0},fe.t("item.equipment"))),z.createElement(H,null,z.createElement(ae,null,z.createElement("p",null,fe.t("item.equipmentDescription")))),z.createElement(H,null,z.createElement(La,{actionTitle:fe.t("common.showMore"),onClick:g},z.createElement(Kn,{items:d})))),z.createElement(fb,{documents:j}),z.createElement(Ob,{accessories:y}),z.createElement(yt,null,z.createElement(Oy,{branch:w,displayBranchName:u,loading:_}),T&&T.enabled&&z.createElement(H,null,z.createElement(Kt,{disabled:!!T.reserved,title:"K\xF6p bilen online",onClick:()=>I.current?.start()},"K\xF6p bilen online"))),z.createElement(Ay,{packageOptions:B}),z.createElement(Rg,{packageOption:C?.packageOption}))))),z.createElement(wy,{id:t,hashRoute:r,pathRoute:i,authorizedReseller:!!w?.flags?.authorizedReseller,displayBranchName:u,onClickSearchItem:c})),z.createElement(qn,{id:er.DefaultPortal}),E&&z.createElement(sb,{onClose:l}))},Sp=GB;import ui from"react";var Bu={name:"@wayke-se/components-react",version:"4.6.5",description:"",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",type:"module",files:["dist"],scripts:{prebuild:"npm run clean",test:"npm run lint",lint:"eslint --ext .tsx,.ts 'src' 'example'","lint:fix":"eslint --ext .tsx,.ts 'src' 'example' --fix",typecheck:"tsc --noEmit --skipLibCheck",prettify:"prettier --write 'src/**/*.{ts,tsx}'",gen:"graphql-codegen --config ./codegen.yml","generate-libphonenumber-metadata":"libphonenumber-metadata-generator src/utils/metadata.min.json --countries SE,NO --extended",prepare:"husky",start:"node ./esbuild/start.js",build:"npm run clean && node ./esbuild/lib.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn","build:types":"tsc --emitDeclarationOnly --declaration --project tsconfig.build.json"},repository:{type:"git",url:"git+https://github.com/wayke/components-react.git"},author:"Ourstudio",license:"MIT",peerDependencies:{react:"^16 || ^17 || ^18","react-dom":"^16 || ^17 || ^18","styled-components":"^5.1.0"},devDependencies:{"@graphql-codegen/cli":"^5.0.0","@graphql-codegen/typescript":"^4.0.1","@types/googlemaps":"^3.43.3","@types/react":"^18.0.20","@types/react-dom":"^18.0.6","@types/react-router-dom":"^5.3.2","@types/react-slick":"^0.23.7","@types/styled-components":"^5.1.15","@typescript-eslint/eslint-plugin":"^7.3.1","@typescript-eslint/parser":"^7.3.1","@wayke-se/ecom-web":"^1.7.5",dotenv:"^16.3.1",esbuild:"^0.20.2","esbuild-plugin-copy":"^2.1.1",eslint:"^8.23.1","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prettier":"^5.0.1","eslint-plugin-react":"^7.27.0",husky:"^9.0.11","libphonenumber-metadata-generator":"^1.0.1","lint-staged":"^15.2.2","npm-dts":"^1.3.12",prettier:"^3.0.3",react:"^18.2.0","react-dom":"^18.2.0","react-router-dom":"^6.0.2",rimraf:"^5.0.5","styled-components":"^5.3.11",typescript:"^5.3.3"},dependencies:{"@apollo/client":"^3.4.17","@wayke-se/pannellum-react":"^1.0.0","date-fns":"^3.6.0",graphql:"^16.0.1",i18next:"^23.6.0","libphonenumber-js":"^1.9.42",marked:"^12.0.1","react-compound-slider":"^3.3.1","react-i18next":"^14.1.0","react-slick":"^0.30.2","scroll-into-view-if-needed":"^3.1.0"}};import VB from"react";import{ApolloProvider as WB,ApolloClient as QB,InMemoryCache as JB}from"@apollo/client";var YB=({uri:e,children:t})=>{let r=new QB({uri:e,cache:new JB});return VB.createElement(WB,{client:r},t)},Fu=YB;import KB from"react";import{ThemeProvider as ZB}from"styled-components";var XB=({children:e})=>KB.createElement(ZB,{theme:Xe},e),ta=XB;import e9,{useState as Hu,useEffect as Ru,useCallback as Ip}from"react";var lx=()=>new URLSearchParams(window.location.search);var Cp=new URLSearchParams;Cp.set("hits","30");Cp.set("sort","published-desc");var t9=({url:e,apiKey:t,useQueryParamsFromUrl:r,pathRoute:i,children:n})=>{let{replaceState:a,pushState:s}=Yi(),[u,c]=Hu({searchParams:Cp}),[f,h]=Hu(),[k,b]=Hu(),[S,_]=Hu(!1),{data:P}=gi(`${e}?hits=0`,{headers:t?{"x-api-key":t}:{}},!!f),w=u.searchParams.toString(),{loading:I,data:E,error:o}=gi(`${e}${w?`?${w}`:""}`,{headers:t?{"x-api-key":t}:{}},!S||!!u?.block),l=y=>{let{currentTarget:x}=y;if(x){let M=new URLSearchParams(x.location.search);M.has("sort")||M.set("sort","published-desc"),c({searchParams:M})}};Ru(()=>{r&&window.addEventListener("popstate",l);let y={actionName:"onFilterUpdate",callback:d};return Z.subscribeAction(y),()=>{window.removeEventListener("popstate",l),Z.unsubscribeAction(y)}},[]),Ru(()=>{P&&h(P.facets)},[P]),Ru(()=>{if(r){let y=new URLSearchParams(u.searchParams);y.delete("hits"),y.delete("offset"),y.get("sort")==="published-desc"&&y.delete("sort");let x=y.toString()?`?${y}`:"";if(S&&window.location.search.localeCompare(x)!==0){let M=i?.replace(/^\/|\/$/g,""),N=M?`/${M}/`:"/",D=M?window.location.pathname.indexOf(N):-1,F=window.location.pathname;D>-1&&(F=F.substr(0,D)),s(`${F}${x}`)}}},[u,S,r]),Ru(()=>{if(E){if(!f&&!r&&h(E.facets),r&&E.query?.parameters){let y=new URLSearchParams(E.query.parameters);y.delete("hits"),y.delete("offset");let x=y.toString()?`?${y}`:"";window.location.search.localeCompare(x)!==0&&(a(`${window.location.pathname}${x}`),c({searchParams:new URLSearchParams(x),block:!0}))}u?.concatResult?b([...k||[],...E.documentList.documents||[]]):b(E.documentList.documents||[])}},[E,r]);let d=Ip(y=>{{S||_(!0);let x=new URLSearchParams(y);x.delete("offset"),c({searchParams:x})}},[S]),g=Ip(()=>{E&&c({searchParams:new URLSearchParams(E?.documentList.pagination.nextPage?.query),concatResult:!0})},[E]),v=Ip(y=>{if(!S){let x=lx(),M=r?x:y;if(r&&y&&y.forEach((N,D)=>{M?.getAll(D)?.some(F=>F===N)||M?.append(D,N)}),M){let N=new URLSearchParams(M);N.delete("hits"),N.delete("offset"),M.has("hits")||M.set("hits","30"),M.has("sort")||M.set("sort","published-desc");let D=N.toString()?`?${N}`:"";c({searchParams:M}),r&&a(`${window.location.pathname}${D}`)}_(!0)}},[S]),A={loading:I,error:o,response:E,documents:k,initialFacets:f,queryFilter:u,onFilterUpdate:d,onLoadMore:g,onInitialize:v};return e9.createElement(la.Provider,{value:A},n)},dx=t9;import r9 from"styled-components";var i9=r9.div.attrs(()=>({className:"wayke__theme wayke__font--regular"}))`
|
|
5570
5570
|
background-color: ${e=>e.theme.color.bg};
|
|
5571
5571
|
color: ${e=>e.theme.color.textDark};
|
|
5572
5572
|
font-size: 1rem;
|
|
@@ -5583,7 +5583,7 @@ and ensure you are accounting for this risk.
|
|
|
5583
5583
|
a img {
|
|
5584
5584
|
border: 0;
|
|
5585
5585
|
}
|
|
5586
|
-
`,ju=i9;import n9 from"react";var o9=({googleMapsApiKey:e,googleMapsMarker:t,ecomSettings:r,children:i})=>n9.createElement(xs.Provider,{value:{ecomSettings:r,googleMapsApiKey:e,googleMapsMarker:t}},i),$u=o9;import a9,{useState as s9,useCallback as u9}from"react";var c9=({url:e,urlMlt:t,apiKey:r,children:i})=>{let[n,a]=s9(),s=n?.searchParams.toString(),{loading:u,data:c,error:f}=gi(`${t||e}${s?`?${s}`:""}`,{headers:r?{"x-api-key":r}:{}},!n),h=u9(b=>a({searchParams:b}),[]),k={moreLikeThisUrl:!!t,loading:u,error:f,response:c,queryFilter:n,fetchRelated:h};return a9.createElement(ws.Provider,{value:k},i)},zu=c9;import p9,{useCallback as m9}from"react";import{useState as l9,useCallback as Pp}from"react";var d9=e=>{let[t,r]=l9(sessionStorage.getItem(e)),i=Pp(s=>{sessionStorage.setItem(e,s),r(s)},[e]),n=Pp(()=>{sessionStorage.removeItem(e),r(null)},[e]),a=Pp(()=>{sessionStorage.clear(),r(null)},[e]);return{value:t,set:i,remove:n,clear:a}},px=d9;var h9=({children:e})=>{let{value:t,set:r,remove:i}=px("centralStorage"),n=m9(a=>a?r(a):i(),[]);return p9.createElement(dn.Provider,{value:{centralStorageId:t,setCentralStorageId:n}},e)},qu=h9;import k9,{useCallback as gx,useEffect as v9,useMemo as yx,useReducer as w9}from"react";import{useRef as f9,useEffect as g9}from"react";var y9=e=>{let t=f9();return g9(()=>{t.current=e}),t.current},mx=y9;var ra="SET_PATH",hx={path:window.location.pathname},b9=(e,t)=>{let r={...e};switch(t.type){case ra:return r.path=t.path,r;default:throw new Error("Unsupported action type")}},fx=b9;var A9=/(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}/g,bx="popstate",x9=({children:e})=>{let[t,r]=w9(fx,hx),i=mx(t.path);v9(()=>{let c=()=>{r({type:ra,path:window.location.pathname})};return window.addEventListener(bx,c),()=>{window.removeEventListener(bx,c)}},[]);let n=gx(c=>{let f=window.location.hash;history.pushState(null,"",`${c}`);let h=window.location.hash;f.localeCompare(h)!==0&&window.dispatchEvent(new HashChangeEvent("hashchange")),r({type:ra,path:c})},[]),a=gx(c=>{let f=window.location.hash;history.replaceState(null,"",c);let h=window.location.hash;f.localeCompare(h)!==0&&window.dispatchEvent(new HashChangeEvent("hashchange")),r({type:ra,path:c})},[]),s=yx(()=>t.path.match(A9)?.pop(),[t.path]),u=yx(()=>({...t,previousPath:i,id:s,pushState:n,replaceState:a}),[t]);return k9.createElement(Pa.Provider,{value:u},e)},Gu=x9;var E9=({url:e,urlMlt:t,apiKey:r,ecomSettings:i,graphQlUrl:n,googleMapsApiKey:a,googleMapsMarker:s,useQueryParamsFromUrl:u,pathRoute:c,children:f})=>ui.createElement(Gu,null,ui.createElement($u,{googleMapsApiKey:a,googleMapsMarker:s,ecomSettings:i},ui.createElement(qu,null,ui.createElement(Fu,{uri:n},ui.createElement(dx,{url:e,apiKey:r,useQueryParamsFromUrl:u,pathRoute:c},ui.createElement(zu,{url:e,urlMlt:t,apiKey:r},ui.createElement(ta,null,ui.createElement(ju,{"data-version":Bu.version},f)))))))),Tp=E9;import xx from"react";import Uu,{useEffect as T9}from"react";import{useState as S9,useEffect as I9}from"react";var vx=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i,kx="hashchange",C9=()=>{let e=window.location.hash.substr(1,window.location.hash.length);return vx.test(e)||!e?e:void 0},P9=()=>{let[e,t]=S9(()=>C9()),r=()=>{let i=window.location.hash.substr(1,window.location.hash.length);if(vx.test(i)||!i)t(window.location.hash.substr(1,window.location.hash.length));else throw"Invalid Guid"};return I9(()=>(r(),window.addEventListener(kx,r),()=>{window.removeEventListener(kx,r)}),[]),e},wx=P9;var M9=({marketCode:e,filterList:t,initialQueryParams:r,removeSearchBar:i,removeFilterOptions:n,disableResetScrollOnInit:a,placeholderImage:s,pathRoute:u,modifyDocumentTitleItem:c,modifyDocumentTitleSearch:f,displayBranchName:h})=>{let k=wx(),{id:b}=Yi(),S=Zi(e);T9(()=>{u||(k?Z.publish("HashRouteChange",{id:k}):Z.publish("HashRouteChange",{id:void 0}))},[k]);let _=b||k;return S?Uu.createElement(Uu.Fragment,null,_?Uu.createElement(Sp,{id:_,hashRoute:!u,disableResetScrollOnInit:a,placeholderImage:s,pathRoute:u,modifyDocumentTitleItem:c,displayBranchName:h}):Uu.createElement(Dc,{marketCode:e,filterList:t,initialQueryParams:r,removeSearchBar:i,hashRoute:!u,placeholderImage:s,pathRoute:u,removeFilterOptions:n,modifyDocumentTitleSearch:f,displayBranchName:h})):null},Ax=M9;var N9=({provider:e,composite:t})=>xx.createElement(Tp,{...e},xx.createElement(Ax,{...t})),Ex=N9;import qi from"react";var _9=({url:e,urlMlt:t,apiKey:r,ecomSettings:i,graphQlUrl:n,googleMapsApiKey:a,googleMapsMarker:s,children:u})=>qi.createElement(Gu,null,qi.createElement($u,{googleMapsApiKey:a,googleMapsMarker:s,ecomSettings:i},qi.createElement(qu,null,qi.createElement(Fu,{uri:n},qi.createElement(zu,{url:e,urlMlt:t,apiKey:r},qi.createElement(ta,null,qi.createElement(ju,{"data-version":Bu.version},u))))))),L9=_9;var Aae=Ex;export{_c as SearchBar,L9 as WaykeItemProvider,Tp as WaykeProvider,Z as WaykePubSub,Dc as WaykeSearch,Sp as WaykeSearchItem,ta as WaykeThemeProvider,Aae as default};
|
|
5586
|
+
`,ju=i9;import n9 from"react";var o9=({googleMapsApiKey:e,googleMapsMarker:t,ecomSettings:r,children:i})=>n9.createElement(xs.Provider,{value:{ecomSettings:r,googleMapsApiKey:e,googleMapsMarker:t}},i),$u=o9;import a9,{useState as s9,useCallback as u9}from"react";var c9=({url:e,urlMlt:t,apiKey:r,children:i})=>{let[n,a]=s9(),s=n?.searchParams.toString(),{loading:u,data:c,error:f}=gi(`${t||e}${s?`?${s}`:""}`,{headers:r?{"x-api-key":r}:{}},!n),h=u9(b=>a({searchParams:b}),[]),k={moreLikeThisUrl:!!t,loading:u,error:f,response:c,queryFilter:n,fetchRelated:h};return a9.createElement(ws.Provider,{value:k},i)},zu=c9;import p9,{useCallback as m9}from"react";import{useState as l9,useCallback as Pp}from"react";var d9=e=>{let[t,r]=l9(sessionStorage.getItem(e)),i=Pp(s=>{sessionStorage.setItem(e,s),r(s)},[e]),n=Pp(()=>{sessionStorage.removeItem(e),r(null)},[e]),a=Pp(()=>{sessionStorage.clear(),r(null)},[e]);return{value:t,set:i,remove:n,clear:a}},px=d9;var h9=({children:e})=>{let{value:t,set:r,remove:i}=px("centralStorage"),n=m9(a=>a?r(a):i(),[]);return p9.createElement(dn.Provider,{value:{centralStorageId:t,setCentralStorageId:n}},e)},qu=h9;import k9,{useCallback as gx,useEffect as v9,useMemo as yx,useReducer as w9}from"react";import{useRef as f9,useEffect as g9}from"react";var y9=e=>{let t=f9();return g9(()=>{t.current=e}),t.current},mx=y9;var ra="SET_PATH",hx={path:window.location.pathname},b9=(e,t)=>{let r={...e};switch(t.type){case ra:return r.path=t.path,r;default:throw new Error("Unsupported action type")}},fx=b9;var A9=/(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}/g,bx="popstate",x9=({children:e})=>{let[t,r]=w9(fx,hx),i=mx(t.path);v9(()=>{let c=()=>{r({type:ra,path:window.location.pathname})};return window.addEventListener(bx,c),()=>{window.removeEventListener(bx,c)}},[]);let n=gx(c=>{let f=window.location.hash;history.pushState(null,"",`${c}`);let h=window.location.hash;f.localeCompare(h)!==0&&window.dispatchEvent(new HashChangeEvent("hashchange")),r({type:ra,path:c})},[]),a=gx(c=>{let f=window.location.hash;history.replaceState(null,"",c);let h=window.location.hash;f.localeCompare(h)!==0&&window.dispatchEvent(new HashChangeEvent("hashchange")),r({type:ra,path:c})},[]),s=yx(()=>t.path.match(A9)?.pop(),[t.path]),u=yx(()=>({...t,previousPath:i,id:s,pushState:n,replaceState:a}),[t]);return k9.createElement(Pa.Provider,{value:u},e)},Gu=x9;var E9=({url:e,urlMlt:t,apiKey:r,ecomSettings:i,graphQlUrl:n,googleMapsApiKey:a,googleMapsMarker:s,useQueryParamsFromUrl:u,pathRoute:c,children:f})=>ui.createElement(Gu,null,ui.createElement($u,{googleMapsApiKey:a,googleMapsMarker:s,ecomSettings:i},ui.createElement(qu,null,ui.createElement(Fu,{uri:n},ui.createElement(dx,{url:e,apiKey:r,useQueryParamsFromUrl:u,pathRoute:c},ui.createElement(zu,{url:e,urlMlt:t,apiKey:r},ui.createElement(ta,null,ui.createElement(ju,{"data-version":Bu.version},f)))))))),Tp=E9;import xx from"react";import Uu,{useEffect as T9}from"react";import{useState as S9,useEffect as I9}from"react";var vx=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i,kx="hashchange",C9=()=>{let e=window.location.hash.substr(1,window.location.hash.length);return vx.test(e)||!e?e:void 0},P9=()=>{let[e,t]=S9(()=>C9()),r=()=>{let i=window.location.hash.substr(1,window.location.hash.length);if(vx.test(i)||!i)t(window.location.hash.substr(1,window.location.hash.length));else throw"Invalid Guid"};return I9(()=>(r(),window.addEventListener(kx,r),()=>{window.removeEventListener(kx,r)}),[]),e},wx=P9;var M9=({marketCode:e="SE",filterList:t,initialQueryParams:r,removeSearchBar:i,removeFilterOptions:n,disableResetScrollOnInit:a,placeholderImage:s,pathRoute:u,modifyDocumentTitleItem:c,modifyDocumentTitleSearch:f,displayBranchName:h})=>{let k=wx(),{id:b}=Yi(),S=Zi(e);T9(()=>{u||(k?Z.publish("HashRouteChange",{id:k}):Z.publish("HashRouteChange",{id:void 0}))},[k]);let _=b||k;return S?Uu.createElement(Uu.Fragment,null,_?Uu.createElement(Sp,{marketCode:e,id:_,hashRoute:!u,disableResetScrollOnInit:a,placeholderImage:s,pathRoute:u,modifyDocumentTitleItem:c,displayBranchName:h}):Uu.createElement(Dc,{marketCode:e,filterList:t,initialQueryParams:r,removeSearchBar:i,hashRoute:!u,placeholderImage:s,pathRoute:u,removeFilterOptions:n,modifyDocumentTitleSearch:f,displayBranchName:h})):null},Ax=M9;var N9=({provider:e,composite:t})=>xx.createElement(Tp,{...e},xx.createElement(Ax,{...t})),Ex=N9;import qi from"react";var _9=({url:e,urlMlt:t,apiKey:r,ecomSettings:i,graphQlUrl:n,googleMapsApiKey:a,googleMapsMarker:s,children:u})=>qi.createElement(Gu,null,qi.createElement($u,{googleMapsApiKey:a,googleMapsMarker:s,ecomSettings:i},qi.createElement(qu,null,qi.createElement(Fu,{uri:n},qi.createElement(zu,{url:e,urlMlt:t,apiKey:r},qi.createElement(ta,null,qi.createElement(ju,{"data-version":Bu.version},u))))))),L9=_9;var Aae=Ex;export{_c as SearchBar,L9 as WaykeItemProvider,Tp as WaykeProvider,Z as WaykePubSub,Dc as WaykeSearch,Sp as WaykeSearchItem,ta as WaykeThemeProvider,Aae as default};
|
|
5587
5587
|
/*! Bundled license information:
|
|
5588
5588
|
|
|
5589
5589
|
is-plain-object/dist/is-plain-object.js:
|