import { B2CInstance } from '../../instance/index.js'; import { type JobExecution, type WaitForJobOptions } from '../jobs/run.js'; import { type CommerceAppManifest } from './validate.js'; /** * Options for CAP installation. */ export interface CommerceAppInstallOptions { /** Target site ID to install the app on. */ siteId: string; /** Keep the uploaded zip on the instance after install (default: false). */ keepArchive?: boolean; /** * Create a pull request against the connected Storefront Next repository * when the app includes storefront content (default: false). */ shouldCreatePr?: boolean; /** Wait options for job completion. */ waitOptions?: WaitForJobOptions; } /** * Result of a CAP installation. */ export interface CommerceAppInstallResult { /** Job execution details. */ execution: JobExecution; /** App name (id from commerce-app.json). */ appName: string; /** App version. */ appVersion: string; /** Uploaded archive filename. */ archiveFilename: string; /** Whether the archive was kept on the instance. */ archiveKept: boolean; } /** * Installs a Commerce App Package (CAP) on a B2C Commerce instance. * * Accepts a local directory or zip file. Reads the commerce-app.json manifest * to determine app name, version, and domain. Uploads the zip to WebDAV and * executes the sfcc-install-commerce-app system job. * * @param instance - B2C instance to install to * @param target - Path to a CAP directory or .zip file * @param options - Install options including required siteId * @returns Install result with job execution details * @throws JobExecutionError if the install job fails * * @example * ```typescript * const result = await commerceAppInstall(instance, './commerce-avalara-tax-app-v0.2.5', { * siteId: 'RefArch', * }); * ``` */ export declare function commerceAppInstall(instance: B2CInstance, target: string, options: CommerceAppInstallOptions): Promise; /** * Reads and parses the commerce-app.json manifest file from a CAP directory. * * @param capDir - Path to the CAP directory containing commerce-app.json * @returns Parsed manifest object * @throws Error if commerce-app.json does not exist in the directory * @throws Error if commerce-app.json is not valid JSON * * @example * ```typescript * const manifest = readManifest('./my-commerce-app'); * console.log(`App: ${manifest.id}@${manifest.version}`); * ``` */ export declare function readManifest(capDir: string): CommerceAppManifest; /** Prefix site ID with "Sites-" if not already present. */ export declare function normalizeSiteId(siteId: string): string;