@evershop/evershop 2.1.1 → 2.1.2
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/dist/components/common/Area.js +199 -12
- package/dist/components/common/Area.js.map +1 -1
- package/dist/components/common/Editor.js +2 -1
- package/dist/components/common/Editor.js.map +1 -1
- package/dist/components/common/ExtendableTable.js +1 -1
- package/dist/components/common/ExtendableTable.js.map +1 -1
- package/dist/components/common/StaticImage.js +2 -2
- package/dist/components/common/StaticImage.js.map +1 -1
- package/dist/components/common/form/Editor.scss +3 -1
- package/dist/components/common/form/ReactSelectCreatableField.d.ts +1 -1
- package/dist/components/common/form/SelectField.js +3 -3
- package/dist/components/common/form/SelectField.js.map +1 -1
- package/dist/components/common/ui/Badge.d.ts +1 -1
- package/dist/components/common/ui/Item.js +1 -1
- package/dist/components/common/ui/Item.js.map +1 -1
- package/dist/components/common/ui/Sonner.d.ts +5 -0
- package/dist/components/common/ui/Sonner.js +24 -0
- package/dist/components/common/ui/Sonner.js.map +1 -0
- package/dist/components/common/ui/Tabs.d.ts +1 -1
- package/dist/components/frontStore/Footer.js +3 -1
- package/dist/components/frontStore/Footer.js.map +1 -1
- package/dist/components/frontStore/Pagination.js +1 -1
- package/dist/components/frontStore/Pagination.js.map +1 -1
- package/dist/components/frontStore/cart/CartContext.d.ts +2 -2
- package/dist/components/frontStore/cart/DefaultCartItemList.js +5 -5
- package/dist/components/frontStore/cart/DefaultCartItemList.js.map +1 -1
- package/dist/components/frontStore/cart/DefaultMiniCartDropdown.js +2 -19
- package/dist/components/frontStore/cart/DefaultMiniCartDropdown.js.map +1 -1
- package/dist/components/frontStore/cart/DefaultMinicartDropdownSummary.d.ts +7 -0
- package/dist/components/frontStore/cart/DefaultMinicartDropdownSummary.js +29 -0
- package/dist/components/frontStore/cart/DefaultMinicartDropdownSummary.js.map +1 -0
- package/dist/components/frontStore/catalog/CategoryInfo.js +2 -2
- package/dist/components/frontStore/catalog/CategoryInfo.js.map +1 -1
- package/dist/components/frontStore/catalog/DefaultCategoryFilterRender.js +1 -1
- package/dist/components/frontStore/catalog/DefaultCategoryFilterRender.js.map +1 -1
- package/dist/components/frontStore/catalog/DefaultProductFilterRender.js +3 -3
- package/dist/components/frontStore/catalog/DefaultProductFilterRender.js.map +1 -1
- package/dist/components/frontStore/catalog/ProductSorting.d.ts +2 -1
- package/dist/components/frontStore/catalog/ProductSorting.js +7 -3
- package/dist/components/frontStore/catalog/ProductSorting.js.map +1 -1
- package/dist/components/frontStore/catalog/SearchBox.d.ts +1 -1
- package/dist/components/frontStore/checkout/CheckoutButton.js +19 -12
- package/dist/components/frontStore/checkout/CheckoutButton.js.map +1 -1
- package/dist/components/frontStore/checkout/CheckoutContext.d.ts +10 -9
- package/dist/components/frontStore/checkout/CheckoutContext.js +39 -25
- package/dist/components/frontStore/checkout/CheckoutContext.js.map +1 -1
- package/dist/components/frontStore/checkout/ContactInformation.js +12 -8
- package/dist/components/frontStore/checkout/ContactInformation.js.map +1 -1
- package/dist/components/frontStore/checkout/Payment.js +19 -12
- package/dist/components/frontStore/checkout/Payment.js.map +1 -1
- package/dist/components/frontStore/checkout/Shipment.js +19 -13
- package/dist/components/frontStore/checkout/Shipment.js.map +1 -1
- package/dist/components/frontStore/checkout/payment/PaymentMethods.js +1 -1
- package/dist/components/frontStore/checkout/payment/PaymentMethods.js.map +1 -1
- package/dist/components/frontStore/checkout/shipment/ShippingMethods.js +2 -2
- package/dist/components/frontStore/checkout/shipment/ShippingMethods.js.map +1 -1
- package/dist/components/frontStore/customer/CustomerContext.d.ts +3 -3
- package/dist/components/frontStore/customer/RegistrationForm.js +1 -1
- package/dist/components/frontStore/customer/address/addressForm/AddressForm.js +1 -1
- package/dist/components/frontStore/customer/address/addressForm/AddressForm.js.map +1 -1
- package/dist/lib/componee/scanForComponents.js.map +1 -1
- package/dist/lib/event/EventProcessor.d.ts +17 -0
- package/dist/lib/event/EventProcessor.js +63 -0
- package/dist/lib/event/EventProcessor.js.map +1 -0
- package/dist/lib/event/EventStorage.d.ts +36 -0
- package/dist/lib/event/EventStorage.js +49 -0
- package/dist/lib/event/EventStorage.js.map +1 -0
- package/dist/lib/event/callSubscibers.d.ts +1 -1
- package/dist/lib/event/callSubscibers.js +7 -11
- package/dist/lib/event/callSubscibers.js.map +1 -1
- package/dist/lib/event/event-manager.js +38 -71
- package/dist/lib/event/event-manager.js.map +1 -1
- package/dist/lib/event/loadSubscribers.d.ts +10 -1
- package/dist/lib/event/loadSubscribers.js +2 -4
- package/dist/lib/event/loadSubscribers.js.map +1 -1
- package/dist/lib/event/tests/unit/EventProcessor.test.d.ts +1 -0
- package/dist/lib/event/tests/unit/EventProcessor.test.js +196 -0
- package/dist/lib/event/tests/unit/EventProcessor.test.js.map +1 -0
- package/dist/lib/event/tests/unit/callSubscribers.test.d.ts +1 -0
- package/dist/lib/event/tests/unit/callSubscribers.test.js +57 -0
- package/dist/lib/event/tests/unit/callSubscribers.test.js.map +1 -0
- package/dist/lib/mail/emailHelper.d.ts +2 -2
- package/dist/lib/postgres/connection.d.ts +3 -1
- package/dist/lib/postgres/connection.js +10 -6
- package/dist/lib/postgres/connection.js.map +1 -1
- package/dist/lib/postgres/query.d.ts +296 -0
- package/dist/lib/postgres/query.js +42 -0
- package/dist/lib/postgres/query.js.map +1 -0
- package/dist/lib/util/getConfig.d.ts +6 -6
- package/dist/lib/util/registry.d.ts +17 -2
- package/dist/lib/util/registry.js.map +1 -1
- package/dist/lib/util/sanitizeHtml.d.ts +16 -0
- package/dist/lib/util/sanitizeHtml.js +45 -0
- package/dist/lib/util/sanitizeHtml.js.map +1 -0
- package/dist/lib/webpack/loaders/AreaLoader.js +0 -1
- package/dist/lib/webpack/loaders/AreaLoader.js.map +1 -1
- package/dist/lib/webpack/util/getTailwindSources.js +1 -1
- package/dist/lib/webpack/util/getTailwindSources.js.map +1 -1
- package/dist/modules/auth/api/refreshUserToken/refreshToken.js +4 -6
- package/dist/modules/auth/api/refreshUserToken/refreshToken.js.map +1 -1
- package/dist/modules/auth/bootstrap.d.ts +1 -1
- package/dist/modules/auth/bootstrap.js +16 -14
- package/dist/modules/auth/bootstrap.js.map +1 -1
- package/dist/modules/auth/services/buildAdminUserPayload.d.ts +10 -0
- package/dist/modules/auth/services/buildAdminUserPayload.js +19 -0
- package/dist/modules/auth/services/buildAdminUserPayload.js.map +1 -0
- package/dist/modules/auth/services/loginUserWithEmail.d.ts +3 -7
- package/dist/modules/auth/services/loginUserWithEmail.js +15 -6
- package/dist/modules/auth/services/loginUserWithEmail.js.map +1 -1
- package/dist/modules/auth/services/logoutUser.d.ts +3 -4
- package/dist/modules/auth/services/logoutUser.js +12 -1
- package/dist/modules/auth/services/logoutUser.js.map +1 -1
- package/dist/modules/base/api/global/[apiResponse]apiErrorHandler.d.ts +3 -1
- package/dist/modules/base/api/global/[apiResponse]apiErrorHandler.js.map +1 -1
- package/dist/modules/base/api/global/[auth]apiResponse[apiErrorHandler].d.ts +3 -1
- package/dist/modules/base/api/global/[auth]apiResponse[apiErrorHandler].js.map +1 -1
- package/dist/modules/base/api/global/[auth]payloadValidate.d.ts +3 -1
- package/dist/modules/base/api/global/[auth]payloadValidate.js +3 -2
- package/dist/modules/base/api/global/[auth]payloadValidate.js.map +1 -1
- package/dist/modules/base/api/global/[payloadValidate]escapeHtml.d.ts +3 -1
- package/dist/modules/base/api/global/[payloadValidate]escapeHtml.js +0 -2
- package/dist/modules/base/api/global/[payloadValidate]escapeHtml.js.map +1 -1
- package/dist/modules/base/migration/Version-1.0.2.d.ts +2 -0
- package/dist/modules/base/migration/Version-1.0.2.js +22 -0
- package/dist/modules/base/migration/Version-1.0.2.js.map +1 -0
- package/dist/modules/base/pages/admin/all/global.scss +1 -1
- package/dist/modules/base/services/escapePayload.js +20 -13
- package/dist/modules/base/services/escapePayload.js.map +1 -1
- package/dist/modules/base/services/markSkipEscape.d.ts +5 -0
- package/dist/modules/base/services/markSkipEscape.js +25 -20
- package/dist/modules/base/services/markSkipEscape.js.map +1 -1
- package/dist/modules/catalog/api/createAttribute/createAttribute[finish].d.ts +3 -1
- package/dist/modules/catalog/api/createCategory/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/catalog/api/createCategory/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/catalog/api/createCategory/createCategory[finish].d.ts +5 -1
- package/dist/modules/catalog/api/createCategory/createCategory[finish].js.map +1 -1
- package/dist/modules/catalog/api/createCategory/finish[apiResponse].d.ts +3 -1
- package/dist/modules/catalog/api/createCategory/finish[apiResponse].js +2 -2
- package/dist/modules/catalog/api/createCategory/finish[apiResponse].js.map +1 -1
- package/dist/modules/catalog/api/createCategory/payloadSchema.json +76 -0
- package/dist/modules/catalog/api/createCollection/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/catalog/api/createCollection/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/catalog/api/createCollection/createCollection[finish].d.ts +4 -1
- package/dist/modules/catalog/api/createCollection/createCollection[finish].js.map +1 -1
- package/dist/modules/catalog/api/createCollection/finish[apiResponse].d.ts +3 -1
- package/dist/modules/catalog/api/createCollection/finish[apiResponse].js +1 -1
- package/dist/modules/catalog/api/createCollection/finish[apiResponse].js.map +1 -1
- package/dist/modules/catalog/{services/collection/collectionDataSchema.json → api/createCollection/payloadSchema.json} +1 -0
- package/dist/modules/catalog/api/createProduct/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/catalog/api/createProduct/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/catalog/api/createProduct/createProduct[finish].d.ts +5 -1
- package/dist/modules/catalog/api/createProduct/createProduct[finish].js.map +1 -1
- package/dist/modules/catalog/api/createProduct/finish[apiResponse].d.ts +3 -1
- package/dist/modules/catalog/api/createProduct/finish[apiResponse].js +2 -2
- package/dist/modules/catalog/api/createProduct/finish[apiResponse].js.map +1 -1
- package/dist/modules/catalog/api/createProduct/payloadSchema.json +76 -0
- package/dist/modules/catalog/api/updateAttribute/updateAttribute[finish].d.ts +3 -1
- package/dist/modules/catalog/api/updateCategory/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/catalog/api/updateCategory/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/catalog/api/updateCategory/finish[apiResponse].d.ts +3 -1
- package/dist/modules/catalog/api/updateCategory/finish[apiResponse].js +2 -2
- package/dist/modules/catalog/api/updateCategory/finish[apiResponse].js.map +1 -1
- package/dist/modules/catalog/api/updateCategory/payloadSchema.json +76 -0
- package/dist/modules/catalog/api/updateCategory/updateCategory[finish].d.ts +5 -1
- package/dist/modules/catalog/api/updateCategory/updateCategory[finish].js +1 -1
- package/dist/modules/catalog/api/updateCategory/updateCategory[finish].js.map +1 -1
- package/dist/modules/catalog/api/updateCollection/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/catalog/api/updateCollection/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/catalog/api/updateCollection/finish[apiResponse].d.ts +3 -1
- package/dist/modules/catalog/api/updateCollection/finish[apiResponse].js +1 -1
- package/dist/modules/catalog/api/updateCollection/finish[apiResponse].js.map +1 -1
- package/{src/modules/catalog/services/collection/collectionDataSchema.json → dist/modules/catalog/api/updateCollection/payloadSchema.json} +1 -0
- package/dist/modules/catalog/api/updateCollection/updateCollection[finish].d.ts +5 -1
- package/dist/modules/catalog/api/updateCollection/updateCollection[finish].js +1 -1
- package/dist/modules/catalog/api/updateCollection/updateCollection[finish].js.map +1 -1
- package/dist/modules/catalog/api/updateProduct/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/catalog/api/updateProduct/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/catalog/api/updateProduct/finish[apiResponse].d.ts +3 -1
- package/dist/modules/catalog/api/updateProduct/finish[apiResponse].js +2 -2
- package/dist/modules/catalog/api/updateProduct/finish[apiResponse].js.map +1 -1
- package/dist/modules/catalog/api/updateProduct/payloadSchema.json +76 -0
- package/dist/modules/catalog/api/updateProduct/updateProduct[finish].d.ts +5 -1
- package/dist/modules/catalog/api/updateProduct/updateProduct[finish].js +1 -1
- package/dist/modules/catalog/api/updateProduct/updateProduct[finish].js.map +1 -1
- package/dist/modules/catalog/graphql/types/Category/Category.resolvers.d.ts +36 -37
- package/dist/modules/catalog/graphql/types/Category/Category.resolvers.js +0 -18
- package/dist/modules/catalog/graphql/types/Category/Category.resolvers.js.map +1 -1
- package/dist/modules/catalog/graphql/types/Collection/Collection.resolvers.js +1 -8
- package/dist/modules/catalog/graphql/types/Collection/Collection.resolvers.js.map +1 -1
- package/dist/modules/catalog/graphql/types/Product/Product.resolvers.js +0 -18
- package/dist/modules/catalog/graphql/types/Product/Product.resolvers.js.map +1 -1
- package/dist/modules/catalog/pages/admin/productEdit/variants/CreateVariant.js +4 -3
- package/dist/modules/catalog/pages/admin/productEdit/variants/CreateVariant.js.map +1 -1
- package/dist/modules/catalog/pages/admin/productEdit/variants/CreateVariantGroup.d.ts +1 -0
- package/dist/modules/catalog/pages/admin/productEdit/variants/CreateVariantGroup.js +12 -6
- package/dist/modules/catalog/pages/admin/productEdit/variants/CreateVariantGroup.js.map +1 -1
- package/dist/modules/catalog/pages/admin/productEdit/variants/EditVariant.js +4 -3
- package/dist/modules/catalog/pages/admin/productEdit/variants/EditVariant.js.map +1 -1
- package/dist/modules/catalog/pages/admin/productEdit/variants/New.js +6 -10
- package/dist/modules/catalog/pages/admin/productEdit/variants/New.js.map +1 -1
- package/dist/modules/catalog/pages/admin/productEdit/variants/VariantModal.d.ts +2 -0
- package/dist/modules/catalog/pages/admin/productEdit/variants/VariantModal.js +8 -2
- package/dist/modules/catalog/pages/admin/productEdit/variants/VariantModal.js.map +1 -1
- package/dist/modules/catalog/pages/admin/productEdit+productNew/General.js +4 -1
- package/dist/modules/catalog/pages/admin/productEdit+productNew/General.js.map +1 -1
- package/dist/modules/catalog/pages/frontStore/categoryView/CategoryView.js +1 -6
- package/dist/modules/catalog/pages/frontStore/categoryView/CategoryView.js.map +1 -1
- package/dist/modules/catalog/pages/frontStore/productView/ProductView.js +7 -1
- package/dist/modules/catalog/pages/frontStore/productView/ProductView.js.map +1 -1
- package/dist/modules/catalog/services/attribute/createProductAttribute.d.ts +78 -2
- package/dist/modules/catalog/services/attribute/createProductAttribute.js +25 -1
- package/dist/modules/catalog/services/attribute/createProductAttribute.js.map +1 -1
- package/dist/modules/catalog/services/attribute/deleteProductAttribute.d.ts +7 -1
- package/dist/modules/catalog/services/attribute/deleteProductAttribute.js +13 -1
- package/dist/modules/catalog/services/attribute/deleteProductAttribute.js.map +1 -1
- package/dist/modules/catalog/services/attribute/updateProductAttribute.d.ts +56 -2
- package/dist/modules/catalog/services/attribute/updateProductAttribute.js +28 -6
- package/dist/modules/catalog/services/attribute/updateProductAttribute.js.map +1 -1
- package/dist/modules/catalog/services/category/createCategory.d.ts +28 -2
- package/dist/modules/catalog/services/category/createCategory.js +18 -1
- package/dist/modules/catalog/services/category/createCategory.js.map +1 -1
- package/dist/modules/catalog/services/category/deleteCategory.d.ts +7 -1
- package/dist/modules/catalog/services/category/deleteCategory.js +13 -1
- package/dist/modules/catalog/services/category/deleteCategory.js.map +1 -1
- package/dist/modules/catalog/services/category/updateCategory.d.ts +25 -1
- package/dist/modules/catalog/services/category/updateCategory.js +26 -4
- package/dist/modules/catalog/services/category/updateCategory.js.map +1 -1
- package/dist/modules/catalog/services/collection/createCollection.d.ts +12 -3
- package/dist/modules/catalog/services/collection/createCollection.js +20 -20
- package/dist/modules/catalog/services/collection/createCollection.js.map +1 -1
- package/dist/modules/catalog/services/collection/deleteCollection.d.ts +7 -1
- package/dist/modules/catalog/services/collection/deleteCollection.js +13 -1
- package/dist/modules/catalog/services/collection/deleteCollection.js.map +1 -1
- package/dist/modules/catalog/services/collection/updateCollection.d.ts +9 -1
- package/dist/modules/catalog/services/collection/updateCollection.js +22 -24
- package/dist/modules/catalog/services/collection/updateCollection.js.map +1 -1
- package/dist/modules/catalog/services/index.d.ts +29 -18
- package/dist/modules/catalog/services/index.js +35 -18
- package/dist/modules/catalog/services/index.js.map +1 -1
- package/dist/modules/catalog/services/product/createProduct.d.ts +56 -4
- package/dist/modules/catalog/services/product/createProduct.js +36 -1
- package/dist/modules/catalog/services/product/createProduct.js.map +1 -1
- package/dist/modules/catalog/services/product/deleteProduct.d.ts +7 -2
- package/dist/modules/catalog/services/product/deleteProduct.js +13 -1
- package/dist/modules/catalog/services/product/deleteProduct.js.map +1 -1
- package/dist/modules/catalog/services/product/updateProduct.d.ts +58 -2
- package/dist/modules/catalog/services/product/updateProduct.js +43 -4
- package/dist/modules/catalog/services/product/updateProduct.js.map +1 -1
- package/dist/modules/checkout/pages/frontStore/cart/ShoppingCart.js +1 -3
- package/dist/modules/checkout/pages/frontStore/cart/ShoppingCart.js.map +1 -1
- package/dist/modules/checkout/pages/frontStore/checkout/Checkout.js +3 -1
- package/dist/modules/checkout/pages/frontStore/checkout/Checkout.js.map +1 -1
- package/dist/modules/checkout/services/addBillingAddress.d.ts +15 -0
- package/dist/modules/checkout/services/addBillingAddress.js +24 -6
- package/dist/modules/checkout/services/addBillingAddress.js.map +1 -1
- package/dist/modules/checkout/services/addCartItem.d.ts +12 -0
- package/dist/modules/checkout/services/addCartItem.js +7 -1
- package/dist/modules/checkout/services/addCartItem.js.map +1 -1
- package/dist/modules/checkout/services/addShippingAddress.d.ts +13 -0
- package/dist/modules/checkout/services/addShippingAddress.js +18 -6
- package/dist/modules/checkout/services/addShippingAddress.js.map +1 -1
- package/dist/modules/checkout/services/checkout.d.ts +19 -1
- package/dist/modules/checkout/services/checkout.js +12 -6
- package/dist/modules/checkout/services/checkout.js.map +1 -1
- package/dist/modules/checkout/services/index.d.ts +5 -3
- package/dist/modules/checkout/services/index.js +5 -3
- package/dist/modules/checkout/services/index.js.map +1 -1
- package/dist/modules/checkout/services/orderCreator.d.ts +48 -0
- package/dist/modules/checkout/services/orderCreator.js +25 -1
- package/dist/modules/checkout/services/orderCreator.js.map +1 -1
- package/dist/modules/checkout/services/removeCartItem.d.ts +8 -0
- package/dist/modules/checkout/services/removeCartItem.js +7 -1
- package/dist/modules/checkout/services/removeCartItem.js.map +1 -1
- package/dist/modules/checkout/services/updateCartItemQty.d.ts +14 -0
- package/dist/modules/checkout/services/updateCartItemQty.js +7 -1
- package/dist/modules/checkout/services/updateCartItemQty.js.map +1 -1
- package/dist/modules/cms/api/createCmsPage/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/cms/api/createCmsPage/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/cms/api/createCmsPage/createPage[finish].d.ts +3 -1
- package/dist/modules/cms/api/createCmsPage/createPage[finish].js +1 -1
- package/dist/modules/cms/api/createCmsPage/createPage[finish].js.map +1 -1
- package/dist/modules/cms/api/createCmsPage/finish[apiResponse].d.ts +3 -1
- package/dist/modules/cms/api/createCmsPage/finish[apiResponse].js +2 -2
- package/dist/modules/cms/api/createCmsPage/finish[apiResponse].js.map +1 -1
- package/dist/modules/cms/api/createCmsPage/payloadSchema.json +76 -0
- package/dist/modules/cms/api/deleteCmsPage/deleteCmsPage.d.ts +3 -1
- package/dist/modules/cms/api/deleteCmsPage/deleteCmsPage.js +1 -1
- package/dist/modules/cms/api/deleteCmsPage/deleteCmsPage.js.map +1 -1
- package/dist/modules/cms/api/updateCmsPage/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/cms/api/updateCmsPage/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/cms/api/updateCmsPage/finish[apiResponse].d.ts +3 -1
- package/dist/modules/cms/api/updateCmsPage/finish[apiResponse].js +2 -2
- package/dist/modules/cms/api/updateCmsPage/finish[apiResponse].js.map +1 -1
- package/dist/modules/cms/api/updateCmsPage/payloadSchema.json +76 -0
- package/dist/modules/cms/api/updateCmsPage/updatePage[finish].d.ts +2 -1
- package/dist/modules/cms/api/updateCmsPage/updatePage[finish].js.map +1 -1
- package/dist/modules/cms/bootstrap.d.ts +1 -1
- package/dist/modules/cms/bootstrap.js +18 -0
- package/dist/modules/cms/bootstrap.js.map +1 -1
- package/dist/modules/cms/components/BasicMenu.js +1 -1
- package/dist/modules/cms/components/BasicMenu.js.map +1 -1
- package/dist/modules/cms/graphql/types/CmsPage/CmsPage.resolvers.js +0 -18
- package/dist/modules/cms/graphql/types/CmsPage/CmsPage.resolvers.js.map +1 -1
- package/dist/modules/cms/graphql/types/Widget/Widget.resolvers.js +0 -17
- package/dist/modules/cms/graphql/types/Widget/Widget.resolvers.js.map +1 -1
- package/dist/modules/cms/services/index.d.ts +3 -0
- package/dist/modules/cms/services/index.js +3 -0
- package/dist/modules/cms/services/index.js.map +1 -1
- package/dist/modules/cms/services/page/createPage.d.ts +18 -2
- package/dist/modules/cms/services/page/createPage.js +25 -7
- package/dist/modules/cms/services/page/createPage.js.map +1 -1
- package/dist/modules/cms/services/page/deletePage.d.ts +6 -2
- package/dist/modules/cms/services/page/deletePage.js +18 -6
- package/dist/modules/cms/services/page/deletePage.js.map +1 -1
- package/dist/modules/cms/services/page/pageDataSchema.json +9 -1
- package/dist/modules/cms/services/page/updatePage.d.ts +22 -1
- package/dist/modules/cms/services/page/updatePage.js +19 -2
- package/dist/modules/cms/services/page/updatePage.js.map +1 -1
- package/dist/modules/cms/services/widget/createWidget.d.ts +12 -1
- package/dist/modules/cms/services/widget/createWidget.js +14 -2
- package/dist/modules/cms/services/widget/createWidget.js.map +1 -1
- package/dist/modules/cms/services/widget/deleteWidget.d.ts +7 -1
- package/dist/modules/cms/services/widget/deleteWidget.js +13 -1
- package/dist/modules/cms/services/widget/deleteWidget.js.map +1 -1
- package/dist/modules/cms/services/widget/updateWidget.d.ts +7 -1
- package/dist/modules/cms/services/widget/updateWidget.js +15 -3
- package/dist/modules/cms/services/widget/updateWidget.js.map +1 -1
- package/dist/modules/cod/pages/frontStore/checkout/CashOnDelivery.js +2 -2
- package/dist/modules/cod/pages/frontStore/checkout/CashOnDelivery.js.map +1 -1
- package/dist/modules/customer/api/refreshCustomerToken/refreshToken.js +4 -6
- package/dist/modules/customer/api/refreshCustomerToken/refreshToken.js.map +1 -1
- package/dist/modules/customer/pages/frontStore/login/LoginPage.js +10 -9
- package/dist/modules/customer/pages/frontStore/login/LoginPage.js.map +1 -1
- package/dist/modules/customer/pages/frontStore/register/RegisterPage.js +14 -13
- package/dist/modules/customer/pages/frontStore/register/RegisterPage.js.map +1 -1
- package/dist/modules/customer/services/customer/address/createCustomerAddress.d.ts +13 -0
- package/dist/modules/customer/services/customer/address/createCustomerAddress.js +13 -1
- package/dist/modules/customer/services/customer/address/createCustomerAddress.js.map +1 -1
- package/dist/modules/customer/services/customer/address/deleteCustomerAddress.d.ts +5 -0
- package/dist/modules/customer/services/customer/address/deleteCustomerAddress.js +13 -1
- package/dist/modules/customer/services/customer/address/deleteCustomerAddress.js.map +1 -1
- package/dist/modules/customer/services/customer/address/updateCustomerAddress.d.ts +13 -0
- package/dist/modules/customer/services/customer/address/updateCustomerAddress.js +13 -1
- package/dist/modules/customer/services/customer/address/updateCustomerAddress.js.map +1 -1
- package/dist/modules/customer/services/customer/buildCustomerPayload.d.ts +8 -0
- package/dist/modules/customer/services/customer/buildCustomerPayload.js +19 -0
- package/dist/modules/customer/services/customer/buildCustomerPayload.js.map +1 -0
- package/dist/modules/customer/services/customer/createCustomer.d.ts +19 -1
- package/dist/modules/customer/services/customer/createCustomer.js +17 -4
- package/dist/modules/customer/services/customer/createCustomer.js.map +1 -1
- package/dist/modules/customer/services/customer/deleteCustomer.d.ts +7 -2
- package/dist/modules/customer/services/customer/deleteCustomer.js +13 -1
- package/dist/modules/customer/services/customer/deleteCustomer.js.map +1 -1
- package/dist/modules/customer/services/customer/loginCustomerWithEmail.js +3 -4
- package/dist/modules/customer/services/customer/loginCustomerWithEmail.js.map +1 -1
- package/dist/modules/customer/services/customer/updateCustomer.d.ts +23 -1
- package/dist/modules/customer/services/customer/updateCustomer.js +13 -1
- package/dist/modules/customer/services/customer/updateCustomer.js.map +1 -1
- package/dist/modules/customer/services/customer/updatePassword.d.ts +13 -0
- package/dist/modules/customer/services/customer/updatePassword.js +13 -1
- package/dist/modules/customer/services/customer/updatePassword.js.map +1 -1
- package/dist/modules/customer/services/index.d.ts +17 -11
- package/dist/modules/customer/services/index.js +26 -11
- package/dist/modules/customer/services/index.js.map +1 -1
- package/dist/modules/oms/bootstrap.js +8 -8
- package/dist/modules/oms/bootstrap.js.map +1 -1
- package/dist/modules/oms/services/addOrderActivityLog.d.ts +20 -0
- package/dist/modules/oms/services/addOrderActivityLog.js +7 -1
- package/dist/modules/oms/services/addOrderActivityLog.js.map +1 -1
- package/dist/modules/oms/services/addPaymentTransaction.d.ts +3 -0
- package/dist/modules/oms/services/addPaymentTransaction.js +16 -0
- package/dist/modules/oms/services/addPaymentTransaction.js.map +1 -0
- package/dist/modules/oms/services/cancelOrder.d.ts +61 -0
- package/dist/modules/oms/services/cancelOrder.js +31 -1
- package/dist/modules/oms/services/cancelOrder.js.map +1 -1
- package/dist/modules/oms/services/createShipment.d.ts +20 -0
- package/dist/modules/oms/services/createShipment.js +7 -1
- package/dist/modules/oms/services/createShipment.js.map +1 -1
- package/dist/modules/oms/services/index.d.ts +4 -0
- package/dist/modules/oms/services/index.js +4 -0
- package/dist/modules/oms/services/index.js.map +1 -1
- package/dist/modules/oms/services/orderLoader.d.ts +8 -0
- package/dist/modules/oms/services/orderLoader.js +57 -0
- package/dist/modules/oms/services/orderLoader.js.map +1 -0
- package/dist/modules/oms/services/statusManager.d.ts +54 -0
- package/dist/modules/oms/services/statusManager.js +101 -0
- package/dist/modules/oms/services/statusManager.js.map +1 -0
- package/dist/modules/oms/services/updateOrderStatus.d.ts +37 -0
- package/dist/modules/oms/services/updateOrderStatus.js +34 -9
- package/dist/modules/oms/services/updateOrderStatus.js.map +1 -1
- package/dist/modules/oms/services/updatePaymentStatus.d.ts +26 -0
- package/dist/modules/oms/services/updatePaymentStatus.js +13 -1
- package/dist/modules/oms/services/updatePaymentStatus.js.map +1 -1
- package/dist/modules/oms/services/updateShipmentStatus.d.ts +26 -0
- package/dist/modules/oms/services/updateShipmentStatus.js +13 -1
- package/dist/modules/oms/services/updateShipmentStatus.js.map +1 -1
- package/dist/modules/paypal/api/paypalAuthorizePayment/[bodyParser]authorize.js +1 -1
- package/dist/modules/paypal/api/paypalAuthorizePayment/[bodyParser]authorize.js.map +1 -1
- package/dist/modules/paypal/api/paypalCaptureAuthorizedPayment/[bodyParser]capture.js +2 -2
- package/dist/modules/paypal/api/paypalCaptureAuthorizedPayment/[bodyParser]capture.js.map +1 -1
- package/dist/modules/paypal/api/paypalCapturePayment/[bodyParser]capture.js +1 -1
- package/dist/modules/paypal/api/paypalCapturePayment/[bodyParser]capture.js.map +1 -1
- package/dist/modules/paypal/bootstrap.d.ts +1 -1
- package/dist/modules/paypal/bootstrap.js +22 -2
- package/dist/modules/paypal/bootstrap.js.map +1 -1
- package/dist/modules/paypal/graphql/types/PaypalSetting/PaypalSetting.admin.resolvers.d.ts +1 -1
- package/dist/modules/paypal/migration/Version-1.0.0.d.ts +3 -0
- package/dist/modules/paypal/migration/Version-1.0.0.js +19 -0
- package/dist/modules/paypal/migration/Version-1.0.0.js.map +1 -0
- package/dist/modules/paypal/pages/admin/orderEdit/PaypalCaptureButton.js +1 -1
- package/dist/modules/paypal/pages/admin/orderEdit/PaypalCaptureButton.js.map +1 -1
- package/dist/modules/paypal/pages/frontStore/checkout/Paypal.js +8 -3
- package/dist/modules/paypal/pages/frontStore/checkout/Paypal.js.map +1 -1
- package/dist/modules/promotion/api/createCoupon/createCoupon[finish].d.ts +1 -1
- package/dist/modules/promotion/api/updateCoupon/updateCoupon[finish].d.ts +1 -1
- package/dist/modules/promotion/services/coupon/createCoupon.d.ts +45 -1
- package/dist/modules/promotion/services/coupon/createCoupon.js +17 -5
- package/dist/modules/promotion/services/coupon/createCoupon.js.map +1 -1
- package/dist/modules/promotion/services/coupon/deleteCoupon.d.ts +8 -1
- package/dist/modules/promotion/services/coupon/deleteCoupon.js +16 -4
- package/dist/modules/promotion/services/coupon/deleteCoupon.js.map +1 -1
- package/dist/modules/promotion/services/coupon/updateCoupon.d.ts +8 -1
- package/dist/modules/promotion/services/coupon/updateCoupon.js +27 -13
- package/dist/modules/promotion/services/coupon/updateCoupon.js.map +1 -1
- package/dist/modules/promotion/services/index.d.ts +6 -0
- package/dist/modules/promotion/services/index.js +10 -0
- package/dist/modules/promotion/services/index.js.map +1 -0
- package/dist/modules/setting/services/setting.d.ts +10 -1
- package/dist/modules/setting/services/setting.js +27 -0
- package/dist/modules/setting/services/setting.js.map +1 -1
- package/dist/modules/stripe/api/capturePaymentIntent/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/stripe/api/capturePaymentIntent/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/stripe/api/capturePaymentIntent/capturePaymentIntent.d.ts +4 -1
- package/dist/modules/stripe/api/capturePaymentIntent/capturePaymentIntent.js +6 -4
- package/dist/modules/stripe/api/capturePaymentIntent/capturePaymentIntent.js.map +1 -1
- package/dist/modules/stripe/api/createPaymentIntent/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/stripe/api/createPaymentIntent/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/stripe/api/createPaymentIntent/createPaymentIntent.d.ts +3 -1
- package/dist/modules/stripe/api/createPaymentIntent/createPaymentIntent.js +4 -4
- package/dist/modules/stripe/api/createPaymentIntent/createPaymentIntent.js.map +1 -1
- package/dist/modules/stripe/api/refundPaymentIntent/[context]bodyParser[auth].d.ts +1 -1
- package/dist/modules/stripe/api/refundPaymentIntent/[context]bodyParser[auth].js.map +1 -1
- package/dist/modules/stripe/api/refundPaymentIntent/refundPaymentIntent.d.ts +1 -1
- package/dist/modules/stripe/api/refundPaymentIntent/refundPaymentIntent.js +11 -7
- package/dist/modules/stripe/api/refundPaymentIntent/refundPaymentIntent.js.map +1 -1
- package/dist/modules/stripe/api/stripeWebHook/[bodyJson]webhook.d.ts +3 -1
- package/dist/modules/stripe/api/stripeWebHook/[bodyJson]webhook.js +6 -6
- package/dist/modules/stripe/api/stripeWebHook/[bodyJson]webhook.js.map +1 -1
- package/dist/modules/stripe/api/stripeWebHook/bodyJson.d.ts +1 -1
- package/dist/modules/stripe/api/stripeWebHook/bodyJson.js.map +1 -1
- package/dist/modules/stripe/bootstrap.d.ts +1 -1
- package/dist/modules/stripe/bootstrap.js +31 -15
- package/dist/modules/stripe/bootstrap.js.map +1 -1
- package/dist/modules/stripe/graphql/types/StripeSetting/StripeSetting.resolvers.d.ts +1 -1
- package/dist/modules/stripe/migration/Version-1.0.0.d.ts +3 -0
- package/dist/modules/stripe/migration/Version-1.0.0.js +19 -0
- package/dist/modules/stripe/migration/Version-1.0.0.js.map +1 -0
- package/dist/modules/stripe/pages/admin/orderEdit/StripeCaptureButton.js +1 -1
- package/dist/modules/stripe/pages/admin/orderEdit/StripeCaptureButton.js.map +1 -1
- package/dist/modules/stripe/pages/admin/orderEdit/StripeRefundButton.js +7 -3
- package/dist/modules/stripe/pages/admin/orderEdit/StripeRefundButton.js.map +1 -1
- package/dist/modules/stripe/pages/frontStore/checkout/Stripe.js +16 -7
- package/dist/modules/stripe/pages/frontStore/checkout/Stripe.js.map +1 -1
- package/dist/modules/stripe/pages/frontStore/stripeReturn/index.d.ts +3 -1
- package/dist/modules/stripe/pages/frontStore/stripeReturn/index.js +8 -4
- package/dist/modules/stripe/pages/frontStore/stripeReturn/index.js.map +1 -1
- package/dist/modules/stripe/services/cancelPayment.d.ts +1 -1
- package/dist/modules/stripe/services/cancelPayment.js +3 -3
- package/dist/modules/stripe/services/cancelPayment.js.map +1 -1
- package/dist/types/apiResponse.d.ts +1 -1
- package/dist/types/appContext.d.ts +7 -4
- package/dist/types/customerAddress.d.ts +1 -1
- package/dist/types/db/index.d.ts +61 -61
- package/dist/types/event.d.ts +27 -14
- package/dist/types/registry.d.ts +119 -0
- package/dist/types/registry.js +2 -0
- package/dist/types/registry.js.map +1 -0
- package/dist/types/widget.d.ts +3 -0
- package/package.json +21 -12
- package/src/components/common/Area.tsx +256 -40
- package/src/components/common/Editor.tsx +6 -3
- package/src/components/common/ExtendableTable.tsx +1 -1
- package/src/components/common/StaticImage.tsx +2 -2
- package/src/components/common/form/Editor.scss +3 -1
- package/src/components/common/form/ReactSelectCreatableField.tsx +1 -1
- package/src/components/common/form/SelectField.tsx +1 -1
- package/src/components/common/ui/Item.tsx +1 -1
- package/src/components/common/ui/Sonner.tsx +43 -0
- package/src/components/frontStore/Footer.tsx +2 -0
- package/src/components/frontStore/Pagination.tsx +1 -1
- package/src/components/frontStore/cart/CartContext.tsx +2 -2
- package/src/components/frontStore/cart/DefaultCartItemList.tsx +5 -5
- package/src/components/frontStore/cart/DefaultMiniCartDropdown.tsx +7 -37
- package/src/components/frontStore/cart/DefaultMinicartDropdownSummary.tsx +57 -0
- package/src/components/frontStore/catalog/CategoryInfo.tsx +2 -2
- package/src/components/frontStore/catalog/DefaultCategoryFilterRender.tsx +1 -1
- package/src/components/frontStore/catalog/DefaultProductFilterRender.tsx +3 -3
- package/src/components/frontStore/catalog/ProductSorting.tsx +13 -4
- package/src/components/frontStore/catalog/SearchBox.tsx +1 -1
- package/src/components/frontStore/checkout/CheckoutButton.tsx +40 -31
- package/src/components/frontStore/checkout/CheckoutContext.tsx +55 -36
- package/src/components/frontStore/checkout/ContactInformation.tsx +28 -23
- package/src/components/frontStore/checkout/Payment.tsx +36 -27
- package/src/components/frontStore/checkout/Shipment.tsx +35 -28
- package/src/components/frontStore/checkout/payment/PaymentMethods.tsx +1 -1
- package/src/components/frontStore/checkout/shipment/ShippingMethods.tsx +6 -2
- package/src/components/frontStore/customer/CustomerContext.tsx +5 -5
- package/src/components/frontStore/customer/RegistrationForm.tsx +1 -1
- package/src/components/frontStore/customer/address/addressForm/AddressForm.tsx +1 -0
- package/src/lib/componee/scanForComponents.ts +0 -1
- package/src/lib/event/EventProcessor.ts +78 -0
- package/src/lib/event/EventStorage.ts +74 -0
- package/src/lib/event/callSubscibers.ts +13 -0
- package/src/lib/event/event-manager.ts +96 -0
- package/src/lib/event/{loadSubscribers.js → loadSubscribers.ts} +20 -8
- package/src/lib/event/tests/unit/EventProcessor.test.js +262 -0
- package/src/lib/event/tests/unit/callSubscribers.test.js +77 -0
- package/src/lib/mail/emailHelper.ts +2 -2
- package/src/lib/postgres/connection.ts +11 -7
- package/src/lib/postgres/query.ts +582 -0
- package/src/lib/util/getConfig.ts +6 -6
- package/src/lib/util/registry.ts +31 -0
- package/src/lib/util/sanitizeHtml.ts +59 -0
- package/src/lib/webpack/loaders/AreaLoader.js +0 -1
- package/src/lib/webpack/util/getTailwindSources.ts +1 -1
- package/src/modules/auth/api/refreshUserToken/refreshToken.ts +4 -6
- package/src/modules/auth/bootstrap.ts +33 -0
- package/src/modules/auth/services/buildAdminUserPayload.ts +22 -0
- package/src/modules/auth/services/loginUserWithEmail.ts +36 -6
- package/src/modules/auth/services/logoutUser.ts +22 -1
- package/src/modules/base/api/global/{[apiResponse]apiErrorHandler.js → [apiResponse]apiErrorHandler.ts} +8 -1
- package/src/modules/base/api/global/{[auth]apiResponse[apiErrorHandler].js → [auth]apiResponse[apiErrorHandler].ts} +7 -1
- package/src/modules/base/api/global/{[auth]payloadValidate.js → [auth]payloadValidate.ts} +10 -3
- package/src/modules/base/api/global/[payloadValidate]escapeHtml.ts +12 -0
- package/src/modules/base/migration/Version-1.0.2.js +37 -0
- package/src/modules/base/pages/admin/all/global.scss +1 -1
- package/src/modules/base/services/{escapePayload.js → escapePayload.ts} +17 -11
- package/src/modules/base/services/markSkipEscape.ts +43 -0
- package/src/modules/catalog/api/createCategory/createCategory[finish].ts +10 -0
- package/src/modules/catalog/api/createCategory/{finish[apiResponse].js → finish[apiResponse].ts} +13 -4
- package/src/modules/catalog/api/createCategory/payloadSchema.json +76 -0
- package/src/modules/catalog/api/createCollection/{createCollection[finish].js → createCollection[finish].ts} +2 -1
- package/src/modules/catalog/api/{updateCollection/finish[apiResponse].js → createCollection/finish[apiResponse].ts} +12 -3
- package/src/modules/catalog/api/createCollection/payloadSchema.json +94 -0
- package/src/modules/catalog/api/createProduct/createProduct[finish].ts +10 -0
- package/src/modules/catalog/api/createProduct/{finish[apiResponse].js → finish[apiResponse].ts} +13 -4
- package/src/modules/catalog/api/createProduct/payloadSchema.json +76 -0
- package/src/modules/catalog/api/updateCategory/{finish[apiResponse].js → finish[apiResponse].ts} +13 -4
- package/src/modules/catalog/api/updateCategory/payloadSchema.json +76 -0
- package/src/modules/catalog/api/updateCategory/updateCategory[finish].ts +14 -0
- package/src/modules/catalog/api/{createCollection/finish[apiResponse].js → updateCollection/finish[apiResponse].ts} +12 -3
- package/src/modules/catalog/api/updateCollection/payloadSchema.json +94 -0
- package/src/modules/catalog/api/updateCollection/updateCollection[finish].ts +14 -0
- package/src/modules/catalog/api/updateProduct/{finish[apiResponse].js → finish[apiResponse].ts} +13 -4
- package/src/modules/catalog/api/updateProduct/payloadSchema.json +76 -0
- package/src/modules/catalog/api/updateProduct/updateProduct[finish].ts +14 -0
- package/src/modules/catalog/graphql/types/Category/{Category.resolvers.js → Category.resolvers.ts} +0 -21
- package/src/modules/catalog/graphql/types/Collection/Collection.resolvers.js +1 -8
- package/src/modules/catalog/graphql/types/Product/Product.resolvers.ts +0 -20
- package/src/modules/catalog/pages/admin/productEdit/variants/CreateVariant.tsx +6 -2
- package/src/modules/catalog/pages/admin/productEdit/variants/CreateVariantGroup.tsx +22 -11
- package/src/modules/catalog/pages/admin/productEdit/variants/EditVariant.tsx +10 -3
- package/src/modules/catalog/pages/admin/productEdit/variants/New.tsx +8 -23
- package/src/modules/catalog/pages/admin/productEdit/variants/VariantModal.tsx +10 -2
- package/src/modules/catalog/pages/admin/productEdit+productNew/General.tsx +5 -2
- package/src/modules/catalog/pages/frontStore/categoryView/CategoryView.tsx +4 -8
- package/src/modules/catalog/pages/frontStore/productView/ProductView.tsx +10 -1
- package/src/modules/catalog/services/attribute/createProductAttribute.ts +146 -8
- package/src/modules/catalog/services/attribute/deleteProductAttribute.ts +58 -4
- package/src/modules/catalog/services/attribute/updateProductAttribute.ts +128 -12
- package/src/modules/catalog/services/category/createCategory.ts +66 -6
- package/src/modules/catalog/services/category/deleteCategory.ts +61 -4
- package/src/modules/catalog/services/category/updateCategory.ts +75 -10
- package/src/modules/catalog/services/collection/createCollection.ts +71 -30
- package/src/modules/catalog/services/collection/deleteCollection.ts +58 -4
- package/src/modules/catalog/services/collection/updateCollection.ts +70 -35
- package/src/modules/catalog/services/index.ts +46 -35
- package/src/modules/catalog/services/product/createProduct.ts +155 -11
- package/src/modules/catalog/services/product/deleteProduct.ts +58 -4
- package/src/modules/catalog/services/product/updateProduct.ts +168 -17
- package/src/modules/checkout/pages/frontStore/cart/ShoppingCart.tsx +0 -2
- package/src/modules/checkout/pages/frontStore/checkout/Checkout.tsx +2 -0
- package/src/modules/checkout/services/addBillingAddress.ts +74 -6
- package/src/modules/checkout/services/addCartItem.ts +31 -1
- package/src/modules/checkout/services/addShippingAddress.ts +54 -6
- package/src/modules/checkout/services/checkout.ts +35 -7
- package/src/modules/checkout/services/index.ts +17 -3
- package/src/modules/checkout/services/orderCreator.ts +105 -1
- package/src/modules/checkout/services/removeCartItem.ts +27 -1
- package/src/modules/checkout/services/updateCartItemQty.ts +33 -1
- package/src/modules/cms/api/createCmsPage/createPage[finish].ts +12 -0
- package/src/modules/cms/api/createCmsPage/{finish[apiResponse].js → finish[apiResponse].ts} +10 -4
- package/src/modules/cms/api/createCmsPage/payloadSchema.json +76 -0
- package/src/modules/cms/api/deleteCmsPage/{deleteCmsPage.js → deleteCmsPage.ts} +8 -2
- package/src/modules/cms/api/updateCmsPage/{finish[apiResponse].js → finish[apiResponse].ts} +10 -4
- package/src/modules/cms/api/updateCmsPage/payloadSchema.json +76 -0
- package/src/modules/cms/api/updateCmsPage/{updatePage[finish].js → updatePage[finish].ts} +2 -1
- package/src/modules/cms/{bootstrap.js → bootstrap.ts} +24 -3
- package/src/modules/cms/components/BasicMenu.tsx +1 -1
- package/src/modules/cms/graphql/types/CmsPage/CmsPage.resolvers.ts +0 -21
- package/src/modules/cms/graphql/types/Widget/Widget.resolvers.js +0 -20
- package/src/modules/cms/services/index.ts +3 -0
- package/src/modules/cms/services/page/{createPage.js → createPage.ts} +65 -8
- package/src/modules/cms/services/page/deletePage.ts +109 -0
- package/src/modules/cms/services/page/pageDataSchema.json +9 -1
- package/src/modules/cms/services/page/{updatePage.js → updatePage.ts} +68 -6
- package/src/modules/cms/services/widget/createWidget.ts +120 -0
- package/src/modules/cms/services/widget/deleteWidget.ts +97 -0
- package/src/modules/cms/services/widget/updateWidget.js +17 -1
- package/src/modules/cms/services/widget/updateWidget.ts +139 -0
- package/src/modules/cod/pages/frontStore/checkout/CashOnDelivery.tsx +4 -2
- package/src/modules/customer/api/refreshCustomerToken/refreshToken.ts +4 -6
- package/src/modules/customer/pages/frontStore/login/LoginPage.tsx +26 -24
- package/src/modules/customer/pages/frontStore/register/RegisterPage.tsx +24 -22
- package/src/modules/customer/services/customer/address/createCustomerAddress.ts +54 -2
- package/src/modules/customer/services/customer/address/deleteCustomerAddress.ts +49 -2
- package/src/modules/customer/services/customer/address/updateCustomerAddress.ts +55 -3
- package/src/modules/customer/services/customer/buildCustomerPayload.ts +20 -0
- package/src/modules/customer/services/customer/createCustomer.ts +60 -7
- package/src/modules/customer/services/customer/deleteCustomer.ts +55 -5
- package/src/modules/customer/services/customer/loginCustomerWithEmail.ts +3 -4
- package/src/modules/customer/services/customer/updateCustomer.ts +62 -5
- package/src/modules/customer/services/customer/updatePassword.ts +56 -3
- package/src/modules/customer/services/index.ts +34 -27
- package/src/modules/oms/bootstrap.ts +9 -8
- package/src/modules/oms/services/addOrderActivityLog.ts +31 -1
- package/src/modules/oms/services/addPaymentTransaction.ts +26 -0
- package/src/modules/oms/services/cancelOrder.ts +131 -1
- package/src/modules/oms/services/createShipment.ts +31 -1
- package/src/modules/oms/services/index.ts +4 -0
- package/src/modules/oms/services/orderLoader.ts +73 -0
- package/src/modules/oms/services/statusManager.ts +159 -0
- package/src/modules/oms/services/updateOrderStatus.ts +101 -9
- package/src/modules/oms/services/updatePaymentStatus.ts +53 -1
- package/src/modules/oms/services/updateShipmentStatus.ts +53 -1
- package/src/modules/paypal/api/paypalAuthorizePayment/[bodyParser]authorize.ts +1 -1
- package/src/modules/paypal/api/paypalCaptureAuthorizedPayment/[bodyParser]capture.ts +10 -2
- package/src/modules/paypal/api/paypalCapturePayment/[bodyParser]capture.ts +5 -1
- package/src/modules/paypal/{bootstrap.js → bootstrap.ts} +23 -2
- package/src/modules/paypal/migration/Version-1.0.0.ts +24 -0
- package/src/modules/paypal/pages/admin/orderEdit/PaypalCaptureButton.tsx +1 -1
- package/src/modules/paypal/pages/frontStore/checkout/Paypal.tsx +9 -3
- package/src/modules/promotion/services/coupon/createCoupon.ts +147 -0
- package/src/modules/promotion/services/coupon/deleteCoupon.ts +100 -0
- package/src/modules/promotion/services/coupon/updateCoupon.ts +130 -0
- package/src/modules/promotion/services/index.ts +11 -0
- package/src/modules/setting/services/setting.ts +40 -2
- package/src/modules/stripe/api/capturePaymentIntent/{capturePaymentIntent.js → capturePaymentIntent.ts} +14 -5
- package/src/modules/stripe/api/createPaymentIntent/{createPaymentIntent.js → createPaymentIntent.ts} +11 -5
- package/src/modules/stripe/api/refundPaymentIntent/{refundPaymentIntent.js → refundPaymentIntent.ts} +11 -7
- package/src/modules/stripe/api/stripeWebHook/{[bodyJson]webhook.js → [bodyJson]webhook.ts} +30 -10
- package/src/modules/stripe/{bootstrap.js → bootstrap.ts} +40 -15
- package/src/modules/stripe/migration/Version-1.0.0.ts +24 -0
- package/src/modules/stripe/pages/admin/orderEdit/StripeCaptureButton.jsx +1 -1
- package/src/modules/stripe/pages/admin/orderEdit/StripeRefundButton.tsx +9 -3
- package/src/modules/stripe/pages/frontStore/checkout/Stripe.tsx +16 -7
- package/src/modules/stripe/pages/frontStore/stripeReturn/{index.js → index.ts} +15 -5
- package/src/modules/stripe/services/{cancelPayment.js → cancelPayment.ts} +4 -4
- package/src/types/apiResponse.ts +1 -1
- package/src/types/appContext.tsx +9 -4
- package/src/types/customerAddress.ts +1 -1
- package/src/types/db/index.ts +61 -61
- package/src/types/event.ts +29 -15
- package/src/types/registry.ts +160 -0
- package/src/types/widget.ts +3 -0
- package/src/lib/event/callSubscibers.js +0 -19
- package/src/lib/event/event-manager.js +0 -134
- package/src/modules/auth/bootstrap.js +0 -28
- package/src/modules/base/api/global/[payloadValidate]escapeHtml.js +0 -12
- package/src/modules/base/services/markSkipEscape.js +0 -30
- package/src/modules/catalog/api/createCategory/createCategory[finish].js +0 -8
- package/src/modules/catalog/api/createProduct/createProduct[finish].js +0 -8
- package/src/modules/catalog/api/updateCategory/updateCategory[finish].js +0 -8
- package/src/modules/catalog/api/updateCollection/updateCollection[finish].js +0 -8
- package/src/modules/catalog/api/updateProduct/updateProduct[finish].js +0 -8
- package/src/modules/cms/api/createCmsPage/createPage[finish].js +0 -10
- package/src/modules/cms/services/page/deletePage.js +0 -55
- package/src/modules/cms/services/widget/createWidget.js +0 -71
- package/src/modules/cms/services/widget/deleteWidget.js +0 -47
- package/src/modules/promotion/services/coupon/createCoupon.js +0 -75
- package/src/modules/promotion/services/coupon/deleteCoupon.js +0 -49
- package/src/modules/promotion/services/coupon/updateCoupon.js +0 -94
- package/src/types/request.d.ts +0 -7
- /package/src/modules/catalog/api/createCategory/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/catalog/api/createCollection/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/catalog/api/createProduct/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/catalog/api/updateCategory/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/catalog/api/updateCollection/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/catalog/api/updateProduct/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/cms/api/createCmsPage/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/cms/api/updateCmsPage/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/stripe/api/capturePaymentIntent/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/stripe/api/createPaymentIntent/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/stripe/api/refundPaymentIntent/{[context]bodyParser[auth].js → [context]bodyParser[auth].ts} +0 -0
- /package/src/modules/stripe/api/stripeWebHook/{bodyJson.js → bodyJson.ts} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { insert, Pool, PoolClient } from '../../../lib/postgres/query.js';
|
|
2
|
+
import { PaymentTransactionRow } from '../../../types/db/index.js';
|
|
3
|
+
|
|
4
|
+
export async function addPaymentTransaction(
|
|
5
|
+
connection: Pool | PoolClient,
|
|
6
|
+
orderId: number,
|
|
7
|
+
amount: number,
|
|
8
|
+
transactionId: string | number,
|
|
9
|
+
transactionType: string,
|
|
10
|
+
paymentAction: string,
|
|
11
|
+
additionalInformation?: string,
|
|
12
|
+
parentTransactionId?: string | number
|
|
13
|
+
): Promise<PaymentTransactionRow> {
|
|
14
|
+
const transaction = await insert('payment_transaction')
|
|
15
|
+
.given({
|
|
16
|
+
payment_transaction_order_id: orderId,
|
|
17
|
+
amount,
|
|
18
|
+
transaction_id: transactionId,
|
|
19
|
+
transaction_type: transactionType,
|
|
20
|
+
payment_action: paymentAction,
|
|
21
|
+
additional_information: additionalInformation,
|
|
22
|
+
parent_transaction_id: parentTransactionId
|
|
23
|
+
})
|
|
24
|
+
.execute(connection);
|
|
25
|
+
return transaction;
|
|
26
|
+
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { error } from '../../../lib/log/logger.js';
|
|
11
11
|
import { pool } from '../../../lib/postgres/connection.js';
|
|
12
12
|
import { getConfig } from '../../../lib/util/getConfig.js';
|
|
13
|
-
import { hookable } from '../../../lib/util/hookable.js';
|
|
13
|
+
import { hookable, hookBefore, hookAfter } from '../../../lib/util/hookable.js';
|
|
14
14
|
import { PaymentStatus, ShipmentStatus } from '../../../types/order.js';
|
|
15
15
|
import addOrderActivityLog from './addOrderActivityLog.js';
|
|
16
16
|
import { updatePaymentStatus } from './updatePaymentStatus.js';
|
|
@@ -120,3 +120,133 @@ async function cancelOrder(uuid: string, reason: string | undefined) {
|
|
|
120
120
|
export default async (uuid: string, reason: string | undefined) => {
|
|
121
121
|
await hookable(cancelOrder, { uuid })(uuid, reason);
|
|
122
122
|
};
|
|
123
|
+
|
|
124
|
+
export function hookBeforeValidateStatus(
|
|
125
|
+
callback: (
|
|
126
|
+
this: { order: Record<string, any> },
|
|
127
|
+
...args: [
|
|
128
|
+
paymentStatus: string,
|
|
129
|
+
shipmentStatus: string
|
|
130
|
+
]
|
|
131
|
+
) => void | Promise<void>,
|
|
132
|
+
priority: number = 10
|
|
133
|
+
): void {
|
|
134
|
+
hookBefore('validateStatus', callback, priority);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function hookAfterValidateStatus(
|
|
138
|
+
callback: (
|
|
139
|
+
this: { order: Record<string, any> },
|
|
140
|
+
...args: [
|
|
141
|
+
paymentStatus: string,
|
|
142
|
+
shipmentStatus: string
|
|
143
|
+
]
|
|
144
|
+
) => void | Promise<void>,
|
|
145
|
+
priority: number = 10
|
|
146
|
+
): void {
|
|
147
|
+
hookAfter('validateStatus', callback, priority);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function hookBeforeUpdatePaymentStatusToCancel(
|
|
151
|
+
callback: (
|
|
152
|
+
this: { order: Record<string, any> },
|
|
153
|
+
...args: [
|
|
154
|
+
orderID: number,
|
|
155
|
+
connection: PoolClient
|
|
156
|
+
]
|
|
157
|
+
) => void | Promise<void>,
|
|
158
|
+
priority: number = 10
|
|
159
|
+
): void {
|
|
160
|
+
hookBefore('updatePaymentStatusToCancel', callback, priority);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function hookAfterUpdatePaymentStatusToCancel(
|
|
164
|
+
callback: (
|
|
165
|
+
this: { order: Record<string, any> },
|
|
166
|
+
...args: [
|
|
167
|
+
orderID: number,
|
|
168
|
+
connection: PoolClient
|
|
169
|
+
]
|
|
170
|
+
) => void | Promise<void>,
|
|
171
|
+
priority: number = 10
|
|
172
|
+
): void {
|
|
173
|
+
hookAfter('updatePaymentStatusToCancel', callback, priority);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function hookBeforeUpdateShipmentStatusToCancel(
|
|
177
|
+
callback: (
|
|
178
|
+
this: { order: Record<string, any> },
|
|
179
|
+
...args: [
|
|
180
|
+
orderID: number,
|
|
181
|
+
connection: PoolClient
|
|
182
|
+
]
|
|
183
|
+
) => void | Promise<void>,
|
|
184
|
+
priority: number = 10
|
|
185
|
+
): void {
|
|
186
|
+
hookBefore('updateShipmentStatusToCancel', callback, priority);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function hookAfterUpdateShipmentStatusToCancel(
|
|
190
|
+
callback: (
|
|
191
|
+
this: { order: Record<string, any> },
|
|
192
|
+
...args: [
|
|
193
|
+
orderID: number,
|
|
194
|
+
connection: PoolClient
|
|
195
|
+
]
|
|
196
|
+
) => void | Promise<void>,
|
|
197
|
+
priority: number = 10
|
|
198
|
+
): void {
|
|
199
|
+
hookAfter('updateShipmentStatusToCancel', callback, priority);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function hookBeforeReStockAfterCancel(
|
|
203
|
+
callback: (
|
|
204
|
+
this: { order: Record<string, any> },
|
|
205
|
+
...args: [
|
|
206
|
+
orderID: number,
|
|
207
|
+
connection: PoolClient
|
|
208
|
+
]
|
|
209
|
+
) => void | Promise<void>,
|
|
210
|
+
priority: number = 10
|
|
211
|
+
): void {
|
|
212
|
+
hookBefore('reStockAfterCancel', callback, priority);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function hookAfterReStockAfterCancel(
|
|
216
|
+
callback: (
|
|
217
|
+
this: { order: Record<string, any> },
|
|
218
|
+
...args: [
|
|
219
|
+
orderID: number,
|
|
220
|
+
connection: PoolClient
|
|
221
|
+
]
|
|
222
|
+
) => void | Promise<void>,
|
|
223
|
+
priority: number = 10
|
|
224
|
+
): void {
|
|
225
|
+
hookAfter('reStockAfterCancel', callback, priority);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function hookBeforeCancelOrder(
|
|
229
|
+
callback: (
|
|
230
|
+
this: { uuid: string },
|
|
231
|
+
...args: [
|
|
232
|
+
uuid: string,
|
|
233
|
+
reason: string | undefined
|
|
234
|
+
]
|
|
235
|
+
) => void | Promise<void>,
|
|
236
|
+
priority: number = 10
|
|
237
|
+
): void {
|
|
238
|
+
hookBefore('cancelOrder', callback, priority);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export function hookAfterCancelOrder(
|
|
242
|
+
callback: (
|
|
243
|
+
this: { uuid: string },
|
|
244
|
+
...args: [
|
|
245
|
+
uuid: string,
|
|
246
|
+
reason: string | undefined
|
|
247
|
+
]
|
|
248
|
+
) => void | Promise<void>,
|
|
249
|
+
priority: number = 10
|
|
250
|
+
): void {
|
|
251
|
+
hookAfter('cancelOrder', callback, priority);
|
|
252
|
+
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@evershop/postgres-query-builder';
|
|
8
8
|
import { PoolClient } from 'pg';
|
|
9
9
|
import { getConnection } from '../../../lib/postgres/connection.js';
|
|
10
|
-
import { hookable } from '../../../lib/util/hookable.js';
|
|
10
|
+
import { hookable, hookBefore, hookAfter } from '../../../lib/util/hookable.js';
|
|
11
11
|
import addOrderActivityLog from './addOrderActivityLog.js';
|
|
12
12
|
import { updateShipmentStatus } from './updateShipmentStatus.js';
|
|
13
13
|
|
|
@@ -89,3 +89,33 @@ export default async (
|
|
|
89
89
|
throw e;
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
+
|
|
93
|
+
export function hookBeforeCreateShipment(
|
|
94
|
+
callback: (
|
|
95
|
+
this: { order: Record<string, any>; carrier: string | null; trackingNumber: string | null },
|
|
96
|
+
...args: [
|
|
97
|
+
orderId: number,
|
|
98
|
+
carrier: string | null,
|
|
99
|
+
trackingNumber: string | null,
|
|
100
|
+
connection: PoolClient
|
|
101
|
+
]
|
|
102
|
+
) => void | Promise<void>,
|
|
103
|
+
priority: number = 10
|
|
104
|
+
): void {
|
|
105
|
+
hookBefore('createShipment', callback, priority);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function hookAfterCreateShipment(
|
|
109
|
+
callback: (
|
|
110
|
+
this: { order: Record<string, any>; carrier: string | null; trackingNumber: string | null },
|
|
111
|
+
...args: [
|
|
112
|
+
orderId: number,
|
|
113
|
+
carrier: string | null,
|
|
114
|
+
trackingNumber: string | null,
|
|
115
|
+
connection: PoolClient
|
|
116
|
+
]
|
|
117
|
+
) => void | Promise<void>,
|
|
118
|
+
priority: number = 10
|
|
119
|
+
): void {
|
|
120
|
+
hookAfter('createShipment', callback, priority);
|
|
121
|
+
}
|
|
@@ -3,4 +3,8 @@ import cancelOrder from './cancelOrder.js';
|
|
|
3
3
|
import createShipment from './createShipment.js';
|
|
4
4
|
export * from './updatePaymentStatus.js';
|
|
5
5
|
export * from './updateShipmentStatus.js';
|
|
6
|
+
export * from './orderLoader.js';
|
|
7
|
+
export * from './addPaymentTransaction.js';
|
|
8
|
+
export * from './statusManager.js';
|
|
9
|
+
export * from './updateOrderStatus.js';
|
|
6
10
|
export { cancelOrder, addOrderActivityLog, createShipment };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { pool } from '../../../lib/postgres/connection.js';
|
|
2
|
+
import { select } from '../../../lib/postgres/query.js';
|
|
3
|
+
import {
|
|
4
|
+
OrderAddressRow,
|
|
5
|
+
OrderItemRow,
|
|
6
|
+
OrderRow
|
|
7
|
+
} from '../../../types/db/index.js';
|
|
8
|
+
|
|
9
|
+
export type OrderDetails = OrderRow & {
|
|
10
|
+
items: OrderItemRow[];
|
|
11
|
+
shippingAddress: OrderAddressRow | null;
|
|
12
|
+
billingAddress: OrderAddressRow | null;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export async function loadOrderById(
|
|
16
|
+
orderId: number
|
|
17
|
+
): Promise<OrderDetails | null> {
|
|
18
|
+
const order = (await select()
|
|
19
|
+
.from('order')
|
|
20
|
+
.where('order_id', '=', orderId)
|
|
21
|
+
.load(pool)) as OrderRow | null;
|
|
22
|
+
if (!order) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const items = (await select()
|
|
26
|
+
.from('order_item')
|
|
27
|
+
.where('order_item_order_id', '=', orderId)
|
|
28
|
+
.execute(pool)) as OrderItemRow[];
|
|
29
|
+
const shippingAddress = (await select()
|
|
30
|
+
.from('order_address')
|
|
31
|
+
.where('order_address_id', '=', order.shipping_address_id)
|
|
32
|
+
.load(pool)) as OrderAddressRow | null;
|
|
33
|
+
const billingAddress = (await select()
|
|
34
|
+
.from('order_address')
|
|
35
|
+
.where('order_address_id', '=', order.billing_address_id)
|
|
36
|
+
.load(pool)) as OrderAddressRow | null;
|
|
37
|
+
return {
|
|
38
|
+
...order,
|
|
39
|
+
items,
|
|
40
|
+
shippingAddress,
|
|
41
|
+
billingAddress
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function loadOrderByUUID(
|
|
46
|
+
orderUUID: string
|
|
47
|
+
): Promise<OrderDetails | null> {
|
|
48
|
+
const order = (await select()
|
|
49
|
+
.from('order')
|
|
50
|
+
.where('uuid', '=', orderUUID)
|
|
51
|
+
.load(pool)) as OrderRow | null;
|
|
52
|
+
if (!order) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const items = (await select()
|
|
56
|
+
.from('order_item')
|
|
57
|
+
.where('order_item_order_id', '=', order.order_id)
|
|
58
|
+
.execute(pool)) as OrderItemRow[];
|
|
59
|
+
const shippingAddress = (await select()
|
|
60
|
+
.from('order_address')
|
|
61
|
+
.where('order_address_id', '=', order.shipping_address_id)
|
|
62
|
+
.load(pool)) as OrderAddressRow | null;
|
|
63
|
+
const billingAddress = (await select()
|
|
64
|
+
.from('order_address')
|
|
65
|
+
.where('order_address_id', '=', order.billing_address_id)
|
|
66
|
+
.load(pool)) as OrderAddressRow | null;
|
|
67
|
+
return {
|
|
68
|
+
...order,
|
|
69
|
+
items,
|
|
70
|
+
shippingAddress,
|
|
71
|
+
billingAddress
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import config from 'config';
|
|
2
|
+
import { getConfig } from '../../../lib/util/getConfig.js';
|
|
3
|
+
import { addProcessor } from '../../../lib/util/registry.js';
|
|
4
|
+
import {
|
|
5
|
+
OrderStatus,
|
|
6
|
+
PaymentStatus,
|
|
7
|
+
ShipmentStatus
|
|
8
|
+
} from '../../../types/order.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves the list of order statuses defined in the system. The statuses are defined in the configuration under `oms.order.status`. Each status includes details such as its name, badge, whether it's the default status, and possible next statuses.
|
|
12
|
+
* @returns A record of order statuses, where the key is the status ID and the value is an object containing the status details.
|
|
13
|
+
*/
|
|
14
|
+
function getOrderStatusList(): Record<string, OrderStatus> {
|
|
15
|
+
const statuses = getConfig('oms.order.status', {}) as Record<
|
|
16
|
+
string,
|
|
17
|
+
OrderStatus
|
|
18
|
+
>;
|
|
19
|
+
return statuses;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the list of shipment statuses defined in the system. The statuses are defined in the configuration under `oms.order.shipmentStatus`. Each status includes details such as its name, badge, whether it's the default status, and whether it's cancelable.
|
|
24
|
+
* @returns A record of shipment statuses, where the key is the status ID and the value is an object containing the status details.
|
|
25
|
+
*/
|
|
26
|
+
function getShipmentStatusList() {
|
|
27
|
+
const statuses = getConfig('oms.order.shipmentStatus', {}) as Record<
|
|
28
|
+
string,
|
|
29
|
+
{
|
|
30
|
+
name: string;
|
|
31
|
+
badge: string;
|
|
32
|
+
progress?: string;
|
|
33
|
+
isDefault?: boolean;
|
|
34
|
+
isCancelable?: boolean;
|
|
35
|
+
}
|
|
36
|
+
>;
|
|
37
|
+
return statuses;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves the list of payment statuses defined in the system. The statuses are defined in the configuration under `oms.order.paymentStatus`. Each status includes details such as its name, badge, whether it's the default status, and whether it's cancelable.
|
|
42
|
+
* @returns A record of payment statuses, where the key is the status ID and the value is an object containing the status details.
|
|
43
|
+
*/
|
|
44
|
+
function getPaymentStatusList() {
|
|
45
|
+
const statuses = getConfig('oms.order.paymentStatus', {}) as Record<
|
|
46
|
+
string,
|
|
47
|
+
{
|
|
48
|
+
name: string;
|
|
49
|
+
badge: string;
|
|
50
|
+
isDefault?: boolean;
|
|
51
|
+
isCancelable?: boolean;
|
|
52
|
+
}
|
|
53
|
+
>;
|
|
54
|
+
return statuses;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Registers a new payment status in the system. This function must be called during the application initialization phase (e.g., in a module's `bootstrap` function).
|
|
59
|
+
* @param id Unique identifier for the payment status (e.g., "paid", "pending")
|
|
60
|
+
* @param detail Object containing details about the payment status (name, badge, etc.)
|
|
61
|
+
* @param psoMapping Optional mapping of payment status to order status (e.g., { "paid": "processing" })
|
|
62
|
+
*/
|
|
63
|
+
function registerPaymentStatus(
|
|
64
|
+
id: string,
|
|
65
|
+
detail: PaymentStatus,
|
|
66
|
+
psoMapping?: Record<string, string>
|
|
67
|
+
) {
|
|
68
|
+
// Make sure ID is not empty and does not contain spaces
|
|
69
|
+
if (!id || /\s/.test(id)) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
'Payment status ID must be a non-empty string without spaces.'
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const statusConfig = {
|
|
75
|
+
order: {
|
|
76
|
+
paymentStatus: {
|
|
77
|
+
[id]: detail
|
|
78
|
+
},
|
|
79
|
+
psoMapping: psoMapping
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
config.util.setModuleDefaults('oms', statusConfig);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Registers a new shipment status in the system. This function must be called during the application initialization phase (e.g., in a module's `bootstrap` function).
|
|
87
|
+
* @param id Unique identifier for the shipment status (e.g., "shipped", "delivered")
|
|
88
|
+
* @param detail Object containing details about the shipment status (name, badge, etc.)
|
|
89
|
+
* @param psoMapping Optional mapping of shipment status to order status (e.g., { "shipped": "processing" })
|
|
90
|
+
*/
|
|
91
|
+
function registerShipmentStatus(
|
|
92
|
+
id: string,
|
|
93
|
+
detail: ShipmentStatus,
|
|
94
|
+
psoMapping?: Record<string, string>
|
|
95
|
+
) {
|
|
96
|
+
// Make sure ID is not empty and does not contain spaces
|
|
97
|
+
if (!id || /\s/.test(id)) {
|
|
98
|
+
throw new Error(
|
|
99
|
+
'Shipment status ID must be a non-empty string without spaces.'
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
const statusConfig = {
|
|
103
|
+
order: {
|
|
104
|
+
shipmentStatus: {
|
|
105
|
+
[id]: detail
|
|
106
|
+
},
|
|
107
|
+
psoMapping: psoMapping
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
config.util.setModuleDefaults('oms', statusConfig);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Registers a new order status in the system. This function must be called during the application initialization phase (e.g., in a module's `bootstrap` function).
|
|
115
|
+
* @param id Unique identifier for the order status (e.g., "processing", "completed")
|
|
116
|
+
* @param detail Object containing details about the order status (name, badge, next statuses, etc.)
|
|
117
|
+
*/
|
|
118
|
+
function registerOrderStatus(id: string, detail: OrderStatus) {
|
|
119
|
+
// Make sure ID is not empty and does not contain spaces
|
|
120
|
+
if (!id || /\s/.test(id)) {
|
|
121
|
+
throw new Error(
|
|
122
|
+
'Order status ID must be a non-empty string without spaces.'
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
const statusConfig = {
|
|
126
|
+
order: {
|
|
127
|
+
status: {
|
|
128
|
+
[id]: { ...detail }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
config.util.setModuleDefaults('oms', statusConfig);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Registers a mapping of payment status and shipment status to order status. This function must be called during the application initialization phase (e.g., in a module's `bootstrap` function).
|
|
136
|
+
* @param paymentStatus Payment status ID or "*" to match any payment status
|
|
137
|
+
* @param shipmentStatus Shipment status ID or "*" to match any shipment status
|
|
138
|
+
* @param orderStatus Order status ID to map to when the payment status and shipment status match the provided values
|
|
139
|
+
*/
|
|
140
|
+
function registerPSOStatusMapping(
|
|
141
|
+
paymentStatus: string | '*',
|
|
142
|
+
shipmentStatus: string | '*',
|
|
143
|
+
orderStatus: string
|
|
144
|
+
) {
|
|
145
|
+
addProcessor('psoMapping', async (mapping: Record<string, string>) => {
|
|
146
|
+
mapping[`${paymentStatus}:${shipmentStatus}`] = orderStatus;
|
|
147
|
+
return mapping;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
getOrderStatusList,
|
|
153
|
+
getShipmentStatusList,
|
|
154
|
+
getPaymentStatusList,
|
|
155
|
+
registerPaymentStatus,
|
|
156
|
+
registerShipmentStatus,
|
|
157
|
+
registerOrderStatus,
|
|
158
|
+
registerPSOStatusMapping
|
|
159
|
+
};
|
|
@@ -15,7 +15,9 @@ import Topo from '@hapi/topo';
|
|
|
15
15
|
import { error } from '../../../lib/log/logger.js';
|
|
16
16
|
import { pool } from '../../../lib/postgres/connection.js';
|
|
17
17
|
import { getConfig } from '../../../lib/util/getConfig.js';
|
|
18
|
-
import { hookable } from '../../../lib/util/hookable.js';
|
|
18
|
+
import { hookable, hookAfter, hookBefore } from '../../../lib/util/hookable.js';
|
|
19
|
+
import { getValueSync } from '../../../lib/util/registry.js';
|
|
20
|
+
import { OrderRow } from '../../../types/db/index.js';
|
|
19
21
|
import { PaymentStatus, ShipmentStatus } from '../../../types/order.js';
|
|
20
22
|
|
|
21
23
|
function getOrderStatusFlow() {
|
|
@@ -58,12 +60,13 @@ export function resolveOrderStatus(
|
|
|
58
60
|
'Either shipment status or payment status is invalid. Can not update order status'
|
|
59
61
|
);
|
|
60
62
|
}
|
|
63
|
+
const finalPsoMapping = getValueSync('psoMapping', psoMapping, {});
|
|
61
64
|
// Reverse the order status list to get the highest priority status first
|
|
62
65
|
const nextStatus =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
finalPsoMapping[`${paymentStatus}:${shipmentStatus}`] ||
|
|
67
|
+
finalPsoMapping[`*:${shipmentStatus}`] ||
|
|
68
|
+
finalPsoMapping[`${paymentStatus}:*`] ||
|
|
69
|
+
finalPsoMapping['*:*'];
|
|
67
70
|
if (!nextStatus || !orderStatusList[nextStatus]) {
|
|
68
71
|
throw new Error(
|
|
69
72
|
'Can not found a valid order status from the current shipment and payment status'
|
|
@@ -72,6 +75,14 @@ export function resolveOrderStatus(
|
|
|
72
75
|
return nextStatus;
|
|
73
76
|
}
|
|
74
77
|
|
|
78
|
+
/**
|
|
79
|
+
* This function means to be private and should not be called outside of this module. It will not perform any validation and directly update the order status.
|
|
80
|
+
* You should consider updating the payment status and shipment status only, and let the system to update the order status automatically.
|
|
81
|
+
*
|
|
82
|
+
* @param orderId
|
|
83
|
+
* @param status
|
|
84
|
+
* @param connection
|
|
85
|
+
*/
|
|
75
86
|
async function updateOrderStatus(
|
|
76
87
|
orderId: number,
|
|
77
88
|
status: string,
|
|
@@ -95,7 +106,7 @@ async function addOrderStatusChangeEvents(
|
|
|
95
106
|
.given({
|
|
96
107
|
name: 'order_status_updated',
|
|
97
108
|
data: {
|
|
98
|
-
|
|
109
|
+
orderId: orderId,
|
|
99
110
|
before,
|
|
100
111
|
after
|
|
101
112
|
}
|
|
@@ -110,13 +121,17 @@ export async function changeOrderStatus(
|
|
|
110
121
|
) {
|
|
111
122
|
const statusFlow = getOrderStatusFlow();
|
|
112
123
|
const connection = conn || (await getConnection(pool));
|
|
113
|
-
const order = await select()
|
|
124
|
+
const order = (await select()
|
|
114
125
|
.from('order')
|
|
115
126
|
.where('order_id', '=', orderId)
|
|
116
|
-
.load(connection, false);
|
|
127
|
+
.load(connection, false)) as OrderRow | null;
|
|
117
128
|
if (!order) {
|
|
118
129
|
throw new Error('Order not found');
|
|
119
130
|
}
|
|
131
|
+
|
|
132
|
+
if (order.status === status) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
120
135
|
// Do not allow to revert the status
|
|
121
136
|
if (statusFlow.indexOf(order.status) > statusFlow.indexOf(status)) {
|
|
122
137
|
throw new Error('Can not revert the status of the order');
|
|
@@ -135,7 +150,12 @@ export async function changeOrderStatus(
|
|
|
135
150
|
await hookable(addOrderStatusChangeEvents, {
|
|
136
151
|
order,
|
|
137
152
|
status
|
|
138
|
-
})(
|
|
153
|
+
})(
|
|
154
|
+
order.order_id,
|
|
155
|
+
order.status ? order.status.toString() : 'unknown',
|
|
156
|
+
status,
|
|
157
|
+
connection
|
|
158
|
+
);
|
|
139
159
|
|
|
140
160
|
if (!conn) {
|
|
141
161
|
await commit(connection);
|
|
@@ -148,3 +168,75 @@ export async function changeOrderStatus(
|
|
|
148
168
|
throw err;
|
|
149
169
|
}
|
|
150
170
|
}
|
|
171
|
+
|
|
172
|
+
export function hookBeforeUpdateOrderStatus(
|
|
173
|
+
callback: (
|
|
174
|
+
this: {
|
|
175
|
+
order: OrderRow;
|
|
176
|
+
status: string;
|
|
177
|
+
},
|
|
178
|
+
...args: [
|
|
179
|
+
orderId: number,
|
|
180
|
+
status: string,
|
|
181
|
+
connection: PoolClient,
|
|
182
|
+
...args: any[]
|
|
183
|
+
]
|
|
184
|
+
) => void | Promise<void>,
|
|
185
|
+
priority: number = 10
|
|
186
|
+
): void {
|
|
187
|
+
hookBefore('updateOrderStatus', callback, priority);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function hookAfterUpdateOrderStatus(
|
|
191
|
+
callback: (
|
|
192
|
+
this: {
|
|
193
|
+
order: OrderRow;
|
|
194
|
+
status: string;
|
|
195
|
+
},
|
|
196
|
+
...args: [
|
|
197
|
+
orderId: number,
|
|
198
|
+
status: string,
|
|
199
|
+
connection: PoolClient,
|
|
200
|
+
...args: any[]
|
|
201
|
+
]
|
|
202
|
+
) => void | Promise<void>,
|
|
203
|
+
priority: number = 10
|
|
204
|
+
): void {
|
|
205
|
+
hookAfter('updateOrderStatus', callback, priority);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function hookBeforeAddOrderStatusChangeEvents(
|
|
209
|
+
callback: (
|
|
210
|
+
this: {
|
|
211
|
+
order: OrderRow;
|
|
212
|
+
status: string;
|
|
213
|
+
},
|
|
214
|
+
...args: [
|
|
215
|
+
orderId: number,
|
|
216
|
+
before: string,
|
|
217
|
+
after: string,
|
|
218
|
+
connection: PoolClient
|
|
219
|
+
]
|
|
220
|
+
) => void | Promise<void>,
|
|
221
|
+
priority: number = 10
|
|
222
|
+
): void {
|
|
223
|
+
hookBefore('addOrderStatusChangeEvents', callback, priority);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function hookAfterAddOrderStatusChangeEvents(
|
|
227
|
+
callback: (
|
|
228
|
+
this: {
|
|
229
|
+
order: OrderRow;
|
|
230
|
+
status: string;
|
|
231
|
+
},
|
|
232
|
+
...args: [
|
|
233
|
+
orderId: number,
|
|
234
|
+
before: string,
|
|
235
|
+
after: string,
|
|
236
|
+
connection: PoolClient
|
|
237
|
+
]
|
|
238
|
+
) => void | Promise<void>,
|
|
239
|
+
priority: number = 10
|
|
240
|
+
): void {
|
|
241
|
+
hookAfter('addOrderStatusChangeEvents', callback, priority);
|
|
242
|
+
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { error } from '../../../lib/log/logger.js';
|
|
10
10
|
import { pool } from '../../../lib/postgres/connection.js';
|
|
11
11
|
import { getConfig } from '../../../lib/util/getConfig.js';
|
|
12
|
-
import { hookable } from '../../../lib/util/hookable.js';
|
|
12
|
+
import { hookable, hookBefore, hookAfter } from '../../../lib/util/hookable.js';
|
|
13
13
|
import { PaymentStatus } from '../../../types/order.js';
|
|
14
14
|
|
|
15
15
|
function validatePaymentStatusBeforeUpdate(status: string): boolean {
|
|
@@ -64,3 +64,55 @@ export const updatePaymentStatus = async (
|
|
|
64
64
|
throw err;
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
+
|
|
68
|
+
export function hookBeforeValidatePaymentStatusBeforeUpdate(
|
|
69
|
+
callback: (
|
|
70
|
+
this: { orderId: number },
|
|
71
|
+
...args: [
|
|
72
|
+
status: string
|
|
73
|
+
]
|
|
74
|
+
) => void | Promise<void>,
|
|
75
|
+
priority: number = 10
|
|
76
|
+
): void {
|
|
77
|
+
hookBefore('validatePaymentStatusBeforeUpdate', callback, priority);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function hookAfterValidatePaymentStatusBeforeUpdate(
|
|
81
|
+
callback: (
|
|
82
|
+
this: { orderId: number },
|
|
83
|
+
...args: [
|
|
84
|
+
status: string
|
|
85
|
+
]
|
|
86
|
+
) => void | Promise<void>,
|
|
87
|
+
priority: number = 10
|
|
88
|
+
): void {
|
|
89
|
+
hookAfter('validatePaymentStatusBeforeUpdate', callback, priority);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function hookBeforeChangePaymentStatus(
|
|
93
|
+
callback: (
|
|
94
|
+
this: { orderId: number; status: string },
|
|
95
|
+
...args: [
|
|
96
|
+
orderId: number,
|
|
97
|
+
status: string,
|
|
98
|
+
connection: PoolClient
|
|
99
|
+
]
|
|
100
|
+
) => void | Promise<void>,
|
|
101
|
+
priority: number = 10
|
|
102
|
+
): void {
|
|
103
|
+
hookBefore('changePaymentStatus', callback, priority);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function hookAfterChangePaymentStatus(
|
|
107
|
+
callback: (
|
|
108
|
+
this: { orderId: number; status: string },
|
|
109
|
+
...args: [
|
|
110
|
+
orderId: number,
|
|
111
|
+
status: string,
|
|
112
|
+
connection: PoolClient
|
|
113
|
+
]
|
|
114
|
+
) => void | Promise<void>,
|
|
115
|
+
priority: number = 10
|
|
116
|
+
): void {
|
|
117
|
+
hookAfter('changePaymentStatus', callback, priority);
|
|
118
|
+
}
|