@timardex/cluemart-server-shared 2.1.0 → 2.1.2

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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, RelationDate, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType } from '@timardex/cluemart-shared';
2
+ import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, RelationDate, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType } from '@timardex/cluemart-shared';
3
3
  import * as mongoose from 'mongoose';
4
4
  import mongoose__default from 'mongoose';
5
5
  export { default as mongoose } from 'mongoose';
@@ -9,12 +9,55 @@ export { default as express } from 'express';
9
9
  import dayjs, { Dayjs } from 'dayjs';
10
10
  import { EnumUserLicence as EnumUserLicence$1 } from '@timardex/cluemart-shared/enums';
11
11
 
12
+ declare const schemaAdresource: mongoose__default.Schema<_timardex_cluemart_shared.AdResource, mongoose__default.Model<_timardex_cluemart_shared.AdResource, any, any, any, mongoose__default.Document<unknown, any, _timardex_cluemart_shared.AdResource, any, {}> & _timardex_cluemart_shared.AdResource & {
13
+ _id: mongoose__default.Types.ObjectId;
14
+ } & {
15
+ __v: number;
16
+ }, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, _timardex_cluemart_shared.AdResource, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<_timardex_cluemart_shared.AdResource>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<_timardex_cluemart_shared.AdResource> & {
17
+ _id: mongoose__default.Types.ObjectId;
18
+ } & {
19
+ __v: number;
20
+ }>;
12
21
  declare const AdModel: mongoose__default.Model<AdType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdType, {}, {}> & AdType & Required<{
13
22
  _id: string;
14
23
  }> & {
15
24
  __v: number;
16
25
  }, any>;
17
26
 
27
+ declare const AD_BILLING_CATALOG_COLLECTION_NAME = "adBillingCatalog";
28
+ declare const AdBillingCatalogModel: mongoose__default.Model<AdDailyPriceType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdDailyPriceType, {}, {}> & AdDailyPriceType & Required<{
29
+ _id: string;
30
+ }> & {
31
+ __v: number;
32
+ }, any>;
33
+
34
+ declare const AdBookingModel: mongoose__default.Model<AdBookingType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdBookingType, {}, {}> & AdBookingType & Required<{
35
+ _id: string;
36
+ }> & {
37
+ __v: number;
38
+ }, any>;
39
+
40
+ type AdImpressionEntry = {
41
+ _id: string;
42
+ adId: string;
43
+ dayKey: string;
44
+ placement: EnumAdShowOn.FRONT_PAGE | EnumAdShowOn.MARKET_SEARCH;
45
+ recordedAt: Date;
46
+ viewerSlotKey: string;
47
+ };
48
+ declare const AdImpressionModel: mongoose__default.Model<AdImpressionEntry, {}, {}, {}, mongoose__default.Document<unknown, {}, AdImpressionEntry, {}, {}> & AdImpressionEntry & Required<{
49
+ _id: string;
50
+ }> & {
51
+ __v: number;
52
+ }, any>;
53
+
54
+ declare const DEFAULT_AD_SETTINGS: AdSettingsType;
55
+ declare const AdSettingsModel: mongoose__default.Model<AdSettingsType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdSettingsType, {}, {}> & AdSettingsType & Required<{
56
+ _id: "default";
57
+ }> & {
58
+ __v: number;
59
+ }, any>;
60
+
18
61
  type SchemaChatMessageReplyPreviewType = Omit<NonNullable<ChatMessageType["replyPreview"]>, "senderId"> & {
19
62
  senderId: ObjectId;
20
63
  };
@@ -584,6 +627,9 @@ type SchemaUserType = Omit<UserType, "vendor" | "coupon" | "events" | "partner"
584
627
  type SchemaStripeSubscription = StripeSubscription & {
585
628
  billingPeriod?: EnumBillingPeriod;
586
629
  cancelAtPeriodEnd?: boolean;
630
+ paymentFailedAt?: Date;
631
+ paymentGracePeriodEndsAt?: Date;
632
+ paymentGraceSubscriptionId?: string;
587
633
  pendingBillingPeriod?: EnumBillingPeriod;
588
634
  pendingChangeEffectiveAt?: Date;
589
635
  pendingPlan?: EnumUserLicence;
@@ -882,13 +928,14 @@ type AwardAffiliateVendorSubscriptionRewardsResult = {
882
928
  * - `affiliateResources.resourceOwner` has a non-expired Standard / Pro / Pro+ vendor licence
883
929
  *
884
930
  * Reward type follows the owner's highest valid licence + Stripe paying status:
885
- * - Pro / Pro+ with paying Stripe (ACTIVE/TRIALING) → `ACTIVE_VENDOR_PRO_SUBSCRIPTION` (3 pts)
931
+ * - Pro / Pro+ with paying Stripe (ACTIVE) → `ACTIVE_VENDOR_PRO_SUBSCRIPTION` (3 pts)
886
932
  * - Pro / Pro+ without paying Stripe → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
887
933
  * - Standard → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
888
934
  *
889
935
  * Idempotent per affiliate + vendor + calendar month — a mid-month licence
890
936
  * upgrade (Standard → paying Pro) takes effect from the following month.
891
- * On successful award, notifies the affiliate owner (best-effort).
937
+ * On successful awards, sends the affiliate owner a single aggregated
938
+ * notification per run (best-effort).
892
939
  *
893
940
  * @param now - Reference time for month bounds and licence expiry (defaults to now).
894
941
  * @returns Counts of awarded and skipped candidates.
@@ -1050,7 +1097,8 @@ type PayingStripeSubscriptionPlanResult = {
1050
1097
  };
1051
1098
  /**
1052
1099
  * Returns the paying Stripe plan when `currentPlan` is any PRO plan
1053
- * (event or vendor) and the subscription is active/trialing.
1100
+ * (event or vendor), the subscription is active, and its finite paid-through
1101
+ * `endDate` is later than `now`. Status alone does not establish paid access.
1054
1102
  */
1055
1103
  declare function getPayingStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
1056
1104
  /**
@@ -1278,7 +1326,9 @@ declare function getVendorResourceInfo(userId: ObjectId, vendorId: ObjectId): Pr
1278
1326
  declare enum LicenceExpiryDate {
1279
1327
  ONE_YEAR = "1 year",
1280
1328
  ONE_MONTH = "1 month",
1281
- TWO_MONTHS = "2 months"
1329
+ TWO_MONTHS = "2 months",
1330
+ THREE_MONTHS = "3 months",
1331
+ SIX_MONTHS = "6 months"
1282
1332
  }
1283
1333
  declare enum LicenceCategory {
1284
1334
  EVENT = "event",
@@ -1323,4 +1373,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1323
1373
  resourceType: EnumResourceType;
1324
1374
  }): Promise<void>;
1325
1375
 
1326
- export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, LicenceExpiryDate, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorLicences, vendorOwnerHasProLicence, vendorProductTypeSchema };
1376
+ export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, LicenceExpiryDate, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorLicences, vendorOwnerHasProLicence, vendorProductTypeSchema };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, RelationDate, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType } from '@timardex/cluemart-shared';
2
+ import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, RelationDate, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType } from '@timardex/cluemart-shared';
3
3
  import * as mongoose from 'mongoose';
4
4
  import mongoose__default from 'mongoose';
5
5
  export { default as mongoose } from 'mongoose';
@@ -9,12 +9,55 @@ export { default as express } from 'express';
9
9
  import dayjs, { Dayjs } from 'dayjs';
10
10
  import { EnumUserLicence as EnumUserLicence$1 } from '@timardex/cluemart-shared/enums';
11
11
 
12
+ declare const schemaAdresource: mongoose__default.Schema<_timardex_cluemart_shared.AdResource, mongoose__default.Model<_timardex_cluemart_shared.AdResource, any, any, any, mongoose__default.Document<unknown, any, _timardex_cluemart_shared.AdResource, any, {}> & _timardex_cluemart_shared.AdResource & {
13
+ _id: mongoose__default.Types.ObjectId;
14
+ } & {
15
+ __v: number;
16
+ }, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, _timardex_cluemart_shared.AdResource, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<_timardex_cluemart_shared.AdResource>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<_timardex_cluemart_shared.AdResource> & {
17
+ _id: mongoose__default.Types.ObjectId;
18
+ } & {
19
+ __v: number;
20
+ }>;
12
21
  declare const AdModel: mongoose__default.Model<AdType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdType, {}, {}> & AdType & Required<{
13
22
  _id: string;
14
23
  }> & {
15
24
  __v: number;
16
25
  }, any>;
17
26
 
27
+ declare const AD_BILLING_CATALOG_COLLECTION_NAME = "adBillingCatalog";
28
+ declare const AdBillingCatalogModel: mongoose__default.Model<AdDailyPriceType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdDailyPriceType, {}, {}> & AdDailyPriceType & Required<{
29
+ _id: string;
30
+ }> & {
31
+ __v: number;
32
+ }, any>;
33
+
34
+ declare const AdBookingModel: mongoose__default.Model<AdBookingType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdBookingType, {}, {}> & AdBookingType & Required<{
35
+ _id: string;
36
+ }> & {
37
+ __v: number;
38
+ }, any>;
39
+
40
+ type AdImpressionEntry = {
41
+ _id: string;
42
+ adId: string;
43
+ dayKey: string;
44
+ placement: EnumAdShowOn.FRONT_PAGE | EnumAdShowOn.MARKET_SEARCH;
45
+ recordedAt: Date;
46
+ viewerSlotKey: string;
47
+ };
48
+ declare const AdImpressionModel: mongoose__default.Model<AdImpressionEntry, {}, {}, {}, mongoose__default.Document<unknown, {}, AdImpressionEntry, {}, {}> & AdImpressionEntry & Required<{
49
+ _id: string;
50
+ }> & {
51
+ __v: number;
52
+ }, any>;
53
+
54
+ declare const DEFAULT_AD_SETTINGS: AdSettingsType;
55
+ declare const AdSettingsModel: mongoose__default.Model<AdSettingsType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdSettingsType, {}, {}> & AdSettingsType & Required<{
56
+ _id: "default";
57
+ }> & {
58
+ __v: number;
59
+ }, any>;
60
+
18
61
  type SchemaChatMessageReplyPreviewType = Omit<NonNullable<ChatMessageType["replyPreview"]>, "senderId"> & {
19
62
  senderId: ObjectId;
20
63
  };
@@ -584,6 +627,9 @@ type SchemaUserType = Omit<UserType, "vendor" | "coupon" | "events" | "partner"
584
627
  type SchemaStripeSubscription = StripeSubscription & {
585
628
  billingPeriod?: EnumBillingPeriod;
586
629
  cancelAtPeriodEnd?: boolean;
630
+ paymentFailedAt?: Date;
631
+ paymentGracePeriodEndsAt?: Date;
632
+ paymentGraceSubscriptionId?: string;
587
633
  pendingBillingPeriod?: EnumBillingPeriod;
588
634
  pendingChangeEffectiveAt?: Date;
589
635
  pendingPlan?: EnumUserLicence;
@@ -882,13 +928,14 @@ type AwardAffiliateVendorSubscriptionRewardsResult = {
882
928
  * - `affiliateResources.resourceOwner` has a non-expired Standard / Pro / Pro+ vendor licence
883
929
  *
884
930
  * Reward type follows the owner's highest valid licence + Stripe paying status:
885
- * - Pro / Pro+ with paying Stripe (ACTIVE/TRIALING) → `ACTIVE_VENDOR_PRO_SUBSCRIPTION` (3 pts)
931
+ * - Pro / Pro+ with paying Stripe (ACTIVE) → `ACTIVE_VENDOR_PRO_SUBSCRIPTION` (3 pts)
886
932
  * - Pro / Pro+ without paying Stripe → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
887
933
  * - Standard → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
888
934
  *
889
935
  * Idempotent per affiliate + vendor + calendar month — a mid-month licence
890
936
  * upgrade (Standard → paying Pro) takes effect from the following month.
891
- * On successful award, notifies the affiliate owner (best-effort).
937
+ * On successful awards, sends the affiliate owner a single aggregated
938
+ * notification per run (best-effort).
892
939
  *
893
940
  * @param now - Reference time for month bounds and licence expiry (defaults to now).
894
941
  * @returns Counts of awarded and skipped candidates.
@@ -1050,7 +1097,8 @@ type PayingStripeSubscriptionPlanResult = {
1050
1097
  };
1051
1098
  /**
1052
1099
  * Returns the paying Stripe plan when `currentPlan` is any PRO plan
1053
- * (event or vendor) and the subscription is active/trialing.
1100
+ * (event or vendor), the subscription is active, and its finite paid-through
1101
+ * `endDate` is later than `now`. Status alone does not establish paid access.
1054
1102
  */
1055
1103
  declare function getPayingStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
1056
1104
  /**
@@ -1278,7 +1326,9 @@ declare function getVendorResourceInfo(userId: ObjectId, vendorId: ObjectId): Pr
1278
1326
  declare enum LicenceExpiryDate {
1279
1327
  ONE_YEAR = "1 year",
1280
1328
  ONE_MONTH = "1 month",
1281
- TWO_MONTHS = "2 months"
1329
+ TWO_MONTHS = "2 months",
1330
+ THREE_MONTHS = "3 months",
1331
+ SIX_MONTHS = "6 months"
1282
1332
  }
1283
1333
  declare enum LicenceCategory {
1284
1334
  EVENT = "event",
@@ -1323,4 +1373,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1323
1373
  resourceType: EnumResourceType;
1324
1374
  }): Promise<void>;
1325
1375
 
1326
- export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, LicenceExpiryDate, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorLicences, vendorOwnerHasProLicence, vendorProductTypeSchema };
1376
+ export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, LicenceExpiryDate, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorLicences, vendorOwnerHasProLicence, vendorProductTypeSchema };