LedgerHQ/ledger-fresh-management

[Notification center] - Plugin Browser + dependencies

qd-qd opened this issue · 1 comments

qd-qd commented

Header

Name of the task: Plugin Browser + dependencies

Name of the module: Notification center

Difficulty: 3

Waiting for: #37 #38 #39 #40 #41

Body

Short description

Now that we have a server that is consumed by our "watcher module" and received notification orders, we need to do these orders. The aim of this task is to create an open-source plugin for our notification center that will be in charge to send web browser native notifications. This plugin will be used by our users who want to receive native browser notifications.

Full description

Develop a simple open-source project that can be imported into the server developed in #39 to send native web browser notifications. This plugin will be called by the server each time to_type is equal to browser.

The plugin will receive these parameters:

type PluginParameters = {
  to: string, // define the endpoint where the notification will be sent
  message: string, // define the message to send
}

All the secrets that the plugin will need must be passed during the initialization of the plugin.

The plugin must have two exposed methods:

  • init(...) used to init the plugin. Parameters are configuration and secrets needed
  • async send(to: string, message: string) used to send a notification.

The send function must return the status of the external request made.

pnpm must be used as a dependency manager. A .nvmrc must be set to the LTS version of node. No library should be used to interact with the endpoint, keep the code simple. Everything must be tested, prettied, eslinted and the README of the repository should describe the plugin. Keep in mind the plugin will be an npm package.


In addition to that, the server defined in #39 must be updated to accept the new to_type value: browser. At this point, the toType type will look like this:

type ToType = "telegram" | "mail" | "browser";

Also, the server defined in #38 must be updated in order to add browser as a key for the Values type. The Values type will look like this:

type Values = {
    telegrams?: string[],
    emails?: string[],
    browser?: string[], // IFTTT endpoints
};

Finally, the schema of the database defined in #37 must be updated. It will look like this:

type Schema = {
    id: string, // wallet address
    telegrams: string[], // handles
    emails: string[],
    browsers: string[],
 }

The migration must be developed, and existing rows must inherit an empty value for the new browsers key.

Additionals ressources

Task monitoring 📝


This is an automatic post that is intended to facilitate the follow-up of the project.
This post is meant to be edited throughout the life of the project.