@formixru/b2b-ui 2.0.0 → 2.0.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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -44,11 +44,15 @@ export const request = async ({ $b, url = '', method = 'GET', data = {}, loader
|
|
|
44
44
|
if (!response.ok) {
|
|
45
45
|
throw response;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
const raw = await response.text();
|
|
49
|
+
let data;
|
|
50
|
+
try {
|
|
51
|
+
data = JSON.parse(raw);
|
|
52
|
+
} catch {
|
|
48
53
|
console.warn('Ошибка при попытке преобразования ответа в JSON');
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
54
|
+
data = { content: raw };
|
|
55
|
+
}
|
|
52
56
|
|
|
53
57
|
if (is(data.redirect, 'String')) {
|
|
54
58
|
if (data.redirect) {
|
|
@@ -65,7 +69,7 @@ export const request = async ({ $b, url = '', method = 'GET', data = {}, loader
|
|
|
65
69
|
}
|
|
66
70
|
} else {
|
|
67
71
|
try {
|
|
68
|
-
await window.
|
|
72
|
+
await window.__FORMIX__REQUEST__INTERCEPT_DATA(data);
|
|
69
73
|
} catch {
|
|
70
74
|
console.warn('Функция __FORMIX__REQUEST__INTERCEPT_DATA не установлена');
|
|
71
75
|
}
|
package/src/helpers/css-var.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export const cssVar = (name, element = document.documentElement) => {
|
|
2
2
|
const value = window.getComputedStyle(element).getPropertyValue(name);
|
|
3
|
-
const durationRegExp =
|
|
3
|
+
const durationRegExp = /(^[\d.]+)(ms|s)$/;
|
|
4
4
|
if (durationRegExp.test(value)) {
|
|
5
|
-
|
|
5
|
+
const [, numericValue, unit] = durationRegExp.exec(value);
|
|
6
|
+
return unit === 's' ? numericValue * 1000 : Number(numericValue);
|
|
6
7
|
}
|
|
7
8
|
return value;
|
|
8
9
|
};
|