@flashbacktech/flashbackclient 0.2.3 → 0.2.5

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.
@@ -6,7 +6,7 @@ import { NodeInfoResponse, RegisterRequest } from './types/bridge';
6
6
  import { GetOrganizationKeysResponse } from './types/noderegistration';
7
7
  import { QuotaResponse } from './types/quota';
8
8
  import { DeviceListResponse, DeviceDetailsResponse, SessionListResponse, TrustDeviceRequest, TrustDeviceResponse, UntrustDeviceResponse, RemoveDeviceResponse, RevokeSessionResponse, RevokeAllSessionsResponse, SessionHeartbeatResponse, DeviceInfo } from './types/device';
9
- import { BuySubscriptionRequest, BuySubscriptionResponse, GetSubscriptionsResponse, MySubscriptionResponse, PaymentsListResponse, PaymentsQueryParams, CancelSubscriptionResponse } from './types/subscriptions';
9
+ import { BuySubscriptionRequest, BuySubscriptionResponse, GetSubscriptionsResponse, MySubscriptionResponse, PaymentsListResponse, PaymentsQueryParams, CancelSubscriptionResponse, GetCheckoutSessionStatusResponse, CreateBillingPortalResponse } from './types/subscriptions';
10
10
  import { WorkspaceTypes } from '.';
11
11
  import { MFAMethodsResponse, MFASetupRequest, MFASetupResponse, MFAStatusResponse, MFAVerificationSetupRequest, MFAVerificationSetupResponse, MFAEnableRequest, MFAEnableResponse, MFADisableResponse, MFAPrimaryRequest, MFAPrimaryResponse, MFAResetResponse, MFAOrganizationEnforceRequest, MFAOrganizationEnforceResponse, MagicLinkActivationRequest, MagicLinkActivationResponse, MagicLinkSendResponse, PasskeyAuthOptionsResult, PasskeyCompleteRegistrationRequest, PasskeyCompleteRegistrationResponse, MFAVerificationRequest, MFAVerificationLoginResponse, MFAResetRequest } from './types/mfa';
12
12
  import { DeleteSettingsRequest, GetSettingsResponse, PartialUpdateSettingsRequest, UpdateSettingsRequest } from './types/settings';
@@ -123,6 +123,8 @@ export declare class ApiClient implements IApiClient {
123
123
  buySubscription: (data: BuySubscriptionRequest) => Promise<BuySubscriptionResponse>;
124
124
  getPayments: (params?: PaymentsQueryParams) => Promise<PaymentsListResponse>;
125
125
  cancelSubscription: () => Promise<CancelSubscriptionResponse>;
126
+ createBillingPortal: () => Promise<CreateBillingPortalResponse>;
127
+ getCheckoutSessionStatus: (id: string) => Promise<GetCheckoutSessionStatusResponse>;
126
128
  getDevices: () => Promise<DeviceListResponse>;
127
129
  getDeviceDetails: (deviceId: string) => Promise<DeviceDetailsResponse>;
128
130
  trustDevice: (data: TrustDeviceRequest) => Promise<TrustDeviceResponse>;
@@ -293,6 +293,12 @@ class ApiClient {
293
293
  this.cancelSubscription = async () => {
294
294
  return this.makeRequest('subscriptions/cancel', 'POST', null);
295
295
  };
296
+ this.createBillingPortal = async () => {
297
+ return this.makeRequest('subscriptions/portal', 'POST', null);
298
+ };
299
+ this.getCheckoutSessionStatus = async (id) => {
300
+ return this.makeRequest(`subscriptions/checkout-session/${id}`, 'GET', null);
301
+ };
296
302
  ////// Device Management API
297
303
  this.getDevices = async () => {
298
304
  return this.makeRequest('devices', 'GET', null);
@@ -1,14 +1,25 @@
1
+ import { PeriodType } from "./quota";
1
2
  export interface SubscriptionPeriodResponse {
2
3
  id: string;
3
4
  subscriptionId: string;
4
5
  periodType: string;
5
6
  price: number;
6
7
  }
8
+ export interface SubscriptionCapability {
9
+ id: string;
10
+ code: string;
11
+ description: string;
12
+ type: string;
13
+ price: number;
14
+ periodType: PeriodType;
15
+ value: number;
16
+ }
7
17
  export interface SubscriptionResponse {
8
18
  id: string;
9
19
  name: string;
10
20
  description: string;
11
21
  periods: SubscriptionPeriodResponse[];
22
+ capabilities: SubscriptionCapability[];
12
23
  }
13
24
  export interface BuySubscriptionRequest {
14
25
  subscriptionPeriodId: string;
@@ -63,3 +74,18 @@ export interface CancelSubscriptionResponse {
63
74
  message?: string;
64
75
  error_code?: string;
65
76
  }
77
+ export interface CreateBillingPortalResponse {
78
+ success: boolean;
79
+ url?: string;
80
+ message?: string;
81
+ error_code?: string;
82
+ }
83
+ export interface GetCheckoutSessionStatusResponse {
84
+ success: boolean;
85
+ id?: string;
86
+ status?: string | null;
87
+ payment_status?: string | null;
88
+ subscriptionId?: string | null;
89
+ message?: string;
90
+ error_code?: string;
91
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"