@experteam-mx/ngx-services 20.7.0-dev1.10 → 20.7.0-dev1.12

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
@@ -22,8 +22,12 @@ import { routes } from './app.routes'
22
22
 
23
23
  const envs = {
24
24
  ...environment,
25
- authCookie: 'token',
26
- cacheTtl: 3000
25
+ authCookie: 'token'
26
+ // cacheRoutes is opt-in; omit or leave empty until routes are registered:
27
+ // cacheRoutes: [
28
+ // { pattern: '/api/catalogs', ttl: 60_000 },
29
+ // { pattern: '/api/companies/.+/branches', ttl: 30_000 }
30
+ // ]
27
31
  } as Environment
28
32
 
29
33
  export const appConfig: ApplicationConfig = {
@@ -41,6 +45,8 @@ export const appConfig: ApplicationConfig = {
41
45
 
42
46
  `provideNgxServices` registers `ENVIRONMENT_TOKEN`, which is required by the API services and some interceptors in this package.
43
47
 
48
+ `httpCachingInterceptor` caches only GET requests whose URL matches an entry in `cacheRoutes` (first matching RegExp pattern wins). With no routes configured, nothing is cached.
49
+
44
50
  ## NgModule compatibility
45
51
 
46
52
  `NgxServicesModule.forRoot(environment)` is still available for compatibility, but it is deprecated for new standalone applications and will be removed in `20.2.0`.
@@ -1022,6 +1022,16 @@ class ApiCatalogsService {
1022
1022
  return this.http.put(`${this.url}/generic-folios/${id}`, body)
1023
1023
  .pipe(map(({ data }) => data));
1024
1024
  }
1025
+ /**
1026
+ * Retrieves the list of products.
1027
+ *
1028
+ * @param params Query parameters used to filter or paginate the products.
1029
+ * @returns An observable containing the list of products.
1030
+ */
1031
+ getProducts(params) {
1032
+ return this.http.get(`${this.url}/products`, { params })
1033
+ .pipe(map(({ data }) => data));
1034
+ }
1025
1035
  /**
1026
1036
  * Retrieves a product by its unique identifier.
1027
1037
  *
@@ -1430,6 +1440,53 @@ class ApiCatalogsService {
1430
1440
  return this.http.get(`${this.url}/export-reason-types`, { params })
1431
1441
  .pipe(map(({ data }) => data));
1432
1442
  }
1443
+ /**
1444
+ * Retrieves the list of upselling indicators.
1445
+ * @param params - Query parameters used to filter or paginate the results
1446
+ * @returns An Observable that emits the upselling indicators and total count
1447
+ */
1448
+ getUpsellingIndicators(params) {
1449
+ return this.http.get(`${this.url}/upselling-indicators`, { params })
1450
+ .pipe(map(({ data }) => data));
1451
+ }
1452
+ /**
1453
+ * Creates a new upselling indicator.
1454
+ * @param body - Upselling indicator data
1455
+ * @returns An Observable that emits the created upselling indicator
1456
+ */
1457
+ postUpsellingIndicator(body) {
1458
+ return this.http.post(`${this.url}/upselling-indicators`, body)
1459
+ .pipe(map(({ data }) => data));
1460
+ }
1461
+ /**
1462
+ * Updates an existing upselling indicator.
1463
+ * @param id - Identifier of the upselling indicator to update
1464
+ * @param body - Updated upselling indicator data
1465
+ * @returns An Observable that emits the updated upselling indicator
1466
+ */
1467
+ putUpsellingIndicator(id, body) {
1468
+ return this.http.put(`${this.url}/upselling-indicators/${id}`, body)
1469
+ .pipe(map(({ data }) => data));
1470
+ }
1471
+ /**
1472
+ * Deletes an upselling indicator by its identifier.
1473
+ * @param id - Identifier of the upselling indicator to delete
1474
+ * @returns An Observable that emits the operation result
1475
+ */
1476
+ deleteUpsellingIndicator(id) {
1477
+ return this.http.delete(`${this.url}/upselling-indicators/${id}`)
1478
+ .pipe(map(({ data }) => data));
1479
+ }
1480
+ /**
1481
+ * Updates the active status of an upselling indicator.
1482
+ * @param id - Identifier of the upselling indicator
1483
+ * @param isActive - Indicates whether the upselling indicator should be active or inactive
1484
+ * @returns An Observable that emits the operation result
1485
+ */
1486
+ patchUpsellingIndicator(id, isActive) {
1487
+ return this.http.patch(`${this.url}/upselling-indicators/${id}`, { isActive })
1488
+ .pipe(map(({ data }) => data));
1489
+ }
1433
1490
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCatalogsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1434
1491
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCatalogsService, providedIn: 'root' });
1435
1492
  }
@@ -1440,6 +1497,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
1440
1497
  }]
1441
1498
  }] });
1442
1499
 
1500
+ class ApiCheckpointsService {
1501
+ environments = inject(ENVIRONMENT_TOKEN);
1502
+ http = inject(HttpClient);
1503
+ /**
1504
+ * Retrieves the API checkpoints URL from the environment configuration.
1505
+ *
1506
+ * @returns {string} The API checkpoints URL.
1507
+ */
1508
+ get url() {
1509
+ return this.environments.apiCheckpointsUrl ?? '';
1510
+ }
1511
+ /**
1512
+ * Retrieves event registers from the checkpoints API.
1513
+ *
1514
+ * @param {QueryParams} params - Query parameters for filtering and pagination.
1515
+ * @returns {Observable<EventRegistersOut>} An observable containing the event registers data.
1516
+ */
1517
+ getEventRegisters(params) {
1518
+ return this.http.get(`${this.url}/event-registers`, { params })
1519
+ .pipe(map(({ data }) => data));
1520
+ }
1521
+ /**
1522
+ * Retrieves checkpoints from the checkpoints API.
1523
+ *
1524
+ * @param {QueryParams} params - Query parameters for filtering and pagination.
1525
+ * @returns {Observable<CheckpointsInventoryOut>} An observable containing the checkpoints data.
1526
+ */
1527
+ getCheckpoints(params) {
1528
+ return this.http.get(`${this.url}/checkpoints`, { params })
1529
+ .pipe(map(({ data }) => data));
1530
+ }
1531
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCheckpointsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1532
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCheckpointsService, providedIn: 'root' });
1533
+ }
1534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCheckpointsService, decorators: [{
1535
+ type: Injectable,
1536
+ args: [{
1537
+ providedIn: 'root'
1538
+ }]
1539
+ }] });
1540
+
1443
1541
  class ApiCompaniesService {
1444
1542
  environments = inject(ENVIRONMENT_TOKEN);
1445
1543
  http = inject(HttpClient);
@@ -2047,19 +2145,18 @@ class ApiCompaniesService {
2047
2145
  /**
2048
2146
  * Retrieves the parameter values based on the provided parameter names.
2049
2147
  *
2050
- * @param {Object} params - An object containing the required parameters.
2051
- * @param {string[]} params.paramNames - An array of parameter names for which the values need to be fetched.
2148
+ * @param {string[]} names - An array of parameter names for which the values need to be fetched.
2052
2149
  * @return {Observable<ParametersValuesOut>} An observable that emits the fetched parameter values.
2053
2150
  */
2054
- postParametersValues({ paramNames }) {
2055
- const parameters = paramNames.map((p) => ({ name: p }));
2151
+ postParametersValues(names) {
2152
+ const parameters = names.map((name) => ({ name }));
2056
2153
  return this.http.post(`${this.url}/parameters-values`, { parameters })
2057
2154
  .pipe(map(({ data }) => data));
2058
2155
  }
2059
2156
  /**
2060
- * Retrieves parameter values based on the provided level configuration.
2157
+ * Retrieves parameter values based on the provided model configuration.
2061
2158
  *
2062
- * @param {ParametersByLevelIn} parameters - The input object containing the criteria or level details to retrieve the parameters.
2159
+ * @param {ParametersByModelIn} parameters - The input object containing the criteria or model details to retrieve the parameters.
2063
2160
  * @return {Observable<ParametersValuesOut>} An observable that emits the parameter values fetched from the server.
2064
2161
  */
2065
2162
  postParameterValueByModel(parameters) {
@@ -2069,12 +2166,11 @@ class ApiCompaniesService {
2069
2166
  /**
2070
2167
  * Retrieves the value of a specified parameter.
2071
2168
  *
2072
- * @param {Object} input - The input object containing the parameter details.
2073
- * @param {string} input.paramName - The name of the parameter whose value is to be retrieved.
2169
+ * @param {string} name - The name of the parameter whose value is to be retrieved.
2074
2170
  * @return {Observable<ParameterValueOut>} An observable emitting the value of the specified parameter.
2075
2171
  */
2076
- getParameterValue({ paramName, }) {
2077
- return this.http.get(`${this.url}/parameters-values/${paramName}`)
2172
+ getParameterValue(name) {
2173
+ return this.http.get(`${this.url}/parameters-values/${name}`)
2078
2174
  .pipe(map(({ data }) => data));
2079
2175
  }
2080
2176
  /**
@@ -2491,22 +2587,6 @@ class ApiCompaniesService {
2491
2587
  return this.http.put(`${this.url}/tdx-account-settings/${id}`, body)
2492
2588
  .pipe(map(({ data }) => data));
2493
2589
  }
2494
- /**
2495
- * Retrieves the employees of a specific location using a provided token.
2496
- *
2497
- * @param params - Input parameters for the request, defined by the `LocationEmployeesIn` interface.
2498
- * @returns An `Observable<LocationEmployeesOut>` that emits the employees
2499
- * associated with the given location.
2500
- * @returns The response type is `ApiSuccess<LocationEmployeesOut>`, from which the `data` field is extracted.
2501
- */
2502
- getLocationEmployeesByToken(params) {
2503
- return this.http.get(`${this.url}/location-employees`, {
2504
- params: params.queryParams,
2505
- headers: {
2506
- Authorization: `Bearer ${params.token}`
2507
- }
2508
- }).pipe(map(({ data }) => data));
2509
- }
2510
2590
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCompaniesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2511
2591
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiCompaniesService, providedIn: 'root' });
2512
2592
  }
@@ -2935,6 +3015,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
2935
3015
  }]
2936
3016
  }] });
2937
3017
 
3018
+ class ApiDropoffsService {
3019
+ environments = inject(ENVIRONMENT_TOKEN);
3020
+ http = inject(HttpClient);
3021
+ /**
3022
+ * Retrieves the URL for the Inventories API from the environment configurations.
3023
+ *
3024
+ * @return {string} The URL of the Inventories API.
3025
+ */
3026
+ get url() {
3027
+ return this.environments.apiDropoffUrl ?? '';
3028
+ }
3029
+ /**
3030
+ * Send a Courier Request for Shipment.
3031
+ *
3032
+ * @param {ShipmentsBookingIn} body - The courier for shipment data.
3033
+ */
3034
+ postShipmentsBooking(body) {
3035
+ return this.http.post(`${this.url}/shipments/booking`, body).pipe(map(({ data }) => data));
3036
+ }
3037
+ /**
3038
+ * Send a EReceipt for Shipment.
3039
+ *
3040
+ * @param {ShipmentsEReceiptIn} body - The EReceipt for Shipment data.
3041
+ */
3042
+ postShipmentsEReceipt(body) {
3043
+ return this.http.post(`${this.url}/shipments/ereceipt`, body).pipe(map(({ data }) => data));
3044
+ }
3045
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiDropoffsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3046
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiDropoffsService, providedIn: 'root' });
3047
+ }
3048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiDropoffsService, decorators: [{
3049
+ type: Injectable,
3050
+ args: [{
3051
+ providedIn: 'root'
3052
+ }]
3053
+ }] });
3054
+
2938
3055
  class ApiEToolsAutoBillingService {
2939
3056
  environments = inject(ENVIRONMENT_TOKEN);
2940
3057
  http = inject(HttpClient);
@@ -3187,7 +3304,7 @@ class ApiInventoriesService {
3187
3304
  * Retrieves a list of checkpoints based on query parameters.
3188
3305
  *
3189
3306
  * @param {QueryParams} params - Query parameters for filtering the checkpoints.
3190
- * @returns {Observable<CheckpointsOut>} The list of checkpoints.
3307
+ * @returns {Observable<CheckpointsInventoryOut>} The list of checkpoints.
3191
3308
  */
3192
3309
  getCheckpoints(params) {
3193
3310
  return this.http.get(`${this.url}/checkpoints`, {
@@ -3432,6 +3549,101 @@ class ApiInventoriesService {
3432
3549
  return this.http.get(`${this.url}/stock-update/packages/${id}`)
3433
3550
  .pipe(map(({ data }) => data));
3434
3551
  }
3552
+ /**
3553
+ * Retrieves a list of courier routes based on query parameters.
3554
+ *
3555
+ * @param {QueryParams} params - Query parameters for filtering the courier routes.
3556
+ * @returns {Observable<CourierRoutesOut>} An observable that emits the list of courier routes.
3557
+ */
3558
+ getCourierRoutes(params) {
3559
+ return this.http.get(`${this.url}/courier-routes`, {
3560
+ params
3561
+ }).pipe(map(({ data }) => data));
3562
+ }
3563
+ /**
3564
+ * Fetches the courier route details based on the provided courier route ID.
3565
+ *
3566
+ * @param {number} id - The courier route id
3567
+ * @return {Observable<CourierRouteOut>} An observable that emits the courier route data.
3568
+ */
3569
+ getCourierRoute(id) {
3570
+ return this.http.get(`${this.url}/courier-routes/${id}`)
3571
+ .pipe(map(({ data }) => data));
3572
+ }
3573
+ /**
3574
+ * Creates a new courier route.
3575
+ *
3576
+ * @param {CourierRouteIn} body - The data for the new courier route.
3577
+ * @returns {Observable<CourierRouteOut>} An observable the created courier route detail.
3578
+ */
3579
+ postCourierRoute(body) {
3580
+ return this.http.post(`${this.url}/courier-routes`, body).pipe(map(({ data }) => data));
3581
+ }
3582
+ /**
3583
+ * Update an existing courier route.
3584
+ *
3585
+ * @param {number} id - The identifier of the courier route record to update.
3586
+ * @param {CourierRouteIn} body - The courier route data to be updated.
3587
+ * @returns {Observable<CourierRouteOut>} An observable detail of the updated courier route.
3588
+ */
3589
+ putCourierRoute(id, body) {
3590
+ return this.http.put(`${this.url}/courier-routes/${id}`, body).pipe(map(({ data }) => data));
3591
+ }
3592
+ /**
3593
+ * Delete an existing courier route.
3594
+ *
3595
+ * @param {number} id - The unique identifier of the courier route to be deleted.
3596
+ * @returns {Observable<CourierRouteOut>} An observable that emits the result of the delete courier route.
3597
+ */
3598
+ deleteCourierRoute(id) {
3599
+ return this.http.delete(`${this.url}/courier-routes/${id}`)
3600
+ .pipe(map(({ data }) => data));
3601
+ }
3602
+ /**
3603
+ * Get a package/shipment enabled to perform an action.
3604
+ *
3605
+ * @param {PackageValidationActionIn} body - package/shipment number to validate.
3606
+ * @returns {Observable<PackageValidationActionOut>} An observable with the package/shipment validated.
3607
+ */
3608
+ postPackageValidationActions(body) {
3609
+ return this.http.post(`${this.url}/package-validation/actions`, body).pipe(map(({ data }) => data));
3610
+ }
3611
+ /**
3612
+ * Edit return first mile resource.
3613
+ *
3614
+ * @param {ReturnFirstMileIn} body - The first mile data to be updated.
3615
+ * @returns {Observable<ReturnFirstMileOut>} An observable with the first mile updated.
3616
+ */
3617
+ putReturnFirstMile(body) {
3618
+ return this.http.put(`${this.url}/return-first-mile`, body).pipe(map(({ data }) => data));
3619
+ }
3620
+ /**
3621
+ * Replaces a Package Reassign Position resource.
3622
+ *
3623
+ * @param {PackageReassignPositionIn} body - The Package Reassign Position resource data to be updated.
3624
+ * @returns {Observable<PackageReassignPositionOut>} An observable with the Package Reassign Position resource updated.
3625
+ */
3626
+ putPackageReassignPositions(body) {
3627
+ return this.http.put(`${this.url}/package-reassign-positions`, body).pipe(map(({ data }) => data));
3628
+ }
3629
+ /**
3630
+ * Edit missing package resource.
3631
+ *
3632
+ * @param {MissingPackagesIn} body - The missing package resource data to be updated.
3633
+ * @returns {Observable<MissingPackagesOut>} An observable with the missing package resource updated.
3634
+ */
3635
+ putMissingPackages(body) {
3636
+ return this.http.put(`${this.url}/missing-packages`, body).pipe(map(({ data }) => data));
3637
+ }
3638
+ /**
3639
+ * Edit package on hold resource..
3640
+ *
3641
+ * @param {PackageOnHoldIn} body - The package on hold resource data to be updated.
3642
+ * @returns {Observable<PackageOnHoldOut>} An observable with the package on hold resource updated.
3643
+ */
3644
+ putPackageOnHold(body) {
3645
+ return this.http.put(`${this.url}/package-on-hold`, body).pipe(map(({ data }) => data));
3646
+ }
3435
3647
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiInventoriesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3436
3648
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiInventoriesService, providedIn: 'root' });
3437
3649
  }
@@ -4438,19 +4650,6 @@ class ApiSecurityService {
4438
4650
  return this.http.get(`${this.url}/auth/me`)
4439
4651
  .pipe(map(({ data }) => data));
4440
4652
  }
4441
- /**
4442
- * Fetches the authenticated user's details from the server.
4443
- *
4444
- * @param token The JWT token used for authorization.
4445
- * @return An Observable that emits the user's details encapsulated in a MeOut object.
4446
- */
4447
- getOtherMe(token) {
4448
- return this.http.get(`${this.url}/auth/me`, {
4449
- headers: {
4450
- Authorization: `Bearer ${token}`
4451
- }
4452
- }).pipe(map(({ data }) => data));
4453
- }
4454
4653
  /**
4455
4654
  * Fetches a user by their unique ID.
4456
4655
  *
@@ -5337,6 +5536,24 @@ var ShipmentIncomeTypeCode;
5337
5536
  ShipmentIncomeTypeCode["EMBASSY"] = "EMB";
5338
5537
  })(ShipmentIncomeTypeCode || (ShipmentIncomeTypeCode = {}));
5339
5538
 
5539
+ var AccountTypeId;
5540
+ (function (AccountTypeId) {
5541
+ AccountTypeId[AccountTypeId["CASH"] = 1] = "CASH";
5542
+ AccountTypeId[AccountTypeId["COMAT"] = 2] = "COMAT";
5543
+ AccountTypeId[AccountTypeId["FOC"] = 3] = "FOC";
5544
+ AccountTypeId[AccountTypeId["EMPLOYEE"] = 4] = "EMPLOYEE";
5545
+ AccountTypeId[AccountTypeId["RPA"] = 5] = "RPA";
5546
+ AccountTypeId[AccountTypeId["GL"] = 6] = "GL";
5547
+ AccountTypeId[AccountTypeId["CUS"] = 7] = "CUS";
5548
+ AccountTypeId[AccountTypeId["VENDOR"] = 8] = "VENDOR";
5549
+ AccountTypeId[AccountTypeId["WPX"] = 9] = "WPX";
5550
+ AccountTypeId[AccountTypeId["DHL"] = 12] = "DHL";
5551
+ })(AccountTypeId || (AccountTypeId = {}));
5552
+ var AccountTypeName;
5553
+ (function (AccountTypeName) {
5554
+ AccountTypeName["EMBASSY"] = "EMBASSY";
5555
+ })(AccountTypeName || (AccountTypeName = {}));
5556
+
5340
5557
  var OperationModuleStatus;
5341
5558
  (function (OperationModuleStatus) {
5342
5559
  OperationModuleStatus["CANCELED"] = "canceled";
@@ -5374,6 +5591,35 @@ var Group;
5374
5591
  Group["expiration"] = "expiration";
5375
5592
  Group["verification"] = "verification";
5376
5593
  })(Group || (Group = {}));
5594
+ var InventoryActions;
5595
+ (function (InventoryActions) {
5596
+ InventoryActions["INVENTORY_CHECK_OUT"] = "inventoryCheckOut";
5597
+ InventoryActions["INVENTORY_COURIER_PICK_UP"] = "inventoryCourierPickUp";
5598
+ InventoryActions["INVENTORY_LOCATION_BACKROOM"] = "inventoryLocationBackroom";
5599
+ InventoryActions["INVENTORY_MISSING_PIECES"] = "inventoryMissingPieces";
5600
+ InventoryActions["INVENTORY_RE_ENTRY_MISSING_PIECES"] = "inventoryReEntryMissingPieces";
5601
+ InventoryActions["INVENTORY_ODD_NOTIFICATION"] = "inventoryOddNotifications";
5602
+ InventoryActions["INVENTORY_ON_HOLD_MISSED_CONNECTION"] = "inventoryOnHoldMissed";
5603
+ })(InventoryActions || (InventoryActions = {}));
5604
+ var InventoryErrorCodes;
5605
+ (function (InventoryErrorCodes) {
5606
+ InventoryErrorCodes["CODE_SHP_FORMAT"] = "INV-E001";
5607
+ InventoryErrorCodes["CODE_PCKG_FORMAT"] = "INV-E002";
5608
+ InventoryErrorCodes["CODE_PACKAGE_NOT_FOUND"] = "INV-E101";
5609
+ InventoryErrorCodes["CODE_EXISTS_INVENTORY_DIFFERENT_LOCATION"] = "INV-E007";
5610
+ InventoryErrorCodes["CODE_PACKAGE_NOT_IN_STOCK"] = "INV-E105";
5611
+ InventoryErrorCodes["CODE_PACKAGE_NOT_MISSING"] = "INV-E107";
5612
+ InventoryErrorCodes["CODE_ACTION_NOT_VALID"] = "INV-E108";
5613
+ InventoryErrorCodes["CODE_MULTIPLE_PACKAGES"] = "INV-E109";
5614
+ InventoryErrorCodes["CODE_PACKAGE_NOT_CHECK_IN"] = "INV-E110";
5615
+ InventoryErrorCodes["CODE_PACKAGE_NOT_DROP_OFF"] = "INV-E111";
5616
+ })(InventoryErrorCodes || (InventoryErrorCodes = {}));
5617
+ var RouteModelType;
5618
+ (function (RouteModelType) {
5619
+ RouteModelType["ROUTE_ID"] = "RouteId";
5620
+ RouteModelType["COURIER"] = "Courier";
5621
+ RouteModelType["COURIER_ROUTE"] = "CourierRoute";
5622
+ })(RouteModelType || (RouteModelType = {}));
5377
5623
 
5378
5624
  var PaymentTypeCode;
5379
5625
  (function (PaymentTypeCode) {
@@ -5644,23 +5890,40 @@ function apiTokenInterceptor(req, next) {
5644
5890
  return next(req);
5645
5891
  }
5646
5892
 
5647
- const DEFAULT_TTL = 10000; // ttl in ms
5648
5893
  const cache = new Map();
5649
5894
  const inFlightRequests = new Map();
5650
5895
  /**
5651
- * Interceptor function to handle HTTP caching for GET requests. It retrieves cached responses
5652
- * if available and valid; otherwise, it processes the request and caches the response for future use.
5896
+ * Resolves the TTL for a URL from the first matching `cacheRoutes` entry.
5897
+ * Returns `null` when there is no match or no routes configured.
5898
+ */
5899
+ function resolveCacheTtl(url, cacheRoutes) {
5900
+ if (!cacheRoutes?.length)
5901
+ return null;
5902
+ for (const route of cacheRoutes) {
5903
+ if (new RegExp(route.pattern).test(url)) {
5904
+ return route.ttl;
5905
+ }
5906
+ }
5907
+ return null;
5908
+ }
5909
+ /**
5910
+ * Interceptor function to handle opt-in HTTP caching for GET requests that match
5911
+ * a configured `cacheRoutes` pattern. Non-matching GETs pass through uncached.
5912
+ * Concurrent in-flight requests for the same key are deduplicated via `shareReplay`.
5653
5913
  *
5654
- * @param {HttpRequest<any>} req - The HTTP request object being intercepted.
5914
+ * @param {HttpRequest<unknown>} req - The HTTP request object being intercepted.
5655
5915
  * @param {HttpHandlerFn} next - The next HTTP handler function in the chain to process the request.
5656
- * @return {Observable<HttpEvent<any>>} An observable that emits the HTTP event, either from cache
5916
+ * @return {Observable<HttpEvent<unknown>>} An observable that emits the HTTP event, either from cache
5657
5917
  * or by invoking the next handler.
5658
5918
  */
5659
5919
  function httpCachingInterceptor(req, next) {
5660
- const { cacheTtl } = inject(ENVIRONMENT_TOKEN);
5920
+ const { cacheRoutes } = inject(ENVIRONMENT_TOKEN);
5661
5921
  if (req.method !== 'GET')
5662
5922
  return next(req);
5663
5923
  const key = req.urlWithParams;
5924
+ const routeTtl = resolveCacheTtl(key, cacheRoutes);
5925
+ if (routeTtl === null)
5926
+ return next(req);
5664
5927
  const cached = cache.get(key);
5665
5928
  if (cached) {
5666
5929
  const isExpired = Date.now() > cached.ttl;
@@ -5677,7 +5940,7 @@ function httpCachingInterceptor(req, next) {
5677
5940
  if (!(res instanceof HttpResponse)) {
5678
5941
  return;
5679
5942
  }
5680
- const ttl = Date.now() + (cacheTtl ?? DEFAULT_TTL);
5943
+ const ttl = Date.now() + routeTtl;
5681
5944
  cache.set(key, { res, ttl });
5682
5945
  }), finalize(() => {
5683
5946
  inFlightRequests.delete(key);
@@ -5759,5 +6022,5 @@ const xmlHeaders = (format = 'object') => {
5759
6022
  * Generated bundle index. Do not edit.
5760
6023
  */
5761
6024
 
5762
- export { AlphaNumeric, ApiBillingCOService, ApiBillingDOService, ApiBillingGtService, ApiBillingMxService, ApiBillingPaService, ApiBillingSvService, ApiCashOperationsService, ApiCatalogsService, ApiCompaniesService, ApiCompositionService, ApiCustomsService, ApiDiscountsService, ApiEToolsAutoBillingService, ApiEventsService, ApiExternalOperationsService, ApiInventoriesService, ApiInvoicesService, ApiNotificationsService, ApiOpenItemsService, ApiQuoteService, ApiReportsService, ApiSecurityService, ApiServicesService, ApiShipmentsService, ApiSuppliesService, ApiSurveysService, CryptoService, DefaultValueType, DepositTypeCode, DocumentStatusCode, ENVIRONMENT_TOKEN, Event, Group, NgxServicesModule, OpeningStatusCode, OperationModuleStatus, PaymentTypeCode, PrintMode, PrintableFormat, PrintersService, PrintersType, ShipmentIncomeTypeCode, TransferenceTypeCode, ViewSectionOption, WebSocketsService, apiHeadersInterceptor, apiTokenInterceptor, base64PdfToUrl, downloadBase64Pdf, httpCachingInterceptor, httpParams, pdfHeaders, provideNgxServices, queryString, xmlHeaders };
6025
+ export { AccountTypeId, AccountTypeName, AlphaNumeric, ApiBillingCOService, ApiBillingDOService, ApiBillingGtService, ApiBillingMxService, ApiBillingPaService, ApiBillingSvService, ApiCashOperationsService, ApiCatalogsService, ApiCheckpointsService, ApiCompaniesService, ApiCompositionService, ApiCustomsService, ApiDiscountsService, ApiDropoffsService, ApiEToolsAutoBillingService, ApiEventsService, ApiExternalOperationsService, ApiInventoriesService, ApiInvoicesService, ApiNotificationsService, ApiOpenItemsService, ApiQuoteService, ApiReportsService, ApiSecurityService, ApiServicesService, ApiShipmentsService, ApiSuppliesService, ApiSurveysService, CryptoService, DefaultValueType, DepositTypeCode, DocumentStatusCode, ENVIRONMENT_TOKEN, Event, Group, InventoryActions, InventoryErrorCodes, NgxServicesModule, OpeningStatusCode, OperationModuleStatus, PaymentTypeCode, PrintMode, PrintableFormat, PrintersService, PrintersType, RouteModelType, ShipmentIncomeTypeCode, TransferenceTypeCode, ViewSectionOption, WebSocketsService, apiHeadersInterceptor, apiTokenInterceptor, base64PdfToUrl, downloadBase64Pdf, httpCachingInterceptor, httpParams, pdfHeaders, provideNgxServices, queryString, xmlHeaders };
5763
6026
  //# sourceMappingURL=experteam-mx-ngx-services.mjs.map