@experteam-mx/ngx-services 18.3.5 → 18.3.7

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.
Files changed (51) hide show
  1. package/esm2022/lib/apis/api-billing-do.service.mjs +41 -0
  2. package/esm2022/lib/apis/api-billing-mx.service.mjs +62 -0
  3. package/esm2022/lib/apis/api-companies.service.mjs +20 -21
  4. package/esm2022/lib/apis/api-external-pickups.service.mjs +72 -0
  5. package/esm2022/lib/apis/api-invoices.service.mjs +69 -9
  6. package/esm2022/lib/apis/api-open-items.service.mjs +6 -6
  7. package/esm2022/lib/apis/api-reports.service.mjs +11 -1
  8. package/esm2022/lib/apis/api-security.service.mjs +22 -33
  9. package/esm2022/lib/apis/api-shipments.service.mjs +3 -3
  10. package/esm2022/lib/apis/models/api-billing.interfaces.mjs +2 -0
  11. package/esm2022/lib/apis/models/api-billing.types.mjs +2 -0
  12. package/esm2022/lib/apis/models/api-catalog.interfaces.mjs +1 -1
  13. package/esm2022/lib/apis/models/api-companies.types.mjs +1 -1
  14. package/esm2022/lib/apis/models/api-external-pickups.types.mjs +2 -0
  15. package/esm2022/lib/apis/models/api-invoices.interfaces.mjs +1 -1
  16. package/esm2022/lib/apis/models/api-invoices.types.mjs +1 -1
  17. package/esm2022/lib/apis/models/api-open-items.interfaces.mjs +1 -1
  18. package/esm2022/lib/apis/models/api-open-items.types.mjs +1 -1
  19. package/esm2022/lib/apis/models/api-reports.types.mjs +1 -1
  20. package/esm2022/lib/apis/models/api-security.interfaces.mjs +1 -1
  21. package/esm2022/lib/apis/models/api-security.types.mjs +1 -1
  22. package/esm2022/lib/ngx-services.models.mjs +1 -1
  23. package/esm2022/lib/websockets/web-sockets.service.mjs +115 -0
  24. package/esm2022/public-api.mjs +10 -1
  25. package/fesm2022/experteam-mx-ngx-services.mjs +469 -134
  26. package/fesm2022/experteam-mx-ngx-services.mjs.map +1 -1
  27. package/lib/apis/api-billing-do.service.d.ts +24 -0
  28. package/lib/apis/api-billing-mx.service.d.ts +39 -0
  29. package/lib/apis/api-companies.service.d.ts +9 -9
  30. package/lib/apis/api-external-pickups.service.d.ts +45 -0
  31. package/lib/apis/api-invoices.service.d.ts +52 -9
  32. package/lib/apis/api-open-items.service.d.ts +7 -7
  33. package/lib/apis/api-reports.service.d.ts +7 -0
  34. package/lib/apis/api-security.service.d.ts +21 -29
  35. package/lib/apis/api-shipments.service.d.ts +2 -2
  36. package/lib/apis/models/api-billing.interfaces.d.ts +41 -0
  37. package/lib/apis/models/api-billing.types.d.ts +17 -0
  38. package/lib/apis/models/api-catalog.interfaces.d.ts +6 -0
  39. package/lib/apis/models/api-companies.types.d.ts +7 -13
  40. package/lib/apis/models/api-external-pickups.types.d.ts +31 -0
  41. package/lib/apis/models/api-invoices.interfaces.d.ts +35 -1
  42. package/lib/apis/models/api-invoices.types.d.ts +28 -5
  43. package/lib/apis/models/api-open-items.interfaces.d.ts +2 -2
  44. package/lib/apis/models/api-open-items.types.d.ts +2 -2
  45. package/lib/apis/models/api-reports.types.d.ts +2 -3
  46. package/lib/apis/models/api-security.interfaces.d.ts +0 -4
  47. package/lib/apis/models/api-security.types.d.ts +8 -8
  48. package/lib/ngx-services.models.d.ts +10 -0
  49. package/lib/websockets/web-sockets.service.d.ts +49 -0
  50. package/package.json +11 -2
  51. package/public-api.d.ts +7 -0
@@ -1,10 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { NgModule, Injectable, Inject } from '@angular/core';
3
3
  import * as i1 from '@angular/common/http';
4
- import { provideHttpClient, HttpParams, HttpHeaders, HttpResponse } from '@angular/common/http';
5
- import { map, mergeMap, forkJoin, tap, of } from 'rxjs';
4
+ import { provideHttpClient, HttpHeaders, HttpResponse, HttpParams } from '@angular/common/http';
5
+ import { map, mergeMap, forkJoin, tap, Observable, of } from 'rxjs';
6
+ import { map as map$1, tap as tap$1 } from 'rxjs/operators';
6
7
  import * as i1$1 from 'ngx-cookie-service';
7
- import { tap as tap$1 } from 'rxjs/operators';
8
+ import Pusher__default from 'pusher-js';
9
+ export * from 'pusher-js';
8
10
 
9
11
  class NgxServicesModule {
10
12
  /**
@@ -36,70 +38,100 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
36
38
  }]
37
39
  }] });
38
40
 
39
- /**
40
- * Convert an object of key-value pairs into a URL query string.
41
- *
42
- * @param {Object} params - The key-value pairs to converted into a query string.
43
- *
44
- * @return {string} - The generated query string.
45
- */
46
- const queryString = (params) => {
47
- const queryElements = [];
48
- Object.entries(params).forEach(([key, value]) => {
49
- if (Array.isArray(value)) {
50
- const arrayQuery = value
51
- .map((item) => `${encodeURIComponent(key)}=${encodeURIComponent(item)}`)
52
- .join('&');
53
- queryElements.push(arrayQuery);
54
- }
55
- else {
56
- const encodedQuery = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
57
- queryElements.push(encodedQuery);
58
- }
59
- });
60
- const queryString = queryElements.join('&');
61
- return queryString.length ? `?${queryString}` : '';
62
- };
63
- /**
64
- * Creates an instance of HttpParams using the provided params object.
65
- *
66
- * @param {Object} params - The object containing the params to the HttpParams constructor.
67
- *
68
- * @returns {HttpParams} - An instance of HttpParams created from the params object.
69
- */
70
- const httpParams = (params) => new HttpParams({
71
- fromObject: params
72
- });
73
- /**
74
- * Returns the headers for generating PDF files.
75
- *
76
- * @param {string} format - The format of the headers, 'object' or 'http_header'.
77
- *
78
- * @returns {HttpHeaders | { [header: string]: string | string[] }} - The headers for generating PDF files.
79
- */
80
- const pdfHeaders = (format = 'object') => {
81
- const headers = {
82
- Accept: 'application/pdf'
83
- };
84
- return format === 'object'
85
- ? headers
86
- : new HttpHeaders(headers);
87
- };
88
- /**
89
- * Returns the headers for generating XML files.
90
- *
91
- * @param {string} format - The format of the headers, 'object' or 'http_header'.
92
- *
93
- * @returns {HttpHeaders | { [header: string]: string | string[] }} - The headers for generating XML files.
94
- */
95
- const xmlHeaders = (format = 'object') => {
96
- const headers = {
97
- Accept: 'application/xml',
98
- };
99
- return format === 'object'
100
- ? headers
101
- : new HttpHeaders(headers);
102
- };
41
+ class ApiBillingDOService {
42
+ environments;
43
+ http;
44
+ constructor(environments, http) {
45
+ this.environments = environments;
46
+ this.http = http;
47
+ }
48
+ /**
49
+ * Retrieves the URL for the shipments API from the environment configurations.
50
+ *
51
+ * @return {string} The URL of the shipments API.
52
+ */
53
+ get url() {
54
+ return this.environments.apiBillingDO;
55
+ }
56
+ /**
57
+ * Retrieves a list of income types
58
+ *
59
+ * @return {Observable<ApiSuccess<IncomeTypesOut>>} An observable that emits the income types data.
60
+ */
61
+ getIncomeTypes() {
62
+ return this.http.get(`${this.url}/income-types`)
63
+ .pipe(map(({ data }) => data));
64
+ }
65
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiBillingDOService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
66
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiBillingDOService, providedIn: 'root' });
67
+ }
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiBillingDOService, decorators: [{
69
+ type: Injectable,
70
+ args: [{
71
+ providedIn: 'root'
72
+ }]
73
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
74
+ type: Inject,
75
+ args: ['env']
76
+ }] }, { type: i1.HttpClient }] });
77
+
78
+ class ApiBillingMxService {
79
+ environments;
80
+ http;
81
+ constructor(environments, http) {
82
+ this.environments = environments;
83
+ this.http = http;
84
+ }
85
+ /**
86
+ * Retrieves the URL for the shipments API from the environment configurations.
87
+ *
88
+ * @return {string} The URL of the shipments API.
89
+ */
90
+ get url() {
91
+ return this.environments.apiBillingMX;
92
+ }
93
+ /**
94
+ * Fetches the tax regimen data from the server.
95
+ *
96
+ * @return {Observable<FiscalRegimensOut>} An observable that emits the fiscal regimen data.
97
+ */
98
+ getFiscalRegimens() {
99
+ return this.http.get(`${this.url}/fiscal-regimens`)
100
+ .pipe(map(({ data }) => data));
101
+ }
102
+ /**
103
+ * Fetches a paginated list of CFDIs (Comprobante Fiscal Digital por Internet) based on the provided fiscal regimen.
104
+ *
105
+ * @param {number} fiscalRegimen - The fiscal regimen identifier to filter the CFDIs.
106
+ * @return {Observable<FiscalRegimensAcceptedOut>} An observable containing the paginated list of CFDIs.
107
+ */
108
+ getFiscalRegimensAccepted(fiscalRegimen) {
109
+ const params = { 'fiscal-regimen': fiscalRegimen };
110
+ return this.http.get(`${this.url}/cfdi-uses/fiscal-regimen-accepted/list`, { params })
111
+ .pipe(map(({ data }) => data));
112
+ }
113
+ /**
114
+ * Fetches and validates postal code data from the server.
115
+ *
116
+ * @param {QueryParams} params - Query parameters used to filter the postal code data.
117
+ * @return {Observable<PostalCodesOut>} - An observable emitting the validated postal code data.
118
+ */
119
+ getPostalCodes(params) {
120
+ return this.http.get(`${this.url}/postal-codes`, { params })
121
+ .pipe(map(({ data }) => data));
122
+ }
123
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiBillingMxService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
124
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiBillingMxService, providedIn: 'root' });
125
+ }
126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiBillingMxService, decorators: [{
127
+ type: Injectable,
128
+ args: [{
129
+ providedIn: 'root'
130
+ }]
131
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
132
+ type: Inject,
133
+ args: ['env']
134
+ }] }, { type: i1.HttpClient }] });
103
135
 
104
136
  class ApiCompaniesService {
105
137
  environments;
@@ -124,7 +156,7 @@ class ApiCompaniesService {
124
156
  */
125
157
  getInstallations(params) {
126
158
  return this.http.get(`${this.url}/installations`, {
127
- params: httpParams(params),
159
+ params,
128
160
  }).pipe(map(({ data }) => data));
129
161
  }
130
162
  /**
@@ -145,7 +177,7 @@ class ApiCompaniesService {
145
177
  */
146
178
  getLocations(params) {
147
179
  return this.http.get(`${this.url}/locations`, {
148
- params: httpParams(params),
180
+ params,
149
181
  }).pipe(map(({ data }) => data));
150
182
  }
151
183
  /**
@@ -162,11 +194,11 @@ class ApiCompaniesService {
162
194
  * Retrieves a list of active supply entities.
163
195
  *
164
196
  * @param {QueryParams} params - The query parameters to filter supply entities.
165
- * @return {Observable<SupplyEntitiesOut>} Observable emitting supply entities data.
197
+ * @return {Observable<SupplyEntitiesActivesOut>} Observable emitting supply entities data.
166
198
  */
167
- getSupplyEntitiesActive(params) {
199
+ getSupplyEntitiesActives(params) {
168
200
  return this.http.get(`${this.url}/supply-entities/actives`, {
169
- params: httpParams(params),
201
+ params,
170
202
  }).pipe(map(({ data }) => data));
171
203
  }
172
204
  /**
@@ -177,7 +209,7 @@ class ApiCompaniesService {
177
209
  */
178
210
  getEmployees(params) {
179
211
  return this.http.get(`${this.url}/employees`, {
180
- params: httpParams(params),
212
+ params,
181
213
  }).pipe(map(({ data }) => data));
182
214
  }
183
215
  /**
@@ -198,7 +230,7 @@ class ApiCompaniesService {
198
230
  */
199
231
  getLocationEmployees(params) {
200
232
  return this.http.get(`${this.url}/location-employees`, {
201
- params: httpParams(params),
233
+ params,
202
234
  }).pipe(map(({ data }) => data));
203
235
  }
204
236
  /**
@@ -209,7 +241,7 @@ class ApiCompaniesService {
209
241
  */
210
242
  getCompanyCountries(params) {
211
243
  return this.http.get(`${this.url}/company-countries`, {
212
- params: httpParams(params),
244
+ params,
213
245
  }).pipe(map(({ data }) => data));
214
246
  }
215
247
  /**
@@ -254,11 +286,11 @@ class ApiCompaniesService {
254
286
  * Fetches exchange data based on the provided query parameters.
255
287
  *
256
288
  * @param {QueryParams} params - The query parameters for retrieving exchange data.
257
- * @return {Observable<CountryExchangesOut>} An observable containing the exchange data.
289
+ * @return {Observable<ExchangesOut>} An observable containing the exchange data.
258
290
  */
259
291
  getExchanges(params) {
260
292
  return this.http.get(`${this.url}/exchanges`, {
261
- params: httpParams(params),
293
+ params,
262
294
  }).pipe(map(({ data }) => data));
263
295
  }
264
296
  /**
@@ -270,7 +302,7 @@ class ApiCompaniesService {
270
302
  */
271
303
  getCurrentExchanges(params) {
272
304
  return this.http.get(`${this.url}/exchanges/current`, {
273
- params: httpParams(params),
305
+ params,
274
306
  }).pipe(map(({ data }) => data));
275
307
  }
276
308
  /**
@@ -281,18 +313,18 @@ class ApiCompaniesService {
281
313
  */
282
314
  getCompanyCountryTaxes(params) {
283
315
  return this.http.get(`${this.url}/company-country-taxes`, {
284
- params: httpParams(params),
316
+ params,
285
317
  }).pipe(map(({ data }) => data));
286
318
  }
287
319
  /**
288
320
  * Retrieves the list of active account entities based on the provided query parameters.
289
321
  *
290
322
  * @param {QueryParams} params - The parameters to filter and query active account entities.
291
- * @return {Observable<AccountEntitiesOut>} An observable that emits the list of active account entities.
323
+ * @return {Observable<AccountEntitiesActivesOut>} An observable that emits the list of active account entities.
292
324
  */
293
- getActiveAccountEntities(params) {
325
+ getAccountEntitiesActives(params) {
294
326
  return this.http.get(`${this.url}/account-entities/actives`, {
295
- params: httpParams(params),
327
+ params,
296
328
  }).pipe(map(({ data }) => data));
297
329
  }
298
330
  /**
@@ -300,9 +332,9 @@ class ApiCompaniesService {
300
332
  *
301
333
  * @param {Object} params - An object containing the required parameters.
302
334
  * @param {string[]} params.paramNames - An array of parameter names for which the values need to be fetched.
303
- * @return {Observable<ParametersOut>} An observable that emits the fetched parameter values.
335
+ * @return {Observable<ParametersValuesOut>} An observable that emits the fetched parameter values.
304
336
  */
305
- getParameters({ paramNames, }) {
337
+ getParametersValues({ paramNames, }) {
306
338
  const parameters = paramNames.map((p) => ({ name: p }));
307
339
  return this.http.post(`${this.url}/parameters-values`, {
308
340
  parameters
@@ -327,7 +359,7 @@ class ApiCompaniesService {
327
359
  */
328
360
  getCountryReferences(params) {
329
361
  return this.http.get(`${this.url}/country-references`, {
330
- params: httpParams(params),
362
+ params,
331
363
  }).pipe(map(({ data }) => data));
332
364
  }
333
365
  /**
@@ -348,7 +380,7 @@ class ApiCompaniesService {
348
380
  */
349
381
  getWorkflows(params) {
350
382
  return this.http.get(`${this.url}/workflows`, {
351
- params: httpParams(params),
383
+ params,
352
384
  }).pipe(map(({ data }) => data));
353
385
  }
354
386
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiCompaniesService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -364,6 +396,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
364
396
  args: ['env']
365
397
  }] }, { type: i1.HttpClient }] });
366
398
 
399
+ class ApiExternalPickupsService {
400
+ httpClient;
401
+ environment;
402
+ constructor(httpClient, environment) {
403
+ this.httpClient = httpClient;
404
+ this.environment = environment;
405
+ }
406
+ /**
407
+ * Getter method to retrieve the API's external operations URL.
408
+ * Fetches the URL from the `apiExternalOperationsUrl` property of the environment object.
409
+ * Defaults to an empty string if the property is undefined or null.
410
+ *
411
+ * @return {string} The external operations URL or an empty string if unavailable.
412
+ */
413
+ get url() {
414
+ return this.environment.apiExternalOperationsUrl ?? '';
415
+ }
416
+ /**
417
+ * Generates a delivery confirmation by sending the provided payload to the API.
418
+ *
419
+ * @param {DeliveryConfirmationGenerateIn} payload - The input payload required to generate the delivery confirmation.
420
+ * @return {Observable<DeliveryConfirmationGenerateOut>} An observable that emits the generated delivery confirmation data.
421
+ */
422
+ postDeliveryConfirmationGenerate(payload) {
423
+ return this.httpClient.post(`${this.url}/delivery-confirmation/generate`, payload, {
424
+ headers: { appkey: this.environment.apiExternalOperationsKey }
425
+ }).pipe(map$1(({ data }) => data));
426
+ }
427
+ /**
428
+ * Confirms the completion of a delivery operation by making a PATCH request.
429
+ *
430
+ * @param {Object} input - The input parameters for the method.
431
+ * @param {string} input.operationId - The unique identifier of the delivery operation to be confirmed.
432
+ * @param {string} input.keyOTP - The one-time password (OTP) key associated with the delivery confirmation.
433
+ * @return {Observable<Object>} - An observable containing the response data from the API.
434
+ */
435
+ patchDeliveryConfirmationComplete({ keyOTP, operationId, }) {
436
+ return this.httpClient.patch(`${this.url}/delivery-confirmation/completed/${keyOTP}`, null, {
437
+ headers: { appkey: this.environment.apiExternalOperationsKey },
438
+ params: { operation_id: operationId }
439
+ }).pipe(map$1(({ data }) => data));
440
+ }
441
+ /**
442
+ * Cancels a delivery confirmation by sending an OTP and additional data to the server.
443
+ *
444
+ * @param {Object} param0 - The parameter object containing the required properties.
445
+ * @param {string} param0.otp - The one-time password to authenticate the cancellation request.
446
+ * @param {Object} param0.body - Additional body data required for cancellation.
447
+ * @return {Observable<Object>} An observable that emits the server's response when the cancellation is processed.
448
+ */
449
+ putDeliveryConfirmation({ otp, ...body }) {
450
+ return this.httpClient.put(`${this.url}/delivery-confirmation/confirmation/${otp}`, body, {
451
+ headers: { appkey: this.environment.apiExternalOperationsKey },
452
+ }).pipe(map$1(({ data }) => data));
453
+ }
454
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiExternalPickupsService, deps: [{ token: i1.HttpClient }, { token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable });
455
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiExternalPickupsService, providedIn: 'root' });
456
+ }
457
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiExternalPickupsService, decorators: [{
458
+ type: Injectable,
459
+ args: [{
460
+ providedIn: 'root'
461
+ }]
462
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
463
+ type: Inject,
464
+ args: ['env']
465
+ }] }] });
466
+
367
467
  class ApiInvoicesService {
368
468
  environments;
369
469
  http;
@@ -385,7 +485,7 @@ class ApiInvoicesService {
385
485
  * @param {OperationDocumentIn} body - The input data for the operation document.
386
486
  * @return {Observable<OperationDocumentOut>} An observable containing the processed operation document output.
387
487
  */
388
- operationDocument(body) {
488
+ postOperationDocument(body) {
389
489
  return this.http.post(`${this.url}/operation/document`, body)
390
490
  .pipe(map(({ data }) => data));
391
491
  }
@@ -393,9 +493,9 @@ class ApiInvoicesService {
393
493
  * Fetches and returns the collection receipt data for a given collection ID.
394
494
  *
395
495
  * @param {number} id - The unique identifier of the collection for which the receipt needs to be retrieved.
396
- * @return {Observable<CollectionReceiptOut>} An observable containing the collection receipt data.
496
+ * @return {Observable<PrintCollectionReceiptOut>} An observable containing the collection receipt data.
397
497
  */
398
- printCollectionReceipt(id) {
498
+ getPrintCollectionReceipt(id) {
399
499
  return this.http.get(`${this.url}/operation/print/collection-receipt/${id}`)
400
500
  .pipe(map(({ data }) => data));
401
501
  }
@@ -403,10 +503,10 @@ class ApiInvoicesService {
403
503
  * Handles the account payment operation by sending a POST request to the specified endpoint.
404
504
  * Processes the response and returns the operation data.
405
505
  *
406
- * @param {AccountPaymentOperationIn} body The payload containing information for the account payment operation.
407
- * @return {Observable<AccountPaymentOperationOut>} An observable emitting the processed account payment operation data.
506
+ * @param {OperationAccountPaymentIn} body The payload containing information for the account payment operation.
507
+ * @return {Observable<OperationAccountPaymentOut>} An observable emitting the processed account payment operation data.
408
508
  */
409
- accountPaymentOperation(body) {
509
+ postOperationAccountPayment(body) {
410
510
  return this.http.post(`${this.url}/operation/account-payment`, body)
411
511
  .pipe(map(({ data }) => data));
412
512
  }
@@ -417,7 +517,7 @@ class ApiInvoicesService {
417
517
  * @param body The data required to cancel the payment receipt, encapsulated in a CancelPaymentReceiptIn object.
418
518
  * @return An Observable representing the result of the cancellation. Emits an empty object on success.
419
519
  */
420
- cancelPaymentReceipt(body) {
520
+ postOperationCancelDocument(body) {
421
521
  return this.http.post(`${this.url}/operation/cancel-document`, body)
422
522
  .pipe(map(({ data }) => data));
423
523
  }
@@ -427,10 +527,70 @@ class ApiInvoicesService {
427
527
  * @param {Object} parameters - The parameters required to cancel the invoice, encapsulated in a CancelBillingIn object.
428
528
  * @return {Observable<Object>} An observable that emits the response of the cancellation operation.
429
529
  */
430
- cancelInvoice({ invoiceId, ...body }) {
530
+ postOperationCancelBilling({ invoiceId, ...body }) {
431
531
  return this.http.post(`${this.url}/operation/cancel-billing/${invoiceId}`, body)
432
532
  .pipe(map(({ data }) => data));
433
533
  }
534
+ /**
535
+ * Fetches a list of customer types from the server.
536
+ *
537
+ * @param {QueryParams} params - Query parameters to filter or customize the request.
538
+ * @return {Observable<CustomerTypesOut>} An observable emitting the customer types fetched from the server.
539
+ */
540
+ getCustomerTypes(params) {
541
+ return this.http.get(`${this.url}/customer-types`, { params })
542
+ .pipe(map(({ data }) => data));
543
+ }
544
+ /**
545
+ * Retrieves document types specific to a given country.
546
+ *
547
+ * @param {QueryParams} params - The query parameters containing country-specific information.
548
+ * @return {Observable<CustomerDocumentTypesOut>} An observable emitting the document types available for the specified country.
549
+ */
550
+ getCustomerDocumentTypes(params) {
551
+ return this.http.get(`${this.url}/customer-country-document-types`, { params })
552
+ .pipe(map(({ data }) => data));
553
+ }
554
+ /**
555
+ * Fetches customer invoice details filtered by a custom invoice type.
556
+ *
557
+ * @param {InvoiceTypeCustomParamsIn} params - An object containing the filter parameters for the custom invoice type.
558
+ * @return {Observable<CustomersOut>} An observable containing customer invoice details of the specified type.
559
+ */
560
+ getCustomers(params) {
561
+ return this.http.get(`${this.url}/customers`, { params })
562
+ .pipe(map(({ data }) => data));
563
+ }
564
+ /**
565
+ * Sends a POST request to create or update an external shipment operation.
566
+ *
567
+ * @param {OperationShipmentExternalIn} params - The input parameters for the external shipment operation.
568
+ * @return {Observable<OperationShipmentExternalOut>} An observable that emits the result of the external shipment operation.
569
+ */
570
+ postOperationShipmentExternal(params) {
571
+ return this.http.post(`${this.url}/operation/shipment/external`, params)
572
+ .pipe(map(({ data }) => data));
573
+ }
574
+ /**
575
+ * Processes an external payment operation for a shipment.
576
+ *
577
+ * @param {OperationShipmentExternalIn} params - The input parameters required for the external payment operation.
578
+ * @return {Observable<OperationShipmentExternalOut>} An observable that emits the result of the external payment operation for a shipment.
579
+ */
580
+ postOperationShipmentExternalPayment(params) {
581
+ return this.http.post(`${this.url}/operation/shipment/external/payment`, params)
582
+ .pipe(map(({ data }) => data));
583
+ }
584
+ /**
585
+ * Retrieves and returns billing operation print details for a given document ID.
586
+ *
587
+ * @param {number} documentId - The ID of the document for which to fetch the print billing operation details.
588
+ * @return {Observable<OperationPrintDocumentOut>} An observable emitting the print billing operation details for the specified document.
589
+ */
590
+ getOperationPrintDocument(documentId) {
591
+ return this.http.get(`${this.url}/operation/print/document/${documentId}`)
592
+ .pipe(map(({ data }) => data));
593
+ }
434
594
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiInvoicesService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
435
595
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiInvoicesService, providedIn: 'root' });
436
596
  }
@@ -473,19 +633,19 @@ class ApiOpenItemsService {
473
633
  * Processes a payment for an open item.
474
634
  *
475
635
  * @param {PaymentOpenItemIn} body - The payment details for the open item.
476
- * @return {Observable<PaymentOpenItemOut>} An observable that emits the result of the payment processing.
636
+ * @return {Observable<PaymentOut>} An observable that emits the result of the payment processing.
477
637
  */
478
- paymentOpenItem(body) {
638
+ postPayment(body) {
479
639
  return this.http.post(`${this.url}/payment`, body)
480
640
  .pipe(map(({ data }) => data));
481
641
  }
482
642
  /**
483
643
  * Processes a payment for other invoice.
484
644
  *
485
- * @param {PaymentOtherInvoiceIn} body - The payment details for the other invoice.
486
- * @return {Observable<PaymentOtherInvoiceOut>} An observable that emits the result of the payment processing.
645
+ * @param {OtherInvoiceIn} body - The payment details for the other invoice.
646
+ * @return {Observable<OtherInvoiceOut>} An observable that emits the result of the payment processing.
487
647
  */
488
- paymentOtherInvoice(body) {
648
+ postOtherInvoice(body) {
489
649
  return this.http.post(`${this.url}/other-invoices`, body)
490
650
  .pipe(map(({ data }) => data));
491
651
  }
@@ -564,6 +724,16 @@ class ApiReportsService {
564
724
  },
565
725
  }).pipe(map(({ data }) => data));
566
726
  }
727
+ /**
728
+ * Fetches shipment reports based on the provided query parameters.
729
+ *
730
+ * @param {QueryParams} params - The query parameters used to filter or define the shipment reports.
731
+ * @return {Observable<ShipmentsReportOut>} An observable emitting the shipment report data.
732
+ */
733
+ getShipmentsReport(params) {
734
+ return this.http.get(`${this.url}/shipments-report`, { params })
735
+ .pipe(map(({ data }) => data));
736
+ }
567
737
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiReportsService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
568
738
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ApiReportsService, providedIn: 'root' });
569
739
  }
@@ -601,9 +771,9 @@ class ApiSecurityService {
601
771
  * @param {string} param0.username - The username of the user.
602
772
  * @param {string} param0.password - The password of the user.
603
773
  * @param {string} param0.role - The role of the user.
604
- * @return {Observable<LoginOut>} An observable emitting the login output object.
774
+ * @return {Observable<AuthLoginOut>} An observable emitting the login output object.
605
775
  */
606
- login({ username, password, role, }) {
776
+ postAuthLogin({ username, password, role, }) {
607
777
  return this.http.post(`${this.url}/auth/login`, {
608
778
  system_name: 'CRA',
609
779
  username,
@@ -618,7 +788,7 @@ class ApiSecurityService {
618
788
  *
619
789
  * @return {Observable<{}>} An observable that emits the server's response to the logout request.
620
790
  */
621
- logout() {
791
+ postAuthLogout() {
622
792
  return this.http.post(`${this.url}/auth/logout`, null)
623
793
  .pipe(map(({ data }) => data), tap(() => this.cookie.delete(this.environments.authCookie, '/')));
624
794
  }
@@ -630,9 +800,9 @@ class ApiSecurityService {
630
800
  * @param {string} params.modelId - The ID of the model.
631
801
  * @param {string} [params.token] - Optional authorization token.
632
802
  *
633
- * @return {Observable<CreateSessionOut>} An observable containing the created session details.
803
+ * @return {Observable<SessionOut>} An observable containing the created session details.
634
804
  */
635
- createSession({ modelType, modelId, token, }) {
805
+ postSession({ modelType, modelId, token, }) {
636
806
  let headers = new HttpHeaders({});
637
807
  if (token) {
638
808
  headers = headers.set('Authorization', `Bearer ${token}`);
@@ -649,9 +819,9 @@ class ApiSecurityService {
649
819
  * Sends a GET request to the endpoint '/auth/me' to retrieve information
650
820
  * about the currently authenticated user.
651
821
  *
652
- * @return {Observable<MeOut>} An observable that emits the authenticated user's data.
822
+ * @return {Observable<AuthMeOut>} An observable that emits the authenticated user's data.
653
823
  */
654
- me() {
824
+ getAuthMe() {
655
825
  return this.http.get(`${this.url}/auth/me`)
656
826
  .pipe(map(({ data }) => data));
657
827
  }
@@ -661,7 +831,7 @@ class ApiSecurityService {
661
831
  * @param token The JWT token used for authorization.
662
832
  * @return An Observable that emits the user's details encapsulated in a MeOut object.
663
833
  */
664
- otherMe(token) {
834
+ getOtherMe(token) {
665
835
  return this.http.get(`${this.url}/auth/me`, {
666
836
  headers: {
667
837
  Authorization: `Bearer ${token}`
@@ -674,7 +844,7 @@ class ApiSecurityService {
674
844
  * @param {number} id - The unique identifier of the user to be fetched.
675
845
  * @return {Observable<GetUserOut>} An observable containing the user information.
676
846
  */
677
- user(id) {
847
+ getUser(id) {
678
848
  return this.http.get(`${this.url}/users/${id}`)
679
849
  .pipe(map(({ data }) => data));
680
850
  }
@@ -683,9 +853,9 @@ class ApiSecurityService {
683
853
  *
684
854
  * @param {Object} params - The input parameters for changing the language.
685
855
  * @param {string} params.languageId - The ID of the new language to be set.
686
- * @return {Observable<ApiSuccess<MeOut>>} An observable that emits the result of the language change request.
856
+ * @return {Observable<ApiSuccess<AuthMeOut>>} An observable that emits the result of the language change request.
687
857
  */
688
- changeLanguage({ languageId }) {
858
+ putChangeLanguage({ languageId }) {
689
859
  return this.http.put(`${this.url}/auth/me`, {
690
860
  language_id: languageId
691
861
  }).pipe(map(({ data }) => data));
@@ -694,7 +864,7 @@ class ApiSecurityService {
694
864
  * Retrieves a list of roles with their permissions.
695
865
  *
696
866
  * @param {QueryParams} params - The query parameters to filter the roles.
697
- * @returns {Observable<RolePermissionsIn[]>} An observable that emits an array of role permissions.
867
+ * @returns {Observable<RoleIn[]>} An observable that emits an array of role permissions.
698
868
  */
699
869
  getRoles(params) {
700
870
  return this.http.get(`${this.url}/roles`, {
@@ -712,34 +882,23 @@ class ApiSecurityService {
712
882
  params
713
883
  }).pipe(map(({ data }) => data));
714
884
  }
715
- /**
716
- * Retrieves the permissions for a module.
717
- *
718
- * @param {QueryParams} params - The query parameters to be sent with the request.
719
- * @returns {Observable<ModulePermissionsOut>} An observable containing the module permissions.
720
- */
721
- getPermissions(params) {
722
- return this.http.get(`${this.url}/modules`, {
723
- params
724
- }).pipe(map(({ data }) => data));
725
- }
726
885
  /**
727
886
  * Retrieves roles by the specified ID.
728
887
  *
729
- * @param params - The ID of the role to retrieve.
888
+ * @param id - The ID of the role to retrieve.
730
889
  * @returns An Observable that emits the role data.
731
890
  */
732
- getRolesById(params) {
733
- return this.http.get(`${this.url}/roles/${params}`)
891
+ getRole(id) {
892
+ return this.http.get(`${this.url}/roles/${id}`)
734
893
  .pipe(map(({ data }) => data));
735
894
  }
736
895
  /**
737
896
  * Creates a new role with the specified permissions.
738
897
  *
739
- * @param {RolePermissionsIn} body - The permissions and details for the new role.
740
- * @returns {Observable<ModulePermissionsOut>} An observable containing the created role's permissions.
898
+ * @param {RoleIn} body - The permissions and details for the new role.
899
+ * @returns {Observable<RoleOut>} An observable containing the created role's permissions.
741
900
  */
742
- createRole(body) {
901
+ postRole(body) {
743
902
  return this.http.post(`${this.url}/roles`, body)
744
903
  .pipe(map(({ data }) => data));
745
904
  }
@@ -750,7 +909,7 @@ class ApiSecurityService {
750
909
  * @param body - The new permissions to assign to the role.
751
910
  * @returns An Observable that emits the updated module permissions.
752
911
  */
753
- updateRolePermissions(id, body) {
912
+ putRole(id, body) {
754
913
  return this.http.put(`${this.url}/roles/${id}`, body)
755
914
  .pipe(map(({ data }) => data));
756
915
  }
@@ -760,7 +919,7 @@ class ApiSecurityService {
760
919
  * @param {number} id - The unique identifier of the role whose permissions are to be deleted.
761
920
  * @returns {Observable<{}>} An observable that emits the result of the delete operation.
762
921
  */
763
- deleteRolePermissions(id) {
922
+ deleteRole(id) {
764
923
  return this.http.delete(`${this.url}/roles/${id}`)
765
924
  .pipe(map(({ data }) => data));
766
925
  }
@@ -782,7 +941,7 @@ class ApiSecurityService {
782
941
  * @param params.queryParams - The query parameters to filter the modules.
783
942
  * @returns Observable<ModulesOut[]> - An observable that emits an array of modules and permissions.
784
943
  */
785
- getModulesToken(params) {
944
+ getModulesByToken(params) {
786
945
  return this.http.get(`${this.url}/modules`, {
787
946
  params: params.queryParams,
788
947
  headers: {
@@ -825,7 +984,7 @@ class ApiShipmentsService {
825
984
  * @return {Observable<ValidateAccountIn>} An observable that emits the fetched parameter values
826
985
  * @param body
827
986
  */
828
- validateAccount(body) {
987
+ postValidateAccount(body) {
829
988
  return this.http.post(`${this.url}/accounts`, body)
830
989
  .pipe(map(({ data }) => data));
831
990
  }
@@ -835,7 +994,7 @@ class ApiShipmentsService {
835
994
  * @param body - The request payload of type `ManifestMultipleIn`.
836
995
  * @returns An observable that emits the response data of type `ManifestMultipleOut`.
837
996
  */
838
- manifestMultiple(body) {
997
+ postManifestMultiple(body) {
839
998
  return this.http.post(`${this.url}/shipments/manifest`, body)
840
999
  .pipe(map(({ data }) => data));
841
1000
  }
@@ -852,6 +1011,117 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
852
1011
  args: ['env']
853
1012
  }] }, { type: i1.HttpClient }] });
854
1013
 
1014
+ class WebSocketsService {
1015
+ environments;
1016
+ pusher;
1017
+ constructor(environments) {
1018
+ this.environments = environments;
1019
+ this.pusher = null;
1020
+ this.connect()
1021
+ .then((pusher) => {
1022
+ if (!pusher)
1023
+ return;
1024
+ this.pusher = pusher;
1025
+ });
1026
+ }
1027
+ /**
1028
+ * Publishes an event to the specified channel with the given data.
1029
+ *
1030
+ * @param {Channel} channel - The channel instance where the event will be published.
1031
+ * @param {string} eventName - The name of the event to be published.
1032
+ * @param {T} data - The payload data to be sent with the event.
1033
+ * @return {Promise<boolean>} A promise that resolves to a boolean indicating
1034
+ * whether the event was successfully triggered on the channel.
1035
+ */
1036
+ async pub(channel, eventName, data) {
1037
+ return channel.trigger(`client-${eventName}`, data);
1038
+ }
1039
+ /**
1040
+ * Subscribes to a specified channel, retrying multiple times upon failure.
1041
+ *
1042
+ * @param {string} channelName - The name of the channel to be subscribed to.
1043
+ * @return {Promise<Channel>} A promise that resolves to the subscribed channel object if successful.
1044
+ * @throws {Error} If the subscription fails after the maximum number of retry attempts.
1045
+ */
1046
+ async channelSub(channelName) {
1047
+ const attempts = 3;
1048
+ for (let attempt = 0; attempt <= attempts; attempt++) {
1049
+ const channel = this.pusher?.channel(channelName);
1050
+ if (channel?.subscribed) {
1051
+ return channel;
1052
+ }
1053
+ this.pusher?.subscribe(channelName);
1054
+ if (attempt < attempts) {
1055
+ await this.wait();
1056
+ }
1057
+ }
1058
+ throw new Error(`Failed to subscribe to channel "${channelName}" after ${attempts} attempts.`);
1059
+ }
1060
+ /**
1061
+ * Binds an event listener to a specified event on a given channel using Pusher or a Channel object,
1062
+ * and returns an Observable that emits event data of type T.
1063
+ *
1064
+ * @param {Channel|string} channel - The channel to bind the event to. It can be a Channel object or a string representing the channel name.
1065
+ * @param {string} event - The name of the event to bind to the channel.
1066
+ * @return {Observable<T>} An Observable that emits data of type T when the specified event is triggered.
1067
+ */
1068
+ eventBind(channel, event) {
1069
+ return new Observable((subscriber) => {
1070
+ if (channel?.name) {
1071
+ channel.bind(event, (data) => subscriber.next(data));
1072
+ }
1073
+ else {
1074
+ this.pusher?.subscribe(channel)
1075
+ .bind(event, (data) => subscriber.next(data));
1076
+ }
1077
+ });
1078
+ }
1079
+ /**
1080
+ * Unbinds an event from the specified channel and returns an observable
1081
+ * that emits data when the event callback is triggered.
1082
+ *
1083
+ * @param {Channel} channel - The channel object from which the event should be unbound.
1084
+ * @param {string} event - The name of the event to unbind.
1085
+ * @return {Observable<T>} An observable that emits data from the unbound event callback.
1086
+ */
1087
+ eventUnbind(channel, event) {
1088
+ return new Observable((subscriber) => channel.unbind(event, (data) => subscriber.next(data)));
1089
+ }
1090
+ connect() {
1091
+ return new Promise((resolve) => {
1092
+ const { sockets } = this.environments;
1093
+ if (!sockets)
1094
+ return resolve(false);
1095
+ const pusher = new Pusher__default(sockets.app_key, {
1096
+ wsHost: sockets.url,
1097
+ wsPort: sockets.port,
1098
+ enabledTransports: ['wss', 'ws'],
1099
+ forceTLS: false,
1100
+ enableStats: false,
1101
+ });
1102
+ if (sockets.debug) {
1103
+ Pusher__default.logToConsole = true;
1104
+ }
1105
+ return resolve(pusher);
1106
+ });
1107
+ }
1108
+ async wait() {
1109
+ const waitTime = 3 * 1000;
1110
+ return new Promise((resolve) => setTimeout(resolve, waitTime));
1111
+ }
1112
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: WebSocketsService, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable });
1113
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: WebSocketsService, providedIn: 'root' });
1114
+ }
1115
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: WebSocketsService, decorators: [{
1116
+ type: Injectable,
1117
+ args: [{
1118
+ providedIn: 'root',
1119
+ }]
1120
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
1121
+ type: Inject,
1122
+ args: ['env']
1123
+ }] }] });
1124
+
855
1125
  class CryptoService {
856
1126
  environments;
857
1127
  constructor(environments) {
@@ -1062,6 +1332,71 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
1062
1332
  args: ['env']
1063
1333
  }] }] });
1064
1334
 
1335
+ /**
1336
+ * Convert an object of key-value pairs into a URL query string.
1337
+ *
1338
+ * @param {Object} params - The key-value pairs to converted into a query string.
1339
+ *
1340
+ * @return {string} - The generated query string.
1341
+ */
1342
+ const queryString = (params) => {
1343
+ const queryElements = [];
1344
+ Object.entries(params).forEach(([key, value]) => {
1345
+ if (Array.isArray(value)) {
1346
+ const arrayQuery = value
1347
+ .map((item) => `${encodeURIComponent(key)}=${encodeURIComponent(item)}`)
1348
+ .join('&');
1349
+ queryElements.push(arrayQuery);
1350
+ }
1351
+ else {
1352
+ const encodedQuery = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
1353
+ queryElements.push(encodedQuery);
1354
+ }
1355
+ });
1356
+ const queryString = queryElements.join('&');
1357
+ return queryString.length ? `?${queryString}` : '';
1358
+ };
1359
+ /**
1360
+ * Creates an instance of HttpParams using the provided params object.
1361
+ *
1362
+ * @param {Object} params - The object containing the params to the HttpParams constructor.
1363
+ *
1364
+ * @returns {HttpParams} - An instance of HttpParams created from the params object.
1365
+ */
1366
+ const httpParams = (params) => new HttpParams({
1367
+ fromObject: params
1368
+ });
1369
+ /**
1370
+ * Returns the headers for generating PDF files.
1371
+ *
1372
+ * @param {string} format - The format of the headers, 'object' or 'http_header'.
1373
+ *
1374
+ * @returns {HttpHeaders | { [header: string]: string | string[] }} - The headers for generating PDF files.
1375
+ */
1376
+ const pdfHeaders = (format = 'object') => {
1377
+ const headers = {
1378
+ Accept: 'application/pdf'
1379
+ };
1380
+ return format === 'object'
1381
+ ? headers
1382
+ : new HttpHeaders(headers);
1383
+ };
1384
+ /**
1385
+ * Returns the headers for generating XML files.
1386
+ *
1387
+ * @param {string} format - The format of the headers, 'object' or 'http_header'.
1388
+ *
1389
+ * @returns {HttpHeaders | { [header: string]: string | string[] }} - The headers for generating XML files.
1390
+ */
1391
+ const xmlHeaders = (format = 'object') => {
1392
+ const headers = {
1393
+ Accept: 'application/xml',
1394
+ };
1395
+ return format === 'object'
1396
+ ? headers
1397
+ : new HttpHeaders(headers);
1398
+ };
1399
+
1065
1400
  /*
1066
1401
  * Public API Surface of ngx-services
1067
1402
  */
@@ -1070,5 +1405,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
1070
1405
  * Generated bundle index. Do not edit.
1071
1406
  */
1072
1407
 
1073
- export { ApiCompaniesService, ApiHeadersInterceptor, ApiInvoicesService, ApiOpenItemsService, ApiReportsService, ApiSecurityService, ApiShipmentsService, ApiTokenInterceptor, CryptoService, HttpCachingInterceptor, NgxServicesModule, httpParams, pdfHeaders, queryString, xmlHeaders };
1408
+ export { ApiBillingDOService, ApiBillingMxService, ApiCompaniesService, ApiExternalPickupsService, ApiHeadersInterceptor, ApiInvoicesService, ApiOpenItemsService, ApiReportsService, ApiSecurityService, ApiShipmentsService, ApiTokenInterceptor, CryptoService, HttpCachingInterceptor, NgxServicesModule, WebSocketsService, httpParams, pdfHeaders, queryString, xmlHeaders };
1074
1409
  //# sourceMappingURL=experteam-mx-ngx-services.mjs.map