@timardex/cluemart-shared 3.0.0 → 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.
package/dist/index.d.mts CHANGED
@@ -4272,6 +4272,16 @@ type StallholderFilterOption = {
4272
4272
  declare function eventStartDatesSet(dateTime: Array<{
4273
4273
  startDate?: string | null;
4274
4274
  }> | undefined): Set<string>;
4275
+ /**
4276
+ * True when the vendor shares a start date with the event, **or** when
4277
+ * `eventStartDates` is empty (no dates to scope against).
4278
+ *
4279
+ * An empty set means the event payload has no dates (all archived, or a response
4280
+ * that has not been merged yet). The constraint is then skipped: the stallholder
4281
+ * list is already event-scoped, and intersecting against an empty set would
4282
+ * filter every vendor out and make the screen claim the event has no
4283
+ * stallholders.
4284
+ */
4275
4285
  declare function hasMatchingEventDate(vendorStartDates: string[], eventStartDates: Set<string>): boolean;
4276
4286
  declare function matchesSelectedDate(vendorStartDates: string[], selectedDate: string | null): boolean;
4277
4287
  declare function matchesCategory(categoryNames: string[], selectedCategory: string | null): boolean;
@@ -4299,7 +4309,7 @@ declare function filterVendorEventsBySelectedDate(events: EventListItemType[] |
4299
4309
  declare function collectVendorEventRelationDateTimes(events: EventListItemType[] | null | undefined): DateTimeType[];
4300
4310
  declare function getVendorEventRelationStartDates(events: EventListItemType[] | null | undefined): string[];
4301
4311
  declare function getVendorEventRelationDateOptions(events: EventListItemType[] | null | undefined): StallholderFilterOption[];
4302
- declare function getVendorEventsEmptyMessage(): string;
4312
+ declare function getVendorEventsEmptyMessage(hasAnyEventsForVendor?: boolean, selectedDate?: string | null): string;
4303
4313
 
4304
4314
  declare const AFFILIATE_PARTICIPANT_TYPE_LABELS: {
4305
4315
  readonly INDIVIDUAL: "Individual";
package/dist/index.d.ts CHANGED
@@ -4272,6 +4272,16 @@ type StallholderFilterOption = {
4272
4272
  declare function eventStartDatesSet(dateTime: Array<{
4273
4273
  startDate?: string | null;
4274
4274
  }> | undefined): Set<string>;
4275
+ /**
4276
+ * True when the vendor shares a start date with the event, **or** when
4277
+ * `eventStartDates` is empty (no dates to scope against).
4278
+ *
4279
+ * An empty set means the event payload has no dates (all archived, or a response
4280
+ * that has not been merged yet). The constraint is then skipped: the stallholder
4281
+ * list is already event-scoped, and intersecting against an empty set would
4282
+ * filter every vendor out and make the screen claim the event has no
4283
+ * stallholders.
4284
+ */
4275
4285
  declare function hasMatchingEventDate(vendorStartDates: string[], eventStartDates: Set<string>): boolean;
4276
4286
  declare function matchesSelectedDate(vendorStartDates: string[], selectedDate: string | null): boolean;
4277
4287
  declare function matchesCategory(categoryNames: string[], selectedCategory: string | null): boolean;
@@ -4299,7 +4309,7 @@ declare function filterVendorEventsBySelectedDate(events: EventListItemType[] |
4299
4309
  declare function collectVendorEventRelationDateTimes(events: EventListItemType[] | null | undefined): DateTimeType[];
4300
4310
  declare function getVendorEventRelationStartDates(events: EventListItemType[] | null | undefined): string[];
4301
4311
  declare function getVendorEventRelationDateOptions(events: EventListItemType[] | null | undefined): StallholderFilterOption[];
4302
- declare function getVendorEventsEmptyMessage(): string;
4312
+ declare function getVendorEventsEmptyMessage(hasAnyEventsForVendor?: boolean, selectedDate?: string | null): string;
4303
4313
 
4304
4314
  declare const AFFILIATE_PARTICIPANT_TYPE_LABELS: {
4305
4315
  readonly INDIVIDUAL: "Individual";
package/dist/index.mjs CHANGED
@@ -2595,6 +2595,9 @@ function eventStartDatesSet(dateTime) {
2595
2595
  );
2596
2596
  }
2597
2597
  function hasMatchingEventDate(vendorStartDates, eventStartDates) {
2598
+ if (eventStartDates.size === 0) {
2599
+ return true;
2600
+ }
2598
2601
  return vendorStartDates.some((startDate) => eventStartDates.has(startDate));
2599
2602
  }
2600
2603
  function matchesSelectedDate(vendorStartDates, selectedDate) {
@@ -2748,8 +2751,8 @@ function getVendorEventRelationDateOptions(events) {
2748
2751
  value: startDate
2749
2752
  }));
2750
2753
  }
2751
- function getVendorEventsEmptyMessage() {
2752
- return "No events found.";
2754
+ function getVendorEventsEmptyMessage(hasAnyEventsForVendor = false, selectedDate = null) {
2755
+ return hasAnyEventsForVendor && selectedDate ? "No events found for this date." : "No events found.";
2753
2756
  }
2754
2757
 
2755
2758
  // src/utils/affiliate.ts
@@ -3063,7 +3066,10 @@ function getVendorEventsData({
3063
3066
  })
3064
3067
  );
3065
3068
  return {
3066
- emptyMessage: getVendorEventsEmptyMessage(),
3069
+ emptyMessage: getVendorEventsEmptyMessage(
3070
+ (events?.length ?? 0) > 0,
3071
+ selectedDate
3072
+ ),
3067
3073
  eventDateOptions,
3068
3074
  eventsByDate: filterVendorEventsBySelectedDate(events, selectedDate),
3069
3075
  hasDatePills: eventDateOptions.length > 0