n8n-nodes-didar-crm 0.0.7 → 0.0.9
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 +2 -2
- package/README.md +116 -23
- package/dist/nodes/DidarCrm.node.js +46 -0
- package/dist/nodes/company/create.operation.d.ts +2 -0
- package/dist/nodes/company/create.operation.js +121 -0
- package/dist/nodes/company/create.properties.d.ts +2 -0
- package/dist/nodes/company/create.properties.js +210 -0
- package/dist/nodes/company/get.operation.d.ts +2 -0
- package/dist/nodes/company/get.operation.js +15 -0
- package/dist/nodes/company/get.properties.d.ts +2 -0
- package/dist/nodes/company/get.properties.js +14 -0
- package/dist/nodes/company/index.d.ts +6 -0
- package/dist/nodes/company/index.js +15 -0
- package/dist/nodes/company/update.operation.d.ts +2 -0
- package/dist/nodes/company/update.operation.js +123 -0
- package/dist/nodes/company/update.properties.d.ts +2 -0
- package/dist/nodes/company/update.properties.js +180 -0
- package/dist/nodes/person/get.operation.d.ts +2 -0
- package/dist/nodes/person/get.operation.js +15 -0
- package/dist/nodes/person/get.properties.d.ts +2 -0
- package/dist/nodes/person/get.properties.js +14 -0
- package/dist/nodes/person/index.d.ts +4 -0
- package/dist/nodes/person/index.js +9 -2
- package/dist/nodes/person/update.operation.d.ts +2 -0
- package/dist/nodes/person/update.operation.js +130 -0
- package/dist/nodes/person/update.properties.d.ts +2 -0
- package/dist/nodes/person/update.properties.js +191 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 Ali Mozayyani
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,45 +1,138 @@
|
|
|
1
1
|
# n8n-nodes-didar-crm
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Custom **n8n nodes** for integrating with **Didar CRM**.
|
|
4
|
+
This package provides actions and triggers to automate workflows with your Didar CRM account.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
* **Trigger**
|
|
11
|
+
|
|
12
|
+
* Receive webhook events from Didar CRM (entity changes, updates, deletions, etc.)
|
|
13
|
+
|
|
14
|
+
* **Deal**
|
|
15
|
+
|
|
16
|
+
* Create a deal
|
|
17
|
+
* Update a deal (by Id)
|
|
18
|
+
* Get deal details (by Id)
|
|
19
|
+
|
|
20
|
+
* **Person (Contact)**
|
|
21
|
+
|
|
22
|
+
* Create a person
|
|
23
|
+
* Update a person (by Id)
|
|
24
|
+
* Get person details (by Id)
|
|
25
|
+
|
|
26
|
+
* **Common**
|
|
27
|
+
|
|
28
|
+
* Dropdown selectors for Pipelines, Pipeline Stages, Owners (Users)
|
|
29
|
+
* Manual ID input option for each dropdown field
|
|
30
|
+
* Support for additional fields like Source, Lost Reason, Visibility Type, Custom Fields, etc.
|
|
31
|
+
* Proper handling of default values (zero-guid where needed)
|
|
32
|
+
* Webhook trigger enforces POST requests
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 📦 Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install n8n-nodes-didar-crm
|
|
40
|
+
```
|
|
10
41
|
|
|
11
|
-
|
|
42
|
+
Then, place the module inside your n8n custom directory (usually `~/.n8n/custom/`) and restart n8n.
|
|
12
43
|
|
|
13
44
|
---
|
|
14
45
|
|
|
15
|
-
##
|
|
46
|
+
## ⚡ Usage
|
|
47
|
+
|
|
48
|
+
### 1. Trigger node
|
|
49
|
+
|
|
50
|
+
Add the **Didar CRM Trigger** node to your workflow.
|
|
51
|
+
|
|
52
|
+
* It exposes a webhook URL in n8n.
|
|
53
|
+
* Only **POST** requests are accepted.
|
|
54
|
+
* Returns payload structured into:
|
|
16
55
|
|
|
17
|
-
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"data": { ... },
|
|
59
|
+
"changes": [ ... ],
|
|
60
|
+
"meta": { ... },
|
|
61
|
+
"raw": { ... },
|
|
62
|
+
"receivedAt": "timestamp"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
18
65
|
|
|
19
|
-
|
|
66
|
+
### 2. Deal operations
|
|
20
67
|
|
|
21
|
-
|
|
68
|
+
* **Create Deal** → required fields: `Title`, `OwnerId`, `PipelineId`, `PipelineStageId`, `PersonId`, `CompanyId`, `Status`
|
|
69
|
+
* **Update Deal** → same as Create, plus required `Id`
|
|
70
|
+
* **Get Deal** → requires `Id`
|
|
22
71
|
|
|
72
|
+
### 3. Person (Contact) operations
|
|
73
|
+
|
|
74
|
+
* **Create Person** → required fields: `LastName`, `OwnerId`
|
|
75
|
+
* **Update Person** → same as Create, plus required `Id`
|
|
76
|
+
* **Get Person** → requires `Id`
|
|
23
77
|
|
|
24
78
|
---
|
|
25
79
|
|
|
26
|
-
## 🔑
|
|
80
|
+
## 🔑 Credentials
|
|
81
|
+
|
|
82
|
+
A new credential type **Didar API** is provided.
|
|
83
|
+
|
|
84
|
+
* You must set your **API Key** and (if required) authentication cookies.
|
|
85
|
+
* Used across all operations.
|
|
27
86
|
|
|
28
|
-
|
|
29
|
-
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 📂 Project structure
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
n8n-nodes-didar-crm/
|
|
93
|
+
│── package.json
|
|
94
|
+
│── README.md
|
|
95
|
+
│── LICENSE
|
|
96
|
+
│── nodes/
|
|
97
|
+
│ ├── DidarCrm.node.ts # Main entry for resource & operation switch
|
|
98
|
+
│ ├── DidarCrmTrigger.node.ts # Trigger node
|
|
99
|
+
│ └── deal/ # Deal operations
|
|
100
|
+
│ ├── create.operation.ts
|
|
101
|
+
│ ├── update.operation.ts
|
|
102
|
+
│ └── get.operation.ts
|
|
103
|
+
│ └── person/ # Person operations
|
|
104
|
+
│ ├── create.operation.ts
|
|
105
|
+
│ ├── update.operation.ts
|
|
106
|
+
│ └── get.operation.ts
|
|
107
|
+
│── lib/
|
|
108
|
+
├── http.ts # Request helper
|
|
109
|
+
└── loadOptions.ts # Dropdown population (pipelines, stages, users)
|
|
110
|
+
```
|
|
30
111
|
|
|
31
112
|
---
|
|
32
113
|
|
|
33
|
-
##
|
|
114
|
+
## 🛠 Development
|
|
34
115
|
|
|
35
|
-
Clone repo
|
|
116
|
+
1. Clone the repo
|
|
117
|
+
2. Install dependencies:
|
|
36
118
|
|
|
37
|
-
```bash
|
|
38
|
-
npm install
|
|
39
|
-
|
|
119
|
+
```bash
|
|
120
|
+
npm install
|
|
121
|
+
```
|
|
122
|
+
3. Build:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm run build
|
|
126
|
+
```
|
|
127
|
+
4. Link into your n8n custom directory and restart n8n:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm link
|
|
131
|
+
n8n start
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
40
135
|
|
|
41
|
-
|
|
136
|
+
## 📜 License
|
|
42
137
|
|
|
43
|
-
|
|
44
|
-
cd ~/.n8n/custom
|
|
45
|
-
npm install /path/to/n8n-nodes-didar-crm
|
|
138
|
+
MIT License – see [LICENSE](./LICENSE) for details.
|
|
@@ -39,6 +39,8 @@ const Load = __importStar(require("../lib/loadOptions"));
|
|
|
39
39
|
const deal_1 = require("./deal");
|
|
40
40
|
const PersonOps = __importStar(require("./person"));
|
|
41
41
|
const person_1 = require("./person");
|
|
42
|
+
const CompanyOps = __importStar(require("./company"));
|
|
43
|
+
const company_1 = require("./company");
|
|
42
44
|
class DidarCrm {
|
|
43
45
|
constructor() {
|
|
44
46
|
this.methods = {
|
|
@@ -68,6 +70,7 @@ class DidarCrm {
|
|
|
68
70
|
options: [
|
|
69
71
|
{ name: 'Deal', value: 'deal' },
|
|
70
72
|
{ name: 'Person', value: 'person' },
|
|
73
|
+
{ name: 'Company', value: 'company' },
|
|
71
74
|
],
|
|
72
75
|
default: 'deal',
|
|
73
76
|
description: 'Choose the entity to act on.',
|
|
@@ -92,6 +95,21 @@ class DidarCrm {
|
|
|
92
95
|
displayOptions: { show: { resource: ['person'] } },
|
|
93
96
|
options: [
|
|
94
97
|
{ name: 'Create', value: 'create', action: 'Create a person' },
|
|
98
|
+
{ name: 'Update', value: 'update', action: 'Update a person by Id' },
|
|
99
|
+
{ name: 'Get', value: 'get', action: 'Get a person by Id' },
|
|
100
|
+
],
|
|
101
|
+
default: 'create',
|
|
102
|
+
description: 'Select the action to perform on the selected resource.',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
displayName: 'Operation',
|
|
106
|
+
name: 'operation',
|
|
107
|
+
type: 'options',
|
|
108
|
+
displayOptions: { show: { resource: ['company'] } },
|
|
109
|
+
options: [
|
|
110
|
+
{ name: 'Create', value: 'create', action: 'Create a company' },
|
|
111
|
+
{ name: 'Update', value: 'update', action: 'Update a company by Id' }, // NEW
|
|
112
|
+
{ name: 'Get', value: 'get', action: 'Get a company by Id' }, // NEW
|
|
95
113
|
],
|
|
96
114
|
default: 'create',
|
|
97
115
|
description: 'Select the action to perform on the selected resource.',
|
|
@@ -102,6 +120,12 @@ class DidarCrm {
|
|
|
102
120
|
...deal_1.dealGetProperties,
|
|
103
121
|
// Person properties (imported)
|
|
104
122
|
...person_1.personCreateProperties,
|
|
123
|
+
...person_1.personUpdateProperties,
|
|
124
|
+
...person_1.personGetProperties,
|
|
125
|
+
// Company properties (imported)
|
|
126
|
+
...company_1.companyCreateProperties,
|
|
127
|
+
...company_1.companyUpdateProperties,
|
|
128
|
+
...company_1.companyGetProperties,
|
|
105
129
|
],
|
|
106
130
|
};
|
|
107
131
|
}
|
|
@@ -130,6 +154,28 @@ class DidarCrm {
|
|
|
130
154
|
await PersonOps.personCreate.call(this, i, returnData);
|
|
131
155
|
continue;
|
|
132
156
|
}
|
|
157
|
+
if (operation === 'update') {
|
|
158
|
+
await PersonOps.personUpdate.call(this, i, returnData);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (operation === 'get') {
|
|
162
|
+
await PersonOps.personGet.call(this, i, returnData);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (resource === 'company') {
|
|
167
|
+
if (operation === 'create') {
|
|
168
|
+
await CompanyOps.companyCreate.call(this, i, returnData);
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (operation === 'update') {
|
|
172
|
+
await CompanyOps.companyUpdate.call(this, i, returnData);
|
|
173
|
+
continue;
|
|
174
|
+
} // NEW
|
|
175
|
+
if (operation === 'get') {
|
|
176
|
+
await CompanyOps.companyGet.call(this, i, returnData);
|
|
177
|
+
continue;
|
|
178
|
+
} // NEW
|
|
133
179
|
}
|
|
134
180
|
}
|
|
135
181
|
return [returnData];
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.companyCreate = companyCreate;
|
|
4
|
+
const http_1 = require("../../lib/http");
|
|
5
|
+
async function companyCreate(i, returnData) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
7
|
+
// Name (maps to FirstName) is required
|
|
8
|
+
const name = this.getNodeParameter('FirstName', i, '');
|
|
9
|
+
if (!name)
|
|
10
|
+
throw new Error('Name is required.');
|
|
11
|
+
// Owner selection
|
|
12
|
+
const ownerMode = this.getNodeParameter('OwnerMode', i);
|
|
13
|
+
const ownerId = ownerMode === 'select'
|
|
14
|
+
? this.getNodeParameter('OwnerIdSelect', i, '')
|
|
15
|
+
: this.getNodeParameter('OwnerIdManual', i, '');
|
|
16
|
+
if (!ownerId)
|
|
17
|
+
throw new Error('OwnerId is required (select from list or enter manually).');
|
|
18
|
+
// Main fields
|
|
19
|
+
const mobile = this.getNodeParameter('MobilePhone', i, '');
|
|
20
|
+
const workPhone = this.getNodeParameter('WorkPhone', i, '');
|
|
21
|
+
// Additional fields
|
|
22
|
+
const add = this.getNodeParameter('additionalFields', i, {}) || {};
|
|
23
|
+
const workPhoneExt = (_a = add.WorkPhoneExtension) !== null && _a !== void 0 ? _a : '';
|
|
24
|
+
const fax = (_b = add.Fax) !== null && _b !== void 0 ? _b : '';
|
|
25
|
+
const email = (_c = add.Email) !== null && _c !== void 0 ? _c : '';
|
|
26
|
+
const isVip = (_d = add.IsVIP) !== null && _d !== void 0 ? _d : false;
|
|
27
|
+
const backgroundInfo = (_e = add.BackgroundInfo) !== null && _e !== void 0 ? _e : '';
|
|
28
|
+
const customerCode = (_f = add.CustomerCode) !== null && _f !== void 0 ? _f : '';
|
|
29
|
+
const economicIssue = (_g = add.EconomicIssue) !== null && _g !== void 0 ? _g : '';
|
|
30
|
+
const registrationNumber = (_h = add.RegistrationNumber) !== null && _h !== void 0 ? _h : '';
|
|
31
|
+
const nationalId = (_j = add.NationalID) !== null && _j !== void 0 ? _j : '';
|
|
32
|
+
const zipCode = (_k = add.ZipCode) !== null && _k !== void 0 ? _k : '';
|
|
33
|
+
const visibilityType = (_l = add.VisibilityType) !== null && _l !== void 0 ? _l : 'Owner';
|
|
34
|
+
// Fields (JSON)
|
|
35
|
+
let fields;
|
|
36
|
+
if (typeof add.Fields === 'string' && add.Fields.trim()) {
|
|
37
|
+
try {
|
|
38
|
+
fields = JSON.parse(add.Fields);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
throw new Error('Invalid JSON in "Custom Fields (JSON)".');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (typeof add.Fields === 'object' && add.Fields) {
|
|
45
|
+
fields = add.Fields;
|
|
46
|
+
}
|
|
47
|
+
// Helper: fixedCollection → { KeyValues: [{Key,Value}] }
|
|
48
|
+
const toKeyValues = (obj) => {
|
|
49
|
+
var _a;
|
|
50
|
+
if (!obj || typeof obj !== 'object')
|
|
51
|
+
return undefined;
|
|
52
|
+
const list = (_a = obj.KeyValues) !== null && _a !== void 0 ? _a : [];
|
|
53
|
+
if (!Array.isArray(list) || !list.length)
|
|
54
|
+
return undefined;
|
|
55
|
+
return { KeyValues: list.map(e => { var _a, _b; return ({ Key: (_a = e.Key) !== null && _a !== void 0 ? _a : '', Value: (_b = e.Value) !== null && _b !== void 0 ? _b : '' }); }) };
|
|
56
|
+
};
|
|
57
|
+
const websites = toKeyValues(add.Websites);
|
|
58
|
+
const otherPhones = toKeyValues(add.OtherPhones);
|
|
59
|
+
const otherEmails = toKeyValues(add.OtherEmails);
|
|
60
|
+
const addresses = toKeyValues(add.Addresses);
|
|
61
|
+
// BankAccounts: { Values: [{Value1..Value4}] }
|
|
62
|
+
let bankAccounts;
|
|
63
|
+
if (add.BankAccounts && typeof add.BankAccounts === 'object') {
|
|
64
|
+
const vals = add.BankAccounts.Values;
|
|
65
|
+
if (Array.isArray(vals) && vals.length) {
|
|
66
|
+
bankAccounts = { Values: vals.map(v => {
|
|
67
|
+
var _a, _b, _c, _d;
|
|
68
|
+
return ({
|
|
69
|
+
Value1: (_a = v.Value1) !== null && _a !== void 0 ? _a : '', Value2: (_b = v.Value2) !== null && _b !== void 0 ? _b : '', Value3: (_c = v.Value3) !== null && _c !== void 0 ? _c : '', Value4: (_d = v.Value4) !== null && _d !== void 0 ? _d : '',
|
|
70
|
+
});
|
|
71
|
+
}) };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// SegmentIds: string[]
|
|
75
|
+
let segmentIds;
|
|
76
|
+
const seg = add.SegmentIds;
|
|
77
|
+
if (Array.isArray(seg))
|
|
78
|
+
segmentIds = seg.filter(Boolean);
|
|
79
|
+
else if (typeof seg === 'string' && seg)
|
|
80
|
+
segmentIds = [seg];
|
|
81
|
+
// Contact body (Type = Company)
|
|
82
|
+
const contact = {
|
|
83
|
+
Type: 'Company',
|
|
84
|
+
FirstName: name, // UI "Name" → API FirstName
|
|
85
|
+
OwnerId: ownerId,
|
|
86
|
+
MobilePhone: mobile,
|
|
87
|
+
WorkPhone: workPhone,
|
|
88
|
+
WorkPhoneExtension: workPhoneExt,
|
|
89
|
+
Fax: fax,
|
|
90
|
+
Email: email,
|
|
91
|
+
IsVIP: isVip,
|
|
92
|
+
BackgroundInfo: backgroundInfo,
|
|
93
|
+
CustomerCode: customerCode,
|
|
94
|
+
EconomicIssue: economicIssue,
|
|
95
|
+
RegistrationNumber: registrationNumber,
|
|
96
|
+
NationalID: nationalId,
|
|
97
|
+
ZipCode: zipCode,
|
|
98
|
+
VisibilityType: visibilityType,
|
|
99
|
+
};
|
|
100
|
+
if (fields)
|
|
101
|
+
contact['Fields'] = fields;
|
|
102
|
+
if (websites)
|
|
103
|
+
contact['Websites'] = websites;
|
|
104
|
+
if (otherPhones)
|
|
105
|
+
contact['OtherPhones'] = otherPhones;
|
|
106
|
+
if (otherEmails)
|
|
107
|
+
contact['OtherEmails'] = otherEmails;
|
|
108
|
+
if (addresses)
|
|
109
|
+
contact['Addresses'] = addresses;
|
|
110
|
+
if (bankAccounts)
|
|
111
|
+
contact['BankAccounts'] = bankAccounts;
|
|
112
|
+
const body = { Contact: contact };
|
|
113
|
+
if (segmentIds && segmentIds.length)
|
|
114
|
+
body['SegmentIds'] = segmentIds;
|
|
115
|
+
const resp = await (0, http_1.didarRequest)(this, i, {
|
|
116
|
+
method: 'POST',
|
|
117
|
+
path: '/api/contact/save',
|
|
118
|
+
body,
|
|
119
|
+
});
|
|
120
|
+
returnData.push({ json: resp });
|
|
121
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.companyCreateProperties = void 0;
|
|
4
|
+
const showForCompanyCreate = { show: { resource: ['company'], operation: ['create'] } };
|
|
5
|
+
exports.companyCreateProperties = [
|
|
6
|
+
// --- مین فیلدها (بالا به پایین) ---
|
|
7
|
+
{
|
|
8
|
+
displayName: 'Name',
|
|
9
|
+
name: 'FirstName', // به API به عنوان FirstName ارسال میشود
|
|
10
|
+
type: 'string',
|
|
11
|
+
default: '',
|
|
12
|
+
required: true,
|
|
13
|
+
displayOptions: showForCompanyCreate,
|
|
14
|
+
description: 'Company name (required).',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
displayName: 'Mobile Phone',
|
|
18
|
+
name: 'MobilePhone',
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: '',
|
|
21
|
+
displayOptions: showForCompanyCreate,
|
|
22
|
+
description: 'Primary mobile phone number.',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
displayName: 'Work Phone',
|
|
26
|
+
name: 'WorkPhone',
|
|
27
|
+
type: 'string',
|
|
28
|
+
default: '',
|
|
29
|
+
displayOptions: showForCompanyCreate,
|
|
30
|
+
description: 'Work phone number.',
|
|
31
|
+
},
|
|
32
|
+
// --- Owner (Select/Manual) مانند Person/Deal ---
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Owner Input Mode',
|
|
35
|
+
name: 'OwnerMode',
|
|
36
|
+
type: 'options',
|
|
37
|
+
options: [
|
|
38
|
+
{ name: 'Select from list', value: 'select' },
|
|
39
|
+
{ name: 'Enter ID manually', value: 'manual' },
|
|
40
|
+
],
|
|
41
|
+
default: 'select',
|
|
42
|
+
displayOptions: showForCompanyCreate,
|
|
43
|
+
description: 'Choose how to set the owner of this company.',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
displayName: 'Owner',
|
|
47
|
+
name: 'OwnerIdSelect',
|
|
48
|
+
type: 'options',
|
|
49
|
+
typeOptions: { loadOptionsMethod: 'getUsers' },
|
|
50
|
+
default: '',
|
|
51
|
+
displayOptions: { show: { ...showForCompanyCreate.show, OwnerMode: ['select'] } },
|
|
52
|
+
description: 'Select the owner user (required if select mode).',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
displayName: 'Owner ID',
|
|
56
|
+
name: 'OwnerIdManual',
|
|
57
|
+
type: 'string',
|
|
58
|
+
default: '',
|
|
59
|
+
displayOptions: { show: { ...showForCompanyCreate.show, OwnerMode: ['manual'] } },
|
|
60
|
+
description: 'Enter owner user ID manually (required if manual mode).',
|
|
61
|
+
},
|
|
62
|
+
// --- Additional Fields ---
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Additional Fields',
|
|
65
|
+
name: 'additionalFields',
|
|
66
|
+
type: 'collection',
|
|
67
|
+
placeholder: 'Add field',
|
|
68
|
+
default: {},
|
|
69
|
+
displayOptions: showForCompanyCreate,
|
|
70
|
+
options: [
|
|
71
|
+
{ displayName: 'Work Phone Extension', name: 'WorkPhoneExtension', type: 'string', default: '', description: 'Extension for the work phone.' },
|
|
72
|
+
{ displayName: 'Fax', name: 'Fax', type: 'string', default: '', description: 'Fax number.' },
|
|
73
|
+
{ displayName: 'Email', name: 'Email', type: 'string', default: '', description: 'Primary email address.' },
|
|
74
|
+
{ displayName: 'Is VIP', name: 'IsVIP', type: 'boolean', default: false, description: 'Mark this company as VIP.' },
|
|
75
|
+
{ displayName: 'Background Info', name: 'BackgroundInfo', type: 'string', default: '', description: 'Notes or background information.' },
|
|
76
|
+
{ displayName: 'Customer Code', name: 'CustomerCode', type: 'string', default: '', description: 'Internal or CRM customer code.' },
|
|
77
|
+
// فیلدهای مخصوص شرکت
|
|
78
|
+
{ displayName: 'Economic Issue', name: 'EconomicIssue', type: 'string', default: '', description: 'Economic issue code (company-specific).' },
|
|
79
|
+
{ displayName: 'Registration Number', name: 'RegistrationNumber', type: 'string', default: '', description: 'Company registration number.' },
|
|
80
|
+
{ displayName: 'National ID', name: 'NationalID', type: 'string', default: '', description: 'Company national ID.' },
|
|
81
|
+
{ displayName: 'Zip Code', name: 'ZipCode', type: 'string', default: '', description: 'Postal/ZIP code.' },
|
|
82
|
+
// VisibilityType مانند قبل
|
|
83
|
+
{
|
|
84
|
+
displayName: 'Visibility Type',
|
|
85
|
+
name: 'VisibilityType',
|
|
86
|
+
type: 'options',
|
|
87
|
+
options: [
|
|
88
|
+
{ name: 'Owner', value: 'Owner' },
|
|
89
|
+
{ name: 'Owner Group', value: 'OwnerGroup' },
|
|
90
|
+
{ name: 'Owner SubGroup', value: 'OwnerSubGroup' },
|
|
91
|
+
{ name: 'All', value: 'All' },
|
|
92
|
+
],
|
|
93
|
+
default: 'Owner',
|
|
94
|
+
description: 'Visibility setting for this company.',
|
|
95
|
+
},
|
|
96
|
+
// Fields (JSON)
|
|
97
|
+
{
|
|
98
|
+
displayName: 'Custom Fields (JSON)',
|
|
99
|
+
name: 'Fields',
|
|
100
|
+
type: 'json',
|
|
101
|
+
default: '',
|
|
102
|
+
placeholder: '{ "Field_996_0_7": "value" }',
|
|
103
|
+
description: 'JSON object of custom fields.',
|
|
104
|
+
},
|
|
105
|
+
// Websites / OtherPhones / OtherEmails / Addresses → Key/Value
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Websites',
|
|
108
|
+
name: 'Websites',
|
|
109
|
+
type: 'fixedCollection',
|
|
110
|
+
typeOptions: { multipleValues: true },
|
|
111
|
+
default: {},
|
|
112
|
+
options: [
|
|
113
|
+
{
|
|
114
|
+
name: 'KeyValues',
|
|
115
|
+
displayName: 'Website',
|
|
116
|
+
values: [
|
|
117
|
+
{ displayName: 'Key', name: 'Key', type: 'string', default: '' },
|
|
118
|
+
{ displayName: 'Value', name: 'Value', type: 'string', default: '' },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
description: 'List of websites as key/value pairs.',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Other Phones',
|
|
126
|
+
name: 'OtherPhones',
|
|
127
|
+
type: 'fixedCollection',
|
|
128
|
+
typeOptions: { multipleValues: true },
|
|
129
|
+
default: {},
|
|
130
|
+
options: [
|
|
131
|
+
{
|
|
132
|
+
name: 'KeyValues',
|
|
133
|
+
displayName: 'Phone',
|
|
134
|
+
values: [
|
|
135
|
+
{ displayName: 'Key', name: 'Key', type: 'string', default: '' },
|
|
136
|
+
{ displayName: 'Value', name: 'Value', type: 'string', default: '' },
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
description: 'Additional phone numbers as key/value pairs.',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
displayName: 'Other Emails',
|
|
144
|
+
name: 'OtherEmails',
|
|
145
|
+
type: 'fixedCollection',
|
|
146
|
+
typeOptions: { multipleValues: true },
|
|
147
|
+
default: {},
|
|
148
|
+
options: [
|
|
149
|
+
{
|
|
150
|
+
name: 'KeyValues',
|
|
151
|
+
displayName: 'Email',
|
|
152
|
+
values: [
|
|
153
|
+
{ displayName: 'Key', name: 'Key', type: 'string', default: '' },
|
|
154
|
+
{ displayName: 'Value', name: 'Value', type: 'string', default: '' },
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
description: 'Additional emails as key/value pairs.',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
displayName: 'Addresses',
|
|
162
|
+
name: 'Addresses',
|
|
163
|
+
type: 'fixedCollection',
|
|
164
|
+
typeOptions: { multipleValues: true },
|
|
165
|
+
default: {},
|
|
166
|
+
options: [
|
|
167
|
+
{
|
|
168
|
+
name: 'KeyValues',
|
|
169
|
+
displayName: 'Address',
|
|
170
|
+
values: [
|
|
171
|
+
{ displayName: 'Key', name: 'Key', type: 'string', default: '' },
|
|
172
|
+
{ displayName: 'Value', name: 'Value', type: 'string', default: '' },
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
description: 'Addresses as key/value pairs (e.g., HQ/Branch/etc.).',
|
|
177
|
+
},
|
|
178
|
+
// BankAccounts: Values[1..4]
|
|
179
|
+
{
|
|
180
|
+
displayName: 'Bank Accounts',
|
|
181
|
+
name: 'BankAccounts',
|
|
182
|
+
type: 'fixedCollection',
|
|
183
|
+
typeOptions: { multipleValues: true },
|
|
184
|
+
default: {},
|
|
185
|
+
options: [
|
|
186
|
+
{
|
|
187
|
+
name: 'Values',
|
|
188
|
+
displayName: 'Bank Account',
|
|
189
|
+
values: [
|
|
190
|
+
{ displayName: 'Value1', name: 'Value1', type: 'string', default: '' },
|
|
191
|
+
{ displayName: 'Value2', name: 'Value2', type: 'string', default: '' },
|
|
192
|
+
{ displayName: 'Value3', name: 'Value3', type: 'string', default: '' },
|
|
193
|
+
{ displayName: 'Value4', name: 'Value4', type: 'string', default: '' },
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
description: 'Bank account details (four flexible fields per entry).',
|
|
198
|
+
},
|
|
199
|
+
// SegmentIds: string[]
|
|
200
|
+
{
|
|
201
|
+
displayName: 'Segment IDs',
|
|
202
|
+
name: 'SegmentIds',
|
|
203
|
+
type: 'string',
|
|
204
|
+
typeOptions: { multipleValues: true },
|
|
205
|
+
default: [],
|
|
206
|
+
description: 'List of segment IDs (GUIDs).',
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.companyGet = companyGet;
|
|
4
|
+
const http_1 = require("../../lib/http");
|
|
5
|
+
async function companyGet(i, returnData) {
|
|
6
|
+
const companyId = this.getNodeParameter('companyId', i, '');
|
|
7
|
+
if (!companyId)
|
|
8
|
+
throw new Error('Company Id is required.');
|
|
9
|
+
const resp = await (0, http_1.didarRequest)(this, i, {
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/api/contact/GetContactDetail',
|
|
12
|
+
body: { Id: companyId },
|
|
13
|
+
});
|
|
14
|
+
returnData.push({ json: resp });
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.companyGetProperties = void 0;
|
|
4
|
+
exports.companyGetProperties = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Company Id',
|
|
7
|
+
name: 'companyId',
|
|
8
|
+
type: 'string',
|
|
9
|
+
default: '',
|
|
10
|
+
required: true,
|
|
11
|
+
displayOptions: { show: { resource: ['company'], operation: ['get'] } },
|
|
12
|
+
description: 'Company Id to fetch (required).',
|
|
13
|
+
},
|
|
14
|
+
];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { companyCreate } from './create.operation';
|
|
2
|
+
export { companyCreateProperties } from './create.properties';
|
|
3
|
+
export { companyUpdate } from './update.operation';
|
|
4
|
+
export { companyUpdateProperties } from './update.properties';
|
|
5
|
+
export { companyGet } from './get.operation';
|
|
6
|
+
export { companyGetProperties } from './get.properties';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.companyGetProperties = exports.companyGet = exports.companyUpdateProperties = exports.companyUpdate = exports.companyCreateProperties = exports.companyCreate = void 0;
|
|
4
|
+
var create_operation_1 = require("./create.operation");
|
|
5
|
+
Object.defineProperty(exports, "companyCreate", { enumerable: true, get: function () { return create_operation_1.companyCreate; } });
|
|
6
|
+
var create_properties_1 = require("./create.properties");
|
|
7
|
+
Object.defineProperty(exports, "companyCreateProperties", { enumerable: true, get: function () { return create_properties_1.companyCreateProperties; } });
|
|
8
|
+
var update_operation_1 = require("./update.operation");
|
|
9
|
+
Object.defineProperty(exports, "companyUpdate", { enumerable: true, get: function () { return update_operation_1.companyUpdate; } });
|
|
10
|
+
var update_properties_1 = require("./update.properties");
|
|
11
|
+
Object.defineProperty(exports, "companyUpdateProperties", { enumerable: true, get: function () { return update_properties_1.companyUpdateProperties; } });
|
|
12
|
+
var get_operation_1 = require("./get.operation"); // NEW
|
|
13
|
+
Object.defineProperty(exports, "companyGet", { enumerable: true, get: function () { return get_operation_1.companyGet; } });
|
|
14
|
+
var get_properties_1 = require("./get.properties"); // NEW
|
|
15
|
+
Object.defineProperty(exports, "companyGetProperties", { enumerable: true, get: function () { return get_properties_1.companyGetProperties; } });
|