@lyxa.ai/marketing 1.0.57 → 1.0.59

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 (176) 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 +62 -12
  7. package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
  8. package/dist/lib/event/events/marketing-product-seed.event.d.ts +1 -2
  9. package/dist/lib/event/events/marketing-product-seed.event.d.ts.map +1 -1
  10. package/dist/lib/event/events/marketing-product-seed.event.js.map +1 -1
  11. package/dist/lib/event/events/marketing-product-sync.event.d.ts +11 -0
  12. package/dist/lib/event/events/marketing-product-sync.event.d.ts.map +1 -0
  13. package/dist/lib/event/events/marketing-product-sync.event.js +12 -0
  14. package/dist/lib/event/events/marketing-product-sync.event.js.map +1 -0
  15. package/dist/lib/index.d.ts +243 -12
  16. package/dist/lib/index.d.ts.map +1 -1
  17. package/dist/lib/index.js +3 -2
  18. package/dist/lib/index.js.map +1 -1
  19. package/dist/lib/modules/coupon/routers/coupon.router.d.ts +2 -2
  20. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +2 -2
  21. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
  22. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +6 -6
  23. package/dist/lib/modules/coupon/validations/coupon.validation.js +2 -2
  24. package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
  25. package/dist/lib/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
  26. package/dist/lib/modules/deal-setting/services/deal-setting.service.js +4 -1
  27. package/dist/lib/modules/deal-setting/services/deal-setting.service.js.map +1 -1
  28. package/dist/lib/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
  29. package/dist/lib/modules/featured-setting/services/featured-setting.service.js +3 -0
  30. package/dist/lib/modules/featured-setting/services/featured-setting.service.js.map +1 -1
  31. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +54 -8
  32. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  33. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +11 -0
  34. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
  35. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
  36. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js +6 -0
  37. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js.map +1 -1
  38. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
  39. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
  40. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +2 -6
  41. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -1
  42. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +16 -3
  43. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
  44. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +22 -3
  45. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -1
  46. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +2 -0
  47. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
  48. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js +12 -0
  49. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js.map +1 -1
  50. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +242 -35
  51. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  52. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +19 -1
  53. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
  54. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +6 -1
  55. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
  56. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js +45 -1
  57. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js.map +1 -1
  58. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +3 -0
  59. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
  60. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js +66 -8
  61. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js.map +1 -1
  62. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
  63. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  64. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +37 -19
  65. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
  66. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +2 -2
  67. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +241 -10
  68. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  69. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts +2 -0
  70. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
  71. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +15 -3
  72. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -1
  73. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
  74. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js +1 -1
  75. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js.map +1 -1
  76. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +10 -2
  77. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
  78. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +4 -1
  79. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -1
  80. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +10 -0
  81. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  82. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +43 -0
  83. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
  84. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +187 -2
  85. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  86. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +29 -0
  87. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -1
  88. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +395 -0
  89. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  90. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +16 -6
  91. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
  92. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +7 -4
  93. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  94. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +31 -6
  95. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -1
  96. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +14 -3
  97. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  98. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +76 -16
  99. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
  100. package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts +13 -0
  101. package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts.map +1 -0
  102. package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.js +75 -0
  103. package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.js.map +1 -0
  104. package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts +21 -0
  105. package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts.map +1 -0
  106. package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.js +83 -0
  107. package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.js.map +1 -0
  108. package/dist/lib/modules/marketing/services/marketing.service.d.ts +1 -0
  109. package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
  110. package/dist/lib/modules/marketing/services/marketing.service.js +60 -46
  111. package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
  112. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +2 -3
  113. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  114. package/dist/lib/modules/marketing/services/product-marketing.service.js +42 -13
  115. package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
  116. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  117. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +95 -27
  118. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
  119. package/dist/types/event/event-initializations.d.ts.map +1 -1
  120. package/dist/types/event/event-listeners/event-listeners.d.ts +1 -0
  121. package/dist/types/event/event-listeners/event-listeners.d.ts.map +1 -1
  122. package/dist/types/event/events/marketing-product-seed.event.d.ts +1 -2
  123. package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -1
  124. package/dist/types/event/events/marketing-product-sync.event.d.ts +11 -0
  125. package/dist/types/event/events/marketing-product-sync.event.d.ts.map +1 -0
  126. package/dist/types/index.d.ts +243 -12
  127. package/dist/types/index.d.ts.map +1 -1
  128. package/dist/types/modules/coupon/routers/coupon.router.d.ts +2 -2
  129. package/dist/types/modules/coupon/validations/coupon.validation.d.ts +6 -6
  130. package/dist/types/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
  131. package/dist/types/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
  132. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +54 -8
  133. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  134. package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
  135. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
  136. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
  137. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +16 -3
  138. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
  139. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +2 -0
  140. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
  141. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +242 -35
  142. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  143. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +6 -1
  144. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
  145. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +3 -0
  146. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
  147. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
  148. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  149. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +2 -2
  150. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +241 -10
  151. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  152. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts +2 -0
  153. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
  154. package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
  155. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +10 -2
  156. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
  157. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +10 -0
  158. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  159. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +187 -2
  160. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  161. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +395 -0
  162. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  163. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +7 -4
  164. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  165. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +14 -3
  166. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  167. package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts +13 -0
  168. package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts.map +1 -0
  169. package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts +21 -0
  170. package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts.map +1 -0
  171. package/dist/types/modules/marketing/services/marketing.service.d.ts +1 -0
  172. package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
  173. package/dist/types/modules/marketing/services/product-marketing.service.d.ts +7 -3
  174. package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  175. package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  176. package/package.json +2 -2
@@ -6,9 +6,9 @@ export declare const CreateLimitedTimeOfferConfigSchema: z.ZodObject<{
6
6
  discountOptions: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
7
7
  maxDiscountCaps: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
8
8
  }, "strip", z.ZodTypeAny, {
9
+ campaignType: MarketingType;
9
10
  discountOptions: number[];
10
11
  maxDiscountCaps: number[];
11
- campaignType: MarketingType;
12
12
  }, {
13
13
  campaignType: MarketingType;
14
14
  discountOptions?: number[] | undefined;
@@ -45,9 +45,9 @@ export declare const LimitedTimeOfferConfigSchema: z.ZodObject<{
45
45
  updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
46
46
  }, "strip", z.ZodTypeAny, {
47
47
  _id: import("mongoose").Types.ObjectId;
48
+ campaignType: MarketingType;
48
49
  discountOptions: number[];
49
50
  maxDiscountCaps: number[];
50
- campaignType: MarketingType;
51
51
  createdAt?: Date | null | undefined;
52
52
  updatedAt?: Date | null | undefined;
53
53
  }, {
@@ -197,7 +197,9 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
197
197
  startDate: string | Date;
198
198
  endDate: string | Date;
199
199
  title?: string | undefined;
200
+ campaignType?: import("@lyxa.ai/core/dist/utilities/enum").MarketingType | undefined;
200
201
  subTitle?: string | undefined;
202
+ repeatDays?: number[] | undefined;
201
203
  };
202
204
  output: {
203
205
  message: string;
@@ -212,9 +214,10 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
212
214
  updatedAt?: Date | null | undefined;
213
215
  title?: string | undefined;
214
216
  subTitle?: string | undefined;
215
- archivedAt?: Date | null | undefined;
217
+ repeatDays?: number[] | undefined;
216
218
  discountOptions?: number[] | undefined;
217
219
  maxDiscountCaps?: number[] | undefined;
220
+ archivedAt?: Date | null | undefined;
218
221
  } | {
219
222
  documents: {
220
223
  status: import("@lyxa.ai/core/dist/utilities/enum").LimitedTimeOfferCampaignStatus;
@@ -226,9 +229,10 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
226
229
  updatedAt?: Date | null | undefined;
227
230
  title?: string | undefined;
228
231
  subTitle?: string | undefined;
229
- archivedAt?: Date | null | undefined;
232
+ repeatDays?: number[] | undefined;
230
233
  discountOptions?: number[] | undefined;
231
234
  maxDiscountCaps?: number[] | undefined;
235
+ archivedAt?: Date | null | undefined;
232
236
  }[];
233
237
  metadata?: {
234
238
  page: number;
@@ -255,9 +259,10 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
255
259
  updatedAt?: Date | null | undefined;
256
260
  title?: string | undefined;
257
261
  subTitle?: string | undefined;
258
- archivedAt?: Date | null | undefined;
262
+ repeatDays?: number[] | undefined;
259
263
  discountOptions?: number[] | undefined;
260
264
  maxDiscountCaps?: number[] | undefined;
265
+ archivedAt?: Date | null | undefined;
261
266
  } | {
262
267
  documents: ({
263
268
  status: import("@lyxa.ai/core/dist/utilities/enum").LimitedTimeOfferCampaignStatus;
@@ -269,9 +274,10 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
269
274
  updatedAt?: Date | null | undefined;
270
275
  title?: string | undefined;
271
276
  subTitle?: string | undefined;
272
- archivedAt?: Date | null | undefined;
277
+ repeatDays?: number[] | undefined;
273
278
  discountOptions?: number[] | undefined;
274
279
  maxDiscountCaps?: number[] | undefined;
280
+ archivedAt?: Date | null | undefined;
275
281
  } | null)[];
276
282
  metadata?: {
277
283
  page: number;
@@ -300,9 +306,10 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
300
306
  updatedAt?: Date | null | undefined;
301
307
  title?: string | undefined;
302
308
  subTitle?: string | undefined;
303
- archivedAt?: Date | null | undefined;
309
+ repeatDays?: number[] | undefined;
304
310
  discountOptions?: number[] | undefined;
305
311
  maxDiscountCaps?: number[] | undefined;
312
+ archivedAt?: Date | null | undefined;
306
313
  } | {
307
314
  documents: {
308
315
  status: import("@lyxa.ai/core/dist/utilities/enum").LimitedTimeOfferCampaignStatus;
@@ -314,9 +321,10 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
314
321
  updatedAt?: Date | null | undefined;
315
322
  title?: string | undefined;
316
323
  subTitle?: string | undefined;
317
- archivedAt?: Date | null | undefined;
324
+ repeatDays?: number[] | undefined;
318
325
  discountOptions?: number[] | undefined;
319
326
  maxDiscountCaps?: number[] | undefined;
327
+ archivedAt?: Date | null | undefined;
320
328
  }[];
321
329
  metadata?: {
322
330
  page: number;
@@ -372,6 +380,7 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
372
380
  endDate: string | Date;
373
381
  title?: string | undefined;
374
382
  subTitle?: string | undefined;
383
+ repeatDays?: number[] | undefined;
375
384
  discountOptions?: number[] | undefined;
376
385
  maxDiscountCaps?: number[] | undefined;
377
386
  confirmActive?: boolean | undefined;
@@ -389,9 +398,10 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
389
398
  updatedAt?: Date | null | undefined;
390
399
  title?: string | undefined;
391
400
  subTitle?: string | undefined;
392
- archivedAt?: Date | null | undefined;
401
+ repeatDays?: number[] | undefined;
393
402
  discountOptions?: number[] | undefined;
394
403
  maxDiscountCaps?: number[] | undefined;
404
+ archivedAt?: Date | null | undefined;
395
405
  } | {
396
406
  documents: {
397
407
  status: import("@lyxa.ai/core/dist/utilities/enum").LimitedTimeOfferCampaignStatus;
@@ -403,9 +413,10 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
403
413
  updatedAt?: Date | null | undefined;
404
414
  title?: string | undefined;
405
415
  subTitle?: string | undefined;
406
- archivedAt?: Date | null | undefined;
416
+ repeatDays?: number[] | undefined;
407
417
  discountOptions?: number[] | undefined;
408
418
  maxDiscountCaps?: number[] | undefined;
419
+ archivedAt?: Date | null | undefined;
409
420
  }[];
410
421
  metadata?: {
411
422
  page: number;
@@ -449,6 +460,41 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
449
460
  };
450
461
  meta: object;
451
462
  }>;
463
+ getSessions: import("@trpc/server").TRPCQueryProcedure<{
464
+ input: {
465
+ campaignId: string | import("mongoose").Types.ObjectId;
466
+ page?: number | undefined;
467
+ size?: number | undefined;
468
+ };
469
+ output: {
470
+ message: string;
471
+ success: boolean;
472
+ data?: {
473
+ _id: string | import("mongoose").Types.ObjectId;
474
+ startDate: Date;
475
+ endDate: Date;
476
+ shopCount: number;
477
+ archivedAt: Date;
478
+ campaign: string | import("mongoose").Types.ObjectId;
479
+ } | {
480
+ documents: {
481
+ _id: string | import("mongoose").Types.ObjectId;
482
+ startDate: Date;
483
+ endDate: Date;
484
+ shopCount: number;
485
+ archivedAt: Date;
486
+ campaign: string | import("mongoose").Types.ObjectId;
487
+ }[];
488
+ metadata?: {
489
+ page: number;
490
+ size: number;
491
+ totalElements: number;
492
+ totalPages: number;
493
+ } | undefined;
494
+ } | undefined;
495
+ };
496
+ meta: object;
497
+ }>;
452
498
  cancel: import("@trpc/server").TRPCMutationProcedure<{
453
499
  input: {
454
500
  campaignId: string | import("mongoose").Types.ObjectId;
@@ -653,6 +699,130 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
653
699
  };
654
700
  meta: object;
655
701
  }>;
702
+ enrollShops: import("@trpc/server").TRPCMutationProcedure<{
703
+ input: {
704
+ shops: {
705
+ isEntireMenu: boolean;
706
+ shopId: string | import("mongoose").Types.ObjectId;
707
+ discountPercentage: number;
708
+ maxDiscountCap: number;
709
+ isOrderCapacityEnabled: boolean;
710
+ products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
711
+ maxOrderCapacity?: number | undefined;
712
+ shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
713
+ }[];
714
+ };
715
+ output: {
716
+ message: string;
717
+ success: boolean;
718
+ data?: {
719
+ _id: string | import("mongoose").Types.ObjectId;
720
+ shop: string | import("mongoose").Types.ObjectId;
721
+ isEntireMenu: boolean;
722
+ joinedAt: Date;
723
+ campaign: string | import("mongoose").Types.ObjectId;
724
+ isOrderCapacityEnabled: boolean;
725
+ isWithdrawn: boolean;
726
+ createdAt?: Date | null | undefined;
727
+ updatedAt?: Date | null | undefined;
728
+ products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
729
+ discountPercentage?: number | undefined;
730
+ maxDiscountCap?: number | undefined;
731
+ maxOrderCapacity?: number | undefined;
732
+ withdrawnAt?: Date | null | undefined;
733
+ }[] | {
734
+ documents: {
735
+ _id: string | import("mongoose").Types.ObjectId;
736
+ shop: string | import("mongoose").Types.ObjectId;
737
+ isEntireMenu: boolean;
738
+ joinedAt: Date;
739
+ campaign: string | import("mongoose").Types.ObjectId;
740
+ isOrderCapacityEnabled: boolean;
741
+ isWithdrawn: boolean;
742
+ createdAt?: Date | null | undefined;
743
+ updatedAt?: Date | null | undefined;
744
+ products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
745
+ discountPercentage?: number | undefined;
746
+ maxDiscountCap?: number | undefined;
747
+ maxOrderCapacity?: number | undefined;
748
+ withdrawnAt?: Date | null | undefined;
749
+ }[][];
750
+ metadata?: {
751
+ page: number;
752
+ size: number;
753
+ totalElements: number;
754
+ totalPages: number;
755
+ } | undefined;
756
+ } | undefined;
757
+ };
758
+ meta: object;
759
+ }>;
760
+ updateShop: import("@trpc/server").TRPCMutationProcedure<{
761
+ input: {
762
+ isEntireMenu: boolean;
763
+ shopId: string | import("mongoose").Types.ObjectId;
764
+ discountPercentage: number;
765
+ maxDiscountCap: number;
766
+ isOrderCapacityEnabled: boolean;
767
+ products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
768
+ maxOrderCapacity?: number | undefined;
769
+ shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
770
+ };
771
+ output: {
772
+ message: string;
773
+ success: boolean;
774
+ data?: {
775
+ _id: string | import("mongoose").Types.ObjectId;
776
+ shop: string | import("mongoose").Types.ObjectId;
777
+ isEntireMenu: boolean;
778
+ joinedAt: Date;
779
+ campaign: string | import("mongoose").Types.ObjectId;
780
+ isOrderCapacityEnabled: boolean;
781
+ isWithdrawn: boolean;
782
+ createdAt?: Date | null | undefined;
783
+ updatedAt?: Date | null | undefined;
784
+ products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
785
+ discountPercentage?: number | undefined;
786
+ maxDiscountCap?: number | undefined;
787
+ maxOrderCapacity?: number | undefined;
788
+ withdrawnAt?: Date | null | undefined;
789
+ } | {
790
+ documents: {
791
+ _id: string | import("mongoose").Types.ObjectId;
792
+ shop: string | import("mongoose").Types.ObjectId;
793
+ isEntireMenu: boolean;
794
+ joinedAt: Date;
795
+ campaign: string | import("mongoose").Types.ObjectId;
796
+ isOrderCapacityEnabled: boolean;
797
+ isWithdrawn: boolean;
798
+ createdAt?: Date | null | undefined;
799
+ updatedAt?: Date | null | undefined;
800
+ products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
801
+ discountPercentage?: number | undefined;
802
+ maxDiscountCap?: number | undefined;
803
+ maxOrderCapacity?: number | undefined;
804
+ withdrawnAt?: Date | null | undefined;
805
+ }[];
806
+ metadata?: {
807
+ page: number;
808
+ size: number;
809
+ totalElements: number;
810
+ totalPages: number;
811
+ } | undefined;
812
+ } | undefined;
813
+ };
814
+ meta: object;
815
+ }>;
816
+ withdrawShop: import("@trpc/server").TRPCMutationProcedure<{
817
+ input: {
818
+ shopId: string | import("mongoose").Types.ObjectId;
819
+ };
820
+ output: {
821
+ message: string;
822
+ success: boolean;
823
+ };
824
+ meta: object;
825
+ }>;
656
826
  getParticipants: import("@trpc/server").TRPCQueryProcedure<{
657
827
  input: {
658
828
  campaignId: string | import("mongoose").Types.ObjectId;
@@ -667,17 +837,78 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
667
837
  shopId: string | import("mongoose").Types.ObjectId;
668
838
  joinedAt: Date;
669
839
  shopName: string | null;
840
+ shopPhoto?: string | null | undefined;
670
841
  discountPercentage?: number | undefined;
671
842
  maxDiscountCap?: number | undefined;
672
- shopPhoto?: string | null | undefined;
673
843
  } | {
674
844
  documents: {
675
845
  shopId: string | import("mongoose").Types.ObjectId;
676
846
  joinedAt: Date;
677
847
  shopName: string | null;
848
+ shopPhoto?: string | null | undefined;
678
849
  discountPercentage?: number | undefined;
679
850
  maxDiscountCap?: number | undefined;
680
- shopPhoto?: string | null | undefined;
851
+ }[];
852
+ metadata?: {
853
+ page: number;
854
+ size: number;
855
+ totalElements: number;
856
+ totalPages: number;
857
+ } | undefined;
858
+ } | undefined;
859
+ };
860
+ meta: object;
861
+ }>;
862
+ getParticipantByShop: import("@trpc/server").TRPCQueryProcedure<{
863
+ input: {
864
+ shopId: string | import("mongoose").Types.ObjectId;
865
+ };
866
+ output: {
867
+ message: string;
868
+ success: boolean;
869
+ data?: {
870
+ campaignState: import("./participant/limited-time-offer-participant.validation").LtoCardState;
871
+ campaign?: {
872
+ _id: string | import("mongoose").Types.ObjectId;
873
+ startDate?: Date | null | undefined;
874
+ endDate?: Date | null | undefined;
875
+ title?: string | undefined;
876
+ subTitle?: string | undefined;
877
+ discountOptions?: number[] | undefined;
878
+ maxDiscountCaps?: number[] | undefined;
879
+ } | undefined;
880
+ participant?: {
881
+ isEntireMenu: boolean;
882
+ joinedAt: Date;
883
+ isOrderCapacityEnabled: boolean;
884
+ productIds?: (string | import("mongoose").Types.ObjectId)[] | undefined;
885
+ marketingId?: string | import("mongoose").Types.ObjectId | undefined;
886
+ discountPercentage?: number | undefined;
887
+ maxDiscountCap?: number | undefined;
888
+ maxOrderCapacity?: number | undefined;
889
+ } | undefined;
890
+ } | {
891
+ documents: {
892
+ campaignState: import("./participant/limited-time-offer-participant.validation").LtoCardState;
893
+ campaign?: {
894
+ _id: string | import("mongoose").Types.ObjectId;
895
+ startDate?: Date | null | undefined;
896
+ endDate?: Date | null | undefined;
897
+ title?: string | undefined;
898
+ subTitle?: string | undefined;
899
+ discountOptions?: number[] | undefined;
900
+ maxDiscountCaps?: number[] | undefined;
901
+ } | undefined;
902
+ participant?: {
903
+ isEntireMenu: boolean;
904
+ joinedAt: Date;
905
+ isOrderCapacityEnabled: boolean;
906
+ productIds?: (string | import("mongoose").Types.ObjectId)[] | undefined;
907
+ marketingId?: string | import("mongoose").Types.ObjectId | undefined;
908
+ discountPercentage?: number | undefined;
909
+ maxDiscountCap?: number | undefined;
910
+ maxOrderCapacity?: number | undefined;
911
+ } | undefined;
681
912
  }[];
682
913
  metadata?: {
683
914
  page: number;
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer.router.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.router.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwBjC,CAAC"}
1
+ {"version":3,"file":"limited-time-offer.router.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.router.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwBjC,CAAC"}
@@ -2,9 +2,11 @@ import { mongoose } from '@typegoose/typegoose';
2
2
  import { GetActiveCampaignDTO } from '../limited-time-offer/campaign/limited-time-offer-campaign.validation';
3
3
  export declare class LimitedTimeOfferService {
4
4
  private campaignService;
5
+ private lifecycle;
5
6
  private participantService;
6
7
  private notificationService;
7
8
  constructor();
9
+ activateCampaign(campaignId: mongoose.Types.ObjectId): Promise<void>;
8
10
  getActiveCampaign(input: GetActiveCampaignDTO): Promise<{
9
11
  _id: mongoose.Types.ObjectId;
10
12
  title?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAK9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,6EAA6E,CAAC;AAejH,qBACa,uBAAuB;IAChC,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,kBAAkB,CAAqC;IAC/D,OAAO,CAAC,mBAAmB,CAAsC;;IAQpD,iBAAiB,CAAC,KAAK,EAAE,oBAAoB;;;;;;;IAQ7C,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlE,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAIlF;AAED,eAAO,MAAM,uBAAuB,yBAAyC,CAAC"}
1
+ {"version":3,"file":"limited-time-offer.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAQ9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,6EAA6E,CAAC;AAejH,qBACa,uBAAuB;IAChC,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,kBAAkB,CAAqC;IAC/D,OAAO,CAAC,mBAAmB,CAAsC;;IASpD,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpE,iBAAiB,CAAC,KAAK,EAAE,oBAAoB;;;;;;;IAQ7C,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlE,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAMlF;AAED,eAAO,MAAM,uBAAuB,yBAAyC,CAAC"}
@@ -45,18 +45,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.limitedTimeOfferService = exports.LimitedTimeOfferService = void 0;
46
46
  const typedi_1 = __importStar(require("typedi"));
47
47
  const limited_time_offer_campaign_service_1 = require("../limited-time-offer/campaign/services/limited-time-offer-campaign.service");
48
+ const limited_time_offer_campaign_lifecycle_service_1 = require("../limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service");
48
49
  const limited_time_offer_participant_service_1 = require("../limited-time-offer/participant/services/limited-time-offer-participant.service");
49
50
  const limited_time_offer_notification_service_1 = require("../limited-time-offer/notification/limited-time-offer-notification.service");
50
51
  const limited_time_offer_notification_constants_1 = require("../limited-time-offer/notification/limited-time-offer-notification.constants");
51
52
  let LimitedTimeOfferService = class LimitedTimeOfferService {
52
53
  campaignService;
54
+ lifecycle;
53
55
  participantService;
54
56
  notificationService;
55
57
  constructor() {
56
58
  this.campaignService = limited_time_offer_campaign_service_1.ltoCampaignService;
59
+ this.lifecycle = typedi_1.default.get(limited_time_offer_campaign_lifecycle_service_1.LtoCampaignLifecycleService);
57
60
  this.participantService = limited_time_offer_participant_service_1.ltoParticipantService;
58
61
  this.notificationService = typedi_1.default.get(limited_time_offer_notification_service_1.LimitedTimeOfferNotificationService);
59
62
  }
63
+ async activateCampaign(campaignId) {
64
+ const campaign = await this.campaignService.getById(campaignId);
65
+ await this.lifecycle.activateCampaign(campaignId);
66
+ if ((campaign.repeatDays ?? []).length > 0) {
67
+ await this.participantService.reactivateMarketings(campaign);
68
+ }
69
+ }
60
70
  async getActiveCampaign(input) {
61
71
  const campaign = await this.campaignService.getActive();
62
72
  if (!campaign)
@@ -67,12 +77,14 @@ let LimitedTimeOfferService = class LimitedTimeOfferService {
67
77
  async cancelCampaign(campaignId) {
68
78
  await this.campaignService.cancel(campaignId);
69
79
  const participantIds = await this.participantService.getParticipantIdsByCampaignId(campaignId);
70
- await this.participantService.removeCampaignMarketings(campaignId);
80
+ await this.participantService.cleanupCampaignMarketings(campaignId);
71
81
  await this.notificationService.send(limited_time_offer_notification_constants_1.NotificationType.Cancel, participantIds, { campaignId });
72
82
  }
73
83
  async expireCampaign(campaignId) {
74
- await this.campaignService.expire(campaignId);
75
- await this.participantService.removeCampaignMarketings(campaignId);
84
+ const isRecurring = await this.lifecycle.expireCampaign(campaignId);
85
+ if (!isRecurring) {
86
+ await this.participantService.cleanupCampaignMarketings(campaignId);
87
+ }
76
88
  }
77
89
  };
78
90
  exports.LimitedTimeOfferService = LimitedTimeOfferService;
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,2IAG2F;AAE3F,oJAGiG;AACjG,8IAE0F;AAC1F,kJAAoH;AAQ7G,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IACxB,eAAe,CAAqB;IACpC,kBAAkB,CAAqC;IACvD,mBAAmB,CAAsC;IAEjE;QACI,IAAI,CAAC,eAAe,GAAG,wDAAkB,CAAC;QAC1C,IAAI,CAAC,kBAAkB,GAAG,8DAAqB,CAAC;QAChD,IAAI,CAAC,mBAAmB,GAAG,gBAAS,CAAC,GAAG,CAAC,6EAAmC,CAAC,CAAC;IAClF,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,KAA2B;QACtD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;QACxD,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAE3B,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACxF,OAAO,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAmC;QAC3D,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAA;QAC9F,MAAM,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACnE,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,4DAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,EAAC,UAAU,EAAC,CAAC,CAAA;IAC9F,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAmC;QAC3D,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACvE,CAAC;CACJ,CAAA;AA9BY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,gBAAO,GAAE;;GACG,uBAAuB,CA8BnC;AAEY,QAAA,uBAAuB,GAAG,gBAAS,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {\n ltoCampaignService,\n LtoCampaignService,\n} from '@modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service';\nimport {GetActiveCampaignDTO} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.validation';\nimport {\n LimitedTimeOfferParticipantService,\n ltoParticipantService,\n} from '@modules/limited-time-offer/participant/services/limited-time-offer-participant.service';\nimport {\n LimitedTimeOfferNotificationService\n} from \"@modules/limited-time-offer/notification/limited-time-offer-notification.service\";\nimport {NotificationType} from \"@modules/limited-time-offer/notification/limited-time-offer-notification.constants\";\n\n/**\n * Application/orchestration layer for the Limited Time Offer module. Owns every flow that spans the\n * campaign and participant aggregates so neither domain service has to reach across the boundary.\n * Pure single-aggregate operations stay on their respective domain services.\n */\n@Service()\nexport class LimitedTimeOfferService {\n private campaignService: LtoCampaignService;\n private participantService: LimitedTimeOfferParticipantService;\n private notificationService: LimitedTimeOfferNotificationService;\n\n constructor() {\n this.campaignService = ltoCampaignService;\n this.participantService = ltoParticipantService;\n this.notificationService = Container.get(LimitedTimeOfferNotificationService);\n }\n\n public async getActiveCampaign(input: GetActiveCampaignDTO) {\n const campaign = await this.campaignService.getActive();\n if (!campaign) return null;\n\n const nearbyParticipants = await this.participantService.getNearby(campaign._id, input);\n return nearbyParticipants.length > 0 ? campaign : null;\n }\n\n public async cancelCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.campaignService.cancel(campaignId);\n const participantIds = await this.participantService.getParticipantIdsByCampaignId(campaignId)\n await this.participantService.removeCampaignMarketings(campaignId);\n await this.notificationService.send(NotificationType.Cancel, participantIds, {campaignId})\n }\n\n public async expireCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.campaignService.expire(campaignId);\n await this.participantService.removeCampaignMarketings(campaignId);\n }\n}\n\nexport const limitedTimeOfferService = Container.get(LimitedTimeOfferService);\n"]}
1
+ {"version":3,"file":"limited-time-offer.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,2IAG2F;AAC3F,+JAEqG;AAErG,oJAGiG;AACjG,8IAE0F;AAC1F,kJAAoH;AAQ7G,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IACxB,eAAe,CAAqB;IACpC,SAAS,CAA8B;IACvC,kBAAkB,CAAqC;IACvD,mBAAmB,CAAsC;IAEjE;QACI,IAAI,CAAC,eAAe,GAAG,wDAAkB,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,gBAAS,CAAC,GAAG,CAAC,2EAA2B,CAAC,CAAC;QAC5D,IAAI,CAAC,kBAAkB,GAAG,8DAAqB,CAAC;QAChD,IAAI,CAAC,mBAAmB,GAAG,gBAAS,CAAC,GAAG,CAAC,6EAAmC,CAAC,CAAC;IAClF,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,UAAmC;QAC7D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAChE,MAAM,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,KAA2B;QACtD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;QACxD,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAE3B,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACxF,OAAO,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAmC;QAC3D,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;QAC/F,MAAM,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;QACpE,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,4DAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,EAAC,UAAU,EAAC,CAAC,CAAC;IAC/F,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAmC;QAC3D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;CACJ,CAAA;AA1CY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,gBAAO,GAAE;;GACG,uBAAuB,CA0CnC;AAEY,QAAA,uBAAuB,GAAG,gBAAS,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {\n ltoCampaignService,\n LtoCampaignService,\n} from '@modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service';\nimport {\n LtoCampaignLifecycleService,\n} from '@modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service';\nimport {GetActiveCampaignDTO} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.validation';\nimport {\n LimitedTimeOfferParticipantService,\n ltoParticipantService,\n} from '@modules/limited-time-offer/participant/services/limited-time-offer-participant.service';\nimport {\n LimitedTimeOfferNotificationService\n} from \"@modules/limited-time-offer/notification/limited-time-offer-notification.service\";\nimport {NotificationType} from \"@modules/limited-time-offer/notification/limited-time-offer-notification.constants\";\n\n/**\n * Application/orchestration layer for the Limited Time Offer module. Owns every flow that spans the\n * campaign and participant aggregates so neither domain service has to reach across the boundary.\n * Pure single-aggregate operations stay on their respective domain services.\n */\n@Service()\nexport class LimitedTimeOfferService {\n private campaignService: LtoCampaignService;\n private lifecycle: LtoCampaignLifecycleService;\n private participantService: LimitedTimeOfferParticipantService;\n private notificationService: LimitedTimeOfferNotificationService;\n\n constructor() {\n this.campaignService = ltoCampaignService;\n this.lifecycle = Container.get(LtoCampaignLifecycleService);\n this.participantService = ltoParticipantService;\n this.notificationService = Container.get(LimitedTimeOfferNotificationService);\n }\n\n public async activateCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n const campaign = await this.campaignService.getById(campaignId);\n await this.lifecycle.activateCampaign(campaignId);\n if ((campaign.repeatDays ?? []).length > 0) {\n await this.participantService.reactivateMarketings(campaign);\n }\n }\n\n public async getActiveCampaign(input: GetActiveCampaignDTO) {\n const campaign = await this.campaignService.getActive();\n if (!campaign) return null;\n\n const nearbyParticipants = await this.participantService.getNearby(campaign._id, input);\n return nearbyParticipants.length > 0 ? campaign : null;\n }\n\n public async cancelCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.campaignService.cancel(campaignId);\n const participantIds = await this.participantService.getParticipantIdsByCampaignId(campaignId);\n await this.participantService.cleanupCampaignMarketings(campaignId);\n await this.notificationService.send(NotificationType.Cancel, participantIds, {campaignId});\n }\n\n public async expireCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n const isRecurring = await this.lifecycle.expireCampaign(campaignId);\n if (!isRecurring) {\n await this.participantService.cleanupCampaignMarketings(campaignId);\n }\n }\n}\n\nexport const limitedTimeOfferService = Container.get(LimitedTimeOfferService);\n"]}
@@ -8,7 +8,7 @@ export declare const TARGET_ACCOUNT_TYPES: readonly [NotificationAccountType.SHO
8
8
  export declare const NOTIFICATIONS: {
9
9
  readonly CAMPAIGN_CANCELLED: {
10
10
  readonly title: "Lyxa deleted the current campaign";
11
- readonly body: "The ongoing limited time offer campaign has been deleted by lyxa.";
11
+ readonly body: "The ongoing limited time offer campaign has been deleted by Lyxa.";
12
12
  readonly sound: "notification_sound";
13
13
  };
14
14
  readonly CAMPAIGN_ACTIVATED: {
@@ -14,7 +14,7 @@ const CUSTOM_NOTIFICATION_SOUND = 'notification_sound';
14
14
  exports.NOTIFICATIONS = {
15
15
  CAMPAIGN_CANCELLED: {
16
16
  title: "Lyxa deleted the current campaign",
17
- body: "The ongoing limited time offer campaign has been deleted by lyxa.",
17
+ body: "The ongoing limited time offer campaign has been deleted by Lyxa.",
18
18
  sound: CUSTOM_NOTIFICATION_SOUND
19
19
  },
20
20
  CAMPAIGN_ACTIVATED: {
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer-notification.constants.js","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.constants.ts"],"names":[],"mappings":";;;AAAA,4DAA0E;AAE7D,QAAA,gBAAgB,GAAG;IAC5B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAME,QAAA,oBAAoB,GAAG;IAChC,8BAAuB,CAAC,IAAI;IAC5B,8BAAuB,CAAC,YAAY;CAC9B,CAAC;AAEX,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAE1C,QAAA,aAAa,GAAG;IACzB,kBAAkB,EAAE;QAChB,KAAK,EAAE,mCAAmC;QAC1C,IAAI,EAAE,mEAAmE;QACzE,KAAK,EAAE,yBAAyB;KACnC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,6BAA6B;QACpC,IAAI,EAAE,yDAAyD;QAC/D,KAAK,EAAE,yBAAyB;KACnC;CACK,CAAC","sourcesContent":["import {NotificationAccountType} from \"@lyxa.ai/core/dist/utilities/enum\";\n\nexport const NotificationType = {\n Cancel: \"cancel\",\n Activate: \"activate\",\n} as const;\n\nexport type NotificationType =\n (typeof NotificationType)[keyof typeof NotificationType];\n\n\nexport const TARGET_ACCOUNT_TYPES = [\n NotificationAccountType.SHOP,\n NotificationAccountType.SHOP_CONSOLE,\n] as const;\n\nconst CUSTOM_NOTIFICATION_SOUND = 'notification_sound';\n\nexport const NOTIFICATIONS = {\n CAMPAIGN_CANCELLED: {\n title: \"Lyxa deleted the current campaign\",\n body: \"The ongoing limited time offer campaign has been deleted by lyxa.\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n CAMPAIGN_ACTIVATED: {\n title: \"Limited Time Offer is Live!\",\n body: \"A new limited time offer has started. Check it out now!\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n} as const;"]}
1
+ {"version":3,"file":"limited-time-offer-notification.constants.js","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.constants.ts"],"names":[],"mappings":";;;AAAA,4DAA0E;AAE7D,QAAA,gBAAgB,GAAG;IAC5B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAME,QAAA,oBAAoB,GAAG;IAChC,8BAAuB,CAAC,IAAI;IAC5B,8BAAuB,CAAC,YAAY;CAC9B,CAAC;AAEX,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAE1C,QAAA,aAAa,GAAG;IACzB,kBAAkB,EAAE;QAChB,KAAK,EAAE,mCAAmC;QAC1C,IAAI,EAAE,mEAAmE;QACzE,KAAK,EAAE,yBAAyB;KACnC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,6BAA6B;QACpC,IAAI,EAAE,yDAAyD;QAC/D,KAAK,EAAE,yBAAyB;KACnC;CACK,CAAC","sourcesContent":["import {NotificationAccountType} from \"@lyxa.ai/core/dist/utilities/enum\";\n\nexport const NotificationType = {\n Cancel: \"cancel\",\n Activate: \"activate\",\n} as const;\n\nexport type NotificationType =\n (typeof NotificationType)[keyof typeof NotificationType];\n\n\nexport const TARGET_ACCOUNT_TYPES = [\n NotificationAccountType.SHOP,\n NotificationAccountType.SHOP_CONSOLE,\n] as const;\n\nconst CUSTOM_NOTIFICATION_SOUND = 'notification_sound';\n\nexport const NOTIFICATIONS = {\n CAMPAIGN_CANCELLED: {\n title: \"Lyxa deleted the current campaign\",\n body: \"The ongoing limited time offer campaign has been deleted by Lyxa.\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n CAMPAIGN_ACTIVATED: {\n title: \"Limited Time Offer is Live!\",\n body: \"A new limited time offer has started. Check it out now!\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n} as const;"]}
@@ -1,6 +1,6 @@
1
1
  import { mongoose } from '@typegoose/typegoose';
2
2
  import { LimitedTimeOfferCampaign } from '@lyxa.ai/core/dist/libraries/mongo/models';
3
- import { MarketingStatus, MarketingType, ValueType } from '@lyxa.ai/core/dist/utilities/enum';
3
+ import { MarketingCampaignType, MarketingStatus, MarketingType, ValueType } from '@lyxa.ai/core/dist/utilities/enum';
4
4
  import { GetLtoCampaignParticipantsDTO } from '../campaign/limited-time-offer-campaign.validation';
5
5
  import { JoinLtoCampaignDTO } from './limited-time-offer-participant.validation';
6
6
  export declare class LtoParticipantQueryBuilder {
@@ -9,7 +9,13 @@ export declare class LtoParticipantQueryBuilder {
9
9
  isWithdrawn: boolean;
10
10
  };
11
11
  static buildSearchTerm(dto: GetLtoCampaignParticipantsDTO): string | undefined;
12
- static buildCreateInput(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId, marketingId: mongoose.Types.ObjectId, dto: JoinLtoCampaignDTO): {
12
+ static buildCreateInput(input: {
13
+ campaignId: mongoose.Types.ObjectId;
14
+ shopId: mongoose.Types.ObjectId;
15
+ marketingId: mongoose.Types.ObjectId;
16
+ dto: JoinLtoCampaignDTO;
17
+ pausedMarketings?: mongoose.Types.ObjectId[];
18
+ }): {
13
19
  campaign: mongoose.Types.ObjectId;
14
20
  shop: mongoose.Types.ObjectId;
15
21
  marketing: mongoose.Types.ObjectId;
@@ -21,12 +27,14 @@ export declare class LtoParticipantQueryBuilder {
21
27
  isOrderCapacityEnabled: boolean;
22
28
  maxOrderCapacity: number | undefined;
23
29
  isWithdrawn: boolean;
30
+ pausedMarketings: mongoose.Types.ObjectId[];
24
31
  };
25
32
  static buildMarketingInput(shopId: mongoose.Types.ObjectId, campaign: LimitedTimeOfferCampaign & {
26
33
  _id: mongoose.Types.ObjectId;
27
34
  }, dto: JoinLtoCampaignDTO): {
28
35
  shop: mongoose.Types.ObjectId;
29
36
  marketingType: MarketingType;
37
+ campaignType: MarketingCampaignType;
30
38
  isAppliedByCompany: boolean;
31
39
  duration: {
32
40
  start: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer-participant.builder.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,wBAAwB,EAAC,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAC,eAAe,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5F,OAAO,EAAC,6BAA6B,EAAC,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAC,kBAAkB,EAAC,MAAM,6CAA6C,CAAC;AAE/E,qBAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,6BAA6B;;;;IAI7D,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,6BAA6B,GAAG,MAAM,GAAG,SAAS;IAI9E,MAAM,CAAC,gBAAgB,CACnB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACpC,GAAG,EAAE,kBAAkB;;;;;;;;;;;;;IAiB3B,MAAM,CAAC,mBAAmB,CACtB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,QAAQ,EAAE,wBAAwB,GAAG;QAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAA;KAAC,EACnE,GAAG,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;CA2B9B"}
1
+ {"version":3,"file":"limited-time-offer-participant.builder.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,wBAAwB,EAAC,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAC,qBAAqB,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACnH,OAAO,EAAC,6BAA6B,EAAC,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAC,kBAAkB,EAAC,MAAM,6CAA6C,CAAC;AAE/E,qBAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,6BAA6B;;;;IAI7D,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,6BAA6B,GAAG,MAAM,GAAG,SAAS;IAI9E,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE;QAC3B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QACpC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QAChC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QACrC,GAAG,EAAE,kBAAkB,CAAC;QACxB,gBAAgB,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;KAChD;;;;;;;;;;;;;;IAkBD,MAAM,CAAC,mBAAmB,CACtB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,QAAQ,EAAE,wBAAwB,GAAG;QAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAA;KAAC,EACnE,GAAG,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B9B"}
@@ -9,7 +9,8 @@ class LtoParticipantQueryBuilder {
9
9
  static buildSearchTerm(dto) {
10
10
  return dto.search?.trim() || undefined;
11
11
  }
12
- static buildCreateInput(campaignId, shopId, marketingId, dto) {
12
+ static buildCreateInput(input) {
13
+ const { campaignId, shopId, marketingId, dto, pausedMarketings = [] } = input;
13
14
  return {
14
15
  campaign: campaignId,
15
16
  shop: shopId,
@@ -22,12 +23,14 @@ class LtoParticipantQueryBuilder {
22
23
  isOrderCapacityEnabled: dto.isOrderCapacityEnabled,
23
24
  maxOrderCapacity: dto.maxOrderCapacity,
24
25
  isWithdrawn: false,
26
+ pausedMarketings,
25
27
  };
26
28
  }
27
29
  static buildMarketingInput(shopId, campaign, dto) {
28
30
  return {
29
31
  shop: shopId,
30
32
  marketingType: enum_1.MarketingType.DISCOUNT,
33
+ campaignType: enum_1.MarketingCampaignType.LIMITED_TIME_OFFER,
31
34
  isAppliedByCompany: false,
32
35
  duration: { start: campaign.startDate, end: campaign.endDate },
33
36
  status: enum_1.MarketingStatus.ACTIVE,
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer-participant.builder.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":";;;AAEA,4DAA4F;AAI5F,MAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAkC;QACzD,OAAO,EAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,GAAkC;QACrD,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,gBAAgB,CACnB,UAAmC,EACnC,MAA+B,EAC/B,WAAoC,EACpC,GAAuB;QAEvB,OAAO;YACH,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,IAAI,IAAI,EAAE;YACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;YAC5B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;YAC1C,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;YAClD,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,WAAW,EAAE,KAAK;SACrB,CAAC;IACN,CAAC;IAED,MAAM,CAAC,mBAAmB,CACtB,MAA+B,EAC/B,QAAmE,EACnE,GAAuB;QAEvB,OAAO;YACH,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,oBAAa,CAAC,QAAQ;YACrC,kBAAkB,EAAE,KAAK;YACzB,QAAQ,EAAE,EAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAC;YAC5D,MAAM,EAAE,sBAAe,CAAC,MAAM;YAC9B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;YAC5D,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAS,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;YAC9D,QAAQ,EAAE,GAAG,CAAC,YAAY;gBACtB,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;oBAC7B,OAAO,EAAE,SAAS;oBAClB,KAAK,EAAE,GAAG,CAAC,kBAAkB;oBAC7B,SAAS,EAAE,gBAAS,CAAC,UAAU;iBAClC,CAAC,CAAC;YACP,mBAAmB,EAAE,GAAG,CAAC,cAAc;YACvC,4BAA4B,EAAE,GAAG,CAAC,cAAc,GAAG,CAAC;YACpD,UAAU,EAAE,EAAE;YACd,eAAe,EAAE,EAAE;YACnB,UAAU,EAAE,CAAC;YACb,mBAAmB,EAAE,KAAK;YAC1B,mBAAmB,EAAE,KAAK;SAC7B,CAAC;IACN,CAAC;CACJ;AA5DD,gEA4DC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaign} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {MarketingStatus, MarketingType, ValueType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {GetLtoCampaignParticipantsDTO} from '../campaign/limited-time-offer-campaign.validation';\nimport {JoinLtoCampaignDTO} from './limited-time-offer-participant.validation';\n\nexport class LtoParticipantQueryBuilder {\n static buildCampaignFilter(dto: GetLtoCampaignParticipantsDTO) {\n return {campaign: dto.campaignId, isWithdrawn: false};\n }\n\n static buildSearchTerm(dto: GetLtoCampaignParticipantsDTO): string | undefined {\n return dto.search?.trim() || undefined;\n }\n\n static buildCreateInput(\n campaignId: mongoose.Types.ObjectId,\n shopId: mongoose.Types.ObjectId,\n marketingId: mongoose.Types.ObjectId,\n dto: JoinLtoCampaignDTO,\n ) {\n return {\n campaign: campaignId,\n shop: shopId,\n marketing: marketingId,\n joinedAt: new Date(),\n products: dto.products ?? [],\n isEntireMenu: dto.isEntireMenu,\n discountPercentage: dto.discountPercentage,\n maxDiscountCap: dto.maxDiscountCap,\n isOrderCapacityEnabled: dto.isOrderCapacityEnabled,\n maxOrderCapacity: dto.maxOrderCapacity,\n isWithdrawn: false,\n };\n }\n\n static buildMarketingInput(\n shopId: mongoose.Types.ObjectId,\n campaign: LimitedTimeOfferCampaign & {_id: mongoose.Types.ObjectId},\n dto: JoinLtoCampaignDTO,\n ) {\n return {\n shop: shopId,\n marketingType: MarketingType.DISCOUNT,\n isAppliedByCompany: false,\n duration: {start: campaign.startDate, end: campaign.endDate},\n status: MarketingStatus.ACTIVE,\n isEntireMenu: dto.isEntireMenu,\n value: dto.isEntireMenu ? dto.discountPercentage : undefined,\n valueType: dto.isEntireMenu ? ValueType.PERCENTAGE : undefined,\n products: dto.isEntireMenu\n ? []\n : dto.products.map(productId => ({\n product: productId,\n value: dto.discountPercentage,\n valueType: ValueType.PERCENTAGE,\n })),\n maxDiscountPerOrder: dto.maxDiscountCap,\n isMaxDiscountPerOrderEnabled: dto.maxDiscountCap > 0,\n categories: [],\n excludeProducts: [],\n spendLimit: 0,\n isSpendLimitEnabled: false,\n isOnlyForSubscriber: false,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"limited-time-offer-participant.builder.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":";;;AAEA,4DAAmH;AAInH,MAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAkC;QACzD,OAAO,EAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,GAAkC;QACrD,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,KAMvB;QACG,MAAM,EAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,gBAAgB,GAAG,EAAE,EAAC,GAAG,KAAK,CAAC;QAC5E,OAAO;YACH,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,IAAI,IAAI,EAAE;YACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;YAC5B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;YAC1C,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;YAClD,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,WAAW,EAAE,KAAK;YAClB,gBAAgB;SACnB,CAAC;IACN,CAAC;IAED,MAAM,CAAC,mBAAmB,CACtB,MAA+B,EAC/B,QAAmE,EACnE,GAAuB;QAEvB,OAAO;YACH,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,oBAAa,CAAC,QAAQ;YACrC,YAAY,EAAE,4BAAqB,CAAC,kBAAkB;YACtD,kBAAkB,EAAE,KAAK;YACzB,QAAQ,EAAE,EAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAC;YAC5D,MAAM,EAAE,sBAAe,CAAC,MAAM;YAC9B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;YAC5D,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAS,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;YAC9D,QAAQ,EAAE,GAAG,CAAC,YAAY;gBACtB,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;oBAC7B,OAAO,EAAE,SAAS;oBAClB,KAAK,EAAE,GAAG,CAAC,kBAAkB;oBAC7B,SAAS,EAAE,gBAAS,CAAC,UAAU;iBAClC,CAAC,CAAC;YACP,mBAAmB,EAAE,GAAG,CAAC,cAAc;YACvC,4BAA4B,EAAE,GAAG,CAAC,cAAc,GAAG,CAAC;YACpD,UAAU,EAAE,EAAE;YACd,eAAe,EAAE,EAAE;YACnB,UAAU,EAAE,CAAC;YACb,mBAAmB,EAAE,KAAK;YAC1B,mBAAmB,EAAE,KAAK;SAC7B,CAAC;IACN,CAAC;CACJ;AAhED,gEAgEC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaign} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {MarketingCampaignType, MarketingStatus, MarketingType, ValueType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {GetLtoCampaignParticipantsDTO} from '../campaign/limited-time-offer-campaign.validation';\nimport {JoinLtoCampaignDTO} from './limited-time-offer-participant.validation';\n\nexport class LtoParticipantQueryBuilder {\n static buildCampaignFilter(dto: GetLtoCampaignParticipantsDTO) {\n return {campaign: dto.campaignId, isWithdrawn: false};\n }\n\n static buildSearchTerm(dto: GetLtoCampaignParticipantsDTO): string | undefined {\n return dto.search?.trim() || undefined;\n }\n\n static buildCreateInput(input: {\n campaignId: mongoose.Types.ObjectId;\n shopId: mongoose.Types.ObjectId;\n marketingId: mongoose.Types.ObjectId;\n dto: JoinLtoCampaignDTO;\n pausedMarketings?: mongoose.Types.ObjectId[];\n }) {\n const {campaignId, shopId, marketingId, dto, pausedMarketings = []} = input;\n return {\n campaign: campaignId,\n shop: shopId,\n marketing: marketingId,\n joinedAt: new Date(),\n products: dto.products ?? [],\n isEntireMenu: dto.isEntireMenu,\n discountPercentage: dto.discountPercentage,\n maxDiscountCap: dto.maxDiscountCap,\n isOrderCapacityEnabled: dto.isOrderCapacityEnabled,\n maxOrderCapacity: dto.maxOrderCapacity,\n isWithdrawn: false,\n pausedMarketings,\n };\n }\n\n static buildMarketingInput(\n shopId: mongoose.Types.ObjectId,\n campaign: LimitedTimeOfferCampaign & {_id: mongoose.Types.ObjectId},\n dto: JoinLtoCampaignDTO,\n ) {\n return {\n shop: shopId,\n marketingType: MarketingType.DISCOUNT,\n campaignType: MarketingCampaignType.LIMITED_TIME_OFFER,\n isAppliedByCompany: false,\n duration: {start: campaign.startDate, end: campaign.endDate},\n status: MarketingStatus.ACTIVE,\n isEntireMenu: dto.isEntireMenu,\n value: dto.isEntireMenu ? dto.discountPercentage : undefined,\n valueType: dto.isEntireMenu ? ValueType.PERCENTAGE : undefined,\n products: dto.isEntireMenu\n ? []\n : dto.products.map(productId => ({\n product: productId,\n value: dto.discountPercentage,\n valueType: ValueType.PERCENTAGE,\n })),\n maxDiscountPerOrder: dto.maxDiscountCap,\n isMaxDiscountPerOrderEnabled: dto.maxDiscountCap > 0,\n categories: [],\n excludeProducts: [],\n spendLimit: 0,\n isSpendLimitEnabled: false,\n isOnlyForSubscriber: false,\n };\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { DocumentType, mongoose } from '@typegoose/typegoose';
2
2
  import { LimitedTimeOfferParticipant as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';
3
+ import { MarketingStatus, MarketingType } from '@lyxa.ai/core/dist/utilities/enum';
3
4
  import { GetLtoCampaignParticipantsDTO, LtoCampaignParticipantItemDTO } from '../campaign/limited-time-offer-campaign.validation';
4
5
  import { ActiveParticipantMarketingDTO, ParticipantSummaryDTO, UpdateParticipantDataDTO } from './limited-time-offer-participant.validation';
5
6
  export declare class LtoParticipantRepository {
@@ -24,6 +25,15 @@ export declare class LtoParticipantRepository {
24
25
  countShopProducts(shopId: mongoose.Types.ObjectId, productIds: mongoose.Types.ObjectId[]): Promise<number>;
25
26
  findProductIdsByCategories(shopId: mongoose.Types.ObjectId, categoryIds: mongoose.Types.ObjectId[]): Promise<mongoose.Types.ObjectId[]>;
26
27
  findMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
28
+ countNonWithdrawnByCampaign(campaignId: mongoose.Types.ObjectId): Promise<number>;
29
+ findAllActiveByCampaign(campaignId: mongoose.Types.ObjectId): Promise<DocumentType<Model>[]>;
30
+ findPausedMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
31
+ findActiveMarketingIdsByShop(shopId: mongoose.Types.ObjectId, marketingType: MarketingType): Promise<mongoose.Types.ObjectId[]>;
32
+ findRevivableMarketings(ids: mongoose.Types.ObjectId[]): Promise<Array<{
33
+ _id: mongoose.Types.ObjectId;
34
+ shop: mongoose.Types.ObjectId;
35
+ }>>;
36
+ updateMarketingStatus(ids: mongoose.Types.ObjectId[], status: MarketingStatus): Promise<void>;
27
37
  findParticipantIdsByCampaignId(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
28
38
  findByCampaign(dto: GetLtoCampaignParticipantsDTO): Promise<{
29
39
  documents: LtoCampaignParticipantItemDTO[];