@progalaxyelabs/ngx-stonescriptphp-client 1.23.2 → 1.23.4

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.
@@ -1169,13 +1169,15 @@ class AuthService {
1169
1169
  plugin;
1170
1170
  tokens;
1171
1171
  signinStatus;
1172
+ environment;
1172
1173
  USER_STORAGE_KEY = 'progalaxyapi_user';
1173
1174
  userSubject = new BehaviorSubject(null);
1174
1175
  user$ = this.userSubject.asObservable();
1175
- constructor(plugin, tokens, signinStatus) {
1176
+ constructor(plugin, tokens, signinStatus, environment) {
1176
1177
  this.plugin = plugin;
1177
1178
  this.tokens = tokens;
1178
1179
  this.signinStatus = signinStatus;
1180
+ this.environment = environment;
1179
1181
  this.restoreUser();
1180
1182
  }
1181
1183
  // ── State management ──────────────────────────────────────────────────────
@@ -1301,6 +1303,40 @@ class AuthService {
1301
1303
  isAuthenticated() {
1302
1304
  return this.tokens.hasValidAccessToken();
1303
1305
  }
1306
+ // ── Profile management ────────────────────────────────────────────────────
1307
+ /**
1308
+ * Update the authenticated user's display name.
1309
+ * Calls PUT /api/account/profile with { display_name } and updates local user state on success.
1310
+ */
1311
+ async updateProfile(displayName) {
1312
+ const accessToken = this.tokens.getAccessToken();
1313
+ if (!accessToken) {
1314
+ return { success: false, message: 'Not authenticated' };
1315
+ }
1316
+ try {
1317
+ const host = this.environment.apiServer.host;
1318
+ const response = await fetch(`${host}/api/account/profile`, {
1319
+ method: 'PUT',
1320
+ headers: {
1321
+ 'Content-Type': 'application/json',
1322
+ 'Authorization': `Bearer ${accessToken}`
1323
+ },
1324
+ body: JSON.stringify({ display_name: displayName })
1325
+ });
1326
+ const data = await response.json();
1327
+ if (data.status === 'ok') {
1328
+ const currentUser = this.getCurrentUser();
1329
+ if (currentUser) {
1330
+ this.updateUser({ ...currentUser, display_name: displayName });
1331
+ }
1332
+ return { success: true };
1333
+ }
1334
+ return { success: false, message: data.message || 'Profile update failed' };
1335
+ }
1336
+ catch {
1337
+ return { success: false, message: 'Network error. Please try again.' };
1338
+ }
1339
+ }
1304
1340
  getCurrentUser() {
1305
1341
  return this.userSubject.value;
1306
1342
  }
@@ -1415,7 +1451,7 @@ class AuthService {
1415
1451
  const result = await this.plugin.checkEmail(email);
1416
1452
  return result.exists ? result.user : null;
1417
1453
  }
1418
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthService, deps: [{ token: AUTH_PLUGIN }, { token: TokenService }, { token: SigninStatusService }], target: i0.ɵɵFactoryTarget.Injectable });
1454
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthService, deps: [{ token: AUTH_PLUGIN }, { token: TokenService }, { token: SigninStatusService }, { token: MyEnvironmentModel }], target: i0.ɵɵFactoryTarget.Injectable });
1419
1455
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthService, providedIn: 'root' });
1420
1456
  }
1421
1457
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AuthService, decorators: [{
@@ -1426,7 +1462,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
1426
1462
  }], ctorParameters: () => [{ type: undefined, decorators: [{
1427
1463
  type: Inject,
1428
1464
  args: [AUTH_PLUGIN]
1429
- }] }, { type: TokenService }, { type: SigninStatusService }] });
1465
+ }] }, { type: TokenService }, { type: SigninStatusService }, { type: MyEnvironmentModel }] });
1430
1466
 
1431
1467
  class ApiConnectionService {
1432
1468
  tokens;
@@ -2840,8 +2876,8 @@ class TenantLoginComponent {
2840
2876
  }
2841
2877
  }
2842
2878
 
2843
- <!-- OAuth Providers -->
2844
- @if (effectiveOauthProviders.length > 0 && !otpActive && (useOAuth || !isProviderEnabled('emailPassword'))) {
2879
+ <!-- OAuth Providers (always visible as alternative sign-in) -->
2880
+ @if (effectiveOauthProviders.length > 0) {
2845
2881
  <div class="oauth-buttons">
2846
2882
  @for (provider of effectiveOauthProviders; track provider) {
2847
2883
  <button
@@ -3121,8 +3157,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
3121
3157
  }
3122
3158
  }
3123
3159
 
3124
- <!-- OAuth Providers -->
3125
- @if (effectiveOauthProviders.length > 0 && !otpActive && (useOAuth || !isProviderEnabled('emailPassword'))) {
3160
+ <!-- OAuth Providers (always visible as alternative sign-in) -->
3161
+ @if (effectiveOauthProviders.length > 0) {
3126
3162
  <div class="oauth-buttons">
3127
3163
  @for (provider of effectiveOauthProviders; track provider) {
3128
3164
  <button