@shopify/cli-hydrogen 8.4.3 → 8.4.5

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,5 +1,20 @@
1
1
  # skeleton
2
2
 
3
+ ## 2024.7.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`f3363030`](https://github.com/Shopify/hydrogen/commit/f3363030a50bd24d946427e01b88ba77253a6cc9), [`bb5b0979`](https://github.com/Shopify/hydrogen/commit/bb5b0979ddffb007111885b3a9b7aa490a3c6882)]:
8
+ - @shopify/hydrogen@2024.7.8
9
+ - @shopify/remix-oxygen@2.0.8
10
+
11
+ ## 2024.7.8
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`39f8f8fd`](https://github.com/Shopify/hydrogen/commit/39f8f8fd42766d02c6e98f8090608e641db9f002)]:
16
+ - @shopify/hydrogen@2024.7.7
17
+
3
18
  ## 2024.7.7
4
19
 
5
20
  ### Patch Changes
@@ -1,4 +1,10 @@
1
- import {createContext, type ReactNode, useContext, useState} from 'react';
1
+ import {
2
+ createContext,
3
+ type ReactNode,
4
+ useContext,
5
+ useEffect,
6
+ useState,
7
+ } from 'react';
2
8
 
3
9
  type AsideType = 'search' | 'cart' | 'mobile' | 'closed';
4
10
  type AsideContextValue = {
@@ -29,6 +35,23 @@ export function Aside({
29
35
  const {type: activeType, close} = useAside();
30
36
  const expanded = type === activeType;
31
37
 
38
+ useEffect(() => {
39
+ const abortController = new AbortController();
40
+
41
+ if (expanded) {
42
+ document.addEventListener(
43
+ 'keydown',
44
+ function handler(event: KeyboardEvent) {
45
+ if (event.key === 'Escape') {
46
+ close();
47
+ }
48
+ },
49
+ {signal: abortController.signal},
50
+ );
51
+ }
52
+ return () => abortController.abort();
53
+ }, [close, expanded]);
54
+
32
55
  return (
33
56
  <div
34
57
  aria-modal
@@ -1,6 +1,10 @@
1
1
  import {Suspense} from 'react';
2
- import {Await, NavLink} from '@remix-run/react';
3
- import {type CartViewPayload, useAnalytics} from '@shopify/hydrogen';
2
+ import {Await, NavLink, useAsyncValue} from '@remix-run/react';
3
+ import {
4
+ type CartViewPayload,
5
+ useAnalytics,
6
+ useOptimisticCart,
7
+ } from '@shopify/hydrogen';
4
8
  import type {HeaderQuery, CartApiQueryFragment} from 'storefrontapi.generated';
5
9
  import {useAside} from '~/components/Aside';
6
10
 
@@ -159,15 +163,18 @@ function CartToggle({cart}: Pick<HeaderProps, 'cart'>) {
159
163
  return (
160
164
  <Suspense fallback={<CartBadge count={null} />}>
161
165
  <Await resolve={cart}>
162
- {(cart) => {
163
- if (!cart) return <CartBadge count={0} />;
164
- return <CartBadge count={cart.totalQuantity || 0} />;
165
- }}
166
+ <CartBanner />
166
167
  </Await>
167
168
  </Suspense>
168
169
  );
169
170
  }
170
171
 
172
+ function CartBanner() {
173
+ const originalCart = useAsyncValue() as CartApiQueryFragment | null;
174
+ const cart = useOptimisticCart(originalCart);
175
+ return <CartBadge count={cart?.totalQuantity ?? 0} />;
176
+ }
177
+
171
178
  const FALLBACK_HEADER_MENU = {
172
179
  id: 'gid://shopify/Menu/199655587896',
173
180
  items: [
@@ -29,7 +29,9 @@ export async function loader({params, context}: LoaderFunctionArgs) {
29
29
 
30
30
  const lineItems = flattenConnection(order.lineItems);
31
31
  const discountApplications = flattenConnection(order.discountApplications);
32
- const fulfillmentStatus = flattenConnection(order.fulfillments)[0].status;
32
+
33
+ const fulfillmentStatus =
34
+ flattenConnection(order.fulfillments)[0]?.status ?? 'N/A';
33
35
 
34
36
  const firstDiscount = discountApplications[0]?.value;
35
37
 
@@ -2,7 +2,7 @@
2
2
  "name": "skeleton",
3
3
  "private": true,
4
4
  "sideEffects": false,
5
- "version": "2024.7.7",
5
+ "version": "2024.7.9",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "shopify hydrogen build --codegen",
@@ -16,8 +16,8 @@
16
16
  "dependencies": {
17
17
  "@remix-run/react": "^2.10.1",
18
18
  "@remix-run/server-runtime": "^2.10.1",
19
- "@shopify/hydrogen": "2024.7.6",
20
- "@shopify/remix-oxygen": "^2.0.7",
19
+ "@shopify/hydrogen": "2024.7.8",
20
+ "@shopify/remix-oxygen": "^2.0.8",
21
21
  "graphql": "^16.6.0",
22
22
  "graphql-tag": "^2.12.6",
23
23
  "isbot": "^3.8.0",
@@ -1758,5 +1758,5 @@
1758
1758
  ]
1759
1759
  }
1760
1760
  },
1761
- "version": "8.4.3"
1761
+ "version": "8.4.5"
1762
1762
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "@shopify:registry": "https://registry.npmjs.org"
6
6
  },
7
- "version": "8.4.3",
7
+ "version": "8.4.5",
8
8
  "license": "MIT",
9
9
  "type": "module",
10
10
  "scripts": {
@@ -56,7 +56,7 @@
56
56
  "@graphql-codegen/cli": "^5.0.2",
57
57
  "@remix-run/dev": "^2.1.0",
58
58
  "@shopify/hydrogen-codegen": "^0.3.1",
59
- "@shopify/mini-oxygen": "^3.0.5",
59
+ "@shopify/mini-oxygen": "^3.0.6",
60
60
  "graphql-config": "^5.0.3",
61
61
  "vite": "^5.1.0"
62
62
  },