@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,86 @@
|
|
|
1
|
+
import { Order } from '@unchainedshop/core-orders';
|
|
2
|
+
import { deliverySettings } from '@unchainedshop/core-delivery';
|
|
3
|
+
import { paymentSettings } from '@unchainedshop/core-payment';
|
|
4
|
+
import { supportedDeliveryProvidersService } from './supportedDeliveryProviders.js';
|
|
5
|
+
import { supportedPaymentProvidersService } from './supportedPaymentProviders.js';
|
|
6
|
+
import { Modules } from '../modules.js';
|
|
7
|
+
|
|
8
|
+
export async function initCartProvidersService(this: Modules, order: Order) {
|
|
9
|
+
let updatedOrder = order;
|
|
10
|
+
|
|
11
|
+
// Init delivery provider
|
|
12
|
+
const supportedDeliveryProviders = await supportedDeliveryProvidersService.bind(this)({
|
|
13
|
+
order: updatedOrder,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const orderDelivery = await this.orders.deliveries.findDelivery({
|
|
17
|
+
orderDeliveryId: updatedOrder.deliveryId,
|
|
18
|
+
});
|
|
19
|
+
const deliveryProviderId = orderDelivery?.deliveryProviderId;
|
|
20
|
+
|
|
21
|
+
const isAlreadyInitializedWithSupportedDeliveryProvider = supportedDeliveryProviders?.some(
|
|
22
|
+
(provider) => {
|
|
23
|
+
return provider._id === deliveryProviderId;
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (supportedDeliveryProviders?.length > 0 && !isAlreadyInitializedWithSupportedDeliveryProvider) {
|
|
28
|
+
const defaultOrderDeliveryProvider = await deliverySettings.determineDefaultProvider(
|
|
29
|
+
{
|
|
30
|
+
providers: supportedDeliveryProviders,
|
|
31
|
+
order: updatedOrder,
|
|
32
|
+
},
|
|
33
|
+
{ modules: this },
|
|
34
|
+
);
|
|
35
|
+
if (defaultOrderDeliveryProvider) {
|
|
36
|
+
updatedOrder = await this.orders.setDeliveryProvider(
|
|
37
|
+
updatedOrder._id,
|
|
38
|
+
defaultOrderDeliveryProvider._id,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Init payment provider
|
|
44
|
+
const supportedPaymentProviders = await supportedPaymentProvidersService.bind(this)({
|
|
45
|
+
order: updatedOrder,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const orderPayment = await this.orders.payments.findOrderPayment({
|
|
49
|
+
orderPaymentId: updatedOrder.paymentId,
|
|
50
|
+
});
|
|
51
|
+
const paymentProviderId = orderPayment?.paymentProviderId;
|
|
52
|
+
|
|
53
|
+
const isAlreadyInitializedWithSupportedPaymentProvider = supportedPaymentProviders?.some(
|
|
54
|
+
(provider) => {
|
|
55
|
+
return provider._id === paymentProviderId;
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (supportedPaymentProviders?.length > 0 && !isAlreadyInitializedWithSupportedPaymentProvider) {
|
|
60
|
+
const paymentCredentials = await this.payment.paymentCredentials.findPaymentCredentials(
|
|
61
|
+
{ userId: updatedOrder.userId, isPreferred: true },
|
|
62
|
+
{
|
|
63
|
+
sort: {
|
|
64
|
+
created: -1,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const defaultOrderPaymentProvider = await paymentSettings.determineDefaultProvider(
|
|
70
|
+
{
|
|
71
|
+
providers: supportedPaymentProviders,
|
|
72
|
+
order: updatedOrder,
|
|
73
|
+
paymentCredentials,
|
|
74
|
+
},
|
|
75
|
+
{ modules: this },
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
if (defaultOrderPaymentProvider) {
|
|
79
|
+
updatedOrder = await this.orders.setPaymentProvider(
|
|
80
|
+
updatedOrder._id,
|
|
81
|
+
defaultOrderPaymentProvider._id,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return updatedOrder;
|
|
86
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Enrollment } from '@unchainedshop/core-enrollments';
|
|
2
|
+
import { EnrollmentDirector } from '../core-index.js';
|
|
3
|
+
import { processEnrollmentService } from './processEnrollment.js';
|
|
4
|
+
import { Modules } from '../modules.js';
|
|
5
|
+
|
|
6
|
+
export async function initializeEnrollmentService(
|
|
7
|
+
this: Modules,
|
|
8
|
+
enrollment: Enrollment,
|
|
9
|
+
params: { orderIdForFirstPeriod?: string; reason: string },
|
|
10
|
+
) {
|
|
11
|
+
const director = await EnrollmentDirector.actions({ enrollment }, { modules: this });
|
|
12
|
+
const period = await director.nextPeriod();
|
|
13
|
+
|
|
14
|
+
let updatedEnrollment = enrollment;
|
|
15
|
+
if (period && (params.orderIdForFirstPeriod || period.isTrial)) {
|
|
16
|
+
updatedEnrollment = await this.enrollments.addEnrollmentPeriod(enrollment._id, {
|
|
17
|
+
...period,
|
|
18
|
+
orderId: params.orderIdForFirstPeriod,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const processedEnrollment = await processEnrollmentService.bind(this)(updatedEnrollment);
|
|
23
|
+
const user = await this.users.findUserById(enrollment.userId);
|
|
24
|
+
const locale = this.users.userLocale(user);
|
|
25
|
+
|
|
26
|
+
await this.worker.addWork({
|
|
27
|
+
type: 'MESSAGE',
|
|
28
|
+
retries: 0,
|
|
29
|
+
input: {
|
|
30
|
+
reason: params.reason || 'status_change',
|
|
31
|
+
locale,
|
|
32
|
+
template: 'ENROLLMENT_STATUS',
|
|
33
|
+
enrollmentId: processedEnrollment._id,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return processedEnrollment;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Modules } from '../modules.js';
|
|
2
|
+
import { FilterDirector } from '../core-index.js';
|
|
3
|
+
import { createLogger } from '@unchainedshop/logger';
|
|
4
|
+
|
|
5
|
+
const logger = createLogger('unchained:core');
|
|
6
|
+
|
|
7
|
+
export async function invalidateFilterCacheService(this: Modules) {
|
|
8
|
+
logger.debug('Filters: Start invalidating filter caches');
|
|
9
|
+
|
|
10
|
+
const filters = await this.filters.findFilters({ includeInactive: true });
|
|
11
|
+
|
|
12
|
+
await filters.reduce(async (lastPromise, filter) => {
|
|
13
|
+
await lastPromise;
|
|
14
|
+
return FilterDirector.invalidateProductIdCache(filter, { modules: this });
|
|
15
|
+
}, Promise.resolve(undefined));
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FileDirector } from '@unchainedshop/file-upload';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
|
|
4
|
+
export async function linkFileService(
|
|
5
|
+
this: Modules,
|
|
6
|
+
{ fileId, size, type }: { fileId: string; size: number; type?: string },
|
|
7
|
+
) {
|
|
8
|
+
const file = await this.files.findFile({ fileId });
|
|
9
|
+
if (file?.expires) {
|
|
10
|
+
await this.files.update(file._id, {
|
|
11
|
+
size: size || file.size,
|
|
12
|
+
type: type || file.type,
|
|
13
|
+
expires: null,
|
|
14
|
+
});
|
|
15
|
+
const callback = FileDirector.getFileUploadCallback(file.path);
|
|
16
|
+
if (callback) {
|
|
17
|
+
await callback(file, { modules: this });
|
|
18
|
+
}
|
|
19
|
+
return this.files.findFile({ fileId });
|
|
20
|
+
}
|
|
21
|
+
return file;
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FilterType, Filter, SearchQuery } from '@unchainedshop/core-filters';
|
|
2
|
+
import { intersectSet } from '@unchainedshop/utils';
|
|
3
|
+
import { Modules } from '../modules.js';
|
|
4
|
+
import { FilterDirector, parseQueryArray } from '../directors/FilterDirector.js';
|
|
5
|
+
|
|
6
|
+
export async function loadFilterOptionsService(
|
|
7
|
+
this: Modules,
|
|
8
|
+
filter: Filter,
|
|
9
|
+
params: {
|
|
10
|
+
searchQuery: SearchQuery;
|
|
11
|
+
forceLiveCollection: boolean;
|
|
12
|
+
productIdSet: Set<string>;
|
|
13
|
+
},
|
|
14
|
+
) {
|
|
15
|
+
const { forceLiveCollection, productIdSet, searchQuery } = params;
|
|
16
|
+
|
|
17
|
+
const filterQueryParsed = parseQueryArray(searchQuery?.filterQuery);
|
|
18
|
+
const values = filterQueryParsed[filter.key];
|
|
19
|
+
|
|
20
|
+
const allOptions = (filter.type === FilterType.SWITCH && ['true', 'false']) || filter.options || [];
|
|
21
|
+
const mappedOptions = await Promise.all(
|
|
22
|
+
allOptions.map(async (value) => {
|
|
23
|
+
const filterOptionProductIds = await FilterDirector.filterProductIds(
|
|
24
|
+
filter,
|
|
25
|
+
{
|
|
26
|
+
values: [value],
|
|
27
|
+
forceLiveCollection,
|
|
28
|
+
},
|
|
29
|
+
{ modules: this },
|
|
30
|
+
);
|
|
31
|
+
const filteredProductIdSet = intersectSet(productIdSet, new Set(filterOptionProductIds));
|
|
32
|
+
|
|
33
|
+
const normalizedValues = values && this.filters.parse(filter, values, [value]);
|
|
34
|
+
const isSelected = normalizedValues && normalizedValues.indexOf(value) !== -1;
|
|
35
|
+
|
|
36
|
+
if (!filteredProductIdSet.size && !isSelected) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
filteredProductIdSet,
|
|
42
|
+
searchQuery,
|
|
43
|
+
value,
|
|
44
|
+
filter,
|
|
45
|
+
isSelected,
|
|
46
|
+
};
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
49
|
+
return mappedOptions.filter(Boolean);
|
|
50
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { SearchQuery, defaultFilterSelector } from '@unchainedshop/core-filters';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
import { FilterDirector } from '../directors/FilterDirector.js';
|
|
4
|
+
|
|
5
|
+
export async function loadFiltersService(
|
|
6
|
+
this: Modules,
|
|
7
|
+
searchQuery: SearchQuery,
|
|
8
|
+
{ productIds, forceLiveCollection }: { productIds: Array<string>; forceLiveCollection: boolean },
|
|
9
|
+
) {
|
|
10
|
+
const filterActions = await FilterDirector.actions({ searchQuery }, { modules: this });
|
|
11
|
+
const filterSelector = await filterActions.transformFilterSelector(defaultFilterSelector(searchQuery));
|
|
12
|
+
|
|
13
|
+
if (!filterSelector) return [];
|
|
14
|
+
|
|
15
|
+
const otherFilters = await this.filters.findFilters({
|
|
16
|
+
...filterSelector,
|
|
17
|
+
limit: 0,
|
|
18
|
+
includeInactive: true,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const extractedFilterIds = (filterSelector?._id as any)?.$in || [];
|
|
22
|
+
const sortedFilters = otherFilters.sort((left, right) => {
|
|
23
|
+
const leftIndex = extractedFilterIds.indexOf(left._id);
|
|
24
|
+
const rightIndex = extractedFilterIds.indexOf(right._id);
|
|
25
|
+
return leftIndex - rightIndex;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return Promise.all(
|
|
29
|
+
sortedFilters.map(async (filter) => {
|
|
30
|
+
const { examinedProductIdSet, filteredByOtherFiltersSet, filteredByThisFilterSet } =
|
|
31
|
+
await FilterDirector.filterFacets(
|
|
32
|
+
filter,
|
|
33
|
+
{
|
|
34
|
+
searchQuery,
|
|
35
|
+
forceLiveCollection,
|
|
36
|
+
allProductIds: productIds,
|
|
37
|
+
otherFilters,
|
|
38
|
+
},
|
|
39
|
+
{ modules: this },
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
forceLiveCollection,
|
|
44
|
+
searchQuery,
|
|
45
|
+
filter,
|
|
46
|
+
examinedProductIdSet,
|
|
47
|
+
filteredByOtherFiltersSet,
|
|
48
|
+
filteredByThisFilterSet,
|
|
49
|
+
};
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Modules } from '../modules.js';
|
|
2
|
+
|
|
3
|
+
const hashBookmark = (bookmark) => {
|
|
4
|
+
return `${bookmark.productId}:${bookmark.userId}:${JSON.stringify(bookmark.meta || {})}`;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export async function migrateBookmarksService(
|
|
8
|
+
this: Modules,
|
|
9
|
+
{
|
|
10
|
+
fromUserId,
|
|
11
|
+
toUserId,
|
|
12
|
+
shouldMerge,
|
|
13
|
+
}: {
|
|
14
|
+
fromUserId: string;
|
|
15
|
+
toUserId: string;
|
|
16
|
+
shouldMerge: boolean;
|
|
17
|
+
countryContext: string;
|
|
18
|
+
},
|
|
19
|
+
) {
|
|
20
|
+
const fromBookmarks = await this.bookmarks.findBookmarks({ userId: fromUserId });
|
|
21
|
+
if (!fromBookmarks) {
|
|
22
|
+
// No bookmarks no copy needed
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!shouldMerge) {
|
|
26
|
+
await this.bookmarks.deleteByUserId(toUserId);
|
|
27
|
+
await this.bookmarks.replaceUserId(fromUserId, toUserId);
|
|
28
|
+
} else {
|
|
29
|
+
const toBookmarks = await this.bookmarks.findBookmarks({ userId: toUserId });
|
|
30
|
+
const toBookmarkHashes = toBookmarks.map(hashBookmark);
|
|
31
|
+
const newBookmarkIds = fromBookmarks
|
|
32
|
+
.filter((fromBookmark) => {
|
|
33
|
+
const hash = hashBookmark(fromBookmark);
|
|
34
|
+
return !toBookmarkHashes.includes(hash);
|
|
35
|
+
})
|
|
36
|
+
.map((bookmark) => bookmark._id);
|
|
37
|
+
await this.bookmarks.replaceUserId(fromUserId, toUserId, newBookmarkIds);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { updateCalculationService } from './updateCalculation.js';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
|
|
4
|
+
export async function migrateOrderCartsService(
|
|
5
|
+
this: Modules,
|
|
6
|
+
{
|
|
7
|
+
fromUserId,
|
|
8
|
+
toUserId,
|
|
9
|
+
shouldMerge,
|
|
10
|
+
countryContext,
|
|
11
|
+
}: {
|
|
12
|
+
fromUserId: string;
|
|
13
|
+
toUserId: string;
|
|
14
|
+
shouldMerge: boolean;
|
|
15
|
+
countryContext: string;
|
|
16
|
+
},
|
|
17
|
+
) {
|
|
18
|
+
const fromCart = await this.orders.cart({
|
|
19
|
+
countryContext,
|
|
20
|
+
userId: fromUserId,
|
|
21
|
+
});
|
|
22
|
+
const toCart = await this.orders.cart({
|
|
23
|
+
countryContext,
|
|
24
|
+
userId: toUserId,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (!fromCart) {
|
|
28
|
+
// No cart, don't copy
|
|
29
|
+
return toCart;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!toCart || !shouldMerge) {
|
|
33
|
+
// No destination cart, move whole cart
|
|
34
|
+
this.orders.setCartOwner({ orderId: fromCart._id, userId: toUserId });
|
|
35
|
+
return updateCalculationService.bind(this)(fromCart._id);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Move positions
|
|
39
|
+
this.orders.moveCartPositions({ fromOrderId: fromCart._id, toOrderId: toCart._id });
|
|
40
|
+
|
|
41
|
+
// Move billing address if target order has none
|
|
42
|
+
if (fromCart.billingAddress && !toCart.billingAddress) {
|
|
43
|
+
await this.orders.updateBillingAddress(toCart._id, fromCart.billingAddress);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Move contact data if target order has none
|
|
47
|
+
if (fromCart.contact && !toCart.contact) {
|
|
48
|
+
await this.orders.updateContact(toCart._id, fromCart.contact);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return updateCalculationService.bind(this)(toCart._id);
|
|
52
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { userSettings } from '@unchainedshop/core-users';
|
|
2
|
+
import { migrateBookmarksService } from './migrateBookmarks.js';
|
|
3
|
+
import { migrateOrderCartsService } from './migrateOrderCart.js';
|
|
4
|
+
|
|
5
|
+
export async function migrateUserDataService(userIdBeforeLogin: string, userId: string) {
|
|
6
|
+
const user = await this.users.findUserById(userId);
|
|
7
|
+
const userBeforeLogin = await this.users.findUserById(userIdBeforeLogin);
|
|
8
|
+
|
|
9
|
+
await migrateOrderCartsService.bind(this)({
|
|
10
|
+
fromUserId: userIdBeforeLogin,
|
|
11
|
+
toUserId: userId,
|
|
12
|
+
shouldMerge: userSettings.mergeUserCartsOnLogin,
|
|
13
|
+
countryContext: userBeforeLogin.lastLogin?.countryCode || user.lastLogin?.countryCode,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
await migrateBookmarksService.bind(this)({
|
|
17
|
+
fromUserId: userIdBeforeLogin,
|
|
18
|
+
toUserId: userId,
|
|
19
|
+
shouldMerge: userSettings.mergeUserCartsOnLogin,
|
|
20
|
+
countryContext: userBeforeLogin.lastLogin?.countryCode || user.lastLogin?.countryCode,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { resolveBestCurrency } from '@unchainedshop/utils';
|
|
2
|
+
import { User } from '@unchainedshop/core-users';
|
|
3
|
+
import { ordersSettings } from '@unchainedshop/core-orders';
|
|
4
|
+
import { initCartProvidersService } from './initCartProviders.js';
|
|
5
|
+
import { Modules } from '../modules.js';
|
|
6
|
+
|
|
7
|
+
export async function nextUserCartService(
|
|
8
|
+
this: Modules,
|
|
9
|
+
{
|
|
10
|
+
user,
|
|
11
|
+
orderNumber,
|
|
12
|
+
countryCode,
|
|
13
|
+
forceCartCreation,
|
|
14
|
+
}: {
|
|
15
|
+
user: User;
|
|
16
|
+
orderNumber?: string;
|
|
17
|
+
countryCode?: string;
|
|
18
|
+
forceCartCreation?: boolean;
|
|
19
|
+
},
|
|
20
|
+
) {
|
|
21
|
+
const cart = await this.orders.cart({
|
|
22
|
+
countryContext: countryCode || user.lastLogin?.countryCode,
|
|
23
|
+
orderNumber,
|
|
24
|
+
userId: user._id,
|
|
25
|
+
});
|
|
26
|
+
if (cart) return cart;
|
|
27
|
+
|
|
28
|
+
const shouldCreateNewCart = forceCartCreation || ordersSettings.ensureUserHasCart;
|
|
29
|
+
if (!shouldCreateNewCart) return null;
|
|
30
|
+
|
|
31
|
+
const countryObject = await this.countries.findCountry({ isoCode: countryCode });
|
|
32
|
+
const currencies = await this.currencies.findCurrencies({ includeInactive: false });
|
|
33
|
+
const currency = resolveBestCurrency(countryObject.defaultCurrencyCode, currencies);
|
|
34
|
+
|
|
35
|
+
const order = await this.orders.create({
|
|
36
|
+
userId: user._id,
|
|
37
|
+
orderNumber,
|
|
38
|
+
currency,
|
|
39
|
+
countryCode,
|
|
40
|
+
billingAddress: user.lastBillingAddress || user.profile?.address,
|
|
41
|
+
contact:
|
|
42
|
+
user.lastContact ||
|
|
43
|
+
(!user.guest
|
|
44
|
+
? {
|
|
45
|
+
telNumber: user.profile?.phoneMobile,
|
|
46
|
+
emailAddress: this.users.primaryEmail(user)?.address,
|
|
47
|
+
}
|
|
48
|
+
: {}),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return initCartProvidersService.bind(this)(order);
|
|
52
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Enrollment, EnrollmentStatus } from '@unchainedshop/core-enrollments';
|
|
2
|
+
import { Modules } from '../modules.js';
|
|
3
|
+
import { EnrollmentDirector } from '../core-index.js';
|
|
4
|
+
|
|
5
|
+
const findNextStatus = async (enrollment: Enrollment, modules: Modules): Promise<EnrollmentStatus> => {
|
|
6
|
+
let status = enrollment.status;
|
|
7
|
+
const director = await EnrollmentDirector.actions({ enrollment }, { modules });
|
|
8
|
+
|
|
9
|
+
if (status === EnrollmentStatus.INITIAL || status === EnrollmentStatus.PAUSED) {
|
|
10
|
+
if (await director.isValidForActivation()) {
|
|
11
|
+
status = EnrollmentStatus.ACTIVE;
|
|
12
|
+
}
|
|
13
|
+
} else if (status === EnrollmentStatus.ACTIVE) {
|
|
14
|
+
if (await director.isOverdue()) {
|
|
15
|
+
status = EnrollmentStatus.PAUSED;
|
|
16
|
+
}
|
|
17
|
+
} else if (modules.enrollments.isExpired(enrollment, {})) {
|
|
18
|
+
status = EnrollmentStatus.TERMINATED;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return status;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export async function processEnrollmentService(this: Modules, enrollment: Enrollment) {
|
|
25
|
+
const status = await findNextStatus(enrollment, this);
|
|
26
|
+
|
|
27
|
+
if (status === EnrollmentStatus.ACTIVE) {
|
|
28
|
+
// const nextEnrollment = await reactivateEnrollment(enrollment);
|
|
29
|
+
// TODO: Reactivate!
|
|
30
|
+
// status = await findNextStatus(nextEnrollment, unchainedAPI);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return this.enrollments.updateStatus(enrollment._id, {
|
|
34
|
+
status,
|
|
35
|
+
info: 'enrollment processed',
|
|
36
|
+
});
|
|
37
|
+
}
|