2.2.6 • Published 9 months ago

@bigbinary/neeto-email-notifications-frontend v2.2.6

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
9 months ago

neeto-email-notifications-nano

The neeto-email-notifications-nano enables the management of email notifications within neeto applications. The nano exports the @bigbinary/neeto-email-notifications-frontend NPM package and neeto-email-notifications-engine Rails engine for development.

Contents

  1. Development with Host Application
  2. Instructions for Publishing

Development with Host Application

Engine

The engine is used to manage email notifications across neeto products.

Installation

  1. Add this line to your application's Gemfile:

    source "NEETO_GEM_SERVER_URL" do
      # Rails engine to manage email notifications
      gem "neeto-email-notifications-engine"
    end
  2. And then execute:

    bundle install
  3. Add this line to your application's config/routes.rb file (replace at to your desired route):

    mount NeetoEmailNotificationsEngine::Engine, at: "/neeto_email_notifications"
  4. Add required migrations in the db/migrate folder. Run the following commands to generate the migrations.

    rails g neeto_email_notifications_engine:install

    This will generate the migration to create the neeto_email_notifications_engine_email_notifications table, which holds the data for the email notifications, and have custom_fields column to include custom attributes

  5. Run the following command to create the tables.

    rails db:migrate

Usage

  1. Create required email notification models inherited from NeetoEmailNotificationsEngine::EmailNotification. For example,

    class PushEmailNotification < ::NeetoEmailNotificationsEngine::EmailNotification
      default_scope { where("custom_fields -> 'notification_type' ? :value", value: "Push") }
      after_initialize :set_custom_field
    
      def set_custom_field
        self.custom_fields ||= {}
        self.custom_fields[custom_field_key] = "Push"
      end
    
      def custom_field_key
        "notification_type"
      end
    end
  2. Add the required associations to the polymorphic model. For example,

    class Form < ApplicationRecord
      ....
    
      has_many :email_notifications, as: :notification_holder, class_name: "::NeetoEmailNotificationsEngine::EmailNotification", dependent: :destroy
      has_one :push_email_notification, as: :notification_holder
    
      ....
    end

You can learn more about the setup and usage here:

  1. Models
  2. Services

Frontend package

Installation

  1. Add the neeto-email-notifications-frontend package to the package.json

    yarn add @bigbinary/neeto-email-notifications-frontend

    This package will provide a single component NeetoEmailNotification, which uses components from neeto-molecules.

Instructions for development

Check the Frontend package development guide for step-by-step instructions to develop the frontend package.

Usage

  1. Add the component to the host application. For example,
    <NeetoEmailNotificationForm
      title="Email notification"
      subtitle="Send an email notification when a new event occurred"
      emailPreviewProps={{ productName: "Product" }}
      emailNotificationParams={{
        notificationHolderType: "Form",
        notificationHolderId: formId,
        customFields: { notificationType: "Push" },
      }}
    />
NeetoEmailNotificationForm

The component is a form-based interface for adding or editing team members.

Props
  • title: The title of the component.
  • subtitle: The subtitle of the component.
  • onSuccess: Function that will be called when the email notification is updated successfully.
  • disabled: Disables the component.

You can learn more about the NeetoEmailNotificationForm component and usage here:

  1. NeetoEmailNotificationForm component

Instructions for Publishing

Consult the building and releasing packages guide for details on how to publish.

2.2.6

9 months ago

2.2.3

10 months ago

2.2.5

10 months ago

2.2.4

10 months ago

2.2.1

11 months ago

2.2.2

11 months ago

2.2.0

12 months ago

2.1.1

12 months ago

2.1.0

1 year ago

2.0.0

1 year ago

1.5.0-beta1

1 year ago

1.4.14

1 year ago

1.4.13

1 year ago

1.4.12

1 year ago

1.4.11

1 year ago

1.4.10

1 year ago

1.4.9

1 year ago

1.4.8

1 year ago

1.4.7

1 year ago

1.4.6

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago