/** * Managed Runtime B2C Commerce API client. * * Provides a typed client for the MRT B2C Commerce integration API, * which manages the connection between MRT targets and B2C Commerce instances. * * @module clients/mrt-b2c */ import { type Client } from 'openapi-fetch'; import type { AuthStrategy } from '../auth/types.js'; import type { paths, components } from './mrt-b2c.generated.js'; import { type MiddlewareRegistry } from './middleware-registry.js'; /** * Re-export generated types for external use. */ export type { paths, components }; /** * The typed MRT B2C client for B2C Commerce integration with Managed Runtime. * * ## Common Endpoints * * | Method | Path | Description | * |--------|------|-------------| * | GET | `/b2c-organization-info/{organization_slug}/` | Get B2C org info | * | GET | `/projects/{project_slug}/b2c-target-info/{target_slug}/` | Get B2C target info | * | PUT | `/projects/{project_slug}/b2c-target-info/{target_slug}/` | Update B2C target | * | PATCH | `/projects/{project_slug}/b2c-target-info/{target_slug}/` | Partial update target | * * @example * ```typescript * import { createMrtB2CClient } from '@salesforce/b2c-tooling-sdk/clients'; * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * * const auth = new ApiKeyStrategy(apiKey, 'Authorization'); * const client = createMrtB2CClient({}, auth); * * // Get B2C target info * const { data, error } = await client.GET('/projects/{project_slug}/b2c-target-info/{target_slug}/', { * params: { path: { project_slug: 'my-project', target_slug: 'staging' } } * }); * ``` * * @see {@link createMrtB2CClient} for instantiation * @see {@link https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/references/mrt-b2c-config?meta=Summary | MRT B2C Config API Reference} */ export type MrtB2CClient = Client; /** * Helper type to extract response data from an operation. */ export type MrtB2CResponse = T extends { content: { 'application/json': infer R; }; } ? R : never; /** * B2C organization info from MRT. */ export type B2COrgInfo = components['schemas']['APIB2COrgInfo']; /** * B2C target info - connection between MRT target and B2C instance. */ export type B2CTargetInfo = components['schemas']['APIB2CTargetInfo']; /** * Partial B2C target info for updates. */ export type PatchedB2CTargetInfo = components['schemas']['PatchedAPIB2CTargetInfo']; /** * Standard MRT B2C error response structure. */ export interface MrtB2CError { status: number; message: string; detail?: string; } /** * Configuration for creating an MRT B2C client. */ export interface MrtB2CClientConfig { /** * The origin URL for the MRT B2C API. * @default "https://cloud.mobify.com/api/cc/b2c" * @example "https://cloud.mobify.com/api/cc/b2c" */ origin?: string; /** * Middleware registry to use for this client. * If not specified, uses the global middleware registry. */ middlewareRegistry?: MiddlewareRegistry; } /** * Default MRT B2C API origin. */ export declare const DEFAULT_MRT_B2C_ORIGIN = "https://cloud.mobify.com/api/cc/b2c"; /** * Creates a typed Managed Runtime B2C Commerce API client. * * This client handles the B2C Commerce integration endpoints, which manage * the connection between MRT targets/environments and B2C Commerce instances. * * @param config - MRT B2C client configuration * @param auth - Authentication strategy (typically ApiKeyStrategy) * @returns Typed openapi-fetch client * * @example * // Create MRT B2C client with API key auth * const apiKeyStrategy = new ApiKeyStrategy(apiKey, 'Authorization'); * * const client = createMrtB2CClient({}, apiKeyStrategy); * * // Get B2C organization info * const { data, error } = await client.GET('/b2c-organization-info/{organization_slug}/', { * params: { * path: { organization_slug: 'my-org' } * } * }); * * @example * // Get B2C target info * const { data, error } = await client.GET('/projects/{project_slug}/b2c-target-info/{target_slug}/', { * params: { * path: { project_slug: 'my-project', target_slug: 'staging' } * } * }); * * @example * // Update B2C target info * const { data, error } = await client.PUT('/projects/{project_slug}/b2c-target-info/{target_slug}/', { * params: { * path: { project_slug: 'my-project', target_slug: 'staging' } * }, * body: { * instance_id: 'zzxy_prd', * sites: ['RefArch', 'SiteGenesis'] * } * }); */ export declare function createMrtB2CClient(config: MrtB2CClientConfig, auth: AuthStrategy): MrtB2CClient;