@timardex/cluemart-server-shared 1.0.179 → 1.0.201

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.
@@ -1,10 +1,9 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, ReportChatUser, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, GoogleImportedMarket, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, AppSettingsType, GameType, GameDocType, SchoolType } from '@timardex/cluemart-shared';
2
+ import { AdType, ReportChatUser, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, GoogleImportedMarket, PushTokenType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, AppSettingsType, GameType, GameDocType, SchoolType } from '@timardex/cluemart-shared';
3
3
  import mongoose from 'mongoose';
4
- import { O as ObjectId } from '../Chat-Ctmtatmi.mjs';
5
- export { C as ChatModel, N as NotificationModel, a as SchemaChatMessageReactionType, S as SchemaChatMessageReplyPreviewType, b as SchemaChatMessageSeenType, c as SchemaChatMessageType, e as SchemaChatType, f as SchemaCreateBulkNotificationInput, g as SchemaNotificationType, d as SchemaParticipantType } from '../Chat-Ctmtatmi.mjs';
6
- import { EnumOSPlatform } from '@timardex/cluemart-shared/enums';
7
- export { a as RelationModel, R as RelationTypeSchema, S as SchemaRelationType, r as relationDatesSchema } from '../Relation-BQhULTU-.mjs';
4
+ import { O as ObjectId } from '../Chat-DYkhie3G.mjs';
5
+ export { C as ChatModel, N as NotificationModel, a as SchemaChatMessageReactionType, S as SchemaChatMessageReplyPreviewType, b as SchemaChatMessageSeenType, c as SchemaChatMessageType, e as SchemaChatType, f as SchemaCreateBulkNotificationInput, g as SchemaNotificationType, d as SchemaParticipantType } from '../Chat-DYkhie3G.mjs';
6
+ export { a as RelationModel, R as RelationTypeSchema, S as SchemaRelationType, r as relationDatesSchema } from '../Relation-BjYghDE9.mjs';
8
7
  import '@timardex/cluemart-shared/types';
9
8
  import 'express';
10
9
 
@@ -332,14 +331,6 @@ declare const GoogleImportedMarketModel: mongoose.Model<SchemaGoogleImportedMark
332
331
  __v: number;
333
332
  }, any>;
334
333
 
335
- type PushTokenType = {
336
- _id: string;
337
- createdAt: Date;
338
- platform: EnumOSPlatform;
339
- token: string;
340
- updatedAt: Date;
341
- userId: string;
342
- };
343
334
  type SchemaPushTokenType = Omit<PushTokenType, "userId"> & {
344
335
  userId: ObjectId;
345
336
  };
@@ -1,10 +1,9 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, ReportChatUser, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, GoogleImportedMarket, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, AppSettingsType, GameType, GameDocType, SchoolType } from '@timardex/cluemart-shared';
2
+ import { AdType, ReportChatUser, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, GoogleImportedMarket, PushTokenType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, AppSettingsType, GameType, GameDocType, SchoolType } from '@timardex/cluemart-shared';
3
3
  import mongoose from 'mongoose';
4
- import { O as ObjectId } from '../Chat-Ctmtatmi.js';
5
- export { C as ChatModel, N as NotificationModel, a as SchemaChatMessageReactionType, S as SchemaChatMessageReplyPreviewType, b as SchemaChatMessageSeenType, c as SchemaChatMessageType, e as SchemaChatType, f as SchemaCreateBulkNotificationInput, g as SchemaNotificationType, d as SchemaParticipantType } from '../Chat-Ctmtatmi.js';
6
- import { EnumOSPlatform } from '@timardex/cluemart-shared/enums';
7
- export { a as RelationModel, R as RelationTypeSchema, S as SchemaRelationType, r as relationDatesSchema } from '../Relation-Dvgd2CFi.js';
4
+ import { O as ObjectId } from '../Chat-DYkhie3G.js';
5
+ export { C as ChatModel, N as NotificationModel, a as SchemaChatMessageReactionType, S as SchemaChatMessageReplyPreviewType, b as SchemaChatMessageSeenType, c as SchemaChatMessageType, e as SchemaChatType, f as SchemaCreateBulkNotificationInput, g as SchemaNotificationType, d as SchemaParticipantType } from '../Chat-DYkhie3G.js';
6
+ export { a as RelationModel, R as RelationTypeSchema, S as SchemaRelationType, r as relationDatesSchema } from '../Relation-6t3Gn4pM.js';
8
7
  import '@timardex/cluemart-shared/types';
9
8
  import 'express';
10
9
 
@@ -332,14 +331,6 @@ declare const GoogleImportedMarketModel: mongoose.Model<SchemaGoogleImportedMark
332
331
  __v: number;
333
332
  }, any>;
334
333
 
335
- type PushTokenType = {
336
- _id: string;
337
- createdAt: Date;
338
- platform: EnumOSPlatform;
339
- token: string;
340
- updatedAt: Date;
341
- userId: string;
342
- };
343
334
  type SchemaPushTokenType = Omit<PushTokenType, "userId"> & {
344
335
  userId: ObjectId;
345
336
  };
@@ -37,7 +37,7 @@ import {
37
37
  resourceRelationsSchema,
38
38
  termsAgreementSchema,
39
39
  userLicenseSchema
40
- } from "../chunk-QHPLDTUG.mjs";
40
+ } from "../chunk-HO2KMWIK.mjs";
41
41
  import "../chunk-3QS3WKRC.mjs";
42
42
  export {
43
43
  APP_SETTINGS_ID,
@@ -7327,7 +7327,12 @@ var gameScreenIdentifierList = [
7327
7327
  match: "/events/events-near-me"
7328
7328
  },
7329
7329
  {
7330
- clue: "A collection of things worth attending.",
7330
+ clue: "Where events appear as pins on a map.",
7331
+ id: "events-map",
7332
+ match: "/events/events-map"
7333
+ },
7334
+ {
7335
+ clue: "A collection of events worth attending.",
7331
7336
  id: "events",
7332
7337
  match: "/events"
7333
7338
  },
@@ -7420,6 +7425,7 @@ function normalizeUrl(url) {
7420
7425
  }
7421
7426
  return url;
7422
7427
  }
7428
+ var CLUEMART_MAIN_DOMAIN_URL = "https://cluemart.co.nz";
7423
7429
  var SCHOOL_MIN_STUDENT_COUNT = 300;
7424
7430
  var packagingTypes = [
7425
7431
  "Biodegradable",
@@ -8825,7 +8831,6 @@ var USER_FIELDS_FRAGMENT = gql`
8825
8831
  platform
8826
8832
  preferredRegion
8827
8833
  promoCodes
8828
- refreshToken
8829
8834
  role
8830
8835
  school
8831
8836
  termsAgreement {
@@ -9075,7 +9080,10 @@ var GET_EVENT_BY_PLACE_ID = gql`
9075
9080
  ${EVENT_LIST_ITEM}
9076
9081
  `;
9077
9082
  var GET_EVENTS_BY_REGION = gql`
9078
- query getEventsByRegion($region: String!, $options: EventsByRegionOptions) {
9083
+ query getEventsByRegion(
9084
+ $region: String!
9085
+ $options: ResourcesByRegionOptions
9086
+ ) {
9079
9087
  eventsByRegion(region: $region, options: $options) {
9080
9088
  ...EventListItemFields
9081
9089
  }
@@ -9083,7 +9091,7 @@ var GET_EVENTS_BY_REGION = gql`
9083
9091
  ${EVENT_LIST_ITEM}
9084
9092
  `;
9085
9093
  var SEARCH_EVENTS = gql`
9086
- query searchEvents($region: String, $search: String,$tags: [String]) {
9094
+ query searchEvents($region: String, $search: String, $tags: [String]) {
9087
9095
  eventsSearch(region: $region, search: $search, tags: $tags) {
9088
9096
  ...EventListItemFields
9089
9097
  }
@@ -9307,8 +9315,11 @@ var GET_VENDOR = gql`
9307
9315
  ${VENDOR}
9308
9316
  `;
9309
9317
  var GET_VENDORS_BY_REGION = gql`
9310
- query getVendorsByRegion($region: String!) {
9311
- vendorsByRegion(region: $region) {
9318
+ query getVendorsByRegion(
9319
+ $region: String!
9320
+ $options: ResourcesByRegionOptions
9321
+ ) {
9322
+ vendorsByRegion(region: $region, options: $options) {
9312
9323
  ...VendorFields
9313
9324
  }
9314
9325
  }
@@ -9704,8 +9715,11 @@ var GET_PARTNER = gql`
9704
9715
  ${PARTNER}
9705
9716
  `;
9706
9717
  var GET_PARTNERS_BY_REGION = gql`
9707
- query getPartnersByRegion($region: String!) {
9708
- partnersByRegion(region: $region) {
9718
+ query getPartnersByRegion(
9719
+ $region: String!
9720
+ $options: ResourcesByRegionOptions
9721
+ ) {
9722
+ partnersByRegion(region: $region, options: $options) {
9709
9723
  ...PartnerFields
9710
9724
  }
9711
9725
  }
@@ -9908,7 +9922,6 @@ var RELATION_FIELDS_FRAGMENT = gql`
9908
9922
  fragment RelationFields on RelationType {
9909
9923
  _id
9910
9924
  active
9911
- apiMessage
9912
9925
  chatId
9913
9926
  createdAt
9914
9927
  lastUpdateBy
@@ -10924,7 +10937,7 @@ var emailOptionalSchema = create$6().nullable().notRequired().transform(
10924
10937
  (value) => !value || create$6().email().isValidSync(value)
10925
10938
  ).label("Email");
10926
10939
  var mobileRegex = /^02\d{7,9}$/;
10927
- var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
10940
+ var landlineRegex = /^0[34679]\d{7}$/;
10928
10941
  var mobilePhoneSchema = create$6().label("Mobile Phone").nullable().notRequired().test(
10929
10942
  "mobile-phone",
10930
10943
  "Mobile must start with 02 and be 9\u201311 digits",
@@ -11309,12 +11322,12 @@ var validateVerificationTokenSchema = create$3().shape({
11309
11322
  email: emailRequiredSchema,
11310
11323
  verificationToken: create$6().required("Verification code is required").matches(/^\d{6}$/, "Verification code must be exactly 6 digits")
11311
11324
  });
11312
- var EnumAdShowOn = /* @__PURE__ */ ((EnumAdShowOn3) => {
11313
- EnumAdShowOn3["EVENTS_PAGE"] = "Events_page";
11314
- EnumAdShowOn3["FRONT_PAGE"] = "Front_page";
11315
- EnumAdShowOn3["PARTNERS_PAGE"] = "Partners_page";
11316
- EnumAdShowOn3["VENDORS_PAGE"] = "Vendors_page";
11317
- return EnumAdShowOn3;
11325
+ var EnumAdShowOn = /* @__PURE__ */ ((EnumAdShowOn2) => {
11326
+ EnumAdShowOn2["EVENTS_PAGE"] = "Events_page";
11327
+ EnumAdShowOn2["FRONT_PAGE"] = "Front_page";
11328
+ EnumAdShowOn2["PARTNERS_PAGE"] = "Partners_page";
11329
+ EnumAdShowOn2["VENDORS_PAGE"] = "Vendors_page";
11330
+ return EnumAdShowOn2;
11318
11331
  })(EnumAdShowOn || {});
11319
11332
  var EnumAdStatus = /* @__PURE__ */ ((EnumAdStatus2) => {
11320
11333
  EnumAdStatus2["ACTIVE"] = "Active";
@@ -11333,15 +11346,15 @@ var EnumAdStyle = /* @__PURE__ */ ((EnumAdStyle2) => {
11333
11346
  return EnumAdStyle2;
11334
11347
  })(EnumAdStyle || {});
11335
11348
  var adResourceSchema = create$3({
11336
- adDescription: create$6().nullable().trim().required("Ad description is required").max(150, "Ad description must be at most 150 characters"),
11337
- adImage: create$6().nullable().required("Ad image is required"),
11338
- adStyle: create$8().nullable().oneOf(Object.values(EnumAdStyle), "Please select a valid ad style").required("Ad style is required"),
11339
- adTitle: create$6().nullable().trim().required("Ad title is required").max(30, "Ad title must be at most 30 characters"),
11340
- adType: create$8().nullable().oneOf(Object.values(EnumAdType), "Please select a valid ad type").required("Ad type is required"),
11341
- resourceId: create$6().nullable().required("Resource ID is required"),
11342
- resourceName: create$6().nullable().required("Resource name is required"),
11343
- resourceRegion: create$6().nullable().required("Resource region is required"),
11344
- resourceType: create$8().nullable().oneOf(Object.values(EnumResourceType), "Please select Event or Vendor").required("Resource type is required")
11349
+ adDescription: create$6().trim().required("Ad description is required").max(150, "Ad description must be at most 150 characters"),
11350
+ adImage: create$6().required("Ad image is required"),
11351
+ adStyle: create$8().oneOf(Object.values(EnumAdStyle), "Please select a valid ad style").required("Ad style is required"),
11352
+ adTitle: create$6().trim().required("Ad title is required").max(30, "Ad title must be at most 30 characters"),
11353
+ adType: create$8().oneOf(Object.values(EnumAdType), "Please select a valid ad type").required("Ad type is required"),
11354
+ resourceId: create$6().required("Resource ID is required"),
11355
+ resourceName: create$6().required("Resource name is required"),
11356
+ resourceRegion: create$6().required("Resource region is required"),
11357
+ resourceType: create$8().oneOf(Object.values(EnumResourceType), "Please select Event or Vendor").required("Resource type is required")
11345
11358
  });
11346
11359
  var adSchema = create$3().shape({
11347
11360
  active: create$7().required("Active status is required"),
@@ -11371,7 +11384,8 @@ var adSchema = create$3().shape({
11371
11384
  if (!value) return false;
11372
11385
  return value > /* @__PURE__ */ new Date();
11373
11386
  }),
11374
- otherwise: () => create$4().nullable().notRequired()
11387
+ // Keep `start` optional (not null) when ACTIVE to match TS type `start?: Date`.
11388
+ otherwise: () => create$4().notRequired()
11375
11389
  }),
11376
11390
  targetRegion: create$2().of(create$6().required()).min(1, "At least one target region is required").required("Target region is required")
11377
11391
  });
@@ -11499,6 +11513,31 @@ var contactUsSchema = create$3().shape({
11499
11513
  lastName: create$6().label("Last Name").required("Last name is required"),
11500
11514
  message: create$6().label("Message").required("Message is required")
11501
11515
  });
11516
+ var defaultValues8 = {
11517
+ active: true,
11518
+ // Use a future default so yup "future date" rules pass on first submit.
11519
+ end: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3),
11520
+ resource: {
11521
+ adDescription: "",
11522
+ adImage: "",
11523
+ adStyle: "Bloom",
11524
+ adTitle: "",
11525
+ adType: "Sponsored",
11526
+ resourceId: "",
11527
+ resourceName: "",
11528
+ resourceRegion: "",
11529
+ resourceType: "event"
11530
+ /* EVENT */
11531
+ },
11532
+ showOn: [
11533
+ "Front_page"
11534
+ /* FRONT_PAGE */
11535
+ ],
11536
+ // `start` is only required (and must be future) when status !== ACTIVE.
11537
+ start: void 0,
11538
+ status: "Active",
11539
+ targetRegion: []
11540
+ };
11502
11541
  var schoolSchema = create$3().shape({
11503
11542
  active: create$7().required("Active is required"),
11504
11543
  contactDetails: contactDetailsSchema,
@@ -11560,8 +11599,9 @@ var badgeFiles = Object.fromEntries(
11560
11599
  var logoIds = [
11561
11600
  "googleMaps-logo-dark",
11562
11601
  "googleMaps-logo-light",
11563
- "logo",
11564
- "logo-atr"
11602
+ "logo-atr",
11603
+ "logo-dark",
11604
+ "logo"
11565
11605
  ];
11566
11606
  var logoFiles = Object.fromEntries(
11567
11607
  logoIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
@@ -11569,6 +11609,7 @@ var logoFiles = Object.fromEntries(
11569
11609
  var otherImagesIds = [
11570
11610
  "banner-horizontal",
11571
11611
  "banner-vertical",
11612
+ "gazebo-top",
11572
11613
  "qr-code",
11573
11614
  "store-android",
11574
11615
  "store-ios"
@@ -11596,7 +11637,7 @@ var otherImages = Object.fromEntries(
11596
11637
  );
11597
11638
  var RELATION_SHARE_INVITATION = "invitation";
11598
11639
  var RELATION_SHARE_APPLICATION = "application";
11599
- var SHARE_SITE_URL = "https://cluemart.co.nz";
11640
+ var SHARE_SITE_URL = CLUEMART_MAIN_DOMAIN_URL;
11600
11641
  var SHARE_CALENDAR_ICON = "\u{1F4C5}";
11601
11642
  var SHARE_MARKET_DATES_SECTION_HEADING = `${SHARE_CALENDAR_ICON} Market dates:`;
11602
11643
  var SHARE_CHECKMARK_ICON = "\u2705";
@@ -11744,7 +11785,11 @@ var schema2 = new MongooseSchema2(
11744
11785
  type: String
11745
11786
  },
11746
11787
  token: { required: true, type: String },
11747
- userId: { required: true, type: import_mongoose3.default.Schema.Types.ObjectId }
11788
+ userId: {
11789
+ ref: "User",
11790
+ required: true,
11791
+ type: import_mongoose3.default.Schema.Types.ObjectId
11792
+ }
11748
11793
  },
11749
11794
  { timestamps: true }
11750
11795
  );
@@ -12131,6 +12176,7 @@ var refundPolicySchema = new MongooseSchema6(
12131
12176
  );
12132
12177
  var schema4 = new MongooseSchema6(
12133
12178
  {
12179
+ active: { default: true, type: Boolean },
12134
12180
  applicationDeadlineHours: { required: true, type: Number },
12135
12181
  dateTime: { required: true, type: [dateTimeSchema2] },
12136
12182
  eventId: {
@@ -12855,6 +12901,7 @@ var AttributesSchema = new MongooseSchema14(
12855
12901
  );
12856
12902
  var schema10 = new MongooseSchema14(
12857
12903
  {
12904
+ active: { default: true, type: Boolean },
12858
12905
  compliance: {
12859
12906
  foodBeverageLicense: { default: false, required: false, type: Boolean },
12860
12907
  liabilityInsurance: { default: false, required: false, type: Boolean }
@@ -13428,12 +13475,12 @@ async function removeAssociateFromResource({
13428
13475
  // src/service/vendor.ts
13429
13476
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
13430
13477
  try {
13431
- const user = await UserModel.findById(userId).select("vendor").lean();
13478
+ const user = await UserModel.findById(userId).select("vendor").lean().exec();
13432
13479
  if (!user?.vendor) {
13433
13480
  console.warn(`[updateVendor] No vendor found for userId=${userId}`);
13434
13481
  return;
13435
13482
  }
13436
- const vendor = await VendorModel.findById(user.vendor).lean();
13483
+ const vendor = await VendorModel.findById(user.vendor).lean().exec();
13437
13484
  if (!vendor) {
13438
13485
  console.warn(`[updateVendor] Vendor not found for id=${user.vendor}`);
13439
13486
  return;