@adobe/aio-commerce-sdk

中文文档
2.1.0发布于 2026/11/13Apache-2.0TypeScriptESM + CJS近 30 天下载 4956

Meta-package re-exporting Adobe Commerce SDK libraries for Adobe App Builder applications.

原始使用文档
文档目录6 节
  1. Installation
  2. Overview
  3. Current Libraries
  4. Usage
  5. Benefits
  6. Contributing

@adobe/aio-commerce-sdk

Meta-package that re-exports Adobe Commerce SDK libraries for Adobe App Builder applications.

This package serves as a convenient entry point for accessing commonly used Adobe Commerce libraries in App Builder projects, similar to how @adobe/aio-sdk works for general App Builder development.

Installation

npm install @adobe/aio-commerce-sdk

Overview

The @adobe/aio-commerce-sdk is a meta-package that consolidates and re-exports the most commonly used Adobe Commerce libraries for App Builder applications. Rather than installing and importing multiple individual packages, you can use this single package to access all the essential Commerce functionality.

Current Libraries

The SDK currently includes:

Usage

Import directly from a specific library sub-path:

import {
  assertImsAuthParams,
  getImsAuthProvider,
  assertIntegrationAuthParams,
  getIntegrationAuthProvider,
} from "@adobe/aio-commerce-sdk/auth"; // <-- This is like @adobe/aio-commerce-lib-auth

import { AdobeCommerceHttpClient } from "@adobe/aio-commerce-sdk/api"; // <-- This is like @adobe/aio-commerce-lib-api
import {
  createCommerceEventsApiClient,
  updateEventingConfiguration,
} from "@adobe/aio-commerce-sdk/events/commerce"; // <-- This is like @adobe/aio-commerce-lib-events/commerce
import {
  createCommerceWebhooksApiClient,
  subscribeWebhook,
} from "@adobe/aio-commerce-sdk/webhooks/api"; // <-- This is like @adobe/aio-commerce-lib-webhooks/api

// Validate and create IMS auth provider
assertImsAuthParams(params);
const imsAuth = getImsAuthProvider(params);

const commerceHttpClientConfig = {
  auth: imsAuth,
  config: {
    baseUrl: "https://na1-sandbox.api.commerce.adobe.com/{tenantId}/",
    flavor: "saas",
  },
};

const updateEventingConfigurationParams = {
  enabled: true,
  environmentId: "my-environment-id",
  instanceId: "my-instance-id",
  merchantId: "my-merchant-id",
  providerId: "my-provider-id",
  workspaceConfiguration: {
    // ...
  },
};

// Use the raw HTTP client
const commerceClient = new AdobeCommerceHttpClient(commerceHttpClientConfig);
await updateEventingConfiguration(
  commerceClient,
  updateEventingConfigurationParams,
);

// Or create an API client with a pre-bound HTTP client.
const commerceEventsClient = createCommerceEventsApiClient(
  commerceHttpClientConfig,
);

await commerceEventsClient.updateEventingConfiguration(
  updateEventingConfigurationParams,
);

// Create a webhooks API client
const commerceWebhooksClient = createCommerceWebhooksApiClient(
  commerceHttpClientConfig,
);

// Subscribe to a webhook
await commerceWebhooksClient.subscribeWebhook({
  webhook_method: "plugin.order.api.order_created",
  webhook_type: "after",
  batch_name: "default",
  hook_name: "order_created",
  url: "https://example.com/webhook",
  method: "POST",
});

Invoice view-button helpers are available from @adobe/aio-commerce-sdk/admin-ui/invoice-view-buttons. The matching useInvoiceViewButtonContext hook is available from @adobe/aio-commerce-sdk/admin-ui/web. See the Admin UI usage guide for iframe (view) and runtime action (worker) examples.

Credit memo view-button helpers are available from @adobe/aio-commerce-sdk/admin-ui/credit-memo-view-buttons. The matching useCreditMemoViewButtonContext hook is available from @adobe/aio-commerce-sdk/admin-ui/web. See the Admin UI usage guide for iframe (view) and runtime action (worker) examples.

Return (RMA) view-button helpers are available from @adobe/aio-commerce-sdk/admin-ui/rma-view-buttons. The matching useRmaViewButtonContext hook is available from @adobe/aio-commerce-sdk/admin-ui/web. See the Admin UI usage guide for iframe (view) and runtime action (worker) examples.

Benefits

  • Simplified dependency management: Install one package instead of multiple individual libraries
  • Consistent versioning: All included libraries are tested together for compatibility
  • Better developer experience: Single import source for common Commerce functionality
  • Tree-shaking support: Both import patterns support dead code elimination
  • Type safety: Full TypeScript support with type definitions included

Contributing

This package is part of the Adobe Commerce SDK monorepo. See the Contributing Guide and Development Guide for development setup and guidelines.

Refer to this section of the development guide if you want to add your library to the SDK: Add it to the SDK (optional)

版本与发布记录

@adobe/aio-commerce-sdk 共发布 77 个版本,首次发布于 2025/07/07;过去 12 个月发布了 67 个版本。

版本发布日期距今
2.1.0latest2026/11/13今天
2.1.0-beta-20261112165514beta2026/11/13今天
2.1.0-alpha-20261111132333alpha2026/11/112 天前
2.1.0-alpha-202611111050532026/11/112 天前
2.1.0-alpha-202611102044562026/11/112 天前
2.1.0-alpha-202611101714572026/11/112 天前

关于 @adobe/aio-commerce-sdk 的常见问题

@adobe/aio-commerce-sdk 是什么?

Meta-package re-exporting Adobe Commerce SDK libraries for Adobe App Builder applications.

如何安装 @adobe/aio-commerce-sdk?

在项目目录运行 npm install @adobe/aio-commerce-sdk,或使用 pnpm add / yarn add / bun add。

@adobe/aio-commerce-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adobe/aio-commerce-sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@adobe/aio-commerce-sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22 <=26。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@adobe/aio-commerce-sdk 可以商用吗?

@adobe/aio-commerce-sdk 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/aio-commerce-sdk 的下载量有多少?

根据 npm 官方下载统计,@adobe/aio-commerce-sdk 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,956 次,日均约 165 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adobe/aio-commerce-sdk 还在维护吗?

最新版本 2.1.0 发布于 2026/11/13(今天);至今共发布 77 个版本,其中过去 12 个月发布了 67 个;首次发布于 2025/07/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。