n8n-nodes-ablefy 2.6.2
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 +158 -0
- package/dist/credentials/AblefyApi.credentials.d.ts +10 -0
- package/dist/credentials/AblefyApi.credentials.d.ts.map +1 -0
- package/dist/credentials/AblefyApi.credentials.js +67 -0
- package/dist/credentials/AblefyApi.credentials.js.map +1 -0
- package/dist/nodes/Ablefy/Ablefy.node.d.ts +6 -0
- package/dist/nodes/Ablefy/Ablefy.node.d.ts.map +1 -0
- package/dist/nodes/Ablefy/Ablefy.node.js +184 -0
- package/dist/nodes/Ablefy/Ablefy.node.js.map +1 -0
- package/dist/nodes/Ablefy/ablefy.svg +8 -0
- package/dist/nodes/AblefyTrigger/AblefyTrigger.node.d.ts +13 -0
- package/dist/nodes/AblefyTrigger/AblefyTrigger.node.d.ts.map +1 -0
- package/dist/nodes/AblefyTrigger/AblefyTrigger.node.js +268 -0
- package/dist/nodes/AblefyTrigger/AblefyTrigger.node.js.map +1 -0
- package/dist/nodes/AblefyTrigger/ablefy.svg +8 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# n8n-nodes-ablefy
|
|
2
|
+
|
|
3
|
+
An n8n community node package for **[Ablefy](https://ablefy.io)** (formerly elopage) — the all-in-one platform for coaches, digital service providers, and online course creators.
|
|
4
|
+
|
|
5
|
+
This package provides two nodes:
|
|
6
|
+
|
|
7
|
+
| Node | Type | Purpose |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| **Ablefy Trigger** | Trigger | Starts a workflow when Ablefy webhook events fire |
|
|
10
|
+
| **Ablefy** | Action | Make custom API calls to the Ablefy REST API |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### On n8n.cloud or self-hosted (recommended)
|
|
17
|
+
|
|
18
|
+
1. In n8n, go to **Settings → Community Nodes**.
|
|
19
|
+
2. Click **Install a community node**.
|
|
20
|
+
3. Enter `n8n-nodes-ablefy` and click **Install**.
|
|
21
|
+
|
|
22
|
+
### Manual installation (self-hosted only)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd ~/.n8n/nodes
|
|
26
|
+
npm install /path/to/n8n-nodes-ablefy
|
|
27
|
+
# Restart n8n
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Credentials
|
|
33
|
+
|
|
34
|
+
Before using either node, create **Ablefy API** credentials:
|
|
35
|
+
|
|
36
|
+
1. In your Ablefy account, go to **Apps & Integrations → Integrations → ablefy API**.
|
|
37
|
+
2. Click **Generate API key**. Two keys are generated: an **API Key** and a **Secret Key**.
|
|
38
|
+
3. In n8n, create a new credential of type **Ablefy API** and paste both keys.
|
|
39
|
+
4. Choose **Production** or **Sandbox / Test** environment.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Ablefy Trigger Node
|
|
44
|
+
|
|
45
|
+
The trigger node registers a webhook endpoint in your Ablefy account automatically when the workflow is activated, and removes it when the workflow is deactivated.
|
|
46
|
+
|
|
47
|
+
### Supported Events
|
|
48
|
+
|
|
49
|
+
| Category | Event | Value |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| **Order** | Order: Created | `order_created` |
|
|
52
|
+
| **Order** | Order: Updated | `order_updated` |
|
|
53
|
+
| **Order** | Order: Canceled | `order_canceled` |
|
|
54
|
+
| **Payment** | Payment: Succeeded | `payment_succeeded` |
|
|
55
|
+
| **Payment** | Payment: Failed | `payment_failed` |
|
|
56
|
+
| **Payment** | Payment: Chargeback | `payment_chargeback` |
|
|
57
|
+
| **Refund** | Refund: Created | `refund_created` |
|
|
58
|
+
| **Payer** | Payer: Created | `payer_created` |
|
|
59
|
+
| **Payer** | Payer: Updated | `payer_updated` |
|
|
60
|
+
| **Product** | Product: Created | `product_created` |
|
|
61
|
+
| **Product** | Product: Updated | `product_updated` |
|
|
62
|
+
| **Subscription** | Subscription: Created | `subscription_created` |
|
|
63
|
+
| **Subscription** | Subscription: Renewed | `subscription_renewed` |
|
|
64
|
+
| **Subscription** | Subscription: Canceled | `subscription_canceled` |
|
|
65
|
+
| **Subscription** | Subscription: Expired | `subscription_expired` |
|
|
66
|
+
| **Pricing Plan** | Pricing Plan: Created | `pricing_plan_created` |
|
|
67
|
+
| **Pricing Plan** | Pricing Plan: Updated | `pricing_plan_updated` |
|
|
68
|
+
| **Opt-In** | New Email Opt-In | `email_opt_in` |
|
|
69
|
+
| **Event Ticket** | Event Ticket: Purchased | `event_ticket_purchased` |
|
|
70
|
+
|
|
71
|
+
### Output
|
|
72
|
+
|
|
73
|
+
The trigger outputs the full webhook payload sent by Ablefy, plus a `_headers` field containing the HTTP request headers (useful for signature verification).
|
|
74
|
+
|
|
75
|
+
### Configuration
|
|
76
|
+
|
|
77
|
+
| Parameter | Description |
|
|
78
|
+
|---|---|
|
|
79
|
+
| **Events** | One or more events to subscribe to (multi-select) |
|
|
80
|
+
| **Webhook Endpoint Name** | The display name used when registering the endpoint in Ablefy |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Ablefy Action Node
|
|
85
|
+
|
|
86
|
+
The action node allows you to make arbitrary API calls to the Ablefy REST API.
|
|
87
|
+
|
|
88
|
+
### Usage
|
|
89
|
+
|
|
90
|
+
1. Select **Resource**: `Custom API Call`
|
|
91
|
+
2. Select **Operation**: `Make an API Call`
|
|
92
|
+
3. Set the **Method** (GET, POST, PUT, PATCH, DELETE)
|
|
93
|
+
4. Set the **Endpoint** (e.g. `/orders`, `/products`, `/payers`)
|
|
94
|
+
5. Optionally provide **Query Parameters** and/or **Body Parameters** as JSON
|
|
95
|
+
|
|
96
|
+
### API Base URL
|
|
97
|
+
|
|
98
|
+
| Environment | Base URL |
|
|
99
|
+
|---|---|
|
|
100
|
+
| Production | `https://api.myablefy.com/api/v1` |
|
|
101
|
+
| Sandbox | `https://sandbox.elopage.com/api/v1` |
|
|
102
|
+
|
|
103
|
+
### Common Endpoints
|
|
104
|
+
|
|
105
|
+
| Endpoint | Method | Description |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| `/orders` | GET | List orders |
|
|
108
|
+
| `/orders/{id}` | GET | Get a specific order |
|
|
109
|
+
| `/orders/{id}` | PUT | Cancel an order |
|
|
110
|
+
| `/payments/{id}` | GET | Get a payment |
|
|
111
|
+
| `/payments/{id}/refund` | PUT | Refund a payment |
|
|
112
|
+
| `/products` | GET | List products |
|
|
113
|
+
| `/products` | POST | Create a product |
|
|
114
|
+
| `/products/{id}` | GET | Get a product |
|
|
115
|
+
| `/products/{id}` | PUT | Update a product |
|
|
116
|
+
| `/pricing_plans` | GET | List pricing plans |
|
|
117
|
+
| `/payers` | GET | List payers (customers) |
|
|
118
|
+
| `/webhook_endpoints` | GET | List webhook endpoints |
|
|
119
|
+
| `/webhook_endpoints` | POST | Create a webhook endpoint |
|
|
120
|
+
| `/webhook_endpoints/{id}` | DELETE | Delete a webhook endpoint |
|
|
121
|
+
| `/funnels` | GET | List funnels |
|
|
122
|
+
| `/invoices` | GET | List invoices |
|
|
123
|
+
| `/publishers` | GET | List affiliate publishers |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Publishing to npm
|
|
128
|
+
|
|
129
|
+
To publish this package so it can be installed via the n8n UI:
|
|
130
|
+
|
|
131
|
+
1. Generate an npm Access Token with **"Allow this token to bypass 2FA"** enabled.
|
|
132
|
+
2. Run:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npm config set //registry.npmjs.org/:_authToken "npm_YOUR_TOKEN"
|
|
136
|
+
npm publish --access public
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Install dependencies
|
|
145
|
+
pnpm install
|
|
146
|
+
|
|
147
|
+
# Build (compile TypeScript + copy SVG icons)
|
|
148
|
+
npm run build
|
|
149
|
+
|
|
150
|
+
# Watch mode
|
|
151
|
+
npm run dev
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class AblefyApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AblefyApi.credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AblefyApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/AblefyApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,SAAU,YAAW,eAAe;IAChD,IAAI,SAAe;IACnB,WAAW,SAAgB;IAC3B,gBAAgB,SAA0E;IAE1F,UAAU,EAAE,eAAe,EAAE,CAwC3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;IAEF,IAAI,EAAE,sBAAsB,CAK1B;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AblefyApi = void 0;
|
|
4
|
+
class AblefyApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'ablefyApi';
|
|
7
|
+
this.displayName = 'Ablefy API';
|
|
8
|
+
this.documentationUrl = 'https://support.ablefy.io/seller/s/article/ablefy-api?language=en_US';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Key',
|
|
12
|
+
name: 'apiKey',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: {
|
|
15
|
+
password: true,
|
|
16
|
+
},
|
|
17
|
+
default: '',
|
|
18
|
+
required: true,
|
|
19
|
+
description: 'The API Key generated in Ablefy under Apps & Integrations > Integrations > ablefy API',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Secret Key',
|
|
23
|
+
name: 'secretKey',
|
|
24
|
+
type: 'string',
|
|
25
|
+
typeOptions: {
|
|
26
|
+
password: true,
|
|
27
|
+
},
|
|
28
|
+
default: '',
|
|
29
|
+
required: true,
|
|
30
|
+
description: 'The Secret Key generated in Ablefy under Apps & Integrations > Integrations > ablefy API',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Environment',
|
|
34
|
+
name: 'environment',
|
|
35
|
+
type: 'options',
|
|
36
|
+
options: [
|
|
37
|
+
{
|
|
38
|
+
name: 'Production',
|
|
39
|
+
value: 'production',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Sandbox / Test',
|
|
43
|
+
value: 'sandbox',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
default: 'production',
|
|
47
|
+
description: 'The environment to use',
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
this.authenticate = {
|
|
51
|
+
type: 'generic',
|
|
52
|
+
properties: {
|
|
53
|
+
headers: {
|
|
54
|
+
'Authorization': '={{"Bearer " + Buffer.from(`${$credentials.apiKey}:${$credentials.secretKey}`).toString("base64")}}',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
this.test = {
|
|
59
|
+
request: {
|
|
60
|
+
baseURL: '={{$credentials.environment === "sandbox" ? "https://sandbox.elopage.com/api/v1" : "https://api.myablefy.com/api/v1"}}',
|
|
61
|
+
url: '/account',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.AblefyApi = AblefyApi;
|
|
67
|
+
//# sourceMappingURL=AblefyApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AblefyApi.credentials.js","sourceRoot":"","sources":["../../credentials/AblefyApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,SAAS;IAAtB;QACC,SAAI,GAAG,WAAW,CAAC;QACnB,gBAAW,GAAG,YAAY,CAAC;QAC3B,qBAAgB,GAAG,sEAAsE,CAAC;QAE1F,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,uFAAuF;aACpG;YACD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,0FAA0F;aACvG;YACD;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,YAAY;wBAClB,KAAK,EAAE,YAAY;qBACnB;oBACD;wBACC,IAAI,EAAE,gBAAgB;wBACtB,KAAK,EAAE,SAAS;qBAChB;iBACD;gBACD,OAAO,EAAE,YAAY;gBACrB,WAAW,EAAE,wBAAwB;aACrC;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,eAAe,EAAE,qGAAqG;iBACtH;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,wHAAwH;gBACjI,GAAG,EAAE,UAAU;aACf;SACD,CAAC;IACH,CAAC;CAAA;AA9DD,8BA8DC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class Ablefy implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=Ablefy.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ablefy.node.d.ts","sourceRoot":"","sources":["../../../nodes/Ablefy/Ablefy.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EAEjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EAEpB,MAAM,cAAc,CAAC;AAEtB,qBAAa,MAAO,YAAW,SAAS;IACvC,WAAW,EAAE,oBAAoB,CAoH/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CA6DvE"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ablefy = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class Ablefy {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Ablefy',
|
|
9
|
+
name: 'ablefy',
|
|
10
|
+
icon: 'file:ablefy.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
14
|
+
description: 'Consume Ablefy API',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'Ablefy',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
credentials: [
|
|
21
|
+
{
|
|
22
|
+
name: 'ablefyApi',
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
properties: [
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Resource',
|
|
29
|
+
name: 'resource',
|
|
30
|
+
type: 'options',
|
|
31
|
+
noDataExpression: true,
|
|
32
|
+
options: [
|
|
33
|
+
{
|
|
34
|
+
name: 'Custom API Call',
|
|
35
|
+
value: 'customApiCall',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
default: 'customApiCall',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Operation',
|
|
42
|
+
name: 'operation',
|
|
43
|
+
type: 'options',
|
|
44
|
+
noDataExpression: true,
|
|
45
|
+
displayOptions: {
|
|
46
|
+
show: {
|
|
47
|
+
resource: ['customApiCall'],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
options: [
|
|
51
|
+
{
|
|
52
|
+
name: 'Make an API Call',
|
|
53
|
+
value: 'makeApiCall',
|
|
54
|
+
description: 'Make a custom API call to Ablefy',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
default: 'makeApiCall',
|
|
58
|
+
},
|
|
59
|
+
// Custom API Call Properties
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Method',
|
|
62
|
+
name: 'method',
|
|
63
|
+
type: 'options',
|
|
64
|
+
displayOptions: {
|
|
65
|
+
show: {
|
|
66
|
+
resource: ['customApiCall'],
|
|
67
|
+
operation: ['makeApiCall'],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
options: [
|
|
71
|
+
{ name: 'GET', value: 'GET' },
|
|
72
|
+
{ name: 'POST', value: 'POST' },
|
|
73
|
+
{ name: 'PUT', value: 'PUT' },
|
|
74
|
+
{ name: 'PATCH', value: 'PATCH' },
|
|
75
|
+
{ name: 'DELETE', value: 'DELETE' },
|
|
76
|
+
],
|
|
77
|
+
default: 'GET',
|
|
78
|
+
description: 'The HTTP method to use',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Endpoint',
|
|
82
|
+
name: 'endpoint',
|
|
83
|
+
type: 'string',
|
|
84
|
+
displayOptions: {
|
|
85
|
+
show: {
|
|
86
|
+
resource: ['customApiCall'],
|
|
87
|
+
operation: ['makeApiCall'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
default: '',
|
|
91
|
+
placeholder: '/orders',
|
|
92
|
+
description: 'The API endpoint to call, e.g. /orders',
|
|
93
|
+
required: true,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
displayName: 'Query Parameters',
|
|
97
|
+
name: 'queryParameters',
|
|
98
|
+
type: 'json',
|
|
99
|
+
displayOptions: {
|
|
100
|
+
show: {
|
|
101
|
+
resource: ['customApiCall'],
|
|
102
|
+
operation: ['makeApiCall'],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
default: '',
|
|
106
|
+
description: 'Query parameters as a JSON object',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
displayName: 'Body Parameters',
|
|
110
|
+
name: 'bodyParameters',
|
|
111
|
+
type: 'json',
|
|
112
|
+
displayOptions: {
|
|
113
|
+
show: {
|
|
114
|
+
resource: ['customApiCall'],
|
|
115
|
+
operation: ['makeApiCall'],
|
|
116
|
+
method: ['POST', 'PUT', 'PATCH'],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
default: '',
|
|
120
|
+
description: 'Body parameters as a JSON object',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
async execute() {
|
|
126
|
+
const items = this.getInputData();
|
|
127
|
+
const returnData = [];
|
|
128
|
+
const length = items.length;
|
|
129
|
+
const credentials = await this.getCredentials('ablefyApi');
|
|
130
|
+
const baseUrl = credentials.environment === 'sandbox'
|
|
131
|
+
? 'https://sandbox.elopage.com/api/v1'
|
|
132
|
+
: 'https://api.myablefy.com/api/v1';
|
|
133
|
+
for (let i = 0; i < length; i++) {
|
|
134
|
+
try {
|
|
135
|
+
const resource = this.getNodeParameter('resource', i);
|
|
136
|
+
const operation = this.getNodeParameter('operation', i);
|
|
137
|
+
if (resource === 'customApiCall' && operation === 'makeApiCall') {
|
|
138
|
+
const method = this.getNodeParameter('method', i);
|
|
139
|
+
const endpoint = this.getNodeParameter('endpoint', i);
|
|
140
|
+
const queryParameters = this.getNodeParameter('queryParameters', i, '');
|
|
141
|
+
const bodyParameters = this.getNodeParameter('bodyParameters', i, '');
|
|
142
|
+
let qs = {};
|
|
143
|
+
if (queryParameters) {
|
|
144
|
+
try {
|
|
145
|
+
qs = JSON.parse(queryParameters);
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Invalid JSON in Query Parameters' });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
let body = {};
|
|
152
|
+
if (bodyParameters && ['POST', 'PUT', 'PATCH'].includes(method)) {
|
|
153
|
+
try {
|
|
154
|
+
body = JSON.parse(bodyParameters);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'Invalid JSON in Body Parameters' });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const options = {
|
|
161
|
+
method,
|
|
162
|
+
uri: `${baseUrl}${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`,
|
|
163
|
+
qs,
|
|
164
|
+
body,
|
|
165
|
+
json: true,
|
|
166
|
+
};
|
|
167
|
+
const responseData = await this.helpers.requestWithAuthentication.call(this, 'ablefyApi', options);
|
|
168
|
+
returnData.push({ json: responseData });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
if (this.continueOnFail()) {
|
|
173
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
174
|
+
returnData.push({ json: { error: errMsg } });
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return [returnData];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.Ablefy = Ablefy;
|
|
184
|
+
//# sourceMappingURL=Ablefy.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ablefy.node.js","sourceRoot":"","sources":["../../../nodes/Ablefy/Ablefy.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AAEtB,MAAa,MAAM;IAAnB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,QAAQ;YACrB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8BAA8B;YACxC,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE;gBACT,IAAI,EAAE,QAAQ;aACd;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,WAAW;oBACjB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,iBAAiB;4BACvB,KAAK,EAAE,eAAe;yBACtB;qBACD;oBACD,OAAO,EAAE,eAAe;iBACxB;gBACD;oBACC,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAA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,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,EAAE;wBACxE,EAAE;wBACF,IAAI;wBACJ,IAAI,EAAE,IAAI;qBACV,CAAC;oBAED,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;oBACnG,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;gBACzC,CAAC;YACF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACtE,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;oBAC7C,SAAS;gBACV,CAAC;gBACD,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAY,CAAC,CAAC;YACtD,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AApLD,wBAoLC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
|
2
|
+
<circle cx="50" cy="50" r="50" fill="#3BF5A0"/>
|
|
3
|
+
<rect x="28" y="25" width="22" height="10" rx="3" fill="#0D0D0D"/>
|
|
4
|
+
<rect x="28" y="25" width="10" height="40" rx="3" fill="#0D0D0D"/>
|
|
5
|
+
<circle cx="46" cy="60" r="8" fill="#0D0D0D"/>
|
|
6
|
+
<rect x="55" y="55" width="18" height="10" rx="3" fill="#0D0D0D"/>
|
|
7
|
+
<rect x="63" y="45" width="10" height="20" rx="3" fill="#0D0D0D"/>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IHookFunctions, IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class AblefyTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhookMethods: {
|
|
5
|
+
default: {
|
|
6
|
+
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
7
|
+
create(this: IHookFunctions): Promise<boolean>;
|
|
8
|
+
delete(this: IHookFunctions): Promise<boolean>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=AblefyTrigger.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AblefyTrigger.node.d.ts","sourceRoot":"","sources":["../../../nodes/AblefyTrigger/AblefyTrigger.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EAEpB,MAAM,cAAc,CAAC;AAEtB,qBAAa,aAAc,YAAW,SAAS;IAC9C,WAAW,EAAE,oBAAoB,CAqJ/B;IAEF,cAAc;;8BAEY,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;yBAiCtC,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;yBAuCjC,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;;MA6BpD;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CA6BrE"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AblefyTrigger = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class AblefyTrigger {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Ablefy Trigger',
|
|
9
|
+
name: 'ablefyTrigger',
|
|
10
|
+
icon: 'file:ablefy.svg',
|
|
11
|
+
group: ['trigger'],
|
|
12
|
+
version: 1,
|
|
13
|
+
description: 'Starts the workflow when Ablefy events occur (orders, payments, refunds, payers, products, subscriptions)',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Ablefy Trigger',
|
|
16
|
+
},
|
|
17
|
+
inputs: [],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'ablefyApi',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
webhooks: [
|
|
26
|
+
{
|
|
27
|
+
name: 'default',
|
|
28
|
+
httpMethod: 'POST',
|
|
29
|
+
responseMode: 'onReceived',
|
|
30
|
+
path: 'webhook',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
properties: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Events',
|
|
36
|
+
name: 'events',
|
|
37
|
+
type: 'multiOptions',
|
|
38
|
+
required: true,
|
|
39
|
+
default: [],
|
|
40
|
+
description: 'The Ablefy events to listen for. Select one or more events.',
|
|
41
|
+
options: [
|
|
42
|
+
// ── Order events ──────────────────────────────────────────
|
|
43
|
+
{
|
|
44
|
+
name: 'Order: Created',
|
|
45
|
+
value: 'order_created',
|
|
46
|
+
description: 'Triggers when a new order is created',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'Order: Updated',
|
|
50
|
+
value: 'order_updated',
|
|
51
|
+
description: 'Triggers when an existing order is updated',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Order: Canceled',
|
|
55
|
+
value: 'order_canceled',
|
|
56
|
+
description: 'Triggers when an order is canceled',
|
|
57
|
+
},
|
|
58
|
+
// ── Payment events ────────────────────────────────────────
|
|
59
|
+
{
|
|
60
|
+
name: 'Payment: Succeeded',
|
|
61
|
+
value: 'payment_succeeded',
|
|
62
|
+
description: 'Triggers when a payment is successfully processed',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Payment: Failed',
|
|
66
|
+
value: 'payment_failed',
|
|
67
|
+
description: 'Triggers when a payment attempt fails',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Payment: Chargeback',
|
|
71
|
+
value: 'payment_chargeback',
|
|
72
|
+
description: 'Triggers when a chargeback is received',
|
|
73
|
+
},
|
|
74
|
+
// ── Refund events ─────────────────────────────────────────
|
|
75
|
+
{
|
|
76
|
+
name: 'Refund: Created',
|
|
77
|
+
value: 'refund_created',
|
|
78
|
+
description: 'Triggers when a new refund is processed',
|
|
79
|
+
},
|
|
80
|
+
// ── Payer events ──────────────────────────────────────────
|
|
81
|
+
{
|
|
82
|
+
name: 'Payer: Created',
|
|
83
|
+
value: 'payer_created',
|
|
84
|
+
description: 'Triggers when a new payer (customer) is created',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'Payer: Updated',
|
|
88
|
+
value: 'payer_updated',
|
|
89
|
+
description: 'Triggers when a payer record is updated',
|
|
90
|
+
},
|
|
91
|
+
// ── Product events ────────────────────────────────────────
|
|
92
|
+
{
|
|
93
|
+
name: 'Product: Created',
|
|
94
|
+
value: 'product_created',
|
|
95
|
+
description: 'Triggers when a new product is created',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'Product: Updated',
|
|
99
|
+
value: 'product_updated',
|
|
100
|
+
description: 'Triggers when a product is updated',
|
|
101
|
+
},
|
|
102
|
+
// ── SaaS Plan / Subscription events ───────────────────────
|
|
103
|
+
{
|
|
104
|
+
name: 'Subscription: Created',
|
|
105
|
+
value: 'subscription_created',
|
|
106
|
+
description: 'Triggers when a new subscription (SaaS plan) is created',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'Subscription: Renewed',
|
|
110
|
+
value: 'subscription_renewed',
|
|
111
|
+
description: 'Triggers when a subscription is successfully renewed',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'Subscription: Canceled',
|
|
115
|
+
value: 'subscription_canceled',
|
|
116
|
+
description: 'Triggers when a subscription is canceled',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'Subscription: Expired',
|
|
120
|
+
value: 'subscription_expired',
|
|
121
|
+
description: 'Triggers when a subscription expires',
|
|
122
|
+
},
|
|
123
|
+
// ── Pricing Plan events ────────────────────────────────────
|
|
124
|
+
{
|
|
125
|
+
name: 'Pricing Plan: Created',
|
|
126
|
+
value: 'pricing_plan_created',
|
|
127
|
+
description: 'Triggers when a new pricing plan is created',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'Pricing Plan: Updated',
|
|
131
|
+
value: 'pricing_plan_updated',
|
|
132
|
+
description: 'Triggers when a pricing plan is updated',
|
|
133
|
+
},
|
|
134
|
+
// ── Opt-in / Lead events ───────────────────────────────────
|
|
135
|
+
{
|
|
136
|
+
name: 'Opt-In: New Email Opt-In',
|
|
137
|
+
value: 'email_opt_in',
|
|
138
|
+
description: 'Triggers when a product with opt-in is purchased',
|
|
139
|
+
},
|
|
140
|
+
// ── Event Ticket events ────────────────────────────────────
|
|
141
|
+
{
|
|
142
|
+
name: 'Event Ticket: Purchased',
|
|
143
|
+
value: 'event_ticket_purchased',
|
|
144
|
+
description: 'Triggers when an event ticket is purchased',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
displayName: 'Webhook Endpoint Name',
|
|
150
|
+
name: 'webhookName',
|
|
151
|
+
type: 'string',
|
|
152
|
+
default: 'n8n Ablefy Webhook',
|
|
153
|
+
description: 'The name to use when registering the webhook endpoint in Ablefy',
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
};
|
|
157
|
+
this.webhookMethods = {
|
|
158
|
+
default: {
|
|
159
|
+
async checkExists() {
|
|
160
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
161
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
162
|
+
if (!webhookData.webhookId) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
const credentials = await this.getCredentials('ablefyApi');
|
|
166
|
+
const baseUrl = (credentials.environment === 'sandbox'
|
|
167
|
+
? 'https://sandbox.elopage.com/api/v1'
|
|
168
|
+
: 'https://api.myablefy.com/api/v1');
|
|
169
|
+
try {
|
|
170
|
+
const responseData = await this.helpers.requestWithAuthentication.call(this, 'ablefyApi', {
|
|
171
|
+
method: 'GET',
|
|
172
|
+
uri: `${baseUrl}/webhook_endpoints/${webhookData.webhookId}`,
|
|
173
|
+
json: true,
|
|
174
|
+
});
|
|
175
|
+
if (responseData && responseData.url === webhookUrl) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
catch (_error) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
async create() {
|
|
185
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
186
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
187
|
+
const events = this.getNodeParameter('events');
|
|
188
|
+
const webhookName = this.getNodeParameter('webhookName');
|
|
189
|
+
const credentials = await this.getCredentials('ablefyApi');
|
|
190
|
+
const baseUrl = (credentials.environment === 'sandbox'
|
|
191
|
+
? 'https://sandbox.elopage.com/api/v1'
|
|
192
|
+
: 'https://api.myablefy.com/api/v1');
|
|
193
|
+
const body = {
|
|
194
|
+
url: webhookUrl,
|
|
195
|
+
name: webhookName || `n8n - ${this.getWorkflow().id}`,
|
|
196
|
+
event_ids: events,
|
|
197
|
+
};
|
|
198
|
+
try {
|
|
199
|
+
const responseData = await this.helpers.requestWithAuthentication.call(this, 'ablefyApi', {
|
|
200
|
+
method: 'POST',
|
|
201
|
+
uri: `${baseUrl}/webhook_endpoints`,
|
|
202
|
+
body,
|
|
203
|
+
json: true,
|
|
204
|
+
});
|
|
205
|
+
if (responseData && responseData.id) {
|
|
206
|
+
webhookData.webhookId = responseData.id;
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
async delete() {
|
|
216
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
217
|
+
if (!webhookData.webhookId) {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
const credentials = await this.getCredentials('ablefyApi');
|
|
221
|
+
const baseUrl = (credentials.environment === 'sandbox'
|
|
222
|
+
? 'https://sandbox.elopage.com/api/v1'
|
|
223
|
+
: 'https://api.myablefy.com/api/v1');
|
|
224
|
+
try {
|
|
225
|
+
await this.helpers.requestWithAuthentication.call(this, 'ablefyApi', {
|
|
226
|
+
method: 'DELETE',
|
|
227
|
+
uri: `${baseUrl}/webhook_endpoints/${webhookData.webhookId}`,
|
|
228
|
+
json: true,
|
|
229
|
+
});
|
|
230
|
+
delete webhookData.webhookId;
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
catch (_error) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
async webhook() {
|
|
241
|
+
const bodyData = this.getBodyData();
|
|
242
|
+
const headerData = this.getHeaderData();
|
|
243
|
+
// Optionally filter by event type if Ablefy sends an event type field
|
|
244
|
+
// Common patterns: bodyData.event, bodyData.type, bodyData.event_type
|
|
245
|
+
const eventType = bodyData.event || bodyData.type || bodyData.event_type;
|
|
246
|
+
const subscribedEvents = this.getNodeParameter('events');
|
|
247
|
+
// If an event type is present in the payload, only process subscribed events
|
|
248
|
+
if (eventType && subscribedEvents.length > 0 && !subscribedEvents.includes(eventType)) {
|
|
249
|
+
return {
|
|
250
|
+
noWebhookResponse: true,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
workflowData: [
|
|
255
|
+
[
|
|
256
|
+
{
|
|
257
|
+
json: {
|
|
258
|
+
...bodyData,
|
|
259
|
+
_headers: headerData,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
],
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.AblefyTrigger = AblefyTrigger;
|
|
268
|
+
//# sourceMappingURL=AblefyTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AblefyTrigger.node.js","sourceRoot":"","sources":["../../../nodes/AblefyTrigger/AblefyTrigger.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AAEtB,MAAa,aAAa;IAA1B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,gBAAgB;YAC7B,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,2GAA2G;YACxH,QAAQ,EAAE;gBACT,IAAI,EAAE,gBAAgB;aACtB;YACD,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,WAAW;oBACjB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,QAAQ,EAAE;gBACT;oBACC,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,YAAY;oBAC1B,IAAI,EAAE,SAAS;iBACf;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,QAAQ;oBACrB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,cAAc;oBACpB,QAAQ,EAAE,IA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AAM,EAAE,QAAQ;4BAChB,GAAG,EAAE,GAAG,OAAO,sBAAsB,WAAW,CAAC,SAAS,EAAE;4BAC5D,IAAI,EAAE,IAAI;yBACV,CACD,CAAC;wBACF,OAAO,WAAW,CAAC,SAAS,CAAC;wBAC7B,OAAO,IAAI,CAAC;oBACb,CAAC;oBAAC,OAAO,MAAM,EAAE,CAAC;wBACjB,OAAO,KAAK,CAAC;oBACd,CAAC;gBACF,CAAC;aACD;SACD,CAAC;IA+BH,CAAC;IA7BA,KAAK,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAExC,sEAAsE;QACtE,sEAAsE;QACtE,MAAM,SAAS,GAAI,QAAgB,CAAC,KAAK,IAAK,QAAgB,CAAC,IAAI,IAAK,QAAgB,CAAC,UAAU,CAAC;QACpG,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAa,CAAC;QAErE,6EAA6E;QAC7E,IAAI,SAAS,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,SAAmB,CAAC,EAAE,CAAC;YACjG,OAAO;gBACN,iBAAiB,EAAE,IAAI;aACvB,CAAC;QACH,CAAC;QAED,OAAO;YACN,YAAY,EAAE;gBACb;oBACC;wBACC,IAAI,EAAE;4BACL,GAAI,QAAoC;4BACxC,QAAQ,EAAE,UAAU;yBACpB;qBACD;iBACD;aACD;SACD,CAAC;IACH,CAAC;CACD;AA9RD,sCA8RC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
|
2
|
+
<circle cx="50" cy="50" r="50" fill="#3BF5A0"/>
|
|
3
|
+
<rect x="28" y="25" width="22" height="10" rx="3" fill="#0D0D0D"/>
|
|
4
|
+
<rect x="28" y="25" width="10" height="40" rx="3" fill="#0D0D0D"/>
|
|
5
|
+
<circle cx="46" cy="60" r="8" fill="#0D0D0D"/>
|
|
6
|
+
<rect x="55" y="55" width="18" height="10" rx="3" fill="#0D0D0D"/>
|
|
7
|
+
<rect x="63" y="45" width="10" height="20" rx="3" fill="#0D0D0D"/>
|
|
8
|
+
</svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-ablefy",
|
|
3
|
+
"version": "2.6.2",
|
|
4
|
+
"description": "n8n community node for Ablefy \u2013 triggers and actions for orders, payments, payers, products, SaaS plans, and refunds.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"ablefy",
|
|
8
|
+
"elopage",
|
|
9
|
+
"webhook",
|
|
10
|
+
"payment",
|
|
11
|
+
"e-commerce"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"homepage": "https://github.com/your-org/n8n-nodes-ablefy",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "CRM Kraft"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/your-org/n8n-nodes-ablefy.git"
|
|
21
|
+
},
|
|
22
|
+
"main": "index.js",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "npx tsc && npm run copy-icons",
|
|
25
|
+
"copy-icons": "cp nodes/Ablefy/ablefy.svg dist/nodes/Ablefy/ablefy.svg && cp nodes/AblefyTrigger/ablefy.svg dist/nodes/AblefyTrigger/ablefy.svg",
|
|
26
|
+
"dev": "tsc --watch",
|
|
27
|
+
"lint": "eslint nodes --ext .ts",
|
|
28
|
+
"prepublishOnly": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"n8n": {
|
|
34
|
+
"n8nNodesApiVersion": 1,
|
|
35
|
+
"credentials": [
|
|
36
|
+
"dist/credentials/AblefyApi.credentials.js"
|
|
37
|
+
],
|
|
38
|
+
"nodes": [
|
|
39
|
+
"dist/nodes/Ablefy/Ablefy.node.js",
|
|
40
|
+
"dist/nodes/AblefyTrigger/AblefyTrigger.node.js"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^18.16.0",
|
|
45
|
+
"copyfiles": "^2.4.1",
|
|
46
|
+
"n8n-workflow": "*",
|
|
47
|
+
"typescript": "^5.1.6"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"n8n-workflow": "*"
|
|
51
|
+
}
|
|
52
|
+
}
|