@timardex/cluemart-server-shared 2.1.2 → 2.1.5

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,13 +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
- THREE_MONTHS = "3 months",
437
- SIX_MONTHS = "6 months"
438
- }
439
431
  declare enum LicenceCategory {
440
432
  EVENT = "event",
441
433
  PARTNER = "partner",
@@ -479,4 +471,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
479
471
  resourceType: EnumResourceType;
480
472
  }): Promise<void>;
481
473
 
482
- 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,13 +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
- THREE_MONTHS = "3 months",
437
- SIX_MONTHS = "6 months"
438
- }
439
431
  declare enum LicenceCategory {
440
432
  EVENT = "event",
441
433
  PARTNER = "partner",
@@ -479,4 +471,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
479
471
  resourceType: EnumResourceType;
480
472
  }): Promise<void>;
481
473
 
482
- 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 };
@@ -8,7 +8,7 @@ import {
8
8
  PushTokenModel,
9
9
  UserModel,
10
10
  VendorModel
11
- } from "../chunk-MEEBCSMJ.mjs";
11
+ } from "../chunk-M4ZWI4YC.mjs";
12
12
  import "../chunk-6PNG5BI5.mjs";
13
13
 
14
14
  // src/service/promoCode/constants.ts
@@ -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,18 +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
- LicenceExpiryDate2["THREE_MONTHS"] = "3 months";
1044
- LicenceExpiryDate2["SIX_MONTHS"] = "6 months";
1045
- return LicenceExpiryDate2;
1046
- })(LicenceExpiryDate || {});
1047
1041
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
1048
1042
  LicenceCategory2["EVENT"] = "event";
1049
1043
  LicenceCategory2["PARTNER"] = "partner";
@@ -1125,11 +1119,11 @@ function getHighestLicenceForCategory(licences, category) {
1125
1119
  function createLicenceObject(expiryDate, licenceType) {
1126
1120
  const today = dayjs3();
1127
1121
  const expiryDateMapping = {
1128
- ["1 year" /* ONE_YEAR */]: today.add(1, "year").endOf("day").toDate(),
1129
- ["1 month" /* ONE_MONTH */]: today.add(1, "month").endOf("day").toDate(),
1130
- ["2 months" /* TWO_MONTHS */]: today.add(2, "month").endOf("day").toDate(),
1131
- ["3 months" /* THREE_MONTHS */]: today.add(3, "month").endOf("day").toDate(),
1132
- ["6 months" /* SIX_MONTHS */]: today.add(6, "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()
1133
1127
  };
1134
1128
  const licenceObject = {
1135
1129
  expiryDate: expiryDateMapping[expiryDate],
@@ -1381,11 +1375,6 @@ async function restoreVendorProFeatures(userId, licenceType) {
1381
1375
  throw error;
1382
1376
  }
1383
1377
  }
1384
- var vendorLicences = [
1385
- EnumUserLicence6.STANDARD_VENDOR,
1386
- EnumUserLicence6.PRO_VENDOR,
1387
- EnumUserLicence6.PRO_PLUS_VENDOR
1388
- ];
1389
1378
  function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
1390
1379
  const stripe = user.stripe;
1391
1380
  if (!stripe || stripe.currentPlan !== licenceType) {
@@ -1649,7 +1638,8 @@ import {
1649
1638
  EnumNotificationResourceType as EnumNotificationResourceType4,
1650
1639
  EnumNotificationType as EnumNotificationType4,
1651
1640
  EnumUserLicence as EnumUserLicence8,
1652
- licenseNiceNames
1641
+ licenseNiceNames,
1642
+ vendorLicences as vendorLicences2
1653
1643
  } from "@timardex/cluemart-shared";
1654
1644
  import { formatDate } from "@timardex/cluemart-shared/utils";
1655
1645
  import dayjs7 from "dayjs";
@@ -1737,7 +1727,7 @@ function getNotificationTypes(isVendorLicense, isPartnerLicense) {
1737
1727
  };
1738
1728
  }
1739
1729
  async function getLicenseResourceInfo(user, licence) {
1740
- const isVendorLicense = vendorLicences.includes(licence.licenceType);
1730
+ const isVendorLicense = vendorLicences2.includes(licence.licenceType);
1741
1731
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
1742
1732
  const licenceName = getLicenseName(licence.licenceType);
1743
1733
  const { notificationType, resourceType } = getNotificationTypes(
@@ -1915,7 +1905,6 @@ async function remindUsersAboutLicenseExpiration() {
1915
1905
  export {
1916
1906
  ACTIVE_NOT_DELETED_FILTER,
1917
1907
  LicenceCategory,
1918
- LicenceExpiryDate,
1919
1908
  REMINDER_WINDOW_MAX_HOURS,
1920
1909
  REMINDER_WINDOW_MIN_HOURS,
1921
1910
  SUBSCRIPTION_REWARD_TIMEZONE,
@@ -1974,7 +1963,6 @@ export {
1974
1963
  updateRelationDatesToUnavailable,
1975
1964
  updateSingleDateTimeStatus,
1976
1965
  upgradeUserToLicence,
1977
- vendorLicences,
1978
1966
  vendorOwnerHasProLicence
1979
1967
  };
1980
1968
  //# sourceMappingURL=index.mjs.map