@scayle/storefront-core 8.4.0 → 8.5.0
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/CHANGELOG.md +16 -0
- package/dist/rpc/methods/checkout/checkout.mjs +1 -1
- package/dist/rpc/methods/search.d.ts +22 -0
- package/package.json +9 -19
- package/dist/api/customer.cjs +0 -164
- package/dist/api/oauth.cjs +0 -238
- package/dist/cache/cache.cjs +0 -1
- package/dist/cache/cached.cjs +0 -90
- package/dist/cache/index.cjs +0 -27
- package/dist/cache/providers/unstorage.cjs +0 -55
- package/dist/constants/basket.cjs +0 -26
- package/dist/constants/cache.cjs +0 -7
- package/dist/constants/hash.cjs +0 -11
- package/dist/constants/httpStatus.cjs +0 -634
- package/dist/constants/index.cjs +0 -93
- package/dist/constants/product.cjs +0 -10
- package/dist/constants/promotion.cjs +0 -12
- package/dist/constants/sorting.cjs +0 -22
- package/dist/constants/withParameters.cjs +0 -132
- package/dist/errors/errorResponse.cjs +0 -27
- package/dist/errors/index.cjs +0 -16
- package/dist/helpers/advancedAttributeHelpers.cjs +0 -30
- package/dist/helpers/arrayHelpers.cjs +0 -10
- package/dist/helpers/attributeHelpers.cjs +0 -24
- package/dist/helpers/basketHelpers.cjs +0 -12
- package/dist/helpers/categoryHelper.cjs +0 -61
- package/dist/helpers/filterHelper.cjs +0 -185
- package/dist/helpers/formHelpers.cjs +0 -114
- package/dist/helpers/imageHelpers.cjs +0 -20
- package/dist/helpers/index.cjs +0 -181
- package/dist/helpers/localization.cjs +0 -13
- package/dist/helpers/objectHelpers.cjs +0 -19
- package/dist/helpers/orderHelpers.cjs +0 -10
- package/dist/helpers/product.fixture.cjs +0 -766
- package/dist/helpers/productDisruptorHelper.cjs +0 -37
- package/dist/helpers/productHelpers.cjs +0 -156
- package/dist/helpers/sanitizationHelpers.cjs +0 -35
- package/dist/helpers/sortingHelper.cjs +0 -68
- package/dist/helpers/stringHelpers.cjs +0 -8
- package/dist/index.cjs +0 -100
- package/dist/rpc/methods/basket/basket.cjs +0 -270
- package/dist/rpc/methods/brands.cjs +0 -33
- package/dist/rpc/methods/categories.cjs +0 -129
- package/dist/rpc/methods/cbd.cjs +0 -38
- package/dist/rpc/methods/checkout/checkout.cjs +0 -48
- package/dist/rpc/methods/checkout/index.cjs +0 -49
- package/dist/rpc/methods/checkout/order.cjs +0 -42
- package/dist/rpc/methods/checkout/shopUser.cjs +0 -110
- package/dist/rpc/methods/checkout/shopUserAddresses.cjs +0 -12
- package/dist/rpc/methods/index.cjs +0 -225
- package/dist/rpc/methods/navigationTrees.cjs +0 -54
- package/dist/rpc/methods/oauth/idp.cjs +0 -59
- package/dist/rpc/methods/products.cjs +0 -309
- package/dist/rpc/methods/promotion.cjs +0 -51
- package/dist/rpc/methods/search.cjs +0 -40
- package/dist/rpc/methods/session.cjs +0 -257
- package/dist/rpc/methods/shopConfiguration.cjs +0 -15
- package/dist/rpc/methods/user.cjs +0 -103
- package/dist/rpc/methods/variants.cjs +0 -29
- package/dist/rpc/methods/wishlist.cjs +0 -104
- package/dist/server.cjs +0 -47
- package/dist/test/factories/index.cjs +0 -16
- package/dist/types/api/auth.cjs +0 -1
- package/dist/types/api/context.cjs +0 -15
- package/dist/types/api/rpc.cjs +0 -1
- package/dist/types/breadcrumb.cjs +0 -1
- package/dist/types/index.cjs +0 -267
- package/dist/types/promises.cjs +0 -1
- package/dist/types/sapi/basket.cjs +0 -1
- package/dist/types/sapi/brand.cjs +0 -1
- package/dist/types/sapi/campaign.cjs +0 -1
- package/dist/types/sapi/category.cjs +0 -1
- package/dist/types/sapi/filter.cjs +0 -1
- package/dist/types/sapi/navigation.cjs +0 -1
- package/dist/types/sapi/order.cjs +0 -1
- package/dist/types/sapi/product.cjs +0 -1
- package/dist/types/sapi/productFilter.cjs +0 -1
- package/dist/types/sapi/promotion.cjs +0 -1
- package/dist/types/sapi/redirects.cjs +0 -1
- package/dist/types/sapi/router.cjs +0 -1
- package/dist/types/sapi/search.cjs +0 -1
- package/dist/types/sapi/sorting.cjs +0 -1
- package/dist/types/sapi/variant.cjs +0 -1
- package/dist/types/sapi/wishlist.cjs +0 -1
- package/dist/types/user.cjs +0 -1
- package/dist/utils/basket.cjs +0 -14
- package/dist/utils/fetch.cjs +0 -19
- package/dist/utils/hash.cjs +0 -72
- package/dist/utils/index.cjs +0 -49
- package/dist/utils/keys.cjs +0 -67
- package/dist/utils/log.cjs +0 -93
- package/dist/utils/response.cjs +0 -13
- package/dist/utils/sapi.cjs +0 -26
- package/dist/utils/timeout.cjs +0 -18
- package/dist/utils/user.cjs +0 -90
package/dist/utils/timeout.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.wait = exports.timeout = void 0;
|
|
7
|
-
const wait = ms => {
|
|
8
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
9
|
-
};
|
|
10
|
-
exports.wait = wait;
|
|
11
|
-
const timeout = (ms, promise) => {
|
|
12
|
-
let pendingTimeout;
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
pendingTimeout = setTimeout(() => reject(new Error("timeout")), ms);
|
|
15
|
-
promise.then(resolve, reject);
|
|
16
|
-
}).finally(() => clearTimeout(pendingTimeout));
|
|
17
|
-
};
|
|
18
|
-
exports.timeout = timeout;
|
package/dist/utils/user.cjs
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.mergeWishlists = exports.mergeBaskets = void 0;
|
|
7
|
-
var _constants = require("../constants/index.cjs");
|
|
8
|
-
const mergeBaskets = async (fromBasketKey, toBasketKey, withOptions, context) => {
|
|
9
|
-
const {
|
|
10
|
-
sapiClient,
|
|
11
|
-
campaignKey
|
|
12
|
-
} = context;
|
|
13
|
-
const fromOriginBasket = await sapiClient.basket.get(fromBasketKey, {
|
|
14
|
-
with: withOptions,
|
|
15
|
-
campaignKey,
|
|
16
|
-
orderCustomData: withOptions.orderCustomData
|
|
17
|
-
});
|
|
18
|
-
context.log.debug(`Merging basket ${fromBasketKey} to ${toBasketKey}`);
|
|
19
|
-
if (fromBasketKey === toBasketKey) {
|
|
20
|
-
return fromOriginBasket;
|
|
21
|
-
}
|
|
22
|
-
const {
|
|
23
|
-
basket: fromBasket,
|
|
24
|
-
type
|
|
25
|
-
} = fromOriginBasket;
|
|
26
|
-
if (type === "success" && fromBasket?.items?.length > 0) {
|
|
27
|
-
const itemsToAddOrUpdate = fromBasket.items.map(item => ({
|
|
28
|
-
variantId: item.variant.id,
|
|
29
|
-
quantity: item.quantity,
|
|
30
|
-
params: {
|
|
31
|
-
promotionId: item.promotionId,
|
|
32
|
-
customData: item.customData,
|
|
33
|
-
displayData: item.displayData,
|
|
34
|
-
itemGroup: item.itemGroup,
|
|
35
|
-
pricePromotionKey: withOptions.pricePromotionKey
|
|
36
|
-
}
|
|
37
|
-
}));
|
|
38
|
-
const mergedBasket = await sapiClient.basket.addOrUpdateItems(toBasketKey, itemsToAddOrUpdate, {
|
|
39
|
-
with: withOptions,
|
|
40
|
-
campaignKey,
|
|
41
|
-
includeItemsWithoutProductData: withOptions?.includeItemsWithoutProductData,
|
|
42
|
-
orderCustomData: withOptions.orderCustomData
|
|
43
|
-
}, {
|
|
44
|
-
existingItemHandling: _constants.ExistingItemHandling.AddQuantityToExisting
|
|
45
|
-
});
|
|
46
|
-
fromBasket.items.map(async item => {
|
|
47
|
-
return await sapiClient.basket.deleteItem(fromBasketKey, item.key);
|
|
48
|
-
});
|
|
49
|
-
return mergedBasket;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
exports.mergeBaskets = mergeBaskets;
|
|
53
|
-
const mergeWishlists = async (fromWishlistKey, toWishlistKey, withOptions, context) => {
|
|
54
|
-
const {
|
|
55
|
-
sapiClient,
|
|
56
|
-
campaignKey
|
|
57
|
-
} = context;
|
|
58
|
-
const oldWishlist = await sapiClient.wishlist.get(fromWishlistKey, {
|
|
59
|
-
with: withOptions,
|
|
60
|
-
campaignKey
|
|
61
|
-
});
|
|
62
|
-
context.log.debug(`Merging wishlist ${fromWishlistKey} to ${toWishlistKey}`);
|
|
63
|
-
if (oldWishlist != null) {
|
|
64
|
-
for (const item of oldWishlist.items) {
|
|
65
|
-
const {
|
|
66
|
-
productId,
|
|
67
|
-
variantId
|
|
68
|
-
} = item;
|
|
69
|
-
if (productId || variantId) {
|
|
70
|
-
await sapiClient.wishlist.addItem(toWishlistKey, {
|
|
71
|
-
...(variantId ? {
|
|
72
|
-
variantId
|
|
73
|
-
} : {
|
|
74
|
-
productId
|
|
75
|
-
})
|
|
76
|
-
}, {
|
|
77
|
-
campaignKey,
|
|
78
|
-
...(item.itemGroup ? {
|
|
79
|
-
itemGroup: item.itemGroup
|
|
80
|
-
} : void 0),
|
|
81
|
-
...(item.customData && Object.keys(item.customData).length ? {
|
|
82
|
-
customData: item.customData
|
|
83
|
-
} : void 0)
|
|
84
|
-
});
|
|
85
|
-
sapiClient.wishlist.deleteItem(fromWishlistKey, item?.key);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.mergeWishlists = mergeWishlists;
|