@mhosaic/feedback 0.12.2 → 0.13.0
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/{chunk-TBT2OODO.mjs → chunk-64HXWJCH.mjs} +33 -7
- package/dist/chunk-64HXWJCH.mjs.map +1 -0
- package/dist/embed.min.js +4 -4
- package/dist/embed.min.js.map +1 -1
- package/dist/error-tracking.d.ts +1 -1
- package/dist/{index-DK9sbiTf.d.ts → index-snrtK3_E.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +1 -1
- package/dist/replay.d.ts +1 -1
- package/dist/{types-ZCdu32FU.d.ts → types-BrsktaE1.d.ts} +11 -0
- package/dist/webvitals.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-TBT2OODO.mjs.map +0 -1
|
@@ -43,6 +43,13 @@ function createApiClient(options) {
|
|
|
43
43
|
if (payload.synthetic) {
|
|
44
44
|
headers["X-Mhosaic-Capture-Source"] = "error-tracking";
|
|
45
45
|
}
|
|
46
|
+
const signed = options.getSignedIdentity?.();
|
|
47
|
+
if (signed && signed.userHash && signed.exp && payload.user?.id) {
|
|
48
|
+
headers["X-Mhosaic-User"] = String(payload.user.id);
|
|
49
|
+
headers["X-Mhosaic-User-Hmac"] = signed.userHash;
|
|
50
|
+
headers["X-Mhosaic-User-Exp"] = String(signed.exp);
|
|
51
|
+
if (signed.email) headers["X-Mhosaic-User-Email"] = signed.email;
|
|
52
|
+
}
|
|
46
53
|
const response = await fetcher(`${endpoint}/api/feedback/v1/reports/`, {
|
|
47
54
|
method: "POST",
|
|
48
55
|
headers,
|
|
@@ -55,10 +62,17 @@ function createApiClient(options) {
|
|
|
55
62
|
return response.json();
|
|
56
63
|
}
|
|
57
64
|
function widgetHeaders(externalId) {
|
|
58
|
-
|
|
65
|
+
const headers = {
|
|
59
66
|
Authorization: `Bearer ${options.apiKey}`,
|
|
60
67
|
"X-Mhosaic-User": externalId
|
|
61
68
|
};
|
|
69
|
+
const signed = options.getSignedIdentity?.();
|
|
70
|
+
if (signed && signed.userHash && signed.exp) {
|
|
71
|
+
headers["X-Mhosaic-User-Hmac"] = signed.userHash;
|
|
72
|
+
headers["X-Mhosaic-User-Exp"] = String(signed.exp);
|
|
73
|
+
if (signed.email) headers["X-Mhosaic-User-Email"] = signed.email;
|
|
74
|
+
}
|
|
75
|
+
return headers;
|
|
62
76
|
}
|
|
63
77
|
async function listMine(externalId) {
|
|
64
78
|
const response = await fetcher(`${endpoint}/api/feedback/v1/reports/widget/mine/`, {
|
|
@@ -4697,14 +4711,26 @@ function createFeedback(config) {
|
|
|
4697
4711
|
const capture = installCapture({
|
|
4698
4712
|
...config.sanitizeUrl !== void 0 && { sanitizeUrl: config.sanitizeUrl }
|
|
4699
4713
|
});
|
|
4714
|
+
let user = config.user;
|
|
4715
|
+
let metadata = config.metadata ?? {};
|
|
4700
4716
|
const api = createApiClient({
|
|
4701
4717
|
apiKey: config.apiKey,
|
|
4702
4718
|
endpoint: config.endpoint,
|
|
4703
4719
|
...config.fetchImpl !== void 0 && { fetch: config.fetchImpl },
|
|
4704
|
-
...config.beforeSend !== void 0 && { beforeSend: config.beforeSend }
|
|
4720
|
+
...config.beforeSend !== void 0 && { beforeSend: config.beforeSend },
|
|
4721
|
+
// v0.13: the API client reads this on every request so a late
|
|
4722
|
+
// `identify({userHash, exp, ...})` lights up signed headers
|
|
4723
|
+
// immediately on subsequent calls. Returns null when the host
|
|
4724
|
+
// hasn't supplied a signature (legacy unsigned path).
|
|
4725
|
+
getSignedIdentity: () => {
|
|
4726
|
+
if (!user || !user.userHash || !user.exp || !user.email) return null;
|
|
4727
|
+
return {
|
|
4728
|
+
userHash: user.userHash,
|
|
4729
|
+
exp: user.exp,
|
|
4730
|
+
email: user.email
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4705
4733
|
});
|
|
4706
|
-
let user = config.user;
|
|
4707
|
-
let metadata = config.metadata ?? {};
|
|
4708
4734
|
const transformers = [];
|
|
4709
4735
|
const host = document.createElement("div");
|
|
4710
4736
|
host.className = "mhosaic-feedback";
|
|
@@ -4732,8 +4758,8 @@ function createFeedback(config) {
|
|
|
4732
4758
|
capture_method: captureMethod,
|
|
4733
4759
|
technical_context
|
|
4734
4760
|
};
|
|
4735
|
-
if ("0.
|
|
4736
|
-
payload.widget_version = "0.
|
|
4761
|
+
if ("0.13.0") {
|
|
4762
|
+
payload.widget_version = "0.13.0";
|
|
4737
4763
|
}
|
|
4738
4764
|
if (manualScreenshot) payload.screenshot = manualScreenshot;
|
|
4739
4765
|
if (values.synthetic) payload.synthetic = true;
|
|
@@ -4819,4 +4845,4 @@ function createFeedback(config) {
|
|
|
4819
4845
|
export {
|
|
4820
4846
|
createFeedback
|
|
4821
4847
|
};
|
|
4822
|
-
//# sourceMappingURL=chunk-
|
|
4848
|
+
//# sourceMappingURL=chunk-64HXWJCH.mjs.map
|