@timardex/cluemart-server-shared 2.1.1 → 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 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -8
- package/dist/index.d.ts +2 -8
- package/dist/index.mjs +12 -20
- package/dist/index.mjs.map +1 -1
- package/dist/service/index.cjs +8 -21
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +2 -8
- package/dist/service/index.d.ts +2 -8
- package/dist/service/index.mjs +12 -20
- 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,12 +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
|
-
return LicenceExpiryDate2;
|
|
3522
|
-
})(LicenceExpiryDate || {});
|
|
3523
3515
|
var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
3524
3516
|
LicenceCategory2["EVENT"] = "event";
|
|
3525
3517
|
LicenceCategory2["PARTNER"] = "partner";
|
|
@@ -3601,9 +3593,11 @@ function getHighestLicenceForCategory(licences, category) {
|
|
|
3601
3593
|
function createLicenceObject(expiryDate, licenceType) {
|
|
3602
3594
|
const today = (0, import_dayjs3.default)();
|
|
3603
3595
|
const expiryDateMapping = {
|
|
3604
|
-
[
|
|
3605
|
-
[
|
|
3606
|
-
[
|
|
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()
|
|
3607
3601
|
};
|
|
3608
3602
|
const licenceObject = {
|
|
3609
3603
|
expiryDate: expiryDateMapping[expiryDate],
|
|
@@ -3855,11 +3849,6 @@ async function restoreVendorProFeatures(userId, licenceType) {
|
|
|
3855
3849
|
throw error;
|
|
3856
3850
|
}
|
|
3857
3851
|
}
|
|
3858
|
-
var vendorLicences = [
|
|
3859
|
-
import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR,
|
|
3860
|
-
import_cluemart_shared30.EnumUserLicence.PRO_VENDOR,
|
|
3861
|
-
import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR
|
|
3862
|
-
];
|
|
3863
3852
|
function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
|
|
3864
3853
|
const stripe = user.stripe;
|
|
3865
3854
|
if (!stripe || stripe.currentPlan !== licenceType) {
|
|
@@ -3906,7 +3895,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
3906
3895
|
const expiredProLicence = expiredProLicences.some(
|
|
3907
3896
|
(licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
3908
3897
|
);
|
|
3909
|
-
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
|
|
3898
|
+
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared30.vendorLicences, now);
|
|
3910
3899
|
const hasExpiredVendorLicence = vendorLicencesOfUser.some(
|
|
3911
3900
|
(licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
3912
3901
|
);
|
|
@@ -3922,7 +3911,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
3922
3911
|
"owner.userId": user._id
|
|
3923
3912
|
}).lean().exec();
|
|
3924
3913
|
}
|
|
3925
|
-
const licencesToSync = vendorLicences.filter(
|
|
3914
|
+
const licencesToSync = import_cluemart_shared30.vendorLicences.filter(
|
|
3926
3915
|
(licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
|
|
3927
3916
|
);
|
|
3928
3917
|
await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
|
|
@@ -4205,7 +4194,7 @@ function getNotificationTypes(isVendorLicense, isPartnerLicense) {
|
|
|
4205
4194
|
};
|
|
4206
4195
|
}
|
|
4207
4196
|
async function getLicenseResourceInfo(user, licence) {
|
|
4208
|
-
const isVendorLicense = vendorLicences.includes(licence.licenceType);
|
|
4197
|
+
const isVendorLicense = import_cluemart_shared32.vendorLicences.includes(licence.licenceType);
|
|
4209
4198
|
const isPartnerLicense = partnerLicences.includes(licence.licenceType);
|
|
4210
4199
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4211
4200
|
const { notificationType, resourceType } = getNotificationTypes(
|
|
@@ -4384,7 +4373,6 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4384
4373
|
0 && (module.exports = {
|
|
4385
4374
|
ACTIVE_NOT_DELETED_FILTER,
|
|
4386
4375
|
LicenceCategory,
|
|
4387
|
-
LicenceExpiryDate,
|
|
4388
4376
|
REMINDER_WINDOW_MAX_HOURS,
|
|
4389
4377
|
REMINDER_WINDOW_MIN_HOURS,
|
|
4390
4378
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
@@ -4443,7 +4431,6 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4443
4431
|
updateRelationDatesToUnavailable,
|
|
4444
4432
|
updateSingleDateTimeStatus,
|
|
4445
4433
|
upgradeUserToLicence,
|
|
4446
|
-
vendorLicences,
|
|
4447
4434
|
vendorOwnerHasProLicence
|
|
4448
4435
|
});
|
|
4449
4436
|
//# sourceMappingURL=index.cjs.map
|