@faststore/core 3.0.157 → 3.0.158
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/.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/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-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +7 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/3202.js +1 -1
- package/.next/server/chunks/5484.js +1 -1
- package/.next/server/chunks/5754.js +1 -1
- package/.next/server/chunks/7917.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/api/graphql.js +1 -1
- package/.next/server/pages/en-US/404.html +1 -1
- package/.next/server/pages/en-US/500.html +1 -1
- package/.next/server/pages/en-US/account.html +1 -1
- package/.next/server/pages/en-US/checkout.html +1 -1
- package/.next/server/pages/en-US/login.html +1 -1
- package/.next/server/pages/en-US/s.html +1 -1
- package/.next/server/pages/en-US.html +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/{3202.2bdeba847ce9ecd4.js → 3202.d7d5a83625bed7aa.js} +1 -1
- package/.next/static/chunks/3523.7b396bcd952800b9.js +1 -0
- package/.next/static/chunks/{5484.50796e8843ec9dad.js → 5484.4fe23adb8755a0dd.js} +1 -1
- package/.next/static/chunks/{webpack-4db0ac36fb83322c.js → webpack-9c6d1ba53f8caf2c.js} +1 -1
- package/.next/trace +97 -97
- package/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +5 -5
- package/package.json +2 -2
- package/src/components/search/SearchDropdown/SearchDropdown.tsx +27 -6
- package/src/components/search/SearchDropdown/index.ts +1 -0
- package/src/components/search/SearchProductItem/SearchProductItem.tsx +7 -0
- package/src/sdk/analytics/platform/vtex/search.ts +21 -0
- package/src/sdk/analytics/types.ts +12 -0
- package/.next/static/chunks/3523.9c4d94172a1336ac.js +0 -1
- /package/.next/static/{VgK3X_MvA1JXpiVU8zDih → gxJyuR6uuwUtbNvozKfXD}/_buildManifest.js +0 -0
- /package/.next/static/{VgK3X_MvA1JXpiVU8zDih → gxJyuR6uuwUtbNvozKfXD}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -38,8 +38,8 @@ https://nextjs.org/telemetry
|
|
|
38
38
|
Collecting page data ...
|
|
39
39
|
Generating static pages (0/7) ...
|
|
40
40
|
|
|
41
41
|
Generating static pages (1/7)
|
|
42
|
-
|
|
43
42
|
Generating static pages (3/7)
|
|
44
43
|
Warning: Dynamic Content not found for the page: home. Refer to the Dynamic Content documentation at https://developers.vtex.com/docs/guides/faststore/dynamic-content-overview for mapping the page and the corresponding data-fetching function.
|
|
44
|
+
|
|
45
45
|
Generating static pages (3/7)
|
|
46
46
|
|
|
47
47
|
Generating static pages (5/7)
|
|
48
48
|
|
|
49
49
|
✓ Generating static pages (7/7)
|
|
50
50
|
Finalizing page optimization ...
|
|
@@ -67,11 +67,11 @@ Route (pages) Size First Load JS
|
|
|
67
67
|
├ chunks/framework-12a146e94cfcf7c4.js 45.4 kB
|
|
68
68
|
├ chunks/main-209ac4974b020af1.js 33.1 kB
|
|
69
69
|
├ chunks/pages/_app-e419b2062065ccf0.js 9.87 kB
|
|
70
|
-
├ chunks/webpack-
|
|
70
|
+
├ chunks/webpack-9c6d1ba53f8caf2c.js 3.36 kB
|
|
71
71
|
└ css/ee0556daedda6306.css 3.07 kB
|
|
72
72
|
|
|
73
73
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
|
74
74
|
○ (Static) automatically rendered as static HTML (uses no initial props)
|
|
75
75
|
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
|
|
76
76
|
|
|
77
|
-
Done in 69.
|
|
77
|
+
Done in 69.94s.
|
package/.turbo/turbo-lint.log
CHANGED
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
yarn run v1.22.22
|
|
2
2
|
$ jest
|
|
3
|
-
PASS test/
|
|
4
|
-
PASS test/
|
|
5
|
-
PASS test/server/index.test.ts (
|
|
3
|
+
PASS test/server/cms/index.test.ts (34.175 s)
|
|
4
|
+
PASS test/utils/multipleTemplates.test.ts (34.375 s)
|
|
5
|
+
PASS test/server/index.test.ts (37.644 s)
|
|
6
6
|
|
|
7
7
|
Test Suites: 3 passed, 3 total
|
|
8
8
|
Tests: 19 passed, 19 total
|
|
9
9
|
Snapshots: 0 total
|
|
10
|
-
Time:
|
|
10
|
+
Time: 38.767 s
|
|
11
11
|
Ran all test suites.
|
|
12
|
-
Done in
|
|
12
|
+
Done in 40.04s.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.158",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "vtex/faststore",
|
|
6
6
|
"browserslist": "supports es6-module and not dead",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"node": "18.19.0",
|
|
129
129
|
"yarn": "1.19.1"
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "fd9b72c772175840b781e52dde650a0ff7a4c66b"
|
|
132
132
|
}
|
|
@@ -13,11 +13,30 @@ import { SearchState } from '@faststore/sdk'
|
|
|
13
13
|
import { ProductSummary_ProductFragment } from '@generated/graphql'
|
|
14
14
|
import SearchProductItem from 'src/components/search/SearchProductItem'
|
|
15
15
|
import { formatSearchPath } from 'src/sdk/search/formatSearchPath'
|
|
16
|
+
import type {
|
|
17
|
+
IntelligentSearchAutocompleteClickEvent,
|
|
18
|
+
IntelligentSearchAutocompleteClickParams,
|
|
19
|
+
} from 'src/sdk/analytics/types'
|
|
20
|
+
|
|
16
21
|
interface SearchDropdownProps {
|
|
17
22
|
sort: SearchState['sort']
|
|
18
23
|
[key: string]: any
|
|
19
24
|
}
|
|
20
25
|
|
|
26
|
+
export function sendAutocompleteClickEvent({
|
|
27
|
+
url,
|
|
28
|
+
term,
|
|
29
|
+
position,
|
|
30
|
+
productId,
|
|
31
|
+
}: IntelligentSearchAutocompleteClickParams) {
|
|
32
|
+
import('@faststore/sdk').then(({ sendAnalyticsEvent }) => {
|
|
33
|
+
sendAnalyticsEvent<IntelligentSearchAutocompleteClickEvent>({
|
|
34
|
+
name: 'intelligent_search_autocomplete_click',
|
|
35
|
+
params: { term, url, productId, position },
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
21
40
|
function SearchDropdown({ sort, ...otherProps }: SearchDropdownProps) {
|
|
22
41
|
const {
|
|
23
42
|
values: { onSearchSelection, products, term, terms },
|
|
@@ -38,14 +57,16 @@ function SearchDropdown({ sort, ...otherProps }: SearchDropdownProps) {
|
|
|
38
57
|
term: suggestion,
|
|
39
58
|
sort,
|
|
40
59
|
}),
|
|
41
|
-
onClick: () =>
|
|
60
|
+
onClick: () => {
|
|
42
61
|
onSearchSelection?.(
|
|
43
62
|
suggestion,
|
|
44
|
-
formatSearchPath({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
63
|
+
formatSearchPath({ term: suggestion, sort })
|
|
64
|
+
)
|
|
65
|
+
sendAutocompleteClickEvent({
|
|
66
|
+
term: suggestion,
|
|
67
|
+
url: window.location.href,
|
|
68
|
+
})
|
|
69
|
+
},
|
|
49
70
|
}}
|
|
50
71
|
/>
|
|
51
72
|
))}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import { Image } from 'src/components/ui/Image'
|
|
9
9
|
import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
|
|
10
10
|
import { useProductLink } from 'src/sdk/product/useProductLink'
|
|
11
|
+
import { sendAutocompleteClickEvent } from '../SearchDropdown'
|
|
11
12
|
import type { ProductSummary_ProductFragment } from '@generated/graphql'
|
|
12
13
|
|
|
13
14
|
type SearchProductItemProps = {
|
|
@@ -50,6 +51,12 @@ function SearchProductItem({
|
|
|
50
51
|
onClick: () => {
|
|
51
52
|
onClick()
|
|
52
53
|
onSearchSelection?.(name, href)
|
|
54
|
+
sendAutocompleteClickEvent({
|
|
55
|
+
url: href,
|
|
56
|
+
term: name,
|
|
57
|
+
position: index,
|
|
58
|
+
productId: product.isVariantOf.productGroupID ?? product.sku,
|
|
59
|
+
})
|
|
53
60
|
},
|
|
54
61
|
...baseLinkProps,
|
|
55
62
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { AnalyticsEvent } from '@faststore/sdk'
|
|
5
5
|
import type {
|
|
6
|
+
IntelligentSearchAutocompleteClickEvent,
|
|
6
7
|
IntelligentSearchAutocompleteQueryEvent,
|
|
7
8
|
IntelligentSearchQueryEvent,
|
|
8
9
|
SearchSelectItemEvent,
|
|
@@ -76,6 +77,13 @@ type SearchEvent =
|
|
|
76
77
|
url: string
|
|
77
78
|
type: 'search.autocomplete.query'
|
|
78
79
|
}
|
|
80
|
+
| {
|
|
81
|
+
text: string
|
|
82
|
+
url?: string
|
|
83
|
+
position?: number
|
|
84
|
+
productId?: string
|
|
85
|
+
type: 'search.autocomplete.click'
|
|
86
|
+
}
|
|
79
87
|
|
|
80
88
|
const sendEvent = (options: SearchEvent & { url?: string }) =>
|
|
81
89
|
fetch(`https://sp.vtex.com/event-api/v1/${config.api.storeId}/event`, {
|
|
@@ -101,6 +109,7 @@ const handleEvent = (
|
|
|
101
109
|
| SearchSelectItemEvent
|
|
102
110
|
| IntelligentSearchQueryEvent
|
|
103
111
|
| IntelligentSearchAutocompleteQueryEvent
|
|
112
|
+
| IntelligentSearchAutocompleteClickEvent
|
|
104
113
|
) => {
|
|
105
114
|
switch (event.name) {
|
|
106
115
|
case 'search_select_item': {
|
|
@@ -156,6 +165,18 @@ const handleEvent = (
|
|
|
156
165
|
break
|
|
157
166
|
}
|
|
158
167
|
|
|
168
|
+
case 'intelligent_search_autocomplete_click': {
|
|
169
|
+
sendEvent({
|
|
170
|
+
text: event.params.term,
|
|
171
|
+
url: event.params.url ?? '',
|
|
172
|
+
productId: event.params.productId ?? '',
|
|
173
|
+
...(event.params.position && { position: event.params.position }),
|
|
174
|
+
type: 'search.autocomplete.click',
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
break
|
|
178
|
+
}
|
|
179
|
+
|
|
159
180
|
default:
|
|
160
181
|
}
|
|
161
182
|
}
|
|
@@ -48,3 +48,15 @@ export interface IntelligentSearchAutocompleteQueryEvent {
|
|
|
48
48
|
name: 'intelligent_search_autocomplete_query'
|
|
49
49
|
params: IntelligentSearchAutocompleteQueryParams
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
export interface IntelligentSearchAutocompleteClickParams {
|
|
53
|
+
term: string
|
|
54
|
+
url?: string
|
|
55
|
+
position?: number
|
|
56
|
+
productId?: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface IntelligentSearchAutocompleteClickEvent {
|
|
60
|
+
name: 'intelligent_search_autocomplete_click'
|
|
61
|
+
params: IntelligentSearchAutocompleteClickParams
|
|
62
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3523],{9767:function(e,t,r){var a=r(2784),n=r(5450);let c=(0,a.forwardRef)(function({value:e,as:t="span",variant:r="selling",testId:c="fs-price",formatter:o=e=>e,SRText:s,...i},l){let u=o(e,r);return a.createElement(t,{ref:l,"data-fs-price":!0,"data-fs-price-variant":r,"data-testid":c,...i},s&&a.createElement(n.Z,{text:s}),u)});t.Z=c},5450:function(e,t,r){var a=r(2784);t.Z=function({text:e,as:t}){let r=t??"span";return a.createElement(r,{"data-fs-sr-only":!0},e)}},1933:function(e,t,r){r.d(t,{R:function(){return useSearch}});var a=r(2784),n=r(101);let useSearch=()=>{let e=(0,a.useContext)(n.c);return e?{inContext:!0,values:e}:{inContext:!1}}},9088:function(e,t,r){var a=r(2784),n=r(9767);let c=(0,a.forwardRef)(function({testId:e="fs-product-price",value:t,listPrice:r,formatter:c,...o},s){let i=r??0,l=t??0;return a.createElement("div",{ref:s,"data-fs-product-price":!0,"data-testid":e,...o},l!==i&&0!==i?a.createElement(a.Fragment,null,a.createElement(n.Z,{value:i,formatter:c,testId:"list-price","data-value":i,variant:"listing",SRText:"Original price:"}),a.createElement(n.Z,{value:l,formatter:c,testId:"price","data-value":l,variant:"spot",SRText:"Price:"})):a.createElement(n.Z,{value:l,formatter:c,testId:"price","data-value":l,variant:"spot",SRText:"Price:"}))});t.Z=c},2174:function(e,t,r){var a=r(2784),n=r(1933),c=r(4564);t.Z=({testId:e="fs-search-auto-complete",children:t,...r})=>{let{inContext:o,values:s}=(0,n.R)();return o&&(s.terms.length<=0||s.term.length<=0)?null:a.createElement("section",{"data-testid":e,"data-fs-search-auto-complete":!0,...r},a.createElement(c.Z,{as:"ol"},t))}},757:function(e,t,r){var a=r(2784),n=r(2614),c=r(727);t.Z=({testId:e="fs-search-auto-complete-term",suggestion:t,term:r,linkProps:o,icon:s=a.createElement(n.Z,{name:"MagnifyingGlass",width:18,height:18})})=>{let i=t.toLowerCase().split(r.toLowerCase());return a.createElement("li",{"data-fs-search-auto-complete-item":!0,"data-testid":e},a.createElement(c.Z,{...o,"data-fs-search-auto-complete-item-link":!0,variant:"display"},a.createElement("span",{"data-fs-search-auto-complete-item-icon":!0},s),a.createElement("p",null,i.map((e,n)=>a.createElement(a.Fragment,{key:[e,n].join()},e.length>0&&a.createElement("strong",{"data-fs-search-auto-complete-item-suggestion":!0},0===n?e.charAt(0).toUpperCase()+e.slice(1):e),n!==i.length-1&&(0===n?r.split("").map((e,r)=>0===r&&0===t.indexOf(e.toUpperCase())?e.toUpperCase():e.toLowerCase()).join(""):r.toLowerCase()))))))}},4583:function(e,t,r){var a=r(2784),n=r(1933);let SearchLoading=()=>{let{inContext:e,values:t}=(0,n.R)();return a.createElement(a.Fragment,null,e&&t.isLoading&&a.createElement("p",{"data-fs-search-dropdown-loading-text":!0},"Loading..."))},c=(0,a.forwardRef)(function({testId:e="fs-search-dropdown",children:t,...r},n){return a.createElement("div",{ref:n,"data-fs-search-dropdown":!0,"data-testid":e,...r},a.createElement("section",null,a.createElement(SearchLoading,null),t))});t.Z=c},2701:function(e,t,r){var a=r(2784),n=r(1933),c=r(3339),o=r(4564);t.Z=({testId:e="fs-search-history",title:t="History",clearLabel:r="Clear History",onClear:s,children:i,...l})=>{let{inContext:u,values:d}=(0,n.R)();return u&&(0!==d.term.length||d.isLoading)?null:a.createElement("section",{"data-testid":e,"data-fs-search-history":!0,...l},a.createElement("header",{"data-fs-search-history-header":!0},a.createElement("p",{"data-fs-search-history-title":!0},t),a.createElement(c.Z,{variant:"tertiary",onClick:s,size:"small"},r)),a.createElement(o.Z,{as:"ol"},i))}},9482:function(e,t,r){var a=r(2784),n=r(2614),c=r(727);t.Z=({testId:e="fs-search-history-term",value:t,linkProps:r,icon:o=a.createElement(n.Z,{name:"ClockClockwise",width:18,height:18})})=>a.createElement("li",{"data-fs-search-history-item":!0,"data-testid":e},a.createElement(c.Z,{...r,"data-fs-search-history-item-link":!0,variant:"display"},a.createElement("span",{"data-fs-search-history-item-icon":!0},o),a.createElement("span",null,t)))},6035:function(e,t,r){var a=r(2784),n=r(727);let c=(0,a.forwardRef)(function({testId:e="fs-search-product-item",linkProps:t,children:r},c){return a.createElement("li",{ref:c,"data-fs-search-product-item":!0,"data-testid":e},a.createElement(n.Z,{...t,"data-fs-search-product-item-link":!0,variant:"display"},r))});t.Z=c},3454:function(e,t,r){var a=r(2784),n=r(9088);let c=(0,a.forwardRef)(function({price:e,title:t,...r},c){return a.createElement("section",{ref:c,"data-fs-search-product-item-content":!0,...r},a.createElement("p",{"data-fs-search-product-item-title":!0},t),0!==e.value&&a.createElement(n.Z,{"data-fs-search-product-item-prices":!0,listPrice:e.listPrice,value:e.value,formatter:e.formatter}))});t.Z=c},9082:function(e,t,r){var a=r(2784);let n=(0,a.forwardRef)(function({testId:e="fs-search-product-item-image",children:t,...r},n){return a.createElement("div",{ref:n,"data-fs-search-product-item-image":!0,"data-testid":e,...r},t)});t.Z=n},9994:function(e,t,r){var a=r(2784),n=r(1933),c=r(4564);t.Z=({testId:e="fs-search-products",title:t="Suggested Products",children:r,...o})=>{let{inContext:s,values:i}=(0,n.R)();return s&&i.products.length<=0?null:a.createElement("section",{"data-testid":e,"data-fs-search-products":!0,...o},a.createElement("header",{"data-fs-search-products-header":!0},a.createElement("p",{"data-fs-search-products-title":!0},t)),a.createElement(c.Z,{as:"ol"},r))}},3311:function(e,t,r){var a=r(2784),n=r(1933),c=r(4564);let o=(0,a.forwardRef)(function({testId:e="fs-top-search",title:t="Top Search",children:r,...o},s){let{inContext:i,values:l}=(0,n.R)();return i&&(0!==l.term.length||l.isLoading)?null:a.createElement("section",{ref:s,"data-testid":e,"data-fs-search-top":!0,...o},a.createElement("header",{"data-fs-search-top-header":!0},a.createElement("p",{"data-fs-search-top-title":!0},t)),a.createElement(c.Z,{as:"ol"},r))});t.Z=o},1287:function(e,t,r){var a=r(2784),n=r(727),c=r(276);let o=(0,a.forwardRef)(function({testId:e="fs-top-search-term",value:t,linkProps:r,index:o},s){return a.createElement("li",{ref:s,"data-fs-search-top-item":!0,"data-testid":e},a.createElement(n.Z,{...r,"data-fs-search-top-item-link":!0,variant:"display"},a.createElement(c.Z,{"data-fs-search-top-item-badge":!0,variant:"info"},o+1),t))});t.Z=o},6942:function(e,t,r){r.r(t),r.d(t,{default:function(){return search_SearchDropdown_SearchDropdown}});var a=r(9499),n=r(4730),c=r(1933),o=r(4583),s=r(2174),i=r(757),l=r(9994),u=r(2701),d=r(9482),p=r(8543),f=r(2322);function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){(0,a.Z)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var search_SearchHistory_SearchHistory=e=>{var t=Object.assign({},e),{values:{onSearchSelection:r}}=(0,c.R)(),{searchHistory:a,clearSearchHistory:n}=(0,p.Z)();return a.length?(0,f.jsx)(u.Z,_objectSpread(_objectSpread({title:"History",onClear:n},t),{},{children:a.map(e=>(0,f.jsx)(d.Z,{value:e.term,linkProps:{href:e.path,onClick:()=>null==r?void 0:r(e.term,e.path)}},e.term))})):null},m=r(3311),h=r(1287),v=r(3295),y=r(3523),b=r(7553),O=r(5238),j=y.M,search_useTopSearch=function(){var{channel:e,locale:t}=(0,O.kP)(),{data:r,error:a}=(0,b.aM)(j,{term:"",selectedFacets:[{key:"channel",value:null!=e?e:""},{key:"locale",value:t}]});return{data:r,error:a}},g=["topTerms","sort"];function SearchTop_ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function SearchTop_objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SearchTop_ownKeys(Object(r),!0).forEach(function(t){(0,a.Z)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SearchTop_ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var search_SearchTop_SearchTop=function(e){var t,{topTerms:r=[],sort:a}=e,o=(0,n.Z)(e,g),{values:{onSearchSelection:s}}=(0,c.R)(),{data:i}=search_useTopSearch(),l=(null!==(t=null==i?void 0:i.search.suggestions.terms)&&void 0!==t?t:r).slice(0,5);return 0===l.length?null:(0,f.jsx)(m.Z,SearchTop_objectSpread(SearchTop_objectSpread({title:"Top Search"},o),{},{children:l.map((e,t)=>(0,f.jsx)(h.Z,{value:e.value,index:t,linkProps:{href:(0,v.u)({term:e.value,sort:a}),onClick:()=>null==s?void 0:s(e.value,(0,v.u)({term:e.value,sort:a}))}},t))}))},w=r(6035),S=r(9082),P=r(3454),E=r(8918),_=r(113),Z=r(5679),k=["product","index"],D=["href","onClick"];function SearchProductItem_ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function SearchProductItem_objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SearchProductItem_ownKeys(Object(r),!0).forEach(function(t){(0,a.Z)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SearchProductItem_ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var search_SearchProductItem_SearchProductItem=function(e){var{product:t,index:r}=e,a=(0,n.Z)(e,k),{values:{onSearchSelection:o}}=(0,c.R)(),s=(0,Z.w)({product:t,selectedOffer:0,index:r}),{href:i,onClick:l}=s,u=(0,n.Z)(s,D),{isVariantOf:{name:d},image:[p],offers:{lowPrice:m,offers:[{listPrice:h}]}}=t,v=SearchProductItem_objectSpread({href:i,onClick:()=>{l(),null==o||o(d,i)}},u);return(0,f.jsxs)(w.Z,SearchProductItem_objectSpread(SearchProductItem_objectSpread({linkProps:v},a),{},{children:[(0,f.jsx)(S.Z,{children:(0,f.jsx)(E.Z,{src:p.url,alt:p.alternateName,width:56,height:56})}),(0,f.jsx)(P.Z,{title:d,price:{value:m,listPrice:h,formatter:_.P}})]}))},x=["sort"];function SearchDropdown_ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function SearchDropdown_objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SearchDropdown_ownKeys(Object(r),!0).forEach(function(t){(0,a.Z)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SearchDropdown_ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var search_SearchDropdown_SearchDropdown=function(e){var{sort:t}=e,r=(0,n.Z)(e,x),{values:{onSearchSelection:a,products:u,term:d,terms:p}}=(0,c.R)();return(0,f.jsxs)(o.Z,SearchDropdown_objectSpread(SearchDropdown_objectSpread({},r),{},{children:[(0,f.jsx)(search_SearchHistory_SearchHistory,{sort:t}),(0,f.jsx)(search_SearchTop_SearchTop,{sort:t}),(0,f.jsx)(s.Z,{children:null==p?void 0:p.map(e=>{var{value:r}=e;return(0,f.jsx)(i.Z,{term:d,suggestion:r,linkProps:{href:(0,v.u)({term:r,sort:t}),onClick:()=>null==a?void 0:a(r,(0,v.u)({term:r,sort:t}))}},r)})}),(0,f.jsx)(l.Z,{children:u.map((e,t)=>(0,f.jsx)(search_SearchProductItem_SearchProductItem,{product:e,index:t},e.id))})]}))}},113:function(e,t,r){r.d(t,{P:function(){return useFormattedPrice}});var a=r(2784),n=r(5238),usePriceFormatter=function(){var{decimals:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{currency:t,locale:r}=(0,n.kP)();return(0,a.useCallback)(a=>Intl.NumberFormat(r,{style:"currency",currency:t.code,minimumFractionDigits:e?2:0}).format(a),[t.code,r,e])},useFormattedPrice=e=>{var t=usePriceFormatter();return(0,a.useMemo)(()=>t(e),[t,e])}},5679:function(e,t,r){r.d(t,{w:function(){return useProductLink}});var a=r(2784),n=r(5238),useProductLink=e=>{var{index:t,product:c,selectedOffer:o}=e,{slug:s}=c,{currency:{code:i}}=(0,n.kP)(),l=(0,a.useCallback)(()=>{r.e(7195).then(r.bind(r,1153)).then(e=>{var{sendAnalyticsEvent:r}=e;r({name:"select_item",params:{items:[{item_id:c.isVariantOf.productGroupID,item_name:c.isVariantOf.name,item_brand:c.brand.name,item_variant:c.sku,index:t,price:c.offers.offers[o].price,discount:c.offers.offers[o].listPrice-c.offers.offers[o].price,currency:i,item_variant_name:c.name,product_reference_id:c.gtin}]}}),r({name:"search_select_item",params:{url:window.location.href,items:[{item_id:c.isVariantOf.productGroupID,item_variant:c.sku,index:t}]}})})},[i,c,t,o]);return{href:"/".concat(s,"/p"),onClick:l,"data-testid":"product-link"}}}}]);
|
|
File without changes
|
|
File without changes
|