@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.d.mts CHANGED
@@ -165,7 +165,6 @@ type Requirement = {
165
165
  interface EventInfoFormData {
166
166
  _id?: string;
167
167
  applicationDeadlineHours: number;
168
- contactDetails?: ResourceContactDetailsType | null;
169
168
  dateTime: DateTimeWithPriceType[];
170
169
  eventId: string;
171
170
  packInTime: number;
@@ -238,7 +237,6 @@ type VendorInfoFormData = {
238
237
  liabilityInsurance: boolean;
239
238
  foodBeverageLicense: boolean;
240
239
  };
241
- contactDetails?: ResourceContactDetailsType | null;
242
240
  documents?: ResourceImageType[] | null;
243
241
  documentsUpload?: ResourceImageType[] | null;
244
242
  product: {
@@ -287,6 +285,11 @@ interface VendorWithConnectionDatesType extends VendorType {
287
285
  type Nullable<T> = {
288
286
  [K in keyof T]: T[K] | null | undefined;
289
287
  };
288
+ type ResourceContactDetailsType = {
289
+ email?: string | null;
290
+ landlinePhone?: string | null;
291
+ mobilePhone?: string | null;
292
+ };
290
293
  type ResourceImageType = {
291
294
  source: string;
292
295
  title: string;
@@ -308,6 +311,7 @@ type OwnerType = {
308
311
  interface BaseResourceTypeFormData {
309
312
  _id?: string;
310
313
  active: boolean;
314
+ contactDetails?: ResourceContactDetailsType | null;
311
315
  cover: ResourceImageType;
312
316
  coverUpload?: ResourceImageType | null;
313
317
  description: string;
@@ -316,11 +320,11 @@ interface BaseResourceTypeFormData {
316
320
  logo?: ResourceImageType | null;
317
321
  logoUpload?: ResourceImageType | null;
318
322
  name: string;
323
+ owner?: OwnerType | null;
324
+ partners?: PartnerType[] | null;
319
325
  promoCodes?: string[] | null;
320
326
  region: string;
321
327
  socialMedia?: SocialMediaType[] | null;
322
- partners?: PartnerType[] | null;
323
- owner?: OwnerType | null;
324
328
  }
325
329
  type PosterUsageType = {
326
330
  month: string;
@@ -422,11 +426,6 @@ interface CreateFormData<T extends FieldValues> {
422
426
  setValue: UseFormSetValue<T>;
423
427
  watch: UseFormWatch<T>;
424
428
  }
425
- type ResourceContactDetailsType = {
426
- email?: string | null;
427
- landlinePhone?: string | null;
428
- mobilePhone?: string | null;
429
- };
430
429
 
431
430
  declare const vendorBasicInfoFields: FormField[];
432
431
  declare const vendorMultiLocation: FormField;
package/dist/index.d.ts CHANGED
@@ -165,7 +165,6 @@ type Requirement = {
165
165
  interface EventInfoFormData {
166
166
  _id?: string;
167
167
  applicationDeadlineHours: number;
168
- contactDetails?: ResourceContactDetailsType | null;
169
168
  dateTime: DateTimeWithPriceType[];
170
169
  eventId: string;
171
170
  packInTime: number;
@@ -238,7 +237,6 @@ type VendorInfoFormData = {
238
237
  liabilityInsurance: boolean;
239
238
  foodBeverageLicense: boolean;
240
239
  };
241
- contactDetails?: ResourceContactDetailsType | null;
242
240
  documents?: ResourceImageType[] | null;
243
241
  documentsUpload?: ResourceImageType[] | null;
244
242
  product: {
@@ -287,6 +285,11 @@ interface VendorWithConnectionDatesType extends VendorType {
287
285
  type Nullable<T> = {
288
286
  [K in keyof T]: T[K] | null | undefined;
289
287
  };
288
+ type ResourceContactDetailsType = {
289
+ email?: string | null;
290
+ landlinePhone?: string | null;
291
+ mobilePhone?: string | null;
292
+ };
290
293
  type ResourceImageType = {
291
294
  source: string;
292
295
  title: string;
@@ -308,6 +311,7 @@ type OwnerType = {
308
311
  interface BaseResourceTypeFormData {
309
312
  _id?: string;
310
313
  active: boolean;
314
+ contactDetails?: ResourceContactDetailsType | null;
311
315
  cover: ResourceImageType;
312
316
  coverUpload?: ResourceImageType | null;
313
317
  description: string;
@@ -316,11 +320,11 @@ interface BaseResourceTypeFormData {
316
320
  logo?: ResourceImageType | null;
317
321
  logoUpload?: ResourceImageType | null;
318
322
  name: string;
323
+ owner?: OwnerType | null;
324
+ partners?: PartnerType[] | null;
319
325
  promoCodes?: string[] | null;
320
326
  region: string;
321
327
  socialMedia?: SocialMediaType[] | null;
322
- partners?: PartnerType[] | null;
323
- owner?: OwnerType | null;
324
328
  }
325
329
  type PosterUsageType = {
326
330
  month: string;
@@ -422,11 +426,6 @@ interface CreateFormData<T extends FieldValues> {
422
426
  setValue: UseFormSetValue<T>;
423
427
  watch: UseFormWatch<T>;
424
428
  }
425
- type ResourceContactDetailsType = {
426
- email?: string | null;
427
- landlinePhone?: string | null;
428
- mobilePhone?: string | null;
429
- };
430
429
 
431
430
  declare const vendorBasicInfoFields: FormField[];
432
431
  declare const vendorMultiLocation: FormField;
package/dist/index.mjs CHANGED
@@ -2065,6 +2065,13 @@ var STALL_TYPE_FIELDS_FRAGMENT = gql2`
2065
2065
  }
2066
2066
  }
2067
2067
  `;
2068
+ var CONTACT_DETAILS_FIELDS_FRAGMENT = gql2`
2069
+ fragment ContactDetailsFields on ContactDetailsType {
2070
+ email
2071
+ landlinePhone
2072
+ mobilePhone
2073
+ }
2074
+ `;
2068
2075
 
2069
2076
  // src/graphql/queries/event.ts
2070
2077
  var EVENT_DATETIME_FIELDS_FRAGMENT = gql3`
@@ -2091,11 +2098,6 @@ var EVENT_INFO = gql3`
2091
2098
  fragment EventInfoFields on EventInfoType {
2092
2099
  _id
2093
2100
  applicationDeadlineHours
2094
- contactDetails {
2095
- email
2096
- landlinePhone
2097
- mobilePhone
2098
- }
2099
2101
  dateTime {
2100
2102
  endDate
2101
2103
  endTime
@@ -2131,6 +2133,9 @@ var EVENT = gql3`
2131
2133
  ...ResourceImageFields
2132
2134
  }
2133
2135
  createdAt
2136
+ contactDetails {
2137
+ ...ContactDetailsFields
2138
+ }
2134
2139
  dateTime {
2135
2140
  ...EventDateTimeFields
2136
2141
  }
@@ -2176,6 +2181,7 @@ var EVENT = gql3`
2176
2181
  ${SOCIAL_MEDIA_FIELDS_FRAGMENT}
2177
2182
  ${POSTER_USAGE_FIELDS_FRAGMENT}
2178
2183
  ${PARTNER_FIELDS_FRAGMENT}
2184
+ ${CONTACT_DETAILS_FIELDS_FRAGMENT}
2179
2185
  `;
2180
2186
  var GET_EVENTS = gql3`
2181
2187
  query getEvents {
@@ -2270,6 +2276,9 @@ var VENDOR = gql4`
2270
2276
  categories {
2271
2277
  ...CategoryFields
2272
2278
  }
2279
+ contactDetails {
2280
+ ...ContactDetailsFields
2281
+ }
2273
2282
  cover {
2274
2283
  ...ResourceImageFields
2275
2284
  }
@@ -2323,6 +2332,7 @@ var VENDOR = gql4`
2323
2332
  ${POSTER_USAGE_FIELDS_FRAGMENT}
2324
2333
  ${PARTNER_FIELDS_FRAGMENT}
2325
2334
  ${VENDOR_MENU_FIELDS_FRAGMENT}
2335
+ ${CONTACT_DETAILS_FIELDS_FRAGMENT}
2326
2336
  `;
2327
2337
  var VENDOR_ATTRIBUTES_FRAGMENT = gql4`
2328
2338
  fragment VendorAttributesFields on VendorAttributesType {
@@ -2337,11 +2347,6 @@ var VENDOR_INFO = gql4`
2337
2347
  foodBeverageLicense
2338
2348
  liabilityInsurance
2339
2349
  }
2340
- contactDetails {
2341
- email
2342
- landlinePhone
2343
- mobilePhone
2344
- }
2345
2350
  documents {
2346
2351
  ...ResourceImageFields
2347
2352
  }
@@ -3361,6 +3366,9 @@ var GET_RESOURCE_CONNECTIONS = gql17`
3361
3366
  cover {
3362
3367
  ...ResourceImageFields
3363
3368
  }
3369
+ contactDetails {
3370
+ ...ContactDetailsFields
3371
+ }
3364
3372
  createdAt
3365
3373
  dateTime {
3366
3374
  ...EventDateTimeFields
@@ -3416,6 +3424,9 @@ var GET_RESOURCE_CONNECTIONS = gql17`
3416
3424
  categories {
3417
3425
  ...CategoryFields
3418
3426
  }
3427
+ contactDetails {
3428
+ ...ContactDetailsFields
3429
+ }
3419
3430
  cover {
3420
3431
  ...ResourceImageFields
3421
3432
  }
@@ -3477,6 +3488,7 @@ var GET_RESOURCE_CONNECTIONS = gql17`
3477
3488
  ${POSTER_USAGE_FIELDS_FRAGMENT}
3478
3489
  ${PARTNER_FIELDS_FRAGMENT}
3479
3490
  ${VENDOR_MENU_FIELDS_FRAGMENT}
3491
+ ${CONTACT_DETAILS_FIELDS_FRAGMENT}
3480
3492
  `;
3481
3493
 
3482
3494
  // src/graphql/mutations/relation.ts
@@ -4512,6 +4524,33 @@ var noLeadingZeros = (fieldName, options = {}) => {
4512
4524
  };
4513
4525
  dayjs2.extend(isSameOrAfter2);
4514
4526
  dayjs2.extend(customParseFormat2);
4527
+ var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
4528
+ (value) => typeof value === "string" ? value.trim().toLowerCase() : value
4529
+ );
4530
+ var emailOptionalSchema = yup.string().nullable().notRequired().transform(
4531
+ (value) => typeof value === "string" ? value.trim().toLowerCase() : value
4532
+ ).test(
4533
+ "is-valid-email",
4534
+ "Invalid email address",
4535
+ (value) => !value || yup.string().email().isValidSync(value)
4536
+ ).label("Email");
4537
+ var mobileRegex = /^02\d{7,9}$/;
4538
+ var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
4539
+ var contactDetailsSchema = yup.object({
4540
+ email: emailOptionalSchema,
4541
+ mobilePhone: yup.string().label("Mobile Phone").nullable().notRequired().test(
4542
+ "mobile-phone",
4543
+ "Mobile must start with 02 and be 9\u201311 digits",
4544
+ (value) => !value || mobileRegex.test(value)
4545
+ // skip empty values
4546
+ ),
4547
+ landlinePhone: yup.string().label("Landline Phone").nullable().notRequired().test(
4548
+ "landline-phone",
4549
+ "Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
4550
+ (value) => !value || landlineRegex.test(value)
4551
+ // skip empty values
4552
+ )
4553
+ }).nullable().optional().label("Contact Details");
4515
4554
  var endDateNotInPastTest = yup.string().test("not-in-past", "End date cannot be in the past", (value) => {
4516
4555
  const now = dayjs2();
4517
4556
  return value ? dayjs2(value, dateFormat, true).isSameOrAfter(now, "day") : false;
@@ -4607,16 +4646,6 @@ var locationSchema = yup.object().shape({
4607
4646
  region: yup.string().label("Region").required("Region is required"),
4608
4647
  type: yup.string().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
4609
4648
  });
4610
- var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
4611
- (value) => typeof value === "string" ? value.trim().toLowerCase() : value
4612
- );
4613
- var emailOptionalSchema = yup.string().nullable().notRequired().transform(
4614
- (value) => typeof value === "string" ? value.trim().toLowerCase() : value
4615
- ).test(
4616
- "is-valid-email",
4617
- "Invalid email address",
4618
- (value) => !value || yup.string().email().isValidSync(value)
4619
- ).label("Email");
4620
4649
  var passwordSchema = yup.string().trim().label("Password").min(8, "Password must be at least 8 characters long").required("Password is required");
4621
4650
  var socialMediaSchema = yup.object({
4622
4651
  name: yup.mixed().oneOf(Object.values(EnumSocialMedia)).label("Social Media Name").optional(),
@@ -4633,6 +4662,7 @@ var globalResourceSchema = yup.object().shape({
4633
4662
  source: yup.string().label("Cover").required("Cover is required"),
4634
4663
  title: yup.string().label("Cover Title").required("Cover is required")
4635
4664
  }),
4665
+ contactDetails: contactDetailsSchema,
4636
4666
  description: yup.string().label("Description").trim().min(3).required("Description is required"),
4637
4667
  name: yup.string().label("Name").trim().min(3).max(40).required("Name is required"),
4638
4668
  region: yup.string().label("Region").required("Region is required"),
@@ -4664,23 +4694,6 @@ var categorySchema = yup.array().of(
4664
4694
  ).min(1, "At least one subcategory is required").required("Subcategories are required")
4665
4695
  })
4666
4696
  );
4667
- var mobileRegex = /^02\d{7,9}$/;
4668
- var landlineRegex = /^(0(3|4|6|7|9)[0-9]{7})$/;
4669
- var contactDetailsSchema = yup.object({
4670
- email: emailOptionalSchema,
4671
- mobilePhone: yup.string().label("Mobile Phone").nullable().notRequired().test(
4672
- "mobile-phone",
4673
- "Mobile must start with 02 and be 9\u201311 digits",
4674
- (value) => !value || mobileRegex.test(value)
4675
- // skip empty values
4676
- ),
4677
- landlinePhone: yup.string().label("Landline Phone").nullable().notRequired().test(
4678
- "landline-phone",
4679
- "Landline must start with 03, 04, 06, 07, or 09 (not 090) and have 7 digits after area code",
4680
- (value) => !value || landlineRegex.test(value)
4681
- // skip empty values
4682
- )
4683
- }).nullable().optional().label("Contact Details");
4684
4697
 
4685
4698
  // src/yupSchema/event.ts
4686
4699
  import * as yup2 from "yup";
@@ -4731,7 +4744,6 @@ var paymentInfoSchema = yup2.object({
4731
4744
  })
4732
4745
  });
4733
4746
  var eventInfoSchema = yup2.object().shape({
4734
- contactDetails: contactDetailsSchema,
4735
4747
  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")),
4736
4748
  dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
4737
4749
  eventId: yup2.string().trim().required("Event ID is required"),
@@ -4762,7 +4774,6 @@ var vendorSchema = globalResourceSchema.shape({
4762
4774
  vendorType: yup3.mixed().oneOf(Object.values(EnumVendorType)).required("Please select a Vendor type")
4763
4775
  });
4764
4776
  var vendorInfoSchema = yup3.object().shape({
4765
- contactDetails: contactDetailsSchema,
4766
4777
  product: yup3.object().shape({
4767
4778
  foodFlavors: yup3.array().of(
4768
4779
  yup3.mixed().oneOf(Object.values(EnumFoodFlavor), "Invalid flavor selected").required("Flavor is required")
@@ -4945,6 +4956,11 @@ var adSchema = yup7.object().shape({
4945
4956
  // src/hooks/utils.ts
4946
4957
  var globalDefaultValues = {
4947
4958
  active: false,
4959
+ contactDetails: {
4960
+ email: null,
4961
+ landlinePhone: null,
4962
+ mobilePhone: null
4963
+ },
4948
4964
  cover: {
4949
4965
  source: "",
4950
4966
  title: ""
@@ -4966,14 +4982,7 @@ var globalDefaultValues = {
4966
4982
  };
4967
4983
  var defaultEventFormValues = {
4968
4984
  ...globalDefaultValues,
4969
- dateTime: [
4970
- {
4971
- endDate: "",
4972
- endTime: "",
4973
- startDate: "",
4974
- startTime: ""
4975
- }
4976
- ],
4985
+ dateTime: [],
4977
4986
  eventType: "market" /* MARKET */,
4978
4987
  location: {
4979
4988
  city: "",
@@ -4994,20 +5003,7 @@ var defaultEventFormValues = {
4994
5003
  };
4995
5004
  var defaultEventInfoFormValues = {
4996
5005
  applicationDeadlineHours: 24,
4997
- contactDetails: {
4998
- email: null,
4999
- landlinePhone: null,
5000
- mobilePhone: null
5001
- },
5002
- dateTime: [
5003
- {
5004
- endDate: "",
5005
- endTime: "",
5006
- stallTypes: [],
5007
- startDate: "",
5008
- startTime: ""
5009
- }
5010
- ],
5006
+ dateTime: [],
5011
5007
  eventId: "",
5012
5008
  packInTime: 2,
5013
5009
  // e.g., 2 hours before event opens
@@ -5030,11 +5026,6 @@ var defaultVendorFormValues = {
5030
5026
  };
5031
5027
  var defaultVendorInfoFormValues = {
5032
5028
  compliance: { foodBeverageLicense: false, liabilityInsurance: false },
5033
- contactDetails: {
5034
- email: null,
5035
- landlinePhone: null,
5036
- mobilePhone: null
5037
- },
5038
5029
  documents: null,
5039
5030
  documentsUpload: null,
5040
5031
  product: {
@@ -5057,6 +5048,7 @@ function mapBaseResourceTypeToFormData(data) {
5057
5048
  return {
5058
5049
  _id: data._id,
5059
5050
  active: data.active,
5051
+ contactDetails: data.contactDetails,
5060
5052
  cover: data.cover,
5061
5053
  coverUpload: data.coverUpload,
5062
5054
  description: data.description,
@@ -5180,7 +5172,6 @@ function useVendorInfoForm(data) {
5180
5172
  reset({
5181
5173
  _id: data._id,
5182
5174
  compliance: data.compliance,
5183
- contactDetails: data.contactDetails,
5184
5175
  documents: data.documents,
5185
5176
  documentsUpload: data.documentsUpload,
5186
5177
  product: data.product,
@@ -5195,7 +5186,6 @@ function useVendorInfoForm(data) {
5195
5186
  const {
5196
5187
  _id,
5197
5188
  compliance,
5198
- contactDetails,
5199
5189
  documents,
5200
5190
  documentsUpload,
5201
5191
  product,
@@ -5208,7 +5198,6 @@ function useVendorInfoForm(data) {
5208
5198
  fields: {
5209
5199
  _id,
5210
5200
  compliance,
5211
- contactDetails,
5212
5201
  documents,
5213
5202
  documentsUpload,
5214
5203
  product,
@@ -5337,7 +5326,6 @@ function useEventInfoForm(data) {
5337
5326
  reset({
5338
5327
  _id: data._id,
5339
5328
  applicationDeadlineHours: data.applicationDeadlineHours,
5340
- contactDetails: data.contactDetails,
5341
5329
  dateTime: data.dateTime,
5342
5330
  eventId: data.eventId,
5343
5331
  packInTime: data.packInTime,
@@ -5352,7 +5340,6 @@ function useEventInfoForm(data) {
5352
5340
  const {
5353
5341
  _id,
5354
5342
  applicationDeadlineHours,
5355
- contactDetails,
5356
5343
  dateTime,
5357
5344
  eventId,
5358
5345
  packInTime,
@@ -5365,7 +5352,6 @@ function useEventInfoForm(data) {
5365
5352
  fields: {
5366
5353
  _id,
5367
5354
  applicationDeadlineHours,
5368
- contactDetails,
5369
5355
  dateTime,
5370
5356
  eventId,
5371
5357
  packInTime,