@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
|
@@ -613,7 +613,7 @@ function getPrivacyBanner() {
|
|
|
613
613
|
}
|
|
614
614
|
|
|
615
615
|
// package.json
|
|
616
|
-
var version = "2026.4.
|
|
616
|
+
var version = "2026.4.1";
|
|
617
617
|
|
|
618
618
|
// src/analytics-manager/ShopifyAnalytics.tsx
|
|
619
619
|
function getCustomerPrivacyRequired() {
|
|
@@ -2009,7 +2009,7 @@ function generateUUID() {
|
|
|
2009
2009
|
}
|
|
2010
2010
|
|
|
2011
2011
|
// src/version.ts
|
|
2012
|
-
var LIB_VERSION = "2026.4.
|
|
2012
|
+
var LIB_VERSION = "2026.4.1";
|
|
2013
2013
|
|
|
2014
2014
|
// src/utils/graphql.ts
|
|
2015
2015
|
function minifyQuery(string) {
|
|
@@ -2537,6 +2537,20 @@ function formatAPIResult(data, errors2) {
|
|
|
2537
2537
|
};
|
|
2538
2538
|
}
|
|
2539
2539
|
|
|
2540
|
+
// src/cart/queries/cart-query-helpers.ts
|
|
2541
|
+
function shouldIncludeVisitorConsent(input) {
|
|
2542
|
+
return input?.visitorConsent !== void 0;
|
|
2543
|
+
}
|
|
2544
|
+
function getInContextVariables(includeVisitorConsent = false) {
|
|
2545
|
+
const base = `$country: CountryCode = ZZ
|
|
2546
|
+
$language: LanguageCode`;
|
|
2547
|
+
return includeVisitorConsent ? `${base}
|
|
2548
|
+
$visitorConsent: VisitorConsent` : base;
|
|
2549
|
+
}
|
|
2550
|
+
function getInContextDirective(includeVisitorConsent = false) {
|
|
2551
|
+
return includeVisitorConsent ? "@inContext(country: $country, language: $language, visitorConsent: $visitorConsent)" : "@inContext(country: $country, language: $language)";
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2540
2554
|
// src/cart/queries/cartGetDefault.ts
|
|
2541
2555
|
function cartGetDefault({
|
|
2542
2556
|
storefront,
|
|
@@ -2547,12 +2561,16 @@ function cartGetDefault({
|
|
|
2547
2561
|
return async (cartInput) => {
|
|
2548
2562
|
const cartId = getCartId();
|
|
2549
2563
|
if (!cartId) return null;
|
|
2564
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(cartInput);
|
|
2550
2565
|
const [isCustomerLoggedIn, { cart, errors: errors2 }] = await Promise.all([
|
|
2551
2566
|
customerAccount ? customerAccount.isLoggedIn() : false,
|
|
2552
|
-
storefront.query(
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2567
|
+
storefront.query(
|
|
2568
|
+
CART_QUERY(cartFragment, { includeVisitorConsent }),
|
|
2569
|
+
{
|
|
2570
|
+
variables: { cartId, ...cartInput },
|
|
2571
|
+
cache: storefront.CacheNone()
|
|
2572
|
+
}
|
|
2573
|
+
)
|
|
2556
2574
|
]);
|
|
2557
2575
|
if (isCustomerLoggedIn && cart?.checkoutUrl) {
|
|
2558
2576
|
const finalCheckoutUrl = new URL(cart.checkoutUrl);
|
|
@@ -2562,14 +2580,12 @@ function cartGetDefault({
|
|
|
2562
2580
|
return cart || errors2 ? formatAPIResult(cart, errors2) : null;
|
|
2563
2581
|
};
|
|
2564
2582
|
}
|
|
2565
|
-
var CART_QUERY = (cartFragment = DEFAULT_CART_FRAGMENT) => `#graphql
|
|
2583
|
+
var CART_QUERY = (cartFragment = DEFAULT_CART_FRAGMENT, options = {}) => `#graphql
|
|
2566
2584
|
query CartQuery(
|
|
2567
2585
|
$cartId: ID!
|
|
2568
2586
|
$numCartLines: Int = 100
|
|
2569
|
-
$
|
|
2570
|
-
|
|
2571
|
-
$visitorConsent: VisitorConsent
|
|
2572
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2587
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2588
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2573
2589
|
cart(id: $cartId) {
|
|
2574
2590
|
...CartApiQuery
|
|
2575
2591
|
}
|
|
@@ -2723,7 +2739,8 @@ function cartCreateDefault(options) {
|
|
|
2723
2739
|
const buyer = options.customerAccount ? await options.customerAccount.getBuyer() : void 0;
|
|
2724
2740
|
const { cartId, ...restOfOptionalParams } = optionalParams || {};
|
|
2725
2741
|
const { buyerIdentity, ...restOfInput } = input;
|
|
2726
|
-
const
|
|
2742
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2743
|
+
const { cartCreate, errors: errors2 } = await options.storefront.mutate(CART_CREATE_MUTATION(options.cartFragment, { includeVisitorConsent }), {
|
|
2727
2744
|
variables: {
|
|
2728
2745
|
input: {
|
|
2729
2746
|
...restOfInput,
|
|
@@ -2738,13 +2755,11 @@ function cartCreateDefault(options) {
|
|
|
2738
2755
|
return formatAPIResult(cartCreate, errors2);
|
|
2739
2756
|
};
|
|
2740
2757
|
}
|
|
2741
|
-
var CART_CREATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2758
|
+
var CART_CREATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2742
2759
|
mutation cartCreate(
|
|
2743
2760
|
$input: CartInput!
|
|
2744
|
-
$
|
|
2745
|
-
|
|
2746
|
-
$visitorConsent: VisitorConsent
|
|
2747
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2761
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2762
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2748
2763
|
cartCreate(input: $input) {
|
|
2749
2764
|
cart {
|
|
2750
2765
|
...CartApiMutation
|
|
@@ -2766,7 +2781,8 @@ var CART_CREATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
|
2766
2781
|
// src/cart/queries/cartLinesAddDefault.ts
|
|
2767
2782
|
function cartLinesAddDefault(options) {
|
|
2768
2783
|
return async (lines, optionalParams) => {
|
|
2769
|
-
const
|
|
2784
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2785
|
+
const { cartLinesAdd, errors: errors2 } = await options.storefront.mutate(CART_LINES_ADD_MUTATION(options.cartFragment, { includeVisitorConsent }), {
|
|
2770
2786
|
variables: {
|
|
2771
2787
|
cartId: options.getCartId(),
|
|
2772
2788
|
lines,
|
|
@@ -2776,14 +2792,12 @@ function cartLinesAddDefault(options) {
|
|
|
2776
2792
|
return formatAPIResult(cartLinesAdd, errors2);
|
|
2777
2793
|
};
|
|
2778
2794
|
}
|
|
2779
|
-
var CART_LINES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2795
|
+
var CART_LINES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2780
2796
|
mutation cartLinesAdd(
|
|
2781
2797
|
$cartId: ID!
|
|
2782
2798
|
$lines: [CartLineInput!]!
|
|
2783
|
-
$
|
|
2784
|
-
|
|
2785
|
-
$visitorConsent: VisitorConsent
|
|
2786
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2799
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2800
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2787
2801
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
2788
2802
|
cart {
|
|
2789
2803
|
...CartApiMutation
|
|
@@ -2823,24 +2837,26 @@ function throwIfLinesAreOptimistic(type, lines) {
|
|
|
2823
2837
|
function cartLinesUpdateDefault(options) {
|
|
2824
2838
|
return async (lines, optionalParams) => {
|
|
2825
2839
|
throwIfLinesAreOptimistic("updateLines", lines);
|
|
2826
|
-
const
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2840
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2841
|
+
const { cartLinesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2842
|
+
CART_LINES_UPDATE_MUTATION(options.cartFragment, { includeVisitorConsent }),
|
|
2843
|
+
{
|
|
2844
|
+
variables: {
|
|
2845
|
+
cartId: options.getCartId(),
|
|
2846
|
+
lines,
|
|
2847
|
+
...optionalParams
|
|
2848
|
+
}
|
|
2831
2849
|
}
|
|
2832
|
-
|
|
2850
|
+
);
|
|
2833
2851
|
return formatAPIResult(cartLinesUpdate, errors2);
|
|
2834
2852
|
};
|
|
2835
2853
|
}
|
|
2836
|
-
var CART_LINES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2854
|
+
var CART_LINES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2837
2855
|
mutation cartLinesUpdate(
|
|
2838
2856
|
$cartId: ID!
|
|
2839
2857
|
$lines: [CartLineUpdateInput!]!
|
|
2840
|
-
$
|
|
2841
|
-
|
|
2842
|
-
$visitorConsent: VisitorConsent
|
|
2843
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2858
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2859
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2844
2860
|
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
2845
2861
|
cart {
|
|
2846
2862
|
...CartApiMutation
|
|
@@ -2862,24 +2878,26 @@ var CART_LINES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#gra
|
|
|
2862
2878
|
function cartLinesRemoveDefault(options) {
|
|
2863
2879
|
return async (lineIds, optionalParams) => {
|
|
2864
2880
|
throwIfLinesAreOptimistic("removeLines", lineIds);
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2881
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2882
|
+
const { cartLinesRemove, errors: errors2 } = await options.storefront.mutate(
|
|
2883
|
+
CART_LINES_REMOVE_MUTATION(options.cartFragment, { includeVisitorConsent }),
|
|
2884
|
+
{
|
|
2885
|
+
variables: {
|
|
2886
|
+
cartId: options.getCartId(),
|
|
2887
|
+
lineIds,
|
|
2888
|
+
...optionalParams
|
|
2889
|
+
}
|
|
2870
2890
|
}
|
|
2871
|
-
|
|
2891
|
+
);
|
|
2872
2892
|
return formatAPIResult(cartLinesRemove, errors2);
|
|
2873
2893
|
};
|
|
2874
2894
|
}
|
|
2875
|
-
var CART_LINES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2895
|
+
var CART_LINES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2876
2896
|
mutation cartLinesRemove(
|
|
2877
2897
|
$cartId: ID!
|
|
2878
2898
|
$lineIds: [ID!]!
|
|
2879
|
-
$
|
|
2880
|
-
|
|
2881
|
-
$visitorConsent: VisitorConsent
|
|
2882
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2899
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2900
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2883
2901
|
cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
|
|
2884
2902
|
cart {
|
|
2885
2903
|
...CartApiMutation
|
|
@@ -2903,24 +2921,28 @@ function cartDiscountCodesUpdateDefault(options) {
|
|
|
2903
2921
|
const uniqueCodes = discountCodes.filter((value, index, array) => {
|
|
2904
2922
|
return array.indexOf(value) === index;
|
|
2905
2923
|
});
|
|
2906
|
-
const
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2924
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2925
|
+
const { cartDiscountCodesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2926
|
+
CART_DISCOUNT_CODE_UPDATE_MUTATION(options.cartFragment, {
|
|
2927
|
+
includeVisitorConsent
|
|
2928
|
+
}),
|
|
2929
|
+
{
|
|
2930
|
+
variables: {
|
|
2931
|
+
cartId: options.getCartId(),
|
|
2932
|
+
discountCodes: uniqueCodes,
|
|
2933
|
+
...optionalParams
|
|
2934
|
+
}
|
|
2911
2935
|
}
|
|
2912
|
-
|
|
2936
|
+
);
|
|
2913
2937
|
return formatAPIResult(cartDiscountCodesUpdate, errors2);
|
|
2914
2938
|
};
|
|
2915
2939
|
}
|
|
2916
|
-
var CART_DISCOUNT_CODE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2940
|
+
var CART_DISCOUNT_CODE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2917
2941
|
mutation cartDiscountCodesUpdate(
|
|
2918
2942
|
$cartId: ID!
|
|
2919
2943
|
$discountCodes: [String!]!
|
|
2920
|
-
$
|
|
2921
|
-
|
|
2922
|
-
$visitorConsent: VisitorConsent
|
|
2923
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2944
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2945
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2924
2946
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
2925
2947
|
... @defer {
|
|
2926
2948
|
cart {
|
|
@@ -2949,27 +2971,31 @@ function cartBuyerIdentityUpdateDefault(options) {
|
|
|
2949
2971
|
});
|
|
2950
2972
|
}
|
|
2951
2973
|
const buyer = options.customerAccount ? await options.customerAccount.getBuyer() : void 0;
|
|
2952
|
-
const
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2974
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
2975
|
+
const { cartBuyerIdentityUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
2976
|
+
CART_BUYER_IDENTITY_UPDATE_MUTATION(options.cartFragment, {
|
|
2977
|
+
includeVisitorConsent
|
|
2978
|
+
}),
|
|
2979
|
+
{
|
|
2980
|
+
variables: {
|
|
2981
|
+
cartId: options.getCartId(),
|
|
2982
|
+
buyerIdentity: {
|
|
2983
|
+
...buyer,
|
|
2984
|
+
...buyerIdentity
|
|
2985
|
+
},
|
|
2986
|
+
...optionalParams
|
|
2987
|
+
}
|
|
2960
2988
|
}
|
|
2961
|
-
|
|
2989
|
+
);
|
|
2962
2990
|
return formatAPIResult(cartBuyerIdentityUpdate, errors2);
|
|
2963
2991
|
};
|
|
2964
2992
|
}
|
|
2965
|
-
var CART_BUYER_IDENTITY_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
2993
|
+
var CART_BUYER_IDENTITY_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
2966
2994
|
mutation cartBuyerIdentityUpdate(
|
|
2967
2995
|
$cartId: ID!
|
|
2968
2996
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
2969
|
-
$
|
|
2970
|
-
|
|
2971
|
-
$visitorConsent: VisitorConsent
|
|
2972
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
2997
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
2998
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
2973
2999
|
cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
|
|
2974
3000
|
cart {
|
|
2975
3001
|
...CartApiMutation
|
|
@@ -2990,24 +3016,26 @@ var CART_BUYER_IDENTITY_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT)
|
|
|
2990
3016
|
// src/cart/queries/cartNoteUpdateDefault.ts
|
|
2991
3017
|
function cartNoteUpdateDefault(options) {
|
|
2992
3018
|
return async (note, optionalParams) => {
|
|
2993
|
-
const
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
3019
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3020
|
+
const { cartNoteUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
3021
|
+
CART_NOTE_UPDATE_MUTATION(options.cartFragment, { includeVisitorConsent }),
|
|
3022
|
+
{
|
|
3023
|
+
variables: {
|
|
3024
|
+
cartId: options.getCartId(),
|
|
3025
|
+
note,
|
|
3026
|
+
...optionalParams
|
|
3027
|
+
}
|
|
2998
3028
|
}
|
|
2999
|
-
|
|
3029
|
+
);
|
|
3000
3030
|
return formatAPIResult(cartNoteUpdate, errors2);
|
|
3001
3031
|
};
|
|
3002
3032
|
}
|
|
3003
|
-
var CART_NOTE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3033
|
+
var CART_NOTE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3004
3034
|
mutation cartNoteUpdate(
|
|
3005
3035
|
$cartId: ID!
|
|
3006
3036
|
$note: String!
|
|
3007
|
-
$
|
|
3008
|
-
|
|
3009
|
-
$visitorConsent: VisitorConsent
|
|
3010
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3037
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3038
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3011
3039
|
cartNoteUpdate(cartId: $cartId, note: $note) {
|
|
3012
3040
|
cart {
|
|
3013
3041
|
...CartApiMutation
|
|
@@ -3028,24 +3056,28 @@ var CART_NOTE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#grap
|
|
|
3028
3056
|
// src/cart/queries/cartSelectedDeliveryOptionsUpdateDefault.ts
|
|
3029
3057
|
function cartSelectedDeliveryOptionsUpdateDefault(options) {
|
|
3030
3058
|
return async (selectedDeliveryOptions, optionalParams) => {
|
|
3031
|
-
const
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3059
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3060
|
+
const { cartSelectedDeliveryOptionsUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
3061
|
+
CART_SELECTED_DELIVERY_OPTIONS_UPDATE_MUTATION(options.cartFragment, {
|
|
3062
|
+
includeVisitorConsent
|
|
3063
|
+
}),
|
|
3064
|
+
{
|
|
3065
|
+
variables: {
|
|
3066
|
+
cartId: options.getCartId(),
|
|
3067
|
+
selectedDeliveryOptions,
|
|
3068
|
+
...optionalParams
|
|
3069
|
+
}
|
|
3036
3070
|
}
|
|
3037
|
-
|
|
3071
|
+
);
|
|
3038
3072
|
return formatAPIResult(cartSelectedDeliveryOptionsUpdate, errors2);
|
|
3039
3073
|
};
|
|
3040
3074
|
}
|
|
3041
|
-
var CART_SELECTED_DELIVERY_OPTIONS_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3075
|
+
var CART_SELECTED_DELIVERY_OPTIONS_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3042
3076
|
mutation cartSelectedDeliveryOptionsUpdate(
|
|
3043
3077
|
$cartId: ID!
|
|
3044
3078
|
$selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
|
|
3045
|
-
$
|
|
3046
|
-
|
|
3047
|
-
$visitorConsent: VisitorConsent
|
|
3048
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3079
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3080
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3049
3081
|
cartSelectedDeliveryOptionsUpdate(cartId: $cartId, selectedDeliveryOptions: $selectedDeliveryOptions) {
|
|
3050
3082
|
cart {
|
|
3051
3083
|
...CartApiMutation
|
|
@@ -3066,24 +3098,28 @@ var CART_SELECTED_DELIVERY_OPTIONS_UPDATE_MUTATION = (cartFragment = MINIMAL_CAR
|
|
|
3066
3098
|
// src/cart/queries/cartAttributesUpdateDefault.ts
|
|
3067
3099
|
function cartAttributesUpdateDefault(options) {
|
|
3068
3100
|
return async (attributes, optionalParams) => {
|
|
3069
|
-
const
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3101
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3102
|
+
const { cartAttributesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
3103
|
+
CART_ATTRIBUTES_UPDATE_MUTATION(options.cartFragment, {
|
|
3104
|
+
includeVisitorConsent
|
|
3105
|
+
}),
|
|
3106
|
+
{
|
|
3107
|
+
variables: {
|
|
3108
|
+
cartId: optionalParams?.cartId || options.getCartId(),
|
|
3109
|
+
attributes,
|
|
3110
|
+
...optionalParams
|
|
3111
|
+
}
|
|
3074
3112
|
}
|
|
3075
|
-
|
|
3113
|
+
);
|
|
3076
3114
|
return formatAPIResult(cartAttributesUpdate, errors2);
|
|
3077
3115
|
};
|
|
3078
3116
|
}
|
|
3079
|
-
var CART_ATTRIBUTES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3117
|
+
var CART_ATTRIBUTES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3080
3118
|
mutation cartAttributesUpdate(
|
|
3081
3119
|
$cartId: ID!
|
|
3082
3120
|
$attributes: [AttributeInput!]!
|
|
3083
|
-
$
|
|
3084
|
-
|
|
3085
|
-
$visitorConsent: VisitorConsent
|
|
3086
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3121
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3122
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3087
3123
|
cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
|
|
3088
3124
|
cart {
|
|
3089
3125
|
...CartApiMutation
|
|
@@ -3111,7 +3147,8 @@ function cartMetafieldsSetDefault(options) {
|
|
|
3111
3147
|
ownerId
|
|
3112
3148
|
})
|
|
3113
3149
|
);
|
|
3114
|
-
const
|
|
3150
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3151
|
+
const { cartMetafieldsSet, errors: errors2 } = await options.storefront.mutate(CART_METAFIELD_SET_MUTATION({ includeVisitorConsent }), {
|
|
3115
3152
|
variables: { metafields: metafieldsWithOwnerId, ...optionalParams }
|
|
3116
3153
|
});
|
|
3117
3154
|
return formatAPIResult(
|
|
@@ -3125,13 +3162,11 @@ function cartMetafieldsSetDefault(options) {
|
|
|
3125
3162
|
);
|
|
3126
3163
|
};
|
|
3127
3164
|
}
|
|
3128
|
-
var CART_METAFIELD_SET_MUTATION = () => `#graphql
|
|
3165
|
+
var CART_METAFIELD_SET_MUTATION = (options = {}) => `#graphql
|
|
3129
3166
|
mutation cartMetafieldsSet(
|
|
3130
3167
|
$metafields: [CartMetafieldsSetInput!]!
|
|
3131
|
-
$
|
|
3132
|
-
|
|
3133
|
-
$visitorConsent: VisitorConsent
|
|
3134
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3168
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3169
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3135
3170
|
cartMetafieldsSet(metafields: $metafields) {
|
|
3136
3171
|
userErrors {
|
|
3137
3172
|
code
|
|
@@ -3147,7 +3182,8 @@ var CART_METAFIELD_SET_MUTATION = () => `#graphql
|
|
|
3147
3182
|
function cartMetafieldDeleteDefault(options) {
|
|
3148
3183
|
return async (key, optionalParams) => {
|
|
3149
3184
|
const ownerId = optionalParams?.cartId || options.getCartId();
|
|
3150
|
-
const
|
|
3185
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3186
|
+
const { cartMetafieldDelete, errors: errors2 } = await options.storefront.mutate(CART_METAFIELD_DELETE_MUTATION({ includeVisitorConsent }), {
|
|
3151
3187
|
variables: {
|
|
3152
3188
|
input: {
|
|
3153
3189
|
ownerId,
|
|
@@ -3167,13 +3203,11 @@ function cartMetafieldDeleteDefault(options) {
|
|
|
3167
3203
|
);
|
|
3168
3204
|
};
|
|
3169
3205
|
}
|
|
3170
|
-
var CART_METAFIELD_DELETE_MUTATION = () => `#graphql
|
|
3206
|
+
var CART_METAFIELD_DELETE_MUTATION = (options = {}) => `#graphql
|
|
3171
3207
|
mutation cartMetafieldDelete(
|
|
3172
3208
|
$input: CartMetafieldDeleteInput!
|
|
3173
|
-
$
|
|
3174
|
-
|
|
3175
|
-
$visitorConsent: VisitorConsent
|
|
3176
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3209
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3210
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3177
3211
|
cartMetafieldDelete(input: $input) {
|
|
3178
3212
|
userErrors {
|
|
3179
3213
|
code
|
|
@@ -3187,24 +3221,28 @@ var CART_METAFIELD_DELETE_MUTATION = () => `#graphql
|
|
|
3187
3221
|
// src/cart/queries/cartGiftCardCodeUpdateDefault.ts
|
|
3188
3222
|
function cartGiftCardCodesUpdateDefault(options) {
|
|
3189
3223
|
return async (giftCardCodes, optionalParams) => {
|
|
3190
|
-
const
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3224
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3225
|
+
const { cartGiftCardCodesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
3226
|
+
CART_GIFT_CARD_CODE_UPDATE_MUTATION(options.cartFragment, {
|
|
3227
|
+
includeVisitorConsent
|
|
3228
|
+
}),
|
|
3229
|
+
{
|
|
3230
|
+
variables: {
|
|
3231
|
+
cartId: options.getCartId(),
|
|
3232
|
+
giftCardCodes,
|
|
3233
|
+
...optionalParams
|
|
3234
|
+
}
|
|
3195
3235
|
}
|
|
3196
|
-
|
|
3236
|
+
);
|
|
3197
3237
|
return formatAPIResult(cartGiftCardCodesUpdate, errors2);
|
|
3198
3238
|
};
|
|
3199
3239
|
}
|
|
3200
|
-
var CART_GIFT_CARD_CODE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3240
|
+
var CART_GIFT_CARD_CODE_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3201
3241
|
mutation cartGiftCardCodesUpdate(
|
|
3202
3242
|
$cartId: ID!
|
|
3203
3243
|
$giftCardCodes: [String!]!
|
|
3204
|
-
$
|
|
3205
|
-
|
|
3206
|
-
$visitorConsent: VisitorConsent
|
|
3207
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3244
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3245
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3208
3246
|
cartGiftCardCodesUpdate(cartId: $cartId, giftCardCodes: $giftCardCodes) {
|
|
3209
3247
|
cart {
|
|
3210
3248
|
...CartApiMutation
|
|
@@ -3262,24 +3300,28 @@ var CART_GIFT_CARD_CODES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) =
|
|
|
3262
3300
|
// src/cart/queries/cartGiftCardCodesRemoveDefault.ts
|
|
3263
3301
|
function cartGiftCardCodesRemoveDefault(options) {
|
|
3264
3302
|
return async (appliedGiftCardIds, optionalParams) => {
|
|
3265
|
-
const
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3303
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3304
|
+
const { cartGiftCardCodesRemove, errors: errors2 } = await options.storefront.mutate(
|
|
3305
|
+
CART_GIFT_CARD_CODES_REMOVE_MUTATION(options.cartFragment, {
|
|
3306
|
+
includeVisitorConsent
|
|
3307
|
+
}),
|
|
3308
|
+
{
|
|
3309
|
+
variables: {
|
|
3310
|
+
cartId: options.getCartId(),
|
|
3311
|
+
appliedGiftCardIds,
|
|
3312
|
+
...optionalParams
|
|
3313
|
+
}
|
|
3270
3314
|
}
|
|
3271
|
-
|
|
3315
|
+
);
|
|
3272
3316
|
return formatAPIResult(cartGiftCardCodesRemove, errors2);
|
|
3273
3317
|
};
|
|
3274
3318
|
}
|
|
3275
|
-
var CART_GIFT_CARD_CODES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3319
|
+
var CART_GIFT_CARD_CODES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3276
3320
|
mutation cartGiftCardCodesRemove(
|
|
3277
3321
|
$cartId: ID!
|
|
3278
3322
|
$appliedGiftCardIds: [ID!]!
|
|
3279
|
-
$
|
|
3280
|
-
|
|
3281
|
-
$visitorConsent: VisitorConsent
|
|
3282
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3323
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3324
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3283
3325
|
cartGiftCardCodesRemove(cartId: $cartId, appliedGiftCardIds: $appliedGiftCardIds) {
|
|
3284
3326
|
cart {
|
|
3285
3327
|
...CartApiMutation
|
|
@@ -3300,24 +3342,28 @@ var CART_GIFT_CARD_CODES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT
|
|
|
3300
3342
|
// src/cart/queries/cartDeliveryAddressesAddDefault.tsx
|
|
3301
3343
|
function cartDeliveryAddressesAddDefault(options) {
|
|
3302
3344
|
return async (addresses, optionalParams) => {
|
|
3303
|
-
const
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3345
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3346
|
+
const { cartDeliveryAddressesAdd, errors: errors2 } = await options.storefront.mutate(
|
|
3347
|
+
CART_DELIVERY_ADDRESSES_ADD_MUTATION(options.cartFragment, {
|
|
3348
|
+
includeVisitorConsent
|
|
3349
|
+
}),
|
|
3350
|
+
{
|
|
3351
|
+
variables: {
|
|
3352
|
+
cartId: options.getCartId(),
|
|
3353
|
+
addresses,
|
|
3354
|
+
...optionalParams
|
|
3355
|
+
}
|
|
3308
3356
|
}
|
|
3309
|
-
|
|
3357
|
+
);
|
|
3310
3358
|
return formatAPIResult(cartDeliveryAddressesAdd, errors2);
|
|
3311
3359
|
};
|
|
3312
3360
|
}
|
|
3313
|
-
var CART_DELIVERY_ADDRESSES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3361
|
+
var CART_DELIVERY_ADDRESSES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3314
3362
|
mutation cartDeliveryAddressesAdd(
|
|
3315
3363
|
$cartId: ID!
|
|
3316
3364
|
$addresses: [CartSelectableAddressInput!]!,
|
|
3317
|
-
$
|
|
3318
|
-
|
|
3319
|
-
$visitorConsent: VisitorConsent
|
|
3320
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3365
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3366
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3321
3367
|
cartDeliveryAddressesAdd(addresses: $addresses, cartId: $cartId) {
|
|
3322
3368
|
cart {
|
|
3323
3369
|
...CartApiMutation
|
|
@@ -3338,24 +3384,28 @@ var CART_DELIVERY_ADDRESSES_ADD_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT
|
|
|
3338
3384
|
// src/cart/queries/cartDeliveryAddressesRemoveDefault.tsx
|
|
3339
3385
|
function cartDeliveryAddressesRemoveDefault(options) {
|
|
3340
3386
|
return async (addressIds, optionalParams) => {
|
|
3341
|
-
const
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3387
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3388
|
+
const { cartDeliveryAddressesRemove, errors: errors2 } = await options.storefront.mutate(
|
|
3389
|
+
CART_DELIVERY_ADDRESSES_REMOVE_MUTATION(options.cartFragment, {
|
|
3390
|
+
includeVisitorConsent
|
|
3391
|
+
}),
|
|
3392
|
+
{
|
|
3393
|
+
variables: {
|
|
3394
|
+
cartId: options.getCartId(),
|
|
3395
|
+
addressIds,
|
|
3396
|
+
...optionalParams
|
|
3397
|
+
}
|
|
3346
3398
|
}
|
|
3347
|
-
|
|
3399
|
+
);
|
|
3348
3400
|
return formatAPIResult(cartDeliveryAddressesRemove, errors2);
|
|
3349
3401
|
};
|
|
3350
3402
|
}
|
|
3351
|
-
var CART_DELIVERY_ADDRESSES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3403
|
+
var CART_DELIVERY_ADDRESSES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3352
3404
|
mutation cartDeliveryAddressesRemove(
|
|
3353
3405
|
$cartId: ID!
|
|
3354
3406
|
$addressIds: [ID!]!,
|
|
3355
|
-
$
|
|
3356
|
-
|
|
3357
|
-
$visitorConsent: VisitorConsent
|
|
3358
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3407
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3408
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3359
3409
|
cartDeliveryAddressesRemove(addressIds: $addressIds, cartId: $cartId) {
|
|
3360
3410
|
cart {
|
|
3361
3411
|
...CartApiMutation
|
|
@@ -3376,24 +3426,28 @@ var CART_DELIVERY_ADDRESSES_REMOVE_MUTATION = (cartFragment = MINIMAL_CART_FRAGM
|
|
|
3376
3426
|
// src/cart/queries/cartDeliveryAddressesUpdateDefault.tsx
|
|
3377
3427
|
function cartDeliveryAddressesUpdateDefault(options) {
|
|
3378
3428
|
return async (addresses, optionalParams) => {
|
|
3379
|
-
const
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3429
|
+
const includeVisitorConsent = shouldIncludeVisitorConsent(optionalParams);
|
|
3430
|
+
const { cartDeliveryAddressesUpdate, errors: errors2 } = await options.storefront.mutate(
|
|
3431
|
+
CART_DELIVERY_ADDRESSES_UPDATE_MUTATION(options.cartFragment, {
|
|
3432
|
+
includeVisitorConsent
|
|
3433
|
+
}),
|
|
3434
|
+
{
|
|
3435
|
+
variables: {
|
|
3436
|
+
cartId: options.getCartId(),
|
|
3437
|
+
addresses,
|
|
3438
|
+
...optionalParams
|
|
3439
|
+
}
|
|
3384
3440
|
}
|
|
3385
|
-
|
|
3441
|
+
);
|
|
3386
3442
|
return formatAPIResult(cartDeliveryAddressesUpdate, errors2);
|
|
3387
3443
|
};
|
|
3388
3444
|
}
|
|
3389
|
-
var CART_DELIVERY_ADDRESSES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT) => `#graphql
|
|
3445
|
+
var CART_DELIVERY_ADDRESSES_UPDATE_MUTATION = (cartFragment = MINIMAL_CART_FRAGMENT, options = {}) => `#graphql
|
|
3390
3446
|
mutation cartDeliveryAddressesUpdate(
|
|
3391
3447
|
$cartId: ID!
|
|
3392
3448
|
$addresses: [CartSelectableAddressUpdateInput!]!,
|
|
3393
|
-
$
|
|
3394
|
-
|
|
3395
|
-
$visitorConsent: VisitorConsent
|
|
3396
|
-
) @inContext(country: $country, language: $language, visitorConsent: $visitorConsent) {
|
|
3449
|
+
${getInContextVariables(options.includeVisitorConsent)}
|
|
3450
|
+
) ${getInContextDirective(options.includeVisitorConsent)} {
|
|
3397
3451
|
cartDeliveryAddressesUpdate(addresses: $addresses, cartId: $cartId) {
|
|
3398
3452
|
cart {
|
|
3399
3453
|
...CartApiMutation
|
|
@@ -3942,15 +3996,15 @@ function ensureLocalRedirectUrl({
|
|
|
3942
3996
|
redirectUrl
|
|
3943
3997
|
}) {
|
|
3944
3998
|
const fromUrl = requestUrl;
|
|
3945
|
-
const
|
|
3946
|
-
const toUrl = redirectUrl ? buildURLObject(requestUrl, redirectUrl) :
|
|
3999
|
+
const parsedDefaultUrl = buildURLObject(requestUrl, defaultUrl);
|
|
4000
|
+
const toUrl = redirectUrl ? buildURLObject(requestUrl, redirectUrl) : parsedDefaultUrl;
|
|
3947
4001
|
if (isLocalPath(requestUrl, toUrl.toString())) {
|
|
3948
4002
|
return toUrl.toString();
|
|
3949
4003
|
} else {
|
|
3950
4004
|
console.warn(
|
|
3951
|
-
`Cross-domain redirects are not supported. Tried to redirect from ${fromUrl} to ${toUrl}. Default url ${
|
|
4005
|
+
`Cross-domain redirects are not supported. Tried to redirect from ${fromUrl} to ${toUrl}. Default url ${parsedDefaultUrl} is used instead.`
|
|
3952
4006
|
);
|
|
3953
|
-
return
|
|
4007
|
+
return parsedDefaultUrl.toString();
|
|
3954
4008
|
}
|
|
3955
4009
|
}
|
|
3956
4010
|
function buildURLObject(requestUrl, relativeOrAbsoluteUrl) {
|