@progalaxyelabs/ngx-stonescriptphp-client 1.18.2 → 1.19.0
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, makeEnvironmentProviders, Injectable, Inject, EventEmitter, Output, Input, Component
|
|
2
|
+
import { InjectionToken, makeEnvironmentProviders, Injectable, Inject, Optional, EventEmitter, Output, Input, Component } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
4
|
import * as i3 from '@angular/common';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
@@ -8,6 +8,13 @@ import { FormsModule } from '@angular/forms';
|
|
|
8
8
|
|
|
9
9
|
class MyEnvironmentModel {
|
|
10
10
|
production = true;
|
|
11
|
+
/**
|
|
12
|
+
* Enable debug logging across the app.
|
|
13
|
+
* Set to true in development environments to see [DEBUG] logs in the browser console.
|
|
14
|
+
* Always false in production.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
debug = false;
|
|
11
18
|
/**
|
|
12
19
|
* Platform code identifier (e.g., 'progalaxy', 'hr', 'admin').
|
|
13
20
|
* Used for multi-tenant authentication.
|
|
@@ -835,16 +842,18 @@ class ProgalaxyElabsAuth {
|
|
|
835
842
|
}
|
|
836
843
|
// -- Internal helpers -----------------------------------------------------
|
|
837
844
|
handleLoginResponse(data) {
|
|
838
|
-
//
|
|
839
|
-
|
|
845
|
+
// Identity with no tenant memberships — needs onboarding
|
|
846
|
+
// Covers both new registration (is_new_identity=true) and
|
|
847
|
+
// returning user who hasn't created a tenant yet (is_new_identity=false, memberships=[])
|
|
848
|
+
if (data.identity && (!data.membership)) {
|
|
840
849
|
return {
|
|
841
850
|
success: true,
|
|
842
851
|
accessToken: data.access_token,
|
|
843
852
|
refreshToken: data.refresh_token,
|
|
844
|
-
|
|
853
|
+
user: this.toUser(data.identity),
|
|
854
|
+
isNewIdentity: data.is_new_identity ?? false,
|
|
845
855
|
authMethod: data.auth_method,
|
|
846
856
|
oauthProvider: data.oauth_provider,
|
|
847
|
-
user: this.toUser(data.identity),
|
|
848
857
|
};
|
|
849
858
|
}
|
|
850
859
|
// Multi-tenant selection required
|
|
@@ -1446,6 +1455,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
|
|
|
1446
1455
|
}]
|
|
1447
1456
|
}], ctorParameters: () => [] });
|
|
1448
1457
|
|
|
1458
|
+
/**
|
|
1459
|
+
* LogService — debug logger for ProgalaxyELabs Angular platforms.
|
|
1460
|
+
*
|
|
1461
|
+
* Reads environment.debug from MyEnvironmentModel (set via provideNgxStoneScriptPhpClient).
|
|
1462
|
+
* All output is silenced when debug = false (production default).
|
|
1463
|
+
*
|
|
1464
|
+
* Usage in components / services:
|
|
1465
|
+
* ```typescript
|
|
1466
|
+
* constructor(private log: LogService) {}
|
|
1467
|
+
*
|
|
1468
|
+
* this.log.debug('MyComponent', 'event fired', { data });
|
|
1469
|
+
* ```
|
|
1470
|
+
*
|
|
1471
|
+
* Configure in app:
|
|
1472
|
+
* ```typescript
|
|
1473
|
+
* // environment.ts
|
|
1474
|
+
* export const environment = { production: false, debug: true, ... };
|
|
1475
|
+
*
|
|
1476
|
+
* // app.config.ts
|
|
1477
|
+
* provideNgxStoneScriptPhpClient(environment) // LogService picks up environment.debug automatically
|
|
1478
|
+
* ```
|
|
1479
|
+
*/
|
|
1480
|
+
class LogService {
|
|
1481
|
+
_debug = false;
|
|
1482
|
+
constructor(env) {
|
|
1483
|
+
this._debug = env?.debug ?? false;
|
|
1484
|
+
}
|
|
1485
|
+
/** Log a debug message. No-op when environment.debug = false. */
|
|
1486
|
+
debug(context, message, ...args) {
|
|
1487
|
+
if (this._debug) {
|
|
1488
|
+
console.log(`[DEBUG][${context}] ${message}`, ...args);
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
/** Log a warning. Always visible regardless of debug flag. */
|
|
1492
|
+
warn(context, message, ...args) {
|
|
1493
|
+
console.warn(`[WARN][${context}] ${message}`, ...args);
|
|
1494
|
+
}
|
|
1495
|
+
/** Log an error. Always visible regardless of debug flag. */
|
|
1496
|
+
error(context, message, ...args) {
|
|
1497
|
+
console.error(`[ERROR][${context}] ${message}`, ...args);
|
|
1498
|
+
}
|
|
1499
|
+
/** Returns true if debug mode is on (useful for conditional expensive logging). */
|
|
1500
|
+
get isDebug() {
|
|
1501
|
+
return this._debug;
|
|
1502
|
+
}
|
|
1503
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: LogService, deps: [{ token: MyEnvironmentModel, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1504
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: LogService, providedIn: 'root' });
|
|
1505
|
+
}
|
|
1506
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: LogService, decorators: [{
|
|
1507
|
+
type: Injectable,
|
|
1508
|
+
args: [{ providedIn: 'root' }]
|
|
1509
|
+
}], ctorParameters: () => [{ type: MyEnvironmentModel, decorators: [{
|
|
1510
|
+
type: Optional
|
|
1511
|
+
}] }] });
|
|
1512
|
+
|
|
1449
1513
|
/**
|
|
1450
1514
|
* CSRF Token Service
|
|
1451
1515
|
*
|
|
@@ -4219,5 +4283,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
|
|
|
4219
4283
|
* Generated bundle index. Do not edit.
|
|
4220
4284
|
*/
|
|
4221
4285
|
|
|
4222
|
-
export { AUTH_PLUGIN, ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, ProgalaxyElabsAuth, ProviderRegistryService, RegisterComponent, SigninStatusService, StoneScriptPHPAuth, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus, provideNgxStoneScriptPhpClient };
|
|
4286
|
+
export { AUTH_PLUGIN, ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LogService, LoginDialogComponent, MyEnvironmentModel, ProgalaxyElabsAuth, ProviderRegistryService, RegisterComponent, SigninStatusService, StoneScriptPHPAuth, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus, provideNgxStoneScriptPhpClient };
|
|
4223
4287
|
//# sourceMappingURL=progalaxyelabs-ngx-stonescriptphp-client.mjs.map
|