import { ProxyVersions } from '@vtex/raccoon-core'; export { ProxyVersions, VTEX_ID_COOKIE_NAME, X_VTEX_RACCOON_ACCOUNT, X_VTEX_RACCOON_TOKEN, X_VTEX_RACCOON_WORKSPACE, hosts, proxyV1, routes } from '@vtex/raccoon-core'; import { ComponentType } from 'react'; interface AdminContext { /** * The account in which the app is running */ account: string; /** * The workspace in which the app is running */ workspace: string; /** * The locale of the current user. This information * comes from the Sales Channel. */ locale?: string; /** * The currency of the current user. This information * comes from the Sales Channel. */ currency?: string; /** * The country of the current user. This information * comes from the Sales Channel. */ country?: string; /** * VTEX ID token from the user */ token: string; /** * The production URL of the app */ prodUrl: string; /** * The development URL of the app */ devUrl?: string; /** * Whether the app is running in production mode */ production: boolean; /** * The base path of the application relative to the admin * It is the app's path that appears on the admin sidebar * @example * /admin/rocket */ basePath: string; /** * The top window href of the admin * @example * https://teamadmin.myvtex.com/admin/rocket */ topWindowHref: string; /** * The current path relative to the admin * @example * /admin/rocket/nextjs-internal-route */ path?: string; proxy?: ProxyOptions; } interface ProxyOptions { version: ProxyVersions; appUrl: string; } interface BootstrapOptions { /** * Proxy version to be used by the application. * * Enable this option if you want your application to be served * under *.myvtex.com. * * @default undefined */ proxy?: ProxyOptions; /** * Render mode to be used by the application. * * @default 'client' */ renderMode?: 'client'; /** * Enable Activity Flow script load in development mode. * * In production, the Activity Flow script is always loaded. * In development, it is disabled by default to avoid polluting metrics. * Enable this option if you need to capture events during development. * * @default true */ enableActivityFlow?: boolean; } declare function useAdmin(): AdminContext; declare function connect(options?: BootstrapOptions): void; declare function bootstrap

(Component: ComponentType

, options?: BootstrapOptions): ComponentType; /** * This hook exposes the `navigation` method responsible * for enabling navigation between Next.js and Render pages. * * It triggers the triggerNextJSNavigation method from admin-shell. * * Read more about Raccoon's navigation architecture under the * navigation section of its docs. */ declare function useNavigation(): { navigate: (path: string, options?: NavigateOptions) => Window | Promise | null | undefined; }; interface NavigateOptions { /** * Use the default `navigation` option when navigating to a page within your Next.js app. * Under the hood, this `navigation` type delegates the navigation to the Next.js router. * * Use the `adminRelativeNavigation` option when navigating to a Render app page or a Next.js page * outside your Next.js app. * Under the hood, the `adminRelativeNavigation` type delegates the navigation entirely to Render. */ type: 'navigation' | 'adminRelativeNavigation'; } type MessageParams = { type: string; data: Partial; }; declare function publishMessage(params: MessageParams): void; /** * internal store */ declare const adminStore: { set: (val: AdminContext) => void; read: () => AdminContext; reject: (val: unknown) => void; subscribe: (sub: (value: AdminContext) => void) => () => void; }; /** * VTEX IO rewrite rules using Next.js rewrites. * Not compliant with the VTEX proxy routes existent from Raccoon's proxy server nor from Raccoon's `fetcher` function. * @see https://admin-platform.vtex.com/raccoon/#proxies/ */ declare const vtexIORewrite: { source: string; destination: string; }[]; interface MyVtexGraphQLParams { /** * The GraphQL query body. */ body: string; /** * The options for the GraphQL request. */ options: MyVtexGraphQLOptions; } interface MyVtexGraphQLOptions { /** * The locale to be used in the request. * @default '' */ locale?: string; /** * The maxAge cache to be used in the request. * @default 'long' */ maxAge?: string; /** * The appsEtag to be used in the request. * @default 'remove' */ appsEtag?: string; } /** * Fetches data authenticated with the VTEX ID token. * * When using the `proxy` option, this method doesn't * use the underlying fetcher from `@vtex/raccoon-core`, * which goes through the `@vtex/raccoon-proxy` library. * * Instead, it uses the native `fetch` method and since * the application is already running under *.myvtex.com, * it will be authenticated by the VTEX ID token and it * doesn't need to go through the proxy. */ declare function fetcher(route: string | URL | Request, options?: RequestInit): Promise; /** * Hits myvtex GraphQL endpoint with the given body */ declare function fetchMyVtexGraphQL(params: MyVtexGraphQLParams): Promise; /** * Factory function to create a query function for a given query body * * @example * const UserRoles = JSON.stringify({ * query: `query UserRoles {\n userRoles @context(provider: "vtex.admin-graphql@2.x") {\n roles {\n id\n isAdmin\n roleType\n name\n }\n }\n}`, * variables: null, * operationName: "UserRoles", * }); * * const fetchUserRoles = createGraphQLQuery(UserRoles) * const { locale } = useAdmin() * * fetchUserRoles({ * locale, * }) */ declare function createGraphQLQuery(body: string): (options: MyVtexGraphQLOptions) => Promise; /** * Whether is running a Raccoon application in a standalone development environment, * without being embedded in the VTEX Admin. */ declare function isStandalone(): string | false; export { type AdminContext, type BootstrapOptions, type ProxyOptions, adminStore, bootstrap, connect, createGraphQLQuery, fetchMyVtexGraphQL, fetcher, isStandalone, publishMessage, useAdmin, useNavigation, vtexIORewrite };