@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.
- 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-B7gB8cvC.d.ts → global-Cj-4jtsW.d.ts} +38 -9
- package/dist/{global-B8kYikwQ.d.mts → global-zKCLfUmA.d.mts} +38 -9
- package/dist/graphql/index.cjs +96 -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 +93 -16
- package/dist/graphql/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +164 -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 +162 -82
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +309 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +66 -11
- package/dist/index.d.ts +66 -11
- package/dist/index.mjs +304 -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,44 @@ 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
|
+
active: yup2.boolean().required("Active is required"),
|
|
399
|
+
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")),
|
|
400
|
+
dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
|
|
401
|
+
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")),
|
|
402
|
+
paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
|
|
403
|
+
paymentTarget: yup2.object().when("paymentMethod", (paymentMethod, schema) => {
|
|
404
|
+
const isBankTransfer = paymentMethod.includes(
|
|
405
|
+
"bank_transfer" /* BANK_TRANSFER */
|
|
406
|
+
);
|
|
407
|
+
if (!isBankTransfer) {
|
|
408
|
+
return schema.shape({
|
|
409
|
+
accountHolderName: yup2.string().notRequired(),
|
|
410
|
+
accountNumber: yup2.string().notRequired(),
|
|
411
|
+
link: yup2.string().trim().required("Link is required for PayPal/Stripe")
|
|
412
|
+
});
|
|
413
|
+
} else if (isBankTransfer) {
|
|
414
|
+
return schema.shape({
|
|
415
|
+
accountHolderName: yup2.string().trim().required("Account holder name is required for bank transfer"),
|
|
416
|
+
accountNumber: yup2.string().trim().required("Account number is required for bank transfer").matches(
|
|
417
|
+
nzBankAccountRegex,
|
|
418
|
+
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
419
|
+
),
|
|
420
|
+
link: yup2.string().notRequired()
|
|
421
|
+
});
|
|
422
|
+
} else {
|
|
423
|
+
return schema.shape({
|
|
424
|
+
accountHolderName: yup2.string().notRequired(),
|
|
425
|
+
accountNumber: yup2.string().notRequired(),
|
|
426
|
+
link: yup2.string().notRequired()
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}),
|
|
430
|
+
rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
|
|
431
|
+
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"))
|
|
432
|
+
});
|
|
433
433
|
|
|
434
434
|
// src/yupSchema/stallholder.ts
|
|
435
435
|
import * as yup3 from "yup";
|
|
@@ -560,14 +560,12 @@ var defaultMarketFormValues = {
|
|
|
560
560
|
{
|
|
561
561
|
endDate: "04-05-2025",
|
|
562
562
|
endTime: "15:00",
|
|
563
|
-
marketPrice: 0,
|
|
564
563
|
startDate: "04-05-2025",
|
|
565
564
|
startTime: "09:00"
|
|
566
565
|
},
|
|
567
566
|
{
|
|
568
567
|
endDate: "05-05-2025",
|
|
569
568
|
endTime: "15:00",
|
|
570
|
-
marketPrice: 0,
|
|
571
569
|
startDate: "05-05-2025",
|
|
572
570
|
startTime: "09:00"
|
|
573
571
|
}
|
|
@@ -585,19 +583,36 @@ var defaultMarketFormValues = {
|
|
|
585
583
|
// Default type for GeoJSON
|
|
586
584
|
},
|
|
587
585
|
provider: "Provider name",
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
586
|
+
tags: null
|
|
587
|
+
};
|
|
588
|
+
var defaultMarketInfoFormValues = {
|
|
589
|
+
active: false,
|
|
590
|
+
applicationDeadlineHours: 0,
|
|
591
|
+
dateTime: [
|
|
592
|
+
{
|
|
593
|
+
endDate: "04-05-2025",
|
|
594
|
+
endTime: "15:00",
|
|
595
|
+
marketPrice: 0,
|
|
596
|
+
startDate: "04-05-2025",
|
|
597
|
+
startTime: "09:00"
|
|
596
598
|
},
|
|
597
|
-
|
|
598
|
-
|
|
599
|
+
{
|
|
600
|
+
endDate: "05-05-2025",
|
|
601
|
+
endTime: "15:00",
|
|
602
|
+
marketPrice: 0,
|
|
603
|
+
startDate: "05-05-2025",
|
|
604
|
+
startTime: "09:00"
|
|
605
|
+
}
|
|
606
|
+
],
|
|
607
|
+
paymentDueHours: 0,
|
|
608
|
+
paymentMethod: "",
|
|
609
|
+
paymentTarget: {
|
|
610
|
+
accountHolderName: "",
|
|
611
|
+
accountNumber: "",
|
|
612
|
+
link: ""
|
|
599
613
|
},
|
|
600
|
-
|
|
614
|
+
rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
|
|
615
|
+
stallCapacity: 0
|
|
601
616
|
};
|
|
602
617
|
var defaultStallholderFormValues = {
|
|
603
618
|
...globalDefaultValues,
|
|
@@ -783,7 +798,7 @@ function useStallholderApplyForm(data) {
|
|
|
783
798
|
};
|
|
784
799
|
}
|
|
785
800
|
|
|
786
|
-
// src/hooks/useMarketForm.ts
|
|
801
|
+
// src/hooks/market/useMarketForm.ts
|
|
787
802
|
import { yupResolver as yupResolver3 } from "@hookform/resolvers/yup";
|
|
788
803
|
import * as React3 from "react";
|
|
789
804
|
import { useForm as useForm3 } from "react-hook-form";
|
|
@@ -818,7 +833,6 @@ function useMarketForm(data) {
|
|
|
818
833
|
promoCode: data.promoCode,
|
|
819
834
|
provider: data.provider,
|
|
820
835
|
region: data.region,
|
|
821
|
-
stallApplicationInfo: data.stallApplicationInfo,
|
|
822
836
|
tags: data.tags
|
|
823
837
|
});
|
|
824
838
|
} else {
|
|
@@ -840,7 +854,6 @@ function useMarketForm(data) {
|
|
|
840
854
|
name,
|
|
841
855
|
provider,
|
|
842
856
|
region,
|
|
843
|
-
stallApplicationInfo: stallApplicationInfo2,
|
|
844
857
|
tags
|
|
845
858
|
} = getValues();
|
|
846
859
|
return {
|
|
@@ -860,7 +873,6 @@ function useMarketForm(data) {
|
|
|
860
873
|
name,
|
|
861
874
|
provider,
|
|
862
875
|
region,
|
|
863
|
-
stallApplicationInfo: stallApplicationInfo2,
|
|
864
876
|
tags
|
|
865
877
|
},
|
|
866
878
|
formState: { errors },
|
|
@@ -871,10 +883,76 @@ function useMarketForm(data) {
|
|
|
871
883
|
};
|
|
872
884
|
}
|
|
873
885
|
|
|
874
|
-
// src/hooks/
|
|
886
|
+
// src/hooks/market/useMarketInfoForm.ts
|
|
875
887
|
import { yupResolver as yupResolver4 } from "@hookform/resolvers/yup";
|
|
876
888
|
import * as React4 from "react";
|
|
877
889
|
import { useForm as useForm4 } from "react-hook-form";
|
|
890
|
+
function useMarketInfoForm(data) {
|
|
891
|
+
const {
|
|
892
|
+
control,
|
|
893
|
+
formState: { errors },
|
|
894
|
+
getValues,
|
|
895
|
+
handleSubmit,
|
|
896
|
+
reset,
|
|
897
|
+
setValue,
|
|
898
|
+
watch
|
|
899
|
+
} = useForm4({
|
|
900
|
+
defaultValues: defaultMarketInfoFormValues,
|
|
901
|
+
resolver: yupResolver4(marketInfoSchema)
|
|
902
|
+
});
|
|
903
|
+
React4.useEffect(() => {
|
|
904
|
+
if (data) {
|
|
905
|
+
reset({
|
|
906
|
+
_id: data._id,
|
|
907
|
+
active: data.active,
|
|
908
|
+
applicationDeadlineHours: data.applicationDeadlineHours,
|
|
909
|
+
dateTime: data.dateTime,
|
|
910
|
+
paymentDueHours: data.paymentDueHours,
|
|
911
|
+
paymentMethod: data.paymentMethod,
|
|
912
|
+
paymentTarget: data.paymentTarget,
|
|
913
|
+
rejectionPolicy: data.rejectionPolicy,
|
|
914
|
+
stallCapacity: data.stallCapacity
|
|
915
|
+
});
|
|
916
|
+
} else {
|
|
917
|
+
reset(defaultMarketInfoFormValues);
|
|
918
|
+
}
|
|
919
|
+
}, [data]);
|
|
920
|
+
const {
|
|
921
|
+
_id,
|
|
922
|
+
active,
|
|
923
|
+
applicationDeadlineHours,
|
|
924
|
+
dateTime,
|
|
925
|
+
paymentDueHours,
|
|
926
|
+
paymentMethod,
|
|
927
|
+
paymentTarget,
|
|
928
|
+
rejectionPolicy,
|
|
929
|
+
stallCapacity
|
|
930
|
+
} = getValues();
|
|
931
|
+
return {
|
|
932
|
+
control,
|
|
933
|
+
fields: {
|
|
934
|
+
_id,
|
|
935
|
+
active,
|
|
936
|
+
applicationDeadlineHours,
|
|
937
|
+
dateTime,
|
|
938
|
+
paymentDueHours,
|
|
939
|
+
paymentMethod,
|
|
940
|
+
paymentTarget,
|
|
941
|
+
rejectionPolicy,
|
|
942
|
+
stallCapacity
|
|
943
|
+
},
|
|
944
|
+
formState: { errors },
|
|
945
|
+
handleSubmit,
|
|
946
|
+
reset,
|
|
947
|
+
setValue,
|
|
948
|
+
watch
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// src/hooks/useUserForm.ts
|
|
953
|
+
import { yupResolver as yupResolver5 } from "@hookform/resolvers/yup";
|
|
954
|
+
import * as React5 from "react";
|
|
955
|
+
import { useForm as useForm5 } from "react-hook-form";
|
|
878
956
|
var defaultValues = {
|
|
879
957
|
active: false,
|
|
880
958
|
avatar: null,
|
|
@@ -896,11 +974,11 @@ function useUserForm(data) {
|
|
|
896
974
|
reset,
|
|
897
975
|
setValue,
|
|
898
976
|
watch
|
|
899
|
-
} =
|
|
977
|
+
} = useForm5({
|
|
900
978
|
defaultValues,
|
|
901
|
-
resolver:
|
|
979
|
+
resolver: yupResolver5(userSchema)
|
|
902
980
|
});
|
|
903
|
-
|
|
981
|
+
React5.useEffect(() => {
|
|
904
982
|
if (data) {
|
|
905
983
|
reset({
|
|
906
984
|
_id: data._id,
|
|
@@ -956,8 +1034,8 @@ function useUserForm(data) {
|
|
|
956
1034
|
}
|
|
957
1035
|
|
|
958
1036
|
// src/hooks/auth/useLoginForm.ts
|
|
959
|
-
import { yupResolver as
|
|
960
|
-
import { useForm as
|
|
1037
|
+
import { yupResolver as yupResolver6 } from "@hookform/resolvers/yup";
|
|
1038
|
+
import { useForm as useForm6 } from "react-hook-form";
|
|
961
1039
|
var defaultValues2 = {
|
|
962
1040
|
email: "",
|
|
963
1041
|
password: ""
|
|
@@ -971,9 +1049,9 @@ function useLoginForm() {
|
|
|
971
1049
|
reset,
|
|
972
1050
|
setValue,
|
|
973
1051
|
watch
|
|
974
|
-
} =
|
|
1052
|
+
} = useForm6({
|
|
975
1053
|
defaultValues: defaultValues2,
|
|
976
|
-
resolver:
|
|
1054
|
+
resolver: yupResolver6(loginSchema)
|
|
977
1055
|
});
|
|
978
1056
|
const { email, password } = getValues();
|
|
979
1057
|
return {
|
|
@@ -991,8 +1069,8 @@ function useLoginForm() {
|
|
|
991
1069
|
}
|
|
992
1070
|
|
|
993
1071
|
// src/hooks/auth/useRegisterForm.ts
|
|
994
|
-
import { yupResolver as
|
|
995
|
-
import { useForm as
|
|
1072
|
+
import { yupResolver as yupResolver7 } from "@hookform/resolvers/yup";
|
|
1073
|
+
import { useForm as useForm7 } from "react-hook-form";
|
|
996
1074
|
var defaultValues3 = {
|
|
997
1075
|
email: "",
|
|
998
1076
|
firstName: "",
|
|
@@ -1010,9 +1088,9 @@ function useRegisterForm() {
|
|
|
1010
1088
|
reset,
|
|
1011
1089
|
setValue,
|
|
1012
1090
|
watch
|
|
1013
|
-
} =
|
|
1091
|
+
} = useForm7({
|
|
1014
1092
|
defaultValues: defaultValues3,
|
|
1015
|
-
resolver:
|
|
1093
|
+
resolver: yupResolver7(registerSchema)
|
|
1016
1094
|
});
|
|
1017
1095
|
const { email, firstName, lastName, password, preferredRegion, role } = getValues();
|
|
1018
1096
|
return {
|
|
@@ -1034,8 +1112,8 @@ function useRegisterForm() {
|
|
|
1034
1112
|
}
|
|
1035
1113
|
|
|
1036
1114
|
// src/hooks/auth/useRequestPasswordResetForm.ts
|
|
1037
|
-
import { yupResolver as
|
|
1038
|
-
import { useForm as
|
|
1115
|
+
import { yupResolver as yupResolver8 } from "@hookform/resolvers/yup";
|
|
1116
|
+
import { useForm as useForm8 } from "react-hook-form";
|
|
1039
1117
|
var defaultValues4 = {
|
|
1040
1118
|
email: ""
|
|
1041
1119
|
};
|
|
@@ -1048,9 +1126,9 @@ function useRequestPasswordResetForm() {
|
|
|
1048
1126
|
reset,
|
|
1049
1127
|
setValue,
|
|
1050
1128
|
watch
|
|
1051
|
-
} =
|
|
1129
|
+
} = useForm8({
|
|
1052
1130
|
defaultValues: defaultValues4,
|
|
1053
|
-
resolver:
|
|
1131
|
+
resolver: yupResolver8(requestPasswordResetSchema)
|
|
1054
1132
|
});
|
|
1055
1133
|
const { email } = getValues();
|
|
1056
1134
|
return {
|
|
@@ -1067,8 +1145,8 @@ function useRequestPasswordResetForm() {
|
|
|
1067
1145
|
}
|
|
1068
1146
|
|
|
1069
1147
|
// src/hooks/auth/useValidateTokenForm.ts
|
|
1070
|
-
import { yupResolver as
|
|
1071
|
-
import { useForm as
|
|
1148
|
+
import { yupResolver as yupResolver9 } from "@hookform/resolvers/yup";
|
|
1149
|
+
import { useForm as useForm9 } from "react-hook-form";
|
|
1072
1150
|
var defaultValues5 = {
|
|
1073
1151
|
email: "",
|
|
1074
1152
|
token: ""
|
|
@@ -1082,9 +1160,9 @@ function useValidateTokenForm() {
|
|
|
1082
1160
|
reset,
|
|
1083
1161
|
setValue,
|
|
1084
1162
|
watch
|
|
1085
|
-
} =
|
|
1163
|
+
} = useForm9({
|
|
1086
1164
|
defaultValues: defaultValues5,
|
|
1087
|
-
resolver:
|
|
1165
|
+
resolver: yupResolver9(validateTokenSchema)
|
|
1088
1166
|
});
|
|
1089
1167
|
const { email, token } = getValues();
|
|
1090
1168
|
return {
|
|
@@ -1102,8 +1180,8 @@ function useValidateTokenForm() {
|
|
|
1102
1180
|
}
|
|
1103
1181
|
|
|
1104
1182
|
// src/hooks/auth/useResetPasswordForm.ts
|
|
1105
|
-
import { yupResolver as
|
|
1106
|
-
import { useForm as
|
|
1183
|
+
import { yupResolver as yupResolver10 } from "@hookform/resolvers/yup";
|
|
1184
|
+
import { useForm as useForm10 } from "react-hook-form";
|
|
1107
1185
|
var defaultValues6 = {
|
|
1108
1186
|
confirmPassword: "",
|
|
1109
1187
|
email: "",
|
|
@@ -1118,9 +1196,9 @@ function useResetPasswordForm() {
|
|
|
1118
1196
|
reset,
|
|
1119
1197
|
setValue,
|
|
1120
1198
|
watch
|
|
1121
|
-
} =
|
|
1199
|
+
} = useForm10({
|
|
1122
1200
|
defaultValues: defaultValues6,
|
|
1123
|
-
resolver:
|
|
1201
|
+
resolver: yupResolver10(resetPasswordSchema)
|
|
1124
1202
|
});
|
|
1125
1203
|
const { confirmPassword, email, password } = getValues();
|
|
1126
1204
|
return {
|
|
@@ -1470,7 +1548,6 @@ var MARKET_DATETIME_FIELDS_FRAGMENT = gql5`
|
|
|
1470
1548
|
fragment MarketDateTimeFields on MarketDateTimeType {
|
|
1471
1549
|
endDate
|
|
1472
1550
|
endTime
|
|
1473
|
-
marketPrice
|
|
1474
1551
|
startDate
|
|
1475
1552
|
startTime
|
|
1476
1553
|
}
|
|
@@ -1487,25 +1564,29 @@ var MARKET_LOCATION_FIELDS_FRAGMENT = gql5`
|
|
|
1487
1564
|
type
|
|
1488
1565
|
}
|
|
1489
1566
|
`;
|
|
1490
|
-
var
|
|
1491
|
-
fragment
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
link
|
|
1495
|
-
}
|
|
1496
|
-
`;
|
|
1497
|
-
var STALL_APPLICATION_INFO_FIELDS_FRAGMENT = gql5`
|
|
1498
|
-
fragment StallApplicationInfoFields on StallApplicationInfoType {
|
|
1567
|
+
var MARKET_INFO = gql5`
|
|
1568
|
+
fragment MarketInfoFields on MarketInfoType {
|
|
1569
|
+
_id
|
|
1570
|
+
active
|
|
1499
1571
|
applicationDeadlineHours
|
|
1572
|
+
dateTime {
|
|
1573
|
+
endDate
|
|
1574
|
+
endTime
|
|
1575
|
+
marketPrice
|
|
1576
|
+
startDate
|
|
1577
|
+
startTime
|
|
1578
|
+
}
|
|
1579
|
+
marketId
|
|
1500
1580
|
paymentDueHours
|
|
1501
1581
|
paymentMethod
|
|
1502
1582
|
paymentTarget {
|
|
1503
|
-
|
|
1583
|
+
accountHolderName
|
|
1584
|
+
accountNumber
|
|
1585
|
+
link
|
|
1504
1586
|
}
|
|
1505
1587
|
rejectionPolicy
|
|
1506
1588
|
stallCapacity
|
|
1507
1589
|
}
|
|
1508
|
-
${PAYMENT_TARGET_FIELDS_FRAGMENT}
|
|
1509
1590
|
`;
|
|
1510
1591
|
var MARKET = gql5`
|
|
1511
1592
|
fragment MarketFields on MarketType {
|
|
@@ -1536,9 +1617,6 @@ var MARKET = gql5`
|
|
|
1536
1617
|
provider
|
|
1537
1618
|
region
|
|
1538
1619
|
relationIds
|
|
1539
|
-
stallApplicationInfo {
|
|
1540
|
-
...StallApplicationInfoFields
|
|
1541
|
-
}
|
|
1542
1620
|
tags
|
|
1543
1621
|
updatedAt
|
|
1544
1622
|
}
|
|
@@ -1546,7 +1624,6 @@ var MARKET = gql5`
|
|
|
1546
1624
|
${MARKET_LOCATION_FIELDS_FRAGMENT}
|
|
1547
1625
|
${OWNER_FIELDS_FRAGMENT}
|
|
1548
1626
|
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
1549
|
-
${STALL_APPLICATION_INFO_FIELDS_FRAGMENT}
|
|
1550
1627
|
`;
|
|
1551
1628
|
var GET_MARKETS = gql5`
|
|
1552
1629
|
query getMarkets {
|
|
@@ -1588,6 +1665,14 @@ var GET_MARKETS_NEAR_ME = gql5`
|
|
|
1588
1665
|
}
|
|
1589
1666
|
${MARKET}
|
|
1590
1667
|
`;
|
|
1668
|
+
var GET_MARKET_INFO = gql5`
|
|
1669
|
+
query getMarketInfo($_id: ID!) {
|
|
1670
|
+
marketInfo(_id: $_id) {
|
|
1671
|
+
...MarketInfoFields
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
${MARKET_INFO}
|
|
1675
|
+
`;
|
|
1591
1676
|
|
|
1592
1677
|
// src/graphql/mutations/market.ts
|
|
1593
1678
|
var CREATE_MARKET_MUTATION = gql6`
|
|
@@ -1611,6 +1696,22 @@ var DELETE_MARKET_MUTATION = gql6`
|
|
|
1611
1696
|
deleteMarket(_id: $_id)
|
|
1612
1697
|
}
|
|
1613
1698
|
`;
|
|
1699
|
+
var CREATE_MARKET_INFO_MUTATION = gql6`
|
|
1700
|
+
mutation createMarketInfo($input: MarketInfoInputType!) {
|
|
1701
|
+
createMarketInfo(input: $input) {
|
|
1702
|
+
...MarketInfoFields
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
${MARKET_INFO}
|
|
1706
|
+
`;
|
|
1707
|
+
var UPDATE_MARKET_INFO_MUTATION = gql6`
|
|
1708
|
+
mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
|
|
1709
|
+
updateMarketInfo(_id: $_id, input: $input) {
|
|
1710
|
+
...MarketInfoFields
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
${MARKET_INFO}
|
|
1714
|
+
`;
|
|
1614
1715
|
|
|
1615
1716
|
// src/graphql/queries/user.ts
|
|
1616
1717
|
import { gql as gql8 } from "@apollo/client";
|
|
@@ -1831,6 +1932,46 @@ var useDeleteMarket = () => {
|
|
|
1831
1932
|
);
|
|
1832
1933
|
return { deleteMarket, error, loading };
|
|
1833
1934
|
};
|
|
1935
|
+
var useCreateMarketInfo = () => {
|
|
1936
|
+
const [createMarketInfo, { loading, error }] = useMutation3(
|
|
1937
|
+
CREATE_MARKET_INFO_MUTATION,
|
|
1938
|
+
{
|
|
1939
|
+
awaitRefetchQueries: true,
|
|
1940
|
+
refetchQueries: (mutationResult) => {
|
|
1941
|
+
const marketId = mutationResult?.data?.createMarketInfo?.stallholderId;
|
|
1942
|
+
if (!marketId) return [];
|
|
1943
|
+
return [
|
|
1944
|
+
{
|
|
1945
|
+
query: GET_MARKET_INFO,
|
|
1946
|
+
variables: { marketId }
|
|
1947
|
+
// Pass the marketId for refetching
|
|
1948
|
+
}
|
|
1949
|
+
];
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
);
|
|
1953
|
+
return { createMarketInfo, error, loading };
|
|
1954
|
+
};
|
|
1955
|
+
var useUpdateMarketInfo = () => {
|
|
1956
|
+
const [updateMarketInfo, { loading, error }] = useMutation3(
|
|
1957
|
+
UPDATE_MARKET_INFO_MUTATION,
|
|
1958
|
+
{
|
|
1959
|
+
awaitRefetchQueries: true,
|
|
1960
|
+
refetchQueries: (mutationResult) => {
|
|
1961
|
+
const marketId = mutationResult?.data?.updateMarketInfo?.marketId;
|
|
1962
|
+
if (!marketId) return [];
|
|
1963
|
+
return [
|
|
1964
|
+
{
|
|
1965
|
+
query: GET_MARKET_INFO,
|
|
1966
|
+
variables: { marketId }
|
|
1967
|
+
// Pass the marketId for refetching
|
|
1968
|
+
}
|
|
1969
|
+
];
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
);
|
|
1973
|
+
return { error, loading, updateMarketInfo };
|
|
1974
|
+
};
|
|
1834
1975
|
|
|
1835
1976
|
// src/graphql/hooks/market/hooksQuery.ts
|
|
1836
1977
|
import { useQuery as useQuery2 } from "@apollo/client";
|
|
@@ -1882,6 +2023,15 @@ var useGetMarketsNearMe = (location) => {
|
|
|
1882
2023
|
const markets = data?.marketsNearMe;
|
|
1883
2024
|
return { error, loading, markets, refetch };
|
|
1884
2025
|
};
|
|
2026
|
+
var useGetMarketInfo = (marketId) => {
|
|
2027
|
+
const { loading, error, data, refetch } = useQuery2(GET_MARKET_INFO, {
|
|
2028
|
+
fetchPolicy: "network-only",
|
|
2029
|
+
skip: !marketId,
|
|
2030
|
+
variables: { marketId }
|
|
2031
|
+
});
|
|
2032
|
+
const marketInfo = data?.marketInfo;
|
|
2033
|
+
return { error, loading, marketInfo, refetch };
|
|
2034
|
+
};
|
|
1885
2035
|
|
|
1886
2036
|
// src/graphql/hooks/poster.ts
|
|
1887
2037
|
import { useMutation as useMutation4 } from "@apollo/client";
|
|
@@ -2435,6 +2585,8 @@ var useGetStallholderApplyForm = (stallholderId) => {
|
|
|
2435
2585
|
const { loading, error, data, refetch } = useQuery4(
|
|
2436
2586
|
GET_STALLHOLDER_APPLY_FORM,
|
|
2437
2587
|
{
|
|
2588
|
+
fetchPolicy: "network-only",
|
|
2589
|
+
skip: !stallholderId,
|
|
2438
2590
|
variables: { stallholderId }
|
|
2439
2591
|
}
|
|
2440
2592
|
);
|
|
@@ -2644,7 +2796,7 @@ var useGetUserNotifications = () => {
|
|
|
2644
2796
|
return { error, loading, refetch, userNotifications };
|
|
2645
2797
|
};
|
|
2646
2798
|
|
|
2647
|
-
// src/formFields/stallholder/
|
|
2799
|
+
// src/formFields/stallholder/stallholder.ts
|
|
2648
2800
|
var stallholderBasicInfoFields = [
|
|
2649
2801
|
{
|
|
2650
2802
|
helperText: "Business Name of the Stallholder *",
|
|
@@ -2813,7 +2965,7 @@ var producedIngTypes = [
|
|
|
2813
2965
|
var packagingOptions = mapArrayToOptions(packagingTypes);
|
|
2814
2966
|
var producedIngOptions = mapArrayToOptions(producedIngTypes);
|
|
2815
2967
|
|
|
2816
|
-
// src/formFields/market.ts
|
|
2968
|
+
// src/formFields/market/market.ts
|
|
2817
2969
|
var marketBasicInfoFields = [
|
|
2818
2970
|
{
|
|
2819
2971
|
helperText: "Name of the Market *",
|
|
@@ -2837,43 +2989,6 @@ var marketBasicInfoFields = [
|
|
|
2837
2989
|
placeholder: "Promo code"
|
|
2838
2990
|
}
|
|
2839
2991
|
];
|
|
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
2992
|
var marketStartDateFields = [
|
|
2878
2993
|
{
|
|
2879
2994
|
dateMode: "date",
|
|
@@ -2888,14 +3003,6 @@ var marketStartDateFields = [
|
|
|
2888
3003
|
placeholder: "Start Time"
|
|
2889
3004
|
}
|
|
2890
3005
|
];
|
|
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
3006
|
var marketEndDateFields = [
|
|
2900
3007
|
{
|
|
2901
3008
|
dateMode: "date",
|
|
@@ -2929,6 +3036,53 @@ var availableTagTypes = [
|
|
|
2929
3036
|
"Port Nearby"
|
|
2930
3037
|
];
|
|
2931
3038
|
var tagOptions = mapArrayToOptions(availableTagTypes);
|
|
3039
|
+
|
|
3040
|
+
// src/formFields/market/marketInfo.ts
|
|
3041
|
+
var stallApplicationInfo = [
|
|
3042
|
+
{
|
|
3043
|
+
helperText: "Application Deadline of the Market *",
|
|
3044
|
+
keyboardType: "number-pad",
|
|
3045
|
+
name: "stallApplicationInfo.applicationDeadlineHours",
|
|
3046
|
+
placeholder: "Application Deadline Hours"
|
|
3047
|
+
},
|
|
3048
|
+
{
|
|
3049
|
+
helperText: "Stall Capacity of the Market *",
|
|
3050
|
+
keyboardType: "number-pad",
|
|
3051
|
+
name: "stallApplicationInfo.stallCapacity",
|
|
3052
|
+
placeholder: "Stall Capacity"
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
helperText: "Payment Due Hours of the Market *",
|
|
3056
|
+
keyboardType: "number-pad",
|
|
3057
|
+
name: "stallApplicationInfo.paymentDueHours",
|
|
3058
|
+
placeholder: "Payment Due Hours"
|
|
3059
|
+
}
|
|
3060
|
+
];
|
|
3061
|
+
var stallApplicationInfoPaymentTarget = [
|
|
3062
|
+
{
|
|
3063
|
+
helperText: "Account holder name *",
|
|
3064
|
+
name: "stallApplicationInfo.paymentTarget.accountHolderName",
|
|
3065
|
+
placeholder: "Account holder name"
|
|
3066
|
+
},
|
|
3067
|
+
{
|
|
3068
|
+
helperText: "Account number *",
|
|
3069
|
+
name: "stallApplicationInfo.paymentTarget.accountNumber",
|
|
3070
|
+
placeholder: "Account number"
|
|
3071
|
+
},
|
|
3072
|
+
{
|
|
3073
|
+
helperText: "Link to payment target *",
|
|
3074
|
+
name: "stallApplicationInfo.paymentTarget.link",
|
|
3075
|
+
placeholder: "Link to payment target"
|
|
3076
|
+
}
|
|
3077
|
+
];
|
|
3078
|
+
var marketPriceByDateFields = [
|
|
3079
|
+
{
|
|
3080
|
+
helperText: "Market Price for this date *",
|
|
3081
|
+
keyboardType: "number-pad",
|
|
3082
|
+
name: "marketPrice",
|
|
3083
|
+
placeholder: "Market Price"
|
|
3084
|
+
}
|
|
3085
|
+
];
|
|
2932
3086
|
var rejectionPolicyOptions = mapArrayToOptions(
|
|
2933
3087
|
Object.values(EnumRejectionPolicy)
|
|
2934
3088
|
);
|
|
@@ -3375,6 +3529,7 @@ export {
|
|
|
3375
3529
|
categoryColors,
|
|
3376
3530
|
dateFormat,
|
|
3377
3531
|
defaultMarketFormValues,
|
|
3532
|
+
defaultMarketInfoFormValues,
|
|
3378
3533
|
defaultRegion,
|
|
3379
3534
|
defaultStallholderApplyFormValues,
|
|
3380
3535
|
defaultStallholderFormValues,
|
|
@@ -3423,6 +3578,7 @@ export {
|
|
|
3423
3578
|
useAddUserFavouriteResource,
|
|
3424
3579
|
useCreateChat,
|
|
3425
3580
|
useCreateMarket,
|
|
3581
|
+
useCreateMarketInfo,
|
|
3426
3582
|
useCreatePoster,
|
|
3427
3583
|
useCreateRelation,
|
|
3428
3584
|
useCreateStallholder,
|
|
@@ -3435,6 +3591,7 @@ export {
|
|
|
3435
3591
|
useGetChat,
|
|
3436
3592
|
useGetChatSubscription,
|
|
3437
3593
|
useGetMarket,
|
|
3594
|
+
useGetMarketInfo,
|
|
3438
3595
|
useGetMarketRelations,
|
|
3439
3596
|
useGetMarkets,
|
|
3440
3597
|
useGetMarketsByRegion,
|
|
@@ -3458,6 +3615,7 @@ export {
|
|
|
3458
3615
|
useLogin,
|
|
3459
3616
|
useLoginForm,
|
|
3460
3617
|
useMarketForm,
|
|
3618
|
+
useMarketInfoForm,
|
|
3461
3619
|
useRegister,
|
|
3462
3620
|
useRegisterForm,
|
|
3463
3621
|
useRemoveParticipantFromChat,
|
|
@@ -3472,6 +3630,7 @@ export {
|
|
|
3472
3630
|
useStallholderApplyForm,
|
|
3473
3631
|
useStallholderForm,
|
|
3474
3632
|
useUpdateMarket,
|
|
3633
|
+
useUpdateMarketInfo,
|
|
3475
3634
|
useUpdateRelation,
|
|
3476
3635
|
useUpdateStallholder,
|
|
3477
3636
|
useUpdateStallholderApplyForm,
|