@experteam-mx/ngx-services 18.8.23 → 18.8.24

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.
@@ -0,0 +1,54 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { Environment } from '../ngx-services.models';
4
+ import { DeliveryConfirmationCompleteIn, DeliveryConfirmationGenerateIn, DeliveryConfirmationGenerateOut, DeliveryConfirmationIn, DeliveryConfirmationSearchOut } from './models/api-external-ops.types';
5
+ import * as i0 from "@angular/core";
6
+ export declare class ApiExternalOperationsService {
7
+ private http;
8
+ private environment;
9
+ private appKey;
10
+ constructor(http: HttpClient, environment: Environment);
11
+ /**
12
+ * Getter method to retrieve the API's external operations URL.
13
+ * Fetches the URL from the `apiExternalOperationsUrl` property of the environment object.
14
+ * Defaults to an empty string if the property is undefined or null.
15
+ *
16
+ * @return {string} The external operations URL or an empty string if unavailable.
17
+ */
18
+ get url(): string;
19
+ /**
20
+ * Retrieves delivery confirmation details based on the provided OTP code.
21
+ *
22
+ * @param {string} otpCode - The OTP code used to search for delivery confirmation.
23
+ * @return {Observable<DeliveryConfirmationData>} An observable containing the delivery confirmation data.
24
+ */
25
+ getDeliveryConfirmation(otpCode: string): Observable<DeliveryConfirmationSearchOut>;
26
+ /**
27
+ * Generates a delivery confirmation by sending the provided payload to the API.
28
+ *
29
+ * @param {DeliveryConfirmationGenerateIn} payload - The input payload required to generate the delivery confirmation.
30
+ * @return {Observable<DeliveryConfirmationGenerateOut>} An observable that emits the generated delivery confirmation data.
31
+ */
32
+ postDeliveryConfirmationGenerate(payload: DeliveryConfirmationGenerateIn): Observable<DeliveryConfirmationGenerateOut>;
33
+ /**
34
+ * Confirms the completion of a delivery operation by making a PATCH request.
35
+ *
36
+ * @param {Object} input - The input parameters for the method.
37
+ * @param {string} input.operationId - The unique identifier of the delivery operation to be confirmed.
38
+ * @param {string} input.keyOTP - The one-time password (OTP) key associated with the delivery confirmation.
39
+ * @return {Observable<Object>} - An observable containing the response data from the API.
40
+ */
41
+ patchDeliveryConfirmationComplete({ keyOTP, operationId, }: DeliveryConfirmationCompleteIn): Observable<{}>;
42
+ /**
43
+ * Cancels a delivery confirmation by sending an OTP and additional data to the server.
44
+ *
45
+ * @param {Object} param0 - The parameter object containing the required properties.
46
+ * @param {string} param0.otp - The one-time password to authenticate the cancellation request.
47
+ * @param {Object} param0.body - Additional body data required for cancellation.
48
+ * @return {Observable<Object>} An observable that emits the server's response when the cancellation is processed.
49
+ */
50
+ putDeliveryConfirmation({ otp, ...body }: DeliveryConfirmationIn): Observable<{}>;
51
+ private getAppKeyHeader;
52
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApiExternalOperationsService, never>;
53
+ static ɵprov: i0.ɵɵInjectableDeclaration<ApiExternalOperationsService>;
54
+ }
@@ -0,0 +1,65 @@
1
+ import { Environment } from '../ngx-services.models';
2
+ import { HttpClient } from '@angular/common/http';
3
+ import { QueryParams } from './models/api.models';
4
+ import { Observable } from 'rxjs';
5
+ import { QuoteEventIn, QuoteEventOut, QuoteEventsOut, QuoteEventTypesOut } from './models/api-quote.types';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Service to manage quote-related events.
9
+ *
10
+ * This service provides methods to retrieve, create, and get event types
11
+ * related to quote processes.
12
+ */
13
+ export declare class ApiQuoteService {
14
+ private environments;
15
+ private http;
16
+ constructor(environments: Environment, http: HttpClient);
17
+ /**
18
+ * Base URL for the Quotes API.
19
+ */
20
+ get url(): string;
21
+ /**
22
+ * Retrieves all registered events for a specific quote.
23
+ *
24
+ * @param id - Quote identifier.
25
+ * @param params - Optional query parameters such as pagination or filtering.
26
+ * @returns Observable containing the list of quote events.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * this.apiQuoteService.getQuoteEvents(10, { page: 1 })
31
+ * .subscribe((events) => console.log(events))
32
+ * ```
33
+ */
34
+ getQuoteEvents(id: number, params: QueryParams): Observable<QuoteEventsOut>;
35
+ /**
36
+ * Registers a new event related to a specific quote.
37
+ *
38
+ * @param id - Quote identifier.
39
+ * @param body - Event payload to be created.
40
+ * @returns Observable containing the newly created event.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const event: QuoteEventIn = { code: 'WON', note: 'Client approved' }
45
+ * this.apiQuoteService.postQuoteEvents(10, event)
46
+ * .subscribe((response) => console.log(response))
47
+ * ```
48
+ */
49
+ postQuoteEvents(id: number, body: QuoteEventIn): Observable<QuoteEventOut>;
50
+ /**
51
+ * Retrieves the available quote event types.
52
+ *
53
+ * @param params - Optional query parameters such as pagination or filtering.
54
+ * @returns Observable containing the list of event types.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * this.apiQuoteService.getQuoteEventTypes({ page: 1 })
59
+ * .subscribe((types) => console.log(types))
60
+ * ```
61
+ */
62
+ getQuoteEventTypes(params: QueryParams): Observable<QuoteEventTypesOut>;
63
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApiQuoteService, never>;
64
+ static ɵprov: i0.ɵɵInjectableDeclaration<ApiQuoteService>;
65
+ }
@@ -0,0 +1,21 @@
1
+ import { LaravelModel } from './api.models';
2
+ export interface Operation extends LaravelModel {
3
+ _id: string;
4
+ operation_id: number;
5
+ status: 'Pending' | 'Completed' | 'Canceled';
6
+ code: number;
7
+ signature: {
8
+ signature_base_64: string;
9
+ mime_type: 'image/png';
10
+ client: {
11
+ full_name: string;
12
+ };
13
+ package_detail: {
14
+ shipment_tracking_number: string;
15
+ pieces: {
16
+ tracking_number: string;
17
+ status: null | 'damaged' | 'lost';
18
+ }[];
19
+ }[];
20
+ };
21
+ }
@@ -0,0 +1,35 @@
1
+ import { Operation } from './api-external-ops.interfaces';
2
+ export type DeliveryConfirmationGenerateOut = {
3
+ code: string;
4
+ };
5
+ export type DeliveryConfirmationGenerateIn = {
6
+ operation_id: number;
7
+ signature: {
8
+ client: {
9
+ full_name: string;
10
+ };
11
+ package_detail: {
12
+ shipment_tracking_number: string;
13
+ pieces: {
14
+ tracking_number: string;
15
+ status: string;
16
+ }[];
17
+ }[];
18
+ };
19
+ };
20
+ export type DeliveryConfirmationCompleteIn = {
21
+ operationId: number;
22
+ keyOTP: string;
23
+ };
24
+ export type DeliveryConfirmationIn = {
25
+ signature: {
26
+ status: string;
27
+ operation_id: number;
28
+ signature_base_64: string;
29
+ mime_type: string;
30
+ };
31
+ otp?: string;
32
+ };
33
+ export type DeliveryConfirmationSearchOut = {
34
+ operation: Operation;
35
+ };
@@ -0,0 +1,13 @@
1
+ import { ActiveLessSymfonyModel, SymfonyModel } from './api.models';
2
+ export interface QuoteEvent extends ActiveLessSymfonyModel {
3
+ date: string;
4
+ quoteEventType: QuoteEventType;
5
+ comment: string;
6
+ userId: number;
7
+ userUsername: string;
8
+ userName: string;
9
+ }
10
+ export interface QuoteEventType extends SymfonyModel {
11
+ code: string;
12
+ name: string;
13
+ }
@@ -0,0 +1,17 @@
1
+ import { QuoteEvent, QuoteEventType } from './api-quote.interfaces';
2
+ export type QuoteEventsOut = {
3
+ total: number;
4
+ quoteEvents: QuoteEvent[];
5
+ };
6
+ export type QuoteEventIn = {
7
+ date: string;
8
+ quoteEventTypeId: number;
9
+ comment: string;
10
+ };
11
+ export interface QuoteEventOut {
12
+ quoteEvent: QuoteEvent;
13
+ }
14
+ export interface QuoteEventTypesOut {
15
+ total: number;
16
+ quoteEventTypes: QuoteEventType[];
17
+ }
@@ -0,0 +1,35 @@
1
+ import { HttpEvent, HttpHandlerFn, HttpRequest } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ /**
4
+ * HTTP interceptor that injects the external operations API key into outbound requests.
5
+ *
6
+ * The interceptor:
7
+ * 1. Reads `apiExternalOperationsKey` from the injected `ENVIRONMENT_TOKEN`.
8
+ * 2. Skips modification if the key is absent.
9
+ * 3. Leaves the request unchanged if it already contains an `AppKey` header (caller override).
10
+ * 4. Otherwise clones the request adding `AppKey: apiExternalOperationsKey`.
11
+ *
12
+ * This enables centralized, transparent authentication for services targeting external
13
+ * operations endpoints while allowing explicit per-request overrides.
14
+ *
15
+ * Example:
16
+ * ```ts
17
+ * provideHttpClient(
18
+ * withInterceptors([apiKeyInterceptor])
19
+ * );
20
+ * ```
21
+ *
22
+ * @param request The original immutable `HttpRequest` instance.
23
+ * @param next The next handler in the interceptor chain, used to forward the (possibly cloned) request.
24
+ * @returns An `Observable` stream of the HTTP events for the (potentially augmented) request.
25
+ *
26
+ * @remarks
27
+ * - If you need to intentionally send a different key for a specific request, set the `AppKey`
28
+ * header manually before this interceptor runs.
29
+ * - If `apiExternalOperationsKey` is undefined (e.g., missing configuration), the request is passed through unchanged.
30
+ * - Order matters: place this interceptor before others that rely on the presence of the `AppKey` header.
31
+ *
32
+ * @see HttpRequest
33
+ * @see HttpHandlerFn
34
+ */
35
+ export declare function apiKeyInterceptor(request: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
@@ -27,14 +27,15 @@ export type Environment = {
27
27
  apiCompositionUrl?: string;
28
28
  apiCustomsUrl?: string;
29
29
  apiDiscountsUrl?: string;
30
- apiEventsUrl?: string;
31
30
  apiEToolsAutoBilling?: string;
31
+ apiEventsUrl?: string;
32
32
  apiExternalOperationsKey?: string;
33
33
  apiExternalOperationsUrl?: string;
34
34
  apiInventoriesUrl?: string;
35
35
  apiInvoicesUrl?: string;
36
36
  apiNotificationsUrl?: string;
37
37
  apiOpenItemsUrl?: string;
38
+ apiQuotesUrl?: string;
38
39
  apiReportsUrl?: string;
39
40
  apiSecurityUrl?: string;
40
41
  apiServicesUrl?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experteam-mx/ngx-services",
3
- "version": "18.8.23",
3
+ "version": "18.8.24",
4
4
  "description": "Angular common services for Experteam apps",
5
5
  "author": "Experteam Cía. Ltda.",
6
6
  "keywords": [
package/public-api.d.ts CHANGED
@@ -11,13 +11,14 @@ export * from './lib/apis/api-companies.service';
11
11
  export * from './lib/apis/api-composition.service';
12
12
  export * from './lib/apis/api-customs.service';
13
13
  export * from './lib/apis/api-discounts.service';
14
- export * from './lib/apis/api-events.service';
15
14
  export * from './lib/apis/api-e-tools-auto-billing.service';
15
+ export * from './lib/apis/api-events.service';
16
16
  export * from './lib/apis/api-external-pickups.service';
17
17
  export * from './lib/apis/api-inventories.service';
18
18
  export * from './lib/apis/api-invoices.service';
19
19
  export * from './lib/apis/api-notifications.service';
20
20
  export * from './lib/apis/api-open-items.service';
21
+ export * from './lib/apis/api-quote.service';
21
22
  export * from './lib/apis/api-reports.service';
22
23
  export * from './lib/apis/api-security.service';
23
24
  export * from './lib/apis/api-services.service';
@@ -60,6 +61,8 @@ export * from './lib/apis/models/api-notifications.interfaces';
60
61
  export * from './lib/apis/models/api-notifications.types';
61
62
  export * from './lib/apis/models/api-open-items.interfaces';
62
63
  export * from './lib/apis/models/api-open-items.types';
64
+ export * from './lib/apis/models/api-quote.interfaces';
65
+ export * from './lib/apis/models/api-quote.types';
63
66
  export * from './lib/apis/models/api-reports.interfaces';
64
67
  export * from './lib/apis/models/api-reports.types';
65
68
  export * from './lib/apis/models/api-security.interfaces';