feat(sdk): 0.2.1——track补归属+business接线

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-18 23:47:44 +08:00
parent 7b670f274c
commit fea19c15cd
5 changed files with 132 additions and 15 deletions
+13
View File
@@ -427,6 +427,19 @@ describe("business / startBusinessTracking", () => {
expect(ids).toEqual(["cf7-156", "cf7-42", "cf7-0"]);
});
it("form_id 回归(T4 审查遗留):11 位 ID 不截断匹配 → cf7-0(服务端 cf7-N 上限 10 位)", () => {
setUrl("/fid11");
const t = mkTransport("biz-fid11");
startPageSession(t);
startBusinessTracking(t);
const form = mkForm({ action: "#wpcf7-f12345678901" });
trusted("focusin", form.querySelector("input")!);
t.flush();
const fss = fetchedEvents("biz-fid11").filter((e) => e.event_name === "form_start");
expect(fss).toHaveLength(1);
expect(fss[0].properties.form_id).toBe("cf7-0"); // (?!\d) 拒绝截断——按解析失败归 cf7-0
});
// ---- product_view(spec §1.3:非锚定段匹配 + onSegmentChange 切段) ----
it("product_view:init 时 /product/slug/ 判定 → inferred=true rule_version=v1 + 顶层归属", () => {