@shopify/hydrogen 1.6.6 → 1.6.8

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.
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import { BaseButtonProps } from '../BaseButton/index.js';
3
- interface CartLineQuantityAdjustButtonProps {
3
+ interface CartLineQuantityAdjustButtonBaseProps {
4
4
  /** The adjustment for a cart line's quantity. Valid values: `increase` (default), `decrease`, or `remove`. */
5
5
  adjust?: 'increase' | 'decrease' | 'remove';
6
6
  }
7
+ declare type CartLineQuantityAdjustButtonProps<AsType extends React.ElementType = 'button'> = BaseButtonProps<AsType> & CartLineQuantityAdjustButtonBaseProps;
7
8
  /**
8
9
  * The `CartLineQuantityAdjustButton` component renders a button that adjusts the cart line's quantity when pressed.
9
10
  * It must be a descendent of a `CartLineProvider` component.
10
11
  */
11
- export declare function CartLineQuantityAdjustButton<AsType extends React.ElementType = 'button'>(props: CartLineQuantityAdjustButtonProps & BaseButtonProps<AsType>): JSX.Element;
12
+ export declare function CartLineQuantityAdjustButton<AsType extends React.ElementType = 'button'>(props: CartLineQuantityAdjustButtonProps<AsType>): JSX.Element;
12
13
  export {};
@@ -12,15 +12,32 @@ export function CartLineQuantityAdjustButton(props) {
12
12
  const { children, adjust, onClick, ...passthroughProps } = props;
13
13
  const handleAdjust = useCallback(() => {
14
14
  if (adjust === 'remove') {
15
- linesRemove([cartLine.id]);
15
+ linesRemove([cartLine?.id ?? '']);
16
16
  return;
17
17
  }
18
- const quantity = adjust === 'decrease' ? cartLine.quantity - 1 : cartLine.quantity + 1;
18
+ const quantity = adjust === 'decrease'
19
+ ? (cartLine?.quantity ?? 0) - 1
20
+ : (cartLine?.quantity ?? 0) + 1;
19
21
  if (quantity <= 0) {
20
- linesRemove([cartLine.id]);
22
+ linesRemove([cartLine?.id ?? '']);
21
23
  return;
22
24
  }
23
- linesUpdate([{ id: cartLine.id, quantity }]);
24
- }, [adjust, cartLine.id, cartLine.quantity, linesRemove, linesUpdate]);
25
- return (React.createElement(BaseButton, { disabled: status !== 'idle', onClick: onClick, defaultOnClick: handleAdjust, ...passthroughProps }, children));
25
+ const lineUpdate = {
26
+ id: cartLine?.id ?? '',
27
+ quantity,
28
+ attributes: (cartLine?.attributes ??
29
+ []),
30
+ };
31
+ linesUpdate([lineUpdate]);
32
+ }, [
33
+ adjust,
34
+ cartLine?.attributes,
35
+ cartLine?.id,
36
+ cartLine?.quantity,
37
+ linesRemove,
38
+ linesUpdate,
39
+ ]);
40
+ return (React.createElement(BaseButton, { onClick: onClick, defaultOnClick: handleAdjust, ...passthroughProps, disabled: typeof passthroughProps.disabled !== 'undefined'
41
+ ? passthroughProps.disabled
42
+ : status !== 'idle' }, children));
26
43
  }
@@ -171,7 +171,8 @@ async function processRequest(handleRequest, App, url, request, sessionApi, opti
171
171
  headers: response.headers,
172
172
  });
173
173
  }
174
- if (isBotUA(url, request.headers.get('user-agent'))) {
174
+ if (request.headers.get('oxygen-do-not-stream-response') === 'true' ||
175
+ isBotUA(url, request.headers.get('user-agent'))) {
175
176
  response.doNotStream();
176
177
  }
177
178
  return runSSR({
@@ -4,54 +4,56 @@
4
4
  * https://github.com/GoogleChrome/rendertron/blob/6f681688737846b28754fbfdf5db173846a826df/middleware/src/middleware.ts#L24-L41
5
5
  */
6
6
  const botUserAgents = [
7
- 'AdsBot-Google',
8
- 'AdsBot-Google-Mobile',
7
+ '360spider',
8
+ 'adsbot-google',
9
+ 'adsbot-google-mobile',
9
10
  'applebot',
10
- 'Baiduspider',
11
11
  'baiduspider',
12
- 'Bytespider',
13
- '360Spider',
14
- 'PetalBot',
15
- 'Yisouspider',
12
+ 'baiduspider',
13
+ 'bingbot',
16
14
  'bingbot',
17
- 'Bingbot',
18
- 'BingPreview',
15
+ 'bingpreview',
19
16
  'bitlybot',
20
- 'Discordbot',
21
- 'DuckDuckBot',
22
- 'Embedly',
17
+ 'bytespider',
18
+ 'discordbot',
19
+ 'duckduckbot',
20
+ 'embedly',
23
21
  'facebookcatalog',
24
22
  'facebookexternalhit',
25
- 'Google-PageRenderer',
26
- 'Googlebot',
27
- 'Googlebot-Image',
28
- 'Googlebot-News',
29
- 'Googlebot-Video',
23
+ 'google-inspectiontool',
24
+ 'google-pagerenderer',
25
+ 'googlebot',
26
+ 'googlebot-image',
27
+ 'googlebot-news',
28
+ 'googlebot-video',
29
+ 'googleother',
30
30
  'googleweblight',
31
31
  'ia_archive',
32
- 'LinkedInBot',
33
- 'Mediapartners-Google',
32
+ 'ia_archiver',
33
+ 'linkedinbot',
34
+ 'mediapartners-google',
34
35
  'outbrain',
36
+ 'petalbot',
35
37
  'pinterest',
36
38
  'quora link preview',
37
39
  'redditbot',
38
40
  'rogerbot',
41
+ 'seoradar',
39
42
  'showyoubot',
40
- 'SkypeUriPreview',
41
- 'Slackbot',
42
- 'Slurp',
43
+ 'skypeuripreview',
44
+ 'slackbot',
45
+ 'slurp',
43
46
  'sogou',
44
- 'Storebot-Google',
45
- 'TelegramBot',
47
+ 'storebot-google',
48
+ 'telegrambot',
46
49
  'tumblr',
47
- 'Twitterbot',
48
- 'vkShare',
49
- 'W3C_Validator',
50
- 'WhatsApp',
50
+ 'twitterbot',
51
+ 'vkshare',
52
+ 'w3c html2txt',
53
+ 'w3c_validator',
54
+ 'whatsapp',
51
55
  'yandex',
52
- // SEO Tools
53
- 'Seoradar',
54
- 'W3C html2txt',
56
+ 'yisouspider',
55
57
  ];
56
58
  /**
57
59
  * Creates a regex based on the botUserAgents array
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "1.6.6";
1
+ export declare const LIB_VERSION = "1.6.8";
@@ -1 +1 @@
1
- export const LIB_VERSION = '1.6.6';
1
+ export const LIB_VERSION = '1.6.8';
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "engines": {
8
8
  "node": ">=14"
9
9
  },
10
- "version": "1.6.6",
10
+ "version": "1.6.8",
11
11
  "description": "Modern custom Shopify storefronts",
12
12
  "license": "MIT",
13
13
  "main": "dist/esnext/index.js",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "repository": {
72
72
  "type": "git",
73
- "url": "git+https://github.com/Shopify/hydrogen.git",
73
+ "url": "git+https://github.com/Shopify/hydrogen-v1.git",
74
74
  "directory": "packages/hydrogen"
75
75
  },
76
76
  "devDependencies": {