@timardex/cluemart-server-shared 1.1.33 → 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-WLOHVSV6.mjs → chunk-UGGLUJIR.mjs} +9 -5
- package/dist/chunk-UGGLUJIR.mjs.map +1 -0
- package/dist/index.cjs +29 -19
- 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 +28 -19
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +8 -4
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +29 -19
- 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 +21 -16
- 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,
|
|
@@ -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
|
];
|
|
@@ -11375,6 +11380,11 @@ async function sendPushNotifications({
|
|
|
11375
11380
|
}
|
|
11376
11381
|
}
|
|
11377
11382
|
|
|
11383
|
+
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11384
|
+
var import_dayjs5 = __toESM(require("dayjs"));
|
|
11385
|
+
var import_timezone3 = __toESM(require("dayjs/plugin/timezone"));
|
|
11386
|
+
var import_utc3 = __toESM(require("dayjs/plugin/utc"));
|
|
11387
|
+
|
|
11378
11388
|
// src/service/license.ts
|
|
11379
11389
|
var PRO_EVENT_PLANS = /* @__PURE__ */ new Set([
|
|
11380
11390
|
EnumUserLicence2.PRO_EVENT,
|
|
@@ -11421,6 +11431,9 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
|
|
|
11421
11431
|
}
|
|
11422
11432
|
|
|
11423
11433
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
11434
|
+
import_dayjs5.default.extend(import_utc3.default);
|
|
11435
|
+
import_dayjs5.default.extend(import_timezone3.default);
|
|
11436
|
+
var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
|
|
11424
11437
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
11425
11438
|
const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
|
|
11426
11439
|
if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
@@ -11435,12 +11448,8 @@ async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE
|
|
|
11435
11448
|
return null;
|
|
11436
11449
|
}
|
|
11437
11450
|
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
|
-
);
|
|
11451
|
+
const periodStart = (0, import_dayjs5.default)(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").toDate();
|
|
11452
|
+
const periodEnd = (0, import_dayjs5.default)(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").add(1, "month").toDate();
|
|
11444
11453
|
return { periodEnd, periodStart };
|
|
11445
11454
|
}
|
|
11446
11455
|
|
|
@@ -11450,6 +11459,7 @@ function isEligibleVendorResource(resource) {
|
|
|
11450
11459
|
}
|
|
11451
11460
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
11452
11461
|
return await AffiliateModel.find({
|
|
11462
|
+
active: true,
|
|
11453
11463
|
affiliateResources: {
|
|
11454
11464
|
$elemMatch: {
|
|
11455
11465
|
resourceActive: true,
|
|
@@ -11522,8 +11532,7 @@ async function tryAwardSubscriptionReward({
|
|
|
11522
11532
|
createdAt: {
|
|
11523
11533
|
$gte: period.periodStart,
|
|
11524
11534
|
$lt: period.periodEnd
|
|
11525
|
-
}
|
|
11526
|
-
rewardType
|
|
11535
|
+
}
|
|
11527
11536
|
}
|
|
11528
11537
|
}
|
|
11529
11538
|
}
|
|
@@ -11808,11 +11817,11 @@ function convertObjectIdsToStrings(obj) {
|
|
|
11808
11817
|
}
|
|
11809
11818
|
|
|
11810
11819
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
11811
|
-
var
|
|
11820
|
+
var import_dayjs6 = __toESM(require("dayjs"));
|
|
11812
11821
|
var import_customParseFormat3 = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
11813
11822
|
var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
|
|
11814
|
-
|
|
11815
|
-
|
|
11823
|
+
import_dayjs6.default.extend(import_customParseFormat3.default);
|
|
11824
|
+
import_dayjs6.default.extend(import_isoWeek.default);
|
|
11816
11825
|
function getFutureEventStatus(startDateTime, now) {
|
|
11817
11826
|
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
11818
11827
|
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
@@ -11832,14 +11841,14 @@ function getFutureEventStatus(startDateTime, now) {
|
|
|
11832
11841
|
}
|
|
11833
11842
|
return EnumEventDateStatus.UPCOMING;
|
|
11834
11843
|
}
|
|
11835
|
-
function updateSingleDateTimeStatus(dateTime, now = (0,
|
|
11844
|
+
function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs6.default)()) {
|
|
11836
11845
|
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
11837
|
-
const startDateTime = (0,
|
|
11846
|
+
const startDateTime = (0, import_dayjs6.default)(
|
|
11838
11847
|
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
11839
11848
|
dateTimeFormat,
|
|
11840
11849
|
true
|
|
11841
11850
|
);
|
|
11842
|
-
const endDateTime = (0,
|
|
11851
|
+
const endDateTime = (0, import_dayjs6.default)(
|
|
11843
11852
|
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
11844
11853
|
dateTimeFormat,
|
|
11845
11854
|
true
|
|
@@ -11921,7 +11930,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
11921
11930
|
return updated;
|
|
11922
11931
|
}
|
|
11923
11932
|
async function updateAllEventDateTimeStatuses() {
|
|
11924
|
-
const now = (0,
|
|
11933
|
+
const now = (0, import_dayjs6.default)();
|
|
11925
11934
|
const [eventCount, marketCount] = await Promise.all([
|
|
11926
11935
|
updateModelDateTimeStatuses(EventModel, now),
|
|
11927
11936
|
updateModelDateTimeStatuses(
|
|
@@ -11972,6 +11981,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
11972
11981
|
// Annotate the CommonJS export names for ESM import in node:
|
|
11973
11982
|
0 && (module.exports = {
|
|
11974
11983
|
ACTIVE_NOT_DELETED_FILTER,
|
|
11984
|
+
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
11975
11985
|
activeAffiliateCodeExists,
|
|
11976
11986
|
awardAffiliateVendorSubscriptionRewards,
|
|
11977
11987
|
connectToDatabase,
|