@timardex/cluemart-shared 1.3.65 → 1.3.67
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/{googleImportedMarket-BgS5XPGo.d.ts → googleImportedMarket-BuxDo6MX.d.ts} +21 -20
- package/dist/{googleImportedMarket-7QO1hU15.d.mts → googleImportedMarket-D2HOg7O-.d.mts} +21 -20
- package/dist/graphql/index.cjs +146 -59
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +34 -8
- package/dist/graphql/index.d.ts +34 -8
- package/dist/graphql/index.mjs +143 -59
- package/dist/graphql/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +42 -19
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +42 -19
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +188 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +54 -27
- package/dist/index.d.ts +54 -27
- package/dist/index.mjs +185 -78
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -182,6 +182,8 @@ __export(index_exports, {
|
|
|
182
182
|
useGetEventsByRegion: () => useGetEventsByRegion,
|
|
183
183
|
useGetEventsNearMe: () => useGetEventsNearMe,
|
|
184
184
|
useGetGoogleImportedMarkets: () => useGetGoogleImportedMarkets,
|
|
185
|
+
useGetGoogleImportedMarketsByRegion: () => useGetGoogleImportedMarketsByRegion,
|
|
186
|
+
useGetGoogleImportedMarketsNearMe: () => useGetGoogleImportedMarketsNearMe,
|
|
185
187
|
useGetNotificationCount: () => useGetNotificationCount,
|
|
186
188
|
useGetNotificationCountSubscription: () => useGetNotificationCountSubscription,
|
|
187
189
|
useGetPartner: () => useGetPartner,
|
|
@@ -233,6 +235,7 @@ __export(index_exports, {
|
|
|
233
235
|
useResetPassword: () => useResetPassword,
|
|
234
236
|
useResetPasswordForm: () => useResetPasswordForm,
|
|
235
237
|
useSearchEvents: () => useSearchEvents,
|
|
238
|
+
useSearchGoogleImportedMarkets: () => useSearchGoogleImportedMarkets,
|
|
236
239
|
useSearchPartners: () => useSearchPartners,
|
|
237
240
|
useSearchVendors: () => useSearchVendors,
|
|
238
241
|
useSelectPackage: () => useSelectPackage,
|
|
@@ -5722,13 +5725,6 @@ var UPDATE_APP_SETTINGS_MUTATION = import_client63.gql`
|
|
|
5722
5725
|
updateAppSettings(input: $input)
|
|
5723
5726
|
}
|
|
5724
5727
|
`;
|
|
5725
|
-
var CRAWL_GOOGLE_MARKETS_MUTATION = import_client63.gql`
|
|
5726
|
-
mutation crawlGoogleMarkets {
|
|
5727
|
-
crawlGoogleMarkets {
|
|
5728
|
-
message
|
|
5729
|
-
}
|
|
5730
|
-
}
|
|
5731
|
-
`;
|
|
5732
5728
|
|
|
5733
5729
|
// src/graphql/queries/appSettings.ts
|
|
5734
5730
|
var import_client64 = require("@apollo/client");
|
|
@@ -5741,45 +5737,6 @@ var APP_SETTINGS_FIELDS_FRAGMENT = import_client64.gql`
|
|
|
5741
5737
|
updatedAt
|
|
5742
5738
|
}
|
|
5743
5739
|
`;
|
|
5744
|
-
var GOOGLE_IMPORTED_MARKETS_FIELDS_FRAGMENT = import_client64.gql`
|
|
5745
|
-
fragment GoogleImportedMarketsFields on GoogleImportedMarketType {
|
|
5746
|
-
_id
|
|
5747
|
-
name
|
|
5748
|
-
slug
|
|
5749
|
-
image
|
|
5750
|
-
address
|
|
5751
|
-
location {
|
|
5752
|
-
lat
|
|
5753
|
-
lng
|
|
5754
|
-
}
|
|
5755
|
-
googlePlaceId
|
|
5756
|
-
website
|
|
5757
|
-
phone
|
|
5758
|
-
openingHours
|
|
5759
|
-
rating
|
|
5760
|
-
reviewCount
|
|
5761
|
-
photos
|
|
5762
|
-
googleMapsUrl
|
|
5763
|
-
businessStatus
|
|
5764
|
-
addressComponents {
|
|
5765
|
-
longName
|
|
5766
|
-
shortName
|
|
5767
|
-
types
|
|
5768
|
-
}
|
|
5769
|
-
accessibilityOptions
|
|
5770
|
-
allowsDogs
|
|
5771
|
-
goodForChildren
|
|
5772
|
-
goodForGroups
|
|
5773
|
-
liveMusic
|
|
5774
|
-
parkingOptions
|
|
5775
|
-
paymentOptions
|
|
5776
|
-
restroom
|
|
5777
|
-
importedAt
|
|
5778
|
-
claimed
|
|
5779
|
-
createdAt
|
|
5780
|
-
updatedAt
|
|
5781
|
-
}
|
|
5782
|
-
`;
|
|
5783
5740
|
var GET_APP_SETTINGS = import_client64.gql`
|
|
5784
5741
|
query getAppSettings {
|
|
5785
5742
|
appSettings {
|
|
@@ -5788,14 +5745,6 @@ var GET_APP_SETTINGS = import_client64.gql`
|
|
|
5788
5745
|
}
|
|
5789
5746
|
${APP_SETTINGS_FIELDS_FRAGMENT}
|
|
5790
5747
|
`;
|
|
5791
|
-
var GET_GOOGLE_IMPORTED_MARKETS = import_client64.gql`
|
|
5792
|
-
query getGoogleImportedMarkets {
|
|
5793
|
-
googleImportedMarkets {
|
|
5794
|
-
...GoogleImportedMarketsFields
|
|
5795
|
-
}
|
|
5796
|
-
}
|
|
5797
|
-
${GOOGLE_IMPORTED_MARKETS_FIELDS_FRAGMENT}
|
|
5798
|
-
`;
|
|
5799
5748
|
|
|
5800
5749
|
// src/graphql/hooks/appSettings/hooksMutation.ts
|
|
5801
5750
|
var useUpdateAppSettings = () => {
|
|
@@ -5808,10 +5757,6 @@ var useUpdateAppSettings = () => {
|
|
|
5808
5757
|
);
|
|
5809
5758
|
return { error, loading, updateAppSettings };
|
|
5810
5759
|
};
|
|
5811
|
-
var useCrawlGoogleMarkets = () => {
|
|
5812
|
-
const [crawlGoogleMarkets, { loading, error }] = (0, import_client65.useMutation)(CRAWL_GOOGLE_MARKETS_MUTATION);
|
|
5813
|
-
return { crawlGoogleMarkets, error, loading };
|
|
5814
|
-
};
|
|
5815
5760
|
|
|
5816
5761
|
// src/graphql/hooks/appSettings/hooksQuery.ts
|
|
5817
5762
|
var import_client66 = require("@apollo/client");
|
|
@@ -5822,13 +5767,152 @@ var useGetAppSettings = () => {
|
|
|
5822
5767
|
const appSettings = data?.appSettings || null;
|
|
5823
5768
|
return { appSettings, error, loading, refetch };
|
|
5824
5769
|
};
|
|
5770
|
+
|
|
5771
|
+
// src/graphql/hooks/googleImportedMarkets/hooksMutation.ts
|
|
5772
|
+
var import_client68 = require("@apollo/client");
|
|
5773
|
+
|
|
5774
|
+
// src/graphql/mutations/googleImportedMarkets.ts
|
|
5775
|
+
var import_client67 = require("@apollo/client");
|
|
5776
|
+
var CRAWL_GOOGLE_MARKETS_MUTATION = import_client67.gql`
|
|
5777
|
+
mutation crawlGoogleMarkets {
|
|
5778
|
+
crawlGoogleMarkets {
|
|
5779
|
+
message
|
|
5780
|
+
}
|
|
5781
|
+
}
|
|
5782
|
+
`;
|
|
5783
|
+
|
|
5784
|
+
// src/graphql/hooks/googleImportedMarkets/hooksMutation.ts
|
|
5785
|
+
var useCrawlGoogleMarkets = () => {
|
|
5786
|
+
const [crawlGoogleMarkets, { loading, error }] = (0, import_client68.useMutation)(CRAWL_GOOGLE_MARKETS_MUTATION);
|
|
5787
|
+
return { crawlGoogleMarkets, error, loading };
|
|
5788
|
+
};
|
|
5789
|
+
|
|
5790
|
+
// src/graphql/hooks/googleImportedMarkets/hooksQuery.ts
|
|
5791
|
+
var import_client70 = require("@apollo/client");
|
|
5792
|
+
|
|
5793
|
+
// src/graphql/queries/googleImportedMarkets.ts
|
|
5794
|
+
var import_client69 = require("@apollo/client");
|
|
5795
|
+
var GOOGLE_IMPORTED_MARKETS_FIELDS_FRAGMENT = import_client69.gql`
|
|
5796
|
+
fragment GoogleImportedMarketsFields on GoogleImportedMarketType {
|
|
5797
|
+
_id
|
|
5798
|
+
accessibilityOptions
|
|
5799
|
+
address
|
|
5800
|
+
addressComponents {
|
|
5801
|
+
longName
|
|
5802
|
+
shortName
|
|
5803
|
+
types
|
|
5804
|
+
}
|
|
5805
|
+
allowsDogs
|
|
5806
|
+
businessStatus
|
|
5807
|
+
claimed
|
|
5808
|
+
createdAt
|
|
5809
|
+
goodForChildren
|
|
5810
|
+
goodForGroups
|
|
5811
|
+
googleMapsUrl
|
|
5812
|
+
googlePlaceId
|
|
5813
|
+
image
|
|
5814
|
+
importedAt
|
|
5815
|
+
liveMusic
|
|
5816
|
+
location {
|
|
5817
|
+
lat
|
|
5818
|
+
lng
|
|
5819
|
+
}
|
|
5820
|
+
name
|
|
5821
|
+
openingHours
|
|
5822
|
+
parkingOptions
|
|
5823
|
+
paymentOptions
|
|
5824
|
+
phone
|
|
5825
|
+
photos
|
|
5826
|
+
rating
|
|
5827
|
+
region
|
|
5828
|
+
restroom
|
|
5829
|
+
reviewCount
|
|
5830
|
+
slug
|
|
5831
|
+
updatedAt
|
|
5832
|
+
website
|
|
5833
|
+
}
|
|
5834
|
+
`;
|
|
5835
|
+
var GET_GOOGLE_IMPORTED_MARKETS = import_client69.gql`
|
|
5836
|
+
query getGoogleImportedMarkets {
|
|
5837
|
+
googleImportedMarkets {
|
|
5838
|
+
...GoogleImportedMarketsFields
|
|
5839
|
+
}
|
|
5840
|
+
}
|
|
5841
|
+
${GOOGLE_IMPORTED_MARKETS_FIELDS_FRAGMENT}
|
|
5842
|
+
`;
|
|
5843
|
+
var GET_GOOGLE_IMPORTED_MARKETS_BY_REGION = import_client69.gql`
|
|
5844
|
+
query getGoogleImportedMarketsByRegion($region: String!) {
|
|
5845
|
+
googleImportedMarketsByRegion(region: $region) {
|
|
5846
|
+
...GoogleImportedMarketsFields
|
|
5847
|
+
}
|
|
5848
|
+
}
|
|
5849
|
+
${GOOGLE_IMPORTED_MARKETS_FIELDS_FRAGMENT}
|
|
5850
|
+
`;
|
|
5851
|
+
var SEARCH_GOOGLE_IMPORTED_MARKETS = import_client69.gql`
|
|
5852
|
+
query searchGoogleImportedMarkets($search: String!, $region: String) {
|
|
5853
|
+
googleImportedMarketsSearch(search: $search, region: $region) {
|
|
5854
|
+
...GoogleImportedMarketsFields
|
|
5855
|
+
}
|
|
5856
|
+
}
|
|
5857
|
+
${GOOGLE_IMPORTED_MARKETS_FIELDS_FRAGMENT}
|
|
5858
|
+
`;
|
|
5859
|
+
var GET_GOOGLE_IMPORTED_MARKETS_NEAR_ME = import_client69.gql`
|
|
5860
|
+
query getGoogleImportedMarketsNearMe(
|
|
5861
|
+
$latitude: Float!
|
|
5862
|
+
$longitude: Float!
|
|
5863
|
+
$radius: Int
|
|
5864
|
+
) {
|
|
5865
|
+
googleImportedMarketsNearMe(
|
|
5866
|
+
lat: $latitude
|
|
5867
|
+
lng: $longitude
|
|
5868
|
+
radius: $radius
|
|
5869
|
+
) {
|
|
5870
|
+
...GoogleImportedMarketsFields
|
|
5871
|
+
}
|
|
5872
|
+
}
|
|
5873
|
+
${GOOGLE_IMPORTED_MARKETS_FIELDS_FRAGMENT}
|
|
5874
|
+
`;
|
|
5875
|
+
|
|
5876
|
+
// src/graphql/hooks/googleImportedMarkets/hooksQuery.ts
|
|
5825
5877
|
var useGetGoogleImportedMarkets = () => {
|
|
5826
|
-
const { loading, error, data, refetch } = (0,
|
|
5878
|
+
const { loading, error, data, refetch } = (0, import_client70.useQuery)(GET_GOOGLE_IMPORTED_MARKETS, {
|
|
5827
5879
|
fetchPolicy: "network-only"
|
|
5828
5880
|
});
|
|
5829
5881
|
const googleImportedMarkets = data?.googleImportedMarkets || [];
|
|
5830
5882
|
return { error, googleImportedMarkets, loading, refetch };
|
|
5831
5883
|
};
|
|
5884
|
+
var useGetGoogleImportedMarketsByRegion = (region) => {
|
|
5885
|
+
const { loading, error, data, refetch } = (0, import_client70.useQuery)(GET_GOOGLE_IMPORTED_MARKETS_BY_REGION, {
|
|
5886
|
+
fetchPolicy: "network-only",
|
|
5887
|
+
skip: !region,
|
|
5888
|
+
variables: { region }
|
|
5889
|
+
});
|
|
5890
|
+
const googleImportedMarketsByRegion = data?.googleImportedMarketsByRegion || [];
|
|
5891
|
+
return { error, googleImportedMarketsByRegion, loading, refetch };
|
|
5892
|
+
};
|
|
5893
|
+
var useSearchGoogleImportedMarkets = (search, region) => {
|
|
5894
|
+
const { loading, error, data, refetch } = (0, import_client70.useQuery)(SEARCH_GOOGLE_IMPORTED_MARKETS, {
|
|
5895
|
+
fetchPolicy: "network-only",
|
|
5896
|
+
skip: search.length < 3,
|
|
5897
|
+
variables: { region, search }
|
|
5898
|
+
});
|
|
5899
|
+
const googleImportedMarketsSearch = data?.googleImportedMarketsSearch || [];
|
|
5900
|
+
return { error, googleImportedMarketsSearch, loading, refetch };
|
|
5901
|
+
};
|
|
5902
|
+
var useGetGoogleImportedMarketsNearMe = (latitude, longitude, radius) => {
|
|
5903
|
+
const { loading, error, data, refetch } = (0, import_client70.useQuery)(GET_GOOGLE_IMPORTED_MARKETS_NEAR_ME, {
|
|
5904
|
+
fetchPolicy: "network-only",
|
|
5905
|
+
skip: !latitude || !longitude,
|
|
5906
|
+
variables: {
|
|
5907
|
+
latitude,
|
|
5908
|
+
longitude,
|
|
5909
|
+
radius: radius || 1e4
|
|
5910
|
+
// Default to 10km if no radius is provided
|
|
5911
|
+
}
|
|
5912
|
+
});
|
|
5913
|
+
const googleImportedMarketsNearMe = data?.googleImportedMarketsNearMe || [];
|
|
5914
|
+
return { error, googleImportedMarketsNearMe, loading, refetch };
|
|
5915
|
+
};
|
|
5832
5916
|
|
|
5833
5917
|
// src/hooks/useLocationSearch.ts
|
|
5834
5918
|
var handleApiError = (error, message) => {
|
|
@@ -5838,13 +5922,31 @@ var useLocationSearch = (googleApi) => {
|
|
|
5838
5922
|
const getPredictions = async (text) => {
|
|
5839
5923
|
try {
|
|
5840
5924
|
const response = await fetch(
|
|
5841
|
-
|
|
5925
|
+
"https://places.googleapis.com/v1/places:autocomplete",
|
|
5926
|
+
{
|
|
5927
|
+
body: JSON.stringify({
|
|
5928
|
+
includedRegionCodes: ["nz"],
|
|
5929
|
+
input: text,
|
|
5930
|
+
languageCode: "en"
|
|
5931
|
+
}),
|
|
5932
|
+
headers: {
|
|
5933
|
+
"Content-Type": "application/json",
|
|
5934
|
+
"X-Goog-Api-Key": googleApi,
|
|
5935
|
+
"X-Goog-FieldMask": "suggestions.placePrediction.placeId,suggestions.placePrediction.text.text"
|
|
5936
|
+
},
|
|
5937
|
+
method: "POST"
|
|
5938
|
+
}
|
|
5842
5939
|
);
|
|
5843
5940
|
if (!response.ok) {
|
|
5844
5941
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
5845
5942
|
}
|
|
5846
5943
|
const data = await response.json();
|
|
5847
|
-
|
|
5944
|
+
const suggestions = data.suggestions ?? [];
|
|
5945
|
+
const predictions = suggestions.map((suggestion) => suggestion.placePrediction).filter(Boolean).map((prediction) => ({
|
|
5946
|
+
description: prediction?.text?.text || "",
|
|
5947
|
+
place_id: prediction?.placeId || ""
|
|
5948
|
+
})).filter((prediction) => prediction.place_id && prediction.description);
|
|
5949
|
+
return predictions;
|
|
5848
5950
|
} catch (error) {
|
|
5849
5951
|
console.error("Error fetching predictions:", error);
|
|
5850
5952
|
handleApiError(error, "Failed to fetch address predictions.");
|
|
@@ -5853,42 +5955,47 @@ var useLocationSearch = (googleApi) => {
|
|
|
5853
5955
|
const getPlaceDetails = async (placeId) => {
|
|
5854
5956
|
try {
|
|
5855
5957
|
const response = await fetch(
|
|
5856
|
-
`https://
|
|
5958
|
+
`https://places.googleapis.com/v1/places/${placeId}`,
|
|
5959
|
+
{
|
|
5960
|
+
headers: {
|
|
5961
|
+
"X-Goog-Api-Key": googleApi,
|
|
5962
|
+
"X-Goog-FieldMask": "addressComponents,formattedAddress,location"
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5857
5965
|
);
|
|
5858
5966
|
if (!response.ok) {
|
|
5859
5967
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
5860
5968
|
}
|
|
5861
|
-
const
|
|
5862
|
-
const {
|
|
5863
|
-
const {
|
|
5864
|
-
const
|
|
5865
|
-
const address = address_components.reduce((acc, item) => {
|
|
5969
|
+
const result = await response.json();
|
|
5970
|
+
const { latitude, longitude } = result.location;
|
|
5971
|
+
const { addressComponents, formattedAddress } = result;
|
|
5972
|
+
const address = addressComponents.reduce((acc, item) => {
|
|
5866
5973
|
if (item.types.includes("street_number")) {
|
|
5867
|
-
return { ...acc, streetNumber: item.
|
|
5974
|
+
return { ...acc, streetNumber: item.longText };
|
|
5868
5975
|
}
|
|
5869
5976
|
if (item.types.includes("route")) {
|
|
5870
|
-
return { ...acc, streetName: item.
|
|
5977
|
+
return { ...acc, streetName: item.longText };
|
|
5871
5978
|
}
|
|
5872
5979
|
if (item.types.includes("locality")) {
|
|
5873
|
-
return { ...acc, city: item.
|
|
5980
|
+
return { ...acc, city: item.longText };
|
|
5874
5981
|
}
|
|
5875
5982
|
if (item.types.includes("administrative_area_level_1")) {
|
|
5876
|
-
return { ...acc, region: item.
|
|
5983
|
+
return { ...acc, region: item.longText };
|
|
5877
5984
|
}
|
|
5878
5985
|
if (item.types.includes("country")) {
|
|
5879
|
-
return { ...acc, country: item.
|
|
5986
|
+
return { ...acc, country: item.longText };
|
|
5880
5987
|
}
|
|
5881
5988
|
return acc;
|
|
5882
5989
|
}, {});
|
|
5883
5990
|
const newLocation = {
|
|
5884
|
-
city: address.city.toLowerCase(),
|
|
5885
|
-
coordinates: [
|
|
5991
|
+
city: address.city ? address.city.toLowerCase() : "",
|
|
5992
|
+
coordinates: [longitude, latitude],
|
|
5886
5993
|
// [longitude, latitude]
|
|
5887
5994
|
country: address.country,
|
|
5888
|
-
fullAddress:
|
|
5889
|
-
latitude
|
|
5890
|
-
longitude
|
|
5891
|
-
region: address.region.replace(/ Region$/, ""),
|
|
5995
|
+
fullAddress: formattedAddress,
|
|
5996
|
+
latitude,
|
|
5997
|
+
longitude,
|
|
5998
|
+
region: address.region ? address.region.replace(/ Region$/, "") : "",
|
|
5892
5999
|
// Remove " Region" suffix
|
|
5893
6000
|
type: "Point"
|
|
5894
6001
|
// Mongoose GeoJSON type
|
|
@@ -7927,6 +8034,8 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
|
7927
8034
|
useGetEventsByRegion,
|
|
7928
8035
|
useGetEventsNearMe,
|
|
7929
8036
|
useGetGoogleImportedMarkets,
|
|
8037
|
+
useGetGoogleImportedMarketsByRegion,
|
|
8038
|
+
useGetGoogleImportedMarketsNearMe,
|
|
7930
8039
|
useGetNotificationCount,
|
|
7931
8040
|
useGetNotificationCountSubscription,
|
|
7932
8041
|
useGetPartner,
|
|
@@ -7978,6 +8087,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
|
7978
8087
|
useResetPassword,
|
|
7979
8088
|
useResetPasswordForm,
|
|
7980
8089
|
useSearchEvents,
|
|
8090
|
+
useSearchGoogleImportedMarkets,
|
|
7981
8091
|
useSearchPartners,
|
|
7982
8092
|
useSearchVendors,
|
|
7983
8093
|
useSelectPackage,
|