@timardex/cluemart-shared 1.0.0 → 1.0.2

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
@@ -38,7 +38,6 @@ __export(index_exports, {
38
38
  EnumResourceTypeIcon: () => EnumResourceTypeIcon,
39
39
  EnumUserLicence: () => EnumUserLicence,
40
40
  EnumUserRole: () => EnumUserRole,
41
- GOOGLE_API_KEY: () => GOOGLE_API_KEY,
42
41
  ImageTypeEnum: () => ImageTypeEnum,
43
42
  availableCategories: () => availableCategories,
44
43
  availableCityOptions: () => availableCityOptions,
@@ -282,7 +281,6 @@ var formatTimestamp = (timestamp) => {
282
281
  const formattedTime = (0, import_dayjs.default)(timestamp).tz("Pacific/Auckland").format(timeFormat);
283
282
  return formatDate(formattedDate, "date");
284
283
  };
285
- var GOOGLE_API_KEY = "AIzaSyC8UkMGkrF6lIInF9yHxaVQQvlN-zqCfMc";
286
284
  var defaultRegion = {
287
285
  latitude: -36.8624942,
288
286
  // Default: New Zealand
@@ -340,16 +338,19 @@ function sortDatesByProximity(dates) {
340
338
  var handleApiError = (error, message) => {
341
339
  console.error(message, error);
342
340
  };
343
- var useLocationSearch = () => {
341
+ var useLocationSearch = (googleApi) => {
344
342
  const getPredictions = async (text) => {
343
+ console.log("Fetching predictions for:", text);
344
+ console.log("Using Google API key:", googleApi);
345
345
  try {
346
346
  const response = await fetch(
347
- `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${text}&components=country:nz&key=${GOOGLE_API_KEY}`
347
+ `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${text}&components=country:nz&key=${googleApi}`
348
348
  );
349
349
  if (!response.ok) {
350
350
  throw new Error(`HTTP error! Status: ${response.status}`);
351
351
  }
352
352
  const data = await response.json();
353
+ console.log("Predictions data:", data);
353
354
  return data.predictions;
354
355
  } catch (error) {
355
356
  console.error("Error fetching predictions:", error);
@@ -359,7 +360,7 @@ var useLocationSearch = () => {
359
360
  const getPlaceDetails = async (placeId) => {
360
361
  try {
361
362
  const response = await fetch(
362
- `https://maps.googleapis.com/maps/api/place/details/json?place_id=${placeId}&key=${GOOGLE_API_KEY}`
363
+ `https://maps.googleapis.com/maps/api/place/details/json?place_id=${placeId}&key=${googleApi}`
363
364
  );
364
365
  if (!response.ok) {
365
366
  throw new Error(`HTTP error! Status: ${response.status}`);
@@ -399,6 +400,7 @@ var useLocationSearch = () => {
399
400
  type: "Point"
400
401
  // Mongoose GeoJSON type
401
402
  };
403
+ console.log("New location created:", newLocation);
402
404
  return newLocation;
403
405
  } catch (error) {
404
406
  handleApiError(error, "Failed to fetch place details.");
@@ -3032,7 +3034,6 @@ var categoryColors = {
3032
3034
  EnumResourceTypeIcon,
3033
3035
  EnumUserLicence,
3034
3036
  EnumUserRole,
3035
- GOOGLE_API_KEY,
3036
3037
  ImageTypeEnum,
3037
3038
  availableCategories,
3038
3039
  availableCityOptions,
package/dist/index.d.mts CHANGED
@@ -497,7 +497,6 @@ declare const getFutureDatesAfterThreshold: (dates: {
497
497
  startTime: string;
498
498
  }[];
499
499
  declare const formatTimestamp: (timestamp: string) => string;
500
- declare const GOOGLE_API_KEY = "AIzaSyC8UkMGkrF6lIInF9yHxaVQQvlN-zqCfMc";
501
500
  declare const defaultRegion: Region;
502
501
  /**
503
502
  * Function to remove __typename from an object or array of objects.
@@ -549,7 +548,7 @@ interface UseLocation {
549
548
  *
550
549
  * @returns {UseLocation} - The functions to get predictions and place details.
551
550
  */
552
- declare const useLocationSearch: () => UseLocation;
551
+ declare const useLocationSearch: (googleApi: string) => UseLocation;
553
552
 
554
553
  /**
555
554
  * Custom hook to manage the stallholder form state and validation.
@@ -1157,4 +1156,4 @@ declare const profileFields: FormField[];
1157
1156
  declare const availableCategories: Category[];
1158
1157
  declare const categoryColors: Record<string, string>;
1159
1158
 
1160
- export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type CreateForgotPasswordFormData, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateVerifyEmailFormData, type DateTimeType, EnumInviteStatus, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type ForgotPasswordFormData, type FormDateField, type FormField, GOOGLE_API_KEY, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type OptionItem, type PlacePrediction, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type VerifyEmailFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, forgotPasswordFields, forgotPasswordSchema, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketSchema, marketStartDateFields, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddUserFavouriteResource, useCreateMarket, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useForgotPassword, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveUserFavouriteResource, useSearchMarkets, useSearchStallholders, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useVerifyEmail, userSchema, validateEmailSchema };
1159
+ export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type CreateForgotPasswordFormData, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateVerifyEmailFormData, type DateTimeType, EnumInviteStatus, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type ForgotPasswordFormData, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type OptionItem, type PlacePrediction, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type VerifyEmailFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, forgotPasswordFields, forgotPasswordSchema, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketSchema, marketStartDateFields, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddUserFavouriteResource, useCreateMarket, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useForgotPassword, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveUserFavouriteResource, useSearchMarkets, useSearchStallholders, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useVerifyEmail, userSchema, validateEmailSchema };
package/dist/index.d.ts CHANGED
@@ -497,7 +497,6 @@ declare const getFutureDatesAfterThreshold: (dates: {
497
497
  startTime: string;
498
498
  }[];
499
499
  declare const formatTimestamp: (timestamp: string) => string;
500
- declare const GOOGLE_API_KEY = "AIzaSyC8UkMGkrF6lIInF9yHxaVQQvlN-zqCfMc";
501
500
  declare const defaultRegion: Region;
502
501
  /**
503
502
  * Function to remove __typename from an object or array of objects.
@@ -549,7 +548,7 @@ interface UseLocation {
549
548
  *
550
549
  * @returns {UseLocation} - The functions to get predictions and place details.
551
550
  */
552
- declare const useLocationSearch: () => UseLocation;
551
+ declare const useLocationSearch: (googleApi: string) => UseLocation;
553
552
 
554
553
  /**
555
554
  * Custom hook to manage the stallholder form state and validation.
@@ -1157,4 +1156,4 @@ declare const profileFields: FormField[];
1157
1156
  declare const availableCategories: Category[];
1158
1157
  declare const categoryColors: Record<string, string>;
1159
1158
 
1160
- export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type CreateForgotPasswordFormData, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateVerifyEmailFormData, type DateTimeType, EnumInviteStatus, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type ForgotPasswordFormData, type FormDateField, type FormField, GOOGLE_API_KEY, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type OptionItem, type PlacePrediction, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type VerifyEmailFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, forgotPasswordFields, forgotPasswordSchema, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketSchema, marketStartDateFields, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddUserFavouriteResource, useCreateMarket, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useForgotPassword, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveUserFavouriteResource, useSearchMarkets, useSearchStallholders, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useVerifyEmail, userSchema, validateEmailSchema };
1159
+ export { type BaseResourceType, type BaseResourceTypeFormData, type Category, type CreateForgotPasswordFormData, type CreateLoginFormData, type CreateMarketFormData, type CreateRegisterFormData, type CreateResetPasswordFormData, type CreateStallholderApplyFormFormData, type CreateStallholderFormData, type CreateUserFormData, type CreateVerifyEmailFormData, type DateTimeType, EnumInviteStatus, EnumRegions, EnumRejectionPolicy, EnumRelationResource, EnumResourceType, EnumResourceTypeIcon, EnumUserLicence, EnumUserRole, type ForgotPasswordFormData, type FormDateField, type FormField, type GeocodeLocation, type ImageObjectType, ImageTypeEnum, type LocationType, type LoginFormData, type MapMultiLocation, type MarketFormData, type MarketType, type MarketWithConnectionDatesType, type NotificationType, type OptionItem, type PlacePrediction, type Region, type RegisterFormData, type RelationDate, type RelationLog, type RelationType, type ResetPasswordFormData, type ResourceConnectionsType, type ResourceImageType, type SatllholderWithConnectionDatesType, type StallholderApplyFormFormData, type StallholderApplyFormType, type StallholderAttributes, type StallholderFormData, type StallholderLocation, type StallholderType, type Subcategory, type UserFormData, type UserType, type VerifyEmailFormData, availableCategories, availableCityOptions, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, dateFormat, dateTimeSchema, defaultMarketFormValues, defaultRegion, defaultStallholderApplyFormValues, defaultStallholderFormValues, emailSchema, endDateAfterStartDateTest, endDateNotInPastTest, endTimeMustBeAfterStartTimeTest, forgotPasswordFields, forgotPasswordSchema, formatDate, formatTimestamp, getCurrentAndFutureDates, getFutureDatesAfterThreshold, globalDefaultValues, globalResourceSchema, locationSchema, loginFields, loginSchema, mapArrayToOptions, marketBasicInfoFields, marketEndDateFields, marketSchema, marketStartDateFields, packagingOptions, passwordSchema, paymentMethodOptions, producedIngOptions, profileFields, registerFields, registerSchema, rejectionPolicyOptions, removeTypename, resetPasswordFields, resetPasswordSchema, sortDatesByProximity, stallApplicationInfo, stallHolderSchema, stallholderApplyFormSchema, stallholderBasicInfoFields, stallholderElectricity, stallholderEndDateFields, stallholderFullAddress, stallholderGazebo, stallholderLocationDescription, stallholderMultiLocation, stallholderPackaging, stallholderPaymentMethod, stallholderPriceRange, stallholderProducedIn, stallholderStallSize, stallholderStartDateFields, stallholderTable, startDateNotInPastTest, startTimeCannotBeInPastTest, statusOptions, tagOptions, timeFormat, truncateText, useAddUserFavouriteResource, useCreateMarket, useCreateRelation, useCreateStallholder, useCreateStallholderApplyForm, useCreateUser, useDeleteMarket, useDeleteRelation, useDeleteStallholder, useForgotPassword, useGetMarket, useGetMarketRelations, useGetMarkets, useGetMarketsByRegion, useGetMarketsNearMe, useGetNotification, useGetRelation, useGetRelationByMarketAndStallholder, useGetResourceConnections, useGetStallholder, useGetStallholderApplyForm, useGetStallholderRelations, useGetStallholders, useGetStallholdersByRegion, useGetUser, useGetUserFavourites, useGetUserMarkets, useGetUserNotifications, useGetUsers, useLocationSearch, useLogin, useLoginForm, useMarketForm, useRegister, useRegisterForm, useRemoveUserFavouriteResource, useSearchMarkets, useSearchStallholders, useStallholderApplyForm, useStallholderForm, useUpdateMarket, useUpdateRelation, useUpdateStallholder, useUpdateStallholderApplyForm, useUpdateUser, useUserForm, useVerifyEmail, userSchema, validateEmailSchema };