@bigbinary/neeto-email-notifications-frontend 1.1.0 → 1.2.1

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 CHANGED
@@ -1,7 +1,83 @@
1
1
  # neeto-email-notifications-nano
2
2
 
3
- This repo acts as the source of truth for the new nano's structure, configs,
4
- data etc.
3
+ [![BuildStatus](https://neeto-engineering.neetoci.com/badges/neeto-email-notifications-nano/workflows/branch.svg)](https://neeto-engineering.neetoci.com/projects/neeto-email-notifications-nano)
4
+ ![package version](https://img.shields.io/npm/v/@bigbinary/neeto-email-notifications-frontend?color=greenyellow)
5
+ ![npm downloads](https://img.shields.io/npm/dw/@bigbinary/neeto-email-notifications-frontend?color=greenyellow)
6
+
7
+ neeto-email-notifications-nano enables the management of email notifications
8
+ across neeto products
9
+
10
+ # Installation
11
+
12
+ [Engine and package installation](./docs/engine-and-package-installation.md)
13
+
14
+ # Usage
15
+
16
+ ### Backend
17
+
18
+ 1. Create required email notification models inherited from
19
+ `NeetoEmailNotificationsEngine::EmailNotification`. For example,
20
+
21
+ ```ruby
22
+ class PushEmailNotification < ::NeetoEmailNotificationsEngine::EmailNotification
23
+ default_scope { where("custom_fields -> 'notification_type' ? :value", value: "Push") }
24
+ after_initialize :set_custom_field
25
+
26
+ def set_custom_field
27
+ self.custom_fields ||= {}
28
+ self.custom_fields[custom_field_key] = "Push"
29
+ end
30
+
31
+ def custom_field_key
32
+ "notification_type"
33
+ end
34
+ end
35
+ ```
36
+
37
+ 2. Add the required associations to the polymorphic model. For example,
38
+
39
+ ```ruby
40
+ class Form < ApplicationRecord
41
+ ....
42
+
43
+ has_many :email_notifications, as: :notification_holder, class_name: "::NeetoEmailNotificationsEngine::EmailNotification", dependent: :destroy
44
+ has_one :push_email_notification, as: :notification_holder
45
+
46
+ ....
47
+ end
48
+ ```
49
+
50
+ ### Frontend
51
+
52
+ 1. Add the component to the host application. For example,
53
+ ```js
54
+ <NeetoEmailNotification
55
+ title="Email notification"
56
+ subtitle="Send an email notification when a new event occurred"
57
+ emailPreviewProps={{ productName: "Product" }}
58
+ emailNotificationParams={{
59
+ notificationHolderType: "Form",
60
+ notificationHolderId: formId,
61
+ customFields: { notificationType: "Push" },
62
+ }}
63
+ />
64
+ ```
65
+
66
+ <img width="1318" alt="NeetoEmailNotification component" src="https://github.com/bigbinary/neeto-email-notifications-nano/assets/89389135/bbe89fce-98ad-4974-9617-2a69d9baa61a">
67
+
68
+ | Prop | Type | Default Value | Description |
69
+ | ----------------------- | ------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
70
+ | title | String | "Email notification" | The title of the component. |
71
+ | subtitle | String | "Send an email notification when a new event occurred" | The subtitle of the component. |
72
+ | disabled | Boolean | false | Disables the component |
73
+ | emailFormikProps | Object | {} | Props for [`<EmailFormProvider />`](https://github.com/bigbinary/neeto-molecules/blob/main/docs/components.md#emailformprovider) |
74
+ | emailFormProps | Object | {} | Props for [`<EmailForm />`](https://github.com/bigbinary/neeto-molecules/blob/main/docs/components.md#emailform) |
75
+ | emailPreviewProps | Object | {} | Props for [`<EmailPreview />`](https://github.com/bigbinary/neeto-molecules/blob/main/docs/components.md#emailpreview) |
76
+ | emailNotificationParams | Object | {} | Contains params required for fetching email notification |
77
+ | tooltipProps | Object | {} | Props for `<Tooltip>` for showing toolTip content when disabled |
78
+ | children | Node | undefined | Additional content to be displayed inside the component |
79
+
80
+ <!-- TODO: Add references -->
5
81
 
6
82
  # Local Development Setup
7
83
 
@@ -15,5 +91,4 @@ data etc.
15
91
 
16
92
  # Publish instructions
17
93
 
18
- 1. [Engine and package installation](./docs/engine-and-package-installation.md)
19
- 2. [Building and releasing](./docs/building-and-releasing.md)
94
+ 1. [Building and releasing](./docs/building-and-releasing.md)
package/dist/index.cjs.js CHANGED
@@ -2580,7 +2580,7 @@ var errors = {
2580
2580
  };
2581
2581
  var emailNotification = {
2582
2582
  title: "Email notification",
2583
- subTitle: "Send an email notification when a new event occured"
2583
+ subTitle: "Send an email notification when a new event occurred"
2584
2584
  };
2585
2585
  var en = {
2586
2586
  welcomeScreen: welcomeScreen,
package/dist/index.js CHANGED
@@ -2551,7 +2551,7 @@ var errors = {
2551
2551
  };
2552
2552
  var emailNotification = {
2553
2553
  title: "Email notification",
2554
- subTitle: "Send an email notification when a new event occured"
2554
+ subTitle: "Send an email notification when a new event occurred"
2555
2555
  };
2556
2556
  var en = {
2557
2557
  welcomeScreen: welcomeScreen,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-email-notifications-frontend",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "A repo acts as the source of truth for the new nano's structure, configs, data etc.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/bigbinary/neeto-email-notifications-nano",
@@ -49,12 +49,14 @@
49
49
  "@bigbinary/babel-preset-neeto": "1.0.3",
50
50
  "@bigbinary/eslint-plugin-neeto": "1.0.64",
51
51
  "@bigbinary/neeto-commons-frontend": "2.0.127",
52
+ "@bigbinary/neeto-editor": "^1.28.9",
52
53
  "@bigbinary/neeto-icons": "1.12.3",
53
54
  "@bigbinary/neeto-molecules": "1.0.92",
54
55
  "@bigbinary/neetoui": "5.0.13",
55
56
  "@emotion/is-prop-valid": "1.2.0",
56
57
  "@faker-js/faker": "8.0.2",
57
58
  "@honeybadger-io/react": "2.0.1",
59
+ "@rails/actiontext": "^7.0.8",
58
60
  "@rollup/plugin-alias": "5.0.0",
59
61
  "@rollup/plugin-babel": "6.0.3",
60
62
  "@rollup/plugin-commonjs": "25.0.2",
@@ -110,14 +112,15 @@
110
112
  "prettier-plugin-tailwindcss": "0.3.0",
111
113
  "process": "0.11.10",
112
114
  "ramda": "0.29.0",
113
- "react": "17.0.2",
114
- "react-dom": "17.0.2",
115
+ "react": "^18.2.0",
116
+ "react-dom": "^18.2.0",
115
117
  "react-helmet": "6.1.0",
116
118
  "react-i18next": "13.0.1",
117
119
  "react-query": "3.39.3",
118
- "react-router-dom": "5.2.0",
120
+ "react-router-dom": "5.3.3",
121
+ "react-router-nav-prompt": "0.4.1",
119
122
  "react-toastify": "8.0.2",
120
- "react_ujs": "2.6.2",
123
+ "react_ujs": "^3.1.1",
121
124
  "rollup": "2.79.1",
122
125
  "rollup-plugin-analyzer": "4.0.0",
123
126
  "rollup-plugin-cleaner": "1.0.0",
@@ -126,10 +129,12 @@
126
129
  "sass": "1.63.6",
127
130
  "sass-loader": "13.3.2",
128
131
  "shakapacker": "6.6.0",
132
+ "source-map-loader": "^4.0.1",
129
133
  "stream-browserify": "3.0.0",
130
134
  "stream-http": "3.2.0",
131
135
  "style-loader": "3.3.3",
132
136
  "tailwindcss": "npm:@tailwindcss/postcss7-compat",
137
+ "trix": "^2.0.5",
133
138
  "tty-browserify": "0.0.1",
134
139
  "url": "0.11.1",
135
140
  "util": "0.12.5",
@@ -138,14 +143,15 @@
138
143
  "webpack-assets-manifest": "5.1.0",
139
144
  "webpack-cli": "5.1.4",
140
145
  "webpack-dev-server": "4.15.1",
141
- "yup": "0.32.11"
146
+ "yup": "0.32.11",
147
+ "zustand": "4.3.2"
142
148
  },
143
149
  "peerDependencies": {
144
150
  "@bigbinary/neeto-commons-frontend": "latest",
145
- "@bigbinary/neeto-editor": "^1.26.3",
146
- "@bigbinary/neeto-icons": "^1.9.22",
147
- "@bigbinary/neeto-molecules": "^1.0.9",
148
- "@bigbinary/neetoui": "^4.4.10",
151
+ "@bigbinary/neeto-editor": "latest",
152
+ "@bigbinary/neeto-icons": "latest",
153
+ "@bigbinary/neeto-molecules": "latest",
154
+ "@bigbinary/neetoui": "latest",
149
155
  "@honeybadger-io/react": "^2.0.1",
150
156
  "axios": "^0.27.2",
151
157
  "classnames": "^2.3.2",
@@ -153,11 +159,11 @@
153
159
  "js-logger": "^1.6.1",
154
160
  "mixpanel-browser": "^2.45.0",
155
161
  "ramda": "^0.29.0",
156
- "react": "17.0.2",
157
- "react-dom": "17.0.2",
162
+ "react": "18.2.0",
163
+ "react-dom": "18.2.0",
158
164
  "react-helmet": "^6.1.0",
159
165
  "react-query": "3.39.2",
160
- "react-router-dom": "5.3.0",
166
+ "react-router-dom": "5.3.3",
161
167
  "react-toastify": "8.2.0",
162
168
  "yup": "^0.32.11",
163
169
  "zustand": "4.3.2"
@@ -169,13 +175,5 @@
169
175
  "node": ">=18.12",
170
176
  "npm": ">=9",
171
177
  "yarn": ">=1.22"
172
- },
173
- "dependencies": {
174
- "@bigbinary/neeto-editor": "^1.28.9",
175
- "@rails/actiontext": "^7.0.8",
176
- "react-router-nav-prompt": "0.4.1",
177
- "source-map-loader": "^4.0.1",
178
- "trix": "^2.0.5",
179
- "zustand": "4.3.2"
180
178
  }
181
179
  }
package/types.d.ts CHANGED
@@ -66,6 +66,4 @@ interface EmailNotificationProps {
66
66
  children?: React.ReactNode;
67
67
  }
68
68
 
69
- const NeetoEmailNotification: React.FC<EmailNotificationProps>;
70
-
71
- export default NeetoEmailNotification
69
+ export const NeetoEmailNotification: React.FC<EmailNotificationProps>;