@bigbinary/neeto-commons-frontend 2.0.2 → 2.0.5
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/README.md +1 -1
- package/initializers.cjs.js +86 -71
- package/initializers.js +86 -71
- package/package.json +2 -1
- package/pure.cjs.js +28 -11
- package/pure.d.ts +22 -20
- package/pure.js +28 -12
- package/react-utils.cjs.js +16 -18
- package/react-utils.d.ts +5 -10
- package/react-utils.js +16 -18
- package/utils.cjs.js +697 -0
- package/utils.d.ts +2 -0
- package/utils.js +698 -2
package/pure.js
CHANGED
|
@@ -129,6 +129,22 @@ var keysToSnakeCase = function keysToSnakeCase(object) {
|
|
|
129
129
|
return [camelToSnakeCase(key), value];
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
|
+
var serializeKeysToSnakeCase = function serializeKeysToSnakeCase(object) {
|
|
133
|
+
if (Array.isArray(object)) {
|
|
134
|
+
return object.map(serializeKeysToSnakeCase);
|
|
135
|
+
} else if (object === null || _typeof(object) !== "object") {
|
|
136
|
+
return object;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return Object.fromEntries(Object.entries(object).map(function (_ref3) {
|
|
140
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
141
|
+
key = _ref4[0],
|
|
142
|
+
value = _ref4[1];
|
|
143
|
+
|
|
144
|
+
var val = typeof (value === null || value === void 0 ? void 0 : value.toJSON) === "function" ? value.toJSON() : value;
|
|
145
|
+
return [camelToSnakeCase(key), serializeKeysToSnakeCase(val)];
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
132
148
|
var deepFreezeObject = function deepFreezeObject(object) {
|
|
133
149
|
if (object && _typeof(object) === "object" && !Object.isFrozen(object)) {
|
|
134
150
|
Object.keys(object).forEach(function (property) {
|
|
@@ -146,25 +162,25 @@ var matches = curry(function (pattern, object) {
|
|
|
146
162
|
if (typeof pattern === "function" && pattern(object, __parent)) return true;
|
|
147
163
|
if (isNil(pattern) || isNil(object)) return false;
|
|
148
164
|
if (_typeof(pattern) !== "object") return false;
|
|
149
|
-
return Object.entries(pattern).every(function (
|
|
150
|
-
var
|
|
151
|
-
key =
|
|
152
|
-
value =
|
|
165
|
+
return Object.entries(pattern).every(function (_ref5) {
|
|
166
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
167
|
+
key = _ref6[0],
|
|
168
|
+
value = _ref6[1];
|
|
153
169
|
|
|
154
170
|
return matches(value, object[key], __parent);
|
|
155
171
|
});
|
|
156
172
|
});
|
|
157
173
|
var filterNonNull = function filterNonNull(object) {
|
|
158
|
-
return Object.fromEntries(Object.entries(object).filter(function (
|
|
159
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
160
|
-
v = _ref6[1];
|
|
161
|
-
|
|
162
|
-
return !isNil(v);
|
|
163
|
-
}).map(function (_ref7) {
|
|
174
|
+
return Object.fromEntries(Object.entries(object).filter(function (_ref7) {
|
|
164
175
|
var _ref8 = _slicedToArray(_ref7, 2),
|
|
165
|
-
k = _ref8[0],
|
|
166
176
|
v = _ref8[1];
|
|
167
177
|
|
|
178
|
+
return !isNil(v);
|
|
179
|
+
}).map(function (_ref9) {
|
|
180
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
181
|
+
k = _ref10[0],
|
|
182
|
+
v = _ref10[1];
|
|
183
|
+
|
|
168
184
|
return [k, _typeof(v) === "object" && !Array.isArray(v) ? filterNonNull(v) : v];
|
|
169
185
|
}));
|
|
170
186
|
};
|
|
@@ -344,4 +360,4 @@ var isNot = notEquals;
|
|
|
344
360
|
var notEqualsDeep = complement(equals);
|
|
345
361
|
var isNotEqualDeep = notEqualsDeep;
|
|
346
362
|
|
|
347
|
-
export { camelToSnakeCase, capitalize, copyKeys, copyKeysDeep, countBy, deepFreezeObject, dynamicArray, existsBy, existsById, filterBy, filterNonNull, findBy, findById, findIndexBy, findIndexById, findLastBy, findLastIndexBy, getRandomInt, humanize, isNot, isNotEmpty, isNotEqualDeep, isNotNil, keysToCamelCase, keysToSnakeCase, matches, modifyBy, modifyById, noop, notEquals, notEqualsDeep, randomPick, removeBy, removeById, renameKeys, replaceBy, replaceById, slugify, snakeToCamelCase, toLabelAndValue, transformObjectDeep, truncate };
|
|
363
|
+
export { camelToSnakeCase, capitalize, copyKeys, copyKeysDeep, countBy, deepFreezeObject, dynamicArray, existsBy, existsById, filterBy, filterNonNull, findBy, findById, findIndexBy, findIndexById, findLastBy, findLastIndexBy, getRandomInt, humanize, isNot, isNotEmpty, isNotEqualDeep, isNotNil, keysToCamelCase, keysToSnakeCase, matches, modifyBy, modifyById, noop, notEquals, notEqualsDeep, randomPick, removeBy, removeById, renameKeys, replaceBy, replaceById, serializeKeysToSnakeCase, slugify, snakeToCamelCase, toLabelAndValue, transformObjectDeep, truncate };
|
package/react-utils.cjs.js
CHANGED
|
@@ -74,20 +74,6 @@ var SvgFallbackComponent = function SvgFallbackComponent(props) {
|
|
|
74
74
|
})));
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
react.Honeybadger.beforeNotify(function (notice) {
|
|
78
|
-
return !/ResizeObserver/.test(notice.message);
|
|
79
|
-
});
|
|
80
|
-
var honeybadger = react.Honeybadger.configure({
|
|
81
|
-
apiKey: globalProps.honeybadgerApiKey,
|
|
82
|
-
environment: globalProps.nodeEnv,
|
|
83
|
-
revision: globalProps.honeybadgerRevision,
|
|
84
|
-
developmentEnvironments: ["development", "test"],
|
|
85
|
-
enableUncaught: true,
|
|
86
|
-
async: true,
|
|
87
|
-
breadcrumbsEnabled: true,
|
|
88
|
-
projectRoot: "webpack:///./"
|
|
89
|
-
});
|
|
90
|
-
|
|
91
77
|
var FallbackComponent = function FallbackComponent() {
|
|
92
78
|
var _useTranslation = reactI18next.useTranslation(),
|
|
93
79
|
t = _useTranslation.t;
|
|
@@ -114,7 +100,7 @@ var FallbackComponent = function FallbackComponent() {
|
|
|
114
100
|
style: "primary",
|
|
115
101
|
size: "large",
|
|
116
102
|
onClick: function onClick() {
|
|
117
|
-
return window.location.reload(
|
|
103
|
+
return window.location.reload();
|
|
118
104
|
},
|
|
119
105
|
label: t("neetoCommons.fallbackComponent.reload")
|
|
120
106
|
}))));
|
|
@@ -124,6 +110,19 @@ var HoneybadgerErrorBoundary = function HoneybadgerErrorBoundary(_ref) {
|
|
|
124
110
|
var children = _ref.children,
|
|
125
111
|
_ref$ErrorComponent = _ref.ErrorComponent,
|
|
126
112
|
ErrorComponent = _ref$ErrorComponent === void 0 ? FallbackComponent : _ref$ErrorComponent;
|
|
113
|
+
react.Honeybadger.beforeNotify(function (notice) {
|
|
114
|
+
return !/ResizeObserver/.test(notice.message);
|
|
115
|
+
});
|
|
116
|
+
var honeybadger = react.Honeybadger.configure({
|
|
117
|
+
apiKey: globalProps.honeybadgerApiKey,
|
|
118
|
+
environment: globalProps.nodeEnv,
|
|
119
|
+
revision: globalProps.honeybadgerRevision,
|
|
120
|
+
developmentEnvironments: ["development", "test"],
|
|
121
|
+
enableUncaught: true,
|
|
122
|
+
async: true,
|
|
123
|
+
breadcrumbsEnabled: true,
|
|
124
|
+
projectRoot: "webpack:///./"
|
|
125
|
+
});
|
|
127
126
|
return /*#__PURE__*/React__default["default"].createElement(react.HoneybadgerErrorBoundary, {
|
|
128
127
|
honeybadger: honeybadger,
|
|
129
128
|
ErrorComponent: ErrorComponent
|
|
@@ -1174,15 +1173,14 @@ function SignIn(_ref) {
|
|
|
1174
1173
|
response = _context.sent;
|
|
1175
1174
|
neetoui.Toastr.success("Logged in successfully.");
|
|
1176
1175
|
redirectAfterSuccessfulLogin(response.redirectTo);
|
|
1177
|
-
_context.next =
|
|
1176
|
+
_context.next = 10;
|
|
1178
1177
|
break;
|
|
1179
1178
|
|
|
1180
1179
|
case 8:
|
|
1181
1180
|
_context.prev = 8;
|
|
1182
1181
|
_context.t0 = _context["catch"](0);
|
|
1183
|
-
neetoui.Toastr.error(_context.t0);
|
|
1184
1182
|
|
|
1185
|
-
case
|
|
1183
|
+
case 10:
|
|
1186
1184
|
case "end":
|
|
1187
1185
|
return _context.stop();
|
|
1188
1186
|
}
|
package/react-utils.d.ts
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import { AvatarProps } from "@bigbinary/neetoui";
|
|
2
|
-
import {
|
|
3
|
-
LinkType,
|
|
4
|
-
NavLinkItemType,
|
|
5
|
-
SidebarProps,
|
|
6
|
-
} from "@bigbinary/neetoui/layouts";
|
|
2
|
+
import { LinkType, NavLinkItemType } from "@bigbinary/neetoui/layouts";
|
|
7
3
|
import React from "react";
|
|
4
|
+
import { RouteProps } from "react-router-dom";
|
|
8
5
|
import { ObjectAndPrimitives } from "./pure";
|
|
9
6
|
|
|
10
7
|
export const HoneybadgerErrorBoundary: React.FC<{
|
|
11
|
-
ErrorComponent?: React.ReactNode
|
|
8
|
+
ErrorComponent?: React.ReactNode | React.ComponentType<any>;
|
|
12
9
|
}>;
|
|
13
|
-
export function PrivateRoute
|
|
10
|
+
export function PrivateRoute(
|
|
14
11
|
props: {
|
|
15
|
-
component: Component;
|
|
16
12
|
condition: boolean;
|
|
17
|
-
path: string;
|
|
18
13
|
redirectRoute: string;
|
|
19
|
-
} &
|
|
14
|
+
} & RouteProps
|
|
20
15
|
): JSX.Element;
|
|
21
16
|
export const Sidebar: React.FC<{
|
|
22
17
|
navLinks: NavLinkItemType[];
|
package/react-utils.js
CHANGED
|
@@ -45,20 +45,6 @@ var SvgFallbackComponent = function SvgFallbackComponent(props) {
|
|
|
45
45
|
})));
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
Honeybadger.beforeNotify(function (notice) {
|
|
49
|
-
return !/ResizeObserver/.test(notice.message);
|
|
50
|
-
});
|
|
51
|
-
var honeybadger = Honeybadger.configure({
|
|
52
|
-
apiKey: globalProps.honeybadgerApiKey,
|
|
53
|
-
environment: globalProps.nodeEnv,
|
|
54
|
-
revision: globalProps.honeybadgerRevision,
|
|
55
|
-
developmentEnvironments: ["development", "test"],
|
|
56
|
-
enableUncaught: true,
|
|
57
|
-
async: true,
|
|
58
|
-
breadcrumbsEnabled: true,
|
|
59
|
-
projectRoot: "webpack:///./"
|
|
60
|
-
});
|
|
61
|
-
|
|
62
48
|
var FallbackComponent = function FallbackComponent() {
|
|
63
49
|
var _useTranslation = useTranslation(),
|
|
64
50
|
t = _useTranslation.t;
|
|
@@ -85,7 +71,7 @@ var FallbackComponent = function FallbackComponent() {
|
|
|
85
71
|
style: "primary",
|
|
86
72
|
size: "large",
|
|
87
73
|
onClick: function onClick() {
|
|
88
|
-
return window.location.reload(
|
|
74
|
+
return window.location.reload();
|
|
89
75
|
},
|
|
90
76
|
label: t("neetoCommons.fallbackComponent.reload")
|
|
91
77
|
}))));
|
|
@@ -95,6 +81,19 @@ var HoneybadgerErrorBoundary = function HoneybadgerErrorBoundary(_ref) {
|
|
|
95
81
|
var children = _ref.children,
|
|
96
82
|
_ref$ErrorComponent = _ref.ErrorComponent,
|
|
97
83
|
ErrorComponent = _ref$ErrorComponent === void 0 ? FallbackComponent : _ref$ErrorComponent;
|
|
84
|
+
Honeybadger.beforeNotify(function (notice) {
|
|
85
|
+
return !/ResizeObserver/.test(notice.message);
|
|
86
|
+
});
|
|
87
|
+
var honeybadger = Honeybadger.configure({
|
|
88
|
+
apiKey: globalProps.honeybadgerApiKey,
|
|
89
|
+
environment: globalProps.nodeEnv,
|
|
90
|
+
revision: globalProps.honeybadgerRevision,
|
|
91
|
+
developmentEnvironments: ["development", "test"],
|
|
92
|
+
enableUncaught: true,
|
|
93
|
+
async: true,
|
|
94
|
+
breadcrumbsEnabled: true,
|
|
95
|
+
projectRoot: "webpack:///./"
|
|
96
|
+
});
|
|
98
97
|
return /*#__PURE__*/React__default.createElement(HoneybadgerErrorBoundary$1, {
|
|
99
98
|
honeybadger: honeybadger,
|
|
100
99
|
ErrorComponent: ErrorComponent
|
|
@@ -1145,15 +1144,14 @@ function SignIn(_ref) {
|
|
|
1145
1144
|
response = _context.sent;
|
|
1146
1145
|
Toastr.success("Logged in successfully.");
|
|
1147
1146
|
redirectAfterSuccessfulLogin(response.redirectTo);
|
|
1148
|
-
_context.next =
|
|
1147
|
+
_context.next = 10;
|
|
1149
1148
|
break;
|
|
1150
1149
|
|
|
1151
1150
|
case 8:
|
|
1152
1151
|
_context.prev = 8;
|
|
1153
1152
|
_context.t0 = _context["catch"](0);
|
|
1154
|
-
Toastr.error(_context.t0);
|
|
1155
1153
|
|
|
1156
|
-
case
|
|
1154
|
+
case 10:
|
|
1157
1155
|
case "end":
|
|
1158
1156
|
return _context.stop();
|
|
1159
1157
|
}
|