@23blocks/block-crm 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1516 -23
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/lib/crm.block.d.ts +19 -1
- package/dist/src/lib/crm.block.d.ts.map +1 -1
- package/dist/src/lib/mappers/account-document.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/account-document.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/busy-block.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/busy-block.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/calendar-account.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/calendar-account.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/category.mapper.d.ts +5 -0
- package/dist/src/lib/mappers/category.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/contact-event.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/contact-event.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/ics-token.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/ics-token.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/index.d.ts +16 -0
- package/dist/src/lib/mappers/index.d.ts.map +1 -1
- package/dist/src/lib/mappers/lead-follow.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/lead-follow.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/mail-template.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/mail-template.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/meeting-billing.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/meeting-billing.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/meeting-participant.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/meeting-participant.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/referral.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/referral.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/subscriber.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/subscriber.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/touch.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/touch.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/user.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/user.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/zoom-host.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/zoom-host.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/zoom-meeting.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/zoom-meeting.mapper.d.ts.map +1 -0
- package/dist/src/lib/services/billing-reports.service.d.ts +11 -0
- package/dist/src/lib/services/billing-reports.service.d.ts.map +1 -0
- package/dist/src/lib/services/busy-blocks.service.d.ts +11 -0
- package/dist/src/lib/services/busy-blocks.service.d.ts.map +1 -0
- package/dist/src/lib/services/calendar-accounts.service.d.ts +15 -0
- package/dist/src/lib/services/calendar-accounts.service.d.ts.map +1 -0
- package/dist/src/lib/services/calendar-sync.service.d.ts +15 -0
- package/dist/src/lib/services/calendar-sync.service.d.ts.map +1 -0
- package/dist/src/lib/services/categories.service.d.ts +13 -0
- package/dist/src/lib/services/categories.service.d.ts.map +1 -0
- package/dist/src/lib/services/communications.service.d.ts +9 -0
- package/dist/src/lib/services/communications.service.d.ts.map +1 -0
- package/dist/src/lib/services/contact-events.service.d.ts +21 -0
- package/dist/src/lib/services/contact-events.service.d.ts.map +1 -0
- package/dist/src/lib/services/ics-tokens.service.d.ts +11 -0
- package/dist/src/lib/services/ics-tokens.service.d.ts.map +1 -0
- package/dist/src/lib/services/index.d.ts +18 -0
- package/dist/src/lib/services/index.d.ts.map +1 -1
- package/dist/src/lib/services/lead-follows.service.d.ts +13 -0
- package/dist/src/lib/services/lead-follows.service.d.ts.map +1 -0
- package/dist/src/lib/services/mail-templates.service.d.ts +16 -0
- package/dist/src/lib/services/mail-templates.service.d.ts.map +1 -0
- package/dist/src/lib/services/meeting-billings.service.d.ts +19 -0
- package/dist/src/lib/services/meeting-billings.service.d.ts.map +1 -0
- package/dist/src/lib/services/meeting-participants.service.d.ts +11 -0
- package/dist/src/lib/services/meeting-participants.service.d.ts.map +1 -0
- package/dist/src/lib/services/referrals.service.d.ts +13 -0
- package/dist/src/lib/services/referrals.service.d.ts.map +1 -0
- package/dist/src/lib/services/subscribers.service.d.ts +13 -0
- package/dist/src/lib/services/subscribers.service.d.ts.map +1 -0
- package/dist/src/lib/services/touches.service.d.ts +13 -0
- package/dist/src/lib/services/touches.service.d.ts.map +1 -0
- package/dist/src/lib/services/users.service.d.ts +16 -0
- package/dist/src/lib/services/users.service.d.ts.map +1 -0
- package/dist/src/lib/services/zoom-hosts.service.d.ts +16 -0
- package/dist/src/lib/services/zoom-hosts.service.d.ts.map +1 -0
- package/dist/src/lib/services/zoom-meetings.service.d.ts +13 -0
- package/dist/src/lib/services/zoom-meetings.service.d.ts.map +1 -0
- package/dist/src/lib/types/account-document.d.ts +54 -0
- package/dist/src/lib/types/account-document.d.ts.map +1 -0
- package/dist/src/lib/types/billing-report.d.ts +51 -0
- package/dist/src/lib/types/billing-report.d.ts.map +1 -0
- package/dist/src/lib/types/busy-block.d.ts +35 -0
- package/dist/src/lib/types/busy-block.d.ts.map +1 -0
- package/dist/src/lib/types/calendar-account.d.ts +58 -0
- package/dist/src/lib/types/calendar-account.d.ts.map +1 -0
- package/dist/src/lib/types/category.d.ts +61 -0
- package/dist/src/lib/types/category.d.ts.map +1 -0
- package/dist/src/lib/types/communication.d.ts +12 -0
- package/dist/src/lib/types/communication.d.ts.map +1 -0
- package/dist/src/lib/types/contact-event.d.ts +64 -0
- package/dist/src/lib/types/contact-event.d.ts.map +1 -0
- package/dist/src/lib/types/ics-token.d.ts +28 -0
- package/dist/src/lib/types/ics-token.d.ts.map +1 -0
- package/dist/src/lib/types/index.d.ts +18 -0
- package/dist/src/lib/types/index.d.ts.map +1 -1
- package/dist/src/lib/types/lead-follow.d.ts +38 -0
- package/dist/src/lib/types/lead-follow.d.ts.map +1 -0
- package/dist/src/lib/types/mail-template.d.ts +72 -0
- package/dist/src/lib/types/mail-template.d.ts.map +1 -0
- package/dist/src/lib/types/meeting-billing.d.ts +93 -0
- package/dist/src/lib/types/meeting-billing.d.ts.map +1 -0
- package/dist/src/lib/types/meeting-participant.d.ts +44 -0
- package/dist/src/lib/types/meeting-participant.d.ts.map +1 -0
- package/dist/src/lib/types/referral.d.ts +35 -0
- package/dist/src/lib/types/referral.d.ts.map +1 -0
- package/dist/src/lib/types/subscriber.d.ts +44 -0
- package/dist/src/lib/types/subscriber.d.ts.map +1 -0
- package/dist/src/lib/types/touch.d.ts +46 -0
- package/dist/src/lib/types/touch.d.ts.map +1 -0
- package/dist/src/lib/types/user.d.ts +22 -0
- package/dist/src/lib/types/user.d.ts.map +1 -0
- package/dist/src/lib/types/zoom-host.d.ts +76 -0
- package/dist/src/lib/types/zoom-host.d.ts.map +1 -0
- package/dist/src/lib/types/zoom-meeting.d.ts +50 -0
- package/dist/src/lib/types/zoom-meeting.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decodePageResult, decodeOne } from '@23blocks/jsonapi-codec';
|
|
1
|
+
import { decodePageResult, decodeOne, decodeMany } from '@23blocks/jsonapi-codec';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Parse a string value, returning undefined for empty/undefined
|
|
@@ -46,6 +46,15 @@ import { decodePageResult, decodeOne } from '@23blocks/jsonapi-codec';
|
|
|
46
46
|
}
|
|
47
47
|
return undefined;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Parse a number value
|
|
51
|
+
*/ function parseNumber(value) {
|
|
52
|
+
if (value === null || value === undefined) {
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
const num = Number(value);
|
|
56
|
+
return isNaN(num) ? 0 : num;
|
|
57
|
+
}
|
|
49
58
|
/**
|
|
50
59
|
* Parse an optional number value
|
|
51
60
|
*/ function parseOptionalNumber(value) {
|
|
@@ -324,6 +333,163 @@ function createContactsService(transport, _config) {
|
|
|
324
333
|
};
|
|
325
334
|
}
|
|
326
335
|
|
|
336
|
+
const contactEventMapper = {
|
|
337
|
+
type: 'contact_event',
|
|
338
|
+
map (resource) {
|
|
339
|
+
const attrs = resource.attributes || {};
|
|
340
|
+
return {
|
|
341
|
+
id: resource.id,
|
|
342
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
343
|
+
contactUniqueId: parseString(attrs['contact_unique_id']),
|
|
344
|
+
userUniqueId: parseString(attrs['user_unique_id']),
|
|
345
|
+
eventType: parseString(attrs['event_type']),
|
|
346
|
+
title: parseString(attrs['title']),
|
|
347
|
+
description: parseString(attrs['description']),
|
|
348
|
+
scheduledAt: parseDate(attrs['scheduled_at']),
|
|
349
|
+
startTime: parseDate(attrs['start_time']),
|
|
350
|
+
endTime: parseDate(attrs['end_time']),
|
|
351
|
+
status: parseStatus(attrs['status']),
|
|
352
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
353
|
+
payload: attrs['payload'],
|
|
354
|
+
createdAt: parseDate(attrs['created_at']),
|
|
355
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
function createContactEventsService(transport, _config) {
|
|
361
|
+
return {
|
|
362
|
+
async list (params) {
|
|
363
|
+
const queryParams = {};
|
|
364
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
365
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
366
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
367
|
+
if (params == null ? void 0 : params.eventType) queryParams['event_type'] = params.eventType;
|
|
368
|
+
if (params == null ? void 0 : params.contactUniqueId) queryParams['contact_unique_id'] = params.contactUniqueId;
|
|
369
|
+
if (params == null ? void 0 : params.userUniqueId) queryParams['user_unique_id'] = params.userUniqueId;
|
|
370
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
371
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
372
|
+
const response = await transport.get('/events', {
|
|
373
|
+
params: queryParams
|
|
374
|
+
});
|
|
375
|
+
return decodePageResult(response, contactEventMapper);
|
|
376
|
+
},
|
|
377
|
+
async get (uniqueId) {
|
|
378
|
+
const response = await transport.get(`/events/${uniqueId}`);
|
|
379
|
+
return decodeOne(response, contactEventMapper);
|
|
380
|
+
},
|
|
381
|
+
async create (data) {
|
|
382
|
+
var _data_scheduledAt, _data_startTime, _data_endTime;
|
|
383
|
+
const response = await transport.post('/events', {
|
|
384
|
+
event: {
|
|
385
|
+
contact_unique_id: data.contactUniqueId,
|
|
386
|
+
user_unique_id: data.userUniqueId,
|
|
387
|
+
event_type: data.eventType,
|
|
388
|
+
title: data.title,
|
|
389
|
+
description: data.description,
|
|
390
|
+
scheduled_at: (_data_scheduledAt = data.scheduledAt) == null ? void 0 : _data_scheduledAt.toISOString(),
|
|
391
|
+
start_time: (_data_startTime = data.startTime) == null ? void 0 : _data_startTime.toISOString(),
|
|
392
|
+
end_time: (_data_endTime = data.endTime) == null ? void 0 : _data_endTime.toISOString(),
|
|
393
|
+
payload: data.payload
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
return decodeOne(response, contactEventMapper);
|
|
397
|
+
},
|
|
398
|
+
async update (uniqueId, data) {
|
|
399
|
+
var _data_scheduledAt, _data_startTime, _data_endTime;
|
|
400
|
+
const response = await transport.put(`/events/${uniqueId}`, {
|
|
401
|
+
event: {
|
|
402
|
+
event_type: data.eventType,
|
|
403
|
+
title: data.title,
|
|
404
|
+
description: data.description,
|
|
405
|
+
scheduled_at: (_data_scheduledAt = data.scheduledAt) == null ? void 0 : _data_scheduledAt.toISOString(),
|
|
406
|
+
start_time: (_data_startTime = data.startTime) == null ? void 0 : _data_startTime.toISOString(),
|
|
407
|
+
end_time: (_data_endTime = data.endTime) == null ? void 0 : _data_endTime.toISOString(),
|
|
408
|
+
enabled: data.enabled,
|
|
409
|
+
status: data.status,
|
|
410
|
+
payload: data.payload
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
return decodeOne(response, contactEventMapper);
|
|
414
|
+
},
|
|
415
|
+
async delete (uniqueId) {
|
|
416
|
+
await transport.delete(`/events/${uniqueId}`);
|
|
417
|
+
},
|
|
418
|
+
async studentConfirmation (uniqueId, request) {
|
|
419
|
+
const response = await transport.put(`/events/${uniqueId}/contacts/confirmation`, {
|
|
420
|
+
event: {
|
|
421
|
+
notes: request == null ? void 0 : request.notes,
|
|
422
|
+
payload: request == null ? void 0 : request.payload
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
return decodeOne(response, contactEventMapper);
|
|
426
|
+
},
|
|
427
|
+
async studentCheckin (uniqueId, request) {
|
|
428
|
+
const response = await transport.put(`/events/${uniqueId}/contacts/checking`, {
|
|
429
|
+
event: {
|
|
430
|
+
notes: request == null ? void 0 : request.notes,
|
|
431
|
+
payload: request == null ? void 0 : request.payload
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
return decodeOne(response, contactEventMapper);
|
|
435
|
+
},
|
|
436
|
+
async teacherConfirmation (uniqueId, request) {
|
|
437
|
+
const response = await transport.put(`/events/${uniqueId}/employees/confirmation`, {
|
|
438
|
+
event: {
|
|
439
|
+
notes: request == null ? void 0 : request.notes,
|
|
440
|
+
payload: request == null ? void 0 : request.payload
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
return decodeOne(response, contactEventMapper);
|
|
444
|
+
},
|
|
445
|
+
async teacherCheckin (uniqueId, request) {
|
|
446
|
+
const response = await transport.put(`/events/${uniqueId}/employees/checking`, {
|
|
447
|
+
event: {
|
|
448
|
+
notes: request == null ? void 0 : request.notes,
|
|
449
|
+
payload: request == null ? void 0 : request.payload
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
return decodeOne(response, contactEventMapper);
|
|
453
|
+
},
|
|
454
|
+
async checkout (uniqueId, request) {
|
|
455
|
+
const response = await transport.put(`/events/${uniqueId}/employees/checkout`, {
|
|
456
|
+
event: {
|
|
457
|
+
notes: request == null ? void 0 : request.notes,
|
|
458
|
+
payload: request == null ? void 0 : request.payload
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
return decodeOne(response, contactEventMapper);
|
|
462
|
+
},
|
|
463
|
+
async checkoutStudent (uniqueId, request) {
|
|
464
|
+
const response = await transport.put(`/events/${uniqueId}/contacts/checkout`, {
|
|
465
|
+
event: {
|
|
466
|
+
notes: request == null ? void 0 : request.notes,
|
|
467
|
+
payload: request == null ? void 0 : request.payload
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
return decodeOne(response, contactEventMapper);
|
|
471
|
+
},
|
|
472
|
+
async studentNotes (uniqueId, request) {
|
|
473
|
+
const response = await transport.put(`/events/${uniqueId}/contacts/notes`, {
|
|
474
|
+
event: {
|
|
475
|
+
notes: request.notes,
|
|
476
|
+
payload: request.payload
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
return decodeOne(response, contactEventMapper);
|
|
480
|
+
},
|
|
481
|
+
async adminNotes (uniqueId, request) {
|
|
482
|
+
const response = await transport.put(`/events/${uniqueId}/admin/notes`, {
|
|
483
|
+
event: {
|
|
484
|
+
notes: request.notes,
|
|
485
|
+
payload: request.payload
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
return decodeOne(response, contactEventMapper);
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
|
|
327
493
|
const leadMapper = {
|
|
328
494
|
type: 'Lead',
|
|
329
495
|
map: (resource)=>({
|
|
@@ -453,6 +619,81 @@ function createLeadsService(transport, _config) {
|
|
|
453
619
|
};
|
|
454
620
|
}
|
|
455
621
|
|
|
622
|
+
const leadFollowMapper = {
|
|
623
|
+
type: 'lead_follow',
|
|
624
|
+
map (resource) {
|
|
625
|
+
const attrs = resource.attributes || {};
|
|
626
|
+
return {
|
|
627
|
+
id: resource.id,
|
|
628
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
629
|
+
leadUniqueId: parseString(attrs['lead_unique_id']) || '',
|
|
630
|
+
userUniqueId: parseString(attrs['user_unique_id']),
|
|
631
|
+
followType: parseString(attrs['follow_type']),
|
|
632
|
+
scheduledAt: parseDate(attrs['scheduled_at']),
|
|
633
|
+
completedAt: parseDate(attrs['completed_at']),
|
|
634
|
+
notes: parseString(attrs['notes']),
|
|
635
|
+
status: parseStatus(attrs['status']),
|
|
636
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
637
|
+
payload: attrs['payload'],
|
|
638
|
+
createdAt: parseDate(attrs['created_at']),
|
|
639
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
function createLeadFollowsService(transport, _config) {
|
|
645
|
+
return {
|
|
646
|
+
async list (leadUniqueId, params) {
|
|
647
|
+
const queryParams = {};
|
|
648
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
649
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
650
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
651
|
+
if (params == null ? void 0 : params.followType) queryParams['follow_type'] = params.followType;
|
|
652
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
653
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
654
|
+
const response = await transport.get(`/leads/${leadUniqueId}/follows`, {
|
|
655
|
+
params: queryParams
|
|
656
|
+
});
|
|
657
|
+
return decodePageResult(response, leadFollowMapper);
|
|
658
|
+
},
|
|
659
|
+
async get (leadUniqueId, followUniqueId) {
|
|
660
|
+
const response = await transport.get(`/leads/${leadUniqueId}/follows/${followUniqueId}`);
|
|
661
|
+
return decodeOne(response, leadFollowMapper);
|
|
662
|
+
},
|
|
663
|
+
async create (leadUniqueId, data) {
|
|
664
|
+
var _data_scheduledAt;
|
|
665
|
+
const response = await transport.post(`/leads/${leadUniqueId}/follows`, {
|
|
666
|
+
follow: {
|
|
667
|
+
user_unique_id: data.userUniqueId,
|
|
668
|
+
follow_type: data.followType,
|
|
669
|
+
scheduled_at: (_data_scheduledAt = data.scheduledAt) == null ? void 0 : _data_scheduledAt.toISOString(),
|
|
670
|
+
notes: data.notes,
|
|
671
|
+
payload: data.payload
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
return decodeOne(response, leadFollowMapper);
|
|
675
|
+
},
|
|
676
|
+
async update (leadUniqueId, followUniqueId, data) {
|
|
677
|
+
var _data_scheduledAt, _data_completedAt;
|
|
678
|
+
const response = await transport.put(`/leads/${leadUniqueId}/follows/${followUniqueId}`, {
|
|
679
|
+
follow: {
|
|
680
|
+
follow_type: data.followType,
|
|
681
|
+
scheduled_at: (_data_scheduledAt = data.scheduledAt) == null ? void 0 : _data_scheduledAt.toISOString(),
|
|
682
|
+
completed_at: (_data_completedAt = data.completedAt) == null ? void 0 : _data_completedAt.toISOString(),
|
|
683
|
+
notes: data.notes,
|
|
684
|
+
enabled: data.enabled,
|
|
685
|
+
status: data.status,
|
|
686
|
+
payload: data.payload
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
return decodeOne(response, leadFollowMapper);
|
|
690
|
+
},
|
|
691
|
+
async delete (leadUniqueId, followUniqueId) {
|
|
692
|
+
await transport.delete(`/leads/${leadUniqueId}/follows/${followUniqueId}`);
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
|
|
456
697
|
const opportunityMapper = {
|
|
457
698
|
type: 'Opportunity',
|
|
458
699
|
map: (resource)=>({
|
|
@@ -708,6 +949,180 @@ function createMeetingsService(transport, _config) {
|
|
|
708
949
|
};
|
|
709
950
|
}
|
|
710
951
|
|
|
952
|
+
const meetingParticipantMapper = {
|
|
953
|
+
type: 'meeting_participant',
|
|
954
|
+
map (resource) {
|
|
955
|
+
const attrs = resource.attributes || {};
|
|
956
|
+
return {
|
|
957
|
+
id: resource.id,
|
|
958
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
959
|
+
meetingUniqueId: parseString(attrs['meeting_unique_id']) || '',
|
|
960
|
+
contactUniqueId: parseString(attrs['contact_unique_id']),
|
|
961
|
+
userUniqueId: parseString(attrs['user_unique_id']),
|
|
962
|
+
email: parseString(attrs['email']),
|
|
963
|
+
name: parseString(attrs['name']),
|
|
964
|
+
role: parseString(attrs['role']),
|
|
965
|
+
rsvpStatus: parseString(attrs['rsvp_status']),
|
|
966
|
+
joinedAt: parseDate(attrs['joined_at']),
|
|
967
|
+
leftAt: parseDate(attrs['left_at']),
|
|
968
|
+
status: parseStatus(attrs['status']),
|
|
969
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
970
|
+
payload: attrs['payload'],
|
|
971
|
+
createdAt: parseDate(attrs['created_at']),
|
|
972
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
function createMeetingParticipantsService(transport, _config) {
|
|
978
|
+
return {
|
|
979
|
+
async list (meetingUniqueId, params) {
|
|
980
|
+
const queryParams = {};
|
|
981
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
982
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
983
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
984
|
+
if (params == null ? void 0 : params.role) queryParams['role'] = params.role;
|
|
985
|
+
if (params == null ? void 0 : params.rsvpStatus) queryParams['rsvp_status'] = params.rsvpStatus;
|
|
986
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
987
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
988
|
+
const response = await transport.get(`/meetings/${meetingUniqueId}/participants`, {
|
|
989
|
+
params: queryParams
|
|
990
|
+
});
|
|
991
|
+
return decodePageResult(response, meetingParticipantMapper);
|
|
992
|
+
},
|
|
993
|
+
async create (meetingUniqueId, data) {
|
|
994
|
+
const response = await transport.post(`/meetings/${meetingUniqueId}/participants`, {
|
|
995
|
+
participant: {
|
|
996
|
+
contact_unique_id: data.contactUniqueId,
|
|
997
|
+
user_unique_id: data.userUniqueId,
|
|
998
|
+
email: data.email,
|
|
999
|
+
name: data.name,
|
|
1000
|
+
role: data.role,
|
|
1001
|
+
rsvp_status: data.rsvpStatus,
|
|
1002
|
+
payload: data.payload
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
return decodeOne(response, meetingParticipantMapper);
|
|
1006
|
+
},
|
|
1007
|
+
async delete (meetingUniqueId, participantUniqueId) {
|
|
1008
|
+
await transport.delete(`/meetings/${meetingUniqueId}/participants/${participantUniqueId}`);
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
const meetingBillingMapper = {
|
|
1014
|
+
type: 'meeting_billing',
|
|
1015
|
+
map (resource) {
|
|
1016
|
+
const attrs = resource.attributes || {};
|
|
1017
|
+
return {
|
|
1018
|
+
id: resource.id,
|
|
1019
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1020
|
+
meetingUniqueId: parseString(attrs['meeting_unique_id']) || '',
|
|
1021
|
+
participantUniqueId: parseString(attrs['participant_unique_id']),
|
|
1022
|
+
participantEmail: parseString(attrs['participant_email']),
|
|
1023
|
+
payerName: parseString(attrs['payer_name']),
|
|
1024
|
+
amount: parseOptionalNumber(attrs['amount']),
|
|
1025
|
+
currency: parseString(attrs['currency']),
|
|
1026
|
+
billingStatus: parseString(attrs['billing_status']),
|
|
1027
|
+
paidAt: parseDate(attrs['paid_at']),
|
|
1028
|
+
dueAt: parseDate(attrs['due_at']),
|
|
1029
|
+
notes: parseString(attrs['notes']),
|
|
1030
|
+
status: parseStatus(attrs['status']),
|
|
1031
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1032
|
+
payload: attrs['payload'],
|
|
1033
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1034
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
function createMeetingBillingsService(transport, _config) {
|
|
1040
|
+
return {
|
|
1041
|
+
async list (meetingUniqueId, params) {
|
|
1042
|
+
const queryParams = {};
|
|
1043
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1044
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1045
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1046
|
+
if (params == null ? void 0 : params.billingStatus) queryParams['billing_status'] = params.billingStatus;
|
|
1047
|
+
if (params == null ? void 0 : params.payerName) queryParams['payer_name'] = params.payerName;
|
|
1048
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1049
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1050
|
+
const response = await transport.get(`/meetings/${meetingUniqueId}/billing`, {
|
|
1051
|
+
params: queryParams
|
|
1052
|
+
});
|
|
1053
|
+
return decodePageResult(response, meetingBillingMapper);
|
|
1054
|
+
},
|
|
1055
|
+
async get (uniqueId) {
|
|
1056
|
+
const response = await transport.get(`/billings/${uniqueId}`);
|
|
1057
|
+
return decodeOne(response, meetingBillingMapper);
|
|
1058
|
+
},
|
|
1059
|
+
async create (meetingUniqueId, data) {
|
|
1060
|
+
var _data_dueAt;
|
|
1061
|
+
const response = await transport.post(`/meetings/${meetingUniqueId}/billing`, {
|
|
1062
|
+
billing: {
|
|
1063
|
+
participant_unique_id: data.participantUniqueId,
|
|
1064
|
+
participant_email: data.participantEmail,
|
|
1065
|
+
payer_name: data.payerName,
|
|
1066
|
+
amount: data.amount,
|
|
1067
|
+
currency: data.currency,
|
|
1068
|
+
billing_status: data.billingStatus,
|
|
1069
|
+
due_at: (_data_dueAt = data.dueAt) == null ? void 0 : _data_dueAt.toISOString(),
|
|
1070
|
+
notes: data.notes,
|
|
1071
|
+
payload: data.payload
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
return decodeOne(response, meetingBillingMapper);
|
|
1075
|
+
},
|
|
1076
|
+
async update (uniqueId, data) {
|
|
1077
|
+
var _data_paidAt, _data_dueAt;
|
|
1078
|
+
const response = await transport.put(`/billings/${uniqueId}`, {
|
|
1079
|
+
billing: {
|
|
1080
|
+
participant_unique_id: data.participantUniqueId,
|
|
1081
|
+
participant_email: data.participantEmail,
|
|
1082
|
+
payer_name: data.payerName,
|
|
1083
|
+
amount: data.amount,
|
|
1084
|
+
currency: data.currency,
|
|
1085
|
+
billing_status: data.billingStatus,
|
|
1086
|
+
paid_at: (_data_paidAt = data.paidAt) == null ? void 0 : _data_paidAt.toISOString(),
|
|
1087
|
+
due_at: (_data_dueAt = data.dueAt) == null ? void 0 : _data_dueAt.toISOString(),
|
|
1088
|
+
notes: data.notes,
|
|
1089
|
+
enabled: data.enabled,
|
|
1090
|
+
status: data.status,
|
|
1091
|
+
payload: data.payload
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
return decodeOne(response, meetingBillingMapper);
|
|
1095
|
+
},
|
|
1096
|
+
async delete (uniqueId) {
|
|
1097
|
+
await transport.delete(`/billings/${uniqueId}`);
|
|
1098
|
+
},
|
|
1099
|
+
async getPaymentSplit (uniqueId) {
|
|
1100
|
+
const response = await transport.get(`/billings/${uniqueId}/payment_split`);
|
|
1101
|
+
return response.data || [];
|
|
1102
|
+
},
|
|
1103
|
+
async getEapSessions (participantEmail, payerName) {
|
|
1104
|
+
const response = await transport.get(`/billings/eap_sessions/${encodeURIComponent(participantEmail)}/${encodeURIComponent(payerName)}`);
|
|
1105
|
+
return response.data;
|
|
1106
|
+
},
|
|
1107
|
+
async getOutstandingByPayer () {
|
|
1108
|
+
const response = await transport.get('/billings/outstanding_by_payer');
|
|
1109
|
+
return response.data || [];
|
|
1110
|
+
},
|
|
1111
|
+
async getRevenueReport () {
|
|
1112
|
+
const response = await transport.get('/billings/reports/revenue');
|
|
1113
|
+
return response.data;
|
|
1114
|
+
},
|
|
1115
|
+
async getAgingReport () {
|
|
1116
|
+
const response = await transport.get('/billings/reports/aging');
|
|
1117
|
+
return response.data;
|
|
1118
|
+
},
|
|
1119
|
+
async getParticipantReport (participantEmail) {
|
|
1120
|
+
const response = await transport.get(`/billings/reports/participant/${encodeURIComponent(participantEmail)}`);
|
|
1121
|
+
return response.data;
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
|
|
711
1126
|
const quoteMapper = {
|
|
712
1127
|
type: 'Quote',
|
|
713
1128
|
map: (resource)=>({
|
|
@@ -832,30 +1247,1108 @@ function createQuotesService(transport, _config) {
|
|
|
832
1247
|
};
|
|
833
1248
|
}
|
|
834
1249
|
|
|
835
|
-
|
|
1250
|
+
const subscriberMapper = {
|
|
1251
|
+
type: 'subscriber',
|
|
1252
|
+
map (resource) {
|
|
1253
|
+
const attrs = resource.attributes || {};
|
|
1254
|
+
return {
|
|
1255
|
+
id: resource.id,
|
|
1256
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1257
|
+
email: parseString(attrs['email']) || '',
|
|
1258
|
+
firstName: parseString(attrs['first_name']),
|
|
1259
|
+
lastName: parseString(attrs['last_name']),
|
|
1260
|
+
phone: parseString(attrs['phone']),
|
|
1261
|
+
source: parseString(attrs['source']),
|
|
1262
|
+
sourceId: parseString(attrs['source_id']),
|
|
1263
|
+
status: parseStatus(attrs['status']),
|
|
1264
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1265
|
+
payload: attrs['payload'],
|
|
1266
|
+
tags: parseStringArray(attrs['tags']),
|
|
1267
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1268
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
function createSubscribersService(transport, _config) {
|
|
836
1274
|
return {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
1275
|
+
async list (params) {
|
|
1276
|
+
const queryParams = {};
|
|
1277
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1278
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1279
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1280
|
+
if (params == null ? void 0 : params.source) queryParams['source'] = params.source;
|
|
1281
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1282
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1283
|
+
const response = await transport.get('/subscribers', {
|
|
1284
|
+
params: queryParams
|
|
1285
|
+
});
|
|
1286
|
+
return decodePageResult(response, subscriberMapper);
|
|
1287
|
+
},
|
|
1288
|
+
async get (uniqueId) {
|
|
1289
|
+
const response = await transport.get(`/subscribers/${uniqueId}`);
|
|
1290
|
+
return decodeOne(response, subscriberMapper);
|
|
1291
|
+
},
|
|
1292
|
+
async create (data) {
|
|
1293
|
+
const response = await transport.post('/subscribers', {
|
|
1294
|
+
subscriber: {
|
|
1295
|
+
email: data.email,
|
|
1296
|
+
first_name: data.firstName,
|
|
1297
|
+
last_name: data.lastName,
|
|
1298
|
+
phone: data.phone,
|
|
1299
|
+
source: data.source,
|
|
1300
|
+
source_id: data.sourceId,
|
|
1301
|
+
payload: data.payload,
|
|
1302
|
+
tags: data.tags
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
return decodeOne(response, subscriberMapper);
|
|
1306
|
+
},
|
|
1307
|
+
async update (uniqueId, data) {
|
|
1308
|
+
const response = await transport.put(`/subscribers/${uniqueId}`, {
|
|
1309
|
+
subscriber: {
|
|
1310
|
+
email: data.email,
|
|
1311
|
+
first_name: data.firstName,
|
|
1312
|
+
last_name: data.lastName,
|
|
1313
|
+
phone: data.phone,
|
|
1314
|
+
source: data.source,
|
|
1315
|
+
enabled: data.enabled,
|
|
1316
|
+
status: data.status,
|
|
1317
|
+
payload: data.payload,
|
|
1318
|
+
tags: data.tags
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
return decodeOne(response, subscriberMapper);
|
|
1322
|
+
},
|
|
1323
|
+
async delete (uniqueId) {
|
|
1324
|
+
await transport.delete(`/subscribers/${uniqueId}`);
|
|
1325
|
+
}
|
|
843
1326
|
};
|
|
844
1327
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1328
|
+
|
|
1329
|
+
const referralMapper = {
|
|
1330
|
+
type: 'referral',
|
|
1331
|
+
map (resource) {
|
|
1332
|
+
const attrs = resource.attributes || {};
|
|
1333
|
+
return {
|
|
1334
|
+
id: resource.id,
|
|
1335
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1336
|
+
referrerUniqueId: parseString(attrs['referrer_unique_id']),
|
|
1337
|
+
referredUniqueId: parseString(attrs['referred_unique_id']),
|
|
1338
|
+
referralCode: parseString(attrs['referral_code']),
|
|
1339
|
+
source: parseString(attrs['source']),
|
|
1340
|
+
status: parseStatus(attrs['status']),
|
|
1341
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1342
|
+
payload: attrs['payload'],
|
|
1343
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1344
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1349
|
+
function createReferralsService(transport, _config) {
|
|
1350
|
+
return {
|
|
1351
|
+
async list (params) {
|
|
1352
|
+
const queryParams = {};
|
|
1353
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1354
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1355
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1356
|
+
if (params == null ? void 0 : params.referrerUniqueId) queryParams['referrer_unique_id'] = params.referrerUniqueId;
|
|
1357
|
+
if (params == null ? void 0 : params.referredUniqueId) queryParams['referred_unique_id'] = params.referredUniqueId;
|
|
1358
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1359
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1360
|
+
const response = await transport.get('/referrals', {
|
|
1361
|
+
params: queryParams
|
|
1362
|
+
});
|
|
1363
|
+
return decodePageResult(response, referralMapper);
|
|
1364
|
+
},
|
|
1365
|
+
async get (uniqueId) {
|
|
1366
|
+
const response = await transport.get(`/referrals/${uniqueId}`);
|
|
1367
|
+
return decodeOne(response, referralMapper);
|
|
1368
|
+
},
|
|
1369
|
+
async create (data) {
|
|
1370
|
+
const response = await transport.post('/referrals', {
|
|
1371
|
+
referral: {
|
|
1372
|
+
referrer_unique_id: data.referrerUniqueId,
|
|
1373
|
+
referred_unique_id: data.referredUniqueId,
|
|
1374
|
+
referral_code: data.referralCode,
|
|
1375
|
+
source: data.source,
|
|
1376
|
+
payload: data.payload
|
|
1377
|
+
}
|
|
1378
|
+
});
|
|
1379
|
+
return decodeOne(response, referralMapper);
|
|
1380
|
+
},
|
|
1381
|
+
async update (uniqueId, data) {
|
|
1382
|
+
const response = await transport.put(`/referrals/${uniqueId}`, {
|
|
1383
|
+
referral: {
|
|
1384
|
+
referral_code: data.referralCode,
|
|
1385
|
+
source: data.source,
|
|
1386
|
+
enabled: data.enabled,
|
|
1387
|
+
status: data.status,
|
|
1388
|
+
payload: data.payload
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
1391
|
+
return decodeOne(response, referralMapper);
|
|
1392
|
+
},
|
|
1393
|
+
async delete (uniqueId) {
|
|
1394
|
+
await transport.delete(`/referrals/${uniqueId}`);
|
|
1395
|
+
}
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
const touchMapper = {
|
|
1400
|
+
type: 'touch',
|
|
1401
|
+
map (resource) {
|
|
1402
|
+
const attrs = resource.attributes || {};
|
|
1403
|
+
return {
|
|
1404
|
+
id: resource.id,
|
|
1405
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1406
|
+
contactUniqueId: parseString(attrs['contact_unique_id']),
|
|
1407
|
+
userUniqueId: parseString(attrs['user_unique_id']),
|
|
1408
|
+
touchType: parseString(attrs['touch_type']),
|
|
1409
|
+
channel: parseString(attrs['channel']),
|
|
1410
|
+
subject: parseString(attrs['subject']),
|
|
1411
|
+
notes: parseString(attrs['notes']),
|
|
1412
|
+
touchedAt: parseDate(attrs['touched_at']),
|
|
1413
|
+
status: parseStatus(attrs['status']),
|
|
1414
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1415
|
+
payload: attrs['payload'],
|
|
1416
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1417
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1422
|
+
function createTouchesService(transport, _config) {
|
|
1423
|
+
return {
|
|
1424
|
+
async list (params) {
|
|
1425
|
+
const queryParams = {};
|
|
1426
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1427
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1428
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1429
|
+
if (params == null ? void 0 : params.contactUniqueId) queryParams['contact_unique_id'] = params.contactUniqueId;
|
|
1430
|
+
if (params == null ? void 0 : params.userUniqueId) queryParams['user_unique_id'] = params.userUniqueId;
|
|
1431
|
+
if (params == null ? void 0 : params.touchType) queryParams['touch_type'] = params.touchType;
|
|
1432
|
+
if (params == null ? void 0 : params.channel) queryParams['channel'] = params.channel;
|
|
1433
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1434
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1435
|
+
const response = await transport.get('/touches', {
|
|
1436
|
+
params: queryParams
|
|
1437
|
+
});
|
|
1438
|
+
return decodePageResult(response, touchMapper);
|
|
1439
|
+
},
|
|
1440
|
+
async get (uniqueId) {
|
|
1441
|
+
const response = await transport.get(`/touches/${uniqueId}`);
|
|
1442
|
+
return decodeOne(response, touchMapper);
|
|
1443
|
+
},
|
|
1444
|
+
async create (data) {
|
|
1445
|
+
var _data_touchedAt;
|
|
1446
|
+
const response = await transport.post('/touches', {
|
|
1447
|
+
touch: {
|
|
1448
|
+
contact_unique_id: data.contactUniqueId,
|
|
1449
|
+
user_unique_id: data.userUniqueId,
|
|
1450
|
+
touch_type: data.touchType,
|
|
1451
|
+
channel: data.channel,
|
|
1452
|
+
subject: data.subject,
|
|
1453
|
+
notes: data.notes,
|
|
1454
|
+
touched_at: (_data_touchedAt = data.touchedAt) == null ? void 0 : _data_touchedAt.toISOString(),
|
|
1455
|
+
payload: data.payload
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
return decodeOne(response, touchMapper);
|
|
1459
|
+
},
|
|
1460
|
+
async update (uniqueId, data) {
|
|
1461
|
+
var _data_touchedAt;
|
|
1462
|
+
const response = await transport.put(`/touches/${uniqueId}`, {
|
|
1463
|
+
touch: {
|
|
1464
|
+
touch_type: data.touchType,
|
|
1465
|
+
channel: data.channel,
|
|
1466
|
+
subject: data.subject,
|
|
1467
|
+
notes: data.notes,
|
|
1468
|
+
touched_at: (_data_touchedAt = data.touchedAt) == null ? void 0 : _data_touchedAt.toISOString(),
|
|
1469
|
+
enabled: data.enabled,
|
|
1470
|
+
status: data.status,
|
|
1471
|
+
payload: data.payload
|
|
1472
|
+
}
|
|
1473
|
+
});
|
|
1474
|
+
return decodeOne(response, touchMapper);
|
|
1475
|
+
},
|
|
1476
|
+
async delete (uniqueId) {
|
|
1477
|
+
await transport.delete(`/touches/${uniqueId}`);
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
const categoryMapper = {
|
|
1483
|
+
type: 'category',
|
|
1484
|
+
map (resource) {
|
|
1485
|
+
const attrs = resource.attributes || {};
|
|
1486
|
+
return {
|
|
1487
|
+
id: resource.id,
|
|
1488
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1489
|
+
name: parseString(attrs['name']) || '',
|
|
1490
|
+
code: parseString(attrs['code']),
|
|
1491
|
+
description: parseString(attrs['description']),
|
|
1492
|
+
parentUniqueId: parseString(attrs['parent_unique_id']),
|
|
1493
|
+
order: parseOptionalNumber(attrs['order']),
|
|
1494
|
+
color: parseString(attrs['color']),
|
|
1495
|
+
icon: parseString(attrs['icon']),
|
|
1496
|
+
status: parseStatus(attrs['status']),
|
|
1497
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1498
|
+
payload: attrs['payload'],
|
|
1499
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1500
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
};
|
|
1504
|
+
const accountCategoryMapper = {
|
|
1505
|
+
type: 'account_category',
|
|
1506
|
+
map (resource) {
|
|
1507
|
+
const attrs = resource.attributes || {};
|
|
1508
|
+
return {
|
|
1509
|
+
id: resource.id,
|
|
1510
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1511
|
+
accountUniqueId: parseString(attrs['account_unique_id']) || '',
|
|
1512
|
+
categoryUniqueId: parseString(attrs['category_unique_id']) || '',
|
|
1513
|
+
order: parseOptionalNumber(attrs['order']),
|
|
1514
|
+
status: parseStatus(attrs['status']),
|
|
1515
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1516
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1517
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
function createCategoriesService(transport, _config) {
|
|
1523
|
+
return {
|
|
1524
|
+
async list (params) {
|
|
1525
|
+
const queryParams = {};
|
|
1526
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1527
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1528
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1529
|
+
if (params == null ? void 0 : params.parentUniqueId) queryParams['parent_unique_id'] = params.parentUniqueId;
|
|
1530
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1531
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1532
|
+
const response = await transport.get('/categories', {
|
|
1533
|
+
params: queryParams
|
|
1534
|
+
});
|
|
1535
|
+
return decodePageResult(response, categoryMapper);
|
|
1536
|
+
},
|
|
1537
|
+
async get (uniqueId) {
|
|
1538
|
+
const response = await transport.get(`/categories/${uniqueId}`);
|
|
1539
|
+
return decodeOne(response, categoryMapper);
|
|
1540
|
+
},
|
|
1541
|
+
async create (data) {
|
|
1542
|
+
const response = await transport.post('/categories', {
|
|
1543
|
+
category: {
|
|
1544
|
+
name: data.name,
|
|
1545
|
+
code: data.code,
|
|
1546
|
+
description: data.description,
|
|
1547
|
+
parent_unique_id: data.parentUniqueId,
|
|
1548
|
+
order: data.order,
|
|
1549
|
+
color: data.color,
|
|
1550
|
+
icon: data.icon,
|
|
1551
|
+
payload: data.payload
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
return decodeOne(response, categoryMapper);
|
|
1555
|
+
},
|
|
1556
|
+
async update (uniqueId, data) {
|
|
1557
|
+
const response = await transport.put(`/categories/${uniqueId}`, {
|
|
1558
|
+
category: {
|
|
1559
|
+
name: data.name,
|
|
1560
|
+
code: data.code,
|
|
1561
|
+
description: data.description,
|
|
1562
|
+
parent_unique_id: data.parentUniqueId,
|
|
1563
|
+
order: data.order,
|
|
1564
|
+
color: data.color,
|
|
1565
|
+
icon: data.icon,
|
|
1566
|
+
enabled: data.enabled,
|
|
1567
|
+
status: data.status,
|
|
1568
|
+
payload: data.payload
|
|
1569
|
+
}
|
|
1570
|
+
});
|
|
1571
|
+
return decodeOne(response, categoryMapper);
|
|
1572
|
+
},
|
|
1573
|
+
async delete (uniqueId) {
|
|
1574
|
+
await transport.delete(`/categories/${uniqueId}`);
|
|
1575
|
+
}
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
const calendarAccountMapper = {
|
|
1580
|
+
type: 'calendar_account',
|
|
1581
|
+
map (resource) {
|
|
1582
|
+
const attrs = resource.attributes || {};
|
|
1583
|
+
return {
|
|
1584
|
+
id: resource.id,
|
|
1585
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1586
|
+
userUniqueId: parseString(attrs['user_unique_id']) || '',
|
|
1587
|
+
provider: parseString(attrs['provider']) || '',
|
|
1588
|
+
email: parseString(attrs['email']),
|
|
1589
|
+
name: parseString(attrs['name']),
|
|
1590
|
+
accessToken: parseString(attrs['access_token']),
|
|
1591
|
+
refreshToken: parseString(attrs['refresh_token']),
|
|
1592
|
+
tokenExpiresAt: parseDate(attrs['token_expires_at']),
|
|
1593
|
+
lastSyncAt: parseDate(attrs['last_sync_at']),
|
|
1594
|
+
syncEnabled: parseBoolean(attrs['sync_enabled']),
|
|
1595
|
+
status: parseStatus(attrs['status']),
|
|
1596
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1597
|
+
payload: attrs['payload'],
|
|
1598
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1599
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
function createCalendarAccountsService(transport, _config) {
|
|
1605
|
+
return {
|
|
1606
|
+
async list (userUniqueId, params) {
|
|
1607
|
+
const queryParams = {};
|
|
1608
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1609
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1610
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1611
|
+
if (params == null ? void 0 : params.provider) queryParams['provider'] = params.provider;
|
|
1612
|
+
if ((params == null ? void 0 : params.syncEnabled) !== undefined) queryParams['sync_enabled'] = String(params.syncEnabled);
|
|
1613
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1614
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1615
|
+
const response = await transport.get(`/users/${userUniqueId}/calendar_accounts`, {
|
|
1616
|
+
params: queryParams
|
|
1617
|
+
});
|
|
1618
|
+
return decodePageResult(response, calendarAccountMapper);
|
|
1619
|
+
},
|
|
1620
|
+
async get (userUniqueId, id) {
|
|
1621
|
+
const response = await transport.get(`/users/${userUniqueId}/calendar_accounts/${id}`);
|
|
1622
|
+
return decodeOne(response, calendarAccountMapper);
|
|
1623
|
+
},
|
|
1624
|
+
async create (userUniqueId, data) {
|
|
1625
|
+
var _data_tokenExpiresAt;
|
|
1626
|
+
const response = await transport.post(`/users/${userUniqueId}/calendar_accounts`, {
|
|
1627
|
+
calendar_account: {
|
|
1628
|
+
provider: data.provider,
|
|
1629
|
+
email: data.email,
|
|
1630
|
+
name: data.name,
|
|
1631
|
+
access_token: data.accessToken,
|
|
1632
|
+
refresh_token: data.refreshToken,
|
|
1633
|
+
token_expires_at: (_data_tokenExpiresAt = data.tokenExpiresAt) == null ? void 0 : _data_tokenExpiresAt.toISOString(),
|
|
1634
|
+
sync_enabled: data.syncEnabled,
|
|
1635
|
+
payload: data.payload
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
return decodeOne(response, calendarAccountMapper);
|
|
1639
|
+
},
|
|
1640
|
+
async update (userUniqueId, id, data) {
|
|
1641
|
+
var _data_tokenExpiresAt;
|
|
1642
|
+
const response = await transport.put(`/users/${userUniqueId}/calendar_accounts/${id}`, {
|
|
1643
|
+
calendar_account: {
|
|
1644
|
+
email: data.email,
|
|
1645
|
+
name: data.name,
|
|
1646
|
+
access_token: data.accessToken,
|
|
1647
|
+
refresh_token: data.refreshToken,
|
|
1648
|
+
token_expires_at: (_data_tokenExpiresAt = data.tokenExpiresAt) == null ? void 0 : _data_tokenExpiresAt.toISOString(),
|
|
1649
|
+
sync_enabled: data.syncEnabled,
|
|
1650
|
+
enabled: data.enabled,
|
|
1651
|
+
status: data.status,
|
|
1652
|
+
payload: data.payload
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
return decodeOne(response, calendarAccountMapper);
|
|
1656
|
+
},
|
|
1657
|
+
async delete (userUniqueId, id) {
|
|
1658
|
+
await transport.delete(`/users/${userUniqueId}/calendar_accounts/${id}`);
|
|
1659
|
+
},
|
|
1660
|
+
async syncUser (userUniqueId, request) {
|
|
1661
|
+
var _request_syncFrom, _request_syncTo;
|
|
1662
|
+
const response = await transport.post(`/users/${userUniqueId}/calendar/sync`, {
|
|
1663
|
+
sync: {
|
|
1664
|
+
force_refresh: request == null ? void 0 : request.forceRefresh,
|
|
1665
|
+
sync_from: request == null ? void 0 : (_request_syncFrom = request.syncFrom) == null ? void 0 : _request_syncFrom.toISOString(),
|
|
1666
|
+
sync_to: request == null ? void 0 : (_request_syncTo = request.syncTo) == null ? void 0 : _request_syncTo.toISOString()
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
return response.data;
|
|
1670
|
+
},
|
|
1671
|
+
async syncTenant (request) {
|
|
1672
|
+
var _request_syncFrom, _request_syncTo;
|
|
1673
|
+
const response = await transport.post('/calendar/sync', {
|
|
1674
|
+
sync: {
|
|
1675
|
+
force_refresh: request == null ? void 0 : request.forceRefresh,
|
|
1676
|
+
sync_from: request == null ? void 0 : (_request_syncFrom = request.syncFrom) == null ? void 0 : _request_syncFrom.toISOString(),
|
|
1677
|
+
sync_to: request == null ? void 0 : (_request_syncTo = request.syncTo) == null ? void 0 : _request_syncTo.toISOString()
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
return response.data;
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
const busyBlockMapper = {
|
|
1686
|
+
type: 'busy_block',
|
|
1687
|
+
map (resource) {
|
|
1688
|
+
const attrs = resource.attributes || {};
|
|
1689
|
+
return {
|
|
1690
|
+
id: resource.id,
|
|
1691
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1692
|
+
userUniqueId: parseString(attrs['user_unique_id']) || '',
|
|
1693
|
+
title: parseString(attrs['title']),
|
|
1694
|
+
description: parseString(attrs['description']),
|
|
1695
|
+
startTime: parseDate(attrs['start_time']) || new Date(),
|
|
1696
|
+
endTime: parseDate(attrs['end_time']) || new Date(),
|
|
1697
|
+
allDay: parseBoolean(attrs['all_day']),
|
|
1698
|
+
recurring: parseBoolean(attrs['recurring']),
|
|
1699
|
+
recurrenceRule: parseString(attrs['recurrence_rule']),
|
|
1700
|
+
status: parseStatus(attrs['status']),
|
|
1701
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1702
|
+
payload: attrs['payload'],
|
|
1703
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1704
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
};
|
|
1708
|
+
|
|
1709
|
+
function createBusyBlocksService(transport, _config) {
|
|
1710
|
+
return {
|
|
1711
|
+
async list (userUniqueId, params) {
|
|
1712
|
+
const queryParams = {};
|
|
1713
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1714
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1715
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1716
|
+
if (params == null ? void 0 : params.startTime) queryParams['start_time'] = params.startTime.toISOString();
|
|
1717
|
+
if (params == null ? void 0 : params.endTime) queryParams['end_time'] = params.endTime.toISOString();
|
|
1718
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1719
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1720
|
+
const response = await transport.get(`/users/${userUniqueId}/busy_blocks`, {
|
|
1721
|
+
params: queryParams
|
|
1722
|
+
});
|
|
1723
|
+
return decodePageResult(response, busyBlockMapper);
|
|
1724
|
+
},
|
|
1725
|
+
async create (userUniqueId, data) {
|
|
1726
|
+
const response = await transport.post(`/users/${userUniqueId}/busy_blocks`, {
|
|
1727
|
+
busy_block: {
|
|
1728
|
+
title: data.title,
|
|
1729
|
+
description: data.description,
|
|
1730
|
+
start_time: data.startTime.toISOString(),
|
|
1731
|
+
end_time: data.endTime.toISOString(),
|
|
1732
|
+
all_day: data.allDay,
|
|
1733
|
+
recurring: data.recurring,
|
|
1734
|
+
recurrence_rule: data.recurrenceRule,
|
|
1735
|
+
payload: data.payload
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
return decodeOne(response, busyBlockMapper);
|
|
1739
|
+
},
|
|
1740
|
+
async delete (userUniqueId, id) {
|
|
1741
|
+
await transport.delete(`/users/${userUniqueId}/busy_blocks/${id}`);
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
const icsTokenMapper = {
|
|
1747
|
+
type: 'ics_token',
|
|
1748
|
+
map (resource) {
|
|
1749
|
+
const attrs = resource.attributes || {};
|
|
1750
|
+
return {
|
|
1751
|
+
id: resource.id,
|
|
1752
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1753
|
+
userUniqueId: parseString(attrs['user_unique_id']) || '',
|
|
1754
|
+
token: parseString(attrs['token']) || '',
|
|
1755
|
+
name: parseString(attrs['name']),
|
|
1756
|
+
description: parseString(attrs['description']),
|
|
1757
|
+
expiresAt: parseDate(attrs['expires_at']),
|
|
1758
|
+
lastAccessedAt: parseDate(attrs['last_accessed_at']),
|
|
1759
|
+
accessCount: parseNumber(attrs['access_count']),
|
|
1760
|
+
status: parseStatus(attrs['status']),
|
|
1761
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1762
|
+
payload: attrs['payload'],
|
|
1763
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1764
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
function createIcsTokensService(transport, _config) {
|
|
1770
|
+
return {
|
|
1771
|
+
async list (userUniqueId, params) {
|
|
1772
|
+
const queryParams = {};
|
|
1773
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1774
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1775
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1776
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1777
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1778
|
+
const response = await transport.get(`/users/${userUniqueId}/ics_tokens`, {
|
|
1779
|
+
params: queryParams
|
|
1780
|
+
});
|
|
1781
|
+
return decodePageResult(response, icsTokenMapper);
|
|
1782
|
+
},
|
|
1783
|
+
async create (userUniqueId, data) {
|
|
1784
|
+
var _data_expiresAt;
|
|
1785
|
+
const response = await transport.post(`/users/${userUniqueId}/ics_tokens`, {
|
|
1786
|
+
ics_token: {
|
|
1787
|
+
name: data.name,
|
|
1788
|
+
description: data.description,
|
|
1789
|
+
expires_at: (_data_expiresAt = data.expiresAt) == null ? void 0 : _data_expiresAt.toISOString(),
|
|
1790
|
+
payload: data.payload
|
|
1791
|
+
}
|
|
1792
|
+
});
|
|
1793
|
+
return decodeOne(response, icsTokenMapper);
|
|
1794
|
+
},
|
|
1795
|
+
async delete (userUniqueId, id) {
|
|
1796
|
+
await transport.delete(`/users/${userUniqueId}/ics_tokens/${id}`);
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
const zoomMeetingMapper = {
|
|
1802
|
+
type: 'zoom_meeting',
|
|
1803
|
+
map (resource) {
|
|
1804
|
+
const attrs = resource.attributes || {};
|
|
1805
|
+
return {
|
|
1806
|
+
id: resource.id,
|
|
1807
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1808
|
+
meetingUniqueId: parseString(attrs['meeting_unique_id']) || '',
|
|
1809
|
+
userUniqueId: parseString(attrs['user_unique_id']) || '',
|
|
1810
|
+
zoomMeetingId: parseString(attrs['zoom_meeting_id']),
|
|
1811
|
+
zoomHostId: parseString(attrs['zoom_host_id']),
|
|
1812
|
+
joinUrl: parseString(attrs['join_url']),
|
|
1813
|
+
startUrl: parseString(attrs['start_url']),
|
|
1814
|
+
password: parseString(attrs['password']),
|
|
1815
|
+
topic: parseString(attrs['topic']),
|
|
1816
|
+
agenda: parseString(attrs['agenda']),
|
|
1817
|
+
startTime: parseDate(attrs['start_time']),
|
|
1818
|
+
duration: parseOptionalNumber(attrs['duration']),
|
|
1819
|
+
timezone: parseString(attrs['timezone']),
|
|
1820
|
+
zoomStatus: parseString(attrs['zoom_status']),
|
|
1821
|
+
status: parseStatus(attrs['status']),
|
|
1822
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1823
|
+
payload: attrs['payload'],
|
|
1824
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1825
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
function createZoomMeetingsService(transport, _config) {
|
|
1831
|
+
return {
|
|
1832
|
+
async get (userUniqueId, meetingUniqueId) {
|
|
1833
|
+
const response = await transport.get(`/users/${userUniqueId}/meetings/${meetingUniqueId}/zoom`);
|
|
1834
|
+
return decodeOne(response, zoomMeetingMapper);
|
|
1835
|
+
},
|
|
1836
|
+
async provision (userUniqueId, meetingUniqueId, request) {
|
|
1837
|
+
const response = await transport.post(`/users/${userUniqueId}/meetings/${meetingUniqueId}/zoom`, {
|
|
1838
|
+
zoom_meeting: {
|
|
1839
|
+
topic: request == null ? void 0 : request.topic,
|
|
1840
|
+
agenda: request == null ? void 0 : request.agenda,
|
|
1841
|
+
duration: request == null ? void 0 : request.duration,
|
|
1842
|
+
timezone: request == null ? void 0 : request.timezone,
|
|
1843
|
+
password: request == null ? void 0 : request.password,
|
|
1844
|
+
waiting_room: request == null ? void 0 : request.waitingRoom,
|
|
1845
|
+
join_before_host: request == null ? void 0 : request.joinBeforeHost,
|
|
1846
|
+
mute_on_entry: request == null ? void 0 : request.muteOnEntry,
|
|
1847
|
+
auto_recording: request == null ? void 0 : request.autoRecording,
|
|
1848
|
+
payload: request == null ? void 0 : request.payload
|
|
1849
|
+
}
|
|
1850
|
+
});
|
|
1851
|
+
return decodeOne(response, zoomMeetingMapper);
|
|
1852
|
+
},
|
|
1853
|
+
async update (userUniqueId, meetingUniqueId, request) {
|
|
1854
|
+
var _request_startTime;
|
|
1855
|
+
const response = await transport.put(`/users/${userUniqueId}/meetings/${meetingUniqueId}/zoom`, {
|
|
1856
|
+
zoom_meeting: {
|
|
1857
|
+
topic: request.topic,
|
|
1858
|
+
agenda: request.agenda,
|
|
1859
|
+
start_time: (_request_startTime = request.startTime) == null ? void 0 : _request_startTime.toISOString(),
|
|
1860
|
+
duration: request.duration,
|
|
1861
|
+
timezone: request.timezone,
|
|
1862
|
+
password: request.password,
|
|
1863
|
+
waiting_room: request.waitingRoom,
|
|
1864
|
+
join_before_host: request.joinBeforeHost,
|
|
1865
|
+
mute_on_entry: request.muteOnEntry,
|
|
1866
|
+
auto_recording: request.autoRecording,
|
|
1867
|
+
payload: request.payload
|
|
1868
|
+
}
|
|
1869
|
+
});
|
|
1870
|
+
return decodeOne(response, zoomMeetingMapper);
|
|
1871
|
+
},
|
|
1872
|
+
async cancel (userUniqueId, meetingUniqueId) {
|
|
1873
|
+
await transport.delete(`/users/${userUniqueId}/meetings/${meetingUniqueId}/zoom`);
|
|
1874
|
+
},
|
|
1875
|
+
async checkAvailability (userUniqueId) {
|
|
1876
|
+
const response = await transport.get(`/users/${userUniqueId}/zoom/availability`);
|
|
1877
|
+
return response.data;
|
|
1878
|
+
}
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
const zoomHostMapper = {
|
|
1883
|
+
type: 'zoom_host',
|
|
1884
|
+
map (resource) {
|
|
1885
|
+
const attrs = resource.attributes || {};
|
|
1886
|
+
return {
|
|
1887
|
+
id: resource.id,
|
|
1888
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
1889
|
+
userUniqueId: parseString(attrs['user_unique_id']),
|
|
1890
|
+
zoomUserId: parseString(attrs['zoom_user_id']),
|
|
1891
|
+
email: parseString(attrs['email']),
|
|
1892
|
+
firstName: parseString(attrs['first_name']),
|
|
1893
|
+
lastName: parseString(attrs['last_name']),
|
|
1894
|
+
displayName: parseString(attrs['display_name']),
|
|
1895
|
+
hostKey: parseString(attrs['host_key']),
|
|
1896
|
+
licenseType: parseString(attrs['license_type']),
|
|
1897
|
+
maxMeetings: parseOptionalNumber(attrs['max_meetings']),
|
|
1898
|
+
currentMeetings: parseOptionalNumber(attrs['current_meetings']),
|
|
1899
|
+
status: parseStatus(attrs['status']),
|
|
1900
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
1901
|
+
payload: attrs['payload'],
|
|
1902
|
+
createdAt: parseDate(attrs['created_at']),
|
|
1903
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
};
|
|
1907
|
+
|
|
1908
|
+
function createZoomHostsService(transport, _config) {
|
|
1909
|
+
return {
|
|
1910
|
+
async list (params) {
|
|
1911
|
+
const queryParams = {};
|
|
1912
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
1913
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
1914
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
1915
|
+
if (params == null ? void 0 : params.licenseType) queryParams['license_type'] = params.licenseType;
|
|
1916
|
+
if ((params == null ? void 0 : params.available) !== undefined) queryParams['available'] = String(params.available);
|
|
1917
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
1918
|
+
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
1919
|
+
const response = await transport.get('/zoom_hosts', {
|
|
1920
|
+
params: queryParams
|
|
1921
|
+
});
|
|
1922
|
+
return decodePageResult(response, zoomHostMapper);
|
|
1923
|
+
},
|
|
1924
|
+
async get (uniqueId) {
|
|
1925
|
+
const response = await transport.get(`/zoom_hosts/${uniqueId}`);
|
|
1926
|
+
return decodeOne(response, zoomHostMapper);
|
|
1927
|
+
},
|
|
1928
|
+
async create (data) {
|
|
1929
|
+
const response = await transport.post('/zoom_hosts', {
|
|
1930
|
+
zoom_host: {
|
|
1931
|
+
user_unique_id: data.userUniqueId,
|
|
1932
|
+
zoom_user_id: data.zoomUserId,
|
|
1933
|
+
email: data.email,
|
|
1934
|
+
first_name: data.firstName,
|
|
1935
|
+
last_name: data.lastName,
|
|
1936
|
+
display_name: data.displayName,
|
|
1937
|
+
host_key: data.hostKey,
|
|
1938
|
+
license_type: data.licenseType,
|
|
1939
|
+
max_meetings: data.maxMeetings,
|
|
1940
|
+
payload: data.payload
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1943
|
+
return decodeOne(response, zoomHostMapper);
|
|
1944
|
+
},
|
|
1945
|
+
async update (uniqueId, data) {
|
|
1946
|
+
const response = await transport.put(`/zoom_hosts/${uniqueId}`, {
|
|
1947
|
+
zoom_host: {
|
|
1948
|
+
first_name: data.firstName,
|
|
1949
|
+
last_name: data.lastName,
|
|
1950
|
+
display_name: data.displayName,
|
|
1951
|
+
host_key: data.hostKey,
|
|
1952
|
+
license_type: data.licenseType,
|
|
1953
|
+
max_meetings: data.maxMeetings,
|
|
1954
|
+
enabled: data.enabled,
|
|
1955
|
+
status: data.status,
|
|
1956
|
+
payload: data.payload
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
return decodeOne(response, zoomHostMapper);
|
|
1960
|
+
},
|
|
1961
|
+
async delete (uniqueId) {
|
|
1962
|
+
await transport.delete(`/zoom_hosts/${uniqueId}`);
|
|
1963
|
+
},
|
|
1964
|
+
async getAvailability (uniqueId) {
|
|
1965
|
+
const response = await transport.get(`/zoom_hosts/${uniqueId}/availability`);
|
|
1966
|
+
return response.data;
|
|
1967
|
+
},
|
|
1968
|
+
async getAllocations (uniqueId) {
|
|
1969
|
+
const response = await transport.get(`/zoom_hosts/${uniqueId}/allocations`);
|
|
1970
|
+
return response.data || [];
|
|
1971
|
+
},
|
|
1972
|
+
async getAvailableUsers () {
|
|
1973
|
+
const response = await transport.get('/zoom_hosts/available_users');
|
|
1974
|
+
return response.data || [];
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
const crmMailTemplateMapper = {
|
|
1980
|
+
type: 'mail_template',
|
|
1981
|
+
map: (resource)=>{
|
|
1982
|
+
var _resource_attributes_enabled;
|
|
1983
|
+
return {
|
|
1984
|
+
id: resource.id,
|
|
1985
|
+
uniqueId: resource.attributes['unique_id'],
|
|
1986
|
+
code: resource.attributes['code'],
|
|
1987
|
+
name: resource.attributes['name'],
|
|
1988
|
+
subject: resource.attributes['subject'],
|
|
1989
|
+
fromEmail: resource.attributes['from_email'],
|
|
1990
|
+
fromName: resource.attributes['from_name'],
|
|
1991
|
+
htmlContent: resource.attributes['html_content'],
|
|
1992
|
+
textContent: resource.attributes['text_content'],
|
|
1993
|
+
mandrillSlug: resource.attributes['mandrill_slug'],
|
|
1994
|
+
status: parseStatus(resource.attributes['status']),
|
|
1995
|
+
enabled: (_resource_attributes_enabled = resource.attributes['enabled']) != null ? _resource_attributes_enabled : true,
|
|
1996
|
+
payload: resource.attributes['payload'],
|
|
1997
|
+
createdAt: parseDate(resource.attributes['created_at']),
|
|
1998
|
+
updatedAt: parseDate(resource.attributes['updated_at'])
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
2002
|
+
|
|
2003
|
+
function createCrmMailTemplatesService(transport, _config) {
|
|
2004
|
+
return {
|
|
2005
|
+
async list (params) {
|
|
2006
|
+
const queryParams = {};
|
|
2007
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
2008
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
2009
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
2010
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
2011
|
+
const response = await transport.get('/mailtemplates', {
|
|
2012
|
+
params: queryParams
|
|
2013
|
+
});
|
|
2014
|
+
return decodePageResult(response, crmMailTemplateMapper);
|
|
2015
|
+
},
|
|
2016
|
+
async get (uniqueId) {
|
|
2017
|
+
const response = await transport.get(`/mailtemplates/${uniqueId}`);
|
|
2018
|
+
return decodeOne(response, crmMailTemplateMapper);
|
|
2019
|
+
},
|
|
2020
|
+
async create (data) {
|
|
2021
|
+
const response = await transport.post('/mailtemplates', {
|
|
2022
|
+
mail_template: {
|
|
2023
|
+
code: data.code,
|
|
2024
|
+
name: data.name,
|
|
2025
|
+
subject: data.subject,
|
|
2026
|
+
from_email: data.fromEmail,
|
|
2027
|
+
from_name: data.fromName,
|
|
2028
|
+
html_content: data.htmlContent,
|
|
2029
|
+
text_content: data.textContent,
|
|
2030
|
+
payload: data.payload
|
|
2031
|
+
}
|
|
2032
|
+
});
|
|
2033
|
+
return decodeOne(response, crmMailTemplateMapper);
|
|
2034
|
+
},
|
|
2035
|
+
async update (uniqueId, data) {
|
|
2036
|
+
const response = await transport.put(`/mailtemplates/${uniqueId}`, {
|
|
2037
|
+
mail_template: {
|
|
2038
|
+
name: data.name,
|
|
2039
|
+
subject: data.subject,
|
|
2040
|
+
from_email: data.fromEmail,
|
|
2041
|
+
from_name: data.fromName,
|
|
2042
|
+
html_content: data.htmlContent,
|
|
2043
|
+
text_content: data.textContent,
|
|
2044
|
+
enabled: data.enabled,
|
|
2045
|
+
status: data.status,
|
|
2046
|
+
payload: data.payload
|
|
2047
|
+
}
|
|
2048
|
+
});
|
|
2049
|
+
return decodeOne(response, crmMailTemplateMapper);
|
|
2050
|
+
},
|
|
2051
|
+
async getMandrillStats (uniqueId) {
|
|
2052
|
+
const response = await transport.get(`/mailtemplates/${uniqueId}/mandrill/stats`);
|
|
2053
|
+
return {
|
|
2054
|
+
slug: response.slug,
|
|
2055
|
+
name: response.name,
|
|
2056
|
+
sentCount: response.sent_count || 0,
|
|
2057
|
+
openCount: response.open_count || 0,
|
|
2058
|
+
clickCount: response.click_count || 0,
|
|
2059
|
+
bounceCount: response.bounce_count || 0,
|
|
2060
|
+
complaintCount: response.complaint_count || 0,
|
|
2061
|
+
createdAt: new Date(response.created_at),
|
|
2062
|
+
updatedAt: new Date(response.updated_at)
|
|
2063
|
+
};
|
|
2064
|
+
},
|
|
2065
|
+
async createMandrillTemplate (uniqueId, data) {
|
|
2066
|
+
const response = await transport.post(`/mailtemplates/${uniqueId}/mandrill`, {
|
|
2067
|
+
mandrill: {
|
|
2068
|
+
name: data.name,
|
|
2069
|
+
from_email: data.fromEmail,
|
|
2070
|
+
from_name: data.fromName,
|
|
2071
|
+
subject: data.subject,
|
|
2072
|
+
code: data.code,
|
|
2073
|
+
text: data.text,
|
|
2074
|
+
publish: data.publish,
|
|
2075
|
+
labels: data.labels
|
|
2076
|
+
}
|
|
2077
|
+
});
|
|
2078
|
+
return decodeOne(response, crmMailTemplateMapper);
|
|
2079
|
+
},
|
|
2080
|
+
async updateMandrillTemplate (uniqueId, data) {
|
|
2081
|
+
const response = await transport.put(`/mailtemplates/${uniqueId}/mandrill`, {
|
|
2082
|
+
mandrill: {
|
|
2083
|
+
from_email: data.fromEmail,
|
|
2084
|
+
from_name: data.fromName,
|
|
2085
|
+
subject: data.subject,
|
|
2086
|
+
code: data.code,
|
|
2087
|
+
text: data.text,
|
|
2088
|
+
publish: data.publish,
|
|
2089
|
+
labels: data.labels
|
|
2090
|
+
}
|
|
2091
|
+
});
|
|
2092
|
+
return decodeOne(response, crmMailTemplateMapper);
|
|
2093
|
+
},
|
|
2094
|
+
async publishMandrill (uniqueId) {
|
|
2095
|
+
const response = await transport.put(`/mailtemplates/${uniqueId}/mandrill/publish`, {});
|
|
2096
|
+
return decodeOne(response, crmMailTemplateMapper);
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
function createCommunicationsService(transport, _config) {
|
|
2102
|
+
return {
|
|
2103
|
+
async unsubscribe (data) {
|
|
2104
|
+
const response = await transport.post('/communications/unsubscribe', {
|
|
2105
|
+
unsubscribe: {
|
|
2106
|
+
email: data.email,
|
|
2107
|
+
reason: data.reason,
|
|
2108
|
+
campaign_id: data.campaignId,
|
|
2109
|
+
payload: data.payload
|
|
2110
|
+
}
|
|
2111
|
+
});
|
|
2112
|
+
var _response_success;
|
|
2113
|
+
return {
|
|
2114
|
+
success: (_response_success = response.success) != null ? _response_success : true,
|
|
2115
|
+
email: response.email || data.email,
|
|
2116
|
+
unsubscribedAt: new Date(response.unsubscribed_at || Date.now())
|
|
2117
|
+
};
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
const crmUserMapper = {
|
|
2123
|
+
type: 'user',
|
|
2124
|
+
map: (resource)=>{
|
|
2125
|
+
var _resource_attributes_enabled;
|
|
2126
|
+
return {
|
|
2127
|
+
id: resource.id,
|
|
2128
|
+
uniqueId: resource.attributes['unique_id'],
|
|
2129
|
+
email: resource.attributes['email'],
|
|
2130
|
+
name: resource.attributes['name'],
|
|
2131
|
+
phone: resource.attributes['phone'],
|
|
2132
|
+
status: parseStatus(resource.attributes['status']),
|
|
2133
|
+
enabled: (_resource_attributes_enabled = resource.attributes['enabled']) != null ? _resource_attributes_enabled : true,
|
|
2134
|
+
payload: resource.attributes['payload'],
|
|
2135
|
+
createdAt: parseDate(resource.attributes['created_at']),
|
|
2136
|
+
updatedAt: parseDate(resource.attributes['updated_at'])
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
|
|
2141
|
+
function createCrmUsersService(transport, _config) {
|
|
2142
|
+
return {
|
|
2143
|
+
async list (params) {
|
|
2144
|
+
const queryParams = {};
|
|
2145
|
+
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
2146
|
+
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
2147
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
2148
|
+
if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
|
|
2149
|
+
const response = await transport.get('/users', {
|
|
2150
|
+
params: queryParams
|
|
2151
|
+
});
|
|
2152
|
+
return decodePageResult(response, crmUserMapper);
|
|
2153
|
+
},
|
|
2154
|
+
async get (uniqueId) {
|
|
2155
|
+
const response = await transport.get(`/users/${uniqueId}`);
|
|
2156
|
+
return decodeOne(response, crmUserMapper);
|
|
2157
|
+
},
|
|
2158
|
+
async register (uniqueId, data) {
|
|
2159
|
+
const response = await transport.post(`/users/${uniqueId}/register`, {
|
|
2160
|
+
user: {
|
|
2161
|
+
email: data.email,
|
|
2162
|
+
name: data.name,
|
|
2163
|
+
phone: data.phone,
|
|
2164
|
+
payload: data.payload
|
|
2165
|
+
}
|
|
2166
|
+
});
|
|
2167
|
+
return decodeOne(response, crmUserMapper);
|
|
2168
|
+
},
|
|
2169
|
+
async delete (uniqueId) {
|
|
2170
|
+
await transport.delete(`/users/${uniqueId}`);
|
|
2171
|
+
},
|
|
2172
|
+
async getContacts (uniqueId) {
|
|
2173
|
+
const response = await transport.get(`/users/${uniqueId}/contacts`);
|
|
2174
|
+
return decodeMany(response, contactMapper);
|
|
2175
|
+
},
|
|
2176
|
+
async getMeetings (uniqueId) {
|
|
2177
|
+
const response = await transport.get(`/users/${uniqueId}/meetings`);
|
|
2178
|
+
return decodeMany(response, meetingMapper);
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
function createBillingReportsService(transport, _config) {
|
|
2184
|
+
return {
|
|
2185
|
+
async getRevenueReport (params) {
|
|
2186
|
+
const queryParams = {};
|
|
2187
|
+
if (params == null ? void 0 : params.startDate) queryParams['start_date'] = params.startDate;
|
|
2188
|
+
if (params == null ? void 0 : params.endDate) queryParams['end_date'] = params.endDate;
|
|
2189
|
+
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
2190
|
+
const response = await transport.get('/billings/reports/revenue', {
|
|
2191
|
+
params: queryParams
|
|
2192
|
+
});
|
|
2193
|
+
return {
|
|
2194
|
+
totalRevenue: response.total_revenue,
|
|
2195
|
+
totalBilled: response.total_billed,
|
|
2196
|
+
totalPaid: response.total_paid,
|
|
2197
|
+
totalOutstanding: response.total_outstanding,
|
|
2198
|
+
currency: response.currency,
|
|
2199
|
+
period: {
|
|
2200
|
+
startDate: new Date(response.period.start_date),
|
|
2201
|
+
endDate: new Date(response.period.end_date)
|
|
2202
|
+
},
|
|
2203
|
+
breakdown: {
|
|
2204
|
+
byMonth: response.breakdown.by_month,
|
|
2205
|
+
byStatus: response.breakdown.by_status
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
},
|
|
2209
|
+
async getAgingReport () {
|
|
2210
|
+
const response = await transport.get('/billings/reports/aging');
|
|
2211
|
+
return {
|
|
2212
|
+
current: response.current,
|
|
2213
|
+
thirtyDays: response.thirty_days,
|
|
2214
|
+
sixtyDays: response.sixty_days,
|
|
2215
|
+
ninetyDays: response.ninety_days,
|
|
2216
|
+
over90Days: response.over_90_days,
|
|
2217
|
+
total: response.total,
|
|
2218
|
+
items: (response.items || []).map((i)=>({
|
|
2219
|
+
billingUniqueId: i.billing_unique_id,
|
|
2220
|
+
accountName: i.account_name,
|
|
2221
|
+
contactName: i.contact_name,
|
|
2222
|
+
amount: i.amount,
|
|
2223
|
+
dueDate: new Date(i.due_date),
|
|
2224
|
+
daysOutstanding: i.days_outstanding
|
|
2225
|
+
}))
|
|
2226
|
+
};
|
|
2227
|
+
},
|
|
2228
|
+
async getParticipantReport (participantEmail) {
|
|
2229
|
+
const response = await transport.get(`/billings/reports/participant/${encodeURIComponent(participantEmail)}`);
|
|
2230
|
+
return {
|
|
2231
|
+
participantEmail: response.participant_email,
|
|
2232
|
+
totalBilled: response.total_billed,
|
|
2233
|
+
totalPaid: response.total_paid,
|
|
2234
|
+
totalOutstanding: response.total_outstanding,
|
|
2235
|
+
sessions: (response.sessions || []).map((s)=>({
|
|
2236
|
+
meetingUniqueId: s.meeting_unique_id,
|
|
2237
|
+
date: new Date(s.date),
|
|
2238
|
+
amount: s.amount,
|
|
2239
|
+
status: s.status
|
|
2240
|
+
}))
|
|
2241
|
+
};
|
|
2242
|
+
}
|
|
2243
|
+
};
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
function createCalendarSyncService(transport, _config) {
|
|
2247
|
+
return {
|
|
2248
|
+
async syncUser (userUniqueId) {
|
|
2249
|
+
const response = await transport.post(`/users/${userUniqueId}/calendar/sync`, {});
|
|
2250
|
+
var _response_success;
|
|
2251
|
+
return {
|
|
2252
|
+
success: (_response_success = response.success) != null ? _response_success : true,
|
|
2253
|
+
syncedEvents: response.synced_events || 0,
|
|
2254
|
+
errors: response.errors,
|
|
2255
|
+
syncedAt: new Date(response.synced_at || Date.now())
|
|
2256
|
+
};
|
|
2257
|
+
},
|
|
2258
|
+
async syncTenant () {
|
|
2259
|
+
const response = await transport.post('/calendar/sync', {});
|
|
2260
|
+
var _response_success;
|
|
2261
|
+
return {
|
|
2262
|
+
success: (_response_success = response.success) != null ? _response_success : true,
|
|
2263
|
+
syncedEvents: response.synced_events || 0,
|
|
2264
|
+
errors: response.errors,
|
|
2265
|
+
syncedAt: new Date(response.synced_at || Date.now())
|
|
2266
|
+
};
|
|
2267
|
+
}
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
function createCrmBlock(transport, config) {
|
|
2272
|
+
return {
|
|
2273
|
+
accounts: createAccountsService(transport),
|
|
2274
|
+
contacts: createContactsService(transport),
|
|
2275
|
+
contactEvents: createContactEventsService(transport),
|
|
2276
|
+
leads: createLeadsService(transport),
|
|
2277
|
+
leadFollows: createLeadFollowsService(transport),
|
|
2278
|
+
opportunities: createOpportunitiesService(transport),
|
|
2279
|
+
meetings: createMeetingsService(transport),
|
|
2280
|
+
meetingParticipants: createMeetingParticipantsService(transport),
|
|
2281
|
+
meetingBillings: createMeetingBillingsService(transport),
|
|
2282
|
+
quotes: createQuotesService(transport),
|
|
2283
|
+
subscribers: createSubscribersService(transport),
|
|
2284
|
+
referrals: createReferralsService(transport),
|
|
2285
|
+
touches: createTouchesService(transport),
|
|
2286
|
+
categories: createCategoriesService(transport),
|
|
2287
|
+
calendarAccounts: createCalendarAccountsService(transport),
|
|
2288
|
+
busyBlocks: createBusyBlocksService(transport),
|
|
2289
|
+
icsTokens: createIcsTokensService(transport),
|
|
2290
|
+
zoomMeetings: createZoomMeetingsService(transport),
|
|
2291
|
+
zoomHosts: createZoomHostsService(transport),
|
|
2292
|
+
mailTemplates: createCrmMailTemplatesService(transport),
|
|
2293
|
+
communications: createCommunicationsService(transport),
|
|
2294
|
+
users: createCrmUsersService(transport),
|
|
2295
|
+
billingReports: createBillingReportsService(transport),
|
|
2296
|
+
calendarSync: createCalendarSyncService(transport)
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
const crmBlockMetadata = {
|
|
2300
|
+
name: 'crm',
|
|
2301
|
+
version: '0.1.0',
|
|
2302
|
+
description: 'CRM block for managing accounts, contacts, leads, opportunities, meetings, quotes, and more',
|
|
2303
|
+
resourceTypes: [
|
|
2304
|
+
'Account',
|
|
2305
|
+
'AccountDetail',
|
|
2306
|
+
'AccountDocument',
|
|
2307
|
+
'Contact',
|
|
2308
|
+
'ContactProfile',
|
|
2309
|
+
'ContactEvent',
|
|
2310
|
+
'Lead',
|
|
2311
|
+
'LeadFollow',
|
|
2312
|
+
'Opportunity',
|
|
2313
|
+
'Meeting',
|
|
2314
|
+
'MeetingParticipant',
|
|
2315
|
+
'MeetingBilling',
|
|
2316
|
+
'Quote',
|
|
2317
|
+
'Subscriber',
|
|
2318
|
+
'Referral',
|
|
2319
|
+
'Touch',
|
|
2320
|
+
'Category',
|
|
2321
|
+
'CalendarAccount',
|
|
2322
|
+
'BusyBlock',
|
|
2323
|
+
'IcsToken',
|
|
2324
|
+
'ZoomMeeting',
|
|
2325
|
+
'ZoomHost',
|
|
2326
|
+
'CrmMailTemplate',
|
|
2327
|
+
'CrmUser'
|
|
2328
|
+
]
|
|
2329
|
+
};
|
|
2330
|
+
|
|
2331
|
+
const accountDocumentMapper = {
|
|
2332
|
+
type: 'account_document',
|
|
2333
|
+
map (resource) {
|
|
2334
|
+
const attrs = resource.attributes || {};
|
|
2335
|
+
return {
|
|
2336
|
+
id: resource.id,
|
|
2337
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
2338
|
+
accountUniqueId: parseString(attrs['account_unique_id']) || '',
|
|
2339
|
+
name: parseString(attrs['name']) || '',
|
|
2340
|
+
originalName: parseString(attrs['original_name']),
|
|
2341
|
+
description: parseString(attrs['description']),
|
|
2342
|
+
fileType: parseString(attrs['file_type']),
|
|
2343
|
+
fileSize: parseOptionalNumber(attrs['file_size']),
|
|
2344
|
+
url: parseString(attrs['url']),
|
|
2345
|
+
status: parseStatus(attrs['status']),
|
|
2346
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
2347
|
+
payload: attrs['payload'],
|
|
2348
|
+
createdAt: parseDate(attrs['created_at']),
|
|
2349
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
859
2352
|
};
|
|
860
2353
|
|
|
861
|
-
export { accountDetailMapper, accountMapper, contactMapper, contactProfileMapper, createAccountsService, createContactsService, createCrmBlock, createLeadsService, createMeetingsService, createOpportunitiesService, createQuotesService, crmBlockMetadata, leadMapper, meetingMapper, opportunityMapper, quoteMapper };
|
|
2354
|
+
export { accountCategoryMapper, accountDetailMapper, accountDocumentMapper, accountMapper, busyBlockMapper, calendarAccountMapper, categoryMapper, contactEventMapper, contactMapper, contactProfileMapper, createAccountsService, createBusyBlocksService, createCalendarAccountsService, createCategoriesService, createContactEventsService, createContactsService, createCrmBlock, createIcsTokensService, createLeadFollowsService, createLeadsService, createMeetingBillingsService, createMeetingParticipantsService, createMeetingsService, createOpportunitiesService, createQuotesService, createReferralsService, createSubscribersService, createTouchesService, createZoomHostsService, createZoomMeetingsService, crmBlockMetadata, icsTokenMapper, leadFollowMapper, leadMapper, meetingBillingMapper, meetingMapper, meetingParticipantMapper, opportunityMapper, quoteMapper, referralMapper, subscriberMapper, touchMapper, zoomHostMapper, zoomMeetingMapper };
|