@shopify/hydrogen 1.6.3 → 1.6.4
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/esnext/components/CartProvider/CartProvider.client.d.ts +0 -1
- package/dist/esnext/components/CartProvider/CartProvider.client.js +1 -100
- package/dist/esnext/entry-server.js +1 -1
- package/dist/esnext/foundation/Form/Form.client.d.ts +4 -1
- package/dist/esnext/streaming.server.js +1 -1
- package/dist/esnext/utilities/parse.d.ts +1 -3
- package/dist/esnext/utilities/parse.js +9 -6
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/package.json +1 -1
|
@@ -47,4 +47,3 @@ export declare function CartProvider({ children, numCartLines, onCreate, onLineA
|
|
|
47
47
|
/** The ISO country code for i18n. */
|
|
48
48
|
countryCode?: CountryCode;
|
|
49
49
|
}): JSX.Element;
|
|
50
|
-
export declare const defaultCartFragment = "\nfragment CartFragment on Cart {\n id\n checkoutUrl\n totalQuantity\n buyerIdentity {\n countryCode\n customer {\n id\n email\n firstName\n lastName\n displayName\n }\n email\n phone\n }\n lines(first: $numCartLines) {\n edges {\n node {\n id\n quantity\n attributes {\n key\n value\n }\n cost {\n totalAmount {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n availableForSale\n compareAtPriceV2 {\n ...MoneyFragment\n }\n priceV2 {\n ...MoneyFragment\n }\n requiresShipping\n title\n image {\n ...ImageFragment\n }\n product {\n handle\n title\n }\n selectedOptions {\n name\n value\n }\n }\n }\n }\n }\n }\n cost {\n subtotalAmount {\n ...MoneyFragment\n }\n totalAmount {\n ...MoneyFragment\n }\n totalDutyAmount {\n ...MoneyFragment\n }\n totalTaxAmount {\n ...MoneyFragment\n }\n }\n note\n attributes {\n key\n value\n }\n discountCodes {\n code\n }\n}\n\nfragment MoneyFragment on MoneyV2 {\n currencyCode\n amount\n}\nfragment ImageFragment on Image {\n id\n url\n altText\n width\n height\n}\n";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef, useState, useTransition, } from 'react';
|
|
2
2
|
import { CountryCode, } from '../../storefront-api-types.js';
|
|
3
|
+
import { defaultCartFragment } from './cart-queries.js';
|
|
3
4
|
import { CartContext } from './context.js';
|
|
4
5
|
import { useCartAPIStateMachine } from './useCartAPIStateMachine.client.js';
|
|
5
6
|
import { CART_ID_STORAGE_KEY } from './constants.js';
|
|
@@ -432,103 +433,3 @@ function publishDiscountCodesUpdateAnalytics(context, event) {
|
|
|
432
433
|
prevCart: context.prevCart,
|
|
433
434
|
});
|
|
434
435
|
}
|
|
435
|
-
export const defaultCartFragment = `
|
|
436
|
-
fragment CartFragment on Cart {
|
|
437
|
-
id
|
|
438
|
-
checkoutUrl
|
|
439
|
-
totalQuantity
|
|
440
|
-
buyerIdentity {
|
|
441
|
-
countryCode
|
|
442
|
-
customer {
|
|
443
|
-
id
|
|
444
|
-
email
|
|
445
|
-
firstName
|
|
446
|
-
lastName
|
|
447
|
-
displayName
|
|
448
|
-
}
|
|
449
|
-
email
|
|
450
|
-
phone
|
|
451
|
-
}
|
|
452
|
-
lines(first: $numCartLines) {
|
|
453
|
-
edges {
|
|
454
|
-
node {
|
|
455
|
-
id
|
|
456
|
-
quantity
|
|
457
|
-
attributes {
|
|
458
|
-
key
|
|
459
|
-
value
|
|
460
|
-
}
|
|
461
|
-
cost {
|
|
462
|
-
totalAmount {
|
|
463
|
-
amount
|
|
464
|
-
currencyCode
|
|
465
|
-
}
|
|
466
|
-
compareAtAmountPerQuantity {
|
|
467
|
-
amount
|
|
468
|
-
currencyCode
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
merchandise {
|
|
472
|
-
... on ProductVariant {
|
|
473
|
-
id
|
|
474
|
-
availableForSale
|
|
475
|
-
compareAtPriceV2 {
|
|
476
|
-
...MoneyFragment
|
|
477
|
-
}
|
|
478
|
-
priceV2 {
|
|
479
|
-
...MoneyFragment
|
|
480
|
-
}
|
|
481
|
-
requiresShipping
|
|
482
|
-
title
|
|
483
|
-
image {
|
|
484
|
-
...ImageFragment
|
|
485
|
-
}
|
|
486
|
-
product {
|
|
487
|
-
handle
|
|
488
|
-
title
|
|
489
|
-
}
|
|
490
|
-
selectedOptions {
|
|
491
|
-
name
|
|
492
|
-
value
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
cost {
|
|
500
|
-
subtotalAmount {
|
|
501
|
-
...MoneyFragment
|
|
502
|
-
}
|
|
503
|
-
totalAmount {
|
|
504
|
-
...MoneyFragment
|
|
505
|
-
}
|
|
506
|
-
totalDutyAmount {
|
|
507
|
-
...MoneyFragment
|
|
508
|
-
}
|
|
509
|
-
totalTaxAmount {
|
|
510
|
-
...MoneyFragment
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
note
|
|
514
|
-
attributes {
|
|
515
|
-
key
|
|
516
|
-
value
|
|
517
|
-
}
|
|
518
|
-
discountCodes {
|
|
519
|
-
code
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
fragment MoneyFragment on MoneyV2 {
|
|
524
|
-
currencyCode
|
|
525
|
-
amount
|
|
526
|
-
}
|
|
527
|
-
fragment ImageFragment on Image {
|
|
528
|
-
id
|
|
529
|
-
url
|
|
530
|
-
altText
|
|
531
|
-
width
|
|
532
|
-
height
|
|
533
|
-
}
|
|
534
|
-
`;
|
|
@@ -573,7 +573,7 @@ function tagOnWrite(response) {
|
|
|
573
573
|
const savedChunks = [];
|
|
574
574
|
response.write = (arg) => {
|
|
575
575
|
if (arg instanceof Uint8Array) {
|
|
576
|
-
savedChunks.push(decoder.decode(arg));
|
|
576
|
+
savedChunks.push(decoder.decode(arg, { stream: true }));
|
|
577
577
|
}
|
|
578
578
|
else {
|
|
579
579
|
savedChunks.push(arg);
|
|
@@ -2,7 +2,10 @@ import React, { FormEvent } from 'react';
|
|
|
2
2
|
interface FormProps {
|
|
3
3
|
action: string;
|
|
4
4
|
method?: string;
|
|
5
|
-
children?: Array<React.ReactNode
|
|
5
|
+
children?: Array<React.ReactNode> | ((props: {
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: Error | null;
|
|
8
|
+
}) => React.ReactNode);
|
|
6
9
|
onSubmit?: (e: FormEvent<HTMLFormElement>) => void;
|
|
7
10
|
encType?: string;
|
|
8
11
|
noValidate?: boolean;
|
|
@@ -14,7 +14,7 @@ export async function bufferReadableStream(reader, cb) {
|
|
|
14
14
|
const { done, value } = await reader.read();
|
|
15
15
|
if (done)
|
|
16
16
|
break;
|
|
17
|
-
const stringValue = typeof value === 'string' ? value : decoder.decode(value);
|
|
17
|
+
const stringValue = typeof value === 'string' ? value : decoder.decode(value, { stream: true });
|
|
18
18
|
result += stringValue;
|
|
19
19
|
if (cb) {
|
|
20
20
|
cb(stringValue);
|
|
@@ -11,13 +11,16 @@ function noproto(k, v) {
|
|
|
11
11
|
export function parseState(url) {
|
|
12
12
|
try {
|
|
13
13
|
const { pathname, search } = url;
|
|
14
|
+
const stateParam = url.searchParams.get('state');
|
|
14
15
|
const state = pathname === RSC_PATHNAME
|
|
15
|
-
?
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
? stateParam
|
|
17
|
+
? parseJSON(decodeURIComponent(stateParam))
|
|
18
|
+
: {}
|
|
19
|
+
: {
|
|
20
|
+
pathname: decodeURIComponent(pathname),
|
|
21
|
+
search: decodeURIComponent(search),
|
|
22
|
+
};
|
|
23
|
+
return state;
|
|
21
24
|
}
|
|
22
25
|
catch {
|
|
23
26
|
// Do not throw to prevent unhandled errors
|
package/dist/esnext/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.6.
|
|
1
|
+
export declare const LIB_VERSION = "1.6.4";
|
package/dist/esnext/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = '1.6.
|
|
1
|
+
export const LIB_VERSION = '1.6.4';
|