@timardex/cluemart-server-shared 1.1.33 → 1.1.35
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/{chunk-WLOHVSV6.mjs → chunk-ZVXL6B3M.mjs} +13 -7
- package/dist/chunk-ZVXL6B3M.mjs.map +1 -0
- package/dist/index.cjs +37 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.mjs +36 -25
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +12 -6
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +37 -25
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +7 -4
- package/dist/service/index.d.ts +7 -4
- package/dist/service/index.mjs +25 -20
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-WLOHVSV6.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -802,7 +802,7 @@ type AwardAffiliateVendorSubscriptionRewardsResult = {
|
|
|
802
802
|
* Awards monthly vendor subscription rewards to affiliates with active referred vendors.
|
|
803
803
|
*
|
|
804
804
|
* Eligibility per affiliate resource:
|
|
805
|
-
* - Affiliate is not soft-deleted
|
|
805
|
+
* - Affiliate is active and not soft-deleted
|
|
806
806
|
* - Linked `affiliateResources` entry is vendor, `resourceActive`, and not deleted
|
|
807
807
|
* - Vendor is active, not deleted, and `owner.userId` matches
|
|
808
808
|
* `affiliateResources.resourceOwner.userId`
|
|
@@ -813,7 +813,8 @@ type AwardAffiliateVendorSubscriptionRewardsResult = {
|
|
|
813
813
|
* - Pro / Pro+ without paying Stripe → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
|
|
814
814
|
* - Standard → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
|
|
815
815
|
*
|
|
816
|
-
* Idempotent per affiliate + vendor +
|
|
816
|
+
* Idempotent per affiliate + vendor + calendar month — a mid-month licence
|
|
817
|
+
* upgrade (Standard → paying Pro) takes effect from the following month.
|
|
817
818
|
* On successful award, notifies the affiliate owner (best-effort).
|
|
818
819
|
*
|
|
819
820
|
* @param now - Reference time for month bounds and licence expiry (defaults to now).
|
|
@@ -850,6 +851,8 @@ declare function findAffiliateByPromoCode(promoCode: PromoCodeType): Promise<(mo
|
|
|
850
851
|
*/
|
|
851
852
|
declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null | undefined): PromoCodeType[];
|
|
852
853
|
|
|
854
|
+
/** Timezone the monthly reward window aligns to (matches the cron scheduler's `tz`). */
|
|
855
|
+
declare const SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
|
|
853
856
|
/**
|
|
854
857
|
* Maps a vendor owner's highest valid vendor licence to a monthly subscription reward.
|
|
855
858
|
*
|
|
@@ -859,7 +862,7 @@ declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null
|
|
|
859
862
|
* Returns `null` when no non-expired vendor licence applies.
|
|
860
863
|
*/
|
|
861
864
|
declare function mapVendorLicenceToSubscriptionRewardType(userId: ObjectId | string, now?: Date): Promise<EnumAffiliateRewardType | null>;
|
|
862
|
-
/** Inclusive start / exclusive end of the
|
|
865
|
+
/** Inclusive start / exclusive end of the {@link SUBSCRIPTION_REWARD_TIMEZONE} calendar month containing `now`. */
|
|
863
866
|
declare function getSubscriptionRewardPeriodBounds(now?: Date): {
|
|
864
867
|
periodEnd: Date;
|
|
865
868
|
periodStart: Date;
|
|
@@ -987,4 +990,4 @@ declare function getPayingVendorStripeSubscriptionPlan(userId: ObjectId | string
|
|
|
987
990
|
*/
|
|
988
991
|
declare function getPayingEventStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
|
|
989
992
|
|
|
990
|
-
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, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema, vendorProductTypeSchema };
|
|
993
|
+
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, SUBSCRIPTION_REWARD_TIMEZONE, 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, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema, vendorProductTypeSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -802,7 +802,7 @@ type AwardAffiliateVendorSubscriptionRewardsResult = {
|
|
|
802
802
|
* Awards monthly vendor subscription rewards to affiliates with active referred vendors.
|
|
803
803
|
*
|
|
804
804
|
* Eligibility per affiliate resource:
|
|
805
|
-
* - Affiliate is not soft-deleted
|
|
805
|
+
* - Affiliate is active and not soft-deleted
|
|
806
806
|
* - Linked `affiliateResources` entry is vendor, `resourceActive`, and not deleted
|
|
807
807
|
* - Vendor is active, not deleted, and `owner.userId` matches
|
|
808
808
|
* `affiliateResources.resourceOwner.userId`
|
|
@@ -813,7 +813,8 @@ type AwardAffiliateVendorSubscriptionRewardsResult = {
|
|
|
813
813
|
* - Pro / Pro+ without paying Stripe → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
|
|
814
814
|
* - Standard → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
|
|
815
815
|
*
|
|
816
|
-
* Idempotent per affiliate + vendor +
|
|
816
|
+
* Idempotent per affiliate + vendor + calendar month — a mid-month licence
|
|
817
|
+
* upgrade (Standard → paying Pro) takes effect from the following month.
|
|
817
818
|
* On successful award, notifies the affiliate owner (best-effort).
|
|
818
819
|
*
|
|
819
820
|
* @param now - Reference time for month bounds and licence expiry (defaults to now).
|
|
@@ -850,6 +851,8 @@ declare function findAffiliateByPromoCode(promoCode: PromoCodeType): Promise<(mo
|
|
|
850
851
|
*/
|
|
851
852
|
declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null | undefined): PromoCodeType[];
|
|
852
853
|
|
|
854
|
+
/** Timezone the monthly reward window aligns to (matches the cron scheduler's `tz`). */
|
|
855
|
+
declare const SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
|
|
853
856
|
/**
|
|
854
857
|
* Maps a vendor owner's highest valid vendor licence to a monthly subscription reward.
|
|
855
858
|
*
|
|
@@ -859,7 +862,7 @@ declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null
|
|
|
859
862
|
* Returns `null` when no non-expired vendor licence applies.
|
|
860
863
|
*/
|
|
861
864
|
declare function mapVendorLicenceToSubscriptionRewardType(userId: ObjectId | string, now?: Date): Promise<EnumAffiliateRewardType | null>;
|
|
862
|
-
/** Inclusive start / exclusive end of the
|
|
865
|
+
/** Inclusive start / exclusive end of the {@link SUBSCRIPTION_REWARD_TIMEZONE} calendar month containing `now`. */
|
|
863
866
|
declare function getSubscriptionRewardPeriodBounds(now?: Date): {
|
|
864
867
|
periodEnd: Date;
|
|
865
868
|
periodStart: Date;
|
|
@@ -987,4 +990,4 @@ declare function getPayingVendorStripeSubscriptionPlan(userId: ObjectId | string
|
|
|
987
990
|
*/
|
|
988
991
|
declare function getPayingEventStripeSubscriptionPlan(userId: ObjectId | string, now?: Date): Promise<PayingStripeSubscriptionPlanResult>;
|
|
989
992
|
|
|
990
|
-
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, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema, vendorProductTypeSchema };
|
|
993
|
+
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, SUBSCRIPTION_REWARD_TIMEZONE, 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, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema, vendorProductTypeSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -3399,7 +3399,7 @@ var gameScreenIdentifierList = [
|
|
|
3399
3399
|
{
|
|
3400
3400
|
clue: "Where you can find your loyalties.",
|
|
3401
3401
|
id: "coupons",
|
|
3402
|
-
match: "/coupons"
|
|
3402
|
+
match: "/profile/account/coupons"
|
|
3403
3403
|
},
|
|
3404
3404
|
{
|
|
3405
3405
|
clue: "A single moment worth showing up for.",
|
|
@@ -3429,7 +3429,7 @@ var gameScreenIdentifierList = [
|
|
|
3429
3429
|
{
|
|
3430
3430
|
clue: "Where fun becomes a challenge.",
|
|
3431
3431
|
id: "games",
|
|
3432
|
-
match: "/games"
|
|
3432
|
+
match: "/profile/account/games"
|
|
3433
3433
|
},
|
|
3434
3434
|
{
|
|
3435
3435
|
clue: "Your starting point for everything.",
|
|
@@ -4775,7 +4775,7 @@ var registerFields = [
|
|
|
4775
4775
|
required: true
|
|
4776
4776
|
},
|
|
4777
4777
|
{
|
|
4778
|
-
helperText: "Enter Nickname",
|
|
4778
|
+
helperText: "Enter Nickname (optional)",
|
|
4779
4779
|
keyboardType: "default",
|
|
4780
4780
|
name: "nickName",
|
|
4781
4781
|
placeholder: "Nickname",
|
|
@@ -4832,16 +4832,18 @@ var profileFields = [
|
|
|
4832
4832
|
helperText: "Enter first name",
|
|
4833
4833
|
keyboardType: "default",
|
|
4834
4834
|
name: "firstName",
|
|
4835
|
-
placeholder: "First Name"
|
|
4835
|
+
placeholder: "First Name",
|
|
4836
|
+
required: true
|
|
4836
4837
|
},
|
|
4837
4838
|
{
|
|
4838
4839
|
helperText: "Enter last name",
|
|
4839
4840
|
keyboardType: "default",
|
|
4840
4841
|
name: "lastName",
|
|
4841
|
-
placeholder: "Last Name"
|
|
4842
|
+
placeholder: "Last Name",
|
|
4843
|
+
required: true
|
|
4842
4844
|
},
|
|
4843
4845
|
{
|
|
4844
|
-
helperText: "Enter Nickname",
|
|
4846
|
+
helperText: "Enter Nickname (optional)",
|
|
4845
4847
|
keyboardType: "default",
|
|
4846
4848
|
name: "nickName",
|
|
4847
4849
|
placeholder: "Nickname",
|
|
@@ -4852,6 +4854,7 @@ var profileFields = [
|
|
|
4852
4854
|
keyboardType: "default",
|
|
4853
4855
|
name: "password",
|
|
4854
4856
|
placeholder: "Password",
|
|
4857
|
+
required: true,
|
|
4855
4858
|
secureTextEntry: true
|
|
4856
4859
|
},
|
|
4857
4860
|
{
|
|
@@ -4859,6 +4862,7 @@ var profileFields = [
|
|
|
4859
4862
|
keyboardType: "default",
|
|
4860
4863
|
name: "confirmPassword",
|
|
4861
4864
|
placeholder: "Confirm Password",
|
|
4865
|
+
required: true,
|
|
4862
4866
|
secureTextEntry: true
|
|
4863
4867
|
}
|
|
4864
4868
|
];
|
|
@@ -7861,6 +7865,7 @@ var COUPON_DATA_FIELDS_FRAGMENT = gql`
|
|
|
7861
7865
|
...CouponVendorProductFields
|
|
7862
7866
|
}
|
|
7863
7867
|
createdAt
|
|
7868
|
+
deletedAt
|
|
7864
7869
|
endDate
|
|
7865
7870
|
participantUsers {
|
|
7866
7871
|
...CouponParticipantUserFields
|
|
@@ -9926,6 +9931,7 @@ var couponDataSchema = new MongooseSchema26(
|
|
|
9926
9931
|
required: false,
|
|
9927
9932
|
type: [couponVendorProductSchema]
|
|
9928
9933
|
},
|
|
9934
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
9929
9935
|
endDate: { required: true, type: Date },
|
|
9930
9936
|
participantUsers: {
|
|
9931
9937
|
default: null,
|
|
@@ -10026,7 +10032,7 @@ var SHARE_RESOURCE_LABEL2 = {
|
|
|
10026
10032
|
school: "School"
|
|
10027
10033
|
};
|
|
10028
10034
|
|
|
10029
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10035
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-364EX22V.mjs
|
|
10030
10036
|
var PROMO_CODE_PREFIX2 = "CM-";
|
|
10031
10037
|
var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
|
|
10032
10038
|
var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
|
|
@@ -10039,7 +10045,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10039
10045
|
{
|
|
10040
10046
|
clue: "Where you can find your loyalties.",
|
|
10041
10047
|
id: "coupons",
|
|
10042
|
-
match: "/coupons"
|
|
10048
|
+
match: "/profile/account/coupons"
|
|
10043
10049
|
},
|
|
10044
10050
|
{
|
|
10045
10051
|
clue: "A single moment worth showing up for.",
|
|
@@ -10069,7 +10075,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10069
10075
|
{
|
|
10070
10076
|
clue: "Where fun becomes a challenge.",
|
|
10071
10077
|
id: "games",
|
|
10072
|
-
match: "/games"
|
|
10078
|
+
match: "/profile/account/games"
|
|
10073
10079
|
},
|
|
10074
10080
|
{
|
|
10075
10081
|
clue: "Your starting point for everything.",
|
|
@@ -10138,7 +10144,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10138
10144
|
}
|
|
10139
10145
|
];
|
|
10140
10146
|
|
|
10141
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10147
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-5RXL62LO.mjs
|
|
10142
10148
|
import dayjs4 from "dayjs";
|
|
10143
10149
|
var statusOptions2 = [
|
|
10144
10150
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -11315,6 +11321,11 @@ async function sendPushNotifications({
|
|
|
11315
11321
|
}
|
|
11316
11322
|
}
|
|
11317
11323
|
|
|
11324
|
+
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11325
|
+
import dayjs5 from "dayjs";
|
|
11326
|
+
import timezone3 from "dayjs/plugin/timezone";
|
|
11327
|
+
import utc3 from "dayjs/plugin/utc";
|
|
11328
|
+
|
|
11318
11329
|
// src/service/license.ts
|
|
11319
11330
|
var PRO_EVENT_PLANS = /* @__PURE__ */ new Set([
|
|
11320
11331
|
EnumUserLicence2.PRO_EVENT,
|
|
@@ -11361,6 +11372,9 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
|
|
|
11361
11372
|
}
|
|
11362
11373
|
|
|
11363
11374
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11375
|
+
dayjs5.extend(utc3);
|
|
11376
|
+
dayjs5.extend(timezone3);
|
|
11377
|
+
var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
|
|
11364
11378
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
11365
11379
|
const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
|
|
11366
11380
|
if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
@@ -11375,12 +11389,8 @@ async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE
|
|
|
11375
11389
|
return null;
|
|
11376
11390
|
}
|
|
11377
11391
|
function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
11378
|
-
const periodStart =
|
|
11379
|
-
|
|
11380
|
-
);
|
|
11381
|
-
const periodEnd = new Date(
|
|
11382
|
-
Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1)
|
|
11383
|
-
);
|
|
11392
|
+
const periodStart = dayjs5(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").toDate();
|
|
11393
|
+
const periodEnd = dayjs5(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").add(1, "month").toDate();
|
|
11384
11394
|
return { periodEnd, periodStart };
|
|
11385
11395
|
}
|
|
11386
11396
|
|
|
@@ -11390,6 +11400,7 @@ function isEligibleVendorResource(resource) {
|
|
|
11390
11400
|
}
|
|
11391
11401
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
11392
11402
|
return await AffiliateModel.find({
|
|
11403
|
+
active: true,
|
|
11393
11404
|
affiliateResources: {
|
|
11394
11405
|
$elemMatch: {
|
|
11395
11406
|
resourceActive: true,
|
|
@@ -11462,8 +11473,7 @@ async function tryAwardSubscriptionReward({
|
|
|
11462
11473
|
createdAt: {
|
|
11463
11474
|
$gte: period.periodStart,
|
|
11464
11475
|
$lt: period.periodEnd
|
|
11465
|
-
}
|
|
11466
|
-
rewardType
|
|
11476
|
+
}
|
|
11467
11477
|
}
|
|
11468
11478
|
}
|
|
11469
11479
|
}
|
|
@@ -11755,11 +11765,11 @@ function convertObjectIdsToStrings(obj) {
|
|
|
11755
11765
|
}
|
|
11756
11766
|
|
|
11757
11767
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
11758
|
-
import
|
|
11768
|
+
import dayjs6 from "dayjs";
|
|
11759
11769
|
import customParseFormat3 from "dayjs/plugin/customParseFormat";
|
|
11760
11770
|
import isoWeek from "dayjs/plugin/isoWeek";
|
|
11761
|
-
|
|
11762
|
-
|
|
11771
|
+
dayjs6.extend(customParseFormat3);
|
|
11772
|
+
dayjs6.extend(isoWeek);
|
|
11763
11773
|
function getFutureEventStatus(startDateTime, now) {
|
|
11764
11774
|
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
11765
11775
|
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
@@ -11779,14 +11789,14 @@ function getFutureEventStatus(startDateTime, now) {
|
|
|
11779
11789
|
}
|
|
11780
11790
|
return EnumEventDateStatus.UPCOMING;
|
|
11781
11791
|
}
|
|
11782
|
-
function updateSingleDateTimeStatus(dateTime, now =
|
|
11792
|
+
function updateSingleDateTimeStatus(dateTime, now = dayjs6()) {
|
|
11783
11793
|
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
11784
|
-
const startDateTime =
|
|
11794
|
+
const startDateTime = dayjs6(
|
|
11785
11795
|
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
11786
11796
|
dateTimeFormat,
|
|
11787
11797
|
true
|
|
11788
11798
|
);
|
|
11789
|
-
const endDateTime =
|
|
11799
|
+
const endDateTime = dayjs6(
|
|
11790
11800
|
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
11791
11801
|
dateTimeFormat,
|
|
11792
11802
|
true
|
|
@@ -11868,7 +11878,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
11868
11878
|
return updated;
|
|
11869
11879
|
}
|
|
11870
11880
|
async function updateAllEventDateTimeStatuses() {
|
|
11871
|
-
const now =
|
|
11881
|
+
const now = dayjs6();
|
|
11872
11882
|
const [eventCount, marketCount] = await Promise.all([
|
|
11873
11883
|
updateModelDateTimeStatuses(EventModel, now),
|
|
11874
11884
|
updateModelDateTimeStatuses(
|
|
@@ -11941,6 +11951,7 @@ export {
|
|
|
11941
11951
|
RelationTypeSchema,
|
|
11942
11952
|
ResourceActivityModel,
|
|
11943
11953
|
ResourceImageTypeSchema,
|
|
11954
|
+
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
11944
11955
|
SchoolModel,
|
|
11945
11956
|
SocialMediaTypeSchema,
|
|
11946
11957
|
StallTypeSchema,
|