@timardex/cluemart-shared 1.0.56 → 1.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -59,8 +59,8 @@ __export(index_exports, {
59
59
  defaultMarketFormValues: () => defaultMarketFormValues,
60
60
  defaultMarketInfoFormValues: () => defaultMarketInfoFormValues,
61
61
  defaultRegion: () => defaultRegion,
62
- defaultStallholderApplyFormValues: () => defaultStallholderApplyFormValues,
63
62
  defaultStallholderFormValues: () => defaultStallholderFormValues,
63
+ defaultStallholderInfoFormValues: () => defaultStallholderInfoFormValues,
64
64
  formatDate: () => formatDate,
65
65
  formatTimestamp: () => formatTimestamp,
66
66
  getCurrentAndFutureDates: () => getCurrentAndFutureDates,
@@ -116,7 +116,7 @@ __export(index_exports, {
116
116
  useCreatePoster: () => useCreatePoster,
117
117
  useCreateRelation: () => useCreateRelation,
118
118
  useCreateStallholder: () => useCreateStallholder,
119
- useCreateStallholderApplyForm: () => useCreateStallholderApplyForm,
119
+ useCreateStallholderInfo: () => useCreateStallholderInfo,
120
120
  useCreateTester: () => useCreateTester,
121
121
  useCreateUser: () => useCreateUser,
122
122
  useDeleteChat: () => useDeleteChat,
@@ -137,7 +137,7 @@ __export(index_exports, {
137
137
  useGetRelationByMarketAndStallholder: () => useGetRelationByMarketAndStallholder,
138
138
  useGetResourceConnections: () => useGetResourceConnections,
139
139
  useGetStallholder: () => useGetStallholder,
140
- useGetStallholderApplyForm: () => useGetStallholderApplyForm,
140
+ useGetStallholderInfo: () => useGetStallholderInfo,
141
141
  useGetStallholderRelations: () => useGetStallholderRelations,
142
142
  useGetStallholders: () => useGetStallholders,
143
143
  useGetStallholdersByRegion: () => useGetStallholdersByRegion,
@@ -168,14 +168,14 @@ __export(index_exports, {
168
168
  useSearchMarkets: () => useSearchMarkets,
169
169
  useSearchStallholders: () => useSearchStallholders,
170
170
  useSendChatMessage: () => useSendChatMessage,
171
- useStallholderApplyForm: () => useStallholderApplyForm,
172
171
  useStallholderForm: () => useStallholderForm,
172
+ useStallholderInfoForm: () => useStallholderInfoForm,
173
173
  useTestersForm: () => useTestersForm,
174
174
  useUpdateMarket: () => useUpdateMarket,
175
175
  useUpdateMarketInfo: () => useUpdateMarketInfo,
176
176
  useUpdateRelation: () => useUpdateRelation,
177
177
  useUpdateStallholder: () => useUpdateStallholder,
178
- useUpdateStallholderApplyForm: () => useUpdateStallholderApplyForm,
178
+ useUpdateStallholderInfo: () => useUpdateStallholderInfo,
179
179
  useUpdateTester: () => useUpdateTester,
180
180
  useUpdateUser: () => useUpdateUser,
181
181
  useUserForm: () => useUserForm,
@@ -666,7 +666,7 @@ var stallHolderSchema = globalResourceSchema.shape({
666
666
  multiLocation: yup3.boolean().required("Multi location is required"),
667
667
  products: yup3.array().of(yup3.string().defined()).min(1, "Product list must contain at least one item").required("Products are required")
668
668
  });
669
- var stallholderApplyFormSchema = yup3.object().shape({
669
+ var stallholderInfoSchema = yup3.object().shape({
670
670
  electricity: yup3.object().shape({
671
671
  details: yup3.string().trim().test("details-required", "Please add details", function(value) {
672
672
  return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
@@ -849,7 +849,7 @@ var defaultStallholderFormValues = {
849
849
  products: [],
850
850
  specialities: null
851
851
  };
852
- var defaultStallholderApplyFormValues = {
852
+ var defaultStallholderInfoFormValues = {
853
853
  electricity: { details: null, isRequired: false },
854
854
  foodSafetyGradeFiles: null,
855
855
  foodSafetyGradeFilesUpload: null,
@@ -958,11 +958,11 @@ function useStallholderForm(data) {
958
958
  };
959
959
  }
960
960
 
961
- // src/hooks/stallholder/useStallholderApplyForm.ts
961
+ // src/hooks/stallholder/useStallholderInfoForm.ts
962
962
  var import_yup2 = require("@hookform/resolvers/yup");
963
963
  var React2 = __toESM(require("react"));
964
964
  var import_react_hook_form2 = require("react-hook-form");
965
- function useStallholderApplyForm(data) {
965
+ function useStallholderInfoForm(data) {
966
966
  const {
967
967
  control,
968
968
  formState: { errors },
@@ -972,8 +972,8 @@ function useStallholderApplyForm(data) {
972
972
  setValue,
973
973
  watch
974
974
  } = (0, import_react_hook_form2.useForm)({
975
- defaultValues: defaultStallholderApplyFormValues,
976
- resolver: (0, import_yup2.yupResolver)(stallholderApplyFormSchema)
975
+ defaultValues: defaultStallholderInfoFormValues,
976
+ resolver: (0, import_yup2.yupResolver)(stallholderInfoSchema)
977
977
  });
978
978
  React2.useEffect(() => {
979
979
  if (data) {
@@ -992,7 +992,7 @@ function useStallholderApplyForm(data) {
992
992
  table: data.table
993
993
  });
994
994
  } else {
995
- reset(defaultStallholderApplyFormValues);
995
+ reset(defaultStallholderInfoFormValues);
996
996
  }
997
997
  }, [data]);
998
998
  const {
@@ -2181,8 +2181,8 @@ var STALLHOLDER = import_client10.gql`
2181
2181
  ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
2182
2182
  ${SOCIAL_MEDIA_FIELDS_FRAGMENT}
2183
2183
  `;
2184
- var STALLHOLDER_APPLY_FORM = import_client10.gql`
2185
- fragment StallholderApplyFormFields on StallholderApplyFormType {
2184
+ var STALLHOLDER_INFO = import_client10.gql`
2185
+ fragment StallholderInfoFields on StallholderInfoType {
2186
2186
  _id
2187
2187
  electricity {
2188
2188
  details
@@ -2243,13 +2243,13 @@ var SEARCH_STALLHOLDERS = import_client10.gql`
2243
2243
  }
2244
2244
  ${STALLHOLDER}
2245
2245
  `;
2246
- var GET_STALLHOLDER_APPLY_FORM = import_client10.gql`
2247
- query getStallholderApplyForm($stallholderId: ID!) {
2248
- stallholderApplyForm(stallholderId: $stallholderId) {
2249
- ...StallholderApplyFormFields
2246
+ var GET_STALLHOLDER_INFO = import_client10.gql`
2247
+ query getStallholderInfo($stallholderId: ID!) {
2248
+ stallholderInfo(stallholderId: $stallholderId) {
2249
+ ...StallholderInfoFields
2250
2250
  }
2251
2251
  }
2252
- ${STALLHOLDER_APPLY_FORM}
2252
+ ${STALLHOLDER_INFO}
2253
2253
  `;
2254
2254
 
2255
2255
  // src/graphql/queries/user.ts
@@ -2411,8 +2411,8 @@ var useGetMarketsByRegion = (region) => {
2411
2411
  skip: !region,
2412
2412
  variables: { region }
2413
2413
  });
2414
- const markets = data?.marketsByRegion;
2415
- return { error, loading, markets, refetch };
2414
+ const marketsByRegion = data?.marketsByRegion;
2415
+ return { error, loading, marketsByRegion, refetch };
2416
2416
  };
2417
2417
  var useSearchMarkets = (search, region) => {
2418
2418
  const { loading, error, data, refetch } = (0, import_client13.useQuery)(SEARCH_MARKETS, {
@@ -2420,8 +2420,8 @@ var useSearchMarkets = (search, region) => {
2420
2420
  skip: search.length < 3,
2421
2421
  variables: { region, search }
2422
2422
  });
2423
- const markets = data?.marketSearch;
2424
- return { error, loading, markets, refetch };
2423
+ const marketsSearch = data?.marketSearch;
2424
+ return { error, loading, marketsSearch, refetch };
2425
2425
  };
2426
2426
  var useGetMarketsNearMe = (location) => {
2427
2427
  const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_MARKETS_NEAR_ME, {
@@ -2434,8 +2434,8 @@ var useGetMarketsNearMe = (location) => {
2434
2434
  // Default to 10km if no radius is provided
2435
2435
  }
2436
2436
  });
2437
- const markets = data?.marketsNearMe;
2438
- return { error, loading, markets, refetch };
2437
+ const marketsNearMe = data?.marketsNearMe;
2438
+ return { error, loading, marketsNearMe, refetch };
2439
2439
  };
2440
2440
  var useGetMarketInfo = (marketId) => {
2441
2441
  const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_MARKET_INFO, {
@@ -2789,6 +2789,9 @@ var useDeleteRelation = () => {
2789
2789
  {
2790
2790
  query: GET_RELATION_BY_MARKET_AND_STALLHOLDER,
2791
2791
  variables: { marketId, stallholderId }
2792
+ },
2793
+ {
2794
+ query: USER_CHATS
2792
2795
  }
2793
2796
  ];
2794
2797
  }
@@ -2876,24 +2879,21 @@ var DELETE_STALLHOLDER_MUTATION = import_client20.gql`
2876
2879
  deleteStallholder(_id: $_id)
2877
2880
  }
2878
2881
  `;
2879
- var CREATE_STALLHOLDER_APPLY_FORM_MUTATION = import_client20.gql`
2880
- mutation createStallholderApplyForm($input: StallholderApplyFormInputType!) {
2881
- createStallholderApplyForm(input: $input) {
2882
- ...StallholderApplyFormFields
2882
+ var CREATE_STALLHOLDER_INFO_MUTATION = import_client20.gql`
2883
+ mutation createStallholderInfo($input: StallholderInfoInputType!) {
2884
+ createStallholderInfo(input: $input) {
2885
+ ...StallholderInfoFields
2883
2886
  }
2884
2887
  }
2885
- ${STALLHOLDER_APPLY_FORM}
2888
+ ${STALLHOLDER_INFO}
2886
2889
  `;
2887
- var UPDATE_STALLHOLDER_APPLY_FORM_MUTATION = import_client20.gql`
2888
- mutation updateStallholderApplyForm(
2889
- $_id: ID!
2890
- $input: StallholderApplyFormInputType!
2891
- ) {
2892
- updateStallholderApplyForm(_id: $_id, input: $input) {
2893
- ...StallholderApplyFormFields
2890
+ var UPDATE_STALLHOLDER_INFO_MUTATION = import_client20.gql`
2891
+ mutation updateStallholderInfo($_id: ID!, $input: StallholderInfoInputType!) {
2892
+ updateStallholderInfo(_id: $_id, input: $input) {
2893
+ ...StallholderInfoFields
2894
2894
  }
2895
2895
  }
2896
- ${STALLHOLDER_APPLY_FORM}
2896
+ ${STALLHOLDER_INFO}
2897
2897
  `;
2898
2898
 
2899
2899
  // src/graphql/hooks/stallholder/hooksMutation.ts
@@ -2936,17 +2936,17 @@ var useDeleteStallholder = () => {
2936
2936
  );
2937
2937
  return { deleteStallholder, error, loading };
2938
2938
  };
2939
- var useCreateStallholderApplyForm = () => {
2940
- const [createStallholderApplyForm, { loading, error }] = (0, import_client21.useMutation)(
2941
- CREATE_STALLHOLDER_APPLY_FORM_MUTATION,
2939
+ var useCreateStallholderInfo = () => {
2940
+ const [createStallholderInfo, { loading, error }] = (0, import_client21.useMutation)(
2941
+ CREATE_STALLHOLDER_INFO_MUTATION,
2942
2942
  {
2943
2943
  awaitRefetchQueries: true,
2944
2944
  refetchQueries: (mutationResult) => {
2945
- const stallholderId = mutationResult?.data?.createStallholderApplyForm?.stallholderId;
2945
+ const stallholderId = mutationResult?.data?.createStallholderInfo?.stallholderId;
2946
2946
  if (!stallholderId) return [];
2947
2947
  return [
2948
2948
  {
2949
- query: GET_STALLHOLDER_APPLY_FORM,
2949
+ query: GET_STALLHOLDER_INFO,
2950
2950
  variables: { stallholderId }
2951
2951
  // Pass the stallholderId for refetching
2952
2952
  }
@@ -2954,19 +2954,19 @@ var useCreateStallholderApplyForm = () => {
2954
2954
  }
2955
2955
  }
2956
2956
  );
2957
- return { createStallholderApplyForm, error, loading };
2957
+ return { createStallholderInfo, error, loading };
2958
2958
  };
2959
- var useUpdateStallholderApplyForm = () => {
2960
- const [updateStallholderApplyForm, { loading, error }] = (0, import_client21.useMutation)(
2961
- UPDATE_STALLHOLDER_APPLY_FORM_MUTATION,
2959
+ var useUpdateStallholderInfo = () => {
2960
+ const [updateStallholderInfo, { loading, error }] = (0, import_client21.useMutation)(
2961
+ UPDATE_STALLHOLDER_INFO_MUTATION,
2962
2962
  {
2963
2963
  awaitRefetchQueries: true,
2964
2964
  refetchQueries: (mutationResult) => {
2965
- const stallholderId = mutationResult?.data?.createStallholderApplyForm?.stallholderId;
2965
+ const stallholderId = mutationResult?.data?.updateStallholderInfo?.stallholderId;
2966
2966
  if (!stallholderId) return [];
2967
2967
  return [
2968
2968
  {
2969
- query: GET_STALLHOLDER_APPLY_FORM,
2969
+ query: GET_STALLHOLDER_INFO,
2970
2970
  variables: { stallholderId }
2971
2971
  // Pass the stallholderId for refetching
2972
2972
  }
@@ -2974,7 +2974,7 @@ var useUpdateStallholderApplyForm = () => {
2974
2974
  }
2975
2975
  }
2976
2976
  );
2977
- return { error, loading, updateStallholderApplyForm };
2977
+ return { error, loading, updateStallholderInfo };
2978
2978
  };
2979
2979
 
2980
2980
  // src/graphql/hooks/stallholder/hooksQuery.ts
@@ -3009,8 +3009,8 @@ var useGetStallholdersByRegion = (region) => {
3009
3009
  variables: { region }
3010
3010
  }
3011
3011
  );
3012
- const stallholders = data?.stallholdersByRegion;
3013
- return { error, loading, refetch, stallholders };
3012
+ const stallholdersByRegion = data?.stallholdersByRegion;
3013
+ return { error, loading, refetch, stallholdersByRegion };
3014
3014
  };
3015
3015
  var useSearchStallholders = (search, region) => {
3016
3016
  const { loading, error, data, refetch } = (0, import_client22.useQuery)(SEARCH_STALLHOLDERS, {
@@ -3018,24 +3018,21 @@ var useSearchStallholders = (search, region) => {
3018
3018
  skip: search.length < 3,
3019
3019
  variables: { region, search }
3020
3020
  });
3021
- const stallholders = data?.stallholderSearch;
3022
- return { error, loading, refetch, stallholders };
3021
+ const stallholderSearch = data?.stallholderSearch;
3022
+ return { error, loading, refetch, stallholderSearch };
3023
3023
  };
3024
- var useGetStallholderApplyForm = (stallholderId) => {
3025
- const { loading, error, data, refetch } = (0, import_client22.useQuery)(
3026
- GET_STALLHOLDER_APPLY_FORM,
3027
- {
3028
- fetchPolicy: "network-only",
3029
- skip: !stallholderId,
3030
- variables: { stallholderId }
3031
- }
3032
- );
3033
- const applyForm = data?.stallholderApplyForm;
3024
+ var useGetStallholderInfo = (stallholderId) => {
3025
+ const { loading, error, data, refetch } = (0, import_client22.useQuery)(GET_STALLHOLDER_INFO, {
3026
+ fetchPolicy: "network-only",
3027
+ skip: !stallholderId,
3028
+ variables: { stallholderId }
3029
+ });
3030
+ const stallholderInfo = data?.stallholderInfo;
3034
3031
  return {
3035
- applyForm,
3036
3032
  error,
3037
3033
  loading,
3038
- refetch
3034
+ refetch,
3035
+ stallholderInfo
3039
3036
  };
3040
3037
  };
3041
3038
 
@@ -3445,7 +3442,7 @@ var availableCityTypes = [
3445
3442
  ];
3446
3443
  var availableCityOptions = mapArrayToOptions(availableCityTypes);
3447
3444
 
3448
- // src/formFields/stallholder/stallholderApplyForm.ts
3445
+ // src/formFields/stallholder/stallholderInfo.ts
3449
3446
  var stallholderElectricity = {
3450
3447
  details: {
3451
3448
  helperText: "Please describe details e.g. amps, voltage, etc.",
@@ -4429,8 +4426,8 @@ var USER_STORAGE_KEY = "authUser";
4429
4426
  defaultMarketFormValues,
4430
4427
  defaultMarketInfoFormValues,
4431
4428
  defaultRegion,
4432
- defaultStallholderApplyFormValues,
4433
4429
  defaultStallholderFormValues,
4430
+ defaultStallholderInfoFormValues,
4434
4431
  formatDate,
4435
4432
  formatTimestamp,
4436
4433
  getCurrentAndFutureDates,
@@ -4486,7 +4483,7 @@ var USER_STORAGE_KEY = "authUser";
4486
4483
  useCreatePoster,
4487
4484
  useCreateRelation,
4488
4485
  useCreateStallholder,
4489
- useCreateStallholderApplyForm,
4486
+ useCreateStallholderInfo,
4490
4487
  useCreateTester,
4491
4488
  useCreateUser,
4492
4489
  useDeleteChat,
@@ -4507,7 +4504,7 @@ var USER_STORAGE_KEY = "authUser";
4507
4504
  useGetRelationByMarketAndStallholder,
4508
4505
  useGetResourceConnections,
4509
4506
  useGetStallholder,
4510
- useGetStallholderApplyForm,
4507
+ useGetStallholderInfo,
4511
4508
  useGetStallholderRelations,
4512
4509
  useGetStallholders,
4513
4510
  useGetStallholdersByRegion,
@@ -4538,14 +4535,14 @@ var USER_STORAGE_KEY = "authUser";
4538
4535
  useSearchMarkets,
4539
4536
  useSearchStallholders,
4540
4537
  useSendChatMessage,
4541
- useStallholderApplyForm,
4542
4538
  useStallholderForm,
4539
+ useStallholderInfoForm,
4543
4540
  useTestersForm,
4544
4541
  useUpdateMarket,
4545
4542
  useUpdateMarketInfo,
4546
4543
  useUpdateRelation,
4547
4544
  useUpdateStallholder,
4548
- useUpdateStallholderApplyForm,
4545
+ useUpdateStallholderInfo,
4549
4546
  useUpdateTester,
4550
4547
  useUpdateUser,
4551
4548
  useUserForm,