b2m-utils 0.0.114 → 0.0.116

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/build/index.js CHANGED
@@ -2,259 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var formatDateString = function (dateString, staticTime) {
6
- if (staticTime === void 0) { staticTime = false; }
7
- if (dateString.includes('.000Z')) {
8
- var firstSplit = dateString === null || dateString === void 0 ? void 0 : dateString.split('.000Z')[0];
9
- var secondSplit = firstSplit === null || firstSplit === void 0 ? void 0 : firstSplit.split('T');
10
- if (secondSplit === null || secondSplit === void 0 ? void 0 : secondSplit.length) {
11
- if (staticTime) {
12
- return "".concat(secondSplit[0], " 12:00:00");
13
- }
14
- else {
15
- return "".concat(secondSplit[0], " ").concat(secondSplit[1]);
16
- }
17
- }
18
- }
19
- else if (dateString.includes(' ')) {
20
- if (staticTime) {
21
- return "".concat(dateString.split(' ')[0], " 12:00:00");
22
- }
23
- else {
24
- return dateString;
25
- }
26
- }
27
- return '';
28
- };
29
-
30
- function getConfigurationFromDomain(domainConfigurations, configurationName) {
31
- return domainConfigurations.find(function (i) { return i.name === configurationName; });
32
- }
33
-
34
- var getCookies = function (cookies) {
35
- if (cookies) {
36
- var data_1 = {};
37
- cookies
38
- .split(';')
39
- .map(function (item) { return item.trim().split('='); })
40
- .forEach(function (item) { return (data_1[item[0]] = item[1]); });
41
- return data_1;
42
- }
43
- else {
44
- return {};
45
- }
46
- };
47
-
48
- function getDataFromToken(token) {
49
- var jwtDataBase64 = token.split('.')[1];
50
- var data = JSON.parse(Buffer.from(jwtDataBase64, 'base64').toString());
51
- if (data.exp * 1000 < Date.now()) {
52
- throw new Error('Token expirado.');
53
- }
54
- return data;
55
- }
56
-
57
- exports.ApplicationColumnNameEnum = void 0;
58
- (function (ApplicationColumnNameEnum) {
59
- ApplicationColumnNameEnum["DEPARTURE_AT"] = "departureAt";
60
- ApplicationColumnNameEnum["ARRIVAL_AT"] = "arrivalAt";
61
- ApplicationColumnNameEnum["CLEARANCE_AT"] = "clearanceAt";
62
- ApplicationColumnNameEnum["DELIVERY_AT"] = "deliveryAt";
63
- ApplicationColumnNameEnum["CREATED_AT"] = "createdAt";
64
- })(exports.ApplicationColumnNameEnum || (exports.ApplicationColumnNameEnum = {}));
65
-
66
- exports.ApplicationEnum = void 0;
67
- (function (ApplicationEnum) {
68
- ApplicationEnum[ApplicationEnum["B2M_CORE"] = 1] = "B2M_CORE";
69
- ApplicationEnum[ApplicationEnum["TMS"] = 2] = "TMS";
70
- ApplicationEnum[ApplicationEnum["SPOT"] = 3] = "SPOT";
71
- ApplicationEnum[ApplicationEnum["TRACK_PROCESSES"] = 4] = "TRACK_PROCESSES";
72
- ApplicationEnum[ApplicationEnum["RATECARD_MANAGEMENT"] = 5] = "RATECARD_MANAGEMENT";
73
- ApplicationEnum[ApplicationEnum["SLA"] = 6] = "SLA";
74
- ApplicationEnum[ApplicationEnum["AUDIT"] = 7] = "AUDIT";
75
- })(exports.ApplicationEnum || (exports.ApplicationEnum = {}));
76
-
77
- exports.CountryEnum = void 0;
78
- (function (CountryEnum) {
79
- CountryEnum[CountryEnum["BRAZIL"] = 1] = "BRAZIL";
80
- })(exports.CountryEnum || (exports.CountryEnum = {}));
81
-
82
- exports.CurrencyEnum = void 0;
83
- (function (CurrencyEnum) {
84
- CurrencyEnum[CurrencyEnum["REAL"] = 1] = "REAL";
85
- CurrencyEnum[CurrencyEnum["DOLAR"] = 2] = "DOLAR";
86
- CurrencyEnum[CurrencyEnum["EURO"] = 3] = "EURO";
87
- CurrencyEnum[CurrencyEnum["IENE"] = 4] = "IENE";
88
- })(exports.CurrencyEnum || (exports.CurrencyEnum = {}));
89
-
90
- exports.DomainConfigurationEnum = void 0;
91
- (function (DomainConfigurationEnum) {
92
- DomainConfigurationEnum["CLEARANCE_DAYS"] = "CLEARANCE_DAYS";
93
- DomainConfigurationEnum["CARGO_REMOVAL_DAYS"] = "CARGO_REMOVAL_DAYS";
94
- DomainConfigurationEnum["DELIVERY_DAYS"] = "DELIVERY_DAYS";
95
- DomainConfigurationEnum["DEMURRAGE_EXPIRY_NOTIFICATION_DAYS"] = "DEMURRAGE_EXPIRY_NOTIFICATION_DAYS";
96
- DomainConfigurationEnum["INVOICE_EXPIRY_NOTIFICATION_DAYS"] = "INVOICE_EXPIRY_NOTIFICATION_DAYS";
97
- })(exports.DomainConfigurationEnum || (exports.DomainConfigurationEnum = {}));
98
-
99
- exports.DomainTypeEnum = void 0;
100
- (function (DomainTypeEnum) {
101
- DomainTypeEnum[DomainTypeEnum["TMS"] = 1] = "TMS";
102
- DomainTypeEnum[DomainTypeEnum["SPOT"] = 2] = "SPOT";
103
- DomainTypeEnum[DomainTypeEnum["PROVIDER"] = 3] = "PROVIDER";
104
- DomainTypeEnum[DomainTypeEnum["FREIGHT_FORWARDER"] = 4] = "FREIGHT_FORWARDER";
105
- DomainTypeEnum[DomainTypeEnum["DISPATCHER"] = 5] = "DISPATCHER";
106
- DomainTypeEnum[DomainTypeEnum["B2M_CLIENT"] = 6] = "B2M_CLIENT";
107
- })(exports.DomainTypeEnum || (exports.DomainTypeEnum = {}));
108
-
109
- exports.FeeCalculationTypeEnum = void 0;
110
- (function (FeeCalculationTypeEnum) {
111
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["FIXED"] = 1] = "FIXED";
112
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["TAXED_WEIGHT"] = 2] = "TAXED_WEIGHT";
113
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["INTERNATIONAL_CHARGE"] = 3] = "INTERNATIONAL_CHARGE";
114
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["CONVERSION_TAX"] = 4] = "CONVERSION_TAX";
115
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["CUBED_WEIGHT"] = 5] = "CUBED_WEIGHT";
116
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["COMMODITY_VALUE"] = 6] = "COMMODITY_VALUE";
117
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["FRACTIONED"] = 7] = "FRACTIONED";
118
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["FREIGHT"] = 8] = "FREIGHT";
119
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["TOTAL_PERCENTAGE"] = 9] = "TOTAL_PERCENTAGE";
120
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["MIN_VALUE"] = 10] = "MIN_VALUE";
121
- FeeCalculationTypeEnum[FeeCalculationTypeEnum["SUM_CONTAINERS"] = 11] = "SUM_CONTAINERS";
122
- })(exports.FeeCalculationTypeEnum || (exports.FeeCalculationTypeEnum = {}));
123
-
124
- exports.FeeCategoryEnum = void 0;
125
- (function (FeeCategoryEnum) {
126
- FeeCategoryEnum[FeeCategoryEnum["ORIGIN"] = 1] = "ORIGIN";
127
- FeeCategoryEnum[FeeCategoryEnum["INTERNATIONAL"] = 2] = "INTERNATIONAL";
128
- FeeCategoryEnum[FeeCategoryEnum["DESTINATION"] = 3] = "DESTINATION";
129
- FeeCategoryEnum[FeeCategoryEnum["DELIVERY"] = 4] = "DELIVERY";
130
- FeeCategoryEnum[FeeCategoryEnum["ADDITIONAL"] = 5] = "ADDITIONAL";
131
- FeeCategoryEnum[FeeCategoryEnum["PICKUP"] = 6] = "PICKUP";
132
- FeeCategoryEnum[FeeCategoryEnum["FREIGHT"] = 7] = "FREIGHT";
133
- FeeCategoryEnum[FeeCategoryEnum["FEES"] = 8] = "FEES";
134
- FeeCategoryEnum[FeeCategoryEnum["TAXES"] = 9] = "TAXES";
135
- })(exports.FeeCategoryEnum || (exports.FeeCategoryEnum = {}));
136
-
137
- exports.ModalEnum = void 0;
138
- (function (ModalEnum) {
139
- ModalEnum[ModalEnum["AIR"] = 1] = "AIR";
140
- ModalEnum[ModalEnum["OCEAN_FCL"] = 2] = "OCEAN_FCL";
141
- ModalEnum[ModalEnum["OCEAN_LCL"] = 3] = "OCEAN_LCL";
142
- ModalEnum[ModalEnum["ROAD_FTL"] = 4] = "ROAD_FTL";
143
- ModalEnum[ModalEnum["ROAD_LTL"] = 5] = "ROAD_LTL";
144
- })(exports.ModalEnum || (exports.ModalEnum = {}));
145
-
146
- exports.NotificationTypeEnum = void 0;
147
- (function (NotificationTypeEnum) {
148
- NotificationTypeEnum[NotificationTypeEnum["USER_NOTIFICATION"] = 1] = "USER_NOTIFICATION";
149
- NotificationTypeEnum[NotificationTypeEnum["DOMAIN_NOTIFICATION"] = 2] = "DOMAIN_NOTIFICATION";
150
- })(exports.NotificationTypeEnum || (exports.NotificationTypeEnum = {}));
151
-
152
- exports.PermissionEnum = void 0;
153
- (function (PermissionEnum) {
154
- PermissionEnum[PermissionEnum["B2M_ADMIN"] = 1] = "B2M_ADMIN";
155
- PermissionEnum[PermissionEnum["DOMAIN_ADMIN"] = 2] = "DOMAIN_ADMIN";
156
- PermissionEnum[PermissionEnum["TMS"] = 3] = "TMS";
157
- PermissionEnum[PermissionEnum["SPOT"] = 4] = "SPOT";
158
- PermissionEnum[PermissionEnum["SPOT_PROVIDER"] = 5] = "SPOT_PROVIDER";
159
- PermissionEnum[PermissionEnum["TRACK_PROCESSES"] = 6] = "TRACK_PROCESSES";
160
- PermissionEnum[PermissionEnum["DISPATCHER"] = 7] = "DISPATCHER";
161
- PermissionEnum[PermissionEnum["RATECARD_MANAGEMENT"] = 8] = "RATECARD_MANAGEMENT";
162
- PermissionEnum[PermissionEnum["SLA"] = 9] = "SLA";
163
- })(exports.PermissionEnum || (exports.PermissionEnum = {}));
164
-
165
- exports.SpotStatusEnum = void 0;
166
- (function (SpotStatusEnum) {
167
- SpotStatusEnum[SpotStatusEnum["DRAFT"] = 1] = "DRAFT";
168
- SpotStatusEnum[SpotStatusEnum["OPEN"] = 2] = "OPEN";
169
- SpotStatusEnum[SpotStatusEnum["CLOSED"] = 3] = "CLOSED";
170
- SpotStatusEnum[SpotStatusEnum["FINISHED"] = 4] = "FINISHED";
171
- })(exports.SpotStatusEnum || (exports.SpotStatusEnum = {}));
172
-
173
- exports.TrackProcessProviderTypeEnum = void 0;
174
- (function (TrackProcessProviderTypeEnum) {
175
- TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["FREIGHT_FORWARDER"] = 1] = "FREIGHT_FORWARDER";
176
- TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["DISPATCHER"] = 2] = "DISPATCHER";
177
- TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["TERMINAL"] = 3] = "TERMINAL";
178
- TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["SHIPPING_COMPANY"] = 4] = "SHIPPING_COMPANY";
179
- TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["OTHERS"] = 5] = "OTHERS";
180
- })(exports.TrackProcessProviderTypeEnum || (exports.TrackProcessProviderTypeEnum = {}));
181
-
182
- var getFormattedFreightPlaceName = function (freightPlace, modalId, complete, sqlVersion) {
183
- var _a, _b;
184
- if (complete === void 0) { complete = false; }
185
- if (sqlVersion === void 0) { sqlVersion = false; }
186
- if (sqlVersion) {
187
- var iataText = freightPlace.iata ? "(".concat(freightPlace.iata, ") ") : '';
188
- var locationText = freightPlace.location ? " ".concat(freightPlace.location) : '';
189
- var countryText = [exports.ModalEnum.OCEAN_FCL, exports.ModalEnum.OCEAN_LCL].includes(modalId) ? "".concat(freightPlace.freightPlaceCountryName, ", ") : '';
190
- return "".concat(iataText).concat(freightPlace.name).concat(locationText).concat(complete ? " - ".concat(countryText).concat(freightPlace.freightPlaceRegionName) : '');
191
- }
192
- else {
193
- var iataText = freightPlace.iata ? "(".concat(freightPlace.iata, ") ") : '';
194
- var locationText = freightPlace.location ? " ".concat(freightPlace.location) : '';
195
- var countryText = [exports.ModalEnum.OCEAN_FCL, exports.ModalEnum.OCEAN_LCL].includes(modalId) ? "".concat((_a = freightPlace.freightPlaceCountry) === null || _a === void 0 ? void 0 : _a.name, ", ") : '';
196
- return "".concat(iataText).concat(freightPlace.name).concat(locationText).concat(complete ? " - ".concat(countryText).concat((_b = freightPlace.freightPlaceRegion) === null || _b === void 0 ? void 0 : _b.name) : '');
197
- }
198
- };
199
-
200
- /******************************************************************************
201
- Copyright (c) Microsoft Corporation.
202
-
203
- Permission to use, copy, modify, and/or distribute this software for any
204
- purpose with or without fee is hereby granted.
205
-
206
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
207
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
208
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
209
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
210
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
211
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
212
- PERFORMANCE OF THIS SOFTWARE.
213
- ***************************************************************************** */
214
-
215
- function __awaiter(thisArg, _arguments, P, generator) {
216
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
217
- return new (P || (P = Promise))(function (resolve, reject) {
218
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
219
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
220
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
221
- step((generator = generator.apply(thisArg, _arguments || [])).next());
222
- });
223
- }
224
-
225
- function __generator(thisArg, body) {
226
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
227
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
228
- function verb(n) { return function (v) { return step([n, v]); }; }
229
- function step(op) {
230
- if (f) throw new TypeError("Generator is already executing.");
231
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
232
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
233
- if (y = 0, t) op = [op[0] & 2, t.value];
234
- switch (op[0]) {
235
- case 0: case 1: t = op; break;
236
- case 4: _.label++; return { value: op[1], done: false };
237
- case 5: _.label++; y = op[1]; op = [0]; continue;
238
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
239
- default:
240
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
241
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
242
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
243
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
244
- if (t[2]) _.ops.pop();
245
- _.trys.pop(); continue;
246
- }
247
- op = body.call(thisArg, _);
248
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
249
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
250
- }
251
- }
252
-
253
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
254
- var e = new Error(message);
255
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
256
- };
257
-
258
5
  /**
259
6
  * @name toDate
260
7
  * @category Common Helpers
@@ -769,9 +516,69 @@ function isValid(date) {
769
516
  }
770
517
 
771
518
  /**
772
- * @name startOfYear
773
- * @category Year Helpers
774
- * @summary Return the start of a year for the given date.
519
+ * The {@link eachDayOfInterval} function options.
520
+ */
521
+
522
+ /**
523
+ * @name eachDayOfInterval
524
+ * @category Interval Helpers
525
+ * @summary Return the array of dates within the specified time interval.
526
+ *
527
+ * @description
528
+ * Return the array of dates within the specified time interval.
529
+ *
530
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
531
+ *
532
+ * @param interval - The interval.
533
+ * @param options - An object with options.
534
+ *
535
+ * @returns The array with starts of days from the day of the interval start to the day of the interval end
536
+ *
537
+ * @example
538
+ * // Each day between 6 October 2014 and 10 October 2014:
539
+ * const result = eachDayOfInterval({
540
+ * start: new Date(2014, 9, 6),
541
+ * end: new Date(2014, 9, 10)
542
+ * })
543
+ * //=> [
544
+ * // Mon Oct 06 2014 00:00:00,
545
+ * // Tue Oct 07 2014 00:00:00,
546
+ * // Wed Oct 08 2014 00:00:00,
547
+ * // Thu Oct 09 2014 00:00:00,
548
+ * // Fri Oct 10 2014 00:00:00
549
+ * // ]
550
+ */
551
+ function eachDayOfInterval(interval, options) {
552
+ const startDate = toDate(interval.start);
553
+ const endDate = toDate(interval.end);
554
+
555
+ let reversed = +startDate > +endDate;
556
+ const endTime = reversed ? +startDate : +endDate;
557
+ const currentDate = reversed ? endDate : startDate;
558
+ currentDate.setHours(0, 0, 0, 0);
559
+
560
+ let step = options?.step ?? 1;
561
+ if (!step) return [];
562
+ if (step < 0) {
563
+ step = -step;
564
+ reversed = !reversed;
565
+ }
566
+
567
+ const dates = [];
568
+
569
+ while (+currentDate <= endTime) {
570
+ dates.push(toDate(currentDate));
571
+ currentDate.setDate(currentDate.getDate() + step);
572
+ currentDate.setHours(0, 0, 0, 0);
573
+ }
574
+
575
+ return reversed ? dates.reverse() : dates;
576
+ }
577
+
578
+ /**
579
+ * @name startOfYear
580
+ * @category Year Helpers
581
+ * @summary Return the start of a year for the given date.
775
582
  *
776
583
  * @description
777
584
  * Return the start of a year for the given date.
@@ -6160,6 +5967,414 @@ const ptBR = {
6160
5967
  },
6161
5968
  };
6162
5969
 
5970
+ var formatDateString = function (dateString, staticTime) {
5971
+ if (staticTime === void 0) { staticTime = false; }
5972
+ if (dateString.includes('.000Z')) {
5973
+ var firstSplit = dateString === null || dateString === void 0 ? void 0 : dateString.split('.000Z')[0];
5974
+ var secondSplit = firstSplit === null || firstSplit === void 0 ? void 0 : firstSplit.split('T');
5975
+ if (secondSplit === null || secondSplit === void 0 ? void 0 : secondSplit.length) {
5976
+ if (staticTime) {
5977
+ return "".concat(secondSplit[0], " 12:00:00");
5978
+ }
5979
+ else {
5980
+ return "".concat(secondSplit[0], " ").concat(secondSplit[1]);
5981
+ }
5982
+ }
5983
+ }
5984
+ else if (dateString.includes(' ')) {
5985
+ if (staticTime) {
5986
+ return "".concat(dateString.split(' ')[0], " 12:00:00");
5987
+ }
5988
+ else {
5989
+ return dateString;
5990
+ }
5991
+ }
5992
+ return '';
5993
+ };
5994
+
5995
+ var getContractFromFreight = function (contracts, freight) {
5996
+ return contracts.find(function (item) {
5997
+ if (item.shippingCompanyId === freight.shippingCompanyId) {
5998
+ var formattedCteAt = format(parse(formatDateString(freight.cteAt), "yyyy-MM-dd HH:mm:ss", new Date()), "yyyy-MM-dd", {
5999
+ locale: ptBR,
6000
+ });
6001
+ var formattedStartsAt = format(parse(formatDateString(item.startsAt), "yyyy-MM-dd HH:mm:ss", new Date()), "yyyy-MM-dd", {
6002
+ locale: ptBR,
6003
+ });
6004
+ var formattedEndsAt = format(parse(formatDateString(item.endsAt), "yyyy-MM-dd HH:mm:ss", new Date()), "yyyy-MM-dd", {
6005
+ locale: ptBR,
6006
+ });
6007
+ if (formattedCteAt >= formattedStartsAt && formattedCteAt <= formattedEndsAt) {
6008
+ return true;
6009
+ }
6010
+ }
6011
+ return false;
6012
+ });
6013
+ };
6014
+
6015
+ var getContractRouteFromFreight = function (contracts, freight) {
6016
+ var _a;
6017
+ var contract = getContractFromFreight(contracts, freight);
6018
+ if (contract) {
6019
+ var routesToStateDestination = (_a = contract.DomainSlaRoute) === null || _a === void 0 ? void 0 : _a.filter(function (it) { var _a; return it.stateDestinationId === ((_a = freight.cityDestination) === null || _a === void 0 ? void 0 : _a.state.id); });
6020
+ console.log({
6021
+ routesToStateDestination: routesToStateDestination,
6022
+ });
6023
+ if (routesToStateDestination === null || routesToStateDestination === void 0 ? void 0 : routesToStateDestination.length) {
6024
+ var routesToCityDestination = routesToStateDestination.filter(function (it) { return it.cityDestinationId === freight.cityDestinationId; });
6025
+ if (routesToCityDestination === null || routesToCityDestination === void 0 ? void 0 : routesToCityDestination.length) {
6026
+ console.log({
6027
+ routesToCityDestination: routesToCityDestination,
6028
+ });
6029
+ var routeFromCityOriginAndToCityDestination = routesToCityDestination.find(function (it) { return it.cityOriginId === freight.cityOriginId; });
6030
+ if (routeFromCityOriginAndToCityDestination) {
6031
+ console.log({
6032
+ routeFromCityOriginAndToCityDestination: routeFromCityOriginAndToCityDestination,
6033
+ });
6034
+ return routeFromCityOriginAndToCityDestination;
6035
+ }
6036
+ else {
6037
+ var routeFromStateOriginWithoutCity = routesToCityDestination.find(function (it) { var _a, _b; return it.stateOriginId === ((_b = (_a = freight.cityOrigin) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.id) && it.cityOriginId === null; });
6038
+ if (routeFromStateOriginWithoutCity) {
6039
+ console.log({
6040
+ routeFromStateOriginWithoutCity: routeFromStateOriginWithoutCity,
6041
+ });
6042
+ return routeFromStateOriginWithoutCity;
6043
+ }
6044
+ else {
6045
+ var routeWithoutCityAndStateOrigin = routesToCityDestination.find(function (it) { return it.stateOriginId === null && it.cityOriginId === null; });
6046
+ if (routeWithoutCityAndStateOrigin) {
6047
+ console.log({
6048
+ routeWithoutCityAndStateOrigin: routeWithoutCityAndStateOrigin,
6049
+ });
6050
+ return routeWithoutCityAndStateOrigin;
6051
+ }
6052
+ }
6053
+ }
6054
+ }
6055
+ else {
6056
+ var routesWithoutCityDestination = routesToStateDestination.filter(function (it) { return it.cityDestinationId === null; });
6057
+ var routesFromStateOrigin = routesWithoutCityDestination.filter(function (it) { var _a, _b; return it.stateOriginId === ((_b = (_a = freight.cityOrigin) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.id); });
6058
+ if (routesFromStateOrigin === null || routesFromStateOrigin === void 0 ? void 0 : routesFromStateOrigin.length) {
6059
+ var routeFromCityOrigin = routesFromStateOrigin.find(function (it) { return it.cityOriginId === freight.cityOriginId; });
6060
+ if (routeFromCityOrigin) {
6061
+ console.log({
6062
+ routeFromCityOrigin: routeFromCityOrigin,
6063
+ });
6064
+ return routeFromCityOrigin;
6065
+ }
6066
+ else {
6067
+ var routeFromStateOrigin = routesFromStateOrigin.find(function (it) { var _a, _b; return it.stateOriginId === ((_b = (_a = freight.cityOrigin) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.id) && it.cityOriginId === null; });
6068
+ if (routeFromStateOrigin) {
6069
+ console.log({
6070
+ routeFromStateOrigin: routeFromStateOrigin
6071
+ });
6072
+ return routeFromStateOrigin;
6073
+ }
6074
+ }
6075
+ }
6076
+ else {
6077
+ var routeFromStateDestination = routesToStateDestination.find(function (it) { var _a, _b; return it.stateDestinationId === ((_b = (_a = freight.cityDestination) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.id) && it.cityDestinationId === null && it.cityOriginId === null && it.stateOriginId === null; });
6078
+ if (routeFromStateDestination) {
6079
+ console.log({
6080
+ routeFromStateDestination: routeFromStateDestination,
6081
+ });
6082
+ return routeFromStateDestination;
6083
+ }
6084
+ }
6085
+ }
6086
+ }
6087
+ }
6088
+ return false;
6089
+ };
6090
+
6091
+ var getRouteDeliveryTimeFromFreight = function (freight, contracts) {
6092
+ var _a;
6093
+ var route = getContractRouteFromFreight(contracts, freight);
6094
+ if (freight.cteAt && freight.deliveredAt) {
6095
+ if (route) {
6096
+ var freightStarts = parse(formatDateString(freight.cteAt), "yyyy-MM-dd HH:mm:ss", new Date());
6097
+ var freightsEnds = parse(formatDateString(freight.deliveredAt), "yyyy-MM-dd HH:mm:ss", new Date());
6098
+ if (freightStarts < freightsEnds) {
6099
+ var daysDifference = eachDayOfInterval({
6100
+ start: freightStarts,
6101
+ end: freightsEnds,
6102
+ });
6103
+ if (daysDifference instanceof Array) {
6104
+ var daysToDeliveryArray_1 = (_a = route.daysToDelivery) === null || _a === void 0 ? void 0 : _a.split(',').map(function (it) { return +it; });
6105
+ var daysToDeliveryQtd = daysDifference.filter(function (date) {
6106
+ var dateDay = date.getDay();
6107
+ return daysToDeliveryArray_1.includes(dateDay);
6108
+ });
6109
+ if (daysToDeliveryQtd.length) {
6110
+ return daysToDeliveryQtd.length - 1;
6111
+ }
6112
+ }
6113
+ }
6114
+ }
6115
+ }
6116
+ return 'ND';
6117
+ };
6118
+
6119
+ var getRouteOnTimeFromFreight = function (freight, contracts) {
6120
+ var _a;
6121
+ var route = getContractRouteFromFreight(contracts, freight);
6122
+ if (route) {
6123
+ if (freight.cteAt && freight.deliveredAt) {
6124
+ var contract = getContractFromFreight(contracts, freight);
6125
+ if (contract) {
6126
+ var freightStarts = parse(formatDateString(freight.cteAt), "yyyy-MM-dd HH:mm:ss", new Date());
6127
+ var freightEnds = parse(formatDateString(freight.deliveredAt), "yyyy-MM-dd HH:mm:ss", new Date());
6128
+ if (freightStarts < freightEnds) {
6129
+ var daysDifference = eachDayOfInterval({
6130
+ start: freightStarts,
6131
+ end: freightEnds,
6132
+ });
6133
+ if (daysDifference instanceof Array) {
6134
+ var daysToDeliveryArray_1 = (_a = route.daysToDelivery) === null || _a === void 0 ? void 0 : _a.split(',').map(function (it) { return +it; });
6135
+ var daysToDeliveryQtd = daysDifference.filter(function (date) {
6136
+ var dateDay = date.getDay();
6137
+ return daysToDeliveryArray_1 === null || daysToDeliveryArray_1 === void 0 ? void 0 : daysToDeliveryArray_1.includes(dateDay);
6138
+ });
6139
+ if (daysToDeliveryQtd.length) {
6140
+ return (daysToDeliveryQtd.length - 1) <= route.transitTime ? 'Sim' : 'Não';
6141
+ }
6142
+ }
6143
+ }
6144
+ }
6145
+ }
6146
+ }
6147
+ return 'ND';
6148
+ };
6149
+
6150
+ function getConfigurationFromDomain(domainConfigurations, configurationName) {
6151
+ return domainConfigurations.find(function (i) { return i.name === configurationName; });
6152
+ }
6153
+
6154
+ var getCookies = function (cookies) {
6155
+ if (cookies) {
6156
+ var data_1 = {};
6157
+ cookies
6158
+ .split(';')
6159
+ .map(function (item) { return item.trim().split('='); })
6160
+ .forEach(function (item) { return (data_1[item[0]] = item[1]); });
6161
+ return data_1;
6162
+ }
6163
+ else {
6164
+ return {};
6165
+ }
6166
+ };
6167
+
6168
+ function getDataFromToken(token) {
6169
+ var jwtDataBase64 = token.split('.')[1];
6170
+ var data = JSON.parse(Buffer.from(jwtDataBase64, 'base64').toString());
6171
+ if (data.exp * 1000 < Date.now()) {
6172
+ throw new Error('Token expirado.');
6173
+ }
6174
+ return data;
6175
+ }
6176
+
6177
+ exports.ApplicationColumnNameEnum = void 0;
6178
+ (function (ApplicationColumnNameEnum) {
6179
+ ApplicationColumnNameEnum["DEPARTURE_AT"] = "departureAt";
6180
+ ApplicationColumnNameEnum["ARRIVAL_AT"] = "arrivalAt";
6181
+ ApplicationColumnNameEnum["CLEARANCE_AT"] = "clearanceAt";
6182
+ ApplicationColumnNameEnum["DELIVERY_AT"] = "deliveryAt";
6183
+ ApplicationColumnNameEnum["CREATED_AT"] = "createdAt";
6184
+ })(exports.ApplicationColumnNameEnum || (exports.ApplicationColumnNameEnum = {}));
6185
+
6186
+ exports.ApplicationEnum = void 0;
6187
+ (function (ApplicationEnum) {
6188
+ ApplicationEnum[ApplicationEnum["B2M_CORE"] = 1] = "B2M_CORE";
6189
+ ApplicationEnum[ApplicationEnum["TMS"] = 2] = "TMS";
6190
+ ApplicationEnum[ApplicationEnum["SPOT"] = 3] = "SPOT";
6191
+ ApplicationEnum[ApplicationEnum["TRACK_PROCESSES"] = 4] = "TRACK_PROCESSES";
6192
+ ApplicationEnum[ApplicationEnum["RATECARD_MANAGEMENT"] = 5] = "RATECARD_MANAGEMENT";
6193
+ ApplicationEnum[ApplicationEnum["SLA"] = 6] = "SLA";
6194
+ ApplicationEnum[ApplicationEnum["AUDIT"] = 7] = "AUDIT";
6195
+ })(exports.ApplicationEnum || (exports.ApplicationEnum = {}));
6196
+
6197
+ exports.CountryEnum = void 0;
6198
+ (function (CountryEnum) {
6199
+ CountryEnum[CountryEnum["BRAZIL"] = 1] = "BRAZIL";
6200
+ })(exports.CountryEnum || (exports.CountryEnum = {}));
6201
+
6202
+ exports.CurrencyEnum = void 0;
6203
+ (function (CurrencyEnum) {
6204
+ CurrencyEnum[CurrencyEnum["REAL"] = 1] = "REAL";
6205
+ CurrencyEnum[CurrencyEnum["DOLAR"] = 2] = "DOLAR";
6206
+ CurrencyEnum[CurrencyEnum["EURO"] = 3] = "EURO";
6207
+ CurrencyEnum[CurrencyEnum["IENE"] = 4] = "IENE";
6208
+ })(exports.CurrencyEnum || (exports.CurrencyEnum = {}));
6209
+
6210
+ exports.DomainConfigurationEnum = void 0;
6211
+ (function (DomainConfigurationEnum) {
6212
+ DomainConfigurationEnum["CLEARANCE_DAYS"] = "CLEARANCE_DAYS";
6213
+ DomainConfigurationEnum["CARGO_REMOVAL_DAYS"] = "CARGO_REMOVAL_DAYS";
6214
+ DomainConfigurationEnum["DELIVERY_DAYS"] = "DELIVERY_DAYS";
6215
+ DomainConfigurationEnum["DEMURRAGE_EXPIRY_NOTIFICATION_DAYS"] = "DEMURRAGE_EXPIRY_NOTIFICATION_DAYS";
6216
+ DomainConfigurationEnum["INVOICE_EXPIRY_NOTIFICATION_DAYS"] = "INVOICE_EXPIRY_NOTIFICATION_DAYS";
6217
+ })(exports.DomainConfigurationEnum || (exports.DomainConfigurationEnum = {}));
6218
+
6219
+ exports.DomainTypeEnum = void 0;
6220
+ (function (DomainTypeEnum) {
6221
+ DomainTypeEnum[DomainTypeEnum["TMS"] = 1] = "TMS";
6222
+ DomainTypeEnum[DomainTypeEnum["SPOT"] = 2] = "SPOT";
6223
+ DomainTypeEnum[DomainTypeEnum["PROVIDER"] = 3] = "PROVIDER";
6224
+ DomainTypeEnum[DomainTypeEnum["FREIGHT_FORWARDER"] = 4] = "FREIGHT_FORWARDER";
6225
+ DomainTypeEnum[DomainTypeEnum["DISPATCHER"] = 5] = "DISPATCHER";
6226
+ DomainTypeEnum[DomainTypeEnum["B2M_CLIENT"] = 6] = "B2M_CLIENT";
6227
+ })(exports.DomainTypeEnum || (exports.DomainTypeEnum = {}));
6228
+
6229
+ exports.FeeCalculationTypeEnum = void 0;
6230
+ (function (FeeCalculationTypeEnum) {
6231
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["FIXED"] = 1] = "FIXED";
6232
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["TAXED_WEIGHT"] = 2] = "TAXED_WEIGHT";
6233
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["INTERNATIONAL_CHARGE"] = 3] = "INTERNATIONAL_CHARGE";
6234
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["CONVERSION_TAX"] = 4] = "CONVERSION_TAX";
6235
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["CUBED_WEIGHT"] = 5] = "CUBED_WEIGHT";
6236
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["COMMODITY_VALUE"] = 6] = "COMMODITY_VALUE";
6237
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["FRACTIONED"] = 7] = "FRACTIONED";
6238
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["FREIGHT"] = 8] = "FREIGHT";
6239
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["TOTAL_PERCENTAGE"] = 9] = "TOTAL_PERCENTAGE";
6240
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["MIN_VALUE"] = 10] = "MIN_VALUE";
6241
+ FeeCalculationTypeEnum[FeeCalculationTypeEnum["SUM_CONTAINERS"] = 11] = "SUM_CONTAINERS";
6242
+ })(exports.FeeCalculationTypeEnum || (exports.FeeCalculationTypeEnum = {}));
6243
+
6244
+ exports.FeeCategoryEnum = void 0;
6245
+ (function (FeeCategoryEnum) {
6246
+ FeeCategoryEnum[FeeCategoryEnum["ORIGIN"] = 1] = "ORIGIN";
6247
+ FeeCategoryEnum[FeeCategoryEnum["INTERNATIONAL"] = 2] = "INTERNATIONAL";
6248
+ FeeCategoryEnum[FeeCategoryEnum["DESTINATION"] = 3] = "DESTINATION";
6249
+ FeeCategoryEnum[FeeCategoryEnum["DELIVERY"] = 4] = "DELIVERY";
6250
+ FeeCategoryEnum[FeeCategoryEnum["ADDITIONAL"] = 5] = "ADDITIONAL";
6251
+ FeeCategoryEnum[FeeCategoryEnum["PICKUP"] = 6] = "PICKUP";
6252
+ FeeCategoryEnum[FeeCategoryEnum["FREIGHT"] = 7] = "FREIGHT";
6253
+ FeeCategoryEnum[FeeCategoryEnum["FEES"] = 8] = "FEES";
6254
+ FeeCategoryEnum[FeeCategoryEnum["TAXES"] = 9] = "TAXES";
6255
+ })(exports.FeeCategoryEnum || (exports.FeeCategoryEnum = {}));
6256
+
6257
+ exports.ModalEnum = void 0;
6258
+ (function (ModalEnum) {
6259
+ ModalEnum[ModalEnum["AIR"] = 1] = "AIR";
6260
+ ModalEnum[ModalEnum["OCEAN_FCL"] = 2] = "OCEAN_FCL";
6261
+ ModalEnum[ModalEnum["OCEAN_LCL"] = 3] = "OCEAN_LCL";
6262
+ ModalEnum[ModalEnum["ROAD_FTL"] = 4] = "ROAD_FTL";
6263
+ ModalEnum[ModalEnum["ROAD_LTL"] = 5] = "ROAD_LTL";
6264
+ })(exports.ModalEnum || (exports.ModalEnum = {}));
6265
+
6266
+ exports.NotificationTypeEnum = void 0;
6267
+ (function (NotificationTypeEnum) {
6268
+ NotificationTypeEnum[NotificationTypeEnum["USER_NOTIFICATION"] = 1] = "USER_NOTIFICATION";
6269
+ NotificationTypeEnum[NotificationTypeEnum["DOMAIN_NOTIFICATION"] = 2] = "DOMAIN_NOTIFICATION";
6270
+ })(exports.NotificationTypeEnum || (exports.NotificationTypeEnum = {}));
6271
+
6272
+ exports.PermissionEnum = void 0;
6273
+ (function (PermissionEnum) {
6274
+ PermissionEnum[PermissionEnum["B2M_ADMIN"] = 1] = "B2M_ADMIN";
6275
+ PermissionEnum[PermissionEnum["DOMAIN_ADMIN"] = 2] = "DOMAIN_ADMIN";
6276
+ PermissionEnum[PermissionEnum["TMS"] = 3] = "TMS";
6277
+ PermissionEnum[PermissionEnum["SPOT"] = 4] = "SPOT";
6278
+ PermissionEnum[PermissionEnum["SPOT_PROVIDER"] = 5] = "SPOT_PROVIDER";
6279
+ PermissionEnum[PermissionEnum["TRACK_PROCESSES"] = 6] = "TRACK_PROCESSES";
6280
+ PermissionEnum[PermissionEnum["DISPATCHER"] = 7] = "DISPATCHER";
6281
+ PermissionEnum[PermissionEnum["RATECARD_MANAGEMENT"] = 8] = "RATECARD_MANAGEMENT";
6282
+ PermissionEnum[PermissionEnum["SLA"] = 9] = "SLA";
6283
+ })(exports.PermissionEnum || (exports.PermissionEnum = {}));
6284
+
6285
+ exports.SpotStatusEnum = void 0;
6286
+ (function (SpotStatusEnum) {
6287
+ SpotStatusEnum[SpotStatusEnum["DRAFT"] = 1] = "DRAFT";
6288
+ SpotStatusEnum[SpotStatusEnum["OPEN"] = 2] = "OPEN";
6289
+ SpotStatusEnum[SpotStatusEnum["CLOSED"] = 3] = "CLOSED";
6290
+ SpotStatusEnum[SpotStatusEnum["FINISHED"] = 4] = "FINISHED";
6291
+ })(exports.SpotStatusEnum || (exports.SpotStatusEnum = {}));
6292
+
6293
+ exports.TrackProcessProviderTypeEnum = void 0;
6294
+ (function (TrackProcessProviderTypeEnum) {
6295
+ TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["FREIGHT_FORWARDER"] = 1] = "FREIGHT_FORWARDER";
6296
+ TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["DISPATCHER"] = 2] = "DISPATCHER";
6297
+ TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["TERMINAL"] = 3] = "TERMINAL";
6298
+ TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["SHIPPING_COMPANY"] = 4] = "SHIPPING_COMPANY";
6299
+ TrackProcessProviderTypeEnum[TrackProcessProviderTypeEnum["OTHERS"] = 5] = "OTHERS";
6300
+ })(exports.TrackProcessProviderTypeEnum || (exports.TrackProcessProviderTypeEnum = {}));
6301
+
6302
+ var getFormattedFreightPlaceName = function (freightPlace, modalId, complete, sqlVersion) {
6303
+ var _a, _b;
6304
+ if (complete === void 0) { complete = false; }
6305
+ if (sqlVersion === void 0) { sqlVersion = false; }
6306
+ if (sqlVersion) {
6307
+ var iataText = freightPlace.iata ? "(".concat(freightPlace.iata, ") ") : '';
6308
+ var locationText = freightPlace.location ? " ".concat(freightPlace.location) : '';
6309
+ var countryText = [exports.ModalEnum.OCEAN_FCL, exports.ModalEnum.OCEAN_LCL].includes(modalId) ? "".concat(freightPlace.freightPlaceCountryName, ", ") : '';
6310
+ return "".concat(iataText).concat(freightPlace.name).concat(locationText).concat(complete ? " - ".concat(countryText).concat(freightPlace.freightPlaceRegionName) : '');
6311
+ }
6312
+ else {
6313
+ var iataText = freightPlace.iata ? "(".concat(freightPlace.iata, ") ") : '';
6314
+ var locationText = freightPlace.location ? " ".concat(freightPlace.location) : '';
6315
+ var countryText = [exports.ModalEnum.OCEAN_FCL, exports.ModalEnum.OCEAN_LCL].includes(modalId) ? "".concat((_a = freightPlace.freightPlaceCountry) === null || _a === void 0 ? void 0 : _a.name, ", ") : '';
6316
+ return "".concat(iataText).concat(freightPlace.name).concat(locationText).concat(complete ? " - ".concat(countryText).concat((_b = freightPlace.freightPlaceRegion) === null || _b === void 0 ? void 0 : _b.name) : '');
6317
+ }
6318
+ };
6319
+
6320
+ /******************************************************************************
6321
+ Copyright (c) Microsoft Corporation.
6322
+
6323
+ Permission to use, copy, modify, and/or distribute this software for any
6324
+ purpose with or without fee is hereby granted.
6325
+
6326
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
6327
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
6328
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
6329
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
6330
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
6331
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
6332
+ PERFORMANCE OF THIS SOFTWARE.
6333
+ ***************************************************************************** */
6334
+
6335
+ function __awaiter(thisArg, _arguments, P, generator) {
6336
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6337
+ return new (P || (P = Promise))(function (resolve, reject) {
6338
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6339
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6340
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6341
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
6342
+ });
6343
+ }
6344
+
6345
+ function __generator(thisArg, body) {
6346
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
6347
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
6348
+ function verb(n) { return function (v) { return step([n, v]); }; }
6349
+ function step(op) {
6350
+ if (f) throw new TypeError("Generator is already executing.");
6351
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
6352
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
6353
+ if (y = 0, t) op = [op[0] & 2, t.value];
6354
+ switch (op[0]) {
6355
+ case 0: case 1: t = op; break;
6356
+ case 4: _.label++; return { value: op[1], done: false };
6357
+ case 5: _.label++; y = op[1]; op = [0]; continue;
6358
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
6359
+ default:
6360
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
6361
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
6362
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
6363
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
6364
+ if (t[2]) _.ops.pop();
6365
+ _.trys.pop(); continue;
6366
+ }
6367
+ op = body.call(thisArg, _);
6368
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
6369
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
6370
+ }
6371
+ }
6372
+
6373
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
6374
+ var e = new Error(message);
6375
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
6376
+ };
6377
+
6163
6378
  var setFormattedDatesInObjects = function (objectFormat) { return __awaiter(void 0, void 0, void 0, function () {
6164
6379
  var _a, _b, _c, _i, key, formattedDate, _d, _e, _f, _g;
6165
6380
  return __generator(this, function (_h) {
@@ -6222,8 +6437,12 @@ var setFormattedDatesInObjects = function (objectFormat) { return __awaiter(void
6222
6437
 
6223
6438
  exports.formatDateString = formatDateString;
6224
6439
  exports.getConfigurationFromDomain = getConfigurationFromDomain;
6440
+ exports.getContractFromFreight = getContractFromFreight;
6441
+ exports.getContractRouteFromFreight = getContractRouteFromFreight;
6225
6442
  exports.getCookies = getCookies;
6226
6443
  exports.getDataFromToken = getDataFromToken;
6227
6444
  exports.getFormattedFreightPlaceName = getFormattedFreightPlaceName;
6445
+ exports.getRouteDeliveryTimeFromFreight = getRouteDeliveryTimeFromFreight;
6446
+ exports.getRouteOnTimeFromFreight = getRouteOnTimeFromFreight;
6228
6447
  exports.setFormattedDatesInObjects = setFormattedDatesInObjects;
6229
6448
  //# sourceMappingURL=index.js.map