@slyxup/ui 0.2.14 → 0.3.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/components/AdminPanel/AdminPanel.d.ts.map +1 -1
- package/dist/components/AdminPanel/AdminPanel.js +214 -28
- package/dist/components/AdminPanel/AdminPanel.js.map +1 -1
- package/package.json +6 -3
- package/.turbo/turbo-build.log +0 -4
- package/CHANGELOG.md +0 -70
- package/src/components/AdminPanel/AdminPanel.tsx +0 -663
- package/src/components/BillingPortal/BillingPortal.tsx +0 -184
- package/src/components/EmailVerification/EmailVerification.tsx +0 -182
- package/src/components/ForgotPassword/ForgotPassword.tsx +0 -124
- package/src/components/PricingTable/PricingTable.tsx +0 -157
- package/src/components/ResetPassword/ResetPassword.tsx +0 -122
- package/src/components/SignIn/SignIn.tsx +0 -239
- package/src/components/SignUp/SignUp.tsx +0 -211
- package/src/components/SocialButtons/SocialButtons.tsx +0 -47
- package/src/components/UserButton/UserButton.tsx +0 -101
- package/src/components/UserProfile/UserProfile.tsx +0 -1776
- package/src/icons.tsx +0 -71
- package/src/index.ts +0 -56
- package/src/lib/paddle.ts +0 -131
- package/src/styles.ts +0 -619
- package/test/components.test.tsx +0 -135
- package/test/icons.test.tsx +0 -32
- package/test/styles.test.ts +0 -47
- package/tsconfig.json +0 -1
- package/vitest.config.ts +0 -2
package/test/components.test.tsx
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
const mockSignIn = vi.fn().mockResolvedValue({ ok: true });
|
|
6
|
-
const mockSignUp = vi.fn().mockResolvedValue({ ok: true });
|
|
7
|
-
const mockSignOut = vi.fn().mockResolvedValue({ ok: true });
|
|
8
|
-
|
|
9
|
-
vi.mock('@slyxup/react', () => ({
|
|
10
|
-
useAuth: () => ({
|
|
11
|
-
isLoaded: true,
|
|
12
|
-
isSignedIn: false,
|
|
13
|
-
userId: null,
|
|
14
|
-
client: {},
|
|
15
|
-
signIn: mockSignIn,
|
|
16
|
-
signUp: mockSignUp,
|
|
17
|
-
signOut: mockSignOut,
|
|
18
|
-
}),
|
|
19
|
-
useUser: () => ({
|
|
20
|
-
isLoaded: true,
|
|
21
|
-
isSignedIn: false,
|
|
22
|
-
user: null,
|
|
23
|
-
isSignedOut: true,
|
|
24
|
-
reload: vi.fn(),
|
|
25
|
-
}),
|
|
26
|
-
useSession: () => ({
|
|
27
|
-
isLoaded: true,
|
|
28
|
-
isSignedIn: false,
|
|
29
|
-
session: null,
|
|
30
|
-
reload: vi.fn(),
|
|
31
|
-
}),
|
|
32
|
-
}));
|
|
33
|
-
|
|
34
|
-
import { SignIn } from '../src/components/SignIn/SignIn';
|
|
35
|
-
import { SignUp } from '../src/components/SignUp/SignUp';
|
|
36
|
-
import { SocialButtons } from '../src/components/SocialButtons/SocialButtons';
|
|
37
|
-
import { UserButton } from '../src/components/UserButton/UserButton';
|
|
38
|
-
|
|
39
|
-
describe('SignIn', () => {
|
|
40
|
-
beforeEach(() => vi.clearAllMocks());
|
|
41
|
-
|
|
42
|
-
it('renders sign in heading', () => {
|
|
43
|
-
render(<SignIn />);
|
|
44
|
-
expect(screen.getByRole('heading', { name: /sign in/i })).toBeTruthy();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('renders email and password inputs', () => {
|
|
48
|
-
render(<SignIn />);
|
|
49
|
-
expect(screen.getByLabelText(/email/i)).toBeTruthy();
|
|
50
|
-
expect(screen.getByLabelText(/password/i)).toBeTruthy();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('renders submit button', () => {
|
|
54
|
-
render(<SignIn />);
|
|
55
|
-
expect(screen.getByRole('button', { name: /sign in/i })).toBeTruthy();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('shows social buttons by default', () => {
|
|
59
|
-
render(<SignIn />);
|
|
60
|
-
expect(screen.getByText(/continue with google/i)).toBeTruthy();
|
|
61
|
-
expect(screen.getByText(/continue with github/i)).toBeTruthy();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('hides social buttons when social=false', () => {
|
|
65
|
-
render(<SignIn social={false} />);
|
|
66
|
-
expect(screen.queryByText(/continue with google/i)).toBeNull();
|
|
67
|
-
expect(screen.queryByText(/continue with github/i)).toBeNull();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('calls signIn on form submit', async () => {
|
|
71
|
-
render(<SignIn />);
|
|
72
|
-
fireEvent.change(screen.getByLabelText(/email/i), { target: { value: 'a@b.com' } });
|
|
73
|
-
fireEvent.change(screen.getByLabelText(/password/i), { target: { value: '12345678' } });
|
|
74
|
-
fireEvent.click(screen.getByRole('button', { name: /sign in/i }));
|
|
75
|
-
await waitFor(() => expect(mockSignIn).toHaveBeenCalledWith({ email: 'a@b.com', password: '12345678' }));
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('shows sign up link when onSignUpClick provided', () => {
|
|
79
|
-
const onSignUp = vi.fn();
|
|
80
|
-
render(<SignIn onSignUpClick={onSignUp} />);
|
|
81
|
-
expect(screen.getByText(/sign up/i)).toBeTruthy();
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
describe('SignUp', () => {
|
|
86
|
-
beforeEach(() => vi.clearAllMocks());
|
|
87
|
-
|
|
88
|
-
it('renders create your account heading', () => {
|
|
89
|
-
render(<SignUp />);
|
|
90
|
-
expect(screen.getByRole('heading', { name: /create your account/i })).toBeTruthy();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('renders first name, email, password inputs', () => {
|
|
94
|
-
render(<SignUp />);
|
|
95
|
-
expect(screen.getByLabelText(/first name/i)).toBeTruthy();
|
|
96
|
-
expect(screen.getByLabelText(/email/i)).toBeTruthy();
|
|
97
|
-
expect(screen.getByLabelText(/password/i)).toBeTruthy();
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('shows social buttons by default', () => {
|
|
101
|
-
render(<SignUp />);
|
|
102
|
-
expect(screen.getByText(/continue with google/i)).toBeTruthy();
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
describe('SocialButtons', () => {
|
|
107
|
-
beforeEach(() => vi.clearAllMocks());
|
|
108
|
-
|
|
109
|
-
it('renders both providers by default', () => {
|
|
110
|
-
render(<SocialButtons />);
|
|
111
|
-
expect(screen.getByText(/continue with google/i)).toBeTruthy();
|
|
112
|
-
expect(screen.getByText(/continue with github/i)).toBeTruthy();
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('renders only specified providers', () => {
|
|
116
|
-
render(<SocialButtons providers={['google']} />);
|
|
117
|
-
expect(screen.getByText(/continue with google/i)).toBeTruthy();
|
|
118
|
-
expect(screen.queryByText(/continue with github/i)).toBeNull();
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
describe('UserButton', () => {
|
|
123
|
-
beforeEach(() => vi.clearAllMocks());
|
|
124
|
-
|
|
125
|
-
it('renders avatar', () => {
|
|
126
|
-
render(<UserButton />);
|
|
127
|
-
expect(screen.getByRole('button', { name: /account menu/i })).toBeTruthy();
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('opens dropdown on click', async () => {
|
|
131
|
-
render(<UserButton />);
|
|
132
|
-
fireEvent.click(screen.getByRole('button', { name: /account menu/i }));
|
|
133
|
-
await waitFor(() => expect(screen.getByText(/sign out/i)).toBeTruthy());
|
|
134
|
-
});
|
|
135
|
-
});
|
package/test/icons.test.tsx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { KeyholeMark, GoogleIcon, GitHubIcon, CheckIcon } from '../src/icons';
|
|
5
|
-
|
|
6
|
-
describe('KeyholeMark', () => {
|
|
7
|
-
it('renders an SVG', () => {
|
|
8
|
-
const { container } = render(<KeyholeMark />);
|
|
9
|
-
expect(container.querySelector('svg')).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
describe('GoogleIcon', () => {
|
|
14
|
-
it('renders an SVG', () => {
|
|
15
|
-
const { container } = render(<GoogleIcon />);
|
|
16
|
-
expect(container.querySelector('svg')).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('GitHubIcon', () => {
|
|
21
|
-
it('renders an SVG', () => {
|
|
22
|
-
const { container } = render(<GitHubIcon />);
|
|
23
|
-
expect(container.querySelector('svg')).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe('CheckIcon', () => {
|
|
28
|
-
it('renders an SVG', () => {
|
|
29
|
-
const { container } = render(<CheckIcon />);
|
|
30
|
-
expect(container.querySelector('svg')).toBeTruthy();
|
|
31
|
-
});
|
|
32
|
-
});
|
package/test/styles.test.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { CSS, injectStyles } from '../src/styles';
|
|
3
|
-
|
|
4
|
-
describe('CSS', () => {
|
|
5
|
-
it('is a non-empty string', () => {
|
|
6
|
-
expect(typeof CSS).toBe('string');
|
|
7
|
-
expect(CSS.length).toBeGreaterThan(0);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('contains .slyxup-root', () => {
|
|
11
|
-
expect(CSS).toContain('.slyxup-root');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('contains --slx-accent', () => {
|
|
15
|
-
expect(CSS).toContain('--slx-accent');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('contains dark mode media query', () => {
|
|
19
|
-
expect(CSS).toContain('prefers-color-scheme: dark');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('contains @keyframes slx-shake', () => {
|
|
23
|
-
expect(CSS).toContain('@keyframes slx-shake');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('contains @keyframes slx-spin', () => {
|
|
27
|
-
expect(CSS).toContain('@keyframes slx-spin');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('contains prefers-reduced-motion', () => {
|
|
31
|
-
expect(CSS).toContain('prefers-reduced-motion');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('contains card styles', () => {
|
|
35
|
-
expect(CSS).toContain('.slx-card');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('contains button styles', () => {
|
|
39
|
-
expect(CSS).toContain('.slx-btn');
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('injectStyles', () => {
|
|
44
|
-
it('is a function', () => {
|
|
45
|
-
expect(typeof injectStyles).toBe('function');
|
|
46
|
-
});
|
|
47
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "dist", "rootDir": "src", "jsx": "react-jsx", "lib": ["ES2022", "DOM", "DOM.Iterable"], "moduleResolution": "bundler" }, "include": ["src"] }
|
package/vitest.config.ts
DELETED