@bigbinary/neeto-commons-frontend 2.0.0 → 2.0.3
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 +440 -0
- package/initializers.d.ts +59 -0
- package/initializers.js +222 -109
- package/package.json +26 -7
- package/pure.cjs.js +409 -0
- package/pure.d.ts +183 -0
- package/pure.js +62 -93
- package/{react.js → react-utils.cjs.js} +8 -6
- package/react-utils.d.ts +87 -0
- package/react-utils.js +1220 -0
- package/utils.cjs.js +1325 -0
- package/utils.d.ts +43 -0
- package/utils.js +743 -42
package/pure.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var ramda = require('ramda');
|
|
1
|
+
import { concat, slice, curry, isNil, complement, findLast, findLastIndex, count, fromPairs, toPairs, path, isEmpty, equals } from 'ramda';
|
|
6
2
|
|
|
7
3
|
function _arrayWithHoles(arr) {
|
|
8
4
|
if (Array.isArray(arr)) return arr;
|
|
@@ -102,10 +98,8 @@ var camelToSnakeCase = function camelToSnakeCase(string) {
|
|
|
102
98
|
var capitalize = function capitalize(string) {
|
|
103
99
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
104
100
|
};
|
|
105
|
-
var truncate = function truncate() {
|
|
106
|
-
|
|
107
|
-
var length = arguments.length > 1 ? arguments[1] : undefined;
|
|
108
|
-
return string.length > length ? ramda.concat(ramda.slice(0, length, string), "...") : string;
|
|
101
|
+
var truncate = function truncate(string, length) {
|
|
102
|
+
return string.length > length ? concat(slice(0, length, string), "...") : string;
|
|
109
103
|
};
|
|
110
104
|
|
|
111
105
|
var transformObjectDeep = function transformObjectDeep(object, keyValueTransformer) {
|
|
@@ -135,6 +129,22 @@ var keysToSnakeCase = function keysToSnakeCase(object) {
|
|
|
135
129
|
return [camelToSnakeCase(key), value];
|
|
136
130
|
});
|
|
137
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
|
+
};
|
|
138
148
|
var deepFreezeObject = function deepFreezeObject(object) {
|
|
139
149
|
if (object && _typeof(object) === "object" && !Object.isFrozen(object)) {
|
|
140
150
|
Object.keys(object).forEach(function (property) {
|
|
@@ -145,32 +155,32 @@ var deepFreezeObject = function deepFreezeObject(object) {
|
|
|
145
155
|
|
|
146
156
|
return object;
|
|
147
157
|
};
|
|
148
|
-
var matches =
|
|
158
|
+
var matches = curry(function (pattern, object) {
|
|
149
159
|
var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
150
160
|
|
|
151
161
|
if (object === pattern) return true;
|
|
152
162
|
if (typeof pattern === "function" && pattern(object, __parent)) return true;
|
|
153
|
-
if (
|
|
163
|
+
if (isNil(pattern) || isNil(object)) return false;
|
|
154
164
|
if (_typeof(pattern) !== "object") return false;
|
|
155
|
-
return Object.entries(pattern).every(function (
|
|
156
|
-
var
|
|
157
|
-
key =
|
|
158
|
-
value =
|
|
165
|
+
return Object.entries(pattern).every(function (_ref5) {
|
|
166
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
167
|
+
key = _ref6[0],
|
|
168
|
+
value = _ref6[1];
|
|
159
169
|
|
|
160
170
|
return matches(value, object[key], __parent);
|
|
161
171
|
});
|
|
162
172
|
});
|
|
163
173
|
var filterNonNull = function filterNonNull(object) {
|
|
164
|
-
return Object.fromEntries(Object.entries(object).filter(function (
|
|
165
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
166
|
-
v = _ref6[1];
|
|
167
|
-
|
|
168
|
-
return !ramda.isNil(v);
|
|
169
|
-
}).map(function (_ref7) {
|
|
174
|
+
return Object.fromEntries(Object.entries(object).filter(function (_ref7) {
|
|
170
175
|
var _ref8 = _slicedToArray(_ref7, 2),
|
|
171
|
-
k = _ref8[0],
|
|
172
176
|
v = _ref8[1];
|
|
173
177
|
|
|
178
|
+
return !isNil(v);
|
|
179
|
+
}).map(function (_ref9) {
|
|
180
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
181
|
+
k = _ref10[0],
|
|
182
|
+
v = _ref10[1];
|
|
183
|
+
|
|
174
184
|
return [k, _typeof(v) === "object" && !Array.isArray(v) ? filterNonNull(v) : v];
|
|
175
185
|
}));
|
|
176
186
|
};
|
|
@@ -193,71 +203,71 @@ function _defineProperty(obj, key, value) {
|
|
|
193
203
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
194
204
|
|
|
195
205
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
196
|
-
var removeById =
|
|
206
|
+
var removeById = curry(function (id, array) {
|
|
197
207
|
return array.filter(function (item) {
|
|
198
208
|
return item.id !== id;
|
|
199
209
|
});
|
|
200
210
|
});
|
|
201
|
-
var findById =
|
|
211
|
+
var findById = curry(function (id, array) {
|
|
202
212
|
return array.find(function (item) {
|
|
203
213
|
return item.id === id;
|
|
204
214
|
});
|
|
205
215
|
});
|
|
206
|
-
var replaceById =
|
|
216
|
+
var replaceById = curry(function (id, newItem, array) {
|
|
207
217
|
return array.map(function (item) {
|
|
208
218
|
return item.id === id ? newItem : item;
|
|
209
219
|
});
|
|
210
220
|
});
|
|
211
|
-
var modifyById =
|
|
221
|
+
var modifyById = curry(function (id, modifier, array) {
|
|
212
222
|
return array.map(function (item) {
|
|
213
223
|
return item.id === id ? modifier(item) : item;
|
|
214
224
|
});
|
|
215
225
|
});
|
|
216
|
-
var findBy =
|
|
226
|
+
var findBy = curry(function (pattern, array) {
|
|
217
227
|
return array.find(matches(pattern));
|
|
218
228
|
});
|
|
219
|
-
var removeBy =
|
|
220
|
-
return array.filter(
|
|
229
|
+
var removeBy = curry(function (pattern, array) {
|
|
230
|
+
return array.filter(complement(matches(pattern)));
|
|
221
231
|
});
|
|
222
|
-
var replaceBy =
|
|
232
|
+
var replaceBy = curry(function (pattern, newItem, array) {
|
|
223
233
|
return array.map(function (item) {
|
|
224
234
|
return matches(pattern, item) ? newItem : item;
|
|
225
235
|
});
|
|
226
236
|
});
|
|
227
|
-
var modifyBy =
|
|
237
|
+
var modifyBy = curry(function (pattern, modifier, array) {
|
|
228
238
|
return array.map(function (item) {
|
|
229
239
|
return matches(pattern, item) ? modifier(item) : item;
|
|
230
240
|
});
|
|
231
241
|
});
|
|
232
|
-
var existsById =
|
|
242
|
+
var existsById = curry(function (id, array) {
|
|
233
243
|
return array.some(function (item) {
|
|
234
244
|
return item.id === id;
|
|
235
245
|
});
|
|
236
246
|
});
|
|
237
|
-
var existsBy =
|
|
247
|
+
var existsBy = curry(function (pattern, array) {
|
|
238
248
|
return array.some(matches(pattern));
|
|
239
249
|
});
|
|
240
|
-
var findLastBy =
|
|
241
|
-
return
|
|
250
|
+
var findLastBy = curry(function (pattern, array) {
|
|
251
|
+
return findLast(matches(pattern), array);
|
|
242
252
|
});
|
|
243
|
-
var findIndexById =
|
|
253
|
+
var findIndexById = curry(function (id, array) {
|
|
244
254
|
return array.findIndex(function (item) {
|
|
245
255
|
return item.id === id;
|
|
246
256
|
});
|
|
247
257
|
});
|
|
248
|
-
var findIndexBy =
|
|
258
|
+
var findIndexBy = curry(function (pattern, array) {
|
|
249
259
|
return array.findIndex(matches(pattern));
|
|
250
260
|
});
|
|
251
|
-
var findLastIndexBy =
|
|
252
|
-
return
|
|
261
|
+
var findLastIndexBy = curry(function (pattern, array) {
|
|
262
|
+
return findLastIndex(matches(pattern), array);
|
|
253
263
|
});
|
|
254
|
-
var filterBy =
|
|
264
|
+
var filterBy = curry(function (pattern, array) {
|
|
255
265
|
return array.filter(matches(pattern));
|
|
256
266
|
});
|
|
257
|
-
var countBy =
|
|
258
|
-
return
|
|
267
|
+
var countBy = curry(function (pattern, array) {
|
|
268
|
+
return count(matches(pattern), array);
|
|
259
269
|
});
|
|
260
|
-
var copyKeys =
|
|
270
|
+
var copyKeys = curry(function (keyMap, objectArray) {
|
|
261
271
|
return objectArray.map(function (object) {
|
|
262
272
|
var shallowCopy = _objectSpread({}, object);
|
|
263
273
|
|
|
@@ -268,7 +278,7 @@ var copyKeys = ramda.curry(function (keyMap, objectArray) {
|
|
|
268
278
|
return shallowCopy;
|
|
269
279
|
});
|
|
270
280
|
});
|
|
271
|
-
var renameKeys =
|
|
281
|
+
var renameKeys = curry(function (keyMap, objectArray) {
|
|
272
282
|
return objectArray.map(function (object) {
|
|
273
283
|
var shallowCopy = _objectSpread({}, object);
|
|
274
284
|
|
|
@@ -280,10 +290,10 @@ var renameKeys = ramda.curry(function (keyMap, objectArray) {
|
|
|
280
290
|
return shallowCopy;
|
|
281
291
|
});
|
|
282
292
|
});
|
|
283
|
-
var copyKeysDeep =
|
|
293
|
+
var copyKeysDeep = curry(function (keyMap, objectArray) {
|
|
284
294
|
var copyKeysSingleObject = function copyKeysSingleObject(object, keyMap) {
|
|
285
295
|
var root = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
286
|
-
return _objectSpread(_objectSpread({}, object),
|
|
296
|
+
return _objectSpread(_objectSpread({}, object), fromPairs(toPairs(keyMap).map(function (_ref) {
|
|
287
297
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
288
298
|
destination = _ref2[0],
|
|
289
299
|
source = _ref2[1];
|
|
@@ -291,7 +301,7 @@ var copyKeysDeep = ramda.curry(function (keyMap, objectArray) {
|
|
|
291
301
|
if (typeof source === "function") {
|
|
292
302
|
return [destination, source(object[destination], root)];
|
|
293
303
|
} else if (Array.isArray(source)) {
|
|
294
|
-
return [destination,
|
|
304
|
+
return [destination, path(source, root)];
|
|
295
305
|
} else if (_typeof(source) === "object") {
|
|
296
306
|
return [destination, copyKeysSingleObject(object[destination], source, root)];
|
|
297
307
|
}
|
|
@@ -341,54 +351,13 @@ var dynamicArray = function dynamicArray(count, elementGenerator) {
|
|
|
341
351
|
return elementGenerator(index);
|
|
342
352
|
});
|
|
343
353
|
};
|
|
344
|
-
var isNotNil =
|
|
345
|
-
var isNotEmpty =
|
|
346
|
-
var notEquals =
|
|
354
|
+
var isNotNil = complement(isNil);
|
|
355
|
+
var isNotEmpty = complement(isEmpty);
|
|
356
|
+
var notEquals = curry(function (x, y) {
|
|
347
357
|
return x !== y;
|
|
348
358
|
});
|
|
349
359
|
var isNot = notEquals;
|
|
350
|
-
var notEqualsDeep =
|
|
360
|
+
var notEqualsDeep = complement(equals);
|
|
351
361
|
var isNotEqualDeep = notEqualsDeep;
|
|
352
362
|
|
|
353
|
-
|
|
354
|
-
exports.capitalize = capitalize;
|
|
355
|
-
exports.copyKeys = copyKeys;
|
|
356
|
-
exports.copyKeysDeep = copyKeysDeep;
|
|
357
|
-
exports.countBy = countBy;
|
|
358
|
-
exports.deepFreezeObject = deepFreezeObject;
|
|
359
|
-
exports.dynamicArray = dynamicArray;
|
|
360
|
-
exports.existsBy = existsBy;
|
|
361
|
-
exports.existsById = existsById;
|
|
362
|
-
exports.filterBy = filterBy;
|
|
363
|
-
exports.filterNonNull = filterNonNull;
|
|
364
|
-
exports.findBy = findBy;
|
|
365
|
-
exports.findById = findById;
|
|
366
|
-
exports.findIndexBy = findIndexBy;
|
|
367
|
-
exports.findIndexById = findIndexById;
|
|
368
|
-
exports.findLastBy = findLastBy;
|
|
369
|
-
exports.findLastIndexBy = findLastIndexBy;
|
|
370
|
-
exports.getRandomInt = getRandomInt;
|
|
371
|
-
exports.humanize = humanize;
|
|
372
|
-
exports.isNot = isNot;
|
|
373
|
-
exports.isNotEmpty = isNotEmpty;
|
|
374
|
-
exports.isNotEqualDeep = isNotEqualDeep;
|
|
375
|
-
exports.isNotNil = isNotNil;
|
|
376
|
-
exports.keysToCamelCase = keysToCamelCase;
|
|
377
|
-
exports.keysToSnakeCase = keysToSnakeCase;
|
|
378
|
-
exports.matches = matches;
|
|
379
|
-
exports.modifyBy = modifyBy;
|
|
380
|
-
exports.modifyById = modifyById;
|
|
381
|
-
exports.noop = noop;
|
|
382
|
-
exports.notEquals = notEquals;
|
|
383
|
-
exports.notEqualsDeep = notEqualsDeep;
|
|
384
|
-
exports.randomPick = randomPick;
|
|
385
|
-
exports.removeBy = removeBy;
|
|
386
|
-
exports.removeById = removeById;
|
|
387
|
-
exports.renameKeys = renameKeys;
|
|
388
|
-
exports.replaceBy = replaceBy;
|
|
389
|
-
exports.replaceById = replaceById;
|
|
390
|
-
exports.slugify = slugify;
|
|
391
|
-
exports.snakeToCamelCase = snakeToCamelCase;
|
|
392
|
-
exports.toLabelAndValue = toLabelAndValue;
|
|
393
|
-
exports.transformObjectDeep = transformObjectDeep;
|
|
394
|
-
exports.truncate = 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 };
|
|
@@ -11,7 +11,6 @@ var neetoIcons = require('@bigbinary/neeto-icons');
|
|
|
11
11
|
var layouts = require('@bigbinary/neetoui/layouts');
|
|
12
12
|
var i18next = require('i18next');
|
|
13
13
|
var ramda = require('ramda');
|
|
14
|
-
var strings = require('src/pure/strings');
|
|
15
14
|
var axios = require('axios');
|
|
16
15
|
var Yup = require('yup');
|
|
17
16
|
var formik = require('@bigbinary/neetoui/formik');
|
|
@@ -263,6 +262,10 @@ function _slicedToArray(arr, i) {
|
|
|
263
262
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
264
263
|
}
|
|
265
264
|
|
|
265
|
+
var capitalize = function capitalize(string) {
|
|
266
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
267
|
+
};
|
|
268
|
+
|
|
266
269
|
var HEADERS_KEYS = {
|
|
267
270
|
xAuthEmail: "X-Auth-Email",
|
|
268
271
|
xAuthToken: "X-Auth-Token",
|
|
@@ -353,7 +356,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
353
356
|
});
|
|
354
357
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(layouts.Sidebar, {
|
|
355
358
|
isCollapsed: true,
|
|
356
|
-
appName: "neeto".concat(
|
|
359
|
+
appName: "neeto".concat(capitalize(appName)),
|
|
357
360
|
navLinks: navLinks,
|
|
358
361
|
profileInfo: profileInfo,
|
|
359
362
|
organizationInfo: ramda.mergeLeft(organizationInfoOverrides, globalProps.organization),
|
|
@@ -367,7 +370,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
367
370
|
return setIsAppSwitcherOpen(false);
|
|
368
371
|
},
|
|
369
372
|
neetoApps: globalProps.neetoApps,
|
|
370
|
-
activeApp:
|
|
373
|
+
activeApp: capitalize(appName),
|
|
371
374
|
environment: process.env.RAILS_ENV
|
|
372
375
|
}));
|
|
373
376
|
};
|
|
@@ -1171,15 +1174,14 @@ function SignIn(_ref) {
|
|
|
1171
1174
|
response = _context.sent;
|
|
1172
1175
|
neetoui.Toastr.success("Logged in successfully.");
|
|
1173
1176
|
redirectAfterSuccessfulLogin(response.redirectTo);
|
|
1174
|
-
_context.next =
|
|
1177
|
+
_context.next = 10;
|
|
1175
1178
|
break;
|
|
1176
1179
|
|
|
1177
1180
|
case 8:
|
|
1178
1181
|
_context.prev = 8;
|
|
1179
1182
|
_context.t0 = _context["catch"](0);
|
|
1180
|
-
neetoui.Toastr.error(_context.t0);
|
|
1181
1183
|
|
|
1182
|
-
case
|
|
1184
|
+
case 10:
|
|
1183
1185
|
case "end":
|
|
1184
1186
|
return _context.stop();
|
|
1185
1187
|
}
|
package/react-utils.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { AvatarProps } from "@bigbinary/neetoui";
|
|
2
|
+
import {
|
|
3
|
+
LinkType,
|
|
4
|
+
NavLinkItemType,
|
|
5
|
+
SidebarProps,
|
|
6
|
+
} from "@bigbinary/neetoui/layouts";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { ObjectAndPrimitives } from "./pure";
|
|
9
|
+
|
|
10
|
+
export const HoneybadgerErrorBoundary: React.FC<{
|
|
11
|
+
ErrorComponent?: React.ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
export function PrivateRoute<Component extends JSX.Element>(
|
|
14
|
+
props: {
|
|
15
|
+
component: Component;
|
|
16
|
+
condition: boolean;
|
|
17
|
+
path: string;
|
|
18
|
+
redirectRoute: string;
|
|
19
|
+
} & { [key in keyof Component]: Component[key] }
|
|
20
|
+
): JSX.Element;
|
|
21
|
+
export const Sidebar: React.FC<{
|
|
22
|
+
navLinks: NavLinkItemType[];
|
|
23
|
+
appName: string;
|
|
24
|
+
profileInfoOverrides?: {
|
|
25
|
+
name?: string;
|
|
26
|
+
email?: string;
|
|
27
|
+
topLinks?: LinkType[];
|
|
28
|
+
bottomLinks?: LinkType[];
|
|
29
|
+
customContent?: React.ReactNode;
|
|
30
|
+
changelogProps?: LinkType;
|
|
31
|
+
helpProps?: LinkType;
|
|
32
|
+
"data-cy"?: string;
|
|
33
|
+
} & AvatarProps;
|
|
34
|
+
organizationInfoOverrides?: {
|
|
35
|
+
logo?: React.ReactNode;
|
|
36
|
+
name?: React.ReactNode;
|
|
37
|
+
subdomain?: React.ReactNode;
|
|
38
|
+
};
|
|
39
|
+
extraTopLinks?: LinkType[];
|
|
40
|
+
showAppSwitcher?: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
|
|
43
|
+
export function useDebounce<T>(value: T, delay?: number): T;
|
|
44
|
+
export function useFuncDebounce<A, B, C, D, E>(
|
|
45
|
+
func: (a?: A, b?: B, c?: C, d?: D, ...e: E[]) => any,
|
|
46
|
+
delay?: number
|
|
47
|
+
): (a?: A, b?: B, c?: C, d?: D, ...e: E[]) => void;
|
|
48
|
+
export function useLocalStorage<T>(
|
|
49
|
+
key: string,
|
|
50
|
+
initialValue?: T
|
|
51
|
+
): [T, (value: T) => void];
|
|
52
|
+
export function useOnClickOutside<T>(
|
|
53
|
+
ref: React.MutableRefObject<T>,
|
|
54
|
+
handler: (event: MouseEvent | TouchEvent) => any
|
|
55
|
+
);
|
|
56
|
+
export function usePrevious<T>(value: T): T;
|
|
57
|
+
export function useUpdateEffect(effect: () => void, deps: any[]): void;
|
|
58
|
+
|
|
59
|
+
export function createContext<T>(initialValue: T): {
|
|
60
|
+
Provider: React.FC<{}>;
|
|
61
|
+
useState: T;
|
|
62
|
+
useSetState: React.Dispatch<React.SetStateAction<T>>;
|
|
63
|
+
useContext: [T, React.Dispatch<React.SetStateAction<T>>];
|
|
64
|
+
};
|
|
65
|
+
type ActionType<T> = {
|
|
66
|
+
type: string;
|
|
67
|
+
payload: Partial<T> | ObjectAndPrimitives;
|
|
68
|
+
};
|
|
69
|
+
export function createContext<T>(
|
|
70
|
+
initialValue: T,
|
|
71
|
+
reducer: (prevState: T, action: ActionType<T>) => T
|
|
72
|
+
): {
|
|
73
|
+
Provider: React.FC<{}>;
|
|
74
|
+
useState: T;
|
|
75
|
+
useDispatch: (action: ActionType<T>) => void;
|
|
76
|
+
useContext: [T, (action: ActionType<T>) => void];
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const ErrorPage: React.FC<{}>;
|
|
80
|
+
export const LoginPage: React.FC<{
|
|
81
|
+
handleSubmit: (data: {
|
|
82
|
+
user: {
|
|
83
|
+
email: string;
|
|
84
|
+
password: string;
|
|
85
|
+
};
|
|
86
|
+
}) => any;
|
|
87
|
+
}>;
|