@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/mongoose/index.mjs
CHANGED
package/dist/service/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var service_exports = {};
|
|
32
32
|
__export(service_exports, {
|
|
33
33
|
ACTIVE_NOT_DELETED_FILTER: () => ACTIVE_NOT_DELETED_FILTER,
|
|
34
|
+
SUBSCRIPTION_REWARD_TIMEZONE: () => SUBSCRIPTION_REWARD_TIMEZONE,
|
|
34
35
|
activeAffiliateCodeExists: () => activeAffiliateCodeExists,
|
|
35
36
|
awardAffiliateVendorSubscriptionRewards: () => awardAffiliateVendorSubscriptionRewards,
|
|
36
37
|
connectToDatabase: () => connectToDatabase,
|
|
@@ -3459,7 +3460,7 @@ var gameScreenIdentifierList = [
|
|
|
3459
3460
|
{
|
|
3460
3461
|
clue: "Where you can find your loyalties.",
|
|
3461
3462
|
id: "coupons",
|
|
3462
|
-
match: "/coupons"
|
|
3463
|
+
match: "/profile/account/coupons"
|
|
3463
3464
|
},
|
|
3464
3465
|
{
|
|
3465
3466
|
clue: "A single moment worth showing up for.",
|
|
@@ -3489,7 +3490,7 @@ var gameScreenIdentifierList = [
|
|
|
3489
3490
|
{
|
|
3490
3491
|
clue: "Where fun becomes a challenge.",
|
|
3491
3492
|
id: "games",
|
|
3492
|
-
match: "/games"
|
|
3493
|
+
match: "/profile/account/games"
|
|
3493
3494
|
},
|
|
3494
3495
|
{
|
|
3495
3496
|
clue: "Your starting point for everything.",
|
|
@@ -4835,7 +4836,7 @@ var registerFields = [
|
|
|
4835
4836
|
required: true
|
|
4836
4837
|
},
|
|
4837
4838
|
{
|
|
4838
|
-
helperText: "Enter Nickname",
|
|
4839
|
+
helperText: "Enter Nickname (optional)",
|
|
4839
4840
|
keyboardType: "default",
|
|
4840
4841
|
name: "nickName",
|
|
4841
4842
|
placeholder: "Nickname",
|
|
@@ -4892,16 +4893,18 @@ var profileFields = [
|
|
|
4892
4893
|
helperText: "Enter first name",
|
|
4893
4894
|
keyboardType: "default",
|
|
4894
4895
|
name: "firstName",
|
|
4895
|
-
placeholder: "First Name"
|
|
4896
|
+
placeholder: "First Name",
|
|
4897
|
+
required: true
|
|
4896
4898
|
},
|
|
4897
4899
|
{
|
|
4898
4900
|
helperText: "Enter last name",
|
|
4899
4901
|
keyboardType: "default",
|
|
4900
4902
|
name: "lastName",
|
|
4901
|
-
placeholder: "Last Name"
|
|
4903
|
+
placeholder: "Last Name",
|
|
4904
|
+
required: true
|
|
4902
4905
|
},
|
|
4903
4906
|
{
|
|
4904
|
-
helperText: "Enter Nickname",
|
|
4907
|
+
helperText: "Enter Nickname (optional)",
|
|
4905
4908
|
keyboardType: "default",
|
|
4906
4909
|
name: "nickName",
|
|
4907
4910
|
placeholder: "Nickname",
|
|
@@ -4912,6 +4915,7 @@ var profileFields = [
|
|
|
4912
4915
|
keyboardType: "default",
|
|
4913
4916
|
name: "password",
|
|
4914
4917
|
placeholder: "Password",
|
|
4918
|
+
required: true,
|
|
4915
4919
|
secureTextEntry: true
|
|
4916
4920
|
},
|
|
4917
4921
|
{
|
|
@@ -4919,6 +4923,7 @@ var profileFields = [
|
|
|
4919
4923
|
keyboardType: "default",
|
|
4920
4924
|
name: "confirmPassword",
|
|
4921
4925
|
placeholder: "Confirm Password",
|
|
4926
|
+
required: true,
|
|
4922
4927
|
secureTextEntry: true
|
|
4923
4928
|
}
|
|
4924
4929
|
];
|
|
@@ -7921,6 +7926,7 @@ var COUPON_DATA_FIELDS_FRAGMENT = gql`
|
|
|
7921
7926
|
...CouponVendorProductFields
|
|
7922
7927
|
}
|
|
7923
7928
|
createdAt
|
|
7929
|
+
deletedAt
|
|
7924
7930
|
endDate
|
|
7925
7931
|
participantUsers {
|
|
7926
7932
|
...CouponParticipantUserFields
|
|
@@ -9986,6 +9992,7 @@ var couponDataSchema = new MongooseSchema26(
|
|
|
9986
9992
|
required: false,
|
|
9987
9993
|
type: [couponVendorProductSchema]
|
|
9988
9994
|
},
|
|
9995
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
9989
9996
|
endDate: { required: true, type: Date },
|
|
9990
9997
|
participantUsers: {
|
|
9991
9998
|
default: null,
|
|
@@ -10086,7 +10093,7 @@ var SHARE_RESOURCE_LABEL2 = {
|
|
|
10086
10093
|
school: "School"
|
|
10087
10094
|
};
|
|
10088
10095
|
|
|
10089
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10096
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-364EX22V.mjs
|
|
10090
10097
|
var PROMO_CODE_PREFIX2 = "CM-";
|
|
10091
10098
|
var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
|
|
10092
10099
|
var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
|
|
@@ -10099,7 +10106,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10099
10106
|
{
|
|
10100
10107
|
clue: "Where you can find your loyalties.",
|
|
10101
10108
|
id: "coupons",
|
|
10102
|
-
match: "/coupons"
|
|
10109
|
+
match: "/profile/account/coupons"
|
|
10103
10110
|
},
|
|
10104
10111
|
{
|
|
10105
10112
|
clue: "A single moment worth showing up for.",
|
|
@@ -10129,7 +10136,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10129
10136
|
{
|
|
10130
10137
|
clue: "Where fun becomes a challenge.",
|
|
10131
10138
|
id: "games",
|
|
10132
|
-
match: "/games"
|
|
10139
|
+
match: "/profile/account/games"
|
|
10133
10140
|
},
|
|
10134
10141
|
{
|
|
10135
10142
|
clue: "Your starting point for everything.",
|
|
@@ -10198,7 +10205,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10198
10205
|
}
|
|
10199
10206
|
];
|
|
10200
10207
|
|
|
10201
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10208
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-5RXL62LO.mjs
|
|
10202
10209
|
var import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
10203
10210
|
var statusOptions2 = [
|
|
10204
10211
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -11375,6 +11382,11 @@ async function sendPushNotifications({
|
|
|
11375
11382
|
}
|
|
11376
11383
|
}
|
|
11377
11384
|
|
|
11385
|
+
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11386
|
+
var import_dayjs5 = __toESM(require("dayjs"));
|
|
11387
|
+
var import_timezone3 = __toESM(require("dayjs/plugin/timezone"));
|
|
11388
|
+
var import_utc3 = __toESM(require("dayjs/plugin/utc"));
|
|
11389
|
+
|
|
11378
11390
|
// src/service/license.ts
|
|
11379
11391
|
var PRO_EVENT_PLANS = /* @__PURE__ */ new Set([
|
|
11380
11392
|
EnumUserLicence2.PRO_EVENT,
|
|
@@ -11421,6 +11433,9 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
|
|
|
11421
11433
|
}
|
|
11422
11434
|
|
|
11423
11435
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11436
|
+
import_dayjs5.default.extend(import_utc3.default);
|
|
11437
|
+
import_dayjs5.default.extend(import_timezone3.default);
|
|
11438
|
+
var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
|
|
11424
11439
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
11425
11440
|
const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
|
|
11426
11441
|
if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
@@ -11435,12 +11450,8 @@ async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE
|
|
|
11435
11450
|
return null;
|
|
11436
11451
|
}
|
|
11437
11452
|
function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
11438
|
-
const periodStart =
|
|
11439
|
-
|
|
11440
|
-
);
|
|
11441
|
-
const periodEnd = new Date(
|
|
11442
|
-
Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1)
|
|
11443
|
-
);
|
|
11453
|
+
const periodStart = (0, import_dayjs5.default)(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").toDate();
|
|
11454
|
+
const periodEnd = (0, import_dayjs5.default)(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").add(1, "month").toDate();
|
|
11444
11455
|
return { periodEnd, periodStart };
|
|
11445
11456
|
}
|
|
11446
11457
|
|
|
@@ -11450,6 +11461,7 @@ function isEligibleVendorResource(resource) {
|
|
|
11450
11461
|
}
|
|
11451
11462
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
11452
11463
|
return await AffiliateModel.find({
|
|
11464
|
+
active: true,
|
|
11453
11465
|
affiliateResources: {
|
|
11454
11466
|
$elemMatch: {
|
|
11455
11467
|
resourceActive: true,
|
|
@@ -11522,8 +11534,7 @@ async function tryAwardSubscriptionReward({
|
|
|
11522
11534
|
createdAt: {
|
|
11523
11535
|
$gte: period.periodStart,
|
|
11524
11536
|
$lt: period.periodEnd
|
|
11525
|
-
}
|
|
11526
|
-
rewardType
|
|
11537
|
+
}
|
|
11527
11538
|
}
|
|
11528
11539
|
}
|
|
11529
11540
|
}
|
|
@@ -11808,11 +11819,11 @@ function convertObjectIdsToStrings(obj) {
|
|
|
11808
11819
|
}
|
|
11809
11820
|
|
|
11810
11821
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
11811
|
-
var
|
|
11822
|
+
var import_dayjs6 = __toESM(require("dayjs"));
|
|
11812
11823
|
var import_customParseFormat3 = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
11813
11824
|
var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
|
|
11814
|
-
|
|
11815
|
-
|
|
11825
|
+
import_dayjs6.default.extend(import_customParseFormat3.default);
|
|
11826
|
+
import_dayjs6.default.extend(import_isoWeek.default);
|
|
11816
11827
|
function getFutureEventStatus(startDateTime, now) {
|
|
11817
11828
|
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
11818
11829
|
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
@@ -11832,14 +11843,14 @@ function getFutureEventStatus(startDateTime, now) {
|
|
|
11832
11843
|
}
|
|
11833
11844
|
return EnumEventDateStatus.UPCOMING;
|
|
11834
11845
|
}
|
|
11835
|
-
function updateSingleDateTimeStatus(dateTime, now = (0,
|
|
11846
|
+
function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs6.default)()) {
|
|
11836
11847
|
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
11837
|
-
const startDateTime = (0,
|
|
11848
|
+
const startDateTime = (0, import_dayjs6.default)(
|
|
11838
11849
|
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
11839
11850
|
dateTimeFormat,
|
|
11840
11851
|
true
|
|
11841
11852
|
);
|
|
11842
|
-
const endDateTime = (0,
|
|
11853
|
+
const endDateTime = (0, import_dayjs6.default)(
|
|
11843
11854
|
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
11844
11855
|
dateTimeFormat,
|
|
11845
11856
|
true
|
|
@@ -11921,7 +11932,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
11921
11932
|
return updated;
|
|
11922
11933
|
}
|
|
11923
11934
|
async function updateAllEventDateTimeStatuses() {
|
|
11924
|
-
const now = (0,
|
|
11935
|
+
const now = (0, import_dayjs6.default)();
|
|
11925
11936
|
const [eventCount, marketCount] = await Promise.all([
|
|
11926
11937
|
updateModelDateTimeStatuses(EventModel, now),
|
|
11927
11938
|
updateModelDateTimeStatuses(
|
|
@@ -11972,6 +11983,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
11972
11983
|
// Annotate the CommonJS export names for ESM import in node:
|
|
11973
11984
|
0 && (module.exports = {
|
|
11974
11985
|
ACTIVE_NOT_DELETED_FILTER,
|
|
11986
|
+
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
11975
11987
|
activeAffiliateCodeExists,
|
|
11976
11988
|
awardAffiliateVendorSubscriptionRewards,
|
|
11977
11989
|
connectToDatabase,
|