@faststore/core 2.0.147-alpha.0 → 2.0.151-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/.next/BUILD_ID +1 -0
- package/.next/build-manifest.json +132 -0
- package/.next/cache/.tsbuildinfo +1 -0
- package/.next/cache/config.json +7 -0
- package/.next/cache/eslint/.cache_1gneedd +1 -0
- package/.next/cache/next-server.js.nft.json +1 -0
- 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/export-marker.json +1 -0
- package/.next/images-manifest.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +1 -0
- package/.next/react-loadable-manifest.json +48 -0
- package/.next/required-server-files.json +1 -0
- package/.next/routes-manifest.json +1 -0
- package/.next/server/chunks/104.js +703 -0
- package/.next/server/chunks/123.js +58 -0
- package/.next/server/chunks/143.js +106 -0
- package/.next/server/chunks/183.js +80 -0
- package/.next/server/chunks/247.js +61 -0
- package/.next/server/chunks/280.js +324 -0
- package/.next/server/chunks/287.js +58 -0
- package/.next/server/chunks/312.js +670 -0
- package/.next/server/chunks/336.js +821 -0
- package/.next/server/chunks/350.js +142 -0
- package/.next/server/chunks/368.js +253 -0
- package/.next/server/chunks/401.js +7241 -0
- package/.next/server/chunks/431.js +7241 -0
- package/.next/server/chunks/502.js +600 -0
- package/.next/server/chunks/557.js +132 -0
- package/.next/server/chunks/576.js +80 -0
- package/.next/server/chunks/597.js +169 -0
- package/.next/server/chunks/608.js +644 -0
- package/.next/server/chunks/644.js +235 -0
- package/.next/server/chunks/664.js +3401 -0
- package/.next/server/chunks/676.js +32 -0
- package/.next/server/chunks/701.js +87 -0
- package/.next/server/chunks/74.js +2674 -0
- package/.next/server/chunks/746.js +225 -0
- package/.next/server/chunks/82.js +371 -0
- package/.next/server/chunks/854.js +72 -0
- package/.next/server/chunks/859.js +959 -0
- package/.next/server/chunks/874.js +487 -0
- package/.next/server/chunks/886.js +120 -0
- package/.next/server/chunks/907.js +1723 -0
- package/.next/server/chunks/98.js +124 -0
- package/.next/server/chunks/font-manifest.json +1 -0
- package/.next/server/font-manifest.json +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/pages/404.js +393 -0
- package/.next/server/pages/404.js.nft.json +1 -0
- package/.next/server/pages/500.js +395 -0
- package/.next/server/pages/500.js.nft.json +1 -0
- package/.next/server/pages/[...slug].js +718 -0
- package/.next/server/pages/[...slug].js.nft.json +1 -0
- package/.next/server/pages/[slug]/p.js +2458 -0
- package/.next/server/pages/[slug]/p.js.nft.json +1 -0
- package/.next/server/pages/_app.js +368 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +304 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +164 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages/account.js +370 -0
- package/.next/server/pages/account.js.nft.json +1 -0
- package/.next/server/pages/api/graphql.js +315 -0
- package/.next/server/pages/api/graphql.js.nft.json +1 -0
- package/.next/server/pages/api/preview.js +118 -0
- package/.next/server/pages/api/preview.js.nft.json +1 -0
- package/.next/server/pages/checkout.js +370 -0
- package/.next/server/pages/checkout.js.nft.json +1 -0
- package/.next/server/pages/en-US/404.html +81 -0
- package/.next/server/pages/en-US/404.json +1 -0
- package/.next/server/pages/en-US/500.html +81 -0
- package/.next/server/pages/en-US/500.json +1 -0
- package/.next/server/pages/en-US/account.html +81 -0
- package/.next/server/pages/en-US/account.json +1 -0
- package/.next/server/pages/en-US/checkout.html +81 -0
- package/.next/server/pages/en-US/checkout.json +1 -0
- package/.next/server/pages/en-US/login.html +81 -0
- package/.next/server/pages/en-US/login.json +1 -0
- package/.next/server/pages/en-US/s.html +81 -0
- package/.next/server/pages/en-US/s.json +1 -0
- package/.next/server/pages/en-US.html +81 -0
- package/.next/server/pages/en-US.json +1 -0
- package/.next/server/pages/index.js +966 -0
- package/.next/server/pages/index.js.nft.json +1 -0
- package/.next/server/pages/login.js +375 -0
- package/.next/server/pages/login.js.nft.json +1 -0
- package/.next/server/pages/s.js +457 -0
- package/.next/server/pages/s.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +16 -0
- package/.next/server/webpack-api-runtime.js +229 -0
- package/.next/server/webpack-runtime.js +229 -0
- package/.next/static/SPkTG9-gxU2UejLG7FvOw/_buildManifest.js +1 -0
- package/.next/static/SPkTG9-gxU2UejLG7FvOw/_ssgManifest.js +1 -0
- package/.next/static/chunks/143.dd8a556e6957baa1.js +1 -0
- package/.next/static/chunks/170.c17ce564bb568265.js +1 -0
- package/.next/static/chunks/226.b57e10ad9932f88c.js +1 -0
- package/.next/static/chunks/327-43715af4f3fffaf6.js +1 -0
- package/.next/static/chunks/336.0846f48eccce57e4.js +1 -0
- package/.next/static/chunks/366-4a0572a47e2225d9.js +1 -0
- package/.next/static/chunks/377-61e89c711b136605.js +1 -0
- package/.next/static/chunks/391-47b923ef44945418.js +1 -0
- package/.next/static/chunks/495.8ffebac98e9475dc.js +1 -0
- package/.next/static/chunks/502.ae82de1669112b15.js +1 -0
- package/.next/static/chunks/545-1d3d08edfd2ee4c6.js +1 -0
- package/.next/static/chunks/597.c5cf3fbeae5ceb63.js +1 -0
- package/.next/static/chunks/651.7142f31ce1e052b3.js +1 -0
- package/.next/static/chunks/741.52f7fb873418346f.js +1 -0
- package/.next/static/chunks/98.97381d2021f86cd9.js +1 -0
- package/.next/static/chunks/framework-dfd14d7ce6600b03.js +1 -0
- package/.next/static/chunks/main-fd466221927468fd.js +1 -0
- package/.next/static/chunks/pages/404-459452495a0df278.js +1 -0
- package/.next/static/chunks/pages/500-008e30c48eceebed.js +1 -0
- package/.next/static/chunks/pages/[...slug]-3c749c7d8561eb90.js +1 -0
- package/.next/static/chunks/pages/[slug]/p-fa35dd93d53f75f6.js +1 -0
- package/.next/static/chunks/pages/_app-3e4e7e579cb0681a.js +1 -0
- package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +1 -0
- package/.next/static/chunks/pages/account-46263f0c100c3eae.js +1 -0
- package/.next/static/chunks/pages/checkout-20bb3710b24df3b6.js +1 -0
- package/.next/static/chunks/pages/index-49b7ee570f7cc4b7.js +1 -0
- package/.next/static/chunks/pages/login-f9d316d261fcc062.js +1 -0
- package/.next/static/chunks/pages/s-890c0c4b88484224.js +1 -0
- package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +1 -0
- package/.next/static/chunks/webpack-5051dce9659282f3.js +1 -0
- package/.next/static/css/13a4da555ff5e3be.css +1 -0
- package/.next/static/css/1de3e7b6ba8daaac.css +1 -0
- package/.next/static/css/2e00f7ba49c754b3.css +1 -0
- package/.next/static/css/2e9de35e0cb999e0.css +1 -0
- package/.next/static/css/43b1b3821e21630c.css +1 -0
- package/.next/static/css/48af598df5fe042d.css +1 -0
- package/.next/static/css/923c4a942e57bc91.css +1 -0
- package/.next/static/css/e02cdad8fc000339.css +1 -0
- package/.next/static/css/e434797816e17065.css +1 -0
- package/.next/static/css/e7a6f3559cf45c62.css +1 -0
- package/.next/trace +69 -0
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +6 -0
- package/cms/faststore/sections.json +26 -19
- package/package.json +4 -4
- package/public/~partytown/debug/partytown-atomics.js +556 -0
- package/public/~partytown/debug/partytown-media.js +374 -0
- package/public/~partytown/debug/partytown-sandbox-sw.js +543 -0
- package/public/~partytown/debug/partytown-sw.js +59 -0
- package/public/~partytown/debug/partytown-ww-atomics.js +1789 -0
- package/public/~partytown/debug/partytown-ww-sw.js +1781 -0
- package/public/~partytown/debug/partytown.js +72 -0
- package/public/~partytown/partytown-atomics.js +2 -0
- package/public/~partytown/partytown-media.js +2 -0
- package/public/~partytown/partytown-sw.js +2 -0
- package/public/~partytown/partytown.js +2 -0
- package/src/components/sections/ProductDetails/ProductDetails.tsx +106 -165
- package/src/components/{sections/ProducDetailsContent/ProductDetailsContent.tsx → ui/ProductDescription/ProductDescription.tsx} +7 -7
- package/src/components/ui/ProductDescription/index.ts +1 -0
- package/src/components/ui/ProductDetails/AddToCartLoadingSkeleton.tsx +57 -0
- package/src/components/ui/ProductDetails/ProductDetailsSettings.tsx +125 -0
- package/src/components/ui/ProductDetails/index.ts +2 -0
- package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +18 -2
- package/src/components/sections/ProducDetailsContent/index.ts +0 -1
- /package/src/components/{sections/ProducDetailsContent/ProductDetailsContent.stories.mdx → ui/ProductDescription/ProductDescription.stories.mdx} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = 123;
|
|
3
|
+
exports.ids = [123];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ 123:
|
|
7
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11
|
+
/* harmony export */ });
|
|
12
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
13
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2765);
|
|
15
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5045);
|
|
16
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(875);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const QuantitySelector = ({ max, min = 1, initial, disabled = false, onChange, testId = 'fs-quantity-selector', ...otherProps }) => {
|
|
20
|
+
const [quantity, setQuantity] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initial ?? min);
|
|
21
|
+
const isLeftDisabled = quantity === min;
|
|
22
|
+
const isRightDisabled = quantity === max;
|
|
23
|
+
const changeQuantity = (increaseValue) => {
|
|
24
|
+
const quantityValue = validateQuantityBounds(quantity + increaseValue);
|
|
25
|
+
onChange?.(quantityValue);
|
|
26
|
+
setQuantity(quantityValue);
|
|
27
|
+
};
|
|
28
|
+
const increase = () => changeQuantity(1);
|
|
29
|
+
const decrease = () => changeQuantity(-1);
|
|
30
|
+
function validateQuantityBounds(n) {
|
|
31
|
+
const maxValue = min ? Math.max(n, min) : n;
|
|
32
|
+
return max ? Math.min(maxValue, max) : maxValue;
|
|
33
|
+
}
|
|
34
|
+
function validateInput(e) {
|
|
35
|
+
const val = e.currentTarget.value;
|
|
36
|
+
if (!Number.isNaN(Number(val))) {
|
|
37
|
+
setQuantity(() => {
|
|
38
|
+
const quantityValue = validateQuantityBounds(Number(val));
|
|
39
|
+
onChange?.(quantityValue);
|
|
40
|
+
return quantityValue;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
45
|
+
initial && setQuantity(initial);
|
|
46
|
+
}, [initial]);
|
|
47
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { "data-fs-quantity-selector": disabled ? 'disabled' : 'true', "data-testid": testId, ...otherProps },
|
|
48
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { "data-quantity-selector-button": "left", icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { name: "Minus", width: 16, height: 16, weight: "bold" }), "aria-label": "Decrement Quantity", "aria-controls": "quantity-selector-input", disabled: isLeftDisabled || disabled, onClick: decrease, testId: `${testId}-left-button`, size: "small" }),
|
|
49
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { "data-quantity-selector-input": true, id: "quantity-selector-input", "aria-label": "Quantity", value: quantity, onChange: validateInput, disabled: disabled }),
|
|
50
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { "data-quantity-selector-button": "right", "aria-controls": "quantity-selector-input", "aria-label": "Increment Quantity", disabled: isRightDisabled || disabled, icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { name: "Plus", width: 16, height: 16, weight: "bold" }), onClick: increase, testId: `${testId}-right-button`, size: "small" })));
|
|
51
|
+
};
|
|
52
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (QuantitySelector);
|
|
53
|
+
//# sourceMappingURL=QuantitySelector.js.map
|
|
54
|
+
|
|
55
|
+
/***/ })
|
|
56
|
+
|
|
57
|
+
};
|
|
58
|
+
;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = 143;
|
|
3
|
+
exports.ids = [143];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ 9143:
|
|
7
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
/* harmony import */ var _faststore_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7183);
|
|
14
|
+
/* harmony import */ var _faststore_config__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_faststore_config__WEBPACK_IMPORTED_MODULE_0__);
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
|
|
19
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* More info at: https://www.notion.so/vtexhandbook/Event-API-Documentation-48eee26730cf4d7f80f8fd7262231f84
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const THIRTY_MINUTES_S = 30 * 60;
|
|
26
|
+
const ONE_YEAR_S = 365 * 24 * 3600;
|
|
27
|
+
|
|
28
|
+
const randomUUID = () => typeof crypto.randomUUID === 'function' ? crypto.randomUUID() : (Math.random() * 1e6).toFixed(0);
|
|
29
|
+
|
|
30
|
+
const createStorage = (key, expiresSecond) => {
|
|
31
|
+
const timelapsed = past => (Date.now() - past) / 1e3;
|
|
32
|
+
|
|
33
|
+
return () => {
|
|
34
|
+
const item = JSON.parse(localStorage.getItem(key) ?? 'null');
|
|
35
|
+
const isExpired = !item || timelapsed(item.createdAt) > expiresSecond;
|
|
36
|
+
const payload = isExpired ? randomUUID() : item.payload;
|
|
37
|
+
|
|
38
|
+
if (isExpired) {
|
|
39
|
+
const data = {
|
|
40
|
+
payload,
|
|
41
|
+
createdAt: Date.now()
|
|
42
|
+
};
|
|
43
|
+
localStorage.setItem(key, JSON.stringify(data));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return payload;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const user = {
|
|
51
|
+
anonymous: createStorage('vtex.search.anonymous', ONE_YEAR_S),
|
|
52
|
+
session: createStorage('vtex.search.session', THIRTY_MINUTES_S)
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const sendEvent = options => fetch(`https://sp.vtex.com/event-api/v1/${(_faststore_config__WEBPACK_IMPORTED_MODULE_0___default().api.storeId)}/event`, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
body: JSON.stringify(_objectSpread(_objectSpread({}, options), {}, {
|
|
58
|
+
userAgent: navigator.userAgent,
|
|
59
|
+
anonymous: user.anonymous(),
|
|
60
|
+
session: user.session()
|
|
61
|
+
})),
|
|
62
|
+
headers: {
|
|
63
|
+
'content-type': 'application/json'
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const isFullTextSearch = url => typeof url.searchParams.get('q') === 'string' && /^\/s(\/)?$/g.test(url.pathname);
|
|
68
|
+
|
|
69
|
+
const handleEvent = event => {
|
|
70
|
+
if (event.name !== 'search_select_item') {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const url = new URL(event.params.url);
|
|
75
|
+
|
|
76
|
+
if (!isFullTextSearch(url)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
for (const item of event.params.items ?? []) {
|
|
81
|
+
const productId = item.item_id ?? item.item_variant;
|
|
82
|
+
const position = item.index;
|
|
83
|
+
|
|
84
|
+
if (productId && position) {
|
|
85
|
+
sendEvent({
|
|
86
|
+
type: 'search.click',
|
|
87
|
+
productId,
|
|
88
|
+
position,
|
|
89
|
+
url: url.href,
|
|
90
|
+
text: url.searchParams.get('q') ?? '<empty>'
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
setInterval(() => sendEvent({
|
|
97
|
+
type: 'session.ping'
|
|
98
|
+
}), 60 * 1e3
|
|
99
|
+
/* One minute */
|
|
100
|
+
);
|
|
101
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (handleEvent);
|
|
102
|
+
|
|
103
|
+
/***/ })
|
|
104
|
+
|
|
105
|
+
};
|
|
106
|
+
;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
exports.id = 183;
|
|
2
|
+
exports.ids = [183];
|
|
3
|
+
exports.modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 7183:
|
|
6
|
+
/***/ ((module) => {
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
seo: {
|
|
10
|
+
title: 'NextJSStore',
|
|
11
|
+
description: 'Fast Demo Store',
|
|
12
|
+
titleTemplate: '%s | FastStore',
|
|
13
|
+
author: 'Store Framework'
|
|
14
|
+
},
|
|
15
|
+
// Theming
|
|
16
|
+
theme: 'custom-theme',
|
|
17
|
+
// Ecommerce Platform
|
|
18
|
+
platform: 'vtex',
|
|
19
|
+
// Platform specific configs for API
|
|
20
|
+
api: {
|
|
21
|
+
storeId: 'storeframework',
|
|
22
|
+
workspace: 'master',
|
|
23
|
+
environment: 'vtexcommercestable',
|
|
24
|
+
hideUnavailableItems: true
|
|
25
|
+
},
|
|
26
|
+
// Default session
|
|
27
|
+
session: {
|
|
28
|
+
currency: {
|
|
29
|
+
code: 'USD',
|
|
30
|
+
symbol: '$'
|
|
31
|
+
},
|
|
32
|
+
locale: 'en-US',
|
|
33
|
+
channel: '{"salesChannel":"1","regionId":""}',
|
|
34
|
+
country: 'USA',
|
|
35
|
+
postalCode: null,
|
|
36
|
+
geoCoordinates: null,
|
|
37
|
+
person: null
|
|
38
|
+
},
|
|
39
|
+
// Default cart
|
|
40
|
+
cart: {
|
|
41
|
+
id: '',
|
|
42
|
+
items: [],
|
|
43
|
+
messages: [],
|
|
44
|
+
shouldSplitItem: true
|
|
45
|
+
},
|
|
46
|
+
// Production URLs
|
|
47
|
+
storeUrl: 'https://vtexfaststore.com',
|
|
48
|
+
secureSubdomain: 'https://secure.vtexfaststore.com',
|
|
49
|
+
checkoutUrl: 'https://secure.vtexfaststore.com/checkout',
|
|
50
|
+
loginUrl: 'https://secure.vtexfaststore.com/api/io/login',
|
|
51
|
+
accountUrl: 'https://secure.vtexfaststore.com/api/io/account',
|
|
52
|
+
// Lighthouse CI
|
|
53
|
+
lighthouse: {
|
|
54
|
+
server: process.env.BASE_SITE_URL || 'http://localhost:3000',
|
|
55
|
+
pages: {
|
|
56
|
+
home: '/',
|
|
57
|
+
pdp: '/apple-magic-mouse/p',
|
|
58
|
+
collection: '/office'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
// E2E CI
|
|
62
|
+
cypress: {
|
|
63
|
+
pages: {
|
|
64
|
+
home: '/',
|
|
65
|
+
pdp: '/apple-magic-mouse/p',
|
|
66
|
+
collection: '/office',
|
|
67
|
+
collection_filtered: '/office/?category-1=office&marca=acer&facets=category-1%2Cmarca',
|
|
68
|
+
search: '/s?q=orange'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
analytics: {
|
|
72
|
+
// https://developers.google.com/tag-platform/tag-manager/web#standard_web_page_installation,
|
|
73
|
+
gtmContainerId: 'GTM-PGHZ95N'
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/***/ })
|
|
78
|
+
|
|
79
|
+
};
|
|
80
|
+
;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = 247;
|
|
3
|
+
exports.ids = [247];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ 7549:
|
|
7
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11
|
+
/* harmony export */ });
|
|
12
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
13
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2691);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const Price = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function Price({ value, as: Component = 'span', variant = 'selling', testId = 'fs-price', formatter = (price) => price, SRText, ...otherProps }, ref) {
|
|
18
|
+
const formattedPrice = formatter(value, variant);
|
|
19
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Component, { ref: ref, "data-fs-price": true, "data-fs-price-variant": variant, "data-testid": testId, ...otherProps },
|
|
20
|
+
SRText && react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { text: SRText }),
|
|
21
|
+
formattedPrice));
|
|
22
|
+
});
|
|
23
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Price);
|
|
24
|
+
//# sourceMappingURL=Price.js.map
|
|
25
|
+
|
|
26
|
+
/***/ }),
|
|
27
|
+
|
|
28
|
+
/***/ 5346:
|
|
29
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
30
|
+
|
|
31
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
32
|
+
/* harmony export */ "P": () => (/* binding */ useFormattedPrice)
|
|
33
|
+
/* harmony export */ });
|
|
34
|
+
/* unused harmony export usePriceFormatter */
|
|
35
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
36
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
37
|
+
/* harmony import */ var _session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7295);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const usePriceFormatter = ({
|
|
41
|
+
decimals
|
|
42
|
+
} = {}) => {
|
|
43
|
+
const {
|
|
44
|
+
currency,
|
|
45
|
+
locale
|
|
46
|
+
} = (0,_session__WEBPACK_IMPORTED_MODULE_1__/* .useSession */ .kP)();
|
|
47
|
+
return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(price => Intl.NumberFormat(locale, {
|
|
48
|
+
style: 'currency',
|
|
49
|
+
currency: currency.code,
|
|
50
|
+
minimumFractionDigits: decimals ? 2 : 0
|
|
51
|
+
}).format(price), [currency.code, locale, decimals]);
|
|
52
|
+
};
|
|
53
|
+
const useFormattedPrice = price => {
|
|
54
|
+
const formatter = usePriceFormatter();
|
|
55
|
+
return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => formatter(price), [formatter, price]);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/***/ })
|
|
59
|
+
|
|
60
|
+
};
|
|
61
|
+
;
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = 280;
|
|
3
|
+
exports.ids = [280];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ 9875:
|
|
7
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
"Z": () => (/* binding */ DiscountBadge_DiscountBadge)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// EXTERNAL MODULE: external "react"
|
|
16
|
+
var external_react_ = __webpack_require__(6689);
|
|
17
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
18
|
+
// EXTERNAL MODULE: ../components/dist/atoms/Badge/Badge.js
|
|
19
|
+
var Badge = __webpack_require__(44);
|
|
20
|
+
;// CONCATENATED MODULE: ../components/dist/molecules/DiscountBadge/useDiscountPercent.js
|
|
21
|
+
|
|
22
|
+
const useDiscountPercent = (listPrice, spotPrice) => {
|
|
23
|
+
return (0,external_react_.useMemo)(() => {
|
|
24
|
+
const diff = listPrice - spotPrice;
|
|
25
|
+
const discount = (diff * 100) / listPrice;
|
|
26
|
+
return Math.round(discount);
|
|
27
|
+
}, [spotPrice, listPrice]);
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useDiscountPercent.js.map
|
|
30
|
+
;// CONCATENATED MODULE: ../components/dist/molecules/DiscountBadge/DiscountBadge.js
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const DiscountBadge = ({ listPrice, spotPrice, thresholdLow = 15, thresholdHigh = 40, size, testId = 'fs-discount-badge', }) => {
|
|
35
|
+
const discountPercent = useDiscountPercent(listPrice, spotPrice);
|
|
36
|
+
if (discountPercent === 0) {
|
|
37
|
+
return external_react_default().createElement((external_react_default()).Fragment, null);
|
|
38
|
+
}
|
|
39
|
+
const discountVariant = discountPercent <= thresholdLow
|
|
40
|
+
? 'low'
|
|
41
|
+
: discountPercent <= thresholdHigh
|
|
42
|
+
? 'medium'
|
|
43
|
+
: 'high';
|
|
44
|
+
return (external_react_default().createElement(Badge/* default */.Z, { "data-fs-discount-badge": true, "data-fs-discount-badge-variant": discountVariant, size: size, "data-testid": testId },
|
|
45
|
+
discountPercent,
|
|
46
|
+
"% off"));
|
|
47
|
+
};
|
|
48
|
+
/* harmony default export */ const DiscountBadge_DiscountBadge = (DiscountBadge);
|
|
49
|
+
//# sourceMappingURL=DiscountBadge.js.map
|
|
50
|
+
|
|
51
|
+
/***/ }),
|
|
52
|
+
|
|
53
|
+
/***/ 783:
|
|
54
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
55
|
+
|
|
56
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
57
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
58
|
+
/* harmony export */ });
|
|
59
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
60
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
61
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5045);
|
|
62
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2765);
|
|
63
|
+
/* harmony import */ var _atoms_List__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1329);
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const Rating = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function Rating({ children, testId = 'fs-rating', length = 5, value = 0, icon, onChange, ...otherProps }, ref) {
|
|
68
|
+
const [hover, setHover] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0);
|
|
69
|
+
const outlineProps = { 'data-fs-rating-icon-outline': true };
|
|
70
|
+
const ratingIcon = react__WEBPACK_IMPORTED_MODULE_0___default().isValidElement(icon) ? icon : react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { name: "Star" });
|
|
71
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_atoms_List__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { ref: ref, "data-fs-rating": true, "data-fs-rating-actionable": typeof onChange === 'function', "data-testid": testId, ...otherProps }, Array.from({ length }).map((_, index) => {
|
|
72
|
+
const tempIndex = index + 1;
|
|
73
|
+
const fillCheck = () => {
|
|
74
|
+
if (tempIndex <= (hover || value)) {
|
|
75
|
+
return 'full';
|
|
76
|
+
}
|
|
77
|
+
if (tempIndex - value > 0 && tempIndex - value < 1) {
|
|
78
|
+
return 'partial';
|
|
79
|
+
}
|
|
80
|
+
return 'empty';
|
|
81
|
+
};
|
|
82
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", { key: `rating-${index}`, "data-fs-rating-item": fillCheck(), "data-testid": `${testId}-item` }, onChange ? (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { "data-fs-rating-button": true, icon: ratingIcon, size: "small", "aria-label": "rate", onClick: () => {
|
|
83
|
+
onChange(tempIndex);
|
|
84
|
+
}, onMouseEnter: () => setHover(tempIndex), onMouseLeave: () => setHover(value) })) : (react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null,
|
|
85
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { "data-fs-rating-icon-wrapper": true }, ratingIcon),
|
|
86
|
+
react__WEBPACK_IMPORTED_MODULE_0___default().isValidElement(icon) ? (react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(icon, outlineProps)) : (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { name: "Star", "data-fs-rating-icon-outline": true }))))));
|
|
87
|
+
})));
|
|
88
|
+
});
|
|
89
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rating);
|
|
90
|
+
//# sourceMappingURL=Rating.js.map
|
|
91
|
+
|
|
92
|
+
/***/ }),
|
|
93
|
+
|
|
94
|
+
/***/ 6475:
|
|
95
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
// EXPORTS
|
|
99
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
100
|
+
"Z": () => (/* reexport */ product_ProductCard_ProductCard)
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// EXTERNAL MODULE: external "react"
|
|
104
|
+
var external_react_ = __webpack_require__(6689);
|
|
105
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
106
|
+
;// CONCATENATED MODULE: ../components/dist/molecules/ProductCard/ProductCard.js
|
|
107
|
+
|
|
108
|
+
const ProductCard = (0,external_react_.forwardRef)(function ProductCard({ testId = 'fs-product-card', variant = 'default', bordered = false, outOfStock, children, ...otherProps }, ref) {
|
|
109
|
+
return (external_react_default().createElement("article", { ref: ref, "data-fs-product-card": outOfStock ? 'out-of-stock' : '', "data-fs-product-card-variant": variant, "data-fs-product-card-bordered": bordered, "data-testid": testId, ...otherProps }, children));
|
|
110
|
+
});
|
|
111
|
+
/* harmony default export */ const ProductCard_ProductCard = (ProductCard);
|
|
112
|
+
//# sourceMappingURL=ProductCard.js.map
|
|
113
|
+
;// CONCATENATED MODULE: ../components/dist/molecules/ProductCard/ProductCardImage.js
|
|
114
|
+
|
|
115
|
+
const ProductCardImage = (0,external_react_.forwardRef)(function ProductCardImage({ testId = 'fs-product-card-image', aspectRatio = 1, children, ...otherProps }, ref) {
|
|
116
|
+
return (external_react_default().createElement("div", { ref: ref, "data-fs-product-card-image": true, "data-testid": testId, style: {
|
|
117
|
+
'--fs-product-card-image-aspect-ratio': aspectRatio
|
|
118
|
+
}, ...otherProps }, children));
|
|
119
|
+
});
|
|
120
|
+
/* harmony default export */ const ProductCard_ProductCardImage = (ProductCardImage);
|
|
121
|
+
//# sourceMappingURL=ProductCardImage.js.map
|
|
122
|
+
// EXTERNAL MODULE: ../components/dist/atoms/Link/Link.js
|
|
123
|
+
var Link = __webpack_require__(7865);
|
|
124
|
+
// EXTERNAL MODULE: ../components/dist/atoms/Price/Price.js
|
|
125
|
+
var Price = __webpack_require__(7549);
|
|
126
|
+
// EXTERNAL MODULE: ../components/dist/molecules/Rating/Rating.js
|
|
127
|
+
var Rating = __webpack_require__(783);
|
|
128
|
+
// EXTERNAL MODULE: ../components/dist/atoms/Icon/Icon.js
|
|
129
|
+
var Icon = __webpack_require__(5045);
|
|
130
|
+
// EXTERNAL MODULE: ../components/dist/molecules/DiscountBadge/DiscountBadge.js + 1 modules
|
|
131
|
+
var DiscountBadge = __webpack_require__(9875);
|
|
132
|
+
// EXTERNAL MODULE: ../components/dist/atoms/Badge/Badge.js
|
|
133
|
+
var Badge = __webpack_require__(44);
|
|
134
|
+
// EXTERNAL MODULE: ../components/dist/atoms/Button/Button.js
|
|
135
|
+
var Button = __webpack_require__(7578);
|
|
136
|
+
;// CONCATENATED MODULE: ../components/dist/molecules/ProductCard/ProductCardContent.js
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
const ProductCardContent = (0,external_react_.forwardRef)(function CardContent({ testId = 'fs-product-card-content', title, linkProps, price, outOfStock, outOfStockLabel = 'Out of stock', ratingValue, showDiscountBadge, buttonLabel = 'Add', onButtonClick, children, ...otherProps }, ref) {
|
|
140
|
+
return (external_react_default().createElement("section", { ref: ref, "data-fs-product-card-content": true, "data-fs-product-card-badge": showDiscountBadge, "data-testid": testId, ...otherProps },
|
|
141
|
+
external_react_default().createElement("div", { "data-fs-product-card-heading": true },
|
|
142
|
+
external_react_default().createElement("h3", { "data-fs-product-card-title": true },
|
|
143
|
+
external_react_default().createElement(Link/* default */.Z, { ...linkProps, title: title }, title)),
|
|
144
|
+
external_react_default().createElement("div", { "data-fs-product-card-prices": true },
|
|
145
|
+
external_react_default().createElement(Price/* default */.Z, { value: price?.listPrice ? price.listPrice : 0, formatter: price?.formatter, testId: "list-price", "data-value": price?.listPrice, variant: "listing", SRText: "Original price:" }),
|
|
146
|
+
external_react_default().createElement(Price/* default */.Z, { value: price?.value ? price.value : 0, formatter: price?.formatter, testId: "price", "data-value": price?.value, variant: "spot", SRText: "Sale Price:" })),
|
|
147
|
+
ratingValue && external_react_default().createElement(Rating/* default */.Z, { value: ratingValue, icon: external_react_default().createElement(Icon/* default */.Z, { name: "Star" }) })),
|
|
148
|
+
showDiscountBadge && !outOfStock && (external_react_default().createElement(DiscountBadge/* default */.Z, { listPrice: price?.listPrice ? price.listPrice : 0, spotPrice: price?.value ? price.value : 0 })),
|
|
149
|
+
outOfStock && external_react_default().createElement(Badge/* default */.Z, null, outOfStockLabel),
|
|
150
|
+
onButtonClick && !outOfStock && (external_react_default().createElement("div", { "data-fs-product-card-actions": true },
|
|
151
|
+
external_react_default().createElement(Button/* default */.Z, { variant: "primary", icon: external_react_default().createElement(Icon/* default */.Z, { name: "ShoppingCart" }), iconPosition: "left", size: "small", onClick: onButtonClick }, buttonLabel)))));
|
|
152
|
+
});
|
|
153
|
+
/* harmony default export */ const ProductCard_ProductCardContent = (ProductCardContent);
|
|
154
|
+
//# sourceMappingURL=ProductCardContent.js.map
|
|
155
|
+
// EXTERNAL MODULE: ./node_modules/next/link.js
|
|
156
|
+
var next_link = __webpack_require__(1664);
|
|
157
|
+
var link_default = /*#__PURE__*/__webpack_require__.n(next_link);
|
|
158
|
+
// EXTERNAL MODULE: ./src/components/ui/Image/index.ts + 2 modules
|
|
159
|
+
var Image = __webpack_require__(9266);
|
|
160
|
+
// EXTERNAL MODULE: ./src/sdk/product/useFormattedPrice.ts
|
|
161
|
+
var useFormattedPrice = __webpack_require__(5346);
|
|
162
|
+
// EXTERNAL MODULE: ./src/sdk/product/useProductLink.ts
|
|
163
|
+
var useProductLink = __webpack_require__(9854);
|
|
164
|
+
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
165
|
+
var jsx_runtime_ = __webpack_require__(997);
|
|
166
|
+
;// CONCATENATED MODULE: ./src/components/product/ProductCard/ProductCard.tsx
|
|
167
|
+
const _excluded = ["product", "index", "bordered", "variant", "aspectRatio", "imgProps", "ratingValue", "buttonLabel", "onButtonClick", "showDiscountBadge"];
|
|
168
|
+
|
|
169
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
170
|
+
|
|
171
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
172
|
+
|
|
173
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
174
|
+
|
|
175
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
176
|
+
|
|
177
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
function ProductCard_ProductCard_ProductCard(_ref) {
|
|
189
|
+
let {
|
|
190
|
+
product,
|
|
191
|
+
index,
|
|
192
|
+
bordered = false,
|
|
193
|
+
variant = 'default',
|
|
194
|
+
aspectRatio = 1,
|
|
195
|
+
imgProps,
|
|
196
|
+
ratingValue,
|
|
197
|
+
buttonLabel = 'Add',
|
|
198
|
+
onButtonClick,
|
|
199
|
+
showDiscountBadge = true
|
|
200
|
+
} = _ref,
|
|
201
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
202
|
+
|
|
203
|
+
const {
|
|
204
|
+
sku,
|
|
205
|
+
isVariantOf: {
|
|
206
|
+
name
|
|
207
|
+
},
|
|
208
|
+
image: [img],
|
|
209
|
+
offers: {
|
|
210
|
+
lowPrice: spotPrice,
|
|
211
|
+
offers: [{
|
|
212
|
+
listPrice,
|
|
213
|
+
availability
|
|
214
|
+
}]
|
|
215
|
+
}
|
|
216
|
+
} = product;
|
|
217
|
+
|
|
218
|
+
const linkProps = _objectSpread(_objectSpread({}, (0,useProductLink/* useProductLink */.w)({
|
|
219
|
+
product,
|
|
220
|
+
selectedOffer: 0,
|
|
221
|
+
index
|
|
222
|
+
})), {}, {
|
|
223
|
+
as: (link_default()),
|
|
224
|
+
passHref: true,
|
|
225
|
+
legacyBehavior: false,
|
|
226
|
+
prefetch: false
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const outOfStock = availability !== 'https://schema.org/InStock';
|
|
230
|
+
return /*#__PURE__*/(0,jsx_runtime_.jsxs)(ProductCard_ProductCard, _objectSpread(_objectSpread({
|
|
231
|
+
outOfStock: outOfStock,
|
|
232
|
+
bordered: bordered,
|
|
233
|
+
variant: variant,
|
|
234
|
+
"data-fs-product-card-sku": sku
|
|
235
|
+
}, otherProps), {}, {
|
|
236
|
+
children: [/*#__PURE__*/jsx_runtime_.jsx(ProductCard_ProductCardImage, {
|
|
237
|
+
aspectRatio: aspectRatio,
|
|
238
|
+
children: /*#__PURE__*/jsx_runtime_.jsx(Image/* Image */.E, {
|
|
239
|
+
src: img.url,
|
|
240
|
+
alt: img.alternateName,
|
|
241
|
+
sizes: `${imgProps?.sizes ?? '(max-width: 768px) 40vw, 30vw'}`,
|
|
242
|
+
width: imgProps?.width ?? 360,
|
|
243
|
+
height: Math.round((Number(imgProps?.height) || 360) / aspectRatio),
|
|
244
|
+
loading: imgProps?.loading
|
|
245
|
+
})
|
|
246
|
+
}), /*#__PURE__*/jsx_runtime_.jsx(ProductCard_ProductCardContent, {
|
|
247
|
+
title: name,
|
|
248
|
+
price: {
|
|
249
|
+
value: spotPrice,
|
|
250
|
+
listPrice: listPrice,
|
|
251
|
+
formatter: useFormattedPrice/* useFormattedPrice */.P
|
|
252
|
+
},
|
|
253
|
+
ratingValue: ratingValue,
|
|
254
|
+
outOfStock: outOfStock,
|
|
255
|
+
onButtonClick: onButtonClick,
|
|
256
|
+
linkProps: linkProps,
|
|
257
|
+
showDiscountBadge: showDiscountBadge
|
|
258
|
+
})]
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const fragment = "unknown";
|
|
263
|
+
/* harmony default export */ const product_ProductCard_ProductCard = (/*#__PURE__*/(0,external_react_.memo)(ProductCard_ProductCard_ProductCard));
|
|
264
|
+
;// CONCATENATED MODULE: ./src/components/product/ProductCard/index.ts
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
/***/ }),
|
|
268
|
+
|
|
269
|
+
/***/ 5184:
|
|
270
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
271
|
+
|
|
272
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
273
|
+
/* harmony export */ "m": () => (/* binding */ useViewItemListEvent)
|
|
274
|
+
/* harmony export */ });
|
|
275
|
+
/* harmony import */ var _faststore_sdk__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1072);
|
|
276
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
277
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
278
|
+
/* harmony import */ var src_sdk_session__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7295);
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
const useViewItemListEvent = ({
|
|
283
|
+
products,
|
|
284
|
+
title,
|
|
285
|
+
page,
|
|
286
|
+
pageSize
|
|
287
|
+
}) => {
|
|
288
|
+
const {
|
|
289
|
+
currency: {
|
|
290
|
+
code
|
|
291
|
+
}
|
|
292
|
+
} = (0,src_sdk_session__WEBPACK_IMPORTED_MODULE_1__/* .useSession */ .kP)();
|
|
293
|
+
const sendViewItemListEvent = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => {
|
|
294
|
+
(0,_faststore_sdk__WEBPACK_IMPORTED_MODULE_2__/* .sendAnalyticsEvent */ ._)({
|
|
295
|
+
name: 'view_item_list',
|
|
296
|
+
params: {
|
|
297
|
+
item_list_name: title,
|
|
298
|
+
item_list_id: title,
|
|
299
|
+
items: products.map(({
|
|
300
|
+
node: product
|
|
301
|
+
}, index) => ({
|
|
302
|
+
item_id: product.isVariantOf.productGroupID,
|
|
303
|
+
item_name: product.isVariantOf.name,
|
|
304
|
+
item_brand: product.brand.name,
|
|
305
|
+
item_variant: product.sku,
|
|
306
|
+
price: product.offers.offers[0].price,
|
|
307
|
+
index: page * pageSize + index + 1,
|
|
308
|
+
discount: product.offers.offers[0].listPrice - product.offers.offers[0].price,
|
|
309
|
+
currency: code,
|
|
310
|
+
item_variant_name: product.name,
|
|
311
|
+
product_reference_id: product.gtin
|
|
312
|
+
}))
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
}, [code, products, title, page, pageSize]);
|
|
316
|
+
return {
|
|
317
|
+
sendViewItemListEvent
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/***/ })
|
|
322
|
+
|
|
323
|
+
};
|
|
324
|
+
;
|