@bigbinary/neeto-commons-frontend 2.0.58 → 2.0.60
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/configs/scripts/jsdoc-builder/constants.mjs +42 -0
- package/configs/scripts/jsdoc-builder/index.mjs +67 -0
- package/configs/scripts/jsdoc-builder/utils.mjs +218 -0
- package/configs/webpack/index.js +1 -0
- package/cypress-utils.d.ts +99 -103
- package/initializers.d.ts +20 -9
- package/package.json +8 -4
- package/pure.d.ts +1895 -270
- package/react-utils.cjs.js +1 -1
- package/react-utils.d.ts +297 -116
- package/react-utils.js +1 -1
- package/utils.d.ts +263 -48
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
2
|
+
import { complement, startsWith } from "ramda";
|
|
3
|
+
|
|
4
|
+
export const REMARK_NODE_TYPES = {
|
|
5
|
+
HTML: "html",
|
|
6
|
+
PARAGRAPH: "paragraph",
|
|
7
|
+
CODE: "code",
|
|
8
|
+
HEADING: "heading",
|
|
9
|
+
TEXT: "text",
|
|
10
|
+
INLINE_CODE: "inlineCode",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const BABEL_NODE_TYPES = { IDENTIFIER: "Identifier" };
|
|
14
|
+
|
|
15
|
+
export const SUBHEADING_PATTERN = { type: REMARK_NODE_TYPES.HEADING, depth: 2 };
|
|
16
|
+
export const HTML_PATTERN = { type: REMARK_NODE_TYPES.HTML };
|
|
17
|
+
export const IMG_PATTERN = {
|
|
18
|
+
type: REMARK_NODE_TYPES.HTML,
|
|
19
|
+
value: startsWith("<img"),
|
|
20
|
+
};
|
|
21
|
+
export const CODE_PATTERN = { type: REMARK_NODE_TYPES.CODE };
|
|
22
|
+
export const PARAGRAPH_PATTERN = { type: REMARK_NODE_TYPES.PARAGRAPH };
|
|
23
|
+
export const HTML_EXCEPT_IMG_PATTERN = {
|
|
24
|
+
type: REMARK_NODE_TYPES.HTML,
|
|
25
|
+
value: complement(startsWith("<img")),
|
|
26
|
+
};
|
|
27
|
+
export const INLINE_CODE_PATTERN = { type: REMARK_NODE_TYPES.INLINE_CODE };
|
|
28
|
+
export const TEXT_PATTERN = { type: REMARK_NODE_TYPES.TEXT };
|
|
29
|
+
export const DOCS_FOLDER_NAME = "docs";
|
|
30
|
+
export const TYPES_FOLDER_NAME = "typeTemplates";
|
|
31
|
+
export const EXPORTED_TYPES_FOLDER_NAME = ""; // root
|
|
32
|
+
|
|
33
|
+
export const JSDOC_IMG_HEIGHT = "200";
|
|
34
|
+
export const JSDOC_IMG_WIDTH = "300";
|
|
35
|
+
|
|
36
|
+
export const DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT = "\n *\n";
|
|
37
|
+
export const LINE_BREAK = "\n";
|
|
38
|
+
export const JSDOC_EXAMPLE_TAG = "@example ";
|
|
39
|
+
export const JSDOC_END_EXAMPLE_TAG = "@endexample";
|
|
40
|
+
export const ASTERISK = "*";
|
|
41
|
+
export const ASTERISK_WITH_SPACES = " * ";
|
|
42
|
+
export const WHITESPACE_REGEX = /\s/g;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
import _generate from "@babel/generator";
|
|
5
|
+
import _traverse from "@babel/traverse";
|
|
6
|
+
import * as babelTypes from "@babel/types";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
DOCS_FOLDER_NAME,
|
|
10
|
+
EXPORTED_TYPES_FOLDER_NAME,
|
|
11
|
+
TYPES_FOLDER_NAME,
|
|
12
|
+
} from "./constants.mjs";
|
|
13
|
+
import {
|
|
14
|
+
buildEntityTitleToEntityDescMap,
|
|
15
|
+
getFileContent,
|
|
16
|
+
getFileNameList,
|
|
17
|
+
parseMarkdown,
|
|
18
|
+
parseTypeFile,
|
|
19
|
+
syncTypeFiles,
|
|
20
|
+
defaultTypeFileTraverser,
|
|
21
|
+
} from "./utils.mjs";
|
|
22
|
+
|
|
23
|
+
const traverse = _traverse.default;
|
|
24
|
+
const generate = _generate.default;
|
|
25
|
+
|
|
26
|
+
const buildJsdoc = ({
|
|
27
|
+
customTypeFileTraverser = defaultTypeFileTraverser,
|
|
28
|
+
exportedTypesFolderName = EXPORTED_TYPES_FOLDER_NAME,
|
|
29
|
+
} = {}) => {
|
|
30
|
+
const fileNamesInsideDocs = getFileNameList(path.resolve(DOCS_FOLDER_NAME));
|
|
31
|
+
const typeFileNames = fs.readdirSync(path.resolve(TYPES_FOLDER_NAME));
|
|
32
|
+
|
|
33
|
+
syncTypeFiles(exportedTypesFolderName);
|
|
34
|
+
|
|
35
|
+
const entityTitleToDescMapOfAllFiles = {};
|
|
36
|
+
|
|
37
|
+
fileNamesInsideDocs.forEach(docFileName => {
|
|
38
|
+
const fileContent = getFileContent(docFileName);
|
|
39
|
+
const markdownAST = parseMarkdown(fileContent);
|
|
40
|
+
|
|
41
|
+
buildEntityTitleToEntityDescMap(
|
|
42
|
+
markdownAST.children,
|
|
43
|
+
entityTitleToDescMapOfAllFiles
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// eslint-disable-next-line consistent-return
|
|
48
|
+
typeFileNames.forEach(typeFileName => {
|
|
49
|
+
const typeFileContent = getFileContent(
|
|
50
|
+
path.join(exportedTypesFolderName, typeFileName)
|
|
51
|
+
);
|
|
52
|
+
const typeFileAST = parseTypeFile(typeFileContent);
|
|
53
|
+
|
|
54
|
+
customTypeFileTraverser({
|
|
55
|
+
typeFileName,
|
|
56
|
+
typeFileAST,
|
|
57
|
+
entityTitleToDescMapOfAllFiles,
|
|
58
|
+
babelTraverse: traverse,
|
|
59
|
+
babelCodeGenerator: generate,
|
|
60
|
+
babelTypes,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
console.log("Successfully added JSDoc comments to type files.");
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default buildJsdoc;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
import * as babelParser from "@babel/parser";
|
|
5
|
+
import { curry, __, mergeLeft } from "ramda";
|
|
6
|
+
import remarkParse from "remark-parse";
|
|
7
|
+
import unified from "unified";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
ASTERISK,
|
|
11
|
+
ASTERISK_WITH_SPACES,
|
|
12
|
+
CODE_PATTERN,
|
|
13
|
+
DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT,
|
|
14
|
+
EXPORTED_TYPES_FOLDER_NAME,
|
|
15
|
+
HTML_EXCEPT_IMG_PATTERN,
|
|
16
|
+
IMG_PATTERN,
|
|
17
|
+
JSDOC_EXAMPLE_TAG,
|
|
18
|
+
JSDOC_END_EXAMPLE_TAG,
|
|
19
|
+
JSDOC_IMG_HEIGHT,
|
|
20
|
+
JSDOC_IMG_WIDTH,
|
|
21
|
+
LINE_BREAK,
|
|
22
|
+
PARAGRAPH_PATTERN,
|
|
23
|
+
SUBHEADING_PATTERN,
|
|
24
|
+
TYPES_FOLDER_NAME,
|
|
25
|
+
WHITESPACE_REGEX,
|
|
26
|
+
} from "./constants.mjs";
|
|
27
|
+
import * as babelTypes from "@babel/types";
|
|
28
|
+
import _traverse from "@babel/traverse";
|
|
29
|
+
import _generate from "@babel/generator";
|
|
30
|
+
|
|
31
|
+
import { matches } from "../../../pure.cjs.js";
|
|
32
|
+
|
|
33
|
+
const traverse = _traverse.default;
|
|
34
|
+
const generate = _generate.default;
|
|
35
|
+
|
|
36
|
+
const removeSpaces = string => string.replace(WHITESPACE_REGEX, "");
|
|
37
|
+
|
|
38
|
+
const addLeadingCommentForTextWithLineBreaks = ({
|
|
39
|
+
text,
|
|
40
|
+
addCommentForFirstItem = true,
|
|
41
|
+
addDoubleLineBreaks = true,
|
|
42
|
+
}) => {
|
|
43
|
+
if (!hasLineBreaks(text)) return addLeadingComment(text);
|
|
44
|
+
const joinString = addDoubleLineBreaks
|
|
45
|
+
? DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT
|
|
46
|
+
: LINE_BREAK;
|
|
47
|
+
|
|
48
|
+
return text
|
|
49
|
+
.split(LINE_BREAK)
|
|
50
|
+
.map((item, idx) => {
|
|
51
|
+
if (!addCommentForFirstItem && idx === 0) return item;
|
|
52
|
+
|
|
53
|
+
return addLeadingComment(item);
|
|
54
|
+
})
|
|
55
|
+
.join(joinString);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const addLeadingComment = (text, trimWhiteSpace = false) =>
|
|
59
|
+
(trimWhiteSpace ? ASTERISK : ASTERISK_WITH_SPACES) + text;
|
|
60
|
+
|
|
61
|
+
const transformCode = node => {
|
|
62
|
+
let text = "";
|
|
63
|
+
text += addLeadingComment(JSDOC_EXAMPLE_TAG);
|
|
64
|
+
text += DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT;
|
|
65
|
+
text += addLeadingCommentForTextWithLineBreaks({
|
|
66
|
+
text: removeCommentTags(node.value),
|
|
67
|
+
addDoubleLineBreaks: false,
|
|
68
|
+
});
|
|
69
|
+
text += LINE_BREAK;
|
|
70
|
+
text += addLeadingComment(JSDOC_END_EXAMPLE_TAG);
|
|
71
|
+
text += LINE_BREAK;
|
|
72
|
+
|
|
73
|
+
return text;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const hasLineBreaks = text => text?.includes(LINE_BREAK);
|
|
77
|
+
|
|
78
|
+
const getParagraphChildrenText = node => {
|
|
79
|
+
const children = node.children;
|
|
80
|
+
if (children.length === 1) return children[0].value;
|
|
81
|
+
|
|
82
|
+
return children.map(child => child.value || child.children[0].value).join("");
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const transformParagraph = node => {
|
|
86
|
+
let text = "";
|
|
87
|
+
text += ASTERISK_WITH_SPACES;
|
|
88
|
+
const childrenText = getParagraphChildrenText(node);
|
|
89
|
+
|
|
90
|
+
if (hasLineBreaks(childrenText)) {
|
|
91
|
+
text += addLeadingCommentForTextWithLineBreaks({
|
|
92
|
+
text: childrenText,
|
|
93
|
+
addCommentForFirstItem: false,
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
text += childrenText;
|
|
97
|
+
}
|
|
98
|
+
text += DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT;
|
|
99
|
+
|
|
100
|
+
return text;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const transformImg = node => {
|
|
104
|
+
const { src, alt } = parseImgTag(node.value);
|
|
105
|
+
let text = ASTERISK_WITH_SPACES;
|
|
106
|
+
text += ``;
|
|
107
|
+
text += DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT;
|
|
108
|
+
|
|
109
|
+
return text;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const transformNodesToText = nodes => {
|
|
113
|
+
let text = DOUBLE_LINE_BREAK_WITH_LEADING_COMMENT;
|
|
114
|
+
|
|
115
|
+
nodes.forEach(node => {
|
|
116
|
+
if (matches(CODE_PATTERN, node)) {
|
|
117
|
+
text += transformCode(node);
|
|
118
|
+
} else if (matches(IMG_PATTERN, node)) {
|
|
119
|
+
text += transformImg(node);
|
|
120
|
+
} else if (matches(PARAGRAPH_PATTERN, node)) {
|
|
121
|
+
text += transformParagraph(node);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return addLeadingComment(text, true);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const parseImgTag = imgTagStr =>
|
|
129
|
+
imgTagStr.split(" ").reduce((acc, item) => {
|
|
130
|
+
let [attrName, attrValue] = item.split("=");
|
|
131
|
+
attrValue = attrValue?.replaceAll(">", "").replaceAll('"', "");
|
|
132
|
+
|
|
133
|
+
return mergeLeft({ [attrName]: attrValue }, acc);
|
|
134
|
+
}, {});
|
|
135
|
+
|
|
136
|
+
const removeCommentTags = str => str.replaceAll("/*", "").replaceAll("*/", "");
|
|
137
|
+
|
|
138
|
+
export const parseTypeFile = typeFileContent =>
|
|
139
|
+
babelParser.parse(typeFileContent, {
|
|
140
|
+
sourceType: "module",
|
|
141
|
+
plugins: [["typescript", { dts: true }]],
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export const buildEntityTitleToEntityDescMap = (nodes, map) => {
|
|
145
|
+
nodes.forEach((node, idx) => {
|
|
146
|
+
if (!matches(SUBHEADING_PATTERN, node)) return;
|
|
147
|
+
|
|
148
|
+
const entityName = removeSpaces(node.children[0].value);
|
|
149
|
+
const entityRightSiblings = [];
|
|
150
|
+
|
|
151
|
+
for (let i = idx + 1; i < nodes.length; i++) {
|
|
152
|
+
const siblingNode = nodes[i];
|
|
153
|
+
|
|
154
|
+
if (matches(HTML_EXCEPT_IMG_PATTERN, siblingNode)) continue;
|
|
155
|
+
|
|
156
|
+
if (matches(SUBHEADING_PATTERN, siblingNode)) break;
|
|
157
|
+
|
|
158
|
+
entityRightSiblings.push(siblingNode);
|
|
159
|
+
}
|
|
160
|
+
const entityRightSiblingsText = transformNodesToText(entityRightSiblings);
|
|
161
|
+
map[entityName] = entityRightSiblingsText;
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const defaultTypeFileTraverser = ({
|
|
166
|
+
typeFileAST,
|
|
167
|
+
typeFileName,
|
|
168
|
+
entityTitleToDescMapOfAllFiles,
|
|
169
|
+
}) =>
|
|
170
|
+
traverse(typeFileAST, {
|
|
171
|
+
ExportNamedDeclaration: ({ node }) => {
|
|
172
|
+
const entityName = findEntityName(node);
|
|
173
|
+
const entityDesc = entityTitleToDescMapOfAllFiles[entityName];
|
|
174
|
+
|
|
175
|
+
if (!entityName || !entityDesc) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
babelTypes.addComment(node, "leading", entityDesc);
|
|
180
|
+
|
|
181
|
+
const { code } = generate(typeFileAST, {});
|
|
182
|
+
|
|
183
|
+
fs.writeFileSync(path.resolve(typeFileName), code);
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
export const syncTypeFiles = exportedTypesFolderName => {
|
|
188
|
+
const sourceDir = path.resolve(TYPES_FOLDER_NAME);
|
|
189
|
+
const destDir = path.resolve(exportedTypesFolderName);
|
|
190
|
+
|
|
191
|
+
fs.cpSync(sourceDir, destDir, { recursive: true });
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export const getFileNameList = dirPath => {
|
|
195
|
+
let files = [];
|
|
196
|
+
const items = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
197
|
+
|
|
198
|
+
for (const item of items) {
|
|
199
|
+
if (item.isDirectory()) {
|
|
200
|
+
files = [...files, ...getFileNameList(path.join(dirPath, item.name))];
|
|
201
|
+
} else {
|
|
202
|
+
files.push(path.join(dirPath, item.name));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return files;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export const getFileContent = fileName =>
|
|
210
|
+
fs.readFileSync(path.resolve(fileName), "utf8").toString();
|
|
211
|
+
|
|
212
|
+
export const parseMarkdown = fileContent =>
|
|
213
|
+
unified().use(remarkParse).parse(fileContent);
|
|
214
|
+
|
|
215
|
+
export const findEntityName = node =>
|
|
216
|
+
node?.declaration?.declarations?.[0]?.id?.name || node?.declaration?.id?.name;
|
|
217
|
+
|
|
218
|
+
export const matchesAny = curry((list, obj) => list.some(matches(__, obj)));
|
package/configs/webpack/index.js
CHANGED
package/cypress-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// selectors ------------------------------------------------
|
|
2
2
|
|
|
3
3
|
type CommonSelectors = {
|
|
4
4
|
alertTitle: string;
|
|
@@ -32,7 +32,6 @@ type CommonSelectors = {
|
|
|
32
32
|
tabItem: (index: string) => string;
|
|
33
33
|
dropdownWrapper: (index: string) => string;
|
|
34
34
|
};
|
|
35
|
-
|
|
36
35
|
type MemberSelectors = {
|
|
37
36
|
activatedMembersButton: string;
|
|
38
37
|
columnCheckBox: string;
|
|
@@ -48,7 +47,6 @@ type MemberSelectors = {
|
|
|
48
47
|
searchTextField: string;
|
|
49
48
|
submitButton: string;
|
|
50
49
|
};
|
|
51
|
-
|
|
52
50
|
type LoginSelectors = {
|
|
53
51
|
appleAuthenticationButton: string;
|
|
54
52
|
emailTextField: string;
|
|
@@ -61,13 +59,11 @@ type LoginSelectors = {
|
|
|
61
59
|
submitButton: string;
|
|
62
60
|
twitterAuthenticationButton: string;
|
|
63
61
|
};
|
|
64
|
-
|
|
65
62
|
type ProfileSelectors = {
|
|
66
63
|
tab: string;
|
|
67
64
|
logoutLink: string;
|
|
68
65
|
profileOptionsContainer: string;
|
|
69
66
|
};
|
|
70
|
-
|
|
71
67
|
type SignUpSelectors = {
|
|
72
68
|
emailTextField: string;
|
|
73
69
|
firstNameTextField: string;
|
|
@@ -108,7 +104,6 @@ type CommonTexts = {
|
|
|
108
104
|
unsavedChangesAlertMessage: string;
|
|
109
105
|
unsavedChangesAlertTitle: string;
|
|
110
106
|
};
|
|
111
|
-
|
|
112
107
|
type MemberText = {
|
|
113
108
|
addMember: string;
|
|
114
109
|
admin: string;
|
|
@@ -129,7 +124,6 @@ type MemberText = {
|
|
|
129
124
|
newHeading: string;
|
|
130
125
|
updatedMemberRole: string;
|
|
131
126
|
};
|
|
132
|
-
|
|
133
127
|
type MemberTableTexts = {
|
|
134
128
|
created: string;
|
|
135
129
|
email: string;
|
|
@@ -137,13 +131,11 @@ type MemberTableTexts = {
|
|
|
137
131
|
role: string;
|
|
138
132
|
teams: string;
|
|
139
133
|
};
|
|
140
|
-
|
|
141
134
|
type SignUpTexts = {
|
|
142
135
|
email: string;
|
|
143
136
|
profile: string;
|
|
144
137
|
tryItFree: string;
|
|
145
138
|
};
|
|
146
|
-
|
|
147
139
|
type Environment = {
|
|
148
140
|
development: string;
|
|
149
141
|
staging: string;
|
|
@@ -151,29 +143,11 @@ type Environment = {
|
|
|
151
143
|
|
|
152
144
|
// utils ------------------------------------------------
|
|
153
145
|
|
|
154
|
-
// Utils: auth
|
|
155
|
-
|
|
156
|
-
function verifySSOLoginPage(): Void;
|
|
157
|
-
|
|
158
|
-
function logout(homeUrl: string): Void;
|
|
159
|
-
|
|
160
|
-
// Utils: date
|
|
161
|
-
|
|
162
|
-
function currentDate(): String;
|
|
163
|
-
|
|
164
|
-
function futureDate(numberOfDays: number = 1): String;
|
|
165
|
-
|
|
166
|
-
function pastDate(numberOfDays: number = 1): String;
|
|
167
|
-
|
|
168
146
|
// Utils: common
|
|
169
|
-
export function initCustomCommands():
|
|
170
|
-
|
|
171
|
-
export function
|
|
172
|
-
|
|
173
|
-
export function getTestTitle(): String;
|
|
174
|
-
|
|
175
|
-
export function getUrl(path: string): String;
|
|
176
|
-
|
|
147
|
+
export function initCustomCommands(): void;
|
|
148
|
+
export function dataCy(dataCyId: string): string;
|
|
149
|
+
export function getTestTitle(): string;
|
|
150
|
+
export function getUrl(path: string): string;
|
|
177
151
|
export function initializeCredentials(props: {
|
|
178
152
|
businessName: string;
|
|
179
153
|
currentUserName: string;
|
|
@@ -183,13 +157,23 @@ export function initializeCredentials(props: {
|
|
|
183
157
|
domain: string;
|
|
184
158
|
subdomainName: string;
|
|
185
159
|
skipSetup: boolean;
|
|
186
|
-
}):
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
160
|
+
}): string;
|
|
161
|
+
/**
|
|
162
|
+
*
|
|
163
|
+
* Curried: false
|
|
164
|
+
*
|
|
165
|
+
* This function joins the given strings with hyphen.
|
|
166
|
+
*
|
|
167
|
+
* Usage:
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
*
|
|
171
|
+
* joinHyphenCase("hello", "world"); // output: "hello-world"
|
|
172
|
+
* @endexample
|
|
173
|
+
*/
|
|
174
|
+
export function joinHyphenCase(string: string | string[]): string;
|
|
175
|
+
export function setListCount(countSelector: string, alias: string): void;
|
|
176
|
+
export function verifyListCount(countSelector: string, count: number): string;
|
|
193
177
|
|
|
194
178
|
// Utils: organization
|
|
195
179
|
export function createOrganization(props: {
|
|
@@ -199,91 +183,103 @@ export function createOrganization(props: {
|
|
|
199
183
|
firstName: string;
|
|
200
184
|
lastName: string;
|
|
201
185
|
subdomainName: string;
|
|
202
|
-
}):
|
|
186
|
+
}): void;
|
|
203
187
|
|
|
204
188
|
// Utils: validation
|
|
189
|
+
export function verifyCrossSiteScript(inputSelector: string, submitSelector: string): void;
|
|
205
190
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
191
|
+
// exporting all utils
|
|
192
|
+
export const authUtils: {
|
|
193
|
+
verifySSOLoginPage: () => void;
|
|
194
|
+
logout: (homeUrl: string) => void;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
*
|
|
198
|
+
* Utils related to the date
|
|
199
|
+
*
|
|
200
|
+
* Import statement
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
*
|
|
204
|
+
* import { dateUtils } from "@bigbinary/neeto-commons-frontend/cypress-utils";
|
|
205
|
+
* @endexample
|
|
206
|
+
* Function to get the current date in YYYY-MM-DD format.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
*
|
|
210
|
+
* dateUtils.currentDate();
|
|
211
|
+
* @endexample
|
|
212
|
+
* Function to return the date after n days from the current date.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
*
|
|
216
|
+
* // Current date is 2023-02-07
|
|
217
|
+
* dateUtils.futureDate(2); // return 2023-02-09
|
|
218
|
+
* @endexample
|
|
219
|
+
* Function to return the date before n days from the current date.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
*
|
|
223
|
+
* // Current date is 2023-02-07
|
|
224
|
+
* dateUtils.pastDate(2); // return 2023-02-05
|
|
225
|
+
* @endexample
|
|
226
|
+
*/
|
|
227
|
+
export const dateUtils: {
|
|
228
|
+
currentDate: () => string;
|
|
229
|
+
futureDate: (numberOfDays: number) => string;
|
|
230
|
+
pastDate: (numberOfDays: number) => string;
|
|
231
|
+
};
|
|
232
|
+
type AddMemberViaRequestPropsType = {
|
|
214
233
|
email: string;
|
|
215
234
|
role: string;
|
|
216
235
|
requestCount: number;
|
|
217
236
|
appName: string;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function addMemberViaUI(email: string, role: string = "Agent"): Void;
|
|
221
|
-
|
|
222
|
-
function activateMember(props: {
|
|
237
|
+
};
|
|
238
|
+
type ActivateMembersPropsType = {
|
|
223
239
|
email: string;
|
|
224
240
|
skipSearchRequest: boolean;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function activateMemberViaRequest(email: string, requestCount: number): Void;
|
|
228
|
-
|
|
229
|
-
function checkColumnCheckBox(fieldSelector: string): Void;
|
|
230
|
-
|
|
231
|
-
function deactivateMember(props: {
|
|
241
|
+
};
|
|
242
|
+
type UpdateMembersPropsType = {
|
|
232
243
|
email: string;
|
|
244
|
+
role: string;
|
|
233
245
|
skipSearchRequest: boolean;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function deactivateMemberViaRequest(email: string, requestCount: number): Void;
|
|
237
|
-
|
|
238
|
-
function updateMemberRole(props: {
|
|
246
|
+
};
|
|
247
|
+
type VerifyMembersPropsType = {
|
|
239
248
|
email: string;
|
|
240
249
|
role: string;
|
|
241
250
|
skipSearchRequest: boolean;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function interceptMemberApi(alias: string, times: number = 1): Void;
|
|
245
|
-
|
|
246
|
-
function navigateToMembersPage(waitForRequest: boolean = true): Void;
|
|
247
|
-
|
|
248
|
-
function unCheckColumnCheckBox(fieldSelector: string): Void;
|
|
249
|
-
|
|
250
|
-
function verifyMemberDetails(props: {
|
|
251
|
+
};
|
|
252
|
+
type DeactivateMembersPropsType = {
|
|
251
253
|
email: string;
|
|
252
|
-
role: string;
|
|
253
254
|
skipSearchRequest: boolean;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
updateMemberRole,
|
|
268
|
-
interceptMemberApi,
|
|
269
|
-
navigateToMembersPage,
|
|
270
|
-
unCheckColumnCheckBox,
|
|
271
|
-
verifyMemberDetails,
|
|
255
|
+
};
|
|
256
|
+
export const memberUtils: {
|
|
257
|
+
addMemberViaRequest: (props: AddMemberViaRequestPropsType) => void;
|
|
258
|
+
addMemberViaUI: (email: string, role: string) => void;
|
|
259
|
+
activateMember: (props: ActivateMembersPropsType) => void;
|
|
260
|
+
deactivateMember: (props: DeactivateMembersPropsType) => void;
|
|
261
|
+
checkColumnCheckBox: (fieldSelector: string) => void;
|
|
262
|
+
deactivateMemberViaRequest: (email: string, requestCount: number) => void;
|
|
263
|
+
updateMemberRole: (props: UpdateMembersPropsType) => void;
|
|
264
|
+
interceptMemberApi: (alias: string, times: number) => void;
|
|
265
|
+
navigateToMembersPage: (waitForRequest: boolean) => void;
|
|
266
|
+
unCheckColumnCheckBox: (fieldSelector: string) => void;
|
|
267
|
+
verifyMemberDetails: (props: VerifyMembersPropsType) => void;
|
|
272
268
|
};
|
|
273
269
|
|
|
274
270
|
// exporting all selectors
|
|
275
271
|
|
|
276
|
-
export
|
|
277
|
-
export
|
|
278
|
-
export
|
|
279
|
-
export
|
|
280
|
-
export
|
|
272
|
+
export const commonSelectors: CommonSelectors;
|
|
273
|
+
export const memberSelectors: MemberSelectors;
|
|
274
|
+
export const loginSelectors: LoginSelectors;
|
|
275
|
+
export const profileSelectors: ProfileSelectors;
|
|
276
|
+
export const signUpSelectors: SignUpSelectors;
|
|
281
277
|
|
|
282
278
|
// exporting all texts
|
|
283
279
|
|
|
284
|
-
export
|
|
285
|
-
export
|
|
286
|
-
export
|
|
287
|
-
export
|
|
288
|
-
export
|
|
289
|
-
export
|
|
280
|
+
export const commonTexts: CommonTexts;
|
|
281
|
+
export const memberTexts: MemberText;
|
|
282
|
+
export const memberTableTexts: MemberTableTexts;
|
|
283
|
+
export const signUpTexts: SignUpTexts;
|
|
284
|
+
export const environment: Environment;
|
|
285
|
+
export const isStagingEnv: boolean;
|
package/initializers.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
type Skippable<T> = boolean | Partial<T>;
|
|
2
|
-
|
|
3
2
|
type Configurations = {
|
|
4
|
-
translationResources?: {
|
|
3
|
+
translationResources?: {
|
|
4
|
+
en: {
|
|
5
|
+
translation: object;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
5
8
|
skip?: Partial<{
|
|
6
9
|
globalProps: boolean;
|
|
7
10
|
mixpanel: boolean;
|
|
@@ -26,7 +29,6 @@ type Configurations = {
|
|
|
26
29
|
}>;
|
|
27
30
|
}>;
|
|
28
31
|
};
|
|
29
|
-
|
|
30
32
|
type GlobalPropsType = {
|
|
31
33
|
railsEnv: string;
|
|
32
34
|
honeybadgerApiKey: string;
|
|
@@ -56,12 +58,21 @@ type GlobalPropsType = {
|
|
|
56
58
|
permissions: string[];
|
|
57
59
|
[key: string]: any;
|
|
58
60
|
};
|
|
59
|
-
|
|
60
|
-
export default function initializeApplication(
|
|
61
|
-
configurations: Configurations
|
|
62
|
-
): void;
|
|
63
|
-
|
|
61
|
+
export default function initializeApplication(configurations: Configurations): void;
|
|
64
62
|
export const globalProps: GlobalPropsType;
|
|
65
63
|
|
|
66
64
|
/** @deprecated use useDisplayErrorPage from react-utils bundle */
|
|
67
|
-
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* This hook will return true if any API request fails with 404 or 403 status.
|
|
68
|
+
*
|
|
69
|
+
* Until any such API response is received, it will return false. It can be used
|
|
70
|
+
*
|
|
71
|
+
* to render ErrorPage conditionally. Refer:
|
|
72
|
+
*
|
|
73
|
+
* axios error response handler
|
|
74
|
+
*
|
|
75
|
+
* for more details.
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export function useDisplayErrorPage(): Boolean;
|