@parra/parra-js-sdk 0.2.37 → 0.2.41

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.
@@ -5,6 +5,9 @@ export interface CreateCheckoutSessionRequestBody {
5
5
  export interface CheckoutSession {
6
6
  url: string;
7
7
  }
8
+ export interface BillingPortalSession {
9
+ url: string;
10
+ }
8
11
  export interface CreateCustomerRequestBody {
9
12
  name: string;
10
13
  tenant_id: string;
@@ -32,19 +35,19 @@ export interface Price {
32
35
  export interface UnitPrice {
33
36
  currency: Currency;
34
37
  amount: number;
35
- interval?: Interval;
38
+ interval?: Interval | null;
36
39
  }
37
40
  export interface Plan {
38
41
  id: string;
39
42
  created_at: string;
40
43
  updated_at: string;
41
44
  deleted_at?: string | null;
42
- tier: string;
43
- interval: string;
44
- price: UnitPrice;
45
- discounted_price?: Price;
46
- unit_price: UnitPrice;
47
- context: string;
45
+ tier: string | null;
46
+ interval: string | null;
47
+ price: UnitPrice | null;
48
+ discounted_price?: Price | null;
49
+ unit_price: UnitPrice | null;
50
+ context?: string | null;
48
51
  }
49
52
  export declare enum SubscriptionStatus {
50
53
  incomplete = "incomplete",
@@ -55,15 +58,21 @@ export declare enum SubscriptionStatus {
55
58
  canceled = "canceled",
56
59
  unpaid = "unpaid"
57
60
  }
61
+ export interface SubscriptionItem {
62
+ id: string;
63
+ created_at: string;
64
+ updated_at: string;
65
+ deleted_at?: string | null;
66
+ plan_id: string;
67
+ quantity: number;
68
+ }
58
69
  export interface Subscription {
59
70
  id: string;
60
71
  created_at: string;
61
72
  updated_at: string;
62
73
  deleted_at?: string | null;
63
74
  customer_id: string;
64
- stripe_payment_intent_id: string;
65
- stripe_subscription_id: string;
66
- status: SubscriptionStatus;
75
+ status: SubscriptionStatus | null;
67
76
  cancel_at?: string | null;
68
77
  cancel_at_period_end?: boolean | null;
69
78
  canceled_at?: string | null;
@@ -73,13 +82,18 @@ export interface Subscription {
73
82
  ended_at?: string | null;
74
83
  trial_start?: string | null;
75
84
  trial_end?: string | null;
85
+ items: Array<SubscriptionItem> | null;
76
86
  }
77
87
  export interface TenantPlansResponse {
78
- plans?: Array<Plan>;
79
- subscriptions?: Array<Subscription>;
88
+ plans?: Array<Plan> | null;
89
+ subscriptions?: Array<Subscription> | null;
80
90
  }
81
91
  export interface StripeEvent {
82
92
  }
93
+ export interface Entitlement {
94
+ }
95
+ export declare type Entitlements = Array<Entitlement>;
96
+ export declare type UpdateEntitlementsRequestBody = Array<Entitlement>;
83
97
  export interface CreateTenantRequestBody {
84
98
  name: string;
85
99
  is_test: boolean;
@@ -91,6 +105,7 @@ export interface Tenant {
91
105
  deleted_at?: string | null;
92
106
  name: string;
93
107
  is_test: boolean;
108
+ entitlements?: Array<Entitlement> | null;
94
109
  }
95
110
  export declare type TenantListResponse = Array<Tenant>;
96
111
  export interface TenantCollectionResponse {
@@ -155,12 +170,12 @@ export declare enum CardItemType {
155
170
  question = "question"
156
171
  }
157
172
  export interface CardItem {
158
- type: CardItemType;
159
- version: string;
160
- data: CardItemData;
173
+ type: CardItemType | null;
174
+ version: string | null;
175
+ data: CardItemData | null;
161
176
  }
162
177
  export interface CardsResponse {
163
- items: Array<CardItem>;
178
+ items: Array<CardItem> | null;
164
179
  }
165
180
  export declare enum QuestionType {
166
181
  choice = "choice",
@@ -172,28 +187,28 @@ export declare enum QuestionKind {
172
187
  star = "star"
173
188
  }
174
189
  export interface MutableChoiceQuestionOption {
175
- title: string;
176
- value: string;
190
+ title: string | null;
191
+ value: string | null;
177
192
  is_other?: boolean | null;
178
193
  }
179
194
  export interface ChoiceQuestionOption {
180
- title: string;
181
- value: string;
195
+ title: string | null;
196
+ value: string | null;
182
197
  is_other?: boolean | null;
183
- id: string;
198
+ id: string | null;
184
199
  }
185
200
  export interface ChoiceQuestionBody {
186
- options: Array<ChoiceQuestionOption>;
201
+ options: Array<ChoiceQuestionOption> | null;
187
202
  }
188
203
  export interface MutableChoiceQuestionBody {
189
- options: Array<MutableChoiceQuestionOption>;
204
+ options: Array<MutableChoiceQuestionOption> | null;
190
205
  }
191
206
  export declare type MutableQuestionData = MutableChoiceQuestionBody;
192
207
  export declare type QuestionData = ChoiceQuestionBody;
193
208
  export interface UpdateQuestionRequestBody {
194
209
  title: string;
195
210
  subtitle?: string | null;
196
- data: MutableQuestionData;
211
+ data: MutableQuestionData | null;
197
212
  active?: boolean;
198
213
  expires_at?: string | null;
199
214
  answer_quota?: number | null;
@@ -201,12 +216,12 @@ export interface UpdateQuestionRequestBody {
201
216
  export interface CreateQuestionRequestBody {
202
217
  title: string;
203
218
  subtitle?: string | null;
204
- data: MutableQuestionData;
219
+ data: MutableQuestionData | null;
205
220
  active?: boolean;
206
221
  expires_at?: string | null;
207
222
  answer_quota?: number | null;
208
- type: QuestionType;
209
- kind: QuestionKind;
223
+ type: QuestionType | null;
224
+ kind: QuestionKind | null;
210
225
  }
211
226
  export declare enum QuestionStatus {
212
227
  open = "open",
@@ -217,20 +232,20 @@ export interface Question {
217
232
  created_at: string;
218
233
  updated_at: string;
219
234
  deleted_at?: string | null;
220
- status: QuestionStatus;
235
+ status: QuestionStatus | null;
221
236
  tenant_id: string;
222
237
  title: string;
223
238
  subtitle?: string | null;
224
- type: QuestionType;
225
- kind: QuestionKind;
226
- data: QuestionData;
239
+ type: QuestionType | null;
240
+ kind: QuestionKind | null;
241
+ data: QuestionData | null;
227
242
  active?: boolean;
228
243
  answer_quota?: number | null;
229
244
  answer_count?: number;
230
245
  expires_at?: string | null;
231
246
  closed_at?: string | null;
232
- answer?: Answer;
233
- metrics?: QuestionMetrics;
247
+ answer?: Answer | null;
248
+ metrics?: QuestionMetrics | null;
234
249
  }
235
250
  export interface QuestionCollectionResponse {
236
251
  page: number;
@@ -246,18 +261,18 @@ export interface QuestionMetrics {
246
261
  deleted_at?: string | null;
247
262
  question_id: string;
248
263
  answer_count: number;
249
- type: QuestionType;
250
- data: QuestionMetricsData;
264
+ type: QuestionType | null;
265
+ data: QuestionMetricsData | null;
251
266
  }
252
267
  export declare type QuestionMetricsData = ChoiceQuestionMetricsBody;
253
268
  export interface ChoiceQuestionMetricsBody {
254
- options: Array<ChoiceQuestionMetricsOption>;
269
+ options: Array<ChoiceQuestionMetricsOption> | null;
255
270
  }
256
271
  export interface ChoiceQuestionMetricsOption {
257
- title: string;
258
- value: string;
272
+ title: string | null;
273
+ value: string | null;
259
274
  is_other?: boolean | null;
260
- id: string;
275
+ id: string | null;
261
276
  answer_count: number;
262
277
  }
263
278
  export interface NotificationRecipient {
@@ -277,7 +292,7 @@ export interface CreateNotificationRequestBody {
277
292
  silent?: boolean;
278
293
  content_available?: boolean;
279
294
  expires_at?: string | null;
280
- recipients: Array<NotificationRecipient>;
295
+ recipients: Array<NotificationRecipient> | null;
281
296
  }
282
297
  export interface NotificationResponse {
283
298
  type?: string;
@@ -350,7 +365,7 @@ export interface CreateUserRequestBody {
350
365
  avatar_url?: string | null;
351
366
  locale?: string | null;
352
367
  type: string;
353
- identities?: Array<CreateIdentityRequestBody>;
368
+ identities?: Array<CreateIdentityRequestBody> | null;
354
369
  }
355
370
  export interface UpdateUserRequestBody {
356
371
  first_name: string;
@@ -374,6 +389,8 @@ declare class ParraAPI {
374
389
  baseUrl: string;
375
390
  });
376
391
  createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
392
+ updateEntitlementsForCustomerById: (customer_id: string) => Promise<Response>;
393
+ createBillingPortalSession: (tenant_id: string) => Promise<BillingPortalSession>;
377
394
  createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
378
395
  getPlansForTenantById: (tenant_id: string) => Promise<TenantPlansResponse>;
379
396
  getTenantById: (tenant_id: string) => Promise<Tenant>;
package/dist/ParraAPI.js CHANGED
@@ -54,6 +54,16 @@ var ParraAPI = /** @class */ (function () {
54
54
  },
55
55
  });
56
56
  };
57
+ this.updateEntitlementsForCustomerById = function (customer_id) {
58
+ return _this.http.execute(_this.options.baseUrl + "/v1/customers/" + customer_id + "/entitlements", {
59
+ method: "post",
60
+ });
61
+ };
62
+ this.createBillingPortalSession = function (tenant_id) {
63
+ return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/billing-portal/sessions", {
64
+ method: "post",
65
+ });
66
+ };
57
67
  this.createCheckoutSession = function (body) {
58
68
  return _this.http.execute(_this.options.baseUrl + "/v1/checkout/sessions", {
59
69
  method: "post",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.37",
3
+ "version": "0.2.41",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",