@bigbinary/neeto-email-notifications-frontend 1.2.0 → 1.3.0

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
+ <NeetoEmailNotificationForm
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="NeetoEmailNotificationForm 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,
@@ -2800,7 +2800,7 @@ var renderText = function renderText(text, fallbackTranslation) {
2800
2800
 
2801
2801
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2802
2802
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2803
- var NeetoEmailNotification = function NeetoEmailNotification(_ref) {
2803
+ var NeetoEmailNotificationForm = function NeetoEmailNotificationForm(_ref) {
2804
2804
  var _ref$emailNotificatio = _ref.emailNotificationParams,
2805
2805
  emailNotificationParams = _ref$emailNotificatio === void 0 ? {} : _ref$emailNotificatio,
2806
2806
  _ref$emailPreviewProp = _ref.emailPreviewProps,
@@ -2888,5 +2888,5 @@ var NeetoEmailNotification = function NeetoEmailNotification(_ref) {
2888
2888
  }));
2889
2889
  };
2890
2890
 
2891
- exports.NeetoEmailNotification = NeetoEmailNotification;
2891
+ exports.NeetoEmailNotificationForm = NeetoEmailNotificationForm;
2892
2892
  //# sourceMappingURL=index.cjs.js.map