@shopify/hydrogen 2026.4.0 → 2026.4.1
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/development/index.cjs +228 -174
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +228 -174
- package/dist/development/index.js.map +1 -1
- package/dist/oxygen/index.d.ts +1 -1
- package/dist/production/index.cjs +121 -153
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.cts +64 -1
- package/dist/production/index.d.ts +64 -1
- package/dist/production/index.js +121 -153
- package/dist/production/index.js.map +1 -1
- package/dist/vite/{chunk-ZSWP2RO7.js → chunk-4O5OI3OO.js} +0 -4
- package/dist/vite/{chunk-XTDF5RJS.js → chunk-QXBQVDMY.js} +1 -2
- package/dist/vite/hydrogen-middleware.js +2 -2
- package/dist/vite/plugin.js +2 -3
- package/dist/vite/request-events.d.ts +0 -1
- package/dist/vite/request-events.js +1 -1
- package/package.json +3 -3
|
@@ -437,7 +437,7 @@ function getPrivacyBanner() {
|
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
// package.json
|
|
440
|
-
var version = "2026.4.
|
|
440
|
+
var version = "2026.4.1";
|
|
441
441
|
|
|
442
442
|
// src/analytics-manager/ShopifyAnalytics.tsx
|
|
443
443
|
function getCustomerPrivacyRequired() {
|
|
@@ -1833,7 +1833,7 @@ function generateUUID() {
|
|
|
1833
1833
|
}
|
|
1834
1834
|
|
|
1835
1835
|
// src/version.ts
|
|
1836
|
-
var LIB_VERSION = "2026.4.
|
|
1836
|
+
var LIB_VERSION = "2026.4.1";
|
|
1837
1837
|
|
|
1838
1838
|
// src/utils/graphql.ts
|
|
1839
1839
|
function minifyQuery(string) {
|
|
@@ -2361,6 +2361,20 @@ function formatAPIResult(data, errors2) {
|
|
|
2361
2361
|
};
|
|
2362
2362
|
}
|
|
2363
2363
|
|
|
2364
|
+
// src/cart/queries/cart-query-helpers.ts
|
|
2365
|
+
function shouldIncludeVisitorConsent(input) {
|
|
2366
|
+
return input?.visitorConsent !== void 0;
|
|
2367
|
+
}
|
|
2368
|
+
function getInContextVariables(includeVisitorConsent = false) {
|
|
2369
|
+
const base = `$country: CountryCode = ZZ
|
|
2370
|
+
$language: LanguageCode`;
|
|
2371
|
+
return includeVisitorConsent ? `${base}
|
|
2372
|
+
$visitorConsent: VisitorConsent` : base;
|
|
2373
|
+
}
|
|
2374
|
+
function getInContextDirective(includeVisitorConsent = false) {
|
|
2375
|
+
return includeVisitorConsent ? "@inContext(country: $country, language: $language, visitorConsent: $visitorConsent)" : "@inContext(country: $country, language: $language)";
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2364
2378
|
// src/cart/queries/cartGetDefault.ts
|
|
2365
2379
|
function cartGetDefault({
|
|
2366
2380
|
storefront,
|
|
@@ -2371,12 +2385,16 @@ function cartGetDefault({
|
|
|
2371
2385
|
return async (cartInput) => {
|
|
2372
2386
|
const cartId = getCartId();
|
|
2373
2387
|
if (!cartId) return null;
|
|
2388
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(cartInput);
|
|
2374
2389
|
const [isCustomerLoggedIn, { cart, errors: errors2 }] = await Promise.all([
|
|
2375
2390
|
customerAccount ? customerAccount.isLoggedIn() : false,
|
|
2376
|
-
storefront.query(
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2391
|
+
storefront.query(
|
|
2392
|
+
CART_QUERY(cartFragment, { includeVisitorConsent }),
|
|
2393
|
+
{
|
|
2394
|
+
variables: { cartId, ...cartInput },
|
|
2395
|
+
cache: storefront.CacheNone()
|
|
2396
|
+
}
|
|
2397
|
+
)
|
|
2380
2398
|
]);
|
|
2381
2399
|
if (isCustomerLoggedIn && cart?.checkoutUrl) {
|
|
2382
2400
|
const finalCheckoutUrl = new URL(cart.checkoutUrl);
|
|
@@ -2386,14 +2404,12 @@ function cartGetDefault({
|
|
|
2386
2404
|
return cart || errors2 ? formatAPIResult(cart, errors2) : null;
|
|
2387
2405
|
};
|
|
2388
2406
|
}
|
|
2389
|
-
var CART_QUERY = (cartFragment = DEFAULT_CART_FRAGMENT) => `#graphql
|
|
2407
|
+
var CART_QUERY = (cartFragment = DEFAULT_CART_FRAGMENT, options = {}) => `#graphql
|
|
2390
2408
|
query CartQuery(
|
|
2391
2409
|
$cartId: ID!
|
|
2392
2410
|
$numCartLines: Int = 100
|
|
2393
|
-
$
|
|
2394
|
-
|
|
2395
|
-
$visitorConsent: VisitorConsent
|
|
2396
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2411
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2412
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2397
2413
|
cart(id: $cartId) {
|
|
2398
2414
|
...CartApiQuery
|
|
2399
2415
|
}
|
|
@@ -2547,7 +2563,8 @@ function cartCreateDefault(options) {
|
|
|
2547
2563
|
const buyer = options.customerAccount ? await options.customerAccount.getBuyer() : void 0;
|
|
2548
2564
|
const { cartId, ...restOfOptionalParams } = optionalParams || {};
|
|
2549
2565
|
const { buyerIdentity, ...restOfInput } = input;
|
|
2550
|
-
const
|
|
2566
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2567
|
+
const { cartCreate, errors: errors2 } = await options.storefront.mutate(CART_CREATE_MUTATION(options.cartFragment, { includeVisitorConsent }), {
|
|
2551
2568
|
variables: {
|
|
2552
2569
|
input: {
|
|
2553
2570
|
...restOfInput,
|
|
@@ -2562,13 +2579,11 @@ function cartCreateDefault(options) {
|
|
|
2562
2579
|
return formatAPIResult(cartCreate, errors2);
|
|
2563
2580
|
};
|
|
2564
2581
|
}
|
|
2565
|
-
var CART_CREATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2582
|
+
var CART_CREATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2566
2583
|
mutation cartCreate(
|
|
2567
2584
|
$input: CartInput!
|
|
2568
|
-
$
|
|
2569
|
-
|
|
2570
|
-
$visitorConsent: VisitorConsent
|
|
2571
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2585
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2586
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2572
2587
|
cartCreate(input: $input) {
|
|
2573
2588
|
cart {
|
|
2574
2589
|
...CartApiMutation
|
|
@@ -2590,7 +2605,8 @@ var CART_CREATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
|
2590
2605
|
// src/cart/queries/cartLinesAddDefault.ts
|
|
2591
2606
|
function cartLinesAddDefault(options) {
|
|
2592
2607
|
return async (lines, optionalParams) => {
|
|
2593
|
-
const
|
|
2608
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2609
|
+
const { cartLinesAdd, errors: errors2 } = await options.storefront.mutate(CART_LINES_ADD_MUTATION(options.cartFragment, { includeVisitorConsent }), {
|
|
2594
2610
|
variables: {
|
|
2595
2611
|
cartId: options.getCartId(),
|
|
2596
2612
|
lines,
|
|
@@ -2600,14 +2616,12 @@ function cartLinesAddDefault(options) {
|
|
|
2600
2616
|
return formatAPIResult(cartLinesAdd, errors2);
|
|
2601
2617
|
};
|
|
2602
2618
|
}
|
|
2603
|
-
var CART_LINES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2619
|
+
var CART_LINES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2604
2620
|
mutation cartLinesAdd(
|
|
2605
2621
|
$cartId: ID!
|
|
2606
2622
|
$lines: [CartLineInput!]!
|
|
2607
|
-
$
|
|
2608
|
-
|
|
2609
|
-
$visitorConsent: VisitorConsent
|
|
2610
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2623
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2624
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2611
2625
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
2612
2626
|
cart {
|
|
2613
2627
|
...CartApiMutation
|
|
@@ -2647,24 +2661,26 @@ function throwIfLinesAreOptimistic(type, lines) {
|
|
|
2647
2661
|
function cartLinesUpdateDefault(options) {
|
|
2648
2662
|
return async (lines, optionalParams) => {
|
|
2649
2663
|
throwIfLinesAreOptimistic("updateLines", lines);
|
|
2650
|
-
const
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2664
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2665
|
+
const { cartLinesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2666
|
+
CART_LINES_UPDATE_MUTATION(options.cartFragment, { includeVisitorConsent }),
|
|
2667
|
+
{
|
|
2668
|
+
variables: {
|
|
2669
|
+
cartId: options.getCartId(),
|
|
2670
|
+
lines,
|
|
2671
|
+
...optionalParams
|
|
2672
|
+
}
|
|
2655
2673
|
}
|
|
2656
|
-
|
|
2674
|
+
);
|
|
2657
2675
|
return formatAPIResult(cartLinesUpdate, errors2);
|
|
2658
2676
|
};
|
|
2659
2677
|
}
|
|
2660
|
-
var CART_LINES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2678
|
+
var CART_LINES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2661
2679
|
mutation cartLinesUpdate(
|
|
2662
2680
|
$cartId: ID!
|
|
2663
2681
|
$lines: [CartLineUpdateInput!]!
|
|
2664
|
-
$
|
|
2665
|
-
|
|
2666
|
-
$visitorConsent: VisitorConsent
|
|
2667
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2682
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2683
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2668
2684
|
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
2669
2685
|
cart {
|
|
2670
2686
|
...CartApiMutation
|
|
@@ -2686,24 +2702,26 @@ var CART_LINES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#gra
|
|
|
2686
2702
|
function cartLinesRemoveDefault(options) {
|
|
2687
2703
|
return async (lineIds, optionalParams) => {
|
|
2688
2704
|
throwIfLinesAreOptimistic("removeLines", lineIds);
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2705
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2706
|
+
const { cartLinesRemove, errors: errors2 } = await options.storefront.mutate(
|
|
2707
|
+
CART_LINES_REMOVE_MUTATION(options.cartFragment, { includeVisitorConsent }),
|
|
2708
|
+
{
|
|
2709
|
+
variables: {
|
|
2710
|
+
cartId: options.getCartId(),
|
|
2711
|
+
lineIds,
|
|
2712
|
+
...optionalParams
|
|
2713
|
+
}
|
|
2694
2714
|
}
|
|
2695
|
-
|
|
2715
|
+
);
|
|
2696
2716
|
return formatAPIResult(cartLinesRemove, errors2);
|
|
2697
2717
|
};
|
|
2698
2718
|
}
|
|
2699
|
-
var CART_LINES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2719
|
+
var CART_LINES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2700
2720
|
mutation cartLinesRemove(
|
|
2701
2721
|
$cartId: ID!
|
|
2702
2722
|
$lineIds: [ID!]!
|
|
2703
|
-
$
|
|
2704
|
-
|
|
2705
|
-
$visitorConsent: VisitorConsent
|
|
2706
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2723
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2724
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2707
2725
|
cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
|
|
2708
2726
|
cart {
|
|
2709
2727
|
...CartApiMutation
|
|
@@ -2727,24 +2745,28 @@ function cartDiscountCodesUpdateDefault(options) {
|
|
|
2727
2745
|
const uniqueCodes = discountCodes.filter((value, index, array) => {
|
|
2728
2746
|
return array.indexOf(value) === index;
|
|
2729
2747
|
});
|
|
2730
|
-
const
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2748
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2749
|
+
const { cartDiscountCodesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2750
|
+
CART_DISCOUNT_CODE_UPDATE_MUTATION(options.cartFragment, {
|
|
2751
|
+
includeVisitorConsent
|
|
2752
|
+
}),
|
|
2753
|
+
{
|
|
2754
|
+
variables: {
|
|
2755
|
+
cartId: options.getCartId(),
|
|
2756
|
+
discountCodes: uniqueCodes,
|
|
2757
|
+
...optionalParams
|
|
2758
|
+
}
|
|
2735
2759
|
}
|
|
2736
|
-
|
|
2760
|
+
);
|
|
2737
2761
|
return formatAPIResult(cartDiscountCodesUpdate, errors2);
|
|
2738
2762
|
};
|
|
2739
2763
|
}
|
|
2740
|
-
var CART_DISCOUNT_CODE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2764
|
+
var CART_DISCOUNT_CODE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2741
2765
|
mutation cartDiscountCodesUpdate(
|
|
2742
2766
|
$cartId: ID!
|
|
2743
2767
|
$discountCodes: [String!]!
|
|
2744
|
-
$
|
|
2745
|
-
|
|
2746
|
-
$visitorConsent: VisitorConsent
|
|
2747
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2768
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2769
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2748
2770
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
2749
2771
|
... @defer {
|
|
2750
2772
|
cart {
|
|
@@ -2773,27 +2795,31 @@ function cartBuyerIdentityUpdateDefault(options) {
|
|
|
2773
2795
|
});
|
|
2774
2796
|
}
|
|
2775
2797
|
const buyer = options.customerAccount ? await options.customerAccount.getBuyer() : void 0;
|
|
2776
|
-
const
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2798
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2799
|
+
const { cartBuyerIdentityUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2800
|
+
CART_BUYER_IDENTITY_UPDATE_MUTATION(options.cartFragment, {
|
|
2801
|
+
includeVisitorConsent
|
|
2802
|
+
}),
|
|
2803
|
+
{
|
|
2804
|
+
variables: {
|
|
2805
|
+
cartId: options.getCartId(),
|
|
2806
|
+
buyerIdentity: {
|
|
2807
|
+
...buyer,
|
|
2808
|
+
...buyerIdentity
|
|
2809
|
+
},
|
|
2810
|
+
...optionalParams
|
|
2811
|
+
}
|
|
2784
2812
|
}
|
|
2785
|
-
|
|
2813
|
+
);
|
|
2786
2814
|
return formatAPIResult(cartBuyerIdentityUpdate, errors2);
|
|
2787
2815
|
};
|
|
2788
2816
|
}
|
|
2789
|
-
var CART_BUYER_IDENTITY_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2817
|
+
var CART_BUYER_IDENTITY_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2790
2818
|
mutation cartBuyerIdentityUpdate(
|
|
2791
2819
|
$cartId: ID!
|
|
2792
2820
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
2793
|
-
$
|
|
2794
|
-
|
|
2795
|
-
$visitorConsent: VisitorConsent
|
|
2796
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2821
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2822
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2797
2823
|
cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
|
|
2798
2824
|
cart {
|
|
2799
2825
|
...CartApiMutation
|
|
@@ -2814,24 +2840,26 @@ var CART_BUYER_IDENTITY_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT)
|
|
|
2814
2840
|
// src/cart/queries/cartNoteUpdateDefault.ts
|
|
2815
2841
|
function cartNoteUpdateDefault(options) {
|
|
2816
2842
|
return async (note, optionalParams) => {
|
|
2817
|
-
const
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2843
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2844
|
+
const { cartNoteUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2845
|
+
CART_NOTE_UPDATE_MUTATION(options.cartFragment, { includeVisitorConsent }),
|
|
2846
|
+
{
|
|
2847
|
+
variables: {
|
|
2848
|
+
cartId: options.getCartId(),
|
|
2849
|
+
note,
|
|
2850
|
+
...optionalParams
|
|
2851
|
+
}
|
|
2822
2852
|
}
|
|
2823
|
-
|
|
2853
|
+
);
|
|
2824
2854
|
return formatAPIResult(cartNoteUpdate, errors2);
|
|
2825
2855
|
};
|
|
2826
2856
|
}
|
|
2827
|
-
var CART_NOTE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2857
|
+
var CART_NOTE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2828
2858
|
mutation cartNoteUpdate(
|
|
2829
2859
|
$cartId: ID!
|
|
2830
2860
|
$note: String!
|
|
2831
|
-
$
|
|
2832
|
-
|
|
2833
|
-
$visitorConsent: VisitorConsent
|
|
2834
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2861
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2862
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2835
2863
|
cartNoteUpdate(cartId: $cartId, note: $note) {
|
|
2836
2864
|
cart {
|
|
2837
2865
|
...CartApiMutation
|
|
@@ -2852,24 +2880,28 @@ var CART_NOTE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#grap
|
|
|
2852
2880
|
// src/cart/queries/cartSelectedDeliveryOptionsUpdateDefault.ts
|
|
2853
2881
|
function cartSelectedDeliveryOptionsUpdateDefault(options) {
|
|
2854
2882
|
return async (selectedDeliveryOptions, optionalParams) => {
|
|
2855
|
-
const
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2883
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2884
|
+
const { cartSelectedDeliveryOptionsUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2885
|
+
CART_SELECTED_DELIVERY_OPTIONS_UPDATE_MUTATION(options.cartFragment, {
|
|
2886
|
+
includeVisitorConsent
|
|
2887
|
+
}),
|
|
2888
|
+
{
|
|
2889
|
+
variables: {
|
|
2890
|
+
cartId: options.getCartId(),
|
|
2891
|
+
selectedDeliveryOptions,
|
|
2892
|
+
...optionalParams
|
|
2893
|
+
}
|
|
2860
2894
|
}
|
|
2861
|
-
|
|
2895
|
+
);
|
|
2862
2896
|
return formatAPIResult(cartSelectedDeliveryOptionsUpdate, errors2);
|
|
2863
2897
|
};
|
|
2864
2898
|
}
|
|
2865
|
-
var CART_SELECTED_DELIVERY_OPTIONS_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2899
|
+
var CART_SELECTED_DELIVERY_OPTIONS_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2866
2900
|
mutation cartSelectedDeliveryOptionsUpdate(
|
|
2867
2901
|
$cartId: ID!
|
|
2868
2902
|
$selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
|
|
2869
|
-
$
|
|
2870
|
-
|
|
2871
|
-
$visitorConsent: VisitorConsent
|
|
2872
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2903
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2904
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2873
2905
|
cartSelectedDeliveryOptionsUpdate(cartId: $cartId, selectedDeliveryOptions: $selectedDeliveryOptions) {
|
|
2874
2906
|
cart {
|
|
2875
2907
|
...CartApiMutation
|
|
@@ -2890,24 +2922,28 @@ var CART_SELECTED_DELIVERY_OPTIONS_UPDATE_MUTATION = (cartFragment = MINIMAL_CAR
|
|
|
2890
2922
|
// src/cart/queries/cartAttributesUpdateDefault.ts
|
|
2891
2923
|
function cartAttributesUpdateDefault(options) {
|
|
2892
2924
|
return async (attributes, optionalParams) => {
|
|
2893
|
-
const
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2925
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2926
|
+
const { cartAttributesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2927
|
+
CART_ATTRIBUTES_UPDATE_MUTATION(options.cartFragment, {
|
|
2928
|
+
includeVisitorConsent
|
|
2929
|
+
}),
|
|
2930
|
+
{
|
|
2931
|
+
variables: {
|
|
2932
|
+
cartId: optionalParams?.cartId || options.getCartId(),
|
|
2933
|
+
attributes,
|
|
2934
|
+
...optionalParams
|
|
2935
|
+
}
|
|
2898
2936
|
}
|
|
2899
|
-
|
|
2937
|
+
);
|
|
2900
2938
|
return formatAPIResult(cartAttributesUpdate, errors2);
|
|
2901
2939
|
};
|
|
2902
2940
|
}
|
|
2903
|
-
var CART_ATTRIBUTES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2941
|
+
var CART_ATTRIBUTES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2904
2942
|
mutation cartAttributesUpdate(
|
|
2905
2943
|
$cartId: ID!
|
|
2906
2944
|
$attributes: [AttributeInput!]!
|
|
2907
|
-
$
|
|
2908
|
-
|
|
2909
|
-
$visitorConsent: VisitorConsent
|
|
2910
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2945
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2946
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2911
2947
|
cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
|
|
2912
2948
|
cart {
|
|
2913
2949
|
...CartApiMutation
|
|
@@ -2935,7 +2971,8 @@ function cartMetafieldsSetDefault(options) {
|
|
|
2935
2971
|
ownerId
|
|
2936
2972
|
})
|
|
2937
2973
|
);
|
|
2938
|
-
const
|
|
2974
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2975
|
+
const { cartMetafieldsSet, errors: errors2 } = await options.storefront.mutate(CART_METAFIELD_SET_MUTATION({ includeVisitorConsent }), {
|
|
2939
2976
|
variables: { metafields: metafieldsWithOwnerId, ...optionalParams }
|
|
2940
2977
|
});
|
|
2941
2978
|
return formatAPIResult(
|
|
@@ -2949,13 +2986,11 @@ function cartMetafieldsSetDefault(options) {
|
|
|
2949
2986
|
);
|
|
2950
2987
|
};
|
|
2951
2988
|
}
|
|
2952
|
-
var CART_METAFIELD_SET_MUTATION = () => `#graphql
|
|
2989
|
+
var CART_METAFIELD_SET_MUTATION = (options = {}) => `#graphql
|
|
2953
2990
|
mutation cartMetafieldsSet(
|
|
2954
2991
|
$metafields: [CartMetafieldsSetInput!]!
|
|
2955
|
-
$
|
|
2956
|
-
|
|
2957
|
-
$visitorConsent: VisitorConsent
|
|
2958
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2992
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2993
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2959
2994
|
cartMetafieldsSet(metafields: $metafields) {
|
|
2960
2995
|
userErrors {
|
|
2961
2996
|
code
|
|
@@ -2971,7 +3006,8 @@ var CART_METAFIELD_SET_MUTATION = () => `#graphql
|
|
|
2971
3006
|
function cartMetafieldDeleteDefault(options) {
|
|
2972
3007
|
return async (key, optionalParams) => {
|
|
2973
3008
|
const ownerId = optionalParams?.cartId || options.getCartId();
|
|
2974
|
-
const
|
|
3009
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3010
|
+
const { cartMetafieldDelete, errors: errors2 } = await options.storefront.mutate(CART_METAFIELD_DELETE_MUTATION({ includeVisitorConsent }), {
|
|
2975
3011
|
variables: {
|
|
2976
3012
|
input: {
|
|
2977
3013
|
ownerId,
|
|
@@ -2991,13 +3027,11 @@ function cartMetafieldDeleteDefault(options) {
|
|
|
2991
3027
|
);
|
|
2992
3028
|
};
|
|
2993
3029
|
}
|
|
2994
|
-
var CART_METAFIELD_DELETE_MUTATION = () => `#graphql
|
|
3030
|
+
var CART_METAFIELD_DELETE_MUTATION = (options = {}) => `#graphql
|
|
2995
3031
|
mutation cartMetafieldDelete(
|
|
2996
3032
|
$input: CartMetafieldDeleteInput!
|
|
2997
|
-
$
|
|
2998
|
-
|
|
2999
|
-
$visitorConsent: VisitorConsent
|
|
3000
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3033
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3034
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3001
3035
|
cartMetafieldDelete(input: $input) {
|
|
3002
3036
|
userErrors {
|
|
3003
3037
|
code
|
|
@@ -3011,24 +3045,28 @@ var CART_METAFIELD_DELETE_MUTATION = () => `#graphql
|
|
|
3011
3045
|
// src/cart/queries/cartGiftCardCodeUpdateDefault.ts
|
|
3012
3046
|
function cartGiftCardCodesUpdateDefault(options) {
|
|
3013
3047
|
return async (giftCardCodes, optionalParams) => {
|
|
3014
|
-
const
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3048
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3049
|
+
const { cartGiftCardCodesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
3050
|
+
CART_GIFT_CARD_CODE_UPDATE_MUTATION(options.cartFragment, {
|
|
3051
|
+
includeVisitorConsent
|
|
3052
|
+
}),
|
|
3053
|
+
{
|
|
3054
|
+
variables: {
|
|
3055
|
+
cartId: options.getCartId(),
|
|
3056
|
+
giftCardCodes,
|
|
3057
|
+
...optionalParams
|
|
3058
|
+
}
|
|
3019
3059
|
}
|
|
3020
|
-
|
|
3060
|
+
);
|
|
3021
3061
|
return formatAPIResult(cartGiftCardCodesUpdate, errors2);
|
|
3022
3062
|
};
|
|
3023
3063
|
}
|
|
3024
|
-
var CART_GIFT_CARD_CODE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3064
|
+
var CART_GIFT_CARD_CODE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3025
3065
|
mutation cartGiftCardCodesUpdate(
|
|
3026
3066
|
$cartId: ID!
|
|
3027
3067
|
$giftCardCodes: [String!]!
|
|
3028
|
-
$
|
|
3029
|
-
|
|
3030
|
-
$visitorConsent: VisitorConsent
|
|
3031
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3068
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3069
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3032
3070
|
cartGiftCardCodesUpdate(cartId: $cartId, giftCardCodes: $giftCardCodes) {
|
|
3033
3071
|
cart {
|
|
3034
3072
|
...CartApiMutation
|
|
@@ -3086,24 +3124,28 @@ var CART_GIFT_CARD_CODES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) =
|
|
|
3086
3124
|
// src/cart/queries/cartGiftCardCodesRemoveDefault.ts
|
|
3087
3125
|
function cartGiftCardCodesRemoveDefault(options) {
|
|
3088
3126
|
return async (appliedGiftCardIds, optionalParams) => {
|
|
3089
|
-
const
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3127
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3128
|
+
const { cartGiftCardCodesRemove, errors: errors2 } = await options.storefront.mutate(
|
|
3129
|
+
CART_GIFT_CARD_CODES_REMOVE_MUTATION(options.cartFragment, {
|
|
3130
|
+
includeVisitorConsent
|
|
3131
|
+
}),
|
|
3132
|
+
{
|
|
3133
|
+
variables: {
|
|
3134
|
+
cartId: options.getCartId(),
|
|
3135
|
+
appliedGiftCardIds,
|
|
3136
|
+
...optionalParams
|
|
3137
|
+
}
|
|
3094
3138
|
}
|
|
3095
|
-
|
|
3139
|
+
);
|
|
3096
3140
|
return formatAPIResult(cartGiftCardCodesRemove, errors2);
|
|
3097
3141
|
};
|
|
3098
3142
|
}
|
|
3099
|
-
var CART_GIFT_CARD_CODES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3143
|
+
var CART_GIFT_CARD_CODES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3100
3144
|
mutation cartGiftCardCodesRemove(
|
|
3101
3145
|
$cartId: ID!
|
|
3102
3146
|
$appliedGiftCardIds: [ID!]!
|
|
3103
|
-
$
|
|
3104
|
-
|
|
3105
|
-
$visitorConsent: VisitorConsent
|
|
3106
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3147
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3148
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3107
3149
|
cartGiftCardCodesRemove(cartId: $cartId, appliedGiftCardIds: $appliedGiftCardIds) {
|
|
3108
3150
|
cart {
|
|
3109
3151
|
...CartApiMutation
|
|
@@ -3124,24 +3166,28 @@ var CART_GIFT_CARD_CODES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT
|
|
|
3124
3166
|
// src/cart/queries/cartDeliveryAddressesAddDefault.tsx
|
|
3125
3167
|
function cartDeliveryAddressesAddDefault(options) {
|
|
3126
3168
|
return async (addresses, optionalParams) => {
|
|
3127
|
-
const
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3169
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3170
|
+
const { cartDeliveryAddressesAdd, errors: errors2 } = await options.storefront.mutate(
|
|
3171
|
+
CART_DELIVERY_ADDRESSES_ADD_MUTATION(options.cartFragment, {
|
|
3172
|
+
includeVisitorConsent
|
|
3173
|
+
}),
|
|
3174
|
+
{
|
|
3175
|
+
variables: {
|
|
3176
|
+
cartId: options.getCartId(),
|
|
3177
|
+
addresses,
|
|
3178
|
+
...optionalParams
|
|
3179
|
+
}
|
|
3132
3180
|
}
|
|
3133
|
-
|
|
3181
|
+
);
|
|
3134
3182
|
return formatAPIResult(cartDeliveryAddressesAdd, errors2);
|
|
3135
3183
|
};
|
|
3136
3184
|
}
|
|
3137
|
-
var CART_DELIVERY_ADDRESSES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3185
|
+
var CART_DELIVERY_ADDRESSES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3138
3186
|
mutation cartDeliveryAddressesAdd(
|
|
3139
3187
|
$cartId: ID!
|
|
3140
3188
|
$addresses: [CartSelectableAddressInput!]!,
|
|
3141
|
-
$
|
|
3142
|
-
|
|
3143
|
-
$visitorConsent: VisitorConsent
|
|
3144
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3189
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3190
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3145
3191
|
cartDeliveryAddressesAdd(addresses: $addresses, cartId: $cartId) {
|
|
3146
3192
|
cart {
|
|
3147
3193
|
...CartApiMutation
|
|
@@ -3162,24 +3208,28 @@ var CART_DELIVERY_ADDRESSES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT
|
|
|
3162
3208
|
// src/cart/queries/cartDeliveryAddressesRemoveDefault.tsx
|
|
3163
3209
|
function cartDeliveryAddressesRemoveDefault(options) {
|
|
3164
3210
|
return async (addressIds, optionalParams) => {
|
|
3165
|
-
const
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3211
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3212
|
+
const { cartDeliveryAddressesRemove, errors: errors2 } = await options.storefront.mutate(
|
|
3213
|
+
CART_DELIVERY_ADDRESSES_REMOVE_MUTATION(options.cartFragment, {
|
|
3214
|
+
includeVisitorConsent
|
|
3215
|
+
}),
|
|
3216
|
+
{
|
|
3217
|
+
variables: {
|
|
3218
|
+
cartId: options.getCartId(),
|
|
3219
|
+
addressIds,
|
|
3220
|
+
...optionalParams
|
|
3221
|
+
}
|
|
3170
3222
|
}
|
|
3171
|
-
|
|
3223
|
+
);
|
|
3172
3224
|
return formatAPIResult(cartDeliveryAddressesRemove, errors2);
|
|
3173
3225
|
};
|
|
3174
3226
|
}
|
|
3175
|
-
var CART_DELIVERY_ADDRESSES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3227
|
+
var CART_DELIVERY_ADDRESSES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3176
3228
|
mutation cartDeliveryAddressesRemove(
|
|
3177
3229
|
$cartId: ID!
|
|
3178
3230
|
$addressIds: [ID!]!,
|
|
3179
|
-
$
|
|
3180
|
-
|
|
3181
|
-
$visitorConsent: VisitorConsent
|
|
3182
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3231
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3232
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3183
3233
|
cartDeliveryAddressesRemove(addressIds: $addressIds, cartId: $cartId) {
|
|
3184
3234
|
cart {
|
|
3185
3235
|
...CartApiMutation
|
|
@@ -3200,24 +3250,28 @@ var CART_DELIVERY_ADDRESSES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGM
|
|
|
3200
3250
|
// src/cart/queries/cartDeliveryAddressesUpdateDefault.tsx
|
|
3201
3251
|
function cartDeliveryAddressesUpdateDefault(options) {
|
|
3202
3252
|
return async (addresses, optionalParams) => {
|
|
3203
|
-
const
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3253
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3254
|
+
const { cartDeliveryAddressesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
3255
|
+
CART_DELIVERY_ADDRESSES_UPDATE_MUTATION(options.cartFragment, {
|
|
3256
|
+
includeVisitorConsent
|
|
3257
|
+
}),
|
|
3258
|
+
{
|
|
3259
|
+
variables: {
|
|
3260
|
+
cartId: options.getCartId(),
|
|
3261
|
+
addresses,
|
|
3262
|
+
...optionalParams
|
|
3263
|
+
}
|
|
3208
3264
|
}
|
|
3209
|
-
|
|
3265
|
+
);
|
|
3210
3266
|
return formatAPIResult(cartDeliveryAddressesUpdate, errors2);
|
|
3211
3267
|
};
|
|
3212
3268
|
}
|
|
3213
|
-
var CART_DELIVERY_ADDRESSES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3269
|
+
var CART_DELIVERY_ADDRESSES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3214
3270
|
mutation cartDeliveryAddressesUpdate(
|
|
3215
3271
|
$cartId: ID!
|
|
3216
3272
|
$addresses: [CartSelectableAddressUpdateInput!]!,
|
|
3217
|
-
$
|
|
3218
|
-
|
|
3219
|
-
$visitorConsent: VisitorConsent
|
|
3220
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3273
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3274
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3221
3275
|
cartDeliveryAddressesUpdate(addresses: $addresses, cartId: $cartId) {
|
|
3222
3276
|
cart {
|
|
3223
3277
|
...CartApiMutation
|
|
@@ -3766,15 +3820,15 @@ function ensureLocalRedirectUrl({
|
|
|
3766
3820
|
redirectUrl
|
|
3767
3821
|
}) {
|
|
3768
3822
|
const fromUrl = requestUrl;
|
|
3769
|
-
const
|
|
3770
|
-
const toUrl = redirectUrl ? buildURLObject(requestUrl, redirectUrl) :
|
|
3823
|
+
const parsedDefaultUrl = buildURLObject(requestUrl, defaultUrl);
|
|
3824
|
+
const toUrl = redirectUrl ? buildURLObject(requestUrl, redirectUrl) : parsedDefaultUrl;
|
|
3771
3825
|
if (isLocalPath(requestUrl, toUrl.toString())) {
|
|
3772
3826
|
return toUrl.toString();
|
|
3773
3827
|
} else {
|
|
3774
3828
|
console.warn(
|
|
3775
|
-
`Cross-domain redirects are not supported. Tried to redirect from ${fromUrl} to ${toUrl}. Default url ${
|
|
3829
|
+
`Cross-domain redirects are not supported. Tried to redirect from ${fromUrl} to ${toUrl}. Default url ${parsedDefaultUrl} is used instead.`
|
|
3776
3830
|
);
|
|
3777
|
-
return
|
|
3831
|
+
return parsedDefaultUrl.toString();
|
|
3778
3832
|
}
|
|
3779
3833
|
}
|
|
3780
3834
|
function buildURLObject(requestUrl, relativeOrAbsoluteUrl) {
|