UNPKG

@bigdigital/kiosk-content-sdk

Version:

A Firebase-powered Content Management System SDK optimized for kiosks with offline support, template management, and real-time connection monitoring

592 lines 20 kB
import { z } from "zod"; export declare const userRoles: readonly ["admin", "editor", "viewer"]; export declare const fieldTypeEnum: z.ZodEnum<["text", "number", "boolean", "select", "rich-text", "image", "video", "audio", "date", "multi-select", "color"]>; export declare const normalizeGroupName: (name: string) => string; export declare const validationSchema: z.ZodOptional<z.ZodObject<{ required: z.ZodDefault<z.ZodBoolean>; min: z.ZodOptional<z.ZodNumber>; max: z.ZodOptional<z.ZodNumber>; pattern: z.ZodOptional<z.ZodString>; customError: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { required: boolean; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; }, { required?: boolean | undefined; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; }>>; export declare const fieldSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; label: z.ZodString; type: z.ZodEnum<["text", "number", "boolean", "select", "rich-text", "image", "video", "audio", "date", "multi-select", "color"]>; description: z.ZodOptional<z.ZodString>; defaultValue: z.ZodOptional<z.ZodAny>; options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; validation: z.ZodOptional<z.ZodObject<{ required: z.ZodDefault<z.ZodBoolean>; min: z.ZodOptional<z.ZodNumber>; max: z.ZodOptional<z.ZodNumber>; pattern: z.ZodOptional<z.ZodString>; customError: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { required: boolean; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; }, { required?: boolean | undefined; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; }>>; step: z.ZodOptional<z.ZodNumber>; groupId: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { type: "number" | "boolean" | "text" | "select" | "rich-text" | "image" | "video" | "audio" | "date" | "multi-select" | "color"; id: string; name: string; label: string; options?: string[] | undefined; validation?: { required: boolean; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; } | undefined; description?: string | undefined; defaultValue?: any; step?: number | undefined; groupId?: string | undefined; }, { type: "number" | "boolean" | "text" | "select" | "rich-text" | "image" | "video" | "audio" | "date" | "multi-select" | "color"; id: string; name: string; label: string; options?: string[] | undefined; validation?: { required?: boolean | undefined; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; } | undefined; description?: string | undefined; defaultValue?: any; step?: number | undefined; groupId?: string | undefined; }>; export declare const groupSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodOptional<z.ZodString>; order: z.ZodNumber; fieldIds: z.ZodArray<z.ZodString, "many">; normalizedName: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; name: string; order: number; fieldIds: string[]; description?: string | undefined; normalizedName?: string | undefined; }, { id: string; name: string; order: number; fieldIds: string[]; description?: string | undefined; normalizedName?: string | undefined; }>; export declare const templateSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodString; type: z.ZodString; fields: z.ZodArray<z.ZodObject<{ id: z.ZodString; name: z.ZodString; label: z.ZodString; type: z.ZodEnum<["text", "number", "boolean", "select", "rich-text", "image", "video", "audio", "date", "multi-select", "color"]>; description: z.ZodOptional<z.ZodString>; defaultValue: z.ZodOptional<z.ZodAny>; options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; validation: z.ZodOptional<z.ZodObject<{ required: z.ZodDefault<z.ZodBoolean>; min: z.ZodOptional<z.ZodNumber>; max: z.ZodOptional<z.ZodNumber>; pattern: z.ZodOptional<z.ZodString>; customError: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { required: boolean; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; }, { required?: boolean | undefined; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; }>>; step: z.ZodOptional<z.ZodNumber>; groupId: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { type: "number" | "boolean" | "text" | "select" | "rich-text" | "image" | "video" | "audio" | "date" | "multi-select" | "color"; id: string; name: string; label: string; options?: string[] | undefined; validation?: { required: boolean; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; } | undefined; description?: string | undefined; defaultValue?: any; step?: number | undefined; groupId?: string | undefined; }, { type: "number" | "boolean" | "text" | "select" | "rich-text" | "image" | "video" | "audio" | "date" | "multi-select" | "color"; id: string; name: string; label: string; options?: string[] | undefined; validation?: { required?: boolean | undefined; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; } | undefined; description?: string | undefined; defaultValue?: any; step?: number | undefined; groupId?: string | undefined; }>, "many">; groups: z.ZodRecord<z.ZodString, z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodOptional<z.ZodString>; order: z.ZodNumber; fieldIds: z.ZodArray<z.ZodString, "many">; normalizedName: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; name: string; order: number; fieldIds: string[]; description?: string | undefined; normalizedName?: string | undefined; }, { id: string; name: string; order: number; fieldIds: string[]; description?: string | undefined; normalizedName?: string | undefined; }>>; ungroupedFieldIds: z.ZodArray<z.ZodString, "many">; groupOrder: z.ZodArray<z.ZodString, "many">; createdBy: z.ZodString; createdAt: z.ZodNumber; updatedAt: z.ZodNumber; version: z.ZodDefault<z.ZodNumber>; settings: z.ZodDefault<z.ZodObject<{ cacheStrategy: z.ZodDefault<z.ZodEnum<["memory", "local", "none"]>>; syncInterval: z.ZodOptional<z.ZodNumber>; offlineSupport: z.ZodDefault<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { cacheStrategy: "memory" | "local" | "none"; offlineSupport: boolean; syncInterval?: number | undefined; }, { cacheStrategy?: "memory" | "local" | "none" | undefined; syncInterval?: number | undefined; offlineSupport?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { type: string; id: string; name: string; description: string; fields: { type: "number" | "boolean" | "text" | "select" | "rich-text" | "image" | "video" | "audio" | "date" | "multi-select" | "color"; id: string; name: string; label: string; options?: string[] | undefined; validation?: { required: boolean; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; } | undefined; description?: string | undefined; defaultValue?: any; step?: number | undefined; groupId?: string | undefined; }[]; groups: Record<string, { id: string; name: string; order: number; fieldIds: string[]; description?: string | undefined; normalizedName?: string | undefined; }>; ungroupedFieldIds: string[]; groupOrder: string[]; createdBy: string; createdAt: number; updatedAt: number; version: number; settings: { cacheStrategy: "memory" | "local" | "none"; offlineSupport: boolean; syncInterval?: number | undefined; }; }, { type: string; id: string; name: string; description: string; fields: { type: "number" | "boolean" | "text" | "select" | "rich-text" | "image" | "video" | "audio" | "date" | "multi-select" | "color"; id: string; name: string; label: string; options?: string[] | undefined; validation?: { required?: boolean | undefined; min?: number | undefined; max?: number | undefined; pattern?: string | undefined; customError?: string | undefined; } | undefined; description?: string | undefined; defaultValue?: any; step?: number | undefined; groupId?: string | undefined; }[]; groups: Record<string, { id: string; name: string; order: number; fieldIds: string[]; description?: string | undefined; normalizedName?: string | undefined; }>; ungroupedFieldIds: string[]; groupOrder: string[]; createdBy: string; createdAt: number; updatedAt: number; version?: number | undefined; settings?: { cacheStrategy?: "memory" | "local" | "none" | undefined; syncInterval?: number | undefined; offlineSupport?: boolean | undefined; } | undefined; }>; export declare const templateValuesSchema: z.ZodObject<{ groups: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>; ungrouped: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>; _template: z.ZodOptional<z.ZodObject<{ id: z.ZodString; version: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; version: number; }, { id: string; version: number; }>>; }, "strip", z.ZodTypeAny, { groups: Record<string, Record<string, any>>; ungrouped: Record<string, any>; _template?: { id: string; version: number; } | undefined; }, { groups?: Record<string, Record<string, any>> | undefined; ungrouped?: Record<string, any> | undefined; _template?: { id: string; version: number; } | undefined; }>; declare const baseContentSchema: z.ZodObject<{ id: z.ZodString; title: z.ZodString; description: z.ZodString; type: z.ZodEnum<["text", "image", "video", "template"]>; mediaUrl: z.ZodOptional<z.ZodString>; projectIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; createdBy: z.ZodString; createdAt: z.ZodNumber; updatedAt: z.ZodNumber; templateId: z.ZodOptional<z.ZodString>; templateValues: z.ZodOptional<z.ZodObject<{ groups: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>; ungrouped: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>; _template: z.ZodOptional<z.ZodObject<{ id: z.ZodString; version: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; version: number; }, { id: string; version: number; }>>; }, "strip", z.ZodTypeAny, { groups: Record<string, Record<string, any>>; ungrouped: Record<string, any>; _template?: { id: string; version: number; } | undefined; }, { groups?: Record<string, Record<string, any>> | undefined; ungrouped?: Record<string, any> | undefined; _template?: { id: string; version: number; } | undefined; }>>; templateVersion: z.ZodOptional<z.ZodNumber>; version: z.ZodDefault<z.ZodNumber>; status: z.ZodDefault<z.ZodEnum<["published", "draft", "archived"]>>; metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>; data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; }, "strip", z.ZodTypeAny, { type: "text" | "image" | "video" | "template"; status: "published" | "draft" | "archived"; id: string; description: string; createdBy: string; createdAt: number; updatedAt: number; version: number; title: string; projectIds: string[]; metadata: Record<string, any>; mediaUrl?: string | undefined; templateId?: string | undefined; templateValues?: { groups: Record<string, Record<string, any>>; ungrouped: Record<string, any>; _template?: { id: string; version: number; } | undefined; } | undefined; templateVersion?: number | undefined; data?: Record<string, any> | undefined; }, { type: "text" | "image" | "video" | "template"; id: string; description: string; createdBy: string; createdAt: number; updatedAt: number; title: string; status?: "published" | "draft" | "archived" | undefined; version?: number | undefined; mediaUrl?: string | undefined; projectIds?: string[] | undefined; templateId?: string | undefined; templateValues?: { groups?: Record<string, Record<string, any>> | undefined; ungrouped?: Record<string, any> | undefined; _template?: { id: string; version: number; } | undefined; } | undefined; templateVersion?: number | undefined; metadata?: Record<string, any> | undefined; data?: Record<string, any> | undefined; }>; export declare const contentSchema: z.ZodEffects<z.ZodObject<{ id: z.ZodString; title: z.ZodString; description: z.ZodString; type: z.ZodEnum<["text", "image", "video", "template"]>; mediaUrl: z.ZodOptional<z.ZodString>; projectIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; createdBy: z.ZodString; createdAt: z.ZodNumber; updatedAt: z.ZodNumber; templateId: z.ZodOptional<z.ZodString>; templateValues: z.ZodOptional<z.ZodObject<{ groups: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>; ungrouped: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>; _template: z.ZodOptional<z.ZodObject<{ id: z.ZodString; version: z.ZodNumber; }, "strip", z.ZodTypeAny, { id: string; version: number; }, { id: string; version: number; }>>; }, "strip", z.ZodTypeAny, { groups: Record<string, Record<string, any>>; ungrouped: Record<string, any>; _template?: { id: string; version: number; } | undefined; }, { groups?: Record<string, Record<string, any>> | undefined; ungrouped?: Record<string, any> | undefined; _template?: { id: string; version: number; } | undefined; }>>; templateVersion: z.ZodOptional<z.ZodNumber>; version: z.ZodDefault<z.ZodNumber>; status: z.ZodDefault<z.ZodEnum<["published", "draft", "archived"]>>; metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>; data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; }, "strip", z.ZodTypeAny, { type: "text" | "image" | "video" | "template"; status: "published" | "draft" | "archived"; id: string; description: string; createdBy: string; createdAt: number; updatedAt: number; version: number; title: string; projectIds: string[]; metadata: Record<string, any>; mediaUrl?: string | undefined; templateId?: string | undefined; templateValues?: { groups: Record<string, Record<string, any>>; ungrouped: Record<string, any>; _template?: { id: string; version: number; } | undefined; } | undefined; templateVersion?: number | undefined; data?: Record<string, any> | undefined; }, { type: "text" | "image" | "video" | "template"; id: string; description: string; createdBy: string; createdAt: number; updatedAt: number; title: string; status?: "published" | "draft" | "archived" | undefined; version?: number | undefined; mediaUrl?: string | undefined; projectIds?: string[] | undefined; templateId?: string | undefined; templateValues?: { groups?: Record<string, Record<string, any>> | undefined; ungrouped?: Record<string, any> | undefined; _template?: { id: string; version: number; } | undefined; } | undefined; templateVersion?: number | undefined; metadata?: Record<string, any> | undefined; data?: Record<string, any> | undefined; }>, { type: "text" | "image" | "video" | "template"; status: "published" | "draft" | "archived"; id: string; description: string; createdBy: string; createdAt: number; updatedAt: number; version: number; title: string; projectIds: string[]; metadata: Record<string, any>; mediaUrl?: string | undefined; templateId?: string | undefined; templateValues?: { groups: Record<string, Record<string, any>>; ungrouped: Record<string, any>; _template?: { id: string; version: number; } | undefined; } | undefined; templateVersion?: number | undefined; data?: Record<string, any> | undefined; }, unknown>; export type Content = z.infer<typeof baseContentSchema>; export type Field = z.infer<typeof fieldSchema>; export type Group = z.infer<typeof groupSchema>; export type Template = z.infer<typeof templateSchema>; export type FieldType = z.infer<typeof fieldTypeEnum>; export type TemplateValues = z.infer<typeof templateValuesSchema>; export interface KioskConfig { projectId: string; apiKey: string; authDomain?: string; offlineSupport?: boolean; cacheStrategy?: "memory" | "local" | "none"; syncInterval?: number; cacheMaxAge?: number; } export interface CacheOptions { ttl?: number; strategy?: "memory" | "local" | "none"; validateOnLoad?: boolean; } export interface SyncOptions { force?: boolean; onProgress?: (progress: number) => void; onError?: (error: Error) => void; retryAttempts?: number; } export interface GroupedTemplateContent { group: Group & { normalizedName: string; }; fields: Field[]; values: Record<string, any>; } export interface TemplateContentStructure { groups: GroupedTemplateContent[]; ungroupedFields: { fields: Field[]; values: Record<string, any>; }; } export interface ContentHookResult { content: Content | null; template: Template | null; loading: boolean; error: Error | null; isOnline: boolean; refresh?: () => void; } export {}; //# sourceMappingURL=types.d.ts.map