n8n-nodes-didar-crm 0.0.20 → 0.0.21
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 +38 -12
- package/dist/nodes/DidarCrm.node.js +12 -0
- package/dist/nodes/deal/_shared.fields.js +8 -0
- package/dist/nodes/deal/create.operation.js +44 -1
- package/dist/nodes/deal/update.operation.js +41 -1
- package/dist/nodes/supplementary/didaryab-search.operation.d.ts +2 -0
- package/dist/nodes/supplementary/didaryab-search.operation.js +27 -0
- package/dist/nodes/supplementary/didaryab-search.properties.d.ts +2 -0
- package/dist/nodes/supplementary/didaryab-search.properties.js +32 -0
- package/dist/nodes/supplementary/get-base-info.properties.js +1 -1
- package/dist/nodes/supplementary/index.d.ts +4 -0
- package/dist/nodes/supplementary/index.js +10 -1
- package/dist/nodes/supplementary/popup-callerid.operation.d.ts +2 -0
- package/dist/nodes/supplementary/popup-callerid.operation.js +40 -0
- package/dist/nodes/supplementary/popup-callerid.properties.d.ts +2 -0
- package/dist/nodes/supplementary/popup-callerid.properties.js +34 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,20 +14,24 @@ This package provides actions and triggers to automate workflows with your Didar
|
|
|
14
14
|
- Create a deal
|
|
15
15
|
- Update a deal (by Id)
|
|
16
16
|
- Get deal details (by Id)
|
|
17
|
+
- Search deals (flexible filters, pipeline & stage, labels, custom fields, etc.)
|
|
17
18
|
|
|
18
19
|
### Person (Contact)
|
|
19
20
|
- Create a person
|
|
20
21
|
- Update a person (by Id)
|
|
21
22
|
- Get person details (by Id)
|
|
23
|
+
- Search persons (keywords, owner, custom fields, filters)
|
|
22
24
|
|
|
23
25
|
### Company
|
|
24
26
|
- Create a company
|
|
25
27
|
- Update a company (by Id)
|
|
26
28
|
- Get company details (by Id)
|
|
29
|
+
- Search companies (keywords, owner, custom fields, filters)
|
|
27
30
|
|
|
28
31
|
### Activity
|
|
29
32
|
- Create an activity
|
|
30
33
|
- Update an activity (by Id)
|
|
34
|
+
- Search activities (type, owner, creator, contactIds, tags, dealId, caseId, etc.)
|
|
31
35
|
|
|
32
36
|
### Note
|
|
33
37
|
- Create a note
|
|
@@ -36,11 +40,18 @@ This package provides actions and triggers to automate workflows with your Didar
|
|
|
36
40
|
### Case (Card)
|
|
37
41
|
- Create a case
|
|
38
42
|
- Update a case (by Id)
|
|
43
|
+
- Search cases (keywords, owner, contactIds, custom fields)
|
|
39
44
|
|
|
40
45
|
### Product
|
|
41
|
-
- Create a product
|
|
42
|
-
- Update a product (
|
|
46
|
+
- Create a product (with variants & custom fields)
|
|
47
|
+
- Update a product (with variants & custom fields)
|
|
43
48
|
- Get products by list of codes
|
|
49
|
+
- Search products (keywords)
|
|
50
|
+
|
|
51
|
+
### Complementary Actions
|
|
52
|
+
- **Get Base Information**: retrieve Pipelines, Activity Types, Custom Fields, Product Categories
|
|
53
|
+
- **Didaryab Searching**: global search across contacts, companies, deals, cases, attachments
|
|
54
|
+
- **Popup Caller ID**: insert call log by phone number & internal number
|
|
44
55
|
|
|
45
56
|
---
|
|
46
57
|
|
|
@@ -48,13 +59,15 @@ This package provides actions and triggers to automate workflows with your Didar
|
|
|
48
59
|
|
|
49
60
|
- Dropdown selectors for Pipelines, Owners (Users), Activity Types, Product Categories, etc.
|
|
50
61
|
- Manual ID input option for each dropdown field
|
|
62
|
+
- Multi-select and manual list parsing for IDs (supports JSON arrays, comma/newline separated, and n8n array variables)
|
|
51
63
|
- Additional fields for advanced properties:
|
|
52
64
|
- Visibility Type
|
|
53
65
|
- Custom Fields (JSON)
|
|
66
|
+
- Deal Items (list of product entries)
|
|
54
67
|
- Multi-value lists (phones, emails, websites, addresses, bank accounts, labels, users)
|
|
55
68
|
- Correct handling of defaults (zero GUIDs, booleans, etc.)
|
|
56
69
|
- Webhook trigger enforces **POST** requests only
|
|
57
|
-
- Consistent **Owner selection mechanism** (select from list or manual ID) across all resources
|
|
70
|
+
- Consistent **Owner/Creator selection mechanism** (select from list or manual ID) across all resources
|
|
58
71
|
|
|
59
72
|
---
|
|
60
73
|
|
|
@@ -89,36 +102,47 @@ Add the **Didar CRM Trigger** node to your workflow.
|
|
|
89
102
|
### 2. Resource operations
|
|
90
103
|
|
|
91
104
|
#### Deal
|
|
92
|
-
- **Create** → required
|
|
105
|
+
- **Create** → required: `Title`, `OwnerId`, `PipelineId`, `PipelineStageId`
|
|
93
106
|
- **Update** → same as create + `Id`
|
|
94
107
|
- **Get** → requires `Id`
|
|
108
|
+
- **Search** → optional filters (keywords, status, pipeline, owner, labels, probability, custom fields, etc.)
|
|
95
109
|
|
|
96
110
|
#### Person (Contact)
|
|
97
|
-
- **Create** → required
|
|
111
|
+
- **Create** → required: `LastName`, `OwnerId`
|
|
98
112
|
- **Update** → same as create + `Id`
|
|
99
113
|
- **Get** → requires `Id`
|
|
114
|
+
- **Search** → optional filters (keywords, owner, custom fields, etc.)
|
|
100
115
|
|
|
101
116
|
#### Company
|
|
102
|
-
- **Create** → required
|
|
117
|
+
- **Create** → required: `Name`, `OwnerId`
|
|
103
118
|
- **Update** → same as create + `Id`
|
|
104
119
|
- **Get** → requires `Id`
|
|
120
|
+
- **Search** → optional filters (keywords, owner, custom fields, etc.)
|
|
105
121
|
|
|
106
122
|
#### Activity
|
|
107
|
-
- **Create Activity** → required
|
|
123
|
+
- **Create Activity** → required: `Title`, `OwnerId`, `ActivityTypeId`
|
|
108
124
|
- **Update Activity** → same as create + `Id`
|
|
125
|
+
- **Search** → optional filters (activity types, owner, creator, tags, contacts, deals, cases, done/deleted flags)
|
|
109
126
|
|
|
110
127
|
#### Note
|
|
111
|
-
- **Create Note** → required
|
|
128
|
+
- **Create Note** → required: `ResultNote`, `OwnerId`
|
|
112
129
|
- **Update Note** → same as create + `Id`
|
|
113
130
|
|
|
114
131
|
#### Case (Card)
|
|
115
|
-
- **Create Case** → required
|
|
132
|
+
- **Create Case** → required: `Title`, `OwnerId`, `PipelineStageId`, `Status`
|
|
116
133
|
- **Update Case** → same as create + `Id`
|
|
134
|
+
- **Search** → optional filters (keywords, owner, contactIds, custom fields)
|
|
117
135
|
|
|
118
136
|
#### Product
|
|
119
|
-
- **Create Product** → required
|
|
137
|
+
- **Create Product** → required: `Title`, optional: `Variants`, `Fields`
|
|
120
138
|
- **Update Product** → same as create + `Id`
|
|
121
|
-
- **Get Products by Codes** → required
|
|
139
|
+
- **Get Products by Codes** → required: `Code[]`
|
|
140
|
+
- **Search Products** → optional: `Keywords`
|
|
141
|
+
|
|
142
|
+
#### Complementary
|
|
143
|
+
- **Get Base Information** → pipelines, activity types, custom fields, product categories
|
|
144
|
+
- **Didaryab Searching** → global search with `Keyword` + multiple `Types`
|
|
145
|
+
- **Popup Caller ID** → log calls by phone number & internal extension, requires `CallerId's APIKey`
|
|
122
146
|
|
|
123
147
|
---
|
|
124
148
|
|
|
@@ -128,6 +152,7 @@ A new credential type **Didar API** is provided.
|
|
|
128
152
|
|
|
129
153
|
- Set your **API Key** and (if required) authentication cookies.
|
|
130
154
|
- Shared across all nodes.
|
|
155
|
+
- Note: **Popup Caller ID** uses a separate fixed API Key provided by Didar.
|
|
131
156
|
|
|
132
157
|
---
|
|
133
158
|
|
|
@@ -147,7 +172,8 @@ n8n-nodes-didar-crm/
|
|
|
147
172
|
│ ├── activity/ # Activity operations
|
|
148
173
|
│ ├── note/ # Note operations
|
|
149
174
|
│ ├── case/ # Case operations
|
|
150
|
-
│
|
|
175
|
+
│ ├── product/ # Product operations
|
|
176
|
+
│ └── extras/ # Complementary actions (base info, didaryab, popup caller ID)
|
|
151
177
|
│── lib/
|
|
152
178
|
│ ├── http.ts # Request helper
|
|
153
179
|
│ └── loadOptions.ts # Dropdown population
|
|
@@ -195,6 +195,8 @@ class DidarCrm {
|
|
|
195
195
|
},
|
|
196
196
|
options: [
|
|
197
197
|
{ name: 'Get Base Info', value: 'getBaseInfo', action: 'Fetch base information' },
|
|
198
|
+
{ name: 'Didaryab Searching', value: 'didaryabSearch', action: 'Didaryab Searching' }, // NEW
|
|
199
|
+
{ name: 'Popup Caller ID', value: 'popupCallerId', action: 'Trigger caller ID popup' }, // NEW
|
|
198
200
|
],
|
|
199
201
|
default: 'getBaseInfo',
|
|
200
202
|
},
|
|
@@ -231,6 +233,8 @@ class DidarCrm {
|
|
|
231
233
|
...product_1.productSearchProperties,
|
|
232
234
|
// somewhere after Operation property
|
|
233
235
|
...supplementary_1.getBaseInfoProperties,
|
|
236
|
+
...supplementary_1.didaryabSearchProperties,
|
|
237
|
+
...supplementary_1.popupCallerIdProperties,
|
|
234
238
|
],
|
|
235
239
|
};
|
|
236
240
|
}
|
|
@@ -355,6 +359,14 @@ class DidarCrm {
|
|
|
355
359
|
await supplementary_1.getBaseInfo.call(this, i, returnData);
|
|
356
360
|
continue;
|
|
357
361
|
}
|
|
362
|
+
if (operation === 'didaryabSearch') {
|
|
363
|
+
await supplementary_1.didaryabSearch.call(this, i, returnData);
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
if (operation === 'popupCallerId') {
|
|
367
|
+
await supplementary_1.popupCallerId.call(this, i, returnData);
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
358
370
|
}
|
|
359
371
|
}
|
|
360
372
|
return [returnData];
|
|
@@ -186,6 +186,14 @@ const additionalFields = (op) => ({
|
|
|
186
186
|
description: 'Visibility setting.',
|
|
187
187
|
},
|
|
188
188
|
{ displayName: 'Custom Fields (JSON)', name: 'Fields', type: 'json', default: '', placeholder: '{ "Field_8783_12_4": 12 }', description: 'JSON object of custom fields.' },
|
|
189
|
+
{
|
|
190
|
+
displayName: 'Deal Items (JSON)',
|
|
191
|
+
name: 'DealItems',
|
|
192
|
+
type: 'string',
|
|
193
|
+
default: '',
|
|
194
|
+
placeholder: `[{"ProductId":"...","Quantity":"1","UnitPrice":"1000","Price":"1000","Discount":"0","Description":"...","VariantId":"..."}]`,
|
|
195
|
+
description: 'JSON array of deal items, or an expression that resolves to an array. Also accepts strings like [Array: [...]].',
|
|
196
|
+
},
|
|
189
197
|
],
|
|
190
198
|
});
|
|
191
199
|
exports.additionalFields = additionalFields;
|
|
@@ -2,6 +2,43 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dealCreate = dealCreate;
|
|
4
4
|
const http_1 = require("../../lib/http");
|
|
5
|
+
const parseJsonArrayFlexible = (val, fieldLabel = 'DealItems') => {
|
|
6
|
+
if (val == null || val === '')
|
|
7
|
+
return [];
|
|
8
|
+
if (Array.isArray(val))
|
|
9
|
+
return val;
|
|
10
|
+
if (typeof val === 'string') {
|
|
11
|
+
const s = val.trim();
|
|
12
|
+
if (!s)
|
|
13
|
+
return [];
|
|
14
|
+
// پشتیبانی از برچسب n8n: [Array: [...]]
|
|
15
|
+
const m = s.match(/^\s*\[Array:\s*(\[[\s\S]*\])\s*\]\s*$/i);
|
|
16
|
+
if (m) {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(m[1]);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
throw new Error(`Invalid JSON in ${fieldLabel}.`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// تلاش برای JSON.parse عادی (آرایه یا آبجکت)
|
|
25
|
+
try {
|
|
26
|
+
const parsed = JSON.parse(s);
|
|
27
|
+
if (Array.isArray(parsed))
|
|
28
|
+
return parsed;
|
|
29
|
+
if (parsed && typeof parsed === 'object')
|
|
30
|
+
return [parsed];
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
throw new Error(`Invalid JSON in ${fieldLabel}.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// اگر آبجکت تکی بود، تبدیل به آرایه
|
|
38
|
+
if (typeof val === 'object')
|
|
39
|
+
return [val];
|
|
40
|
+
return [];
|
|
41
|
+
};
|
|
5
42
|
async function dealCreate(i, returnData) {
|
|
6
43
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
7
44
|
// --- Required composed: Owner / Pipeline / Stage ---
|
|
@@ -47,6 +84,8 @@ async function dealCreate(i, returnData) {
|
|
|
47
84
|
const creatorId = (_g = add.CreatorId) !== null && _g !== void 0 ? _g : ownerId;
|
|
48
85
|
const price = (_h = add.Price) !== null && _h !== void 0 ? _h : '0';
|
|
49
86
|
const visibilityType = (_j = add.VisibilityType) !== null && _j !== void 0 ? _j : '1';
|
|
87
|
+
const dealItemsRaw = add.DealItems;
|
|
88
|
+
const dealItemsArr = parseJsonArrayFlexible(dealItemsRaw, 'DealItems');
|
|
50
89
|
// Custom fields
|
|
51
90
|
let fields;
|
|
52
91
|
if (typeof add.Fields === 'string' && add.Fields.trim()) {
|
|
@@ -80,10 +119,14 @@ async function dealCreate(i, returnData) {
|
|
|
80
119
|
};
|
|
81
120
|
if (fields)
|
|
82
121
|
bodyDeal['Fields'] = fields;
|
|
122
|
+
const body = { Deal: bodyDeal };
|
|
123
|
+
if (dealItemsArr.length) {
|
|
124
|
+
body['DealItems'] = dealItemsArr;
|
|
125
|
+
}
|
|
83
126
|
const resp = await (0, http_1.didarRequest)(this, i, {
|
|
84
127
|
method: 'POST',
|
|
85
128
|
path: '/api/deal/save',
|
|
86
|
-
body
|
|
129
|
+
body,
|
|
87
130
|
});
|
|
88
131
|
returnData.push({ json: resp });
|
|
89
132
|
}
|
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dealUpdate = dealUpdate;
|
|
4
4
|
const http_1 = require("../../lib/http");
|
|
5
|
+
const parseJsonArrayFlexible = (val, fieldLabel = 'DealItems') => {
|
|
6
|
+
if (val == null || val === '')
|
|
7
|
+
return [];
|
|
8
|
+
if (Array.isArray(val))
|
|
9
|
+
return val;
|
|
10
|
+
if (typeof val === 'string') {
|
|
11
|
+
const s = val.trim();
|
|
12
|
+
if (!s)
|
|
13
|
+
return [];
|
|
14
|
+
const m = s.match(/^\s*\[Array:\s*(\[[\s\S]*\])\s*\]\s*$/i);
|
|
15
|
+
if (m) {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(m[1]);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
throw new Error(`Invalid JSON in ${fieldLabel}.`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const parsed = JSON.parse(s);
|
|
25
|
+
if (Array.isArray(parsed))
|
|
26
|
+
return parsed;
|
|
27
|
+
if (parsed && typeof parsed === 'object')
|
|
28
|
+
return [parsed];
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
throw new Error(`Invalid JSON in ${fieldLabel}.`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (typeof val === 'object')
|
|
36
|
+
return [val];
|
|
37
|
+
return [];
|
|
38
|
+
};
|
|
5
39
|
async function dealUpdate(i, returnData) {
|
|
6
40
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
7
41
|
// ---- Required Id ----
|
|
@@ -56,6 +90,8 @@ async function dealUpdate(i, returnData) {
|
|
|
56
90
|
const creatorId = (_g = add.CreatorId) !== null && _g !== void 0 ? _g : ownerId; // همرفتار با create
|
|
57
91
|
const price = (_h = add.Price) !== null && _h !== void 0 ? _h : '0';
|
|
58
92
|
const visibilityType = (_j = add.VisibilityType) !== null && _j !== void 0 ? _j : 'Owner'; // دراپداون متنی
|
|
93
|
+
const dealItemsRaw = add.DealItems;
|
|
94
|
+
const dealItemsArr = parseJsonArrayFlexible(dealItemsRaw, 'DealItems');
|
|
59
95
|
// Custom fields
|
|
60
96
|
let fields;
|
|
61
97
|
if (typeof add.Fields === 'string' && add.Fields.trim()) {
|
|
@@ -91,11 +127,15 @@ async function dealUpdate(i, returnData) {
|
|
|
91
127
|
};
|
|
92
128
|
if (fields)
|
|
93
129
|
bodyDeal['Fields'] = fields;
|
|
130
|
+
const body = { Deal: bodyDeal };
|
|
131
|
+
if (dealItemsArr.length) {
|
|
132
|
+
body['DealItems'] = dealItemsArr;
|
|
133
|
+
}
|
|
94
134
|
// ---- Request ----
|
|
95
135
|
const resp = await (0, http_1.didarRequest)(this, i, {
|
|
96
136
|
method: 'POST',
|
|
97
137
|
path: '/api/deal/save',
|
|
98
|
-
body
|
|
138
|
+
body,
|
|
99
139
|
});
|
|
100
140
|
returnData.push({ json: resp });
|
|
101
141
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.didaryabSearch = didaryabSearch;
|
|
4
|
+
const http_1 = require("../../lib/http");
|
|
5
|
+
async function didaryabSearch(i, returnData) {
|
|
6
|
+
var _a;
|
|
7
|
+
const keyword = this.getNodeParameter('Keyword', i, '').trim();
|
|
8
|
+
const types = this.getNodeParameter('Types', i, []);
|
|
9
|
+
// normalize types to string[]
|
|
10
|
+
const typesArr = Array.isArray(types) ? types : (types ? [types] : []);
|
|
11
|
+
if (!keyword)
|
|
12
|
+
throw new Error('Keyword is required.');
|
|
13
|
+
if (!typesArr.length)
|
|
14
|
+
throw new Error('At least one type must be selected.');
|
|
15
|
+
const body = {
|
|
16
|
+
Keyword: keyword,
|
|
17
|
+
Types: typesArr,
|
|
18
|
+
};
|
|
19
|
+
const resp = await (0, http_1.didarRequest)(this, i, {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
path: '/api/search/search',
|
|
22
|
+
body,
|
|
23
|
+
});
|
|
24
|
+
const out = ((_a = resp === null || resp === void 0 ? void 0 : resp.Response) !== null && _a !== void 0 ? _a : resp);
|
|
25
|
+
returnData.push({ json: { search_response: out, criteria: body } });
|
|
26
|
+
return returnData;
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.didaryabSearchProperties = void 0;
|
|
4
|
+
const showForDidaryab = { show: { resource: ['supplementary'], operation: ['didaryabSearch'] } };
|
|
5
|
+
exports.didaryabSearchProperties = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Keyword',
|
|
8
|
+
name: 'Keyword',
|
|
9
|
+
type: 'string',
|
|
10
|
+
default: '',
|
|
11
|
+
required: true,
|
|
12
|
+
displayOptions: showForDidaryab,
|
|
13
|
+
description: 'Search term.',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Types',
|
|
17
|
+
name: 'Types',
|
|
18
|
+
type: 'multiOptions',
|
|
19
|
+
options: [
|
|
20
|
+
{ name: 'Contact', value: 'contact' },
|
|
21
|
+
{ name: 'Company', value: 'company' },
|
|
22
|
+
{ name: 'Deal', value: 'deal' },
|
|
23
|
+
{ name: 'Case', value: 'case' },
|
|
24
|
+
{ name: 'Attachment', value: 'attachment' },
|
|
25
|
+
],
|
|
26
|
+
// default: all checked
|
|
27
|
+
default: ['contact', 'company', 'deal', 'case', 'attachment'],
|
|
28
|
+
required: true,
|
|
29
|
+
displayOptions: showForDidaryab,
|
|
30
|
+
description: 'Select one or more entity types to search.',
|
|
31
|
+
},
|
|
32
|
+
];
|
|
@@ -10,7 +10,7 @@ exports.getBaseInfoProperties = [
|
|
|
10
10
|
options: [
|
|
11
11
|
{ name: 'Pipelines', value: 'pipelines' },
|
|
12
12
|
{ name: 'Activity Types', value: 'activityTypes' },
|
|
13
|
-
{ name: 'Custom Fields', value: 'customFields' },
|
|
13
|
+
{ name: 'Custom Fields List', value: 'customFields' },
|
|
14
14
|
{ name: 'Product Categories', value: 'productCategories' },
|
|
15
15
|
],
|
|
16
16
|
default: 'pipelines',
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { getBaseInfo } from './get-base-info.operation';
|
|
2
2
|
export { getBaseInfoProperties } from './get-base-info.properties';
|
|
3
|
+
export { didaryabSearch } from './didaryab-search.operation';
|
|
4
|
+
export { didaryabSearchProperties } from './didaryab-search.properties';
|
|
5
|
+
export { popupCallerId } from './popup-callerid.operation';
|
|
6
|
+
export { popupCallerIdProperties } from './popup-callerid.properties';
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBaseInfoProperties = exports.getBaseInfo = void 0;
|
|
3
|
+
exports.popupCallerIdProperties = exports.popupCallerId = exports.didaryabSearchProperties = exports.didaryabSearch = exports.getBaseInfoProperties = exports.getBaseInfo = void 0;
|
|
4
|
+
// nodes/supplementary/index.ts
|
|
4
5
|
var get_base_info_operation_1 = require("./get-base-info.operation");
|
|
5
6
|
Object.defineProperty(exports, "getBaseInfo", { enumerable: true, get: function () { return get_base_info_operation_1.getBaseInfo; } });
|
|
6
7
|
var get_base_info_properties_1 = require("./get-base-info.properties");
|
|
7
8
|
Object.defineProperty(exports, "getBaseInfoProperties", { enumerable: true, get: function () { return get_base_info_properties_1.getBaseInfoProperties; } });
|
|
9
|
+
var didaryab_search_operation_1 = require("./didaryab-search.operation");
|
|
10
|
+
Object.defineProperty(exports, "didaryabSearch", { enumerable: true, get: function () { return didaryab_search_operation_1.didaryabSearch; } });
|
|
11
|
+
var didaryab_search_properties_1 = require("./didaryab-search.properties");
|
|
12
|
+
Object.defineProperty(exports, "didaryabSearchProperties", { enumerable: true, get: function () { return didaryab_search_properties_1.didaryabSearchProperties; } });
|
|
13
|
+
var popup_callerid_operation_1 = require("./popup-callerid.operation");
|
|
14
|
+
Object.defineProperty(exports, "popupCallerId", { enumerable: true, get: function () { return popup_callerid_operation_1.popupCallerId; } });
|
|
15
|
+
var popup_callerid_properties_1 = require("./popup-callerid.properties");
|
|
16
|
+
Object.defineProperty(exports, "popupCallerIdProperties", { enumerable: true, get: function () { return popup_callerid_properties_1.popupCallerIdProperties; } });
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.popupCallerId = popupCallerId;
|
|
4
|
+
async function popupCallerId(i, returnData) {
|
|
5
|
+
var _a;
|
|
6
|
+
const callerIdApiKey = this.getNodeParameter('callerIdApiKey', i, '');
|
|
7
|
+
const number = this.getNodeParameter('number', i, '');
|
|
8
|
+
const internal = this.getNodeParameter('internalnumber', i, '');
|
|
9
|
+
if (!callerIdApiKey)
|
|
10
|
+
throw new Error("CallerId's APIKey is required.");
|
|
11
|
+
if (!number)
|
|
12
|
+
throw new Error('Phone Number is required.');
|
|
13
|
+
if (!internal)
|
|
14
|
+
throw new Error('User Extension is required.');
|
|
15
|
+
// Use baseUrl & optional cookie from credentials, but DO NOT use the main apiKey.
|
|
16
|
+
const creds = await this.getCredentials('didarApi');
|
|
17
|
+
const baseUrl = creds.baseUrl;
|
|
18
|
+
const useCookie = creds.useCookie;
|
|
19
|
+
const cookie = creds.cookie;
|
|
20
|
+
const urlBase = (baseUrl || '').replace(/\/+$/, '');
|
|
21
|
+
const url = `${urlBase}/api/calllog/insert`
|
|
22
|
+
+ `?apikey=${encodeURIComponent(callerIdApiKey)}`
|
|
23
|
+
+ `&number=${encodeURIComponent(number)}`
|
|
24
|
+
+ `&internalnumber=${encodeURIComponent(internal)}`;
|
|
25
|
+
const options = {
|
|
26
|
+
method: 'GET',
|
|
27
|
+
url,
|
|
28
|
+
json: true,
|
|
29
|
+
headers: { 'Content-Type': 'application/json' },
|
|
30
|
+
};
|
|
31
|
+
if (useCookie && cookie)
|
|
32
|
+
options.headers.Cookie = cookie;
|
|
33
|
+
const resp = await this.helpers.httpRequest(options);
|
|
34
|
+
const out = ((_a = resp === null || resp === void 0 ? void 0 : resp.Response) !== null && _a !== void 0 ? _a : resp);
|
|
35
|
+
returnData.push({
|
|
36
|
+
// json: { popup_callerid_response: out, query: { apikey: callerIdApiKey, number, internalnumber: internal } },
|
|
37
|
+
json: out,
|
|
38
|
+
});
|
|
39
|
+
return returnData;
|
|
40
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.popupCallerIdProperties = void 0;
|
|
4
|
+
const showForPopupCallerId = { show: { resource: ['supplementary'], operation: ['popupCallerId'] } };
|
|
5
|
+
exports.popupCallerIdProperties = [
|
|
6
|
+
// NEW: dedicated key for Caller ID endpoint
|
|
7
|
+
{
|
|
8
|
+
displayName: "CallerId's APIKey",
|
|
9
|
+
name: 'callerIdApiKey',
|
|
10
|
+
type: 'string',
|
|
11
|
+
default: '',
|
|
12
|
+
required: true,
|
|
13
|
+
displayOptions: showForPopupCallerId,
|
|
14
|
+
description: 'Dedicated API key for the Caller ID popup endpoint (NOT the main Didar API key).',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
displayName: 'Phone Number',
|
|
18
|
+
name: 'number',
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: '',
|
|
21
|
+
required: true,
|
|
22
|
+
displayOptions: showForPopupCallerId,
|
|
23
|
+
description: 'Caller phone number to look up.',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
displayName: 'User Extension',
|
|
27
|
+
name: 'internalnumber',
|
|
28
|
+
type: 'string',
|
|
29
|
+
default: '',
|
|
30
|
+
required: true,
|
|
31
|
+
displayOptions: showForPopupCallerId,
|
|
32
|
+
description: 'Internal extension number of the user receiving the call.',
|
|
33
|
+
},
|
|
34
|
+
];
|