@flashbacktech/flashbackclient 0.2.5 → 0.2.7

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, GetCheckoutSessionStatusResponse, CreateBillingPortalResponse } from './types/subscriptions';
9
+ import { BuySubscriptionRequest, BuySubscriptionResponse, GetSubscriptionsResponse, MySubscriptionResponse, PaymentsListResponse, PaymentsQueryParams, CancelSubscriptionResponse, GetCheckoutSessionStatusResponse, CreateBillingPortalResponse, GetPendingPaymentResponse, CancelPendingPaymentResponse } 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';
@@ -125,6 +125,8 @@ export declare class ApiClient implements IApiClient {
125
125
  cancelSubscription: () => Promise<CancelSubscriptionResponse>;
126
126
  createBillingPortal: () => Promise<CreateBillingPortalResponse>;
127
127
  getCheckoutSessionStatus: (id: string) => Promise<GetCheckoutSessionStatusResponse>;
128
+ getPendingPayment: () => Promise<GetPendingPaymentResponse>;
129
+ cancelPendingPayment: () => Promise<CancelPendingPaymentResponse>;
128
130
  getDevices: () => Promise<DeviceListResponse>;
129
131
  getDeviceDetails: (deviceId: string) => Promise<DeviceDetailsResponse>;
130
132
  trustDevice: (data: TrustDeviceRequest) => Promise<TrustDeviceResponse>;
@@ -299,6 +299,12 @@ class ApiClient {
299
299
  this.getCheckoutSessionStatus = async (id) => {
300
300
  return this.makeRequest(`subscriptions/checkout-session/${id}`, 'GET', null);
301
301
  };
302
+ this.getPendingPayment = async () => {
303
+ return this.makeRequest('subscriptions/pending-payment', 'GET', null);
304
+ };
305
+ this.cancelPendingPayment = async () => {
306
+ return this.makeRequest('subscriptions/pending-payment', 'DELETE', null);
307
+ };
302
308
  ////// Device Management API
303
309
  this.getDevices = async () => {
304
310
  return this.makeRequest('devices', 'GET', null);
@@ -26,7 +26,7 @@ export interface BuySubscriptionRequest {
26
26
  }
27
27
  export interface BuySubscriptionResponse {
28
28
  success: boolean;
29
- clientSecret?: string;
29
+ checkoutUrl?: string;
30
30
  sessionId?: string;
31
31
  message?: string;
32
32
  error_code?: string;
@@ -89,3 +89,48 @@ export interface GetCheckoutSessionStatusResponse {
89
89
  message?: string;
90
90
  error_code?: string;
91
91
  }
92
+ export interface PendingPaymentSubscription {
93
+ id: string;
94
+ name: string;
95
+ description: string;
96
+ }
97
+ export interface PendingPaymentSubscriptionPeriod {
98
+ id: string;
99
+ periodType: 'ALL_TIME' | 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY';
100
+ price: number;
101
+ }
102
+ export interface PendingPaymentData {
103
+ id: string;
104
+ stripePaymentId: string;
105
+ amount: number;
106
+ currency: string;
107
+ status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'UNPAID' | 'EXPIRED';
108
+ createdAt: string;
109
+ subscription: PendingPaymentSubscription;
110
+ subscriptionPeriod: PendingPaymentSubscriptionPeriod;
111
+ checkoutUrl: string | null;
112
+ sessionStatus: string | null;
113
+ }
114
+ export interface GetPendingPaymentResponse {
115
+ success: boolean;
116
+ data: PendingPaymentData;
117
+ }
118
+ export interface CancelPendingPaymentData {
119
+ paymentId: string;
120
+ stripePaymentId: string;
121
+ cancelledAt: string;
122
+ }
123
+ export interface CancelPendingPaymentResponse {
124
+ success: boolean;
125
+ message: string;
126
+ data: CancelPendingPaymentData;
127
+ }
128
+ export interface PendingPaymentErrorResponse {
129
+ success: false;
130
+ error_code: 'NO_PENDING_PAYMENT' | 'USER_NOT_FOUND' | 'NO_ORGANIZATION' | 'SUBSCRIPTION_PERIOD_NOT_FOUND' | 'INTERNAL_ERROR';
131
+ message: string;
132
+ debug_info?: {
133
+ error_message: string;
134
+ error_type: string;
135
+ };
136
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"