@timardex/cluemart-shared 1.0.9 → 1.0.12

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
@@ -69,6 +69,7 @@ __export(index_exports, {
69
69
  mapArrayToOptions: () => mapArrayToOptions,
70
70
  marketBasicInfoFields: () => marketBasicInfoFields,
71
71
  marketEndDateFields: () => marketEndDateFields,
72
+ marketPriceByDateFields: () => marketPriceByDateFields,
72
73
  marketSchema: () => marketSchema,
73
74
  marketStartDateFields: () => marketStartDateFields,
74
75
  packagingOptions: () => packagingOptions,
@@ -216,22 +217,22 @@ var EnumResourceTypeIcon = /* @__PURE__ */ ((EnumResourceTypeIcon2) => {
216
217
  EnumResourceTypeIcon2["STALLHOLDER"] = "store";
217
218
  return EnumResourceTypeIcon2;
218
219
  })(EnumResourceTypeIcon || {});
219
- var EnumRegions = /* @__PURE__ */ ((EnumRegions2) => {
220
- EnumRegions2["Auckland"] = "Auckland";
221
- EnumRegions2["BayOfPlenty"] = "Bay of Plenty";
222
- EnumRegions2["Canterbury"] = "Canterbury";
223
- EnumRegions2["Gisborne"] = "Gisborne";
224
- EnumRegions2["HawkesBay"] = "Hawke's Bay";
225
- EnumRegions2["ManawatuWanganui"] = "Manawatu-Wanganui";
226
- EnumRegions2["Marlborough"] = "Marlborough";
227
- EnumRegions2["Nelson"] = "Nelson";
228
- EnumRegions2["Northland"] = "Northland";
229
- EnumRegions2["Otago"] = "Otago";
230
- EnumRegions2["Southland"] = "Southland";
231
- EnumRegions2["Taranaki"] = "Taranaki";
232
- EnumRegions2["Waikato"] = "Waikato";
233
- EnumRegions2["Wellington"] = "Wellington";
234
- return EnumRegions2;
220
+ var EnumRegions = /* @__PURE__ */ ((EnumRegions3) => {
221
+ EnumRegions3["Auckland"] = "Auckland";
222
+ EnumRegions3["BayOfPlenty"] = "Bay of Plenty";
223
+ EnumRegions3["Canterbury"] = "Canterbury";
224
+ EnumRegions3["Gisborne"] = "Gisborne";
225
+ EnumRegions3["HawkesBay"] = "Hawke's Bay";
226
+ EnumRegions3["ManawatuWanganui"] = "Manawatu-Wanganui";
227
+ EnumRegions3["Marlborough"] = "Marlborough";
228
+ EnumRegions3["Nelson"] = "Nelson";
229
+ EnumRegions3["Northland"] = "Northland";
230
+ EnumRegions3["Otago"] = "Otago";
231
+ EnumRegions3["Southland"] = "Southland";
232
+ EnumRegions3["Taranaki"] = "Taranaki";
233
+ EnumRegions3["Waikato"] = "Waikato";
234
+ EnumRegions3["Wellington"] = "Wellington";
235
+ return EnumRegions3;
235
236
  })(EnumRegions || {});
236
237
  var ImageTypeEnum = /* @__PURE__ */ ((ImageTypeEnum2) => {
237
238
  ImageTypeEnum2["AVATAR"] = "avatar";
@@ -351,6 +352,8 @@ function sortDatesByProximity(dates) {
351
352
  return diffA - diffB;
352
353
  });
353
354
  }
355
+ var availableRegionTypes = Object.values(EnumRegions);
356
+ var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
354
357
 
355
358
  // src/hooks/useLocationSearch.ts
356
359
  var handleApiError = (error, message) => {
@@ -493,6 +496,14 @@ var startTimeCannotBeInPastTest = yup.string().test(
493
496
  var dateTimeSchema = yup.object().shape({
494
497
  endDate: yup.string().concat(endDateNotInPastTest).concat(endDateAfterStartDateTest).required("End date is required"),
495
498
  endTime: yup.string().concat(endTimeMustBeAfterStartTimeTest).required("End time is required"),
499
+ marketPrice: yup.number().typeError("Market price must be a number").min(0.1, "Market price must be at least 0.1").required("Market price is required").test(
500
+ "no-leading-zeros",
501
+ "Market price must not have leading zeros",
502
+ (value, context) => {
503
+ const original = context.originalValue?.toString() ?? "";
504
+ return !/^0\d+(\.\d+)?$/.test(original);
505
+ }
506
+ ),
496
507
  startDate: yup.string().concat(startDateNotInPastTest).required("Start date is required"),
497
508
  startTime: yup.string().concat(startTimeCannotBeInPastTest).required("Start time is required")
498
509
  });
@@ -531,9 +542,23 @@ var marketSchema = globalResourceSchema.shape({
531
542
  location: locationSchema,
532
543
  provider: yup2.string().trim().min(3).required("Provider is required"),
533
544
  stallApplicationInfo: yup2.object().shape({
534
- applicationDeadlineHours: yup2.number().min(1).required("Application deadline hours is required"),
545
+ applicationDeadlineHours: yup2.number().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(
546
+ "no-leading-zeros",
547
+ "Application deadline hours must not start with leading zeros",
548
+ (value, context) => {
549
+ const original = context.originalValue?.toString() ?? "";
550
+ return !/^0\d+$/.test(original);
551
+ }
552
+ ),
535
553
  rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
536
- stallCapacity: yup2.number().min(1).required("Stall capacity is required")
554
+ stallCapacity: yup2.number().typeError("Stall capacity must be a number").min(1, "Stall capacity must be at least 1").integer("Stall capacity must be a whole number").required("Stall capacity is required").test(
555
+ "no-leading-zeros",
556
+ "Stall capacity must not have leading zeros",
557
+ (value, context) => {
558
+ const original = context.originalValue?.toString() ?? "";
559
+ return !/^0\d+$/.test(original);
560
+ }
561
+ )
537
562
  }),
538
563
  tags: yup2.array().of(yup2.string().defined()).nullable()
539
564
  });
@@ -607,6 +632,7 @@ var userSchema = yup4.object().shape({
607
632
  firstName: yup4.string().required("First name is required"),
608
633
  lastName: yup4.string().required("Last name is required"),
609
634
  password: passwordSchema,
635
+ preferredRegion: yup4.string().required("Preferred region is required"),
610
636
  // eslint-disable-next-line sort-keys
611
637
  confirmPassword: yup4.string().oneOf([yup4.ref("password")], "Passwords must match").required("Confirm Password is required"),
612
638
  role: yup4.mixed().oneOf(Object.values(EnumUserRole)).required("Role is required")
@@ -623,6 +649,7 @@ var registerSchema = yup5.object().shape({
623
649
  firstName: yup5.string().required("First Name is required"),
624
650
  lastName: yup5.string().required("Last Name is required"),
625
651
  password: passwordSchema,
652
+ preferredRegion: yup5.string().required("Preferred Region is required"),
626
653
  role: yup5.mixed().oneOf(Object.values(EnumUserRole)).required("Role is required")
627
654
  });
628
655
  var requestPasswordResetSchema = yup5.object().shape({
@@ -665,12 +692,14 @@ var defaultMarketFormValues = {
665
692
  {
666
693
  endDate: "04-05-2025",
667
694
  endTime: "15:00",
695
+ marketPrice: 0,
668
696
  startDate: "04-05-2025",
669
697
  startTime: "09:00"
670
698
  },
671
699
  {
672
700
  endDate: "05-05-2025",
673
701
  endTime: "15:00",
702
+ marketPrice: 0,
674
703
  startDate: "05-05-2025",
675
704
  startTime: "09:00"
676
705
  }
@@ -689,9 +718,9 @@ var defaultMarketFormValues = {
689
718
  },
690
719
  provider: "Provider name",
691
720
  stallApplicationInfo: {
692
- applicationDeadlineHours: 72,
721
+ applicationDeadlineHours: 0,
693
722
  rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
694
- stallCapacity: 4
723
+ stallCapacity: 0
695
724
  },
696
725
  tags: null
697
726
  };
@@ -980,6 +1009,7 @@ var defaultValues = {
980
1009
  firstName: "",
981
1010
  lastName: "",
982
1011
  password: "",
1012
+ preferredRegion: "",
983
1013
  role: "customer" /* CUSTOMER */
984
1014
  };
985
1015
  function useUserForm(data) {
@@ -1007,6 +1037,7 @@ function useUserForm(data) {
1007
1037
  firstName: data.firstName,
1008
1038
  lastName: data.lastName,
1009
1039
  password: data.password,
1040
+ preferredRegion: data.preferredRegion,
1010
1041
  role: data.role
1011
1042
  });
1012
1043
  } else {
@@ -1023,6 +1054,7 @@ function useUserForm(data) {
1023
1054
  firstName,
1024
1055
  lastName,
1025
1056
  password,
1057
+ preferredRegion,
1026
1058
  role
1027
1059
  } = getValues();
1028
1060
  return {
@@ -1037,6 +1069,7 @@ function useUserForm(data) {
1037
1069
  firstName,
1038
1070
  lastName,
1039
1071
  password,
1072
+ preferredRegion,
1040
1073
  role
1041
1074
  },
1042
1075
  formState: { errors },
@@ -1090,6 +1123,7 @@ var defaultValues3 = {
1090
1123
  firstName: "",
1091
1124
  lastName: "",
1092
1125
  password: "",
1126
+ preferredRegion: "",
1093
1127
  role: "customer" /* CUSTOMER */
1094
1128
  };
1095
1129
  function useRegisterForm() {
@@ -1105,7 +1139,7 @@ function useRegisterForm() {
1105
1139
  defaultValues: defaultValues3,
1106
1140
  resolver: (0, import_yup6.yupResolver)(registerSchema)
1107
1141
  });
1108
- const { email, firstName, lastName, password, role } = getValues();
1142
+ const { email, firstName, lastName, password, preferredRegion, role } = getValues();
1109
1143
  return {
1110
1144
  control,
1111
1145
  fields: {
@@ -1113,6 +1147,7 @@ function useRegisterForm() {
1113
1147
  firstName,
1114
1148
  lastName,
1115
1149
  password,
1150
+ preferredRegion,
1116
1151
  role
1117
1152
  },
1118
1153
  formState: { errors },
@@ -1277,6 +1312,7 @@ var USER_FIELDS_FRAGMENT = import_client.gql`
1277
1312
  lastName
1278
1313
  licences
1279
1314
  markets
1315
+ preferredRegion
1280
1316
  role
1281
1317
  stallholder
1282
1318
  updatedAt
@@ -1559,6 +1595,7 @@ var MARKET_DATETIME_FIELDS_FRAGMENT = import_client8.gql`
1559
1595
  fragment MarketDateTimeFields on MarketDateTimeType {
1560
1596
  endDate
1561
1597
  endTime
1598
+ marketPrice
1562
1599
  startDate
1563
1600
  startTime
1564
1601
  }
@@ -1982,6 +2019,7 @@ var RELATION_LOGS_FRAGMENT = import_client14.gql`
1982
2019
  var RELATION_DATES_FRAGMENT = import_client14.gql`
1983
2020
  fragment RelationDates on RelationDateType {
1984
2021
  lastUpdateBy
2022
+ marketPrice
1985
2023
  startDate
1986
2024
  status
1987
2025
  }
@@ -2759,9 +2797,7 @@ var availableCityTypes = [
2759
2797
  "Hamilton",
2760
2798
  "Wellington"
2761
2799
  ];
2762
- var availableRegionTypes = Object.values(EnumRegions);
2763
2800
  var availableCityOptions = mapArrayToOptions(availableCityTypes);
2764
- var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
2765
2801
 
2766
2802
  // src/formFields/stallholder/stallholderApplyForm.ts
2767
2803
  var stallholderElectricity = {
@@ -2915,6 +2951,14 @@ var marketStartDateFields = [
2915
2951
  placeholder: "Start Time"
2916
2952
  }
2917
2953
  ];
2954
+ var marketPriceByDateFields = [
2955
+ {
2956
+ helperText: "Market Price for this date *",
2957
+ keyboardType: "number-pad",
2958
+ name: "marketPrice",
2959
+ placeholder: "Market Price"
2960
+ }
2961
+ ];
2918
2962
  var marketEndDateFields = [
2919
2963
  {
2920
2964
  dateMode: "date",
@@ -3413,6 +3457,7 @@ var categoryColors = {
3413
3457
  mapArrayToOptions,
3414
3458
  marketBasicInfoFields,
3415
3459
  marketEndDateFields,
3460
+ marketPriceByDateFields,
3416
3461
  marketSchema,
3417
3462
  marketStartDateFields,
3418
3463
  packagingOptions,
package/dist/index.d.mts CHANGED
@@ -87,6 +87,7 @@ type RegisterFormData = {
87
87
  firstName: string;
88
88
  lastName: string;
89
89
  password: string;
90
+ preferredRegion: string;
90
91
  role: EnumUserRole;
91
92
  };
92
93
  interface CreateRegisterFormData {
@@ -185,6 +186,7 @@ type RelationLog = {
185
186
  };
186
187
  type RelationDate = {
187
188
  lastUpdateBy: string;
189
+ marketPrice: number;
188
190
  startDate: string;
189
191
  status: EnumInviteStatus;
190
192
  };
@@ -200,8 +202,11 @@ interface RelationType {
200
202
  updatedAt?: string;
201
203
  }
202
204
 
205
+ type DateTimeWithPrice = DateTimeType & {
206
+ marketPrice: number;
207
+ };
203
208
  interface MarketFormData extends BaseResourceTypeFormData {
204
- dateTime: DateTimeType[];
209
+ dateTime: DateTimeWithPrice[];
205
210
  location: LocationType;
206
211
  provider: string;
207
212
  stallApplicationInfo: {
@@ -234,23 +239,9 @@ interface MarketWithConnectionDatesType extends MarketType {
234
239
  }
235
240
 
236
241
  type StallholderLocation = {
237
- dateTime: {
238
- startDate?: string | null;
239
- startTime?: string | null;
240
- endDate?: string | null;
241
- endTime?: string | null;
242
- } | null;
242
+ dateTime: Nullable<DateTimeType> | null;
243
243
  description?: string | null;
244
- location: {
245
- city?: string | null;
246
- coordinates?: number[] | null;
247
- country?: string | null;
248
- fullAddress?: string | null;
249
- latitude?: number | null;
250
- longitude?: number | null;
251
- region?: string | null;
252
- type?: "Point" | null;
253
- } | null;
244
+ location: Nullable<LocationType> | null;
254
245
  resourceId?: MapMultiLocation["resourceId"];
255
246
  resourceName?: MapMultiLocation["resourceName"];
256
247
  resourceType?: MapMultiLocation["resourceType"];
@@ -359,6 +350,7 @@ type UserFormData = {
359
350
  firstName: string;
360
351
  lastName: string;
361
352
  password: string;
353
+ preferredRegion: string;
362
354
  role: EnumUserRole;
363
355
  };
364
356
  interface CreateUserFormData {
@@ -387,11 +379,15 @@ interface UserType {
387
379
  licences: EnumUserLicence[] | null;
388
380
  markets: string[] | null;
389
381
  password: string;
382
+ preferredRegion: string;
390
383
  role: EnumUserRole;
391
384
  stallholder: string | null;
392
385
  updatedAt: string;
393
386
  }
394
387
 
388
+ type Nullable<T> = {
389
+ [K in keyof T]: T[K] | null | undefined;
390
+ };
395
391
  type ResourceImageType = {
396
392
  source: string;
397
393
  title: string;
@@ -513,13 +509,10 @@ type DateFormat = "date" | "time" | "datetime";
513
509
  * @returns formatted string based on display option
514
510
  */
515
511
  declare const formatDate: (dateStr: string, display?: DateFormat, timeStr?: string) => string;
516
- declare const getCurrentAndFutureDates: (dates: {
512
+ declare const getCurrentAndFutureDates: <T extends {
517
513
  startDate: string;
518
514
  startTime: string;
519
- }[]) => {
520
- startDate: string;
521
- startTime: string;
522
- }[];
515
+ }>(dates: T[]) => T[];
523
516
  declare const getFutureDatesAfterThreshold: (dates: {
524
517
  startDate: string;
525
518
  startTime: string;
@@ -558,13 +551,12 @@ declare const statusOptions: {
558
551
  * @param dates - The array of date strings to sort.
559
552
  * @returns - The sorted array of date strings.
560
553
  */
561
- declare function sortDatesByProximity(dates: {
554
+ declare function sortDatesByProximity<T extends {
562
555
  startDate: string;
563
556
  startTime: string;
564
- }[]): {
565
- startDate: string;
566
- startTime: string;
567
- }[];
557
+ }>(dates: T[]): T[];
558
+ declare const availableRegionTypes: EnumRegions[];
559
+ declare const availableRegionOptions: OptionItem[];
568
560
 
569
561
  interface PlacePrediction {
570
562
  place_id: string;
@@ -646,11 +638,13 @@ declare const startTimeCannotBeInPastTest: yup.StringSchema<string | undefined,
646
638
  declare const dateTimeSchema: yup.ObjectSchema<{
647
639
  endDate: string;
648
640
  endTime: string;
641
+ marketPrice: number;
649
642
  startDate: string;
650
643
  startTime: string;
651
644
  }, yup.AnyObject, {
652
645
  endDate: undefined;
653
646
  endTime: undefined;
647
+ marketPrice: undefined;
654
648
  startDate: undefined;
655
649
  startTime: undefined;
656
650
  }, "">;
@@ -709,6 +703,7 @@ declare const marketSchema: yup.ObjectSchema<{
709
703
  endTime: string;
710
704
  startDate: string;
711
705
  startTime: string;
706
+ marketPrice: number;
712
707
  }[];
713
708
  location: {
714
709
  region: string;
@@ -851,6 +846,7 @@ declare const userSchema: yup.ObjectSchema<{
851
846
  firstName: string;
852
847
  lastName: string;
853
848
  password: string;
849
+ preferredRegion: string;
854
850
  confirmPassword: string;
855
851
  role: NonNullable<EnumUserRole | undefined>;
856
852
  }, yup.AnyObject, {
@@ -859,6 +855,7 @@ declare const userSchema: yup.ObjectSchema<{
859
855
  firstName: undefined;
860
856
  lastName: undefined;
861
857
  password: undefined;
858
+ preferredRegion: undefined;
862
859
  confirmPassword: undefined;
863
860
  role: undefined;
864
861
  }, "">;
@@ -875,12 +872,14 @@ declare const registerSchema: yup.ObjectSchema<{
875
872
  firstName: string;
876
873
  lastName: string;
877
874
  password: string;
875
+ preferredRegion: string;
878
876
  role: NonNullable<EnumUserRole | undefined>;
879
877
  }, yup.AnyObject, {
880
878
  email: undefined;
881
879
  firstName: undefined;
882
880
  lastName: undefined;
883
881
  password: undefined;
882
+ preferredRegion: undefined;
884
883
  role: undefined;
885
884
  }, "">;
886
885
  declare const requestPasswordResetSchema: yup.ObjectSchema<{
@@ -1197,9 +1196,7 @@ declare const stallholderFullAddress: FormField;
1197
1196
  declare const stallholderStartDateFields: FormDateField[];
1198
1197
  declare const stallholderEndDateFields: FormDateField[];
1199
1198
  declare const stallholderLocationDescription: FormField;
1200
- declare const availableRegionTypes: EnumRegions[];
1201
1199
  declare const availableCityOptions: OptionItem[];
1202
- declare const availableRegionOptions: OptionItem[];
1203
1200
 
1204
1201
  declare const stallholderElectricity: {
1205
1202
  details: FormField;
@@ -1231,6 +1228,7 @@ declare const paymentMethodOptions: OptionItem[];
1231
1228
  declare const marketBasicInfoFields: FormField[];
1232
1229
  declare const stallApplicationInfo: FormField[];
1233
1230
  declare const marketStartDateFields: FormDateField[];
1231
+ declare const marketPriceByDateFields: FormField[];
1234
1232
  declare const marketEndDateFields: FormDateField[];
1235
1233
  declare const availableTagTypes: string[];
1236
1234
  declare const tagOptions: OptionItem[];
@@ -1247,4 +1245,4 @@ declare const profileFields: FormField[];
1247
1245
  declare const availableCategories: Category[];
1248
1246
  declare const categoryColors: Record<string, string>;
1249
1247
 
1250
- export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateValidateTokenFormData, type DateTimeType, EnumInviteStatus, EnumNotification, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type OptionItem, type PlacePrediction, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type ValidateTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketSchema, marketStartDateFields, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, requestPasswordResetFields, requestPasswordResetSchema, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddParticipantToChat, useAddUserFavouriteResource, useCreateChat, useCreateMarket, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteChat, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useGetChat, useGetChatSubscription, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserChats, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchMarkets, useSearchStallholders, useSendChatMessage, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useValidateToken, useValidateTokenForm, userSchema, validateTokenFields, validateTokenSchema };
1248
+ export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateValidateTokenFormData, type DateTimeType, type DateTimeWithPrice, EnumInviteStatus, EnumNotification, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type Nullable, type OptionItem, type PlacePrediction, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type ValidateTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketPriceByDateFields, marketSchema, marketStartDateFields, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, requestPasswordResetFields, requestPasswordResetSchema, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddParticipantToChat, useAddUserFavouriteResource, useCreateChat, useCreateMarket, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteChat, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useGetChat, useGetChatSubscription, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserChats, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchMarkets, useSearchStallholders, useSendChatMessage, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useValidateToken, useValidateTokenForm, userSchema, validateTokenFields, validateTokenSchema };
package/dist/index.d.ts CHANGED
@@ -87,6 +87,7 @@ type RegisterFormData = {
87
87
  firstName: string;
88
88
  lastName: string;
89
89
  password: string;
90
+ preferredRegion: string;
90
91
  role: EnumUserRole;
91
92
  };
92
93
  interface CreateRegisterFormData {
@@ -185,6 +186,7 @@ type RelationLog = {
185
186
  };
186
187
  type RelationDate = {
187
188
  lastUpdateBy: string;
189
+ marketPrice: number;
188
190
  startDate: string;
189
191
  status: EnumInviteStatus;
190
192
  };
@@ -200,8 +202,11 @@ interface RelationType {
200
202
  updatedAt?: string;
201
203
  }
202
204
 
205
+ type DateTimeWithPrice = DateTimeType & {
206
+ marketPrice: number;
207
+ };
203
208
  interface MarketFormData extends BaseResourceTypeFormData {
204
- dateTime: DateTimeType[];
209
+ dateTime: DateTimeWithPrice[];
205
210
  location: LocationType;
206
211
  provider: string;
207
212
  stallApplicationInfo: {
@@ -234,23 +239,9 @@ interface MarketWithConnectionDatesType extends MarketType {
234
239
  }
235
240
 
236
241
  type StallholderLocation = {
237
- dateTime: {
238
- startDate?: string | null;
239
- startTime?: string | null;
240
- endDate?: string | null;
241
- endTime?: string | null;
242
- } | null;
242
+ dateTime: Nullable<DateTimeType> | null;
243
243
  description?: string | null;
244
- location: {
245
- city?: string | null;
246
- coordinates?: number[] | null;
247
- country?: string | null;
248
- fullAddress?: string | null;
249
- latitude?: number | null;
250
- longitude?: number | null;
251
- region?: string | null;
252
- type?: "Point" | null;
253
- } | null;
244
+ location: Nullable<LocationType> | null;
254
245
  resourceId?: MapMultiLocation["resourceId"];
255
246
  resourceName?: MapMultiLocation["resourceName"];
256
247
  resourceType?: MapMultiLocation["resourceType"];
@@ -359,6 +350,7 @@ type UserFormData = {
359
350
  firstName: string;
360
351
  lastName: string;
361
352
  password: string;
353
+ preferredRegion: string;
362
354
  role: EnumUserRole;
363
355
  };
364
356
  interface CreateUserFormData {
@@ -387,11 +379,15 @@ interface UserType {
387
379
  licences: EnumUserLicence[] | null;
388
380
  markets: string[] | null;
389
381
  password: string;
382
+ preferredRegion: string;
390
383
  role: EnumUserRole;
391
384
  stallholder: string | null;
392
385
  updatedAt: string;
393
386
  }
394
387
 
388
+ type Nullable<T> = {
389
+ [K in keyof T]: T[K] | null | undefined;
390
+ };
395
391
  type ResourceImageType = {
396
392
  source: string;
397
393
  title: string;
@@ -513,13 +509,10 @@ type DateFormat = "date" | "time" | "datetime";
513
509
  * @returns formatted string based on display option
514
510
  */
515
511
  declare const formatDate: (dateStr: string, display?: DateFormat, timeStr?: string) => string;
516
- declare const getCurrentAndFutureDates: (dates: {
512
+ declare const getCurrentAndFutureDates: <T extends {
517
513
  startDate: string;
518
514
  startTime: string;
519
- }[]) => {
520
- startDate: string;
521
- startTime: string;
522
- }[];
515
+ }>(dates: T[]) => T[];
523
516
  declare const getFutureDatesAfterThreshold: (dates: {
524
517
  startDate: string;
525
518
  startTime: string;
@@ -558,13 +551,12 @@ declare const statusOptions: {
558
551
  * @param dates - The array of date strings to sort.
559
552
  * @returns - The sorted array of date strings.
560
553
  */
561
- declare function sortDatesByProximity(dates: {
554
+ declare function sortDatesByProximity<T extends {
562
555
  startDate: string;
563
556
  startTime: string;
564
- }[]): {
565
- startDate: string;
566
- startTime: string;
567
- }[];
557
+ }>(dates: T[]): T[];
558
+ declare const availableRegionTypes: EnumRegions[];
559
+ declare const availableRegionOptions: OptionItem[];
568
560
 
569
561
  interface PlacePrediction {
570
562
  place_id: string;
@@ -646,11 +638,13 @@ declare const startTimeCannotBeInPastTest: yup.StringSchema<string | undefined,
646
638
  declare const dateTimeSchema: yup.ObjectSchema<{
647
639
  endDate: string;
648
640
  endTime: string;
641
+ marketPrice: number;
649
642
  startDate: string;
650
643
  startTime: string;
651
644
  }, yup.AnyObject, {
652
645
  endDate: undefined;
653
646
  endTime: undefined;
647
+ marketPrice: undefined;
654
648
  startDate: undefined;
655
649
  startTime: undefined;
656
650
  }, "">;
@@ -709,6 +703,7 @@ declare const marketSchema: yup.ObjectSchema<{
709
703
  endTime: string;
710
704
  startDate: string;
711
705
  startTime: string;
706
+ marketPrice: number;
712
707
  }[];
713
708
  location: {
714
709
  region: string;
@@ -851,6 +846,7 @@ declare const userSchema: yup.ObjectSchema<{
851
846
  firstName: string;
852
847
  lastName: string;
853
848
  password: string;
849
+ preferredRegion: string;
854
850
  confirmPassword: string;
855
851
  role: NonNullable<EnumUserRole | undefined>;
856
852
  }, yup.AnyObject, {
@@ -859,6 +855,7 @@ declare const userSchema: yup.ObjectSchema<{
859
855
  firstName: undefined;
860
856
  lastName: undefined;
861
857
  password: undefined;
858
+ preferredRegion: undefined;
862
859
  confirmPassword: undefined;
863
860
  role: undefined;
864
861
  }, "">;
@@ -875,12 +872,14 @@ declare const registerSchema: yup.ObjectSchema<{
875
872
  firstName: string;
876
873
  lastName: string;
877
874
  password: string;
875
+ preferredRegion: string;
878
876
  role: NonNullable<EnumUserRole | undefined>;
879
877
  }, yup.AnyObject, {
880
878
  email: undefined;
881
879
  firstName: undefined;
882
880
  lastName: undefined;
883
881
  password: undefined;
882
+ preferredRegion: undefined;
884
883
  role: undefined;
885
884
  }, "">;
886
885
  declare const requestPasswordResetSchema: yup.ObjectSchema<{
@@ -1197,9 +1196,7 @@ declare const stallholderFullAddress: FormField;
1197
1196
  declare const stallholderStartDateFields: FormDateField[];
1198
1197
  declare const stallholderEndDateFields: FormDateField[];
1199
1198
  declare const stallholderLocationDescription: FormField;
1200
- declare const availableRegionTypes: EnumRegions[];
1201
1199
  declare const availableCityOptions: OptionItem[];
1202
- declare const availableRegionOptions: OptionItem[];
1203
1200
 
1204
1201
  declare const stallholderElectricity: {
1205
1202
  details: FormField;
@@ -1231,6 +1228,7 @@ declare const paymentMethodOptions: OptionItem[];
1231
1228
  declare const marketBasicInfoFields: FormField[];
1232
1229
  declare const stallApplicationInfo: FormField[];
1233
1230
  declare const marketStartDateFields: FormDateField[];
1231
+ declare const marketPriceByDateFields: FormField[];
1234
1232
  declare const marketEndDateFields: FormDateField[];
1235
1233
  declare const availableTagTypes: string[];
1236
1234
  declare const tagOptions: OptionItem[];
@@ -1247,4 +1245,4 @@ declare const profileFields: FormField[];
1247
1245
  declare const availableCategories: Category[];
1248
1246
  declare const categoryColors: Record<string, string>;
1249
1247
 
1250
- export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateValidateTokenFormData, type DateTimeType, EnumInviteStatus, EnumNotification, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type OptionItem, type PlacePrediction, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type ValidateTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketSchema, marketStartDateFields, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, requestPasswordResetFields, requestPasswordResetSchema, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddParticipantToChat, useAddUserFavouriteResource, useCreateChat, useCreateMarket, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteChat, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useGetChat, useGetChatSubscription, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserChats, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchMarkets, useSearchStallholders, useSendChatMessage, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useValidateToken, useValidateTokenForm, userSchema, validateTokenFields, validateTokenSchema };
1248
+ export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateValidateTokenFormData, type DateTimeType, type DateTimeWithPrice, EnumInviteStatus, EnumNotification, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type Nullable, type OptionItem, type PlacePrediction, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type ValidateTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketPriceByDateFields, marketSchema, marketStartDateFields, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, requestPasswordResetFields, requestPasswordResetSchema, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddParticipantToChat, useAddUserFavouriteResource, useCreateChat, useCreateMarket, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteChat, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useGetChat, useGetChatSubscription, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserChats, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchMarkets, useSearchStallholders, useSendChatMessage, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useValidateToken, useValidateTokenForm, userSchema, validateTokenFields, validateTokenSchema };