@unchainedshop/core 3.0.0-alpha7 → 3.0.0-rc2
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/lib/core-index.d.ts +8 -61
- package/lib/core-index.d.ts.map +1 -1
- package/lib/core-index.js +9 -140
- package/lib/core-index.js.map +1 -1
- package/lib/core-index_BACKUP_57582.d.ts +26 -0
- package/lib/core-index_BACKUP_57582.d.ts.map +1 -0
- package/lib/core-index_BACKUP_57582.js +30 -0
- package/lib/core-index_BACKUP_57582.js.map +1 -0
- package/lib/core-index_BASE_57582.d.ts +74 -0
- package/lib/core-index_BASE_57582.d.ts.map +1 -0
- package/lib/core-index_BASE_57582.js +145 -0
- package/lib/core-index_BASE_57582.js.map +1 -0
- package/lib/core-index_LOCAL_57582.d.ts +26 -0
- package/lib/core-index_LOCAL_57582.d.ts.map +1 -0
- package/lib/core-index_LOCAL_57582.js +31 -0
- package/lib/core-index_LOCAL_57582.js.map +1 -0
- package/lib/core-index_REMOTE_57582.d.ts +74 -0
- package/lib/core-index_REMOTE_57582.d.ts.map +1 -0
- package/lib/core-index_REMOTE_57582.js +146 -0
- package/lib/core-index_REMOTE_57582.js.map +1 -0
- package/lib/directors/BaseDiscountAdapter.d.ts +38 -0
- package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/BaseDiscountAdapter.js +48 -0
- package/lib/directors/BaseDiscountAdapter.js.map +1 -0
- package/lib/directors/BaseDiscountDirector.d.ts +12 -0
- package/lib/directors/BaseDiscountDirector.d.ts.map +1 -0
- package/lib/directors/BaseDiscountDirector.js +45 -0
- package/lib/directors/BaseDiscountDirector.js.map +1 -0
- package/lib/directors/BasePricingAdapter.d.ts +39 -0
- package/lib/directors/BasePricingAdapter.d.ts.map +1 -0
- package/lib/directors/BasePricingAdapter.js +25 -0
- package/lib/directors/BasePricingAdapter.js.map +1 -0
- package/lib/directors/BasePricingDirector.d.ts +17 -0
- package/lib/directors/BasePricingDirector.d.ts.map +1 -0
- package/lib/directors/BasePricingDirector.js +70 -0
- package/lib/directors/BasePricingDirector.js.map +1 -0
- package/lib/directors/BasePricingSheet.d.ts +46 -0
- package/lib/directors/BasePricingSheet.d.ts.map +1 -0
- package/lib/directors/BasePricingSheet.js +74 -0
- package/lib/directors/BasePricingSheet.js.map +1 -0
- package/lib/directors/DeliveryAdapter.d.ts +46 -0
- package/lib/directors/DeliveryAdapter.d.ts.map +1 -0
- package/lib/directors/DeliveryAdapter.js +50 -0
- package/lib/directors/DeliveryAdapter.js.map +1 -0
- package/lib/directors/DeliveryDirector.d.ts +15 -0
- package/lib/directors/DeliveryDirector.d.ts.map +1 -0
- package/lib/directors/DeliveryDirector.js +96 -0
- package/lib/directors/DeliveryDirector.js.map +1 -0
- package/lib/directors/DeliveryPricingAdapter.d.ts +49 -0
- package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingAdapter.js +25 -0
- package/lib/directors/DeliveryPricingAdapter.js.map +1 -0
- package/lib/directors/DeliveryPricingDirector.d.ts +20 -0
- package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingDirector.js +50 -0
- package/lib/directors/DeliveryPricingDirector.js.map +1 -0
- package/lib/directors/DeliveryPricingSheet.d.ts +10 -0
- package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -0
- package/lib/directors/DeliveryPricingSheet.js +75 -0
- package/lib/directors/DeliveryPricingSheet.js.map +1 -0
- package/lib/directors/EnrollmentAdapter.d.ts +27 -0
- package/lib/directors/EnrollmentAdapter.d.ts.map +1 -0
- package/lib/directors/EnrollmentAdapter.js +73 -0
- package/lib/directors/EnrollmentAdapter.js.map +1 -0
- package/lib/directors/EnrollmentDirector.d.ts +14 -0
- package/lib/directors/EnrollmentDirector.d.ts.map +1 -0
- package/lib/directors/EnrollmentDirector.js +44 -0
- package/lib/directors/EnrollmentDirector.js.map +1 -0
- package/lib/directors/FilterAdapter.d.ts +54 -0
- package/lib/directors/FilterAdapter.d.ts.map +1 -0
- package/lib/directors/FilterAdapter.js +38 -0
- package/lib/directors/FilterAdapter.js.map +1 -0
- package/lib/directors/FilterDirector.d.ts +40 -0
- package/lib/directors/FilterDirector.d.ts.map +1 -0
- package/lib/directors/FilterDirector.js +173 -0
- package/lib/directors/FilterDirector.js.map +1 -0
- package/lib/directors/MessagingDirector.d.ts +46 -0
- package/lib/directors/MessagingDirector.d.ts.map +1 -0
- package/lib/directors/MessagingDirector.js +10 -0
- package/lib/directors/MessagingDirector.js.map +1 -0
- package/lib/directors/OrderDiscountAdapter.d.ts +3 -0
- package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/OrderDiscountAdapter.js +3 -0
- package/lib/directors/OrderDiscountAdapter.js.map +1 -0
- package/lib/directors/OrderDiscountConfiguration.d.ts +6 -0
- package/lib/directors/OrderDiscountConfiguration.d.ts.map +1 -0
- package/lib/directors/OrderDiscountConfiguration.js +2 -0
- package/lib/directors/OrderDiscountConfiguration.js.map +1 -0
- package/lib/directors/OrderDiscountDirector.d.ts +3 -0
- package/lib/directors/OrderDiscountDirector.d.ts.map +1 -0
- package/lib/directors/OrderDiscountDirector.js +3 -0
- package/lib/directors/OrderDiscountDirector.js.map +1 -0
- package/lib/directors/OrderPricingAdapter.d.ts +18 -0
- package/lib/directors/OrderPricingAdapter.d.ts.map +1 -0
- package/lib/directors/OrderPricingAdapter.js +24 -0
- package/lib/directors/OrderPricingAdapter.js.map +1 -0
- package/lib/directors/OrderPricingDirector.d.ts +18 -0
- package/lib/directors/OrderPricingDirector.d.ts.map +1 -0
- package/lib/directors/OrderPricingDirector.js +31 -0
- package/lib/directors/OrderPricingDirector.js.map +1 -0
- package/lib/directors/OrderPricingSheet.d.ts +37 -0
- package/lib/directors/OrderPricingSheet.d.ts.map +1 -0
- package/lib/directors/OrderPricingSheet.js +108 -0
- package/lib/directors/OrderPricingSheet.js.map +1 -0
- package/lib/directors/PaymentAdapter.d.ts +50 -0
- package/lib/directors/PaymentAdapter.d.ts.map +1 -0
- package/lib/directors/PaymentAdapter.js +55 -0
- package/lib/directors/PaymentAdapter.js.map +1 -0
- package/lib/directors/PaymentDirector.d.ts +21 -0
- package/lib/directors/PaymentDirector.d.ts.map +1 -0
- package/lib/directors/PaymentDirector.js +172 -0
- package/lib/directors/PaymentDirector.js.map +1 -0
- package/lib/directors/PaymentPricingAdapter.d.ts +48 -0
- package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -0
- package/lib/directors/PaymentPricingAdapter.js +25 -0
- package/lib/directors/PaymentPricingAdapter.js.map +1 -0
- package/lib/directors/PaymentPricingDirector.d.ts +18 -0
- package/lib/directors/PaymentPricingDirector.d.ts.map +1 -0
- package/lib/directors/PaymentPricingDirector.js +51 -0
- package/lib/directors/PaymentPricingDirector.js.map +1 -0
- package/lib/directors/PaymentPricingSheet.d.ts +9 -0
- package/lib/directors/PaymentPricingSheet.d.ts.map +1 -0
- package/lib/directors/PaymentPricingSheet.js +75 -0
- package/lib/directors/PaymentPricingSheet.js.map +1 -0
- package/lib/directors/ProductDiscountAdapter.d.ts +3 -0
- package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -0
- package/lib/directors/ProductDiscountAdapter.js +3 -0
- package/lib/directors/ProductDiscountAdapter.js.map +1 -0
- package/lib/directors/ProductDiscountConfiguration.d.ts +13 -0
- package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -0
- package/lib/directors/ProductDiscountConfiguration.js +2 -0
- package/lib/directors/ProductDiscountConfiguration.js.map +1 -0
- package/lib/directors/ProductDiscountDirector.d.ts +3 -0
- package/lib/directors/ProductDiscountDirector.d.ts.map +1 -0
- package/lib/directors/ProductDiscountDirector.js +3 -0
- package/lib/directors/ProductDiscountDirector.js.map +1 -0
- package/lib/directors/ProductPricingAdapter.d.ts +17 -0
- package/lib/directors/ProductPricingAdapter.d.ts.map +1 -0
- package/lib/directors/ProductPricingAdapter.js +24 -0
- package/lib/directors/ProductPricingAdapter.js.map +1 -0
- package/lib/directors/ProductPricingDirector.d.ts +21 -0
- package/lib/directors/ProductPricingDirector.d.ts.map +1 -0
- package/lib/directors/ProductPricingDirector.js +52 -0
- package/lib/directors/ProductPricingDirector.js.map +1 -0
- package/lib/directors/ProductPricingSheet.d.ts +38 -0
- package/lib/directors/ProductPricingSheet.d.ts.map +1 -0
- package/lib/directors/ProductPricingSheet.js +83 -0
- package/lib/directors/ProductPricingSheet.js.map +1 -0
- package/lib/directors/QuotationAdapter.d.ts +28 -0
- package/lib/directors/QuotationAdapter.d.ts.map +1 -0
- package/lib/directors/QuotationAdapter.js +46 -0
- package/lib/directors/QuotationAdapter.js.map +1 -0
- package/lib/directors/QuotationDirector.d.ts +7 -0
- package/lib/directors/QuotationDirector.d.ts.map +1 -0
- package/lib/directors/QuotationDirector.js +84 -0
- package/lib/directors/QuotationDirector.js.map +1 -0
- package/lib/directors/WarehousingAdapter.d.ts +40 -0
- package/lib/directors/WarehousingAdapter.d.ts.map +1 -0
- package/lib/directors/WarehousingAdapter.js +32 -0
- package/lib/directors/WarehousingAdapter.js.map +1 -0
- package/lib/directors/WarehousingDirector.d.ts +38 -0
- package/lib/directors/WarehousingDirector.d.ts.map +1 -0
- package/lib/directors/WarehousingDirector.js +169 -0
- package/lib/directors/WarehousingDirector.js.map +1 -0
- package/lib/directors/WorkerAdapter.d.ts +17 -0
- package/lib/directors/WorkerAdapter.d.ts.map +1 -0
- package/lib/directors/WorkerAdapter.js +11 -0
- package/lib/directors/WorkerAdapter.js.map +1 -0
- package/lib/directors/WorkerDirector.d.ts +26 -0
- package/lib/directors/WorkerDirector.d.ts.map +1 -0
- package/lib/directors/WorkerDirector.js +102 -0
- package/lib/directors/WorkerDirector.js.map +1 -0
- package/lib/directors/index.d.ts +39 -0
- package/lib/directors/index.d.ts.map +1 -0
- package/lib/directors/index.js +39 -0
- package/lib/directors/index.js.map +1 -0
- package/lib/modules.d.ts +61 -0
- package/lib/modules.d.ts.map +1 -0
- package/lib/modules.js +132 -0
- package/lib/modules.js.map +1 -0
- package/lib/services/activateEnrollment.d.ts +4 -0
- package/lib/services/activateEnrollment.d.ts.map +1 -0
- package/lib/services/activateEnrollment.js +25 -0
- package/lib/services/activateEnrollment.js.map +1 -0
- package/lib/services/calculateDiscountTotal.d.ts +7 -0
- package/lib/services/calculateDiscountTotal.d.ts.map +1 -0
- package/lib/services/calculateDiscountTotal.js +49 -0
- package/lib/services/calculateDiscountTotal.js.map +1 -0
- package/lib/services/checkoutOrder.d.ts +9 -0
- package/lib/services/checkoutOrder.d.ts.map +1 -0
- package/lib/services/checkoutOrder.js +28 -0
- package/lib/services/checkoutOrder.js.map +1 -0
- package/lib/services/confirmOrder.d.ts +9 -0
- package/lib/services/confirmOrder.d.ts.map +1 -0
- package/lib/services/confirmOrder.js +17 -0
- package/lib/services/confirmOrder.js.map +1 -0
- package/lib/services/createDownloadStream.d.ts +5 -0
- package/lib/services/createDownloadStream.d.ts.map +1 -0
- package/lib/services/createDownloadStream.js +8 -0
- package/lib/services/createDownloadStream.js.map +1 -0
- package/lib/services/createDownloadStreamService.d.ts +11 -0
- package/lib/services/createDownloadStreamService.d.ts.map +1 -0
- package/lib/services/createDownloadStreamService.js +9 -0
- package/lib/services/createDownloadStreamService.js.map +1 -0
- package/lib/services/createEnrollmentFromCheckout.d.ts +15 -0
- package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -0
- package/lib/services/createEnrollmentFromCheckout.js +40 -0
- package/lib/services/createEnrollmentFromCheckout.js.map +1 -0
- package/lib/services/createManualOrderDiscount.d.ts +7 -0
- package/lib/services/createManualOrderDiscount.d.ts.map +1 -0
- package/lib/services/createManualOrderDiscount.js +47 -0
- package/lib/services/createManualOrderDiscount.js.map +1 -0
- package/lib/services/createSignedURL.d.ts +8 -0
- package/lib/services/createSignedURL.d.ts.map +1 -0
- package/lib/services/createSignedURL.js +15 -0
- package/lib/services/createSignedURL.js.map +1 -0
- package/lib/services/createSignedURLService.d.ts +13 -0
- package/lib/services/createSignedURLService.d.ts.map +1 -0
- package/lib/services/createSignedURLService.js +14 -0
- package/lib/services/createSignedURLService.js.map +1 -0
- package/lib/services/deleteUser.d.ts +5 -0
- package/lib/services/deleteUser.d.ts.map +1 -0
- package/lib/services/deleteUser.js +26 -0
- package/lib/services/deleteUser.js.map +1 -0
- package/lib/services/deleteUserCartService.d.ts +6 -0
- package/lib/services/deleteUserCartService.d.ts.map +1 -0
- package/lib/services/deleteUserCartService.js +20 -0
- package/lib/services/deleteUserCartService.js.map +1 -0
- package/lib/services/deleteUserCarts.d.ts +5 -0
- package/lib/services/deleteUserCarts.d.ts.map +1 -0
- package/lib/services/deleteUserCarts.js +18 -0
- package/lib/services/deleteUserCarts.js.map +1 -0
- package/lib/services/deleteUserCartsService.d.ts +5 -0
- package/lib/services/deleteUserCartsService.d.ts.map +1 -0
- package/lib/services/deleteUserCartsService.js +18 -0
- package/lib/services/deleteUserCartsService.js.map +1 -0
- package/lib/services/discountedEntities.d.ts +5 -0
- package/lib/services/discountedEntities.d.ts.map +1 -0
- package/lib/services/discountedEntities.js +61 -0
- package/lib/services/discountedEntities.js.map +1 -0
- package/lib/services/ercMetadata.d.ts +7 -0
- package/lib/services/ercMetadata.d.ts.map +1 -0
- package/lib/services/ercMetadata.js +22 -0
- package/lib/services/ercMetadata.js.map +1 -0
- package/lib/services/fullfillQuotation.d.ts +4 -0
- package/lib/services/fullfillQuotation.d.ts.map +1 -0
- package/lib/services/fullfillQuotation.js +12 -0
- package/lib/services/fullfillQuotation.js.map +1 -0
- package/lib/services/index.d.ts +110 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +124 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/index_BACKUP_58089.d.ts +246 -0
- package/lib/services/index_BACKUP_58089.d.ts.map +1 -0
- package/lib/services/index_BACKUP_58089.js +103 -0
- package/lib/services/index_BACKUP_58089.js.map +1 -0
- package/lib/services/index_BASE_58089.d.ts +31 -0
- package/lib/services/index_BASE_58089.d.ts.map +1 -0
- package/lib/services/index_BASE_58089.js +42 -0
- package/lib/services/index_BASE_58089.js.map +1 -0
- package/lib/services/index_LOCAL_58089.d.ts +246 -0
- package/lib/services/index_LOCAL_58089.d.ts.map +1 -0
- package/lib/services/index_LOCAL_58089.js +103 -0
- package/lib/services/index_LOCAL_58089.js.map +1 -0
- package/lib/services/index_REMOTE_58089.d.ts +34 -0
- package/lib/services/index_REMOTE_58089.d.ts.map +1 -0
- package/lib/services/index_REMOTE_58089.js +44 -0
- package/lib/services/index_REMOTE_58089.js.map +1 -0
- package/lib/services/initCartProviders.d.ts +4 -0
- package/lib/services/initCartProviders.d.ts.map +1 -0
- package/lib/services/initCartProviders.js +55 -0
- package/lib/services/initCartProviders.js.map +1 -0
- package/lib/services/initializeEnrollment.d.ts +7 -0
- package/lib/services/initializeEnrollment.d.ts.map +1 -0
- package/lib/services/initializeEnrollment.js +28 -0
- package/lib/services/initializeEnrollment.js.map +1 -0
- package/lib/services/invalidateFilterCache.d.ts +3 -0
- package/lib/services/invalidateFilterCache.d.ts.map +1 -0
- package/lib/services/invalidateFilterCache.js +12 -0
- package/lib/services/invalidateFilterCache.js.map +1 -0
- package/lib/services/linkFileService.d.ts +7 -0
- package/lib/services/linkFileService.d.ts.map +1 -0
- package/lib/services/linkFileService.js +18 -0
- package/lib/services/linkFileService.js.map +1 -0
- package/lib/services/loadFilterOptions.d.ts +14 -0
- package/lib/services/loadFilterOptions.d.ts.map +1 -0
- package/lib/services/loadFilterOptions.js +30 -0
- package/lib/services/loadFilterOptions.js.map +1 -0
- package/lib/services/loadFilters.d.ts +14 -0
- package/lib/services/loadFilters.d.ts.map +1 -0
- package/lib/services/loadFilters.js +36 -0
- package/lib/services/loadFilters.js.map +1 -0
- package/lib/services/migrateBookmarks.d.ts +8 -0
- package/lib/services/migrateBookmarks.d.ts.map +1 -0
- package/lib/services/migrateBookmarks.js +26 -0
- package/lib/services/migrateBookmarks.js.map +1 -0
- package/lib/services/migrateBookmarksService.d.ts +13 -0
- package/lib/services/migrateBookmarksService.d.ts.map +1 -0
- package/lib/services/migrateBookmarksService.js +26 -0
- package/lib/services/migrateBookmarksService.js.map +1 -0
- package/lib/services/migrateOrderCart.d.ts +8 -0
- package/lib/services/migrateOrderCart.d.ts.map +1 -0
- package/lib/services/migrateOrderCart.js +32 -0
- package/lib/services/migrateOrderCart.js.map +1 -0
- package/lib/services/migrateOrderCartService.d.ts +23 -0
- package/lib/services/migrateOrderCartService.d.ts.map +1 -0
- package/lib/services/migrateOrderCartService.js +32 -0
- package/lib/services/migrateOrderCartService.js.map +1 -0
- package/lib/services/migrateUserData.d.ts +2 -0
- package/lib/services/migrateUserData.d.ts.map +1 -0
- package/lib/services/migrateUserData.js +20 -0
- package/lib/services/migrateUserData.js.map +1 -0
- package/lib/services/migrateUserDataService.d.ts +19 -0
- package/lib/services/migrateUserDataService.d.ts.map +1 -0
- package/lib/services/migrateUserDataService.js +18 -0
- package/lib/services/migrateUserDataService.js.map +1 -0
- package/lib/services/nextUserCart.d.ts +9 -0
- package/lib/services/nextUserCart.d.ts.map +1 -0
- package/lib/services/nextUserCart.js +34 -0
- package/lib/services/nextUserCart.js.map +1 -0
- package/lib/services/nextUserCartService.d.ts +22 -0
- package/lib/services/nextUserCartService.d.ts.map +1 -0
- package/lib/services/nextUserCartService.js +35 -0
- package/lib/services/nextUserCartService.js.map +1 -0
- package/lib/services/processEnrollment.d.ts +4 -0
- package/lib/services/processEnrollment.d.ts.map +1 -0
- package/lib/services/processEnrollment.js +33 -0
- package/lib/services/processEnrollment.js.map +1 -0
- package/lib/services/processOrder.d.ts +9 -0
- package/lib/services/processOrder.d.ts.map +1 -0
- package/lib/services/processOrder.js +161 -0
- package/lib/services/processOrder.js.map +1 -0
- package/lib/services/processQuotation.d.ts +6 -0
- package/lib/services/processQuotation.d.ts.map +1 -0
- package/lib/services/processQuotation.js +60 -0
- package/lib/services/processQuotation.js.map +1 -0
- package/lib/services/proposeQuotation.d.ts +6 -0
- package/lib/services/proposeQuotation.d.ts.map +1 -0
- package/lib/services/proposeQuotation.js +12 -0
- package/lib/services/proposeQuotation.js.map +1 -0
- package/lib/services/registerPaymentCredentials.d.ts +5 -0
- package/lib/services/registerPaymentCredentials.d.ts.map +1 -0
- package/lib/services/registerPaymentCredentials.js +21 -0
- package/lib/services/registerPaymentCredentials.js.map +1 -0
- package/lib/services/rejectOrder.d.ts +9 -0
- package/lib/services/rejectOrder.d.ts.map +1 -0
- package/lib/services/rejectOrder.js +17 -0
- package/lib/services/rejectOrder.js.map +1 -0
- package/lib/services/rejectQuotation.d.ts +6 -0
- package/lib/services/rejectQuotation.d.ts.map +1 -0
- package/lib/services/rejectQuotation.js +12 -0
- package/lib/services/rejectQuotation.js.map +1 -0
- package/lib/services/removeFiles.d.ts +5 -0
- package/lib/services/removeFiles.d.ts.map +1 -0
- package/lib/services/removeFiles.js +19 -0
- package/lib/services/removeFiles.js.map +1 -0
- package/lib/services/removeFilesService.d.ts +10 -0
- package/lib/services/removeFilesService.d.ts.map +1 -0
- package/lib/services/removeFilesService.js +20 -0
- package/lib/services/removeFilesService.js.map +1 -0
- package/lib/services/removeProduct.d.ts +5 -0
- package/lib/services/removeProduct.d.ts.map +1 -0
- package/lib/services/removeProduct.js +26 -0
- package/lib/services/removeProduct.js.map +1 -0
- package/lib/services/removeProductService.d.ts +20 -0
- package/lib/services/removeProductService.d.ts.map +1 -0
- package/lib/services/removeProductService.js +27 -0
- package/lib/services/removeProductService.js.map +1 -0
- package/lib/services/searchAssortments.d.ts +19 -0
- package/lib/services/searchAssortments.d.ts.map +1 -0
- package/lib/services/searchAssortments.js +33 -0
- package/lib/services/searchAssortments.js.map +1 -0
- package/lib/services/searchProducts.d.ts +16 -0
- package/lib/services/searchProducts.d.ts.map +1 -0
- package/lib/services/searchProducts.js +41 -0
- package/lib/services/searchProducts.js.map +1 -0
- package/lib/services/supportedDeliveryProviders.d.ts +5 -0
- package/lib/services/supportedDeliveryProviders.d.ts.map +1 -0
- package/lib/services/supportedDeliveryProviders.js +14 -0
- package/lib/services/supportedDeliveryProviders.js.map +1 -0
- package/lib/services/supportedPaymentProviders.d.ts +5 -0
- package/lib/services/supportedPaymentProviders.d.ts.map +1 -0
- package/lib/services/supportedPaymentProviders.js +14 -0
- package/lib/services/supportedPaymentProviders.js.map +1 -0
- package/lib/services/supportedWarehousingProviders.d.ts +5 -0
- package/lib/services/supportedWarehousingProviders.d.ts.map +1 -0
- package/lib/services/supportedWarehousingProviders.js +10 -0
- package/lib/services/supportedWarehousingProviders.js.map +1 -0
- package/lib/services/terminateEnrollment.d.ts +3 -0
- package/lib/services/terminateEnrollment.d.ts.map +1 -0
- package/lib/services/terminateEnrollment.js +25 -0
- package/lib/services/terminateEnrollment.js.map +1 -0
- package/lib/services/updateCalculation.d.ts +3 -0
- package/lib/services/updateCalculation.d.ts.map +1 -0
- package/lib/services/updateCalculation.js +101 -0
- package/lib/services/updateCalculation.js.map +1 -0
- package/lib/services/updateCalculationService.d.ts +17 -0
- package/lib/services/updateCalculationService.d.ts.map +1 -0
- package/lib/services/updateCalculationService.js +68 -0
- package/lib/services/updateCalculationService.js.map +1 -0
- package/lib/services/updateScheduling.d.ts +8 -0
- package/lib/services/updateScheduling.d.ts.map +1 -0
- package/lib/services/updateScheduling.js +42 -0
- package/lib/services/updateScheduling.js.map +1 -0
- package/lib/services/updateUserAvatarAfterUpload.d.ts +6 -0
- package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -0
- package/lib/services/updateUserAvatarAfterUpload.js +25 -0
- package/lib/services/updateUserAvatarAfterUpload.js.map +1 -0
- package/lib/services/updateUserAvatarAfterUploadService.d.ts +18 -0
- package/lib/services/updateUserAvatarAfterUploadService.d.ts.map +1 -0
- package/lib/services/updateUserAvatarAfterUploadService.js +25 -0
- package/lib/services/updateUserAvatarAfterUploadService.js.map +1 -0
- package/lib/services/uploadFileFromStream.d.ts +8 -0
- package/lib/services/uploadFileFromStream.d.ts.map +1 -0
- package/lib/services/uploadFileFromStream.js +11 -0
- package/lib/services/uploadFileFromStream.js.map +1 -0
- package/lib/services/uploadFileFromStreamService.d.ts +12 -0
- package/lib/services/uploadFileFromStreamService.d.ts.map +1 -0
- package/lib/services/uploadFileFromStreamService.js +10 -0
- package/lib/services/uploadFileFromStreamService.js.map +1 -0
- package/lib/services/uploadFileFromURL.d.ts +13 -0
- package/lib/services/uploadFileFromURL.d.ts.map +1 -0
- package/lib/services/uploadFileFromURL.js +11 -0
- package/lib/services/uploadFileFromURL.js.map +1 -0
- package/lib/services/uploadFileFromURLService.d.ts +17 -0
- package/lib/services/uploadFileFromURLService.d.ts.map +1 -0
- package/lib/services/uploadFileFromURLService.js +10 -0
- package/lib/services/uploadFileFromURLService.js.map +1 -0
- package/lib/services/validateOrder.d.ts +4 -0
- package/lib/services/validateOrder.d.ts.map +1 -0
- package/lib/services/validateOrder.js +45 -0
- package/lib/services/validateOrder.js.map +1 -0
- package/lib/services/verifyQuotation.d.ts +6 -0
- package/lib/services/verifyQuotation.d.ts.map +1 -0
- package/lib/services/verifyQuotation.js +12 -0
- package/lib/services/verifyQuotation.js.map +1 -0
- package/package.json +28 -28
- package/src/core-index.ts +14 -241
- package/src/directors/BaseDiscountAdapter.test.ts +49 -0
- package/src/directors/BaseDiscountAdapter.ts +91 -0
- package/src/directors/BaseDiscountDirector.ts +72 -0
- package/src/directors/BasePricingAdapter.ts +82 -0
- package/src/directors/BasePricingDirector.ts +136 -0
- package/src/directors/BasePricingSheet.test.ts +43 -0
- package/src/directors/BasePricingSheet.ts +140 -0
- package/src/directors/DeliveryAdapter.ts +110 -0
- package/src/directors/DeliveryDirector.ts +135 -0
- package/src/directors/DeliveryPricingAdapter.ts +87 -0
- package/src/directors/DeliveryPricingDirector.ts +92 -0
- package/src/directors/DeliveryPricingSheet.ts +86 -0
- package/src/directors/EnrollmentAdapter.ts +109 -0
- package/src/directors/EnrollmentDirector.ts +70 -0
- package/src/directors/FilterAdapter.ts +103 -0
- package/src/directors/FilterDirector.ts +309 -0
- package/src/directors/MessagingDirector.test.ts +5 -0
- package/src/directors/MessagingDirector.ts +59 -0
- package/src/directors/OrderDiscountAdapter.ts +10 -0
- package/src/directors/OrderDiscountConfiguration.ts +5 -0
- package/src/directors/OrderDiscountDirector.ts +6 -0
- package/src/directors/OrderPricingAdapter.ts +63 -0
- package/src/directors/OrderPricingDirector.ts +74 -0
- package/src/directors/OrderPricingSheet.ts +147 -0
- package/src/directors/PaymentAdapter.ts +118 -0
- package/src/directors/PaymentDirector.ts +275 -0
- package/src/directors/PaymentPricingAdapter.ts +86 -0
- package/src/directors/PaymentPricingDirector.ts +94 -0
- package/src/directors/PaymentPricingSheet.ts +91 -0
- package/src/directors/ProductDiscountAdapter.ts +10 -0
- package/src/directors/ProductDiscountConfiguration.ts +18 -0
- package/src/directors/ProductDiscountDirector.ts +5 -0
- package/src/directors/ProductPricingAdapter.ts +56 -0
- package/src/directors/ProductPricingDirector.ts +100 -0
- package/src/directors/ProductPricingSheet.test.ts +129 -0
- package/src/directors/ProductPricingSheet.ts +127 -0
- package/src/directors/QuotationAdapter.ts +86 -0
- package/src/directors/QuotationDirector.ts +105 -0
- package/src/directors/WarehousingAdapter.ts +83 -0
- package/src/directors/WarehousingDirector.ts +235 -0
- package/src/directors/WorkerAdapter.ts +30 -0
- package/src/directors/WorkerDirector.ts +154 -0
- package/src/directors/index.ts +49 -0
- package/src/directors/periodForReferenceDate.test.ts +23 -0
- package/src/modules.ts +215 -0
- package/src/services/activateEnrollment.ts +30 -0
- package/src/services/calculateDiscountTotal.ts +71 -0
- package/src/services/checkoutOrder.ts +43 -0
- package/src/services/confirmOrder.ts +26 -0
- package/src/services/createDownloadStream.ts +16 -0
- package/src/services/createEnrollmentFromCheckout.ts +66 -0
- package/src/services/createManualOrderDiscount.ts +56 -0
- package/src/services/createSignedURL.ts +20 -0
- package/src/services/deleteUser.ts +33 -0
- package/src/services/discountedEntities.ts +81 -0
- package/src/services/ercMetadata.ts +33 -0
- package/src/services/fullfillQuotation.ts +14 -0
- package/src/services/index.ts +154 -0
- package/src/services/initCartProviders.ts +86 -0
- package/src/services/initializeEnrollment.ts +38 -0
- package/src/services/invalidateFilterCache.ts +16 -0
- package/src/services/linkFileService.ts +22 -0
- package/src/services/loadFilterOptions.ts +50 -0
- package/src/services/loadFilters.ts +52 -0
- package/src/services/migrateBookmarks.ts +39 -0
- package/src/services/migrateOrderCart.ts +52 -0
- package/src/services/migrateUserData.ts +22 -0
- package/src/services/nextUserCart.ts +52 -0
- package/src/services/processEnrollment.ts +37 -0
- package/src/services/processOrder.ts +241 -0
- package/src/services/processQuotation.ts +75 -0
- package/src/services/proposeQuotation.ts +18 -0
- package/src/services/registerPaymentCredentials.ts +30 -0
- package/src/services/rejectOrder.ts +26 -0
- package/src/services/rejectQuotation.ts +18 -0
- package/src/services/removeFiles.ts +25 -0
- package/src/services/removeProduct.ts +34 -0
- package/src/services/searchAssortments.ts +58 -0
- package/src/services/searchProducts.ts +73 -0
- package/src/services/supportedDeliveryProviders.ts +24 -0
- package/src/services/supportedPaymentProviders.ts +25 -0
- package/src/services/supportedWarehousingProviders.ts +18 -0
- package/src/services/terminateEnrollment.ts +29 -0
- package/src/services/updateCalculation.ts +143 -0
- package/src/services/updateScheduling.ts +64 -0
- package/src/services/updateUserAvatarAfterUpload.ts +30 -0
- package/src/services/uploadFileFromStream.ts +15 -0
- package/src/services/uploadFileFromURL.ts +29 -0
- package/src/services/validateOrder.ts +53 -0
- package/src/services/verifyQuotation.ts +18 -0
- package/tsconfig.json +5 -7
- package/src/types.ts +0 -7
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { mongodb } from '@unchainedshop/mongodb';
|
|
2
|
+
import { BaseDirector, IBaseDirector, intersectSet } from '@unchainedshop/utils';
|
|
3
|
+
import { FilterAdapterActions, FilterContext, IFilterAdapter } from './FilterAdapter.js';
|
|
4
|
+
import {
|
|
5
|
+
Filter,
|
|
6
|
+
filtersSettings,
|
|
7
|
+
FilterType,
|
|
8
|
+
SearchConfiguration,
|
|
9
|
+
SearchFilterQuery,
|
|
10
|
+
SearchQuery,
|
|
11
|
+
} from '@unchainedshop/core-filters';
|
|
12
|
+
import { Product } from '@unchainedshop/core-products';
|
|
13
|
+
import { Modules } from '../modules.js';
|
|
14
|
+
|
|
15
|
+
export const parseQueryArray = (query: SearchFilterQuery): Record<string, Array<string>> =>
|
|
16
|
+
(query || []).reduce(
|
|
17
|
+
(accumulator, { key, value }) => ({
|
|
18
|
+
...accumulator,
|
|
19
|
+
[key]: accumulator[key] ? accumulator[key].concat(value) : [value],
|
|
20
|
+
}),
|
|
21
|
+
{},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export type IFilterDirector = IBaseDirector<IFilterAdapter> & {
|
|
25
|
+
actions: (filterContext: FilterContext, unchainedAPI) => Promise<FilterAdapterActions>;
|
|
26
|
+
invalidateProductIdCache: (filter: Filter, unchainedAPI) => Promise<void>;
|
|
27
|
+
findProductIds: (
|
|
28
|
+
filter: Filter,
|
|
29
|
+
{ value }: { value?: boolean | string },
|
|
30
|
+
unchainedAPI: { modules: Modules },
|
|
31
|
+
) => Promise<Array<string>>;
|
|
32
|
+
buildProductIdMap: (
|
|
33
|
+
filter: Filter,
|
|
34
|
+
unchainedAPI: { modules: Modules },
|
|
35
|
+
) => Promise<[Array<string>, Record<string, Array<string>>]>;
|
|
36
|
+
filterProductIds: (
|
|
37
|
+
filter: Filter,
|
|
38
|
+
{ values, forceLiveCollection }: { values: Array<string>; forceLiveCollection?: boolean },
|
|
39
|
+
unchainedAPI: { modules: Modules },
|
|
40
|
+
) => Promise<Array<string>>;
|
|
41
|
+
|
|
42
|
+
filterFacets: (
|
|
43
|
+
filter: Filter,
|
|
44
|
+
params: {
|
|
45
|
+
searchQuery: SearchQuery;
|
|
46
|
+
forceLiveCollection?: boolean;
|
|
47
|
+
allProductIds: Array<string>;
|
|
48
|
+
otherFilters: Array<Filter>;
|
|
49
|
+
},
|
|
50
|
+
unchainedAPI: { modules: Modules },
|
|
51
|
+
) => Promise<{
|
|
52
|
+
examinedProductIdSet: Set<string>;
|
|
53
|
+
filteredByOtherFiltersSet: Set<string>;
|
|
54
|
+
filteredByThisFilterSet: Set<string>;
|
|
55
|
+
}>;
|
|
56
|
+
|
|
57
|
+
productFacetedSearch: (
|
|
58
|
+
productIds: Array<string>,
|
|
59
|
+
searchConfiguration: SearchConfiguration,
|
|
60
|
+
unchainedAPI: { modules: Modules },
|
|
61
|
+
) => Promise<Array<string>>;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const baseDirector = BaseDirector<IFilterAdapter>('FilterDirector', {
|
|
65
|
+
adapterSortKey: 'orderIndex',
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const FilterDirector: IFilterDirector = {
|
|
69
|
+
...baseDirector,
|
|
70
|
+
|
|
71
|
+
actions: async (filterContext, unchainedAPI) => {
|
|
72
|
+
const context = { ...filterContext, ...unchainedAPI };
|
|
73
|
+
const adapters = baseDirector.getAdapters().map((Adapter) => Adapter.actions(context));
|
|
74
|
+
|
|
75
|
+
const reduceAdapters = <V>(
|
|
76
|
+
reducer: (currentValue: Promise<V>, adapter: FilterAdapterActions, index: number) => Promise<V>,
|
|
77
|
+
initialValue: V,
|
|
78
|
+
) => {
|
|
79
|
+
if (adapters.length === 0) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return adapters.reduce(async (lastSearchPromise, adapter, index) => {
|
|
83
|
+
return reducer(lastSearchPromise, adapter, index);
|
|
84
|
+
}, Promise.resolve(initialValue));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
aggregateProductIds: (params) => {
|
|
89
|
+
const reducedProductIds = adapters.reduce(
|
|
90
|
+
(productIds, adapter) => adapter.aggregateProductIds({ productIds }),
|
|
91
|
+
params.productIds,
|
|
92
|
+
);
|
|
93
|
+
return reducedProductIds;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
searchAssortments: async (params) => {
|
|
97
|
+
return reduceAdapters<Array<string>>(async (lastSearchPromise, adapter) => {
|
|
98
|
+
const assortmentIds = await lastSearchPromise;
|
|
99
|
+
return adapter.searchAssortments({ assortmentIds });
|
|
100
|
+
}, params.assortmentIds);
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
searchProducts: async (params) => {
|
|
104
|
+
return reduceAdapters<Array<string>>(async (lastSearchPromise, adapter) => {
|
|
105
|
+
const productIds = await lastSearchPromise;
|
|
106
|
+
return adapter.searchProducts({ productIds });
|
|
107
|
+
}, params.productIds);
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
transformProductSelector: async (defaultSelector, options) => {
|
|
111
|
+
return reduceAdapters<mongodb.Filter<Product>>(async (lastSelector, adapter) => {
|
|
112
|
+
return adapter.transformProductSelector(await lastSelector, options);
|
|
113
|
+
}, defaultSelector || null);
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
transformSortStage: async (defaultStage, options) => {
|
|
117
|
+
return reduceAdapters<mongodb.FindOptions<Product>['sort']>(async (lastSortStage, adapter) => {
|
|
118
|
+
return adapter.transformSortStage(await lastSortStage, options);
|
|
119
|
+
}, defaultStage || null);
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
transformFilterSelector: async (defaultSelector) => {
|
|
123
|
+
return reduceAdapters<mongodb.Filter<Filter>>(async (lastSelector, adapter) => {
|
|
124
|
+
return adapter.transformFilterSelector(await lastSelector);
|
|
125
|
+
}, defaultSelector || null);
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
async findProductIds(
|
|
131
|
+
filter: Filter,
|
|
132
|
+
{ value }: { value?: boolean | string },
|
|
133
|
+
unchainedAPI: { modules: Modules },
|
|
134
|
+
) {
|
|
135
|
+
const { modules } = unchainedAPI;
|
|
136
|
+
const director = await FilterDirector.actions({ filter, searchQuery: {} }, unchainedAPI);
|
|
137
|
+
const productSelector = await director.transformProductSelector(
|
|
138
|
+
modules.products.search.buildActiveDraftStatusFilter(),
|
|
139
|
+
{
|
|
140
|
+
key: filter.key,
|
|
141
|
+
value,
|
|
142
|
+
},
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
if (!productSelector) return [];
|
|
146
|
+
return modules.products.findProductIds({
|
|
147
|
+
productSelector,
|
|
148
|
+
includeDrafts: true,
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
async buildProductIdMap(
|
|
153
|
+
filter: Filter,
|
|
154
|
+
unchainedAPI: { modules: Modules },
|
|
155
|
+
): Promise<[Array<string>, Record<string, Array<string>>]> {
|
|
156
|
+
const allProductIds = await this.findProductIds(filter, {}, unchainedAPI);
|
|
157
|
+
const productIdsMap =
|
|
158
|
+
filter.type === FilterType.SWITCH
|
|
159
|
+
? {
|
|
160
|
+
true: await this.findProductIds(filter, { value: true }, unchainedAPI),
|
|
161
|
+
false: await this.findProductIds(filter, { value: false }, unchainedAPI),
|
|
162
|
+
}
|
|
163
|
+
: await (filter.options || []).reduce(async (accumulatorPromise, option) => {
|
|
164
|
+
const accumulator = await accumulatorPromise;
|
|
165
|
+
return {
|
|
166
|
+
...accumulator,
|
|
167
|
+
[option]: await this.findProductIds(filter, { value: option }, unchainedAPI),
|
|
168
|
+
};
|
|
169
|
+
}, Promise.resolve({}));
|
|
170
|
+
|
|
171
|
+
return [allProductIds, productIdsMap];
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
async filterProductIds(
|
|
175
|
+
filter: Filter,
|
|
176
|
+
{ values, forceLiveCollection }: { values: Array<string>; forceLiveCollection?: boolean },
|
|
177
|
+
unchainedAPI: { modules: Modules },
|
|
178
|
+
) {
|
|
179
|
+
const [allProductIds, keyToProductIdMap]: [Array<string>, Record<string, Array<string>>] =
|
|
180
|
+
(!forceLiveCollection && (await filtersSettings.getCachedProductIds(filter._id))) ||
|
|
181
|
+
(await this.buildProductIdMap(filter, unchainedAPI));
|
|
182
|
+
|
|
183
|
+
const filteredKeys = unchainedAPI.modules.filters.parse(
|
|
184
|
+
filter,
|
|
185
|
+
values,
|
|
186
|
+
Object.keys(keyToProductIdMap),
|
|
187
|
+
);
|
|
188
|
+
return filteredKeys.reduce((accumulator, key) => {
|
|
189
|
+
const additionalValues = key === undefined ? allProductIds : keyToProductIdMap[key];
|
|
190
|
+
return [...accumulator, ...(additionalValues || [])];
|
|
191
|
+
}, []);
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
async productFacetedSearch(
|
|
195
|
+
productIds: Array<string>,
|
|
196
|
+
searchConfiguration: SearchConfiguration,
|
|
197
|
+
unchainedAPI: { modules: Modules },
|
|
198
|
+
): Promise<Array<string>> {
|
|
199
|
+
const { searchQuery, filterSelector, forceLiveCollection } = searchConfiguration;
|
|
200
|
+
const { modules } = unchainedAPI;
|
|
201
|
+
if (!searchQuery || !searchQuery.filterQuery) return productIds;
|
|
202
|
+
|
|
203
|
+
const parsedFilterQuery = parseQueryArray(searchQuery.filterQuery);
|
|
204
|
+
|
|
205
|
+
const filters = filterSelector
|
|
206
|
+
? await modules.filters.findFilters({
|
|
207
|
+
...filterSelector,
|
|
208
|
+
limit: 0,
|
|
209
|
+
includeInactive: true,
|
|
210
|
+
})
|
|
211
|
+
: [];
|
|
212
|
+
|
|
213
|
+
const intersectedProductIds = await filters.reduce(
|
|
214
|
+
async (productIdSetPromise: Promise<Set<string>>, filter) => {
|
|
215
|
+
const productIdSet = await productIdSetPromise;
|
|
216
|
+
|
|
217
|
+
if (!parsedFilterQuery[filter.key]) return productIdSet;
|
|
218
|
+
|
|
219
|
+
const values = parsedFilterQuery[filter.key];
|
|
220
|
+
|
|
221
|
+
const filterOptionProductIds = await this.filterProductIds(
|
|
222
|
+
filter,
|
|
223
|
+
{
|
|
224
|
+
values,
|
|
225
|
+
forceLiveCollection,
|
|
226
|
+
},
|
|
227
|
+
unchainedAPI,
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
return intersectSet(productIdSet, new Set(filterOptionProductIds));
|
|
231
|
+
},
|
|
232
|
+
Promise.resolve(new Set(productIds)),
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
return [...intersectedProductIds];
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
async filterFacets(filter, params, unchainedAPI) {
|
|
239
|
+
const { allProductIds, searchQuery, forceLiveCollection, otherFilters } = params;
|
|
240
|
+
|
|
241
|
+
const filterQueryParsed = parseQueryArray(searchQuery?.filterQuery);
|
|
242
|
+
|
|
243
|
+
// The examinedProductIdSet is a set of product id's that:
|
|
244
|
+
// - Fit this filter generally
|
|
245
|
+
// - Are part of the preselected product id array
|
|
246
|
+
const filteredProductIds = await this.filterProductIds(
|
|
247
|
+
filter,
|
|
248
|
+
{
|
|
249
|
+
values: [undefined],
|
|
250
|
+
forceLiveCollection,
|
|
251
|
+
},
|
|
252
|
+
unchainedAPI,
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
const examinedProductIdSet = intersectSet(new Set(allProductIds), new Set(filteredProductIds));
|
|
256
|
+
const values = filterQueryParsed[filter.key];
|
|
257
|
+
|
|
258
|
+
// The filteredProductIdSet is a set of product id's that:
|
|
259
|
+
// - Are filtered by all other filters
|
|
260
|
+
// - Are filtered by the currently selected value of this filter
|
|
261
|
+
// or if there is no currently selected value:
|
|
262
|
+
// - Is the same like examinedProductIdSet
|
|
263
|
+
const filteredByOtherFiltersSet = await otherFilters
|
|
264
|
+
.filter((otherFilter) => otherFilter.key !== filter.key)
|
|
265
|
+
.reduce(
|
|
266
|
+
async (productIdSetPromise, otherFilter) => {
|
|
267
|
+
if (otherFilter.key === filter.key) return productIdSetPromise;
|
|
268
|
+
if (!filterQueryParsed[otherFilter.key]) return productIdSetPromise;
|
|
269
|
+
const productIdSet = await productIdSetPromise;
|
|
270
|
+
const otherFilterProductIds = await this.filterProductIds(
|
|
271
|
+
otherFilter,
|
|
272
|
+
{
|
|
273
|
+
values: filterQueryParsed[otherFilter.key],
|
|
274
|
+
forceLiveCollection,
|
|
275
|
+
},
|
|
276
|
+
unchainedAPI,
|
|
277
|
+
);
|
|
278
|
+
return intersectSet(productIdSet, new Set(otherFilterProductIds));
|
|
279
|
+
},
|
|
280
|
+
Promise.resolve(new Set(examinedProductIdSet)),
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
const filterProductIdsForValues = values
|
|
284
|
+
? await this.filterProductIds(
|
|
285
|
+
filter,
|
|
286
|
+
{
|
|
287
|
+
values,
|
|
288
|
+
forceLiveCollection,
|
|
289
|
+
},
|
|
290
|
+
unchainedAPI,
|
|
291
|
+
)
|
|
292
|
+
: filteredProductIds;
|
|
293
|
+
|
|
294
|
+
const filteredByThisFilterSet = new Set<string>(filterProductIdsForValues);
|
|
295
|
+
|
|
296
|
+
return {
|
|
297
|
+
examinedProductIdSet,
|
|
298
|
+
filteredByOtherFiltersSet,
|
|
299
|
+
filteredByThisFilterSet,
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
async invalidateProductIdCache(filter: Filter, unchainedAPI: { modules: Modules }) {
|
|
304
|
+
if (!filter) return;
|
|
305
|
+
|
|
306
|
+
const [productIds, productIdMap] = await this.buildProductIdMap(filter, unchainedAPI);
|
|
307
|
+
await filtersSettings.setCachedProductIds(filter._id, productIds, productIdMap);
|
|
308
|
+
},
|
|
309
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { log } from '@unchainedshop/logger';
|
|
2
|
+
|
|
3
|
+
export type EmailTemplateType = {
|
|
4
|
+
type: 'EMAIL';
|
|
5
|
+
input: {
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
cc?: string;
|
|
9
|
+
subject: string;
|
|
10
|
+
text: string;
|
|
11
|
+
html?: string;
|
|
12
|
+
attachments?: Array<
|
|
13
|
+
| { filename: string; path: string }
|
|
14
|
+
| {
|
|
15
|
+
filename: string;
|
|
16
|
+
content: string;
|
|
17
|
+
contentType: string;
|
|
18
|
+
encoding: string;
|
|
19
|
+
}
|
|
20
|
+
| { href: string; filename: string }
|
|
21
|
+
>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type SMSTemplateType = {
|
|
26
|
+
type: 'SMS';
|
|
27
|
+
input: {
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
text: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type ArbitraryTemplateType = {
|
|
35
|
+
type: string;
|
|
36
|
+
input: any;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type TemplateResolver<T = { [x: string]: any }> = (
|
|
40
|
+
params: { template: string } & T,
|
|
41
|
+
unchainedAPI,
|
|
42
|
+
) => Promise<Array<EmailTemplateType | SMSTemplateType | ArbitraryTemplateType>>;
|
|
43
|
+
|
|
44
|
+
export type IMessagingDirector = {
|
|
45
|
+
registerTemplate: (templateName: string, templateResolver: TemplateResolver) => void;
|
|
46
|
+
getTemplate: (templateName: string) => TemplateResolver;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const TemplateResolvers = new Map<string, TemplateResolver>();
|
|
50
|
+
|
|
51
|
+
export const MessagingDirector: IMessagingDirector = {
|
|
52
|
+
registerTemplate: (templateName, templateResolver) => {
|
|
53
|
+
log(`MessagingDirector -> Registered template resolver for ${templateName}`);
|
|
54
|
+
|
|
55
|
+
TemplateResolvers.set(templateName, templateResolver);
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
getTemplate: (templateName) => TemplateResolvers.get(templateName),
|
|
59
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseDiscountAdapter,
|
|
3
|
+
IDiscountAdapter,
|
|
4
|
+
OrderDiscountConfiguration,
|
|
5
|
+
} from '../directors/index.js';
|
|
6
|
+
|
|
7
|
+
export const OrderDiscountAdapter: Omit<
|
|
8
|
+
IDiscountAdapter<OrderDiscountConfiguration, any>,
|
|
9
|
+
'key' | 'label' | 'version'
|
|
10
|
+
> = BaseDiscountAdapter;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseDiscountDirector } from './BaseDiscountDirector.js';
|
|
2
|
+
import { OrderDiscountConfiguration } from './OrderDiscountConfiguration.js';
|
|
3
|
+
|
|
4
|
+
export const OrderDiscountDirector = BaseDiscountDirector<OrderDiscountConfiguration, any>(
|
|
5
|
+
'OrderDiscountDirector',
|
|
6
|
+
);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IOrderPricingSheet,
|
|
3
|
+
OrderPricingCalculation,
|
|
4
|
+
OrderPricingSheet,
|
|
5
|
+
BasePricingAdapter,
|
|
6
|
+
IPricingAdapter,
|
|
7
|
+
BasePricingAdapterContext,
|
|
8
|
+
} from '../directors/index.js';
|
|
9
|
+
import {
|
|
10
|
+
Order,
|
|
11
|
+
OrderDelivery,
|
|
12
|
+
OrderDiscount,
|
|
13
|
+
OrderPayment,
|
|
14
|
+
OrderPosition,
|
|
15
|
+
} from '@unchainedshop/core-orders';
|
|
16
|
+
import { User } from '@unchainedshop/core-users';
|
|
17
|
+
import { Modules } from '../modules.js';
|
|
18
|
+
|
|
19
|
+
export interface OrderPricingAdapterContext extends BasePricingAdapterContext {
|
|
20
|
+
currency?: string;
|
|
21
|
+
discounts: Array<OrderDiscount>;
|
|
22
|
+
order: Order;
|
|
23
|
+
orderDelivery: OrderDelivery;
|
|
24
|
+
orderPositions: Array<OrderPosition>;
|
|
25
|
+
orderPayment: OrderPayment;
|
|
26
|
+
user: User;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type IOrderPricingAdapter<DiscountConfiguration = unknown> = IPricingAdapter<
|
|
30
|
+
OrderPricingAdapterContext & { modules: Modules },
|
|
31
|
+
OrderPricingCalculation,
|
|
32
|
+
IOrderPricingSheet,
|
|
33
|
+
DiscountConfiguration
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
const basePricingAdapter = BasePricingAdapter<OrderPricingAdapterContext, OrderPricingCalculation>();
|
|
37
|
+
|
|
38
|
+
export const OrderPricingAdapter: IOrderPricingAdapter = {
|
|
39
|
+
...basePricingAdapter,
|
|
40
|
+
|
|
41
|
+
isActivatedFor: () => {
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
actions: (params) => {
|
|
46
|
+
const { context } = params;
|
|
47
|
+
const { currency } = context;
|
|
48
|
+
const baseActions = basePricingAdapter.actions(params);
|
|
49
|
+
const resultSheet = OrderPricingSheet({ currency });
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
...baseActions,
|
|
53
|
+
calculate: async () => {
|
|
54
|
+
const resultRaw = resultSheet.getRawPricingSheet();
|
|
55
|
+
resultRaw.forEach(({ amount, category }) =>
|
|
56
|
+
basePricingAdapter.log(`Order Pricing Calculation -> ${category} ${amount}`),
|
|
57
|
+
);
|
|
58
|
+
return resultRaw;
|
|
59
|
+
},
|
|
60
|
+
resultSheet: () => resultSheet,
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IOrderPricingSheet,
|
|
3
|
+
OrderPricingCalculation,
|
|
4
|
+
OrderPricingSheet,
|
|
5
|
+
IOrderPricingAdapter,
|
|
6
|
+
OrderPricingAdapterContext,
|
|
7
|
+
BasePricingDirector,
|
|
8
|
+
PricingDiscount,
|
|
9
|
+
IPricingDirector,
|
|
10
|
+
} from '../directors/index.js';
|
|
11
|
+
import { Order, OrderDelivery, OrderPayment, OrderPosition } from '@unchainedshop/core-orders';
|
|
12
|
+
|
|
13
|
+
export interface OrderPricingContext {
|
|
14
|
+
currency: string;
|
|
15
|
+
order: Order;
|
|
16
|
+
orderDelivery: OrderDelivery;
|
|
17
|
+
orderPositions: Array<OrderPosition>;
|
|
18
|
+
orderPayment: OrderPayment;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type OrderPricingDiscount = PricingDiscount & {
|
|
22
|
+
delivery?: OrderDelivery;
|
|
23
|
+
item?: OrderPosition;
|
|
24
|
+
order?: Order;
|
|
25
|
+
payment?: OrderPayment;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type IOrderPricingDirector<DiscountConfiguration = unknown> = IPricingDirector<
|
|
29
|
+
OrderPricingContext,
|
|
30
|
+
OrderPricingCalculation,
|
|
31
|
+
OrderPricingAdapterContext,
|
|
32
|
+
IOrderPricingSheet,
|
|
33
|
+
IOrderPricingAdapter<DiscountConfiguration>
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
const baseDirector = BasePricingDirector<
|
|
37
|
+
OrderPricingContext,
|
|
38
|
+
OrderPricingAdapterContext,
|
|
39
|
+
OrderPricingCalculation,
|
|
40
|
+
IOrderPricingAdapter
|
|
41
|
+
>('OrderPricingDirector');
|
|
42
|
+
|
|
43
|
+
export const OrderPricingDirector: IOrderPricingDirector<any> = {
|
|
44
|
+
...baseDirector,
|
|
45
|
+
|
|
46
|
+
buildPricingContext: async (context, unchainedAPI) => {
|
|
47
|
+
const { modules } = unchainedAPI;
|
|
48
|
+
const { order, currency } = context;
|
|
49
|
+
|
|
50
|
+
const user = await modules.users.findUserById(order.userId);
|
|
51
|
+
const discounts = await modules.orders.discounts.findOrderDiscounts({
|
|
52
|
+
orderId: order._id,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
...unchainedAPI,
|
|
57
|
+
country: order.countryCode,
|
|
58
|
+
currency,
|
|
59
|
+
discounts,
|
|
60
|
+
order,
|
|
61
|
+
orderDelivery: context.orderDelivery,
|
|
62
|
+
orderPayment: context.orderPayment,
|
|
63
|
+
orderPositions: context.orderPositions,
|
|
64
|
+
user,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
calculationSheet(pricingContext, calculation) {
|
|
69
|
+
return OrderPricingSheet({
|
|
70
|
+
calculation,
|
|
71
|
+
currency: pricingContext.currency,
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { PricingCalculation } from '@unchainedshop/utils';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BasePricingSheet,
|
|
5
|
+
IPricingSheet,
|
|
6
|
+
IBasePricingSheet,
|
|
7
|
+
PricingSheetParams,
|
|
8
|
+
} from '../directors/index.js';
|
|
9
|
+
|
|
10
|
+
export interface OrderPricingCalculation extends PricingCalculation {
|
|
11
|
+
discountId?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export enum OrderPricingRowCategory {
|
|
15
|
+
Items = 'ITEMS',
|
|
16
|
+
Discounts = 'DISCOUNTS',
|
|
17
|
+
Taxes = 'TAXES',
|
|
18
|
+
Delivery = 'DELIVERY',
|
|
19
|
+
Payment = 'PAYMENT',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IOrderPricingSheet extends IPricingSheet<OrderPricingCalculation> {
|
|
23
|
+
addDelivery: (params: { amount: number; taxAmount: number; meta?: any }) => void;
|
|
24
|
+
addDiscount: (params: { amount: number; taxAmount: number; discountId: string; meta?: any }) => void;
|
|
25
|
+
addItems: (params: { amount: number; taxAmount: number; meta?: any }) => void;
|
|
26
|
+
addPayment: (params: { amount: number; taxAmount: number; meta?: any }) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const OrderPricingSheet = (
|
|
30
|
+
params: PricingSheetParams<OrderPricingCalculation>,
|
|
31
|
+
): IOrderPricingSheet => {
|
|
32
|
+
const basePricingSheet: IBasePricingSheet<OrderPricingCalculation> = BasePricingSheet(params);
|
|
33
|
+
|
|
34
|
+
const addTaxIfAvailabile = (category: string, taxAmount?: number, meta?: any, discountId?: string) => {
|
|
35
|
+
if (taxAmount) {
|
|
36
|
+
basePricingSheet.calculation.push({
|
|
37
|
+
category: OrderPricingRowCategory.Taxes,
|
|
38
|
+
amount: taxAmount,
|
|
39
|
+
baseCategory: category,
|
|
40
|
+
discountId,
|
|
41
|
+
meta,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const pricingSheet: IOrderPricingSheet = {
|
|
47
|
+
...basePricingSheet,
|
|
48
|
+
|
|
49
|
+
addItems({ amount, taxAmount, meta }) {
|
|
50
|
+
basePricingSheet.calculation.push({
|
|
51
|
+
category: OrderPricingRowCategory.Items,
|
|
52
|
+
amount,
|
|
53
|
+
meta,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
addTaxIfAvailabile(OrderPricingRowCategory.Items, taxAmount, meta);
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
addDiscount({ amount, taxAmount, discountId, meta }) {
|
|
60
|
+
basePricingSheet.calculation.push({
|
|
61
|
+
category: OrderPricingRowCategory.Discounts,
|
|
62
|
+
amount,
|
|
63
|
+
discountId,
|
|
64
|
+
meta,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
addTaxIfAvailabile(OrderPricingRowCategory.Discounts, taxAmount, meta, discountId);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
addDelivery({ amount, taxAmount, meta }) {
|
|
71
|
+
basePricingSheet.calculation.push({
|
|
72
|
+
category: OrderPricingRowCategory.Delivery,
|
|
73
|
+
amount,
|
|
74
|
+
meta,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
addTaxIfAvailabile(OrderPricingRowCategory.Delivery, taxAmount, meta);
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
addPayment({ amount, taxAmount, meta }) {
|
|
81
|
+
basePricingSheet.calculation.push({
|
|
82
|
+
category: OrderPricingRowCategory.Payment,
|
|
83
|
+
amount,
|
|
84
|
+
meta,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
addTaxIfAvailabile(OrderPricingRowCategory.Payment, taxAmount, meta);
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
taxSum(filter) {
|
|
91
|
+
return basePricingSheet.sum({
|
|
92
|
+
category: OrderPricingRowCategory.Taxes,
|
|
93
|
+
...(filter || {}),
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
gross() {
|
|
98
|
+
// tax is included 2 times, this is only true for Order Pricing!
|
|
99
|
+
return basePricingSheet.sum() - this.taxSum();
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
net() {
|
|
103
|
+
return basePricingSheet.sum() - this.taxSum() - this.taxSum();
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
total({ category, useNetPrice, discountId } = { useNetPrice: false }) {
|
|
107
|
+
const taxAmount = this.taxSum({ baseCategory: category, discountId });
|
|
108
|
+
const amount = this.sum({ category, discountId }) - taxAmount;
|
|
109
|
+
|
|
110
|
+
// Sum does not contain taxes when filtering by category, it's net in that case and gross if there is no category
|
|
111
|
+
const netAmount = !category ? amount - taxAmount : amount;
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
amount: Math.round(useNetPrice ? netAmount : netAmount + taxAmount),
|
|
115
|
+
currency: this.currency,
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
discountPrices(explicitDiscountId) {
|
|
120
|
+
const discountIds = pricingSheet
|
|
121
|
+
.filterBy({
|
|
122
|
+
category: OrderPricingRowCategory.Discounts,
|
|
123
|
+
discountId: explicitDiscountId,
|
|
124
|
+
})
|
|
125
|
+
.map(({ discountId }) => discountId);
|
|
126
|
+
|
|
127
|
+
return [...new Set(discountIds)]
|
|
128
|
+
.map((discountId) => {
|
|
129
|
+
const amount = basePricingSheet.sum({
|
|
130
|
+
category: OrderPricingRowCategory.Discounts,
|
|
131
|
+
discountId,
|
|
132
|
+
});
|
|
133
|
+
if (!amount) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
discountId,
|
|
138
|
+
amount: Math.round(amount),
|
|
139
|
+
currency: basePricingSheet.currency,
|
|
140
|
+
};
|
|
141
|
+
})
|
|
142
|
+
.filter(Boolean);
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
return pricingSheet;
|
|
147
|
+
};
|