@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
package/dist/index.cjs CHANGED
@@ -50,6 +50,7 @@ __export(index_exports, {
50
50
  categoryColors: () => categoryColors,
51
51
  dateFormat: () => dateFormat,
52
52
  defaultMarketFormValues: () => defaultMarketFormValues,
53
+ defaultMarketInfoFormValues: () => defaultMarketInfoFormValues,
53
54
  defaultRegion: () => defaultRegion,
54
55
  defaultStallholderApplyFormValues: () => defaultStallholderApplyFormValues,
55
56
  defaultStallholderFormValues: () => defaultStallholderFormValues,
@@ -98,6 +99,7 @@ __export(index_exports, {
98
99
  useAddUserFavouriteResource: () => useAddUserFavouriteResource,
99
100
  useCreateChat: () => useCreateChat,
100
101
  useCreateMarket: () => useCreateMarket,
102
+ useCreateMarketInfo: () => useCreateMarketInfo,
101
103
  useCreatePoster: () => useCreatePoster,
102
104
  useCreateRelation: () => useCreateRelation,
103
105
  useCreateStallholder: () => useCreateStallholder,
@@ -110,6 +112,7 @@ __export(index_exports, {
110
112
  useGetChat: () => useGetChat,
111
113
  useGetChatSubscription: () => useGetChatSubscription,
112
114
  useGetMarket: () => useGetMarket,
115
+ useGetMarketInfo: () => useGetMarketInfo,
113
116
  useGetMarketRelations: () => useGetMarketRelations,
114
117
  useGetMarkets: () => useGetMarkets,
115
118
  useGetMarketsByRegion: () => useGetMarketsByRegion,
@@ -133,6 +136,7 @@ __export(index_exports, {
133
136
  useLogin: () => useLogin,
134
137
  useLoginForm: () => useLoginForm,
135
138
  useMarketForm: () => useMarketForm,
139
+ useMarketInfoForm: () => useMarketInfoForm,
136
140
  useRegister: () => useRegister,
137
141
  useRegisterForm: () => useRegisterForm,
138
142
  useRemoveParticipantFromChat: () => useRemoveParticipantFromChat,
@@ -147,6 +151,7 @@ __export(index_exports, {
147
151
  useStallholderApplyForm: () => useStallholderApplyForm,
148
152
  useStallholderForm: () => useStallholderForm,
149
153
  useUpdateMarket: () => useUpdateMarket,
154
+ useUpdateMarketInfo: () => useUpdateMarketInfo,
150
155
  useUpdateRelation: () => useUpdateRelation,
151
156
  useUpdateStallholder: () => useUpdateStallholder,
152
157
  useUpdateStallholderApplyForm: () => useUpdateStallholderApplyForm,
@@ -507,13 +512,15 @@ var startTimeCannotBeInPastTest = yup.string().test(
507
512
  var dateTimeSchema = yup.object().shape({
508
513
  endDate: yup.string().concat(endDateNotInPastTest).concat(endDateAfterStartDateTest).required("End date is required"),
509
514
  endTime: yup.string().concat(endTimeMustBeAfterStartTimeTest).required("End time is required"),
515
+ startDate: yup.string().concat(startDateNotInPastTest).required("Start date is required"),
516
+ startTime: yup.string().concat(startTimeCannotBeInPastTest).required("Start time is required")
517
+ });
518
+ var dateTimeWithPriceSchema = dateTimeSchema.shape({
510
519
  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(
511
520
  "no-leading-zeros",
512
521
  "",
513
522
  noLeadingZeros("Market price", { allowDecimal: true })
514
- ),
515
- startDate: yup.string().concat(startDateNotInPastTest).required("Start date is required"),
516
- startTime: yup.string().concat(startTimeCannotBeInPastTest).required("Start time is required")
523
+ )
517
524
  });
518
525
  var locationSchema = yup.object().shape({
519
526
  city: yup.string().required("City is required"),
@@ -550,46 +557,44 @@ var marketSchema = globalResourceSchema.shape({
550
557
  dateTime: yup2.array().of(dateTimeSchema).required("DateTime is required"),
551
558
  location: locationSchema,
552
559
  provider: yup2.string().trim().min(3).required("Provider is required"),
553
- stallApplicationInfo: yup2.object().shape({
554
- 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(
555
- "no-leading-zeros",
556
- "",
557
- noLeadingZeros("Application deadline hours")
558
- ),
559
- 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")),
560
- paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
561
- paymentTarget: yup2.object().when("paymentMethod", (paymentMethod, schema) => {
562
- const isBankTransfer = paymentMethod.includes(
563
- "bank_transfer" /* BANK_TRANSFER */
564
- );
565
- if (!isBankTransfer) {
566
- return schema.shape({
567
- accountHolderName: yup2.string().notRequired(),
568
- accountNumber: yup2.string().notRequired(),
569
- link: yup2.string().trim().required("Link is required for PayPal/Stripe")
570
- });
571
- } else if (isBankTransfer) {
572
- return schema.shape({
573
- accountHolderName: yup2.string().trim().required("Account holder name is required for bank transfer"),
574
- accountNumber: yup2.string().trim().required("Account number is required for bank transfer").matches(
575
- nzBankAccountRegex,
576
- "Account number must be in format: XX-XXXX-XXXXXXX-XX"
577
- ),
578
- link: yup2.string().notRequired()
579
- });
580
- } else {
581
- return schema.shape({
582
- accountHolderName: yup2.string().notRequired(),
583
- accountNumber: yup2.string().notRequired(),
584
- link: yup2.string().notRequired()
585
- });
586
- }
587
- }),
588
- rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
589
- 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"))
590
- }),
591
560
  tags: yup2.array().of(yup2.string().defined()).nullable()
592
561
  });
562
+ var marketInfoSchema = yup2.object().shape({
563
+ active: yup2.boolean().required("Active is required"),
564
+ 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")),
565
+ dateTime: yup2.array().of(dateTimeWithPriceSchema).required("DateTime is required"),
566
+ 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")),
567
+ paymentMethod: yup2.mixed().oneOf(Object.values(EnumPaymentMethod)).required("Please select a Payment method"),
568
+ paymentTarget: yup2.object().when("paymentMethod", (paymentMethod, schema) => {
569
+ const isBankTransfer = paymentMethod.includes(
570
+ "bank_transfer" /* BANK_TRANSFER */
571
+ );
572
+ if (!isBankTransfer) {
573
+ return schema.shape({
574
+ accountHolderName: yup2.string().notRequired(),
575
+ accountNumber: yup2.string().notRequired(),
576
+ link: yup2.string().trim().required("Link is required for PayPal/Stripe")
577
+ });
578
+ } else if (isBankTransfer) {
579
+ return schema.shape({
580
+ accountHolderName: yup2.string().trim().required("Account holder name is required for bank transfer"),
581
+ accountNumber: yup2.string().trim().required("Account number is required for bank transfer").matches(
582
+ nzBankAccountRegex,
583
+ "Account number must be in format: XX-XXXX-XXXXXXX-XX"
584
+ ),
585
+ link: yup2.string().notRequired()
586
+ });
587
+ } else {
588
+ return schema.shape({
589
+ accountHolderName: yup2.string().notRequired(),
590
+ accountNumber: yup2.string().notRequired(),
591
+ link: yup2.string().notRequired()
592
+ });
593
+ }
594
+ }),
595
+ rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
596
+ 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"))
597
+ });
593
598
 
594
599
  // src/yupSchema/stallholder.ts
595
600
  var yup3 = __toESM(require("yup"));
@@ -720,14 +725,12 @@ var defaultMarketFormValues = {
720
725
  {
721
726
  endDate: "04-05-2025",
722
727
  endTime: "15:00",
723
- marketPrice: 0,
724
728
  startDate: "04-05-2025",
725
729
  startTime: "09:00"
726
730
  },
727
731
  {
728
732
  endDate: "05-05-2025",
729
733
  endTime: "15:00",
730
- marketPrice: 0,
731
734
  startDate: "05-05-2025",
732
735
  startTime: "09:00"
733
736
  }
@@ -745,19 +748,36 @@ var defaultMarketFormValues = {
745
748
  // Default type for GeoJSON
746
749
  },
747
750
  provider: "Provider name",
748
- stallApplicationInfo: {
749
- applicationDeadlineHours: 0,
750
- paymentDueHours: 0,
751
- paymentMethod: "",
752
- paymentTarget: {
753
- accountHolderName: "",
754
- accountNumber: "",
755
- link: ""
751
+ tags: null
752
+ };
753
+ var defaultMarketInfoFormValues = {
754
+ active: false,
755
+ applicationDeadlineHours: 0,
756
+ dateTime: [
757
+ {
758
+ endDate: "04-05-2025",
759
+ endTime: "15:00",
760
+ marketPrice: 0,
761
+ startDate: "04-05-2025",
762
+ startTime: "09:00"
756
763
  },
757
- rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
758
- stallCapacity: 0
764
+ {
765
+ endDate: "05-05-2025",
766
+ endTime: "15:00",
767
+ marketPrice: 0,
768
+ startDate: "05-05-2025",
769
+ startTime: "09:00"
770
+ }
771
+ ],
772
+ paymentDueHours: 0,
773
+ paymentMethod: "",
774
+ paymentTarget: {
775
+ accountHolderName: "",
776
+ accountNumber: "",
777
+ link: ""
759
778
  },
760
- tags: null
779
+ rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
780
+ stallCapacity: 0
761
781
  };
762
782
  var defaultStallholderFormValues = {
763
783
  ...globalDefaultValues,
@@ -943,7 +963,7 @@ function useStallholderApplyForm(data) {
943
963
  };
944
964
  }
945
965
 
946
- // src/hooks/useMarketForm.ts
966
+ // src/hooks/market/useMarketForm.ts
947
967
  var import_yup3 = require("@hookform/resolvers/yup");
948
968
  var React3 = __toESM(require("react"));
949
969
  var import_react_hook_form3 = require("react-hook-form");
@@ -978,7 +998,6 @@ function useMarketForm(data) {
978
998
  promoCode: data.promoCode,
979
999
  provider: data.provider,
980
1000
  region: data.region,
981
- stallApplicationInfo: data.stallApplicationInfo,
982
1001
  tags: data.tags
983
1002
  });
984
1003
  } else {
@@ -1000,7 +1019,6 @@ function useMarketForm(data) {
1000
1019
  name,
1001
1020
  provider,
1002
1021
  region,
1003
- stallApplicationInfo: stallApplicationInfo2,
1004
1022
  tags
1005
1023
  } = getValues();
1006
1024
  return {
@@ -1020,7 +1038,6 @@ function useMarketForm(data) {
1020
1038
  name,
1021
1039
  provider,
1022
1040
  region,
1023
- stallApplicationInfo: stallApplicationInfo2,
1024
1041
  tags
1025
1042
  },
1026
1043
  formState: { errors },
@@ -1031,10 +1048,76 @@ function useMarketForm(data) {
1031
1048
  };
1032
1049
  }
1033
1050
 
1034
- // src/hooks/useUserForm.ts
1051
+ // src/hooks/market/useMarketInfoForm.ts
1035
1052
  var import_yup4 = require("@hookform/resolvers/yup");
1036
1053
  var React4 = __toESM(require("react"));
1037
1054
  var import_react_hook_form4 = require("react-hook-form");
1055
+ function useMarketInfoForm(data) {
1056
+ const {
1057
+ control,
1058
+ formState: { errors },
1059
+ getValues,
1060
+ handleSubmit,
1061
+ reset,
1062
+ setValue,
1063
+ watch
1064
+ } = (0, import_react_hook_form4.useForm)({
1065
+ defaultValues: defaultMarketInfoFormValues,
1066
+ resolver: (0, import_yup4.yupResolver)(marketInfoSchema)
1067
+ });
1068
+ React4.useEffect(() => {
1069
+ if (data) {
1070
+ reset({
1071
+ _id: data._id,
1072
+ active: data.active,
1073
+ applicationDeadlineHours: data.applicationDeadlineHours,
1074
+ dateTime: data.dateTime,
1075
+ paymentDueHours: data.paymentDueHours,
1076
+ paymentMethod: data.paymentMethod,
1077
+ paymentTarget: data.paymentTarget,
1078
+ rejectionPolicy: data.rejectionPolicy,
1079
+ stallCapacity: data.stallCapacity
1080
+ });
1081
+ } else {
1082
+ reset(defaultMarketInfoFormValues);
1083
+ }
1084
+ }, [data]);
1085
+ const {
1086
+ _id,
1087
+ active,
1088
+ applicationDeadlineHours,
1089
+ dateTime,
1090
+ paymentDueHours,
1091
+ paymentMethod,
1092
+ paymentTarget,
1093
+ rejectionPolicy,
1094
+ stallCapacity
1095
+ } = getValues();
1096
+ return {
1097
+ control,
1098
+ fields: {
1099
+ _id,
1100
+ active,
1101
+ applicationDeadlineHours,
1102
+ dateTime,
1103
+ paymentDueHours,
1104
+ paymentMethod,
1105
+ paymentTarget,
1106
+ rejectionPolicy,
1107
+ stallCapacity
1108
+ },
1109
+ formState: { errors },
1110
+ handleSubmit,
1111
+ reset,
1112
+ setValue,
1113
+ watch
1114
+ };
1115
+ }
1116
+
1117
+ // src/hooks/useUserForm.ts
1118
+ var import_yup5 = require("@hookform/resolvers/yup");
1119
+ var React5 = __toESM(require("react"));
1120
+ var import_react_hook_form5 = require("react-hook-form");
1038
1121
  var defaultValues = {
1039
1122
  active: false,
1040
1123
  avatar: null,
@@ -1056,11 +1139,11 @@ function useUserForm(data) {
1056
1139
  reset,
1057
1140
  setValue,
1058
1141
  watch
1059
- } = (0, import_react_hook_form4.useForm)({
1142
+ } = (0, import_react_hook_form5.useForm)({
1060
1143
  defaultValues,
1061
- resolver: (0, import_yup4.yupResolver)(userSchema)
1144
+ resolver: (0, import_yup5.yupResolver)(userSchema)
1062
1145
  });
1063
- React4.useEffect(() => {
1146
+ React5.useEffect(() => {
1064
1147
  if (data) {
1065
1148
  reset({
1066
1149
  _id: data._id,
@@ -1116,8 +1199,8 @@ function useUserForm(data) {
1116
1199
  }
1117
1200
 
1118
1201
  // src/hooks/auth/useLoginForm.ts
1119
- var import_yup5 = require("@hookform/resolvers/yup");
1120
- var import_react_hook_form5 = require("react-hook-form");
1202
+ var import_yup6 = require("@hookform/resolvers/yup");
1203
+ var import_react_hook_form6 = require("react-hook-form");
1121
1204
  var defaultValues2 = {
1122
1205
  email: "",
1123
1206
  password: ""
@@ -1131,9 +1214,9 @@ function useLoginForm() {
1131
1214
  reset,
1132
1215
  setValue,
1133
1216
  watch
1134
- } = (0, import_react_hook_form5.useForm)({
1217
+ } = (0, import_react_hook_form6.useForm)({
1135
1218
  defaultValues: defaultValues2,
1136
- resolver: (0, import_yup5.yupResolver)(loginSchema)
1219
+ resolver: (0, import_yup6.yupResolver)(loginSchema)
1137
1220
  });
1138
1221
  const { email, password } = getValues();
1139
1222
  return {
@@ -1151,8 +1234,8 @@ function useLoginForm() {
1151
1234
  }
1152
1235
 
1153
1236
  // src/hooks/auth/useRegisterForm.ts
1154
- var import_yup6 = require("@hookform/resolvers/yup");
1155
- var import_react_hook_form6 = require("react-hook-form");
1237
+ var import_yup7 = require("@hookform/resolvers/yup");
1238
+ var import_react_hook_form7 = require("react-hook-form");
1156
1239
  var defaultValues3 = {
1157
1240
  email: "",
1158
1241
  firstName: "",
@@ -1170,9 +1253,9 @@ function useRegisterForm() {
1170
1253
  reset,
1171
1254
  setValue,
1172
1255
  watch
1173
- } = (0, import_react_hook_form6.useForm)({
1256
+ } = (0, import_react_hook_form7.useForm)({
1174
1257
  defaultValues: defaultValues3,
1175
- resolver: (0, import_yup6.yupResolver)(registerSchema)
1258
+ resolver: (0, import_yup7.yupResolver)(registerSchema)
1176
1259
  });
1177
1260
  const { email, firstName, lastName, password, preferredRegion, role } = getValues();
1178
1261
  return {
@@ -1194,8 +1277,8 @@ function useRegisterForm() {
1194
1277
  }
1195
1278
 
1196
1279
  // src/hooks/auth/useRequestPasswordResetForm.ts
1197
- var import_yup7 = require("@hookform/resolvers/yup");
1198
- var import_react_hook_form7 = require("react-hook-form");
1280
+ var import_yup8 = require("@hookform/resolvers/yup");
1281
+ var import_react_hook_form8 = require("react-hook-form");
1199
1282
  var defaultValues4 = {
1200
1283
  email: ""
1201
1284
  };
@@ -1208,9 +1291,9 @@ function useRequestPasswordResetForm() {
1208
1291
  reset,
1209
1292
  setValue,
1210
1293
  watch
1211
- } = (0, import_react_hook_form7.useForm)({
1294
+ } = (0, import_react_hook_form8.useForm)({
1212
1295
  defaultValues: defaultValues4,
1213
- resolver: (0, import_yup7.yupResolver)(requestPasswordResetSchema)
1296
+ resolver: (0, import_yup8.yupResolver)(requestPasswordResetSchema)
1214
1297
  });
1215
1298
  const { email } = getValues();
1216
1299
  return {
@@ -1227,8 +1310,8 @@ function useRequestPasswordResetForm() {
1227
1310
  }
1228
1311
 
1229
1312
  // src/hooks/auth/useValidateTokenForm.ts
1230
- var import_yup8 = require("@hookform/resolvers/yup");
1231
- var import_react_hook_form8 = require("react-hook-form");
1313
+ var import_yup9 = require("@hookform/resolvers/yup");
1314
+ var import_react_hook_form9 = require("react-hook-form");
1232
1315
  var defaultValues5 = {
1233
1316
  email: "",
1234
1317
  token: ""
@@ -1242,9 +1325,9 @@ function useValidateTokenForm() {
1242
1325
  reset,
1243
1326
  setValue,
1244
1327
  watch
1245
- } = (0, import_react_hook_form8.useForm)({
1328
+ } = (0, import_react_hook_form9.useForm)({
1246
1329
  defaultValues: defaultValues5,
1247
- resolver: (0, import_yup8.yupResolver)(validateTokenSchema)
1330
+ resolver: (0, import_yup9.yupResolver)(validateTokenSchema)
1248
1331
  });
1249
1332
  const { email, token } = getValues();
1250
1333
  return {
@@ -1262,8 +1345,8 @@ function useValidateTokenForm() {
1262
1345
  }
1263
1346
 
1264
1347
  // src/hooks/auth/useResetPasswordForm.ts
1265
- var import_yup9 = require("@hookform/resolvers/yup");
1266
- var import_react_hook_form9 = require("react-hook-form");
1348
+ var import_yup10 = require("@hookform/resolvers/yup");
1349
+ var import_react_hook_form10 = require("react-hook-form");
1267
1350
  var defaultValues6 = {
1268
1351
  confirmPassword: "",
1269
1352
  email: "",
@@ -1278,9 +1361,9 @@ function useResetPasswordForm() {
1278
1361
  reset,
1279
1362
  setValue,
1280
1363
  watch
1281
- } = (0, import_react_hook_form9.useForm)({
1364
+ } = (0, import_react_hook_form10.useForm)({
1282
1365
  defaultValues: defaultValues6,
1283
- resolver: (0, import_yup9.yupResolver)(resetPasswordSchema)
1366
+ resolver: (0, import_yup10.yupResolver)(resetPasswordSchema)
1284
1367
  });
1285
1368
  const { confirmPassword, email, password } = getValues();
1286
1369
  return {
@@ -1630,7 +1713,6 @@ var MARKET_DATETIME_FIELDS_FRAGMENT = import_client8.gql`
1630
1713
  fragment MarketDateTimeFields on MarketDateTimeType {
1631
1714
  endDate
1632
1715
  endTime
1633
- marketPrice
1634
1716
  startDate
1635
1717
  startTime
1636
1718
  }
@@ -1647,25 +1729,29 @@ var MARKET_LOCATION_FIELDS_FRAGMENT = import_client8.gql`
1647
1729
  type
1648
1730
  }
1649
1731
  `;
1650
- var PAYMENT_TARGET_FIELDS_FRAGMENT = import_client8.gql`
1651
- fragment PaymentTargetFields on PaymentTargetType {
1652
- accountHolderName
1653
- accountNumber
1654
- link
1655
- }
1656
- `;
1657
- var STALL_APPLICATION_INFO_FIELDS_FRAGMENT = import_client8.gql`
1658
- fragment StallApplicationInfoFields on StallApplicationInfoType {
1732
+ var MARKET_INFO = import_client8.gql`
1733
+ fragment MarketInfoFields on MarketInfoType {
1734
+ _id
1735
+ active
1659
1736
  applicationDeadlineHours
1737
+ dateTime {
1738
+ endDate
1739
+ endTime
1740
+ marketPrice
1741
+ startDate
1742
+ startTime
1743
+ }
1744
+ marketId
1660
1745
  paymentDueHours
1661
1746
  paymentMethod
1662
1747
  paymentTarget {
1663
- ...PaymentTargetFields
1748
+ accountHolderName
1749
+ accountNumber
1750
+ link
1664
1751
  }
1665
1752
  rejectionPolicy
1666
1753
  stallCapacity
1667
1754
  }
1668
- ${PAYMENT_TARGET_FIELDS_FRAGMENT}
1669
1755
  `;
1670
1756
  var MARKET = import_client8.gql`
1671
1757
  fragment MarketFields on MarketType {
@@ -1696,9 +1782,6 @@ var MARKET = import_client8.gql`
1696
1782
  provider
1697
1783
  region
1698
1784
  relationIds
1699
- stallApplicationInfo {
1700
- ...StallApplicationInfoFields
1701
- }
1702
1785
  tags
1703
1786
  updatedAt
1704
1787
  }
@@ -1706,7 +1789,6 @@ var MARKET = import_client8.gql`
1706
1789
  ${MARKET_LOCATION_FIELDS_FRAGMENT}
1707
1790
  ${OWNER_FIELDS_FRAGMENT}
1708
1791
  ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1709
- ${STALL_APPLICATION_INFO_FIELDS_FRAGMENT}
1710
1792
  `;
1711
1793
  var GET_MARKETS = import_client8.gql`
1712
1794
  query getMarkets {
@@ -1748,6 +1830,14 @@ var GET_MARKETS_NEAR_ME = import_client8.gql`
1748
1830
  }
1749
1831
  ${MARKET}
1750
1832
  `;
1833
+ var GET_MARKET_INFO = import_client8.gql`
1834
+ query getMarketInfo($_id: ID!) {
1835
+ marketInfo(_id: $_id) {
1836
+ ...MarketInfoFields
1837
+ }
1838
+ }
1839
+ ${MARKET_INFO}
1840
+ `;
1751
1841
 
1752
1842
  // src/graphql/mutations/market.ts
1753
1843
  var CREATE_MARKET_MUTATION = import_client9.gql`
@@ -1771,6 +1861,22 @@ var DELETE_MARKET_MUTATION = import_client9.gql`
1771
1861
  deleteMarket(_id: $_id)
1772
1862
  }
1773
1863
  `;
1864
+ var CREATE_MARKET_INFO_MUTATION = import_client9.gql`
1865
+ mutation createMarketInfo($input: MarketInfoInputType!) {
1866
+ createMarketInfo(input: $input) {
1867
+ ...MarketInfoFields
1868
+ }
1869
+ }
1870
+ ${MARKET_INFO}
1871
+ `;
1872
+ var UPDATE_MARKET_INFO_MUTATION = import_client9.gql`
1873
+ mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
1874
+ updateMarketInfo(_id: $_id, input: $input) {
1875
+ ...MarketInfoFields
1876
+ }
1877
+ }
1878
+ ${MARKET_INFO}
1879
+ `;
1774
1880
 
1775
1881
  // src/graphql/queries/user.ts
1776
1882
  var import_client11 = require("@apollo/client");
@@ -1991,6 +2097,46 @@ var useDeleteMarket = () => {
1991
2097
  );
1992
2098
  return { deleteMarket, error, loading };
1993
2099
  };
2100
+ var useCreateMarketInfo = () => {
2101
+ const [createMarketInfo, { loading, error }] = (0, import_client12.useMutation)(
2102
+ CREATE_MARKET_INFO_MUTATION,
2103
+ {
2104
+ awaitRefetchQueries: true,
2105
+ refetchQueries: (mutationResult) => {
2106
+ const marketId = mutationResult?.data?.createMarketInfo?.stallholderId;
2107
+ if (!marketId) return [];
2108
+ return [
2109
+ {
2110
+ query: GET_MARKET_INFO,
2111
+ variables: { marketId }
2112
+ // Pass the marketId for refetching
2113
+ }
2114
+ ];
2115
+ }
2116
+ }
2117
+ );
2118
+ return { createMarketInfo, error, loading };
2119
+ };
2120
+ var useUpdateMarketInfo = () => {
2121
+ const [updateMarketInfo, { loading, error }] = (0, import_client12.useMutation)(
2122
+ UPDATE_MARKET_INFO_MUTATION,
2123
+ {
2124
+ awaitRefetchQueries: true,
2125
+ refetchQueries: (mutationResult) => {
2126
+ const marketId = mutationResult?.data?.updateMarketInfo?.marketId;
2127
+ if (!marketId) return [];
2128
+ return [
2129
+ {
2130
+ query: GET_MARKET_INFO,
2131
+ variables: { marketId }
2132
+ // Pass the marketId for refetching
2133
+ }
2134
+ ];
2135
+ }
2136
+ }
2137
+ );
2138
+ return { error, loading, updateMarketInfo };
2139
+ };
1994
2140
 
1995
2141
  // src/graphql/hooks/market/hooksQuery.ts
1996
2142
  var import_client13 = require("@apollo/client");
@@ -2042,6 +2188,15 @@ var useGetMarketsNearMe = (location) => {
2042
2188
  const markets = data?.marketsNearMe;
2043
2189
  return { error, loading, markets, refetch };
2044
2190
  };
2191
+ var useGetMarketInfo = (marketId) => {
2192
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_MARKET_INFO, {
2193
+ fetchPolicy: "network-only",
2194
+ skip: !marketId,
2195
+ variables: { marketId }
2196
+ });
2197
+ const marketInfo = data?.marketInfo;
2198
+ return { error, loading, marketInfo, refetch };
2199
+ };
2045
2200
 
2046
2201
  // src/graphql/hooks/poster.ts
2047
2202
  var import_client15 = require("@apollo/client");
@@ -2595,6 +2750,8 @@ var useGetStallholderApplyForm = (stallholderId) => {
2595
2750
  const { loading, error, data, refetch } = (0, import_client22.useQuery)(
2596
2751
  GET_STALLHOLDER_APPLY_FORM,
2597
2752
  {
2753
+ fetchPolicy: "network-only",
2754
+ skip: !stallholderId,
2598
2755
  variables: { stallholderId }
2599
2756
  }
2600
2757
  );
@@ -2804,7 +2961,7 @@ var useGetUserNotifications = () => {
2804
2961
  return { error, loading, refetch, userNotifications };
2805
2962
  };
2806
2963
 
2807
- // src/formFields/stallholder/createEditStallholder.ts
2964
+ // src/formFields/stallholder/stallholder.ts
2808
2965
  var stallholderBasicInfoFields = [
2809
2966
  {
2810
2967
  helperText: "Business Name of the Stallholder *",
@@ -2973,7 +3130,7 @@ var producedIngTypes = [
2973
3130
  var packagingOptions = mapArrayToOptions(packagingTypes);
2974
3131
  var producedIngOptions = mapArrayToOptions(producedIngTypes);
2975
3132
 
2976
- // src/formFields/market.ts
3133
+ // src/formFields/market/market.ts
2977
3134
  var marketBasicInfoFields = [
2978
3135
  {
2979
3136
  helperText: "Name of the Market *",
@@ -2997,43 +3154,6 @@ var marketBasicInfoFields = [
2997
3154
  placeholder: "Promo code"
2998
3155
  }
2999
3156
  ];
3000
- var stallApplicationInfo = [
3001
- {
3002
- helperText: "Application Deadline of the Market *",
3003
- keyboardType: "number-pad",
3004
- name: "stallApplicationInfo.applicationDeadlineHours",
3005
- placeholder: "Application Deadline Hours"
3006
- },
3007
- {
3008
- helperText: "Stall Capacity of the Market *",
3009
- keyboardType: "number-pad",
3010
- name: "stallApplicationInfo.stallCapacity",
3011
- placeholder: "Stall Capacity"
3012
- },
3013
- {
3014
- helperText: "Payment Due Hours of the Market *",
3015
- keyboardType: "number-pad",
3016
- name: "stallApplicationInfo.paymentDueHours",
3017
- placeholder: "Payment Due Hours"
3018
- }
3019
- ];
3020
- var stallApplicationInfoPaymentTarget = [
3021
- {
3022
- helperText: "Account holder name *",
3023
- name: "stallApplicationInfo.paymentTarget.accountHolderName",
3024
- placeholder: "Account holder name"
3025
- },
3026
- {
3027
- helperText: "Account number *",
3028
- name: "stallApplicationInfo.paymentTarget.accountNumber",
3029
- placeholder: "Account number"
3030
- },
3031
- {
3032
- helperText: "Link to payment target *",
3033
- name: "stallApplicationInfo.paymentTarget.link",
3034
- placeholder: "Link to payment target"
3035
- }
3036
- ];
3037
3157
  var marketStartDateFields = [
3038
3158
  {
3039
3159
  dateMode: "date",
@@ -3048,14 +3168,6 @@ var marketStartDateFields = [
3048
3168
  placeholder: "Start Time"
3049
3169
  }
3050
3170
  ];
3051
- var marketPriceByDateFields = [
3052
- {
3053
- helperText: "Market Price for this date *",
3054
- keyboardType: "number-pad",
3055
- name: "marketPrice",
3056
- placeholder: "Market Price"
3057
- }
3058
- ];
3059
3171
  var marketEndDateFields = [
3060
3172
  {
3061
3173
  dateMode: "date",
@@ -3089,6 +3201,53 @@ var availableTagTypes = [
3089
3201
  "Port Nearby"
3090
3202
  ];
3091
3203
  var tagOptions = mapArrayToOptions(availableTagTypes);
3204
+
3205
+ // src/formFields/market/marketInfo.ts
3206
+ var stallApplicationInfo = [
3207
+ {
3208
+ helperText: "Application Deadline of the Market *",
3209
+ keyboardType: "number-pad",
3210
+ name: "stallApplicationInfo.applicationDeadlineHours",
3211
+ placeholder: "Application Deadline Hours"
3212
+ },
3213
+ {
3214
+ helperText: "Stall Capacity of the Market *",
3215
+ keyboardType: "number-pad",
3216
+ name: "stallApplicationInfo.stallCapacity",
3217
+ placeholder: "Stall Capacity"
3218
+ },
3219
+ {
3220
+ helperText: "Payment Due Hours of the Market *",
3221
+ keyboardType: "number-pad",
3222
+ name: "stallApplicationInfo.paymentDueHours",
3223
+ placeholder: "Payment Due Hours"
3224
+ }
3225
+ ];
3226
+ var stallApplicationInfoPaymentTarget = [
3227
+ {
3228
+ helperText: "Account holder name *",
3229
+ name: "stallApplicationInfo.paymentTarget.accountHolderName",
3230
+ placeholder: "Account holder name"
3231
+ },
3232
+ {
3233
+ helperText: "Account number *",
3234
+ name: "stallApplicationInfo.paymentTarget.accountNumber",
3235
+ placeholder: "Account number"
3236
+ },
3237
+ {
3238
+ helperText: "Link to payment target *",
3239
+ name: "stallApplicationInfo.paymentTarget.link",
3240
+ placeholder: "Link to payment target"
3241
+ }
3242
+ ];
3243
+ var marketPriceByDateFields = [
3244
+ {
3245
+ helperText: "Market Price for this date *",
3246
+ keyboardType: "number-pad",
3247
+ name: "marketPrice",
3248
+ placeholder: "Market Price"
3249
+ }
3250
+ ];
3092
3251
  var rejectionPolicyOptions = mapArrayToOptions(
3093
3252
  Object.values(EnumRejectionPolicy)
3094
3253
  );
@@ -3536,6 +3695,7 @@ var categoryColors = {
3536
3695
  categoryColors,
3537
3696
  dateFormat,
3538
3697
  defaultMarketFormValues,
3698
+ defaultMarketInfoFormValues,
3539
3699
  defaultRegion,
3540
3700
  defaultStallholderApplyFormValues,
3541
3701
  defaultStallholderFormValues,
@@ -3584,6 +3744,7 @@ var categoryColors = {
3584
3744
  useAddUserFavouriteResource,
3585
3745
  useCreateChat,
3586
3746
  useCreateMarket,
3747
+ useCreateMarketInfo,
3587
3748
  useCreatePoster,
3588
3749
  useCreateRelation,
3589
3750
  useCreateStallholder,
@@ -3596,6 +3757,7 @@ var categoryColors = {
3596
3757
  useGetChat,
3597
3758
  useGetChatSubscription,
3598
3759
  useGetMarket,
3760
+ useGetMarketInfo,
3599
3761
  useGetMarketRelations,
3600
3762
  useGetMarkets,
3601
3763
  useGetMarketsByRegion,
@@ -3619,6 +3781,7 @@ var categoryColors = {
3619
3781
  useLogin,
3620
3782
  useLoginForm,
3621
3783
  useMarketForm,
3784
+ useMarketInfoForm,
3622
3785
  useRegister,
3623
3786
  useRegisterForm,
3624
3787
  useRemoveParticipantFromChat,
@@ -3633,6 +3796,7 @@ var categoryColors = {
3633
3796
  useStallholderApplyForm,
3634
3797
  useStallholderForm,
3635
3798
  useUpdateMarket,
3799
+ useUpdateMarketInfo,
3636
3800
  useUpdateRelation,
3637
3801
  useUpdateStallholder,
3638
3802
  useUpdateStallholderApplyForm,