@shopify/cli-hydrogen 6.0.2 → 7.0.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.
- package/dist/commands/hydrogen/build.js +40 -78
- package/dist/commands/hydrogen/codegen.js +8 -3
- package/dist/commands/hydrogen/deploy.js +173 -37
- package/dist/commands/hydrogen/deploy.test.js +192 -20
- package/dist/commands/hydrogen/dev.js +56 -31
- package/dist/commands/hydrogen/init.js +1 -1
- package/dist/commands/hydrogen/init.test.js +155 -53
- package/dist/commands/hydrogen/link.js +5 -21
- package/dist/commands/hydrogen/link.test.js +10 -10
- package/dist/commands/hydrogen/preview.js +22 -11
- package/dist/commands/hydrogen/setup.js +0 -4
- package/dist/commands/hydrogen/setup.test.js +0 -1
- package/dist/commands/hydrogen/shortcut.js +1 -0
- package/dist/commands/hydrogen/upgrade.js +720 -0
- package/dist/commands/hydrogen/upgrade.test.js +786 -0
- package/dist/generator-templates/starter/.graphqlrc.yml +12 -1
- package/dist/generator-templates/starter/CHANGELOG.md +126 -0
- package/dist/generator-templates/starter/README.md +23 -0
- package/dist/generator-templates/starter/app/components/Cart.tsx +1 -1
- package/dist/generator-templates/starter/app/components/Footer.tsx +3 -1
- package/dist/generator-templates/starter/app/components/Header.tsx +5 -1
- package/dist/generator-templates/starter/app/components/Layout.tsx +14 -11
- package/dist/generator-templates/starter/app/components/Search.tsx +1 -1
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerAddressMutations.ts +61 -0
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerDetailsQuery.ts +39 -0
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerOrderQuery.ts +87 -0
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerOrdersQuery.ts +58 -0
- package/dist/generator-templates/starter/app/graphql/customer-account/CustomerUpdateMutation.ts +24 -0
- package/dist/generator-templates/starter/app/lib/fragments.ts +102 -0
- package/dist/generator-templates/starter/app/lib/session.ts +67 -0
- package/dist/generator-templates/starter/app/root.tsx +11 -45
- package/dist/generator-templates/starter/app/routes/[robots.txt].tsx +0 -27
- package/dist/generator-templates/starter/app/routes/account.$.tsx +8 -4
- package/dist/generator-templates/starter/app/routes/account._index.tsx +5 -0
- package/dist/generator-templates/starter/app/routes/account.addresses.tsx +215 -206
- package/dist/generator-templates/starter/app/routes/account.orders.$id.tsx +56 -163
- package/dist/generator-templates/starter/app/routes/account.orders._index.tsx +32 -109
- package/dist/generator-templates/starter/app/routes/account.profile.tsx +40 -180
- package/dist/generator-templates/starter/app/routes/account.tsx +20 -135
- package/dist/generator-templates/starter/app/routes/account_.authorize.tsx +5 -0
- package/dist/generator-templates/starter/app/routes/account_.login.tsx +3 -140
- package/dist/generator-templates/starter/app/routes/account_.logout.tsx +5 -24
- package/dist/generator-templates/starter/app/routes/cart.tsx +7 -5
- package/dist/generator-templates/starter/app/routes/collections.$handle.tsx +1 -1
- package/dist/generator-templates/starter/app/routes/products.$handle.tsx +2 -2
- package/dist/generator-templates/starter/app/routes/search.tsx +1 -1
- package/dist/generator-templates/starter/customer-accountapi.generated.d.ts +506 -0
- package/dist/generator-templates/starter/package.json +11 -10
- package/dist/generator-templates/starter/remix.config.js +4 -0
- package/dist/generator-templates/starter/remix.env.d.ts +6 -11
- package/dist/generator-templates/starter/server.ts +24 -167
- package/dist/generator-templates/starter/storefrontapi.generated.d.ts +104 -881
- package/dist/hooks/init.js +4 -4
- package/dist/lib/auth.js +5 -10
- package/dist/lib/build.js +6 -1
- package/dist/lib/bundle/analyzer.js +36 -26
- package/dist/lib/check-lockfile.js +1 -0
- package/dist/lib/codegen.js +59 -18
- package/dist/lib/defer.js +12 -0
- package/dist/lib/file.js +52 -3
- package/dist/lib/flags.js +27 -9
- package/dist/lib/get-oxygen-deployment-data.test.js +4 -2
- package/dist/lib/graphql/admin/client.test.js +2 -2
- package/dist/lib/graphql/admin/get-oxygen-data.js +1 -0
- package/dist/lib/log.js +32 -14
- package/dist/lib/mini-oxygen/assets.js +118 -0
- package/dist/lib/mini-oxygen/common.js +2 -1
- package/dist/lib/mini-oxygen/index.js +7 -5
- package/dist/lib/mini-oxygen/mini-oxygen.test.js +214 -0
- package/dist/lib/mini-oxygen/node.js +19 -5
- package/dist/lib/mini-oxygen/workerd-inspector-logs.js +227 -0
- package/dist/lib/mini-oxygen/workerd-inspector-proxy.js +200 -0
- package/dist/lib/mini-oxygen/workerd-inspector.js +62 -235
- package/dist/lib/mini-oxygen/workerd.js +74 -50
- package/dist/lib/missing-routes.js +6 -3
- package/dist/lib/onboarding/common.js +40 -9
- package/dist/lib/onboarding/local.js +19 -11
- package/dist/lib/onboarding/remote.js +48 -28
- package/dist/lib/render-errors.js +2 -0
- package/dist/lib/request-events.js +65 -31
- package/dist/lib/setups/css/assets.js +1 -46
- package/dist/lib/setups/css/css-modules.js +3 -2
- package/dist/lib/setups/css/postcss.js +4 -2
- package/dist/lib/setups/css/tailwind.js +4 -2
- package/dist/lib/setups/css/vanilla-extract.js +3 -2
- package/dist/lib/setups/i18n/replacers.test.js +56 -38
- package/dist/lib/shell.js +1 -1
- package/dist/lib/template-diff.js +89 -0
- package/dist/lib/template-downloader.js +3 -2
- package/dist/lib/transpile/project.js +1 -1
- package/dist/virtual-routes/assets/debug-network.css +592 -0
- package/dist/virtual-routes/assets/favicon-dark.svg +20 -0
- package/dist/virtual-routes/components/FlameChartWrapper.jsx +8 -10
- package/dist/virtual-routes/components/IconClose.jsx +38 -0
- package/dist/virtual-routes/components/IconDiscard.jsx +44 -0
- package/dist/virtual-routes/components/RequestDetails.jsx +179 -0
- package/dist/virtual-routes/components/RequestTable.jsx +92 -0
- package/dist/virtual-routes/components/RequestWaterfall.jsx +151 -0
- package/dist/virtual-routes/lib/useDebugNetworkServer.jsx +176 -0
- package/dist/virtual-routes/routes/subrequest-profiler.jsx +243 -0
- package/oclif.manifest.json +134 -59
- package/package.json +18 -26
- package/dist/generator-templates/starter/app/routes/account_.activate.$id.$activationToken.tsx +0 -161
- package/dist/generator-templates/starter/app/routes/account_.recover.tsx +0 -129
- package/dist/generator-templates/starter/app/routes/account_.register.tsx +0 -207
- package/dist/generator-templates/starter/app/routes/account_.reset.$id.$resetToken.tsx +0 -136
- package/dist/virtual-routes/routes/debug-network.jsx +0 -289
- /package/dist/generator-templates/starter/app/{utils.ts → lib/variants.ts} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Money,
|
|
8
8
|
} from '@shopify/hydrogen';
|
|
9
9
|
import type {ProductItemFragment} from 'storefrontapi.generated';
|
|
10
|
-
import {useVariantUrl} from '~/
|
|
10
|
+
import {useVariantUrl} from '~/lib/variants';
|
|
11
11
|
|
|
12
12
|
export const meta: MetaFunction<typeof loader> = ({data}) => {
|
|
13
13
|
return [{title: `Hydrogen | ${data?.collection.title ?? ''} Collection`}];
|
|
@@ -25,7 +25,7 @@ import type {
|
|
|
25
25
|
CartLineInput,
|
|
26
26
|
SelectedOption,
|
|
27
27
|
} from '@shopify/hydrogen/storefront-api-types';
|
|
28
|
-
import {getVariantUrl} from '~/
|
|
28
|
+
import {getVariantUrl} from '~/lib/variants';
|
|
29
29
|
|
|
30
30
|
export const meta: MetaFunction<typeof loader> = ({data}) => {
|
|
31
31
|
return [{title: `Hydrogen | ${data?.product.title ?? ''}`}];
|
|
@@ -373,7 +373,7 @@ const PRODUCT_FRAGMENT = `#graphql
|
|
|
373
373
|
name
|
|
374
374
|
values
|
|
375
375
|
}
|
|
376
|
-
selectedVariant: variantBySelectedOptions(selectedOptions: $selectedOptions) {
|
|
376
|
+
selectedVariant: variantBySelectedOptions(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {
|
|
377
377
|
...ProductVariant
|
|
378
378
|
}
|
|
379
379
|
variants(first: 1) {
|
|
@@ -21,7 +21,7 @@ export async function loader({request, context}: LoaderFunctionArgs) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const data = await context.storefront.query(SEARCH_QUERY, {
|
|
24
|
+
const {errors, ...data} = await context.storefront.query(SEARCH_QUERY, {
|
|
25
25
|
variables: {
|
|
26
26
|
query: searchTerm,
|
|
27
27
|
...variables,
|
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
/* eslint-disable eslint-comments/disable-enable-pair */
|
|
2
|
+
/* eslint-disable eslint-comments/no-unlimited-disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import * as CustomerAccountAPI from '@shopify/hydrogen/customer-account-api-types';
|
|
5
|
+
|
|
6
|
+
export type CustomerAddressUpdateMutationVariables = CustomerAccountAPI.Exact<{
|
|
7
|
+
address: CustomerAccountAPI.CustomerAddressInput;
|
|
8
|
+
addressId: CustomerAccountAPI.Scalars['ID']['input'];
|
|
9
|
+
defaultAddress?: CustomerAccountAPI.InputMaybe<
|
|
10
|
+
CustomerAccountAPI.Scalars['Boolean']['input']
|
|
11
|
+
>;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export type CustomerAddressUpdateMutation = {
|
|
15
|
+
customerAddressUpdate?: CustomerAccountAPI.Maybe<{
|
|
16
|
+
customerAddress?: CustomerAccountAPI.Maybe<
|
|
17
|
+
Pick<CustomerAccountAPI.CustomerAddress, 'id'>
|
|
18
|
+
>;
|
|
19
|
+
userErrors: Array<
|
|
20
|
+
Pick<
|
|
21
|
+
CustomerAccountAPI.UserErrorsCustomerAddressUserErrors,
|
|
22
|
+
'code' | 'field' | 'message'
|
|
23
|
+
>
|
|
24
|
+
>;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type CustomerAddressDeleteMutationVariables = CustomerAccountAPI.Exact<{
|
|
29
|
+
addressId: CustomerAccountAPI.Scalars['ID']['input'];
|
|
30
|
+
}>;
|
|
31
|
+
|
|
32
|
+
export type CustomerAddressDeleteMutation = {
|
|
33
|
+
customerAddressDelete?: CustomerAccountAPI.Maybe<
|
|
34
|
+
Pick<
|
|
35
|
+
CustomerAccountAPI.CustomerAddressDeletePayload,
|
|
36
|
+
'deletedAddressId'
|
|
37
|
+
> & {
|
|
38
|
+
userErrors: Array<
|
|
39
|
+
Pick<
|
|
40
|
+
CustomerAccountAPI.UserErrorsCustomerAddressUserErrors,
|
|
41
|
+
'code' | 'field' | 'message'
|
|
42
|
+
>
|
|
43
|
+
>;
|
|
44
|
+
}
|
|
45
|
+
>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type CustomerAddressCreateMutationVariables = CustomerAccountAPI.Exact<{
|
|
49
|
+
address: CustomerAccountAPI.CustomerAddressInput;
|
|
50
|
+
defaultAddress?: CustomerAccountAPI.InputMaybe<
|
|
51
|
+
CustomerAccountAPI.Scalars['Boolean']['input']
|
|
52
|
+
>;
|
|
53
|
+
}>;
|
|
54
|
+
|
|
55
|
+
export type CustomerAddressCreateMutation = {
|
|
56
|
+
customerAddressCreate?: CustomerAccountAPI.Maybe<{
|
|
57
|
+
customerAddress?: CustomerAccountAPI.Maybe<
|
|
58
|
+
Pick<CustomerAccountAPI.CustomerAddress, 'id'>
|
|
59
|
+
>;
|
|
60
|
+
userErrors: Array<
|
|
61
|
+
Pick<
|
|
62
|
+
CustomerAccountAPI.UserErrorsCustomerAddressUserErrors,
|
|
63
|
+
'code' | 'field' | 'message'
|
|
64
|
+
>
|
|
65
|
+
>;
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type CustomerFragment = Pick<
|
|
70
|
+
CustomerAccountAPI.Customer,
|
|
71
|
+
'firstName' | 'lastName'
|
|
72
|
+
> & {
|
|
73
|
+
defaultAddress?: CustomerAccountAPI.Maybe<
|
|
74
|
+
Pick<
|
|
75
|
+
CustomerAccountAPI.CustomerAddress,
|
|
76
|
+
| 'id'
|
|
77
|
+
| 'formatted'
|
|
78
|
+
| 'firstName'
|
|
79
|
+
| 'lastName'
|
|
80
|
+
| 'company'
|
|
81
|
+
| 'address1'
|
|
82
|
+
| 'address2'
|
|
83
|
+
| 'territoryCode'
|
|
84
|
+
| 'zoneCode'
|
|
85
|
+
| 'city'
|
|
86
|
+
| 'zip'
|
|
87
|
+
| 'phoneNumber'
|
|
88
|
+
>
|
|
89
|
+
>;
|
|
90
|
+
addresses: {
|
|
91
|
+
nodes: Array<
|
|
92
|
+
Pick<
|
|
93
|
+
CustomerAccountAPI.CustomerAddress,
|
|
94
|
+
| 'id'
|
|
95
|
+
| 'formatted'
|
|
96
|
+
| 'firstName'
|
|
97
|
+
| 'lastName'
|
|
98
|
+
| 'company'
|
|
99
|
+
| 'address1'
|
|
100
|
+
| 'address2'
|
|
101
|
+
| 'territoryCode'
|
|
102
|
+
| 'zoneCode'
|
|
103
|
+
| 'city'
|
|
104
|
+
| 'zip'
|
|
105
|
+
| 'phoneNumber'
|
|
106
|
+
>
|
|
107
|
+
>;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export type AddressFragment = Pick<
|
|
112
|
+
CustomerAccountAPI.CustomerAddress,
|
|
113
|
+
| 'id'
|
|
114
|
+
| 'formatted'
|
|
115
|
+
| 'firstName'
|
|
116
|
+
| 'lastName'
|
|
117
|
+
| 'company'
|
|
118
|
+
| 'address1'
|
|
119
|
+
| 'address2'
|
|
120
|
+
| 'territoryCode'
|
|
121
|
+
| 'zoneCode'
|
|
122
|
+
| 'city'
|
|
123
|
+
| 'zip'
|
|
124
|
+
| 'phoneNumber'
|
|
125
|
+
>;
|
|
126
|
+
|
|
127
|
+
export type CustomerDetailsQueryVariables = CustomerAccountAPI.Exact<{
|
|
128
|
+
[key: string]: never;
|
|
129
|
+
}>;
|
|
130
|
+
|
|
131
|
+
export type CustomerDetailsQuery = {
|
|
132
|
+
customer: Pick<CustomerAccountAPI.Customer, 'firstName' | 'lastName'> & {
|
|
133
|
+
defaultAddress?: CustomerAccountAPI.Maybe<
|
|
134
|
+
Pick<
|
|
135
|
+
CustomerAccountAPI.CustomerAddress,
|
|
136
|
+
| 'id'
|
|
137
|
+
| 'formatted'
|
|
138
|
+
| 'firstName'
|
|
139
|
+
| 'lastName'
|
|
140
|
+
| 'company'
|
|
141
|
+
| 'address1'
|
|
142
|
+
| 'address2'
|
|
143
|
+
| 'territoryCode'
|
|
144
|
+
| 'zoneCode'
|
|
145
|
+
| 'city'
|
|
146
|
+
| 'zip'
|
|
147
|
+
| 'phoneNumber'
|
|
148
|
+
>
|
|
149
|
+
>;
|
|
150
|
+
addresses: {
|
|
151
|
+
nodes: Array<
|
|
152
|
+
Pick<
|
|
153
|
+
CustomerAccountAPI.CustomerAddress,
|
|
154
|
+
| 'id'
|
|
155
|
+
| 'formatted'
|
|
156
|
+
| 'firstName'
|
|
157
|
+
| 'lastName'
|
|
158
|
+
| 'company'
|
|
159
|
+
| 'address1'
|
|
160
|
+
| 'address2'
|
|
161
|
+
| 'territoryCode'
|
|
162
|
+
| 'zoneCode'
|
|
163
|
+
| 'city'
|
|
164
|
+
| 'zip'
|
|
165
|
+
| 'phoneNumber'
|
|
166
|
+
>
|
|
167
|
+
>;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export type OrderMoneyFragment = Pick<
|
|
173
|
+
CustomerAccountAPI.MoneyV2,
|
|
174
|
+
'amount' | 'currencyCode'
|
|
175
|
+
>;
|
|
176
|
+
|
|
177
|
+
export type DiscountApplicationFragment = {
|
|
178
|
+
value:
|
|
179
|
+
| ({__typename: 'MoneyV2'} & Pick<
|
|
180
|
+
CustomerAccountAPI.MoneyV2,
|
|
181
|
+
'amount' | 'currencyCode'
|
|
182
|
+
>)
|
|
183
|
+
| ({__typename: 'PricingPercentageValue'} & Pick<
|
|
184
|
+
CustomerAccountAPI.PricingPercentageValue,
|
|
185
|
+
'percentage'
|
|
186
|
+
>);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export type OrderLineItemFullFragment = Pick<
|
|
190
|
+
CustomerAccountAPI.LineItem,
|
|
191
|
+
'id' | 'title' | 'quantity' | 'variantTitle'
|
|
192
|
+
> & {
|
|
193
|
+
price?: CustomerAccountAPI.Maybe<
|
|
194
|
+
Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>
|
|
195
|
+
>;
|
|
196
|
+
discountAllocations: Array<{
|
|
197
|
+
allocatedAmount: Pick<
|
|
198
|
+
CustomerAccountAPI.MoneyV2,
|
|
199
|
+
'amount' | 'currencyCode'
|
|
200
|
+
>;
|
|
201
|
+
discountApplication: {
|
|
202
|
+
value:
|
|
203
|
+
| ({__typename: 'MoneyV2'} & Pick<
|
|
204
|
+
CustomerAccountAPI.MoneyV2,
|
|
205
|
+
'amount' | 'currencyCode'
|
|
206
|
+
>)
|
|
207
|
+
| ({__typename: 'PricingPercentageValue'} & Pick<
|
|
208
|
+
CustomerAccountAPI.PricingPercentageValue,
|
|
209
|
+
'percentage'
|
|
210
|
+
>);
|
|
211
|
+
};
|
|
212
|
+
}>;
|
|
213
|
+
totalDiscount: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
|
|
214
|
+
image?: CustomerAccountAPI.Maybe<
|
|
215
|
+
Pick<
|
|
216
|
+
CustomerAccountAPI.Image,
|
|
217
|
+
'altText' | 'height' | 'url' | 'id' | 'width'
|
|
218
|
+
>
|
|
219
|
+
>;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export type OrderFragment = Pick<
|
|
223
|
+
CustomerAccountAPI.Order,
|
|
224
|
+
'id' | 'name' | 'statusPageUrl' | 'processedAt'
|
|
225
|
+
> & {
|
|
226
|
+
fulfillments: {nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>};
|
|
227
|
+
totalTax?: CustomerAccountAPI.Maybe<
|
|
228
|
+
Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>
|
|
229
|
+
>;
|
|
230
|
+
totalPrice: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
|
|
231
|
+
subtotal?: CustomerAccountAPI.Maybe<
|
|
232
|
+
Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>
|
|
233
|
+
>;
|
|
234
|
+
shippingAddress?: CustomerAccountAPI.Maybe<
|
|
235
|
+
Pick<
|
|
236
|
+
CustomerAccountAPI.CustomerAddress,
|
|
237
|
+
'name' | 'formatted' | 'formattedArea'
|
|
238
|
+
>
|
|
239
|
+
>;
|
|
240
|
+
discountApplications: {
|
|
241
|
+
nodes: Array<{
|
|
242
|
+
value:
|
|
243
|
+
| ({__typename: 'MoneyV2'} & Pick<
|
|
244
|
+
CustomerAccountAPI.MoneyV2,
|
|
245
|
+
'amount' | 'currencyCode'
|
|
246
|
+
>)
|
|
247
|
+
| ({__typename: 'PricingPercentageValue'} & Pick<
|
|
248
|
+
CustomerAccountAPI.PricingPercentageValue,
|
|
249
|
+
'percentage'
|
|
250
|
+
>);
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
253
|
+
lineItems: {
|
|
254
|
+
nodes: Array<
|
|
255
|
+
Pick<
|
|
256
|
+
CustomerAccountAPI.LineItem,
|
|
257
|
+
'id' | 'title' | 'quantity' | 'variantTitle'
|
|
258
|
+
> & {
|
|
259
|
+
price?: CustomerAccountAPI.Maybe<
|
|
260
|
+
Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>
|
|
261
|
+
>;
|
|
262
|
+
discountAllocations: Array<{
|
|
263
|
+
allocatedAmount: Pick<
|
|
264
|
+
CustomerAccountAPI.MoneyV2,
|
|
265
|
+
'amount' | 'currencyCode'
|
|
266
|
+
>;
|
|
267
|
+
discountApplication: {
|
|
268
|
+
value:
|
|
269
|
+
| ({__typename: 'MoneyV2'} & Pick<
|
|
270
|
+
CustomerAccountAPI.MoneyV2,
|
|
271
|
+
'amount' | 'currencyCode'
|
|
272
|
+
>)
|
|
273
|
+
| ({__typename: 'PricingPercentageValue'} & Pick<
|
|
274
|
+
CustomerAccountAPI.PricingPercentageValue,
|
|
275
|
+
'percentage'
|
|
276
|
+
>);
|
|
277
|
+
};
|
|
278
|
+
}>;
|
|
279
|
+
totalDiscount: Pick<
|
|
280
|
+
CustomerAccountAPI.MoneyV2,
|
|
281
|
+
'amount' | 'currencyCode'
|
|
282
|
+
>;
|
|
283
|
+
image?: CustomerAccountAPI.Maybe<
|
|
284
|
+
Pick<
|
|
285
|
+
CustomerAccountAPI.Image,
|
|
286
|
+
'altText' | 'height' | 'url' | 'id' | 'width'
|
|
287
|
+
>
|
|
288
|
+
>;
|
|
289
|
+
}
|
|
290
|
+
>;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export type OrderQueryVariables = CustomerAccountAPI.Exact<{
|
|
295
|
+
orderId: CustomerAccountAPI.Scalars['ID']['input'];
|
|
296
|
+
}>;
|
|
297
|
+
|
|
298
|
+
export type OrderQuery = {
|
|
299
|
+
order?: CustomerAccountAPI.Maybe<
|
|
300
|
+
Pick<
|
|
301
|
+
CustomerAccountAPI.Order,
|
|
302
|
+
'id' | 'name' | 'statusPageUrl' | 'processedAt'
|
|
303
|
+
> & {
|
|
304
|
+
fulfillments: {
|
|
305
|
+
nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>;
|
|
306
|
+
};
|
|
307
|
+
totalTax?: CustomerAccountAPI.Maybe<
|
|
308
|
+
Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>
|
|
309
|
+
>;
|
|
310
|
+
totalPrice: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
|
|
311
|
+
subtotal?: CustomerAccountAPI.Maybe<
|
|
312
|
+
Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>
|
|
313
|
+
>;
|
|
314
|
+
shippingAddress?: CustomerAccountAPI.Maybe<
|
|
315
|
+
Pick<
|
|
316
|
+
CustomerAccountAPI.CustomerAddress,
|
|
317
|
+
'name' | 'formatted' | 'formattedArea'
|
|
318
|
+
>
|
|
319
|
+
>;
|
|
320
|
+
discountApplications: {
|
|
321
|
+
nodes: Array<{
|
|
322
|
+
value:
|
|
323
|
+
| ({__typename: 'MoneyV2'} & Pick<
|
|
324
|
+
CustomerAccountAPI.MoneyV2,
|
|
325
|
+
'amount' | 'currencyCode'
|
|
326
|
+
>)
|
|
327
|
+
| ({__typename: 'PricingPercentageValue'} & Pick<
|
|
328
|
+
CustomerAccountAPI.PricingPercentageValue,
|
|
329
|
+
'percentage'
|
|
330
|
+
>);
|
|
331
|
+
}>;
|
|
332
|
+
};
|
|
333
|
+
lineItems: {
|
|
334
|
+
nodes: Array<
|
|
335
|
+
Pick<
|
|
336
|
+
CustomerAccountAPI.LineItem,
|
|
337
|
+
'id' | 'title' | 'quantity' | 'variantTitle'
|
|
338
|
+
> & {
|
|
339
|
+
price?: CustomerAccountAPI.Maybe<
|
|
340
|
+
Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>
|
|
341
|
+
>;
|
|
342
|
+
discountAllocations: Array<{
|
|
343
|
+
allocatedAmount: Pick<
|
|
344
|
+
CustomerAccountAPI.MoneyV2,
|
|
345
|
+
'amount' | 'currencyCode'
|
|
346
|
+
>;
|
|
347
|
+
discountApplication: {
|
|
348
|
+
value:
|
|
349
|
+
| ({__typename: 'MoneyV2'} & Pick<
|
|
350
|
+
CustomerAccountAPI.MoneyV2,
|
|
351
|
+
'amount' | 'currencyCode'
|
|
352
|
+
>)
|
|
353
|
+
| ({__typename: 'PricingPercentageValue'} & Pick<
|
|
354
|
+
CustomerAccountAPI.PricingPercentageValue,
|
|
355
|
+
'percentage'
|
|
356
|
+
>);
|
|
357
|
+
};
|
|
358
|
+
}>;
|
|
359
|
+
totalDiscount: Pick<
|
|
360
|
+
CustomerAccountAPI.MoneyV2,
|
|
361
|
+
'amount' | 'currencyCode'
|
|
362
|
+
>;
|
|
363
|
+
image?: CustomerAccountAPI.Maybe<
|
|
364
|
+
Pick<
|
|
365
|
+
CustomerAccountAPI.Image,
|
|
366
|
+
'altText' | 'height' | 'url' | 'id' | 'width'
|
|
367
|
+
>
|
|
368
|
+
>;
|
|
369
|
+
}
|
|
370
|
+
>;
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
>;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export type OrderItemFragment = Pick<
|
|
377
|
+
CustomerAccountAPI.Order,
|
|
378
|
+
'financialStatus' | 'id' | 'number' | 'processedAt'
|
|
379
|
+
> & {
|
|
380
|
+
totalPrice: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
|
|
381
|
+
fulfillments: {nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>};
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
export type CustomerOrdersFragment = {
|
|
385
|
+
orders: {
|
|
386
|
+
nodes: Array<
|
|
387
|
+
Pick<
|
|
388
|
+
CustomerAccountAPI.Order,
|
|
389
|
+
'financialStatus' | 'id' | 'number' | 'processedAt'
|
|
390
|
+
> & {
|
|
391
|
+
totalPrice: Pick<CustomerAccountAPI.MoneyV2, 'amount' | 'currencyCode'>;
|
|
392
|
+
fulfillments: {
|
|
393
|
+
nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>;
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
>;
|
|
397
|
+
pageInfo: Pick<
|
|
398
|
+
CustomerAccountAPI.PageInfo,
|
|
399
|
+
'hasPreviousPage' | 'hasNextPage' | 'endCursor' | 'startCursor'
|
|
400
|
+
>;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
export type CustomerOrdersQueryVariables = CustomerAccountAPI.Exact<{
|
|
405
|
+
endCursor?: CustomerAccountAPI.InputMaybe<
|
|
406
|
+
CustomerAccountAPI.Scalars['String']['input']
|
|
407
|
+
>;
|
|
408
|
+
first?: CustomerAccountAPI.InputMaybe<
|
|
409
|
+
CustomerAccountAPI.Scalars['Int']['input']
|
|
410
|
+
>;
|
|
411
|
+
last?: CustomerAccountAPI.InputMaybe<
|
|
412
|
+
CustomerAccountAPI.Scalars['Int']['input']
|
|
413
|
+
>;
|
|
414
|
+
startCursor?: CustomerAccountAPI.InputMaybe<
|
|
415
|
+
CustomerAccountAPI.Scalars['String']['input']
|
|
416
|
+
>;
|
|
417
|
+
}>;
|
|
418
|
+
|
|
419
|
+
export type CustomerOrdersQuery = {
|
|
420
|
+
customer: {
|
|
421
|
+
orders: {
|
|
422
|
+
nodes: Array<
|
|
423
|
+
Pick<
|
|
424
|
+
CustomerAccountAPI.Order,
|
|
425
|
+
'financialStatus' | 'id' | 'number' | 'processedAt'
|
|
426
|
+
> & {
|
|
427
|
+
totalPrice: Pick<
|
|
428
|
+
CustomerAccountAPI.MoneyV2,
|
|
429
|
+
'amount' | 'currencyCode'
|
|
430
|
+
>;
|
|
431
|
+
fulfillments: {
|
|
432
|
+
nodes: Array<Pick<CustomerAccountAPI.Fulfillment, 'status'>>;
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
>;
|
|
436
|
+
pageInfo: Pick<
|
|
437
|
+
CustomerAccountAPI.PageInfo,
|
|
438
|
+
'hasPreviousPage' | 'hasNextPage' | 'endCursor' | 'startCursor'
|
|
439
|
+
>;
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
export type CustomerUpdateMutationVariables = CustomerAccountAPI.Exact<{
|
|
445
|
+
customer: CustomerAccountAPI.CustomerUpdateInput;
|
|
446
|
+
}>;
|
|
447
|
+
|
|
448
|
+
export type CustomerUpdateMutation = {
|
|
449
|
+
customerUpdate?: CustomerAccountAPI.Maybe<{
|
|
450
|
+
customer?: CustomerAccountAPI.Maybe<
|
|
451
|
+
Pick<CustomerAccountAPI.Customer, 'firstName' | 'lastName'> & {
|
|
452
|
+
emailAddress?: CustomerAccountAPI.Maybe<
|
|
453
|
+
Pick<CustomerAccountAPI.CustomerEmailAddress, 'emailAddress'>
|
|
454
|
+
>;
|
|
455
|
+
phoneNumber?: CustomerAccountAPI.Maybe<
|
|
456
|
+
Pick<CustomerAccountAPI.CustomerPhoneNumber, 'phoneNumber'>
|
|
457
|
+
>;
|
|
458
|
+
}
|
|
459
|
+
>;
|
|
460
|
+
userErrors: Array<
|
|
461
|
+
Pick<
|
|
462
|
+
CustomerAccountAPI.UserErrorsCustomerUserErrors,
|
|
463
|
+
'code' | 'field' | 'message'
|
|
464
|
+
>
|
|
465
|
+
>;
|
|
466
|
+
}>;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
interface GeneratedQueryTypes {
|
|
470
|
+
'#graphql\n query CustomerDetails {\n customer {\n ...Customer\n }\n }\n #graphql\n fragment Customer on Customer {\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': {
|
|
471
|
+
return: CustomerDetailsQuery;
|
|
472
|
+
variables: CustomerDetailsQueryVariables;
|
|
473
|
+
};
|
|
474
|
+
'#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': {
|
|
475
|
+
return: OrderQuery;
|
|
476
|
+
variables: OrderQueryVariables;
|
|
477
|
+
};
|
|
478
|
+
'#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': {
|
|
479
|
+
return: CustomerOrdersQuery;
|
|
480
|
+
variables: CustomerOrdersQueryVariables;
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
interface GeneratedMutationTypes {
|
|
485
|
+
'#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': {
|
|
486
|
+
return: CustomerAddressUpdateMutation;
|
|
487
|
+
variables: CustomerAddressUpdateMutationVariables;
|
|
488
|
+
};
|
|
489
|
+
'#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': {
|
|
490
|
+
return: CustomerAddressDeleteMutation;
|
|
491
|
+
variables: CustomerAddressDeleteMutationVariables;
|
|
492
|
+
};
|
|
493
|
+
'#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': {
|
|
494
|
+
return: CustomerAddressCreateMutation;
|
|
495
|
+
variables: CustomerAddressCreateMutationVariables;
|
|
496
|
+
};
|
|
497
|
+
'#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': {
|
|
498
|
+
return: CustomerUpdateMutation;
|
|
499
|
+
variables: CustomerUpdateMutationVariables;
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
declare module '@shopify/hydrogen' {
|
|
504
|
+
interface CustomerAccountQueries extends GeneratedQueryTypes {}
|
|
505
|
+
interface CustomerAccountMutations extends GeneratedMutationTypes {}
|
|
506
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "skeleton",
|
|
3
3
|
"private": true,
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.2",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "shopify hydrogen build",
|
|
8
8
|
"dev": "shopify hydrogen dev --codegen",
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"prettier": "@shopify/prettier-config",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@remix-run/react": "2.1
|
|
17
|
-
"@
|
|
18
|
-
"@shopify/cli
|
|
19
|
-
"@shopify/hydrogen": "^
|
|
20
|
-
"@shopify/
|
|
16
|
+
"@remix-run/react": "^2.5.1",
|
|
17
|
+
"@remix-run/server-runtime": "^2.5.1",
|
|
18
|
+
"@shopify/cli": "3.52.0",
|
|
19
|
+
"@shopify/cli-hydrogen": "^7.0.0",
|
|
20
|
+
"@shopify/hydrogen": "~2024.1.0",
|
|
21
|
+
"@shopify/remix-oxygen": "^2.0.3",
|
|
21
22
|
"graphql": "^16.6.0",
|
|
22
23
|
"graphql-tag": "^2.12.6",
|
|
23
24
|
"isbot": "^3.6.6",
|
|
@@ -25,9 +26,9 @@
|
|
|
25
26
|
"react-dom": "^18.2.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@remix-run/dev": "2.1
|
|
29
|
-
"@remix-run/eslint-config": "2.1
|
|
30
|
-
"@shopify/oxygen-workers-types": "^
|
|
29
|
+
"@remix-run/dev": "^2.5.1",
|
|
30
|
+
"@remix-run/eslint-config": "^2.5.1",
|
|
31
|
+
"@shopify/oxygen-workers-types": "^4.0.0",
|
|
31
32
|
"@shopify/prettier-config": "^1.1.2",
|
|
32
33
|
"@total-typescript/ts-reset": "^0.4.2",
|
|
33
34
|
"@types/eslint": "^8.4.10",
|
|
@@ -39,6 +40,6 @@
|
|
|
39
40
|
"typescript": "^5.2.2"
|
|
40
41
|
},
|
|
41
42
|
"engines": {
|
|
42
|
-
"node": ">=
|
|
43
|
+
"node": ">=18.0.0"
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
// Enhance TypeScript's built-in typings.
|
|
6
6
|
import '@total-typescript/ts-reset';
|
|
7
7
|
|
|
8
|
-
import type {Storefront, HydrogenCart} from '@shopify/hydrogen';
|
|
9
|
-
import type {
|
|
10
|
-
import type {HydrogenSession} from './server';
|
|
8
|
+
import type {Storefront, CustomerClient, HydrogenCart} from '@shopify/hydrogen';
|
|
9
|
+
import type {AppSession} from '~/lib/session';
|
|
11
10
|
|
|
12
11
|
declare global {
|
|
13
12
|
/**
|
|
@@ -24,6 +23,8 @@ declare global {
|
|
|
24
23
|
PRIVATE_STOREFRONT_API_TOKEN: string;
|
|
25
24
|
PUBLIC_STORE_DOMAIN: string;
|
|
26
25
|
PUBLIC_STOREFRONT_ID: string;
|
|
26
|
+
PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID: string;
|
|
27
|
+
PUBLIC_CUSTOMER_ACCOUNT_API_URL: string;
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -35,14 +36,8 @@ declare module '@shopify/remix-oxygen' {
|
|
|
35
36
|
env: Env;
|
|
36
37
|
cart: HydrogenCart;
|
|
37
38
|
storefront: Storefront;
|
|
38
|
-
|
|
39
|
+
customerAccount: CustomerClient;
|
|
40
|
+
session: AppSession;
|
|
39
41
|
waitUntil: ExecutionContext['waitUntil'];
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Declare the data we expect to access via `context.session`.
|
|
44
|
-
*/
|
|
45
|
-
export interface SessionData {
|
|
46
|
-
customerAccessToken: CustomerAccessToken;
|
|
47
|
-
}
|
|
48
43
|
}
|