@faststore/core 2.0.83-alpha.0 → 2.0.87-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.
Files changed (166) hide show
  1. package/.turbo/turbo-build.log +6 -7
  2. package/CHANGELOG.md +12 -0
  3. package/package.json +4 -4
  4. package/src/Layout.tsx +2 -2
  5. package/src/components/common/Toast/Toast.tsx +2 -4
  6. package/src/components/sections/Newsletter/Newsletter.tsx +5 -5
  7. package/src/components/sections/ProductDetails/ProductDetails.tsx +7 -5
  8. package/src/components/sections/ProductDetails/product-details.module.scss +0 -5
  9. package/src/components/ui/SkuSelector/Selectors.stories.mdx +5 -1
  10. package/src/components/ui/SkuSelector/Selectors.tsx +40 -54
  11. package/src/components/ui/SkuSelector/index.ts +0 -2
  12. package/src/sdk/cart/index.ts +2 -2
  13. package/.next/BUILD_ID +0 -1
  14. package/.next/build-manifest.json +0 -103
  15. package/.next/cache/.tsbuildinfo +0 -1
  16. package/.next/cache/config.json +0 -7
  17. package/.next/cache/eslint/.cache_1gneedd +0 -1
  18. package/.next/cache/next-server.js.nft.json +0 -1
  19. package/.next/cache/webpack/client-production/0.pack +0 -0
  20. package/.next/cache/webpack/client-production/index.pack +0 -0
  21. package/.next/cache/webpack/server-production/0.pack +0 -0
  22. package/.next/cache/webpack/server-production/index.pack +0 -0
  23. package/.next/export-marker.json +0 -1
  24. package/.next/images-manifest.json +0 -1
  25. package/.next/next-server.js.nft.json +0 -1
  26. package/.next/package.json +0 -1
  27. package/.next/prerender-manifest.json +0 -1
  28. package/.next/react-loadable-manifest.json +0 -52
  29. package/.next/required-server-files.json +0 -1
  30. package/.next/routes-manifest.json +0 -1
  31. package/.next/server/chunks/1317.js +0 -125
  32. package/.next/server/chunks/1394.js +0 -3801
  33. package/.next/server/chunks/1444.js +0 -464
  34. package/.next/server/chunks/1608.js +0 -515
  35. package/.next/server/chunks/2154.js +0 -206
  36. package/.next/server/chunks/2439.js +0 -175
  37. package/.next/server/chunks/247.js +0 -61
  38. package/.next/server/chunks/2914.js +0 -96
  39. package/.next/server/chunks/3264.js +0 -67
  40. package/.next/server/chunks/350.js +0 -120
  41. package/.next/server/chunks/3746.js +0 -237
  42. package/.next/server/chunks/3898.js +0 -240
  43. package/.next/server/chunks/4312.js +0 -712
  44. package/.next/server/chunks/4371.js +0 -1467
  45. package/.next/server/chunks/4849.js +0 -664
  46. package/.next/server/chunks/5098.js +0 -124
  47. package/.next/server/chunks/5576.js +0 -72
  48. package/.next/server/chunks/6280.js +0 -417
  49. package/.next/server/chunks/6307.js +0 -109
  50. package/.next/server/chunks/6465.js +0 -91
  51. package/.next/server/chunks/650.js +0 -216
  52. package/.next/server/chunks/676.js +0 -32
  53. package/.next/server/chunks/6859.js +0 -959
  54. package/.next/server/chunks/6881.js +0 -320
  55. package/.next/server/chunks/7104.js +0 -196
  56. package/.next/server/chunks/7183.js +0 -72
  57. package/.next/server/chunks/7377.js +0 -82
  58. package/.next/server/chunks/7732.js +0 -51
  59. package/.next/server/chunks/7992.js +0 -562
  60. package/.next/server/chunks/8098.js +0 -266
  61. package/.next/server/chunks/8287.js +0 -79
  62. package/.next/server/chunks/8872.js +0 -378
  63. package/.next/server/chunks/9143.js +0 -106
  64. package/.next/server/chunks/953.js +0 -674
  65. package/.next/server/chunks/9854.js +0 -72
  66. package/.next/server/chunks/font-manifest.json +0 -1
  67. package/.next/server/font-manifest.json +0 -1
  68. package/.next/server/middleware-build-manifest.js +0 -1
  69. package/.next/server/middleware-manifest.json +0 -6
  70. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  71. package/.next/server/pages/404.js.nft.json +0 -1
  72. package/.next/server/pages/500.js.nft.json +0 -1
  73. package/.next/server/pages/[...slug].js +0 -633
  74. package/.next/server/pages/[...slug].js.nft.json +0 -1
  75. package/.next/server/pages/[slug]/p.js +0 -2586
  76. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  77. package/.next/server/pages/_app.js +0 -2082
  78. package/.next/server/pages/_app.js.nft.json +0 -1
  79. package/.next/server/pages/_document.js +0 -304
  80. package/.next/server/pages/_document.js.nft.json +0 -1
  81. package/.next/server/pages/_error.js +0 -164
  82. package/.next/server/pages/_error.js.nft.json +0 -1
  83. package/.next/server/pages/account.js.nft.json +0 -1
  84. package/.next/server/pages/api/graphql.js +0 -259
  85. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  86. package/.next/server/pages/api/preview.js +0 -118
  87. package/.next/server/pages/api/preview.js.nft.json +0 -1
  88. package/.next/server/pages/checkout.js.nft.json +0 -1
  89. package/.next/server/pages/en-US/404.html +0 -81
  90. package/.next/server/pages/en-US/500.html +0 -81
  91. package/.next/server/pages/en-US/account.html +0 -81
  92. package/.next/server/pages/en-US/checkout.html +0 -81
  93. package/.next/server/pages/en-US/login.html +0 -81
  94. package/.next/server/pages/en-US/s.html +0 -81
  95. package/.next/server/pages/en-US.html +0 -81
  96. package/.next/server/pages/en-US.json +0 -1
  97. package/.next/server/pages/index.js +0 -428
  98. package/.next/server/pages/index.js.nft.json +0 -1
  99. package/.next/server/pages/login.js.nft.json +0 -1
  100. package/.next/server/pages/s.js.nft.json +0 -1
  101. package/.next/server/pages-manifest.json +0 -16
  102. package/.next/server/webpack-api-runtime.js +0 -229
  103. package/.next/server/webpack-runtime.js +0 -229
  104. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  105. package/.next/static/chunks/153-a20e3f2da180607e.js +0 -1
  106. package/.next/static/chunks/29.8b3dad75b915d222.js +0 -1
  107. package/.next/static/chunks/307.10facde65af3066a.js +0 -1
  108. package/.next/static/chunks/337-cf283e91e431869b.js +0 -1
  109. package/.next/static/chunks/351-a4e28d64f48c5269.js +0 -1
  110. package/.next/static/chunks/380-efd3541ef85300d5.js +0 -1
  111. package/.next/static/chunks/608.59e69b83f35d9c44.js +0 -1
  112. package/.next/static/chunks/650.807852d1c36bfe44.js +0 -1
  113. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  114. package/.next/static/chunks/686.41582b9e75eaba89.js +0 -1
  115. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  116. package/.next/static/chunks/817-f2821b9a40663949.js +0 -1
  117. package/.next/static/chunks/843.fab5a00e170b4f11.js +0 -1
  118. package/.next/static/chunks/909.787de82e0ed9eea3.js +0 -1
  119. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  120. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  121. package/.next/static/chunks/main-9746772201fe3ac1.js +0 -1
  122. package/.next/static/chunks/pages/404-ba608a2a9f0c420a.js +0 -1
  123. package/.next/static/chunks/pages/500-910883c20541d9ce.js +0 -1
  124. package/.next/static/chunks/pages/[...slug]-51896262f6760bf1.js +0 -1
  125. package/.next/static/chunks/pages/[slug]/p-08c1f443f7d84d0d.js +0 -1
  126. package/.next/static/chunks/pages/_app-81a4a14c7f15c641.js +0 -1
  127. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  128. package/.next/static/chunks/pages/account-f19102933e6fd84c.js +0 -1
  129. package/.next/static/chunks/pages/checkout-f8cb7cb22225ef9d.js +0 -1
  130. package/.next/static/chunks/pages/index-912d65fde37706bb.js +0 -1
  131. package/.next/static/chunks/pages/login-0b9ea80d9fa0f91b.js +0 -1
  132. package/.next/static/chunks/pages/s-86fe1e3303388123.js +0 -1
  133. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  134. package/.next/static/chunks/webpack-1352532ac51c6a2d.js +0 -1
  135. package/.next/static/css/430b8cafbf7c23c1.css +0 -1
  136. package/.next/static/css/43d61b402f41569b.css +0 -1
  137. package/.next/static/css/4d7e7f156483493d.css +0 -1
  138. package/.next/static/css/6507cb48401e73a4.css +0 -1
  139. package/.next/static/css/9dd1d1084d254c66.css +0 -1
  140. package/.next/static/css/9e7c9877b9f78c63.css +0 -1
  141. package/.next/static/css/9e8d9784094a047f.css +0 -1
  142. package/.next/static/css/b2f16bd4b93e0aca.css +0 -1
  143. package/.next/static/css/bd743407c8049677.css +0 -1
  144. package/.next/static/dh7cD3fiozdMG3HhpxK6m/_buildManifest.js +0 -1
  145. package/.next/static/dh7cD3fiozdMG3HhpxK6m/_ssgManifest.js +0 -1
  146. package/.next/static/media/brandless-neutral.76ddf63a.png +0 -0
  147. package/.next/trace +0 -65
  148. package/public/~partytown/debug/partytown-atomics.js +0 -556
  149. package/public/~partytown/debug/partytown-media.js +0 -374
  150. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  151. package/public/~partytown/debug/partytown-sw.js +0 -59
  152. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  153. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  154. package/public/~partytown/debug/partytown.js +0 -72
  155. package/public/~partytown/partytown-atomics.js +0 -2
  156. package/public/~partytown/partytown-media.js +0 -2
  157. package/public/~partytown/partytown-sw.js +0 -2
  158. package/public/~partytown/partytown.js +0 -2
  159. package/src/components/ui/SkuSelector/SkuSelector.stories.mdx +0 -345
  160. package/src/components/ui/SkuSelector/SkuSelector.tsx +0 -46
  161. package/src/components/ui/SkuSelector/sku-selector.module.scss +0 -172
  162. package/src/components/ui/SkuSelector/skuVariants.ts +0 -59
  163. package/src/components/ui/Toast/Toast.stories.mdx +0 -158
  164. package/src/components/ui/Toast/Toast.tsx +0 -56
  165. package/src/components/ui/Toast/index.ts +0 -1
  166. package/src/components/ui/Toast/toast.module.scss +0 -112
@@ -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
- ;