@djust-b2b/djust-front-sdk 1.21.6 → 1.21.7
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.
|
@@ -37,6 +37,7 @@ exports.enhancedFetch = exports.updateConfiguration = exports.initialize = void
|
|
|
37
37
|
const qs = __importStar(require("query-string"));
|
|
38
38
|
const Sentry = __importStar(require("@sentry/browser"));
|
|
39
39
|
require("isomorphic-fetch");
|
|
40
|
+
const SDK_VERSION = require("../package.json").version;
|
|
40
41
|
let clientConfig = {
|
|
41
42
|
baseUrl: "",
|
|
42
43
|
clientId: "",
|
|
@@ -51,9 +52,10 @@ const initialize = (initConfig) => {
|
|
|
51
52
|
};
|
|
52
53
|
if (clientConfig.dsn) {
|
|
53
54
|
Sentry.init({
|
|
54
|
-
dsn: clientConfig.dsn
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
dsn: clientConfig.dsn ||
|
|
56
|
+
"https://39ef5198e24fa0ec7b743c460bd1ca63@o1191347.ingest.us.sentry.io/4508879498575872",
|
|
57
|
+
environment: `${clientConfig.clientName}-${clientConfig.env}`,
|
|
58
|
+
release: `${SDK_VERSION || "unknown"}`,
|
|
57
59
|
integrations: [
|
|
58
60
|
Sentry.browserTracingIntegration(),
|
|
59
61
|
Sentry.replayIntegration(),
|
|
@@ -61,6 +63,7 @@ const initialize = (initConfig) => {
|
|
|
61
63
|
tracesSampleRate: 1.0,
|
|
62
64
|
replaysSessionSampleRate: 0.1,
|
|
63
65
|
replaysOnErrorSampleRate: 1.0,
|
|
66
|
+
profilesSampleRate: 1.0,
|
|
64
67
|
});
|
|
65
68
|
console.log(`[Djust SDK] Sentry initialized in ${clientConfig.clientName || "unknown"} environment: ${clientConfig.env || "unknown"}.`);
|
|
66
69
|
}
|
|
@@ -157,11 +160,20 @@ const enhancedFetch = async ({ path, method, params = {}, body, }) => {
|
|
|
157
160
|
const error = new Error(`[Djust SDK] HTTP error ${response.status}: ${errorMessage}`);
|
|
158
161
|
Sentry.captureException(error, {
|
|
159
162
|
extra: {
|
|
160
|
-
url:
|
|
163
|
+
url: fullPath,
|
|
161
164
|
method,
|
|
162
165
|
response: errorMessage,
|
|
163
166
|
status: response.status,
|
|
164
167
|
env: clientConfig.env,
|
|
168
|
+
headers: (() => {
|
|
169
|
+
const headersObj = {};
|
|
170
|
+
requestHeaders.forEach((value, key) => {
|
|
171
|
+
headersObj[key] = value;
|
|
172
|
+
});
|
|
173
|
+
return headersObj;
|
|
174
|
+
})(),
|
|
175
|
+
body: body ? body : null,
|
|
176
|
+
params,
|
|
165
177
|
},
|
|
166
178
|
});
|
|
167
179
|
throw error;
|