@timardex/cluemart-server-shared 2.3.0 → 2.5.0

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.
@@ -96,8 +96,8 @@ __export(service_exports, {
96
96
  syncUserLicencesAfterExpiry: () => syncUserLicencesAfterExpiry,
97
97
  updateAdStatuses: () => updateAdStatuses,
98
98
  updateAllEventDateTimeStatuses: () => updateAllEventDateTimeStatuses,
99
- updateRelationDatesToUnavailable: () => updateRelationDatesToUnavailable,
100
- updateSingleDateTimeStatus: () => import_cluemart_shared35.updateSingleDateTimeStatus,
99
+ updateRelationDatesToCanceled: () => updateRelationDatesToCanceled,
100
+ updateSingleDateTimeStatus: () => import_cluemart_shared36.updateSingleDateTimeStatus,
101
101
  upgradeUserToLicence: () => upgradeUserToLicence,
102
102
  vendorOwnerHasProLicence: () => vendorOwnerHasProLicence
103
103
  });
@@ -136,7 +136,6 @@ var schemaAdresource = new MongooseSchema({
136
136
  var schema = new MongooseSchema(
137
137
  {
138
138
  active: { default: true, type: Boolean },
139
- adminManaged: { default: false, type: Boolean },
140
139
  approvalStatus: {
141
140
  enum: Object.values(import_cluemart_shared.EnumAdApprovalStatus),
142
141
  required: false,
@@ -152,9 +151,14 @@ var schema = new MongooseSchema(
152
151
  required: false,
153
152
  type: String
154
153
  },
155
- clicks: { default: 0, required: true, type: Number },
156
- end: { required: true, type: Date },
157
- impressions: { default: 0, required: true, type: Number },
154
+ end: {
155
+ required: true,
156
+ type: Date,
157
+ validate: {
158
+ message: "end must be a UTC-midnight day key.",
159
+ validator: import_cluemart_shared.isUtcMidnight
160
+ }
161
+ },
158
162
  paymentStatus: {
159
163
  enum: Object.values(import_cluemart_shared.EnumAdPaymentStatus),
160
164
  required: false,
@@ -167,7 +171,14 @@ var schema = new MongooseSchema(
167
171
  required: true,
168
172
  type: [String]
169
173
  },
170
- start: { required: true, type: Date },
174
+ start: {
175
+ required: true,
176
+ type: Date,
177
+ validate: {
178
+ message: "start must be a UTC-midnight day key.",
179
+ validator: import_cluemart_shared.isUtcMidnight
180
+ }
181
+ },
171
182
  status: {
172
183
  default: import_cluemart_shared.EnumAdStatus.ACTIVE,
173
184
  enum: Object.values(import_cluemart_shared.EnumAdStatus),
@@ -201,6 +212,7 @@ schema.index(
201
212
  var AdModel = import_mongoose.default.models.Ad || import_mongoose.default.model("Ad", schema);
202
213
 
203
214
  // src/mongoose/ad/AdBillingCatalog.ts
215
+ var import_cluemart_shared2 = require("@timardex/cluemart-shared");
204
216
  var import_mongoose2 = __toESM(require("mongoose"));
205
217
  var AD_BILLING_CATALOG_COLLECTION_NAME = "adBillingCatalog";
206
218
  var schema2 = new import_mongoose2.default.Schema(
@@ -214,7 +226,7 @@ var schema2 = new import_mongoose2.default.Schema(
214
226
  type: String
215
227
  },
216
228
  key: {
217
- enum: ["front_page_day", "market_search_day"],
229
+ enum: Object.values(import_cluemart_shared2.EnumAdShowOn),
218
230
  immutable: true,
219
231
  required: true,
220
232
  type: String,
@@ -240,20 +252,19 @@ var AdBillingCatalogModel = import_mongoose2.default.models.AdBillingCatalog ||
240
252
  );
241
253
 
242
254
  // src/mongoose/ad/AdBooking.ts
243
- var import_cluemart_shared2 = require("@timardex/cluemart-shared");
255
+ var import_cluemart_shared3 = require("@timardex/cluemart-shared");
244
256
  var import_mongoose3 = __toESM(require("mongoose"));
245
257
  var liveStates = [
246
- import_cluemart_shared2.EnumAdBookingState.HELD,
247
- import_cluemart_shared2.EnumAdBookingState.PENDING_APPROVAL,
248
- import_cluemart_shared2.EnumAdBookingState.APPROVED
258
+ import_cluemart_shared3.EnumAdBookingState.HELD,
259
+ import_cluemart_shared3.EnumAdBookingState.PENDING_APPROVAL,
260
+ import_cluemart_shared3.EnumAdBookingState.APPROVED
249
261
  ];
250
- var placementValues = [import_cluemart_shared2.EnumAdShowOn.FRONT_PAGE, import_cluemart_shared2.EnumAdShowOn.MARKET_SEARCH];
251
262
  var schema3 = new import_mongoose3.default.Schema(
252
263
  {
253
264
  adId: { default: null, ref: "Ad", type: String },
254
265
  approvalStatus: {
255
- default: import_cluemart_shared2.EnumAdApprovalStatus.PENDING,
256
- enum: Object.values(import_cluemart_shared2.EnumAdApprovalStatus),
266
+ default: import_cluemart_shared3.EnumAdApprovalStatus.PENDING,
267
+ enum: Object.values(import_cluemart_shared3.EnumAdApprovalStatus),
257
268
  required: true,
258
269
  type: String
259
270
  },
@@ -261,19 +272,16 @@ var schema3 = new import_mongoose3.default.Schema(
261
272
  currency: { default: null, lowercase: true, type: String },
262
273
  dayKey: {
263
274
  immutable: true,
264
- match: /^\d{4}-\d{2}-\d{2}$/,
265
275
  required: true,
266
- type: String
267
- },
268
- entitlementClaimKey: { default: null, type: String },
269
- entitlementSource: {
270
- default: null,
271
- enum: Object.values(import_cluemart_shared2.EnumAdEntitlementSource),
272
- type: String
276
+ type: Date,
277
+ validate: {
278
+ message: "dayKey must be a UTC-midnight day key.",
279
+ validator: import_cluemart_shared3.isUtcMidnight
280
+ }
273
281
  },
274
282
  expiresAt: { default: null, type: Date },
275
283
  placement: {
276
- enum: placementValues,
284
+ enum: Object.values(import_cluemart_shared3.EnumAdShowOn),
277
285
  immutable: true,
278
286
  required: true,
279
287
  type: String
@@ -288,15 +296,16 @@ var schema3 = new import_mongoose3.default.Schema(
288
296
  },
289
297
  resource: { required: true, type: schemaAdresource },
290
298
  slotKind: {
291
- enum: Object.values(import_cluemart_shared2.EnumAdBookingSlotKind),
299
+ default: import_cluemart_shared3.EnumAdBookingSlotKind.PAID,
300
+ enum: Object.values(import_cluemart_shared3.EnumAdBookingSlotKind),
292
301
  immutable: true,
293
302
  required: true,
294
303
  type: String
295
304
  },
296
305
  slotNumber: { immutable: true, min: 1, required: true, type: Number },
297
306
  state: {
298
- default: import_cluemart_shared2.EnumAdBookingState.HELD,
299
- enum: Object.values(import_cluemart_shared2.EnumAdBookingState),
307
+ default: import_cluemart_shared3.EnumAdBookingState.HELD,
308
+ enum: Object.values(import_cluemart_shared3.EnumAdBookingState),
300
309
  required: true,
301
310
  type: String
302
311
  },
@@ -314,14 +323,14 @@ schema3.pre(
314
323
  this.invalidate("slotNumber", "Ad booking slot must be an integer.");
315
324
  return;
316
325
  }
317
- const maximum = this.slotKind === import_cluemart_shared2.EnumAdBookingSlotKind.PAID ? 30 : 7;
326
+ const maximum = 30;
318
327
  if (this.slotNumber < 1 || this.slotNumber > maximum) {
319
328
  this.invalidate(
320
329
  "slotNumber",
321
330
  `Ad booking slot must be between 1 and ${maximum}.`
322
331
  );
323
332
  }
324
- if (this.slotKind === import_cluemart_shared2.EnumAdBookingSlotKind.PAID && this.state !== import_cluemart_shared2.EnumAdBookingState.HELD && this.state !== import_cluemart_shared2.EnumAdBookingState.FAILED && this.state !== import_cluemart_shared2.EnumAdBookingState.CANCELLED && (!this.unitAmount || !this.currency)) {
333
+ if (this.slotKind === import_cluemart_shared3.EnumAdBookingSlotKind.PAID && this.state !== import_cluemart_shared3.EnumAdBookingState.HELD && this.state !== import_cluemart_shared3.EnumAdBookingState.FAILED && this.state !== import_cluemart_shared3.EnumAdBookingState.CANCELLED && (!this.unitAmount || !this.currency)) {
325
334
  this.invalidate(
326
335
  "unitAmount",
327
336
  "Paid ad booking must retain its checkout price."
@@ -351,26 +360,6 @@ schema3.index(
351
360
  unique: true
352
361
  }
353
362
  );
354
- schema3.index(
355
- { entitlementClaimKey: 1 },
356
- {
357
- partialFilterExpression: {
358
- entitlementClaimKey: { $type: "string" },
359
- state: { $in: liveStates }
360
- },
361
- unique: true
362
- }
363
- );
364
- schema3.index(
365
- { adId: 1, region: 1, placement: 1, dayKey: 1 },
366
- {
367
- partialFilterExpression: {
368
- entitlementSource: import_cluemart_shared2.EnumAdEntitlementSource.ADMIN,
369
- state: { $in: liveStates }
370
- },
371
- unique: true
372
- }
373
- );
374
363
  schema3.index(
375
364
  { stripeCheckoutSessionId: 1 },
376
365
  {
@@ -380,29 +369,40 @@ schema3.index(
380
369
  );
381
370
  var AdBookingModel = import_mongoose3.default.models.AdBooking || import_mongoose3.default.model("AdBooking", schema3);
382
371
 
383
- // src/mongoose/ad/AdImpression.ts
384
- var import_cluemart_shared3 = require("@timardex/cluemart-shared");
372
+ // src/mongoose/ad/AdMetrics.ts
373
+ var import_cluemart_shared4 = require("@timardex/cluemart-shared");
385
374
  var import_mongoose4 = __toESM(require("mongoose"));
386
375
  var schema4 = new import_mongoose4.default.Schema(
387
376
  {
388
- _id: { required: true, type: String },
389
- adId: { required: true, type: String },
390
- dayKey: { match: /^\d{4}-\d{2}-\d{2}$/, required: true, type: String },
377
+ adId: { ref: "Ad", required: true, type: String },
378
+ clicks: { default: 0, required: true, type: Number },
379
+ date: {
380
+ immutable: true,
381
+ required: true,
382
+ type: Date,
383
+ validate: {
384
+ message: "date must be a UTC-midnight day key.",
385
+ validator: import_cluemart_shared4.isUtcMidnight
386
+ }
387
+ },
388
+ impressions: { default: 0, required: true, type: Number },
391
389
  placement: {
392
- enum: [import_cluemart_shared3.EnumAdShowOn.FRONT_PAGE, import_cluemart_shared3.EnumAdShowOn.MARKET_SEARCH],
390
+ enum: Object.values(import_cluemart_shared4.EnumAdShowOn),
391
+ immutable: true,
393
392
  required: true,
394
393
  type: String
395
394
  },
396
- recordedAt: { default: Date.now, required: true, type: Date },
397
- viewerSlotKey: { required: true, type: String }
395
+ platform: {
396
+ enum: Object.values(import_cluemart_shared4.EnumAdPlatform),
397
+ immutable: true,
398
+ required: true,
399
+ type: String
400
+ }
398
401
  },
399
- { collection: "adImpressions" }
402
+ { timestamps: true }
400
403
  );
401
- schema4.index({ adId: 1, recordedAt: 1 });
402
- schema4.index({ adId: 1, placement: 1, viewerSlotKey: 1 }, { unique: true });
403
- schema4.index({ recordedAt: 1 }, { expireAfterSeconds: 7 * 24 * 60 * 60 });
404
- schema4.index({ dayKey: 1, placement: 1, adId: 1 });
405
- var AdImpressionModel = import_mongoose4.default.models.AdImpression || import_mongoose4.default.model("AdImpression", schema4, "adImpressions");
404
+ schema4.index({ adId: 1, date: 1, placement: 1, platform: 1 }, { unique: true });
405
+ var AdMetricsModel = import_mongoose4.default.models.AdMetrics || import_mongoose4.default.model("AdMetrics", schema4);
406
406
 
407
407
  // src/mongoose/ad/AdSettings.ts
408
408
  var import_mongoose5 = __toESM(require("mongoose"));
@@ -411,54 +411,31 @@ var schema5 = new import_mongoose5.default.Schema(
411
411
  _id: { default: "default", enum: ["default"], type: String },
412
412
  approvalRequired: { default: true, required: true, type: Boolean },
413
413
  minAppearancesPerHour: {
414
- default: 12,
414
+ max: 12,
415
415
  min: 1,
416
- required: true,
417
416
  type: Number,
418
- validate: {
419
- message: "Minimum appearances per hour must be a whole number.",
420
- validator: Number.isInteger
421
- }
417
+ validate: Number.isInteger
422
418
  },
423
- paidSlotsPerPlacement: {
424
- default: 30,
425
- enum: [30],
426
- immutable: true,
427
- type: Number
428
- },
429
- reservedSlotsPerPlacement: {
430
- default: 7,
431
- enum: [7],
432
- immutable: true,
433
- type: Number
434
- },
435
- rotationSeconds: { default: 8, enum: [8], immutable: true, type: Number }
419
+ paidSlotsPerPlacement: { enum: [30], immutable: true, type: Number },
420
+ reservedSlotsPerPlacement: { enum: [7], immutable: true, type: Number },
421
+ rotationSeconds: { enum: [8], immutable: true, type: Number }
436
422
  },
437
423
  { collection: "adSettings", timestamps: true }
438
424
  );
439
- schema5.pre("validate", function validateRotationCapacity() {
440
- const availableRotationsPerHour = 3600 / this.rotationSeconds;
441
- if (this.minAppearancesPerHour * (this.paidSlotsPerPlacement + this.reservedSlotsPerPlacement) > availableRotationsPerHour) {
442
- this.invalidate(
443
- "minAppearancesPerHour",
444
- "The configured minimum exceeds the available rotation slots."
445
- );
446
- }
447
- });
448
425
  var AdSettingsModel = import_mongoose5.default.models.AdSettings || import_mongoose5.default.model("AdSettings", schema5, "adSettings");
449
426
 
450
427
  // src/mongoose/BillingCatalog.ts
451
- var import_cluemart_shared4 = require("@timardex/cluemart-shared");
428
+ var import_cluemart_shared5 = require("@timardex/cluemart-shared");
452
429
  var import_mongoose6 = __toESM(require("mongoose"));
453
430
  var MongooseSchema2 = import_mongoose6.default.Schema;
454
431
  var BILLING_CATALOG_COLLECTION_NAME = "billingCatalog";
455
432
  var paidVendorLicences = [
456
- import_cluemart_shared4.EnumUserLicence.PRO_VENDOR,
457
- import_cluemart_shared4.EnumUserLicence.PRO_PLUS_VENDOR
433
+ import_cluemart_shared5.EnumUserLicence.PRO_VENDOR,
434
+ import_cluemart_shared5.EnumUserLicence.PRO_PLUS_VENDOR
458
435
  ];
459
436
  var supportedBillingPeriods = [
460
- import_cluemart_shared4.EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,
461
- import_cluemart_shared4.EnumBillingPeriod.YEARLY_ANNUAL_BILLED
437
+ import_cluemart_shared5.EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,
438
+ import_cluemart_shared5.EnumBillingPeriod.YEARLY_ANNUAL_BILLED
462
439
  ];
463
440
  var unitAmountField = {
464
441
  min: 1,
@@ -470,8 +447,8 @@ var unitAmountField = {
470
447
  }
471
448
  };
472
449
  var currencyField = {
473
- default: import_cluemart_shared4.BILLING_CATALOG_CURRENCY,
474
- enum: [import_cluemart_shared4.BILLING_CATALOG_CURRENCY],
450
+ default: import_cluemart_shared5.BILLING_CATALOG_CURRENCY,
451
+ enum: [import_cluemart_shared5.BILLING_CATALOG_CURRENCY],
475
452
  immutable: true,
476
453
  lowercase: true,
477
454
  required: true,
@@ -520,7 +497,7 @@ var schema6 = new MongooseSchema2(
520
497
  currency: currencyField,
521
498
  effectiveFrom: { default: Date.now, required: true, type: Date },
522
499
  key: {
523
- enum: import_cluemart_shared4.BILLING_CATALOG_KEYS,
500
+ enum: import_cluemart_shared5.BILLING_CATALOG_KEYS,
524
501
  immutable: true,
525
502
  required: true,
526
503
  type: String,
@@ -574,7 +551,7 @@ var schema6 = new MongooseSchema2(
574
551
  }
575
552
  );
576
553
  schema6.pre("validate", function validateDefinition() {
577
- if (!(0, import_cluemart_shared4.billingCatalogDefinitionMatches)(this)) {
554
+ if (!(0, import_cluemart_shared5.billingCatalogDefinitionMatches)(this)) {
578
555
  this.invalidate(
579
556
  "key",
580
557
  "Billing catalogue key does not match its licence and billing period."
@@ -597,7 +574,7 @@ var BillingCatalogModel = import_mongoose6.default.models.BillingCatalogEntry ||
597
574
  );
598
575
 
599
576
  // src/mongoose/chat/Chat.ts
600
- var import_cluemart_shared5 = require("@timardex/cluemart-shared");
577
+ var import_cluemart_shared6 = require("@timardex/cluemart-shared");
601
578
  var import_mongoose7 = __toESM(require("mongoose"));
602
579
  var MongooseSchema3 = import_mongoose7.default.Schema;
603
580
  var MessageReplyPreviewSchema = new MongooseSchema3(
@@ -677,7 +654,7 @@ var ChatSchema = new MongooseSchema3(
677
654
  chatDescription: { required: false, type: String },
678
655
  chatName: { required: true, type: String },
679
656
  chatType: {
680
- enum: Object.values(import_cluemart_shared5.EnumChatType),
657
+ enum: Object.values(import_cluemart_shared6.EnumChatType),
681
658
  required: true,
682
659
  type: String
683
660
  },
@@ -698,14 +675,14 @@ ChatSchema.index({
698
675
  var ChatModel = import_mongoose7.default.models.Chat || import_mongoose7.default.model("Chat", ChatSchema);
699
676
 
700
677
  // src/mongoose/chat/ChatReport.ts
701
- var import_cluemart_shared6 = require("@timardex/cluemart-shared");
678
+ var import_cluemart_shared7 = require("@timardex/cluemart-shared");
702
679
  var import_mongoose8 = __toESM(require("mongoose"));
703
680
  var MongooseSchema4 = import_mongoose8.default.Schema;
704
681
  var ReasonSchema = new MongooseSchema4(
705
682
  {
706
683
  details: { default: null, required: false, type: String },
707
684
  reasonType: {
708
- enum: Object.values(import_cluemart_shared6.EnumChatReportReason),
685
+ enum: Object.values(import_cluemart_shared7.EnumChatReportReason),
709
686
  required: true,
710
687
  type: String
711
688
  }
@@ -739,7 +716,7 @@ ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
739
716
  var ChatReportModel = import_mongoose8.default.models.ChatReport || import_mongoose8.default.model("ChatReport", ChatReportSchema);
740
717
 
741
718
  // src/mongoose/global.ts
742
- var import_cluemart_shared7 = require("@timardex/cluemart-shared");
719
+ var import_cluemart_shared8 = require("@timardex/cluemart-shared");
743
720
  var import_mongoose9 = __toESM(require("mongoose"));
744
721
  var MongooseSchema5 = import_mongoose9.default.Schema;
745
722
  var OwnerTypeSchema = new MongooseSchema5(
@@ -807,12 +784,12 @@ var userLicenseSchema = new MongooseSchema5(
807
784
  expiryDate: { required: true, type: Date },
808
785
  issuedDate: { required: true, type: Date },
809
786
  licenceType: {
810
- enum: Object.values(import_cluemart_shared7.EnumUserLicence),
787
+ enum: Object.values(import_cluemart_shared8.EnumUserLicence),
811
788
  required: true,
812
789
  type: String
813
790
  },
814
791
  prevLicenceType: {
815
- enum: Object.values(import_cluemart_shared7.EnumUserLicence),
792
+ enum: Object.values(import_cluemart_shared8.EnumUserLicence),
816
793
  required: false,
817
794
  type: String
818
795
  }
@@ -848,7 +825,7 @@ var termsAgreementSchema = new MongooseSchema5(
848
825
  var dateTimeSchema = new MongooseSchema5(
849
826
  {
850
827
  dateStatus: {
851
- enum: Object.values(import_cluemart_shared7.EnumEventDateStatus),
828
+ enum: Object.values(import_cluemart_shared8.EnumEventDateStatus),
852
829
  required: false,
853
830
  type: String
854
831
  },
@@ -895,7 +872,7 @@ var relatedPostSchema = new MongooseSchema5(
895
872
  },
896
873
  postSlug: { required: true, type: String },
897
874
  postType: {
898
- enum: Object.values(import_cluemart_shared7.EnumPostType),
875
+ enum: Object.values(import_cluemart_shared8.EnumPostType),
899
876
  required: true,
900
877
  type: String
901
878
  }
@@ -946,7 +923,7 @@ var baseResourceFields = {
946
923
  };
947
924
 
948
925
  // src/mongoose/GoogleImportedMarket.ts
949
- var import_cluemart_shared8 = require("@timardex/cluemart-shared");
926
+ var import_cluemart_shared9 = require("@timardex/cluemart-shared");
950
927
  var import_mongoose10 = __toESM(require("mongoose"));
951
928
 
952
929
  // src/mongoose/searchNamePlugin.ts
@@ -1079,7 +1056,7 @@ var schema7 = new MongooseSchema6(
1079
1056
  type: import_mongoose10.default.Schema.Types.ObjectId
1080
1057
  },
1081
1058
  eventType: {
1082
- enum: Object.values(import_cluemart_shared8.EnumEventType),
1059
+ enum: Object.values(import_cluemart_shared9.EnumEventType),
1083
1060
  required: true,
1084
1061
  type: String
1085
1062
  },
@@ -1121,7 +1098,7 @@ schema7.plugin(searchNamePlugin);
1121
1098
  var GoogleImportedMarketModel = import_mongoose10.default.models.GoogleImportedMarket || import_mongoose10.default.model("GoogleImportedMarket", schema7);
1122
1099
 
1123
1100
  // src/mongoose/Notification.ts
1124
- var import_cluemart_shared9 = require("@timardex/cluemart-shared");
1101
+ var import_cluemart_shared10 = require("@timardex/cluemart-shared");
1125
1102
  var import_mongoose11 = __toESM(require("mongoose"));
1126
1103
  var MongooseSchema7 = import_mongoose11.default.Schema;
1127
1104
  var notificationDataSchema = new MongooseSchema7(
@@ -1129,7 +1106,7 @@ var notificationDataSchema = new MongooseSchema7(
1129
1106
  resourceId: { required: true, type: String },
1130
1107
  resourceName: { required: true, type: String },
1131
1108
  resourceType: {
1132
- enum: Object.values(import_cluemart_shared9.EnumNotificationResourceType),
1109
+ enum: Object.values(import_cluemart_shared10.EnumNotificationResourceType),
1133
1110
  required: true,
1134
1111
  type: String
1135
1112
  }
@@ -1147,8 +1124,8 @@ var schema8 = new MongooseSchema7(
1147
1124
  message: { required: true, type: String },
1148
1125
  title: { required: true, type: String },
1149
1126
  type: {
1150
- default: import_cluemart_shared9.EnumNotificationType.SYSTEM,
1151
- enum: Object.values(import_cluemart_shared9.EnumNotificationType),
1127
+ default: import_cluemart_shared10.EnumNotificationType.SYSTEM,
1128
+ enum: Object.values(import_cluemart_shared10.EnumNotificationType),
1152
1129
  required: true,
1153
1130
  type: String
1154
1131
  },
@@ -1187,11 +1164,11 @@ var schema9 = new MongooseSchema8(
1187
1164
  var PushTokenModel = import_mongoose12.default.models.PushToken || import_mongoose12.default.model("PushToken", schema9);
1188
1165
 
1189
1166
  // src/mongoose/Relation.ts
1190
- var import_cluemart_shared11 = require("@timardex/cluemart-shared");
1167
+ var import_cluemart_shared12 = require("@timardex/cluemart-shared");
1191
1168
  var import_mongoose14 = __toESM(require("mongoose"));
1192
1169
 
1193
1170
  // src/mongoose/event/EventInfo.ts
1194
- var import_cluemart_shared10 = require("@timardex/cluemart-shared");
1171
+ var import_cluemart_shared11 = require("@timardex/cluemart-shared");
1195
1172
  var import_mongoose13 = __toESM(require("mongoose"));
1196
1173
  var MongooseSchema9 = import_mongoose13.default.Schema;
1197
1174
  var StallTypeSchema = new MongooseSchema9(
@@ -1208,7 +1185,7 @@ var StallTypeSchema = new MongooseSchema9(
1208
1185
  var dateTimeSchema2 = new MongooseSchema9(
1209
1186
  {
1210
1187
  dateStatus: {
1211
- enum: Object.values(import_cluemart_shared10.EnumEventDateStatus),
1188
+ enum: Object.values(import_cluemart_shared11.EnumEventDateStatus),
1212
1189
  required: false,
1213
1190
  type: String
1214
1191
  },
@@ -1227,7 +1204,7 @@ var paymentInfoSchema = new MongooseSchema9(
1227
1204
  accountNumber: { required: false, type: String },
1228
1205
  link: { required: false, type: String },
1229
1206
  paymentMethod: {
1230
- enum: Object.values(import_cluemart_shared10.EnumPaymentMethod),
1207
+ enum: Object.values(import_cluemart_shared11.EnumPaymentMethod),
1231
1208
  required: true,
1232
1209
  type: String
1233
1210
  }
@@ -1280,7 +1257,7 @@ var MongooseSchema10 = import_mongoose14.default.Schema;
1280
1257
  var relationDateTimeSchema = new MongooseSchema10(
1281
1258
  {
1282
1259
  dateStatus: {
1283
- enum: Object.values(import_cluemart_shared11.EnumEventDateStatus),
1260
+ enum: Object.values(import_cluemart_shared12.EnumEventDateStatus),
1284
1261
  required: true,
1285
1262
  type: String
1286
1263
  },
@@ -1304,7 +1281,7 @@ var relationDatesSchema = new MongooseSchema10(
1304
1281
  },
1305
1282
  paymentReference: { required: false, type: String },
1306
1283
  status: {
1307
- enum: Object.values(import_cluemart_shared11.EnumInviteStatus),
1284
+ enum: Object.values(import_cluemart_shared12.EnumInviteStatus),
1308
1285
  required: false,
1309
1286
  type: String
1310
1287
  }
@@ -1326,13 +1303,13 @@ var RelationTypeSchema = new MongooseSchema10(
1326
1303
  type: import_mongoose14.default.Schema.Types.ObjectId
1327
1304
  },
1328
1305
  lastUpdateBy: {
1329
- enum: Object.values(import_cluemart_shared11.EnumResourceType),
1306
+ enum: Object.values(import_cluemart_shared12.EnumResourceType),
1330
1307
  required: true,
1331
1308
  type: String
1332
1309
  },
1333
1310
  relationDates: [relationDatesSchema],
1334
1311
  relationType: {
1335
- enum: Object.values(import_cluemart_shared11.EnumRelationResource),
1312
+ enum: Object.values(import_cluemart_shared12.EnumRelationResource),
1336
1313
  required: true,
1337
1314
  type: String
1338
1315
  },
@@ -1354,18 +1331,18 @@ RelationTypeSchema.index({
1354
1331
  var RelationModel = import_mongoose14.default.models.Relation || import_mongoose14.default.model("Relation", RelationTypeSchema);
1355
1332
 
1356
1333
  // src/mongoose/ResourceActivity.ts
1357
- var import_cluemart_shared12 = require("@timardex/cluemart-shared");
1334
+ var import_cluemart_shared13 = require("@timardex/cluemart-shared");
1358
1335
  var import_mongoose15 = __toESM(require("mongoose"));
1359
1336
  var MongooseSchema11 = import_mongoose15.default.Schema;
1360
1337
  var ActivitySchema = new MongooseSchema11(
1361
1338
  {
1362
1339
  activityType: {
1363
- enum: Object.values(import_cluemart_shared12.EnumActivity),
1340
+ enum: Object.values(import_cluemart_shared13.EnumActivity),
1364
1341
  required: true,
1365
1342
  type: String
1366
1343
  },
1367
1344
  dateStatus: {
1368
- enum: Object.values(import_cluemart_shared12.EnumEventDateStatus),
1345
+ enum: Object.values(import_cluemart_shared13.EnumEventDateStatus),
1369
1346
  required: false,
1370
1347
  type: String
1371
1348
  },
@@ -1377,7 +1354,7 @@ var ActivitySchema = new MongooseSchema11(
1377
1354
  startTime: { required: false, type: String },
1378
1355
  timestamp: { default: Date.now, type: Date },
1379
1356
  userAgent: {
1380
- enum: Object.values(import_cluemart_shared12.EnumOSPlatform),
1357
+ enum: Object.values(import_cluemart_shared13.EnumOSPlatform),
1381
1358
  required: true,
1382
1359
  type: String
1383
1360
  },
@@ -1390,7 +1367,7 @@ var schema11 = new MongooseSchema11(
1390
1367
  activity: { default: [], type: [ActivitySchema] },
1391
1368
  resourceId: { required: true, type: String },
1392
1369
  resourceType: {
1393
- enum: Object.values(import_cluemart_shared12.EnumResourceType),
1370
+ enum: Object.values(import_cluemart_shared13.EnumResourceType),
1394
1371
  required: true,
1395
1372
  type: String
1396
1373
  }
@@ -1402,7 +1379,7 @@ schema11.index({ "views.location": "2dsphere" });
1402
1379
  var ResourceActivityModel = import_mongoose15.default.models.ResourceActivity || import_mongoose15.default.model("ResourceActivity", schema11);
1403
1380
 
1404
1381
  // src/mongoose/User.ts
1405
- var import_cluemart_shared13 = require("@timardex/cluemart-shared");
1382
+ var import_cluemart_shared14 = require("@timardex/cluemart-shared");
1406
1383
  var import_mongoose16 = __toESM(require("mongoose"));
1407
1384
  var MongooseSchema12 = import_mongoose16.default.Schema;
1408
1385
  var userActivityEventSchema = new MongooseSchema12(
@@ -1439,7 +1416,7 @@ var userActivityFavouritesSchema = new MongooseSchema12(
1439
1416
  var stripeSchema = new MongooseSchema12(
1440
1417
  {
1441
1418
  billingPeriod: {
1442
- enum: Object.values(import_cluemart_shared13.EnumBillingPeriod),
1419
+ enum: Object.values(import_cluemart_shared14.EnumBillingPeriod),
1443
1420
  required: false,
1444
1421
  type: String
1445
1422
  },
@@ -1448,7 +1425,7 @@ var stripeSchema = new MongooseSchema12(
1448
1425
  type: Boolean
1449
1426
  },
1450
1427
  currentPlan: {
1451
- enum: Object.values(import_cluemart_shared13.EnumUserLicence),
1428
+ enum: Object.values(import_cluemart_shared14.EnumUserLicence),
1452
1429
  required: false,
1453
1430
  type: String
1454
1431
  },
@@ -1473,7 +1450,7 @@ var stripeSchema = new MongooseSchema12(
1473
1450
  type: String
1474
1451
  },
1475
1452
  pendingBillingPeriod: {
1476
- enum: Object.values(import_cluemart_shared13.EnumBillingPeriod),
1453
+ enum: Object.values(import_cluemart_shared14.EnumBillingPeriod),
1477
1454
  required: false,
1478
1455
  type: String
1479
1456
  },
@@ -1482,7 +1459,7 @@ var stripeSchema = new MongooseSchema12(
1482
1459
  type: Date
1483
1460
  },
1484
1461
  pendingPlan: {
1485
- enum: Object.values(import_cluemart_shared13.EnumUserLicence),
1462
+ enum: Object.values(import_cluemart_shared14.EnumUserLicence),
1486
1463
  required: false,
1487
1464
  type: String
1488
1465
  },
@@ -1499,7 +1476,7 @@ var stripeSchema = new MongooseSchema12(
1499
1476
  type: Date
1500
1477
  },
1501
1478
  status: {
1502
- enum: Object.values(import_cluemart_shared13.EnumSubscriptionStatus),
1479
+ enum: Object.values(import_cluemart_shared14.EnumSubscriptionStatus),
1503
1480
  required: false,
1504
1481
  type: String
1505
1482
  },
@@ -1521,7 +1498,7 @@ var stripeSchema = new MongooseSchema12(
1521
1498
  var redeemedRewardSchema = new MongooseSchema12(
1522
1499
  {
1523
1500
  name: {
1524
- enum: Object.values(import_cluemart_shared13.EnumReward),
1501
+ enum: Object.values(import_cluemart_shared14.EnumReward),
1525
1502
  required: true,
1526
1503
  type: String
1527
1504
  },
@@ -1535,7 +1512,7 @@ var userOverallPointsSchema = new MongooseSchema12(
1535
1512
  createdAt: { required: true, type: Date },
1536
1513
  points: { default: 0, required: true, type: Number },
1537
1514
  pointType: {
1538
- enum: Object.values(import_cluemart_shared13.EnumPointType),
1515
+ enum: Object.values(import_cluemart_shared14.EnumPointType),
1539
1516
  required: true,
1540
1517
  type: String
1541
1518
  },
@@ -1563,7 +1540,7 @@ var schema12 = new MongooseSchema12(
1563
1540
  deletedAt: { default: null, required: false, type: Date },
1564
1541
  email: { required: true, type: String },
1565
1542
  emailSentFor: {
1566
- enum: Object.values(import_cluemart_shared13.EnumNotificationResourceType),
1543
+ enum: Object.values(import_cluemart_shared14.EnumNotificationResourceType),
1567
1544
  required: false,
1568
1545
  type: [String]
1569
1546
  },
@@ -1579,7 +1556,7 @@ var schema12 = new MongooseSchema12(
1579
1556
  type: import_mongoose16.default.Schema.Types.ObjectId
1580
1557
  },
1581
1558
  interests: {
1582
- enum: Object.values(import_cluemart_shared13.EnumResourceType),
1559
+ enum: Object.values(import_cluemart_shared14.EnumResourceType),
1583
1560
  required: false,
1584
1561
  type: [String]
1585
1562
  },
@@ -1606,7 +1583,7 @@ var schema12 = new MongooseSchema12(
1606
1583
  },
1607
1584
  password: { required: true, type: String },
1608
1585
  platform: {
1609
- enum: Object.values(import_cluemart_shared13.EnumOSPlatform),
1586
+ enum: Object.values(import_cluemart_shared14.EnumOSPlatform),
1610
1587
  required: false,
1611
1588
  type: String
1612
1589
  },
@@ -1627,8 +1604,8 @@ var schema12 = new MongooseSchema12(
1627
1604
  type: String
1628
1605
  },
1629
1606
  roles: {
1630
- default: [import_cluemart_shared13.EnumUserRole.CUSTOMER],
1631
- enum: Object.values(import_cluemart_shared13.EnumUserRole),
1607
+ default: [import_cluemart_shared14.EnumUserRole.CUSTOMER],
1608
+ enum: Object.values(import_cluemart_shared14.EnumUserRole),
1632
1609
  required: true,
1633
1610
  type: [String]
1634
1611
  },
@@ -1692,7 +1669,7 @@ var schema13 = new MongooseSchema13(
1692
1669
  var VerificationTokenModel = import_mongoose17.default.models.VerificationToken || import_mongoose17.default.model("VerificationToken", schema13);
1693
1670
 
1694
1671
  // src/mongoose/vendor/Vendor.ts
1695
- var import_cluemart_shared14 = require("@timardex/cluemart-shared");
1672
+ var import_cluemart_shared15 = require("@timardex/cluemart-shared");
1696
1673
  var import_mongoose18 = __toESM(require("mongoose"));
1697
1674
  var MongooseSchema14 = import_mongoose18.default.Schema;
1698
1675
  var vendorProductTypeSchema = new MongooseSchema14(
@@ -1717,7 +1694,7 @@ var calendarSchema = new MongooseSchema14(
1717
1694
  {
1718
1695
  dateTime: {
1719
1696
  dateStatus: {
1720
- enum: Object.values(import_cluemart_shared14.EnumEventDateStatus),
1697
+ enum: Object.values(import_cluemart_shared15.EnumEventDateStatus),
1721
1698
  required: false,
1722
1699
  type: String
1723
1700
  },
@@ -1784,7 +1761,7 @@ var schema14 = new MongooseSchema14(
1784
1761
  type: import_mongoose18.default.Schema.Types.ObjectId
1785
1762
  },
1786
1763
  vendorType: {
1787
- enum: Object.values(import_cluemart_shared14.EnumVendorType),
1764
+ enum: Object.values(import_cluemart_shared15.EnumVendorType),
1788
1765
  required: true,
1789
1766
  type: String
1790
1767
  }
@@ -1806,7 +1783,7 @@ schema14.plugin(searchNamePlugin);
1806
1783
  var VendorModel = import_mongoose18.default.models.Vendor || import_mongoose18.default.model("Vendor", schema14);
1807
1784
 
1808
1785
  // src/mongoose/vendor/VendorInfo.ts
1809
- var import_cluemart_shared15 = require("@timardex/cluemart-shared");
1786
+ var import_cluemart_shared16 = require("@timardex/cluemart-shared");
1810
1787
  var import_mongoose19 = __toESM(require("mongoose"));
1811
1788
  var MongooseSchema15 = import_mongoose19.default.Schema;
1812
1789
  var AttributesSchema = new MongooseSchema15(
@@ -1826,7 +1803,7 @@ var schema15 = new MongooseSchema15(
1826
1803
  documents: [ResourceImageTypeSchema],
1827
1804
  product: {
1828
1805
  foodFlavors: {
1829
- enum: Object.values(import_cluemart_shared15.EnumFoodFlavor),
1806
+ enum: Object.values(import_cluemart_shared16.EnumFoodFlavor),
1830
1807
  required: true,
1831
1808
  type: [String]
1832
1809
  },
@@ -1900,7 +1877,7 @@ schema16.index({ email: 1 });
1900
1877
  var UnregisteredVendorModel = import_mongoose20.default.models.UnregisteredVendor || import_mongoose20.default.model("UnregisteredVendor", schema16);
1901
1878
 
1902
1879
  // src/mongoose/event/Event.ts
1903
- var import_cluemart_shared16 = require("@timardex/cluemart-shared");
1880
+ var import_cluemart_shared17 = require("@timardex/cluemart-shared");
1904
1881
  var import_mongoose21 = __toESM(require("mongoose"));
1905
1882
  var MongooseSchema17 = import_mongoose21.default.Schema;
1906
1883
  var schema17 = new MongooseSchema17(
@@ -1915,7 +1892,7 @@ var schema17 = new MongooseSchema17(
1915
1892
  type: import_mongoose21.default.Schema.Types.ObjectId
1916
1893
  },
1917
1894
  eventType: {
1918
- enum: Object.values(import_cluemart_shared16.EnumEventType),
1895
+ enum: Object.values(import_cluemart_shared17.EnumEventType),
1919
1896
  required: true,
1920
1897
  type: String
1921
1898
  },
@@ -1966,7 +1943,7 @@ schema18.index({ eventId: 1 }, { unique: true });
1966
1943
  var EventDateArchiveModel = import_mongoose22.default.models.EventDateArchive || import_mongoose22.default.model("EventDateArchive", schema18);
1967
1944
 
1968
1945
  // src/mongoose/Partner.ts
1969
- var import_cluemart_shared17 = require("@timardex/cluemart-shared");
1946
+ var import_cluemart_shared18 = require("@timardex/cluemart-shared");
1970
1947
  var import_mongoose23 = __toESM(require("mongoose"));
1971
1948
  var MongooseSchema18 = import_mongoose23.default.Schema;
1972
1949
  var schema19 = new MongooseSchema18(
@@ -1978,7 +1955,7 @@ var schema19 = new MongooseSchema18(
1978
1955
  },
1979
1956
  nzbn: { required: true, type: String },
1980
1957
  partnerType: {
1981
- enum: Object.values(import_cluemart_shared17.EnumPartnerType),
1958
+ enum: Object.values(import_cluemart_shared18.EnumPartnerType),
1982
1959
  required: true,
1983
1960
  type: String
1984
1961
  }
@@ -1996,7 +1973,7 @@ schema19.plugin(searchNamePlugin);
1996
1973
  var PartnerModel = import_mongoose23.default.models.Partner || import_mongoose23.default.model("Partner", schema19);
1997
1974
 
1998
1975
  // src/mongoose/Post.ts
1999
- var import_cluemart_shared18 = require("@timardex/cluemart-shared");
1976
+ var import_cluemart_shared19 = require("@timardex/cluemart-shared");
2000
1977
  var import_mongoose24 = __toESM(require("mongoose"));
2001
1978
  var MongooseSchema19 = import_mongoose24.default.Schema;
2002
1979
  var contentSchema = new MongooseSchema19(
@@ -2004,7 +1981,7 @@ var contentSchema = new MongooseSchema19(
2004
1981
  contentData: import_mongoose24.Schema.Types.Mixed,
2005
1982
  contentOrder: { required: true, type: Number },
2006
1983
  contentType: {
2007
- enum: Object.values(import_cluemart_shared18.EnumPostContentType),
1984
+ enum: Object.values(import_cluemart_shared19.EnumPostContentType),
2008
1985
  required: true,
2009
1986
  type: String
2010
1987
  }
@@ -2017,7 +1994,7 @@ var resourceSchema = new MongooseSchema19(
2017
1994
  resourceRegion: { required: true, type: String },
2018
1995
  resourceSlug: { required: true, type: String },
2019
1996
  resourceType: {
2020
- enum: Object.values(import_cluemart_shared18.EnumResourceType),
1997
+ enum: Object.values(import_cluemart_shared19.EnumResourceType),
2021
1998
  required: true,
2022
1999
  type: String
2023
2000
  }
@@ -2040,7 +2017,7 @@ var schema20 = new MongooseSchema19(
2040
2017
  },
2041
2018
  deletedAt: { default: null, required: false, type: Date },
2042
2019
  postType: {
2043
- enum: Object.values(import_cluemart_shared18.EnumPostType),
2020
+ enum: Object.values(import_cluemart_shared19.EnumPostType),
2044
2021
  required: true,
2045
2022
  type: String
2046
2023
  },
@@ -2102,7 +2079,7 @@ var AppSettingSchema = new MongooseSchema20(
2102
2079
  var AppSettingModel = import_mongoose25.default.models.AppSetting || import_mongoose25.default.model("AppSetting", AppSettingSchema);
2103
2080
 
2104
2081
  // src/mongoose/game/Game.ts
2105
- var import_cluemart_shared19 = require("@timardex/cluemart-shared");
2082
+ var import_cluemart_shared20 = require("@timardex/cluemart-shared");
2106
2083
  var import_mongoose29 = __toESM(require("mongoose"));
2107
2084
 
2108
2085
  // src/mongoose/game/DailyClue.ts
@@ -2199,9 +2176,9 @@ var schemaPuzzleGameData = new MongooseSchema23(
2199
2176
  // src/mongoose/game/Game.ts
2200
2177
  var MongooseSchema24 = import_mongoose29.default.Schema;
2201
2178
  var gameDataSchemas = {
2202
- [import_cluemart_shared19.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
2203
- [import_cluemart_shared19.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
2204
- [import_cluemart_shared19.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
2179
+ [import_cluemart_shared20.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
2180
+ [import_cluemart_shared20.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
2181
+ [import_cluemart_shared20.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
2205
2182
  };
2206
2183
  var gameDataDefinition = Object.fromEntries(
2207
2184
  Object.entries(gameDataSchemas).map(([key, schema25]) => [
@@ -2214,13 +2191,13 @@ var gameHistorySchema = new MongooseSchema24(
2214
2191
  createdAt: { required: true, type: Date },
2215
2192
  gameDate: { required: true, type: schemaGameDate },
2216
2193
  gameStatus: {
2217
- enum: Object.values(import_cluemart_shared19.EnumGameStatus),
2194
+ enum: Object.values(import_cluemart_shared20.EnumGameStatus),
2218
2195
  required: true,
2219
2196
  type: String
2220
2197
  },
2221
2198
  gameTitle: { required: true, type: String },
2222
2199
  gameType: {
2223
- enum: Object.values(import_cluemart_shared19.EnumGameType),
2200
+ enum: Object.values(import_cluemart_shared20.EnumGameType),
2224
2201
  required: true,
2225
2202
  type: String
2226
2203
  },
@@ -2236,7 +2213,7 @@ var gameTypeSchema = new MongooseSchema24(
2236
2213
  gameHistory: { default: [], required: true, type: [gameHistorySchema] },
2237
2214
  gameTitle: { required: true, type: String },
2238
2215
  gameType: {
2239
- enum: Object.values(import_cluemart_shared19.EnumGameType),
2216
+ enum: Object.values(import_cluemart_shared20.EnumGameType),
2240
2217
  required: true,
2241
2218
  type: String
2242
2219
  },
@@ -2310,7 +2287,7 @@ schema22.index(
2310
2287
  var SchoolModel = import_mongoose30.default.models.School || import_mongoose30.default.model("School", schema22);
2311
2288
 
2312
2289
  // src/mongoose/Affiliate.ts
2313
- var import_cluemart_shared20 = require("@timardex/cluemart-shared");
2290
+ var import_cluemart_shared21 = require("@timardex/cluemart-shared");
2314
2291
  var import_mongoose31 = __toESM(require("mongoose"));
2315
2292
  var MongooseSchema26 = import_mongoose31.default.Schema;
2316
2293
  var affiliateRewardSchema = new MongooseSchema26(
@@ -2319,7 +2296,7 @@ var affiliateRewardSchema = new MongooseSchema26(
2319
2296
  redeemedAt: { default: null, required: false, type: Date },
2320
2297
  rewardDescription: { required: true, type: String },
2321
2298
  rewardType: {
2322
- enum: Object.values(import_cluemart_shared20.EnumAffiliateRewardType),
2299
+ enum: Object.values(import_cluemart_shared21.EnumAffiliateRewardType),
2323
2300
  required: true,
2324
2301
  type: String
2325
2302
  },
@@ -2341,7 +2318,7 @@ var affiliateResourceSchema = new MongooseSchema26(
2341
2318
  type: OwnerTypeSchema
2342
2319
  },
2343
2320
  resourceType: {
2344
- enum: Object.values(import_cluemart_shared20.EnumResourceType),
2321
+ enum: Object.values(import_cluemart_shared21.EnumResourceType),
2345
2322
  required: true,
2346
2323
  type: String
2347
2324
  },
@@ -2379,7 +2356,7 @@ var affiliateDetailsSchema = new MongooseSchema26(
2379
2356
  lastName: { required: true, type: String },
2380
2357
  location: { required: true, type: locationsSchema },
2381
2358
  participantType: {
2382
- enum: Object.values(import_cluemart_shared20.EnumAffiliateParticipantType),
2359
+ enum: Object.values(import_cluemart_shared21.EnumAffiliateParticipantType),
2383
2360
  required: true,
2384
2361
  type: String
2385
2362
  },
@@ -2436,7 +2413,7 @@ schema23.index(
2436
2413
  var AffiliateModel = import_mongoose31.default.models.Affiliate || import_mongoose31.default.model("Affiliate", schema23);
2437
2414
 
2438
2415
  // src/mongoose/Coupon.ts
2439
- var import_cluemart_shared21 = require("@timardex/cluemart-shared");
2416
+ var import_cluemart_shared22 = require("@timardex/cluemart-shared");
2440
2417
  var import_mongoose32 = __toESM(require("mongoose"));
2441
2418
  var MongooseSchema27 = import_mongoose32.default.Schema;
2442
2419
  var couponOptionSchema = new MongooseSchema27(
@@ -2445,7 +2422,7 @@ var couponOptionSchema = new MongooseSchema27(
2445
2422
  get: { required: false, type: Number },
2446
2423
  maxRewardCount: { required: false, type: Number },
2447
2424
  type: {
2448
- enum: Object.values(import_cluemart_shared21.EnumCouponQualificationType),
2425
+ enum: Object.values(import_cluemart_shared22.EnumCouponQualificationType),
2449
2426
  required: true,
2450
2427
  type: String
2451
2428
  },
@@ -2517,7 +2494,7 @@ var couponDataSchema = new MongooseSchema27(
2517
2494
  },
2518
2495
  resourceId: { required: true, type: String },
2519
2496
  resourceType: {
2520
- enum: Object.values(import_cluemart_shared21.EnumResourceType),
2497
+ enum: Object.values(import_cluemart_shared22.EnumResourceType),
2521
2498
  required: true,
2522
2499
  type: String
2523
2500
  },
@@ -2542,7 +2519,7 @@ schema24.index({ "couponData.participantUsers.userId": 1 });
2542
2519
  var CouponModel = import_mongoose32.default.models.Coupon || import_mongoose32.default.model("Coupon", schema24);
2543
2520
 
2544
2521
  // src/mongoose/Impersonation.ts
2545
- var import_cluemart_shared22 = require("@timardex/cluemart-shared");
2522
+ var import_cluemart_shared23 = require("@timardex/cluemart-shared");
2546
2523
  var import_mongoose33 = __toESM(require("mongoose"));
2547
2524
  var MongooseSchema28 = import_mongoose33.default.Schema;
2548
2525
  var impersonationSessionSchema = new MongooseSchema28(
@@ -2583,7 +2560,7 @@ var impersonationAuditSchema = new MongooseSchema28(
2583
2560
  type: import_mongoose33.default.Schema.Types.ObjectId
2584
2561
  },
2585
2562
  resourceId: { type: import_mongoose33.default.Schema.Types.ObjectId },
2586
- resourceType: { enum: Object.values(import_cluemart_shared22.EnumResourceType), type: String },
2563
+ resourceType: { enum: Object.values(import_cluemart_shared23.EnumResourceType), type: String },
2587
2564
  sessionId: {
2588
2565
  ref: "ImpersonationSession",
2589
2566
  required: true,
@@ -2613,7 +2590,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
2613
2590
  }
2614
2591
 
2615
2592
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2616
- var import_cluemart_shared24 = require("@timardex/cluemart-shared");
2593
+ var import_cluemart_shared25 = require("@timardex/cluemart-shared");
2617
2594
  var import_utils3 = require("@timardex/cluemart-shared/utils");
2618
2595
 
2619
2596
  // src/service/saveNotificationsInDb.ts
@@ -2748,7 +2725,7 @@ async function sendPushNotifications({
2748
2725
  }
2749
2726
 
2750
2727
  // src/service/affiliate/vendorSubscriptionRewards.ts
2751
- var import_cluemart_shared23 = require("@timardex/cluemart-shared");
2728
+ var import_cluemart_shared24 = require("@timardex/cluemart-shared");
2752
2729
  var import_dayjs = __toESM(require("dayjs"));
2753
2730
  var import_timezone = __toESM(require("dayjs/plugin/timezone"));
2754
2731
  var import_utc = __toESM(require("dayjs/plugin/utc"));
@@ -2767,7 +2744,7 @@ var PRO_PLANS = /* @__PURE__ */ new Set([
2767
2744
  ...PRO_EVENT_PLANS,
2768
2745
  ...PRO_VENDOR_PLANS
2769
2746
  ]);
2770
- async function getPayingStripePlanFor(userId, now, payingPlans) {
2747
+ async function getStripePlanFor(userId, now, allowedPlans, requirePaidAccess = true) {
2771
2748
  const user = await UserModel.findById(userId).select("licences stripe").lean().exec();
2772
2749
  if (!user) {
2773
2750
  return { hasSubscription: false, plan: null, validTypes: /* @__PURE__ */ new Set() };
@@ -2782,38 +2759,41 @@ async function getPayingStripePlanFor(userId, now, payingPlans) {
2782
2759
  if (stripe == null || stripe.subscriptionId == null) {
2783
2760
  return { hasSubscription: false, plan: null, validTypes };
2784
2761
  }
2785
- const hasActiveStatus = stripe.status === import_enums2.EnumSubscriptionStatus.ACTIVE;
2762
+ const hasActiveStatus = stripe.status === import_enums2.EnumSubscriptionStatus.ACTIVE || !requirePaidAccess && stripe.status === import_enums2.EnumSubscriptionStatus.TRIALING;
2786
2763
  const paidThrough = stripe.endDate ? new Date(stripe.endDate).getTime() : Number.NaN;
2787
- if (!hasActiveStatus || !Number.isFinite(paidThrough) || paidThrough <= now.getTime() || stripe.currentPlan == null) {
2764
+ if (!hasActiveStatus || requirePaidAccess && (!Number.isFinite(paidThrough) || paidThrough <= now.getTime()) || stripe.currentPlan == null) {
2788
2765
  return { hasSubscription: false, plan: null, validTypes };
2789
2766
  }
2790
- const plan = payingPlans.has(stripe.currentPlan) ? stripe.currentPlan : null;
2767
+ const plan = allowedPlans.has(stripe.currentPlan) ? stripe.currentPlan : null;
2791
2768
  return { hasSubscription: plan != null, plan, validTypes };
2792
2769
  }
2793
2770
  async function getPayingStripeSubscriptionPlan(userId, now = /* @__PURE__ */ new Date()) {
2794
- return getPayingStripePlanFor(userId, now, PRO_PLANS);
2771
+ return getStripePlanFor(userId, now, PRO_PLANS);
2795
2772
  }
2796
2773
  async function getPayingVendorStripeSubscriptionPlan(userId, now = /* @__PURE__ */ new Date()) {
2797
- return getPayingStripePlanFor(userId, now, PRO_VENDOR_PLANS);
2774
+ return getStripePlanFor(userId, now, PRO_VENDOR_PLANS);
2775
+ }
2776
+ async function getVendorStripeSubscriptionPlanForRewards(userId, now = /* @__PURE__ */ new Date()) {
2777
+ return getStripePlanFor(userId, now, PRO_VENDOR_PLANS, false);
2798
2778
  }
2799
2779
  async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ */ new Date()) {
2800
- return getPayingStripePlanFor(userId, now, PRO_EVENT_PLANS);
2780
+ return getStripePlanFor(userId, now, PRO_EVENT_PLANS);
2801
2781
  }
2802
2782
 
2803
2783
  // src/service/affiliate/vendorSubscriptionRewards.ts
2804
2784
  import_dayjs.default.extend(import_utc.default);
2805
2785
  import_dayjs.default.extend(import_timezone.default);
2806
- var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
2786
+ var SUBSCRIPTION_REWARD_TIMEZONE = import_cluemart_shared24.NZ_TZ;
2807
2787
  async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
2808
- const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
2809
- if (validTypes.has(import_cluemart_shared23.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared23.EnumUserLicence.PRO_PLUS_VENDOR)) {
2788
+ const { hasSubscription, validTypes } = await getVendorStripeSubscriptionPlanForRewards(userId, now);
2789
+ if (validTypes.has(import_cluemart_shared24.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared24.EnumUserLicence.PRO_PLUS_VENDOR)) {
2810
2790
  if (hasSubscription) {
2811
- return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
2791
+ return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
2812
2792
  }
2813
- return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2793
+ return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2814
2794
  }
2815
- if (validTypes.has(import_cluemart_shared23.EnumUserLicence.STANDARD_VENDOR)) {
2816
- return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2795
+ if (validTypes.has(import_cluemart_shared24.EnumUserLicence.STANDARD_VENDOR)) {
2796
+ return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2817
2797
  }
2818
2798
  return null;
2819
2799
  }
@@ -2825,7 +2805,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
2825
2805
 
2826
2806
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2827
2807
  function isEligibleVendorResource(resource) {
2828
- return resource.resourceType === import_cluemart_shared24.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2808
+ return resource.resourceType === import_cluemart_shared25.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2829
2809
  }
2830
2810
  async function findAffiliatesWithActiveVendorReferrals() {
2831
2811
  return await AffiliateModel.find({
@@ -2834,7 +2814,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
2834
2814
  $elemMatch: {
2835
2815
  resourceActive: true,
2836
2816
  resourceDeletedAt: null,
2837
- resourceType: import_cluemart_shared24.EnumResourceType.VENDOR
2817
+ resourceType: import_cluemart_shared25.EnumResourceType.VENDOR
2838
2818
  }
2839
2819
  },
2840
2820
  deletedAt: null
@@ -2868,11 +2848,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
2868
2848
  data: {
2869
2849
  resourceId: String(affiliateId),
2870
2850
  resourceName: resourceNames.join(", "),
2871
- resourceType: import_cluemart_shared24.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
2851
+ resourceType: import_cluemart_shared25.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
2872
2852
  },
2873
2853
  message,
2874
2854
  title: "Affiliate points earned",
2875
- type: import_cluemart_shared24.EnumNotificationType.SYSTEM,
2855
+ type: import_cluemart_shared25.EnumNotificationType.SYSTEM,
2876
2856
  userIds: [affiliateOwnerUserId]
2877
2857
  };
2878
2858
  try {
@@ -2901,7 +2881,7 @@ async function tryAwardSubscriptionReward({
2901
2881
  resourceActive: true,
2902
2882
  resourceDeletedAt: null,
2903
2883
  resourceId: resource.resourceId,
2904
- resourceType: import_cluemart_shared24.EnumResourceType.VENDOR,
2884
+ resourceType: import_cluemart_shared25.EnumResourceType.VENDOR,
2905
2885
  rewards: {
2906
2886
  $not: {
2907
2887
  $elemMatch: {
@@ -3096,9 +3076,9 @@ async function notifyUsers({
3096
3076
  }
3097
3077
 
3098
3078
  // src/service/updateAdStatus.ts
3099
- var import_cluemart_shared25 = require("@timardex/cluemart-shared");
3079
+ var import_cluemart_shared26 = require("@timardex/cluemart-shared");
3100
3080
  async function updateAdStatuses() {
3101
- const now = /* @__PURE__ */ new Date();
3081
+ const now = (0, import_cluemart_shared26.nzDayKey)();
3102
3082
  const invalidResult = await AdModel.updateMany(
3103
3083
  {
3104
3084
  $or: [
@@ -3106,50 +3086,50 @@ async function updateAdStatuses() {
3106
3086
  { end: { $exists: false } },
3107
3087
  { $expr: { $gt: ["$start", "$end"] } }
3108
3088
  ],
3109
- status: { $ne: import_cluemart_shared25.EnumAdStatus.PAUSED }
3089
+ status: { $ne: import_cluemart_shared26.EnumAdStatus.PAUSED }
3110
3090
  },
3111
- { $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
3091
+ { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3112
3092
  );
3113
3093
  const expiredResult = await AdModel.updateMany(
3114
- { end: { $lte: now }, status: { $ne: import_cluemart_shared25.EnumAdStatus.EXPIRED } },
3115
- { $set: { status: import_cluemart_shared25.EnumAdStatus.EXPIRED } }
3094
+ { end: { $lte: now }, status: { $ne: import_cluemart_shared26.EnumAdStatus.EXPIRED } },
3095
+ { $set: { status: import_cluemart_shared26.EnumAdStatus.EXPIRED } }
3116
3096
  );
3117
3097
  const eligibleBooking = {
3118
3098
  $or: [
3119
3099
  { bookingKind: { $exists: false } },
3120
3100
  { bookingKind: null },
3121
3101
  {
3122
- approvalStatus: import_cluemart_shared25.EnumAdApprovalStatus.APPROVED,
3123
- bookingKind: import_cluemart_shared25.EnumAdBookingSlotKind.RESERVED
3102
+ approvalStatus: import_cluemart_shared26.EnumAdApprovalStatus.APPROVED,
3103
+ bookingKind: import_cluemart_shared26.EnumAdBookingSlotKind.RESERVED
3124
3104
  },
3125
3105
  {
3126
- approvalStatus: import_cluemart_shared25.EnumAdApprovalStatus.APPROVED,
3127
- bookingKind: import_cluemart_shared25.EnumAdBookingSlotKind.PAID,
3128
- paymentStatus: import_cluemart_shared25.EnumAdPaymentStatus.PAID
3106
+ approvalStatus: import_cluemart_shared26.EnumAdApprovalStatus.APPROVED,
3107
+ bookingKind: import_cluemart_shared26.EnumAdBookingSlotKind.PAID,
3108
+ paymentStatus: import_cluemart_shared26.EnumAdPaymentStatus.PAID
3129
3109
  }
3130
3110
  ]
3131
3111
  };
3132
3112
  const awaitingApprovalResult = await AdModel.updateMany(
3133
3113
  {
3134
3114
  $nor: eligibleBooking.$or,
3135
- bookingKind: { $in: Object.values(import_cluemart_shared25.EnumAdBookingSlotKind) },
3115
+ bookingKind: { $in: Object.values(import_cluemart_shared26.EnumAdBookingSlotKind) },
3136
3116
  end: { $gt: now },
3137
- status: import_cluemart_shared25.EnumAdStatus.ACTIVE
3117
+ status: import_cluemart_shared26.EnumAdStatus.ACTIVE
3138
3118
  },
3139
- { $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
3119
+ { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3140
3120
  );
3141
3121
  const activeResult = await AdModel.updateMany(
3142
3122
  {
3143
3123
  end: { $gt: now },
3144
3124
  start: { $lte: now },
3145
- status: { $ne: import_cluemart_shared25.EnumAdStatus.ACTIVE },
3125
+ status: { $ne: import_cluemart_shared26.EnumAdStatus.ACTIVE },
3146
3126
  ...eligibleBooking
3147
3127
  },
3148
- { $set: { status: import_cluemart_shared25.EnumAdStatus.ACTIVE } }
3128
+ { $set: { status: import_cluemart_shared26.EnumAdStatus.ACTIVE } }
3149
3129
  );
3150
3130
  const pausedResult = await AdModel.updateMany(
3151
- { start: { $gt: now }, status: { $ne: import_cluemart_shared25.EnumAdStatus.PAUSED } },
3152
- { $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
3131
+ { start: { $gt: now }, status: { $ne: import_cluemart_shared26.EnumAdStatus.PAUSED } },
3132
+ { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3153
3133
  );
3154
3134
  console.log(
3155
3135
  `\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, awaitingApproval=${awaitingApprovalResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
@@ -3359,19 +3339,19 @@ function buildUserPointEntryRemovalPipeline(pointType, sourceId) {
3359
3339
  }
3360
3340
 
3361
3341
  // src/service/event/updateAllEventDateTimeStatuses.ts
3362
- var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3342
+ var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3363
3343
  var import_dayjs4 = __toESM(require("dayjs"));
3364
3344
 
3365
3345
  // src/service/event/archiveEndedEventDates.ts
3366
- var import_cluemart_shared26 = require("@timardex/cluemart-shared");
3346
+ var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3367
3347
  var import_dayjs3 = __toESM(require("dayjs"));
3368
3348
  var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
3369
3349
  import_dayjs3.default.extend(import_customParseFormat.default);
3370
3350
  var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
3371
- import_cluemart_shared26.EnumEventDateStatus.ENDED
3351
+ import_cluemart_shared27.EnumEventDateStatus.ENDED
3372
3352
  ]);
3373
3353
  var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
3374
- import_cluemart_shared26.EnumEventDateStatus.INVALID
3354
+ import_cluemart_shared27.EnumEventDateStatus.INVALID
3375
3355
  ]);
3376
3356
  function splitEventDatesForArchive(dateTime) {
3377
3357
  return {
@@ -3394,12 +3374,12 @@ function dedupeArchivedSlotsByStartDateTime(slots) {
3394
3374
  });
3395
3375
  }
3396
3376
  function isPastCanceledEventDate(slot, now) {
3397
- if (slot.dateStatus !== import_cluemart_shared26.EnumEventDateStatus.CANCELED) {
3377
+ if (slot.dateStatus !== import_cluemart_shared27.EnumEventDateStatus.CANCELED) {
3398
3378
  return false;
3399
3379
  }
3400
3380
  const endDateTime = (0, import_dayjs3.default)(
3401
3381
  `${slot.endDate} ${slot.endTime}`,
3402
- `${import_cluemart_shared26.dateFormat} ${import_cluemart_shared26.timeFormat}`,
3382
+ `${import_cluemart_shared27.dateFormat} ${import_cluemart_shared27.timeFormat}`,
3403
3383
  true
3404
3384
  );
3405
3385
  return endDateTime.isValid() && endDateTime.isBefore(now);
@@ -3445,7 +3425,7 @@ async function updateModelDateTimeStatuses(model, now) {
3445
3425
  try {
3446
3426
  for await (const doc of cursor) {
3447
3427
  const dateTime = doc.dateTime.map(
3448
- (slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
3428
+ (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3449
3429
  );
3450
3430
  if (!hasDateTimeStatusChanges(doc.dateTime, dateTime)) {
3451
3431
  continue;
@@ -3469,9 +3449,9 @@ async function updateModelDateTimeStatuses(model, now) {
3469
3449
  var ARCHIVABLE_EVENT_FILTER = {
3470
3450
  "dateTime.dateStatus": {
3471
3451
  $in: [
3472
- import_cluemart_shared27.EnumEventDateStatus.ENDED,
3473
- import_cluemart_shared27.EnumEventDateStatus.INVALID,
3474
- import_cluemart_shared27.EnumEventDateStatus.CANCELED
3452
+ import_cluemart_shared28.EnumEventDateStatus.ENDED,
3453
+ import_cluemart_shared28.EnumEventDateStatus.INVALID,
3454
+ import_cluemart_shared28.EnumEventDateStatus.CANCELED
3475
3455
  ]
3476
3456
  },
3477
3457
  deletedAt: null
@@ -3496,7 +3476,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
3496
3476
  try {
3497
3477
  for await (const doc of cursor) {
3498
3478
  const updated = doc.dateTime.map(
3499
- (slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
3479
+ (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3500
3480
  );
3501
3481
  const { archive, discard } = splitEventDatesForArchive(updated);
3502
3482
  const pastCanceled = updated.filter(
@@ -3520,13 +3500,13 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
3520
3500
  if (archive.length > 0 || discard.length > 0) {
3521
3501
  pullConditions.push({
3522
3502
  dateStatus: {
3523
- $in: [import_cluemart_shared27.EnumEventDateStatus.ENDED, import_cluemart_shared27.EnumEventDateStatus.INVALID]
3503
+ $in: [import_cluemart_shared28.EnumEventDateStatus.ENDED, import_cluemart_shared28.EnumEventDateStatus.INVALID]
3524
3504
  }
3525
3505
  });
3526
3506
  }
3527
3507
  for (const slot of pastCanceled) {
3528
3508
  pullConditions.push({
3529
- dateStatus: import_cluemart_shared27.EnumEventDateStatus.CANCELED,
3509
+ dateStatus: import_cluemart_shared28.EnumEventDateStatus.CANCELED,
3530
3510
  startDate: slot.startDate,
3531
3511
  startTime: slot.startTime
3532
3512
  });
@@ -3568,9 +3548,9 @@ async function cleanEventInfoDates(now) {
3568
3548
  try {
3569
3549
  for await (const doc of cursor) {
3570
3550
  const updated = doc.dateTime.map(
3571
- (slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
3551
+ (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3572
3552
  );
3573
- const kept = (0, import_cluemart_shared27.filterDatesByFutureStatus)(updated);
3553
+ const kept = (0, import_cluemart_shared28.filterDatesByFutureStatus)(updated);
3574
3554
  if (kept.length === updated.length) {
3575
3555
  continue;
3576
3556
  }
@@ -3616,7 +3596,7 @@ async function updateAllEventDateTimeStatuses() {
3616
3596
  }
3617
3597
 
3618
3598
  // src/service/index.ts
3619
- var import_cluemart_shared35 = require("@timardex/cluemart-shared");
3599
+ var import_cluemart_shared36 = require("@timardex/cluemart-shared");
3620
3600
 
3621
3601
  // src/service/event/findEventOrImportedMarketById.ts
3622
3602
  async function findEventOrImportedMarketById(resourceId) {
@@ -3632,7 +3612,7 @@ async function findEventOrImportedMarketById(resourceId) {
3632
3612
  }
3633
3613
 
3634
3614
  // src/service/relations.ts
3635
- var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3615
+ var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3636
3616
  function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
3637
3617
  if (!previousDateTime?.length) {
3638
3618
  return false;
@@ -3648,19 +3628,19 @@ function didRemoveAnyStartedDates(previousDateTime, nextDateTime) {
3648
3628
  return false;
3649
3629
  }
3650
3630
  return previousDateTime.some(
3651
- (prev) => prev.dateStatus === import_cluemart_shared28.EnumEventDateStatus.STARTED && !nextDateTime?.some(
3652
- (next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared28.EnumEventDateStatus.STARTED
3631
+ (prev) => prev.dateStatus === import_cluemart_shared29.EnumEventDateStatus.STARTED && !nextDateTime?.some(
3632
+ (next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared29.EnumEventDateStatus.STARTED
3653
3633
  )
3654
3634
  );
3655
3635
  }
3656
- function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
3636
+ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
3657
3637
  return relationDates.map((relationDate) => {
3658
3638
  const existsInEvent = eventDateTime?.some(
3659
3639
  (dt) => dt.startDate === relationDate.dateTime.startDate && dt.startTime === relationDate.dateTime.startTime
3660
3640
  ) ?? false;
3661
3641
  return {
3662
3642
  ...relationDate,
3663
- status: existsInEvent ? relationDate.status : import_cluemart_shared28.EnumInviteStatus.UNAVAILABLE
3643
+ status: existsInEvent ? relationDate.status : import_cluemart_shared29.EnumInviteStatus.CANCELED
3664
3644
  };
3665
3645
  });
3666
3646
  }
@@ -3669,15 +3649,15 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
3669
3649
  var import_dayjs8 = __toESM(require("dayjs"));
3670
3650
 
3671
3651
  // src/service/license/compliance/utils.ts
3672
- var import_cluemart_shared33 = require("@timardex/cluemart-shared");
3652
+ var import_cluemart_shared34 = require("@timardex/cluemart-shared");
3673
3653
  var import_dayjs7 = __toESM(require("dayjs"));
3674
3654
 
3675
3655
  // src/service/license/compliance/event.ts
3676
- var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3656
+ var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3677
3657
  var eventLicences = [
3678
- import_cluemart_shared29.EnumUserLicence.STANDARD_EVENT,
3679
- import_cluemart_shared29.EnumUserLicence.PRO_EVENT,
3680
- import_cluemart_shared29.EnumUserLicence.PRO_PLUS_EVENT
3658
+ import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT,
3659
+ import_cluemart_shared30.EnumUserLicence.PRO_EVENT,
3660
+ import_cluemart_shared30.EnumUserLicence.PRO_PLUS_EVENT
3681
3661
  ];
3682
3662
  async function handleEventLicenceCompliance(user, now) {
3683
3663
  if (!user.licences || !user.events?.length) {
@@ -3889,9 +3869,9 @@ function buildLicenceExpiryPipeline(params) {
3889
3869
  }
3890
3870
 
3891
3871
  // src/service/license/compliance/partner.ts
3892
- var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3872
+ var import_cluemart_shared31 = require("@timardex/cluemart-shared");
3893
3873
  var partnerLicences = [
3894
- import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER
3874
+ import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER
3895
3875
  ];
3896
3876
  async function handlePartnerLicenceCompliance(user, now) {
3897
3877
  if (!user.licences || !user.partner) {
@@ -3901,11 +3881,11 @@ async function handlePartnerLicenceCompliance(user, now) {
3901
3881
  }
3902
3882
 
3903
3883
  // src/service/license/compliance/vendor.ts
3904
- var import_cluemart_shared32 = require("@timardex/cluemart-shared");
3884
+ var import_cluemart_shared33 = require("@timardex/cluemart-shared");
3905
3885
  var import_dayjs6 = __toESM(require("dayjs"));
3906
3886
 
3907
3887
  // src/service/license/models.ts
3908
- var import_cluemart_shared31 = require("@timardex/cluemart-shared");
3888
+ var import_cluemart_shared32 = require("@timardex/cluemart-shared");
3909
3889
  var import_dayjs5 = __toESM(require("dayjs"));
3910
3890
  var import_graphql = require("graphql");
3911
3891
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
@@ -3917,31 +3897,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
3917
3897
  return LicenceCategory2;
3918
3898
  })(LicenceCategory || {});
3919
3899
  var licenceCategoryMapping = {
3920
- [import_cluemart_shared31.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
3921
- [import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
3922
- [import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
3923
- [import_cluemart_shared31.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
3924
- [import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
3925
- [import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
3926
- [import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
3927
- [import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
3928
- [import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
3900
+ [import_cluemart_shared32.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
3901
+ [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
3902
+ [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
3903
+ [import_cluemart_shared32.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
3904
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
3905
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
3906
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
3907
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
3908
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
3929
3909
  };
3930
3910
  var licencePriority = {
3931
- [import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT]: 3,
3932
- [import_cluemart_shared31.EnumUserLicence.PRO_EVENT]: 2,
3933
- [import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT]: 1,
3934
- [import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
3935
- [import_cluemart_shared31.EnumUserLicence.PRO_VENDOR]: 2,
3936
- [import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR]: 1,
3937
- [import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER]: 1,
3938
- [import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE]: 1,
3939
- [import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL]: 1
3911
+ [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_EVENT]: 3,
3912
+ [import_cluemart_shared32.EnumUserLicence.PRO_EVENT]: 2,
3913
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT]: 1,
3914
+ [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
3915
+ [import_cluemart_shared32.EnumUserLicence.PRO_VENDOR]: 2,
3916
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR]: 1,
3917
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER]: 1,
3918
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE]: 1,
3919
+ [import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL]: 1
3940
3920
  };
3941
3921
  var standardLicences = [
3942
- import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR,
3943
- import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
3944
- import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER
3922
+ import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR,
3923
+ import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT,
3924
+ import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER
3945
3925
  ];
3946
3926
  var standardLicenceSet = new Set(standardLicences);
3947
3927
  function isStandardLicence(licence) {
@@ -3955,11 +3935,11 @@ var categoryRegexMapping = {
3955
3935
  ["school" /* SCHOOL */]: /_school$/
3956
3936
  };
3957
3937
  var categoryFallbackLicence = {
3958
- ["event" /* EVENT */]: import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
3959
- ["partner" /* PARTNER */]: import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER,
3960
- ["vendor" /* VENDOR */]: import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR,
3961
- ["affiliate" /* AFFILIATE */]: import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE,
3962
- ["school" /* SCHOOL */]: import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL
3938
+ ["event" /* EVENT */]: import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT,
3939
+ ["partner" /* PARTNER */]: import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER,
3940
+ ["vendor" /* VENDOR */]: import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR,
3941
+ ["affiliate" /* AFFILIATE */]: import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE,
3942
+ ["school" /* SCHOOL */]: import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL
3963
3943
  };
3964
3944
  var LicenceFilterInput = {
3965
3945
  INPUT_USER_LICENCES: "$licences"
@@ -3989,11 +3969,11 @@ function getHighestLicenceForCategory(licences, category) {
3989
3969
  function createLicenceObject(expiryDate, licenceType) {
3990
3970
  const today = (0, import_dayjs5.default)();
3991
3971
  const expiryDateMapping = {
3992
- [import_cluemart_shared31.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
3993
- [import_cluemart_shared31.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
3994
- [import_cluemart_shared31.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
3995
- [import_cluemart_shared31.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
3996
- [import_cluemart_shared31.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
3972
+ [import_cluemart_shared32.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
3973
+ [import_cluemart_shared32.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
3974
+ [import_cluemart_shared32.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
3975
+ [import_cluemart_shared32.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
3976
+ [import_cluemart_shared32.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
3997
3977
  };
3998
3978
  const licenceObject = {
3999
3979
  expiryDate: expiryDateMapping[expiryDate],
@@ -4097,13 +4077,13 @@ async function checkOwnerHasLicence({
4097
4077
  const owner = await UserModel.findById(userId);
4098
4078
  if (!owner) throw new import_graphql.GraphQLError("Owner not found");
4099
4079
  const categoryByResource = {
4100
- [import_cluemart_shared31.EnumResourceType.EVENT]: "event" /* EVENT */,
4101
- [import_cluemart_shared31.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
4102
- [import_cluemart_shared31.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
4103
- [import_cluemart_shared31.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
4104
- [import_cluemart_shared31.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
4080
+ [import_cluemart_shared32.EnumResourceType.EVENT]: "event" /* EVENT */,
4081
+ [import_cluemart_shared32.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
4082
+ [import_cluemart_shared32.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
4083
+ [import_cluemart_shared32.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
4084
+ [import_cluemart_shared32.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
4105
4085
  };
4106
- if (!(0, import_cluemart_shared31.isNonVisitorResourceType)(resourceType)) {
4086
+ if (!(0, import_cluemart_shared32.isNonVisitorResourceType)(resourceType)) {
4107
4087
  throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
4108
4088
  }
4109
4089
  const requiredCategory = categoryByResource[resourceType];
@@ -4183,7 +4163,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
4183
4163
  return (result?.matchedCount ?? 0) > 0;
4184
4164
  }
4185
4165
  async function downgradeVendorProFeatures(userId, licenceType) {
4186
- const isStandardVendor = licenceType === import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR;
4166
+ const isStandardVendor = licenceType === import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR;
4187
4167
  if (!isStandardVendor) {
4188
4168
  return;
4189
4169
  }
@@ -4230,7 +4210,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
4230
4210
  return (result?.matchedCount ?? 0) > 0;
4231
4211
  }
4232
4212
  async function restoreVendorProFeatures(userId, licenceType) {
4233
- const isProVendor = licenceType === import_cluemart_shared32.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR;
4213
+ const isProVendor = licenceType === import_cluemart_shared33.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR;
4234
4214
  if (!isProVendor) {
4235
4215
  return;
4236
4216
  }
@@ -4251,14 +4231,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
4251
4231
  return false;
4252
4232
  }
4253
4233
  const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs6.default)(stripe.paymentGracePeriodEndsAt) : null;
4254
- 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);
4234
+ const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared33.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared33.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
4255
4235
  if (hasActivePaymentGracePeriod) {
4256
4236
  return true;
4257
4237
  }
4258
4238
  if (!stripe.subscriptionId) {
4259
4239
  return false;
4260
4240
  }
4261
- if (stripe.status !== import_cluemart_shared32.EnumSubscriptionStatus.ACTIVE) {
4241
+ if (stripe.status !== import_cluemart_shared33.EnumSubscriptionStatus.ACTIVE) {
4262
4242
  return false;
4263
4243
  }
4264
4244
  if (!stripe.endDate) {
@@ -4278,7 +4258,7 @@ async function handleVendorLicenceCompliance(user, now) {
4278
4258
  return;
4279
4259
  }
4280
4260
  const proLicences = vendorLicencesOfUser.filter(
4281
- (licence) => licence.licenceType !== import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR
4261
+ (licence) => licence.licenceType !== import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
4282
4262
  );
4283
4263
  const expiredProLicences = proLicences.filter(
4284
4264
  (licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now)
@@ -4291,7 +4271,7 @@ async function handleVendorLicenceCompliance(user, now) {
4291
4271
  const expiredProLicence = expiredProLicences.some(
4292
4272
  (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
4293
4273
  );
4294
- const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared32.vendorLicences, now);
4274
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared33.vendorLicences, now);
4295
4275
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
4296
4276
  (licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
4297
4277
  );
@@ -4307,7 +4287,7 @@ async function handleVendorLicenceCompliance(user, now) {
4307
4287
  "owner.userId": user._id
4308
4288
  }).lean().exec();
4309
4289
  }
4310
- const licencesToSync = import_cluemart_shared32.vendorLicences.filter(
4290
+ const licencesToSync = import_cluemart_shared33.vendorLicences.filter(
4311
4291
  (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
4312
4292
  );
4313
4293
  await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
@@ -4322,11 +4302,11 @@ async function handleVendorLicenceCompliance(user, now) {
4322
4302
  data: {
4323
4303
  resourceId: String(vendor._id),
4324
4304
  resourceName: vendor.name,
4325
- resourceType: import_cluemart_shared32.EnumNotificationResourceType.DOWNGRADED_VENDOR
4305
+ resourceType: import_cluemart_shared33.EnumNotificationResourceType.DOWNGRADED_VENDOR
4326
4306
  },
4327
4307
  message: `Your Vendor licence has been downgraded due to licence expiration.`,
4328
4308
  title: `Vendor Licence Downgraded`,
4329
- type: import_cluemart_shared32.EnumNotificationType.SYSTEM,
4309
+ type: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4330
4310
  userIds: [user._id]
4331
4311
  };
4332
4312
  await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
@@ -4359,7 +4339,7 @@ async function vendorOwnerHasProLicence(vendorId) {
4359
4339
  effectiveVendorLicences,
4360
4340
  "vendor" /* VENDOR */
4361
4341
  );
4362
- return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared32.EnumUserLicence.PRO_VENDOR];
4342
+ return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared33.EnumUserLicence.PRO_VENDOR];
4363
4343
  }
4364
4344
 
4365
4345
  // src/service/license/compliance/utils.ts
@@ -4369,12 +4349,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
4369
4349
  const pipeline = buildLicenceExpiryPipeline({
4370
4350
  downgradeBranches: [
4371
4351
  {
4372
- case: import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR,
4373
- then: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
4352
+ case: import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR,
4353
+ then: import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
4374
4354
  },
4375
4355
  {
4376
- case: import_cluemart_shared33.EnumUserLicence.PRO_VENDOR,
4377
- then: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
4356
+ case: import_cluemart_shared34.EnumUserLicence.PRO_VENDOR,
4357
+ then: import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
4378
4358
  }
4379
4359
  ],
4380
4360
  licenceTypes,
@@ -4503,7 +4483,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
4503
4483
  var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
4504
4484
 
4505
4485
  // src/service/license/reminder/utils.ts
4506
- var import_cluemart_shared34 = require("@timardex/cluemart-shared");
4486
+ var import_cluemart_shared35 = require("@timardex/cluemart-shared");
4507
4487
  var import_utils8 = require("@timardex/cluemart-shared/utils");
4508
4488
  var import_dayjs9 = __toESM(require("dayjs"));
4509
4489
 
@@ -4569,28 +4549,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
4569
4549
  return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
4570
4550
  }
4571
4551
  function getLicenseName(licenceType) {
4572
- return import_cluemart_shared34.licenseNiceNames[licenceType] || licenceType;
4552
+ return import_cluemart_shared35.licenseNiceNames[licenceType] || licenceType;
4573
4553
  }
4574
4554
  function getNotificationTypes(isVendorLicense, isPartnerLicense) {
4575
4555
  if (isVendorLicense) {
4576
4556
  return {
4577
- notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
4578
- resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4557
+ notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4558
+ resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4579
4559
  };
4580
4560
  }
4581
4561
  if (isPartnerLicense) {
4582
4562
  return {
4583
- notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
4584
- resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4563
+ notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4564
+ resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4585
4565
  };
4586
4566
  }
4587
4567
  return {
4588
- notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
4589
- resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4568
+ notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4569
+ resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4590
4570
  };
4591
4571
  }
4592
4572
  async function getLicenseResourceInfo(user, licence) {
4593
- const isVendorLicense = import_cluemart_shared34.vendorLicences.includes(licence.licenceType);
4573
+ const isVendorLicense = import_cluemart_shared35.vendorLicences.includes(licence.licenceType);
4594
4574
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
4595
4575
  const licenceName = getLicenseName(licence.licenceType);
4596
4576
  const { notificationType, resourceType } = getNotificationTypes(
@@ -4638,11 +4618,11 @@ async function getLicenseResourceInfo(user, licence) {
4638
4618
  };
4639
4619
  }
4640
4620
  function getLicenceExpiryMode(licenceType) {
4641
- return licenceType === import_cluemart_shared34.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4621
+ return licenceType === import_cluemart_shared35.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared35.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4642
4622
  }
4643
4623
  async function sendLicenseReminder(user, licence) {
4644
4624
  const licenceName = getLicenseName(licence.licenceType);
4645
- const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared34.dateFormat);
4625
+ const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared35.dateFormat);
4646
4626
  const userId = String(user._id);
4647
4627
  const resourceInfo = await getLicenseResourceInfo(user, licence);
4648
4628
  if (!resourceInfo) {
@@ -4833,7 +4813,7 @@ async function remindUsersAboutLicenseExpiration() {
4833
4813
  syncUserLicencesAfterExpiry,
4834
4814
  updateAdStatuses,
4835
4815
  updateAllEventDateTimeStatuses,
4836
- updateRelationDatesToUnavailable,
4816
+ updateRelationDatesToCanceled,
4837
4817
  updateSingleDateTimeStatus,
4838
4818
  upgradeUserToLicence,
4839
4819
  vendorOwnerHasProLicence