@prodact.ai/sdk 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/sdk.global.js +2 -2
- package/dist/cdn/sdk.global.js.map +1 -1
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +110 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +110 -2
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -1198,7 +1198,15 @@ var UserFlowTracker = class {
|
|
|
1198
1198
|
console.warn("[UserFlow] Cannot track outside browser environment");
|
|
1199
1199
|
return null;
|
|
1200
1200
|
}
|
|
1201
|
+
console.log("[UserFlow] start() called", {
|
|
1202
|
+
enabled: this.config.enabled,
|
|
1203
|
+
samplingRate: this.config.samplingRate,
|
|
1204
|
+
currentState: this.state,
|
|
1205
|
+
apiUrl: this.apiUrl,
|
|
1206
|
+
hasSessionToken: !!this.sessionToken
|
|
1207
|
+
});
|
|
1201
1208
|
if (!this.config.enabled) {
|
|
1209
|
+
console.warn("[UserFlow] Tracking disabled by config");
|
|
1202
1210
|
return null;
|
|
1203
1211
|
}
|
|
1204
1212
|
if (this.state === "tracking") {
|
|
@@ -1979,11 +1987,13 @@ Check the Network tab in DevTools for more details.`
|
|
|
1979
1987
|
role: "assistant",
|
|
1980
1988
|
content: result.message?.content || result.response || "",
|
|
1981
1989
|
visualFlows: result.flows || [],
|
|
1982
|
-
images: result.images || []
|
|
1990
|
+
images: result.images || [],
|
|
1991
|
+
userFlows: result.userFlows || []
|
|
1983
1992
|
};
|
|
1984
1993
|
await this.log("info", "Chat response received", {
|
|
1985
1994
|
hasFlows: (result.flows || []).length > 0,
|
|
1986
|
-
hasImages: (result.images || []).length > 0
|
|
1995
|
+
hasImages: (result.images || []).length > 0,
|
|
1996
|
+
hasUserFlows: (result.userFlows || []).length > 0
|
|
1987
1997
|
});
|
|
1988
1998
|
this.emit("message", chatMessage);
|
|
1989
1999
|
return chatMessage;
|
|
@@ -2549,6 +2559,15 @@ Check the Network tab in DevTools for more details.`
|
|
|
2549
2559
|
*/
|
|
2550
2560
|
async initUserFlowTracking() {
|
|
2551
2561
|
try {
|
|
2562
|
+
console.log(
|
|
2563
|
+
"%c\u{1F4CA} Initializing User Flow Tracking",
|
|
2564
|
+
"background: #8b5cf6; color: #fff; padding: 2px 6px; border-radius: 3px;",
|
|
2565
|
+
{
|
|
2566
|
+
config: this.config.userFlows,
|
|
2567
|
+
apiUrl: this.config.apiUrl,
|
|
2568
|
+
sdkKey: this.config.sdkKey ? "present" : "missing"
|
|
2569
|
+
}
|
|
2570
|
+
);
|
|
2552
2571
|
this.userFlowTracker = new UserFlowTracker(this.config.userFlows);
|
|
2553
2572
|
this.userFlowTracker.initialize(
|
|
2554
2573
|
this.sessionToken,
|
|
@@ -2558,12 +2577,27 @@ Check the Network tab in DevTools for more details.`
|
|
|
2558
2577
|
const recordingSessionId = this.recorder?.getSessionId?.() || null;
|
|
2559
2578
|
const sessionId = await this.userFlowTracker.start(recordingSessionId);
|
|
2560
2579
|
if (sessionId) {
|
|
2580
|
+
console.log(
|
|
2581
|
+
"%c\u2705 User Flow Tracking Started",
|
|
2582
|
+
"background: #10b981; color: #fff; padding: 2px 6px; border-radius: 3px;",
|
|
2583
|
+
{ flowSessionId: sessionId, linkedRecordingSession: recordingSessionId }
|
|
2584
|
+
);
|
|
2561
2585
|
await this.log("info", "User flow tracking started", {
|
|
2562
2586
|
flowSessionId: sessionId,
|
|
2563
2587
|
linkedRecordingSession: recordingSessionId
|
|
2564
2588
|
});
|
|
2589
|
+
} else {
|
|
2590
|
+
console.warn(
|
|
2591
|
+
"%c\u26A0\uFE0F User Flow Tracking: No session ID returned",
|
|
2592
|
+
"background: #f59e0b; color: #000; padding: 2px 6px; border-radius: 3px;"
|
|
2593
|
+
);
|
|
2565
2594
|
}
|
|
2566
2595
|
} catch (error) {
|
|
2596
|
+
console.error(
|
|
2597
|
+
"%c\u274C User Flow Tracking Failed",
|
|
2598
|
+
"background: #ef4444; color: #fff; padding: 2px 6px; border-radius: 3px;",
|
|
2599
|
+
error
|
|
2600
|
+
);
|
|
2567
2601
|
await this.log("warn", "Failed to initialize user flow tracking", {
|
|
2568
2602
|
error: error instanceof Error ? error.message : String(error)
|
|
2569
2603
|
});
|
|
@@ -3472,6 +3506,80 @@ function ProduckChat({
|
|
|
3472
3506
|
]
|
|
3473
3507
|
},
|
|
3474
3508
|
imgIdx
|
|
3509
|
+
)) }),
|
|
3510
|
+
msg.userFlows && msg.userFlows.length > 0 && /* @__PURE__ */ jsx3("div", { style: { marginTop: "12px" }, children: msg.userFlows.filter((uf) => uf.hasReplay).slice(0, 2).map((userFlow, ufIdx) => /* @__PURE__ */ jsxs2(
|
|
3511
|
+
"div",
|
|
3512
|
+
{
|
|
3513
|
+
style: {
|
|
3514
|
+
marginTop: ufIdx > 0 ? "8px" : 0,
|
|
3515
|
+
padding: "12px",
|
|
3516
|
+
borderRadius: "8px",
|
|
3517
|
+
border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`,
|
|
3518
|
+
backgroundColor: isDark ? "#1f2937" : "#f9fafb"
|
|
3519
|
+
},
|
|
3520
|
+
children: [
|
|
3521
|
+
/* @__PURE__ */ jsxs2("div", { style: {
|
|
3522
|
+
display: "flex",
|
|
3523
|
+
alignItems: "center",
|
|
3524
|
+
justifyContent: "space-between",
|
|
3525
|
+
marginBottom: "8px"
|
|
3526
|
+
}, children: [
|
|
3527
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
3528
|
+
/* @__PURE__ */ jsx3("span", { style: { fontSize: "16px" }, children: "\u{1F3AC}" }),
|
|
3529
|
+
/* @__PURE__ */ jsx3("span", { style: {
|
|
3530
|
+
fontWeight: 600,
|
|
3531
|
+
fontSize: "13px",
|
|
3532
|
+
color: isDark ? "#f3f4f6" : "#111827"
|
|
3533
|
+
}, children: userFlow.title })
|
|
3534
|
+
] }),
|
|
3535
|
+
/* @__PURE__ */ jsxs2("span", { style: {
|
|
3536
|
+
fontSize: "11px",
|
|
3537
|
+
padding: "2px 6px",
|
|
3538
|
+
backgroundColor: primaryColor + "20",
|
|
3539
|
+
color: primaryColor,
|
|
3540
|
+
borderRadius: "4px"
|
|
3541
|
+
}, children: [
|
|
3542
|
+
userFlow.eventCount,
|
|
3543
|
+
" steps"
|
|
3544
|
+
] })
|
|
3545
|
+
] }),
|
|
3546
|
+
/* @__PURE__ */ jsx3("p", { style: {
|
|
3547
|
+
fontSize: "12px",
|
|
3548
|
+
color: isDark ? "#9ca3af" : "#6b7280",
|
|
3549
|
+
marginBottom: "10px",
|
|
3550
|
+
lineHeight: 1.4
|
|
3551
|
+
}, children: userFlow.description }),
|
|
3552
|
+
/* @__PURE__ */ jsxs2(
|
|
3553
|
+
"button",
|
|
3554
|
+
{
|
|
3555
|
+
onClick: () => {
|
|
3556
|
+
const replayUrl = `${window.location.origin}/recordings/${userFlow.recordingId}`;
|
|
3557
|
+
window.open(replayUrl, "_blank", "width=1200,height=800");
|
|
3558
|
+
},
|
|
3559
|
+
style: {
|
|
3560
|
+
display: "flex",
|
|
3561
|
+
alignItems: "center",
|
|
3562
|
+
gap: "6px",
|
|
3563
|
+
padding: "8px 12px",
|
|
3564
|
+
backgroundColor: primaryColor,
|
|
3565
|
+
color: "#fff",
|
|
3566
|
+
border: "none",
|
|
3567
|
+
borderRadius: "6px",
|
|
3568
|
+
fontSize: "12px",
|
|
3569
|
+
fontWeight: 500,
|
|
3570
|
+
cursor: "pointer",
|
|
3571
|
+
width: "100%",
|
|
3572
|
+
justifyContent: "center"
|
|
3573
|
+
},
|
|
3574
|
+
children: [
|
|
3575
|
+
/* @__PURE__ */ jsx3("span", { children: "\u25B6\uFE0F" }),
|
|
3576
|
+
/* @__PURE__ */ jsx3("span", { children: "Watch Session Replay" })
|
|
3577
|
+
]
|
|
3578
|
+
}
|
|
3579
|
+
)
|
|
3580
|
+
]
|
|
3581
|
+
},
|
|
3582
|
+
userFlow.id || ufIdx
|
|
3475
3583
|
)) })
|
|
3476
3584
|
]
|
|
3477
3585
|
}
|