@faststore/api 1.12.36 → 1.12.37
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/LICENSE +21 -0
- package/dist/api.cjs.development.js +19 -8
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +19 -8
- package/dist/api.esm.js.map +1 -1
- package/package.json +4 -3
- package/src/platforms/vtex/resolvers/validateCart.ts +76 -66
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 VTEX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -961,6 +961,13 @@ function getPropertyId(item) {
|
|
|
961
961
|
return md5(`${item.name}:${JSON.stringify(item.value)}:${item.valueReference}`);
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
+
const mutateChannelContext = (ctx, channelString) => {
|
|
965
|
+
ctx.storage.channel = ChannelMarshal.parse(channelString);
|
|
966
|
+
};
|
|
967
|
+
const mutateLocaleContext = (ctx, locale) => {
|
|
968
|
+
ctx.storage.locale = locale;
|
|
969
|
+
};
|
|
970
|
+
|
|
964
971
|
const isAttachment = value => value.valueReference === VALUE_REFERENCES.attachment;
|
|
965
972
|
|
|
966
973
|
const getId = item => {
|
|
@@ -1177,7 +1184,18 @@ const validateCart = async (_, {
|
|
|
1177
1184
|
loaders: {
|
|
1178
1185
|
skuLoader
|
|
1179
1186
|
}
|
|
1180
|
-
} = ctx;
|
|
1187
|
+
} = ctx;
|
|
1188
|
+
const channel = session == null ? void 0 : session.channel;
|
|
1189
|
+
const locale = session == null ? void 0 : session.locale;
|
|
1190
|
+
|
|
1191
|
+
if (channel) {
|
|
1192
|
+
mutateChannelContext(ctx, channel);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
if (locale) {
|
|
1196
|
+
mutateLocaleContext(ctx, locale);
|
|
1197
|
+
} // Step1: Get OrderForm from VTEX Commerce
|
|
1198
|
+
|
|
1181
1199
|
|
|
1182
1200
|
const orderForm = await getOrderForm(orderNumber, session, ctx); // Step1.5: Check if another system changed the orderForm with this orderNumber
|
|
1183
1201
|
// If so, this means the user interacted with this cart elsewhere and expects
|
|
@@ -1650,13 +1668,6 @@ const StorePropertyValue = {
|
|
|
1650
1668
|
}) => valueReference
|
|
1651
1669
|
};
|
|
1652
1670
|
|
|
1653
|
-
const mutateChannelContext = (ctx, channelString) => {
|
|
1654
|
-
ctx.storage.channel = ChannelMarshal.parse(channelString);
|
|
1655
|
-
};
|
|
1656
|
-
const mutateLocaleContext = (ctx, locale) => {
|
|
1657
|
-
ctx.storage.locale = locale;
|
|
1658
|
-
};
|
|
1659
|
-
|
|
1660
1671
|
const SORT_MAP = {
|
|
1661
1672
|
price_desc: 'price:desc',
|
|
1662
1673
|
price_asc: 'price:asc',
|