@timardex/cluemart-server-shared 2.1.2 → 2.1.5
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/{chunk-MEEBCSMJ.mjs → chunk-M4ZWI4YC.mjs} +2 -1
- package/dist/chunk-M4ZWI4YC.mjs.map +1 -0
- package/dist/index.cjs +9 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -10
- package/dist/index.d.ts +2 -10
- package/dist/index.mjs +13 -24
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +1 -0
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +9 -25
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +2 -10
- package/dist/service/index.d.ts +2 -10
- package/dist/service/index.mjs +13 -25
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-MEEBCSMJ.mjs.map +0 -1
package/dist/mongoose/index.mjs
CHANGED
package/dist/service/index.cjs
CHANGED
|
@@ -32,7 +32,6 @@ var service_exports = {};
|
|
|
32
32
|
__export(service_exports, {
|
|
33
33
|
ACTIVE_NOT_DELETED_FILTER: () => ACTIVE_NOT_DELETED_FILTER,
|
|
34
34
|
LicenceCategory: () => LicenceCategory,
|
|
35
|
-
LicenceExpiryDate: () => LicenceExpiryDate,
|
|
36
35
|
REMINDER_WINDOW_MAX_HOURS: () => REMINDER_WINDOW_MAX_HOURS,
|
|
37
36
|
REMINDER_WINDOW_MIN_HOURS: () => REMINDER_WINDOW_MIN_HOURS,
|
|
38
37
|
SUBSCRIPTION_REWARD_TIMEZONE: () => SUBSCRIPTION_REWARD_TIMEZONE,
|
|
@@ -91,7 +90,6 @@ __export(service_exports, {
|
|
|
91
90
|
updateRelationDatesToUnavailable: () => updateRelationDatesToUnavailable,
|
|
92
91
|
updateSingleDateTimeStatus: () => updateSingleDateTimeStatus,
|
|
93
92
|
upgradeUserToLicence: () => upgradeUserToLicence,
|
|
94
|
-
vendorLicences: () => vendorLicences,
|
|
95
93
|
vendorOwnerHasProLicence: () => vendorOwnerHasProLicence
|
|
96
94
|
});
|
|
97
95
|
module.exports = __toCommonJS(service_exports);
|
|
@@ -1658,6 +1656,7 @@ var schema12 = new MongooseSchema12(
|
|
|
1658
1656
|
schema12.index({ "licences.expiryDate": 1 });
|
|
1659
1657
|
schema12.index({ "licences.licenceType": 1 });
|
|
1660
1658
|
schema12.index({ promoCodes: 1, active: 1, deletedAt: 1 });
|
|
1659
|
+
schema12.index({ email: "text", firstName: "text", lastName: "text" });
|
|
1661
1660
|
var UserModel = import_mongoose16.default.models.User || import_mongoose16.default.model("User", schema12);
|
|
1662
1661
|
|
|
1663
1662
|
// src/mongoose/VerificationToken.ts
|
|
@@ -3514,14 +3513,6 @@ var import_dayjs4 = __toESM(require("dayjs"));
|
|
|
3514
3513
|
var import_cluemart_shared29 = require("@timardex/cluemart-shared");
|
|
3515
3514
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
3516
3515
|
var import_graphql = require("graphql");
|
|
3517
|
-
var LicenceExpiryDate = /* @__PURE__ */ ((LicenceExpiryDate2) => {
|
|
3518
|
-
LicenceExpiryDate2["ONE_YEAR"] = "1 year";
|
|
3519
|
-
LicenceExpiryDate2["ONE_MONTH"] = "1 month";
|
|
3520
|
-
LicenceExpiryDate2["TWO_MONTHS"] = "2 months";
|
|
3521
|
-
LicenceExpiryDate2["THREE_MONTHS"] = "3 months";
|
|
3522
|
-
LicenceExpiryDate2["SIX_MONTHS"] = "6 months";
|
|
3523
|
-
return LicenceExpiryDate2;
|
|
3524
|
-
})(LicenceExpiryDate || {});
|
|
3525
3516
|
var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
3526
3517
|
LicenceCategory2["EVENT"] = "event";
|
|
3527
3518
|
LicenceCategory2["PARTNER"] = "partner";
|
|
@@ -3603,11 +3594,11 @@ function getHighestLicenceForCategory(licences, category) {
|
|
|
3603
3594
|
function createLicenceObject(expiryDate, licenceType) {
|
|
3604
3595
|
const today = (0, import_dayjs3.default)();
|
|
3605
3596
|
const expiryDateMapping = {
|
|
3606
|
-
[
|
|
3607
|
-
[
|
|
3608
|
-
[
|
|
3609
|
-
[
|
|
3610
|
-
[
|
|
3597
|
+
[import_cluemart_shared29.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
|
|
3598
|
+
[import_cluemart_shared29.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
|
|
3599
|
+
[import_cluemart_shared29.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
|
|
3600
|
+
[import_cluemart_shared29.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
|
|
3601
|
+
[import_cluemart_shared29.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
|
|
3611
3602
|
};
|
|
3612
3603
|
const licenceObject = {
|
|
3613
3604
|
expiryDate: expiryDateMapping[expiryDate],
|
|
@@ -3859,11 +3850,6 @@ async function restoreVendorProFeatures(userId, licenceType) {
|
|
|
3859
3850
|
throw error;
|
|
3860
3851
|
}
|
|
3861
3852
|
}
|
|
3862
|
-
var vendorLicences = [
|
|
3863
|
-
import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR,
|
|
3864
|
-
import_cluemart_shared30.EnumUserLicence.PRO_VENDOR,
|
|
3865
|
-
import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR
|
|
3866
|
-
];
|
|
3867
3853
|
function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
|
|
3868
3854
|
const stripe = user.stripe;
|
|
3869
3855
|
if (!stripe || stripe.currentPlan !== licenceType) {
|
|
@@ -3910,7 +3896,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
3910
3896
|
const expiredProLicence = expiredProLicences.some(
|
|
3911
3897
|
(licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
3912
3898
|
);
|
|
3913
|
-
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
|
|
3899
|
+
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared30.vendorLicences, now);
|
|
3914
3900
|
const hasExpiredVendorLicence = vendorLicencesOfUser.some(
|
|
3915
3901
|
(licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
3916
3902
|
);
|
|
@@ -3926,7 +3912,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
3926
3912
|
"owner.userId": user._id
|
|
3927
3913
|
}).lean().exec();
|
|
3928
3914
|
}
|
|
3929
|
-
const licencesToSync = vendorLicences.filter(
|
|
3915
|
+
const licencesToSync = import_cluemart_shared30.vendorLicences.filter(
|
|
3930
3916
|
(licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
|
|
3931
3917
|
);
|
|
3932
3918
|
await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
|
|
@@ -4209,7 +4195,7 @@ function getNotificationTypes(isVendorLicense, isPartnerLicense) {
|
|
|
4209
4195
|
};
|
|
4210
4196
|
}
|
|
4211
4197
|
async function getLicenseResourceInfo(user, licence) {
|
|
4212
|
-
const isVendorLicense = vendorLicences.includes(licence.licenceType);
|
|
4198
|
+
const isVendorLicense = import_cluemart_shared32.vendorLicences.includes(licence.licenceType);
|
|
4213
4199
|
const isPartnerLicense = partnerLicences.includes(licence.licenceType);
|
|
4214
4200
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4215
4201
|
const { notificationType, resourceType } = getNotificationTypes(
|
|
@@ -4388,7 +4374,6 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4388
4374
|
0 && (module.exports = {
|
|
4389
4375
|
ACTIVE_NOT_DELETED_FILTER,
|
|
4390
4376
|
LicenceCategory,
|
|
4391
|
-
LicenceExpiryDate,
|
|
4392
4377
|
REMINDER_WINDOW_MAX_HOURS,
|
|
4393
4378
|
REMINDER_WINDOW_MIN_HOURS,
|
|
4394
4379
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
@@ -4447,7 +4432,6 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4447
4432
|
updateRelationDatesToUnavailable,
|
|
4448
4433
|
updateSingleDateTimeStatus,
|
|
4449
4434
|
upgradeUserToLicence,
|
|
4450
|
-
vendorLicences,
|
|
4451
4435
|
vendorOwnerHasProLicence
|
|
4452
4436
|
});
|
|
4453
4437
|
//# sourceMappingURL=index.cjs.map
|