@evershop/evershop 1.0.0 → 1.1.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/bin/build/client/index.js +1 -1
- package/bin/build/complie.js +1 -1
- package/bin/build/index.js +1 -1
- package/bin/build/server/index.js +1 -1
- package/bin/build/server/useDDL.js +1 -1
- package/bin/dev/index.js +2 -1
- package/bin/evershop +8 -7
- package/bin/extension/index.js +1 -1
- package/bin/install/index.js +1 -1
- package/bin/lib/addDefaultMiddlewareFuncs.js +2 -2
- package/bin/lib/app.js +1 -1
- package/bin/lib/bootstrap/migrate.js +1 -1
- package/bin/lib/buildEntry.js +1 -1
- package/bin/lib/onError.js +1 -1
- package/bin/lib/onListening.js +1 -1
- package/bin/lib/startUp.js +10 -9
- package/bin/lib/watch/watchComponents.js +16 -26
- package/bin/lib/watch/watchMF.js +1 -1
- package/bin/lib/watch/watchMR.js +1 -1
- package/bin/lib/watch/watchSchema.js +1 -1
- package/bin/user/changePassword.js +1 -1
- package/bin/user/create.js +1 -1
- package/package.json +2 -2
- package/src/components/admin/catalog/productEdit/category/CategoryItem.jsx +1 -1
- package/src/components/admin/catalog/productEdit/category/CategoryTree.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/CreateVariantGroup.jsx +3 -8
- package/src/components/admin/catalog/productEdit/variants/Variant.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/VariantModal.jsx +62 -6
- package/src/components/admin/catalog/productEdit/variants/Variants.jsx +1 -1
- package/src/components/admin/checkout/shippingSetting/Method.jsx +130 -0
- package/src/components/admin/{oms → checkout}/shippingSetting/MethodForm.jsx +124 -13
- package/src/components/admin/{oms → checkout}/shippingSetting/Methods.jsx +2 -2
- package/src/components/admin/checkout/shippingSetting/PriceBasedPrice.jsx +101 -0
- package/src/components/admin/checkout/shippingSetting/WeightBasedPrice.jsx +101 -0
- package/src/components/admin/{oms → checkout}/shippingSetting/Zone.jsx +34 -4
- package/src/components/admin/{oms → checkout}/shippingSetting/Zones.jsx +6 -3
- package/src/components/admin/promotion/couponEdit/AttributeGroupSelector.jsx +5 -5
- package/src/components/admin/promotion/couponEdit/CategorySelector.jsx +5 -5
- package/src/components/admin/promotion/couponEdit/CollectionSelector.jsx +5 -5
- package/src/components/admin/promotion/couponEdit/ProductSkuSelector.jsx +27 -6
- package/src/components/common/context/checkout.jsx +8 -14
- package/src/components/common/form/Field.jsx +1 -1
- package/src/components/common/form/fields/Input.jsx +2 -1
- package/src/components/common/form/validator.js +6 -2
- package/src/components/common/grid/headers/Dummy.jsx +1 -1
- package/src/components/common/grid/headers/Sortable.jsx +148 -0
- package/src/components/common/grid/rows/StatusRow.jsx +1 -1
- package/src/components/common/list/Filter.jsx +83 -0
- package/src/components/common/list/Filter.scss +39 -0
- package/src/components/frontStore/catalog/categoryView/filter/AttributeFilter.jsx +19 -5
- package/src/components/frontStore/catalog/categoryView/filter/CategoryFilter.jsx +59 -52
- package/src/components/frontStore/catalog/categoryView/filter/PriceFilter.jsx +20 -11
- package/src/components/frontStore/catalog/product/list/SortOptions.jsx +4 -2
- package/src/components/frontStore/catalog/product/list/Sorting.jsx +5 -5
- package/src/components/frontStore/checkout/checkout/payment/paymentStep/StepContent.jsx +9 -6
- package/src/components/frontStore/stripe/checkout/CheckoutForm.jsx +8 -4
- package/src/lib/event/callSubscibers.js +14 -11
- package/src/lib/event/event-manager.js +1 -1
- package/src/lib/event/loadSubscribers.js +2 -2
- package/src/lib/helpers.js +3 -1
- package/src/lib/log/CustomColorize.js +22 -0
- package/src/lib/log/logger.js +153 -19
- package/src/lib/middleware/Handler.js +2 -3
- package/src/lib/middleware/async.js +5 -9
- package/src/lib/middleware/sync.js +5 -10
- package/src/lib/middleware/tests/app/app.js +1 -1
- package/src/lib/router/buildAbsoluteUrl.js +1 -1
- package/src/lib/util/buildFilterFromUrl.js +31 -64
- package/src/lib/util/defaultPaginationFilters.js +102 -0
- package/src/lib/util/filterOperationMapp.js +16 -0
- package/src/lib/util/registry.js +44 -6
- package/src/lib/webpack/dev/createConfigClient.js +2 -0
- package/src/lib/webpack/loaders/AreaLoader.js +1 -1
- package/src/lib/webpack/loaders/loadTranslationFromCsv.js +1 -1
- package/src/lib/webpack/plugins/Tailwindcss.js +1 -1
- package/src/modules/auth/graphql/types/AdminUser/AdminUser.admin.resolvers.js +6 -6
- package/src/modules/auth/pages/admin/adminLogin/LoginForm.jsx +1 -15
- package/src/modules/base/api/global/[apiResponse]apiErrorHandler.js +2 -2
- package/src/modules/base/pages/global/[response]errorHandler.js +2 -2
- package/src/modules/catalog/api/addProductToCategory/addProducts.js +1 -1
- package/src/modules/catalog/api/addProductToCollection/addProducts.js +35 -22
- package/src/modules/catalog/api/removeProductFromCollection/removeProducts.js +20 -5
- package/src/modules/catalog/bootstrap.js +63 -0
- package/src/modules/catalog/graphql/types/Attribute/Attribute.admin.graphql +2 -2
- package/src/modules/catalog/graphql/types/Attribute/Attribute.admin.resolvers.js +48 -276
- package/src/modules/catalog/graphql/types/Category/Category.graphql +15 -2
- package/src/modules/catalog/graphql/types/Category/Category.resolvers.js +2 -2
- package/src/modules/catalog/graphql/types/Collection/Collection.resolvers.js +2 -2
- package/src/modules/catalog/graphql/types/Product/Product.resolvers.js +1 -1
- package/src/modules/catalog/graphql/types/Product/Variant/Variant.graphql +2 -2
- package/src/modules/catalog/graphql/types/Product/Variant/Variant.resolvers.js +68 -92
- package/src/modules/catalog/pages/admin/attributeEdit+attributeNew/General.jsx +13 -9
- package/src/modules/catalog/pages/admin/attributeGrid/Grid.jsx +82 -39
- package/src/modules/catalog/pages/admin/attributeGrid/index.js +1 -1
- package/src/modules/catalog/pages/admin/categoryEdit/Products.jsx +5 -5
- package/src/modules/catalog/pages/admin/categoryGrid/Grid.jsx +48 -16
- package/src/modules/catalog/pages/admin/categoryGrid/index.js +1 -1
- package/src/modules/catalog/pages/admin/collectionEdit/Products.jsx +5 -5
- package/src/modules/catalog/pages/admin/collectionGrid/Grid.jsx +46 -5
- package/src/modules/catalog/pages/admin/collectionGrid/index.js +1 -1
- package/src/modules/catalog/pages/admin/productEdit+productNew/Attributes.jsx +28 -24
- package/src/modules/catalog/pages/admin/productGrid/Grid.jsx +158 -26
- package/src/modules/catalog/pages/admin/productGrid/index.js +1 -2
- package/src/modules/catalog/pages/frontStore/all/SearchBox.jsx +2 -1
- package/src/modules/catalog/pages/frontStore/catalogSearch/[index]filters.js +4 -59
- package/src/modules/catalog/pages/frontStore/catalogSearch/index.js +11 -0
- package/src/modules/catalog/pages/frontStore/categoryView/Filter.jsx +22 -6
- package/src/modules/catalog/pages/frontStore/categoryView/Filter.scss +2 -0
- package/src/modules/catalog/pages/frontStore/categoryView/[index]filters.js +5 -105
- package/src/modules/catalog/pages/frontStore/homepage/FeaturedProducts.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/productView/Form.jsx +8 -3
- package/src/modules/catalog/pages/frontStore/productView/Variants.jsx +102 -40
- package/src/modules/catalog/services/AttributeCollection.js +59 -0
- package/src/modules/catalog/services/AttributeGroupCollection.js +100 -0
- package/src/modules/catalog/services/CategoryCollection.js +27 -84
- package/src/modules/catalog/services/CollectionCollection.js +24 -72
- package/src/modules/catalog/services/ProductCollection.js +50 -216
- package/src/modules/catalog/services/attribute/deleteProductAttribute.js +15 -0
- package/src/modules/catalog/services/getAttributeGroupsBaseQuery.js +3 -0
- package/src/modules/catalog/services/getAttributesBaseQuery.js +3 -0
- package/src/modules/catalog/services/getCollectionsBaseQuery.js +0 -1
- package/src/modules/catalog/services/product/updateProduct.js +8 -2
- package/src/modules/catalog/services/registerDefaultAttributeCollectionFilters.js +149 -0
- package/src/modules/catalog/services/registerDefaultCategoryCollectionFilters.js +85 -0
- package/src/modules/catalog/services/registerDefaultCollectionCollectionFilters.js +65 -0
- package/src/modules/catalog/services/registerDefaultProductCollectionFilters.js +219 -0
- package/src/modules/catalog/subscribers/category_created/buildUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/category_deleted/deleteUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/category_updated/builUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/product_created/builUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/product_deleted/deleteUrlRewrite.js +1 -1
- package/src/modules/catalog/subscribers/product_image_added/localGenerateProductImageVariant.js +3 -3
- package/src/modules/checkout/api/addCartShippingMethod/saveShippingMethod.js +6 -1
- package/src/modules/checkout/api/createCart/[context]bodyParser[auth].js +5 -0
- package/src/modules/checkout/api/createCart/createNewCart.js +92 -0
- package/src/modules/checkout/api/createCart/payloadSchema.json +44 -0
- package/src/modules/checkout/api/createCart/route.json +5 -0
- package/src/modules/checkout/api/deleteShippingZone/deleteShippingZone.js +58 -0
- package/src/modules/checkout/api/deleteShippingZone/route.json +5 -0
- package/src/modules/checkout/api/deleteShippingZoneMethod/deleteShippingZoneMethod.js +85 -0
- package/src/modules/checkout/api/deleteShippingZoneMethod/route.json +5 -0
- package/src/modules/checkout/api/getShippingMethods/sendMethods.js +37 -0
- package/src/modules/checkout/api/updateShippingMethod/[context]borderParser[auth].js +5 -0
- package/src/modules/checkout/api/updateShippingMethod/payloadSchema.json +12 -0
- package/src/modules/checkout/api/updateShippingMethod/route.json +5 -0
- package/src/modules/checkout/api/updateShippingMethod/updateShippingMethod.js +64 -0
- package/src/modules/checkout/api/updateShippingZoneMethod/payloadSchema.json +43 -1
- package/src/modules/checkout/api/updateShippingZoneMethod/updateShippingZoneMethod.js +17 -3
- package/src/modules/checkout/bootstrap.js +1 -1
- package/src/modules/checkout/graphql/types/ShippingMethod/ShippingMethod.graphql +1 -0
- package/src/modules/checkout/graphql/types/ShippingMethod/ShippingMethod.resolvers.js +4 -0
- package/src/modules/checkout/graphql/types/ShippingZone/ShippingZone.graphql +21 -1
- package/src/modules/checkout/graphql/types/ShippingZone/ShippingZone.resolvers.js +34 -4
- package/src/modules/checkout/graphql/types/Weight/Weight.resolvers.js +8 -11
- package/src/modules/checkout/migration/Version-1.0.5.js +28 -0
- package/src/modules/{oms → checkout}/pages/admin/shippingSetting/ShippingSetting.jsx +66 -43
- package/src/modules/checkout/pages/frontStore/all/[auth]addCustomerToCart.js +3 -3
- package/src/modules/checkout/pages/frontStore/checkout/PaymentStep.jsx +3 -2
- package/src/modules/checkout/pages/frontStore/checkout/ShippingMethods.jsx +23 -10
- package/src/modules/checkout/pages/frontStore/checkout/SummaryMobile.jsx +132 -0
- package/src/modules/checkout/pages/frontStore/checkout/SummaryMobile.scss +7 -0
- package/src/modules/checkout/services/cart/Cart.js +23 -7
- package/src/modules/checkout/services/cart/DataObject.js +3 -3
- package/src/modules/checkout/services/cart/registerCartBaseFields.js +32 -0
- package/src/modules/checkout/services/cart/registerCartItemBaseFields.js +3 -2
- package/src/modules/cms/bootstrap.js +17 -0
- package/src/modules/cms/graphql/types/CmsPage/CmsPage.resolvers.js +2 -11
- package/src/modules/cms/pages/admin/all/Layout.scss +3 -2
- package/src/modules/cms/pages/admin/all/SearchBox.jsx +1 -1
- package/src/modules/cms/pages/admin/cmsPageGrid/Grid.jsx +62 -9
- package/src/modules/cms/pages/admin/cmsPageGrid/index.js +1 -2
- package/src/modules/cms/services/CMSPageCollection.js +23 -70
- package/src/modules/cms/services/registerDefaultPageCollectionFilters.js +62 -0
- package/src/modules/cms/services/tailwind.admin.config.js +6 -1
- package/src/modules/customer/api/createCustomer/[bodyParser]createCustomer.js +2 -2
- package/src/modules/customer/api/resetPassword/[bodyParser]resetPassword.js +2 -2
- package/src/modules/customer/api/updatePassword/[bodyParser]updatePassword.js +2 -2
- package/src/modules/customer/bootstrap.js +29 -0
- package/src/modules/customer/graphql/types/Customer/Customer.admin.resolvers.js +2 -4
- package/src/modules/customer/pages/admin/customerGrid/Grid.jsx +108 -14
- package/src/modules/customer/pages/admin/customerGrid/index.js +1 -2
- package/src/modules/customer/pages/frontStore/login/LoginForm.jsx +0 -1
- package/src/modules/customer/services/CustomerCollection.js +23 -104
- package/src/modules/customer/services/CustomerGroupCollection.js +21 -70
- package/src/modules/customer/services/registerDefaultCustomerCollectionFilters.js +90 -0
- package/src/modules/customer/services/registerDefaultCustomerGroupCollectionFilters.js +50 -0
- package/src/modules/graphql/pages/global/[bodyParser]buildQuery[graphql].js +1 -1
- package/src/modules/graphql/pages/global/[buildQuery]graphql[notification].js +1 -1
- package/src/modules/graphql/services/graphqlMiddleware.js +1 -1
- package/src/modules/oms/bootstrap.js +17 -0
- package/src/modules/oms/graphql/types/Order/Order.admin.resolvers.js +1 -1
- package/src/modules/oms/graphql/types/Order/Order.resolvers.js +2 -1
- package/src/modules/oms/pages/admin/orderGrid/Grid.jsx +152 -51
- package/src/modules/oms/pages/admin/orderGrid/index.js +1 -2
- package/src/modules/oms/services/OrderCollection.js +19 -139
- package/src/modules/oms/services/registerDefaultOrderCollectionFilters.js +121 -0
- package/src/modules/promotion/bootstrap.js +16 -0
- package/src/modules/promotion/graphql/types/Coupon/Coupon.admin.resolvers.js +2 -7
- package/src/modules/promotion/pages/admin/couponGrid/Grid.jsx +157 -33
- package/src/modules/promotion/pages/admin/couponGrid/index.js +1 -2
- package/src/modules/promotion/services/CouponCollection.js +21 -130
- package/src/modules/promotion/services/registerDefaultCouponCollectionFilters.js +72 -0
- package/src/modules/stripe/api/stripeWebHook/[bodyJson]webhook.js +4 -2
- package/src/modules/tax/bootstrap.js +17 -0
- package/src/modules/tax/services/TaxClassCollection.js +22 -56
- package/src/modules/tax/services/registerDefaultTaxClassCollectionFilters.js +49 -0
- package/src/components/admin/oms/shippingSetting/Method.jsx +0 -73
- package/src/components/common/grid/headers/Basic.jsx +0 -55
- package/src/lib/log/debuger.js +0 -89
- package/src/modules/customer/pages/frontStore/login/LoginButton.jsx +0 -27
- /package/src/components/admin/{oms → checkout}/shippingSetting/ZoneForm.jsx +0 -0
- /package/src/modules/{oms → checkout}/pages/admin/all/ShippingSettingMenu.jsx +0 -0
- /package/src/modules/{oms → checkout}/pages/admin/shippingSetting/index.js +0 -0
- /package/src/modules/{oms → checkout}/pages/admin/shippingSetting/route.json +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Map the operation to the SQL operation
|
|
2
|
+
const OPERATION_MAP = {
|
|
3
|
+
eq: '=',
|
|
4
|
+
neq: '<>',
|
|
5
|
+
gt: '>',
|
|
6
|
+
gteq: '>=',
|
|
7
|
+
lt: '<',
|
|
8
|
+
lteq: '<=',
|
|
9
|
+
like: 'ILIKE',
|
|
10
|
+
nlike: 'NOT ILIKE',
|
|
11
|
+
in: 'IN',
|
|
12
|
+
nin: 'NOT IN'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
module.exports = exports;
|
|
16
|
+
exports.OPERATION_MAP = OPERATION_MAP;
|
package/src/lib/util/registry.js
CHANGED
|
@@ -10,7 +10,8 @@ class Registry {
|
|
|
10
10
|
// If the initValue and the context are identical, return the cached value. Skip the processors
|
|
11
11
|
if (
|
|
12
12
|
isEqual(initValue, this.values[name].initValue) &&
|
|
13
|
-
isEqual(this.values[name].context, context)
|
|
13
|
+
isEqual(this.values[name].context, context) &&
|
|
14
|
+
Object.prototype.hasOwnProperty.call(this.values[name], 'value')
|
|
14
15
|
) {
|
|
15
16
|
return this.values[name].value;
|
|
16
17
|
}
|
|
@@ -65,7 +66,8 @@ class Registry {
|
|
|
65
66
|
// If the initValue and the context are identical, return the cached value. Skip the processors
|
|
66
67
|
if (
|
|
67
68
|
isEqual(initValue, this.values[name].initValue) &&
|
|
68
|
-
isEqual(this.values[name].context, context)
|
|
69
|
+
isEqual(this.values[name].context, context) &&
|
|
70
|
+
Object.prototype.hasOwnProperty.call(this.values[name], 'value')
|
|
69
71
|
) {
|
|
70
72
|
return this.values[name].value;
|
|
71
73
|
}
|
|
@@ -167,22 +169,52 @@ const registry = new Registry();
|
|
|
167
169
|
module.exports = {
|
|
168
170
|
/**
|
|
169
171
|
* @param {String} name
|
|
170
|
-
* @param {any}
|
|
172
|
+
* @param {any} initialization
|
|
171
173
|
* @param {Object} context
|
|
172
174
|
* @param {Function} validator
|
|
173
175
|
*/
|
|
174
|
-
async getValue(name,
|
|
176
|
+
async getValue(name, initialization, context, validator) {
|
|
177
|
+
let initValue;
|
|
178
|
+
// Check if the initValue is a function, then add this function to the processors as the first processor
|
|
179
|
+
if (typeof initialization === 'function') {
|
|
180
|
+
// Add this function to the processors, add this to the biginning of the processors
|
|
181
|
+
const processors = this.values[name] ? this.values[name].processors : [];
|
|
182
|
+
processors.unshift({
|
|
183
|
+
callback: initialization,
|
|
184
|
+
priority: 0
|
|
185
|
+
});
|
|
186
|
+
this.values[name] = this.values[name] || {};
|
|
187
|
+
this.values[name].processors = processors;
|
|
188
|
+
} else {
|
|
189
|
+
initValue = initialization;
|
|
190
|
+
}
|
|
175
191
|
const val = await registry.get(name, initValue, context, validator);
|
|
176
192
|
return val;
|
|
177
193
|
},
|
|
178
194
|
|
|
179
195
|
/**
|
|
180
196
|
* @param {String} name
|
|
181
|
-
* @param {any}
|
|
197
|
+
* @param {any} initialization
|
|
182
198
|
* @param {Object} context
|
|
183
199
|
* @param {Function} validator
|
|
184
200
|
*/
|
|
185
|
-
getValueSync(name,
|
|
201
|
+
getValueSync(name, initialization, context, validator) {
|
|
202
|
+
let initValue;
|
|
203
|
+
// Check if the initValue is a function, then add this function to the processors as the first processor
|
|
204
|
+
if (typeof initialization === 'function') {
|
|
205
|
+
// Add this function to the processors, add this to the biginning of the processors
|
|
206
|
+
const processors = registry.values[name]
|
|
207
|
+
? registry.values[name]?.processors
|
|
208
|
+
: [];
|
|
209
|
+
processors.unshift({
|
|
210
|
+
callback: initialization,
|
|
211
|
+
priority: 0
|
|
212
|
+
});
|
|
213
|
+
registry.values[name] = registry.values[name] || {};
|
|
214
|
+
registry.values[name].processors = processors;
|
|
215
|
+
} else {
|
|
216
|
+
initValue = initialization;
|
|
217
|
+
}
|
|
186
218
|
const val = registry.getSync(name, initValue, context, validator);
|
|
187
219
|
return val;
|
|
188
220
|
},
|
|
@@ -200,6 +232,12 @@ module.exports = {
|
|
|
200
232
|
},
|
|
201
233
|
|
|
202
234
|
lockRegistry() {
|
|
235
|
+
// Reset the values cache by removing all values from all properties in the registry values
|
|
236
|
+
Object.keys(registry.values).forEach((key) => {
|
|
237
|
+
if (Object.prototype.hasOwnProperty.call(registry.values, key)) {
|
|
238
|
+
delete registry.values[key].value;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
203
241
|
locked = true;
|
|
204
242
|
}
|
|
205
243
|
};
|
|
@@ -2,7 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const { inspect } = require('util');
|
|
3
3
|
const JSON5 = require('json5');
|
|
4
4
|
const { CONSTANTS } = require('../../helpers');
|
|
5
|
-
const { error } = require('../../log/
|
|
5
|
+
const { error } = require('../../log/logger');
|
|
6
6
|
|
|
7
7
|
/* eslint-disable no-multi-assign */
|
|
8
8
|
/* eslint-disable global-require */
|
|
@@ -3,7 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const { getConfig } = require('../../util/getConfig');
|
|
4
4
|
const { CONSTANTS } = require('../../helpers');
|
|
5
5
|
const { readCsvFile } = require('../../util/readCsvFile');
|
|
6
|
-
const { error } = require('../../log/
|
|
6
|
+
const { error } = require('../../log/logger');
|
|
7
7
|
|
|
8
8
|
module.exports.loadCsvTranslationFiles =
|
|
9
9
|
async function loadCsvTranslationFiles() {
|
|
@@ -7,7 +7,7 @@ const autoprefixer = require('autoprefixer');
|
|
|
7
7
|
const CleanCSS = require('clean-css');
|
|
8
8
|
const { Compilation, sources } = require('webpack');
|
|
9
9
|
const { getTailwindConfig } = require('../util/getTailwindConfig');
|
|
10
|
-
const { error } = require('../../log/
|
|
10
|
+
const { error } = require('../../log/logger');
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line no-multi-assign
|
|
13
13
|
module.exports = exports = {};
|
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
|
21
21
|
query.andWhere('admin_user.full_name', 'LIKE', `%${filter.value}%`);
|
|
22
22
|
currentFilters.push({
|
|
23
23
|
key: 'full_name',
|
|
24
|
-
operation: '
|
|
24
|
+
operation: 'eq',
|
|
25
25
|
value: filter.value
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
|
29
29
|
query.andWhere('admin_user.status', '=', filter.value);
|
|
30
30
|
currentFilters.push({
|
|
31
31
|
key: 'status',
|
|
32
|
-
operation: '
|
|
32
|
+
operation: 'eq',
|
|
33
33
|
value: filter.value
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -43,7 +43,7 @@ module.exports = {
|
|
|
43
43
|
query.orderBy('admin_user.full_name', sortOrder.value);
|
|
44
44
|
currentFilters.push({
|
|
45
45
|
key: 'sortBy',
|
|
46
|
-
operation: '
|
|
46
|
+
operation: 'eq',
|
|
47
47
|
value: sortBy.value
|
|
48
48
|
});
|
|
49
49
|
} else {
|
|
@@ -53,7 +53,7 @@ module.exports = {
|
|
|
53
53
|
if (sortOrder.key) {
|
|
54
54
|
currentFilters.push({
|
|
55
55
|
key: 'sortOrder',
|
|
56
|
-
operation: '
|
|
56
|
+
operation: 'eq',
|
|
57
57
|
value: sortOrder.value
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -68,12 +68,12 @@ module.exports = {
|
|
|
68
68
|
}; // TODO: Get from the config
|
|
69
69
|
currentFilters.push({
|
|
70
70
|
key: 'page',
|
|
71
|
-
operation: '
|
|
71
|
+
operation: 'eq',
|
|
72
72
|
value: page.value
|
|
73
73
|
});
|
|
74
74
|
currentFilters.push({
|
|
75
75
|
key: 'limit',
|
|
76
|
-
operation: '
|
|
76
|
+
operation: 'eq',
|
|
77
77
|
value: limit.value
|
|
78
78
|
});
|
|
79
79
|
query.limit(
|
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { Field } from '@components/common/form/Field';
|
|
4
4
|
import { Form } from '@components/common/form/Form';
|
|
5
5
|
import './LoginForm.scss';
|
|
6
|
-
import Button from '@components/common/form/Button';
|
|
7
6
|
|
|
8
7
|
export default function LoginForm({ authUrl, dashboardUrl }) {
|
|
9
8
|
const [error, setError] = React.useState(null);
|
|
@@ -33,7 +32,7 @@ export default function LoginForm({ authUrl, dashboardUrl }) {
|
|
|
33
32
|
id="adminLoginForm"
|
|
34
33
|
isJSON
|
|
35
34
|
onSuccess={onSuccess}
|
|
36
|
-
|
|
35
|
+
btnText="SIGN IN"
|
|
37
36
|
>
|
|
38
37
|
<Field
|
|
39
38
|
name="email"
|
|
@@ -49,19 +48,6 @@ export default function LoginForm({ authUrl, dashboardUrl }) {
|
|
|
49
48
|
placeholder="Password"
|
|
50
49
|
validationRules={['notEmpty']}
|
|
51
50
|
/>
|
|
52
|
-
<div className="form-submit-button flex border-t border-divider mt-1 pt-1">
|
|
53
|
-
<Button
|
|
54
|
-
title="Login"
|
|
55
|
-
type="submit"
|
|
56
|
-
onAction={() => {
|
|
57
|
-
document
|
|
58
|
-
.getElementById('adminLoginForm')
|
|
59
|
-
.dispatchEvent(
|
|
60
|
-
new Event('submit', { cancelable: true, bubbles: true })
|
|
61
|
-
);
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
</div>
|
|
65
51
|
</Form>
|
|
66
52
|
</div>
|
|
67
53
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const {
|
|
2
2
|
INTERNAL_SERVER_ERROR
|
|
3
3
|
} = require('@evershop/evershop/src/lib/util/httpStatus');
|
|
4
|
-
const {
|
|
4
|
+
const { error } = require('@evershop/evershop/src/lib/log/logger');
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line no-unused-vars
|
|
7
7
|
module.exports = async (err, request, response, delegate, next) => {
|
|
8
|
-
|
|
8
|
+
error(err);
|
|
9
9
|
// Set this flag to make sure this middleware only be executed 1 time
|
|
10
10
|
response.locals.errorHandlerTriggered = true;
|
|
11
11
|
const promises = [];
|
|
@@ -2,11 +2,11 @@ const { encode } = require('html-entities');
|
|
|
2
2
|
const {
|
|
3
3
|
INTERNAL_SERVER_ERROR
|
|
4
4
|
} = require('@evershop/evershop/src/lib/util/httpStatus');
|
|
5
|
-
const {
|
|
5
|
+
const { error } = require('@evershop/evershop/src/lib/log/logger');
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line no-unused-vars
|
|
8
8
|
module.exports = async (err, request, response, delegate, next) => {
|
|
9
|
-
|
|
9
|
+
error(err);
|
|
10
10
|
// Set this flag to make sure this middleware only be executed 1 time
|
|
11
11
|
response.locals.errorHandlerTriggered = true;
|
|
12
12
|
const promises = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { error } = require('@evershop/evershop/src/lib/log/
|
|
1
|
+
const { error } = require('@evershop/evershop/src/lib/log/logger');
|
|
2
2
|
const {
|
|
3
3
|
getConnection
|
|
4
4
|
} = require('@evershop/evershop/src/lib/postgres/connection');
|
|
@@ -8,11 +8,11 @@ const {
|
|
|
8
8
|
INTERNAL_SERVER_ERROR
|
|
9
9
|
} = require('@evershop/evershop/src/lib/util/httpStatus');
|
|
10
10
|
const {
|
|
11
|
-
insert,
|
|
12
11
|
startTransaction,
|
|
13
12
|
rollback,
|
|
14
13
|
commit,
|
|
15
|
-
select
|
|
14
|
+
select,
|
|
15
|
+
insertOnUpdate
|
|
16
16
|
} = require('@evershop/postgres-query-builder');
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -47,27 +47,40 @@ module.exports = async (request, response, delegate, next) => {
|
|
|
47
47
|
message: 'Product does not exists'
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
|
|
51
|
+
// If the product is belong to a variant group, get all the variants and assign them to the collection
|
|
52
|
+
if (product.variant_group_id) {
|
|
53
|
+
const variants = await select()
|
|
54
|
+
.from('product')
|
|
55
|
+
.where('variant_group_id', '=', product.variant_group_id)
|
|
56
|
+
.execute(connection);
|
|
57
|
+
// Insert all the variants to the collection
|
|
58
|
+
await Promise.all(
|
|
59
|
+
variants.map(async (variant) => {
|
|
60
|
+
await insertOnUpdate('product_collection', [
|
|
61
|
+
'collection_id',
|
|
62
|
+
'product_id'
|
|
63
|
+
])
|
|
64
|
+
.given({
|
|
65
|
+
collection_id: collection.collection_id,
|
|
66
|
+
product_id: variant.product_id
|
|
67
|
+
})
|
|
68
|
+
.execute(connection);
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
} else {
|
|
72
|
+
// Assign the product to the collection
|
|
73
|
+
await insertOnUpdate('product_collection', [
|
|
74
|
+
'collection_id',
|
|
75
|
+
'product_id'
|
|
76
|
+
])
|
|
77
|
+
.given({
|
|
78
|
+
collection_id: collection.collection_id,
|
|
79
|
+
product_id: product.product_id
|
|
80
|
+
})
|
|
81
|
+
.execute(connection);
|
|
62
82
|
}
|
|
63
83
|
|
|
64
|
-
// Assign the product to the collection
|
|
65
|
-
await insert('product_collection')
|
|
66
|
-
.given({
|
|
67
|
-
collection_id: collection.collection_id,
|
|
68
|
-
product_id: product.product_id
|
|
69
|
-
})
|
|
70
|
-
.execute(connection);
|
|
71
84
|
await commit(connection);
|
|
72
85
|
response.status(OK);
|
|
73
86
|
return response.json({
|
|
@@ -48,11 +48,26 @@ module.exports = async (request, response, delegate, next) => {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
if (product.variant_group_id) {
|
|
52
|
+
const variants = await select()
|
|
53
|
+
.from('product')
|
|
54
|
+
.where('variant_group_id', '=', product.variant_group_id)
|
|
55
|
+
.execute(connection);
|
|
56
|
+
|
|
57
|
+
await Promise.all(
|
|
58
|
+
variants.map(async (variant) => {
|
|
59
|
+
await del('product_collection')
|
|
60
|
+
.where('collection_id', '=', collection.collection_id)
|
|
61
|
+
.and('product_id', '=', variant.product_id)
|
|
62
|
+
.execute(connection);
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
} else {
|
|
66
|
+
await del('product_collection')
|
|
67
|
+
.where('collection_id', '=', collection.collection_id)
|
|
68
|
+
.and('product_id', '=', product.product_id)
|
|
69
|
+
.execute(connection);
|
|
70
|
+
}
|
|
56
71
|
await commit(connection);
|
|
57
72
|
response.status(OK);
|
|
58
73
|
response.json({
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const config = require('config');
|
|
2
|
+
const { addProcessor } = require('../../lib/util/registry');
|
|
3
|
+
const registerDefaultProductCollectionFilters = require('./services/registerDefaultProductCollectionFilters');
|
|
4
|
+
const registerDefaultCategoryCollectionFilters = require('./services/registerDefaultCategoryCollectionFilters');
|
|
5
|
+
const registerDefaultCollectionCollectionFilters = require('./services/registerDefaultCollectionCollectionFilters');
|
|
6
|
+
const registerDefaultAttributeCollectionFilters = require('./services/registerDefaultAttributeCollectionFilters');
|
|
7
|
+
const {
|
|
8
|
+
defaultPaginationFilters
|
|
9
|
+
} = require('../../lib/util/defaultPaginationFilters');
|
|
2
10
|
|
|
3
11
|
module.exports = () => {
|
|
4
12
|
const catalogConfig = {
|
|
@@ -30,4 +38,59 @@ module.exports = () => {
|
|
|
30
38
|
};
|
|
31
39
|
config.util.setModuleDefaults('pricing', pricingConfig);
|
|
32
40
|
// Getting config value like this: config.get('catalog.product.image.thumbnail.width');
|
|
41
|
+
|
|
42
|
+
// Reigtering the default filters for product collection
|
|
43
|
+
addProcessor(
|
|
44
|
+
'productCollectionFilters',
|
|
45
|
+
registerDefaultProductCollectionFilters,
|
|
46
|
+
1
|
|
47
|
+
);
|
|
48
|
+
addProcessor(
|
|
49
|
+
'productCollectionFilters',
|
|
50
|
+
(filters) => [...filters, ...defaultPaginationFilters],
|
|
51
|
+
2
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// Reigtering the default filters for category collection
|
|
55
|
+
addProcessor(
|
|
56
|
+
'categoryCollectionFilters',
|
|
57
|
+
registerDefaultCategoryCollectionFilters,
|
|
58
|
+
1
|
|
59
|
+
);
|
|
60
|
+
addProcessor(
|
|
61
|
+
'categoryCollectionFilters',
|
|
62
|
+
(filters) => [...filters, ...defaultPaginationFilters],
|
|
63
|
+
2
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// Reigtering the default filters for collection collection
|
|
67
|
+
addProcessor(
|
|
68
|
+
'collectionCollectionFilters',
|
|
69
|
+
registerDefaultCollectionCollectionFilters,
|
|
70
|
+
1
|
|
71
|
+
);
|
|
72
|
+
addProcessor(
|
|
73
|
+
'collectionCollectionFilters',
|
|
74
|
+
(filters) => [...filters, ...defaultPaginationFilters],
|
|
75
|
+
2
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// Reigtering the default filters for attribute collection
|
|
79
|
+
addProcessor(
|
|
80
|
+
'attributeCollectionFilters',
|
|
81
|
+
registerDefaultAttributeCollectionFilters,
|
|
82
|
+
1
|
|
83
|
+
);
|
|
84
|
+
addProcessor(
|
|
85
|
+
'attributeCollectionFilters',
|
|
86
|
+
(filters) => [...filters, ...defaultPaginationFilters],
|
|
87
|
+
2
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Reigtering the default filters for attribute group collection
|
|
91
|
+
addProcessor(
|
|
92
|
+
'attributeGroupCollectionFilters',
|
|
93
|
+
(filters) => [...filters, ...defaultPaginationFilters],
|
|
94
|
+
1
|
|
95
|
+
);
|
|
33
96
|
};
|
|
@@ -6,11 +6,11 @@ type AttributeGroup {
|
|
|
6
6
|
uuid: String!
|
|
7
7
|
groupName: String!
|
|
8
8
|
updateApi: String!
|
|
9
|
-
attributes:
|
|
9
|
+
attributes: AttributeCollection
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
extend type Attribute {
|
|
13
|
-
groups:
|
|
13
|
+
groups: AttributeGroupCollection
|
|
14
14
|
editUrl: String!
|
|
15
15
|
updateApi: String!
|
|
16
16
|
deleteApi: String!
|