@livechat/developer-studio-api 2.3.2 → 2.3.3

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 CHANGED
@@ -434,6 +434,25 @@ 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 GetTextPlatformDashboardReportParams {
447
+ from: string;
448
+ to: string;
449
+ service?: "agent-api" | "customer-api" | "configuration-api" | "lc-webhooks" | "reports-api";
450
+ action?: string;
451
+ source?: string;
452
+ time_distribution: "hour" | "day";
453
+ group_by?: "source" | "service" | "action";
454
+ }
455
+
437
456
  interface TextClientInstanceAuthorization {
438
457
  token?: string;
439
458
  tokenType?: "Basic" | "Bearer";
@@ -626,8 +645,9 @@ interface PatDto {
626
645
  organization_id: string;
627
646
  personal_token_id: string;
628
647
  scope: string;
648
+ personal_token?: string;
629
649
  }
630
- interface CreatePatPayload extends PatDto {
650
+ interface PatWithSecretDto extends PatDto {
631
651
  personal_token: string;
632
652
  }
633
653
 
@@ -637,6 +657,20 @@ interface ScopeDto {
637
657
  beta?: boolean;
638
658
  }
639
659
 
660
+ interface OrganizationDto {
661
+ organization_id: string;
662
+ name?: string;
663
+ invitation_mode?: "lax" | "strict";
664
+ company?: {
665
+ phone: string;
666
+ website: string;
667
+ };
668
+ products: {
669
+ product: string;
670
+ client_id: string;
671
+ }[];
672
+ }
673
+
640
674
  interface PlatformAccountsClientInstanceAuthorization {
641
675
  token?: string;
642
676
  }
@@ -652,6 +686,77 @@ declare function getPlatformAccountsClientAuthorization(req: {
652
686
  declare function getPlatformAccountsClientConfig(options?: PlatformAccountsClientInstanceOptions): AxiosRequestConfig;
653
687
  declare function initPlatformAccountsClientInstance(baseUrl?: string, token?: string): void;
654
688
 
689
+ interface BillingAccountDto {
690
+ account_code: string;
691
+ state: string;
692
+ username: string;
693
+ email: string;
694
+ first_name: string;
695
+ last_name: string;
696
+ company_name: string;
697
+ vat_number: string;
698
+ tax_exempt: boolean;
699
+ accept_language: string;
700
+ address: {
701
+ first_name: string;
702
+ last_name: string;
703
+ phone: string;
704
+ city: string;
705
+ country: string;
706
+ state: string;
707
+ zip: string;
708
+ };
709
+ }
710
+
711
+ interface BillingAccountInfoDto {
712
+ first_name: string;
713
+ last_name: string;
714
+ company: string;
715
+ address1: string;
716
+ address2: string;
717
+ city: string;
718
+ state: string;
719
+ zip: string;
720
+ country: string;
721
+ phone: string;
722
+ vat_number: string;
723
+ ip_address: string;
724
+ ip_address_country: string;
725
+ card_type: string;
726
+ year: number;
727
+ month: number;
728
+ first_six: string;
729
+ last_four: string;
730
+ }
731
+
732
+ interface BillingInvoiceDto {
733
+ number: number;
734
+ state: string;
735
+ created_at: string;
736
+ total_cents: number;
737
+ currency: string;
738
+ items: {
739
+ description: string;
740
+ unit_amount_cents: number;
741
+ quantity: number;
742
+ total_amount_cents: number;
743
+ origin: string;
744
+ }[];
745
+ }
746
+
747
+ interface PlatformBillingClientInstanceAuthorization {
748
+ token?: string;
749
+ }
750
+ interface PlatformBillingClientInstanceOptions {
751
+ token?: string;
752
+ }
753
+ declare const platformBillingClientInstance: axios.AxiosInstance;
754
+ declare function getPlatformBillingClientAuthorization(req: {
755
+ headers: Record<string, string | string[] | undefined>;
756
+ }): PlatformBillingClientInstanceAuthorization;
757
+ declare function getPlatformBillingClientConfig(options?: PlatformBillingClientInstanceOptions): AxiosRequestConfig;
758
+ declare function initPlatformBillingClientInstance(baseUrl?: string, token?: string): void;
759
+
655
760
  interface CreateAppPayload {
656
761
  data: {
657
762
  app: CreateApplicationPayload;
@@ -1853,9 +1958,13 @@ declare const api: {
1853
1958
  };
1854
1959
  pat: {
1855
1960
  readonly getPersonalAccessTokens: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<PatDto[]>;
1856
- readonly createPersonalAccessToken: (name: string, scopes: PatScopeDto[], authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<CreatePatPayload>;
1961
+ readonly createPersonalAccessToken: (name: string, scopes: PatScopeDto[], authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<PatWithSecretDto>;
1857
1962
  readonly deletePersonalAccessToken: (id: string, authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<void>;
1858
1963
  };
1964
+ organization: {
1965
+ readonly getOrganizations: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<OrganizationDto[]>;
1966
+ readonly getMyOrganization: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<OrganizationDto>>;
1967
+ };
1859
1968
  products: {
1860
1969
  readonly getOrganizationProducts: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<ProductDto[]>;
1861
1970
  readonly updateOrganizationProducts: (payload: {
@@ -1869,6 +1978,18 @@ declare const api: {
1869
1978
  readonly deleteSessions: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<void>>;
1870
1979
  };
1871
1980
  };
1981
+ billing: {
1982
+ account: {
1983
+ readonly getAccount: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<BillingAccountDto>>;
1984
+ readonly getAccountInfo: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<BillingAccountInfoDto>>;
1985
+ };
1986
+ invoices: {
1987
+ readonly getInvoices: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<{
1988
+ result: BillingInvoiceDto[];
1989
+ }>>;
1990
+ readonly downloadInvoices: (number: number, authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<void>;
1991
+ };
1992
+ };
1872
1993
  adapter: {
1873
1994
  app: {
1874
1995
  blocks: {
@@ -2320,6 +2441,12 @@ declare const api: {
2320
2441
  };
2321
2442
  };
2322
2443
  };
2444
+ platform: {
2445
+ dashboard: {
2446
+ getReport(params: GetTextPlatformDashboardReportParams, authorization?: TextClientInstanceAuthorization | undefined): Promise<TextPlatformDashboardReportDto>;
2447
+ getCredits(authorization?: TextClientInstanceAuthorization | undefined): Promise<unknown>;
2448
+ };
2449
+ };
2323
2450
  };
2324
2451
  };
2325
2452
  isInitialized: boolean;
@@ -2328,6 +2455,7 @@ declare function initApi(config: {
2328
2455
  urls: {
2329
2456
  platform?: {
2330
2457
  accounts?: string;
2458
+ billing?: string;
2331
2459
  adapter?: string;
2332
2460
  dps?: string;
2333
2461
  };
@@ -2389,4 +2517,4 @@ declare const serializerBase64: {
2389
2517
  deserialize<T_1>(message?: string): T_1 | undefined;
2390
2518
  };
2391
2519
 
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, CreatePatPayload, DeveloperLedgerParams, DeveloperMessage, DeveloperMessageBaseDto, DeveloperMessageDto, GetAppMonitoringCustomReportDataPayload, GetAppMonitoringEventsLogPayload, GetAppMonitoringEventsLogResponse, GetAppMonitoringEventsReportPayload, GetAppMonitoringUptimeReportPayload, GetPlanetScaleDatabasePasswordsResult, GetPlanetScaleDatabasesResult, GetPlanetScaleOrganizationsResult, 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, PatDto, PatScopeDto, PlanetScaleClientInstanceAuthorization, PlanetScaleClientInstanceOptions, PlanetScaleDatabase, PlanetScaleDatabasePassword, PlanetScaleOrganization, PlanetScalePaginatedResult, PlanetScalePagination, PlanetScaleUser, PlatformAccountsClientInstanceAuthorization, PlatformAccountsClientInstanceOptions, PlatformAdapterClientInstanceAuthorization, PlatformAdapterClientInstanceOptions, 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, 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, getPlatformDpsAdminClientAuthorization, getPlatformDpsClientAuthorization, getPlatformDpsClientConfig, getRegion, getSentryClientAuthorization, getSentryClientConfig, getTextClientAuthorization, getTextClientConfig, getVercelClientAuthorization, getVercelClientConfig, githubClientInstance, initApi, initGithubClientInstance, initLiveChatClientInstance, initNetlifyClientInstance, initPlanetScaleClientInstance, initPlatformAccountsClientInstance, initPlatformAdapterClientInstance, initPlatformDpsClientInstance, initSentryClientInstance, initTextClientInstance, initVercelClientInstance, livechatClientInstance, netlifyClientInstance, planetScaleClientInstance, platformAccountsClientInstance, platformAdapterClientInstance, platformDpsClientInstance, sentryClientInstance, serializerBase64, textClientInstance, updateGithubClientInstance, updateNetlifyClientInstance, updatePlanetScaleClientInstance, updatePlatformAdapterClientInstance, updateSentryClientInstance, updateVercelClientInstance, vercelClientInstance };
2520
+ 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, 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,25 @@ 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 GetTextPlatformDashboardReportParams {
447
+ from: string;
448
+ to: string;
449
+ service?: "agent-api" | "customer-api" | "configuration-api" | "lc-webhooks" | "reports-api";
450
+ action?: string;
451
+ source?: string;
452
+ time_distribution: "hour" | "day";
453
+ group_by?: "source" | "service" | "action";
454
+ }
455
+
437
456
  interface TextClientInstanceAuthorization {
438
457
  token?: string;
439
458
  tokenType?: "Basic" | "Bearer";
@@ -626,8 +645,9 @@ interface PatDto {
626
645
  organization_id: string;
627
646
  personal_token_id: string;
628
647
  scope: string;
648
+ personal_token?: string;
629
649
  }
630
- interface CreatePatPayload extends PatDto {
650
+ interface PatWithSecretDto extends PatDto {
631
651
  personal_token: string;
632
652
  }
633
653
 
@@ -637,6 +657,20 @@ interface ScopeDto {
637
657
  beta?: boolean;
638
658
  }
639
659
 
660
+ interface OrganizationDto {
661
+ organization_id: string;
662
+ name?: string;
663
+ invitation_mode?: "lax" | "strict";
664
+ company?: {
665
+ phone: string;
666
+ website: string;
667
+ };
668
+ products: {
669
+ product: string;
670
+ client_id: string;
671
+ }[];
672
+ }
673
+
640
674
  interface PlatformAccountsClientInstanceAuthorization {
641
675
  token?: string;
642
676
  }
@@ -652,6 +686,77 @@ declare function getPlatformAccountsClientAuthorization(req: {
652
686
  declare function getPlatformAccountsClientConfig(options?: PlatformAccountsClientInstanceOptions): AxiosRequestConfig;
653
687
  declare function initPlatformAccountsClientInstance(baseUrl?: string, token?: string): void;
654
688
 
689
+ interface BillingAccountDto {
690
+ account_code: string;
691
+ state: string;
692
+ username: string;
693
+ email: string;
694
+ first_name: string;
695
+ last_name: string;
696
+ company_name: string;
697
+ vat_number: string;
698
+ tax_exempt: boolean;
699
+ accept_language: string;
700
+ address: {
701
+ first_name: string;
702
+ last_name: string;
703
+ phone: string;
704
+ city: string;
705
+ country: string;
706
+ state: string;
707
+ zip: string;
708
+ };
709
+ }
710
+
711
+ interface BillingAccountInfoDto {
712
+ first_name: string;
713
+ last_name: string;
714
+ company: string;
715
+ address1: string;
716
+ address2: string;
717
+ city: string;
718
+ state: string;
719
+ zip: string;
720
+ country: string;
721
+ phone: string;
722
+ vat_number: string;
723
+ ip_address: string;
724
+ ip_address_country: string;
725
+ card_type: string;
726
+ year: number;
727
+ month: number;
728
+ first_six: string;
729
+ last_four: string;
730
+ }
731
+
732
+ interface BillingInvoiceDto {
733
+ number: number;
734
+ state: string;
735
+ created_at: string;
736
+ total_cents: number;
737
+ currency: string;
738
+ items: {
739
+ description: string;
740
+ unit_amount_cents: number;
741
+ quantity: number;
742
+ total_amount_cents: number;
743
+ origin: string;
744
+ }[];
745
+ }
746
+
747
+ interface PlatformBillingClientInstanceAuthorization {
748
+ token?: string;
749
+ }
750
+ interface PlatformBillingClientInstanceOptions {
751
+ token?: string;
752
+ }
753
+ declare const platformBillingClientInstance: axios.AxiosInstance;
754
+ declare function getPlatformBillingClientAuthorization(req: {
755
+ headers: Record<string, string | string[] | undefined>;
756
+ }): PlatformBillingClientInstanceAuthorization;
757
+ declare function getPlatformBillingClientConfig(options?: PlatformBillingClientInstanceOptions): AxiosRequestConfig;
758
+ declare function initPlatformBillingClientInstance(baseUrl?: string, token?: string): void;
759
+
655
760
  interface CreateAppPayload {
656
761
  data: {
657
762
  app: CreateApplicationPayload;
@@ -1853,9 +1958,13 @@ declare const api: {
1853
1958
  };
1854
1959
  pat: {
1855
1960
  readonly getPersonalAccessTokens: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<PatDto[]>;
1856
- readonly createPersonalAccessToken: (name: string, scopes: PatScopeDto[], authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<CreatePatPayload>;
1961
+ readonly createPersonalAccessToken: (name: string, scopes: PatScopeDto[], authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<PatWithSecretDto>;
1857
1962
  readonly deletePersonalAccessToken: (id: string, authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<void>;
1858
1963
  };
1964
+ organization: {
1965
+ readonly getOrganizations: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<OrganizationDto[]>;
1966
+ readonly getMyOrganization: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<OrganizationDto>>;
1967
+ };
1859
1968
  products: {
1860
1969
  readonly getOrganizationProducts: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<ProductDto[]>;
1861
1970
  readonly updateOrganizationProducts: (payload: {
@@ -1869,6 +1978,18 @@ declare const api: {
1869
1978
  readonly deleteSessions: (authorization?: PlatformAccountsClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<void>>;
1870
1979
  };
1871
1980
  };
1981
+ billing: {
1982
+ account: {
1983
+ readonly getAccount: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<BillingAccountDto>>;
1984
+ readonly getAccountInfo: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<BillingAccountInfoDto>>;
1985
+ };
1986
+ invoices: {
1987
+ readonly getInvoices: (authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<axios.AxiosResponse<{
1988
+ result: BillingInvoiceDto[];
1989
+ }>>;
1990
+ readonly downloadInvoices: (number: number, authorization?: PlatformBillingClientInstanceAuthorization | undefined) => Promise<void>;
1991
+ };
1992
+ };
1872
1993
  adapter: {
1873
1994
  app: {
1874
1995
  blocks: {
@@ -2320,6 +2441,12 @@ declare const api: {
2320
2441
  };
2321
2442
  };
2322
2443
  };
2444
+ platform: {
2445
+ dashboard: {
2446
+ getReport(params: GetTextPlatformDashboardReportParams, authorization?: TextClientInstanceAuthorization | undefined): Promise<TextPlatformDashboardReportDto>;
2447
+ getCredits(authorization?: TextClientInstanceAuthorization | undefined): Promise<unknown>;
2448
+ };
2449
+ };
2323
2450
  };
2324
2451
  };
2325
2452
  isInitialized: boolean;
@@ -2328,6 +2455,7 @@ declare function initApi(config: {
2328
2455
  urls: {
2329
2456
  platform?: {
2330
2457
  accounts?: string;
2458
+ billing?: string;
2331
2459
  adapter?: string;
2332
2460
  dps?: string;
2333
2461
  };
@@ -2389,4 +2517,4 @@ declare const serializerBase64: {
2389
2517
  deserialize<T_1>(message?: string): T_1 | undefined;
2390
2518
  };
2391
2519
 
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, CreatePatPayload, DeveloperLedgerParams, DeveloperMessage, DeveloperMessageBaseDto, DeveloperMessageDto, GetAppMonitoringCustomReportDataPayload, GetAppMonitoringEventsLogPayload, GetAppMonitoringEventsLogResponse, GetAppMonitoringEventsReportPayload, GetAppMonitoringUptimeReportPayload, GetPlanetScaleDatabasePasswordsResult, GetPlanetScaleDatabasesResult, GetPlanetScaleOrganizationsResult, 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, PatDto, PatScopeDto, PlanetScaleClientInstanceAuthorization, PlanetScaleClientInstanceOptions, PlanetScaleDatabase, PlanetScaleDatabasePassword, PlanetScaleOrganization, PlanetScalePaginatedResult, PlanetScalePagination, PlanetScaleUser, PlatformAccountsClientInstanceAuthorization, PlatformAccountsClientInstanceOptions, PlatformAdapterClientInstanceAuthorization, PlatformAdapterClientInstanceOptions, 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, 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, getPlatformDpsAdminClientAuthorization, getPlatformDpsClientAuthorization, getPlatformDpsClientConfig, getRegion, getSentryClientAuthorization, getSentryClientConfig, getTextClientAuthorization, getTextClientConfig, getVercelClientAuthorization, getVercelClientConfig, githubClientInstance, initApi, initGithubClientInstance, initLiveChatClientInstance, initNetlifyClientInstance, initPlanetScaleClientInstance, initPlatformAccountsClientInstance, initPlatformAdapterClientInstance, initPlatformDpsClientInstance, initSentryClientInstance, initTextClientInstance, initVercelClientInstance, livechatClientInstance, netlifyClientInstance, planetScaleClientInstance, platformAccountsClientInstance, platformAdapterClientInstance, platformDpsClientInstance, sentryClientInstance, serializerBase64, textClientInstance, updateGithubClientInstance, updateNetlifyClientInstance, updatePlanetScaleClientInstance, updatePlatformAdapterClientInstance, updateSentryClientInstance, updateVercelClientInstance, vercelClientInstance };
2520
+ 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, 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.livechatinc.com"
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
- const response = yield platformAccountsClientInstance.delete(
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
- initPlatformDpsClientInstance(
5311
- (_c = config.urls.platform) == null ? void 0 : _c.dps,
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
- (_e = config.urls.platform) == null ? void 0 : _e.adapter,
5534
+ (_g = config.urls.platform) == null ? void 0 : _g.adapter,
5316
5535
  tokens ? {
5317
5536
  platform: {
5318
- dps: (_f = tokens.platform) == null ? void 0 : _f.dps
5537
+ dps: (_h = tokens.platform) == null ? void 0 : _h.dps
5319
5538
  },
5320
5539
  github: {
5321
- app: (_g = tokens.github) == null ? void 0 : _g.apps,
5322
- oauth: (_h = tokens.github) == null ? void 0 : _h.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: (_i = tokens.netlify) == null ? void 0 : _i.token,
5325
- vercel: (_j = tokens.vercel) == null ? void 0 : _j.token,
5326
- planetscale: (_k = tokens.planetscale) == null ? void 0 : _k.token,
5327
- sentry: (_l = tokens.sentry) == null ? void 0 : _l.token
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
- (_m = config.urls.products) == null ? void 0 : _m.livechat,
5332
- (_n = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _n.dps
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((_o = config.urls.integrations) == null ? void 0 : _o.text, (_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps);
5335
- initGithubClientInstance((_q = tokens == null ? void 0 : tokens.github) == null ? void 0 : _q.apps);
5336
- initNetlifyClientInstance((_r = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _r.token);
5337
- initVercelClientInstance((_s = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _s.token);
5338
- initPlanetScaleClientInstance((_t = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _t.token);
5339
- initSentryClientInstance((_u = tokens == null ? void 0 : tokens.sentry) == null ? void 0 : _u.token);
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.livechatinc.com"
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
- const response = yield platformAccountsClientInstance.delete(
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
- initPlatformDpsClientInstance(
5224
- (_c = config.urls.platform) == null ? void 0 : _c.dps,
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
- (_e = config.urls.platform) == null ? void 0 : _e.adapter,
5443
+ (_g = config.urls.platform) == null ? void 0 : _g.adapter,
5229
5444
  tokens ? {
5230
5445
  platform: {
5231
- dps: (_f = tokens.platform) == null ? void 0 : _f.dps
5446
+ dps: (_h = tokens.platform) == null ? void 0 : _h.dps
5232
5447
  },
5233
5448
  github: {
5234
- app: (_g = tokens.github) == null ? void 0 : _g.apps,
5235
- oauth: (_h = tokens.github) == null ? void 0 : _h.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: (_i = tokens.netlify) == null ? void 0 : _i.token,
5238
- vercel: (_j = tokens.vercel) == null ? void 0 : _j.token,
5239
- planetscale: (_k = tokens.planetscale) == null ? void 0 : _k.token,
5240
- sentry: (_l = tokens.sentry) == null ? void 0 : _l.token
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
- (_m = config.urls.products) == null ? void 0 : _m.livechat,
5245
- (_n = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _n.dps
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((_o = config.urls.integrations) == null ? void 0 : _o.text, (_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps);
5248
- initGithubClientInstance((_q = tokens == null ? void 0 : tokens.github) == null ? void 0 : _q.apps);
5249
- initNetlifyClientInstance((_r = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _r.token);
5250
- initVercelClientInstance((_s = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _s.token);
5251
- initPlanetScaleClientInstance((_t = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _t.token);
5252
- initSentryClientInstance((_u = tokens == null ? void 0 : tokens.sentry) == null ? void 0 : _u.token);
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.2",
3
+ "version": "2.3.3",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",