@timardex/cluemart-server-shared 2.2.1 → 2.2.2

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.
@@ -91,7 +91,7 @@ __export(service_exports, {
91
91
  updateAdStatuses: () => updateAdStatuses,
92
92
  updateAllEventDateTimeStatuses: () => updateAllEventDateTimeStatuses,
93
93
  updateRelationDatesToUnavailable: () => updateRelationDatesToUnavailable,
94
- updateSingleDateTimeStatus: () => updateSingleDateTimeStatus,
94
+ updateSingleDateTimeStatus: () => import_cluemart_shared35.updateSingleDateTimeStatus,
95
95
  upgradeUserToLicence: () => upgradeUserToLicence,
96
96
  vendorOwnerHasProLicence: () => vendorOwnerHasProLicence
97
97
  });
@@ -2515,6 +2515,62 @@ schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2515
2515
  schema24.index({ "couponData.participantUsers.userId": 1 });
2516
2516
  var CouponModel = import_mongoose32.default.models.Coupon || import_mongoose32.default.model("Coupon", schema24);
2517
2517
 
2518
+ // src/mongoose/Impersonation.ts
2519
+ var import_cluemart_shared22 = require("@timardex/cluemart-shared");
2520
+ var import_mongoose33 = __toESM(require("mongoose"));
2521
+ var MongooseSchema28 = import_mongoose33.default.Schema;
2522
+ var impersonationSessionSchema = new MongooseSchema28(
2523
+ {
2524
+ expiresAt: { expires: 0, required: true, type: Date },
2525
+ impersonatedUserId: {
2526
+ index: true,
2527
+ ref: "User",
2528
+ required: true,
2529
+ type: import_mongoose33.default.Schema.Types.ObjectId
2530
+ },
2531
+ impersonatorUserId: {
2532
+ index: true,
2533
+ ref: "User",
2534
+ required: true,
2535
+ type: import_mongoose33.default.Schema.Types.ObjectId
2536
+ },
2537
+ refreshToken: { required: true, type: String }
2538
+ },
2539
+ { timestamps: true }
2540
+ );
2541
+ var ImpersonationSessionModel = import_mongoose33.default.models.ImpersonationSession || import_mongoose33.default.model(
2542
+ "ImpersonationSession",
2543
+ impersonationSessionSchema
2544
+ );
2545
+ var impersonationAuditSchema = new MongooseSchema28(
2546
+ {
2547
+ action: { enum: ["start", "end"], required: true, type: String },
2548
+ endReason: { type: String },
2549
+ impersonatedUserId: {
2550
+ ref: "User",
2551
+ required: true,
2552
+ type: import_mongoose33.default.Schema.Types.ObjectId
2553
+ },
2554
+ impersonatorUserId: {
2555
+ ref: "User",
2556
+ required: true,
2557
+ type: import_mongoose33.default.Schema.Types.ObjectId
2558
+ },
2559
+ resourceId: { type: import_mongoose33.default.Schema.Types.ObjectId },
2560
+ resourceType: { enum: Object.values(import_cluemart_shared22.EnumResourceType), type: String },
2561
+ sessionId: {
2562
+ ref: "ImpersonationSession",
2563
+ required: true,
2564
+ type: import_mongoose33.default.Schema.Types.ObjectId
2565
+ }
2566
+ },
2567
+ { timestamps: true }
2568
+ );
2569
+ var ImpersonationAuditModel = import_mongoose33.default.models.ImpersonationAudit || import_mongoose33.default.model(
2570
+ "ImpersonationAudit",
2571
+ impersonationAuditSchema
2572
+ );
2573
+
2518
2574
  // src/service/promoCode/constants.ts
2519
2575
  var ACTIVE_NOT_DELETED_FILTER = {
2520
2576
  active: true,
@@ -2531,7 +2587,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
2531
2587
  }
2532
2588
 
2533
2589
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2534
- var import_cluemart_shared23 = require("@timardex/cluemart-shared");
2590
+ var import_cluemart_shared24 = require("@timardex/cluemart-shared");
2535
2591
  var import_utils3 = require("@timardex/cluemart-shared/utils");
2536
2592
 
2537
2593
  // src/service/saveNotificationsInDb.ts
@@ -2666,7 +2722,7 @@ async function sendPushNotifications({
2666
2722
  }
2667
2723
 
2668
2724
  // src/service/affiliate/vendorSubscriptionRewards.ts
2669
- var import_cluemart_shared22 = require("@timardex/cluemart-shared");
2725
+ var import_cluemart_shared23 = require("@timardex/cluemart-shared");
2670
2726
  var import_dayjs = __toESM(require("dayjs"));
2671
2727
  var import_timezone = __toESM(require("dayjs/plugin/timezone"));
2672
2728
  var import_utc = __toESM(require("dayjs/plugin/utc"));
@@ -2724,14 +2780,14 @@ import_dayjs.default.extend(import_timezone.default);
2724
2780
  var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
2725
2781
  async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
2726
2782
  const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
2727
- if (validTypes.has(import_cluemart_shared22.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared22.EnumUserLicence.PRO_PLUS_VENDOR)) {
2783
+ if (validTypes.has(import_cluemart_shared23.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared23.EnumUserLicence.PRO_PLUS_VENDOR)) {
2728
2784
  if (hasSubscription) {
2729
- return import_cluemart_shared22.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
2785
+ return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
2730
2786
  }
2731
- return import_cluemart_shared22.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2787
+ return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2732
2788
  }
2733
- if (validTypes.has(import_cluemart_shared22.EnumUserLicence.STANDARD_VENDOR)) {
2734
- return import_cluemart_shared22.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2789
+ if (validTypes.has(import_cluemart_shared23.EnumUserLicence.STANDARD_VENDOR)) {
2790
+ return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2735
2791
  }
2736
2792
  return null;
2737
2793
  }
@@ -2743,7 +2799,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
2743
2799
 
2744
2800
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2745
2801
  function isEligibleVendorResource(resource) {
2746
- return resource.resourceType === import_cluemart_shared23.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2802
+ return resource.resourceType === import_cluemart_shared24.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2747
2803
  }
2748
2804
  async function findAffiliatesWithActiveVendorReferrals() {
2749
2805
  return await AffiliateModel.find({
@@ -2752,7 +2808,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
2752
2808
  $elemMatch: {
2753
2809
  resourceActive: true,
2754
2810
  resourceDeletedAt: null,
2755
- resourceType: import_cluemart_shared23.EnumResourceType.VENDOR
2811
+ resourceType: import_cluemart_shared24.EnumResourceType.VENDOR
2756
2812
  }
2757
2813
  },
2758
2814
  deletedAt: null
@@ -2786,11 +2842,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
2786
2842
  data: {
2787
2843
  resourceId: String(affiliateId),
2788
2844
  resourceName: resourceNames.join(", "),
2789
- resourceType: import_cluemart_shared23.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
2845
+ resourceType: import_cluemart_shared24.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
2790
2846
  },
2791
2847
  message,
2792
2848
  title: "Affiliate points earned",
2793
- type: import_cluemart_shared23.EnumNotificationType.SYSTEM,
2849
+ type: import_cluemart_shared24.EnumNotificationType.SYSTEM,
2794
2850
  userIds: [affiliateOwnerUserId]
2795
2851
  };
2796
2852
  try {
@@ -2819,7 +2875,7 @@ async function tryAwardSubscriptionReward({
2819
2875
  resourceActive: true,
2820
2876
  resourceDeletedAt: null,
2821
2877
  resourceId: resource.resourceId,
2822
- resourceType: import_cluemart_shared23.EnumResourceType.VENDOR,
2878
+ resourceType: import_cluemart_shared24.EnumResourceType.VENDOR,
2823
2879
  rewards: {
2824
2880
  $not: {
2825
2881
  $elemMatch: {
@@ -2940,7 +2996,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
2940
2996
  }
2941
2997
 
2942
2998
  // src/service/database.ts
2943
- var import_mongoose36 = __toESM(require("mongoose"));
2999
+ var import_mongoose37 = __toESM(require("mongoose"));
2944
3000
  var connectToDatabase = async ({
2945
3001
  appName,
2946
3002
  dbName,
@@ -2953,7 +3009,7 @@ var connectToDatabase = async ({
2953
3009
  // Fallback to MongoDB Atlas connection string
2954
3010
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
2955
3011
  );
2956
- await import_mongoose36.default.connect(mongoUri);
3012
+ await import_mongoose37.default.connect(mongoUri);
2957
3013
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
2958
3014
  console.log(
2959
3015
  `${connectionType} connected from server/src/service/database.ts`
@@ -2966,7 +3022,7 @@ var connectToDatabase = async ({
2966
3022
 
2967
3023
  // src/types/index.ts
2968
3024
  var import_express = __toESM(require("express"));
2969
- var import_mongoose37 = __toESM(require("mongoose"));
3025
+ var import_mongoose38 = __toESM(require("mongoose"));
2970
3026
 
2971
3027
  // src/service/notifyUsers.ts
2972
3028
  async function publishNotificationEvents(userId, pubsub) {
@@ -3014,7 +3070,7 @@ async function notifyUsers({
3014
3070
  }
3015
3071
 
3016
3072
  // src/service/updateAdStatus.ts
3017
- var import_cluemart_shared24 = require("@timardex/cluemart-shared");
3073
+ var import_cluemart_shared25 = require("@timardex/cluemart-shared");
3018
3074
  async function updateAdStatuses() {
3019
3075
  const now = /* @__PURE__ */ new Date();
3020
3076
  const invalidResult = await AdModel.updateMany(
@@ -3024,50 +3080,50 @@ async function updateAdStatuses() {
3024
3080
  { end: { $exists: false } },
3025
3081
  { $expr: { $gt: ["$start", "$end"] } }
3026
3082
  ],
3027
- status: { $ne: import_cluemart_shared24.EnumAdStatus.PAUSED }
3083
+ status: { $ne: import_cluemart_shared25.EnumAdStatus.PAUSED }
3028
3084
  },
3029
- { $set: { status: import_cluemart_shared24.EnumAdStatus.PAUSED } }
3085
+ { $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
3030
3086
  );
3031
3087
  const expiredResult = await AdModel.updateMany(
3032
- { end: { $lte: now }, status: { $ne: import_cluemart_shared24.EnumAdStatus.EXPIRED } },
3033
- { $set: { status: import_cluemart_shared24.EnumAdStatus.EXPIRED } }
3088
+ { end: { $lte: now }, status: { $ne: import_cluemart_shared25.EnumAdStatus.EXPIRED } },
3089
+ { $set: { status: import_cluemart_shared25.EnumAdStatus.EXPIRED } }
3034
3090
  );
3035
3091
  const eligibleBooking = {
3036
3092
  $or: [
3037
3093
  { bookingKind: { $exists: false } },
3038
3094
  { bookingKind: null },
3039
3095
  {
3040
- approvalStatus: import_cluemart_shared24.EnumAdApprovalStatus.APPROVED,
3041
- bookingKind: import_cluemart_shared24.EnumAdBookingSlotKind.RESERVED
3096
+ approvalStatus: import_cluemart_shared25.EnumAdApprovalStatus.APPROVED,
3097
+ bookingKind: import_cluemart_shared25.EnumAdBookingSlotKind.RESERVED
3042
3098
  },
3043
3099
  {
3044
- approvalStatus: import_cluemart_shared24.EnumAdApprovalStatus.APPROVED,
3045
- bookingKind: import_cluemart_shared24.EnumAdBookingSlotKind.PAID,
3046
- paymentStatus: import_cluemart_shared24.EnumAdPaymentStatus.PAID
3100
+ approvalStatus: import_cluemart_shared25.EnumAdApprovalStatus.APPROVED,
3101
+ bookingKind: import_cluemart_shared25.EnumAdBookingSlotKind.PAID,
3102
+ paymentStatus: import_cluemart_shared25.EnumAdPaymentStatus.PAID
3047
3103
  }
3048
3104
  ]
3049
3105
  };
3050
3106
  const awaitingApprovalResult = await AdModel.updateMany(
3051
3107
  {
3052
3108
  $nor: eligibleBooking.$or,
3053
- bookingKind: { $in: Object.values(import_cluemart_shared24.EnumAdBookingSlotKind) },
3109
+ bookingKind: { $in: Object.values(import_cluemart_shared25.EnumAdBookingSlotKind) },
3054
3110
  end: { $gt: now },
3055
- status: import_cluemart_shared24.EnumAdStatus.ACTIVE
3111
+ status: import_cluemart_shared25.EnumAdStatus.ACTIVE
3056
3112
  },
3057
- { $set: { status: import_cluemart_shared24.EnumAdStatus.PAUSED } }
3113
+ { $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
3058
3114
  );
3059
3115
  const activeResult = await AdModel.updateMany(
3060
3116
  {
3061
3117
  end: { $gt: now },
3062
3118
  start: { $lte: now },
3063
- status: { $ne: import_cluemart_shared24.EnumAdStatus.ACTIVE },
3119
+ status: { $ne: import_cluemart_shared25.EnumAdStatus.ACTIVE },
3064
3120
  ...eligibleBooking
3065
3121
  },
3066
- { $set: { status: import_cluemart_shared24.EnumAdStatus.ACTIVE } }
3122
+ { $set: { status: import_cluemart_shared25.EnumAdStatus.ACTIVE } }
3067
3123
  );
3068
3124
  const pausedResult = await AdModel.updateMany(
3069
- { start: { $gt: now }, status: { $ne: import_cluemart_shared24.EnumAdStatus.PAUSED } },
3070
- { $set: { status: import_cluemart_shared24.EnumAdStatus.PAUSED } }
3125
+ { start: { $gt: now }, status: { $ne: import_cluemart_shared25.EnumAdStatus.PAUSED } },
3126
+ { $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
3071
3127
  );
3072
3128
  console.log(
3073
3129
  `\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, awaitingApproval=${awaitingApprovalResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
@@ -3075,15 +3131,15 @@ async function updateAdStatuses() {
3075
3131
  }
3076
3132
 
3077
3133
  // src/service/objectIdToString.ts
3078
- var import_mongoose39 = __toESM(require("mongoose"));
3134
+ var import_mongoose40 = __toESM(require("mongoose"));
3079
3135
  function isValidObjectId(value) {
3080
- return import_mongoose39.default.Types.ObjectId.isValid(value);
3136
+ return import_mongoose40.default.Types.ObjectId.isValid(value);
3081
3137
  }
3082
3138
  function convertObjectIdsToStrings(obj) {
3083
3139
  if (obj === null || obj === void 0) {
3084
3140
  return obj;
3085
3141
  }
3086
- if (obj instanceof import_mongoose39.default.Types.ObjectId) {
3142
+ if (obj instanceof import_mongoose40.default.Types.ObjectId) {
3087
3143
  return obj.toString();
3088
3144
  }
3089
3145
  if (obj instanceof Date) {
@@ -3103,18 +3159,16 @@ function convertObjectIdsToStrings(obj) {
3103
3159
  }
3104
3160
 
3105
3161
  // src/service/event/updateAllEventDateTimeStatuses.ts
3106
- var import_cluemart_shared26 = require("@timardex/cluemart-shared");
3162
+ var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3107
3163
  var import_dayjs2 = __toESM(require("dayjs"));
3108
- var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
3109
- var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
3110
3164
 
3111
3165
  // src/service/event/archiveEndedEventDates.ts
3112
- var import_cluemart_shared25 = require("@timardex/cluemart-shared");
3166
+ var import_cluemart_shared26 = require("@timardex/cluemart-shared");
3113
3167
  var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
3114
- import_cluemart_shared25.EnumEventDateStatus.ENDED
3168
+ import_cluemart_shared26.EnumEventDateStatus.ENDED
3115
3169
  ]);
3116
3170
  var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
3117
- import_cluemart_shared25.EnumEventDateStatus.INVALID
3171
+ import_cluemart_shared26.EnumEventDateStatus.INVALID
3118
3172
  ]);
3119
3173
  function splitEventDatesForArchive(dateTime) {
3120
3174
  return {
@@ -3149,73 +3203,6 @@ async function persistArchivedEventDates(eventId, slots) {
3149
3203
  }
3150
3204
 
3151
3205
  // src/service/event/updateAllEventDateTimeStatuses.ts
3152
- import_dayjs2.default.extend(import_customParseFormat.default);
3153
- import_dayjs2.default.extend(import_isoWeek.default);
3154
- var MANUAL_DATE_STATUSES = /* @__PURE__ */ new Set([
3155
- import_cluemart_shared26.EnumEventDateStatus.CANCELED,
3156
- import_cluemart_shared26.EnumEventDateStatus.RE_SCHEDULED
3157
- ]);
3158
- function getFutureEventStatus(startDateTime, now) {
3159
- const hoursUntilStart = startDateTime.diff(now, "hour", true);
3160
- if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
3161
- return import_cluemart_shared26.EnumEventDateStatus.STARTING_SOON;
3162
- }
3163
- if (startDateTime.isSame(now, "day")) {
3164
- return import_cluemart_shared26.EnumEventDateStatus.TODAY;
3165
- }
3166
- if (startDateTime.isSame(now.add(1, "day"), "day")) {
3167
- return import_cluemart_shared26.EnumEventDateStatus.TOMORROW;
3168
- }
3169
- if (startDateTime.isSame(now, "isoWeek")) {
3170
- return import_cluemart_shared26.EnumEventDateStatus.THIS_WEEK;
3171
- }
3172
- if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
3173
- return import_cluemart_shared26.EnumEventDateStatus.NEXT_WEEK;
3174
- }
3175
- return import_cluemart_shared26.EnumEventDateStatus.UPCOMING;
3176
- }
3177
- function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs2.default)()) {
3178
- if (MANUAL_DATE_STATUSES.has(dateTime.dateStatus)) {
3179
- return dateTime;
3180
- }
3181
- const dateTimeFormat = `${import_cluemart_shared26.dateFormat} ${import_cluemart_shared26.timeFormat}`;
3182
- const startDateTime = (0, import_dayjs2.default)(
3183
- `${dateTime.startDate} ${dateTime.startTime}`,
3184
- dateTimeFormat,
3185
- true
3186
- );
3187
- const endDateTime = (0, import_dayjs2.default)(
3188
- `${dateTime.endDate} ${dateTime.endTime}`,
3189
- dateTimeFormat,
3190
- true
3191
- );
3192
- if (!startDateTime.isValid() || !endDateTime.isValid()) {
3193
- return {
3194
- ...dateTime,
3195
- dateStatus: import_cluemart_shared26.EnumEventDateStatus.INVALID
3196
- };
3197
- }
3198
- if (endDateTime.isBefore(startDateTime)) {
3199
- return {
3200
- ...dateTime,
3201
- dateStatus: import_cluemart_shared26.EnumEventDateStatus.INVALID
3202
- };
3203
- }
3204
- let dateStatus;
3205
- if (endDateTime.isAfter(now)) {
3206
- if (startDateTime.isAfter(now)) {
3207
- dateStatus = getFutureEventStatus(startDateTime, now);
3208
- } else {
3209
- dateStatus = import_cluemart_shared26.EnumEventDateStatus.STARTED;
3210
- }
3211
- } else {
3212
- dateStatus = import_cluemart_shared26.EnumEventDateStatus.ENDED;
3213
- }
3214
- return {
3215
- ...dateTime,
3216
- dateStatus
3217
- };
3218
- }
3219
3206
  var dateTimeStatusFilter = {
3220
3207
  dateTime: { $ne: [], $type: "array" },
3221
3208
  deletedAt: null
@@ -3244,7 +3231,7 @@ async function updateModelDateTimeStatuses(model, now) {
3244
3231
  try {
3245
3232
  for await (const doc of cursor) {
3246
3233
  const dateTime = doc.dateTime.map(
3247
- (slot) => updateSingleDateTimeStatus(slot, now)
3234
+ (slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
3248
3235
  );
3249
3236
  if (!hasDateTimeStatusChanges(doc.dateTime, dateTime)) {
3250
3237
  continue;
@@ -3267,7 +3254,7 @@ async function updateModelDateTimeStatuses(model, now) {
3267
3254
  }
3268
3255
  var ARCHIVABLE_EVENT_FILTER = {
3269
3256
  "dateTime.dateStatus": {
3270
- $in: [import_cluemart_shared26.EnumEventDateStatus.ENDED, import_cluemart_shared26.EnumEventDateStatus.INVALID]
3257
+ $in: [import_cluemart_shared27.EnumEventDateStatus.ENDED, import_cluemart_shared27.EnumEventDateStatus.INVALID]
3271
3258
  },
3272
3259
  deletedAt: null
3273
3260
  };
@@ -3289,7 +3276,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
3289
3276
  try {
3290
3277
  for await (const doc of cursor) {
3291
3278
  const updated = doc.dateTime.map(
3292
- (slot) => updateSingleDateTimeStatus(slot, now)
3279
+ (slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
3293
3280
  );
3294
3281
  const { archive, discard } = splitEventDatesForArchive(updated);
3295
3282
  if (archive.length === 0 && discard.length === 0) {
@@ -3313,7 +3300,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
3313
3300
  $pull: {
3314
3301
  dateTime: {
3315
3302
  dateStatus: {
3316
- $in: [import_cluemart_shared26.EnumEventDateStatus.ENDED, import_cluemart_shared26.EnumEventDateStatus.INVALID]
3303
+ $in: [import_cluemart_shared27.EnumEventDateStatus.ENDED, import_cluemart_shared27.EnumEventDateStatus.INVALID]
3317
3304
  }
3318
3305
  }
3319
3306
  }
@@ -3347,9 +3334,9 @@ async function cleanEventInfoDates(now) {
3347
3334
  try {
3348
3335
  for await (const doc of cursor) {
3349
3336
  const updated = doc.dateTime.map(
3350
- (slot) => updateSingleDateTimeStatus(slot, now)
3337
+ (slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
3351
3338
  );
3352
- const kept = (0, import_cluemart_shared26.filterDatesByFutureStatus)(updated);
3339
+ const kept = (0, import_cluemart_shared27.filterDatesByFutureStatus)(updated);
3353
3340
  if (kept.length === updated.length) {
3354
3341
  continue;
3355
3342
  }
@@ -3394,6 +3381,9 @@ async function updateAllEventDateTimeStatuses() {
3394
3381
  }
3395
3382
  }
3396
3383
 
3384
+ // src/service/index.ts
3385
+ var import_cluemart_shared35 = require("@timardex/cluemart-shared");
3386
+
3397
3387
  // src/service/event/findEventOrImportedMarketById.ts
3398
3388
  async function findEventOrImportedMarketById(resourceId) {
3399
3389
  if (!resourceId) {
@@ -3408,7 +3398,7 @@ async function findEventOrImportedMarketById(resourceId) {
3408
3398
  }
3409
3399
 
3410
3400
  // src/service/relations.ts
3411
- var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3401
+ var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3412
3402
  function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
3413
3403
  if (!previousDateTime?.length) {
3414
3404
  return false;
@@ -3426,7 +3416,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
3426
3416
  ) ?? false;
3427
3417
  return {
3428
3418
  ...relationDate,
3429
- status: existsInEvent ? relationDate.status : import_cluemart_shared27.EnumInviteStatus.UNAVAILABLE
3419
+ status: existsInEvent ? relationDate.status : import_cluemart_shared28.EnumInviteStatus.UNAVAILABLE
3430
3420
  };
3431
3421
  });
3432
3422
  }
@@ -3435,15 +3425,15 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
3435
3425
  var import_dayjs6 = __toESM(require("dayjs"));
3436
3426
 
3437
3427
  // src/service/license/compliance/utils.ts
3438
- var import_cluemart_shared32 = require("@timardex/cluemart-shared");
3428
+ var import_cluemart_shared33 = require("@timardex/cluemart-shared");
3439
3429
  var import_dayjs5 = __toESM(require("dayjs"));
3440
3430
 
3441
3431
  // src/service/license/compliance/event.ts
3442
- var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3432
+ var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3443
3433
  var eventLicences = [
3444
- import_cluemart_shared28.EnumUserLicence.STANDARD_EVENT,
3445
- import_cluemart_shared28.EnumUserLicence.PRO_EVENT,
3446
- import_cluemart_shared28.EnumUserLicence.PRO_PLUS_EVENT
3434
+ import_cluemart_shared29.EnumUserLicence.STANDARD_EVENT,
3435
+ import_cluemart_shared29.EnumUserLicence.PRO_EVENT,
3436
+ import_cluemart_shared29.EnumUserLicence.PRO_PLUS_EVENT
3447
3437
  ];
3448
3438
  async function handleEventLicenceCompliance(user, now) {
3449
3439
  if (!user.licences || !user.events?.length) {
@@ -3655,9 +3645,9 @@ function buildLicenceExpiryPipeline(params) {
3655
3645
  }
3656
3646
 
3657
3647
  // src/service/license/compliance/partner.ts
3658
- var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3648
+ var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3659
3649
  var partnerLicences = [
3660
- import_cluemart_shared29.EnumUserLicence.STANDARD_PARTNER
3650
+ import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER
3661
3651
  ];
3662
3652
  async function handlePartnerLicenceCompliance(user, now) {
3663
3653
  if (!user.licences || !user.partner) {
@@ -3667,11 +3657,11 @@ async function handlePartnerLicenceCompliance(user, now) {
3667
3657
  }
3668
3658
 
3669
3659
  // src/service/license/compliance/vendor.ts
3670
- var import_cluemart_shared31 = require("@timardex/cluemart-shared");
3660
+ var import_cluemart_shared32 = require("@timardex/cluemart-shared");
3671
3661
  var import_dayjs4 = __toESM(require("dayjs"));
3672
3662
 
3673
3663
  // src/service/license/models.ts
3674
- var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3664
+ var import_cluemart_shared31 = require("@timardex/cluemart-shared");
3675
3665
  var import_dayjs3 = __toESM(require("dayjs"));
3676
3666
  var import_graphql = require("graphql");
3677
3667
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
@@ -3683,31 +3673,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
3683
3673
  return LicenceCategory2;
3684
3674
  })(LicenceCategory || {});
3685
3675
  var licenceCategoryMapping = {
3686
- [import_cluemart_shared30.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
3687
- [import_cluemart_shared30.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
3688
- [import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
3689
- [import_cluemart_shared30.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
3690
- [import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
3691
- [import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
3692
- [import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
3693
- [import_cluemart_shared30.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
3694
- [import_cluemart_shared30.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
3676
+ [import_cluemart_shared31.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
3677
+ [import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
3678
+ [import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
3679
+ [import_cluemart_shared31.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
3680
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
3681
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
3682
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
3683
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
3684
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
3695
3685
  };
3696
3686
  var licencePriority = {
3697
- [import_cluemart_shared30.EnumUserLicence.PRO_PLUS_EVENT]: 3,
3698
- [import_cluemart_shared30.EnumUserLicence.PRO_EVENT]: 2,
3699
- [import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT]: 1,
3700
- [import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
3701
- [import_cluemart_shared30.EnumUserLicence.PRO_VENDOR]: 2,
3702
- [import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR]: 1,
3703
- [import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER]: 1,
3704
- [import_cluemart_shared30.EnumUserLicence.STANDARD_AFFILIATE]: 1,
3705
- [import_cluemart_shared30.EnumUserLicence.STANDARD_SCHOOL]: 1
3687
+ [import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT]: 3,
3688
+ [import_cluemart_shared31.EnumUserLicence.PRO_EVENT]: 2,
3689
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT]: 1,
3690
+ [import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
3691
+ [import_cluemart_shared31.EnumUserLicence.PRO_VENDOR]: 2,
3692
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR]: 1,
3693
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER]: 1,
3694
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE]: 1,
3695
+ [import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL]: 1
3706
3696
  };
3707
3697
  var standardLicences = [
3708
- import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR,
3709
- import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT,
3710
- import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER
3698
+ import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR,
3699
+ import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
3700
+ import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER
3711
3701
  ];
3712
3702
  var standardLicenceSet = new Set(standardLicences);
3713
3703
  function isStandardLicence(licence) {
@@ -3721,11 +3711,11 @@ var categoryRegexMapping = {
3721
3711
  ["school" /* SCHOOL */]: /_school$/
3722
3712
  };
3723
3713
  var categoryFallbackLicence = {
3724
- ["event" /* EVENT */]: import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT,
3725
- ["partner" /* PARTNER */]: import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER,
3726
- ["vendor" /* VENDOR */]: import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR,
3727
- ["affiliate" /* AFFILIATE */]: import_cluemart_shared30.EnumUserLicence.STANDARD_AFFILIATE,
3728
- ["school" /* SCHOOL */]: import_cluemart_shared30.EnumUserLicence.STANDARD_SCHOOL
3714
+ ["event" /* EVENT */]: import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
3715
+ ["partner" /* PARTNER */]: import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER,
3716
+ ["vendor" /* VENDOR */]: import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR,
3717
+ ["affiliate" /* AFFILIATE */]: import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE,
3718
+ ["school" /* SCHOOL */]: import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL
3729
3719
  };
3730
3720
  var LicenceFilterInput = {
3731
3721
  INPUT_USER_LICENCES: "$licences"
@@ -3755,11 +3745,11 @@ function getHighestLicenceForCategory(licences, category) {
3755
3745
  function createLicenceObject(expiryDate, licenceType) {
3756
3746
  const today = (0, import_dayjs3.default)();
3757
3747
  const expiryDateMapping = {
3758
- [import_cluemart_shared30.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
3759
- [import_cluemart_shared30.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
3760
- [import_cluemart_shared30.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
3761
- [import_cluemart_shared30.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
3762
- [import_cluemart_shared30.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
3748
+ [import_cluemart_shared31.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
3749
+ [import_cluemart_shared31.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
3750
+ [import_cluemart_shared31.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
3751
+ [import_cluemart_shared31.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
3752
+ [import_cluemart_shared31.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
3763
3753
  };
3764
3754
  const licenceObject = {
3765
3755
  expiryDate: expiryDateMapping[expiryDate],
@@ -3863,13 +3853,13 @@ async function checkOwnerHasLicence({
3863
3853
  const owner = await UserModel.findById(userId);
3864
3854
  if (!owner) throw new import_graphql.GraphQLError("Owner not found");
3865
3855
  const categoryByResource = {
3866
- [import_cluemart_shared30.EnumResourceType.EVENT]: "event" /* EVENT */,
3867
- [import_cluemart_shared30.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
3868
- [import_cluemart_shared30.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
3869
- [import_cluemart_shared30.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
3870
- [import_cluemart_shared30.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
3856
+ [import_cluemart_shared31.EnumResourceType.EVENT]: "event" /* EVENT */,
3857
+ [import_cluemart_shared31.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
3858
+ [import_cluemart_shared31.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
3859
+ [import_cluemart_shared31.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
3860
+ [import_cluemart_shared31.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
3871
3861
  };
3872
- if (!(0, import_cluemart_shared30.isNonVisitorResourceType)(resourceType)) {
3862
+ if (!(0, import_cluemart_shared31.isNonVisitorResourceType)(resourceType)) {
3873
3863
  throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
3874
3864
  }
3875
3865
  const requiredCategory = categoryByResource[resourceType];
@@ -3949,7 +3939,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
3949
3939
  return (result?.matchedCount ?? 0) > 0;
3950
3940
  }
3951
3941
  async function downgradeVendorProFeatures(userId, licenceType) {
3952
- const isStandardVendor = licenceType === import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR;
3942
+ const isStandardVendor = licenceType === import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR;
3953
3943
  if (!isStandardVendor) {
3954
3944
  return;
3955
3945
  }
@@ -3996,7 +3986,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
3996
3986
  return (result?.matchedCount ?? 0) > 0;
3997
3987
  }
3998
3988
  async function restoreVendorProFeatures(userId, licenceType) {
3999
- const isProVendor = licenceType === import_cluemart_shared31.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR;
3989
+ const isProVendor = licenceType === import_cluemart_shared32.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR;
4000
3990
  if (!isProVendor) {
4001
3991
  return;
4002
3992
  }
@@ -4017,14 +4007,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
4017
4007
  return false;
4018
4008
  }
4019
4009
  const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs4.default)(stripe.paymentGracePeriodEndsAt) : null;
4020
- const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared31.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared31.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
4010
+ const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared32.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared32.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
4021
4011
  if (hasActivePaymentGracePeriod) {
4022
4012
  return true;
4023
4013
  }
4024
4014
  if (!stripe.subscriptionId) {
4025
4015
  return false;
4026
4016
  }
4027
- if (stripe.status !== import_cluemart_shared31.EnumSubscriptionStatus.ACTIVE) {
4017
+ if (stripe.status !== import_cluemart_shared32.EnumSubscriptionStatus.ACTIVE) {
4028
4018
  return false;
4029
4019
  }
4030
4020
  if (!stripe.endDate) {
@@ -4044,7 +4034,7 @@ async function handleVendorLicenceCompliance(user, now) {
4044
4034
  return;
4045
4035
  }
4046
4036
  const proLicences = vendorLicencesOfUser.filter(
4047
- (licence) => licence.licenceType !== import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR
4037
+ (licence) => licence.licenceType !== import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR
4048
4038
  );
4049
4039
  const expiredProLicences = proLicences.filter(
4050
4040
  (licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now)
@@ -4057,7 +4047,7 @@ async function handleVendorLicenceCompliance(user, now) {
4057
4047
  const expiredProLicence = expiredProLicences.some(
4058
4048
  (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
4059
4049
  );
4060
- const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared31.vendorLicences, now);
4050
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared32.vendorLicences, now);
4061
4051
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
4062
4052
  (licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
4063
4053
  );
@@ -4073,7 +4063,7 @@ async function handleVendorLicenceCompliance(user, now) {
4073
4063
  "owner.userId": user._id
4074
4064
  }).lean().exec();
4075
4065
  }
4076
- const licencesToSync = import_cluemart_shared31.vendorLicences.filter(
4066
+ const licencesToSync = import_cluemart_shared32.vendorLicences.filter(
4077
4067
  (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
4078
4068
  );
4079
4069
  await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
@@ -4088,11 +4078,11 @@ async function handleVendorLicenceCompliance(user, now) {
4088
4078
  data: {
4089
4079
  resourceId: String(vendor._id),
4090
4080
  resourceName: vendor.name,
4091
- resourceType: import_cluemart_shared31.EnumNotificationResourceType.DOWNGRADED_VENDOR
4081
+ resourceType: import_cluemart_shared32.EnumNotificationResourceType.DOWNGRADED_VENDOR
4092
4082
  },
4093
4083
  message: `Your Vendor licence has been downgraded due to licence expiration.`,
4094
4084
  title: `Vendor Licence Downgraded`,
4095
- type: import_cluemart_shared31.EnumNotificationType.SYSTEM,
4085
+ type: import_cluemart_shared32.EnumNotificationType.SYSTEM,
4096
4086
  userIds: [user._id]
4097
4087
  };
4098
4088
  await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
@@ -4125,7 +4115,7 @@ async function vendorOwnerHasProLicence(vendorId) {
4125
4115
  effectiveVendorLicences,
4126
4116
  "vendor" /* VENDOR */
4127
4117
  );
4128
- return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared31.EnumUserLicence.PRO_VENDOR];
4118
+ return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared32.EnumUserLicence.PRO_VENDOR];
4129
4119
  }
4130
4120
 
4131
4121
  // src/service/license/compliance/utils.ts
@@ -4135,12 +4125,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
4135
4125
  const pipeline = buildLicenceExpiryPipeline({
4136
4126
  downgradeBranches: [
4137
4127
  {
4138
- case: import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR,
4139
- then: import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR
4128
+ case: import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR,
4129
+ then: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
4140
4130
  },
4141
4131
  {
4142
- case: import_cluemart_shared32.EnumUserLicence.PRO_VENDOR,
4143
- then: import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR
4132
+ case: import_cluemart_shared33.EnumUserLicence.PRO_VENDOR,
4133
+ then: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
4144
4134
  }
4145
4135
  ],
4146
4136
  licenceTypes,
@@ -4269,7 +4259,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
4269
4259
  var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
4270
4260
 
4271
4261
  // src/service/license/reminder/utils.ts
4272
- var import_cluemart_shared33 = require("@timardex/cluemart-shared");
4262
+ var import_cluemart_shared34 = require("@timardex/cluemart-shared");
4273
4263
  var import_utils8 = require("@timardex/cluemart-shared/utils");
4274
4264
  var import_dayjs7 = __toESM(require("dayjs"));
4275
4265
 
@@ -4335,28 +4325,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
4335
4325
  return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
4336
4326
  }
4337
4327
  function getLicenseName(licenceType) {
4338
- return import_cluemart_shared33.licenseNiceNames[licenceType] || licenceType;
4328
+ return import_cluemart_shared34.licenseNiceNames[licenceType] || licenceType;
4339
4329
  }
4340
4330
  function getNotificationTypes(isVendorLicense, isPartnerLicense) {
4341
4331
  if (isVendorLicense) {
4342
4332
  return {
4343
- notificationType: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4344
- resourceType: import_cluemart_shared33.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4333
+ notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
4334
+ resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4345
4335
  };
4346
4336
  }
4347
4337
  if (isPartnerLicense) {
4348
4338
  return {
4349
- notificationType: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4350
- resourceType: import_cluemart_shared33.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4339
+ notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
4340
+ resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4351
4341
  };
4352
4342
  }
4353
4343
  return {
4354
- notificationType: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4355
- resourceType: import_cluemart_shared33.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4344
+ notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
4345
+ resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4356
4346
  };
4357
4347
  }
4358
4348
  async function getLicenseResourceInfo(user, licence) {
4359
- const isVendorLicense = import_cluemart_shared33.vendorLicences.includes(licence.licenceType);
4349
+ const isVendorLicense = import_cluemart_shared34.vendorLicences.includes(licence.licenceType);
4360
4350
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
4361
4351
  const licenceName = getLicenseName(licence.licenceType);
4362
4352
  const { notificationType, resourceType } = getNotificationTypes(
@@ -4404,11 +4394,11 @@ async function getLicenseResourceInfo(user, licence) {
4404
4394
  };
4405
4395
  }
4406
4396
  function getLicenceExpiryMode(licenceType) {
4407
- return licenceType === import_cluemart_shared33.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4397
+ return licenceType === import_cluemart_shared34.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4408
4398
  }
4409
4399
  async function sendLicenseReminder(user, licence) {
4410
4400
  const licenceName = getLicenseName(licence.licenceType);
4411
- const expiryDate = (0, import_dayjs7.default)(licence.expiryDate).format(import_cluemart_shared33.dateFormat);
4401
+ const expiryDate = (0, import_dayjs7.default)(licence.expiryDate).format(import_cluemart_shared34.dateFormat);
4412
4402
  const userId = String(user._id);
4413
4403
  const resourceInfo = await getLicenseResourceInfo(user, licence);
4414
4404
  if (!resourceInfo) {