ab-ecosystem-sso 0.1.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/dist/ab-ecosystem-sso.cjs +41 -0
- package/dist/ab-ecosystem-sso.js +9923 -0
- package/dist/index.d.ts +136 -0
- package/dist/style.css +1 -0
- package/package.json +52 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** CSS class overrides for all auth component sub-elements */
|
|
5
|
+
export declare interface AuthClassNames {
|
|
6
|
+
root?: string;
|
|
7
|
+
card?: string;
|
|
8
|
+
cardHeader?: string;
|
|
9
|
+
cardContent?: string;
|
|
10
|
+
cardFooter?: string;
|
|
11
|
+
logo?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
input?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
button?: string;
|
|
17
|
+
link?: string;
|
|
18
|
+
captcha?: string;
|
|
19
|
+
legalLinks?: string;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare interface AuthComponentBaseProps {
|
|
24
|
+
projectId: string;
|
|
25
|
+
/** Pre-fetched config — skips internal fetch if provided */
|
|
26
|
+
config?: AuthConfig;
|
|
27
|
+
classNames?: AuthClassNames;
|
|
28
|
+
onSuccess?: (data: {
|
|
29
|
+
token: string;
|
|
30
|
+
user: unknown;
|
|
31
|
+
}) => void;
|
|
32
|
+
onError?: (error: Error) => void;
|
|
33
|
+
/** API base URL override */
|
|
34
|
+
apiBaseUrl?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export declare interface AuthConfig {
|
|
38
|
+
projectId: string;
|
|
39
|
+
brandLogoUrl: string | null;
|
|
40
|
+
cardLayout: CardLayoutConfig;
|
|
41
|
+
captcha: CaptchaConfig;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare interface AuthConfigContextValue {
|
|
45
|
+
config: AuthConfig | null;
|
|
46
|
+
isLoading: boolean;
|
|
47
|
+
error: Error | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare function AuthProvider({ projectId, config: externalConfig, apiBaseUrl, children, }: AuthProviderProps): JSX_2.Element;
|
|
51
|
+
|
|
52
|
+
declare interface AuthProviderProps {
|
|
53
|
+
projectId: string;
|
|
54
|
+
/** Pre-fetched config — skips API call if provided */
|
|
55
|
+
config?: AuthConfig;
|
|
56
|
+
apiBaseUrl?: string;
|
|
57
|
+
children: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare interface AuthResponse {
|
|
61
|
+
token: string;
|
|
62
|
+
user: unknown;
|
|
63
|
+
/** If true, the user must complete 2FA before getting a full token */
|
|
64
|
+
twoFactorRequired?: boolean;
|
|
65
|
+
/** Temporary token to pass to the 2FA verification endpoint */
|
|
66
|
+
twoFactorToken?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare interface CaptchaConfig {
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
provider: "recaptcha" | "hcaptcha";
|
|
72
|
+
/** reCAPTCHA version — "v2" renders a visible checkbox, "v3" runs invisibly and returns a score */
|
|
73
|
+
version?: "v2" | "v3";
|
|
74
|
+
clientId: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare interface CardLayoutConfig {
|
|
78
|
+
privacyPolicyEnabled: boolean;
|
|
79
|
+
privacyPolicyUrl?: string;
|
|
80
|
+
termsEnabled: boolean;
|
|
81
|
+
termsUrl?: string;
|
|
82
|
+
forgotPasswordEnabled: boolean;
|
|
83
|
+
signupEnabled: boolean;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export declare function ForgotPassword(props: ForgotPasswordProps): JSX_2.Element;
|
|
87
|
+
|
|
88
|
+
export declare interface ForgotPasswordProps extends AuthComponentBaseProps {
|
|
89
|
+
onBackToLogin?: () => void;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare interface ForgotPasswordRequest {
|
|
93
|
+
email: string;
|
|
94
|
+
captchaToken?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export declare function Login(props: LoginProps): JSX_2.Element;
|
|
98
|
+
|
|
99
|
+
export declare interface LoginProps extends AuthComponentBaseProps {
|
|
100
|
+
onForgotPassword?: () => void;
|
|
101
|
+
onSignupClick?: () => void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare interface LoginRequest {
|
|
105
|
+
email: string;
|
|
106
|
+
password: string;
|
|
107
|
+
captchaToken?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export declare function Signup(props: SignupProps): JSX_2.Element;
|
|
111
|
+
|
|
112
|
+
export declare interface SignupProps extends AuthComponentBaseProps {
|
|
113
|
+
onLoginClick?: () => void;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare interface SignupRequest {
|
|
117
|
+
firstName: string;
|
|
118
|
+
lastName: string;
|
|
119
|
+
email: string;
|
|
120
|
+
password: string;
|
|
121
|
+
phoneNumber?: string;
|
|
122
|
+
country?: string;
|
|
123
|
+
currency?: string;
|
|
124
|
+
captchaToken?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export declare function useAuthConfig(): AuthConfigContextValue;
|
|
128
|
+
|
|
129
|
+
export declare interface VerifyTwoFactorRequest {
|
|
130
|
+
email: string;
|
|
131
|
+
code: string;
|
|
132
|
+
/** Temporary token returned by login when 2FA is required */
|
|
133
|
+
twoFactorToken: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { }
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--PhoneInput-color--focus: #03b2cb;--PhoneInputInternationalIconPhone-opacity: .8;--PhoneInputInternationalIconGlobe-opacity: .65;--PhoneInputCountrySelect-marginRight: .35em;--PhoneInputCountrySelectArrow-width: .3em;--PhoneInputCountrySelectArrow-marginLeft: var(--PhoneInputCountrySelect-marginRight);--PhoneInputCountrySelectArrow-borderWidth: 1px;--PhoneInputCountrySelectArrow-opacity: .45;--PhoneInputCountrySelectArrow-color: currentColor;--PhoneInputCountrySelectArrow-color--focus: var(--PhoneInput-color--focus);--PhoneInputCountrySelectArrow-transform: rotate(45deg);--PhoneInputCountryFlag-aspectRatio: 1.5;--PhoneInputCountryFlag-height: 1em;--PhoneInputCountryFlag-borderWidth: 1px;--PhoneInputCountryFlag-borderColor: rgba(0,0,0,.5);--PhoneInputCountryFlag-borderColor--focus: var(--PhoneInput-color--focus);--PhoneInputCountryFlag-backgroundColor--loading: rgba(0,0,0,.1)}.PhoneInput{display:flex;align-items:center}.PhoneInputInput{flex:1;min-width:0}.PhoneInputCountryIcon{width:calc(var(--PhoneInputCountryFlag-height) * var(--PhoneInputCountryFlag-aspectRatio));height:var(--PhoneInputCountryFlag-height)}.PhoneInputCountryIcon--square{width:var(--PhoneInputCountryFlag-height)}.PhoneInputCountryIcon--border{background-color:var(--PhoneInputCountryFlag-backgroundColor--loading);box-shadow:0 0 0 var(--PhoneInputCountryFlag-borderWidth) var(--PhoneInputCountryFlag-borderColor),inset 0 0 0 var(--PhoneInputCountryFlag-borderWidth) var(--PhoneInputCountryFlag-borderColor)}.PhoneInputCountryIconImg{display:block;width:100%;height:100%}.PhoneInputInternationalIconPhone{opacity:var(--PhoneInputInternationalIconPhone-opacity)}.PhoneInputInternationalIconGlobe{opacity:var(--PhoneInputInternationalIconGlobe-opacity)}.PhoneInputCountry{position:relative;align-self:stretch;display:flex;align-items:center;margin-right:var(--PhoneInputCountrySelect-marginRight)}.PhoneInputCountrySelect{position:absolute;top:0;left:0;height:100%;width:100%;z-index:1;border:0;opacity:0;cursor:pointer}.PhoneInputCountrySelect[disabled],.PhoneInputCountrySelect[readonly]{cursor:default}.PhoneInputCountrySelectArrow{display:block;content:"";width:var(--PhoneInputCountrySelectArrow-width);height:var(--PhoneInputCountrySelectArrow-width);margin-left:var(--PhoneInputCountrySelectArrow-marginLeft);border-style:solid;border-color:var(--PhoneInputCountrySelectArrow-color);border-top-width:0;border-bottom-width:var(--PhoneInputCountrySelectArrow-borderWidth);border-left-width:0;border-right-width:var(--PhoneInputCountrySelectArrow-borderWidth);transform:var(--PhoneInputCountrySelectArrow-transform);opacity:var(--PhoneInputCountrySelectArrow-opacity)}.PhoneInputCountrySelect:focus+.PhoneInputCountryIcon+.PhoneInputCountrySelectArrow{opacity:1;color:var(--PhoneInputCountrySelectArrow-color--focus)}.PhoneInputCountrySelect:focus+.PhoneInputCountryIcon--border{box-shadow:0 0 0 var(--PhoneInputCountryFlag-borderWidth) var(--PhoneInputCountryFlag-borderColor--focus),inset 0 0 0 var(--PhoneInputCountryFlag-borderWidth) var(--PhoneInputCountryFlag-borderColor--focus)}.PhoneInputCountrySelect:focus+.PhoneInputCountryIcon .PhoneInputInternationalIconGlobe{opacity:1;color:var(--PhoneInputCountrySelectArrow-color--focus)}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ab-ecosystem-sso",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/ab-ecosystem-sso.cjs",
|
|
6
|
+
"module": "dist/ab-ecosystem-sso.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/ab-ecosystem-sso.js",
|
|
11
|
+
"require": "./dist/ab-ecosystem-sso.cjs",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./styles.css": "./dist/style.css"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build:lib": "vite build --config vite.config.lib.ts",
|
|
22
|
+
"build:remote": "vite build --config vite.config.federation.ts",
|
|
23
|
+
"build": "npm run build:lib && npm run build:remote",
|
|
24
|
+
"preview": "vite preview",
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"prepublishOnly": "npm run build:lib"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
30
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"class-variance-authority": "^0.7.1",
|
|
34
|
+
"clsx": "^2.1.1",
|
|
35
|
+
"react-phone-number-input": "^3.4.16",
|
|
36
|
+
"tailwind-merge": "^2.6.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@module-federation/vite": "^1.1.0",
|
|
40
|
+
"@tailwindcss/vite": "^4.0.0",
|
|
41
|
+
"@types/node": "^20.11.0",
|
|
42
|
+
"@types/react": "^18.2.0",
|
|
43
|
+
"@types/react-dom": "^18.2.0",
|
|
44
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
45
|
+
"react": "^18.2.0",
|
|
46
|
+
"react-dom": "^18.2.0",
|
|
47
|
+
"tailwindcss": "^4.0.0",
|
|
48
|
+
"typescript": "^5.3.0",
|
|
49
|
+
"vite": "^5.4.0",
|
|
50
|
+
"vite-plugin-dts": "^4.0.0"
|
|
51
|
+
}
|
|
52
|
+
}
|