@bigbinary/neeto-webhooks-frontend 1.6.7 → 1.6.9
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 +117 -12
- package/app/javascript/src/translations/en.json +3 -1
- package/dist/index.cjs.js +428 -291
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +444 -307
- package/dist/index.js.map +1 -1
- package/package.json +79 -69
package/README.md
CHANGED
|
@@ -1,21 +1,126 @@
|
|
|
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
|
-
|
|
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
|
-
#
|
|
5
|
-
|
|
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
|
+
### Instructions for development
|
|
72
|
+
Check the [Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0) for step-by-step instructions to develop the frontend package.
|
|
73
|
+
|
|
74
|
+
### Components
|
|
75
|
+
#### `NeetoWebhooks` ([source code](https://github.com/bigbinary/neeto-webhooks-nano/blob/52aa6b3fc38dce1afb9f6a7a821f3d2d12cb6a6a/app/javascript/src/components/NeetoWebhooks.jsx))
|
|
76
|
+
This component is used to manage webhooks in your web application.
|
|
77
|
+
1. It provides a user interface for viewing, adding, and editing webhooks.
|
|
78
|
+
2. It also includes a user interface for listing deliveries and viewing delivery details, featuring tabs that display both request and response information.
|
|
6
79
|
|
|
80
|
+
##### Props
|
|
81
|
+
- `entityId`: Specifies the ID of the entity.
|
|
82
|
+
- `entityType`: Specifies the type of the entity.
|
|
7
83
|
|
|
8
|
-
|
|
84
|
+
##### Optional Props
|
|
85
|
+
- `breadcrumbs`: An array of objects that specify breadcrumbs for navigation.
|
|
9
86
|
|
|
10
|
-
|
|
11
|
-
|
|
87
|
+
##### Usage
|
|
88
|
+
```jsx
|
|
89
|
+
import React from "react";
|
|
12
90
|
|
|
13
|
-
|
|
91
|
+
import { NeetoWebhooks } from "@bigbinary/neeto-webhooks-frontend";
|
|
92
|
+
import { routes } from "common/routes";
|
|
93
|
+
import { BrowserRouter, Route, Switch } from "react-router-dom";
|
|
94
|
+
import { ToastContainer } from "react-toastify";
|
|
14
95
|
|
|
15
|
-
|
|
16
|
-
|
|
96
|
+
const Main = () => (
|
|
97
|
+
<BrowserRouter>
|
|
98
|
+
<div className="flex">
|
|
99
|
+
<Switch>
|
|
100
|
+
<Route
|
|
101
|
+
path={routes.webhooks}
|
|
102
|
+
component={() => (
|
|
103
|
+
<NeetoWebhooks
|
|
104
|
+
entityId={entityId}
|
|
105
|
+
entityType={entityType}
|
|
106
|
+
breadcrumbs={[
|
|
107
|
+
{
|
|
108
|
+
text: "Settings",
|
|
109
|
+
link: routes.settings,
|
|
110
|
+
},
|
|
111
|
+
{ text: "Webhook" },
|
|
112
|
+
]}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
/>
|
|
116
|
+
</Switch>
|
|
117
|
+
</div>
|
|
118
|
+
<ToastContainer />
|
|
119
|
+
</BrowserRouter>
|
|
120
|
+
);
|
|
17
121
|
|
|
18
|
-
|
|
122
|
+
export default Main;
|
|
123
|
+
```
|
|
19
124
|
|
|
20
|
-
|
|
21
|
-
|
|
125
|
+
# Instructions for Publishing
|
|
126
|
+
Consult the [building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages) guide for details on how to publish.
|