@open-condo/miniapp-utils
Version:
A set of helper functions / components / hooks used to build new condo apps fast
59 lines (56 loc) • 2.18 kB
text/typescript
import { z } from 'zod';
import { O as Optional, A as AppType } from '../types-DHs6TUPa.mjs';
import { IncomingMessage, ServerResponse } from 'http';
import 'react';
declare const EMBEDDING_CONTEXT_SCHEMA: z.ZodObject<{
dv: z.ZodLiteral<1>;
app: z.ZodObject<{
id: z.ZodString;
version: z.ZodOptional<z.ZodString>;
build: z.ZodOptional<z.ZodString>;
}, z.core.$strict>;
platform: z.ZodEnum<{
iOS: "iOS";
Android: "Android";
web: "web";
}>;
os: z.ZodOptional<z.ZodObject<{
name: z.ZodString;
version: z.ZodOptional<z.ZodString>;
}, z.core.$strict>>;
device: z.ZodObject<{
id: z.ZodString;
}, z.core.$strict>;
}, z.core.$strict>;
declare const EMBEDDING_CONTEXT_WITH_SOURCE_SCHEMA: z.ZodObject<{
ctx: z.ZodObject<{
dv: z.ZodLiteral<1>;
app: z.ZodObject<{
id: z.ZodString;
version: z.ZodOptional<z.ZodString>;
build: z.ZodOptional<z.ZodString>;
}, z.core.$strict>;
platform: z.ZodEnum<{
iOS: "iOS";
Android: "Android";
web: "web";
}>;
os: z.ZodOptional<z.ZodObject<{
name: z.ZodString;
version: z.ZodOptional<z.ZodString>;
}, z.core.$strict>>;
device: z.ZodObject<{
id: z.ZodString;
}, z.core.$strict>;
}, z.core.$strict>;
source: z.ZodEnum<{
query: "query";
cookie: "cookie";
}>;
}, z.core.$strict>;
type EmbeddingContext = z.infer<typeof EMBEDDING_CONTEXT_SCHEMA>;
type EmbeddingContextWithSource = z.infer<typeof EMBEDDING_CONTEXT_WITH_SOURCE_SCHEMA>;
declare function useEmbeddingContext(): EmbeddingContext | null;
declare function getEmbeddingContext(req?: Optional<IncomingMessage>, res?: Optional<ServerResponse>): EmbeddingContextWithSource | null;
declare function withEmbeddingContext<PropsType extends Record<string, unknown>, ComponentType, RouterType>(App: AppType<PropsType, ComponentType, RouterType>): AppType<PropsType, ComponentType, RouterType>;
export { type EmbeddingContext, getEmbeddingContext, useEmbeddingContext, withEmbeddingContext };