@lyxa.ai/marketing 1.0.37 → 1.0.40

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 (59) hide show
  1. package/dist/lib/index.d.ts +87 -7
  2. package/dist/lib/index.d.ts.map +1 -1
  3. package/dist/lib/modules/coupon/services/coupon.service.d.ts +3 -0
  4. package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
  5. package/dist/lib/modules/coupon/services/coupon.service.js +122 -5
  6. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  7. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  8. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +7 -0
  9. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
  10. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  11. package/dist/lib/modules/coupon/validations/coupon.validation.js +5 -14
  12. package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
  13. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +39 -0
  14. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -0
  15. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js +539 -0
  16. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js.map +1 -0
  17. package/dist/lib/modules/marketing/routers/marketing.router.d.ts +87 -7
  18. package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  19. package/dist/lib/modules/marketing/routers/marketing.router.js +27 -8
  20. package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
  21. package/dist/lib/modules/marketing/services/marketing.service.d.ts +4 -8
  22. package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
  23. package/dist/lib/modules/marketing/services/marketing.service.js +65 -355
  24. package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
  25. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +1 -0
  26. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  27. package/dist/lib/modules/marketing/services/product-marketing.service.js +4 -0
  28. package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
  29. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +106 -1
  30. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
  31. package/dist/lib/modules/marketing/validations/marketing.validation.js +31 -1
  32. package/dist/lib/modules/marketing/validations/marketing.validation.js.map +1 -1
  33. package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
  34. package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js +19 -1
  35. package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js.map +1 -1
  36. package/dist/lib/utility/utils.d.ts +3 -0
  37. package/dist/lib/utility/utils.d.ts.map +1 -0
  38. package/dist/lib/utility/utils.js +31 -0
  39. package/dist/lib/utility/utils.js.map +1 -0
  40. package/dist/types/index.d.ts +87 -7
  41. package/dist/types/index.d.ts.map +1 -1
  42. package/dist/types/modules/coupon/services/coupon.service.d.ts +3 -0
  43. package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
  44. package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  45. package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  46. package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +39 -0
  47. package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -0
  48. package/dist/types/modules/marketing/routers/marketing.router.d.ts +87 -7
  49. package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  50. package/dist/types/modules/marketing/services/marketing.service.d.ts +4 -8
  51. package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
  52. package/dist/types/modules/marketing/services/product-marketing.service.d.ts +1 -0
  53. package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  54. package/dist/types/modules/marketing/validations/marketing.validation.d.ts +106 -1
  55. package/dist/types/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
  56. package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
  57. package/dist/types/utility/utils.d.ts +15 -0
  58. package/dist/types/utility/utils.d.ts.map +1 -0
  59. package/package.json +2 -2
@@ -678,18 +678,19 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
678
678
  output: string;
679
679
  meta: object;
680
680
  }>;
681
- evaluateMarketingSpendLimits: import("@trpc/server").TRPCMutationProcedure<{
682
- input: {
683
- marketings: (string | import("mongoose").Types.ObjectId)[];
684
- };
681
+ calculateMarketingSpent: import("@trpc/server").TRPCMutationProcedure<{
682
+ input: string | import("mongoose").Types.ObjectId;
685
683
  output: {
686
684
  success: boolean;
687
685
  message: string;
688
- data: unknown;
686
+ data: {
687
+ amount: number;
688
+ marketingType: import("@lyxa.ai/core/dist/utilities/enum").MarketingType;
689
+ } | undefined;
689
690
  };
690
691
  meta: object;
691
692
  }>;
692
- calculateMarketingSpent: import("@trpc/server").TRPCMutationProcedure<{
693
+ incrementMarketingSpentFromOrder: import("@trpc/server").TRPCMutationProcedure<{
693
694
  input: string | import("mongoose").Types.ObjectId;
694
695
  output: {
695
696
  success: boolean;
@@ -698,7 +699,7 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
698
699
  };
699
700
  meta: object;
700
701
  }>;
701
- incrementMarketingSpentFromOrder: import("@trpc/server").TRPCMutationProcedure<{
702
+ decrementMarketingSpentFromOrder: import("@trpc/server").TRPCMutationProcedure<{
702
703
  input: string | import("mongoose").Types.ObjectId;
703
704
  output: {
704
705
  success: boolean;
@@ -707,6 +708,85 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
707
708
  };
708
709
  meta: object;
709
710
  }>;
711
+ recomputeAndSyncAllMarketingSpent: import("@trpc/server").TRPCMutationProcedure<{
712
+ input: void;
713
+ output: {
714
+ success: boolean;
715
+ message: string;
716
+ data: void | undefined;
717
+ };
718
+ meta: object;
719
+ }>;
720
+ getMetrics: import("@trpc/server").TRPCQueryProcedure<{
721
+ input: string | import("mongoose").Types.ObjectId;
722
+ output: {
723
+ success: boolean;
724
+ message: string;
725
+ data: {
726
+ numberOfItems?: number | undefined;
727
+ orderIncreaseWithDiscount?: {
728
+ count: number;
729
+ percentageIncrease: number;
730
+ } | undefined;
731
+ customerIncreaseWithDiscount?: {
732
+ count: number;
733
+ percentageIncrease: number;
734
+ } | undefined;
735
+ } | undefined;
736
+ };
737
+ meta: object;
738
+ }>;
739
+ getOrdersGraph: import("@trpc/server").TRPCQueryProcedure<{
740
+ input: {
741
+ startDate: string | Date;
742
+ marketingId: string | import("mongoose").Types.ObjectId;
743
+ endDate: string | Date;
744
+ type?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
745
+ };
746
+ output: {
747
+ success: boolean;
748
+ message: string;
749
+ data: {
750
+ date: string;
751
+ orders: number;
752
+ }[] | undefined;
753
+ };
754
+ meta: object;
755
+ }>;
756
+ getCustomersGraph: import("@trpc/server").TRPCQueryProcedure<{
757
+ input: {
758
+ startDate: string | Date;
759
+ marketingId: string | import("mongoose").Types.ObjectId;
760
+ endDate: string | Date;
761
+ type?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
762
+ };
763
+ output: {
764
+ success: boolean;
765
+ message: string;
766
+ data: {
767
+ date: string;
768
+ users: number;
769
+ }[] | undefined;
770
+ };
771
+ meta: object;
772
+ }>;
773
+ getAmountSpentGraph: import("@trpc/server").TRPCQueryProcedure<{
774
+ input: {
775
+ startDate: string | Date;
776
+ marketingId: string | import("mongoose").Types.ObjectId;
777
+ endDate: string | Date;
778
+ type?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
779
+ };
780
+ output: {
781
+ success: boolean;
782
+ message: string;
783
+ data: {
784
+ date: string;
785
+ amount: number;
786
+ }[] | undefined;
787
+ };
788
+ meta: object;
789
+ }>;
710
790
  }>>;
711
791
  couponRouter: import("@trpc/server").TRPCBuiltRouter<{
712
792
  ctx: import("@lyxa.ai/core/dist/libraries/trpc/context").LyxaHTTPContext;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAeD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAR/B,CAAC;AAoCH,MAAM,MAAM,2BAA2B,GAAG,OAAO,2BAA2B,CAAC"}
@@ -15,6 +15,7 @@ export declare class CouponService {
15
15
  private punchHistoryService;
16
16
  private _coreUserModel;
17
17
  private couponHelper;
18
+ private readonly referralSettingsModel;
18
19
  constructor();
19
20
  private get coreUserModel();
20
21
  create(data: AllCouponsValidationDTO): Promise<DocumentType<Model>>;
@@ -51,9 +52,11 @@ export declare class CouponService {
51
52
  getUserCouponList(data?: Partial<FilterDTO>): Promise<PaginatedResponse<AllCouponsDTO>>;
52
53
  addExistingCouponsToNewUser(userId: mongoose.Types.ObjectId): Promise<void>;
53
54
  getActiveNewUserCoupon(): Promise<DocumentType<BaseCoupon> | null>;
55
+ getActiveNewUserCouponWithSecondaryCurrency(): Promise<DocumentType<BaseCoupon> | null>;
54
56
  checkExistingNewUserCoupon(): Promise<CheckExistingNewUserCouponOutputDTO>;
55
57
  private getAllOrders;
56
58
  handleCouponGiftBox(deviceId: string, userId: mongoose.Types.ObjectId | null): Promise<DocumentType<GlobalCoupon>[]>;
59
+ private updateNewUserCouponField;
57
60
  updateCouponGiftBoxShown(userId: mongoose.Types.ObjectId, data: any): Promise<number>;
58
61
  }
59
62
  export declare const couponService: CouponService;
@@ -1 +1 @@
1
- {"version":3,"file":"coupon.service.d.ts","sourceRoot":"/","sources":["modules/coupon/services/coupon.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAgC,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAKN,YAAY,EAGZ,MAAM,IAAI,KAAK,EAWf,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,mCAAmC,EACnC,MAAM,6BAA6B,C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C,QAAQ,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;CAyBlG;AAED,eAAO,MAAM,aAAa,eAA+B,CAAC"}
@@ -58,6 +58,9 @@ const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
58
58
  const shops_categories_coupon_service_1 = require("./shops-categories-coupon.service");
59
59
  const helper_service_1 = require("./helper.service");
60
60
  const dayjs_1 = require("@lyxa.ai/core/dist/utilities/dayjs");
61
+ const currency_1 = require("@lyxa.ai/core/dist/utilities/currency");
62
+ const shared_1 = require("@lyxa.ai/core/dist/utilities/shared");
63
+ const common_pipeline_functions_1 = require("@lyxa.ai/core/dist/utilities/pipelines/common-pipeline-functions");
61
64
  let CouponService = class CouponService {
62
65
  model;
63
66
  baseCouponModel;
@@ -68,6 +71,7 @@ let CouponService = class CouponService {
68
71
  punchHistoryService;
69
72
  _coreUserModel = null;
70
73
  couponHelper;
74
+ referralSettingsModel;
71
75
  constructor() {
72
76
  this.model = models_1.CouponModel;
73
77
  this.baseCouponModel = models_2.BaseCouponModel;
@@ -77,6 +81,7 @@ let CouponService = class CouponService {
77
81
  this.referralRewardModel = models_1.ReferralRewardCouponModel;
78
82
  this.punchHistoryService = services_1.punchMarketingHistoryService;
79
83
  this.couponHelper = helper_service_1.couponHelperService;
84
+ this.referralSettingsModel = models_1.ReferralSettingModel;
80
85
  }
81
86
  get coreUserModel() {
82
87
  if (!this._coreUserModel) {
@@ -957,6 +962,98 @@ let CouponService = class CouponService {
957
962
  });
958
963
  return activeForNewUserCoupon;
959
964
  }
965
+ async getActiveNewUserCouponWithSecondaryCurrency() {
966
+ const exchangeRate = await (0, currency_1.getExchangeRate)();
967
+ const currentDate = (0, dayjs_1.dayjs)().toDate();
968
+ const referralSettings = await this.referralSettingsModel.findOne();
969
+ const secondaryReferralReceiverValue = referralSettings?.receiver?.valueType == enum_1.ValueType.PERCENTAGE
970
+ ? null
971
+ : (0, shared_1.roundSecondaryCurrency)((referralSettings?.receiver?.value ?? 0) * exchangeRate);
972
+ const secondaryReferralReceiverMinOrderAmount = (0, shared_1.roundSecondaryCurrency)((referralSettings?.receiver?.minimumOrderValue ?? 0) * exchangeRate);
973
+ const activeForNewUserCoupon = await this.baseCouponModel.aggregate([
974
+ {
975
+ $match: {
976
+ couponType: enum_1.CouponType.GLOBAL,
977
+ forNewUserOnly: true,
978
+ deletedAt: null,
979
+ $or: [
980
+ { expirationReason: { $exists: false } },
981
+ { expirationReason: null },
982
+ ],
983
+ 'duration.end': { $gte: currentDate },
984
+ updatedVersion: { $exists: false },
985
+ },
986
+ },
987
+ {
988
+ $addFields: {
989
+ 'secondaryCurrencyValue': {
990
+ $cond: [
991
+ {
992
+ $eq: ['$valueType', enum_1.ValueType.PERCENTAGE],
993
+ },
994
+ null,
995
+ {
996
+ $switch: {
997
+ branches: [
998
+ {
999
+ case: {
1000
+ $eq: [
1001
+ '$couponType',
1002
+ enum_1.CouponType.REFERRAL_CODE,
1003
+ ],
1004
+ },
1005
+ then: secondaryReferralReceiverValue,
1006
+ },
1007
+ ],
1008
+ default: (0, common_pipeline_functions_1.getRoundSecondaryCurrencyStage)({
1009
+ $multiply: ['$value', exchangeRate],
1010
+ }),
1011
+ },
1012
+ },
1013
+ ],
1014
+ },
1015
+ 'secondaryCurrencyMaxDiscountLimit': {
1016
+ $switch: {
1017
+ branches: [
1018
+ {
1019
+ case: {
1020
+ $eq: [
1021
+ '$couponType',
1022
+ enum_1.CouponType.REFERRAL_CODE,
1023
+ ],
1024
+ },
1025
+ then: null,
1026
+ },
1027
+ ],
1028
+ default: (0, common_pipeline_functions_1.getRoundSecondaryCurrencyStage)({
1029
+ $multiply: ['$maxDiscountLimit', exchangeRate],
1030
+ }),
1031
+ },
1032
+ },
1033
+ 'secondaryCurrencyMinOrderValue': {
1034
+ $switch: {
1035
+ branches: [
1036
+ {
1037
+ case: {
1038
+ $eq: [
1039
+ '$couponType',
1040
+ enum_1.CouponType.REFERRAL_CODE,
1041
+ ],
1042
+ },
1043
+ then: secondaryReferralReceiverMinOrderAmount,
1044
+ },
1045
+ ],
1046
+ default: (0, common_pipeline_functions_1.getRoundSecondaryCurrencyStage)({
1047
+ $multiply: ['$minOrderValue', exchangeRate],
1048
+ }),
1049
+ },
1050
+ },
1051
+ }
1052
+ },
1053
+ { $limit: 1 },
1054
+ ]);
1055
+ return activeForNewUserCoupon[0] || null;
1056
+ }
960
1057
  async checkExistingNewUserCoupon() {
961
1058
  const alreadyActiveForNewUserCoupon = await this.getActiveNewUserCoupon();
962
1059
  if (alreadyActiveForNewUserCoupon) {
@@ -978,20 +1075,40 @@ let CouponService = class CouponService {
978
1075
  if (userId) {
979
1076
  userIds.push(new typegoose_1.mongoose.Types.ObjectId(userId));
980
1077
  }
1078
+ const hasShownCoupon = await this.userModel.exists({
1079
+ _id: { $in: userIds },
1080
+ isNewUserCouponShowed: true,
1081
+ });
1082
+ if (hasShownCoupon) {
1083
+ return [];
1084
+ }
981
1085
  const totalOrders = await this.getAllOrders(userIds);
982
- const activeNewUserCoupon = await this.getActiveNewUserCoupon();
1086
+ const activeNewUserCoupon = await this.getActiveNewUserCouponWithSecondaryCurrency();
983
1087
  if (!activeNewUserCoupon) {
984
- (0, error_common_1.notFoundError)('No active new user coupon found');
1088
+ return [];
985
1089
  }
986
1090
  if (activeNewUserCoupon.isOrderLimitPerUserEnabled &&
987
1091
  totalOrders < (activeNewUserCoupon.orderLimitPerUser || 0)) {
988
- return couponRepository.addLabelsToCoupons([activeNewUserCoupon.toJSON()]);
1092
+ return couponRepository.addLabelsToCoupons([activeNewUserCoupon]);
989
1093
  }
990
- (0, error_common_1.notFoundError)('No gift box coupon available');
991
1094
  return [];
992
1095
  }
1096
+ async updateNewUserCouponField(userIds) {
1097
+ const result = await this.userModel.updateMany({ _id: { $in: userIds } }, {
1098
+ $set: {
1099
+ isNewUserCouponShowed: false,
1100
+ },
1101
+ });
1102
+ return result.modifiedCount;
1103
+ }
993
1104
  async updateCouponGiftBoxShown(userId, data) {
994
- const result = await this.userModel.updateOne({ _id: userId }, {
1105
+ const user = await this.userModel.findById(userId);
1106
+ const users = await this.userModel
1107
+ .find({ deviceId: user?.deviceId })
1108
+ .select('_id')
1109
+ .lean();
1110
+ const userIds = users.map(u => u._id);
1111
+ const result = await this.userModel.updateMany({ _id: { $in: userIds } }, {
995
1112
  $set: {
996
1113
  isNewUserCouponShowed: data.isNewUserGiftBoxShown,
997
1114
  },