@timardex/cluemart-server-shared 1.1.36 → 1.1.37
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 +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/dist/service/index.cjs +12 -4
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +14 -1
- package/dist/service/index.d.ts +14 -1
- package/dist/service/index.mjs +10 -4
- package/dist/service/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/service/index.cjs
CHANGED
|
@@ -33,6 +33,8 @@ __export(service_exports, {
|
|
|
33
33
|
ACTIVE_NOT_DELETED_FILTER: () => ACTIVE_NOT_DELETED_FILTER,
|
|
34
34
|
LicenceCategory: () => LicenceCategory,
|
|
35
35
|
LicenceExpiryDate: () => LicenceExpiryDate,
|
|
36
|
+
REMINDER_WINDOW_MAX_HOURS: () => REMINDER_WINDOW_MAX_HOURS,
|
|
37
|
+
REMINDER_WINDOW_MIN_HOURS: () => REMINDER_WINDOW_MIN_HOURS,
|
|
36
38
|
SUBSCRIPTION_REWARD_TIMEZONE: () => SUBSCRIPTION_REWARD_TIMEZONE,
|
|
37
39
|
activeAffiliateCodeExists: () => activeAffiliateCodeExists,
|
|
38
40
|
awardAffiliateVendorSubscriptionRewards: () => awardAffiliateVendorSubscriptionRewards,
|
|
@@ -9742,6 +9744,10 @@ async function getPartnerResourceInfo(userId, partnerId) {
|
|
|
9742
9744
|
// src/service/license/reminder/remindUsersAboutLicenseExpiration.ts
|
|
9743
9745
|
var import_dayjs12 = __toESM(require("dayjs"));
|
|
9744
9746
|
|
|
9747
|
+
// src/service/license/reminder/reminderWindow.ts
|
|
9748
|
+
var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
|
|
9749
|
+
var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
9750
|
+
|
|
9745
9751
|
// src/service/license/reminder/utils.ts
|
|
9746
9752
|
var import_dayjs11 = __toESM(require("dayjs"));
|
|
9747
9753
|
|
|
@@ -9803,8 +9809,8 @@ async function checkAndCreateNotification(payload) {
|
|
|
9803
9809
|
}
|
|
9804
9810
|
function isLicenseExpiringIn7Days(expiryDate, now) {
|
|
9805
9811
|
const expiry = (0, import_dayjs11.default)(expiryDate);
|
|
9806
|
-
const
|
|
9807
|
-
return
|
|
9812
|
+
const hoursUntilExpiry = expiry.diff(now, "hour", true);
|
|
9813
|
+
return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
|
|
9808
9814
|
}
|
|
9809
9815
|
function getLicenseName(licenceType) {
|
|
9810
9816
|
return licenseNiceNames[licenceType] || licenceType;
|
|
@@ -9968,8 +9974,8 @@ async function processUserLicenseReminders(user, now) {
|
|
|
9968
9974
|
async function remindUsersAboutLicenseExpiration() {
|
|
9969
9975
|
const now = (0, import_dayjs12.default)();
|
|
9970
9976
|
console.log(`\u{1F50D} Checking for licenses expiring in 7 days at ${now.format()}`);
|
|
9971
|
-
const minExpiryDate = now.add(
|
|
9972
|
-
const maxExpiryDate = now.add(
|
|
9977
|
+
const minExpiryDate = now.add(REMINDER_WINDOW_MIN_HOURS, "hour").toDate();
|
|
9978
|
+
const maxExpiryDate = now.add(REMINDER_WINDOW_MAX_HOURS, "hour").toDate();
|
|
9973
9979
|
const users = await UserModel.find({
|
|
9974
9980
|
licences: {
|
|
9975
9981
|
$elemMatch: {
|
|
@@ -10008,6 +10014,8 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
10008
10014
|
ACTIVE_NOT_DELETED_FILTER,
|
|
10009
10015
|
LicenceCategory,
|
|
10010
10016
|
LicenceExpiryDate,
|
|
10017
|
+
REMINDER_WINDOW_MAX_HOURS,
|
|
10018
|
+
REMINDER_WINDOW_MIN_HOURS,
|
|
10011
10019
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
10012
10020
|
activeAffiliateCodeExists,
|
|
10013
10021
|
awardAffiliateVendorSubscriptionRewards,
|