@bigbinary/neeto-webhooks-frontend 1.6.7 → 1.6.8

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,21 +1,124 @@
1
+ # neeto-webhooks-nano
2
+ The `neeto-webhooks-nano` manages webhooks within neeto applications. The nano exports the `@bigbinary/neeto-webhooks-frontend` NPM package and `neeto-webhooks-engine` Rails engine for development.
1
3
 
2
- [![BuildStatus](https://neeto-engineering.neetoci.com/badges/neeto-webhooks-nano/workflows/default.svg)](https://neeto-engineering.neetoci.com/projects/neeto-webhooks-nano)
4
+ # Contents
5
+ 1. [Development with Host Application](#development-with-host-application)
6
+ - [Engine](#engine)
7
+ - [Installation](#installation)
8
+ - [Usage](#usage)
9
+ - [Frontend package](#frontend-package)
10
+ - [Installation](#installation-1)
11
+ - [Components](#components)
12
+ 2. [Instructions for Publishing](#instructions-for-publishing)
3
13
 
4
- # neeto-webhooks-nano
5
- Nano to manage webhooks on neeto applications.
14
+ # Development with Host Application
15
+ ## Engine
16
+ The engine is used to manage webhooks across neeto products.
17
+
18
+ ### Installation
19
+ 1. Add this line to your application's Gemfile:
20
+ ```ruby
21
+ source "NEETO_GEM_SERVER_URL" do
22
+ # ..existing gems
23
+
24
+ gem 'neeto-webhooks-engine'
25
+ end
26
+ ```
27
+ 2. And then execute:
28
+ ```zsh
29
+ bundle install
30
+ ```
31
+ 3. Add this line to your application's `config/routes.rb` file:
32
+ ```ruby
33
+ mount NeetoWebhooksEngine::Engine => "/webhooks"
34
+ ```
35
+ 4. Run the following command to copy the migrations from the engine to the host application:
36
+ ```zsh
37
+ bundle exec rails neeto_webhooks_engine:install:migrations
38
+ ```
39
+ 5. Add the migrations to the database:
40
+ ```zsh
41
+ bundle exec rails db:migrate
42
+ ```
43
+ 6. Add the following line to application's config/initializer/neeto_webhooks_engine.rb file. Replace the event_identifiers with an array of unique keywords representing possible webhook events.
44
+
45
+ ```zsh
46
+ NeetoWebhooksEngine.event_identifiers = ["create", "update", "cancel"]
47
+ ```
48
+ 7. Add translations for the webhook events using the key format webhooks.events.webhook_event, where webhook_event is the custom-defined event_identifier.
49
+
50
+ ```zsh
51
+ webhooks:
52
+ events:
53
+ create: "Booking creation"
54
+ update: "Booking reschedule"
55
+ cancel: "Booking cancellation"
56
+ ```
57
+
58
+
59
+
60
+ ### Usage
61
+
62
+ You can learn more about the setup and usage here:
63
+ 1. [Models](/docs/engine/models.md)
64
+
65
+ ## Frontend package
66
+ ### Installation
67
+ 1. Install the latest `neeto-webhooks-nano` package using the below command:
68
+ ```zsh
69
+ yarn add @bigbinary/neeto-webhooks-frontend
70
+ ```
71
+
72
+ ### Components
73
+ #### `NeetoWebhooks` ([source code](https://github.com/bigbinary/neeto-webhooks-nano/blob/52aa6b3fc38dce1afb9f6a7a821f3d2d12cb6a6a/app/javascript/src/components/NeetoWebhooks.jsx))
74
+ This component is used to manage webhooks in your web application.
75
+ 1. It provides a user interface for viewing, adding, and editing webhooks.
76
+ 2. It also includes a user interface for listing deliveries and viewing delivery details, featuring tabs that display both request and response information.
6
77
 
78
+ ##### Props
79
+ - `entityId`: Specifies the ID of the entity.
80
+ - `entityType`: Specifies the type of the entity.
7
81
 
8
- # Local Development Setup
82
+ ##### Optional Props
83
+ - `breadcrumbs`: An array of objects that specify breadcrumbs for navigation.
9
84
 
10
- 1. Setup
11
- [Instructions](https://github.com/bigbinary/neeto-engineering/tree/main/Local-Development-Setup).
85
+ ##### Usage
86
+ ```jsx
87
+ import React from "react";
12
88
 
13
- 2. Run `yarn build` to bundle the app.
89
+ import { NeetoWebhooks } from "@bigbinary/neeto-webhooks-frontend";
90
+ import { routes } from "common/routes";
91
+ import { BrowserRouter, Route, Switch } from "react-router-dom";
92
+ import { ToastContainer } from "react-toastify";
14
93
 
15
- 3. Visit http://spinkart.lvh.me:9100 and login with email `oliver@example.com`
16
- and password `welcome`.
94
+ const Main = () => (
95
+ <BrowserRouter>
96
+ <div className="flex">
97
+ <Switch>
98
+ <Route
99
+ path={routes.webhooks}
100
+ component={() => (
101
+ <NeetoWebhooks
102
+ entityId={entityId}
103
+ entityType={entityType}
104
+ breadcrumbs={[
105
+ {
106
+ text: "Settings",
107
+ link: routes.settings,
108
+ },
109
+ { text: "Webhook" },
110
+ ]}
111
+ />
112
+ )}
113
+ />
114
+ </Switch>
115
+ </div>
116
+ <ToastContainer />
117
+ </BrowserRouter>
118
+ );
17
119
 
18
- # Publish instructions
120
+ export default Main;
121
+ ```
19
122
 
20
- 1. [Engine and package installation](./docs/engine-and-package-installation.md)
21
- 2. [Building and releasing](./docs/building-and-releasing.md)
123
+ # Instructions for Publishing
124
+ Consult the [building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages) guide for details on how to publish.