@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.cjs
CHANGED
|
@@ -54,6 +54,7 @@ __export(index_exports, {
|
|
|
54
54
|
RelationTypeSchema: () => RelationTypeSchema,
|
|
55
55
|
ResourceActivityModel: () => ResourceActivityModel,
|
|
56
56
|
ResourceImageTypeSchema: () => ResourceImageTypeSchema,
|
|
57
|
+
SUBSCRIPTION_REWARD_TIMEZONE: () => SUBSCRIPTION_REWARD_TIMEZONE,
|
|
57
58
|
SchoolModel: () => SchoolModel,
|
|
58
59
|
SocialMediaTypeSchema: () => SocialMediaTypeSchema,
|
|
59
60
|
StallTypeSchema: () => StallTypeSchema,
|
|
@@ -3504,7 +3505,7 @@ var gameScreenIdentifierList = [
|
|
|
3504
3505
|
{
|
|
3505
3506
|
clue: "Where you can find your loyalties.",
|
|
3506
3507
|
id: "coupons",
|
|
3507
|
-
match: "/coupons"
|
|
3508
|
+
match: "/profile/account/coupons"
|
|
3508
3509
|
},
|
|
3509
3510
|
{
|
|
3510
3511
|
clue: "A single moment worth showing up for.",
|
|
@@ -3534,7 +3535,7 @@ var gameScreenIdentifierList = [
|
|
|
3534
3535
|
{
|
|
3535
3536
|
clue: "Where fun becomes a challenge.",
|
|
3536
3537
|
id: "games",
|
|
3537
|
-
match: "/games"
|
|
3538
|
+
match: "/profile/account/games"
|
|
3538
3539
|
},
|
|
3539
3540
|
{
|
|
3540
3541
|
clue: "Your starting point for everything.",
|
|
@@ -4880,7 +4881,7 @@ var registerFields = [
|
|
|
4880
4881
|
required: true
|
|
4881
4882
|
},
|
|
4882
4883
|
{
|
|
4883
|
-
helperText: "Enter Nickname",
|
|
4884
|
+
helperText: "Enter Nickname (optional)",
|
|
4884
4885
|
keyboardType: "default",
|
|
4885
4886
|
name: "nickName",
|
|
4886
4887
|
placeholder: "Nickname",
|
|
@@ -4937,16 +4938,18 @@ var profileFields = [
|
|
|
4937
4938
|
helperText: "Enter first name",
|
|
4938
4939
|
keyboardType: "default",
|
|
4939
4940
|
name: "firstName",
|
|
4940
|
-
placeholder: "First Name"
|
|
4941
|
+
placeholder: "First Name",
|
|
4942
|
+
required: true
|
|
4941
4943
|
},
|
|
4942
4944
|
{
|
|
4943
4945
|
helperText: "Enter last name",
|
|
4944
4946
|
keyboardType: "default",
|
|
4945
4947
|
name: "lastName",
|
|
4946
|
-
placeholder: "Last Name"
|
|
4948
|
+
placeholder: "Last Name",
|
|
4949
|
+
required: true
|
|
4947
4950
|
},
|
|
4948
4951
|
{
|
|
4949
|
-
helperText: "Enter Nickname",
|
|
4952
|
+
helperText: "Enter Nickname (optional)",
|
|
4950
4953
|
keyboardType: "default",
|
|
4951
4954
|
name: "nickName",
|
|
4952
4955
|
placeholder: "Nickname",
|
|
@@ -4957,6 +4960,7 @@ var profileFields = [
|
|
|
4957
4960
|
keyboardType: "default",
|
|
4958
4961
|
name: "password",
|
|
4959
4962
|
placeholder: "Password",
|
|
4963
|
+
required: true,
|
|
4960
4964
|
secureTextEntry: true
|
|
4961
4965
|
},
|
|
4962
4966
|
{
|
|
@@ -4964,6 +4968,7 @@ var profileFields = [
|
|
|
4964
4968
|
keyboardType: "default",
|
|
4965
4969
|
name: "confirmPassword",
|
|
4966
4970
|
placeholder: "Confirm Password",
|
|
4971
|
+
required: true,
|
|
4967
4972
|
secureTextEntry: true
|
|
4968
4973
|
}
|
|
4969
4974
|
];
|
|
@@ -7966,6 +7971,7 @@ var COUPON_DATA_FIELDS_FRAGMENT = gql`
|
|
|
7966
7971
|
...CouponVendorProductFields
|
|
7967
7972
|
}
|
|
7968
7973
|
createdAt
|
|
7974
|
+
deletedAt
|
|
7969
7975
|
endDate
|
|
7970
7976
|
participantUsers {
|
|
7971
7977
|
...CouponParticipantUserFields
|
|
@@ -10031,6 +10037,7 @@ var couponDataSchema = new MongooseSchema26(
|
|
|
10031
10037
|
required: false,
|
|
10032
10038
|
type: [couponVendorProductSchema]
|
|
10033
10039
|
},
|
|
10040
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
10034
10041
|
endDate: { required: true, type: Date },
|
|
10035
10042
|
participantUsers: {
|
|
10036
10043
|
default: null,
|
|
@@ -10131,7 +10138,7 @@ var SHARE_RESOURCE_LABEL2 = {
|
|
|
10131
10138
|
school: "School"
|
|
10132
10139
|
};
|
|
10133
10140
|
|
|
10134
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10141
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-364EX22V.mjs
|
|
10135
10142
|
var PROMO_CODE_PREFIX2 = "CM-";
|
|
10136
10143
|
var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
|
|
10137
10144
|
var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
|
|
@@ -10144,7 +10151,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10144
10151
|
{
|
|
10145
10152
|
clue: "Where you can find your loyalties.",
|
|
10146
10153
|
id: "coupons",
|
|
10147
|
-
match: "/coupons"
|
|
10154
|
+
match: "/profile/account/coupons"
|
|
10148
10155
|
},
|
|
10149
10156
|
{
|
|
10150
10157
|
clue: "A single moment worth showing up for.",
|
|
@@ -10174,7 +10181,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10174
10181
|
{
|
|
10175
10182
|
clue: "Where fun becomes a challenge.",
|
|
10176
10183
|
id: "games",
|
|
10177
|
-
match: "/games"
|
|
10184
|
+
match: "/profile/account/games"
|
|
10178
10185
|
},
|
|
10179
10186
|
{
|
|
10180
10187
|
clue: "Your starting point for everything.",
|
|
@@ -10243,7 +10250,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10243
10250
|
}
|
|
10244
10251
|
];
|
|
10245
10252
|
|
|
10246
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10253
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-5RXL62LO.mjs
|
|
10247
10254
|
var import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
10248
10255
|
var statusOptions2 = [
|
|
10249
10256
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -11420,6 +11427,11 @@ async function sendPushNotifications({
|
|
|
11420
11427
|
}
|
|
11421
11428
|
}
|
|
11422
11429
|
|
|
11430
|
+
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11431
|
+
var import_dayjs5 = __toESM(require("dayjs"));
|
|
11432
|
+
var import_timezone3 = __toESM(require("dayjs/plugin/timezone"));
|
|
11433
|
+
var import_utc3 = __toESM(require("dayjs/plugin/utc"));
|
|
11434
|
+
|
|
11423
11435
|
// src/service/license.ts
|
|
11424
11436
|
var PRO_EVENT_PLANS = /* @__PURE__ */ new Set([
|
|
11425
11437
|
EnumUserLicence2.PRO_EVENT,
|
|
@@ -11466,6 +11478,9 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
|
|
|
11466
11478
|
}
|
|
11467
11479
|
|
|
11468
11480
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11481
|
+
import_dayjs5.default.extend(import_utc3.default);
|
|
11482
|
+
import_dayjs5.default.extend(import_timezone3.default);
|
|
11483
|
+
var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
|
|
11469
11484
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
11470
11485
|
const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
|
|
11471
11486
|
if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
@@ -11480,12 +11495,8 @@ async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE
|
|
|
11480
11495
|
return null;
|
|
11481
11496
|
}
|
|
11482
11497
|
function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
11483
|
-
const periodStart =
|
|
11484
|
-
|
|
11485
|
-
);
|
|
11486
|
-
const periodEnd = new Date(
|
|
11487
|
-
Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1)
|
|
11488
|
-
);
|
|
11498
|
+
const periodStart = (0, import_dayjs5.default)(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").toDate();
|
|
11499
|
+
const periodEnd = (0, import_dayjs5.default)(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").add(1, "month").toDate();
|
|
11489
11500
|
return { periodEnd, periodStart };
|
|
11490
11501
|
}
|
|
11491
11502
|
|
|
@@ -11495,6 +11506,7 @@ function isEligibleVendorResource(resource) {
|
|
|
11495
11506
|
}
|
|
11496
11507
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
11497
11508
|
return await AffiliateModel.find({
|
|
11509
|
+
active: true,
|
|
11498
11510
|
affiliateResources: {
|
|
11499
11511
|
$elemMatch: {
|
|
11500
11512
|
resourceActive: true,
|
|
@@ -11567,8 +11579,7 @@ async function tryAwardSubscriptionReward({
|
|
|
11567
11579
|
createdAt: {
|
|
11568
11580
|
$gte: period.periodStart,
|
|
11569
11581
|
$lt: period.periodEnd
|
|
11570
|
-
}
|
|
11571
|
-
rewardType
|
|
11582
|
+
}
|
|
11572
11583
|
}
|
|
11573
11584
|
}
|
|
11574
11585
|
}
|
|
@@ -11860,11 +11871,11 @@ function convertObjectIdsToStrings(obj) {
|
|
|
11860
11871
|
}
|
|
11861
11872
|
|
|
11862
11873
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
11863
|
-
var
|
|
11874
|
+
var import_dayjs6 = __toESM(require("dayjs"));
|
|
11864
11875
|
var import_customParseFormat3 = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
11865
11876
|
var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
|
|
11866
|
-
|
|
11867
|
-
|
|
11877
|
+
import_dayjs6.default.extend(import_customParseFormat3.default);
|
|
11878
|
+
import_dayjs6.default.extend(import_isoWeek.default);
|
|
11868
11879
|
function getFutureEventStatus(startDateTime, now) {
|
|
11869
11880
|
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
11870
11881
|
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
@@ -11884,14 +11895,14 @@ function getFutureEventStatus(startDateTime, now) {
|
|
|
11884
11895
|
}
|
|
11885
11896
|
return EnumEventDateStatus.UPCOMING;
|
|
11886
11897
|
}
|
|
11887
|
-
function updateSingleDateTimeStatus(dateTime, now = (0,
|
|
11898
|
+
function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs6.default)()) {
|
|
11888
11899
|
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
11889
|
-
const startDateTime = (0,
|
|
11900
|
+
const startDateTime = (0, import_dayjs6.default)(
|
|
11890
11901
|
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
11891
11902
|
dateTimeFormat,
|
|
11892
11903
|
true
|
|
11893
11904
|
);
|
|
11894
|
-
const endDateTime = (0,
|
|
11905
|
+
const endDateTime = (0, import_dayjs6.default)(
|
|
11895
11906
|
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
11896
11907
|
dateTimeFormat,
|
|
11897
11908
|
true
|
|
@@ -11973,7 +11984,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
11973
11984
|
return updated;
|
|
11974
11985
|
}
|
|
11975
11986
|
async function updateAllEventDateTimeStatuses() {
|
|
11976
|
-
const now = (0,
|
|
11987
|
+
const now = (0, import_dayjs6.default)();
|
|
11977
11988
|
const [eventCount, marketCount] = await Promise.all([
|
|
11978
11989
|
updateModelDateTimeStatuses(EventModel, now),
|
|
11979
11990
|
updateModelDateTimeStatuses(
|
|
@@ -12047,6 +12058,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
12047
12058
|
RelationTypeSchema,
|
|
12048
12059
|
ResourceActivityModel,
|
|
12049
12060
|
ResourceImageTypeSchema,
|
|
12061
|
+
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
12050
12062
|
SchoolModel,
|
|
12051
12063
|
SocialMediaTypeSchema,
|
|
12052
12064
|
StallTypeSchema,
|