@dispatchtickets/sdk 0.6.0 → 0.8.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/README.md +38 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# @dispatchtickets/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@dispatchtickets/sdk)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
Official TypeScript SDK for the [Dispatch Tickets](https://dispatchtickets.com) API.
|
|
4
7
|
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
@@ -37,6 +40,38 @@ await client.comments.create('ws_abc123', ticket.id, {
|
|
|
37
40
|
});
|
|
38
41
|
```
|
|
39
42
|
|
|
43
|
+
## Portal API (End-User Access)
|
|
44
|
+
|
|
45
|
+
For customer-facing integrations, use `DispatchPortal` to let end-users view and manage their own tickets:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { DispatchTickets, DispatchPortal } from '@dispatchtickets/sdk';
|
|
49
|
+
|
|
50
|
+
// 1. Backend: Generate a portal token for your user
|
|
51
|
+
const admin = new DispatchTickets({ apiKey: 'sk_live_xxx' });
|
|
52
|
+
const { token } = await admin.brands.generatePortalToken('br_xxx', {
|
|
53
|
+
email: user.email,
|
|
54
|
+
name: user.name,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// 2. Frontend: Use the token to access tickets
|
|
58
|
+
const portal = new DispatchPortal({ token });
|
|
59
|
+
|
|
60
|
+
// List user's tickets
|
|
61
|
+
const { data: tickets } = await portal.tickets.list();
|
|
62
|
+
|
|
63
|
+
// Create a new ticket
|
|
64
|
+
const ticket = await portal.tickets.create({
|
|
65
|
+
title: 'Help with my order',
|
|
66
|
+
body: 'Order #12345 has not arrived...',
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Add a comment
|
|
70
|
+
await portal.tickets.addComment(ticket.id, 'Here is more information...');
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Portal tokens are scoped to a single customer and expire after 1 hour. See the [Integration Guide](https://dispatchtickets.com/docs/integration) for complete examples.
|
|
74
|
+
|
|
40
75
|
## Configuration
|
|
41
76
|
|
|
42
77
|
```typescript
|
|
@@ -477,6 +512,8 @@ This creates a `docs/` folder with HTML documentation for all exported types and
|
|
|
477
512
|
|
|
478
513
|
## Links
|
|
479
514
|
|
|
515
|
+
- [Website](https://dispatchtickets.com)
|
|
516
|
+
- [Integration Guide](https://dispatchtickets.com/docs/integration)
|
|
480
517
|
- [API Reference (Swagger)](https://dispatch-tickets-api.onrender.com/docs)
|
|
481
518
|
- [GitHub](https://github.com/Epic-Design-Labs/app-dispatchtickets-sdk)
|
|
482
519
|
- [Changelog](./CHANGELOG.md)
|
package/dist/index.d.cts
CHANGED
|
@@ -346,6 +346,8 @@ interface Brand {
|
|
|
346
346
|
autoresponseBody?: string;
|
|
347
347
|
fromName?: string;
|
|
348
348
|
fromEmail?: string;
|
|
349
|
+
/** Allowed origins for portal API CORS */
|
|
350
|
+
portalOrigins: string[];
|
|
349
351
|
createdAt: string;
|
|
350
352
|
updatedAt: string;
|
|
351
353
|
}
|
|
@@ -376,6 +378,8 @@ interface UpdateBrandInput {
|
|
|
376
378
|
autoresponseBody?: string;
|
|
377
379
|
metadata?: Record<string, unknown>;
|
|
378
380
|
ticketSchema?: Record<string, unknown>;
|
|
381
|
+
/** Allowed origins for portal API CORS. Empty array = block all cross-origin requests. */
|
|
382
|
+
portalOrigins?: string[];
|
|
379
383
|
}
|
|
380
384
|
/**
|
|
381
385
|
* Brand deletion preview result
|
package/dist/index.d.ts
CHANGED
|
@@ -346,6 +346,8 @@ interface Brand {
|
|
|
346
346
|
autoresponseBody?: string;
|
|
347
347
|
fromName?: string;
|
|
348
348
|
fromEmail?: string;
|
|
349
|
+
/** Allowed origins for portal API CORS */
|
|
350
|
+
portalOrigins: string[];
|
|
349
351
|
createdAt: string;
|
|
350
352
|
updatedAt: string;
|
|
351
353
|
}
|
|
@@ -376,6 +378,8 @@ interface UpdateBrandInput {
|
|
|
376
378
|
autoresponseBody?: string;
|
|
377
379
|
metadata?: Record<string, unknown>;
|
|
378
380
|
ticketSchema?: Record<string, unknown>;
|
|
381
|
+
/** Allowed origins for portal API CORS. Empty array = block all cross-origin requests. */
|
|
382
|
+
portalOrigins?: string[];
|
|
379
383
|
}
|
|
380
384
|
/**
|
|
381
385
|
* Brand deletion preview result
|