@shopify/create-hydrogen 5.0.7 → 5.0.9
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/dist/assets/hydrogen/starter/CHANGELOG.md +19 -0
- package/dist/assets/hydrogen/starter/app/components/Aside.tsx +24 -1
- package/dist/assets/hydrogen/starter/app/components/Header.tsx +13 -6
- package/dist/assets/hydrogen/starter/app/components/PageLayout.tsx +5 -3
- package/dist/assets/hydrogen/starter/app/components/SearchResultsPredictive.tsx +10 -25
- package/dist/assets/hydrogen/starter/app/routes/account.orders.$id.tsx +3 -1
- package/dist/assets/hydrogen/starter/package.json +4 -4
- package/dist/{chunk-HGHOTTBR.js → chunk-62RC26N6.js} +1095 -491
- package/dist/create-app.js +595 -1207
- package/dist/error-handler-RS6Q2YZE.js +2 -0
- package/package.json +1 -1
- package/dist/error-handler-OF6UOEFG.js +0 -2
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# skeleton
|
|
2
2
|
|
|
3
|
+
## 2024.7.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Use HTML datalist element for query suggestions for autocomplete experience ([#2506](https://github.com/Shopify/hydrogen/pull/2506)) by [@frontsideair](https://github.com/frontsideair)
|
|
8
|
+
|
|
9
|
+
- Bump cli packages version ([#2592](https://github.com/Shopify/hydrogen/pull/2592)) by [@wizardlyhel](https://github.com/wizardlyhel)
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`e963389d`](https://github.com/Shopify/hydrogen/commit/e963389d011b1cb44e2874fa332dc355c0d38eb9), [`d08d8c37`](https://github.com/Shopify/hydrogen/commit/d08d8c3779564cc55749f24bed1f6a2958a0a865)]:
|
|
12
|
+
- @shopify/hydrogen@2024.7.9
|
|
13
|
+
|
|
14
|
+
## 2024.7.9
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`f3363030`](https://github.com/Shopify/hydrogen/commit/f3363030a50bd24d946427e01b88ba77253a6cc9), [`bb5b0979`](https://github.com/Shopify/hydrogen/commit/bb5b0979ddffb007111885b3a9b7aa490a3c6882)]:
|
|
19
|
+
- @shopify/hydrogen@2024.7.8
|
|
20
|
+
- @shopify/remix-oxygen@2.0.8
|
|
21
|
+
|
|
3
22
|
## 2024.7.8
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
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
|
-
|
|
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: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Await, Link} from '@remix-run/react';
|
|
2
|
-
import {Suspense} from 'react';
|
|
2
|
+
import {Suspense, useId} from 'react';
|
|
3
3
|
import type {
|
|
4
4
|
CartApiQueryFragment,
|
|
5
5
|
FooterQuery,
|
|
@@ -70,6 +70,7 @@ function CartAside({cart}: {cart: PageLayoutProps['cart']}) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
function SearchAside() {
|
|
73
|
+
const queriesDatalistId = useId();
|
|
73
74
|
return (
|
|
74
75
|
<Aside type="search" heading="SEARCH">
|
|
75
76
|
<div className="predictive-search">
|
|
@@ -84,6 +85,7 @@ function SearchAside() {
|
|
|
84
85
|
placeholder="Search"
|
|
85
86
|
ref={inputRef}
|
|
86
87
|
type="search"
|
|
88
|
+
list={queriesDatalistId}
|
|
87
89
|
/>
|
|
88
90
|
|
|
89
91
|
<button onClick={goToSearch}>Search</button>
|
|
@@ -92,7 +94,7 @@ function SearchAside() {
|
|
|
92
94
|
</SearchFormPredictive>
|
|
93
95
|
|
|
94
96
|
<SearchResultsPredictive>
|
|
95
|
-
{({items, total, term, state,
|
|
97
|
+
{({items, total, term, state, closeSearch}) => {
|
|
96
98
|
const {articles, collections, pages, products, queries} = items;
|
|
97
99
|
|
|
98
100
|
if (state === 'loading' && term.current) {
|
|
@@ -107,7 +109,7 @@ function SearchAside() {
|
|
|
107
109
|
<>
|
|
108
110
|
<SearchResultsPredictive.Queries
|
|
109
111
|
queries={queries}
|
|
110
|
-
|
|
112
|
+
queriesDatalistId={queriesDatalistId}
|
|
111
113
|
/>
|
|
112
114
|
<SearchResultsPredictive.Products
|
|
113
115
|
products={products}
|
|
@@ -244,35 +244,20 @@ function SearchResultsPredictiveProducts({
|
|
|
244
244
|
|
|
245
245
|
function SearchResultsPredictiveQueries({
|
|
246
246
|
queries,
|
|
247
|
-
|
|
248
|
-
}: PartialPredictiveSearchResult<'queries',
|
|
247
|
+
queriesDatalistId,
|
|
248
|
+
}: PartialPredictiveSearchResult<'queries', never> & {
|
|
249
|
+
queriesDatalistId: string;
|
|
250
|
+
}) {
|
|
249
251
|
if (!queries.length) return null;
|
|
250
252
|
|
|
251
253
|
return (
|
|
252
|
-
<
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
{queries.map((suggestion) => {
|
|
256
|
-
if (!suggestion) return null;
|
|
254
|
+
<datalist id={queriesDatalistId}>
|
|
255
|
+
{queries.map((suggestion) => {
|
|
256
|
+
if (!suggestion) return null;
|
|
257
257
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
role="presentation"
|
|
262
|
-
onClick={() => {
|
|
263
|
-
if (!inputRef.current) return;
|
|
264
|
-
inputRef.current.value = suggestion.text;
|
|
265
|
-
inputRef.current.focus();
|
|
266
|
-
}}
|
|
267
|
-
dangerouslySetInnerHTML={{
|
|
268
|
-
__html: suggestion?.styledText,
|
|
269
|
-
}}
|
|
270
|
-
/>
|
|
271
|
-
</li>
|
|
272
|
-
);
|
|
273
|
-
})}
|
|
274
|
-
</ul>
|
|
275
|
-
</div>
|
|
258
|
+
return <option key={suggestion.text} value={suggestion.text} />;
|
|
259
|
+
})}
|
|
260
|
+
</datalist>
|
|
276
261
|
);
|
|
277
262
|
}
|
|
278
263
|
|
|
@@ -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
|
-
|
|
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.
|
|
5
|
+
"version": "2024.7.10",
|
|
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.
|
|
20
|
-
"@shopify/remix-oxygen": "^2.0.
|
|
19
|
+
"@shopify/hydrogen": "2024.7.9",
|
|
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",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@graphql-codegen/cli": "5.0.2",
|
|
29
29
|
"@remix-run/dev": "^2.10.1",
|
|
30
30
|
"@remix-run/eslint-config": "^2.10.1",
|
|
31
|
-
"@shopify/cli": "~3.
|
|
31
|
+
"@shopify/cli": "~3.68.0",
|
|
32
32
|
"@shopify/hydrogen-codegen": "^0.3.1",
|
|
33
33
|
"@shopify/mini-oxygen": "^3.0.5",
|
|
34
34
|
"@shopify/oxygen-workers-types": "^4.1.2",
|