@fastenhealth/fasten-stitch-element-react

中文文档
5.0.1发布于 2026/10/28MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 4854

为 Fasten 连接反应 SDK – 将健康数据连接嵌入任何 React 网络应用程序

中文使用文档
文档目录4 节
  1. 安装
  2. 使用量
  3. 道具
  4. 反馈

fasten_view

@fastenhealth/fasten-stitch-element-resact) 互联网档案馆的存檔,存档日期2013-12-21

反应 SDK 用于 紧接连接 将健康数据连接纳入任何反应应用程序.

渲染一个启动按钮,打开一个模式对话框,其中包含一个iframe中的快取连接部件。 处理您的应用程序和部件之间的通讯 postMessage。 。 。 .

安装

将软件包添加到您的项目及其反应依赖性 :

npm install @fastenhealth/fasten-stitch-element-react
# or
yarn add @fastenhealth/fasten-stitch-element-react

反应 18+ 需要作为同伴依赖.

使用量

import { FastenStitchElement } from '@fastenhealth/fasten-stitch-element-react';

const CUSTOMER_PUBLIC_ID = 'public_test_...';

function App() {
  return (
    <FastenStitchElement
      publicId={CUSTOMER_PUBLIC_ID}
      externalId="user-123"
      email="[email protected]"
      brandingTheme="dark"
      brandingAccentColor="#E04E3C"
      brandingCompanyName="your brand"
      brandingLogoUrl="https://your-brand.com/assets/logo.svg"
      onEventBus={(event) => {
          console.log('Fasten event:', event.data);
      }}
    />
  );
}

道具

组件接受以下选项(匹配 Stitch.js 部件配置):

Prop类型默认说明
publicIdstring—— 说(必须) 您的 Fasten 连接公共ID .
externalIdstring—— 说患者/用户的外部标识符.
emailstring—— 说患者电子邮件用于预先流行支持的表格和签名流.
reconnectOrgConnectionIdstring—— 说已存在的 org- 连接- id 用于重接流量 .
brandIdstring—— 说预选特定品牌.
portalIdstring—— 说预选特定门户.
endpointIdstring—— 说预选特定终点 .
searchQuerystring—— 说预填搜索输入.
searchSortBystring—— 说将搜索结果排序为 .
searchSortByOptsstring—— 说排序选项的 JSON 字符串( Base64URL- 自动编码) .
searchOnlybooleantrue只允许搜索( 无签名) .
showSplashbooleanfalse在搜索前显示溅射屏幕 .
tefcaModebooleanfalse启用TEFCA模式(身份验证+记录定位).
tefcaCspPromptForcebooleanfalse以TEFCA模式强制CSP选择提示.
brandingThemestring—— 说部件主题, 例如 . "dark"发送为 branding-theme。 。 。 .
brandingAccentColorstring—— 说部件口音颜色,例如:. "#E04E3C"发送为 branding-accent-color。 。 。 .
brandingCompanyNamestring—— 说部件中显示的公司名称 。 发送为 branding-company-name。 。 。 .
brandingLogoUrlstring—— 说公司标志 URL. 发送为 branding-logo-url。 。 。 .
eventTypesstring—— 说要订阅的逗号分隔事件类型 .
onEventBus(event: MessageEvent) => void—— 说回调部件后消息事件 .
staticBackdropbooleanfalse防止背景点击关闭 .
buttonLabelstring"Share Records"默认按钮文字( 当 children 页:1.
buttonClassNamestring—— 说启动按钮的CSS类.
buttonStyleCSSProperties—— 说触发按钮的内置样式.
dialogClassNamestring—— 说用于 <dialog> 键.
dialogStyleCSSProperties—— 说内嵌样式 <dialog>。 。 。 .
iframeClassNamestring—— 说用于 <iframe> 键.
iframeStyleCSSProperties—— 说内嵌样式 <iframe>。 。 。 .
environmentstring"production""production", (中文(简体) ), "development", (中文(简体) ), "local",或者一个完整的 URL.
childrenReactNode—— 说自定义触发元素( 替换默认按钮) .

反馈

请打开任何错误或请求的问题 。 你的反馈会帮助我们稳定公共SDK接口.

版本与发布记录

@fastenhealth/fasten-stitch-element-react 共发布 6 个版本,首次发布于 2026/05/08;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.0.1latest2026/10/2816 天前
5.0.02026/10/2817 天前
1.0.42026/06/264 个月前
1.0.22026/05/185 个月前
1.0.12026/05/175 个月前
1.0.02026/05/086 个月前

关于 @fastenhealth/fasten-stitch-element-react 的常见问题

@fastenhealth/fasten-stitch-element-react 是什么?

为 Fasten 连接反应 SDK – 将健康数据连接嵌入任何 React 网络应用程序

如何安装 @fastenhealth/fasten-stitch-element-react?

在项目目录运行 npm install @fastenhealth/fasten-stitch-element-react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.0.0)、react-dom(>=18.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fastenhealth/fasten-stitch-element-react 支持 TypeScript 吗?

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

@fastenhealth/fasten-stitch-element-react 支持 ESM 还是 CommonJS?

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

@fastenhealth/fasten-stitch-element-react 可以商用吗?

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

@fastenhealth/fasten-stitch-element-react 的下载量有多少?

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

@fastenhealth/fasten-stitch-element-react 还在维护吗?

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