@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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { Card } from '@components/admin/cms/Card';
|
|
2
|
+
import Spinner from '@components/common/Spinner';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useQuery } from 'urql';
|
|
6
|
+
import CheckIcon from '@heroicons/react/outline/CheckIcon';
|
|
7
|
+
import { SimplePageination } from '@components/common/SimplePagination';
|
|
8
|
+
import { Field } from '@components/common/form/Field';
|
|
9
|
+
|
|
10
|
+
const SearchQuery = `
|
|
11
|
+
query Query ($filters: [FilterInput!]) {
|
|
12
|
+
collections(filters: $filters) {
|
|
13
|
+
items {
|
|
14
|
+
collectionId
|
|
15
|
+
uuid
|
|
16
|
+
code
|
|
17
|
+
name
|
|
18
|
+
}
|
|
19
|
+
total
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
function CollectionProductsSetting({
|
|
25
|
+
collectionProductsWidget: { collection, count }
|
|
26
|
+
}) {
|
|
27
|
+
const limit = 10;
|
|
28
|
+
const [inputValue, setInputValue] = React.useState(null);
|
|
29
|
+
const [selectedCollection, setSelectedCollection] =
|
|
30
|
+
React.useState(collection);
|
|
31
|
+
const [page, setPage] = React.useState(1);
|
|
32
|
+
|
|
33
|
+
const [result, reexecuteQuery] = useQuery({
|
|
34
|
+
query: SearchQuery,
|
|
35
|
+
variables: {
|
|
36
|
+
filters: inputValue
|
|
37
|
+
? [
|
|
38
|
+
{ key: 'name', operation: 'like', value: inputValue },
|
|
39
|
+
{ key: 'page', operation: 'eq', value: page.toString() },
|
|
40
|
+
{ key: 'limit', operation: 'eq', value: limit.toString() }
|
|
41
|
+
]
|
|
42
|
+
: [
|
|
43
|
+
{ key: 'limit', operation: 'eq', value: limit.toString() },
|
|
44
|
+
{ key: 'page', operation: 'eq', value: page.toString() }
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
pause: true
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
reexecuteQuery({ requestPolicy: 'network-only' });
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
const timer = setTimeout(() => {
|
|
56
|
+
if (inputValue !== null) {
|
|
57
|
+
reexecuteQuery({ requestPolicy: 'network-only' });
|
|
58
|
+
}
|
|
59
|
+
}, 1500);
|
|
60
|
+
|
|
61
|
+
return () => clearTimeout(timer);
|
|
62
|
+
}, [inputValue]);
|
|
63
|
+
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
reexecuteQuery({ requestPolicy: 'network-only' });
|
|
66
|
+
}, [page]);
|
|
67
|
+
|
|
68
|
+
const { data, fetching, error } = result;
|
|
69
|
+
|
|
70
|
+
if (error) {
|
|
71
|
+
return (
|
|
72
|
+
<p>
|
|
73
|
+
There was an error fetching collections.
|
|
74
|
+
{error.message}
|
|
75
|
+
</p>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div>
|
|
81
|
+
<div className="modal-content">
|
|
82
|
+
<Card.Session title="Select a collection">
|
|
83
|
+
<div>
|
|
84
|
+
<div className="border rounded border-divider mb-8">
|
|
85
|
+
<input
|
|
86
|
+
type="text"
|
|
87
|
+
value={inputValue}
|
|
88
|
+
placeholder="Search collections"
|
|
89
|
+
onChange={(e) => setInputValue(e.target.value)}
|
|
90
|
+
/>
|
|
91
|
+
<Field
|
|
92
|
+
type="hidden"
|
|
93
|
+
name="settings[collection]"
|
|
94
|
+
value={selectedCollection}
|
|
95
|
+
validationRules={['notEmpty']}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
{fetching && (
|
|
99
|
+
<div className="p-3 border border-divider rounded flex justify-center items-center">
|
|
100
|
+
<Spinner width={25} height={25} />
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
{!fetching && data && (
|
|
104
|
+
<div className="divide-y">
|
|
105
|
+
{data.collections.items.length === 0 && (
|
|
106
|
+
<div className="p-3 border border-divider rounded flex justify-center items-center">
|
|
107
|
+
{inputValue ? (
|
|
108
|
+
<p>
|
|
109
|
+
No collections found for query "{inputValue}”
|
|
110
|
+
</p>
|
|
111
|
+
) : (
|
|
112
|
+
<p>You have no collections to display</p>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
{data.collections.items.map((collection) => (
|
|
117
|
+
<div
|
|
118
|
+
key={collection.uuid}
|
|
119
|
+
className="grid grid-cols-8 gap-8 py-4 border-divider items-center"
|
|
120
|
+
>
|
|
121
|
+
<div className="col-span-6">
|
|
122
|
+
<h3>{collection.name}</h3>
|
|
123
|
+
</div>
|
|
124
|
+
<div className="col-span-2 text-right">
|
|
125
|
+
<div className="flex items-center">
|
|
126
|
+
{!(collection.code === selectedCollection) && (
|
|
127
|
+
<button
|
|
128
|
+
type="button"
|
|
129
|
+
className="button secondary"
|
|
130
|
+
onClick={(e) => {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
setSelectedCollection(collection.code);
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
Select
|
|
136
|
+
</button>
|
|
137
|
+
)}
|
|
138
|
+
{collection.code === selectedCollection && (
|
|
139
|
+
<CheckIcon width={20} height={20} />
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
))}
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|
|
148
|
+
</Card.Session>
|
|
149
|
+
<Card.Session title="Number of products to display">
|
|
150
|
+
<div className="flex justify-between gap-8">
|
|
151
|
+
<Field
|
|
152
|
+
type="text"
|
|
153
|
+
name="settings[count]"
|
|
154
|
+
value={count}
|
|
155
|
+
validationRules={['notEmpty']}
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
</Card.Session>
|
|
159
|
+
</div>
|
|
160
|
+
<Card.Session>
|
|
161
|
+
<div className="flex justify-between gap-8">
|
|
162
|
+
<SimplePageination
|
|
163
|
+
total={data?.collections.total}
|
|
164
|
+
count={data?.collections?.items?.length || 0}
|
|
165
|
+
page={page}
|
|
166
|
+
hasNext={limit * page < data?.collections.total}
|
|
167
|
+
setPage={setPage}
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
</Card.Session>
|
|
171
|
+
</div>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
CollectionProductsSetting.propTypes = {
|
|
176
|
+
collectionProductsWidget: PropTypes.shape({
|
|
177
|
+
collection: PropTypes.string,
|
|
178
|
+
count: PropTypes.number
|
|
179
|
+
})
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
CollectionProductsSetting.defaultProps = {
|
|
183
|
+
collectionProductsWidget: {
|
|
184
|
+
collection: '',
|
|
185
|
+
count: 5
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export default CollectionProductsSetting;
|
|
190
|
+
|
|
191
|
+
export const query = `
|
|
192
|
+
query Query($collection: String, $count: Int) {
|
|
193
|
+
collectionProductsWidget(collection: $collection, count: $count) {
|
|
194
|
+
collection
|
|
195
|
+
count
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
`;
|
|
199
|
+
|
|
200
|
+
export const variables = `{
|
|
201
|
+
collection: getWidgetSetting("collection"),
|
|
202
|
+
count: getWidgetSetting("count")
|
|
203
|
+
}`;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Editor from '@components/common/form/fields/Editor';
|
|
4
|
+
import { Field } from '@components/common/form/Field';
|
|
5
|
+
|
|
6
|
+
export default function TextBlockSetting({
|
|
7
|
+
textWidget: { text, className },
|
|
8
|
+
browserApi,
|
|
9
|
+
deleteApi,
|
|
10
|
+
uploadApi,
|
|
11
|
+
folderCreateApi
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<Field
|
|
16
|
+
type="text"
|
|
17
|
+
name="settings[className]"
|
|
18
|
+
label="Custom css classes"
|
|
19
|
+
value={className}
|
|
20
|
+
placeholder="Custom css classes"
|
|
21
|
+
/>
|
|
22
|
+
<Editor
|
|
23
|
+
name="settings[text]"
|
|
24
|
+
label="Content"
|
|
25
|
+
value={text}
|
|
26
|
+
browserApi={browserApi}
|
|
27
|
+
deleteApi={deleteApi}
|
|
28
|
+
uploadApi={uploadApi}
|
|
29
|
+
folderCreateApi={folderCreateApi}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
TextBlockSetting.propTypes = {
|
|
36
|
+
browserApi: PropTypes.string.isRequired,
|
|
37
|
+
deleteApi: PropTypes.string.isRequired,
|
|
38
|
+
uploadApi: PropTypes.string.isRequired,
|
|
39
|
+
folderCreateApi: PropTypes.string.isRequired,
|
|
40
|
+
textWidget: PropTypes.shape({
|
|
41
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
42
|
+
text: PropTypes.array,
|
|
43
|
+
className: PropTypes.string
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
TextBlockSetting.defaultProps = {
|
|
48
|
+
textWidget: {
|
|
49
|
+
text: [],
|
|
50
|
+
className: ''
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const query = `
|
|
55
|
+
query Query($text: String, $className: String) {
|
|
56
|
+
textWidget(text: $text, className: $className) {
|
|
57
|
+
text
|
|
58
|
+
className
|
|
59
|
+
}
|
|
60
|
+
browserApi: url(routeId: "fileBrowser", params: [{key: "0", value: ""}])
|
|
61
|
+
deleteApi: url(routeId: "fileDelete", params: [{key: "0", value: ""}])
|
|
62
|
+
uploadApi: url(routeId: "imageUpload", params: [{key: "0", value: ""}])
|
|
63
|
+
folderCreateApi: url(routeId: "folderCreate")
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const variables = `{
|
|
68
|
+
text: getWidgetSetting("text"),
|
|
69
|
+
className: getWidgetSetting("className")
|
|
70
|
+
}`;
|
|
@@ -5,6 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import { useAppState } from '@components/common/context/app';
|
|
6
6
|
|
|
7
7
|
function Area(props) {
|
|
8
|
+
const context = useAppState();
|
|
8
9
|
const {
|
|
9
10
|
id,
|
|
10
11
|
coreComponents,
|
|
@@ -17,14 +18,30 @@ function Area(props) {
|
|
|
17
18
|
|
|
18
19
|
const areaComponents = (() => {
|
|
19
20
|
const areaCoreComponents = coreComponents || [];
|
|
21
|
+
const widgets = context.widgets || [];
|
|
22
|
+
const wildCardWidgets = components['*'] || {};
|
|
23
|
+
const assignedWidgets = [];
|
|
24
|
+
|
|
25
|
+
widgets.forEach((widget) => {
|
|
26
|
+
const w = wildCardWidgets[widget.type];
|
|
27
|
+
if (widget.areaId.includes(id) && w !== undefined) {
|
|
28
|
+
assignedWidgets.push({
|
|
29
|
+
id: widget.id,
|
|
30
|
+
sortOrder: widget.sortOrder,
|
|
31
|
+
props: widget.props,
|
|
32
|
+
component: w.component
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
20
36
|
const cs =
|
|
21
37
|
components[id] === undefined
|
|
22
|
-
? areaCoreComponents
|
|
23
|
-
: areaCoreComponents
|
|
24
|
-
|
|
38
|
+
? areaCoreComponents.concat(assignedWidgets)
|
|
39
|
+
: areaCoreComponents
|
|
40
|
+
.concat(Object.values(components[id]))
|
|
41
|
+
.concat(assignedWidgets);
|
|
25
42
|
return cs.sort((obj1, obj2) => obj1.sortOrder - obj2.sortOrder);
|
|
26
43
|
})();
|
|
27
|
-
|
|
44
|
+
const { propsMap } = context;
|
|
28
45
|
let WrapperComponent = React.Fragment;
|
|
29
46
|
if (noOuter !== true) {
|
|
30
47
|
if (wrapper !== undefined) {
|
|
@@ -43,17 +60,15 @@ function Area(props) {
|
|
|
43
60
|
areaWrapperProps = { className: className || '' };
|
|
44
61
|
}
|
|
45
62
|
|
|
46
|
-
const context = useAppState();
|
|
47
|
-
|
|
48
63
|
return (
|
|
49
64
|
<WrapperComponent {...areaWrapperProps}>
|
|
50
65
|
{areaComponents.map((w, index) => {
|
|
51
66
|
const C = w.component.default;
|
|
52
67
|
// eslint-disable-next-line no-shadow
|
|
53
68
|
const { id } = w;
|
|
54
|
-
const { propsMap } = context;
|
|
55
69
|
const propsData = context.graphqlResponse;
|
|
56
70
|
const propKeys = propsMap[id] || [];
|
|
71
|
+
|
|
57
72
|
const componentProps = propKeys.reduce((acc, map) => {
|
|
58
73
|
const { origin, alias } = map;
|
|
59
74
|
acc[origin] = propsData[alias];
|
|
@@ -95,7 +110,15 @@ Area.propTypes = {
|
|
|
95
110
|
wrapper: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
|
|
96
111
|
// eslint-disable-next-line react/forbid-prop-types
|
|
97
112
|
wrapperProps: PropTypes.object,
|
|
98
|
-
components: PropTypes.shape({
|
|
113
|
+
components: PropTypes.shape({
|
|
114
|
+
'*': PropTypes.objectOf(
|
|
115
|
+
PropTypes.shape({
|
|
116
|
+
component: PropTypes.shape({
|
|
117
|
+
default: PropTypes.elementType
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
)
|
|
121
|
+
}).isRequired
|
|
99
122
|
};
|
|
100
123
|
|
|
101
124
|
Area.defaultProps = {
|
|
@@ -27,7 +27,7 @@ export default function Badge({
|
|
|
27
27
|
: 'default';
|
|
28
28
|
return (
|
|
29
29
|
<span className={`${badgeVariant} badge`}>
|
|
30
|
-
<span className={`${badgeProgress} progress rounded-
|
|
30
|
+
<span className={`${badgeProgress} progress rounded-full`}>
|
|
31
31
|
{progress === 'partiallycomplete' && <span />}
|
|
32
32
|
</span>
|
|
33
33
|
<span className="self-center title">{title}</span>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import getRowClasses from './form/fields/editor/GetRowClasses';
|
|
4
|
+
import getColumnClasses from './form/fields/editor/GetColumnClasses';
|
|
5
|
+
|
|
6
|
+
function Paragraph({ data }) {
|
|
7
|
+
return <p dangerouslySetInnerHTML={{ __html: data.text }} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
Paragraph.propTypes = {
|
|
11
|
+
data: PropTypes.shape({
|
|
12
|
+
text: PropTypes.string.isRequired
|
|
13
|
+
}).isRequired
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function Header({ data }) {
|
|
17
|
+
const Tag = `h${data.level}`;
|
|
18
|
+
return <Tag>{data.text}</Tag>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Header.propTypes = {
|
|
22
|
+
data: PropTypes.shape({
|
|
23
|
+
level: PropTypes.number.isRequired,
|
|
24
|
+
text: PropTypes.string.isRequired
|
|
25
|
+
}).isRequired
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function List({ data }) {
|
|
29
|
+
return (
|
|
30
|
+
<ul>
|
|
31
|
+
{data.items.map((item, index) => (
|
|
32
|
+
<li key={index}>{item}</li>
|
|
33
|
+
))}
|
|
34
|
+
</ul>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
List.propTypes = {
|
|
39
|
+
data: PropTypes.shape({
|
|
40
|
+
items: PropTypes.arrayOf(PropTypes.string).isRequired
|
|
41
|
+
}).isRequired
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function Quote({ data }) {
|
|
45
|
+
return (
|
|
46
|
+
<blockquote>
|
|
47
|
+
<p>"{data.text}"</p>
|
|
48
|
+
{data.caption && <cite>- {data.caption}</cite>}
|
|
49
|
+
</blockquote>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Quote.propTypes = {
|
|
54
|
+
data: PropTypes.shape({
|
|
55
|
+
text: PropTypes.string.isRequired,
|
|
56
|
+
caption: PropTypes.string
|
|
57
|
+
}).isRequired
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function Image({ data }) {
|
|
61
|
+
const { file, caption, withBorder, withBackground, stretched, url } = data;
|
|
62
|
+
|
|
63
|
+
const imageStyles = {
|
|
64
|
+
border: withBorder ? '1px solid #ccc' : 'none',
|
|
65
|
+
backgroundColor: withBackground ? '#f9f9f9' : 'transparent',
|
|
66
|
+
width: stretched ? '100%' : 'auto',
|
|
67
|
+
display: 'block',
|
|
68
|
+
maxWidth: '100%',
|
|
69
|
+
margin: '0 auto' // Center the image if not stretched
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const imageElement = (
|
|
73
|
+
<img src={file.url} alt={caption || 'Image'} style={imageStyles} />
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div>
|
|
78
|
+
{url ? (
|
|
79
|
+
<a href={url} target="_blank" rel="noopener noreferrer">
|
|
80
|
+
{imageElement}
|
|
81
|
+
</a>
|
|
82
|
+
) : (
|
|
83
|
+
imageElement
|
|
84
|
+
)}
|
|
85
|
+
{caption && (
|
|
86
|
+
<p style={{ textAlign: 'center', marginTop: '10px' }}>{caption}</p>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
Image.propTypes = {
|
|
93
|
+
data: PropTypes.shape({
|
|
94
|
+
file: PropTypes.shape({
|
|
95
|
+
url: PropTypes.string.isRequired
|
|
96
|
+
}).isRequired,
|
|
97
|
+
caption: PropTypes.string,
|
|
98
|
+
withBorder: PropTypes.bool,
|
|
99
|
+
withBackground: PropTypes.bool,
|
|
100
|
+
stretched: PropTypes.bool,
|
|
101
|
+
url: PropTypes.string
|
|
102
|
+
}).isRequired
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
function RawHtml({ data }) {
|
|
106
|
+
return <div dangerouslySetInnerHTML={{ __html: data.html }} />;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
RawHtml.propTypes = {
|
|
110
|
+
data: PropTypes.shape({
|
|
111
|
+
html: PropTypes.string.isRequired
|
|
112
|
+
}).isRequired
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
function RenderEditorJS({ blocks }) {
|
|
116
|
+
return (
|
|
117
|
+
<div className="prose prose-base max-w-none">
|
|
118
|
+
{blocks.map((block, index) => {
|
|
119
|
+
switch (block.type) {
|
|
120
|
+
case 'paragraph':
|
|
121
|
+
return <Paragraph key={index} data={block.data} />;
|
|
122
|
+
case 'header':
|
|
123
|
+
return <Header key={index} data={block.data} />;
|
|
124
|
+
case 'list':
|
|
125
|
+
return <List key={index} data={block.data} />;
|
|
126
|
+
case 'image':
|
|
127
|
+
return <Image key={index} data={block.data} />;
|
|
128
|
+
case 'quote':
|
|
129
|
+
return <Quote key={index} data={block.data} />;
|
|
130
|
+
case 'raw':
|
|
131
|
+
return <RawHtml key={index} data={block.data} />;
|
|
132
|
+
default:
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
})}
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
RenderEditorJS.propTypes = {
|
|
141
|
+
blocks: PropTypes.arrayOf(
|
|
142
|
+
PropTypes.shape({
|
|
143
|
+
type: PropTypes.string.isRequired,
|
|
144
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
145
|
+
data: PropTypes.object.isRequired
|
|
146
|
+
})
|
|
147
|
+
).isRequired
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default function Editor({ rows }) {
|
|
151
|
+
return (
|
|
152
|
+
<div className="editor__html">
|
|
153
|
+
{rows.map((row, index) => {
|
|
154
|
+
const rowClasses = getRowClasses(row.size);
|
|
155
|
+
return (
|
|
156
|
+
<div
|
|
157
|
+
className={`row__container mt-12 grid md:${rowClasses} grid-cols-1 gap-8`}
|
|
158
|
+
key={index}
|
|
159
|
+
>
|
|
160
|
+
{row.columns.map((column, index) => {
|
|
161
|
+
const columnClasses = getColumnClasses(column.size);
|
|
162
|
+
return (
|
|
163
|
+
<div
|
|
164
|
+
className={`column__container md:${columnClasses} col-span-1`}
|
|
165
|
+
key={index}
|
|
166
|
+
>
|
|
167
|
+
{column.data?.blocks && (
|
|
168
|
+
<RenderEditorJS blocks={column.data?.blocks} />
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
})}
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
})}
|
|
176
|
+
</div>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
Editor.propTypes = {
|
|
181
|
+
rows: PropTypes.arrayOf(
|
|
182
|
+
PropTypes.shape({
|
|
183
|
+
size: PropTypes.number.isRequired,
|
|
184
|
+
columns: PropTypes.arrayOf(
|
|
185
|
+
PropTypes.shape({
|
|
186
|
+
size: PropTypes.number.isRequired,
|
|
187
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
188
|
+
data: PropTypes.object
|
|
189
|
+
})
|
|
190
|
+
).isRequired
|
|
191
|
+
})
|
|
192
|
+
).isRequired
|
|
193
|
+
};
|
|
@@ -5,13 +5,13 @@ import ChevronDoubleRightIcon from '@heroicons/react/outline/ChevronRightIcon';
|
|
|
5
5
|
|
|
6
6
|
export function SimplePageination({ total, count, page, hasNext, setPage }) {
|
|
7
7
|
return (
|
|
8
|
-
<div className="simple__pagination flex gap-
|
|
8
|
+
<div className="simple__pagination flex gap-4 items-center">
|
|
9
9
|
<div>
|
|
10
10
|
<span>
|
|
11
11
|
{count} of {total}
|
|
12
12
|
</span>
|
|
13
13
|
</div>
|
|
14
|
-
<div className="flex gap-
|
|
14
|
+
<div className="flex gap-4">
|
|
15
15
|
{page > 1 && (
|
|
16
16
|
<a
|
|
17
17
|
className="hover:text-interactive border rounded p-[5px] border-divider"
|
|
@@ -196,7 +196,7 @@ export function Form(props) {
|
|
|
196
196
|
>
|
|
197
197
|
{children}
|
|
198
198
|
{submitBtn === true && (
|
|
199
|
-
<div className="form-submit-button flex border-t border-divider mt-
|
|
199
|
+
<div className="form-submit-button flex border-t border-divider mt-4 pt-4">
|
|
200
200
|
<Button
|
|
201
201
|
title={btnText || 'Save'}
|
|
202
202
|
onAction={() => {
|
|
@@ -49,7 +49,7 @@ function Checkbox({
|
|
|
49
49
|
/>
|
|
50
50
|
{_isChecked === true && <CheckedIcon />}
|
|
51
51
|
{_isChecked === false && <UnCheckedIcon />}
|
|
52
|
-
<span className="pl-
|
|
52
|
+
<span className="pl-2">{label}</span>
|
|
53
53
|
<input type="hidden" name={name} value={_isChecked ? 1 : 0} />
|
|
54
54
|
</label>
|
|
55
55
|
</div>
|
|
@@ -255,11 +255,11 @@ function FileBrowser({
|
|
|
255
255
|
</a>
|
|
256
256
|
</div>
|
|
257
257
|
<div>
|
|
258
|
-
<div className="grid grid-cols-4 gap-
|
|
258
|
+
<div className="grid grid-cols-4 gap-8">
|
|
259
259
|
<div className="col-span-1">
|
|
260
|
-
<div className="current-path mb-
|
|
260
|
+
<div className="current-path mb-16">
|
|
261
261
|
<div className="flex">
|
|
262
|
-
<div className="pr-
|
|
262
|
+
<div className="pr-4">You are here:</div>
|
|
263
263
|
<div>
|
|
264
264
|
<a
|
|
265
265
|
href="#"
|
|
@@ -285,7 +285,7 @@ function FileBrowser({
|
|
|
285
285
|
))}
|
|
286
286
|
</div>
|
|
287
287
|
</div>
|
|
288
|
-
<ul className="mt-
|
|
288
|
+
<ul className="mt-6 mb-6">
|
|
289
289
|
{folders.map((f, i) => (
|
|
290
290
|
<li
|
|
291
291
|
key={i}
|
|
@@ -307,7 +307,7 @@ function FileBrowser({
|
|
|
307
307
|
/>
|
|
308
308
|
</svg>
|
|
309
309
|
<a
|
|
310
|
-
className="pl-
|
|
310
|
+
className="pl-2 hover:underline"
|
|
311
311
|
href="#"
|
|
312
312
|
onClick={(e) => onSelectFolder(e, f)}
|
|
313
313
|
>
|
|
@@ -327,7 +327,7 @@ function FileBrowser({
|
|
|
327
327
|
placeholder="New folder"
|
|
328
328
|
ref={newFolderRefInput}
|
|
329
329
|
/>
|
|
330
|
-
<div className="mt-
|
|
330
|
+
<div className="mt-4">
|
|
331
331
|
<a
|
|
332
332
|
href="#"
|
|
333
333
|
onClick={(e) =>
|
|
@@ -341,8 +341,8 @@ function FileBrowser({
|
|
|
341
341
|
</div>
|
|
342
342
|
</div>
|
|
343
343
|
<div className="col-span-3">
|
|
344
|
-
<div className="error text-critical mb-
|
|
345
|
-
<div className="tool-bar grid grid-cols-3 gap-
|
|
344
|
+
<div className="error text-critical mb-8">{error}</div>
|
|
345
|
+
<div className="tool-bar grid grid-cols-3 gap-4 mb-8">
|
|
346
346
|
<Button
|
|
347
347
|
variant="critical"
|
|
348
348
|
outline
|
|
@@ -373,7 +373,7 @@ function FileBrowser({
|
|
|
373
373
|
</label>
|
|
374
374
|
</div>
|
|
375
375
|
{files.length === 0 && <div>There is no file to display.</div>}
|
|
376
|
-
<div className="grid grid-cols-9 gap-
|
|
376
|
+
<div className="grid grid-cols-9 gap-4">
|
|
377
377
|
{files.map((f) => (
|
|
378
378
|
<File file={f} select={onSelectFile} />
|
|
379
379
|
))}
|
|
@@ -422,8 +422,8 @@ export default function CkeditorField({
|
|
|
422
422
|
|
|
423
423
|
return (
|
|
424
424
|
<div className="ckeditor">
|
|
425
|
-
<label htmlFor="description mt-
|
|
426
|
-
<div className="image-icon mt-
|
|
425
|
+
<label htmlFor="description mt-4">{label}</label>
|
|
426
|
+
<div className="image-icon mt-4">
|
|
427
427
|
<a
|
|
428
428
|
href="#"
|
|
429
429
|
onClick={(e) => {
|