@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 +7 -6
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -120,7 +120,6 @@ var formatTimestamp = (timestamp) => {
|
|
|
120
120
|
const formattedTime = dayjs(timestamp).tz("Pacific/Auckland").format(timeFormat);
|
|
121
121
|
return formatDate(formattedDate, "date");
|
|
122
122
|
};
|
|
123
|
-
var GOOGLE_API_KEY = "AIzaSyC8UkMGkrF6lIInF9yHxaVQQvlN-zqCfMc";
|
|
124
123
|
var defaultRegion = {
|
|
125
124
|
latitude: -36.8624942,
|
|
126
125
|
// Default: New Zealand
|
|
@@ -178,16 +177,19 @@ function sortDatesByProximity(dates) {
|
|
|
178
177
|
var handleApiError = (error, message) => {
|
|
179
178
|
console.error(message, error);
|
|
180
179
|
};
|
|
181
|
-
var useLocationSearch = () => {
|
|
180
|
+
var useLocationSearch = (googleApi) => {
|
|
182
181
|
const getPredictions = async (text) => {
|
|
182
|
+
console.log("Fetching predictions for:", text);
|
|
183
|
+
console.log("Using Google API key:", googleApi);
|
|
183
184
|
try {
|
|
184
185
|
const response = await fetch(
|
|
185
|
-
`https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${text}&components=country:nz&key=${
|
|
186
|
+
`https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${text}&components=country:nz&key=${googleApi}`
|
|
186
187
|
);
|
|
187
188
|
if (!response.ok) {
|
|
188
189
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
189
190
|
}
|
|
190
191
|
const data = await response.json();
|
|
192
|
+
console.log("Predictions data:", data);
|
|
191
193
|
return data.predictions;
|
|
192
194
|
} catch (error) {
|
|
193
195
|
console.error("Error fetching predictions:", error);
|
|
@@ -197,7 +199,7 @@ var useLocationSearch = () => {
|
|
|
197
199
|
const getPlaceDetails = async (placeId) => {
|
|
198
200
|
try {
|
|
199
201
|
const response = await fetch(
|
|
200
|
-
`https://maps.googleapis.com/maps/api/place/details/json?place_id=${placeId}&key=${
|
|
202
|
+
`https://maps.googleapis.com/maps/api/place/details/json?place_id=${placeId}&key=${googleApi}`
|
|
201
203
|
);
|
|
202
204
|
if (!response.ok) {
|
|
203
205
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
@@ -237,6 +239,7 @@ var useLocationSearch = () => {
|
|
|
237
239
|
type: "Point"
|
|
238
240
|
// Mongoose GeoJSON type
|
|
239
241
|
};
|
|
242
|
+
console.log("New location created:", newLocation);
|
|
240
243
|
return newLocation;
|
|
241
244
|
} catch (error) {
|
|
242
245
|
handleApiError(error, "Failed to fetch place details.");
|
|
@@ -2869,7 +2872,6 @@ export {
|
|
|
2869
2872
|
EnumResourceTypeIcon,
|
|
2870
2873
|
EnumUserLicence,
|
|
2871
2874
|
EnumUserRole,
|
|
2872
|
-
GOOGLE_API_KEY,
|
|
2873
2875
|
ImageTypeEnum,
|
|
2874
2876
|
availableCategories,
|
|
2875
2877
|
availableCityOptions,
|