@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.
@@ -1,6 +1,6 @@
1
1
  import * as mongoose from 'mongoose';
2
2
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
3
- import { PromoCodeType, EnumAffiliateRewardType, DateTimeType, EventListItemType, DateTimeWithPriceType, EnumUserLicence as EnumUserLicence$1, UserLicenceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType } from '@timardex/cluemart-shared';
3
+ import { PromoCodeType, EnumAffiliateRewardType, DateTimeType, EventListItemType, DateTimeWithPriceType, EnumUserLicence as EnumUserLicence$1, UserLicenceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
4
4
  import { d as SchemaAffiliateResourceType, S as SchemaOwnerType, g as SchemaRelationType, j as SchemaUserType } from '../Affiliate-B1mxoMeD.mjs';
5
5
  import { O as ObjectId, G as GraphQLContext, e as SchemaCreateBulkNotificationInput } from '../index-Bq-lT7a2.mjs';
6
6
  import dayjs, { Dayjs } from 'dayjs';
@@ -321,7 +321,6 @@ declare function downgradeVendorProFeatures(userId: ObjectId, licenceType: EnumU
321
321
  * no snapshot exists), and keeps all images active.
322
322
  */
323
323
  declare function restoreVendorProFeatures(userId: ObjectId, licenceType: EnumUserLicence$1): Promise<void>;
324
- declare const vendorLicences: EnumUserLicence$1[];
325
324
  /**
326
325
  * Handles vendor licence compliance for a single user
327
326
  */
@@ -429,11 +428,6 @@ declare function getVendorResourceInfo(userId: ObjectId, vendorId: ObjectId): Pr
429
428
  resourceName: string;
430
429
  } | null>;
431
430
 
432
- declare enum LicenceExpiryDate {
433
- ONE_YEAR = "1 year",
434
- ONE_MONTH = "1 month",
435
- TWO_MONTHS = "2 months"
436
- }
437
431
  declare enum LicenceCategory {
438
432
  EVENT = "event",
439
433
  PARTNER = "partner",
@@ -477,4 +471,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
477
471
  resourceType: EnumResourceType;
478
472
  }): Promise<void>;
479
473
 
480
- export { ACTIVE_NOT_DELETED_FILTER, type AwardAffiliateVendorSubscriptionRewardsResult, LicenceCategory, LicenceExpiryDate, type NotificationPubSub, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, SUBSCRIPTION_REWARD_TIMEZONE, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, syncUserLicencesAfterExpiry, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, vendorLicences, vendorOwnerHasProLicence };
474
+ export { ACTIVE_NOT_DELETED_FILTER, type AwardAffiliateVendorSubscriptionRewardsResult, LicenceCategory, type NotificationPubSub, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, SUBSCRIPTION_REWARD_TIMEZONE, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, syncUserLicencesAfterExpiry, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, vendorOwnerHasProLicence };
@@ -1,6 +1,6 @@
1
1
  import * as mongoose from 'mongoose';
2
2
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
3
- import { PromoCodeType, EnumAffiliateRewardType, DateTimeType, EventListItemType, DateTimeWithPriceType, EnumUserLicence as EnumUserLicence$1, UserLicenceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType } from '@timardex/cluemart-shared';
3
+ import { PromoCodeType, EnumAffiliateRewardType, DateTimeType, EventListItemType, DateTimeWithPriceType, EnumUserLicence as EnumUserLicence$1, UserLicenceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
4
4
  import { d as SchemaAffiliateResourceType, S as SchemaOwnerType, g as SchemaRelationType, j as SchemaUserType } from '../Affiliate-Dlf_OLIh.js';
5
5
  import { O as ObjectId, G as GraphQLContext, e as SchemaCreateBulkNotificationInput } from '../index-Bq-lT7a2.js';
6
6
  import dayjs, { Dayjs } from 'dayjs';
@@ -321,7 +321,6 @@ declare function downgradeVendorProFeatures(userId: ObjectId, licenceType: EnumU
321
321
  * no snapshot exists), and keeps all images active.
322
322
  */
323
323
  declare function restoreVendorProFeatures(userId: ObjectId, licenceType: EnumUserLicence$1): Promise<void>;
324
- declare const vendorLicences: EnumUserLicence$1[];
325
324
  /**
326
325
  * Handles vendor licence compliance for a single user
327
326
  */
@@ -429,11 +428,6 @@ declare function getVendorResourceInfo(userId: ObjectId, vendorId: ObjectId): Pr
429
428
  resourceName: string;
430
429
  } | null>;
431
430
 
432
- declare enum LicenceExpiryDate {
433
- ONE_YEAR = "1 year",
434
- ONE_MONTH = "1 month",
435
- TWO_MONTHS = "2 months"
436
- }
437
431
  declare enum LicenceCategory {
438
432
  EVENT = "event",
439
433
  PARTNER = "partner",
@@ -477,4 +471,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
477
471
  resourceType: EnumResourceType;
478
472
  }): Promise<void>;
479
473
 
480
- export { ACTIVE_NOT_DELETED_FILTER, type AwardAffiliateVendorSubscriptionRewardsResult, LicenceCategory, LicenceExpiryDate, type NotificationPubSub, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, SUBSCRIPTION_REWARD_TIMEZONE, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, syncUserLicencesAfterExpiry, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, vendorLicences, vendorOwnerHasProLicence };
474
+ export { ACTIVE_NOT_DELETED_FILTER, type AwardAffiliateVendorSubscriptionRewardsResult, LicenceCategory, type NotificationPubSub, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, SUBSCRIPTION_REWARD_TIMEZONE, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, syncUserLicencesAfterExpiry, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, vendorOwnerHasProLicence };
@@ -1024,7 +1024,8 @@ import {
1024
1024
  EnumNotificationResourceType as EnumNotificationResourceType2,
1025
1025
  EnumNotificationType as EnumNotificationType2,
1026
1026
  EnumSubscriptionStatus as EnumSubscriptionStatus2,
1027
- EnumUserLicence as EnumUserLicence6
1027
+ EnumUserLicence as EnumUserLicence6,
1028
+ vendorLicences
1028
1029
  } from "@timardex/cluemart-shared";
1029
1030
  import dayjs4 from "dayjs";
1030
1031
 
@@ -1032,16 +1033,11 @@ import dayjs4 from "dayjs";
1032
1033
  import {
1033
1034
  EnumResourceType as EnumResourceType2,
1034
1035
  EnumUserLicence as EnumUserLicence5,
1035
- isNonVisitorResourceType
1036
+ isNonVisitorResourceType,
1037
+ LicenceExpiryDate
1036
1038
  } from "@timardex/cluemart-shared";
1037
1039
  import dayjs3 from "dayjs";
1038
1040
  import { GraphQLError } from "graphql";
1039
- var LicenceExpiryDate = /* @__PURE__ */ ((LicenceExpiryDate2) => {
1040
- LicenceExpiryDate2["ONE_YEAR"] = "1 year";
1041
- LicenceExpiryDate2["ONE_MONTH"] = "1 month";
1042
- LicenceExpiryDate2["TWO_MONTHS"] = "2 months";
1043
- return LicenceExpiryDate2;
1044
- })(LicenceExpiryDate || {});
1045
1041
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
1046
1042
  LicenceCategory2["EVENT"] = "event";
1047
1043
  LicenceCategory2["PARTNER"] = "partner";
@@ -1123,9 +1119,11 @@ function getHighestLicenceForCategory(licences, category) {
1123
1119
  function createLicenceObject(expiryDate, licenceType) {
1124
1120
  const today = dayjs3();
1125
1121
  const expiryDateMapping = {
1126
- ["1 year" /* ONE_YEAR */]: today.add(1, "year").endOf("day").toDate(),
1127
- ["1 month" /* ONE_MONTH */]: today.add(1, "month").endOf("day").toDate(),
1128
- ["2 months" /* TWO_MONTHS */]: today.add(2, "month").endOf("day").toDate()
1122
+ [LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
1123
+ [LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
1124
+ [LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
1125
+ [LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
1126
+ [LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
1129
1127
  };
1130
1128
  const licenceObject = {
1131
1129
  expiryDate: expiryDateMapping[expiryDate],
@@ -1377,11 +1375,6 @@ async function restoreVendorProFeatures(userId, licenceType) {
1377
1375
  throw error;
1378
1376
  }
1379
1377
  }
1380
- var vendorLicences = [
1381
- EnumUserLicence6.STANDARD_VENDOR,
1382
- EnumUserLicence6.PRO_VENDOR,
1383
- EnumUserLicence6.PRO_PLUS_VENDOR
1384
- ];
1385
1378
  function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
1386
1379
  const stripe = user.stripe;
1387
1380
  if (!stripe || stripe.currentPlan !== licenceType) {
@@ -1645,7 +1638,8 @@ import {
1645
1638
  EnumNotificationResourceType as EnumNotificationResourceType4,
1646
1639
  EnumNotificationType as EnumNotificationType4,
1647
1640
  EnumUserLicence as EnumUserLicence8,
1648
- licenseNiceNames
1641
+ licenseNiceNames,
1642
+ vendorLicences as vendorLicences2
1649
1643
  } from "@timardex/cluemart-shared";
1650
1644
  import { formatDate } from "@timardex/cluemart-shared/utils";
1651
1645
  import dayjs7 from "dayjs";
@@ -1733,7 +1727,7 @@ function getNotificationTypes(isVendorLicense, isPartnerLicense) {
1733
1727
  };
1734
1728
  }
1735
1729
  async function getLicenseResourceInfo(user, licence) {
1736
- const isVendorLicense = vendorLicences.includes(licence.licenceType);
1730
+ const isVendorLicense = vendorLicences2.includes(licence.licenceType);
1737
1731
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
1738
1732
  const licenceName = getLicenseName(licence.licenceType);
1739
1733
  const { notificationType, resourceType } = getNotificationTypes(
@@ -1911,7 +1905,6 @@ async function remindUsersAboutLicenseExpiration() {
1911
1905
  export {
1912
1906
  ACTIVE_NOT_DELETED_FILTER,
1913
1907
  LicenceCategory,
1914
- LicenceExpiryDate,
1915
1908
  REMINDER_WINDOW_MAX_HOURS,
1916
1909
  REMINDER_WINDOW_MIN_HOURS,
1917
1910
  SUBSCRIPTION_REWARD_TIMEZONE,
@@ -1970,7 +1963,6 @@ export {
1970
1963
  updateRelationDatesToUnavailable,
1971
1964
  updateSingleDateTimeStatus,
1972
1965
  upgradeUserToLicence,
1973
- vendorLicences,
1974
1966
  vendorOwnerHasProLicence
1975
1967
  };
1976
1968
  //# sourceMappingURL=index.mjs.map