@timardex/cluemart-shared 2.2.41 → 2.3.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 (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-YTRRTC2S.mjs} +11 -6
  7. package/dist/chunk-YTRRTC2S.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 +10 -5
  12. package/dist/graphql/index.cjs.map +1 -1
  13. package/dist/graphql/index.d.mts +3 -1
  14. package/dist/graphql/index.d.ts +3 -1
  15. package/dist/graphql/index.mjs +1 -1
  16. package/dist/hooks/index.cjs +8 -2
  17. package/dist/hooks/index.cjs.map +1 -1
  18. package/dist/hooks/index.mjs +5 -5
  19. package/dist/index.cjs +37 -15
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.mts +12 -2
  22. package/dist/index.d.ts +12 -2
  23. package/dist/index.mjs +36 -15
  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-YTRRTC2S.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,
@@ -1321,19 +1322,34 @@ var formatDate = (dateStr, display = "datetime", timeStr) => {
1321
1322
  return formattedDate;
1322
1323
  }
1323
1324
  };
1325
+ var SLOT_FORMATS = [
1326
+ `${dateFormat} ${timeFormat}`,
1327
+ `${dateFormat} H:mm`,
1328
+ `${dateFormat} ${timeFormat}:ss`,
1329
+ `${dateFormat} H:mm:ss`
1330
+ ];
1331
+ var parseSlot = (date) => {
1332
+ if (!date.startDate || !date.startTime) {
1333
+ return null;
1334
+ }
1335
+ const value = `${date.startDate} ${date.startTime}`;
1336
+ for (const format of SLOT_FORMATS) {
1337
+ const parsed = (0, import_dayjs2.default)(value, format, true);
1338
+ if (parsed.isValid()) {
1339
+ return parsed;
1340
+ }
1341
+ }
1342
+ return null;
1343
+ };
1344
+ var isFutureDateTime = (date, now) => {
1345
+ const slot = parseSlot(date);
1346
+ return slot ? slot.isSameOrAfter(now) : false;
1347
+ };
1324
1348
  var getCurrentAndFutureDates = (dates) => {
1325
1349
  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
- });
1350
+ return dates.filter((dateObj) => isFutureDateTime(dateObj, now));
1336
1351
  };
1352
+ var isFutureStartDate = (date) => isFutureDateTime(date, (0, import_dayjs2.default)());
1337
1353
  var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
1338
1354
  if (!date.startDate || !date.startTime) {
1339
1355
  return false;
@@ -5746,8 +5762,8 @@ var RELATION_FIELDS_FRAGMENT = import_client11.gql`
5746
5762
  ${RELATION_DATES_FRAGMENT}
5747
5763
  `;
5748
5764
  var GET_RELATION = import_client11.gql`
5749
- query getRelation($_id: ID!) {
5750
- relation(_id: $_id) {
5765
+ query getRelation($_id: ID!, $futureOnly: Boolean = false) {
5766
+ relation(_id: $_id, futureOnly: $futureOnly) {
5751
5767
  ...RelationFields
5752
5768
  }
5753
5769
  }
@@ -7122,11 +7138,16 @@ var useDeleteRelation = () => {
7122
7138
 
7123
7139
  // src/graphql/hooks/relation/hooksQuery.ts
7124
7140
  var import_client38 = require("@apollo/client");
7125
- var useGetRelation = (_id) => {
7141
+ var useGetRelation = (_id, options) => {
7126
7142
  const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION, {
7127
- fetchPolicy: "network-only",
7143
+ // `relation(futureOnly)` is a projection-specific view of RelationType.
7144
+ // If this writes into the normalized RelationType cache, a full-history
7145
+ // read (e.g. the statistics screen's `futureOnly: false`) and this one can
7146
+ // overwrite each other's `relationDates` for the same entity id. Keep it
7147
+ // uncached.
7148
+ fetchPolicy: "no-cache",
7128
7149
  skip: !_id,
7129
- variables: _id ? { _id } : void 0
7150
+ variables: _id ? { _id, futureOnly: options?.futureOnly ?? false } : void 0
7130
7151
  });
7131
7152
  const relation = data?.relation;
7132
7153
  return { error, loading, refetch, relation };
@@ -10583,6 +10604,7 @@ function canAccessAdminPath(roles, pathname) {
10583
10604
  icons,
10584
10605
  isFutureDatesBeforeThreshold,
10585
10606
  isFutureEventDateStatus,
10607
+ isFutureStartDate,
10586
10608
  isInternalErrorMessage,
10587
10609
  isIsoDateString,
10588
10610
  isNonVisitorResourceType,