@timardex/cluemart-shared 1.5.502 → 1.5.504
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/{chunk-6JRXEOO3.mjs → chunk-A3BCQJII.mjs} +2 -2
- package/dist/{chunk-PZZKQ3IV.mjs → chunk-XNMKWMNF.mjs} +84 -87
- package/dist/chunk-XNMKWMNF.mjs.map +1 -0
- package/dist/formFields/index.cjs +8 -11
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.mjs +2 -2
- package/dist/hooks/index.cjs +21 -24
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.cjs +95 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/index.mjs +94 -99
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.cjs +82 -88
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +14 -11
- package/dist/utils/index.d.ts +14 -11
- package/dist/utils/index.mjs +3 -1
- package/package.json +1 -1
- package/dist/chunk-PZZKQ3IV.mjs.map +0 -1
- /package/dist/{chunk-6JRXEOO3.mjs.map → chunk-A3BCQJII.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FieldValues, Control, FormState, UseFormHandleSubmit, UseFormReset, UseFormSetValue, UseFormWatch } from 'react-hook-form';
|
|
2
2
|
import * as _apollo_client from '@apollo/client';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
3
4
|
|
|
4
5
|
declare enum EnumInviteStatus {
|
|
5
6
|
ACCEPTED = "Accepted",
|
|
@@ -2444,7 +2445,7 @@ declare function computeDailyClueState(dailyClue: DailyClueGameData): {
|
|
|
2444
2445
|
|
|
2445
2446
|
declare const dateFormat = "DD-MM-YYYY";
|
|
2446
2447
|
declare const timeFormat = "HH:mm";
|
|
2447
|
-
declare function toNZTime(date
|
|
2448
|
+
declare function toNZTime(date?: Date | string): dayjs.Dayjs;
|
|
2448
2449
|
type DateFormat = "date" | "time" | "datetime";
|
|
2449
2450
|
/**
|
|
2450
2451
|
* Format a date string to a more readable format.
|
|
@@ -2463,6 +2464,17 @@ declare const isFutureDatesBeforeThreshold: (date: {
|
|
|
2463
2464
|
startTime: string;
|
|
2464
2465
|
}, minHoursFromNow: number) => boolean;
|
|
2465
2466
|
declare const formatTimestamp: (timestamp: string) => string;
|
|
2467
|
+
declare const isIsoDateString: (value: unknown) => value is string;
|
|
2468
|
+
/**
|
|
2469
|
+
* Sort an array of date strings by their proximity to the current date.
|
|
2470
|
+
* @param dates - The array of date strings to sort.
|
|
2471
|
+
* @returns - The sorted array of date strings.
|
|
2472
|
+
*/
|
|
2473
|
+
declare function sortDatesChronologically<T extends {
|
|
2474
|
+
startDate: string;
|
|
2475
|
+
startTime: string;
|
|
2476
|
+
}>(dates: T[]): T[];
|
|
2477
|
+
|
|
2466
2478
|
declare const removeTypename: (obj: any) => any;
|
|
2467
2479
|
/**
|
|
2468
2480
|
* Truncate text to a specified length and append ellipsis if necessary.
|
|
@@ -2482,15 +2494,6 @@ declare const statusOptions: {
|
|
|
2482
2494
|
label: EnumInviteStatus;
|
|
2483
2495
|
value: EnumInviteStatus;
|
|
2484
2496
|
}[];
|
|
2485
|
-
/**
|
|
2486
|
-
* Sort an array of date strings by their proximity to the current date.
|
|
2487
|
-
* @param dates - The array of date strings to sort.
|
|
2488
|
-
* @returns - The sorted array of date strings.
|
|
2489
|
-
*/
|
|
2490
|
-
declare function sortDatesChronologically<T extends {
|
|
2491
|
-
startDate: string;
|
|
2492
|
-
startTime: string;
|
|
2493
|
-
}>(dates: T[]): T[];
|
|
2494
2497
|
declare const availableRegionTypes: EnumRegions[];
|
|
2495
2498
|
declare const availableRegionOptions: OptionItem[];
|
|
2496
2499
|
declare const paymentMethodOptions: OptionItem[];
|
|
@@ -2500,4 +2503,4 @@ declare const cluemartSocialMedia: SocialMediaType[];
|
|
|
2500
2503
|
declare const IOS_URL = "https://apps.apple.com/nz/app/cluemart/id6747251008";
|
|
2501
2504
|
declare const ANDROID_URL = "https://play.google.com/store/apps/details?id=com.timardex.cluemart";
|
|
2502
2505
|
|
|
2503
|
-
export { ANDROID_URL, type AdFormData, type AdResource, type AdType, type AdminUpdateResourceType, type AppSettingsFormData, type AppSettingsType, type AssociateType, type BaseGame, type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatMessageInput, type ChatMessageReaction, type ChatMessageReplyPreview, type ChatMessageSeen, type ChatMessageType, type ChatType, type ContactUsFormData, type CreateAdFormData, type CreateAppSettingsFormData, type CreateBulkNotificationInput, type CreateContactUsFormData, type CreateEventFormData, type CreateEventInfoFormData, type CreateFormData, type CreateLoginFormData, type CreatePartnerFormData, type CreatePostFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateUnregisteredVendorFormData, type CreateUserFormData, type CreateValidateVerificationTokenFormData, type CreateVendorFormData, type CreateVendorInfoFormData, type DailyClueGameData, type DateTimeType, type DateTimeWithPriceType, type DeviceInfo, EnumActivity, EnumAdShowOn, EnumAdStatus, EnumAdStyle, EnumAdType, EnumBillingPeriod, EnumChatReportReason, EnumChatType, EnumEventDateStatus, EnumEventType, EnumFoodFlavor, EnumFoodType, EnumGameStatus, EnumGameType, EnumInviteStatus, EnumNotificationResourceType, EnumNotificationType, EnumOSPlatform, EnumPartnerType, EnumPaymentMethod, EnumPostContentType, EnumPostType, EnumRegions, EnumRelationResource, EnumResourceType, EnumSocialMedia, EnumSubscriptionStatus, EnumUserLicence, EnumUserRole, EnumVendorType, EnumVerificationType, type EventFormData, type EventInfoFormData, type EventInfoType, type EventListItemType, type EventStatusType, type EventType, type FormDateField, type FormField, type GameData, type GameDate, type GameHistory, type GameLeaderboard, type GamePlacement, type GamePlacementClue, type GameType, type GeocodeLocation, type GoogleAddressComponent, type GoogleImportedMarket, IOS_URL, type ImageObjectType, ImageTypeEnum, type LocationGeoType, type LocationType, type LoginFormData, type NotificationCount, type NotificationDataType, type NotificationType, type Nullable, type OptionItem, type OwnerType, type ParticipantType, type PartnerFormData, type PartnerType, type PaymentInfoType, type PlacePrediction, type PostContentData, type PostContentFormData, type PostContentGame, type PostContentImage, type PostContentList, type PostContentTextarea, type PostContentType, type PostContentVideo, type PostFileInput, type PostFormData, type PostType, type PosterInputType, type PosterUsageType, type RefundPolicy, type Region, type RegisterFormData, type RelationDate, type RelationType, type ReportChatUser, type RequestPasswordResetFormData, type Requirement, type ResetPasswordFormData, type ResourceActivityEntry, type ResourceActivityInputType, type ResourceActivityType, type ResourceByUser, type ResourceConnectionsType, type ResourceContactDetailsType, type ResourceDetails, type ResourceImageType, SAVED_EMAIL_KEY, SAVED_PASSWORD_KEY, SAVED_REFRESH_TOKEN_KEY, SAVED_TOKEN_KEY, type SocialMediaType, type StallType, type StripeSubscription, type Subcategory, type SubcategoryItems, type SubscriptionPlanData, type SubscriptionPlansResponse, type SubscriptionPricingData, type SubscriptionStatusData, type TermsAgreement, USER_STORAGE_KEY, type UnregisteredVendorFormData, type UnregisteredVendorInvitationType, type UnregisteredVendorType, type UseGetEventsByRegionOptions, type UserActivity, type UserActivityEvent, type UserFormData, type UserLicenceType, type UserType, type ValidateVerificationTokenFormData, type VendorAttributes, type VendorCalendarData, type VendorFormData, type VendorInfoFormData, type VendorInfoType, type VendorProductList, type VendorType, availableCategories, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, cluemartSocialMedia, companyContactFields, computeDailyClueState, contactUsFields, darkColors, dateFormat, defaultEventFormValues, defaultEventInfoFormValues, defaultPartnerFormValues, defaultUnregisteredVendorFormValues, defaultVendorFormValues, defaultVendorInfoFormValues, emailField, eventBasicInfoFields, eventEndDateFields, eventInfo, eventInfoPaymentInfo, eventStartDateFields, fonts, foodFlavourOptions, formatDate, formatTimestamp, gameScreenIdentifierList, gameTypeToDisplayName, getCurrentAndFutureDates, globalDefaultValues, isFutureDatesBeforeThreshold, licenseNiceNames, lightColors, loginFields, mapArrayToOptions, mapBaseResourceTypeToFormData, normalizeUrl, packagingOptions, partnerBasicInfoFields, paymentMethodOptions, priceUnits, producedIngOptions, productLabelGroups, profileFields, refundPolicyOptions, registerFields, removeTypename, requestPasswordResetFields, requirementsOptions, resetPasswordFields, seededShuffle, socialMediaFields, sortDatesChronologically, stallTypeOptions, statusOptions, tagOptions, timeFormat, toNZTime, truncateText, useAdForm, useAddParticipantToChat, useAddUserFavouriteResource, useAddUserGoingResource, useAddUserInterestResource, useAddUserPresentResource, useAdminPermanentlyDeleteResource, useAdminResendUserVerificationEmail, useAdminUpdateResourceType, useAppSettingsForm, useCancelSubscription, useContactUs, useContactUsForm, useCrawlGoogleMarkets, useCreateAd, useCreateBulkNotifications, useCreateCheckoutSession, useCreateCustomerPortal, useCreateEvent, useCreateEventInfo, useCreatePartner, useCreatePost, useCreatePoster, useCreatePrivateChat, useCreatePushToken, useCreateRelation, useCreateResourceActivity, useCreateUnregisteredVendor, useCreateUser, useCreateVendor, useCreateVendorInfo, useDeleteAd, useDeleteAllNotifications, useDeleteChat, useDeleteEvent, useDeleteNotification, useDeletePartner, useDeletePost, useDeleteRelation, useDeleteUnregisteredVendor, useDeleteUser, useDeleteVendor, useEventForm, useEventInfoForm, useGetAd, useGetAds, useGetAdsByRegion, useGetAppSettings, useGetChat, useGetChatSubscription, useGetChatsByRegion, useGetEvent, useGetEventByPlaceId, useGetEventInfo, useGetEventRelations, useGetEvents, useGetEventsByRegion, useGetEventsNearMe, useGetGame, useGetGameLeaderboard, useGetGames, useGetNotificationCount, useGetNotificationCountSubscription, useGetPartner, useGetPartners, useGetPartnersByRegion, useGetPost, useGetPosts, useGetPostsByType, useGetRelation, useGetRelationByEventAndVendor, useGetReportedChatUsers, useGetResourceActivity, useGetResourceConnections, useGetSubscriptionPlans, useGetSubscriptionStatus, useGetUnregisteredVendor, useGetUnregisteredVendors, useGetUser, useGetUserActivities, useGetUserChats, useGetUserEvents, useGetUserNotifications, useGetUserNotificationsSubscription, useGetUserPartners, useGetUserResources, useGetUserVendors, useGetUsers, useGetVendor, useGetVendorInfo, useGetVendorRelations, useGetVendors, useGetVendorsByRegion, useLeaveGame, useLocationSearch, useLogin, useLoginForm, useLogout, useMarkAllNotificationsRead, useMarkChatMessagesSeen, useMarkNotificationRead, usePartnerForm, usePostForm, useRefreshToken, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRemoveUserGoingResource, useRemoveUserInterestResource, useRemoveUserPresentResource, useReportChatUser, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchEvents, useSearchPartners, useSearchVendors, useSelectPackage, useSelectStandardPackage, useSendChatMessage, useStartGame, useToggleChatMessageLike, useUpdateAd, useUpdateAppSettings, useUpdateDailyClueGame, useUpdateEvent, useUpdateEventInfo, useUpdateGoogleImportedMarkets, useUpdatePartner, useUpdatePost, useUpdateRelation, useUpdateSubscriptionPlan, useUpdateUnregisteredVendor, useUpdateUser, useUpdateVendor, useUpdateVendorInfo, useUserForm, useValidateVerificationToken, useValidateVerificationTokenForm, useVendorForm, useVendorInfoForm, validateVerificationTokenFields, vendorAvailability, vendorBasicInfoFields, vendorCompliance, vendorElectricity, vendorEndDateFields, vendorFoodFlavour, vendorFullAddress, vendorGazebo, vendorLocationDescription, vendorMenuFields, vendorPackaging, vendorPriceRange, vendorProducedIn, vendorStallSize, vendorStartDateFields, vendorTable };
|
|
2506
|
+
export { ANDROID_URL, type AdFormData, type AdResource, type AdType, type AdminUpdateResourceType, type AppSettingsFormData, type AppSettingsType, type AssociateType, type BaseGame, type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatMessageInput, type ChatMessageReaction, type ChatMessageReplyPreview, type ChatMessageSeen, type ChatMessageType, type ChatType, type ContactUsFormData, type CreateAdFormData, type CreateAppSettingsFormData, type CreateBulkNotificationInput, type CreateContactUsFormData, type CreateEventFormData, type CreateEventInfoFormData, type CreateFormData, type CreateLoginFormData, type CreatePartnerFormData, type CreatePostFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateUnregisteredVendorFormData, type CreateUserFormData, type CreateValidateVerificationTokenFormData, type CreateVendorFormData, type CreateVendorInfoFormData, type DailyClueGameData, type DateTimeType, type DateTimeWithPriceType, type DeviceInfo, EnumActivity, EnumAdShowOn, EnumAdStatus, EnumAdStyle, EnumAdType, EnumBillingPeriod, EnumChatReportReason, EnumChatType, EnumEventDateStatus, EnumEventType, EnumFoodFlavor, EnumFoodType, EnumGameStatus, EnumGameType, EnumInviteStatus, EnumNotificationResourceType, EnumNotificationType, EnumOSPlatform, EnumPartnerType, EnumPaymentMethod, EnumPostContentType, EnumPostType, EnumRegions, EnumRelationResource, EnumResourceType, EnumSocialMedia, EnumSubscriptionStatus, EnumUserLicence, EnumUserRole, EnumVendorType, EnumVerificationType, type EventFormData, type EventInfoFormData, type EventInfoType, type EventListItemType, type EventStatusType, type EventType, type FormDateField, type FormField, type GameData, type GameDate, type GameHistory, type GameLeaderboard, type GamePlacement, type GamePlacementClue, type GameType, type GeocodeLocation, type GoogleAddressComponent, type GoogleImportedMarket, IOS_URL, type ImageObjectType, ImageTypeEnum, type LocationGeoType, type LocationType, type LoginFormData, type NotificationCount, type NotificationDataType, type NotificationType, type Nullable, type OptionItem, type OwnerType, type ParticipantType, type PartnerFormData, type PartnerType, type PaymentInfoType, type PlacePrediction, type PostContentData, type PostContentFormData, type PostContentGame, type PostContentImage, type PostContentList, type PostContentTextarea, type PostContentType, type PostContentVideo, type PostFileInput, type PostFormData, type PostType, type PosterInputType, type PosterUsageType, type RefundPolicy, type Region, type RegisterFormData, type RelationDate, type RelationType, type ReportChatUser, type RequestPasswordResetFormData, type Requirement, type ResetPasswordFormData, type ResourceActivityEntry, type ResourceActivityInputType, type ResourceActivityType, type ResourceByUser, type ResourceConnectionsType, type ResourceContactDetailsType, type ResourceDetails, type ResourceImageType, SAVED_EMAIL_KEY, SAVED_PASSWORD_KEY, SAVED_REFRESH_TOKEN_KEY, SAVED_TOKEN_KEY, type SocialMediaType, type StallType, type StripeSubscription, type Subcategory, type SubcategoryItems, type SubscriptionPlanData, type SubscriptionPlansResponse, type SubscriptionPricingData, type SubscriptionStatusData, type TermsAgreement, USER_STORAGE_KEY, type UnregisteredVendorFormData, type UnregisteredVendorInvitationType, type UnregisteredVendorType, type UseGetEventsByRegionOptions, type UserActivity, type UserActivityEvent, type UserFormData, type UserLicenceType, type UserType, type ValidateVerificationTokenFormData, type VendorAttributes, type VendorCalendarData, type VendorFormData, type VendorInfoFormData, type VendorInfoType, type VendorProductList, type VendorType, availableCategories, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, cluemartSocialMedia, companyContactFields, computeDailyClueState, contactUsFields, darkColors, dateFormat, defaultEventFormValues, defaultEventInfoFormValues, defaultPartnerFormValues, defaultUnregisteredVendorFormValues, defaultVendorFormValues, defaultVendorInfoFormValues, emailField, eventBasicInfoFields, eventEndDateFields, eventInfo, eventInfoPaymentInfo, eventStartDateFields, fonts, foodFlavourOptions, formatDate, formatTimestamp, gameScreenIdentifierList, gameTypeToDisplayName, getCurrentAndFutureDates, globalDefaultValues, isFutureDatesBeforeThreshold, isIsoDateString, licenseNiceNames, lightColors, loginFields, mapArrayToOptions, mapBaseResourceTypeToFormData, normalizeUrl, packagingOptions, partnerBasicInfoFields, paymentMethodOptions, priceUnits, producedIngOptions, productLabelGroups, profileFields, refundPolicyOptions, registerFields, removeTypename, requestPasswordResetFields, requirementsOptions, resetPasswordFields, seededShuffle, socialMediaFields, sortDatesChronologically, stallTypeOptions, statusOptions, tagOptions, timeFormat, toNZTime, truncateText, useAdForm, useAddParticipantToChat, useAddUserFavouriteResource, useAddUserGoingResource, useAddUserInterestResource, useAddUserPresentResource, useAdminPermanentlyDeleteResource, useAdminResendUserVerificationEmail, useAdminUpdateResourceType, useAppSettingsForm, useCancelSubscription, useContactUs, useContactUsForm, useCrawlGoogleMarkets, useCreateAd, useCreateBulkNotifications, useCreateCheckoutSession, useCreateCustomerPortal, useCreateEvent, useCreateEventInfo, useCreatePartner, useCreatePost, useCreatePoster, useCreatePrivateChat, useCreatePushToken, useCreateRelation, useCreateResourceActivity, useCreateUnregisteredVendor, useCreateUser, useCreateVendor, useCreateVendorInfo, useDeleteAd, useDeleteAllNotifications, useDeleteChat, useDeleteEvent, useDeleteNotification, useDeletePartner, useDeletePost, useDeleteRelation, useDeleteUnregisteredVendor, useDeleteUser, useDeleteVendor, useEventForm, useEventInfoForm, useGetAd, useGetAds, useGetAdsByRegion, useGetAppSettings, useGetChat, useGetChatSubscription, useGetChatsByRegion, useGetEvent, useGetEventByPlaceId, useGetEventInfo, useGetEventRelations, useGetEvents, useGetEventsByRegion, useGetEventsNearMe, useGetGame, useGetGameLeaderboard, useGetGames, useGetNotificationCount, useGetNotificationCountSubscription, useGetPartner, useGetPartners, useGetPartnersByRegion, useGetPost, useGetPosts, useGetPostsByType, useGetRelation, useGetRelationByEventAndVendor, useGetReportedChatUsers, useGetResourceActivity, useGetResourceConnections, useGetSubscriptionPlans, useGetSubscriptionStatus, useGetUnregisteredVendor, useGetUnregisteredVendors, useGetUser, useGetUserActivities, useGetUserChats, useGetUserEvents, useGetUserNotifications, useGetUserNotificationsSubscription, useGetUserPartners, useGetUserResources, useGetUserVendors, useGetUsers, useGetVendor, useGetVendorInfo, useGetVendorRelations, useGetVendors, useGetVendorsByRegion, useLeaveGame, useLocationSearch, useLogin, useLoginForm, useLogout, useMarkAllNotificationsRead, useMarkChatMessagesSeen, useMarkNotificationRead, usePartnerForm, usePostForm, useRefreshToken, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRemoveUserGoingResource, useRemoveUserInterestResource, useRemoveUserPresentResource, useReportChatUser, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchEvents, useSearchPartners, useSearchVendors, useSelectPackage, useSelectStandardPackage, useSendChatMessage, useStartGame, useToggleChatMessageLike, useUpdateAd, useUpdateAppSettings, useUpdateDailyClueGame, useUpdateEvent, useUpdateEventInfo, useUpdateGoogleImportedMarkets, useUpdatePartner, useUpdatePost, useUpdateRelation, useUpdateSubscriptionPlan, useUpdateUnregisteredVendor, useUpdateUser, useUpdateVendor, useUpdateVendorInfo, useUserForm, useValidateVerificationToken, useValidateVerificationTokenForm, useVendorForm, useVendorInfoForm, validateVerificationTokenFields, vendorAvailability, vendorBasicInfoFields, vendorCompliance, vendorElectricity, vendorEndDateFields, vendorFoodFlavour, vendorFullAddress, vendorGazebo, vendorLocationDescription, vendorMenuFields, vendorPackaging, vendorPriceRange, vendorProducedIn, vendorStallSize, vendorStartDateFields, vendorTable };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FieldValues, Control, FormState, UseFormHandleSubmit, UseFormReset, UseFormSetValue, UseFormWatch } from 'react-hook-form';
|
|
2
2
|
import * as _apollo_client from '@apollo/client';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
3
4
|
|
|
4
5
|
declare enum EnumInviteStatus {
|
|
5
6
|
ACCEPTED = "Accepted",
|
|
@@ -2444,7 +2445,7 @@ declare function computeDailyClueState(dailyClue: DailyClueGameData): {
|
|
|
2444
2445
|
|
|
2445
2446
|
declare const dateFormat = "DD-MM-YYYY";
|
|
2446
2447
|
declare const timeFormat = "HH:mm";
|
|
2447
|
-
declare function toNZTime(date
|
|
2448
|
+
declare function toNZTime(date?: Date | string): dayjs.Dayjs;
|
|
2448
2449
|
type DateFormat = "date" | "time" | "datetime";
|
|
2449
2450
|
/**
|
|
2450
2451
|
* Format a date string to a more readable format.
|
|
@@ -2463,6 +2464,17 @@ declare const isFutureDatesBeforeThreshold: (date: {
|
|
|
2463
2464
|
startTime: string;
|
|
2464
2465
|
}, minHoursFromNow: number) => boolean;
|
|
2465
2466
|
declare const formatTimestamp: (timestamp: string) => string;
|
|
2467
|
+
declare const isIsoDateString: (value: unknown) => value is string;
|
|
2468
|
+
/**
|
|
2469
|
+
* Sort an array of date strings by their proximity to the current date.
|
|
2470
|
+
* @param dates - The array of date strings to sort.
|
|
2471
|
+
* @returns - The sorted array of date strings.
|
|
2472
|
+
*/
|
|
2473
|
+
declare function sortDatesChronologically<T extends {
|
|
2474
|
+
startDate: string;
|
|
2475
|
+
startTime: string;
|
|
2476
|
+
}>(dates: T[]): T[];
|
|
2477
|
+
|
|
2466
2478
|
declare const removeTypename: (obj: any) => any;
|
|
2467
2479
|
/**
|
|
2468
2480
|
* Truncate text to a specified length and append ellipsis if necessary.
|
|
@@ -2482,15 +2494,6 @@ declare const statusOptions: {
|
|
|
2482
2494
|
label: EnumInviteStatus;
|
|
2483
2495
|
value: EnumInviteStatus;
|
|
2484
2496
|
}[];
|
|
2485
|
-
/**
|
|
2486
|
-
* Sort an array of date strings by their proximity to the current date.
|
|
2487
|
-
* @param dates - The array of date strings to sort.
|
|
2488
|
-
* @returns - The sorted array of date strings.
|
|
2489
|
-
*/
|
|
2490
|
-
declare function sortDatesChronologically<T extends {
|
|
2491
|
-
startDate: string;
|
|
2492
|
-
startTime: string;
|
|
2493
|
-
}>(dates: T[]): T[];
|
|
2494
2497
|
declare const availableRegionTypes: EnumRegions[];
|
|
2495
2498
|
declare const availableRegionOptions: OptionItem[];
|
|
2496
2499
|
declare const paymentMethodOptions: OptionItem[];
|
|
@@ -2500,4 +2503,4 @@ declare const cluemartSocialMedia: SocialMediaType[];
|
|
|
2500
2503
|
declare const IOS_URL = "https://apps.apple.com/nz/app/cluemart/id6747251008";
|
|
2501
2504
|
declare const ANDROID_URL = "https://play.google.com/store/apps/details?id=com.timardex.cluemart";
|
|
2502
2505
|
|
|
2503
|
-
export { ANDROID_URL, type AdFormData, type AdResource, type AdType, type AdminUpdateResourceType, type AppSettingsFormData, type AppSettingsType, type AssociateType, type BaseGame, type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatMessageInput, type ChatMessageReaction, type ChatMessageReplyPreview, type ChatMessageSeen, type ChatMessageType, type ChatType, type ContactUsFormData, type CreateAdFormData, type CreateAppSettingsFormData, type CreateBulkNotificationInput, type CreateContactUsFormData, type CreateEventFormData, type CreateEventInfoFormData, type CreateFormData, type CreateLoginFormData, type CreatePartnerFormData, type CreatePostFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateUnregisteredVendorFormData, type CreateUserFormData, type CreateValidateVerificationTokenFormData, type CreateVendorFormData, type CreateVendorInfoFormData, type DailyClueGameData, type DateTimeType, type DateTimeWithPriceType, type DeviceInfo, EnumActivity, EnumAdShowOn, EnumAdStatus, EnumAdStyle, EnumAdType, EnumBillingPeriod, EnumChatReportReason, EnumChatType, EnumEventDateStatus, EnumEventType, EnumFoodFlavor, EnumFoodType, EnumGameStatus, EnumGameType, EnumInviteStatus, EnumNotificationResourceType, EnumNotificationType, EnumOSPlatform, EnumPartnerType, EnumPaymentMethod, EnumPostContentType, EnumPostType, EnumRegions, EnumRelationResource, EnumResourceType, EnumSocialMedia, EnumSubscriptionStatus, EnumUserLicence, EnumUserRole, EnumVendorType, EnumVerificationType, type EventFormData, type EventInfoFormData, type EventInfoType, type EventListItemType, type EventStatusType, type EventType, type FormDateField, type FormField, type GameData, type GameDate, type GameHistory, type GameLeaderboard, type GamePlacement, type GamePlacementClue, type GameType, type GeocodeLocation, type GoogleAddressComponent, type GoogleImportedMarket, IOS_URL, type ImageObjectType, ImageTypeEnum, type LocationGeoType, type LocationType, type LoginFormData, type NotificationCount, type NotificationDataType, type NotificationType, type Nullable, type OptionItem, type OwnerType, type ParticipantType, type PartnerFormData, type PartnerType, type PaymentInfoType, type PlacePrediction, type PostContentData, type PostContentFormData, type PostContentGame, type PostContentImage, type PostContentList, type PostContentTextarea, type PostContentType, type PostContentVideo, type PostFileInput, type PostFormData, type PostType, type PosterInputType, type PosterUsageType, type RefundPolicy, type Region, type RegisterFormData, type RelationDate, type RelationType, type ReportChatUser, type RequestPasswordResetFormData, type Requirement, type ResetPasswordFormData, type ResourceActivityEntry, type ResourceActivityInputType, type ResourceActivityType, type ResourceByUser, type ResourceConnectionsType, type ResourceContactDetailsType, type ResourceDetails, type ResourceImageType, SAVED_EMAIL_KEY, SAVED_PASSWORD_KEY, SAVED_REFRESH_TOKEN_KEY, SAVED_TOKEN_KEY, type SocialMediaType, type StallType, type StripeSubscription, type Subcategory, type SubcategoryItems, type SubscriptionPlanData, type SubscriptionPlansResponse, type SubscriptionPricingData, type SubscriptionStatusData, type TermsAgreement, USER_STORAGE_KEY, type UnregisteredVendorFormData, type UnregisteredVendorInvitationType, type UnregisteredVendorType, type UseGetEventsByRegionOptions, type UserActivity, type UserActivityEvent, type UserFormData, type UserLicenceType, type UserType, type ValidateVerificationTokenFormData, type VendorAttributes, type VendorCalendarData, type VendorFormData, type VendorInfoFormData, type VendorInfoType, type VendorProductList, type VendorType, availableCategories, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, cluemartSocialMedia, companyContactFields, computeDailyClueState, contactUsFields, darkColors, dateFormat, defaultEventFormValues, defaultEventInfoFormValues, defaultPartnerFormValues, defaultUnregisteredVendorFormValues, defaultVendorFormValues, defaultVendorInfoFormValues, emailField, eventBasicInfoFields, eventEndDateFields, eventInfo, eventInfoPaymentInfo, eventStartDateFields, fonts, foodFlavourOptions, formatDate, formatTimestamp, gameScreenIdentifierList, gameTypeToDisplayName, getCurrentAndFutureDates, globalDefaultValues, isFutureDatesBeforeThreshold, licenseNiceNames, lightColors, loginFields, mapArrayToOptions, mapBaseResourceTypeToFormData, normalizeUrl, packagingOptions, partnerBasicInfoFields, paymentMethodOptions, priceUnits, producedIngOptions, productLabelGroups, profileFields, refundPolicyOptions, registerFields, removeTypename, requestPasswordResetFields, requirementsOptions, resetPasswordFields, seededShuffle, socialMediaFields, sortDatesChronologically, stallTypeOptions, statusOptions, tagOptions, timeFormat, toNZTime, truncateText, useAdForm, useAddParticipantToChat, useAddUserFavouriteResource, useAddUserGoingResource, useAddUserInterestResource, useAddUserPresentResource, useAdminPermanentlyDeleteResource, useAdminResendUserVerificationEmail, useAdminUpdateResourceType, useAppSettingsForm, useCancelSubscription, useContactUs, useContactUsForm, useCrawlGoogleMarkets, useCreateAd, useCreateBulkNotifications, useCreateCheckoutSession, useCreateCustomerPortal, useCreateEvent, useCreateEventInfo, useCreatePartner, useCreatePost, useCreatePoster, useCreatePrivateChat, useCreatePushToken, useCreateRelation, useCreateResourceActivity, useCreateUnregisteredVendor, useCreateUser, useCreateVendor, useCreateVendorInfo, useDeleteAd, useDeleteAllNotifications, useDeleteChat, useDeleteEvent, useDeleteNotification, useDeletePartner, useDeletePost, useDeleteRelation, useDeleteUnregisteredVendor, useDeleteUser, useDeleteVendor, useEventForm, useEventInfoForm, useGetAd, useGetAds, useGetAdsByRegion, useGetAppSettings, useGetChat, useGetChatSubscription, useGetChatsByRegion, useGetEvent, useGetEventByPlaceId, useGetEventInfo, useGetEventRelations, useGetEvents, useGetEventsByRegion, useGetEventsNearMe, useGetGame, useGetGameLeaderboard, useGetGames, useGetNotificationCount, useGetNotificationCountSubscription, useGetPartner, useGetPartners, useGetPartnersByRegion, useGetPost, useGetPosts, useGetPostsByType, useGetRelation, useGetRelationByEventAndVendor, useGetReportedChatUsers, useGetResourceActivity, useGetResourceConnections, useGetSubscriptionPlans, useGetSubscriptionStatus, useGetUnregisteredVendor, useGetUnregisteredVendors, useGetUser, useGetUserActivities, useGetUserChats, useGetUserEvents, useGetUserNotifications, useGetUserNotificationsSubscription, useGetUserPartners, useGetUserResources, useGetUserVendors, useGetUsers, useGetVendor, useGetVendorInfo, useGetVendorRelations, useGetVendors, useGetVendorsByRegion, useLeaveGame, useLocationSearch, useLogin, useLoginForm, useLogout, useMarkAllNotificationsRead, useMarkChatMessagesSeen, useMarkNotificationRead, usePartnerForm, usePostForm, useRefreshToken, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRemoveUserGoingResource, useRemoveUserInterestResource, useRemoveUserPresentResource, useReportChatUser, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchEvents, useSearchPartners, useSearchVendors, useSelectPackage, useSelectStandardPackage, useSendChatMessage, useStartGame, useToggleChatMessageLike, useUpdateAd, useUpdateAppSettings, useUpdateDailyClueGame, useUpdateEvent, useUpdateEventInfo, useUpdateGoogleImportedMarkets, useUpdatePartner, useUpdatePost, useUpdateRelation, useUpdateSubscriptionPlan, useUpdateUnregisteredVendor, useUpdateUser, useUpdateVendor, useUpdateVendorInfo, useUserForm, useValidateVerificationToken, useValidateVerificationTokenForm, useVendorForm, useVendorInfoForm, validateVerificationTokenFields, vendorAvailability, vendorBasicInfoFields, vendorCompliance, vendorElectricity, vendorEndDateFields, vendorFoodFlavour, vendorFullAddress, vendorGazebo, vendorLocationDescription, vendorMenuFields, vendorPackaging, vendorPriceRange, vendorProducedIn, vendorStallSize, vendorStartDateFields, vendorTable };
|
|
2506
|
+
export { ANDROID_URL, type AdFormData, type AdResource, type AdType, type AdminUpdateResourceType, type AppSettingsFormData, type AppSettingsType, type AssociateType, type BaseGame, type BaseResourceType, type BaseResourceTypeFormData, type Category, type ChatMessageInput, type ChatMessageReaction, type ChatMessageReplyPreview, type ChatMessageSeen, type ChatMessageType, type ChatType, type ContactUsFormData, type CreateAdFormData, type CreateAppSettingsFormData, type CreateBulkNotificationInput, type CreateContactUsFormData, type CreateEventFormData, type CreateEventInfoFormData, type CreateFormData, type CreateLoginFormData, type CreatePartnerFormData, type CreatePostFormData, type CreateRegisterFormData, type CreateRequestPasswordResetFormData, type CreateResetPasswordFormData, type CreateUnregisteredVendorFormData, type CreateUserFormData, type CreateValidateVerificationTokenFormData, type CreateVendorFormData, type CreateVendorInfoFormData, type DailyClueGameData, type DateTimeType, type DateTimeWithPriceType, type DeviceInfo, EnumActivity, EnumAdShowOn, EnumAdStatus, EnumAdStyle, EnumAdType, EnumBillingPeriod, EnumChatReportReason, EnumChatType, EnumEventDateStatus, EnumEventType, EnumFoodFlavor, EnumFoodType, EnumGameStatus, EnumGameType, EnumInviteStatus, EnumNotificationResourceType, EnumNotificationType, EnumOSPlatform, EnumPartnerType, EnumPaymentMethod, EnumPostContentType, EnumPostType, EnumRegions, EnumRelationResource, EnumResourceType, EnumSocialMedia, EnumSubscriptionStatus, EnumUserLicence, EnumUserRole, EnumVendorType, EnumVerificationType, type EventFormData, type EventInfoFormData, type EventInfoType, type EventListItemType, type EventStatusType, type EventType, type FormDateField, type FormField, type GameData, type GameDate, type GameHistory, type GameLeaderboard, type GamePlacement, type GamePlacementClue, type GameType, type GeocodeLocation, type GoogleAddressComponent, type GoogleImportedMarket, IOS_URL, type ImageObjectType, ImageTypeEnum, type LocationGeoType, type LocationType, type LoginFormData, type NotificationCount, type NotificationDataType, type NotificationType, type Nullable, type OptionItem, type OwnerType, type ParticipantType, type PartnerFormData, type PartnerType, type PaymentInfoType, type PlacePrediction, type PostContentData, type PostContentFormData, type PostContentGame, type PostContentImage, type PostContentList, type PostContentTextarea, type PostContentType, type PostContentVideo, type PostFileInput, type PostFormData, type PostType, type PosterInputType, type PosterUsageType, type RefundPolicy, type Region, type RegisterFormData, type RelationDate, type RelationType, type ReportChatUser, type RequestPasswordResetFormData, type Requirement, type ResetPasswordFormData, type ResourceActivityEntry, type ResourceActivityInputType, type ResourceActivityType, type ResourceByUser, type ResourceConnectionsType, type ResourceContactDetailsType, type ResourceDetails, type ResourceImageType, SAVED_EMAIL_KEY, SAVED_PASSWORD_KEY, SAVED_REFRESH_TOKEN_KEY, SAVED_TOKEN_KEY, type SocialMediaType, type StallType, type StripeSubscription, type Subcategory, type SubcategoryItems, type SubscriptionPlanData, type SubscriptionPlansResponse, type SubscriptionPricingData, type SubscriptionStatusData, type TermsAgreement, USER_STORAGE_KEY, type UnregisteredVendorFormData, type UnregisteredVendorInvitationType, type UnregisteredVendorType, type UseGetEventsByRegionOptions, type UserActivity, type UserActivityEvent, type UserFormData, type UserLicenceType, type UserType, type ValidateVerificationTokenFormData, type VendorAttributes, type VendorCalendarData, type VendorFormData, type VendorInfoFormData, type VendorInfoType, type VendorProductList, type VendorType, availableCategories, availableRegionOptions, availableRegionTypes, availableTagTypes, capitalizeFirstLetter, categoryColors, cluemartSocialMedia, companyContactFields, computeDailyClueState, contactUsFields, darkColors, dateFormat, defaultEventFormValues, defaultEventInfoFormValues, defaultPartnerFormValues, defaultUnregisteredVendorFormValues, defaultVendorFormValues, defaultVendorInfoFormValues, emailField, eventBasicInfoFields, eventEndDateFields, eventInfo, eventInfoPaymentInfo, eventStartDateFields, fonts, foodFlavourOptions, formatDate, formatTimestamp, gameScreenIdentifierList, gameTypeToDisplayName, getCurrentAndFutureDates, globalDefaultValues, isFutureDatesBeforeThreshold, isIsoDateString, licenseNiceNames, lightColors, loginFields, mapArrayToOptions, mapBaseResourceTypeToFormData, normalizeUrl, packagingOptions, partnerBasicInfoFields, paymentMethodOptions, priceUnits, producedIngOptions, productLabelGroups, profileFields, refundPolicyOptions, registerFields, removeTypename, requestPasswordResetFields, requirementsOptions, resetPasswordFields, seededShuffle, socialMediaFields, sortDatesChronologically, stallTypeOptions, statusOptions, tagOptions, timeFormat, toNZTime, truncateText, useAdForm, useAddParticipantToChat, useAddUserFavouriteResource, useAddUserGoingResource, useAddUserInterestResource, useAddUserPresentResource, useAdminPermanentlyDeleteResource, useAdminResendUserVerificationEmail, useAdminUpdateResourceType, useAppSettingsForm, useCancelSubscription, useContactUs, useContactUsForm, useCrawlGoogleMarkets, useCreateAd, useCreateBulkNotifications, useCreateCheckoutSession, useCreateCustomerPortal, useCreateEvent, useCreateEventInfo, useCreatePartner, useCreatePost, useCreatePoster, useCreatePrivateChat, useCreatePushToken, useCreateRelation, useCreateResourceActivity, useCreateUnregisteredVendor, useCreateUser, useCreateVendor, useCreateVendorInfo, useDeleteAd, useDeleteAllNotifications, useDeleteChat, useDeleteEvent, useDeleteNotification, useDeletePartner, useDeletePost, useDeleteRelation, useDeleteUnregisteredVendor, useDeleteUser, useDeleteVendor, useEventForm, useEventInfoForm, useGetAd, useGetAds, useGetAdsByRegion, useGetAppSettings, useGetChat, useGetChatSubscription, useGetChatsByRegion, useGetEvent, useGetEventByPlaceId, useGetEventInfo, useGetEventRelations, useGetEvents, useGetEventsByRegion, useGetEventsNearMe, useGetGame, useGetGameLeaderboard, useGetGames, useGetNotificationCount, useGetNotificationCountSubscription, useGetPartner, useGetPartners, useGetPartnersByRegion, useGetPost, useGetPosts, useGetPostsByType, useGetRelation, useGetRelationByEventAndVendor, useGetReportedChatUsers, useGetResourceActivity, useGetResourceConnections, useGetSubscriptionPlans, useGetSubscriptionStatus, useGetUnregisteredVendor, useGetUnregisteredVendors, useGetUser, useGetUserActivities, useGetUserChats, useGetUserEvents, useGetUserNotifications, useGetUserNotificationsSubscription, useGetUserPartners, useGetUserResources, useGetUserVendors, useGetUsers, useGetVendor, useGetVendorInfo, useGetVendorRelations, useGetVendors, useGetVendorsByRegion, useLeaveGame, useLocationSearch, useLogin, useLoginForm, useLogout, useMarkAllNotificationsRead, useMarkChatMessagesSeen, useMarkNotificationRead, usePartnerForm, usePostForm, useRefreshToken, useRegister, useRegisterForm, useRemoveParticipantFromChat, useRemoveUserFavouriteResource, useRemoveUserGoingResource, useRemoveUserInterestResource, useRemoveUserPresentResource, useReportChatUser, useRequestPasswordReset, useRequestPasswordResetForm, useResetPassword, useResetPasswordForm, useSearchEvents, useSearchPartners, useSearchVendors, useSelectPackage, useSelectStandardPackage, useSendChatMessage, useStartGame, useToggleChatMessageLike, useUpdateAd, useUpdateAppSettings, useUpdateDailyClueGame, useUpdateEvent, useUpdateEventInfo, useUpdateGoogleImportedMarkets, useUpdatePartner, useUpdatePost, useUpdateRelation, useUpdateSubscriptionPlan, useUpdateUnregisteredVendor, useUpdateUser, useUpdateVendor, useUpdateVendorInfo, useUserForm, useValidateVerificationToken, useValidateVerificationTokenForm, useVendorForm, useVendorInfoForm, validateVerificationTokenFields, vendorAvailability, vendorBasicInfoFields, vendorCompliance, vendorElectricity, vendorEndDateFields, vendorFoodFlavour, vendorFullAddress, vendorGazebo, vendorLocationDescription, vendorMenuFields, vendorPackaging, vendorPriceRange, vendorProducedIn, vendorStallSize, vendorStartDateFields, vendorTable };
|
package/dist/index.mjs
CHANGED
|
@@ -433,10 +433,6 @@ var priceUnits = [
|
|
|
433
433
|
{ label: "Half dozen", value: "HALF_DOZEN" }
|
|
434
434
|
];
|
|
435
435
|
|
|
436
|
-
// src/utils/dailyClueGame.ts
|
|
437
|
-
import dayjs from "dayjs";
|
|
438
|
-
import utc from "dayjs/plugin/utc";
|
|
439
|
-
|
|
440
436
|
// src/types/game.ts
|
|
441
437
|
var gameScreenIdentifierList = [
|
|
442
438
|
{
|
|
@@ -549,8 +545,76 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
|
|
|
549
545
|
return EnumGameStatus2;
|
|
550
546
|
})(EnumGameStatus || {});
|
|
551
547
|
|
|
552
|
-
// src/utils/
|
|
548
|
+
// src/utils/date.ts
|
|
549
|
+
import dayjs from "dayjs";
|
|
550
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
551
|
+
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
|
552
|
+
import timezone from "dayjs/plugin/timezone.js";
|
|
553
|
+
import utc from "dayjs/plugin/utc.js";
|
|
554
|
+
var dateFormat = "DD-MM-YYYY";
|
|
555
|
+
var timeFormat = "HH:mm";
|
|
556
|
+
dayjs.extend(customParseFormat);
|
|
553
557
|
dayjs.extend(utc);
|
|
558
|
+
dayjs.extend(timezone);
|
|
559
|
+
dayjs.extend(isSameOrAfter);
|
|
560
|
+
var NZ_TZ = "Pacific/Auckland";
|
|
561
|
+
function toNZTime(date3) {
|
|
562
|
+
return date3 ? dayjs(date3).tz(NZ_TZ) : dayjs().tz(NZ_TZ);
|
|
563
|
+
}
|
|
564
|
+
var formatDate = (dateStr, display = "datetime", timeStr) => {
|
|
565
|
+
const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
|
|
566
|
+
const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
|
|
567
|
+
const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
|
|
568
|
+
const formattedTime = dateTime.format("h:mm a");
|
|
569
|
+
switch (display) {
|
|
570
|
+
case "date":
|
|
571
|
+
return formattedDate;
|
|
572
|
+
case "time":
|
|
573
|
+
return formattedTime;
|
|
574
|
+
case "datetime":
|
|
575
|
+
return `${formattedDate} at ${formattedTime}`;
|
|
576
|
+
default:
|
|
577
|
+
return formattedDate;
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
var getCurrentAndFutureDates = (dates) => {
|
|
581
|
+
const now = dayjs();
|
|
582
|
+
return dates.filter((dateObj) => {
|
|
583
|
+
const dateTime = dayjs(
|
|
584
|
+
`${dateObj.startDate} ${dateObj.startTime}`,
|
|
585
|
+
`${dateFormat} ${timeFormat}`
|
|
586
|
+
);
|
|
587
|
+
return dateTime.isSameOrAfter(now);
|
|
588
|
+
});
|
|
589
|
+
};
|
|
590
|
+
var isFutureDatesBeforeThreshold = (date3, minHoursFromNow) => {
|
|
591
|
+
const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
|
|
592
|
+
const dateTime = dayjs(
|
|
593
|
+
`${date3.startDate} ${date3.startTime}`,
|
|
594
|
+
`${dateFormat} ${timeFormat}`
|
|
595
|
+
);
|
|
596
|
+
return dateTime.isSameOrAfter(threshold);
|
|
597
|
+
};
|
|
598
|
+
var formatTimestamp = (timestamp) => {
|
|
599
|
+
const formattedDate = toNZTime(timestamp).format(dateFormat);
|
|
600
|
+
return formatDate(formattedDate, "date");
|
|
601
|
+
};
|
|
602
|
+
var isIsoDateString = (value) => {
|
|
603
|
+
return typeof value === "string" && !isNaN(Date.parse(value));
|
|
604
|
+
};
|
|
605
|
+
function sortDatesChronologically(dates) {
|
|
606
|
+
if (!dates || !dates.length) {
|
|
607
|
+
return [];
|
|
608
|
+
}
|
|
609
|
+
return [...dates].sort((a, b) => {
|
|
610
|
+
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
611
|
+
const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);
|
|
612
|
+
const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);
|
|
613
|
+
return dateA.valueOf() - dateB.valueOf();
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// src/utils/dailyClueGame.ts
|
|
554
618
|
function createSeededRng(seed) {
|
|
555
619
|
let t = seed >>> 0;
|
|
556
620
|
return function random() {
|
|
@@ -578,15 +642,15 @@ function seededShuffle(array6, seed) {
|
|
|
578
642
|
}
|
|
579
643
|
return result;
|
|
580
644
|
}
|
|
581
|
-
function getDayIndex(
|
|
582
|
-
return
|
|
645
|
+
function getDayIndex(start, today) {
|
|
646
|
+
return today.diff(start, "day");
|
|
583
647
|
}
|
|
584
648
|
function computeDailyClueState(dailyClue) {
|
|
585
649
|
const { startDate, endDate } = dailyClue.gameFields.gameDate;
|
|
586
650
|
const { shuffled, collected } = dailyClue.letterInfo;
|
|
587
|
-
const today =
|
|
588
|
-
const start =
|
|
589
|
-
const end =
|
|
651
|
+
const today = toNZTime().startOf("day");
|
|
652
|
+
const start = toNZTime(startDate).startOf("day");
|
|
653
|
+
const end = toNZTime(endDate).startOf("day");
|
|
590
654
|
const shuffledPlacements = seededShuffle(
|
|
591
655
|
gameScreenIdentifierList,
|
|
592
656
|
start.toISOString()
|
|
@@ -594,14 +658,6 @@ function computeDailyClueState(dailyClue) {
|
|
|
594
658
|
if (today.isBefore(start)) {
|
|
595
659
|
return null;
|
|
596
660
|
}
|
|
597
|
-
if (today.isAfter(end)) {
|
|
598
|
-
return null;
|
|
599
|
-
}
|
|
600
|
-
const index = getDayIndex(startDate);
|
|
601
|
-
if (index < 0 || index >= shuffled.length) return null;
|
|
602
|
-
if (collected?.includes(shuffled[index])) {
|
|
603
|
-
return null;
|
|
604
|
-
}
|
|
605
661
|
if (today.isAfter(end)) {
|
|
606
662
|
return {
|
|
607
663
|
gameHistory: {
|
|
@@ -615,6 +671,11 @@ function computeDailyClueState(dailyClue) {
|
|
|
615
671
|
todaysPlacement: null
|
|
616
672
|
};
|
|
617
673
|
}
|
|
674
|
+
const index = getDayIndex(start, today);
|
|
675
|
+
if (index < 0 || index >= shuffled.length) return null;
|
|
676
|
+
if (collected?.includes(shuffled[index])) {
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
618
679
|
return {
|
|
619
680
|
gameHistory: null,
|
|
620
681
|
todaysClue: shuffledPlacements[index].clue,
|
|
@@ -623,63 +684,7 @@ function computeDailyClueState(dailyClue) {
|
|
|
623
684
|
};
|
|
624
685
|
}
|
|
625
686
|
|
|
626
|
-
// src/utils/
|
|
627
|
-
import dayjs2 from "dayjs";
|
|
628
|
-
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
629
|
-
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
|
630
|
-
import timezone from "dayjs/plugin/timezone.js";
|
|
631
|
-
import utc2 from "dayjs/plugin/utc.js";
|
|
632
|
-
var dateFormat = "DD-MM-YYYY";
|
|
633
|
-
var timeFormat = "HH:mm";
|
|
634
|
-
dayjs2.extend(customParseFormat);
|
|
635
|
-
dayjs2.extend(utc2);
|
|
636
|
-
dayjs2.extend(timezone);
|
|
637
|
-
dayjs2.extend(isSameOrAfter);
|
|
638
|
-
var NZ_TZ = "Pacific/Auckland";
|
|
639
|
-
function toNZTime(date3) {
|
|
640
|
-
return dayjs2(date3).tz(NZ_TZ).format();
|
|
641
|
-
}
|
|
642
|
-
var formatDate = (dateStr, display = "datetime", timeStr) => {
|
|
643
|
-
const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
|
|
644
|
-
const dateTime = timeStr ? dayjs2(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs2(dateStr, dateFormat);
|
|
645
|
-
const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
|
|
646
|
-
const formattedTime = dateTime.format("h:mm a");
|
|
647
|
-
switch (display) {
|
|
648
|
-
case "date":
|
|
649
|
-
return formattedDate;
|
|
650
|
-
case "time":
|
|
651
|
-
return formattedTime;
|
|
652
|
-
case "datetime":
|
|
653
|
-
return `${formattedDate} at ${formattedTime}`;
|
|
654
|
-
default:
|
|
655
|
-
return formattedDate;
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
var getCurrentAndFutureDates = (dates) => {
|
|
659
|
-
const now = dayjs2();
|
|
660
|
-
return dates.filter((dateObj) => {
|
|
661
|
-
const dateTime = dayjs2(
|
|
662
|
-
`${dateObj.startDate} ${dateObj.startTime}`,
|
|
663
|
-
`${dateFormat} ${timeFormat}`
|
|
664
|
-
);
|
|
665
|
-
return dateTime.isSameOrAfter(now);
|
|
666
|
-
});
|
|
667
|
-
};
|
|
668
|
-
var isFutureDatesBeforeThreshold = (date3, minHoursFromNow) => {
|
|
669
|
-
const threshold = minHoursFromNow ? dayjs2().add(minHoursFromNow, "hour") : dayjs2().startOf("day");
|
|
670
|
-
const dateTime = dayjs2(
|
|
671
|
-
`${date3.startDate} ${date3.startTime}`,
|
|
672
|
-
`${dateFormat} ${timeFormat}`
|
|
673
|
-
);
|
|
674
|
-
return dateTime.isSameOrAfter(threshold);
|
|
675
|
-
};
|
|
676
|
-
var formatTimestamp = (timestamp) => {
|
|
677
|
-
const formattedDate = dayjs2(timestamp).tz("Pacific/Auckland").format(dateFormat);
|
|
678
|
-
return formatDate(formattedDate, "date");
|
|
679
|
-
};
|
|
680
|
-
var isIsoDateString = (value) => {
|
|
681
|
-
return typeof value === "string" && !isNaN(Date.parse(value));
|
|
682
|
-
};
|
|
687
|
+
// src/utils/utils.ts
|
|
683
688
|
var removeTypename = (obj) => {
|
|
684
689
|
if (obj instanceof Date) {
|
|
685
690
|
return obj;
|
|
@@ -719,17 +724,6 @@ var statusOptions = [
|
|
|
719
724
|
})).sort((a, b) => a.label.localeCompare(b.label))
|
|
720
725
|
// Sort the options alphabetically
|
|
721
726
|
];
|
|
722
|
-
function sortDatesChronologically(dates) {
|
|
723
|
-
if (!dates || !dates.length) {
|
|
724
|
-
return [];
|
|
725
|
-
}
|
|
726
|
-
return [...dates].sort((a, b) => {
|
|
727
|
-
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
728
|
-
const dateA = dayjs2(`${a.startDate} ${a.startTime}`, dateTimeFormat);
|
|
729
|
-
const dateB = dayjs2(`${b.startDate} ${b.startTime}`, dateTimeFormat);
|
|
730
|
-
return dateA.valueOf() - dateB.valueOf();
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
727
|
var availableRegionTypes = Object.values(EnumRegions);
|
|
734
728
|
var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
|
|
735
729
|
var paymentMethodOptions = mapArrayToOptions(
|
|
@@ -6213,7 +6207,7 @@ import * as React from "react";
|
|
|
6213
6207
|
import { useForm } from "react-hook-form";
|
|
6214
6208
|
|
|
6215
6209
|
// src/yupSchema/global.ts
|
|
6216
|
-
import
|
|
6210
|
+
import dayjs2 from "dayjs";
|
|
6217
6211
|
import customParseFormat2 from "dayjs/plugin/customParseFormat.js";
|
|
6218
6212
|
import isSameOrAfter2 from "dayjs/plugin/isSameOrAfter.js";
|
|
6219
6213
|
import * as yup from "yup";
|
|
@@ -6242,8 +6236,8 @@ var noLeadingZeros = (fieldName, options = {}) => {
|
|
|
6242
6236
|
return true;
|
|
6243
6237
|
};
|
|
6244
6238
|
};
|
|
6245
|
-
|
|
6246
|
-
|
|
6239
|
+
dayjs2.extend(isSameOrAfter2);
|
|
6240
|
+
dayjs2.extend(customParseFormat2);
|
|
6247
6241
|
var emailRequiredSchema = yup.string().email("Invalid email address").required("Email is required").label("Email").transform(
|
|
6248
6242
|
(value) => typeof value === "string" ? value.trim().toLowerCase() : value
|
|
6249
6243
|
);
|
|
@@ -6274,12 +6268,12 @@ var contactDetailsSchema = yup.object({
|
|
|
6274
6268
|
landlinePhone: landlinePhoneSchema
|
|
6275
6269
|
}).nullable().default(void 0);
|
|
6276
6270
|
var endDateNotInPastTest = yup.string().test("not-in-past", "End date cannot be in the past", (value) => {
|
|
6277
|
-
const now =
|
|
6278
|
-
return value ?
|
|
6271
|
+
const now = dayjs2();
|
|
6272
|
+
return value ? dayjs2(value, dateFormat, true).isSameOrAfter(now, "day") : false;
|
|
6279
6273
|
});
|
|
6280
6274
|
var startDateNotInPastTest = yup.string().test("not-in-past", "Start date cannot be in the past", (value) => {
|
|
6281
|
-
const now =
|
|
6282
|
-
return value ?
|
|
6275
|
+
const now = dayjs2();
|
|
6276
|
+
return value ? dayjs2(value, dateFormat, true).isSameOrAfter(now, "day") : false;
|
|
6283
6277
|
});
|
|
6284
6278
|
var endDateAfterStartDateTest = yup.string().test(
|
|
6285
6279
|
"end-after-start",
|
|
@@ -6287,8 +6281,8 @@ var endDateAfterStartDateTest = yup.string().test(
|
|
|
6287
6281
|
function(value) {
|
|
6288
6282
|
const { startDate } = this.parent;
|
|
6289
6283
|
if (!startDate || !value) return false;
|
|
6290
|
-
return
|
|
6291
|
-
|
|
6284
|
+
return dayjs2(value, dateFormat, true).isSameOrAfter(
|
|
6285
|
+
dayjs2(startDate, dateFormat, true),
|
|
6292
6286
|
"day"
|
|
6293
6287
|
);
|
|
6294
6288
|
}
|
|
@@ -6299,12 +6293,12 @@ var endTimeMustBeAfterStartTimeTest = yup.string().test(
|
|
|
6299
6293
|
function(value) {
|
|
6300
6294
|
const { startDate, endDate, startTime } = this.parent;
|
|
6301
6295
|
if (!startDate || !endDate || !startTime || !value) return false;
|
|
6302
|
-
const startDateTime =
|
|
6296
|
+
const startDateTime = dayjs2(
|
|
6303
6297
|
`${startDate} ${startTime}`,
|
|
6304
6298
|
`${dateFormat} ${timeFormat}`,
|
|
6305
6299
|
true
|
|
6306
6300
|
);
|
|
6307
|
-
const endDateTime =
|
|
6301
|
+
const endDateTime = dayjs2(
|
|
6308
6302
|
`${endDate} ${value}`,
|
|
6309
6303
|
`${dateFormat} ${timeFormat}`,
|
|
6310
6304
|
true
|
|
@@ -6316,10 +6310,10 @@ var startTimeCannotBeInPastTest = yup.string().test(
|
|
|
6316
6310
|
"valid-start-time",
|
|
6317
6311
|
"Start time cannot be in the past",
|
|
6318
6312
|
function(value) {
|
|
6319
|
-
const now =
|
|
6313
|
+
const now = dayjs2();
|
|
6320
6314
|
const { startDate } = this.parent;
|
|
6321
6315
|
if (!startDate || !value) return false;
|
|
6322
|
-
const startDateTime =
|
|
6316
|
+
const startDateTime = dayjs2(
|
|
6323
6317
|
`${startDate} ${value}`,
|
|
6324
6318
|
`${dateFormat} ${timeFormat}`,
|
|
6325
6319
|
true
|
|
@@ -7998,6 +7992,7 @@ export {
|
|
|
7998
7992
|
getCurrentAndFutureDates,
|
|
7999
7993
|
globalDefaultValues,
|
|
8000
7994
|
isFutureDatesBeforeThreshold,
|
|
7995
|
+
isIsoDateString,
|
|
8001
7996
|
licenseNiceNames,
|
|
8002
7997
|
lightColors,
|
|
8003
7998
|
loginFields,
|