@lyxa.ai/marketing 1.0.67 → 1.0.68

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 (267) hide show
  1. package/dist/lib/index.d.ts +21 -11810
  2. package/dist/lib/index.d.ts.map +1 -1
  3. package/dist/lib/index.js +2 -0
  4. package/dist/lib/index.js.map +1 -1
  5. package/dist/lib/modules/coupon/routers/coupon.router.d.ts +1233 -10
  6. package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  7. package/dist/lib/modules/coupon/routers/coupon.router.js +28 -0
  8. package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
  9. package/dist/lib/modules/coupon/services/coupon.service.d.ts +29 -4
  10. package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
  11. package/dist/lib/modules/coupon/services/coupon.service.js +19 -3
  12. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  13. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  14. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +12 -15
  15. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
  16. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts +30 -2
  17. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  18. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +412 -2
  19. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
  20. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  21. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +1 -0
  22. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
  23. package/dist/lib/modules/coupon/transformers/coupon.transformer.d.ts +50 -0
  24. package/dist/lib/modules/coupon/transformers/coupon.transformer.d.ts.map +1 -1
  25. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts +822 -0
  26. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
  27. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +580 -1
  28. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  29. package/dist/lib/modules/coupon/validations/coupon.validation.js +48 -1
  30. package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
  31. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts +98 -0
  32. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
  33. package/dist/lib/modules/coupon/validations/create-coupon.validation.js +4 -1
  34. package/dist/lib/modules/coupon/validations/create-coupon.validation.js.map +1 -1
  35. package/dist/lib/modules/coupon/validations/referral-reward-coupon.validation.d.ts +374 -0
  36. package/dist/lib/modules/coupon/validations/referral-reward-coupon.validation.d.ts.map +1 -1
  37. package/dist/lib/modules/coupon/validations/referral-reward-coupon.validation.js +2 -0
  38. package/dist/lib/modules/coupon/validations/referral-reward-coupon.validation.js.map +1 -1
  39. package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts +4 -4
  40. package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
  41. package/dist/lib/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
  42. package/dist/lib/modules/deal-setting/services/deal-setting.service.js +4 -1
  43. package/dist/lib/modules/deal-setting/services/deal-setting.service.js.map +1 -1
  44. package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts +4 -4
  45. package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
  46. package/dist/lib/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
  47. package/dist/lib/modules/featured-setting/services/featured-setting.service.js +3 -0
  48. package/dist/lib/modules/featured-setting/services/featured-setting.service.js.map +1 -1
  49. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +54 -8
  50. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  51. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +13 -0
  52. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
  53. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
  54. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js +9 -0
  55. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js.map +1 -1
  56. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
  57. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
  58. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +2 -6
  59. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -1
  60. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +16 -3
  61. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
  62. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +22 -3
  63. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -1
  64. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +2 -0
  65. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
  66. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js +12 -0
  67. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js.map +1 -1
  68. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +242 -35
  69. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  70. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +19 -1
  71. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
  72. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +10 -1
  73. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
  74. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js +83 -1
  75. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js.map +1 -1
  76. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +4 -0
  77. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
  78. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js +75 -6
  79. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js.map +1 -1
  80. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
  81. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  82. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +46 -19
  83. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
  84. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +241 -10
  85. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  86. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts +2 -0
  87. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
  88. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +13 -4
  89. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -1
  90. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
  91. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js +1 -1
  92. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js.map +1 -1
  93. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +30 -3
  94. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
  95. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +23 -1
  96. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -1
  97. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +18 -0
  98. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  99. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +103 -0
  100. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
  101. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +187 -2
  102. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  103. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +34 -0
  104. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -1
  105. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
  106. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
  107. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +2 -0
  108. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +1 -0
  109. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +515 -116
  110. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  111. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +16 -6
  112. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
  113. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +11 -4
  114. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  115. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +48 -7
  116. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -1
  117. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +19 -5
  118. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  119. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +114 -16
  120. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
  121. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
  122. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js +1 -0
  123. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js.map +1 -1
  124. package/dist/lib/modules/marketing/routers/marketing.router.d.ts +4 -4
  125. package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  126. package/dist/lib/modules/marketing/services/index.d.ts +1 -0
  127. package/dist/lib/modules/marketing/services/index.d.ts.map +1 -1
  128. package/dist/lib/modules/marketing/services/index.js +1 -0
  129. package/dist/lib/modules/marketing/services/index.js.map +1 -1
  130. package/dist/lib/modules/marketing/services/marketing.service.d.ts +7 -3
  131. package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
  132. package/dist/lib/modules/marketing/services/marketing.service.js +61 -10
  133. package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
  134. package/dist/lib/modules/marketing/services/new-user-discount-marketing.service.d.ts +11 -0
  135. package/dist/lib/modules/marketing/services/new-user-discount-marketing.service.d.ts.map +1 -0
  136. package/dist/lib/modules/marketing/services/new-user-discount-marketing.service.js +116 -0
  137. package/dist/lib/modules/marketing/services/new-user-discount-marketing.service.js.map +1 -0
  138. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +1 -0
  139. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  140. package/dist/lib/modules/marketing/services/product-marketing.service.js +32 -0
  141. package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
  142. package/dist/lib/modules/marketing/validations/all-marketings.validation.d.ts.map +1 -1
  143. package/dist/lib/modules/marketing/validations/all-marketings.validation.js +3 -0
  144. package/dist/lib/modules/marketing/validations/all-marketings.validation.js.map +1 -1
  145. package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +6 -6
  146. package/dist/lib/modules/marketing/validations/index.d.ts +1 -0
  147. package/dist/lib/modules/marketing/validations/index.d.ts.map +1 -1
  148. package/dist/lib/modules/marketing/validations/index.js +1 -0
  149. package/dist/lib/modules/marketing/validations/index.js.map +1 -1
  150. package/dist/lib/modules/marketing/validations/new-user-discount-marketing.validation.d.ts +677 -0
  151. package/dist/lib/modules/marketing/validations/new-user-discount-marketing.validation.d.ts.map +1 -0
  152. package/dist/lib/modules/marketing/validations/new-user-discount-marketing.validation.js +83 -0
  153. package/dist/lib/modules/marketing/validations/new-user-discount-marketing.validation.js.map +1 -0
  154. package/dist/lib/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
  155. package/dist/lib/modules/marketing/validations/spend-to-get-marketing.validation.d.ts.map +1 -1
  156. package/dist/lib/modules/marketing/validations/spend-to-get-marketing.validation.js +30 -0
  157. package/dist/lib/modules/marketing/validations/spend-to-get-marketing.validation.js.map +1 -1
  158. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +4 -4
  159. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
  160. package/dist/lib/modules/referral-setting/validations/referral-setting.validation.d.ts.map +1 -1
  161. package/dist/lib/modules/referral-setting/validations/referral-setting.validation.js.map +1 -1
  162. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.d.ts +3 -2
  163. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.d.ts.map +1 -1
  164. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.js +11 -3
  165. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.js.map +1 -1
  166. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts +20 -4
  167. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -1
  168. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.d.ts +2 -2
  169. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.d.ts.map +1 -1
  170. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.js.map +1 -1
  171. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +19 -0
  172. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.d.ts.map +1 -1
  173. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.js +1 -0
  174. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.js.map +1 -1
  175. package/dist/types/index.d.ts +21 -11810
  176. package/dist/types/index.d.ts.map +1 -1
  177. package/dist/types/modules/coupon/routers/coupon.router.d.ts +1233 -10
  178. package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  179. package/dist/types/modules/coupon/services/coupon.service.d.ts +29 -4
  180. package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
  181. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  182. package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts +30 -2
  183. package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  184. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  185. package/dist/types/modules/coupon/transformers/coupon.transformer.d.ts +50 -0
  186. package/dist/types/modules/coupon/transformers/coupon.transformer.d.ts.map +1 -1
  187. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts +822 -0
  188. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
  189. package/dist/types/modules/coupon/validations/coupon.validation.d.ts +580 -1
  190. package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  191. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts +98 -0
  192. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
  193. package/dist/types/modules/coupon/validations/referral-reward-coupon.validation.d.ts +374 -0
  194. package/dist/types/modules/coupon/validations/referral-reward-coupon.validation.d.ts.map +1 -1
  195. package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts +4 -4
  196. package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
  197. package/dist/types/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
  198. package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts +4 -4
  199. package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
  200. package/dist/types/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
  201. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +54 -8
  202. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  203. package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
  204. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
  205. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
  206. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +16 -3
  207. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
  208. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +2 -0
  209. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
  210. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +242 -35
  211. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  212. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +10 -1
  213. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
  214. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +4 -0
  215. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
  216. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
  217. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  218. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +241 -10
  219. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  220. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts +2 -0
  221. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
  222. package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
  223. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +30 -3
  224. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
  225. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +18 -0
  226. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  227. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +187 -2
  228. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  229. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
  230. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
  231. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +515 -116
  232. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  233. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +11 -4
  234. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  235. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +19 -5
  236. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  237. package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
  238. package/dist/types/modules/marketing/routers/marketing.router.d.ts +4 -4
  239. package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  240. package/dist/types/modules/marketing/services/index.d.ts +1 -0
  241. package/dist/types/modules/marketing/services/index.d.ts.map +1 -1
  242. package/dist/types/modules/marketing/services/marketing.service.d.ts +7 -3
  243. package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
  244. package/dist/types/modules/marketing/services/new-user-discount-marketing.service.d.ts +20 -0
  245. package/dist/types/modules/marketing/services/new-user-discount-marketing.service.d.ts.map +1 -0
  246. package/dist/types/modules/marketing/services/product-marketing.service.d.ts +6 -0
  247. package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  248. package/dist/types/modules/marketing/validations/all-marketings.validation.d.ts.map +1 -1
  249. package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +6 -6
  250. package/dist/types/modules/marketing/validations/index.d.ts +1 -0
  251. package/dist/types/modules/marketing/validations/index.d.ts.map +1 -1
  252. package/dist/types/modules/marketing/validations/new-user-discount-marketing.validation.d.ts +686 -0
  253. package/dist/types/modules/marketing/validations/new-user-discount-marketing.validation.d.ts.map +1 -0
  254. package/dist/types/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
  255. package/dist/types/modules/marketing/validations/spend-to-get-marketing.validation.d.ts.map +1 -1
  256. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +4 -4
  257. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
  258. package/dist/types/modules/referral-setting/validations/referral-setting.validation.d.ts.map +1 -1
  259. package/dist/types/modules/spend-to-get-history/spend-to-get-history.repository.d.ts +3 -2
  260. package/dist/types/modules/spend-to-get-history/spend-to-get-history.repository.d.ts.map +1 -1
  261. package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts +20 -4
  262. package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -1
  263. package/dist/types/modules/spend-to-get-history/spend-to-get-history.service.d.ts +2 -2
  264. package/dist/types/modules/spend-to-get-history/spend-to-get-history.service.d.ts.map +1 -1
  265. package/dist/types/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +19 -0
  266. package/dist/types/modules/spend-to-get-history/spend-to-get-history.validation.d.ts.map +1 -1
  267. package/package.json +2 -7
@@ -10,6 +10,8 @@ const shared_1 = require("@lyxa.ai/core/dist/utilities/shared");
10
10
  const dayjs_1 = require("@lyxa.ai/core/dist/utilities/dayjs");
11
11
  const pagination_1 = require("@lyxa.ai/core/dist/utilities/pagination");
12
12
  const search_1 = require("@lyxa.ai/core/dist/utilities/search");
13
+ const time_1 = require("@lyxa.ai/core/dist/utilities/time");
14
+ const core_1 = require("@lyxa.ai/core");
13
15
  class CouponRepository {
14
16
  model;
15
17
  userModel;
@@ -611,8 +613,6 @@ class CouponRepository {
611
613
  .includes(keyword));
612
614
  });
613
615
  }
614
- result.metadata.totalElements = result.documents.length;
615
- result.metadata.totalPages = Math.ceil(result.documents.length / size);
616
616
  return result;
617
617
  }
618
618
  buildCouponUsersPipeline(params) {
@@ -909,6 +909,416 @@ class CouponRepository {
909
909
  ],
910
910
  });
911
911
  }
912
+ async getReferFriendCouponOrders(params) {
913
+ const { page = 1, size = 10, sort, search, status, startDate, endDate } = params;
914
+ const adminSettings = await (0, core_1.getLibraries)().getCachedSettingsService().getSettings();
915
+ const exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 1;
916
+ const match = {
917
+ couponType: enum_1.CouponType.REFERRAL_REWARD,
918
+ };
919
+ if (startDate || endDate) {
920
+ match.createdAt = {};
921
+ if (startDate) {
922
+ match.createdAt.$gte = new Date(startDate);
923
+ }
924
+ if (endDate) {
925
+ match.createdAt.$lte = new Date(endDate);
926
+ }
927
+ }
928
+ const pipeline = [
929
+ {
930
+ $match: match,
931
+ },
932
+ {
933
+ $lookup: {
934
+ from: 'users',
935
+ localField: 'user',
936
+ foreignField: '_id',
937
+ as: 'senderDoc',
938
+ pipeline: [
939
+ {
940
+ $project: {
941
+ coreUser: 1,
942
+ },
943
+ },
944
+ ],
945
+ },
946
+ },
947
+ {
948
+ $unwind: {
949
+ path: '$senderDoc',
950
+ preserveNullAndEmptyArrays: true,
951
+ },
952
+ },
953
+ {
954
+ $lookup: {
955
+ from: 'users',
956
+ localField: 'referralCodeUsedBy',
957
+ foreignField: '_id',
958
+ as: 'receiverDoc',
959
+ pipeline: [
960
+ {
961
+ $project: {
962
+ coreUser: 1,
963
+ },
964
+ },
965
+ ],
966
+ },
967
+ },
968
+ {
969
+ $unwind: {
970
+ path: '$receiverDoc',
971
+ preserveNullAndEmptyArrays: true,
972
+ },
973
+ },
974
+ {
975
+ $project: {
976
+ senderDoc: {
977
+ _id: '$senderDoc._id',
978
+ coreUser: '$senderDoc.coreUser',
979
+ },
980
+ receiverDoc: {
981
+ _id: '$receiverDoc._id',
982
+ coreUser: '$receiverDoc.coreUser',
983
+ },
984
+ senderGets: {
985
+ value: '$referralSettingSnapShot.sender.value',
986
+ valueType: '$referralSettingSnapShot.sender.valueType',
987
+ },
988
+ receiverGets: {
989
+ value: '$referralSettingSnapShot.receiver.value',
990
+ valueType: '$referralSettingSnapShot.receiver.valueType',
991
+ },
992
+ status: enum_1.Status.ACTIVE,
993
+ referralDate: '$createdAt',
994
+ conversionDate: {
995
+ $cond: [
996
+ {
997
+ $eq: ['$expirationReason', null],
998
+ },
999
+ null,
1000
+ '$updatedAt',
1001
+ ],
1002
+ },
1003
+ },
1004
+ },
1005
+ ];
1006
+ if (search) {
1007
+ const userIds = await this.getCoreUserIds(search);
1008
+ pipeline.push({
1009
+ $match: {
1010
+ $or: [
1011
+ {
1012
+ 'senderDoc.coreUser': {
1013
+ $in: userIds,
1014
+ },
1015
+ },
1016
+ {
1017
+ 'receiverDoc.coreUser': {
1018
+ $in: userIds,
1019
+ },
1020
+ },
1021
+ ],
1022
+ },
1023
+ });
1024
+ }
1025
+ const result = await (0, pagination_1.paginateAggregation)(this.model, pipeline, page, size, sort ?? { createdAt: -1 });
1026
+ const coreUserIds = result.documents
1027
+ .flatMap((doc) => [doc.senderDoc?.coreUser, doc.receiverDoc?.coreUser])
1028
+ .filter(Boolean);
1029
+ const coreUsers = await this.coreUserModel.find({
1030
+ _id: { $in: coreUserIds },
1031
+ });
1032
+ const coreUserMap = new Map(coreUsers.map((user) => [String(user._id), user]));
1033
+ for (const doc of result.documents) {
1034
+ const senderCoreUser = coreUserMap.get(String(doc.senderDoc?.coreUser));
1035
+ const receiverCoreUser = coreUserMap.get(String(doc.receiverDoc?.coreUser));
1036
+ const senderValue = doc.senderGets?.valueType === 'fixed'
1037
+ ? (0, shared_1.roundSecondaryCurrency)((doc.senderGets?.value ?? 0) * exchangeRate)
1038
+ : doc.senderGets?.value;
1039
+ const receiverValue = doc.receiverGets?.valueType === 'fixed'
1040
+ ? (0, shared_1.roundSecondaryCurrency)((doc.receiverGets?.value ?? 0) * exchangeRate)
1041
+ : doc.receiverGets?.value;
1042
+ doc.sender = {
1043
+ _id: String(doc.senderDoc?._id ?? ''),
1044
+ name: senderCoreUser?.name ?? null,
1045
+ photo: senderCoreUser?.profilePhoto ?? null,
1046
+ };
1047
+ doc.receiver = {
1048
+ _id: String(doc.receiverDoc?._id ?? ''),
1049
+ name: receiverCoreUser?.name ?? null,
1050
+ photo: receiverCoreUser?.profilePhoto ?? null,
1051
+ };
1052
+ doc.senderGets = senderValue != null ? `${senderValue} ${doc.senderGets.valueType}` : null;
1053
+ doc.receiverGets = receiverValue != null ? `${receiverValue} ${doc.receiverGets.valueType}` : null;
1054
+ delete doc.senderDoc;
1055
+ delete doc.receiverDoc;
1056
+ }
1057
+ return result;
1058
+ }
1059
+ getAnalyticsGrouping(startDate, endDate) {
1060
+ const diffInDays = Math.ceil((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24)) + 1;
1061
+ return {
1062
+ isDaily: diffInDays <= 30,
1063
+ dateFormat: diffInDays <= 30 ? '%Y-%m-%d' : '%Y-%m',
1064
+ };
1065
+ }
1066
+ fillMissingDates(startDate, endDate, data, valueField) {
1067
+ const dataMap = new Map(data.map(item => [item.date, item[valueField]]));
1068
+ const result = [];
1069
+ const currentDate = new Date(startDate);
1070
+ while (currentDate <= endDate) {
1071
+ const formatter = new Intl.DateTimeFormat('en-CA', {
1072
+ timeZone: time_1.LyxaTimezone,
1073
+ year: 'numeric',
1074
+ month: '2-digit',
1075
+ day: '2-digit',
1076
+ });
1077
+ const parts = formatter.formatToParts(currentDate);
1078
+ const year = parts.find(p => p.type === 'year')?.value;
1079
+ const month = parts.find(p => p.type === 'month')?.value;
1080
+ const day = parts.find(p => p.type === 'day')?.value;
1081
+ const date = `${year}-${month}-${day}`;
1082
+ result.push({
1083
+ date,
1084
+ [valueField]: dataMap.get(date) ?? 0,
1085
+ });
1086
+ currentDate.setDate(currentDate.getDate() + 1);
1087
+ }
1088
+ return result;
1089
+ }
1090
+ fillMissingMonths(startDate, endDate, data, valueField) {
1091
+ const dataMap = new Map(data.map(item => [item.date, item[valueField]]));
1092
+ const result = [];
1093
+ const current = new Date(startDate);
1094
+ current.setDate(1);
1095
+ while (current <= endDate) {
1096
+ const year = current.getFullYear();
1097
+ const month = String(current.getMonth() + 1).padStart(2, '0');
1098
+ const date = `${year}-${month}`;
1099
+ result.push({
1100
+ date,
1101
+ [valueField]: dataMap.get(date) ?? 0,
1102
+ });
1103
+ current.setMonth(current.getMonth() + 1);
1104
+ }
1105
+ return result;
1106
+ }
1107
+ async getReferralsGraphData(payload) {
1108
+ const { startDate, endDate } = payload;
1109
+ const { isDaily, dateFormat } = this.getAnalyticsGrouping(startDate, endDate);
1110
+ const referrals = await this.model.aggregate([
1111
+ {
1112
+ $match: {
1113
+ couponType: enum_1.CouponType.REFERRAL_REWARD,
1114
+ createdAt: {
1115
+ $gte: startDate,
1116
+ $lte: endDate,
1117
+ },
1118
+ },
1119
+ },
1120
+ {
1121
+ $group: {
1122
+ _id: {
1123
+ $dateToString: {
1124
+ format: dateFormat,
1125
+ date: '$createdAt',
1126
+ timezone: time_1.LyxaTimezone,
1127
+ },
1128
+ },
1129
+ totalReferrals: {
1130
+ $sum: 1,
1131
+ },
1132
+ },
1133
+ },
1134
+ {
1135
+ $project: {
1136
+ _id: 0,
1137
+ date: '$_id',
1138
+ totalReferrals: 1,
1139
+ },
1140
+ },
1141
+ {
1142
+ $sort: {
1143
+ date: 1,
1144
+ },
1145
+ },
1146
+ ]);
1147
+ const conversions = await this.model.aggregate([
1148
+ {
1149
+ $match: {
1150
+ couponType: enum_1.CouponType.REFERRAL_REWARD,
1151
+ expirationReason: {
1152
+ $ne: null,
1153
+ },
1154
+ updatedAt: {
1155
+ $gte: startDate,
1156
+ $lte: endDate,
1157
+ },
1158
+ },
1159
+ },
1160
+ {
1161
+ $group: {
1162
+ _id: {
1163
+ $dateToString: {
1164
+ format: dateFormat,
1165
+ date: '$updatedAt',
1166
+ timezone: time_1.LyxaTimezone,
1167
+ },
1168
+ },
1169
+ totalConversions: {
1170
+ $sum: 1,
1171
+ },
1172
+ },
1173
+ },
1174
+ {
1175
+ $project: {
1176
+ _id: 0,
1177
+ date: '$_id',
1178
+ totalConversions: 1,
1179
+ },
1180
+ },
1181
+ {
1182
+ $sort: {
1183
+ date: 1,
1184
+ },
1185
+ },
1186
+ ]);
1187
+ if (!isDaily) {
1188
+ const referralData = this.fillMissingMonths(startDate, endDate, referrals, 'totalReferrals');
1189
+ const conversionData = this.fillMissingMonths(startDate, endDate, conversions, 'totalConversions');
1190
+ return referralData.map((item, index) => ({
1191
+ date: item.date,
1192
+ totalReferrals: item.totalReferrals,
1193
+ totalConversions: conversionData[index].totalConversions,
1194
+ }));
1195
+ }
1196
+ const referralData = this.fillMissingDates(startDate, endDate, referrals, 'totalReferrals');
1197
+ const conversionData = this.fillMissingDates(startDate, endDate, conversions, 'totalConversions');
1198
+ return referralData.map((item, index) => ({
1199
+ date: item.date,
1200
+ totalReferrals: item.totalReferrals,
1201
+ totalConversions: conversionData[index].totalConversions,
1202
+ }));
1203
+ }
1204
+ async getReferFriendMetrics(payload) {
1205
+ const { startDate, endDate } = payload;
1206
+ const [totalReferralsSent, totalReferralsConverted, totalProfit, totalNewCustomers] = await Promise.all([
1207
+ this.orderModel.countDocuments({
1208
+ status: enum_1.RegularOrderStatus.DELIVERED,
1209
+ deletedAt: null,
1210
+ processedAt: {
1211
+ $gte: startDate,
1212
+ $lte: endDate,
1213
+ },
1214
+ 'adjustedFinance.coupon.couponType': enum_1.CouponType.REFERRAL_CODE,
1215
+ }),
1216
+ this.model.countDocuments({
1217
+ couponType: enum_1.CouponType.REFERRAL_REWARD,
1218
+ expirationReason: {
1219
+ $ne: null,
1220
+ },
1221
+ updatedAt: {
1222
+ $gte: startDate,
1223
+ $lte: endDate,
1224
+ },
1225
+ }),
1226
+ this.orderModel.aggregate([
1227
+ {
1228
+ $match: {
1229
+ status: enum_1.RegularOrderStatus.DELIVERED,
1230
+ deletedAt: null,
1231
+ processedAt: {
1232
+ $gte: startDate,
1233
+ $lte: endDate,
1234
+ },
1235
+ 'adjustedFinance.coupon.couponType': enum_1.CouponType.REFERRAL_CODE,
1236
+ },
1237
+ },
1238
+ {
1239
+ $group: {
1240
+ _id: null,
1241
+ total: {
1242
+ $sum: '$adjustedFinance.companyProfit.totalProfit',
1243
+ },
1244
+ },
1245
+ },
1246
+ ]),
1247
+ this.userModel.countDocuments({
1248
+ createdAt: {
1249
+ $gte: startDate,
1250
+ $lte: endDate,
1251
+ },
1252
+ }),
1253
+ ]);
1254
+ const newCustomersFromReferral = await this.model.countDocuments({
1255
+ couponType: enum_1.CouponType.REFERRAL_REWARD,
1256
+ createdAt: {
1257
+ $gte: startDate,
1258
+ $lte: endDate,
1259
+ },
1260
+ });
1261
+ const conversionRate = totalReferralsSent === 0
1262
+ ? 0
1263
+ : Number(((totalReferralsConverted / totalReferralsSent) * 100).toFixed(2));
1264
+ const customerReferralRate = totalNewCustomers === 0 ? 0 : Number(((newCustomersFromReferral / totalNewCustomers) * 100).toFixed(2));
1265
+ return {
1266
+ totalReferralsSent,
1267
+ totalReferralsConverted,
1268
+ totalProfitFromReferrals: totalProfit[0]?.total ?? 0,
1269
+ conversionRate,
1270
+ customerReferralRate,
1271
+ };
1272
+ }
1273
+ async getTotalProfitGraphData(payload) {
1274
+ const { startDate, endDate } = payload;
1275
+ const { isDaily, dateFormat } = this.getAnalyticsGrouping(startDate, endDate);
1276
+ const analytics = await this.orderModel.aggregate([
1277
+ {
1278
+ $match: {
1279
+ status: enum_1.RegularOrderStatus.DELIVERED,
1280
+ deletedAt: null,
1281
+ processedAt: {
1282
+ $gte: startDate,
1283
+ $lte: endDate,
1284
+ },
1285
+ 'adjustedFinance.coupon.couponType': enum_1.CouponType.REFERRAL_CODE,
1286
+ },
1287
+ },
1288
+ {
1289
+ $group: {
1290
+ _id: {
1291
+ $dateToString: {
1292
+ format: dateFormat,
1293
+ date: '$processedAt',
1294
+ timezone: time_1.LyxaTimezone,
1295
+ },
1296
+ },
1297
+ totalProfit: {
1298
+ $sum: {
1299
+ $ifNull: ['$adjustedFinance.companyProfit.totalProfit', 0],
1300
+ },
1301
+ },
1302
+ },
1303
+ },
1304
+ {
1305
+ $project: {
1306
+ _id: 0,
1307
+ date: '$_id',
1308
+ totalProfit: 1,
1309
+ },
1310
+ },
1311
+ {
1312
+ $sort: {
1313
+ date: 1,
1314
+ },
1315
+ },
1316
+ ]);
1317
+ if (!isDaily) {
1318
+ return this.fillMissingMonths(startDate, endDate, analytics, 'totalProfit');
1319
+ }
1320
+ return this.fillMissingDates(startDate, endDate, analytics, 'totalProfit');
1321
+ }
912
1322
  }
913
1323
  exports.CouponRepository = CouponRepository;
914
1324
  //# sourceMappingURL=CouponRepository.js.map