@bigbinary/neeto-commons-frontend 2.0.35 → 2.0.36
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 +5 -6
- package/configs/eslint/helpers/index.js +2 -1
- package/initializers.cjs.js +9 -32
- package/initializers.js +9 -32
- package/package.json +3 -1
- package/pure.cjs.js +5 -5
- package/pure.js +5 -5
- package/react-utils.cjs.js +331 -236
- package/react-utils.d.ts +17 -0
- package/react-utils.js +345 -251
- package/utils.cjs.js +15 -33
- package/utils.d.ts +2 -0
- package/utils.js +15 -34
package/README.md
CHANGED
|
@@ -59,13 +59,12 @@ Category
|
|
|
59
59
|
- [CustomDomain](./docs/react/components.md#customdomain)
|
|
60
60
|
- [BrowserSupport](./docs/react/components.md#browsersupport)
|
|
61
61
|
- [IpRestriction](./docs/react/components.md#iprestriction)
|
|
62
|
-
- [
|
|
63
|
-
- [
|
|
62
|
+
- [PublishBlock](./docs/react/components.md#publishblock)
|
|
63
|
+
- [withImmutableActions](./docs/react/utils.md#withimmutableactions)
|
|
64
|
+
- [withTitle](./docs/react/utils.md#withtitle)
|
|
64
65
|
- [registerBrowserNotifications](./docs/react/utils.md#registerbrowsernotifications)
|
|
65
|
-
(register browser subscription for push notifications)
|
|
66
66
|
- [destroyBrowserSubscription](./docs/react/utils.md#destroybrowsersubscription)
|
|
67
|
-
|
|
68
|
-
- [handleMetaClick](./docs/react/utils.md#handlemetaclick) (handle clicks to redirect to newtab)
|
|
67
|
+
- [handleMetaClick](./docs/react/utils.md#handlemetaclick)
|
|
69
68
|
|
|
70
69
|
</td>
|
|
71
70
|
<td style="vertical-align: top;">
|
|
@@ -186,7 +185,7 @@ them to read more:
|
|
|
186
185
|
3. [Pure utility functions](./docs/pure/README.md)
|
|
187
186
|
4. [Web utility functions](./docs/utils/README.md)
|
|
188
187
|
5. [Default configurations](./docs/configs/README.md)
|
|
189
|
-
|
|
188
|
+
6. [Cypress Utils](./docs/cypress/README.md)
|
|
190
189
|
|
|
191
190
|
## Other references
|
|
192
191
|
|
|
@@ -6,7 +6,7 @@ const { mergeDeepLeft } = require("ramda");
|
|
|
6
6
|
const loadJS = jsPath => {
|
|
7
7
|
try {
|
|
8
8
|
return require(path.resolve(__dirname, "../../../..", jsPath));
|
|
9
|
-
} catch
|
|
9
|
+
} catch {
|
|
10
10
|
return {};
|
|
11
11
|
}
|
|
12
12
|
};
|
|
@@ -42,6 +42,7 @@ const buildPathGroupsBasedOnWebpackAliases = ({
|
|
|
42
42
|
const absolutePath = isAlreadyAnAbsolutePath
|
|
43
43
|
? path
|
|
44
44
|
: `${railsJSFilesRoot}${path}`;
|
|
45
|
+
|
|
45
46
|
const wildCard =
|
|
46
47
|
isFile(`${absolutePath}.js`) || isFile(`${absolutePath}.jsx`)
|
|
47
48
|
? ""
|
package/initializers.cjs.js
CHANGED
|
@@ -131,20 +131,6 @@ var nullSafe = function nullSafe(func) {
|
|
|
131
131
|
);
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
var slugify = function slugify(string) {
|
|
135
|
-
return string.toString().toLowerCase().replace(/\s+/g, "-") // Replace spaces with -
|
|
136
|
-
.replace(/&/g, "-and-") // Replace & with 'and'
|
|
137
|
-
.replace(/[^\w-]+/g, "") // Remove all non-word characters
|
|
138
|
-
.replace(/--+/g, "-") // Replace multiple - with single -
|
|
139
|
-
.replace(/^-+/, "") // Trim - from start of text
|
|
140
|
-
.replace(/-+$/, "");
|
|
141
|
-
}; // Trim - from end of text
|
|
142
|
-
|
|
143
|
-
var humanize = function humanize(string) {
|
|
144
|
-
string = string.replace(/[_-]+/g, " ").replace(/\s{2,}/g, " ").replace(/([a-z\d])([A-Z])/g, "$1" + " " + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + " " + "$2").toLowerCase().trim();
|
|
145
|
-
string = string.charAt(0).toUpperCase() + string.slice(1);
|
|
146
|
-
return string;
|
|
147
|
-
};
|
|
148
134
|
var snakeToCamelCase = function snakeToCamelCase(string) {
|
|
149
135
|
return string.replace(/(_\w)/g, function (letter) {
|
|
150
136
|
return letter[1].toUpperCase();
|
|
@@ -155,14 +141,6 @@ var camelToSnakeCase = function camelToSnakeCase(string) {
|
|
|
155
141
|
return "_".concat(letter.toLowerCase());
|
|
156
142
|
});
|
|
157
143
|
};
|
|
158
|
-
var capitalize = function capitalize(string) {
|
|
159
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
160
|
-
};
|
|
161
|
-
nullSafe(slugify);
|
|
162
|
-
nullSafe(humanize);
|
|
163
|
-
nullSafe(snakeToCamelCase);
|
|
164
|
-
nullSafe(camelToSnakeCase);
|
|
165
|
-
nullSafe(capitalize);
|
|
166
144
|
|
|
167
145
|
var matchesImpl = function matchesImpl(pattern, object) {
|
|
168
146
|
var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
@@ -800,19 +778,11 @@ const createImpl = (createState) => {
|
|
|
800
778
|
return useBoundStore;
|
|
801
779
|
};
|
|
802
780
|
const create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
803
|
-
var react = (createState) => {
|
|
804
|
-
if ((undefined && undefined.MODE) !== "production") {
|
|
805
|
-
console.warn(
|
|
806
|
-
"[DEPRECATED] default export is deprecated, instead import { create } from'zustand'"
|
|
807
|
-
);
|
|
808
|
-
}
|
|
809
|
-
return create(createState);
|
|
810
|
-
};
|
|
811
781
|
|
|
812
782
|
var useDisplayErrorPage = function useDisplayErrorPage() {
|
|
813
783
|
return useErrorDisplayStore(ramda.prop("show404Page"));
|
|
814
784
|
};
|
|
815
|
-
var useErrorDisplayStore =
|
|
785
|
+
var useErrorDisplayStore = create(function () {
|
|
816
786
|
return {
|
|
817
787
|
show404Page: false
|
|
818
788
|
};
|
|
@@ -1099,7 +1069,9 @@ var neetoCommons = {
|
|
|
1099
1069
|
editTitle: "Edit {{entity}}",
|
|
1100
1070
|
addNew: "Add new {{entity}}",
|
|
1101
1071
|
reset: "Reset",
|
|
1102
|
-
saveChanges: "Save changes"
|
|
1072
|
+
saveChanges: "Save changes",
|
|
1073
|
+
publish: "Publish",
|
|
1074
|
+
draft: "Draft"
|
|
1103
1075
|
},
|
|
1104
1076
|
andSentence: "{{first}} {{and}} {{last}}",
|
|
1105
1077
|
and: "and",
|
|
@@ -1264,6 +1236,11 @@ var neetoCommons = {
|
|
|
1264
1236
|
},
|
|
1265
1237
|
currentIpTitle: "Your current IP is",
|
|
1266
1238
|
currentIpDescription: "Your current IP will be added to the allowed IP range by default. You will not be able to save the IP settings without your current IP address on the list"
|
|
1239
|
+
},
|
|
1240
|
+
publishBlock: {
|
|
1241
|
+
viewDraftVersion: "View draft version",
|
|
1242
|
+
deleteDraftVersion: "Delete draft version. It'll not impact the published version",
|
|
1243
|
+
viewPublishedVersion: "View published version"
|
|
1267
1244
|
}
|
|
1268
1245
|
};
|
|
1269
1246
|
var en = {
|
package/initializers.js
CHANGED
|
@@ -119,20 +119,6 @@ var nullSafe = function nullSafe(func) {
|
|
|
119
119
|
);
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
var slugify = function slugify(string) {
|
|
123
|
-
return string.toString().toLowerCase().replace(/\s+/g, "-") // Replace spaces with -
|
|
124
|
-
.replace(/&/g, "-and-") // Replace & with 'and'
|
|
125
|
-
.replace(/[^\w-]+/g, "") // Remove all non-word characters
|
|
126
|
-
.replace(/--+/g, "-") // Replace multiple - with single -
|
|
127
|
-
.replace(/^-+/, "") // Trim - from start of text
|
|
128
|
-
.replace(/-+$/, "");
|
|
129
|
-
}; // Trim - from end of text
|
|
130
|
-
|
|
131
|
-
var humanize = function humanize(string) {
|
|
132
|
-
string = string.replace(/[_-]+/g, " ").replace(/\s{2,}/g, " ").replace(/([a-z\d])([A-Z])/g, "$1" + " " + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + " " + "$2").toLowerCase().trim();
|
|
133
|
-
string = string.charAt(0).toUpperCase() + string.slice(1);
|
|
134
|
-
return string;
|
|
135
|
-
};
|
|
136
122
|
var snakeToCamelCase = function snakeToCamelCase(string) {
|
|
137
123
|
return string.replace(/(_\w)/g, function (letter) {
|
|
138
124
|
return letter[1].toUpperCase();
|
|
@@ -143,14 +129,6 @@ var camelToSnakeCase = function camelToSnakeCase(string) {
|
|
|
143
129
|
return "_".concat(letter.toLowerCase());
|
|
144
130
|
});
|
|
145
131
|
};
|
|
146
|
-
var capitalize = function capitalize(string) {
|
|
147
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
148
|
-
};
|
|
149
|
-
nullSafe(slugify);
|
|
150
|
-
nullSafe(humanize);
|
|
151
|
-
nullSafe(snakeToCamelCase);
|
|
152
|
-
nullSafe(camelToSnakeCase);
|
|
153
|
-
nullSafe(capitalize);
|
|
154
132
|
|
|
155
133
|
var matchesImpl = function matchesImpl(pattern, object) {
|
|
156
134
|
var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
@@ -788,19 +766,11 @@ const createImpl = (createState) => {
|
|
|
788
766
|
return useBoundStore;
|
|
789
767
|
};
|
|
790
768
|
const create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
791
|
-
var react = (createState) => {
|
|
792
|
-
if ((import.meta.env && import.meta.env.MODE) !== "production") {
|
|
793
|
-
console.warn(
|
|
794
|
-
"[DEPRECATED] default export is deprecated, instead import { create } from'zustand'"
|
|
795
|
-
);
|
|
796
|
-
}
|
|
797
|
-
return create(createState);
|
|
798
|
-
};
|
|
799
769
|
|
|
800
770
|
var useDisplayErrorPage = function useDisplayErrorPage() {
|
|
801
771
|
return useErrorDisplayStore(prop("show404Page"));
|
|
802
772
|
};
|
|
803
|
-
var useErrorDisplayStore =
|
|
773
|
+
var useErrorDisplayStore = create(function () {
|
|
804
774
|
return {
|
|
805
775
|
show404Page: false
|
|
806
776
|
};
|
|
@@ -1087,7 +1057,9 @@ var neetoCommons = {
|
|
|
1087
1057
|
editTitle: "Edit {{entity}}",
|
|
1088
1058
|
addNew: "Add new {{entity}}",
|
|
1089
1059
|
reset: "Reset",
|
|
1090
|
-
saveChanges: "Save changes"
|
|
1060
|
+
saveChanges: "Save changes",
|
|
1061
|
+
publish: "Publish",
|
|
1062
|
+
draft: "Draft"
|
|
1091
1063
|
},
|
|
1092
1064
|
andSentence: "{{first}} {{and}} {{last}}",
|
|
1093
1065
|
and: "and",
|
|
@@ -1252,6 +1224,11 @@ var neetoCommons = {
|
|
|
1252
1224
|
},
|
|
1253
1225
|
currentIpTitle: "Your current IP is",
|
|
1254
1226
|
currentIpDescription: "Your current IP will be added to the allowed IP range by default. You will not be able to save the IP settings without your current IP address on the list"
|
|
1227
|
+
},
|
|
1228
|
+
publishBlock: {
|
|
1229
|
+
viewDraftVersion: "View draft version",
|
|
1230
|
+
deleteDraftVersion: "Delete draft version. It'll not impact the published version",
|
|
1231
|
+
viewPublishedVersion: "View published version"
|
|
1255
1232
|
}
|
|
1256
1233
|
};
|
|
1257
1234
|
var en = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.36",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
|
@@ -110,6 +110,8 @@
|
|
|
110
110
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
111
111
|
"rollup-plugin-cleaner": "^1.0.0",
|
|
112
112
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
113
|
+
"rollup-plugin-styles": "^4.0.0",
|
|
114
|
+
"sass": "^1.58.1",
|
|
113
115
|
"yup": "^0.32.11",
|
|
114
116
|
"zustand": "^4.1.2"
|
|
115
117
|
},
|
package/pure.cjs.js
CHANGED
|
@@ -158,11 +158,11 @@ var capitalize = function capitalize(string) {
|
|
|
158
158
|
var truncate = function truncate(string, length) {
|
|
159
159
|
return string.length > length ? ramda.concat(ramda.slice(0, length, string), "...") : string;
|
|
160
160
|
};
|
|
161
|
-
var _slugify = nullSafe(slugify);
|
|
162
|
-
var _humanize = nullSafe(humanize);
|
|
163
|
-
var _snakeToCamelCase = nullSafe(snakeToCamelCase);
|
|
164
|
-
var _camelToSnakeCase = nullSafe(camelToSnakeCase);
|
|
165
|
-
var _capitalize = nullSafe(capitalize);
|
|
161
|
+
var _slugify = /*#__PURE__*/nullSafe(slugify);
|
|
162
|
+
var _humanize = /*#__PURE__*/nullSafe(humanize);
|
|
163
|
+
var _snakeToCamelCase = /*#__PURE__*/nullSafe(snakeToCamelCase);
|
|
164
|
+
var _camelToSnakeCase = /*#__PURE__*/nullSafe(camelToSnakeCase);
|
|
165
|
+
var _capitalize = /*#__PURE__*/nullSafe(capitalize);
|
|
166
166
|
var _truncate = function _truncate(string, length) {
|
|
167
167
|
return ramda.isNil(string) ? string : truncate(string, length);
|
|
168
168
|
};
|
package/pure.js
CHANGED
|
@@ -154,11 +154,11 @@ var capitalize = function capitalize(string) {
|
|
|
154
154
|
var truncate = function truncate(string, length) {
|
|
155
155
|
return string.length > length ? concat(slice(0, length, string), "...") : string;
|
|
156
156
|
};
|
|
157
|
-
var _slugify = nullSafe(slugify);
|
|
158
|
-
var _humanize = nullSafe(humanize);
|
|
159
|
-
var _snakeToCamelCase = nullSafe(snakeToCamelCase);
|
|
160
|
-
var _camelToSnakeCase = nullSafe(camelToSnakeCase);
|
|
161
|
-
var _capitalize = nullSafe(capitalize);
|
|
157
|
+
var _slugify = /*#__PURE__*/nullSafe(slugify);
|
|
158
|
+
var _humanize = /*#__PURE__*/nullSafe(humanize);
|
|
159
|
+
var _snakeToCamelCase = /*#__PURE__*/nullSafe(snakeToCamelCase);
|
|
160
|
+
var _camelToSnakeCase = /*#__PURE__*/nullSafe(camelToSnakeCase);
|
|
161
|
+
var _capitalize = /*#__PURE__*/nullSafe(capitalize);
|
|
162
162
|
var _truncate = function _truncate(string, length) {
|
|
163
163
|
return isNil(string) ? string : truncate(string, length);
|
|
164
164
|
};
|