@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 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,14 +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
- LicenceExpiryDate2["THREE_MONTHS"] = "3 months";
3613
- LicenceExpiryDate2["SIX_MONTHS"] = "6 months";
3614
- return LicenceExpiryDate2;
3615
- })(LicenceExpiryDate || {});
3616
3606
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
3617
3607
  LicenceCategory2["EVENT"] = "event";
3618
3608
  LicenceCategory2["PARTNER"] = "partner";
@@ -3694,11 +3684,11 @@ function getHighestLicenceForCategory(licences, category) {
3694
3684
  function createLicenceObject(expiryDate, licenceType) {
3695
3685
  const today = (0, import_dayjs3.default)();
3696
3686
  const expiryDateMapping = {
3697
- ["1 year" /* ONE_YEAR */]: today.add(1, "year").endOf("day").toDate(),
3698
- ["1 month" /* ONE_MONTH */]: today.add(1, "month").endOf("day").toDate(),
3699
- ["2 months" /* TWO_MONTHS */]: today.add(2, "month").endOf("day").toDate(),
3700
- ["3 months" /* THREE_MONTHS */]: today.add(3, "month").endOf("day").toDate(),
3701
- ["6 months" /* SIX_MONTHS */]: today.add(6, "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()
3702
3692
  };
3703
3693
  const licenceObject = {
3704
3694
  expiryDate: expiryDateMapping[expiryDate],
@@ -3950,11 +3940,6 @@ async function restoreVendorProFeatures(userId, licenceType) {
3950
3940
  throw error;
3951
3941
  }
3952
3942
  }
3953
- var vendorLicences = [
3954
- import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR,
3955
- import_cluemart_shared30.EnumUserLicence.PRO_VENDOR,
3956
- import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR
3957
- ];
3958
3943
  function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
3959
3944
  const stripe = user.stripe;
3960
3945
  if (!stripe || stripe.currentPlan !== licenceType) {
@@ -4001,7 +3986,7 @@ async function handleVendorLicenceCompliance(user, now) {
4001
3986
  const expiredProLicence = expiredProLicences.some(
4002
3987
  (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
4003
3988
  );
4004
- const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
3989
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared30.vendorLicences, now);
4005
3990
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
4006
3991
  (licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
4007
3992
  );
@@ -4017,7 +4002,7 @@ async function handleVendorLicenceCompliance(user, now) {
4017
4002
  "owner.userId": user._id
4018
4003
  }).lean().exec();
4019
4004
  }
4020
- const licencesToSync = vendorLicences.filter(
4005
+ const licencesToSync = import_cluemart_shared30.vendorLicences.filter(
4021
4006
  (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
4022
4007
  );
4023
4008
  await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
@@ -4300,7 +4285,7 @@ function getNotificationTypes(isVendorLicense, isPartnerLicense) {
4300
4285
  };
4301
4286
  }
4302
4287
  async function getLicenseResourceInfo(user, licence) {
4303
- const isVendorLicense = vendorLicences.includes(licence.licenceType);
4288
+ const isVendorLicense = import_cluemart_shared32.vendorLicences.includes(licence.licenceType);
4304
4289
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
4305
4290
  const licenceName = getLicenseName(licence.licenceType);
4306
4291
  const { notificationType, resourceType } = getNotificationTypes(
@@ -4501,7 +4486,6 @@ async function remindUsersAboutLicenseExpiration() {
4501
4486
  GameModel,
4502
4487
  GoogleImportedMarketModel,
4503
4488
  LicenceCategory,
4504
- LicenceExpiryDate,
4505
4489
  NotificationModel,
4506
4490
  OwnerTypeSchema,
4507
4491
  PartnerModel,
@@ -4593,7 +4577,6 @@ async function remindUsersAboutLicenseExpiration() {
4593
4577
  updateSingleDateTimeStatus,
4594
4578
  upgradeUserToLicence,
4595
4579
  userLicenseSchema,
4596
- vendorLicences,
4597
4580
  vendorOwnerHasProLicence,
4598
4581
  vendorProductTypeSchema
4599
4582
  });