@a-tech.jo/auth-sdk 1.0.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.
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { AuthClient } from "./client";
3
+ import { AuthConfig, AuthResponse, LoginPayload, RegisterPayload } from "./types";
4
+ interface AuthContextType {
5
+ client: AuthClient;
6
+ token: string | null;
7
+ user: any | null;
8
+ login: (payload: LoginPayload) => Promise<AuthResponse>;
9
+ register: (payload: RegisterPayload) => Promise<AuthResponse>;
10
+ logout: () => void;
11
+ isAuthenticated: boolean;
12
+ isExpired: boolean;
13
+ }
14
+ export declare const AuthProvider: React.FC<{
15
+ config?: AuthConfig;
16
+ children: React.ReactNode;
17
+ }>;
18
+ export declare const useAuth: () => AuthContextType;
19
+ export {};
20
+ //# sourceMappingURL=AuthContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthContext.d.ts","sourceRoot":"","sources":["../src/AuthContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkE,MAAM,OAAO,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAElF,UAAU,eAAe;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IACxD,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9D,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;CACtB;AA2BD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CA4EA,CAAC;AAEF,eAAO,MAAM,OAAO,uBAMnB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { CompleteSDKConfig } from "./config";
2
+ import { SDKOptions, LoginPayload, RegisterPayload, ForgotPasswordPayload, ResetPasswordPayload, AuthResponse } from "./types";
3
+ export declare class AuthClient {
4
+ config: CompleteSDKConfig;
5
+ constructor(options?: SDKOptions);
6
+ private request;
7
+ login(payload: LoginPayload): Promise<AuthResponse>;
8
+ register(payload: RegisterPayload): Promise<AuthResponse>;
9
+ forgotPassword(payload: ForgotPasswordPayload): Promise<AuthResponse>;
10
+ resetPassword(payload: ResetPasswordPayload): Promise<AuthResponse>;
11
+ }
12
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EACH,UAAU,EACV,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACf,MAAM,SAAS,CAAC;AAEjB,qBAAa,UAAU;IACZ,MAAM,EAAE,iBAAiB,CAAC;gBAErB,OAAO,GAAE,UAAe;YAItB,OAAO;IAiBf,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAInD,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAIzD,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIrE,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC;CAI5E"}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ export type AuthMode = "login" | "register" | "forgot-password";
3
+ export interface AuthContainerProps {
4
+ /** Initial view mode to render */
5
+ initialMode?: AuthMode;
6
+ /** Callback fired upon successful authentication */
7
+ onSuccess?: () => void;
8
+ /** Custom CSS class passed to container */
9
+ className?: string;
10
+ /** Custom subtitle banner override */
11
+ ssoMessage?: string;
12
+ }
13
+ export declare const SDKAuthContainer: React.FC<AuthContainerProps>;
14
+ //# sourceMappingURL=AuthContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthContainer.d.ts","sourceRoot":"","sources":["../../src/components/AuthContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,iBAAiB,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IAC/B,kCAAkC;IAClC,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwCzD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export interface ForgotPasswordFormProps {
3
+ onSuccess?: () => void;
4
+ onLoginClick?: () => void;
5
+ className?: string;
6
+ }
7
+ export declare const SDKForgotPasswordForm: React.FC<ForgotPasswordFormProps>;
8
+ //# sourceMappingURL=ForgotPasswordForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForgotPasswordForm.d.ts","sourceRoot":"","sources":["../../src/components/ForgotPasswordForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,MAAM,WAAW,uBAAuB;IACpC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA4HnE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export interface LoginFormProps {
3
+ onSuccess?: () => void;
4
+ onForgotPasswordClick?: () => void;
5
+ onRegisterClick?: () => void;
6
+ className?: string;
7
+ }
8
+ export declare const SDKLoginForm: React.FC<LoginFormProps>;
9
+ //# sourceMappingURL=LoginForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoginForm.d.ts","sourceRoot":"","sources":["../../src/components/LoginForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,MAAM,WAAW,cAAc;IAC3B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAsGjD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ export interface CountryOption {
3
+ id: number;
4
+ name: string;
5
+ phoneCode?: string;
6
+ nameIso2?: string;
7
+ }
8
+ export interface RegisterFormProps {
9
+ onSuccess?: () => void;
10
+ onLoginClick?: () => void;
11
+ className?: string;
12
+ }
13
+ export declare const SDKRegisterForm: React.FC<RegisterFormProps>;
14
+ //# sourceMappingURL=RegisterForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegisterForm.d.ts","sourceRoot":"","sources":["../../src/components/RegisterForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAK3D,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAC9B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0UvD,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { AuthEnvironment, EndpointConfig, StorageKeys, ThemeConfig, SDKOptions } from "./types";
2
+ /**
3
+ * Built-in default environment base URLs
4
+ */
5
+ export declare const DEFAULT_ENVIRONMENT_URLS: Record<AuthEnvironment, string>;
6
+ /**
7
+ * Default API endpoints
8
+ */
9
+ export declare const DEFAULT_ENDPOINTS: EndpointConfig;
10
+ /**
11
+ * Default LocalStorage Keys
12
+ */
13
+ export declare const DEFAULT_STORAGE_KEYS: StorageKeys;
14
+ /**
15
+ * Default Theme Color Palette
16
+ */
17
+ export declare const DEFAULT_THEME: Required<ThemeConfig>;
18
+ /**
19
+ * Complete Default SDK Configuration Object
20
+ */
21
+ export declare const DEFAULT_SDK_CONFIG: {
22
+ environment: AuthEnvironment;
23
+ environmentUrls: Record<AuthEnvironment, string>;
24
+ endpoints: EndpointConfig;
25
+ storageKeys: StorageKeys;
26
+ theme: Required<ThemeConfig>;
27
+ brand: {
28
+ logoUrl: string;
29
+ companyName: string;
30
+ };
31
+ };
32
+ /**
33
+ * Resolves full SDK configuration by merging defaults with user options
34
+ */
35
+ export declare function getSDKConfig(options?: SDKOptions): {
36
+ environment: AuthEnvironment;
37
+ baseUrl: string;
38
+ endpoints: {
39
+ login: string;
40
+ register: string;
41
+ forgotPassword: string;
42
+ resetPassword: string;
43
+ refreshToken: string;
44
+ me: string;
45
+ };
46
+ storageKeys: {
47
+ accessToken: string;
48
+ refreshToken: string;
49
+ };
50
+ theme: {
51
+ primary: string;
52
+ navy: string;
53
+ pink: string;
54
+ bg: string;
55
+ };
56
+ brand: {
57
+ logoUrl: string;
58
+ companyName: string;
59
+ };
60
+ onSuccess: ((data: any) => void) | undefined;
61
+ onError: ((error: Error) => void) | undefined;
62
+ };
63
+ export type CompleteSDKConfig = ReturnType<typeof getSDKConfig>;
64
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,cAAc,EACd,WAAW,EACX,WAAW,EACX,UAAU,EACb,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAIpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAO/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAGlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAK/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;iBACE,eAAe;;;;;;;;;CAS/C,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,UAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCpD;AAED,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./types";
2
+ export * from "./config";
3
+ export * from "./client";
4
+ export * from "./AuthContext";
5
+ export * from "./components/AuthContainer";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAA"}