@experteam-mx/ngx-services 20.8.6 → 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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { InjectionToken, ModuleWithProviders, EnvironmentProviders } from '@angular/core';
3
3
  import { Observable, BehaviorSubject } from 'rxjs';
4
4
  import { HttpResponse, HttpRequest, HttpHandlerFn, HttpEvent, HttpParams, HttpHeaders } from '@angular/common/http';
5
- import { Channel } from 'pusher-js';
5
+ import Pusher, { Channel } from 'pusher-js';
6
6
 
7
7
  /**
8
8
  * Represents the configuration settings for the application's environment.
@@ -18,7 +18,6 @@ import { Channel } from 'pusher-js';
18
18
  * - authCookie: The name of the authentication cookie used for user sessions.
19
19
  * - cacheTtl: Optional. Specifies the time-to-live (TTL) for cached items.
20
20
  * - printUrl: Optional. The URL used for generating or downloading printable documents.
21
- * - secretKey: A secret key used for authentication or other secure operations.
22
21
  */
23
22
  type Environment = {
24
23
  apiBillingCO?: string;
@@ -52,9 +51,7 @@ type Environment = {
52
51
  authCookie?: string;
53
52
  cacheTtl?: number;
54
53
  printUrl?: string;
55
- secretKey?: string;
56
54
  sockets?: {
57
- app_key: string;
58
55
  debug?: boolean;
59
56
  port: number;
60
57
  url: string;
@@ -9424,8 +9421,26 @@ declare enum PaymentTypeCode {
9424
9421
 
9425
9422
  declare class WebSocketsService {
9426
9423
  private pusher;
9424
+ private appKey;
9425
+ private connectPromise;
9427
9426
  private environments;
9428
- constructor();
9427
+ /**
9428
+ * Stores the Pusher/Soketi application key without opening a connection.
9429
+ * The first `channelSub` / `eventBind` opens Pusher via `ensureConnected`.
9430
+ *
9431
+ * @param {string} appKey - The Pusher/Soketi application key.
9432
+ */
9433
+ setAppKey(appKey: string): void;
9434
+ /**
9435
+ * Connects to Pusher using the given app key and env `sockets` url/port/debug.
9436
+ * No-ops if already connected with the same key; reconnects if the key changed.
9437
+ * Resolves false when `sockets` is missing from the environment.
9438
+ * Apps should store the key with `setAppKey` and let subscribe open the client.
9439
+ *
9440
+ * @param {string} appKey - The Pusher/Soketi application key.
9441
+ * @return {Promise<Pusher | false>} The Pusher instance, or false when sockets are not configured.
9442
+ */
9443
+ connect(appKey: string): Promise<Pusher | false>;
9429
9444
  /**
9430
9445
  * Publishes an event to the specified channel with the given data.
9431
9446
  *
@@ -9462,16 +9477,15 @@ declare class WebSocketsService {
9462
9477
  * @return {Observable<T>} An observable that emits data from the unbound event callback.
9463
9478
  */
9464
9479
  eventUnbind<T>(channel: Channel, event: string): Observable<unknown>;
9465
- private connect;
9480
+ private ensureConnected;
9466
9481
  private wait;
9467
9482
  static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketsService, never>;
9468
9483
  static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketsService>;
9469
9484
  }
9470
9485
 
9471
9486
  declare class CryptoService {
9472
- private environments;
9473
- encryptAES(plaintext: string): Promise<string>;
9474
- decryptAES(payload: string): Promise<string>;
9487
+ encryptAES(plaintext: string, secretKey: string): Promise<string>;
9488
+ decryptAES(payload: string, secretKey: string): Promise<string>;
9475
9489
  private loadKey;
9476
9490
  private uint8ArrayToBase64;
9477
9491
  private base64ToUint8Array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@experteam-mx/ngx-services",
3
- "version": "20.8.6",
3
+ "version": "20.8.8",
4
4
  "description": "Angular common services for Experteam apps",
5
5
  "author": "Experteam Cía. Ltda.",
6
6
  "keywords": [