/** * @license * * Copyright 2026 Adobe. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ import { n as getAclResourceId, t as AdminUiEntity } from "../acl-resource-id-DBlYU0DE.cjs"; import { CommerceSdkErrorBase, CommerceSdkErrorOptions } from "@adobe/aio-commerce-lib-core/error"; import { AdobeCommerceHttpClient, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api"; import * as v from "valibot"; //#region source/errors.d.ts /** Base error for Admin UI SDK permission helper failures. */ declare class AdminUiPermissionError extends CommerceSdkErrorBase {} /** Options for {@link AdminUiPermissionDeniedError}. */ type AdminUiPermissionDeniedErrorOptions = CommerceSdkErrorOptions; /** Error thrown when the current user is denied access to an Admin UI SDK ACL resource. */ declare class AdminUiPermissionDeniedError extends AdminUiPermissionError { readonly resource: string; constructor(resource: string, options?: AdminUiPermissionDeniedErrorOptions); } //#endregion //#region source/api/lib/api-client.d.ts /** * Creates a new API client for the Admin UI API with all available operations. * * @param params - The parameters to build the Commerce HTTP client. */ declare function createAdminUiApiClient(params: CommerceHttpClientParams): import("@adobe/aio-commerce-lib-api").ApiClientRecord; unregisterExtension(httpClient: AdobeCommerceHttpClient, params: UnregisterExtensionParams, fetchOptions?: import("ky").Options): Promise; enableAdminUiSdk(httpClient: AdobeCommerceHttpClient, fetchOptions?: import("ky").Options): Promise; }>; /** * An API client for the Admin UI API with all operations. * @see {@link createAdminUiApiClient} */ type AdminUiApiClient = ReturnType; //#endregion //#region source/api/lib/permission-client.d.ts /** Options used to create an Admin UI SDK permission client. */ type AdminUiPermissionClientOptions = { /** The application's `metadata.id` value. When provided, `check()` and `require()` can be called with no resource argument. */ appId?: string; /** * Milliseconds to cache a permission result. Default: 300_000 (5 minutes). * Set to 0 to disable result caching. Note: in-flight deduplication of concurrent identical * requests is independent of this setting and remains active even when caching is disabled. */ cacheTtlMs?: number; /** Return false instead of throwing when a network or parse error occurs. Default: true. */ denyOnError?: boolean; /** Commerce HTTP client used to call the Admin UI SDK permission endpoint. */ httpClient: AdobeCommerceHttpClient; }; /** Client for checking the current user's Admin UI SDK resource permissions. */ type AdminUiPermissionClient = { /** * Checks whether the current user has the given ACL resource granted. * * @param resource - The ACL resource id to check. When omitted, defaults to the id derived from `appId`. * @returns `true` when granted; `false` when denied, on network or parse errors while `denyOnError` is * `true` (the default), or immediately when neither `resource` nor a valid `appId` is available. * @throws {@link AdminUiPermissionError} on HTTP 401, regardless of `denyOnError`. */ check: (resource?: string) => Promise; /** * Clears cached permission results. * * @param resource - The ACL resource id whose cached result to clear. When omitted, clears all cached * entries and in-flight tracking without aborting outstanding HTTP requests. */ invalidate: (resource?: string) => void; /** * Resolves when the current user has the given ACL resource granted. * * @param resource - The ACL resource id to require. When omitted, defaults to the id derived from `appId`. * @throws {@link AdminUiPermissionDeniedError} when the resource is explicitly denied. * @throws {@link AdminUiPermissionError} on HTTP 401, on network or parse errors while `denyOnError` is * `false`, or immediately when neither `resource` nor a valid `appId` is available. */ require: (resource?: string) => Promise; }; /** * Creates a client for checking Admin UI SDK ACL resources. * * @param options - Client configuration; see {@link AdminUiPermissionClientOptions}. * @returns An {@link AdminUiPermissionClient} for checking and requiring ACL resources. */ declare function getAdminUiPermissionClient(options: AdminUiPermissionClientOptions): AdminUiPermissionClient; //#endregion //#region source/api/extensions/schema.d.ts /** Parameters for POST /V1/adminuisdk/extension. */ declare const ExtensionRegistrationParamsSchema: v.ObjectSchema<{ readonly extensionName: v.SchemaWithPipe, v.MinLengthAction]>; readonly extensionTitle: v.SchemaWithPipe, v.MinLengthAction]>; readonly extensionWorkspace: v.SchemaWithPipe, v.MinLengthAction]>; }, undefined>; /** Parameters for DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}. */ declare const UnregisterExtensionParamsSchema: v.ObjectSchema<{ readonly extensionName: v.SchemaWithPipe, v.MinLengthAction]>; readonly workspaceName: v.SchemaWithPipe, v.MinLengthAction]>; }, undefined>; /** The parameters accepted by POST /V1/adminuisdk/extension. */ type ExtensionRegistrationParams = v.InferInput; /** The parameters accepted by DELETE /V1/adminuisdk/extension/{workspaceName}/{extensionName}. */ type UnregisterExtensionParams = v.InferInput; /** The response returned by POST /V1/adminuisdk/extension. */ type RegisterExtensionResponse = { extensionId: string; }; //#endregion //#region source/api/permissions/schema.d.ts /** Response shape returned by the Admin UI SDK permission check endpoint. */ declare const permissionCheckResponseSchema: v.ObjectSchema<{ readonly allowed: v.BooleanSchema; }, undefined>; /** Parsed Admin UI SDK permission check response. */ type PermissionCheckResponse = v.InferOutput; //#endregion export { AdminUiApiClient, type AdminUiEntity, AdminUiPermissionClient, AdminUiPermissionClientOptions, AdminUiPermissionDeniedError, AdminUiPermissionDeniedErrorOptions, AdminUiPermissionError, type ExtensionRegistrationParams, type ExtensionRegistrationParamsSchema, type PermissionCheckResponse, type RegisterExtensionResponse, type UnregisterExtensionParams, type UnregisterExtensionParamsSchema, createAdminUiApiClient, getAclResourceId, getAdminUiPermissionClient, type permissionCheckResponseSchema };