@bigbinary/neeto-webhooks-frontend 1.6.10 → 1.6.12
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 +82 -48
- package/dist/index.cjs.js +9 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -1,90 +1,121 @@
|
|
|
1
1
|
# neeto-webhooks-nano
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
The `neeto-webhooks-nano` manages webhooks within neeto applications. The nano
|
|
4
|
+
exports the `@bigbinary/neeto-webhooks-frontend` NPM package
|
|
5
|
+
and `neeto-webhooks-engine` Rails engine for development.
|
|
3
6
|
|
|
4
7
|
# Contents
|
|
8
|
+
|
|
5
9
|
1. [Development with Host Application](#development-with-host-application)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
- [Engine](#engine)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Usage](#usage)
|
|
13
|
+
- [Frontend package](#frontend-package)
|
|
14
|
+
- [Installation](#installation-1)
|
|
15
|
+
- [Components](#components)
|
|
12
16
|
2. [Instructions for Publishing](#instructions-for-publishing)
|
|
13
17
|
|
|
14
18
|
# Development with Host Application
|
|
19
|
+
|
|
15
20
|
## Engine
|
|
21
|
+
|
|
16
22
|
The engine is used to manage webhooks across neeto products.
|
|
17
23
|
|
|
18
24
|
### Installation
|
|
19
|
-
1. Add this line to your application's Gemfile:
|
|
20
|
-
```ruby
|
|
21
|
-
source "NEETO_GEM_SERVER_URL" do
|
|
22
|
-
# ..existing gems
|
|
23
25
|
|
|
24
|
-
|
|
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.
|
|
26
|
+
1. Add this line to your application's Gemfile:
|
|
44
27
|
|
|
45
|
-
|
|
46
|
-
|
|
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.
|
|
28
|
+
```ruby
|
|
29
|
+
source "NEETO_GEM_SERVER_URL" do
|
|
30
|
+
# ..existing gems
|
|
49
31
|
|
|
50
|
-
|
|
51
|
-
webhooks:
|
|
52
|
-
events:
|
|
53
|
-
create: "Booking creation"
|
|
54
|
-
update: "Booking reschedule"
|
|
55
|
-
cancel: "Booking cancellation"
|
|
56
|
-
```
|
|
32
|
+
gem 'neeto-webhooks-engine'
|
|
57
33
|
|
|
34
|
+
# Use this for live development:
|
|
35
|
+
# gem 'neeto-webhooks-engine', path: "../neeto-webhooks-nano"
|
|
36
|
+
end
|
|
37
|
+
```
|
|
58
38
|
|
|
39
|
+
2. And then execute:
|
|
40
|
+
```zsh
|
|
41
|
+
bundle install
|
|
42
|
+
```
|
|
43
|
+
3. Add this line to your application's `config/routes.rb` file:
|
|
44
|
+
```ruby
|
|
45
|
+
mount NeetoWebhooksEngine::Engine => "/webhooks"
|
|
46
|
+
```
|
|
47
|
+
4. Run the following command to copy the migrations from the engine to the host
|
|
48
|
+
application:
|
|
49
|
+
```zsh
|
|
50
|
+
bundle exec rails neeto_webhooks_engine:install:migrations
|
|
51
|
+
```
|
|
52
|
+
5. Add the migrations to the database:
|
|
53
|
+
```zsh
|
|
54
|
+
bundle exec rails db:migrate
|
|
55
|
+
```
|
|
56
|
+
6. Add the following line to application's
|
|
57
|
+
config/initializer/neeto_webhooks_engine.rb file. Replace the
|
|
58
|
+
event_identifiers with an array of unique keywords representing possible
|
|
59
|
+
webhook events.
|
|
60
|
+
|
|
61
|
+
```zsh
|
|
62
|
+
NeetoWebhooksEngine.event_identifiers = ["create", "update", "cancel"]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
7. Add translations for the webhook events using the key format
|
|
66
|
+
webhooks.events.webhook_event, where webhook_event is the custom-defined
|
|
67
|
+
event_identifier.
|
|
68
|
+
|
|
69
|
+
```zsh
|
|
70
|
+
webhooks:
|
|
71
|
+
events:
|
|
72
|
+
create: "Booking creation"
|
|
73
|
+
update: "Booking reschedule"
|
|
74
|
+
cancel: "Booking cancellation"
|
|
75
|
+
```
|
|
59
76
|
|
|
60
77
|
### Usage
|
|
61
78
|
|
|
62
79
|
You can learn more about the setup and usage here:
|
|
80
|
+
|
|
63
81
|
1. [Models](/docs/engine/models.md)
|
|
64
82
|
|
|
65
83
|
## Frontend package
|
|
84
|
+
|
|
66
85
|
### Installation
|
|
86
|
+
|
|
67
87
|
1. Install the latest `neeto-webhooks-nano` package using the below command:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
88
|
+
```zsh
|
|
89
|
+
yarn add @bigbinary/neeto-webhooks-frontend
|
|
90
|
+
```
|
|
91
|
+
|
|
71
92
|
### Instructions for development
|
|
72
|
-
|
|
93
|
+
|
|
94
|
+
Check the
|
|
95
|
+
[Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0)
|
|
96
|
+
for step-by-step instructions to develop the frontend package.
|
|
73
97
|
|
|
74
98
|
### Components
|
|
99
|
+
|
|
75
100
|
#### `NeetoWebhooks` ([source code](https://github.com/bigbinary/neeto-webhooks-nano/blob/52aa6b3fc38dce1afb9f6a7a821f3d2d12cb6a6a/app/javascript/src/components/NeetoWebhooks.jsx))
|
|
101
|
+
|
|
76
102
|
This component is used to manage webhooks in your web application.
|
|
103
|
+
|
|
77
104
|
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
|
|
105
|
+
2. It also includes a user interface for listing deliveries and viewing delivery
|
|
106
|
+
details, featuring tabs that display both request and response information.
|
|
79
107
|
|
|
80
108
|
##### Props
|
|
109
|
+
|
|
81
110
|
- `entityId`: Specifies the ID of the entity.
|
|
82
111
|
- `entityType`: Specifies the type of the entity.
|
|
83
112
|
|
|
84
113
|
##### Optional Props
|
|
114
|
+
|
|
85
115
|
- `breadcrumbs`: An array of objects that specify breadcrumbs for navigation.
|
|
86
116
|
|
|
87
117
|
##### Usage
|
|
118
|
+
|
|
88
119
|
```jsx
|
|
89
120
|
import React from "react";
|
|
90
121
|
|
|
@@ -123,4 +154,7 @@ export default Main;
|
|
|
123
154
|
```
|
|
124
155
|
|
|
125
156
|
# Instructions for Publishing
|
|
126
|
-
|
|
157
|
+
|
|
158
|
+
Consult the
|
|
159
|
+
[building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages)
|
|
160
|
+
guide for details on how to publish.
|
package/dist/index.cjs.js
CHANGED
|
@@ -627,6 +627,13 @@ var TransactionDetails = function TransactionDetails(_ref) {
|
|
|
627
627
|
className: "flex w-full items-center justify-center py-6"
|
|
628
628
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null));
|
|
629
629
|
}
|
|
630
|
+
var renderPayload = function renderPayload() {
|
|
631
|
+
try {
|
|
632
|
+
return JSON.stringify(JSON.parse(deliveryDetails.requestBody), null, 2);
|
|
633
|
+
} catch (_unused) {
|
|
634
|
+
return "";
|
|
635
|
+
}
|
|
636
|
+
};
|
|
630
637
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
631
638
|
className: "neeto-ui-bg-white sticky top-0 mb-2 flex w-full flex-col"
|
|
632
639
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -656,7 +663,7 @@ var TransactionDetails = function TransactionDetails(_ref) {
|
|
|
656
663
|
return setActiveHeader(DELIVERY_TAB.response);
|
|
657
664
|
}
|
|
658
665
|
}, t("neetoWebhooks.delivery.response")))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
659
|
-
className: "mt-2"
|
|
666
|
+
className: "mt-2 w-full"
|
|
660
667
|
}, activeHeader === DELIVERY_TAB.request ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
661
668
|
className: "space-y-4"
|
|
662
669
|
}, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -667,7 +674,7 @@ var TransactionDetails = function TransactionDetails(_ref) {
|
|
|
667
674
|
style: "h5"
|
|
668
675
|
}, t("neetoWebhooks.delivery.payload")), /*#__PURE__*/React__default["default"].createElement(Snippet, {
|
|
669
676
|
dataCy: "delivery-request-payload"
|
|
670
|
-
},
|
|
677
|
+
}, renderPayload()))) : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
671
678
|
className: "space-y-4"
|
|
672
679
|
}, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
673
680
|
style: "h5"
|