UNPKG

@experteam-mx/ngx-services

Version:

Angular common services for Experteam apps

1,108 lines (1,097 loc) 89 kB
import * as i0 from '@angular/core'; import { InjectionToken, NgModule, Injectable, Inject, inject } from '@angular/core'; import * as i1 from '@angular/common/http'; import { provideHttpClient, HttpHeaders, HttpResponse, HttpParams } from '@angular/common/http'; import { map, mergeMap, forkJoin, tap, Observable, of } from 'rxjs'; import { map as map$1, tap as tap$1 } from 'rxjs/operators'; import * as i1$1 from 'ngx-cookie-service'; import { CookieService } from 'ngx-cookie-service'; import Pusher from 'pusher-js'; /** * Injection token used to inject environment configurations. * * `ENVIRONMENT_TOKEN` is a dependency injection token that allows * for the provision and retrieval of environment-specific configurations * within the application. This token is typically associated with an * `Environment` type that defines the structure of the configuration. */ const ENVIRONMENT_TOKEN = new InjectionToken('Environments token'); class NgxServicesModule { /** * Returns a module with providers for the NgxServicesModule. * * @param {Environment} environment - The environment configuration object. * * @return {ModuleWithProviders<NgxServicesModule>} The module with providers for the NgxServicesModule. */ static forRoot(environment) { return { ngModule: NgxServicesModule, providers: [ { provide: 'env', useValue: environment } ] }; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxServicesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: NgxServicesModule }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxServicesModule, providers: [provideHttpClient()] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxServicesModule, decorators: [{ type: NgModule, args: [{ providers: [provideHttpClient()] }] }] }); class ApiBillingDOService { environments; http; constructor(environments, http) { this.environments = environments; this.http = http; } /** * Retrieves the URL for the shipments API from the environment configurations. * * @return {string} The URL of the shipments API. */ get url() { return this.environments.apiBillingDO ?? ''; } /** * Retrieves a list of income types * * @return {Observable<ApiSuccess<IncomeTypesOut>>} An observable that emits the income types data. */ getIncomeTypes() { return this.http.get(`${this.url}/income-types`) .pipe(map(({ data }) => data)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiBillingDOService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiBillingDOService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiBillingDOService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: ['env'] }] }, { type: i1.HttpClient }] }); class ApiBillingMxService { environments; http; constructor(environments, http) { this.environments = environments; this.http = http; } /** * Retrieves the URL for the shipments API from the environment configurations. * * @return {string} The URL of the shipments API. */ get url() { return this.environments.apiBillingMX ?? ''; } /** * Fetches the tax regimen data from the server. * * @return {Observable<FiscalRegimensOut>} An observable that emits the fiscal regimen data. */ getFiscalRegimens() { return this.http.get(`${this.url}/fiscal-regimens`) .pipe(map(({ data }) => data)); } /** * Fetches a paginated list of CFDIs (Comprobante Fiscal Digital por Internet) based on the provided fiscal regimen. * * @param {number} fiscalRegimen - The fiscal regimen identifier to filter the CFDIs. * @return {Observable<FiscalRegimensAcceptedOut>} An observable containing the paginated list of CFDIs. */ getFiscalRegimensAccepted(fiscalRegimen) { const params = { 'fiscal-regimen': fiscalRegimen }; return this.http.get(`${this.url}/cfdi-uses/fiscal-regimen-accepted/list`, { params }) .pipe(map(({ data }) => data)); } /** * Fetches and validates postal code data from the server. * * @param {QueryParams} params - Query parameters used to filter the postal code data. * @return {Observable<PostalCodesOut>} - An observable emitting the validated postal code data. */ getPostalCodes(params) { return this.http.get(`${this.url}/postal-codes`, { params }) .pipe(map(({ data }) => data)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiBillingMxService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiBillingMxService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiBillingMxService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: ['env'] }] }, { type: i1.HttpClient }] }); class ApiCashOperationsService { environments; http; constructor(environments, http) { this.environments = environments; this.http = http; } /** * Retrieves the URL for the cash operations API from the environment configurations. * * @return {string} The URL of the cash operations API. */ get url() { return this.environments.apiCashOperationsUrl ?? ''; } /** * Creates a new installation country reference currency. * * @param {InstallationCountryReferenceCurrencyIn} body - The data for the new reference currency. * @returns {Observable<InstallationCountryReferenceCurrencyOut>} The created reference currency. */ postInstallationCountryReferenceCurrency(body) { return this.http.post(`${this.url}/installation-country-reference-currencies`, body).pipe(map(({ data }) => data)); } /** * Updates an existing installation country reference currency. * * @param {number} id - The ID of the reference currency to update. * @param {InstallationCountryReferenceCurrencyIn} body - The updated data for the reference currency. * @returns {Observable<InstallationCountryReferenceCurrencyOut>} The updated reference currency. */ putInstallationCountryReferenceCurrency(id, body) { return this.http.put(`${this.url}/installation-country-reference-currencies/${id}`, body) .pipe(map(({ data }) => data)); } /** * Retrieves a list of installation country reference currencies based on query parameters. * * @param {QueryParams} params - Query parameters for filtering the currencies. * @returns {Observable<InstallationCountryReferenceCurrenciesOut>} The list of reference currencies. */ getInstallationCompanyCountryCurrencies(params) { return this.http.get(`${this.url}/installation-country-reference-currencies`, { params }).pipe(map(({ data }) => data)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCashOperationsService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCashOperationsService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCashOperationsService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: ['env'] }] }, { type: i1.HttpClient }] }); class ApiCatalogsService { environments; http; constructor(environments, http) { this.environments = environments; this.http = http; } /** * Retrieves the URL for the reports API from the environment configurations. * * @return {string} The URL of the reports API. */ get url() { return this.environments.apiCatalogsUrl ?? ''; } /** * Retrieves the list of collection payments * * @param {QueryParams} params - The query parameters used to fetch the operation types. * @return {Observable<OperationTypesOut[]>} An observable that emits an array of operation type. */ getOperationTypes(params) { return this.http.get(`${this.url}/operation-types`, { params }).pipe(map(({ data }) => data)); } /** * Retrieves the list of identificatios types * * @param {QueryParams} params - The query parameters used to fetch the identification types. * @return {Observable<IdentificationTypesOut[]>} An observable that emits an array of identification type. */ getIdentificationTypes(params) { return this.http.get(`${this.url}/identification-types`, { params }).pipe(map(({ data }) => data)); } /** * Fetches the extra charges based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter the results. * @return {Observable<ExtraChargesOut>} An observable emitting the extra charges data. */ getExtraCharges(params) { return this.http.get(`${this.url}/extracharges`, { params }).pipe(map(({ data }) => data)); } /** * Submits an extra charge request to the server and returns the created extra charge details. * * @param {ExtraChargeIn} body - The data for the extra charge to be created. * @return {Observable<ExtraChargeOut>} An observable that emits the details of the created extra charge. */ postExtraCharge(body) { return this.http.post(`${this.url}/extracharges`, body) .pipe(map(({ data }) => data)); } /** * Updates an extra charge entity with new data and returns the updated entity. * * @param {number} id - The unique identifier of the extra charge to update. * @param {ExtraChargeIn} body - The new data for the extra charge. * @return {Observable<ExtraChargeOut>} An observable emitting the updated extra charge entity. */ putExtraCharge(id, body) { return this.http.put(`${this.url}/extracharges/${id}`, body) .pipe(map(({ data }) => data)); } /** * Fetches a list of countries from the API. * * @param {QueryParams} params - The query parameters to be passed to the API request. * @return {Observable<CountriesOut>} An observable containing the list of countries. */ getCountries(params) { return this.http.get(`${this.url}/countries`, { params }) .pipe(map(({ data }) => data)); } /** * Retrieves the details of a country based on its ID. * * @param {number} id - The identifier of the country to fetch. * @return {Observable<CountryOut>} An observable that emits the country data. */ getCountry(id) { return this.http.get(`${this.url}/countries/${id}`) .pipe(map(({ data }) => data)); } /** * Updates the details of a specific country by its ID. * * @param {number} id - The unique identifier of the country to be updated. * @param {CountryIn} body - The data to update the country with. * @return {Observable<CountryOut>} An observable that emits the updated country data. */ putCountry(id, body) { return this.http.put(`${this.url}/countries/${id}`, body) .pipe(map(({ data }) => data)); } /** * Fetches postal location details based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter and fetch postal location data. * @return {Observable<PostalLocationsOut>} An observable that emits the postal location details. */ getPostalLocations(params) { return this.http.get(`${this.url}/postal-locations`, { params }) .pipe(map(({ data }) => data)); } /** * Fetches a list of regions based on the provided query parameters. * * @param {QueryParams} params - The query parameters used to filter the regions. * @return {Observable<RegionsOut>} An observable that emits the list of regions. */ getRegions(params) { return this.http.get(`${this.url}/regions`, { params }) .pipe(map(({ data }) => data)); } /** * Fetches the zones data based on the provided query parameters. * * @param {QueryParams} params - The query parameters used to filter the zones data. * @return {Observable<ZonesOut>} An observable that emits the fetched zones data. */ getZones(params) { return this.http.get(`${this.url}/zones`, { params }) .pipe(map(({ data }) => data)); } /** * Fetches the management areas based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter the management areas. * @return {Observable<ManagementAreasOut>} An observable that emits the management areas data. */ getManagementAreas(params) { return this.http.get(`${this.url}/management-areas`, { params }) .pipe(map(({ data }) => data)); } /** * Retrieves cancellation reasons from the server based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter the cancellation reasons. * @return {Observable<CancellationReasonsOut>} An observable containing the retrieved cancellation reasons. */ getCancellationReasons(params) { return this.http.get(`${this.url}/cancellation-reasons`, { params }) .pipe(map(({ data }) => data)); } /** * Sends a cancellation reason to the server. * * @param {CancellationReasonIn} body - The cancellation reason object to be sent. * @return {Observable<CancellationReasonOut>} An observable containing the server's response with the processed cancellation reason. */ postCancellationReason(body) { return this.http.post(`${this.url}/cancellation-reasons`, body) .pipe(map(({ data }) => data)); } /** * Updates the cancellation reason for the specified ID with the provided data. * * @param {number} id - The unique identifier of the cancellation reason to update. * @param {CancellationReasonIn} body - The details of the cancellation reason to be updated. * @return {Observable<CancellationReasonOut>} An observable containing the updated cancellation reason. */ putCancellationReason(id, body) { return this.http.put(`${this.url}/cancellation-reasons/${id}`, body) .pipe(map(({ data }) => data)); } /** * Retrieves a list of currencies based on the provided query parameters. * * @param {QueryParams} params - The query parameters to customize the currency retrieval request. * @return {Observable<CurrenciesOut>} An observable that emits the retrieved currencies data. */ getCurrencies(params) { return this.http.get(`${this.url}/currencies`, { params }) .pipe(map(({ data }) => data)); } /** * Fetches the list of available languages based on the provided query parameters. * * @param {QueryParams} params - The query parameters to pass with the HTTP request. * @return {Observable<LanguagesOut>} An observable that emits the available languages. */ getLanguages(params) { return this.http.get(`${this.url}/languages`, { params }) .pipe(map(({ data }) => data)); } /** * Fetches the available units from the API based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter the units being fetched. * @return {Observable<UnitsOut>} An observable that emits the retrieved units data. */ getUnits(params) { return this.http.get(`${this.url}/units`, { params }) .pipe(map(({ data }) => data)); } /** * Retrieves the shipment scopes based on the provided query parameters. * * @param {QueryParams} params The query parameters to filter or modify the request for shipment scopes. * @return {Observable<ShipmentScopesOut>} An observable that emits the shipment scopes data. */ getShipmentScopes(params) { return this.http.get(`${this.url}/shipment-scopes`, { params }) .pipe(map(({ data }) => data)); } /** * Fetches the available shipment content types based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter the shipment content types. * @return {Observable<ShipmentContentTypesOut>} An observable that emits the shipment content types data. */ getShipmentContentTypes(params) { return this.http.get(`${this.url}/shipment-content-types`, { params }) .pipe(map(({ data }) => data)); } /** * Fetches a list of generic folios based on the given query parameters. * * @param {QueryParams} params - The query parameters used to filter the generic folios. * @return {Observable<GenericFoliosOut>} An observable containing the fetched generic folios. */ getGenericFolios(params) { return this.http.get(`${this.url}/generic-folios`, { params }) .pipe(map(({ data }) => data)); } /** * Sends a POST request to create or update a generic folio. * * @param {GenericFolioIn} body - The payload containing the details of the generic folio to be created or updated. * @return {Observable<GenericFolioOut>} An observable containing the response data of the created or updated generic folio. */ postGenericFolio(body) { return this.http.post(`${this.url}/generic-folios`, body) .pipe(map(({ data }) => data)); } /** * Updates a generic folio with the specified ID using the provided data. * * @param {number} id - The unique identifier of the generic folio to update. * @param {GenericFolioIn} body - The data to update the generic folio with. * @return {Observable<GenericFolioOut>} An observable containing the updated generic folio. */ putGenericFolio(id, body) { return this.http.put(`${this.url}/generic-folios/${id}`, body) .pipe(map(({ data }) => data)); } /** * Sends a PUT request to update a Generic Folio resource with the specified ID and body data, and returns the updated resource. * * @param {number} id - The unique identifier of the Generic Folio to be updated. * @param {Partial<GenericFolioIn>} body - The partial data representing the changes to be applied to the Generic Folio. * @return {Observable<GenericFolioOut>} An observable containing the updated Generic Folio resource. */ pathGenericFolio(id, body) { return this.http.put(`${this.url}/generic-folios/${id}`, body) .pipe(map(({ data }) => data)); } /** * Sends a POST request to create a new product. * * @param {ProductIn} body - The product data to be sent in the request body. * @return {Observable<ProductOut>} An observable emitting the created product data. */ postProduct(body) { return this.http.post(`${this.url}/products`, body) .pipe(map(({ data }) => data)); } /** * Updates an existing product with the given ID using the provided data. * * @param {number} id - The unique identifier of the product to update. * @param {ProductIn} body - The product data to update. * @return {Observable<ProductOut>} An observable containing the updated product data. */ putProduct(id, body) { return this.http.put(`${this.url}/products/${id}`, body) .pipe(map(({ data }) => data)); } /** * Retrieves a list of shipment income types based on the provided query parameters. * * @param {QueryParams} params - The query parameters to filter the shipment income types. * @return {Observable<ShipmentIncomeTypesOut>} An observable containing the shipment income types data. */ getShipmentIncomeTypes(params) { return this.http.get(`${this.url}/shipment-income-types`, { params }) .pipe(map(({ data }) => data)); } /** * Sends a POST request to create a new shipment income type. * * @param {ShipmentIncomeTypeIn} body The payload containing the details of the shipment income type to be created. * @return {Observable<ShipmentIncomeTypeOut>} An observable that emits the created shipment income type data. */ postShipmentIncomeType(body) { return this.http.post(`${this.url}/shipment-income-types`, body) .pipe(map(({ data }) => data)); } /** * Updates the shipment income type with the specified ID. * * @param {number} id - The identifier of the shipment income type to update. * @param {ShipmentIncomeTypeIn} body - The data to update the shipment income type with. * @return {Observable<ShipmentIncomeTypeOut>} An observable emitting the updated shipment income type. */ putShipmentIncomeType(id, body) { return this.http.put(`${this.url}/shipment-income-types/${id}`, body) .pipe(map(({ data }) => data)); } /** * Retrieves a list of unique folios based on the provided query parameters. * * @param {QueryParams} params - The query parameters used to filter and fetch unique folios. * @return {Observable<UniqueFoliosOut>} An observable that emits the unique folios data. */ getUniqueFolios(params) { return this.http.get(`${this.url}/unique-folios`, { params }) .pipe(map(({ data }) => data)); } /** * Sends a POST request to create a unique folio. * * @param {UniqueFolioIn} body - The data object containing details for the unique folio to be created. * @return {Observable<UniqueFolioOut>} An observable that emits the created unique folio details. */ postUniqueFolio(body) { return this.http.post(`${this.url}/unique-folios`, body) .pipe(map(({ data }) => data)); } /** * Updates a unique folio with the given data using the provided ID. * * @param {number} id - The ID of the unique folio to be updated. * @param {UniqueFolioIn} body - The payload containing the details of the unique folio to update. * @return {Observable<UniqueFolioOut>} An observable that emits the updated unique folio. */ putUniqueFolio(id, body) { return this.http.put(`${this.url}/unique-folios/${id}`, body) .pipe(map(({ data }) => data)); } /** * Updates a unique folio by its identifier with the provided data. * * @param {number} id - The identifier of the unique folio to update. * @param {Partial<UniqueFolioIn>} body - The partial data of the unique folio to update. * @return {Observable<UniqueFolioOut>} An observable emitting the updated unique folio data. */ pathUniqueFolio(id, body) { return this.http.put(`${this.url}/unique-folios/${id}`, body) .pipe(map(({ data }) => data)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCatalogsService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCatalogsService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCatalogsService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: ['env'] }] }, { type: i1.HttpClient }] }); class ApiCompaniesService { environments; http; constructor(environments, http) { this.environments = environments; this.http = http; } /** * Retrieves the URL for the companies API from the environment configurations. * * @return {string} The URL of the companies API. */ get url() { return this.environments.apiCompaniesUrl ?? ''; } /** * Fetches the installations based on the provided query parameters. * * @param {QueryParams} params - The parameters used to filter the installations query. * @return {Observable<InstallationsOut>} An observable that emits the installation's data. */ getInstallations(params) { return this.http.get(`${this.url}/installations`, { params, }).pipe(map(({ data }) => data)); } /** * Retrieves the installation details based on the given installation ID. * * @param {number} id - The unique identifier of the installation to retrieve. * @returns {Observable<InstallationOut>} An observable of the installation details. */ getInstallation(id) { return this.http.get(`${this.url}/installations/${id}`) .pipe(map(({ data }) => data)); } /** * Retrieves a list of locations based on the provided query parameters. * * @param {QueryParams} params - The parameters to use for querying locations. * @return {Observable<LocationsOut>} An observable that emits the location's data. */ getLocations(params) { return this.http.get(`${this.url}/locations`, { params, }).pipe(map(({ data }) => data)); } /** * Fetches the location details for a given location ID. * * @param {number} id - The unique identifier of the location. * @return {Observable<LocationOut>} An Observable containing the location details. */ getLocation(id) { return this.http.get(`${this.url}/locations/${id}`) .pipe(map(({ data }) => data)); } /** * Retrieves a list of active supply entities. * * @param {QueryParams} params - The query parameters to filter supply entities. * @return {Observable<SupplyEntitiesActivesOut>} Observable emitting supply entities data. */ getSupplyEntitiesActives(params) { return this.http.get(`${this.url}/supply-entities/actives`, { params, }).pipe(map(({ data }) => data)); } /** * Fetches a list of employees based on the specified query parameters. * * @param {QueryParams} params - The parameters to filter and sort the employees. * @return {Observable<EmployeesOut>} An observable that emits the list of employees. */ getEmployees(params) { return this.http.get(`${this.url}/employees`, { params, }).pipe(map(({ data }) => data)); } /** * Fetches an employee's details based on the provided employee ID. * * @param {number} id - The unique identifier of the employee. * @return {Observable<EmployeeOut>} An observable that emits the employee's details. */ getEmployee(id) { return this.http.get(`${this.url}/employees/${id}`) .pipe(map(({ data }) => data)); } /** * Retrieves the list of employees for a specified location based on provided query parameters. * * @param {QueryParams} params - The query parameters used to filter and retrieve the location employees. * @returns {Observable<LocationEmployeesOut>} An observable that emits the list of employees for the specified location. */ getLocationEmployees(params) { return this.http.get(`${this.url}/location-employees`, { params, }).pipe(map(({ data }) => data)); } /** * Retrieves a list of countries where the company operates. * * @param {QueryParams} params - The query parameters for the API request. * @return {Observable<CompanyCountriesOut>} An observable containing the list of company countries. */ getCompanyCountries(params) { return this.http.get(`${this.url}/company-countries`, { params, }).pipe(map(({ data }) => data)); } /** * Retrieves the country information for a specified company by its ID. * * @param {number} id - The unique identifier of the company. * @return {Observable<CompanyCountryOut>} An observable containing the country information of the company. */ getCompanyCountry(id) { return this.http.get(`${this.url}/company-countries/${id}`) .pipe(map(({ data }) => data)); } /** * Fetches the reference currencies for a given country. * * @param {QueryParams} params - The query parameters to include in the request. * @return {Observable<CountryReferenceCurrenciesOut>} The observable containing the country reference currencies data. */ getCountryReferenceCurrencies(params) { return this.http.get(`${this.url}/country-reference-currencies`, { params }).pipe(map(({ data }) => data)); } /** * Retrieves a list of currencies for different countries along with their current exchange rates. * * @param {QueryParams} params - The query parameters used to fetch the country reference currencies. * @return {Observable<CountryCurrencyRate[]>} An observable that emits an array of country currency rates. */ getCountryCurrenciesWithRate(params) { return this.getCountryReferenceCurrencies(params) .pipe(mergeMap((currenciesData) => { const $observables = currenciesData.country_reference_currencies .map((item) => this.getCurrentExchanges({ currency_id: item.currency.id, }).pipe(map((exchangesData) => ({ ...item, rate: exchangesData.exchanges[0]?.value, })))); return forkJoin($observables); })); } /** * Fetches exchange data based on the provided query parameters. * * @param {QueryParams} params - The query parameters for retrieving exchange data. * @return {Observable<ExchangesOut>} An observable containing the exchange data. */ getExchanges(params) { return this.http.get(`${this.url}/exchanges`, { params, }).pipe(map(({ data }) => data)); } /** * Retrieves the current exchanges based on the given query parameters. * * @param {QueryParams} params - The query parameters to filter the exchanges. * * @returns {Observable<ExchangesOut>} - An observable that emits the API response data containing the current exchanges. */ getCurrentExchanges(params) { return this.http.get(`${this.url}/exchanges/current`, { params, }).pipe(map(({ data }) => data)); } /** * Fetches the country-specific tax information for a company. * * @param {QueryParams} params - The parameters used to filter and query the taxes. * @return {Observable<CompanyCountryTaxesOut>} An observable that emits the tax information. */ getCompanyCountryTaxes(params) { return this.http.get(`${this.url}/company-country-taxes`, { params, }).pipe(map(({ data }) => data)); } /** * Retrieves the list of active account entities based on the provided query parameters. * * @param {QueryParams} params - The parameters to filter and query active account entities. * @return {Observable<AccountEntitiesActivesOut>} An observable that emits the list of active account entities. */ getAccountEntitiesActives(params) { return this.http.get(`${this.url}/account-entities/actives`, { params, }).pipe(map(({ data }) => data)); } /** * Retrieves the parameter values based on the provided parameter names. * * @param {Object} params - An object containing the required parameters. * @param {string[]} params.paramNames - An array of parameter names for which the values need to be fetched. * @return {Observable<ParametersValuesOut>} An observable that emits the fetched parameter values. */ getParametersValues({ paramNames, }) { const parameters = paramNames.map((p) => ({ name: p })); return this.http.post(`${this.url}/parameters-values`, { parameters }).pipe(map(({ data }) => data)); } /** * Retrieves the value of a specified parameter. * * @param {Object} input - The input object containing the parameter details. * @param {string} input.paramName - The name of the parameter whose value is to be retrieved. * @return {Observable<ParameterValueOut>} An observable emitting the value of the specified parameter. */ getParameterValue({ paramName, }) { return this.http.get(`${this.url}/parameters-values/${paramName}`) .pipe(map(({ data }) => data)); } /** * Retrieves a list of country references based on the given query parameters. * * @param {QueryParams} params - The query parameters for retrieving country references. * @return {Observable<CountryReferencesOut>} An observable containing the country reference data. */ getCountryReferences(params) { return this.http.get(`${this.url}/country-references`, { params, }).pipe(map(({ data }) => data)); } /** * Fetches the country reference data for a given country ID. * * @param {number} id - The unique identifier of the country for which the reference data is to be retrieved. * @return {Observable<CountryReferenceOut>} An observable containing the country reference data. */ getCountryReference(id) { return this.http.get(`${this.url}/country-references/${id}`) .pipe(map(({ data }) => data)); } /** * Fetches the list of workflows based on the provided query parameters. * * @param {QueryParams} params - The query parameters used to filter workflows. * @return {Observable<WorkflowsOut>} An observable containing the workflow data. */ getWorkflows(params) { return this.http.get(`${this.url}/workflows`, { params, }).pipe(map(({ data }) => data)); } /** * Fetches the list of employee customer * * @param {QueryParams} params - The query parameters used to filter employee customers. * @return {Observable<EmployeeCustomersOut>} An observable containing the employee customer data. */ getEmployeesCustomers(params) { return this.http.get(`${this.url}/employee-customers`, { params, }).pipe(map(({ data }) => data)); } /** * Sends a POST request to create or update employee customer records and processes the server response. * * @param {EmployeeCustomersIn} body - The request payload containing employee customer data to be sent to the server. * @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee customer data on successful response. */ postEmployeeCustomers(body) { return this.http.post(`${this.url}/employee-customers`, body).pipe(map(({ data }) => data)); } /** * Updates the employee-customer association record identified by the given ID with the provided data. * * @param {number} id - The identifier of the employee-customer record to update. * @param {EmployeeCustomersIn} body - The data to update the employee-customer record with. * @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee-customer data. */ putEmployeeCustomers(id, body) { return this.http.put(`${this.url}/employee-customers/${id}`, body).pipe(map(({ data }) => data)); } /** * Fetches the employee-customer details based on the provided employee customer ID. * * @param {number} id - The identifier of the employee-customer record to update. * @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee-customer data. */ getEmployeeCustomer(id) { return this.http.get(`${this.url}/employee-customers/${id}`).pipe(map(({ data }) => data)); } /** * Enables or disables an employee customer's active state. * * @param {EmployeeCustomerDhl} employee - The employee customer object to be updated. * @param {boolean} [isActive] - Optional parameter to explicitly set the active state. * If null or undefined, the active state will be toggled. * @return {Observable<EmployeeCustomersOut>} An observable containing the updated employee customer output. */ enableDisableEmployeeCustomers(employee, isActive) { return this.http.patch(`${this.url}/employee-customers/${employee.id}`, { is_active: isActive ?? !employee.is_active }).pipe(map(({ data }) => data)); } /** * Submits a file containing employee customer data for a specific country to the server. * * @param {number} countryId - The identifier of the country for which the data is being uploaded. * @param {File} file - The file containing employee customer data to be uploaded. * @return {Observable<BoardingProcessIdIn>} Observable that emits the processed boarding process ID on success. */ postEmployeeCustomersLoad(countryId, file) { const formData = new FormData(); formData.append('file', file); formData.append('country_id', countryId.toString()); return this.http.post(`${this.url}/employee-customers/load`, formData).pipe(map(({ data }) => data)); } /** * Downloads a file containing customer data for a specific employee based on the provided country ID. * * @param {number} id - The ID of the country used as a filter for fetching the employee's customers. * @return {Observable<Blob>} An observable that emits the file blob containing the customer data. */ getEmployeeCustomersDownload(id) { return this.http.get(`${this.url}/employee-customers/download`, { params: { country_id: id }, responseType: 'blob' }); } /** * Retrieves the boarding process details for a given ID. * * @param {number} id - The unique identifier of the boarding process to retrieve. * @return {Observable<BoardingProcessIn>} An observable containing the boarding process details. */ getBoardingProcess(id) { return this.http.get(`${this.url}/boarding-process/${id}`).pipe(map(({ data }) => data)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCompaniesService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCompaniesService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiCompaniesService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: ['env'] }] }, { type: i1.HttpClient }] }); class ApiEToolsAutoBillingService { environments; http; constructor(environments, http) { this.environments = environments; this.http = http; } /** * Retrieves the URL for the shipments API from the environment configurations. * * @return {string} The URL of the shipments API. */ get url() { return this.environments.apiEToolsAutoBilling ?? ''; } /** * Updates external shipment address details for the given address ID. * * @param {Object} params - The parameters for the API request. * @param {string} params.id - The unique identifier of the address to update. * @param {Object} params.body - The payload containing updated address details. * @return {Observable<ExternalShipmentAddressesOut>} An observable containing the updated external shipment address information. */ patchExternalShipmentAddresses({ id, ...body }) { return this.http.patch(`${this.url}/external-shipment-addresses/${id}`, body) .pipe(map(({ data }) => data)); } /** * Fetches the external shipment file by its identifier. * * @param {number} fileId - The unique identifier of the external shipment file to be retrieved. * @return {Observable<ExternalShipmentFileOut>} An observable containing the external shipment file data. */ getExternalShipmentFile(fileId) { return this.http.get(`${this.url}/external-shipment-files/${fileId}`) .pipe(map(({ data }) => data)); } /** * Retrieves the history entries for a specific external shipment. * * @param {number} id - The ID of the external shipment to retrieve history for. * @return {Observable<ExternalShipmentHistoriesOut>} An observable containing the external shipment history entries. */ getExternalShipmentHistories(id) { return this.http.get(`${this.url}/external-shipments/${id}/external-shipment-histories`) .pipe(map(({ data }) => data)); } /** * Retrieves the list of external shipment statuses * * @param {QueryParams} params - The query parameters used to fetch the external shipment statuses. * @return {Observable<ExternalShipmentStatusOut>} An observable that emits the external shipment statuses data. */ getExternalShipmentStatuses(params) { return this.http.get(`${this.url}/external-shipment-statuses`, { params }).pipe(map(({ data }) => data)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiEToolsAutoBillingService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiEToolsAutoBillingService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiEToolsAutoBillingService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: ['env'] }] }, { type: i1.HttpClient }] }); class ApiExternalPickupsService { httpClient; environment; appKey; constructor(httpClient, environment) { this.httpClient = httpClient; this.environment = environment; this.appKey = environment.apiExternalOperationsKey ?? ''; } /** * Getter method to retrieve the API's external operations URL. * Fetches the URL from the `apiExternalOperationsUrl` property of the environment object. * Defaults to an empty string if the property is undefined or null. * * @return {string} The external operations URL or an empty string if unavailable. */ get url() { return this.environment.apiExternalOperationsUrl ?? ''; } /** * Generates a delivery confirmation by sending the provided payload to the API. * * @param {DeliveryConfirmationGenerateIn} payload - The input payload required to generate the delivery confirmation. * @return {Observable<DeliveryConfirmationGenerateOut>} An observable that emits the generated delivery confirmation data. */ postDeliveryConfirmationGenerate(payload) { return this.httpClient.post(`${this.url}/delivery-confirmation/generate`, payload, { headers: { appkey: this.appKey } }).pipe(map$1(({ data }) => data)); } /** * Confirms the completion of a delivery operation by making a PATCH request. * * @param {Object} input - The input parameters for the method. * @param {string} input.operationId - The unique identifier of the delivery operation to be confirmed. * @param {string} input.keyOTP - The one-time password (OTP) key associated with the delivery confirmation. * @return {Observable<Object>} - An observable containing the response data from the API. */ patchDeliveryConfirmationComplete({ keyOTP, operationId, }) { return this.httpClient.patch(`${this.url}/delivery-confirmation/completed/${keyOTP}`, null, { headers: { appkey: this.appKey }, params: { operation_id: operationId } }).pipe(map$1(({ data }) => data)); } /** * Cancels a delivery confirmation by sending an OTP and additional data to the server. * * @param {Object} param0 - The parameter object containing the required properties. * @param {string} param0.otp - The one-time password to authenticate the cancellation request. * @param {Object} param0.body - Additional body data required for cancellation. * @return {Observable<Object>} An observable that emits the server's response when the cancellation is processed. */ putDeliveryConfirmation({ otp, ...body }) { return this.httpClient.put(`${this.url}/delivery-confirmation/confirmation/${otp}`, body, { headers: { appkey: this.appKey }, }).pipe(map$1(({ data }) => data)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiExternalPickupsService, deps: [{ token: i1.HttpClient }, { token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiExternalPickupsService, providedIn: 'root' }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApiExternalPickupsService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{ type: Inject, args: ['env'] }] }] }); class ApiInvoicesService { environments; http; constructor(environments, http) { this.environments = environments; this.http = http; } /** * Retrieves the API URL for invoices from the environments configuration. * * @return {string} The API URL for invoices. */ get url() { return this.environments.apiInvoicesUrl ?? ''; } /** * Sends an operation document to the server and processes the response. * * @param {OperationDocumentIn} body - The input data for the operation document. * @return {Observable<OperationDocumentOut>} An observable containing the processed operation document output. */ postOperationDocument(body) { return this.http.post(`${this.url}/operation/document`, body) .pipe(map(({ data }) => data)); } /** * Fetches and returns the collection receipt data for a given collection ID. * * @param {number} id - The unique identifier of the collection for which the receipt needs to be retrieved. * @return {Observable<PrintCollectionReceiptOut>} An observable containing the collection receipt data. */ getPrintCollectionReceipt(id) { return this.http.get(`${this.url}/operation/print/collection-receipt/${id}`) .pipe(map(({ data }) => data)); } /** * Handles the account payment operation by sending a POST request to the specified endpoint. * Processes the response and returns the operation data. * * @param {OperationAccountPaymentIn} body The payload containing information for the account payment operation. * @return {Observable<OperationAccountPaymentOut>} An observable emitting the processed account payment operation data. */ postOperationAccountPayment(body) {