@timardex/cluemart-shared 1.0.16 → 1.0.17
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/{auth-CdcH8nqw.d.mts → auth-CAeHx-BM.d.mts} +1 -1
- package/dist/{auth-TM_XttY3.d.ts → auth-gmfsaSPo.d.ts} +1 -1
- package/dist/{chat-NGx5Emrr.d.mts → chat-BUVCf9Tu.d.mts} +1 -1
- package/dist/{chat-NGx5Emrr.d.ts → chat-BUVCf9Tu.d.ts} +1 -1
- package/dist/formFields/index.cjs +49 -47
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +5 -4
- package/dist/formFields/index.d.ts +5 -4
- package/dist/formFields/index.mjs +49 -47
- package/dist/formFields/index.mjs.map +1 -1
- package/dist/{global-B8kYikwQ.d.mts → global-B6OE9jjE.d.mts} +20 -9
- package/dist/{global-B7gB8cvC.d.ts → global-Diphaotm.d.ts} +20 -9
- package/dist/graphql/index.cjs +94 -16
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +19 -3
- package/dist/graphql/index.d.ts +19 -3
- package/dist/graphql/index.mjs +91 -16
- package/dist/graphql/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +159 -82
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +12 -3
- package/dist/hooks/index.d.ts +12 -3
- package/dist/hooks/index.mjs +157 -82
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +302 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +48 -11
- package/dist/index.d.ts +48 -11
- package/dist/index.mjs +297 -145
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -347,13 +347,15 @@ var startTimeCannotBeInPastTest = yup.string().test(
|
|
|
347
347
|
var dateTimeSchema = yup.object().shape({
|
|
348
348
|
endDate: yup.string().concat(endDateNotInPastTest).concat(endDateAfterStartDateTest).required("End date is required"),
|
|
349
349
|
endTime: yup.string().concat(endTimeMustBeAfterStartTimeTest).required("End time is required"),
|
|
350
|
+
startDate: yup.string().concat(startDateNotInPastTest).required("Start date is required"),
|
|
351
|
+
startTime: yup.string().concat(startTimeCannotBeInPastTest).required("Start time is required")
|
|
352
|
+
});
|
|
353
|
+
var dateTimeWithPriceSchema = dateTimeSchema.shape({
|
|
350
354
|
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(
|
|
351
355
|
"no-leading-zeros",
|
|
352
356
|
"",
|
|
353
357
|
noLeadingZeros("Market price", { allowDecimal: true })
|
|
354
|
-
)
|
|
355
|
-
startDate: yup.string().concat(startDateNotInPastTest).required("Start date is required"),
|
|
356
|
-
startTime: yup.string().concat(startTimeCannotBeInPastTest).required("Start time is required")
|
|
358
|
+
)
|
|
357
359
|
});
|
|
358
360
|
var locationSchema = yup.object().shape({
|
|
359
361
|
city: yup.string().required("City is required"),
|
|
@@ -390,46 +392,43 @@ var marketSchema = globalResourceSchema.shape({
|
|
|
390
392
|
dateTime: yup2.array().of(dateTimeSchema).required("DateTime is required"),
|
|
391
393
|
location: locationSchema,
|
|
392
394
|
provider: yup2.string().trim().min(3).required("Provider is required"),
|
|
393
|
-
stallApplicationInfo: yup2.object().shape({
|
|
394
|
-
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(
|
|
395
|
-
"no-leading-zeros",
|
|
396
|
-
"",
|
|
397
|
-
noLeadingZeros("Application deadline hours")
|
|
398
|
-
),
|
|
399
|
-
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")),
|
|
400
|
-
paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
|
|
401
|
-
paymentTarget: yup2.object().when("paymentMethod", (paymentMethod, schema) => {
|
|
402
|
-
const isBankTransfer = paymentMethod.includes(
|
|
403
|
-
"bank_transfer" /* BANK_TRANSFER */
|
|
404
|
-
);
|
|
405
|
-
if (!isBankTransfer) {
|
|
406
|
-
return schema.shape({
|
|
407
|
-
accountHolderName: yup2.string().notRequired(),
|
|
408
|
-
accountNumber: yup2.string().notRequired(),
|
|
409
|
-
link: yup2.string().trim().required("Link is required for PayPal/Stripe")
|
|
410
|
-
});
|
|
411
|
-
} else if (isBankTransfer) {
|
|
412
|
-
return schema.shape({
|
|
413
|
-
accountHolderName: yup2.string().trim().required("Account holder name is required for bank transfer"),
|
|
414
|
-
accountNumber: yup2.string().trim().required("Account number is required for bank transfer").matches(
|
|
415
|
-
nzBankAccountRegex,
|
|
416
|
-
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
417
|
-
),
|
|
418
|
-
link: yup2.string().notRequired()
|
|
419
|
-
});
|
|
420
|
-
} else {
|
|
421
|
-
return schema.shape({
|
|
422
|
-
accountHolderName: yup2.string().notRequired(),
|
|
423
|
-
accountNumber: yup2.string().notRequired(),
|
|
424
|
-
link: yup2.string().notRequired()
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
}),
|
|
428
|
-
rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
|
|
429
|
-
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"))
|
|
430
|
-
}),
|
|
431
395
|
tags: yup2.array().of(yup2.string().defined()).nullable()
|
|
432
396
|
});
|
|
397
|
+
var marketInfoSchema = yup2.object().shape({
|
|
398
|
+
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")),
|
|
399
|
+
dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
|
|
400
|
+
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")),
|
|
401
|
+
paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
|
|
402
|
+
paymentTarget: yup2.object().when("paymentMethod", (paymentMethod, schema) => {
|
|
403
|
+
const isBankTransfer = paymentMethod.includes(
|
|
404
|
+
"bank_transfer" /* BANK_TRANSFER */
|
|
405
|
+
);
|
|
406
|
+
if (!isBankTransfer) {
|
|
407
|
+
return schema.shape({
|
|
408
|
+
accountHolderName: yup2.string().notRequired(),
|
|
409
|
+
accountNumber: yup2.string().notRequired(),
|
|
410
|
+
link: yup2.string().trim().required("Link is required for PayPal/Stripe")
|
|
411
|
+
});
|
|
412
|
+
} else if (isBankTransfer) {
|
|
413
|
+
return schema.shape({
|
|
414
|
+
accountHolderName: yup2.string().trim().required("Account holder name is required for bank transfer"),
|
|
415
|
+
accountNumber: yup2.string().trim().required("Account number is required for bank transfer").matches(
|
|
416
|
+
nzBankAccountRegex,
|
|
417
|
+
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
418
|
+
),
|
|
419
|
+
link: yup2.string().notRequired()
|
|
420
|
+
});
|
|
421
|
+
} else {
|
|
422
|
+
return schema.shape({
|
|
423
|
+
accountHolderName: yup2.string().notRequired(),
|
|
424
|
+
accountNumber: yup2.string().notRequired(),
|
|
425
|
+
link: yup2.string().notRequired()
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}),
|
|
429
|
+
rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
|
|
430
|
+
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"))
|
|
431
|
+
});
|
|
433
432
|
|
|
434
433
|
// src/yupSchema/stallholder.ts
|
|
435
434
|
import * as yup3 from "yup";
|
|
@@ -560,14 +559,12 @@ var defaultMarketFormValues = {
|
|
|
560
559
|
{
|
|
561
560
|
endDate: "04-05-2025",
|
|
562
561
|
endTime: "15:00",
|
|
563
|
-
marketPrice: 0,
|
|
564
562
|
startDate: "04-05-2025",
|
|
565
563
|
startTime: "09:00"
|
|
566
564
|
},
|
|
567
565
|
{
|
|
568
566
|
endDate: "05-05-2025",
|
|
569
567
|
endTime: "15:00",
|
|
570
|
-
marketPrice: 0,
|
|
571
568
|
startDate: "05-05-2025",
|
|
572
569
|
startTime: "09:00"
|
|
573
570
|
}
|
|
@@ -585,19 +582,35 @@ var defaultMarketFormValues = {
|
|
|
585
582
|
// Default type for GeoJSON
|
|
586
583
|
},
|
|
587
584
|
provider: "Provider name",
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
585
|
+
tags: null
|
|
586
|
+
};
|
|
587
|
+
var defaultMarketInfoFormValues = {
|
|
588
|
+
applicationDeadlineHours: 0,
|
|
589
|
+
dateTime: [
|
|
590
|
+
{
|
|
591
|
+
endDate: "04-05-2025",
|
|
592
|
+
endTime: "15:00",
|
|
593
|
+
marketPrice: 0,
|
|
594
|
+
startDate: "04-05-2025",
|
|
595
|
+
startTime: "09:00"
|
|
596
596
|
},
|
|
597
|
-
|
|
598
|
-
|
|
597
|
+
{
|
|
598
|
+
endDate: "05-05-2025",
|
|
599
|
+
endTime: "15:00",
|
|
600
|
+
marketPrice: 0,
|
|
601
|
+
startDate: "05-05-2025",
|
|
602
|
+
startTime: "09:00"
|
|
603
|
+
}
|
|
604
|
+
],
|
|
605
|
+
paymentDueHours: 0,
|
|
606
|
+
paymentMethod: "",
|
|
607
|
+
paymentTarget: {
|
|
608
|
+
accountHolderName: "",
|
|
609
|
+
accountNumber: "",
|
|
610
|
+
link: ""
|
|
599
611
|
},
|
|
600
|
-
|
|
612
|
+
rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
|
|
613
|
+
stallCapacity: 0
|
|
601
614
|
};
|
|
602
615
|
var defaultStallholderFormValues = {
|
|
603
616
|
...globalDefaultValues,
|
|
@@ -783,7 +796,7 @@ function useStallholderApplyForm(data) {
|
|
|
783
796
|
};
|
|
784
797
|
}
|
|
785
798
|
|
|
786
|
-
// src/hooks/useMarketForm.ts
|
|
799
|
+
// src/hooks/market/useMarketForm.ts
|
|
787
800
|
import { yupResolver as yupResolver3 } from "@hookform/resolvers/yup";
|
|
788
801
|
import * as React3 from "react";
|
|
789
802
|
import { useForm as useForm3 } from "react-hook-form";
|
|
@@ -818,7 +831,6 @@ function useMarketForm(data) {
|
|
|
818
831
|
promoCode: data.promoCode,
|
|
819
832
|
provider: data.provider,
|
|
820
833
|
region: data.region,
|
|
821
|
-
stallApplicationInfo: data.stallApplicationInfo,
|
|
822
834
|
tags: data.tags
|
|
823
835
|
});
|
|
824
836
|
} else {
|
|
@@ -840,7 +852,6 @@ function useMarketForm(data) {
|
|
|
840
852
|
name,
|
|
841
853
|
provider,
|
|
842
854
|
region,
|
|
843
|
-
stallApplicationInfo: stallApplicationInfo2,
|
|
844
855
|
tags
|
|
845
856
|
} = getValues();
|
|
846
857
|
return {
|
|
@@ -860,7 +871,6 @@ function useMarketForm(data) {
|
|
|
860
871
|
name,
|
|
861
872
|
provider,
|
|
862
873
|
region,
|
|
863
|
-
stallApplicationInfo: stallApplicationInfo2,
|
|
864
874
|
tags
|
|
865
875
|
},
|
|
866
876
|
formState: { errors },
|
|
@@ -871,10 +881,73 @@ function useMarketForm(data) {
|
|
|
871
881
|
};
|
|
872
882
|
}
|
|
873
883
|
|
|
874
|
-
// src/hooks/
|
|
884
|
+
// src/hooks/market/useMarketInfoForm.ts
|
|
875
885
|
import { yupResolver as yupResolver4 } from "@hookform/resolvers/yup";
|
|
876
886
|
import * as React4 from "react";
|
|
877
887
|
import { useForm as useForm4 } from "react-hook-form";
|
|
888
|
+
function useMarketInfoForm(data) {
|
|
889
|
+
const {
|
|
890
|
+
control,
|
|
891
|
+
formState: { errors },
|
|
892
|
+
getValues,
|
|
893
|
+
handleSubmit,
|
|
894
|
+
reset,
|
|
895
|
+
setValue,
|
|
896
|
+
watch
|
|
897
|
+
} = useForm4({
|
|
898
|
+
defaultValues: defaultMarketInfoFormValues,
|
|
899
|
+
resolver: yupResolver4(marketInfoSchema)
|
|
900
|
+
});
|
|
901
|
+
React4.useEffect(() => {
|
|
902
|
+
if (data) {
|
|
903
|
+
reset({
|
|
904
|
+
_id: data._id,
|
|
905
|
+
applicationDeadlineHours: data.applicationDeadlineHours,
|
|
906
|
+
dateTime: data.dateTime,
|
|
907
|
+
paymentDueHours: data.paymentDueHours,
|
|
908
|
+
paymentMethod: data.paymentMethod,
|
|
909
|
+
paymentTarget: data.paymentTarget,
|
|
910
|
+
rejectionPolicy: data.rejectionPolicy,
|
|
911
|
+
stallCapacity: data.stallCapacity
|
|
912
|
+
});
|
|
913
|
+
} else {
|
|
914
|
+
reset(defaultMarketInfoFormValues);
|
|
915
|
+
}
|
|
916
|
+
}, [data]);
|
|
917
|
+
const {
|
|
918
|
+
_id,
|
|
919
|
+
applicationDeadlineHours,
|
|
920
|
+
dateTime,
|
|
921
|
+
paymentDueHours,
|
|
922
|
+
paymentMethod,
|
|
923
|
+
paymentTarget,
|
|
924
|
+
rejectionPolicy,
|
|
925
|
+
stallCapacity
|
|
926
|
+
} = getValues();
|
|
927
|
+
return {
|
|
928
|
+
control,
|
|
929
|
+
fields: {
|
|
930
|
+
_id,
|
|
931
|
+
applicationDeadlineHours,
|
|
932
|
+
dateTime,
|
|
933
|
+
paymentDueHours,
|
|
934
|
+
paymentMethod,
|
|
935
|
+
paymentTarget,
|
|
936
|
+
rejectionPolicy,
|
|
937
|
+
stallCapacity
|
|
938
|
+
},
|
|
939
|
+
formState: { errors },
|
|
940
|
+
handleSubmit,
|
|
941
|
+
reset,
|
|
942
|
+
setValue,
|
|
943
|
+
watch
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
// src/hooks/useUserForm.ts
|
|
948
|
+
import { yupResolver as yupResolver5 } from "@hookform/resolvers/yup";
|
|
949
|
+
import * as React5 from "react";
|
|
950
|
+
import { useForm as useForm5 } from "react-hook-form";
|
|
878
951
|
var defaultValues = {
|
|
879
952
|
active: false,
|
|
880
953
|
avatar: null,
|
|
@@ -896,11 +969,11 @@ function useUserForm(data) {
|
|
|
896
969
|
reset,
|
|
897
970
|
setValue,
|
|
898
971
|
watch
|
|
899
|
-
} =
|
|
972
|
+
} = useForm5({
|
|
900
973
|
defaultValues,
|
|
901
|
-
resolver:
|
|
974
|
+
resolver: yupResolver5(userSchema)
|
|
902
975
|
});
|
|
903
|
-
|
|
976
|
+
React5.useEffect(() => {
|
|
904
977
|
if (data) {
|
|
905
978
|
reset({
|
|
906
979
|
_id: data._id,
|
|
@@ -956,8 +1029,8 @@ function useUserForm(data) {
|
|
|
956
1029
|
}
|
|
957
1030
|
|
|
958
1031
|
// src/hooks/auth/useLoginForm.ts
|
|
959
|
-
import { yupResolver as
|
|
960
|
-
import { useForm as
|
|
1032
|
+
import { yupResolver as yupResolver6 } from "@hookform/resolvers/yup";
|
|
1033
|
+
import { useForm as useForm6 } from "react-hook-form";
|
|
961
1034
|
var defaultValues2 = {
|
|
962
1035
|
email: "",
|
|
963
1036
|
password: ""
|
|
@@ -971,9 +1044,9 @@ function useLoginForm() {
|
|
|
971
1044
|
reset,
|
|
972
1045
|
setValue,
|
|
973
1046
|
watch
|
|
974
|
-
} =
|
|
1047
|
+
} = useForm6({
|
|
975
1048
|
defaultValues: defaultValues2,
|
|
976
|
-
resolver:
|
|
1049
|
+
resolver: yupResolver6(loginSchema)
|
|
977
1050
|
});
|
|
978
1051
|
const { email, password } = getValues();
|
|
979
1052
|
return {
|
|
@@ -991,8 +1064,8 @@ function useLoginForm() {
|
|
|
991
1064
|
}
|
|
992
1065
|
|
|
993
1066
|
// src/hooks/auth/useRegisterForm.ts
|
|
994
|
-
import { yupResolver as
|
|
995
|
-
import { useForm as
|
|
1067
|
+
import { yupResolver as yupResolver7 } from "@hookform/resolvers/yup";
|
|
1068
|
+
import { useForm as useForm7 } from "react-hook-form";
|
|
996
1069
|
var defaultValues3 = {
|
|
997
1070
|
email: "",
|
|
998
1071
|
firstName: "",
|
|
@@ -1010,9 +1083,9 @@ function useRegisterForm() {
|
|
|
1010
1083
|
reset,
|
|
1011
1084
|
setValue,
|
|
1012
1085
|
watch
|
|
1013
|
-
} =
|
|
1086
|
+
} = useForm7({
|
|
1014
1087
|
defaultValues: defaultValues3,
|
|
1015
|
-
resolver:
|
|
1088
|
+
resolver: yupResolver7(registerSchema)
|
|
1016
1089
|
});
|
|
1017
1090
|
const { email, firstName, lastName, password, preferredRegion, role } = getValues();
|
|
1018
1091
|
return {
|
|
@@ -1034,8 +1107,8 @@ function useRegisterForm() {
|
|
|
1034
1107
|
}
|
|
1035
1108
|
|
|
1036
1109
|
// src/hooks/auth/useRequestPasswordResetForm.ts
|
|
1037
|
-
import { yupResolver as
|
|
1038
|
-
import { useForm as
|
|
1110
|
+
import { yupResolver as yupResolver8 } from "@hookform/resolvers/yup";
|
|
1111
|
+
import { useForm as useForm8 } from "react-hook-form";
|
|
1039
1112
|
var defaultValues4 = {
|
|
1040
1113
|
email: ""
|
|
1041
1114
|
};
|
|
@@ -1048,9 +1121,9 @@ function useRequestPasswordResetForm() {
|
|
|
1048
1121
|
reset,
|
|
1049
1122
|
setValue,
|
|
1050
1123
|
watch
|
|
1051
|
-
} =
|
|
1124
|
+
} = useForm8({
|
|
1052
1125
|
defaultValues: defaultValues4,
|
|
1053
|
-
resolver:
|
|
1126
|
+
resolver: yupResolver8(requestPasswordResetSchema)
|
|
1054
1127
|
});
|
|
1055
1128
|
const { email } = getValues();
|
|
1056
1129
|
return {
|
|
@@ -1067,8 +1140,8 @@ function useRequestPasswordResetForm() {
|
|
|
1067
1140
|
}
|
|
1068
1141
|
|
|
1069
1142
|
// src/hooks/auth/useValidateTokenForm.ts
|
|
1070
|
-
import { yupResolver as
|
|
1071
|
-
import { useForm as
|
|
1143
|
+
import { yupResolver as yupResolver9 } from "@hookform/resolvers/yup";
|
|
1144
|
+
import { useForm as useForm9 } from "react-hook-form";
|
|
1072
1145
|
var defaultValues5 = {
|
|
1073
1146
|
email: "",
|
|
1074
1147
|
token: ""
|
|
@@ -1082,9 +1155,9 @@ function useValidateTokenForm() {
|
|
|
1082
1155
|
reset,
|
|
1083
1156
|
setValue,
|
|
1084
1157
|
watch
|
|
1085
|
-
} =
|
|
1158
|
+
} = useForm9({
|
|
1086
1159
|
defaultValues: defaultValues5,
|
|
1087
|
-
resolver:
|
|
1160
|
+
resolver: yupResolver9(validateTokenSchema)
|
|
1088
1161
|
});
|
|
1089
1162
|
const { email, token } = getValues();
|
|
1090
1163
|
return {
|
|
@@ -1102,8 +1175,8 @@ function useValidateTokenForm() {
|
|
|
1102
1175
|
}
|
|
1103
1176
|
|
|
1104
1177
|
// src/hooks/auth/useResetPasswordForm.ts
|
|
1105
|
-
import { yupResolver as
|
|
1106
|
-
import { useForm as
|
|
1178
|
+
import { yupResolver as yupResolver10 } from "@hookform/resolvers/yup";
|
|
1179
|
+
import { useForm as useForm10 } from "react-hook-form";
|
|
1107
1180
|
var defaultValues6 = {
|
|
1108
1181
|
confirmPassword: "",
|
|
1109
1182
|
email: "",
|
|
@@ -1118,9 +1191,9 @@ function useResetPasswordForm() {
|
|
|
1118
1191
|
reset,
|
|
1119
1192
|
setValue,
|
|
1120
1193
|
watch
|
|
1121
|
-
} =
|
|
1194
|
+
} = useForm10({
|
|
1122
1195
|
defaultValues: defaultValues6,
|
|
1123
|
-
resolver:
|
|
1196
|
+
resolver: yupResolver10(resetPasswordSchema)
|
|
1124
1197
|
});
|
|
1125
1198
|
const { confirmPassword, email, password } = getValues();
|
|
1126
1199
|
return {
|
|
@@ -1470,7 +1543,6 @@ var MARKET_DATETIME_FIELDS_FRAGMENT = gql5`
|
|
|
1470
1543
|
fragment MarketDateTimeFields on MarketDateTimeType {
|
|
1471
1544
|
endDate
|
|
1472
1545
|
endTime
|
|
1473
|
-
marketPrice
|
|
1474
1546
|
startDate
|
|
1475
1547
|
startTime
|
|
1476
1548
|
}
|
|
@@ -1487,25 +1559,27 @@ var MARKET_LOCATION_FIELDS_FRAGMENT = gql5`
|
|
|
1487
1559
|
type
|
|
1488
1560
|
}
|
|
1489
1561
|
`;
|
|
1490
|
-
var
|
|
1491
|
-
fragment
|
|
1492
|
-
|
|
1493
|
-
accountNumber
|
|
1494
|
-
link
|
|
1495
|
-
}
|
|
1496
|
-
`;
|
|
1497
|
-
var STALL_APPLICATION_INFO_FIELDS_FRAGMENT = gql5`
|
|
1498
|
-
fragment StallApplicationInfoFields on StallApplicationInfoType {
|
|
1562
|
+
var MARKET_INFO = gql5`
|
|
1563
|
+
fragment MarketInfoFields on MarketInfoType {
|
|
1564
|
+
_id
|
|
1499
1565
|
applicationDeadlineHours
|
|
1566
|
+
dateTime {
|
|
1567
|
+
endDate
|
|
1568
|
+
endTime
|
|
1569
|
+
marketPrice
|
|
1570
|
+
startDate
|
|
1571
|
+
startTime
|
|
1572
|
+
}
|
|
1500
1573
|
paymentDueHours
|
|
1501
1574
|
paymentMethod
|
|
1502
1575
|
paymentTarget {
|
|
1503
|
-
|
|
1576
|
+
accountHolderName
|
|
1577
|
+
accountNumber
|
|
1578
|
+
link
|
|
1504
1579
|
}
|
|
1505
1580
|
rejectionPolicy
|
|
1506
1581
|
stallCapacity
|
|
1507
1582
|
}
|
|
1508
|
-
${PAYMENT_TARGET_FIELDS_FRAGMENT}
|
|
1509
1583
|
`;
|
|
1510
1584
|
var MARKET = gql5`
|
|
1511
1585
|
fragment MarketFields on MarketType {
|
|
@@ -1536,9 +1610,6 @@ var MARKET = gql5`
|
|
|
1536
1610
|
provider
|
|
1537
1611
|
region
|
|
1538
1612
|
relationIds
|
|
1539
|
-
stallApplicationInfo {
|
|
1540
|
-
...StallApplicationInfoFields
|
|
1541
|
-
}
|
|
1542
1613
|
tags
|
|
1543
1614
|
updatedAt
|
|
1544
1615
|
}
|
|
@@ -1546,7 +1617,6 @@ var MARKET = gql5`
|
|
|
1546
1617
|
${MARKET_LOCATION_FIELDS_FRAGMENT}
|
|
1547
1618
|
${OWNER_FIELDS_FRAGMENT}
|
|
1548
1619
|
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
1549
|
-
${STALL_APPLICATION_INFO_FIELDS_FRAGMENT}
|
|
1550
1620
|
`;
|
|
1551
1621
|
var GET_MARKETS = gql5`
|
|
1552
1622
|
query getMarkets {
|
|
@@ -1588,6 +1658,14 @@ var GET_MARKETS_NEAR_ME = gql5`
|
|
|
1588
1658
|
}
|
|
1589
1659
|
${MARKET}
|
|
1590
1660
|
`;
|
|
1661
|
+
var GET_MARKET_INFO = gql5`
|
|
1662
|
+
query getMarketInfo($_id: ID!) {
|
|
1663
|
+
marketInfo(_id: $_id) {
|
|
1664
|
+
...MarketInfoFields
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
${MARKET_INFO}
|
|
1668
|
+
`;
|
|
1591
1669
|
|
|
1592
1670
|
// src/graphql/mutations/market.ts
|
|
1593
1671
|
var CREATE_MARKET_MUTATION = gql6`
|
|
@@ -1611,6 +1689,22 @@ var DELETE_MARKET_MUTATION = gql6`
|
|
|
1611
1689
|
deleteMarket(_id: $_id)
|
|
1612
1690
|
}
|
|
1613
1691
|
`;
|
|
1692
|
+
var CREATE_MARKET_INFO_MUTATION = gql6`
|
|
1693
|
+
mutation createMarketInfo($input: MarketInfoInputType!) {
|
|
1694
|
+
createMarketInfo(input: $input) {
|
|
1695
|
+
...MarketInfoFields
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
${MARKET_INFO}
|
|
1699
|
+
`;
|
|
1700
|
+
var UPDATE_MARKET_INFO_MUTATION = gql6`
|
|
1701
|
+
mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
|
|
1702
|
+
updateMarketInfo(_id: $_id, input: $input) {
|
|
1703
|
+
...MarketInfoFields
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
${MARKET_INFO}
|
|
1707
|
+
`;
|
|
1614
1708
|
|
|
1615
1709
|
// src/graphql/queries/user.ts
|
|
1616
1710
|
import { gql as gql8 } from "@apollo/client";
|
|
@@ -1831,6 +1925,46 @@ var useDeleteMarket = () => {
|
|
|
1831
1925
|
);
|
|
1832
1926
|
return { deleteMarket, error, loading };
|
|
1833
1927
|
};
|
|
1928
|
+
var useCreateMarketInfo = () => {
|
|
1929
|
+
const [createMarketInfo, { loading, error }] = useMutation3(
|
|
1930
|
+
CREATE_MARKET_INFO_MUTATION,
|
|
1931
|
+
{
|
|
1932
|
+
awaitRefetchQueries: true,
|
|
1933
|
+
refetchQueries: (mutationResult) => {
|
|
1934
|
+
const marketId = mutationResult?.data?.createMarketInfo?.stallholderId;
|
|
1935
|
+
if (!marketId) return [];
|
|
1936
|
+
return [
|
|
1937
|
+
{
|
|
1938
|
+
query: GET_MARKET_INFO,
|
|
1939
|
+
variables: { marketId }
|
|
1940
|
+
// Pass the marketId for refetching
|
|
1941
|
+
}
|
|
1942
|
+
];
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
);
|
|
1946
|
+
return { createMarketInfo, error, loading };
|
|
1947
|
+
};
|
|
1948
|
+
var useUpdateMarketInfo = () => {
|
|
1949
|
+
const [updateMarketInfo, { loading, error }] = useMutation3(
|
|
1950
|
+
UPDATE_MARKET_INFO_MUTATION,
|
|
1951
|
+
{
|
|
1952
|
+
awaitRefetchQueries: true,
|
|
1953
|
+
refetchQueries: (mutationResult) => {
|
|
1954
|
+
const marketId = mutationResult?.data?.updateMarketInfo?.marketId;
|
|
1955
|
+
if (!marketId) return [];
|
|
1956
|
+
return [
|
|
1957
|
+
{
|
|
1958
|
+
query: GET_MARKET_INFO,
|
|
1959
|
+
variables: { marketId }
|
|
1960
|
+
// Pass the marketId for refetching
|
|
1961
|
+
}
|
|
1962
|
+
];
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
);
|
|
1966
|
+
return { error, loading, updateMarketInfo };
|
|
1967
|
+
};
|
|
1834
1968
|
|
|
1835
1969
|
// src/graphql/hooks/market/hooksQuery.ts
|
|
1836
1970
|
import { useQuery as useQuery2 } from "@apollo/client";
|
|
@@ -1882,6 +2016,15 @@ var useGetMarketsNearMe = (location) => {
|
|
|
1882
2016
|
const markets = data?.marketsNearMe;
|
|
1883
2017
|
return { error, loading, markets, refetch };
|
|
1884
2018
|
};
|
|
2019
|
+
var useGetMarketInfo = (marketId) => {
|
|
2020
|
+
const { loading, error, data, refetch } = useQuery2(GET_MARKET_INFO, {
|
|
2021
|
+
fetchPolicy: "network-only",
|
|
2022
|
+
skip: !marketId,
|
|
2023
|
+
variables: { marketId }
|
|
2024
|
+
});
|
|
2025
|
+
const marketInfo = data?.marketInfo;
|
|
2026
|
+
return { error, loading, marketInfo, refetch };
|
|
2027
|
+
};
|
|
1885
2028
|
|
|
1886
2029
|
// src/graphql/hooks/poster.ts
|
|
1887
2030
|
import { useMutation as useMutation4 } from "@apollo/client";
|
|
@@ -2435,6 +2578,8 @@ var useGetStallholderApplyForm = (stallholderId) => {
|
|
|
2435
2578
|
const { loading, error, data, refetch } = useQuery4(
|
|
2436
2579
|
GET_STALLHOLDER_APPLY_FORM,
|
|
2437
2580
|
{
|
|
2581
|
+
fetchPolicy: "network-only",
|
|
2582
|
+
skip: !stallholderId,
|
|
2438
2583
|
variables: { stallholderId }
|
|
2439
2584
|
}
|
|
2440
2585
|
);
|
|
@@ -2644,7 +2789,7 @@ var useGetUserNotifications = () => {
|
|
|
2644
2789
|
return { error, loading, refetch, userNotifications };
|
|
2645
2790
|
};
|
|
2646
2791
|
|
|
2647
|
-
// src/formFields/stallholder/
|
|
2792
|
+
// src/formFields/stallholder/stallholder.ts
|
|
2648
2793
|
var stallholderBasicInfoFields = [
|
|
2649
2794
|
{
|
|
2650
2795
|
helperText: "Business Name of the Stallholder *",
|
|
@@ -2813,7 +2958,7 @@ var producedIngTypes = [
|
|
|
2813
2958
|
var packagingOptions = mapArrayToOptions(packagingTypes);
|
|
2814
2959
|
var producedIngOptions = mapArrayToOptions(producedIngTypes);
|
|
2815
2960
|
|
|
2816
|
-
// src/formFields/market.ts
|
|
2961
|
+
// src/formFields/market/market.ts
|
|
2817
2962
|
var marketBasicInfoFields = [
|
|
2818
2963
|
{
|
|
2819
2964
|
helperText: "Name of the Market *",
|
|
@@ -2837,43 +2982,6 @@ var marketBasicInfoFields = [
|
|
|
2837
2982
|
placeholder: "Promo code"
|
|
2838
2983
|
}
|
|
2839
2984
|
];
|
|
2840
|
-
var stallApplicationInfo = [
|
|
2841
|
-
{
|
|
2842
|
-
helperText: "Application Deadline of the Market *",
|
|
2843
|
-
keyboardType: "number-pad",
|
|
2844
|
-
name: "stallApplicationInfo.applicationDeadlineHours",
|
|
2845
|
-
placeholder: "Application Deadline Hours"
|
|
2846
|
-
},
|
|
2847
|
-
{
|
|
2848
|
-
helperText: "Stall Capacity of the Market *",
|
|
2849
|
-
keyboardType: "number-pad",
|
|
2850
|
-
name: "stallApplicationInfo.stallCapacity",
|
|
2851
|
-
placeholder: "Stall Capacity"
|
|
2852
|
-
},
|
|
2853
|
-
{
|
|
2854
|
-
helperText: "Payment Due Hours of the Market *",
|
|
2855
|
-
keyboardType: "number-pad",
|
|
2856
|
-
name: "stallApplicationInfo.paymentDueHours",
|
|
2857
|
-
placeholder: "Payment Due Hours"
|
|
2858
|
-
}
|
|
2859
|
-
];
|
|
2860
|
-
var stallApplicationInfoPaymentTarget = [
|
|
2861
|
-
{
|
|
2862
|
-
helperText: "Account holder name *",
|
|
2863
|
-
name: "stallApplicationInfo.paymentTarget.accountHolderName",
|
|
2864
|
-
placeholder: "Account holder name"
|
|
2865
|
-
},
|
|
2866
|
-
{
|
|
2867
|
-
helperText: "Account number *",
|
|
2868
|
-
name: "stallApplicationInfo.paymentTarget.accountNumber",
|
|
2869
|
-
placeholder: "Account number"
|
|
2870
|
-
},
|
|
2871
|
-
{
|
|
2872
|
-
helperText: "Link to payment target *",
|
|
2873
|
-
name: "stallApplicationInfo.paymentTarget.link",
|
|
2874
|
-
placeholder: "Link to payment target"
|
|
2875
|
-
}
|
|
2876
|
-
];
|
|
2877
2985
|
var marketStartDateFields = [
|
|
2878
2986
|
{
|
|
2879
2987
|
dateMode: "date",
|
|
@@ -2888,14 +2996,6 @@ var marketStartDateFields = [
|
|
|
2888
2996
|
placeholder: "Start Time"
|
|
2889
2997
|
}
|
|
2890
2998
|
];
|
|
2891
|
-
var marketPriceByDateFields = [
|
|
2892
|
-
{
|
|
2893
|
-
helperText: "Market Price for this date *",
|
|
2894
|
-
keyboardType: "number-pad",
|
|
2895
|
-
name: "marketPrice",
|
|
2896
|
-
placeholder: "Market Price"
|
|
2897
|
-
}
|
|
2898
|
-
];
|
|
2899
2999
|
var marketEndDateFields = [
|
|
2900
3000
|
{
|
|
2901
3001
|
dateMode: "date",
|
|
@@ -2929,6 +3029,53 @@ var availableTagTypes = [
|
|
|
2929
3029
|
"Port Nearby"
|
|
2930
3030
|
];
|
|
2931
3031
|
var tagOptions = mapArrayToOptions(availableTagTypes);
|
|
3032
|
+
|
|
3033
|
+
// src/formFields/market/marketInfo.ts
|
|
3034
|
+
var stallApplicationInfo = [
|
|
3035
|
+
{
|
|
3036
|
+
helperText: "Application Deadline of the Market *",
|
|
3037
|
+
keyboardType: "number-pad",
|
|
3038
|
+
name: "stallApplicationInfo.applicationDeadlineHours",
|
|
3039
|
+
placeholder: "Application Deadline Hours"
|
|
3040
|
+
},
|
|
3041
|
+
{
|
|
3042
|
+
helperText: "Stall Capacity of the Market *",
|
|
3043
|
+
keyboardType: "number-pad",
|
|
3044
|
+
name: "stallApplicationInfo.stallCapacity",
|
|
3045
|
+
placeholder: "Stall Capacity"
|
|
3046
|
+
},
|
|
3047
|
+
{
|
|
3048
|
+
helperText: "Payment Due Hours of the Market *",
|
|
3049
|
+
keyboardType: "number-pad",
|
|
3050
|
+
name: "stallApplicationInfo.paymentDueHours",
|
|
3051
|
+
placeholder: "Payment Due Hours"
|
|
3052
|
+
}
|
|
3053
|
+
];
|
|
3054
|
+
var stallApplicationInfoPaymentTarget = [
|
|
3055
|
+
{
|
|
3056
|
+
helperText: "Account holder name *",
|
|
3057
|
+
name: "stallApplicationInfo.paymentTarget.accountHolderName",
|
|
3058
|
+
placeholder: "Account holder name"
|
|
3059
|
+
},
|
|
3060
|
+
{
|
|
3061
|
+
helperText: "Account number *",
|
|
3062
|
+
name: "stallApplicationInfo.paymentTarget.accountNumber",
|
|
3063
|
+
placeholder: "Account number"
|
|
3064
|
+
},
|
|
3065
|
+
{
|
|
3066
|
+
helperText: "Link to payment target *",
|
|
3067
|
+
name: "stallApplicationInfo.paymentTarget.link",
|
|
3068
|
+
placeholder: "Link to payment target"
|
|
3069
|
+
}
|
|
3070
|
+
];
|
|
3071
|
+
var marketPriceByDateFields = [
|
|
3072
|
+
{
|
|
3073
|
+
helperText: "Market Price for this date *",
|
|
3074
|
+
keyboardType: "number-pad",
|
|
3075
|
+
name: "marketPrice",
|
|
3076
|
+
placeholder: "Market Price"
|
|
3077
|
+
}
|
|
3078
|
+
];
|
|
2932
3079
|
var rejectionPolicyOptions = mapArrayToOptions(
|
|
2933
3080
|
Object.values(EnumRejectionPolicy)
|
|
2934
3081
|
);
|
|
@@ -3375,6 +3522,7 @@ export {
|
|
|
3375
3522
|
categoryColors,
|
|
3376
3523
|
dateFormat,
|
|
3377
3524
|
defaultMarketFormValues,
|
|
3525
|
+
defaultMarketInfoFormValues,
|
|
3378
3526
|
defaultRegion,
|
|
3379
3527
|
defaultStallholderApplyFormValues,
|
|
3380
3528
|
defaultStallholderFormValues,
|
|
@@ -3423,6 +3571,7 @@ export {
|
|
|
3423
3571
|
useAddUserFavouriteResource,
|
|
3424
3572
|
useCreateChat,
|
|
3425
3573
|
useCreateMarket,
|
|
3574
|
+
useCreateMarketInfo,
|
|
3426
3575
|
useCreatePoster,
|
|
3427
3576
|
useCreateRelation,
|
|
3428
3577
|
useCreateStallholder,
|
|
@@ -3435,6 +3584,7 @@ export {
|
|
|
3435
3584
|
useGetChat,
|
|
3436
3585
|
useGetChatSubscription,
|
|
3437
3586
|
useGetMarket,
|
|
3587
|
+
useGetMarketInfo,
|
|
3438
3588
|
useGetMarketRelations,
|
|
3439
3589
|
useGetMarkets,
|
|
3440
3590
|
useGetMarketsByRegion,
|
|
@@ -3458,6 +3608,7 @@ export {
|
|
|
3458
3608
|
useLogin,
|
|
3459
3609
|
useLoginForm,
|
|
3460
3610
|
useMarketForm,
|
|
3611
|
+
useMarketInfoForm,
|
|
3461
3612
|
useRegister,
|
|
3462
3613
|
useRegisterForm,
|
|
3463
3614
|
useRemoveParticipantFromChat,
|
|
@@ -3472,6 +3623,7 @@ export {
|
|
|
3472
3623
|
useStallholderApplyForm,
|
|
3473
3624
|
useStallholderForm,
|
|
3474
3625
|
useUpdateMarket,
|
|
3626
|
+
useUpdateMarketInfo,
|
|
3475
3627
|
useUpdateRelation,
|
|
3476
3628
|
useUpdateStallholder,
|
|
3477
3629
|
useUpdateStallholderApplyForm,
|