@evershop/evershop 1.1.0 → 1.2.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/index.js +24 -0
- package/bin/extension/index.js +2 -2
- package/bin/lib/addDefaultMiddlewareFuncs.js +7 -2
- package/bin/lib/buildEntry.js +15 -0
- package/bin/lib/onListening.js +7 -4
- package/bin/lib/startUp.js +6 -0
- package/package.json +9 -1
- package/src/components/admin/catalog/productEdit/category/CategoryItem.jsx +2 -7
- package/src/components/admin/catalog/productEdit/category/CategoryTree.jsx +14 -7
- package/src/components/admin/catalog/productEdit/category/CategoryTree.scss +10 -0
- package/src/components/admin/catalog/productEdit/variants/CreateVariant.jsx +2 -2
- package/src/components/admin/catalog/productEdit/variants/CreateVariantGroup.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/EditVariant.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/New.jsx +2 -2
- package/src/components/admin/catalog/productEdit/variants/Search.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/SearchModal.jsx +1 -1
- package/src/components/admin/catalog/productEdit/variants/VariantModal.jsx +6 -6
- package/src/components/admin/catalog/productGrid/rows/ThumbnailRow.jsx +1 -1
- package/src/components/admin/checkout/shippingSetting/Method.jsx +6 -6
- package/src/components/admin/checkout/shippingSetting/MethodForm.jsx +4 -4
- package/src/components/admin/checkout/shippingSetting/Methods.jsx +3 -3
- package/src/components/admin/checkout/shippingSetting/PriceBasedPrice.jsx +2 -2
- package/src/components/admin/checkout/shippingSetting/WeightBasedPrice.jsx +2 -2
- package/src/components/admin/checkout/shippingSetting/Zone.jsx +7 -7
- package/src/components/admin/checkout/shippingSetting/ZoneForm.jsx +1 -1
- package/src/components/admin/cms/Card.jsx +3 -3
- package/src/components/admin/cms/PageHeading.jsx +3 -3
- package/src/components/admin/cms/widget/WidgetTypes.jsx +28 -0
- package/src/components/admin/cms/widget/grid/WidgetTypeRow.jsx +29 -0
- package/src/components/admin/oms/orderEdit/items/ItemVariantOptions.jsx +1 -1
- package/src/components/admin/oms/orderEdit/items/Name.jsx +1 -1
- package/src/components/admin/oms/orderGrid/headers/OrderDateColumnHeader.jsx +1 -1
- package/src/components/admin/promotion/couponEdit/AttributeGroupSelector.jsx +3 -3
- package/src/components/admin/promotion/couponEdit/BuyXGetY.jsx +2 -2
- package/src/components/admin/promotion/couponEdit/CategorySelector.jsx +6 -6
- package/src/components/admin/promotion/couponEdit/CollectionSelector.jsx +3 -3
- package/src/components/admin/promotion/couponEdit/ProductSkuSelector.jsx +4 -4
- package/src/components/admin/promotion/couponEdit/RequireProducts.jsx +2 -2
- package/src/components/admin/promotion/couponEdit/Setting.jsx +1 -1
- package/src/components/admin/promotion/couponEdit/TargetProducts.jsx +4 -4
- package/src/components/admin/tax/taxSetting/Rate.jsx +6 -6
- package/src/components/admin/tax/taxSetting/RateForm.jsx +5 -5
- package/src/components/admin/tax/taxSetting/Rates.jsx +6 -6
- package/src/components/admin/tax/taxSetting/TaxClass.jsx +3 -3
- package/src/components/admin/tax/taxSetting/TaxClassForm.jsx +1 -1
- package/src/components/admin/widgets/BasicMenuSetting.jsx +614 -0
- package/src/components/admin/widgets/BasicMenuSetting.scss +19 -0
- package/src/components/admin/widgets/CollectionProductsSetting.jsx +203 -0
- package/src/components/admin/widgets/TextBlockSetting.jsx +70 -0
- package/src/components/common/Area.jsx +31 -8
- package/src/components/common/Badge.jsx +1 -1
- package/src/components/common/Editor.jsx +191 -0
- package/src/components/common/Notification.scss +1 -0
- package/src/components/common/SimplePagination.jsx +2 -2
- package/src/components/common/form/Form.jsx +1 -1
- package/src/components/common/form/fields/Checkbox.jsx +1 -1
- package/src/components/common/form/fields/Ckeditor.jsx +11 -11
- package/src/components/common/form/fields/Editor.jsx +326 -0
- package/src/components/common/form/fields/Editor.scss +29 -0
- package/src/components/common/form/fields/Radio.jsx +1 -1
- package/src/components/common/form/fields/editor/FileBrowser.jsx +419 -0
- package/src/components/common/form/fields/editor/FileBrowser.scss +37 -0
- package/src/components/common/form/fields/editor/GetColumnClasses.jsx +14 -0
- package/src/components/common/form/fields/editor/GetRowClasses.jsx +18 -0
- package/src/components/common/form/fields/editor/RowTemplates.jsx +154 -0
- package/src/components/common/grid/Pagination.jsx +4 -4
- package/src/components/common/grid/headers/FromTo.jsx +1 -1
- package/src/components/common/grid/headers/Sortable.jsx +1 -1
- package/src/components/common/grid/rows/ThumbnailRow.jsx +1 -1
- package/src/components/common/list/Filter.jsx +1 -1
- package/src/components/common/modal/Alert.jsx +1 -1
- package/src/components/common/modal/Modal.jsx +1 -1
- package/src/components/frontStore/catalog/categoryView/filter/AttributeFilter.jsx +2 -2
- package/src/components/frontStore/catalog/categoryView/filter/CategoryFilter.jsx +3 -2
- package/src/components/frontStore/catalog/categoryView/filter/CategoryFilter.scss +5 -0
- package/src/components/frontStore/catalog/product/list/List.jsx +4 -4
- package/src/components/frontStore/catalog/product/list/Pagination.jsx +1 -1
- package/src/components/frontStore/catalog/product/list/Sorting.jsx +2 -2
- package/src/components/frontStore/catalog/product/list/item/Name.jsx +1 -1
- package/src/components/frontStore/checkout/cart/Empty.jsx +3 -3
- package/src/components/frontStore/checkout/cart/items/ItemOptions.jsx +1 -1
- package/src/components/frontStore/checkout/cart/items/ItemVariantOptions.jsx +1 -1
- package/src/components/frontStore/checkout/cart/items/Items.jsx +20 -21
- package/src/components/frontStore/checkout/cart/items/Items.scss +47 -0
- package/src/components/frontStore/checkout/cart/items/Quantity.jsx +154 -0
- package/src/components/frontStore/checkout/checkout/StepTitle.jsx +1 -1
- package/src/components/frontStore/checkout/checkout/payment/paymentStep/StepContent.jsx +5 -5
- package/src/components/frontStore/checkout/checkout/shipment/StepContent.jsx +1 -1
- package/src/components/frontStore/checkout/checkout/summary/Cart.jsx +10 -12
- package/src/components/frontStore/checkout/checkout/summary/Items.jsx +9 -9
- package/src/components/frontStore/checkout/checkout/summary/cart/Total.jsx +6 -6
- package/src/components/frontStore/checkout/success/summary/items/ItemOptions.jsx +1 -1
- package/src/components/frontStore/checkout/success/summary/items/Items.jsx +9 -6
- package/src/components/frontStore/checkout/success/summary/order/OrderSummary.jsx +9 -13
- package/src/components/frontStore/checkout/success/summary/order/Total.jsx +5 -5
- package/src/components/frontStore/customer/address/addressForm/AddressFormLoadingSkeleton.jsx +2 -2
- package/src/components/frontStore/customer/address/addressForm/NameAndTelephone.jsx +1 -1
- package/src/components/frontStore/customer/address/addressForm/ProvinceAndPostcode.jsx +1 -1
- package/src/components/frontStore/customer/checkout/Edit.jsx +2 -2
- package/src/components/frontStore/customer/detail/Order.jsx +4 -4
- package/src/components/frontStore/stripe/checkout/CheckoutForm.jsx +2 -2
- package/src/components/frontStore/stripe/checkout/TestCards.jsx +1 -1
- package/src/components/frontStore/widgets/BasicMenu.jsx +129 -0
- package/src/{modules/catalog/pages/frontStore/homepage/FeaturedProducts.jsx → components/frontStore/widgets/CollectionProducts.jsx} +40 -32
- package/src/components/frontStore/widgets/TextBlock.jsx +46 -0
- package/src/lib/componee/getComponentsByRoute.js +15 -2
- package/src/lib/event/event-manager.js +1 -1
- package/src/lib/middleware/tests/app/modules/404page/pages/frontStore/product/route.json +2 -1
- package/src/lib/middlewares/static.js +3 -1
- package/src/lib/response/render.js +5 -6
- package/src/lib/router/Router.js +1 -1
- package/src/lib/router/loadModuleRoutes.js +3 -0
- package/src/lib/router/registerAdminRoute.js +9 -1
- package/src/lib/router/registerFrontStoreRoute.js +2 -0
- package/src/lib/router/scanForRoutes.js +1 -0
- package/src/lib/router/tests/unit/unit.validateRoute.test.js +7 -1
- package/src/lib/util/defaultPaginationFilters.js +19 -17
- package/src/lib/util/getEnabledWidgets.js +28 -0
- package/src/lib/util/merge.js +67 -14
- package/src/lib/util/tests/unit/util.merge.test.js +21 -4
- package/src/lib/util/validateConfiguration.js +83 -0
- package/src/lib/webpack/createBaseConfig.js +4 -1
- package/src/lib/webpack/dev/createConfigClient.js +10 -2
- package/src/lib/webpack/loaders/AreaLoader.js +14 -3
- package/src/lib/webpack/util/parseGraphql.js +29 -16
- package/src/lib/webpack/util/parseGraphqlByFile.js +16 -2
- package/src/modules/auth/pages/admin/adminLogin/LoginForm.jsx +54 -21
- package/src/modules/auth/pages/admin/all/AdminUser.jsx +3 -3
- package/src/modules/base/bootstrap.js +79 -0
- package/src/modules/base/graphql/types/Route/Route.admin.graphql +15 -0
- package/src/modules/base/graphql/types/Route/Route.admin.resolvers.js +10 -0
- package/src/modules/base/pages/global/response[errorHandler].js +23 -0
- package/src/modules/catalog/bootstrap.js +125 -5
- package/src/modules/catalog/graphql/types/Category/Category.graphql +4 -3
- package/src/modules/catalog/graphql/types/Category/Category.resolvers.js +34 -0
- package/src/modules/catalog/graphql/types/Collection/Collection.graphql +2 -2
- package/src/modules/catalog/graphql/types/Collection/Collection.resolvers.js +34 -0
- package/src/modules/catalog/graphql/types/Product/Attribute/ProductAttribute.resolvers.js +1 -0
- package/src/modules/catalog/graphql/types/Product/Product.graphql +1 -1
- package/src/modules/catalog/graphql/types/Product/Product.resolvers.js +34 -0
- package/src/modules/catalog/graphql/types/Widget/CollectionProductsWidget/CollectionProductsWidget.graphql +11 -0
- package/src/modules/catalog/graphql/types/Widget/CollectionProductsWidget/CollectionProductsWidget.resolvers.js +8 -0
- package/src/modules/catalog/migration/Version-1.0.0.js +1 -0
- package/src/modules/catalog/migration/Version-1.0.7.js +10 -0
- package/src/modules/catalog/pages/admin/attributeEdit+attributeNew/FormContent.jsx +4 -4
- package/src/modules/catalog/pages/admin/attributeEdit+attributeNew/General.jsx +5 -5
- package/src/modules/catalog/pages/admin/attributeGrid/Grid.jsx +2 -2
- package/src/modules/catalog/pages/admin/categoryEdit/Products.jsx +4 -4
- package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/FormContent.jsx +4 -4
- package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/General.jsx +16 -18
- package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/Image.jsx +1 -2
- package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/Status.jsx +16 -1
- package/src/modules/catalog/pages/admin/categoryGrid/Grid.jsx +3 -3
- package/src/modules/catalog/pages/admin/collectionEdit/Products.jsx +4 -4
- package/src/modules/catalog/pages/admin/collectionEdit+collectionNew/FormContent.jsx +2 -2
- package/src/modules/catalog/pages/admin/collectionEdit+collectionNew/General.jsx +2 -2
- package/src/modules/catalog/pages/admin/collectionGrid/Grid.jsx +3 -3
- package/src/modules/catalog/pages/admin/productEdit/Collection.jsx +7 -7
- package/src/modules/catalog/pages/admin/productEdit+productNew/Attributes.jsx +1 -1
- package/src/modules/catalog/pages/admin/productEdit+productNew/CustomOptions.jsss +4 -4
- package/src/modules/catalog/pages/admin/productEdit+productNew/FormContent.jsx +4 -4
- package/src/modules/catalog/pages/admin/productEdit+productNew/General.jsx +15 -17
- package/src/modules/catalog/pages/admin/productGrid/Grid.jsx +3 -3
- package/src/modules/catalog/pages/frontStore/catalogSearch/General.jsx +2 -2
- package/src/modules/catalog/pages/frontStore/catalogSearch/Products.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/catalogSearch/route.json +2 -1
- package/src/modules/catalog/pages/frontStore/categoryView/CategoryView.jsx +19 -2
- package/src/modules/catalog/pages/frontStore/categoryView/Filter.scss +1 -0
- package/src/modules/catalog/pages/frontStore/categoryView/General.jsx +6 -8
- package/src/modules/catalog/pages/frontStore/categoryView/General.scss +0 -2
- package/src/modules/catalog/pages/frontStore/categoryView/Pagination.jsx +6 -0
- package/src/modules/catalog/pages/frontStore/categoryView/Products.jsx +8 -1
- package/src/modules/catalog/pages/frontStore/categoryView/route.json +2 -1
- package/src/modules/catalog/pages/frontStore/productView/Description.jsx +3 -3
- package/src/modules/catalog/pages/frontStore/productView/Form.jsx +4 -4
- package/src/modules/catalog/pages/frontStore/productView/Form.scss +1 -0
- package/src/modules/catalog/pages/frontStore/productView/GeneralInfo.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/productView/Images.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/productView/Layout.jsx +1 -1
- package/src/modules/catalog/pages/frontStore/productView/Options.jsx +2 -2
- package/src/modules/catalog/pages/frontStore/productView/Variants.jsx +4 -4
- package/src/modules/catalog/pages/frontStore/productView/route.json +2 -1
- package/src/modules/catalog/services/AttributeCollection.js +10 -10
- package/src/modules/catalog/services/AttributeGroupCollection.js +10 -10
- package/src/modules/catalog/services/CategoryCollection.js +10 -10
- package/src/modules/catalog/services/CollectionCollection.js +10 -10
- package/src/modules/catalog/services/registerCartItemProductUrlField.js +35 -0
- package/src/modules/catalog/services/registerCartItemVariantOptionsField.js +51 -0
- package/src/modules/catalog/services/registerDefaultCategoryCollectionFilters.js +16 -0
- package/src/modules/checkout/api/addShippingNote/[context]bodyParser[auth].js +5 -0
- package/src/modules/checkout/api/addShippingNote/payloadSchema.json +15 -0
- package/src/modules/checkout/api/addShippingNote/route.json +5 -0
- package/src/modules/checkout/api/addShippingNote/saveShippingNote.js +50 -0
- package/src/modules/checkout/api/createCart/createNewCart.js +28 -1
- package/src/modules/checkout/api/updateCartItemQty/[bodyParser]updateQty.js +49 -0
- package/src/modules/checkout/api/updateCartItemQty/[context]bodyParser[auth].js +5 -0
- package/src/modules/checkout/api/updateCartItemQty/payloadSchema.json +21 -0
- package/src/modules/checkout/api/updateCartItemQty/route.json +5 -0
- package/src/modules/checkout/api/updateMineCartItemQty/[context]bodyParser[auth].js +5 -0
- package/src/modules/checkout/api/updateMineCartItemQty/[detectCurrentCart]updateQty.js +51 -0
- package/src/modules/checkout/api/updateMineCartItemQty/[getCurrentCustomer]detectCurrentCart.js +32 -0
- package/src/modules/checkout/api/updateMineCartItemQty/payloadSchema.json +21 -0
- package/src/modules/checkout/api/updateMineCartItemQty/route.json +5 -0
- package/src/modules/checkout/bootstrap.js +27 -0
- package/src/modules/checkout/graphql/types/Cart/Cart.graphql +22 -3
- package/src/modules/checkout/graphql/types/Cart/Cart.resolvers.js +18 -2
- package/src/modules/checkout/graphql/types/CheckoutSetting/CheckoutSetting.graphql +3 -0
- package/src/modules/checkout/graphql/types/CheckoutSetting/CheckoutSetting.resolvers.js +7 -0
- package/src/modules/checkout/migration/Version-1.0.0.js +14 -0
- package/src/modules/checkout/migration/Version-1.0.6.js +201 -0
- package/src/modules/checkout/pages/admin/shippingSetting/ShippingSetting.jsx +2 -2
- package/src/modules/checkout/pages/frontStore/all/[context]detectCurrentCart[auth].js +5 -0
- package/src/modules/checkout/pages/frontStore/cart/ShoppingCart.jsx +17 -8
- package/src/modules/checkout/pages/frontStore/cart/Summary.jsx +18 -19
- package/src/modules/checkout/pages/frontStore/cart/route.json +2 -1
- package/src/modules/checkout/pages/frontStore/checkout/Checkout.jsx +5 -5
- package/src/modules/checkout/pages/frontStore/checkout/Checkout.scss +4 -0
- package/src/modules/checkout/pages/frontStore/checkout/ShippingMethods.jsx +2 -2
- package/src/modules/checkout/pages/frontStore/checkout/ShippingNote.jsx +105 -0
- package/src/modules/checkout/pages/frontStore/checkout/Summary.jsx +14 -14
- package/src/modules/checkout/pages/frontStore/checkout/SummaryMobile.jsx +12 -15
- package/src/modules/checkout/pages/frontStore/checkout/route.json +2 -1
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/CheckoutSuccess.jsx +1 -1
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/CheckoutSuccess.scss +4 -0
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/CustomerInfo.jsx +30 -32
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/ShippingNote.jsx +47 -0
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/Summary.jsx +12 -15
- package/src/modules/checkout/pages/frontStore/checkoutSuccess/route.json +2 -1
- package/src/modules/checkout/services/cart/Cart.js +31 -27
- package/src/modules/checkout/services/cart/registerCartBaseFields.js +133 -41
- package/src/modules/checkout/services/cart/registerCartItemBaseFields.js +300 -374
- package/src/modules/checkout/services/toPrice.js +1 -1
- package/src/modules/checkout/tests/basicSetup.js +85 -0
- package/src/modules/checkout/tests/coupons.js +82 -0
- package/src/modules/checkout/tests/products.js +67 -0
- package/src/modules/checkout/tests/taxRates.js +3 -0
- package/src/modules/checkout/tests/unit/discountAmount.test.js +60 -0
- package/src/modules/checkout/tests/unit/grandTotal.test.js +83 -0
- package/src/modules/checkout/tests/unit/lineTotal.test.js +90 -0
- package/src/modules/checkout/tests/unit/lineTotalWithDiscount.test.js +103 -0
- package/src/modules/checkout/tests/unit/productPrice.test.js +67 -0
- package/src/modules/checkout/tests/unit/subTotal.test.js +85 -0
- package/src/modules/checkout/tests/unit/subTotalWithDiscount.test.js +117 -0
- package/src/modules/checkout/tests/unit/taxAmount.test.js +67 -0
- package/src/modules/checkout/tests/unit/taxAmountRounding.test.js +277 -0
- package/src/modules/cms/api/createWidget/[context]bodyParser[auth].js +5 -0
- package/src/modules/cms/api/createWidget/createWidget[finish].js +17 -0
- package/src/modules/cms/api/createWidget/finish[apiResponse].js +27 -0
- package/src/modules/cms/api/createWidget/payloadSchema.json +18 -0
- package/src/modules/cms/api/createWidget/route.json +5 -0
- package/src/modules/cms/api/deleteWidget/deleteWidget.js +27 -0
- package/src/modules/cms/api/deleteWidget/route.json +5 -0
- package/src/modules/cms/api/updateWidget/[context]bodyParser[auth].js +5 -0
- package/src/modules/cms/api/updateWidget/finish[apiResponse].js +27 -0
- package/src/modules/cms/api/updateWidget/payloadSchema.json +18 -0
- package/src/modules/cms/api/updateWidget/route.json +5 -0
- package/src/modules/cms/api/updateWidget/updateWidget[finish].js +17 -0
- package/src/modules/cms/bootstrap.js +223 -3
- package/src/modules/cms/graphql/types/CmsPage/CmsPage.graphql +1 -2
- package/src/modules/cms/graphql/types/CmsPage/CmsPage.resolvers.js +35 -1
- package/src/modules/cms/graphql/types/Widget/Widget.graphql +91 -0
- package/src/modules/cms/graphql/types/Widget/Widget.resolvers.js +142 -0
- package/src/modules/cms/migration/Version-1.1.0.js +22 -0
- package/src/modules/cms/migration/Version-1.1.1.js +103 -0
- package/src/modules/cms/pages/admin/adminNotFound/NotFound.jsx +4 -4
- package/src/modules/cms/pages/admin/all/CmsMenuGroup.jsx +12 -4
- package/src/modules/cms/pages/admin/all/Notification.scss +1 -1
- package/src/modules/cms/pages/admin/all/search/NoResult.jsx +2 -2
- package/src/modules/cms/pages/admin/all/search/Results.jsx +3 -3
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/FormContent.jsx +7 -9
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/General.jsx +3 -3
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/Seo.jsx +1 -1
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/Status.jsx +40 -0
- package/src/modules/cms/pages/admin/cmsPageGrid/Grid.jsx +3 -4
- package/src/modules/cms/pages/admin/dashboard/Layout.jsx +3 -3
- package/src/modules/cms/pages/admin/widgetEdit/WidgetForm.jsx +52 -0
- package/src/modules/cms/pages/admin/widgetEdit/index.js +36 -0
- package/src/modules/cms/pages/admin/widgetEdit/route.json +4 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/FormContent.jsx +69 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/FormContent.scss +7 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/General.jsx +185 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/PageHeading.jsx +37 -0
- package/src/modules/cms/pages/admin/widgetEdit+widgetNew/Setting.jsx +55 -0
- package/src/modules/cms/pages/admin/widgetGrid/Grid.jsx +415 -0
- package/src/modules/cms/pages/admin/widgetGrid/Heading.jsx +11 -0
- package/src/modules/cms/pages/admin/widgetGrid/NewWidgetButton.jsx +52 -0
- package/src/modules/cms/pages/admin/widgetGrid/index.js +15 -0
- package/src/modules/cms/pages/admin/widgetGrid/route.json +4 -0
- package/src/modules/cms/pages/admin/widgetNew/WidgetNewForm.jsx +60 -0
- package/src/modules/cms/pages/admin/widgetNew/index.js +11 -0
- package/src/modules/cms/pages/admin/widgetNew/route.json +4 -0
- package/src/modules/cms/pages/admin/widgetNew/typeValidate.js +21 -0
- package/src/modules/cms/pages/frontStore/all/Breadcrumb.jsx +1 -1
- package/src/modules/cms/pages/frontStore/all/Footer.jsx +2 -2
- package/src/modules/cms/pages/frontStore/all/Layout.jsx +3 -3
- package/src/modules/cms/pages/frontStore/all/Layout.scss +13 -0
- package/src/modules/cms/pages/frontStore/all/Logo.jsx +2 -2
- package/src/modules/cms/pages/frontStore/all/Logo.scss +2 -4
- package/src/modules/cms/pages/frontStore/all/Notification.scss +1 -1
- package/src/modules/cms/pages/frontStore/cmsPageView/Layout.jsx +2 -2
- package/src/modules/cms/pages/frontStore/cmsPageView/View.jsx +5 -3
- package/src/modules/cms/pages/frontStore/cmsPageView/index.js +6 -12
- package/src/modules/cms/pages/frontStore/cmsPageView/route.json +2 -1
- package/src/modules/cms/pages/frontStore/homepage/route.json +2 -1
- package/src/modules/cms/pages/frontStore/notFound/NotFound.jsx +4 -4
- package/src/modules/cms/pages/frontStore/notFound/route.json +2 -1
- package/src/modules/cms/pages/frontStore/staticAsset/[context]staticAssets[auth].js +1 -1
- package/src/modules/cms/services/CMSPageCollection.js +10 -10
- package/src/modules/cms/services/WidgetCollection.js +62 -0
- package/src/modules/cms/services/getWidgetsBaseQuery.js +7 -0
- package/src/modules/cms/services/page/createPage.js +1 -2
- package/src/modules/cms/services/page/pageDataSchema.json +0 -4
- package/src/modules/cms/services/registerDefaultWidgetCollectionFilters.js +62 -0
- package/src/modules/cms/services/tailwind.admin.config.js +22 -107
- package/src/modules/cms/services/tailwind.frontStore.config.js +23 -108
- package/src/modules/cms/services/widget/createWidget.js +73 -0
- package/src/modules/cms/services/widget/deleteWidget.js +49 -0
- package/src/modules/cms/services/widget/loadWidgetInstances.js +54 -0
- package/src/modules/cms/services/widget/updateWidget.js +86 -0
- package/src/modules/cms/services/widget/widgetDataSchema.json +29 -0
- package/src/modules/cod/pages/admin/paymentSetting/CODSetting.jsx +2 -2
- package/src/modules/cod/pages/frontStore/checkout/CashOnDelivery.jsx +1 -1
- package/src/modules/customer/bootstrap.js +21 -4
- package/src/modules/customer/pages/admin/customerEdit/CustomerEditForm.jsx +3 -3
- package/src/modules/customer/pages/admin/customerEdit+customerNew/OrderHistory.jsx +1 -1
- package/src/modules/customer/pages/admin/customerGrid/Grid.jsx +3 -3
- package/src/modules/customer/pages/frontStore/account/AccountDetails.jsx +3 -3
- package/src/modules/customer/pages/frontStore/account/Layout.jsx +3 -3
- package/src/modules/customer/pages/frontStore/account/OrderHistory.jsx +1 -1
- package/src/modules/customer/pages/frontStore/account/route.json +2 -1
- package/src/modules/customer/pages/frontStore/login/LoginForm.jsx +2 -2
- package/src/modules/customer/pages/frontStore/login/route.json +2 -1
- package/src/modules/customer/pages/frontStore/register/RegisterForm.jsx +2 -2
- package/src/modules/customer/pages/frontStore/register/route.json +2 -1
- package/src/modules/customer/pages/frontStore/resetPasswordPage/ResetPasswordForm.jsx +2 -2
- package/src/modules/customer/pages/frontStore/resetPasswordPage/route.json +2 -1
- package/src/modules/customer/pages/frontStore/updatePasswordPage/UpdatePasswordForm.jsx +3 -3
- package/src/modules/customer/pages/frontStore/updatePasswordPage/route.json +2 -1
- package/src/modules/customer/services/CustomerCollection.js +10 -10
- package/src/modules/customer/services/CustomerGroupCollection.js +10 -10
- package/src/modules/graphql/pages/global/[bodyParser]buildQuery[graphql].js +238 -6
- package/src/modules/graphql/pages/global/[buildQuery]graphql[notification].js +12 -8
- package/src/modules/oms/bootstrap.js +87 -3
- package/src/modules/oms/graphql/types/Order/Order.graphql +11 -2
- package/src/modules/oms/graphql/types/Order/Order.resolvers.js +7 -1
- package/src/modules/oms/pages/admin/dashboard/Bestsellers.jsx +2 -2
- package/src/modules/oms/pages/admin/dashboard/Lifetimesales.jsx +5 -5
- package/src/modules/oms/pages/admin/orderEdit/AddTrackingButton.jsx +1 -1
- package/src/modules/oms/pages/admin/orderEdit/Items.jsx +7 -7
- package/src/modules/oms/pages/admin/orderEdit/Layout.jsx +3 -3
- package/src/modules/oms/pages/admin/orderEdit/Payment.jsx +6 -6
- package/src/modules/oms/pages/admin/orderEdit/ShipButton.jsx +1 -1
- package/src/modules/oms/pages/admin/orderGrid/Grid.jsx +3 -3
- package/src/modules/oms/services/OrderCollection.js +10 -10
- package/src/modules/paypal/api/paypalCreateOrder/[bodyParser]createOrder.js +55 -24
- package/src/modules/paypal/pages/admin/paymentSetting/PaypalSetting.jsx +6 -6
- package/src/modules/paypal/pages/frontStore/checkout/Paypal.jsx +3 -4
- package/src/modules/promotion/bootstrap.js +19 -101
- package/src/modules/promotion/pages/admin/couponEdit+couponNew/DiscountType.jsx +1 -1
- package/src/modules/promotion/pages/admin/couponEdit+couponNew/FormContent.jsx +5 -5
- package/src/modules/promotion/pages/admin/couponGrid/Grid.jsx +3 -3
- package/src/modules/promotion/pages/frontStore/cart/Coupon.jsx +2 -2
- package/src/modules/promotion/services/CouponCollection.js +10 -10
- package/src/modules/promotion/services/couponValidator.js +4 -7
- package/src/modules/promotion/services/discountCalculator.js +2 -7
- package/src/modules/promotion/services/registerCartItemPromotionFields.js +80 -0
- package/src/modules/promotion/services/registerCartPromotionFields.js +128 -0
- package/src/modules/promotion/services/registerDefaultCalculators.js +48 -20
- package/src/modules/promotion/services/registerDefaultValidators.js +16 -4
- package/src/modules/setting/pages/admin/paymentSetting/PaymentSetting.jsx +2 -2
- package/src/modules/setting/pages/admin/storeSetting/StoreSetting.jsx +98 -35
- package/src/modules/stripe/pages/admin/paymentSetting/StripePayment.jsx +5 -5
- package/src/modules/stripe/pages/frontStore/checkout/Stripe.jsx +1 -1
- package/src/modules/tax/bootstrap.js +40 -5
- package/src/modules/tax/graphql/types/Product/Price/ProductPrice.resolvers.js +6 -39
- package/src/modules/tax/graphql/types/TaxSetting/TaxSetting.graphql +1 -2
- package/src/modules/tax/graphql/types/TaxSetting/TaxSetting.resolvers.js +1 -8
- package/src/modules/tax/pages/admin/taxSetting/TaxSetting.jsx +4 -4
- package/src/modules/tax/services/TaxClassCollection.js +10 -10
- package/src/modules/tax/services/calculateTaxAmount.js +12 -9
- package/src/modules/tax/services/registerCartItemTaxPercentField.js +76 -0
- package/src/modules/auth/services/adminSessionMiddleware.js +0 -0
- package/src/modules/catalog/pages/frontStore/homepage/FeaturedCategories.jsx +0 -58
- package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/StatusAndLayout.jsx +0 -61
- package/src/modules/cms/pages/frontStore/all/Menu.jsx +0 -46
- package/src/modules/cms/pages/frontStore/all/Menu.scss +0 -7
- package/src/modules/cms/pages/frontStore/all/MobileMenu.jsx +0 -73
- package/src/modules/cms/pages/frontStore/all/MobileMenu.scss +0 -35
- package/src/modules/cms/pages/frontStore/homepage/MainBanner.jsx +0 -31
- package/src/modules/cms/pages/frontStore/homepage/MainBanner.scss +0 -48
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
const { select } = require('@evershop/postgres-query-builder');
|
|
3
3
|
const { pool } = require('@evershop/evershop/src/lib/postgres/connection');
|
|
4
4
|
const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');
|
|
5
|
-
const { getCartTotalBeforeDiscount } = require('./getCartTotalBeforeDiscount');
|
|
6
5
|
const { toPrice } = require('../../checkout/services/toPrice');
|
|
7
6
|
|
|
8
7
|
module.exports.registerDefaultCalculators =
|
|
9
8
|
function registerDefaultCalculators() {
|
|
10
9
|
return [
|
|
11
10
|
async function percentageDiscountToEntireOrderCalculator(cart, coupon) {
|
|
11
|
+
const priceIncludingTax = getConfig(
|
|
12
|
+
'pricing.tax.price_including_tax',
|
|
13
|
+
false
|
|
14
|
+
);
|
|
12
15
|
if (coupon.discount_type !== 'percentage_discount_to_entire_order') {
|
|
13
16
|
return false;
|
|
14
17
|
}
|
|
@@ -17,8 +20,11 @@ module.exports.registerDefaultCalculators =
|
|
|
17
20
|
return false;
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
const cartSubTotal = priceIncludingTax
|
|
24
|
+
? cart.getData('sub_total_incl_tax')
|
|
25
|
+
: cart.getData('sub_total');
|
|
20
26
|
const cartDiscountAmount = toPrice(
|
|
21
|
-
(discountPercent *
|
|
27
|
+
(discountPercent * cartSubTotal) / 100
|
|
22
28
|
);
|
|
23
29
|
let distributedAmount = 0;
|
|
24
30
|
const discounts = {};
|
|
@@ -27,7 +33,7 @@ module.exports.registerDefaultCalculators =
|
|
|
27
33
|
let sharedDiscount = 0;
|
|
28
34
|
if (index === items.length - 1) {
|
|
29
35
|
const precision = getConfig('pricing.precision', '2');
|
|
30
|
-
const precisionFix =
|
|
36
|
+
const precisionFix = 10**precision;
|
|
31
37
|
sharedDiscount =
|
|
32
38
|
(cartDiscountAmount * precisionFix -
|
|
33
39
|
distributedAmount * precisionFix) /
|
|
@@ -35,10 +41,11 @@ module.exports.registerDefaultCalculators =
|
|
|
35
41
|
// Fix for rounding error
|
|
36
42
|
sharedDiscount = parseFloat(sharedDiscount.toFixed(precision));
|
|
37
43
|
} else {
|
|
38
|
-
const
|
|
44
|
+
const lineTotal = priceIncludingTax
|
|
45
|
+
? item.getData('line_total_incl_tax')
|
|
46
|
+
: item.getData('line_total');
|
|
39
47
|
sharedDiscount = toPrice(
|
|
40
|
-
(
|
|
41
|
-
getCartTotalBeforeDiscount(cart),
|
|
48
|
+
(lineTotal * cartDiscountAmount) / cartSubTotal,
|
|
42
49
|
0
|
|
43
50
|
);
|
|
44
51
|
}
|
|
@@ -50,7 +57,6 @@ module.exports.registerDefaultCalculators =
|
|
|
50
57
|
}
|
|
51
58
|
distributedAmount += sharedDiscount;
|
|
52
59
|
});
|
|
53
|
-
|
|
54
60
|
await Promise.all(
|
|
55
61
|
items.map(async (item) => {
|
|
56
62
|
await item.setData('discount_amount', discounts[item.getId()] || 0);
|
|
@@ -60,6 +66,10 @@ module.exports.registerDefaultCalculators =
|
|
|
60
66
|
return true;
|
|
61
67
|
},
|
|
62
68
|
async function fixedDiscountToEntireOrderCalculator(cart, coupon) {
|
|
69
|
+
const priceIncludingTax = getConfig(
|
|
70
|
+
'pricing.tax.price_including_tax',
|
|
71
|
+
false
|
|
72
|
+
);
|
|
63
73
|
if (coupon.discount_type !== 'fixed_discount_to_entire_order')
|
|
64
74
|
return false;
|
|
65
75
|
|
|
@@ -69,9 +79,11 @@ module.exports.registerDefaultCalculators =
|
|
|
69
79
|
if (cartDiscountAmount < 0) {
|
|
70
80
|
return false;
|
|
71
81
|
}
|
|
72
|
-
const
|
|
82
|
+
const cartSubTotal = priceIncludingTax
|
|
83
|
+
? cart.getData('sub_total_incl_tax')
|
|
84
|
+
: cart.getData('sub_total');
|
|
73
85
|
cartDiscountAmount =
|
|
74
|
-
|
|
86
|
+
cartSubTotal > cartDiscountAmount ? cartDiscountAmount : cartSubTotal;
|
|
75
87
|
let distributedAmount = 0;
|
|
76
88
|
const discounts = {};
|
|
77
89
|
const items = cart.getItems();
|
|
@@ -87,10 +99,11 @@ module.exports.registerDefaultCalculators =
|
|
|
87
99
|
// Fix for rounding error
|
|
88
100
|
sharedDiscount = parseFloat(sharedDiscount.toFixed(precision));
|
|
89
101
|
} else {
|
|
90
|
-
const
|
|
102
|
+
const lineTotal = priceIncludingTax
|
|
103
|
+
? item.getData('line_total_incl_tax')
|
|
104
|
+
: item.getData('line_total');
|
|
91
105
|
sharedDiscount = toPrice(
|
|
92
|
-
(
|
|
93
|
-
getCartTotalBeforeDiscount(cart),
|
|
106
|
+
(lineTotal * cartDiscountAmount) / cartSubTotal,
|
|
94
107
|
0
|
|
95
108
|
);
|
|
96
109
|
}
|
|
@@ -110,6 +123,10 @@ module.exports.registerDefaultCalculators =
|
|
|
110
123
|
return true;
|
|
111
124
|
},
|
|
112
125
|
async function discountToSpecificProductsCalculator(cart, coupon) {
|
|
126
|
+
const priceIncludingTax = getConfig(
|
|
127
|
+
'pricing.tax.price_including_tax',
|
|
128
|
+
false
|
|
129
|
+
);
|
|
113
130
|
if (
|
|
114
131
|
![
|
|
115
132
|
'fixed_discount_to_specific_products',
|
|
@@ -261,18 +278,21 @@ module.exports.registerDefaultCalculators =
|
|
|
261
278
|
return;
|
|
262
279
|
}
|
|
263
280
|
if (coupon.discount_type === 'fixed_discount_to_specific_products') {
|
|
264
|
-
|
|
265
|
-
discountAmount
|
|
266
|
-
|
|
281
|
+
discountAmount = Math.min(
|
|
282
|
+
discountAmount,
|
|
283
|
+
priceIncludingTax
|
|
284
|
+
? item.getData('final_price_incl_tax')
|
|
285
|
+
: item.getData('final_price')
|
|
286
|
+
);
|
|
267
287
|
discounts[item.getId()] =
|
|
268
|
-
|
|
269
|
-
? toPrice(discountAmount * item.getData('qty'))
|
|
270
|
-
: toPrice(discountAmount * maxQty);
|
|
288
|
+
Math.min(item.getData('qty'), maxQty) * discountAmount;
|
|
271
289
|
} else {
|
|
272
290
|
const discountPercent = Math.min(discountAmount, 100);
|
|
273
291
|
discounts[item.getId()] = toPrice(
|
|
274
292
|
(Math.min(item.getData('qty'), maxQty) *
|
|
275
|
-
(
|
|
293
|
+
(priceIncludingTax
|
|
294
|
+
? item.getData('final_price_incl_tax')
|
|
295
|
+
: item.getData('final_price') * discountPercent)) /
|
|
276
296
|
100
|
|
277
297
|
);
|
|
278
298
|
}
|
|
@@ -286,6 +306,10 @@ module.exports.registerDefaultCalculators =
|
|
|
286
306
|
return true;
|
|
287
307
|
},
|
|
288
308
|
async function buyXGetYCalculator(cart, coupon) {
|
|
309
|
+
const priceIncludingTax = getConfig(
|
|
310
|
+
'pricing.tax.price_including_tax',
|
|
311
|
+
false
|
|
312
|
+
);
|
|
289
313
|
if (coupon.discount_type !== 'buy_x_get_y') {
|
|
290
314
|
return true;
|
|
291
315
|
}
|
|
@@ -311,7 +335,11 @@ module.exports.registerDefaultCalculators =
|
|
|
311
335
|
item.getData('qty') >= buyQty + getQty
|
|
312
336
|
) {
|
|
313
337
|
const discountPerUnit = toPrice(
|
|
314
|
-
(discount *
|
|
338
|
+
(discount *
|
|
339
|
+
(priceIncludingTax
|
|
340
|
+
? item.getData('final_price_incl_tax')
|
|
341
|
+
: item.getData('final_price'))) /
|
|
342
|
+
100
|
|
315
343
|
);
|
|
316
344
|
const discountAbleUnits =
|
|
317
345
|
Math.floor(item.getData('qty') / buyQty) * getQty;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const { select } = require('@evershop/postgres-query-builder');
|
|
3
3
|
const { DateTime } = require('luxon');
|
|
4
4
|
const { pool } = require('@evershop/evershop/src/lib/postgres/connection');
|
|
5
|
-
const {
|
|
5
|
+
const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');
|
|
6
6
|
|
|
7
7
|
module.exports.registerDefaultValidators =
|
|
8
8
|
function registerDefaultValidators() {
|
|
@@ -76,6 +76,10 @@ module.exports.registerDefaultValidators =
|
|
|
76
76
|
return true;
|
|
77
77
|
},
|
|
78
78
|
function subTotalValidator(cart, coupon) {
|
|
79
|
+
const priceIncludingTax = getConfig(
|
|
80
|
+
'pricing.tax.price_including_tax',
|
|
81
|
+
false
|
|
82
|
+
);
|
|
79
83
|
const conditions = coupon.condition;
|
|
80
84
|
const minimumSubTotal = !Number.isNaN(
|
|
81
85
|
parseFloat(conditions.order_total)
|
|
@@ -83,8 +87,9 @@ module.exports.registerDefaultValidators =
|
|
|
83
87
|
? parseFloat(conditions.order_total)
|
|
84
88
|
: null;
|
|
85
89
|
if (
|
|
86
|
-
minimumSubTotal &&
|
|
87
|
-
|
|
90
|
+
minimumSubTotal && priceIncludingTax
|
|
91
|
+
? cart.getData('sub_total_incl_tax')
|
|
92
|
+
: cart.getData('sub_total') < minimumSubTotal
|
|
88
93
|
) {
|
|
89
94
|
return false;
|
|
90
95
|
}
|
|
@@ -280,6 +285,10 @@ module.exports.registerDefaultValidators =
|
|
|
280
285
|
return flag;
|
|
281
286
|
},
|
|
282
287
|
async function requiredProductByPriceValidator(cart, coupon) {
|
|
288
|
+
const priceIncludingTax = getConfig(
|
|
289
|
+
'pricing.tax.price_including_tax',
|
|
290
|
+
false
|
|
291
|
+
);
|
|
283
292
|
let flag = true;
|
|
284
293
|
const items = cart.getItems();
|
|
285
294
|
const conditions = coupon.condition;
|
|
@@ -306,8 +315,11 @@ module.exports.registerDefaultValidators =
|
|
|
306
315
|
operator = '===';
|
|
307
316
|
}
|
|
308
317
|
items.forEach((item) => {
|
|
318
|
+
const price = priceIncludingTax
|
|
319
|
+
? item.getData('final_price_incl_tax')
|
|
320
|
+
: item.getData('final_price');
|
|
309
321
|
// eslint-disable-next-line no-eval
|
|
310
|
-
if (eval(`${
|
|
322
|
+
if (eval(`${price} ${operator} ${value}`)) {
|
|
311
323
|
qty += item.getData('qty');
|
|
312
324
|
}
|
|
313
325
|
});
|
|
@@ -8,7 +8,7 @@ import SettingMenu from '@components/admin/setting/SettingMenu';
|
|
|
8
8
|
export default function PaymentSetting({ saveSettingApi }) {
|
|
9
9
|
return (
|
|
10
10
|
<div className="main-content-inner">
|
|
11
|
-
<div className="grid grid-cols-6 gap-x-
|
|
11
|
+
<div className="grid grid-cols-6 gap-x-8 grid-flow-row ">
|
|
12
12
|
<div className="col-span-2">
|
|
13
13
|
<SettingMenu />
|
|
14
14
|
</div>
|
|
@@ -25,7 +25,7 @@ export default function PaymentSetting({ saveSettingApi }) {
|
|
|
25
25
|
}
|
|
26
26
|
}}
|
|
27
27
|
>
|
|
28
|
-
<Area id="paymentSetting" className="grid gap-
|
|
28
|
+
<Area id="paymentSetting" className="grid gap-8" />
|
|
29
29
|
</Form>
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
@@ -6,6 +6,7 @@ import { Field } from '@components/common/form/Field';
|
|
|
6
6
|
import { Form } from '@components/common/form/Form';
|
|
7
7
|
import { Card } from '@components/admin/cms/Card';
|
|
8
8
|
import SettingMenu from '@components/admin/setting/SettingMenu';
|
|
9
|
+
import Area from '@components/common/Area';
|
|
9
10
|
|
|
10
11
|
const ProvincesQuery = `
|
|
11
12
|
query Province($countries: [String]) {
|
|
@@ -182,6 +183,46 @@ Currency.defaultProps = {
|
|
|
182
183
|
fieldName: 'storeCurrency'
|
|
183
184
|
};
|
|
184
185
|
|
|
186
|
+
function StorePhoneNumber({ storePhoneNumber }) {
|
|
187
|
+
return <div>
|
|
188
|
+
<Field
|
|
189
|
+
name="storePhoneNumber"
|
|
190
|
+
label="Store Phone Number"
|
|
191
|
+
placeholder="Store Phone Number"
|
|
192
|
+
value={storePhoneNumber}
|
|
193
|
+
type="text"
|
|
194
|
+
/>
|
|
195
|
+
</div>
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
StorePhoneNumber.propTypes = {
|
|
199
|
+
storePhoneNumber: PropTypes.string
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
StorePhoneNumber.defaultProps = {
|
|
203
|
+
storePhoneNumber: ''
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
function StoreEmail({ storeEmail }) {
|
|
207
|
+
return <div>
|
|
208
|
+
<Field
|
|
209
|
+
name="storeEmail"
|
|
210
|
+
label="Store Email"
|
|
211
|
+
placeholder="Store Email"
|
|
212
|
+
value={storeEmail}
|
|
213
|
+
type="text"
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
StoreEmail.propTypes = {
|
|
219
|
+
storeEmail: PropTypes.string
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
StoreEmail.defaultProps = {
|
|
223
|
+
storeEmail: ''
|
|
224
|
+
};
|
|
225
|
+
|
|
185
226
|
export default function StoreSetting({
|
|
186
227
|
saveSettingApi,
|
|
187
228
|
setting: {
|
|
@@ -207,7 +248,7 @@ export default function StoreSetting({
|
|
|
207
248
|
|
|
208
249
|
return (
|
|
209
250
|
<div className="main-content-inner">
|
|
210
|
-
<div className="grid grid-cols-6 gap-x-
|
|
251
|
+
<div className="grid grid-cols-6 gap-x-8 grid-flow-row ">
|
|
211
252
|
<div className="col-span-2">
|
|
212
253
|
<SettingMenu />
|
|
213
254
|
</div>
|
|
@@ -226,42 +267,64 @@ export default function StoreSetting({
|
|
|
226
267
|
>
|
|
227
268
|
<Card>
|
|
228
269
|
<Card.Session title="Store Information">
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
270
|
+
<Area
|
|
271
|
+
id="storeInfoSetting"
|
|
272
|
+
coreComponents={[
|
|
273
|
+
{
|
|
274
|
+
component: {
|
|
275
|
+
default: Field
|
|
276
|
+
},
|
|
277
|
+
props: {
|
|
278
|
+
name: 'storeName',
|
|
279
|
+
label: 'Store Name',
|
|
280
|
+
placeholder: 'Store Name',
|
|
281
|
+
value: storeName,
|
|
282
|
+
type: 'text'
|
|
283
|
+
},
|
|
284
|
+
sortOrder: 10
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
component: {
|
|
288
|
+
default: Field
|
|
289
|
+
},
|
|
290
|
+
props: {
|
|
291
|
+
name: 'storeDescription',
|
|
292
|
+
label: 'Store Description',
|
|
293
|
+
placeholder: 'Store Description',
|
|
294
|
+
value: storeDescription,
|
|
295
|
+
type: 'textarea'
|
|
296
|
+
},
|
|
297
|
+
sortOrder: 20
|
|
298
|
+
}
|
|
299
|
+
]}
|
|
300
|
+
noOuter
|
|
242
301
|
/>
|
|
243
302
|
</Card.Session>
|
|
244
303
|
<Card.Session title="Contact Information">
|
|
245
|
-
<
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
304
|
+
<Area
|
|
305
|
+
id="storeContactSetting"
|
|
306
|
+
coreComponents={[
|
|
307
|
+
{
|
|
308
|
+
component: {
|
|
309
|
+
default: StorePhoneNumber
|
|
310
|
+
},
|
|
311
|
+
props: {
|
|
312
|
+
storePhoneNumber
|
|
313
|
+
},
|
|
314
|
+
sortOrder: 10
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
component: {
|
|
318
|
+
default: StoreEmail
|
|
319
|
+
},
|
|
320
|
+
props: {
|
|
321
|
+
storeEmail
|
|
322
|
+
},
|
|
323
|
+
sortOrder: 20
|
|
324
|
+
}
|
|
325
|
+
]}
|
|
326
|
+
className="grid grid-cols-2 gap-8 mt-8"
|
|
327
|
+
/>
|
|
265
328
|
</Card.Session>
|
|
266
329
|
<Card.Session title="Address">
|
|
267
330
|
<Country
|
|
@@ -275,7 +338,7 @@ export default function StoreSetting({
|
|
|
275
338
|
placeholder="Store Address"
|
|
276
339
|
type="text"
|
|
277
340
|
/>
|
|
278
|
-
<div className="grid grid-cols-3 gap-
|
|
341
|
+
<div className="grid grid-cols-3 gap-8 mt-8">
|
|
279
342
|
<div>
|
|
280
343
|
<Field
|
|
281
344
|
name="storeCity"
|
|
@@ -16,7 +16,7 @@ export default function StripePayment({
|
|
|
16
16
|
return (
|
|
17
17
|
<Card title="Stripe Payment">
|
|
18
18
|
<Card.Session>
|
|
19
|
-
<div className="grid grid-cols-3 gap-
|
|
19
|
+
<div className="grid grid-cols-3 gap-8">
|
|
20
20
|
<div className="col-span-1 items-center flex">
|
|
21
21
|
<h4>Enable?</h4>
|
|
22
22
|
</div>
|
|
@@ -26,7 +26,7 @@ export default function StripePayment({
|
|
|
26
26
|
</div>
|
|
27
27
|
</Card.Session>
|
|
28
28
|
<Card.Session>
|
|
29
|
-
<div className="grid grid-cols-3 gap-
|
|
29
|
+
<div className="grid grid-cols-3 gap-8">
|
|
30
30
|
<div className="col-span-1 items-center flex">
|
|
31
31
|
<h4>Dislay Name</h4>
|
|
32
32
|
</div>
|
|
@@ -41,7 +41,7 @@ export default function StripePayment({
|
|
|
41
41
|
</div>
|
|
42
42
|
</Card.Session>
|
|
43
43
|
<Card.Session>
|
|
44
|
-
<div className="grid grid-cols-3 gap-
|
|
44
|
+
<div className="grid grid-cols-3 gap-8">
|
|
45
45
|
<div className="col-span-1 items-center flex">
|
|
46
46
|
<h4>Publishable Key</h4>
|
|
47
47
|
</div>
|
|
@@ -56,7 +56,7 @@ export default function StripePayment({
|
|
|
56
56
|
</div>
|
|
57
57
|
</Card.Session>
|
|
58
58
|
<Card.Session>
|
|
59
|
-
<div className="grid grid-cols-3 gap-
|
|
59
|
+
<div className="grid grid-cols-3 gap-8">
|
|
60
60
|
<div className="col-span-1 items-center flex">
|
|
61
61
|
<h4>Secret Key</h4>
|
|
62
62
|
</div>
|
|
@@ -71,7 +71,7 @@ export default function StripePayment({
|
|
|
71
71
|
</div>
|
|
72
72
|
</Card.Session>
|
|
73
73
|
<Card.Session>
|
|
74
|
-
<div className="grid grid-cols-3 gap-
|
|
74
|
+
<div className="grid grid-cols-3 gap-8">
|
|
75
75
|
<div className="col-span-1 items-center flex">
|
|
76
76
|
<h4>Webhook Secret Key</h4>
|
|
77
77
|
</div>
|
|
@@ -42,7 +42,7 @@ export default function StripeMethod({ setting }) {
|
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<div>
|
|
45
|
-
<div className="flex justify-start items-center gap-
|
|
45
|
+
<div className="flex justify-start items-center gap-4">
|
|
46
46
|
{(!selectedPaymentMethod ||
|
|
47
47
|
selectedPaymentMethod.code !== 'stripe') && (
|
|
48
48
|
<a
|
|
@@ -1,22 +1,57 @@
|
|
|
1
1
|
const config = require('config');
|
|
2
|
+
const { merge } = require('@evershop/evershop/src/lib/util/merge');
|
|
2
3
|
const { addProcessor } = require('../../lib/util/registry');
|
|
3
4
|
const registerDefaultTaxClassCollectionFilters = require('./services/registerDefaultTaxClassCollectionFilters');
|
|
4
5
|
const {
|
|
5
6
|
defaultPaginationFilters
|
|
6
7
|
} = require('../../lib/util/defaultPaginationFilters');
|
|
8
|
+
const {
|
|
9
|
+
registerCartItemTaxPercentField
|
|
10
|
+
} = require('./services/registerCartItemTaxPercentField');
|
|
7
11
|
|
|
8
12
|
module.exports = () => {
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
addProcessor('cartItemFields', registerCartItemTaxPercentField, 0);
|
|
14
|
+
addProcessor('configuratonSchema', (schema) => {
|
|
15
|
+
merge(schema, {
|
|
16
|
+
properties: {
|
|
17
|
+
pricing: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
tax: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
rounding: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: ['round', 'ceil', 'floor']
|
|
26
|
+
},
|
|
27
|
+
precision: {
|
|
28
|
+
type: 'integer'
|
|
29
|
+
},
|
|
30
|
+
round_level: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['total', 'line', 'unit']
|
|
33
|
+
},
|
|
34
|
+
price_including_tax: {
|
|
35
|
+
type: 'boolean'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return schema;
|
|
44
|
+
});
|
|
45
|
+
// Default tax configuration
|
|
46
|
+
const defaultTaxConfig = {
|
|
11
47
|
tax: {
|
|
12
48
|
rounding: 'round',
|
|
13
49
|
precision: 2,
|
|
14
50
|
round_level: 'total',
|
|
15
|
-
|
|
16
|
-
display_checkout_price_including_tax: true
|
|
51
|
+
price_including_tax: true
|
|
17
52
|
}
|
|
18
53
|
};
|
|
19
|
-
config.util.setModuleDefaults('pricing',
|
|
54
|
+
config.util.setModuleDefaults('pricing', defaultTaxConfig);
|
|
20
55
|
// Getting config value like this: config.get('pricing.tax.rounding');
|
|
21
56
|
|
|
22
57
|
// Reigtering the default filters for tax class collection
|
|
@@ -1,48 +1,15 @@
|
|
|
1
|
-
const {
|
|
2
|
-
getSetting
|
|
3
|
-
} = require('@evershop/evershop/src/modules/setting/services/setting');
|
|
4
1
|
const {
|
|
5
2
|
toPrice
|
|
6
3
|
} = require('@evershop/evershop/src/modules/checkout/services/toPrice');
|
|
7
|
-
const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');
|
|
8
|
-
const { getTaxRates } = require('../../../../services/getTaxRates');
|
|
9
|
-
const { getTaxPercent } = require('../../../../services/getTaxPercent');
|
|
10
|
-
const {
|
|
11
|
-
calculateTaxAmount
|
|
12
|
-
} = require('../../../../services/calculateTaxAmount');
|
|
13
4
|
|
|
14
5
|
module.exports = {
|
|
15
6
|
Product: {
|
|
16
|
-
price: async (product
|
|
17
|
-
const price =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const taxClassId = product.taxClass;
|
|
23
|
-
if (!taxClassId || !taxConfigDisplay || user) {
|
|
24
|
-
return {
|
|
25
|
-
regular: price,
|
|
26
|
-
special: price // TODO: implement special price
|
|
27
|
-
};
|
|
28
|
-
} else {
|
|
29
|
-
const taxRates = await getTaxRates(
|
|
30
|
-
taxClassId,
|
|
31
|
-
await getSetting('storeCountry', null),
|
|
32
|
-
await getSetting('storeProvince', null),
|
|
33
|
-
await getSetting('storePostalCode', null)
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
// We display the price including tax based on the store address.
|
|
37
|
-
// TODO: This has to be changed to the customer address.
|
|
38
|
-
const percentage = getTaxPercent(taxRates);
|
|
39
|
-
const taxAmount = calculateTaxAmount(percentage, price, 1);
|
|
40
|
-
const includedTaxPrice = toPrice(price + taxAmount);
|
|
41
|
-
return {
|
|
42
|
-
regular: includedTaxPrice,
|
|
43
|
-
special: includedTaxPrice // TODO: implement special price
|
|
44
|
-
};
|
|
45
|
-
}
|
|
7
|
+
price: async (product) => {
|
|
8
|
+
const price = toPrice(product.price);
|
|
9
|
+
return {
|
|
10
|
+
regular: price,
|
|
11
|
+
special: price // TODO: implement special price
|
|
12
|
+
};
|
|
46
13
|
}
|
|
47
14
|
}
|
|
48
15
|
};
|
|
@@ -2,13 +2,6 @@ const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
Setting: {
|
|
5
|
-
|
|
6
|
-
'pricing.tax.display_catalog_price_including_tax',
|
|
7
|
-
false
|
|
8
|
-
),
|
|
9
|
-
displayCheckoutPriceIncludeTax: () => getConfig(
|
|
10
|
-
'pricing.tax.display_checkout_price_including_tax',
|
|
11
|
-
false
|
|
12
|
-
)
|
|
5
|
+
priceIncludingTax: () => getConfig('pricing.tax.price_including_tax', false)
|
|
13
6
|
}
|
|
14
7
|
};
|
|
@@ -68,7 +68,7 @@ export default function TaxSetting({
|
|
|
68
68
|
if (countriesQueryData.fetching || taxClassesQueryData.fetching) {
|
|
69
69
|
return (
|
|
70
70
|
<div className="main-content-inner">
|
|
71
|
-
<div className="grid grid-cols-6 gap-x-
|
|
71
|
+
<div className="grid grid-cols-6 gap-x-8 grid-flow-row ">
|
|
72
72
|
<div className="col-span-2">
|
|
73
73
|
<SettingMenu />
|
|
74
74
|
</div>
|
|
@@ -82,11 +82,11 @@ export default function TaxSetting({
|
|
|
82
82
|
|
|
83
83
|
return (
|
|
84
84
|
<div className="main-content-inner">
|
|
85
|
-
<div className="grid grid-cols-6 gap-x-
|
|
85
|
+
<div className="grid grid-cols-6 gap-x-8 grid-flow-row ">
|
|
86
86
|
<div className="col-span-2">
|
|
87
87
|
<SettingMenu />
|
|
88
88
|
</div>
|
|
89
|
-
<div className="col-span-4 grid grid-cols-1 gap-
|
|
89
|
+
<div className="col-span-4 grid grid-cols-1 gap-8">
|
|
90
90
|
<Card>
|
|
91
91
|
<Card.Session title="Tax">
|
|
92
92
|
<div>
|
|
@@ -107,7 +107,7 @@ export default function TaxSetting({
|
|
|
107
107
|
}
|
|
108
108
|
}}
|
|
109
109
|
>
|
|
110
|
-
<div className="grid grid-cols-2 gap-
|
|
110
|
+
<div className="grid grid-cols-2 gap-8">
|
|
111
111
|
<div>
|
|
112
112
|
<Field
|
|
113
113
|
type="select"
|
|
@@ -17,16 +17,16 @@ class TaxClassCollection {
|
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
taxClassCollectionFilters.forEach((filter) => {
|
|
20
|
-
const check = filters.find(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const check = filters.find(
|
|
21
|
+
(f) => f.key === filter.key && filter.operation.includes(f.operation)
|
|
22
|
+
);
|
|
23
|
+
if (filter.key === '*' || check) {
|
|
24
|
+
filter.callback(
|
|
25
|
+
this.baseQuery,
|
|
26
|
+
check?.operation,
|
|
27
|
+
check?.value,
|
|
28
|
+
currentFilters
|
|
29
|
+
);
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
|