@bigbinary/neeto-email-notifications-frontend 1.2.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 +79 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/types.d.ts +1 -3
package/README.md
CHANGED
|
@@ -1,7 +1,83 @@
|
|
|
1
1
|
# neeto-email-notifications-nano
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
[](https://neeto-engineering.neetoci.com/projects/neeto-email-notifications-nano)
|
|
4
|
+

|
|
5
|
+

|
|
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. [
|
|
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
|
|
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
|
|
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.2.
|
|
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",
|
package/types.d.ts
CHANGED