@parra/parra-js-sdk 0.2.36 → 0.2.39

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;
@@ -44,18 +47,49 @@ export interface Plan {
44
47
  price: UnitPrice;
45
48
  discounted_price?: Price;
46
49
  unit_price: UnitPrice;
47
- context: string;
50
+ context?: string | null;
51
+ }
52
+ export declare enum SubscriptionStatus {
53
+ incomplete = "incomplete",
54
+ incompleteExpired = "incomplete_expired",
55
+ trialing = "trialing",
56
+ active = "active",
57
+ pastDue = "past_due",
58
+ canceled = "canceled",
59
+ unpaid = "unpaid"
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;
48
68
  }
49
69
  export interface Subscription {
50
70
  id: string;
51
71
  created_at: string;
52
72
  updated_at: string;
53
73
  deleted_at?: string | null;
74
+ customer_id: string;
75
+ status: SubscriptionStatus;
76
+ cancel_at?: string | null;
77
+ cancel_at_period_end?: boolean | null;
78
+ canceled_at?: string | null;
79
+ current_period_start?: string | null;
80
+ current_period_end?: string | null;
81
+ start_date?: string | null;
82
+ ended_at?: string | null;
83
+ trial_start?: string | null;
84
+ trial_end?: string | null;
85
+ items: Array<SubscriptionItem>;
54
86
  }
55
87
  export interface TenantPlansResponse {
56
88
  plans?: Array<Plan>;
57
89
  subscriptions?: Array<Subscription>;
58
90
  }
91
+ export interface StripeEvent {
92
+ }
59
93
  export interface CreateTenantRequestBody {
60
94
  name: string;
61
95
  is_test: boolean;
@@ -350,6 +384,7 @@ declare class ParraAPI {
350
384
  baseUrl: string;
351
385
  });
352
386
  createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
387
+ createBillingPortalSession: (tenant_id: string) => Promise<BillingPortalSession>;
353
388
  createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
354
389
  getPlansForTenantById: (tenant_id: string) => Promise<TenantPlansResponse>;
355
390
  getTenantById: (tenant_id: string) => Promise<Tenant>;
package/dist/ParraAPI.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QuestionStatus = exports.QuestionKind = exports.QuestionType = exports.CardItemType = exports.Interval = exports.Currency = void 0;
3
+ exports.QuestionStatus = exports.QuestionKind = exports.QuestionType = exports.CardItemType = exports.SubscriptionStatus = exports.Interval = exports.Currency = void 0;
4
4
  var Currency;
5
5
  (function (Currency) {
6
6
  Currency["usd"] = "usd";
@@ -10,6 +10,16 @@ var Interval;
10
10
  Interval["monthly"] = "monthly";
11
11
  Interval["annual"] = "annual";
12
12
  })(Interval = exports.Interval || (exports.Interval = {}));
13
+ var SubscriptionStatus;
14
+ (function (SubscriptionStatus) {
15
+ SubscriptionStatus["incomplete"] = "incomplete";
16
+ SubscriptionStatus["incompleteExpired"] = "incomplete_expired";
17
+ SubscriptionStatus["trialing"] = "trialing";
18
+ SubscriptionStatus["active"] = "active";
19
+ SubscriptionStatus["pastDue"] = "past_due";
20
+ SubscriptionStatus["canceled"] = "canceled";
21
+ SubscriptionStatus["unpaid"] = "unpaid";
22
+ })(SubscriptionStatus = exports.SubscriptionStatus || (exports.SubscriptionStatus = {}));
13
23
  var CardItemType;
14
24
  (function (CardItemType) {
15
25
  CardItemType["question"] = "question";
@@ -44,6 +54,11 @@ var ParraAPI = /** @class */ (function () {
44
54
  },
45
55
  });
46
56
  };
57
+ this.createBillingPortalSession = function (tenant_id) {
58
+ return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/billing-portal/sessions", {
59
+ method: "post",
60
+ });
61
+ };
47
62
  this.createCheckoutSession = function (body) {
48
63
  return _this.http.execute(_this.options.baseUrl + "/v1/checkout/sessions", {
49
64
  method: "post",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.36",
3
+ "version": "0.2.39",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",