@microsurveysai/web-core

中文文档
0.1.6发布于 2026/11/02MITTypeScriptESM + CJS零依赖

Framework-agnostic browser runtime for MicroSurveys — on-device trigger evaluation, deterministic sampling, config cache, and offline ingest.

原始使用文档

@microsurveysai/web-core

Framework-agnostic browser runtime for MicroSurveys. Feed it events and identity; it decides on-device when a survey is eligible and emits it for a UI layer (e.g. @microsurveysai/react) to render. No UI, no framework dependencies.

A faithful port of the iOS SDK runtime — the same FNV-1a sampling on both platforms, so a given user buckets identically across web and mobile.

npm install @microsurveysai/web-core
import { createClient } from "@microsurveysai/web-core";

const client = createClient({ apiKey: "ms_live_…" });
client.start();

client.onPresent(({ survey, close }) => {
  // render `survey`, then call close({ answers, completed, dismissed })
});

client.track("checkout_completed", { plan: "pro" });

Most apps use a framework adapter (@microsurveysai/react) rather than this directly. See the repository README for the full picture.

License

MIT

版本与发布记录

@microsurveysai/web-core 共发布 7 个版本,首次发布于 2026/07/06;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.1.6latest2026/11/021 天前
0.1.52026/10/259 天前
0.1.42026/10/2014 天前
0.1.32026/10/1915 天前
0.1.22026/07/203 个月前
0.1.12026/07/063 个月前

关于 @microsurveysai/web-core 的常见问题

@microsurveysai/web-core 是什么?

MicroSurveys的框架无关的浏览器运行时——设备上的触发评估、确定性采样、配置缓存和离线摄取。

如何安装 @microsurveysai/web-core?

在项目目录运行 npm install @microsurveysai/web-core,或使用 pnpm add / yarn add / bun add。

@microsurveysai/web-core 支持 TypeScript 吗?

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

@microsurveysai/web-core 支持 ESM 还是 CommonJS?

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

@microsurveysai/web-core 可以商用吗?

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

@microsurveysai/web-core 还在维护吗?

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