@progalaxyelabs/ngx-stonescriptphp-client 1.16.1 → 1.18.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
@@ -109,13 +109,6 @@ declare class MyEnvironmentModel {
109
109
  * Used for multi-tenant authentication.
110
110
  */
111
111
  platformCode: string;
112
- /**
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.
116
- * @example '//api.medstoreapp.in'
117
- */
118
- apiUrl?: string;
119
112
  apiServer: {
120
113
  host: string;
121
114
  };
@@ -234,15 +227,6 @@ interface TenantMembership {
234
227
  status: string;
235
228
  last_accessed?: string;
236
229
  }
237
- interface RegisterTenantData {
238
- tenantName: string;
239
- displayName?: string;
240
- email?: string;
241
- password?: string;
242
- provider: string;
243
- role?: string;
244
- countryCode?: string;
245
- }
246
230
  /**
247
231
  * Auth plugin interface — implement this to support any auth backend.
248
232
  *
@@ -301,8 +285,6 @@ interface AuthPlugin {
301
285
  selectTenant?(tenantId: string, accessToken: string): Promise<AuthResult>;
302
286
  /** List tenant memberships for the authenticated user */
303
287
  getTenantMemberships?(accessToken: string): Promise<TenantMembership[]>;
304
- /** Register a new tenant (organization) */
305
- registerTenant?(data: RegisterTenantData): Promise<AuthResult>;
306
288
  /** Check if a tenant slug is available */
307
289
  checkTenantSlugAvailable?(slug: string): Promise<{
308
290
  available: boolean;
@@ -310,15 +292,11 @@ interface AuthPlugin {
310
292
  }>;
311
293
  /** Check onboarding status for a user identity */
312
294
  checkOnboardingStatus?(identityId: string, platformCode?: string): Promise<any>;
313
- /** Complete tenant onboarding (create tenant with country + org name) */
314
- completeTenantOnboarding?(countryCode: string, tenantName: string, accessToken: string): Promise<any>;
315
295
  /** Check if user email exists */
316
296
  checkEmail?(email: string): Promise<{
317
297
  exists: boolean;
318
298
  user?: any;
319
299
  }>;
320
- /** Provision a new tenant for an authenticated user (post-onboarding) */
321
- provisionTenant?(storeName: string, countryCode: string, accessToken: string): Promise<any>;
322
300
  switchServer?(serverName: string): void;
323
301
  getAvailableServers?(): string[];
324
302
  getActiveServer?(): string | null;
@@ -382,11 +360,6 @@ interface StoneScriptPHPAuthConfig {
382
360
  * Defaults: mode='cookie', refreshEndpoint='/auth/refresh', useCsrf=true
383
361
  */
384
362
  auth?: Pick<AuthConfig, 'mode' | 'refreshEndpoint' | 'useCsrf' | 'csrfTokenCookieName' | 'csrfHeaderName'>;
385
- /**
386
- * Platform's own API URL for register-tenant proxy route.
387
- * Falls back to host if not set.
388
- */
389
- apiUrl?: string;
390
363
  }
391
364
  /**
392
365
  * Built-in auth plugin for StoneScriptPHP backends.
@@ -417,7 +390,6 @@ declare class StoneScriptPHPAuth implements AuthPlugin {
417
390
  private hashUUID;
418
391
  private getCsrfToken;
419
392
  private getAccountsUrl;
420
- private getPlatformApiUrl;
421
393
  private getDefaultServer;
422
394
  private restoreActiveServer;
423
395
  switchServer(serverName: string): void;
@@ -434,21 +406,57 @@ declare class StoneScriptPHPAuth implements AuthPlugin {
434
406
  loginWithProvider(provider: string): Promise<AuthResult>;
435
407
  selectTenant(tenantId: string, accessToken: string): Promise<AuthResult>;
436
408
  getTenantMemberships(accessToken: string): Promise<TenantMembership[]>;
437
- registerTenant(data: RegisterTenantData): Promise<AuthResult>;
438
- private registerTenantWithOAuth;
439
409
  checkTenantSlugAvailable(slug: string): Promise<{
440
410
  available: boolean;
441
411
  suggestion?: string;
442
412
  }>;
443
413
  checkOnboardingStatus(identityId: string, platformCode?: string): Promise<any>;
444
- completeTenantOnboarding(countryCode: string, tenantName: string, accessToken: string): Promise<any>;
445
- provisionTenant(storeName: string, countryCode: string, accessToken: string): Promise<any>;
446
414
  checkEmail(email: string): Promise<{
447
415
  exists: boolean;
448
416
  user?: any;
449
417
  }>;
450
418
  }
451
419
 
420
+ interface ProgalaxyElabsAuthConfig {
421
+ host: string;
422
+ platformCode: string;
423
+ }
424
+ /**
425
+ * Auth plugin for progalaxyelabs-auth (Rust/Axum).
426
+ *
427
+ * Speaks the Rust auth server's native format:
428
+ * - Login: { access_token, refresh_token, identity, membership, ... }
429
+ * - Tenant selection: { requires_tenant_selection, selection_token, memberships }
430
+ * - New identity: { access_token, identity, is_new_identity, memberships:[] }
431
+ * - select-tenant: Bearer header + { tenant_id } body
432
+ * - refresh: { access_token, refresh_token } body mode
433
+ */
434
+ declare class ProgalaxyElabsAuth implements AuthPlugin {
435
+ private config;
436
+ constructor(config: ProgalaxyElabsAuthConfig);
437
+ private get host();
438
+ login(email: string, password: string): Promise<AuthResult>;
439
+ register(email: string, password: string, displayName: string): Promise<AuthResult>;
440
+ logout(refreshToken?: string): Promise<void>;
441
+ checkSession(): Promise<AuthResult>;
442
+ refresh(accessToken: string, refreshToken?: string): Promise<string | null>;
443
+ selectTenant(tenantId: string, selectionToken: string): Promise<AuthResult>;
444
+ getTenantMemberships(accessToken: string): Promise<TenantMembership[]>;
445
+ checkTenantSlugAvailable(slug: string): Promise<{
446
+ available: boolean;
447
+ suggestion?: string;
448
+ }>;
449
+ checkOnboardingStatus(identityId: string, platformCode?: string): Promise<any>;
450
+ checkEmail(email: string): Promise<{
451
+ exists: boolean;
452
+ user?: any;
453
+ }>;
454
+ loginWithProvider(provider: string): Promise<AuthResult>;
455
+ private handleLoginResponse;
456
+ private toUser;
457
+ private toMembership;
458
+ }
459
+
452
460
  declare class TokenService {
453
461
  private accessToken;
454
462
  private refreshToken;
@@ -557,15 +565,6 @@ declare class AuthService {
557
565
  refresh(): Promise<boolean>;
558
566
  isAuthenticated(): boolean;
559
567
  getCurrentUser(): User | null;
560
- registerTenant(data: {
561
- tenantName: string;
562
- displayName?: string;
563
- email?: string;
564
- password?: string;
565
- provider: AuthProvider;
566
- role?: string;
567
- countryCode?: string;
568
- }): Promise<AuthResult>;
569
568
  getTenantMemberships(serverName?: string): Promise<{
570
569
  memberships: TenantMembership[];
571
570
  }>;
@@ -579,8 +578,6 @@ declare class AuthService {
579
578
  suggestion?: string;
580
579
  }>;
581
580
  checkOnboardingStatus(identityId: string, serverName?: string): Promise<any>;
582
- provisionTenant(storeName: string, countryCode?: string): Promise<any>;
583
- completeTenantOnboarding(countryCode: string, tenantName: string, serverName?: string): Promise<any>;
584
581
  getAvailableAuthServers(): string[];
585
582
  getActiveAuthServer(): string | null;
586
583
  switchAuthServer(serverName: string): void;
@@ -1007,6 +1004,14 @@ interface TenantCreatedEvent {
1007
1004
  display_name: string;
1008
1005
  };
1009
1006
  }
1007
+ interface TenantRegisterRequestEvent {
1008
+ tenantName: string;
1009
+ tenantSlug: string;
1010
+ displayName?: string;
1011
+ email?: string;
1012
+ password?: string;
1013
+ provider: string;
1014
+ }
1010
1015
  declare class TenantRegisterComponent implements OnInit {
1011
1016
  private auth;
1012
1017
  private providerRegistry;
@@ -1028,6 +1033,7 @@ declare class TenantRegisterComponent implements OnInit {
1028
1033
  loginLinkText: string;
1029
1034
  loginLinkAction: string;
1030
1035
  tenantCreated: EventEmitter<TenantCreatedEvent>;
1036
+ registerRequested: EventEmitter<TenantRegisterRequestEvent>;
1031
1037
  navigateToLogin: EventEmitter<void>;
1032
1038
  tenantName: string;
1033
1039
  tenantSlug: string;
@@ -1057,11 +1063,19 @@ declare class TenantRegisterComponent implements OnInit {
1057
1063
  checkSlugAvailability(): Promise<void>;
1058
1064
  toggleAuthMethod(event: Event): void;
1059
1065
  isFormValid(): boolean;
1060
- onOAuthRegister(provider: AuthProvider): Promise<void>;
1061
- onRegister(): Promise<void>;
1066
+ onOAuthRegister(provider: AuthProvider): void;
1067
+ onRegister(): void;
1068
+ /** Call from consuming component after handling registerRequested to show loading state */
1069
+ setLoading(loading: boolean, text?: string): void;
1070
+ /** Call from consuming component to show success/error after handling registerRequested */
1071
+ setResult(result: {
1072
+ success: boolean;
1073
+ message?: string;
1074
+ user?: any;
1075
+ }): void;
1062
1076
  onLoginClick(event: Event): void;
1063
1077
  static ɵfac: i0.ɵɵFactoryDeclaration<TenantRegisterComponent, never>;
1064
- static ɵcmp: i0.ɵɵComponentDeclaration<TenantRegisterComponent, "lib-tenant-register", never, { "title": { "alias": "title"; "required": false; }; "providers": { "alias": "providers"; "required": false; }; "requireTenantName": { "alias": "requireTenantName"; "required": false; }; "tenantSectionTitle": { "alias": "tenantSectionTitle"; "required": false; }; "tenantNameLabel": { "alias": "tenantNameLabel"; "required": false; }; "tenantNamePlaceholder": { "alias": "tenantNamePlaceholder"; "required": false; }; "tenantSlugLabel": { "alias": "tenantSlugLabel"; "required": false; }; "tenantSlugPlaceholder": { "alias": "tenantSlugPlaceholder"; "required": false; }; "urlPreviewEnabled": { "alias": "urlPreviewEnabled"; "required": false; }; "urlPreviewPrefix": { "alias": "urlPreviewPrefix"; "required": false; }; "userSectionTitle": { "alias": "userSectionTitle"; "required": false; }; "oauthDescription": { "alias": "oauthDescription"; "required": false; }; "ownershipTitle": { "alias": "ownershipTitle"; "required": false; }; "ownershipMessage": { "alias": "ownershipMessage"; "required": false; }; "submitButtonText": { "alias": "submitButtonText"; "required": false; }; "loginLinkText": { "alias": "loginLinkText"; "required": false; }; "loginLinkAction": { "alias": "loginLinkAction"; "required": false; }; }, { "tenantCreated": "tenantCreated"; "navigateToLogin": "navigateToLogin"; }, never, never, true, never>;
1078
+ static ɵcmp: i0.ɵɵComponentDeclaration<TenantRegisterComponent, "lib-tenant-register", never, { "title": { "alias": "title"; "required": false; }; "providers": { "alias": "providers"; "required": false; }; "requireTenantName": { "alias": "requireTenantName"; "required": false; }; "tenantSectionTitle": { "alias": "tenantSectionTitle"; "required": false; }; "tenantNameLabel": { "alias": "tenantNameLabel"; "required": false; }; "tenantNamePlaceholder": { "alias": "tenantNamePlaceholder"; "required": false; }; "tenantSlugLabel": { "alias": "tenantSlugLabel"; "required": false; }; "tenantSlugPlaceholder": { "alias": "tenantSlugPlaceholder"; "required": false; }; "urlPreviewEnabled": { "alias": "urlPreviewEnabled"; "required": false; }; "urlPreviewPrefix": { "alias": "urlPreviewPrefix"; "required": false; }; "userSectionTitle": { "alias": "userSectionTitle"; "required": false; }; "oauthDescription": { "alias": "oauthDescription"; "required": false; }; "ownershipTitle": { "alias": "ownershipTitle"; "required": false; }; "ownershipMessage": { "alias": "ownershipMessage"; "required": false; }; "submitButtonText": { "alias": "submitButtonText"; "required": false; }; "loginLinkText": { "alias": "loginLinkText"; "required": false; }; "loginLinkAction": { "alias": "loginLinkAction"; "required": false; }; }, { "tenantCreated": "tenantCreated"; "registerRequested": "registerRequested"; "navigateToLogin": "navigateToLogin"; }, never, never, true, never>;
1065
1079
  }
1066
1080
 
1067
1081
  /**
@@ -1140,5 +1154,5 @@ declare class TenantRegisterDialogComponent {
1140
1154
  static ɵcmp: i0.ɵɵComponentDeclaration<TenantRegisterDialogComponent, "lib-tenant-register-dialog", never, {}, {}, never, never, true, never>;
1141
1155
  }
1142
1156
 
1143
- export { AUTH_PLUGIN, ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, ProviderRegistryService, RegisterComponent, SigninStatusService, StoneScriptPHPAuth, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus, provideNgxStoneScriptPhpClient };
1144
- export type { AuthConfig, AuthMode, AuthPlugin, AuthProvider, AuthResponseMap, AuthResult, AuthServerConfig, BuiltInProvider, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, OAuthProviderConfig, OnboardingNeededEvent, RegisterTenantData, StoneScriptPHPAuthConfig, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
1157
+ export { AUTH_PLUGIN, ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, ProgalaxyElabsAuth, ProviderRegistryService, RegisterComponent, SigninStatusService, StoneScriptPHPAuth, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus, provideNgxStoneScriptPhpClient };
1158
+ export type { AuthConfig, AuthMode, AuthPlugin, AuthProvider, AuthResponseMap, AuthResult, AuthServerConfig, BuiltInProvider, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, OAuthProviderConfig, OnboardingNeededEvent, ProgalaxyElabsAuthConfig, StoneScriptPHPAuthConfig, TenantCreatedEvent, TenantMembership, TenantRegisterRequestEvent, TenantSelectedEvent, User };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progalaxyelabs/ngx-stonescriptphp-client",
3
- "version": "1.16.1",
3
+ "version": "1.18.0",
4
4
  "description": "Angular client library for StoneScriptPHP backend framework",
5
5
  "keywords": [
6
6
  "angular",