@progalaxyelabs/ngx-stonescriptphp-client 1.11.1 → 1.12.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.
package/index.d.ts
CHANGED
|
@@ -1,68 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { InjectionToken, EnvironmentProviders, OnInit, EventEmitter } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
4
|
-
import * as i1 from '@angular/common';
|
|
5
|
-
|
|
6
|
-
declare class TokenService {
|
|
7
|
-
private accessToken;
|
|
8
|
-
private refreshToken;
|
|
9
|
-
private lsAccessTokenKey;
|
|
10
|
-
private lsRefreshTokenKey;
|
|
11
|
-
constructor();
|
|
12
|
-
setTokens(accessToken: string, refreshToken: string): void;
|
|
13
|
-
setAccessToken(accessToken: string): void;
|
|
14
|
-
setRefreshToken(refreshToken: string): void;
|
|
15
|
-
getAccessToken(): string;
|
|
16
|
-
getRefreshToken(): string;
|
|
17
|
-
clear(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Check if there is a non-empty access token.
|
|
20
|
-
* Token is treated as opaque — validity is determined by the auth server.
|
|
21
|
-
*/
|
|
22
|
-
hasValidAccessToken(): boolean;
|
|
23
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TokenService, never>;
|
|
24
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<TokenService>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Use boolean directly. Kept for backward compatibility.
|
|
29
|
-
*/
|
|
30
|
-
declare enum VerifyStatus {
|
|
31
|
-
initialized = "initialized",
|
|
32
|
-
yes = "yes",
|
|
33
|
-
no = "no"
|
|
34
|
-
}
|
|
35
|
-
declare class SigninStatusService {
|
|
36
|
-
status: BehaviorSubject<boolean | VerifyStatus>;
|
|
37
|
-
constructor();
|
|
38
|
-
signedOut(): void;
|
|
39
|
-
signedIn(): void;
|
|
40
|
-
/**
|
|
41
|
-
* Set signin status
|
|
42
|
-
* @param isSignedIn - True if user is signed in, false otherwise
|
|
43
|
-
*/
|
|
44
|
-
setSigninStatus(isSignedIn: boolean): void;
|
|
45
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SigninStatusService, never>;
|
|
46
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<SigninStatusService>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
declare class ApiResponse<DataType> {
|
|
50
|
-
readonly status: string;
|
|
51
|
-
readonly data: DataType | null;
|
|
52
|
-
readonly message: string;
|
|
53
|
-
get success(): boolean;
|
|
54
|
-
get errors(): string[];
|
|
55
|
-
constructor(status: string, data?: any, message?: string);
|
|
56
|
-
onOk(callback: (data: DataType) => void): ApiResponse<DataType>;
|
|
57
|
-
onNotOk(callback: (message: string, data: DataType) => void): ApiResponse<DataType>;
|
|
58
|
-
onError(callback: () => void): ApiResponse<DataType>;
|
|
59
|
-
isSuccess(): boolean;
|
|
60
|
-
isError(): boolean;
|
|
61
|
-
getData(): DataType | null;
|
|
62
|
-
getError(): string;
|
|
63
|
-
getStatus(): string;
|
|
64
|
-
getMessage(): string;
|
|
65
|
-
}
|
|
66
4
|
|
|
67
5
|
type AuthMode = 'cookie' | 'body' | 'none';
|
|
68
6
|
interface AuthConfig {
|
|
@@ -74,33 +12,46 @@ interface AuthConfig {
|
|
|
74
12
|
*/
|
|
75
13
|
mode: AuthMode;
|
|
76
14
|
/**
|
|
77
|
-
*
|
|
15
|
+
* Auth server host for token refresh and all auth operations.
|
|
16
|
+
* Use this when auth is on a different server than the API.
|
|
17
|
+
* Replaces the deprecated accountsUrl and accountsServer fields.
|
|
18
|
+
* @example 'https://accounts.progalaxyelabs.com'
|
|
19
|
+
*/
|
|
20
|
+
host?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Token refresh endpoint path.
|
|
78
23
|
* @default '/auth/refresh' for cookie mode, '/user/refresh_access' for body mode
|
|
79
24
|
*/
|
|
80
25
|
refreshEndpoint?: string;
|
|
81
26
|
/**
|
|
82
|
-
* Enable CSRF token support (required for cookie mode)
|
|
27
|
+
* Enable CSRF token support (required for cookie mode).
|
|
83
28
|
* @default true for cookie mode, false for body mode
|
|
84
29
|
*/
|
|
85
30
|
useCsrf?: boolean;
|
|
86
31
|
/**
|
|
87
|
-
* Cookie name for refresh token
|
|
32
|
+
* Cookie name for refresh token.
|
|
88
33
|
* @default 'refresh_token'
|
|
89
34
|
*/
|
|
90
35
|
refreshTokenCookieName?: string;
|
|
91
36
|
/**
|
|
92
|
-
* Cookie name for CSRF token
|
|
37
|
+
* Cookie name for CSRF token.
|
|
93
38
|
* @default 'csrf_token'
|
|
94
39
|
*/
|
|
95
40
|
csrfTokenCookieName?: string;
|
|
96
41
|
/**
|
|
97
|
-
* CSRF header name
|
|
42
|
+
* CSRF header name.
|
|
98
43
|
* @default 'X-CSRF-Token'
|
|
99
44
|
*/
|
|
100
45
|
csrfHeaderName?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Response field mapping for external auth compatibility.
|
|
48
|
+
* Defaults to StoneScriptPHP format: { status:'ok', data:{ access_token, user } }
|
|
49
|
+
* Replaces the deprecated top-level authResponseMap field.
|
|
50
|
+
*/
|
|
51
|
+
responseMap?: Partial<AuthResponseMap>;
|
|
101
52
|
}
|
|
102
53
|
/**
|
|
103
|
-
* Authentication server configuration
|
|
54
|
+
* Authentication server configuration (for multi-server mode via StoneScriptPHPAuth).
|
|
104
55
|
*/
|
|
105
56
|
interface AuthServerConfig {
|
|
106
57
|
/** Server URL (e.g., 'https://accounts.progalaxyelabs.com') */
|
|
@@ -112,8 +63,6 @@ interface AuthServerConfig {
|
|
|
112
63
|
}
|
|
113
64
|
/**
|
|
114
65
|
* Configuration for a custom OAuth provider.
|
|
115
|
-
* Used to register custom providers via the ProviderRegistryService
|
|
116
|
-
* or through the environment's customProviders field.
|
|
117
66
|
*/
|
|
118
67
|
interface OAuthProviderConfig {
|
|
119
68
|
/** Display label for the provider (e.g., "Okta") */
|
|
@@ -131,7 +80,6 @@ interface OAuthProviderConfig {
|
|
|
131
80
|
}
|
|
132
81
|
/**
|
|
133
82
|
* Maps auth service response fields to expected locations.
|
|
134
|
-
* Different auth backends return tokens/user info in different structures.
|
|
135
83
|
* Paths use dot-notation (e.g., 'data.access_token' for nested fields).
|
|
136
84
|
*
|
|
137
85
|
* StoneScriptPHP format: { status: 'ok', data: { access_token, user, ... } }
|
|
@@ -157,195 +105,85 @@ interface AuthResponseMap {
|
|
|
157
105
|
declare class MyEnvironmentModel {
|
|
158
106
|
production: boolean;
|
|
159
107
|
/**
|
|
160
|
-
* Platform code identifier (e.g., 'progalaxy', 'hr', 'admin')
|
|
161
|
-
* Used for multi-tenant authentication
|
|
108
|
+
* Platform code identifier (e.g., 'progalaxy', 'hr', 'admin').
|
|
109
|
+
* Used for multi-tenant authentication.
|
|
162
110
|
*/
|
|
163
111
|
platformCode: string;
|
|
164
112
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*/
|
|
169
|
-
accountsUrl: string;
|
|
170
|
-
/**
|
|
171
|
-
* Multiple authentication servers configuration
|
|
172
|
-
* Enables platforms to authenticate against different identity providers
|
|
173
|
-
* @example
|
|
174
|
-
* ```typescript
|
|
175
|
-
* authServers: {
|
|
176
|
-
* customer: { url: 'https://auth.progalaxyelabs.com', default: true },
|
|
177
|
-
* employee: { url: 'https://admin-auth.progalaxyelabs.com' }
|
|
178
|
-
* }
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
181
|
-
authServers?: Record<string, AuthServerConfig>;
|
|
182
|
-
firebase: {
|
|
183
|
-
projectId: string;
|
|
184
|
-
appId: string;
|
|
185
|
-
databaseURL: string;
|
|
186
|
-
storageBucket: string;
|
|
187
|
-
locationId: string;
|
|
188
|
-
apiKey: string;
|
|
189
|
-
authDomain: string;
|
|
190
|
-
messagingSenderId: string;
|
|
191
|
-
measurementId: string;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Platform's own API base URL (e.g., '//api.medstoreapp.in')
|
|
195
|
-
* Used to route registration through the platform API proxy instead of auth directly
|
|
113
|
+
* Platform's own API base URL.
|
|
114
|
+
* Used for routes that go through the platform API proxy (e.g. register-tenant).
|
|
115
|
+
* Falls back to apiServer.host if not set.
|
|
196
116
|
* @example '//api.medstoreapp.in'
|
|
197
117
|
*/
|
|
198
118
|
apiUrl?: string;
|
|
199
119
|
apiServer: {
|
|
200
120
|
host: string;
|
|
201
121
|
};
|
|
202
|
-
chatServer: {
|
|
203
|
-
host: string;
|
|
204
|
-
};
|
|
205
122
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* Replaces the deprecated accountsUrl string with structured config
|
|
209
|
-
* @example { host: 'https://accounts.progalaxyelabs.com' }
|
|
210
|
-
*/
|
|
211
|
-
accountsServer?: {
|
|
212
|
-
host: string;
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* Files service server configuration
|
|
216
|
-
* Used by FilesService for file upload/download operations
|
|
123
|
+
* Files service server configuration.
|
|
124
|
+
* Used by FilesService for file upload/download operations.
|
|
217
125
|
* @example { host: 'https://files.progalaxyelabs.com/api/' }
|
|
218
126
|
*/
|
|
219
127
|
filesServer?: {
|
|
220
128
|
host: string;
|
|
221
129
|
};
|
|
222
130
|
/**
|
|
223
|
-
* Authentication configuration
|
|
131
|
+
* Authentication configuration.
|
|
224
132
|
* @default { mode: 'cookie', refreshEndpoint: '/auth/refresh', useCsrf: true }
|
|
225
133
|
*/
|
|
226
134
|
auth?: AuthConfig;
|
|
227
135
|
/**
|
|
228
|
-
*
|
|
229
|
-
* Register additional OAuth providers beyond the built-in ones
|
|
230
|
-
* (google, linkedin, apple, microsoft, github, zoho).
|
|
136
|
+
* Multiple authentication servers configuration (for StoneScriptPHPAuth multi-server mode).
|
|
231
137
|
* @example
|
|
232
138
|
* ```typescript
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
139
|
+
* authServers: {
|
|
140
|
+
* customer: { url: 'https://auth.progalaxyelabs.com', default: true },
|
|
141
|
+
* employee: { url: 'https://admin-auth.progalaxyelabs.com' }
|
|
236
142
|
* }
|
|
237
143
|
* ```
|
|
238
144
|
*/
|
|
239
|
-
|
|
145
|
+
authServers?: Record<string, AuthServerConfig>;
|
|
240
146
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* For external auth servers that return flat responses like
|
|
245
|
-
* { access_token, identity, ... }, override with:
|
|
147
|
+
* Custom OAuth provider configurations.
|
|
148
|
+
* @example
|
|
246
149
|
* ```typescript
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* refreshTokenPath: 'refresh_token',
|
|
250
|
-
* userPath: 'identity',
|
|
251
|
-
* errorMessagePath: 'message'
|
|
150
|
+
* customProviders: {
|
|
151
|
+
* okta: { label: 'Sign in with Okta', cssClass: 'btn-okta', buttonStyle: { borderColor: '#007dc1' } }
|
|
252
152
|
* }
|
|
253
153
|
* ```
|
|
254
154
|
*/
|
|
255
|
-
|
|
155
|
+
customProviders?: Record<string, OAuthProviderConfig>;
|
|
256
156
|
/**
|
|
257
|
-
* Branding configuration for auth components
|
|
258
|
-
* Allows platforms to customize login/register pages without creating wrappers
|
|
157
|
+
* Branding configuration for auth UI components.
|
|
259
158
|
*/
|
|
260
159
|
branding?: {
|
|
261
|
-
/** Application name displayed on auth pages */
|
|
262
160
|
appName: string;
|
|
263
|
-
/** URL to logo image */
|
|
264
161
|
logo?: string;
|
|
265
|
-
/** Primary brand color (hex) */
|
|
266
162
|
primaryColor?: string;
|
|
267
|
-
/** Gradient start color (hex) */
|
|
268
163
|
gradientStart?: string;
|
|
269
|
-
/** Gradient end color (hex) */
|
|
270
164
|
gradientEnd?: string;
|
|
271
|
-
/** Subtitle text displayed on auth pages */
|
|
272
165
|
subtitle?: string;
|
|
273
166
|
};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* CSRF Token Service
|
|
278
|
-
*
|
|
279
|
-
* Manages CSRF tokens for cookie-based authentication.
|
|
280
|
-
* Reads CSRF token from cookies and provides it for request headers.
|
|
281
|
-
*/
|
|
282
|
-
declare class CsrfService {
|
|
283
167
|
/**
|
|
284
|
-
*
|
|
168
|
+
* @deprecated Use auth.host instead.
|
|
169
|
+
* Auth server URL for centralized authentication.
|
|
285
170
|
*/
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Check if CSRF token exists
|
|
289
|
-
*/
|
|
290
|
-
hasCsrfToken(cookieName?: string): boolean;
|
|
291
|
-
/**
|
|
292
|
-
* Clear CSRF token (for logout)
|
|
293
|
-
* Note: Client-side deletion is limited for httpOnly cookies
|
|
294
|
-
*/
|
|
295
|
-
clearCsrfToken(cookieName?: string): void;
|
|
296
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CsrfService, never>;
|
|
297
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<CsrfService>;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
declare class ApiConnectionService {
|
|
301
|
-
private tokens;
|
|
302
|
-
private signinStatus;
|
|
303
|
-
private environment;
|
|
304
|
-
private csrf;
|
|
305
|
-
private host;
|
|
306
|
-
private accessToken;
|
|
307
|
-
private authConfig;
|
|
308
|
-
constructor(tokens: TokenService, signinStatus: SigninStatusService, environment: MyEnvironmentModel, csrf: CsrfService);
|
|
309
|
-
private request;
|
|
310
|
-
private handleError;
|
|
311
|
-
get<DataType>(endpoint: string, queryParamsObj?: any): Promise<ApiResponse<DataType>>;
|
|
312
|
-
post<DataType>(pathWithQueryParams: string, data: any): Promise<ApiResponse<DataType>>;
|
|
313
|
-
put<DataType>(pathWithQueryParams: string, data: any): Promise<ApiResponse<DataType>>;
|
|
314
|
-
patch<DataType>(pathWithQueryParams: string, data: any): Promise<ApiResponse<DataType>>;
|
|
315
|
-
delete<DataType>(endpoint: string, queryParamsObj?: any): Promise<ApiResponse<DataType>>;
|
|
316
|
-
private includeAccessToken;
|
|
317
|
-
private refreshAccessTokenAndRetry;
|
|
318
|
-
refreshAccessToken(): Promise<boolean>;
|
|
319
|
-
/**
|
|
320
|
-
* Refresh access token using cookie-based auth (StoneScriptPHP v2.1.x default)
|
|
321
|
-
*/
|
|
322
|
-
private refreshAccessTokenCookieMode;
|
|
323
|
-
/**
|
|
324
|
-
* Refresh access token using body-based auth (legacy mode)
|
|
325
|
-
*/
|
|
326
|
-
private refreshAccessTokenBodyMode;
|
|
327
|
-
buildQueryString(options?: any): string;
|
|
171
|
+
accountsUrl: string;
|
|
328
172
|
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
173
|
+
* @deprecated Use auth.host instead.
|
|
174
|
+
* Accounts/Authentication service server configuration.
|
|
331
175
|
*/
|
|
332
|
-
|
|
176
|
+
accountsServer?: {
|
|
177
|
+
host: string;
|
|
178
|
+
};
|
|
333
179
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
180
|
+
* @deprecated Use auth.responseMap instead.
|
|
181
|
+
* Auth response field mapping for external auth compatibility.
|
|
336
182
|
*/
|
|
337
|
-
|
|
338
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ApiConnectionService, never>;
|
|
339
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ApiConnectionService>;
|
|
183
|
+
authResponseMap?: AuthResponseMap;
|
|
340
184
|
}
|
|
341
185
|
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Authentication provider identifier.
|
|
345
|
-
* Includes all built-in providers plus any custom string identifier.
|
|
346
|
-
* The (string & {}) trick preserves autocomplete for built-in values.
|
|
347
|
-
*/
|
|
348
|
-
type AuthProvider = BuiltInProvider | (string & {});
|
|
186
|
+
declare const AUTH_PLUGIN: InjectionToken<AuthPlugin>;
|
|
349
187
|
interface User {
|
|
350
188
|
user_id: number;
|
|
351
189
|
id: string;
|
|
@@ -358,312 +196,427 @@ interface AuthResult {
|
|
|
358
196
|
success: boolean;
|
|
359
197
|
message?: string;
|
|
360
198
|
user?: User;
|
|
199
|
+
/** Set by the plugin on successful auth — AuthService stores it in TokenService */
|
|
200
|
+
accessToken?: string;
|
|
201
|
+
/** Set by the plugin for body mode — AuthService stores it in TokenService */
|
|
202
|
+
refreshToken?: string;
|
|
203
|
+
needsVerification?: boolean;
|
|
361
204
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
205
|
+
interface TenantMembership {
|
|
206
|
+
tenant_id: string;
|
|
207
|
+
slug: string;
|
|
208
|
+
name: string;
|
|
209
|
+
role: string;
|
|
210
|
+
status: string;
|
|
211
|
+
last_accessed?: string;
|
|
212
|
+
}
|
|
213
|
+
interface RegisterTenantData {
|
|
214
|
+
tenantName: string;
|
|
215
|
+
displayName?: string;
|
|
216
|
+
email?: string;
|
|
217
|
+
password?: string;
|
|
218
|
+
provider: string;
|
|
219
|
+
role?: string;
|
|
220
|
+
countryCode?: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Auth plugin interface — implement this to support any auth backend.
|
|
224
|
+
*
|
|
225
|
+
* The library ships StoneScriptPHPAuth as the built-in plugin.
|
|
226
|
+
* For external providers (Firebase, progalaxyelabs-auth, Okta, etc.),
|
|
227
|
+
* create a class implementing this interface and provide it via
|
|
228
|
+
* provideNgxStoneScriptPhpClient(environment, new YourAuthPlugin(...))
|
|
229
|
+
*
|
|
230
|
+
* @example Firebase
|
|
231
|
+
* ```typescript
|
|
232
|
+
* // firebase-auth.auth-plugin.ts (in your app)
|
|
233
|
+
* export class FirebaseAuthPlugin implements AuthPlugin {
|
|
234
|
+
* async login(email, password): Promise<AuthResult> {
|
|
235
|
+
* const cred = await signInWithEmailAndPassword(getAuth(), email, password);
|
|
236
|
+
* return { success: true, accessToken: await cred.user.getIdToken() };
|
|
237
|
+
* }
|
|
238
|
+
* async refresh(): Promise<string | null> {
|
|
239
|
+
* const user = getAuth().currentUser;
|
|
240
|
+
* return user ? await user.getIdToken(true) : null;
|
|
241
|
+
* }
|
|
242
|
+
* // ...
|
|
243
|
+
* }
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
interface AuthPlugin {
|
|
378
247
|
/**
|
|
379
|
-
*
|
|
248
|
+
* Authenticate with email and password.
|
|
249
|
+
* Return accessToken (and optionally refreshToken for body mode) in result.
|
|
380
250
|
*/
|
|
381
|
-
|
|
251
|
+
login(email: string, password: string): Promise<AuthResult>;
|
|
382
252
|
/**
|
|
383
|
-
*
|
|
253
|
+
* Register a new user account.
|
|
254
|
+
* Return accessToken on success.
|
|
384
255
|
*/
|
|
385
|
-
|
|
256
|
+
register(email: string, password: string, displayName: string): Promise<AuthResult>;
|
|
386
257
|
/**
|
|
387
|
-
*
|
|
258
|
+
* Sign out the current user.
|
|
259
|
+
* @param refreshToken - Current refresh token (for body mode revocation)
|
|
388
260
|
*/
|
|
389
|
-
|
|
261
|
+
logout(refreshToken?: string): Promise<void>;
|
|
390
262
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
263
|
+
* Check for an existing session on app init (e.g., via httpOnly refresh cookie).
|
|
264
|
+
* Return success + accessToken if session is valid.
|
|
393
265
|
*/
|
|
394
|
-
|
|
266
|
+
checkSession(): Promise<AuthResult>;
|
|
395
267
|
/**
|
|
396
|
-
*
|
|
397
|
-
* @
|
|
268
|
+
* Refresh the access token.
|
|
269
|
+
* @param accessToken - Current access token (for body mode)
|
|
270
|
+
* @param refreshToken - Current refresh token (for body mode)
|
|
271
|
+
* @returns New access token, or null if refresh failed
|
|
398
272
|
*/
|
|
399
|
-
|
|
273
|
+
refresh(accessToken: string, refreshToken?: string): Promise<string | null>;
|
|
274
|
+
/** OAuth popup login (google, github, linkedin, etc.) */
|
|
275
|
+
loginWithProvider?(provider: string): Promise<AuthResult>;
|
|
276
|
+
/** Select a tenant and get a tenant-scoped access token */
|
|
277
|
+
selectTenant?(tenantId: string, accessToken: string): Promise<AuthResult>;
|
|
278
|
+
/** List tenant memberships for the authenticated user */
|
|
279
|
+
getTenantMemberships?(accessToken: string): Promise<TenantMembership[]>;
|
|
280
|
+
/** Register a new tenant (organization) */
|
|
281
|
+
registerTenant?(data: RegisterTenantData, accessToken?: string): Promise<any>;
|
|
282
|
+
/** Check if a tenant slug is available */
|
|
283
|
+
checkTenantSlugAvailable?(slug: string): Promise<{
|
|
284
|
+
available: boolean;
|
|
285
|
+
suggestion?: string;
|
|
286
|
+
}>;
|
|
287
|
+
/** Check onboarding status for a user identity */
|
|
288
|
+
checkOnboardingStatus?(identityId: string, platformCode?: string): Promise<any>;
|
|
289
|
+
/** Complete tenant onboarding (create tenant with country + org name) */
|
|
290
|
+
completeTenantOnboarding?(countryCode: string, tenantName: string, accessToken: string): Promise<any>;
|
|
291
|
+
/** Check if user email exists */
|
|
292
|
+
checkEmail?(email: string): Promise<{
|
|
293
|
+
exists: boolean;
|
|
294
|
+
user?: any;
|
|
295
|
+
}>;
|
|
296
|
+
switchServer?(serverName: string): void;
|
|
297
|
+
getAvailableServers?(): string[];
|
|
298
|
+
getActiveServer?(): string | null;
|
|
299
|
+
getServerConfig?(serverName?: string): any;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Configure the ngx-stonescriptphp-client library.
|
|
304
|
+
*
|
|
305
|
+
* @param environment - Library configuration (API server, auth settings, etc.)
|
|
306
|
+
* @param plugin - Optional auth plugin override. Defaults to StoneScriptPHPAuth.
|
|
307
|
+
* Provide your own plugin to use Firebase, progalaxyelabs-auth, Okta, or any other auth backend.
|
|
308
|
+
*
|
|
309
|
+
* @example Default (StoneScriptPHP backend)
|
|
310
|
+
* ```typescript
|
|
311
|
+
* // app.config.ts
|
|
312
|
+
* export const appConfig: ApplicationConfig = {
|
|
313
|
+
* providers: [
|
|
314
|
+
* provideNgxStoneScriptPhpClient(environment)
|
|
315
|
+
* ]
|
|
316
|
+
* };
|
|
317
|
+
* ```
|
|
318
|
+
*
|
|
319
|
+
* @example External auth plugin
|
|
320
|
+
* ```typescript
|
|
321
|
+
* import { ProgalaxyElabsAuth } from './progalaxyelabs-auth.auth-plugin';
|
|
322
|
+
*
|
|
323
|
+
* providers: [
|
|
324
|
+
* provideNgxStoneScriptPhpClient(environment, new ProgalaxyElabsAuth({ host: '...' }))
|
|
325
|
+
* ]
|
|
326
|
+
* ```
|
|
327
|
+
*
|
|
328
|
+
* @example Firebase
|
|
329
|
+
* ```typescript
|
|
330
|
+
* import { FirebaseAuthPlugin } from './firebase-auth.auth-plugin';
|
|
331
|
+
*
|
|
332
|
+
* providers: [
|
|
333
|
+
* provideNgxStoneScriptPhpClient(environment, new FirebaseAuthPlugin(firebaseConfig))
|
|
334
|
+
* ]
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
declare function provideNgxStoneScriptPhpClient(environment: MyEnvironmentModel, plugin?: AuthPlugin): EnvironmentProviders;
|
|
338
|
+
|
|
339
|
+
interface StoneScriptPHPAuthConfig {
|
|
340
|
+
/** Auth server base URL (e.g., 'https://accounts.progalaxyelabs.com') */
|
|
341
|
+
host: string;
|
|
342
|
+
/** Platform code for multi-tenant auth (e.g., 'progalaxy', 'hr') */
|
|
343
|
+
platformCode?: string;
|
|
400
344
|
/**
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
* @throws Error if server not found in configuration
|
|
345
|
+
* Named auth servers for multi-server mode.
|
|
346
|
+
* When set, host is used as fallback if no default server is specified.
|
|
404
347
|
*/
|
|
405
|
-
|
|
348
|
+
authServers?: Record<string, AuthServerConfig>;
|
|
406
349
|
/**
|
|
407
|
-
*
|
|
408
|
-
*
|
|
350
|
+
* Response field mapping for external format compatibility.
|
|
351
|
+
* Defaults to StoneScriptPHP format: { status:'ok', data:{ access_token, user } }
|
|
409
352
|
*/
|
|
410
|
-
|
|
353
|
+
responseMap?: Partial<AuthResponseMap>;
|
|
411
354
|
/**
|
|
412
|
-
*
|
|
355
|
+
* Auth mode and CSRF configuration.
|
|
356
|
+
* Defaults: mode='cookie', refreshEndpoint='/auth/refresh', useCsrf=true
|
|
413
357
|
*/
|
|
414
|
-
|
|
358
|
+
auth?: Pick<AuthConfig, 'mode' | 'refreshEndpoint' | 'useCsrf' | 'csrfTokenCookieName' | 'csrfHeaderName'>;
|
|
415
359
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
* @throws Error if no API URL is configured
|
|
360
|
+
* Platform's own API URL for register-tenant proxy route.
|
|
361
|
+
* Falls back to host if not set.
|
|
419
362
|
*/
|
|
420
|
-
|
|
421
|
-
|
|
363
|
+
apiUrl?: string;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Built-in auth plugin for StoneScriptPHP backends.
|
|
367
|
+
*
|
|
368
|
+
* Handles StoneScriptPHP's auth format ({ status:'ok', data:{ access_token } })
|
|
369
|
+
* with optional authResponseMap overrides for external backends.
|
|
370
|
+
*
|
|
371
|
+
* Supports:
|
|
372
|
+
* - Cookie mode (httpOnly refresh token + CSRF)
|
|
373
|
+
* - Body mode (tokens in localStorage)
|
|
374
|
+
* - Multi-server auth (named authServers config)
|
|
375
|
+
* - OAuth popup login
|
|
376
|
+
* - Multi-tenant operations
|
|
377
|
+
*/
|
|
378
|
+
declare class StoneScriptPHPAuth implements AuthPlugin {
|
|
379
|
+
private config;
|
|
380
|
+
private activeServer;
|
|
381
|
+
constructor(config: StoneScriptPHPAuthConfig);
|
|
422
382
|
private get responseMap();
|
|
423
|
-
/** Resolve a dot-notation path on an object (e.g., 'data.access_token') */
|
|
424
383
|
private resolvePath;
|
|
425
|
-
/** Check if an auth response indicates success */
|
|
426
384
|
private isAuthSuccess;
|
|
427
|
-
|
|
428
|
-
private
|
|
429
|
-
|
|
430
|
-
private
|
|
431
|
-
/** Extract user/identity object from auth response */
|
|
432
|
-
private getUserFromResponse;
|
|
433
|
-
/** Extract error message from auth response */
|
|
434
|
-
private getErrorMessage;
|
|
435
|
-
/** Normalize a user/identity object into the standard User shape */
|
|
385
|
+
private resolveAccessToken;
|
|
386
|
+
private resolveRefreshToken;
|
|
387
|
+
private resolveUser;
|
|
388
|
+
private resolveErrorMessage;
|
|
436
389
|
private normalizeUser;
|
|
437
|
-
/**
|
|
438
|
-
* Hash UUID to numeric ID for backward compatibility
|
|
439
|
-
* Converts UUID string to a consistent numeric ID for legacy code
|
|
440
|
-
*/
|
|
441
390
|
private hashUUID;
|
|
391
|
+
private getCsrfToken;
|
|
392
|
+
private getAccountsUrl;
|
|
393
|
+
private getPlatformApiUrl;
|
|
394
|
+
private getDefaultServer;
|
|
395
|
+
private restoreActiveServer;
|
|
396
|
+
switchServer(serverName: string): void;
|
|
397
|
+
getAvailableServers(): string[];
|
|
398
|
+
getActiveServer(): string | null;
|
|
399
|
+
getServerConfig(serverName?: string): AuthServerConfig | null;
|
|
400
|
+
login(email: string, password: string): Promise<AuthResult>;
|
|
401
|
+
register(email: string, password: string, displayName: string): Promise<AuthResult>;
|
|
402
|
+
logout(refreshToken?: string): Promise<void>;
|
|
403
|
+
checkSession(): Promise<AuthResult>;
|
|
404
|
+
refresh(accessToken: string, refreshToken?: string): Promise<string | null>;
|
|
405
|
+
private refreshCookieMode;
|
|
406
|
+
private refreshBodyMode;
|
|
407
|
+
loginWithProvider(provider: string): Promise<AuthResult>;
|
|
408
|
+
selectTenant(tenantId: string, accessToken: string): Promise<AuthResult>;
|
|
409
|
+
getTenantMemberships(accessToken: string): Promise<TenantMembership[]>;
|
|
410
|
+
registerTenant(data: RegisterTenantData, accessToken?: string): Promise<any>;
|
|
411
|
+
private registerTenantWithOAuth;
|
|
412
|
+
checkTenantSlugAvailable(slug: string): Promise<{
|
|
413
|
+
available: boolean;
|
|
414
|
+
suggestion?: string;
|
|
415
|
+
}>;
|
|
416
|
+
checkOnboardingStatus(identityId: string, platformCode?: string): Promise<any>;
|
|
417
|
+
completeTenantOnboarding(countryCode: string, tenantName: string, accessToken: string): Promise<any>;
|
|
418
|
+
checkEmail(email: string): Promise<{
|
|
419
|
+
exists: boolean;
|
|
420
|
+
user?: any;
|
|
421
|
+
}>;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
declare class TokenService {
|
|
425
|
+
private accessToken;
|
|
426
|
+
private refreshToken;
|
|
427
|
+
private lsAccessTokenKey;
|
|
428
|
+
private lsRefreshTokenKey;
|
|
429
|
+
constructor();
|
|
430
|
+
setTokens(accessToken: string, refreshToken: string): void;
|
|
431
|
+
setAccessToken(accessToken: string): void;
|
|
432
|
+
setRefreshToken(refreshToken: string): void;
|
|
433
|
+
getAccessToken(): string;
|
|
434
|
+
getRefreshToken(): string;
|
|
435
|
+
clear(): void;
|
|
442
436
|
/**
|
|
443
|
-
*
|
|
437
|
+
* Check if there is a non-empty access token.
|
|
438
|
+
* Token is treated as opaque — validity is determined by the auth server.
|
|
444
439
|
*/
|
|
445
|
-
|
|
440
|
+
hasValidAccessToken(): boolean;
|
|
441
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TokenService, never>;
|
|
442
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<TokenService>;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @deprecated Use boolean directly. Kept for backward compatibility.
|
|
447
|
+
*/
|
|
448
|
+
declare enum VerifyStatus {
|
|
449
|
+
initialized = "initialized",
|
|
450
|
+
yes = "yes",
|
|
451
|
+
no = "no"
|
|
452
|
+
}
|
|
453
|
+
declare class SigninStatusService {
|
|
454
|
+
status: BehaviorSubject<boolean | VerifyStatus>;
|
|
455
|
+
constructor();
|
|
456
|
+
signedOut(): void;
|
|
457
|
+
signedIn(): void;
|
|
446
458
|
/**
|
|
447
|
-
*
|
|
459
|
+
* Set signin status
|
|
460
|
+
* @param isSignedIn - True if user is signed in, false otherwise
|
|
448
461
|
*/
|
|
462
|
+
setSigninStatus(isSignedIn: boolean): void;
|
|
463
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SigninStatusService, never>;
|
|
464
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SigninStatusService>;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
declare class ApiResponse<DataType> {
|
|
468
|
+
readonly status: string;
|
|
469
|
+
readonly data: DataType | null;
|
|
470
|
+
readonly message: string;
|
|
471
|
+
get success(): boolean;
|
|
472
|
+
get errors(): string[];
|
|
473
|
+
constructor(status: string, data?: any, message?: string);
|
|
474
|
+
onOk(callback: (data: DataType) => void): ApiResponse<DataType>;
|
|
475
|
+
onNotOk(callback: (message: string, data: DataType) => void): ApiResponse<DataType>;
|
|
476
|
+
onError(callback: () => void): ApiResponse<DataType>;
|
|
477
|
+
isSuccess(): boolean;
|
|
478
|
+
isError(): boolean;
|
|
479
|
+
getData(): DataType | null;
|
|
480
|
+
getError(): string;
|
|
481
|
+
getStatus(): string;
|
|
482
|
+
getMessage(): string;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
type BuiltInProvider = 'google' | 'linkedin' | 'apple' | 'microsoft' | 'github' | 'zoho' | 'emailPassword';
|
|
486
|
+
/**
|
|
487
|
+
* Authentication provider identifier.
|
|
488
|
+
* Includes all built-in providers plus any custom string identifier.
|
|
489
|
+
* The (string & {}) trick preserves autocomplete for built-in values.
|
|
490
|
+
*/
|
|
491
|
+
type AuthProvider = BuiltInProvider | (string & {});
|
|
492
|
+
/**
|
|
493
|
+
* AuthService — manages auth state and delegates all auth operations to the AuthPlugin.
|
|
494
|
+
*
|
|
495
|
+
* This service holds user state (via BehaviorSubject) and tokens (via TokenService).
|
|
496
|
+
* It does not make any HTTP calls directly — all auth logic lives in the plugin.
|
|
497
|
+
*
|
|
498
|
+
* Provide a plugin via provideNgxStoneScriptPhpClient():
|
|
499
|
+
* - Default: StoneScriptPHPAuth (built-in, matches StoneScriptPHP backend)
|
|
500
|
+
* - External: any class implementing AuthPlugin (Firebase, progalaxyelabs-auth, Okta, etc.)
|
|
501
|
+
*/
|
|
502
|
+
declare class AuthService {
|
|
503
|
+
private plugin;
|
|
504
|
+
private tokens;
|
|
505
|
+
private signinStatus;
|
|
506
|
+
private readonly USER_STORAGE_KEY;
|
|
507
|
+
private userSubject;
|
|
508
|
+
user$: Observable<User | null>;
|
|
509
|
+
constructor(plugin: AuthPlugin, tokens: TokenService, signinStatus: SigninStatusService);
|
|
510
|
+
private restoreUser;
|
|
449
511
|
private saveUser;
|
|
450
|
-
/**
|
|
451
|
-
* Update user subject and persist to localStorage
|
|
452
|
-
*/
|
|
453
512
|
private updateUser;
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
* @param email - User email
|
|
457
|
-
* @param password - User password
|
|
458
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
459
|
-
*/
|
|
460
|
-
loginWithEmail(email: string, password: string, serverName?: string): Promise<AuthResult>;
|
|
461
|
-
/**
|
|
462
|
-
* Login with Google OAuth (popup window)
|
|
463
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
464
|
-
*/
|
|
513
|
+
private storeAuthResult;
|
|
514
|
+
loginWithEmail(email: string, password: string): Promise<AuthResult>;
|
|
465
515
|
loginWithGoogle(serverName?: string): Promise<AuthResult>;
|
|
466
|
-
/**
|
|
467
|
-
* Login with GitHub OAuth (popup window)
|
|
468
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
469
|
-
*/
|
|
470
516
|
loginWithGitHub(serverName?: string): Promise<AuthResult>;
|
|
471
|
-
/**
|
|
472
|
-
* Login with LinkedIn OAuth (popup window)
|
|
473
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
474
|
-
*/
|
|
475
517
|
loginWithLinkedIn(serverName?: string): Promise<AuthResult>;
|
|
476
|
-
/**
|
|
477
|
-
* Login with Apple OAuth (popup window)
|
|
478
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
479
|
-
*/
|
|
480
518
|
loginWithApple(serverName?: string): Promise<AuthResult>;
|
|
481
|
-
/**
|
|
482
|
-
* Login with Microsoft OAuth (popup window)
|
|
483
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
484
|
-
*/
|
|
485
519
|
loginWithMicrosoft(serverName?: string): Promise<AuthResult>;
|
|
486
|
-
/**
|
|
487
|
-
* Login with Zoho OAuth (popup window)
|
|
488
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
489
|
-
*/
|
|
490
520
|
loginWithZoho(serverName?: string): Promise<AuthResult>;
|
|
491
|
-
/**
|
|
492
|
-
* Generic provider-based login (supports all OAuth providers)
|
|
493
|
-
* @param provider - The provider identifier
|
|
494
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
495
|
-
*/
|
|
496
521
|
loginWithProvider(provider: AuthProvider, serverName?: string): Promise<AuthResult>;
|
|
497
|
-
/**
|
|
498
|
-
* Generic OAuth login handler
|
|
499
|
-
* Opens popup window and listens for postMessage
|
|
500
|
-
* @param provider - OAuth provider name
|
|
501
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
502
|
-
*/
|
|
503
|
-
private loginWithOAuth;
|
|
504
|
-
/**
|
|
505
|
-
* Register new user
|
|
506
|
-
* @param email - User email
|
|
507
|
-
* @param password - User password
|
|
508
|
-
* @param displayName - Display name
|
|
509
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
510
|
-
*/
|
|
511
522
|
register(email: string, password: string, displayName: string, serverName?: string): Promise<AuthResult>;
|
|
512
|
-
/**
|
|
513
|
-
* Sign out user
|
|
514
|
-
* @param serverName - Optional: Specify which auth server to logout from (for multi-server mode)
|
|
515
|
-
*/
|
|
516
523
|
signout(serverName?: string): Promise<void>;
|
|
517
|
-
/**
|
|
518
|
-
* Check for active session (call on app init)
|
|
519
|
-
* @param serverName - Optional: Specify which auth server to check (for multi-server mode)
|
|
520
|
-
*/
|
|
521
524
|
checkSession(serverName?: string): Promise<boolean>;
|
|
522
525
|
/**
|
|
523
|
-
*
|
|
526
|
+
* Refresh the access token. Called by ApiConnectionService on 401.
|
|
527
|
+
* @returns true if token was refreshed, false if refresh failed (user is signed out)
|
|
524
528
|
*/
|
|
529
|
+
refresh(): Promise<boolean>;
|
|
525
530
|
isAuthenticated(): boolean;
|
|
526
|
-
/**
|
|
527
|
-
* Get current user (synchronous)
|
|
528
|
-
*/
|
|
529
531
|
getCurrentUser(): User | null;
|
|
530
|
-
/**
|
|
531
|
-
* Register a new user AND create a new tenant (organization)
|
|
532
|
-
* This is used when a user wants to create their own organization
|
|
533
|
-
*/
|
|
534
532
|
registerTenant(data: {
|
|
535
533
|
tenantName: string;
|
|
536
|
-
tenantSlug: string;
|
|
537
534
|
displayName?: string;
|
|
538
535
|
email?: string;
|
|
539
536
|
password?: string;
|
|
540
537
|
provider: AuthProvider;
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
tenant?: {
|
|
545
|
-
id: string;
|
|
546
|
-
name: string;
|
|
547
|
-
slug: string;
|
|
548
|
-
};
|
|
549
|
-
user?: {
|
|
550
|
-
id: string;
|
|
551
|
-
email: string;
|
|
552
|
-
name: string;
|
|
553
|
-
};
|
|
554
|
-
access_token?: string;
|
|
555
|
-
}>;
|
|
556
|
-
/**
|
|
557
|
-
* Register tenant with OAuth provider
|
|
558
|
-
* Opens popup window for OAuth flow
|
|
559
|
-
*/
|
|
560
|
-
private registerTenantWithOAuth;
|
|
561
|
-
/**
|
|
562
|
-
* Get all tenant memberships for the authenticated user
|
|
563
|
-
* @param serverName - Optional: Specify which auth server to query (for multi-server mode)
|
|
564
|
-
*/
|
|
538
|
+
role?: string;
|
|
539
|
+
countryCode?: string;
|
|
540
|
+
}): Promise<any>;
|
|
565
541
|
getTenantMemberships(serverName?: string): Promise<{
|
|
566
|
-
memberships:
|
|
567
|
-
tenant_id: string;
|
|
568
|
-
slug: string;
|
|
569
|
-
name: string;
|
|
570
|
-
role: string;
|
|
571
|
-
status: string;
|
|
572
|
-
last_accessed?: string;
|
|
573
|
-
}>;
|
|
542
|
+
memberships: TenantMembership[];
|
|
574
543
|
}>;
|
|
575
|
-
/**
|
|
576
|
-
* Select a tenant for the current session
|
|
577
|
-
* Updates the JWT token with tenant context
|
|
578
|
-
* @param tenantId - Tenant ID to select
|
|
579
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
580
|
-
*/
|
|
581
544
|
selectTenant(tenantId: string, serverName?: string): Promise<{
|
|
582
545
|
success: boolean;
|
|
583
546
|
message?: string;
|
|
584
547
|
access_token?: string;
|
|
585
548
|
}>;
|
|
586
|
-
/**
|
|
587
|
-
* Check if a tenant slug is available
|
|
588
|
-
* @param slug - Tenant slug to check
|
|
589
|
-
* @param serverName - Optional: Specify which auth server to query (for multi-server mode)
|
|
590
|
-
*/
|
|
591
549
|
checkTenantSlugAvailable(slug: string, serverName?: string): Promise<{
|
|
592
550
|
available: boolean;
|
|
593
551
|
suggestion?: string;
|
|
594
552
|
}>;
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
553
|
+
checkOnboardingStatus(identityId: string, serverName?: string): Promise<any>;
|
|
554
|
+
completeTenantOnboarding(countryCode: string, tenantName: string, serverName?: string): Promise<any>;
|
|
555
|
+
getAvailableAuthServers(): string[];
|
|
556
|
+
getActiveAuthServer(): string | null;
|
|
557
|
+
switchAuthServer(serverName: string): void;
|
|
558
|
+
getAuthServerConfig(serverName?: string): any | null;
|
|
559
|
+
isMultiServerMode(): boolean;
|
|
560
|
+
/** @deprecated Use getCurrentUser()?.user_id instead */
|
|
598
561
|
getUserId(): number;
|
|
599
|
-
/**
|
|
600
|
-
* @deprecated Use getCurrentUser()?.display_name instead
|
|
601
|
-
*/
|
|
562
|
+
/** @deprecated Use getCurrentUser()?.display_name instead */
|
|
602
563
|
getUserName(): string;
|
|
603
|
-
/**
|
|
604
|
-
* @deprecated Use getCurrentUser()?.photo_url instead
|
|
605
|
-
*/
|
|
564
|
+
/** @deprecated Use getCurrentUser()?.photo_url instead */
|
|
606
565
|
getPhotoUrl(): string;
|
|
607
|
-
/**
|
|
608
|
-
* @deprecated Use getCurrentUser()?.display_name instead
|
|
609
|
-
*/
|
|
566
|
+
/** @deprecated Use getCurrentUser()?.display_name instead */
|
|
610
567
|
getDisplayName(): string;
|
|
611
|
-
/**
|
|
612
|
-
* @deprecated Use `/profile/${getCurrentUser()?.user_id}` instead
|
|
613
|
-
*/
|
|
568
|
+
/** @deprecated Use `/profile/${getCurrentUser()?.user_id}` instead */
|
|
614
569
|
getProfileUrl(): string;
|
|
615
|
-
/**
|
|
616
|
-
* @deprecated Use isAuthenticated() instead
|
|
617
|
-
*/
|
|
570
|
+
/** @deprecated Use isAuthenticated() instead */
|
|
618
571
|
signin(): Promise<boolean>;
|
|
619
|
-
/**
|
|
620
|
-
* @deprecated Use loginWithEmail() instead
|
|
621
|
-
*/
|
|
572
|
+
/** @deprecated Use loginWithEmail() instead */
|
|
622
573
|
verifyCredentials(email: string, password: string): Promise<boolean>;
|
|
623
|
-
/**
|
|
624
|
-
* @deprecated Check user.is_email_verified from getCurrentUser() instead
|
|
625
|
-
*/
|
|
574
|
+
/** @deprecated Check user.is_email_verified from getCurrentUser() instead */
|
|
626
575
|
isSigninEmailValid(): boolean;
|
|
627
|
-
/**
|
|
628
|
-
* @deprecated No longer needed - dialog is managed by platform
|
|
629
|
-
*/
|
|
576
|
+
/** @deprecated No longer needed */
|
|
630
577
|
onDialogClose(): void;
|
|
631
|
-
/**
|
|
632
|
-
* @deprecated No longer needed - dialog is managed by platform
|
|
633
|
-
*/
|
|
578
|
+
/** @deprecated No longer needed */
|
|
634
579
|
closeSocialAuthDialog(): void;
|
|
580
|
+
/** @deprecated Use checkEmail() from the plugin directly */
|
|
581
|
+
getUserProfile(email: string, serverName?: string): Promise<User | null>;
|
|
582
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
|
|
583
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
declare class ApiConnectionService {
|
|
587
|
+
private tokens;
|
|
588
|
+
private signinStatus;
|
|
589
|
+
private environment;
|
|
590
|
+
private authService;
|
|
591
|
+
private host;
|
|
592
|
+
constructor(tokens: TokenService, signinStatus: SigninStatusService, environment: MyEnvironmentModel, authService: AuthService);
|
|
593
|
+
private request;
|
|
594
|
+
private handleError;
|
|
595
|
+
get<DataType>(endpoint: string, queryParamsObj?: any): Promise<ApiResponse<DataType>>;
|
|
596
|
+
post<DataType>(pathWithQueryParams: string, data: any): Promise<ApiResponse<DataType>>;
|
|
597
|
+
put<DataType>(pathWithQueryParams: string, data: any): Promise<ApiResponse<DataType>>;
|
|
598
|
+
patch<DataType>(pathWithQueryParams: string, data: any): Promise<ApiResponse<DataType>>;
|
|
599
|
+
delete<DataType>(endpoint: string, queryParamsObj?: any): Promise<ApiResponse<DataType>>;
|
|
600
|
+
private includeAccessToken;
|
|
601
|
+
private refreshAndRetry;
|
|
635
602
|
/**
|
|
636
|
-
*
|
|
603
|
+
* Refresh the access token (delegates to AuthService → AuthPlugin).
|
|
604
|
+
* Kept public for backward compatibility.
|
|
637
605
|
*/
|
|
638
|
-
|
|
606
|
+
refreshAccessToken(): Promise<boolean>;
|
|
607
|
+
buildQueryString(options?: any): string;
|
|
639
608
|
/**
|
|
640
|
-
*
|
|
641
|
-
* @
|
|
642
|
-
* @param serverName - Optional: Specify which auth server to query (for multi-server mode)
|
|
609
|
+
* Upload a drawing (uses upload server if configured, otherwise API server)
|
|
610
|
+
* @deprecated Platform-specific method - consider moving to platform service
|
|
643
611
|
*/
|
|
644
|
-
|
|
645
|
-
onboarded: boolean;
|
|
646
|
-
tenant_slug?: string;
|
|
647
|
-
tenant_name?: string;
|
|
648
|
-
role?: string;
|
|
649
|
-
}>;
|
|
612
|
+
uploadDrawing<DataType>(formData: FormData): Promise<ApiResponse<DataType>>;
|
|
650
613
|
/**
|
|
651
|
-
*
|
|
652
|
-
* @
|
|
653
|
-
* @param tenantName - Tenant organization name
|
|
654
|
-
* @param serverName - Optional: Specify which auth server to use (for multi-server mode)
|
|
614
|
+
* Upload an image (uses upload server if configured, otherwise API server)
|
|
615
|
+
* @deprecated Platform-specific method - consider moving to platform service
|
|
655
616
|
*/
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
slug: string;
|
|
660
|
-
name: string;
|
|
661
|
-
};
|
|
662
|
-
access_token: string;
|
|
663
|
-
refresh_token: string;
|
|
664
|
-
}>;
|
|
665
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
|
|
666
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
|
|
617
|
+
uploadImage<DataType>(formData: FormData): Promise<ApiResponse<DataType>>;
|
|
618
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApiConnectionService, never>;
|
|
619
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ApiConnectionService>;
|
|
667
620
|
}
|
|
668
621
|
|
|
669
622
|
declare class DbService {
|
|
@@ -672,6 +625,30 @@ declare class DbService {
|
|
|
672
625
|
static ɵprov: i0.ɵɵInjectableDeclaration<DbService>;
|
|
673
626
|
}
|
|
674
627
|
|
|
628
|
+
/**
|
|
629
|
+
* CSRF Token Service
|
|
630
|
+
*
|
|
631
|
+
* Manages CSRF tokens for cookie-based authentication.
|
|
632
|
+
* Reads CSRF token from cookies and provides it for request headers.
|
|
633
|
+
*/
|
|
634
|
+
declare class CsrfService {
|
|
635
|
+
/**
|
|
636
|
+
* Get CSRF token from cookie
|
|
637
|
+
*/
|
|
638
|
+
getCsrfToken(cookieName?: string): string | null;
|
|
639
|
+
/**
|
|
640
|
+
* Check if CSRF token exists
|
|
641
|
+
*/
|
|
642
|
+
hasCsrfToken(cookieName?: string): boolean;
|
|
643
|
+
/**
|
|
644
|
+
* Clear CSRF token (for logout)
|
|
645
|
+
* Note: Client-side deletion is limited for httpOnly cookies
|
|
646
|
+
*/
|
|
647
|
+
clearCsrfToken(cookieName?: string): void;
|
|
648
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CsrfService, never>;
|
|
649
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CsrfService>;
|
|
650
|
+
}
|
|
651
|
+
|
|
675
652
|
/**
|
|
676
653
|
* Result of a file upload operation
|
|
677
654
|
*/
|
|
@@ -854,21 +831,6 @@ declare class ProviderRegistryService {
|
|
|
854
831
|
static ɵprov: i0.ɵɵInjectableDeclaration<ProviderRegistryService>;
|
|
855
832
|
}
|
|
856
833
|
|
|
857
|
-
declare class NgxStoneScriptPhpClientModule {
|
|
858
|
-
static forRoot(environment: MyEnvironmentModel): ModuleWithProviders<NgxStoneScriptPhpClientModule>;
|
|
859
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgxStoneScriptPhpClientModule, never>;
|
|
860
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxStoneScriptPhpClientModule, never, [typeof i1.CommonModule], never>;
|
|
861
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<NgxStoneScriptPhpClientModule>;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
interface TenantMembership {
|
|
865
|
-
tenant_id: string;
|
|
866
|
-
slug: string;
|
|
867
|
-
name: string;
|
|
868
|
-
role: string;
|
|
869
|
-
status: string;
|
|
870
|
-
last_accessed?: string;
|
|
871
|
-
}
|
|
872
834
|
interface TenantSelectedEvent {
|
|
873
835
|
tenantId: string;
|
|
874
836
|
tenantSlug: string;
|
|
@@ -1143,5 +1105,5 @@ declare class TenantRegisterDialogComponent {
|
|
|
1143
1105
|
static ɵcmp: i0.ɵɵComponentDeclaration<TenantRegisterDialogComponent, "lib-tenant-register-dialog", never, {}, {}, never, never, true, never>;
|
|
1144
1106
|
}
|
|
1145
1107
|
|
|
1146
|
-
export { ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel,
|
|
1147
|
-
export type { AuthConfig, AuthMode, AuthProvider, AuthResponseMap, AuthResult, AuthServerConfig, BuiltInProvider, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, OAuthProviderConfig, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
|
|
1108
|
+
export { AUTH_PLUGIN, ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, ProviderRegistryService, RegisterComponent, SigninStatusService, StoneScriptPHPAuth, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus, provideNgxStoneScriptPhpClient };
|
|
1109
|
+
export type { AuthConfig, AuthMode, AuthPlugin, AuthProvider, AuthResponseMap, AuthResult, AuthServerConfig, BuiltInProvider, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, OAuthProviderConfig, RegisterTenantData, StoneScriptPHPAuthConfig, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
|