@lyxa.ai/marketing 1.0.43 → 1.0.46

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 (156) hide show
  1. package/dist/lib/event/event-initializations.d.ts.map +1 -1
  2. package/dist/lib/event/event-initializations.js +1 -0
  3. package/dist/lib/event/event-initializations.js.map +1 -1
  4. package/dist/lib/event/event-listeners/event-listeners.d.ts +1 -0
  5. package/dist/lib/event/event-listeners/event-listeners.d.ts.map +1 -1
  6. package/dist/lib/event/event-listeners/event-listeners.js +7 -0
  7. package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
  8. package/dist/lib/index.d.ts +162 -22
  9. package/dist/lib/index.d.ts.map +1 -1
  10. package/dist/lib/modules/coupon/routers/coupon.router.d.ts +103 -21
  11. package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  12. package/dist/lib/modules/coupon/routers/coupon.router.js +1 -1
  13. package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
  14. package/dist/lib/modules/coupon/services/coupon.service.d.ts +3 -1
  15. package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
  16. package/dist/lib/modules/coupon/services/coupon.service.js +33 -12
  17. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  18. package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts +208 -3
  19. package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
  20. package/dist/lib/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  21. package/dist/lib/modules/coupon/services/global-coupon.service.js +2 -0
  22. package/dist/lib/modules/coupon/services/global-coupon.service.js.map +1 -1
  23. package/dist/lib/modules/coupon/services/helper.service.d.ts +214 -4
  24. package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
  25. package/dist/lib/modules/coupon/services/helper.service.js +114 -16
  26. package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
  27. package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts +208 -3
  28. package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
  29. package/dist/lib/modules/coupon/services/individual-user-coupon.service.d.ts +1 -1
  30. package/dist/lib/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  31. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js +20 -11
  32. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js.map +1 -1
  33. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  34. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +3 -5
  35. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
  36. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts +2 -2
  37. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  38. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +151 -45
  39. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
  40. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  41. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +2 -0
  42. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
  43. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts +208 -3
  44. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
  45. package/dist/lib/modules/coupon/transformers/coupon.transformer.d.ts +5 -1
  46. package/dist/lib/modules/coupon/transformers/coupon.transformer.d.ts.map +1 -1
  47. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts +243 -23
  48. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
  49. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +82 -17
  50. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  51. package/dist/lib/modules/coupon/validations/coupon.validation.js +25 -3
  52. package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
  53. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts +94 -6
  54. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
  55. package/dist/lib/modules/coupon/validations/custom-coupon.validation.d.ts +9 -0
  56. package/dist/lib/modules/coupon/validations/custom-coupon.validation.d.ts.map +1 -1
  57. package/dist/lib/modules/coupon/validations/custom-coupon.validation.js +1 -0
  58. package/dist/lib/modules/coupon/validations/custom-coupon.validation.js.map +1 -1
  59. package/dist/lib/modules/coupon/validations/individual-store-coupon.validation.d.ts +200 -122
  60. package/dist/lib/modules/coupon/validations/individual-store-coupon.validation.d.ts.map +1 -1
  61. package/dist/lib/modules/coupon/validations/individual-store-coupon.validation.js +20 -3
  62. package/dist/lib/modules/coupon/validations/individual-store-coupon.validation.js.map +1 -1
  63. package/dist/lib/modules/coupon/validations/individual-user-coupon.validation.d.ts +9 -0
  64. package/dist/lib/modules/coupon/validations/individual-user-coupon.validation.d.ts.map +1 -1
  65. package/dist/lib/modules/coupon/validations/individual-user-coupon.validation.js +1 -0
  66. package/dist/lib/modules/coupon/validations/individual-user-coupon.validation.js.map +1 -1
  67. package/dist/lib/modules/coupon/validations/shops-categories-coupon.validation.d.ts +9 -0
  68. package/dist/lib/modules/coupon/validations/shops-categories-coupon.validation.d.ts.map +1 -1
  69. package/dist/lib/modules/coupon/validations/shops-categories-coupon.validation.js +1 -0
  70. package/dist/lib/modules/coupon/validations/shops-categories-coupon.validation.js.map +1 -1
  71. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +58 -0
  72. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  73. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +4 -1
  74. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  75. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +18 -2
  76. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
  77. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +58 -0
  78. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  79. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +7 -0
  80. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -1
  81. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +137 -3
  82. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  83. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +11 -9
  84. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
  85. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +3 -0
  86. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  87. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +4 -0
  88. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -1
  89. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +1 -0
  90. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  91. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +19 -0
  92. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
  93. package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
  94. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
  95. package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts +1 -0
  96. package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
  97. package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js +14 -0
  98. package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js.map +1 -1
  99. package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
  100. package/dist/types/event/event-initializations.d.ts.map +1 -1
  101. package/dist/types/event/event-listeners/event-listeners.d.ts +1 -0
  102. package/dist/types/event/event-listeners/event-listeners.d.ts.map +1 -1
  103. package/dist/types/index.d.ts +162 -22
  104. package/dist/types/index.d.ts.map +1 -1
  105. package/dist/types/modules/coupon/routers/coupon.router.d.ts +103 -21
  106. package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  107. package/dist/types/modules/coupon/services/coupon.service.d.ts +3 -1
  108. package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
  109. package/dist/types/modules/coupon/services/custom-coupon.service.d.ts +208 -3
  110. package/dist/types/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
  111. package/dist/types/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  112. package/dist/types/modules/coupon/services/helper.service.d.ts +214 -4
  113. package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
  114. package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts +208 -3
  115. package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
  116. package/dist/types/modules/coupon/services/individual-user-coupon.service.d.ts +1 -1
  117. package/dist/types/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  118. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  119. package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts +2 -2
  120. package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  121. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  122. package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts +208 -3
  123. package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
  124. package/dist/types/modules/coupon/transformers/coupon.transformer.d.ts +5 -1
  125. package/dist/types/modules/coupon/transformers/coupon.transformer.d.ts.map +1 -1
  126. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts +243 -23
  127. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
  128. package/dist/types/modules/coupon/validations/coupon.validation.d.ts +82 -17
  129. package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  130. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts +94 -6
  131. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
  132. package/dist/types/modules/coupon/validations/custom-coupon.validation.d.ts +9 -0
  133. package/dist/types/modules/coupon/validations/custom-coupon.validation.d.ts.map +1 -1
  134. package/dist/types/modules/coupon/validations/individual-store-coupon.validation.d.ts +200 -122
  135. package/dist/types/modules/coupon/validations/individual-store-coupon.validation.d.ts.map +1 -1
  136. package/dist/types/modules/coupon/validations/individual-user-coupon.validation.d.ts +9 -0
  137. package/dist/types/modules/coupon/validations/individual-user-coupon.validation.d.ts.map +1 -1
  138. package/dist/types/modules/coupon/validations/shops-categories-coupon.validation.d.ts +9 -0
  139. package/dist/types/modules/coupon/validations/shops-categories-coupon.validation.d.ts.map +1 -1
  140. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +58 -0
  141. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  142. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +4 -1
  143. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  144. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +58 -0
  145. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  146. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +137 -3
  147. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  148. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +3 -0
  149. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  150. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +1 -0
  151. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  152. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
  153. package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts +1 -0
  154. package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
  155. package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
  156. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"event-initializations.d.ts","sourceRoot":"/","sources":["event/event-initializations.ts"],"names":[],"mappings":"AAMA,wBAAsB,kBAAkB,kBAIvC"}
1
+ {"version":3,"file":"event-initializations.d.ts","sourceRoot":"/","sources":["event/event-initializations.ts"],"names":[],"mappings":"AAOA,wBAAsB,kBAAkB,kBAKvC"}
@@ -6,6 +6,7 @@ const jobs_1 = require("../modules/limited-time-offer/campaign/jobs");
6
6
  async function initEventListeners() {
7
7
  (0, event_listeners_1.subscribeToSyncAllProductsProductMarketingInfoProcessEvent)();
8
8
  await (0, event_listeners_1.subscribeToMarketingEntireMenuSeedEvent)();
9
+ await (0, event_listeners_1.subscribeToMarketingReturnPunchCouponEvent)();
9
10
  await (0, jobs_1.startBullMQWorkers)();
10
11
  }
11
12
  //# sourceMappingURL=event-initializations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-initializations.js","sourceRoot":"/","sources":["event/event-initializations.ts"],"names":[],"mappings":";;AAMA,gDAIC;AAVD,uEAG2C;AAC3C,oEAA+E;AAExE,KAAK,UAAU,kBAAkB;IACpC,IAAA,4EAA0D,GAAE,CAAC;IAC7D,MAAM,IAAA,yDAAuC,GAAE,CAAC;IAChD,MAAM,IAAA,yBAAkB,GAAE,CAAC;AAC/B,CAAC","sourcesContent":["import {\n subscribeToSyncAllProductsProductMarketingInfoProcessEvent,\n subscribeToMarketingEntireMenuSeedEvent,\n} from './event-listeners/event-listeners';\nimport { startBullMQWorkers } from '@modules/limited-time-offer/campaign/jobs';\n\nexport async function initEventListeners() {\n subscribeToSyncAllProductsProductMarketingInfoProcessEvent();\n await subscribeToMarketingEntireMenuSeedEvent();\n await startBullMQWorkers();\n}\n"]}
1
+ {"version":3,"file":"event-initializations.js","sourceRoot":"/","sources":["event/event-initializations.ts"],"names":[],"mappings":";;AAOA,gDAKC;AAZD,uEAI2C;AAC3C,oEAA+E;AAExE,KAAK,UAAU,kBAAkB;IACpC,IAAA,4EAA0D,GAAE,CAAC;IAC7D,MAAM,IAAA,yDAAuC,GAAE,CAAC;IAChD,MAAM,IAAA,4DAA0C,GAAE,CAAC;IACnD,MAAM,IAAA,yBAAkB,GAAE,CAAC;AAC/B,CAAC","sourcesContent":["import {\n subscribeToSyncAllProductsProductMarketingInfoProcessEvent,\n subscribeToMarketingEntireMenuSeedEvent,\n subscribeToMarketingReturnPunchCouponEvent,\n} from './event-listeners/event-listeners';\nimport { startBullMQWorkers } from '@modules/limited-time-offer/campaign/jobs';\n\nexport async function initEventListeners() {\n subscribeToSyncAllProductsProductMarketingInfoProcessEvent();\n await subscribeToMarketingEntireMenuSeedEvent();\n await subscribeToMarketingReturnPunchCouponEvent();\n await startBullMQWorkers();\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  export declare function subscribeToSyncAllProductsProductMarketingInfoProcessEvent(): Promise<void>;
2
2
  export declare function subscribeToMarketingEntireMenuSeedEvent(): Promise<void>;
3
+ export declare function subscribeToMarketingReturnPunchCouponEvent(): Promise<void>;
3
4
  //# sourceMappingURL=event-listeners.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-listeners.d.ts","sourceRoot":"/","sources":["event/event-listeners/event-listeners.ts"],"names":[],"mappings":"AAYA,wBAAsB,0DAA0D,kBAI/E;AAED,wBAAsB,uCAAuC,kBAmD5D"}
1
+ {"version":3,"file":"event-listeners.d.ts","sourceRoot":"/","sources":["event/event-listeners/event-listeners.ts"],"names":[],"mappings":"AAaA,wBAAsB,0DAA0D,kBAI/E;AAED,wBAAsB,uCAAuC,kBAmD5D;AAED,wBAAsB,0CAA0C,kBAI/D"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.subscribeToSyncAllProductsProductMarketingInfoProcessEvent = subscribeToSyncAllProductsProductMarketingInfoProcessEvent;
4
4
  exports.subscribeToMarketingEntireMenuSeedEvent = subscribeToMarketingEntireMenuSeedEvent;
5
+ exports.subscribeToMarketingReturnPunchCouponEvent = subscribeToMarketingReturnPunchCouponEvent;
5
6
  const event_1 = require("@lyxa.ai/core/dist/libraries/event");
6
7
  const core_1 = require("@lyxa.ai/core");
7
8
  const services_1 = require("../../modules/marketing/services");
@@ -10,6 +11,7 @@ const typegoose_1 = require("@typegoose/typegoose");
10
11
  const mongo_stream_changes_batch_process_shops_event_1 = require("@lyxa.ai/core/dist/libraries/event/events/mongo-stream-changes-batch-process-shops-event");
11
12
  const events_common_methods_1 = require("@lyxa.ai/core/dist/utilities/events-common-methods");
12
13
  const marketing_product_seed_event_1 = require("../events/marketing-product-seed.event");
14
+ const services_2 = require("../../modules/punch-marketing-history/services");
13
15
  async function subscribeToSyncAllProductsProductMarketingInfoProcessEvent() {
14
16
  await (0, event_1.subscribeToEvent)(EventEnums_1.PublishEventEnums.SYNC_ALL_PRODUCTS_PRODUCT_MARKETING_INFO_EVENT, async (payload) => {
15
17
  services_1.synchronizeProductMarketingService.processAllProductsProductMarketingInfoEvent(payload);
@@ -61,4 +63,9 @@ async function subscribeToMarketingEntireMenuSeedEvent() {
61
63
  });
62
64
  });
63
65
  }
66
+ async function subscribeToMarketingReturnPunchCouponEvent() {
67
+ await (0, event_1.subscribeToEvent)(EventEnums_1.PublishEventEnums.MARKETING_RETURN_PUNCH_COUPON_EVENT, async (payload) => {
68
+ services_2.punchMarketingHistoryService.returnPunchCoupon(payload.orderId);
69
+ });
70
+ }
64
71
  //# sourceMappingURL=event-listeners.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-listeners.js","sourceRoot":"/","sources":["event/event-listeners/event-listeners.ts"],"names":[],"mappings":";;AAYA,gIAIC;AAED,0FAmDC;AArED,8DAAsE;AACtE,wCAA6C;AAC7C,0DAA0G;AAC1G,8EAAkF;AAClF,oDAAgD;AAChD,6JAAsI;AACtI,8FAAsH;AACtH,yFAGgD;AAEzC,KAAK,UAAU,0DAA0D;IAC/E,MAAM,IAAA,wBAAgB,EAAC,8BAAiB,CAAC,8CAA8C,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;QACxG,6CAAkC,CAAC,2CAA2C,CAAC,OAAO,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,uCAAuC;IAC5D,MAAM,IAAA,wBAAgB,EAAC,+DAAgC,EAAE,KAAK,EAAE,OAAoC,EAAE,EAAE;QACvG,MAAM,MAAM,GAAG,IAAA,mBAAY,GAAE,CAAC,YAAY,EAAE,CAAC;QAC7C,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAClE,MAAM,WAAW,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAEhD,MAAM,YAAY,GAAG,CAAC,CAAC;QACvB,IAAI,SAAkB,CAAC;QAEvB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,YAAY,EAAE,OAAO,EAAE,EAA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EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;SACvD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { subscribeToEvent } from '@lyxa.ai/core/dist/libraries/event';\nimport { getLibraries } from '@lyxa.ai/core';\nimport { productMarketingService, synchronizeProductMarketingService } from '@modules/marketing/services';\nimport { PublishEventEnums } from '@lyxa.ai/core/dist/libraries/event/EventEnums';\nimport { mongoose } from '@typegoose/typegoose';\nimport { ChangeStreamOperationTypes } from '@lyxa.ai/core/dist/libraries/event/events/mongo-stream-changes-batch-process-shops-event';\nimport { publishSyncSingleShopSectionsInCacheProcessEvent } from '@lyxa.ai/core/dist/utilities/events-common-methods';\nimport {\n\tMARKETING_ENTIRE_MENU_SEED_EVENT,\n\tMarketingProductSeedPayload,\n} from '../events/marketing-product-seed.event';\n\nexport async function subscribeToSyncAllProductsProductMarketingInfoProcessEvent() {\n\tawait subscribeToEvent(PublishEventEnums.SYNC_ALL_PRODUCTS_PRODUCT_MARKETING_INFO_EVENT, async payload => {\n\t\tsynchronizeProductMarketingService.processAllProductsProductMarketingInfoEvent(payload);\n\t});\n}\n\nexport async function subscribeToMarketingEntireMenuSeedEvent() {\n\tawait subscribeToEvent(MARKETING_ENTIRE_MENU_SEED_EVENT, async (payload: MarketingProductSeedPayload) => {\n\t\tconst logger = getLibraries().getLoggerKit();\n\t\tconst { marketingId: mid, shopId: sid, page, pageSize } = payload;\n\t\tconst marketingId = new mongoose.Types.ObjectId(mid);\n\t\tconst shopId = new mongoose.Types.ObjectId(sid);\n\n\t\tconst MAX_ATTEMPTS = 3;\n\t\tlet lastError: unknown;\n\n\t\tfor (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {\n\t\t\ttry {\n\t\t\t\tconst productIds = await productMarketingService.upsertProductMarketingsForPage({\n\t\t\t\t\tshop: shopId,\n\t\t\t\t\tmarketingId,\n\t\t\t\t\tpage,\n\t\t\t\t\tpageSize,\n\t\t\t\t\tisAppliedByCompany: payload.isAppliedByCompany,\n\t\t\t\t\tisBuy1Get1: payload.isBuy1Get1,\n\t\t\t\t\tvalue: payload.value,\n\t\t\t\t\tvalueType: payload.valueType,\n\t\t\t\t});\n\n\t\t\t\tif (productIds.length) {\n\t\t\t\t\tawait synchronizeProductMarketingService.syncProductMarketingInfoByProductIds(productIds);\n\t\t\t\t}\n\n\t\t\t\tpublishSyncSingleShopSectionsInCacheProcessEvent({\n\t\t\t\t\tshopId,\n\t\t\t\t\toperation: ChangeStreamOperationTypes.UPDATE,\n\t\t\t\t});\n\n\t\t\t\tlogger.debug(`page ${page} seeded — ${productIds.length} products updated`, {\n\t\t\t\t\ttag: 'marketing.seed.entire-menu',\n\t\t\t\t\tdata: { marketingId: mid, shopId: sid, page, count: productIds.length },\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tlastError = error;\n\t\t\t\tif (attempt < MAX_ATTEMPTS) {\n\t\t\t\t\tawait new Promise(resolve => setTimeout(resolve, 2000 * attempt));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlogger.error(`page ${page} seed failed after ${MAX_ATTEMPTS} attempts — manual reseed required`, lastError, {\n\t\t\ttag: 'marketing.seed.entire-menu',\n\t\t\tdata: { marketingId: mid, shopId: sid, page, pageSize },\n\t\t});\n\t});\n}\n"]}
1
+ {"version":3,"file":"event-listeners.js","sourceRoot":"/","sources":["event/event-listeners/event-listeners.ts"],"names":[],"mappings":";;AAaA,gIAIC;AAED,0FAmDC;AAED,gGAIC;AA5ED,8DAAsE;AACtE,wCAA6C;AAC7C,0DAA0G;AAC1G,8EAAkF;AAClF,oDAAgD;AAChD,6JAAsI;AACtI,8FAAsH;AACtH,yFAGgD;AAChD,wEAAyF;AAElF,KAAK,UAAU,0DAA0D;IAC/E,MAAM,IAAA,wBAAgB,EAAC,8BAAiB,CAAC,8CAA8C,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;QACxG,6C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gBAEH,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,aAAa,UAAU,CAAC,MAAM,mBAAmB,EAAE;oBAC3E,GAAG,EAAE,4BAA4B;oBACjC,IAAI,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE;iBACvE,CAAC,CAAC;gBAEH,OAAO;YACR,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,SAAS,GAAG,KAAK,CAAC;gBAClB,IAAI,OAAO,GAAG,YAAY,EAAE,CAAC;oBAC5B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;gBACnE,CAAC;YACF,CAAC;QACF,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,sBAAsB,YAAY,oCAAoC,EAAE,SAAS,EAAE;YAC3G,GAAG,EAAE,4BAA4B;YACjC,IAAI,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;SACvD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,0CAA0C;IAC/D,MAAM,IAAA,wBAAgB,EAAC,8BAAiB,CAAC,mCAAmC,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;QAC7F,uCAA4B,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { subscribeToEvent } from '@lyxa.ai/core/dist/libraries/event';\nimport { getLibraries } from '@lyxa.ai/core';\nimport { productMarketingService, synchronizeProductMarketingService } from '@modules/marketing/services';\nimport { PublishEventEnums } from '@lyxa.ai/core/dist/libraries/event/EventEnums';\nimport { mongoose } from '@typegoose/typegoose';\nimport { ChangeStreamOperationTypes } from '@lyxa.ai/core/dist/libraries/event/events/mongo-stream-changes-batch-process-shops-event';\nimport { publishSyncSingleShopSectionsInCacheProcessEvent } from '@lyxa.ai/core/dist/utilities/events-common-methods';\nimport {\n\tMARKETING_ENTIRE_MENU_SEED_EVENT,\n\tMarketingProductSeedPayload,\n} from '../events/marketing-product-seed.event';\nimport { punchMarketingHistoryService } from '@modules/punch-marketing-history/services';\n\nexport async function subscribeToSyncAllProductsProductMarketingInfoProcessEvent() {\n\tawait subscribeToEvent(PublishEventEnums.SYNC_ALL_PRODUCTS_PRODUCT_MARKETING_INFO_EVENT, async payload => {\n\t\tsynchronizeProductMarketingService.processAllProductsProductMarketingInfoEvent(payload);\n\t});\n}\n\nexport async function subscribeToMarketingEntireMenuSeedEvent() {\n\tawait subscribeToEvent(MARKETING_ENTIRE_MENU_SEED_EVENT, async (payload: MarketingProductSeedPayload) => {\n\t\tconst logger = getLibraries().getLoggerKit();\n\t\tconst { marketingId: mid, shopId: sid, page, pageSize } = payload;\n\t\tconst marketingId = new mongoose.Types.ObjectId(mid);\n\t\tconst shopId = new mongoose.Types.ObjectId(sid);\n\n\t\tconst MAX_ATTEMPTS = 3;\n\t\tlet lastError: unknown;\n\n\t\tfor (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {\n\t\t\ttry {\n\t\t\t\tconst productIds = await productMarketingService.upsertProductMarketingsForPage({\n\t\t\t\t\tshop: shopId,\n\t\t\t\t\tmarketingId,\n\t\t\t\t\tpage,\n\t\t\t\t\tpageSize,\n\t\t\t\t\tisAppliedByCompany: payload.isAppliedByCompany,\n\t\t\t\t\tisBuy1Get1: payload.isBuy1Get1,\n\t\t\t\t\tvalue: payload.value,\n\t\t\t\t\tvalueType: payload.valueType,\n\t\t\t\t});\n\n\t\t\t\tif (productIds.length) {\n\t\t\t\t\tawait synchronizeProductMarketingService.syncProductMarketingInfoByProductIds(productIds);\n\t\t\t\t}\n\n\t\t\t\tpublishSyncSingleShopSectionsInCacheProcessEvent({\n\t\t\t\t\tshopId,\n\t\t\t\t\toperation: ChangeStreamOperationTypes.UPDATE,\n\t\t\t\t});\n\n\t\t\t\tlogger.debug(`page ${page} seeded — ${productIds.length} products updated`, {\n\t\t\t\t\ttag: 'marketing.seed.entire-menu',\n\t\t\t\t\tdata: { marketingId: mid, shopId: sid, page, count: productIds.length },\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tlastError = error;\n\t\t\t\tif (attempt < MAX_ATTEMPTS) {\n\t\t\t\t\tawait new Promise(resolve => setTimeout(resolve, 2000 * attempt));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlogger.error(`page ${page} seed failed after ${MAX_ATTEMPTS} attempts — manual reseed required`, lastError, {\n\t\t\ttag: 'marketing.seed.entire-menu',\n\t\t\tdata: { marketingId: mid, shopId: sid, page, pageSize },\n\t\t});\n\t});\n}\n\nexport async function subscribeToMarketingReturnPunchCouponEvent() {\n\tawait subscribeToEvent(PublishEventEnums.MARKETING_RETURN_PUNCH_COUPON_EVENT, async payload => {\n\t\tpunchMarketingHistoryService.returnPunchCoupon(payload.orderId);\n\t});\n}\n"]}