@experteam-mx/ngx-services 20.8.6-dev3.0 → 20.8.8
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/fesm2022/experteam-mx-ngx-services.mjs +124 -65
- package/fesm2022/experteam-mx-ngx-services.mjs.map +1 -1
- package/index.d.ts +416 -188
- package/package.json +1 -1
|
@@ -2561,16 +2561,6 @@ class ApiCompositionService {
|
|
|
2561
2561
|
return this.http.get(`${this.url}/shipments/${id}`)
|
|
2562
2562
|
.pipe(map(({ data }) => data));
|
|
2563
2563
|
}
|
|
2564
|
-
/**
|
|
2565
|
-
* Retrieves shipments based on the provided query parameters.
|
|
2566
|
-
*
|
|
2567
|
-
* @param {QueryParams} params - The query parameters for the API request.
|
|
2568
|
-
* @returns {Observable<ShipmentsOut>} An observable that emits the shipments data.
|
|
2569
|
-
*/
|
|
2570
|
-
getShipments(params) {
|
|
2571
|
-
return this.http.get(`${this.url}/shipments`, { params })
|
|
2572
|
-
.pipe(map(({ data }) => data));
|
|
2573
|
-
}
|
|
2574
2564
|
/**
|
|
2575
2565
|
* Fetches the country references data based on the provided query parameters.
|
|
2576
2566
|
*
|
|
@@ -3159,7 +3149,7 @@ class ApiExternalOperationsService {
|
|
|
3159
3149
|
* Retrieves delivery confirmation details based on the provided OTP code.
|
|
3160
3150
|
*
|
|
3161
3151
|
* @param {string} otpCode - The OTP code used to search for delivery confirmation.
|
|
3162
|
-
* @return {Observable<
|
|
3152
|
+
* @return {Observable<DeliveryConfirmationSearchOut>} An observable containing the delivery confirmation data.
|
|
3163
3153
|
*/
|
|
3164
3154
|
getDeliveryConfirmation(otpCode) {
|
|
3165
3155
|
return this.http.get(`${this.url}/delivery-confirmation/search/${otpCode}`)
|
|
@@ -3200,6 +3190,38 @@ class ApiExternalOperationsService {
|
|
|
3200
3190
|
return this.http.put(`${this.url}/delivery-confirmation/confirmation/${otp}`, body)
|
|
3201
3191
|
.pipe(map$1(({ data }) => data));
|
|
3202
3192
|
}
|
|
3193
|
+
/**
|
|
3194
|
+
* Retrieves signature page confirmation information associated with an OTP code.
|
|
3195
|
+
*
|
|
3196
|
+
* @param {string} otpCode - OTP code used to search for the signature page confirmation.
|
|
3197
|
+
* @returns {Observable<SignaturePageConfirmationOut>} An observable containing the signature page confirmation details.
|
|
3198
|
+
*/
|
|
3199
|
+
getSignaturePageConfirmationSearch(otpCode) {
|
|
3200
|
+
return this.http.get(`${this.url}/signature-page-confirmation/search/${otpCode}`)
|
|
3201
|
+
.pipe(map$1(({ data }) => data));
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* Generates a signature page confirmation request for a shipment.
|
|
3205
|
+
*
|
|
3206
|
+
* @param {ShipmentSignaturePageIn} payload - Shipment data required to generate the signature page confirmation.
|
|
3207
|
+
* @returns {Observable<SignaturePageConfirmationGenerateOut>} An observable containing the generated confirmation information.
|
|
3208
|
+
*/
|
|
3209
|
+
postSignaturePageConfirmationGenerate(payload) {
|
|
3210
|
+
return this.http.post(`${this.url}/signature-page-confirmation/generate`, payload)
|
|
3211
|
+
.pipe(map$1(({ data }) => data));
|
|
3212
|
+
}
|
|
3213
|
+
/**
|
|
3214
|
+
* Confirms a shipment signature page using an OTP code.
|
|
3215
|
+
*
|
|
3216
|
+
* @param {ShipmentSignaturePageConfirmationIn} input - Signature page confirmation data.
|
|
3217
|
+
* @param {string} input.otp - OTP code used to validate the confirmation.
|
|
3218
|
+
* @param {...Object} input.body - Additional confirmation information sent in the request body.
|
|
3219
|
+
* @returns {Observable<{}>} An observable that emits the API response data.
|
|
3220
|
+
*/
|
|
3221
|
+
putSignaturePageConfirmation({ otp, ...body }) {
|
|
3222
|
+
return this.http.put(`${this.url}/signature-page-confirmation/${otp}`, body)
|
|
3223
|
+
.pipe(map$1(({ data }) => data));
|
|
3224
|
+
}
|
|
3203
3225
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiExternalOperationsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3204
3226
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ApiExternalOperationsService, providedIn: 'root' });
|
|
3205
3227
|
}
|
|
@@ -5560,24 +5582,54 @@ var DocumentStatusCode;
|
|
|
5560
5582
|
DocumentStatusCode[DocumentStatusCode["WITH_ERRORS"] = 3] = "WITH_ERRORS";
|
|
5561
5583
|
})(DocumentStatusCode || (DocumentStatusCode = {}));
|
|
5562
5584
|
|
|
5563
|
-
var CustomerRoleType;
|
|
5564
|
-
(function (CustomerRoleType) {
|
|
5565
|
-
CustomerRoleType["SHIPPER"] = "SP";
|
|
5566
|
-
CustomerRoleType["CONSIGNEE"] = "RV";
|
|
5567
|
-
CustomerRoleType["IMPORTER"] = "IP";
|
|
5568
|
-
CustomerRoleType["EXPORTER"] = "EP";
|
|
5569
|
-
})(CustomerRoleType || (CustomerRoleType = {}));
|
|
5570
|
-
|
|
5571
5585
|
class WebSocketsService {
|
|
5572
|
-
pusher;
|
|
5586
|
+
pusher = null;
|
|
5587
|
+
appKey = null;
|
|
5588
|
+
connectPromise = null;
|
|
5573
5589
|
environments = inject(ENVIRONMENT_TOKEN);
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5590
|
+
/**
|
|
5591
|
+
* Stores the Pusher/Soketi application key without opening a connection.
|
|
5592
|
+
* The first `channelSub` / `eventBind` opens Pusher via `ensureConnected`.
|
|
5593
|
+
*
|
|
5594
|
+
* @param {string} appKey - The Pusher/Soketi application key.
|
|
5595
|
+
*/
|
|
5596
|
+
setAppKey(appKey) {
|
|
5597
|
+
this.appKey = appKey;
|
|
5598
|
+
}
|
|
5599
|
+
/**
|
|
5600
|
+
* Connects to Pusher using the given app key and env `sockets` url/port/debug.
|
|
5601
|
+
* No-ops if already connected with the same key; reconnects if the key changed.
|
|
5602
|
+
* Resolves false when `sockets` is missing from the environment.
|
|
5603
|
+
* Apps should store the key with `setAppKey` and let subscribe open the client.
|
|
5604
|
+
*
|
|
5605
|
+
* @param {string} appKey - The Pusher/Soketi application key.
|
|
5606
|
+
* @return {Promise<Pusher | false>} The Pusher instance, or false when sockets are not configured.
|
|
5607
|
+
*/
|
|
5608
|
+
connect(appKey) {
|
|
5609
|
+
this.setAppKey(appKey);
|
|
5610
|
+
return new Promise((resolve) => {
|
|
5611
|
+
if (this.pusher && this.appKey === appKey) {
|
|
5612
|
+
return resolve(this.pusher);
|
|
5613
|
+
}
|
|
5614
|
+
const { sockets } = this.environments;
|
|
5615
|
+
if (!sockets)
|
|
5616
|
+
return resolve(false);
|
|
5617
|
+
if (this.pusher) {
|
|
5618
|
+
this.pusher.disconnect();
|
|
5619
|
+
this.pusher = null;
|
|
5620
|
+
}
|
|
5621
|
+
const pusher = new Pusher(appKey, {
|
|
5622
|
+
wsHost: sockets.url,
|
|
5623
|
+
wsPort: sockets.port,
|
|
5624
|
+
enabledTransports: ['wss', 'ws'],
|
|
5625
|
+
forceTLS: false,
|
|
5626
|
+
enableStats: false,
|
|
5627
|
+
});
|
|
5628
|
+
if (sockets.debug) {
|
|
5629
|
+
Pusher.logToConsole = true;
|
|
5630
|
+
}
|
|
5580
5631
|
this.pusher = pusher;
|
|
5632
|
+
return resolve(pusher);
|
|
5581
5633
|
});
|
|
5582
5634
|
}
|
|
5583
5635
|
/**
|
|
@@ -5600,13 +5652,14 @@ class WebSocketsService {
|
|
|
5600
5652
|
* @throws {Error} If the subscription fails after the maximum number of retry attempts.
|
|
5601
5653
|
*/
|
|
5602
5654
|
async channelSub(channelName) {
|
|
5655
|
+
const pusher = await this.ensureConnected();
|
|
5603
5656
|
const attempts = 3;
|
|
5604
5657
|
for (let attempt = 0; attempt <= attempts; attempt++) {
|
|
5605
|
-
const channel =
|
|
5658
|
+
const channel = pusher.channel(channelName);
|
|
5606
5659
|
if (channel?.subscribed) {
|
|
5607
5660
|
return channel;
|
|
5608
5661
|
}
|
|
5609
|
-
|
|
5662
|
+
pusher.subscribe(channelName);
|
|
5610
5663
|
if (attempt < attempts) {
|
|
5611
5664
|
await this.wait();
|
|
5612
5665
|
}
|
|
@@ -5623,13 +5676,21 @@ class WebSocketsService {
|
|
|
5623
5676
|
*/
|
|
5624
5677
|
eventBind(channel, event) {
|
|
5625
5678
|
return new Observable((subscriber) => {
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5679
|
+
void (async () => {
|
|
5680
|
+
try {
|
|
5681
|
+
const pusher = await this.ensureConnected();
|
|
5682
|
+
if (channel?.name) {
|
|
5683
|
+
channel.bind(event, (data) => subscriber.next(data));
|
|
5684
|
+
}
|
|
5685
|
+
else {
|
|
5686
|
+
pusher.subscribe(channel)
|
|
5687
|
+
.bind(event, (data) => subscriber.next(data));
|
|
5688
|
+
}
|
|
5689
|
+
}
|
|
5690
|
+
catch (error) {
|
|
5691
|
+
subscriber.error(error);
|
|
5692
|
+
}
|
|
5693
|
+
})();
|
|
5633
5694
|
});
|
|
5634
5695
|
}
|
|
5635
5696
|
/**
|
|
@@ -5643,23 +5704,24 @@ class WebSocketsService {
|
|
|
5643
5704
|
eventUnbind(channel, event) {
|
|
5644
5705
|
return new Observable((subscriber) => channel.unbind(event, (data) => subscriber.next(data)));
|
|
5645
5706
|
}
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
});
|
|
5658
|
-
if (sockets.debug) {
|
|
5659
|
-
Pusher.logToConsole = true;
|
|
5707
|
+
async ensureConnected() {
|
|
5708
|
+
if (this.pusher)
|
|
5709
|
+
return this.pusher;
|
|
5710
|
+
if (!this.appKey) {
|
|
5711
|
+
throw new Error('The sockets connection is not established.');
|
|
5712
|
+
}
|
|
5713
|
+
this.connectPromise ??= this.connect(this.appKey);
|
|
5714
|
+
try {
|
|
5715
|
+
const pusher = await this.connectPromise;
|
|
5716
|
+
if (!pusher) {
|
|
5717
|
+
throw new Error('The sockets connection is not established.');
|
|
5660
5718
|
}
|
|
5661
|
-
return
|
|
5662
|
-
}
|
|
5719
|
+
return pusher;
|
|
5720
|
+
}
|
|
5721
|
+
catch (error) {
|
|
5722
|
+
this.connectPromise = null;
|
|
5723
|
+
throw error;
|
|
5724
|
+
}
|
|
5663
5725
|
}
|
|
5664
5726
|
async wait() {
|
|
5665
5727
|
const waitTime = 3 * 1000;
|
|
@@ -5673,13 +5735,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
5673
5735
|
args: [{
|
|
5674
5736
|
providedIn: 'root',
|
|
5675
5737
|
}]
|
|
5676
|
-
}]
|
|
5738
|
+
}] });
|
|
5677
5739
|
|
|
5678
5740
|
const AES_KEY_USAGES = ['encrypt', 'decrypt'];
|
|
5679
5741
|
class CryptoService {
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
const cryptoKey = await this.loadKey();
|
|
5742
|
+
async encryptAES(plaintext, secretKey) {
|
|
5743
|
+
const cryptoKey = await this.loadKey(secretKey);
|
|
5683
5744
|
// Convert the plaintext in Uint8Array
|
|
5684
5745
|
const encoder = new TextEncoder();
|
|
5685
5746
|
const encoded = encoder.encode(plaintext);
|
|
@@ -5692,13 +5753,13 @@ class CryptoService {
|
|
|
5692
5753
|
}, cryptoKey, encoded);
|
|
5693
5754
|
return `${this.uint8ArrayToBase64(iv)}:${this.arrayBufferToBase64(ciphertext)}`;
|
|
5694
5755
|
}
|
|
5695
|
-
async decryptAES(payload) {
|
|
5756
|
+
async decryptAES(payload, secretKey) {
|
|
5696
5757
|
// Extract the Initialization Vector (IV), and the cypher text
|
|
5697
5758
|
const [base64IV, base64Ciphertext] = payload.split(':');
|
|
5698
5759
|
if (!base64IV || !base64Ciphertext) {
|
|
5699
5760
|
throw new Error('The payload must contain the IV and the cipher text.');
|
|
5700
5761
|
}
|
|
5701
|
-
const cryptoKey = await this.loadKey();
|
|
5762
|
+
const cryptoKey = await this.loadKey(secretKey);
|
|
5702
5763
|
const iv = this.base64ToUint8Array(base64IV);
|
|
5703
5764
|
const cipherText = this.base64ToArrayBuffer(base64Ciphertext);
|
|
5704
5765
|
// Decrypt the cypher text
|
|
@@ -5710,14 +5771,12 @@ class CryptoService {
|
|
|
5710
5771
|
const decoder = new TextDecoder();
|
|
5711
5772
|
return decoder.decode(decrypted);
|
|
5712
5773
|
}
|
|
5713
|
-
async loadKey() {
|
|
5714
|
-
if (!
|
|
5715
|
-
throw new Error('The secret key is not defined
|
|
5774
|
+
async loadKey(secretKey) {
|
|
5775
|
+
if (!secretKey) {
|
|
5776
|
+
throw new Error('The secret key is not defined.');
|
|
5716
5777
|
}
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
// Import the key to API Crypto
|
|
5720
|
-
return await crypto.subtle.importKey('raw', rawKey, { name: 'AES-GCM' }, true, AES_KEY_USAGES);
|
|
5778
|
+
const rawKey = new TextEncoder().encode(secretKey);
|
|
5779
|
+
return crypto.subtle.importKey('raw', rawKey, { name: 'AES-GCM' }, true, AES_KEY_USAGES);
|
|
5721
5780
|
}
|
|
5722
5781
|
uint8ArrayToBase64(data) {
|
|
5723
5782
|
let binary = '';
|
|
@@ -5934,5 +5993,5 @@ const xmlHeaders = (format = 'object') => {
|
|
|
5934
5993
|
* Generated bundle index. Do not edit.
|
|
5935
5994
|
*/
|
|
5936
5995
|
|
|
5937
|
-
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,
|
|
5996
|
+
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 };
|
|
5938
5997
|
//# sourceMappingURL=experteam-mx-ngx-services.mjs.map
|