@parra/parra-js-sdk 0.2.73 → 0.2.75
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/ParraAPI.d.ts +87 -45
- package/dist/ParraAPI.js +17 -1
- package/package.json +1 -1
package/dist/ParraAPI.d.ts
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import { HTTPClient } from "@parra/http-client";
|
|
2
|
+
export interface Size {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
export interface UploadImageAssetRequestBody {
|
|
7
|
+
group: string;
|
|
8
|
+
image: File;
|
|
9
|
+
}
|
|
10
|
+
export interface ImageAsset {
|
|
11
|
+
id: string;
|
|
12
|
+
created_at: string;
|
|
13
|
+
updated_at: string;
|
|
14
|
+
deleted_at?: string | null;
|
|
15
|
+
tenant_id: string;
|
|
16
|
+
size: Size;
|
|
17
|
+
url: string;
|
|
18
|
+
bucket: string;
|
|
19
|
+
key: string;
|
|
20
|
+
group: string;
|
|
21
|
+
file_type: string;
|
|
22
|
+
mime_type: string;
|
|
23
|
+
}
|
|
2
24
|
export interface AuthorizationCheckRequestBody {
|
|
3
25
|
namespace: string;
|
|
4
26
|
subject: string;
|
|
@@ -44,18 +66,18 @@ export interface Price {
|
|
|
44
66
|
export interface UnitPrice {
|
|
45
67
|
currency: Currency;
|
|
46
68
|
amount: number;
|
|
47
|
-
interval?: Interval
|
|
69
|
+
interval?: Interval;
|
|
48
70
|
}
|
|
49
71
|
export interface Plan {
|
|
50
72
|
id: string;
|
|
51
73
|
created_at: string;
|
|
52
74
|
updated_at: string;
|
|
53
75
|
deleted_at?: string | null;
|
|
54
|
-
tier: string
|
|
55
|
-
interval: string
|
|
56
|
-
price: UnitPrice
|
|
57
|
-
discounted_price?: Price
|
|
58
|
-
unit_price: UnitPrice
|
|
76
|
+
tier: string;
|
|
77
|
+
interval: string;
|
|
78
|
+
price: UnitPrice;
|
|
79
|
+
discounted_price?: Price;
|
|
80
|
+
unit_price: UnitPrice;
|
|
59
81
|
context?: string | null;
|
|
60
82
|
}
|
|
61
83
|
export declare enum SubscriptionStatus {
|
|
@@ -81,7 +103,7 @@ export interface Subscription {
|
|
|
81
103
|
updated_at: string;
|
|
82
104
|
deleted_at?: string | null;
|
|
83
105
|
customer_id: string;
|
|
84
|
-
status: SubscriptionStatus
|
|
106
|
+
status: SubscriptionStatus;
|
|
85
107
|
cancel_at?: string | null;
|
|
86
108
|
cancel_at_period_end?: boolean | null;
|
|
87
109
|
canceled_at?: string | null;
|
|
@@ -91,11 +113,11 @@ export interface Subscription {
|
|
|
91
113
|
ended_at?: string | null;
|
|
92
114
|
trial_start?: string | null;
|
|
93
115
|
trial_end?: string | null;
|
|
94
|
-
items: Array<SubscriptionItem
|
|
116
|
+
items: Array<SubscriptionItem>;
|
|
95
117
|
}
|
|
96
118
|
export interface TenantPlansResponse {
|
|
97
|
-
plans?: Array<Plan
|
|
98
|
-
subscriptions?: Array<Subscription
|
|
119
|
+
plans?: Array<Plan>;
|
|
120
|
+
subscriptions?: Array<Subscription>;
|
|
99
121
|
}
|
|
100
122
|
export interface StripeEvent {
|
|
101
123
|
}
|
|
@@ -122,7 +144,6 @@ export interface CreateAuthTokenRequestBody {
|
|
|
122
144
|
}
|
|
123
145
|
export interface Entitlement {
|
|
124
146
|
}
|
|
125
|
-
export declare type Entitlements = Array<Entitlement>;
|
|
126
147
|
export declare type UpdateEntitlementsRequestBody = Array<Entitlement>;
|
|
127
148
|
export interface UpdateTenantRequestBody {
|
|
128
149
|
name: string;
|
|
@@ -292,12 +313,12 @@ export declare enum CardItemType {
|
|
|
292
313
|
question = "question"
|
|
293
314
|
}
|
|
294
315
|
export interface CardItem {
|
|
295
|
-
type: CardItemType
|
|
296
|
-
version: string
|
|
297
|
-
data: CardItemData
|
|
316
|
+
type: CardItemType;
|
|
317
|
+
version: string;
|
|
318
|
+
data: CardItemData;
|
|
298
319
|
}
|
|
299
320
|
export interface CardsResponse {
|
|
300
|
-
items: Array<CardItem
|
|
321
|
+
items: Array<CardItem>;
|
|
301
322
|
}
|
|
302
323
|
export declare enum QuestionType {
|
|
303
324
|
choice = "choice",
|
|
@@ -306,32 +327,50 @@ export declare enum QuestionType {
|
|
|
306
327
|
export declare enum QuestionKind {
|
|
307
328
|
radio = "radio",
|
|
308
329
|
checkbox = "checkbox",
|
|
309
|
-
star = "star"
|
|
330
|
+
star = "star",
|
|
331
|
+
image = "image"
|
|
310
332
|
}
|
|
311
333
|
export interface MutableChoiceQuestionOption {
|
|
312
|
-
title: string
|
|
313
|
-
value: string
|
|
334
|
+
title: string;
|
|
335
|
+
value: string;
|
|
314
336
|
is_other?: boolean | null;
|
|
315
337
|
}
|
|
316
338
|
export interface ChoiceQuestionOption {
|
|
317
|
-
title: string
|
|
318
|
-
value: string
|
|
339
|
+
title: string;
|
|
340
|
+
value: string;
|
|
319
341
|
is_other?: boolean | null;
|
|
320
|
-
id: string
|
|
342
|
+
id: string;
|
|
321
343
|
}
|
|
322
344
|
export interface ChoiceQuestionBody {
|
|
323
|
-
options: Array<ChoiceQuestionOption
|
|
345
|
+
options: Array<ChoiceQuestionOption>;
|
|
324
346
|
}
|
|
325
347
|
export interface MutableChoiceQuestionBody {
|
|
326
|
-
options: Array<MutableChoiceQuestionOption
|
|
348
|
+
options: Array<MutableChoiceQuestionOption>;
|
|
349
|
+
}
|
|
350
|
+
export interface MutableImageQuestionOption {
|
|
351
|
+
image_asset_id: string;
|
|
352
|
+
title?: string | null;
|
|
353
|
+
value: string;
|
|
354
|
+
}
|
|
355
|
+
export interface ImageQuestionOption {
|
|
356
|
+
image_asset_id: string;
|
|
357
|
+
title?: string | null;
|
|
358
|
+
value: string;
|
|
359
|
+
id: string;
|
|
327
360
|
}
|
|
328
|
-
export
|
|
329
|
-
|
|
361
|
+
export interface ImageQuestionBody {
|
|
362
|
+
options: Array<ImageQuestionOption>;
|
|
363
|
+
}
|
|
364
|
+
export interface MutableImageQuestionBody {
|
|
365
|
+
options: Array<MutableImageQuestionOption>;
|
|
366
|
+
}
|
|
367
|
+
export declare type MutableQuestionData = MutableChoiceQuestionBody | MutableImageQuestionBody;
|
|
368
|
+
export declare type QuestionData = ChoiceQuestionBody | ImageQuestionBody;
|
|
330
369
|
export interface UpdateQuestionRequestBody {
|
|
331
370
|
title: string;
|
|
332
371
|
subtitle?: string | null;
|
|
333
372
|
app_area_id?: string | null;
|
|
334
|
-
data: MutableQuestionData
|
|
373
|
+
data: MutableQuestionData;
|
|
335
374
|
active?: boolean;
|
|
336
375
|
expires_at?: string | null;
|
|
337
376
|
answer_quota?: number | null;
|
|
@@ -340,12 +379,12 @@ export interface CreateQuestionRequestBody {
|
|
|
340
379
|
title: string;
|
|
341
380
|
subtitle?: string | null;
|
|
342
381
|
app_area_id?: string | null;
|
|
343
|
-
data: MutableQuestionData
|
|
382
|
+
data: MutableQuestionData;
|
|
344
383
|
active?: boolean;
|
|
345
384
|
expires_at?: string | null;
|
|
346
385
|
answer_quota?: number | null;
|
|
347
|
-
type: QuestionType
|
|
348
|
-
kind: QuestionKind
|
|
386
|
+
type: QuestionType;
|
|
387
|
+
kind: QuestionKind;
|
|
349
388
|
}
|
|
350
389
|
export declare enum QuestionStatus {
|
|
351
390
|
open = "open",
|
|
@@ -356,22 +395,22 @@ export interface Question {
|
|
|
356
395
|
created_at: string;
|
|
357
396
|
updated_at: string;
|
|
358
397
|
deleted_at?: string | null;
|
|
359
|
-
status: QuestionStatus
|
|
398
|
+
status: QuestionStatus;
|
|
360
399
|
tenant_id: string;
|
|
361
400
|
title: string;
|
|
362
401
|
subtitle?: string | null;
|
|
363
402
|
app_area_id?: string | null;
|
|
364
|
-
type: QuestionType
|
|
365
|
-
kind: QuestionKind
|
|
366
|
-
data: QuestionData
|
|
403
|
+
type: QuestionType;
|
|
404
|
+
kind: QuestionKind;
|
|
405
|
+
data: QuestionData;
|
|
367
406
|
active?: boolean;
|
|
368
407
|
answer_quota?: number | null;
|
|
369
408
|
answer_count?: number;
|
|
370
409
|
expires_at?: string | null;
|
|
371
410
|
closed_at?: string | null;
|
|
372
|
-
answer?: Answer
|
|
373
|
-
metrics?: QuestionMetrics
|
|
374
|
-
app_area?: AppArea
|
|
411
|
+
answer?: Answer;
|
|
412
|
+
metrics?: QuestionMetrics;
|
|
413
|
+
app_area?: AppArea;
|
|
375
414
|
}
|
|
376
415
|
export interface QuestionCollectionResponse {
|
|
377
416
|
page: number;
|
|
@@ -387,18 +426,18 @@ export interface QuestionMetrics {
|
|
|
387
426
|
deleted_at?: string | null;
|
|
388
427
|
question_id: string;
|
|
389
428
|
answer_count: number;
|
|
390
|
-
type: QuestionType
|
|
391
|
-
data: QuestionMetricsData
|
|
429
|
+
type: QuestionType;
|
|
430
|
+
data: QuestionMetricsData;
|
|
392
431
|
}
|
|
393
432
|
export declare type QuestionMetricsData = ChoiceQuestionMetricsBody;
|
|
394
433
|
export interface ChoiceQuestionMetricsBody {
|
|
395
|
-
options: Array<ChoiceQuestionMetricsOption
|
|
434
|
+
options: Array<ChoiceQuestionMetricsOption>;
|
|
396
435
|
}
|
|
397
436
|
export interface ChoiceQuestionMetricsOption {
|
|
398
|
-
title: string
|
|
399
|
-
value: string
|
|
437
|
+
title: string;
|
|
438
|
+
value: string;
|
|
400
439
|
is_other?: boolean | null;
|
|
401
|
-
id: string
|
|
440
|
+
id: string;
|
|
402
441
|
answer_count: number;
|
|
403
442
|
}
|
|
404
443
|
export interface NotificationRecipient {
|
|
@@ -418,7 +457,7 @@ export interface CreateNotificationRequestBody {
|
|
|
418
457
|
silent?: boolean;
|
|
419
458
|
content_available?: boolean;
|
|
420
459
|
expires_at?: string | null;
|
|
421
|
-
recipients: Array<NotificationRecipient
|
|
460
|
+
recipients: Array<NotificationRecipient>;
|
|
422
461
|
}
|
|
423
462
|
export interface NotificationResponse {
|
|
424
463
|
type?: string;
|
|
@@ -491,7 +530,7 @@ export interface CreateUserRequestBody {
|
|
|
491
530
|
avatar_url?: string | null;
|
|
492
531
|
locale?: string | null;
|
|
493
532
|
type: string;
|
|
494
|
-
identities?: Array<CreateIdentityRequestBody
|
|
533
|
+
identities?: Array<CreateIdentityRequestBody>;
|
|
495
534
|
}
|
|
496
535
|
export interface UpdateUserRequestBody {
|
|
497
536
|
first_name: string;
|
|
@@ -520,6 +559,7 @@ declare class ParraAPI {
|
|
|
520
559
|
constructor(http: HTTPClient, options: {
|
|
521
560
|
baseUrl: string;
|
|
522
561
|
});
|
|
562
|
+
uploadImageAssetForTenantById: (tenant_id: string, body?: UploadImageAssetRequestBody | undefined) => Promise<ImageAsset>;
|
|
523
563
|
createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
|
|
524
564
|
updateEntitlementsForCustomerById: (customer_id: string) => Promise<Response>;
|
|
525
565
|
createBillingPortalSession: (tenant_id: string) => Promise<BillingPortalSession>;
|
|
@@ -548,7 +588,9 @@ declare class ParraAPI {
|
|
|
548
588
|
getAppAreaById: (tenant_id: string, app_area_id: string) => Promise<AppArea>;
|
|
549
589
|
updateAppAreaById: (tenant_id: string, app_area_id: string, body?: UpdateAppAreaRequestBody | undefined) => Promise<AppArea>;
|
|
550
590
|
deleteAppAreaById: (tenant_id: string, app_area_id: string) => Promise<Response>;
|
|
551
|
-
getCards: (
|
|
591
|
+
getCards: (query?: {
|
|
592
|
+
app_area_id?: string | undefined;
|
|
593
|
+
} | undefined) => Promise<CardsResponse>;
|
|
552
594
|
getFormById: (form_id: string) => Promise<Form>;
|
|
553
595
|
submitFormById: (form_id: string, body?: FormResponse | undefined) => Promise<Response>;
|
|
554
596
|
createQuestion: (body?: CreateQuestionRequestBody | undefined) => Promise<Question>;
|
package/dist/ParraAPI.js
CHANGED
|
@@ -34,6 +34,7 @@ var QuestionKind;
|
|
|
34
34
|
QuestionKind["radio"] = "radio";
|
|
35
35
|
QuestionKind["checkbox"] = "checkbox";
|
|
36
36
|
QuestionKind["star"] = "star";
|
|
37
|
+
QuestionKind["image"] = "image";
|
|
37
38
|
})(QuestionKind = exports.QuestionKind || (exports.QuestionKind = {}));
|
|
38
39
|
var QuestionStatus;
|
|
39
40
|
(function (QuestionStatus) {
|
|
@@ -45,6 +46,20 @@ var ParraAPI = /** @class */ (function () {
|
|
|
45
46
|
var _this = this;
|
|
46
47
|
this.http = http;
|
|
47
48
|
this.options = options;
|
|
49
|
+
this.uploadImageAssetForTenantById = function (tenant_id, body) {
|
|
50
|
+
var formData = new FormData();
|
|
51
|
+
Object.entries(body || {}).forEach(function (_a) {
|
|
52
|
+
var key = _a[0], value = _a[1];
|
|
53
|
+
formData.append(key, value);
|
|
54
|
+
});
|
|
55
|
+
return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/assets/images"), {
|
|
56
|
+
method: "post",
|
|
57
|
+
body: formData,
|
|
58
|
+
headers: {
|
|
59
|
+
"content-type": "multipart/form-data",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
};
|
|
48
63
|
this.createCustomer = function (body) {
|
|
49
64
|
return _this.http.execute("".concat(_this.options.baseUrl, "/v1/customers"), {
|
|
50
65
|
method: "post",
|
|
@@ -230,9 +245,10 @@ var ParraAPI = /** @class */ (function () {
|
|
|
230
245
|
method: "delete",
|
|
231
246
|
});
|
|
232
247
|
};
|
|
233
|
-
this.getCards = function () {
|
|
248
|
+
this.getCards = function (query) {
|
|
234
249
|
return _this.http.execute("".concat(_this.options.baseUrl, "/v1/cards"), {
|
|
235
250
|
method: "get",
|
|
251
|
+
query: query,
|
|
236
252
|
});
|
|
237
253
|
};
|
|
238
254
|
this.getFormById = function (form_id) {
|