@shopify/hydrogen 0.13.2 → 0.14.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/esnext/components/Link/Link.client.d.ts +6 -0
  3. package/dist/esnext/components/Link/Link.client.js +85 -3
  4. package/dist/esnext/components/LocalizationProvider/LocalizationContext.client.d.ts +1 -1
  5. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.d.ts +16 -0
  6. package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +7 -2
  7. package/dist/esnext/components/Seo/DefaultPageSeo.client.js +1 -2
  8. package/dist/esnext/entry-client.js +14 -1
  9. package/dist/esnext/entry-server.js +13 -8
  10. package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.d.ts +6 -1
  11. package/dist/esnext/foundation/ServerStateProvider/ServerStateProvider.js +27 -22
  12. package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +4 -1
  13. package/dist/esnext/foundation/ShopifyProvider/types.d.ts +3 -1
  14. package/dist/esnext/foundation/constants.d.ts +1 -1
  15. package/dist/esnext/foundation/constants.js +1 -1
  16. package/dist/esnext/framework/Hydration/ServerComponentRequest.server.js +3 -2
  17. package/dist/esnext/framework/cache.d.ts +0 -8
  18. package/dist/esnext/framework/cache.js +0 -8
  19. package/dist/esnext/hooks/useParsedMetafields/useParsedMetafields.d.ts +1 -1
  20. package/dist/esnext/hooks/useShopQuery/hooks.d.ts +1 -1
  21. package/dist/esnext/hooks/useShopQuery/hooks.js +17 -9
  22. package/dist/esnext/storefront-api-types.d.ts +150 -3
  23. package/dist/esnext/storefront-api-types.js +16 -0
  24. package/dist/esnext/version.d.ts +1 -1
  25. package/dist/esnext/version.js +1 -1
  26. package/dist/node/entry-server.js +13 -8
  27. package/dist/node/foundation/ServerStateProvider/ServerStateProvider.d.ts +6 -1
  28. package/dist/node/foundation/ServerStateProvider/ServerStateProvider.js +27 -22
  29. package/dist/node/foundation/ShopifyProvider/types.d.ts +3 -1
  30. package/dist/node/framework/Hydration/ServerComponentRequest.server.js +3 -2
  31. package/dist/node/framework/cache.d.ts +0 -8
  32. package/dist/node/framework/cache.js +1 -10
  33. package/dist/node/storefront-api-types.d.ts +150 -3
  34. package/dist/node/storefront-api-types.js +17 -1
  35. package/dist/node/version.d.ts +1 -1
  36. package/dist/node/version.js +1 -1
  37. package/package.json +3 -3
  38. package/dist/esnext/components/LocalizationProvider/LocalizationQuery.d.ts +0 -23
  39. package/dist/esnext/components/LocalizationProvider/LocalizationQuery.js +0 -1
@@ -215,6 +215,8 @@ export declare type ArticleConnection = {
215
215
  __typename?: 'ArticleConnection';
216
216
  /** A list of edges. */
217
217
  edges: Array<ArticleEdge>;
218
+ /** A list of the nodes contained in ArticleEdge. */
219
+ nodes: Array<Article>;
218
220
  /** Information to aid in pagination. */
219
221
  pageInfo: PageInfo;
220
222
  };
@@ -362,6 +364,8 @@ export declare type BlogConnection = {
362
364
  __typename?: 'BlogConnection';
363
365
  /** A list of edges. */
364
366
  edges: Array<BlogEdge>;
367
+ /** A list of the nodes contained in BlogEdge. */
368
+ nodes: Array<Blog>;
365
369
  /** Information to aid in pagination. */
366
370
  pageInfo: PageInfo;
367
371
  };
@@ -417,6 +421,8 @@ export declare type Cart = Node & {
417
421
  checkoutUrl: Scalars['URL'];
418
422
  /** The date and time when the cart was created. */
419
423
  createdAt: Scalars['DateTime'];
424
+ /** The delivery groups available for the cart, based on the default address of the logged-in customer. */
425
+ deliveryGroups: CartDeliveryGroupConnection;
420
426
  /** The discount codes that have been applied to the cart. */
421
427
  discountCodes: Array<CartDiscountCode>;
422
428
  /** The estimated costs that the buyer will pay at checkout. The estimated costs are subject to change and changes will be reflected at checkout. The `estimatedCost` field uses the `buyerIdentity` field to determine [international pricing](https://shopify.dev/api/examples/international-pricing#create-a-cart). */
@@ -431,6 +437,14 @@ export declare type Cart = Node & {
431
437
  updatedAt: Scalars['DateTime'];
432
438
  };
433
439
  /** A cart represents the merchandise that a buyer intends to purchase, and the estimated cost associated with the cart. To learn how to interact with a cart during a customer's session, refer to [Manage a cart with the Storefront API](https://shopify.dev/api/examples/cart). */
440
+ export declare type CartDeliveryGroupsArgs = {
441
+ after?: InputMaybe<Scalars['String']>;
442
+ before?: InputMaybe<Scalars['String']>;
443
+ first?: InputMaybe<Scalars['Int']>;
444
+ last?: InputMaybe<Scalars['Int']>;
445
+ reverse?: InputMaybe<Scalars['Boolean']>;
446
+ };
447
+ /** A cart represents the merchandise that a buyer intends to purchase, and the estimated cost associated with the cart. To learn how to interact with a cart during a customer's session, refer to [Manage a cart with the Storefront API](https://shopify.dev/api/examples/cart). */
434
448
  export declare type CartLinesArgs = {
435
449
  after?: InputMaybe<Scalars['String']>;
436
450
  before?: InputMaybe<Scalars['String']>;
@@ -507,6 +521,64 @@ export declare type CartCreatePayload = {
507
521
  /** The list of errors that occurred from executing the mutation. */
508
522
  userErrors: Array<CartUserError>;
509
523
  };
524
+ /** Information about the options available for one or more line items to be delivered to a specific address. */
525
+ export declare type CartDeliveryGroup = {
526
+ __typename?: 'CartDeliveryGroup';
527
+ /** A list of cart lines for the delivery group. */
528
+ cartLines: CartLineConnection;
529
+ /** The destination address for the delivery group. */
530
+ deliveryAddress: MailingAddress;
531
+ /** The delivery options available for the delivery group. */
532
+ deliveryOptions: Array<CartDeliveryOption>;
533
+ /** The ID for the delivery group. */
534
+ id: Scalars['ID'];
535
+ };
536
+ /** Information about the options available for one or more line items to be delivered to a specific address. */
537
+ export declare type CartDeliveryGroupCartLinesArgs = {
538
+ after?: InputMaybe<Scalars['String']>;
539
+ before?: InputMaybe<Scalars['String']>;
540
+ first?: InputMaybe<Scalars['Int']>;
541
+ last?: InputMaybe<Scalars['Int']>;
542
+ reverse?: InputMaybe<Scalars['Boolean']>;
543
+ };
544
+ /**
545
+ * An auto-generated type for paginating through multiple CartDeliveryGroups.
546
+ *
547
+ */
548
+ export declare type CartDeliveryGroupConnection = {
549
+ __typename?: 'CartDeliveryGroupConnection';
550
+ /** A list of edges. */
551
+ edges: Array<CartDeliveryGroupEdge>;
552
+ /** A list of the nodes contained in CartDeliveryGroupEdge. */
553
+ nodes: Array<CartDeliveryGroup>;
554
+ /** Information to aid in pagination. */
555
+ pageInfo: PageInfo;
556
+ };
557
+ /**
558
+ * An auto-generated type which holds one CartDeliveryGroup and a cursor during pagination.
559
+ *
560
+ */
561
+ export declare type CartDeliveryGroupEdge = {
562
+ __typename?: 'CartDeliveryGroupEdge';
563
+ /** A cursor for use in pagination. */
564
+ cursor: Scalars['String'];
565
+ /** The item at the end of CartDeliveryGroupEdge. */
566
+ node: CartDeliveryGroup;
567
+ };
568
+ /** Information about a delivery option. */
569
+ export declare type CartDeliveryOption = {
570
+ __typename?: 'CartDeliveryOption';
571
+ /** The code of the delivery option. */
572
+ code?: Maybe<Scalars['String']>;
573
+ /** The method for the delivery option. */
574
+ deliveryMethodType: DeliveryMethodType;
575
+ /** The description of the delivery option. */
576
+ description?: Maybe<Scalars['String']>;
577
+ /** The estimated cost for the delivery option. */
578
+ estimatedCost: MoneyV2;
579
+ /** The title of the delivery option. */
580
+ title?: Maybe<Scalars['String']>;
581
+ };
510
582
  /** The discounts that have been applied to the cart line. */
511
583
  export declare type CartDiscountAllocation = {
512
584
  /** The discounted amount that has been applied to the cart line. */
@@ -597,6 +669,8 @@ export declare type CartLineConnection = {
597
669
  __typename?: 'CartLineConnection';
598
670
  /** A list of edges. */
599
671
  edges: Array<CartLineEdge>;
672
+ /** A list of the nodes contained in CartLineEdge. */
673
+ nodes: Array<CartLine>;
600
674
  /** Information to aid in pagination. */
601
675
  pageInfo: PageInfo;
602
676
  };
@@ -1282,6 +1356,8 @@ export declare type CheckoutLineItemConnection = {
1282
1356
  __typename?: 'CheckoutLineItemConnection';
1283
1357
  /** A list of edges. */
1284
1358
  edges: Array<CheckoutLineItemEdge>;
1359
+ /** A list of the nodes contained in CheckoutLineItemEdge. */
1360
+ nodes: Array<CheckoutLineItem>;
1285
1361
  /** Information to aid in pagination. */
1286
1362
  pageInfo: PageInfo;
1287
1363
  };
@@ -1484,6 +1560,8 @@ export declare type CollectionConnection = {
1484
1560
  __typename?: 'CollectionConnection';
1485
1561
  /** A list of edges. */
1486
1562
  edges: Array<CollectionEdge>;
1563
+ /** A list of the nodes contained in CollectionEdge. */
1564
+ nodes: Array<Collection>;
1487
1565
  /** Information to aid in pagination. */
1488
1566
  pageInfo: PageInfo;
1489
1567
  };
@@ -1545,6 +1623,8 @@ export declare type CommentConnection = {
1545
1623
  __typename?: 'CommentConnection';
1546
1624
  /** A list of edges. */
1547
1625
  edges: Array<CommentEdge>;
1626
+ /** A list of the nodes contained in CommentEdge. */
1627
+ nodes: Array<Comment>;
1548
1628
  /** Information to aid in pagination. */
1549
1629
  pageInfo: PageInfo;
1550
1630
  };
@@ -2845,6 +2925,21 @@ export declare type CustomerUserError = DisplayableError & {
2845
2925
  /** The error message. */
2846
2926
  message: Scalars['String'];
2847
2927
  };
2928
+ /** List of different delivery method types. */
2929
+ export declare enum DeliveryMethodType {
2930
+ /** Local Delivery. */
2931
+ Local = "LOCAL",
2932
+ /** None. */
2933
+ None = "NONE",
2934
+ /** Shipping to a Pickup Point. */
2935
+ PickupPoint = "PICKUP_POINT",
2936
+ /** Local Pickup. */
2937
+ PickUp = "PICK_UP",
2938
+ /** Retail. */
2939
+ Retail = "RETAIL",
2940
+ /** Shipping. */
2941
+ Shipping = "SHIPPING"
2942
+ }
2848
2943
  /** Digital wallet, such as Apple Pay, which can be used for accelerated checkouts. */
2849
2944
  export declare enum DigitalWallet {
2850
2945
  /** Android Pay. */
@@ -2899,6 +2994,8 @@ export declare type DiscountApplicationConnection = {
2899
2994
  __typename?: 'DiscountApplicationConnection';
2900
2995
  /** A list of edges. */
2901
2996
  edges: Array<DiscountApplicationEdge>;
2997
+ /** A list of the nodes contained in DiscountApplicationEdge. */
2998
+ nodes: Array<AutomaticDiscountApplication | DiscountCodeApplication | ManualDiscountApplication | ScriptDiscountApplication>;
2902
2999
  /** Information to aid in pagination. */
2903
3000
  pageInfo: PageInfo;
2904
3001
  };
@@ -3076,6 +3173,8 @@ export declare type FulfillmentLineItemConnection = {
3076
3173
  __typename?: 'FulfillmentLineItemConnection';
3077
3174
  /** A list of edges. */
3078
3175
  edges: Array<FulfillmentLineItemEdge>;
3176
+ /** A list of the nodes contained in FulfillmentLineItemEdge. */
3177
+ nodes: Array<FulfillmentLineItem>;
3079
3178
  /** Information to aid in pagination. */
3080
3179
  pageInfo: PageInfo;
3081
3180
  };
@@ -3098,6 +3197,22 @@ export declare type FulfillmentTrackingInfo = {
3098
3197
  /** The URL to track the fulfillment. */
3099
3198
  url?: Maybe<Scalars['URL']>;
3100
3199
  };
3200
+ /** The generic file resource lets you manage files in a merchant’s store. Generic files include any file that doesn’t fit into a designated type such as image or video. Example: PDF, JSON. */
3201
+ export declare type GenericFile = Node & {
3202
+ __typename?: 'GenericFile';
3203
+ /** A word or phrase to indicate the contents of a file. */
3204
+ alt?: Maybe<Scalars['String']>;
3205
+ /** A globally-unique identifier. */
3206
+ id: Scalars['ID'];
3207
+ /** The mime type of the file. */
3208
+ mimeType?: Maybe<Scalars['String']>;
3209
+ /** The size of the original file in bytes. */
3210
+ originalFileSize?: Maybe<Scalars['Int']>;
3211
+ /** The preview image for the file. */
3212
+ previewImage?: Maybe<Image>;
3213
+ /** The URL of the file. */
3214
+ url?: Maybe<Scalars['URL']>;
3215
+ };
3101
3216
  /** Used to specify a geographical location. */
3102
3217
  export declare type GeoCoordinateInput = {
3103
3218
  /** The coordinate's latitude value. */
@@ -3195,6 +3310,8 @@ export declare type ImageConnection = {
3195
3310
  __typename?: 'ImageConnection';
3196
3311
  /** A list of edges. */
3197
3312
  edges: Array<ImageEdge>;
3313
+ /** A list of the nodes contained in ImageEdge. */
3314
+ nodes: Array<Image>;
3198
3315
  /** Information to aid in pagination. */
3199
3316
  pageInfo: PageInfo;
3200
3317
  };
@@ -3600,6 +3717,8 @@ export declare type LocationConnection = {
3600
3717
  __typename?: 'LocationConnection';
3601
3718
  /** A list of edges. */
3602
3719
  edges: Array<LocationEdge>;
3720
+ /** A list of the nodes contained in LocationEdge. */
3721
+ nodes: Array<Location>;
3603
3722
  /** Information to aid in pagination. */
3604
3723
  pageInfo: PageInfo;
3605
3724
  };
@@ -3716,6 +3835,8 @@ export declare type MailingAddressConnection = {
3716
3835
  __typename?: 'MailingAddressConnection';
3717
3836
  /** A list of edges. */
3718
3837
  edges: Array<MailingAddressEdge>;
3838
+ /** A list of the nodes contained in MailingAddressEdge. */
3839
+ nodes: Array<MailingAddress>;
3719
3840
  /** Information to aid in pagination. */
3720
3841
  pageInfo: PageInfo;
3721
3842
  };
@@ -3806,6 +3927,8 @@ export declare type MediaConnection = {
3806
3927
  __typename?: 'MediaConnection';
3807
3928
  /** A list of edges. */
3808
3929
  edges: Array<MediaEdge>;
3930
+ /** A list of the nodes contained in MediaEdge. */
3931
+ nodes: Array<ExternalVideo | MediaImage | Model3d | Video>;
3809
3932
  /** Information to aid in pagination. */
3810
3933
  pageInfo: PageInfo;
3811
3934
  };
@@ -3957,6 +4080,8 @@ export declare type MetafieldConnection = {
3957
4080
  __typename?: 'MetafieldConnection';
3958
4081
  /** A list of edges. */
3959
4082
  edges: Array<MetafieldEdge>;
4083
+ /** A list of the nodes contained in MetafieldEdge. */
4084
+ nodes: Array<Metafield>;
3960
4085
  /** Information to aid in pagination. */
3961
4086
  pageInfo: PageInfo;
3962
4087
  };
@@ -3995,7 +4120,7 @@ export declare type MetafieldParentResource = Article | Blog | Collection | Cust
3995
4120
  * Returns the resource which is being referred to by a metafield.
3996
4121
  *
3997
4122
  */
3998
- export declare type MetafieldReference = MediaImage | Page | Product | ProductVariant;
4123
+ export declare type MetafieldReference = GenericFile | MediaImage | Page | Product | ProductVariant | Video;
3999
4124
  /** Represents a Shopify hosted 3D model. */
4000
4125
  export declare type Model3d = Media & Node & {
4001
4126
  __typename?: 'Model3d';
@@ -4634,6 +4759,8 @@ export declare type OrderConnection = {
4634
4759
  __typename?: 'OrderConnection';
4635
4760
  /** A list of edges. */
4636
4761
  edges: Array<OrderEdge>;
4762
+ /** A list of the nodes contained in OrderEdge. */
4763
+ nodes: Array<Order>;
4637
4764
  /** Information to aid in pagination. */
4638
4765
  pageInfo: PageInfo;
4639
4766
  };
@@ -4714,6 +4841,8 @@ export declare type OrderLineItemConnection = {
4714
4841
  __typename?: 'OrderLineItemConnection';
4715
4842
  /** A list of edges. */
4716
4843
  edges: Array<OrderLineItemEdge>;
4844
+ /** A list of the nodes contained in OrderLineItemEdge. */
4845
+ nodes: Array<OrderLineItem>;
4717
4846
  /** Information to aid in pagination. */
4718
4847
  pageInfo: PageInfo;
4719
4848
  };
@@ -4795,6 +4924,8 @@ export declare type PageConnection = {
4795
4924
  __typename?: 'PageConnection';
4796
4925
  /** A list of edges. */
4797
4926
  edges: Array<PageEdge>;
4927
+ /** A list of the nodes contained in PageEdge. */
4928
+ nodes: Array<Page>;
4798
4929
  /** Information to aid in pagination. */
4799
4930
  pageInfo: PageInfo;
4800
4931
  };
@@ -4816,10 +4947,14 @@ export declare type PageEdge = {
4816
4947
  */
4817
4948
  export declare type PageInfo = {
4818
4949
  __typename?: 'PageInfo';
4950
+ /** The cursor corresponding to the last node in edges. */
4951
+ endCursor?: Maybe<Scalars['String']>;
4819
4952
  /** Whether there are more pages to fetch following the current page. */
4820
4953
  hasNextPage: Scalars['Boolean'];
4821
4954
  /** Whether there are any pages prior to the current page. */
4822
4955
  hasPreviousPage: Scalars['Boolean'];
4956
+ /** The cursor corresponding to the first node in edges. */
4957
+ startCursor?: Maybe<Scalars['String']>;
4823
4958
  };
4824
4959
  /** The set of valid sort keys for the Page query. */
4825
4960
  export declare enum PageSortKeys {
@@ -5141,6 +5276,8 @@ export declare type ProductConnection = {
5141
5276
  edges: Array<ProductEdge>;
5142
5277
  /** A list of available filters. */
5143
5278
  filters: Array<Filter>;
5279
+ /** A list of the nodes contained in ProductEdge. */
5280
+ nodes: Array<Product>;
5144
5281
  /** Information to aid in pagination. */
5145
5282
  pageInfo: PageInfo;
5146
5283
  };
@@ -5349,6 +5486,8 @@ export declare type ProductVariantConnection = {
5349
5486
  __typename?: 'ProductVariantConnection';
5350
5487
  /** A list of edges. */
5351
5488
  edges: Array<ProductVariantEdge>;
5489
+ /** A list of the nodes contained in ProductVariantEdge. */
5490
+ nodes: Array<ProductVariant>;
5352
5491
  /** Information to aid in pagination. */
5353
5492
  pageInfo: PageInfo;
5354
5493
  };
@@ -5419,9 +5558,9 @@ export declare type QueryRoot = {
5419
5558
  /** A storefront menu. */
5420
5559
  menu?: Maybe<Menu>;
5421
5560
  /** Returns a specific node by ID. */
5422
- node?: Maybe<AppliedGiftCard | Article | Blog | Cart | CartLine | Checkout | CheckoutLineItem | Collection | Comment | ExternalVideo | Location | MailingAddress | MediaImage | Menu | MenuItem | Metafield | Model3d | Order | Page | Payment | Product | ProductOption | ProductVariant | Shop | ShopPolicy | Video>;
5561
+ node?: Maybe<AppliedGiftCard | Article | Blog | Cart | CartLine | Checkout | CheckoutLineItem | Collection | Comment | ExternalVideo | GenericFile | Location | MailingAddress | MediaImage | Menu | MenuItem | Metafield | Model3d | Order | Page | Payment | Product | ProductOption | ProductVariant | Shop | ShopPolicy | Video>;
5423
5562
  /** Returns the list of nodes with the given IDs. */
5424
- nodes: Array<Maybe<AppliedGiftCard | Article | Blog | Cart | CartLine | Checkout | CheckoutLineItem | Collection | Comment | ExternalVideo | Location | MailingAddress | MediaImage | Menu | MenuItem | Metafield | Model3d | Order | Page | Payment | Product | ProductOption | ProductVariant | Shop | ShopPolicy | Video>>;
5563
+ nodes: Array<Maybe<AppliedGiftCard | Article | Blog | Cart | CartLine | Checkout | CheckoutLineItem | Collection | Comment | ExternalVideo | GenericFile | Location | MailingAddress | MediaImage | Menu | MenuItem | Metafield | Model3d | Order | Page | Payment | Product | ProductOption | ProductVariant | Shop | ShopPolicy | Video>>;
5425
5564
  /** Fetch a specific `Page` by one of its unique attributes. */
5426
5565
  page?: Maybe<Page>;
5427
5566
  /**
@@ -5665,6 +5804,8 @@ export declare type SellingPlanAllocationConnection = {
5665
5804
  __typename?: 'SellingPlanAllocationConnection';
5666
5805
  /** A list of edges. */
5667
5806
  edges: Array<SellingPlanAllocationEdge>;
5807
+ /** A list of the nodes contained in SellingPlanAllocationEdge. */
5808
+ nodes: Array<SellingPlanAllocation>;
5668
5809
  /** Information to aid in pagination. */
5669
5810
  pageInfo: PageInfo;
5670
5811
  };
@@ -5699,6 +5840,8 @@ export declare type SellingPlanConnection = {
5699
5840
  __typename?: 'SellingPlanConnection';
5700
5841
  /** A list of edges. */
5701
5842
  edges: Array<SellingPlanEdge>;
5843
+ /** A list of the nodes contained in SellingPlanEdge. */
5844
+ nodes: Array<SellingPlan>;
5702
5845
  /** Information to aid in pagination. */
5703
5846
  pageInfo: PageInfo;
5704
5847
  };
@@ -5753,6 +5896,8 @@ export declare type SellingPlanGroupConnection = {
5753
5896
  __typename?: 'SellingPlanGroupConnection';
5754
5897
  /** A list of edges. */
5755
5898
  edges: Array<SellingPlanGroupEdge>;
5899
+ /** A list of the nodes contained in SellingPlanGroupEdge. */
5900
+ nodes: Array<SellingPlanGroup>;
5756
5901
  /** Information to aid in pagination. */
5757
5902
  pageInfo: PageInfo;
5758
5903
  };
@@ -5919,6 +6064,8 @@ export declare type StoreAvailabilityConnection = {
5919
6064
  __typename?: 'StoreAvailabilityConnection';
5920
6065
  /** A list of edges. */
5921
6066
  edges: Array<StoreAvailabilityEdge>;
6067
+ /** A list of the nodes contained in StoreAvailabilityEdge. */
6068
+ nodes: Array<StoreAvailability>;
5922
6069
  /** Information to aid in pagination. */
5923
6070
  pageInfo: PageInfo;
5924
6071
  };
@@ -1038,6 +1038,22 @@ export var CustomerErrorCode;
1038
1038
  /** Unidentified customer. */
1039
1039
  CustomerErrorCode["UnidentifiedCustomer"] = "UNIDENTIFIED_CUSTOMER";
1040
1040
  })(CustomerErrorCode || (CustomerErrorCode = {}));
1041
+ /** List of different delivery method types. */
1042
+ export var DeliveryMethodType;
1043
+ (function (DeliveryMethodType) {
1044
+ /** Local Delivery. */
1045
+ DeliveryMethodType["Local"] = "LOCAL";
1046
+ /** None. */
1047
+ DeliveryMethodType["None"] = "NONE";
1048
+ /** Shipping to a Pickup Point. */
1049
+ DeliveryMethodType["PickupPoint"] = "PICKUP_POINT";
1050
+ /** Local Pickup. */
1051
+ DeliveryMethodType["PickUp"] = "PICK_UP";
1052
+ /** Retail. */
1053
+ DeliveryMethodType["Retail"] = "RETAIL";
1054
+ /** Shipping. */
1055
+ DeliveryMethodType["Shipping"] = "SHIPPING";
1056
+ })(DeliveryMethodType || (DeliveryMethodType = {}));
1041
1057
  /** Digital wallet, such as Apple Pay, which can be used for accelerated checkouts. */
1042
1058
  export var DigitalWallet;
1043
1059
  (function (DigitalWallet) {
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "0.13.2";
1
+ export declare const LIB_VERSION = "0.14.0";
@@ -1 +1 @@
1
- export const LIB_VERSION = '0.13.2';
1
+ export const LIB_VERSION = '0.14.0';
@@ -34,7 +34,6 @@ const defer_1 = require("./utilities/defer");
34
34
  const Html_1 = require("./framework/Hydration/Html");
35
35
  const ServerComponentResponse_server_1 = require("./framework/Hydration/ServerComponentResponse.server");
36
36
  const ServerComponentRequest_server_1 = require("./framework/Hydration/ServerComponentRequest.server");
37
- const cache_1 = require("./framework/cache");
38
37
  const ServerRequestProvider_1 = require("./foundation/ServerRequestProvider");
39
38
  const apiRoutes_1 = require("./utilities/apiRoutes");
40
39
  const ServerStateProvider_1 = require("./foundation/ServerStateProvider");
@@ -139,7 +138,7 @@ async function render(url, { App, routes, request, componentResponse, log, templ
139
138
  * TODO: Also add `Vary` headers for `accept-language` and any other keys
140
139
  * we want to shard our full-page cache for all Hydrogen storefronts.
141
140
  */
142
- headers[(0, cache_1.getCacheControlHeader)({ dev })] = componentResponse.cacheControlHeader;
141
+ headers['cache-control'] = componentResponse.cacheControlHeader;
143
142
  if (componentResponse.customBody) {
144
143
  // This can be used to return sitemap.xml or any other custom response.
145
144
  postRequestTasks('ssr', status, request, componentResponse);
@@ -234,7 +233,7 @@ async function stream(url, { App, routes, request, response, componentResponse,
234
233
  * queries which might be caught behind Suspense. Clarify this or add
235
234
  * additional checks downstream?
236
235
  */
237
- responseOptions.headers[(0, cache_1.getCacheControlHeader)({ dev })] =
236
+ responseOptions.headers['cache-control'] =
238
237
  componentResponse.cacheControlHeader;
239
238
  if (isRedirect(responseOptions)) {
240
239
  return false;
@@ -302,7 +301,7 @@ async function stream(url, { App, routes, request, response, componentResponse,
302
301
  * queries which might be caught behind Suspense. Clarify this or add
303
302
  * additional checks downstream?
304
303
  */
305
- response.setHeader((0, cache_1.getCacheControlHeader)({ dev }), componentResponse.cacheControlHeader);
304
+ response.setHeader('cache-control', componentResponse.cacheControlHeader);
306
305
  writeHeadToServerResponse(response, componentResponse, log, didError);
307
306
  if (isRedirect(response)) {
308
307
  // Return redirects early without further rendering/streaming
@@ -386,15 +385,21 @@ async function hydrate(url, { App, routes, request, response, componentResponse,
386
385
  // Note: CFW does not support reader.piteTo nor iterable syntax
387
386
  const bufferedBody = await (0, streaming_server_1.bufferReadableStream)(rscReadable.getReader());
388
387
  postRequestTasks('rsc', 200, request, componentResponse);
389
- return new Response(bufferedBody);
388
+ return new Response(bufferedBody, {
389
+ headers: {
390
+ 'cache-control': componentResponse.cacheControlHeader,
391
+ },
392
+ });
390
393
  }
391
394
  else if (response) {
392
395
  const rscWriter = await Promise.resolve().then(() => __importStar(require(
393
396
  // @ts-ignore
394
397
  '@shopify/hydrogen/vendor/react-server-dom-vite/writer.node.server')));
395
- const stream = rscWriter
396
- .renderToPipeableStream(AppRSC)
397
- .pipe(response);
398
+ const streamer = rscWriter.renderToPipeableStream(AppRSC);
399
+ response.writeHead(200, 'ok', {
400
+ 'cache-control': componentResponse.cacheControlHeader,
401
+ });
402
+ const stream = streamer.pipe(response);
398
403
  stream.on('finish', function () {
399
404
  postRequestTasks('rsc', response.statusCode, request, componentResponse);
400
405
  });
@@ -7,13 +7,18 @@ export interface ServerState {
7
7
  search: string;
8
8
  [key: string]: any;
9
9
  }
10
+ declare type ServerStateSetterInput = ((prev: ServerState) => Partial<ServerState>) | Partial<ServerState> | string;
10
11
  export interface ServerStateSetter {
11
- (input: ((prev: ServerState) => Partial<ServerState>) | Partial<ServerState> | string, propValue?: any): void;
12
+ (input: ServerStateSetterInput, propValue?: any): void;
13
+ }
14
+ interface ProposedServerStateSetter {
15
+ (input: ServerStateSetterInput, propValue?: any): ServerState;
12
16
  }
13
17
  export interface ServerStateContextValue {
14
18
  pending: boolean;
15
19
  serverState: ServerState;
16
20
  setServerState: ServerStateSetter;
21
+ getProposedServerState: ProposedServerStateSetter;
17
22
  }
18
23
  export declare const ServerStateContext: React.Context<ServerStateContextValue>;
19
24
  interface ServerStateProviderProps {
@@ -38,34 +38,39 @@ function ServerStateProvider({ serverState, setServerState, children, }) {
38
38
  * the `pending` flag also provided by the hook to display in the UI.
39
39
  */
40
40
  startTransition(() => {
41
- return setServerState((prev) => {
42
- let newValue;
43
- if (typeof input === 'function') {
44
- newValue = input(prev);
45
- }
46
- else if (typeof input === 'string') {
47
- newValue = { [input]: propValue };
48
- }
49
- else {
50
- newValue = input;
51
- }
52
- if (__DEV__) {
53
- const privateProp = PRIVATE_PROPS.find((prop) => prop in newValue);
54
- if (privateProp) {
55
- console.warn(`Custom "${privateProp}" property in server state is ignored. Use a different name.`);
56
- }
57
- }
58
- return {
59
- ...prev,
60
- ...newValue,
61
- };
62
- });
41
+ return setServerState((prev) => getNewServerState(prev, input, propValue));
63
42
  });
64
43
  }, [setServerState, startTransition]);
44
+ const getProposedServerStateCallback = (0, react_1.useCallback)((input, propValue) => {
45
+ return getNewServerState(serverState, input, propValue);
46
+ }, [serverState]);
47
+ function getNewServerState(prev, input, propValue) {
48
+ let newValue;
49
+ if (typeof input === 'function') {
50
+ newValue = input(prev);
51
+ }
52
+ else if (typeof input === 'string') {
53
+ newValue = { [input]: propValue };
54
+ }
55
+ else {
56
+ newValue = input;
57
+ }
58
+ if (__DEV__) {
59
+ const privateProp = PRIVATE_PROPS.find((prop) => prop in newValue);
60
+ if (privateProp) {
61
+ console.warn(`Custom "${privateProp}" property in server state is ignored. Use a different name.`);
62
+ }
63
+ }
64
+ return {
65
+ ...prev,
66
+ ...newValue,
67
+ };
68
+ }
65
69
  const value = (0, react_1.useMemo)(() => ({
66
70
  pending,
67
71
  serverState,
68
72
  setServerState: setServerStateCallback,
73
+ getProposedServerState: getProposedServerStateCallback,
69
74
  }), [serverState, setServerStateCallback, pending]);
70
75
  return (react_1.default.createElement(exports.ServerStateContext.Provider, { value: value }, children));
71
76
  }
@@ -1,7 +1,9 @@
1
+ import type { CountryCode, LanguageCode } from '../../storefront-api-types';
1
2
  import type { ReactNode } from 'react';
2
3
  import type { ShopifyConfig } from '../../types';
3
4
  export declare type ShopifyContextValue = {
4
- locale: string;
5
+ locale: `${LanguageCode}-${CountryCode}`;
6
+ languageCode: `${LanguageCode}`;
5
7
  storeDomain: ShopifyConfig['storeDomain'];
6
8
  storefrontToken: ShopifyConfig['storefrontToken'];
7
9
  storefrontApiVersion: string;
@@ -127,8 +127,9 @@ function getInitFromNodeRequest(request) {
127
127
  ? request.body
128
128
  : undefined,
129
129
  };
130
- if (!init.headers.has('x-forwarded-for')) {
131
- init.headers.set('x-forwarded-for', request.socket.remoteAddress);
130
+ const remoteAddress = request.socket.remoteAddress;
131
+ if (!init.headers.has('x-forwarded-for') && remoteAddress) {
132
+ init.headers.set('x-forwarded-for', remoteAddress);
132
133
  }
133
134
  return init;
134
135
  }
@@ -1,13 +1,5 @@
1
1
  import type { QueryKey, CachingStrategy } from '../types';
2
2
  export declare function generateSubRequestCacheControlHeader(userCacheOptions?: CachingStrategy): string;
3
- /**
4
- * Use a preview header during development.
5
- * TODO: Support an override of this to force the cache
6
- * header to be present during dev. ENV var maybe?
7
- */
8
- export declare function getCacheControlHeader({ dev }: {
9
- dev?: boolean;
10
- }): "cache-control-preview" | "cache-control";
11
3
  export declare function hashKey(key: QueryKey): string;
12
4
  /**
13
5
  * Get an item from the cache. If a match is found, returns a tuple
@@ -1,21 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isStale = exports.deleteItemFromCache = exports.setItemInCache = exports.getItemFromCache = exports.hashKey = exports.getCacheControlHeader = exports.generateSubRequestCacheControlHeader = void 0;
3
+ exports.isStale = exports.deleteItemFromCache = exports.setItemInCache = exports.getItemFromCache = exports.hashKey = exports.generateSubRequestCacheControlHeader = void 0;
4
4
  const runtime_1 = require("./runtime");
5
5
  const CachingStrategy_1 = require("../framework/CachingStrategy");
6
6
  function generateSubRequestCacheControlHeader(userCacheOptions) {
7
7
  return (0, CachingStrategy_1.generateCacheControlHeader)(userCacheOptions || (0, CachingStrategy_1.CacheSeconds)());
8
8
  }
9
9
  exports.generateSubRequestCacheControlHeader = generateSubRequestCacheControlHeader;
10
- /**
11
- * Use a preview header during development.
12
- * TODO: Support an override of this to force the cache
13
- * header to be present during dev. ENV var maybe?
14
- */
15
- function getCacheControlHeader({ dev }) {
16
- return dev ? 'cache-control-preview' : 'cache-control';
17
- }
18
- exports.getCacheControlHeader = getCacheControlHeader;
19
10
  function hashKey(key) {
20
11
  const rawKey = key instanceof Array ? key : [key];
21
12
  /**