@scryme/chat 2.71.1 → 2.81.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +610 -0
- package/dist/sdk.d.ts +230 -0
- package/dist/sdk.js +151 -0
- package/package.json +1 -1
- package/src/__tests__/sdk.test.ts +84 -0
- package/src/sdk.ts +332 -0
package/src/sdk.ts
CHANGED
|
@@ -438,6 +438,148 @@ export interface UserProfile {
|
|
|
438
438
|
createdAt?: string;
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
+
/**
|
|
442
|
+
* Represents a customer profile for support and CRM tracking.
|
|
443
|
+
*/
|
|
444
|
+
export interface CustomerProfile {
|
|
445
|
+
/** Unique customer profile identifier. */
|
|
446
|
+
id: string;
|
|
447
|
+
/** Unique user identifier. */
|
|
448
|
+
userId: string;
|
|
449
|
+
/** Associated workspace identifier. */
|
|
450
|
+
workspaceId: string;
|
|
451
|
+
/** Optional company name. */
|
|
452
|
+
company?: string | null;
|
|
453
|
+
/** Optional job title. */
|
|
454
|
+
jobTitle?: string | null;
|
|
455
|
+
/** External CRM identifier. */
|
|
456
|
+
crmId?: string | null;
|
|
457
|
+
/** Custom metadata key-value store. */
|
|
458
|
+
metadata?: Record<string, unknown> | null;
|
|
459
|
+
/** Array of customer tags. */
|
|
460
|
+
tags?: string[];
|
|
461
|
+
/** Associated user profile details. */
|
|
462
|
+
user?: UserProfile;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Represents a support ticket.
|
|
467
|
+
*/
|
|
468
|
+
export interface SupportTicket {
|
|
469
|
+
/** Unique ticket identifier. */
|
|
470
|
+
id: string;
|
|
471
|
+
/** Subject line or title of the ticket. */
|
|
472
|
+
subject: string;
|
|
473
|
+
/** Status of the ticket (OPEN, IN_PROGRESS, RESOLVED, CLOSED). */
|
|
474
|
+
status: string;
|
|
475
|
+
/** Unique workspace identifier. */
|
|
476
|
+
workspaceId: string;
|
|
477
|
+
/** Unique customer profile identifier. */
|
|
478
|
+
customerId: string;
|
|
479
|
+
/** Unique channel identifier created for ticket messages. */
|
|
480
|
+
channelId?: string | null;
|
|
481
|
+
/** Optional assigned agent user identifier. */
|
|
482
|
+
assigneeId?: string | null;
|
|
483
|
+
/** ISO timestamp when the ticket was created. */
|
|
484
|
+
createdAt: string;
|
|
485
|
+
/** ISO timestamp when the last message was sent. */
|
|
486
|
+
lastMessageAt: string;
|
|
487
|
+
/** Optional customer details. */
|
|
488
|
+
customer?: {
|
|
489
|
+
id: string;
|
|
490
|
+
userId: string;
|
|
491
|
+
user?: UserProfile;
|
|
492
|
+
};
|
|
493
|
+
/** Optional assignee details. */
|
|
494
|
+
assignee?: UserProfile;
|
|
495
|
+
/** Associated channel details. */
|
|
496
|
+
channel?: WorkspaceChannel;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Represents an active or ended live chat session.
|
|
501
|
+
*/
|
|
502
|
+
export interface LiveChatSession {
|
|
503
|
+
/** Unique session identifier. */
|
|
504
|
+
id: string;
|
|
505
|
+
/** Associated workspace identifier. */
|
|
506
|
+
workspaceId: string;
|
|
507
|
+
/** Optional customer profile identifier. */
|
|
508
|
+
customerId?: string | null;
|
|
509
|
+
/** Unique channel identifier for live chat. */
|
|
510
|
+
channelId: string;
|
|
511
|
+
/** Session status (ACTIVE, ENDED). */
|
|
512
|
+
status: string;
|
|
513
|
+
/** Custom metadata key-value store. */
|
|
514
|
+
metadata?: Record<string, unknown> | null;
|
|
515
|
+
/** Associated support ticket identifier if escalated. */
|
|
516
|
+
ticketId?: string | null;
|
|
517
|
+
/** ISO timestamp when live chat started. */
|
|
518
|
+
createdAt: string;
|
|
519
|
+
/** ISO timestamp when live chat ended. */
|
|
520
|
+
endedAt?: string | null;
|
|
521
|
+
/** Associated live chat channel details. */
|
|
522
|
+
channel?: WorkspaceChannel;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Options for creating a new support ticket.
|
|
527
|
+
*/
|
|
528
|
+
export interface CreateSupportTicketDto {
|
|
529
|
+
/** Unique workspace identifier where ticket is filed. */
|
|
530
|
+
workspaceId: string;
|
|
531
|
+
/** Subject or title of the support ticket. */
|
|
532
|
+
subject: string;
|
|
533
|
+
/** Initial message content to start the ticket conversation. */
|
|
534
|
+
initialMessage?: string;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Options for updating support ticket status.
|
|
539
|
+
*/
|
|
540
|
+
export interface UpdateSupportTicketStatusDto {
|
|
541
|
+
/** Target status (OPEN, IN_PROGRESS, RESOLVED, CLOSED). */
|
|
542
|
+
status: string;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Options for assigning or unassigning an agent to a support ticket.
|
|
547
|
+
*/
|
|
548
|
+
export interface AssignSupportTicketDto {
|
|
549
|
+
/** User ID of the agent to assign, or null to unassign. */
|
|
550
|
+
assigneeId: string | null;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Options for starting a new live chat session.
|
|
555
|
+
*/
|
|
556
|
+
export interface StartLiveChatDto {
|
|
557
|
+
/** Unique workspace identifier where live chat is initialized. */
|
|
558
|
+
workspaceId: string;
|
|
559
|
+
/** Optional metadata associated with the live chat session. */
|
|
560
|
+
metadata?: Record<string, unknown>;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Options for creating or updating a customer profile.
|
|
565
|
+
*/
|
|
566
|
+
export interface CreateCustomerProfileDto {
|
|
567
|
+
/** Associated workspace identifier. */
|
|
568
|
+
workspaceId: string;
|
|
569
|
+
/** User ID of the customer. */
|
|
570
|
+
userId: string;
|
|
571
|
+
/** Optional company name. */
|
|
572
|
+
company?: string;
|
|
573
|
+
/** Optional job title. */
|
|
574
|
+
jobTitle?: string;
|
|
575
|
+
/** External CRM identifier. */
|
|
576
|
+
crmId?: string;
|
|
577
|
+
/** Additional metadata key-value pairs. */
|
|
578
|
+
metadata?: Record<string, unknown>;
|
|
579
|
+
/** Tags for segmenting customers. */
|
|
580
|
+
tags?: string[];
|
|
581
|
+
}
|
|
582
|
+
|
|
441
583
|
/**
|
|
442
584
|
* Configuration options for initializing the Scryme SDK.
|
|
443
585
|
*/
|
|
@@ -1377,6 +1519,196 @@ export class ScrymeSDK {
|
|
|
1377
1519
|
};
|
|
1378
1520
|
}
|
|
1379
1521
|
|
|
1522
|
+
/**
|
|
1523
|
+
* Operations for managing support tickets, live chat sessions, and customer profiles.
|
|
1524
|
+
*/
|
|
1525
|
+
public get support() {
|
|
1526
|
+
return {
|
|
1527
|
+
/**
|
|
1528
|
+
* Creates a new support ticket in a workspace.
|
|
1529
|
+
* @param data Details for creating the ticket including workspaceId, subject, and optional initialMessage.
|
|
1530
|
+
* @param options Optional request config override.
|
|
1531
|
+
*/
|
|
1532
|
+
createTicket: async (
|
|
1533
|
+
data: CreateSupportTicketDto,
|
|
1534
|
+
options?: AxiosRequestConfig
|
|
1535
|
+
): Promise<SupportTicket> => {
|
|
1536
|
+
return this.raw.supportControllerCreateTicket({
|
|
1537
|
+
...options,
|
|
1538
|
+
data,
|
|
1539
|
+
} as any) as unknown as SupportTicket;
|
|
1540
|
+
},
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* Retrieves all support tickets for a given workspace.
|
|
1544
|
+
* @param workspaceId Unique workspace identifier.
|
|
1545
|
+
* @param options Optional request config override.
|
|
1546
|
+
*/
|
|
1547
|
+
getTickets: async (
|
|
1548
|
+
workspaceId: string,
|
|
1549
|
+
options?: AxiosRequestConfig
|
|
1550
|
+
): Promise<SupportTicket[]> => {
|
|
1551
|
+
return this.raw.supportControllerGetTickets(
|
|
1552
|
+
{ workspaceId },
|
|
1553
|
+
options
|
|
1554
|
+
) as unknown as SupportTicket[];
|
|
1555
|
+
},
|
|
1556
|
+
|
|
1557
|
+
/**
|
|
1558
|
+
* Updates the status of an existing support ticket.
|
|
1559
|
+
* @param ticketId Unique identifier of the support ticket.
|
|
1560
|
+
* @param status New status string (e.g. OPEN, IN_PROGRESS, RESOLVED, CLOSED).
|
|
1561
|
+
* @param options Optional request config override.
|
|
1562
|
+
*/
|
|
1563
|
+
updateStatus: async (
|
|
1564
|
+
ticketId: string,
|
|
1565
|
+
status: string,
|
|
1566
|
+
options?: AxiosRequestConfig
|
|
1567
|
+
): Promise<SupportTicket> => {
|
|
1568
|
+
return this.raw.supportControllerUpdateTicketStatus(ticketId, {
|
|
1569
|
+
...options,
|
|
1570
|
+
data: { status },
|
|
1571
|
+
} as any) as unknown as SupportTicket;
|
|
1572
|
+
},
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Assigns a support ticket to an agent or unassigns it.
|
|
1576
|
+
* @param ticketId Unique identifier of the support ticket.
|
|
1577
|
+
* @param assigneeId User ID of the assigned agent or null to unassign.
|
|
1578
|
+
* @param options Optional request config override.
|
|
1579
|
+
*/
|
|
1580
|
+
assignTicket: async (
|
|
1581
|
+
ticketId: string,
|
|
1582
|
+
assigneeId: string | null,
|
|
1583
|
+
options?: AxiosRequestConfig
|
|
1584
|
+
): Promise<SupportTicket> => {
|
|
1585
|
+
return this.raw.supportControllerAssignTicket(ticketId, {
|
|
1586
|
+
...options,
|
|
1587
|
+
data: { assigneeId },
|
|
1588
|
+
} as any) as unknown as SupportTicket;
|
|
1589
|
+
},
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* Sub-namespace for managing support tickets.
|
|
1593
|
+
*/
|
|
1594
|
+
tickets: {
|
|
1595
|
+
/**
|
|
1596
|
+
* Creates a new support ticket in a workspace.
|
|
1597
|
+
* @param data Details for creating the ticket.
|
|
1598
|
+
* @param options Optional request config override.
|
|
1599
|
+
*/
|
|
1600
|
+
create: async (
|
|
1601
|
+
data: CreateSupportTicketDto,
|
|
1602
|
+
options?: AxiosRequestConfig
|
|
1603
|
+
): Promise<SupportTicket> => {
|
|
1604
|
+
return this.support.createTicket(data, options);
|
|
1605
|
+
},
|
|
1606
|
+
/**
|
|
1607
|
+
* Lists all support tickets in a workspace.
|
|
1608
|
+
* @param workspaceId Unique workspace identifier.
|
|
1609
|
+
* @param options Optional request config override.
|
|
1610
|
+
*/
|
|
1611
|
+
list: async (
|
|
1612
|
+
workspaceId: string,
|
|
1613
|
+
options?: AxiosRequestConfig
|
|
1614
|
+
): Promise<SupportTicket[]> => {
|
|
1615
|
+
return this.support.getTickets(workspaceId, options);
|
|
1616
|
+
},
|
|
1617
|
+
/**
|
|
1618
|
+
* Updates ticket status.
|
|
1619
|
+
* @param ticketId Unique ticket identifier.
|
|
1620
|
+
* @param status New status string.
|
|
1621
|
+
* @param options Optional request config override.
|
|
1622
|
+
*/
|
|
1623
|
+
updateStatus: async (
|
|
1624
|
+
ticketId: string,
|
|
1625
|
+
status: string,
|
|
1626
|
+
options?: AxiosRequestConfig
|
|
1627
|
+
): Promise<SupportTicket> => {
|
|
1628
|
+
return this.support.updateStatus(ticketId, status, options);
|
|
1629
|
+
},
|
|
1630
|
+
/**
|
|
1631
|
+
* Assigns or unassigns an agent to/from a support ticket.
|
|
1632
|
+
* @param ticketId Unique ticket identifier.
|
|
1633
|
+
* @param assigneeId Agent user ID or null.
|
|
1634
|
+
* @param options Optional request config override.
|
|
1635
|
+
*/
|
|
1636
|
+
assign: async (
|
|
1637
|
+
ticketId: string,
|
|
1638
|
+
assigneeId: string | null,
|
|
1639
|
+
options?: AxiosRequestConfig
|
|
1640
|
+
): Promise<SupportTicket> => {
|
|
1641
|
+
return this.support.assignTicket(ticketId, assigneeId, options);
|
|
1642
|
+
},
|
|
1643
|
+
},
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* Sub-namespace for live chat sessions.
|
|
1647
|
+
*/
|
|
1648
|
+
liveChat: {
|
|
1649
|
+
/**
|
|
1650
|
+
* Starts a new live chat session for support.
|
|
1651
|
+
* @param data Details for starting live chat session.
|
|
1652
|
+
* @param options Optional request config override.
|
|
1653
|
+
*/
|
|
1654
|
+
start: async (
|
|
1655
|
+
data: StartLiveChatDto,
|
|
1656
|
+
options?: AxiosRequestConfig
|
|
1657
|
+
): Promise<LiveChatSession> => {
|
|
1658
|
+
return this.raw.supportControllerStartLiveChat({
|
|
1659
|
+
...options,
|
|
1660
|
+
data,
|
|
1661
|
+
} as any) as unknown as LiveChatSession;
|
|
1662
|
+
},
|
|
1663
|
+
/**
|
|
1664
|
+
* Ends an active live chat session.
|
|
1665
|
+
* @param sessionId Unique session identifier.
|
|
1666
|
+
* @param options Optional request config override.
|
|
1667
|
+
*/
|
|
1668
|
+
end: async (
|
|
1669
|
+
sessionId: string,
|
|
1670
|
+
options?: AxiosRequestConfig
|
|
1671
|
+
): Promise<LiveChatSession> => {
|
|
1672
|
+
return this.raw.supportControllerEndLiveChat(sessionId, options) as unknown as LiveChatSession;
|
|
1673
|
+
},
|
|
1674
|
+
},
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Sub-namespace for managing customer profiles.
|
|
1678
|
+
*/
|
|
1679
|
+
customer: {
|
|
1680
|
+
/**
|
|
1681
|
+
* Creates or updates a customer profile in a workspace.
|
|
1682
|
+
* @param data Profile details including workspaceId and userId.
|
|
1683
|
+
* @param options Optional request config override.
|
|
1684
|
+
*/
|
|
1685
|
+
createProfile: async (
|
|
1686
|
+
data: CreateCustomerProfileDto,
|
|
1687
|
+
options?: AxiosRequestConfig
|
|
1688
|
+
): Promise<CustomerProfile> => {
|
|
1689
|
+
return this.raw.supportControllerCreateCustomerProfile({
|
|
1690
|
+
...options,
|
|
1691
|
+
data,
|
|
1692
|
+
} as any) as unknown as CustomerProfile;
|
|
1693
|
+
},
|
|
1694
|
+
/**
|
|
1695
|
+
* Retrieves customer profiles in a workspace.
|
|
1696
|
+
* @param workspaceId Unique workspace identifier.
|
|
1697
|
+
* @param options Optional request config override.
|
|
1698
|
+
*/
|
|
1699
|
+
getProfiles: async (
|
|
1700
|
+
workspaceId: string,
|
|
1701
|
+
options?: AxiosRequestConfig
|
|
1702
|
+
): Promise<CustomerProfile[]> => {
|
|
1703
|
+
return this.raw.supportControllerGetCustomerProfiles(
|
|
1704
|
+
{ workspaceId },
|
|
1705
|
+
options
|
|
1706
|
+
) as unknown as CustomerProfile[];
|
|
1707
|
+
},
|
|
1708
|
+
},
|
|
1709
|
+
};
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1380
1712
|
/**
|
|
1381
1713
|
* First-class namespace for Machine-to-Machine (M2M) operations,
|
|
1382
1714
|
* grouping V3 Enterprise M2M APIs into logical, highly cohesive spaces.
|