@23blocks/block-crm 2.0.0 → 2.1.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 +1198 -4
- 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 +14 -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 +14 -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/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/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/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/categories.service.d.ts +13 -0
- package/dist/src/lib/services/categories.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 +13 -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/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/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/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/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 +14 -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/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/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
|
@@ -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,809 @@ function createQuotesService(transport, _config) {
|
|
|
832
1247
|
};
|
|
833
1248
|
}
|
|
834
1249
|
|
|
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) {
|
|
1274
|
+
return {
|
|
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
|
+
}
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
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
|
+
|
|
835
1979
|
function createCrmBlock(transport, config) {
|
|
836
1980
|
return {
|
|
837
1981
|
accounts: createAccountsService(transport),
|
|
838
1982
|
contacts: createContactsService(transport),
|
|
1983
|
+
contactEvents: createContactEventsService(transport),
|
|
839
1984
|
leads: createLeadsService(transport),
|
|
1985
|
+
leadFollows: createLeadFollowsService(transport),
|
|
840
1986
|
opportunities: createOpportunitiesService(transport),
|
|
841
1987
|
meetings: createMeetingsService(transport),
|
|
842
|
-
|
|
1988
|
+
meetingParticipants: createMeetingParticipantsService(transport),
|
|
1989
|
+
meetingBillings: createMeetingBillingsService(transport),
|
|
1990
|
+
quotes: createQuotesService(transport),
|
|
1991
|
+
subscribers: createSubscribersService(transport),
|
|
1992
|
+
referrals: createReferralsService(transport),
|
|
1993
|
+
touches: createTouchesService(transport),
|
|
1994
|
+
categories: createCategoriesService(transport),
|
|
1995
|
+
calendarAccounts: createCalendarAccountsService(transport),
|
|
1996
|
+
busyBlocks: createBusyBlocksService(transport),
|
|
1997
|
+
icsTokens: createIcsTokensService(transport),
|
|
1998
|
+
zoomMeetings: createZoomMeetingsService(transport),
|
|
1999
|
+
zoomHosts: createZoomHostsService(transport)
|
|
843
2000
|
};
|
|
844
2001
|
}
|
|
845
2002
|
const crmBlockMetadata = {
|
|
846
2003
|
name: 'crm',
|
|
847
2004
|
version: '0.1.0',
|
|
848
|
-
description: 'CRM block for managing accounts, contacts, leads, opportunities, meetings, and
|
|
2005
|
+
description: 'CRM block for managing accounts, contacts, leads, opportunities, meetings, quotes, and more',
|
|
849
2006
|
resourceTypes: [
|
|
850
2007
|
'Account',
|
|
851
2008
|
'AccountDetail',
|
|
2009
|
+
'AccountDocument',
|
|
852
2010
|
'Contact',
|
|
853
2011
|
'ContactProfile',
|
|
2012
|
+
'ContactEvent',
|
|
854
2013
|
'Lead',
|
|
2014
|
+
'LeadFollow',
|
|
855
2015
|
'Opportunity',
|
|
856
2016
|
'Meeting',
|
|
857
|
-
'
|
|
2017
|
+
'MeetingParticipant',
|
|
2018
|
+
'MeetingBilling',
|
|
2019
|
+
'Quote',
|
|
2020
|
+
'Subscriber',
|
|
2021
|
+
'Referral',
|
|
2022
|
+
'Touch',
|
|
2023
|
+
'Category',
|
|
2024
|
+
'CalendarAccount',
|
|
2025
|
+
'BusyBlock',
|
|
2026
|
+
'IcsToken',
|
|
2027
|
+
'ZoomMeeting',
|
|
2028
|
+
'ZoomHost'
|
|
858
2029
|
]
|
|
859
2030
|
};
|
|
860
2031
|
|
|
861
|
-
|
|
2032
|
+
const accountDocumentMapper = {
|
|
2033
|
+
type: 'account_document',
|
|
2034
|
+
map (resource) {
|
|
2035
|
+
const attrs = resource.attributes || {};
|
|
2036
|
+
return {
|
|
2037
|
+
id: resource.id,
|
|
2038
|
+
uniqueId: parseString(attrs['unique_id']) || resource.id,
|
|
2039
|
+
accountUniqueId: parseString(attrs['account_unique_id']) || '',
|
|
2040
|
+
name: parseString(attrs['name']) || '',
|
|
2041
|
+
originalName: parseString(attrs['original_name']),
|
|
2042
|
+
description: parseString(attrs['description']),
|
|
2043
|
+
fileType: parseString(attrs['file_type']),
|
|
2044
|
+
fileSize: parseOptionalNumber(attrs['file_size']),
|
|
2045
|
+
url: parseString(attrs['url']),
|
|
2046
|
+
status: parseStatus(attrs['status']),
|
|
2047
|
+
enabled: parseBoolean(attrs['enabled']),
|
|
2048
|
+
payload: attrs['payload'],
|
|
2049
|
+
createdAt: parseDate(attrs['created_at']),
|
|
2050
|
+
updatedAt: parseDate(attrs['updated_at'])
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
};
|
|
2054
|
+
|
|
2055
|
+
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 };
|