@timardex/cluemart-shared 2.0.17 → 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.
Files changed (69) hide show
  1. package/dist/{ad-BaKxf-Rj.d.ts → ad-CUckkB7I.d.ts} +3 -3
  2. package/dist/{ad-B4hhLfL-.d.mts → ad-sqc3JME-.d.mts} +3 -3
  3. package/dist/{affiliate-Bv4PXBXC.d.mts → affiliate-7SDCo04C.d.mts} +2 -2
  4. package/dist/{affiliate-xDFlLdJI.d.ts → affiliate-C03r7ssL.d.ts} +2 -2
  5. package/dist/auth/index.d.mts +3 -3
  6. package/dist/auth/index.d.ts +3 -3
  7. package/dist/auth/index.mjs +4 -15
  8. package/dist/auth/index.mjs.map +1 -1
  9. package/dist/{chunk-RNHDFZIC.mjs → chunk-KUC252SN.mjs} +9 -5
  10. package/dist/chunk-KUC252SN.mjs.map +1 -0
  11. package/dist/chunk-N46DFZ3R.mjs +20 -0
  12. package/dist/chunk-N46DFZ3R.mjs.map +1 -0
  13. package/dist/{chunk-JESR7H4R.mjs → chunk-PIEXGXTD.mjs} +1 -1
  14. package/dist/chunk-PIEXGXTD.mjs.map +1 -0
  15. package/dist/chunk-RE4NZPYY.mjs +43 -0
  16. package/dist/chunk-RE4NZPYY.mjs.map +1 -0
  17. package/dist/{chunk-5G3MQXQX.mjs → chunk-YPT2VOTM.mjs} +2 -2
  18. package/dist/{contactUs-DtKFwekV.d.ts → contactUs-BG3sJ6gc.d.ts} +1 -1
  19. package/dist/{contactUs-0IhAsiDW.d.mts → contactUs-CWFP59_0.d.mts} +1 -1
  20. package/dist/formFields/index.cjs.map +1 -1
  21. package/dist/formFields/index.d.mts +1 -1
  22. package/dist/formFields/index.d.ts +1 -1
  23. package/dist/formFields/index.mjs +3 -2
  24. package/dist/{global-C6w0hQ5Y.d.mts → global-BqeTWrvk.d.ts} +4 -1
  25. package/dist/{global-Coz5Jgi2.d.ts → global-CWo-hWKZ.d.mts} +4 -1
  26. package/dist/graphql/index.cjs +8 -4
  27. package/dist/graphql/index.cjs.map +1 -1
  28. package/dist/graphql/index.d.mts +6 -6
  29. package/dist/graphql/index.d.ts +6 -6
  30. package/dist/graphql/index.mjs +1 -1
  31. package/dist/hooks/index.cjs +6 -2
  32. package/dist/hooks/index.cjs.map +1 -1
  33. package/dist/hooks/index.d.mts +5 -5
  34. package/dist/hooks/index.d.ts +5 -5
  35. package/dist/hooks/index.mjs +4 -3
  36. package/dist/hooks/index.mjs.map +1 -1
  37. package/dist/index.cjs +51 -4
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.mts +9 -2
  40. package/dist/index.d.ts +9 -2
  41. package/dist/index.mjs +48 -4
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/map/index.d.mts +1 -1
  44. package/dist/map/index.d.ts +1 -1
  45. package/dist/region/index.cjs +290 -0
  46. package/dist/region/index.cjs.map +1 -0
  47. package/dist/region/index.d.mts +36 -0
  48. package/dist/region/index.d.ts +36 -0
  49. package/dist/region/index.mjs +220 -0
  50. package/dist/region/index.mjs.map +1 -0
  51. package/dist/{resourceActivities-DScv6fiM.d.ts → resourceActivities-BbhGFtZA.d.ts} +1 -1
  52. package/dist/{resourceActivities-DIK3bwZg.d.mts → resourceActivities-D81u7Mu0.d.mts} +1 -1
  53. package/dist/sharing/index.d.mts +1 -1
  54. package/dist/sharing/index.d.ts +1 -1
  55. package/dist/types/index.cjs.map +1 -1
  56. package/dist/types/index.d.mts +7 -7
  57. package/dist/types/index.d.ts +7 -7
  58. package/dist/types/index.mjs +1 -1
  59. package/dist/{user-DhxdbFT7.d.ts → user-2peJoOeK.d.ts} +1 -1
  60. package/dist/{user-BwcVKK-h.d.mts → user-DKcyf8gn.d.mts} +1 -1
  61. package/dist/utils/index.cjs +43 -0
  62. package/dist/utils/index.cjs.map +1 -1
  63. package/dist/utils/index.d.mts +8 -4
  64. package/dist/utils/index.d.ts +8 -4
  65. package/dist/utils/index.mjs +10 -2
  66. package/package.json +6 -1
  67. package/dist/chunk-JESR7H4R.mjs.map +0 -1
  68. package/dist/chunk-RNHDFZIC.mjs.map +0 -1
  69. /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) {
@@ -7407,8 +7447,12 @@ var GET_AD = import_client44.gql`
7407
7447
  ${AD_FIELDS_FRAGMENT}
7408
7448
  `;
7409
7449
  var GET_ADS_BY_REGION = import_client44.gql`
7410
- query getAdsByRegion($region: String!, $platform: AdPlatformEnum!) {
7411
- adsByRegion(region: $region, platform: $platform) {
7450
+ query getAdsByRegion(
7451
+ $region: String!
7452
+ $platform: AdPlatformEnum!
7453
+ $showOn: AdShowOnEnum
7454
+ ) {
7455
+ adsByRegion(region: $region, platform: $platform, showOn: $showOn) {
7412
7456
  ...AdFields
7413
7457
  }
7414
7458
  }
@@ -7511,11 +7555,11 @@ var useGetAd = (_id) => {
7511
7555
  refetch
7512
7556
  };
7513
7557
  };
7514
- var useGetAdsByRegion = (region, platform) => {
7558
+ var useGetAdsByRegion = (region, platform, showOn) => {
7515
7559
  const { data, loading, error, refetch } = (0, import_client47.useQuery)(GET_ADS_BY_REGION, {
7516
7560
  fetchPolicy: "no-cache",
7517
7561
  skip: !region || region === "",
7518
- variables: { platform, region }
7562
+ variables: { platform, region, showOn }
7519
7563
  });
7520
7564
  return {
7521
7565
  adsByRegion: data?.adsByRegion || [],
@@ -10161,6 +10205,7 @@ function canAccessAdminPath(roles, pathname) {
10161
10205
  foodFlavourOptions,
10162
10206
  formatCategoryLabel,
10163
10207
  formatDate,
10208
+ formatDistance,
10164
10209
  formatIrdNumber,
10165
10210
  formatNZBankAccount,
10166
10211
  formatShareApplicationCategoriesSection,
@@ -10185,6 +10230,8 @@ function canAccessAdminPath(roles, pathname) {
10185
10230
  getBillingCatalogKeyForSelection,
10186
10231
  getCurrentAndFutureDates,
10187
10232
  getDefaultAdminHome,
10233
+ getDistanceInKilometers,
10234
+ getDistanceInMeters,
10188
10235
  getErrorMessage,
10189
10236
  getEventCalendarIsoDates,
10190
10237
  getEventDatesWithStallholders,