@timardex/cluemart-shared 2.5.2 → 3.0.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.
@@ -1,18 +1,18 @@
1
- import "../chunk-YJJUTHBX.mjs";
1
+ import "../chunk-OVSUNBMA.mjs";
2
2
  import "../chunk-VA5YN2K3.mjs";
3
3
  import "../chunk-VPANTTZI.mjs";
4
4
  import "../chunk-DWO35OY4.mjs";
5
- import "../chunk-WRYRBSRZ.mjs";
5
+ import "../chunk-JEULYOPH.mjs";
6
6
  import {
7
7
  SCHOOL_MIN_STUDENT_COUNT,
8
8
  isValidIrdNumber,
9
9
  normalizeUrl
10
- } from "../chunk-T736WX7J.mjs";
10
+ } from "../chunk-JSUPW2TO.mjs";
11
11
  import "../chunk-RE4NZPYY.mjs";
12
12
  import {
13
13
  dateFormat,
14
14
  timeFormat
15
- } from "../chunk-TGEYOSSX.mjs";
15
+ } from "../chunk-ENRGEWZM.mjs";
16
16
  import {
17
17
  EnumAdShowOn,
18
18
  EnumAdStatus,
package/dist/index.cjs CHANGED
@@ -314,7 +314,6 @@ __export(index_exports, {
314
314
  isInternalErrorMessage: () => isInternalErrorMessage,
315
315
  isIsoDateString: () => isIsoDateString,
316
316
  isNonVisitorResourceType: () => isNonVisitorResourceType,
317
- isPastDate: () => isPastDate,
318
317
  isPostShareResourceType: () => isPostShareResourceType,
319
318
  isRelationShareResourceType: () => isRelationShareResourceType,
320
319
  isResourceImageActive: () => isResourceImageActive,
@@ -1331,11 +1330,10 @@ function nzDayKey(input) {
1331
1330
  function isUtcMidnight(value) {
1332
1331
  return value instanceof Date && !Number.isNaN(value.getTime()) && value.getUTCHours() === 0 && value.getUTCMinutes() === 0 && value.getUTCSeconds() === 0 && value.getUTCMilliseconds() === 0;
1333
1332
  }
1334
- var DATE_DISPLAY_FORMAT = "dddd, D MMMM, YYYY";
1335
1333
  var formatDate = (dateStr, display = "datetime", timeStr) => {
1336
1334
  const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
1337
1335
  const dateTime = timeStr ? (0, import_dayjs2.default)(dateTimeStr, `${dateFormat} ${timeFormat}`) : (0, import_dayjs2.default)(dateStr, dateFormat);
1338
- const formattedDate = dateTime.format(DATE_DISPLAY_FORMAT);
1336
+ const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
1339
1337
  const formattedTime = dateTime.format("h:mm a");
1340
1338
  switch (display) {
1341
1339
  case "date":
@@ -1348,24 +1346,13 @@ var formatDate = (dateStr, display = "datetime", timeStr) => {
1348
1346
  return formattedDate;
1349
1347
  }
1350
1348
  };
1351
- function parseStrictDate(dateStr) {
1352
- return (0, import_dayjs2.default)(dateStr, dateFormat, true);
1353
- }
1354
- function isDayBeforeNzToday(parsed) {
1355
- const dayKey = /* @__PURE__ */ new Date(`${parsed.format(isoDateFormat)}T00:00:00Z`);
1356
- return dayKey.getTime() < nzDayKey().getTime();
1357
- }
1358
- function isPastDate(dateStr) {
1359
- const parsed = parseStrictDate(dateStr);
1360
- return parsed.isValid() && isDayBeforeNzToday(parsed);
1361
- }
1362
1349
  function formatDateOptionLabel(dateStr) {
1363
- const parsed = parseStrictDate(dateStr);
1350
+ const parsed = (0, import_dayjs2.default)(dateStr, dateFormat, true);
1364
1351
  if (!parsed.isValid()) {
1365
1352
  return dateStr;
1366
1353
  }
1367
- const label = parsed.format(DATE_DISPLAY_FORMAT);
1368
- return isDayBeforeNzToday(parsed) ? `${label} (Past)` : label;
1354
+ const label = formatDate(dateStr, "date");
1355
+ return parsed.isBefore((0, import_dayjs2.default)(), "day") ? `${label} (Past)` : label;
1369
1356
  }
1370
1357
  var SLOT_FORMATS = [
1371
1358
  `${dateFormat} ${timeFormat}`,
@@ -3177,6 +3164,9 @@ function eventStartDatesSet(dateTime) {
3177
3164
  );
3178
3165
  }
3179
3166
  function hasMatchingEventDate(vendorStartDates, eventStartDates) {
3167
+ if (eventStartDates.size === 0) {
3168
+ return true;
3169
+ }
3180
3170
  return vendorStartDates.some((startDate) => eventStartDates.has(startDate));
3181
3171
  }
3182
3172
  function matchesSelectedDate(vendorStartDates, selectedDate) {
@@ -3330,8 +3320,8 @@ function getVendorEventRelationDateOptions(events) {
3330
3320
  value: startDate
3331
3321
  }));
3332
3322
  }
3333
- function getVendorEventsEmptyMessage() {
3334
- return "No events found.";
3323
+ function getVendorEventsEmptyMessage(hasAnyEventsForVendor = false, selectedDate = null) {
3324
+ return hasAnyEventsForVendor && selectedDate ? "No events found for this date." : "No events found.";
3335
3325
  }
3336
3326
 
3337
3327
  // src/utils/affiliate.ts
@@ -3645,7 +3635,10 @@ function getVendorEventsData({
3645
3635
  })
3646
3636
  );
3647
3637
  return {
3648
- emptyMessage: getVendorEventsEmptyMessage(),
3638
+ emptyMessage: getVendorEventsEmptyMessage(
3639
+ (events?.length ?? 0) > 0,
3640
+ selectedDate
3641
+ ),
3649
3642
  eventDateOptions,
3650
3643
  eventsByDate: filterVendorEventsBySelectedDate(events, selectedDate),
3651
3644
  hasDatePills: eventDateOptions.length > 0
@@ -10877,7 +10870,6 @@ function canAccessAdminPath(roles, pathname) {
10877
10870
  isInternalErrorMessage,
10878
10871
  isIsoDateString,
10879
10872
  isNonVisitorResourceType,
10880
- isPastDate,
10881
10873
  isPostShareResourceType,
10882
10874
  isRelationShareResourceType,
10883
10875
  isResourceImageActive,