@timardex/cluemart-server-shared 1.0.179 → 1.0.200

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-BBXiEM1-.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-1llDbRjW.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-MBUS572I.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
  }
@@ -10924,7 +10938,7 @@ var emailOptionalSchema = create$6().nullable().notRequired().transform(
10924
10938
  (value) => !value || create$6().email().isValidSync(value)
10925
10939
  ).label("Email");
10926
10940
  var mobileRegex = /^02\d{7,9}$/;
10927
- var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
10941
+ var landlineRegex = /^0[34679]\d{7}$/;
10928
10942
  var mobilePhoneSchema = create$6().label("Mobile Phone").nullable().notRequired().test(
10929
10943
  "mobile-phone",
10930
10944
  "Mobile must start with 02 and be 9\u201311 digits",
@@ -11309,12 +11323,12 @@ var validateVerificationTokenSchema = create$3().shape({
11309
11323
  email: emailRequiredSchema,
11310
11324
  verificationToken: create$6().required("Verification code is required").matches(/^\d{6}$/, "Verification code must be exactly 6 digits")
11311
11325
  });
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;
11326
+ var EnumAdShowOn = /* @__PURE__ */ ((EnumAdShowOn2) => {
11327
+ EnumAdShowOn2["EVENTS_PAGE"] = "Events_page";
11328
+ EnumAdShowOn2["FRONT_PAGE"] = "Front_page";
11329
+ EnumAdShowOn2["PARTNERS_PAGE"] = "Partners_page";
11330
+ EnumAdShowOn2["VENDORS_PAGE"] = "Vendors_page";
11331
+ return EnumAdShowOn2;
11318
11332
  })(EnumAdShowOn || {});
11319
11333
  var EnumAdStatus = /* @__PURE__ */ ((EnumAdStatus2) => {
11320
11334
  EnumAdStatus2["ACTIVE"] = "Active";
@@ -11333,15 +11347,15 @@ var EnumAdStyle = /* @__PURE__ */ ((EnumAdStyle2) => {
11333
11347
  return EnumAdStyle2;
11334
11348
  })(EnumAdStyle || {});
11335
11349
  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")
11350
+ adDescription: create$6().trim().required("Ad description is required").max(150, "Ad description must be at most 150 characters"),
11351
+ adImage: create$6().required("Ad image is required"),
11352
+ adStyle: create$8().oneOf(Object.values(EnumAdStyle), "Please select a valid ad style").required("Ad style is required"),
11353
+ adTitle: create$6().trim().required("Ad title is required").max(30, "Ad title must be at most 30 characters"),
11354
+ adType: create$8().oneOf(Object.values(EnumAdType), "Please select a valid ad type").required("Ad type is required"),
11355
+ resourceId: create$6().required("Resource ID is required"),
11356
+ resourceName: create$6().required("Resource name is required"),
11357
+ resourceRegion: create$6().required("Resource region is required"),
11358
+ resourceType: create$8().oneOf(Object.values(EnumResourceType), "Please select Event or Vendor").required("Resource type is required")
11345
11359
  });
11346
11360
  var adSchema = create$3().shape({
11347
11361
  active: create$7().required("Active status is required"),
@@ -11371,7 +11385,8 @@ var adSchema = create$3().shape({
11371
11385
  if (!value) return false;
11372
11386
  return value > /* @__PURE__ */ new Date();
11373
11387
  }),
11374
- otherwise: () => create$4().nullable().notRequired()
11388
+ // Keep `start` optional (not null) when ACTIVE to match TS type `start?: Date`.
11389
+ otherwise: () => create$4().notRequired()
11375
11390
  }),
11376
11391
  targetRegion: create$2().of(create$6().required()).min(1, "At least one target region is required").required("Target region is required")
11377
11392
  });
@@ -11499,6 +11514,31 @@ var contactUsSchema = create$3().shape({
11499
11514
  lastName: create$6().label("Last Name").required("Last name is required"),
11500
11515
  message: create$6().label("Message").required("Message is required")
11501
11516
  });
11517
+ var defaultValues8 = {
11518
+ active: true,
11519
+ // Use a future default so yup "future date" rules pass on first submit.
11520
+ end: new Date(Date.now() + 7 * 24 * 60 * 60 * 1e3),
11521
+ resource: {
11522
+ adDescription: "",
11523
+ adImage: "",
11524
+ adStyle: "Bloom",
11525
+ adTitle: "",
11526
+ adType: "Sponsored",
11527
+ resourceId: "",
11528
+ resourceName: "",
11529
+ resourceRegion: "",
11530
+ resourceType: "event"
11531
+ /* EVENT */
11532
+ },
11533
+ showOn: [
11534
+ "Front_page"
11535
+ /* FRONT_PAGE */
11536
+ ],
11537
+ // `start` is only required (and must be future) when status !== ACTIVE.
11538
+ start: void 0,
11539
+ status: "Active",
11540
+ targetRegion: []
11541
+ };
11502
11542
  var schoolSchema = create$3().shape({
11503
11543
  active: create$7().required("Active is required"),
11504
11544
  contactDetails: contactDetailsSchema,
@@ -11560,8 +11600,9 @@ var badgeFiles = Object.fromEntries(
11560
11600
  var logoIds = [
11561
11601
  "googleMaps-logo-dark",
11562
11602
  "googleMaps-logo-light",
11563
- "logo",
11564
- "logo-atr"
11603
+ "logo-atr",
11604
+ "logo-dark",
11605
+ "logo"
11565
11606
  ];
11566
11607
  var logoFiles = Object.fromEntries(
11567
11608
  logoIds.map((id) => [id, `${id}${IMAGE_EXTENSION}`])
@@ -11569,6 +11610,7 @@ var logoFiles = Object.fromEntries(
11569
11610
  var otherImagesIds = [
11570
11611
  "banner-horizontal",
11571
11612
  "banner-vertical",
11613
+ "gazebo-top",
11572
11614
  "qr-code",
11573
11615
  "store-android",
11574
11616
  "store-ios"
@@ -11596,7 +11638,7 @@ var otherImages = Object.fromEntries(
11596
11638
  );
11597
11639
  var RELATION_SHARE_INVITATION = "invitation";
11598
11640
  var RELATION_SHARE_APPLICATION = "application";
11599
- var SHARE_SITE_URL = "https://cluemart.co.nz";
11641
+ var SHARE_SITE_URL = CLUEMART_MAIN_DOMAIN_URL;
11600
11642
  var SHARE_CALENDAR_ICON = "\u{1F4C5}";
11601
11643
  var SHARE_MARKET_DATES_SECTION_HEADING = `${SHARE_CALENDAR_ICON} Market dates:`;
11602
11644
  var SHARE_CHECKMARK_ICON = "\u2705";
@@ -11744,7 +11786,11 @@ var schema2 = new MongooseSchema2(
11744
11786
  type: String
11745
11787
  },
11746
11788
  token: { required: true, type: String },
11747
- userId: { required: true, type: import_mongoose3.default.Schema.Types.ObjectId }
11789
+ userId: {
11790
+ ref: "User",
11791
+ required: true,
11792
+ type: import_mongoose3.default.Schema.Types.ObjectId
11793
+ }
11748
11794
  },
11749
11795
  { timestamps: true }
11750
11796
  );
@@ -12131,6 +12177,7 @@ var refundPolicySchema = new MongooseSchema6(
12131
12177
  );
12132
12178
  var schema4 = new MongooseSchema6(
12133
12179
  {
12180
+ active: { default: true, type: Boolean },
12134
12181
  applicationDeadlineHours: { required: true, type: Number },
12135
12182
  dateTime: { required: true, type: [dateTimeSchema2] },
12136
12183
  eventId: {
@@ -12855,6 +12902,7 @@ var AttributesSchema = new MongooseSchema14(
12855
12902
  );
12856
12903
  var schema10 = new MongooseSchema14(
12857
12904
  {
12905
+ active: { default: true, type: Boolean },
12858
12906
  compliance: {
12859
12907
  foodBeverageLicense: { default: false, required: false, type: Boolean },
12860
12908
  liabilityInsurance: { default: false, required: false, type: Boolean }
@@ -13428,12 +13476,12 @@ async function removeAssociateFromResource({
13428
13476
  // src/service/vendor.ts
13429
13477
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
13430
13478
  try {
13431
- const user = await UserModel.findById(userId).select("vendor").lean();
13479
+ const user = await UserModel.findById(userId).select("vendor").lean().exec();
13432
13480
  if (!user?.vendor) {
13433
13481
  console.warn(`[updateVendor] No vendor found for userId=${userId}`);
13434
13482
  return;
13435
13483
  }
13436
- const vendor = await VendorModel.findById(user.vendor).lean();
13484
+ const vendor = await VendorModel.findById(user.vendor).lean().exec();
13437
13485
  if (!vendor) {
13438
13486
  console.warn(`[updateVendor] Vendor not found for id=${user.vendor}`);
13439
13487
  return;