@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.
Files changed (530) hide show
  1. package/lib/core-index.d.ts +8 -61
  2. package/lib/core-index.d.ts.map +1 -1
  3. package/lib/core-index.js +9 -140
  4. package/lib/core-index.js.map +1 -1
  5. package/lib/core-index_BACKUP_57582.d.ts +26 -0
  6. package/lib/core-index_BACKUP_57582.d.ts.map +1 -0
  7. package/lib/core-index_BACKUP_57582.js +30 -0
  8. package/lib/core-index_BACKUP_57582.js.map +1 -0
  9. package/lib/core-index_BASE_57582.d.ts +74 -0
  10. package/lib/core-index_BASE_57582.d.ts.map +1 -0
  11. package/lib/core-index_BASE_57582.js +145 -0
  12. package/lib/core-index_BASE_57582.js.map +1 -0
  13. package/lib/core-index_LOCAL_57582.d.ts +26 -0
  14. package/lib/core-index_LOCAL_57582.d.ts.map +1 -0
  15. package/lib/core-index_LOCAL_57582.js +31 -0
  16. package/lib/core-index_LOCAL_57582.js.map +1 -0
  17. package/lib/core-index_REMOTE_57582.d.ts +74 -0
  18. package/lib/core-index_REMOTE_57582.d.ts.map +1 -0
  19. package/lib/core-index_REMOTE_57582.js +146 -0
  20. package/lib/core-index_REMOTE_57582.js.map +1 -0
  21. package/lib/directors/BaseDiscountAdapter.d.ts +38 -0
  22. package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -0
  23. package/lib/directors/BaseDiscountAdapter.js +48 -0
  24. package/lib/directors/BaseDiscountAdapter.js.map +1 -0
  25. package/lib/directors/BaseDiscountDirector.d.ts +12 -0
  26. package/lib/directors/BaseDiscountDirector.d.ts.map +1 -0
  27. package/lib/directors/BaseDiscountDirector.js +45 -0
  28. package/lib/directors/BaseDiscountDirector.js.map +1 -0
  29. package/lib/directors/BasePricingAdapter.d.ts +39 -0
  30. package/lib/directors/BasePricingAdapter.d.ts.map +1 -0
  31. package/lib/directors/BasePricingAdapter.js +25 -0
  32. package/lib/directors/BasePricingAdapter.js.map +1 -0
  33. package/lib/directors/BasePricingDirector.d.ts +17 -0
  34. package/lib/directors/BasePricingDirector.d.ts.map +1 -0
  35. package/lib/directors/BasePricingDirector.js +70 -0
  36. package/lib/directors/BasePricingDirector.js.map +1 -0
  37. package/lib/directors/BasePricingSheet.d.ts +46 -0
  38. package/lib/directors/BasePricingSheet.d.ts.map +1 -0
  39. package/lib/directors/BasePricingSheet.js +74 -0
  40. package/lib/directors/BasePricingSheet.js.map +1 -0
  41. package/lib/directors/DeliveryAdapter.d.ts +46 -0
  42. package/lib/directors/DeliveryAdapter.d.ts.map +1 -0
  43. package/lib/directors/DeliveryAdapter.js +50 -0
  44. package/lib/directors/DeliveryAdapter.js.map +1 -0
  45. package/lib/directors/DeliveryDirector.d.ts +15 -0
  46. package/lib/directors/DeliveryDirector.d.ts.map +1 -0
  47. package/lib/directors/DeliveryDirector.js +96 -0
  48. package/lib/directors/DeliveryDirector.js.map +1 -0
  49. package/lib/directors/DeliveryPricingAdapter.d.ts +49 -0
  50. package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -0
  51. package/lib/directors/DeliveryPricingAdapter.js +25 -0
  52. package/lib/directors/DeliveryPricingAdapter.js.map +1 -0
  53. package/lib/directors/DeliveryPricingDirector.d.ts +20 -0
  54. package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -0
  55. package/lib/directors/DeliveryPricingDirector.js +50 -0
  56. package/lib/directors/DeliveryPricingDirector.js.map +1 -0
  57. package/lib/directors/DeliveryPricingSheet.d.ts +10 -0
  58. package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -0
  59. package/lib/directors/DeliveryPricingSheet.js +75 -0
  60. package/lib/directors/DeliveryPricingSheet.js.map +1 -0
  61. package/lib/directors/EnrollmentAdapter.d.ts +27 -0
  62. package/lib/directors/EnrollmentAdapter.d.ts.map +1 -0
  63. package/lib/directors/EnrollmentAdapter.js +73 -0
  64. package/lib/directors/EnrollmentAdapter.js.map +1 -0
  65. package/lib/directors/EnrollmentDirector.d.ts +14 -0
  66. package/lib/directors/EnrollmentDirector.d.ts.map +1 -0
  67. package/lib/directors/EnrollmentDirector.js +44 -0
  68. package/lib/directors/EnrollmentDirector.js.map +1 -0
  69. package/lib/directors/FilterAdapter.d.ts +54 -0
  70. package/lib/directors/FilterAdapter.d.ts.map +1 -0
  71. package/lib/directors/FilterAdapter.js +38 -0
  72. package/lib/directors/FilterAdapter.js.map +1 -0
  73. package/lib/directors/FilterDirector.d.ts +40 -0
  74. package/lib/directors/FilterDirector.d.ts.map +1 -0
  75. package/lib/directors/FilterDirector.js +173 -0
  76. package/lib/directors/FilterDirector.js.map +1 -0
  77. package/lib/directors/MessagingDirector.d.ts +46 -0
  78. package/lib/directors/MessagingDirector.d.ts.map +1 -0
  79. package/lib/directors/MessagingDirector.js +10 -0
  80. package/lib/directors/MessagingDirector.js.map +1 -0
  81. package/lib/directors/OrderDiscountAdapter.d.ts +3 -0
  82. package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -0
  83. package/lib/directors/OrderDiscountAdapter.js +3 -0
  84. package/lib/directors/OrderDiscountAdapter.js.map +1 -0
  85. package/lib/directors/OrderDiscountConfiguration.d.ts +6 -0
  86. package/lib/directors/OrderDiscountConfiguration.d.ts.map +1 -0
  87. package/lib/directors/OrderDiscountConfiguration.js +2 -0
  88. package/lib/directors/OrderDiscountConfiguration.js.map +1 -0
  89. package/lib/directors/OrderDiscountDirector.d.ts +3 -0
  90. package/lib/directors/OrderDiscountDirector.d.ts.map +1 -0
  91. package/lib/directors/OrderDiscountDirector.js +3 -0
  92. package/lib/directors/OrderDiscountDirector.js.map +1 -0
  93. package/lib/directors/OrderPricingAdapter.d.ts +18 -0
  94. package/lib/directors/OrderPricingAdapter.d.ts.map +1 -0
  95. package/lib/directors/OrderPricingAdapter.js +24 -0
  96. package/lib/directors/OrderPricingAdapter.js.map +1 -0
  97. package/lib/directors/OrderPricingDirector.d.ts +18 -0
  98. package/lib/directors/OrderPricingDirector.d.ts.map +1 -0
  99. package/lib/directors/OrderPricingDirector.js +31 -0
  100. package/lib/directors/OrderPricingDirector.js.map +1 -0
  101. package/lib/directors/OrderPricingSheet.d.ts +37 -0
  102. package/lib/directors/OrderPricingSheet.d.ts.map +1 -0
  103. package/lib/directors/OrderPricingSheet.js +108 -0
  104. package/lib/directors/OrderPricingSheet.js.map +1 -0
  105. package/lib/directors/PaymentAdapter.d.ts +50 -0
  106. package/lib/directors/PaymentAdapter.d.ts.map +1 -0
  107. package/lib/directors/PaymentAdapter.js +55 -0
  108. package/lib/directors/PaymentAdapter.js.map +1 -0
  109. package/lib/directors/PaymentDirector.d.ts +21 -0
  110. package/lib/directors/PaymentDirector.d.ts.map +1 -0
  111. package/lib/directors/PaymentDirector.js +172 -0
  112. package/lib/directors/PaymentDirector.js.map +1 -0
  113. package/lib/directors/PaymentPricingAdapter.d.ts +48 -0
  114. package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -0
  115. package/lib/directors/PaymentPricingAdapter.js +25 -0
  116. package/lib/directors/PaymentPricingAdapter.js.map +1 -0
  117. package/lib/directors/PaymentPricingDirector.d.ts +18 -0
  118. package/lib/directors/PaymentPricingDirector.d.ts.map +1 -0
  119. package/lib/directors/PaymentPricingDirector.js +51 -0
  120. package/lib/directors/PaymentPricingDirector.js.map +1 -0
  121. package/lib/directors/PaymentPricingSheet.d.ts +9 -0
  122. package/lib/directors/PaymentPricingSheet.d.ts.map +1 -0
  123. package/lib/directors/PaymentPricingSheet.js +75 -0
  124. package/lib/directors/PaymentPricingSheet.js.map +1 -0
  125. package/lib/directors/ProductDiscountAdapter.d.ts +3 -0
  126. package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -0
  127. package/lib/directors/ProductDiscountAdapter.js +3 -0
  128. package/lib/directors/ProductDiscountAdapter.js.map +1 -0
  129. package/lib/directors/ProductDiscountConfiguration.d.ts +13 -0
  130. package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -0
  131. package/lib/directors/ProductDiscountConfiguration.js +2 -0
  132. package/lib/directors/ProductDiscountConfiguration.js.map +1 -0
  133. package/lib/directors/ProductDiscountDirector.d.ts +3 -0
  134. package/lib/directors/ProductDiscountDirector.d.ts.map +1 -0
  135. package/lib/directors/ProductDiscountDirector.js +3 -0
  136. package/lib/directors/ProductDiscountDirector.js.map +1 -0
  137. package/lib/directors/ProductPricingAdapter.d.ts +17 -0
  138. package/lib/directors/ProductPricingAdapter.d.ts.map +1 -0
  139. package/lib/directors/ProductPricingAdapter.js +24 -0
  140. package/lib/directors/ProductPricingAdapter.js.map +1 -0
  141. package/lib/directors/ProductPricingDirector.d.ts +21 -0
  142. package/lib/directors/ProductPricingDirector.d.ts.map +1 -0
  143. package/lib/directors/ProductPricingDirector.js +52 -0
  144. package/lib/directors/ProductPricingDirector.js.map +1 -0
  145. package/lib/directors/ProductPricingSheet.d.ts +38 -0
  146. package/lib/directors/ProductPricingSheet.d.ts.map +1 -0
  147. package/lib/directors/ProductPricingSheet.js +83 -0
  148. package/lib/directors/ProductPricingSheet.js.map +1 -0
  149. package/lib/directors/QuotationAdapter.d.ts +28 -0
  150. package/lib/directors/QuotationAdapter.d.ts.map +1 -0
  151. package/lib/directors/QuotationAdapter.js +46 -0
  152. package/lib/directors/QuotationAdapter.js.map +1 -0
  153. package/lib/directors/QuotationDirector.d.ts +7 -0
  154. package/lib/directors/QuotationDirector.d.ts.map +1 -0
  155. package/lib/directors/QuotationDirector.js +84 -0
  156. package/lib/directors/QuotationDirector.js.map +1 -0
  157. package/lib/directors/WarehousingAdapter.d.ts +40 -0
  158. package/lib/directors/WarehousingAdapter.d.ts.map +1 -0
  159. package/lib/directors/WarehousingAdapter.js +32 -0
  160. package/lib/directors/WarehousingAdapter.js.map +1 -0
  161. package/lib/directors/WarehousingDirector.d.ts +38 -0
  162. package/lib/directors/WarehousingDirector.d.ts.map +1 -0
  163. package/lib/directors/WarehousingDirector.js +169 -0
  164. package/lib/directors/WarehousingDirector.js.map +1 -0
  165. package/lib/directors/WorkerAdapter.d.ts +17 -0
  166. package/lib/directors/WorkerAdapter.d.ts.map +1 -0
  167. package/lib/directors/WorkerAdapter.js +11 -0
  168. package/lib/directors/WorkerAdapter.js.map +1 -0
  169. package/lib/directors/WorkerDirector.d.ts +26 -0
  170. package/lib/directors/WorkerDirector.d.ts.map +1 -0
  171. package/lib/directors/WorkerDirector.js +102 -0
  172. package/lib/directors/WorkerDirector.js.map +1 -0
  173. package/lib/directors/index.d.ts +39 -0
  174. package/lib/directors/index.d.ts.map +1 -0
  175. package/lib/directors/index.js +39 -0
  176. package/lib/directors/index.js.map +1 -0
  177. package/lib/modules.d.ts +61 -0
  178. package/lib/modules.d.ts.map +1 -0
  179. package/lib/modules.js +132 -0
  180. package/lib/modules.js.map +1 -0
  181. package/lib/services/activateEnrollment.d.ts +4 -0
  182. package/lib/services/activateEnrollment.d.ts.map +1 -0
  183. package/lib/services/activateEnrollment.js +25 -0
  184. package/lib/services/activateEnrollment.js.map +1 -0
  185. package/lib/services/calculateDiscountTotal.d.ts +7 -0
  186. package/lib/services/calculateDiscountTotal.d.ts.map +1 -0
  187. package/lib/services/calculateDiscountTotal.js +49 -0
  188. package/lib/services/calculateDiscountTotal.js.map +1 -0
  189. package/lib/services/checkoutOrder.d.ts +9 -0
  190. package/lib/services/checkoutOrder.d.ts.map +1 -0
  191. package/lib/services/checkoutOrder.js +28 -0
  192. package/lib/services/checkoutOrder.js.map +1 -0
  193. package/lib/services/confirmOrder.d.ts +9 -0
  194. package/lib/services/confirmOrder.d.ts.map +1 -0
  195. package/lib/services/confirmOrder.js +17 -0
  196. package/lib/services/confirmOrder.js.map +1 -0
  197. package/lib/services/createDownloadStream.d.ts +5 -0
  198. package/lib/services/createDownloadStream.d.ts.map +1 -0
  199. package/lib/services/createDownloadStream.js +8 -0
  200. package/lib/services/createDownloadStream.js.map +1 -0
  201. package/lib/services/createDownloadStreamService.d.ts +11 -0
  202. package/lib/services/createDownloadStreamService.d.ts.map +1 -0
  203. package/lib/services/createDownloadStreamService.js +9 -0
  204. package/lib/services/createDownloadStreamService.js.map +1 -0
  205. package/lib/services/createEnrollmentFromCheckout.d.ts +15 -0
  206. package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -0
  207. package/lib/services/createEnrollmentFromCheckout.js +40 -0
  208. package/lib/services/createEnrollmentFromCheckout.js.map +1 -0
  209. package/lib/services/createManualOrderDiscount.d.ts +7 -0
  210. package/lib/services/createManualOrderDiscount.d.ts.map +1 -0
  211. package/lib/services/createManualOrderDiscount.js +47 -0
  212. package/lib/services/createManualOrderDiscount.js.map +1 -0
  213. package/lib/services/createSignedURL.d.ts +8 -0
  214. package/lib/services/createSignedURL.d.ts.map +1 -0
  215. package/lib/services/createSignedURL.js +15 -0
  216. package/lib/services/createSignedURL.js.map +1 -0
  217. package/lib/services/createSignedURLService.d.ts +13 -0
  218. package/lib/services/createSignedURLService.d.ts.map +1 -0
  219. package/lib/services/createSignedURLService.js +14 -0
  220. package/lib/services/createSignedURLService.js.map +1 -0
  221. package/lib/services/deleteUser.d.ts +5 -0
  222. package/lib/services/deleteUser.d.ts.map +1 -0
  223. package/lib/services/deleteUser.js +26 -0
  224. package/lib/services/deleteUser.js.map +1 -0
  225. package/lib/services/deleteUserCartService.d.ts +6 -0
  226. package/lib/services/deleteUserCartService.d.ts.map +1 -0
  227. package/lib/services/deleteUserCartService.js +20 -0
  228. package/lib/services/deleteUserCartService.js.map +1 -0
  229. package/lib/services/deleteUserCarts.d.ts +5 -0
  230. package/lib/services/deleteUserCarts.d.ts.map +1 -0
  231. package/lib/services/deleteUserCarts.js +18 -0
  232. package/lib/services/deleteUserCarts.js.map +1 -0
  233. package/lib/services/deleteUserCartsService.d.ts +5 -0
  234. package/lib/services/deleteUserCartsService.d.ts.map +1 -0
  235. package/lib/services/deleteUserCartsService.js +18 -0
  236. package/lib/services/deleteUserCartsService.js.map +1 -0
  237. package/lib/services/discountedEntities.d.ts +5 -0
  238. package/lib/services/discountedEntities.d.ts.map +1 -0
  239. package/lib/services/discountedEntities.js +61 -0
  240. package/lib/services/discountedEntities.js.map +1 -0
  241. package/lib/services/ercMetadata.d.ts +7 -0
  242. package/lib/services/ercMetadata.d.ts.map +1 -0
  243. package/lib/services/ercMetadata.js +22 -0
  244. package/lib/services/ercMetadata.js.map +1 -0
  245. package/lib/services/fullfillQuotation.d.ts +4 -0
  246. package/lib/services/fullfillQuotation.d.ts.map +1 -0
  247. package/lib/services/fullfillQuotation.js +12 -0
  248. package/lib/services/fullfillQuotation.js.map +1 -0
  249. package/lib/services/index.d.ts +110 -0
  250. package/lib/services/index.d.ts.map +1 -0
  251. package/lib/services/index.js +124 -0
  252. package/lib/services/index.js.map +1 -0
  253. package/lib/services/index_BACKUP_58089.d.ts +246 -0
  254. package/lib/services/index_BACKUP_58089.d.ts.map +1 -0
  255. package/lib/services/index_BACKUP_58089.js +103 -0
  256. package/lib/services/index_BACKUP_58089.js.map +1 -0
  257. package/lib/services/index_BASE_58089.d.ts +31 -0
  258. package/lib/services/index_BASE_58089.d.ts.map +1 -0
  259. package/lib/services/index_BASE_58089.js +42 -0
  260. package/lib/services/index_BASE_58089.js.map +1 -0
  261. package/lib/services/index_LOCAL_58089.d.ts +246 -0
  262. package/lib/services/index_LOCAL_58089.d.ts.map +1 -0
  263. package/lib/services/index_LOCAL_58089.js +103 -0
  264. package/lib/services/index_LOCAL_58089.js.map +1 -0
  265. package/lib/services/index_REMOTE_58089.d.ts +34 -0
  266. package/lib/services/index_REMOTE_58089.d.ts.map +1 -0
  267. package/lib/services/index_REMOTE_58089.js +44 -0
  268. package/lib/services/index_REMOTE_58089.js.map +1 -0
  269. package/lib/services/initCartProviders.d.ts +4 -0
  270. package/lib/services/initCartProviders.d.ts.map +1 -0
  271. package/lib/services/initCartProviders.js +55 -0
  272. package/lib/services/initCartProviders.js.map +1 -0
  273. package/lib/services/initializeEnrollment.d.ts +7 -0
  274. package/lib/services/initializeEnrollment.d.ts.map +1 -0
  275. package/lib/services/initializeEnrollment.js +28 -0
  276. package/lib/services/initializeEnrollment.js.map +1 -0
  277. package/lib/services/invalidateFilterCache.d.ts +3 -0
  278. package/lib/services/invalidateFilterCache.d.ts.map +1 -0
  279. package/lib/services/invalidateFilterCache.js +12 -0
  280. package/lib/services/invalidateFilterCache.js.map +1 -0
  281. package/lib/services/linkFileService.d.ts +7 -0
  282. package/lib/services/linkFileService.d.ts.map +1 -0
  283. package/lib/services/linkFileService.js +18 -0
  284. package/lib/services/linkFileService.js.map +1 -0
  285. package/lib/services/loadFilterOptions.d.ts +14 -0
  286. package/lib/services/loadFilterOptions.d.ts.map +1 -0
  287. package/lib/services/loadFilterOptions.js +30 -0
  288. package/lib/services/loadFilterOptions.js.map +1 -0
  289. package/lib/services/loadFilters.d.ts +14 -0
  290. package/lib/services/loadFilters.d.ts.map +1 -0
  291. package/lib/services/loadFilters.js +36 -0
  292. package/lib/services/loadFilters.js.map +1 -0
  293. package/lib/services/migrateBookmarks.d.ts +8 -0
  294. package/lib/services/migrateBookmarks.d.ts.map +1 -0
  295. package/lib/services/migrateBookmarks.js +26 -0
  296. package/lib/services/migrateBookmarks.js.map +1 -0
  297. package/lib/services/migrateBookmarksService.d.ts +13 -0
  298. package/lib/services/migrateBookmarksService.d.ts.map +1 -0
  299. package/lib/services/migrateBookmarksService.js +26 -0
  300. package/lib/services/migrateBookmarksService.js.map +1 -0
  301. package/lib/services/migrateOrderCart.d.ts +8 -0
  302. package/lib/services/migrateOrderCart.d.ts.map +1 -0
  303. package/lib/services/migrateOrderCart.js +32 -0
  304. package/lib/services/migrateOrderCart.js.map +1 -0
  305. package/lib/services/migrateOrderCartService.d.ts +23 -0
  306. package/lib/services/migrateOrderCartService.d.ts.map +1 -0
  307. package/lib/services/migrateOrderCartService.js +32 -0
  308. package/lib/services/migrateOrderCartService.js.map +1 -0
  309. package/lib/services/migrateUserData.d.ts +2 -0
  310. package/lib/services/migrateUserData.d.ts.map +1 -0
  311. package/lib/services/migrateUserData.js +20 -0
  312. package/lib/services/migrateUserData.js.map +1 -0
  313. package/lib/services/migrateUserDataService.d.ts +19 -0
  314. package/lib/services/migrateUserDataService.d.ts.map +1 -0
  315. package/lib/services/migrateUserDataService.js +18 -0
  316. package/lib/services/migrateUserDataService.js.map +1 -0
  317. package/lib/services/nextUserCart.d.ts +9 -0
  318. package/lib/services/nextUserCart.d.ts.map +1 -0
  319. package/lib/services/nextUserCart.js +34 -0
  320. package/lib/services/nextUserCart.js.map +1 -0
  321. package/lib/services/nextUserCartService.d.ts +22 -0
  322. package/lib/services/nextUserCartService.d.ts.map +1 -0
  323. package/lib/services/nextUserCartService.js +35 -0
  324. package/lib/services/nextUserCartService.js.map +1 -0
  325. package/lib/services/processEnrollment.d.ts +4 -0
  326. package/lib/services/processEnrollment.d.ts.map +1 -0
  327. package/lib/services/processEnrollment.js +33 -0
  328. package/lib/services/processEnrollment.js.map +1 -0
  329. package/lib/services/processOrder.d.ts +9 -0
  330. package/lib/services/processOrder.d.ts.map +1 -0
  331. package/lib/services/processOrder.js +161 -0
  332. package/lib/services/processOrder.js.map +1 -0
  333. package/lib/services/processQuotation.d.ts +6 -0
  334. package/lib/services/processQuotation.d.ts.map +1 -0
  335. package/lib/services/processQuotation.js +60 -0
  336. package/lib/services/processQuotation.js.map +1 -0
  337. package/lib/services/proposeQuotation.d.ts +6 -0
  338. package/lib/services/proposeQuotation.d.ts.map +1 -0
  339. package/lib/services/proposeQuotation.js +12 -0
  340. package/lib/services/proposeQuotation.js.map +1 -0
  341. package/lib/services/registerPaymentCredentials.d.ts +5 -0
  342. package/lib/services/registerPaymentCredentials.d.ts.map +1 -0
  343. package/lib/services/registerPaymentCredentials.js +21 -0
  344. package/lib/services/registerPaymentCredentials.js.map +1 -0
  345. package/lib/services/rejectOrder.d.ts +9 -0
  346. package/lib/services/rejectOrder.d.ts.map +1 -0
  347. package/lib/services/rejectOrder.js +17 -0
  348. package/lib/services/rejectOrder.js.map +1 -0
  349. package/lib/services/rejectQuotation.d.ts +6 -0
  350. package/lib/services/rejectQuotation.d.ts.map +1 -0
  351. package/lib/services/rejectQuotation.js +12 -0
  352. package/lib/services/rejectQuotation.js.map +1 -0
  353. package/lib/services/removeFiles.d.ts +5 -0
  354. package/lib/services/removeFiles.d.ts.map +1 -0
  355. package/lib/services/removeFiles.js +19 -0
  356. package/lib/services/removeFiles.js.map +1 -0
  357. package/lib/services/removeFilesService.d.ts +10 -0
  358. package/lib/services/removeFilesService.d.ts.map +1 -0
  359. package/lib/services/removeFilesService.js +20 -0
  360. package/lib/services/removeFilesService.js.map +1 -0
  361. package/lib/services/removeProduct.d.ts +5 -0
  362. package/lib/services/removeProduct.d.ts.map +1 -0
  363. package/lib/services/removeProduct.js +26 -0
  364. package/lib/services/removeProduct.js.map +1 -0
  365. package/lib/services/removeProductService.d.ts +20 -0
  366. package/lib/services/removeProductService.d.ts.map +1 -0
  367. package/lib/services/removeProductService.js +27 -0
  368. package/lib/services/removeProductService.js.map +1 -0
  369. package/lib/services/searchAssortments.d.ts +19 -0
  370. package/lib/services/searchAssortments.d.ts.map +1 -0
  371. package/lib/services/searchAssortments.js +33 -0
  372. package/lib/services/searchAssortments.js.map +1 -0
  373. package/lib/services/searchProducts.d.ts +16 -0
  374. package/lib/services/searchProducts.d.ts.map +1 -0
  375. package/lib/services/searchProducts.js +41 -0
  376. package/lib/services/searchProducts.js.map +1 -0
  377. package/lib/services/supportedDeliveryProviders.d.ts +5 -0
  378. package/lib/services/supportedDeliveryProviders.d.ts.map +1 -0
  379. package/lib/services/supportedDeliveryProviders.js +14 -0
  380. package/lib/services/supportedDeliveryProviders.js.map +1 -0
  381. package/lib/services/supportedPaymentProviders.d.ts +5 -0
  382. package/lib/services/supportedPaymentProviders.d.ts.map +1 -0
  383. package/lib/services/supportedPaymentProviders.js +14 -0
  384. package/lib/services/supportedPaymentProviders.js.map +1 -0
  385. package/lib/services/supportedWarehousingProviders.d.ts +5 -0
  386. package/lib/services/supportedWarehousingProviders.d.ts.map +1 -0
  387. package/lib/services/supportedWarehousingProviders.js +10 -0
  388. package/lib/services/supportedWarehousingProviders.js.map +1 -0
  389. package/lib/services/terminateEnrollment.d.ts +3 -0
  390. package/lib/services/terminateEnrollment.d.ts.map +1 -0
  391. package/lib/services/terminateEnrollment.js +25 -0
  392. package/lib/services/terminateEnrollment.js.map +1 -0
  393. package/lib/services/updateCalculation.d.ts +3 -0
  394. package/lib/services/updateCalculation.d.ts.map +1 -0
  395. package/lib/services/updateCalculation.js +101 -0
  396. package/lib/services/updateCalculation.js.map +1 -0
  397. package/lib/services/updateCalculationService.d.ts +17 -0
  398. package/lib/services/updateCalculationService.d.ts.map +1 -0
  399. package/lib/services/updateCalculationService.js +68 -0
  400. package/lib/services/updateCalculationService.js.map +1 -0
  401. package/lib/services/updateScheduling.d.ts +8 -0
  402. package/lib/services/updateScheduling.d.ts.map +1 -0
  403. package/lib/services/updateScheduling.js +42 -0
  404. package/lib/services/updateScheduling.js.map +1 -0
  405. package/lib/services/updateUserAvatarAfterUpload.d.ts +6 -0
  406. package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -0
  407. package/lib/services/updateUserAvatarAfterUpload.js +25 -0
  408. package/lib/services/updateUserAvatarAfterUpload.js.map +1 -0
  409. package/lib/services/updateUserAvatarAfterUploadService.d.ts +18 -0
  410. package/lib/services/updateUserAvatarAfterUploadService.d.ts.map +1 -0
  411. package/lib/services/updateUserAvatarAfterUploadService.js +25 -0
  412. package/lib/services/updateUserAvatarAfterUploadService.js.map +1 -0
  413. package/lib/services/uploadFileFromStream.d.ts +8 -0
  414. package/lib/services/uploadFileFromStream.d.ts.map +1 -0
  415. package/lib/services/uploadFileFromStream.js +11 -0
  416. package/lib/services/uploadFileFromStream.js.map +1 -0
  417. package/lib/services/uploadFileFromStreamService.d.ts +12 -0
  418. package/lib/services/uploadFileFromStreamService.d.ts.map +1 -0
  419. package/lib/services/uploadFileFromStreamService.js +10 -0
  420. package/lib/services/uploadFileFromStreamService.js.map +1 -0
  421. package/lib/services/uploadFileFromURL.d.ts +13 -0
  422. package/lib/services/uploadFileFromURL.d.ts.map +1 -0
  423. package/lib/services/uploadFileFromURL.js +11 -0
  424. package/lib/services/uploadFileFromURL.js.map +1 -0
  425. package/lib/services/uploadFileFromURLService.d.ts +17 -0
  426. package/lib/services/uploadFileFromURLService.d.ts.map +1 -0
  427. package/lib/services/uploadFileFromURLService.js +10 -0
  428. package/lib/services/uploadFileFromURLService.js.map +1 -0
  429. package/lib/services/validateOrder.d.ts +4 -0
  430. package/lib/services/validateOrder.d.ts.map +1 -0
  431. package/lib/services/validateOrder.js +45 -0
  432. package/lib/services/validateOrder.js.map +1 -0
  433. package/lib/services/verifyQuotation.d.ts +6 -0
  434. package/lib/services/verifyQuotation.d.ts.map +1 -0
  435. package/lib/services/verifyQuotation.js +12 -0
  436. package/lib/services/verifyQuotation.js.map +1 -0
  437. package/package.json +28 -28
  438. package/src/core-index.ts +14 -241
  439. package/src/directors/BaseDiscountAdapter.test.ts +49 -0
  440. package/src/directors/BaseDiscountAdapter.ts +91 -0
  441. package/src/directors/BaseDiscountDirector.ts +72 -0
  442. package/src/directors/BasePricingAdapter.ts +82 -0
  443. package/src/directors/BasePricingDirector.ts +136 -0
  444. package/src/directors/BasePricingSheet.test.ts +43 -0
  445. package/src/directors/BasePricingSheet.ts +140 -0
  446. package/src/directors/DeliveryAdapter.ts +110 -0
  447. package/src/directors/DeliveryDirector.ts +135 -0
  448. package/src/directors/DeliveryPricingAdapter.ts +87 -0
  449. package/src/directors/DeliveryPricingDirector.ts +92 -0
  450. package/src/directors/DeliveryPricingSheet.ts +86 -0
  451. package/src/directors/EnrollmentAdapter.ts +109 -0
  452. package/src/directors/EnrollmentDirector.ts +70 -0
  453. package/src/directors/FilterAdapter.ts +103 -0
  454. package/src/directors/FilterDirector.ts +309 -0
  455. package/src/directors/MessagingDirector.test.ts +5 -0
  456. package/src/directors/MessagingDirector.ts +59 -0
  457. package/src/directors/OrderDiscountAdapter.ts +10 -0
  458. package/src/directors/OrderDiscountConfiguration.ts +5 -0
  459. package/src/directors/OrderDiscountDirector.ts +6 -0
  460. package/src/directors/OrderPricingAdapter.ts +63 -0
  461. package/src/directors/OrderPricingDirector.ts +74 -0
  462. package/src/directors/OrderPricingSheet.ts +147 -0
  463. package/src/directors/PaymentAdapter.ts +118 -0
  464. package/src/directors/PaymentDirector.ts +275 -0
  465. package/src/directors/PaymentPricingAdapter.ts +86 -0
  466. package/src/directors/PaymentPricingDirector.ts +94 -0
  467. package/src/directors/PaymentPricingSheet.ts +91 -0
  468. package/src/directors/ProductDiscountAdapter.ts +10 -0
  469. package/src/directors/ProductDiscountConfiguration.ts +18 -0
  470. package/src/directors/ProductDiscountDirector.ts +5 -0
  471. package/src/directors/ProductPricingAdapter.ts +56 -0
  472. package/src/directors/ProductPricingDirector.ts +100 -0
  473. package/src/directors/ProductPricingSheet.test.ts +129 -0
  474. package/src/directors/ProductPricingSheet.ts +127 -0
  475. package/src/directors/QuotationAdapter.ts +86 -0
  476. package/src/directors/QuotationDirector.ts +105 -0
  477. package/src/directors/WarehousingAdapter.ts +83 -0
  478. package/src/directors/WarehousingDirector.ts +235 -0
  479. package/src/directors/WorkerAdapter.ts +30 -0
  480. package/src/directors/WorkerDirector.ts +154 -0
  481. package/src/directors/index.ts +49 -0
  482. package/src/directors/periodForReferenceDate.test.ts +23 -0
  483. package/src/modules.ts +215 -0
  484. package/src/services/activateEnrollment.ts +30 -0
  485. package/src/services/calculateDiscountTotal.ts +71 -0
  486. package/src/services/checkoutOrder.ts +43 -0
  487. package/src/services/confirmOrder.ts +26 -0
  488. package/src/services/createDownloadStream.ts +16 -0
  489. package/src/services/createEnrollmentFromCheckout.ts +66 -0
  490. package/src/services/createManualOrderDiscount.ts +56 -0
  491. package/src/services/createSignedURL.ts +20 -0
  492. package/src/services/deleteUser.ts +33 -0
  493. package/src/services/discountedEntities.ts +81 -0
  494. package/src/services/ercMetadata.ts +33 -0
  495. package/src/services/fullfillQuotation.ts +14 -0
  496. package/src/services/index.ts +154 -0
  497. package/src/services/initCartProviders.ts +86 -0
  498. package/src/services/initializeEnrollment.ts +38 -0
  499. package/src/services/invalidateFilterCache.ts +16 -0
  500. package/src/services/linkFileService.ts +22 -0
  501. package/src/services/loadFilterOptions.ts +50 -0
  502. package/src/services/loadFilters.ts +52 -0
  503. package/src/services/migrateBookmarks.ts +39 -0
  504. package/src/services/migrateOrderCart.ts +52 -0
  505. package/src/services/migrateUserData.ts +22 -0
  506. package/src/services/nextUserCart.ts +52 -0
  507. package/src/services/processEnrollment.ts +37 -0
  508. package/src/services/processOrder.ts +241 -0
  509. package/src/services/processQuotation.ts +75 -0
  510. package/src/services/proposeQuotation.ts +18 -0
  511. package/src/services/registerPaymentCredentials.ts +30 -0
  512. package/src/services/rejectOrder.ts +26 -0
  513. package/src/services/rejectQuotation.ts +18 -0
  514. package/src/services/removeFiles.ts +25 -0
  515. package/src/services/removeProduct.ts +34 -0
  516. package/src/services/searchAssortments.ts +58 -0
  517. package/src/services/searchProducts.ts +73 -0
  518. package/src/services/supportedDeliveryProviders.ts +24 -0
  519. package/src/services/supportedPaymentProviders.ts +25 -0
  520. package/src/services/supportedWarehousingProviders.ts +18 -0
  521. package/src/services/terminateEnrollment.ts +29 -0
  522. package/src/services/updateCalculation.ts +143 -0
  523. package/src/services/updateScheduling.ts +64 -0
  524. package/src/services/updateUserAvatarAfterUpload.ts +30 -0
  525. package/src/services/uploadFileFromStream.ts +15 -0
  526. package/src/services/uploadFileFromURL.ts +29 -0
  527. package/src/services/validateOrder.ts +53 -0
  528. package/src/services/verifyQuotation.ts +18 -0
  529. package/tsconfig.json +5 -7
  530. package/src/types.ts +0 -7
@@ -0,0 +1,56 @@
1
+ import { Product, ProductConfiguration } from '@unchainedshop/core-products';
2
+ import { Order } from '@unchainedshop/core-orders';
3
+ import {
4
+ IProductPricingSheet,
5
+ ProductPricingCalculation,
6
+ ProductPricingSheet,
7
+ BasePricingAdapter,
8
+ BasePricingAdapterContext,
9
+ IPricingAdapter,
10
+ } from '../directors/index.js';
11
+ import { Modules } from '../modules.js';
12
+
13
+ export interface ProductPricingAdapterContext extends BasePricingAdapterContext {
14
+ country: string;
15
+ currency: string;
16
+ product: Product;
17
+ quantity: number;
18
+ configuration: Array<ProductConfiguration>;
19
+ order?: Order;
20
+ }
21
+
22
+ export type IProductPricingAdapter<DiscountConfiguration = unknown> = IPricingAdapter<
23
+ ProductPricingAdapterContext & { modules: Modules },
24
+ ProductPricingCalculation,
25
+ IProductPricingSheet,
26
+ DiscountConfiguration
27
+ >;
28
+
29
+ const basePricingAdapter = BasePricingAdapter<ProductPricingAdapterContext, ProductPricingCalculation>();
30
+
31
+ export const ProductPricingAdapter: IProductPricingAdapter = {
32
+ ...basePricingAdapter,
33
+
34
+ isActivatedFor: () => {
35
+ return false;
36
+ },
37
+
38
+ actions: (params) => {
39
+ const { context } = params;
40
+ const { currency, quantity } = context;
41
+ const baseActions = basePricingAdapter.actions(params);
42
+ const resultSheet = ProductPricingSheet({ currency, quantity });
43
+
44
+ return {
45
+ ...baseActions,
46
+ calculate: async () => {
47
+ const resultRaw = resultSheet.getRawPricingSheet();
48
+ resultRaw.forEach(({ amount, category }) =>
49
+ basePricingAdapter.log(`Product Item Calculation -> ${category} ${amount}`),
50
+ );
51
+ return resultRaw;
52
+ },
53
+ resultSheet: () => resultSheet,
54
+ };
55
+ },
56
+ };
@@ -0,0 +1,100 @@
1
+ import { Product, ProductConfiguration } from '@unchainedshop/core-products';
2
+ import { User } from '@unchainedshop/core-users';
3
+ import { Order, OrderDiscount, OrderPosition } from '@unchainedshop/core-orders';
4
+ import {
5
+ IProductPricingSheet,
6
+ ProductPricingCalculation,
7
+ ProductPricingSheet,
8
+ IProductPricingAdapter,
9
+ ProductPricingAdapterContext,
10
+ BasePricingDirector,
11
+ IPricingDirector,
12
+ } from '../directors/index.js';
13
+
14
+ export type ProductPricingContext =
15
+ | {
16
+ currency: string;
17
+ quantity: number;
18
+ country?: string;
19
+ discounts?: Array<OrderDiscount>;
20
+ order?: Order;
21
+ product?: Product;
22
+ configuration?: Array<ProductConfiguration>;
23
+ user?: User;
24
+ }
25
+ | {
26
+ currency: string;
27
+ quantity: number;
28
+ item: OrderPosition;
29
+ };
30
+
31
+ const baseDirector = BasePricingDirector<
32
+ ProductPricingContext,
33
+ ProductPricingAdapterContext,
34
+ ProductPricingCalculation,
35
+ IProductPricingAdapter
36
+ >('ProductPricingDirector');
37
+
38
+ export type IProductPricingDirector<DiscountConfiguration = unknown> = IPricingDirector<
39
+ ProductPricingContext,
40
+ ProductPricingCalculation,
41
+ ProductPricingAdapterContext,
42
+ IProductPricingSheet,
43
+ IProductPricingAdapter<DiscountConfiguration>
44
+ >;
45
+
46
+ export const ProductPricingDirector: IProductPricingDirector<any> = {
47
+ ...baseDirector,
48
+
49
+ async buildPricingContext(context, unchainedAPI) {
50
+ const { modules } = unchainedAPI;
51
+ const { quantity = 1, currency } = context;
52
+
53
+ if ('item' in context) {
54
+ const { item } = context;
55
+
56
+ const product = await modules.products.findProduct({
57
+ productId: item.productId,
58
+ });
59
+ const order = await modules.orders.findOrder({
60
+ orderId: item.orderId,
61
+ });
62
+ const user = await modules.users.findUserById(order.userId);
63
+ const discounts = await modules.orders.discounts.findOrderDiscounts({
64
+ orderId: item.orderId,
65
+ });
66
+
67
+ return {
68
+ ...unchainedAPI,
69
+ country: order.countryCode,
70
+ currency,
71
+ discounts,
72
+ order,
73
+ product,
74
+ quantity,
75
+ configuration: item.configuration,
76
+ user,
77
+ };
78
+ }
79
+
80
+ return {
81
+ ...unchainedAPI,
82
+ country: context.country,
83
+ currency,
84
+ discounts: [],
85
+ order: context.order,
86
+ product: context.product,
87
+ quantity,
88
+ configuration: context.configuration,
89
+ user: context.user,
90
+ };
91
+ },
92
+
93
+ calculationSheet(pricingContext, calculation) {
94
+ return ProductPricingSheet({
95
+ calculation,
96
+ currency: pricingContext.currency,
97
+ quantity: pricingContext.quantity ?? 1,
98
+ });
99
+ },
100
+ };
@@ -0,0 +1,129 @@
1
+ import { ProductPricingSheet } from './ProductPricingSheet.js';
2
+
3
+ const TAX = { category: 'TAX', amount: 50, isNetPrice: false, isTaxable: false };
4
+ const TAX2 = { category: 'TAX', amount: 25, isNetPrice: false, isTaxable: false };
5
+ const DISCOUNT = {
6
+ category: 'DISCOUNT',
7
+ amount: 20,
8
+ isNetPrice: false,
9
+ isTaxable: false,
10
+ discountId: 'for-all',
11
+ };
12
+ const DISCOUNT2 = {
13
+ category: 'DISCOUNT',
14
+ amount: 20,
15
+ isNetPrice: false,
16
+ isTaxable: false,
17
+ discountId: 'for-all',
18
+ };
19
+ const DISCOUNT3 = {
20
+ category: 'DISCOUNT',
21
+ amount: 20,
22
+ isNetPrice: false,
23
+ isTaxable: false,
24
+ discountId: 'special',
25
+ };
26
+ const ITEM1 = { category: 'ITEM', amount: 200, isNetPrice: true, isTaxable: false };
27
+ const ITEM2 = { category: 'ITEM', amount: 200, isNetPrice: true, isTaxable: false };
28
+ const calculations = [TAX, TAX2, DISCOUNT, DISCOUNT2, DISCOUNT3, ITEM1, ITEM2];
29
+
30
+ describe('ProductPricingSheet', () => {
31
+ let pricingSheet;
32
+
33
+ const pricingSheetParams = {
34
+ calculation: calculations,
35
+ currency: 'CHF',
36
+ quantity: 2,
37
+ };
38
+ beforeEach(() => {
39
+ pricingSheet = ProductPricingSheet(pricingSheetParams);
40
+ });
41
+
42
+ it('should return an object that implements the IProductPricingSheet interface', () => {
43
+ expect(pricingSheet).toBeDefined();
44
+ expect(pricingSheet.quantity).toEqual(2);
45
+ expect(pricingSheet.currency).toEqual('CHF');
46
+ expect(typeof pricingSheet.addItem).toBe('function');
47
+ expect(typeof pricingSheet.addDiscount).toBe('function');
48
+ expect(typeof pricingSheet.addTax).toBe('function');
49
+ expect(typeof pricingSheet.taxSum).toBe('function');
50
+ expect(typeof pricingSheet.unitPrice).toBe('function');
51
+ expect(typeof pricingSheet.discountPrices).toBe('function');
52
+ });
53
+
54
+ it('gross() should return the GROSS sum of all ProductPricingCalculation', () => {
55
+ expect(pricingSheet.gross()).toEqual(535);
56
+ });
57
+
58
+ it('net() should return the NET sum of all ProductPricingCalculation (i.e before TAX)', () => {
59
+ expect(pricingSheet.net()).toEqual(460);
60
+ });
61
+
62
+ describe('total()', () => {
63
+ it('should return sum of all ProductPricingCalculations ', () => {
64
+ expect(pricingSheet.total()).toEqual({ amount: 535, currency: 'CHF' });
65
+ expect(pricingSheet.total()).toEqual({ amount: pricingSheet.gross(), currency: 'CHF' });
66
+ });
67
+
68
+ it('should return sum of all ProductPricingCalculations ', () => {
69
+ expect(pricingSheet.total({ useNetPrice: true })).toEqual({ amount: 460, currency: 'CHF' });
70
+ expect(pricingSheet.total({ useNetPrice: true })).toEqual({
71
+ amount: pricingSheet.net(),
72
+ currency: 'CHF',
73
+ });
74
+ });
75
+
76
+ it('should return sum of all ProductPricingCalculations for the provided category ', () => {
77
+ expect(pricingSheet.total({ category: 'ITEM' })).toEqual({ amount: 400, currency: 'CHF' });
78
+ expect(pricingSheet.total({ category: 'DISCOUNT' })).toEqual({ amount: 60, currency: 'CHF' });
79
+ expect(pricingSheet.total({ category: 'TAX' })).toEqual({ amount: 75, currency: 'CHF' });
80
+ });
81
+ });
82
+
83
+ describe('isValid()', () => {
84
+ it('should return true if there is at least 1 registered ProductPricingCalculation ', () => {
85
+ expect(pricingSheet.isValid()).toEqual(true);
86
+ });
87
+ it('should return false if there is no registered ProductPricingCalculation ', () => {
88
+ const sheet = ProductPricingSheet({ ...pricingSheetParams, calculation: [] });
89
+ expect(sheet.isValid()).toEqual(false);
90
+ });
91
+ });
92
+
93
+ describe('getRawPricingSheet', () => {
94
+ it('should return all registered ProductPricingCalculation', () => {
95
+ expect(pricingSheet.getRawPricingSheet()).toEqual(calculations);
96
+ });
97
+ });
98
+
99
+ describe('taxSum', () => {
100
+ it('should return the sum of TAX calculation registered on the adapter', () => {
101
+ expect(pricingSheet.taxSum()).toEqual(75);
102
+ });
103
+ });
104
+
105
+ describe('unitPrice', () => {
106
+ it('should return the GROSS sum for a product price useNetPrice:false', () => {
107
+ expect(pricingSheet.unitPrice({ useNetPrice: false })).toEqual({ amount: 268, currency: 'CHF' });
108
+ });
109
+
110
+ it('should return the NET sum for a product price when useNetPrice:true', () => {
111
+ expect(pricingSheet.unitPrice({ useNetPrice: true })).toEqual({ amount: 230, currency: 'CHF' });
112
+ });
113
+ });
114
+
115
+ describe('discountPrices', () => {
116
+ it('should return the sum of all discounts registered on the price sheet based on discountId', () => {
117
+ expect(pricingSheet.discountPrices('for-all')).toEqual([
118
+ { amount: 40, currency: 'CHF', discountId: 'for-all' },
119
+ ]);
120
+ expect(pricingSheet.discountPrices('special')).toEqual([
121
+ { amount: 20, currency: 'CHF', discountId: 'special' },
122
+ ]);
123
+ });
124
+
125
+ it('should return empty array if discount with the provided discountId is not found', () => {
126
+ expect(pricingSheet.discountPrices('non-existing')).toEqual([]);
127
+ });
128
+ });
129
+ });
@@ -0,0 +1,127 @@
1
+ import { PricingCalculation } from '@unchainedshop/utils';
2
+
3
+ import { BasePricingSheet, IPricingSheet, PricingSheetParams } from '../directors/index.js';
4
+
5
+ export interface ProductPricingCalculation extends PricingCalculation {
6
+ discountId?: string;
7
+ isTaxable: boolean;
8
+ isNetPrice: boolean;
9
+ rate?: number;
10
+ }
11
+ export enum ProductPricingRowCategory {
12
+ Item = 'ITEM',
13
+ Discount = 'DISCOUNT',
14
+ Tax = 'TAX',
15
+ }
16
+
17
+ export interface IProductPricingSheet extends IPricingSheet<ProductPricingCalculation> {
18
+ addItem: (params: Omit<ProductPricingCalculation, 'category' | 'discountId'>) => void;
19
+
20
+ addTax: (params: {
21
+ amount: number;
22
+ rate: number;
23
+ baseCategory?: string;
24
+ discountId?: string;
25
+ meta?: any;
26
+ }) => void;
27
+
28
+ addDiscount: (params: {
29
+ amount: number;
30
+ isTaxable: boolean;
31
+ isNetPrice: boolean;
32
+ discountId: string;
33
+ meta?: any;
34
+ }) => void;
35
+
36
+ unitPrice: (params?: { useNetPrice: boolean }) => {
37
+ amount: number;
38
+ currency: string;
39
+ };
40
+ }
41
+
42
+ export const ProductPricingSheet = (
43
+ params: PricingSheetParams<ProductPricingCalculation>,
44
+ ): IProductPricingSheet => {
45
+ const basePricingSheet = BasePricingSheet<ProductPricingCalculation>(params);
46
+
47
+ const pricingSheet: IProductPricingSheet = {
48
+ ...basePricingSheet,
49
+
50
+ addDiscount({ amount, isTaxable, isNetPrice, discountId, meta }) {
51
+ basePricingSheet.calculation.push({
52
+ category: ProductPricingRowCategory.Discount,
53
+ amount,
54
+ isTaxable,
55
+ isNetPrice,
56
+ discountId,
57
+ meta,
58
+ });
59
+ },
60
+
61
+ addItem({ amount, isTaxable, isNetPrice, meta }) {
62
+ basePricingSheet.calculation.push({
63
+ category: ProductPricingRowCategory.Item,
64
+ amount,
65
+ isTaxable,
66
+ isNetPrice,
67
+ meta,
68
+ });
69
+ },
70
+
71
+ addTax({ amount, baseCategory, rate, meta, discountId }) {
72
+ basePricingSheet.calculation.push({
73
+ category: ProductPricingRowCategory.Tax,
74
+ baseCategory,
75
+ discountId,
76
+ amount,
77
+ isTaxable: false,
78
+ isNetPrice: false,
79
+ rate,
80
+ meta,
81
+ });
82
+ },
83
+
84
+ taxSum(filter) {
85
+ return basePricingSheet.sum({
86
+ category: ProductPricingRowCategory.Tax,
87
+ ...(filter || {}),
88
+ });
89
+ },
90
+
91
+ unitPrice(unitPriceParams) {
92
+ const amount = unitPriceParams?.useNetPrice ? this.net() : this.gross();
93
+ return {
94
+ amount: Math.round(amount / (this.quantity ?? 1)),
95
+ currency: this.currency,
96
+ };
97
+ },
98
+
99
+ discountPrices(explicitDiscountId) {
100
+ const discountIds = pricingSheet
101
+ .filterBy({
102
+ category: ProductPricingRowCategory.Discount,
103
+ discountId: explicitDiscountId,
104
+ })
105
+ .map(({ discountId }) => discountId);
106
+
107
+ return [...new Set(discountIds)]
108
+ .map((discountId) => {
109
+ const amount = basePricingSheet.sum({
110
+ category: ProductPricingRowCategory.Discount,
111
+ discountId,
112
+ });
113
+ if (!amount) {
114
+ return null;
115
+ }
116
+ return {
117
+ discountId,
118
+ amount: Math.round(amount),
119
+ currency: basePricingSheet.currency,
120
+ };
121
+ })
122
+ .filter(Boolean);
123
+ },
124
+ };
125
+
126
+ return pricingSheet;
127
+ };
@@ -0,0 +1,86 @@
1
+ import {
2
+ Quotation,
3
+ QuotationItemConfiguration,
4
+ QuotationProposal,
5
+ } from '@unchainedshop/core-quotations';
6
+ import { log, LogLevel } from '@unchainedshop/logger';
7
+ import { IBaseAdapter } from '@unchainedshop/utils';
8
+
9
+ export type QuotationContext = {
10
+ quotation?: Quotation;
11
+ };
12
+
13
+ export interface QuotationAdapterActions {
14
+ configurationError: () => QuotationError;
15
+ isManualProposalRequired: () => Promise<boolean>;
16
+ isManualRequestVerificationRequired: () => Promise<boolean>;
17
+ quote: () => Promise<QuotationProposal>;
18
+ rejectRequest: (unchainedAPI?: any) => Promise<boolean>;
19
+ submitRequest: (unchainedAPI?: any) => Promise<boolean>;
20
+ verifyRequest: (unchainedAPI?: any) => Promise<boolean>;
21
+
22
+ transformItemConfiguration: (
23
+ params: QuotationItemConfiguration,
24
+ ) => Promise<QuotationItemConfiguration>;
25
+ }
26
+
27
+ export type IQuotationAdapter = IBaseAdapter & {
28
+ orderIndex: number;
29
+ isActivatedFor: (quotationContext: QuotationContext, unchainedAPI) => boolean;
30
+ actions: (params: QuotationContext) => QuotationAdapterActions;
31
+ };
32
+
33
+ export enum QuotationError {
34
+ ADAPTER_NOT_FOUND = 'ADAPTER_NOT_FOUND',
35
+ NOT_IMPLEMENTED = 'NOT_IMPLEMENTED',
36
+ INCOMPLETE_CONFIGURATION = 'INCOMPLETE_CONFIGURATION',
37
+ WRONG_CREDENTIALS = 'WRONG_CREDENTIALS',
38
+ }
39
+
40
+ export const QuotationAdapter: Omit<IQuotationAdapter, 'key' | 'label' | 'version'> = {
41
+ orderIndex: 0,
42
+
43
+ isActivatedFor: () => {
44
+ return false;
45
+ },
46
+
47
+ actions: () => {
48
+ return {
49
+ configurationError: () => {
50
+ return QuotationError.NOT_IMPLEMENTED;
51
+ },
52
+
53
+ isManualRequestVerificationRequired: async () => {
54
+ return true;
55
+ },
56
+
57
+ isManualProposalRequired: async () => {
58
+ return true;
59
+ },
60
+
61
+ quote: async () => {
62
+ return {};
63
+ },
64
+
65
+ rejectRequest: async () => {
66
+ return true;
67
+ },
68
+
69
+ submitRequest: async () => {
70
+ return true;
71
+ },
72
+
73
+ verifyRequest: async () => {
74
+ return true;
75
+ },
76
+
77
+ transformItemConfiguration: async ({ quantity, configuration }) => {
78
+ return { quantity, configuration };
79
+ },
80
+ };
81
+ },
82
+
83
+ log(message: string, { level = LogLevel.Debug, ...options } = {}) {
84
+ return log(message, { level, ...options });
85
+ },
86
+ };
@@ -0,0 +1,105 @@
1
+ import { BaseDirector, IBaseDirector } from '@unchainedshop/utils';
2
+ import {
3
+ QuotationError,
4
+ IQuotationAdapter,
5
+ QuotationAdapterActions,
6
+ QuotationContext,
7
+ } from './QuotationAdapter.js';
8
+ import { createLogger } from '@unchainedshop/logger';
9
+
10
+ const logger = createLogger('unchained:core');
11
+
12
+ export type IQuotationDirector = IBaseDirector<IQuotationAdapter> & {
13
+ actions: (quotationContext: QuotationContext, unchainedAPI) => Promise<QuotationAdapterActions>;
14
+ };
15
+
16
+ const baseDirector = BaseDirector<IQuotationAdapter>('QuotationDirector', {
17
+ adapterSortKey: 'orderIndex',
18
+ });
19
+
20
+ const findAppropriateAdapters = (quotationContext: QuotationContext, unchainedAPI) =>
21
+ baseDirector.getAdapters({
22
+ adapterFilter: (Adapter: IQuotationAdapter) => {
23
+ const activated = Adapter.isActivatedFor(quotationContext, unchainedAPI);
24
+ if (!activated) {
25
+ logger.warn(`Quotation Director -> ${Adapter.key} (${Adapter.version}) skipped`);
26
+ }
27
+ return activated;
28
+ },
29
+ });
30
+
31
+ export const QuotationDirector: IQuotationDirector = {
32
+ ...baseDirector,
33
+
34
+ actions: async (quotationContext, unchainedAPI) => {
35
+ const context = { ...quotationContext, ...unchainedAPI };
36
+
37
+ const Adapter = findAppropriateAdapters(quotationContext, unchainedAPI)?.shift();
38
+
39
+ if (!Adapter) {
40
+ throw new Error('No suitable quotation plugin available for this context');
41
+ }
42
+
43
+ const adapter = Adapter.actions(context);
44
+
45
+ return {
46
+ configurationError: () => {
47
+ try {
48
+ return adapter.configurationError();
49
+ } catch (error) {
50
+ logger.warn('QuotationDirector -> Error while checking for configurationError', {
51
+ ...error,
52
+ });
53
+ return QuotationError.ADAPTER_NOT_FOUND;
54
+ }
55
+ },
56
+
57
+ isManualRequestVerificationRequired: async () => {
58
+ try {
59
+ const isRequired = await adapter.isManualRequestVerificationRequired();
60
+ return isRequired;
61
+ } catch (error) {
62
+ logger.error(
63
+ 'QuotationDirector -> Error while checking if is manual request verification required',
64
+ {
65
+ ...error,
66
+ },
67
+ );
68
+ return null;
69
+ }
70
+ },
71
+
72
+ isManualProposalRequired: async () => {
73
+ try {
74
+ const isRequired = await adapter.isManualProposalRequired();
75
+ return isRequired;
76
+ } catch (error) {
77
+ logger.error('QuotationDirector -> Error while checking if is manual proposal required', {
78
+ ...error,
79
+ });
80
+ return null;
81
+ }
82
+ },
83
+
84
+ quote: adapter.quote,
85
+ rejectRequest: adapter.rejectRequest,
86
+ submitRequest: adapter.submitRequest,
87
+ verifyRequest: adapter.verifyRequest,
88
+
89
+ transformItemConfiguration: async ({ quantity, configuration }) => {
90
+ try {
91
+ const itemConfiguration = await adapter.transformItemConfiguration({
92
+ quantity,
93
+ configuration,
94
+ });
95
+ return itemConfiguration;
96
+ } catch (error) {
97
+ logger.error('QuotationDirector -> Error while transforming item configuration', {
98
+ ...error,
99
+ });
100
+ return null;
101
+ }
102
+ },
103
+ };
104
+ },
105
+ };
@@ -0,0 +1,83 @@
1
+ import { log, LogLevel } from '@unchainedshop/logger';
2
+ import { IBaseAdapter } from '@unchainedshop/utils';
3
+ import { DeliveryProvider } from '@unchainedshop/core-delivery';
4
+ import { Product } from '@unchainedshop/core-products';
5
+ import { Order, OrderPosition } from '@unchainedshop/core-orders';
6
+ import {
7
+ TokenSurrogate,
8
+ WarehousingConfiguration,
9
+ WarehousingProviderType,
10
+ } from '@unchainedshop/core-warehousing';
11
+
12
+ export enum WarehousingError {
13
+ ADAPTER_NOT_FOUND = 'ADAPTER_NOT_FOUND',
14
+ NOT_IMPLEMENTED = 'NOT_IMPLEMENTED',
15
+ INCOMPLETE_CONFIGURATION = 'INCOMPLETE_CONFIGURATION',
16
+ WRONG_CREDENTIALS = 'WRONG_CREDENTIALS',
17
+ }
18
+
19
+ export type WarehousingAdapterActions = {
20
+ configurationError: () => WarehousingError;
21
+ isActive: () => boolean;
22
+ stock: (referenceDate: Date) => Promise<number>;
23
+ productionTime: (quantityToProduce: number) => Promise<number>;
24
+ commissioningTime: (quantity: number) => Promise<number>;
25
+ tokenize: () => Promise<Array<Omit<TokenSurrogate, 'userId' | 'productId' | 'orderPositionId'>>>;
26
+ tokenMetadata: (chainTokenId: string, referenceDate: Date) => Promise<any>;
27
+ isInvalidateable: (chainTokenId: string, referenceDate: Date) => Promise<boolean>;
28
+ };
29
+
30
+ export interface WarehousingContext {
31
+ deliveryProvider?: DeliveryProvider;
32
+ product?: Product;
33
+ token?: TokenSurrogate;
34
+ quantity?: number;
35
+ referenceDate?: Date;
36
+ locale?: Intl.Locale;
37
+ order?: Order;
38
+ warehousingProviderId?: string;
39
+ orderPosition?: OrderPosition;
40
+ }
41
+
42
+ export type IWarehousingAdapter = IBaseAdapter & {
43
+ orderIndex: number;
44
+ initialConfiguration: WarehousingConfiguration;
45
+ typeSupported: (type: WarehousingProviderType) => boolean;
46
+
47
+ actions: (config: WarehousingConfiguration, context: WarehousingContext) => WarehousingAdapterActions;
48
+ };
49
+
50
+ export const WarehousingAdapter: Omit<IWarehousingAdapter, 'key' | 'label' | 'version'> = {
51
+ orderIndex: 0,
52
+
53
+ typeSupported: () => {
54
+ return false;
55
+ },
56
+
57
+ initialConfiguration: [],
58
+
59
+ actions: () => {
60
+ return {
61
+ configurationError: () => WarehousingError.NOT_IMPLEMENTED,
62
+
63
+ isActive: () => false,
64
+
65
+ stock: async () => 0,
66
+
67
+ productionTime: async () => 0,
68
+
69
+ commissioningTime: async () => 0,
70
+
71
+ tokenize: async () => [],
72
+
73
+ tokenMetadata: async () => ({}),
74
+
75
+ isInvalidateable: async () => true,
76
+ };
77
+ },
78
+
79
+ log(message, { level = LogLevel.Debug, ...options } = {}) {
80
+ // eslint-disable-line
81
+ return log(message, { level, ...options });
82
+ },
83
+ };