@shopgate/pwa-common-commerce 7.30.0-alpha.10 → 7.30.0-alpha.12
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/cart/mock.js +2 -2
- package/cart/subscriptions/index.js +1 -1
- package/category/mock.js +2 -2
- package/favorites/subscriptions/spec.js +2 -2
- package/package.json +5 -5
- package/product/collections/ProductImageFormats.js +14 -13
- package/product/reducers/resultsByHash.js +1 -1
- package/product/selectors/product.mock.js +1 -4
- package/reviews/reducers/reviewsByHash.js +1 -1
- package/reviews/selectors/index.js +2 -2
- package/scanner/subscriptions/index.js +1 -1
package/cart/mock.js
CHANGED
|
@@ -42,7 +42,7 @@ export default function cart(subscribe) {
|
|
|
42
42
|
*/
|
|
43
43
|
const cartDidEnterOrAppDidStart$ = cartDidEnter$.merge(appDidStart$);
|
|
44
44
|
const cartBusy$ = cartRequesting$.merge(couponsAdded$, couponsDeleted$, productsAdded$, productsModified$, productsDeleted$);
|
|
45
|
-
const cartIdle$ = cartReceived$.merge(couponsUpdated
|
|
45
|
+
const cartIdle$ = cartReceived$.merge(couponsUpdated$.switchMap(() => cartReceived$.first()), productsUpdated$.switchMap(() => cartReceived$.first()));
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Gets triggered when the app will start.
|
package/category/mock.js
CHANGED
|
@@ -159,7 +159,7 @@ const emptyState = {
|
|
|
159
159
|
},
|
|
160
160
|
router: {
|
|
161
161
|
...routerState.router,
|
|
162
|
-
stack: [
|
|
162
|
+
stack: [].concat(routerState.router.stack, [{
|
|
163
163
|
id: '5a227cfd-c55a-4e9b-9deb-d2ee20154030',
|
|
164
164
|
params: {
|
|
165
165
|
categoryId: '74657374'
|
|
@@ -170,7 +170,7 @@ const emptyState = {
|
|
|
170
170
|
state: {
|
|
171
171
|
title: 'test'
|
|
172
172
|
}
|
|
173
|
-
}]
|
|
173
|
+
}])
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
176
|
export { initialCategoryState, emptyState, categoryState, routerState, categoryRouteMock, childCategoryRouteMock, uiState };
|
|
@@ -373,11 +373,11 @@ describe('Favorites - subscriptions', () => {
|
|
|
373
373
|
mockedGetFavoritesProductsReturnValue = {
|
|
374
374
|
byList: {
|
|
375
375
|
DEFAULT: {
|
|
376
|
-
items: [
|
|
376
|
+
items: [].concat(mockedGetFavoritesProductsReturnValue.byList.DEFAULT.items, [{
|
|
377
377
|
productId,
|
|
378
378
|
quantity: 1,
|
|
379
379
|
notes: null
|
|
380
|
-
}]
|
|
380
|
+
}])
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common-commerce",
|
|
3
|
-
"version": "7.30.0-alpha.
|
|
3
|
+
"version": "7.30.0-alpha.12",
|
|
4
4
|
"description": "Commerce library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"reselect": "^4.1.8"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@shopgate/pwa-common": "7.30.0-alpha.
|
|
23
|
-
"@shopgate/pwa-core": "7.30.0-alpha.
|
|
22
|
+
"@shopgate/pwa-common": "7.30.0-alpha.12",
|
|
23
|
+
"@shopgate/pwa-core": "7.30.0-alpha.12",
|
|
24
24
|
"lodash": "^4.17.4",
|
|
25
|
-
"react": "
|
|
26
|
-
"react-dom": "
|
|
25
|
+
"react": "^17.0.2",
|
|
26
|
+
"react-dom": "^17.0.2"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -3,11 +3,11 @@ import "core-js/modules/es.array.reduce.js";
|
|
|
3
3
|
* Class to maintain the image formats
|
|
4
4
|
* @deprecated not used anymore. Kept for backwards compatibility.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
let ProductImageFormats = /*#__PURE__*/function () {
|
|
7
7
|
/**
|
|
8
8
|
* Constructor.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
function ProductImageFormats() {
|
|
11
11
|
this.formats = [];
|
|
12
12
|
this.map = new Map();
|
|
13
13
|
}
|
|
@@ -16,9 +16,10 @@ class ProductImageFormats {
|
|
|
16
16
|
* Returns all formats.
|
|
17
17
|
* @returns {Array}
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
var _proto = ProductImageFormats.prototype;
|
|
20
|
+
_proto.getAllUniqueFormats = function getAllUniqueFormats() {
|
|
20
21
|
const hashes = [];
|
|
21
|
-
return Array.from(this.map.values()).reduce((prev, val) => [
|
|
22
|
+
return Array.from(this.map.values()).reduce((prev, val) => [].concat(prev, val), []).filter(val => {
|
|
22
23
|
const hash = JSON.stringify(val);
|
|
23
24
|
if (hashes.indexOf(hash) === -1) {
|
|
24
25
|
hashes.push(hash);
|
|
@@ -31,8 +32,8 @@ class ProductImageFormats {
|
|
|
31
32
|
/**
|
|
32
33
|
* @param {string} key key of format to get
|
|
33
34
|
* @returns {Object} format
|
|
34
|
-
|
|
35
|
-
get(key) {
|
|
35
|
+
*/;
|
|
36
|
+
_proto.get = function get(key) {
|
|
36
37
|
return this.map.get(key);
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -40,8 +41,8 @@ class ProductImageFormats {
|
|
|
40
41
|
* @param {string} key key of format
|
|
41
42
|
* @param {Object} value value of format
|
|
42
43
|
* @returns {Object}
|
|
43
|
-
|
|
44
|
-
set(key, value) {
|
|
44
|
+
*/;
|
|
45
|
+
_proto.set = function set(key, value) {
|
|
45
46
|
return this.map.set(key, value);
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -49,13 +50,13 @@ class ProductImageFormats {
|
|
|
49
50
|
* Removes a format from the list of persisted formats.
|
|
50
51
|
* @param {string} key The key of the format to remove.
|
|
51
52
|
* @returns {ProductImageFormats}
|
|
52
|
-
|
|
53
|
-
remove(key) {
|
|
53
|
+
*/;
|
|
54
|
+
_proto.remove = function remove(key) {
|
|
54
55
|
this.map.remove(key);
|
|
55
56
|
return this;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
};
|
|
58
|
+
return ProductImageFormats;
|
|
59
|
+
}();
|
|
59
60
|
/**
|
|
60
61
|
* @deprecated
|
|
61
62
|
*/
|
|
@@ -37,7 +37,7 @@ export default function resultsByHash(state = {}, action) {
|
|
|
37
37
|
* its set to empty array, otherwise it will be an array of the previous and the
|
|
38
38
|
* new products. Duplicates are removed.
|
|
39
39
|
*/
|
|
40
|
-
const stateProducts = products || nextProducts.length ? uniq([
|
|
40
|
+
const stateProducts = products || nextProducts.length ? uniq([].concat(products || [], nextProducts.map(product => product.id))) : [];
|
|
41
41
|
return {
|
|
42
42
|
...state,
|
|
43
43
|
[action.hash]: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
-
/* eslint-disable camelcase */
|
|
3
2
|
export const mockedRouterState = {
|
|
4
3
|
currentRoute: null,
|
|
5
4
|
stack: []
|
|
@@ -325,6 +324,4 @@ delete mockedVariantStateVariantDataFetching.product.productsById.product_3;
|
|
|
325
324
|
// Base product and variants data is available, but variants ara fetching.
|
|
326
325
|
export const mockedVariantStateVariantsFetching = cloneDeep(mockedVariantStateComplete);
|
|
327
326
|
delete mockedVariantStateVariantsFetching.product.productsById.product_2;
|
|
328
|
-
delete mockedVariantStateVariantsFetching.product.productsById.product_3;
|
|
329
|
-
|
|
330
|
-
/* eslint-enable camelcase */
|
|
327
|
+
delete mockedVariantStateVariantsFetching.product.productsById.product_3;
|
|
@@ -28,7 +28,7 @@ function reviewsByHash(state = {}, action) {
|
|
|
28
28
|
* its set to empty array, otherwise it will be an array of the previous and the
|
|
29
29
|
* new reviews. Duplicates are removed.
|
|
30
30
|
*/
|
|
31
|
-
const stateReviews = reviews || nextReviews.length ? uniq([
|
|
31
|
+
const stateReviews = reviews || nextReviews.length ? uniq([].concat(reviews, nextReviews.map(review => review.id))) : [];
|
|
32
32
|
return {
|
|
33
33
|
...state,
|
|
34
34
|
[action.hash]: {
|
|
@@ -146,7 +146,7 @@ export const getProductReviews = createSelector(getCollectionForCurrentBaseProdu
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// User review always on top. Avoid duplicates.
|
|
149
|
-
return [userReview
|
|
149
|
+
return [userReview].concat(reviews.filter(r => r.id !== userReview.id));
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
/**
|
|
@@ -164,5 +164,5 @@ export const getProductReviewsExcerpt = createSelector(getBaseProductId, getProd
|
|
|
164
164
|
if (!userReview.id) {
|
|
165
165
|
return reviews;
|
|
166
166
|
}
|
|
167
|
-
return [userReview
|
|
167
|
+
return [userReview].concat(reviews.filter(r => r.id !== userReview.id)).slice(0, REVIEW_PREVIEW_COUNT);
|
|
168
168
|
});
|
|
@@ -9,7 +9,7 @@ import { SCANNER_FORMATS_BARCODE, SCANNER_FORMATS_QR_CODE } from "../constants";
|
|
|
9
9
|
import { startScanner$, scannerFinishedBarCode$, scannerFinishedQrCode$ } from "../streams";
|
|
10
10
|
|
|
11
11
|
// Scanner payload formats which are handled by the subscriptions.
|
|
12
|
-
export const handledFormats = [
|
|
12
|
+
export const handledFormats = [].concat(SCANNER_FORMATS_BARCODE, SCANNER_FORMATS_QR_CODE);
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Scanner subscriptions.
|