@basis-theory/basis-theory-js 4.23.0 → 4.23.1
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/common/constants.js +1 -1
- package/common/logging.js +25 -26
- package/package.json +1 -1
package/common/constants.js
CHANGED
|
@@ -28,7 +28,7 @@ const DEFAULT_ELEMENTS_BASE_URL = `https://${"js.basistheory.com/hosted-elements
|
|
|
28
28
|
exports.DEFAULT_ELEMENTS_BASE_URL = DEFAULT_ELEMENTS_BASE_URL;
|
|
29
29
|
const DD_TOKEN = "pub5f53501515584007899577554c4aeda6";
|
|
30
30
|
exports.DD_TOKEN = DD_TOKEN;
|
|
31
|
-
const DD_GIT_SHA = "
|
|
31
|
+
const DD_GIT_SHA = "c87a19b595c31ac80783989cd97d882a8cbd74d8";
|
|
32
32
|
exports.DD_GIT_SHA = DD_GIT_SHA;
|
|
33
33
|
const CLIENT_BASE_PATHS = {
|
|
34
34
|
tokens: 'tokens',
|
package/common/logging.js
CHANGED
|
@@ -12,39 +12,38 @@ const logger = (() => {
|
|
|
12
12
|
let isTelemetryEnabled = undefined !== 'test';
|
|
13
13
|
|
|
14
14
|
const log = async (message, level, attributes = {}) => {
|
|
15
|
-
var _document;
|
|
16
|
-
|
|
17
15
|
if (!isTelemetryEnabled) {
|
|
18
16
|
return;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
try {
|
|
20
|
+
var _document, _window, _window$location, _window2, _window2$location, _navigator;
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
env = 'local';
|
|
25
|
-
} else if (_constants.DEFAULT_BASE_URL.includes('dev')) {
|
|
26
|
-
env = 'dev';
|
|
27
|
-
} else {
|
|
28
|
-
env = 'prod';
|
|
29
|
-
}
|
|
22
|
+
let env;
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// browser information
|
|
39
|
-
referrer: (_document = document) === null || _document === void 0 ? void 0 : _document.referrer,
|
|
40
|
-
origin: window.location.origin,
|
|
41
|
-
url: window.location.href,
|
|
42
|
-
userAgent: navigator.userAgent,
|
|
43
|
-
// custom values
|
|
44
|
-
...attributes
|
|
45
|
-
};
|
|
24
|
+
if (_constants.DEFAULT_BASE_URL.includes('localhost')) {
|
|
25
|
+
env = 'local';
|
|
26
|
+
} else if (_constants.DEFAULT_BASE_URL.includes('dev')) {
|
|
27
|
+
env = 'dev';
|
|
28
|
+
} else {
|
|
29
|
+
env = 'prod';
|
|
30
|
+
}
|
|
46
31
|
|
|
47
|
-
|
|
32
|
+
const payload = {
|
|
33
|
+
// dd info
|
|
34
|
+
level,
|
|
35
|
+
message,
|
|
36
|
+
// for basis theory tracking
|
|
37
|
+
service: 'js-sdk',
|
|
38
|
+
env,
|
|
39
|
+
// browser information
|
|
40
|
+
referrer: (_document = document) === null || _document === void 0 ? void 0 : _document.referrer,
|
|
41
|
+
origin: (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.origin,
|
|
42
|
+
url: (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$location = _window2.location) === null || _window2$location === void 0 ? void 0 : _window2$location.href,
|
|
43
|
+
userAgent: (_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.userAgent,
|
|
44
|
+
// custom values
|
|
45
|
+
...attributes
|
|
46
|
+
};
|
|
48
47
|
await fetch(`https://http-intake.logs.datadoghq.com/v1/input/${ddTok}`, {
|
|
49
48
|
method: 'POST',
|
|
50
49
|
body: JSON.stringify(payload),
|