@bigbinary/neeto-commons-frontend 2.1.6 → 2.1.8
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 +104 -94
- package/configs/scripts/jsdoc-builder/constants.mjs +1 -1
- package/configs/scripts/jsdoc-builder/utils.mjs +4 -3
- package/cypress-utils.d.ts +2 -2
- package/initializers.cjs.js +0 -1
- package/initializers.cjs.js.map +1 -1
- package/initializers.d.ts +7 -5
- package/initializers.js +0 -1
- package/initializers.js.map +1 -1
- package/package.json +1 -1
- package/pure.d.ts +325 -324
- package/react-utils.d.ts +674 -153
- package/utils.cjs.js +8 -2
- package/utils.cjs.js.map +1 -1
- package/utils.d.ts +145 -44
- package/utils.js +8 -2
- package/utils.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# neeto-commons-frontend
|
|
2
2
|
|
|
3
|
-
A library
|
|
3
|
+
A library that packages common boilerplate frontend code necessary for all neeto
|
|
4
4
|
products.
|
|
5
5
|
|
|
6
6
|
<table>
|
|
7
7
|
<thead>
|
|
8
8
|
<tr>
|
|
9
|
-
<th>
|
|
9
|
+
<th style="text-align: left;">
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Category
|
|
12
12
|
|
|
13
13
|
</th>
|
|
14
|
-
<th>
|
|
14
|
+
<th style="text-align: left;">
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Name
|
|
17
17
|
|
|
18
18
|
</th>
|
|
19
19
|
</tr>
|
|
@@ -23,17 +23,16 @@ Category
|
|
|
23
23
|
<tr>
|
|
24
24
|
<td style="vertical-align: top;">
|
|
25
25
|
|
|
26
|
+
Initializers [↗](./docs/initializers/README.md)
|
|
27
|
+
|
|
28
|
+
</td>
|
|
29
|
+
<td style="vertical-align: top;">
|
|
30
|
+
|
|
26
31
|
- [Set up axios](./docs/initializers/axios.md)
|
|
27
32
|
- [Set up globalProps](./docs/initializers/globalProps.md)
|
|
28
33
|
- [Set up translations](./docs/initializers/translation.md)
|
|
29
|
-
- [Set up mixpanel](./docs/initializers/mixpanel.md)
|
|
30
34
|
- [Set up logger](./docs/initializers/logger.md)
|
|
31
35
|
- [Disable React Developer Tools in production](./docs/initializers/reactDevTools.md)
|
|
32
|
-
</td>
|
|
33
|
-
<td style="vertical-align: top;">
|
|
34
|
-
|
|
35
|
-
[Initializers](./docs/initializers/README.md)
|
|
36
|
-
|
|
37
36
|
</td>
|
|
38
37
|
</tr>
|
|
39
38
|
<tr></tr>
|
|
@@ -41,90 +40,100 @@ Category
|
|
|
41
40
|
<tr>
|
|
42
41
|
<td style="vertical-align: top;">
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
- [useFuncDebounce](./docs/react/hooks.md#usefuncdebounce)
|
|
46
|
-
- [usePrevious](./docs/react/hooks.md#useprevious)
|
|
47
|
-
- [useUpdateEffect](./docs/react/hooks.md#useupdateeffect)
|
|
48
|
-
- [useLocalStorage](./docs/react/hooks.md#uselocalstorage)
|
|
49
|
-
- [useOnClickOutside](./docs/react/hooks.md#useonclickoutside)
|
|
50
|
-
- [useFieldSubmit](./docs/react/hooks.md#usefieldsubmit)
|
|
51
|
-
- [useDisplayErrorPage](./docs/react/hooks.md#usedisplayerrorpage)
|
|
52
|
-
- [useErrorDisplayStore](./docs/react/hooks.md#useerrordisplaystore)
|
|
53
|
-
- [useHotKeys](./docs/react/hooks.md#usehotkeys)
|
|
54
|
-
- [useTimer](./docs/react/hooks.md#usetimer)
|
|
55
|
-
- [useRegisterNavigationCheckpoint](./docs/react/hooks.md#useregisternavigationcheckpoint)
|
|
56
|
-
- [useNavigationCheckpoints](./docs/react/hooks.md#usenavigationcheckpoints)
|
|
57
|
-
- [useStateWithDependency](./docs/react/hooks.md#usestatewithdependency)
|
|
58
|
-
- [useMutationWithInvalidation](./docs/react/hooks.md#usemutationwithinvalidation)
|
|
59
|
-
- [withImmutableActions](./docs/react/utils.md#withimmutableactions)
|
|
60
|
-
- [withTitle](./docs/react/utils.md#withtitle)
|
|
61
|
-
- [withT](./docs/react/utils.md#witht)
|
|
62
|
-
- [registerBrowserNotifications](./docs/react/utils.md#registerbrowsernotifications)
|
|
63
|
-
- [destroyBrowserSubscription](./docs/react/utils.md#destroybrowsersubscription)
|
|
64
|
-
- [handleMetaClick](./docs/react/utils.md#handlemetaclick)
|
|
65
|
-
- [isMetaKeyPressed](./docs/react/utils.md#ismetakeypressed)
|
|
66
|
-
- [PrivateRoute](./docs/react/components.md#privateroute)
|
|
67
|
-
- [HoneybadgerErrorBoundary](./docs/react/components.md#honeybadgererrorboundary)
|
|
43
|
+
React utilities [↗](./docs/react/README.md)
|
|
68
44
|
|
|
69
45
|
</td>
|
|
70
46
|
<td style="vertical-align: top;">
|
|
71
47
|
|
|
72
|
-
[
|
|
48
|
+
- [useDebounce](./docs/react/hooks/useDebounce.md)
|
|
49
|
+
- [useFuncDebounce](./docs/react/hooks/useFuncDebounce.md)
|
|
50
|
+
- [usePrevious](./docs/react/hooks/usePrevious.md)
|
|
51
|
+
- [useUpdateEffect](./docs/react/hooks/useUpdateEffect.md)
|
|
52
|
+
- [useLocalStorage](./docs/react/hooks/useLocalStorage.md)
|
|
53
|
+
- [useOnClickOutside](./docs/react/hooks/useOnClickOutside.md)
|
|
54
|
+
- [useFieldSubmit](./docs/react/hooks/useFieldSubmit.md)
|
|
55
|
+
- [useHotKeys](./docs/react/hooks/useHotKeys.md)
|
|
56
|
+
- [useKeyboardShortcutsPaneState](./docs/react/hooks/useKeyboardShortcutsPaneState.md)
|
|
57
|
+
- [useDisplayErrorPage](./docs/react/hooks/useDisplayErrorPage.md)
|
|
58
|
+
- [useErrorDisplayStore](./docs/react/hooks/useErrorDisplayStore.md)
|
|
59
|
+
- [useTimer](./docs/react/hooks/useTimer.md)
|
|
60
|
+
- [useRegisterNavigationCheckpoint](./docs/react/hooks/useRegisterNavigationCheckpoint.md)
|
|
61
|
+
- [useNavigationCheckpoints](./docs/react/hooks/useNavigationCheckpoints.md)
|
|
62
|
+
- [useMutationWithInvalidation](./docs/react/hooks/useMutationWithInvalidation.md)
|
|
63
|
+
- [useFetchNeetoApps](./docs/react/hooks/useFetchNeetoApps.md)
|
|
64
|
+
- [usePersistedQuery](./docs/react/hooks/usePersistedQuery.md)
|
|
65
|
+
- [useIsElementVisibleInDom](./docs/react/hooks/useIsElementVisibleInDom.md)
|
|
66
|
+
- [useStateWithDependency](./docs/react/hooks/useStateWithDependency.md)
|
|
67
|
+
- [PrivateRoute](./docs/react/components/PrivateRoute.md)
|
|
68
|
+
- [HoneybadgerErrorBoundary](./docs/react/components/HoneybadgerErrorBoundary.md)
|
|
69
|
+
- [withImmutableActions](./docs/react/utils/withImmutableActions.md)
|
|
70
|
+
- [withTitle](./docs/react/utils/withTitle.md)
|
|
71
|
+
- [registerBrowserNotifications](./docs/react/utils/registerBrowserNotifications.md)
|
|
72
|
+
- [destroyBrowserSubscription](./docs/react/utils/destroyBrowserSubscription.md)
|
|
73
|
+
- [handleMetaClick](./docs/react/utils/handleMetaClick.md)
|
|
74
|
+
- [isMetaKeyPressed](./docs/react/utils/isMetaKeyPressed.md)
|
|
75
|
+
- [withT](./docs/react/utils/withT.md)
|
|
73
76
|
|
|
74
77
|
</td>
|
|
78
|
+
</tr>
|
|
79
|
+
</td>
|
|
80
|
+
|
|
75
81
|
</tr>
|
|
76
82
|
<tr></tr>
|
|
77
83
|
<tr>
|
|
78
84
|
<td style="vertical-align: top;">
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
- [findIndexById](./docs/pure/arrays.md#findindexbyid)
|
|
82
|
-
- [removeById](./docs/pure/arrays.md#removebyid)
|
|
83
|
-
- [replaceById](./docs/pure/arrays.md#replacebyid)
|
|
84
|
-
- [modifyById](./docs/pure/arrays.md#modifybyid)
|
|
85
|
-
- [existsById](./docs/pure/arrays.md#existsbyid)
|
|
86
|
-
- [findBy](./docs/pure/arrays.md#findby)
|
|
87
|
-
- [findIndexBy](./docs/pure/arrays.md#findindexby)
|
|
88
|
-
- [removeBy](./docs/pure/arrays.md#removeby)
|
|
89
|
-
- [replaceBy](./docs/pure/arrays.md#replaceby)
|
|
90
|
-
- [modifyBy](./docs/pure/arrays.md#modifyby)
|
|
91
|
-
- [existsBy](./docs/pure/arrays.md#existsby)
|
|
92
|
-
- [findLastBy](./docs/pure/arrays.md#findlastby)
|
|
93
|
-
- [findLastIndexBy](./docs/pure/arrays.md#findlastindexby)
|
|
94
|
-
- [filterBy](./docs/pure/arrays.md#filterby)
|
|
95
|
-
- [countBy](./docs/pure/arrays.md#countby)
|
|
96
|
-
- [renameKeys](./docs/pure/arrays.md#renamekeys)
|
|
97
|
-
- [copyKeys](./docs/pure/arrays.md#copykeys)
|
|
98
|
-
- [copyKeysDeep](./docs/pure/arrays.md#copykeysdeep)
|
|
99
|
-
- [transformObjectDeep](./docs/pure/objects.md#transformobjectdeep)
|
|
100
|
-
- [preprocessForSerialization](./docs/pure/objects.md#preprocessforserialization)
|
|
101
|
-
- [keysToCamelCase](./docs/pure/objects.md#keystocamelcase)
|
|
102
|
-
- [keysToSnakeCase](./docs/pure/objects.md#keystosnakecase)
|
|
103
|
-
- [serializeKeysToSnakeCase](./docs/pure/objects.md#serializekeystosnakecase)
|
|
104
|
-
- [deepFreezeObject](./docs/pure/objects.md#deepfreezeobject)
|
|
105
|
-
- [matches](./docs/pure/objects.md#matches)
|
|
106
|
-
- [filterNonNull](./docs/pure/objects.md#filternonnull)
|
|
107
|
-
- [slugify](./docs/pure/strings.md#slugify)
|
|
108
|
-
- [humanize](./docs/pure/strings.md#humanize)
|
|
109
|
-
- [snakeToCamelCase](./docs/pure/strings.md#snaketocamelcase)
|
|
110
|
-
- [camelToSnakeCase](./docs/pure/strings.md#cameltosnakecase)
|
|
111
|
-
- [capitalize](./docs/pure/strings.md#capitalize)
|
|
112
|
-
- [truncate](./docs/pure/strings.md#truncate)
|
|
113
|
-
- [noop](./docs/pure/general.md#noop)
|
|
114
|
-
- [toLabelAndValue](./docs/pure/general.md#tolabelandvalue)
|
|
115
|
-
- [getRandomInt](./docs/pure/general.md#getrandomint)
|
|
116
|
-
- [randomPick](./docs/pure/general.md#randompick)
|
|
117
|
-
- [dynamicArray](./docs/pure/general.md#dynamicarray)
|
|
118
|
-
- [isNotEmpty](./docs/pure/general.md#isnotempty)
|
|
119
|
-
- [isNot (alias notEquals)](./docs/pure/general.md#isnot_alias_notequals)
|
|
120
|
-
- [isNotEqualDeep (alias notEqualsDeep)](./docs/pure/general.md#isnotequaldeep_alias_notequalsdeep)
|
|
86
|
+
Pure utility functions [↗](./docs/pure/README.md)
|
|
121
87
|
|
|
122
88
|
</td>
|
|
123
89
|
<td style="vertical-align: top;">
|
|
124
90
|
|
|
125
|
-
[
|
|
91
|
+
- [findById](./docs/pure/arrays/findById.md)
|
|
92
|
+
- [findIndexById](./docs/pure/arrays/findIndexById.md)
|
|
93
|
+
- [removeById](./docs/pure/arrays/removeById.md)
|
|
94
|
+
- [replaceById](./docs/pure/arrays/replaceById.md)
|
|
95
|
+
- [modifyById](./docs/pure/arrays/modifyById.md)
|
|
96
|
+
- [existsById](./docs/pure/arrays/existsById.md)
|
|
97
|
+
- [findBy](./docs/pure/arrays/findBy.md)
|
|
98
|
+
- [findIndexBy](./docs/pure/arrays/findIndexBy.md)
|
|
99
|
+
- [removeBy](./docs/pure/arrays/removeBy.md)
|
|
100
|
+
- [replaceBy](./docs/pure/arrays/replaceBy.md)
|
|
101
|
+
- [modifyBy](./docs/pure/arrays/modifyBy.md)
|
|
102
|
+
- [existsBy](./docs/pure/arrays/existsBy.md)
|
|
103
|
+
- [findLastBy](./docs/pure/arrays/findLastBy.md)
|
|
104
|
+
- [findLastIndexBy](./docs/pure/arrays/findLastIndexBy.md)
|
|
105
|
+
- [filterBy](./docs/pure/arrays/filterBy.md)
|
|
106
|
+
- [countBy](./docs/pure/arrays/countBy.md)
|
|
107
|
+
- [renameKeys](./docs/pure/arrays/renameKeys.md)
|
|
108
|
+
- [copyKeys](./docs/pure/arrays/copyKeys.md)
|
|
109
|
+
- [copyKeysDeep](./docs/pure/arrays/copyKeysDeep.md)
|
|
110
|
+
- [transformObjectDeep](./docs/pure/objects/transformObjectDeep.md)
|
|
111
|
+
- [preprocessForSerialization](./docs/pure/objects/preprocessForSerialization.md)
|
|
112
|
+
- [keysToCamelCase](./docs/pure/objects/keysToCamelCase.md)
|
|
113
|
+
- [keysToSnakeCase](./docs/pure/objects/keysToSnakeCase.md)
|
|
114
|
+
- [serializeKeysToSnakeCase](./docs/pure/objects/serializeKeysToSnakeCase.md)
|
|
115
|
+
- [deepFreezeObject](./docs/pure/objects/deepFreezeObject.md)
|
|
116
|
+
- [matches](./docs/pure/objects/matches.md)
|
|
117
|
+
- [filterNonNull](./docs/pure/objects/filterNonNull.md)
|
|
118
|
+
- [slugify](./docs/pure/strings/slugify.md)
|
|
119
|
+
- [humanize](./docs/pure/strings/humanize.md)
|
|
120
|
+
- [snakeToCamelCase](./docs/pure/strings/snakeToCamelCase.md)
|
|
121
|
+
- [camelToSnakeCase](./docs/pure/strings/camelToSnakeCase.md)
|
|
122
|
+
- [capitalize](./docs/pure/strings/capitalize.md)
|
|
123
|
+
- [truncate](./docs/pure/strings/truncate.md)
|
|
124
|
+
- [noop](./docs/pure/general/noop.md)
|
|
125
|
+
- [toLabelAndValue](./docs/pure/general/toLabelAndValue.md)
|
|
126
|
+
- [getRandomInt](./docs/pure/general/getRandomInt.md)
|
|
127
|
+
- [randomPick](./docs/pure/general/randomPick.md)
|
|
128
|
+
- [dynamicArray](./docs/pure/general/dynamicArray.md)
|
|
129
|
+
- [isNotEmpty](./docs/pure/general/isNotEmpty.md)
|
|
130
|
+
- [isNot](./docs/pure/general/isNot.md)
|
|
131
|
+
- [isNotEqualDeep](./docs/pure/general/isNotEqualDeep.md)
|
|
132
|
+
- [isNotPresent](./docs/pure/general/isNotPresent.md)
|
|
133
|
+
- [modifyWithImmer](./docs/pure/general/modifyWithImmer.md)
|
|
126
134
|
|
|
127
135
|
</td>
|
|
136
|
+
|
|
128
137
|
</tr>
|
|
129
138
|
|
|
130
139
|
<tr></tr>
|
|
@@ -132,28 +141,29 @@ Category
|
|
|
132
141
|
<tr>
|
|
133
142
|
<td style="vertical-align: top;">
|
|
134
143
|
|
|
135
|
-
|
|
136
|
-
- [getSubdomain](./docs/utils/README.md#getsubdomain)
|
|
137
|
-
- [simulateApiCall](./docs/utils/README.md#simulateapicall)
|
|
138
|
-
- [copyToClipboard](./docs/utils/README.md#copytoclipboard)
|
|
139
|
-
- [buildUrl](./docs/utils/README.md#buildurl)
|
|
140
|
-
- [dateFormat/timeFormat](./docs/utils/README.md#dateformattimeformat)
|
|
141
|
-
- [toLocale](./docs/utils/README.md#tolocale)
|
|
142
|
-
- [getQueryParams](./docs/utils/README.md#getqueryparams)
|
|
143
|
-
- [joinHyphenCase](./docs/utils/README.md#joinhyphencase)
|
|
144
|
-
- [debounce](./docs/utils/README.md#debounce)
|
|
145
|
-
- [hasPermission](./docs/utils/README.md#haspermission)
|
|
146
|
-
- [hasAnyPermission](./docs/utils/README.md#hasanypermission)
|
|
147
|
-
- [hasAllPermissions](./docs/utils/README.md#hasallpermission)
|
|
148
|
-
- [createSubscription](./docs/utils/README.md#createsubscription)
|
|
149
|
-
- [getFromLocalStorage](./docs/utils/README.md#getfromlocalstorage)
|
|
144
|
+
Web utility functions [↗](./docs/utils/README.md)
|
|
150
145
|
|
|
151
146
|
</td>
|
|
152
147
|
<td style="vertical-align: top;">
|
|
153
148
|
|
|
154
|
-
[
|
|
149
|
+
- [withEventTargetValue](./docs/utils/withEventTargetValue.md)
|
|
150
|
+
- [getSubdomain](./docs/utils/getSubdomain.md)
|
|
151
|
+
- [simulateApiCall](./docs/utils/simulateApiCall.md)
|
|
152
|
+
- [copyToClipboard](./docs/utils/copyToClipboard.md)
|
|
153
|
+
- [buildUrl](./docs/utils/buildUrl.md)
|
|
154
|
+
- [dateFormat](./docs/utils/dateFormat.md)
|
|
155
|
+
- [toLocale](./docs/utils/toLocale.md)
|
|
156
|
+
- [getQueryParams](./docs/utils/getQueryParams.md)
|
|
157
|
+
- [joinHyphenCase](./docs/utils/joinHyphenCase.md)
|
|
158
|
+
- [debounce](./docs/utils/debounce.md)
|
|
159
|
+
- [hasPermission](./docs/utils/hasPermission.md)
|
|
160
|
+
- [hasAnyPermission](./docs/utils/hasAnyPermission.md)
|
|
161
|
+
- [hasAllPermissions](./docs/utils/hasAllPermissions.md)
|
|
162
|
+
- [createSubscription](./docs/utils/createSubscription.md)
|
|
163
|
+
- [getFromLocalStorage](./docs/utils/getFromLocalStorage.md)
|
|
155
164
|
|
|
156
165
|
</td>
|
|
166
|
+
|
|
157
167
|
</tr>
|
|
158
168
|
|
|
159
169
|
</tbody>
|
|
@@ -39,4 +39,4 @@ export const JSDOC_EXAMPLE_TAG = "@example ";
|
|
|
39
39
|
export const JSDOC_END_EXAMPLE_TAG = "@endexample";
|
|
40
40
|
export const ASTERISK = "*";
|
|
41
41
|
export const ASTERISK_WITH_SPACES = " * ";
|
|
42
|
-
export const
|
|
42
|
+
export const WHITESPACE_PARENTHESIS_REGEX = /[\s()]/g;
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
PARAGRAPH_PATTERN,
|
|
23
23
|
SUBHEADING_PATTERN,
|
|
24
24
|
TYPES_FOLDER_NAME,
|
|
25
|
-
|
|
25
|
+
WHITESPACE_PARENTHESIS_REGEX,
|
|
26
26
|
} from "./constants.mjs";
|
|
27
27
|
import * as babelTypes from "@babel/types";
|
|
28
28
|
import _traverse from "@babel/traverse";
|
|
@@ -33,7 +33,8 @@ import { matches } from "../../../pure.cjs.js";
|
|
|
33
33
|
const traverse = _traverse.default;
|
|
34
34
|
const generate = _generate.default;
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const removeWhiteSpaceAndParentheses = string =>
|
|
37
|
+
string.replace(WHITESPACE_PARENTHESIS_REGEX, "");
|
|
37
38
|
|
|
38
39
|
const addLeadingCommentForTextWithLineBreaks = ({
|
|
39
40
|
text,
|
|
@@ -145,7 +146,7 @@ export const buildEntityTitleToEntityDescMap = (nodes, map) => {
|
|
|
145
146
|
nodes.forEach((node, idx) => {
|
|
146
147
|
if (!matches(SUBHEADING_PATTERN, node)) return;
|
|
147
148
|
|
|
148
|
-
const entityName =
|
|
149
|
+
const entityName = removeWhiteSpaceAndParentheses(node.children[0].value);
|
|
149
150
|
const entityRightSiblings = [];
|
|
150
151
|
|
|
151
152
|
for (let i = idx + 1; i < nodes.length; i++) {
|
package/cypress-utils.d.ts
CHANGED
|
@@ -243,9 +243,9 @@ export function initializeCredentials(props: {
|
|
|
243
243
|
}): string;
|
|
244
244
|
/**
|
|
245
245
|
*
|
|
246
|
-
*
|
|
246
|
+
* The joinHyphenCase function joins an array of strings using hyphens as the
|
|
247
247
|
*
|
|
248
|
-
*
|
|
248
|
+
* delimiter and returns the resulting string.
|
|
249
249
|
*
|
|
250
250
|
* Any number of string arguments.
|
|
251
251
|
*
|