@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/index.mjs CHANGED
@@ -1007,14 +1007,10 @@ function useApplyCartCodes(options) {
1007
1007
  const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
1008
1008
  const applyCodes = useCallback(
1009
1009
  async (_key, { arg }) => {
1010
- const { cartId: providedCartId, discountCodes, replaceExistingCodes } = arg;
1010
+ const { cartId, discountCodes, replaceExistingCodes } = arg;
1011
1011
  if (!discountCodes?.length) {
1012
1012
  throw new Error("Invalid input used for this operation: Miss discountCode");
1013
1013
  }
1014
- const cartId = providedCartId || cart?.id;
1015
- if (!cartId) {
1016
- return void 0;
1017
- }
1018
1014
  const updatedCart = await updateCartCodes(client, {
1019
1015
  cartId,
1020
1016
  discountCodes: replaceExistingCodes ? discountCodes : [
@@ -1044,8 +1040,7 @@ function useRemoveCartCodes(options) {
1044
1040
  const { mutateCart, cart, metafieldIdentifiers } = useCartContext();
1045
1041
  const removeCodes = useCallback(
1046
1042
  async (_key, { arg }) => {
1047
- const { cartId: providedCartId, discountCodes } = arg;
1048
- const cartId = providedCartId || cart?.id;
1043
+ const { cartId, discountCodes } = arg;
1049
1044
  const codes = cart?.discountCodes?.filter((code) => !!code.applicable) || [];
1050
1045
  const leftCodes = codes.filter((code) => discountCodes?.length ? !discountCodes.includes(code.code) : code.code).map((code) => code.code);
1051
1046
  const updatedCart = await updateCartCodes(client, {