@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
|
@@ -12,7 +12,7 @@ const {
|
|
|
12
12
|
} = require('@evershop/evershop/src/lib/postgres/connection');
|
|
13
13
|
const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');
|
|
14
14
|
const { emit } = require('@evershop/evershop/src/lib/event/emitter');
|
|
15
|
-
const { debug } = require('@evershop/evershop/src/lib/log/
|
|
15
|
+
const { debug } = require('@evershop/evershop/src/lib/log/logger');
|
|
16
16
|
const { display } = require('zero-decimal-currencies');
|
|
17
17
|
const { getSetting } = require('../../../setting/services/setting');
|
|
18
18
|
|
|
@@ -57,7 +57,9 @@ module.exports = async (request, response, delegate, next) => {
|
|
|
57
57
|
// Create payment transaction
|
|
58
58
|
await insert('payment_transaction')
|
|
59
59
|
.given({
|
|
60
|
-
amount: parseFloat(
|
|
60
|
+
amount: parseFloat(
|
|
61
|
+
display(paymentIntent.amount, paymentIntent.currency)
|
|
62
|
+
),
|
|
61
63
|
payment_transaction_order_id: order.order_id,
|
|
62
64
|
transaction_id: paymentIntent.id,
|
|
63
65
|
transaction_type: 'online',
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
const config = require('config');
|
|
2
|
+
const { addProcessor } = require('../../lib/util/registry');
|
|
3
|
+
const registerDefaultTaxClassCollectionFilters = require('./services/registerDefaultTaxClassCollectionFilters');
|
|
4
|
+
const {
|
|
5
|
+
defaultPaginationFilters
|
|
6
|
+
} = require('../../lib/util/defaultPaginationFilters');
|
|
2
7
|
|
|
3
8
|
module.exports = () => {
|
|
4
9
|
// Pricing configuration
|
|
@@ -13,4 +18,16 @@ module.exports = () => {
|
|
|
13
18
|
};
|
|
14
19
|
config.util.setModuleDefaults('pricing', pricingConfig);
|
|
15
20
|
// Getting config value like this: config.get('pricing.tax.rounding');
|
|
21
|
+
|
|
22
|
+
// Reigtering the default filters for tax class collection
|
|
23
|
+
addProcessor(
|
|
24
|
+
'taxClassCollectionFilters',
|
|
25
|
+
registerDefaultTaxClassCollectionFilters,
|
|
26
|
+
1
|
|
27
|
+
);
|
|
28
|
+
addProcessor(
|
|
29
|
+
'taxClassCollectionFilters',
|
|
30
|
+
(filters) => [...filters, ...defaultPaginationFilters],
|
|
31
|
+
2
|
|
32
|
+
);
|
|
16
33
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { camelCase } = require('@evershop/evershop/src/lib/util/camelCase');
|
|
2
2
|
const { pool } = require('@evershop/evershop/src/lib/postgres/connection');
|
|
3
|
+
const { getValue } = require('@evershop/evershop/src/lib/util/registry');
|
|
3
4
|
|
|
4
5
|
class TaxClassCollection {
|
|
5
6
|
constructor(baseQuery) {
|
|
@@ -8,68 +9,33 @@ class TaxClassCollection {
|
|
|
8
9
|
|
|
9
10
|
async init(args, { filters = [] }) {
|
|
10
11
|
const currentFilters = [];
|
|
11
|
-
// Name filter
|
|
12
|
-
const nameFilter = filters.find((f) => f.key === 'name');
|
|
13
|
-
if (nameFilter) {
|
|
14
|
-
this.baseQuery.andWhere(
|
|
15
|
-
'tax_class.name',
|
|
16
|
-
'ILIKE',
|
|
17
|
-
`%${nameFilter.value}%`
|
|
18
|
-
);
|
|
19
|
-
currentFilters.push({
|
|
20
|
-
key: 'name',
|
|
21
|
-
operation: '=',
|
|
22
|
-
value: nameFilter.value
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
12
|
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
operation: '=',
|
|
46
|
-
value: sortOrder.value
|
|
47
|
-
});
|
|
48
|
-
}
|
|
13
|
+
// Apply the filters
|
|
14
|
+
const taxClassCollectionFilters = await getValue(
|
|
15
|
+
'taxClassCollectionFilters',
|
|
16
|
+
[]
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
taxClassCollectionFilters.forEach((filter) => {
|
|
20
|
+
const check = filters.find((f) => f.key === filter.key);
|
|
21
|
+
if (check) {
|
|
22
|
+
if (filter.operation.includes(check.operation)) {
|
|
23
|
+
filter.callback(
|
|
24
|
+
this.baseQuery,
|
|
25
|
+
check.operation,
|
|
26
|
+
check.value,
|
|
27
|
+
currentFilters
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
49
32
|
|
|
50
33
|
// Clone the main query for getting total right before doing the paging
|
|
51
34
|
const totalQuery = this.baseQuery.clone();
|
|
52
35
|
totalQuery.select('COUNT(*)', 'total');
|
|
53
36
|
totalQuery.removeOrderBy();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const limit = filters.find((f) => f.key === 'limit' && f.value > 0) || {
|
|
57
|
-
value: 20
|
|
58
|
-
}; // TODO: Get from the config
|
|
59
|
-
currentFilters.push({
|
|
60
|
-
key: 'page',
|
|
61
|
-
operation: '=',
|
|
62
|
-
value: page.value
|
|
63
|
-
});
|
|
64
|
-
currentFilters.push({
|
|
65
|
-
key: 'limit',
|
|
66
|
-
operation: '=',
|
|
67
|
-
value: limit.value
|
|
68
|
-
});
|
|
69
|
-
this.baseQuery.limit(
|
|
70
|
-
(page.value - 1) * parseInt(limit.value, 10),
|
|
71
|
-
parseInt(limit.value, 10)
|
|
72
|
-
);
|
|
37
|
+
totalQuery.removeLimit();
|
|
38
|
+
|
|
73
39
|
this.currentFilters = currentFilters;
|
|
74
40
|
this.totalQuery = totalQuery;
|
|
75
41
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const {
|
|
2
|
+
OPERATION_MAP
|
|
3
|
+
} = require('@evershop/evershop/src/lib/util/filterOperationMapp');
|
|
4
|
+
const { getValueSync } = require('@evershop/evershop/src/lib/util/registry');
|
|
5
|
+
|
|
6
|
+
module.exports = async function registerDefaultTaxClassCollectionFilters() {
|
|
7
|
+
// List of default supported filters
|
|
8
|
+
const defaultFilters = [
|
|
9
|
+
{
|
|
10
|
+
key: 'name',
|
|
11
|
+
operation: ['like'],
|
|
12
|
+
callback: (query, operation, value, currentFilters) => {
|
|
13
|
+
query.andWhere(
|
|
14
|
+
'tax_class.name',
|
|
15
|
+
OPERATION_MAP[operation],
|
|
16
|
+
`%${value}%`
|
|
17
|
+
);
|
|
18
|
+
currentFilters.push({
|
|
19
|
+
key: 'name',
|
|
20
|
+
operation,
|
|
21
|
+
value
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: 'ob',
|
|
27
|
+
operation: ['eq'],
|
|
28
|
+
callback: (query, operation, value, currentFilters) => {
|
|
29
|
+
const taxClassCollectionSortBy = getValueSync(
|
|
30
|
+
'taxClassCollectionSortBy',
|
|
31
|
+
{
|
|
32
|
+
name: (query) => query.orderBy('tax_class.name')
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (taxClassCollectionSortBy[value]) {
|
|
37
|
+
taxClassCollectionSortBy[value](query, operation);
|
|
38
|
+
currentFilters.push({
|
|
39
|
+
key: 'ob',
|
|
40
|
+
operation,
|
|
41
|
+
value
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
return defaultFilters;
|
|
49
|
+
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useModal } from '@components/common/modal/useModal';
|
|
4
|
-
import MethodForm from './MethodForm';
|
|
5
|
-
|
|
6
|
-
function Method({ method, getZones }) {
|
|
7
|
-
const modal = useModal();
|
|
8
|
-
return (
|
|
9
|
-
<>
|
|
10
|
-
<>
|
|
11
|
-
<td className="border-none py-1">{method.name}</td>
|
|
12
|
-
<td className="border-none py-1">
|
|
13
|
-
{method.isEnabled ? 'Enabled' : 'Disabled'}
|
|
14
|
-
</td>
|
|
15
|
-
<td className="border-none py-1">{method.cost?.text}</td>
|
|
16
|
-
<td className="border-none py-1">
|
|
17
|
-
{method.conditionType
|
|
18
|
-
? `${method.min || 0} <= ${method.conditionType} <= ${
|
|
19
|
-
method.max || '∞'
|
|
20
|
-
}`
|
|
21
|
-
: 'None'}
|
|
22
|
-
</td>
|
|
23
|
-
<td className="border-none py-1">
|
|
24
|
-
<a
|
|
25
|
-
href="#"
|
|
26
|
-
className="text-interactive"
|
|
27
|
-
onClick={(e) => {
|
|
28
|
-
e.preventDefault();
|
|
29
|
-
modal.openModal();
|
|
30
|
-
}}
|
|
31
|
-
>
|
|
32
|
-
Edit
|
|
33
|
-
</a>
|
|
34
|
-
</td>
|
|
35
|
-
</>
|
|
36
|
-
{modal.state.showing && (
|
|
37
|
-
<div className={modal.className} onAnimationEnd={modal.onAnimationEnd}>
|
|
38
|
-
<div
|
|
39
|
-
className="modal-wrapper flex self-center justify-center items-center"
|
|
40
|
-
tabIndex={-1}
|
|
41
|
-
role="dialog"
|
|
42
|
-
>
|
|
43
|
-
<div className="modal">
|
|
44
|
-
<MethodForm
|
|
45
|
-
saveMethodApi={method.updateApi}
|
|
46
|
-
closeModal={() => modal.closeModal()}
|
|
47
|
-
getZones={getZones}
|
|
48
|
-
method={method}
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
)}
|
|
54
|
-
</>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
Method.propTypes = {
|
|
59
|
-
method: PropTypes.shape({
|
|
60
|
-
name: PropTypes.string.isRequired,
|
|
61
|
-
isEnabled: PropTypes.bool.isRequired,
|
|
62
|
-
cost: PropTypes.shape({
|
|
63
|
-
text: PropTypes.string.isRequired
|
|
64
|
-
}),
|
|
65
|
-
conditionType: PropTypes.string.isRequired,
|
|
66
|
-
min: PropTypes.number.isRequired,
|
|
67
|
-
max: PropTypes.number.isRequired,
|
|
68
|
-
updateApi: PropTypes.string.isRequired
|
|
69
|
-
}).isRequired,
|
|
70
|
-
getZones: PropTypes.func.isRequired
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default Method;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Input } from '@components/common/form/fields/Input';
|
|
4
|
-
|
|
5
|
-
export default function BasicColumnHeader({ title, id, currentFilters = [] }) {
|
|
6
|
-
const filterInput = React.useRef(null);
|
|
7
|
-
|
|
8
|
-
const onKeyPress = (e) => {
|
|
9
|
-
const url = new URL(document.location);
|
|
10
|
-
if (e.key === 'Enter') {
|
|
11
|
-
if (e.target.value === '') url.searchParams.delete(id);
|
|
12
|
-
else url.searchParams.set(id, e.target.value);
|
|
13
|
-
window.location.href = url.href;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
React.useEffect(() => {
|
|
18
|
-
const filter = currentFilters.find((fillter) => fillter.key === id) || {
|
|
19
|
-
value: ''
|
|
20
|
-
};
|
|
21
|
-
filterInput.current.value = filter.value;
|
|
22
|
-
}, []);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<th className="column">
|
|
26
|
-
<div className="table-header id-header">
|
|
27
|
-
<div className="title" style={{ marginBottom: '1rem' }}>
|
|
28
|
-
<span>{title}</span>
|
|
29
|
-
</div>
|
|
30
|
-
<div className="filter" style={{ width: '15rem' }}>
|
|
31
|
-
<Input
|
|
32
|
-
ref={filterInput}
|
|
33
|
-
onKeyPress={(e) => onKeyPress(e)}
|
|
34
|
-
placeholder={title}
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</th>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
BasicColumnHeader.propTypes = {
|
|
43
|
-
id: PropTypes.string.isRequired,
|
|
44
|
-
title: PropTypes.string.isRequired,
|
|
45
|
-
currentFilters: PropTypes.arrayOf(
|
|
46
|
-
PropTypes.shape({
|
|
47
|
-
key: PropTypes.string,
|
|
48
|
-
value: PropTypes.string
|
|
49
|
-
})
|
|
50
|
-
)
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
BasicColumnHeader.defaultProps = {
|
|
54
|
-
currentFilters: []
|
|
55
|
-
};
|
package/src/lib/log/debuger.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
const { green, red, blue, yellow, white } = require('kleur');
|
|
2
|
-
const isDevelopmentMode = require('../util/isDevelopmentMode');
|
|
3
|
-
|
|
4
|
-
// Define logger function
|
|
5
|
-
function debug(level, message) {
|
|
6
|
-
if (isDevelopmentMode() || process.argv.includes('--debug')) {
|
|
7
|
-
let logMessage = ``;
|
|
8
|
-
let textMessage = `${message}`;
|
|
9
|
-
// If message is an exception object, include the stack trace
|
|
10
|
-
if (message instanceof Error) {
|
|
11
|
-
textMessage = `${message.message}\n${message.stack}`;
|
|
12
|
-
}
|
|
13
|
-
// Switch color based on level
|
|
14
|
-
switch (level) {
|
|
15
|
-
case 'critical':
|
|
16
|
-
logMessage += red(`[debug] ❌ ${textMessage}`);
|
|
17
|
-
break;
|
|
18
|
-
case 'warning':
|
|
19
|
-
logMessage += yellow(`[debug] ⚠️ ${textMessage}`);
|
|
20
|
-
break;
|
|
21
|
-
case 'info':
|
|
22
|
-
logMessage += blue(`[debug] ℹ️ ${textMessage}`);
|
|
23
|
-
break;
|
|
24
|
-
case 'success':
|
|
25
|
-
logMessage += green(`[debug] ✅ ${textMessage}`);
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
logMessage += white(`[debug] - ${textMessage}`);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// If message is added to a group, store it in the group
|
|
33
|
-
if (this.group && Array.isArray(this.group.messages)) {
|
|
34
|
-
this.group.messages.push(logMessage);
|
|
35
|
-
return; // Do not output message to console or file
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// eslint-disable-next-line no-console
|
|
39
|
-
console.log(logMessage);
|
|
40
|
-
} else {
|
|
41
|
-
// Do not output message to console or file
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function error(e) {
|
|
46
|
-
// Check if e is a string message
|
|
47
|
-
if (typeof e === 'string') {
|
|
48
|
-
// eslint-disable-next-line no-console
|
|
49
|
-
console.log(`\n❌ ${red(e)}\n`);
|
|
50
|
-
} else if (e instanceof Error) {
|
|
51
|
-
// eslint-disable-next-line no-console
|
|
52
|
-
console.log(`\n❌ ${red(e.stack)}`);
|
|
53
|
-
} else {
|
|
54
|
-
throw new Error('Error message must be a string or an Error object');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function warning(message) {
|
|
59
|
-
if (typeof message === 'string' || typeof message === 'number') {
|
|
60
|
-
// eslint-disable-next-line no-console
|
|
61
|
-
console.log(`\n⚠️ ${yellow(message)}\n`);
|
|
62
|
-
} else {
|
|
63
|
-
throw new Error('Warning message must be a string or number');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function info(message) {
|
|
68
|
-
if (typeof message === 'string' || typeof message === 'number') {
|
|
69
|
-
// eslint-disable-next-line no-console
|
|
70
|
-
console.log(`\nℹ️ ${blue(message)}\n`);
|
|
71
|
-
} else {
|
|
72
|
-
throw new Error('Warning message must be a string or number');
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function success(message) {
|
|
77
|
-
if (typeof message === 'string' || typeof message === 'number') {
|
|
78
|
-
// eslint-disable-next-line no-console
|
|
79
|
-
console.log(`\n✅ ${green(message)}\n`);
|
|
80
|
-
} else {
|
|
81
|
-
throw new Error('Warning message must be a string or number');
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
module.exports.success = success;
|
|
86
|
-
module.exports.info = info;
|
|
87
|
-
module.exports.warning = warning;
|
|
88
|
-
module.exports.error = error;
|
|
89
|
-
module.exports.debug = debug;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { _ } from '@evershop/evershop/src/lib/locale/translate';
|
|
3
|
-
import Button from '@components/common/form/Button';
|
|
4
|
-
|
|
5
|
-
export default function LoginButton() {
|
|
6
|
-
return (
|
|
7
|
-
<div className="form-submit-button flex border-t border-divider mt-1 pt-1">
|
|
8
|
-
<Button
|
|
9
|
-
title={_('SIGN IN')}
|
|
10
|
-
type="submit"
|
|
11
|
-
onAction={() => {
|
|
12
|
-
document.getElementById('loginForm').dispatchEvent(
|
|
13
|
-
new Event('submit', {
|
|
14
|
-
cancelable: true,
|
|
15
|
-
bubbles: true
|
|
16
|
-
})
|
|
17
|
-
);
|
|
18
|
-
}}
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const layout = {
|
|
25
|
-
areaId: 'loginFormInner',
|
|
26
|
-
sortOrder: 50
|
|
27
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|