@anker-in/shopify-react 0.1.1-beta.22 → 0.1.1-beta.24
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 +245 -210
- package/dist/hooks/index.d.ts +245 -210
- package/dist/hooks/index.js +78 -24
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +78 -24
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +78 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -24
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +1 -2
- package/dist/provider/index.d.ts +1 -2
- package/dist/provider/index.js +15 -22
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +15 -22
- package/dist/provider/index.mjs.map +1 -1
- package/dist/{types-C1So3siD.d.mts → types-BSsb8OPm.d.mts} +1 -34
- package/dist/{types-C1So3siD.d.ts → types-BSsb8OPm.d.ts} +1 -34
- package/package.json +5 -5
package/dist/provider/index.mjs
CHANGED
|
@@ -922,7 +922,7 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
922
922
|
);
|
|
923
923
|
const functionEnvValue = getDiscountEnvAttributeValue(line.customAttributes);
|
|
924
924
|
const hasSameFunctionEnvAttribute = Number(functionEnvValue.discounted_amount) === Number(line.totalAmount);
|
|
925
|
-
if (!hasSameFunctionEnvAttribute && hasFunctionEnvAttribute) {
|
|
925
|
+
if (!hasSameFunctionEnvAttribute && hasFunctionEnvAttribute && !functionEnvValue.is_gift) {
|
|
926
926
|
attrNeedUpdate.push({
|
|
927
927
|
key: CUSTOMER_ATTRIBUTE_KEY,
|
|
928
928
|
value: JSON.stringify({
|
|
@@ -961,29 +961,22 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
961
961
|
}).filter(
|
|
962
962
|
({ attrNeedUpdate, attrNeedDelete }) => attrNeedUpdate.length || attrNeedDelete.length
|
|
963
963
|
).map(({ line, attrNeedUpdate, attrNeedDelete }) => {
|
|
964
|
+
let lineId = line.id;
|
|
965
|
+
let attributes = line.customAttributes || [];
|
|
966
|
+
if (attrNeedDelete.length) {
|
|
967
|
+
attributes = attributes.filter(
|
|
968
|
+
(attr) => !attrNeedDelete.includes(attr.key)
|
|
969
|
+
);
|
|
970
|
+
}
|
|
964
971
|
if (attrNeedUpdate.length) {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
...line.customAttributes?.filter(
|
|
969
|
-
(attr) => !attrNeedUpdate.some((updateAttr) => updateAttr.key === attr.key)
|
|
970
|
-
) || [],
|
|
971
|
-
...attrNeedUpdate
|
|
972
|
-
]
|
|
973
|
-
};
|
|
974
|
-
} else if (attrNeedDelete.length) {
|
|
975
|
-
return {
|
|
976
|
-
id: line.id,
|
|
977
|
-
attributes: line.customAttributes?.filter(
|
|
978
|
-
(attr) => !attrNeedDelete.includes(attr.key)
|
|
979
|
-
) || []
|
|
980
|
-
};
|
|
981
|
-
} else {
|
|
982
|
-
return {
|
|
983
|
-
id: line.id,
|
|
984
|
-
attributes: line.customAttributes || []
|
|
985
|
-
};
|
|
972
|
+
attributes = attributes.filter(
|
|
973
|
+
(attr) => !attrNeedUpdate.some((updateAttr) => updateAttr.key === attr.key)
|
|
974
|
+
).concat(attrNeedUpdate);
|
|
986
975
|
}
|
|
976
|
+
return {
|
|
977
|
+
id: lineId,
|
|
978
|
+
attributes
|
|
979
|
+
};
|
|
987
980
|
}),
|
|
988
981
|
[cart?.lineItems, mainProductDiscountCodes]
|
|
989
982
|
);
|