@timardex/cluemart-shared 1.7.91 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ad-DzAxJcWT.d.ts → ad-C7jlZyUd.d.ts} +2 -2
- package/dist/{ad-DjHlreUH.d.mts → ad-tNoTBv3n.d.mts} +2 -2
- package/dist/{affiliate-BpjRWPUA.d.mts → affiliate-BL1ZN-4t.d.mts} +2 -2
- package/dist/{affiliate-BVLyYY70.d.ts → affiliate-DStyY84o.d.ts} +2 -2
- package/dist/auth/index.cjs +11 -8
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.mts +3 -3
- package/dist/auth/index.d.ts +3 -3
- package/dist/auth/index.mjs +1 -1
- package/dist/chunk-7DQBUZXY.mjs +41 -0
- package/dist/chunk-7DQBUZXY.mjs.map +1 -0
- package/dist/{chunk-STNE7PMX.mjs → chunk-D45RNLV2.mjs} +1 -1
- package/dist/chunk-D45RNLV2.mjs.map +1 -0
- package/dist/{chunk-ZW4M5EGZ.mjs → chunk-GRP7XQNB.mjs} +119 -71
- package/dist/chunk-GRP7XQNB.mjs.map +1 -0
- package/dist/{chunk-PSKWWPLY.mjs → chunk-OUWKLNHZ.mjs} +14 -23
- package/dist/chunk-OUWKLNHZ.mjs.map +1 -0
- package/dist/{chunk-3ZPHXVUT.mjs → chunk-XED54CPG.mjs} +2 -2
- package/dist/{contactUs-TEAbhwp9.d.mts → contactUs-BYm-iDIH.d.mts} +1 -1
- package/dist/{contactUs-Dm-0Qua3.d.ts → contactUs-_BHRXUrv.d.ts} +1 -1
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +1 -1
- package/dist/formFields/index.d.ts +1 -1
- package/dist/formFields/index.mjs +3 -2
- package/dist/{global-CDYmiqmd.d.mts → global-C7-KDYqg.d.mts} +6 -3
- package/dist/{global-DTXnm4Ok.d.ts → global-D_et_d2Y.d.ts} +6 -3
- package/dist/graphql/index.cjs +351 -275
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +54 -55
- package/dist/graphql/index.d.ts +54 -55
- package/dist/graphql/index.mjs +17 -14
- package/dist/hooks/index.cjs +191 -184
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +5 -5
- package/dist/hooks/index.d.ts +5 -5
- package/dist/hooks/index.mjs +5 -4
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +360 -275
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +71 -53
- package/dist/index.d.ts +71 -53
- package/dist/index.mjs +319 -239
- package/dist/index.mjs.map +1 -1
- package/dist/map/index.d.mts +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/{resourceActivities-BDp-h5yH.d.mts → resourceActivities-BJAI4jf-.d.mts} +2 -2
- package/dist/{resourceActivities-C14qOL7_.d.ts → resourceActivities-BW648M1v.d.ts} +2 -2
- package/dist/sharing/index.d.mts +1 -1
- package/dist/sharing/index.d.ts +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +7 -7
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.mjs +1 -1
- package/dist/{user-DCpVFB6K.d.mts → user-BA7TT2yB.d.mts} +1 -1
- package/dist/{user-C1yYa8oa.d.ts → user-nHjaLZoG.d.ts} +1 -1
- package/dist/utils/index.cjs +42 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +20 -4
- package/dist/utils/index.d.ts +20 -4
- package/dist/utils/index.mjs +12 -2
- package/package.json +4 -1
- package/dist/chunk-PSKWWPLY.mjs.map +0 -1
- package/dist/chunk-STNE7PMX.mjs.map +0 -1
- package/dist/chunk-ZW4M5EGZ.mjs.map +0 -1
- /package/dist/{chunk-3ZPHXVUT.mjs.map → chunk-XED54CPG.mjs.map} +0 -0
|
@@ -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","../src/types/coupon/index.ts"],"sourcesContent":["import {\n CreateFormData,\n EnumOSPlatform,\n EnumResourceType,\n PromoCodeType,\n TermsAgreement,\n} from \"src\";\n\nimport { MutationResponse } from \"./global\";\nimport { SafeUserType, UserFormData } 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 = Pick<\n UserFormData,\n | \"email\"\n | \"firstName\"\n | \"lastName\"\n | \"nickName\"\n | \"platform\"\n | \"preferredRegion\"\n | \"termsAgreement\"\n> & {\n interests: EnumResourceType[];\n password: string;\n promoCode?: PromoCodeType | 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: Date;\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 sharePublic?: SocialShareResourceType | 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\n/** Offset-pagination input for plain list fields (events/vendors/partners/posts/users). */\nexport interface PaginationOptions {\n limit?: number;\n offset?: number;\n}\n\nexport interface UseGetResourcesByRegionOptions extends PaginationOptions {\n onlyClaimed?: boolean;\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\" | \"userId\">;\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 CLUE_BITES = \"clue_bites\",\n //CLUE_GUIDES_FOR_ORGANISERS = \"clue_guides_for_organisers\",\n //CLUE_GUIDES_FOR_VENDORS = \"clue_guides_for_vendors\",\n MARKET_FACES = \"market_faces\",\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 nickName: string;\n overallPoints: number;\n userId: string;\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 conversations happen without speaking.\",\n id: \"chat\",\n match: \"/chat\",\n },\n {\n clue: \"Where you can find your loyalties.\",\n id: \"coupons\",\n match: \"/profile/account/coupons\",\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: \"/profile/account/games\",\n },\n {\n clue: \"Your starting point for everything.\",\n id: \"home\",\n match: \"/home\",\n },\n {\n clue: \"Where the app whispers what you shouldn’t miss.\",\n id: \"notifications\",\n match: \"/notifications\",\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: \"Where your actions turn into a timeline.\",\n id: \"activities\",\n match: \"/profile/account/favourites\",\n },\n {\n clue: \"The place to redefine who you are.\",\n id: \"edit-profile\",\n match: \"/profile/account\",\n },\n {\n clue: \"Your identity, on display.\",\n id: \"profile\",\n match: \"/profile\",\n },\n {\n clue: \"Where you can redeem your rewards.\",\n id: \"rewards\",\n match: \"/profile/account/rewards\",\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: \"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 {\n clue: \"Where you fine-tune your experience.\",\n id: \"options\",\n match: \"/options\",\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","import { EnumResourceType } from \"../../enums\";\nimport { CreateFormData, OwnerType, ResourceImageType } from \"../global\";\nimport { VendorProductList } from \"../vendor\";\n\nexport type ProductCoupon = {\n couponDocumentId: string;\n couponId: string;\n};\n\nexport enum EnumCouponQualificationType {\n PURCHASE = \"PURCHASE\",\n MARKET_VISIT = \"MARKET_VISIT\",\n MARKET_PASSPORT = \"MARKET_PASSPORT\",\n}\n\nexport type CouponPurchaseOption = {\n buy: number;\n get: number;\n maxRewardCount: number;\n type: EnumCouponQualificationType.PURCHASE;\n unit: string;\n};\n\nexport type CouponMarketVisitOption = {\n type: EnumCouponQualificationType.MARKET_VISIT;\n visits: number;\n};\n\nexport type CouponMarketPassportOption = {\n type: EnumCouponQualificationType.MARKET_PASSPORT;\n visits: number;\n};\n\nexport type CouponOption =\n CouponPurchaseOption | CouponMarketVisitOption | CouponMarketPassportOption;\n\nexport type CouponVendorProduct = {\n couponId: string;\n productId: string;\n vendorId: string;\n\n // Required only for MARKET_PASSPORT: which Vendor coupon contributes\n // progress when scanned.\n vendorCouponId?: string | null;\n};\n\nexport type CouponDefaultsFormData = {\n couponDescription: string;\n couponOption: CouponOption | null;\n couponVendorProducts?: CouponVendorProduct[];\n endDate: Date;\n resourceId: string;\n resourceType: EnumResourceType;\n startDate: Date;\n};\n\nexport type CreateCouponFormData = CreateFormData<CouponDefaultsFormData>;\n\nexport type CouponParticipantUserType = {\n couponCollectedCount: number;\n couponRedeemedAt: Date | null;\n couponRedeemedCount: number;\n couponCycleRedeemed: boolean;\n createdAt: Date;\n updatedAt: Date | null;\n userId: string;\n // Not persisted; resolved on read by `attachCouponDataProducts` from\n // `UserModel` via the participant's `userId`.\n nickName?: string | null;\n};\n\nexport type CouponCodeType = {\n code: string;\n qrCode: ResourceImageType;\n shareableQrCode: ResourceImageType;\n};\n\nexport type CouponDataProductsType = {\n active: boolean | null;\n couponId: string;\n productsList: VendorProductList[];\n vendorId: string;\n vendorLogo: ResourceImageType | null;\n vendorName: string;\n};\n\nexport type CouponDataType = CouponDefaultsFormData & {\n _id: string;\n active: boolean;\n couponCode: CouponCodeType | null;\n createdAt: Date;\n deletedAt: Date | null;\n participantUsers: CouponParticipantUserType[] | null;\n // products are not saved in the database, but are returned by the backend for convenience\n products?: CouponDataProductsType[] | null;\n updatedAt: Date | null;\n};\n\nexport interface CouponType {\n _id: string;\n active: boolean;\n couponData: CouponDataType[] | null;\n createdAt: Date;\n deletedAt: Date | null;\n owner: OwnerType;\n updatedAt: Date | null;\n}\n\nexport enum EnumCouponListType {\n ACTIVE = \"active\",\n OWNED = \"owned\",\n SCANNED = \"scanned\",\n}\n\nexport type CouponTypeList = {\n active: {\n data: CouponType[] | null;\n listName: EnumCouponListType.ACTIVE;\n };\n owned: {\n data: CouponType[] | null;\n listName: EnumCouponListType.OWNED;\n };\n scanned: {\n data: CouponType[] | null;\n listName: EnumCouponListType.SCANNED;\n };\n};\n"],"mappings":";AAWO,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,cAAW;AACX,EAAAA,sBAAA,oBAAiB;AAFP,SAAAA;AAAA,GAAA;;;ACYL,IAAM,oBAAoB;;;ACnB1B,IAAK,eAAL,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AkB;AAHR,SAAAA;AAAA,GAAA;AAmGL,IAAK,qBAAL,kBAAKC,wBAAL;AACL,EAAAA,oBAAA,YAAS;AACT,EAAAA,oBAAA,WAAQ;AACR,EAAAA,oBAAA,aAAU;AAHA,SAAAA;AAAA,GAAA;","names":["EnumVerificationType","EnumAdShowOn","EnumAdStatus","EnumAdType","EnumAdStyle","EnumActivity","EnumPostType","EnumPostContentType","EnumGameStatus","EnumGameType","EnumAffiliateParticipantType","EnumAffiliateRewardType","EnumCouponQualificationType","EnumCouponListType"]}
|
|
@@ -4,14 +4,12 @@ import {
|
|
|
4
4
|
EVENT_INFO,
|
|
5
5
|
EVENT_LIST_ITEM,
|
|
6
6
|
GET_EVENT,
|
|
7
|
-
GET_EVENTS,
|
|
8
7
|
GET_EVENTS_BY_REGION,
|
|
9
8
|
GET_EVENTS_NEAR_ME,
|
|
10
9
|
GET_EVENT_BY_PLACE_ID,
|
|
11
10
|
GET_EVENT_INFO,
|
|
12
11
|
GET_OWNED_EVENT,
|
|
13
12
|
GET_PARTNER,
|
|
14
|
-
GET_PARTNERS,
|
|
15
13
|
GET_PARTNERS_BY_REGION,
|
|
16
14
|
GET_UNREGISTERED_VENDOR,
|
|
17
15
|
GET_UNREGISTERED_VENDORS,
|
|
@@ -22,7 +20,6 @@ import {
|
|
|
22
20
|
GET_USER_PARTNERS,
|
|
23
21
|
GET_USER_VENDORS,
|
|
24
22
|
GET_VENDOR,
|
|
25
|
-
GET_VENDORS,
|
|
26
23
|
GET_VENDORS_BY_REGION,
|
|
27
24
|
GET_VENDOR_INFO,
|
|
28
25
|
LICENCE_FIELDS_FRAGMENT,
|
|
@@ -45,7 +42,12 @@ import {
|
|
|
45
42
|
VENDOR,
|
|
46
43
|
VENDOR_INFO,
|
|
47
44
|
VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT
|
|
48
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-OUWKLNHZ.mjs";
|
|
46
|
+
import {
|
|
47
|
+
DEFAULT_PAGE_SIZE,
|
|
48
|
+
accumulateItems,
|
|
49
|
+
defaultGetId
|
|
50
|
+
} from "./chunk-7DQBUZXY.mjs";
|
|
49
51
|
|
|
50
52
|
// src/graphql/mutations/vendor.ts
|
|
51
53
|
import { gql } from "@apollo/client";
|
|
@@ -333,8 +335,8 @@ var POST_FIELDS_FRAGMENT = gql4`
|
|
|
333
335
|
${SOCIAL_SHARE_RESOURCE_FIELDS_FRAGMENT}
|
|
334
336
|
`;
|
|
335
337
|
var GET_POSTS = gql4`
|
|
336
|
-
query getPosts {
|
|
337
|
-
posts {
|
|
338
|
+
query getPosts($options: PaginationOptions) {
|
|
339
|
+
posts(options: $options) {
|
|
338
340
|
...PostFields
|
|
339
341
|
}
|
|
340
342
|
}
|
|
@@ -349,8 +351,8 @@ var GET_POST = gql4`
|
|
|
349
351
|
${POST_FIELDS_FRAGMENT}
|
|
350
352
|
`;
|
|
351
353
|
var GET_POSTS_BY_TYPE = gql4`
|
|
352
|
-
query getPostsByType($postType: PostTypeEnum
|
|
353
|
-
postsByType(postType: $postType) {
|
|
354
|
+
query getPostsByType($postType: PostTypeEnum!, $options: PaginationOptions) {
|
|
355
|
+
postsByType(postType: $postType, options: $options) {
|
|
354
356
|
...PostFields
|
|
355
357
|
}
|
|
356
358
|
}
|
|
@@ -1081,14 +1083,6 @@ var useUpdateEventInfo = () => {
|
|
|
1081
1083
|
|
|
1082
1084
|
// src/graphql/hooks/event/hooksQuery.ts
|
|
1083
1085
|
import { useQuery as useQuery2 } from "@apollo/client";
|
|
1084
|
-
var useGetEvents = (dateStatus) => {
|
|
1085
|
-
const { loading, error, data, refetch } = useQuery2(GET_EVENTS, {
|
|
1086
|
-
fetchPolicy: "network-only",
|
|
1087
|
-
variables: { dateStatus }
|
|
1088
|
-
});
|
|
1089
|
-
const events = data?.events || [];
|
|
1090
|
-
return { error, events, loading, refetch };
|
|
1091
|
-
};
|
|
1092
1086
|
var useGetEvent = (_id) => {
|
|
1093
1087
|
const { loading, error, data, refetch } = useQuery2(GET_EVENT, {
|
|
1094
1088
|
fetchPolicy: "network-only",
|
|
@@ -1137,10 +1131,10 @@ var useGetEventsByRegion = (region, options, dateStatus, tags) => {
|
|
|
1137
1131
|
refetch
|
|
1138
1132
|
};
|
|
1139
1133
|
};
|
|
1140
|
-
var useSearchEvents = (
|
|
1141
|
-
const normalizedSearch =
|
|
1134
|
+
var useSearchEvents = (search, region, tags, dateStatus) => {
|
|
1135
|
+
const normalizedSearch = search.trim();
|
|
1142
1136
|
const normalizedTags = (tags ?? []).filter(Boolean);
|
|
1143
|
-
const shouldRunQuery = normalizedSearch.length
|
|
1137
|
+
const shouldRunQuery = normalizedSearch.length >= 3 || normalizedTags.length > 0;
|
|
1144
1138
|
const { loading, error, data, refetch } = useQuery2(SEARCH_EVENTS, {
|
|
1145
1139
|
fetchPolicy: "network-only",
|
|
1146
1140
|
skip: !shouldRunQuery,
|
|
@@ -1760,21 +1754,6 @@ var useActivateVendorClaim = () => {
|
|
|
1760
1754
|
|
|
1761
1755
|
// src/graphql/hooks/vendor/hooksQuery.ts
|
|
1762
1756
|
import { useQuery as useQuery5 } from "@apollo/client";
|
|
1763
|
-
var useGetVendors = () => {
|
|
1764
|
-
const { loading, error, data, refetch } = useQuery5(
|
|
1765
|
-
GET_VENDORS,
|
|
1766
|
-
{
|
|
1767
|
-
fetchPolicy: "network-only"
|
|
1768
|
-
}
|
|
1769
|
-
);
|
|
1770
|
-
const vendors = data?.vendors || [];
|
|
1771
|
-
return {
|
|
1772
|
-
error,
|
|
1773
|
-
loading,
|
|
1774
|
-
refetch,
|
|
1775
|
-
vendors
|
|
1776
|
-
};
|
|
1777
|
-
};
|
|
1778
1757
|
var useGetVendor = (_id) => {
|
|
1779
1758
|
const { loading, error, data, refetch } = useQuery5(
|
|
1780
1759
|
GET_VENDOR,
|
|
@@ -1806,10 +1785,11 @@ var useGetVendorsByRegion = (region, options) => {
|
|
|
1806
1785
|
};
|
|
1807
1786
|
};
|
|
1808
1787
|
var useSearchVendors = (search, region) => {
|
|
1788
|
+
const normalizedSearch = search.trim();
|
|
1809
1789
|
const { loading, error, data, refetch } = useQuery5(SEARCH_VENDORS, {
|
|
1810
1790
|
fetchPolicy: "network-only",
|
|
1811
|
-
skip:
|
|
1812
|
-
variables: { region, search }
|
|
1791
|
+
skip: normalizedSearch.length < 3,
|
|
1792
|
+
variables: { region, search: normalizedSearch }
|
|
1813
1793
|
});
|
|
1814
1794
|
const vendorSearch = data?.vendorSearch || [];
|
|
1815
1795
|
return { error, loading, refetch, vendorSearch };
|
|
@@ -2604,18 +2584,6 @@ var useDeletePartner = () => {
|
|
|
2604
2584
|
|
|
2605
2585
|
// src/graphql/hooks/partner/hooksQuery.ts
|
|
2606
2586
|
import { useQuery as useQuery9 } from "@apollo/client";
|
|
2607
|
-
var useGetPartners = () => {
|
|
2608
|
-
const { loading, error, data, refetch } = useQuery9(GET_PARTNERS, {
|
|
2609
|
-
fetchPolicy: "network-only"
|
|
2610
|
-
});
|
|
2611
|
-
const partners = data?.partners || [];
|
|
2612
|
-
return {
|
|
2613
|
-
error,
|
|
2614
|
-
loading,
|
|
2615
|
-
partners,
|
|
2616
|
-
refetch
|
|
2617
|
-
};
|
|
2618
|
-
};
|
|
2619
2587
|
var useGetPartner = (_id) => {
|
|
2620
2588
|
const { loading, error, data, refetch } = useQuery9(
|
|
2621
2589
|
GET_PARTNER,
|
|
@@ -2647,10 +2615,11 @@ var useGetPartnersByRegion = (region, options) => {
|
|
|
2647
2615
|
};
|
|
2648
2616
|
};
|
|
2649
2617
|
var useSearchPartners = (search, region) => {
|
|
2618
|
+
const normalizedSearch = search.trim();
|
|
2650
2619
|
const { loading, error, data, refetch } = useQuery9(SEARCH_PARTNERS, {
|
|
2651
2620
|
fetchPolicy: "network-only",
|
|
2652
|
-
skip:
|
|
2653
|
-
variables: { region, search }
|
|
2621
|
+
skip: normalizedSearch.length < 3,
|
|
2622
|
+
variables: { region, search: normalizedSearch }
|
|
2654
2623
|
});
|
|
2655
2624
|
const partnersSearch = data?.partnersSearch || [];
|
|
2656
2625
|
return { error, loading, partnersSearch, refetch };
|
|
@@ -2717,12 +2686,6 @@ var useDeletePost = () => {
|
|
|
2717
2686
|
|
|
2718
2687
|
// src/graphql/hooks/post/hooksQuery.ts
|
|
2719
2688
|
import { useQuery as useQuery10 } from "@apollo/client";
|
|
2720
|
-
var useGetPosts = () => {
|
|
2721
|
-
const { data, loading, error, refetch } = useQuery10(GET_POSTS, {
|
|
2722
|
-
fetchPolicy: "network-only"
|
|
2723
|
-
});
|
|
2724
|
-
return { error, loading, posts: data?.posts || [], refetch };
|
|
2725
|
-
};
|
|
2726
2689
|
var useGetPost = (_id) => {
|
|
2727
2690
|
const { data, loading, error, refetch } = useQuery10(GET_POST, {
|
|
2728
2691
|
fetchPolicy: "network-only",
|
|
@@ -2731,14 +2694,6 @@ var useGetPost = (_id) => {
|
|
|
2731
2694
|
});
|
|
2732
2695
|
return { error, loading, post: data?.post, refetch };
|
|
2733
2696
|
};
|
|
2734
|
-
var useGetPostsByType = (postType) => {
|
|
2735
|
-
const { data, loading, error, refetch } = useQuery10(GET_POSTS_BY_TYPE, {
|
|
2736
|
-
fetchPolicy: "network-only",
|
|
2737
|
-
skip: !postType,
|
|
2738
|
-
variables: { postType }
|
|
2739
|
-
});
|
|
2740
|
-
return { error, loading, postsByType: data?.postsByType || [], refetch };
|
|
2741
|
-
};
|
|
2742
2697
|
|
|
2743
2698
|
// src/graphql/hooks/appSettings/hooksMutation.ts
|
|
2744
2699
|
import { useMutation as useMutation16 } from "@apollo/client";
|
|
@@ -3942,9 +3897,106 @@ var useGetCoupon = (_id) => {
|
|
|
3942
3897
|
return { coupon, error, loading, refetch };
|
|
3943
3898
|
};
|
|
3944
3899
|
|
|
3900
|
+
// src/graphql/hooks/usePaginatedList.ts
|
|
3901
|
+
import { useQuery as useQuery17 } from "@apollo/client";
|
|
3902
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3903
|
+
function usePaginatedList({
|
|
3904
|
+
document,
|
|
3905
|
+
getItems,
|
|
3906
|
+
variables,
|
|
3907
|
+
skip = false,
|
|
3908
|
+
pageSize = DEFAULT_PAGE_SIZE,
|
|
3909
|
+
getId = defaultGetId
|
|
3910
|
+
}) {
|
|
3911
|
+
if (!Number.isInteger(pageSize) || pageSize <= 0) {
|
|
3912
|
+
throw new Error(
|
|
3913
|
+
`usePaginatedList: pageSize must be a positive integer, received ${String(pageSize)}.`
|
|
3914
|
+
);
|
|
3915
|
+
}
|
|
3916
|
+
const [offset, setOffset] = useState(0);
|
|
3917
|
+
const [items, setItems] = useState([]);
|
|
3918
|
+
const [hasMore, setHasMore] = useState(!skip);
|
|
3919
|
+
const [hasSettled, setHasSettled] = useState(false);
|
|
3920
|
+
const variablesKey = JSON.stringify(variables ?? null);
|
|
3921
|
+
useEffect(() => {
|
|
3922
|
+
setItems([]);
|
|
3923
|
+
setHasMore(!skip);
|
|
3924
|
+
setHasSettled(false);
|
|
3925
|
+
setOffset(0);
|
|
3926
|
+
}, [variablesKey, pageSize, skip]);
|
|
3927
|
+
const { data, loading, error, refetch } = useQuery17(document, {
|
|
3928
|
+
fetchPolicy: "network-only",
|
|
3929
|
+
skip,
|
|
3930
|
+
variables: { ...variables, options: { limit: pageSize + 1, offset } }
|
|
3931
|
+
});
|
|
3932
|
+
const refetchRef = useRef(refetch);
|
|
3933
|
+
refetchRef.current = refetch;
|
|
3934
|
+
const variablesRef = useRef(variables);
|
|
3935
|
+
variablesRef.current = variables;
|
|
3936
|
+
const rawPage = getItems(data);
|
|
3937
|
+
const page = rawPage.length > pageSize ? rawPage.slice(0, pageSize) : rawPage;
|
|
3938
|
+
const hasMorePage = rawPage.length > pageSize;
|
|
3939
|
+
useEffect(() => {
|
|
3940
|
+
if (loading || skip || error) {
|
|
3941
|
+
return;
|
|
3942
|
+
}
|
|
3943
|
+
setItems((prev) => {
|
|
3944
|
+
if (!hasSettled) {
|
|
3945
|
+
if (page.length === 0 && prev.length === 0) {
|
|
3946
|
+
return prev;
|
|
3947
|
+
}
|
|
3948
|
+
return page;
|
|
3949
|
+
}
|
|
3950
|
+
return accumulateItems(prev, page, getId);
|
|
3951
|
+
});
|
|
3952
|
+
setHasSettled(true);
|
|
3953
|
+
setHasMore(hasMorePage);
|
|
3954
|
+
}, [loading, skip, error, page, hasMorePage, hasSettled, pageSize, getId]);
|
|
3955
|
+
const loadMore = useCallback(() => {
|
|
3956
|
+
if (loading || skip) {
|
|
3957
|
+
return;
|
|
3958
|
+
}
|
|
3959
|
+
if (error) {
|
|
3960
|
+
void refetchRef.current();
|
|
3961
|
+
return;
|
|
3962
|
+
}
|
|
3963
|
+
if (!hasSettled) {
|
|
3964
|
+
return;
|
|
3965
|
+
}
|
|
3966
|
+
if (!hasMore) {
|
|
3967
|
+
return;
|
|
3968
|
+
}
|
|
3969
|
+
setOffset(offset + pageSize);
|
|
3970
|
+
}, [loading, skip, error, hasSettled, hasMore, offset, pageSize]);
|
|
3971
|
+
const refresh = useCallback(() => {
|
|
3972
|
+
setItems([]);
|
|
3973
|
+
setHasMore(!skip);
|
|
3974
|
+
setHasSettled(false);
|
|
3975
|
+
setOffset(0);
|
|
3976
|
+
if (skip) {
|
|
3977
|
+
return Promise.resolve();
|
|
3978
|
+
}
|
|
3979
|
+
return refetchRef.current({
|
|
3980
|
+
...variablesRef.current,
|
|
3981
|
+
options: { limit: pageSize + 1, offset: 0 }
|
|
3982
|
+
});
|
|
3983
|
+
}, [pageSize, skip]);
|
|
3984
|
+
return {
|
|
3985
|
+
error,
|
|
3986
|
+
hasMore,
|
|
3987
|
+
items,
|
|
3988
|
+
loading: loading && !hasSettled,
|
|
3989
|
+
loadingMore: loading && hasSettled,
|
|
3990
|
+
loadMore,
|
|
3991
|
+
refresh
|
|
3992
|
+
};
|
|
3993
|
+
}
|
|
3994
|
+
|
|
3945
3995
|
export {
|
|
3946
3996
|
ACTIVATE_VENDOR_CLAIM_MUTATION,
|
|
3997
|
+
GET_POSTS,
|
|
3947
3998
|
GET_POST,
|
|
3999
|
+
GET_POSTS_BY_TYPE,
|
|
3948
4000
|
GET_EVENT_BY_SLUG,
|
|
3949
4001
|
GET_VENDOR_BY_SLUG,
|
|
3950
4002
|
GET_PARTNER_BY_SLUG,
|
|
@@ -3974,7 +4026,6 @@ export {
|
|
|
3974
4026
|
useDeleteEvent,
|
|
3975
4027
|
useCreateEventInfo,
|
|
3976
4028
|
useUpdateEventInfo,
|
|
3977
|
-
useGetEvents,
|
|
3978
4029
|
useGetEvent,
|
|
3979
4030
|
useGetOwnedEvent,
|
|
3980
4031
|
useGetEventByPlaceId,
|
|
@@ -4011,7 +4062,6 @@ export {
|
|
|
4011
4062
|
useDeleteUnregisteredVendor,
|
|
4012
4063
|
useUnlinkUnregisteredVendorByInviterId,
|
|
4013
4064
|
useActivateVendorClaim,
|
|
4014
|
-
useGetVendors,
|
|
4015
4065
|
useGetVendor,
|
|
4016
4066
|
useGetVendorsByRegion,
|
|
4017
4067
|
useSearchVendors,
|
|
@@ -4050,16 +4100,13 @@ export {
|
|
|
4050
4100
|
useCreatePartner,
|
|
4051
4101
|
useUpdatePartner,
|
|
4052
4102
|
useDeletePartner,
|
|
4053
|
-
useGetPartners,
|
|
4054
4103
|
useGetPartner,
|
|
4055
4104
|
useGetPartnersByRegion,
|
|
4056
4105
|
useSearchPartners,
|
|
4057
4106
|
useCreatePost,
|
|
4058
4107
|
useUpdatePost,
|
|
4059
4108
|
useDeletePost,
|
|
4060
|
-
useGetPosts,
|
|
4061
4109
|
useGetPost,
|
|
4062
|
-
useGetPostsByType,
|
|
4063
4110
|
useUpdateAppSettings,
|
|
4064
4111
|
useCrawlGoogleMarkets,
|
|
4065
4112
|
useUpdateGoogleImportedMarkets,
|
|
@@ -4094,6 +4141,7 @@ export {
|
|
|
4094
4141
|
useScanCoupon,
|
|
4095
4142
|
useRewardCoupon,
|
|
4096
4143
|
useGetCoupons,
|
|
4097
|
-
useGetCoupon
|
|
4144
|
+
useGetCoupon,
|
|
4145
|
+
usePaginatedList
|
|
4098
4146
|
};
|
|
4099
|
-
//# sourceMappingURL=chunk-
|
|
4147
|
+
//# sourceMappingURL=chunk-GRP7XQNB.mjs.map
|