@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.
@@ -41,7 +41,7 @@ import {
41
41
  termsAgreementSchema,
42
42
  userLicenseSchema,
43
43
  vendorProductTypeSchema
44
- } from "../chunk-VUTQY6KS.mjs";
44
+ } from "../chunk-UGGLUJIR.mjs";
45
45
  export {
46
46
  APP_SETTINGS_ID,
47
47
  AdModel,
@@ -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
  ];
@@ -7879,7 +7884,7 @@ var COUPON_OPTION_FIELDS_FRAGMENT = gql`
7879
7884
  get
7880
7885
  unit
7881
7886
  visits
7882
- maxCouponCount
7887
+ maxRewardCount
7883
7888
  }
7884
7889
  `;
7885
7890
  var COUPON_VENDOR_PRODUCT_FIELDS_FRAGMENT = gql`
@@ -9921,7 +9926,7 @@ var couponOptionSchema = new MongooseSchema26(
9921
9926
  {
9922
9927
  buy: { required: false, type: Number },
9923
9928
  get: { required: false, type: Number },
9924
- maxCouponCount: { required: false, type: Number },
9929
+ maxRewardCount: { required: false, type: Number },
9925
9930
  type: {
9926
9931
  enum: Object.values(EnumCouponQualificationType),
9927
9932
  required: true,
@@ -10086,7 +10091,7 @@ var SHARE_RESOURCE_LABEL2 = {
10086
10091
  school: "School"
10087
10092
  };
10088
10093
 
10089
- // node_modules/@timardex/cluemart-shared/dist/chunk-2CIW3WKR.mjs
10094
+ // node_modules/@timardex/cluemart-shared/dist/chunk-FGVNX6EN.mjs
10090
10095
  var PROMO_CODE_PREFIX2 = "CM-";
10091
10096
  var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
10092
10097
  var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
@@ -10198,7 +10203,7 @@ var gameScreenIdentifierList2 = [
10198
10203
  }
10199
10204
  ];
10200
10205
 
10201
- // node_modules/@timardex/cluemart-shared/dist/chunk-A3RIEOQ7.mjs
10206
+ // node_modules/@timardex/cluemart-shared/dist/chunk-UPFNTXDX.mjs
10202
10207
  var import_dayjs4 = __toESM(require("dayjs"), 1);
10203
10208
  var statusOptions2 = [
10204
10209
  ...Object.values(EnumInviteStatus2).map((status) => ({
@@ -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 = new Date(
11439
- Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)
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 import_dayjs5 = __toESM(require("dayjs"));
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
- import_dayjs5.default.extend(import_customParseFormat3.default);
11815
- import_dayjs5.default.extend(import_isoWeek.default);
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, import_dayjs5.default)()) {
11844
+ function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs6.default)()) {
11836
11845
  const dateTimeFormat = `${dateFormat} ${timeFormat}`;
11837
- const startDateTime = (0, import_dayjs5.default)(
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, import_dayjs5.default)(
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, import_dayjs5.default)();
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,