n8n-nodes-didar-crm 0.0.5 → 0.0.7
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/dist/nodes/DidarCrm.node.js +26 -430
- package/dist/nodes/deal/_shared.fields.d.ts +8 -0
- package/dist/nodes/deal/_shared.fields.js +191 -0
- package/dist/nodes/deal/create.properties.d.ts +2 -0
- package/dist/nodes/deal/create.properties.js +13 -0
- package/dist/nodes/deal/get.operation.js +3 -4
- package/dist/nodes/deal/get.properties.d.ts +2 -0
- package/dist/nodes/deal/get.properties.js +13 -0
- package/dist/nodes/deal/index.d.ts +3 -0
- package/dist/nodes/deal/index.js +7 -1
- package/dist/nodes/deal/update.properties.d.ts +2 -0
- package/dist/nodes/deal/update.properties.js +21 -0
- package/dist/nodes/person/create.operation.d.ts +2 -0
- package/dist/nodes/person/create.operation.js +132 -0
- package/dist/nodes/person/create.properties.d.ts +2 -0
- package/dist/nodes/person/create.properties.js +224 -0
- package/dist/nodes/person/index.d.ts +2 -0
- package/dist/nodes/person/index.js +8 -0
- package/package.json +1 -1
|
@@ -36,6 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.DidarCrm = void 0;
|
|
37
37
|
const DealOps = __importStar(require("./deal"));
|
|
38
38
|
const Load = __importStar(require("../lib/loadOptions"));
|
|
39
|
+
const deal_1 = require("./deal");
|
|
40
|
+
const PersonOps = __importStar(require("./person"));
|
|
41
|
+
const person_1 = require("./person");
|
|
39
42
|
class DidarCrm {
|
|
40
43
|
constructor() {
|
|
41
44
|
this.methods = {
|
|
@@ -62,7 +65,10 @@ class DidarCrm {
|
|
|
62
65
|
displayName: 'Resource',
|
|
63
66
|
name: 'resource',
|
|
64
67
|
type: 'options',
|
|
65
|
-
options: [
|
|
68
|
+
options: [
|
|
69
|
+
{ name: 'Deal', value: 'deal' },
|
|
70
|
+
{ name: 'Person', value: 'person' },
|
|
71
|
+
],
|
|
66
72
|
default: 'deal',
|
|
67
73
|
description: 'Choose the entity to act on.',
|
|
68
74
|
},
|
|
@@ -79,440 +85,24 @@ class DidarCrm {
|
|
|
79
85
|
default: 'create',
|
|
80
86
|
description: 'Select the action to perform on the selected resource.',
|
|
81
87
|
},
|
|
82
|
-
// ========================= Deal → Create (MAIN FIELDS) =========================
|
|
83
|
-
// 1) Title
|
|
84
|
-
{
|
|
85
|
-
displayName: 'Title',
|
|
86
|
-
name: 'Title',
|
|
87
|
-
type: 'string',
|
|
88
|
-
default: '',
|
|
89
|
-
displayOptions: { show: { resource: ['deal'], operation: ['create'] } },
|
|
90
|
-
description: 'Deal title (required).',
|
|
91
|
-
},
|
|
92
|
-
// 2) Owner (select/manual)
|
|
93
|
-
{
|
|
94
|
-
displayName: 'Owner Input Mode',
|
|
95
|
-
name: 'OwnerMode',
|
|
96
|
-
type: 'options',
|
|
97
|
-
options: [
|
|
98
|
-
{ name: 'Select from list', value: 'select' },
|
|
99
|
-
{ name: 'Enter ID manually', value: 'manual' },
|
|
100
|
-
],
|
|
101
|
-
default: 'select',
|
|
102
|
-
displayOptions: { show: { resource: ['deal'], operation: ['create'] } },
|
|
103
|
-
description: 'Choose how to set the owner.',
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
displayName: 'Owner',
|
|
107
|
-
name: 'OwnerIdSelect',
|
|
108
|
-
type: 'options',
|
|
109
|
-
typeOptions: { loadOptionsMethod: 'getUsers' },
|
|
110
|
-
default: '',
|
|
111
|
-
displayOptions: {
|
|
112
|
-
show: { resource: ['deal'], operation: ['create'], OwnerMode: ['select'] },
|
|
113
|
-
},
|
|
114
|
-
description: 'Select the deal owner (required if select mode).',
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
displayName: 'Owner ID',
|
|
118
|
-
name: 'OwnerIdManual',
|
|
119
|
-
type: 'string',
|
|
120
|
-
default: '',
|
|
121
|
-
displayOptions: {
|
|
122
|
-
show: { resource: ['deal'], operation: ['create'], OwnerMode: ['manual'] },
|
|
123
|
-
},
|
|
124
|
-
description: 'Enter owner ID manually (required if manual mode).',
|
|
125
|
-
},
|
|
126
|
-
// 3) Pipeline (select/manual)
|
|
127
|
-
{
|
|
128
|
-
displayName: 'Pipeline Input Mode',
|
|
129
|
-
name: 'PipelineMode',
|
|
130
|
-
type: 'options',
|
|
131
|
-
options: [
|
|
132
|
-
{ name: 'Select from list', value: 'select' },
|
|
133
|
-
{ name: 'Enter ID manually', value: 'manual' },
|
|
134
|
-
],
|
|
135
|
-
default: 'select',
|
|
136
|
-
displayOptions: { show: { resource: ['deal'], operation: ['create'] } },
|
|
137
|
-
description: 'Choose how to set the pipeline.',
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
displayName: 'Pipeline',
|
|
141
|
-
name: 'PipelineIdSelect',
|
|
142
|
-
type: 'options',
|
|
143
|
-
typeOptions: { loadOptionsMethod: 'getPipelines' },
|
|
144
|
-
default: '',
|
|
145
|
-
displayOptions: {
|
|
146
|
-
show: { resource: ['deal'], operation: ['create'], PipelineMode: ['select'] },
|
|
147
|
-
},
|
|
148
|
-
description: 'Pick a pipeline (required if select mode).',
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
displayName: 'Pipeline ID',
|
|
152
|
-
name: 'PipelineId',
|
|
153
|
-
type: 'string',
|
|
154
|
-
default: '',
|
|
155
|
-
displayOptions: {
|
|
156
|
-
show: { resource: ['deal'], operation: ['create'], PipelineMode: ['manual'] },
|
|
157
|
-
},
|
|
158
|
-
description: 'Enter pipeline ID (required if manual mode).',
|
|
159
|
-
},
|
|
160
|
-
// 4) Stage (select/manual)
|
|
161
|
-
{
|
|
162
|
-
displayName: 'Stage Input Mode',
|
|
163
|
-
name: 'StageMode',
|
|
164
|
-
type: 'options',
|
|
165
|
-
options: [
|
|
166
|
-
{ name: 'Select from list', value: 'select' },
|
|
167
|
-
{ name: 'Enter ID manually', value: 'manual' },
|
|
168
|
-
],
|
|
169
|
-
default: 'select',
|
|
170
|
-
displayOptions: { show: { resource: ['deal'], operation: ['create'] } },
|
|
171
|
-
description: 'Choose how to set the stage.',
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
displayName: 'Pipeline Stage',
|
|
175
|
-
name: 'PipelineStageIdSelect',
|
|
176
|
-
type: 'options',
|
|
177
|
-
typeOptions: {
|
|
178
|
-
loadOptionsMethod: 'getStagesForPipeline',
|
|
179
|
-
loadOptionsDependsOn: ['PipelineIdSelect'],
|
|
180
|
-
},
|
|
181
|
-
default: '',
|
|
182
|
-
displayOptions: {
|
|
183
|
-
show: {
|
|
184
|
-
resource: ['deal'],
|
|
185
|
-
operation: ['create'],
|
|
186
|
-
StageMode: ['select'],
|
|
187
|
-
PipelineMode: ['select'],
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
description: 'Pick a stage (required if select mode).',
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
displayName: 'Pipeline Stage ID',
|
|
194
|
-
name: 'PipelineStageId',
|
|
195
|
-
type: 'string',
|
|
196
|
-
default: '',
|
|
197
|
-
displayOptions: {
|
|
198
|
-
show: { resource: ['deal'], operation: ['create'], StageMode: ['manual'] },
|
|
199
|
-
},
|
|
200
|
-
description: 'Enter stage ID (required if manual mode).',
|
|
201
|
-
},
|
|
202
|
-
// 5) Person (default zero-guid)
|
|
203
|
-
{
|
|
204
|
-
displayName: 'Person ID',
|
|
205
|
-
name: 'PersonId',
|
|
206
|
-
type: 'string',
|
|
207
|
-
default: '00000000-0000-0000-0000-000000000000',
|
|
208
|
-
displayOptions: { show: { resource: ['deal'], operation: ['create'] } },
|
|
209
|
-
description: 'Person ID related to the deal (required).',
|
|
210
|
-
},
|
|
211
|
-
// 6) Company (default zero-guid)
|
|
212
|
-
{
|
|
213
|
-
displayName: 'Company ID',
|
|
214
|
-
name: 'CompanyId',
|
|
215
|
-
type: 'string',
|
|
216
|
-
default: '00000000-0000-0000-0000-000000000000',
|
|
217
|
-
displayOptions: { show: { resource: ['deal'], operation: ['create'] } },
|
|
218
|
-
description: 'Company ID related to the deal (required).',
|
|
219
|
-
},
|
|
220
|
-
// Status dropdown (required)
|
|
221
|
-
{
|
|
222
|
-
displayName: 'Status',
|
|
223
|
-
name: 'Status',
|
|
224
|
-
type: 'options',
|
|
225
|
-
options: [
|
|
226
|
-
{ name: 'Pending', value: 'Pending' },
|
|
227
|
-
{ name: 'Won', value: 'Won' },
|
|
228
|
-
{ name: 'Lost', value: 'Lost' },
|
|
229
|
-
],
|
|
230
|
-
default: 'Pending',
|
|
231
|
-
displayOptions: { show: { resource: ['deal'], operation: ['create'] } },
|
|
232
|
-
description: 'Deal status (required).',
|
|
233
|
-
},
|
|
234
|
-
// ========================= Additional Fields (OPTIONAL) =========================
|
|
235
|
-
{
|
|
236
|
-
displayName: 'Additional Fields',
|
|
237
|
-
name: 'additionalFields',
|
|
238
|
-
type: 'collection',
|
|
239
|
-
placeholder: 'Add field',
|
|
240
|
-
default: {},
|
|
241
|
-
displayOptions: { show: { resource: ['deal'], operation: ['create'] } },
|
|
242
|
-
options: [
|
|
243
|
-
// طبق خواسته: SourceOther بلافاصله بعد از SourceId
|
|
244
|
-
{
|
|
245
|
-
displayName: 'Source ID',
|
|
246
|
-
name: 'SourceId',
|
|
247
|
-
type: 'string',
|
|
248
|
-
default: '00000000-0000-0000-0000-000000000000',
|
|
249
|
-
description: 'Source identifier (optional).',
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
displayName: 'Source Other',
|
|
253
|
-
name: 'SourceOther',
|
|
254
|
-
type: 'string',
|
|
255
|
-
default: '',
|
|
256
|
-
description: 'Custom text for other/unlisted sources.',
|
|
257
|
-
},
|
|
258
|
-
// LostReason سهتایی کنار هم (در UI n8n همه در همین Collection خواهند بود)
|
|
259
|
-
{
|
|
260
|
-
displayName: 'Lost Reason ID',
|
|
261
|
-
name: 'LostReasonId',
|
|
262
|
-
type: 'string',
|
|
263
|
-
default: '00000000-0000-0000-0000-000000000000',
|
|
264
|
-
description: 'Lost reason identifier.',
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
displayName: 'Lost Reason Note',
|
|
268
|
-
name: 'LostReasonNote',
|
|
269
|
-
type: 'string',
|
|
270
|
-
default: '',
|
|
271
|
-
description: 'Additional notes for lost reason.',
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
displayName: 'Lost Reason Other',
|
|
275
|
-
name: 'LostReasonOther',
|
|
276
|
-
type: 'string',
|
|
277
|
-
default: '',
|
|
278
|
-
description: 'Custom lost reason text.',
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
displayName: 'Description',
|
|
282
|
-
name: 'Description',
|
|
283
|
-
type: 'string',
|
|
284
|
-
default: '',
|
|
285
|
-
description: 'Optional description for the deal.',
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
displayName: 'Creator ID',
|
|
289
|
-
name: 'CreatorId',
|
|
290
|
-
type: 'string',
|
|
291
|
-
default: '00000000-0000-0000-0000-000000000000',
|
|
292
|
-
description: 'Creator user ID (defaults to owner if empty).',
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
displayName: 'Price',
|
|
296
|
-
name: 'Price',
|
|
297
|
-
type: 'string',
|
|
298
|
-
default: '0',
|
|
299
|
-
description: 'Deal price/amount.',
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
displayName: 'Visibility Type',
|
|
303
|
-
name: 'VisibilityType',
|
|
304
|
-
type: 'options',
|
|
305
|
-
options: [
|
|
306
|
-
{ name: 'Owner', value: '0' },
|
|
307
|
-
{ name: 'Owner Group', value: '1' },
|
|
308
|
-
{ name: 'Owner SubGroup', value: '2' },
|
|
309
|
-
{ name: 'All', value: '3' },
|
|
310
|
-
],
|
|
311
|
-
default: 'Owner',
|
|
312
|
-
description: 'Visibility setting: restricts who can see this deal.',
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
displayName: 'Custom Fields (JSON)',
|
|
316
|
-
name: 'Fields',
|
|
317
|
-
type: 'json',
|
|
318
|
-
default: '',
|
|
319
|
-
placeholder: '{ "Field_8783_12_4": 12 }',
|
|
320
|
-
description: 'JSON object of custom fields.',
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
},
|
|
324
|
-
// ===== Deal.Update fields (exact mirror of Create, plus Id at top) =====
|
|
325
|
-
{
|
|
326
|
-
displayName: 'Id',
|
|
327
|
-
name: 'Id',
|
|
328
|
-
type: 'string',
|
|
329
|
-
default: '',
|
|
330
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
331
|
-
description: 'Deal Id to update (required).',
|
|
332
|
-
},
|
|
333
|
-
// 1) Title
|
|
334
88
|
{
|
|
335
|
-
displayName: '
|
|
336
|
-
name: '
|
|
337
|
-
type: 'string',
|
|
338
|
-
default: '',
|
|
339
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
340
|
-
description: 'Deal title (required).',
|
|
341
|
-
},
|
|
342
|
-
// 2) Owner (select/manual)
|
|
343
|
-
{
|
|
344
|
-
displayName: 'Owner Input Mode',
|
|
345
|
-
name: 'OwnerMode',
|
|
346
|
-
type: 'options',
|
|
347
|
-
options: [
|
|
348
|
-
{ name: 'Select from list', value: 'select' },
|
|
349
|
-
{ name: 'Enter ID manually', value: 'manual' },
|
|
350
|
-
],
|
|
351
|
-
default: 'select',
|
|
352
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
353
|
-
description: 'Choose how to set the owner.',
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
displayName: 'Owner',
|
|
357
|
-
name: 'OwnerIdSelect',
|
|
358
|
-
type: 'options',
|
|
359
|
-
typeOptions: { loadOptionsMethod: 'getUsers' },
|
|
360
|
-
default: '',
|
|
361
|
-
displayOptions: {
|
|
362
|
-
show: { resource: ['deal'], operation: ['update'], OwnerMode: ['select'] },
|
|
363
|
-
},
|
|
364
|
-
description: 'Select the deal owner (required if select mode).',
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
displayName: 'Owner ID',
|
|
368
|
-
name: 'OwnerIdManual',
|
|
369
|
-
type: 'string',
|
|
370
|
-
default: '',
|
|
371
|
-
displayOptions: {
|
|
372
|
-
show: { resource: ['deal'], operation: ['update'], OwnerMode: ['manual'] },
|
|
373
|
-
},
|
|
374
|
-
description: 'Enter owner ID manually (required if manual mode).',
|
|
375
|
-
},
|
|
376
|
-
// 3) Pipeline (select/manual)
|
|
377
|
-
{
|
|
378
|
-
displayName: 'Pipeline Input Mode',
|
|
379
|
-
name: 'PipelineMode',
|
|
380
|
-
type: 'options',
|
|
381
|
-
options: [
|
|
382
|
-
{ name: 'Select from list', value: 'select' },
|
|
383
|
-
{ name: 'Enter ID manually', value: 'manual' },
|
|
384
|
-
],
|
|
385
|
-
default: 'select',
|
|
386
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
387
|
-
description: 'Choose how to set the pipeline.',
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
displayName: 'Pipeline',
|
|
391
|
-
name: 'PipelineIdSelect',
|
|
392
|
-
type: 'options',
|
|
393
|
-
typeOptions: { loadOptionsMethod: 'getPipelines' },
|
|
394
|
-
default: '',
|
|
395
|
-
displayOptions: {
|
|
396
|
-
show: { resource: ['deal'], operation: ['update'], PipelineMode: ['select'] },
|
|
397
|
-
},
|
|
398
|
-
description: 'Pick a pipeline (required if select mode).',
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
displayName: 'Pipeline ID',
|
|
402
|
-
name: 'PipelineId',
|
|
403
|
-
type: 'string',
|
|
404
|
-
default: '',
|
|
405
|
-
displayOptions: {
|
|
406
|
-
show: { resource: ['deal'], operation: ['update'], PipelineMode: ['manual'] },
|
|
407
|
-
},
|
|
408
|
-
description: 'Enter pipeline ID (required if manual mode).',
|
|
409
|
-
},
|
|
410
|
-
// 4) Stage (select/manual)
|
|
411
|
-
{
|
|
412
|
-
displayName: 'Stage Input Mode',
|
|
413
|
-
name: 'StageMode',
|
|
414
|
-
type: 'options',
|
|
415
|
-
options: [
|
|
416
|
-
{ name: 'Select from list', value: 'select' },
|
|
417
|
-
{ name: 'Enter ID manually', value: 'manual' },
|
|
418
|
-
],
|
|
419
|
-
default: 'select',
|
|
420
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
421
|
-
description: 'Choose how to set the stage.',
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
displayName: 'Pipeline Stage',
|
|
425
|
-
name: 'PipelineStageIdSelect',
|
|
426
|
-
type: 'options',
|
|
427
|
-
typeOptions: {
|
|
428
|
-
loadOptionsMethod: 'getStagesForPipeline',
|
|
429
|
-
loadOptionsDependsOn: ['PipelineIdSelect'],
|
|
430
|
-
},
|
|
431
|
-
default: '',
|
|
432
|
-
displayOptions: {
|
|
433
|
-
show: {
|
|
434
|
-
resource: ['deal'],
|
|
435
|
-
operation: ['update'],
|
|
436
|
-
StageMode: ['select'],
|
|
437
|
-
PipelineMode: ['select'],
|
|
438
|
-
},
|
|
439
|
-
},
|
|
440
|
-
description: 'Pick a stage (required if select mode).',
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
displayName: 'Pipeline Stage ID',
|
|
444
|
-
name: 'PipelineStageId',
|
|
445
|
-
type: 'string',
|
|
446
|
-
default: '',
|
|
447
|
-
displayOptions: {
|
|
448
|
-
show: { resource: ['deal'], operation: ['update'], StageMode: ['manual'] },
|
|
449
|
-
},
|
|
450
|
-
description: 'Enter stage ID (required if manual mode).',
|
|
451
|
-
},
|
|
452
|
-
// 5) Person
|
|
453
|
-
{
|
|
454
|
-
displayName: 'Person ID',
|
|
455
|
-
name: 'PersonId',
|
|
456
|
-
type: 'string',
|
|
457
|
-
default: '00000000-0000-0000-0000-000000000000',
|
|
458
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
459
|
-
description: 'Person ID related to the deal (required).',
|
|
460
|
-
},
|
|
461
|
-
// 6) Company
|
|
462
|
-
{
|
|
463
|
-
displayName: 'Company ID',
|
|
464
|
-
name: 'CompanyId',
|
|
465
|
-
type: 'string',
|
|
466
|
-
default: '00000000-0000-0000-0000-000000000000',
|
|
467
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
468
|
-
description: 'Company ID related to the deal (required).',
|
|
469
|
-
},
|
|
470
|
-
// Status dropdown
|
|
471
|
-
{
|
|
472
|
-
displayName: 'Status',
|
|
473
|
-
name: 'Status',
|
|
89
|
+
displayName: 'Operation',
|
|
90
|
+
name: 'operation',
|
|
474
91
|
type: 'options',
|
|
92
|
+
displayOptions: { show: { resource: ['person'] } },
|
|
475
93
|
options: [
|
|
476
|
-
{ name: '
|
|
477
|
-
{ name: 'Won', value: 'Won' },
|
|
478
|
-
{ name: 'Lost', value: 'Lost' },
|
|
479
|
-
],
|
|
480
|
-
default: 'Pending',
|
|
481
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
482
|
-
description: 'Deal status (required).',
|
|
483
|
-
},
|
|
484
|
-
// Additional Fields (same as create)
|
|
485
|
-
{
|
|
486
|
-
displayName: 'Additional Fields',
|
|
487
|
-
name: 'additionalFields',
|
|
488
|
-
type: 'collection',
|
|
489
|
-
placeholder: 'Add field',
|
|
490
|
-
default: {},
|
|
491
|
-
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
492
|
-
options: [
|
|
493
|
-
{ displayName: 'Source ID', name: 'SourceId', type: 'string', default: '00000000-0000-0000-0000-000000000000', description: 'Source identifier (optional).' },
|
|
494
|
-
{ displayName: 'Source Other', name: 'SourceOther', type: 'string', default: '', description: 'Custom text for other/unlisted sources.' },
|
|
495
|
-
{ displayName: 'Lost Reason ID', name: 'LostReasonId', type: 'string', default: '00000000-0000-0000-0000-000000000000', description: 'Lost reason identifier.' },
|
|
496
|
-
{ displayName: 'Lost Reason Note', name: 'LostReasonNote', type: 'string', default: '', description: 'Additional notes for lost reason.' },
|
|
497
|
-
{ displayName: 'Lost Reason Other', name: 'LostReasonOther', type: 'string', default: '', description: 'Custom lost reason text.' },
|
|
498
|
-
{ displayName: 'Description', name: 'Description', type: 'string', default: '', description: 'Optional description for the deal.' },
|
|
499
|
-
{ displayName: 'Creator ID', name: 'CreatorId', type: 'string', default: '00000000-0000-0000-0000-000000000000', description: 'Creator user ID (defaults to owner if empty).' },
|
|
500
|
-
{ displayName: 'Price', name: 'Price', type: 'string', default: '0', description: 'Deal price/amount.' },
|
|
501
|
-
{
|
|
502
|
-
displayName: 'Visibility Type', name: 'VisibilityType', type: 'options',
|
|
503
|
-
options: [
|
|
504
|
-
{ name: 'Owner', value: 'Owner' },
|
|
505
|
-
{ name: 'Owner Group', value: 'OwnerGroup' },
|
|
506
|
-
{ name: 'Owner SubGroup', value: 'OwnerSubGroup' },
|
|
507
|
-
{ name: 'All', value: 'All' },
|
|
508
|
-
],
|
|
509
|
-
default: 'Owner',
|
|
510
|
-
description: 'Visibility setting.'
|
|
511
|
-
},
|
|
512
|
-
{ displayName: 'Custom Fields (JSON)', name: 'Fields', type: 'json', default: '', placeholder: '{ "Field_8783_12_4": 12 }', description: 'JSON object of custom fields.' },
|
|
94
|
+
{ name: 'Create', value: 'create', action: 'Create a person' },
|
|
513
95
|
],
|
|
96
|
+
default: 'create',
|
|
97
|
+
description: 'Select the action to perform on the selected resource.',
|
|
514
98
|
},
|
|
515
|
-
|
|
99
|
+
// Deal properties (imported)
|
|
100
|
+
...deal_1.dealCreateProperties,
|
|
101
|
+
...deal_1.dealUpdateProperties,
|
|
102
|
+
...deal_1.dealGetProperties,
|
|
103
|
+
// Person properties (imported)
|
|
104
|
+
...person_1.personCreateProperties,
|
|
105
|
+
],
|
|
516
106
|
};
|
|
517
107
|
}
|
|
518
108
|
async execute() {
|
|
@@ -535,6 +125,12 @@ class DidarCrm {
|
|
|
535
125
|
continue;
|
|
536
126
|
}
|
|
537
127
|
}
|
|
128
|
+
if (resource === 'person') {
|
|
129
|
+
if (operation === 'create') {
|
|
130
|
+
await PersonOps.personCreate.call(this, i, returnData);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
538
134
|
}
|
|
539
135
|
return [returnData];
|
|
540
136
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const titleField: (op: "create" | "update") => INodeProperties;
|
|
3
|
+
export declare const ownerFields: (op: "create" | "update") => INodeProperties[];
|
|
4
|
+
export declare const pipelineFields: (op: "create" | "update") => INodeProperties[];
|
|
5
|
+
export declare const stageFields: (op: "create" | "update") => INodeProperties[];
|
|
6
|
+
export declare const personCompanyFields: (op: "create" | "update") => INodeProperties[];
|
|
7
|
+
export declare const statusField: (op: "create" | "update") => INodeProperties;
|
|
8
|
+
export declare const additionalFields: (op: "create" | "update") => INodeProperties;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.additionalFields = exports.statusField = exports.personCompanyFields = exports.stageFields = exports.pipelineFields = exports.ownerFields = exports.titleField = void 0;
|
|
4
|
+
// helper برای تزریق displayOptions به فیلد
|
|
5
|
+
const showFor = (op) => ({
|
|
6
|
+
resource: ['deal'],
|
|
7
|
+
operation: [op],
|
|
8
|
+
});
|
|
9
|
+
// 1) Title
|
|
10
|
+
const titleField = (op) => ({
|
|
11
|
+
displayName: 'Title',
|
|
12
|
+
name: 'Title',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
displayOptions: { show: { ...showFor(op) } },
|
|
16
|
+
description: 'Deal title (required).',
|
|
17
|
+
});
|
|
18
|
+
exports.titleField = titleField;
|
|
19
|
+
// 2) Owner (select/manual)
|
|
20
|
+
const ownerFields = (op) => ([
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Owner Input Mode',
|
|
23
|
+
name: 'OwnerMode',
|
|
24
|
+
type: 'options',
|
|
25
|
+
options: [
|
|
26
|
+
{ name: 'Select from list', value: 'select' },
|
|
27
|
+
{ name: 'Enter ID manually', value: 'manual' },
|
|
28
|
+
],
|
|
29
|
+
default: 'select',
|
|
30
|
+
displayOptions: { show: showFor(op) },
|
|
31
|
+
description: 'Choose how to set the owner.',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Owner',
|
|
35
|
+
name: 'OwnerIdSelect',
|
|
36
|
+
type: 'options',
|
|
37
|
+
typeOptions: { loadOptionsMethod: 'getUsers' },
|
|
38
|
+
default: '',
|
|
39
|
+
displayOptions: { show: { ...showFor(op), OwnerMode: ['select'] } },
|
|
40
|
+
description: 'Select the deal owner (required if select mode).',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Owner ID',
|
|
44
|
+
name: 'OwnerIdManual',
|
|
45
|
+
type: 'string',
|
|
46
|
+
default: '',
|
|
47
|
+
displayOptions: { show: { ...showFor(op), OwnerMode: ['manual'] } },
|
|
48
|
+
description: 'Enter owner ID manually (required if manual mode).',
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
51
|
+
exports.ownerFields = ownerFields;
|
|
52
|
+
// 3) Pipeline (select/manual)
|
|
53
|
+
const pipelineFields = (op) => ([
|
|
54
|
+
{
|
|
55
|
+
displayName: 'Pipeline Input Mode',
|
|
56
|
+
name: 'PipelineMode',
|
|
57
|
+
type: 'options',
|
|
58
|
+
options: [
|
|
59
|
+
{ name: 'Select from list', value: 'select' },
|
|
60
|
+
{ name: 'Enter ID manually', value: 'manual' },
|
|
61
|
+
],
|
|
62
|
+
default: 'select',
|
|
63
|
+
displayOptions: { show: showFor(op) },
|
|
64
|
+
description: 'Choose how to set the pipeline.',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Pipeline',
|
|
68
|
+
name: 'PipelineIdSelect',
|
|
69
|
+
type: 'options',
|
|
70
|
+
typeOptions: { loadOptionsMethod: 'getPipelines' },
|
|
71
|
+
default: '',
|
|
72
|
+
displayOptions: { show: { ...showFor(op), PipelineMode: ['select'] } },
|
|
73
|
+
description: 'Pick a pipeline (required if select mode).',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Pipeline ID',
|
|
77
|
+
name: 'PipelineId',
|
|
78
|
+
type: 'string',
|
|
79
|
+
default: '',
|
|
80
|
+
displayOptions: { show: { ...showFor(op), PipelineMode: ['manual'] } },
|
|
81
|
+
description: 'Enter pipeline ID (required if manual mode).',
|
|
82
|
+
},
|
|
83
|
+
]);
|
|
84
|
+
exports.pipelineFields = pipelineFields;
|
|
85
|
+
// 4) Stage (select/manual)
|
|
86
|
+
const stageFields = (op) => ([
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Stage Input Mode',
|
|
89
|
+
name: 'StageMode',
|
|
90
|
+
type: 'options',
|
|
91
|
+
options: [
|
|
92
|
+
{ name: 'Select from list', value: 'select' },
|
|
93
|
+
{ name: 'Enter ID manually', value: 'manual' },
|
|
94
|
+
],
|
|
95
|
+
default: 'select',
|
|
96
|
+
displayOptions: { show: showFor(op) },
|
|
97
|
+
description: 'Choose how to set the stage.',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Pipeline Stage',
|
|
101
|
+
name: 'PipelineStageIdSelect',
|
|
102
|
+
type: 'options',
|
|
103
|
+
typeOptions: {
|
|
104
|
+
loadOptionsMethod: 'getStagesForPipeline',
|
|
105
|
+
loadOptionsDependsOn: ['PipelineIdSelect'],
|
|
106
|
+
},
|
|
107
|
+
default: '',
|
|
108
|
+
displayOptions: {
|
|
109
|
+
show: { ...showFor(op), StageMode: ['select'], PipelineMode: ['select'] },
|
|
110
|
+
},
|
|
111
|
+
description: 'Pick a stage (required if select mode).',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
displayName: 'Pipeline Stage ID',
|
|
115
|
+
name: 'PipelineStageId',
|
|
116
|
+
type: 'string',
|
|
117
|
+
default: '',
|
|
118
|
+
displayOptions: { show: { ...showFor(op), StageMode: ['manual'] } },
|
|
119
|
+
description: 'Enter stage ID (required if manual mode).',
|
|
120
|
+
},
|
|
121
|
+
]);
|
|
122
|
+
exports.stageFields = stageFields;
|
|
123
|
+
// 5) Person / 6) Company
|
|
124
|
+
const personCompanyFields = (op) => ([
|
|
125
|
+
{
|
|
126
|
+
displayName: 'Person ID',
|
|
127
|
+
name: 'PersonId',
|
|
128
|
+
type: 'string',
|
|
129
|
+
default: '00000000-0000-0000-0000-000000000000',
|
|
130
|
+
displayOptions: { show: showFor(op) },
|
|
131
|
+
description: 'Person ID related to the deal (required).',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Company ID',
|
|
135
|
+
name: 'CompanyId',
|
|
136
|
+
type: 'string',
|
|
137
|
+
default: '00000000-0000-0000-0000-000000000000',
|
|
138
|
+
displayOptions: { show: showFor(op) },
|
|
139
|
+
description: 'Company ID related to the deal (required).',
|
|
140
|
+
},
|
|
141
|
+
]);
|
|
142
|
+
exports.personCompanyFields = personCompanyFields;
|
|
143
|
+
// Status
|
|
144
|
+
const statusField = (op) => ({
|
|
145
|
+
displayName: 'Status',
|
|
146
|
+
name: 'Status',
|
|
147
|
+
type: 'options',
|
|
148
|
+
options: [
|
|
149
|
+
{ name: 'Pending', value: 'Pending' },
|
|
150
|
+
{ name: 'Won', value: 'Won' },
|
|
151
|
+
{ name: 'Lost', value: 'Lost' },
|
|
152
|
+
],
|
|
153
|
+
default: 'Pending',
|
|
154
|
+
displayOptions: { show: showFor(op) },
|
|
155
|
+
description: 'Deal status (required).',
|
|
156
|
+
});
|
|
157
|
+
exports.statusField = statusField;
|
|
158
|
+
// Additional Fields
|
|
159
|
+
const additionalFields = (op) => ({
|
|
160
|
+
displayName: 'Additional Fields',
|
|
161
|
+
name: 'additionalFields',
|
|
162
|
+
type: 'collection',
|
|
163
|
+
placeholder: 'Add field',
|
|
164
|
+
default: {},
|
|
165
|
+
displayOptions: { show: showFor(op) },
|
|
166
|
+
options: [
|
|
167
|
+
{ displayName: 'Source ID', name: 'SourceId', type: 'string', default: '00000000-0000-0000-0000-000000000000', description: 'Source identifier (optional).' },
|
|
168
|
+
{ displayName: 'Source Other', name: 'SourceOther', type: 'string', default: '', description: 'Custom text for other/unlisted sources.' },
|
|
169
|
+
{ displayName: 'Lost Reason ID', name: 'LostReasonId', type: 'string', default: '00000000-0000-0000-0000-000000000000', description: 'Lost reason identifier.' },
|
|
170
|
+
{ displayName: 'Lost Reason Note', name: 'LostReasonNote', type: 'string', default: '', description: 'Additional notes for lost reason.' },
|
|
171
|
+
{ displayName: 'Lost Reason Other', name: 'LostReasonOther', type: 'string', default: '', description: 'Custom lost reason text.' },
|
|
172
|
+
{ displayName: 'Description', name: 'Description', type: 'string', default: '', description: 'Optional description for the deal.' },
|
|
173
|
+
{ displayName: 'Creator ID', name: 'CreatorId', type: 'string', default: '00000000-0000-0000-0000-000000000000', description: 'Creator user ID (defaults to owner if empty).' },
|
|
174
|
+
{ displayName: 'Price', name: 'Price', type: 'string', default: '0', description: 'Deal price/amount.' },
|
|
175
|
+
{
|
|
176
|
+
displayName: 'Visibility Type',
|
|
177
|
+
name: 'VisibilityType',
|
|
178
|
+
type: 'options',
|
|
179
|
+
options: [
|
|
180
|
+
{ name: 'Owner', value: 'Owner' },
|
|
181
|
+
{ name: 'Owner Group', value: 'OwnerGroup' },
|
|
182
|
+
{ name: 'Owner SubGroup', value: 'OwnerSubGroup' },
|
|
183
|
+
{ name: 'All', value: 'All' },
|
|
184
|
+
],
|
|
185
|
+
default: 'Owner',
|
|
186
|
+
description: 'Visibility setting.',
|
|
187
|
+
},
|
|
188
|
+
{ displayName: 'Custom Fields (JSON)', name: 'Fields', type: 'json', default: '', placeholder: '{ "Field_8783_12_4": 12 }', description: 'JSON object of custom fields.' },
|
|
189
|
+
],
|
|
190
|
+
});
|
|
191
|
+
exports.additionalFields = additionalFields;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dealCreateProperties = void 0;
|
|
4
|
+
const _shared_fields_1 = require("./_shared.fields");
|
|
5
|
+
exports.dealCreateProperties = [
|
|
6
|
+
(0, _shared_fields_1.titleField)('create'),
|
|
7
|
+
...(0, _shared_fields_1.ownerFields)('create'),
|
|
8
|
+
...(0, _shared_fields_1.pipelineFields)('create'),
|
|
9
|
+
...(0, _shared_fields_1.stageFields)('create'),
|
|
10
|
+
...(0, _shared_fields_1.personCompanyFields)('create'),
|
|
11
|
+
(0, _shared_fields_1.statusField)('create'),
|
|
12
|
+
(0, _shared_fields_1.additionalFields)('create'),
|
|
13
|
+
];
|
|
@@ -6,11 +6,10 @@ async function dealGet(i, returnData) {
|
|
|
6
6
|
const dealId = this.getNodeParameter('dealId', i, '');
|
|
7
7
|
if (!dealId)
|
|
8
8
|
throw new Error('Deal Id is required.');
|
|
9
|
-
// اگر endpoint دقیق get چیز دیگری است، اینجا عوض کن
|
|
10
9
|
const resp = await (0, http_1.didarRequest)(this, i, {
|
|
11
|
-
method: '
|
|
12
|
-
path: '/api/deal/
|
|
13
|
-
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/api/deal/getdealdetail',
|
|
12
|
+
body: { Id: dealId },
|
|
14
13
|
});
|
|
15
14
|
returnData.push({ json: resp });
|
|
16
15
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dealGetProperties = void 0;
|
|
4
|
+
exports.dealGetProperties = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Deal Id',
|
|
7
|
+
name: 'dealId',
|
|
8
|
+
type: 'string',
|
|
9
|
+
default: '',
|
|
10
|
+
displayOptions: { show: { resource: ['deal'], operation: ['get'] } },
|
|
11
|
+
description: 'Deal Id to fetch (required).',
|
|
12
|
+
},
|
|
13
|
+
];
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { dealCreate } from './create.operation';
|
|
2
2
|
export { dealUpdate } from './update.operation';
|
|
3
3
|
export { dealGet } from './get.operation';
|
|
4
|
+
export { dealCreateProperties } from './create.properties';
|
|
5
|
+
export { dealUpdateProperties } from './update.properties';
|
|
6
|
+
export { dealGetProperties } from './get.properties';
|
package/dist/nodes/deal/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dealGet = exports.dealUpdate = exports.dealCreate = void 0;
|
|
3
|
+
exports.dealGetProperties = exports.dealUpdateProperties = exports.dealCreateProperties = exports.dealGet = exports.dealUpdate = exports.dealCreate = void 0;
|
|
4
4
|
var create_operation_1 = require("./create.operation");
|
|
5
5
|
Object.defineProperty(exports, "dealCreate", { enumerable: true, get: function () { return create_operation_1.dealCreate; } });
|
|
6
6
|
var update_operation_1 = require("./update.operation");
|
|
7
7
|
Object.defineProperty(exports, "dealUpdate", { enumerable: true, get: function () { return update_operation_1.dealUpdate; } });
|
|
8
8
|
var get_operation_1 = require("./get.operation");
|
|
9
9
|
Object.defineProperty(exports, "dealGet", { enumerable: true, get: function () { return get_operation_1.dealGet; } });
|
|
10
|
+
var create_properties_1 = require("./create.properties");
|
|
11
|
+
Object.defineProperty(exports, "dealCreateProperties", { enumerable: true, get: function () { return create_properties_1.dealCreateProperties; } });
|
|
12
|
+
var update_properties_1 = require("./update.properties");
|
|
13
|
+
Object.defineProperty(exports, "dealUpdateProperties", { enumerable: true, get: function () { return update_properties_1.dealUpdateProperties; } });
|
|
14
|
+
var get_properties_1 = require("./get.properties");
|
|
15
|
+
Object.defineProperty(exports, "dealGetProperties", { enumerable: true, get: function () { return get_properties_1.dealGetProperties; } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dealUpdateProperties = void 0;
|
|
4
|
+
const _shared_fields_1 = require("./_shared.fields");
|
|
5
|
+
exports.dealUpdateProperties = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Id',
|
|
8
|
+
name: 'Id',
|
|
9
|
+
type: 'string',
|
|
10
|
+
default: '',
|
|
11
|
+
displayOptions: { show: { resource: ['deal'], operation: ['update'] } },
|
|
12
|
+
description: 'Deal Id to update (required).',
|
|
13
|
+
},
|
|
14
|
+
(0, _shared_fields_1.titleField)('update'),
|
|
15
|
+
...(0, _shared_fields_1.ownerFields)('update'),
|
|
16
|
+
...(0, _shared_fields_1.pipelineFields)('update'),
|
|
17
|
+
...(0, _shared_fields_1.stageFields)('update'),
|
|
18
|
+
...(0, _shared_fields_1.personCompanyFields)('update'),
|
|
19
|
+
(0, _shared_fields_1.statusField)('update'),
|
|
20
|
+
(0, _shared_fields_1.additionalFields)('update'),
|
|
21
|
+
];
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.personCreate = personCreate;
|
|
4
|
+
const http_1 = require("../../lib/http");
|
|
5
|
+
async function personCreate(i, returnData) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
7
|
+
// Required LastName
|
|
8
|
+
const lastName = this.getNodeParameter('LastName', i, '');
|
|
9
|
+
if (!lastName)
|
|
10
|
+
throw new Error('LastName is required.');
|
|
11
|
+
// First layer fields
|
|
12
|
+
const firstName = this.getNodeParameter('FirstName', i, '');
|
|
13
|
+
const mobile = this.getNodeParameter('MobilePhone', i, '');
|
|
14
|
+
const workPhone = this.getNodeParameter('WorkPhone', i, '');
|
|
15
|
+
// Owner selection
|
|
16
|
+
const ownerMode = this.getNodeParameter('OwnerMode', i);
|
|
17
|
+
const ownerId = ownerMode === 'select'
|
|
18
|
+
? this.getNodeParameter('OwnerIdSelect', i, '')
|
|
19
|
+
: this.getNodeParameter('OwnerIdManual', i, '');
|
|
20
|
+
if (!ownerId)
|
|
21
|
+
throw new Error('OwnerId is required (select from list or enter manually).');
|
|
22
|
+
// Additional fields
|
|
23
|
+
const add = this.getNodeParameter('additionalFields', i, {}) || {};
|
|
24
|
+
const title = (_a = add.Title) !== null && _a !== void 0 ? _a : '';
|
|
25
|
+
const companyName = (_b = add.CompanyName) !== null && _b !== void 0 ? _b : '';
|
|
26
|
+
const companyId = (_c = add.CompanyId) !== null && _c !== void 0 ? _c : '00000000-0000-0000-0000-000000000000';
|
|
27
|
+
const birthDate = (_d = add.BirthDate) !== null && _d !== void 0 ? _d : '';
|
|
28
|
+
const birthDateMessageId = (_e = add.BirthDateMessageId) !== null && _e !== void 0 ? _e : '00000000-0000-0000-0000-000000000000';
|
|
29
|
+
const workPhoneExt = (_f = add.WorkPhoneExtension) !== null && _f !== void 0 ? _f : '';
|
|
30
|
+
const fax = (_g = add.Fax) !== null && _g !== void 0 ? _g : '';
|
|
31
|
+
const email = (_h = add.Email) !== null && _h !== void 0 ? _h : '';
|
|
32
|
+
const isVip = (_j = add.IsVIP) !== null && _j !== void 0 ? _j : false;
|
|
33
|
+
const backgroundInfo = (_k = add.BackgroundInfo) !== null && _k !== void 0 ? _k : '';
|
|
34
|
+
const position = (_l = add.Position) !== null && _l !== void 0 ? _l : '';
|
|
35
|
+
const customerCode = (_m = add.CustomerCode) !== null && _m !== void 0 ? _m : '';
|
|
36
|
+
const nationalCode = (_o = add.NationalCode) !== null && _o !== void 0 ? _o : '';
|
|
37
|
+
const zipCode = (_p = add.ZipCode) !== null && _p !== void 0 ? _p : '';
|
|
38
|
+
const visibilityType = (_q = add.VisibilityType) !== null && _q !== void 0 ? _q : 'Owner';
|
|
39
|
+
// Fields (JSON or object)
|
|
40
|
+
let fields;
|
|
41
|
+
if (typeof add.Fields === 'string' && add.Fields.trim()) {
|
|
42
|
+
try {
|
|
43
|
+
fields = JSON.parse(add.Fields);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
throw new Error('Invalid JSON in "Custom Fields (JSON)".');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (typeof add.Fields === 'object' && add.Fields) {
|
|
50
|
+
fields = add.Fields;
|
|
51
|
+
}
|
|
52
|
+
// Helper to convert fixedCollection multipleValues => { KeyValues: [{Key,Value}, ...] }
|
|
53
|
+
const toKeyValues = (obj) => {
|
|
54
|
+
var _a;
|
|
55
|
+
if (!obj || typeof obj !== 'object')
|
|
56
|
+
return undefined;
|
|
57
|
+
const list = (_a = obj.KeyValues) !== null && _a !== void 0 ? _a : [];
|
|
58
|
+
if (!Array.isArray(list) || !list.length)
|
|
59
|
+
return undefined;
|
|
60
|
+
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 : '' }); }) };
|
|
61
|
+
};
|
|
62
|
+
// Websites / OtherPhones / OtherEmails / Addresses
|
|
63
|
+
const websites = toKeyValues(add.Websites);
|
|
64
|
+
const otherPhones = toKeyValues(add.OtherPhones);
|
|
65
|
+
const otherEmails = toKeyValues(add.OtherEmails);
|
|
66
|
+
const addresses = toKeyValues(add.Addresses);
|
|
67
|
+
// BankAccounts: { Values: [{Value1,Value2,Value3,Value4}, ...] }
|
|
68
|
+
let bankAccounts;
|
|
69
|
+
if (add.BankAccounts && typeof add.BankAccounts === 'object') {
|
|
70
|
+
const vals = add.BankAccounts.Values;
|
|
71
|
+
if (Array.isArray(vals) && vals.length) {
|
|
72
|
+
bankAccounts = { Values: vals.map(v => {
|
|
73
|
+
var _a, _b, _c, _d;
|
|
74
|
+
return ({
|
|
75
|
+
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 : '',
|
|
76
|
+
});
|
|
77
|
+
}) };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// SegmentIds: string[]
|
|
81
|
+
let segmentIds;
|
|
82
|
+
const seg = add.SegmentIds;
|
|
83
|
+
if (Array.isArray(seg))
|
|
84
|
+
segmentIds = seg.filter(Boolean);
|
|
85
|
+
else if (typeof seg === 'string' && seg)
|
|
86
|
+
segmentIds = [seg];
|
|
87
|
+
// بدنه Contact
|
|
88
|
+
const contact = {
|
|
89
|
+
Type: 'Person', // hidden field, always set
|
|
90
|
+
FirstName: firstName,
|
|
91
|
+
LastName: lastName,
|
|
92
|
+
Title: title,
|
|
93
|
+
OwnerId: ownerId,
|
|
94
|
+
CompanyName: companyName,
|
|
95
|
+
CompanyId: companyId,
|
|
96
|
+
BirthDate: birthDate || undefined,
|
|
97
|
+
BirthDateMessageId: birthDateMessageId,
|
|
98
|
+
MobilePhone: mobile,
|
|
99
|
+
WorkPhone: workPhone,
|
|
100
|
+
WorkPhoneExtension: workPhoneExt,
|
|
101
|
+
Fax: fax,
|
|
102
|
+
Email: email,
|
|
103
|
+
IsVIP: isVip,
|
|
104
|
+
BackgroundInfo: backgroundInfo,
|
|
105
|
+
Position: position,
|
|
106
|
+
CustomerCode: customerCode,
|
|
107
|
+
NationalCode: nationalCode,
|
|
108
|
+
ZipCode: zipCode,
|
|
109
|
+
VisibilityType: visibilityType,
|
|
110
|
+
};
|
|
111
|
+
if (fields)
|
|
112
|
+
contact['Fields'] = fields;
|
|
113
|
+
if (websites)
|
|
114
|
+
contact['Websites'] = websites;
|
|
115
|
+
if (otherPhones)
|
|
116
|
+
contact['OtherPhones'] = otherPhones;
|
|
117
|
+
if (otherEmails)
|
|
118
|
+
contact['OtherEmails'] = otherEmails;
|
|
119
|
+
if (addresses)
|
|
120
|
+
contact['Addresses'] = addresses;
|
|
121
|
+
if (bankAccounts)
|
|
122
|
+
contact['BankAccounts'] = bankAccounts;
|
|
123
|
+
const body = { Contact: contact };
|
|
124
|
+
if (segmentIds && segmentIds.length)
|
|
125
|
+
body['SegmentIds'] = segmentIds;
|
|
126
|
+
const resp = await (0, http_1.didarRequest)(this, i, {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
path: '/api/contact/save',
|
|
129
|
+
body,
|
|
130
|
+
});
|
|
131
|
+
returnData.push({ json: resp });
|
|
132
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.personCreateProperties = void 0;
|
|
4
|
+
const showForPersonCreate = { show: { resource: ['person'], operation: ['create'] } };
|
|
5
|
+
exports.personCreateProperties = [
|
|
6
|
+
// --- مین فیلدها (بالا به پایین) ---
|
|
7
|
+
{
|
|
8
|
+
displayName: 'First Name',
|
|
9
|
+
name: 'FirstName',
|
|
10
|
+
type: 'string',
|
|
11
|
+
default: '',
|
|
12
|
+
displayOptions: showForPersonCreate,
|
|
13
|
+
description: 'Optional given name of the person.',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Last Name',
|
|
17
|
+
name: 'LastName',
|
|
18
|
+
type: 'string',
|
|
19
|
+
default: '',
|
|
20
|
+
required: true,
|
|
21
|
+
displayOptions: showForPersonCreate,
|
|
22
|
+
description: 'Required family name (last name) of the person.',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
displayName: 'Mobile Phone',
|
|
26
|
+
name: 'MobilePhone',
|
|
27
|
+
type: 'string',
|
|
28
|
+
default: '',
|
|
29
|
+
displayOptions: showForPersonCreate,
|
|
30
|
+
description: 'Primary mobile phone number.',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Work Phone',
|
|
34
|
+
name: 'WorkPhone',
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: '',
|
|
37
|
+
displayOptions: showForPersonCreate,
|
|
38
|
+
description: 'Work phone number.',
|
|
39
|
+
},
|
|
40
|
+
// --- Owner (Select/Manual) مثل Deal ---
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Owner Input Mode',
|
|
43
|
+
name: 'OwnerMode',
|
|
44
|
+
type: 'options',
|
|
45
|
+
options: [
|
|
46
|
+
{ name: 'Select from list', value: 'select' },
|
|
47
|
+
{ name: 'Enter ID manually', value: 'manual' },
|
|
48
|
+
],
|
|
49
|
+
default: 'select',
|
|
50
|
+
displayOptions: showForPersonCreate,
|
|
51
|
+
description: 'Choose how to set the owner of this person.',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Owner',
|
|
55
|
+
name: 'OwnerIdSelect',
|
|
56
|
+
type: 'options',
|
|
57
|
+
typeOptions: { loadOptionsMethod: 'getUsers' },
|
|
58
|
+
default: '',
|
|
59
|
+
displayOptions: { show: { ...showForPersonCreate.show, OwnerMode: ['select'] } },
|
|
60
|
+
description: 'Select the owner user (required if select mode).',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Owner ID',
|
|
64
|
+
name: 'OwnerIdManual',
|
|
65
|
+
type: 'string',
|
|
66
|
+
default: '',
|
|
67
|
+
displayOptions: { show: { ...showForPersonCreate.show, OwnerMode: ['manual'] } },
|
|
68
|
+
description: 'Enter owner user ID manually (required if manual mode).',
|
|
69
|
+
},
|
|
70
|
+
// --- Additional Fields ---
|
|
71
|
+
{
|
|
72
|
+
displayName: 'Additional Fields',
|
|
73
|
+
name: 'additionalFields',
|
|
74
|
+
type: 'collection',
|
|
75
|
+
placeholder: 'Add field',
|
|
76
|
+
default: {},
|
|
77
|
+
displayOptions: showForPersonCreate,
|
|
78
|
+
options: [
|
|
79
|
+
{ displayName: 'Title', name: 'Title', type: 'string', default: '', description: 'Honorific or title (e.g., Mr., Ms., Dr.).' },
|
|
80
|
+
{ displayName: 'Company Name', name: 'CompanyName', type: 'string', default: '', description: 'Related company name (plain text).' },
|
|
81
|
+
{ displayName: 'Company ID', name: 'CompanyId', type: 'string', default: '00000000-0000-0000-0000-000000000000', description: 'Related company ID (GUID).' },
|
|
82
|
+
{ displayName: 'Birth Date (ISO)', name: 'BirthDate', type: 'string', default: '', description: 'Birth date in ISO format (e.g., 2025-08-31T08:02:06Z).' },
|
|
83
|
+
{ displayName: 'Birth Date Message ID', name: 'BirthDateMessageId', type: 'string', default: '00000000-0000-0000-0000-000000000000', description: 'Notification/message template ID for birthday (GUID).' },
|
|
84
|
+
{ displayName: 'Work Phone Extension', name: 'WorkPhoneExtension', type: 'string', default: '', description: 'Extension for the work phone.' },
|
|
85
|
+
{ displayName: 'Fax', name: 'Fax', type: 'string', default: '', description: 'Fax number.' },
|
|
86
|
+
{ displayName: 'Email', name: 'Email', type: 'string', default: '', description: 'Primary email address.' },
|
|
87
|
+
{ displayName: 'Is VIP', name: 'IsVIP', type: 'boolean', default: false, description: 'Mark this person as VIP.' },
|
|
88
|
+
{ displayName: 'Background Info', name: 'BackgroundInfo', type: 'string', default: '', description: 'Notes or background information.' },
|
|
89
|
+
{ displayName: 'Position', name: 'Position', type: 'string', default: '', description: 'Job title or position.' },
|
|
90
|
+
{ displayName: 'Customer Code', name: 'CustomerCode', type: 'string', default: '', description: 'Internal or CRM customer code.' },
|
|
91
|
+
{ displayName: 'National Code', name: 'NationalCode', type: 'string', default: '', description: 'National ID code.' },
|
|
92
|
+
{ displayName: 'Zip Code', name: 'ZipCode', type: 'string', default: '', description: 'Postal/ZIP code.' },
|
|
93
|
+
// VisibilityType مانند Deal
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Visibility Type',
|
|
96
|
+
name: 'VisibilityType',
|
|
97
|
+
type: 'options',
|
|
98
|
+
options: [
|
|
99
|
+
{ name: 'Owner', value: 'Owner' },
|
|
100
|
+
{ name: 'Owner Group', value: 'OwnerGroup' },
|
|
101
|
+
{ name: 'Owner SubGroup', value: 'OwnerSubGroup' },
|
|
102
|
+
{ name: 'All', value: 'All' },
|
|
103
|
+
],
|
|
104
|
+
default: 'Owner',
|
|
105
|
+
description: 'Visibility setting for this person.',
|
|
106
|
+
},
|
|
107
|
+
// Fields (JSON) مثل Deal
|
|
108
|
+
{
|
|
109
|
+
displayName: 'Custom Fields (JSON)',
|
|
110
|
+
name: 'Fields',
|
|
111
|
+
type: 'json',
|
|
112
|
+
default: '',
|
|
113
|
+
placeholder: '{ "Field_996_0_7": "value" }',
|
|
114
|
+
description: 'JSON object of custom fields.',
|
|
115
|
+
},
|
|
116
|
+
// Websites (Key/Value list)
|
|
117
|
+
{
|
|
118
|
+
displayName: 'Websites',
|
|
119
|
+
name: 'Websites',
|
|
120
|
+
type: 'fixedCollection',
|
|
121
|
+
typeOptions: { multipleValues: true },
|
|
122
|
+
default: {},
|
|
123
|
+
options: [
|
|
124
|
+
{
|
|
125
|
+
name: 'KeyValues',
|
|
126
|
+
displayName: 'Website',
|
|
127
|
+
values: [
|
|
128
|
+
{ displayName: 'Key', name: 'Key', type: 'string', default: '' },
|
|
129
|
+
{ displayName: 'Value', name: 'Value', type: 'string', default: '' },
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
description: 'List of websites as key/value pairs.',
|
|
134
|
+
},
|
|
135
|
+
// OtherPhones (Key/Value list)
|
|
136
|
+
{
|
|
137
|
+
displayName: 'Other Phones',
|
|
138
|
+
name: 'OtherPhones',
|
|
139
|
+
type: 'fixedCollection',
|
|
140
|
+
typeOptions: { multipleValues: true },
|
|
141
|
+
default: {},
|
|
142
|
+
options: [
|
|
143
|
+
{
|
|
144
|
+
name: 'KeyValues',
|
|
145
|
+
displayName: 'Phone',
|
|
146
|
+
values: [
|
|
147
|
+
{ displayName: 'Key', name: 'Key', type: 'string', default: '' },
|
|
148
|
+
{ displayName: 'Value', name: 'Value', type: 'string', default: '' },
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
description: 'Additional phone numbers as key/value pairs.',
|
|
153
|
+
},
|
|
154
|
+
// OtherEmails (Key/Value list)
|
|
155
|
+
{
|
|
156
|
+
displayName: 'Other Emails',
|
|
157
|
+
name: 'OtherEmails',
|
|
158
|
+
type: 'fixedCollection',
|
|
159
|
+
typeOptions: { multipleValues: true },
|
|
160
|
+
default: {},
|
|
161
|
+
options: [
|
|
162
|
+
{
|
|
163
|
+
name: 'KeyValues',
|
|
164
|
+
displayName: 'Email',
|
|
165
|
+
values: [
|
|
166
|
+
{ displayName: 'Key', name: 'Key', type: 'string', default: '' },
|
|
167
|
+
{ displayName: 'Value', name: 'Value', type: 'string', default: '' },
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
description: 'Additional emails as key/value pairs.',
|
|
172
|
+
},
|
|
173
|
+
// Addresses (Key/Value list)
|
|
174
|
+
{
|
|
175
|
+
displayName: 'Addresses',
|
|
176
|
+
name: 'Addresses',
|
|
177
|
+
type: 'fixedCollection',
|
|
178
|
+
typeOptions: { multipleValues: true },
|
|
179
|
+
default: {},
|
|
180
|
+
options: [
|
|
181
|
+
{
|
|
182
|
+
name: 'KeyValues',
|
|
183
|
+
displayName: 'Address',
|
|
184
|
+
values: [
|
|
185
|
+
{ displayName: 'Key', name: 'Key', type: 'string', default: '' },
|
|
186
|
+
{ displayName: 'Value', name: 'Value', type: 'string', default: '' },
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
description: 'Addresses as key/value pairs (e.g., Home/Work/etc.).',
|
|
191
|
+
},
|
|
192
|
+
// BankAccounts (Values[4])
|
|
193
|
+
{
|
|
194
|
+
displayName: 'Bank Accounts',
|
|
195
|
+
name: 'BankAccounts',
|
|
196
|
+
type: 'fixedCollection',
|
|
197
|
+
typeOptions: { multipleValues: true },
|
|
198
|
+
default: {},
|
|
199
|
+
options: [
|
|
200
|
+
{
|
|
201
|
+
name: 'Values',
|
|
202
|
+
displayName: 'Bank Account',
|
|
203
|
+
values: [
|
|
204
|
+
{ displayName: 'Value1', name: 'Value1', type: 'string', default: '' },
|
|
205
|
+
{ displayName: 'Value2', name: 'Value2', type: 'string', default: '' },
|
|
206
|
+
{ displayName: 'Value3', name: 'Value3', type: 'string', default: '' },
|
|
207
|
+
{ displayName: 'Value4', name: 'Value4', type: 'string', default: '' },
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
description: 'Bank account details (four flexible fields per entry).',
|
|
212
|
+
},
|
|
213
|
+
// SegmentIds (string[])
|
|
214
|
+
{
|
|
215
|
+
displayName: 'Segment IDs',
|
|
216
|
+
name: 'SegmentIds',
|
|
217
|
+
type: 'string',
|
|
218
|
+
typeOptions: { multipleValues: true }, // returns string[]
|
|
219
|
+
default: [],
|
|
220
|
+
description: 'List of segment IDs (GUIDs).',
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
},
|
|
224
|
+
];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.personCreateProperties = exports.personCreate = void 0;
|
|
4
|
+
// src/nodes/person/index.ts
|
|
5
|
+
var create_operation_1 = require("./create.operation");
|
|
6
|
+
Object.defineProperty(exports, "personCreate", { enumerable: true, get: function () { return create_operation_1.personCreate; } });
|
|
7
|
+
var create_properties_1 = require("./create.properties");
|
|
8
|
+
Object.defineProperty(exports, "personCreateProperties", { enumerable: true, get: function () { return create_properties_1.personCreateProperties; } });
|