import type { UserStatus } from "./types"; const host = ""; export const apiHost = "https://api-web.aura.wit.life"; const siteHost = "https://aura.wit.life"; const prefix = "api/v1"; const routes = { client: { root: () => [host, ""].join("/"), birthday: () => [host, "birthday"].join("/"), didYouKnow: () => [host, "did-you-know"].join("/"), freePeriodInfo: () => [host, "free-period"].join("/"), birthtime: () => [host, "birthtime"].join("/"), emailEnter: () => [host, "email"].join("/"), authResult: () => [host, "auth", "result"].join("/"), auth: () => [host, "auth"].join("/"), subscription: () => [host, "subscription"].join("/"), createProfile: () => [host, "profile", "create"].join("/"), attention: () => [host, "attention"].join("/"), feedback: () => [host, "feedback"].join("/"), paymentMethod: () => [host, "payment", "method"].join("/"), paymentResult: () => [host, "payment", "result"].join("/"), paymentSuccess: () => [host, "payment", "success"].join("/"), paymentFail: () => [host, "payment", "fail"].join("/"), paymentStripe: () => [host, "payment", "stripe"].join("/"), wallpaper: () => [host, "wallpaper"].join("/"), static: () => [host, "static", ":typeId"].join("/"), legal: (type: string) => [host, "static", type].join("/"), compatibility: () => [host, "compatibility"].join("/"), compatibilityResult: () => [host, "compatibility", "result"].join("/"), breath: () => [host, "breath"].join("/"), priceList: () => [host, "price-list"].join("/"), home: () => [host, "home"].join("/"), breathResult: () => [host, "breath", "result"].join("/"), magicBall: () => [host, "magic-ball"].join("/"), horoscopeBestiesResult: () => [host, "horoscope-besties"].join("/"), predictionMoonResult: () => [host, "prediction-moon"].join("/"), myHoroscopeResult: () => [host, "my-horoscope"].join("/"), thermalResult: () => [host, "thermal"].join("/"), moonPhaseTracker: () => [host, "moon-phase-tracker"].join("/"), energyVampirismResult: () => [host, "energy-vampirism"].join("/"), nameHoroscopeResult: () => [host, "name-horoscope"].join("/"), // test routes gender: () => [host, "gender"].join("/"), questionnaire: () => [host, "questionnaire"].join("/"), goalSetup: () => [host, "goal-setup"].join("/"), hyperPersonalizedAstrology: () => [host, "hyper-personalized-astrology"].join("/"), noTime: () => [host, "no-time"].join("/"), loadingInRelationship: () => [host, "loading-in-relationship"].join("/"), worksRouter: () => [host, "works-router"].join("/"), worksForUs: () => [host, "works-for-us"].join("/"), worksTraits: () => [host, "works-traits"].join("/"), relationshipAlmostThere: () => [host, "relationship-almost-there"].join("/"), singleZodiacInfo: () => [host, "single-zodiac-info"].join("/"), problems: () => [host, "problems"].join("/"), notAlone: () => [host, "not-alone"].join("/"), allRight: () => [host, "all-right"].join("/"), almostThere: () => [host, "almost-there"].join("/"), partnerRightPlace: () => [host, "partner-right-place"].join("/"), partnerThing: () => [host, "partner-thing"].join("/"), partnerTotallyNormal: () => [host, "partner-totally-normal"].join("/"), withHeart: () => [host, "with-heart"].join("/"), withHead: () => [host, "with-head"].join("/"), both: () => [host, "both"].join("/"), relationshipZodiacInfo: () => [host, "relationship-zodiac-info"].join("/"), satisfiedResult: () => [host, "satisfied-result"].join("/"), aboutUs: () => [host, "about-us"].join("/"), loadingProfile: () => [host, "loading-profile"].join("/"), emailConfirm: () => [host, "email-confirm"].join("/"), onboarding: () => [host, "onboarding"].join("/"), trialChoice: () => [host, "trial-choice"].join("/"), trialPayment: () => [host, "trial-payment"].join("/"), notFound: () => [host, "404"].join("/"), }, server: { appleAuth: (origin: string) => [apiHost, "auth", "apple", `gate?origin=${origin}`].join("/"), googleAuth: (origin: string) => [apiHost, "auth", "google", `gate?origin=${origin}`].join("/"), user: () => [apiHost, prefix, "user.json"].join("/"), token: () => [apiHost, prefix, "auth", "token.json"].join("/"), elements: () => [apiHost, prefix, "elements.json"].join("/"), zodiacs: (zodiac: string) => [apiHost, prefix, "zodiacs", `${zodiac}.json`].join("/"), element: (type: string) => [apiHost, prefix, "elements", `${type}.json`].join("/"), apps: (bundleId: string) => [apiHost, prefix, "apps", `${bundleId}.json`].join("/"), assets: (category: string) => [apiHost, prefix, "assets", "categories", `${category}.json`].join("/"), assetCategories: () => [apiHost, prefix, "assets", "categories.json"].join("/"), dailyForecasts: () => [apiHost, prefix, "user", "daily_forecast.json"].join("/"), auras: () => [apiHost, prefix, "user", "aura.json"].join("/"), paymentIntents: () => [apiHost, prefix, "user", "payment_intents.json"].join("/"), subscriptionItems: () => [apiHost, prefix, "user", "subscription", "item_prices.json"].join("/"), subscriptionPlans: () => [apiHost, prefix, "sub_plans.json"].join("/"), subscriptionCheckout: () => [apiHost, prefix, "user", "subscription", "checkout", "new.json"].join( "/" ), subscriptionStatus: () => [apiHost, prefix, "user", "subscription_receipts", "status.json"].join( "/" ), subscriptionReceipts: () => [apiHost, prefix, "user", "subscription_receipts.json"].join("/"), subscriptionReceipt: (id: string) => [apiHost, prefix, "user", "subscription_receipts", `${id}.json`].join( "/" ), compatCategories: () => [apiHost, prefix, "ai", "compat_categories.json"].join("/"), compat: () => [apiHost, prefix, "ai", "compats.json"].join("/"), createUserCallbacks: () => [apiHost, prefix, "user", "callbacks.json"].join("/"), getUserCallbacks: (id: string) => [apiHost, prefix, "user", "callbacks", `${id}.json`].join("/"), getTranslations: () => [siteHost, "api/v2", "t.json"].join("/"), aiRequestsV2: (promptKey: string) => [apiHost, "api/v2", "ai", "prompts", promptKey, "requests.json"].join( "/" ), getAiRequestsV2: (id: string) => [apiHost, "api/v2", "ai", "requests", `${id}.json`].join("/"), }, }; export const entrypoints = [ routes.client.root(), routes.client.birthday(), routes.client.subscription(), routes.client.wallpaper(), routes.client.didYouKnow(), routes.client.attention(), routes.client.feedback(), routes.client.breath(), routes.client.compatibilityResult(), routes.client.home(), routes.client.breathResult(), routes.client.magicBall(), routes.client.trialChoice(), ]; export const isEntrypoint = (path: string) => entrypoints.includes(path); export const isNotEntrypoint = (path: string) => !isEntrypoint(path); export const withNavigationRoutes = [ routes.client.wallpaper(), routes.client.home(), ]; export const hasNavigation = (path: string) => withNavigationRoutes.includes(path); export const hasNoNavigation = (path: string) => !hasNavigation(path); export const withCrossButtonRoutes = [ // routes.client.attention(), routes.client.subscription(), routes.client.paymentMethod(), ]; /** * Checks if a given path has a cross button. * @param {string} path - The path to check. * @returns {boolean} - True if the path has a cross button, false otherwise. */ export const hasCrossButton = (path: string): boolean => { // Check if the path is included in the array of routes with cross buttons return withCrossButtonRoutes.includes(path); }; export const withoutFooterRoutes = [ routes.client.didYouKnow(), routes.client.freePeriodInfo(), routes.client.createProfile(), routes.client.attention(), routes.client.feedback(), routes.client.compatibility(), routes.client.breath(), routes.client.priceList(), routes.client.compatibilityResult(), routes.client.home(), routes.client.breathResult(), routes.client.paymentResult(), routes.client.paymentSuccess(), routes.client.paymentFail(), routes.client.paymentStripe(), routes.client.magicBall(), routes.client.horoscopeBestiesResult(), routes.client.predictionMoonResult(), routes.client.myHoroscopeResult(), routes.client.thermalResult(), routes.client.moonPhaseTracker(), routes.client.energyVampirismResult(), routes.client.nameHoroscopeResult(), routes.client.goalSetup(), routes.client.hyperPersonalizedAstrology(), routes.client.noTime(), routes.client.loadingInRelationship(), routes.client.worksForUs(), routes.client.relationshipAlmostThere(), routes.client.singleZodiacInfo(), routes.client.worksTraits(), routes.client.notAlone(), routes.client.allRight(), routes.client.almostThere(), routes.client.partnerRightPlace(), routes.client.partnerThing(), routes.client.partnerTotallyNormal(), routes.client.withHeart(), routes.client.withHead(), routes.client.both(), routes.client.relationshipZodiacInfo(), routes.client.satisfiedResult(), routes.client.aboutUs(), routes.client.emailConfirm(), routes.client.onboarding(), routes.client.trialChoice(), routes.client.trialPayment(), ]; export const withoutFooterPartOfRoutes = [routes.client.questionnaire()]; export const hasNoFooter = (path: string) => { const targetRoute = withoutFooterPartOfRoutes.findIndex((route) => path.includes(route) ); return !withoutFooterRoutes.includes(path) && targetRoute === -1; }; export const withNavbarFooterRoutes = [ routes.client.home(), routes.client.compatibility(), routes.client.compatibilityResult(), routes.client.breath(), routes.client.breathResult(), routes.client.wallpaper(), ]; export const hasNavbarFooter = (path: string) => withNavbarFooterRoutes.includes(path); export const withoutHeaderRoutes = [ routes.client.compatibility(), routes.client.subscription(), routes.client.paymentMethod(), routes.client.paymentResult(), routes.client.paymentSuccess(), routes.client.paymentFail(), routes.client.magicBall(), routes.client.horoscopeBestiesResult(), routes.client.predictionMoonResult(), routes.client.myHoroscopeResult(), routes.client.myHoroscopeResult(), routes.client.thermalResult(), routes.client.moonPhaseTracker(), routes.client.energyVampirismResult(), routes.client.nameHoroscopeResult(), routes.client.goalSetup(), routes.client.hyperPersonalizedAstrology(), routes.client.noTime(), routes.client.loadingInRelationship(), routes.client.worksForUs(), routes.client.relationshipAlmostThere(), routes.client.singleZodiacInfo(), routes.client.worksTraits(), routes.client.notAlone(), routes.client.allRight(), routes.client.almostThere(), routes.client.partnerRightPlace(), routes.client.partnerThing(), routes.client.partnerTotallyNormal(), routes.client.withHeart(), routes.client.withHead(), routes.client.both(), routes.client.relationshipZodiacInfo(), routes.client.satisfiedResult(), routes.client.onboarding(), routes.client.trialPayment(), ]; export const hasNoHeader = (path: string) => { return !withoutHeaderRoutes.includes(`/${path.split("/")[1]}`); }; export const withFullDataModalRoutes = [routes.client.home()]; export const hasFullDataModal = (path: string) => { return withFullDataModalRoutes.includes(`/${path.split("/")[1]}`); }; export const getRouteBy = (status: UserStatus): string => { switch (status) { case "lead": return routes.client.gender(); case "registred": case "unsubscribed": return routes.client.trialPayment(); case "subscribed": return routes.client.home(); default: throw new Error(`Unknown user status, received status is "${status}"`); } }; export default routes;