@timardex/cluemart-shared 2.2.0 → 2.2.2
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/{ad-rrCulESo.d.ts → ad-C4L_-r-4.d.ts} +12 -3
- package/dist/{ad-D0xWGTAB.d.mts → ad-XtBAH4rD.d.mts} +12 -3
- package/dist/{affiliate-C9eTAxEj.d.ts → affiliate-CxZHVZb2.d.ts} +2 -2
- package/dist/{affiliate-CGe0hR-U.d.mts → affiliate-D-L_UtL8.d.mts} +2 -2
- package/dist/apollo/index.cjs +12 -7
- package/dist/apollo/index.cjs.map +1 -1
- package/dist/apollo/index.d.mts +11 -0
- package/dist/apollo/index.d.ts +11 -0
- package/dist/apollo/index.mjs +12 -7
- package/dist/apollo/index.mjs.map +1 -1
- package/dist/auth/index.cjs +42 -3
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.mts +5 -4
- package/dist/auth/index.d.ts +5 -4
- package/dist/auth/index.mjs +7 -5
- package/dist/auth/index.mjs.map +1 -1
- package/dist/{chunk-OSSBKFNH.mjs → chunk-BR4XNXE7.mjs} +52 -1
- package/dist/chunk-BR4XNXE7.mjs.map +1 -0
- package/dist/{chunk-PIEXGXTD.mjs → chunk-FWKZZMQR.mjs} +1 -1
- package/dist/chunk-FWKZZMQR.mjs.map +1 -0
- package/dist/{chunk-KT65YYOB.mjs → chunk-KHC57ZNS.mjs} +16 -12
- package/dist/chunk-KHC57ZNS.mjs.map +1 -0
- package/dist/{chunk-T7A7ZG55.mjs → chunk-MTBH5LMV.mjs} +111 -22
- package/dist/chunk-MTBH5LMV.mjs.map +1 -0
- package/dist/{chunk-OK3BPZYA.mjs → chunk-PUX53EZX.mjs} +3 -3
- package/dist/{chunk-YPWBK4WU.mjs → chunk-Q2WLLXTA.mjs} +2 -1
- package/dist/chunk-Q2WLLXTA.mjs.map +1 -0
- package/dist/{chunk-GOWIY4NZ.mjs → chunk-TCV735VY.mjs} +10 -2
- package/dist/chunk-TCV735VY.mjs.map +1 -0
- package/dist/{chunk-BTZIWVSF.mjs → chunk-YKJAOTF7.mjs} +3 -3
- package/dist/chunk-YKJAOTF7.mjs.map +1 -0
- package/dist/{contactUs-Be0zqd9Q.d.ts → contactUs-CR-nghbk.d.ts} +1 -1
- package/dist/{contactUs-CQXyz40A.d.mts → contactUs-CwHKoGEt.d.mts} +1 -1
- package/dist/enums/index.cjs +1 -0
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.mts +1 -0
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums/index.mjs +1 -1
- package/dist/formFields/index.cjs +16 -7
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +1 -1
- package/dist/formFields/index.d.ts +1 -1
- package/dist/formFields/index.mjs +5 -5
- package/dist/{global-CAf04GRC.d.ts → global-B4mmQo6R.d.ts} +25 -7
- package/dist/{global-d8RFwoYS.d.mts → global-D1r5ZuQO.d.mts} +25 -7
- package/dist/graphql/index.cjs +62 -0
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +33 -6
- package/dist/graphql/index.d.ts +33 -6
- package/dist/graphql/index.mjs +9 -3
- package/dist/hooks/index.cjs +84 -37
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +5 -5
- package/dist/hooks/index.d.ts +5 -5
- package/dist/hooks/index.mjs +20 -20
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +190 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +90 -15
- package/dist/index.d.ts +90 -15
- package/dist/index.mjs +185 -32
- package/dist/index.mjs.map +1 -1
- package/dist/map/index.d.mts +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/region/index.cjs.map +1 -1
- package/dist/region/index.d.mts +1 -1
- package/dist/region/index.d.ts +1 -1
- package/dist/region/index.mjs +1 -1
- package/dist/{resourceActivities-DO_PjmMN.d.mts → resourceActivities-DUReu_jD.d.mts} +1 -1
- package/dist/{resourceActivities-ByCZO0rJ.d.ts → resourceActivities-Uz9uavhK.d.ts} +1 -1
- package/dist/sharing/index.cjs +21 -10
- package/dist/sharing/index.cjs.map +1 -1
- package/dist/sharing/index.d.mts +1 -1
- package/dist/sharing/index.d.ts +1 -1
- package/dist/sharing/index.mjs +3 -3
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +7 -7
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.mjs +2 -2
- package/dist/{user-BHYl7drL.d.mts → user-BpR-FTW2.d.mts} +1 -1
- package/dist/{user-DCqDbTLd.d.ts → user-IR0bHKFb.d.ts} +1 -1
- package/dist/utils/index.cjs +126 -31
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +32 -12
- package/dist/utils/index.d.ts +32 -12
- package/dist/utils/index.mjs +9 -5
- package/package.json +1 -1
- package/dist/chunk-BTZIWVSF.mjs.map +0 -1
- package/dist/chunk-GOWIY4NZ.mjs.map +0 -1
- package/dist/chunk-KT65YYOB.mjs.map +0 -1
- package/dist/chunk-OSSBKFNH.mjs.map +0 -1
- package/dist/chunk-PIEXGXTD.mjs.map +0 -1
- package/dist/chunk-T7A7ZG55.mjs.map +0 -1
- package/dist/chunk-YPWBK4WU.mjs.map +0 -1
- /package/dist/{chunk-OK3BPZYA.mjs.map → chunk-PUX53EZX.mjs.map} +0 -0
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a4 as DailyClueGameData,
|
|
1
|
+
import { a4 as DailyClueGameData, al as GamePlacementClue, ak as GamePlacement, O as OptionItem, af as EnumPostType, aW as SocialMediaType, aU as ResourceImageType, a6 as DateTimeType, L as LocationType, i as VendorType, h as UnregisteredVendorType, d as EventListItemType } from '../global-D1r5ZuQO.mjs';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import { EnumEventDateStatus, EnumRegions, EnumUserLicence, EnumReward, EnumInviteStatus, EnumResourceType, EnumBillingPeriod } from '../enums/index.mjs';
|
|
4
|
-
import { h as EnumAffiliateRewardType, f as AffiliateRewardType } from '../affiliate-
|
|
4
|
+
import { h as EnumAffiliateRewardType, f as AffiliateRewardType } from '../affiliate-D-L_UtL8.mjs';
|
|
5
5
|
import { c as BillingCatalogKey, a as BillingCatalogDefinition, b as BillingCatalogInitialEntry, B as BillingCatalogEntryType } from '../billingCatalog-DDAU9BWV.mjs';
|
|
6
6
|
import 'react-hook-form';
|
|
7
|
-
import '../user-
|
|
7
|
+
import '../user-BpR-FTW2.mjs';
|
|
8
8
|
|
|
9
9
|
/** Seeded shuffle so all players see the same letter order / placements for a game. */
|
|
10
10
|
declare function seededShuffle<T>(array: readonly T[], seed: string): T[];
|
|
@@ -36,6 +36,7 @@ declare function computeHasMore(pageLength: number, pageSize: number): boolean;
|
|
|
36
36
|
|
|
37
37
|
declare const dateFormat = "DD-MM-YYYY";
|
|
38
38
|
declare const timeFormat = "HH:mm";
|
|
39
|
+
|
|
39
40
|
declare function toNZTime(date?: Date | string): dayjs.Dayjs;
|
|
40
41
|
/** Start of the calendar day in Pacific/Auckland (daily games, streaks, etc.). */
|
|
41
42
|
declare function nzStartOfDay(input?: Date | string | number | null): dayjs.Dayjs;
|
|
@@ -49,12 +50,12 @@ type DateFormat = "date" | "time" | "datetime";
|
|
|
49
50
|
*/
|
|
50
51
|
declare const formatDate: (dateStr: string, display?: DateFormat, timeStr?: string) => string;
|
|
51
52
|
declare const getCurrentAndFutureDates: <T extends {
|
|
52
|
-
startDate
|
|
53
|
-
startTime
|
|
53
|
+
startDate?: string;
|
|
54
|
+
startTime?: string;
|
|
54
55
|
}>(dates: T[]) => T[];
|
|
55
56
|
declare const isFutureDatesBeforeThreshold: (date: {
|
|
56
|
-
startDate
|
|
57
|
-
startTime
|
|
57
|
+
startDate?: string;
|
|
58
|
+
startTime?: string;
|
|
58
59
|
}, minHoursFromNow: number) => boolean;
|
|
59
60
|
declare const formatTimestamp: (timestamp: string) => string;
|
|
60
61
|
declare const isIsoDateString: (value: unknown) => value is string;
|
|
@@ -64,8 +65,8 @@ declare const isIsoDateString: (value: unknown) => value is string;
|
|
|
64
65
|
* @returns - The sorted array of date strings.
|
|
65
66
|
*/
|
|
66
67
|
declare function sortDatesChronologically<T extends {
|
|
67
|
-
startDate
|
|
68
|
-
startTime
|
|
68
|
+
startDate?: string;
|
|
69
|
+
startTime?: string;
|
|
69
70
|
}>(dates: T[]): T[];
|
|
70
71
|
/**
|
|
71
72
|
* UI filter options for user-activity event periods. Derived from the canonical
|
|
@@ -160,6 +161,21 @@ declare function isFutureEventDateStatus(dateStatus: EnumEventDateStatus | null
|
|
|
160
161
|
declare function filterDatesByFutureStatus<T extends {
|
|
161
162
|
dateStatus?: EnumEventDateStatus | null;
|
|
162
163
|
}>(dates: T[]): T[];
|
|
164
|
+
/**
|
|
165
|
+
* Determines the dateStatus for a future event date
|
|
166
|
+
* @param startDateTime The start date-time of the event
|
|
167
|
+
* @param now The current date-time
|
|
168
|
+
* @returns The appropriate EnumEventDateStatus
|
|
169
|
+
*/
|
|
170
|
+
declare function getFutureEventStatus(startDateTime: dayjs.Dayjs, now: dayjs.Dayjs): EnumEventDateStatus;
|
|
171
|
+
/**
|
|
172
|
+
* Updates the dateStatus field for a single DateTimeType object based on the current date/time.
|
|
173
|
+
* Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
|
|
174
|
+
* @param dateTime The date-time object to update
|
|
175
|
+
* @returns A new object with an updated dateStatus value, or the original
|
|
176
|
+
* object when the stored status is a manual override
|
|
177
|
+
*/
|
|
178
|
+
declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
|
|
163
179
|
|
|
164
180
|
type CalendarSheetContentData = {
|
|
165
181
|
dateTime: DateTimeType;
|
|
@@ -175,7 +191,9 @@ type EventScheduleStatusPresentation = {
|
|
|
175
191
|
};
|
|
176
192
|
declare function toCalendarIsoDate(startDate: string): string | null;
|
|
177
193
|
declare function fromCalendarIsoDate(isoDate: string): string;
|
|
178
|
-
declare function getEventCalendarIsoDates(dateTimes:
|
|
194
|
+
declare function getEventCalendarIsoDates(dateTimes: Array<{
|
|
195
|
+
startDate?: string | null;
|
|
196
|
+
}> | null | undefined): string[];
|
|
179
197
|
declare function findEventDateTimeByIsoDate(dateTimes: DateTimeType[] | null | undefined, isoDate: string): DateTimeType | null;
|
|
180
198
|
declare function buildCalendarSheetContentData(dateTimes: DateTimeType[], isoDate: string, location: LocationType, resourceId: string, resourceType: EnumResourceType): CalendarSheetContentData | null;
|
|
181
199
|
declare function getEventScheduleStatusTone(status: EnumEventDateStatus): EventScheduleStatusTone;
|
|
@@ -187,7 +205,9 @@ type StallholderFilterOption = {
|
|
|
187
205
|
label: string;
|
|
188
206
|
value: string;
|
|
189
207
|
};
|
|
190
|
-
declare function eventStartDatesSet(dateTime:
|
|
208
|
+
declare function eventStartDatesSet(dateTime: Array<{
|
|
209
|
+
startDate?: string | null;
|
|
210
|
+
}> | undefined): Set<string>;
|
|
191
211
|
declare function hasMatchingEventDate(vendorStartDates: string[], eventStartDates: Set<string>): boolean;
|
|
192
212
|
declare function matchesSelectedDate(vendorStartDates: string[], selectedDate: string | null): boolean;
|
|
193
213
|
declare function matchesCategory(categoryNames: string[], selectedCategory: string | null): boolean;
|
|
@@ -311,4 +331,4 @@ declare function toUserFacingErrorMessage(error: string | null | undefined, fall
|
|
|
311
331
|
/** Extracts and sanitizes an unknown catch/Apollo error for toasts and alerts. */
|
|
312
332
|
declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
313
333
|
|
|
314
|
-
export { AFFILIATE_PARTICIPANT_TYPE_LABELS, AFFILIATE_REWARDS, ANDROID_URL, BILLING_CATALOG_CURRENCY, BILLING_CATALOG_DEFINITIONS, BILLING_CATALOG_KEYS, CLUEMART_MAIN_DOMAIN_URL, CM_AFFILIATE_PROMO_CODE, CM_SCHOOL_PROMO_CODE, type CalendarSheetContentData, DEFAULT_PAGE_SIZE, DEFAULT_RESOURCES_RETURN_LIMIT, DEFAULT_RESOURCES_RETURN_OFFSET, DEFAULT_USER_FACING_ERROR, EVENT_DATE_STATUS_PERIOD_MAP, type EventScheduleStatusPresentation, type EventScheduleStatusTone, FUTURE_EVENT_DATE_STATUSES, INITIAL_BILLING_CATALOG, IOS_URL, NETWORK_USER_FACING_ERROR, PostTypeLabels, SCHOOL_MAX_STUDENT_COUNT, SCHOOL_MIN_STUDENT_COUNT, type StallholderFilterOption, accumulateItems, availableRegionOptions, availableRegionTypes, billingCatalogDefinitionMatches, buildCalendarSheetContentData, capitalizeFirstLetter, cluemartSocialMedia, collectStallholderStartDates, collectVendorEventRelationDateTimes, computeDailyClueState, computeHasMore, createAffiliateReward, dateFormat, defaultGetId, eventHasSelectedDate, eventMatchesDateStatusPeriod, eventStartDatesSet, filterDatesByFutureStatus, filterEventsByDateStatusPeriod, filterRegisteredVendorsByEventDatesOnly, filterRegisteredVendorsForEvent, filterUnregisteredVendorsByEventDatesOnly, filterUnregisteredVendorsForEvent, filterVendorEventsBySelectedDate, findEventDateTimeByIsoDate, formatDate, formatDistance, formatIrdNumber, formatNZBankAccount, formatTimestamp, fromCalendarIsoDate, futureTimePeriods, getAllowedEventDateStatuses, getBillingCatalogKeyForSelection, getCurrentAndFutureDates, getDistanceInKilometers, getDistanceInMeters, getErrorMessage, getEventCalendarIsoDates, getEventDatesWithStallholders, getEventScheduleStatusLabel, getEventScheduleStatusPresentation, getEventScheduleStatusTone, getEventStallholderEmptyMessage, getRegisteredVendorCategoryNames, getRegisteredVendorStartDates, getStallholderCategoryNames, getStallholderCategoryOptions, getUnregisteredVendorCategoryNames, getUnregisteredVendorStartDates, getVendorEventRelationDateOptions, getVendorEventRelationStartDates, getVendorEventsEmptyMessage, hasMatchingEventDate, isFutureDatesBeforeThreshold, isFutureEventDateStatus, isInternalErrorMessage, isIsoDateString, isResourceImageActive, isTransientNetworkError, isValidIrdNumber, licenseNiceNames, mapArrayToOptions, matchesCategory, matchesSelectedDate, normalizeIrdNumber, normalizeResourceImage, normalizeUrl, nzStartOfDay, paymentMethodOptions, relationHasSelectedDate, removeTypename, resolveResourceImageActive, rewardNiceNames, seededShuffle, shouldShowEventActionsWithWeather, sortDatesChronologically, statusOptions, timeFormat, toCalendarIsoDate, toNZTime, toUserFacingErrorMessage, truncateText, vendorLicences };
|
|
334
|
+
export { AFFILIATE_PARTICIPANT_TYPE_LABELS, AFFILIATE_REWARDS, ANDROID_URL, BILLING_CATALOG_CURRENCY, BILLING_CATALOG_DEFINITIONS, BILLING_CATALOG_KEYS, CLUEMART_MAIN_DOMAIN_URL, CM_AFFILIATE_PROMO_CODE, CM_SCHOOL_PROMO_CODE, type CalendarSheetContentData, DEFAULT_PAGE_SIZE, DEFAULT_RESOURCES_RETURN_LIMIT, DEFAULT_RESOURCES_RETURN_OFFSET, DEFAULT_USER_FACING_ERROR, EVENT_DATE_STATUS_PERIOD_MAP, type EventScheduleStatusPresentation, type EventScheduleStatusTone, FUTURE_EVENT_DATE_STATUSES, INITIAL_BILLING_CATALOG, IOS_URL, NETWORK_USER_FACING_ERROR, PostTypeLabels, SCHOOL_MAX_STUDENT_COUNT, SCHOOL_MIN_STUDENT_COUNT, type StallholderFilterOption, accumulateItems, availableRegionOptions, availableRegionTypes, billingCatalogDefinitionMatches, buildCalendarSheetContentData, capitalizeFirstLetter, cluemartSocialMedia, collectStallholderStartDates, collectVendorEventRelationDateTimes, computeDailyClueState, computeHasMore, createAffiliateReward, dateFormat, defaultGetId, eventHasSelectedDate, eventMatchesDateStatusPeriod, eventStartDatesSet, filterDatesByFutureStatus, filterEventsByDateStatusPeriod, filterRegisteredVendorsByEventDatesOnly, filterRegisteredVendorsForEvent, filterUnregisteredVendorsByEventDatesOnly, filterUnregisteredVendorsForEvent, filterVendorEventsBySelectedDate, findEventDateTimeByIsoDate, formatDate, formatDistance, formatIrdNumber, formatNZBankAccount, formatTimestamp, fromCalendarIsoDate, futureTimePeriods, getAllowedEventDateStatuses, getBillingCatalogKeyForSelection, getCurrentAndFutureDates, getDistanceInKilometers, getDistanceInMeters, getErrorMessage, getEventCalendarIsoDates, getEventDatesWithStallholders, getEventScheduleStatusLabel, getEventScheduleStatusPresentation, getEventScheduleStatusTone, getEventStallholderEmptyMessage, getFutureEventStatus, getRegisteredVendorCategoryNames, getRegisteredVendorStartDates, getStallholderCategoryNames, getStallholderCategoryOptions, getUnregisteredVendorCategoryNames, getUnregisteredVendorStartDates, getVendorEventRelationDateOptions, getVendorEventRelationStartDates, getVendorEventsEmptyMessage, hasMatchingEventDate, isFutureDatesBeforeThreshold, isFutureEventDateStatus, isInternalErrorMessage, isIsoDateString, isResourceImageActive, isTransientNetworkError, isValidIrdNumber, licenseNiceNames, mapArrayToOptions, matchesCategory, matchesSelectedDate, normalizeIrdNumber, normalizeResourceImage, normalizeUrl, nzStartOfDay, paymentMethodOptions, relationHasSelectedDate, removeTypename, resolveResourceImageActive, rewardNiceNames, seededShuffle, shouldShowEventActionsWithWeather, sortDatesChronologically, statusOptions, timeFormat, toCalendarIsoDate, toNZTime, toUserFacingErrorMessage, truncateText, updateSingleDateTimeStatus, vendorLicences };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a4 as DailyClueGameData,
|
|
1
|
+
import { a4 as DailyClueGameData, al as GamePlacementClue, ak as GamePlacement, O as OptionItem, af as EnumPostType, aW as SocialMediaType, aU as ResourceImageType, a6 as DateTimeType, L as LocationType, i as VendorType, h as UnregisteredVendorType, d as EventListItemType } from '../global-B4mmQo6R.js';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import { EnumEventDateStatus, EnumRegions, EnumUserLicence, EnumReward, EnumInviteStatus, EnumResourceType, EnumBillingPeriod } from '../enums/index.js';
|
|
4
|
-
import { h as EnumAffiliateRewardType, f as AffiliateRewardType } from '../affiliate-
|
|
4
|
+
import { h as EnumAffiliateRewardType, f as AffiliateRewardType } from '../affiliate-CxZHVZb2.js';
|
|
5
5
|
import { c as BillingCatalogKey, a as BillingCatalogDefinition, b as BillingCatalogInitialEntry, B as BillingCatalogEntryType } from '../billingCatalog-oWAfZX95.js';
|
|
6
6
|
import 'react-hook-form';
|
|
7
|
-
import '../user-
|
|
7
|
+
import '../user-IR0bHKFb.js';
|
|
8
8
|
|
|
9
9
|
/** Seeded shuffle so all players see the same letter order / placements for a game. */
|
|
10
10
|
declare function seededShuffle<T>(array: readonly T[], seed: string): T[];
|
|
@@ -36,6 +36,7 @@ declare function computeHasMore(pageLength: number, pageSize: number): boolean;
|
|
|
36
36
|
|
|
37
37
|
declare const dateFormat = "DD-MM-YYYY";
|
|
38
38
|
declare const timeFormat = "HH:mm";
|
|
39
|
+
|
|
39
40
|
declare function toNZTime(date?: Date | string): dayjs.Dayjs;
|
|
40
41
|
/** Start of the calendar day in Pacific/Auckland (daily games, streaks, etc.). */
|
|
41
42
|
declare function nzStartOfDay(input?: Date | string | number | null): dayjs.Dayjs;
|
|
@@ -49,12 +50,12 @@ type DateFormat = "date" | "time" | "datetime";
|
|
|
49
50
|
*/
|
|
50
51
|
declare const formatDate: (dateStr: string, display?: DateFormat, timeStr?: string) => string;
|
|
51
52
|
declare const getCurrentAndFutureDates: <T extends {
|
|
52
|
-
startDate
|
|
53
|
-
startTime
|
|
53
|
+
startDate?: string;
|
|
54
|
+
startTime?: string;
|
|
54
55
|
}>(dates: T[]) => T[];
|
|
55
56
|
declare const isFutureDatesBeforeThreshold: (date: {
|
|
56
|
-
startDate
|
|
57
|
-
startTime
|
|
57
|
+
startDate?: string;
|
|
58
|
+
startTime?: string;
|
|
58
59
|
}, minHoursFromNow: number) => boolean;
|
|
59
60
|
declare const formatTimestamp: (timestamp: string) => string;
|
|
60
61
|
declare const isIsoDateString: (value: unknown) => value is string;
|
|
@@ -64,8 +65,8 @@ declare const isIsoDateString: (value: unknown) => value is string;
|
|
|
64
65
|
* @returns - The sorted array of date strings.
|
|
65
66
|
*/
|
|
66
67
|
declare function sortDatesChronologically<T extends {
|
|
67
|
-
startDate
|
|
68
|
-
startTime
|
|
68
|
+
startDate?: string;
|
|
69
|
+
startTime?: string;
|
|
69
70
|
}>(dates: T[]): T[];
|
|
70
71
|
/**
|
|
71
72
|
* UI filter options for user-activity event periods. Derived from the canonical
|
|
@@ -160,6 +161,21 @@ declare function isFutureEventDateStatus(dateStatus: EnumEventDateStatus | null
|
|
|
160
161
|
declare function filterDatesByFutureStatus<T extends {
|
|
161
162
|
dateStatus?: EnumEventDateStatus | null;
|
|
162
163
|
}>(dates: T[]): T[];
|
|
164
|
+
/**
|
|
165
|
+
* Determines the dateStatus for a future event date
|
|
166
|
+
* @param startDateTime The start date-time of the event
|
|
167
|
+
* @param now The current date-time
|
|
168
|
+
* @returns The appropriate EnumEventDateStatus
|
|
169
|
+
*/
|
|
170
|
+
declare function getFutureEventStatus(startDateTime: dayjs.Dayjs, now: dayjs.Dayjs): EnumEventDateStatus;
|
|
171
|
+
/**
|
|
172
|
+
* Updates the dateStatus field for a single DateTimeType object based on the current date/time.
|
|
173
|
+
* Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
|
|
174
|
+
* @param dateTime The date-time object to update
|
|
175
|
+
* @returns A new object with an updated dateStatus value, or the original
|
|
176
|
+
* object when the stored status is a manual override
|
|
177
|
+
*/
|
|
178
|
+
declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
|
|
163
179
|
|
|
164
180
|
type CalendarSheetContentData = {
|
|
165
181
|
dateTime: DateTimeType;
|
|
@@ -175,7 +191,9 @@ type EventScheduleStatusPresentation = {
|
|
|
175
191
|
};
|
|
176
192
|
declare function toCalendarIsoDate(startDate: string): string | null;
|
|
177
193
|
declare function fromCalendarIsoDate(isoDate: string): string;
|
|
178
|
-
declare function getEventCalendarIsoDates(dateTimes:
|
|
194
|
+
declare function getEventCalendarIsoDates(dateTimes: Array<{
|
|
195
|
+
startDate?: string | null;
|
|
196
|
+
}> | null | undefined): string[];
|
|
179
197
|
declare function findEventDateTimeByIsoDate(dateTimes: DateTimeType[] | null | undefined, isoDate: string): DateTimeType | null;
|
|
180
198
|
declare function buildCalendarSheetContentData(dateTimes: DateTimeType[], isoDate: string, location: LocationType, resourceId: string, resourceType: EnumResourceType): CalendarSheetContentData | null;
|
|
181
199
|
declare function getEventScheduleStatusTone(status: EnumEventDateStatus): EventScheduleStatusTone;
|
|
@@ -187,7 +205,9 @@ type StallholderFilterOption = {
|
|
|
187
205
|
label: string;
|
|
188
206
|
value: string;
|
|
189
207
|
};
|
|
190
|
-
declare function eventStartDatesSet(dateTime:
|
|
208
|
+
declare function eventStartDatesSet(dateTime: Array<{
|
|
209
|
+
startDate?: string | null;
|
|
210
|
+
}> | undefined): Set<string>;
|
|
191
211
|
declare function hasMatchingEventDate(vendorStartDates: string[], eventStartDates: Set<string>): boolean;
|
|
192
212
|
declare function matchesSelectedDate(vendorStartDates: string[], selectedDate: string | null): boolean;
|
|
193
213
|
declare function matchesCategory(categoryNames: string[], selectedCategory: string | null): boolean;
|
|
@@ -311,4 +331,4 @@ declare function toUserFacingErrorMessage(error: string | null | undefined, fall
|
|
|
311
331
|
/** Extracts and sanitizes an unknown catch/Apollo error for toasts and alerts. */
|
|
312
332
|
declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
313
333
|
|
|
314
|
-
export { AFFILIATE_PARTICIPANT_TYPE_LABELS, AFFILIATE_REWARDS, ANDROID_URL, BILLING_CATALOG_CURRENCY, BILLING_CATALOG_DEFINITIONS, BILLING_CATALOG_KEYS, CLUEMART_MAIN_DOMAIN_URL, CM_AFFILIATE_PROMO_CODE, CM_SCHOOL_PROMO_CODE, type CalendarSheetContentData, DEFAULT_PAGE_SIZE, DEFAULT_RESOURCES_RETURN_LIMIT, DEFAULT_RESOURCES_RETURN_OFFSET, DEFAULT_USER_FACING_ERROR, EVENT_DATE_STATUS_PERIOD_MAP, type EventScheduleStatusPresentation, type EventScheduleStatusTone, FUTURE_EVENT_DATE_STATUSES, INITIAL_BILLING_CATALOG, IOS_URL, NETWORK_USER_FACING_ERROR, PostTypeLabels, SCHOOL_MAX_STUDENT_COUNT, SCHOOL_MIN_STUDENT_COUNT, type StallholderFilterOption, accumulateItems, availableRegionOptions, availableRegionTypes, billingCatalogDefinitionMatches, buildCalendarSheetContentData, capitalizeFirstLetter, cluemartSocialMedia, collectStallholderStartDates, collectVendorEventRelationDateTimes, computeDailyClueState, computeHasMore, createAffiliateReward, dateFormat, defaultGetId, eventHasSelectedDate, eventMatchesDateStatusPeriod, eventStartDatesSet, filterDatesByFutureStatus, filterEventsByDateStatusPeriod, filterRegisteredVendorsByEventDatesOnly, filterRegisteredVendorsForEvent, filterUnregisteredVendorsByEventDatesOnly, filterUnregisteredVendorsForEvent, filterVendorEventsBySelectedDate, findEventDateTimeByIsoDate, formatDate, formatDistance, formatIrdNumber, formatNZBankAccount, formatTimestamp, fromCalendarIsoDate, futureTimePeriods, getAllowedEventDateStatuses, getBillingCatalogKeyForSelection, getCurrentAndFutureDates, getDistanceInKilometers, getDistanceInMeters, getErrorMessage, getEventCalendarIsoDates, getEventDatesWithStallholders, getEventScheduleStatusLabel, getEventScheduleStatusPresentation, getEventScheduleStatusTone, getEventStallholderEmptyMessage, getRegisteredVendorCategoryNames, getRegisteredVendorStartDates, getStallholderCategoryNames, getStallholderCategoryOptions, getUnregisteredVendorCategoryNames, getUnregisteredVendorStartDates, getVendorEventRelationDateOptions, getVendorEventRelationStartDates, getVendorEventsEmptyMessage, hasMatchingEventDate, isFutureDatesBeforeThreshold, isFutureEventDateStatus, isInternalErrorMessage, isIsoDateString, isResourceImageActive, isTransientNetworkError, isValidIrdNumber, licenseNiceNames, mapArrayToOptions, matchesCategory, matchesSelectedDate, normalizeIrdNumber, normalizeResourceImage, normalizeUrl, nzStartOfDay, paymentMethodOptions, relationHasSelectedDate, removeTypename, resolveResourceImageActive, rewardNiceNames, seededShuffle, shouldShowEventActionsWithWeather, sortDatesChronologically, statusOptions, timeFormat, toCalendarIsoDate, toNZTime, toUserFacingErrorMessage, truncateText, vendorLicences };
|
|
334
|
+
export { AFFILIATE_PARTICIPANT_TYPE_LABELS, AFFILIATE_REWARDS, ANDROID_URL, BILLING_CATALOG_CURRENCY, BILLING_CATALOG_DEFINITIONS, BILLING_CATALOG_KEYS, CLUEMART_MAIN_DOMAIN_URL, CM_AFFILIATE_PROMO_CODE, CM_SCHOOL_PROMO_CODE, type CalendarSheetContentData, DEFAULT_PAGE_SIZE, DEFAULT_RESOURCES_RETURN_LIMIT, DEFAULT_RESOURCES_RETURN_OFFSET, DEFAULT_USER_FACING_ERROR, EVENT_DATE_STATUS_PERIOD_MAP, type EventScheduleStatusPresentation, type EventScheduleStatusTone, FUTURE_EVENT_DATE_STATUSES, INITIAL_BILLING_CATALOG, IOS_URL, NETWORK_USER_FACING_ERROR, PostTypeLabels, SCHOOL_MAX_STUDENT_COUNT, SCHOOL_MIN_STUDENT_COUNT, type StallholderFilterOption, accumulateItems, availableRegionOptions, availableRegionTypes, billingCatalogDefinitionMatches, buildCalendarSheetContentData, capitalizeFirstLetter, cluemartSocialMedia, collectStallholderStartDates, collectVendorEventRelationDateTimes, computeDailyClueState, computeHasMore, createAffiliateReward, dateFormat, defaultGetId, eventHasSelectedDate, eventMatchesDateStatusPeriod, eventStartDatesSet, filterDatesByFutureStatus, filterEventsByDateStatusPeriod, filterRegisteredVendorsByEventDatesOnly, filterRegisteredVendorsForEvent, filterUnregisteredVendorsByEventDatesOnly, filterUnregisteredVendorsForEvent, filterVendorEventsBySelectedDate, findEventDateTimeByIsoDate, formatDate, formatDistance, formatIrdNumber, formatNZBankAccount, formatTimestamp, fromCalendarIsoDate, futureTimePeriods, getAllowedEventDateStatuses, getBillingCatalogKeyForSelection, getCurrentAndFutureDates, getDistanceInKilometers, getDistanceInMeters, getErrorMessage, getEventCalendarIsoDates, getEventDatesWithStallholders, getEventScheduleStatusLabel, getEventScheduleStatusPresentation, getEventScheduleStatusTone, getEventStallholderEmptyMessage, getFutureEventStatus, getRegisteredVendorCategoryNames, getRegisteredVendorStartDates, getStallholderCategoryNames, getStallholderCategoryOptions, getUnregisteredVendorCategoryNames, getUnregisteredVendorStartDates, getVendorEventRelationDateOptions, getVendorEventRelationStartDates, getVendorEventsEmptyMessage, hasMatchingEventDate, isFutureDatesBeforeThreshold, isFutureEventDateStatus, isInternalErrorMessage, isIsoDateString, isResourceImageActive, isTransientNetworkError, isValidIrdNumber, licenseNiceNames, mapArrayToOptions, matchesCategory, matchesSelectedDate, normalizeIrdNumber, normalizeResourceImage, normalizeUrl, nzStartOfDay, paymentMethodOptions, relationHasSelectedDate, removeTypename, resolveResourceImageActive, rewardNiceNames, seededShuffle, shouldShowEventActionsWithWeather, sortDatesChronologically, statusOptions, timeFormat, toCalendarIsoDate, toNZTime, toUserFacingErrorMessage, truncateText, updateSingleDateTimeStatus, vendorLicences };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
toUserFacingErrorMessage,
|
|
79
79
|
truncateText,
|
|
80
80
|
vendorLicences
|
|
81
|
-
} from "../chunk-
|
|
81
|
+
} from "../chunk-KHC57ZNS.mjs";
|
|
82
82
|
import {
|
|
83
83
|
formatDistance,
|
|
84
84
|
getDistanceInKilometers,
|
|
@@ -96,15 +96,17 @@ import {
|
|
|
96
96
|
futureTimePeriods,
|
|
97
97
|
getAllowedEventDateStatuses,
|
|
98
98
|
getCurrentAndFutureDates,
|
|
99
|
+
getFutureEventStatus,
|
|
99
100
|
isFutureDatesBeforeThreshold,
|
|
100
101
|
isFutureEventDateStatus,
|
|
101
102
|
isIsoDateString,
|
|
102
103
|
nzStartOfDay,
|
|
103
104
|
sortDatesChronologically,
|
|
104
105
|
timeFormat,
|
|
105
|
-
toNZTime
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
toNZTime,
|
|
107
|
+
updateSingleDateTimeStatus
|
|
108
|
+
} from "../chunk-MTBH5LMV.mjs";
|
|
109
|
+
import "../chunk-FWKZZMQR.mjs";
|
|
108
110
|
import {
|
|
109
111
|
isTransientNetworkError
|
|
110
112
|
} from "../chunk-RAYUJODN.mjs";
|
|
@@ -115,7 +117,7 @@ import {
|
|
|
115
117
|
computeHasMore,
|
|
116
118
|
defaultGetId
|
|
117
119
|
} from "../chunk-7DQBUZXY.mjs";
|
|
118
|
-
import "../chunk-
|
|
120
|
+
import "../chunk-Q2WLLXTA.mjs";
|
|
119
121
|
export {
|
|
120
122
|
AFFILIATE_PARTICIPANT_TYPE_LABELS,
|
|
121
123
|
AFFILIATE_REWARDS,
|
|
@@ -182,6 +184,7 @@ export {
|
|
|
182
184
|
getEventScheduleStatusPresentation,
|
|
183
185
|
getEventScheduleStatusTone,
|
|
184
186
|
getEventStallholderEmptyMessage,
|
|
187
|
+
getFutureEventStatus,
|
|
185
188
|
getRegisteredVendorCategoryNames,
|
|
186
189
|
getRegisteredVendorStartDates,
|
|
187
190
|
getStallholderCategoryNames,
|
|
@@ -221,6 +224,7 @@ export {
|
|
|
221
224
|
toNZTime,
|
|
222
225
|
toUserFacingErrorMessage,
|
|
223
226
|
truncateText,
|
|
227
|
+
updateSingleDateTimeStatus,
|
|
224
228
|
vendorLicences
|
|
225
229
|
};
|
|
226
230
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sharing/formatCategoryLabel.ts","../src/sharing/buildRelationShareDescription.ts","../src/sharing/buildPublicShareDescription.ts","../src/sharing/buildShareUrl.ts","../src/sharing/normalizeShareRouteId.ts","../src/sharing/shareSlugResource.ts","../src/sharing/toShareSocialImageCacheVersion.ts"],"sourcesContent":["import type { Category } from \"../types/global\";\n\nexport function formatCategoryLabel(category: Category): string {\n const subcategoryNames = category.subcategories\n .map((subcategory) => subcategory.name)\n .filter(Boolean);\n\n if (subcategoryNames.length === 0) {\n return category.name;\n }\n\n return `${category.name} (${subcategoryNames.join(\", \")})`;\n}\n","import type { StallType } from \"../types/event\";\nimport { formatDate } from \"../utils/date\";\n\nimport {\n SHARE_APPLICATION_DEADLINE_PREFIX,\n SHARE_CATEGORIES_SECTION_HEADING,\n SHARE_FOOD_TRUCK_LINE,\n SHARE_MARKET_DATES_SECTION_HEADING,\n SHARE_RAIN_OR_SHINE_LINE,\n SHARE_REQUIREMENTS_SECTION_HEADING,\n SHARE_COMPLIANCE_PREFIX,\n SHARE_PRICE_RANGE_PREFIX,\n SHARE_STALL_SIZE_PREFIX,\n SHARE_TAGS_SECTION_HEADING,\n} from \"./constants\";\nimport { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nexport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\n/** Formats event `startDate` (`DD-MM-YYYY`) for share copy — same as share preview UI. */\nexport function formatShareMarketDate(dateStr: string): string {\n return formatDate(dateStr, \"date\");\n}\n\nexport function formatStallCapacityLabel(stallCapacity: number): string {\n return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : \" - Full\";\n}\n\nexport function formatShareStallLine(stall: StallType): string {\n return ` - ${stall.label} — $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`;\n}\n\n/** Nested market dates + per-date stall lines for invitation share copy. */\nexport function formatShareInvitationMarketDatesSection(\n dateTime: ShareEventInfoForInvitation[\"dateTime\"],\n): string {\n const dateBlocks = dateTime.map((date) => {\n const formattedDate = formatShareMarketDate(date.startDate);\n const stallLines = date.stallTypes.map(formatShareStallLine);\n return [`- ${formattedDate}`, ...stallLines].join(\"\\n\");\n });\n\n return `${SHARE_MARKET_DATES_SECTION_HEADING}\\n${dateBlocks.join(\"\\n\")}`;\n}\n\nexport function formatShareRainOrShineLine(\n rainOrShine: boolean,\n): string | null {\n return rainOrShine ? SHARE_RAIN_OR_SHINE_LINE : null;\n}\n\nexport function formatShareIsFoodTrueLine(foodTruck: boolean): string | null {\n return foodTruck ? SHARE_FOOD_TRUCK_LINE : null;\n}\n\n/** Bulleted requirements list for invitation share copy. */\nexport function formatShareInvitationRequirementsSection(\n requirements: ShareEventInfoForInvitation[\"requirements\"] | null,\n): string | null {\n const bullets = (requirements ?? [])\n .filter((item) => item.value)\n .map((item) => item.label.trim())\n .filter((label) => label.length > 0)\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_REQUIREMENTS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\nexport function formatShareTagsSection(tags: string[]): string | null {\n const bullets = tags\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0)\n .map((tag) => `- ${tag}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_TAGS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Bulleted categories list for application share copy. */\nexport function formatShareApplicationCategoriesSection(\n categories: ShareVendorForApplication[\"categories\"],\n): string | null {\n const bullets = categories\n .map((category) => formatCategoryLabel(category).trim())\n .filter((label) => label.length > 0)\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_CATEGORIES_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Stall dimensions line for application share copy. */\nexport function formatShareApplicationStallSizeLine(size: {\n width: string;\n depth: string;\n}): string {\n return `${SHARE_STALL_SIZE_PREFIX} ${size.width}m × ${size.depth}m`;\n}\n\n/** Bulleted compliance list for application share copy. */\nexport function formatShareApplicationComplianceSection(\n compliance: ShareVendorInfoForApplication[\"compliance\"],\n): string | null {\n const bullets = [\n compliance?.liabilityInsurance && \"Liability insurance\",\n compliance?.foodBeverageLicense && \"Food & beverage licence\",\n ]\n .filter((label): label is string => Boolean(label))\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_COMPLIANCE_PREFIX}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Price range line for application share copy. */\nexport function formatShareApplicationPriceRangeLine(priceRange: {\n min: string;\n max: string;\n}): string {\n return `${SHARE_PRICE_RANGE_PREFIX} $${priceRange.min} – $${priceRange.max}`;\n}\n\n/** Application-deadline sentence for invitation share copy. */\nexport function formatShareInvitationApplicationDeadlineLine(\n applicationDeadlineHours: number,\n): string {\n return `${SHARE_APPLICATION_DEADLINE_PREFIX} vendors must apply at least ${applicationDeadlineHours} hours before each market date.`;\n}\n\nexport function buildInvitationShareDescription(\n event: ShareEventForInvitation,\n eventInfo: ShareEventInfoForInvitation | null | undefined,\n): string {\n const stallTypes =\n eventInfo?.dateTime?.flatMap((date) => date.stallTypes) ?? [];\n\n if (!eventInfo || stallTypes.length === 0) {\n return event.description?.trim() || \"\";\n }\n\n const sections = [\n event.location.fullAddress,\n formatShareRainOrShineLine(event.rainOrShine),\n formatShareTagsSection(event.tags),\n formatShareInvitationMarketDatesSection(eventInfo.dateTime),\n formatShareInvitationApplicationDeadlineLine(\n eventInfo.applicationDeadlineHours,\n ),\n formatShareInvitationRequirementsSection(eventInfo.requirements),\n ];\n\n return joinShareDescriptionSections(sections);\n}\n\nexport function buildApplicationShareDescription(\n vendor: ShareVendorForApplication,\n vendorInfo: ShareVendorInfoForApplication | null | undefined,\n): string {\n if (!vendorInfo) {\n return vendor.description?.trim() || \"\";\n }\n\n const profileDescription = vendor.description?.trim();\n\n const sections = [\n formatShareIsFoodTrueLine(vendor.foodTruck),\n formatShareApplicationCategoriesSection(vendor.categories),\n formatShareApplicationStallSizeLine(vendorInfo.stallInfo.size),\n formatShareApplicationComplianceSection(vendorInfo.compliance),\n formatShareApplicationPriceRangeLine(vendorInfo.product.priceRange),\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n","import {\n formatShareIsFoodTrueLine,\n formatShareRainOrShineLine,\n formatShareTagsSection,\n} from \"./buildRelationShareDescription\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\n\n/** Minimal event fields for public (market) share copy — matches in-app preview. */\nexport type ShareEventForPublic = {\n description?: string | null;\n rainOrShine: boolean;\n tags: string[];\n};\n\n/** Minimal vendor fields for public (stallholder) share copy — matches in-app preview. */\nexport type ShareVendorForPublic = {\n description?: string | null;\n foodTruck: boolean;\n};\n\nexport function buildPublicEventShareDescription(\n event: ShareEventForPublic,\n): string {\n return joinShareDescriptionSections([\n formatShareRainOrShineLine(event.rainOrShine),\n formatShareTagsSection(event.tags),\n event.description?.trim(),\n ]);\n}\n\nexport function buildPublicVendorShareDescription(\n vendor: ShareVendorForPublic,\n): string {\n return joinShareDescriptionSections([\n formatShareIsFoodTrueLine(vendor.foodTruck),\n vendor.description?.trim(),\n ]);\n}\n","import {\n POST_SHARE_RESOURCE_TYPES,\n RESOURCE_SHARE_TYPES,\n SHARE_SITE_URL,\n} from \"./constants\";\nimport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n} from \"./relationShareTypes\";\n\n/** Path segments for public resource share URLs (markets, posts, etc.). */\nexport const PUBLIC_SHARE_PATH_TYPES = [\n ...RESOURCE_SHARE_TYPES,\n ...POST_SHARE_RESOURCE_TYPES,\n] as const;\n\nexport type PublicSharePathType = (typeof PUBLIC_SHARE_PATH_TYPES)[number];\n\nexport type RelationSharePathType =\n | typeof RELATION_SHARE_INVITATION\n | typeof RELATION_SHARE_APPLICATION;\n\nexport type ShareType = PublicSharePathType | RelationSharePathType;\n\n/** Alternation for deep-link regexes — keep in sync with {@link ShareType}. */\nexport const SHARE_TYPE_PATH_REGEX = [\n ...PUBLIC_SHARE_PATH_TYPES,\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n].join(\"|\");\n\nexport function buildShareUrl(\n type: ShareType,\n slug: string,\n utmMedium: string = \"app\",\n): string {\n return `${SHARE_SITE_URL}/${type}/${encodeURIComponent(slug)}?utm_source=share&utm_medium=${utmMedium}&utm_campaign=${type}`;\n}\n","import type { ShareResourceType } from \"./constants\";\n\nexport function normalizeShareRouteId(id: string): string {\n try {\n return decodeURIComponent(id);\n } catch {\n return id;\n }\n}\n\n/** Relative path for a public share landing page (`/market/demo-market`). */\nexport function buildSharePagePath(\n resourceType: ShareResourceType,\n slug: string,\n): string {\n return `/${resourceType}/${encodeURIComponent(normalizeShareRouteId(slug))}`;\n}\n","export type ShareSlugResource = {\n _id: string;\n};\n\nexport function shareSlugResourceId(\n resource: ShareSlugResource | null | undefined,\n): string | null {\n return resource?._id ?? null;\n}\n","/**\n * Normalizes resource `updatedAt` to an epoch-ms string for Facebook/CDN cache busting\n * on social-image URLs (`?v=`). The API ignores this query param.\n */\nexport function toShareSocialImageCacheVersion(\n updatedAt: Date | string | number | null | undefined,\n): string | null {\n if (updatedAt == null || updatedAt === \"\") {\n return null;\n }\n\n let ms: number;\n if (typeof updatedAt === \"number\") {\n ms = updatedAt;\n } else if (updatedAt instanceof Date) {\n ms = updatedAt.getTime();\n } else {\n ms = Date.parse(String(updatedAt));\n }\n\n if (!Number.isFinite(ms)) {\n return null;\n }\n\n return String(Math.trunc(ms));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEO,SAAS,oBAAoB,UAA4B;AAC9D,QAAM,mBAAmB,SAAS,cAC/B,IAAI,CAAC,gBAAgB,YAAY,IAAI,EACrC,OAAO,OAAO;AAEjB,MAAI,iBAAiB,WAAW,GAAG;AACjC,WAAO,SAAS;AAAA,EAClB;AAEA,SAAO,GAAG,SAAS,IAAI,KAAK,iBAAiB,KAAK,IAAI,CAAC;AACzD;;;ACoBO,SAAS,sBAAsB,SAAyB;AAC7D,SAAO,WAAW,SAAS,MAAM;AACnC;AAEO,SAAS,yBAAyB,eAA+B;AACtE,SAAO,gBAAgB,IAAI,KAAK,aAAa,uBAAuB;AACtE;AAEO,SAAS,qBAAqB,OAA0B;AAC7D,SAAO,QAAQ,MAAM,KAAK,YAAO,MAAM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