@unchainedshop/core 3.0.0-alpha6 → 3.0.0-rc.11

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 (462) 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/directors/BaseDiscountAdapter.d.ts +36 -0
  6. package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -0
  7. package/lib/directors/BaseDiscountAdapter.js +48 -0
  8. package/lib/directors/BaseDiscountAdapter.js.map +1 -0
  9. package/lib/directors/BaseDiscountDirector.d.ts +15 -0
  10. package/lib/directors/BaseDiscountDirector.d.ts.map +1 -0
  11. package/lib/directors/BaseDiscountDirector.js +45 -0
  12. package/lib/directors/BaseDiscountDirector.js.map +1 -0
  13. package/lib/directors/BasePricingAdapter.d.ts +34 -0
  14. package/lib/directors/BasePricingAdapter.d.ts.map +1 -0
  15. package/lib/directors/BasePricingAdapter.js +25 -0
  16. package/lib/directors/BasePricingAdapter.js.map +1 -0
  17. package/lib/directors/BasePricingDirector.d.ts +17 -0
  18. package/lib/directors/BasePricingDirector.d.ts.map +1 -0
  19. package/lib/directors/BasePricingDirector.js +70 -0
  20. package/lib/directors/BasePricingDirector.js.map +1 -0
  21. package/lib/directors/BasePricingSheet.d.ts +46 -0
  22. package/lib/directors/BasePricingSheet.d.ts.map +1 -0
  23. package/lib/directors/BasePricingSheet.js +74 -0
  24. package/lib/directors/BasePricingSheet.js.map +1 -0
  25. package/lib/directors/DeliveryAdapter.d.ts +46 -0
  26. package/lib/directors/DeliveryAdapter.d.ts.map +1 -0
  27. package/lib/directors/DeliveryAdapter.js +50 -0
  28. package/lib/directors/DeliveryAdapter.js.map +1 -0
  29. package/lib/directors/DeliveryDirector.d.ts +15 -0
  30. package/lib/directors/DeliveryDirector.d.ts.map +1 -0
  31. package/lib/directors/DeliveryDirector.js +96 -0
  32. package/lib/directors/DeliveryDirector.js.map +1 -0
  33. package/lib/directors/DeliveryPricingAdapter.d.ts +49 -0
  34. package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -0
  35. package/lib/directors/DeliveryPricingAdapter.js +25 -0
  36. package/lib/directors/DeliveryPricingAdapter.js.map +1 -0
  37. package/lib/directors/DeliveryPricingDirector.d.ts +20 -0
  38. package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -0
  39. package/lib/directors/DeliveryPricingDirector.js +50 -0
  40. package/lib/directors/DeliveryPricingDirector.js.map +1 -0
  41. package/lib/directors/DeliveryPricingSheet.d.ts +10 -0
  42. package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -0
  43. package/lib/directors/DeliveryPricingSheet.js +75 -0
  44. package/lib/directors/DeliveryPricingSheet.js.map +1 -0
  45. package/lib/directors/EnrollmentAdapter.d.ts +27 -0
  46. package/lib/directors/EnrollmentAdapter.d.ts.map +1 -0
  47. package/lib/directors/EnrollmentAdapter.js +73 -0
  48. package/lib/directors/EnrollmentAdapter.js.map +1 -0
  49. package/lib/directors/EnrollmentDirector.d.ts +14 -0
  50. package/lib/directors/EnrollmentDirector.d.ts.map +1 -0
  51. package/lib/directors/EnrollmentDirector.js +44 -0
  52. package/lib/directors/EnrollmentDirector.js.map +1 -0
  53. package/lib/directors/FilterAdapter.d.ts +54 -0
  54. package/lib/directors/FilterAdapter.d.ts.map +1 -0
  55. package/lib/directors/FilterAdapter.js +38 -0
  56. package/lib/directors/FilterAdapter.js.map +1 -0
  57. package/lib/directors/FilterDirector.d.ts +40 -0
  58. package/lib/directors/FilterDirector.d.ts.map +1 -0
  59. package/lib/directors/FilterDirector.js +177 -0
  60. package/lib/directors/FilterDirector.js.map +1 -0
  61. package/lib/directors/MessagingDirector.d.ts +46 -0
  62. package/lib/directors/MessagingDirector.d.ts.map +1 -0
  63. package/lib/directors/MessagingDirector.js +10 -0
  64. package/lib/directors/MessagingDirector.js.map +1 -0
  65. package/lib/directors/OrderDiscountAdapter.d.ts +3 -0
  66. package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -0
  67. package/lib/directors/OrderDiscountAdapter.js +3 -0
  68. package/lib/directors/OrderDiscountAdapter.js.map +1 -0
  69. package/lib/directors/OrderDiscountConfiguration.d.ts +6 -0
  70. package/lib/directors/OrderDiscountConfiguration.d.ts.map +1 -0
  71. package/lib/directors/OrderDiscountConfiguration.js +2 -0
  72. package/lib/directors/OrderDiscountConfiguration.js.map +1 -0
  73. package/lib/directors/OrderDiscountDirector.d.ts +3 -0
  74. package/lib/directors/OrderDiscountDirector.d.ts.map +1 -0
  75. package/lib/directors/OrderDiscountDirector.js +3 -0
  76. package/lib/directors/OrderDiscountDirector.js.map +1 -0
  77. package/lib/directors/OrderPricingAdapter.d.ts +18 -0
  78. package/lib/directors/OrderPricingAdapter.d.ts.map +1 -0
  79. package/lib/directors/OrderPricingAdapter.js +24 -0
  80. package/lib/directors/OrderPricingAdapter.js.map +1 -0
  81. package/lib/directors/OrderPricingDirector.d.ts +18 -0
  82. package/lib/directors/OrderPricingDirector.d.ts.map +1 -0
  83. package/lib/directors/OrderPricingDirector.js +31 -0
  84. package/lib/directors/OrderPricingDirector.js.map +1 -0
  85. package/lib/directors/OrderPricingSheet.d.ts +37 -0
  86. package/lib/directors/OrderPricingSheet.d.ts.map +1 -0
  87. package/lib/directors/OrderPricingSheet.js +108 -0
  88. package/lib/directors/OrderPricingSheet.js.map +1 -0
  89. package/lib/directors/PaymentAdapter.d.ts +50 -0
  90. package/lib/directors/PaymentAdapter.d.ts.map +1 -0
  91. package/lib/directors/PaymentAdapter.js +55 -0
  92. package/lib/directors/PaymentAdapter.js.map +1 -0
  93. package/lib/directors/PaymentDirector.d.ts +21 -0
  94. package/lib/directors/PaymentDirector.d.ts.map +1 -0
  95. package/lib/directors/PaymentDirector.js +172 -0
  96. package/lib/directors/PaymentDirector.js.map +1 -0
  97. package/lib/directors/PaymentPricingAdapter.d.ts +48 -0
  98. package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -0
  99. package/lib/directors/PaymentPricingAdapter.js +25 -0
  100. package/lib/directors/PaymentPricingAdapter.js.map +1 -0
  101. package/lib/directors/PaymentPricingDirector.d.ts +18 -0
  102. package/lib/directors/PaymentPricingDirector.d.ts.map +1 -0
  103. package/lib/directors/PaymentPricingDirector.js +51 -0
  104. package/lib/directors/PaymentPricingDirector.js.map +1 -0
  105. package/lib/directors/PaymentPricingSheet.d.ts +9 -0
  106. package/lib/directors/PaymentPricingSheet.d.ts.map +1 -0
  107. package/lib/directors/PaymentPricingSheet.js +75 -0
  108. package/lib/directors/PaymentPricingSheet.js.map +1 -0
  109. package/lib/directors/ProductDiscountAdapter.d.ts +3 -0
  110. package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -0
  111. package/lib/directors/ProductDiscountAdapter.js +3 -0
  112. package/lib/directors/ProductDiscountAdapter.js.map +1 -0
  113. package/lib/directors/ProductDiscountConfiguration.d.ts +13 -0
  114. package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -0
  115. package/lib/directors/ProductDiscountConfiguration.js +2 -0
  116. package/lib/directors/ProductDiscountConfiguration.js.map +1 -0
  117. package/lib/directors/ProductDiscountDirector.d.ts +3 -0
  118. package/lib/directors/ProductDiscountDirector.d.ts.map +1 -0
  119. package/lib/directors/ProductDiscountDirector.js +3 -0
  120. package/lib/directors/ProductDiscountDirector.js.map +1 -0
  121. package/lib/directors/ProductPricingAdapter.d.ts +19 -0
  122. package/lib/directors/ProductPricingAdapter.d.ts.map +1 -0
  123. package/lib/directors/ProductPricingAdapter.js +24 -0
  124. package/lib/directors/ProductPricingAdapter.js.map +1 -0
  125. package/lib/directors/ProductPricingDirector.d.ts +21 -0
  126. package/lib/directors/ProductPricingDirector.d.ts.map +1 -0
  127. package/lib/directors/ProductPricingDirector.js +52 -0
  128. package/lib/directors/ProductPricingDirector.js.map +1 -0
  129. package/lib/directors/ProductPricingSheet.d.ts +35 -0
  130. package/lib/directors/ProductPricingSheet.d.ts.map +1 -0
  131. package/lib/directors/ProductPricingSheet.js +83 -0
  132. package/lib/directors/ProductPricingSheet.js.map +1 -0
  133. package/lib/directors/QuotationAdapter.d.ts +28 -0
  134. package/lib/directors/QuotationAdapter.d.ts.map +1 -0
  135. package/lib/directors/QuotationAdapter.js +46 -0
  136. package/lib/directors/QuotationAdapter.js.map +1 -0
  137. package/lib/directors/QuotationDirector.d.ts +7 -0
  138. package/lib/directors/QuotationDirector.d.ts.map +1 -0
  139. package/lib/directors/QuotationDirector.js +84 -0
  140. package/lib/directors/QuotationDirector.js.map +1 -0
  141. package/lib/directors/WarehousingAdapter.d.ts +40 -0
  142. package/lib/directors/WarehousingAdapter.d.ts.map +1 -0
  143. package/lib/directors/WarehousingAdapter.js +32 -0
  144. package/lib/directors/WarehousingAdapter.js.map +1 -0
  145. package/lib/directors/WarehousingDirector.d.ts +41 -0
  146. package/lib/directors/WarehousingDirector.d.ts.map +1 -0
  147. package/lib/directors/WarehousingDirector.js +169 -0
  148. package/lib/directors/WarehousingDirector.js.map +1 -0
  149. package/lib/directors/WorkerAdapter.d.ts +17 -0
  150. package/lib/directors/WorkerAdapter.d.ts.map +1 -0
  151. package/lib/directors/WorkerAdapter.js +11 -0
  152. package/lib/directors/WorkerAdapter.js.map +1 -0
  153. package/lib/directors/WorkerDirector.d.ts +26 -0
  154. package/lib/directors/WorkerDirector.d.ts.map +1 -0
  155. package/lib/directors/WorkerDirector.js +102 -0
  156. package/lib/directors/WorkerDirector.js.map +1 -0
  157. package/lib/directors/index.d.ts +39 -0
  158. package/lib/directors/index.d.ts.map +1 -0
  159. package/lib/directors/index.js +39 -0
  160. package/lib/directors/index.js.map +1 -0
  161. package/lib/modules.d.ts +59 -0
  162. package/lib/modules.d.ts.map +1 -0
  163. package/lib/modules.js +126 -0
  164. package/lib/modules.js.map +1 -0
  165. package/lib/services/activateEnrollment.d.ts +4 -0
  166. package/lib/services/activateEnrollment.d.ts.map +1 -0
  167. package/lib/services/activateEnrollment.js +25 -0
  168. package/lib/services/activateEnrollment.js.map +1 -0
  169. package/lib/services/calculateDiscountTotal.d.ts +7 -0
  170. package/lib/services/calculateDiscountTotal.d.ts.map +1 -0
  171. package/lib/services/calculateDiscountTotal.js +49 -0
  172. package/lib/services/calculateDiscountTotal.js.map +1 -0
  173. package/lib/services/checkoutOrder.d.ts +9 -0
  174. package/lib/services/checkoutOrder.d.ts.map +1 -0
  175. package/lib/services/checkoutOrder.js +28 -0
  176. package/lib/services/checkoutOrder.js.map +1 -0
  177. package/lib/services/confirmOrder.d.ts +9 -0
  178. package/lib/services/confirmOrder.d.ts.map +1 -0
  179. package/lib/services/confirmOrder.js +17 -0
  180. package/lib/services/confirmOrder.js.map +1 -0
  181. package/lib/services/createDownloadStream.d.ts +5 -0
  182. package/lib/services/createDownloadStream.d.ts.map +1 -0
  183. package/lib/services/createDownloadStream.js +8 -0
  184. package/lib/services/createDownloadStream.js.map +1 -0
  185. package/lib/services/createEnrollmentFromCheckout.d.ts +15 -0
  186. package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -0
  187. package/lib/services/createEnrollmentFromCheckout.js +40 -0
  188. package/lib/services/createEnrollmentFromCheckout.js.map +1 -0
  189. package/lib/services/createManualOrderDiscount.d.ts +7 -0
  190. package/lib/services/createManualOrderDiscount.d.ts.map +1 -0
  191. package/lib/services/createManualOrderDiscount.js +47 -0
  192. package/lib/services/createManualOrderDiscount.js.map +1 -0
  193. package/lib/services/createSignedURL.d.ts +8 -0
  194. package/lib/services/createSignedURL.d.ts.map +1 -0
  195. package/lib/services/createSignedURL.js +15 -0
  196. package/lib/services/createSignedURL.js.map +1 -0
  197. package/lib/services/deleteUser.d.ts +5 -0
  198. package/lib/services/deleteUser.d.ts.map +1 -0
  199. package/lib/services/deleteUser.js +26 -0
  200. package/lib/services/deleteUser.js.map +1 -0
  201. package/lib/services/discountedEntities.d.ts +5 -0
  202. package/lib/services/discountedEntities.d.ts.map +1 -0
  203. package/lib/services/discountedEntities.js +61 -0
  204. package/lib/services/discountedEntities.js.map +1 -0
  205. package/lib/services/ercMetadata.d.ts +7 -0
  206. package/lib/services/ercMetadata.d.ts.map +1 -0
  207. package/lib/services/ercMetadata.js +22 -0
  208. package/lib/services/ercMetadata.js.map +1 -0
  209. package/lib/services/findOrInitCart.d.ts +9 -0
  210. package/lib/services/findOrInitCart.d.ts.map +1 -0
  211. package/lib/services/findOrInitCart.js +15 -0
  212. package/lib/services/findOrInitCart.js.map +1 -0
  213. package/lib/services/fullfillQuotation.d.ts +4 -0
  214. package/lib/services/fullfillQuotation.d.ts.map +1 -0
  215. package/lib/services/fullfillQuotation.js +12 -0
  216. package/lib/services/fullfillQuotation.js.map +1 -0
  217. package/lib/services/index.d.ts +118 -0
  218. package/lib/services/index.d.ts.map +1 -0
  219. package/lib/services/index.js +132 -0
  220. package/lib/services/index.js.map +1 -0
  221. package/lib/services/initCartProviders.d.ts +4 -0
  222. package/lib/services/initCartProviders.d.ts.map +1 -0
  223. package/lib/services/initCartProviders.js +55 -0
  224. package/lib/services/initCartProviders.js.map +1 -0
  225. package/lib/services/initializeEnrollment.d.ts +7 -0
  226. package/lib/services/initializeEnrollment.d.ts.map +1 -0
  227. package/lib/services/initializeEnrollment.js +28 -0
  228. package/lib/services/initializeEnrollment.js.map +1 -0
  229. package/lib/services/invalidateFilterCache.d.ts +3 -0
  230. package/lib/services/invalidateFilterCache.d.ts.map +1 -0
  231. package/lib/services/invalidateFilterCache.js +12 -0
  232. package/lib/services/invalidateFilterCache.js.map +1 -0
  233. package/lib/services/linkFileService.d.ts +7 -0
  234. package/lib/services/linkFileService.d.ts.map +1 -0
  235. package/lib/services/linkFileService.js +18 -0
  236. package/lib/services/linkFileService.js.map +1 -0
  237. package/lib/services/loadFilterOptions.d.ts +14 -0
  238. package/lib/services/loadFilterOptions.d.ts.map +1 -0
  239. package/lib/services/loadFilterOptions.js +29 -0
  240. package/lib/services/loadFilterOptions.js.map +1 -0
  241. package/lib/services/loadFilters.d.ts +14 -0
  242. package/lib/services/loadFilters.d.ts.map +1 -0
  243. package/lib/services/loadFilters.js +36 -0
  244. package/lib/services/loadFilters.js.map +1 -0
  245. package/lib/services/migrateBookmarks.d.ts +8 -0
  246. package/lib/services/migrateBookmarks.d.ts.map +1 -0
  247. package/lib/services/migrateBookmarks.js +26 -0
  248. package/lib/services/migrateBookmarks.js.map +1 -0
  249. package/lib/services/migrateOrderCart.d.ts +8 -0
  250. package/lib/services/migrateOrderCart.d.ts.map +1 -0
  251. package/lib/services/migrateOrderCart.js +32 -0
  252. package/lib/services/migrateOrderCart.js.map +1 -0
  253. package/lib/services/migrateUserData.d.ts +2 -0
  254. package/lib/services/migrateUserData.d.ts.map +1 -0
  255. package/lib/services/migrateUserData.js +20 -0
  256. package/lib/services/migrateUserData.js.map +1 -0
  257. package/lib/services/nextUserCart.d.ts +9 -0
  258. package/lib/services/nextUserCart.d.ts.map +1 -0
  259. package/lib/services/nextUserCart.js +34 -0
  260. package/lib/services/nextUserCart.js.map +1 -0
  261. package/lib/services/processEnrollment.d.ts +4 -0
  262. package/lib/services/processEnrollment.d.ts.map +1 -0
  263. package/lib/services/processEnrollment.js +33 -0
  264. package/lib/services/processEnrollment.js.map +1 -0
  265. package/lib/services/processOrder.d.ts +9 -0
  266. package/lib/services/processOrder.d.ts.map +1 -0
  267. package/lib/services/processOrder.js +161 -0
  268. package/lib/services/processOrder.js.map +1 -0
  269. package/lib/services/processQuotation.d.ts +6 -0
  270. package/lib/services/processQuotation.d.ts.map +1 -0
  271. package/lib/services/processQuotation.js +60 -0
  272. package/lib/services/processQuotation.js.map +1 -0
  273. package/lib/services/proposeQuotation.d.ts +6 -0
  274. package/lib/services/proposeQuotation.d.ts.map +1 -0
  275. package/lib/services/proposeQuotation.js +12 -0
  276. package/lib/services/proposeQuotation.js.map +1 -0
  277. package/lib/services/registerPaymentCredentials.d.ts +5 -0
  278. package/lib/services/registerPaymentCredentials.d.ts.map +1 -0
  279. package/lib/services/registerPaymentCredentials.js +21 -0
  280. package/lib/services/registerPaymentCredentials.js.map +1 -0
  281. package/lib/services/rejectOrder.d.ts +9 -0
  282. package/lib/services/rejectOrder.d.ts.map +1 -0
  283. package/lib/services/rejectOrder.js +17 -0
  284. package/lib/services/rejectOrder.js.map +1 -0
  285. package/lib/services/rejectQuotation.d.ts +6 -0
  286. package/lib/services/rejectQuotation.d.ts.map +1 -0
  287. package/lib/services/rejectQuotation.js +12 -0
  288. package/lib/services/rejectQuotation.js.map +1 -0
  289. package/lib/services/removeFiles.d.ts +5 -0
  290. package/lib/services/removeFiles.d.ts.map +1 -0
  291. package/lib/services/removeFiles.js +19 -0
  292. package/lib/services/removeFiles.js.map +1 -0
  293. package/lib/services/removeProduct.d.ts +5 -0
  294. package/lib/services/removeProduct.d.ts.map +1 -0
  295. package/lib/services/removeProduct.js +26 -0
  296. package/lib/services/removeProduct.js.map +1 -0
  297. package/lib/services/searchAssortments.d.ts +19 -0
  298. package/lib/services/searchAssortments.d.ts.map +1 -0
  299. package/lib/services/searchAssortments.js +33 -0
  300. package/lib/services/searchAssortments.js.map +1 -0
  301. package/lib/services/searchProducts.d.ts +16 -0
  302. package/lib/services/searchProducts.d.ts.map +1 -0
  303. package/lib/services/searchProducts.js +41 -0
  304. package/lib/services/searchProducts.js.map +1 -0
  305. package/lib/services/simulateProductDispatching.d.ts +15 -0
  306. package/lib/services/simulateProductDispatching.d.ts.map +1 -0
  307. package/lib/services/simulateProductDispatching.js +30 -0
  308. package/lib/services/simulateProductDispatching.js.map +1 -0
  309. package/lib/services/simulateProductInventory.d.ts +15 -0
  310. package/lib/services/simulateProductInventory.d.ts.map +1 -0
  311. package/lib/services/simulateProductInventory.js +29 -0
  312. package/lib/services/simulateProductInventory.js.map +1 -0
  313. package/lib/services/simulateProductPricing.d.ts +12 -0
  314. package/lib/services/simulateProductPricing.d.ts.map +1 -0
  315. package/lib/services/simulateProductPricing.js +8 -0
  316. package/lib/services/simulateProductPricing.js.map +1 -0
  317. package/lib/services/supportedDeliveryProviders.d.ts +5 -0
  318. package/lib/services/supportedDeliveryProviders.d.ts.map +1 -0
  319. package/lib/services/supportedDeliveryProviders.js +14 -0
  320. package/lib/services/supportedDeliveryProviders.js.map +1 -0
  321. package/lib/services/supportedPaymentProviders.d.ts +5 -0
  322. package/lib/services/supportedPaymentProviders.d.ts.map +1 -0
  323. package/lib/services/supportedPaymentProviders.js +14 -0
  324. package/lib/services/supportedPaymentProviders.js.map +1 -0
  325. package/lib/services/supportedWarehousingProviders.d.ts +5 -0
  326. package/lib/services/supportedWarehousingProviders.d.ts.map +1 -0
  327. package/lib/services/supportedWarehousingProviders.js +10 -0
  328. package/lib/services/supportedWarehousingProviders.js.map +1 -0
  329. package/lib/services/terminateEnrollment.d.ts +3 -0
  330. package/lib/services/terminateEnrollment.d.ts.map +1 -0
  331. package/lib/services/terminateEnrollment.js +25 -0
  332. package/lib/services/terminateEnrollment.js.map +1 -0
  333. package/lib/services/updateCalculation.d.ts +3 -0
  334. package/lib/services/updateCalculation.d.ts.map +1 -0
  335. package/lib/services/updateCalculation.js +101 -0
  336. package/lib/services/updateCalculation.js.map +1 -0
  337. package/lib/services/updateScheduling.d.ts +8 -0
  338. package/lib/services/updateScheduling.d.ts.map +1 -0
  339. package/lib/services/updateScheduling.js +42 -0
  340. package/lib/services/updateScheduling.js.map +1 -0
  341. package/lib/services/updateUserAvatarAfterUpload.d.ts +6 -0
  342. package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -0
  343. package/lib/services/updateUserAvatarAfterUpload.js +25 -0
  344. package/lib/services/updateUserAvatarAfterUpload.js.map +1 -0
  345. package/lib/services/uploadFileFromStream.d.ts +8 -0
  346. package/lib/services/uploadFileFromStream.d.ts.map +1 -0
  347. package/lib/services/uploadFileFromStream.js +11 -0
  348. package/lib/services/uploadFileFromStream.js.map +1 -0
  349. package/lib/services/uploadFileFromURL.d.ts +13 -0
  350. package/lib/services/uploadFileFromURL.d.ts.map +1 -0
  351. package/lib/services/uploadFileFromURL.js +11 -0
  352. package/lib/services/uploadFileFromURL.js.map +1 -0
  353. package/lib/services/validateOrder.d.ts +4 -0
  354. package/lib/services/validateOrder.d.ts.map +1 -0
  355. package/lib/services/validateOrder.js +45 -0
  356. package/lib/services/validateOrder.js.map +1 -0
  357. package/lib/services/verifyQuotation.d.ts +6 -0
  358. package/lib/services/verifyQuotation.d.ts.map +1 -0
  359. package/lib/services/verifyQuotation.js +12 -0
  360. package/lib/services/verifyQuotation.js.map +1 -0
  361. package/package.json +30 -29
  362. package/src/core-index.ts +14 -241
  363. package/src/directors/BaseDiscountAdapter.test.ts +49 -0
  364. package/src/directors/BaseDiscountAdapter.ts +90 -0
  365. package/src/directors/BaseDiscountDirector.ts +73 -0
  366. package/src/directors/BasePricingAdapter.ts +80 -0
  367. package/src/directors/BasePricingDirector.ts +137 -0
  368. package/src/directors/BasePricingSheet.test.ts +43 -0
  369. package/src/directors/BasePricingSheet.ts +140 -0
  370. package/src/directors/DeliveryAdapter.ts +110 -0
  371. package/src/directors/DeliveryDirector.ts +135 -0
  372. package/src/directors/DeliveryPricingAdapter.ts +87 -0
  373. package/src/directors/DeliveryPricingDirector.ts +92 -0
  374. package/src/directors/DeliveryPricingSheet.ts +86 -0
  375. package/src/directors/EnrollmentAdapter.ts +113 -0
  376. package/src/directors/EnrollmentDirector.ts +70 -0
  377. package/src/directors/FilterAdapter.ts +103 -0
  378. package/src/directors/FilterDirector.ts +313 -0
  379. package/src/directors/MessagingDirector.test.ts +5 -0
  380. package/src/directors/MessagingDirector.ts +59 -0
  381. package/src/directors/OrderDiscountAdapter.ts +10 -0
  382. package/src/directors/OrderDiscountConfiguration.ts +5 -0
  383. package/src/directors/OrderDiscountDirector.ts +5 -0
  384. package/src/directors/OrderPricingAdapter.ts +63 -0
  385. package/src/directors/OrderPricingDirector.ts +74 -0
  386. package/src/directors/OrderPricingSheet.ts +147 -0
  387. package/src/directors/PaymentAdapter.ts +118 -0
  388. package/src/directors/PaymentDirector.ts +275 -0
  389. package/src/directors/PaymentPricingAdapter.ts +86 -0
  390. package/src/directors/PaymentPricingDirector.ts +94 -0
  391. package/src/directors/PaymentPricingSheet.ts +91 -0
  392. package/src/directors/ProductDiscountAdapter.ts +10 -0
  393. package/src/directors/ProductDiscountConfiguration.ts +18 -0
  394. package/src/directors/ProductDiscountDirector.ts +4 -0
  395. package/src/directors/ProductPricingAdapter.ts +58 -0
  396. package/src/directors/ProductPricingDirector.ts +100 -0
  397. package/src/directors/ProductPricingSheet.test.ts +129 -0
  398. package/src/directors/ProductPricingSheet.ts +124 -0
  399. package/src/directors/QuotationAdapter.ts +86 -0
  400. package/src/directors/QuotationDirector.ts +105 -0
  401. package/src/directors/WarehousingAdapter.ts +83 -0
  402. package/src/directors/WarehousingDirector.ts +236 -0
  403. package/src/directors/WorkerAdapter.ts +30 -0
  404. package/src/directors/WorkerDirector.ts +154 -0
  405. package/src/directors/index.ts +49 -0
  406. package/src/directors/periodForReferenceDate.test.ts +23 -0
  407. package/src/modules.ts +208 -0
  408. package/src/services/activateEnrollment.ts +30 -0
  409. package/src/services/calculateDiscountTotal.ts +71 -0
  410. package/src/services/checkoutOrder.ts +43 -0
  411. package/src/services/confirmOrder.ts +26 -0
  412. package/src/services/createDownloadStream.ts +16 -0
  413. package/src/services/createEnrollmentFromCheckout.ts +66 -0
  414. package/src/services/createManualOrderDiscount.ts +56 -0
  415. package/src/services/createSignedURL.ts +20 -0
  416. package/src/services/deleteUser.ts +33 -0
  417. package/src/services/discountedEntities.ts +81 -0
  418. package/src/services/ercMetadata.ts +33 -0
  419. package/src/services/findOrInitCart.ts +29 -0
  420. package/src/services/fullfillQuotation.ts +14 -0
  421. package/src/services/index.ts +168 -0
  422. package/src/services/initCartProviders.ts +86 -0
  423. package/src/services/initializeEnrollment.ts +38 -0
  424. package/src/services/invalidateFilterCache.ts +16 -0
  425. package/src/services/linkFileService.ts +22 -0
  426. package/src/services/loadFilterOptions.ts +49 -0
  427. package/src/services/loadFilters.ts +52 -0
  428. package/src/services/migrateBookmarks.ts +39 -0
  429. package/src/services/migrateOrderCart.ts +52 -0
  430. package/src/services/migrateUserData.ts +22 -0
  431. package/src/services/nextUserCart.ts +52 -0
  432. package/src/services/processEnrollment.ts +37 -0
  433. package/src/services/processOrder.ts +241 -0
  434. package/src/services/processQuotation.ts +75 -0
  435. package/src/services/proposeQuotation.ts +18 -0
  436. package/src/services/registerPaymentCredentials.ts +30 -0
  437. package/src/services/rejectOrder.ts +26 -0
  438. package/src/services/rejectQuotation.ts +18 -0
  439. package/src/services/removeFiles.ts +25 -0
  440. package/src/services/removeProduct.ts +34 -0
  441. package/src/services/searchAssortments.ts +58 -0
  442. package/src/services/searchProducts.ts +73 -0
  443. package/src/services/simulateProductDispatching.ts +59 -0
  444. package/src/services/simulateProductInventory.ts +56 -0
  445. package/src/services/simulateProductPricing.ts +20 -0
  446. package/src/services/supportedDeliveryProviders.ts +24 -0
  447. package/src/services/supportedPaymentProviders.ts +25 -0
  448. package/src/services/supportedWarehousingProviders.ts +18 -0
  449. package/src/services/terminateEnrollment.ts +29 -0
  450. package/src/services/updateCalculation.ts +143 -0
  451. package/src/services/updateScheduling.ts +64 -0
  452. package/src/services/updateUserAvatarAfterUpload.ts +30 -0
  453. package/src/services/uploadFileFromStream.ts +15 -0
  454. package/src/services/uploadFileFromURL.ts +29 -0
  455. package/src/services/validateOrder.ts +53 -0
  456. package/src/services/verifyQuotation.ts +18 -0
  457. package/tsconfig.json +5 -7
  458. package/lib/types.d.ts +0 -4
  459. package/lib/types.d.ts.map +0 -1
  460. package/lib/types.js +0 -5
  461. package/lib/types.js.map +0 -1
  462. package/src/types.ts +0 -7
@@ -1,36 +1,10 @@
1
- import { BulkImporter } from './types.js';
2
- import { AssortmentsModule, AssortmentsSettingsOptions } from '@unchainedshop/core-assortments';
3
- import { BookmarkServices, BookmarksModule } from '@unchainedshop/core-bookmarks';
4
- import { CountriesModule } from '@unchainedshop/core-countries';
5
- import { CurrenciesModule } from '@unchainedshop/core-currencies';
6
- import { DeliveryModule, DeliverySettingsOptions } from '@unchainedshop/core-delivery';
7
- import { EnrollmentsModule, EnrollmentsSettingsOptions } from '@unchainedshop/core-enrollments';
8
- import { EventsModule } from '@unchainedshop/core-events';
9
- import { FileServices, FilesModule, FilesSettingsOptions } from '@unchainedshop/core-files';
10
- import { FiltersModule, FiltersSettingsOptions } from '@unchainedshop/core-filters';
11
- import { LanguagesModule } from '@unchainedshop/core-languages';
12
- import { MessagingModule } from '@unchainedshop/core-messaging';
13
- import { OrderServices, OrdersModule, OrdersSettingsOptions } from '@unchainedshop/core-orders';
14
- import { PaymentModule, PaymentSettingsOptions } from '@unchainedshop/core-payment';
15
- import { ProductServices, ProductsModule, ProductsSettingsOptions } from '@unchainedshop/core-products';
16
- import { QuotationsModule, QuotationsSettingsOptions } from '@unchainedshop/core-quotations';
17
- import { UserServices, UserSettingsOptions, UsersModule } from '@unchainedshop/core-users';
18
- import { WarehousingModule } from '@unchainedshop/core-warehousing';
19
- import { WorkerModule, WorkerSettingsOptions } from '@unchainedshop/core-worker';
20
1
  import { mongodb, MigrationRepository, ModuleInput } from '@unchainedshop/mongodb';
21
- export * from './types.js';
22
- export interface ModuleOptions {
23
- assortments?: AssortmentsSettingsOptions;
24
- products?: ProductsSettingsOptions;
25
- delivery?: DeliverySettingsOptions;
26
- filters?: FiltersSettingsOptions;
27
- enrollments?: EnrollmentsSettingsOptions;
28
- orders?: OrdersSettingsOptions;
29
- quotations?: QuotationsSettingsOptions;
30
- files?: FilesSettingsOptions;
31
- payment?: PaymentSettingsOptions;
32
- worker?: WorkerSettingsOptions;
33
- users?: UserSettingsOptions;
2
+ import { Services } from './services/index.js';
3
+ import { Modules, ModuleOptions } from './modules.js';
4
+ export * from './services/index.js';
5
+ export * from './directors/index.js';
6
+ export interface BulkImporter {
7
+ createBulkImporter: (options: any) => any;
34
8
  }
35
9
  export interface UnchainedCoreOptions {
36
10
  db: mongodb.Db;
@@ -39,41 +13,14 @@ export interface UnchainedCoreOptions {
39
13
  modules?: Record<string, {
40
14
  configure: (params: ModuleInput<any>) => any;
41
15
  }>;
42
- services?: Record<string, any>;
16
+ services?: Record<string, (this: Modules, ...args: any[]) => any>;
43
17
  options?: ModuleOptions;
44
18
  }
45
- export interface Modules {
46
- assortments: AssortmentsModule;
47
- bookmarks: BookmarksModule;
48
- countries: CountriesModule;
49
- currencies: CurrenciesModule;
50
- delivery: DeliveryModule;
51
- enrollments: EnrollmentsModule;
52
- events: EventsModule;
53
- files: FilesModule;
54
- filters: FiltersModule;
55
- languages: LanguagesModule;
56
- messaging: MessagingModule;
57
- orders: OrdersModule;
58
- payment: PaymentModule;
59
- products: ProductsModule;
60
- quotations: QuotationsModule;
61
- users: UsersModule;
62
- warehousing: WarehousingModule;
63
- worker: WorkerModule;
64
- }
65
- export interface Services {
66
- bookmarks: BookmarkServices;
67
- files: FileServices;
68
- orders: OrderServices;
69
- products: ProductServices;
70
- users: UserServices;
71
- }
72
19
  export interface UnchainedCore {
73
20
  modules: Modules;
74
21
  services: Services;
75
22
  bulkImporter: BulkImporter;
76
23
  options: ModuleOptions;
77
24
  }
78
- export declare const initCore: ({ db, migrationRepository, bulkImporter, modules, services, options, }: UnchainedCoreOptions) => Promise<UnchainedCore>;
25
+ export declare const initCore: ({ db, migrationRepository, bulkImporter, modules: customModules, services: customServices, options, }: UnchainedCoreOptions) => Promise<UnchainedCore>;
79
26
  //# sourceMappingURL=core-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-index.d.ts","sourceRoot":"","sources":["../src/core-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAE3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gBAAgB,EAEhB,eAAe,EAEhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAA4B,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAA6B,gBAAgB,EAAE,M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,GAAG,IAAI,OAAA,KAAK,GAAG,CAAC,CAAC;IAC3D,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,eAAO,MAAM,QAAQ,0GAOlB,oBAAoB,KAAG,OAAO,CAAC,aAAa,CAY9C,CAAC"}
package/lib/core-index.js CHANGED
@@ -1,145 +1,14 @@
1
- import { configureAssortmentsModule, } from '@unchainedshop/core-assortments';
2
- import { bookmarkServices, configureBookmarksModule, } from '@unchainedshop/core-bookmarks';
3
- import { configureCountriesModule } from '@unchainedshop/core-countries';
4
- import { configureCurrenciesModule } from '@unchainedshop/core-currencies';
5
- import { configureDeliveryModule, } from '@unchainedshop/core-delivery';
6
- import { configureEnrollmentsModule, } from '@unchainedshop/core-enrollments';
7
- import { configureEventsModule } from '@unchainedshop/core-events';
8
- import { configureFilesModule, fileServices, } from '@unchainedshop/core-files';
9
- import { configureFiltersModule, } from '@unchainedshop/core-filters';
10
- import { configureLanguagesModule } from '@unchainedshop/core-languages';
11
- import { configureMessagingModule } from '@unchainedshop/core-messaging';
12
- import { configureOrdersModule, orderServices, } from '@unchainedshop/core-orders';
13
- import { configurePaymentModule, } from '@unchainedshop/core-payment';
14
- import { configureProductsModule, productServices, } from '@unchainedshop/core-products';
15
- import { configureQuotationsModule, } from '@unchainedshop/core-quotations';
16
- import { configureUsersModule, userServices, } from '@unchainedshop/core-users';
17
- import { configureWarehousingModule } from '@unchainedshop/core-warehousing';
18
- import { configureWorkerModule } from '@unchainedshop/core-worker';
19
- export * from './types.js';
20
- export const initCore = async ({ db, migrationRepository, bulkImporter, modules = {}, services = {}, options = {}, }) => {
21
- const assortments = await configureAssortmentsModule({
22
- db,
23
- options: options.assortments,
24
- migrationRepository,
25
- });
26
- const bookmarks = await configureBookmarksModule({
27
- db,
28
- migrationRepository,
29
- });
30
- const countries = await configureCountriesModule({
31
- db,
32
- migrationRepository,
33
- });
34
- const currencies = await configureCurrenciesModule({
35
- db,
36
- migrationRepository,
37
- });
38
- const delivery = await configureDeliveryModule({
39
- db,
40
- options: options.delivery,
41
- migrationRepository,
42
- });
43
- const enrollments = await configureEnrollmentsModule({
44
- db,
45
- options: options.enrollments,
46
- migrationRepository,
47
- });
48
- const events = await configureEventsModule({
49
- db,
50
- migrationRepository,
51
- });
52
- const files = await configureFilesModule({
53
- db,
54
- options: options.files,
55
- migrationRepository,
56
- });
57
- const filters = await configureFiltersModule({
58
- db,
59
- options: options.filters,
60
- migrationRepository,
61
- });
62
- const languages = await configureLanguagesModule({
63
- db,
64
- migrationRepository,
65
- });
66
- const messaging = await configureMessagingModule({
67
- db,
68
- migrationRepository,
69
- });
70
- const orders = await configureOrdersModule({
71
- db,
72
- options: options.orders,
73
- migrationRepository,
74
- });
75
- const payment = await configurePaymentModule({
76
- db,
77
- options: options.payment,
78
- migrationRepository,
79
- });
80
- const products = await configureProductsModule({
81
- db,
82
- migrationRepository,
83
- });
84
- const quotations = await configureQuotationsModule({
85
- db,
86
- options: options.quotations,
87
- migrationRepository,
88
- });
89
- const users = await configureUsersModule({
90
- db,
91
- migrationRepository,
92
- });
93
- const warehousing = await configureWarehousingModule({
94
- db,
95
- migrationRepository,
96
- });
97
- const worker = await configureWorkerModule({
98
- db,
99
- options: options.worker,
100
- migrationRepository,
101
- });
1
+ import initServices from './services/index.js';
2
+ import initModules from './modules.js';
3
+ export * from './services/index.js';
4
+ export * from './directors/index.js';
5
+ export const initCore = async ({ db, migrationRepository, bulkImporter, modules: customModules = {}, services: customServices = {}, options = {}, }) => {
102
6
  // Configure custom modules
103
- const customModules = await Object.entries(modules).reduce(async (modulesPromise, [key, customModule]) => {
104
- return {
105
- ...(await modulesPromise),
106
- [key]: await customModule.configure({
107
- db,
108
- options: options?.[key],
109
- migrationRepository,
110
- }),
111
- };
112
- }, Promise.resolve({}));
7
+ const modules = await initModules({ db, migrationRepository, options }, customModules);
8
+ const services = initServices(modules, customServices);
113
9
  return {
114
- modules: {
115
- assortments,
116
- bookmarks,
117
- countries,
118
- currencies,
119
- delivery,
120
- enrollments,
121
- events,
122
- files,
123
- filters,
124
- languages,
125
- messaging,
126
- orders,
127
- payment,
128
- products,
129
- quotations,
130
- users,
131
- warehousing,
132
- worker,
133
- ...customModules,
134
- },
135
- services: {
136
- bookmarks: bookmarkServices,
137
- files: fileServices,
138
- orders: orderServices,
139
- products: productServices,
140
- users: userServices,
141
- ...services,
142
- },
10
+ modules,
11
+ services,
143
12
  bulkImporter,
144
13
  options,
145
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"core-index.js","sourceRoot":"","sources":["../src/core-index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,gBAAgB,EAEhB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAmB,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAoB,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EACL,uBAAuB,GAGxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,0BAA0B,GAG3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAgB,MAAM,4BAA4B,CAAC;AACjF,OAAO,EACL,oBAAoB,EAEpB,YAAY,GAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,sBAAsB,GAGvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAmB,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAmB,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EACL,qBAAqB,EAErB,aAAa,GAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,GAGvB,MAAM,6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,GAAG,EAAE,GACS,EAA0B,EAAE;IACjD,2BAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,EAAE,EAAE,EAAE,mBAAmB,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;IACvF,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAEvD,OAAO;QACL,OAAO;QACP,QAAQ;QACR,YAAY;QACZ,OAAO;KACR,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { IBaseAdapter } from '@unchainedshop/utils';
2
+ import { IPricingSheet } from './BasePricingSheet.js';
3
+ import { PricingCalculation } from '@unchainedshop/utils';
4
+ import { Order, OrderDiscount } from '@unchainedshop/core-orders';
5
+ import { Modules } from '../modules.js';
6
+ export interface DiscountContext {
7
+ code?: string;
8
+ orderDiscount?: OrderDiscount;
9
+ order?: Order;
10
+ }
11
+ export type IDiscountAdapter<DiscountConfiguration> = IBaseAdapter & {
12
+ orderIndex: number;
13
+ isManualAdditionAllowed: (code: string) => Promise<boolean>;
14
+ isManualRemovalAllowed: () => Promise<boolean>;
15
+ actions: (params: {
16
+ context: DiscountContext & {
17
+ modules: Modules;
18
+ };
19
+ }) => Promise<DiscountAdapterActions<DiscountConfiguration>>;
20
+ };
21
+ export interface DiscountAdapterActions<DiscountConfiguration> {
22
+ isValidForSystemTriggering: () => Promise<boolean>;
23
+ isValidForCodeTriggering: (params: {
24
+ code: string;
25
+ }) => Promise<boolean>;
26
+ discountForPricingAdapterKey: (params: {
27
+ pricingAdapterKey: string;
28
+ calculationSheet: IPricingSheet<PricingCalculation>;
29
+ }) => DiscountConfiguration;
30
+ reserve: (params: {
31
+ code: string;
32
+ }) => Promise<any>;
33
+ release: () => Promise<void>;
34
+ }
35
+ export declare const BaseDiscountAdapter: Omit<IDiscountAdapter<unknown>, 'key' | 'label' | 'version'>;
36
+ //# sourceMappingURL=BaseDiscountAdapter.d.ts.map
@@ -0,0 +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,kBAAkB,CAAC,CAAC;KACrD,KAAK,qBAAqB,CAAC;IAE5B,OAAO,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACpD,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,SAAS,CAqD5F,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { log, LogLevel } from '@unchainedshop/logger';
2
+ export const BaseDiscountAdapter = {
3
+ orderIndex: 0,
4
+ isManualAdditionAllowed: async () => {
5
+ return false;
6
+ },
7
+ // return true if a discount is allowed to get removed manually by a user
8
+ isManualRemovalAllowed: async () => {
9
+ return false;
10
+ },
11
+ actions: async () => ({
12
+ // return true if a discount is valid to be part of the order
13
+ // without input of a user. that could be a time based global discount
14
+ // like a 10% discount day
15
+ // if you return false, this discount will
16
+ // get removed from the order before any price calculation
17
+ // takes place.
18
+ // eslint-disable-next-line
19
+ isValidForSystemTriggering: async () => {
20
+ return false;
21
+ },
22
+ // return an arbitrary JSON serializable object with reservation data
23
+ // this method is called when a discount is added through a manual code and let's
24
+ // you manually deduct expendable discounts (coupon balances for ex.) before checkout
25
+ reserve: async () => {
26
+ return {};
27
+ },
28
+ // return void, allows you to free up any reservations in backend systems
29
+ release: async () => {
30
+ return null;
31
+ },
32
+ // return true if a discount is valid to be part of the order.
33
+ // if you return false, this discount will
34
+ // get removed from the order before any price calculation
35
+ // takes place.
36
+ isValidForCodeTriggering: async () => {
37
+ return false;
38
+ },
39
+ // returns the appropriate discount context for a calculation adapter
40
+ discountForPricingAdapterKey() {
41
+ return null;
42
+ },
43
+ }),
44
+ log(message, { level = LogLevel.Debug, ...options } = {}) {
45
+ return log(message, { level, ...options });
46
+ },
47
+ };
48
+ //# sourceMappingURL=BaseDiscountAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseDiscountAdapter.js","sourceRoot":"","sources":["../../src/directors/BaseDiscountAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAoCtD,MAAM,CAAC,MAAM,mBAAmB,GAAiE;IAC/F,UAAU,EAAE,CAAC;IAEb,uBAAuB,EAAE,KAAK,IAAI,EAAE;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yEAAyE;IACzE,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QACpB,6DAA6D;QAC7D,sEAAsE;QACtE,0BAA0B;QAC1B,0CAA0C;QAC1C,0DAA0D;QAC1D,eAAe;QACf,2BAA2B;QAC3B,0BAA0B,EAAE,KAAK,IAAI,EAAE;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,qEAAqE;QACrE,iFAAiF;QACjF,qFAAqF;QACrF,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,yEAAyE;QACzE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,8DAA8D;QAC9D,0CAA0C;QAC1C,0DAA0D;QAC1D,eAAe;QACf,wBAAwB,EAAE,KAAK,IAAI,EAAE;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,qEAAqE;QACrE,4BAA4B;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;IAEF,GAAG,CAAC,OAAe,EAAE,EAAE,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE;QAC9D,OAAO,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { IBaseDirector } from '@unchainedshop/utils';
2
+ import { DiscountContext, IDiscountAdapter } from './BaseDiscountAdapter.js';
3
+ import { Modules } from '../modules.js';
4
+ export type IDiscountDirector<DiscountConfiguration> = IBaseDirector<IDiscountAdapter<DiscountConfiguration>> & {
5
+ actions: (discountContext: DiscountContext, unchainedAPI: {
6
+ modules: Modules;
7
+ }) => Promise<{
8
+ resolveDiscountAdapterFromStaticCode: (params: {
9
+ code: string;
10
+ }) => Promise<IDiscountAdapter<DiscountConfiguration>>;
11
+ findSystemDiscounts: () => Promise<Array<string>>;
12
+ }>;
13
+ };
14
+ export declare const BaseDiscountDirector: <DiscountConfigurationType>(directorName: string) => IDiscountDirector<DiscountConfigurationType>;
15
+ //# sourceMappingURL=BaseDiscountDirector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseDiscountDirector.d.ts","sourceRoot":"","sources":["../../src/directors/BaseDiscountDirector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,iBAAiB,CAAC,qBAAqB,IAAI,aAAa,CAClE,gBAAgB,CAAC,qBAAqB,CAAC,CACxC,GAAG;IACF,OAAO,EAAE,CACP,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAC/B,OAAO,CAAC;QACX,oCAAoC,EAAE,CAAC,MAAM,EAAE;YAC7C,IAAI,EAAE,MAAM,CAAC;SACd,KAAK,OAAO,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAAC;QACvD,mBAAmB,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KACnD,CAAC,CAAC;CACJ,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,yBAAyB,gBAC9C,MAAM,KACnB,iBAAiB,CAAC,yBAAyB,CAoD7C,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { BaseDirector } from '@unchainedshop/utils';
2
+ export const BaseDiscountDirector = (directorName) => {
3
+ const baseDirector = BaseDirector(directorName, {
4
+ adapterSortKey: 'orderIndex',
5
+ });
6
+ return {
7
+ ...baseDirector,
8
+ actions: async (discountContext, unchainedAPI) => {
9
+ const context = { ...discountContext, ...unchainedAPI };
10
+ return {
11
+ resolveDiscountAdapterFromStaticCode: async (options) => {
12
+ if (!context.order)
13
+ return null;
14
+ const discounts = await Promise.all(baseDirector
15
+ .getAdapters()
16
+ .filter((Adapter) => Adapter.isManualAdditionAllowed(options?.code))
17
+ .map(async (Adapter) => {
18
+ const adapter = await Adapter.actions({ context });
19
+ return {
20
+ Adapter,
21
+ isValid: await adapter.isValidForCodeTriggering(options),
22
+ };
23
+ }));
24
+ return discounts.find(({ isValid }) => isValid === true)?.Adapter;
25
+ },
26
+ async findSystemDiscounts() {
27
+ if (!context.order)
28
+ return [];
29
+ const discounts = await Promise.all(baseDirector.getAdapters().map(async (Adapter) => {
30
+ const adapter = await Adapter.actions({ context });
31
+ return {
32
+ key: Adapter.key,
33
+ isValid: await adapter.isValidForSystemTriggering(),
34
+ };
35
+ }));
36
+ const validDiscounts = discounts
37
+ .filter(({ isValid }) => isValid === true)
38
+ .map(({ key }) => key);
39
+ return validDiscounts;
40
+ },
41
+ };
42
+ },
43
+ };
44
+ };
45
+ //# sourceMappingURL=BaseDiscountDirector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseDiscountDirector.js","sourceRoot":"","sources":["../../src/directors/BaseDiscountDirector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,MAAM,sBAAsB,CAAC;AAkBnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,YAAoB,EAC0B,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AC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;wBACnD,OAAO;4BACL,GAAG,EAAE,OAAO,CAAC,GAAG;4BAChB,OAAO,EAAE,MAAM,OAAO,CAAC,0BAA0B,EAAE;yBACpD,CAAC;oBACJ,CAAC,CAAC,CACH,CAAC;oBAEF,MAAM,cAAc,GAAG,SAAS;yBAC7B,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,KAAK,IAAI,CAAC;yBACzC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;oBAEzB,OAAO,cAAc,CAAC;gBACxB,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { IPricingSheet } from './BasePricingSheet.js';
2
+ import { IBaseAdapter, PricingCalculation } from '@unchainedshop/utils';
3
+ import { Discount } from './BasePricingDirector.js';
4
+ import { Order, OrderDiscount } from '@unchainedshop/core-orders';
5
+ interface IDiscountableItem {
6
+ _id?: string;
7
+ orderId?: string;
8
+ }
9
+ export interface BasePricingAdapterContext {
10
+ order?: Order;
11
+ discounts: Array<OrderDiscount>;
12
+ }
13
+ export type BasePricingContext = {
14
+ order?: Order;
15
+ discounts?: Array<OrderDiscount>;
16
+ } | {
17
+ item: IDiscountableItem;
18
+ };
19
+ export interface IPricingAdapterActions<Calculation extends PricingCalculation, Sheet extends IPricingSheet<Calculation>> {
20
+ calculate: () => Promise<Array<Calculation>>;
21
+ resultSheet: () => Sheet;
22
+ }
23
+ export type IPricingAdapter<PricingAdapterContext extends BasePricingAdapterContext, Calculation extends PricingCalculation, Sheet extends IPricingSheet<Calculation>, DiscountConfiguration = unknown> = IBaseAdapter & {
24
+ orderIndex: number;
25
+ isActivatedFor: (context: PricingAdapterContext) => boolean;
26
+ actions: (params: {
27
+ context: PricingAdapterContext;
28
+ calculationSheet: Sheet;
29
+ discounts: Array<Discount<DiscountConfiguration>>;
30
+ }) => IPricingAdapterActions<Calculation, Sheet>;
31
+ };
32
+ export declare const BasePricingAdapter: <PricingAdapterContext extends BasePricingAdapterContext, Calculation extends PricingCalculation>() => IPricingAdapter<PricingAdapterContext, Calculation, IPricingSheet<Calculation>>;
33
+ export {};
34
+ //# sourceMappingURL=BasePricingAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasePricingAdapter.d.ts","sourceRoot":"","sources":["../../src/directors/BasePricingAdapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIlE,UAAU,iBAAiB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,kBAAkB,GAC1B;IACE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAClC,GACD;IACE,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAEN,MAAM,WAAW,sBAAsB,CACrC,WAAW,SAAS,kBAAkB,EACtC,KAAK,SAAS,aAAa,CAAC,WAAW,CAAC;IAExC,SAAS,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7C,WAAW,EAAE,MAAM,KAAK,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,CACzB,qBAAqB,SAAS,yBAAyB,EACvD,WAAW,SAAS,kBAAkB,EACtC,KAAK,SAAS,aAAa,CAAC,WAAW,CAAC,EACxC,qBAAqB,GAAG,OAAO,IAC7B,YAAY,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IAEnB,cAAc,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC;IAE5D,OAAO,EAAE,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,qBAAqB,CAAC;QAC/B,gBAAgB,EAAE,KAAK,CAAC;QACxB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC;KACnD,KAAK,sBAAsB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;CAClD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,qBAAqB,SAAS,yBAAyB,EACvD,WAAW,SAAS,kBAAkB,OACnC,eAAe,CAAC,qBAAqB,EAAE,WAAW,EAAE,aAAa,CAAC,WAAW,CAAC,CAwBjF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { createLogger } from '@unchainedshop/logger';
2
+ const logger = createLogger('unchained:core');
3
+ export const BasePricingAdapter = () => ({
4
+ key: '',
5
+ label: '',
6
+ version: '',
7
+ orderIndex: 0,
8
+ isActivatedFor: () => {
9
+ return false;
10
+ },
11
+ actions: () => {
12
+ return {
13
+ calculate: async () => {
14
+ throw new Error('Method not implemented.');
15
+ },
16
+ resultSheet: () => {
17
+ throw new Error('Method not implemented.');
18
+ }, // abstract
19
+ };
20
+ },
21
+ log(message, options) {
22
+ return logger.debug(message, options);
23
+ },
24
+ });
25
+ //# sourceMappingURL=BasePricingAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasePricingAdapter.js","sourceRoot":"","sources":["../../src/directors/BasePricingAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAMrD,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AA8C9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAGmD,EAAE,CAAC,CAAC;IACvF,GAAG,EAAE,EAAE;IACP,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,CAAC;IAEb,cAAc,EAAE,GAAG,EAAE;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,EAAE,GAAG,EAAE;QACZ,OAAO;YACL,SAAS,EAAE,KAAK,IAAI,EAAE;gBACpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC;YACD,WAAW,EAAE,GAAG,EAAE;gBAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC,EAAE,WAAW;SACf,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,OAAe,EAAE,OAAO;QAC1B,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { IBaseDirector, PricingCalculation } from '@unchainedshop/utils';
2
+ import { BasePricingAdapterContext, BasePricingContext, IPricingAdapter } from './BasePricingAdapter.js';
3
+ import { IPricingSheet } from './BasePricingSheet.js';
4
+ import { Modules } from '../modules.js';
5
+ export interface Discount<DiscountConfiguration> {
6
+ discountId: string;
7
+ configuration: DiscountConfiguration;
8
+ }
9
+ export type IPricingDirector<PricingContext extends BasePricingContext, Calculation extends PricingCalculation, PricingAdapterContext extends BasePricingAdapterContext, PricingAdapterSheet extends IPricingSheet<Calculation>, Adapter extends IPricingAdapter<PricingAdapterContext & Context, Calculation, PricingAdapterSheet>, Context = {
10
+ modules: Modules;
11
+ }> = IBaseDirector<Adapter> & {
12
+ buildPricingContext: (pricingContext: PricingContext, unchainedAPI: Context) => Promise<PricingAdapterContext>;
13
+ rebuildCalculation: (pricingContext: PricingContext, unchainedAPI: Context) => Promise<Array<Calculation>>;
14
+ calculationSheet: (pricingContext: PricingContext, calculation: Array<Calculation>) => PricingAdapterSheet;
15
+ };
16
+ export declare const BasePricingDirector: <DirectorContext extends BasePricingContext, AdapterContext extends BasePricingAdapterContext, Calculation extends PricingCalculation, PricingAdapter extends IPricingAdapter<AdapterContext, Calculation, IPricingSheet<Calculation>>>(directorName: string) => IPricingDirector<DirectorContext, Calculation, AdapterContext, IPricingSheet<Calculation>, PricingAdapter, any>;
17
+ //# sourceMappingURL=BasePricingDirector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasePricingDirector.d.ts","sourceRoot":"","sources":["../../src/directors/BasePricingDirector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAIxC,MAAM,WAAW,QAAQ,CAAC,qBAAqB;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,qBAAqB,CAAC;CACtC;AAED,MAAM,MAAM,gBAAgB,CAC1B,cAAc,SAAS,kBAAkB,EACzC,WAAW,SAAS,kBAAkB,EACtC,qBAAqB,SAAS,yBAAyB,EACvD,mBAAmB,SAAS,aAAa,CAAC,WAAW,CAAC,EACtD,OAAO,SAAS,eAAe,CAAC,qBAAqB,GAAG,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAClG,OAAO,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,IAC5B,aAAa,CAAC,OAAO,CAAC,GAAG;IAC3B,mBAAmB,EAAE,CACnB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,OAAO,KAClB,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEpC,kBAAkB,EAAE,CAClB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,OAAO,KAClB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IAEjC,gBAAgB,EAAE,CAChB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,KAC5B,mBAAmB,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,eAAe,SAAS,kBAAkB,EAC1C,cAAc,SAAS,yBAAyB,EAChD,WAAW,SAAS,kBAAkB,EACtC,cAAc,SAAS,eAAe,CAAC,cAAc,EAAE,WAAW,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,gBAEjF,MAAM,KACnB,gBAAgB,CACjB,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,CAAC,WAAW,CAAC,EAC1B,cAAc,EACd,GAAG,CAqFJ,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { BaseDirector } from '@unchainedshop/utils';
2
+ import { OrderDiscountDirector } from './OrderDiscountDirector.js';
3
+ import { createLogger } from '@unchainedshop/logger';
4
+ const logger = createLogger('unchained:core');
5
+ export const BasePricingDirector = (directorName) => {
6
+ const baseDirector = BaseDirector(directorName, {
7
+ adapterSortKey: 'orderIndex',
8
+ });
9
+ const director = {
10
+ ...baseDirector,
11
+ buildPricingContext: async () => {
12
+ throw new Error('Method not implemented');
13
+ },
14
+ calculationSheet() {
15
+ throw new Error('Method not implemented');
16
+ },
17
+ async rebuildCalculation(pricingContext, unchainedAPI) {
18
+ const context = await this.buildPricingContext(pricingContext, unchainedAPI);
19
+ let calculation = [];
20
+ const Adapters = baseDirector.getAdapters({
21
+ adapterFilter: (Adapter) => {
22
+ return Adapter.isActivatedFor(context);
23
+ },
24
+ });
25
+ calculation = await Adapters.reduce(async (previousPromise, Adapter) => {
26
+ const resolvedCalculation = await previousPromise;
27
+ if (!resolvedCalculation)
28
+ return null;
29
+ const discounts = await Promise.all(context.discounts.map(async (orderDiscount) => {
30
+ const order = await unchainedAPI.modules.orders.findOrder({
31
+ orderId: orderDiscount.orderId,
32
+ });
33
+ const DiscountAdapter = OrderDiscountDirector.getAdapter(orderDiscount.discountKey);
34
+ if (!DiscountAdapter)
35
+ return null;
36
+ const adapter = await DiscountAdapter.actions({
37
+ context: { order, orderDiscount, code: orderDiscount.code, ...unchainedAPI },
38
+ });
39
+ const configuration = adapter.discountForPricingAdapterKey({
40
+ pricingAdapterKey: Adapter.key,
41
+ calculationSheet: this.calculationSheet(pricingContext, calculation),
42
+ });
43
+ return {
44
+ discountId: orderDiscount._id,
45
+ configuration,
46
+ };
47
+ }));
48
+ try {
49
+ const adapter = Adapter.actions({
50
+ context,
51
+ calculationSheet: this.calculationSheet(pricingContext, calculation),
52
+ discounts: discounts.filter((d) => d?.configuration !== null),
53
+ });
54
+ const nextCalculationResult = await adapter.calculate();
55
+ if (!nextCalculationResult)
56
+ return null;
57
+ calculation = resolvedCalculation.concat(nextCalculationResult);
58
+ return calculation;
59
+ }
60
+ catch (error) {
61
+ logger.error(error);
62
+ }
63
+ return resolvedCalculation;
64
+ }, Promise.resolve([]));
65
+ return calculation;
66
+ },
67
+ };
68
+ return director;
69
+ };
70
+ //# sourceMappingURL=BasePricingDirector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasePricingDirector.js","sourceRoot":"","sources":["../../src/directors/BasePricingDirector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqC,MAAM,sBAAsB,CAAC;AAGvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AA+B9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAMjC,YAAoB,EAQpB,EAAE;IACF,MAAM,YAAY,GAAG,YAAY,CAAiB,YAAY,EAAE;QAC9D,cAAc,EAAE,YAAY;KAC7B,CAAC,CAAC;IAEH,MAAM,QAAQ,GAO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