@livechat/developer-studio-api 2.3.2 → 2.3.4
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.
- package/dist/index.d.mts +137 -3
- package/dist/index.d.ts +137 -3
- package/dist/index.js +248 -25
- package/dist/index.mjs +244 -25
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -434,6 +434,31 @@ interface GetAppMonitoringEventsLogResponse {
|
|
|
434
434
|
next_page_from?: string;
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
+
interface TextPlatformDashboardReportItemDto {
|
|
438
|
+
usage: number;
|
|
439
|
+
amount: number;
|
|
440
|
+
client_id: string;
|
|
441
|
+
api_type: string;
|
|
442
|
+
method: string;
|
|
443
|
+
}
|
|
444
|
+
type TextPlatformDashboardReportDto = Record<string, TextPlatformDashboardReportItemDto[]>;
|
|
445
|
+
|
|
446
|
+
interface TextPlatformDashboardCreditsDto {
|
|
447
|
+
available_amount: number;
|
|
448
|
+
used_amount: number;
|
|
449
|
+
left_amount: number;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
interface GetTextPlatformDashboardReportParams {
|
|
453
|
+
from: string;
|
|
454
|
+
to: string;
|
|
455
|
+
service?: "agent-api" | "customer-api" | "configuration-api" | "lc-webhooks" | "reports-api";
|
|
456
|
+
action?: string;
|
|
457
|
+
source?: string;
|
|
458
|
+
time_distribution: "hour" | "day";
|
|
459
|
+
group_by?: "source" | "service" | "action";
|
|
460
|
+
}
|
|
461
|
+
|
|
437
462
|
interface TextClientInstanceAuthorization {
|
|
438
463
|
token?: string;
|
|
439
464
|
tokenType?: "Basic" | "Bearer";
|
|
@@ -626,8 +651,9 @@ interface PatDto {
|
|
|
626
651
|
organization_id: string;
|
|
627
652
|
personal_token_id: string;
|
|
628
653
|
scope: string;
|
|
654
|
+
personal_token?: string;
|
|
629
655
|
}
|
|
630
|
-
interface
|
|
656
|
+
interface PatWithSecretDto extends PatDto {
|
|
631
657
|
personal_token: string;
|
|
632
658
|
}
|
|
633
659
|
|
|
@@ -637,6 +663,20 @@ interface ScopeDto {
|
|
|
637
663
|
beta?: boolean;
|
|
638
664
|
}
|
|
639
665
|
|
|
666
|
+
interface OrganizationDto {
|
|
667
|
+
organization_id: string;
|
|
668
|
+
name?: string;
|
|
669
|
+
invitation_mode?: "lax" | "strict";
|
|
670
|
+
company?: {
|
|
671
|
+
phone: string;
|
|
672
|
+
website: string;
|
|
673
|
+
};
|
|
674
|
+
products: {
|
|
675
|
+
product: string;
|
|
676
|
+
client_id: string;
|
|
677
|
+
}[];
|
|
678
|
+
}
|
|
679
|
+
|
|
640
680
|
interface PlatformAccountsClientInstanceAuthorization {
|
|
641
681
|
token?: string;
|
|
642
682
|
}
|
|
@@ -652,6 +692,77 @@ declare function getPlatformAccountsClientAuthorization(req: {
|
|
|
652
692
|
declare function getPlatformAccountsClientConfig(options?: PlatformAccountsClientInstanceOptions): AxiosRequestConfig;
|
|
653
693
|
declare function initPlatformAccountsClientInstance(baseUrl?: string, token?: string): void;
|
|
654
694
|
|
|
695
|
+
interface BillingAccountDto {
|
|
696
|
+
account_code: string;
|
|
697
|
+
state: string;
|
|
698
|
+
username: string;
|
|
699
|
+
email: string;
|
|
700
|
+
first_name: string;
|
|
701
|
+
last_name: string;
|
|
702
|
+
company_name: string;
|
|
703
|
+
vat_number: string;
|
|
704
|
+
tax_exempt: boolean;
|
|
705
|
+
accept_language: string;
|
|
706
|
+
address: {
|
|
707
|
+
first_name: string;
|
|
708
|
+
last_name: string;
|
|
709
|
+
phone: string;
|
|
710
|
+
city: string;
|
|
711
|
+
country: string;
|
|
712
|
+
state: string;
|
|
713
|
+
zip: string;
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
interface BillingAccountInfoDto {
|
|
718
|
+
first_name: string;
|
|
719
|
+
last_name: string;
|
|
720
|
+
company: string;
|
|
721
|
+
address1: string;
|
|
722
|
+
address2: string;
|
|
723
|
+
city: string;
|
|
724
|
+
state: string;
|
|
725
|
+
zip: string;
|
|
726
|
+
country: string;
|
|
727
|
+
phone: string;
|
|
728
|
+
vat_number: string;
|
|
729
|
+
ip_address: string;
|
|
730
|
+
ip_address_country: string;
|
|
731
|
+
card_type: string;
|
|
732
|
+
year: number;
|
|
733
|
+
month: number;
|
|
734
|
+
first_six: string;
|
|
735
|
+
last_four: string;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
interface BillingInvoiceDto {
|
|
739
|
+
number: number;
|
|
740
|
+
state: string;
|
|
741
|
+
created_at: string;
|
|
742
|
+
total_cents: number;
|
|
743
|
+
currency: string;
|
|
744
|
+
items: {
|
|
745
|
+
description: string;
|
|
746
|
+
unit_amount_cents: number;
|
|
747
|
+
quantity: number;
|
|
748
|
+
total_amount_cents: number;
|
|
749
|
+
origin: string;
|
|
750
|
+
}[];
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
interface PlatformBillingClientInstanceAuthorization {
|
|
754
|
+
token?: string;
|
|
755
|
+
}
|
|
756
|
+
interface PlatformBillingClientInstanceOptions {
|
|
757
|
+
token?: string;
|
|
758
|
+
}
|
|
759
|
+
declare const platformBillingClientInstance: axios.AxiosInstance;
|
|
760
|
+
declare function getPlatformBillingClientAuthorization(req: {
|
|
761
|
+
headers: Record<string, string | string[] | undefined>;
|
|
762
|
+
}): PlatformBillingClientInstanceAuthorization;
|
|
763
|
+
declare function getPlatformBillingClientConfig(options?: PlatformBillingClientInstanceOptions): AxiosRequestConfig;
|
|
764
|
+
declare function initPlatformBillingClientInstance(baseUrl?: string, token?: string): void;
|
|
765
|
+
|
|
655
766
|
interface CreateAppPayload {
|
|
656
767
|
data: {
|
|
657
768
|
app: CreateApplicationPayload;
|
|
@@ -1853,9 +1964,13 @@ declare const api: {
|
|
|
1853
1964
|
};
|
|
1854
1965
|
pat: {
|
|
1855
1966
|
readonly getPersonalAccessTokens: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<PatDto[]>;
|
|
1856
|
-
readonly createPersonalAccessToken: (name: string, scopes: PatScopeDto[], authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<
|
|
1967
|
+
readonly createPersonalAccessToken: (name: string, scopes: PatScopeDto[], authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<PatWithSecretDto>;
|
|
1857
1968
|
readonly deletePersonalAccessToken: (id: string, authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<void>;
|
|
1858
1969
|
};
|
|
1970
|
+
organization: {
|
|
1971
|
+
readonly getOrganizations: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<OrganizationDto[]>;
|
|
1972
|
+
readonly getMyOrganization: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<OrganizationDto>>;
|
|
1973
|
+
};
|
|
1859
1974
|
products: {
|
|
1860
1975
|
readonly getOrganizationProducts: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<ProductDto[]>;
|
|
1861
1976
|
readonly updateOrganizationProducts: (payload: {
|
|
@@ -1869,6 +1984,18 @@ declare const api: {
|
|
|
1869
1984
|
readonly deleteSessions: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<void>>;
|
|
1870
1985
|
};
|
|
1871
1986
|
};
|
|
1987
|
+
billing: {
|
|
1988
|
+
account: {
|
|
1989
|
+
readonly getAccount: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<BillingAccountDto>>;
|
|
1990
|
+
readonly getAccountInfo: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<BillingAccountInfoDto>>;
|
|
1991
|
+
};
|
|
1992
|
+
invoices: {
|
|
1993
|
+
readonly getInvoices: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<{
|
|
1994
|
+
result: BillingInvoiceDto[];
|
|
1995
|
+
}>>;
|
|
1996
|
+
readonly downloadInvoices: (number: number, authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<void>;
|
|
1997
|
+
};
|
|
1998
|
+
};
|
|
1872
1999
|
adapter: {
|
|
1873
2000
|
app: {
|
|
1874
2001
|
blocks: {
|
|
@@ -2320,6 +2447,12 @@ declare const api: {
|
|
|
2320
2447
|
};
|
|
2321
2448
|
};
|
|
2322
2449
|
};
|
|
2450
|
+
platform: {
|
|
2451
|
+
dashboard: {
|
|
2452
|
+
getReport(params: GetTextPlatformDashboardReportParams, authorization?: TextClientInstanceAuthorization | undefined): Promise<TextPlatformDashboardReportDto>;
|
|
2453
|
+
getCredits(authorization?: TextClientInstanceAuthorization | undefined): Promise<TextPlatformDashboardCreditsDto>;
|
|
2454
|
+
};
|
|
2455
|
+
};
|
|
2323
2456
|
};
|
|
2324
2457
|
};
|
|
2325
2458
|
isInitialized: boolean;
|
|
@@ -2328,6 +2461,7 @@ declare function initApi(config: {
|
|
|
2328
2461
|
urls: {
|
|
2329
2462
|
platform?: {
|
|
2330
2463
|
accounts?: string;
|
|
2464
|
+
billing?: string;
|
|
2331
2465
|
adapter?: string;
|
|
2332
2466
|
dps?: string;
|
|
2333
2467
|
};
|
|
@@ -2389,4 +2523,4 @@ declare const serializerBase64: {
|
|
|
2389
2523
|
deserialize<T_1>(message?: string): T_1 | undefined;
|
|
2390
2524
|
};
|
|
2391
2525
|
|
|
2392
|
-
export { API_NOTIFICATIONS, AccountDto, AddAppAuthorizationData, AddAppAuthorizationPayload, AddAppAuthorizationResult, AgentDto, ApiError, AppDeployment, AppDeploymentBlock, AppDeploymentMode, AppDeploymentProvider, AppGitHubRepository, AppGitHubRepositoryConfig, AppGitLabRepository, AppInfrastructureBlocks, AppLoggerBlock, AppLoggerProvider, AppMonitoringCustomReport, AppMonitoringCustomReportDataDto, AppMonitoringEvent, AppMonitoringEventData, AppMonitoringEventsLog, AppMonitoringEventsLogItem, AppMonitoringEventsReportDto, AppMonitoringReportParams, AppMonitoringUptimeReportDto, AppNetlifyDeployment, AppNetlifyDeploymentConfig, AppPlanetScaleStorage, AppPlanetScaleStorageConfig, AppRepository, AppRepositoryBlock, AppRepositoryProvider, AppRepositoryTarget, AppResourceDto, AppSentryLogger, AppSentryLoggerConfig, AppStorage, AppStorageBlock, AppStorageProvider, AppVariable, AppVariableExternalProvider, AppVariableLocalProvider, AppVariableProvider, AppVariableStatus, AppVariableType, AppVercelDeployment, AppVercelDeploymentConfig, AppVercelStorage, AppVercelStorageConfig, ApplicationAutoReviewDto, ApplicationAutoReviewPayload, ApplicationBasicDetailsDto, ApplicationBenefitDto, ApplicationDto, ApplicationFeatureDto, ApplicationIconDto, ApplicationOverviewDto, ApplicationPaymentDto, ApplicationPropertyDto, ApplicationScreenshotDto, ApplicationTutorialAndSupportDto, ApplicationUsageOptionsDto, AuthorizeData, Category, ClientDto, ClientInfoDto, ClientScopeDto, ClientWithSecretDto, CreateAppOutput, CreateAppPayload, CreateAppResult, CreateAppStatus, CreateAppStepStatus, CreateApplicationAuthorizationPayload, CreateApplicationChatActionPayload, CreateApplicationPayload, CreateApplicationResponse, CreateApplicationSubmissionPayload, CreateClientPayload, CreateDeveloperMessagePayload,
|
|
2526
|
+
export { API_NOTIFICATIONS, AccountDto, AddAppAuthorizationData, AddAppAuthorizationPayload, AddAppAuthorizationResult, AgentDto, ApiError, AppDeployment, AppDeploymentBlock, AppDeploymentMode, AppDeploymentProvider, AppGitHubRepository, AppGitHubRepositoryConfig, AppGitLabRepository, AppInfrastructureBlocks, AppLoggerBlock, AppLoggerProvider, AppMonitoringCustomReport, AppMonitoringCustomReportDataDto, AppMonitoringEvent, AppMonitoringEventData, AppMonitoringEventsLog, AppMonitoringEventsLogItem, AppMonitoringEventsReportDto, AppMonitoringReportParams, AppMonitoringUptimeReportDto, AppNetlifyDeployment, AppNetlifyDeploymentConfig, AppPlanetScaleStorage, AppPlanetScaleStorageConfig, AppRepository, AppRepositoryBlock, AppRepositoryProvider, AppRepositoryTarget, AppResourceDto, AppSentryLogger, AppSentryLoggerConfig, AppStorage, AppStorageBlock, AppStorageProvider, AppVariable, AppVariableExternalProvider, AppVariableLocalProvider, AppVariableProvider, AppVariableStatus, AppVariableType, AppVercelDeployment, AppVercelDeploymentConfig, AppVercelStorage, AppVercelStorageConfig, ApplicationAutoReviewDto, ApplicationAutoReviewPayload, ApplicationBasicDetailsDto, ApplicationBenefitDto, ApplicationDto, ApplicationFeatureDto, ApplicationIconDto, ApplicationOverviewDto, ApplicationPaymentDto, ApplicationPropertyDto, ApplicationScreenshotDto, ApplicationTutorialAndSupportDto, ApplicationUsageOptionsDto, AuthorizeData, BillingAccountDto, BillingAccountInfoDto, BillingInvoiceDto, Category, ClientDto, ClientInfoDto, ClientScopeDto, ClientWithSecretDto, CreateAppOutput, CreateAppPayload, CreateAppResult, CreateAppStatus, CreateAppStepStatus, CreateApplicationAuthorizationPayload, CreateApplicationChatActionPayload, CreateApplicationPayload, CreateApplicationResponse, CreateApplicationSubmissionPayload, CreateClientPayload, CreateDeveloperMessagePayload, DeveloperLedgerParams, DeveloperMessage, DeveloperMessageBaseDto, DeveloperMessageDto, GetAppMonitoringCustomReportDataPayload, GetAppMonitoringEventsLogPayload, GetAppMonitoringEventsLogResponse, GetAppMonitoringEventsReportPayload, GetAppMonitoringUptimeReportPayload, GetPlanetScaleDatabasePasswordsResult, GetPlanetScaleDatabasesResult, GetPlanetScaleOrganizationsResult, GetTextPlatformDashboardReportParams, GetVercelProjectsResult, GitHubInstallation, GitHubRepository, GitHubRepositoryBranch, GitHubRepositoryHook, GitHubRepositoryKey, GitHubRepositorySeed, GithubClientInstanceAuthorization, GithubClientRequestOptions, LinkAppDeploymentData, LinkAppDeploymentNetlifyData, LinkAppDeploymentNetlifySiteData, LinkAppDeploymentPayload, LinkAppDeploymentResult, LinkAppDeploymentVercelData, LinkAppDeploymentVercelProjectData, LinkAppRepositoryData, LinkAppRepositoryGitHubData, LinkAppRepositoryGitLabData, LinkAppRepositoryPayload, LinkAppRepositoryResult, LinkAppSentryLoggerPayload, LinkAppStorageData, LinkAppStoragePayload, LinkAppStoragePlanetScaleData, LinkAppStoragePlanetScaleDatabaseData, LinkAppStorageVercelData, LiveChatClientInstanceAuthorization, LiveChatClientInstanceOptions, MyAccountDto, NetlifyAccount, NetlifyClientInstanceAuthorization, NetlifyClientInstanceOptions, NetlifyDeploy, NetlifyDeployKey, NetlifyEnv, NetlifySite, OrganizationDto, PatDto, PatScopeDto, PatWithSecretDto, PlanetScaleClientInstanceAuthorization, PlanetScaleClientInstanceOptions, PlanetScaleDatabase, PlanetScaleDatabasePassword, PlanetScaleOrganization, PlanetScalePaginatedResult, PlanetScalePagination, PlanetScaleUser, PlatformAccountsClientInstanceAuthorization, PlatformAccountsClientInstanceOptions, PlatformAdapterClientInstanceAuthorization, PlatformAdapterClientInstanceOptions, PlatformBillingClientInstanceAuthorization, PlatformBillingClientInstanceOptions, PlatformDpsClientInstanceAuthorization, PlatformDpsClientInstanceOptions, ProductDto, PropertiesDto, Property, PropertyAccessDto, PropertyAccessItemDto, PropertyDto, ResearchCustomerItemDto, ResearchCustomerLocationItemDto, ResearchDictionaryParams, ResearchMarketplaceItemDto, ResearchMarketplaceParams, ResearchTrafficItemDto, ResearchTrafficParams, ScopeDto, SeedAppRepositoryPayload, SeedAppRepositoryResult, SentryClientInstanceAuthorization, SentryClientInstanceOptions, SentryIntegration, SentryOrganization, SentryProject, SentryProjectIssue, SentryProjectIssueEvent, SentryProjectKey, SentryRepository, SentryTeam, ShortcutDto, SyncAppVariablePayload, TextClientInstanceAuthorization, TextClientInstanceOptions, TextPlatformDashboardCreditsDto, TextPlatformDashboardReportDto, TextPlatformDashboardReportItemDto, UnauthorizeApiError, UnauthorizeApiErrorSource, UnlinkAppDeploymentPayload, UnlinkAppRepositoryPayload, UnlinkAppSentryLoggerPayload, UnlinkAppStoragePayload, UpdateAppInfrastructureBlocksPayload, UpdateApplicationChangelogPayload, UpdateApplicationChatActionPayload, UpdateApplicationDirectInstallUrlPayload, UpdateApplicationIconPayload, UpdateApplicationOnboardingPayload, UpdateApplicationProductPayload, UpdateApplicationWebhookPayload, UpdateApplicationWidgetDto, UpdateChatWebhookPayload, UpdateClientPayload, UpdateUserFeatures, UpdateUserIntegrations, UpsertAppResourcePayload, UpsertApplicationChatBoosterPayload, UserDto, UserGitHubIntegrationDto, UserIntegrationsDto, UserNetlifyIntegrationDto, UserPlanetScaleIntegrationDto, UserSentryIntegrationDto, UserVercelIntegrationDto, VercelClientInstanceAuthorization, VercelClientInstanceOptions, VercelDeploy, VercelNamespace, VercelPaginatedResult, VercelPagination, VercelProject, VercelProjectEnv, VercelRepository, VercelSearchRepositoryResponse, Webhook, WebhookDto, api, getAppAutoReviewPayload, getEmptyAppAutoReview, getGitHubClientAuthorization, getGithubClientRequestConfig, getLiveChatClientAuthorization, getLiveChatClientConfig, getNetlifyClientAuthorization, getNetlifyClientConfig, getPlanetScaleClientAuthorization, getPlanetScaleClientConfig, getPlatformAccountsClientAuthorization, getPlatformAccountsClientConfig, getPlatformAdapterClientAuthorization, getPlatformAdapterClientConfig, getPlatformBillingClientAuthorization, getPlatformBillingClientConfig, getPlatformDpsAdminClientAuthorization, getPlatformDpsClientAuthorization, getPlatformDpsClientConfig, getRegion, getSentryClientAuthorization, getSentryClientConfig, getTextClientAuthorization, getTextClientConfig, getVercelClientAuthorization, getVercelClientConfig, githubClientInstance, initApi, initGithubClientInstance, initLiveChatClientInstance, initNetlifyClientInstance, initPlanetScaleClientInstance, initPlatformAccountsClientInstance, initPlatformAdapterClientInstance, initPlatformBillingClientInstance, initPlatformDpsClientInstance, initSentryClientInstance, initTextClientInstance, initVercelClientInstance, livechatClientInstance, netlifyClientInstance, planetScaleClientInstance, platformAccountsClientInstance, platformAdapterClientInstance, platformBillingClientInstance, platformDpsClientInstance, sentryClientInstance, serializerBase64, textClientInstance, updateGithubClientInstance, updateNetlifyClientInstance, updatePlanetScaleClientInstance, updatePlatformAdapterClientInstance, updateSentryClientInstance, updateVercelClientInstance, vercelClientInstance };
|
package/dist/index.d.ts
CHANGED
|
@@ -434,6 +434,31 @@ interface GetAppMonitoringEventsLogResponse {
|
|
|
434
434
|
next_page_from?: string;
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
+
interface TextPlatformDashboardReportItemDto {
|
|
438
|
+
usage: number;
|
|
439
|
+
amount: number;
|
|
440
|
+
client_id: string;
|
|
441
|
+
api_type: string;
|
|
442
|
+
method: string;
|
|
443
|
+
}
|
|
444
|
+
type TextPlatformDashboardReportDto = Record<string, TextPlatformDashboardReportItemDto[]>;
|
|
445
|
+
|
|
446
|
+
interface TextPlatformDashboardCreditsDto {
|
|
447
|
+
available_amount: number;
|
|
448
|
+
used_amount: number;
|
|
449
|
+
left_amount: number;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
interface GetTextPlatformDashboardReportParams {
|
|
453
|
+
from: string;
|
|
454
|
+
to: string;
|
|
455
|
+
service?: "agent-api" | "customer-api" | "configuration-api" | "lc-webhooks" | "reports-api";
|
|
456
|
+
action?: string;
|
|
457
|
+
source?: string;
|
|
458
|
+
time_distribution: "hour" | "day";
|
|
459
|
+
group_by?: "source" | "service" | "action";
|
|
460
|
+
}
|
|
461
|
+
|
|
437
462
|
interface TextClientInstanceAuthorization {
|
|
438
463
|
token?: string;
|
|
439
464
|
tokenType?: "Basic" | "Bearer";
|
|
@@ -626,8 +651,9 @@ interface PatDto {
|
|
|
626
651
|
organization_id: string;
|
|
627
652
|
personal_token_id: string;
|
|
628
653
|
scope: string;
|
|
654
|
+
personal_token?: string;
|
|
629
655
|
}
|
|
630
|
-
interface
|
|
656
|
+
interface PatWithSecretDto extends PatDto {
|
|
631
657
|
personal_token: string;
|
|
632
658
|
}
|
|
633
659
|
|
|
@@ -637,6 +663,20 @@ interface ScopeDto {
|
|
|
637
663
|
beta?: boolean;
|
|
638
664
|
}
|
|
639
665
|
|
|
666
|
+
interface OrganizationDto {
|
|
667
|
+
organization_id: string;
|
|
668
|
+
name?: string;
|
|
669
|
+
invitation_mode?: "lax" | "strict";
|
|
670
|
+
company?: {
|
|
671
|
+
phone: string;
|
|
672
|
+
website: string;
|
|
673
|
+
};
|
|
674
|
+
products: {
|
|
675
|
+
product: string;
|
|
676
|
+
client_id: string;
|
|
677
|
+
}[];
|
|
678
|
+
}
|
|
679
|
+
|
|
640
680
|
interface PlatformAccountsClientInstanceAuthorization {
|
|
641
681
|
token?: string;
|
|
642
682
|
}
|
|
@@ -652,6 +692,77 @@ declare function getPlatformAccountsClientAuthorization(req: {
|
|
|
652
692
|
declare function getPlatformAccountsClientConfig(options?: PlatformAccountsClientInstanceOptions): AxiosRequestConfig;
|
|
653
693
|
declare function initPlatformAccountsClientInstance(baseUrl?: string, token?: string): void;
|
|
654
694
|
|
|
695
|
+
interface BillingAccountDto {
|
|
696
|
+
account_code: string;
|
|
697
|
+
state: string;
|
|
698
|
+
username: string;
|
|
699
|
+
email: string;
|
|
700
|
+
first_name: string;
|
|
701
|
+
last_name: string;
|
|
702
|
+
company_name: string;
|
|
703
|
+
vat_number: string;
|
|
704
|
+
tax_exempt: boolean;
|
|
705
|
+
accept_language: string;
|
|
706
|
+
address: {
|
|
707
|
+
first_name: string;
|
|
708
|
+
last_name: string;
|
|
709
|
+
phone: string;
|
|
710
|
+
city: string;
|
|
711
|
+
country: string;
|
|
712
|
+
state: string;
|
|
713
|
+
zip: string;
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
interface BillingAccountInfoDto {
|
|
718
|
+
first_name: string;
|
|
719
|
+
last_name: string;
|
|
720
|
+
company: string;
|
|
721
|
+
address1: string;
|
|
722
|
+
address2: string;
|
|
723
|
+
city: string;
|
|
724
|
+
state: string;
|
|
725
|
+
zip: string;
|
|
726
|
+
country: string;
|
|
727
|
+
phone: string;
|
|
728
|
+
vat_number: string;
|
|
729
|
+
ip_address: string;
|
|
730
|
+
ip_address_country: string;
|
|
731
|
+
card_type: string;
|
|
732
|
+
year: number;
|
|
733
|
+
month: number;
|
|
734
|
+
first_six: string;
|
|
735
|
+
last_four: string;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
interface BillingInvoiceDto {
|
|
739
|
+
number: number;
|
|
740
|
+
state: string;
|
|
741
|
+
created_at: string;
|
|
742
|
+
total_cents: number;
|
|
743
|
+
currency: string;
|
|
744
|
+
items: {
|
|
745
|
+
description: string;
|
|
746
|
+
unit_amount_cents: number;
|
|
747
|
+
quantity: number;
|
|
748
|
+
total_amount_cents: number;
|
|
749
|
+
origin: string;
|
|
750
|
+
}[];
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
interface PlatformBillingClientInstanceAuthorization {
|
|
754
|
+
token?: string;
|
|
755
|
+
}
|
|
756
|
+
interface PlatformBillingClientInstanceOptions {
|
|
757
|
+
token?: string;
|
|
758
|
+
}
|
|
759
|
+
declare const platformBillingClientInstance: axios.AxiosInstance;
|
|
760
|
+
declare function getPlatformBillingClientAuthorization(req: {
|
|
761
|
+
headers: Record<string, string | string[] | undefined>;
|
|
762
|
+
}): PlatformBillingClientInstanceAuthorization;
|
|
763
|
+
declare function getPlatformBillingClientConfig(options?: PlatformBillingClientInstanceOptions): AxiosRequestConfig;
|
|
764
|
+
declare function initPlatformBillingClientInstance(baseUrl?: string, token?: string): void;
|
|
765
|
+
|
|
655
766
|
interface CreateAppPayload {
|
|
656
767
|
data: {
|
|
657
768
|
app: CreateApplicationPayload;
|
|
@@ -1853,9 +1964,13 @@ declare const api: {
|
|
|
1853
1964
|
};
|
|
1854
1965
|
pat: {
|
|
1855
1966
|
readonly getPersonalAccessTokens: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<PatDto[]>;
|
|
1856
|
-
readonly createPersonalAccessToken: (name: string, scopes: PatScopeDto[], authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<
|
|
1967
|
+
readonly createPersonalAccessToken: (name: string, scopes: PatScopeDto[], authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<PatWithSecretDto>;
|
|
1857
1968
|
readonly deletePersonalAccessToken: (id: string, authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<void>;
|
|
1858
1969
|
};
|
|
1970
|
+
organization: {
|
|
1971
|
+
readonly getOrganizations: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<OrganizationDto[]>;
|
|
1972
|
+
readonly getMyOrganization: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<OrganizationDto>>;
|
|
1973
|
+
};
|
|
1859
1974
|
products: {
|
|
1860
1975
|
readonly getOrganizationProducts: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<ProductDto[]>;
|
|
1861
1976
|
readonly updateOrganizationProducts: (payload: {
|
|
@@ -1869,6 +1984,18 @@ declare const api: {
|
|
|
1869
1984
|
readonly deleteSessions: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<void>>;
|
|
1870
1985
|
};
|
|
1871
1986
|
};
|
|
1987
|
+
billing: {
|
|
1988
|
+
account: {
|
|
1989
|
+
readonly getAccount: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<BillingAccountDto>>;
|
|
1990
|
+
readonly getAccountInfo: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<BillingAccountInfoDto>>;
|
|
1991
|
+
};
|
|
1992
|
+
invoices: {
|
|
1993
|
+
readonly getInvoices: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<{
|
|
1994
|
+
result: BillingInvoiceDto[];
|
|
1995
|
+
}>>;
|
|
1996
|
+
readonly downloadInvoices: (number: number, authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<void>;
|
|
1997
|
+
};
|
|
1998
|
+
};
|
|
1872
1999
|
adapter: {
|
|
1873
2000
|
app: {
|
|
1874
2001
|
blocks: {
|
|
@@ -2320,6 +2447,12 @@ declare const api: {
|
|
|
2320
2447
|
};
|
|
2321
2448
|
};
|
|
2322
2449
|
};
|
|
2450
|
+
platform: {
|
|
2451
|
+
dashboard: {
|
|
2452
|
+
getReport(params: GetTextPlatformDashboardReportParams, authorization?: TextClientInstanceAuthorization | undefined): Promise<TextPlatformDashboardReportDto>;
|
|
2453
|
+
getCredits(authorization?: TextClientInstanceAuthorization | undefined): Promise<TextPlatformDashboardCreditsDto>;
|
|
2454
|
+
};
|
|
2455
|
+
};
|
|
2323
2456
|
};
|
|
2324
2457
|
};
|
|
2325
2458
|
isInitialized: boolean;
|
|
@@ -2328,6 +2461,7 @@ declare function initApi(config: {
|
|
|
2328
2461
|
urls: {
|
|
2329
2462
|
platform?: {
|
|
2330
2463
|
accounts?: string;
|
|
2464
|
+
billing?: string;
|
|
2331
2465
|
adapter?: string;
|
|
2332
2466
|
dps?: string;
|
|
2333
2467
|
};
|
|
@@ -2389,4 +2523,4 @@ declare const serializerBase64: {
|
|
|
2389
2523
|
deserialize<T_1>(message?: string): T_1 | undefined;
|
|
2390
2524
|
};
|
|
2391
2525
|
|
|
2392
|
-
export { API_NOTIFICATIONS, AccountDto, AddAppAuthorizationData, AddAppAuthorizationPayload, AddAppAuthorizationResult, AgentDto, ApiError, AppDeployment, AppDeploymentBlock, AppDeploymentMode, AppDeploymentProvider, AppGitHubRepository, AppGitHubRepositoryConfig, AppGitLabRepository, AppInfrastructureBlocks, AppLoggerBlock, AppLoggerProvider, AppMonitoringCustomReport, AppMonitoringCustomReportDataDto, AppMonitoringEvent, AppMonitoringEventData, AppMonitoringEventsLog, AppMonitoringEventsLogItem, AppMonitoringEventsReportDto, AppMonitoringReportParams, AppMonitoringUptimeReportDto, AppNetlifyDeployment, AppNetlifyDeploymentConfig, AppPlanetScaleStorage, AppPlanetScaleStorageConfig, AppRepository, AppRepositoryBlock, AppRepositoryProvider, AppRepositoryTarget, AppResourceDto, AppSentryLogger, AppSentryLoggerConfig, AppStorage, AppStorageBlock, AppStorageProvider, AppVariable, AppVariableExternalProvider, AppVariableLocalProvider, AppVariableProvider, AppVariableStatus, AppVariableType, AppVercelDeployment, AppVercelDeploymentConfig, AppVercelStorage, AppVercelStorageConfig, ApplicationAutoReviewDto, ApplicationAutoReviewPayload, ApplicationBasicDetailsDto, ApplicationBenefitDto, ApplicationDto, ApplicationFeatureDto, ApplicationIconDto, ApplicationOverviewDto, ApplicationPaymentDto, ApplicationPropertyDto, ApplicationScreenshotDto, ApplicationTutorialAndSupportDto, ApplicationUsageOptionsDto, AuthorizeData, Category, ClientDto, ClientInfoDto, ClientScopeDto, ClientWithSecretDto, CreateAppOutput, CreateAppPayload, CreateAppResult, CreateAppStatus, CreateAppStepStatus, CreateApplicationAuthorizationPayload, CreateApplicationChatActionPayload, CreateApplicationPayload, CreateApplicationResponse, CreateApplicationSubmissionPayload, CreateClientPayload, CreateDeveloperMessagePayload,
|
|
2526
|
+
export { API_NOTIFICATIONS, AccountDto, AddAppAuthorizationData, AddAppAuthorizationPayload, AddAppAuthorizationResult, AgentDto, ApiError, AppDeployment, AppDeploymentBlock, AppDeploymentMode, AppDeploymentProvider, AppGitHubRepository, AppGitHubRepositoryConfig, AppGitLabRepository, AppInfrastructureBlocks, AppLoggerBlock, AppLoggerProvider, AppMonitoringCustomReport, AppMonitoringCustomReportDataDto, AppMonitoringEvent, AppMonitoringEventData, AppMonitoringEventsLog, AppMonitoringEventsLogItem, AppMonitoringEventsReportDto, AppMonitoringReportParams, AppMonitoringUptimeReportDto, AppNetlifyDeployment, AppNetlifyDeploymentConfig, AppPlanetScaleStorage, AppPlanetScaleStorageConfig, AppRepository, AppRepositoryBlock, AppRepositoryProvider, AppRepositoryTarget, AppResourceDto, AppSentryLogger, AppSentryLoggerConfig, AppStorage, AppStorageBlock, AppStorageProvider, AppVariable, AppVariableExternalProvider, AppVariableLocalProvider, AppVariableProvider, AppVariableStatus, AppVariableType, AppVercelDeployment, AppVercelDeploymentConfig, AppVercelStorage, AppVercelStorageConfig, ApplicationAutoReviewDto, ApplicationAutoReviewPayload, ApplicationBasicDetailsDto, ApplicationBenefitDto, ApplicationDto, ApplicationFeatureDto, ApplicationIconDto, ApplicationOverviewDto, ApplicationPaymentDto, ApplicationPropertyDto, ApplicationScreenshotDto, ApplicationTutorialAndSupportDto, ApplicationUsageOptionsDto, AuthorizeData, BillingAccountDto, BillingAccountInfoDto, BillingInvoiceDto, Category, ClientDto, ClientInfoDto, ClientScopeDto, ClientWithSecretDto, CreateAppOutput, CreateAppPayload, CreateAppResult, CreateAppStatus, CreateAppStepStatus, CreateApplicationAuthorizationPayload, CreateApplicationChatActionPayload, CreateApplicationPayload, CreateApplicationResponse, CreateApplicationSubmissionPayload, CreateClientPayload, CreateDeveloperMessagePayload, DeveloperLedgerParams, DeveloperMessage, DeveloperMessageBaseDto, DeveloperMessageDto, GetAppMonitoringCustomReportDataPayload, GetAppMonitoringEventsLogPayload, GetAppMonitoringEventsLogResponse, GetAppMonitoringEventsReportPayload, GetAppMonitoringUptimeReportPayload, GetPlanetScaleDatabasePasswordsResult, GetPlanetScaleDatabasesResult, GetPlanetScaleOrganizationsResult, GetTextPlatformDashboardReportParams, GetVercelProjectsResult, GitHubInstallation, GitHubRepository, GitHubRepositoryBranch, GitHubRepositoryHook, GitHubRepositoryKey, GitHubRepositorySeed, GithubClientInstanceAuthorization, GithubClientRequestOptions, LinkAppDeploymentData, LinkAppDeploymentNetlifyData, LinkAppDeploymentNetlifySiteData, LinkAppDeploymentPayload, LinkAppDeploymentResult, LinkAppDeploymentVercelData, LinkAppDeploymentVercelProjectData, LinkAppRepositoryData, LinkAppRepositoryGitHubData, LinkAppRepositoryGitLabData, LinkAppRepositoryPayload, LinkAppRepositoryResult, LinkAppSentryLoggerPayload, LinkAppStorageData, LinkAppStoragePayload, LinkAppStoragePlanetScaleData, LinkAppStoragePlanetScaleDatabaseData, LinkAppStorageVercelData, LiveChatClientInstanceAuthorization, LiveChatClientInstanceOptions, MyAccountDto, NetlifyAccount, NetlifyClientInstanceAuthorization, NetlifyClientInstanceOptions, NetlifyDeploy, NetlifyDeployKey, NetlifyEnv, NetlifySite, OrganizationDto, PatDto, PatScopeDto, PatWithSecretDto, PlanetScaleClientInstanceAuthorization, PlanetScaleClientInstanceOptions, PlanetScaleDatabase, PlanetScaleDatabasePassword, PlanetScaleOrganization, PlanetScalePaginatedResult, PlanetScalePagination, PlanetScaleUser, PlatformAccountsClientInstanceAuthorization, PlatformAccountsClientInstanceOptions, PlatformAdapterClientInstanceAuthorization, PlatformAdapterClientInstanceOptions, PlatformBillingClientInstanceAuthorization, PlatformBillingClientInstanceOptions, PlatformDpsClientInstanceAuthorization, PlatformDpsClientInstanceOptions, ProductDto, PropertiesDto, Property, PropertyAccessDto, PropertyAccessItemDto, PropertyDto, ResearchCustomerItemDto, ResearchCustomerLocationItemDto, ResearchDictionaryParams, ResearchMarketplaceItemDto, ResearchMarketplaceParams, ResearchTrafficItemDto, ResearchTrafficParams, ScopeDto, SeedAppRepositoryPayload, SeedAppRepositoryResult, SentryClientInstanceAuthorization, SentryClientInstanceOptions, SentryIntegration, SentryOrganization, SentryProject, SentryProjectIssue, SentryProjectIssueEvent, SentryProjectKey, SentryRepository, SentryTeam, ShortcutDto, SyncAppVariablePayload, TextClientInstanceAuthorization, TextClientInstanceOptions, TextPlatformDashboardCreditsDto, TextPlatformDashboardReportDto, TextPlatformDashboardReportItemDto, UnauthorizeApiError, UnauthorizeApiErrorSource, UnlinkAppDeploymentPayload, UnlinkAppRepositoryPayload, UnlinkAppSentryLoggerPayload, UnlinkAppStoragePayload, UpdateAppInfrastructureBlocksPayload, UpdateApplicationChangelogPayload, UpdateApplicationChatActionPayload, UpdateApplicationDirectInstallUrlPayload, UpdateApplicationIconPayload, UpdateApplicationOnboardingPayload, UpdateApplicationProductPayload, UpdateApplicationWebhookPayload, UpdateApplicationWidgetDto, UpdateChatWebhookPayload, UpdateClientPayload, UpdateUserFeatures, UpdateUserIntegrations, UpsertAppResourcePayload, UpsertApplicationChatBoosterPayload, UserDto, UserGitHubIntegrationDto, UserIntegrationsDto, UserNetlifyIntegrationDto, UserPlanetScaleIntegrationDto, UserSentryIntegrationDto, UserVercelIntegrationDto, VercelClientInstanceAuthorization, VercelClientInstanceOptions, VercelDeploy, VercelNamespace, VercelPaginatedResult, VercelPagination, VercelProject, VercelProjectEnv, VercelRepository, VercelSearchRepositoryResponse, Webhook, WebhookDto, api, getAppAutoReviewPayload, getEmptyAppAutoReview, getGitHubClientAuthorization, getGithubClientRequestConfig, getLiveChatClientAuthorization, getLiveChatClientConfig, getNetlifyClientAuthorization, getNetlifyClientConfig, getPlanetScaleClientAuthorization, getPlanetScaleClientConfig, getPlatformAccountsClientAuthorization, getPlatformAccountsClientConfig, getPlatformAdapterClientAuthorization, getPlatformAdapterClientConfig, getPlatformBillingClientAuthorization, getPlatformBillingClientConfig, getPlatformDpsAdminClientAuthorization, getPlatformDpsClientAuthorization, getPlatformDpsClientConfig, getRegion, getSentryClientAuthorization, getSentryClientConfig, getTextClientAuthorization, getTextClientConfig, getVercelClientAuthorization, getVercelClientConfig, githubClientInstance, initApi, initGithubClientInstance, initLiveChatClientInstance, initNetlifyClientInstance, initPlanetScaleClientInstance, initPlatformAccountsClientInstance, initPlatformAdapterClientInstance, initPlatformBillingClientInstance, initPlatformDpsClientInstance, initSentryClientInstance, initTextClientInstance, initVercelClientInstance, livechatClientInstance, netlifyClientInstance, planetScaleClientInstance, platformAccountsClientInstance, platformAdapterClientInstance, platformBillingClientInstance, platformDpsClientInstance, sentryClientInstance, serializerBase64, textClientInstance, updateGithubClientInstance, updateNetlifyClientInstance, updatePlanetScaleClientInstance, updatePlatformAdapterClientInstance, updateSentryClientInstance, updateVercelClientInstance, vercelClientInstance };
|
package/dist/index.js
CHANGED
|
@@ -84,6 +84,8 @@ __export(src_exports, {
|
|
|
84
84
|
getPlatformAccountsClientConfig: () => getPlatformAccountsClientConfig,
|
|
85
85
|
getPlatformAdapterClientAuthorization: () => getPlatformAdapterClientAuthorization,
|
|
86
86
|
getPlatformAdapterClientConfig: () => getPlatformAdapterClientConfig,
|
|
87
|
+
getPlatformBillingClientAuthorization: () => getPlatformBillingClientAuthorization,
|
|
88
|
+
getPlatformBillingClientConfig: () => getPlatformBillingClientConfig,
|
|
87
89
|
getPlatformDpsAdminClientAuthorization: () => getPlatformDpsAdminClientAuthorization,
|
|
88
90
|
getPlatformDpsClientAuthorization: () => getPlatformDpsClientAuthorization,
|
|
89
91
|
getPlatformDpsClientConfig: () => getPlatformDpsClientConfig,
|
|
@@ -102,6 +104,7 @@ __export(src_exports, {
|
|
|
102
104
|
initPlanetScaleClientInstance: () => initPlanetScaleClientInstance,
|
|
103
105
|
initPlatformAccountsClientInstance: () => initPlatformAccountsClientInstance,
|
|
104
106
|
initPlatformAdapterClientInstance: () => initPlatformAdapterClientInstance,
|
|
107
|
+
initPlatformBillingClientInstance: () => initPlatformBillingClientInstance,
|
|
105
108
|
initPlatformDpsClientInstance: () => initPlatformDpsClientInstance,
|
|
106
109
|
initSentryClientInstance: () => initSentryClientInstance,
|
|
107
110
|
initTextClientInstance: () => initTextClientInstance,
|
|
@@ -111,6 +114,7 @@ __export(src_exports, {
|
|
|
111
114
|
planetScaleClientInstance: () => planetScaleClientInstance,
|
|
112
115
|
platformAccountsClientInstance: () => platformAccountsClientInstance,
|
|
113
116
|
platformAdapterClientInstance: () => platformAdapterClientInstance,
|
|
117
|
+
platformBillingClientInstance: () => platformBillingClientInstance,
|
|
114
118
|
platformDpsClientInstance: () => platformDpsClientInstance,
|
|
115
119
|
sentryClientInstance: () => sentryClientInstance,
|
|
116
120
|
serializerBase64: () => serializerBase64,
|
|
@@ -2038,9 +2042,56 @@ var textAppApi = {
|
|
|
2038
2042
|
monitoring: textAppMonitoringApi
|
|
2039
2043
|
};
|
|
2040
2044
|
|
|
2045
|
+
// src/apis/integrations/text/platform/dashboard/api.ts
|
|
2046
|
+
var textPlatformDashboardApi = {
|
|
2047
|
+
getReport(params, authorization) {
|
|
2048
|
+
return __async(this, null, function* () {
|
|
2049
|
+
try {
|
|
2050
|
+
const searchParams = new URLSearchParams(
|
|
2051
|
+
Object.fromEntries(
|
|
2052
|
+
Object.entries(params).filter(([, value]) => value !== void 0)
|
|
2053
|
+
)
|
|
2054
|
+
);
|
|
2055
|
+
const response = yield textClientInstance.get(
|
|
2056
|
+
`/platform_dashboard/report?${searchParams.toString()}`,
|
|
2057
|
+
getTextClientConfig(authorization)
|
|
2058
|
+
);
|
|
2059
|
+
return response.data;
|
|
2060
|
+
} catch (error) {
|
|
2061
|
+
if (error instanceof Error) {
|
|
2062
|
+
throw new Error(`Couldn't load report. [${error.message}]`);
|
|
2063
|
+
}
|
|
2064
|
+
throw error;
|
|
2065
|
+
}
|
|
2066
|
+
});
|
|
2067
|
+
},
|
|
2068
|
+
getCredits(authorization) {
|
|
2069
|
+
return __async(this, null, function* () {
|
|
2070
|
+
try {
|
|
2071
|
+
const response = yield textClientInstance.get(
|
|
2072
|
+
`/platform_dashboard/credits`,
|
|
2073
|
+
getTextClientConfig(authorization)
|
|
2074
|
+
);
|
|
2075
|
+
return response.data;
|
|
2076
|
+
} catch (error) {
|
|
2077
|
+
if (error instanceof Error) {
|
|
2078
|
+
throw new Error(`Couldn't load credits. [${error.message}]`);
|
|
2079
|
+
}
|
|
2080
|
+
throw error;
|
|
2081
|
+
}
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
|
|
2086
|
+
// src/apis/integrations/text/platform/api.ts
|
|
2087
|
+
var textPlatformApi = {
|
|
2088
|
+
dashboard: textPlatformDashboardApi
|
|
2089
|
+
};
|
|
2090
|
+
|
|
2041
2091
|
// src/apis/integrations/text/api.ts
|
|
2042
2092
|
var textApi = {
|
|
2043
|
-
app: textAppApi
|
|
2093
|
+
app: textAppApi,
|
|
2094
|
+
platform: textPlatformApi
|
|
2044
2095
|
};
|
|
2045
2096
|
|
|
2046
2097
|
// src/apis/integrations/vercel/api.ts
|
|
@@ -2853,7 +2904,7 @@ var productsApi = {
|
|
|
2853
2904
|
// src/apis/platform/accounts/instance.ts
|
|
2854
2905
|
var import_axios11 = __toESM(require("axios"));
|
|
2855
2906
|
var platformAccountsClientInstance = import_axios11.default.create({
|
|
2856
|
-
baseURL: "https://accounts.labs.
|
|
2907
|
+
baseURL: "https://accounts.labs.livechat.com"
|
|
2857
2908
|
});
|
|
2858
2909
|
function getPlatformAccountsClientAuthorization(req) {
|
|
2859
2910
|
return {
|
|
@@ -3081,13 +3132,50 @@ var platformAccountsClientApi = {
|
|
|
3081
3132
|
}
|
|
3082
3133
|
};
|
|
3083
3134
|
|
|
3135
|
+
// src/apis/platform/accounts/organization/api.ts
|
|
3136
|
+
var platformAccountsOrganizationApi = {
|
|
3137
|
+
getOrganizations(authorization) {
|
|
3138
|
+
return __async(this, null, function* () {
|
|
3139
|
+
try {
|
|
3140
|
+
const response = yield platformAccountsClientInstance.get(`/v2/organizations`, getPlatformAccountsClientConfig(authorization));
|
|
3141
|
+
return response.data || [];
|
|
3142
|
+
} catch (error) {
|
|
3143
|
+
if (error instanceof Error) {
|
|
3144
|
+
throw new Error(
|
|
3145
|
+
`Organizations couldn't be fetched. [${error.message}]`
|
|
3146
|
+
);
|
|
3147
|
+
} else {
|
|
3148
|
+
throw error;
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
});
|
|
3152
|
+
},
|
|
3153
|
+
getMyOrganization(authorization) {
|
|
3154
|
+
return __async(this, null, function* () {
|
|
3155
|
+
try {
|
|
3156
|
+
return yield platformAccountsClientInstance.get(
|
|
3157
|
+
`/v2/organizations/my`,
|
|
3158
|
+
getPlatformAccountsClientConfig(authorization)
|
|
3159
|
+
);
|
|
3160
|
+
} catch (error) {
|
|
3161
|
+
if (error instanceof Error) {
|
|
3162
|
+
throw new Error(`Organization couldn't be fetched. [${error.message}]`);
|
|
3163
|
+
} else {
|
|
3164
|
+
throw error;
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
});
|
|
3168
|
+
}
|
|
3169
|
+
};
|
|
3170
|
+
|
|
3084
3171
|
// src/apis/platform/accounts/pat/api.ts
|
|
3085
3172
|
var platformAccountsPersonalAccessTokenApi = {
|
|
3086
3173
|
getPersonalAccessTokens(authorization) {
|
|
3087
3174
|
return __async(this, null, function* () {
|
|
3088
3175
|
try {
|
|
3089
3176
|
const response = yield platformAccountsClientInstance.get(
|
|
3090
|
-
`/v2/personal_token
|
|
3177
|
+
`/v2/personal_token`,
|
|
3178
|
+
__spreadValues({}, getPlatformAccountsClientConfig(authorization))
|
|
3091
3179
|
);
|
|
3092
3180
|
return response.data;
|
|
3093
3181
|
} catch (error) {
|
|
@@ -3109,7 +3197,8 @@ var platformAccountsPersonalAccessTokenApi = {
|
|
|
3109
3197
|
{
|
|
3110
3198
|
name,
|
|
3111
3199
|
scope: scopes && scopes.map((item) => item.name).filter((el) => el).join(",")
|
|
3112
|
-
}
|
|
3200
|
+
},
|
|
3201
|
+
getPlatformAccountsClientConfig(authorization)
|
|
3113
3202
|
);
|
|
3114
3203
|
return response.data;
|
|
3115
3204
|
} catch (error) {
|
|
@@ -3126,11 +3215,10 @@ var platformAccountsPersonalAccessTokenApi = {
|
|
|
3126
3215
|
deletePersonalAccessToken(id, authorization) {
|
|
3127
3216
|
return __async(this, null, function* () {
|
|
3128
3217
|
try {
|
|
3129
|
-
|
|
3218
|
+
yield platformAccountsClientInstance.delete(
|
|
3130
3219
|
`/v2/personal_token/${id}`,
|
|
3131
3220
|
getPlatformAccountsClientConfig(authorization)
|
|
3132
3221
|
);
|
|
3133
|
-
return response.data;
|
|
3134
3222
|
} catch (error) {
|
|
3135
3223
|
if (error instanceof Error) {
|
|
3136
3224
|
throw new Error(
|
|
@@ -3229,6 +3317,7 @@ var platformAccountsApi = {
|
|
|
3229
3317
|
account: platformAccountsAccountApi,
|
|
3230
3318
|
client: platformAccountsClientApi,
|
|
3231
3319
|
pat: platformAccountsPersonalAccessTokenApi,
|
|
3320
|
+
organization: platformAccountsOrganizationApi,
|
|
3232
3321
|
products: platformAccountsProductsApi,
|
|
3233
3322
|
scopes: platformAccountsScopesApi,
|
|
3234
3323
|
sessions: platformAccountsSessionsApi
|
|
@@ -5287,9 +5376,135 @@ var platformAdapterApi = {
|
|
|
5287
5376
|
app: platformAdapterAppApi
|
|
5288
5377
|
};
|
|
5289
5378
|
|
|
5379
|
+
// src/apis/platform/billing/instance.ts
|
|
5380
|
+
var import_axios14 = __toESM(require("axios"));
|
|
5381
|
+
var platformBillingClientInstance = import_axios14.default.create({
|
|
5382
|
+
baseURL: "https://billing.labs.livechatinc.com"
|
|
5383
|
+
});
|
|
5384
|
+
function getPlatformBillingClientAuthorization(req) {
|
|
5385
|
+
return {
|
|
5386
|
+
token: req.headers["platform-token"]
|
|
5387
|
+
};
|
|
5388
|
+
}
|
|
5389
|
+
function getPlatformBillingClientConfig(options = {}) {
|
|
5390
|
+
const defaultAuthorization = platformBillingClientInstance.defaults.headers.Authorization;
|
|
5391
|
+
const headers = {
|
|
5392
|
+
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
5393
|
+
};
|
|
5394
|
+
return {
|
|
5395
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
5396
|
+
};
|
|
5397
|
+
}
|
|
5398
|
+
function initPlatformBillingClientInstance(baseUrl, token) {
|
|
5399
|
+
if (baseUrl) {
|
|
5400
|
+
platformBillingClientInstance.interceptors.request.use(
|
|
5401
|
+
(config) => __async(this, null, function* () {
|
|
5402
|
+
config.baseURL = baseUrl;
|
|
5403
|
+
return config;
|
|
5404
|
+
}),
|
|
5405
|
+
(error) => Promise.reject(error)
|
|
5406
|
+
);
|
|
5407
|
+
}
|
|
5408
|
+
if (token) {
|
|
5409
|
+
platformBillingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
|
|
5410
|
+
} else {
|
|
5411
|
+
delete platformBillingClientInstance.defaults.headers.Authorization;
|
|
5412
|
+
}
|
|
5413
|
+
}
|
|
5414
|
+
|
|
5415
|
+
// src/apis/platform/billing/account/api.ts
|
|
5416
|
+
var platformBillingAccountApi = {
|
|
5417
|
+
getAccount(authorization) {
|
|
5418
|
+
return __async(this, null, function* () {
|
|
5419
|
+
try {
|
|
5420
|
+
return yield platformBillingClientInstance.get(
|
|
5421
|
+
`/v1/account`,
|
|
5422
|
+
getPlatformBillingClientConfig(authorization)
|
|
5423
|
+
);
|
|
5424
|
+
} catch (error) {
|
|
5425
|
+
if (error instanceof Error) {
|
|
5426
|
+
throw new Error(`Account couldn't be fetched. [${error.message}]`);
|
|
5427
|
+
} else {
|
|
5428
|
+
throw error;
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
});
|
|
5432
|
+
},
|
|
5433
|
+
getAccountInfo(authorization) {
|
|
5434
|
+
return __async(this, null, function* () {
|
|
5435
|
+
try {
|
|
5436
|
+
return yield platformBillingClientInstance.get(
|
|
5437
|
+
`/v1/account/billing_info`,
|
|
5438
|
+
getPlatformBillingClientConfig(authorization)
|
|
5439
|
+
);
|
|
5440
|
+
} catch (error) {
|
|
5441
|
+
if (error instanceof Error) {
|
|
5442
|
+
throw new Error(
|
|
5443
|
+
`Account billing info couldn't be fetched. [${error.message}]`
|
|
5444
|
+
);
|
|
5445
|
+
} else {
|
|
5446
|
+
throw error;
|
|
5447
|
+
}
|
|
5448
|
+
}
|
|
5449
|
+
});
|
|
5450
|
+
}
|
|
5451
|
+
};
|
|
5452
|
+
|
|
5453
|
+
// src/apis/platform/billing/invoices/api.ts
|
|
5454
|
+
var platformBillingInvoicesApi = {
|
|
5455
|
+
getInvoices(authorization) {
|
|
5456
|
+
return __async(this, null, function* () {
|
|
5457
|
+
try {
|
|
5458
|
+
return yield platformBillingClientInstance.get(`/v1/invoices`, getPlatformBillingClientConfig(authorization));
|
|
5459
|
+
} catch (error) {
|
|
5460
|
+
if (error instanceof Error) {
|
|
5461
|
+
throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
|
|
5462
|
+
} else {
|
|
5463
|
+
throw error;
|
|
5464
|
+
}
|
|
5465
|
+
}
|
|
5466
|
+
});
|
|
5467
|
+
},
|
|
5468
|
+
downloadInvoices(number, authorization) {
|
|
5469
|
+
return __async(this, null, function* () {
|
|
5470
|
+
try {
|
|
5471
|
+
const response = yield platformBillingClientInstance.request(__spreadValues({
|
|
5472
|
+
url: `https://api.labs.livechatinc.com/v2/invoices/${number}`,
|
|
5473
|
+
data: new URLSearchParams({
|
|
5474
|
+
_method: "GET"
|
|
5475
|
+
//gave the values directly for testing
|
|
5476
|
+
}),
|
|
5477
|
+
responseType: "blob"
|
|
5478
|
+
}, getPlatformBillingClientConfig(authorization)));
|
|
5479
|
+
const href = URL.createObjectURL(response.data);
|
|
5480
|
+
const link = document.createElement("a");
|
|
5481
|
+
link.href = href;
|
|
5482
|
+
link.setAttribute("download", `invoice-${number}.pdf`);
|
|
5483
|
+
document.body.appendChild(link);
|
|
5484
|
+
link.click();
|
|
5485
|
+
document.body.removeChild(link);
|
|
5486
|
+
URL.revokeObjectURL(href);
|
|
5487
|
+
} catch (error) {
|
|
5488
|
+
if (error instanceof Error) {
|
|
5489
|
+
throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
|
|
5490
|
+
} else {
|
|
5491
|
+
throw error;
|
|
5492
|
+
}
|
|
5493
|
+
}
|
|
5494
|
+
});
|
|
5495
|
+
}
|
|
5496
|
+
};
|
|
5497
|
+
|
|
5498
|
+
// src/apis/platform/billing/api.ts
|
|
5499
|
+
var platformBillingApi = {
|
|
5500
|
+
account: platformBillingAccountApi,
|
|
5501
|
+
invoices: platformBillingInvoicesApi
|
|
5502
|
+
};
|
|
5503
|
+
|
|
5290
5504
|
// src/apis/platform/api.ts
|
|
5291
5505
|
var platformApi = {
|
|
5292
5506
|
accounts: platformAccountsApi,
|
|
5507
|
+
billing: platformBillingApi,
|
|
5293
5508
|
adapter: platformAdapterApi,
|
|
5294
5509
|
dps: platformDpsApi
|
|
5295
5510
|
};
|
|
@@ -5302,41 +5517,45 @@ var api = {
|
|
|
5302
5517
|
isInitialized: false
|
|
5303
5518
|
};
|
|
5304
5519
|
function initApi(config, tokens) {
|
|
5305
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
5520
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
5306
5521
|
initPlatformAccountsClientInstance(
|
|
5307
5522
|
(_a = config.urls.platform) == null ? void 0 : _a.accounts,
|
|
5308
5523
|
(_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.dps
|
|
5309
5524
|
);
|
|
5310
|
-
|
|
5311
|
-
(_c = config.urls.platform) == null ? void 0 : _c.
|
|
5525
|
+
initPlatformBillingClientInstance(
|
|
5526
|
+
(_c = config.urls.platform) == null ? void 0 : _c.billing,
|
|
5312
5527
|
(_d = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _d.dps
|
|
5313
5528
|
);
|
|
5529
|
+
initPlatformDpsClientInstance(
|
|
5530
|
+
(_e = config.urls.platform) == null ? void 0 : _e.dps,
|
|
5531
|
+
(_f = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _f.dps
|
|
5532
|
+
);
|
|
5314
5533
|
initPlatformAdapterClientInstance(
|
|
5315
|
-
(
|
|
5534
|
+
(_g = config.urls.platform) == null ? void 0 : _g.adapter,
|
|
5316
5535
|
tokens ? {
|
|
5317
5536
|
platform: {
|
|
5318
|
-
dps: (
|
|
5537
|
+
dps: (_h = tokens.platform) == null ? void 0 : _h.dps
|
|
5319
5538
|
},
|
|
5320
5539
|
github: {
|
|
5321
|
-
app: (
|
|
5322
|
-
oauth: (
|
|
5540
|
+
app: (_i = tokens.github) == null ? void 0 : _i.apps,
|
|
5541
|
+
oauth: (_j = tokens.github) == null ? void 0 : _j.oauth
|
|
5323
5542
|
},
|
|
5324
|
-
netlify: (
|
|
5325
|
-
vercel: (
|
|
5326
|
-
planetscale: (
|
|
5327
|
-
sentry: (
|
|
5543
|
+
netlify: (_k = tokens.netlify) == null ? void 0 : _k.token,
|
|
5544
|
+
vercel: (_l = tokens.vercel) == null ? void 0 : _l.token,
|
|
5545
|
+
planetscale: (_m = tokens.planetscale) == null ? void 0 : _m.token,
|
|
5546
|
+
sentry: (_n = tokens.sentry) == null ? void 0 : _n.token
|
|
5328
5547
|
} : void 0
|
|
5329
5548
|
);
|
|
5330
5549
|
initLiveChatClientInstance(
|
|
5331
|
-
(
|
|
5332
|
-
(
|
|
5550
|
+
(_o = config.urls.products) == null ? void 0 : _o.livechat,
|
|
5551
|
+
(_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps
|
|
5333
5552
|
);
|
|
5334
|
-
initTextClientInstance((
|
|
5335
|
-
initGithubClientInstance((
|
|
5336
|
-
initNetlifyClientInstance((
|
|
5337
|
-
initVercelClientInstance((
|
|
5338
|
-
initPlanetScaleClientInstance((
|
|
5339
|
-
initSentryClientInstance((
|
|
5553
|
+
initTextClientInstance((_q = config.urls.integrations) == null ? void 0 : _q.text, (_r = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _r.dps);
|
|
5554
|
+
initGithubClientInstance((_s = tokens == null ? void 0 : tokens.github) == null ? void 0 : _s.apps);
|
|
5555
|
+
initNetlifyClientInstance((_t = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _t.token);
|
|
5556
|
+
initVercelClientInstance((_u = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _u.token);
|
|
5557
|
+
initPlanetScaleClientInstance((_v = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _v.token);
|
|
5558
|
+
initSentryClientInstance((_w = tokens == null ? void 0 : tokens.sentry) == null ? void 0 : _w.token);
|
|
5340
5559
|
api.isInitialized = true;
|
|
5341
5560
|
}
|
|
5342
5561
|
|
|
@@ -5371,6 +5590,8 @@ var serializerBase64 = {
|
|
|
5371
5590
|
getPlatformAccountsClientConfig,
|
|
5372
5591
|
getPlatformAdapterClientAuthorization,
|
|
5373
5592
|
getPlatformAdapterClientConfig,
|
|
5593
|
+
getPlatformBillingClientAuthorization,
|
|
5594
|
+
getPlatformBillingClientConfig,
|
|
5374
5595
|
getPlatformDpsAdminClientAuthorization,
|
|
5375
5596
|
getPlatformDpsClientAuthorization,
|
|
5376
5597
|
getPlatformDpsClientConfig,
|
|
@@ -5389,6 +5610,7 @@ var serializerBase64 = {
|
|
|
5389
5610
|
initPlanetScaleClientInstance,
|
|
5390
5611
|
initPlatformAccountsClientInstance,
|
|
5391
5612
|
initPlatformAdapterClientInstance,
|
|
5613
|
+
initPlatformBillingClientInstance,
|
|
5392
5614
|
initPlatformDpsClientInstance,
|
|
5393
5615
|
initSentryClientInstance,
|
|
5394
5616
|
initTextClientInstance,
|
|
@@ -5398,6 +5620,7 @@ var serializerBase64 = {
|
|
|
5398
5620
|
planetScaleClientInstance,
|
|
5399
5621
|
platformAccountsClientInstance,
|
|
5400
5622
|
platformAdapterClientInstance,
|
|
5623
|
+
platformBillingClientInstance,
|
|
5401
5624
|
platformDpsClientInstance,
|
|
5402
5625
|
sentryClientInstance,
|
|
5403
5626
|
serializerBase64,
|
package/dist/index.mjs
CHANGED
|
@@ -1951,9 +1951,56 @@ var textAppApi = {
|
|
|
1951
1951
|
monitoring: textAppMonitoringApi
|
|
1952
1952
|
};
|
|
1953
1953
|
|
|
1954
|
+
// src/apis/integrations/text/platform/dashboard/api.ts
|
|
1955
|
+
var textPlatformDashboardApi = {
|
|
1956
|
+
getReport(params, authorization) {
|
|
1957
|
+
return __async(this, null, function* () {
|
|
1958
|
+
try {
|
|
1959
|
+
const searchParams = new URLSearchParams(
|
|
1960
|
+
Object.fromEntries(
|
|
1961
|
+
Object.entries(params).filter(([, value]) => value !== void 0)
|
|
1962
|
+
)
|
|
1963
|
+
);
|
|
1964
|
+
const response = yield textClientInstance.get(
|
|
1965
|
+
`/platform_dashboard/report?${searchParams.toString()}`,
|
|
1966
|
+
getTextClientConfig(authorization)
|
|
1967
|
+
);
|
|
1968
|
+
return response.data;
|
|
1969
|
+
} catch (error) {
|
|
1970
|
+
if (error instanceof Error) {
|
|
1971
|
+
throw new Error(`Couldn't load report. [${error.message}]`);
|
|
1972
|
+
}
|
|
1973
|
+
throw error;
|
|
1974
|
+
}
|
|
1975
|
+
});
|
|
1976
|
+
},
|
|
1977
|
+
getCredits(authorization) {
|
|
1978
|
+
return __async(this, null, function* () {
|
|
1979
|
+
try {
|
|
1980
|
+
const response = yield textClientInstance.get(
|
|
1981
|
+
`/platform_dashboard/credits`,
|
|
1982
|
+
getTextClientConfig(authorization)
|
|
1983
|
+
);
|
|
1984
|
+
return response.data;
|
|
1985
|
+
} catch (error) {
|
|
1986
|
+
if (error instanceof Error) {
|
|
1987
|
+
throw new Error(`Couldn't load credits. [${error.message}]`);
|
|
1988
|
+
}
|
|
1989
|
+
throw error;
|
|
1990
|
+
}
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
};
|
|
1994
|
+
|
|
1995
|
+
// src/apis/integrations/text/platform/api.ts
|
|
1996
|
+
var textPlatformApi = {
|
|
1997
|
+
dashboard: textPlatformDashboardApi
|
|
1998
|
+
};
|
|
1999
|
+
|
|
1954
2000
|
// src/apis/integrations/text/api.ts
|
|
1955
2001
|
var textApi = {
|
|
1956
|
-
app: textAppApi
|
|
2002
|
+
app: textAppApi,
|
|
2003
|
+
platform: textPlatformApi
|
|
1957
2004
|
};
|
|
1958
2005
|
|
|
1959
2006
|
// src/apis/integrations/vercel/api.ts
|
|
@@ -2766,7 +2813,7 @@ var productsApi = {
|
|
|
2766
2813
|
// src/apis/platform/accounts/instance.ts
|
|
2767
2814
|
import axios11 from "axios";
|
|
2768
2815
|
var platformAccountsClientInstance = axios11.create({
|
|
2769
|
-
baseURL: "https://accounts.labs.
|
|
2816
|
+
baseURL: "https://accounts.labs.livechat.com"
|
|
2770
2817
|
});
|
|
2771
2818
|
function getPlatformAccountsClientAuthorization(req) {
|
|
2772
2819
|
return {
|
|
@@ -2994,13 +3041,50 @@ var platformAccountsClientApi = {
|
|
|
2994
3041
|
}
|
|
2995
3042
|
};
|
|
2996
3043
|
|
|
3044
|
+
// src/apis/platform/accounts/organization/api.ts
|
|
3045
|
+
var platformAccountsOrganizationApi = {
|
|
3046
|
+
getOrganizations(authorization) {
|
|
3047
|
+
return __async(this, null, function* () {
|
|
3048
|
+
try {
|
|
3049
|
+
const response = yield platformAccountsClientInstance.get(`/v2/organizations`, getPlatformAccountsClientConfig(authorization));
|
|
3050
|
+
return response.data || [];
|
|
3051
|
+
} catch (error) {
|
|
3052
|
+
if (error instanceof Error) {
|
|
3053
|
+
throw new Error(
|
|
3054
|
+
`Organizations couldn't be fetched. [${error.message}]`
|
|
3055
|
+
);
|
|
3056
|
+
} else {
|
|
3057
|
+
throw error;
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
});
|
|
3061
|
+
},
|
|
3062
|
+
getMyOrganization(authorization) {
|
|
3063
|
+
return __async(this, null, function* () {
|
|
3064
|
+
try {
|
|
3065
|
+
return yield platformAccountsClientInstance.get(
|
|
3066
|
+
`/v2/organizations/my`,
|
|
3067
|
+
getPlatformAccountsClientConfig(authorization)
|
|
3068
|
+
);
|
|
3069
|
+
} catch (error) {
|
|
3070
|
+
if (error instanceof Error) {
|
|
3071
|
+
throw new Error(`Organization couldn't be fetched. [${error.message}]`);
|
|
3072
|
+
} else {
|
|
3073
|
+
throw error;
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
});
|
|
3077
|
+
}
|
|
3078
|
+
};
|
|
3079
|
+
|
|
2997
3080
|
// src/apis/platform/accounts/pat/api.ts
|
|
2998
3081
|
var platformAccountsPersonalAccessTokenApi = {
|
|
2999
3082
|
getPersonalAccessTokens(authorization) {
|
|
3000
3083
|
return __async(this, null, function* () {
|
|
3001
3084
|
try {
|
|
3002
3085
|
const response = yield platformAccountsClientInstance.get(
|
|
3003
|
-
`/v2/personal_token
|
|
3086
|
+
`/v2/personal_token`,
|
|
3087
|
+
__spreadValues({}, getPlatformAccountsClientConfig(authorization))
|
|
3004
3088
|
);
|
|
3005
3089
|
return response.data;
|
|
3006
3090
|
} catch (error) {
|
|
@@ -3022,7 +3106,8 @@ var platformAccountsPersonalAccessTokenApi = {
|
|
|
3022
3106
|
{
|
|
3023
3107
|
name,
|
|
3024
3108
|
scope: scopes && scopes.map((item) => item.name).filter((el) => el).join(",")
|
|
3025
|
-
}
|
|
3109
|
+
},
|
|
3110
|
+
getPlatformAccountsClientConfig(authorization)
|
|
3026
3111
|
);
|
|
3027
3112
|
return response.data;
|
|
3028
3113
|
} catch (error) {
|
|
@@ -3039,11 +3124,10 @@ var platformAccountsPersonalAccessTokenApi = {
|
|
|
3039
3124
|
deletePersonalAccessToken(id, authorization) {
|
|
3040
3125
|
return __async(this, null, function* () {
|
|
3041
3126
|
try {
|
|
3042
|
-
|
|
3127
|
+
yield platformAccountsClientInstance.delete(
|
|
3043
3128
|
`/v2/personal_token/${id}`,
|
|
3044
3129
|
getPlatformAccountsClientConfig(authorization)
|
|
3045
3130
|
);
|
|
3046
|
-
return response.data;
|
|
3047
3131
|
} catch (error) {
|
|
3048
3132
|
if (error instanceof Error) {
|
|
3049
3133
|
throw new Error(
|
|
@@ -3142,6 +3226,7 @@ var platformAccountsApi = {
|
|
|
3142
3226
|
account: platformAccountsAccountApi,
|
|
3143
3227
|
client: platformAccountsClientApi,
|
|
3144
3228
|
pat: platformAccountsPersonalAccessTokenApi,
|
|
3229
|
+
organization: platformAccountsOrganizationApi,
|
|
3145
3230
|
products: platformAccountsProductsApi,
|
|
3146
3231
|
scopes: platformAccountsScopesApi,
|
|
3147
3232
|
sessions: platformAccountsSessionsApi
|
|
@@ -5200,9 +5285,135 @@ var platformAdapterApi = {
|
|
|
5200
5285
|
app: platformAdapterAppApi
|
|
5201
5286
|
};
|
|
5202
5287
|
|
|
5288
|
+
// src/apis/platform/billing/instance.ts
|
|
5289
|
+
import axios14 from "axios";
|
|
5290
|
+
var platformBillingClientInstance = axios14.create({
|
|
5291
|
+
baseURL: "https://billing.labs.livechatinc.com"
|
|
5292
|
+
});
|
|
5293
|
+
function getPlatformBillingClientAuthorization(req) {
|
|
5294
|
+
return {
|
|
5295
|
+
token: req.headers["platform-token"]
|
|
5296
|
+
};
|
|
5297
|
+
}
|
|
5298
|
+
function getPlatformBillingClientConfig(options = {}) {
|
|
5299
|
+
const defaultAuthorization = platformBillingClientInstance.defaults.headers.Authorization;
|
|
5300
|
+
const headers = {
|
|
5301
|
+
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
5302
|
+
};
|
|
5303
|
+
return {
|
|
5304
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
5305
|
+
};
|
|
5306
|
+
}
|
|
5307
|
+
function initPlatformBillingClientInstance(baseUrl, token) {
|
|
5308
|
+
if (baseUrl) {
|
|
5309
|
+
platformBillingClientInstance.interceptors.request.use(
|
|
5310
|
+
(config) => __async(this, null, function* () {
|
|
5311
|
+
config.baseURL = baseUrl;
|
|
5312
|
+
return config;
|
|
5313
|
+
}),
|
|
5314
|
+
(error) => Promise.reject(error)
|
|
5315
|
+
);
|
|
5316
|
+
}
|
|
5317
|
+
if (token) {
|
|
5318
|
+
platformBillingClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
|
|
5319
|
+
} else {
|
|
5320
|
+
delete platformBillingClientInstance.defaults.headers.Authorization;
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
|
|
5324
|
+
// src/apis/platform/billing/account/api.ts
|
|
5325
|
+
var platformBillingAccountApi = {
|
|
5326
|
+
getAccount(authorization) {
|
|
5327
|
+
return __async(this, null, function* () {
|
|
5328
|
+
try {
|
|
5329
|
+
return yield platformBillingClientInstance.get(
|
|
5330
|
+
`/v1/account`,
|
|
5331
|
+
getPlatformBillingClientConfig(authorization)
|
|
5332
|
+
);
|
|
5333
|
+
} catch (error) {
|
|
5334
|
+
if (error instanceof Error) {
|
|
5335
|
+
throw new Error(`Account couldn't be fetched. [${error.message}]`);
|
|
5336
|
+
} else {
|
|
5337
|
+
throw error;
|
|
5338
|
+
}
|
|
5339
|
+
}
|
|
5340
|
+
});
|
|
5341
|
+
},
|
|
5342
|
+
getAccountInfo(authorization) {
|
|
5343
|
+
return __async(this, null, function* () {
|
|
5344
|
+
try {
|
|
5345
|
+
return yield platformBillingClientInstance.get(
|
|
5346
|
+
`/v1/account/billing_info`,
|
|
5347
|
+
getPlatformBillingClientConfig(authorization)
|
|
5348
|
+
);
|
|
5349
|
+
} catch (error) {
|
|
5350
|
+
if (error instanceof Error) {
|
|
5351
|
+
throw new Error(
|
|
5352
|
+
`Account billing info couldn't be fetched. [${error.message}]`
|
|
5353
|
+
);
|
|
5354
|
+
} else {
|
|
5355
|
+
throw error;
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5358
|
+
});
|
|
5359
|
+
}
|
|
5360
|
+
};
|
|
5361
|
+
|
|
5362
|
+
// src/apis/platform/billing/invoices/api.ts
|
|
5363
|
+
var platformBillingInvoicesApi = {
|
|
5364
|
+
getInvoices(authorization) {
|
|
5365
|
+
return __async(this, null, function* () {
|
|
5366
|
+
try {
|
|
5367
|
+
return yield platformBillingClientInstance.get(`/v1/invoices`, getPlatformBillingClientConfig(authorization));
|
|
5368
|
+
} catch (error) {
|
|
5369
|
+
if (error instanceof Error) {
|
|
5370
|
+
throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
|
|
5371
|
+
} else {
|
|
5372
|
+
throw error;
|
|
5373
|
+
}
|
|
5374
|
+
}
|
|
5375
|
+
});
|
|
5376
|
+
},
|
|
5377
|
+
downloadInvoices(number, authorization) {
|
|
5378
|
+
return __async(this, null, function* () {
|
|
5379
|
+
try {
|
|
5380
|
+
const response = yield platformBillingClientInstance.request(__spreadValues({
|
|
5381
|
+
url: `https://api.labs.livechatinc.com/v2/invoices/${number}`,
|
|
5382
|
+
data: new URLSearchParams({
|
|
5383
|
+
_method: "GET"
|
|
5384
|
+
//gave the values directly for testing
|
|
5385
|
+
}),
|
|
5386
|
+
responseType: "blob"
|
|
5387
|
+
}, getPlatformBillingClientConfig(authorization)));
|
|
5388
|
+
const href = URL.createObjectURL(response.data);
|
|
5389
|
+
const link = document.createElement("a");
|
|
5390
|
+
link.href = href;
|
|
5391
|
+
link.setAttribute("download", `invoice-${number}.pdf`);
|
|
5392
|
+
document.body.appendChild(link);
|
|
5393
|
+
link.click();
|
|
5394
|
+
document.body.removeChild(link);
|
|
5395
|
+
URL.revokeObjectURL(href);
|
|
5396
|
+
} catch (error) {
|
|
5397
|
+
if (error instanceof Error) {
|
|
5398
|
+
throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
|
|
5399
|
+
} else {
|
|
5400
|
+
throw error;
|
|
5401
|
+
}
|
|
5402
|
+
}
|
|
5403
|
+
});
|
|
5404
|
+
}
|
|
5405
|
+
};
|
|
5406
|
+
|
|
5407
|
+
// src/apis/platform/billing/api.ts
|
|
5408
|
+
var platformBillingApi = {
|
|
5409
|
+
account: platformBillingAccountApi,
|
|
5410
|
+
invoices: platformBillingInvoicesApi
|
|
5411
|
+
};
|
|
5412
|
+
|
|
5203
5413
|
// src/apis/platform/api.ts
|
|
5204
5414
|
var platformApi = {
|
|
5205
5415
|
accounts: platformAccountsApi,
|
|
5416
|
+
billing: platformBillingApi,
|
|
5206
5417
|
adapter: platformAdapterApi,
|
|
5207
5418
|
dps: platformDpsApi
|
|
5208
5419
|
};
|
|
@@ -5215,41 +5426,45 @@ var api = {
|
|
|
5215
5426
|
isInitialized: false
|
|
5216
5427
|
};
|
|
5217
5428
|
function initApi(config, tokens) {
|
|
5218
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
5429
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
5219
5430
|
initPlatformAccountsClientInstance(
|
|
5220
5431
|
(_a = config.urls.platform) == null ? void 0 : _a.accounts,
|
|
5221
5432
|
(_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.dps
|
|
5222
5433
|
);
|
|
5223
|
-
|
|
5224
|
-
(_c = config.urls.platform) == null ? void 0 : _c.
|
|
5434
|
+
initPlatformBillingClientInstance(
|
|
5435
|
+
(_c = config.urls.platform) == null ? void 0 : _c.billing,
|
|
5225
5436
|
(_d = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _d.dps
|
|
5226
5437
|
);
|
|
5438
|
+
initPlatformDpsClientInstance(
|
|
5439
|
+
(_e = config.urls.platform) == null ? void 0 : _e.dps,
|
|
5440
|
+
(_f = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _f.dps
|
|
5441
|
+
);
|
|
5227
5442
|
initPlatformAdapterClientInstance(
|
|
5228
|
-
(
|
|
5443
|
+
(_g = config.urls.platform) == null ? void 0 : _g.adapter,
|
|
5229
5444
|
tokens ? {
|
|
5230
5445
|
platform: {
|
|
5231
|
-
dps: (
|
|
5446
|
+
dps: (_h = tokens.platform) == null ? void 0 : _h.dps
|
|
5232
5447
|
},
|
|
5233
5448
|
github: {
|
|
5234
|
-
app: (
|
|
5235
|
-
oauth: (
|
|
5449
|
+
app: (_i = tokens.github) == null ? void 0 : _i.apps,
|
|
5450
|
+
oauth: (_j = tokens.github) == null ? void 0 : _j.oauth
|
|
5236
5451
|
},
|
|
5237
|
-
netlify: (
|
|
5238
|
-
vercel: (
|
|
5239
|
-
planetscale: (
|
|
5240
|
-
sentry: (
|
|
5452
|
+
netlify: (_k = tokens.netlify) == null ? void 0 : _k.token,
|
|
5453
|
+
vercel: (_l = tokens.vercel) == null ? void 0 : _l.token,
|
|
5454
|
+
planetscale: (_m = tokens.planetscale) == null ? void 0 : _m.token,
|
|
5455
|
+
sentry: (_n = tokens.sentry) == null ? void 0 : _n.token
|
|
5241
5456
|
} : void 0
|
|
5242
5457
|
);
|
|
5243
5458
|
initLiveChatClientInstance(
|
|
5244
|
-
(
|
|
5245
|
-
(
|
|
5459
|
+
(_o = config.urls.products) == null ? void 0 : _o.livechat,
|
|
5460
|
+
(_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps
|
|
5246
5461
|
);
|
|
5247
|
-
initTextClientInstance((
|
|
5248
|
-
initGithubClientInstance((
|
|
5249
|
-
initNetlifyClientInstance((
|
|
5250
|
-
initVercelClientInstance((
|
|
5251
|
-
initPlanetScaleClientInstance((
|
|
5252
|
-
initSentryClientInstance((
|
|
5462
|
+
initTextClientInstance((_q = config.urls.integrations) == null ? void 0 : _q.text, (_r = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _r.dps);
|
|
5463
|
+
initGithubClientInstance((_s = tokens == null ? void 0 : tokens.github) == null ? void 0 : _s.apps);
|
|
5464
|
+
initNetlifyClientInstance((_t = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _t.token);
|
|
5465
|
+
initVercelClientInstance((_u = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _u.token);
|
|
5466
|
+
initPlanetScaleClientInstance((_v = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _v.token);
|
|
5467
|
+
initSentryClientInstance((_w = tokens == null ? void 0 : tokens.sentry) == null ? void 0 : _w.token);
|
|
5253
5468
|
api.isInitialized = true;
|
|
5254
5469
|
}
|
|
5255
5470
|
|
|
@@ -5283,6 +5498,8 @@ export {
|
|
|
5283
5498
|
getPlatformAccountsClientConfig,
|
|
5284
5499
|
getPlatformAdapterClientAuthorization,
|
|
5285
5500
|
getPlatformAdapterClientConfig,
|
|
5501
|
+
getPlatformBillingClientAuthorization,
|
|
5502
|
+
getPlatformBillingClientConfig,
|
|
5286
5503
|
getPlatformDpsAdminClientAuthorization,
|
|
5287
5504
|
getPlatformDpsClientAuthorization,
|
|
5288
5505
|
getPlatformDpsClientConfig,
|
|
@@ -5301,6 +5518,7 @@ export {
|
|
|
5301
5518
|
initPlanetScaleClientInstance,
|
|
5302
5519
|
initPlatformAccountsClientInstance,
|
|
5303
5520
|
initPlatformAdapterClientInstance,
|
|
5521
|
+
initPlatformBillingClientInstance,
|
|
5304
5522
|
initPlatformDpsClientInstance,
|
|
5305
5523
|
initSentryClientInstance,
|
|
5306
5524
|
initTextClientInstance,
|
|
@@ -5310,6 +5528,7 @@ export {
|
|
|
5310
5528
|
planetScaleClientInstance,
|
|
5311
5529
|
platformAccountsClientInstance,
|
|
5312
5530
|
platformAdapterClientInstance,
|
|
5531
|
+
platformBillingClientInstance,
|
|
5313
5532
|
platformDpsClientInstance,
|
|
5314
5533
|
sentryClientInstance,
|
|
5315
5534
|
serializerBase64,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livechat/developer-studio-api",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "This project is API for LiveChat Developer Studio.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"@types/node": "^17.0.12",
|
|
18
18
|
"tsup": "^7.1.0",
|
|
19
19
|
"typescript": "^5.1.6",
|
|
20
|
+
"tsconfig": "0.0.1",
|
|
20
21
|
"config": "0.0.1",
|
|
21
|
-
"eslint-config-custom": "0.0.2"
|
|
22
|
-
"tsconfig": "0.0.1"
|
|
22
|
+
"eslint-config-custom": "0.0.2"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|