@timardex/cluemart-shared 1.2.7 → 1.2.8

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/index.cjs CHANGED
@@ -2288,6 +2288,13 @@ var STALL_TYPE_FIELDS_FRAGMENT = import_client2.gql`
2288
2288
  }
2289
2289
  }
2290
2290
  `;
2291
+ var CONTACT_DETAILS_FIELDS_FRAGMENT = import_client2.gql`
2292
+ fragment ContactDetailsFields on ContactDetailsType {
2293
+ email
2294
+ landlinePhone
2295
+ mobilePhone
2296
+ }
2297
+ `;
2291
2298
 
2292
2299
  // src/graphql/queries/event.ts
2293
2300
  var EVENT_DATETIME_FIELDS_FRAGMENT = import_client3.gql`
@@ -2314,11 +2321,6 @@ var EVENT_INFO = import_client3.gql`
2314
2321
  fragment EventInfoFields on EventInfoType {
2315
2322
  _id
2316
2323
  applicationDeadlineHours
2317
- contactDetails {
2318
- email
2319
- landlinePhone
2320
- mobilePhone
2321
- }
2322
2324
  dateTime {
2323
2325
  endDate
2324
2326
  endTime
@@ -2354,6 +2356,9 @@ var EVENT = import_client3.gql`
2354
2356
  ...ResourceImageFields
2355
2357
  }
2356
2358
  createdAt
2359
+ contactDetails {
2360
+ ...ContactDetailsFields
2361
+ }
2357
2362
  dateTime {
2358
2363
  ...EventDateTimeFields
2359
2364
  }
@@ -2399,6 +2404,7 @@ var EVENT = import_client3.gql`
2399
2404
  ${SOCIAL_MEDIA_FIELDS_FRAGMENT}
2400
2405
  ${POSTER_USAGE_FIELDS_FRAGMENT}
2401
2406
  ${PARTNER_FIELDS_FRAGMENT}
2407
+ ${CONTACT_DETAILS_FIELDS_FRAGMENT}
2402
2408
  `;
2403
2409
  var GET_EVENTS = import_client3.gql`
2404
2410
  query getEvents {
@@ -2493,6 +2499,9 @@ var VENDOR = import_client4.gql`
2493
2499
  categories {
2494
2500
  ...CategoryFields
2495
2501
  }
2502
+ contactDetails {
2503
+ ...ContactDetailsFields
2504
+ }
2496
2505
  cover {
2497
2506
  ...ResourceImageFields
2498
2507
  }
@@ -2546,6 +2555,7 @@ var VENDOR = import_client4.gql`
2546
2555
  ${POSTER_USAGE_FIELDS_FRAGMENT}
2547
2556
  ${PARTNER_FIELDS_FRAGMENT}
2548
2557
  ${VENDOR_MENU_FIELDS_FRAGMENT}
2558
+ ${CONTACT_DETAILS_FIELDS_FRAGMENT}
2549
2559
  `;
2550
2560
  var VENDOR_ATTRIBUTES_FRAGMENT = import_client4.gql`
2551
2561
  fragment VendorAttributesFields on VendorAttributesType {
@@ -2560,11 +2570,6 @@ var VENDOR_INFO = import_client4.gql`
2560
2570
  foodBeverageLicense
2561
2571
  liabilityInsurance
2562
2572
  }
2563
- contactDetails {
2564
- email
2565
- landlinePhone
2566
- mobilePhone
2567
- }
2568
2573
  documents {
2569
2574
  ...ResourceImageFields
2570
2575
  }
@@ -3584,6 +3589,9 @@ var GET_RESOURCE_CONNECTIONS = import_client29.gql`
3584
3589
  cover {
3585
3590
  ...ResourceImageFields
3586
3591
  }
3592
+ contactDetails {
3593
+ ...ContactDetailsFields
3594
+ }
3587
3595
  createdAt
3588
3596
  dateTime {
3589
3597
  ...EventDateTimeFields
@@ -3639,6 +3647,9 @@ var GET_RESOURCE_CONNECTIONS = import_client29.gql`
3639
3647
  categories {
3640
3648
  ...CategoryFields
3641
3649
  }
3650
+ contactDetails {
3651
+ ...ContactDetailsFields
3652
+ }
3642
3653
  cover {
3643
3654
  ...ResourceImageFields
3644
3655
  }
@@ -3700,6 +3711,7 @@ var GET_RESOURCE_CONNECTIONS = import_client29.gql`
3700
3711
  ${POSTER_USAGE_FIELDS_FRAGMENT}
3701
3712
  ${PARTNER_FIELDS_FRAGMENT}
3702
3713
  ${VENDOR_MENU_FIELDS_FRAGMENT}
3714
+ ${CONTACT_DETAILS_FIELDS_FRAGMENT}
3703
3715
  `;
3704
3716
 
3705
3717
  // src/graphql/mutations/relation.ts
@@ -4735,6 +4747,33 @@ var noLeadingZeros = (fieldName, options = {}) => {
4735
4747
  };
4736
4748
  import_dayjs2.default.extend(import_isSameOrAfter2.default);
4737
4749
  import_dayjs2.default.extend(import_customParseFormat2.default);
4750
+ var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
4751
+ (value) => typeof value === "string" ? value.trim().toLowerCase() : value
4752
+ );
4753
+ var emailOptionalSchema = yup.string().nullable().notRequired().transform(
4754
+ (value) => typeof value === "string" ? value.trim().toLowerCase() : value
4755
+ ).test(
4756
+ "is-valid-email",
4757
+ "Invalid email address",
4758
+ (value) => !value || yup.string().email().isValidSync(value)
4759
+ ).label("Email");
4760
+ var mobileRegex = /^02\d{7,9}$/;
4761
+ var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
4762
+ var contactDetailsSchema = yup.object({
4763
+ email: emailOptionalSchema,
4764
+ mobilePhone: yup.string().label("Mobile Phone").nullable().notRequired().test(
4765
+ "mobile-phone",
4766
+ "Mobile must start with 02 and be 9\u201311 digits",
4767
+ (value) => !value || mobileRegex.test(value)
4768
+ // skip empty values
4769
+ ),
4770
+ landlinePhone: yup.string().label("Landline Phone").nullable().notRequired().test(
4771
+ "landline-phone",
4772
+ "Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
4773
+ (value) => !value || landlineRegex.test(value)
4774
+ // skip empty values
4775
+ )
4776
+ }).nullable().optional().label("Contact Details");
4738
4777
  var endDateNotInPastTest = yup.string().test("not-in-past", "End date cannot be in the past", (value) => {
4739
4778
  const now = (0, import_dayjs2.default)();
4740
4779
  return value ? (0, import_dayjs2.default)(value, dateFormat, true).isSameOrAfter(now, "day") : false;
@@ -4830,16 +4869,6 @@ var locationSchema = yup.object().shape({
4830
4869
  region: yup.string().label("Region").required("Region is required"),
4831
4870
  type: yup.string().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
4832
4871
  });
4833
- var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
4834
- (value) => typeof value === "string" ? value.trim().toLowerCase() : value
4835
- );
4836
- var emailOptionalSchema = yup.string().nullable().notRequired().transform(
4837
- (value) => typeof value === "string" ? value.trim().toLowerCase() : value
4838
- ).test(
4839
- "is-valid-email",
4840
- "Invalid email address",
4841
- (value) => !value || yup.string().email().isValidSync(value)
4842
- ).label("Email");
4843
4872
  var passwordSchema = yup.string().trim().label("Password").min(8, "Password must be at least 8 characters long").required("Password is required");
4844
4873
  var socialMediaSchema = yup.object({
4845
4874
  name: yup.mixed().oneOf(Object.values(EnumSocialMedia)).label("Social Media Name").optional(),
@@ -4856,6 +4885,7 @@ var globalResourceSchema = yup.object().shape({
4856
4885
  source: yup.string().label("Cover").required("Cover is required"),
4857
4886
  title: yup.string().label("Cover Title").required("Cover is required")
4858
4887
  }),
4888
+ contactDetails: contactDetailsSchema,
4859
4889
  description: yup.string().label("Description").trim().min(3).required("Description is required"),
4860
4890
  name: yup.string().label("Name").trim().min(3).max(40).required("Name is required"),
4861
4891
  region: yup.string().label("Region").required("Region is required"),
@@ -4887,23 +4917,6 @@ var categorySchema = yup.array().of(
4887
4917
  ).min(1, "At least one subcategory is required").required("Subcategories are required")
4888
4918
  })
4889
4919
  );
4890
- var mobileRegex = /^02\d{7,9}$/;
4891
- var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
4892
- var contactDetailsSchema = yup.object({
4893
- email: emailOptionalSchema,
4894
- mobilePhone: yup.string().label("Mobile Phone").nullable().notRequired().test(
4895
- "mobile-phone",
4896
- "Mobile must start with 02 and be 9\u201311 digits",
4897
- (value) => !value || mobileRegex.test(value)
4898
- // skip empty values
4899
- ),
4900
- landlinePhone: yup.string().label("Landline Phone").nullable().notRequired().test(
4901
- "landline-phone",
4902
- "Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
4903
- (value) => !value || landlineRegex.test(value)
4904
- // skip empty values
4905
- )
4906
- }).nullable().optional().label("Contact Details");
4907
4920
 
4908
4921
  // src/yupSchema/event.ts
4909
4922
  var yup2 = __toESM(require("yup"));
@@ -4954,7 +4967,6 @@ var paymentInfoSchema = yup2.object({
4954
4967
  })
4955
4968
  });
4956
4969
  var eventInfoSchema = yup2.object().shape({
4957
- contactDetails: contactDetailsSchema,
4958
4970
  applicationDeadlineHours: yup2.number().label("Application Deadline Hours").nullable().transform((value, originalValue) => originalValue === "" ? null : value).typeError("Application deadline hours must be a number").min(1, "Application deadline hours must be at least 1").required("Application deadline hours is required").test("no-leading-zeros", "", noLeadingZeros("Application deadline hours")),
4959
4971
  dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
4960
4972
  eventId: yup2.string().trim().required("Event ID is required"),
@@ -4985,7 +4997,6 @@ var vendorSchema = globalResourceSchema.shape({
4985
4997
  vendorType: yup3.mixed().oneOf(Object.values(EnumVendorType)).required("Please select a Vendor type")
4986
4998
  });
4987
4999
  var vendorInfoSchema = yup3.object().shape({
4988
- contactDetails: contactDetailsSchema,
4989
5000
  product: yup3.object().shape({
4990
5001
  foodFlavors: yup3.array().of(
4991
5002
  yup3.mixed().oneOf(Object.values(EnumFoodFlavor), "Invalid flavor selected").required("Flavor is required")
@@ -5168,6 +5179,11 @@ var adSchema = yup7.object().shape({
5168
5179
  // src/hooks/utils.ts
5169
5180
  var globalDefaultValues = {
5170
5181
  active: false,
5182
+ contactDetails: {
5183
+ email: null,
5184
+ landlinePhone: null,
5185
+ mobilePhone: null
5186
+ },
5171
5187
  cover: {
5172
5188
  source: "",
5173
5189
  title: ""
@@ -5189,14 +5205,7 @@ var globalDefaultValues = {
5189
5205
  };
5190
5206
  var defaultEventFormValues = {
5191
5207
  ...globalDefaultValues,
5192
- dateTime: [
5193
- {
5194
- endDate: "",
5195
- endTime: "",
5196
- startDate: "",
5197
- startTime: ""
5198
- }
5199
- ],
5208
+ dateTime: [],
5200
5209
  eventType: "market" /* MARKET */,
5201
5210
  location: {
5202
5211
  city: "",
@@ -5217,20 +5226,7 @@ var defaultEventFormValues = {
5217
5226
  };
5218
5227
  var defaultEventInfoFormValues = {
5219
5228
  applicationDeadlineHours: 24,
5220
- contactDetails: {
5221
- email: null,
5222
- landlinePhone: null,
5223
- mobilePhone: null
5224
- },
5225
- dateTime: [
5226
- {
5227
- endDate: "",
5228
- endTime: "",
5229
- stallTypes: [],
5230
- startDate: "",
5231
- startTime: ""
5232
- }
5233
- ],
5229
+ dateTime: [],
5234
5230
  eventId: "",
5235
5231
  packInTime: 2,
5236
5232
  // e.g., 2 hours before event opens
@@ -5253,11 +5249,6 @@ var defaultVendorFormValues = {
5253
5249
  };
5254
5250
  var defaultVendorInfoFormValues = {
5255
5251
  compliance: { foodBeverageLicense: false, liabilityInsurance: false },
5256
- contactDetails: {
5257
- email: null,
5258
- landlinePhone: null,
5259
- mobilePhone: null
5260
- },
5261
5252
  documents: null,
5262
5253
  documentsUpload: null,
5263
5254
  product: {
@@ -5280,6 +5271,7 @@ function mapBaseResourceTypeToFormData(data) {
5280
5271
  return {
5281
5272
  _id: data._id,
5282
5273
  active: data.active,
5274
+ contactDetails: data.contactDetails,
5283
5275
  cover: data.cover,
5284
5276
  coverUpload: data.coverUpload,
5285
5277
  description: data.description,
@@ -5403,7 +5395,6 @@ function useVendorInfoForm(data) {
5403
5395
  reset({
5404
5396
  _id: data._id,
5405
5397
  compliance: data.compliance,
5406
- contactDetails: data.contactDetails,
5407
5398
  documents: data.documents,
5408
5399
  documentsUpload: data.documentsUpload,
5409
5400
  product: data.product,
@@ -5418,7 +5409,6 @@ function useVendorInfoForm(data) {
5418
5409
  const {
5419
5410
  _id,
5420
5411
  compliance,
5421
- contactDetails,
5422
5412
  documents,
5423
5413
  documentsUpload,
5424
5414
  product,
@@ -5431,7 +5421,6 @@ function useVendorInfoForm(data) {
5431
5421
  fields: {
5432
5422
  _id,
5433
5423
  compliance,
5434
- contactDetails,
5435
5424
  documents,
5436
5425
  documentsUpload,
5437
5426
  product,
@@ -5560,7 +5549,6 @@ function useEventInfoForm(data) {
5560
5549
  reset({
5561
5550
  _id: data._id,
5562
5551
  applicationDeadlineHours: data.applicationDeadlineHours,
5563
- contactDetails: data.contactDetails,
5564
5552
  dateTime: data.dateTime,
5565
5553
  eventId: data.eventId,
5566
5554
  packInTime: data.packInTime,
@@ -5575,7 +5563,6 @@ function useEventInfoForm(data) {
5575
5563
  const {
5576
5564
  _id,
5577
5565
  applicationDeadlineHours,
5578
- contactDetails,
5579
5566
  dateTime,
5580
5567
  eventId,
5581
5568
  packInTime,
@@ -5588,7 +5575,6 @@ function useEventInfoForm(data) {
5588
5575
  fields: {
5589
5576
  _id,
5590
5577
  applicationDeadlineHours,
5591
- contactDetails,
5592
5578
  dateTime,
5593
5579
  eventId,
5594
5580
  packInTime,