@bigbinary/neeto-molecules 1.0.91-beta → 1.0.92-beta

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.
Files changed (62) hide show
  1. package/README.md +4 -0
  2. package/dist/Breadcrumbs.cjs.js +44 -0
  3. package/dist/Breadcrumbs.cjs.js.map +1 -0
  4. package/dist/Breadcrumbs.js +38 -0
  5. package/dist/Breadcrumbs.js.map +1 -0
  6. package/dist/Codeblock.cjs.js +302 -0
  7. package/dist/Codeblock.cjs.js.map +1 -0
  8. package/dist/Codeblock.js +296 -0
  9. package/dist/Codeblock.js.map +1 -0
  10. package/dist/CustomDomain.cjs.js +4 -0
  11. package/dist/CustomDomain.cjs.js.map +1 -1
  12. package/dist/CustomDomain.js +4 -0
  13. package/dist/CustomDomain.js.map +1 -1
  14. package/dist/CustomDomainDashboard.cjs.js +11 -5
  15. package/dist/CustomDomainDashboard.cjs.js.map +1 -1
  16. package/dist/CustomDomainDashboard.js +11 -5
  17. package/dist/CustomDomainDashboard.js.map +1 -1
  18. package/dist/EmailForm.cjs.js +1237 -7
  19. package/dist/EmailForm.cjs.js.map +1 -1
  20. package/dist/EmailForm.js +1238 -8
  21. package/dist/EmailForm.js.map +1 -1
  22. package/dist/EmailPreview.cjs.js +1216 -5
  23. package/dist/EmailPreview.cjs.js.map +1 -1
  24. package/dist/EmailPreview.js +1216 -5
  25. package/dist/EmailPreview.js.map +1 -1
  26. package/dist/Header.cjs.js +4 -1
  27. package/dist/Header.cjs.js.map +1 -1
  28. package/dist/Header.js +4 -1
  29. package/dist/Header.js.map +1 -1
  30. package/dist/IntegrationCard.cjs.js +37 -2
  31. package/dist/IntegrationCard.cjs.js.map +1 -1
  32. package/dist/IntegrationCard.js +37 -2
  33. package/dist/IntegrationCard.js.map +1 -1
  34. package/dist/MenuBar.cjs.js +19446 -16229
  35. package/dist/MenuBar.cjs.js.map +1 -1
  36. package/dist/MenuBar.js +19446 -16229
  37. package/dist/MenuBar.js.map +1 -1
  38. package/dist/Security.cjs.js +1921 -0
  39. package/dist/Security.cjs.js.map +1 -0
  40. package/dist/Security.js +1895 -0
  41. package/dist/Security.js.map +1 -0
  42. package/dist/Settings.cjs.js +387 -0
  43. package/dist/Settings.cjs.js.map +1 -0
  44. package/dist/Settings.js +381 -0
  45. package/dist/Settings.js.map +1 -0
  46. package/dist/ShareViaEmail.cjs.js +1216 -4
  47. package/dist/ShareViaEmail.cjs.js.map +1 -1
  48. package/dist/ShareViaEmail.js +1216 -4
  49. package/dist/ShareViaEmail.js.map +1 -1
  50. package/dist/Sidebar.cjs.js +19499 -16250
  51. package/dist/Sidebar.cjs.js.map +1 -1
  52. package/dist/Sidebar.js +19499 -16250
  53. package/dist/Sidebar.js.map +1 -1
  54. package/package.json +16 -13
  55. package/src/translations/en.json +34 -0
  56. package/types/Breadcrums.d.ts +27 -0
  57. package/types/Codeblock.d.ts +36 -0
  58. package/types/CopyToClipboardButton.d.ts +8 -7
  59. package/types/IntegrationCard.d.ts +23 -21
  60. package/types/Security.d.ts +35 -0
  61. package/types/Settings.d.ts +95 -0
  62. package/types/Sidebar.d.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-molecules",
3
- "version": "1.0.91-beta",
3
+ "version": "1.0.92-beta",
4
4
  "description": "A package of reusable molecular components for neeto products.",
5
5
  "repository": "git@github.com:bigbinary/neeto-molecules.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -8,7 +8,7 @@
8
8
  "scripts": {
9
9
  "prepare": "husky install",
10
10
  "sync_with_wheel": "./.scripts/sync_with_wheel.sh",
11
- "test": "TZ=UTC jest",
11
+ "test": "TZ=UTC jest --runInBand",
12
12
  "bundle": "NODE_ENV=production rollup -c rollup.config.js && yarn build:jsdoc",
13
13
  "build": "NODE_ENV=production build-storybook",
14
14
  "serve": "node .storybook/db",
@@ -48,7 +48,7 @@
48
48
  "@babel/runtime": "^7.19.0",
49
49
  "@bigbinary/babel-preset-neeto": "^1.0.3",
50
50
  "@bigbinary/eslint-plugin-neeto": "^1.1.14",
51
- "@bigbinary/neeto-commons-frontend": "2.0.119",
51
+ "@bigbinary/neeto-commons-frontend": "2.0.134",
52
52
  "@bigbinary/neeto-editor": "1.27.0-beta.1",
53
53
  "@bigbinary/neeto-filters-frontend": "^2.11.15",
54
54
  "@bigbinary/neeto-icons": "^1.14.0",
@@ -74,10 +74,10 @@
74
74
  "@svgr/webpack": "^6.5.1",
75
75
  "@tailwindcss/line-clamp": "^0.4.4",
76
76
  "@testing-library/jest-dom": "5.16.2",
77
- "@testing-library/react": "12.1.3",
77
+ "@testing-library/react": "^14.0.0",
78
78
  "@testing-library/react-hooks": "^8.0.0",
79
79
  "@testing-library/user-event": "13.5.0",
80
- "antd": "4.24.3",
80
+ "antd": "5.9.2",
81
81
  "autoprefixer": "^10.4.13",
82
82
  "axios": "^0.27.2",
83
83
  "babel-jest": "27.0.6",
@@ -104,7 +104,7 @@
104
104
  "eslint-plugin-react": "7.29.4",
105
105
  "eslint-plugin-react-hooks": "4.5.0",
106
106
  "eslint-plugin-unused-imports": "2.0.0",
107
- "formik": "^2.2.9",
107
+ "formik": "2.4.5",
108
108
  "framer-motion": "^4.1.17",
109
109
  "husky": "^7.0.4",
110
110
  "i18next": "^22.5.1",
@@ -117,6 +117,7 @@
117
117
  "mixpanel-browser": "^2.45.0",
118
118
  "mousetrap": "^1.6.5",
119
119
  "mousetrap-global-bind": "^1.1.0",
120
+ "nock": "^13.3.3",
120
121
  "papaparse": "^5.4.0",
121
122
  "platform": "1.3.6",
122
123
  "postcss": "^8.4.17",
@@ -130,14 +131,15 @@
130
131
  "qs": "^6.11.0",
131
132
  "ramda": "^0.29.0",
132
133
  "raw-loader": "^4.0.2",
133
- "react": "^17.0.2",
134
- "react-dom": "17.0.2",
134
+ "react": "^18.2.0",
135
+ "react-dom": "^18.2.0",
135
136
  "react-dropzone": "^11.2.4",
136
137
  "react-helmet": "^6.1.0",
137
138
  "react-hotkeys-hook": "3.3.2",
138
139
  "react-i18next": "^12.3.1",
139
140
  "react-query": "^3.39.2",
140
- "react-router-dom": "^5.2.0",
141
+ "react-router-dom": "^5.3.3",
142
+ "react-syntax-highlighter": "^15.5.0",
141
143
  "react-toastify": "^9.0.8",
142
144
  "react-transition-group": "^4.4.5",
143
145
  "react-window": "^1.8.9",
@@ -163,21 +165,22 @@
163
165
  "@honeybadger-io/react": "2.0.1",
164
166
  "@neetohq/timezones": "latest",
165
167
  "@svgr/webpack": "^6.5.1",
166
- "antd": "4.24.3",
168
+ "antd": "5.9.2",
167
169
  "axios": "^0.27.2",
168
170
  "cypress": "11.2.0",
169
171
  "dayjs": "1.11.1",
170
172
  "dotenv-webpack": "^8.0.1",
171
- "formik": "^2.2.9",
173
+ "formik": "2.4.5",
172
174
  "i18next": "^22.5.1",
173
175
  "js-logger": "^1.6.1",
174
176
  "mixpanel-browser": "^2.45.0",
175
177
  "ramda": "^0.29.0",
176
- "react": "^17.0.2",
178
+ "react": "^18.2.0",
177
179
  "react-helmet": "^6.1.0",
178
180
  "react-i18next": "^12.3.1",
179
181
  "react-query": "^3.39.2",
180
- "react-router-dom": "^5.2.0",
182
+ "react-router-dom": "^5.3.3",
183
+ "react-syntax-highlighter": "^15.5.0",
181
184
  "react-toastify": "^9.0.8",
182
185
  "shakapacker": "^6.5.5",
183
186
  "tailwindcss": "npm:@tailwindcss/postcss7-compat",
@@ -485,6 +485,9 @@
485
485
  "cc": "CC",
486
486
  "bCc": "BCC"
487
487
  },
488
+ "tooltips": {
489
+ "replyTo": "'Reply to' is the designated address where replies to the email should be sent."
490
+ },
488
491
  "placeholders": {
489
492
  "emailPlaceholder": "Write email address",
490
493
  "commaSeparatedEmails": "Use comma (‘) to add multiple email addresses"
@@ -498,6 +501,37 @@
498
501
  "input": {
499
502
  "editButtonDefaultTooltip": "Edit"
500
503
  }
504
+ },
505
+ "settingsPage": {
506
+ "noData": "No settings found"
507
+ },
508
+ "security": {
509
+ "labels": {
510
+ "notSecured": "Public, anyone can access {{name}}",
511
+ "passwordEnabled": "Secure {{name}} with password",
512
+ "otpEnabled": "Secure {{name}} by allowing emails with certain keywords",
513
+ "private": "Private, logged in members only",
514
+ "password": "Password",
515
+ "keyword": "Keyword",
516
+ "keywordForm": {
517
+ "KB": "Add keywords that must be present in the email address for it to be allowed access to KB. For example if you want to give access only to the folks whose email ends with @bigbinary.com then you can add @bigbinary as the keyword required. You can add as many keywords as you want.",
518
+ "Course": "Add keywords that must be present in the email address for it to be allowed access to the course."
519
+ },
520
+ "addKeyWord": "Add keyword"
521
+ },
522
+ "validation": {
523
+ "required": "{{what}} is required.",
524
+ "min": "{{entity}} should be more than or equal to {{min}} characters."
525
+ },
526
+ "placeholders": {
527
+ "exists": "{{what}} already exists",
528
+ "enterPassword": "Enter password",
529
+ "enterKeyword": "Enter keyword"
530
+ },
531
+ "appName": {
532
+ "KB": "KB",
533
+ "Course": "Course"
534
+ }
501
535
  }
502
536
  }
503
537
  }
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ /**
3
+ *
4
+ * Component to show breadcrumbs
5
+ *
6
+ * @example
7
+ *
8
+ * import React from "react";
9
+ * import Breadcrumbs from "@bigbinary/neeto-molecules/Breadcrumbs";
10
+ *
11
+ * const SETTINGS_BREADCRUMBS = [
12
+ * {
13
+ * text: "Settings",
14
+ * link: "/admin/settings",
15
+ * },
16
+ * ];
17
+ *
18
+ * const Page = () => <Breadcrumbs Breadcrumbs={SETTINGS_BREADCRUMBS} />;
19
+ * @endexample
20
+ */
21
+ const Breadcrumbs: React.FC<{
22
+ breadcrumbs?: {
23
+ text: string;
24
+ link: string;
25
+ }[];
26
+ }>;
27
+ export default Breadcrumbs;
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { SyntaxHighlighterProps } from "react-syntax-highlighter";
3
+ import { CopyToClipboardButtonProps } from "./CopyToClipboardButton";
4
+ /**
5
+ *
6
+ * Codeblock can be used to render a block of code, with appropriate syntax
7
+ *
8
+ * highlighting, and a copy code button.
9
+ *
10
+ * Note: To use this component, you should install
11
+ *
12
+ * react-syntax-highlighter@^15.5.0 package.
13
+ *
14
+ * ![image](https://github.com/bigbinary/neeto-molecules/assets/66865722/ed5c589f-7086-46b9-b8b2-2746afa7e750|height=200|width=300)
15
+ *
16
+ * @example
17
+ *
18
+ * import React from "react";
19
+ * import Codeblock from "@bigbinary/neeto-molecules/Codeblock";
20
+ * import { generateEmbedCode } from "./utils";
21
+ *
22
+ * const EmbedPage = () => (
23
+ * <Codeblock
24
+ * code={generateEmbedCode()}
25
+ * codeblockProps={{ showLineNumbers: true }}
26
+ * />
27
+ * );
28
+ * @endexample
29
+ */
30
+ const Codeblock: React.FC<{
31
+ code: string;
32
+ showCopyButton?: boolean;
33
+ codeblockProps?: Partial<SyntaxHighlighterProps>;
34
+ copyButtonProps?: Partial<CopyToClipboardButtonProps>;
35
+ }>;
36
+ export default Codeblock;
@@ -1,4 +1,11 @@
1
1
  import React from "react";
2
+ export interface CopyToClipboardButtonProps {
3
+ className?: string;
4
+ icon?: string | any;
5
+ label?: string;
6
+ value: string;
7
+ style?: "primary" | "secondary" | "text";
8
+ }
2
9
  /**
3
10
  *
4
11
  * A button that copies the given value to the clipboard.
@@ -12,11 +19,5 @@ import React from "react";
12
19
  * );
13
20
  * @endexample
14
21
  */
15
- const CopyToClipboardButton: React.FC<{
16
- className?: string;
17
- icon?: string | any;
18
- label?: string;
19
- value: string;
20
- style?: 'primary' | 'secondary' | 'text';
21
- }>;
22
+ const CopyToClipboardButton: React.FC<CopyToClipboardButtonProps>;
22
23
  export default CopyToClipboardButton;
@@ -1,5 +1,27 @@
1
1
  import { IconProps } from "neetoicons";
2
2
  import React, { ReactElement } from "react";
3
+ export interface IntegrationCardProps {
4
+ icon: React.FC<IconProps>;
5
+ subIcons?: React.FC<IconProps>[];
6
+ label: string;
7
+ description: string;
8
+ className?: string;
9
+ onConnect: (...args: any[]) => any;
10
+ onDisconnect?: (...args: any[]) => any;
11
+ onManage?: (...args: any[]) => any;
12
+ onClick?: (...args: any[]) => any;
13
+ isLoading?: boolean;
14
+ isConnected?: boolean;
15
+ isFailed?: boolean;
16
+ isExpired?: boolean;
17
+ disabled?: boolean;
18
+ hidden?: boolean;
19
+ hideDisconnect?: boolean;
20
+ tooltipProps?: Partial<TooltipProps>;
21
+ customDropdown?: React.ReactNode;
22
+ children?: React.ReactNode;
23
+ dataCy?: string;
24
+ }
3
25
  /**
4
26
  *
5
27
  * A common component used for integrations across neeto products.
@@ -30,25 +52,5 @@ import React, { ReactElement } from "react";
30
52
  * );
31
53
  * @endexample
32
54
  */
33
- const IntegrationCard: React.FC<{
34
- icon: React.FC<IconProps>;
35
- subIcons?: React.FC<IconProps>[];
36
- label: string;
37
- description: string;
38
- className?: string;
39
- onConnect: (...args: any[]) => any;
40
- onDisconnect?: (...args: any[]) => any;
41
- onManage?: (...args: any[]) => any;
42
- onClick?: (...args: any[]) => any;
43
- isLoading?: boolean;
44
- isConnected?: boolean;
45
- isFailed?: boolean;
46
- isExpired?: boolean;
47
- disabled?: boolean;
48
- hidden?: boolean;
49
- hideDisconnect?: boolean;
50
- tooltipProps?: Partial<TooltipProps>;
51
- customDropdown?: React.ReactNode;
52
- children?: React.ReactNode;
53
- }>;
55
+ const IntegrationCard: React.FC<IntegrationCardProps>;
54
56
  export default IntegrationCard;
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ /**
3
+ *
4
+ * A common component to secure neeto applications.
5
+ *
6
+ * @example
7
+ *
8
+ * import React from "react";
9
+ * import Security from "@bigbinary/neeto-molecules/Security";
10
+ *
11
+ * const SETTINGS_BREADCRUMBS = [
12
+ * {
13
+ * text: "Settings",
14
+ * link: "/admin/settings",
15
+ * },
16
+ * ];
17
+ *
18
+ * const Security = () => (
19
+ * <Security breadcrumbs={SETTINGS_BREADCRUMBS} title="Security" />
20
+ * );
21
+ * @endexample
22
+ */
23
+ const Security: React.FC<{
24
+ breadcrumbs?: {
25
+ text: string;
26
+ link: string;
27
+ }[];
28
+ title: string;
29
+ url: string;
30
+ radioItems: {
31
+ label: string;
32
+ value: string;
33
+ }[];
34
+ }>;
35
+ export default Security;
@@ -0,0 +1,95 @@
1
+ import React, { ReactNode } from "react";
2
+ import { IntegrationCardProps } from "./IntegrationCard";
3
+ type SettingItem = {
4
+ label: string;
5
+ path: string;
6
+ } & Partial<IntegrationCardProps>;
7
+ type SettingCategory = {
8
+ id: string;
9
+ label: string;
10
+ isIntegration?: boolean;
11
+ items: SettingItem[];
12
+ };
13
+ /**
14
+ *
15
+ * Settings can be used to create a settings page card layout.
16
+ *
17
+ * ![image](https://github.com/bigbinary/neeto-molecules/assets/66865722/16af3d07-e96a-4b4e-8013-ed6fa577c7b8|height=200|width=300)
18
+ *
19
+ * @example
20
+ *
21
+ * categories={[
22
+ * {
23
+ * id: "general-settings",
24
+ * label: "General Settings",
25
+ * items: [
26
+ * {
27
+ * label: 'Ticket tags',
28
+ * description: 'Create and manage tags',
29
+ * icon: TicketIcon,
30
+ * path: '/settings/general/ticket_tags'
31
+ * dataCy: 'Ticket tags' //dataCy can be passed here.
32
+ * // other props will be passed on to the setting card.
33
+ * }
34
+ * ...
35
+ * ...
36
+ * //more items
37
+ * ]
38
+ * },
39
+ * {
40
+ * id: "integrations",
41
+ * isIntegration: true //Integrations section MUST have 'isIntegration: true',
42
+ * label: "Integrations",
43
+ * items: [
44
+ * {
45
+ * label: 'Github',
46
+ * description: 'Connect with github',
47
+ * icon: GithubIcon
48
+ * onConnect: () => setIsIntegrationModalOpen(true)
49
+ * onDisconnect: ()=> setIsIntegrationDisconnectModalOpen(true)
50
+ * ...
51
+ * ...
52
+ * //rest of the props for IntegrationCard should be passed here.
53
+ * // other props will be passed on to the integration card.
54
+ * }
55
+ * ],
56
+ * },
57
+ * ...
58
+ * ...
59
+ * //more categories
60
+ * ]}
61
+ * @endexample
62
+ * Note: This component also supports "scroll-into-view" functionality to scroll
63
+ *
64
+ * specific setting categories into view, based on the query params. For example,
65
+ *
66
+ * the page will scroll to the "Integrations" category, when the query params
67
+ *
68
+ * contain ?category=integrations. The query param should be the id of the
69
+ *
70
+ * category.
71
+ *
72
+ * @example
73
+ *
74
+ * import React, { useState } from "react";
75
+ * import Settings from "@bigbinary/neeto-molecules/Settings";
76
+ * import { Modal as IntegrationModal } from "neetointegrations"
77
+ * import { getCategories } from "./utils";
78
+ *
79
+ * const SettingsPage = () => {
80
+ * const [isOpen, setIsOpen] = useState(false);
81
+ *
82
+ * return (
83
+ * <div>
84
+ * <Settings categories={getCategories({setIsIntegrationModalOpen: setIsOpen})} />
85
+ * <IntegrationModal isOpen={isOpen}>
86
+ * </div>
87
+ * );
88
+ * };
89
+ * @endexample
90
+ */
91
+ const Settings: React.FC<{
92
+ categories: SettingCategory[];
93
+ className?: string;
94
+ }>;
95
+ export default Settings;
@@ -6,6 +6,7 @@ type NavLinkItemType = {
6
6
  label?: React.ReactNode;
7
7
  icon?: any;
8
8
  description?: React.ReactNode;
9
+ isActive: () => boolean;
9
10
  } & React.PropsWithoutRef<NavLinkProps<any>> & React.RefAttributes<HTMLAnchorElement>;
10
11
  type LinkType = {
11
12
  onClick?: React.MouseEventHandler<HTMLButtonElement>;