@coveo/atomic-hosted-page

中文文档
1.2.64发布于 2026/11/03TypeScriptES Module构建来源已验证近 30 天下载 6028

Web Component used to inject a Coveo Hosted Search Page in the DOM.

原始使用文档
文档目录12 节
  1. Installation
  2. Via npm
  3. Via CDN
  4. Usage
  5. Import and Use in JavaScript
  6. Using the CDN
  7. Properties
  8. hosted-type
  9. Initialization Options
  10. Example
  11. Basic Example
  12. License

Atomic Hosted Page

The Atomic Hosted Page package provides a Web Component, <atomic-hosted-ui>, that integrates a Coveo Hosted Search Page into your web application. This component leverages the Search Interfaces API.


Installation

Via npm

To use the <atomic-hosted-ui> component in your project, install it via npm:

npm install @coveo/atomic-hosted-page

Via CDN

Alternatively, you can use the component directly from the CDN:

<script
  type="module"
  src="https://static.cloud.coveo.com/atomic-hosted-page/v1/atomic-hosted-page/atomic-hosted-page.esm.js"
></script>

Usage

Import and Use in JavaScript

  1. Import the component into your application:

    import '@coveo/atomic-hosted-page/dist/components/atomic-hosted-ui/atomic-hosted-ui.js';
    
  2. Add the component to your HTML and initialize it with the required options:

    <atomic-hosted-ui hosted-type="code"></atomic-hosted-ui>
    
    const hostedUI = document.querySelector('atomic-hosted-ui');
    hostedUI.initialize({
      pageId: 'your-hosted-page-id',
      organizationId: 'your-organization-id',
      accessToken: 'your-access-token',
    });
    

Using the CDN

  1. Add the component script from the CDN to your HTML:

    <script
      type="module"
      src="https://static.cloud.coveo.com/atomic-hosted-page/v1/atomic-hosted-page/atomic-hosted-page.esm.js"
    ></script>
    
  2. Include the component in your HTML and initialize it:

    <atomic-hosted-ui hosted-type="builder"></atomic-hosted-ui>
    <script>
      const hostedUI = document.querySelector('atomic-hosted-ui');
      hostedUI.initialize({
        pageId: 'example-page-id',
        organizationId: 'my-organization-id',
        accessToken: 'your-api-key',
      });
    </script>
    

Properties

hosted-type

  • Type: 'trial' | 'builder' | 'code'
  • Default: 'code'
  • Description: Specifies the type of hosted search page to load:
    • trial: Loads a trial page.
    • builder: Loads a builder page.
    • code: Loads a custom code page.

Initialization Options

The initialize() method requires the following options:

OptionTypeRequiredDescription
pageIdstringYesThe unique identifier of the hosted search page.
organizationIdstringYesThe Coveo organization ID.
accessTokenstringYesThe API key or token used for authorization.
platformUrlstringNoThe URL of the Coveo platform. Defaults to https://platform.cloud.coveo.com.

Example

Basic Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Atomic Hosted Page Example</title>
    <script
      type="module"
      src="https://static.cloud.coveo.com/atomic-hosted-page/v1/atomic-hosted-page/atomic-hosted-page.esm.js"
    ></script>
  </head>
  <body>
    <atomic-hosted-ui hosted-type="builder"></atomic-hosted-ui>
    <script>
      const hostedUI = document.querySelector('atomic-hosted-ui');
      hostedUI.initialize({
        pageId: 'example-page-id',
        organizationId: 'my-organization-id',
        accessToken: 'your-api-key',
      });
    </script>
  </body>
</html>

License

This project is licensed under the Apache 2.0 License.

版本与发布记录

@coveo/atomic-hosted-page 共发布 3,429 个版本,首次发布于 2023/02/16;过去 12 个月发布了 43 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.2.64latest2026/11/038 天前
1.2.632026/10/2022 天前
1.2.622026/10/1428 天前
1.2.612026/10/061 个月前
1.2.602026/09/301 个月前
1.2.592026/09/231 个月前

其他发布通道:v2-latest → 1.0.10。

关于 @coveo/atomic-hosted-page 的常见问题

@coveo/atomic-hosted-page 是什么?

Web Component used to inject a Coveo Hosted Search Page in the DOM.

如何安装 @coveo/atomic-hosted-page?

在项目目录运行 npm install @coveo/atomic-hosted-page,或使用 pnpm add / yarn add / bun add。

@coveo/atomic-hosted-page 支持 TypeScript 吗?

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

@coveo/atomic-hosted-page 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@coveo/atomic-hosted-page 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^20.9.0 || ^22.11.0 || ^24.11.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@coveo/atomic-hosted-page 可以商用吗?

@coveo/atomic-hosted-page 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@coveo/atomic-hosted-page 的下载量有多少?

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

@coveo/atomic-hosted-page 还在维护吗?

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