@anker-in/shopify-react 1.2.0-beta.4 → 1.2.0-beta.5
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 +3 -1
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/index.js +4 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +4 -3
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -5
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +3 -1
- package/dist/provider/index.d.ts +3 -1
- package/dist/provider/index.js +8 -5
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +8 -5
- package/dist/provider/index.mjs.map +1 -1
- package/package.json +17 -17
package/dist/hooks/index.d.mts
CHANGED
|
@@ -801,7 +801,7 @@ declare const useCartItemQuantityLimit: ({ cart, cartItem, config, }: {
|
|
|
801
801
|
/**
|
|
802
802
|
* 更新购物车中各个 item 的折后价相关的属性
|
|
803
803
|
*/
|
|
804
|
-
declare const useUpdateLineCodeAmountAttributes: ({ cart, mutateCart, isCartLoading, setLoadingState, metafieldIdentifiers, }: {
|
|
804
|
+
declare const useUpdateLineCodeAmountAttributes: ({ cart, mutateCart, isCartLoading, setLoadingState, metafieldIdentifiers, disabled, }: {
|
|
805
805
|
cart?: NormalizedCart;
|
|
806
806
|
mutateCart: (cart: NormalizedCart | undefined) => void;
|
|
807
807
|
isCartLoading: boolean;
|
|
@@ -810,6 +810,8 @@ declare const useUpdateLineCodeAmountAttributes: ({ cart, mutateCart, isCartLoad
|
|
|
810
810
|
variant: HasMetafieldsIdentifier[];
|
|
811
811
|
product: HasMetafieldsIdentifier[];
|
|
812
812
|
};
|
|
813
|
+
/** 是否禁用更新 */
|
|
814
|
+
disabled?: boolean;
|
|
813
815
|
}) => void;
|
|
814
816
|
|
|
815
817
|
declare const currencyCodeMapping: Record<string, string>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -801,7 +801,7 @@ declare const useCartItemQuantityLimit: ({ cart, cartItem, config, }: {
|
|
|
801
801
|
/**
|
|
802
802
|
* 更新购物车中各个 item 的折后价相关的属性
|
|
803
803
|
*/
|
|
804
|
-
declare const useUpdateLineCodeAmountAttributes: ({ cart, mutateCart, isCartLoading, setLoadingState, metafieldIdentifiers, }: {
|
|
804
|
+
declare const useUpdateLineCodeAmountAttributes: ({ cart, mutateCart, isCartLoading, setLoadingState, metafieldIdentifiers, disabled, }: {
|
|
805
805
|
cart?: NormalizedCart;
|
|
806
806
|
mutateCart: (cart: NormalizedCart | undefined) => void;
|
|
807
807
|
isCartLoading: boolean;
|
|
@@ -810,6 +810,8 @@ declare const useUpdateLineCodeAmountAttributes: ({ cart, mutateCart, isCartLoad
|
|
|
810
810
|
variant: HasMetafieldsIdentifier[];
|
|
811
811
|
product: HasMetafieldsIdentifier[];
|
|
812
812
|
};
|
|
813
|
+
/** 是否禁用更新 */
|
|
814
|
+
disabled?: boolean;
|
|
813
815
|
}) => void;
|
|
814
816
|
|
|
815
817
|
declare const currencyCodeMapping: Record<string, string>;
|
package/dist/hooks/index.js
CHANGED
|
@@ -1657,7 +1657,8 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
1657
1657
|
mutateCart,
|
|
1658
1658
|
isCartLoading,
|
|
1659
1659
|
setLoadingState,
|
|
1660
|
-
metafieldIdentifiers
|
|
1660
|
+
metafieldIdentifiers,
|
|
1661
|
+
disabled = false
|
|
1661
1662
|
}) => {
|
|
1662
1663
|
const { client, cartCookieAdapter } = useShopify();
|
|
1663
1664
|
const mainProductDiscountCodes = react.useMemo(
|
|
@@ -1735,7 +1736,7 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
1735
1736
|
);
|
|
1736
1737
|
const { loading } = ahooks.useRequest(
|
|
1737
1738
|
async () => {
|
|
1738
|
-
if (linesNeedUpdate?.length && !isCartLoading) {
|
|
1739
|
+
if (linesNeedUpdate?.length && !isCartLoading && !disabled) {
|
|
1739
1740
|
const result = await shopifySdk.updateCartLines(client, {
|
|
1740
1741
|
cartId: cart?.id || "",
|
|
1741
1742
|
lines: linesNeedUpdate,
|
|
@@ -1751,7 +1752,7 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
1751
1752
|
throttleWait: 3e3,
|
|
1752
1753
|
// 3 秒内只触发最后一次更新
|
|
1753
1754
|
throttleTrailing: true,
|
|
1754
|
-
refreshDeps: [linesNeedUpdate, isCartLoading]
|
|
1755
|
+
refreshDeps: [linesNeedUpdate, isCartLoading, disabled]
|
|
1755
1756
|
}
|
|
1756
1757
|
);
|
|
1757
1758
|
react.useEffect(() => {
|