@chariow/n8n-nodes-chariow 0.0.0
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/LICENSE.md +21 -0
- package/README.md +236 -0
- package/dist/credentials/ChariowApi.credentials.d.ts +13 -0
- package/dist/credentials/ChariowApi.credentials.js +44 -0
- package/dist/icons/chariow.svg +27 -0
- package/dist/nodes/Chariow/Chariow.node.d.ts +5 -0
- package/dist/nodes/Chariow/Chariow.node.js +168 -0
- package/dist/nodes/Chariow/Chariow.node.json +18 -0
- package/dist/nodes/Chariow/ChariowTrigger.node.d.ts +12 -0
- package/dist/nodes/Chariow/ChariowTrigger.node.js +212 -0
- package/dist/nodes/Chariow/ChariowTrigger.node.json +18 -0
- package/dist/nodes/Chariow/resources/affiliate/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/affiliate/get.js +26 -0
- package/dist/nodes/Chariow/resources/affiliate/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/affiliate/index.js +69 -0
- package/dist/nodes/Chariow/resources/affiliate/sendInvitations.d.ts +3 -0
- package/dist/nodes/Chariow/resources/affiliate/sendInvitations.js +38 -0
- package/dist/nodes/Chariow/resources/checkout/create.d.ts +3 -0
- package/dist/nodes/Chariow/resources/checkout/create.js +356 -0
- package/dist/nodes/Chariow/resources/checkout/index.d.ts +5 -0
- package/dist/nodes/Chariow/resources/checkout/index.js +61 -0
- package/dist/nodes/Chariow/resources/customer/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/customer/get.js +26 -0
- package/dist/nodes/Chariow/resources/customer/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/customer/getAll.js +87 -0
- package/dist/nodes/Chariow/resources/customer/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/customer/index.js +69 -0
- package/dist/nodes/Chariow/resources/discount/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/discount/get.js +26 -0
- package/dist/nodes/Chariow/resources/discount/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/discount/getAll.js +99 -0
- package/dist/nodes/Chariow/resources/discount/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/discount/index.js +69 -0
- package/dist/nodes/Chariow/resources/index.d.ts +10 -0
- package/dist/nodes/Chariow/resources/index.js +54 -0
- package/dist/nodes/Chariow/resources/licence/activate.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/activate.js +53 -0
- package/dist/nodes/Chariow/resources/licence/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/get.js +26 -0
- package/dist/nodes/Chariow/resources/licence/getActivations.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/getActivations.js +63 -0
- package/dist/nodes/Chariow/resources/licence/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/getAll.js +92 -0
- package/dist/nodes/Chariow/resources/licence/index.d.ts +9 -0
- package/dist/nodes/Chariow/resources/licence/index.js +99 -0
- package/dist/nodes/Chariow/resources/licence/revoke.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/revoke.js +53 -0
- package/dist/nodes/Chariow/resources/product/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/product/get.js +26 -0
- package/dist/nodes/Chariow/resources/product/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/product/getAll.js +107 -0
- package/dist/nodes/Chariow/resources/product/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/product/index.js +69 -0
- package/dist/nodes/Chariow/resources/pulse/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/pulse/get.js +27 -0
- package/dist/nodes/Chariow/resources/pulse/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/pulse/getAll.js +71 -0
- package/dist/nodes/Chariow/resources/pulse/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/pulse/index.js +69 -0
- package/dist/nodes/Chariow/resources/sale/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/sale/get.js +26 -0
- package/dist/nodes/Chariow/resources/sale/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/sale/getAll.js +110 -0
- package/dist/nodes/Chariow/resources/sale/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/sale/index.js +69 -0
- package/dist/nodes/Chariow/resources/store/getInfo.d.ts +3 -0
- package/dist/nodes/Chariow/resources/store/getInfo.js +10 -0
- package/dist/nodes/Chariow/resources/store/index.d.ts +5 -0
- package/dist/nodes/Chariow/resources/store/index.js +61 -0
- package/dist/nodes/Chariow/shared/constants.d.ts +24 -0
- package/dist/nodes/Chariow/shared/constants.js +27 -0
- package/dist/nodes/Chariow/shared/descriptions.d.ts +4 -0
- package/dist/nodes/Chariow/shared/descriptions.js +33 -0
- package/dist/nodes/Chariow/shared/index.d.ts +4 -0
- package/dist/nodes/Chariow/shared/index.js +20 -0
- package/dist/nodes/Chariow/shared/transport.d.ts +3 -0
- package/dist/nodes/Chariow/shared/transport.js +74 -0
- package/dist/nodes/Chariow/shared/utils.d.ts +3 -0
- package/dist/nodes/Chariow/shared/utils.js +26 -0
- package/dist/package.json +77 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +69 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Axa Zara
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# n8n-nodes-chariow
|
|
2
|
+
|
|
3
|
+
This is an n8n community node that lets you use [Chariow](https://chariow.com) in your n8n workflows.
|
|
4
|
+
|
|
5
|
+
Chariow is a digital products platform that helps creators and entrepreneurs sell their content, products, and services across borders without hassle.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
[Installation](#installation)
|
|
10
|
+
[Operations](#operations)
|
|
11
|
+
[Credentials](#credentials)
|
|
12
|
+
[Compatibility](#compatibility)
|
|
13
|
+
[Usage](#usage)
|
|
14
|
+
[Resources](#resources)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
19
|
+
|
|
20
|
+
### npm
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install n8n-nodes-chariow
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Docker
|
|
27
|
+
|
|
28
|
+
If you're using Docker, add the package to your n8n instance:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
docker exec -it n8n npm install n8n-nodes-chariow
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then restart your n8n instance.
|
|
35
|
+
|
|
36
|
+
## Operations
|
|
37
|
+
|
|
38
|
+
### Chariow Node (Actions)
|
|
39
|
+
|
|
40
|
+
This node supports the following resources and operations:
|
|
41
|
+
|
|
42
|
+
#### Customer
|
|
43
|
+
- **Get**: Retrieve a customer by ID
|
|
44
|
+
- **Get Many**: List customers with optional search filter
|
|
45
|
+
|
|
46
|
+
#### Product
|
|
47
|
+
- **Get**: Retrieve a product by ID
|
|
48
|
+
- **Get Many**: List products with optional filters (search, status)
|
|
49
|
+
|
|
50
|
+
#### Sale
|
|
51
|
+
- **Get**: Retrieve a sale by ID
|
|
52
|
+
- **Get Many**: List sales with optional filters (customer_id, product_id, status)
|
|
53
|
+
|
|
54
|
+
#### Discount
|
|
55
|
+
- **Get**: Retrieve a discount by ID or code
|
|
56
|
+
- **Get Many**: List discounts with optional filters (search, status)
|
|
57
|
+
|
|
58
|
+
#### Licence
|
|
59
|
+
- **Get**: Retrieve a licence by ID or key
|
|
60
|
+
- **Get Many**: List licences with optional filters (customer_id, product_id, search, status)
|
|
61
|
+
- **Activate**: Activate a licence with optional device information
|
|
62
|
+
- **Revoke**: Revoke a licence
|
|
63
|
+
- **Get Activations**: List activations for a licence
|
|
64
|
+
|
|
65
|
+
#### Checkout
|
|
66
|
+
- **Create**: Create a new checkout session with optional customer info, discount code, and custom fields
|
|
67
|
+
|
|
68
|
+
#### Store
|
|
69
|
+
- **Get Info**: Retrieve your store information
|
|
70
|
+
|
|
71
|
+
### Chariow Trigger Node (Webhooks)
|
|
72
|
+
|
|
73
|
+
Automatically start workflows when events occur in Chariow:
|
|
74
|
+
|
|
75
|
+
#### Sale Events
|
|
76
|
+
- `successful.sale` - When a sale is completed successfully
|
|
77
|
+
- `abandoned.sale` - When a sale is abandoned
|
|
78
|
+
- `failed.sale` - When a sale fails
|
|
79
|
+
- `refunded.sale` - When a sale is refunded
|
|
80
|
+
|
|
81
|
+
#### Licence Events
|
|
82
|
+
- `activated.licence` - When a licence is activated
|
|
83
|
+
- `expired.licence` - When a licence expires
|
|
84
|
+
- `issued.licence` - When a new licence is issued
|
|
85
|
+
- `revoked.licence` - When a licence is revoked
|
|
86
|
+
|
|
87
|
+
## Credentials
|
|
88
|
+
|
|
89
|
+
To use this node, you'll need a Chariow API key:
|
|
90
|
+
|
|
91
|
+
1. Log in to your [Chariow dashboard](https://app.chariow.com)
|
|
92
|
+
2. Go to **Settings** > **API Keys**
|
|
93
|
+
3. Create a new API key or copy an existing one
|
|
94
|
+
4. The API key should start with `sk_live_` (production) or `sk_test_` (testing)
|
|
95
|
+
|
|
96
|
+
## Compatibility
|
|
97
|
+
|
|
98
|
+
- Tested with n8n version 1.0.0 and above
|
|
99
|
+
- Requires Node.js 18.10 or higher
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
### Basic Example: Get Customer Data
|
|
104
|
+
|
|
105
|
+
1. Add the **Chariow** node to your workflow
|
|
106
|
+
2. Select **Customer** as the resource
|
|
107
|
+
3. Select **Get** as the operation
|
|
108
|
+
4. Enter the Customer ID (e.g., `cus_abc123xyz`)
|
|
109
|
+
5. Execute the node
|
|
110
|
+
|
|
111
|
+
### Webhook Example: Process New Sales
|
|
112
|
+
|
|
113
|
+
1. Add the **Chariow Trigger** node to your workflow
|
|
114
|
+
2. Select **Sale** as the event category
|
|
115
|
+
3. Select **Successful** as the event type
|
|
116
|
+
4. Activate the workflow
|
|
117
|
+
5. The workflow will trigger whenever a new successful sale occurs
|
|
118
|
+
|
|
119
|
+
### Create Checkout Example
|
|
120
|
+
|
|
121
|
+
1. Add the **Chariow** node to your workflow
|
|
122
|
+
2. Select **Checkout** as the resource
|
|
123
|
+
3. Select **Create** as the operation
|
|
124
|
+
4. Enter the Product ID
|
|
125
|
+
5. Optionally add customer email, discount code, or custom fields
|
|
126
|
+
6. Execute to get a checkout URL
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
### Prerequisites
|
|
131
|
+
|
|
132
|
+
- Node.js 18.10+
|
|
133
|
+
- pnpm 9.1+
|
|
134
|
+
- n8n installed globally (for local testing)
|
|
135
|
+
|
|
136
|
+
### Setup
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Clone the repository
|
|
140
|
+
git clone https://github.com/Chariow/n8n-nodes.git
|
|
141
|
+
cd n8n-nodes
|
|
142
|
+
|
|
143
|
+
# Install dependencies
|
|
144
|
+
pnpm install
|
|
145
|
+
|
|
146
|
+
# Build the node
|
|
147
|
+
pnpm build
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Local Testing
|
|
151
|
+
|
|
152
|
+
There are two ways to test the node locally:
|
|
153
|
+
|
|
154
|
+
#### Option 1: Using n8n-node dev (Recommended)
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Build and start n8n with the custom node
|
|
158
|
+
pnpm test:local
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This will start n8n with your custom node loaded. Access n8n at `http://localhost:5678`.
|
|
162
|
+
|
|
163
|
+
#### Option 2: Link to existing n8n installation
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Build the node
|
|
167
|
+
pnpm build
|
|
168
|
+
|
|
169
|
+
# Link to your global n8n
|
|
170
|
+
pnpm link --global
|
|
171
|
+
|
|
172
|
+
# In your n8n custom nodes directory (~/.n8n/custom)
|
|
173
|
+
mkdir -p ~/.n8n/custom
|
|
174
|
+
cd ~/.n8n/custom
|
|
175
|
+
pnpm link --global n8n-nodes-chariow
|
|
176
|
+
|
|
177
|
+
# Restart n8n
|
|
178
|
+
n8n start
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Available Scripts
|
|
182
|
+
|
|
183
|
+
| Command | Description |
|
|
184
|
+
|---------|-------------|
|
|
185
|
+
| `pnpm build` | Build the node |
|
|
186
|
+
| `pnpm build:watch` | Build and watch for changes |
|
|
187
|
+
| `pnpm dev` | Start n8n with the custom node |
|
|
188
|
+
| `pnpm lint` | Run ESLint |
|
|
189
|
+
| `pnpm lint:fix` | Fix ESLint errors |
|
|
190
|
+
| `pnpm format` | Format code with Prettier |
|
|
191
|
+
| `pnpm format:check` | Check code formatting |
|
|
192
|
+
| `pnpm typecheck` | Run TypeScript type checking |
|
|
193
|
+
| `pnpm test:local` | Build and start n8n for testing |
|
|
194
|
+
|
|
195
|
+
### Project Structure
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
chariow-n8n/
|
|
199
|
+
├── credentials/
|
|
200
|
+
│ └── ChariowApi.credentials.ts
|
|
201
|
+
├── nodes/
|
|
202
|
+
│ └── Chariow/
|
|
203
|
+
│ ├── Chariow.node.ts
|
|
204
|
+
│ ├── ChariowTrigger.node.ts
|
|
205
|
+
│ ├── shared/
|
|
206
|
+
│ │ ├── transport.ts
|
|
207
|
+
│ │ ├── utils.ts
|
|
208
|
+
│ │ └── descriptions.ts
|
|
209
|
+
│ └── resources/
|
|
210
|
+
│ ├── customer/
|
|
211
|
+
│ ├── product/
|
|
212
|
+
│ ├── sale/
|
|
213
|
+
│ ├── discount/
|
|
214
|
+
│ ├── licence/
|
|
215
|
+
│ ├── checkout/
|
|
216
|
+
│ └── store/
|
|
217
|
+
├── icons/
|
|
218
|
+
│ └── chariow.svg
|
|
219
|
+
└── dist/ # Built output
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Resources
|
|
223
|
+
|
|
224
|
+
* [Chariow Documentation](https://docs.chariow.com/)
|
|
225
|
+
* [Chariow API Reference](https://docs.chariow.com/api)
|
|
226
|
+
* [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
227
|
+
|
|
228
|
+
## Support
|
|
229
|
+
|
|
230
|
+
For issues with this node, please [open an issue](https://github.com/Chariow/n8n-nodes/issues) on GitHub.
|
|
231
|
+
|
|
232
|
+
For questions about Chariow, contact [support@chariow.com](mailto:support@chariow.com).
|
|
233
|
+
|
|
234
|
+
## License
|
|
235
|
+
|
|
236
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class ChariowApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
icon: {
|
|
7
|
+
readonly light: "file:../icons/chariow.svg";
|
|
8
|
+
readonly dark: "file:../icons/chariow.svg";
|
|
9
|
+
};
|
|
10
|
+
properties: INodeProperties[];
|
|
11
|
+
authenticate: IAuthenticateGeneric;
|
|
12
|
+
test: ICredentialTestRequest;
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChariowApi = void 0;
|
|
4
|
+
const constants_1 = require("../nodes/Chariow/shared/constants");
|
|
5
|
+
class ChariowApi {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.name = 'chariowApi';
|
|
8
|
+
this.displayName = 'Chariow API';
|
|
9
|
+
this.documentationUrl = 'https://docs.chariow.com/en/introduction/overview';
|
|
10
|
+
this.icon = {
|
|
11
|
+
light: 'file:../icons/chariow.svg',
|
|
12
|
+
dark: 'file:../icons/chariow.svg',
|
|
13
|
+
};
|
|
14
|
+
this.properties = [
|
|
15
|
+
{
|
|
16
|
+
displayName: 'API Key',
|
|
17
|
+
name: 'apiKey',
|
|
18
|
+
type: 'string',
|
|
19
|
+
typeOptions: { password: true },
|
|
20
|
+
default: '',
|
|
21
|
+
required: true,
|
|
22
|
+
description: 'Your Chariow API Key. Find it in your store settings under API Keys. It should start with sk_.',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
this.authenticate = {
|
|
26
|
+
type: 'generic',
|
|
27
|
+
properties: {
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
30
|
+
Accept: 'application/json',
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
'X-Platform-Source': 'n8n',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
this.test = {
|
|
37
|
+
request: {
|
|
38
|
+
baseURL: constants_1.API_BASE_URL,
|
|
39
|
+
url: '/store',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ChariowApi = ChariowApi;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Calque_2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1189.84 1190.66">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
fill: #fc0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cls-2 {
|
|
10
|
+
fill: #1c1e21;
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
</defs>
|
|
14
|
+
<g id="Calque_1-2" data-name="Calque_1">
|
|
15
|
+
<g>
|
|
16
|
+
<path class="cls-1" d="M1189.84,372.38c0,328.57-266.36,594.93-594.93,594.93S0,700.95,0,372.38h148.13c0,246.76,200.03,446.8,446.78,446.8s446.8-200.04,446.8-446.8h148.13Z"/>
|
|
17
|
+
<g>
|
|
18
|
+
<path class="cls-2" d="M892.11,1080c0,61.11-49.53,110.66-110.66,110.66s-110.66-49.55-110.66-110.66,49.55-110.66,110.66-110.66,110.66,49.55,110.66,110.66Z"/>
|
|
19
|
+
<path class="cls-2" d="M519.03,1080c0,61.11-49.53,110.66-110.66,110.66s-110.66-49.55-110.66-110.66,49.55-110.66,110.66-110.66,110.66,49.55,110.66,110.66Z"/>
|
|
20
|
+
</g>
|
|
21
|
+
<g>
|
|
22
|
+
<rect class="cls-1" x="742.88" width="297.76" height="297.76"/>
|
|
23
|
+
<polygon class="cls-2" points="804.55 534.22 594 744.75 149.2 299.95 154.94 294.2 359.73 89.4 642.71 372.38 804.55 534.22"/>
|
|
24
|
+
</g>
|
|
25
|
+
</g>
|
|
26
|
+
</g>
|
|
27
|
+
</svg>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Chariow = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const resources_1 = require("./resources");
|
|
6
|
+
class Chariow {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.description = {
|
|
9
|
+
displayName: 'Chariow',
|
|
10
|
+
name: 'chariow',
|
|
11
|
+
icon: 'file:../../icons/chariow.svg',
|
|
12
|
+
group: ['transform'],
|
|
13
|
+
version: 1,
|
|
14
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
15
|
+
description: 'Interact with Chariow - the digital products platform for creators and entrepreneurs',
|
|
16
|
+
defaults: {
|
|
17
|
+
name: 'Chariow',
|
|
18
|
+
},
|
|
19
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
20
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
21
|
+
usableAsTool: true,
|
|
22
|
+
credentials: [
|
|
23
|
+
{
|
|
24
|
+
name: 'chariowApi',
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
properties: [
|
|
29
|
+
{
|
|
30
|
+
displayName: 'Resource',
|
|
31
|
+
name: 'resource',
|
|
32
|
+
type: 'options',
|
|
33
|
+
noDataExpression: true,
|
|
34
|
+
options: [
|
|
35
|
+
{ name: 'Affiliate', value: 'affiliate' },
|
|
36
|
+
{ name: 'Checkout', value: 'checkout' },
|
|
37
|
+
{ name: 'Customer', value: 'customer' },
|
|
38
|
+
{ name: 'Discount', value: 'discount' },
|
|
39
|
+
{ name: 'Licence', value: 'licence' },
|
|
40
|
+
{ name: 'Product', value: 'product' },
|
|
41
|
+
{ name: 'Pulse', value: 'pulse' },
|
|
42
|
+
{ name: 'Sale', value: 'sale' },
|
|
43
|
+
{ name: 'Store', value: 'store' },
|
|
44
|
+
],
|
|
45
|
+
default: 'customer',
|
|
46
|
+
},
|
|
47
|
+
...resources_1.affiliate.operations,
|
|
48
|
+
...resources_1.affiliate.fields,
|
|
49
|
+
...resources_1.customer.operations,
|
|
50
|
+
...resources_1.customer.fields,
|
|
51
|
+
...resources_1.product.operations,
|
|
52
|
+
...resources_1.product.fields,
|
|
53
|
+
...resources_1.sale.operations,
|
|
54
|
+
...resources_1.sale.fields,
|
|
55
|
+
...resources_1.discount.operations,
|
|
56
|
+
...resources_1.discount.fields,
|
|
57
|
+
...resources_1.licence.operations,
|
|
58
|
+
...resources_1.licence.fields,
|
|
59
|
+
...resources_1.checkout.operations,
|
|
60
|
+
...resources_1.checkout.fields,
|
|
61
|
+
...resources_1.store.operations,
|
|
62
|
+
...resources_1.store.fields,
|
|
63
|
+
...resources_1.pulse.operations,
|
|
64
|
+
...resources_1.pulse.fields,
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async execute() {
|
|
69
|
+
const items = this.getInputData();
|
|
70
|
+
const returnData = [];
|
|
71
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
72
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
73
|
+
for (let i = 0; i < items.length; i++) {
|
|
74
|
+
try {
|
|
75
|
+
let responseData = {};
|
|
76
|
+
if (resource === 'affiliate') {
|
|
77
|
+
if (operation === 'get') {
|
|
78
|
+
responseData = await resources_1.affiliate.get.execute.call(this, i);
|
|
79
|
+
}
|
|
80
|
+
else if (operation === 'sendInvitations') {
|
|
81
|
+
responseData = await resources_1.affiliate.sendInvitations.execute.call(this, i);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (resource === 'customer') {
|
|
85
|
+
if (operation === 'get') {
|
|
86
|
+
responseData = await resources_1.customer.get.execute.call(this, i);
|
|
87
|
+
}
|
|
88
|
+
else if (operation === 'getAll') {
|
|
89
|
+
responseData = await resources_1.customer.getAll.execute.call(this, i);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (resource === 'product') {
|
|
93
|
+
if (operation === 'get') {
|
|
94
|
+
responseData = await resources_1.product.get.execute.call(this, i);
|
|
95
|
+
}
|
|
96
|
+
else if (operation === 'getAll') {
|
|
97
|
+
responseData = await resources_1.product.getAll.execute.call(this, i);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (resource === 'sale') {
|
|
101
|
+
if (operation === 'get') {
|
|
102
|
+
responseData = await resources_1.sale.get.execute.call(this, i);
|
|
103
|
+
}
|
|
104
|
+
else if (operation === 'getAll') {
|
|
105
|
+
responseData = await resources_1.sale.getAll.execute.call(this, i);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (resource === 'discount') {
|
|
109
|
+
if (operation === 'get') {
|
|
110
|
+
responseData = await resources_1.discount.get.execute.call(this, i);
|
|
111
|
+
}
|
|
112
|
+
else if (operation === 'getAll') {
|
|
113
|
+
responseData = await resources_1.discount.getAll.execute.call(this, i);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (resource === 'licence') {
|
|
117
|
+
if (operation === 'get') {
|
|
118
|
+
responseData = await resources_1.licence.get.execute.call(this, i);
|
|
119
|
+
}
|
|
120
|
+
else if (operation === 'getAll') {
|
|
121
|
+
responseData = await resources_1.licence.getAll.execute.call(this, i);
|
|
122
|
+
}
|
|
123
|
+
else if (operation === 'activate') {
|
|
124
|
+
responseData = await resources_1.licence.activate.execute.call(this, i);
|
|
125
|
+
}
|
|
126
|
+
else if (operation === 'revoke') {
|
|
127
|
+
responseData = await resources_1.licence.revoke.execute.call(this, i);
|
|
128
|
+
}
|
|
129
|
+
else if (operation === 'getActivations') {
|
|
130
|
+
responseData = await resources_1.licence.getActivations.execute.call(this, i);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (resource === 'checkout') {
|
|
134
|
+
if (operation === 'create') {
|
|
135
|
+
responseData = await resources_1.checkout.create.execute.call(this, i);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (resource === 'store') {
|
|
139
|
+
if (operation === 'getInfo') {
|
|
140
|
+
responseData = await resources_1.store.getInfo.execute.call(this);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (resource === 'pulse') {
|
|
144
|
+
if (operation === 'get') {
|
|
145
|
+
responseData = await resources_1.pulse.get.execute.call(this, i);
|
|
146
|
+
}
|
|
147
|
+
else if (operation === 'getAll') {
|
|
148
|
+
responseData = await resources_1.pulse.getAll.execute.call(this, i);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
152
|
+
returnData.push(...executionData);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (this.continueOnFail()) {
|
|
156
|
+
returnData.push({
|
|
157
|
+
json: { error: error.message },
|
|
158
|
+
pairedItem: { item: i },
|
|
159
|
+
});
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return [returnData];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.Chariow = Chariow;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-base.chariow",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Sales"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://docs.chariow.com/en/introduction/overview"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://docs.chariow.com/"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IHookFunctions, INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class ChariowTrigger 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
|
+
}
|