@evershop/evershop 1.1.0 → 1.2.1
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 +20 -2
- 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 +193 -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 +33 -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 +34 -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 +16 -6
- package/src/lib/webpack/util/keyGenerator.js +9 -0
- package/src/lib/webpack/util/parseGraphql.js +30 -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 +25 -1
- 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 +8 -3
- 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 +15 -4
- 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 +7 -3
- package/src/modules/catalog/pages/frontStore/productView/Variants.jsx +6 -6
- 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 -3
- 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 +20 -12
- package/src/modules/checkout/pages/frontStore/cart/Summary.jsx +34 -23
- 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 +92 -0
- package/src/modules/checkout/tests/unit/lineTotalWithDiscount.test.js +103 -0
- package/src/modules/checkout/tests/unit/productPrice.test.js +69 -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 +68 -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 +241 -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
|
@@ -10,7 +10,7 @@ export default function Filter({ title, options, selectedOption }) {
|
|
|
10
10
|
<button
|
|
11
11
|
type="button"
|
|
12
12
|
onClick={() => setShow(!show)}
|
|
13
|
-
className="flex gap-
|
|
13
|
+
className="flex gap-4 justify-center items-center"
|
|
14
14
|
>
|
|
15
15
|
<span>{selectedOption || title}</span>
|
|
16
16
|
{!show && (
|
|
@@ -118,7 +118,7 @@ function Alert({ children }) {
|
|
|
118
118
|
{(alert.primaryAction !== undefined ||
|
|
119
119
|
alert.secondaryAction !== undefined) && (
|
|
120
120
|
<Card.Session>
|
|
121
|
-
<div className="flex justify-end space-x-
|
|
121
|
+
<div className="flex justify-end space-x-4">
|
|
122
122
|
{alert.primaryAction && (
|
|
123
123
|
<Button {...alert.primaryAction} />
|
|
124
124
|
)}
|
|
@@ -17,7 +17,7 @@ function Modal({ modal, title, children, primaryAction }) {
|
|
|
17
17
|
<Card title={title}>
|
|
18
18
|
<div className="modal-content">{children}</div>
|
|
19
19
|
<Card.Session>
|
|
20
|
-
<div className="flex justify-end gap-
|
|
20
|
+
<div className="flex justify-end gap-8">
|
|
21
21
|
<Button
|
|
22
22
|
title="Close"
|
|
23
23
|
variant="secondary"
|
|
@@ -66,7 +66,7 @@ export function AttributeFilter({
|
|
|
66
66
|
return (
|
|
67
67
|
<>
|
|
68
68
|
{availableAttributes.map((a) => (
|
|
69
|
-
<div key={a.attributeCode} className="attribute-filter mt-
|
|
69
|
+
<div key={a.attributeCode} className="attribute-filter mt-8">
|
|
70
70
|
<div className="filter-item-title">
|
|
71
71
|
<span className="font-medium">{a.attributeName}</span>
|
|
72
72
|
</div>
|
|
@@ -79,7 +79,7 @@ export function AttributeFilter({
|
|
|
79
79
|
);
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
|
-
<li key={o.optionId} className="mt-
|
|
82
|
+
<li key={o.optionId} className="mt-2 mr-2">
|
|
83
83
|
<a
|
|
84
84
|
href="#"
|
|
85
85
|
className="flex justify-start items-center"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import './CategoryFilter.scss';
|
|
3
4
|
import { _ } from '@evershop/evershop/src/lib/locale/translate';
|
|
4
5
|
|
|
5
6
|
export function CategoryFilter({ currentFilters, categories, updateFilter }) {
|
|
@@ -61,7 +62,7 @@ export function CategoryFilter({ currentFilters, categories, updateFilter }) {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
return (
|
|
64
|
-
<div className="category-filter mt-
|
|
65
|
+
<div className="category-filter mt-8">
|
|
65
66
|
<div className="filter-item-title">
|
|
66
67
|
<span className="font-medium">{_('Category')}</span>
|
|
67
68
|
</div>
|
|
@@ -74,7 +75,7 @@ export function CategoryFilter({ currentFilters, categories, updateFilter }) {
|
|
|
74
75
|
);
|
|
75
76
|
|
|
76
77
|
return (
|
|
77
|
-
<li key={c.uuid} className="mt-
|
|
78
|
+
<li key={c.uuid} className="mt-2 mr-2">
|
|
78
79
|
<a
|
|
79
80
|
href="#"
|
|
80
81
|
className="flex justify-start items-center"
|
|
@@ -19,16 +19,16 @@ export default function ProductList({ products = [], countPerRow = 3 }) {
|
|
|
19
19
|
let className;
|
|
20
20
|
switch (countPerRow) {
|
|
21
21
|
case 3:
|
|
22
|
-
className = 'grid grid-cols-2 md:grid-cols-3 gap-
|
|
22
|
+
className = 'grid grid-cols-2 md:grid-cols-3 gap-8';
|
|
23
23
|
break;
|
|
24
24
|
case 4:
|
|
25
|
-
className = 'grid grid-cols-2 md:grid-cols-4 gap-
|
|
25
|
+
className = 'grid grid-cols-2 md:grid-cols-4 gap-8';
|
|
26
26
|
break;
|
|
27
27
|
case 5:
|
|
28
|
-
className = 'grid grid-cols-2 md:grid-cols-5 gap-
|
|
28
|
+
className = 'grid grid-cols-2 md:grid-cols-5 gap-8';
|
|
29
29
|
break;
|
|
30
30
|
default:
|
|
31
|
-
className = 'grid grid-cols-2 md:grid-cols-3 gap-
|
|
31
|
+
className = 'grid grid-cols-2 md:grid-cols-3 gap-8';
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return (
|
|
@@ -67,7 +67,7 @@ export function Pagination({ total, limit, currentPage }) {
|
|
|
67
67
|
|
|
68
68
|
return (
|
|
69
69
|
<div className="products-pagination">
|
|
70
|
-
<ul className="pagination flex justify-center space-x-
|
|
70
|
+
<ul className="pagination flex justify-center space-x-4">
|
|
71
71
|
{currentPage > 1 && (
|
|
72
72
|
<li className="page-item prev self-center">
|
|
73
73
|
<button
|
|
@@ -58,8 +58,8 @@ export default function Sorting() {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
|
-
<div className="product-sorting mb-
|
|
62
|
-
<div className="product-sorting-inner flex justify-end items-center space-x-
|
|
61
|
+
<div className="product-sorting mb-4">
|
|
62
|
+
<div className="product-sorting-inner flex justify-end items-center space-x-2">
|
|
63
63
|
<div>
|
|
64
64
|
<span>{_('Sort By')}:</span>
|
|
65
65
|
</div>
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
function Name({ name, url }) {
|
|
5
5
|
return (
|
|
6
|
-
<div className="product-name product-list-name mt-
|
|
6
|
+
<div className="product-name product-list-name mt-4 mb-1">
|
|
7
7
|
<a href={url} className="font-bold hover:underline h5">
|
|
8
8
|
<span>{name}</span>
|
|
9
9
|
</a>
|
|
@@ -16,14 +16,14 @@ export function Empty() {
|
|
|
16
16
|
<div className="text-center">
|
|
17
17
|
<h2>{_('Shopping cart')}</h2>
|
|
18
18
|
</div>
|
|
19
|
-
<div className="mt-
|
|
19
|
+
<div className="mt-8 text-center">
|
|
20
20
|
<span>{_('Your cart is empty!')}</span>
|
|
21
21
|
</div>
|
|
22
|
-
<div className="flex justify-center mt-
|
|
22
|
+
<div className="flex justify-center mt-8">
|
|
23
23
|
<Button
|
|
24
24
|
url="/"
|
|
25
25
|
title={
|
|
26
|
-
<span className="flex space-x-
|
|
26
|
+
<span className="flex space-x-4">
|
|
27
27
|
<span className="self-center">{_('CONTINUE SHOPPING')}</span>{' '}
|
|
28
28
|
<svg
|
|
29
29
|
className="self-center"
|
|
@@ -11,7 +11,7 @@ export function ItemOptions({ options = [] }) {
|
|
|
11
11
|
const language = get(useAppState(), 'language', 'en');
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<div className="cart-item-options mt-
|
|
14
|
+
<div className="cart-item-options mt-2">
|
|
15
15
|
<ul className="list-basic">
|
|
16
16
|
{options.map((o, i) => (
|
|
17
17
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -7,7 +7,7 @@ export function ItemVariantOptions({ options = [] }) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
|
-
<div className="cart-item-variant-options mt-
|
|
10
|
+
<div className="cart-item-variant-options mt-2">
|
|
11
11
|
<ul>
|
|
12
12
|
{options.map((o, i) => (
|
|
13
13
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -7,10 +7,10 @@ import ProductNoThumbnail from '@components/common/ProductNoThumbnail';
|
|
|
7
7
|
import { ItemOptions } from './ItemOptions';
|
|
8
8
|
import { ItemVariantOptions } from './ItemVariantOptions';
|
|
9
9
|
import './Items.scss';
|
|
10
|
+
import Quantity from './Quantity';
|
|
10
11
|
|
|
11
|
-
function Items({ items, setting: {
|
|
12
|
+
function Items({ items, setting: { priceIncludingTax } }) {
|
|
12
13
|
const AppContextDispatch = useAppDispatch();
|
|
13
|
-
|
|
14
14
|
const removeItem = async (item) => {
|
|
15
15
|
const response = await fetch(item.removeApi, {
|
|
16
16
|
method: 'DELETE',
|
|
@@ -50,11 +50,10 @@ function Items({ items, setting: { displayCheckoutPriceIncludeTax } }) {
|
|
|
50
50
|
</tr>
|
|
51
51
|
</thead>
|
|
52
52
|
<tbody>
|
|
53
|
-
{items.map((item
|
|
54
|
-
|
|
55
|
-
<tr key={index}>
|
|
53
|
+
{items.map((item) => (
|
|
54
|
+
<tr key={item.cartItemId}>
|
|
56
55
|
<td>
|
|
57
|
-
<div className="flex justify-start space-x-
|
|
56
|
+
<div className="flex justify-start space-x-4 product-info">
|
|
58
57
|
<div className="product-image flex justify-center items-center">
|
|
59
58
|
{item.thumbnail && (
|
|
60
59
|
<img
|
|
@@ -85,7 +84,7 @@ function Items({ items, setting: { displayCheckoutPriceIncludeTax } }) {
|
|
|
85
84
|
<ItemVariantOptions
|
|
86
85
|
options={JSON.parse(item.variantOptions || '[]')}
|
|
87
86
|
/>
|
|
88
|
-
<div className="mt-
|
|
87
|
+
<div className="mt-2">
|
|
89
88
|
<a
|
|
90
89
|
onClick={async (e) => {
|
|
91
90
|
e.preventDefault();
|
|
@@ -104,12 +103,12 @@ function Items({ items, setting: { displayCheckoutPriceIncludeTax } }) {
|
|
|
104
103
|
{item.finalPrice.value < item.productPrice.value && (
|
|
105
104
|
<div>
|
|
106
105
|
<span className="regular-price">
|
|
107
|
-
{
|
|
106
|
+
{priceIncludingTax
|
|
108
107
|
? item.productPriceInclTax.text
|
|
109
108
|
: item.productPrice.text}
|
|
110
109
|
</span>{' '}
|
|
111
110
|
<span className="sale-price">
|
|
112
|
-
{
|
|
111
|
+
{priceIncludingTax
|
|
113
112
|
? item.finalPriceInclTax.text
|
|
114
113
|
: item.finalPrice.text}
|
|
115
114
|
</span>
|
|
@@ -118,25 +117,24 @@ function Items({ items, setting: { displayCheckoutPriceIncludeTax } }) {
|
|
|
118
117
|
{item.finalPrice.value >= item.productPrice.value && (
|
|
119
118
|
<div>
|
|
120
119
|
<span className="sale-price">
|
|
121
|
-
{
|
|
120
|
+
{priceIncludingTax
|
|
122
121
|
? item.finalPriceInclTax.text
|
|
123
122
|
: item.finalPrice.text}
|
|
124
123
|
</span>
|
|
125
124
|
</div>
|
|
126
125
|
)}
|
|
127
|
-
<div className="md:hidden mt-
|
|
128
|
-
<
|
|
129
|
-
<span>{item.qty}</span>
|
|
126
|
+
<div className="md:hidden mt-2 flex justify-end">
|
|
127
|
+
<Quantity qty={item.qty} api={item.updateQtyApi} />
|
|
130
128
|
</div>
|
|
131
129
|
</td>
|
|
132
130
|
<td className="hidden md:table-cell">
|
|
133
|
-
<
|
|
131
|
+
<Quantity qty={item.qty} api={item.updateQtyApi} />
|
|
134
132
|
</td>
|
|
135
133
|
<td className="hidden md:table-cell">
|
|
136
134
|
<span>
|
|
137
|
-
{
|
|
138
|
-
? item.
|
|
139
|
-
: item.
|
|
135
|
+
{priceIncludingTax
|
|
136
|
+
? item.lineTotalInclTax.text
|
|
137
|
+
: item.lineTotal.text}
|
|
140
138
|
</span>
|
|
141
139
|
</td>
|
|
142
140
|
</tr>
|
|
@@ -172,19 +170,20 @@ Items.propTypes = {
|
|
|
172
170
|
text: PropTypes.string
|
|
173
171
|
}),
|
|
174
172
|
qty: PropTypes.number,
|
|
175
|
-
|
|
173
|
+
lineTotalInclTax: PropTypes.shape({
|
|
176
174
|
value: PropTypes.number,
|
|
177
175
|
text: PropTypes.string
|
|
178
176
|
}),
|
|
179
|
-
|
|
177
|
+
lineTotal: PropTypes.shape({
|
|
180
178
|
value: PropTypes.number,
|
|
181
179
|
text: PropTypes.string
|
|
182
180
|
}),
|
|
183
|
-
removeApi: PropTypes.string
|
|
181
|
+
removeApi: PropTypes.string,
|
|
182
|
+
updateQtyApi: PropTypes.string
|
|
184
183
|
})
|
|
185
184
|
).isRequired,
|
|
186
185
|
setting: PropTypes.shape({
|
|
187
|
-
|
|
186
|
+
priceIncludingTax: PropTypes.bool
|
|
188
187
|
}).isRequired
|
|
189
188
|
};
|
|
190
189
|
|
|
@@ -47,4 +47,51 @@
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
.qty-box {
|
|
51
|
+
max-width: 130px;
|
|
52
|
+
button {
|
|
53
|
+
.spinner {
|
|
54
|
+
animation: rotator 1.4s linear infinite;
|
|
55
|
+
.path {
|
|
56
|
+
stroke-dasharray: 280;
|
|
57
|
+
stroke-dashoffset: 0;
|
|
58
|
+
transform-origin: center;
|
|
59
|
+
stroke: var(--primary);
|
|
60
|
+
animation: dash 1.4s ease-in-out infinite;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
svg {
|
|
64
|
+
width: 1.1rem;
|
|
65
|
+
height: 1.1rem;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
input {
|
|
69
|
+
text-align: center;
|
|
70
|
+
padding-left: 10px;
|
|
71
|
+
padding-right: 10px;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
50
74
|
}
|
|
75
|
+
|
|
76
|
+
@keyframes rotator {
|
|
77
|
+
0% {
|
|
78
|
+
transform: rotate(0deg);
|
|
79
|
+
}
|
|
80
|
+
100% {
|
|
81
|
+
transform: rotate(270deg);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@keyframes dash {
|
|
86
|
+
0% {
|
|
87
|
+
stroke-dashoffset: 280;
|
|
88
|
+
}
|
|
89
|
+
50% {
|
|
90
|
+
stroke-dashoffset: 70;
|
|
91
|
+
transform: rotate(135deg);
|
|
92
|
+
}
|
|
93
|
+
100% {
|
|
94
|
+
stroke-dashoffset: 280;
|
|
95
|
+
transform: rotate(450deg);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { useAppDispatch } from '@components/common/context/app';
|
|
4
|
+
import { toast } from 'react-toastify';
|
|
5
|
+
|
|
6
|
+
export default function Quantity({ qty, api }) {
|
|
7
|
+
const AppContextDispatch = useAppDispatch();
|
|
8
|
+
const [quantity, setQuantity] = React.useState(qty);
|
|
9
|
+
const previousQuantity = React.useRef(qty);
|
|
10
|
+
const [debounceTimer, setDebounceTimer] = React.useState(null);
|
|
11
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
12
|
+
|
|
13
|
+
const updateQuantity = (newQuantity) => {
|
|
14
|
+
setQuantity(newQuantity);
|
|
15
|
+
if (debounceTimer) {
|
|
16
|
+
clearTimeout(debounceTimer);
|
|
17
|
+
}
|
|
18
|
+
const timer = setTimeout(() => {
|
|
19
|
+
callUpdateAPI(newQuantity);
|
|
20
|
+
}, 500);
|
|
21
|
+
setDebounceTimer(timer);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const callUpdateAPI = async (qty) => {
|
|
25
|
+
setIsLoading(true);
|
|
26
|
+
try {
|
|
27
|
+
const response = await fetch(api, {
|
|
28
|
+
method: 'PATCH',
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json'
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify({
|
|
33
|
+
qty: Math.abs(previousQuantity.current - qty),
|
|
34
|
+
action: qty > quantity ? 'increase' : 'decrease'
|
|
35
|
+
}),
|
|
36
|
+
credentials: 'same-origin'
|
|
37
|
+
});
|
|
38
|
+
const json = await response.json();
|
|
39
|
+
if (!json.error) {
|
|
40
|
+
const url = new URL(window.location.href);
|
|
41
|
+
url.searchParams.set('ajax', true);
|
|
42
|
+
await AppContextDispatch.fetchPageData(url);
|
|
43
|
+
previousQuantity.current = qty;
|
|
44
|
+
} else {
|
|
45
|
+
setQuantity(previousQuantity.current);
|
|
46
|
+
toast.error(json.error.message);
|
|
47
|
+
}
|
|
48
|
+
} catch (error) {
|
|
49
|
+
setQuantity(previousQuantity.current);
|
|
50
|
+
toast.error(error.message);
|
|
51
|
+
} finally {
|
|
52
|
+
setIsLoading(false);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className="qty-box grid grid-cols-3 border border-[#ccc]">
|
|
58
|
+
<button
|
|
59
|
+
className="flex justify-center items-center"
|
|
60
|
+
onClick={() => updateQuantity(Math.max(quantity - 1, 0))}
|
|
61
|
+
disabled={isLoading}
|
|
62
|
+
type="button"
|
|
63
|
+
>
|
|
64
|
+
{isLoading && (
|
|
65
|
+
<svg
|
|
66
|
+
aria-hidden="true"
|
|
67
|
+
focusable="false"
|
|
68
|
+
role="presentation"
|
|
69
|
+
className="spinner"
|
|
70
|
+
viewBox="0 0 66 66"
|
|
71
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
72
|
+
>
|
|
73
|
+
<circle
|
|
74
|
+
className="path"
|
|
75
|
+
fill="none"
|
|
76
|
+
strokeWidth="6"
|
|
77
|
+
cx="33"
|
|
78
|
+
cy="33"
|
|
79
|
+
r="30"
|
|
80
|
+
/>
|
|
81
|
+
</svg>
|
|
82
|
+
)}
|
|
83
|
+
{!isLoading && (
|
|
84
|
+
<svg
|
|
85
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
86
|
+
aria-hidden="true"
|
|
87
|
+
focusable="false"
|
|
88
|
+
role="presentation"
|
|
89
|
+
className="icon icon-minus"
|
|
90
|
+
fill="none"
|
|
91
|
+
viewBox="0 0 10 2"
|
|
92
|
+
>
|
|
93
|
+
<path
|
|
94
|
+
fillRule="evenodd"
|
|
95
|
+
clipRule="evenodd"
|
|
96
|
+
d="M.5 1C.5.7.7.5 1 .5h8a.5.5 0 110 1H1A.5.5 0 01.5 1z"
|
|
97
|
+
fill="currentColor"
|
|
98
|
+
/>
|
|
99
|
+
</svg>
|
|
100
|
+
)}
|
|
101
|
+
</button>
|
|
102
|
+
<input type="text" value={quantity} readOnly />
|
|
103
|
+
<button
|
|
104
|
+
className="flex justify-center items-center"
|
|
105
|
+
onClick={() => updateQuantity(quantity + 1)}
|
|
106
|
+
disabled={isLoading}
|
|
107
|
+
type="button"
|
|
108
|
+
>
|
|
109
|
+
{isLoading && (
|
|
110
|
+
<svg
|
|
111
|
+
aria-hidden="true"
|
|
112
|
+
focusable="false"
|
|
113
|
+
role="presentation"
|
|
114
|
+
className="spinner"
|
|
115
|
+
viewBox="0 0 66 66"
|
|
116
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
117
|
+
>
|
|
118
|
+
<circle
|
|
119
|
+
className="path"
|
|
120
|
+
fill="none"
|
|
121
|
+
strokeWidth="6"
|
|
122
|
+
cx="33"
|
|
123
|
+
cy="33"
|
|
124
|
+
r="30"
|
|
125
|
+
/>
|
|
126
|
+
</svg>
|
|
127
|
+
)}
|
|
128
|
+
{!isLoading && (
|
|
129
|
+
<svg
|
|
130
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
131
|
+
aria-hidden="true"
|
|
132
|
+
focusable="false"
|
|
133
|
+
role="presentation"
|
|
134
|
+
className="icon icon-plus"
|
|
135
|
+
fill="none"
|
|
136
|
+
viewBox="0 0 10 10"
|
|
137
|
+
>
|
|
138
|
+
<path
|
|
139
|
+
fillRule="evenodd"
|
|
140
|
+
clipRule="evenodd"
|
|
141
|
+
d="M1 4.51a.5.5 0 000 1h3.5l.01 3.5a.5.5 0 001-.01V5.5l3.5-.01a.5.5 0 00-.01-1H5.5L5.49.99a.5.5 0 00-1 .01v3.5l-3.5.01H1z"
|
|
142
|
+
fill="currentColor"
|
|
143
|
+
/>
|
|
144
|
+
</svg>
|
|
145
|
+
)}
|
|
146
|
+
</button>
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
Quantity.propTypes = {
|
|
152
|
+
qty: PropTypes.number.isRequired,
|
|
153
|
+
api: PropTypes.string.isRequired
|
|
154
|
+
};
|
|
@@ -87,7 +87,7 @@ export function StepContent({
|
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
if (error) {
|
|
90
|
-
return <div className="p-
|
|
90
|
+
return <div className="p-8 text-critical">{error.message}</div>;
|
|
91
91
|
}
|
|
92
92
|
return (
|
|
93
93
|
<div>
|
|
@@ -100,7 +100,7 @@ export function StepContent({
|
|
|
100
100
|
submitBtn={false}
|
|
101
101
|
isJSON
|
|
102
102
|
>
|
|
103
|
-
<h4 className="mb-
|
|
103
|
+
<h4 className="mb-4 mt-12">{_('Billing Address')}</h4>
|
|
104
104
|
<BillingAddress
|
|
105
105
|
useShippingAddress={useShippingAddress}
|
|
106
106
|
setUseShippingAddress={setUseShippingAddress}
|
|
@@ -123,16 +123,16 @@ export function StepContent({
|
|
|
123
123
|
</div>
|
|
124
124
|
)}
|
|
125
125
|
|
|
126
|
-
<h4 className="mb-
|
|
126
|
+
<h4 className="mb-4 mt-12">{_('Payment Method')}</h4>
|
|
127
127
|
{paymentMethods && paymentMethods.length > 0 && (
|
|
128
128
|
<>
|
|
129
|
-
<div className="divide-y border rounded border-divider px-
|
|
129
|
+
<div className="divide-y border rounded border-divider px-8 mb-8">
|
|
130
130
|
{paymentMethods.map((method) => (
|
|
131
131
|
<div
|
|
132
132
|
key={method.code}
|
|
133
133
|
className="border-divider payment-method-list"
|
|
134
134
|
>
|
|
135
|
-
<div className="py-
|
|
135
|
+
<div className="py-8">
|
|
136
136
|
<Area id={`checkoutPaymentMethod${method.code}`} />
|
|
137
137
|
</div>
|
|
138
138
|
</div>
|
|
@@ -12,27 +12,25 @@ function CartSummary({
|
|
|
12
12
|
subTotalInclTax,
|
|
13
13
|
grandTotal,
|
|
14
14
|
discountAmount,
|
|
15
|
-
|
|
15
|
+
totalTaxAmount,
|
|
16
16
|
shippingMethodName,
|
|
17
17
|
shippingFeeInclTax,
|
|
18
18
|
coupon,
|
|
19
|
-
|
|
19
|
+
priceIncludingTax
|
|
20
20
|
}) {
|
|
21
21
|
return (
|
|
22
22
|
<div className="checkout-summary-block">
|
|
23
23
|
<Subtotal
|
|
24
24
|
count={totalQty}
|
|
25
|
-
total={
|
|
26
|
-
displayCheckoutPriceIncludeTax ? subTotalInclTax.text : subTotal.text
|
|
27
|
-
}
|
|
25
|
+
total={priceIncludingTax ? subTotalInclTax.text : subTotal.text}
|
|
28
26
|
/>
|
|
29
27
|
<Shipping method={shippingMethodName} cost={shippingFeeInclTax.text} />
|
|
30
|
-
{!
|
|
28
|
+
{!priceIncludingTax && <Tax amount={totalTaxAmount.text} />}
|
|
31
29
|
<Discount code={coupon} discount={discountAmount.text} />
|
|
32
30
|
<Total
|
|
33
|
-
|
|
31
|
+
totalTaxAmount={totalTaxAmount.text}
|
|
34
32
|
total={grandTotal.text}
|
|
35
|
-
|
|
33
|
+
priceIncludingTax={priceIncludingTax}
|
|
36
34
|
/>
|
|
37
35
|
</div>
|
|
38
36
|
);
|
|
@@ -56,11 +54,11 @@ CartSummary.propTypes = {
|
|
|
56
54
|
subTotalInclTax: PropTypes.shape({
|
|
57
55
|
text: PropTypes.string.isRequired
|
|
58
56
|
}),
|
|
59
|
-
|
|
57
|
+
totalTaxAmount: PropTypes.shape({
|
|
60
58
|
text: PropTypes.string.isRequired
|
|
61
59
|
}),
|
|
62
60
|
totalQty: PropTypes.string,
|
|
63
|
-
|
|
61
|
+
priceIncludingTax: PropTypes.bool
|
|
64
62
|
};
|
|
65
63
|
|
|
66
64
|
CartSummary.defaultProps = {
|
|
@@ -81,11 +79,11 @@ CartSummary.defaultProps = {
|
|
|
81
79
|
subTotalInclTax: {
|
|
82
80
|
text: ''
|
|
83
81
|
},
|
|
84
|
-
|
|
82
|
+
totalTaxAmount: {
|
|
85
83
|
text: ''
|
|
86
84
|
},
|
|
87
85
|
totalQty: '',
|
|
88
|
-
|
|
86
|
+
priceIncludingTax: false
|
|
89
87
|
};
|
|
90
88
|
|
|
91
89
|
export { CartSummary };
|
|
@@ -9,7 +9,7 @@ function ItemVariantOptions({ options = [] }) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<div className="cart-item-variant-options mt-
|
|
12
|
+
<div className="cart-item-variant-options mt-2">
|
|
13
13
|
<ul>
|
|
14
14
|
{options.map((o, i) => (
|
|
15
15
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -36,7 +36,7 @@ ItemVariantOptions.defaultProps = {
|
|
|
36
36
|
options: []
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
function Items({ items,
|
|
39
|
+
function Items({ items, priceIncludingTax }) {
|
|
40
40
|
return (
|
|
41
41
|
<div id="summary-items">
|
|
42
42
|
<table className="listing items-table">
|
|
@@ -69,9 +69,9 @@ function Items({ items, displayCheckoutPriceIncludeTax }) {
|
|
|
69
69
|
</td>
|
|
70
70
|
<td>
|
|
71
71
|
<span>
|
|
72
|
-
{
|
|
73
|
-
? item.
|
|
74
|
-
: item.
|
|
72
|
+
{priceIncludingTax
|
|
73
|
+
? item.lineTotalInclTax.text
|
|
74
|
+
: item.lineTotal.text}
|
|
75
75
|
</span>
|
|
76
76
|
</td>
|
|
77
77
|
</tr>
|
|
@@ -89,20 +89,20 @@ Items.propTypes = {
|
|
|
89
89
|
productName: PropTypes.string,
|
|
90
90
|
variantOptions: PropTypes.string,
|
|
91
91
|
qty: PropTypes.number,
|
|
92
|
-
|
|
92
|
+
lineTotalInclTax: PropTypes.shape({
|
|
93
93
|
text: PropTypes.string
|
|
94
94
|
}),
|
|
95
|
-
|
|
95
|
+
lineTotal: PropTypes.shape({
|
|
96
96
|
text: PropTypes.string
|
|
97
97
|
})
|
|
98
98
|
})
|
|
99
99
|
),
|
|
100
|
-
|
|
100
|
+
priceIncludingTax: PropTypes.bool
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
Items.defaultProps = {
|
|
104
104
|
items: [],
|
|
105
|
-
|
|
105
|
+
priceIncludingTax: false
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
export { Items };
|