@progalaxyelabs/ngx-stonescriptphp-client 1.6.0 → 1.8.2

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
@@ -108,6 +108,25 @@ interface AuthServerConfig {
108
108
  /** Whether this is the default server */
109
109
  default?: boolean;
110
110
  }
111
+ /**
112
+ * Configuration for a custom OAuth provider.
113
+ * Used to register custom providers via the ProviderRegistryService
114
+ * or through the environment's customProviders field.
115
+ */
116
+ interface OAuthProviderConfig {
117
+ /** Display label for the provider (e.g., "Okta") */
118
+ label: string;
119
+ /** Optional icon character or emoji to display */
120
+ icon?: string;
121
+ /** Optional CSS class to apply to the button (e.g., "btn-okta") */
122
+ cssClass?: string;
123
+ /** Optional inline button styles for custom branding */
124
+ buttonStyle?: {
125
+ borderColor?: string;
126
+ backgroundColor?: string;
127
+ color?: string;
128
+ };
129
+ }
111
130
  declare class MyEnvironmentModel {
112
131
  production: boolean;
113
132
  /**
@@ -150,6 +169,15 @@ declare class MyEnvironmentModel {
150
169
  chatServer: {
151
170
  host: string;
152
171
  };
172
+ /**
173
+ * Accounts/Authentication service server configuration
174
+ * Use this when auth is on a different server than the API
175
+ * Replaces the deprecated accountsUrl string with structured config
176
+ * @example { host: 'https://accounts.progalaxyelabs.com' }
177
+ */
178
+ accountsServer?: {
179
+ host: string;
180
+ };
153
181
  /**
154
182
  * Files service server configuration
155
183
  * Used by FilesService for file upload/download operations
@@ -163,6 +191,19 @@ declare class MyEnvironmentModel {
163
191
  * @default { mode: 'cookie', refreshEndpoint: '/auth/refresh', useCsrf: true }
164
192
  */
165
193
  auth?: AuthConfig;
194
+ /**
195
+ * Custom OAuth provider configurations.
196
+ * Register additional OAuth providers beyond the built-in ones
197
+ * (google, linkedin, apple, microsoft, github, zoho).
198
+ * @example
199
+ * ```typescript
200
+ * customProviders: {
201
+ * okta: { label: 'Sign in with Okta', cssClass: 'btn-okta', buttonStyle: { borderColor: '#007dc1' } },
202
+ * keycloak: { label: 'Sign in with Keycloak', icon: '🔑' }
203
+ * }
204
+ * ```
205
+ */
206
+ customProviders?: Record<string, OAuthProviderConfig>;
166
207
  /**
167
208
  * Branding configuration for auth components
168
209
  * Allows platforms to customize login/register pages without creating wrappers
@@ -249,7 +290,13 @@ declare class ApiConnectionService {
249
290
  static ɵprov: i0.ɵɵInjectableDeclaration<ApiConnectionService>;
250
291
  }
251
292
 
252
- type AuthProvider = 'google' | 'linkedin' | 'apple' | 'microsoft' | 'github' | 'zoho' | 'emailPassword';
293
+ type BuiltInProvider = 'google' | 'linkedin' | 'apple' | 'microsoft' | 'github' | 'zoho' | 'emailPassword';
294
+ /**
295
+ * Authentication provider identifier.
296
+ * Includes all built-in providers plus any custom string identifier.
297
+ * The (string & {}) trick preserves autocomplete for built-in values.
298
+ */
299
+ type AuthProvider = BuiltInProvider | (string & {});
253
300
  interface User {
254
301
  user_id: number;
255
302
  id: string;
@@ -670,6 +717,72 @@ declare class FilesService {
670
717
  static ɵprov: i0.ɵɵInjectableDeclaration<FilesService>;
671
718
  }
672
719
 
720
+ /**
721
+ * Service for managing OAuth provider configurations.
722
+ *
723
+ * Provides a central registry for both built-in and custom OAuth providers.
724
+ * Custom providers can be registered either through the environment configuration
725
+ * (customProviders field) or programmatically via registerProvider/registerProviders.
726
+ *
727
+ * Custom registrations take precedence over built-in defaults.
728
+ * Unknown providers receive an auto-generated fallback configuration.
729
+ */
730
+ declare class ProviderRegistryService {
731
+ private environment;
732
+ private customProviders;
733
+ constructor(environment: MyEnvironmentModel);
734
+ /**
735
+ * Register a custom OAuth provider configuration.
736
+ * If a provider with the same id already exists, it will be overwritten.
737
+ * @param id - Provider identifier (e.g., 'okta', 'auth0')
738
+ * @param config - Provider display configuration
739
+ */
740
+ registerProvider(id: string, config: OAuthProviderConfig): void;
741
+ /**
742
+ * Register multiple custom OAuth provider configurations at once.
743
+ * @param providers - Record of provider id to configuration
744
+ */
745
+ registerProviders(providers: Record<string, OAuthProviderConfig>): void;
746
+ /**
747
+ * Get the full configuration for a provider.
748
+ * Resolution order: custom registration > built-in default > auto-generated fallback.
749
+ * @param provider - Provider identifier
750
+ */
751
+ getProviderConfig(provider: string): OAuthProviderConfig;
752
+ /**
753
+ * Get the display label for a provider, formatted for sign-in context.
754
+ * @param provider - Provider identifier
755
+ * @returns Label like "Sign in with Google"
756
+ */
757
+ getLabel(provider: string): string;
758
+ /**
759
+ * Get the display label for a provider, formatted for sign-up context.
760
+ * @param provider - Provider identifier
761
+ * @returns Label like "Sign up with Google"
762
+ */
763
+ getSignupLabel(provider: string): string;
764
+ /**
765
+ * Get the icon for a provider, if configured.
766
+ * @param provider - Provider identifier
767
+ * @returns Icon string or undefined
768
+ */
769
+ getIcon(provider: string): string | undefined;
770
+ /**
771
+ * Get the CSS class for a provider button.
772
+ * @param provider - Provider identifier
773
+ * @returns CSS class string (e.g., "btn-google")
774
+ */
775
+ getCssClass(provider: string): string;
776
+ /**
777
+ * Get inline button styles for a provider, if configured.
778
+ * @param provider - Provider identifier
779
+ * @returns Style object for ngStyle binding, or null if no custom styles
780
+ */
781
+ getButtonStyle(provider: string): Record<string, string> | null;
782
+ static ɵfac: i0.ɵɵFactoryDeclaration<ProviderRegistryService, never>;
783
+ static ɵprov: i0.ɵɵInjectableDeclaration<ProviderRegistryService>;
784
+ }
785
+
673
786
  declare class NgxStoneScriptPhpClientModule {
674
787
  static forRoot(environment: MyEnvironmentModel): ModuleWithProviders<NgxStoneScriptPhpClientModule>;
675
788
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxStoneScriptPhpClientModule, never>;
@@ -692,6 +805,7 @@ interface TenantSelectedEvent {
692
805
  }
693
806
  declare class TenantLoginComponent implements OnInit {
694
807
  private auth;
808
+ private providerRegistry;
695
809
  title: string;
696
810
  providers: AuthProvider[];
697
811
  showTenantSelector: boolean;
@@ -718,11 +832,13 @@ declare class TenantLoginComponent implements OnInit {
718
832
  memberships: TenantMembership[];
719
833
  selectedTenantId: string | null;
720
834
  userName: string;
721
- constructor(auth: AuthService);
835
+ constructor(auth: AuthService, providerRegistry: ProviderRegistryService);
722
836
  ngOnInit(): void;
723
837
  isProviderEnabled(provider: AuthProvider): boolean;
724
838
  getProviderLabel(provider: AuthProvider): string;
725
839
  getProviderIcon(provider: AuthProvider): string | undefined;
840
+ getProviderCssClass(provider: AuthProvider): string;
841
+ getProviderButtonStyle(provider: AuthProvider): Record<string, string> | null;
726
842
  toggleAuthMethod(event: Event): void;
727
843
  onEmailLogin(): Promise<void>;
728
844
  onOAuthLogin(provider: AuthProvider): Promise<void>;
@@ -761,6 +877,7 @@ declare class AuthPageComponent implements OnInit {
761
877
 
762
878
  declare class LoginDialogComponent implements OnInit {
763
879
  private auth;
880
+ private providerRegistry;
764
881
  /**
765
882
  * REQUIRED: Which authentication providers to show in this dialog
766
883
  * @example ['google', 'linkedin', 'emailPassword']
@@ -772,11 +889,13 @@ declare class LoginDialogComponent implements OnInit {
772
889
  loading: boolean;
773
890
  showPassword: boolean;
774
891
  oauthProviders: AuthProvider[];
775
- constructor(auth: AuthService);
892
+ constructor(auth: AuthService, providerRegistry: ProviderRegistryService);
776
893
  ngOnInit(): void;
777
894
  isProviderEnabled(provider: AuthProvider): boolean;
778
895
  getProviderLabel(provider: AuthProvider): string;
779
896
  getProviderIcon(provider: AuthProvider): string | undefined;
897
+ getProviderCssClass(provider: AuthProvider): string;
898
+ getProviderButtonStyle(provider: AuthProvider): Record<string, string> | null;
780
899
  onEmailLogin(): Promise<void>;
781
900
  onOAuthLogin(provider: AuthProvider): Promise<void>;
782
901
  onRegisterClick(event: Event): void;
@@ -822,6 +941,7 @@ interface TenantCreatedEvent {
822
941
  }
823
942
  declare class TenantRegisterComponent implements OnInit {
824
943
  private auth;
944
+ private providerRegistry;
825
945
  title: string;
826
946
  providers: AuthProvider[];
827
947
  requireTenantName: boolean;
@@ -858,11 +978,13 @@ declare class TenantRegisterComponent implements OnInit {
858
978
  oauthProviders: AuthProvider[];
859
979
  showPassword: boolean;
860
980
  showConfirmPassword: boolean;
861
- constructor(auth: AuthService);
981
+ constructor(auth: AuthService, providerRegistry: ProviderRegistryService);
862
982
  ngOnInit(): void;
863
983
  isProviderEnabled(provider: AuthProvider): boolean;
864
984
  getProviderLabel(provider: AuthProvider): string;
865
985
  getProviderIcon(provider: AuthProvider): string | undefined;
986
+ getProviderCssClass(provider: AuthProvider): string;
987
+ getProviderButtonStyle(provider: AuthProvider): Record<string, string> | null;
866
988
  onTenantNameChange(): void;
867
989
  checkSlugAvailability(): Promise<void>;
868
990
  toggleAuthMethod(event: Event): void;
@@ -950,5 +1072,5 @@ declare class TenantRegisterDialogComponent {
950
1072
  static ɵcmp: i0.ɵɵComponentDeclaration<TenantRegisterDialogComponent, "lib-tenant-register-dialog", never, {}, {}, never, never, true, never>;
951
1073
  }
952
1074
 
953
- export { ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, NgxStoneScriptPhpClientModule, RegisterComponent, SigninStatusService, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus };
954
- export type { AuthConfig, AuthMode, AuthProvider, AuthResult, AuthServerConfig, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
1075
+ export { ApiConnectionService, ApiResponse, AuthPageComponent, AuthService, CsrfService, DbService, FilesService, LoginDialogComponent, MyEnvironmentModel, NgxStoneScriptPhpClientModule, ProviderRegistryService, RegisterComponent, SigninStatusService, TenantLoginComponent, TenantLoginDialogComponent, TenantRegisterComponent, TenantRegisterDialogComponent, TokenService, VerifyStatus };
1076
+ export type { AuthConfig, AuthMode, AuthProvider, AuthResult, AuthServerConfig, BuiltInProvider, FileDeleteResponse, FileListResponse, FileMetadata, FileUploadResponse, FileUploadResult, OAuthProviderConfig, TenantCreatedEvent, TenantMembership, TenantSelectedEvent, User };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progalaxyelabs/ngx-stonescriptphp-client",
3
- "version": "1.6.0",
3
+ "version": "1.8.2",
4
4
  "description": "Angular client library for StoneScriptPHP backend framework",
5
5
  "keywords": [
6
6
  "angular",