@faststore/core 2.0.117-alpha.0 → 2.0.120-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/.turbo/turbo-build.log +38 -26
- package/CHANGELOG.md +10 -0
- package/cms/faststore/content-types.json +6 -0
- package/cms/faststore/sections.json +8 -0
- package/package.json +3 -3
- package/src/Layout.tsx +2 -24
- package/src/components/cms/GlobalSections.tsx +81 -0
- package/src/components/cms/RenderSections.tsx +39 -0
- package/src/components/common/Alert/Alert.tsx +7 -5
- package/src/components/common/Alert/index.ts +1 -0
- package/src/components/sections/Alert/Alert.tsx +28 -0
- package/src/pages/404.tsx +25 -3
- package/src/pages/500.tsx +25 -3
- package/src/pages/[...slug].tsx +85 -66
- package/src/pages/[slug]/p.tsx +16 -6
- package/src/pages/account.tsx +25 -3
- package/src/pages/checkout.tsx +25 -3
- package/src/pages/index.tsx +20 -10
- package/src/pages/login.tsx +25 -3
- package/src/pages/s.tsx +63 -39
- package/.next/BUILD_ID +0 -1
- package/.next/build-manifest.json +0 -99
- package/.next/cache/.tsbuildinfo +0 -1
- package/.next/cache/config.json +0 -7
- package/.next/cache/eslint/.cache_1gneedd +0 -1
- package/.next/cache/next-server.js.nft.json +0 -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/export-marker.json +0 -1
- package/.next/images-manifest.json +0 -1
- package/.next/next-server.js.nft.json +0 -1
- package/.next/package.json +0 -1
- package/.next/prerender-manifest.json +0 -1
- package/.next/react-loadable-manifest.json +0 -42
- package/.next/required-server-files.json +0 -1
- package/.next/routes-manifest.json +0 -1
- package/.next/server/chunks/120.js +0 -435
- package/.next/server/chunks/123.js +0 -58
- package/.next/server/chunks/1394.js +0 -3801
- package/.next/server/chunks/1597.js +0 -151
- package/.next/server/chunks/1608.js +0 -515
- package/.next/server/chunks/2154.js +0 -206
- package/.next/server/chunks/247.js +0 -61
- package/.next/server/chunks/2502.js +0 -584
- package/.next/server/chunks/2914.js +0 -95
- package/.next/server/chunks/2922.js +0 -7293
- package/.next/server/chunks/3264.js +0 -67
- package/.next/server/chunks/3431.js +0 -7241
- package/.next/server/chunks/350.js +0 -142
- package/.next/server/chunks/3746.js +0 -250
- package/.next/server/chunks/3898.js +0 -240
- package/.next/server/chunks/4312.js +0 -674
- package/.next/server/chunks/4371.js +0 -1424
- package/.next/server/chunks/5098.js +0 -124
- package/.next/server/chunks/5335.js +0 -544
- package/.next/server/chunks/5576.js +0 -79
- package/.next/server/chunks/6280.js +0 -322
- package/.next/server/chunks/6465.js +0 -91
- package/.next/server/chunks/676.js +0 -32
- package/.next/server/chunks/6859.js +0 -959
- package/.next/server/chunks/6881.js +0 -320
- package/.next/server/chunks/6898.js +0 -149
- package/.next/server/chunks/7104.js +0 -235
- package/.next/server/chunks/7181.js +0 -664
- package/.next/server/chunks/7183.js +0 -79
- package/.next/server/chunks/8098.js +0 -246
- package/.next/server/chunks/810.js +0 -432
- package/.next/server/chunks/8287.js +0 -58
- package/.next/server/chunks/9143.js +0 -106
- package/.next/server/chunks/9557.js +0 -119
- package/.next/server/chunks/9854.js +0 -72
- package/.next/server/chunks/font-manifest.json +0 -1
- package/.next/server/font-manifest.json +0 -1
- package/.next/server/middleware-build-manifest.js +0 -1
- package/.next/server/middleware-manifest.json +0 -6
- package/.next/server/middleware-react-loadable-manifest.js +0 -1
- package/.next/server/pages/404.js.nft.json +0 -1
- package/.next/server/pages/500.js.nft.json +0 -1
- package/.next/server/pages/[...slug].js +0 -666
- package/.next/server/pages/[...slug].js.nft.json +0 -1
- package/.next/server/pages/[slug]/p.js +0 -2327
- package/.next/server/pages/[slug]/p.js.nft.json +0 -1
- package/.next/server/pages/_app.js +0 -2454
- package/.next/server/pages/_app.js.nft.json +0 -1
- package/.next/server/pages/_document.js +0 -304
- package/.next/server/pages/_document.js.nft.json +0 -1
- package/.next/server/pages/_error.js +0 -164
- package/.next/server/pages/_error.js.nft.json +0 -1
- package/.next/server/pages/account.js.nft.json +0 -1
- package/.next/server/pages/api/graphql.js +0 -315
- package/.next/server/pages/api/graphql.js.nft.json +0 -1
- package/.next/server/pages/api/preview.js +0 -118
- package/.next/server/pages/api/preview.js.nft.json +0 -1
- package/.next/server/pages/checkout.js.nft.json +0 -1
- package/.next/server/pages/en-US/404.html +0 -81
- package/.next/server/pages/en-US/500.html +0 -81
- package/.next/server/pages/en-US/account.html +0 -81
- package/.next/server/pages/en-US/checkout.html +0 -81
- package/.next/server/pages/en-US/login.html +0 -81
- package/.next/server/pages/en-US/s.html +0 -81
- package/.next/server/pages/en-US.html +0 -81
- package/.next/server/pages/en-US.json +0 -1
- package/.next/server/pages/index.js +0 -475
- package/.next/server/pages/index.js.nft.json +0 -1
- package/.next/server/pages/login.js.nft.json +0 -1
- package/.next/server/pages/s.js.nft.json +0 -1
- package/.next/server/pages-manifest.json +0 -16
- package/.next/server/webpack-api-runtime.js +0 -229
- package/.next/server/webpack-runtime.js +0 -229
- package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
- package/.next/static/chunks/170.79b2f8527e327bca.js +0 -1
- package/.next/static/chunks/264-5b07911df63b8601.js +0 -1
- package/.next/static/chunks/351-a4e28d64f48c5269.js +0 -1
- package/.next/static/chunks/54.e6562383f8a1dfe7.js +0 -1
- package/.next/static/chunks/597.fc79494903e8bb84.js +0 -1
- package/.next/static/chunks/608.59e69b83f35d9c44.js +0 -1
- package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
- package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
- package/.next/static/chunks/781-e1b538e051ff4c3e.js +0 -1
- package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
- package/.next/static/chunks/996.98e590872c51f815.js +0 -1
- package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
- package/.next/static/chunks/main-9746772201fe3ac1.js +0 -1
- package/.next/static/chunks/pages/404-3637ef83b3359df7.js +0 -1
- package/.next/static/chunks/pages/500-910883c20541d9ce.js +0 -1
- package/.next/static/chunks/pages/[...slug]-29d3b81ee0953846.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-9b24055cb30ee7a8.js +0 -1
- package/.next/static/chunks/pages/_app-4aeb21d72aeea9b7.js +0 -1
- package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
- package/.next/static/chunks/pages/account-b8fc5222ffe89b60.js +0 -1
- package/.next/static/chunks/pages/checkout-f8cb7cb22225ef9d.js +0 -1
- package/.next/static/chunks/pages/index-d48285f48d2a66ea.js +0 -1
- package/.next/static/chunks/pages/login-45cc84352bac2408.js +0 -1
- package/.next/static/chunks/pages/s-ba2868e14fedb65b.js +0 -1
- package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
- package/.next/static/chunks/webpack-f725b61675603493.js +0 -1
- package/.next/static/css/1f987650dd4e39d0.css +0 -1
- package/.next/static/css/3a57acf6e411f24d.css +0 -1
- package/.next/static/css/4abccf9803c3c356.css +0 -1
- package/.next/static/css/502746c995f64cce.css +0 -1
- package/.next/static/css/6507cb48401e73a4.css +0 -1
- package/.next/static/css/6f4d3e91f1d161a8.css +0 -1
- package/.next/static/kFT8gMGQbscGgKaZLxG_K/_buildManifest.js +0 -1
- package/.next/static/kFT8gMGQbscGgKaZLxG_K/_ssgManifest.js +0 -1
- package/.next/static/media/brandless-neutral.76ddf63a.png +0 -0
- package/.next/trace +0 -64
- package/public/~partytown/debug/partytown-atomics.js +0 -556
- package/public/~partytown/debug/partytown-media.js +0 -374
- package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
- package/public/~partytown/debug/partytown-sw.js +0 -59
- package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
- package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
- package/public/~partytown/debug/partytown.js +0 -72
- package/public/~partytown/partytown-atomics.js +0 -2
- package/public/~partytown/partytown-media.js +0 -2
- package/public/~partytown/partytown-sw.js +0 -2
- package/public/~partytown/partytown.js +0 -2
- package/src/components/cms/RenderPageSections.tsx +0 -37
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 1597;
|
|
3
|
-
exports.ids = [1597];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 1597:
|
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
// ESM COMPAT FLAG
|
|
10
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11
|
-
|
|
12
|
-
// EXPORTS
|
|
13
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
14
|
-
"default": () => (/* reexport */ region_RegionModal_RegionModal)
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// EXTERNAL MODULE: external "react"
|
|
18
|
-
var external_react_ = __webpack_require__(6689);
|
|
19
|
-
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
20
|
-
// EXTERNAL MODULE: ../components/dist/molecules/Modal/Modal.js + 3 modules
|
|
21
|
-
var Modal = __webpack_require__(9600);
|
|
22
|
-
// EXTERNAL MODULE: ../components/dist/atoms/Icon/Icon.js
|
|
23
|
-
var Icon = __webpack_require__(5045);
|
|
24
|
-
// EXTERNAL MODULE: ../components/dist/molecules/IconButton/IconButton.js
|
|
25
|
-
var IconButton = __webpack_require__(2765);
|
|
26
|
-
;// CONCATENATED MODULE: ../components/dist/molecules/Modal/ModalHeader.js
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const ModalHeader = ({ onClose, title, closeBtnProps = {}, description, }) => {
|
|
31
|
-
return (external_react_default().createElement("header", { "data-fs-modal-header": true },
|
|
32
|
-
onClose && (external_react_default().createElement(IconButton/* default */.Z, { "data-fs-modal-header-close-button": true, "aria-label": "Close modal", icon: external_react_default().createElement(Icon/* default */.Z, { name: "X" }), onClick: () => onClose?.(), ...closeBtnProps })),
|
|
33
|
-
external_react_default().createElement("p", { "data-fs-modal-header-title": true }, title),
|
|
34
|
-
description && external_react_default().createElement("p", { "data-fs-modal-header-description": true }, description)));
|
|
35
|
-
};
|
|
36
|
-
/* harmony default export */ const Modal_ModalHeader = (ModalHeader);
|
|
37
|
-
//# sourceMappingURL=ModalHeader.js.map
|
|
38
|
-
;// CONCATENATED MODULE: ../components/dist/molecules/Modal/ModalBody.js
|
|
39
|
-
|
|
40
|
-
const ModalBody = ({ children, ...otherProps }) => (external_react_default().createElement("div", { "data-fs-modal-body": true, ...otherProps }, children));
|
|
41
|
-
/* harmony default export */ const Modal_ModalBody = (ModalBody);
|
|
42
|
-
//# sourceMappingURL=ModalBody.js.map
|
|
43
|
-
// EXTERNAL MODULE: ../components/dist/molecules/InputField/InputField.js
|
|
44
|
-
var InputField = __webpack_require__(8287);
|
|
45
|
-
// EXTERNAL MODULE: ../components/dist/atoms/Link/Link.js
|
|
46
|
-
var Link = __webpack_require__(7865);
|
|
47
|
-
;// CONCATENATED MODULE: ../components/dist/organisms/RegionModal/RegionModal.js
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
function RegionModal({ testId = 'fs-region-modal', title = 'Set your location', description = 'Prices, offers and availability may vary according to your location.', idkPostalCodeLinkProps, errorMessage, inputRef, inputValue, fadeOutOnSubmit, onClose, onInput, onSubmit, onClear, ...otherProps }) {
|
|
51
|
-
return (external_react_default().createElement(Modal/* default */.Z, { "data-fs-region-modal": true, testId: testId, ...otherProps }, ({ fadeOut }) => (external_react_default().createElement((external_react_default()).Fragment, null,
|
|
52
|
-
external_react_default().createElement(Modal_ModalHeader, { onClose: () => {
|
|
53
|
-
fadeOut();
|
|
54
|
-
onClose?.();
|
|
55
|
-
}, title: title, description: description, closeBtnProps: {
|
|
56
|
-
'aria-label': 'Close Region Modal',
|
|
57
|
-
} }),
|
|
58
|
-
external_react_default().createElement(Modal_ModalBody, null,
|
|
59
|
-
external_react_default().createElement(InputField/* default */.Z, { "data-fs-region-modal-input": true, id: `${testId}-input-field`, inputRef: inputRef, label: "Postal Code", actionable: true, value: inputValue, onInput: (event) => onInput?.(event), onSubmit: () => {
|
|
60
|
-
onSubmit?.();
|
|
61
|
-
fadeOutOnSubmit ? fadeOut() : null;
|
|
62
|
-
}, onClear: () => onClear?.(), error: errorMessage }),
|
|
63
|
-
external_react_default().createElement(Link/* default */.Z, { "data-fs-region-modal-link": true, ...idkPostalCodeLinkProps }, idkPostalCodeLinkProps?.children ?? (external_react_default().createElement((external_react_default()).Fragment, null,
|
|
64
|
-
"I don't know my Postal Code",
|
|
65
|
-
external_react_default().createElement(Icon/* default */.Z, { name: "ArrowSquareOut", width: 20, height: 20 })))))))));
|
|
66
|
-
}
|
|
67
|
-
/* harmony default export */ const RegionModal_RegionModal = (RegionModal);
|
|
68
|
-
//# sourceMappingURL=RegionModal.js.map
|
|
69
|
-
// EXTERNAL MODULE: ./src/sdk/session/index.ts
|
|
70
|
-
var sdk_session = __webpack_require__(5971);
|
|
71
|
-
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
72
|
-
var jsx_runtime_ = __webpack_require__(997);
|
|
73
|
-
;// CONCATENATED MODULE: ./src/components/region/RegionModal/RegionModal.tsx
|
|
74
|
-
const _excluded = ["isValidating"];
|
|
75
|
-
|
|
76
|
-
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; }
|
|
77
|
-
|
|
78
|
-
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; }
|
|
79
|
-
|
|
80
|
-
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; }
|
|
81
|
-
|
|
82
|
-
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; }
|
|
83
|
-
|
|
84
|
-
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; }
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
function RegionModal_RegionModal_RegionModal() {
|
|
92
|
-
const inputRef = (0,external_react_.useRef)(null);
|
|
93
|
-
|
|
94
|
-
const _useSession = (0,sdk_session/* useSession */.kP)(),
|
|
95
|
-
{
|
|
96
|
-
isValidating
|
|
97
|
-
} = _useSession,
|
|
98
|
-
session = _objectWithoutProperties(_useSession, _excluded);
|
|
99
|
-
|
|
100
|
-
const {
|
|
101
|
-
0: errorMessage,
|
|
102
|
-
1: setErrorMessage
|
|
103
|
-
} = (0,external_react_.useState)('');
|
|
104
|
-
const {
|
|
105
|
-
0: input,
|
|
106
|
-
1: setInput
|
|
107
|
-
} = (0,external_react_.useState)('');
|
|
108
|
-
|
|
109
|
-
const handleSubmit = async () => {
|
|
110
|
-
const postalCode = inputRef.current?.value;
|
|
111
|
-
|
|
112
|
-
if (typeof postalCode !== 'string') {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
setErrorMessage('');
|
|
117
|
-
|
|
118
|
-
try {
|
|
119
|
-
const newSession = _objectSpread(_objectSpread({}, session), {}, {
|
|
120
|
-
postalCode
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const validatedSession = await (0,sdk_session/* validateSession */.je)(newSession);
|
|
124
|
-
sdk_session/* sessionStore.set */.Qf.set(validatedSession ?? newSession);
|
|
125
|
-
} catch (error) {
|
|
126
|
-
setErrorMessage('You entered an invalid Postal Code');
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
return /*#__PURE__*/jsx_runtime_.jsx(RegionModal_RegionModal, {
|
|
131
|
-
inputRef: inputRef,
|
|
132
|
-
inputValue: input,
|
|
133
|
-
errorMessage: errorMessage,
|
|
134
|
-
onInput: e => {
|
|
135
|
-
errorMessage !== '' && setErrorMessage('');
|
|
136
|
-
setInput(e.currentTarget.value);
|
|
137
|
-
},
|
|
138
|
-
onSubmit: handleSubmit,
|
|
139
|
-
fadeOutOnSubmit: true,
|
|
140
|
-
onClear: () => setInput('')
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/* harmony default export */ const region_RegionModal_RegionModal = (RegionModal_RegionModal_RegionModal);
|
|
145
|
-
;// CONCATENATED MODULE: ./src/components/region/RegionModal/index.ts
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/***/ })
|
|
149
|
-
|
|
150
|
-
};
|
|
151
|
-
;
|
|
@@ -1,515 +0,0 @@
|
|
|
1
|
-
exports.id = 1608;
|
|
2
|
-
exports.ids = [1608];
|
|
3
|
-
exports.modules = {
|
|
4
|
-
|
|
5
|
-
/***/ 1432:
|
|
6
|
-
/***/ ((module, exports, __webpack_require__) => {
|
|
7
|
-
|
|
8
|
-
"client";
|
|
9
|
-
"use strict";
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
12
|
-
value: true
|
|
13
|
-
}));
|
|
14
|
-
exports["default"] = Image;
|
|
15
|
-
|
|
16
|
-
var _extends = (__webpack_require__(6495)/* ["default"] */ .Z);
|
|
17
|
-
|
|
18
|
-
var _interop_require_default = (__webpack_require__(2648)/* ["default"] */ .Z);
|
|
19
|
-
|
|
20
|
-
var _interop_require_wildcard = (__webpack_require__(1598)/* ["default"] */ .Z);
|
|
21
|
-
|
|
22
|
-
var _object_without_properties_loose = (__webpack_require__(7273)/* ["default"] */ .Z);
|
|
23
|
-
|
|
24
|
-
var _react = _interop_require_wildcard(__webpack_require__(6689));
|
|
25
|
-
|
|
26
|
-
var _head = _interop_require_default(__webpack_require__(5429));
|
|
27
|
-
|
|
28
|
-
var _imageBlurSvg = __webpack_require__(4486);
|
|
29
|
-
|
|
30
|
-
var _imageConfig = __webpack_require__(5843);
|
|
31
|
-
|
|
32
|
-
var _imageConfigContext = __webpack_require__(744);
|
|
33
|
-
|
|
34
|
-
var _utils = __webpack_require__(9232);
|
|
35
|
-
|
|
36
|
-
function Image(_param) {
|
|
37
|
-
var {
|
|
38
|
-
src,
|
|
39
|
-
sizes,
|
|
40
|
-
unoptimized = false,
|
|
41
|
-
priority = false,
|
|
42
|
-
loading,
|
|
43
|
-
className,
|
|
44
|
-
quality,
|
|
45
|
-
width,
|
|
46
|
-
height,
|
|
47
|
-
fill,
|
|
48
|
-
style,
|
|
49
|
-
onLoadingComplete,
|
|
50
|
-
placeholder = 'empty',
|
|
51
|
-
blurDataURL
|
|
52
|
-
} = _param,
|
|
53
|
-
all = _object_without_properties_loose(_param, ["src", "sizes", "unoptimized", "priority", "loading", "className", "quality", "width", "height", "fill", "style", "onLoadingComplete", "placeholder", "blurDataURL"]);
|
|
54
|
-
|
|
55
|
-
const configContext = (0, _react).useContext(_imageConfigContext.ImageConfigContext);
|
|
56
|
-
const config = (0, _react).useMemo(() => {
|
|
57
|
-
const c = configEnv || configContext || _imageConfig.imageConfigDefault;
|
|
58
|
-
const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b);
|
|
59
|
-
const deviceSizes = c.deviceSizes.sort((a, b) => a - b);
|
|
60
|
-
return _extends({}, c, {
|
|
61
|
-
allSizes,
|
|
62
|
-
deviceSizes
|
|
63
|
-
});
|
|
64
|
-
}, [configContext]);
|
|
65
|
-
let rest = all;
|
|
66
|
-
let loader = defaultLoader;
|
|
67
|
-
|
|
68
|
-
if ('loader' in rest) {
|
|
69
|
-
if (rest.loader) {
|
|
70
|
-
const customImageLoader = rest.loader;
|
|
71
|
-
|
|
72
|
-
var _tmp;
|
|
73
|
-
|
|
74
|
-
_tmp = obj => {
|
|
75
|
-
const {
|
|
76
|
-
config: _
|
|
77
|
-
} = obj,
|
|
78
|
-
opts = _object_without_properties_loose(obj, ["config"]); // The config object is internal only so we must
|
|
79
|
-
// not pass it to the user-defined loader()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return customImageLoader(opts);
|
|
83
|
-
}, loader = _tmp, _tmp;
|
|
84
|
-
} // Remove property so it's not spread on <img>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
delete rest.loader;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let staticSrc = '';
|
|
91
|
-
let widthInt = getInt(width);
|
|
92
|
-
let heightInt = getInt(height);
|
|
93
|
-
let blurWidth;
|
|
94
|
-
let blurHeight;
|
|
95
|
-
|
|
96
|
-
if (isStaticImport(src)) {
|
|
97
|
-
const staticImageData = isStaticRequire(src) ? src.default : src;
|
|
98
|
-
|
|
99
|
-
if (!staticImageData.src) {
|
|
100
|
-
throw new Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(staticImageData)}`);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (!staticImageData.height || !staticImageData.width) {
|
|
104
|
-
throw new Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(staticImageData)}`);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
blurWidth = staticImageData.blurWidth;
|
|
108
|
-
blurHeight = staticImageData.blurHeight;
|
|
109
|
-
blurDataURL = blurDataURL || staticImageData.blurDataURL;
|
|
110
|
-
staticSrc = staticImageData.src;
|
|
111
|
-
|
|
112
|
-
if (!fill) {
|
|
113
|
-
if (!widthInt && !heightInt) {
|
|
114
|
-
widthInt = staticImageData.width;
|
|
115
|
-
heightInt = staticImageData.height;
|
|
116
|
-
} else if (widthInt && !heightInt) {
|
|
117
|
-
const ratio = widthInt / staticImageData.width;
|
|
118
|
-
heightInt = Math.round(staticImageData.height * ratio);
|
|
119
|
-
} else if (!widthInt && heightInt) {
|
|
120
|
-
const ratio = heightInt / staticImageData.height;
|
|
121
|
-
widthInt = Math.round(staticImageData.width * ratio);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
src = typeof src === 'string' ? src : staticSrc;
|
|
127
|
-
let isLazy = !priority && (loading === 'lazy' || typeof loading === 'undefined');
|
|
128
|
-
|
|
129
|
-
if (src.startsWith('data:') || src.startsWith('blob:')) {
|
|
130
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
|
|
131
|
-
unoptimized = true;
|
|
132
|
-
isLazy = false;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (config.unoptimized) {
|
|
136
|
-
unoptimized = true;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const [blurComplete, setBlurComplete] = (0, _react).useState(false);
|
|
140
|
-
const [showAltText, setShowAltText] = (0, _react).useState(false);
|
|
141
|
-
const qualityInt = getInt(quality);
|
|
142
|
-
|
|
143
|
-
if (false) {}
|
|
144
|
-
|
|
145
|
-
const imgStyle = Object.assign(fill ? {
|
|
146
|
-
position: 'absolute',
|
|
147
|
-
height: '100%',
|
|
148
|
-
width: '100%',
|
|
149
|
-
left: 0,
|
|
150
|
-
top: 0,
|
|
151
|
-
right: 0,
|
|
152
|
-
bottom: 0
|
|
153
|
-
} : {}, showAltText ? {} : {
|
|
154
|
-
color: 'transparent'
|
|
155
|
-
}, style);
|
|
156
|
-
const blurStyle = placeholder === 'blur' && blurDataURL && !blurComplete ? {
|
|
157
|
-
backgroundSize: imgStyle.objectFit || 'cover',
|
|
158
|
-
backgroundPosition: imgStyle.objectPosition || '50% 50%',
|
|
159
|
-
backgroundRepeat: 'no-repeat',
|
|
160
|
-
backgroundImage: `url("data:image/svg+xml;charset=utf-8,${(0, _imageBlurSvg).getImageBlurSvg({
|
|
161
|
-
widthInt,
|
|
162
|
-
heightInt,
|
|
163
|
-
blurWidth,
|
|
164
|
-
blurHeight,
|
|
165
|
-
blurDataURL
|
|
166
|
-
})}")`
|
|
167
|
-
} : {};
|
|
168
|
-
|
|
169
|
-
if (false) {}
|
|
170
|
-
|
|
171
|
-
const imgAttributes = generateImgAttrs({
|
|
172
|
-
config,
|
|
173
|
-
src,
|
|
174
|
-
unoptimized,
|
|
175
|
-
width: widthInt,
|
|
176
|
-
quality: qualityInt,
|
|
177
|
-
sizes,
|
|
178
|
-
loader
|
|
179
|
-
});
|
|
180
|
-
let srcString = src;
|
|
181
|
-
|
|
182
|
-
if (false) {}
|
|
183
|
-
|
|
184
|
-
let imageSrcSetPropName = 'imagesrcset';
|
|
185
|
-
let imageSizesPropName = 'imagesizes';
|
|
186
|
-
|
|
187
|
-
if (true) {
|
|
188
|
-
imageSrcSetPropName = 'imageSrcSet';
|
|
189
|
-
imageSizesPropName = 'imageSizes';
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const linkProps = {
|
|
193
|
-
// Note: imagesrcset and imagesizes are not in the link element type with react 17.
|
|
194
|
-
[imageSrcSetPropName]: imgAttributes.srcSet,
|
|
195
|
-
[imageSizesPropName]: imgAttributes.sizes,
|
|
196
|
-
crossOrigin: rest.crossOrigin
|
|
197
|
-
};
|
|
198
|
-
const onLoadingCompleteRef = (0, _react).useRef(onLoadingComplete);
|
|
199
|
-
(0, _react).useEffect(() => {
|
|
200
|
-
onLoadingCompleteRef.current = onLoadingComplete;
|
|
201
|
-
}, [onLoadingComplete]);
|
|
202
|
-
|
|
203
|
-
const imgElementArgs = _extends({
|
|
204
|
-
isLazy,
|
|
205
|
-
imgAttributes,
|
|
206
|
-
heightInt,
|
|
207
|
-
widthInt,
|
|
208
|
-
qualityInt,
|
|
209
|
-
className,
|
|
210
|
-
imgStyle,
|
|
211
|
-
blurStyle,
|
|
212
|
-
loading,
|
|
213
|
-
config,
|
|
214
|
-
fill,
|
|
215
|
-
unoptimized,
|
|
216
|
-
placeholder,
|
|
217
|
-
loader,
|
|
218
|
-
srcString,
|
|
219
|
-
onLoadingCompleteRef,
|
|
220
|
-
setBlurComplete,
|
|
221
|
-
setShowAltText
|
|
222
|
-
}, rest);
|
|
223
|
-
|
|
224
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ImageElement, Object.assign({}, imgElementArgs)), priority ? // Note how we omit the `href` attribute, as it would only be relevant
|
|
225
|
-
// for browsers that do not support `imagesrcset`, and in those cases
|
|
226
|
-
// it would likely cause the incorrect image to be preloaded.
|
|
227
|
-
//
|
|
228
|
-
// https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset
|
|
229
|
-
|
|
230
|
-
/*#__PURE__*/
|
|
231
|
-
_react.default.createElement(_head.default, null, /*#__PURE__*/_react.default.createElement("link", Object.assign({
|
|
232
|
-
key: '__nimg-' + imgAttributes.src + imgAttributes.srcSet + imgAttributes.sizes,
|
|
233
|
-
rel: "preload",
|
|
234
|
-
as: "image",
|
|
235
|
-
href: imgAttributes.srcSet ? undefined : imgAttributes.src
|
|
236
|
-
}, linkProps))) : null);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
'client';
|
|
240
|
-
const configEnv = {"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[16,32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","dangerouslyAllowSVG":false,"unoptimized":false};
|
|
241
|
-
const allImgs = new Map();
|
|
242
|
-
let perfObserver;
|
|
243
|
-
|
|
244
|
-
if (true) {
|
|
245
|
-
global.__NEXT_IMAGE_IMPORTED = true;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const VALID_LOADING_VALUES = (/* unused pure expression or super */ null && (['lazy', 'eager', undefined]));
|
|
249
|
-
|
|
250
|
-
function isStaticRequire(src) {
|
|
251
|
-
return src.default !== undefined;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function isStaticImageData(src) {
|
|
255
|
-
return src.src !== undefined;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function isStaticImport(src) {
|
|
259
|
-
return typeof src === 'object' && (isStaticRequire(src) || isStaticImageData(src));
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function getWidths({
|
|
263
|
-
deviceSizes,
|
|
264
|
-
allSizes
|
|
265
|
-
}, width, sizes) {
|
|
266
|
-
if (sizes) {
|
|
267
|
-
// Find all the "vw" percent sizes used in the sizes prop
|
|
268
|
-
const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g;
|
|
269
|
-
const percentSizes = [];
|
|
270
|
-
|
|
271
|
-
for (let match; match = viewportWidthRe.exec(sizes); match) {
|
|
272
|
-
percentSizes.push(parseInt(match[2]));
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
if (percentSizes.length) {
|
|
276
|
-
const smallestRatio = Math.min(...percentSizes) * 0.01;
|
|
277
|
-
return {
|
|
278
|
-
widths: allSizes.filter(s => s >= deviceSizes[0] * smallestRatio),
|
|
279
|
-
kind: 'w'
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return {
|
|
284
|
-
widths: allSizes,
|
|
285
|
-
kind: 'w'
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (typeof width !== 'number') {
|
|
290
|
-
return {
|
|
291
|
-
widths: deviceSizes,
|
|
292
|
-
kind: 'w'
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
const widths = [...new Set( // > This means that most OLED screens that say they are 3x resolution,
|
|
297
|
-
// > are actually 3x in the green color, but only 1.5x in the red and
|
|
298
|
-
// > blue colors. Showing a 3x resolution image in the app vs a 2x
|
|
299
|
-
// > resolution image will be visually the same, though the 3x image
|
|
300
|
-
// > takes significantly more data. Even true 3x resolution screens are
|
|
301
|
-
// > wasteful as the human eye cannot see that level of detail without
|
|
302
|
-
// > something like a magnifying glass.
|
|
303
|
-
// https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html
|
|
304
|
-
[width, width * 2
|
|
305
|
-
/*, width * 3*/
|
|
306
|
-
].map(w => allSizes.find(p => p >= w) || allSizes[allSizes.length - 1]))];
|
|
307
|
-
return {
|
|
308
|
-
widths,
|
|
309
|
-
kind: 'x'
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function generateImgAttrs({
|
|
314
|
-
config,
|
|
315
|
-
src,
|
|
316
|
-
unoptimized,
|
|
317
|
-
width,
|
|
318
|
-
quality,
|
|
319
|
-
sizes,
|
|
320
|
-
loader
|
|
321
|
-
}) {
|
|
322
|
-
if (unoptimized) {
|
|
323
|
-
return {
|
|
324
|
-
src,
|
|
325
|
-
srcSet: undefined,
|
|
326
|
-
sizes: undefined
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const {
|
|
331
|
-
widths,
|
|
332
|
-
kind
|
|
333
|
-
} = getWidths(config, width, sizes);
|
|
334
|
-
const last = widths.length - 1;
|
|
335
|
-
return {
|
|
336
|
-
sizes: !sizes && kind === 'w' ? '100vw' : sizes,
|
|
337
|
-
srcSet: widths.map((w, i) => `${loader({
|
|
338
|
-
config,
|
|
339
|
-
src,
|
|
340
|
-
quality,
|
|
341
|
-
width: w
|
|
342
|
-
})} ${kind === 'w' ? w : i + 1}${kind}`).join(', '),
|
|
343
|
-
// It's intended to keep `src` the last attribute because React updates
|
|
344
|
-
// attributes in order. If we keep `src` the first one, Safari will
|
|
345
|
-
// immediately start to fetch `src`, before `sizes` and `srcSet` are even
|
|
346
|
-
// updated by React. That causes multiple unnecessary requests if `srcSet`
|
|
347
|
-
// and `sizes` are defined.
|
|
348
|
-
// This bug cannot be reproduced in Chrome or Firefox.
|
|
349
|
-
src: loader({
|
|
350
|
-
config,
|
|
351
|
-
src,
|
|
352
|
-
quality,
|
|
353
|
-
width: widths[last]
|
|
354
|
-
})
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
function getInt(x) {
|
|
359
|
-
if (typeof x === 'number' || typeof x === 'undefined') {
|
|
360
|
-
return x;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
if (typeof x === 'string' && /^[0-9]+$/.test(x)) {
|
|
364
|
-
return parseInt(x, 10);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return NaN;
|
|
368
|
-
} // See https://stackoverflow.com/q/39777833/266535 for why we use this ref
|
|
369
|
-
// handler instead of the img's onLoad attribute.
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
function handleLoading(img, src, placeholder, onLoadingCompleteRef, setBlurComplete) {
|
|
373
|
-
if (!img || img['data-loaded-src'] === src) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
img['data-loaded-src'] = src;
|
|
378
|
-
const p = 'decode' in img ? img.decode() : Promise.resolve();
|
|
379
|
-
p.catch(() => {}).then(() => {
|
|
380
|
-
if (!img.parentNode) {
|
|
381
|
-
// Exit early in case of race condition:
|
|
382
|
-
// - onload() is called
|
|
383
|
-
// - decode() is called but incomplete
|
|
384
|
-
// - unmount is called
|
|
385
|
-
// - decode() completes
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (placeholder === 'blur') {
|
|
390
|
-
setBlurComplete(true);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (onLoadingCompleteRef == null ? void 0 : onLoadingCompleteRef.current) {
|
|
394
|
-
onLoadingCompleteRef.current(img);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
if (false) {}
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
const ImageElement = _param => {
|
|
402
|
-
var {
|
|
403
|
-
imgAttributes,
|
|
404
|
-
heightInt,
|
|
405
|
-
widthInt,
|
|
406
|
-
qualityInt,
|
|
407
|
-
className,
|
|
408
|
-
imgStyle,
|
|
409
|
-
blurStyle,
|
|
410
|
-
isLazy,
|
|
411
|
-
fill,
|
|
412
|
-
placeholder,
|
|
413
|
-
loading,
|
|
414
|
-
srcString,
|
|
415
|
-
config,
|
|
416
|
-
unoptimized,
|
|
417
|
-
loader,
|
|
418
|
-
onLoadingCompleteRef,
|
|
419
|
-
setBlurComplete,
|
|
420
|
-
setShowAltText,
|
|
421
|
-
onLoad,
|
|
422
|
-
onError
|
|
423
|
-
} = _param,
|
|
424
|
-
rest = _object_without_properties_loose(_param, ["imgAttributes", "heightInt", "widthInt", "qualityInt", "className", "imgStyle", "blurStyle", "isLazy", "fill", "placeholder", "loading", "srcString", "config", "unoptimized", "loader", "onLoadingCompleteRef", "setBlurComplete", "setShowAltText", "onLoad", "onError"]);
|
|
425
|
-
|
|
426
|
-
loading = isLazy ? 'lazy' : loading;
|
|
427
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("img", Object.assign({}, rest, imgAttributes, {
|
|
428
|
-
width: widthInt,
|
|
429
|
-
height: heightInt,
|
|
430
|
-
decoding: "async",
|
|
431
|
-
"data-nimg": `future${fill ? '-fill' : ''}`,
|
|
432
|
-
className: className,
|
|
433
|
-
// @ts-ignore - TODO: upgrade to `@types/react@17`
|
|
434
|
-
loading: loading,
|
|
435
|
-
style: _extends({}, imgStyle, blurStyle),
|
|
436
|
-
ref: (0, _react).useCallback(img => {
|
|
437
|
-
if (!img) {
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
if (onError) {
|
|
442
|
-
// If the image has an error before react hydrates, then the error is lost.
|
|
443
|
-
// The workaround is to wait until the image is mounted which is after hydration,
|
|
444
|
-
// then we set the src again to trigger the error handler (if there was an error).
|
|
445
|
-
// eslint-disable-next-line no-self-assign
|
|
446
|
-
img.src = img.src;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if (false) {}
|
|
450
|
-
|
|
451
|
-
if (img.complete) {
|
|
452
|
-
handleLoading(img, srcString, placeholder, onLoadingCompleteRef, setBlurComplete);
|
|
453
|
-
}
|
|
454
|
-
}, [srcString, placeholder, onLoadingCompleteRef, setBlurComplete, onError]),
|
|
455
|
-
onLoad: event => {
|
|
456
|
-
const img = event.currentTarget;
|
|
457
|
-
handleLoading(img, srcString, placeholder, onLoadingCompleteRef, setBlurComplete);
|
|
458
|
-
|
|
459
|
-
if (onLoad) {
|
|
460
|
-
onLoad(event);
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
onError: event => {
|
|
464
|
-
// if the real image fails to load, this will ensure "alt" is visible
|
|
465
|
-
setShowAltText(true);
|
|
466
|
-
|
|
467
|
-
if (placeholder === 'blur') {
|
|
468
|
-
// If the real image fails to load, this will still remove the placeholder.
|
|
469
|
-
setBlurComplete(true);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (onError) {
|
|
473
|
-
onError(event);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
})));
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
function defaultLoader({
|
|
480
|
-
config,
|
|
481
|
-
src,
|
|
482
|
-
width,
|
|
483
|
-
quality
|
|
484
|
-
}) {
|
|
485
|
-
if (false) {}
|
|
486
|
-
|
|
487
|
-
if (src.endsWith('.svg') && !config.dangerouslyAllowSVG) {
|
|
488
|
-
// Special case to make svg serve as-is to avoid proxying
|
|
489
|
-
// through the built-in Image Optimization API.
|
|
490
|
-
return src;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
return `${config.path}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
497
|
-
Object.defineProperty(exports.default, '__esModule', {
|
|
498
|
-
value: true
|
|
499
|
-
});
|
|
500
|
-
Object.assign(exports.default, exports);
|
|
501
|
-
module.exports = exports.default;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/***/ }),
|
|
505
|
-
|
|
506
|
-
/***/ 1608:
|
|
507
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
508
|
-
|
|
509
|
-
module.exports = __webpack_require__(1432)
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
/***/ })
|
|
513
|
-
|
|
514
|
-
};
|
|
515
|
-
;
|