@15gifts/sdk 0.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/README.md +3 -0
- package/dist/index.d.mts +859 -0
- package/dist/index.d.ts +859 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +29 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,859 @@
|
|
|
1
|
+
import { Client as Client$1 } from 'openapi-fetch';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file was auto-generated by openapi-typescript.
|
|
5
|
+
* Do not make direct changes to the file.
|
|
6
|
+
*/
|
|
7
|
+
interface paths$1 {
|
|
8
|
+
'/api/v1/conversation/': {
|
|
9
|
+
parameters: {
|
|
10
|
+
query?: never;
|
|
11
|
+
header?: never;
|
|
12
|
+
path?: never;
|
|
13
|
+
cookie?: never;
|
|
14
|
+
};
|
|
15
|
+
get?: never;
|
|
16
|
+
put?: never;
|
|
17
|
+
/**
|
|
18
|
+
* Generate Conversation Response
|
|
19
|
+
* @description Generates a response based on the users last message and the conversation id.
|
|
20
|
+
* The opening message should be the message that is displayed to the user when the engine is first opened, this is currently generated by the frontend,
|
|
21
|
+
* this message forms part of the conversation history, not that if the conversation id is not null then the opening message is ignored.
|
|
22
|
+
*
|
|
23
|
+
* This endpoint meets the contract that is outlined in
|
|
24
|
+
* [here](https://15gifts.atlassian.net/wiki/spaces/AI/pages/4319346722/Contracts+between+Conversation+Speech+Bowser+and+User+Experience+Admin+Rayman+teams).
|
|
25
|
+
*/
|
|
26
|
+
post: operations['generate_conversation_response_api_v1_conversation__post'];
|
|
27
|
+
delete?: never;
|
|
28
|
+
options?: never;
|
|
29
|
+
head?: never;
|
|
30
|
+
patch?: never;
|
|
31
|
+
trace?: never;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface components {
|
|
35
|
+
schemas: {
|
|
36
|
+
/** ConversationRequest */
|
|
37
|
+
ConversationRequest: {
|
|
38
|
+
/**
|
|
39
|
+
* Customerid
|
|
40
|
+
* @description The customer id
|
|
41
|
+
*/
|
|
42
|
+
customerId: string;
|
|
43
|
+
/**
|
|
44
|
+
* Conversationid
|
|
45
|
+
* @description The conversation id
|
|
46
|
+
*/
|
|
47
|
+
conversationId?: string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Usermessage
|
|
50
|
+
* @description The user message
|
|
51
|
+
*/
|
|
52
|
+
userMessage: string;
|
|
53
|
+
/**
|
|
54
|
+
* Openingmessage
|
|
55
|
+
* @description The opening message of the conversation
|
|
56
|
+
*/
|
|
57
|
+
openingMessage?: string | null;
|
|
58
|
+
/**
|
|
59
|
+
* Userid
|
|
60
|
+
* @description Id to identify the user, this should be unified across the entire product.
|
|
61
|
+
*/
|
|
62
|
+
userId?: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Sessionid
|
|
65
|
+
* Format: uuid
|
|
66
|
+
* @description Id to identify the session that the conversation is in, this should be unified across the product
|
|
67
|
+
*/
|
|
68
|
+
sessionId: string;
|
|
69
|
+
};
|
|
70
|
+
/** HTTPValidationError */
|
|
71
|
+
HTTPValidationError: {
|
|
72
|
+
/** Detail */
|
|
73
|
+
detail?: components['schemas']['ValidationError'][];
|
|
74
|
+
};
|
|
75
|
+
/** ValidationError */
|
|
76
|
+
ValidationError: {
|
|
77
|
+
/** Location */
|
|
78
|
+
loc: (string | number)[];
|
|
79
|
+
/** Message */
|
|
80
|
+
msg: string;
|
|
81
|
+
/** Error Type */
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
responses: never;
|
|
86
|
+
parameters: never;
|
|
87
|
+
requestBodies: never;
|
|
88
|
+
headers: never;
|
|
89
|
+
pathItems: never;
|
|
90
|
+
}
|
|
91
|
+
interface operations {
|
|
92
|
+
generate_conversation_response_api_v1_conversation__post: {
|
|
93
|
+
parameters: {
|
|
94
|
+
query?: never;
|
|
95
|
+
header?: {
|
|
96
|
+
'user-agent'?: string;
|
|
97
|
+
/**
|
|
98
|
+
* @description Comma-separated list of feature flags (flags might require elevated permissions)
|
|
99
|
+
* @example debug,no-decision-forest
|
|
100
|
+
*/
|
|
101
|
+
'x-feature-flags'?: string | null;
|
|
102
|
+
};
|
|
103
|
+
path?: never;
|
|
104
|
+
cookie?: never;
|
|
105
|
+
};
|
|
106
|
+
requestBody: {
|
|
107
|
+
content: {
|
|
108
|
+
'application/json': components['schemas']['ConversationRequest'];
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
responses: {
|
|
112
|
+
/** @description A successful response from the conversation service */
|
|
113
|
+
200: {
|
|
114
|
+
headers: {
|
|
115
|
+
[name: string]: unknown;
|
|
116
|
+
};
|
|
117
|
+
content: {
|
|
118
|
+
'text/event-stream': string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
/** @description The user does not have permission to access the requested data */
|
|
122
|
+
403: {
|
|
123
|
+
headers: {
|
|
124
|
+
[name: string]: unknown;
|
|
125
|
+
};
|
|
126
|
+
content: {
|
|
127
|
+
'application/json': unknown;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/** @description The customer config was not found */
|
|
131
|
+
404: {
|
|
132
|
+
headers: {
|
|
133
|
+
[name: string]: unknown;
|
|
134
|
+
};
|
|
135
|
+
content: {
|
|
136
|
+
'application/json': unknown;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
/** @description Validation Error */
|
|
140
|
+
422: {
|
|
141
|
+
headers: {
|
|
142
|
+
[name: string]: unknown;
|
|
143
|
+
};
|
|
144
|
+
content: {
|
|
145
|
+
'application/json': components['schemas']['HTTPValidationError'];
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* This file was auto-generated by openapi-typescript.
|
|
154
|
+
* Do not make direct changes to the file.
|
|
155
|
+
*/
|
|
156
|
+
interface paths {
|
|
157
|
+
'/api/config/v2/{customerId}': {
|
|
158
|
+
parameters: {
|
|
159
|
+
query?: never;
|
|
160
|
+
header?: never;
|
|
161
|
+
path?: never;
|
|
162
|
+
cookie?: never;
|
|
163
|
+
};
|
|
164
|
+
get?: never;
|
|
165
|
+
put?: never;
|
|
166
|
+
/**
|
|
167
|
+
* Get front-end configuration
|
|
168
|
+
* @description Get front-end configuration for the partner identified by the given ID
|
|
169
|
+
*/
|
|
170
|
+
post: {
|
|
171
|
+
parameters: {
|
|
172
|
+
query?: never;
|
|
173
|
+
header?: never;
|
|
174
|
+
path: {
|
|
175
|
+
/** @description Customer ID */
|
|
176
|
+
customerId: string;
|
|
177
|
+
};
|
|
178
|
+
cookie?: never;
|
|
179
|
+
};
|
|
180
|
+
/** @description Product Expert user feedback */
|
|
181
|
+
requestBody: {
|
|
182
|
+
content: {
|
|
183
|
+
'application/json': {
|
|
184
|
+
/**
|
|
185
|
+
* Format: uri
|
|
186
|
+
* @description URL of the page where the product-expert will be shown
|
|
187
|
+
* @example https://www.example.com/telco/
|
|
188
|
+
*/
|
|
189
|
+
url: string;
|
|
190
|
+
/** @description User ID */
|
|
191
|
+
userId?: string;
|
|
192
|
+
/** @description Session ID */
|
|
193
|
+
sessionId: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
responses: {
|
|
198
|
+
/** @description Successful response */
|
|
199
|
+
200: {
|
|
200
|
+
headers: {
|
|
201
|
+
[name: string]: unknown;
|
|
202
|
+
};
|
|
203
|
+
content: {
|
|
204
|
+
'application/json': {
|
|
205
|
+
frontend: {
|
|
206
|
+
customer: {
|
|
207
|
+
id: string;
|
|
208
|
+
displayName: string;
|
|
209
|
+
domain?: string;
|
|
210
|
+
};
|
|
211
|
+
engage: {
|
|
212
|
+
text: string;
|
|
213
|
+
/** @enum {string} */
|
|
214
|
+
type: 'floating' | 'embedded' | 'embedded-fullwidth';
|
|
215
|
+
};
|
|
216
|
+
styles: {
|
|
217
|
+
primaryColor: string;
|
|
218
|
+
hoverColor: string;
|
|
219
|
+
textColor: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
show: boolean;
|
|
223
|
+
features?: string[];
|
|
224
|
+
metadata: {
|
|
225
|
+
customerVersion: string;
|
|
226
|
+
customerRevision: string;
|
|
227
|
+
productVersion: string;
|
|
228
|
+
productRevision: string;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
/** @description Default Response */
|
|
234
|
+
404: {
|
|
235
|
+
headers: {
|
|
236
|
+
[name: string]: unknown;
|
|
237
|
+
};
|
|
238
|
+
content?: never;
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
delete?: never;
|
|
243
|
+
options?: never;
|
|
244
|
+
head?: never;
|
|
245
|
+
patch?: never;
|
|
246
|
+
trace?: never;
|
|
247
|
+
};
|
|
248
|
+
'/api/feedback/v1': {
|
|
249
|
+
parameters: {
|
|
250
|
+
query?: never;
|
|
251
|
+
header?: never;
|
|
252
|
+
path?: never;
|
|
253
|
+
cookie?: never;
|
|
254
|
+
};
|
|
255
|
+
get?: never;
|
|
256
|
+
put?: never;
|
|
257
|
+
/**
|
|
258
|
+
* Submit user feedback
|
|
259
|
+
* @description Submit user feedback
|
|
260
|
+
*/
|
|
261
|
+
post: {
|
|
262
|
+
parameters: {
|
|
263
|
+
query?: never;
|
|
264
|
+
header?: never;
|
|
265
|
+
path?: never;
|
|
266
|
+
cookie?: never;
|
|
267
|
+
};
|
|
268
|
+
/** @description Product Expert user feedback */
|
|
269
|
+
requestBody: {
|
|
270
|
+
content: {
|
|
271
|
+
/** @example {
|
|
272
|
+
* "customerId": "oclet",
|
|
273
|
+
* "userId": "163a692e-8ee2-623f-9927-0bb563b19853",
|
|
274
|
+
* "sessionId": "2f6863a9-2833-5521-a45d-359dcdfd154a",
|
|
275
|
+
* "conversationId": "386d85d7-9daa-8a87-85d4-3f93c990b292",
|
|
276
|
+
* "url": "https://www.example.com/telco/",
|
|
277
|
+
* "deviceType": "desktop",
|
|
278
|
+
* "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
|
|
279
|
+
* "rating": 4,
|
|
280
|
+
* "ratingText": "excellent"
|
|
281
|
+
* } */
|
|
282
|
+
'application/json': {
|
|
283
|
+
/** @description Customer ID */
|
|
284
|
+
customerId: string;
|
|
285
|
+
/** @description User ID */
|
|
286
|
+
userId?: string;
|
|
287
|
+
/** @description Session ID */
|
|
288
|
+
sessionId: string;
|
|
289
|
+
/** @description Conversation ID */
|
|
290
|
+
conversationId?: string;
|
|
291
|
+
/** @description URL */
|
|
292
|
+
url?: string;
|
|
293
|
+
/**
|
|
294
|
+
* @description Device Type
|
|
295
|
+
* @enum {string}
|
|
296
|
+
*/
|
|
297
|
+
deviceType?: 'desktop' | 'mobile' | 'tablet';
|
|
298
|
+
/** @description User Agent */
|
|
299
|
+
userAgent?: string;
|
|
300
|
+
/** @description Conversation Rating */
|
|
301
|
+
rating: number;
|
|
302
|
+
/**
|
|
303
|
+
* @description Conversation Rating
|
|
304
|
+
* @enum {string}
|
|
305
|
+
*/
|
|
306
|
+
ratingText: 'poor' | 'fair' | 'good' | 'excellent';
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
responses: {
|
|
311
|
+
/** @description Successful response */
|
|
312
|
+
204: {
|
|
313
|
+
headers: {
|
|
314
|
+
[name: string]: unknown;
|
|
315
|
+
};
|
|
316
|
+
content?: never;
|
|
317
|
+
};
|
|
318
|
+
/** @description Default Response */
|
|
319
|
+
404: {
|
|
320
|
+
headers: {
|
|
321
|
+
[name: string]: unknown;
|
|
322
|
+
};
|
|
323
|
+
content?: never;
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
delete?: never;
|
|
328
|
+
options?: never;
|
|
329
|
+
head?: never;
|
|
330
|
+
patch?: never;
|
|
331
|
+
trace?: never;
|
|
332
|
+
};
|
|
333
|
+
'/api/tracking/identity/v1': {
|
|
334
|
+
parameters: {
|
|
335
|
+
query?: never;
|
|
336
|
+
header?: never;
|
|
337
|
+
path?: never;
|
|
338
|
+
cookie?: never;
|
|
339
|
+
};
|
|
340
|
+
get?: never;
|
|
341
|
+
put?: never;
|
|
342
|
+
/**
|
|
343
|
+
* Generate tracking identifiers
|
|
344
|
+
* @description Generate tracking identifiers for a user
|
|
345
|
+
*/
|
|
346
|
+
post: {
|
|
347
|
+
parameters: {
|
|
348
|
+
query?: never;
|
|
349
|
+
header?: never;
|
|
350
|
+
path?: never;
|
|
351
|
+
cookie?: never;
|
|
352
|
+
};
|
|
353
|
+
/** @description Generate tracking identifiers for a user */
|
|
354
|
+
requestBody: {
|
|
355
|
+
content: {
|
|
356
|
+
'application/json': {
|
|
357
|
+
/** @description Customer ID */
|
|
358
|
+
customerId: string;
|
|
359
|
+
/** @description User ID */
|
|
360
|
+
createUserId?: boolean;
|
|
361
|
+
/** @description Session ID */
|
|
362
|
+
createSessionId?: boolean;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
responses: {
|
|
367
|
+
/** @description Successful response */
|
|
368
|
+
200: {
|
|
369
|
+
headers: {
|
|
370
|
+
[name: string]: unknown;
|
|
371
|
+
};
|
|
372
|
+
content: {
|
|
373
|
+
'application/json': {
|
|
374
|
+
/** @description User ID */
|
|
375
|
+
userId?: string;
|
|
376
|
+
/** @description Session ID */
|
|
377
|
+
sessionId?: string;
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
delete?: never;
|
|
384
|
+
options?: never;
|
|
385
|
+
head?: never;
|
|
386
|
+
patch?: never;
|
|
387
|
+
trace?: never;
|
|
388
|
+
};
|
|
389
|
+
'/api/tracking/sales/v1': {
|
|
390
|
+
parameters: {
|
|
391
|
+
query?: never;
|
|
392
|
+
header?: never;
|
|
393
|
+
path?: never;
|
|
394
|
+
cookie?: never;
|
|
395
|
+
};
|
|
396
|
+
get?: never;
|
|
397
|
+
put?: never;
|
|
398
|
+
/**
|
|
399
|
+
* Submit sales tracking data
|
|
400
|
+
* @description Submit sales tracking data
|
|
401
|
+
*/
|
|
402
|
+
post: {
|
|
403
|
+
parameters: {
|
|
404
|
+
query?: never;
|
|
405
|
+
header?: never;
|
|
406
|
+
path?: never;
|
|
407
|
+
cookie?: never;
|
|
408
|
+
};
|
|
409
|
+
/** @description Sales tracking event data */
|
|
410
|
+
requestBody: {
|
|
411
|
+
content: {
|
|
412
|
+
/** @example {
|
|
413
|
+
* "customerId": "oclet",
|
|
414
|
+
* "userId": "163a692e-8ee2-623f-9927-0bb563b19853",
|
|
415
|
+
* "sessionId": "2f6863a9-2833-5521-a45d-359dcdfd154a",
|
|
416
|
+
* "saleRef": "34596872",
|
|
417
|
+
* "currency": "GBP",
|
|
418
|
+
* "totalPrice": 100,
|
|
419
|
+
* "totalRecurring": 10,
|
|
420
|
+
* "items": [
|
|
421
|
+
* {
|
|
422
|
+
* "productRef": "1260449",
|
|
423
|
+
* "name": "Product 1",
|
|
424
|
+
* "quantity": 1,
|
|
425
|
+
* "recurring": 10
|
|
426
|
+
* },
|
|
427
|
+
* {
|
|
428
|
+
* "productRef": "fe-56-sd2458",
|
|
429
|
+
* "name": "Product 2",
|
|
430
|
+
* "quantity": 2,
|
|
431
|
+
* "price": 50
|
|
432
|
+
* }
|
|
433
|
+
* ]
|
|
434
|
+
* } */
|
|
435
|
+
'application/json': {
|
|
436
|
+
/** @description Customer ID */
|
|
437
|
+
customerId: string;
|
|
438
|
+
/** @description User ID */
|
|
439
|
+
userId?: string;
|
|
440
|
+
/** @description Session ID */
|
|
441
|
+
sessionId: string;
|
|
442
|
+
/** @description Conversation ID */
|
|
443
|
+
conversationId?: string;
|
|
444
|
+
/** @description URL */
|
|
445
|
+
url?: string;
|
|
446
|
+
/**
|
|
447
|
+
* @description Device Type
|
|
448
|
+
* @enum {string}
|
|
449
|
+
*/
|
|
450
|
+
deviceType?: 'desktop' | 'mobile' | 'tablet';
|
|
451
|
+
/** @description User Agent */
|
|
452
|
+
userAgent?: string;
|
|
453
|
+
/** @description Sale Reference */
|
|
454
|
+
saleRef: string;
|
|
455
|
+
/** @description Currency Code */
|
|
456
|
+
currency: string;
|
|
457
|
+
/** @description Total Price */
|
|
458
|
+
totalPrice: number;
|
|
459
|
+
/** @description Total Recurring Price */
|
|
460
|
+
totalRecurring?: number;
|
|
461
|
+
/** @description Contract Length */
|
|
462
|
+
contractLength?: number;
|
|
463
|
+
/** @description Event data */
|
|
464
|
+
items?: {
|
|
465
|
+
/** @description Product Reference */
|
|
466
|
+
productRef?: string;
|
|
467
|
+
/** @description Product Name */
|
|
468
|
+
name?: string;
|
|
469
|
+
/** @description Quantity */
|
|
470
|
+
quantity?: number;
|
|
471
|
+
/** @description Price */
|
|
472
|
+
price?: number;
|
|
473
|
+
/** @description Recurring Price */
|
|
474
|
+
recurring?: number;
|
|
475
|
+
}[];
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
responses: {
|
|
480
|
+
/** @description Successful response */
|
|
481
|
+
204: {
|
|
482
|
+
headers: {
|
|
483
|
+
[name: string]: unknown;
|
|
484
|
+
};
|
|
485
|
+
content?: never;
|
|
486
|
+
};
|
|
487
|
+
/** @description Default Response */
|
|
488
|
+
404: {
|
|
489
|
+
headers: {
|
|
490
|
+
[name: string]: unknown;
|
|
491
|
+
};
|
|
492
|
+
content?: never;
|
|
493
|
+
};
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
delete?: never;
|
|
497
|
+
options?: never;
|
|
498
|
+
head?: never;
|
|
499
|
+
patch?: never;
|
|
500
|
+
trace?: never;
|
|
501
|
+
};
|
|
502
|
+
'/api/tracking/user/v1': {
|
|
503
|
+
parameters: {
|
|
504
|
+
query?: never;
|
|
505
|
+
header?: never;
|
|
506
|
+
path?: never;
|
|
507
|
+
cookie?: never;
|
|
508
|
+
};
|
|
509
|
+
get?: never;
|
|
510
|
+
put?: never;
|
|
511
|
+
/**
|
|
512
|
+
* Submit user tracking data
|
|
513
|
+
* @description Submit user tracking data
|
|
514
|
+
*/
|
|
515
|
+
post: {
|
|
516
|
+
parameters: {
|
|
517
|
+
query?: never;
|
|
518
|
+
header?: never;
|
|
519
|
+
path?: never;
|
|
520
|
+
cookie?: never;
|
|
521
|
+
};
|
|
522
|
+
/** @description User tracking event data */
|
|
523
|
+
requestBody: {
|
|
524
|
+
content: {
|
|
525
|
+
/** @example {
|
|
526
|
+
* "eventName": "tab-shown",
|
|
527
|
+
* "customerId": "oclet",
|
|
528
|
+
* "userId": "163a692e-8ee2-623f-9927-0bb563b19853",
|
|
529
|
+
* "sessionId": "2f6863a9-2833-5521-a45d-359dcdfd154a",
|
|
530
|
+
* "conversationId": "386d85d7-9daa-8a87-85d4-3f93c990b292",
|
|
531
|
+
* "url": "https://www.example.com/telco/"
|
|
532
|
+
* } */
|
|
533
|
+
'application/json': {
|
|
534
|
+
/** @description Event Name */
|
|
535
|
+
eventName: string;
|
|
536
|
+
/** @description Customer ID */
|
|
537
|
+
customerId: string;
|
|
538
|
+
/** @description User ID */
|
|
539
|
+
userId?: string;
|
|
540
|
+
/** @description Session ID */
|
|
541
|
+
sessionId: string;
|
|
542
|
+
/** @description Conversation ID */
|
|
543
|
+
conversationId?: string;
|
|
544
|
+
/** @description URL */
|
|
545
|
+
url?: string;
|
|
546
|
+
/**
|
|
547
|
+
* @description Device Type
|
|
548
|
+
* @enum {string}
|
|
549
|
+
*/
|
|
550
|
+
deviceType?: 'desktop' | 'mobile' | 'tablet';
|
|
551
|
+
/** @description User Agent */
|
|
552
|
+
userAgent?: string;
|
|
553
|
+
additionalProperties?: Record<string, never>;
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
responses: {
|
|
558
|
+
/** @description Successful response */
|
|
559
|
+
204: {
|
|
560
|
+
headers: {
|
|
561
|
+
[name: string]: unknown;
|
|
562
|
+
};
|
|
563
|
+
content?: never;
|
|
564
|
+
};
|
|
565
|
+
/** @description Default Response */
|
|
566
|
+
404: {
|
|
567
|
+
headers: {
|
|
568
|
+
[name: string]: unknown;
|
|
569
|
+
};
|
|
570
|
+
content?: never;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
delete?: never;
|
|
575
|
+
options?: never;
|
|
576
|
+
head?: never;
|
|
577
|
+
patch?: never;
|
|
578
|
+
trace?: never;
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
type ConversationRequest = components['schemas']['ConversationRequest'];
|
|
583
|
+
/**
|
|
584
|
+
* Configuration options for initializing the client.
|
|
585
|
+
*/
|
|
586
|
+
interface Config {
|
|
587
|
+
/**
|
|
588
|
+
* The customer ID associated with the conversation.
|
|
589
|
+
*/
|
|
590
|
+
customerId: ConversationRequest['customerId'];
|
|
591
|
+
/**
|
|
592
|
+
* Optional fetch function to use for making HTTP requests.
|
|
593
|
+
* If not provided, the default `fetch` implementation will be used.
|
|
594
|
+
*/
|
|
595
|
+
fetch?: ((input: Request) => Promise<Response>) | undefined;
|
|
596
|
+
/**
|
|
597
|
+
* The base URL for the conversation API.
|
|
598
|
+
*/
|
|
599
|
+
conversationUrl: string;
|
|
600
|
+
/**
|
|
601
|
+
* The base URL for the frontend API.
|
|
602
|
+
*/
|
|
603
|
+
frontendUrl: string;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* The API endpoint interfaces outline what operations are available for each API.
|
|
607
|
+
*/
|
|
608
|
+
interface Endpoint {
|
|
609
|
+
/**
|
|
610
|
+
* The client for interacting with the conversation API.
|
|
611
|
+
*/
|
|
612
|
+
conversation: Client$1<paths$1, `${string}/${string}`>;
|
|
613
|
+
/**
|
|
614
|
+
* The client for interacting with the frontend API.
|
|
615
|
+
*/
|
|
616
|
+
frontend: Client$1<paths, `${string}/${string}`>;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* The identity information.
|
|
620
|
+
*/
|
|
621
|
+
interface Identity {
|
|
622
|
+
/**
|
|
623
|
+
* The customer ID.
|
|
624
|
+
*/
|
|
625
|
+
customerId: ConversationRequest['customerId'];
|
|
626
|
+
/**
|
|
627
|
+
* The conversation ID.
|
|
628
|
+
*/
|
|
629
|
+
conversationId: ConversationRequest['conversationId'];
|
|
630
|
+
/**
|
|
631
|
+
* The session ID associated with the user.
|
|
632
|
+
*/
|
|
633
|
+
sessionId: ConversationRequest['sessionId'];
|
|
634
|
+
/**
|
|
635
|
+
* The user ID.
|
|
636
|
+
*/
|
|
637
|
+
userId: ConversationRequest['userId'];
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Message within a conversation.
|
|
641
|
+
*/
|
|
642
|
+
interface Message {
|
|
643
|
+
/**
|
|
644
|
+
* The conversation ID to which the message belongs.
|
|
645
|
+
*/
|
|
646
|
+
conversationId: string;
|
|
647
|
+
/**
|
|
648
|
+
* Optional data associated with the message, as key-value pairs.
|
|
649
|
+
*/
|
|
650
|
+
data?: Record<string, object | string>;
|
|
651
|
+
/**
|
|
652
|
+
* The message content.
|
|
653
|
+
*/
|
|
654
|
+
message: string;
|
|
655
|
+
/**
|
|
656
|
+
* The message type.
|
|
657
|
+
*/
|
|
658
|
+
type: string;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* The `Client` class provides methods to manage 15gifts API.
|
|
663
|
+
*/
|
|
664
|
+
declare class Client {
|
|
665
|
+
/**
|
|
666
|
+
* This can be used to interact with the APIs directly. It is recommended to use the [helper methods](/sdk-reference/classes/client/#methods) provided by the `Client` class instead.
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* ```ts
|
|
670
|
+
* const client = new Client({ customerId: 'YOUR_CUSTOMER_ID' })
|
|
671
|
+
* const { data } = await client.endpoint.conversation.GET('/api/v1/conversation/')
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
endpoint: Endpoint;
|
|
675
|
+
/**
|
|
676
|
+
* The identity information.
|
|
677
|
+
*/
|
|
678
|
+
identity: Identity;
|
|
679
|
+
/**
|
|
680
|
+
* Creates a new instance of the `Client` class.
|
|
681
|
+
*
|
|
682
|
+
* @param config - Configuration options for initializing the client.
|
|
683
|
+
*
|
|
684
|
+
* @example
|
|
685
|
+
* ```ts
|
|
686
|
+
* const client = new Client({ customerId: 'YOUR_CUSTOMER_ID' })
|
|
687
|
+
* ```
|
|
688
|
+
*/
|
|
689
|
+
constructor({ customerId, fetch, conversationUrl, frontendUrl }: Config);
|
|
690
|
+
/**
|
|
691
|
+
* Creates a new identity for the user by generating a session ID and user ID if they don't exist.
|
|
692
|
+
*
|
|
693
|
+
* @returns A promise that resolves once the identity is created.
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* ```ts
|
|
697
|
+
* await client.createIdentity()
|
|
698
|
+
* console.log('Identity created:', client.identity)
|
|
699
|
+
* ```
|
|
700
|
+
*/
|
|
701
|
+
createIdentity(): Promise<void>;
|
|
702
|
+
/**
|
|
703
|
+
* Ends the current conversation by deleting the conversation ID.
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
* ```ts
|
|
707
|
+
* client.endConversation()
|
|
708
|
+
* console.log('Conversation ended')
|
|
709
|
+
* ```
|
|
710
|
+
*/
|
|
711
|
+
endConversation(): void;
|
|
712
|
+
/**
|
|
713
|
+
* Sends a message in the conversation, optionally with an opening message.
|
|
714
|
+
*
|
|
715
|
+
* @param options - An object containing the opening message and the user message.
|
|
716
|
+
* @returns A promise that resolves to an `AsyncIterable` of messages or `undefined` if there was an error.
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
* ```ts
|
|
720
|
+
* const messageStream = await client.sendMessage({
|
|
721
|
+
* openingMessage: 'Hello!',
|
|
722
|
+
* userMessage: 'How can I get support?',
|
|
723
|
+
* })
|
|
724
|
+
*
|
|
725
|
+
* if (messageStream) {
|
|
726
|
+
* for await (const message of messageStream) {
|
|
727
|
+
* console.log('Received message:', message)
|
|
728
|
+
* }
|
|
729
|
+
* } else {
|
|
730
|
+
* console.log('No message received')
|
|
731
|
+
* }
|
|
732
|
+
* ```
|
|
733
|
+
*/
|
|
734
|
+
sendMessage({ openingMessage, userMessage, }: {
|
|
735
|
+
openingMessage?: string;
|
|
736
|
+
userMessage: string;
|
|
737
|
+
}): Promise<AsyncIterable<Message | undefined> | undefined>;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* The key used to store the conversation ID in `sessionStorage`.
|
|
742
|
+
*/
|
|
743
|
+
declare const CONVERSATION_ID = "__15gifts_conversation_id";
|
|
744
|
+
/**
|
|
745
|
+
* Deletes the conversation ID from `sessionStorage`.
|
|
746
|
+
*
|
|
747
|
+
* @example
|
|
748
|
+
* ```ts
|
|
749
|
+
* import { deleteConversationId } from '@15gifts/sdk'
|
|
750
|
+
*
|
|
751
|
+
* deleteConversationId()
|
|
752
|
+
* // The conversation ID will be removed.
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
declare const deleteConversationId: () => void;
|
|
756
|
+
/**
|
|
757
|
+
* Retrieves the conversation ID from `sessionStorage`.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```ts
|
|
761
|
+
* import { getConversationId } from '@15gifts/sdk'
|
|
762
|
+
*
|
|
763
|
+
* const conversationId = getConversationId()
|
|
764
|
+
*
|
|
765
|
+
* if (conversationId) {
|
|
766
|
+
* console.log(`Conversation ID: ${conversationId}`)
|
|
767
|
+
* } else {
|
|
768
|
+
* console.log('No conversation ID found.')
|
|
769
|
+
* }
|
|
770
|
+
* ```
|
|
771
|
+
*/
|
|
772
|
+
declare const getConversationId: () => string | null;
|
|
773
|
+
/**
|
|
774
|
+
* Stores the given conversation ID in `sessionStorage`.
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* ```ts
|
|
778
|
+
* import { setConversationId } from '@15gifts/sdk'
|
|
779
|
+
*
|
|
780
|
+
* setConversationId('ca0ab4ce-f697-41cc-8d0c-081762aace9b')
|
|
781
|
+
* // The conversation ID 'ca0ab4ce-f697-41cc-8d0c-081762aace9b' will be stored.
|
|
782
|
+
* ```
|
|
783
|
+
*/
|
|
784
|
+
declare const setConversationId: (conversationId: string) => void;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* The key used to store the session ID in `sessionStorage`.
|
|
788
|
+
*/
|
|
789
|
+
declare const SESSION_ID = "__15gifts_session_id";
|
|
790
|
+
/**
|
|
791
|
+
* Retrieves the session ID from `sessionStorage`.
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
* ```ts
|
|
795
|
+
* import { getSessionId } from '@15gifts/sdk'
|
|
796
|
+
*
|
|
797
|
+
* const sessionId = getSessionId()
|
|
798
|
+
*
|
|
799
|
+
* if (sessionId) {
|
|
800
|
+
* console.log(`Session ID: ${sessionId}`)
|
|
801
|
+
* } else {
|
|
802
|
+
* console.log('No session ID found.')
|
|
803
|
+
* }
|
|
804
|
+
* ```
|
|
805
|
+
*/
|
|
806
|
+
declare const getSessionId: () => string | null;
|
|
807
|
+
/**
|
|
808
|
+
* Stores the given session ID in `sessionStorage`.
|
|
809
|
+
*
|
|
810
|
+
* @example
|
|
811
|
+
* ```ts
|
|
812
|
+
* import { setSessionId } from '@15gifts/sdk'
|
|
813
|
+
*
|
|
814
|
+
* setSessionId('20b2bff6-64a0-4101-bed9-ff545326584a')
|
|
815
|
+
* // The session ID '20b2bff6-64a0-4101-bed9-ff545326584a' will be stored.
|
|
816
|
+
* ```
|
|
817
|
+
*/
|
|
818
|
+
declare const setSessionId: (sessionId: string) => void;
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* The key used to store the user ID in `localStorage`.
|
|
822
|
+
*/
|
|
823
|
+
declare const USER_ID = "__15gifts_user_id";
|
|
824
|
+
/**
|
|
825
|
+
* Time-to-live (TTL) for the user ID in milliseconds.
|
|
826
|
+
* Set to 30 days.
|
|
827
|
+
*/
|
|
828
|
+
declare const TTL: number;
|
|
829
|
+
/**
|
|
830
|
+
* Retrieves the user ID from `localStorage`.
|
|
831
|
+
*
|
|
832
|
+
* @example
|
|
833
|
+
* ```ts
|
|
834
|
+
* import { getUserId } from '@15gifts/sdk'
|
|
835
|
+
*
|
|
836
|
+
* const userId = getUserId()
|
|
837
|
+
*
|
|
838
|
+
* if (userId) {
|
|
839
|
+
* console.log(`User ID: ${userId}`)
|
|
840
|
+
* } else {
|
|
841
|
+
* console.log('No user ID found.')
|
|
842
|
+
* }
|
|
843
|
+
* ```
|
|
844
|
+
*/
|
|
845
|
+
declare const getUserId: () => string | null;
|
|
846
|
+
/**
|
|
847
|
+
* Stores the given user ID in `localStorage`.
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```ts
|
|
851
|
+
* import { setUserId } from '@15gifts/sdk'
|
|
852
|
+
*
|
|
853
|
+
* setUserId('5b77656c-ea4c-492f-82bf-7129297c5873')
|
|
854
|
+
* // The user ID '5b77656c-ea4c-492f-82bf-7129297c5873' will be stored with a 30-day expiry.
|
|
855
|
+
* ```
|
|
856
|
+
*/
|
|
857
|
+
declare const setUserId: (userId: string) => void;
|
|
858
|
+
|
|
859
|
+
export { CONVERSATION_ID, Client, type Config, type Endpoint, type Identity, type Message, SESSION_ID, TTL, USER_ID, deleteConversationId, getConversationId, getSessionId, getUserId, setConversationId, setSessionId, setUserId };
|