@timardex/cluemart-shared 1.0.16 → 1.0.18

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.
Files changed (35) hide show
  1. package/dist/{auth-CdcH8nqw.d.mts → auth-CAeHx-BM.d.mts} +1 -1
  2. package/dist/{auth-TM_XttY3.d.ts → auth-gmfsaSPo.d.ts} +1 -1
  3. package/dist/{chat-NGx5Emrr.d.mts → chat-BUVCf9Tu.d.mts} +1 -1
  4. package/dist/{chat-NGx5Emrr.d.ts → chat-BUVCf9Tu.d.ts} +1 -1
  5. package/dist/formFields/index.cjs +49 -47
  6. package/dist/formFields/index.cjs.map +1 -1
  7. package/dist/formFields/index.d.mts +5 -4
  8. package/dist/formFields/index.d.ts +5 -4
  9. package/dist/formFields/index.mjs +49 -47
  10. package/dist/formFields/index.mjs.map +1 -1
  11. package/dist/{global-B7gB8cvC.d.ts → global-Cj-4jtsW.d.ts} +38 -9
  12. package/dist/{global-B8kYikwQ.d.mts → global-zKCLfUmA.d.mts} +38 -9
  13. package/dist/graphql/index.cjs +96 -16
  14. package/dist/graphql/index.cjs.map +1 -1
  15. package/dist/graphql/index.d.mts +19 -3
  16. package/dist/graphql/index.d.ts +19 -3
  17. package/dist/graphql/index.mjs +93 -16
  18. package/dist/graphql/index.mjs.map +1 -1
  19. package/dist/hooks/index.cjs +164 -82
  20. package/dist/hooks/index.cjs.map +1 -1
  21. package/dist/hooks/index.d.mts +12 -3
  22. package/dist/hooks/index.d.ts +12 -3
  23. package/dist/hooks/index.mjs +162 -82
  24. package/dist/hooks/index.mjs.map +1 -1
  25. package/dist/index.cjs +309 -145
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.mts +66 -11
  28. package/dist/index.d.ts +66 -11
  29. package/dist/index.mjs +304 -145
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/types/index.d.mts +3 -3
  32. package/dist/types/index.d.ts +3 -3
  33. package/dist/utils/index.d.mts +1 -1
  34. package/dist/utils/index.d.ts +1 -1
  35. package/package.json +1 -1
@@ -161,13 +161,15 @@ var startTimeCannotBeInPastTest = yup.string().test(
161
161
  var dateTimeSchema = yup.object().shape({
162
162
  endDate: yup.string().concat(endDateNotInPastTest).concat(endDateAfterStartDateTest).required("End date is required"),
163
163
  endTime: yup.string().concat(endTimeMustBeAfterStartTimeTest).required("End time is required"),
164
+ startDate: yup.string().concat(startDateNotInPastTest).required("Start date is required"),
165
+ startTime: yup.string().concat(startTimeCannotBeInPastTest).required("Start time is required")
166
+ });
167
+ var dateTimeWithPriceSchema = dateTimeSchema.shape({
164
168
  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(
165
169
  "no-leading-zeros",
166
170
  "",
167
171
  noLeadingZeros("Market price", { allowDecimal: true })
168
- ),
169
- startDate: yup.string().concat(startDateNotInPastTest).required("Start date is required"),
170
- startTime: yup.string().concat(startTimeCannotBeInPastTest).required("Start time is required")
172
+ )
171
173
  });
172
174
  var locationSchema = yup.object().shape({
173
175
  city: yup.string().required("City is required"),
@@ -204,46 +206,44 @@ var marketSchema = globalResourceSchema.shape({
204
206
  dateTime: yup2.array().of(dateTimeSchema).required("DateTime is required"),
205
207
  location: locationSchema,
206
208
  provider: yup2.string().trim().min(3).required("Provider is required"),
207
- stallApplicationInfo: yup2.object().shape({
208
- 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(
209
- "no-leading-zeros",
210
- "",
211
- noLeadingZeros("Application deadline hours")
212
- ),
213
- paymentDueHours: yup2.number().typeError("Payment due hours must be a number").min(1, "Payment due hours must be at least 1").required("Payment due hours is required").test("no-leading-zeros", "", noLeadingZeros("Payment due hours")),
214
- paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
215
- paymentTarget: yup2.object().when("paymentMethod", (paymentMethod, schema) => {
216
- const isBankTransfer = paymentMethod.includes(
217
- "bank_transfer" /* BANK_TRANSFER */
218
- );
219
- if (!isBankTransfer) {
220
- return schema.shape({
221
- accountHolderName: yup2.string().notRequired(),
222
- accountNumber: yup2.string().notRequired(),
223
- link: yup2.string().trim().required("Link is required for PayPal/Stripe")
224
- });
225
- } else if (isBankTransfer) {
226
- return schema.shape({
227
- accountHolderName: yup2.string().trim().required("Account holder name is required for bank transfer"),
228
- accountNumber: yup2.string().trim().required("Account number is required for bank transfer").matches(
229
- nzBankAccountRegex,
230
- "Account number must be in format: XX-XXXX-XXXXXXX-XX"
231
- ),
232
- link: yup2.string().notRequired()
233
- });
234
- } else {
235
- return schema.shape({
236
- accountHolderName: yup2.string().notRequired(),
237
- accountNumber: yup2.string().notRequired(),
238
- link: yup2.string().notRequired()
239
- });
240
- }
241
- }),
242
- rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
243
- 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("no-leading-zeros", "", noLeadingZeros("Stall capacity"))
244
- }),
245
209
  tags: yup2.array().of(yup2.string().defined()).nullable()
246
210
  });
211
+ var marketInfoSchema = yup2.object().shape({
212
+ active: yup2.boolean().required("Active is required"),
213
+ 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("no-leading-zeros", "", noLeadingZeros("Application deadline hours")),
214
+ dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
215
+ paymentDueHours: yup2.number().typeError("Payment due hours must be a number").min(1, "Payment due hours must be at least 1").required("Payment due hours is required").test("no-leading-zeros", "", noLeadingZeros("Payment due hours")),
216
+ paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
217
+ paymentTarget: yup2.object().when("paymentMethod", (paymentMethod, schema) => {
218
+ const isBankTransfer = paymentMethod.includes(
219
+ "bank_transfer" /* BANK_TRANSFER */
220
+ );
221
+ if (!isBankTransfer) {
222
+ return schema.shape({
223
+ accountHolderName: yup2.string().notRequired(),
224
+ accountNumber: yup2.string().notRequired(),
225
+ link: yup2.string().trim().required("Link is required for PayPal/Stripe")
226
+ });
227
+ } else if (isBankTransfer) {
228
+ return schema.shape({
229
+ accountHolderName: yup2.string().trim().required("Account holder name is required for bank transfer"),
230
+ accountNumber: yup2.string().trim().required("Account number is required for bank transfer").matches(
231
+ nzBankAccountRegex,
232
+ "Account number must be in format: XX-XXXX-XXXXXXX-XX"
233
+ ),
234
+ link: yup2.string().notRequired()
235
+ });
236
+ } else {
237
+ return schema.shape({
238
+ accountHolderName: yup2.string().notRequired(),
239
+ accountNumber: yup2.string().notRequired(),
240
+ link: yup2.string().notRequired()
241
+ });
242
+ }
243
+ }),
244
+ rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
245
+ 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("no-leading-zeros", "", noLeadingZeros("Stall capacity"))
246
+ });
247
247
 
248
248
  // src/yupSchema/stallholder.ts
249
249
  import * as yup3 from "yup";
@@ -374,14 +374,12 @@ var defaultMarketFormValues = {
374
374
  {
375
375
  endDate: "04-05-2025",
376
376
  endTime: "15:00",
377
- marketPrice: 0,
378
377
  startDate: "04-05-2025",
379
378
  startTime: "09:00"
380
379
  },
381
380
  {
382
381
  endDate: "05-05-2025",
383
382
  endTime: "15:00",
384
- marketPrice: 0,
385
383
  startDate: "05-05-2025",
386
384
  startTime: "09:00"
387
385
  }
@@ -399,19 +397,36 @@ var defaultMarketFormValues = {
399
397
  // Default type for GeoJSON
400
398
  },
401
399
  provider: "Provider name",
402
- stallApplicationInfo: {
403
- applicationDeadlineHours: 0,
404
- paymentDueHours: 0,
405
- paymentMethod: "",
406
- paymentTarget: {
407
- accountHolderName: "",
408
- accountNumber: "",
409
- link: ""
400
+ tags: null
401
+ };
402
+ var defaultMarketInfoFormValues = {
403
+ active: false,
404
+ applicationDeadlineHours: 0,
405
+ dateTime: [
406
+ {
407
+ endDate: "04-05-2025",
408
+ endTime: "15:00",
409
+ marketPrice: 0,
410
+ startDate: "04-05-2025",
411
+ startTime: "09:00"
410
412
  },
411
- rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
412
- stallCapacity: 0
413
+ {
414
+ endDate: "05-05-2025",
415
+ endTime: "15:00",
416
+ marketPrice: 0,
417
+ startDate: "05-05-2025",
418
+ startTime: "09:00"
419
+ }
420
+ ],
421
+ paymentDueHours: 0,
422
+ paymentMethod: "",
423
+ paymentTarget: {
424
+ accountHolderName: "",
425
+ accountNumber: "",
426
+ link: ""
413
427
  },
414
- tags: null
428
+ rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
429
+ stallCapacity: 0
415
430
  };
416
431
  var defaultStallholderFormValues = {
417
432
  ...globalDefaultValues,
@@ -597,7 +612,7 @@ function useStallholderApplyForm(data) {
597
612
  };
598
613
  }
599
614
 
600
- // src/hooks/useMarketForm.ts
615
+ // src/hooks/market/useMarketForm.ts
601
616
  import { yupResolver as yupResolver3 } from "@hookform/resolvers/yup";
602
617
  import * as React3 from "react";
603
618
  import { useForm as useForm3 } from "react-hook-form";
@@ -632,7 +647,6 @@ function useMarketForm(data) {
632
647
  promoCode: data.promoCode,
633
648
  provider: data.provider,
634
649
  region: data.region,
635
- stallApplicationInfo: data.stallApplicationInfo,
636
650
  tags: data.tags
637
651
  });
638
652
  } else {
@@ -654,7 +668,6 @@ function useMarketForm(data) {
654
668
  name,
655
669
  provider,
656
670
  region,
657
- stallApplicationInfo,
658
671
  tags
659
672
  } = getValues();
660
673
  return {
@@ -674,7 +687,6 @@ function useMarketForm(data) {
674
687
  name,
675
688
  provider,
676
689
  region,
677
- stallApplicationInfo,
678
690
  tags
679
691
  },
680
692
  formState: { errors },
@@ -685,10 +697,76 @@ function useMarketForm(data) {
685
697
  };
686
698
  }
687
699
 
688
- // src/hooks/useUserForm.ts
700
+ // src/hooks/market/useMarketInfoForm.ts
689
701
  import { yupResolver as yupResolver4 } from "@hookform/resolvers/yup";
690
702
  import * as React4 from "react";
691
703
  import { useForm as useForm4 } from "react-hook-form";
704
+ function useMarketInfoForm(data) {
705
+ const {
706
+ control,
707
+ formState: { errors },
708
+ getValues,
709
+ handleSubmit,
710
+ reset,
711
+ setValue,
712
+ watch
713
+ } = useForm4({
714
+ defaultValues: defaultMarketInfoFormValues,
715
+ resolver: yupResolver4(marketInfoSchema)
716
+ });
717
+ React4.useEffect(() => {
718
+ if (data) {
719
+ reset({
720
+ _id: data._id,
721
+ active: data.active,
722
+ applicationDeadlineHours: data.applicationDeadlineHours,
723
+ dateTime: data.dateTime,
724
+ paymentDueHours: data.paymentDueHours,
725
+ paymentMethod: data.paymentMethod,
726
+ paymentTarget: data.paymentTarget,
727
+ rejectionPolicy: data.rejectionPolicy,
728
+ stallCapacity: data.stallCapacity
729
+ });
730
+ } else {
731
+ reset(defaultMarketInfoFormValues);
732
+ }
733
+ }, [data]);
734
+ const {
735
+ _id,
736
+ active,
737
+ applicationDeadlineHours,
738
+ dateTime,
739
+ paymentDueHours,
740
+ paymentMethod,
741
+ paymentTarget,
742
+ rejectionPolicy,
743
+ stallCapacity
744
+ } = getValues();
745
+ return {
746
+ control,
747
+ fields: {
748
+ _id,
749
+ active,
750
+ applicationDeadlineHours,
751
+ dateTime,
752
+ paymentDueHours,
753
+ paymentMethod,
754
+ paymentTarget,
755
+ rejectionPolicy,
756
+ stallCapacity
757
+ },
758
+ formState: { errors },
759
+ handleSubmit,
760
+ reset,
761
+ setValue,
762
+ watch
763
+ };
764
+ }
765
+
766
+ // src/hooks/useUserForm.ts
767
+ import { yupResolver as yupResolver5 } from "@hookform/resolvers/yup";
768
+ import * as React5 from "react";
769
+ import { useForm as useForm5 } from "react-hook-form";
692
770
  var defaultValues = {
693
771
  active: false,
694
772
  avatar: null,
@@ -710,11 +788,11 @@ function useUserForm(data) {
710
788
  reset,
711
789
  setValue,
712
790
  watch
713
- } = useForm4({
791
+ } = useForm5({
714
792
  defaultValues,
715
- resolver: yupResolver4(userSchema)
793
+ resolver: yupResolver5(userSchema)
716
794
  });
717
- React4.useEffect(() => {
795
+ React5.useEffect(() => {
718
796
  if (data) {
719
797
  reset({
720
798
  _id: data._id,
@@ -770,8 +848,8 @@ function useUserForm(data) {
770
848
  }
771
849
 
772
850
  // src/hooks/auth/useLoginForm.ts
773
- import { yupResolver as yupResolver5 } from "@hookform/resolvers/yup";
774
- import { useForm as useForm5 } from "react-hook-form";
851
+ import { yupResolver as yupResolver6 } from "@hookform/resolvers/yup";
852
+ import { useForm as useForm6 } from "react-hook-form";
775
853
  var defaultValues2 = {
776
854
  email: "",
777
855
  password: ""
@@ -785,9 +863,9 @@ function useLoginForm() {
785
863
  reset,
786
864
  setValue,
787
865
  watch
788
- } = useForm5({
866
+ } = useForm6({
789
867
  defaultValues: defaultValues2,
790
- resolver: yupResolver5(loginSchema)
868
+ resolver: yupResolver6(loginSchema)
791
869
  });
792
870
  const { email, password } = getValues();
793
871
  return {
@@ -805,8 +883,8 @@ function useLoginForm() {
805
883
  }
806
884
 
807
885
  // src/hooks/auth/useRegisterForm.ts
808
- import { yupResolver as yupResolver6 } from "@hookform/resolvers/yup";
809
- import { useForm as useForm6 } from "react-hook-form";
886
+ import { yupResolver as yupResolver7 } from "@hookform/resolvers/yup";
887
+ import { useForm as useForm7 } from "react-hook-form";
810
888
  var defaultValues3 = {
811
889
  email: "",
812
890
  firstName: "",
@@ -824,9 +902,9 @@ function useRegisterForm() {
824
902
  reset,
825
903
  setValue,
826
904
  watch
827
- } = useForm6({
905
+ } = useForm7({
828
906
  defaultValues: defaultValues3,
829
- resolver: yupResolver6(registerSchema)
907
+ resolver: yupResolver7(registerSchema)
830
908
  });
831
909
  const { email, firstName, lastName, password, preferredRegion, role } = getValues();
832
910
  return {
@@ -848,8 +926,8 @@ function useRegisterForm() {
848
926
  }
849
927
 
850
928
  // src/hooks/auth/useRequestPasswordResetForm.ts
851
- import { yupResolver as yupResolver7 } from "@hookform/resolvers/yup";
852
- import { useForm as useForm7 } from "react-hook-form";
929
+ import { yupResolver as yupResolver8 } from "@hookform/resolvers/yup";
930
+ import { useForm as useForm8 } from "react-hook-form";
853
931
  var defaultValues4 = {
854
932
  email: ""
855
933
  };
@@ -862,9 +940,9 @@ function useRequestPasswordResetForm() {
862
940
  reset,
863
941
  setValue,
864
942
  watch
865
- } = useForm7({
943
+ } = useForm8({
866
944
  defaultValues: defaultValues4,
867
- resolver: yupResolver7(requestPasswordResetSchema)
945
+ resolver: yupResolver8(requestPasswordResetSchema)
868
946
  });
869
947
  const { email } = getValues();
870
948
  return {
@@ -881,8 +959,8 @@ function useRequestPasswordResetForm() {
881
959
  }
882
960
 
883
961
  // src/hooks/auth/useValidateTokenForm.ts
884
- import { yupResolver as yupResolver8 } from "@hookform/resolvers/yup";
885
- import { useForm as useForm8 } from "react-hook-form";
962
+ import { yupResolver as yupResolver9 } from "@hookform/resolvers/yup";
963
+ import { useForm as useForm9 } from "react-hook-form";
886
964
  var defaultValues5 = {
887
965
  email: "",
888
966
  token: ""
@@ -896,9 +974,9 @@ function useValidateTokenForm() {
896
974
  reset,
897
975
  setValue,
898
976
  watch
899
- } = useForm8({
977
+ } = useForm9({
900
978
  defaultValues: defaultValues5,
901
- resolver: yupResolver8(validateTokenSchema)
979
+ resolver: yupResolver9(validateTokenSchema)
902
980
  });
903
981
  const { email, token } = getValues();
904
982
  return {
@@ -916,8 +994,8 @@ function useValidateTokenForm() {
916
994
  }
917
995
 
918
996
  // src/hooks/auth/useResetPasswordForm.ts
919
- import { yupResolver as yupResolver9 } from "@hookform/resolvers/yup";
920
- import { useForm as useForm9 } from "react-hook-form";
997
+ import { yupResolver as yupResolver10 } from "@hookform/resolvers/yup";
998
+ import { useForm as useForm10 } from "react-hook-form";
921
999
  var defaultValues6 = {
922
1000
  confirmPassword: "",
923
1001
  email: "",
@@ -932,9 +1010,9 @@ function useResetPasswordForm() {
932
1010
  reset,
933
1011
  setValue,
934
1012
  watch
935
- } = useForm9({
1013
+ } = useForm10({
936
1014
  defaultValues: defaultValues6,
937
- resolver: yupResolver9(resetPasswordSchema)
1015
+ resolver: yupResolver10(resetPasswordSchema)
938
1016
  });
939
1017
  const { confirmPassword, email, password } = getValues();
940
1018
  return {
@@ -953,12 +1031,14 @@ function useResetPasswordForm() {
953
1031
  }
954
1032
  export {
955
1033
  defaultMarketFormValues,
1034
+ defaultMarketInfoFormValues,
956
1035
  defaultStallholderApplyFormValues,
957
1036
  defaultStallholderFormValues,
958
1037
  globalDefaultValues,
959
1038
  useLocationSearch,
960
1039
  useLoginForm,
961
1040
  useMarketForm,
1041
+ useMarketInfoForm,
962
1042
  useRegisterForm,
963
1043
  useRequestPasswordResetForm,
964
1044
  useResetPasswordForm,