@timardex/cluemart-shared 1.7.0 → 1.7.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.
Files changed (145) hide show
  1. package/dist/ad-BUYzE6zx.d.ts +181 -0
  2. package/dist/ad-BhLoEul3.d.mts +181 -0
  3. package/dist/affiliate-BbtjeUP4.d.mts +73 -0
  4. package/dist/affiliate-C51nzKsw.d.ts +73 -0
  5. package/dist/apollo/index.cjs +1383 -0
  6. package/dist/apollo/index.cjs.map +1 -0
  7. package/dist/apollo/index.d.mts +323 -0
  8. package/dist/apollo/index.d.ts +323 -0
  9. package/dist/apollo/index.mjs +1295 -0
  10. package/dist/apollo/index.mjs.map +1 -0
  11. package/dist/auth/index.cjs +1727 -0
  12. package/dist/auth/index.cjs.map +1 -0
  13. package/dist/auth/index.d.mts +166 -0
  14. package/dist/auth/index.d.ts +166 -0
  15. package/dist/auth/index.mjs +380 -0
  16. package/dist/auth/index.mjs.map +1 -0
  17. package/dist/chunk-32MKHJTX.mjs +1207 -0
  18. package/dist/chunk-32MKHJTX.mjs.map +1 -0
  19. package/dist/{chunk-HZMP7GXC.mjs → chunk-447EYKHL.mjs} +1010 -2671
  20. package/dist/chunk-447EYKHL.mjs.map +1 -0
  21. package/dist/{chunk-RKIRWZCH.mjs → chunk-AYO3E4DM.mjs} +39 -183
  22. package/dist/chunk-AYO3E4DM.mjs.map +1 -0
  23. package/dist/{chunk-ZZJSCYJK.mjs → chunk-BIJ5NDXW.mjs} +46 -42
  24. package/dist/chunk-BIJ5NDXW.mjs.map +1 -0
  25. package/dist/chunk-DQ7ZHIXW.mjs +26 -0
  26. package/dist/chunk-DQ7ZHIXW.mjs.map +1 -0
  27. package/dist/{chunk-MVQ3CFQR.mjs → chunk-ILILH7E2.mjs} +12 -23
  28. package/dist/chunk-ILILH7E2.mjs.map +1 -0
  29. package/dist/{chunk-TAECMXM4.mjs → chunk-LBEJECG3.mjs} +249 -219
  30. package/dist/{chunk-TAECMXM4.mjs.map → chunk-LBEJECG3.mjs.map} +1 -1
  31. package/dist/chunk-RAYUJODN.mjs +45 -0
  32. package/dist/chunk-RAYUJODN.mjs.map +1 -0
  33. package/dist/chunk-SD42WIMV.mjs +297 -0
  34. package/dist/chunk-SD42WIMV.mjs.map +1 -0
  35. package/dist/chunk-VPANTTZI.mjs +262 -0
  36. package/dist/chunk-VPANTTZI.mjs.map +1 -0
  37. package/dist/{chunk-KZTOISPA.mjs → chunk-X3OLM35T.mjs} +14 -8
  38. package/dist/chunk-X3OLM35T.mjs.map +1 -0
  39. package/dist/{contactUs-H7799pWe.d.ts → contactUs--NoohZBu.d.ts} +1 -1
  40. package/dist/{contactUs-DGrDzJaM.d.mts → contactUs-CBWzefUS.d.mts} +1 -1
  41. package/dist/enums/index.cjs +13 -7
  42. package/dist/enums/index.cjs.map +1 -1
  43. package/dist/enums/index.d.mts +15 -9
  44. package/dist/enums/index.d.ts +15 -9
  45. package/dist/enums/index.mjs +1 -1
  46. package/dist/formFields/index.cjs +136 -73
  47. package/dist/formFields/index.cjs.map +1 -1
  48. package/dist/formFields/index.d.mts +3 -2
  49. package/dist/formFields/index.d.ts +3 -2
  50. package/dist/formFields/index.mjs +9 -4
  51. package/dist/{global-fKbMmluy.d.ts → global-CUYYxpy2.d.ts} +12 -11
  52. package/dist/{global-BUUfmCo7.d.mts → global-DePDtOFt.d.mts} +12 -11
  53. package/dist/graphql/index.cjs +734 -1271
  54. package/dist/graphql/index.cjs.map +1 -1
  55. package/dist/graphql/index.d.mts +434 -176
  56. package/dist/graphql/index.d.ts +434 -176
  57. package/dist/graphql/index.mjs +37 -23
  58. package/dist/hooks/index.cjs +947 -309
  59. package/dist/hooks/index.cjs.map +1 -1
  60. package/dist/hooks/index.d.mts +10 -4
  61. package/dist/hooks/index.d.ts +10 -4
  62. package/dist/hooks/index.mjs +170 -58
  63. package/dist/hooks/index.mjs.map +1 -1
  64. package/dist/images/apple-maps-icon.webp.d.ts +8 -1
  65. package/dist/images/banner-horizontal.webp.d.ts +8 -1
  66. package/dist/images/banner-vertical.webp.d.ts +8 -1
  67. package/dist/images/cluiTui.webp.d.ts +8 -1
  68. package/dist/images/corporate.webp.d.ts +8 -1
  69. package/dist/images/facebook.webp.d.ts +8 -1
  70. package/dist/images/gazebo-top.webp.d.ts +8 -1
  71. package/dist/images/google-maps-icon.webp.d.ts +8 -1
  72. package/dist/images/googleMaps-logo-dark.webp.d.ts +8 -1
  73. package/dist/images/googleMaps-logo-light.webp.d.ts +8 -1
  74. package/dist/images/instagram.webp.d.ts +8 -1
  75. package/dist/images/logo-atr.webp.d.ts +8 -1
  76. package/dist/images/logo-dark.webp.d.ts +8 -1
  77. package/dist/images/logo.webp.d.ts +8 -1
  78. package/dist/images/meet.webp.d.ts +8 -1
  79. package/dist/images/mini-market1.webp.d.ts +8 -1
  80. package/dist/images/mini-market2.webp.d.ts +8 -1
  81. package/dist/images/mini-market3.webp.d.ts +8 -1
  82. package/dist/images/mini-market4.webp.d.ts +8 -1
  83. package/dist/images/mini-market5.webp.d.ts +8 -1
  84. package/dist/images/poll.webp.d.ts +8 -1
  85. package/dist/images/poster1.webp.d.ts +8 -1
  86. package/dist/images/poster2.webp.d.ts +8 -1
  87. package/dist/images/poster3.webp.d.ts +8 -1
  88. package/dist/images/poster4.webp.d.ts +8 -1
  89. package/dist/images/private.webp.d.ts +8 -1
  90. package/dist/images/qr-code.webp.d.ts +8 -1
  91. package/dist/images/school.webp.d.ts +8 -1
  92. package/dist/images/sima.webp.d.ts +8 -1
  93. package/dist/images/store-android.webp.d.ts +8 -1
  94. package/dist/images/store-ios.webp.d.ts +8 -1
  95. package/dist/images/tablas.webp.d.ts +8 -1
  96. package/dist/images/telefonos.webp.d.ts +8 -1
  97. package/dist/images/tiktok.webp.d.ts +8 -1
  98. package/dist/images/tip.webp.d.ts +8 -1
  99. package/dist/images/ugralos.webp.d.ts +8 -1
  100. package/dist/images/waze-maps-icon.webp.d.ts +8 -1
  101. package/dist/images/website.webp.d.ts +8 -1
  102. package/dist/images/youtube.webp.d.ts +8 -1
  103. package/dist/index.cjs +1751 -1781
  104. package/dist/index.cjs.map +1 -1
  105. package/dist/index.d.mts +665 -243
  106. package/dist/index.d.ts +665 -243
  107. package/dist/index.mjs +1711 -1779
  108. package/dist/index.mjs.map +1 -1
  109. package/dist/map/index.cjs +14 -9
  110. package/dist/map/index.cjs.map +1 -1
  111. package/dist/map/index.d.mts +16 -13
  112. package/dist/map/index.d.ts +16 -13
  113. package/dist/map/index.mjs +14 -9
  114. package/dist/map/index.mjs.map +1 -1
  115. package/dist/{resourceActivities-BL_12IAo.d.ts → resourceActivities-CMUcn2P7.d.ts} +9 -4
  116. package/dist/{resourceActivities-zczOntNk.d.mts → resourceActivities-CwbJFGIp.d.mts} +9 -4
  117. package/dist/sharing/index.cjs +39 -1252
  118. package/dist/sharing/index.cjs.map +1 -1
  119. package/dist/sharing/index.d.mts +17 -5
  120. package/dist/sharing/index.d.ts +17 -5
  121. package/dist/sharing/index.mjs +34 -30
  122. package/dist/subscription-BU8GvH2K.d.ts +12 -0
  123. package/dist/subscription-bmAdrnfi.d.mts +12 -0
  124. package/dist/types/index.cjs +15 -2
  125. package/dist/types/index.cjs.map +1 -1
  126. package/dist/types/index.d.mts +10 -23
  127. package/dist/types/index.d.ts +10 -23
  128. package/dist/types/index.mjs +9 -5
  129. package/dist/user-D47MLFyH.d.ts +134 -0
  130. package/dist/user-DE8edl3u.d.mts +134 -0
  131. package/dist/utils/index.cjs +355 -136
  132. package/dist/utils/index.cjs.map +1 -1
  133. package/dist/utils/index.d.mts +87 -35
  134. package/dist/utils/index.d.ts +87 -35
  135. package/dist/utils/index.mjs +42 -15
  136. package/package.json +31 -10
  137. package/dist/ad-CVkVX_z5.d.ts +0 -296
  138. package/dist/ad-DA9ECAhK.d.mts +0 -296
  139. package/dist/affiliate-1RtkLnLP.d.ts +0 -35
  140. package/dist/affiliate-Cos2Syz5.d.mts +0 -35
  141. package/dist/chunk-HZMP7GXC.mjs.map +0 -1
  142. package/dist/chunk-KZTOISPA.mjs.map +0 -1
  143. package/dist/chunk-MVQ3CFQR.mjs.map +0 -1
  144. package/dist/chunk-RKIRWZCH.mjs.map +0 -1
  145. package/dist/chunk-ZZJSCYJK.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/auth.ts","../src/types/global.ts","../src/types/ad.ts","../src/types/resourceActivities.ts","../src/types/post.ts","../src/types/game/index.ts","../src/types/game/dailyClue.ts","../src/types/game/global.ts","../src/types/affiliate.ts"],"sourcesContent":["import {\n CreateFormData,\n EnumOSPlatform,\n PromoCodeType,\n TermsAgreement,\n} from \"src\";\n\nimport { MutationResponse } from \"./global\";\nimport { SafeUserType } from \"./user\";\n\nexport enum EnumVerificationType {\n REGISTER = \"register\",\n RESET_PASSWORD = \"resetPassword\",\n}\n\nexport type LoginFormData = {\n email: string;\n isAdminPage?: boolean;\n password: string;\n platform?: EnumOSPlatform;\n};\n\nexport type CreateLoginFormData = CreateFormData<LoginFormData>;\n\nexport type RegisterFormData = {\n email: string;\n firstName: string;\n lastName: string;\n password: string;\n platform?: EnumOSPlatform;\n preferredRegion: string;\n promoCode?: PromoCodeType | null;\n termsAgreement?: TermsAgreement | null;\n};\n\nexport type CreateRegisterFormData = CreateFormData<RegisterFormData>;\n\nexport type RequestPasswordResetFormData = {\n email: string;\n};\n\nexport type CreateRequestPasswordResetFormData =\n CreateFormData<RequestPasswordResetFormData>;\n\nexport type ResetPasswordFormData = {\n confirmPassword: string;\n email: string;\n password: string;\n};\n\nexport type CreateResetPasswordFormData = CreateFormData<ResetPasswordFormData>;\n\nexport type ValidateVerificationTokenFormData = {\n email: string;\n verificationToken: string;\n verificationType?: EnumVerificationType;\n};\n\nexport type CreateValidateVerificationTokenFormData =\n CreateFormData<ValidateVerificationTokenFormData>;\n\nexport type AuthPayloadType = {\n refreshToken: string | null;\n token: string;\n user: SafeUserType;\n};\n\nexport type AuthMutationResponse = MutationResponse<AuthPayloadType>;\n\nexport type RefreshTokenPayloadType = {\n refreshToken: string;\n token: string;\n};\n\nexport type RefreshTokenMutationResponse =\n MutationResponse<RefreshTokenPayloadType>;\n","import {\n Control,\n FieldValues,\n FormState,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormReset,\n UseFormSetValue,\n UseFormWatch,\n} from \"react-hook-form\";\n\nimport {\n EnumEventDateStatus,\n EnumEventType,\n EnumResourceType,\n EnumSocialMedia,\n EnumUserLicence,\n} from \"../enums\";\n\nimport { EventListItemType } from \"./event\";\nimport { EnumPostType } from \"./post\";\nimport { VendorType } from \"./vendor\";\n\nexport const PROMO_CODE_PREFIX = \"CM-\";\n\nexport type PromoCodeType = `${typeof PROMO_CODE_PREFIX}${string}`;\n\nexport type Nullable<T> = {\n [K in keyof T]: T[K] | null | undefined;\n};\n\n/** Uniform mutation response envelope used across GraphQL mutations. */\nexport type MutationResponse<T> = {\n data: T | null;\n message: string | null;\n};\n\nexport type DeviceInfo = {\n appBuildNumber: string;\n appId: string;\n appVersion: string;\n brand: string;\n deviceName: string;\n installationId: string;\n manufacturer: string;\n modelName: string;\n osName: string;\n osVersion: string;\n timestamp: string;\n};\n\nexport type TermsAgreement = DeviceInfo & {\n termVersion: string;\n};\n\nexport type ResourceContactDetailsType = {\n email?: string | null;\n landlinePhone?: string | null;\n mobilePhone?: string | null;\n};\n\nexport type ResourceImageType = {\n active: boolean;\n source: string;\n title: string;\n};\n\nexport type SocialMediaType = {\n name?: EnumSocialMedia;\n link?: string;\n};\n\nexport type UserLicenceType = {\n expiryDate: Date;\n issuedDate: Date;\n licenceType: EnumUserLicence;\n prevLicenceType?: EnumUserLicence | null;\n};\n\nexport type OwnerType = {\n email: string;\n userId: string;\n};\n\nexport interface BaseResourceTypeFormData {\n _id?: string;\n active: boolean;\n contactDetails: ResourceContactDetailsType | null;\n cover: ResourceImageType;\n coverUpload?: ResourceImageType | null;\n description: string;\n images?: ResourceImageType[] | null;\n imagesUpload?: ResourceImageType[] | null;\n logo?: ResourceImageType | null;\n logoUpload?: ResourceImageType | null;\n name: string;\n promoCodes?: PromoCodeType[] | null;\n region: string;\n socialMedia: SocialMediaType[] | null;\n termsAgreement?: TermsAgreement | null;\n}\n\nexport type PosterUsageType = {\n month: string;\n count: number;\n};\n\nexport type RelatedPostType = {\n postActive: boolean;\n postId: string;\n postSlug: string;\n postType: EnumPostType;\n};\n\nexport type SocialShareResourceType = {\n qrCode: ResourceImageType;\n socialImage: ResourceImageType;\n};\n\nexport type BaseResourceType = Omit<\n BaseResourceTypeFormData,\n \"_id\" | \"coverUpload\" | \"imagesUpload\" | \"logoUpload\"\n> & {\n _id: string;\n adIds?: string[] | null;\n approvedAt?: Date | null;\n createdAt: Date;\n deletedAt: Date | null;\n owner: OwnerType;\n posterUsage?: PosterUsageType | null;\n rating?: number | null;\n relatedPost?: RelatedPostType | null;\n reviewCount?: number | null;\n slug: string;\n updatedAt: Date | null;\n};\n\nexport type LocationGeoType = {\n coordinates: number[]; // [longitude, latitude]\n type: \"Point\"; // Mongoose GeoJSON type\n};\n\nexport type LocationType = {\n city: string;\n country: string;\n fullAddress: string;\n geo: LocationGeoType;\n latitude: number;\n longitude: number;\n region: string;\n};\n\nexport type DateTimeType = {\n dateStatus: EnumEventDateStatus;\n endDate: string;\n endTime: string;\n startDate: string;\n startTime: string;\n};\n\nexport type Region = {\n latitude: number;\n latitudeDelta: number;\n longitude: number;\n longitudeDelta: number;\n};\n\nexport type ResourceDetails = {\n dateTime: DateTimeType[] | null;\n description: string | null;\n eventStatus?: EventStatusType | null;\n location: LocationType | null;\n resourceCover: ResourceImageType | null;\n resourceId: string;\n resourceLogo: ResourceImageType | null;\n resourceName: string;\n resourceType: EnumResourceType;\n};\n\nexport type GeocodeLocation = Pick<LocationType, \"latitude\" | \"longitude\">;\n\nexport type EventStatusType = {\n claimed: boolean;\n eventType: EnumEventType;\n googlePlaceId?: string | null;\n};\n\nexport interface FormField {\n disabled?: boolean;\n helperText?: string;\n isTextArea?: boolean;\n keyboardType?:\n | \"default\"\n | \"email-address\"\n | \"number-pad\"\n | \"url\"\n | \"decimal-pad\"\n | \"phone-pad\";\n name: string;\n placeholder: string;\n required?: boolean;\n secureTextEntry?: boolean;\n}\n\nexport interface FormDateField {\n dateMode: \"date\" | \"time\";\n helperText?: string;\n name: \"endDate\" | \"endTime\" | \"startDate\" | \"startTime\";\n placeholder: string;\n}\n\nexport interface SubcategoryItems {\n id: string;\n name: string;\n description?: string | null;\n}\n\nexport interface Subcategory {\n id: string;\n name: string;\n items?: SubcategoryItems[] | null;\n}\n\nexport interface Category {\n color?: string | null;\n description?: string | null;\n id: string;\n name: string;\n subcategories: Subcategory[];\n}\n\nexport type OptionItem = {\n value: string;\n label: string;\n};\n\nexport type ImageObjectType = {\n uri: string;\n type: string;\n name: string;\n};\n\nexport interface ResourceConnectionsType {\n events: EventListItemType[] | null;\n vendors: VendorType[] | null;\n}\n\nexport interface CreateFormData<T extends FieldValues> {\n control: Control<T, any>;\n fields: T;\n formState: FormState<T>;\n handleSubmit: UseFormHandleSubmit<T, any>;\n reset: UseFormReset<T>;\n setValue: UseFormSetValue<T>;\n watch: UseFormWatch<T>;\n getValues: UseFormGetValues<T>;\n}\n\nexport interface UseGetResourcesByRegionOptions {\n onlyClaimed?: boolean;\n limit?: number;\n offset?: number;\n}\n","import { EnumResourceType } from \"src/enums\";\n\nimport { CreateFormData } from \"./global\";\n\nexport enum EnumAdShowOn {\n EVENTS_PAGE = \"Events_page\",\n FRONT_PAGE = \"Front_page\",\n PARTNERS_PAGE = \"Partners_page\",\n VENDORS_PAGE = \"Vendors_page\",\n}\n\nexport enum EnumAdStatus {\n ACTIVE = \"Active\",\n PAUSED = \"Paused\",\n EXPIRED = \"Expired\",\n}\n\nexport enum EnumAdType {\n SPONSORED = \"Sponsored\",\n FREE = \"Free\",\n}\n\nexport enum EnumAdStyle {\n BLOOM = \"Bloom\",\n RISE = \"Rise\",\n}\n\nexport type AdResource = {\n adDescription: string;\n adImage: string;\n adStyle: EnumAdStyle;\n adTitle: string;\n adType: EnumAdType;\n resourceId: string;\n resourceName: string;\n resourceRegion: string;\n resourceType: EnumResourceType;\n resourceSlug: string;\n};\n\nexport interface AdFormData {\n active: boolean;\n end: Date; // ISO date string\n resource: AdResource;\n showOn: EnumAdShowOn[];\n start?: Date; // ISO date string\n status: EnumAdStatus;\n targetRegion: string[];\n}\n\n// Form state matches the validation schema: all resource fields are present.\n// Use empty strings / explicit enum defaults in `defaultValues` for \"create\" flows.\nexport type AdFormState = AdFormData;\n\nexport type CreateAdFormData = CreateFormData<AdFormData>;\nexport type CreateAdFormState = CreateFormData<AdFormState>;\n\nexport interface AdType extends AdFormData {\n _id: string;\n clicks?: number; // How many times the ad was clicked\n createdAt: Date;\n impressions?: number; // How often the ad was seen\n start: Date; // ISO date string\n updatedAt: Date | null;\n}\n","import {\n EnumEventDateStatus,\n EnumOSPlatform,\n EnumResourceType,\n} from \"src/enums\";\n\nimport { LocationGeoType } from \"./global\";\n\nexport enum EnumActivity {\n FAVORITE = \"FAVORITE\",\n GOING = \"GOING\",\n INTERESTED = \"INTERESTED\",\n PRESENT = \"PRESENT\",\n VIEW = \"VIEW\",\n}\n\nexport type ResourceActivityEntry = {\n activityType: EnumActivity;\n location: LocationGeoType | null;\n dateStatus?: EnumEventDateStatus | null;\n startDate?: string | null;\n startTime?: string | null;\n timestamp: Date;\n userAgent: EnumOSPlatform;\n userId?: string | null;\n};\n\nexport type ResourceActivityType = {\n _id: string;\n resourceType: EnumResourceType;\n resourceId: string;\n activity: ResourceActivityEntry[];\n};\n\nexport type ResourceActivityInputType = {\n resourceId: string;\n resourceType: EnumResourceType;\n activity: Omit<ResourceActivityEntry, \"timestamp\">;\n};\n","import { EnumResourceType } from \"src/enums\";\n\nimport { BaseGameType } from \"./game\";\nimport {\n CreateFormData,\n ResourceImageType,\n SocialShareResourceType,\n} from \"./global\";\n\nexport enum EnumPostType {\n MARKET_FACES = \"market_faces\",\n CLUE_BITES = \"clue_bites\",\n PLAY_AND_WIN = \"play_and_win\",\n}\n\nexport enum EnumPostContentType {\n GAME = \"game\",\n IMAGE = \"image\",\n LIST = \"list\",\n TEXTAREA = \"textarea\",\n VIDEO = \"video\",\n}\n\nexport type PostFileInput = {\n source: File;\n title?: string;\n};\n\nexport type PostContentTextarea = {\n textarea: {\n title?: string;\n data: string;\n };\n};\n\nexport type PostContentImage = {\n images: ResourceImageType[] | null;\n imagesUpload?: PostFileInput[] | null;\n};\n\nexport type PostContentVideo = {\n video: {\n source: string;\n title?: string;\n };\n};\n\nexport type PostContentList = {\n list: {\n title?: string;\n items: {\n text: string;\n }[];\n };\n};\n\nexport type PostContentGame = {\n game: BaseGameType;\n};\n\nexport type PostContentData =\n | PostContentGame\n | PostContentTextarea\n | PostContentImage\n | PostContentVideo\n | PostContentList;\n\nexport type PostContentFormData = {\n contentData?: PostContentData | null;\n contentOrder?: number | null;\n contentType?: EnumPostContentType | null;\n};\n\nexport type PostResource = {\n resourceSlug: string;\n resourceId: string;\n resourceType: EnumResourceType;\n resourceRegion: string;\n};\n\nexport interface PostFormData {\n active: boolean;\n caption: string;\n content: PostContentFormData[];\n cover?: ResourceImageType | null;\n coverUpload?: PostFileInput | null;\n postType: EnumPostType;\n resource?: PostResource | null;\n tags?: string[] | null;\n title: string;\n notifyUsers?: boolean | null;\n}\n\nexport type CreatePostFormData = CreateFormData<PostFormData>;\n\nexport type PostContentType = Omit<PostContentFormData, \"contentData\"> & {\n contentData: Omit<PostContentData, \"imagesUpload\">;\n};\n\nexport type PostType = Omit<\n PostFormData,\n \"content\" | \"coverUpload\" | \"resource\"\n> & {\n _id: string;\n approvedAt?: Date | null;\n content: PostContentType[];\n createdAt: Date;\n deletedAt: Date | null;\n resource?: PostResource | null;\n slug: string;\n sharePublic?: SocialShareResourceType | null;\n updatedAt: Date | null;\n};\n","import { OwnerType } from \"../global\";\n\nimport { DailyClueBaseGame, DailyClueGameData } from \"./dailyClue\";\nimport { EnumGameType, GameDate } from \"./global\";\nimport { PuzzleBaseGame, PuzzleGameData } from \"./puzzleGame\";\n\nexport type BaseGameMap = {\n [EnumGameType.DAILY_CLUE]: DailyClueBaseGame;\n [EnumGameType.MINI_QUIZ]: PuzzleBaseGame;\n [EnumGameType.ODD_ONE_OUT]: PuzzleBaseGame;\n};\n\nexport type BaseGameType = {\n gameType: EnumGameType;\n gameTypeId: string;\n gameTitle: string;\n} & {\n [K in keyof BaseGameMap]?: BaseGameMap[K] | null;\n};\n\nexport enum EnumGameStatus {\n GAME_COMPLETED = \"GAME_COMPLETED\",\n GAME_IN_PROGRESS = \"GAME_IN_PROGRESS\",\n GAME_LEFT = \"GAME_LEFT\",\n GAME_STARTED = \"GAME_STARTED\",\n}\n\nexport type GameHistory = Pick<\n BaseGameType,\n \"gameTitle\" | \"gameType\" | \"gameTypeId\"\n> & {\n createdAt: Date;\n gameDate: GameDate;\n gameStatus: EnumGameStatus;\n /** Per-event delta. Not persisted for overallGamePoints (computed at read time). */\n pointsEarned: number;\n /** Running total for this game instance; computed at read time, not stored in Mongo. */\n overallGamePoints?: number;\n};\n\ntype GameDataMap = {\n [EnumGameType.DAILY_CLUE]: DailyClueGameData;\n [EnumGameType.MINI_QUIZ]: PuzzleGameData;\n [EnumGameType.ODD_ONE_OUT]: PuzzleGameData;\n};\ntype GameDataType = {\n [K in keyof GameDataMap]?: GameDataMap[K] | null;\n};\n\nexport type GameType = Pick<\n BaseGameType,\n \"gameTitle\" | \"gameType\" | \"gameTypeId\"\n> & {\n _id: string;\n active: boolean;\n createdAt: Date;\n gameData: GameDataType;\n gameHistory: GameHistory[] | null;\n updatedAt: Date | null;\n};\n\nexport type GameDocType = {\n _id: string;\n active: boolean;\n createdAt: Date;\n deletedAt: Date | null;\n games: GameType[] | null;\n owner: OwnerType;\n points: number;\n updatedAt: Date | null;\n};\n\nexport type GameLeaderboard = {\n gameHistory: GameHistory[] | null;\n overallPoints: number;\n owner: OwnerType;\n};\n","import { GameDate, GlobalGameData } from \"./global\";\n\nconst OBJECT_ID_PATH_SEGMENT = \"[a-f0-9]{24}\";\nconst OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;\n\nexport const gameScreenIdentifierList = [\n {\n clue: \"Where your actions turn into a timeline.\",\n id: \"activities\",\n match: \"/profile/activities\",\n },\n {\n clue: \"Where conversations happen without speaking.\",\n id: \"chat\",\n match: \"/profile/chat\",\n },\n {\n clue: \"The place to redefine who you are.\",\n id: \"edit-profile\",\n match: \"/profile/edit-profile\",\n },\n {\n clue: \"A single moment worth showing up for.\",\n id: \"single-event\",\n match: new RegExp(`^/events/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"What’s happening around you, right now.\",\n id: \"events-near-me\",\n match: \"/events/events-near-me\",\n },\n {\n clue: \"Where events appear as pins on a map.\",\n id: \"events-map\",\n match: \"/events/events-map\",\n },\n {\n clue: \"A collection of events worth attending.\",\n id: \"events\",\n match: \"/events\",\n },\n {\n clue: \"What’s happening in a wider area — not just nearby.\",\n id: \"events-region\",\n match: /^\\/events\\/region\\/[^/]+$/,\n },\n {\n clue: \"Where fun becomes a challenge.\",\n id: \"games\",\n match: \"/games\",\n },\n {\n clue: \"Your starting point for everything.\",\n id: \"home\",\n match: \"/\",\n },\n {\n clue: \"Where the app whispers what you shouldn’t miss.\",\n id: \"notifications\",\n match: \"/notifications\",\n },\n {\n clue: \"Where you fine-tune your experience.\",\n id: \"options\",\n match: \"/options\",\n },\n {\n clue: \"An organisation or creator supporting the community.\",\n id: \"single-partner\",\n match: new RegExp(`^/partners/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Organisations and creators supporting the community.\",\n id: \"partners\",\n match: \"/partners\",\n },\n {\n clue: \"A single published post in full view.\",\n id: \"single-visitor-post\",\n match: new RegExp(`^/visitors/post/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Your identity, on display.\",\n id: \"profile\",\n match: \"/profile\",\n },\n {\n clue: \"One stallholder offering something valuable.\",\n id: \"single-vendor\",\n match: new RegExp(`^/vendors/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Where every stallholder waits under the right category.\",\n id: \"vendors\",\n match: \"/vendors\",\n },\n {\n clue: \"Where you browse articles and posts from around the platform.\",\n id: \"visitors\",\n match: \"/visitors\",\n },\n] as const;\n\nexport type GamePlacement = (typeof gameScreenIdentifierList)[number][\"id\"];\nexport type GamePlacementClue =\n (typeof gameScreenIdentifierList)[number][\"clue\"];\n\nexport type DailyClueBaseGame = {\n gameDate: GameDate;\n gameSolution: string;\n};\n\nexport type DailyClueGameData = GlobalGameData & {\n gameFields: DailyClueBaseGame;\n lastFoundDate: Date | null;\n letterInfo: {\n collected: string[] | null; // The letters the user has found, e.g. [\"C\", \"L\", \"U\"]\n solutionShuffled: string[]; // The letters of the solution, but shuffled, e.g. [\"L\", \"C\", \"U\"]\n todaysClue: GamePlacementClue | null; // The clue for user to find the letter, e.g. related to {todaysPlacement}\n todaysLetter: string | null; // The letter the user has to find today, e.g. \"C\"\n todaysPlacement: GamePlacement | null; // The screen where the user has to find the clue, e.g. \"HomeScreen\"\n };\n};\n","export enum EnumGameType {\n DAILY_CLUE = \"dailyClue\",\n MINI_QUIZ = \"miniQuiz\",\n ODD_ONE_OUT = \"oddOneOut\",\n}\n\nexport type GameDate = {\n startDate: Date;\n endDate: Date;\n};\n\nexport const gameTypeToDisplayName: Record<EnumGameType, string> = {\n [EnumGameType.DAILY_CLUE]: \"Daily Clue\",\n [EnumGameType.MINI_QUIZ]: \"Mini Quiz\",\n [EnumGameType.ODD_ONE_OUT]: \"Odd One Out\",\n};\n\nexport type GlobalGameData = {\n points: number;\n // User has found the clue 3 days in a row, this is incrementing if the user finds the clue and decrements if user misses a day\n streak: number;\n};\n","import { EnumResourceType } from \"src/enums\";\n\nimport {\n CreateFormData,\n LocationType,\n OwnerType,\n PromoCodeType,\n SocialMediaType,\n} from \"./global\";\nimport { UserFormData } from \"./user\";\n\nexport enum EnumAffiliateParticipantType {\n INDIVIDUAL = \"INDIVIDUAL\",\n SOLE_TRADER = \"SOLE_TRADER\",\n COMPANY = \"COMPANY\",\n}\n\nexport type AffiliateContactDetails = {\n mobilePhone: string;\n};\n\nexport type AffiliateBankAccountDetailsType = {\n accountHolderName: string;\n accountNumber: string;\n};\n\nexport type AffiliateUserDefaultFields = Pick<\n UserFormData,\n \"email\" | \"firstName\" | \"lastName\" | \"termsAgreement\"\n>;\n\nexport type AffiliateDetailsType = AffiliateUserDefaultFields & {\n bankAccountDetails: AffiliateBankAccountDetailsType;\n contactDetails: AffiliateContactDetails;\n irdNumber: string;\n location: LocationType;\n participantType: EnumAffiliateParticipantType;\n socialMedia: SocialMediaType[] | null;\n};\n\nexport enum EnumAffiliateRewardType {\n ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS = \"ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS\",\n ACTIVE_VENDOR_BONUS_REWARD = \"ACTIVE_VENDOR_BONUS_REWARD\",\n ACTIVE_VENDOR_PRO_SUBSCRIPTION = \"ACTIVE_VENDOR_PRO_SUBSCRIPTION\",\n ACTIVE_VENDOR_STANDARD_SUBSCRIPTION = \"ACTIVE_VENDOR_STANDARD_SUBSCRIPTION\",\n NEW_EVENT_REGISTRATION = \"NEW_EVENT_REGISTRATION\",\n NEW_VENDOR_REGISTRATION = \"NEW_VENDOR_REGISTRATION\",\n}\n\nexport type AffiliateRewardType = {\n createdAt: Date;\n redeemedAt: Date | null;\n rewardDescription: string;\n rewardType: EnumAffiliateRewardType;\n rewardValue: number;\n};\n\nexport type AffiliateResourceType = {\n resourceActive: boolean;\n resourceDeletedAt: Date | null;\n resourceId: string;\n resourceName: string;\n resourceOwner: OwnerType;\n resourceType: EnumResourceType;\n rewards: AffiliateRewardType[];\n};\n\nexport type RedeemHistoryType = {\n paidAt?: Date | null;\n redeemedAt: Date;\n rewardValue: number;\n};\n\nexport interface AffiliateType {\n _id: string;\n active: boolean;\n approvedAt?: Date | null;\n affiliateBonusRewards?: AffiliateRewardType[] | null;\n affiliateCode: PromoCodeType | null;\n affiliateDetails: AffiliateDetailsType | null;\n affiliateResources: AffiliateResourceType[];\n createdAt: Date;\n deletedAt: Date | null;\n overallPoints: number;\n owner: OwnerType;\n redeemHistory?: RedeemHistoryType[] | null;\n updatedAt: Date | null;\n}\n\nexport type AffiliateFormData = Omit<\n AffiliateDetailsType,\n \"email\" | \"firstName\" | \"lastName\"\n>;\n\nexport type CreateAffiliateFormData = CreateFormData<AffiliateFormData>;\n"],"mappings":"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","names":["EnumVerificationType","EnumAdShowOn","EnumAdStatus","EnumAdType","EnumAdStyle","EnumActivity","EnumPostType","EnumPostContentType","EnumGameStatus","EnumGameType","EnumAffiliateParticipantType","EnumAffiliateRewardType"]}
@@ -1,20 +1,97 @@
1
+ import {
2
+ dateFormat,
3
+ formatDate,
4
+ isIsoDateString,
5
+ mapArrayToOptions,
6
+ nzStartOfDay,
7
+ sortDatesChronologically,
8
+ stripOverlaySubtitleSpecialChars
9
+ } from "./chunk-SD42WIMV.mjs";
1
10
  import {
2
11
  PROMO_CODE_PREFIX,
3
12
  gameScreenIdentifierList
4
- } from "./chunk-MVQ3CFQR.mjs";
13
+ } from "./chunk-ILILH7E2.mjs";
14
+ import {
15
+ isTransientNetworkError
16
+ } from "./chunk-RAYUJODN.mjs";
5
17
  import {
6
- EnumEventDateStatus,
7
18
  EnumInviteStatus,
8
19
  EnumPaymentMethod,
9
20
  EnumRegions
10
- } from "./chunk-KZTOISPA.mjs";
21
+ } from "./chunk-X3OLM35T.mjs";
11
22
 
12
- // src/utils/date.ts
13
- import dayjs from "dayjs";
14
- import customParseFormat from "dayjs/plugin/customParseFormat.js";
15
- import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
16
- import timezone from "dayjs/plugin/timezone.js";
17
- import utc from "dayjs/plugin/utc.js";
23
+ // src/utils/dailyClueGame.ts
24
+ function createSeededRng(seed) {
25
+ let t = seed >>> 0;
26
+ return function random() {
27
+ t += 1831565813;
28
+ let x = t;
29
+ x = Math.imul(x ^ x >>> 15, x | 1);
30
+ x ^= x + Math.imul(x ^ x >>> 7, x | 61);
31
+ return ((x ^ x >>> 14) >>> 0) / 4294967296;
32
+ };
33
+ }
34
+ function hashStringToNumber(seed) {
35
+ let hash = 2166136261;
36
+ for (let i = 0; i < seed.length; i++) {
37
+ hash ^= seed.codePointAt(i) ?? 0;
38
+ hash = Math.imul(hash, 16777619);
39
+ }
40
+ return hash >>> 0;
41
+ }
42
+ function seededShuffle(array, seed) {
43
+ const rng = createSeededRng(hashStringToNumber(seed));
44
+ const result = [...array];
45
+ for (let i = result.length - 1; i > 0; i--) {
46
+ const j = Math.floor(rng() * (i + 1));
47
+ [result[i], result[j]] = [result[j], result[i]];
48
+ }
49
+ return result;
50
+ }
51
+ function getDayIndex(start, today) {
52
+ return today.diff(start, "day");
53
+ }
54
+ function computeDailyClueState(dailyClue) {
55
+ const { startDate, endDate } = dailyClue.gameFields.gameDate;
56
+ const { solutionShuffled, collected } = dailyClue.letterInfo;
57
+ const today = nzStartOfDay();
58
+ const start = nzStartOfDay(startDate);
59
+ const end = nzStartOfDay(endDate);
60
+ if (today.isBefore(start)) {
61
+ return null;
62
+ }
63
+ const shuffledPlacements = seededShuffle(
64
+ gameScreenIdentifierList,
65
+ start.toISOString()
66
+ );
67
+ const index = getDayIndex(start, today);
68
+ if (today.isAfter(end)) {
69
+ return {
70
+ todaysClue: null,
71
+ todaysLetter: null,
72
+ todaysPlacement: null
73
+ };
74
+ }
75
+ if (index < 0 || index >= solutionShuffled.length || index >= shuffledPlacements.length) {
76
+ return null;
77
+ }
78
+ const letterToday = solutionShuffled[index];
79
+ const placement = shuffledPlacements[index];
80
+ if (!letterToday || !placement) return null;
81
+ const alreadyCollectedToday = (collected ?? []).includes(letterToday);
82
+ if (alreadyCollectedToday) {
83
+ return {
84
+ todaysClue: null,
85
+ todaysLetter: null,
86
+ todaysPlacement: null
87
+ };
88
+ }
89
+ return {
90
+ todaysClue: placement.clue,
91
+ todaysLetter: letterToday,
92
+ todaysPlacement: placement.id
93
+ };
94
+ }
18
95
 
19
96
  // src/utils/utils.ts
20
97
  var removeTypename = (obj) => {
@@ -40,12 +117,9 @@ var removeTypename = (obj) => {
40
117
  return obj;
41
118
  };
42
119
  var truncateText = (text, maxLength = 30) => {
43
- return text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
120
+ const result = stripOverlaySubtitleSpecialChars(text);
121
+ return result.length > maxLength ? result.substring(0, maxLength) + "..." : result;
44
122
  };
45
- var mapArrayToOptions = (items) => items.map((item) => ({
46
- label: item,
47
- value: item
48
- }));
49
123
  var capitalizeFirstLetter = (str) => {
50
124
  return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
51
125
  };
@@ -62,10 +136,8 @@ var paymentMethodOptions = mapArrayToOptions(
62
136
  Object.values(EnumPaymentMethod)
63
137
  );
64
138
  function normalizeUrl(url) {
65
- if (!url.startsWith("http://") && !url.startsWith("https://")) {
66
- return `https://${url}`;
67
- }
68
- return url;
139
+ const withProtocol = !url.startsWith("http://") && !url.startsWith("https://") ? `https://${url}` : url;
140
+ return withProtocol.replace(/\/+$/, "");
69
141
  }
70
142
  var licenseNiceNames = {
71
143
  ["pro_event" /* PRO_EVENT */]: "Pro Event",
@@ -74,7 +146,9 @@ var licenseNiceNames = {
74
146
  ["standard_vendor" /* STANDARD_VENDOR */]: "Standard Stallholder",
75
147
  ["pro_plus_event" /* PRO_PLUS_EVENT */]: "Pro+Ads Event",
76
148
  ["pro_plus_vendor" /* PRO_PLUS_VENDOR */]: "Pro+Ads Stallholder",
77
- ["standard_partner" /* STANDARD_PARTNER */]: "Partner"
149
+ ["standard_partner" /* STANDARD_PARTNER */]: "Partner",
150
+ ["standard_affiliate" /* STANDARD_AFFILIATE */]: "Affiliate",
151
+ ["standard_school" /* STANDARD_SCHOOL */]: "School"
78
152
  };
79
153
  var cluemartSocialMedia = [
80
154
  {
@@ -120,184 +194,14 @@ var PostTypeLabels = {
120
194
  };
121
195
  var CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;
122
196
  var CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;
123
-
124
- // src/utils/date.ts
125
- var dateFormat = "DD-MM-YYYY";
126
- var timeFormat = "HH:mm";
127
- dayjs.extend(customParseFormat);
128
- dayjs.extend(utc);
129
- dayjs.extend(timezone);
130
- dayjs.extend(isSameOrAfter);
131
- var NZ_TZ = "Pacific/Auckland";
132
- function toNZTime(date) {
133
- return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);
134
- }
135
- function nzStartOfDay(input) {
136
- if (input == null) {
137
- return dayjs().tz(NZ_TZ).startOf("day");
138
- }
139
- return dayjs.tz(input, NZ_TZ).startOf("day");
140
- }
141
- var formatDate = (dateStr, display = "datetime", timeStr) => {
142
- const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
143
- const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
144
- const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
145
- const formattedTime = dateTime.format("h:mm a");
146
- switch (display) {
147
- case "date":
148
- return formattedDate;
149
- case "time":
150
- return formattedTime;
151
- case "datetime":
152
- return `${formattedDate} at ${formattedTime}`;
153
- default:
154
- return formattedDate;
155
- }
156
- };
157
- var getCurrentAndFutureDates = (dates) => {
158
- const now = dayjs();
159
- return dates.filter((dateObj) => {
160
- const dateTime = dayjs(
161
- `${dateObj.startDate} ${dateObj.startTime}`,
162
- `${dateFormat} ${timeFormat}`
163
- );
164
- return dateTime.isSameOrAfter(now);
165
- });
166
- };
167
- var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
168
- const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
169
- const dateTime = dayjs(
170
- `${date.startDate} ${date.startTime}`,
171
- `${dateFormat} ${timeFormat}`
172
- );
173
- return dateTime.isSameOrAfter(threshold);
174
- };
175
- var formatTimestamp = (timestamp) => {
176
- const formattedDate = toNZTime(timestamp).format(dateFormat);
177
- return formatDate(formattedDate, "date");
178
- };
179
- var isIsoDateString = (value) => {
180
- return typeof value === "string" && !Number.isNaN(Date.parse(value));
181
- };
182
- function sortDatesChronologically(dates) {
183
- if (!dates?.length) {
184
- return [];
185
- }
186
- return [...dates].sort((a, b) => {
187
- const dateTimeFormat = `${dateFormat} ${timeFormat}`;
188
- const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);
189
- const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);
190
- return dateA.valueOf() - dateB.valueOf();
191
- });
192
- }
193
- var futureTimePeriods = mapArrayToOptions(
194
- Object.values(EnumEventDateStatus)
195
- ).filter(
196
- (period) => period.value !== "Starting_Soon" /* STARTING_SOON */ && period.value !== "Canceled" /* CANCELED */ && period.value !== "Rescheduled" /* RE_SCHEDULED */ && period.value !== "Started" /* STARTED */ && period.value !== "Ended" /* ENDED */ && period.value !== "Invalid" /* INVALID */
197
- ).map((period) => ({
198
- label: period.value.replaceAll("_", " "),
199
- value: period.value
200
- }));
201
-
202
- // src/utils/dailyClueGame.ts
203
- function createSeededRng(seed) {
204
- let t = seed >>> 0;
205
- return function random() {
206
- t += 1831565813;
207
- let x = t;
208
- x = Math.imul(x ^ x >>> 15, x | 1);
209
- x ^= x + Math.imul(x ^ x >>> 7, x | 61);
210
- return ((x ^ x >>> 14) >>> 0) / 4294967296;
211
- };
212
- }
213
- function hashStringToNumber(seed) {
214
- let hash = 2166136261;
215
- for (let i = 0; i < seed.length; i++) {
216
- hash ^= seed.codePointAt(i) ?? 0;
217
- hash = Math.imul(hash, 16777619);
218
- }
219
- return hash >>> 0;
220
- }
221
- function seededShuffle(array, seed) {
222
- const rng = createSeededRng(hashStringToNumber(seed));
223
- const result = [...array];
224
- for (let i = result.length - 1; i > 0; i--) {
225
- const j = Math.floor(rng() * (i + 1));
226
- [result[i], result[j]] = [result[j], result[i]];
227
- }
228
- return result;
229
- }
230
- function getDayIndex(start, today) {
231
- return today.diff(start, "day");
232
- }
233
- function computeDailyClueState(dailyClue) {
234
- const { startDate, endDate } = dailyClue.gameFields.gameDate;
235
- const { solutionShuffled, collected } = dailyClue.letterInfo;
236
- const today = nzStartOfDay();
237
- const start = nzStartOfDay(startDate);
238
- const end = nzStartOfDay(endDate);
239
- if (today.isBefore(start)) {
240
- return null;
241
- }
242
- const shuffledPlacements = seededShuffle(
243
- gameScreenIdentifierList,
244
- start.toISOString()
245
- );
246
- const index = getDayIndex(start, today);
247
- if (today.isAfter(end)) {
248
- return {
249
- todaysClue: null,
250
- todaysLetter: null,
251
- todaysPlacement: null
252
- };
253
- }
254
- if (index < 0 || index >= solutionShuffled.length || index >= shuffledPlacements.length) {
255
- return null;
256
- }
257
- const letterToday = solutionShuffled[index];
258
- const placement = shuffledPlacements[index];
259
- if (!letterToday || !placement) return null;
260
- const alreadyCollectedToday = (collected ?? []).includes(letterToday);
261
- if (alreadyCollectedToday) {
262
- return {
263
- todaysClue: null,
264
- todaysLetter: null,
265
- todaysPlacement: null
266
- };
267
- }
268
- return {
269
- todaysClue: placement.clue,
270
- todaysLetter: letterToday,
271
- todaysPlacement: placement.id
272
- };
273
- }
274
-
275
- // src/utils/affiliate.ts
276
- var AFFILIATE_REWARDS = {
277
- ["NEW_EVENT_REGISTRATION" /* NEW_EVENT_REGISTRATION */]: {
278
- description: "10 points for new event registration (one-time reward)",
279
- value: 10
280
- },
281
- ["NEW_VENDOR_REGISTRATION" /* NEW_VENDOR_REGISTRATION */]: {
282
- description: "5 points for new vendor registration (one-time reward)",
283
- value: 5
284
- },
285
- ["NEW_PARTNER_REGISTRATION" /* NEW_PARTNER_REGISTRATION */]: {
286
- description: "",
287
- value: 0
288
- }
289
- };
290
- function createAffiliateReward(rewardType, createdAt) {
291
- const reward = AFFILIATE_REWARDS[rewardType];
292
- return {
293
- createdAt,
294
- deletedAt: null,
295
- redeemedAt: null,
296
- rewardDescription: reward.description,
297
- rewardType,
298
- rewardValue: reward.value,
299
- updatedAt: null
300
- };
197
+ function formatNZBankAccount(input) {
198
+ const digitsOnly = input.replaceAll(/\D/g, "");
199
+ const parts = [];
200
+ if (digitsOnly.length > 0) parts.push(digitsOnly.slice(0, 2));
201
+ if (digitsOnly.length > 2) parts.push(digitsOnly.slice(2, 6));
202
+ if (digitsOnly.length > 6) parts.push(digitsOnly.slice(6, 13));
203
+ if (digitsOnly.length > 13) parts.push(digitsOnly.slice(13, 15));
204
+ return parts.join("-");
301
205
  }
302
206
 
303
207
  // src/utils/resourceImage.ts
@@ -351,18 +255,18 @@ function filterEventsByDateStatusPeriod(events, period) {
351
255
  }
352
256
 
353
257
  // src/calendar/eventCalendar.ts
354
- import dayjs2 from "dayjs";
258
+ import dayjs from "dayjs";
355
259
  var KNOWN_EVENT_SCHEDULE_STATUSES = /* @__PURE__ */ new Set([
356
260
  "Started" /* STARTED */,
357
261
  "Starting_Soon" /* STARTING_SOON */,
358
262
  "Ended" /* ENDED */
359
263
  ]);
360
264
  function toCalendarIsoDate(startDate) {
361
- const formatted = dayjs2(startDate, dateFormat).format("YYYY-MM-DD");
362
- return dayjs2(formatted, "YYYY-MM-DD", true).isValid() ? formatted : null;
265
+ const formatted = dayjs(startDate, dateFormat).format("YYYY-MM-DD");
266
+ return dayjs(formatted, "YYYY-MM-DD", true).isValid() ? formatted : null;
363
267
  }
364
268
  function fromCalendarIsoDate(isoDate) {
365
- return dayjs2(isoDate, "YYYY-MM-DD").format(dateFormat);
269
+ return dayjs(isoDate, "YYYY-MM-DD").format(dateFormat);
366
270
  }
367
271
  function getEventCalendarIsoDates(dateTimes) {
368
272
  return dateTimes?.map((dateTime) => toCalendarIsoDate(dateTime.startDate)).filter((date) => Boolean(date)) ?? [];
@@ -1584,10 +1488,139 @@ function getVendorEventsEmptyMessage() {
1584
1488
  return "No events found.";
1585
1489
  }
1586
1490
 
1491
+ // src/utils/affiliate.ts
1492
+ var AFFILIATE_PARTICIPANT_TYPE_LABELS = {
1493
+ ["INDIVIDUAL" /* INDIVIDUAL */]: "Individual",
1494
+ ["SOLE_TRADER" /* SOLE_TRADER */]: "Sole Trader",
1495
+ ["COMPANY" /* COMPANY */]: "Company"
1496
+ };
1497
+ var AFFILIATE_REWARDS = {
1498
+ ["NEW_EVENT_REGISTRATION" /* NEW_EVENT_REGISTRATION */]: {
1499
+ description: "10 points for new event registration (one-time reward)",
1500
+ value: 10
1501
+ },
1502
+ ["NEW_VENDOR_REGISTRATION" /* NEW_VENDOR_REGISTRATION */]: {
1503
+ description: "5 points for new vendor registration (one-time reward)",
1504
+ value: 5
1505
+ },
1506
+ ["ACTIVE_VENDOR_PRO_SUBSCRIPTION" /* ACTIVE_VENDOR_PRO_SUBSCRIPTION */]: {
1507
+ description: "3 points for active vendor pro subscription (monthly reward)",
1508
+ value: 3
1509
+ },
1510
+ ["ACTIVE_VENDOR_STANDARD_SUBSCRIPTION" /* ACTIVE_VENDOR_STANDARD_SUBSCRIPTION */]: {
1511
+ description: "1 point for active vendor standard subscription (monthly reward)",
1512
+ value: 1
1513
+ },
1514
+ ["ACTIVE_VENDOR_BONUS_REWARD" /* ACTIVE_VENDOR_BONUS_REWARD */]: {
1515
+ description: "5 bonus points for every 10th active vendor (one-time reward)",
1516
+ value: 5
1517
+ },
1518
+ ["ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS" /* ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS */]: {
1519
+ description: "40 points for active event with vendor registrations (one-time reward)",
1520
+ value: 40
1521
+ }
1522
+ };
1523
+ function createAffiliateReward(rewardType, createdAt) {
1524
+ const reward = AFFILIATE_REWARDS[rewardType];
1525
+ return {
1526
+ createdAt,
1527
+ redeemedAt: null,
1528
+ rewardDescription: reward.description,
1529
+ rewardType,
1530
+ rewardValue: reward.value
1531
+ };
1532
+ }
1533
+
1534
+ // src/utils/irdNumber.ts
1535
+ var PRIMARY_WEIGHTS = [3, 2, 7, 6, 5, 4, 3, 2];
1536
+ var SECONDARY_WEIGHTS = [7, 4, 3, 2, 5, 2, 7, 6];
1537
+ var IRD_MIN = 1e7;
1538
+ var IRD_MAX = 2e8;
1539
+ function calculateCheckDigit(baseDigits, weights) {
1540
+ const sum = [...baseDigits].reduce(
1541
+ (acc, digit, index) => acc + Number(digit) * weights[index],
1542
+ 0
1543
+ );
1544
+ const remainder = sum % 11;
1545
+ return remainder === 0 ? 0 : 11 - remainder;
1546
+ }
1547
+ function normalizeIrdNumber(value) {
1548
+ return value.replace(/\D/g, "");
1549
+ }
1550
+ function formatIrdNumber(input) {
1551
+ const digitsOnly = normalizeIrdNumber(input).slice(0, 9);
1552
+ const parts = [];
1553
+ if (digitsOnly.length > 0) parts.push(digitsOnly.slice(0, 3));
1554
+ if (digitsOnly.length > 3) parts.push(digitsOnly.slice(3, 6));
1555
+ if (digitsOnly.length > 6) parts.push(digitsOnly.slice(6, 9));
1556
+ return parts.join("-");
1557
+ }
1558
+ function isValidIrdNumber(value) {
1559
+ const digits = normalizeIrdNumber(value);
1560
+ if (!/^\d{8,9}$/.test(digits)) {
1561
+ return false;
1562
+ }
1563
+ const ird = Number(digits);
1564
+ if (ird < IRD_MIN || ird > IRD_MAX) {
1565
+ return false;
1566
+ }
1567
+ const padded = digits.padStart(9, "0");
1568
+ const baseDigits = padded.slice(0, -1);
1569
+ const checkDigit = Number(padded.slice(-1));
1570
+ let calculated = calculateCheckDigit(baseDigits, PRIMARY_WEIGHTS);
1571
+ if (calculated === 10) {
1572
+ calculated = calculateCheckDigit(baseDigits, SECONDARY_WEIGHTS);
1573
+ if (calculated === 10) {
1574
+ return false;
1575
+ }
1576
+ }
1577
+ return calculated === checkDigit;
1578
+ }
1579
+
1580
+ // src/utils/toUserFacingErrorMessage.ts
1581
+ var DEFAULT_USER_FACING_ERROR = "Something went wrong. Please try again.";
1582
+ var NETWORK_USER_FACING_ERROR = "Unable to connect. Please check your internet connection and try again.";
1583
+ var INTERNAL_ERROR_PATTERNS = [
1584
+ /connection\s*<monitor>/i,
1585
+ /\bmongo/i,
1586
+ /\b\d{1,3}(?:\.\d{1,3}){3}(?::\d+)?\b/,
1587
+ /\beconn(?:refused|reset|aborted)\b/i,
1588
+ /\betimedout\b/i,
1589
+ /\benotfound\b/i,
1590
+ /\bsocket hang up\b/i,
1591
+ /\binternal server error\b/i,
1592
+ /received status code 5\d\d/i,
1593
+ /\bat\s+\S+\s+\([^)]+:\d+:\d+\)/
1594
+ ];
1595
+ function isInternalErrorMessage(message) {
1596
+ return INTERNAL_ERROR_PATTERNS.some((pattern) => pattern.test(message));
1597
+ }
1598
+ function toUserFacingErrorMessage(error, fallback = DEFAULT_USER_FACING_ERROR) {
1599
+ const message = (error ?? "").trim();
1600
+ if (!message) return fallback;
1601
+ if (isTransientNetworkError(message)) {
1602
+ return NETWORK_USER_FACING_ERROR;
1603
+ }
1604
+ if (isInternalErrorMessage(message)) {
1605
+ return fallback;
1606
+ }
1607
+ return message;
1608
+ }
1609
+ function getErrorMessage(error, fallback = DEFAULT_USER_FACING_ERROR) {
1610
+ let raw;
1611
+ if (error instanceof Error) {
1612
+ raw = error.message;
1613
+ } else if (typeof error === "string") {
1614
+ raw = error;
1615
+ }
1616
+ return toUserFacingErrorMessage(raw, fallback);
1617
+ }
1618
+
1587
1619
  export {
1620
+ seededShuffle,
1621
+ computeDailyClueState,
1588
1622
  removeTypename,
1589
1623
  truncateText,
1590
- mapArrayToOptions,
1591
1624
  capitalizeFirstLetter,
1592
1625
  statusOptions,
1593
1626
  availableRegionTypes,
@@ -1605,21 +1638,7 @@ export {
1605
1638
  PostTypeLabels,
1606
1639
  CM_SCHOOL_PROMO_CODE,
1607
1640
  CM_AFFILIATE_PROMO_CODE,
1608
- dateFormat,
1609
- timeFormat,
1610
- toNZTime,
1611
- nzStartOfDay,
1612
- formatDate,
1613
- getCurrentAndFutureDates,
1614
- isFutureDatesBeforeThreshold,
1615
- formatTimestamp,
1616
- isIsoDateString,
1617
- sortDatesChronologically,
1618
- futureTimePeriods,
1619
- seededShuffle,
1620
- computeDailyClueState,
1621
- AFFILIATE_REWARDS,
1622
- createAffiliateReward,
1641
+ formatNZBankAccount,
1623
1642
  resolveResourceImageActive,
1624
1643
  normalizeResourceImage,
1625
1644
  isResourceImageActive,
@@ -1664,6 +1683,17 @@ export {
1664
1683
  collectVendorEventRelationDateTimes,
1665
1684
  getVendorEventRelationStartDates,
1666
1685
  getVendorEventRelationDateOptions,
1667
- getVendorEventsEmptyMessage
1686
+ getVendorEventsEmptyMessage,
1687
+ AFFILIATE_PARTICIPANT_TYPE_LABELS,
1688
+ AFFILIATE_REWARDS,
1689
+ createAffiliateReward,
1690
+ normalizeIrdNumber,
1691
+ formatIrdNumber,
1692
+ isValidIrdNumber,
1693
+ DEFAULT_USER_FACING_ERROR,
1694
+ NETWORK_USER_FACING_ERROR,
1695
+ isInternalErrorMessage,
1696
+ toUserFacingErrorMessage,
1697
+ getErrorMessage
1668
1698
  };
1669
- //# sourceMappingURL=chunk-TAECMXM4.mjs.map
1699
+ //# sourceMappingURL=chunk-LBEJECG3.mjs.map