@frontegg/rest-api 3.1.76-alpha.9502349697 → 3.1.76-alpha.9762981322

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.
Files changed (122) hide show
  1. package/ContextHolder/index.d.ts +30 -108
  2. package/ContextHolder/index.js +57 -153
  3. package/account-settings/index.d.ts +7 -19
  4. package/account-settings/index.js +13 -23
  5. package/applications/index.d.ts +44 -49
  6. package/applications/index.js +37 -51
  7. package/audits/index.d.ts +15 -27
  8. package/audits/index.js +17 -27
  9. package/auth/index.d.ts +768 -817
  10. package/auth/index.js +721 -902
  11. package/auth/secutiry-poilicy/index.d.ts +102 -58
  12. package/auth/secutiry-poilicy/index.js +90 -122
  13. package/auth/utils.d.ts +2 -2
  14. package/auth/utils.js +8 -9
  15. package/connectivity/index.d.ts +27 -126
  16. package/connectivity/index.js +114 -147
  17. package/directory/index.d.ts +22 -31
  18. package/directory/index.js +15 -27
  19. package/entitlements/index.d.ts +8 -14
  20. package/entitlements/index.js +4 -12
  21. package/feature-flags/index.d.ts +2 -8
  22. package/feature-flags/index.js +8 -16
  23. package/fetch.d.ts +24 -0
  24. package/fetch.js +265 -0
  25. package/groups/index.d.ts +49 -73
  26. package/groups/index.js +45 -64
  27. package/impersonate/index.d.ts +6 -15
  28. package/impersonate/index.js +5 -13
  29. package/index.d.ts +108 -154
  30. package/index.js +78 -109
  31. package/interfaces.d.ts +0 -10
  32. package/metadata/index.d.ts +7 -67
  33. package/metadata/index.js +32 -52
  34. package/node/ContextHolder/index.js +57 -153
  35. package/node/account-settings/index.js +16 -27
  36. package/node/applications/index.js +44 -51
  37. package/node/audits/index.js +20 -31
  38. package/node/auth/index.js +1035 -768
  39. package/node/auth/secutiry-poilicy/index.js +136 -125
  40. package/node/auth/utils.js +7 -9
  41. package/node/connectivity/index.js +187 -148
  42. package/node/directory/index.js +20 -29
  43. package/node/entitlements/index.js +5 -18
  44. package/node/feature-flags/index.js +9 -21
  45. package/node/fetch.js +306 -0
  46. package/node/groups/index.js +63 -65
  47. package/node/impersonate/index.js +5 -18
  48. package/node/index.js +71 -116
  49. package/node/metadata/index.js +52 -61
  50. package/node/notifications/index.js +27 -37
  51. package/node/reports/index.js +70 -78
  52. package/node/roles/index.js +51 -56
  53. package/node/security-center/index.js +9 -21
  54. package/node/sub-tenants/index.js +89 -90
  55. package/node/subscriptions/index.js +107 -69
  56. package/node/subscriptions/invoices.js +17 -25
  57. package/node/subscriptions/managedSubscriptions.js +27 -32
  58. package/node/subscriptions/paymentMethods.js +20 -27
  59. package/node/subscriptions/paymentProviders.js +6 -15
  60. package/node/subscriptions/plans.js +9 -17
  61. package/node/subscriptions/providers/index.js +18 -0
  62. package/node/subscriptions/providers/stripe/index.js +21 -26
  63. package/node/subscriptions/subscriptions.js +27 -32
  64. package/node/subscriptions/summaries.js +6 -15
  65. package/node/subscriptions/tenantConfiguration.js +9 -17
  66. package/node/subscriptions/vendorPublicConfigurations.js +6 -15
  67. package/node/teams/index.js +138 -130
  68. package/node/tenants/index.js +60 -65
  69. package/node/user-phone-numbers/index.js +24 -32
  70. package/node/users/index.js +53 -58
  71. package/node/vendor/index.js +6 -17
  72. package/notifications/index.d.ts +16 -22
  73. package/notifications/index.js +22 -33
  74. package/package.json +1 -1
  75. package/reports/index.d.ts +44 -50
  76. package/reports/index.js +62 -75
  77. package/roles/index.d.ts +38 -44
  78. package/roles/index.js +41 -57
  79. package/security-center/index.d.ts +2 -14
  80. package/security-center/index.js +6 -15
  81. package/sub-tenants/index.d.ts +15 -57
  82. package/sub-tenants/index.js +68 -88
  83. package/subscriptions/index.d.ts +11 -56
  84. package/subscriptions/index.js +11 -58
  85. package/subscriptions/invoices.d.ts +13 -16
  86. package/subscriptions/invoices.js +14 -24
  87. package/subscriptions/managedSubscriptions.d.ts +15 -18
  88. package/subscriptions/managedSubscriptions.js +22 -33
  89. package/subscriptions/paymentMethods.d.ts +13 -16
  90. package/subscriptions/paymentMethods.js +17 -26
  91. package/subscriptions/paymentProviders.d.ts +5 -8
  92. package/subscriptions/paymentProviders.js +4 -11
  93. package/subscriptions/plans.d.ts +8 -11
  94. package/subscriptions/plans.js +6 -14
  95. package/subscriptions/providers/index.d.ts +1 -0
  96. package/subscriptions/providers/index.js +1 -0
  97. package/subscriptions/providers/stripe/index.d.ts +21 -24
  98. package/subscriptions/providers/stripe/index.js +16 -27
  99. package/subscriptions/subscriptions.d.ts +21 -24
  100. package/subscriptions/subscriptions.js +22 -33
  101. package/subscriptions/summaries.d.ts +4 -7
  102. package/subscriptions/summaries.js +3 -10
  103. package/subscriptions/tenantConfiguration.d.ts +3 -6
  104. package/subscriptions/tenantConfiguration.js +7 -15
  105. package/subscriptions/vendorPublicConfigurations.d.ts +2 -5
  106. package/subscriptions/vendorPublicConfigurations.js +4 -11
  107. package/teams/index.d.ts +131 -35
  108. package/teams/index.js +93 -122
  109. package/tenants/index.d.ts +37 -25
  110. package/tenants/index.js +46 -62
  111. package/user-phone-numbers/index.d.ts +26 -32
  112. package/user-phone-numbers/index.js +19 -32
  113. package/users/index.d.ts +15 -21
  114. package/users/index.js +44 -60
  115. package/vendor/index.d.ts +6 -12
  116. package/vendor/index.js +4 -11
  117. package/BaseApiClient.d.ts +0 -16
  118. package/BaseApiClient.js +0 -39
  119. package/FetchClient.d.ts +0 -42
  120. package/FetchClient.js +0 -308
  121. package/node/BaseApiClient.js +0 -49
  122. package/node/FetchClient.js +0 -326
@@ -1,57 +1,15 @@
1
- import { PaginationResult, UserJwtOptions } from '../interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- import { AddUsersToSubTenantRequest, AddUserToSubTenantsRequest, CreateSubTenantRequest, CreateSubTenantResponse, ILoadAllUsers, ISubTenantUser, RemoveUserFromSubTenantsRequest, UpdateSubAccountAccessRequestDto, UpdateSubTenantHierarchySettingsRequest, UpdateSubTenantManagementRequest, UpdateSubTenantRequest, UpdateSubTenantRequestParams, UpdateUserRolesForSubTenantsRequestDto } from './interfaces';
4
- export declare class SubTenantsApi extends BaseApiClient {
5
- constructor(appName: string);
6
- /**
7
- * Loads all users based on given parameters.
8
- */
9
- loadAllUsers: (params: ILoadAllUsers) => Promise<PaginationResult<ISubTenantUser>>;
10
- /**
11
- * Adds a user to a tenant and its sub-tenants.
12
- */
13
- addUserToTenantAndSubTenants: (body: AddUserToSubTenantsRequest) => Promise<void>;
14
- /**
15
- * Removes a user from a tenant and its sub-tenants.
16
- */
17
- removeUserFromTenantAndSubTenants: (body: RemoveUserFromSubTenantsRequest, options?: UserJwtOptions | undefined) => Promise<void>;
18
- /**
19
- * Adds user roles for sub-tenants.
20
- */
21
- addUserRolesForSubTenants: (userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions | undefined) => Promise<void>;
22
- /**
23
- * Removes user roles from sub-tenants.
24
- */
25
- removeUserRolesFromSubTenants: (userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions | undefined) => Promise<void>;
26
- /**
27
- * Sets user roles for sub-tenants.
28
- */
29
- setUserRolesForSubTenants: (userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions | undefined) => Promise<void>;
30
- /**
31
- * Creates a new sub-tenant.
32
- */
33
- createSubTenant: (body: CreateSubTenantRequest, options?: UserJwtOptions | undefined) => Promise<CreateSubTenantResponse>;
34
- /**
35
- * Deletes a sub-tenant.
36
- */
37
- deleteSubTenant: (tenantId: string, options?: UserJwtOptions | undefined) => Promise<void>;
38
- /**
39
- * Updates sub-tenant information.
40
- */
41
- updateSubTenant: ({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantRequest, options?: UserJwtOptions | undefined) => Promise<void>;
42
- /**
43
- * Updates sub-tenant management information.
44
- */
45
- updateSubTenantManagement: ({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantManagementRequest, options?: UserJwtOptions | undefined) => Promise<CreateSubTenantResponse>;
46
- updateSubTenantHierarchySettings({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantHierarchySettingsRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
47
- /**
48
- * Updates sub-account access.
49
- */
50
- updateSubAccountAccess: (userId: string, body: UpdateSubAccountAccessRequestDto, options?: UserJwtOptions | undefined) => Promise<void>;
51
- /**
52
- * Adds multiple users to a sub-tenant.
53
- */
54
- addUsersToSubTenant: (body: AddUsersToSubTenantRequest, options?: UserJwtOptions | undefined) => Promise<void>;
55
- }
56
- declare const _default: SubTenantsApi;
57
- export default _default;
1
+ import { PaginationResult, UserJwtOptions } from "../interfaces";
2
+ import { AddUsersToSubTenantRequest, AddUserToSubTenantsRequest, CreateSubTenantRequest, CreateSubTenantResponse, ILoadAllUsers, ISubTenantUser, RemoveUserFromSubTenantsRequest, UpdateSubAccountAccessRequestDto, UpdateSubTenantHierarchySettingsRequest, UpdateSubTenantManagementRequest, UpdateSubTenantRequest, UpdateSubTenantRequestParams, UpdateUserRolesForSubTenantsRequestDto } from "./interfaces";
3
+ export declare function loadAllUsers(params: ILoadAllUsers): Promise<PaginationResult<ISubTenantUser>>;
4
+ export declare function addUserToTenantAndSubTenants(body: AddUserToSubTenantsRequest): Promise<void>;
5
+ export declare function removeUserFromTenantAndSubTenants(body: RemoveUserFromSubTenantsRequest, options?: UserJwtOptions): Promise<void>;
6
+ export declare function addUserRolesForSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions): Promise<void>;
7
+ export declare function removeUserRolesFromSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions): Promise<void>;
8
+ export declare function setUserRolesForSubTenants(userId: string, body: UpdateUserRolesForSubTenantsRequestDto, options?: UserJwtOptions): Promise<void>;
9
+ export declare function createSubTenant(body: CreateSubTenantRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
10
+ export declare function deleteSubTenant(tenantId: string, options?: UserJwtOptions): Promise<void>;
11
+ export declare function updateSubTenant({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantRequest, options?: UserJwtOptions): Promise<void>;
12
+ export declare function updateSubTenantManagement({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantManagementRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
13
+ export declare function updateSubTenantHierarchySettings({ tenantId }: UpdateSubTenantRequestParams, body: UpdateSubTenantHierarchySettingsRequest, options?: UserJwtOptions): Promise<CreateSubTenantResponse>;
14
+ export declare function updateSubAccountAccess(userId: string, body: UpdateSubAccountAccessRequestDto, options?: UserJwtOptions): Promise<void>;
15
+ export declare function addUsersToSubTenant(body: AddUsersToSubTenantRequest, options?: UserJwtOptions): Promise<void>;
@@ -1,89 +1,69 @@
1
- import { urls } from '../constants';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export class SubTenantsApi extends BaseApiClient {
4
- constructor(appName) {
5
- super(appName);
6
-
7
- this.loadAllUsers = async params => {
8
- return this.get(urls.identity.subTenants.v1, params);
9
- };
10
-
11
- this.addUserToTenantAndSubTenants = async body => {
12
- return this.post(urls.identity.subTenants.v1, body);
13
- };
14
-
15
- this.removeUserFromTenantAndSubTenants = async (body, options) => {
16
- return this.delete(urls.identity.subTenants.v1, body, {
17
- headers: this.extractHeadersFromOptions(options)
18
- });
19
- };
20
-
21
- this.addUserRolesForSubTenants = async (userId, body, options) => {
22
- return this.post(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
23
- headers: this.extractHeadersFromOptions(options)
24
- });
25
- };
26
-
27
- this.removeUserRolesFromSubTenants = async (userId, body, options) => {
28
- return this.delete(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
29
- headers: this.extractHeadersFromOptions(options)
30
- });
31
- };
32
-
33
- this.setUserRolesForSubTenants = async (userId, body, options) => {
34
- return this.patch(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
35
- headers: this.extractHeadersFromOptions(options)
36
- });
37
- };
38
-
39
- this.createSubTenant = async (body, options) => {
40
- return this.post(urls.tenants.subTenants.v1, body, {
41
- headers: this.extractHeadersFromOptions(options)
42
- });
43
- };
44
-
45
- this.deleteSubTenant = async (tenantId, options) => {
46
- return this.delete(`${urls.tenants.subTenants.v1}/${tenantId}`, undefined, {
47
- headers: this.extractHeadersFromOptions(options)
48
- });
49
- };
50
-
51
- this.updateSubTenant = async ({
52
- tenantId
53
- }, body, options) => {
54
- return this.patch(`${urls.tenants.subTenants.v1}/${tenantId}`, body, {
55
- headers: this.extractHeadersFromOptions(options)
56
- });
57
- };
58
-
59
- this.updateSubTenantManagement = async ({
60
- tenantId
61
- }, body, options) => {
62
- return this.put(`${urls.tenants.subTenants.v1}/${tenantId}/management`, body, {
63
- headers: this.extractHeadersFromOptions(options)
64
- });
65
- };
66
-
67
- this.updateSubAccountAccess = async (userId, body, options) => {
68
- return this.put(`${urls.identity.subTenants.v1}/${userId}/access`, body, {
69
- headers: this.extractHeadersFromOptions(options)
70
- });
71
- };
72
-
73
- this.addUsersToSubTenant = async (body, options) => {
74
- return this.post(`${urls.identity.subTenants.v2}/`, body, {
75
- headers: this.extractHeadersFromOptions(options)
76
- });
77
- };
78
- }
79
-
80
- updateSubTenantHierarchySettings({
81
- tenantId
82
- }, body, options) {
83
- return this.put(`${urls.tenants.subTenants.v1}/${tenantId}/hierarchy-settings`, body, {
84
- headers: this.extractHeadersFromOptions(options)
85
- });
86
- }
87
-
1
+ import { Delete, extractHeadersFromOptions, Get, Patch, Post, Put } from "../fetch";
2
+ import { urls } from "../constants";
3
+ export async function loadAllUsers(params) {
4
+ return Get(urls.identity.subTenants.v1, params);
88
5
  }
89
- export default new SubTenantsApi('default');
6
+ export async function addUserToTenantAndSubTenants(body) {
7
+ return Post(urls.identity.subTenants.v1, body);
8
+ }
9
+ export async function removeUserFromTenantAndSubTenants(body, options) {
10
+ return Delete(urls.identity.subTenants.v1, body, {
11
+ headers: extractHeadersFromOptions(options)
12
+ });
13
+ }
14
+ export async function addUserRolesForSubTenants(userId, body, options) {
15
+ return Post(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
16
+ headers: extractHeadersFromOptions(options)
17
+ });
18
+ }
19
+ export async function removeUserRolesFromSubTenants(userId, body, options) {
20
+ return Delete(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
21
+ headers: extractHeadersFromOptions(options)
22
+ });
23
+ }
24
+ export async function setUserRolesForSubTenants(userId, body, options) {
25
+ return Patch(`${urls.identity.subTenants.v1}/${userId}/roles`, body, {
26
+ headers: extractHeadersFromOptions(options)
27
+ });
28
+ }
29
+ export async function createSubTenant(body, options) {
30
+ return Post(urls.tenants.subTenants.v1, body, {
31
+ headers: extractHeadersFromOptions(options)
32
+ });
33
+ }
34
+ export async function deleteSubTenant(tenantId, options) {
35
+ return Delete(`${urls.tenants.subTenants.v1}/${tenantId}`, undefined, {
36
+ headers: extractHeadersFromOptions(options)
37
+ });
38
+ }
39
+ export async function updateSubTenant({
40
+ tenantId
41
+ }, body, options) {
42
+ return Patch(`${urls.tenants.subTenants.v1}/${tenantId}`, body, {
43
+ headers: extractHeadersFromOptions(options)
44
+ });
45
+ }
46
+ export async function updateSubTenantManagement({
47
+ tenantId
48
+ }, body, options) {
49
+ return Put(`${urls.tenants.subTenants.v1}/${tenantId}/management`, body, {
50
+ headers: extractHeadersFromOptions(options)
51
+ });
52
+ }
53
+ export async function updateSubTenantHierarchySettings({
54
+ tenantId
55
+ }, body, options) {
56
+ return Put(`${urls.tenants.subTenants.v1}/${tenantId}/hierarchy-settings`, body, {
57
+ headers: extractHeadersFromOptions(options)
58
+ });
59
+ }
60
+ export async function updateSubAccountAccess(userId, body, options) {
61
+ return Put(`${urls.identity.subTenants.v1}/${userId}/access`, body, {
62
+ headers: extractHeadersFromOptions(options)
63
+ });
64
+ }
65
+ export async function addUsersToSubTenant(body, options) {
66
+ return Post(`${urls.identity.subTenants.v2}/`, body, {
67
+ headers: extractHeadersFromOptions(options)
68
+ });
69
+ }
@@ -1,56 +1,11 @@
1
- import { BaseApiClient } from '../BaseApiClient';
2
- export declare class SubscriptionsApi extends BaseApiClient {
3
- constructor(appName: string);
4
- private readonly invoicesApi;
5
- private readonly managedSubscriptionApi;
6
- private readonly paymentMethodsApi;
7
- private readonly paymentProvidersApi;
8
- private readonly plansApi;
9
- private readonly subscriptionApi;
10
- private readonly summariesApi;
11
- private readonly subscriptionTenantConfigApi;
12
- private readonly vendorPublicConfigApi;
13
- private readonly stripeProviderApi;
14
- /** InvoicesApi **/
15
- getSubscriptionInvoices: () => Promise<import("./interfaces").ISubscriptionInvoiceResponse[]>;
16
- getSubscriptionInvoice: (invoiceId: string) => Promise<import("./interfaces").ISubscriptionInvoiceResponse>;
17
- getSubscriptionInvoicePdf: (invoiceId: string, outputFileName?: string | undefined) => Promise<void>;
18
- /** ManagedSubscriptionApi **/
19
- getManagedSubscription: (subscriptionId: string) => Promise<import("./interfaces").ISubscriptionResponse>;
20
- getManagedSubscriptions: () => Promise<import("./interfaces").ISubscriptionResponse[]>;
21
- cancelManagedSubscription: (subscriptionId: string) => Promise<void>;
22
- renewManagedSubscription: (subscriptionId: string) => Promise<void>;
23
- updateManagedSubscription: (subscriptionId: string, { paymentMethodId, planId }: import("./interfaces").IUpdateManagedSubscriptionRequest) => Promise<void>;
24
- /** PaymentMethodsApi **/
25
- getPaymentMethods: () => Promise<import("./interfaces").ISubscriptionPaymentMethodResponse[]>;
26
- getPaymentMethod: (paymentMethodId: string) => Promise<import("./interfaces").ISubscriptionPaymentMethodResponse>;
27
- updatePaymentMethodBillingDetails: (paymentMethodId: string, { email, ...address }: import("./interfaces").ISubscriptionUpdatePaymentMethodBillingDetails) => Promise<import("./interfaces").ISubscriptionUpdatePaymentMethodBillingDetails>;
28
- /** PaymentProvidersApi **/
29
- getPaymentProviders: () => Promise<import("./interfaces").IPaymentProviderResponse[]>;
30
- /** PlansApi **/
31
- getSubscriptionPlans: () => Promise<import("./interfaces").IPlanResponse[]>;
32
- getSubscriptionPlan: (planId: string) => Promise<import("./interfaces").IPlanResponse[]>;
33
- /** SubscriptionApi **/
34
- getSubscriptions: () => Promise<import("./interfaces").ISubscriptionResponse[]>;
35
- getSubscription: (subscriptionId: string) => Promise<import("./interfaces").ISubscriptionResponse>;
36
- cancelSubscription: (subscriptionId: string) => Promise<void>;
37
- renewSubscription: (subscriptionId: string) => Promise<void>;
38
- updateSubscription: (subscriptionId: string, { paymentMethodId, planId }: import("./interfaces").IUpdateSubscriptionRequest) => Promise<void>;
39
- /** SummariesApi **/
40
- getSubscriptionSummaries: (tenantId: string) => Promise<import("./interfaces").ISubscriptionSummariesResponse>;
41
- /** SubscriptionTenantConfigApi **/
42
- getTenantConfiguration: (tenantId: string) => Promise<import("./interfaces").ITenantConfigurationResponse>;
43
- createTenantConfiguration: (request: import("./interfaces").ICreateTenantConfigurationRequest) => Promise<import("./interfaces").ICreateTenantConfigurationResponse>;
44
- /** VendorPublicConfigApi **/
45
- getVendorPublicConfigurations: () => Promise<import("./interfaces").IVendorPublicConfigurationResponse[]>;
46
- /** StripeProviderApi **/
47
- createSubscription: (request: import("./interfaces").ICreateStripeSubscriptionRequest) => Promise<import("./interfaces").ICreateSubscriptionResponse>;
48
- getStripeCustomer: (tenantId: string) => Promise<import("./interfaces").IStripeCustomerResponse>;
49
- createStripeCustomer: (request: import("./interfaces").ICreateStripeCustomerRequest) => Promise<import("./interfaces").ICreateStripeCustomerResponse>;
50
- getStripePaymentProviderConfiguration: () => Promise<import("./interfaces").IStripePaymentProviderConfigurationResponse>;
51
- createStripePaymentMethodSetupIntentSecret: (request: import("./interfaces").ICreateStripePaymentMethodSetupRequest) => Promise<import("./interfaces").ICreateStripePaymentMethodSetupResponse>;
52
- }
53
- declare const _default: SubscriptionsApi;
54
- export default _default;
55
- export * from './interfaces';
56
- export * from './enums';
1
+ export * from "./subscriptions";
2
+ export * from "./managedSubscriptions";
3
+ export * from "./plans";
4
+ export * from "./invoices";
5
+ export * from "./paymentMethods";
6
+ export * from "./providers";
7
+ export * from "./summaries";
8
+ export * from "./tenantConfiguration";
9
+ export * from "./paymentProviders";
10
+ export * from "./vendorPublicConfigurations";
11
+ export * from "./enums";
@@ -1,58 +1,11 @@
1
- import { BaseApiClient } from '../BaseApiClient';
2
- import { InvoicesApi } from './invoices';
3
- import { ManagedSubscriptionApi } from './managedSubscriptions';
4
- import { PaymentMethodsApi } from './paymentMethods';
5
- import { PaymentProvidersApi } from './paymentProviders';
6
- import { PlansApi } from './plans';
7
- import { SubscriptionApi } from './subscriptions';
8
- import { SummariesApi } from './summaries';
9
- import { SubscriptionTenantConfigApi } from './tenantConfiguration';
10
- import { VendorPublicConfigApi } from './vendorPublicConfigurations';
11
- import { StripeProviderApi } from './providers/stripe';
12
- export class SubscriptionsApi extends BaseApiClient {
13
- constructor(appName) {
14
- super(appName);
15
- this.invoicesApi = new InvoicesApi(this.appName);
16
- this.managedSubscriptionApi = new ManagedSubscriptionApi(this.appName);
17
- this.paymentMethodsApi = new PaymentMethodsApi(this.appName);
18
- this.paymentProvidersApi = new PaymentProvidersApi(this.appName);
19
- this.plansApi = new PlansApi(this.appName);
20
- this.subscriptionApi = new SubscriptionApi(this.appName);
21
- this.summariesApi = new SummariesApi(this.appName);
22
- this.subscriptionTenantConfigApi = new SubscriptionTenantConfigApi(this.appName);
23
- this.vendorPublicConfigApi = new VendorPublicConfigApi(this.appName);
24
- this.stripeProviderApi = new StripeProviderApi(this.appName);
25
- this.getSubscriptionInvoices = this.invoicesApi.getSubscriptionInvoices.bind(this.invoicesApi);
26
- this.getSubscriptionInvoice = this.invoicesApi.getSubscriptionInvoice.bind(this.invoicesApi);
27
- this.getSubscriptionInvoicePdf = this.invoicesApi.getSubscriptionInvoicePdf.bind(this.invoicesApi);
28
- this.getManagedSubscription = this.managedSubscriptionApi.getManagedSubscription.bind(this.managedSubscriptionApi);
29
- this.getManagedSubscriptions = this.managedSubscriptionApi.getManagedSubscriptions.bind(this.managedSubscriptionApi);
30
- this.cancelManagedSubscription = this.managedSubscriptionApi.cancelManagedSubscription.bind(this.managedSubscriptionApi);
31
- this.renewManagedSubscription = this.managedSubscriptionApi.renewManagedSubscription.bind(this.managedSubscriptionApi);
32
- this.updateManagedSubscription = this.managedSubscriptionApi.updateManagedSubscription.bind(this.managedSubscriptionApi);
33
- this.getPaymentMethods = this.paymentMethodsApi.getPaymentMethods.bind(this.paymentMethodsApi);
34
- this.getPaymentMethod = this.paymentMethodsApi.getPaymentMethod.bind(this.paymentMethodsApi);
35
- this.updatePaymentMethodBillingDetails = this.paymentMethodsApi.updatePaymentMethodBillingDetails.bind(this.paymentMethodsApi);
36
- this.getPaymentProviders = this.paymentProvidersApi.getPaymentProviders.bind(this.paymentProvidersApi);
37
- this.getSubscriptionPlans = this.plansApi.getSubscriptionPlans.bind(this.plansApi);
38
- this.getSubscriptionPlan = this.plansApi.getSubscriptionPlan.bind(this.plansApi);
39
- this.getSubscriptions = this.subscriptionApi.getSubscriptions.bind(this.subscriptionApi);
40
- this.getSubscription = this.subscriptionApi.getSubscription.bind(this.subscriptionApi);
41
- this.cancelSubscription = this.subscriptionApi.cancelSubscription.bind(this.subscriptionApi);
42
- this.renewSubscription = this.subscriptionApi.renewSubscription.bind(this.subscriptionApi);
43
- this.updateSubscription = this.subscriptionApi.updateSubscription.bind(this.subscriptionApi);
44
- this.getSubscriptionSummaries = this.summariesApi.getSubscriptionSummaries.bind(this.summariesApi);
45
- this.getTenantConfiguration = this.subscriptionTenantConfigApi.getTenantConfiguration.bind(this.subscriptionTenantConfigApi);
46
- this.createTenantConfiguration = this.subscriptionTenantConfigApi.createTenantConfiguration.bind(this.subscriptionTenantConfigApi);
47
- this.getVendorPublicConfigurations = this.vendorPublicConfigApi.getVendorPublicConfigurations.bind(this.vendorPublicConfigApi);
48
- this.createSubscription = this.stripeProviderApi.createSubscription.bind(this.stripeProviderApi);
49
- this.getStripeCustomer = this.stripeProviderApi.getStripeCustomer.bind(this.stripeProviderApi);
50
- this.createStripeCustomer = this.stripeProviderApi.createStripeCustomer.bind(this.stripeProviderApi);
51
- this.getStripePaymentProviderConfiguration = this.stripeProviderApi.getStripePaymentProviderConfiguration.bind(this.stripeProviderApi);
52
- this.createStripePaymentMethodSetupIntentSecret = this.stripeProviderApi.createStripePaymentMethodSetupIntentSecret.bind(this.stripeProviderApi);
53
- }
54
-
55
- }
56
- export default new SubscriptionsApi('default');
57
- export * from './interfaces';
58
- export * from './enums';
1
+ export * from "./subscriptions";
2
+ export * from "./managedSubscriptions";
3
+ export * from "./plans";
4
+ export * from "./invoices";
5
+ export * from "./paymentMethods";
6
+ export * from "./providers";
7
+ export * from "./summaries";
8
+ export * from "./tenantConfiguration";
9
+ export * from "./paymentProviders";
10
+ export * from "./vendorPublicConfigurations";
11
+ export * from "./enums";
@@ -1,16 +1,13 @@
1
- import { ISubscriptionInvoiceResponse } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class InvoicesApi extends BaseApiClient {
4
- /**
5
- * Get subscription invoices
6
- */
7
- getSubscriptionInvoices: () => Promise<ISubscriptionInvoiceResponse[]>;
8
- /**
9
- * Get subscription invoice
10
- */
11
- getSubscriptionInvoice: (invoiceId: string) => Promise<ISubscriptionInvoiceResponse>;
12
- /**
13
- * Get subscription invoice pdf file
14
- */
15
- getSubscriptionInvoicePdf: (invoiceId: string, outputFileName?: string | undefined) => Promise<void>;
16
- }
1
+ import { ISubscriptionInvoiceResponse } from "./interfaces";
2
+ /**
3
+ * Get subscription invoices
4
+ */
5
+ export declare function getSubscriptionInvoices(): Promise<ISubscriptionInvoiceResponse[]>;
6
+ /**
7
+ * Get subscription invoice
8
+ */
9
+ export declare function getSubscriptionInvoice(invoiceId: string): Promise<ISubscriptionInvoiceResponse>;
10
+ /**
11
+ * Get subscription invoice pdf file
12
+ */
13
+ export declare function getSubscriptionInvoicePdf(invoiceId: string, outputFileName?: string): Promise<void>;
@@ -1,25 +1,15 @@
1
- import { urls } from '../constants';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export class InvoicesApi extends BaseApiClient {
4
- constructor(...args) {
5
- super(...args);
6
-
7
- this.getSubscriptionInvoices = async () => {
8
- return this.get(urls.subscriptions.billing.invoices.v1);
9
- };
10
-
11
- this.getSubscriptionInvoice = async invoiceId => {
12
- return this.get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}`);
13
- };
14
-
15
- this.getSubscriptionInvoicePdf = async (invoiceId, outputFileName) => {
16
- return this.get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}/pdf`, {
17
- outputFileName
18
- }, {
19
- responseType: 'blob'
20
- });
21
- };
22
- }
23
-
1
+ import { Get } from "../fetch";
2
+ import { urls } from "../constants";
3
+ export async function getSubscriptionInvoices() {
4
+ return Get(urls.subscriptions.billing.invoices.v1);
24
5
  }
25
- ;
6
+ export async function getSubscriptionInvoice(invoiceId) {
7
+ return Get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}`);
8
+ }
9
+ export async function getSubscriptionInvoicePdf(invoiceId, outputFileName) {
10
+ return Get(`${urls.subscriptions.billing.invoices.v1}/${invoiceId}/pdf`, {
11
+ outputFileName
12
+ }, {
13
+ responseType: "blob"
14
+ });
15
+ }
@@ -1,18 +1,15 @@
1
- import { ISubscriptionResponse, IUpdateManagedSubscriptionRequest } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class ManagedSubscriptionApi extends BaseApiClient {
4
- getManagedSubscription: (subscriptionId: string) => Promise<ISubscriptionResponse>;
5
- getManagedSubscriptions: () => Promise<ISubscriptionResponse[]>;
6
- /**
7
- * Cancel tenant subscription
8
- */
9
- cancelManagedSubscription: (subscriptionId: string) => Promise<void>;
10
- /**
11
- * Renew tenant subscription
12
- */
13
- renewManagedSubscription: (subscriptionId: string) => Promise<void>;
14
- /**
15
- * Upgrade/Downgrade tenant subscription plan
16
- */
17
- updateManagedSubscription: (subscriptionId: string, { paymentMethodId, planId }: IUpdateManagedSubscriptionRequest) => Promise<void>;
18
- }
1
+ import { ISubscriptionResponse, IUpdateManagedSubscriptionRequest } from "./interfaces";
2
+ export declare function getManagedSubscription(subscriptionId: string): Promise<ISubscriptionResponse>;
3
+ export declare function getManagedSubscriptions(): Promise<ISubscriptionResponse[]>;
4
+ /**
5
+ * Cancel tenant subscription
6
+ */
7
+ export declare function cancelManagedSubscription(subscriptionId: string): Promise<void>;
8
+ /**
9
+ * Renew tenant subscription
10
+ */
11
+ export declare function renewManagedSubscription(subscriptionId: string): Promise<void>;
12
+ /**
13
+ * Upgrade/Downgrade tenant subscription plan
14
+ */
15
+ export declare function updateManagedSubscription(subscriptionId: string, { paymentMethodId, planId }: IUpdateManagedSubscriptionRequest): Promise<void>;
@@ -1,34 +1,23 @@
1
- import { urls } from '../constants';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export class ManagedSubscriptionApi extends BaseApiClient {
4
- constructor(...args) {
5
- super(...args);
6
-
7
- this.getManagedSubscription = async subscriptionId => {
8
- return this.get(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`);
9
- };
10
-
11
- this.getManagedSubscriptions = async () => {
12
- return this.get(urls.subscriptions.managedSubscriptions.v1);
13
- };
14
-
15
- this.cancelManagedSubscription = async subscriptionId => {
16
- return this.put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/cancellations/`, {});
17
- };
18
-
19
- this.renewManagedSubscription = async subscriptionId => {
20
- return this.put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/renewals/`, {});
21
- };
22
-
23
- this.updateManagedSubscription = async (subscriptionId, {
24
- paymentMethodId,
25
- planId
26
- }) => {
27
- return this.put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, {
28
- paymentMethodId,
29
- planId
30
- });
31
- };
32
- }
33
-
1
+ import { Get, Put } from "../fetch";
2
+ import { urls } from "../constants";
3
+ export async function getManagedSubscription(subscriptionId) {
4
+ return Get(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`);
5
+ }
6
+ export async function getManagedSubscriptions() {
7
+ return Get(`${urls.subscriptions.managedSubscriptions.v1}`);
8
+ }
9
+ export async function cancelManagedSubscription(subscriptionId) {
10
+ return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/cancellations/`, {});
11
+ }
12
+ export async function renewManagedSubscription(subscriptionId) {
13
+ return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}/renewals/`, {});
14
+ }
15
+ export async function updateManagedSubscription(subscriptionId, {
16
+ paymentMethodId,
17
+ planId
18
+ }) {
19
+ return Put(`${urls.subscriptions.managedSubscriptions.v1}/${subscriptionId}`, {
20
+ paymentMethodId,
21
+ planId
22
+ });
34
23
  }
@@ -1,16 +1,13 @@
1
- import { ISubscriptionPaymentMethodResponse, ISubscriptionUpdatePaymentMethodBillingDetails } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class PaymentMethodsApi extends BaseApiClient {
4
- /**
5
- * Get payment methods
6
- */
7
- getPaymentMethods: () => Promise<ISubscriptionPaymentMethodResponse[]>;
8
- /**
9
- * Get payment method
10
- */
11
- getPaymentMethod: (paymentMethodId: string) => Promise<ISubscriptionPaymentMethodResponse>;
12
- /**
13
- * Update payment method billing details
14
- */
15
- updatePaymentMethodBillingDetails: (paymentMethodId: string, { email, ...address }: ISubscriptionUpdatePaymentMethodBillingDetails) => Promise<ISubscriptionUpdatePaymentMethodBillingDetails>;
16
- }
1
+ import { ISubscriptionPaymentMethodResponse, ISubscriptionUpdatePaymentMethodBillingDetails } from "./interfaces";
2
+ /**
3
+ * Get payment methods
4
+ */
5
+ export declare function getPaymentMethods(): Promise<ISubscriptionPaymentMethodResponse[]>;
6
+ /**
7
+ * Get payment method
8
+ */
9
+ export declare function getPaymentMethod(paymentMethodId: string): Promise<ISubscriptionPaymentMethodResponse>;
10
+ /**
11
+ * Update payment method billing details
12
+ */
13
+ export declare function updatePaymentMethodBillingDetails(paymentMethodId: string, { email, ...address }: ISubscriptionUpdatePaymentMethodBillingDetails): Promise<ISubscriptionUpdatePaymentMethodBillingDetails>;
@@ -1,30 +1,21 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  const _excluded = ["email"];
3
- import { urls } from '../constants';
4
- import { BaseApiClient } from '../BaseApiClient';
5
- export class PaymentMethodsApi extends BaseApiClient {
6
- constructor(...args) {
7
- super(...args);
8
-
9
- this.getPaymentMethods = async () => {
10
- return this.get(urls.subscriptions.billing.paymentMethods.v1);
11
- };
12
-
13
- this.getPaymentMethod = async paymentMethodId => {
14
- return this.get(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}`);
15
- };
16
-
17
- this.updatePaymentMethodBillingDetails = async (paymentMethodId, _ref) => {
18
- let {
19
- email
20
- } = _ref,
21
- address = _objectWithoutPropertiesLoose(_ref, _excluded);
22
-
23
- return this.patch(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}/billing-details`, {
24
- email,
25
- address
26
- });
27
- };
28
- }
3
+ import { Get, Patch } from "../fetch";
4
+ import { urls } from "../constants";
5
+ export async function getPaymentMethods() {
6
+ return Get(urls.subscriptions.billing.paymentMethods.v1);
7
+ }
8
+ export async function getPaymentMethod(paymentMethodId) {
9
+ return Get(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}`);
10
+ }
11
+ export async function updatePaymentMethodBillingDetails(paymentMethodId, _ref) {
12
+ let {
13
+ email
14
+ } = _ref,
15
+ address = _objectWithoutPropertiesLoose(_ref, _excluded);
29
16
 
17
+ return Patch(`${urls.subscriptions.billing.paymentMethods.v1}/${paymentMethodId}/billing-details`, {
18
+ email,
19
+ address
20
+ });
30
21
  }
@@ -1,8 +1,5 @@
1
- import { IPaymentProviderResponse } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class PaymentProvidersApi extends BaseApiClient {
4
- /**
5
- * Gets payment providers for vendor
6
- */
7
- getPaymentProviders: () => Promise<IPaymentProviderResponse[]>;
8
- }
1
+ import { IPaymentProviderResponse } from "./interfaces";
2
+ /**
3
+ * Gets payment providers for vendor
4
+ */
5
+ export declare function getPaymentProviders(): Promise<IPaymentProviderResponse[]>;