@evershop/evershop 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (519) hide show
  1. package/bin/build/client/index.js +1 -1
  2. package/bin/build/complie.js +1 -1
  3. package/bin/build/index.js +25 -1
  4. package/bin/build/server/index.js +1 -1
  5. package/bin/build/server/useDDL.js +1 -1
  6. package/bin/dev/index.js +2 -1
  7. package/bin/evershop +8 -7
  8. package/bin/extension/index.js +3 -3
  9. package/bin/install/index.js +1 -1
  10. package/bin/lib/addDefaultMiddlewareFuncs.js +9 -4
  11. package/bin/lib/app.js +1 -1
  12. package/bin/lib/bootstrap/migrate.js +1 -1
  13. package/bin/lib/buildEntry.js +16 -1
  14. package/bin/lib/onError.js +1 -1
  15. package/bin/lib/onListening.js +7 -4
  16. package/bin/lib/startUp.js +16 -9
  17. package/bin/lib/watch/watchComponents.js +16 -26
  18. package/bin/lib/watch/watchMF.js +1 -1
  19. package/bin/lib/watch/watchMR.js +1 -1
  20. package/bin/lib/watch/watchSchema.js +1 -1
  21. package/bin/user/changePassword.js +1 -1
  22. package/bin/user/create.js +1 -1
  23. package/package.json +10 -2
  24. package/src/components/admin/catalog/productEdit/category/CategoryItem.jsx +3 -8
  25. package/src/components/admin/catalog/productEdit/category/CategoryTree.jsx +15 -8
  26. package/src/components/admin/catalog/productEdit/category/CategoryTree.scss +10 -0
  27. package/src/components/admin/catalog/productEdit/variants/CreateVariant.jsx +2 -2
  28. package/src/components/admin/catalog/productEdit/variants/CreateVariantGroup.jsx +4 -9
  29. package/src/components/admin/catalog/productEdit/variants/EditVariant.jsx +1 -1
  30. package/src/components/admin/catalog/productEdit/variants/New.jsx +2 -2
  31. package/src/components/admin/catalog/productEdit/variants/Search.jsx +1 -1
  32. package/src/components/admin/catalog/productEdit/variants/SearchModal.jsx +1 -1
  33. package/src/components/admin/catalog/productEdit/variants/Variant.jsx +1 -1
  34. package/src/components/admin/catalog/productEdit/variants/VariantModal.jsx +68 -12
  35. package/src/components/admin/catalog/productEdit/variants/Variants.jsx +1 -1
  36. package/src/components/admin/catalog/productGrid/rows/ThumbnailRow.jsx +1 -1
  37. package/src/components/admin/checkout/shippingSetting/Method.jsx +130 -0
  38. package/src/components/admin/{oms → checkout}/shippingSetting/MethodForm.jsx +127 -16
  39. package/src/components/admin/{oms → checkout}/shippingSetting/Methods.jsx +5 -5
  40. package/src/components/admin/checkout/shippingSetting/PriceBasedPrice.jsx +101 -0
  41. package/src/components/admin/checkout/shippingSetting/WeightBasedPrice.jsx +101 -0
  42. package/src/components/admin/{oms → checkout}/shippingSetting/Zone.jsx +40 -10
  43. package/src/components/admin/{oms → checkout}/shippingSetting/ZoneForm.jsx +1 -1
  44. package/src/components/admin/{oms → checkout}/shippingSetting/Zones.jsx +6 -3
  45. package/src/components/admin/cms/Card.jsx +3 -3
  46. package/src/components/admin/cms/PageHeading.jsx +3 -3
  47. package/src/components/admin/cms/widget/WidgetTypes.jsx +28 -0
  48. package/src/components/admin/cms/widget/grid/WidgetTypeRow.jsx +29 -0
  49. package/src/components/admin/oms/orderEdit/items/ItemVariantOptions.jsx +1 -1
  50. package/src/components/admin/oms/orderEdit/items/Name.jsx +1 -1
  51. package/src/components/admin/oms/orderGrid/headers/OrderDateColumnHeader.jsx +1 -1
  52. package/src/components/admin/promotion/couponEdit/AttributeGroupSelector.jsx +8 -8
  53. package/src/components/admin/promotion/couponEdit/BuyXGetY.jsx +2 -2
  54. package/src/components/admin/promotion/couponEdit/CategorySelector.jsx +10 -10
  55. package/src/components/admin/promotion/couponEdit/CollectionSelector.jsx +8 -8
  56. package/src/components/admin/promotion/couponEdit/ProductSkuSelector.jsx +30 -9
  57. package/src/components/admin/promotion/couponEdit/RequireProducts.jsx +2 -2
  58. package/src/components/admin/promotion/couponEdit/Setting.jsx +1 -1
  59. package/src/components/admin/promotion/couponEdit/TargetProducts.jsx +4 -4
  60. package/src/components/admin/tax/taxSetting/Rate.jsx +6 -6
  61. package/src/components/admin/tax/taxSetting/RateForm.jsx +5 -5
  62. package/src/components/admin/tax/taxSetting/Rates.jsx +6 -6
  63. package/src/components/admin/tax/taxSetting/TaxClass.jsx +3 -3
  64. package/src/components/admin/tax/taxSetting/TaxClassForm.jsx +1 -1
  65. package/src/components/admin/widgets/BasicMenuSetting.jsx +614 -0
  66. package/src/components/admin/widgets/BasicMenuSetting.scss +19 -0
  67. package/src/components/admin/widgets/CollectionProductsSetting.jsx +203 -0
  68. package/src/components/admin/widgets/TextBlockSetting.jsx +70 -0
  69. package/src/components/common/Area.jsx +31 -8
  70. package/src/components/common/Badge.jsx +1 -1
  71. package/src/components/common/Editor.jsx +191 -0
  72. package/src/components/common/Notification.scss +1 -0
  73. package/src/components/common/SimplePagination.jsx +2 -2
  74. package/src/components/common/context/checkout.jsx +8 -14
  75. package/src/components/common/form/Field.jsx +1 -1
  76. package/src/components/common/form/Form.jsx +1 -1
  77. package/src/components/common/form/fields/Checkbox.jsx +1 -1
  78. package/src/components/common/form/fields/Ckeditor.jsx +11 -11
  79. package/src/components/common/form/fields/Editor.jsx +326 -0
  80. package/src/components/common/form/fields/Editor.scss +29 -0
  81. package/src/components/common/form/fields/Input.jsx +2 -1
  82. package/src/components/common/form/fields/Radio.jsx +1 -1
  83. package/src/components/common/form/fields/editor/FileBrowser.jsx +419 -0
  84. package/src/components/common/form/fields/editor/FileBrowser.scss +37 -0
  85. package/src/components/common/form/fields/editor/GetColumnClasses.jsx +14 -0
  86. package/src/components/common/form/fields/editor/GetRowClasses.jsx +18 -0
  87. package/src/components/common/form/fields/editor/RowTemplates.jsx +154 -0
  88. package/src/components/common/form/validator.js +6 -2
  89. package/src/components/common/grid/Pagination.jsx +4 -4
  90. package/src/components/common/grid/headers/Dummy.jsx +1 -1
  91. package/src/components/common/grid/headers/FromTo.jsx +1 -1
  92. package/src/components/common/grid/headers/Sortable.jsx +148 -0
  93. package/src/components/common/grid/rows/StatusRow.jsx +1 -1
  94. package/src/components/common/grid/rows/ThumbnailRow.jsx +1 -1
  95. package/src/components/common/list/Filter.jsx +83 -0
  96. package/src/components/common/list/Filter.scss +39 -0
  97. package/src/components/common/modal/Alert.jsx +1 -1
  98. package/src/components/common/modal/Modal.jsx +1 -1
  99. package/src/components/frontStore/catalog/categoryView/filter/AttributeFilter.jsx +21 -7
  100. package/src/components/frontStore/catalog/categoryView/filter/CategoryFilter.jsx +61 -53
  101. package/src/components/frontStore/catalog/categoryView/filter/CategoryFilter.scss +5 -0
  102. package/src/components/frontStore/catalog/categoryView/filter/PriceFilter.jsx +20 -11
  103. package/src/components/frontStore/catalog/product/list/List.jsx +4 -4
  104. package/src/components/frontStore/catalog/product/list/Pagination.jsx +1 -1
  105. package/src/components/frontStore/catalog/product/list/SortOptions.jsx +4 -2
  106. package/src/components/frontStore/catalog/product/list/Sorting.jsx +7 -7
  107. package/src/components/frontStore/catalog/product/list/item/Name.jsx +1 -1
  108. package/src/components/frontStore/checkout/cart/Empty.jsx +3 -3
  109. package/src/components/frontStore/checkout/cart/items/ItemOptions.jsx +1 -1
  110. package/src/components/frontStore/checkout/cart/items/ItemVariantOptions.jsx +1 -1
  111. package/src/components/frontStore/checkout/cart/items/Items.jsx +20 -21
  112. package/src/components/frontStore/checkout/cart/items/Items.scss +47 -0
  113. package/src/components/frontStore/checkout/cart/items/Quantity.jsx +154 -0
  114. package/src/components/frontStore/checkout/checkout/StepTitle.jsx +1 -1
  115. package/src/components/frontStore/checkout/checkout/payment/paymentStep/StepContent.jsx +13 -10
  116. package/src/components/frontStore/checkout/checkout/shipment/StepContent.jsx +1 -1
  117. package/src/components/frontStore/checkout/checkout/summary/Cart.jsx +10 -12
  118. package/src/components/frontStore/checkout/checkout/summary/Items.jsx +9 -9
  119. package/src/components/frontStore/checkout/checkout/summary/cart/Total.jsx +6 -6
  120. package/src/components/frontStore/checkout/success/summary/items/ItemOptions.jsx +1 -1
  121. package/src/components/frontStore/checkout/success/summary/items/Items.jsx +9 -6
  122. package/src/components/frontStore/checkout/success/summary/order/OrderSummary.jsx +9 -13
  123. package/src/components/frontStore/checkout/success/summary/order/Total.jsx +5 -5
  124. package/src/components/frontStore/customer/address/addressForm/AddressFormLoadingSkeleton.jsx +2 -2
  125. package/src/components/frontStore/customer/address/addressForm/NameAndTelephone.jsx +1 -1
  126. package/src/components/frontStore/customer/address/addressForm/ProvinceAndPostcode.jsx +1 -1
  127. package/src/components/frontStore/customer/checkout/Edit.jsx +2 -2
  128. package/src/components/frontStore/customer/detail/Order.jsx +4 -4
  129. package/src/components/frontStore/stripe/checkout/CheckoutForm.jsx +9 -5
  130. package/src/components/frontStore/stripe/checkout/TestCards.jsx +1 -1
  131. package/src/components/frontStore/widgets/BasicMenu.jsx +129 -0
  132. package/src/{modules/catalog/pages/frontStore/homepage/FeaturedProducts.jsx → components/frontStore/widgets/CollectionProducts.jsx} +40 -32
  133. package/src/components/frontStore/widgets/TextBlock.jsx +46 -0
  134. package/src/lib/componee/getComponentsByRoute.js +15 -2
  135. package/src/lib/event/callSubscibers.js +14 -11
  136. package/src/lib/event/event-manager.js +2 -2
  137. package/src/lib/event/loadSubscribers.js +2 -2
  138. package/src/lib/helpers.js +3 -1
  139. package/src/lib/log/CustomColorize.js +22 -0
  140. package/src/lib/log/logger.js +153 -19
  141. package/src/lib/middleware/Handler.js +2 -3
  142. package/src/lib/middleware/async.js +5 -9
  143. package/src/lib/middleware/sync.js +5 -10
  144. package/src/lib/middleware/tests/app/app.js +1 -1
  145. package/src/lib/middleware/tests/app/modules/404page/pages/frontStore/product/route.json +2 -1
  146. package/src/lib/middlewares/static.js +3 -1
  147. package/src/lib/response/render.js +5 -6
  148. package/src/lib/router/Router.js +1 -1
  149. package/src/lib/router/buildAbsoluteUrl.js +1 -1
  150. package/src/lib/router/loadModuleRoutes.js +3 -0
  151. package/src/lib/router/registerAdminRoute.js +9 -1
  152. package/src/lib/router/registerFrontStoreRoute.js +2 -0
  153. package/src/lib/router/scanForRoutes.js +1 -0
  154. package/src/lib/router/tests/unit/unit.validateRoute.test.js +7 -1
  155. package/src/lib/util/buildFilterFromUrl.js +31 -64
  156. package/src/lib/util/defaultPaginationFilters.js +104 -0
  157. package/src/lib/util/filterOperationMapp.js +16 -0
  158. package/src/lib/util/getEnabledWidgets.js +28 -0
  159. package/src/lib/util/merge.js +67 -14
  160. package/src/lib/util/registry.js +44 -6
  161. package/src/lib/util/tests/unit/util.merge.test.js +21 -4
  162. package/src/lib/util/validateConfiguration.js +83 -0
  163. package/src/lib/webpack/createBaseConfig.js +4 -1
  164. package/src/lib/webpack/dev/createConfigClient.js +12 -2
  165. package/src/lib/webpack/loaders/AreaLoader.js +15 -4
  166. package/src/lib/webpack/loaders/loadTranslationFromCsv.js +1 -1
  167. package/src/lib/webpack/plugins/Tailwindcss.js +1 -1
  168. package/src/lib/webpack/util/parseGraphql.js +29 -16
  169. package/src/lib/webpack/util/parseGraphqlByFile.js +16 -2
  170. package/src/modules/auth/graphql/types/AdminUser/AdminUser.admin.resolvers.js +6 -6
  171. package/src/modules/auth/pages/admin/adminLogin/LoginForm.jsx +55 -36
  172. package/src/modules/auth/pages/admin/all/AdminUser.jsx +3 -3
  173. package/src/modules/base/api/global/[apiResponse]apiErrorHandler.js +2 -2
  174. package/src/modules/base/bootstrap.js +79 -0
  175. package/src/modules/base/graphql/types/Route/Route.admin.graphql +15 -0
  176. package/src/modules/base/graphql/types/Route/Route.admin.resolvers.js +10 -0
  177. package/src/modules/base/pages/global/[response]errorHandler.js +2 -2
  178. package/src/modules/base/pages/global/response[errorHandler].js +23 -0
  179. package/src/modules/catalog/api/addProductToCategory/addProducts.js +1 -1
  180. package/src/modules/catalog/api/addProductToCollection/addProducts.js +35 -22
  181. package/src/modules/catalog/api/removeProductFromCollection/removeProducts.js +20 -5
  182. package/src/modules/catalog/bootstrap.js +188 -5
  183. package/src/modules/catalog/graphql/types/Attribute/Attribute.admin.graphql +2 -2
  184. package/src/modules/catalog/graphql/types/Attribute/Attribute.admin.resolvers.js +48 -276
  185. package/src/modules/catalog/graphql/types/Category/Category.graphql +19 -5
  186. package/src/modules/catalog/graphql/types/Category/Category.resolvers.js +36 -2
  187. package/src/modules/catalog/graphql/types/Collection/Collection.graphql +2 -2
  188. package/src/modules/catalog/graphql/types/Collection/Collection.resolvers.js +36 -2
  189. package/src/modules/catalog/graphql/types/Product/Attribute/ProductAttribute.resolvers.js +1 -0
  190. package/src/modules/catalog/graphql/types/Product/Product.graphql +1 -1
  191. package/src/modules/catalog/graphql/types/Product/Product.resolvers.js +35 -1
  192. package/src/modules/catalog/graphql/types/Product/Variant/Variant.graphql +2 -2
  193. package/src/modules/catalog/graphql/types/Product/Variant/Variant.resolvers.js +68 -92
  194. package/src/modules/catalog/graphql/types/Widget/CollectionProductsWidget/CollectionProductsWidget.graphql +11 -0
  195. package/src/modules/catalog/graphql/types/Widget/CollectionProductsWidget/CollectionProductsWidget.resolvers.js +8 -0
  196. package/src/modules/catalog/migration/Version-1.0.0.js +1 -0
  197. package/src/modules/catalog/migration/Version-1.0.7.js +10 -0
  198. package/src/modules/catalog/pages/admin/attributeEdit+attributeNew/FormContent.jsx +4 -4
  199. package/src/modules/catalog/pages/admin/attributeEdit+attributeNew/General.jsx +18 -14
  200. package/src/modules/catalog/pages/admin/attributeGrid/Grid.jsx +84 -41
  201. package/src/modules/catalog/pages/admin/attributeGrid/index.js +1 -1
  202. package/src/modules/catalog/pages/admin/categoryEdit/Products.jsx +9 -9
  203. package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/FormContent.jsx +4 -4
  204. package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/General.jsx +16 -18
  205. package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/Image.jsx +1 -2
  206. package/src/modules/catalog/pages/admin/categoryEdit+categoryNew/Status.jsx +16 -1
  207. package/src/modules/catalog/pages/admin/categoryGrid/Grid.jsx +50 -18
  208. package/src/modules/catalog/pages/admin/categoryGrid/index.js +1 -1
  209. package/src/modules/catalog/pages/admin/collectionEdit/Products.jsx +9 -9
  210. package/src/modules/catalog/pages/admin/collectionEdit+collectionNew/FormContent.jsx +2 -2
  211. package/src/modules/catalog/pages/admin/collectionEdit+collectionNew/General.jsx +2 -2
  212. package/src/modules/catalog/pages/admin/collectionGrid/Grid.jsx +48 -7
  213. package/src/modules/catalog/pages/admin/collectionGrid/index.js +1 -1
  214. package/src/modules/catalog/pages/admin/productEdit/Collection.jsx +7 -7
  215. package/src/modules/catalog/pages/admin/productEdit+productNew/Attributes.jsx +29 -25
  216. package/src/modules/catalog/pages/admin/productEdit+productNew/CustomOptions.jsss +4 -4
  217. package/src/modules/catalog/pages/admin/productEdit+productNew/FormContent.jsx +4 -4
  218. package/src/modules/catalog/pages/admin/productEdit+productNew/General.jsx +15 -17
  219. package/src/modules/catalog/pages/admin/productGrid/Grid.jsx +160 -28
  220. package/src/modules/catalog/pages/admin/productGrid/index.js +1 -2
  221. package/src/modules/catalog/pages/frontStore/all/SearchBox.jsx +2 -1
  222. package/src/modules/catalog/pages/frontStore/catalogSearch/General.jsx +2 -2
  223. package/src/modules/catalog/pages/frontStore/catalogSearch/Products.jsx +1 -1
  224. package/src/modules/catalog/pages/frontStore/catalogSearch/[index]filters.js +4 -59
  225. package/src/modules/catalog/pages/frontStore/catalogSearch/index.js +11 -0
  226. package/src/modules/catalog/pages/frontStore/catalogSearch/route.json +2 -1
  227. package/src/modules/catalog/pages/frontStore/categoryView/CategoryView.jsx +19 -2
  228. package/src/modules/catalog/pages/frontStore/categoryView/Filter.jsx +22 -6
  229. package/src/modules/catalog/pages/frontStore/categoryView/Filter.scss +3 -0
  230. package/src/modules/catalog/pages/frontStore/categoryView/General.jsx +6 -8
  231. package/src/modules/catalog/pages/frontStore/categoryView/General.scss +0 -2
  232. package/src/modules/catalog/pages/frontStore/categoryView/Pagination.jsx +6 -0
  233. package/src/modules/catalog/pages/frontStore/categoryView/Products.jsx +8 -1
  234. package/src/modules/catalog/pages/frontStore/categoryView/[index]filters.js +5 -105
  235. package/src/modules/catalog/pages/frontStore/categoryView/route.json +2 -1
  236. package/src/modules/catalog/pages/frontStore/productView/Description.jsx +3 -3
  237. package/src/modules/catalog/pages/frontStore/productView/Form.jsx +12 -7
  238. package/src/modules/catalog/pages/frontStore/productView/Form.scss +1 -0
  239. package/src/modules/catalog/pages/frontStore/productView/GeneralInfo.jsx +1 -1
  240. package/src/modules/catalog/pages/frontStore/productView/Images.jsx +1 -1
  241. package/src/modules/catalog/pages/frontStore/productView/Layout.jsx +1 -1
  242. package/src/modules/catalog/pages/frontStore/productView/Options.jsx +2 -2
  243. package/src/modules/catalog/pages/frontStore/productView/Variants.jsx +106 -44
  244. package/src/modules/catalog/pages/frontStore/productView/route.json +2 -1
  245. package/src/modules/catalog/services/AttributeCollection.js +59 -0
  246. package/src/modules/catalog/services/AttributeGroupCollection.js +100 -0
  247. package/src/modules/catalog/services/CategoryCollection.js +26 -83
  248. package/src/modules/catalog/services/CollectionCollection.js +23 -71
  249. package/src/modules/catalog/services/ProductCollection.js +50 -216
  250. package/src/modules/catalog/services/attribute/deleteProductAttribute.js +15 -0
  251. package/src/modules/catalog/services/getAttributeGroupsBaseQuery.js +3 -0
  252. package/src/modules/catalog/services/getAttributesBaseQuery.js +3 -0
  253. package/src/modules/catalog/services/getCollectionsBaseQuery.js +0 -1
  254. package/src/modules/catalog/services/product/updateProduct.js +8 -2
  255. package/src/modules/catalog/services/registerCartItemProductUrlField.js +35 -0
  256. package/src/modules/catalog/services/registerCartItemVariantOptionsField.js +51 -0
  257. package/src/modules/catalog/services/registerDefaultAttributeCollectionFilters.js +149 -0
  258. package/src/modules/catalog/services/registerDefaultCategoryCollectionFilters.js +101 -0
  259. package/src/modules/catalog/services/registerDefaultCollectionCollectionFilters.js +65 -0
  260. package/src/modules/catalog/services/registerDefaultProductCollectionFilters.js +219 -0
  261. package/src/modules/catalog/subscribers/category_created/buildUrlRewrite.js +1 -1
  262. package/src/modules/catalog/subscribers/category_deleted/deleteUrlRewrite.js +1 -1
  263. package/src/modules/catalog/subscribers/category_updated/builUrlRewrite.js +1 -1
  264. package/src/modules/catalog/subscribers/product_created/builUrlRewrite.js +1 -1
  265. package/src/modules/catalog/subscribers/product_deleted/deleteUrlRewrite.js +1 -1
  266. package/src/modules/catalog/subscribers/product_image_added/localGenerateProductImageVariant.js +3 -3
  267. package/src/modules/checkout/api/addCartShippingMethod/saveShippingMethod.js +6 -1
  268. package/src/modules/checkout/api/addShippingNote/[context]bodyParser[auth].js +5 -0
  269. package/src/modules/checkout/api/addShippingNote/payloadSchema.json +15 -0
  270. package/src/modules/checkout/api/addShippingNote/route.json +5 -0
  271. package/src/modules/checkout/api/addShippingNote/saveShippingNote.js +50 -0
  272. package/src/modules/checkout/api/createCart/[context]bodyParser[auth].js +5 -0
  273. package/src/modules/checkout/api/createCart/createNewCart.js +119 -0
  274. package/src/modules/checkout/api/createCart/payloadSchema.json +44 -0
  275. package/src/modules/checkout/api/createCart/route.json +5 -0
  276. package/src/modules/checkout/api/deleteShippingZone/deleteShippingZone.js +58 -0
  277. package/src/modules/checkout/api/deleteShippingZone/route.json +5 -0
  278. package/src/modules/checkout/api/deleteShippingZoneMethod/deleteShippingZoneMethod.js +85 -0
  279. package/src/modules/checkout/api/deleteShippingZoneMethod/route.json +5 -0
  280. package/src/modules/checkout/api/getShippingMethods/sendMethods.js +37 -0
  281. package/src/modules/checkout/api/updateCartItemQty/[bodyParser]updateQty.js +49 -0
  282. package/src/modules/checkout/api/updateCartItemQty/[context]bodyParser[auth].js +5 -0
  283. package/src/modules/checkout/api/updateCartItemQty/payloadSchema.json +21 -0
  284. package/src/modules/checkout/api/updateCartItemQty/route.json +5 -0
  285. package/src/modules/checkout/api/updateMineCartItemQty/[context]bodyParser[auth].js +5 -0
  286. package/src/modules/checkout/api/updateMineCartItemQty/[detectCurrentCart]updateQty.js +51 -0
  287. package/src/modules/checkout/api/updateMineCartItemQty/[getCurrentCustomer]detectCurrentCart.js +32 -0
  288. package/src/modules/checkout/api/updateMineCartItemQty/payloadSchema.json +21 -0
  289. package/src/modules/checkout/api/updateMineCartItemQty/route.json +5 -0
  290. package/src/modules/checkout/api/updateShippingMethod/[context]borderParser[auth].js +5 -0
  291. package/src/modules/checkout/api/updateShippingMethod/payloadSchema.json +12 -0
  292. package/src/modules/checkout/api/updateShippingMethod/route.json +5 -0
  293. package/src/modules/checkout/api/updateShippingMethod/updateShippingMethod.js +64 -0
  294. package/src/modules/checkout/api/updateShippingZoneMethod/payloadSchema.json +43 -1
  295. package/src/modules/checkout/api/updateShippingZoneMethod/updateShippingZoneMethod.js +17 -3
  296. package/src/modules/checkout/bootstrap.js +28 -1
  297. package/src/modules/checkout/graphql/types/Cart/Cart.graphql +22 -3
  298. package/src/modules/checkout/graphql/types/Cart/Cart.resolvers.js +18 -2
  299. package/src/modules/checkout/graphql/types/CheckoutSetting/CheckoutSetting.graphql +3 -0
  300. package/src/modules/checkout/graphql/types/CheckoutSetting/CheckoutSetting.resolvers.js +7 -0
  301. package/src/modules/checkout/graphql/types/ShippingMethod/ShippingMethod.graphql +1 -0
  302. package/src/modules/checkout/graphql/types/ShippingMethod/ShippingMethod.resolvers.js +4 -0
  303. package/src/modules/checkout/graphql/types/ShippingZone/ShippingZone.graphql +21 -1
  304. package/src/modules/checkout/graphql/types/ShippingZone/ShippingZone.resolvers.js +34 -4
  305. package/src/modules/checkout/graphql/types/Weight/Weight.resolvers.js +8 -11
  306. package/src/modules/checkout/migration/Version-1.0.0.js +14 -0
  307. package/src/modules/checkout/migration/Version-1.0.5.js +28 -0
  308. package/src/modules/checkout/migration/Version-1.0.6.js +201 -0
  309. package/src/modules/{oms → checkout}/pages/admin/shippingSetting/ShippingSetting.jsx +67 -44
  310. package/src/modules/checkout/pages/frontStore/all/[auth]addCustomerToCart.js +3 -3
  311. package/src/modules/checkout/pages/frontStore/all/[context]detectCurrentCart[auth].js +5 -0
  312. package/src/modules/checkout/pages/frontStore/cart/ShoppingCart.jsx +17 -8
  313. package/src/modules/checkout/pages/frontStore/cart/Summary.jsx +18 -19
  314. package/src/modules/checkout/pages/frontStore/cart/route.json +2 -1
  315. package/src/modules/checkout/pages/frontStore/checkout/Checkout.jsx +5 -5
  316. package/src/modules/checkout/pages/frontStore/checkout/Checkout.scss +4 -0
  317. package/src/modules/checkout/pages/frontStore/checkout/PaymentStep.jsx +3 -2
  318. package/src/modules/checkout/pages/frontStore/checkout/ShippingMethods.jsx +25 -12
  319. package/src/modules/checkout/pages/frontStore/checkout/ShippingNote.jsx +105 -0
  320. package/src/modules/checkout/pages/frontStore/checkout/Summary.jsx +14 -14
  321. package/src/modules/checkout/pages/frontStore/checkout/SummaryMobile.jsx +129 -0
  322. package/src/modules/checkout/pages/frontStore/checkout/SummaryMobile.scss +7 -0
  323. package/src/modules/checkout/pages/frontStore/checkout/route.json +2 -1
  324. package/src/modules/checkout/pages/frontStore/checkoutSuccess/CheckoutSuccess.jsx +1 -1
  325. package/src/modules/checkout/pages/frontStore/checkoutSuccess/CheckoutSuccess.scss +4 -0
  326. package/src/modules/checkout/pages/frontStore/checkoutSuccess/CustomerInfo.jsx +30 -32
  327. package/src/modules/checkout/pages/frontStore/checkoutSuccess/ShippingNote.jsx +47 -0
  328. package/src/modules/checkout/pages/frontStore/checkoutSuccess/Summary.jsx +12 -15
  329. package/src/modules/checkout/pages/frontStore/checkoutSuccess/route.json +2 -1
  330. package/src/modules/checkout/services/cart/Cart.js +41 -21
  331. package/src/modules/checkout/services/cart/DataObject.js +3 -3
  332. package/src/modules/checkout/services/cart/registerCartBaseFields.js +165 -41
  333. package/src/modules/checkout/services/cart/registerCartItemBaseFields.js +300 -373
  334. package/src/modules/checkout/services/toPrice.js +1 -1
  335. package/src/modules/checkout/tests/basicSetup.js +85 -0
  336. package/src/modules/checkout/tests/coupons.js +82 -0
  337. package/src/modules/checkout/tests/products.js +67 -0
  338. package/src/modules/checkout/tests/taxRates.js +3 -0
  339. package/src/modules/checkout/tests/unit/discountAmount.test.js +60 -0
  340. package/src/modules/checkout/tests/unit/grandTotal.test.js +83 -0
  341. package/src/modules/checkout/tests/unit/lineTotal.test.js +90 -0
  342. package/src/modules/checkout/tests/unit/lineTotalWithDiscount.test.js +103 -0
  343. package/src/modules/checkout/tests/unit/productPrice.test.js +67 -0
  344. package/src/modules/checkout/tests/unit/subTotal.test.js +85 -0
  345. package/src/modules/checkout/tests/unit/subTotalWithDiscount.test.js +117 -0
  346. package/src/modules/checkout/tests/unit/taxAmount.test.js +67 -0
  347. package/src/modules/checkout/tests/unit/taxAmountRounding.test.js +277 -0
  348. package/src/modules/cms/api/createWidget/[context]bodyParser[auth].js +5 -0
  349. package/src/modules/cms/api/createWidget/createWidget[finish].js +17 -0
  350. package/src/modules/cms/api/createWidget/finish[apiResponse].js +27 -0
  351. package/src/modules/cms/api/createWidget/payloadSchema.json +18 -0
  352. package/src/modules/cms/api/createWidget/route.json +5 -0
  353. package/src/modules/cms/api/deleteWidget/deleteWidget.js +27 -0
  354. package/src/modules/cms/api/deleteWidget/route.json +5 -0
  355. package/src/modules/cms/api/updateWidget/[context]bodyParser[auth].js +5 -0
  356. package/src/modules/cms/api/updateWidget/finish[apiResponse].js +27 -0
  357. package/src/modules/cms/api/updateWidget/payloadSchema.json +18 -0
  358. package/src/modules/cms/api/updateWidget/route.json +5 -0
  359. package/src/modules/cms/api/updateWidget/updateWidget[finish].js +17 -0
  360. package/src/modules/cms/bootstrap.js +239 -2
  361. package/src/modules/cms/graphql/types/CmsPage/CmsPage.graphql +1 -2
  362. package/src/modules/cms/graphql/types/CmsPage/CmsPage.resolvers.js +37 -12
  363. package/src/modules/cms/graphql/types/Widget/Widget.graphql +91 -0
  364. package/src/modules/cms/graphql/types/Widget/Widget.resolvers.js +142 -0
  365. package/src/modules/cms/migration/Version-1.1.0.js +22 -0
  366. package/src/modules/cms/migration/Version-1.1.1.js +103 -0
  367. package/src/modules/cms/pages/admin/adminNotFound/NotFound.jsx +4 -4
  368. package/src/modules/cms/pages/admin/all/CmsMenuGroup.jsx +12 -4
  369. package/src/modules/cms/pages/admin/all/Layout.scss +3 -2
  370. package/src/modules/cms/pages/admin/all/Notification.scss +1 -1
  371. package/src/modules/cms/pages/admin/all/SearchBox.jsx +1 -1
  372. package/src/modules/cms/pages/admin/all/search/NoResult.jsx +2 -2
  373. package/src/modules/cms/pages/admin/all/search/Results.jsx +3 -3
  374. package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/FormContent.jsx +7 -9
  375. package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/General.jsx +3 -3
  376. package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/Seo.jsx +1 -1
  377. package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/Status.jsx +40 -0
  378. package/src/modules/cms/pages/admin/cmsPageGrid/Grid.jsx +64 -12
  379. package/src/modules/cms/pages/admin/cmsPageGrid/index.js +1 -2
  380. package/src/modules/cms/pages/admin/dashboard/Layout.jsx +3 -3
  381. package/src/modules/cms/pages/admin/widgetEdit/WidgetForm.jsx +52 -0
  382. package/src/modules/cms/pages/admin/widgetEdit/index.js +36 -0
  383. package/src/modules/cms/pages/admin/widgetEdit/route.json +4 -0
  384. package/src/modules/cms/pages/admin/widgetEdit+widgetNew/FormContent.jsx +69 -0
  385. package/src/modules/cms/pages/admin/widgetEdit+widgetNew/FormContent.scss +7 -0
  386. package/src/modules/cms/pages/admin/widgetEdit+widgetNew/General.jsx +185 -0
  387. package/src/modules/cms/pages/admin/widgetEdit+widgetNew/PageHeading.jsx +37 -0
  388. package/src/modules/cms/pages/admin/widgetEdit+widgetNew/Setting.jsx +55 -0
  389. package/src/modules/cms/pages/admin/widgetGrid/Grid.jsx +415 -0
  390. package/src/modules/cms/pages/admin/widgetGrid/Heading.jsx +11 -0
  391. package/src/modules/cms/pages/admin/widgetGrid/NewWidgetButton.jsx +52 -0
  392. package/src/modules/cms/pages/admin/widgetGrid/index.js +15 -0
  393. package/src/modules/cms/pages/admin/widgetGrid/route.json +4 -0
  394. package/src/modules/cms/pages/admin/widgetNew/WidgetNewForm.jsx +60 -0
  395. package/src/modules/cms/pages/admin/widgetNew/index.js +11 -0
  396. package/src/modules/cms/pages/admin/widgetNew/route.json +4 -0
  397. package/src/modules/cms/pages/admin/widgetNew/typeValidate.js +21 -0
  398. package/src/modules/cms/pages/frontStore/all/Breadcrumb.jsx +1 -1
  399. package/src/modules/cms/pages/frontStore/all/Footer.jsx +2 -2
  400. package/src/modules/cms/pages/frontStore/all/Layout.jsx +3 -3
  401. package/src/modules/cms/pages/frontStore/all/Layout.scss +13 -0
  402. package/src/modules/cms/pages/frontStore/all/Logo.jsx +2 -2
  403. package/src/modules/cms/pages/frontStore/all/Logo.scss +2 -4
  404. package/src/modules/cms/pages/frontStore/all/Notification.scss +1 -1
  405. package/src/modules/cms/pages/frontStore/cmsPageView/Layout.jsx +2 -2
  406. package/src/modules/cms/pages/frontStore/cmsPageView/View.jsx +5 -3
  407. package/src/modules/cms/pages/frontStore/cmsPageView/index.js +6 -12
  408. package/src/modules/cms/pages/frontStore/cmsPageView/route.json +2 -1
  409. package/src/modules/cms/pages/frontStore/homepage/route.json +2 -1
  410. package/src/modules/cms/pages/frontStore/notFound/NotFound.jsx +4 -4
  411. package/src/modules/cms/pages/frontStore/notFound/route.json +2 -1
  412. package/src/modules/cms/pages/frontStore/staticAsset/[context]staticAssets[auth].js +1 -1
  413. package/src/modules/cms/services/CMSPageCollection.js +23 -70
  414. package/src/modules/cms/services/WidgetCollection.js +62 -0
  415. package/src/modules/cms/services/getWidgetsBaseQuery.js +7 -0
  416. package/src/modules/cms/services/page/createPage.js +1 -2
  417. package/src/modules/cms/services/page/pageDataSchema.json +0 -4
  418. package/src/modules/cms/services/registerDefaultPageCollectionFilters.js +62 -0
  419. package/src/modules/cms/services/registerDefaultWidgetCollectionFilters.js +62 -0
  420. package/src/modules/cms/services/tailwind.admin.config.js +22 -102
  421. package/src/modules/cms/services/tailwind.frontStore.config.js +23 -108
  422. package/src/modules/cms/services/widget/createWidget.js +73 -0
  423. package/src/modules/cms/services/widget/deleteWidget.js +49 -0
  424. package/src/modules/cms/services/widget/loadWidgetInstances.js +54 -0
  425. package/src/modules/cms/services/widget/updateWidget.js +86 -0
  426. package/src/modules/cms/services/widget/widgetDataSchema.json +29 -0
  427. package/src/modules/cod/pages/admin/paymentSetting/CODSetting.jsx +2 -2
  428. package/src/modules/cod/pages/frontStore/checkout/CashOnDelivery.jsx +1 -1
  429. package/src/modules/customer/api/createCustomer/[bodyParser]createCustomer.js +2 -2
  430. package/src/modules/customer/api/resetPassword/[bodyParser]resetPassword.js +2 -2
  431. package/src/modules/customer/api/updatePassword/[bodyParser]updatePassword.js +2 -2
  432. package/src/modules/customer/bootstrap.js +50 -4
  433. package/src/modules/customer/graphql/types/Customer/Customer.admin.resolvers.js +2 -4
  434. package/src/modules/customer/pages/admin/customerEdit/CustomerEditForm.jsx +3 -3
  435. package/src/modules/customer/pages/admin/customerEdit+customerNew/OrderHistory.jsx +1 -1
  436. package/src/modules/customer/pages/admin/customerGrid/Grid.jsx +110 -16
  437. package/src/modules/customer/pages/admin/customerGrid/index.js +1 -2
  438. package/src/modules/customer/pages/frontStore/account/AccountDetails.jsx +3 -3
  439. package/src/modules/customer/pages/frontStore/account/Layout.jsx +3 -3
  440. package/src/modules/customer/pages/frontStore/account/OrderHistory.jsx +1 -1
  441. package/src/modules/customer/pages/frontStore/account/route.json +2 -1
  442. package/src/modules/customer/pages/frontStore/login/LoginForm.jsx +2 -3
  443. package/src/modules/customer/pages/frontStore/login/route.json +2 -1
  444. package/src/modules/customer/pages/frontStore/register/RegisterForm.jsx +2 -2
  445. package/src/modules/customer/pages/frontStore/register/route.json +2 -1
  446. package/src/modules/customer/pages/frontStore/resetPasswordPage/ResetPasswordForm.jsx +2 -2
  447. package/src/modules/customer/pages/frontStore/resetPasswordPage/route.json +2 -1
  448. package/src/modules/customer/pages/frontStore/updatePasswordPage/UpdatePasswordForm.jsx +3 -3
  449. package/src/modules/customer/pages/frontStore/updatePasswordPage/route.json +2 -1
  450. package/src/modules/customer/services/CustomerCollection.js +22 -103
  451. package/src/modules/customer/services/CustomerGroupCollection.js +20 -69
  452. package/src/modules/customer/services/registerDefaultCustomerCollectionFilters.js +90 -0
  453. package/src/modules/customer/services/registerDefaultCustomerGroupCollectionFilters.js +50 -0
  454. package/src/modules/graphql/pages/global/[bodyParser]buildQuery[graphql].js +239 -7
  455. package/src/modules/graphql/pages/global/[buildQuery]graphql[notification].js +13 -9
  456. package/src/modules/graphql/services/graphqlMiddleware.js +1 -1
  457. package/src/modules/oms/bootstrap.js +104 -3
  458. package/src/modules/oms/graphql/types/Order/Order.admin.resolvers.js +1 -1
  459. package/src/modules/oms/graphql/types/Order/Order.graphql +11 -2
  460. package/src/modules/oms/graphql/types/Order/Order.resolvers.js +9 -2
  461. package/src/modules/oms/pages/admin/dashboard/Bestsellers.jsx +2 -2
  462. package/src/modules/oms/pages/admin/dashboard/Lifetimesales.jsx +5 -5
  463. package/src/modules/oms/pages/admin/orderEdit/AddTrackingButton.jsx +1 -1
  464. package/src/modules/oms/pages/admin/orderEdit/Items.jsx +7 -7
  465. package/src/modules/oms/pages/admin/orderEdit/Layout.jsx +3 -3
  466. package/src/modules/oms/pages/admin/orderEdit/Payment.jsx +6 -6
  467. package/src/modules/oms/pages/admin/orderEdit/ShipButton.jsx +1 -1
  468. package/src/modules/oms/pages/admin/orderGrid/Grid.jsx +154 -53
  469. package/src/modules/oms/pages/admin/orderGrid/index.js +1 -2
  470. package/src/modules/oms/services/OrderCollection.js +18 -138
  471. package/src/modules/oms/services/registerDefaultOrderCollectionFilters.js +121 -0
  472. package/src/modules/paypal/api/paypalCreateOrder/[bodyParser]createOrder.js +55 -24
  473. package/src/modules/paypal/pages/admin/paymentSetting/PaypalSetting.jsx +6 -6
  474. package/src/modules/paypal/pages/frontStore/checkout/Paypal.jsx +3 -4
  475. package/src/modules/promotion/bootstrap.js +35 -101
  476. package/src/modules/promotion/graphql/types/Coupon/Coupon.admin.resolvers.js +2 -7
  477. package/src/modules/promotion/pages/admin/couponEdit+couponNew/DiscountType.jsx +1 -1
  478. package/src/modules/promotion/pages/admin/couponEdit+couponNew/FormContent.jsx +5 -5
  479. package/src/modules/promotion/pages/admin/couponGrid/Grid.jsx +159 -35
  480. package/src/modules/promotion/pages/admin/couponGrid/index.js +1 -2
  481. package/src/modules/promotion/pages/frontStore/cart/Coupon.jsx +2 -2
  482. package/src/modules/promotion/services/CouponCollection.js +21 -130
  483. package/src/modules/promotion/services/couponValidator.js +4 -7
  484. package/src/modules/promotion/services/discountCalculator.js +2 -7
  485. package/src/modules/promotion/services/registerCartItemPromotionFields.js +80 -0
  486. package/src/modules/promotion/services/registerCartPromotionFields.js +128 -0
  487. package/src/modules/promotion/services/registerDefaultCalculators.js +48 -20
  488. package/src/modules/promotion/services/registerDefaultCouponCollectionFilters.js +72 -0
  489. package/src/modules/promotion/services/registerDefaultValidators.js +16 -4
  490. package/src/modules/setting/pages/admin/paymentSetting/PaymentSetting.jsx +2 -2
  491. package/src/modules/setting/pages/admin/storeSetting/StoreSetting.jsx +98 -35
  492. package/src/modules/stripe/api/stripeWebHook/[bodyJson]webhook.js +4 -2
  493. package/src/modules/stripe/pages/admin/paymentSetting/StripePayment.jsx +5 -5
  494. package/src/modules/stripe/pages/frontStore/checkout/Stripe.jsx +1 -1
  495. package/src/modules/tax/bootstrap.js +57 -5
  496. package/src/modules/tax/graphql/types/Product/Price/ProductPrice.resolvers.js +6 -39
  497. package/src/modules/tax/graphql/types/TaxSetting/TaxSetting.graphql +1 -2
  498. package/src/modules/tax/graphql/types/TaxSetting/TaxSetting.resolvers.js +1 -8
  499. package/src/modules/tax/pages/admin/taxSetting/TaxSetting.jsx +4 -4
  500. package/src/modules/tax/services/TaxClassCollection.js +22 -56
  501. package/src/modules/tax/services/calculateTaxAmount.js +12 -9
  502. package/src/modules/tax/services/registerCartItemTaxPercentField.js +76 -0
  503. package/src/modules/tax/services/registerDefaultTaxClassCollectionFilters.js +49 -0
  504. package/src/components/admin/oms/shippingSetting/Method.jsx +0 -73
  505. package/src/components/common/grid/headers/Basic.jsx +0 -55
  506. package/src/lib/log/debuger.js +0 -89
  507. package/src/modules/auth/services/adminSessionMiddleware.js +0 -0
  508. package/src/modules/catalog/pages/frontStore/homepage/FeaturedCategories.jsx +0 -58
  509. package/src/modules/cms/pages/admin/cmsPageEdit+cmsPageNew/StatusAndLayout.jsx +0 -61
  510. package/src/modules/cms/pages/frontStore/all/Menu.jsx +0 -46
  511. package/src/modules/cms/pages/frontStore/all/Menu.scss +0 -7
  512. package/src/modules/cms/pages/frontStore/all/MobileMenu.jsx +0 -73
  513. package/src/modules/cms/pages/frontStore/all/MobileMenu.scss +0 -35
  514. package/src/modules/cms/pages/frontStore/homepage/MainBanner.jsx +0 -31
  515. package/src/modules/cms/pages/frontStore/homepage/MainBanner.scss +0 -48
  516. package/src/modules/customer/pages/frontStore/login/LoginButton.jsx +0 -27
  517. /package/src/modules/{oms → checkout}/pages/admin/all/ShippingSettingMenu.jsx +0 -0
  518. /package/src/modules/{oms → checkout}/pages/admin/shippingSetting/index.js +0 -0
  519. /package/src/modules/{oms → checkout}/pages/admin/shippingSetting/route.json +0 -0
@@ -0,0 +1,101 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Field } from '@components/common/form/Field';
4
+
5
+ export default function WeightBasedPrice({ lines }) {
6
+ // This is a table with 3 columns: Min Price, Shipping Cost, and Action
7
+ const [rows, setRows] = React.useState(
8
+ lines.map((line) => ({
9
+ ...line,
10
+ key: Math.random().toString(36).substring(7)
11
+ }))
12
+ );
13
+ return (
14
+ <div className="my-8">
15
+ <table className="border-collapse divide-y">
16
+ <thead>
17
+ <tr>
18
+ <th className="border-none">Min Weight</th>
19
+ <th className="border-none">Shipping Cost</th>
20
+ <th className="border-none">Action</th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ {rows.map((row, index) => (
25
+ // Create a random key for each row
26
+ <tr key={row.key} className="border-divider py-8">
27
+ <td className="border-none">
28
+ <Field
29
+ name={`weight_based_cost[${index}][min_weight]`}
30
+ placeholder="Min Weight"
31
+ type="text"
32
+ value={row.minWeight?.value}
33
+ validationRules={['notEmpty', 'number']}
34
+ />
35
+ </td>
36
+ <td className="border-none">
37
+ <Field
38
+ name={`weight_based_cost[${index}][cost]`}
39
+ placeholder="Shipping Cost"
40
+ type="text"
41
+ value={row.cost?.value}
42
+ validationRules={['notEmpty', 'number']}
43
+ />
44
+ </td>
45
+ <td className="border-none">
46
+ <a
47
+ href="#"
48
+ onClick={() => {
49
+ setRows(rows.filter((r) => r.key !== row.key));
50
+ }}
51
+ className="text-critical"
52
+ >
53
+ Delete
54
+ </a>
55
+ </td>
56
+ </tr>
57
+ ))}
58
+ </tbody>
59
+ <tfoot>
60
+ <tr>
61
+ <td colSpan="3" className="border-none">
62
+ <a
63
+ href="#"
64
+ className="text-interactive"
65
+ onClick={() => {
66
+ setRows([
67
+ ...rows,
68
+ {
69
+ min_price: '',
70
+ shipping_cost: '',
71
+ key: Math.random().toString(36).substring(7)
72
+ }
73
+ ]);
74
+ }}
75
+ >
76
+ + Add Line
77
+ </a>
78
+ </td>
79
+ </tr>
80
+ </tfoot>
81
+ </table>
82
+ </div>
83
+ );
84
+ }
85
+
86
+ WeightBasedPrice.propTypes = {
87
+ lines: PropTypes.arrayOf(
88
+ PropTypes.shape({
89
+ minWeight: PropTypes.shape({
90
+ value: PropTypes.number.isRequired
91
+ }),
92
+ cost: PropTypes.shape({
93
+ value: PropTypes.number.isRequired
94
+ })
95
+ })
96
+ )
97
+ };
98
+
99
+ WeightBasedPrice.defaultProps = {
100
+ lines: []
101
+ };
@@ -1,19 +1,21 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import axios from 'axios';
4
+ import { toast } from 'react-toastify';
3
5
  import { Card } from '@components/admin/cms/Card';
4
6
  import MapIcon from '@heroicons/react/solid/esm/LocationMarkerIcon';
5
7
  import { useModal } from '@components/common/modal/useModal';
6
- import ZoneForm from './ZoneForm';
7
- import { Methods } from './Methods';
8
+ import ZoneForm from '@components/admin/checkout/shippingSetting/ZoneForm';
9
+ import { Methods } from '@components/admin/checkout/shippingSetting/Methods';
8
10
 
9
11
  function Zone({ zone, countries, getZones }) {
10
12
  const modal = useModal();
11
13
  return (
12
14
  <Card.Session
13
15
  title={
14
- <div className="flex justify-between items-center gap-2">
16
+ <div className="flex justify-between items-center gap-8">
15
17
  <div>{zone.name}</div>
16
- <div>
18
+ <div className="flex justify-between gap-8">
17
19
  <a
18
20
  href="#"
19
21
  className="text-interactive"
@@ -24,18 +26,45 @@ function Zone({ zone, countries, getZones }) {
24
26
  >
25
27
  Edit Zone
26
28
  </a>
29
+ <a
30
+ className="text-critical"
31
+ href="#"
32
+ onClick={async (e) => {
33
+ e.preventDefault();
34
+ try {
35
+ const response = await axios.delete(zone.deleteApi);
36
+ if (response.status === 200) {
37
+ // Toast success
38
+ toast.success('Zone removed successfully');
39
+ // Delay for 2 seconds
40
+ setTimeout(() => {
41
+ // Reload page
42
+ window.location.reload();
43
+ }, 1500);
44
+ } else {
45
+ // Toast error
46
+ toast.error('Failed to remove zone');
47
+ }
48
+ } catch (error) {
49
+ // Toast error
50
+ toast.error('Failed to remove zone');
51
+ }
52
+ }}
53
+ >
54
+ Remove Zone
55
+ </a>
27
56
  </div>
28
57
  </div>
29
58
  }
30
59
  >
31
60
  <div className="divide-y border rounded border-divider">
32
- <div className="flex justify-start items-center border-divider mt-2">
33
- <div className="p-2">
61
+ <div className="flex justify-start items-center border-divider mt-8">
62
+ <div className="p-8">
34
63
  <MapIcon width={25} height={25} fill="#008060" />
35
64
  </div>
36
- <div className="flex-grow px-1">
65
+ <div className="flex-grow px-4">
37
66
  <div>
38
- <b>{zone.country.name}</b>
67
+ <b>{zone.country?.name || 'Worldwide'}</b>
39
68
  </div>
40
69
  <div>
41
70
  {zone.provinces
@@ -46,8 +75,8 @@ function Zone({ zone, countries, getZones }) {
46
75
  </div>
47
76
  </div>
48
77
  </div>
49
- <div className="flex justify-start items-center border-divider mt-2">
50
- <div className="flex-grow px-1">
78
+ <div className="flex justify-start items-center border-divider mt-8">
79
+ <div className="flex-grow px-4">
51
80
  <Methods
52
81
  methods={zone.methods}
53
82
  getZones={getZones}
@@ -97,6 +126,7 @@ Zone.propTypes = {
97
126
  })
98
127
  ),
99
128
  addMethodApi: PropTypes.string,
129
+ deleteApi: PropTypes.string,
100
130
  updateApi: PropTypes.string
101
131
  }).isRequired,
102
132
  countries: PropTypes.arrayOf(
@@ -84,7 +84,7 @@ function ZoneForm({
84
84
  />
85
85
  </Card.Session>
86
86
  <Card.Session>
87
- <div className="flex justify-end gap-1">
87
+ <div className="flex justify-end gap-4">
88
88
  <Button title="Cancel" variant="secondary" onAction={closeModal} />
89
89
  <Button
90
90
  title="Save"
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import Zone from './Zone';
3
+ import Zone from '@components/admin/checkout/shippingSetting/Zone';
4
4
 
5
5
  export function Zones({ countries, getZones, zones }) {
6
6
  return (
7
7
  <>
8
- {zones.map((zone) => <Zone zone={zone} getZones={getZones} countries={countries} />)}
8
+ {zones.map((zone) => (
9
+ <Zone zone={zone} getZones={getZones} countries={countries} />
10
+ ))}
9
11
  </>
10
12
  );
11
13
  }
@@ -34,7 +36,8 @@ Zones.propTypes = {
34
36
  uuid: PropTypes.string.isRequired,
35
37
  name: PropTypes.string.isRequired
36
38
  })
37
- ).isRequired
39
+ ).isRequired,
40
+ deleteApi: PropTypes.string.isRequired
38
41
  })
39
42
  ).isRequired,
40
43
  getZones: PropTypes.func.isRequired
@@ -9,7 +9,7 @@ function Card({ title, actions = [], subdued = false, children }) {
9
9
  <div className="flex justify-between card-header">
10
10
  {title && <h2 className="card-title">{title}</h2>}
11
11
  {actions.length > 0 && (
12
- <div className="flex space-x-075">
12
+ <div className="flex space-x-3">
13
13
  {actions.map((action, index) => {
14
14
  const className = {
15
15
  primary: 'text-primary',
@@ -69,10 +69,10 @@ const Session = function Session({ actions = [], title, children }) {
69
69
  return (
70
70
  <div className="card-section border-b box-border">
71
71
  {(title || actions.length > 0) && (
72
- <div className="flex justify-between card-section-header mb-1">
72
+ <div className="flex justify-between card-section-header mb-4">
73
73
  {title && <h3 className="card-session-title">{title}</h3>}
74
74
  {actions.length > 0 && (
75
- <div className="flex space-x-075">
75
+ <div className="flex space-x-3">
76
76
  {actions.map((action, index) => {
77
77
  const className = {
78
78
  primary: 'text-primary',
@@ -8,7 +8,7 @@ function BreadcrumbIcon({ backUrl }) {
8
8
  return (
9
9
  <a
10
10
  href={backUrl}
11
- className="breadcrum-icon border block border-border rounded mr-075"
11
+ className="breadcrum-icon border block border-border rounded mr-3"
12
12
  >
13
13
  <span className="flex items-center justify-center">
14
14
  <svg
@@ -51,7 +51,7 @@ function PageHeading({ backUrl, heading }) {
51
51
 
52
52
  return (
53
53
  <div className="page-heading flex justify-between items-center">
54
- <div className="flex justify-start space-x-1 items-center">
54
+ <div className="flex justify-start space-x-4 items-center">
55
55
  <Area
56
56
  id="pageHeadingLeft"
57
57
  noOuter
@@ -75,7 +75,7 @@ function PageHeading({ backUrl, heading }) {
75
75
  ]}
76
76
  />
77
77
  </div>
78
- <div className="flex justify-end space-x-1 items-center">
78
+ <div className="flex justify-end space-x-4 items-center">
79
79
  <Area id="pageHeadingRight" noOuter coreComponents={[]} />
80
80
  </div>
81
81
  </div>
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ export default function WidgetTypes({ types }) {
5
+ return (
6
+ <div className="grid grid-cols-3 gap-4">
7
+ {types.map((type) => (
8
+ <a
9
+ key={type.code}
10
+ href={type.createWidgetUrl}
11
+ className="border border-gray-200 rounded p-4 text-center"
12
+ >
13
+ <div className="text-lg font-bold">{type.name}</div>
14
+ </a>
15
+ ))}
16
+ </div>
17
+ );
18
+ }
19
+
20
+ WidgetTypes.propTypes = {
21
+ types: PropTypes.arrayOf(
22
+ PropTypes.shape({
23
+ code: PropTypes.string.isRequired,
24
+ name: PropTypes.string.isRequired,
25
+ createWidgetUrl: PropTypes.string.isRequired
26
+ })
27
+ ).isRequired
28
+ };
@@ -0,0 +1,29 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+
4
+ export default function WidgetTypeRow({ code, types }) {
5
+ const type = types.find((t) => t.code === code);
6
+ if (!type) {
7
+ return (
8
+ <td>
9
+ <div>Unknown</div>
10
+ </td>
11
+ );
12
+ } else {
13
+ return (
14
+ <td>
15
+ <div>{type.name}</div>
16
+ </td>
17
+ );
18
+ }
19
+ }
20
+
21
+ WidgetTypeRow.propTypes = {
22
+ code: PropTypes.string.isRequired,
23
+ types: PropTypes.arrayOf(
24
+ PropTypes.shape({
25
+ code: PropTypes.string.isRequired,
26
+ name: PropTypes.string.isRequired
27
+ })
28
+ ).isRequired
29
+ };
@@ -7,7 +7,7 @@ export function ItemVariantOptions({ options = [] }) {
7
7
  }
8
8
 
9
9
  return (
10
- <div className="cart-item-variant-options mt-05">
10
+ <div className="cart-item-variant-options mt-2">
11
11
  <ul>
12
12
  {options.map((o, i) => (
13
13
  // eslint-disable-next-line react/no-array-index-key
@@ -13,7 +13,7 @@ export function Name({ name, productSku, productUrl, variantOptions = [] }) {
13
13
  <a href={productUrl}>{name}</a>
14
14
  </span>
15
15
  </div>
16
- <div className="text-sm text-gray-500">
16
+ <div className="text-gray-500">
17
17
  <span className="font-semibold">SKU: </span>
18
18
  <span>{productSku}</span>
19
19
  </div>
@@ -50,7 +50,7 @@ export default function FromToColumnHeader({ title, id }) {
50
50
  <div className="title" style={{ marginBottom: '1rem' }}>
51
51
  <span>{title}</span>
52
52
  </div>
53
- <div className="flex space-x-1">
53
+ <div className="flex space-x-4">
54
54
  <div style={{ width: '10rem' }}>
55
55
  <Date
56
56
  ref={filterFrom}
@@ -37,13 +37,13 @@ function AttributeGroupSelector({
37
37
  variables: {
38
38
  filters: inputValue
39
39
  ? [
40
- { key: 'name', operation: '=', value: inputValue },
41
- { key: 'page', operation: '=', value: page.toString() },
42
- { key: 'limit', operation: '=', value: limit.toString() }
40
+ { key: 'name', operation: 'eq', value: inputValue },
41
+ { key: 'page', operation: 'eq', value: page.toString() },
42
+ { key: 'limit', operation: 'eq', value: limit.toString() }
43
43
  ]
44
44
  : [
45
- { key: 'limit', operation: '=', value: limit.toString() },
46
- { key: 'page', operation: '=', value: page.toString() }
45
+ { key: 'limit', operation: 'eq', value: limit.toString() },
46
+ { key: 'page', operation: 'eq', value: page.toString() }
47
47
  ]
48
48
  },
49
49
  pause: true
@@ -101,7 +101,7 @@ function AttributeGroupSelector({
101
101
  <div className="modal-content">
102
102
  <Card.Session>
103
103
  <div>
104
- <div className="border rounded border-divider mb-2">
104
+ <div className="border rounded border-divider mb-8">
105
105
  <input
106
106
  type="text"
107
107
  value={inputValue}
@@ -128,7 +128,7 @@ function AttributeGroupSelector({
128
128
  {data.attributeGroups.items.map((group) => (
129
129
  <div
130
130
  key={group.uuid}
131
- className="grid grid-cols-8 gap-2 py-1 border-divider items-center"
131
+ className="grid grid-cols-8 gap-8 py-4 border-divider items-center"
132
132
  >
133
133
  <div className="col-span-5">
134
134
  <h3>{group.groupName}</h3>
@@ -167,7 +167,7 @@ function AttributeGroupSelector({
167
167
  </Card.Session>
168
168
  </div>
169
169
  <Card.Session>
170
- <div className="flex justify-between gap-2">
170
+ <div className="flex justify-between gap-8">
171
171
  <SimplePageination
172
172
  total={data?.attributeGroups.total}
173
173
  count={data?.attributeGroups?.items?.length || 0}
@@ -226,7 +226,7 @@ export function BuyXGetY({ requireProducts, discountType }) {
226
226
  ))}
227
227
  </tbody>
228
228
  </table>
229
- <div className="mt-1 flex justify-start">
229
+ <div className="mt-4 flex justify-start">
230
230
  <div className="items-center flex">
231
231
  <svg
232
232
  xmlns="http://www.w3.org/2000/svg"
@@ -244,7 +244,7 @@ export function BuyXGetY({ requireProducts, discountType }) {
244
244
  />
245
245
  </svg>
246
246
  </div>
247
- <div className="pl-1">
247
+ <div className="pl-4">
248
248
  <a href="#" onClick={(e) => addProduct(e)}>
249
249
  <span>Add product</span>
250
250
  </a>
@@ -30,13 +30,13 @@ function CategorySelector({ onSelect, onUnSelect, selectedIDs, closeModal }) {
30
30
  variables: {
31
31
  filters: inputValue
32
32
  ? [
33
- { key: 'name', operation: '=', value: inputValue },
34
- { key: 'page', operation: '=', value: page.toString() },
35
- { key: 'limit', operation: '=', value: limit.toString() }
33
+ { key: 'name', operation: 'like', value: inputValue },
34
+ { key: 'page', operation: 'eq', value: page.toString() },
35
+ { key: 'limit', operation: 'eq', value: limit.toString() }
36
36
  ]
37
37
  : [
38
- { key: 'limit', operation: '=', value: limit.toString() },
39
- { key: 'page', operation: '=', value: page.toString() }
38
+ { key: 'limit', operation: 'eq', value: limit.toString() },
39
+ { key: 'page', operation: 'eq', value: page.toString() }
40
40
  ]
41
41
  },
42
42
  pause: true
@@ -72,11 +72,11 @@ function CategorySelector({ onSelect, onUnSelect, selectedIDs, closeModal }) {
72
72
  }
73
73
 
74
74
  return (
75
- <Card title="Select Products">
75
+ <Card title="Select categories">
76
76
  <div className="modal-content">
77
77
  <Card.Session>
78
78
  <div>
79
- <div className="border rounded border-divider mb-2">
79
+ <div className="border rounded border-divider mb-8">
80
80
  <input
81
81
  type="text"
82
82
  value={inputValue}
@@ -105,12 +105,12 @@ function CategorySelector({ onSelect, onUnSelect, selectedIDs, closeModal }) {
105
105
  {data.categories.items.map((cat) => (
106
106
  <div
107
107
  key={cat.uuid}
108
- className="grid grid-cols-8 gap-2 py-1 border-divider items-center"
108
+ className="grid grid-cols-8 gap-8 py-4 border-divider items-center"
109
109
  >
110
110
  <div className="col-span-5">
111
111
  <h3>{cat.name}</h3>
112
112
  </div>
113
- <div className="col-span-2 text-right">
113
+ <div className="col-span-3 text-right">
114
114
  {!selectedIDs.includes(cat.categoryId) && (
115
115
  <button
116
116
  type="button"
@@ -144,7 +144,7 @@ function CategorySelector({ onSelect, onUnSelect, selectedIDs, closeModal }) {
144
144
  </Card.Session>
145
145
  </div>
146
146
  <Card.Session>
147
- <div className="flex justify-between gap-2">
147
+ <div className="flex justify-between gap-8">
148
148
  <SimplePageination
149
149
  total={data?.categories.total}
150
150
  count={data?.categories?.items?.length || 0}
@@ -30,13 +30,13 @@ function CollectionSelector({ onSelect, onUnSelect, selectedIDs, closeModal }) {
30
30
  variables: {
31
31
  filters: inputValue
32
32
  ? [
33
- { key: 'name', operation: '=', value: inputValue },
34
- { key: 'page', operation: '=', value: page.toString() },
35
- { key: 'limit', operation: '=', value: limit.toString() }
33
+ { key: 'name', operation: 'eq', value: inputValue },
34
+ { key: 'page', operation: 'eq', value: page.toString() },
35
+ { key: 'limit', operation: 'eq', value: limit.toString() }
36
36
  ]
37
37
  : [
38
- { key: 'limit', operation: '=', value: limit.toString() },
39
- { key: 'page', operation: '=', value: page.toString() }
38
+ { key: 'limit', operation: 'eq', value: limit.toString() },
39
+ { key: 'page', operation: 'eq', value: page.toString() }
40
40
  ]
41
41
  },
42
42
  pause: true
@@ -76,7 +76,7 @@ function CollectionSelector({ onSelect, onUnSelect, selectedIDs, closeModal }) {
76
76
  <div className="modal-content">
77
77
  <Card.Session>
78
78
  <div>
79
- <div className="border rounded border-divider mb-2">
79
+ <div className="border rounded border-divider mb-8">
80
80
  <input
81
81
  type="text"
82
82
  value={inputValue}
@@ -105,7 +105,7 @@ function CollectionSelector({ onSelect, onUnSelect, selectedIDs, closeModal }) {
105
105
  {data.collections.items.map((collection) => (
106
106
  <div
107
107
  key={collection.uuid}
108
- className="grid grid-cols-8 gap-2 py-1 border-divider items-center"
108
+ className="grid grid-cols-8 gap-8 py-4 border-divider items-center"
109
109
  >
110
110
  <div className="col-span-5">
111
111
  <h3>{collection.name}</h3>
@@ -144,7 +144,7 @@ function CollectionSelector({ onSelect, onUnSelect, selectedIDs, closeModal }) {
144
144
  </Card.Session>
145
145
  </div>
146
146
  <Card.Session>
147
- <div className="flex justify-between gap-2">
147
+ <div className="flex justify-between gap-8">
148
148
  <SimplePageination
149
149
  total={data?.collections.total}
150
150
  count={data?.collections?.items?.length || 0}
@@ -46,13 +46,13 @@ function ProductSkuSelector({
46
46
  variables: {
47
47
  filters: inputValue
48
48
  ? [
49
- { key: 'keyword', operation: '=', value: inputValue },
50
- { key: 'page', operation: '=', value: page.toString() },
51
- { key: 'limit', operation: '=', value: limit.toString() }
49
+ { key: 'keyword', operation: 'eq', value: inputValue },
50
+ { key: 'page', operation: 'eq', value: page.toString() },
51
+ { key: 'limit', operation: 'eq', value: limit.toString() }
52
52
  ]
53
53
  : [
54
- { key: 'limit', operation: '=', value: limit.toString() },
55
- { key: 'page', operation: '=', value: page.toString() }
54
+ { key: 'limit', operation: 'eq', value: limit.toString() },
55
+ { key: 'page', operation: 'eq', value: page.toString() }
56
56
  ]
57
57
  },
58
58
  pause: true
@@ -109,7 +109,7 @@ function ProductSkuSelector({
109
109
  <div className="modal-content">
110
110
  <Card.Session>
111
111
  <div>
112
- <div className="border rounded border-divider mb-2">
112
+ <div className="border rounded border-divider mb-8">
113
113
  <input
114
114
  type="text"
115
115
  value={inputValue}
@@ -141,10 +141,31 @@ function ProductSkuSelector({
141
141
  {data.products.items.map((product) => (
142
142
  <div
143
143
  key={product.uuid}
144
- className="grid grid-cols-8 gap-2 py-1 border-divider items-center"
144
+ className="grid grid-cols-8 gap-8 py-4 border-divider items-center"
145
145
  >
146
146
  <div className="col-span-1">
147
- <img src={product.image?.url} alt={product.name} />
147
+ <div className="text-border border border-divider p-3 rounded flex justify-center">
148
+ {product.image?.url && (
149
+ <img src={product.image?.url} alt={product.name} />
150
+ )}
151
+ {!product.image?.url && (
152
+ <svg
153
+ className="self-center"
154
+ xmlns="http://www.w3.org/2000/svg"
155
+ width="2rem"
156
+ fill="none"
157
+ viewBox="0 0 24 24"
158
+ stroke="currentColor"
159
+ >
160
+ <path
161
+ strokeLinecap="round"
162
+ strokeLinejoin="round"
163
+ strokeWidth={2}
164
+ d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
165
+ />
166
+ </svg>
167
+ )}
168
+ </div>
148
169
  </div>
149
170
  <div className="col-span-5">
150
171
  <h3>{product.name}</h3>
@@ -192,7 +213,7 @@ function ProductSkuSelector({
192
213
  </Card.Session>
193
214
  </div>
194
215
  <Card.Session>
195
- <div className="flex justify-between gap-2">
216
+ <div className="flex justify-between gap-8">
196
217
  <SimplePageination
197
218
  total={data?.products.total}
198
219
  count={data?.products?.items?.length || 0}
@@ -394,7 +394,7 @@ export function RequiredProducts({ requiredProducts }) {
394
394
  ))}
395
395
  </tbody>
396
396
  </table>
397
- <div className="mt-1 flex justify-start">
397
+ <div className="mt-4 flex justify-start">
398
398
  <div className="items-center flex">
399
399
  <svg
400
400
  xmlns="http://www.w3.org/2000/svg"
@@ -412,7 +412,7 @@ export function RequiredProducts({ requiredProducts }) {
412
412
  />
413
413
  </svg>
414
414
  </div>
415
- <div className="pl-1">
415
+ <div className="pl-4">
416
416
  <a href="#" onClick={(e) => addProduct(e)}>
417
417
  <span>Add product</span>
418
418
  </a>
@@ -4,7 +4,7 @@ import { Field } from '@components/common/form/Field';
4
4
 
5
5
  export function Setting({ discountAmount, startDate, endDate }) {
6
6
  return (
7
- <div className="grid grid-cols-3 gap-2 form-field-container">
7
+ <div className="grid grid-cols-3 gap-8 form-field-container">
8
8
  <div>
9
9
  <Field
10
10
  type="text"