import { AquienpzClient as AquienpzClient$1, AquienpzClientOptions } from './index.js'; export { CompressOptions as ClientCompressOptions, RegenerateResult, SlotHistoryEntry, UploadOptions, UploadResult, UsageDailyPoint, UsagePerKey, UsageSnapshot, UsageWindow } from './index.js'; export { AssetDTO, AssetVariant, ResolveSlotOptions, SignedTransformOptions, SlotDTO, SlotResolution, TransformEffect, TransformFit, TransformFormat, TransformGravity, TransformOptions, VariantPreset, computeVariantDimensions, extractAssetSha, getAssetDimensions, getAssetSrcSet, getAssetUrl, getHlsStreamingUrl, getSignedTransformUrl, getTransformSrcSet, getTransformUrl, getVideoTransformUrl, hasPreset, serializeTransform, signTransformUrl } from '@aquienpz/asset-client'; /** * @aquienpz/sdk/web — browser entry point (BFF-proxy mode). * * Use this subpath from any browser context (Next.js client components, * Vite/CRA SPAs, browser extensions, web workers — anywhere `window` * exists). Bundles the core `AquienpzClient` PLUS browser-only helpers * (client-side image compression). * * // 1. In a client component (browser): * import { AquienpzClient } from "@aquienpz/sdk/web"; * * const aq = new AquienpzClient({ * // Point at your BFF route — the SDK calls * // `${endpoint}/assets/by-hash/...`, `${endpoint}/slots/...`, etc. * endpoint: "/api/am", // relative ⇒ same-origin proxy * tenantCode: "realtyone-cr", * tenantId: 1, * // NO apiKey — the type strips it. Your BFF injects the bearer. * }); * * const result = await aq.upload(file, { compress: true }); * * // 2. In a Next.js route handler (server) — proxy through to aquienpz: * // app/api/am/[...path]/route.ts * export async function GET(req: Request, { params }: ...) { * const path = params.path.join("/"); * const url = `${process.env.AQUIENPZ_URL}/${path}${new URL(req.url).search}`; * return fetch(url, { * headers: { * Authorization: `Bearer ${process.env.AQUIENPZ_API_KEY!}`, * "X-Tenant-Code": "realtyone-cr", * }, * }); * } * * Why no `apiKey` in the type: in browser code, a long-lived bearer key * would be shipped to every visitor in `NEXT_PUBLIC_*`. The type omits * it physically (TS build error at the call site) so security mistakes * are loud instead of silent. Same pattern as `@vercel/blob/client`, * `better-auth/client`, AI SDK's `/edge` subpath. * * Need to ship a server-rendered storefront with a long-lived key? * Import from `@aquienpz/sdk/server` instead — that subpath requires * `apiKey` and bundles cleanly only in Node/Bun/edge runtimes. * * Peer deps (auto-installed via npm peer deps — declared optional): * - `@aquienpz/asset-uploader-web` for multipart uploads * - `@aquienpz/asset-compressor-web` for client-side compression * * Both are lazy-imported; bundles that never call into them skip the cost. */ /** * Browser-safe constructor options for `@aquienpz/sdk/web`. * * Identical to the root `AquienpzClientOptions` except `apiKey` and * `signingKey` are **physically absent** — passing them is a TypeScript * build error, not a runtime warning. In BFF-proxy mode your route * handler injects the bearer header server-side; the browser never * sees the long-lived key. * * const aq = new AquienpzClient({ * endpoint: "/api/am", // OK: relative → same-origin BFF * tenantCode: "realtyone-cr", * tenantId: 1, * // apiKey: "amk_rt_...", // ERROR: TS error: not assignable * }); */ type WebClientOptions = Omit; /** * Browser-safe `AquienpzClient` — same runtime as the root class, but * the constructor's type rejects `apiKey` / `signingKey`. Calls go * through your BFF (typically a same-origin route like `/api/am/...`). * * For server-side instantiation (Node/Bun/edge), import from * `@aquienpz/sdk/server` instead. */ declare class AquienpzClient extends AquienpzClient$1 { constructor(opts: WebClientOptions); } type CompressStage = "convertingHeic" | "compressing" | "compressingKeepingDimensions"; /** * Subset of compressorjs options exposed by the SDK. Matches the * webapp's `DEFAULT_COMPRESSION_OPTIONS` shape from the realtyone-cr * production back-office uploader. */ type CompressOptions = { /** 0..1. Default 0.80 (`LISTING_STANDARD_IMAGE_QUALITY / 100`). */ quality?: number; /** Output format. Default `"image/webp"` (`DEFAULT_IMAGE_TARGET_FORMAT`). */ mimeType?: "image/jpeg" | "image/webp"; /** Max edge in pixels. Default 3840 (`LISTING_STANDARD_IMAGE_WIDTH`). */ maxWidth?: number; /** Default 3840 (`LISTING_STANDARD_IMAGE_HEIGHT`). */ maxHeight?: number; /** * compressorjs `convertSize`: PNG > this byte count auto-converts to * JPEG before the quality pass. Default 5 MB (5 * 1024 * 1024). */ convertSize?: number; /** compressorjs strict mode. Default true. */ strict?: boolean; /** Skip the resize pass (keep original dimensions). Default false. */ keepOriginalDimensions?: boolean; /** * Convert HEIC/HEIF inputs to JPEG via heic2any first. Default true. * Has no effect on non-HEIC inputs. */ convertHeic?: boolean; /** Optional progress hook. Useful for UI status indicators. */ onProgress?: (stage: CompressStage) => void; }; /** * Webapp-tuned defaults (LISTING_STANDARD_*). These intentionally differ * from `@aquienpz/asset-compressor-web`'s package-level defaults — the * SDK overrides at call time. */ declare const DEFAULT_COMPRESSION_OPTIONS: Required>; type CompressResult = { /** Compressed bytes wrapped as a Blob (browser-native). */ blob: Blob; /** Size of the source before compression, in bytes. */ originalBytes: number; }; /** * Compress a single image. Browser-only; in Node/Bun this is a no-op that * returns the input unchanged (with a warning). * * Dynamically imports `@aquienpz/asset-compressor-web` so apps that never * call `compress: true` don't pay the compressorjs + heic2any bundle cost. */ declare function compressImage(file: File | Blob, opts?: CompressOptions): Promise; /** * Compress a batch of images with adaptive concurrency * (navigator.hardwareConcurrency, capped at 8). Failures throw — pass * `try/catch` per file if you want per-file resilience, or call * `compressImage` in a loop yourself. */ declare function compressImages(files: Array, opts?: CompressOptions): Promise; export { AquienpzClient, type CompressOptions, type CompressResult, type CompressStage, DEFAULT_COMPRESSION_OPTIONS, type WebClientOptions, compressImage, compressImages };