@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.
Files changed (82) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +236 -0
  3. package/dist/credentials/ChariowApi.credentials.d.ts +13 -0
  4. package/dist/credentials/ChariowApi.credentials.js +44 -0
  5. package/dist/icons/chariow.svg +27 -0
  6. package/dist/nodes/Chariow/Chariow.node.d.ts +5 -0
  7. package/dist/nodes/Chariow/Chariow.node.js +168 -0
  8. package/dist/nodes/Chariow/Chariow.node.json +18 -0
  9. package/dist/nodes/Chariow/ChariowTrigger.node.d.ts +12 -0
  10. package/dist/nodes/Chariow/ChariowTrigger.node.js +212 -0
  11. package/dist/nodes/Chariow/ChariowTrigger.node.json +18 -0
  12. package/dist/nodes/Chariow/resources/affiliate/get.d.ts +3 -0
  13. package/dist/nodes/Chariow/resources/affiliate/get.js +26 -0
  14. package/dist/nodes/Chariow/resources/affiliate/index.d.ts +6 -0
  15. package/dist/nodes/Chariow/resources/affiliate/index.js +69 -0
  16. package/dist/nodes/Chariow/resources/affiliate/sendInvitations.d.ts +3 -0
  17. package/dist/nodes/Chariow/resources/affiliate/sendInvitations.js +38 -0
  18. package/dist/nodes/Chariow/resources/checkout/create.d.ts +3 -0
  19. package/dist/nodes/Chariow/resources/checkout/create.js +356 -0
  20. package/dist/nodes/Chariow/resources/checkout/index.d.ts +5 -0
  21. package/dist/nodes/Chariow/resources/checkout/index.js +61 -0
  22. package/dist/nodes/Chariow/resources/customer/get.d.ts +3 -0
  23. package/dist/nodes/Chariow/resources/customer/get.js +26 -0
  24. package/dist/nodes/Chariow/resources/customer/getAll.d.ts +3 -0
  25. package/dist/nodes/Chariow/resources/customer/getAll.js +87 -0
  26. package/dist/nodes/Chariow/resources/customer/index.d.ts +6 -0
  27. package/dist/nodes/Chariow/resources/customer/index.js +69 -0
  28. package/dist/nodes/Chariow/resources/discount/get.d.ts +3 -0
  29. package/dist/nodes/Chariow/resources/discount/get.js +26 -0
  30. package/dist/nodes/Chariow/resources/discount/getAll.d.ts +3 -0
  31. package/dist/nodes/Chariow/resources/discount/getAll.js +99 -0
  32. package/dist/nodes/Chariow/resources/discount/index.d.ts +6 -0
  33. package/dist/nodes/Chariow/resources/discount/index.js +69 -0
  34. package/dist/nodes/Chariow/resources/index.d.ts +10 -0
  35. package/dist/nodes/Chariow/resources/index.js +54 -0
  36. package/dist/nodes/Chariow/resources/licence/activate.d.ts +3 -0
  37. package/dist/nodes/Chariow/resources/licence/activate.js +53 -0
  38. package/dist/nodes/Chariow/resources/licence/get.d.ts +3 -0
  39. package/dist/nodes/Chariow/resources/licence/get.js +26 -0
  40. package/dist/nodes/Chariow/resources/licence/getActivations.d.ts +3 -0
  41. package/dist/nodes/Chariow/resources/licence/getActivations.js +63 -0
  42. package/dist/nodes/Chariow/resources/licence/getAll.d.ts +3 -0
  43. package/dist/nodes/Chariow/resources/licence/getAll.js +92 -0
  44. package/dist/nodes/Chariow/resources/licence/index.d.ts +9 -0
  45. package/dist/nodes/Chariow/resources/licence/index.js +99 -0
  46. package/dist/nodes/Chariow/resources/licence/revoke.d.ts +3 -0
  47. package/dist/nodes/Chariow/resources/licence/revoke.js +53 -0
  48. package/dist/nodes/Chariow/resources/product/get.d.ts +3 -0
  49. package/dist/nodes/Chariow/resources/product/get.js +26 -0
  50. package/dist/nodes/Chariow/resources/product/getAll.d.ts +3 -0
  51. package/dist/nodes/Chariow/resources/product/getAll.js +107 -0
  52. package/dist/nodes/Chariow/resources/product/index.d.ts +6 -0
  53. package/dist/nodes/Chariow/resources/product/index.js +69 -0
  54. package/dist/nodes/Chariow/resources/pulse/get.d.ts +3 -0
  55. package/dist/nodes/Chariow/resources/pulse/get.js +27 -0
  56. package/dist/nodes/Chariow/resources/pulse/getAll.d.ts +3 -0
  57. package/dist/nodes/Chariow/resources/pulse/getAll.js +71 -0
  58. package/dist/nodes/Chariow/resources/pulse/index.d.ts +6 -0
  59. package/dist/nodes/Chariow/resources/pulse/index.js +69 -0
  60. package/dist/nodes/Chariow/resources/sale/get.d.ts +3 -0
  61. package/dist/nodes/Chariow/resources/sale/get.js +26 -0
  62. package/dist/nodes/Chariow/resources/sale/getAll.d.ts +3 -0
  63. package/dist/nodes/Chariow/resources/sale/getAll.js +110 -0
  64. package/dist/nodes/Chariow/resources/sale/index.d.ts +6 -0
  65. package/dist/nodes/Chariow/resources/sale/index.js +69 -0
  66. package/dist/nodes/Chariow/resources/store/getInfo.d.ts +3 -0
  67. package/dist/nodes/Chariow/resources/store/getInfo.js +10 -0
  68. package/dist/nodes/Chariow/resources/store/index.d.ts +5 -0
  69. package/dist/nodes/Chariow/resources/store/index.js +61 -0
  70. package/dist/nodes/Chariow/shared/constants.d.ts +24 -0
  71. package/dist/nodes/Chariow/shared/constants.js +27 -0
  72. package/dist/nodes/Chariow/shared/descriptions.d.ts +4 -0
  73. package/dist/nodes/Chariow/shared/descriptions.js +33 -0
  74. package/dist/nodes/Chariow/shared/index.d.ts +4 -0
  75. package/dist/nodes/Chariow/shared/index.js +20 -0
  76. package/dist/nodes/Chariow/shared/transport.d.ts +3 -0
  77. package/dist/nodes/Chariow/shared/transport.js +74 -0
  78. package/dist/nodes/Chariow/shared/utils.d.ts +3 -0
  79. package/dist/nodes/Chariow/shared/utils.js +26 -0
  80. package/dist/package.json +77 -0
  81. package/dist/tsconfig.tsbuildinfo +1 -0
  82. package/package.json +69 -0
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChariowTrigger = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const shared_1 = require("./shared");
6
+ class ChariowTrigger {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'Chariow Trigger',
10
+ name: 'chariowTrigger',
11
+ icon: 'file:../../icons/chariow.svg',
12
+ group: ['trigger'],
13
+ version: 1,
14
+ subtitle: '={{$parameter["eventCategory"]}}',
15
+ description: 'Starts the workflow when Chariow events occur',
16
+ defaults: {
17
+ name: 'Chariow Trigger',
18
+ },
19
+ inputs: [],
20
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
21
+ usableAsTool: true,
22
+ credentials: [
23
+ {
24
+ name: 'chariowApi',
25
+ required: true,
26
+ },
27
+ ],
28
+ webhooks: [
29
+ {
30
+ name: 'default',
31
+ httpMethod: 'POST',
32
+ responseMode: 'onReceived',
33
+ path: 'webhook',
34
+ },
35
+ ],
36
+ properties: [
37
+ {
38
+ displayName: 'Event Category',
39
+ name: 'eventCategory',
40
+ type: 'options',
41
+ options: [
42
+ {
43
+ name: 'Affiliate',
44
+ value: 'affiliate',
45
+ },
46
+ {
47
+ name: 'License',
48
+ value: 'license',
49
+ },
50
+ {
51
+ name: 'Sale',
52
+ value: 'sale',
53
+ },
54
+ ],
55
+ default: 'sale',
56
+ description: 'The category of events to listen for',
57
+ },
58
+ {
59
+ displayName: 'Events',
60
+ name: 'events',
61
+ type: 'multiOptions',
62
+ displayOptions: {
63
+ show: {
64
+ eventCategory: ['affiliate'],
65
+ },
66
+ },
67
+ options: [
68
+ {
69
+ name: 'Joined',
70
+ value: 'affiliate_joined',
71
+ description: 'Triggered when an affiliate joins your store',
72
+ },
73
+ ],
74
+ default: ['affiliate_joined'],
75
+ required: true,
76
+ description: 'The affiliate events to trigger on',
77
+ },
78
+ {
79
+ displayName: 'Events',
80
+ name: 'events',
81
+ type: 'multiOptions',
82
+ displayOptions: {
83
+ show: {
84
+ eventCategory: ['sale'],
85
+ },
86
+ },
87
+ options: [
88
+ {
89
+ name: 'Abandoned',
90
+ value: 'abandoned_sale',
91
+ description: 'Triggered when a sale is abandoned',
92
+ },
93
+ {
94
+ name: 'Failed',
95
+ value: 'failed_sale',
96
+ description: 'Triggered when a sale fails',
97
+ },
98
+ {
99
+ name: 'Successful',
100
+ value: 'successful_sale',
101
+ description: 'Triggered when a sale is completed successfully',
102
+ },
103
+ ],
104
+ default: ['successful_sale'],
105
+ required: true,
106
+ description: 'The sale events to trigger on',
107
+ },
108
+ {
109
+ displayName: 'Events',
110
+ name: 'events',
111
+ type: 'multiOptions',
112
+ displayOptions: {
113
+ show: {
114
+ eventCategory: ['license'],
115
+ },
116
+ },
117
+ options: [
118
+ {
119
+ name: 'Activated',
120
+ value: 'license_activated',
121
+ description: 'Triggered when a license is activated',
122
+ },
123
+ {
124
+ name: 'Expired',
125
+ value: 'license_expired',
126
+ description: 'Triggered when a license expires',
127
+ },
128
+ {
129
+ name: 'Issued',
130
+ value: 'license_issued',
131
+ description: 'Triggered when a new license is issued',
132
+ },
133
+ {
134
+ name: 'Revoked',
135
+ value: 'license_revoked',
136
+ description: 'Triggered when a license is revoked',
137
+ },
138
+ ],
139
+ default: ['license_activated'],
140
+ required: true,
141
+ description: 'The license events to trigger on',
142
+ },
143
+ {
144
+ displayName: 'Options',
145
+ name: 'options',
146
+ type: 'collection',
147
+ placeholder: 'Add Option',
148
+ default: {},
149
+ options: [
150
+ {
151
+ displayName: 'Product IDs',
152
+ name: 'productIds',
153
+ type: 'string',
154
+ default: '',
155
+ description: 'Comma-separated list of product IDs to filter events. Leave empty for all products.',
156
+ },
157
+ ],
158
+ },
159
+ ],
160
+ };
161
+ this.webhookMethods = {
162
+ default: {
163
+ async checkExists() {
164
+ const webhookData = this.getWorkflowStaticData('node');
165
+ return webhookData.webhookId !== undefined;
166
+ },
167
+ async create() {
168
+ const webhookUrl = this.getNodeWebhookUrl('default');
169
+ const webhookData = this.getWorkflowStaticData('node');
170
+ const events = this.getNodeParameter('events');
171
+ const options = this.getNodeParameter('options');
172
+ const body = {
173
+ url: webhookUrl,
174
+ triggers: events,
175
+ };
176
+ if (options.productIds) {
177
+ const productIds = options.productIds
178
+ .split(',')
179
+ .map((id) => id.trim())
180
+ .filter((id) => id);
181
+ if (productIds.length > 0) {
182
+ body.product_ids = productIds;
183
+ }
184
+ }
185
+ const response = await shared_1.chariowApiRequest.call(this, 'POST', shared_1.ENDPOINTS.CONNECTIONS_N8N, body);
186
+ const data = (response.data || response);
187
+ webhookData.webhookId = data.id;
188
+ return true;
189
+ },
190
+ async delete() {
191
+ const webhookData = this.getWorkflowStaticData('node');
192
+ if (webhookData.webhookId) {
193
+ try {
194
+ await shared_1.chariowApiRequest.call(this, 'DELETE', shared_1.ENDPOINTS.CONNECTION_N8N(webhookData.webhookId));
195
+ }
196
+ catch {
197
+ }
198
+ delete webhookData.webhookId;
199
+ }
200
+ return true;
201
+ },
202
+ },
203
+ };
204
+ }
205
+ async webhook() {
206
+ const bodyData = this.getBodyData();
207
+ return {
208
+ workflowData: [this.helpers.returnJsonArray(bodyData)],
209
+ };
210
+ }
211
+ }
212
+ exports.ChariowTrigger = ChariowTrigger;
@@ -0,0 +1,18 @@
1
+ {
2
+ "node": "n8n-nodes-base.chariowTrigger",
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,3 @@
1
+ import type { IExecuteFunctions, IDataObject, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, i: number): Promise<IDataObject>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const shared_1 = require("../../shared");
6
+ exports.description = [
7
+ {
8
+ displayName: 'Affiliate Code',
9
+ name: 'affiliateCode',
10
+ type: 'string',
11
+ required: true,
12
+ default: '',
13
+ displayOptions: {
14
+ show: {
15
+ resource: ['affiliate'],
16
+ operation: ['get'],
17
+ },
18
+ },
19
+ description: 'The unique affiliate code (e.g., JOHN25, PROMO2025)',
20
+ },
21
+ ];
22
+ async function execute(i) {
23
+ const affiliateCode = this.getNodeParameter('affiliateCode', i);
24
+ const response = await shared_1.chariowApiRequest.call(this, 'GET', shared_1.ENDPOINTS.AFFILIATE(affiliateCode));
25
+ return (0, shared_1.extractData)(response);
26
+ }
@@ -0,0 +1,6 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import * as get from './get';
3
+ import * as sendInvitations from './sendInvitations';
4
+ export declare const operations: INodeProperties[];
5
+ export declare const fields: INodeProperties[];
6
+ export { get, sendInvitations };
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.sendInvitations = exports.get = exports.fields = exports.operations = void 0;
37
+ const get = __importStar(require("./get"));
38
+ exports.get = get;
39
+ const sendInvitations = __importStar(require("./sendInvitations"));
40
+ exports.sendInvitations = sendInvitations;
41
+ exports.operations = [
42
+ {
43
+ displayName: 'Operation',
44
+ name: 'operation',
45
+ type: 'options',
46
+ noDataExpression: true,
47
+ displayOptions: {
48
+ show: {
49
+ resource: ['affiliate'],
50
+ },
51
+ },
52
+ options: [
53
+ {
54
+ name: 'Get',
55
+ value: 'get',
56
+ description: 'Get an affiliate by their unique code',
57
+ action: 'Get an affiliate',
58
+ },
59
+ {
60
+ name: 'Send Invitations',
61
+ value: 'sendInvitations',
62
+ description: 'Send affiliate invitations to email addresses',
63
+ action: 'Send affiliate invitations',
64
+ },
65
+ ],
66
+ default: 'get',
67
+ },
68
+ ];
69
+ exports.fields = [...get.description, ...sendInvitations.description];
@@ -0,0 +1,3 @@
1
+ import type { IExecuteFunctions, IDataObject, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, i: number): Promise<IDataObject>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const shared_1 = require("../../shared");
6
+ exports.description = [
7
+ {
8
+ displayName: 'Email Addresses',
9
+ name: 'emails',
10
+ type: 'string',
11
+ typeOptions: {
12
+ multipleValues: true,
13
+ },
14
+ required: true,
15
+ default: [],
16
+ displayOptions: {
17
+ show: {
18
+ resource: ['affiliate'],
19
+ operation: ['sendInvitations'],
20
+ },
21
+ },
22
+ description: 'Email addresses to send affiliate invitations to. Up to 25 emails allowed. Existing affiliates and pending invitations will be automatically skipped.',
23
+ },
24
+ ];
25
+ async function execute(i) {
26
+ const emails = this.getNodeParameter('emails', i);
27
+ const emailList = emails.filter((e) => e && e.trim());
28
+ if (emailList.length === 0) {
29
+ throw new Error('At least one email address is required');
30
+ }
31
+ if (emailList.length > 25) {
32
+ throw new Error('Maximum 25 email addresses allowed per request');
33
+ }
34
+ const response = await shared_1.chariowApiRequest.call(this, 'POST', shared_1.ENDPOINTS.AFFILIATE_INVITATIONS, {
35
+ emails: emailList,
36
+ });
37
+ return (0, shared_1.extractData)(response);
38
+ }
@@ -0,0 +1,3 @@
1
+ import type { IExecuteFunctions, IDataObject, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, i: number): Promise<IDataObject>;