@timardex/cluemart-server-shared 1.0.310 → 1.1.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.
@@ -1,8 +1,8 @@
1
- import * as mongoose from 'mongoose';
2
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
3
- import { PromoCodeType, UserLicenceType, UserType, EnumAffiliateRewardType, EnumUserLicence, DateTimeType, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
4
- import { n as SchemaAffiliateResourceType, S as SchemaOwnerType, i as SchemaRelationType } from '../Affiliate-B76iZ3fE.mjs';
5
- import { G as GraphQLContext, O as ObjectId, f as SchemaCreateBulkNotificationInput } from '../Chat-Wn7yfc3v.mjs';
2
+ import { PromoCodeType, UserLicenceType, UserType, AffiliateRewardEnumType, LicencesEnumType, DateTimeType, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
3
+ import * as mongoose from 'mongoose';
4
+ import { o as SchemaAffiliateType, m as SchemaAffiliateReward, n as SchemaAffiliateResourceType, S as SchemaOwnerType, i as SchemaRelationType } from '../Affiliate-DaFyIRHK.mjs';
5
+ import { G as GraphQLContext, O as ObjectId, f as SchemaCreateBulkNotificationInput } from '../Chat-NS-2VVEV.mjs';
6
6
  import dayjs from 'dayjs';
7
7
  import { DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
8
8
  import 'express';
@@ -54,12 +54,19 @@ declare function awardAffiliateVendorSubscriptionRewards(now?: Date): Promise<Aw
54
54
  * @param promoCode - Normalized affiliate promo code to resolve.
55
55
  * @returns The matching affiliate document, or `null` when not found.
56
56
  */
57
- declare function findAffiliateByPromoCode(promoCode: PromoCodeType): Promise<(mongoose.Document<unknown, {}, Omit<_timardex_cluemart_shared.AffiliateType, "_id" | "owner" | "affiliateResources"> & {
58
- affiliateResources: SchemaAffiliateResourceType[];
59
- owner: SchemaOwnerType;
60
- }, {}, {}> & Omit<_timardex_cluemart_shared.AffiliateType, "_id" | "owner" | "affiliateResources"> & {
57
+ declare function findAffiliateByPromoCode(promoCode: PromoCodeType): Promise<(mongoose.Document<unknown, {}, SchemaAffiliateType, {}, {}> & Omit<_timardex_cluemart_shared.AffiliateType, "_id" | "createdAt" | "updatedAt" | "deletedAt" | "approvedAt" | "owner" | "affiliateBonusRewards" | "affiliateResources" | "redeemHistory"> & {
58
+ affiliateBonusRewards?: SchemaAffiliateReward[];
61
59
  affiliateResources: SchemaAffiliateResourceType[];
60
+ approvedAt?: Date | null;
61
+ createdAt: Date;
62
+ deletedAt?: Date | null;
62
63
  owner: SchemaOwnerType;
64
+ redeemHistory?: {
65
+ paidAt?: Date | null;
66
+ redeemedAt: Date;
67
+ rewardValue: number;
68
+ }[];
69
+ updatedAt: Date;
63
70
  } & {
64
71
  _id: mongoose.Types.ObjectId;
65
72
  } & {
@@ -82,7 +89,7 @@ declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null
82
89
  * otherwise falls back to the Standard subscription reward.
83
90
  * Returns `null` when no non-expired vendor licence applies.
84
91
  */
85
- declare function mapVendorLicenceToSubscriptionRewardType(licences: UserLicenceType[] | null | undefined, now?: Date, stripe?: UserType["stripe"] | null): EnumAffiliateRewardType | null;
92
+ declare function mapVendorLicenceToSubscriptionRewardType(licences: UserLicenceType[] | null | undefined, now?: Date, stripe?: UserType["stripe"] | null): AffiliateRewardEnumType | null;
86
93
  /** Inclusive start / exclusive end of the UTC calendar month containing `now`. */
87
94
  declare function getSubscriptionRewardPeriodBounds(now?: Date): {
88
95
  periodEnd: Date;
@@ -144,7 +151,7 @@ declare function sendPushNotifications({ data, message, title, userIds, }: Schem
144
151
  */
145
152
  declare function updateAdStatuses(): Promise<void>;
146
153
 
147
- declare function updateVendorBasedOnUserLicense(userId: ObjectId, licenceType: EnumUserLicence): Promise<void>;
154
+ declare function updateVendorBasedOnUserLicense(userId: ObjectId, licenceType: LicencesEnumType): Promise<void>;
148
155
 
149
156
  /**
150
157
  * True when `value` is a valid Mongo ObjectId string.
@@ -1,8 +1,8 @@
1
- import * as mongoose from 'mongoose';
2
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
3
- import { PromoCodeType, UserLicenceType, UserType, EnumAffiliateRewardType, EnumUserLicence, DateTimeType, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
4
- import { n as SchemaAffiliateResourceType, S as SchemaOwnerType, i as SchemaRelationType } from '../Affiliate-gqV1-654.js';
5
- import { G as GraphQLContext, O as ObjectId, f as SchemaCreateBulkNotificationInput } from '../Chat-Wn7yfc3v.js';
2
+ import { PromoCodeType, UserLicenceType, UserType, AffiliateRewardEnumType, LicencesEnumType, DateTimeType, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
3
+ import * as mongoose from 'mongoose';
4
+ import { o as SchemaAffiliateType, m as SchemaAffiliateReward, n as SchemaAffiliateResourceType, S as SchemaOwnerType, i as SchemaRelationType } from '../Affiliate-CtH6MdT3.js';
5
+ import { G as GraphQLContext, O as ObjectId, f as SchemaCreateBulkNotificationInput } from '../Chat-NS-2VVEV.js';
6
6
  import dayjs from 'dayjs';
7
7
  import { DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
8
8
  import 'express';
@@ -54,12 +54,19 @@ declare function awardAffiliateVendorSubscriptionRewards(now?: Date): Promise<Aw
54
54
  * @param promoCode - Normalized affiliate promo code to resolve.
55
55
  * @returns The matching affiliate document, or `null` when not found.
56
56
  */
57
- declare function findAffiliateByPromoCode(promoCode: PromoCodeType): Promise<(mongoose.Document<unknown, {}, Omit<_timardex_cluemart_shared.AffiliateType, "_id" | "owner" | "affiliateResources"> & {
58
- affiliateResources: SchemaAffiliateResourceType[];
59
- owner: SchemaOwnerType;
60
- }, {}, {}> & Omit<_timardex_cluemart_shared.AffiliateType, "_id" | "owner" | "affiliateResources"> & {
57
+ declare function findAffiliateByPromoCode(promoCode: PromoCodeType): Promise<(mongoose.Document<unknown, {}, SchemaAffiliateType, {}, {}> & Omit<_timardex_cluemart_shared.AffiliateType, "_id" | "createdAt" | "updatedAt" | "deletedAt" | "approvedAt" | "owner" | "affiliateBonusRewards" | "affiliateResources" | "redeemHistory"> & {
58
+ affiliateBonusRewards?: SchemaAffiliateReward[];
61
59
  affiliateResources: SchemaAffiliateResourceType[];
60
+ approvedAt?: Date | null;
61
+ createdAt: Date;
62
+ deletedAt?: Date | null;
62
63
  owner: SchemaOwnerType;
64
+ redeemHistory?: {
65
+ paidAt?: Date | null;
66
+ redeemedAt: Date;
67
+ rewardValue: number;
68
+ }[];
69
+ updatedAt: Date;
63
70
  } & {
64
71
  _id: mongoose.Types.ObjectId;
65
72
  } & {
@@ -82,7 +89,7 @@ declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null
82
89
  * otherwise falls back to the Standard subscription reward.
83
90
  * Returns `null` when no non-expired vendor licence applies.
84
91
  */
85
- declare function mapVendorLicenceToSubscriptionRewardType(licences: UserLicenceType[] | null | undefined, now?: Date, stripe?: UserType["stripe"] | null): EnumAffiliateRewardType | null;
92
+ declare function mapVendorLicenceToSubscriptionRewardType(licences: UserLicenceType[] | null | undefined, now?: Date, stripe?: UserType["stripe"] | null): AffiliateRewardEnumType | null;
86
93
  /** Inclusive start / exclusive end of the UTC calendar month containing `now`. */
87
94
  declare function getSubscriptionRewardPeriodBounds(now?: Date): {
88
95
  periodEnd: Date;
@@ -144,7 +151,7 @@ declare function sendPushNotifications({ data, message, title, userIds, }: Schem
144
151
  */
145
152
  declare function updateAdStatuses(): Promise<void>;
146
153
 
147
- declare function updateVendorBasedOnUserLicense(userId: ObjectId, licenceType: EnumUserLicence): Promise<void>;
154
+ declare function updateVendorBasedOnUserLicense(userId: ObjectId, licenceType: LicencesEnumType): Promise<void>;
148
155
 
149
156
  /**
150
157
  * True when `value` is a valid Mongo ObjectId string.
@@ -1,29 +1,25 @@
1
1
  import {
2
2
  AdModel,
3
+ AdStatusTypeEnum,
3
4
  AffiliateModel,
4
- EnumAdStatus,
5
- EnumAffiliateRewardType,
6
- EnumEventDateStatus,
7
- EnumEventDateStatus2,
8
- EnumInviteStatus,
9
- EnumInviteStatus2,
10
- EnumNotificationResourceType,
11
- EnumNotificationType,
12
- EnumPaymentMethod,
13
- EnumRegions,
14
- EnumResourceType,
15
- EnumSubscriptionStatus,
16
- EnumUserLicence,
5
+ AffiliateRewardEnumType,
6
+ EventDateStatusEnumType,
17
7
  EventModel,
18
8
  GoogleImportedMarketModel,
9
+ InviteEnumType,
10
+ LicencesEnumType,
11
+ NotificationEnumType,
19
12
  NotificationModel,
13
+ NotificationResourceEnumType,
20
14
  PushTokenModel,
15
+ ResourceTypeEnum,
16
+ SubscriptionStatusEnumType,
21
17
  UserModel,
22
18
  VendorModel,
23
19
  dateFormat,
24
20
  timeFormat
25
- } from "../chunk-U5ER6XDO.mjs";
26
- import "../chunk-6PNG5BI5.mjs";
21
+ } from "../chunk-Z22PTYAL.mjs";
22
+ import "../chunk-RU5PTSIO.mjs";
27
23
 
28
24
  // src/service/promoCode/constants.ts
29
25
  var ACTIVE_NOT_DELETED_FILTER = {
@@ -40,7 +36,41 @@ async function activeAffiliateCodeExists(affiliateCode) {
40
36
  return existing !== null;
41
37
  }
42
38
 
43
- // node_modules/@timardex/cluemart-shared/dist/chunk-SD42WIMV.mjs
39
+ // node_modules/@timardex/cluemart-shared/dist/chunk-INQCDU24.mjs
40
+ var EventDateStatusEnumType2 = /* @__PURE__ */ ((EventDateStatusEnumType22) => {
41
+ EventDateStatusEnumType22["Canceled"] = "Canceled";
42
+ EventDateStatusEnumType22["Ended"] = "Ended";
43
+ EventDateStatusEnumType22["Invalid"] = "Invalid";
44
+ EventDateStatusEnumType22["NextWeek"] = "Next_Week";
45
+ EventDateStatusEnumType22["Rescheduled"] = "Rescheduled";
46
+ EventDateStatusEnumType22["Started"] = "Started";
47
+ EventDateStatusEnumType22["StartingSoon"] = "Starting_Soon";
48
+ EventDateStatusEnumType22["ThisWeek"] = "This_Week";
49
+ EventDateStatusEnumType22["Today"] = "Today";
50
+ EventDateStatusEnumType22["Tomorrow"] = "Tomorrow";
51
+ EventDateStatusEnumType22["Upcoming"] = "Upcoming";
52
+ return EventDateStatusEnumType22;
53
+ })(EventDateStatusEnumType2 || {});
54
+ var InviteEnumType2 = /* @__PURE__ */ ((InviteEnumType22) => {
55
+ InviteEnumType22["Accepted"] = "Accepted";
56
+ InviteEnumType22["Completed"] = "Completed";
57
+ InviteEnumType22["Expired"] = "Expired";
58
+ InviteEnumType22["NoStatus"] = "No_Status";
59
+ InviteEnumType22["Pending"] = "Pending";
60
+ InviteEnumType22["Rejected"] = "Rejected";
61
+ InviteEnumType22["Unavailable"] = "Unavailable";
62
+ return InviteEnumType22;
63
+ })(InviteEnumType2 || {});
64
+ var PaymentMethodEnumType = /* @__PURE__ */ ((PaymentMethodEnumType2) => {
65
+ PaymentMethodEnumType2["BankTransfer"] = "bank_transfer";
66
+ PaymentMethodEnumType2["Cash"] = "cash";
67
+ PaymentMethodEnumType2["Eftpos"] = "eftpos";
68
+ PaymentMethodEnumType2["Paypal"] = "paypal";
69
+ PaymentMethodEnumType2["Stripe"] = "stripe";
70
+ return PaymentMethodEnumType2;
71
+ })(PaymentMethodEnumType || {});
72
+
73
+ // node_modules/@timardex/cluemart-shared/dist/chunk-NWWKI4PJ.mjs
44
74
  import dayjs from "dayjs";
45
75
  import customParseFormat from "dayjs/plugin/customParseFormat.js";
46
76
  import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
@@ -55,10 +85,10 @@ dayjs.extend(utc);
55
85
  dayjs.extend(timezone);
56
86
  dayjs.extend(isSameOrAfter);
57
87
  var futureTimePeriods = mapArrayToOptions(
58
- Object.values(EnumEventDateStatus2)
88
+ Object.values(EventDateStatusEnumType2)
59
89
  ).filter(
60
90
  (period) => period.value !== "Starting_Soon" && period.value !== "Canceled" && period.value !== "Rescheduled" && period.value !== "Started" && period.value !== "Ended" && period.value !== "Invalid"
61
- /* INVALID */
91
+ /* Invalid */
62
92
  ).map((period) => ({
63
93
  label: period.value.replaceAll("_", " "),
64
94
  value: period.value
@@ -95,8 +125,68 @@ var SHARE_RESOURCE_LABEL = {
95
125
  school: "School"
96
126
  };
97
127
 
98
- // node_modules/@timardex/cluemart-shared/dist/chunk-4VN5M5JO.mjs
128
+ // node_modules/@timardex/cluemart-shared/dist/chunk-DATBGC2K.mjs
129
+ var PERMISSIONS = [
130
+ "*",
131
+ // Dashboards
132
+ "dashboard.admin",
133
+ "dashboard.affiliate",
134
+ "dashboard.customer",
135
+ "dashboard.event",
136
+ "dashboard.partner",
137
+ "dashboard.school",
138
+ "dashboard.vendor",
139
+ // Admin: users
140
+ "users.delete",
141
+ "users.read",
142
+ "users.update",
143
+ // Admin: events
144
+ "events.create",
145
+ "events.delete",
146
+ "events.read",
147
+ "events.update",
148
+ // Admin: vendors
149
+ "vendors.create",
150
+ "vendors.delete",
151
+ "vendors.read",
152
+ "vendors.update",
153
+ // Admin: partners
154
+ "partners.create",
155
+ "partners.delete",
156
+ "partners.read",
157
+ "partners.update",
158
+ // Admin: schools
159
+ "schools.create",
160
+ "schools.delete",
161
+ "schools.read",
162
+ "schools.update",
163
+ // Admin: affiliates
164
+ "affiliates.create",
165
+ "affiliates.delete",
166
+ "affiliates.read",
167
+ "affiliates.update",
168
+ // Admin: ads / posts / settings
169
+ "ads.create",
170
+ "ads.delete",
171
+ "ads.read",
172
+ "ads.update",
173
+ "posts.create",
174
+ "posts.delete",
175
+ "posts.read",
176
+ "posts.update",
177
+ "settings.read",
178
+ "settings.update",
179
+ // Product: own-resource management
180
+ "affiliates.manage_own",
181
+ "events.manage_own",
182
+ "partners.manage_own",
183
+ "schools.manage_own",
184
+ "vendors.manage_own"
185
+ ];
99
186
  var PROMO_CODE_PREFIX = "CM-";
187
+ var PERMISSION_SET = new Set(PERMISSIONS);
188
+
189
+ // node_modules/@timardex/cluemart-shared/dist/chunk-DDHECBJR.mjs
100
190
  var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
101
191
  var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
102
192
  var gameScreenIdentifierList = [
@@ -197,10 +287,28 @@ var gameScreenIdentifierList = [
197
287
  }
198
288
  ];
199
289
 
200
- // node_modules/@timardex/cluemart-shared/dist/chunk-TX3TVIQO.mjs
290
+ // node_modules/@timardex/cluemart-shared/dist/chunk-TOEFAEF2.mjs
291
+ var EnumRegions = /* @__PURE__ */ ((EnumRegions2) => {
292
+ EnumRegions2["All"] = "All Regions";
293
+ EnumRegions2["Auckland"] = "Auckland";
294
+ EnumRegions2["BayOfPlentyGisborne"] = "Bay of Plenty & Gisborne";
295
+ EnumRegions2["CanterburyWestCoast"] = "Canterbury & West Coast";
296
+ EnumRegions2["HawkesBay"] = "Hawke's Bay";
297
+ EnumRegions2["ManawatuWanganui"] = "Manawatu-Wanganui";
298
+ EnumRegions2["MarlboroughNelsonTasman"] = "Marlborough & Nelson & Tasman";
299
+ EnumRegions2["Northland"] = "Northland";
300
+ EnumRegions2["Otago"] = "Otago";
301
+ EnumRegions2["Southland"] = "Southland";
302
+ EnumRegions2["Taranaki"] = "Taranaki";
303
+ EnumRegions2["Waikato"] = "Waikato";
304
+ EnumRegions2["Wellington"] = "Wellington";
305
+ return EnumRegions2;
306
+ })(EnumRegions || {});
307
+
308
+ // node_modules/@timardex/cluemart-shared/dist/chunk-OHHJ3KJJ.mjs
201
309
  import dayjs2 from "dayjs";
202
310
  var statusOptions = [
203
- ...Object.values(EnumInviteStatus2).map((status) => ({
311
+ ...Object.values(InviteEnumType2).map((status) => ({
204
312
  label: status,
205
313
  value: status
206
314
  })).sort((a, b) => a.label.localeCompare(b.label))
@@ -209,7 +317,7 @@ var statusOptions = [
209
317
  var availableRegionTypes = Object.values(EnumRegions);
210
318
  var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
211
319
  var paymentMethodOptions = mapArrayToOptions(
212
- Object.values(EnumPaymentMethod)
320
+ Object.values(PaymentMethodEnumType)
213
321
  );
214
322
  var CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;
215
323
  var CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;
@@ -1189,42 +1297,42 @@ var availableCategories = assignColorToCategories([
1189
1297
  var AFFILIATE_REWARDS = {
1190
1298
  [
1191
1299
  "NEW_EVENT_REGISTRATION"
1192
- /* NEW_EVENT_REGISTRATION */
1300
+ /* NewEventRegistration */
1193
1301
  ]: {
1194
1302
  description: "10 points for new event registration (one-time reward)",
1195
1303
  value: 10
1196
1304
  },
1197
1305
  [
1198
1306
  "NEW_VENDOR_REGISTRATION"
1199
- /* NEW_VENDOR_REGISTRATION */
1307
+ /* NewVendorRegistration */
1200
1308
  ]: {
1201
1309
  description: "5 points for new vendor registration (one-time reward)",
1202
1310
  value: 5
1203
1311
  },
1204
1312
  [
1205
1313
  "ACTIVE_VENDOR_PRO_SUBSCRIPTION"
1206
- /* ACTIVE_VENDOR_PRO_SUBSCRIPTION */
1314
+ /* ActiveVendorProSubscription */
1207
1315
  ]: {
1208
1316
  description: "3 points for active vendor pro subscription (monthly reward)",
1209
1317
  value: 3
1210
1318
  },
1211
1319
  [
1212
1320
  "ACTIVE_VENDOR_STANDARD_SUBSCRIPTION"
1213
- /* ACTIVE_VENDOR_STANDARD_SUBSCRIPTION */
1321
+ /* ActiveVendorStandardSubscription */
1214
1322
  ]: {
1215
1323
  description: "1 point for active vendor standard subscription (monthly reward)",
1216
1324
  value: 1
1217
1325
  },
1218
1326
  [
1219
1327
  "ACTIVE_VENDOR_BONUS_REWARD"
1220
- /* ACTIVE_VENDOR_BONUS_REWARD */
1328
+ /* ActiveVendorBonusReward */
1221
1329
  ]: {
1222
1330
  description: "5 bonus points for every 10th active vendor (one-time reward)",
1223
1331
  value: 5
1224
1332
  },
1225
1333
  [
1226
1334
  "ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS"
1227
- /* ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS */
1335
+ /* ActiveEventWithVendorRegistrations */
1228
1336
  ]: {
1229
1337
  description: "40 points for active event with vendor registrations (one-time reward)",
1230
1338
  value: 40
@@ -1383,7 +1491,7 @@ async function sendPushNotifications({
1383
1491
  // src/service/affiliate/vendorSubscriptionRewards.ts
1384
1492
  function isPayingStripeSubscription(stripe) {
1385
1493
  if (!stripe?.subscriptionId) return false;
1386
- return (stripe.status === EnumSubscriptionStatus.ACTIVE || stripe.status === EnumSubscriptionStatus.TRIALING) && (stripe.currentPlan === EnumUserLicence.PRO_VENDOR || stripe.currentPlan === EnumUserLicence.PRO_PLUS_VENDOR);
1494
+ return (stripe.status === SubscriptionStatusEnumType.Active || stripe.status === SubscriptionStatusEnumType.Trialing) && (stripe.currentPlan === LicencesEnumType.ProVendor || stripe.currentPlan === LicencesEnumType.ProPlusVendor);
1387
1495
  }
1388
1496
  function mapVendorLicenceToSubscriptionRewardType(licences, now = /* @__PURE__ */ new Date(), stripe) {
1389
1497
  const validTypes = new Set(
@@ -1391,14 +1499,14 @@ function mapVendorLicenceToSubscriptionRewardType(licences, now = /* @__PURE__ *
1391
1499
  (licence) => new Date(licence.expiryDate).getTime() > now.getTime()
1392
1500
  ).map((licence) => licence.licenceType)
1393
1501
  );
1394
- if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
1502
+ if (validTypes.has(LicencesEnumType.ProVendor) || validTypes.has(LicencesEnumType.ProPlusVendor)) {
1395
1503
  if (isPayingStripeSubscription(stripe)) {
1396
- return EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
1504
+ return AffiliateRewardEnumType.ActiveVendorProSubscription;
1397
1505
  }
1398
- return EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
1506
+ return AffiliateRewardEnumType.ActiveVendorStandardSubscription;
1399
1507
  }
1400
- if (validTypes.has(EnumUserLicence.STANDARD_VENDOR)) {
1401
- return EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
1508
+ if (validTypes.has(LicencesEnumType.StandardVendor)) {
1509
+ return AffiliateRewardEnumType.ActiveVendorStandardSubscription;
1402
1510
  }
1403
1511
  return null;
1404
1512
  }
@@ -1414,7 +1522,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
1414
1522
 
1415
1523
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
1416
1524
  function isEligibleVendorResource(resource) {
1417
- return resource.resourceType === EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
1525
+ return resource.resourceType === ResourceTypeEnum.Vendor && resource.resourceActive === true && resource.resourceDeletedAt == null;
1418
1526
  }
1419
1527
  async function findAffiliatesWithActiveVendorReferrals() {
1420
1528
  return await AffiliateModel.find({
@@ -1422,7 +1530,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
1422
1530
  $elemMatch: {
1423
1531
  resourceActive: true,
1424
1532
  resourceDeletedAt: null,
1425
- resourceType: EnumResourceType.VENDOR
1533
+ resourceType: ResourceTypeEnum.Vendor
1426
1534
  }
1427
1535
  },
1428
1536
  deletedAt: null
@@ -1460,11 +1568,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
1460
1568
  data: {
1461
1569
  resourceId: String(affiliateId),
1462
1570
  resourceName,
1463
- resourceType: EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
1571
+ resourceType: NotificationResourceEnumType.AffiliateRewardReceived
1464
1572
  },
1465
1573
  message: `You earned ${rewardValue} points! Your referred vendor "${resourceName}" has an active subscription.`,
1466
1574
  title: "Affiliate points earned",
1467
- type: EnumNotificationType.SYSTEM,
1575
+ type: NotificationEnumType.System,
1468
1576
  userIds: [affiliateOwnerUserId]
1469
1577
  };
1470
1578
  try {
@@ -1493,7 +1601,7 @@ async function tryAwardSubscriptionReward({
1493
1601
  resourceActive: true,
1494
1602
  resourceDeletedAt: null,
1495
1603
  resourceId: resource.resourceId,
1496
- resourceType: EnumResourceType.VENDOR,
1604
+ resourceType: ResourceTypeEnum.Vendor,
1497
1605
  rewards: {
1498
1606
  $not: {
1499
1607
  $elemMatch: {
@@ -1689,25 +1797,25 @@ async function updateAdStatuses() {
1689
1797
  { end: { $exists: false } },
1690
1798
  { $expr: { $gt: ["$start", "$end"] } }
1691
1799
  ],
1692
- status: { $ne: EnumAdStatus.PAUSED }
1800
+ status: { $ne: AdStatusTypeEnum.Paused }
1693
1801
  },
1694
- { $set: { status: EnumAdStatus.PAUSED } }
1802
+ { $set: { status: AdStatusTypeEnum.Paused } }
1695
1803
  );
1696
1804
  const expiredResult = await AdModel.updateMany(
1697
- { end: { $lte: now }, status: { $ne: EnumAdStatus.EXPIRED } },
1698
- { $set: { status: EnumAdStatus.EXPIRED } }
1805
+ { end: { $lte: now }, status: { $ne: AdStatusTypeEnum.Expired } },
1806
+ { $set: { status: AdStatusTypeEnum.Expired } }
1699
1807
  );
1700
1808
  const activeResult = await AdModel.updateMany(
1701
1809
  {
1702
1810
  end: { $gt: now },
1703
1811
  start: { $lte: now },
1704
- status: { $ne: EnumAdStatus.ACTIVE }
1812
+ status: { $ne: AdStatusTypeEnum.Active }
1705
1813
  },
1706
- { $set: { status: EnumAdStatus.ACTIVE } }
1814
+ { $set: { status: AdStatusTypeEnum.Active } }
1707
1815
  );
1708
1816
  const pausedResult = await AdModel.updateMany(
1709
- { start: { $gt: now }, status: { $ne: EnumAdStatus.PAUSED } },
1710
- { $set: { status: EnumAdStatus.PAUSED } }
1817
+ { start: { $gt: now }, status: { $ne: AdStatusTypeEnum.Paused } },
1818
+ { $set: { status: AdStatusTypeEnum.Paused } }
1711
1819
  );
1712
1820
  console.log(
1713
1821
  `\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
@@ -1728,7 +1836,7 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
1728
1836
  return;
1729
1837
  }
1730
1838
  const updateData = {};
1731
- const isStandardVendor = licenceType === EnumUserLicence.STANDARD_VENDOR;
1839
+ const isStandardVendor = licenceType === LicencesEnumType.StandardVendor;
1732
1840
  if (isStandardVendor) {
1733
1841
  updateData.availability = {
1734
1842
  corporate: false,
@@ -1791,21 +1899,21 @@ dayjs3.extend(isoWeek);
1791
1899
  function getFutureEventStatus(startDateTime, now) {
1792
1900
  const hoursUntilStart = startDateTime.diff(now, "hour", true);
1793
1901
  if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
1794
- return EnumEventDateStatus.STARTING_SOON;
1902
+ return EventDateStatusEnumType.StartingSoon;
1795
1903
  }
1796
1904
  if (startDateTime.isSame(now, "day")) {
1797
- return EnumEventDateStatus.TODAY;
1905
+ return EventDateStatusEnumType.Today;
1798
1906
  }
1799
1907
  if (startDateTime.isSame(now.add(1, "day"), "day")) {
1800
- return EnumEventDateStatus.TOMORROW;
1908
+ return EventDateStatusEnumType.Tomorrow;
1801
1909
  }
1802
1910
  if (startDateTime.isSame(now, "isoWeek")) {
1803
- return EnumEventDateStatus.THIS_WEEK;
1911
+ return EventDateStatusEnumType.ThisWeek;
1804
1912
  }
1805
1913
  if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
1806
- return EnumEventDateStatus.NEXT_WEEK;
1914
+ return EventDateStatusEnumType.NextWeek;
1807
1915
  }
1808
- return EnumEventDateStatus.UPCOMING;
1916
+ return EventDateStatusEnumType.Upcoming;
1809
1917
  }
1810
1918
  function updateSingleDateTimeStatus(dateTime, now = dayjs3()) {
1811
1919
  const dateTimeFormat = `${dateFormat} ${timeFormat}`;
@@ -1822,13 +1930,13 @@ function updateSingleDateTimeStatus(dateTime, now = dayjs3()) {
1822
1930
  if (!startDateTime.isValid() || !endDateTime.isValid()) {
1823
1931
  return {
1824
1932
  ...dateTime,
1825
- dateStatus: EnumEventDateStatus.INVALID
1933
+ dateStatus: EventDateStatusEnumType.Invalid
1826
1934
  };
1827
1935
  }
1828
1936
  if (endDateTime.isBefore(startDateTime)) {
1829
1937
  return {
1830
1938
  ...dateTime,
1831
- dateStatus: EnumEventDateStatus.INVALID
1939
+ dateStatus: EventDateStatusEnumType.Invalid
1832
1940
  };
1833
1941
  }
1834
1942
  let dateStatus;
@@ -1836,10 +1944,10 @@ function updateSingleDateTimeStatus(dateTime, now = dayjs3()) {
1836
1944
  if (startDateTime.isAfter(now)) {
1837
1945
  dateStatus = getFutureEventStatus(startDateTime, now);
1838
1946
  } else {
1839
- dateStatus = EnumEventDateStatus.STARTED;
1947
+ dateStatus = EventDateStatusEnumType.Started;
1840
1948
  }
1841
1949
  } else {
1842
- dateStatus = EnumEventDateStatus.ENDED;
1950
+ dateStatus = EventDateStatusEnumType.Ended;
1843
1951
  }
1844
1952
  return {
1845
1953
  ...dateTime,
@@ -1940,7 +2048,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
1940
2048
  ) ?? false;
1941
2049
  return {
1942
2050
  ...relationDate,
1943
- status: existsInEvent ? relationDate.status : EnumInviteStatus.UNAVAILABLE
2051
+ status: existsInEvent ? relationDate.status : InviteEnumType.Unavailable
1944
2052
  };
1945
2053
  });
1946
2054
  }