@timardex/cluemart-server-shared 2.2.12 → 2.2.21
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.
- package/dist/{Affiliate-i11rkfv5.d.mts → Affiliate-6AEy-gNx.d.mts} +1 -1
- package/dist/{Affiliate-BSF7Wm6O.d.ts → Affiliate-D40kRxO_.d.ts} +1 -1
- package/dist/{chunk-ZKHRT2PV.mjs → chunk-TIGQ6F5T.mjs} +60 -2
- package/dist/chunk-TIGQ6F5T.mjs.map +1 -0
- package/dist/{chunk-6PNG5BI5.mjs → chunk-TMPPPLIW.mjs} +1 -1
- package/dist/chunk-TMPPPLIW.mjs.map +1 -0
- package/dist/{index-Bq-lT7a2.d.mts → index-CmtBYjpi.d.mts} +4 -0
- package/dist/{index-Bq-lT7a2.d.ts → index-CmtBYjpi.d.ts} +4 -0
- package/dist/index.cjs +181 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.mjs +75 -17
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +60 -0
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +36 -6
- package/dist/mongoose/index.d.ts +36 -6
- package/dist/mongoose/index.mjs +5 -1
- package/dist/service/index.cjs +176 -120
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +2 -2
- package/dist/service/index.d.ts +2 -2
- package/dist/service/index.mjs +2 -2
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-6PNG5BI5.mjs.map +0 -1
- package/dist/chunk-ZKHRT2PV.mjs.map +0 -1
package/dist/service/index.cjs
CHANGED
|
@@ -91,7 +91,7 @@ __export(service_exports, {
|
|
|
91
91
|
updateAdStatuses: () => updateAdStatuses,
|
|
92
92
|
updateAllEventDateTimeStatuses: () => updateAllEventDateTimeStatuses,
|
|
93
93
|
updateRelationDatesToUnavailable: () => updateRelationDatesToUnavailable,
|
|
94
|
-
updateSingleDateTimeStatus: () =>
|
|
94
|
+
updateSingleDateTimeStatus: () => import_cluemart_shared35.updateSingleDateTimeStatus,
|
|
95
95
|
upgradeUserToLicence: () => upgradeUserToLicence,
|
|
96
96
|
vendorOwnerHasProLicence: () => vendorOwnerHasProLicence
|
|
97
97
|
});
|
|
@@ -2515,6 +2515,62 @@ schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
|
2515
2515
|
schema24.index({ "couponData.participantUsers.userId": 1 });
|
|
2516
2516
|
var CouponModel = import_mongoose32.default.models.Coupon || import_mongoose32.default.model("Coupon", schema24);
|
|
2517
2517
|
|
|
2518
|
+
// src/mongoose/Impersonation.ts
|
|
2519
|
+
var import_cluemart_shared22 = require("@timardex/cluemart-shared");
|
|
2520
|
+
var import_mongoose33 = __toESM(require("mongoose"));
|
|
2521
|
+
var MongooseSchema28 = import_mongoose33.default.Schema;
|
|
2522
|
+
var impersonationSessionSchema = new MongooseSchema28(
|
|
2523
|
+
{
|
|
2524
|
+
expiresAt: { expires: 0, required: true, type: Date },
|
|
2525
|
+
impersonatedUserId: {
|
|
2526
|
+
index: true,
|
|
2527
|
+
ref: "User",
|
|
2528
|
+
required: true,
|
|
2529
|
+
type: import_mongoose33.default.Schema.Types.ObjectId
|
|
2530
|
+
},
|
|
2531
|
+
impersonatorUserId: {
|
|
2532
|
+
index: true,
|
|
2533
|
+
ref: "User",
|
|
2534
|
+
required: true,
|
|
2535
|
+
type: import_mongoose33.default.Schema.Types.ObjectId
|
|
2536
|
+
},
|
|
2537
|
+
refreshToken: { required: true, type: String }
|
|
2538
|
+
},
|
|
2539
|
+
{ timestamps: true }
|
|
2540
|
+
);
|
|
2541
|
+
var ImpersonationSessionModel = import_mongoose33.default.models.ImpersonationSession || import_mongoose33.default.model(
|
|
2542
|
+
"ImpersonationSession",
|
|
2543
|
+
impersonationSessionSchema
|
|
2544
|
+
);
|
|
2545
|
+
var impersonationAuditSchema = new MongooseSchema28(
|
|
2546
|
+
{
|
|
2547
|
+
action: { enum: ["start", "end"], required: true, type: String },
|
|
2548
|
+
endReason: { type: String },
|
|
2549
|
+
impersonatedUserId: {
|
|
2550
|
+
ref: "User",
|
|
2551
|
+
required: true,
|
|
2552
|
+
type: import_mongoose33.default.Schema.Types.ObjectId
|
|
2553
|
+
},
|
|
2554
|
+
impersonatorUserId: {
|
|
2555
|
+
ref: "User",
|
|
2556
|
+
required: true,
|
|
2557
|
+
type: import_mongoose33.default.Schema.Types.ObjectId
|
|
2558
|
+
},
|
|
2559
|
+
resourceId: { type: import_mongoose33.default.Schema.Types.ObjectId },
|
|
2560
|
+
resourceType: { enum: Object.values(import_cluemart_shared22.EnumResourceType), type: String },
|
|
2561
|
+
sessionId: {
|
|
2562
|
+
ref: "ImpersonationSession",
|
|
2563
|
+
required: true,
|
|
2564
|
+
type: import_mongoose33.default.Schema.Types.ObjectId
|
|
2565
|
+
}
|
|
2566
|
+
},
|
|
2567
|
+
{ timestamps: true }
|
|
2568
|
+
);
|
|
2569
|
+
var ImpersonationAuditModel = import_mongoose33.default.models.ImpersonationAudit || import_mongoose33.default.model(
|
|
2570
|
+
"ImpersonationAudit",
|
|
2571
|
+
impersonationAuditSchema
|
|
2572
|
+
);
|
|
2573
|
+
|
|
2518
2574
|
// src/service/promoCode/constants.ts
|
|
2519
2575
|
var ACTIVE_NOT_DELETED_FILTER = {
|
|
2520
2576
|
active: true,
|
|
@@ -2531,7 +2587,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
|
|
|
2531
2587
|
}
|
|
2532
2588
|
|
|
2533
2589
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
2534
|
-
var
|
|
2590
|
+
var import_cluemart_shared24 = require("@timardex/cluemart-shared");
|
|
2535
2591
|
var import_utils3 = require("@timardex/cluemart-shared/utils");
|
|
2536
2592
|
|
|
2537
2593
|
// src/service/saveNotificationsInDb.ts
|
|
@@ -2666,7 +2722,7 @@ async function sendPushNotifications({
|
|
|
2666
2722
|
}
|
|
2667
2723
|
|
|
2668
2724
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
2669
|
-
var
|
|
2725
|
+
var import_cluemart_shared23 = require("@timardex/cluemart-shared");
|
|
2670
2726
|
var import_dayjs = __toESM(require("dayjs"));
|
|
2671
2727
|
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
|
|
2672
2728
|
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
@@ -2724,14 +2780,14 @@ import_dayjs.default.extend(import_timezone.default);
|
|
|
2724
2780
|
var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
|
|
2725
2781
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
2726
2782
|
const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
|
|
2727
|
-
if (validTypes.has(
|
|
2783
|
+
if (validTypes.has(import_cluemart_shared23.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared23.EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
2728
2784
|
if (hasSubscription) {
|
|
2729
|
-
return
|
|
2785
|
+
return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
|
|
2730
2786
|
}
|
|
2731
|
-
return
|
|
2787
|
+
return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
2732
2788
|
}
|
|
2733
|
-
if (validTypes.has(
|
|
2734
|
-
return
|
|
2789
|
+
if (validTypes.has(import_cluemart_shared23.EnumUserLicence.STANDARD_VENDOR)) {
|
|
2790
|
+
return import_cluemart_shared23.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
2735
2791
|
}
|
|
2736
2792
|
return null;
|
|
2737
2793
|
}
|
|
@@ -2743,7 +2799,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
|
2743
2799
|
|
|
2744
2800
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
2745
2801
|
function isEligibleVendorResource(resource) {
|
|
2746
|
-
return resource.resourceType ===
|
|
2802
|
+
return resource.resourceType === import_cluemart_shared24.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
|
|
2747
2803
|
}
|
|
2748
2804
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
2749
2805
|
return await AffiliateModel.find({
|
|
@@ -2752,7 +2808,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
|
|
|
2752
2808
|
$elemMatch: {
|
|
2753
2809
|
resourceActive: true,
|
|
2754
2810
|
resourceDeletedAt: null,
|
|
2755
|
-
resourceType:
|
|
2811
|
+
resourceType: import_cluemart_shared24.EnumResourceType.VENDOR
|
|
2756
2812
|
}
|
|
2757
2813
|
},
|
|
2758
2814
|
deletedAt: null
|
|
@@ -2786,11 +2842,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
|
|
|
2786
2842
|
data: {
|
|
2787
2843
|
resourceId: String(affiliateId),
|
|
2788
2844
|
resourceName: resourceNames.join(", "),
|
|
2789
|
-
resourceType:
|
|
2845
|
+
resourceType: import_cluemart_shared24.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
|
|
2790
2846
|
},
|
|
2791
2847
|
message,
|
|
2792
2848
|
title: "Affiliate points earned",
|
|
2793
|
-
type:
|
|
2849
|
+
type: import_cluemart_shared24.EnumNotificationType.SYSTEM,
|
|
2794
2850
|
userIds: [affiliateOwnerUserId]
|
|
2795
2851
|
};
|
|
2796
2852
|
try {
|
|
@@ -2819,7 +2875,7 @@ async function tryAwardSubscriptionReward({
|
|
|
2819
2875
|
resourceActive: true,
|
|
2820
2876
|
resourceDeletedAt: null,
|
|
2821
2877
|
resourceId: resource.resourceId,
|
|
2822
|
-
resourceType:
|
|
2878
|
+
resourceType: import_cluemart_shared24.EnumResourceType.VENDOR,
|
|
2823
2879
|
rewards: {
|
|
2824
2880
|
$not: {
|
|
2825
2881
|
$elemMatch: {
|
|
@@ -2940,7 +2996,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
2940
2996
|
}
|
|
2941
2997
|
|
|
2942
2998
|
// src/service/database.ts
|
|
2943
|
-
var
|
|
2999
|
+
var import_mongoose37 = __toESM(require("mongoose"));
|
|
2944
3000
|
var connectToDatabase = async ({
|
|
2945
3001
|
appName,
|
|
2946
3002
|
dbName,
|
|
@@ -2953,7 +3009,7 @@ var connectToDatabase = async ({
|
|
|
2953
3009
|
// Fallback to MongoDB Atlas connection string
|
|
2954
3010
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
2955
3011
|
);
|
|
2956
|
-
await
|
|
3012
|
+
await import_mongoose37.default.connect(mongoUri);
|
|
2957
3013
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
2958
3014
|
console.log(
|
|
2959
3015
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -2966,7 +3022,7 @@ var connectToDatabase = async ({
|
|
|
2966
3022
|
|
|
2967
3023
|
// src/types/index.ts
|
|
2968
3024
|
var import_express = __toESM(require("express"));
|
|
2969
|
-
var
|
|
3025
|
+
var import_mongoose38 = __toESM(require("mongoose"));
|
|
2970
3026
|
|
|
2971
3027
|
// src/service/notifyUsers.ts
|
|
2972
3028
|
async function publishNotificationEvents(userId, pubsub) {
|
|
@@ -3014,7 +3070,7 @@ async function notifyUsers({
|
|
|
3014
3070
|
}
|
|
3015
3071
|
|
|
3016
3072
|
// src/service/updateAdStatus.ts
|
|
3017
|
-
var
|
|
3073
|
+
var import_cluemart_shared25 = require("@timardex/cluemart-shared");
|
|
3018
3074
|
async function updateAdStatuses() {
|
|
3019
3075
|
const now = /* @__PURE__ */ new Date();
|
|
3020
3076
|
const invalidResult = await AdModel.updateMany(
|
|
@@ -3024,50 +3080,50 @@ async function updateAdStatuses() {
|
|
|
3024
3080
|
{ end: { $exists: false } },
|
|
3025
3081
|
{ $expr: { $gt: ["$start", "$end"] } }
|
|
3026
3082
|
],
|
|
3027
|
-
status: { $ne:
|
|
3083
|
+
status: { $ne: import_cluemart_shared25.EnumAdStatus.PAUSED }
|
|
3028
3084
|
},
|
|
3029
|
-
{ $set: { status:
|
|
3085
|
+
{ $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
|
|
3030
3086
|
);
|
|
3031
3087
|
const expiredResult = await AdModel.updateMany(
|
|
3032
|
-
{ end: { $lte: now }, status: { $ne:
|
|
3033
|
-
{ $set: { status:
|
|
3088
|
+
{ end: { $lte: now }, status: { $ne: import_cluemart_shared25.EnumAdStatus.EXPIRED } },
|
|
3089
|
+
{ $set: { status: import_cluemart_shared25.EnumAdStatus.EXPIRED } }
|
|
3034
3090
|
);
|
|
3035
3091
|
const eligibleBooking = {
|
|
3036
3092
|
$or: [
|
|
3037
3093
|
{ bookingKind: { $exists: false } },
|
|
3038
3094
|
{ bookingKind: null },
|
|
3039
3095
|
{
|
|
3040
|
-
approvalStatus:
|
|
3041
|
-
bookingKind:
|
|
3096
|
+
approvalStatus: import_cluemart_shared25.EnumAdApprovalStatus.APPROVED,
|
|
3097
|
+
bookingKind: import_cluemart_shared25.EnumAdBookingSlotKind.RESERVED
|
|
3042
3098
|
},
|
|
3043
3099
|
{
|
|
3044
|
-
approvalStatus:
|
|
3045
|
-
bookingKind:
|
|
3046
|
-
paymentStatus:
|
|
3100
|
+
approvalStatus: import_cluemart_shared25.EnumAdApprovalStatus.APPROVED,
|
|
3101
|
+
bookingKind: import_cluemart_shared25.EnumAdBookingSlotKind.PAID,
|
|
3102
|
+
paymentStatus: import_cluemart_shared25.EnumAdPaymentStatus.PAID
|
|
3047
3103
|
}
|
|
3048
3104
|
]
|
|
3049
3105
|
};
|
|
3050
3106
|
const awaitingApprovalResult = await AdModel.updateMany(
|
|
3051
3107
|
{
|
|
3052
3108
|
$nor: eligibleBooking.$or,
|
|
3053
|
-
bookingKind: { $in: Object.values(
|
|
3109
|
+
bookingKind: { $in: Object.values(import_cluemart_shared25.EnumAdBookingSlotKind) },
|
|
3054
3110
|
end: { $gt: now },
|
|
3055
|
-
status:
|
|
3111
|
+
status: import_cluemart_shared25.EnumAdStatus.ACTIVE
|
|
3056
3112
|
},
|
|
3057
|
-
{ $set: { status:
|
|
3113
|
+
{ $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
|
|
3058
3114
|
);
|
|
3059
3115
|
const activeResult = await AdModel.updateMany(
|
|
3060
3116
|
{
|
|
3061
3117
|
end: { $gt: now },
|
|
3062
3118
|
start: { $lte: now },
|
|
3063
|
-
status: { $ne:
|
|
3119
|
+
status: { $ne: import_cluemart_shared25.EnumAdStatus.ACTIVE },
|
|
3064
3120
|
...eligibleBooking
|
|
3065
3121
|
},
|
|
3066
|
-
{ $set: { status:
|
|
3122
|
+
{ $set: { status: import_cluemart_shared25.EnumAdStatus.ACTIVE } }
|
|
3067
3123
|
);
|
|
3068
3124
|
const pausedResult = await AdModel.updateMany(
|
|
3069
|
-
{ start: { $gt: now }, status: { $ne:
|
|
3070
|
-
{ $set: { status:
|
|
3125
|
+
{ start: { $gt: now }, status: { $ne: import_cluemart_shared25.EnumAdStatus.PAUSED } },
|
|
3126
|
+
{ $set: { status: import_cluemart_shared25.EnumAdStatus.PAUSED } }
|
|
3071
3127
|
);
|
|
3072
3128
|
console.log(
|
|
3073
3129
|
`\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, awaitingApproval=${awaitingApprovalResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
|
|
@@ -3075,15 +3131,15 @@ async function updateAdStatuses() {
|
|
|
3075
3131
|
}
|
|
3076
3132
|
|
|
3077
3133
|
// src/service/objectIdToString.ts
|
|
3078
|
-
var
|
|
3134
|
+
var import_mongoose40 = __toESM(require("mongoose"));
|
|
3079
3135
|
function isValidObjectId(value) {
|
|
3080
|
-
return
|
|
3136
|
+
return import_mongoose40.default.Types.ObjectId.isValid(value);
|
|
3081
3137
|
}
|
|
3082
3138
|
function convertObjectIdsToStrings(obj) {
|
|
3083
3139
|
if (obj === null || obj === void 0) {
|
|
3084
3140
|
return obj;
|
|
3085
3141
|
}
|
|
3086
|
-
if (obj instanceof
|
|
3142
|
+
if (obj instanceof import_mongoose40.default.Types.ObjectId) {
|
|
3087
3143
|
return obj.toString();
|
|
3088
3144
|
}
|
|
3089
3145
|
if (obj instanceof Date) {
|
|
@@ -3103,16 +3159,16 @@ function convertObjectIdsToStrings(obj) {
|
|
|
3103
3159
|
}
|
|
3104
3160
|
|
|
3105
3161
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
3106
|
-
var
|
|
3162
|
+
var import_cluemart_shared27 = require("@timardex/cluemart-shared");
|
|
3107
3163
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
3108
3164
|
|
|
3109
3165
|
// src/service/event/archiveEndedEventDates.ts
|
|
3110
|
-
var
|
|
3166
|
+
var import_cluemart_shared26 = require("@timardex/cluemart-shared");
|
|
3111
3167
|
var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
|
|
3112
|
-
|
|
3168
|
+
import_cluemart_shared26.EnumEventDateStatus.ENDED
|
|
3113
3169
|
]);
|
|
3114
3170
|
var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
|
|
3115
|
-
|
|
3171
|
+
import_cluemart_shared26.EnumEventDateStatus.INVALID
|
|
3116
3172
|
]);
|
|
3117
3173
|
function splitEventDatesForArchive(dateTime) {
|
|
3118
3174
|
return {
|
|
@@ -3175,7 +3231,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
3175
3231
|
try {
|
|
3176
3232
|
for await (const doc of cursor) {
|
|
3177
3233
|
const dateTime = doc.dateTime.map(
|
|
3178
|
-
(slot) => (0,
|
|
3234
|
+
(slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
|
|
3179
3235
|
);
|
|
3180
3236
|
if (!hasDateTimeStatusChanges(doc.dateTime, dateTime)) {
|
|
3181
3237
|
continue;
|
|
@@ -3198,7 +3254,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
3198
3254
|
}
|
|
3199
3255
|
var ARCHIVABLE_EVENT_FILTER = {
|
|
3200
3256
|
"dateTime.dateStatus": {
|
|
3201
|
-
$in: [
|
|
3257
|
+
$in: [import_cluemart_shared27.EnumEventDateStatus.ENDED, import_cluemart_shared27.EnumEventDateStatus.INVALID]
|
|
3202
3258
|
},
|
|
3203
3259
|
deletedAt: null
|
|
3204
3260
|
};
|
|
@@ -3220,7 +3276,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
|
|
|
3220
3276
|
try {
|
|
3221
3277
|
for await (const doc of cursor) {
|
|
3222
3278
|
const updated = doc.dateTime.map(
|
|
3223
|
-
(slot) => (0,
|
|
3279
|
+
(slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
|
|
3224
3280
|
);
|
|
3225
3281
|
const { archive, discard } = splitEventDatesForArchive(updated);
|
|
3226
3282
|
if (archive.length === 0 && discard.length === 0) {
|
|
@@ -3244,7 +3300,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
|
|
|
3244
3300
|
$pull: {
|
|
3245
3301
|
dateTime: {
|
|
3246
3302
|
dateStatus: {
|
|
3247
|
-
$in: [
|
|
3303
|
+
$in: [import_cluemart_shared27.EnumEventDateStatus.ENDED, import_cluemart_shared27.EnumEventDateStatus.INVALID]
|
|
3248
3304
|
}
|
|
3249
3305
|
}
|
|
3250
3306
|
}
|
|
@@ -3278,9 +3334,9 @@ async function cleanEventInfoDates(now) {
|
|
|
3278
3334
|
try {
|
|
3279
3335
|
for await (const doc of cursor) {
|
|
3280
3336
|
const updated = doc.dateTime.map(
|
|
3281
|
-
(slot) => (0,
|
|
3337
|
+
(slot) => (0, import_cluemart_shared27.updateSingleDateTimeStatus)(slot, now)
|
|
3282
3338
|
);
|
|
3283
|
-
const kept = (0,
|
|
3339
|
+
const kept = (0, import_cluemart_shared27.filterDatesByFutureStatus)(updated);
|
|
3284
3340
|
if (kept.length === updated.length) {
|
|
3285
3341
|
continue;
|
|
3286
3342
|
}
|
|
@@ -3326,7 +3382,7 @@ async function updateAllEventDateTimeStatuses() {
|
|
|
3326
3382
|
}
|
|
3327
3383
|
|
|
3328
3384
|
// src/service/index.ts
|
|
3329
|
-
var
|
|
3385
|
+
var import_cluemart_shared35 = require("@timardex/cluemart-shared");
|
|
3330
3386
|
|
|
3331
3387
|
// src/service/event/findEventOrImportedMarketById.ts
|
|
3332
3388
|
async function findEventOrImportedMarketById(resourceId) {
|
|
@@ -3342,7 +3398,7 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
3342
3398
|
}
|
|
3343
3399
|
|
|
3344
3400
|
// src/service/relations.ts
|
|
3345
|
-
var
|
|
3401
|
+
var import_cluemart_shared28 = require("@timardex/cluemart-shared");
|
|
3346
3402
|
function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
|
|
3347
3403
|
if (!previousDateTime?.length) {
|
|
3348
3404
|
return false;
|
|
@@ -3360,7 +3416,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
3360
3416
|
) ?? false;
|
|
3361
3417
|
return {
|
|
3362
3418
|
...relationDate,
|
|
3363
|
-
status: existsInEvent ? relationDate.status :
|
|
3419
|
+
status: existsInEvent ? relationDate.status : import_cluemart_shared28.EnumInviteStatus.UNAVAILABLE
|
|
3364
3420
|
};
|
|
3365
3421
|
});
|
|
3366
3422
|
}
|
|
@@ -3369,15 +3425,15 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
3369
3425
|
var import_dayjs6 = __toESM(require("dayjs"));
|
|
3370
3426
|
|
|
3371
3427
|
// src/service/license/compliance/utils.ts
|
|
3372
|
-
var
|
|
3428
|
+
var import_cluemart_shared33 = require("@timardex/cluemart-shared");
|
|
3373
3429
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
3374
3430
|
|
|
3375
3431
|
// src/service/license/compliance/event.ts
|
|
3376
|
-
var
|
|
3432
|
+
var import_cluemart_shared29 = require("@timardex/cluemart-shared");
|
|
3377
3433
|
var eventLicences = [
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3434
|
+
import_cluemart_shared29.EnumUserLicence.STANDARD_EVENT,
|
|
3435
|
+
import_cluemart_shared29.EnumUserLicence.PRO_EVENT,
|
|
3436
|
+
import_cluemart_shared29.EnumUserLicence.PRO_PLUS_EVENT
|
|
3381
3437
|
];
|
|
3382
3438
|
async function handleEventLicenceCompliance(user, now) {
|
|
3383
3439
|
if (!user.licences || !user.events?.length) {
|
|
@@ -3589,9 +3645,9 @@ function buildLicenceExpiryPipeline(params) {
|
|
|
3589
3645
|
}
|
|
3590
3646
|
|
|
3591
3647
|
// src/service/license/compliance/partner.ts
|
|
3592
|
-
var
|
|
3648
|
+
var import_cluemart_shared30 = require("@timardex/cluemart-shared");
|
|
3593
3649
|
var partnerLicences = [
|
|
3594
|
-
|
|
3650
|
+
import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER
|
|
3595
3651
|
];
|
|
3596
3652
|
async function handlePartnerLicenceCompliance(user, now) {
|
|
3597
3653
|
if (!user.licences || !user.partner) {
|
|
@@ -3601,11 +3657,11 @@ async function handlePartnerLicenceCompliance(user, now) {
|
|
|
3601
3657
|
}
|
|
3602
3658
|
|
|
3603
3659
|
// src/service/license/compliance/vendor.ts
|
|
3604
|
-
var
|
|
3660
|
+
var import_cluemart_shared32 = require("@timardex/cluemart-shared");
|
|
3605
3661
|
var import_dayjs4 = __toESM(require("dayjs"));
|
|
3606
3662
|
|
|
3607
3663
|
// src/service/license/models.ts
|
|
3608
|
-
var
|
|
3664
|
+
var import_cluemart_shared31 = require("@timardex/cluemart-shared");
|
|
3609
3665
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
3610
3666
|
var import_graphql = require("graphql");
|
|
3611
3667
|
var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
@@ -3617,31 +3673,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
|
3617
3673
|
return LicenceCategory2;
|
|
3618
3674
|
})(LicenceCategory || {});
|
|
3619
3675
|
var licenceCategoryMapping = {
|
|
3620
|
-
[
|
|
3621
|
-
[
|
|
3622
|
-
[
|
|
3623
|
-
[
|
|
3624
|
-
[
|
|
3625
|
-
[
|
|
3626
|
-
[
|
|
3627
|
-
[
|
|
3628
|
-
[
|
|
3676
|
+
[import_cluemart_shared31.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
|
|
3677
|
+
[import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
|
|
3678
|
+
[import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
|
|
3679
|
+
[import_cluemart_shared31.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
|
|
3680
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
|
|
3681
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
|
|
3682
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
|
|
3683
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
|
|
3684
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
|
|
3629
3685
|
};
|
|
3630
3686
|
var licencePriority = {
|
|
3631
|
-
[
|
|
3632
|
-
[
|
|
3633
|
-
[
|
|
3634
|
-
[
|
|
3635
|
-
[
|
|
3636
|
-
[
|
|
3637
|
-
[
|
|
3638
|
-
[
|
|
3639
|
-
[
|
|
3687
|
+
[import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT]: 3,
|
|
3688
|
+
[import_cluemart_shared31.EnumUserLicence.PRO_EVENT]: 2,
|
|
3689
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT]: 1,
|
|
3690
|
+
[import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
|
|
3691
|
+
[import_cluemart_shared31.EnumUserLicence.PRO_VENDOR]: 2,
|
|
3692
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR]: 1,
|
|
3693
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER]: 1,
|
|
3694
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE]: 1,
|
|
3695
|
+
[import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL]: 1
|
|
3640
3696
|
};
|
|
3641
3697
|
var standardLicences = [
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3698
|
+
import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR,
|
|
3699
|
+
import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
|
|
3700
|
+
import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER
|
|
3645
3701
|
];
|
|
3646
3702
|
var standardLicenceSet = new Set(standardLicences);
|
|
3647
3703
|
function isStandardLicence(licence) {
|
|
@@ -3655,11 +3711,11 @@ var categoryRegexMapping = {
|
|
|
3655
3711
|
["school" /* SCHOOL */]: /_school$/
|
|
3656
3712
|
};
|
|
3657
3713
|
var categoryFallbackLicence = {
|
|
3658
|
-
["event" /* EVENT */]:
|
|
3659
|
-
["partner" /* PARTNER */]:
|
|
3660
|
-
["vendor" /* VENDOR */]:
|
|
3661
|
-
["affiliate" /* AFFILIATE */]:
|
|
3662
|
-
["school" /* SCHOOL */]:
|
|
3714
|
+
["event" /* EVENT */]: import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
|
|
3715
|
+
["partner" /* PARTNER */]: import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER,
|
|
3716
|
+
["vendor" /* VENDOR */]: import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR,
|
|
3717
|
+
["affiliate" /* AFFILIATE */]: import_cluemart_shared31.EnumUserLicence.STANDARD_AFFILIATE,
|
|
3718
|
+
["school" /* SCHOOL */]: import_cluemart_shared31.EnumUserLicence.STANDARD_SCHOOL
|
|
3663
3719
|
};
|
|
3664
3720
|
var LicenceFilterInput = {
|
|
3665
3721
|
INPUT_USER_LICENCES: "$licences"
|
|
@@ -3689,11 +3745,11 @@ function getHighestLicenceForCategory(licences, category) {
|
|
|
3689
3745
|
function createLicenceObject(expiryDate, licenceType) {
|
|
3690
3746
|
const today = (0, import_dayjs3.default)();
|
|
3691
3747
|
const expiryDateMapping = {
|
|
3692
|
-
[
|
|
3693
|
-
[
|
|
3694
|
-
[
|
|
3695
|
-
[
|
|
3696
|
-
[
|
|
3748
|
+
[import_cluemart_shared31.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
|
|
3749
|
+
[import_cluemart_shared31.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
|
|
3750
|
+
[import_cluemart_shared31.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
|
|
3751
|
+
[import_cluemart_shared31.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
|
|
3752
|
+
[import_cluemart_shared31.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
|
|
3697
3753
|
};
|
|
3698
3754
|
const licenceObject = {
|
|
3699
3755
|
expiryDate: expiryDateMapping[expiryDate],
|
|
@@ -3797,13 +3853,13 @@ async function checkOwnerHasLicence({
|
|
|
3797
3853
|
const owner = await UserModel.findById(userId);
|
|
3798
3854
|
if (!owner) throw new import_graphql.GraphQLError("Owner not found");
|
|
3799
3855
|
const categoryByResource = {
|
|
3800
|
-
[
|
|
3801
|
-
[
|
|
3802
|
-
[
|
|
3803
|
-
[
|
|
3804
|
-
[
|
|
3856
|
+
[import_cluemart_shared31.EnumResourceType.EVENT]: "event" /* EVENT */,
|
|
3857
|
+
[import_cluemart_shared31.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
|
|
3858
|
+
[import_cluemart_shared31.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
|
|
3859
|
+
[import_cluemart_shared31.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
|
|
3860
|
+
[import_cluemart_shared31.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
|
|
3805
3861
|
};
|
|
3806
|
-
if (!(0,
|
|
3862
|
+
if (!(0, import_cluemart_shared31.isNonVisitorResourceType)(resourceType)) {
|
|
3807
3863
|
throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
|
|
3808
3864
|
}
|
|
3809
3865
|
const requiredCategory = categoryByResource[resourceType];
|
|
@@ -3883,7 +3939,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
|
|
|
3883
3939
|
return (result?.matchedCount ?? 0) > 0;
|
|
3884
3940
|
}
|
|
3885
3941
|
async function downgradeVendorProFeatures(userId, licenceType) {
|
|
3886
|
-
const isStandardVendor = licenceType ===
|
|
3942
|
+
const isStandardVendor = licenceType === import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR;
|
|
3887
3943
|
if (!isStandardVendor) {
|
|
3888
3944
|
return;
|
|
3889
3945
|
}
|
|
@@ -3930,7 +3986,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
|
|
|
3930
3986
|
return (result?.matchedCount ?? 0) > 0;
|
|
3931
3987
|
}
|
|
3932
3988
|
async function restoreVendorProFeatures(userId, licenceType) {
|
|
3933
|
-
const isProVendor = licenceType ===
|
|
3989
|
+
const isProVendor = licenceType === import_cluemart_shared32.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR;
|
|
3934
3990
|
if (!isProVendor) {
|
|
3935
3991
|
return;
|
|
3936
3992
|
}
|
|
@@ -3951,14 +4007,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
|
|
|
3951
4007
|
return false;
|
|
3952
4008
|
}
|
|
3953
4009
|
const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs4.default)(stripe.paymentGracePeriodEndsAt) : null;
|
|
3954
|
-
const hasActivePaymentGracePeriod = (stripe.status ===
|
|
4010
|
+
const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared32.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared32.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
|
|
3955
4011
|
if (hasActivePaymentGracePeriod) {
|
|
3956
4012
|
return true;
|
|
3957
4013
|
}
|
|
3958
4014
|
if (!stripe.subscriptionId) {
|
|
3959
4015
|
return false;
|
|
3960
4016
|
}
|
|
3961
|
-
if (stripe.status !==
|
|
4017
|
+
if (stripe.status !== import_cluemart_shared32.EnumSubscriptionStatus.ACTIVE) {
|
|
3962
4018
|
return false;
|
|
3963
4019
|
}
|
|
3964
4020
|
if (!stripe.endDate) {
|
|
@@ -3978,7 +4034,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
3978
4034
|
return;
|
|
3979
4035
|
}
|
|
3980
4036
|
const proLicences = vendorLicencesOfUser.filter(
|
|
3981
|
-
(licence) => licence.licenceType !==
|
|
4037
|
+
(licence) => licence.licenceType !== import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR
|
|
3982
4038
|
);
|
|
3983
4039
|
const expiredProLicences = proLicences.filter(
|
|
3984
4040
|
(licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now)
|
|
@@ -3991,7 +4047,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
3991
4047
|
const expiredProLicence = expiredProLicences.some(
|
|
3992
4048
|
(licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
3993
4049
|
);
|
|
3994
|
-
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences,
|
|
4050
|
+
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared32.vendorLicences, now);
|
|
3995
4051
|
const hasExpiredVendorLicence = vendorLicencesOfUser.some(
|
|
3996
4052
|
(licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
3997
4053
|
);
|
|
@@ -4007,7 +4063,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4007
4063
|
"owner.userId": user._id
|
|
4008
4064
|
}).lean().exec();
|
|
4009
4065
|
}
|
|
4010
|
-
const licencesToSync =
|
|
4066
|
+
const licencesToSync = import_cluemart_shared32.vendorLicences.filter(
|
|
4011
4067
|
(licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
|
|
4012
4068
|
);
|
|
4013
4069
|
await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
|
|
@@ -4022,11 +4078,11 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4022
4078
|
data: {
|
|
4023
4079
|
resourceId: String(vendor._id),
|
|
4024
4080
|
resourceName: vendor.name,
|
|
4025
|
-
resourceType:
|
|
4081
|
+
resourceType: import_cluemart_shared32.EnumNotificationResourceType.DOWNGRADED_VENDOR
|
|
4026
4082
|
},
|
|
4027
4083
|
message: `Your Vendor licence has been downgraded due to licence expiration.`,
|
|
4028
4084
|
title: `Vendor Licence Downgraded`,
|
|
4029
|
-
type:
|
|
4085
|
+
type: import_cluemart_shared32.EnumNotificationType.SYSTEM,
|
|
4030
4086
|
userIds: [user._id]
|
|
4031
4087
|
};
|
|
4032
4088
|
await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
|
|
@@ -4059,7 +4115,7 @@ async function vendorOwnerHasProLicence(vendorId) {
|
|
|
4059
4115
|
effectiveVendorLicences,
|
|
4060
4116
|
"vendor" /* VENDOR */
|
|
4061
4117
|
);
|
|
4062
|
-
return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[
|
|
4118
|
+
return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared32.EnumUserLicence.PRO_VENDOR];
|
|
4063
4119
|
}
|
|
4064
4120
|
|
|
4065
4121
|
// src/service/license/compliance/utils.ts
|
|
@@ -4069,12 +4125,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
|
|
|
4069
4125
|
const pipeline = buildLicenceExpiryPipeline({
|
|
4070
4126
|
downgradeBranches: [
|
|
4071
4127
|
{
|
|
4072
|
-
case:
|
|
4073
|
-
then:
|
|
4128
|
+
case: import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR,
|
|
4129
|
+
then: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
|
|
4074
4130
|
},
|
|
4075
4131
|
{
|
|
4076
|
-
case:
|
|
4077
|
-
then:
|
|
4132
|
+
case: import_cluemart_shared33.EnumUserLicence.PRO_VENDOR,
|
|
4133
|
+
then: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
|
|
4078
4134
|
}
|
|
4079
4135
|
],
|
|
4080
4136
|
licenceTypes,
|
|
@@ -4203,7 +4259,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
|
|
|
4203
4259
|
var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
4204
4260
|
|
|
4205
4261
|
// src/service/license/reminder/utils.ts
|
|
4206
|
-
var
|
|
4262
|
+
var import_cluemart_shared34 = require("@timardex/cluemart-shared");
|
|
4207
4263
|
var import_utils8 = require("@timardex/cluemart-shared/utils");
|
|
4208
4264
|
var import_dayjs7 = __toESM(require("dayjs"));
|
|
4209
4265
|
|
|
@@ -4269,28 +4325,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
|
|
|
4269
4325
|
return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
|
|
4270
4326
|
}
|
|
4271
4327
|
function getLicenseName(licenceType) {
|
|
4272
|
-
return
|
|
4328
|
+
return import_cluemart_shared34.licenseNiceNames[licenceType] || licenceType;
|
|
4273
4329
|
}
|
|
4274
4330
|
function getNotificationTypes(isVendorLicense, isPartnerLicense) {
|
|
4275
4331
|
if (isVendorLicense) {
|
|
4276
4332
|
return {
|
|
4277
|
-
notificationType:
|
|
4278
|
-
resourceType:
|
|
4333
|
+
notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
|
|
4334
|
+
resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
|
|
4279
4335
|
};
|
|
4280
4336
|
}
|
|
4281
4337
|
if (isPartnerLicense) {
|
|
4282
4338
|
return {
|
|
4283
|
-
notificationType:
|
|
4284
|
-
resourceType:
|
|
4339
|
+
notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
|
|
4340
|
+
resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
|
|
4285
4341
|
};
|
|
4286
4342
|
}
|
|
4287
4343
|
return {
|
|
4288
|
-
notificationType:
|
|
4289
|
-
resourceType:
|
|
4344
|
+
notificationType: import_cluemart_shared34.EnumNotificationType.SYSTEM,
|
|
4345
|
+
resourceType: import_cluemart_shared34.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
|
|
4290
4346
|
};
|
|
4291
4347
|
}
|
|
4292
4348
|
async function getLicenseResourceInfo(user, licence) {
|
|
4293
|
-
const isVendorLicense =
|
|
4349
|
+
const isVendorLicense = import_cluemart_shared34.vendorLicences.includes(licence.licenceType);
|
|
4294
4350
|
const isPartnerLicense = partnerLicences.includes(licence.licenceType);
|
|
4295
4351
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4296
4352
|
const { notificationType, resourceType } = getNotificationTypes(
|
|
@@ -4338,11 +4394,11 @@ async function getLicenseResourceInfo(user, licence) {
|
|
|
4338
4394
|
};
|
|
4339
4395
|
}
|
|
4340
4396
|
function getLicenceExpiryMode(licenceType) {
|
|
4341
|
-
return licenceType ===
|
|
4397
|
+
return licenceType === import_cluemart_shared34.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
|
|
4342
4398
|
}
|
|
4343
4399
|
async function sendLicenseReminder(user, licence) {
|
|
4344
4400
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4345
|
-
const expiryDate = (0, import_dayjs7.default)(licence.expiryDate).format(
|
|
4401
|
+
const expiryDate = (0, import_dayjs7.default)(licence.expiryDate).format(import_cluemart_shared34.dateFormat);
|
|
4346
4402
|
const userId = String(user._id);
|
|
4347
4403
|
const resourceInfo = await getLicenseResourceInfo(user, licence);
|
|
4348
4404
|
if (!resourceInfo) {
|