@timardex/cluemart-shared 2.2.22 → 2.2.24

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 (35) hide show
  1. package/dist/{chunk-YKJAOTF7.mjs → chunk-6O6TRUOV.mjs} +2 -2
  2. package/dist/{chunk-FWKZZMQR.mjs → chunk-IKRXLKJ3.mjs} +1 -1
  3. package/dist/{chunk-FWKZZMQR.mjs.map → chunk-IKRXLKJ3.mjs.map} +1 -1
  4. package/dist/{chunk-MTBH5LMV.mjs → chunk-MUDAYKZ6.mjs} +16 -2
  5. package/dist/chunk-MUDAYKZ6.mjs.map +1 -0
  6. package/dist/{chunk-JWWUTS56.mjs → chunk-PNGFNH7J.mjs} +2 -2
  7. package/dist/{chunk-64RGRFSO.mjs → chunk-UOJGSBHK.mjs} +34 -18
  8. package/dist/chunk-UOJGSBHK.mjs.map +1 -0
  9. package/dist/formFields/index.cjs +14 -14
  10. package/dist/formFields/index.cjs.map +1 -1
  11. package/dist/formFields/index.mjs +4 -4
  12. package/dist/hooks/index.cjs +14 -14
  13. package/dist/hooks/index.cjs.map +1 -1
  14. package/dist/hooks/index.mjs +5 -5
  15. package/dist/index.cjs +47 -15
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.mts +41 -8
  18. package/dist/index.d.ts +41 -8
  19. package/dist/index.mjs +44 -15
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/sharing/index.cjs +14 -1
  22. package/dist/sharing/index.cjs.map +1 -1
  23. package/dist/sharing/index.mjs +2 -2
  24. package/dist/types/index.cjs.map +1 -1
  25. package/dist/types/index.mjs +1 -1
  26. package/dist/utils/index.cjs +47 -15
  27. package/dist/utils/index.cjs.map +1 -1
  28. package/dist/utils/index.d.mts +41 -8
  29. package/dist/utils/index.d.ts +41 -8
  30. package/dist/utils/index.mjs +10 -4
  31. package/package.json +1 -1
  32. package/dist/chunk-64RGRFSO.mjs.map +0 -1
  33. package/dist/chunk-MTBH5LMV.mjs.map +0 -1
  34. /package/dist/{chunk-YKJAOTF7.mjs.map → chunk-6O6TRUOV.mjs.map} +0 -0
  35. /package/dist/{chunk-JWWUTS56.mjs.map → chunk-PNGFNH7J.mjs.map} +0 -0
@@ -1,18 +1,18 @@
1
- import "../chunk-YKJAOTF7.mjs";
1
+ import "../chunk-6O6TRUOV.mjs";
2
2
  import "../chunk-VA5YN2K3.mjs";
3
3
  import "../chunk-VPANTTZI.mjs";
4
4
  import "../chunk-DWO35OY4.mjs";
5
- import "../chunk-JWWUTS56.mjs";
5
+ import "../chunk-PNGFNH7J.mjs";
6
6
  import {
7
7
  SCHOOL_MIN_STUDENT_COUNT,
8
8
  isValidIrdNumber,
9
9
  normalizeUrl
10
- } from "../chunk-64RGRFSO.mjs";
10
+ } from "../chunk-UOJGSBHK.mjs";
11
11
  import "../chunk-RE4NZPYY.mjs";
12
12
  import {
13
13
  dateFormat,
14
14
  timeFormat
15
- } from "../chunk-MTBH5LMV.mjs";
15
+ } from "../chunk-MUDAYKZ6.mjs";
16
16
  import {
17
17
  EnumAdShowOn,
18
18
  EnumAdStatus,
@@ -21,7 +21,7 @@ import {
21
21
  EnumAffiliateParticipantType,
22
22
  EnumPostContentType,
23
23
  EnumPostType
24
- } from "../chunk-FWKZZMQR.mjs";
24
+ } from "../chunk-IKRXLKJ3.mjs";
25
25
  import "../chunk-RAYUJODN.mjs";
26
26
  import "../chunk-DQ7ZHIXW.mjs";
27
27
  import "../chunk-TCV735VY.mjs";
package/dist/index.cjs CHANGED
@@ -213,6 +213,8 @@ __export(index_exports, {
213
213
  computeDailyClueState: () => computeDailyClueState,
214
214
  computeHasMore: () => computeHasMore,
215
215
  contactUsFields: () => contactUsFields,
216
+ countLetterOccurrences: () => countLetterOccurrences,
217
+ countLetterOccurrencesUpTo: () => countLetterOccurrencesUpTo,
216
218
  createAffiliateReward: () => createAffiliateReward,
217
219
  darkColors: () => darkColors,
218
220
  dateFormat: () => dateFormat,
@@ -262,6 +264,7 @@ __export(index_exports, {
262
264
  getAllowedEventDateStatuses: () => getAllowedEventDateStatuses,
263
265
  getBillingCatalogKeyForSelection: () => getBillingCatalogKeyForSelection,
264
266
  getCurrentAndFutureDates: () => getCurrentAndFutureDates,
267
+ getDailyClueDayIndex: () => getDailyClueDayIndex,
265
268
  getDefaultAdminHome: () => getDefaultAdminHome,
266
269
  getDistanceInKilometers: () => getDistanceInKilometers,
267
270
  getDistanceInMeters: () => getDistanceInMeters,
@@ -1148,6 +1151,19 @@ var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.j
1148
1151
  var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek.js"));
1149
1152
  import_dayjs.default.extend(import_customParseFormat.default);
1150
1153
  import_dayjs.default.extend(import_isoWeek.default);
1154
+ var EVENT_DATE_STATUS_LABELS = {
1155
+ ["Starting_Soon" /* STARTING_SOON */]: "Starting Soon",
1156
+ ["Started" /* STARTED */]: "Started",
1157
+ ["Today" /* TODAY */]: "Today",
1158
+ ["Tomorrow" /* TOMORROW */]: "Tomorrow",
1159
+ ["This_Week" /* THIS_WEEK */]: "This Week",
1160
+ ["Next_Week" /* NEXT_WEEK */]: "Next Week",
1161
+ ["Upcoming" /* UPCOMING */]: "Upcoming",
1162
+ ["Ended" /* ENDED */]: "Ended",
1163
+ ["Rescheduled" /* RE_SCHEDULED */]: "Rescheduled",
1164
+ ["Canceled" /* CANCELED */]: "Canceled",
1165
+ ["Invalid" /* INVALID */]: "Invalid"
1166
+ };
1151
1167
  var EVENT_DATE_STATUS_PERIOD_MAP = {
1152
1168
  ["Today" /* TODAY */]: [
1153
1169
  "Started" /* STARTED */,
@@ -1339,7 +1355,7 @@ function sortDatesChronologically(dates) {
1339
1355
  var futureTimePeriods = FUTURE_EVENT_DATE_STATUSES.filter(
1340
1356
  (status) => status !== "Starting_Soon" /* STARTING_SOON */
1341
1357
  ).map((status) => ({
1342
- label: status.replaceAll("_", " "),
1358
+ label: EVENT_DATE_STATUS_LABELS[status],
1343
1359
  value: status
1344
1360
  }));
1345
1361
 
@@ -1374,6 +1390,31 @@ function seededShuffle(array, seed) {
1374
1390
  function getDayIndex(start, today) {
1375
1391
  return today.diff(start, "day");
1376
1392
  }
1393
+ function getDailyClueDayIndex(dailyClue) {
1394
+ const today = nzStartOfDay();
1395
+ const start = nzStartOfDay(dailyClue.gameFields.gameDate.startDate);
1396
+ const end = nzStartOfDay(dailyClue.gameFields.gameDate.endDate);
1397
+ if (today.isBefore(start) || today.isAfter(end)) {
1398
+ return null;
1399
+ }
1400
+ return getDayIndex(start, today);
1401
+ }
1402
+ function countLetterOccurrences(letters, letter) {
1403
+ return letters.reduce(
1404
+ (count, candidate) => candidate === letter ? count + 1 : count,
1405
+ 0
1406
+ );
1407
+ }
1408
+ function countLetterOccurrencesUpTo(letters, letter, index) {
1409
+ let count = 0;
1410
+ const end = Math.min(index, letters.length - 1);
1411
+ for (let i = 0; i <= end; i++) {
1412
+ if (letters[i] === letter) {
1413
+ count++;
1414
+ }
1415
+ }
1416
+ return count;
1417
+ }
1377
1418
  function computeDailyClueState(dailyClue) {
1378
1419
  const { startDate, endDate } = dailyClue.gameFields.gameDate;
1379
1420
  const { solutionShuffled, collected } = dailyClue.letterInfo;
@@ -1401,7 +1442,8 @@ function computeDailyClueState(dailyClue) {
1401
1442
  const letterToday = solutionShuffled[index];
1402
1443
  const placement = shuffledPlacements[index];
1403
1444
  if (!letterToday || !placement) return null;
1404
- const alreadyCollectedToday = (collected ?? []).includes(letterToday);
1445
+ const collectedLetters = collected ?? [];
1446
+ const alreadyCollectedToday = countLetterOccurrences(collectedLetters, letterToday) >= countLetterOccurrencesUpTo(solutionShuffled, letterToday, index);
1405
1447
  if (alreadyCollectedToday) {
1406
1448
  return {
1407
1449
  todaysClue: null,
@@ -1953,19 +1995,6 @@ var SCHOOL_MAX_STUDENT_COUNT = 0;
1953
1995
 
1954
1996
  // src/calendar/eventCalendar.ts
1955
1997
  var import_dayjs3 = __toESM(require("dayjs"));
1956
- var EVENT_DATE_STATUS_LABELS = {
1957
- ["Starting_Soon" /* STARTING_SOON */]: "Starting Soon",
1958
- ["Started" /* STARTED */]: "Started",
1959
- ["Today" /* TODAY */]: "Today",
1960
- ["Tomorrow" /* TOMORROW */]: "Tomorrow",
1961
- ["This_Week" /* THIS_WEEK */]: "This Week",
1962
- ["Next_Week" /* NEXT_WEEK */]: "Next Week",
1963
- ["Upcoming" /* UPCOMING */]: "Upcoming",
1964
- ["Ended" /* ENDED */]: "Ended",
1965
- ["Rescheduled" /* RE_SCHEDULED */]: "Rescheduled",
1966
- ["Canceled" /* CANCELED */]: "Canceled",
1967
- ["Invalid" /* INVALID */]: "Invalid"
1968
- };
1969
1998
  function toCalendarIsoDate(startDate) {
1970
1999
  const formatted = (0, import_dayjs3.default)(startDate, dateFormat).format("YYYY-MM-DD");
1971
2000
  return (0, import_dayjs3.default)(formatted, "YYYY-MM-DD", true).isValid() ? formatted : null;
@@ -10349,6 +10378,8 @@ function canAccessAdminPath(roles, pathname) {
10349
10378
  computeDailyClueState,
10350
10379
  computeHasMore,
10351
10380
  contactUsFields,
10381
+ countLetterOccurrences,
10382
+ countLetterOccurrencesUpTo,
10352
10383
  createAffiliateReward,
10353
10384
  darkColors,
10354
10385
  dateFormat,
@@ -10398,6 +10429,7 @@ function canAccessAdminPath(roles, pathname) {
10398
10429
  getAllowedEventDateStatuses,
10399
10430
  getBillingCatalogKeyForSelection,
10400
10431
  getCurrentAndFutureDates,
10432
+ getDailyClueDayIndex,
10401
10433
  getDefaultAdminHome,
10402
10434
  getDistanceInKilometers,
10403
10435
  getDistanceInMeters,