@timardex/cluemart-shared 2.2.41 → 2.3.10

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 (38) hide show
  1. package/dist/{chunk-VHNCSCQU.mjs → chunk-DV3K3JDE.mjs} +2 -2
  2. package/dist/{chunk-PJY7OAQ2.mjs → chunk-HKTBJOB7.mjs} +27 -11
  3. package/dist/chunk-HKTBJOB7.mjs.map +1 -0
  4. package/dist/{chunk-QIF4ZGMY.mjs → chunk-KMS64DE2.mjs} +2 -2
  5. package/dist/{chunk-2GUAD63W.mjs → chunk-PBW5K54C.mjs} +2 -2
  6. package/dist/{chunk-MKHXXZWF.mjs → chunk-UWMZ6VLV.mjs} +45 -2
  7. package/dist/chunk-UWMZ6VLV.mjs.map +1 -0
  8. package/dist/formFields/index.cjs +10 -0
  9. package/dist/formFields/index.cjs.map +1 -1
  10. package/dist/formFields/index.mjs +3 -3
  11. package/dist/graphql/index.cjs +46 -1
  12. package/dist/graphql/index.cjs.map +1 -1
  13. package/dist/graphql/index.d.mts +25 -1
  14. package/dist/graphql/index.d.ts +25 -1
  15. package/dist/graphql/index.mjs +5 -1
  16. package/dist/hooks/index.cjs +25 -0
  17. package/dist/hooks/index.cjs.map +1 -1
  18. package/dist/hooks/index.mjs +5 -5
  19. package/dist/index.cjs +73 -11
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.mts +33 -1
  22. package/dist/index.d.ts +33 -1
  23. package/dist/index.mjs +70 -11
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/sharing/index.cjs +6 -0
  26. package/dist/sharing/index.cjs.map +1 -1
  27. package/dist/sharing/index.mjs +2 -2
  28. package/dist/utils/index.cjs +27 -10
  29. package/dist/utils/index.cjs.map +1 -1
  30. package/dist/utils/index.d.mts +9 -1
  31. package/dist/utils/index.d.ts +9 -1
  32. package/dist/utils/index.mjs +4 -2
  33. package/package.json +1 -1
  34. package/dist/chunk-MKHXXZWF.mjs.map +0 -1
  35. package/dist/chunk-PJY7OAQ2.mjs.map +0 -1
  36. /package/dist/{chunk-VHNCSCQU.mjs.map → chunk-DV3K3JDE.mjs.map} +0 -0
  37. /package/dist/{chunk-QIF4ZGMY.mjs.map → chunk-KMS64DE2.mjs.map} +0 -0
  38. /package/dist/{chunk-2GUAD63W.mjs.map → chunk-PBW5K54C.mjs.map} +0 -0
@@ -1,18 +1,18 @@
1
- import "../chunk-QIF4ZGMY.mjs";
1
+ import "../chunk-KMS64DE2.mjs";
2
2
  import "../chunk-VA5YN2K3.mjs";
3
3
  import "../chunk-VPANTTZI.mjs";
4
4
  import "../chunk-DWO35OY4.mjs";
5
- import "../chunk-2GUAD63W.mjs";
5
+ import "../chunk-PBW5K54C.mjs";
6
6
  import {
7
7
  SCHOOL_MIN_STUDENT_COUNT,
8
8
  isValidIrdNumber,
9
9
  normalizeUrl
10
- } from "../chunk-VHNCSCQU.mjs";
10
+ } from "../chunk-DV3K3JDE.mjs";
11
11
  import "../chunk-RE4NZPYY.mjs";
12
12
  import {
13
13
  dateFormat,
14
14
  timeFormat
15
- } from "../chunk-PJY7OAQ2.mjs";
15
+ } from "../chunk-HKTBJOB7.mjs";
16
16
  import {
17
17
  EnumAdShowOn,
18
18
  EnumAdStatus,
@@ -24,7 +24,7 @@ import {
24
24
  } from "../chunk-5AAYX364.mjs";
25
25
  import "../chunk-RAYUJODN.mjs";
26
26
  import "../chunk-DQ7ZHIXW.mjs";
27
- import "../chunk-MKHXXZWF.mjs";
27
+ import "../chunk-UWMZ6VLV.mjs";
28
28
  import "../chunk-TKSBCN3N.mjs";
29
29
  import "../chunk-7DQBUZXY.mjs";
30
30
  import {
package/dist/index.cjs CHANGED
@@ -303,6 +303,7 @@ __export(index_exports, {
303
303
  icons: () => icons,
304
304
  isFutureDatesBeforeThreshold: () => isFutureDatesBeforeThreshold,
305
305
  isFutureEventDateStatus: () => isFutureEventDateStatus,
306
+ isFutureStartDate: () => isFutureStartDate,
306
307
  isInternalErrorMessage: () => isInternalErrorMessage,
307
308
  isIsoDateString: () => isIsoDateString,
308
309
  isNonVisitorResourceType: () => isNonVisitorResourceType,
@@ -452,6 +453,8 @@ __export(index_exports, {
452
453
  useGetPrivateChats: () => useGetPrivateChats,
453
454
  useGetRelation: () => useGetRelation,
454
455
  useGetRelationByEventAndVendor: () => useGetRelationByEventAndVendor,
456
+ useGetRelationHistories: () => useGetRelationHistories,
457
+ useGetRelationHistory: () => useGetRelationHistory,
455
458
  useGetReportedChatUsers: () => useGetReportedChatUsers,
456
459
  useGetResourceActivity: () => useGetResourceActivity,
457
460
  useGetResourceConnections: () => useGetResourceConnections,
@@ -1321,19 +1324,34 @@ var formatDate = (dateStr, display = "datetime", timeStr) => {
1321
1324
  return formattedDate;
1322
1325
  }
1323
1326
  };
1327
+ var SLOT_FORMATS = [
1328
+ `${dateFormat} ${timeFormat}`,
1329
+ `${dateFormat} H:mm`,
1330
+ `${dateFormat} ${timeFormat}:ss`,
1331
+ `${dateFormat} H:mm:ss`
1332
+ ];
1333
+ var parseSlot = (date) => {
1334
+ if (!date.startDate || !date.startTime) {
1335
+ return null;
1336
+ }
1337
+ const value = `${date.startDate} ${date.startTime}`;
1338
+ for (const format of SLOT_FORMATS) {
1339
+ const parsed = (0, import_dayjs2.default)(value, format, true);
1340
+ if (parsed.isValid()) {
1341
+ return parsed;
1342
+ }
1343
+ }
1344
+ return null;
1345
+ };
1346
+ var isFutureDateTime = (date, now) => {
1347
+ const slot = parseSlot(date);
1348
+ return slot ? slot.isSameOrAfter(now) : false;
1349
+ };
1324
1350
  var getCurrentAndFutureDates = (dates) => {
1325
1351
  const now = (0, import_dayjs2.default)();
1326
- return dates.filter((dateObj) => {
1327
- if (!dateObj.startDate || !dateObj.startTime) {
1328
- return false;
1329
- }
1330
- const dateTime = (0, import_dayjs2.default)(
1331
- `${dateObj.startDate} ${dateObj.startTime}`,
1332
- `${dateFormat} ${timeFormat}`
1333
- );
1334
- return dateTime.isSameOrAfter(now);
1335
- });
1352
+ return dates.filter((dateObj) => isFutureDateTime(dateObj, now));
1336
1353
  };
1354
+ var isFutureStartDate = (date) => isFutureDateTime(date, (0, import_dayjs2.default)());
1337
1355
  var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
1338
1356
  if (!date.startDate || !date.startTime) {
1339
1357
  return false;
@@ -5753,6 +5771,25 @@ var GET_RELATION = import_client11.gql`
5753
5771
  }
5754
5772
  ${RELATION_FIELDS_FRAGMENT}
5755
5773
  `;
5774
+ var GET_RELATION_HISTORY = import_client11.gql`
5775
+ query getRelationHistory($_id: ID!) {
5776
+ relationHistory(_id: $_id) {
5777
+ ...RelationFields
5778
+ }
5779
+ }
5780
+ ${RELATION_FIELDS_FRAGMENT}
5781
+ `;
5782
+ var GET_RELATION_HISTORIES = import_client11.gql`
5783
+ query getRelationHistories(
5784
+ $resourceId: ID!
5785
+ $resourceType: ResourceTypeEnum!
5786
+ ) {
5787
+ relationHistories(resourceId: $resourceId, resourceType: $resourceType) {
5788
+ ...RelationFields
5789
+ }
5790
+ }
5791
+ ${RELATION_FIELDS_FRAGMENT}
5792
+ `;
5756
5793
  var GET_RELATION_BY_EVENT_AND_VENDOR = import_client11.gql`
5757
5794
  query getRelationByEventAndVendor($eventId: ID!, $vendorId: ID!) {
5758
5795
  relationByEventAndVendor(eventId: $eventId, vendorId: $vendorId) {
@@ -7124,13 +7161,35 @@ var useDeleteRelation = () => {
7124
7161
  var import_client38 = require("@apollo/client");
7125
7162
  var useGetRelation = (_id) => {
7126
7163
  const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION, {
7127
- fetchPolicy: "network-only",
7164
+ // `relation` returns only upcoming dates, which is a projection of
7165
+ // RelationType rather than the stored document. Keep it out of the
7166
+ // normalized cache so it cannot overwrite `relationDates` of the same
7167
+ // entity id for other readers.
7168
+ fetchPolicy: "no-cache",
7128
7169
  skip: !_id,
7129
7170
  variables: _id ? { _id } : void 0
7130
7171
  });
7131
7172
  const relation = data?.relation;
7132
7173
  return { error, loading, refetch, relation };
7133
7174
  };
7175
+ var useGetRelationHistory = (_id) => {
7176
+ const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION_HISTORY, {
7177
+ fetchPolicy: "no-cache",
7178
+ skip: !_id,
7179
+ variables: _id ? { _id } : void 0
7180
+ });
7181
+ const relationHistory = data?.relationHistory;
7182
+ return { error, loading, refetch, relationHistory };
7183
+ };
7184
+ var useGetRelationHistories = (resourceId, resourceType) => {
7185
+ const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION_HISTORIES, {
7186
+ fetchPolicy: "no-cache",
7187
+ skip: !resourceId || !resourceType,
7188
+ variables: { resourceId, resourceType }
7189
+ });
7190
+ const relationHistories = data?.relationHistories || [];
7191
+ return { error, loading, refetch, relationHistories };
7192
+ };
7134
7193
  var useGetRelationByEventAndVendor = (eventId, vendorId) => {
7135
7194
  const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION_BY_EVENT_AND_VENDOR, {
7136
7195
  fetchPolicy: "network-only",
@@ -10583,6 +10642,7 @@ function canAccessAdminPath(roles, pathname) {
10583
10642
  icons,
10584
10643
  isFutureDatesBeforeThreshold,
10585
10644
  isFutureEventDateStatus,
10645
+ isFutureStartDate,
10586
10646
  isInternalErrorMessage,
10587
10647
  isIsoDateString,
10588
10648
  isNonVisitorResourceType,
@@ -10732,6 +10792,8 @@ function canAccessAdminPath(roles, pathname) {
10732
10792
  useGetPrivateChats,
10733
10793
  useGetRelation,
10734
10794
  useGetRelationByEventAndVendor,
10795
+ useGetRelationHistories,
10796
+ useGetRelationHistory,
10735
10797
  useGetReportedChatUsers,
10736
10798
  useGetResourceActivity,
10737
10799
  useGetResourceConnections,