@timardex/cluemart-shared 1.0.59 → 1.0.61
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/{chunk-WGEUNGLF.mjs → chunk-P6GA67G6.mjs} +14 -18
- package/dist/chunk-P6GA67G6.mjs.map +1 -0
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.mjs +1 -1
- package/dist/graphql/index.cjs +21 -4
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +6 -1
- package/dist/graphql/index.d.ts +6 -1
- package/dist/graphql/index.mjs +20 -4
- package/dist/graphql/index.mjs.map +1 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.cjs +36 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.mjs +33 -21
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.cjs +15 -19
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +4 -7
- package/dist/utils/index.d.ts +4 -7
- package/dist/utils/index.mjs +5 -5
- package/package.json +1 -1
- package/dist/chunk-WGEUNGLF.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -592,13 +592,10 @@ declare const getCurrentAndFutureDates: <T extends {
|
|
|
592
592
|
startDate: string;
|
|
593
593
|
startTime: string;
|
|
594
594
|
}>(dates: T[]) => T[];
|
|
595
|
-
declare const
|
|
595
|
+
declare const isFutureDatesBeforeThreshold: (date: {
|
|
596
596
|
startDate: string;
|
|
597
597
|
startTime: string;
|
|
598
|
-
}
|
|
599
|
-
startDate: string;
|
|
600
|
-
startTime: string;
|
|
601
|
-
}[];
|
|
598
|
+
}, minHoursFromNow: number) => boolean;
|
|
602
599
|
declare const formatTimestamp: (timestamp: string) => string;
|
|
603
600
|
declare const defaultRegion: Region;
|
|
604
601
|
/**
|
|
@@ -630,7 +627,7 @@ declare const statusOptions: {
|
|
|
630
627
|
* @param dates - The array of date strings to sort.
|
|
631
628
|
* @returns - The sorted array of date strings.
|
|
632
629
|
*/
|
|
633
|
-
declare function
|
|
630
|
+
declare function sortDatesChronologically<T extends {
|
|
634
631
|
startDate: string;
|
|
635
632
|
startTime: string;
|
|
636
633
|
}>(dates: T[]): T[];
|
|
@@ -998,6 +995,11 @@ declare const useUpdateUser: () => {
|
|
|
998
995
|
loading: boolean;
|
|
999
996
|
updateUser: (options?: _apollo_client.MutationFunctionOptions<any, _apollo_client.OperationVariables, _apollo_client.DefaultContext, _apollo_client.ApolloCache<any>> | undefined) => Promise<_apollo_client.FetchResult<any>>;
|
|
1000
997
|
};
|
|
998
|
+
declare const useDeleteUser: () => {
|
|
999
|
+
deleteUser: (options?: _apollo_client.MutationFunctionOptions<any, _apollo_client.OperationVariables, _apollo_client.DefaultContext, _apollo_client.ApolloCache<any>> | undefined) => Promise<_apollo_client.FetchResult<any>>;
|
|
1000
|
+
error: _apollo_client.ApolloError | undefined;
|
|
1001
|
+
loading: boolean;
|
|
1002
|
+
};
|
|
1001
1003
|
declare const useAddUserFavouriteResource: () => {
|
|
1002
1004
|
addUserFavouriteResource: (options?: _apollo_client.MutationFunctionOptions<any, _apollo_client.OperationVariables, _apollo_client.DefaultContext, _apollo_client.ApolloCache<any>> | undefined) => Promise<_apollo_client.FetchResult<any>>;
|
|
1003
1005
|
error: _apollo_client.ApolloError | undefined;
|
|
@@ -1157,4 +1159,4 @@ declare const SAVED_TOKEN_KEY = "savedToken";
|
|
|
1157
1159
|
declare const SAVED_REFRESH_TOKEN_KEY = "savedRefreshToken";
|
|
1158
1160
|
declare const USER_STORAGE_KEY = "authUser";
|
|
1159
1161
|
|
|
1160
|
-
export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type ContactUsFormData, type CreateContactUsFormData, type CreateLoginFormData, type CreateMarketFormData, type CreateMarketInfoFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderFormData, type CreateStallholderInfoFormData, type CreateTestersFormData, type CreateUserFormData, type CreateValidateVerificationTokenFormData, type DateTimeType, type DateTimeWithPriceType, EnumInviteStatus, EnumNotification, EnumOSType, EnumPaymentMethod, EnumRegions, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumSocialMedia, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketInfoFormData, type MarketInfoType, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type Nullable, type OptionItem, type PaymentInfoType, type PlacePrediction, type PosterInputType, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type Requirement, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, SAVED_EMAIL_KEY, SAVED_PASSWORD_KEY, SAVED_REFRESH_TOKEN_KEY, SAVED_TOKEN_KEY, type SatllholderWithConnectionDatesType, type SocialMediaType, type StallType, type StallholderAttributes, type StallholderFormData, type StallholderInfoFormData, type StallholderInfoType, type StallholderLocation, type StallholderType, type Subcategory, type TesterType, type TestersFormData, USER_STORAGE_KEY, type UserFormData, type UserType, type ValidateVerificationTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, contactUsFields, dateFormat, defaultMarketFormValues, defaultMarketInfoFormValues, defaultRegion, defaultStallholderFormValues, defaultStallholderInfoFormValues, formatDate, formatTimestamp, getCurrentAndFutureDates,
|
|
1162
|
+
export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type ContactUsFormData, type CreateContactUsFormData, type CreateLoginFormData, type CreateMarketFormData, type CreateMarketInfoFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderFormData, type CreateStallholderInfoFormData, type CreateTestersFormData, type CreateUserFormData, type CreateValidateVerificationTokenFormData, type DateTimeType, type DateTimeWithPriceType, EnumInviteStatus, EnumNotification, EnumOSType, EnumPaymentMethod, EnumRegions, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumSocialMedia, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketInfoFormData, type MarketInfoType, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type Nullable, type OptionItem, type PaymentInfoType, type PlacePrediction, type PosterInputType, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type Requirement, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, SAVED_EMAIL_KEY, SAVED_PASSWORD_KEY, SAVED_REFRESH_TOKEN_KEY, SAVED_TOKEN_KEY, type SatllholderWithConnectionDatesType, type SocialMediaType, type StallType, type StallholderAttributes, type StallholderFormData, type StallholderInfoFormData, type StallholderInfoType, type StallholderLocation, type StallholderType, type Subcategory, type TesterType, type TestersFormData, USER_STORAGE_KEY, type UserFormData, type UserType, type ValidateVerificationTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, contactUsFields, dateFormat, defaultMarketFormValues, defaultMarketInfoFormValues, defaultRegion, defaultStallholderFormValues, defaultStallholderInfoFormValues, formatDate, formatTimestamp, getCurrentAndFutureDates, globalDefaultValues, isFutureDatesBeforeThreshold, loginFields, mapArrayToOptions, mapBaseResourceTypeToFormData, marketBasicInfoFields, marketEndDateFields, marketInfo, marketInfoPaymentInfo, marketStartDateFields, normalizeUrl, packagingOptions, paymentMethodOptions, producedIngOptions, profileFields, registerFields, removeTypename, requestPasswordResetFields, requirementsOptions, resetPasswordFields, socialMediaFields, sortDatesChronologically, stallTypeOptions, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, statusOptions, tagOptions, testersFields, timeFormat, truncateText, useAddParticipantToChat, useAddUserFavouriteResource, useContactUs, useContactUsForm, useCreateChat, useCreateMarket, useCreateMarketInfo, useCreatePoster, useCreateRelation, useCreateStallholder, useCreateStallholderInfo, useCreateTester, useCreateUser, useDeleteChat, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useDeleteTester, useDeleteUser, useGetChat, useGetChatSubscription, useGetMarket, useGetMarketInfo, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderInfo, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetTester, useGetTesters, useGetUser, useGetUserChats, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUserStallholder, useGetUsers, useLocationSearch, useLogin, useLoginForm, useLogout, useMarketForm, useMarketInfoForm, useRefreshToken, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchMarkets, useSearchStallholders, useSendChatMessage, useStallholderForm, useStallholderInfoForm, useTestersForm, useUpdateMarket, useUpdateMarketInfo, useUpdateRelation, useUpdateStallholder, useUpdateStallholderInfo, useUpdateTester, useUpdateUser, useUserForm, useValidateVerificationToken, useValidateVerificationTokenForm, validateVerificationTokenFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -592,13 +592,10 @@ declare const getCurrentAndFutureDates: <T extends {
|
|
|
592
592
|
startDate: string;
|
|
593
593
|
startTime: string;
|
|
594
594
|
}>(dates: T[]) => T[];
|
|
595
|
-
declare const
|
|
595
|
+
declare const isFutureDatesBeforeThreshold: (date: {
|
|
596
596
|
startDate: string;
|
|
597
597
|
startTime: string;
|
|
598
|
-
}
|
|
599
|
-
startDate: string;
|
|
600
|
-
startTime: string;
|
|
601
|
-
}[];
|
|
598
|
+
}, minHoursFromNow: number) => boolean;
|
|
602
599
|
declare const formatTimestamp: (timestamp: string) => string;
|
|
603
600
|
declare const defaultRegion: Region;
|
|
604
601
|
/**
|
|
@@ -630,7 +627,7 @@ declare const statusOptions: {
|
|
|
630
627
|
* @param dates - The array of date strings to sort.
|
|
631
628
|
* @returns - The sorted array of date strings.
|
|
632
629
|
*/
|
|
633
|
-
declare function
|
|
630
|
+
declare function sortDatesChronologically<T extends {
|
|
634
631
|
startDate: string;
|
|
635
632
|
startTime: string;
|
|
636
633
|
}>(dates: T[]): T[];
|
|
@@ -998,6 +995,11 @@ declare const useUpdateUser: () => {
|
|
|
998
995
|
loading: boolean;
|
|
999
996
|
updateUser: (options?: _apollo_client.MutationFunctionOptions<any, _apollo_client.OperationVariables, _apollo_client.DefaultContext, _apollo_client.ApolloCache<any>> | undefined) => Promise<_apollo_client.FetchResult<any>>;
|
|
1000
997
|
};
|
|
998
|
+
declare const useDeleteUser: () => {
|
|
999
|
+
deleteUser: (options?: _apollo_client.MutationFunctionOptions<any, _apollo_client.OperationVariables, _apollo_client.DefaultContext, _apollo_client.ApolloCache<any>> | undefined) => Promise<_apollo_client.FetchResult<any>>;
|
|
1000
|
+
error: _apollo_client.ApolloError | undefined;
|
|
1001
|
+
loading: boolean;
|
|
1002
|
+
};
|
|
1001
1003
|
declare const useAddUserFavouriteResource: () => {
|
|
1002
1004
|
addUserFavouriteResource: (options?: _apollo_client.MutationFunctionOptions<any, _apollo_client.OperationVariables, _apollo_client.DefaultContext, _apollo_client.ApolloCache<any>> | undefined) => Promise<_apollo_client.FetchResult<any>>;
|
|
1003
1005
|
error: _apollo_client.ApolloError | undefined;
|
|
@@ -1157,4 +1159,4 @@ declare const SAVED_TOKEN_KEY = "savedToken";
|
|
|
1157
1159
|
declare const SAVED_REFRESH_TOKEN_KEY = "savedRefreshToken";
|
|
1158
1160
|
declare const USER_STORAGE_KEY = "authUser";
|
|
1159
1161
|
|
|
1160
|
-
export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type ContactUsFormData, type CreateContactUsFormData, type CreateLoginFormData, type CreateMarketFormData, type CreateMarketInfoFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderFormData, type CreateStallholderInfoFormData, type CreateTestersFormData, type CreateUserFormData, type CreateValidateVerificationTokenFormData, type DateTimeType, type DateTimeWithPriceType, EnumInviteStatus, EnumNotification, EnumOSType, EnumPaymentMethod, EnumRegions, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumSocialMedia, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketInfoFormData, type MarketInfoType, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type Nullable, type OptionItem, type PaymentInfoType, type PlacePrediction, type PosterInputType, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type Requirement, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, SAVED_EMAIL_KEY, SAVED_PASSWORD_KEY, SAVED_REFRESH_TOKEN_KEY, SAVED_TOKEN_KEY, type SatllholderWithConnectionDatesType, type SocialMediaType, type StallType, type StallholderAttributes, type StallholderFormData, type StallholderInfoFormData, type StallholderInfoType, type StallholderLocation, type StallholderType, type Subcategory, type TesterType, type TestersFormData, USER_STORAGE_KEY, type UserFormData, type UserType, type ValidateVerificationTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, contactUsFields, dateFormat, defaultMarketFormValues, defaultMarketInfoFormValues, defaultRegion, defaultStallholderFormValues, defaultStallholderInfoFormValues, formatDate, formatTimestamp, getCurrentAndFutureDates,
|
|
1162
|
+
export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatInput, type ChatMessageInput, type ChatMessageType, type ChatType, type ContactUsFormData, type CreateContactUsFormData, type CreateLoginFormData, type CreateMarketFormData, type CreateMarketInfoFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateStallholderFormData, type CreateStallholderInfoFormData, type CreateTestersFormData, type CreateUserFormData, type CreateValidateVerificationTokenFormData, type DateTimeType, type DateTimeWithPriceType, EnumInviteStatus, EnumNotification, EnumOSType, EnumPaymentMethod, EnumRegions, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumSocialMedia, EnumUserLicence, EnumUserRole, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketInfoFormData, type MarketInfoType, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type Nullable, type OptionItem, type PaymentInfoType, type PlacePrediction, type PosterInputType, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type RequestPasswordResetFormData, type Requirement, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, SAVED_EMAIL_KEY, SAVED_PASSWORD_KEY, SAVED_REFRESH_TOKEN_KEY, SAVED_TOKEN_KEY, type SatllholderWithConnectionDatesType, type SocialMediaType, type StallType, type StallholderAttributes, type StallholderFormData, type StallholderInfoFormData, type StallholderInfoType, type StallholderLocation, type StallholderType, type Subcategory, type TesterType, type TestersFormData, USER_STORAGE_KEY, type UserFormData, type UserType, type ValidateVerificationTokenFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, contactUsFields, dateFormat, defaultMarketFormValues, defaultMarketInfoFormValues, defaultRegion, defaultStallholderFormValues, defaultStallholderInfoFormValues, formatDate, formatTimestamp, getCurrentAndFutureDates, globalDefaultValues, isFutureDatesBeforeThreshold, loginFields, mapArrayToOptions, mapBaseResourceTypeToFormData, marketBasicInfoFields, marketEndDateFields, marketInfo, marketInfoPaymentInfo, marketStartDateFields, normalizeUrl, packagingOptions, paymentMethodOptions, producedIngOptions, profileFields, registerFields, removeTypename, requestPasswordResetFields, requirementsOptions, resetPasswordFields, socialMediaFields, sortDatesChronologically, stallTypeOptions, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, statusOptions, tagOptions, testersFields, timeFormat, truncateText, useAddParticipantToChat, useAddUserFavouriteResource, useContactUs, useContactUsForm, useCreateChat, useCreateMarket, useCreateMarketInfo, useCreatePoster, useCreateRelation, useCreateStallholder, useCreateStallholderInfo, useCreateTester, useCreateUser, useDeleteChat, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useDeleteTester, useDeleteUser, useGetChat, useGetChatSubscription, useGetMarket, useGetMarketInfo, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderInfo, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetTester, useGetTesters, useGetUser, useGetUserChats, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUserStallholder, useGetUsers, useLocationSearch, useLogin, useLoginForm, useLogout, useMarketForm, useMarketInfoForm, useRefreshToken, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchMarkets, useSearchStallholders, useSendChatMessage, useStallholderForm, useStallholderInfoForm, useTestersForm, useUpdateMarket, useUpdateMarketInfo, useUpdateRelation, useUpdateStallholder, useUpdateStallholderInfo, useUpdateTester, useUpdateUser, useUserForm, useValidateVerificationToken, useValidateVerificationTokenForm, validateVerificationTokenFields };
|
package/dist/index.mjs
CHANGED
|
@@ -130,15 +130,13 @@ var getCurrentAndFutureDates = (dates) => {
|
|
|
130
130
|
return dateTime.isSameOrAfter(today);
|
|
131
131
|
});
|
|
132
132
|
};
|
|
133
|
-
var
|
|
133
|
+
var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
|
|
134
134
|
const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return dateTime.isSameOrAfter(threshold);
|
|
141
|
-
});
|
|
135
|
+
const dateTime = dayjs(
|
|
136
|
+
`${date.startDate} ${date.startTime}`,
|
|
137
|
+
`${dateFormat} ${timeFormat}`
|
|
138
|
+
);
|
|
139
|
+
return dateTime.isSameOrAfter(threshold);
|
|
142
140
|
};
|
|
143
141
|
var formatTimestamp = (timestamp) => {
|
|
144
142
|
const formattedDate = dayjs(timestamp).tz("Pacific/Auckland").format(dateFormat);
|
|
@@ -184,17 +182,15 @@ var statusOptions = [
|
|
|
184
182
|
})).sort((a, b) => a.label.localeCompare(b.label))
|
|
185
183
|
// Sort the options alphabetically
|
|
186
184
|
];
|
|
187
|
-
function
|
|
185
|
+
function sortDatesChronologically(dates) {
|
|
188
186
|
if (!dates || !dates.length) {
|
|
189
187
|
return [];
|
|
190
188
|
}
|
|
191
|
-
const reference = dayjs();
|
|
192
189
|
return [...dates].sort((a, b) => {
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
return diffA - diffB;
|
|
190
|
+
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
191
|
+
const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);
|
|
192
|
+
const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);
|
|
193
|
+
return dateA.valueOf() - dateB.valueOf();
|
|
198
194
|
});
|
|
199
195
|
}
|
|
200
196
|
var availableRegionTypes = Object.values(EnumRegions);
|
|
@@ -2762,6 +2758,9 @@ var useCreateStallholderInfo = () => {
|
|
|
2762
2758
|
query: GET_STALLHOLDER_INFO,
|
|
2763
2759
|
variables: { stallholderId }
|
|
2764
2760
|
// Pass the stallholderId for refetching
|
|
2761
|
+
},
|
|
2762
|
+
{
|
|
2763
|
+
query: GET_USER_STALLHOLDER
|
|
2765
2764
|
}
|
|
2766
2765
|
];
|
|
2767
2766
|
}
|
|
@@ -2936,6 +2935,11 @@ var UPDATE_USER_MUTATION = gql15`
|
|
|
2936
2935
|
}
|
|
2937
2936
|
${USER_FIELDS_FRAGMENT}
|
|
2938
2937
|
`;
|
|
2938
|
+
var DELETE_USER_MUTATION = gql15`
|
|
2939
|
+
mutation deleteUser($_id: ID!) {
|
|
2940
|
+
deleteUser(_id: $_id)
|
|
2941
|
+
}
|
|
2942
|
+
`;
|
|
2939
2943
|
var ADD_USER_FAVOURITE_RESOURCE_MUTATION = gql15`
|
|
2940
2944
|
mutation addUserFavouriteResource(
|
|
2941
2945
|
$resourceId: ID!
|
|
@@ -2971,17 +2975,24 @@ var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = gql15`
|
|
|
2971
2975
|
|
|
2972
2976
|
// src/graphql/hooks/user/hooksMutation.ts
|
|
2973
2977
|
var useCreateUser = () => {
|
|
2974
|
-
const [createUser, { loading, error }] = useMutation7(CREATE_USER_MUTATION
|
|
2975
|
-
awaitRefetchQueries: true
|
|
2976
|
-
});
|
|
2978
|
+
const [createUser, { loading, error }] = useMutation7(CREATE_USER_MUTATION);
|
|
2977
2979
|
return { createUser, error, loading };
|
|
2978
2980
|
};
|
|
2979
2981
|
var useUpdateUser = () => {
|
|
2980
2982
|
const [updateUser, { loading, error }] = useMutation7(UPDATE_USER_MUTATION, {
|
|
2981
|
-
awaitRefetchQueries: true
|
|
2983
|
+
awaitRefetchQueries: true,
|
|
2984
|
+
refetchQueries: (mutationResult) => {
|
|
2985
|
+
const userId = mutationResult?.data?.updateUser?._id;
|
|
2986
|
+
if (!userId) return [];
|
|
2987
|
+
return [{ query: GET_USER, variables: { _id: userId } }];
|
|
2988
|
+
}
|
|
2982
2989
|
});
|
|
2983
2990
|
return { error, loading, updateUser };
|
|
2984
2991
|
};
|
|
2992
|
+
var useDeleteUser = () => {
|
|
2993
|
+
const [deleteUser, { loading, error }] = useMutation7(DELETE_USER_MUTATION);
|
|
2994
|
+
return { deleteUser, error, loading };
|
|
2995
|
+
};
|
|
2985
2996
|
var useAddUserFavouriteResource = () => {
|
|
2986
2997
|
const [addUserFavouriteResource, { loading, error }] = useMutation7(
|
|
2987
2998
|
ADD_USER_FAVOURITE_RESOURCE_MUTATION,
|
|
@@ -4243,8 +4254,8 @@ export {
|
|
|
4243
4254
|
formatDate,
|
|
4244
4255
|
formatTimestamp,
|
|
4245
4256
|
getCurrentAndFutureDates,
|
|
4246
|
-
getFutureDatesAfterThreshold,
|
|
4247
4257
|
globalDefaultValues,
|
|
4258
|
+
isFutureDatesBeforeThreshold,
|
|
4248
4259
|
loginFields,
|
|
4249
4260
|
mapArrayToOptions,
|
|
4250
4261
|
mapBaseResourceTypeToFormData,
|
|
@@ -4264,7 +4275,7 @@ export {
|
|
|
4264
4275
|
requirementsOptions,
|
|
4265
4276
|
resetPasswordFields,
|
|
4266
4277
|
socialMediaFields,
|
|
4267
|
-
|
|
4278
|
+
sortDatesChronologically,
|
|
4268
4279
|
stallTypeOptions,
|
|
4269
4280
|
stallholderBasicInfoFields,
|
|
4270
4281
|
stallholderElectricity,
|
|
@@ -4303,6 +4314,7 @@ export {
|
|
|
4303
4314
|
useDeleteRelation,
|
|
4304
4315
|
useDeleteStallholder,
|
|
4305
4316
|
useDeleteTester,
|
|
4317
|
+
useDeleteUser,
|
|
4306
4318
|
useGetChat,
|
|
4307
4319
|
useGetChatSubscription,
|
|
4308
4320
|
useGetMarket,
|