@timardex/cluemart-shared 1.5.756 → 1.5.757

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,14 +1,14 @@
1
1
  import "../chunk-VA5YN2K3.mjs";
2
- import "../chunk-IMQU3E2F.mjs";
2
+ import "../chunk-6CRQZK5X.mjs";
3
3
  import "../chunk-O3S5IQT3.mjs";
4
4
  import "../chunk-NPFJ2CN2.mjs";
5
- import "../chunk-DQVXL6TO.mjs";
5
+ import "../chunk-3MLTYJMV.mjs";
6
6
  import {
7
7
  SCHOOL_MIN_STUDENT_COUNT,
8
8
  dateFormat,
9
9
  normalizeUrl,
10
10
  timeFormat
11
- } from "../chunk-KZLKBUMF.mjs";
11
+ } from "../chunk-UK4D5N3O.mjs";
12
12
  import {
13
13
  EnumAdShowOn,
14
14
  EnumAdStatus,
package/dist/index.cjs CHANGED
@@ -78,6 +78,7 @@ __export(index_exports, {
78
78
  IMAGE_EXTENSION: () => IMAGE_EXTENSION,
79
79
  IOS_URL: () => IOS_URL,
80
80
  ImageTypeEnum: () => ImageTypeEnum,
81
+ KNOWN_EVENT_SCHEDULE_STATUSES: () => KNOWN_EVENT_SCHEDULE_STATUSES,
81
82
  OG_DESCRIPTION_LINE_BREAK: () => OG_DESCRIPTION_LINE_BREAK,
82
83
  POST_SHARE_RESOURCE_TYPES: () => POST_SHARE_RESOURCE_TYPES,
83
84
  PROMO_CODE_PREFIX: () => PROMO_CODE_PREFIX,
@@ -131,6 +132,7 @@ __export(index_exports, {
131
132
  badgeIds: () => badgeIds,
132
133
  badges: () => badges,
133
134
  buildApplicationShareDescription: () => buildApplicationShareDescription,
135
+ buildCalendarSheetContentData: () => buildCalendarSheetContentData,
134
136
  buildFacebookShareQuote: () => buildFacebookShareQuote,
135
137
  buildInvitationShareDescription: () => buildInvitationShareDescription,
136
138
  buildPublicEventShareDescription: () => buildPublicEventShareDescription,
@@ -159,6 +161,7 @@ __export(index_exports, {
159
161
  eventMatchesDateStatusPeriod: () => eventMatchesDateStatusPeriod,
160
162
  eventStartDateFields: () => eventStartDateFields,
161
163
  filterEventsByDateStatusPeriod: () => filterEventsByDateStatusPeriod,
164
+ findEventDateTimeByIsoDate: () => findEventDateTimeByIsoDate,
162
165
  fonts: () => fonts,
163
166
  foodFlavourOptions: () => foodFlavourOptions,
164
167
  formatCategoryLabel: () => formatCategoryLabel,
@@ -177,11 +180,16 @@ __export(index_exports, {
177
180
  formatShareTagsSection: () => formatShareTagsSection,
178
181
  formatStallCapacityLabel: () => formatStallCapacityLabel,
179
182
  formatTimestamp: () => formatTimestamp,
183
+ fromCalendarIsoDate: () => fromCalendarIsoDate,
180
184
  futureTimePeriods: () => futureTimePeriods,
181
185
  gameScreenIdentifierList: () => gameScreenIdentifierList,
182
186
  gameTypeToDisplayName: () => gameTypeToDisplayName,
183
187
  getAllowedEventDateStatuses: () => getAllowedEventDateStatuses,
184
188
  getCurrentAndFutureDates: () => getCurrentAndFutureDates,
189
+ getEventCalendarIsoDates: () => getEventCalendarIsoDates,
190
+ getEventScheduleStatusLabel: () => getEventScheduleStatusLabel,
191
+ getEventScheduleStatusPresentation: () => getEventScheduleStatusPresentation,
192
+ getEventScheduleStatusTone: () => getEventScheduleStatusTone,
185
193
  iconFiles: () => iconFiles,
186
194
  iconIds: () => iconIds,
187
195
  icons: () => icons,
@@ -225,6 +233,7 @@ __export(index_exports, {
225
233
  rewardNiceNames: () => rewardNiceNames,
226
234
  seededShuffle: () => seededShuffle,
227
235
  shareMessageFooterPlacementForType: () => shareMessageFooterPlacementForType,
236
+ shouldShowEventActionsWithWeather: () => shouldShowEventActionsWithWeather,
228
237
  socialMediaFields: () => socialMediaFields,
229
238
  sortDatesChronologically: () => sortDatesChronologically,
230
239
  splitShareDescriptionSections: () => splitShareDescriptionSections,
@@ -232,6 +241,7 @@ __export(index_exports, {
232
241
  statusOptions: () => statusOptions,
233
242
  tagOptions: () => tagOptions,
234
243
  timeFormat: () => timeFormat,
244
+ toCalendarIsoDate: () => toCalendarIsoDate,
235
245
  toGraphqlQueryString: () => toGraphqlQueryString,
236
246
  toNZTime: () => toNZTime,
237
247
  truncateText: () => truncateText,
@@ -1335,6 +1345,76 @@ function filterEventsByDateStatusPeriod(events, period) {
1335
1345
  );
1336
1346
  }
1337
1347
 
1348
+ // src/calendar/eventCalendar.ts
1349
+ var import_dayjs2 = __toESM(require("dayjs"));
1350
+ var KNOWN_EVENT_SCHEDULE_STATUSES = /* @__PURE__ */ new Set([
1351
+ "Started" /* STARTED */,
1352
+ "Starting_Soon" /* STARTING_SOON */,
1353
+ "Ended" /* ENDED */
1354
+ ]);
1355
+ function toCalendarIsoDate(startDate) {
1356
+ const formatted = (0, import_dayjs2.default)(startDate, dateFormat).format("YYYY-MM-DD");
1357
+ return (0, import_dayjs2.default)(formatted, "YYYY-MM-DD", true).isValid() ? formatted : null;
1358
+ }
1359
+ function fromCalendarIsoDate(isoDate) {
1360
+ return (0, import_dayjs2.default)(isoDate, "YYYY-MM-DD").format(dateFormat);
1361
+ }
1362
+ function getEventCalendarIsoDates(dateTimes) {
1363
+ return dateTimes?.map((dateTime) => toCalendarIsoDate(dateTime.startDate)).filter((date) => Boolean(date)) ?? [];
1364
+ }
1365
+ function findEventDateTimeByIsoDate(dateTimes, isoDate) {
1366
+ const selected = fromCalendarIsoDate(isoDate);
1367
+ return dateTimes?.find((dateTime) => dateTime.startDate === selected) ?? null;
1368
+ }
1369
+ function buildCalendarSheetContentData(dateTimes, isoDate, location, resourceId, resourceType) {
1370
+ const dateTime = findEventDateTimeByIsoDate(dateTimes, isoDate);
1371
+ if (!dateTime) {
1372
+ return null;
1373
+ }
1374
+ return {
1375
+ dateTime,
1376
+ location,
1377
+ resourceId,
1378
+ resourceType
1379
+ };
1380
+ }
1381
+ function getEventScheduleStatusTone(status) {
1382
+ switch (status) {
1383
+ case "Started" /* STARTED */:
1384
+ return "started";
1385
+ case "Starting_Soon" /* STARTING_SOON */:
1386
+ return "startingSoon";
1387
+ case "Ended" /* ENDED */:
1388
+ return "ended";
1389
+ default:
1390
+ return "default";
1391
+ }
1392
+ }
1393
+ function getEventScheduleStatusPresentation(dateTime) {
1394
+ return {
1395
+ status: dateTime.dateStatus,
1396
+ statusLabel: dateTime.dateStatus.replaceAll("_", " ").toLowerCase(),
1397
+ tone: getEventScheduleStatusTone(dateTime.dateStatus)
1398
+ };
1399
+ }
1400
+ function getEventScheduleStatusLabel(dateTime, onlyShowKnownStatuses) {
1401
+ const { dateStatus: status } = dateTime;
1402
+ const isKnownStatus = Boolean(
1403
+ status && KNOWN_EVENT_SCHEDULE_STATUSES.has(status)
1404
+ );
1405
+ if (onlyShowKnownStatuses && !isKnownStatus) {
1406
+ return null;
1407
+ }
1408
+ return isKnownStatus ? status.replaceAll("_", " ").toLowerCase() : `Next event date: ${formatDate(dateTime.startDate, "date")}`;
1409
+ }
1410
+ function shouldShowEventActionsWithWeather(resourceType, dateTime, location) {
1411
+ return resourceType === "event" /* EVENT */ && Boolean(location) && Boolean(dateTime?.dateStatus) && ![
1412
+ "Ended" /* ENDED */,
1413
+ "Canceled" /* CANCELED */,
1414
+ "Started" /* STARTED */
1415
+ ].includes(dateTime.dateStatus);
1416
+ }
1417
+
1338
1418
  // src/formFields/vendor/vendorInfo.ts
1339
1419
  var vendorElectricity = {
1340
1420
  details: {
@@ -8497,6 +8577,7 @@ var fonts = {
8497
8577
  IMAGE_EXTENSION,
8498
8578
  IOS_URL,
8499
8579
  ImageTypeEnum,
8580
+ KNOWN_EVENT_SCHEDULE_STATUSES,
8500
8581
  OG_DESCRIPTION_LINE_BREAK,
8501
8582
  POST_SHARE_RESOURCE_TYPES,
8502
8583
  PROMO_CODE_PREFIX,
@@ -8550,6 +8631,7 @@ var fonts = {
8550
8631
  badgeIds,
8551
8632
  badges,
8552
8633
  buildApplicationShareDescription,
8634
+ buildCalendarSheetContentData,
8553
8635
  buildFacebookShareQuote,
8554
8636
  buildInvitationShareDescription,
8555
8637
  buildPublicEventShareDescription,
@@ -8578,6 +8660,7 @@ var fonts = {
8578
8660
  eventMatchesDateStatusPeriod,
8579
8661
  eventStartDateFields,
8580
8662
  filterEventsByDateStatusPeriod,
8663
+ findEventDateTimeByIsoDate,
8581
8664
  fonts,
8582
8665
  foodFlavourOptions,
8583
8666
  formatCategoryLabel,
@@ -8596,11 +8679,16 @@ var fonts = {
8596
8679
  formatShareTagsSection,
8597
8680
  formatStallCapacityLabel,
8598
8681
  formatTimestamp,
8682
+ fromCalendarIsoDate,
8599
8683
  futureTimePeriods,
8600
8684
  gameScreenIdentifierList,
8601
8685
  gameTypeToDisplayName,
8602
8686
  getAllowedEventDateStatuses,
8603
8687
  getCurrentAndFutureDates,
8688
+ getEventCalendarIsoDates,
8689
+ getEventScheduleStatusLabel,
8690
+ getEventScheduleStatusPresentation,
8691
+ getEventScheduleStatusTone,
8604
8692
  iconFiles,
8605
8693
  iconIds,
8606
8694
  icons,
@@ -8644,6 +8732,7 @@ var fonts = {
8644
8732
  rewardNiceNames,
8645
8733
  seededShuffle,
8646
8734
  shareMessageFooterPlacementForType,
8735
+ shouldShowEventActionsWithWeather,
8647
8736
  socialMediaFields,
8648
8737
  sortDatesChronologically,
8649
8738
  splitShareDescriptionSections,
@@ -8651,6 +8740,7 @@ var fonts = {
8651
8740
  statusOptions,
8652
8741
  tagOptions,
8653
8742
  timeFormat,
8743
+ toCalendarIsoDate,
8654
8744
  toGraphqlQueryString,
8655
8745
  toNZTime,
8656
8746
  truncateText,