@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,135 @@
|
|
|
1
|
+
import { BaseDirector, IBaseDirector } from '@unchainedshop/utils';
|
|
2
|
+
import {
|
|
3
|
+
DeliveryAdapterActions,
|
|
4
|
+
DeliveryContext,
|
|
5
|
+
IDeliveryAdapter,
|
|
6
|
+
DeliveryError,
|
|
7
|
+
} from './DeliveryAdapter.js';
|
|
8
|
+
import { DeliveryProvider } from '@unchainedshop/core-delivery';
|
|
9
|
+
import { OrderDelivery, OrderDeliveryStatus } from '@unchainedshop/core-orders';
|
|
10
|
+
import { Modules } from '../modules.js';
|
|
11
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
12
|
+
|
|
13
|
+
const logger = createLogger('unchained:core');
|
|
14
|
+
|
|
15
|
+
export type IDeliveryDirector = IBaseDirector<IDeliveryAdapter> & {
|
|
16
|
+
sendOrderDelivery: (
|
|
17
|
+
orderDelivery: OrderDelivery,
|
|
18
|
+
transactionContext: Record<string, any>,
|
|
19
|
+
unchainedAPI: { modules: Modules },
|
|
20
|
+
) => Promise<OrderDelivery>;
|
|
21
|
+
actions: (
|
|
22
|
+
deliveryProvider: DeliveryProvider,
|
|
23
|
+
deliveryContext: DeliveryContext,
|
|
24
|
+
unchainedAPI: { modules: Modules },
|
|
25
|
+
) => Promise<DeliveryAdapterActions>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const baseDirector = BaseDirector<IDeliveryAdapter>('DeliveryDirector');
|
|
29
|
+
|
|
30
|
+
export const DeliveryDirector: IDeliveryDirector = {
|
|
31
|
+
...baseDirector,
|
|
32
|
+
|
|
33
|
+
actions: async (deliveryProvider, deliveryContext, unchainedAPI) => {
|
|
34
|
+
const Adapter = baseDirector.getAdapter(deliveryProvider.adapterKey);
|
|
35
|
+
|
|
36
|
+
const context = { ...deliveryContext, ...unchainedAPI };
|
|
37
|
+
const adapter = Adapter?.actions(deliveryProvider.configuration, context);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
configurationError: () => {
|
|
41
|
+
try {
|
|
42
|
+
return adapter.configurationError();
|
|
43
|
+
} catch {
|
|
44
|
+
return DeliveryError.ADAPTER_NOT_FOUND;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
estimatedDeliveryThroughput: async (warehousingThroughputTime) => {
|
|
49
|
+
try {
|
|
50
|
+
const throughput = await adapter.estimatedDeliveryThroughput(warehousingThroughputTime);
|
|
51
|
+
return throughput;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
logger.warn('Delivery Director -> Error while estimating delivery throughput', {
|
|
54
|
+
...error,
|
|
55
|
+
});
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
isActive: () => {
|
|
61
|
+
try {
|
|
62
|
+
return adapter.isActive();
|
|
63
|
+
} catch (error) {
|
|
64
|
+
logger.warn('Delivery Director -> Error while checking if is active', {
|
|
65
|
+
...error,
|
|
66
|
+
});
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
isAutoReleaseAllowed: () => {
|
|
72
|
+
try {
|
|
73
|
+
return adapter.isAutoReleaseAllowed();
|
|
74
|
+
} catch (error) {
|
|
75
|
+
logger.warn('Delivery Director -> Error while checking if auto release is allowed', {
|
|
76
|
+
...error,
|
|
77
|
+
});
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
send: async () => {
|
|
83
|
+
return adapter.send();
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
pickUpLocationById: async (locationId) => {
|
|
87
|
+
return adapter.pickUpLocationById(locationId);
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
pickUpLocations: async () => {
|
|
91
|
+
return adapter.pickUpLocations();
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
sendOrderDelivery: async (orderDelivery, transactionContext, unchainedAPI) => {
|
|
97
|
+
if (
|
|
98
|
+
unchainedAPI.modules.orders.deliveries.normalizedStatus(orderDelivery) !== OrderDeliveryStatus.OPEN
|
|
99
|
+
)
|
|
100
|
+
return orderDelivery;
|
|
101
|
+
|
|
102
|
+
const order = await unchainedAPI.modules.orders.findOrder({ orderId: orderDelivery.orderId });
|
|
103
|
+
const deliveryProvider = await unchainedAPI.modules.delivery.findProvider({
|
|
104
|
+
deliveryProviderId: orderDelivery.deliveryProviderId,
|
|
105
|
+
});
|
|
106
|
+
const deliveryProviderId = deliveryProvider._id;
|
|
107
|
+
const address = orderDelivery.context?.address || order || order.billingAddress;
|
|
108
|
+
const provider = await await unchainedAPI.modules.delivery.findProvider({ deliveryProviderId });
|
|
109
|
+
|
|
110
|
+
const adapter = await DeliveryDirector.actions(
|
|
111
|
+
provider,
|
|
112
|
+
{
|
|
113
|
+
order,
|
|
114
|
+
orderDelivery,
|
|
115
|
+
transactionContext: {
|
|
116
|
+
...(transactionContext || {}),
|
|
117
|
+
...(orderDelivery.context || {}),
|
|
118
|
+
...(address || {}),
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
unchainedAPI,
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const arbitraryResponseData = await adapter.send();
|
|
125
|
+
|
|
126
|
+
if (arbitraryResponseData) {
|
|
127
|
+
return await unchainedAPI.modules.orders.deliveries.updateStatus(orderDelivery._id, {
|
|
128
|
+
status: OrderDeliveryStatus.DELIVERED,
|
|
129
|
+
info: JSON.stringify(arbitraryResponseData),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return orderDelivery;
|
|
134
|
+
},
|
|
135
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DeliveryPricingSheet } from './DeliveryPricingSheet.js';
|
|
2
|
+
import {
|
|
3
|
+
BasePricingAdapterContext,
|
|
4
|
+
IPricingAdapter,
|
|
5
|
+
IPricingSheet,
|
|
6
|
+
BasePricingAdapter,
|
|
7
|
+
} from '../directors/index.js';
|
|
8
|
+
import { DeliveryProvider } from '@unchainedshop/core-delivery';
|
|
9
|
+
import { PricingCalculation } from '@unchainedshop/utils';
|
|
10
|
+
import { OrderDelivery, OrderDiscount, Order } from '@unchainedshop/core-orders';
|
|
11
|
+
import { User } from '@unchainedshop/core-users';
|
|
12
|
+
import { Modules } from '../modules.js';
|
|
13
|
+
|
|
14
|
+
export interface DeliveryPricingCalculation extends PricingCalculation {
|
|
15
|
+
discountId?: string;
|
|
16
|
+
isNetPrice: boolean;
|
|
17
|
+
isTaxable: boolean;
|
|
18
|
+
rate?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type IDeliveryPricingSheet = IPricingSheet<DeliveryPricingCalculation> & {
|
|
22
|
+
addFee: (params: { amount: number; isTaxable: boolean; isNetPrice: boolean; meta?: any }) => void;
|
|
23
|
+
addTax: (params: {
|
|
24
|
+
amount: number;
|
|
25
|
+
rate: number;
|
|
26
|
+
baseCategory?: string;
|
|
27
|
+
discountId?: string;
|
|
28
|
+
meta?: any;
|
|
29
|
+
}) => void;
|
|
30
|
+
addDiscount: (params: {
|
|
31
|
+
amount: number;
|
|
32
|
+
isTaxable: boolean;
|
|
33
|
+
isNetPrice: boolean;
|
|
34
|
+
discountId: string;
|
|
35
|
+
meta?: any;
|
|
36
|
+
}) => void;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface DeliveryPricingAdapterContext extends BasePricingAdapterContext {
|
|
40
|
+
country?: string;
|
|
41
|
+
currency?: string;
|
|
42
|
+
provider: DeliveryProvider;
|
|
43
|
+
providerContext?: any;
|
|
44
|
+
order: Order;
|
|
45
|
+
orderDelivery: OrderDelivery;
|
|
46
|
+
user: User;
|
|
47
|
+
discounts: Array<OrderDiscount>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type IDeliveryPricingAdapter<DiscountConfiguration = unknown> = IPricingAdapter<
|
|
51
|
+
DeliveryPricingAdapterContext & { modules: Modules },
|
|
52
|
+
DeliveryPricingCalculation,
|
|
53
|
+
IDeliveryPricingSheet,
|
|
54
|
+
DiscountConfiguration
|
|
55
|
+
>;
|
|
56
|
+
|
|
57
|
+
const basePricingAdapter = BasePricingAdapter<
|
|
58
|
+
DeliveryPricingAdapterContext,
|
|
59
|
+
DeliveryPricingCalculation
|
|
60
|
+
>();
|
|
61
|
+
|
|
62
|
+
export const DeliveryPricingAdapter: IDeliveryPricingAdapter = {
|
|
63
|
+
...basePricingAdapter,
|
|
64
|
+
|
|
65
|
+
isActivatedFor: () => {
|
|
66
|
+
return false;
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
actions: (params) => {
|
|
70
|
+
const { context } = params;
|
|
71
|
+
const { currency } = context;
|
|
72
|
+
const baseActions = basePricingAdapter.actions(params);
|
|
73
|
+
const resultSheet = DeliveryPricingSheet({ currency });
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
...baseActions,
|
|
77
|
+
calculate: async () => {
|
|
78
|
+
const resultRaw = resultSheet.getRawPricingSheet();
|
|
79
|
+
resultRaw.forEach(({ amount, category }) =>
|
|
80
|
+
basePricingAdapter.log(`Delivery Calculation -> ${category} ${amount}`),
|
|
81
|
+
);
|
|
82
|
+
return resultRaw;
|
|
83
|
+
},
|
|
84
|
+
resultSheet: () => resultSheet,
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { DeliveryPricingSheet, BasePricingDirector, IPricingDirector } from '../directors/index.js';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DeliveryPricingAdapterContext,
|
|
5
|
+
DeliveryPricingCalculation,
|
|
6
|
+
IDeliveryPricingAdapter,
|
|
7
|
+
IDeliveryPricingSheet,
|
|
8
|
+
} from './DeliveryPricingAdapter.js';
|
|
9
|
+
import { DeliveryProvider } from '@unchainedshop/core-delivery';
|
|
10
|
+
|
|
11
|
+
import type { Order } from '@unchainedshop/core-orders';
|
|
12
|
+
import type { User } from '@unchainedshop/core-users';
|
|
13
|
+
import type { OrderDelivery } from '@unchainedshop/core-orders';
|
|
14
|
+
|
|
15
|
+
export type DeliveryPricingContext =
|
|
16
|
+
| {
|
|
17
|
+
currency: string;
|
|
18
|
+
country?: string;
|
|
19
|
+
provider: DeliveryProvider;
|
|
20
|
+
providerContext?: any;
|
|
21
|
+
order: Order;
|
|
22
|
+
user: User;
|
|
23
|
+
}
|
|
24
|
+
| { currency: string; item: OrderDelivery };
|
|
25
|
+
|
|
26
|
+
export type IDeliveryPricingDirector<DiscountConfiguration = unknown> = IPricingDirector<
|
|
27
|
+
DeliveryPricingContext,
|
|
28
|
+
DeliveryPricingCalculation,
|
|
29
|
+
DeliveryPricingAdapterContext,
|
|
30
|
+
IDeliveryPricingSheet,
|
|
31
|
+
IDeliveryPricingAdapter<DiscountConfiguration>
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
const baseDirector = BasePricingDirector<
|
|
35
|
+
DeliveryPricingContext,
|
|
36
|
+
DeliveryPricingAdapterContext,
|
|
37
|
+
DeliveryPricingCalculation,
|
|
38
|
+
IDeliveryPricingAdapter
|
|
39
|
+
>('DeliveryPricingDirector');
|
|
40
|
+
|
|
41
|
+
export const DeliveryPricingDirector: IDeliveryPricingDirector<any> = {
|
|
42
|
+
...baseDirector,
|
|
43
|
+
|
|
44
|
+
async buildPricingContext(context, unchainedAPI) {
|
|
45
|
+
const { modules } = unchainedAPI;
|
|
46
|
+
|
|
47
|
+
if ('item' in context) {
|
|
48
|
+
const { item, currency } = context;
|
|
49
|
+
const order = await modules.orders.findOrder({
|
|
50
|
+
orderId: item.orderId,
|
|
51
|
+
});
|
|
52
|
+
const provider = await modules.delivery.findProvider({
|
|
53
|
+
deliveryProviderId: item.deliveryProviderId,
|
|
54
|
+
});
|
|
55
|
+
const user = await modules.users.findUserById(order.userId);
|
|
56
|
+
const discounts = await modules.orders.discounts.findOrderDiscounts({
|
|
57
|
+
orderId: item.orderId,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
...unchainedAPI,
|
|
62
|
+
country: order.countryCode,
|
|
63
|
+
currency,
|
|
64
|
+
order,
|
|
65
|
+
provider,
|
|
66
|
+
user,
|
|
67
|
+
discounts,
|
|
68
|
+
orderDelivery: item,
|
|
69
|
+
providerContext: null,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
...unchainedAPI,
|
|
75
|
+
country: context.country,
|
|
76
|
+
currency: context.currency,
|
|
77
|
+
order: context.order,
|
|
78
|
+
provider: context.provider,
|
|
79
|
+
user: context.user,
|
|
80
|
+
discounts: [],
|
|
81
|
+
orderDelivery: null,
|
|
82
|
+
providerContext: context.providerContext,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
calculationSheet(pricingContext, calculation) {
|
|
87
|
+
return DeliveryPricingSheet({
|
|
88
|
+
calculation,
|
|
89
|
+
currency: pricingContext.currency,
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { BasePricingSheet, IBasePricingSheet, PricingSheetParams } from '../directors/index.js';
|
|
2
|
+
import { DeliveryPricingCalculation, IDeliveryPricingSheet } from './DeliveryPricingAdapter.js';
|
|
3
|
+
|
|
4
|
+
export enum DeliveryPricingRowCategory {
|
|
5
|
+
Delivery = 'DELIVERY',
|
|
6
|
+
Discount = 'DISCOUNT',
|
|
7
|
+
Tax = 'TAX',
|
|
8
|
+
Item = 'ITEM', // Propably unused
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const DeliveryPricingSheet = (
|
|
12
|
+
params: PricingSheetParams<DeliveryPricingCalculation>,
|
|
13
|
+
): IDeliveryPricingSheet => {
|
|
14
|
+
const basePricingSheet: IBasePricingSheet<DeliveryPricingCalculation> = BasePricingSheet(params);
|
|
15
|
+
|
|
16
|
+
const pricingSheet: IDeliveryPricingSheet = {
|
|
17
|
+
...basePricingSheet,
|
|
18
|
+
|
|
19
|
+
addDiscount({ amount, isTaxable, isNetPrice, discountId, meta }) {
|
|
20
|
+
basePricingSheet.calculation.push({
|
|
21
|
+
category: DeliveryPricingRowCategory.Discount,
|
|
22
|
+
amount,
|
|
23
|
+
isTaxable,
|
|
24
|
+
isNetPrice,
|
|
25
|
+
discountId,
|
|
26
|
+
meta,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
addFee({ amount, isTaxable, isNetPrice, meta }) {
|
|
31
|
+
basePricingSheet.calculation.push({
|
|
32
|
+
amount,
|
|
33
|
+
category: DeliveryPricingRowCategory.Delivery,
|
|
34
|
+
isNetPrice,
|
|
35
|
+
isTaxable,
|
|
36
|
+
meta,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
addTax({ amount, rate, meta }) {
|
|
41
|
+
basePricingSheet.calculation.push({
|
|
42
|
+
amount,
|
|
43
|
+
category: DeliveryPricingRowCategory.Tax,
|
|
44
|
+
isNetPrice: false,
|
|
45
|
+
isTaxable: false,
|
|
46
|
+
meta,
|
|
47
|
+
rate,
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
taxSum(filter) {
|
|
52
|
+
return basePricingSheet.sum({
|
|
53
|
+
category: DeliveryPricingRowCategory.Tax,
|
|
54
|
+
...(filter || {}),
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
discountPrices(explicitDiscountId) {
|
|
59
|
+
const discountIds = pricingSheet
|
|
60
|
+
.filterBy({
|
|
61
|
+
category: DeliveryPricingRowCategory.Discount,
|
|
62
|
+
discountId: explicitDiscountId,
|
|
63
|
+
})
|
|
64
|
+
.map(({ discountId }) => discountId);
|
|
65
|
+
|
|
66
|
+
return [...new Set(discountIds)]
|
|
67
|
+
.map((discountId) => {
|
|
68
|
+
const { currency, amount } = basePricingSheet.total({
|
|
69
|
+
category: DeliveryPricingRowCategory.Discount,
|
|
70
|
+
discountId,
|
|
71
|
+
});
|
|
72
|
+
if (!amount) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
discountId,
|
|
77
|
+
amount: Math.round(amount),
|
|
78
|
+
currency,
|
|
79
|
+
};
|
|
80
|
+
})
|
|
81
|
+
.filter(Boolean);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return pricingSheet;
|
|
86
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { IBaseAdapter } from '@unchainedshop/utils';
|
|
2
|
+
import { log, LogLevel } from '@unchainedshop/logger';
|
|
3
|
+
import { add } from 'date-fns/add';
|
|
4
|
+
import { Enrollment, EnrollmentPeriod, EnrollmentPlan } from '@unchainedshop/core-enrollments';
|
|
5
|
+
import type { Product, ProductPlan } from '@unchainedshop/core-products';
|
|
6
|
+
import type { OrderPosition } from '@unchainedshop/core-orders';
|
|
7
|
+
|
|
8
|
+
export type EnrollmentContext = {
|
|
9
|
+
enrollment: Enrollment;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface EnrollmentAdapterActions {
|
|
13
|
+
configurationForOrder: (params: {
|
|
14
|
+
period: EnrollmentPeriod;
|
|
15
|
+
products: Array<Product>;
|
|
16
|
+
}) => Promise<any>;
|
|
17
|
+
isOverdue: () => Promise<boolean>;
|
|
18
|
+
isValidForActivation: () => Promise<boolean>;
|
|
19
|
+
nextPeriod: () => Promise<EnrollmentPeriod>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type IEnrollmentAdapter = IBaseAdapter & {
|
|
23
|
+
isActivatedFor: (productPlan?: ProductPlan) => boolean;
|
|
24
|
+
|
|
25
|
+
transformOrderItemToEnrollmentPlan: (
|
|
26
|
+
orderPosition: OrderPosition,
|
|
27
|
+
unchainedAPI,
|
|
28
|
+
) => Promise<EnrollmentPlan>;
|
|
29
|
+
|
|
30
|
+
actions: (params: EnrollmentContext) => EnrollmentAdapterActions;
|
|
31
|
+
};
|
|
32
|
+
export const periodForReferenceDate = (referenceDate: Date, intervalCount = 1, interval = 'WEEKS') => {
|
|
33
|
+
const lowerCaseInterval = interval.toLowerCase();
|
|
34
|
+
|
|
35
|
+
const start = new Date(referenceDate);
|
|
36
|
+
if (lowerCaseInterval === 'hours') {
|
|
37
|
+
start.setMinutes(0, 0, 0);
|
|
38
|
+
} else {
|
|
39
|
+
start.setSeconds(0, 0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
start,
|
|
44
|
+
end: add(start, {
|
|
45
|
+
[lowerCaseInterval]: intervalCount,
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const EnrollmentAdapter: Omit<IEnrollmentAdapter, 'key' | 'label' | 'version'> = {
|
|
51
|
+
isActivatedFor: () => {
|
|
52
|
+
return false;
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
transformOrderItemToEnrollmentPlan: async (item) => {
|
|
56
|
+
return {
|
|
57
|
+
configuration: item.configuration,
|
|
58
|
+
productId: item.productId,
|
|
59
|
+
quantity: item.quantity,
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
actions: (context) => {
|
|
64
|
+
return {
|
|
65
|
+
configurationForOrder: async () => {
|
|
66
|
+
throw new Error(`Not implemented on EnrollmentAdapter`);
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
isOverdue: async () => false,
|
|
70
|
+
isValidForActivation: async () => false,
|
|
71
|
+
|
|
72
|
+
nextPeriod: async () => {
|
|
73
|
+
const { enrollment } = context;
|
|
74
|
+
const product = await (context as any).modules.products.findProduct({
|
|
75
|
+
productId: enrollment.productId,
|
|
76
|
+
});
|
|
77
|
+
const plan = product?.plan;
|
|
78
|
+
const referenceDate = new Date();
|
|
79
|
+
if (!plan) return null;
|
|
80
|
+
|
|
81
|
+
if (plan.trialIntervalCount && !enrollment?.periods?.length) {
|
|
82
|
+
return {
|
|
83
|
+
...periodForReferenceDate(referenceDate, plan.trialIntervalCount, plan.trialInterval),
|
|
84
|
+
isTrial: true,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const lastEnd = enrollment?.periods?.reduce((acc, item) => {
|
|
89
|
+
if (!acc) return item.end;
|
|
90
|
+
const endDate = new Date(item.end);
|
|
91
|
+
if (acc.getTime() < endDate.getTime()) {
|
|
92
|
+
return endDate;
|
|
93
|
+
}
|
|
94
|
+
return acc;
|
|
95
|
+
}, referenceDate);
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
...periodForReferenceDate(lastEnd, plan.billingIntervalCount, plan.billingInterval),
|
|
99
|
+
isTrial: false,
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
// eslint-disable-next-line
|
|
106
|
+
log(message: string, { level = LogLevel.Debug, ...options } = {}) {
|
|
107
|
+
return log(message, { level, ...options });
|
|
108
|
+
},
|
|
109
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { BaseDirector, IBaseDirector } from '@unchainedshop/utils';
|
|
2
|
+
import { EnrollmentAdapterActions, EnrollmentContext, IEnrollmentAdapter } from './EnrollmentAdapter.js';
|
|
3
|
+
import type { OrderPosition } from '@unchainedshop/core-orders';
|
|
4
|
+
import type { Product, ProductPlan } from '@unchainedshop/core-products';
|
|
5
|
+
import { Enrollment } from '@unchainedshop/core-enrollments';
|
|
6
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
7
|
+
|
|
8
|
+
const logger = createLogger('unchained:core');
|
|
9
|
+
|
|
10
|
+
export type IEnrollmentDirector = IBaseDirector<IEnrollmentAdapter> & {
|
|
11
|
+
transformOrderItemToEnrollment: (
|
|
12
|
+
item: { orderPosition: OrderPosition; product: Product },
|
|
13
|
+
doc: Omit<Enrollment, 'configuration' | 'productId' | 'quantity' | 'status' | 'periods' | 'log'>,
|
|
14
|
+
unchainedAPI,
|
|
15
|
+
) => Promise<Omit<Enrollment, 'status' | 'periods' | 'log'>>;
|
|
16
|
+
|
|
17
|
+
actions: (enrollmentContext: EnrollmentContext, unchainedAPI) => Promise<EnrollmentAdapterActions>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const baseDirector = BaseDirector<IEnrollmentAdapter>('EnrollmentDirector', {
|
|
21
|
+
adapterSortKey: 'orderIndex',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const findAppropriateAdapters = (productPlan?: ProductPlan) =>
|
|
25
|
+
baseDirector.getAdapters({
|
|
26
|
+
adapterFilter: (Adapter: IEnrollmentAdapter) => {
|
|
27
|
+
const activated = Adapter.isActivatedFor(productPlan);
|
|
28
|
+
if (!activated) {
|
|
29
|
+
logger.warn(`Enrollment Director -> ${Adapter.key} (${Adapter.version}) skipped`);
|
|
30
|
+
}
|
|
31
|
+
return activated;
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const EnrollmentDirector: IEnrollmentDirector = {
|
|
36
|
+
...baseDirector,
|
|
37
|
+
|
|
38
|
+
transformOrderItemToEnrollment: async ({ orderPosition, product }, doc, unchainedAPI) => {
|
|
39
|
+
const Adapter = findAppropriateAdapters(product.plan)?.[0];
|
|
40
|
+
if (!Adapter) {
|
|
41
|
+
throw new Error('No suitable enrollment plugin available for this item');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const enrollmentPlan = await Adapter.transformOrderItemToEnrollmentPlan(orderPosition, unchainedAPI);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
...doc,
|
|
48
|
+
...enrollmentPlan,
|
|
49
|
+
configuration: [],
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
actions: async (enrollmentContext, unchainedAPI) => {
|
|
54
|
+
const context = { ...enrollmentContext, ...unchainedAPI };
|
|
55
|
+
|
|
56
|
+
// Resolve adapter
|
|
57
|
+
const product = await context.modules.products.findProduct({
|
|
58
|
+
productId: context.enrollment.productId,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const Adapter = findAppropriateAdapters(product?.plan)?.[0];
|
|
62
|
+
|
|
63
|
+
if (!Adapter) {
|
|
64
|
+
throw new Error('No suitable enrollment plugin available for this plan configuration');
|
|
65
|
+
}
|
|
66
|
+
const adapter = Adapter.actions(context);
|
|
67
|
+
|
|
68
|
+
return adapter;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { log, LogLevel } from '@unchainedshop/logger';
|
|
2
|
+
import { Assortment } from '@unchainedshop/core-assortments';
|
|
3
|
+
import { mongodb } from '@unchainedshop/mongodb';
|
|
4
|
+
import { IBaseAdapter } from '@unchainedshop/utils';
|
|
5
|
+
import { Product } from '@unchainedshop/core-products';
|
|
6
|
+
import { Filter, SearchQuery } from '@unchainedshop/core-filters';
|
|
7
|
+
import { Modules } from '../modules.js';
|
|
8
|
+
|
|
9
|
+
export type FilterInputText = { locale: string; title: string; subtitle?: string };
|
|
10
|
+
|
|
11
|
+
export enum FilterError {
|
|
12
|
+
NOT_IMPLEMENTED = 'NOT_IMPLEMENTED',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type FilterContext = {
|
|
16
|
+
filter?: Filter;
|
|
17
|
+
searchQuery: SearchQuery;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface FilterAdapterActions {
|
|
21
|
+
aggregateProductIds: (params: { productIds: Array<string> }) => Array<string>;
|
|
22
|
+
|
|
23
|
+
searchAssortments: (
|
|
24
|
+
params: {
|
|
25
|
+
assortmentIds: Array<string>;
|
|
26
|
+
},
|
|
27
|
+
options?: {
|
|
28
|
+
filterSelector: mongodb.Filter<Filter>;
|
|
29
|
+
assortmentSelector: mongodb.Filter<Assortment>;
|
|
30
|
+
sortStage: mongodb.FindOptions['sort'];
|
|
31
|
+
},
|
|
32
|
+
) => Promise<Array<string>>;
|
|
33
|
+
|
|
34
|
+
searchProducts: (
|
|
35
|
+
params: {
|
|
36
|
+
productIds: Array<string>;
|
|
37
|
+
},
|
|
38
|
+
options?: {
|
|
39
|
+
filterSelector: mongodb.Filter<Filter>;
|
|
40
|
+
productSelector: mongodb.Filter<Product>;
|
|
41
|
+
sortStage: mongodb.FindOptions['sort'];
|
|
42
|
+
},
|
|
43
|
+
) => Promise<Array<string>>;
|
|
44
|
+
|
|
45
|
+
transformFilterSelector: (
|
|
46
|
+
query: mongodb.Filter<Filter>,
|
|
47
|
+
options?: any,
|
|
48
|
+
) => Promise<mongodb.Filter<Filter>>;
|
|
49
|
+
transformProductSelector: (
|
|
50
|
+
query: mongodb.Filter<Product>,
|
|
51
|
+
options?: { key?: string; value?: any },
|
|
52
|
+
) => Promise<mongodb.Filter<Product>>;
|
|
53
|
+
transformSortStage: (
|
|
54
|
+
sort: mongodb.FindOptions['sort'],
|
|
55
|
+
options?: { key: string; value?: any },
|
|
56
|
+
) => Promise<mongodb.FindOptions['sort']>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type IFilterAdapter = IBaseAdapter & {
|
|
60
|
+
orderIndex: number;
|
|
61
|
+
|
|
62
|
+
actions: (params: FilterContext & { modules: Modules }) => FilterAdapterActions;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const FilterAdapter: Omit<IFilterAdapter, 'key' | 'label' | 'version'> = {
|
|
66
|
+
orderIndex: 0,
|
|
67
|
+
|
|
68
|
+
actions: () => {
|
|
69
|
+
return {
|
|
70
|
+
// This function is called to check if a filter actually matches a certain productId
|
|
71
|
+
aggregateProductIds: ({ productIds }) => {
|
|
72
|
+
return productIds;
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
searchProducts: async ({ productIds }) => {
|
|
76
|
+
return productIds;
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
searchAssortments: async ({ assortmentIds }) => {
|
|
80
|
+
return assortmentIds;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
transformSortStage: async (lastStage) => {
|
|
84
|
+
return lastStage;
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// return a selector that is applied to Products.find to find relevant products
|
|
88
|
+
// if no key is provided, it expects either null for all products or a list of products that are relevant
|
|
89
|
+
transformProductSelector: async (lastSelector) => {
|
|
90
|
+
return lastSelector;
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
// return a selector that is applied to Filters.find to find relevant filters
|
|
94
|
+
transformFilterSelector: async (lastSelector) => {
|
|
95
|
+
return lastSelector;
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
log(message: string, { level = LogLevel.Debug, ...options } = {}) {
|
|
101
|
+
return log(message, { level, ...options });
|
|
102
|
+
},
|
|
103
|
+
};
|