@descope/outbound-applications-widget

中文文档
0.7.21发布于 2026/11/08MITTypeScriptESM + CJS近 30 天下载 126.3万

Descope applications portal widget

原始使用文档
文档目录13 节
  1. Setup
  2. Create an .env file
  3. Example
  4. Authenticate
  5. Start the widget
  6. Architecture
  7. Project Structure
  8. API
  9. Mixins
  10. State
  11. Drivers
  12. Dev
  13. Use mock screens

@descope/outbound-applications-widget

Setup

Create an .env file

In the widget package create an .env file which includes;

DESCOPE_BASE_URL=   # env base url
DESCOPE_PROJECT_ID= # project ID
DESCOPE_WIDGET_ID=  # default: outbound-applications-widget
DEBUG_MODE=         # "true" / "false", default: "false"
DESCOPE_THEME=      # "light" / "dark" / "os", default: "light"

Example

// replace x.x.x with the latest release of the widget: https://www.npmjs.com/package/@descope/outbound-applications-widget
<script src="https://descopecdn.com/npm/@descope/[email protected]/dist/index.js"></script>
<descope-outbound-applications-widget
  base-url="<DESCOPE_BASE_URL>"
  project-id="<DESCOPE_PROJECT_ID>"
  tenant="<DESCOPE_TENANT>"
  debug="<DEBUG_MODE>"
  theme="<DESCOPE_THEME>"
  widget-id="<DESCOPE_WIDGET_ID>"
></descope-outbound-applications-widget>

<script>
  function onLogout(error) {
    window.location.reload();
  }
  const descopeWidgetEle = document.getElementsByTagName('descope-outbound-applications-widget')[0];
  descopeWidgetEle.logout = onLogout;
</script>

Authenticate

In order to work with the widget, you must be logged in In case you are not authenticated, a login flow will run first, and after logging in, the widget will be rendered

Start the widget

run npm start to start the widget.

Architecture

Project Structure

  • /app - contains index.html
  • /lib - widget's source code
  • lib/widget - widget related implementations
  • lib/widget/api - Logic related to API calls
  • lib/widget/mixins - Widget specific logic
  • lib/widget/state - State management logic

API


Mixins

The widget is composed of mixins, each mixin contains specific logic parts, and sometime exposes an API that can be used in other mixins.

Mixins can be composed on top of each other, so we can create new mixins by composing several mixins together.

Mixins Creators

Functions that create mixins, can get a configuration, and returns the mixin functions.

Singleton Mixin

Since mixins are composable, in some cases we want to make sure a mixin is loaded only once. For example: When there is no need for its logic to run multiple times when composed in different mixins.

For this case we have a wrapper function (createSingletonMixin) to ensure that a mixin is loaded only once, regardless how many times it will be composed.

Mixins should be wrapped with the createSingletonMixin wrapper function, unless there is a reason for running the mixin's logic multiple times.

State

We're using several tools to handle the widget's state:

  • Redux Toolkit for the widget's state management.
  • Redux Thunk for API calls and async operations we're using
  • Reselect to compute derived data without hitting performance or triggering state recalculation when state is not mutated.

Drivers

An abstraction layer that provides an API for components, and enables handling interactions with components within the widget.

The motivation to use drivers is to decouple the widget's code from the component's implementation, and therefore it's important to interact with components only using drivers (and not relying on component's implementation details).

Dev

Use mock screens

Since screen are fetched dynamically, when developing a new screen for the widget you will probably want to use mock templates. To do so, simply replace the call to fetchWidgetPage with a string which includes your HTML.

版本与发布记录

@descope/outbound-applications-widget 共发布 222 个版本,首次发布于 2025/08/04;过去 12 个月发布了 168 个版本。

版本发布日期距今
0.7.21latest2026/11/083 天前
0.0.0-next-8d9f5c5a-20261108next2026/11/083 天前
0.0.0-next-4d93b95d-202611052026/11/056 天前
0.7.202026/11/056 天前
0.0.0-next-41289441-202611042026/11/047 天前
0.7.192026/11/038 天前

关于 @descope/outbound-applications-widget 的常见问题

@descope/outbound-applications-widget 是什么?

Descope applications portal widget

如何安装 @descope/outbound-applications-widget?

在项目目录运行 npm install @descope/outbound-applications-widget,或使用 pnpm add / yarn add / bun add。

@descope/outbound-applications-widget 支持 TypeScript 吗?

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

@descope/outbound-applications-widget 支持 ESM 还是 CommonJS?

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

@descope/outbound-applications-widget 可以商用吗?

@descope/outbound-applications-widget 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@descope/outbound-applications-widget 的下载量有多少?

根据 npm 官方下载统计,@descope/outbound-applications-widget 在 2026/10/12 – 2026/11/10 这 30 天内被下载 1,263,417 次,日均约 42,114 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@descope/outbound-applications-widget 还在维护吗?

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