@timardex/cluemart-shared 2.0.18 → 2.1.1

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 (85) hide show
  1. package/dist/{ad-ZwLtQn9a.d.ts → ad-CUckkB7I.d.ts} +2 -2
  2. package/dist/{ad-xO8ltnGA.d.mts → ad-sqc3JME-.d.mts} +2 -2
  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 +5 -16
  8. package/dist/auth/index.mjs.map +1 -1
  9. package/dist/{chunk-ZUXHEXJU.mjs → chunk-6ZH75TAT.mjs} +3 -3
  10. package/dist/{chunk-3DYFIY72.mjs → chunk-7TZDJXYL.mjs} +1 -2
  11. package/dist/chunk-7TZDJXYL.mjs.map +1 -0
  12. package/dist/{chunk-UH6POK3Y.mjs → chunk-7XIDMA4Z.mjs} +2 -2
  13. package/dist/chunk-N46DFZ3R.mjs +20 -0
  14. package/dist/chunk-N46DFZ3R.mjs.map +1 -0
  15. package/dist/{chunk-JESR7H4R.mjs → chunk-PIEXGXTD.mjs} +1 -1
  16. package/dist/chunk-PIEXGXTD.mjs.map +1 -0
  17. package/dist/chunk-RE4NZPYY.mjs +43 -0
  18. package/dist/chunk-RE4NZPYY.mjs.map +1 -0
  19. package/dist/{chunk-5G3MQXQX.mjs → chunk-UHZHNJHO.mjs} +4 -4
  20. package/dist/{chunk-KUC252SN.mjs → chunk-YMLEIEZD.mjs} +5 -27
  21. package/dist/chunk-YMLEIEZD.mjs.map +1 -0
  22. package/dist/{chunk-PNKTKJ47.mjs → chunk-Z4FML4VL.mjs} +2 -2
  23. package/dist/{contactUs-DtKFwekV.d.ts → contactUs-BG3sJ6gc.d.ts} +1 -1
  24. package/dist/{contactUs-0IhAsiDW.d.mts → contactUs-CWFP59_0.d.mts} +1 -1
  25. package/dist/enums/index.cjs +0 -1
  26. package/dist/enums/index.cjs.map +1 -1
  27. package/dist/enums/index.d.mts +1 -2
  28. package/dist/enums/index.d.ts +1 -2
  29. package/dist/enums/index.mjs +1 -1
  30. package/dist/formFields/index.cjs.map +1 -1
  31. package/dist/formFields/index.d.mts +1 -1
  32. package/dist/formFields/index.d.ts +1 -1
  33. package/dist/formFields/index.mjs +6 -5
  34. package/dist/{global-C6w0hQ5Y.d.mts → global-BqeTWrvk.d.ts} +4 -1
  35. package/dist/{global-Coz5Jgi2.d.ts → global-CWo-hWKZ.d.mts} +4 -1
  36. package/dist/graphql/index.cjs +4 -27
  37. package/dist/graphql/index.cjs.map +1 -1
  38. package/dist/graphql/index.d.mts +6 -14
  39. package/dist/graphql/index.d.ts +6 -14
  40. package/dist/graphql/index.mjs +2 -4
  41. package/dist/hooks/index.cjs +0 -8
  42. package/dist/hooks/index.cjs.map +1 -1
  43. package/dist/hooks/index.d.mts +5 -5
  44. package/dist/hooks/index.d.ts +5 -5
  45. package/dist/hooks/index.mjs +8 -7
  46. package/dist/hooks/index.mjs.map +1 -1
  47. package/dist/index.cjs +47 -28
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.mts +9 -11
  50. package/dist/index.d.ts +9 -11
  51. package/dist/index.mjs +44 -27
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/map/index.d.mts +1 -1
  54. package/dist/map/index.d.ts +1 -1
  55. package/dist/region/index.cjs +290 -0
  56. package/dist/region/index.cjs.map +1 -0
  57. package/dist/region/index.d.mts +36 -0
  58. package/dist/region/index.d.ts +36 -0
  59. package/dist/region/index.mjs +220 -0
  60. package/dist/region/index.mjs.map +1 -0
  61. package/dist/{resourceActivities-DScv6fiM.d.ts → resourceActivities-BbhGFtZA.d.ts} +1 -1
  62. package/dist/{resourceActivities-DIK3bwZg.d.mts → resourceActivities-D81u7Mu0.d.mts} +1 -1
  63. package/dist/sharing/index.cjs.map +1 -1
  64. package/dist/sharing/index.d.mts +1 -1
  65. package/dist/sharing/index.d.ts +1 -1
  66. package/dist/sharing/index.mjs +3 -3
  67. package/dist/types/index.cjs.map +1 -1
  68. package/dist/types/index.d.mts +7 -7
  69. package/dist/types/index.d.ts +7 -7
  70. package/dist/types/index.mjs +2 -2
  71. package/dist/{user-DhxdbFT7.d.ts → user-2peJoOeK.d.ts} +1 -1
  72. package/dist/{user-BwcVKK-h.d.mts → user-DKcyf8gn.d.mts} +1 -1
  73. package/dist/utils/index.cjs +43 -0
  74. package/dist/utils/index.cjs.map +1 -1
  75. package/dist/utils/index.d.mts +8 -4
  76. package/dist/utils/index.d.ts +8 -4
  77. package/dist/utils/index.mjs +12 -4
  78. package/package.json +6 -1
  79. package/dist/chunk-3DYFIY72.mjs.map +0 -1
  80. package/dist/chunk-JESR7H4R.mjs.map +0 -1
  81. package/dist/chunk-KUC252SN.mjs.map +0 -1
  82. /package/dist/{chunk-ZUXHEXJU.mjs.map → chunk-6ZH75TAT.mjs.map} +0 -0
  83. /package/dist/{chunk-UH6POK3Y.mjs.map → chunk-7XIDMA4Z.mjs.map} +0 -0
  84. /package/dist/{chunk-5G3MQXQX.mjs.map → chunk-UHZHNJHO.mjs.map} +0 -0
  85. /package/dist/{chunk-PNKTKJ47.mjs.map → chunk-Z4FML4VL.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,
@@ -435,7 +438,6 @@ __export(index_exports, {
435
438
  useGetPrivateChats: () => useGetPrivateChats,
436
439
  useGetRelation: () => useGetRelation,
437
440
  useGetRelationByEventAndVendor: () => useGetRelationByEventAndVendor,
438
- useGetRelationChats: () => useGetRelationChats,
439
441
  useGetReportedChatUsers: () => useGetReportedChatUsers,
440
442
  useGetResourceActivity: () => useGetResourceActivity,
441
443
  useGetResourceConnections: () => useGetResourceConnections,
@@ -555,7 +557,6 @@ var EnumChatReportReason = /* @__PURE__ */ ((EnumChatReportReason2) => {
555
557
  var EnumChatType = /* @__PURE__ */ ((EnumChatType2) => {
556
558
  EnumChatType2["GROUP"] = "group";
557
559
  EnumChatType2["PRIVATE"] = "private";
558
- EnumChatType2["RELATION"] = "relation";
559
560
  return EnumChatType2;
560
561
  })(EnumChatType || {});
561
562
  var EnumPaymentMethod = /* @__PURE__ */ ((EnumPaymentMethod2) => {
@@ -1284,6 +1285,43 @@ function computeDailyClueState(dailyClue) {
1284
1285
  };
1285
1286
  }
1286
1287
 
1288
+ // src/utils/distance.ts
1289
+ function getDistanceInMeters(coordinates1, coordinates2) {
1290
+ const [lon1, lat1] = coordinates1;
1291
+ const [lon2, lat2] = coordinates2;
1292
+ const values = [lon1, lat1, lon2, lat2];
1293
+ if (values.some((v) => !Number.isFinite(v))) {
1294
+ return Infinity;
1295
+ }
1296
+ const toRadians = (deg) => deg * Math.PI / 180;
1297
+ const R = 6371e3;
1298
+ const dLat = toRadians(lat2 - lat1);
1299
+ const dLon = toRadians(lon2 - lon1);
1300
+ const radLat1 = toRadians(lat1);
1301
+ const radLat2 = toRadians(lat2);
1302
+ const a = Math.sin(dLat / 2) ** 2 + Math.sin(dLon / 2) ** 2 * Math.cos(radLat1) * Math.cos(radLat2);
1303
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
1304
+ return R * c;
1305
+ }
1306
+ function getDistanceInKilometers(coordinates1, coordinates2) {
1307
+ const distanceInMeters = getDistanceInMeters(coordinates1, coordinates2);
1308
+ if (!Number.isFinite(distanceInMeters)) {
1309
+ return Infinity;
1310
+ }
1311
+ return Math.round(distanceInMeters / 1e3);
1312
+ }
1313
+ function formatDistance(coordinates1, coordinates2) {
1314
+ const distanceInMeters = getDistanceInMeters(coordinates1, coordinates2);
1315
+ if (!Number.isFinite(distanceInMeters)) {
1316
+ return "\u2014";
1317
+ }
1318
+ const roundedMeters = Math.round(distanceInMeters);
1319
+ if (roundedMeters < 1e3) {
1320
+ return `${roundedMeters} m`;
1321
+ }
1322
+ return `${Math.round(roundedMeters / 1e3)} km`;
1323
+ }
1324
+
1287
1325
  // src/utils/pagination.ts
1288
1326
  var DEFAULT_PAGE_SIZE = 50;
1289
1327
  function defaultGetId(item) {
@@ -5772,14 +5810,6 @@ var PRIVATE_CHATS = import_client16.gql`
5772
5810
  }
5773
5811
  ${CHAT_FIELDS_FRAGMENT}
5774
5812
  `;
5775
- var RELATION_CHATS = import_client16.gql`
5776
- query relationChats {
5777
- relationChats {
5778
- ...ChatFields
5779
- }
5780
- }
5781
- ${CHAT_FIELDS_FRAGMENT}
5782
- `;
5783
5813
  var GET_CHATS_BY_REGION = import_client16.gql`
5784
5814
  query getChatsByRegion($region: String!) {
5785
5815
  chatsByRegion(region: $region) {
@@ -5925,7 +5955,7 @@ var useSendChatMessage = () => {
5925
5955
  var useDeleteChat = () => {
5926
5956
  const [deleteChat, { loading, error }] = (0, import_client18.useMutation)(DELETE_CHAT_MUTATION, {
5927
5957
  awaitRefetchQueries: true,
5928
- refetchQueries: [{ query: PRIVATE_CHATS }, { query: RELATION_CHATS }]
5958
+ refetchQueries: [{ query: PRIVATE_CHATS }]
5929
5959
  });
5930
5960
  return { deleteChat, error, loading };
5931
5961
  };
@@ -5941,9 +5971,6 @@ var useAddParticipantToChat = () => {
5941
5971
  },
5942
5972
  {
5943
5973
  query: PRIVATE_CHATS
5944
- },
5945
- {
5946
- query: RELATION_CHATS
5947
5974
  }
5948
5975
  ];
5949
5976
  }
@@ -5955,10 +5982,7 @@ var useRemoveParticipantFromChat = () => {
5955
5982
  awaitRefetchQueries: true,
5956
5983
  refetchQueries: (mutationResult) => {
5957
5984
  const region = mutationResult?.data?.removeParticipantFromChat?.data?.region;
5958
- const queries = [
5959
- { query: PRIVATE_CHATS },
5960
- { query: RELATION_CHATS }
5961
- ];
5985
+ const queries = [{ query: PRIVATE_CHATS }];
5962
5986
  if (region && region.trim() !== "") {
5963
5987
  queries.push({
5964
5988
  query: GET_CHATS_BY_REGION,
@@ -6036,13 +6060,6 @@ var useGetPrivateChats = () => {
6036
6060
  const privateChats = data?.privateChats || [];
6037
6061
  return { error, loading, privateChats, refetch };
6038
6062
  };
6039
- var useGetRelationChats = () => {
6040
- const { loading, error, data, refetch } = (0, import_client20.useQuery)(RELATION_CHATS, {
6041
- fetchPolicy: "network-only"
6042
- });
6043
- const relationChats = data?.relationChats || [];
6044
- return { error, loading, refetch, relationChats };
6045
- };
6046
6063
  var useGetChatSubscription = () => {
6047
6064
  const { data, loading, error } = (0, import_client20.useSubscription)(
6048
6065
  GET_CHAT_MESSAGE
@@ -6673,7 +6690,7 @@ var useCreateRelation = () => {
6673
6690
  variables: { resourceId, resourceType }
6674
6691
  },
6675
6692
  {
6676
- query: RELATION_CHATS
6693
+ query: PRIVATE_CHATS
6677
6694
  }
6678
6695
  ];
6679
6696
  }
@@ -6754,7 +6771,7 @@ var useDeleteRelation = () => {
6754
6771
  variables: { resourceId, resourceType }
6755
6772
  },
6756
6773
  {
6757
- query: RELATION_CHATS
6774
+ query: PRIVATE_CHATS
6758
6775
  }
6759
6776
  ];
6760
6777
  }
@@ -10165,6 +10182,7 @@ function canAccessAdminPath(roles, pathname) {
10165
10182
  foodFlavourOptions,
10166
10183
  formatCategoryLabel,
10167
10184
  formatDate,
10185
+ formatDistance,
10168
10186
  formatIrdNumber,
10169
10187
  formatNZBankAccount,
10170
10188
  formatShareApplicationCategoriesSection,
@@ -10189,6 +10207,8 @@ function canAccessAdminPath(roles, pathname) {
10189
10207
  getBillingCatalogKeyForSelection,
10190
10208
  getCurrentAndFutureDates,
10191
10209
  getDefaultAdminHome,
10210
+ getDistanceInKilometers,
10211
+ getDistanceInMeters,
10192
10212
  getErrorMessage,
10193
10213
  getEventCalendarIsoDates,
10194
10214
  getEventDatesWithStallholders,
@@ -10364,7 +10384,6 @@ function canAccessAdminPath(roles, pathname) {
10364
10384
  useGetPrivateChats,
10365
10385
  useGetRelation,
10366
10386
  useGetRelationByEventAndVendor,
10367
- useGetRelationChats,
10368
10387
  useGetReportedChatUsers,
10369
10388
  useGetResourceActivity,
10370
10389
  useGetResourceConnections,