@anker-in/shopify-react 1.0.1-beta.1 → 1.0.1-beta.2
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.js +2 -7
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -7
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.js +2 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1015,14 +1015,10 @@ function useApplyCartCodes(options) {
|
|
|
1015
1015
|
const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
|
|
1016
1016
|
const applyCodes = react.useCallback(
|
|
1017
1017
|
async (_key, { arg }) => {
|
|
1018
|
-
const { cartId
|
|
1018
|
+
const { cartId, discountCodes, replaceExistingCodes } = arg;
|
|
1019
1019
|
if (!discountCodes?.length) {
|
|
1020
1020
|
throw new Error("Invalid input used for this operation: Miss discountCode");
|
|
1021
1021
|
}
|
|
1022
|
-
const cartId = providedCartId || cart?.id;
|
|
1023
|
-
if (!cartId) {
|
|
1024
|
-
return void 0;
|
|
1025
|
-
}
|
|
1026
1022
|
const updatedCart = await shopifySdk.updateCartCodes(client, {
|
|
1027
1023
|
cartId,
|
|
1028
1024
|
discountCodes: replaceExistingCodes ? discountCodes : [
|
|
@@ -1052,8 +1048,7 @@ function useRemoveCartCodes(options) {
|
|
|
1052
1048
|
const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
|
|
1053
1049
|
const removeCodes = react.useCallback(
|
|
1054
1050
|
async (_key, { arg }) => {
|
|
1055
|
-
const { cartId
|
|
1056
|
-
const cartId = providedCartId || cart?.id;
|
|
1051
|
+
const { cartId, discountCodes } = arg;
|
|
1057
1052
|
const codes = cart?.discountCodes?.filter((code) => !!code.applicable) || [];
|
|
1058
1053
|
const leftCodes = codes.filter((code) => discountCodes?.length ? !discountCodes.includes(code.code) : code.code).map((code) => code.code);
|
|
1059
1054
|
const updatedCart = await shopifySdk.updateCartCodes(client, {
|