@timardex/cluemart-server-shared 2.1.2 → 2.1.4
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/index.cjs +8 -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 +12 -24
- package/dist/index.mjs.map +1 -1
- package/dist/service/index.cjs +8 -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 +12 -24
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
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);
|
|
@@ -3514,14 +3512,6 @@ var import_dayjs4 = __toESM(require("dayjs"));
|
|
|
3514
3512
|
var import_cluemart_shared29 = require("@timardex/cluemart-shared");
|
|
3515
3513
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
3516
3514
|
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
3515
|
var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
3526
3516
|
LicenceCategory2["EVENT"] = "event";
|
|
3527
3517
|
LicenceCategory2["PARTNER"] = "partner";
|
|
@@ -3603,11 +3593,11 @@ function getHighestLicenceForCategory(licences, category) {
|
|
|
3603
3593
|
function createLicenceObject(expiryDate, licenceType) {
|
|
3604
3594
|
const today = (0, import_dayjs3.default)();
|
|
3605
3595
|
const expiryDateMapping = {
|
|
3606
|
-
[
|
|
3607
|
-
[
|
|
3608
|
-
[
|
|
3609
|
-
[
|
|
3610
|
-
[
|
|
3596
|
+
[import_cluemart_shared29.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
|
|
3597
|
+
[import_cluemart_shared29.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
|
|
3598
|
+
[import_cluemart_shared29.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
|
|
3599
|
+
[import_cluemart_shared29.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
|
|
3600
|
+
[import_cluemart_shared29.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
|
|
3611
3601
|
};
|
|
3612
3602
|
const licenceObject = {
|
|
3613
3603
|
expiryDate: expiryDateMapping[expiryDate],
|
|
@@ -3859,11 +3849,6 @@ async function restoreVendorProFeatures(userId, licenceType) {
|
|
|
3859
3849
|
throw error;
|
|
3860
3850
|
}
|
|
3861
3851
|
}
|
|
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
3852
|
function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
|
|
3868
3853
|
const stripe = user.stripe;
|
|
3869
3854
|
if (!stripe || stripe.currentPlan !== licenceType) {
|
|
@@ -3910,7 +3895,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
3910
3895
|
const expiredProLicence = expiredProLicences.some(
|
|
3911
3896
|
(licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
3912
3897
|
);
|
|
3913
|
-
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
|
|
3898
|
+
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared30.vendorLicences, now);
|
|
3914
3899
|
const hasExpiredVendorLicence = vendorLicencesOfUser.some(
|
|
3915
3900
|
(licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
3916
3901
|
);
|
|
@@ -3926,7 +3911,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
3926
3911
|
"owner.userId": user._id
|
|
3927
3912
|
}).lean().exec();
|
|
3928
3913
|
}
|
|
3929
|
-
const licencesToSync = vendorLicences.filter(
|
|
3914
|
+
const licencesToSync = import_cluemart_shared30.vendorLicences.filter(
|
|
3930
3915
|
(licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
|
|
3931
3916
|
);
|
|
3932
3917
|
await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
|
|
@@ -4209,7 +4194,7 @@ function getNotificationTypes(isVendorLicense, isPartnerLicense) {
|
|
|
4209
4194
|
};
|
|
4210
4195
|
}
|
|
4211
4196
|
async function getLicenseResourceInfo(user, licence) {
|
|
4212
|
-
const isVendorLicense = vendorLicences.includes(licence.licenceType);
|
|
4197
|
+
const isVendorLicense = import_cluemart_shared32.vendorLicences.includes(licence.licenceType);
|
|
4213
4198
|
const isPartnerLicense = partnerLicences.includes(licence.licenceType);
|
|
4214
4199
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4215
4200
|
const { notificationType, resourceType } = getNotificationTypes(
|
|
@@ -4388,7 +4373,6 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4388
4373
|
0 && (module.exports = {
|
|
4389
4374
|
ACTIVE_NOT_DELETED_FILTER,
|
|
4390
4375
|
LicenceCategory,
|
|
4391
|
-
LicenceExpiryDate,
|
|
4392
4376
|
REMINDER_WINDOW_MAX_HOURS,
|
|
4393
4377
|
REMINDER_WINDOW_MIN_HOURS,
|
|
4394
4378
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
@@ -4447,7 +4431,6 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4447
4431
|
updateRelationDatesToUnavailable,
|
|
4448
4432
|
updateSingleDateTimeStatus,
|
|
4449
4433
|
upgradeUserToLicence,
|
|
4450
|
-
vendorLicences,
|
|
4451
4434
|
vendorOwnerHasProLicence
|
|
4452
4435
|
});
|
|
4453
4436
|
//# sourceMappingURL=index.cjs.map
|