@timardex/cluemart-shared 2.0.18 → 2.1.0
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/{ad-ZwLtQn9a.d.ts → ad-CUckkB7I.d.ts} +2 -2
- package/dist/{ad-xO8ltnGA.d.mts → ad-sqc3JME-.d.mts} +2 -2
- package/dist/{affiliate-Bv4PXBXC.d.mts → affiliate-7SDCo04C.d.mts} +2 -2
- package/dist/{affiliate-xDFlLdJI.d.ts → affiliate-C03r7ssL.d.ts} +2 -2
- package/dist/auth/index.d.mts +3 -3
- package/dist/auth/index.d.ts +3 -3
- package/dist/auth/index.mjs +4 -15
- package/dist/auth/index.mjs.map +1 -1
- package/dist/chunk-N46DFZ3R.mjs +20 -0
- package/dist/chunk-N46DFZ3R.mjs.map +1 -0
- package/dist/{chunk-JESR7H4R.mjs → chunk-PIEXGXTD.mjs} +1 -1
- package/dist/chunk-PIEXGXTD.mjs.map +1 -0
- package/dist/chunk-RE4NZPYY.mjs +43 -0
- package/dist/chunk-RE4NZPYY.mjs.map +1 -0
- package/dist/{chunk-5G3MQXQX.mjs → chunk-YPT2VOTM.mjs} +2 -2
- package/dist/{contactUs-DtKFwekV.d.ts → contactUs-BG3sJ6gc.d.ts} +1 -1
- package/dist/{contactUs-0IhAsiDW.d.mts → contactUs-CWFP59_0.d.mts} +1 -1
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +1 -1
- package/dist/formFields/index.d.ts +1 -1
- package/dist/formFields/index.mjs +3 -2
- package/dist/{global-C6w0hQ5Y.d.mts → global-BqeTWrvk.d.ts} +4 -1
- package/dist/{global-Coz5Jgi2.d.ts → global-CWo-hWKZ.d.mts} +4 -1
- package/dist/graphql/index.d.mts +5 -5
- package/dist/graphql/index.d.ts +5 -5
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +5 -5
- package/dist/hooks/index.d.ts +5 -5
- package/dist/hooks/index.mjs +3 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +43 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.mjs +40 -0
- package/dist/index.mjs.map +1 -1
- package/dist/map/index.d.mts +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/region/index.cjs +290 -0
- package/dist/region/index.cjs.map +1 -0
- package/dist/region/index.d.mts +36 -0
- package/dist/region/index.d.ts +36 -0
- package/dist/region/index.mjs +220 -0
- package/dist/region/index.mjs.map +1 -0
- package/dist/{resourceActivities-DScv6fiM.d.ts → resourceActivities-BbhGFtZA.d.ts} +1 -1
- package/dist/{resourceActivities-DIK3bwZg.d.mts → resourceActivities-D81u7Mu0.d.mts} +1 -1
- package/dist/sharing/index.d.mts +1 -1
- package/dist/sharing/index.d.ts +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +7 -7
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.mjs +1 -1
- package/dist/{user-DhxdbFT7.d.ts → user-2peJoOeK.d.ts} +1 -1
- package/dist/{user-BwcVKK-h.d.mts → user-DKcyf8gn.d.mts} +1 -1
- package/dist/utils/index.cjs +43 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +8 -4
- package/dist/utils/index.d.ts +8 -4
- package/dist/utils/index.mjs +10 -2
- package/package.json +6 -1
- package/dist/chunk-JESR7H4R.mjs.map +0 -1
- /package/dist/{chunk-5G3MQXQX.mjs.map → chunk-YPT2VOTM.mjs.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -236,6 +236,7 @@ __export(index_exports, {
|
|
|
236
236
|
foodFlavourOptions: () => foodFlavourOptions,
|
|
237
237
|
formatCategoryLabel: () => formatCategoryLabel,
|
|
238
238
|
formatDate: () => formatDate,
|
|
239
|
+
formatDistance: () => formatDistance,
|
|
239
240
|
formatIrdNumber: () => formatIrdNumber,
|
|
240
241
|
formatNZBankAccount: () => formatNZBankAccount,
|
|
241
242
|
formatShareApplicationCategoriesSection: () => formatShareApplicationCategoriesSection,
|
|
@@ -260,6 +261,8 @@ __export(index_exports, {
|
|
|
260
261
|
getBillingCatalogKeyForSelection: () => getBillingCatalogKeyForSelection,
|
|
261
262
|
getCurrentAndFutureDates: () => getCurrentAndFutureDates,
|
|
262
263
|
getDefaultAdminHome: () => getDefaultAdminHome,
|
|
264
|
+
getDistanceInKilometers: () => getDistanceInKilometers,
|
|
265
|
+
getDistanceInMeters: () => getDistanceInMeters,
|
|
263
266
|
getErrorMessage: () => getErrorMessage,
|
|
264
267
|
getEventCalendarIsoDates: () => getEventCalendarIsoDates,
|
|
265
268
|
getEventDatesWithStallholders: () => getEventDatesWithStallholders,
|
|
@@ -1284,6 +1287,43 @@ function computeDailyClueState(dailyClue) {
|
|
|
1284
1287
|
};
|
|
1285
1288
|
}
|
|
1286
1289
|
|
|
1290
|
+
// src/utils/distance.ts
|
|
1291
|
+
function getDistanceInMeters(coordinates1, coordinates2) {
|
|
1292
|
+
const [lon1, lat1] = coordinates1;
|
|
1293
|
+
const [lon2, lat2] = coordinates2;
|
|
1294
|
+
const values = [lon1, lat1, lon2, lat2];
|
|
1295
|
+
if (values.some((v) => !Number.isFinite(v))) {
|
|
1296
|
+
return Infinity;
|
|
1297
|
+
}
|
|
1298
|
+
const toRadians = (deg) => deg * Math.PI / 180;
|
|
1299
|
+
const R = 6371e3;
|
|
1300
|
+
const dLat = toRadians(lat2 - lat1);
|
|
1301
|
+
const dLon = toRadians(lon2 - lon1);
|
|
1302
|
+
const radLat1 = toRadians(lat1);
|
|
1303
|
+
const radLat2 = toRadians(lat2);
|
|
1304
|
+
const a = Math.sin(dLat / 2) ** 2 + Math.sin(dLon / 2) ** 2 * Math.cos(radLat1) * Math.cos(radLat2);
|
|
1305
|
+
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
1306
|
+
return R * c;
|
|
1307
|
+
}
|
|
1308
|
+
function getDistanceInKilometers(coordinates1, coordinates2) {
|
|
1309
|
+
const distanceInMeters = getDistanceInMeters(coordinates1, coordinates2);
|
|
1310
|
+
if (!Number.isFinite(distanceInMeters)) {
|
|
1311
|
+
return Infinity;
|
|
1312
|
+
}
|
|
1313
|
+
return Math.round(distanceInMeters / 1e3);
|
|
1314
|
+
}
|
|
1315
|
+
function formatDistance(coordinates1, coordinates2) {
|
|
1316
|
+
const distanceInMeters = getDistanceInMeters(coordinates1, coordinates2);
|
|
1317
|
+
if (!Number.isFinite(distanceInMeters)) {
|
|
1318
|
+
return "\u2014";
|
|
1319
|
+
}
|
|
1320
|
+
const roundedMeters = Math.round(distanceInMeters);
|
|
1321
|
+
if (roundedMeters < 1e3) {
|
|
1322
|
+
return `${roundedMeters} m`;
|
|
1323
|
+
}
|
|
1324
|
+
return `${Math.round(roundedMeters / 1e3)} km`;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1287
1327
|
// src/utils/pagination.ts
|
|
1288
1328
|
var DEFAULT_PAGE_SIZE = 50;
|
|
1289
1329
|
function defaultGetId(item) {
|
|
@@ -10165,6 +10205,7 @@ function canAccessAdminPath(roles, pathname) {
|
|
|
10165
10205
|
foodFlavourOptions,
|
|
10166
10206
|
formatCategoryLabel,
|
|
10167
10207
|
formatDate,
|
|
10208
|
+
formatDistance,
|
|
10168
10209
|
formatIrdNumber,
|
|
10169
10210
|
formatNZBankAccount,
|
|
10170
10211
|
formatShareApplicationCategoriesSection,
|
|
@@ -10189,6 +10230,8 @@ function canAccessAdminPath(roles, pathname) {
|
|
|
10189
10230
|
getBillingCatalogKeyForSelection,
|
|
10190
10231
|
getCurrentAndFutureDates,
|
|
10191
10232
|
getDefaultAdminHome,
|
|
10233
|
+
getDistanceInKilometers,
|
|
10234
|
+
getDistanceInMeters,
|
|
10192
10235
|
getErrorMessage,
|
|
10193
10236
|
getEventCalendarIsoDates,
|
|
10194
10237
|
getEventDatesWithStallholders,
|