@chariow/n8n-nodes-chariow 0.0.1
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 +45 -0
- package/dist/credentials/ChariowApi.credentials.js.map +1 -0
- package/dist/examples/n8n-nodes-starter/icons/github.dark.svg +3 -0
- package/dist/examples/n8n-nodes-starter/icons/github.svg +3 -0
- package/dist/examples/n8n-nodes-starter/nodes/Example/example.dark.svg +13 -0
- package/dist/examples/n8n-nodes-starter/nodes/Example/example.svg +13 -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 +147 -0
- package/dist/nodes/Chariow/Chariow.node.js.map +1 -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 +191 -0
- package/dist/nodes/Chariow/ChariowTrigger.node.js.map +1 -0
- package/dist/nodes/Chariow/ChariowTrigger.node.json +18 -0
- package/dist/nodes/Chariow/resources/checkout/create.d.ts +3 -0
- package/dist/nodes/Chariow/resources/checkout/create.js +137 -0
- package/dist/nodes/Chariow/resources/checkout/create.js.map +1 -0
- package/dist/nodes/Chariow/resources/checkout/index.d.ts +5 -0
- package/dist/nodes/Chariow/resources/checkout/index.js +62 -0
- package/dist/nodes/Chariow/resources/checkout/index.js.map +1 -0
- package/dist/nodes/Chariow/resources/customer/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/customer/get.js +27 -0
- package/dist/nodes/Chariow/resources/customer/get.js.map +1 -0
- package/dist/nodes/Chariow/resources/customer/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/customer/getAll.js +80 -0
- package/dist/nodes/Chariow/resources/customer/getAll.js.map +1 -0
- package/dist/nodes/Chariow/resources/customer/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/customer/index.js +70 -0
- package/dist/nodes/Chariow/resources/customer/index.js.map +1 -0
- package/dist/nodes/Chariow/resources/discount/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/discount/get.js +27 -0
- package/dist/nodes/Chariow/resources/discount/get.js.map +1 -0
- package/dist/nodes/Chariow/resources/discount/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/discount/getAll.js +85 -0
- package/dist/nodes/Chariow/resources/discount/getAll.js.map +1 -0
- package/dist/nodes/Chariow/resources/discount/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/discount/index.js +70 -0
- package/dist/nodes/Chariow/resources/discount/index.js.map +1 -0
- package/dist/nodes/Chariow/resources/index.d.ts +8 -0
- package/dist/nodes/Chariow/resources/index.js +51 -0
- package/dist/nodes/Chariow/resources/index.js.map +1 -0
- package/dist/nodes/Chariow/resources/licence/activate.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/activate.js +64 -0
- package/dist/nodes/Chariow/resources/licence/activate.js.map +1 -0
- package/dist/nodes/Chariow/resources/licence/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/get.js +27 -0
- package/dist/nodes/Chariow/resources/licence/get.js.map +1 -0
- package/dist/nodes/Chariow/resources/licence/getActivations.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/getActivations.js +64 -0
- package/dist/nodes/Chariow/resources/licence/getActivations.js.map +1 -0
- package/dist/nodes/Chariow/resources/licence/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/getAll.js +100 -0
- package/dist/nodes/Chariow/resources/licence/getAll.js.map +1 -0
- package/dist/nodes/Chariow/resources/licence/index.d.ts +9 -0
- package/dist/nodes/Chariow/resources/licence/index.js +100 -0
- package/dist/nodes/Chariow/resources/licence/index.js.map +1 -0
- package/dist/nodes/Chariow/resources/licence/revoke.d.ts +3 -0
- package/dist/nodes/Chariow/resources/licence/revoke.js +27 -0
- package/dist/nodes/Chariow/resources/licence/revoke.js.map +1 -0
- package/dist/nodes/Chariow/resources/product/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/product/get.js +27 -0
- package/dist/nodes/Chariow/resources/product/get.js.map +1 -0
- package/dist/nodes/Chariow/resources/product/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/product/getAll.js +84 -0
- package/dist/nodes/Chariow/resources/product/getAll.js.map +1 -0
- package/dist/nodes/Chariow/resources/product/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/product/index.js +70 -0
- package/dist/nodes/Chariow/resources/product/index.js.map +1 -0
- package/dist/nodes/Chariow/resources/sale/get.d.ts +3 -0
- package/dist/nodes/Chariow/resources/sale/get.js +27 -0
- package/dist/nodes/Chariow/resources/sale/get.js.map +1 -0
- package/dist/nodes/Chariow/resources/sale/getAll.d.ts +3 -0
- package/dist/nodes/Chariow/resources/sale/getAll.js +94 -0
- package/dist/nodes/Chariow/resources/sale/getAll.js.map +1 -0
- package/dist/nodes/Chariow/resources/sale/index.d.ts +6 -0
- package/dist/nodes/Chariow/resources/sale/index.js +70 -0
- package/dist/nodes/Chariow/resources/sale/index.js.map +1 -0
- package/dist/nodes/Chariow/resources/store/getInfo.d.ts +3 -0
- package/dist/nodes/Chariow/resources/store/getInfo.js +11 -0
- package/dist/nodes/Chariow/resources/store/getInfo.js.map +1 -0
- package/dist/nodes/Chariow/resources/store/index.d.ts +5 -0
- package/dist/nodes/Chariow/resources/store/index.js +62 -0
- package/dist/nodes/Chariow/resources/store/index.js.map +1 -0
- package/dist/nodes/Chariow/shared/constants.d.ts +20 -0
- package/dist/nodes/Chariow/shared/constants.js +24 -0
- package/dist/nodes/Chariow/shared/constants.js.map +1 -0
- package/dist/nodes/Chariow/shared/descriptions.d.ts +4 -0
- package/dist/nodes/Chariow/shared/descriptions.js +34 -0
- package/dist/nodes/Chariow/shared/descriptions.js.map +1 -0
- package/dist/nodes/Chariow/shared/index.d.ts +4 -0
- package/dist/nodes/Chariow/shared/index.js +21 -0
- package/dist/nodes/Chariow/shared/index.js.map +1 -0
- package/dist/nodes/Chariow/shared/transport.d.ts +3 -0
- package/dist/nodes/Chariow/shared/transport.js +63 -0
- package/dist/nodes/Chariow/shared/transport.js.map +1 -0
- package/dist/nodes/Chariow/shared/utils.d.ts +3 -0
- package/dist/nodes/Chariow/shared/utils.js +20 -0
- package/dist/nodes/Chariow/shared/utils.js.map +1 -0
- package/dist/package.json +67 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,191 @@
|
|
|
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: 'Licence',
|
|
44
|
+
value: 'licence',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'Sale',
|
|
48
|
+
value: 'sale',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
default: 'sale',
|
|
52
|
+
description: 'The category of events to listen for',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
displayName: 'Events',
|
|
56
|
+
name: 'events',
|
|
57
|
+
type: 'multiOptions',
|
|
58
|
+
displayOptions: {
|
|
59
|
+
show: {
|
|
60
|
+
eventCategory: ['sale'],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
options: [
|
|
64
|
+
{
|
|
65
|
+
name: 'Abandoned',
|
|
66
|
+
value: 'abandoned.sale',
|
|
67
|
+
description: 'Triggered when a sale is abandoned',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Failed',
|
|
71
|
+
value: 'failed.sale',
|
|
72
|
+
description: 'Triggered when a sale fails',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Successful',
|
|
76
|
+
value: 'successful.sale',
|
|
77
|
+
description: 'Triggered when a sale is completed successfully',
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
default: ['successful.sale'],
|
|
81
|
+
required: true,
|
|
82
|
+
description: 'The sale events to trigger on',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
displayName: 'Events',
|
|
86
|
+
name: 'events',
|
|
87
|
+
type: 'multiOptions',
|
|
88
|
+
displayOptions: {
|
|
89
|
+
show: {
|
|
90
|
+
eventCategory: ['licence'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
options: [
|
|
94
|
+
{
|
|
95
|
+
name: 'Activated',
|
|
96
|
+
value: 'activated.licence',
|
|
97
|
+
description: 'Triggered when a licence is activated',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'Expired',
|
|
101
|
+
value: 'expired.licence',
|
|
102
|
+
description: 'Triggered when a licence expires',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'Issued',
|
|
106
|
+
value: 'issued.licence',
|
|
107
|
+
description: 'Triggered when a new licence is issued',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'Revoked',
|
|
111
|
+
value: 'revoked.licence',
|
|
112
|
+
description: 'Triggered when a licence is revoked',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
default: ['activated.licence'],
|
|
116
|
+
required: true,
|
|
117
|
+
description: 'The licence events to trigger on',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
displayName: 'Options',
|
|
121
|
+
name: 'options',
|
|
122
|
+
type: 'collection',
|
|
123
|
+
placeholder: 'Add Option',
|
|
124
|
+
default: {},
|
|
125
|
+
options: [
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Product IDs',
|
|
128
|
+
name: 'productIds',
|
|
129
|
+
type: 'string',
|
|
130
|
+
default: '',
|
|
131
|
+
description: 'Comma-separated list of product IDs to filter events. Leave empty for all products.',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
};
|
|
137
|
+
this.webhookMethods = {
|
|
138
|
+
default: {
|
|
139
|
+
async checkExists() {
|
|
140
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
141
|
+
return webhookData.webhookId !== undefined;
|
|
142
|
+
},
|
|
143
|
+
async create() {
|
|
144
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
145
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
146
|
+
const eventCategory = this.getNodeParameter('eventCategory');
|
|
147
|
+
const events = this.getNodeParameter('events');
|
|
148
|
+
const options = this.getNodeParameter('options');
|
|
149
|
+
const body = {
|
|
150
|
+
url: webhookUrl,
|
|
151
|
+
triggers: events,
|
|
152
|
+
event_category: eventCategory,
|
|
153
|
+
};
|
|
154
|
+
if (options.productIds) {
|
|
155
|
+
const productIds = options.productIds
|
|
156
|
+
.split(',')
|
|
157
|
+
.map((id) => id.trim())
|
|
158
|
+
.filter((id) => id);
|
|
159
|
+
if (productIds.length > 0) {
|
|
160
|
+
body.product_ids = productIds;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const response = await shared_1.chariowApiRequest.call(this, 'POST', shared_1.ENDPOINTS.CONNECTIONS_N8N, body);
|
|
164
|
+
const data = (response.data || response);
|
|
165
|
+
webhookData.webhookId = data.id;
|
|
166
|
+
return true;
|
|
167
|
+
},
|
|
168
|
+
async delete() {
|
|
169
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
170
|
+
if (webhookData.webhookId) {
|
|
171
|
+
try {
|
|
172
|
+
await shared_1.chariowApiRequest.call(this, 'DELETE', shared_1.ENDPOINTS.CONNECTION_N8N(webhookData.webhookId));
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
}
|
|
176
|
+
delete webhookData.webhookId;
|
|
177
|
+
}
|
|
178
|
+
return true;
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
async webhook() {
|
|
184
|
+
const bodyData = this.getBodyData();
|
|
185
|
+
return {
|
|
186
|
+
workflowData: [this.helpers.returnJsonArray(bodyData)],
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.ChariowTrigger = ChariowTrigger;
|
|
191
|
+
//# sourceMappingURL=ChariowTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChariowTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Chariow/ChariowTrigger.node.ts"],"names":[],"mappings":";;;AAQA,+CAAmD;AAEnD,qCAAwD;AAExD,MAAa,cAAc;IAA3B;QACC,g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AI,QAAQ,CAAgB,CAAC;oBACxD,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC;oBAChC,OAAO,IAAI,CAAC;gBACb,CAAC;gBAED,KAAK,CAAC,MAAM;oBACX,MAAM,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;oBAEvD,IAAI,WAAW,CAAC,SAAS,EAAE,CAAC;wBAC3B,IAAI,CAAC;4BACJ,MAAM,0BAAiB,CAAC,IAAI,CAC3B,IAAI,EACJ,QAAQ,EACR,kBAAS,CAAC,cAAc,CAAC,WAAW,CAAC,SAAmB,CAAC,CACzD,CAAC;wBACH,CAAC;wBAAC,MAAM,CAAC;wBAET,CAAC;wBAED,OAAO,WAAW,CAAC,SAAS,CAAC;oBAC9B,CAAC;oBAED,OAAO,IAAI,CAAC;gBACb,CAAC;aACD;SACD,CAAC;IASH,CAAC;IAPA,KAAK,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAiB,CAAC;QAEnD,OAAO;YACN,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;SACtD,CAAC;IACH,CAAC;CACD;AA/MD,wCA+MC"}
|
|
@@ -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,137 @@
|
|
|
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: 'Product ID',
|
|
9
|
+
name: 'productId',
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: true,
|
|
12
|
+
default: '',
|
|
13
|
+
displayOptions: {
|
|
14
|
+
show: {
|
|
15
|
+
resource: ['checkout'],
|
|
16
|
+
operation: ['create'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
description: 'The ID of the product to create a checkout for (e.g., prd_abc123xyz)',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Additional Fields',
|
|
23
|
+
name: 'additionalFields',
|
|
24
|
+
type: 'collection',
|
|
25
|
+
placeholder: 'Add Field',
|
|
26
|
+
default: {},
|
|
27
|
+
displayOptions: {
|
|
28
|
+
show: {
|
|
29
|
+
resource: ['checkout'],
|
|
30
|
+
operation: ['create'],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
options: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Cancel URL',
|
|
36
|
+
name: 'cancel_url',
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: '',
|
|
39
|
+
description: 'URL to redirect to if the checkout is cancelled',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Custom Fields',
|
|
43
|
+
name: 'customFields',
|
|
44
|
+
type: 'fixedCollection',
|
|
45
|
+
typeOptions: {
|
|
46
|
+
multipleValues: true,
|
|
47
|
+
},
|
|
48
|
+
default: {},
|
|
49
|
+
description: 'Custom fields to pass with the checkout',
|
|
50
|
+
options: [
|
|
51
|
+
{
|
|
52
|
+
name: 'field',
|
|
53
|
+
displayName: 'Field',
|
|
54
|
+
values: [
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Key',
|
|
57
|
+
name: 'key',
|
|
58
|
+
type: 'string',
|
|
59
|
+
default: '',
|
|
60
|
+
description: 'The key of the custom field',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Value',
|
|
64
|
+
name: 'value',
|
|
65
|
+
type: 'string',
|
|
66
|
+
default: '',
|
|
67
|
+
description: 'The value of the custom field',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
displayName: 'Customer Email',
|
|
75
|
+
name: 'customer_email',
|
|
76
|
+
type: 'string',
|
|
77
|
+
default: '',
|
|
78
|
+
description: 'Pre-fill the customer email',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Customer Name',
|
|
82
|
+
name: 'customer_name',
|
|
83
|
+
type: 'string',
|
|
84
|
+
default: '',
|
|
85
|
+
description: 'Pre-fill the customer name',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Discount Code',
|
|
89
|
+
name: 'discount_code',
|
|
90
|
+
type: 'string',
|
|
91
|
+
default: '',
|
|
92
|
+
description: 'Apply a discount code to the checkout',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Success URL',
|
|
96
|
+
name: 'success_url',
|
|
97
|
+
type: 'string',
|
|
98
|
+
default: '',
|
|
99
|
+
description: 'URL to redirect to after successful payment',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
async function execute(i) {
|
|
105
|
+
const productId = this.getNodeParameter('productId', i);
|
|
106
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
107
|
+
const body = {
|
|
108
|
+
product_id: productId,
|
|
109
|
+
};
|
|
110
|
+
if (additionalFields.customer_email) {
|
|
111
|
+
body.customer_email = additionalFields.customer_email;
|
|
112
|
+
}
|
|
113
|
+
if (additionalFields.customer_name) {
|
|
114
|
+
body.customer_name = additionalFields.customer_name;
|
|
115
|
+
}
|
|
116
|
+
if (additionalFields.discount_code) {
|
|
117
|
+
body.discount_code = additionalFields.discount_code;
|
|
118
|
+
}
|
|
119
|
+
if (additionalFields.success_url) {
|
|
120
|
+
body.success_url = additionalFields.success_url;
|
|
121
|
+
}
|
|
122
|
+
if (additionalFields.cancel_url) {
|
|
123
|
+
body.cancel_url = additionalFields.cancel_url;
|
|
124
|
+
}
|
|
125
|
+
const customFieldsData = additionalFields.customFields;
|
|
126
|
+
if (customFieldsData === null || customFieldsData === void 0 ? void 0 : customFieldsData.field) {
|
|
127
|
+
const customFields = {};
|
|
128
|
+
const fields = customFieldsData.field;
|
|
129
|
+
for (const field of fields) {
|
|
130
|
+
customFields[field.key] = field.value;
|
|
131
|
+
}
|
|
132
|
+
body.custom_fields = customFields;
|
|
133
|
+
}
|
|
134
|
+
const response = await shared_1.chariowApiRequest.call(this, 'POST', shared_1.ENDPOINTS.CHECKOUTS, body);
|
|
135
|
+
return (0, shared_1.extractData)(response);
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../nodes/Chariow/resources/checkout/create.ts"],"names":[],"mappings":";;;AAsGA,0BAqCC;AA1ID,yCAAyE;AAE5D,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,WAAW,EAAE,sEAAsE;KACnF;IACD;QACC,WAAW,EAAE,mBAAmB;QAChC,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,WAAW;QACxB,O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MAAM,GAAG,gBAAgB,CAAC,KAA8C,CAAC;QAC/E,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;QACvC,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,0BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,kBAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvF,OAAO,IAAA,oBAAW,EAAC,QAAQ,CAAgB,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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.create = exports.fields = exports.operations = void 0;
|
|
37
|
+
const create = __importStar(require("./create"));
|
|
38
|
+
exports.create = create;
|
|
39
|
+
exports.operations = [
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Operation',
|
|
42
|
+
name: 'operation',
|
|
43
|
+
type: 'options',
|
|
44
|
+
noDataExpression: true,
|
|
45
|
+
displayOptions: {
|
|
46
|
+
show: {
|
|
47
|
+
resource: ['checkout'],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
options: [
|
|
51
|
+
{
|
|
52
|
+
name: 'Create',
|
|
53
|
+
value: 'create',
|
|
54
|
+
description: 'Create a new checkout session',
|
|
55
|
+
action: 'Create a checkout',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
default: 'create',
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
exports.fields = [...create.description];
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Chariow/resources/checkout/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAmC;AA2B1B,wBAAM;AAzBF,QAAA,UAAU,GAAsB;IAC5C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;aACtB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,+BAA+B;gBAC5C,MAAM,EAAE,mBAAmB;aAC3B;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;CACD,CAAC;AAEW,QAAA,MAAM,GAAsB,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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: 'Customer ID',
|
|
9
|
+
name: 'customerId',
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: true,
|
|
12
|
+
default: '',
|
|
13
|
+
displayOptions: {
|
|
14
|
+
show: {
|
|
15
|
+
resource: ['customer'],
|
|
16
|
+
operation: ['get'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
description: 'The ID of the customer to retrieve (e.g., cus_abc123xyz)',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
async function execute(i) {
|
|
23
|
+
const customerId = this.getNodeParameter('customerId', i);
|
|
24
|
+
const response = await shared_1.chariowApiRequest.call(this, 'GET', shared_1.ENDPOINTS.CUSTOMER(customerId));
|
|
25
|
+
return (0, shared_1.extractData)(response);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../nodes/Chariow/resources/customer/get.ts"],"names":[],"mappings":";;;AAoBA,0BAIC;AAvBD,yCAAyE;AAE5D,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,KAAK,CAAC;aAClB;SACD;QACD,WAAW,EAAE,0DAA0D;KACvE;CACD,CAAC;AAEK,KAAK,UAAU,OAAO,CAA0B,CAAS;IAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAW,CAAC;IACpE,MAAM,QAAQ,GAAG,MAAM,0BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,kBAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3F,OAAO,IAAA,oBAAW,EAAC,QAAQ,CAAgB,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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: 'Return All',
|
|
9
|
+
name: 'returnAll',
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
default: false,
|
|
12
|
+
displayOptions: {
|
|
13
|
+
show: {
|
|
14
|
+
resource: ['customer'],
|
|
15
|
+
operation: ['getAll'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Limit',
|
|
22
|
+
name: 'limit',
|
|
23
|
+
type: 'number',
|
|
24
|
+
default: 50,
|
|
25
|
+
typeOptions: {
|
|
26
|
+
minValue: 1,
|
|
27
|
+
maxValue: 100,
|
|
28
|
+
},
|
|
29
|
+
displayOptions: {
|
|
30
|
+
show: {
|
|
31
|
+
resource: ['customer'],
|
|
32
|
+
operation: ['getAll'],
|
|
33
|
+
returnAll: [false],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
description: 'Max number of results to return',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
displayName: 'Filters',
|
|
40
|
+
name: 'filters',
|
|
41
|
+
type: 'collection',
|
|
42
|
+
placeholder: 'Add Filter',
|
|
43
|
+
default: {},
|
|
44
|
+
displayOptions: {
|
|
45
|
+
show: {
|
|
46
|
+
resource: ['customer'],
|
|
47
|
+
operation: ['getAll'],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
options: [
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Email',
|
|
53
|
+
name: 'email',
|
|
54
|
+
type: 'string',
|
|
55
|
+
placeholder: 'name@email.com',
|
|
56
|
+
default: '',
|
|
57
|
+
description: 'Filter by email address',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'Search',
|
|
61
|
+
name: 'search',
|
|
62
|
+
type: 'string',
|
|
63
|
+
default: '',
|
|
64
|
+
description: 'Search customers by name or email',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
async function execute(i) {
|
|
70
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
71
|
+
const filters = this.getNodeParameter('filters', i);
|
|
72
|
+
const limit = this.getNodeParameter('limit', i, 50);
|
|
73
|
+
const query = (0, shared_1.buildListQuery)(limit, returnAll, filters);
|
|
74
|
+
if (returnAll) {
|
|
75
|
+
return shared_1.chariowApiRequestAllItems.call(this, 'GET', shared_1.ENDPOINTS.CUSTOMERS, {}, query);
|
|
76
|
+
}
|
|
77
|
+
const response = await shared_1.chariowApiRequest.call(this, 'GET', shared_1.ENDPOINTS.CUSTOMERS, {}, query);
|
|
78
|
+
return (0, shared_1.extractData)(response);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=getAll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAll.js","sourceRoot":"","sources":["../../../../../nodes/Chariow/resources/customer/getAll.ts"],"names":[],"mappings":";;;AAyEA,0BAaC;AArFD,yCAMsB;AAET,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,WAAW,EAAE,2DAA2D;KACxE;IACD;QACC,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE;YACZ,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,GAAG;SACb;QACD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,SAAS,EAAE,CAAC,KAAK,CAAC;aAClB;SACD;QACD,WAAW,EAAE,iCAAiC;KAC9C;IACD;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gBAAgB;gBAC7B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,yBAAyB;aACtC;YACD;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,mCAAmC;aAChD;SACD;KACD;CACD,CAAC;AAEK,KAAK,UAAU,OAAO,CAA0B,CAAS;IAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAY,CAAC;IACnE,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAgB,CAAC;IACnE,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;IAE9D,MAAM,KAAK,GAAG,IAAA,uBAAc,EAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAExD,IAAI,SAAS,EAAE,CAAC;QACf,OAAO,kCAAyB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,kBAAS,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACpF,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,0BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,kBAAS,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC3F,OAAO,IAAA,oBAAW,EAAC,QAAQ,CAAkB,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.getAll = exports.get = exports.fields = exports.operations = void 0;
|
|
37
|
+
const get = __importStar(require("./get"));
|
|
38
|
+
exports.get = get;
|
|
39
|
+
const getAll = __importStar(require("./getAll"));
|
|
40
|
+
exports.getAll = getAll;
|
|
41
|
+
exports.operations = [
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Operation',
|
|
44
|
+
name: 'operation',
|
|
45
|
+
type: 'options',
|
|
46
|
+
noDataExpression: true,
|
|
47
|
+
displayOptions: {
|
|
48
|
+
show: {
|
|
49
|
+
resource: ['customer'],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
options: [
|
|
53
|
+
{
|
|
54
|
+
name: 'Get',
|
|
55
|
+
value: 'get',
|
|
56
|
+
description: 'Get a customer by ID',
|
|
57
|
+
action: 'Get a customer',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Get Many',
|
|
61
|
+
value: 'getAll',
|
|
62
|
+
description: 'Get many customers',
|
|
63
|
+
action: 'Get many customers',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
default: 'get',
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
exports.fields = [...get.description, ...getAll.description];
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Chariow/resources/customer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAkCpB,kBAAG;AAjCZ,iDAAmC;AAiCrB,wBAAM;AA/BP,QAAA,UAAU,GAAsB;IAC5C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;aACtB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,sBAAsB;gBACnC,MAAM,EAAE,gBAAgB;aACxB;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,oBAAoB;gBACjC,MAAM,EAAE,oBAAoB;aAC5B;SACD;QACD,OAAO,EAAE,KAAK;KACd;CACD,CAAC;AAEW,QAAA,MAAM,GAAsB,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC"}
|