@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 CHANGED
@@ -54,7 +54,6 @@ __export(index_exports, {
54
54
  GameModel: () => GameModel,
55
55
  GoogleImportedMarketModel: () => GoogleImportedMarketModel,
56
56
  LicenceCategory: () => LicenceCategory,
57
- LicenceExpiryDate: () => LicenceExpiryDate,
58
57
  NotificationModel: () => NotificationModel,
59
58
  OwnerTypeSchema: () => OwnerTypeSchema,
60
59
  PartnerModel: () => PartnerModel,
@@ -146,7 +145,6 @@ __export(index_exports, {
146
145
  updateSingleDateTimeStatus: () => updateSingleDateTimeStatus,
147
146
  upgradeUserToLicence: () => upgradeUserToLicence,
148
147
  userLicenseSchema: () => userLicenseSchema,
149
- vendorLicences: () => vendorLicences,
150
148
  vendorOwnerHasProLicence: () => vendorOwnerHasProLicence,
151
149
  vendorProductTypeSchema: () => vendorProductTypeSchema
152
150
  });
@@ -3605,12 +3603,6 @@ var import_dayjs4 = __toESM(require("dayjs"));
3605
3603
  var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3606
3604
  var import_dayjs3 = __toESM(require("dayjs"));
3607
3605
  var import_graphql = require("graphql");
3608
- var LicenceExpiryDate = /* @__PURE__ */ ((LicenceExpiryDate2) => {
3609
- LicenceExpiryDate2["ONE_YEAR"] = "1 year";
3610
- LicenceExpiryDate2["ONE_MONTH"] = "1 month";
3611
- LicenceExpiryDate2["TWO_MONTHS"] = "2 months";
3612
- return LicenceExpiryDate2;
3613
- })(LicenceExpiryDate || {});
3614
3606
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
3615
3607
  LicenceCategory2["EVENT"] = "event";
3616
3608
  LicenceCategory2["PARTNER"] = "partner";
@@ -3692,9 +3684,11 @@ function getHighestLicenceForCategory(licences, category) {
3692
3684
  function createLicenceObject(expiryDate, licenceType) {
3693
3685
  const today = (0, import_dayjs3.default)();
3694
3686
  const expiryDateMapping = {
3695
- ["1 year" /* ONE_YEAR */]: today.add(1, "year").endOf("day").toDate(),
3696
- ["1 month" /* ONE_MONTH */]: today.add(1, "month").endOf("day").toDate(),
3697
- ["2 months" /* TWO_MONTHS */]: today.add(2, "month").endOf("day").toDate()
3687
+ [import_cluemart_shared29.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
3688
+ [import_cluemart_shared29.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
3689
+ [import_cluemart_shared29.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
3690
+ [import_cluemart_shared29.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
3691
+ [import_cluemart_shared29.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
3698
3692
  };
3699
3693
  const licenceObject = {
3700
3694
  expiryDate: expiryDateMapping[expiryDate],
@@ -3946,11 +3940,6 @@ async function restoreVendorProFeatures(userId, licenceType) {
3946
3940
  throw error;
3947
3941
  }
3948
3942
  }
3949
- var vendorLicences = [
3950
- import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR,
3951
- import_cluemart_shared30.EnumUserLicence.PRO_VENDOR,
3952
- import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR
3953
- ];
3954
3943
  function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
3955
3944
  const stripe = user.stripe;
3956
3945
  if (!stripe || stripe.currentPlan !== licenceType) {
@@ -3997,7 +3986,7 @@ async function handleVendorLicenceCompliance(user, now) {
3997
3986
  const expiredProLicence = expiredProLicences.some(
3998
3987
  (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
3999
3988
  );
4000
- const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
3989
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared30.vendorLicences, now);
4001
3990
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
4002
3991
  (licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
4003
3992
  );
@@ -4013,7 +4002,7 @@ async function handleVendorLicenceCompliance(user, now) {
4013
4002
  "owner.userId": user._id
4014
4003
  }).lean().exec();
4015
4004
  }
4016
- const licencesToSync = vendorLicences.filter(
4005
+ const licencesToSync = import_cluemart_shared30.vendorLicences.filter(
4017
4006
  (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
4018
4007
  );
4019
4008
  await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
@@ -4296,7 +4285,7 @@ function getNotificationTypes(isVendorLicense, isPartnerLicense) {
4296
4285
  };
4297
4286
  }
4298
4287
  async function getLicenseResourceInfo(user, licence) {
4299
- const isVendorLicense = vendorLicences.includes(licence.licenceType);
4288
+ const isVendorLicense = import_cluemart_shared32.vendorLicences.includes(licence.licenceType);
4300
4289
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
4301
4290
  const licenceName = getLicenseName(licence.licenceType);
4302
4291
  const { notificationType, resourceType } = getNotificationTypes(
@@ -4497,7 +4486,6 @@ async function remindUsersAboutLicenseExpiration() {
4497
4486
  GameModel,
4498
4487
  GoogleImportedMarketModel,
4499
4488
  LicenceCategory,
4500
- LicenceExpiryDate,
4501
4489
  NotificationModel,
4502
4490
  OwnerTypeSchema,
4503
4491
  PartnerModel,
@@ -4589,7 +4577,6 @@ async function remindUsersAboutLicenseExpiration() {
4589
4577
  updateSingleDateTimeStatus,
4590
4578
  upgradeUserToLicence,
4591
4579
  userLicenseSchema,
4592
- vendorLicences,
4593
4580
  vendorOwnerHasProLicence,
4594
4581
  vendorProductTypeSchema
4595
4582
  });