@timardex/cluemart-server-shared 1.1.23 → 1.1.25

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
@@ -7,6 +7,7 @@ import { NotificationCount, DateTimeType as DateTimeType$1 } from '@timardex/clu
7
7
  import express from 'express';
8
8
  export { default as express } from 'express';
9
9
  import dayjs from 'dayjs';
10
+ import { EnumUserLicence as EnumUserLicence$1 } from '@timardex/cluemart-shared/enums';
10
11
 
11
12
  declare const AdModel: mongoose__default.Model<AdType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdType, {}, {}> & AdType & Required<{
12
13
  _id: string;
@@ -873,7 +874,7 @@ declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null
873
874
  * otherwise falls back to the Standard subscription reward.
874
875
  * Returns `null` when no non-expired vendor licence applies.
875
876
  */
876
- declare function mapVendorLicenceToSubscriptionRewardType(licences: UserLicenceType[] | null | undefined, now?: Date, stripe?: UserType["stripe"] | null): EnumAffiliateRewardType | null;
877
+ declare function mapVendorLicenceToSubscriptionRewardType(userId: ObjectId | string, now?: Date): Promise<EnumAffiliateRewardType | null>;
877
878
  /** Inclusive start / exclusive end of the UTC calendar month containing `now`. */
878
879
  declare function getSubscriptionRewardPeriodBounds(now?: Date): {
879
880
  periodEnd: Date;
@@ -981,4 +982,25 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
981
982
  */
982
983
  declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
983
984
 
984
- export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, 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 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, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getSubscriptionRewardPeriodBounds, isValidObjectId, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, productCouponSchema, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema, vendorProductTypeSchema };
985
+ type PayingStripeSubscriptionPlanResult = {
986
+ hasSubscription: boolean;
987
+ plan: EnumUserLicence$1 | null;
988
+ validTypes: Set<EnumUserLicence$1>;
989
+ };
990
+ /**
991
+ * Returns the paying Stripe plan when `currentPlan` is any PRO plan
992
+ * (event or vendor) and the subscription is active/trialing.
993
+ */
994
+ declare function getPayingStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
995
+ /**
996
+ * Like {@link getPayingStripeSubscriptionPlan} but only treats a vendor PRO
997
+ * plan (`PRO_VENDOR` / `PRO_PLUS_VENDOR`) as paying.
998
+ */
999
+ declare function getPayingVendorStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
1000
+ /**
1001
+ * Like {@link getPayingStripeSubscriptionPlan} but only treats an event PRO
1002
+ * plan (`PRO_EVENT` / `PRO_PLUS_EVENT`) as paying.
1003
+ */
1004
+ declare function getPayingEventStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
1005
+
1006
+ export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, 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 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, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, isValidObjectId, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, productCouponSchema, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema, vendorProductTypeSchema };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import { NotificationCount, DateTimeType as DateTimeType$1 } from '@timardex/clu
7
7
  import express from 'express';
8
8
  export { default as express } from 'express';
9
9
  import dayjs from 'dayjs';
10
+ import { EnumUserLicence as EnumUserLicence$1 } from '@timardex/cluemart-shared/enums';
10
11
 
11
12
  declare const AdModel: mongoose__default.Model<AdType, {}, {}, {}, mongoose__default.Document<unknown, {}, AdType, {}, {}> & AdType & Required<{
12
13
  _id: string;
@@ -873,7 +874,7 @@ declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null
873
874
  * otherwise falls back to the Standard subscription reward.
874
875
  * Returns `null` when no non-expired vendor licence applies.
875
876
  */
876
- declare function mapVendorLicenceToSubscriptionRewardType(licences: UserLicenceType[] | null | undefined, now?: Date, stripe?: UserType["stripe"] | null): EnumAffiliateRewardType | null;
877
+ declare function mapVendorLicenceToSubscriptionRewardType(userId: ObjectId | string, now?: Date): Promise<EnumAffiliateRewardType | null>;
877
878
  /** Inclusive start / exclusive end of the UTC calendar month containing `now`. */
878
879
  declare function getSubscriptionRewardPeriodBounds(now?: Date): {
879
880
  periodEnd: Date;
@@ -981,4 +982,25 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
981
982
  */
982
983
  declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
983
984
 
984
- export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, 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 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, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getSubscriptionRewardPeriodBounds, isValidObjectId, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, productCouponSchema, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema, vendorProductTypeSchema };
985
+ type PayingStripeSubscriptionPlanResult = {
986
+ hasSubscription: boolean;
987
+ plan: EnumUserLicence$1 | null;
988
+ validTypes: Set<EnumUserLicence$1>;
989
+ };
990
+ /**
991
+ * Returns the paying Stripe plan when `currentPlan` is any PRO plan
992
+ * (event or vendor) and the subscription is active/trialing.
993
+ */
994
+ declare function getPayingStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
995
+ /**
996
+ * Like {@link getPayingStripeSubscriptionPlan} but only treats a vendor PRO
997
+ * plan (`PRO_VENDOR` / `PRO_PLUS_VENDOR`) as paying.
998
+ */
999
+ declare function getPayingVendorStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
1000
+ /**
1001
+ * Like {@link getPayingStripeSubscriptionPlan} but only treats an event PRO
1002
+ * plan (`PRO_EVENT` / `PRO_PLUS_EVENT`) as paying.
1003
+ */
1004
+ declare function getPayingEventStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
1005
+
1006
+ export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, 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 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, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, isValidObjectId, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, productCouponSchema, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema, vendorProductTypeSchema };
package/dist/index.mjs CHANGED
@@ -3393,17 +3393,17 @@ var gameScreenIdentifierList = [
3393
3393
  {
3394
3394
  clue: "Where your actions turn into a timeline.",
3395
3395
  id: "activities",
3396
- match: "/profile/activities"
3396
+ match: "/profile/account/favourites"
3397
3397
  },
3398
3398
  {
3399
3399
  clue: "Where conversations happen without speaking.",
3400
3400
  id: "chat",
3401
- match: "/profile/chat"
3401
+ match: "/chat"
3402
3402
  },
3403
3403
  {
3404
3404
  clue: "The place to redefine who you are.",
3405
3405
  id: "edit-profile",
3406
- match: "/profile/edit-profile"
3406
+ match: "/profile/account"
3407
3407
  },
3408
3408
  {
3409
3409
  clue: "A single moment worth showing up for.",
@@ -3581,8 +3581,8 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
3581
3581
  return EnumActivity2;
3582
3582
  })(EnumActivity || {});
3583
3583
  var EnumPostType = /* @__PURE__ */ ((EnumPostType2) => {
3584
- EnumPostType2["MARKET_FACES"] = "market_faces";
3585
3584
  EnumPostType2["CLUE_BITES"] = "clue_bites";
3585
+ EnumPostType2["MARKET_FACES"] = "market_faces";
3586
3586
  EnumPostType2["PLAY_AND_WIN"] = "play_and_win";
3587
3587
  return EnumPostType2;
3588
3588
  })(EnumPostType || {});
@@ -4763,6 +4763,13 @@ var registerFields = [
4763
4763
  placeholder: "Last Name",
4764
4764
  required: true
4765
4765
  },
4766
+ {
4767
+ helperText: "Enter Nickname",
4768
+ keyboardType: "default",
4769
+ name: "nickName",
4770
+ placeholder: "Nickname",
4771
+ required: false
4772
+ },
4766
4773
  {
4767
4774
  ...emailField,
4768
4775
  required: true
@@ -4822,6 +4829,13 @@ var profileFields = [
4822
4829
  name: "lastName",
4823
4830
  placeholder: "Last Name"
4824
4831
  },
4832
+ {
4833
+ helperText: "Enter Nickname",
4834
+ keyboardType: "default",
4835
+ name: "nickName",
4836
+ placeholder: "Nickname",
4837
+ required: false
4838
+ },
4825
4839
  {
4826
4840
  helperText: "Enter your new password",
4827
4841
  keyboardType: "default",
@@ -5066,6 +5080,7 @@ var USER_FIELDS_FRAGMENT = gql`
5066
5080
  game
5067
5081
  isTester
5068
5082
  lastName
5083
+ nickName
5069
5084
  licences {
5070
5085
  ...LicenceFields
5071
5086
  }
@@ -7665,6 +7680,17 @@ var GET_AFFILIATES = gql`
7665
7680
  }
7666
7681
  ${AFFILIATE_FIELDS_FRAGMENT}
7667
7682
  `;
7683
+ var CREATE_AFFILIATE_MUTATION = gql`
7684
+ mutation createAffiliate($input: AffiliateDetailsInputType!) {
7685
+ createAffiliate(input: $input) {
7686
+ data {
7687
+ ...AffiliateFields
7688
+ }
7689
+ message
7690
+ }
7691
+ }
7692
+ ${AFFILIATE_FIELDS_FRAGMENT}
7693
+ `;
7668
7694
  var UPDATE_AFFILIATE_DETAILS_MUTATION = gql`
7669
7695
  mutation updateAffiliateDetails(
7670
7696
  $input: AffiliateDetailsInputType!
@@ -8761,6 +8787,18 @@ var EnumRegions2 = /* @__PURE__ */ ((EnumRegions22) => {
8761
8787
  EnumRegions22["Wellington"] = "Wellington";
8762
8788
  return EnumRegions22;
8763
8789
  })(EnumRegions2 || {});
8790
+ var EnumUserLicence2 = /* @__PURE__ */ ((EnumUserLicence22) => {
8791
+ EnumUserLicence22["PRO_EVENT"] = "pro_event";
8792
+ EnumUserLicence22["PRO_PLUS_EVENT"] = "pro_plus_event";
8793
+ EnumUserLicence22["PRO_PLUS_VENDOR"] = "pro_plus_vendor";
8794
+ EnumUserLicence22["PRO_VENDOR"] = "pro_vendor";
8795
+ EnumUserLicence22["STANDARD_EVENT"] = "standard_event";
8796
+ EnumUserLicence22["STANDARD_VENDOR"] = "standard_vendor";
8797
+ EnumUserLicence22["STANDARD_PARTNER"] = "standard_partner";
8798
+ EnumUserLicence22["STANDARD_AFFILIATE"] = "standard_affiliate";
8799
+ EnumUserLicence22["STANDARD_SCHOOL"] = "standard_school";
8800
+ return EnumUserLicence22;
8801
+ })(EnumUserLicence2 || {});
8764
8802
  var EnumEventDateStatus2 = /* @__PURE__ */ ((EnumEventDateStatus22) => {
8765
8803
  EnumEventDateStatus22["STARTING_SOON"] = "Starting_Soon";
8766
8804
  EnumEventDateStatus22["STARTED"] = "Started";
@@ -8775,6 +8813,15 @@ var EnumEventDateStatus2 = /* @__PURE__ */ ((EnumEventDateStatus22) => {
8775
8813
  EnumEventDateStatus22["INVALID"] = "Invalid";
8776
8814
  return EnumEventDateStatus22;
8777
8815
  })(EnumEventDateStatus2 || {});
8816
+ var EnumSubscriptionStatus2 = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
8817
+ EnumSubscriptionStatus22["ACTIVE"] = "active";
8818
+ EnumSubscriptionStatus22["INACTIVE"] = "inactive";
8819
+ EnumSubscriptionStatus22["CANCELLED"] = "cancelled";
8820
+ EnumSubscriptionStatus22["NO_SUBSCRIPTION"] = "no_subscription";
8821
+ EnumSubscriptionStatus22["PAST_DUE"] = "past_due";
8822
+ EnumSubscriptionStatus22["TRIALING"] = "trialing";
8823
+ return EnumSubscriptionStatus22;
8824
+ })(EnumSubscriptionStatus2 || {});
8778
8825
 
8779
8826
  // src/mongoose/PushToken.ts
8780
8827
  import mongoose9 from "mongoose";
@@ -8966,6 +9013,7 @@ var schema7 = new MongooseSchema11(
8966
9013
  required: false,
8967
9014
  type: locationsSchema
8968
9015
  },
9016
+ nickName: { required: false, type: String },
8969
9017
  overallPoints: { default: 0, required: false, type: Number },
8970
9018
  partner: {
8971
9019
  ref: "Partner",
@@ -9939,7 +9987,7 @@ var SHARE_RESOURCE_LABEL2 = {
9939
9987
  school: "School"
9940
9988
  };
9941
9989
 
9942
- // node_modules/@timardex/cluemart-shared/dist/chunk-LA47T6CY.mjs
9990
+ // node_modules/@timardex/cluemart-shared/dist/chunk-GZZMH35Y.mjs
9943
9991
  var PROMO_CODE_PREFIX2 = "CM-";
9944
9992
  var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
9945
9993
  var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
@@ -9947,17 +9995,17 @@ var gameScreenIdentifierList2 = [
9947
9995
  {
9948
9996
  clue: "Where your actions turn into a timeline.",
9949
9997
  id: "activities",
9950
- match: "/profile/activities"
9998
+ match: "/profile/account/favourites"
9951
9999
  },
9952
10000
  {
9953
10001
  clue: "Where conversations happen without speaking.",
9954
10002
  id: "chat",
9955
- match: "/profile/chat"
10003
+ match: "/chat"
9956
10004
  },
9957
10005
  {
9958
10006
  clue: "The place to redefine who you are.",
9959
10007
  id: "edit-profile",
9960
- match: "/profile/edit-profile"
10008
+ match: "/profile/account"
9961
10009
  },
9962
10010
  {
9963
10011
  clue: "A single moment worth showing up for.",
@@ -10041,7 +10089,7 @@ var gameScreenIdentifierList2 = [
10041
10089
  }
10042
10090
  ];
10043
10091
 
10044
- // node_modules/@timardex/cluemart-shared/dist/chunk-Q2ZUHS2F.mjs
10092
+ // node_modules/@timardex/cluemart-shared/dist/chunk-TRWMYXB7.mjs
10045
10093
  import dayjs4 from "dayjs";
10046
10094
  var statusOptions2 = [
10047
10095
  ...Object.values(EnumInviteStatus2).map((status) => ({
@@ -11218,19 +11266,56 @@ async function sendPushNotifications({
11218
11266
  }
11219
11267
  }
11220
11268
 
11221
- // src/service/affiliate/vendorSubscriptionRewards.ts
11222
- function isPayingStripeSubscription(stripe) {
11223
- if (!stripe?.subscriptionId) return false;
11224
- return (stripe.status === EnumSubscriptionStatus.ACTIVE || stripe.status === EnumSubscriptionStatus.TRIALING) && (stripe.currentPlan === EnumUserLicence.PRO_VENDOR || stripe.currentPlan === EnumUserLicence.PRO_PLUS_VENDOR);
11225
- }
11226
- function mapVendorLicenceToSubscriptionRewardType(licences, now = /* @__PURE__ */ new Date(), stripe) {
11269
+ // src/service/license.ts
11270
+ var PRO_EVENT_PLANS = /* @__PURE__ */ new Set([
11271
+ EnumUserLicence2.PRO_EVENT,
11272
+ EnumUserLicence2.PRO_PLUS_EVENT
11273
+ ]);
11274
+ var PRO_VENDOR_PLANS = /* @__PURE__ */ new Set([
11275
+ EnumUserLicence2.PRO_VENDOR,
11276
+ EnumUserLicence2.PRO_PLUS_VENDOR
11277
+ ]);
11278
+ var PRO_PLANS = /* @__PURE__ */ new Set([
11279
+ ...PRO_EVENT_PLANS,
11280
+ ...PRO_VENDOR_PLANS
11281
+ ]);
11282
+ async function getPayingStripePlanFor(userId, now, payingPlans) {
11283
+ const user = await UserModel.findById(userId).select("licences stripe").lean().exec();
11284
+ if (!user) {
11285
+ return { hasSubscription: false, plan: null, validTypes: /* @__PURE__ */ new Set() };
11286
+ }
11287
+ const stripe = user.stripe;
11288
+ const licences = user.licences ?? [];
11227
11289
  const validTypes = new Set(
11228
- (licences ?? []).filter(
11290
+ licences.filter(
11229
11291
  (licence) => new Date(licence.expiryDate).getTime() > now.getTime()
11230
11292
  ).map((licence) => licence.licenceType)
11231
11293
  );
11294
+ if (stripe == null || stripe.subscriptionId == null) {
11295
+ return { hasSubscription: false, plan: null, validTypes };
11296
+ }
11297
+ const hasActiveStatus = stripe.status === EnumSubscriptionStatus2.ACTIVE || stripe.status === EnumSubscriptionStatus2.TRIALING;
11298
+ if (!hasActiveStatus || stripe.currentPlan == null) {
11299
+ return { hasSubscription: false, plan: null, validTypes };
11300
+ }
11301
+ const plan = payingPlans.has(stripe.currentPlan) ? stripe.currentPlan : null;
11302
+ return { hasSubscription: plan != null, plan, validTypes };
11303
+ }
11304
+ async function getPayingStripeSubscriptionPlan(userId, now = /* @__PURE__ */ new Date()) {
11305
+ return getPayingStripePlanFor(userId, now, PRO_PLANS);
11306
+ }
11307
+ async function getPayingVendorStripeSubscriptionPlan(userId, now = /* @__PURE__ */ new Date()) {
11308
+ return getPayingStripePlanFor(userId, now, PRO_VENDOR_PLANS);
11309
+ }
11310
+ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ */ new Date()) {
11311
+ return getPayingStripePlanFor(userId, now, PRO_EVENT_PLANS);
11312
+ }
11313
+
11314
+ // src/service/affiliate/vendorSubscriptionRewards.ts
11315
+ async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
11316
+ const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
11232
11317
  if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
11233
- if (isPayingStripeSubscription(stripe)) {
11318
+ if (hasSubscription) {
11234
11319
  return EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
11235
11320
  }
11236
11321
  return EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
@@ -11278,14 +11363,6 @@ async function isEligibleReferredVendor({
11278
11363
  }).exec();
11279
11364
  return Boolean(match);
11280
11365
  }
11281
- async function resolveSubscriptionRewardTypeForVendorOwner(vendorOwnerUserId, now) {
11282
- const vendorOwner = await UserModel.findById(vendorOwnerUserId).select("licences stripe").lean().exec();
11283
- return mapVendorLicenceToSubscriptionRewardType(
11284
- vendorOwner?.licences,
11285
- now,
11286
- vendorOwner?.stripe
11287
- );
11288
- }
11289
11366
  async function notifyAffiliateOwnerOfSubscriptionReward({
11290
11367
  affiliateId,
11291
11368
  affiliateOwnerUserId,
@@ -11375,7 +11452,7 @@ async function processAffiliateVendorReferral({
11375
11452
  if (!vendorEligible) {
11376
11453
  return "skipped";
11377
11454
  }
11378
- const rewardType = await resolveSubscriptionRewardTypeForVendorOwner(
11455
+ const rewardType = await mapVendorLicenceToSubscriptionRewardType(
11379
11456
  resource.resourceOwner.userId,
11380
11457
  now
11381
11458
  );
@@ -11833,6 +11910,9 @@ export {
11833
11910
  express,
11834
11911
  findAffiliateByPromoCode,
11835
11912
  findEventOrImportedMarketById,
11913
+ getPayingEventStripeSubscriptionPlan,
11914
+ getPayingStripeSubscriptionPlan,
11915
+ getPayingVendorStripeSubscriptionPlan,
11836
11916
  getSubscriptionRewardPeriodBounds,
11837
11917
  isValidObjectId,
11838
11918
  locationGeoSchema,