@timardex/cluemart-server-shared 1.1.32 → 1.1.34
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-VUTQY6KS.mjs → chunk-UGGLUJIR.mjs} +11 -7
- package/dist/chunk-UGGLUJIR.mjs.map +1 -0
- package/dist/index.cjs +33 -23
- 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 +32 -23
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +10 -6
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +33 -23
- 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 +23 -18
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-VUTQY6KS.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,
|
|
@@ -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
|
];
|
|
@@ -7924,7 +7929,7 @@ var COUPON_OPTION_FIELDS_FRAGMENT = gql`
|
|
|
7924
7929
|
get
|
|
7925
7930
|
unit
|
|
7926
7931
|
visits
|
|
7927
|
-
|
|
7932
|
+
maxRewardCount
|
|
7928
7933
|
}
|
|
7929
7934
|
`;
|
|
7930
7935
|
var COUPON_VENDOR_PRODUCT_FIELDS_FRAGMENT = gql`
|
|
@@ -9966,7 +9971,7 @@ var couponOptionSchema = new MongooseSchema26(
|
|
|
9966
9971
|
{
|
|
9967
9972
|
buy: { required: false, type: Number },
|
|
9968
9973
|
get: { required: false, type: Number },
|
|
9969
|
-
|
|
9974
|
+
maxRewardCount: { required: false, type: Number },
|
|
9970
9975
|
type: {
|
|
9971
9976
|
enum: Object.values(EnumCouponQualificationType),
|
|
9972
9977
|
required: true,
|
|
@@ -10131,7 +10136,7 @@ var SHARE_RESOURCE_LABEL2 = {
|
|
|
10131
10136
|
school: "School"
|
|
10132
10137
|
};
|
|
10133
10138
|
|
|
10134
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10139
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-FGVNX6EN.mjs
|
|
10135
10140
|
var PROMO_CODE_PREFIX2 = "CM-";
|
|
10136
10141
|
var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
|
|
10137
10142
|
var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
|
|
@@ -10243,7 +10248,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10243
10248
|
}
|
|
10244
10249
|
];
|
|
10245
10250
|
|
|
10246
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10251
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-UPFNTXDX.mjs
|
|
10247
10252
|
var import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
10248
10253
|
var statusOptions2 = [
|
|
10249
10254
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -11420,6 +11425,11 @@ async function sendPushNotifications({
|
|
|
11420
11425
|
}
|
|
11421
11426
|
}
|
|
11422
11427
|
|
|
11428
|
+
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11429
|
+
var import_dayjs5 = __toESM(require("dayjs"));
|
|
11430
|
+
var import_timezone3 = __toESM(require("dayjs/plugin/timezone"));
|
|
11431
|
+
var import_utc3 = __toESM(require("dayjs/plugin/utc"));
|
|
11432
|
+
|
|
11423
11433
|
// src/service/license.ts
|
|
11424
11434
|
var PRO_EVENT_PLANS = /* @__PURE__ */ new Set([
|
|
11425
11435
|
EnumUserLicence2.PRO_EVENT,
|
|
@@ -11466,6 +11476,9 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
|
|
|
11466
11476
|
}
|
|
11467
11477
|
|
|
11468
11478
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11479
|
+
import_dayjs5.default.extend(import_utc3.default);
|
|
11480
|
+
import_dayjs5.default.extend(import_timezone3.default);
|
|
11481
|
+
var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
|
|
11469
11482
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
11470
11483
|
const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
|
|
11471
11484
|
if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
@@ -11480,12 +11493,8 @@ async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE
|
|
|
11480
11493
|
return null;
|
|
11481
11494
|
}
|
|
11482
11495
|
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
|
-
);
|
|
11496
|
+
const periodStart = (0, import_dayjs5.default)(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").toDate();
|
|
11497
|
+
const periodEnd = (0, import_dayjs5.default)(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").add(1, "month").toDate();
|
|
11489
11498
|
return { periodEnd, periodStart };
|
|
11490
11499
|
}
|
|
11491
11500
|
|
|
@@ -11495,6 +11504,7 @@ function isEligibleVendorResource(resource) {
|
|
|
11495
11504
|
}
|
|
11496
11505
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
11497
11506
|
return await AffiliateModel.find({
|
|
11507
|
+
active: true,
|
|
11498
11508
|
affiliateResources: {
|
|
11499
11509
|
$elemMatch: {
|
|
11500
11510
|
resourceActive: true,
|
|
@@ -11567,8 +11577,7 @@ async function tryAwardSubscriptionReward({
|
|
|
11567
11577
|
createdAt: {
|
|
11568
11578
|
$gte: period.periodStart,
|
|
11569
11579
|
$lt: period.periodEnd
|
|
11570
|
-
}
|
|
11571
|
-
rewardType
|
|
11580
|
+
}
|
|
11572
11581
|
}
|
|
11573
11582
|
}
|
|
11574
11583
|
}
|
|
@@ -11860,11 +11869,11 @@ function convertObjectIdsToStrings(obj) {
|
|
|
11860
11869
|
}
|
|
11861
11870
|
|
|
11862
11871
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
11863
|
-
var
|
|
11872
|
+
var import_dayjs6 = __toESM(require("dayjs"));
|
|
11864
11873
|
var import_customParseFormat3 = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
11865
11874
|
var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
|
|
11866
|
-
|
|
11867
|
-
|
|
11875
|
+
import_dayjs6.default.extend(import_customParseFormat3.default);
|
|
11876
|
+
import_dayjs6.default.extend(import_isoWeek.default);
|
|
11868
11877
|
function getFutureEventStatus(startDateTime, now) {
|
|
11869
11878
|
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
11870
11879
|
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
@@ -11884,14 +11893,14 @@ function getFutureEventStatus(startDateTime, now) {
|
|
|
11884
11893
|
}
|
|
11885
11894
|
return EnumEventDateStatus.UPCOMING;
|
|
11886
11895
|
}
|
|
11887
|
-
function updateSingleDateTimeStatus(dateTime, now = (0,
|
|
11896
|
+
function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs6.default)()) {
|
|
11888
11897
|
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
11889
|
-
const startDateTime = (0,
|
|
11898
|
+
const startDateTime = (0, import_dayjs6.default)(
|
|
11890
11899
|
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
11891
11900
|
dateTimeFormat,
|
|
11892
11901
|
true
|
|
11893
11902
|
);
|
|
11894
|
-
const endDateTime = (0,
|
|
11903
|
+
const endDateTime = (0, import_dayjs6.default)(
|
|
11895
11904
|
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
11896
11905
|
dateTimeFormat,
|
|
11897
11906
|
true
|
|
@@ -11973,7 +11982,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
11973
11982
|
return updated;
|
|
11974
11983
|
}
|
|
11975
11984
|
async function updateAllEventDateTimeStatuses() {
|
|
11976
|
-
const now = (0,
|
|
11985
|
+
const now = (0, import_dayjs6.default)();
|
|
11977
11986
|
const [eventCount, marketCount] = await Promise.all([
|
|
11978
11987
|
updateModelDateTimeStatuses(EventModel, now),
|
|
11979
11988
|
updateModelDateTimeStatuses(
|
|
@@ -12047,6 +12056,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
12047
12056
|
RelationTypeSchema,
|
|
12048
12057
|
ResourceActivityModel,
|
|
12049
12058
|
ResourceImageTypeSchema,
|
|
12059
|
+
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
12050
12060
|
SchoolModel,
|
|
12051
12061
|
SocialMediaTypeSchema,
|
|
12052
12062
|
StallTypeSchema,
|