@experteam-mx/ngx-services
Version:
Angular common services for Experteam apps
1 lines • 153 kB
Source Map (JSON)
{"version":3,"file":"experteam-mx-ngx-services.mjs","sources":["../../../../projects/experteam-mx/ngx-services/src/lib/ngx-services.models.ts","../../../../projects/experteam-mx/ngx-services/src/lib/ngx-services.module.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-billing-do.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-billing-mx.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-cash-operations.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-catalogs.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-companies.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-e-tools-auto-billing.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-external-pickups.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-invoices.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-open-items.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-reports.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-security.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/apis/api-shipments.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/websockets/web-sockets.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/cypher/crypto.service.ts","../../../../projects/experteam-mx/ngx-services/src/lib/interceptors/api-headers.interceptor.ts","../../../../projects/experteam-mx/ngx-services/src/lib/interceptors/api-token.interceptor.ts","../../../../projects/experteam-mx/ngx-services/src/lib/interceptors/http-caching.interceptor.ts","../../../../projects/experteam-mx/ngx-services/src/lib/helpers/http.ts","../../../../projects/experteam-mx/ngx-services/src/public-api.ts","../../../../projects/experteam-mx/ngx-services/src/experteam-mx-ngx-services.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\r\n\r\n/**\r\n * Represents the configuration settings for the application's environment.\r\n * This type includes various API endpoint URLs, authentication details, caching options, and other relevant settings.\r\n *\r\n * Properties:\r\n * - apiCompaniesUrl: The URL for the companies API endpoint.\r\n * - apiInvoicesUrl: The URL for the invoices API endpoint.\r\n * - apiReportsUrl: The URL for the reports API endpoint.\r\n * - apiSecurityUrl: The URL for the security-related API endpoint.\r\n * - apiShipmentUrl: The URL for the shipment API endpoint.\r\n * - authCookie: The name of the authentication cookie used for user sessions.\r\n * - cacheTtl: Optional. Specifies the time-to-live (TTL) for cached items.\r\n * - printUrl: Optional. The URL used for generating or downloading printable documents.\r\n * - secretKey: A secret key used for authentication or other secure operations.\r\n */\r\nexport type Environment = {\r\n apiBillingDO?: string\r\n apiBillingMX?: string\r\n apiCashOperationsUrl?: string\r\n apiCatalogsUrl?: string\r\n apiCompaniesUrl?: string\r\n apiEToolsAutoBilling?: string\r\n apiExternalOperationsKey?: string\r\n apiExternalOperationsUrl?: string\r\n apiInvoicesUrl?: string\r\n apiOpenItemsUrl?: string\r\n apiReportsUrl?: string\r\n apiSecurityUrl?: string\r\n apiShipmentUrl?: string\r\n authCookie: string\r\n cacheTtl?: number\r\n printUrl?: string\r\n secretKey: string\r\n sockets?: {\r\n app_key: string\r\n debug?: boolean\r\n port: number\r\n url: string\r\n }\r\n}\r\n\r\n/**\r\n * Injection token used to inject environment configurations.\r\n *\r\n * `ENVIRONMENT_TOKEN` is a dependency injection token that allows\r\n * for the provision and retrieval of environment-specific configurations\r\n * within the application. This token is typically associated with an\r\n * `Environment` type that defines the structure of the configuration.\r\n */\r\nexport const ENVIRONMENT_TOKEN = new InjectionToken<Environment>('Environments token')\r\n","import { ModuleWithProviders, NgModule } from '@angular/core'\r\nimport { Environment } from './ngx-services.models'\r\nimport { provideHttpClient } from '@angular/common/http'\r\n\r\n@NgModule({\r\n providers: [provideHttpClient()]\r\n})\r\nexport class NgxServicesModule {\r\n /**\r\n * Returns a module with providers for the NgxServicesModule.\r\n *\r\n * @param {Environment} environment - The environment configuration object.\r\n *\r\n * @return {ModuleWithProviders<NgxServicesModule>} The module with providers for the NgxServicesModule.\r\n */\r\n public static forRoot (environment: Environment): ModuleWithProviders<NgxServicesModule> {\r\n return {\r\n ngModule: NgxServicesModule,\r\n providers: [\r\n {\r\n provide: 'env',\r\n useValue: environment\r\n }\r\n ]\r\n }\r\n }\r\n}\r\n","import { Inject, Injectable } from '@angular/core'\r\nimport { Environment } from '../ngx-services.models'\r\nimport { HttpClient } from '@angular/common/http'\r\nimport { map, Observable } from 'rxjs'\r\nimport { ApiSuccess } from './models/api.models'\r\nimport { IncomeTypesOut } from './models/api-billing.types'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ApiBillingDOService {\r\n constructor (\r\n @Inject('env') private environments: Environment,\r\n private http: HttpClient\r\n ) { }\r\n\r\n /**\r\n * Retrieves the URL for the shipments API from the environment configurations.\r\n *\r\n * @return {string} The URL of the shipments API.\r\n */\r\n get url (): string {\r\n return this.environments.apiBillingDO ?? ''\r\n }\r\n\r\n /**\r\n * Retrieves a list of income types\r\n *\r\n * @return {Observable<ApiSuccess<IncomeTypesOut>>} An observable that emits the income types data.\r\n */\r\n getIncomeTypes (): Observable<IncomeTypesOut> {\r\n return this.http.get<ApiSuccess<IncomeTypesOut>>(`${this.url}/income-types`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n}\r\n","import { Inject, Injectable } from '@angular/core'\r\nimport { Environment } from '../ngx-services.models'\r\nimport { HttpClient } from '@angular/common/http'\r\nimport { map, Observable } from 'rxjs'\r\nimport { ApiSuccess, QueryParams } from './models/api.models'\r\nimport { FiscalRegimensAcceptedOut, FiscalRegimensOut, PostalCodesOut } from './models/api-billing.types'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ApiBillingMxService {\r\n constructor (\r\n @Inject('env') private environments: Environment,\r\n private http: HttpClient\r\n ) { }\r\n\r\n /**\r\n * Retrieves the URL for the shipments API from the environment configurations.\r\n *\r\n * @return {string} The URL of the shipments API.\r\n */\r\n get url (): string {\r\n return this.environments.apiBillingMX ?? ''\r\n }\r\n\r\n /**\r\n * Fetches the tax regimen data from the server.\r\n *\r\n * @return {Observable<FiscalRegimensOut>} An observable that emits the fiscal regimen data.\r\n */\r\n getFiscalRegimens (): Observable<FiscalRegimensOut> {\r\n return this.http.get<ApiSuccess<FiscalRegimensOut>>(`${this.url}/fiscal-regimens`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches a paginated list of CFDIs (Comprobante Fiscal Digital por Internet) based on the provided fiscal regimen.\r\n *\r\n * @param {number} fiscalRegimen - The fiscal regimen identifier to filter the CFDIs.\r\n * @return {Observable<FiscalRegimensAcceptedOut>} An observable containing the paginated list of CFDIs.\r\n */\r\n getFiscalRegimensAccepted (fiscalRegimen: number): Observable<FiscalRegimensAcceptedOut> {\r\n const params = { 'fiscal-regimen': fiscalRegimen }\r\n\r\n return this.http.get<ApiSuccess<FiscalRegimensAcceptedOut>>(`${this.url}/cfdi-uses/fiscal-regimen-accepted/list`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches and validates postal code data from the server.\r\n *\r\n * @param {QueryParams} params - Query parameters used to filter the postal code data.\r\n * @return {Observable<PostalCodesOut>} - An observable emitting the validated postal code data.\r\n */\r\n getPostalCodes (params: QueryParams): Observable<PostalCodesOut> {\r\n return this.http.get<ApiSuccess<PostalCodesOut>>(`${this.url}/postal-codes`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n}\r\n","import { Inject, Injectable } from '@angular/core'\r\nimport { Environment } from '../ngx-services.models'\r\nimport { HttpClient } from '@angular/common/http'\r\nimport { ApiSuccess, QueryParams } from './models/api.models'\r\nimport { map, Observable } from 'rxjs'\r\nimport {\r\n InstallationCountryReferenceCurrenciesOut,\r\n InstallationCountryReferenceCurrencyIn,\r\n InstallationCountryReferenceCurrencyOut\r\n} from './models/api-cash-operations.types'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ApiCashOperationsService {\r\n constructor (\r\n @Inject('env') private environments: Environment,\r\n private http: HttpClient\r\n ) { }\r\n\r\n /**\r\n * Retrieves the URL for the cash operations API from the environment configurations.\r\n *\r\n * @return {string} The URL of the cash operations API.\r\n */\r\n get url (): string {\r\n return this.environments.apiCashOperationsUrl ?? ''\r\n }\r\n\r\n /**\r\n * Creates a new installation country reference currency.\r\n *\r\n * @param {InstallationCountryReferenceCurrencyIn} body - The data for the new reference currency.\r\n * @returns {Observable<InstallationCountryReferenceCurrencyOut>} The created reference currency.\r\n */\r\n postInstallationCountryReferenceCurrency (body: InstallationCountryReferenceCurrencyIn): Observable<InstallationCountryReferenceCurrencyOut> {\r\n return this.http.post<ApiSuccess<InstallationCountryReferenceCurrencyOut>>(`${this.url}/installation-country-reference-currencies`,\r\n body\r\n ).pipe(\r\n map(({ data }) => data)\r\n )\r\n }\r\n\r\n /**\r\n * Updates an existing installation country reference currency.\r\n *\r\n * @param {number} id - The ID of the reference currency to update.\r\n * @param {InstallationCountryReferenceCurrencyIn} body - The updated data for the reference currency.\r\n * @returns {Observable<InstallationCountryReferenceCurrencyOut>} The updated reference currency.\r\n */\r\n putInstallationCountryReferenceCurrency (id:number, body: InstallationCountryReferenceCurrencyIn): Observable<InstallationCountryReferenceCurrencyOut> {\r\n return this.http.put<ApiSuccess<InstallationCountryReferenceCurrencyOut>>(`${this.url}/installation-country-reference-currencies/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of installation country reference currencies based on query parameters.\r\n *\r\n * @param {QueryParams} params - Query parameters for filtering the currencies.\r\n * @returns {Observable<InstallationCountryReferenceCurrenciesOut>} The list of reference currencies.\r\n */\r\n getInstallationCompanyCountryCurrencies (params: QueryParams): Observable<InstallationCountryReferenceCurrenciesOut> {\r\n return this.http.get<ApiSuccess<InstallationCountryReferenceCurrenciesOut>>(`${this.url}/installation-country-reference-currencies`, {\r\n params\r\n }).pipe(map(({ data }) => data))\r\n }\r\n}\r\n","import { Inject, Injectable } from '@angular/core'\r\nimport { Environment } from '../ngx-services.models'\r\nimport { HttpClient } from '@angular/common/http'\r\nimport { map, Observable } from 'rxjs'\r\nimport { ApiSuccess, QueryParams } from './models/api.models'\r\nimport {\r\n CancellationReasonIn,\r\n CancellationReasonOut,\r\n CancellationReasonsOut,\r\n CountriesOut,\r\n CountryIn,\r\n CountryOut,\r\n CurrenciesOut,\r\n ExtraChargeIn,\r\n ExtraChargeOut,\r\n ExtraChargesOut,\r\n GenericFolioIn,\r\n GenericFolioOut,\r\n GenericFoliosOut,\r\n IdentificationTypesOut,\r\n LanguagesOut,\r\n ManagementAreasOut,\r\n OperationTypesOut,\r\n PostalLocationsOut,\r\n ProductIn,\r\n ProductOut,\r\n RegionsOut,\r\n ShipmentContentTypesOut,\r\n ShipmentIncomeTypeIn,\r\n ShipmentIncomeTypeOut,\r\n ShipmentIncomeTypesOut,\r\n ShipmentScopesOut,\r\n UniqueFolioIn,\r\n UniqueFolioOut,\r\n UniqueFoliosOut,\r\n UnitsOut,\r\n ZonesOut\r\n} from './models/api-catalog.types'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ApiCatalogsService {\r\n constructor (\r\n @Inject('env') private environments: Environment,\r\n private http: HttpClient\r\n ) { }\r\n\r\n /**\r\n * Retrieves the URL for the reports API from the environment configurations.\r\n *\r\n * @return {string} The URL of the reports API.\r\n */\r\n get url (): string {\r\n return this.environments.apiCatalogsUrl ?? ''\r\n }\r\n\r\n /**\r\n * Retrieves the list of collection payments\r\n *\r\n * @param {QueryParams} params - The query parameters used to fetch the operation types.\r\n * @return {Observable<OperationTypesOut[]>} An observable that emits an array of operation type.\r\n */\r\n getOperationTypes (params: QueryParams): Observable<OperationTypesOut> {\r\n return this.http.get<ApiSuccess<OperationTypesOut>>(`${this.url}/operation-types`, {\r\n params\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the list of identificatios types\r\n *\r\n * @param {QueryParams} params - The query parameters used to fetch the identification types.\r\n * @return {Observable<IdentificationTypesOut[]>} An observable that emits an array of identification type.\r\n */\r\n getIdentificationTypes (params: QueryParams): Observable<IdentificationTypesOut> {\r\n return this.http.get<ApiSuccess<IdentificationTypesOut>>(`${this.url}/identification-types`, {\r\n params\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the extra charges based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter the results.\r\n * @return {Observable<ExtraChargesOut>} An observable emitting the extra charges data.\r\n */\r\n getExtraCharges (params: QueryParams): Observable<ExtraChargesOut> {\r\n return this.http.get<ApiSuccess<ExtraChargesOut>>(`${this.url}/extracharges`, {\r\n params\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Submits an extra charge request to the server and returns the created extra charge details.\r\n *\r\n * @param {ExtraChargeIn} body - The data for the extra charge to be created.\r\n * @return {Observable<ExtraChargeOut>} An observable that emits the details of the created extra charge.\r\n */\r\n postExtraCharge (body: ExtraChargeIn): Observable<ExtraChargeOut> {\r\n return this.http.post<ApiSuccess<ExtraChargeOut>>(`${this.url}/extracharges`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Updates an extra charge entity with new data and returns the updated entity.\r\n *\r\n * @param {number} id - The unique identifier of the extra charge to update.\r\n * @param {ExtraChargeIn} body - The new data for the extra charge.\r\n * @return {Observable<ExtraChargeOut>} An observable emitting the updated extra charge entity.\r\n */\r\n putExtraCharge (id: number, body: ExtraChargeIn): Observable<ExtraChargeOut> {\r\n return this.http.put<ApiSuccess<ExtraChargeOut>>(`${this.url}/extracharges/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches a list of countries from the API.\r\n *\r\n * @param {QueryParams} params - The query parameters to be passed to the API request.\r\n * @return {Observable<CountriesOut>} An observable containing the list of countries.\r\n */\r\n getCountries (params: QueryParams): Observable<CountriesOut> {\r\n return this.http.get<ApiSuccess<CountriesOut>>(`${this.url}/countries`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the details of a country based on its ID.\r\n *\r\n * @param {number} id - The identifier of the country to fetch.\r\n * @return {Observable<CountryOut>} An observable that emits the country data.\r\n */\r\n getCountry (id: number): Observable<CountryOut> {\r\n return this.http.get<ApiSuccess<CountryOut>>(`${this.url}/countries/${id}`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Updates the details of a specific country by its ID.\r\n *\r\n * @param {number} id - The unique identifier of the country to be updated.\r\n * @param {CountryIn} body - The data to update the country with.\r\n * @return {Observable<CountryOut>} An observable that emits the updated country data.\r\n */\r\n putCountry (id: number, body: CountryIn): Observable<CountryOut> {\r\n return this.http.put<ApiSuccess<CountryOut>>(`${this.url}/countries/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches postal location details based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter and fetch postal location data.\r\n * @return {Observable<PostalLocationsOut>} An observable that emits the postal location details.\r\n */\r\n getPostalLocations (params: QueryParams): Observable<PostalLocationsOut> {\r\n return this.http.get<ApiSuccess<PostalLocationsOut>>(`${this.url}/postal-locations`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches a list of regions based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters used to filter the regions.\r\n * @return {Observable<RegionsOut>} An observable that emits the list of regions.\r\n */\r\n getRegions (params: QueryParams): Observable<RegionsOut> {\r\n return this.http.get<ApiSuccess<RegionsOut>>(`${this.url}/regions`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the zones data based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters used to filter the zones data.\r\n * @return {Observable<ZonesOut>} An observable that emits the fetched zones data.\r\n */\r\n getZones (params: QueryParams): Observable<ZonesOut> {\r\n return this.http.get<ApiSuccess<ZonesOut>>(`${this.url}/zones`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the management areas based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter the management areas.\r\n * @return {Observable<ManagementAreasOut>} An observable that emits the management areas data.\r\n */\r\n getManagementAreas (params: QueryParams): Observable<ManagementAreasOut> {\r\n return this.http.get<ApiSuccess<ManagementAreasOut>>(`${this.url}/management-areas`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves cancellation reasons from the server based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter the cancellation reasons.\r\n * @return {Observable<CancellationReasonsOut>} An observable containing the retrieved cancellation reasons.\r\n */\r\n getCancellationReasons (params: QueryParams): Observable<CancellationReasonsOut> {\r\n return this.http.get<ApiSuccess<CancellationReasonsOut>>(`${this.url}/cancellation-reasons`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Sends a cancellation reason to the server.\r\n *\r\n * @param {CancellationReasonIn} body - The cancellation reason object to be sent.\r\n * @return {Observable<CancellationReasonOut>} An observable containing the server's response with the processed cancellation reason.\r\n */\r\n postCancellationReason (body: CancellationReasonIn): Observable<CancellationReasonOut> {\r\n return this.http.post<ApiSuccess<CancellationReasonOut>>(`${this.url}/cancellation-reasons`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Updates the cancellation reason for the specified ID with the provided data.\r\n *\r\n * @param {number} id - The unique identifier of the cancellation reason to update.\r\n * @param {CancellationReasonIn} body - The details of the cancellation reason to be updated.\r\n * @return {Observable<CancellationReasonOut>} An observable containing the updated cancellation reason.\r\n */\r\n putCancellationReason (id: number, body: CancellationReasonIn): Observable<CancellationReasonOut> {\r\n return this.http.put<ApiSuccess<CancellationReasonOut>>(`${this.url}/cancellation-reasons/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of currencies based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to customize the currency retrieval request.\r\n * @return {Observable<CurrenciesOut>} An observable that emits the retrieved currencies data.\r\n */\r\n getCurrencies (params: QueryParams): Observable<CurrenciesOut> {\r\n return this.http.get<ApiSuccess<CurrenciesOut>>(`${this.url}/currencies`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the list of available languages based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to pass with the HTTP request.\r\n * @return {Observable<LanguagesOut>} An observable that emits the available languages.\r\n */\r\n getLanguages (params: QueryParams): Observable<LanguagesOut> {\r\n return this.http.get<ApiSuccess<LanguagesOut>>(`${this.url}/languages`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the available units from the API based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter the units being fetched.\r\n * @return {Observable<UnitsOut>} An observable that emits the retrieved units data.\r\n */\r\n getUnits (params: QueryParams): Observable<UnitsOut> {\r\n return this.http.get<ApiSuccess<UnitsOut>>(`${this.url}/units`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the shipment scopes based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params The query parameters to filter or modify the request for shipment scopes.\r\n * @return {Observable<ShipmentScopesOut>} An observable that emits the shipment scopes data.\r\n */\r\n getShipmentScopes (params: QueryParams): Observable<ShipmentScopesOut> {\r\n return this.http.get<ApiSuccess<ShipmentScopesOut>>(`${this.url}/shipment-scopes`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the available shipment content types based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter the shipment content types.\r\n * @return {Observable<ShipmentContentTypesOut>} An observable that emits the shipment content types data.\r\n */\r\n getShipmentContentTypes (params: QueryParams): Observable<ShipmentContentTypesOut> {\r\n return this.http.get<ApiSuccess<ShipmentContentTypesOut>>(`${this.url}/shipment-content-types`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches a list of generic folios based on the given query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters used to filter the generic folios.\r\n * @return {Observable<GenericFoliosOut>} An observable containing the fetched generic folios.\r\n */\r\n getGenericFolios (params: QueryParams): Observable<GenericFoliosOut> {\r\n return this.http.get<ApiSuccess<GenericFoliosOut>>(`${this.url}/generic-folios`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Sends a POST request to create or update a generic folio.\r\n *\r\n * @param {GenericFolioIn} body - The payload containing the details of the generic folio to be created or updated.\r\n * @return {Observable<GenericFolioOut>} An observable containing the response data of the created or updated generic folio.\r\n */\r\n postGenericFolio (body: GenericFolioIn): Observable<GenericFolioOut> {\r\n return this.http.post<ApiSuccess<GenericFolioOut>>(`${this.url}/generic-folios`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Updates a generic folio with the specified ID using the provided data.\r\n *\r\n * @param {number} id - The unique identifier of the generic folio to update.\r\n * @param {GenericFolioIn} body - The data to update the generic folio with.\r\n * @return {Observable<GenericFolioOut>} An observable containing the updated generic folio.\r\n */\r\n putGenericFolio (id: number, body: GenericFolioIn): Observable<GenericFolioOut> {\r\n return this.http.put<ApiSuccess<GenericFolioOut>>(`${this.url}/generic-folios/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Sends a PUT request to update a Generic Folio resource with the specified ID and body data, and returns the updated resource.\r\n *\r\n * @param {number} id - The unique identifier of the Generic Folio to be updated.\r\n * @param {Partial<GenericFolioIn>} body - The partial data representing the changes to be applied to the Generic Folio.\r\n * @return {Observable<GenericFolioOut>} An observable containing the updated Generic Folio resource.\r\n */\r\n pathGenericFolio (id: number, body: Partial<GenericFolioIn>): Observable<GenericFolioOut> {\r\n return this.http.put<ApiSuccess<GenericFolioOut>>(`${this.url}/generic-folios/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Sends a POST request to create a new product.\r\n *\r\n * @param {ProductIn} body - The product data to be sent in the request body.\r\n * @return {Observable<ProductOut>} An observable emitting the created product data.\r\n */\r\n postProduct (body: ProductIn): Observable<ProductOut> {\r\n return this.http.post<ApiSuccess<ProductOut>>(`${this.url}/products`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Updates an existing product with the given ID using the provided data.\r\n *\r\n * @param {number} id - The unique identifier of the product to update.\r\n * @param {ProductIn} body - The product data to update.\r\n * @return {Observable<ProductOut>} An observable containing the updated product data.\r\n */\r\n putProduct (id: number, body: ProductIn): Observable<ProductOut> {\r\n return this.http.put<ApiSuccess<ProductOut>>(`${this.url}/products/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of shipment income types based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter the shipment income types.\r\n * @return {Observable<ShipmentIncomeTypesOut>} An observable containing the shipment income types data.\r\n */\r\n getShipmentIncomeTypes (params: QueryParams): Observable<ShipmentIncomeTypesOut> {\r\n return this.http.get<ApiSuccess<ShipmentIncomeTypesOut>>(`${this.url}/shipment-income-types`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Sends a POST request to create a new shipment income type.\r\n *\r\n * @param {ShipmentIncomeTypeIn} body The payload containing the details of the shipment income type to be created.\r\n * @return {Observable<ShipmentIncomeTypeOut>} An observable that emits the created shipment income type data.\r\n */\r\n postShipmentIncomeType (body: ShipmentIncomeTypeIn): Observable<ShipmentIncomeTypeOut> {\r\n return this.http.post<ApiSuccess<ShipmentIncomeTypeOut>>(`${this.url}/shipment-income-types`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Updates the shipment income type with the specified ID.\r\n *\r\n * @param {number} id - The identifier of the shipment income type to update.\r\n * @param {ShipmentIncomeTypeIn} body - The data to update the shipment income type with.\r\n * @return {Observable<ShipmentIncomeTypeOut>} An observable emitting the updated shipment income type.\r\n */\r\n putShipmentIncomeType (id: number, body: ShipmentIncomeTypeIn): Observable<ShipmentIncomeTypeOut> {\r\n return this.http.put<ApiSuccess<ShipmentIncomeTypeOut>>(`${this.url}/shipment-income-types/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of unique folios based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters used to filter and fetch unique folios.\r\n * @return {Observable<UniqueFoliosOut>} An observable that emits the unique folios data.\r\n */\r\n getUniqueFolios (params: QueryParams): Observable<UniqueFoliosOut> {\r\n return this.http.get<ApiSuccess<UniqueFoliosOut>>(`${this.url}/unique-folios`, { params })\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Sends a POST request to create a unique folio.\r\n *\r\n * @param {UniqueFolioIn} body - The data object containing details for the unique folio to be created.\r\n * @return {Observable<UniqueFolioOut>} An observable that emits the created unique folio details.\r\n */\r\n postUniqueFolio (body: UniqueFolioIn): Observable<UniqueFolioOut> {\r\n return this.http.post<ApiSuccess<UniqueFolioOut>>(`${this.url}/unique-folios`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Updates a unique folio with the given data using the provided ID.\r\n *\r\n * @param {number} id - The ID of the unique folio to be updated.\r\n * @param {UniqueFolioIn} body - The payload containing the details of the unique folio to update.\r\n * @return {Observable<UniqueFolioOut>} An observable that emits the updated unique folio.\r\n */\r\n putUniqueFolio (id: number, body: UniqueFolioIn): Observable<UniqueFolioOut> {\r\n return this.http.put<ApiSuccess<UniqueFolioOut>>(`${this.url}/unique-folios/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Updates a unique folio by its identifier with the provided data.\r\n *\r\n * @param {number} id - The identifier of the unique folio to update.\r\n * @param {Partial<UniqueFolioIn>} body - The partial data of the unique folio to update.\r\n * @return {Observable<UniqueFolioOut>} An observable emitting the updated unique folio data.\r\n */\r\n pathUniqueFolio (id: number, body: Partial<UniqueFolioIn>): Observable<UniqueFolioOut> {\r\n return this.http.put<ApiSuccess<UniqueFolioOut>>(`${this.url}/unique-folios/${id}`, body)\r\n .pipe(map(({ data }) => data))\r\n }\r\n}\r\n","import { Inject, Injectable } from '@angular/core'\r\nimport { Environment } from '../ngx-services.models'\r\nimport { HttpClient } from '@angular/common/http'\r\nimport {\r\n AccountEntitiesActivesOut,\r\n BoardingProcessIdIn,\r\n BoardingProcessIn,\r\n CompanyCountriesOut,\r\n CompanyCountryOut,\r\n CompanyCountryTaxesOut,\r\n CountryReferenceCurrenciesOut,\r\n CountryReferenceOut,\r\n CountryReferencesOut,\r\n EmployeeCustomersIn,\r\n EmployeeCustomersOut,\r\n EmployeeOut,\r\n EmployeesCustomersOut,\r\n EmployeesOut,\r\n ExchangesOut,\r\n InstallationOut,\r\n InstallationsOut,\r\n LocationEmployeesOut,\r\n LocationOut,\r\n LocationsOut,\r\n ParametersIn,\r\n ParametersValuesOut,\r\n ParameterValueIn,\r\n ParameterValueOut,\r\n SupplyEntitiesActivesOut,\r\n WorkflowsOut\r\n} from './models/api-companies.types'\r\nimport { ApiSuccess, QueryParams } from './models/api.models'\r\nimport { forkJoin, map, mergeMap, Observable } from 'rxjs'\r\nimport { CountryCurrencyRate, EmployeeCustomerDhl, } from './models/api-companies.interfaces'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ApiCompaniesService {\r\n constructor (\r\n @Inject('env') private environments: Environment,\r\n private http: HttpClient\r\n ) { }\r\n\r\n /**\r\n * Retrieves the URL for the companies API from the environment configurations.\r\n *\r\n * @return {string} The URL of the companies API.\r\n */\r\n get url (): string {\r\n return this.environments.apiCompaniesUrl ?? ''\r\n }\r\n\r\n /**\r\n * Fetches the installations based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The parameters used to filter the installations query.\r\n * @return {Observable<InstallationsOut>} An observable that emits the installation's data.\r\n */\r\n getInstallations (params: QueryParams): Observable<InstallationsOut> {\r\n return this.http.get<ApiSuccess<InstallationsOut>>(`${this.url}/installations`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the installation details based on the given installation ID.\r\n *\r\n * @param {number} id - The unique identifier of the installation to retrieve.\r\n * @returns {Observable<InstallationOut>} An observable of the installation details.\r\n */\r\n getInstallation (id: number): Observable<InstallationOut> {\r\n return this.http.get<ApiSuccess<InstallationOut>>(`${this.url}/installations/${id}`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of locations based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The parameters to use for querying locations.\r\n * @return {Observable<LocationsOut>} An observable that emits the location's data.\r\n */\r\n getLocations (params: QueryParams): Observable<LocationsOut> {\r\n return this.http.get<ApiSuccess<LocationsOut>>(`${this.url}/locations`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the location details for a given location ID.\r\n *\r\n * @param {number} id - The unique identifier of the location.\r\n * @return {Observable<LocationOut>} An Observable containing the location details.\r\n */\r\n getLocation (id: number): Observable<LocationOut> {\r\n return this.http.get<ApiSuccess<LocationOut>>(`${this.url}/locations/${id}`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of active supply entities.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter supply entities.\r\n * @return {Observable<SupplyEntitiesActivesOut>} Observable emitting supply entities data.\r\n */\r\n getSupplyEntitiesActives (params: QueryParams): Observable<SupplyEntitiesActivesOut> {\r\n return this.http.get<ApiSuccess<SupplyEntitiesActivesOut>>(`${this.url}/supply-entities/actives`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches a list of employees based on the specified query parameters.\r\n *\r\n * @param {QueryParams} params - The parameters to filter and sort the employees.\r\n * @return {Observable<EmployeesOut>} An observable that emits the list of employees.\r\n */\r\n getEmployees (params: QueryParams): Observable<EmployeesOut> {\r\n return this.http.get<ApiSuccess<EmployeesOut>>(`${this.url}/employees`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches an employee's details based on the provided employee ID.\r\n *\r\n * @param {number} id - The unique identifier of the employee.\r\n * @return {Observable<EmployeeOut>} An observable that emits the employee's details.\r\n */\r\n getEmployee (id: number): Observable<EmployeeOut> {\r\n return this.http.get<ApiSuccess<EmployeeOut>>(`${this.url}/employees/${id}`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the list of employees for a specified location based on provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters used to filter and retrieve the location employees.\r\n * @returns {Observable<LocationEmployeesOut>} An observable that emits the list of employees for the specified location.\r\n */\r\n getLocationEmployees (params: QueryParams): Observable<LocationEmployeesOut> {\r\n return this.http.get<ApiSuccess<LocationEmployeesOut>>(`${this.url}/location-employees`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of countries where the company operates.\r\n *\r\n * @param {QueryParams} params - The query parameters for the API request.\r\n * @return {Observable<CompanyCountriesOut>} An observable containing the list of company countries.\r\n */\r\n getCompanyCountries (params: QueryParams): Observable<CompanyCountriesOut> {\r\n return this.http.get<ApiSuccess<CompanyCountriesOut>>(`${this.url}/company-countries`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the country information for a specified company by its ID.\r\n *\r\n * @param {number} id - The unique identifier of the company.\r\n * @return {Observable<CompanyCountryOut>} An observable containing the country information of the company.\r\n */\r\n getCompanyCountry (id: number): Observable<CompanyCountryOut> {\r\n return this.http.get<ApiSuccess<CompanyCountryOut>>(`${this.url}/company-countries/${id}`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the reference currencies for a given country.\r\n *\r\n * @param {QueryParams} params - The query parameters to include in the request.\r\n * @return {Observable<CountryReferenceCurrenciesOut>} The observable containing the country reference currencies data.\r\n */\r\n getCountryReferenceCurrencies (params: QueryParams): Observable<CountryReferenceCurrenciesOut> {\r\n return this.http.get<ApiSuccess<CountryReferenceCurrenciesOut>>(\r\n `${this.url}/country-reference-currencies`,\r\n { params }\r\n ).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of currencies for different countries along with their current exchange rates.\r\n *\r\n * @param {QueryParams} params - The query parameters used to fetch the country reference currencies.\r\n * @return {Observable<CountryCurrencyRate[]>} An observable that emits an array of country currency rates.\r\n */\r\n getCountryCurrenciesWithRate (params: QueryParams): Observable<CountryCurrencyRate[]> {\r\n return this.getCountryReferenceCurrencies(params)\r\n .pipe(mergeMap((currenciesData) => {\r\n const $observables = currenciesData.country_reference_currencies\r\n .map((item) =>\r\n this.getCurrentExchanges({\r\n currency_id: item.currency.id,\r\n }).pipe(\r\n map((exchangesData) => ({\r\n ...item,\r\n rate: exchangesData.exchanges[0]?.value,\r\n }))\r\n )\r\n )\r\n\r\n return forkJoin($observables)\r\n }))\r\n }\r\n\r\n /**\r\n * Fetches exchange data based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters for retrieving exchange data.\r\n * @return {Observable<ExchangesOut>} An observable containing the exchange data.\r\n */\r\n getExchanges (params: QueryParams): Observable<ExchangesOut> {\r\n return this.http.get<ApiSuccess<ExchangesOut>>(`${this.url}/exchanges`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the current exchanges based on the given query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters to filter the exchanges.\r\n *\r\n * @returns {Observable<ExchangesOut>} - An observable that emits the API response data containing the current exchanges.\r\n */\r\n getCurrentExchanges (params: QueryParams): Observable<ExchangesOut> {\r\n return this.http.get<ApiSuccess<ExchangesOut>>(`${this.url}/exchanges/current`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the country-specific tax information for a company.\r\n *\r\n * @param {QueryParams} params - The parameters used to filter and query the taxes.\r\n * @return {Observable<CompanyCountryTaxesOut>} An observable that emits the tax information.\r\n */\r\n getCompanyCountryTaxes (params: QueryParams): Observable<CompanyCountryTaxesOut> {\r\n return this.http.get<ApiSuccess<CompanyCountryTaxesOut>>(`${this.url}/company-country-taxes`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the list of active account entities based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The parameters to filter and query active account entities.\r\n * @return {Observable<AccountEntitiesActivesOut>} An observable that emits the list of active account entities.\r\n */\r\n getAccountEntitiesActives (params: QueryParams): Observable<AccountEntitiesActivesOut> {\r\n return this.http.get<ApiSuccess<AccountEntitiesActivesOut>>(`${this.url}/account-entities/actives`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the parameter values based on the provided parameter names.\r\n *\r\n * @param {Object} params - An object containing the required parameters.\r\n * @param {string[]} params.paramNames - An array of parameter names for which the values need to be fetched.\r\n * @return {Observable<ParametersValuesOut>} An observable that emits the fetched parameter values.\r\n */\r\n getParametersValues ({\r\n paramNames,\r\n }: ParametersIn): Observable<ParametersValuesOut> {\r\n const parameters = paramNames.map((p) => ({ name: p }))\r\n\r\n return this.http.post<ApiSuccess<ParametersValuesOut>>(`${this.url}/parameters-values`, {\r\n parameters\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves the value of a specified parameter.\r\n *\r\n * @param {Object} input - The input object containing the parameter details.\r\n * @param {string} input.paramName - The name of the parameter whose value is to be retrieved.\r\n * @return {Observable<ParameterValueOut>} An observable emitting the value of the specified parameter.\r\n */\r\n getParameterValue ({\r\n paramName,\r\n }: ParameterValueIn): Observable<ParameterValueOut> {\r\n return this.http.get<ApiSuccess<ParameterValueOut>>(`${this.url}/parameters-values/${paramName}`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Retrieves a list of country references based on the given query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters for retrieving country references.\r\n * @return {Observable<CountryReferencesOut>} An observable containing the country reference data.\r\n */\r\n getCountryReferences (params: QueryParams): Observable<CountryReferencesOut> {\r\n return this.http.get<ApiSuccess<CountryReferencesOut>>(`${this.url}/country-references`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the country reference data for a given country ID.\r\n *\r\n * @param {number} id - The unique identifier of the country for which the reference data is to be retrieved.\r\n * @return {Observable<CountryReferenceOut>} An observable containing the country reference data.\r\n */\r\n getCountryReference (id: number): Observable<CountryReferenceOut> {\r\n return this.http.get<ApiSuccess<CountryReferenceOut>>(`${this.url}/country-references/${id}`)\r\n .pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the list of workflows based on the provided query parameters.\r\n *\r\n * @param {QueryParams} params - The query parameters used to filter workflows.\r\n * @return {Observable<WorkflowsOut>} An observable containing the workflow data.\r\n */\r\n getWorkflows (params: QueryParams): Observable<WorkflowsOut> {\r\n return this.http.get<ApiSuccess<WorkflowsOut>>(`${this.url}/workflows`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Fetches the list of employee customer\r\n *\r\n * @param {QueryParams} params - The query parameters used to filter employee customers.\r\n * @return {Observable<EmployeeCustomersOut>} An observable containing the employee customer data.\r\n */\r\n getEmployeesCustomers (params: QueryParams): Observable<EmployeesCustomersOut> {\r\n return this.http.get<ApiSuccess<EmployeesCustomersOut>>(`${this.url}/employee-customers`, {\r\n params,\r\n }).pipe(map(({ data }) => data))\r\n }\r\n\r\n /**\r\n * Sends a POST request to create or update employee customer records and processes the server response.\r\n *\r\n * @param {EmployeeCustomersIn} body - The request payload containing employee customer data to be sent to the server.\r\n * @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee customer data on successful response.\r\n */\r\n postEmployeeCustomers (body: EmployeeCustomersIn) {\r\n return this.http.post<ApiSuccess<EmployeeCustomersOut>>(`${this.url}/employee-customers`,\r\n body\r\n ).pipe(\r\n map(({ data }) => data)\r\n )\r\n }\r\n\r\n /**\r\n * Updates the employee-customer association record identified by the given ID with the provided data.\r\n *\r\n * @param {number} id - The identifier of the employee-customer record to update.\r\n * @param {EmployeeCustomersIn} body - The data to update the employee-customer record with.\r\n * @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee-customer data.\r\n */\r\n putEmployeeCustomers (id: number, body: EmployeeCustomersIn) {\r\n return this.http.put<ApiSuccess<EmployeeCustomersOut>>(`${this.url}/employee-customers/${id}`, body\r\n ).pipe(\r\n map(({ data }) => data)\r\n )\r\n }\r\n\r\n /**\r\n * Fetches the employee-customer details based on the provided employee customer ID.\r\n *\r\n * @param {number} id - The identifier of the employee-customer record to update.\r\n * @return {Observable<EmployeeCustomersOut>} An observable that emits the updated employee-customer data.\r\n */\r\n getEmployeeCustomer (id: number) {\r\n return this.http.get<ApiSuccess<EmployeeCustomersOut>>(`${this.url}/employee-customers/${id}`\r\n ).pipe(\r\n map(({ data }) => data)\r\n )\r\n }\r\n\r\n /**\r\n * Enables or disables an employee customer's active state.\r\n *\r\n * @param {EmployeeCustomerDhl} employee - The employee customer object to be updated.\r\n * @param {boolean} [isActive] - Optional parameter to explicitly set the active state.\r\n * If null or undefined, the active state will be toggled.\r\n * @return {Observable<EmployeeCustomersOut>} An observable containing the updated employee customer output.\r\n */\r\n enableDisableEmployeeCustomers (employee: EmployeeCustomerDhl, isActive?: boolean): Observable<EmployeeCustomersOut> {\r\n return this.http.patch<ApiSuccess<EmployeeCustomersOut>>(`${this.url}/employee-customers/${employee.id}`, {\r\n is_active: isActive ?? !employee.is_active\r\n }).pipe(\r\n map(({ data }) => data)\r\n )\r\n }\r\n\r\n /**\r\n * Submits a file containing employee customer data for a specific country to the server.\r\n *\r\n * @param {number} countryId - The identifier of the country for which the data is being uploaded.\r\n * @param {File} file - The file containing employee customer data to be uploaded.\r\n * @return {Observable<BoardingProcessIdIn>} Observable that emits the processed boarding process ID on success.\r\n */\r\n postEmployeeCustomersLoad (countryId: number, file: File) {\r\n const formData = new FormData()\r\n formData.append('file', file)\r\n formData.append('country_id', countryId.toString())\r\n return this.http.post<ApiSuccess<BoardingProcessIdIn>>(\r\n `${this.url}/employee-customers/load`,\r\n formData\r\n ).pipe(\r\n map(({ data }) => data)\r\n )\r\n }\r\n\r\n /**\r\n * Downloads a file containing customer data for a specific employee based on the provided country ID.\r\n *\r\n * @param {number} id - The ID of the country used as a filter for fetching the employee's customers.\r\n * @return {Observable<Blob>} An observable that emits the file blob containing the customer data.\r\n */\r\n getEmployeeCustomersDownload (id:number):Observable<Blob> {\r\n return this.http.get(`${this.url}/employee-customers/download`, {\r\n params: { country_id: id },\r\n responseType: 'blob'\r\n })\r\n }\r\n\r\n /**\r\n * Retrieves the boarding process details for a given ID.\r\n *\r\n * @param {number} id - The unique identifier of the boarding process to retrieve.\r\n * @return {Observable<BoardingProcessIn>} An observable containing the boarding process details.\r\n */\r\n getBoardingProcess (id:number) {\r\n return this.http.get<ApiSuccess<BoardingProcessIn>>(`${this.url}/boarding-process/${id}`\r\n ).pipe(\r\n map(({ data }) => data)\r\n )\r\n }\r\n}\r\n","import { HttpClient } from '@angular/common/http'\r\nimport { Inject, Injectable } from '@angular/core'\r\nimport { map, Observable } from 'rxjs'\r\nimport { Environment } from '../ngx-services.models'\r\nimport { ApiSuccess, QueryParams } from './models/api.models'\r\nimport {\r\n ExternalShipmentAddressesIn,\r\n ExternalShipmentAddressesOut,\r\n ExternalShipmentFileOut,\r\n ExternalShipmentHistoriesOut,\r\n ExternalShipmentStatusOut\r\n} from './models/api-e-tools-a