@faststore/core 2.0.78-alpha.0 → 2.0.80-alpha.0
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/.husky/pre-commit +1 -1
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +13 -13
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1gneedd +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +2 -2
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/312.js +21 -23
- package/.next/server/chunks/953.js +1 -1
- package/.next/server/chunks/992.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages/index.js +2 -2
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/909.1e25801e430906c0.js +1 -0
- package/.next/static/chunks/{953.34c6b39e63e3a24c.js → 953.7a6f29b1fc85a9d9.js} +1 -1
- package/.next/static/chunks/{webpack-499a79772d3ef1c5.js → webpack-8649a0a6a4495828.js} +1 -1
- package/.next/trace +64 -64
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +13 -0
- package/package.json +5 -5
- package/src/components/cart/CartSidebar/CartSidebar.tsx +2 -5
- package/src/components/search/SearchTop/SearchTop.tsx +27 -30
- package/.next/static/chunks/909.ea3532bde0943808.js +0 -1
- /package/.next/static/{AfRyx-Tw-CIp1IqIH2Vyn → aek2NDV1vh2ZKaUTiqnby}/_buildManifest.js +0 -0
- /package/.next/static/{AfRyx-Tw-CIp1IqIH2Vyn → aek2NDV1vh2ZKaUTiqnby}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -41,7 +41,7 @@ Route (pages) Size First Load JS
|
|
|
41
41
|
├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
|
|
42
42
|
├ chunks/main-9746772201fe3ac1.js 23.9 kB
|
|
43
43
|
├ chunks/pages/_app-9cc7312632f19e94.js 28.9 kB
|
|
44
|
-
├ chunks/webpack-
|
|
44
|
+
├ chunks/webpack-8649a0a6a4495828.js 2.21 kB
|
|
45
45
|
└ css/14ebc84fc6d6c80c.css 19.9 kB
|
|
46
46
|
|
|
47
47
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.80-alpha.0](https://github.com/vtex/faststore/compare/v2.0.79-alpha.0...v2.0.80-alpha.0) (2023-03-15)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- forwardRef errors ([#1671](https://github.com/vtex/faststore/issues/1671)) ([945c5da](https://github.com/vtex/faststore/commit/945c5dabf21b7ee87c1e9197a1115b9b1eafb9c0))
|
|
11
|
+
|
|
12
|
+
## 2.0.79-alpha.0 (2023-03-15)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- husky pre-commit script + Lint-stage ([#1669](https://github.com/vtex/faststore/issues/1669)) ([5a3f3c8](https://github.com/vtex/faststore/commit/5a3f3c85ddc6b76377290a930cd70ed37735d8e8))
|
|
17
|
+
- Puts cart-sidebar test id in the right place ([#1670](https://github.com/vtex/faststore/issues/1670)) ([0001070](https://github.com/vtex/faststore/commit/0001070617546c8f423550c0f4bf26e9a640b804))
|
|
18
|
+
|
|
6
19
|
## [2.0.78-alpha.0](https://github.com/vtex/faststore/compare/v2.0.77-alpha.0...v2.0.78-alpha.0) (2023-03-15)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @faststore/core
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.80-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"browserslist": "supports es6-module and not dead",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"lint": "next lint",
|
|
16
16
|
"stylelint": "stylelint \"**/*.scss\"",
|
|
17
17
|
"stylelint:fix": "stylelint \"**/*.scss\" --fix",
|
|
18
|
-
"postinstall": "node postinstall.js && (is-ci || husky install) || echo Skipped postinstall step for @faststore/core",
|
|
18
|
+
"postinstall": "node postinstall.js && (is-ci || (cd ../.. && husky install packages/core/.husky)) || echo Skipped postinstall step for @faststore/core",
|
|
19
19
|
"partytown": "partytown copylib ./public/~partytown",
|
|
20
20
|
"storybook": "start-storybook --docs -p 6006",
|
|
21
21
|
"build-storybook": "build-storybook"
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@envelop/parser-cache": "^2.2.0",
|
|
31
31
|
"@envelop/validation-cache": "^2.2.0",
|
|
32
32
|
"@faststore/api": "^2.0.3-alpha.0",
|
|
33
|
-
"@faststore/components": "^2.0.
|
|
33
|
+
"@faststore/components": "^2.0.80-alpha.0",
|
|
34
34
|
"@faststore/graphql-utils": "^2.0.3-alpha.0",
|
|
35
35
|
"@faststore/sdk": "^2.0.3-alpha.0",
|
|
36
|
-
"@faststore/ui": "^2.0.
|
|
36
|
+
"@faststore/ui": "^2.0.79-alpha.0",
|
|
37
37
|
"@types/react": "^18.0.14",
|
|
38
38
|
"@vtex/client-cms": "^0.2.12",
|
|
39
39
|
"autoprefixer": "^10.4.0",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"msw": {
|
|
108
108
|
"workerDirectory": "public"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "f34f2ebca04e5c97d12a33ba41bcd7dac7105756"
|
|
111
111
|
}
|
|
@@ -71,12 +71,9 @@ function CartSidebar() {
|
|
|
71
71
|
direction="rightSide"
|
|
72
72
|
className={styles.fsCartSidebar}
|
|
73
73
|
onTransitionEnd={() => fade === 'out' && closeCart()}
|
|
74
|
+
data-testid="cart-sidebar"
|
|
74
75
|
>
|
|
75
|
-
<UISlideOverHeader
|
|
76
|
-
closeBtnProps={closeBtnProps}
|
|
77
|
-
onClose={fadeOut}
|
|
78
|
-
data-testid="cart-sidebar"
|
|
79
|
-
>
|
|
76
|
+
<UISlideOverHeader closeBtnProps={closeBtnProps} onClose={fadeOut}>
|
|
80
77
|
<div data-fs-cart-sidebar-title>
|
|
81
78
|
<p data-fs-cart-sidebar-title-text className="text__lead">
|
|
82
79
|
Your Cart
|
|
@@ -2,12 +2,11 @@ import {
|
|
|
2
2
|
SearchTop as UISearchTop,
|
|
3
3
|
SearchTopTerm as UISearchTopTerm,
|
|
4
4
|
} from '@faststore/ui'
|
|
5
|
-
import { forwardRef } from 'react'
|
|
6
5
|
import type { HTMLAttributes } from 'react'
|
|
7
6
|
|
|
7
|
+
import type { StoreSuggestionTerm } from '@generated/graphql'
|
|
8
8
|
import useSearchInput, { formatSearchPath } from 'src/sdk/search/useSearchInput'
|
|
9
9
|
import useTopSearch from 'src/sdk/search/useTopSearch'
|
|
10
|
-
import type { StoreSuggestionTerm } from '@generated/graphql'
|
|
11
10
|
|
|
12
11
|
export interface SearchTopProps extends HTMLAttributes<HTMLDivElement> {
|
|
13
12
|
/**
|
|
@@ -16,35 +15,33 @@ export interface SearchTopProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
16
15
|
topTerms?: StoreSuggestionTerm[]
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const { terms, isLoading } = useTopSearch(topTerms)
|
|
23
|
-
|
|
24
|
-
if (terms.length === 0) {
|
|
25
|
-
return null
|
|
26
|
-
}
|
|
18
|
+
function SearchTop({ topTerms, ...otherProps }: SearchTopProps) {
|
|
19
|
+
const { onSearchInputSelection } = useSearchInput()
|
|
20
|
+
const { terms, isLoading } = useTopSearch(topTerms)
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{terms.map((term, index) => (
|
|
31
|
-
<UISearchTopTerm
|
|
32
|
-
key={index}
|
|
33
|
-
value={term.value}
|
|
34
|
-
index={index}
|
|
35
|
-
linkProps={{
|
|
36
|
-
href: formatSearchPath(term.value),
|
|
37
|
-
onClick: () =>
|
|
38
|
-
onSearchInputSelection?.(
|
|
39
|
-
term.value,
|
|
40
|
-
formatSearchPath(term.value)
|
|
41
|
-
),
|
|
42
|
-
}}
|
|
43
|
-
/>
|
|
44
|
-
))}
|
|
45
|
-
</UISearchTop>
|
|
46
|
-
)
|
|
22
|
+
if (terms.length === 0) {
|
|
23
|
+
return null
|
|
47
24
|
}
|
|
48
|
-
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<UISearchTop title="Top Search" isLoading={isLoading} {...otherProps}>
|
|
28
|
+
{terms.map((term, index) => (
|
|
29
|
+
<UISearchTopTerm
|
|
30
|
+
key={index}
|
|
31
|
+
value={term.value}
|
|
32
|
+
index={index}
|
|
33
|
+
linkProps={{
|
|
34
|
+
href: formatSearchPath(term.value),
|
|
35
|
+
onClick: () =>
|
|
36
|
+
onSearchInputSelection?.(
|
|
37
|
+
term.value,
|
|
38
|
+
formatSearchPath(term.value)
|
|
39
|
+
),
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
))}
|
|
43
|
+
</UISearchTop>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
49
46
|
|
|
50
47
|
export default SearchTop
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[909],{7549:function(e,t,r){var n=r(2784),a=r(2691);const o=(0,n.forwardRef)((function({value:e,as:t="span",variant:r="selling",testId:o="fs-price",formatter:c=(e=>e),SRText:i,...s},l){const u=c(e,r);return n.createElement(t,{ref:l,"data-fs-price":!0,"data-fs-price-variant":r,"data-testid":o,...s},i&&n.createElement(a.Z,{text:i}),u)}));t.Z=o},3909:function(e,t,r){r.r(t),r.d(t,{default:function(){return re}});var n=r(9499),a=r(4730),o=r(2784),c=r(1329);var i=({testId:e="fs-search-auto-complete",children:t,...r})=>o.createElement("section",{"data-testid":e,"data-fs-search-auto-complete":!0,...r},o.createElement(c.Z,{as:"ol"},t));var s=()=>o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",strokeWidth:"16",width:24,height:24},o.createElement("rect",{width:"256",height:"256",fill:"none"}),o.createElement("circle",{cx:"116",cy:"116",r:"84",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),o.createElement("line",{x1:"175.4",y1:"175.4",x2:"224",y2:"224",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"})),l=r(7865),u=r(5045);var p=({testId:e="fs-search-auto-complete-term",suggestion:t,term:r,linkProps:n,icon:a})=>{const c=a||o.createElement(s,null),i=t.toLowerCase().split(r.toLowerCase());return o.createElement("li",{"data-fs-search-auto-complete-item":!0,"data-testid":e},o.createElement(l.Z,{...n,"data-fs-search-auto-complete-item-link":!0,variant:"display"},c&&o.createElement(u.Z,{component:c,"data-fs-search-auto-complete-item-icon":!0}),o.createElement("p",null,i.map(((e,n)=>o.createElement(o.Fragment,{key:[e,n].join()},e.length>0&&o.createElement("strong",{"data-fs-search-auto-complete-item-suggestion":!0},0===n?e.charAt(0).toUpperCase()+e.slice(1):e),n!==i.length-1&&function(e,t,r){return 0===e?t.split("").map(((e,t)=>0===t&&0===r.indexOf(e.toUpperCase())?e.toUpperCase():e.toLowerCase())).join(""):t.toLowerCase()}(n,r,t)))))))};var d=({testId:e="fs-search-products",title:t="Suggested Products",children:r,...n})=>o.createElement("section",{"data-testid":e,"data-fs-search-products":!0,...n},o.createElement("header",{"data-fs-search-products-header":!0},o.createElement("p",{"data-fs-search-products-title":!0},t)),o.createElement(c.Z,{as:"ol"},r));var f=(0,o.forwardRef)((function({testId:e="fs-search-product-item",linkProps:t,children:r}){return o.createElement("li",{"data-fs-search-product-item":!0,"data-testid":e},o.createElement(l.Z,{...t,"data-fs-search-product-item-link":!0,variant:"display"},r))}));var h=(0,o.forwardRef)((function({testId:e="fs-search-product-item-image",children:t,...r},n){return o.createElement("div",{ref:n,"data-fs-search-product-item-image":!0,"data-testid":e,...r},t)})),m=r(7549);var v=(0,o.forwardRef)((function({price:e,title:t,...r},n){return o.createElement("section",{ref:n,"data-fs-search-product-item-content":!0,...r},o.createElement("p",{"data-fs-search-product-item-title":!0},t),o.createElement("span",{"data-fs-search-product-item-prices":!0},o.createElement(m.Z,{value:e?.listPrice?e.listPrice:0,formatter:e?.formatter,testId:"list-price","data-value":e?.listPrice,variant:"listing",SRText:"Original price:"}),o.createElement(m.Z,{value:e?.value?e.value:0,formatter:e?.formatter,testId:"price","data-value":e?.value,variant:"spot",SRText:"Price:"})))})),O=r(2154),g=r(5346),y=r(9854),b=r(3588),j=r(2322),P=["product","index"],w=["href","onClick"];function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var x=function(e){var{product:t,index:r}=e,n=(0,a.Z)(e,P),{onSearchInputSelection:o}=(0,b.ZP)(),c=(0,y.w)({product:t,selectedOffer:0,index:r}),{href:i,onClick:s}=c,l=(0,a.Z)(c,w),{isVariantOf:{name:u},image:[p],offers:{lowPrice:d,offers:[{listPrice:m}]}}=t,k=E({href:i,onClick:()=>{s(),null===o||void 0===o||o(u,i)}},l);return(0,j.jsxs)(f,E(E({linkProps:k},n),{},{children:[(0,j.jsx)(h,{children:(0,j.jsx)(O.E,{src:p.url,alt:p.alternateName,width:56,height:56})}),(0,j.jsx)(v,{title:u,price:{value:d,listPrice:m,formatter:g.P}})]}))},S=r(1393),Z=r.n(S),D=["testId","term","terms","products"];function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var I=function(e){var{testId:t="suggestions",term:r="",terms:n=[],products:o=[]}=e,c=(0,a.Z)(e,D),{onSearchInputSelection:s}=(0,b.ZP)();return(0,j.jsxs)("section",L(L({"data-testid":t,"data-fs-search":!0,className:Z().fsSearch},c),{},{children:[n.length>0&&(0,j.jsx)(i,{"data-fs-search-section":!0,children:null===n||void 0===n?void 0:n.map((e=>{var{value:t}=e;return(0,j.jsx)(p,{term:r,suggestion:t,linkProps:{href:(0,b.uc)(t),onClick:()=>null===s||void 0===s?void 0:s(t,(0,b.uc)(t))}},t)}))}),o.length>0&&(0,j.jsx)(d,{"data-fs-search-section":!0,children:o.map(((e,t)=>(0,j.jsx)(x,{product:e,index:t},e.id)))})]}))},_=r(7732),R=r(5914),W="SearchSuggestionsQuery";var F=function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,{channel:a,locale:o}=(0,R.kP)(),{data:c,error:i}=(0,_.aM)(W,{term:e,selectedFacets:[{key:"channel",value:null!==a&&void 0!==a?a:""},{key:"locale",value:o}]});return{terms:(null!==(t=null===c||void 0===c?void 0:c.search.suggestions.terms)&&void 0!==t?t:[]).slice(0,n),products:(null!==(r=null===c||void 0===c?void 0:c.search.suggestions.products)&&void 0!==r?r:[]).slice(0,n),isLoading:!i&&!c}},T=r(4842);var N=({testId:e="fs-search-history",title:t="History",clearLabel:r="Clear History",onClear:n,children:a,...i})=>o.createElement("section",{"data-testid":e,"data-fs-search-history":!0,...i},o.createElement("header",{"data-fs-search-history-header":!0},o.createElement("p",{"data-fs-search-history-title":!0},t),o.createElement(T.Z,{variant:"tertiary",onClick:n,size:"small"},r)),o.createElement(c.Z,{as:"ol"},a));var H=()=>o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",strokeWidth:"16",width:24,height:24},o.createElement("rect",{width:"256",height:"256",fill:"none"}),o.createElement("line",{x1:"128",y1:"80",x2:"128",y2:"128",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),o.createElement("line",{x1:"169.6",y1:"152",x2:"128",y2:"128",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),o.createElement("polyline",{points:"184.2 99.7 224.2 99.7 224.2 59.7",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),o.createElement("path",{d:"M190.2,190.2a88,88,0,1,1,0-124.4l34,33.9",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}));var M=({testId:e="fs-search-history-term",value:t,linkProps:r,icon:n})=>{const a=n||o.createElement(H,null);return o.createElement("li",{"data-fs-search-history-item":!0,"data-testid":e},o.createElement(l.Z,{...r,"data-fs-search-history-item-link":!0,variant:"display"},a&&o.createElement(u.Z,{component:a,"data-fs-search-history-item-icon":!0}),o.createElement("span",null,t)))},z=r(5098);function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function V(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var U=e=>{var t=Object.assign({},e),{onSearchInputSelection:r}=(0,b.ZP)(),{searchHistory:n,clearSearchHistory:a}=(0,z.Z)();return n.length?(0,j.jsx)(N,V(V({title:"History",onClear:a},t),{},{children:n.map((e=>(0,j.jsx)(M,{value:e.term,linkProps:{href:e.path,onClick:()=>null===r||void 0===r?void 0:r(e.term,e.path)}},e.term)))})):null};var B=(0,o.forwardRef)((function({testId:e="fs-top-search",title:t="Top Search",loadingMessage:r="Loading...",isLoading:n,children:a,...i},s){return o.createElement("section",{ref:s,"data-testid":e,"data-fs-search-top":!0,...i},n?o.createElement("p",{"data-fs-search-top-input-loading-text":!0},r):o.createElement(o.Fragment,null,o.createElement("header",{"data-fs-search-top-header":!0},o.createElement("p",{"data-fs-search-top-title":!0},t)),o.createElement(c.Z,{as:"ol"},a)))})),G=r(44);var Q=(0,o.forwardRef)((function({testId:e="fs-top-search-term",value:t,linkProps:r,index:n}){return o.createElement("li",{"data-fs-search-top-item":!0,"data-testid":e},o.createElement(l.Z,{...r,"data-fs-search-top-item-link":!0,variant:"display"},o.createElement(G.Z,{"data-fs-search-top-item-badge":!0,variant:"info"},n+1),t))})),J="TopSearchSuggestionsQuery";var q=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,{channel:n,locale:a}=(0,R.kP)(),{data:o,error:c}=(0,_.aM)(J,{term:"",selectedFacets:[{key:"channel",value:null!==n&&void 0!==n?n:""},{key:"locale",value:a}]});return{terms:(null!==(e=null===o||void 0===o?void 0:o.search.suggestions.terms)&&void 0!==e?e:t).slice(0,r),isLoading:!c&&!o}},K=["topTerms"];function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var $=(0,o.forwardRef)((function(e){var{topTerms:t}=e,r=(0,a.Z)(e,K),{onSearchInputSelection:n}=(0,b.ZP)(),{terms:o,isLoading:c}=q(t);return 0===o.length?null:(0,j.jsx)(B,Y(Y({title:"Top Search",isLoading:c},r),{},{children:o.map(((e,t)=>(0,j.jsx)(Q,{value:e.value,index:t,linkProps:{href:(0,b.uc)(e.value),onClick:()=>null===n||void 0===n?void 0:n(e.value,(0,b.uc)(e.value))}},t)))}))})),ee=["term","style"];function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var re=function(e){var{term:t="",style:r}=e,o=(0,a.Z)(e,ee),{terms:c,products:i,isLoading:s}=F(t);return 0!==t.length||s?s?(0,j.jsx)("p",{"data-fs-search-input-loading-text":!0,children:"Loading..."}):0===c.length&&0===i.length?null:(0,j.jsx)(I,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({term:t,terms:c,products:i},o)):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(U,{"data-fs-search-section":!0}),(0,j.jsx)($,{"data-fs-search-section":!0})]})}},2154:function(e,t,r){r.d(t,{E:function(){return y}});var n=r(9499),a=r(4730),o=r(2784),c=r(9008),i=r.n(c);var s=(e,t)=>{var r,n,a=["https://assets.vtex.app","unsafe"],o=[];t.trim&&a.push("trim"),t.manualCrop&&a.push((e=>{var{left:t,top:r,right:n,bottom:a}=e;return"".concat(t,"x").concat(r,":").concat(n,"x").concat(a)})(t.manualCrop)),t.fitIn&&a.push("fit-in"),o.push(null!==(r=t.horizontalAlign)&&void 0!==r?r:"center"),o.push(null!==(n=t.verticalAlign)&&void 0!==n?n:"middle"),t.smart&&o.push("smart");var{filters:c}=t;return c&&o.push(function(e){var t=["filters"];return Object.keys(e).forEach((r=>{var n,a=e[r];n=Array.isArray(a)?a.join(","):!0===a?"":String(a),t.push("".concat(r,"(").concat(n,")"))})),t.join(":")}(c)),o.push(encodeURIComponent(e)),(e,r)=>{var n="";return t.flipHorizontal&&(n+="-"),n+="".concat(e,"x"),t.flipVertical&&(n+="-"),n+="".concat(r),[...a,n,...o].join("/")}},l=["src","width","height","options"];function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var p=[1,2,3],d=p[p.length-1],f=e=>{var{src:t,width:r,height:c,options:i={}}=e,f=(0,a.Z)(e,l),{srcSet:h,src:m}=(0,o.useMemo)((()=>{var e=s(t,i),n=p.map((t=>{var n=r*t;return"".concat(e(n,c*t)," ").concat(n,"w")}));return{src:e(r*d,c*d),srcSet:n.join(", ")}}),[c,i,t,r]);return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({src:m,srcSet:h,width:"".concat(r,"px"),height:"".concat(c,"px")},f)},h=r(2322),m=["preload","fetchPriority"];function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var g=(0,o.forwardRef)(((e,t)=>{var{preload:r=!1,fetchPriority:n}=e,o=(0,a.Z)(e,m),c=f(o),{src:s,sizes:l="100vw",srcSet:u}=c;return(0,h.jsxs)(h.Fragment,{children:[r&&(0,h.jsx)(i(),{children:(0,h.jsx)("link",{as:"image",rel:"preload",href:s,imageSrcSet:u,imageSizes:l,fetchpriority:n})}),(0,h.jsx)("img",O(O({ref:t,"data-fs-image":!0},c),{},{alt:c.alt,fetchpriority:n}))]})}));g.displayName="Image";var y=(0,o.memo)(g)},7732:function(e,t,r){r.d(t,{WN:function(){return u},aM:function(){return p},km:function(){return l}});var n=r(29),a=r(9499),o=r(9857),c=r(180);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){(0,a.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l=(e,t)=>"".concat(e,"::").concat(JSON.stringify(t)),u={errorRetryCount:3,refreshWhenHidden:!1,refreshWhenOffline:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!0},p=(e,t,r)=>(0,o.ZP)(l(e,t),s(s({fetcher:()=>new Promise((a=>{setTimeout((0,n.Z)((function*(){a(yield(0,c.W)(e,t,r))})))}))},u),r))},5346:function(e,t,r){r.d(t,{P:function(){return c},o:function(){return o}});var n=r(2784),a=r(5914),o=function(){var{decimals:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{currency:t,locale:r}=(0,a.kP)();return(0,n.useCallback)((n=>Intl.NumberFormat(r,{style:"currency",currency:t.code,minimumFractionDigits:e?2:0}).format(n)),[t.code,r,e])},c=e=>{var t=o();return(0,n.useMemo)((()=>t(e)),[t,e])}},9854:function(e,t,r){r.d(t,{w:function(){return c}});var n=r(8460),a=r(2784),o=r(5914),c=e=>{var{index:t,product:r,selectedOffer:c}=e,{slug:i}=r,{currency:{code:s}}=(0,o.kP)(),l=(0,a.useCallback)((()=>{(0,n._)({name:"select_item",params:{items:[{item_id:r.isVariantOf.productGroupID,item_name:r.isVariantOf.name,item_brand:r.brand.name,item_variant:r.sku,index:t,price:r.offers.offers[c].price,discount:r.offers.offers[c].listPrice-r.offers.offers[c].price,currency:s,item_variant_name:r.name,product_reference_id:r.gtin}]}}),(0,n._)({name:"search_select_item",params:{url:window.location.href,items:[{item_id:r.isVariantOf.productGroupID,item_variant:r.sku,index:t}]}})}),[s,r,t,c]);return{href:"/".concat(i,"/p"),onClick:l,"data-testid":"product-link"}}}}]);
|
|
File without changes
|
|
File without changes
|