import { AppServer } from "../app.js"; import { Context } from "../context-resolver.js"; import type { ShopInterface, ShopRepositoryInterface } from "../repository.js"; import type { Hono, Context as HonoContext } from "hono"; import { type HttpClientTokenCacheInterface } from "../http-client.js"; declare module "hono" { interface ContextVariableMap { app: AppServer; shop: ShopInterface; context: Context; } } interface MiddlewareConfigBase { /** * The URL of the app. This is the base URL of the app. This will automatically determined by default */ appUrl?: string | null; /** * The relative url of the app registration endpoint * * @default "/app/register" */ registrationUrl?: string | null; /** * The relative url of the app registration confirmation endpoint * * @default "/app/register/confirm" */ registerConfirmationUrl?: string | null; /** * When true, registration requires both app and shop signatures during re-registration and confirmation. * * @default true */ enforceDoubleSignature?: boolean; /** * The relative url of the app installation lifecycle endpoint * * @default "/app/install" */ appInstallUrl?: string | null; /** * The relative url of the app activation lifecycle endpoint * * @default "/app/activate" */ appActivateUrl?: string | null; /** * The relative url of the app update lifecycle endpoint * * @default "/app/update" */ appUpdateUrl?: string | null; /** * The relative url of the app deactivation lifecycle endpoint * * @default "/app/deactivate" */ appDeactivateUrl?: string | null; /** * The relative url of the app deletion lifecycle endpoint * * @default "/app/delete" */ appDeleteUrl?: string | null; /** * The relative url of the app scope. All requests matching this will be the signature automatically validated and the response will be signed * * @default "/app/*" */ appPath?: string | null; /** * Enable the app iframe integration. This will automatically set a cookie to identifiy the shopware shop and validate the request from a client side application. See appIframeRedirects */ appIframeEnable?: boolean; /** * The relative url of the app iframe scope. All requests matching this will require that the request has an cookie set with the shopware shop. This cookie will be automatically set by * * @default "/client-api/*" */ appIframePath?: string | null; /** * A mapping of the app iframe paths to the actual paths. This route will set a cookie automatically before the redirect to the actual path. In that way the client side application can send requests to /app-iframe/* with the cookie set and the server will automatically validate the request and knows which shop the request is for. * * @default { * "/app/module": "https://my-static-client-side-app.com" * } */ appIframeRedirects?: Record; } interface AppServerConfig { /** * An already constructed AppServer instance. When provided, other parameters like appName and appSecret are not required. */ appServer: AppServer; } interface ParametersConfig { /** * The name of the app */ appName: string | ((c: HonoContext) => string); /** * The secret of the app. When the app is published in the Shopware Store, the Shopware Store provides this value. */ appSecret: string | ((c: HonoContext) => string); /** * The repository to fetch and store the shop data */ shopRepository: ShopRepositoryInterface | ((c: HonoContext) => ShopRepositoryInterface); /** * An already constructed AppServer instance. When provided, other parameters like appName and appSecret are not required. */ appServer?: undefined; /** * The token cache to use for the HttpClient. This is used to cache the access token for the shopware shop. If you don't provide a token cache, the HttpClient will use an in-memory cache. */ httpClientTokenCache?: HttpClientTokenCacheInterface | ((c: HonoContext) => HttpClientTokenCacheInterface); /** * A callback to setup the app server. It will be called after the app server is created and before the first request is handled */ setup?: (app: AppServer) => void; } type MiddlewareConfig = (MiddlewareConfigBase & AppServerConfig) | (MiddlewareConfigBase & ParametersConfig); /** * Configure the Hono server to handle the app registration and context resolution */ export declare function configureAppServer(hono: Hono, cfg: MiddlewareConfig): void; export {}; //# sourceMappingURL=hono.d.ts.map