@shopify/create-hydrogen 5.0.23 → 5.0.25

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 (103) hide show
  1. package/dist/assets/hydrogen/bundle/analyzer.html +155 -148
  2. package/dist/assets/hydrogen/starter/.cursor/rules/hydrogen-react-router.mdc +5 -3
  3. package/dist/assets/hydrogen/starter/CHANGELOG.md +97 -9
  4. package/dist/assets/hydrogen/starter/app/components/AddToCartButton.tsx +1 -1
  5. package/dist/assets/hydrogen/starter/app/components/CartLineItem.tsx +1 -1
  6. package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +1 -1
  7. package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +62 -29
  8. package/dist/assets/hydrogen/starter/app/components/Header.tsx +1 -1
  9. package/dist/assets/hydrogen/starter/app/components/PageLayout.tsx +1 -1
  10. package/dist/assets/hydrogen/starter/app/components/ProductForm.tsx +2 -2
  11. package/dist/assets/hydrogen/starter/app/components/SearchForm.tsx +1 -1
  12. package/dist/assets/hydrogen/starter/app/components/SearchFormPredictive.tsx +8 -3
  13. package/dist/assets/hydrogen/starter/app/components/SearchResults.tsx +3 -11
  14. package/dist/assets/hydrogen/starter/app/components/SearchResultsPredictive.tsx +2 -6
  15. package/dist/assets/hydrogen/starter/app/entry.client.tsx +10 -2
  16. package/dist/assets/hydrogen/starter/app/entry.server.tsx +5 -3
  17. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerAddressMutations.ts +7 -4
  18. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerDetailsQuery.ts +1 -1
  19. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerOrderQuery.ts +4 -1
  20. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerOrdersQuery.ts +10 -5
  21. package/dist/assets/hydrogen/starter/app/graphql/customer-account/CustomerUpdateMutation.ts +3 -2
  22. package/dist/assets/hydrogen/starter/app/lib/context.ts +34 -17
  23. package/dist/assets/hydrogen/starter/app/lib/fragments.ts +1 -0
  24. package/dist/assets/hydrogen/starter/app/lib/orderFilters.ts +90 -0
  25. package/dist/assets/hydrogen/starter/app/lib/redirect.ts +1 -1
  26. package/dist/assets/hydrogen/starter/app/lib/session.ts +1 -1
  27. package/dist/assets/hydrogen/starter/app/lib/variants.ts +1 -1
  28. package/dist/assets/hydrogen/starter/app/root.tsx +23 -18
  29. package/dist/assets/hydrogen/starter/app/routes/$.tsx +2 -2
  30. package/dist/assets/hydrogen/starter/app/routes/[robots.txt].tsx +2 -2
  31. package/dist/assets/hydrogen/starter/app/routes/[sitemap.xml].tsx +2 -3
  32. package/dist/assets/hydrogen/starter/app/routes/_index.tsx +12 -8
  33. package/dist/assets/hydrogen/starter/app/routes/account.$.tsx +4 -3
  34. package/dist/assets/hydrogen/starter/app/routes/account._index.tsx +1 -1
  35. package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +15 -11
  36. package/dist/assets/hydrogen/starter/app/routes/account.orders.$id.tsx +47 -22
  37. package/dist/assets/hydrogen/starter/app/routes/account.orders._index.tsx +152 -23
  38. package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +11 -8
  39. package/dist/assets/hydrogen/starter/app/routes/account.tsx +16 -4
  40. package/dist/assets/hydrogen/starter/app/routes/account_.authorize.tsx +2 -2
  41. package/dist/assets/hydrogen/starter/app/routes/account_.login.tsx +5 -3
  42. package/dist/assets/hydrogen/starter/app/routes/account_.logout.tsx +3 -2
  43. package/dist/assets/hydrogen/starter/app/routes/api.$version.[graphql.json].tsx +2 -2
  44. package/dist/assets/hydrogen/starter/app/routes/blogs.$blogHandle.$articleHandle.tsx +6 -10
  45. package/dist/assets/hydrogen/starter/app/routes/blogs.$blogHandle._index.tsx +10 -7
  46. package/dist/assets/hydrogen/starter/app/routes/blogs._index.tsx +13 -7
  47. package/dist/assets/hydrogen/starter/app/routes/cart.$lines.tsx +3 -2
  48. package/dist/assets/hydrogen/starter/app/routes/cart.tsx +13 -9
  49. package/dist/assets/hydrogen/starter/app/routes/collections.$handle.tsx +8 -11
  50. package/dist/assets/hydrogen/starter/app/routes/collections._index.tsx +6 -6
  51. package/dist/assets/hydrogen/starter/app/routes/collections.all.tsx +10 -7
  52. package/dist/assets/hydrogen/starter/app/routes/discount.$code.tsx +3 -2
  53. package/dist/assets/hydrogen/starter/app/routes/pages.$handle.tsx +8 -6
  54. package/dist/assets/hydrogen/starter/app/routes/policies.$handle.tsx +7 -4
  55. package/dist/assets/hydrogen/starter/app/routes/policies._index.tsx +19 -13
  56. package/dist/assets/hydrogen/starter/app/routes/products.$handle.tsx +9 -6
  57. package/dist/assets/hydrogen/starter/app/routes/search.tsx +14 -14
  58. package/dist/assets/hydrogen/starter/app/routes/sitemap.$type.$page[.xml].tsx +2 -3
  59. package/dist/assets/hydrogen/starter/app/routes.ts +1 -1
  60. package/dist/assets/hydrogen/starter/app/styles/app.css +53 -1
  61. package/dist/assets/hydrogen/starter/customer-accountapi.generated.d.ts +47 -13
  62. package/dist/assets/hydrogen/starter/env.d.ts +1 -39
  63. package/dist/assets/hydrogen/starter/eslint.config.js +35 -52
  64. package/dist/assets/hydrogen/starter/package.json +14 -15
  65. package/dist/assets/hydrogen/starter/react-router.config.ts +9 -3
  66. package/dist/assets/hydrogen/starter/server.ts +7 -7
  67. package/dist/assets/hydrogen/starter/storefrontapi.generated.d.ts +1 -1
  68. package/dist/assets/hydrogen/starter/tsconfig.json +17 -13
  69. package/dist/assets/hydrogen/starter/vite.config.ts +4 -1
  70. package/dist/assets/hydrogen/virtual-routes/components/RequestDetails.jsx +13 -20
  71. package/dist/assets/hydrogen/virtual-routes/routes/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.jsx +37 -0
  72. package/dist/chunk-2LZQLWDR.js +1189 -0
  73. package/dist/{chunk-EO6F7WJJ.js → chunk-6YUUFKYO.js} +1 -1
  74. package/dist/chunk-AUULK6IN.js +5 -0
  75. package/dist/chunk-CJKPLQJ7.js +51 -0
  76. package/dist/{chunk-MNT4XW23.js → chunk-LBUW5UHX.js} +1 -1
  77. package/dist/chunk-RUCJI22O.js +3 -0
  78. package/dist/{chunk-PMDMUCNY.js → chunk-VXJIQGAB.js} +1 -1
  79. package/dist/chunk-Y5VZE2FH.js +32 -0
  80. package/dist/chunk-ZLNTSIDN.js +2 -0
  81. package/dist/create-app.js +293 -288
  82. package/dist/{del-72VO4HYK.js → del-VDYQZFAQ.js} +1 -1
  83. package/dist/devtools-3BYEW2L2.js +8 -0
  84. package/dist/error-handler-XRI3ZDLO.js +2 -0
  85. package/dist/is-wsl-52AELLDM.js +2 -0
  86. package/dist/{morph-3JSBLNUD.js → morph-S2LU6PQ4.js} +7 -7
  87. package/dist/{multipart-parser-QIHQVIZA.js → multipart-parser-MX4R5XJM.js} +1 -1
  88. package/dist/open-PMJ32HTM.js +2 -0
  89. package/dist/out-U7AI7XUQ.js +2 -0
  90. package/package.json +4 -2
  91. package/dist/chokidar-FXMI63T6.js +0 -12
  92. package/dist/chunk-3LZ6M5C2.js +0 -3
  93. package/dist/chunk-D7CI46F7.js +0 -10
  94. package/dist/chunk-FB327AH7.js +0 -5
  95. package/dist/chunk-MZPD7BFF.js +0 -23
  96. package/dist/chunk-NIHY2BIB.js +0 -1180
  97. package/dist/chunk-UASQ33JG.js +0 -45
  98. package/dist/chunk-VMIOG46Y.js +0 -2
  99. package/dist/devtools-DGRGSZU7.js +0 -8
  100. package/dist/error-handler-O653XSNU.js +0 -2
  101. package/dist/is-wsl-LL6KGQIK.js +0 -2
  102. package/dist/open-OD6DRFEG.js +0 -2
  103. package/dist/out-DXB3K325.js +0 -2
@@ -1,14 +1,17 @@
1
- import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
2
- import {useLoaderData, type MetaFunction} from 'react-router';
1
+ import type {Route} from './+types/collections.all';
2
+ import {
3
+ useLoaderData,
4
+ } from 'react-router';
3
5
  import {getPaginationVariables, Image, Money} from '@shopify/hydrogen';
4
6
  import {PaginatedResourceSection} from '~/components/PaginatedResourceSection';
5
7
  import {ProductItem} from '~/components/ProductItem';
8
+ import type {CollectionItemFragment} from 'storefrontapi.generated';
6
9
 
7
- export const meta: MetaFunction<typeof loader> = () => {
10
+ export const meta: Route.MetaFunction = () => {
8
11
  return [{title: `Hydrogen | Products`}];
9
12
  };
10
13
 
11
- export async function loader(args: LoaderFunctionArgs) {
14
+ export async function loader(args: Route.LoaderArgs) {
12
15
  // Start fetching non-critical data without blocking time to first byte
13
16
  const deferredData = loadDeferredData(args);
14
17
 
@@ -22,7 +25,7 @@ export async function loader(args: LoaderFunctionArgs) {
22
25
  * Load data necessary for rendering content above the fold. This is the critical data
23
26
  * needed to render the page. If it's unavailable, the whole page should 400 or 500 error.
24
27
  */
25
- async function loadCriticalData({context, request}: LoaderFunctionArgs) {
28
+ async function loadCriticalData({context, request}: Route.LoaderArgs) {
26
29
  const {storefront} = context;
27
30
  const paginationVariables = getPaginationVariables(request, {
28
31
  pageBy: 8,
@@ -42,7 +45,7 @@ async function loadCriticalData({context, request}: LoaderFunctionArgs) {
42
45
  * fetched after the initial page load. If it's unavailable, the page should still 200.
43
46
  * Make sure to not throw any errors here, as it will cause the page to 500.
44
47
  */
45
- function loadDeferredData({context}: LoaderFunctionArgs) {
48
+ function loadDeferredData({context}: Route.LoaderArgs) {
46
49
  return {};
47
50
  }
48
51
 
@@ -52,7 +55,7 @@ export default function Collection() {
52
55
  return (
53
56
  <div className="collection">
54
57
  <h1>Products</h1>
55
- <PaginatedResourceSection
58
+ <PaginatedResourceSection<CollectionItemFragment>
56
59
  connection={products}
57
60
  resourcesClassName="products-grid"
58
61
  >
@@ -1,4 +1,5 @@
1
- import {redirect, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
1
+ import {redirect} from 'react-router';
2
+ import type {Route} from './+types/discount.$code';
2
3
 
3
4
  /**
4
5
  * Automatically applies a discount found on the url
@@ -11,7 +12,7 @@ import {redirect, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
11
12
  *
12
13
  * ```
13
14
  */
14
- export async function loader({request, context, params}: LoaderFunctionArgs) {
15
+ export async function loader({request, context, params}: Route.LoaderArgs) {
15
16
  const {cart} = context;
16
17
  const {code} = params;
17
18
 
@@ -1,12 +1,14 @@
1
- import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
2
- import { useLoaderData, type MetaFunction } from 'react-router';
1
+ import {
2
+ useLoaderData,
3
+ } from 'react-router';
4
+ import type {Route} from './+types/pages.$handle';
3
5
  import {redirectIfHandleIsLocalized} from '~/lib/redirect';
4
6
 
5
- export const meta: MetaFunction<typeof loader> = ({data}) => {
7
+ export const meta: Route.MetaFunction = ({data}) => {
6
8
  return [{title: `Hydrogen | ${data?.page.title ?? ''}`}];
7
9
  };
8
10
 
9
- export async function loader(args: LoaderFunctionArgs) {
11
+ export async function loader(args: Route.LoaderArgs) {
10
12
  // Start fetching non-critical data without blocking time to first byte
11
13
  const deferredData = loadDeferredData(args);
12
14
 
@@ -24,7 +26,7 @@ async function loadCriticalData({
24
26
  context,
25
27
  request,
26
28
  params,
27
- }: LoaderFunctionArgs) {
29
+ }: Route.LoaderArgs) {
28
30
  if (!params.handle) {
29
31
  throw new Error('Missing page handle');
30
32
  }
@@ -54,7 +56,7 @@ async function loadCriticalData({
54
56
  * fetched after the initial page load. If it's unavailable, the page should still 200.
55
57
  * Make sure to not throw any errors here, as it will cause the page to 500.
56
58
  */
57
- function loadDeferredData({context}: LoaderFunctionArgs) {
59
+ function loadDeferredData({context}: Route.LoaderArgs) {
58
60
  return {};
59
61
  }
60
62
 
@@ -1,5 +1,8 @@
1
- import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
2
- import { Link, useLoaderData, type MetaFunction } from 'react-router';
1
+ import {
2
+ Link,
3
+ useLoaderData,
4
+ } from 'react-router';
5
+ import type {Route} from './+types/policies.$handle';
3
6
  import {type Shop} from '@shopify/hydrogen/storefront-api-types';
4
7
 
5
8
  type SelectedPolicies = keyof Pick<
@@ -7,11 +10,11 @@ type SelectedPolicies = keyof Pick<
7
10
  'privacyPolicy' | 'shippingPolicy' | 'termsOfService' | 'refundPolicy'
8
11
  >;
9
12
 
10
- export const meta: MetaFunction<typeof loader> = ({data}) => {
13
+ export const meta: Route.MetaFunction = ({data}) => {
11
14
  return [{title: `Hydrogen | ${data?.policy.title ?? ''}`}];
12
15
  };
13
16
 
14
- export async function loader({params, context}: LoaderFunctionArgs) {
17
+ export async function loader({params, context}: Route.LoaderArgs) {
15
18
  if (!params.handle) {
16
19
  throw new Response('No handle was passed in', {status: 404});
17
20
  }
@@ -1,9 +1,18 @@
1
- import {type LoaderFunctionArgs} from '@shopify/remix-oxygen';
2
- import { useLoaderData, Link } from 'react-router';
1
+ import {useLoaderData, Link} from 'react-router';
2
+ import type {Route} from './+types/policies._index';
3
+ import type {PoliciesQuery, PolicyItemFragment} from 'storefrontapi.generated';
3
4
 
4
- export async function loader({context}: LoaderFunctionArgs) {
5
- const data = await context.storefront.query(POLICIES_QUERY);
6
- const policies = Object.values(data.shop || {});
5
+ export async function loader({context}: Route.LoaderArgs) {
6
+ const data: PoliciesQuery = await context.storefront.query(POLICIES_QUERY);
7
+
8
+ const shopPolicies = data.shop;
9
+ const policies: PolicyItemFragment[] = [
10
+ shopPolicies?.privacyPolicy,
11
+ shopPolicies?.shippingPolicy,
12
+ shopPolicies?.termsOfService,
13
+ shopPolicies?.refundPolicy,
14
+ shopPolicies?.subscriptionPolicy,
15
+ ].filter((policy): policy is PolicyItemFragment => policy != null);
7
16
 
8
17
  if (!policies.length) {
9
18
  throw new Response('No policies found', {status: 404});
@@ -19,14 +28,11 @@ export default function Policies() {
19
28
  <div className="policies">
20
29
  <h1>Policies</h1>
21
30
  <div>
22
- {policies.map((policy) => {
23
- if (!policy) return null;
24
- return (
25
- <fieldset key={policy.id}>
26
- <Link to={`/policies/${policy.handle}`}>{policy.title}</Link>
27
- </fieldset>
28
- );
29
- })}
31
+ {policies.map((policy) => (
32
+ <fieldset key={policy.id}>
33
+ <Link to={`/policies/${policy.handle}`}>{policy.title}</Link>
34
+ </fieldset>
35
+ ))}
30
36
  </div>
31
37
  </div>
32
38
  );
@@ -1,5 +1,8 @@
1
- import {redirect, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
2
- import { useLoaderData, type MetaFunction } from 'react-router';
1
+ import {
2
+ redirect,
3
+ useLoaderData,
4
+ } from 'react-router';
5
+ import type {Route} from './+types/products.$handle';
3
6
  import {
4
7
  getSelectedProductOptions,
5
8
  Analytics,
@@ -13,7 +16,7 @@ import {ProductImage} from '~/components/ProductImage';
13
16
  import {ProductForm} from '~/components/ProductForm';
14
17
  import {redirectIfHandleIsLocalized} from '~/lib/redirect';
15
18
 
16
- export const meta: MetaFunction<typeof loader> = ({data}) => {
19
+ export const meta: Route.MetaFunction = ({data}) => {
17
20
  return [
18
21
  {title: `Hydrogen | ${data?.product.title ?? ''}`},
19
22
  {
@@ -23,7 +26,7 @@ export const meta: MetaFunction<typeof loader> = ({data}) => {
23
26
  ];
24
27
  };
25
28
 
26
- export async function loader(args: LoaderFunctionArgs) {
29
+ export async function loader(args: Route.LoaderArgs) {
27
30
  // Start fetching non-critical data without blocking time to first byte
28
31
  const deferredData = loadDeferredData(args);
29
32
 
@@ -41,7 +44,7 @@ async function loadCriticalData({
41
44
  context,
42
45
  params,
43
46
  request,
44
- }: LoaderFunctionArgs) {
47
+ }: Route.LoaderArgs) {
45
48
  const {handle} = params;
46
49
  const {storefront} = context;
47
50
 
@@ -73,7 +76,7 @@ async function loadCriticalData({
73
76
  * fetched after the initial page load. If it's unavailable, the page should still 200.
74
77
  * Make sure to not throw any errors here, as it will cause the page to 500.
75
78
  */
76
- function loadDeferredData({context, params}: LoaderFunctionArgs) {
79
+ function loadDeferredData({context, params}: Route.LoaderArgs) {
77
80
  // Put any API calls that is not critical to be available on first page render
78
81
  // For example: product reviews, product recommendations, social feeds.
79
82
 
@@ -1,8 +1,7 @@
1
1
  import {
2
- type LoaderFunctionArgs,
3
- type ActionFunctionArgs,
4
- } from '@shopify/remix-oxygen';
5
- import { useLoaderData, type MetaFunction } from 'react-router';
2
+ useLoaderData,
3
+ } from 'react-router';
4
+ import type {Route} from './+types/search';
6
5
  import {getPaginationVariables, Analytics} from '@shopify/hydrogen';
7
6
  import {SearchForm} from '~/components/SearchForm';
8
7
  import {SearchResults} from '~/components/SearchResults';
@@ -11,12 +10,13 @@ import {
11
10
  type PredictiveSearchReturn,
12
11
  getEmptyPredictiveSearchResult,
13
12
  } from '~/lib/search';
13
+ import type {RegularSearchQuery, PredictiveSearchQuery} from 'storefrontapi.generated';
14
14
 
15
- export const meta: MetaFunction = () => {
15
+ export const meta: Route.MetaFunction = () => {
16
16
  return [{title: `Hydrogen | Search`}];
17
17
  };
18
18
 
19
- export async function loader({request, context}: LoaderFunctionArgs) {
19
+ export async function loader({request, context}: Route.LoaderArgs) {
20
20
  const url = new URL(request.url);
21
21
  const isPredictive = url.searchParams.has('predictive');
22
22
  const searchPromise: Promise<PredictiveSearchReturn | RegularSearchReturn> =
@@ -216,7 +216,7 @@ async function regularSearch({
216
216
  request,
217
217
  context,
218
218
  }: Pick<
219
- LoaderFunctionArgs,
219
+ Route.LoaderArgs,
220
220
  'request' | 'context'
221
221
  >): Promise<RegularSearchReturn> {
222
222
  const {storefront} = context;
@@ -225,7 +225,7 @@ async function regularSearch({
225
225
  const term = String(url.searchParams.get('q') || '');
226
226
 
227
227
  // Search articles, pages, and products for the `q` term
228
- const {errors, ...items} = await storefront.query(SEARCH_QUERY, {
228
+ const {errors, ...items}: {errors?: Array<{message: string}>} & RegularSearchQuery = await storefront.query(SEARCH_QUERY, {
229
229
  variables: {...variables, term},
230
230
  });
231
231
 
@@ -234,12 +234,12 @@ async function regularSearch({
234
234
  }
235
235
 
236
236
  const total = Object.values(items).reduce(
237
- (acc, {nodes}) => acc + nodes.length,
237
+ (acc: number, {nodes}: {nodes: Array<unknown>}) => acc + nodes.length,
238
238
  0,
239
239
  );
240
240
 
241
241
  const error = errors
242
- ? errors.map(({message}) => message).join(', ')
242
+ ? errors.map(({message}: {message: string}) => message).join(', ')
243
243
  : undefined;
244
244
 
245
245
  return {type: 'regular', term, error, result: {total, items}};
@@ -377,7 +377,7 @@ async function predictiveSearch({
377
377
  request,
378
378
  context,
379
379
  }: Pick<
380
- ActionFunctionArgs,
380
+ Route.ActionArgs,
381
381
  'request' | 'context'
382
382
  >): Promise<PredictiveSearchReturn> {
383
383
  const {storefront} = context;
@@ -389,7 +389,7 @@ async function predictiveSearch({
389
389
  if (!term) return {type, term, result: getEmptyPredictiveSearchResult()};
390
390
 
391
391
  // Predictively search articles, collections, pages, products, and queries (suggestions)
392
- const {predictiveSearch: items, errors} = await storefront.query(
392
+ const {predictiveSearch: items, errors}: PredictiveSearchQuery & {errors?: Array<{message: string}>} = await storefront.query(
393
393
  PREDICTIVE_SEARCH_QUERY,
394
394
  {
395
395
  variables: {
@@ -403,7 +403,7 @@ async function predictiveSearch({
403
403
 
404
404
  if (errors) {
405
405
  throw new Error(
406
- `Shopify API errors: ${errors.map(({message}) => message).join(', ')}`,
406
+ `Shopify API errors: ${errors.map(({message}: {message: string}) => message).join(', ')}`,
407
407
  );
408
408
  }
409
409
 
@@ -412,7 +412,7 @@ async function predictiveSearch({
412
412
  }
413
413
 
414
414
  const total = Object.values(items).reduce(
415
- (acc, item) => acc + item.length,
415
+ (acc: number, item: Array<unknown>) => acc + item.length,
416
416
  0,
417
417
  );
418
418
 
@@ -1,11 +1,11 @@
1
- import type {LoaderFunctionArgs} from '@shopify/remix-oxygen';
1
+ import type {Route} from './+types/sitemap.$type.$page[.xml]';
2
2
  import {getSitemap} from '@shopify/hydrogen';
3
3
 
4
4
  export async function loader({
5
5
  request,
6
6
  params,
7
7
  context: {storefront},
8
- }: LoaderFunctionArgs) {
8
+ }: Route.LoaderArgs) {
9
9
  const response = await getSitemap({
10
10
  storefront,
11
11
  request,
@@ -21,4 +21,3 @@ export async function loader({
21
21
 
22
22
  return response;
23
23
  }
24
-
@@ -5,5 +5,5 @@ import {hydrogenRoutes} from '@shopify/hydrogen';
5
5
  export default hydrogenRoutes([
6
6
  ...(await flatRoutes()),
7
7
  // Manual route definitions can be added to this array, in addition to or instead of using the `flatRoutes` file-based routing convention.
8
- // See https://remix.run/docs/en/main/guides/routing for more details
8
+ // See https://reactrouter.com/api/framework-conventions/routes.ts#routests
9
9
  ]) satisfies RouteConfig;
@@ -210,7 +210,6 @@ button.reset:hover:not(:has(> *)) {
210
210
  min-width: fit-content;
211
211
  }
212
212
 
213
-
214
213
  /*
215
214
  * --------------------------------------------------
216
215
  * components/Footer
@@ -520,3 +519,56 @@ button.reset:hover:not(:has(> *)) {
520
519
  .account-logout {
521
520
  display: inline-block;
522
521
  }
522
+
523
+ /*
524
+ * --------------------------------------------------
525
+ * Order Search Form - Minimal & Responsive
526
+ * --------------------------------------------------
527
+ */
528
+ .order-search-form {
529
+ margin-bottom: 1.5rem;
530
+ }
531
+
532
+ .order-search-fieldset {
533
+ border: 1px solid #e5e5e5;
534
+ border-radius: 4px;
535
+ padding: 1rem;
536
+ }
537
+
538
+ .order-search-legend {
539
+ font-weight: 600;
540
+ padding: 0 0.5rem;
541
+ }
542
+
543
+ .order-search-active {
544
+ font-weight: normal;
545
+ opacity: 0.7;
546
+ margin-left: 0.5rem;
547
+ }
548
+
549
+ .order-search-inputs {
550
+ display: grid;
551
+ gap: 1rem;
552
+ margin: 0.25rem 0 1rem;
553
+ grid-template-columns: 1fr;
554
+ }
555
+
556
+ @media (min-width: 640px) {
557
+ .order-search-inputs {
558
+ grid-template-columns: 1fr 1fr;
559
+ }
560
+ }
561
+
562
+ .order-search-input {
563
+ width: 100%;
564
+ padding: 0.5rem;
565
+ border: 1px solid #d1d5db;
566
+ border-radius: 4px;
567
+ font-size: 1rem;
568
+ }
569
+
570
+ .order-search-buttons {
571
+ display: flex;
572
+ gap: 0.75rem;
573
+ flex-wrap: wrap;
574
+ }
@@ -9,6 +9,7 @@ export type CustomerAddressUpdateMutationVariables = CustomerAccountAPI.Exact<{
9
9
  defaultAddress?: CustomerAccountAPI.InputMaybe<
10
10
  CustomerAccountAPI.Scalars['Boolean']['input']
11
11
  >;
12
+ language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
12
13
  }>;
13
14
 
14
15
  export type CustomerAddressUpdateMutation = {
@@ -27,6 +28,7 @@ export type CustomerAddressUpdateMutation = {
27
28
 
28
29
  export type CustomerAddressDeleteMutationVariables = CustomerAccountAPI.Exact<{
29
30
  addressId: CustomerAccountAPI.Scalars['ID']['input'];
31
+ language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
30
32
  }>;
31
33
 
32
34
  export type CustomerAddressDeleteMutation = {
@@ -50,6 +52,7 @@ export type CustomerAddressCreateMutationVariables = CustomerAccountAPI.Exact<{
50
52
  defaultAddress?: CustomerAccountAPI.InputMaybe<
51
53
  CustomerAccountAPI.Scalars['Boolean']['input']
52
54
  >;
55
+ language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
53
56
  }>;
54
57
 
55
58
  export type CustomerAddressCreateMutation = {
@@ -125,7 +128,7 @@ export type AddressFragment = Pick<
125
128
  >;
126
129
 
127
130
  export type CustomerDetailsQueryVariables = CustomerAccountAPI.Exact<{
128
- [key: string]: never;
131
+ language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
129
132
  }>;
130
133
 
131
134
  export type CustomerDetailsQuery = {
@@ -224,7 +227,12 @@ export type OrderLineItemFullFragment = Pick<
224
227
 
225
228
  export type OrderFragment = Pick<
226
229
  CustomerAccountAPI.Order,
227
- 'id' | 'name' | 'statusPageUrl' | 'processedAt'
230
+ | 'id'
231
+ | 'name'
232
+ | 'confirmationNumber'
233
+ | 'statusPageUrl'
234
+ | 'fulfillmentStatus'
235
+ | 'processedAt'
228
236
  > & {
229
237
  fulfillments: {nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>};
230
238
  totalTax?: CustomerAccountAPI.Maybe<
@@ -296,13 +304,19 @@ export type OrderFragment = Pick<
296
304
 
297
305
  export type OrderQueryVariables = CustomerAccountAPI.Exact<{
298
306
  orderId: CustomerAccountAPI.Scalars['ID']['input'];
307
+ language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
299
308
  }>;
300
309
 
301
310
  export type OrderQuery = {
302
311
  order?: CustomerAccountAPI.Maybe<
303
312
  Pick<
304
313
  CustomerAccountAPI.Order,
305
- 'id' | 'name' | 'statusPageUrl' | 'processedAt'
314
+ | 'id'
315
+ | 'name'
316
+ | 'confirmationNumber'
317
+ | 'statusPageUrl'
318
+ | 'fulfillmentStatus'
319
+ | 'processedAt'
306
320
  > & {
307
321
  fulfillments: {
308
322
  nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>;
@@ -378,7 +392,12 @@ export type OrderQuery = {
378
392
 
379
393
  export type OrderItemFragment = Pick<
380
394
  CustomerAccountAPI.Order,
381
- 'financialStatus' | 'id' | 'number' | 'processedAt'
395
+ | 'financialStatus'
396
+ | 'fulfillmentStatus'
397
+ | 'id'
398
+ | 'number'
399
+ | 'confirmationNumber'
400
+ | 'processedAt'
382
401
  > & {
383
402
  totalPrice: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
384
403
  fulfillments: {nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>};
@@ -389,7 +408,12 @@ export type CustomerOrdersFragment = {
389
408
  nodes: Array<
390
409
  Pick<
391
410
  CustomerAccountAPI.Order,
392
- 'financialStatus' | 'id' | 'number' | 'processedAt'
411
+ | 'financialStatus'
412
+ | 'fulfillmentStatus'
413
+ | 'id'
414
+ | 'number'
415
+ | 'confirmationNumber'
416
+ | 'processedAt'
393
417
  > & {
394
418
  totalPrice: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
395
419
  fulfillments: {
@@ -417,6 +441,10 @@ export type CustomerOrdersQueryVariables = CustomerAccountAPI.Exact<{
417
441
  startCursor?: CustomerAccountAPI.InputMaybe<
418
442
  CustomerAccountAPI.Scalars['String']['input']
419
443
  >;
444
+ query?: CustomerAccountAPI.InputMaybe<
445
+ CustomerAccountAPI.Scalars['String']['input']
446
+ >;
447
+ language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
420
448
  }>;
421
449
 
422
450
  export type CustomerOrdersQuery = {
@@ -425,7 +453,12 @@ export type CustomerOrdersQuery = {
425
453
  nodes: Array<
426
454
  Pick<
427
455
  CustomerAccountAPI.Order,
428
- 'financialStatus' | 'id' | 'number' | 'processedAt'
456
+ | 'financialStatus'
457
+ | 'fulfillmentStatus'
458
+ | 'id'
459
+ | 'number'
460
+ | 'confirmationNumber'
461
+ | 'processedAt'
429
462
  > & {
430
463
  totalPrice: Pick<
431
464
  CustomerAccountAPI.MoneyV2,
@@ -446,6 +479,7 @@ export type CustomerOrdersQuery = {
446
479
 
447
480
  export type CustomerUpdateMutationVariables = CustomerAccountAPI.Exact<{
448
481
  customer: CustomerAccountAPI.CustomerUpdateInput;
482
+ language?: CustomerAccountAPI.InputMaybe<CustomerAccountAPI.LanguageCode>;
449
483
  }>;
450
484
 
451
485
  export type CustomerUpdateMutation = {
@@ -470,34 +504,34 @@ export type CustomerUpdateMutation = {
470
504
  };
471
505
 
472
506
  interface GeneratedQueryTypes {
473
- '#graphql\n query CustomerDetails {\n customer {\n ...Customer\n }\n }\n #graphql\n fragment Customer on Customer {\n id\n firstName\n lastName\n defaultAddress {\n ...Address\n }\n addresses(first: 6) {\n nodes {\n ...Address\n }\n }\n }\n fragment Address on CustomerAddress {\n id\n formatted\n firstName\n lastName\n company\n address1\n address2\n territoryCode\n zoneCode\n city\n zip\n phoneNumber\n }\n\n': {
507
+ '#graphql\n query CustomerDetails($language: LanguageCode) @inContext(language: $language) {\n customer {\n ...Customer\n }\n }\n #graphql\n fragment Customer on Customer {\n id\n firstName\n lastName\n defaultAddress {\n ...Address\n }\n addresses(first: 6) {\n nodes {\n ...Address\n }\n }\n }\n fragment Address on CustomerAddress {\n id\n formatted\n firstName\n lastName\n company\n address1\n address2\n territoryCode\n zoneCode\n city\n zip\n phoneNumber\n }\n\n': {
474
508
  return: CustomerDetailsQuery;
475
509
  variables: CustomerDetailsQueryVariables;
476
510
  };
477
- '#graphql\n fragment OrderMoney on MoneyV2 {\n amount\n currencyCode\n }\n fragment DiscountApplication on DiscountApplication {\n value {\n __typename\n ... on MoneyV2 {\n ...OrderMoney\n }\n ... on PricingPercentageValue {\n percentage\n }\n }\n }\n fragment OrderLineItemFull on LineItem {\n id\n title\n quantity\n price {\n ...OrderMoney\n }\n discountAllocations {\n allocatedAmount {\n ...OrderMoney\n }\n discountApplication {\n ...DiscountApplication\n }\n }\n totalDiscount {\n ...OrderMoney\n }\n image {\n altText\n height\n url\n id\n width\n }\n variantTitle\n }\n fragment Order on Order {\n id\n name\n statusPageUrl\n processedAt\n fulfillments(first: 1) {\n nodes {\n status\n }\n }\n totalTax {\n ...OrderMoney\n }\n totalPrice {\n ...OrderMoney\n }\n subtotal {\n ...OrderMoney\n }\n shippingAddress {\n name\n formatted(withName: true)\n formattedArea\n }\n discountApplications(first: 100) {\n nodes {\n ...DiscountApplication\n }\n }\n lineItems(first: 100) {\n nodes {\n ...OrderLineItemFull\n }\n }\n }\n query Order($orderId: ID!) {\n order(id: $orderId) {\n ... on Order {\n ...Order\n }\n }\n }\n': {
511
+ '#graphql\n fragment OrderMoney on MoneyV2 {\n amount\n currencyCode\n }\n fragment DiscountApplication on DiscountApplication {\n value {\n __typename\n ... on MoneyV2 {\n ...OrderMoney\n }\n ... on PricingPercentageValue {\n percentage\n }\n }\n }\n fragment OrderLineItemFull on LineItem {\n id\n title\n quantity\n price {\n ...OrderMoney\n }\n discountAllocations {\n allocatedAmount {\n ...OrderMoney\n }\n discountApplication {\n ...DiscountApplication\n }\n }\n totalDiscount {\n ...OrderMoney\n }\n image {\n altText\n height\n url\n id\n width\n }\n variantTitle\n }\n fragment Order on Order {\n id\n name\n confirmationNumber\n statusPageUrl\n fulfillmentStatus\n processedAt\n fulfillments(first: 1) {\n nodes {\n status\n }\n }\n totalTax {\n ...OrderMoney\n }\n totalPrice {\n ...OrderMoney\n }\n subtotal {\n ...OrderMoney\n }\n shippingAddress {\n name\n formatted(withName: true)\n formattedArea\n }\n discountApplications(first: 100) {\n nodes {\n ...DiscountApplication\n }\n }\n lineItems(first: 100) {\n nodes {\n ...OrderLineItemFull\n }\n }\n }\n query Order($orderId: ID!, $language: LanguageCode)\n @inContext(language: $language) {\n order(id: $orderId) {\n ... on Order {\n ...Order\n }\n }\n }\n': {
478
512
  return: OrderQuery;
479
513
  variables: OrderQueryVariables;
480
514
  };
481
- '#graphql\n #graphql\n fragment CustomerOrders on Customer {\n orders(\n sortKey: PROCESSED_AT,\n reverse: true,\n first: $first,\n last: $last,\n before: $startCursor,\n after: $endCursor\n ) {\n nodes {\n ...OrderItem\n }\n pageInfo {\n hasPreviousPage\n hasNextPage\n endCursor\n startCursor\n }\n }\n }\n #graphql\n fragment OrderItem on Order {\n totalPrice {\n amount\n currencyCode\n }\n financialStatus\n fulfillments(first: 1) {\n nodes {\n status\n }\n }\n id\n number\n processedAt\n }\n\n\n query CustomerOrders(\n $endCursor: String\n $first: Int\n $last: Int\n $startCursor: String\n ) {\n customer {\n ...CustomerOrders\n }\n }\n': {
515
+ '#graphql\n #graphql\n fragment CustomerOrders on Customer {\n orders(\n sortKey: PROCESSED_AT,\n reverse: true,\n first: $first,\n last: $last,\n before: $startCursor,\n after: $endCursor,\n query: $query\n ) {\n nodes {\n ...OrderItem\n }\n pageInfo {\n hasPreviousPage\n hasNextPage\n endCursor\n startCursor\n }\n }\n }\n #graphql\n fragment OrderItem on Order {\n totalPrice {\n amount\n currencyCode\n }\n financialStatus\n fulfillmentStatus\n fulfillments(first: 1) {\n nodes {\n status\n }\n }\n id\n number\n confirmationNumber\n processedAt\n }\n\n\n query CustomerOrders(\n $endCursor: String\n $first: Int\n $last: Int\n $startCursor: String\n $query: String\n $language: LanguageCode\n ) @inContext(language: $language) {\n customer {\n ...CustomerOrders\n }\n }\n': {
482
516
  return: CustomerOrdersQuery;
483
517
  variables: CustomerOrdersQueryVariables;
484
518
  };
485
519
  }
486
520
 
487
521
  interface GeneratedMutationTypes {
488
- '#graphql\n mutation customerAddressUpdate(\n $address: CustomerAddressInput!\n $addressId: ID!\n $defaultAddress: Boolean\n ) {\n customerAddressUpdate(\n address: $address\n addressId: $addressId\n defaultAddress: $defaultAddress\n ) {\n customerAddress {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
522
+ '#graphql\n mutation customerAddressUpdate(\n $address: CustomerAddressInput!\n $addressId: ID!\n $defaultAddress: Boolean\n $language: LanguageCode\n ) @inContext(language: $language) {\n customerAddressUpdate(\n address: $address\n addressId: $addressId\n defaultAddress: $defaultAddress\n ) {\n customerAddress {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
489
523
  return: CustomerAddressUpdateMutation;
490
524
  variables: CustomerAddressUpdateMutationVariables;
491
525
  };
492
- '#graphql\n mutation customerAddressDelete(\n $addressId: ID!,\n ) {\n customerAddressDelete(addressId: $addressId) {\n deletedAddressId\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
526
+ '#graphql\n mutation customerAddressDelete(\n $addressId: ID!\n $language: LanguageCode\n ) @inContext(language: $language) {\n customerAddressDelete(addressId: $addressId) {\n deletedAddressId\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
493
527
  return: CustomerAddressDeleteMutation;
494
528
  variables: CustomerAddressDeleteMutationVariables;
495
529
  };
496
- '#graphql\n mutation customerAddressCreate(\n $address: CustomerAddressInput!\n $defaultAddress: Boolean\n ) {\n customerAddressCreate(\n address: $address\n defaultAddress: $defaultAddress\n ) {\n customerAddress {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
530
+ '#graphql\n mutation customerAddressCreate(\n $address: CustomerAddressInput!\n $defaultAddress: Boolean\n $language: LanguageCode\n ) @inContext(language: $language) {\n customerAddressCreate(\n address: $address\n defaultAddress: $defaultAddress\n ) {\n customerAddress {\n id\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
497
531
  return: CustomerAddressCreateMutation;
498
532
  variables: CustomerAddressCreateMutationVariables;
499
533
  };
500
- '#graphql\n # https://shopify.dev/docs/api/customer/latest/mutations/customerUpdate\n mutation customerUpdate(\n $customer: CustomerUpdateInput!\n ){\n customerUpdate(input: $customer) {\n customer {\n firstName\n lastName\n emailAddress {\n emailAddress\n }\n phoneNumber {\n phoneNumber\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
534
+ '#graphql\n mutation customerUpdate(\n $customer: CustomerUpdateInput!\n $language: LanguageCode\n ) @inContext(language: $language) {\n customerUpdate(input: $customer) {\n customer {\n firstName\n lastName\n emailAddress {\n emailAddress\n }\n phoneNumber {\n phoneNumber\n }\n }\n userErrors {\n code\n field\n message\n }\n }\n }\n': {
501
535
  return: CustomerUpdateMutation;
502
536
  variables: CustomerUpdateMutationVariables;
503
537
  };
@@ -1,45 +1,7 @@
1
1
  /// <reference types="vite/client" />
2
2
  /// <reference types="react-router" />
3
3
  /// <reference types="@shopify/oxygen-workers-types" />
4
+ /// <reference types="@shopify/hydrogen/react-router-types" />
4
5
 
5
6
  // Enhance TypeScript's built-in typings.
6
7
  import '@total-typescript/ts-reset';
7
-
8
- import type {
9
- HydrogenContext,
10
- HydrogenSessionData,
11
- HydrogenEnv,
12
- } from '@shopify/hydrogen';
13
- import type {createAppLoadContext} from '~/lib/context';
14
-
15
- declare global {
16
- /**
17
- * A global `process` object is only available during build to access NODE_ENV.
18
- */
19
- const process: {env: {NODE_ENV: 'production' | 'development'}};
20
-
21
- interface Env extends HydrogenEnv {
22
- // declare additional Env parameter use in the fetch handler and Remix loader context here
23
- }
24
- }
25
-
26
- declare module 'react-router' {
27
- interface AppLoadContext
28
- extends Awaited<ReturnType<typeof createAppLoadContext>> {
29
- // to change context type, change the return of createAppLoadContext() instead
30
- }
31
-
32
- // TODO: remove this once we've migrated our loaders to `Route.LoaderArgs`
33
- interface LoaderFunctionArgs {
34
- context: AppLoadContext;
35
- }
36
-
37
- // TODO: remove this once we've migrated our loaders to `Route.ActionArgs`
38
- interface ActionFunctionArgs {
39
- context: AppLoadContext;
40
- }
41
-
42
- interface SessionData extends HydrogenSessionData {
43
- // declare local additions to the Remix session data here
44
- }
45
- }