@timardex/cluemart-shared 2.2.40 → 2.2.41

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-NMJ2CR2F.mjs";
1
+ import "../chunk-QIF4ZGMY.mjs";
2
2
  import "../chunk-VA5YN2K3.mjs";
3
3
  import "../chunk-VPANTTZI.mjs";
4
4
  import "../chunk-DWO35OY4.mjs";
5
- import "../chunk-VL275KFW.mjs";
5
+ import "../chunk-2GUAD63W.mjs";
6
6
  import {
7
7
  SCHOOL_MIN_STUDENT_COUNT,
8
8
  isValidIrdNumber,
9
9
  normalizeUrl
10
- } from "../chunk-BCMBTEGJ.mjs";
10
+ } from "../chunk-VHNCSCQU.mjs";
11
11
  import "../chunk-RE4NZPYY.mjs";
12
12
  import {
13
13
  dateFormat,
14
14
  timeFormat
15
- } from "../chunk-T5ZOYS3L.mjs";
15
+ } from "../chunk-PJY7OAQ2.mjs";
16
16
  import {
17
17
  EnumAdShowOn,
18
18
  EnumAdStatus,
package/dist/index.cjs CHANGED
@@ -209,7 +209,7 @@ __export(index_exports, {
209
209
  cluiFiles: () => cluiFiles,
210
210
  cluiIds: () => cluiIds,
211
211
  cluiImages: () => cluiImages,
212
- collectStallholderStartDates: () => collectStallholderStartDates,
212
+ collectStallholderDateTimes: () => collectStallholderDateTimes,
213
213
  collectVendorEventRelationDateTimes: () => collectVendorEventRelationDateTimes,
214
214
  companyContactFields: () => companyContactFields,
215
215
  computeDailyClueState: () => computeDailyClueState,
@@ -272,7 +272,6 @@ __export(index_exports, {
272
272
  getDistanceInMeters: () => getDistanceInMeters,
273
273
  getErrorMessage: () => getErrorMessage,
274
274
  getEventCalendarIsoDates: () => getEventCalendarIsoDates,
275
- getEventDatesWithStallholders: () => getEventDatesWithStallholders,
276
275
  getEventScheduleStatusLabel: () => getEventScheduleStatusLabel,
277
276
  getEventScheduleStatusPresentation: () => getEventScheduleStatusPresentation,
278
277
  getEventScheduleStatusTone: () => getEventScheduleStatusTone,
@@ -284,6 +283,8 @@ __export(index_exports, {
284
283
  getRegisteredVendorStartDates: () => getRegisteredVendorStartDates,
285
284
  getStallholderCategoryNames: () => getStallholderCategoryNames,
286
285
  getStallholderCategoryOptions: () => getStallholderCategoryOptions,
286
+ getUniqueStallholderStartDates: () => getUniqueStallholderStartDates,
287
+ getUniqueStartDates: () => getUniqueStartDates,
287
288
  getUnregisteredVendorCategoryNames: () => getUnregisteredVendorCategoryNames,
288
289
  getUnregisteredVendorStartDates: () => getUnregisteredVendorStartDates,
289
290
  getUsableAdminContexts: () => getUsableAdminContexts,
@@ -1371,6 +1372,18 @@ function sortDatesChronologically(dates) {
1371
1372
  return 0;
1372
1373
  });
1373
1374
  }
1375
+ function getUniqueStartDates(dates) {
1376
+ const seenStartDates = /* @__PURE__ */ new Set();
1377
+ const uniqueStartDates = [];
1378
+ for (const { startDate } of sortDatesChronologically(dates ?? [])) {
1379
+ if (!startDate || seenStartDates.has(startDate)) {
1380
+ continue;
1381
+ }
1382
+ seenStartDates.add(startDate);
1383
+ uniqueStartDates.push(startDate);
1384
+ }
1385
+ return uniqueStartDates;
1386
+ }
1374
1387
  var futureTimePeriods = FUTURE_EVENT_DATE_STATUSES.filter(
1375
1388
  (status) => status !== "Starting_Soon" /* STARTING_SOON */
1376
1389
  ).map((status) => ({
@@ -3184,21 +3197,23 @@ function filterUnregisteredVendorsByEventDatesOnly(vendors, eventStartDates) {
3184
3197
  )
3185
3198
  );
3186
3199
  }
3187
- function collectStallholderStartDates(registeredVendors, unregisteredVendors = []) {
3200
+ function collectStallholderDateTimes(registeredVendors, unregisteredVendors = []) {
3188
3201
  return [
3189
- ...registeredVendors.flatMap(getRegisteredVendorStartDates),
3190
- ...unregisteredVendors.flatMap(getUnregisteredVendorStartDates)
3202
+ ...registeredVendors.flatMap(
3203
+ (vendor) => (vendor.relations ?? []).flatMap(
3204
+ (relation) => (relation.relationDates ?? []).map(
3205
+ (relationDate) => relationDate.dateTime
3206
+ )
3207
+ )
3208
+ ),
3209
+ ...unregisteredVendors.flatMap(
3210
+ (vendor) => (vendor.invitations ?? []).flatMap((invitation) => invitation.dateTime)
3211
+ )
3191
3212
  ];
3192
3213
  }
3193
- function getEventDatesWithStallholders(eventDateTime, stallholderStartDates) {
3194
- if (!eventDateTime?.length) {
3195
- return [];
3196
- }
3197
- const startDates = new Set(stallholderStartDates);
3198
- return sortDatesChronologically(
3199
- eventDateTime.filter(
3200
- (date) => Boolean(date.startDate) && startDates.has(date.startDate)
3201
- )
3214
+ function getUniqueStallholderStartDates(registeredVendors, unregisteredVendors = []) {
3215
+ return getUniqueStartDates(
3216
+ collectStallholderDateTimes(registeredVendors, unregisteredVendors)
3202
3217
  );
3203
3218
  }
3204
3219
  function getStallholderCategoryNames(registeredVendors, unregisteredVendors = []) {
@@ -3254,16 +3269,7 @@ function collectVendorEventRelationDateTimes(events) {
3254
3269
  );
3255
3270
  }
3256
3271
  function getVendorEventRelationStartDates(events) {
3257
- const sortedDates = sortDatesChronologically(
3258
- collectVendorEventRelationDateTimes(events)
3259
- );
3260
- const uniqueStartDates = [];
3261
- for (const dateTime of sortedDates) {
3262
- if (dateTime.startDate && !uniqueStartDates.includes(dateTime.startDate)) {
3263
- uniqueStartDates.push(dateTime.startDate);
3264
- }
3265
- }
3266
- return uniqueStartDates;
3272
+ return getUniqueStartDates(collectVendorEventRelationDateTimes(events));
3267
3273
  }
3268
3274
  function getVendorEventRelationDateOptions(events) {
3269
3275
  return getVendorEventRelationStartDates(events).map((startDate) => ({
@@ -3528,12 +3534,12 @@ function getEventStallholdersData({
3528
3534
  registeredForSelectedDate,
3529
3535
  unregisteredForSelectedDate
3530
3536
  );
3531
- const futureEventStartDates = getEventDatesWithStallholders(
3532
- eventDateTime,
3533
- collectStallholderStartDates(registeredForEvent, unregisteredForEvent)
3534
- ).map((date) => ({
3535
- label: formatDate(date.startDate, "date"),
3536
- value: date.startDate
3537
+ const futureEventStartDates = getUniqueStallholderStartDates(
3538
+ registeredForEvent,
3539
+ unregisteredForEvent
3540
+ ).map((startDate) => ({
3541
+ label: formatDate(startDate, "date"),
3542
+ value: startDate
3537
3543
  }));
3538
3544
  const hasDatePills = futureEventStartDates.length > 0;
3539
3545
  const hasStallholders = vendorList.length > 0 || unregisteredVendorList.length > 0;
@@ -10483,7 +10489,7 @@ function canAccessAdminPath(roles, pathname) {
10483
10489
  cluiFiles,
10484
10490
  cluiIds,
10485
10491
  cluiImages,
10486
- collectStallholderStartDates,
10492
+ collectStallholderDateTimes,
10487
10493
  collectVendorEventRelationDateTimes,
10488
10494
  companyContactFields,
10489
10495
  computeDailyClueState,
@@ -10546,7 +10552,6 @@ function canAccessAdminPath(roles, pathname) {
10546
10552
  getDistanceInMeters,
10547
10553
  getErrorMessage,
10548
10554
  getEventCalendarIsoDates,
10549
- getEventDatesWithStallholders,
10550
10555
  getEventScheduleStatusLabel,
10551
10556
  getEventScheduleStatusPresentation,
10552
10557
  getEventScheduleStatusTone,
@@ -10558,6 +10563,8 @@ function canAccessAdminPath(roles, pathname) {
10558
10563
  getRegisteredVendorStartDates,
10559
10564
  getStallholderCategoryNames,
10560
10565
  getStallholderCategoryOptions,
10566
+ getUniqueStallholderStartDates,
10567
+ getUniqueStartDates,
10561
10568
  getUnregisteredVendorCategoryNames,
10562
10569
  getUnregisteredVendorStartDates,
10563
10570
  getUsableAdminContexts,