@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
|
@@ -4,8 +4,7 @@ import { ShopifyClient, ShopifyConfig, CartCookieAdapter, NormalizedCart, Attrib
|
|
|
4
4
|
import { C as CookieAdapter, R as RouterAdapter, U as UserContextAdapter } from '../types-Dt0DUG00.mjs';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { SWRConfiguration } from 'swr';
|
|
7
|
-
import { e as PlusMemberSettingsMetafields } from '../types-
|
|
8
|
-
import 'swr/mutation';
|
|
7
|
+
import { e as PlusMemberSettingsMetafields } from '../types-BSsb8OPm.mjs';
|
|
9
8
|
|
|
10
9
|
interface ShopifyContextValue {
|
|
11
10
|
client: ShopifyClient;
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ import { ShopifyClient, ShopifyConfig, CartCookieAdapter, NormalizedCart, Attrib
|
|
|
4
4
|
import { C as CookieAdapter, R as RouterAdapter, U as UserContextAdapter } from '../types-Dt0DUG00.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { SWRConfiguration } from 'swr';
|
|
7
|
-
import { e as PlusMemberSettingsMetafields } from '../types-
|
|
8
|
-
import 'swr/mutation';
|
|
7
|
+
import { e as PlusMemberSettingsMetafields } from '../types-BSsb8OPm.js';
|
|
9
8
|
|
|
10
9
|
interface ShopifyContextValue {
|
|
11
10
|
client: ShopifyClient;
|
package/dist/provider/index.js
CHANGED
|
@@ -931,7 +931,7 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
931
931
|
);
|
|
932
932
|
const functionEnvValue = getDiscountEnvAttributeValue(line.customAttributes);
|
|
933
933
|
const hasSameFunctionEnvAttribute = Number(functionEnvValue.discounted_amount) === Number(line.totalAmount);
|
|
934
|
-
if (!hasSameFunctionEnvAttribute && hasFunctionEnvAttribute) {
|
|
934
|
+
if (!hasSameFunctionEnvAttribute && hasFunctionEnvAttribute && !functionEnvValue.is_gift) {
|
|
935
935
|
attrNeedUpdate.push({
|
|
936
936
|
key: CUSTOMER_ATTRIBUTE_KEY,
|
|
937
937
|
value: JSON.stringify({
|
|
@@ -970,29 +970,22 @@ var useUpdateLineCodeAmountAttributes = ({
|
|
|
970
970
|
}).filter(
|
|
971
971
|
({ attrNeedUpdate, attrNeedDelete }) => attrNeedUpdate.length || attrNeedDelete.length
|
|
972
972
|
).map(({ line, attrNeedUpdate, attrNeedDelete }) => {
|
|
973
|
+
let lineId = line.id;
|
|
974
|
+
let attributes = line.customAttributes || [];
|
|
975
|
+
if (attrNeedDelete.length) {
|
|
976
|
+
attributes = attributes.filter(
|
|
977
|
+
(attr) => !attrNeedDelete.includes(attr.key)
|
|
978
|
+
);
|
|
979
|
+
}
|
|
973
980
|
if (attrNeedUpdate.length) {
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
...line.customAttributes?.filter(
|
|
978
|
-
(attr) => !attrNeedUpdate.some((updateAttr) => updateAttr.key === attr.key)
|
|
979
|
-
) || [],
|
|
980
|
-
...attrNeedUpdate
|
|
981
|
-
]
|
|
982
|
-
};
|
|
983
|
-
} else if (attrNeedDelete.length) {
|
|
984
|
-
return {
|
|
985
|
-
id: line.id,
|
|
986
|
-
attributes: line.customAttributes?.filter(
|
|
987
|
-
(attr) => !attrNeedDelete.includes(attr.key)
|
|
988
|
-
) || []
|
|
989
|
-
};
|
|
990
|
-
} else {
|
|
991
|
-
return {
|
|
992
|
-
id: line.id,
|
|
993
|
-
attributes: line.customAttributes || []
|
|
994
|
-
};
|
|
981
|
+
attributes = attributes.filter(
|
|
982
|
+
(attr) => !attrNeedUpdate.some((updateAttr) => updateAttr.key === attr.key)
|
|
983
|
+
).concat(attrNeedUpdate);
|
|
995
984
|
}
|
|
985
|
+
return {
|
|
986
|
+
id: lineId,
|
|
987
|
+
attributes
|
|
988
|
+
};
|
|
996
989
|
}),
|
|
997
990
|
[cart?.lineItems, mainProductDiscountCodes]
|
|
998
991
|
);
|