@experteam-mx/ngx-services 20.0.0 → 20.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # NgxServices
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.0.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project ngx-services` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-services`.
8
- > Note: Don't forget to add `--project ngx-services` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build ngx-services` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build ngx-services`, go to the dist folder `cd dist/ngx-services` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test ngx-services` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
1
+ # NgxServices
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project ngx-services` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-services`.
8
+ > Note: Don't forget to add `--project ngx-services` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build ngx-services` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build ngx-services`, go to the dist folder `cd dist/ngx-services` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test ngx-services` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -531,7 +531,7 @@ class ApiCatalogsService {
531
531
  * @param body - The identification type payload to create (IdentificationTypeIn).
532
532
  * @returns Observable<IdentificationTypeOut> that emits the created identification type on success.
533
533
  */
534
- postIdentificationtType(body) {
534
+ postIdentificationType(body) {
535
535
  return this.http.post(`${this.url}/identification-types`, body)
536
536
  .pipe(map(({ data }) => data));
537
537
  }
@@ -567,6 +567,21 @@ class ApiCatalogsService {
567
567
  return this.http.delete(`${this.url}/identification-types/${id}`)
568
568
  .pipe(map(({ data }) => data));
569
569
  }
570
+ /**
571
+ * Sends a POST request to validate identification type number.
572
+ *
573
+ * The request payload is sent as an object with a `body` property containing the provided
574
+ * IdentificationTypeNumberValidationIn value (i.e. { body: IdentificationTypeNumberValidationIn }). On success the HTTP response is expected
575
+ * to follow the ApiSuccess<T> shape; the operator maps that response to the inner `data`
576
+ * object and emits it as a IdentificationTypeNumberValidationOut.
577
+ *
578
+ * @param body - The identification type number validation payload to validate (IdentificationTypeNumberValidationIn).
579
+ * @returns Observable<IdentificationTypeNumberValidationOut> that emits the validate status.
580
+ */
581
+ postIdentificationTypeNumberValidation(body) {
582
+ return this.http.post(`${this.url}/identification-types/number-validation`, body)
583
+ .pipe(map(({ data }) => data));
584
+ }
570
585
  /**
571
586
  * Fetches the extra charges based on the provided query parameters.
572
587
  *
@@ -1045,6 +1060,14 @@ class ApiCatalogsService {
1045
1060
  return this.http.delete(`${this.url}/holidays/${id}`)
1046
1061
  .pipe(map(({ data }) => data));
1047
1062
  }
1063
+ /**
1064
+ * Retrieves a list of business party trader types
1065
+ * @param {QueryParams} params - Query parameters for filtering and pagination (optional)
1066
+ * @returns {Observable<BusinessPartyTraderTypesOut>} Observable containing the list of trader types
1067
+ */
1068
+ getBusinessPartyTraderTypes(params) {
1069
+ return this.http.get(`${this.url}/business-party-trader-types`, { params }).pipe(map(({ data }) => data));
1070
+ }
1048
1071
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiCatalogsService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1049
1072
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiCatalogsService, providedIn: 'root' });
1050
1073
  }
@@ -2907,6 +2930,20 @@ class ApiInventoriesService {
2907
2930
  return this.http.delete(`${this.url}/incident-reason-complements/${id}`)
2908
2931
  .pipe(map(({ data }) => data));
2909
2932
  }
2933
+ /**
2934
+ * Posts packages that are currently in stock.
2935
+ *
2936
+ * @param body - The input data containing package stock information
2937
+ * @returns {Observable<PackagesInStockOut>} An Observable that emits the packages in stock output data
2938
+ *
2939
+ * @remarks
2940
+ * This method sends a POST request to the `/packages/in-stock` endpoint and
2941
+ * extracts the data property from the API success response.
2942
+ */
2943
+ postPackagesInStock(body) {
2944
+ return this.http.post(`${this.url}/packages/in-stock`, body)
2945
+ .pipe(map(({ data }) => data));
2946
+ }
2910
2947
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiInventoriesService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2911
2948
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiInventoriesService, providedIn: 'root' });
2912
2949
  }
@@ -3472,6 +3509,89 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
3472
3509
  args: ['env']
3473
3510
  }] }, { type: i1.HttpClient }] });
3474
3511
 
3512
+ /**
3513
+ * Service to manage quote-related events.
3514
+ *
3515
+ * This service provides methods to retrieve, create, and get event types
3516
+ * related to quote processes.
3517
+ */
3518
+ class ApiQuoteService {
3519
+ environments;
3520
+ http;
3521
+ constructor(environments, http) {
3522
+ this.environments = environments;
3523
+ this.http = http;
3524
+ }
3525
+ /**
3526
+ * Base URL for the Quotes API.
3527
+ */
3528
+ get url() {
3529
+ return this.environments.apiQuotesUrl ?? '';
3530
+ }
3531
+ /**
3532
+ * Retrieves all registered events for a specific quote.
3533
+ *
3534
+ * @param id - Quote identifier.
3535
+ * @param params - Optional query parameters such as pagination or filtering.
3536
+ * @returns Observable containing the list of quote events.
3537
+ *
3538
+ * @example
3539
+ * ```ts
3540
+ * this.apiQuoteService.getQuoteEvents(10, { page: 1 })
3541
+ * .subscribe((events) => console.log(events))
3542
+ * ```
3543
+ */
3544
+ getQuoteEvents(id, params) {
3545
+ return this.http.get(`${this.url}/quotes/${id}/quote-events`, { params })
3546
+ .pipe(map(({ data }) => data));
3547
+ }
3548
+ /**
3549
+ * Registers a new event related to a specific quote.
3550
+ *
3551
+ * @param id - Quote identifier.
3552
+ * @param body - Event payload to be created.
3553
+ * @returns Observable containing the newly created event.
3554
+ *
3555
+ * @example
3556
+ * ```ts
3557
+ * const event: QuoteEventIn = { code: 'WON', note: 'Client approved' }
3558
+ * this.apiQuoteService.postQuoteEvents(10, event)
3559
+ * .subscribe((response) => console.log(response))
3560
+ * ```
3561
+ */
3562
+ postQuoteEvents(id, body) {
3563
+ return this.http.post(`${this.url}/quotes/${id}/quote-events`, body)
3564
+ .pipe(map(({ data }) => data));
3565
+ }
3566
+ /**
3567
+ * Retrieves the available quote event types.
3568
+ *
3569
+ * @param params - Optional query parameters such as pagination or filtering.
3570
+ * @returns Observable containing the list of event types.
3571
+ *
3572
+ * @example
3573
+ * ```ts
3574
+ * this.apiQuoteService.getQuoteEventTypes({ page: 1 })
3575
+ * .subscribe((types) => console.log(types))
3576
+ * ```
3577
+ */
3578
+ getQuoteEventTypes(params) {
3579
+ return this.http.get(`${this.url}/quote-event-types`, { params })
3580
+ .pipe(map(({ data }) => data));
3581
+ }
3582
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiQuoteService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
3583
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiQuoteService, providedIn: 'root' });
3584
+ }
3585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiQuoteService, decorators: [{
3586
+ type: Injectable,
3587
+ args: [{
3588
+ providedIn: 'root'
3589
+ }]
3590
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
3591
+ type: Inject,
3592
+ args: ['env']
3593
+ }] }, { type: i1.HttpClient }] });
3594
+
3475
3595
  class ApiReportsService {
3476
3596
  environments;
3477
3597
  http;
@@ -3508,6 +3628,34 @@ class ApiReportsService {
3508
3628
  return this.http.get(`${this.url}/shipments-report`, { params })
3509
3629
  .pipe(map(({ data }) => data));
3510
3630
  }
3631
+ /**
3632
+ * Retrieves the shipments landing report from the reports API.
3633
+ *
3634
+ * Sends a GET request to the `/shipments-landing-report` endpoint with the provided query parameters.
3635
+ * The HTTP response is expected to be wrapped in an `ApiSuccess` envelope, from which the `data`
3636
+ * payload is extracted and returned as the stream value.
3637
+ *
3638
+ * @param params - Query parameters used to filter or paginate the shipments landing report.
3639
+ * @returns An observable that emits the parsed `ShipmentsLandingReportOut` data from the API response.
3640
+ *
3641
+ * @remarks
3642
+ * - The underlying HTTP call uses `HttpClient.get` with `params` serialized as query string values.
3643
+ * - The response is piped through `map` to unwrap `data` from `ApiSuccess<T>`.
3644
+ * - Errors from the HTTP request are propagated through the observable stream.
3645
+ *
3646
+ * @example
3647
+ * ```ts
3648
+ * // Basic usage:
3649
+ * service.getShipmentsLandingReport({ page: 1, perPage: 25 })
3650
+ * .subscribe(report => {
3651
+ * // handle ShipmentsLandingReportOut
3652
+ * });
3653
+ * ```
3654
+ */
3655
+ getShipmentsLandingReport(params) {
3656
+ return this.http.get(`${this.url}/shipments-landing-report`, { params })
3657
+ .pipe(map(({ data }) => data));
3658
+ }
3511
3659
  /**
3512
3660
  * Retrieves a report of external shipments based on the provided query parameters.
3513
3661
  *
@@ -3583,6 +3731,22 @@ class ApiReportsService {
3583
3731
  return this.http.get(`${this.url}/invoices`, { params })
3584
3732
  .pipe(map(({ data }) => data));
3585
3733
  }
3734
+ /**
3735
+ * Retrieves the sales book report based on the provided query parameters.
3736
+ *
3737
+ * @param params - The query parameters to filter or customize the report.
3738
+ * @returns An Observable that emits the sales book report data.
3739
+ *
3740
+ * @example
3741
+ * ```typescript
3742
+ * this.apiReportsService.getSalesBookReport({ page: 1, limit: 10 })
3743
+ * .subscribe(report => console.log(report));
3744
+ * ```
3745
+ */
3746
+ getSalesBookReport(params) {
3747
+ return this.http.get(`${this.url}/sales-book-report`, { params })
3748
+ .pipe(map(({ data }) => data));
3749
+ }
3586
3750
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiReportsService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
3587
3751
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiReportsService, providedIn: 'root' });
3588
3752
  }
@@ -3621,7 +3785,11 @@ class ApiSecurityService {
3621
3785
  */
3622
3786
  postAuthLogin(body) {
3623
3787
  return this.http.post(`${this.url}/auth/login`, body)
3624
- .pipe(map(({ data }) => data), tap(({ access_token }) => this.cookie.set(this.environments.authCookie, access_token, { path: '/' })));
3788
+ .pipe(map(({ data }) => data), tap(({ access_token }) => {
3789
+ if (this.environments.authCookie) {
3790
+ this.cookie.set(this.environments.authCookie, access_token, { path: '/' });
3791
+ }
3792
+ }));
3625
3793
  }
3626
3794
  /**
3627
3795
  * Handles the user login process by sending user credentials to the authentication endpoint.
@@ -3642,7 +3810,11 @@ class ApiSecurityService {
3642
3810
  */
3643
3811
  postAuthLogout() {
3644
3812
  return this.http.post(`${this.url}/auth/logout`, null)
3645
- .pipe(map(({ data }) => data), tap(() => this.cookie.delete(this.environments.authCookie, '/')));
3813
+ .pipe(map(({ data }) => data), tap(() => {
3814
+ if (this.environments.authCookie) {
3815
+ this.cookie.delete(this.environments.authCookie, '/');
3816
+ }
3817
+ }));
3646
3818
  }
3647
3819
  /**
3648
3820
  * Creates a new session for a specified model.
@@ -4004,6 +4176,35 @@ class ApiShipmentsService {
4004
4176
  params
4005
4177
  }).pipe(map(({ data }) => data));
4006
4178
  }
4179
+ /**
4180
+ * Retrieves a paginated list of embassy shipments
4181
+ * @param {QueryParams} params - Query parameters for filtering and pagination
4182
+ * @returns {Observable<EmbassyShipmentsOut>} Observable containing the list of shipments and pagination metadata
4183
+ */
4184
+ getEmbassyShipments(params) {
4185
+ return this.http.get(`${this.url}/embassy-shipments`, {
4186
+ params
4187
+ }).pipe(map(({ data }) => data));
4188
+ }
4189
+ /**
4190
+ * Creates a new embassy shipment
4191
+ * @param {EmbassyShipmentIn} body - The shipment data to create
4192
+ * @returns {Observable<EmbassyShipmentOut>} Observable containing the created shipment with its assigned ID
4193
+ */
4194
+ postEmbassyShipments(body) {
4195
+ return this.http.post(`${this.url}/embassy-shipments`, body)
4196
+ .pipe(map(({ data }) => data));
4197
+ }
4198
+ /**
4199
+ * Updates an existing embassy shipment
4200
+ * @param {number} id - The unique identifier of the shipment to update
4201
+ * @param {EmbassyShipmentIn} body - The updated shipment data
4202
+ * @returns {Observable<EmbassyShipmentOut>} Observable containing the updated shipment
4203
+ */
4204
+ putEmbassyShipments(id, body) {
4205
+ return this.http.put(`${this.url}/embassy-shipments/${id}`, body)
4206
+ .pipe(map(({ data }) => data));
4207
+ }
4007
4208
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiShipmentsService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
4008
4209
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: ApiShipmentsService, providedIn: 'root' });
4009
4210
  }
@@ -4333,6 +4534,9 @@ class CryptoService {
4333
4534
  return decoder.decode(decrypted);
4334
4535
  }
4335
4536
  async loadKey() {
4537
+ if (!this.environments.secretKey) {
4538
+ throw new Error('The secret key is not defined in the environment configuration.');
4539
+ }
4336
4540
  // Decode the base64 key to Uint8Array
4337
4541
  const rawKey = this.base64ToUint8Array(this.environments.secretKey);
4338
4542
  // Import the key to API Crypto
@@ -4403,16 +4607,6 @@ function apiHeadersInterceptor(req, next) {
4403
4607
  return next(req);
4404
4608
  }
4405
4609
  let headers = req.headers;
4406
- const noCacheHeaders = {
4407
- 'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
4408
- Pragma: 'no-cache',
4409
- Expires: '0',
4410
- };
4411
- Object.entries(noCacheHeaders).forEach(([key, value]) => {
4412
- if (!headers.has(key)) {
4413
- headers = headers.set(key, value);
4414
- }
4415
- });
4416
4610
  if (!headers.has('Content-Type') && !(req.body instanceof FormData)) {
4417
4611
  headers = headers.set('Content-Type', 'application/json');
4418
4612
  }
@@ -4487,7 +4681,7 @@ function apiKeyInterceptor(request, next) {
4487
4681
  function apiTokenInterceptor(req, next) {
4488
4682
  const { authCookie } = inject(ENVIRONMENT_TOKEN);
4489
4683
  const cookie = inject(CookieService);
4490
- if (req.headers.has('Authorization') || req.headers.has('AppKey')) {
4684
+ if (req.headers.has('Authorization') || req.headers.has('AppKey') || !authCookie) {
4491
4685
  return next(req);
4492
4686
  }
4493
4687
  const token = cookie.get(authCookie);
@@ -4615,5 +4809,5 @@ const xmlHeaders = (format = 'object') => {
4615
4809
  * Generated bundle index. Do not edit.
4616
4810
  */
4617
4811
 
4618
- export { AlphaNumeric, ApiBillingDOService, ApiBillingGtService, ApiBillingMxService, ApiBillingPaService, ApiBillingSvService, ApiCashOperationsService, ApiCatalogsService, ApiCompaniesService, ApiCompositionService, ApiCustomsService, ApiDiscountsService, ApiEToolsAutoBillingService, ApiEventsService, ApiExternalOperationsService, ApiInventoriesService, ApiInvoicesService, ApiNotificationsService, ApiOpenItemsService, ApiReportsService, ApiSecurityService, ApiServicesService, ApiShipmentsService, ApiSuppliesService, CryptoService, DefaultValueType, ENVIRONMENT_TOKEN, Event, NgxServicesModule, OperationModuleStatus, ViewSectionOption, WebSocketsService, apiHeadersInterceptor, apiKeyInterceptor, apiTokenInterceptor, base64PdfToUrl, downloadBase64Pdf, httpCachingInterceptor, httpParams, pdfHeaders, queryString, xmlHeaders };
4812
+ export { AlphaNumeric, ApiBillingDOService, ApiBillingGtService, ApiBillingMxService, ApiBillingPaService, ApiBillingSvService, ApiCashOperationsService, ApiCatalogsService, ApiCompaniesService, ApiCompositionService, ApiCustomsService, ApiDiscountsService, ApiEToolsAutoBillingService, ApiEventsService, ApiExternalOperationsService, ApiInventoriesService, ApiInvoicesService, ApiNotificationsService, ApiOpenItemsService, ApiQuoteService, ApiReportsService, ApiSecurityService, ApiServicesService, ApiShipmentsService, ApiSuppliesService, CryptoService, DefaultValueType, ENVIRONMENT_TOKEN, Event, NgxServicesModule, OperationModuleStatus, ViewSectionOption, WebSocketsService, apiHeadersInterceptor, apiKeyInterceptor, apiTokenInterceptor, base64PdfToUrl, downloadBase64Pdf, httpCachingInterceptor, httpParams, pdfHeaders, queryString, xmlHeaders };
4619
4813
  //# sourceMappingURL=experteam-mx-ngx-services.mjs.map