@anker-in/shopify-react 0.1.1-beta.13 → 0.1.1-beta.15
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/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +8 -4
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +8 -4
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/{index-C77lIEQZ.d.ts → index-Bfg4hT-O.d.ts} +2 -10
- package/dist/{index-CO_fgrFV.d.mts → index-DGaexgLe.d.mts} +2 -10
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +1 -1
- package/dist/provider/index.d.ts +1 -1
- package/dist/{types-DpxtE_nv.d.mts → types-DX-2ABDs.d.mts} +4 -1
- package/dist/{types-DpxtE_nv.d.ts → types-DX-2ABDs.d.ts} +4 -1
- package/package.json +3 -3
package/dist/hooks/index.mjs
CHANGED
|
@@ -880,7 +880,7 @@ function useRemoveCartCodes(options) {
|
|
|
880
880
|
// src/hooks/cart/use-add-to-cart.ts
|
|
881
881
|
function useAddToCart({ withTrack = true } = {}, swrOptions) {
|
|
882
882
|
const { client, config, locale, cartCookieAdapter, userAdapter } = useShopify();
|
|
883
|
-
const { cart } = useCartContext();
|
|
883
|
+
const { cart, addCustomAttributes } = useCartContext();
|
|
884
884
|
const { trigger: applyCartCodes } = useApplyCartCodes();
|
|
885
885
|
const { trigger: removeInvalidCodes } = useRemoveCartCodes();
|
|
886
886
|
const { trigger: addCartLines2 } = useAddCartLines();
|
|
@@ -894,7 +894,8 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
|
|
|
894
894
|
buyerIdentity,
|
|
895
895
|
needCreateCart = false,
|
|
896
896
|
onCodesInvalid,
|
|
897
|
-
replaceExistingCodes
|
|
897
|
+
replaceExistingCodes,
|
|
898
|
+
customAttributes
|
|
898
899
|
} = arg;
|
|
899
900
|
if (!lineItems || lineItems.length === 0) {
|
|
900
901
|
return;
|
|
@@ -939,6 +940,9 @@ function useAddToCart({ withTrack = true } = {}, swrOptions) {
|
|
|
939
940
|
discountCodes
|
|
940
941
|
});
|
|
941
942
|
}
|
|
943
|
+
if (customAttributes && customAttributes.length > 0) {
|
|
944
|
+
addCustomAttributes(customAttributes);
|
|
945
|
+
}
|
|
942
946
|
if (withTrack) {
|
|
943
947
|
trackAddToCartGA({
|
|
944
948
|
lineItems,
|
|
@@ -2577,7 +2581,7 @@ var useUpdatePlusMemberDeliveryOptions = ({
|
|
|
2577
2581
|
const { deliveryData } = arg;
|
|
2578
2582
|
const firstDeliveryGroup = currentCart?.deliveryGroups?.[0];
|
|
2579
2583
|
const deliveryGroupId = firstDeliveryGroup?.id;
|
|
2580
|
-
const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option;
|
|
2584
|
+
const selectedOptionCode = deliveryData?.deliveryCustomData?.selected_delivery_option?.code;
|
|
2581
2585
|
if (!deliveryGroupId || !selectedOptionCode || selectedOptionCode === firstDeliveryGroup?.selectedDeliveryOption?.code) {
|
|
2582
2586
|
return null;
|
|
2583
2587
|
}
|
|
@@ -2702,7 +2706,7 @@ function useAddPlusMemberProductsToCart({
|
|
|
2702
2706
|
if (profile?.isMonthlyPlus && selectedPlusMemberMode === "monthly" /* MONTHLY */) {
|
|
2703
2707
|
return void 0;
|
|
2704
2708
|
}
|
|
2705
|
-
if (
|
|
2709
|
+
if (profile?.isAnnualPlus && selectedPlusMemberMode === "annual" /* ANNUAL */) {
|
|
2706
2710
|
return void 0;
|
|
2707
2711
|
}
|
|
2708
2712
|
return selectedPlusMemberProduct;
|