@slyxup/ui 0.1.0 → 0.2.1
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/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/components/BillingPortal/BillingPortal.d.ts +22 -0
- package/dist/components/BillingPortal/BillingPortal.d.ts.map +1 -0
- package/dist/components/BillingPortal/BillingPortal.js +59 -0
- package/dist/components/BillingPortal/BillingPortal.js.map +1 -0
- package/dist/components/EmailVerification/EmailVerification.d.ts +9 -0
- package/dist/components/EmailVerification/EmailVerification.d.ts.map +1 -0
- package/dist/components/EmailVerification/EmailVerification.js +72 -0
- package/dist/components/EmailVerification/EmailVerification.js.map +1 -0
- package/dist/components/ForgotPassword/ForgotPassword.d.ts +8 -0
- package/dist/components/ForgotPassword/ForgotPassword.d.ts.map +1 -0
- package/dist/components/ForgotPassword/ForgotPassword.js +43 -0
- package/dist/components/ForgotPassword/ForgotPassword.js.map +1 -0
- package/dist/components/PricingTable/PricingTable.d.ts +19 -0
- package/dist/components/PricingTable/PricingTable.d.ts.map +1 -0
- package/dist/components/PricingTable/PricingTable.js +52 -0
- package/dist/components/PricingTable/PricingTable.js.map +1 -0
- package/dist/components/ResetPassword/ResetPassword.d.ts +9 -0
- package/dist/components/ResetPassword/ResetPassword.d.ts.map +1 -0
- package/dist/components/ResetPassword/ResetPassword.js +50 -0
- package/dist/components/ResetPassword/ResetPassword.js.map +1 -0
- package/dist/components/SignIn/SignIn.d.ts +11 -0
- package/dist/components/SignIn/SignIn.d.ts.map +1 -0
- package/dist/components/SignIn/SignIn.js +53 -0
- package/dist/components/SignIn/SignIn.js.map +1 -0
- package/dist/components/SignUp/SignUp.d.ts +8 -0
- package/dist/components/SignUp/SignUp.d.ts.map +1 -0
- package/dist/components/SignUp/SignUp.js +54 -0
- package/dist/components/SignUp/SignUp.js.map +1 -0
- package/dist/components/SocialButtons/SocialButtons.d.ts +9 -0
- package/dist/components/SocialButtons/SocialButtons.d.ts.map +1 -0
- package/dist/components/SocialButtons/SocialButtons.js +16 -0
- package/dist/components/SocialButtons/SocialButtons.js.map +1 -0
- package/dist/components/UserButton/UserButton.d.ts +3 -0
- package/dist/components/UserButton/UserButton.d.ts.map +1 -0
- package/dist/components/UserButton/UserButton.js +43 -0
- package/dist/components/UserButton/UserButton.js.map +1 -0
- package/dist/components/UserProfile/UserProfile.d.ts +3 -0
- package/dist/components/UserProfile/UserProfile.d.ts.map +1 -0
- package/dist/components/UserProfile/UserProfile.js +38 -0
- package/dist/components/UserProfile/UserProfile.js.map +1 -0
- package/dist/icons.d.ts +6 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +15 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.d.ts +9 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +219 -0
- package/dist/styles.js.map +1 -0
- package/package.json +35 -3
- package/src/components/BillingPortal/BillingPortal.tsx +182 -0
- package/src/components/EmailVerification/EmailVerification.tsx +180 -0
- package/src/components/ForgotPassword/ForgotPassword.tsx +122 -0
- package/src/components/PricingTable/PricingTable.tsx +155 -0
- package/src/components/ResetPassword/ResetPassword.tsx +120 -0
- package/src/components/SignIn/SignIn.tsx +168 -0
- package/src/components/SignUp/SignUp.tsx +181 -0
- package/src/components/SocialButtons/SocialButtons.tsx +39 -0
- package/src/components/UserButton/UserButton.tsx +89 -0
- package/src/components/UserProfile/UserProfile.tsx +93 -0
- package/src/icons.tsx +71 -0
- package/src/index.ts +37 -1
- package/src/styles.ts +221 -0
- package/test/components.test.tsx +135 -0
- package/test/icons.test.tsx +32 -0
- package/test/styles.test.ts +47 -0
- package/vitest.config.ts +2 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @slyxup/ui
|
|
2
|
+
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2011599`](https://github.com/slyxup/stack/commit/2011599a9c989560e34bcea3147c18923e15962d) - UI polish: black buttons in light mode, better card vs page contrast, inline missing-key banner in SignIn/SignUp, provider warns on missing publishableKey.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`2011599`](https://github.com/slyxup/stack/commit/2011599a9c989560e34bcea3147c18923e15962d), [`2011599`](https://github.com/slyxup/stack/commit/2011599a9c989560e34bcea3147c18923e15962d)]:
|
|
10
|
+
- @slyxup/core@0.2.1
|
|
11
|
+
- @slyxup/react@0.2.1
|
|
12
|
+
|
|
13
|
+
## 0.2.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [`7cf24ff`](https://github.com/slyxup/stack/commit/7cf24ffe37fe6f2bca41fdc0281618c2db02b3ae) - Full V1 SDKs: SlyxupClient with cookie jar, React provider + hooks, Next.js server helpers/middleware, themed UI components, slyxup CLI
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`44da26b`](https://github.com/slyxup/stack/commit/44da26bd8f952b6fce4b67f75ddb0ef041a984ac) - ci: verify all packages CI/CD — little change in every package + auth/stack/billing
|
|
22
|
+
|
|
23
|
+
- [`fe4f8bb`](https://github.com/slyxup/stack/commit/fe4f8bb4ab412a58303f59921548d3625b0675c9) - ci: second verify all — 14:55
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`44da26b`](https://github.com/slyxup/stack/commit/44da26bd8f952b6fce4b67f75ddb0ef041a984ac), [`fe4f8bb`](https://github.com/slyxup/stack/commit/fe4f8bb4ab412a58303f59921548d3625b0675c9), [`7cf24ff`](https://github.com/slyxup/stack/commit/7cf24ffe37fe6f2bca41fdc0281618c2db02b3ae)]:
|
|
26
|
+
- @slyxup/core@0.2.0
|
|
27
|
+
- @slyxup/react@0.2.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SlyxUp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @slyxup/ui
|
|
2
|
+
|
|
3
|
+
Prebuilt, themeable auth components — sign-in cards, user button, password flows. Built on [`@slyxup/react`](../react). **Zero CSS dependencies** — styles are self-contained and injected once.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @slyxup/ui @slyxup/react @slyxup/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> Peer: `react ^18 || ^19`
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
Inject the stylesheet once at your app root:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { SlyxUpProvider } from '@slyxup/react';
|
|
19
|
+
import { SlyxUpStyles } from '@slyxup/ui';
|
|
20
|
+
|
|
21
|
+
<SlyxUpProvider publishableKey="pk_test_xxx">
|
|
22
|
+
<SlyxUpStyles />
|
|
23
|
+
<App />
|
|
24
|
+
</SlyxUpProvider>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
(Components also auto-inject on first mount if you skip this.)
|
|
28
|
+
|
|
29
|
+
## Components
|
|
30
|
+
|
|
31
|
+
### `<SignIn />` / `<SignUp />`
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { SignIn, SignUp } from '@slyxup/ui';
|
|
35
|
+
|
|
36
|
+
<SignIn
|
|
37
|
+
social // show Google/GitHub buttons (default true)
|
|
38
|
+
onSuccess={() => router.push('/dashboard')}
|
|
39
|
+
onSignUpClick={() => setMode('sign-up')}
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<SignUp onSignInClick={() => setMode('sign-in')} />
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `<UserButton />` — avatar + dropdown
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { UserButton } from '@slyxup/ui';
|
|
49
|
+
|
|
50
|
+
<header>
|
|
51
|
+
<UserButton /> {/* gradient initials avatar → menu: profile, sign out */}
|
|
52
|
+
</header>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Renders nothing until loaded; shows initials or avatar image.
|
|
56
|
+
|
|
57
|
+
### `<UserProfile />`
|
|
58
|
+
|
|
59
|
+
Edit first/last name and avatar URL with inline save confirmation.
|
|
60
|
+
|
|
61
|
+
### Password flows
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<ForgotPassword onBackToSignIn={...} />
|
|
65
|
+
<ResetPassword token={searchParams.token} onSuccess={...} />
|
|
66
|
+
<EmailVerification token={searchParams.token} />
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`ForgotPassword` always shows a neutral success state (never reveals whether an account exists). `EmailVerification` auto-verifies from the emailed token and offers a resend form otherwise.
|
|
70
|
+
|
|
71
|
+
### `<SocialButtons />`
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<SocialButtons providers={['google', 'github']} basePath="/v1/oauth" />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Redirects to the hosted OAuth flow.
|
|
78
|
+
|
|
79
|
+
## Theming
|
|
80
|
+
|
|
81
|
+
Override CSS variables on any wrapper — light/dark is automatic via `prefers-color-scheme`, force dark with `slyxup-dark`, force light with `slyxup-light`.
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
.slyxup-root {
|
|
85
|
+
--slx-accent: #e8562a; /* your brand color */
|
|
86
|
+
--slx-radius: 16px;
|
|
87
|
+
--slx-font: "Inter", sans-serif;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
| Variable | Default (light) |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `--slx-accent` | `#5b5bd6` |
|
|
94
|
+
| `--slx-bg` | `#ffffff` |
|
|
95
|
+
| `--slx-ink` | `#16161d` |
|
|
96
|
+
| `--slx-muted` | `#6f6f7b` |
|
|
97
|
+
| `--slx-border` | `#e6e6ec` |
|
|
98
|
+
| `--slx-danger` | `#d64550` |
|
|
99
|
+
| `--slx-radius` | `12px` |
|
|
100
|
+
|
|
101
|
+
Accessibility built in: labeled fields, visible focus rings, `prefers-reduced-motion` respected, semantic buttons throughout.
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT © [SlyxUp](https://github.com/slyxup/stack)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface Subscription {
|
|
2
|
+
id: string;
|
|
3
|
+
status: string;
|
|
4
|
+
currentPeriodEnd: string | null;
|
|
5
|
+
cancelAtPeriodEnd: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface Invoice {
|
|
8
|
+
id: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
status: 'paid' | 'pending' | 'overdue' | 'refunded';
|
|
12
|
+
billedAt: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface BillingPortalProps {
|
|
15
|
+
subscription: Subscription | null;
|
|
16
|
+
invoices: Invoice[];
|
|
17
|
+
onCancel?: () => void;
|
|
18
|
+
}
|
|
19
|
+
/** Current plan + invoices table */
|
|
20
|
+
export declare function BillingPortal({ subscription, invoices, onCancel, }: BillingPortalProps): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=BillingPortal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BillingPortal.d.ts","sourceRoot":"","sources":["../../../src/components/BillingPortal/BillingPortal.tsx"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AACD,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IACpD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,oCAAoC;AACpC,wBAAgB,aAAa,CAAC,EAC5B,YAAY,EACZ,QAAQ,EACR,QAAQ,GACT,EAAE,kBAAkB,+BAwJpB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/** Current plan + invoices table */
|
|
4
|
+
export function BillingPortal({ subscription, invoices, onCancel, }) {
|
|
5
|
+
if (!subscription) {
|
|
6
|
+
return (_jsxs("div", { className: "slx-card", children: [_jsx("h3", { style: { fontSize: 16, fontWeight: 600 }, children: "No active subscription" }), _jsx("p", { style: { fontSize: 13.5, color: 'var(--slx-muted)', marginTop: 6 }, children: "You don't have a subscription yet. Choose a plan to get started." })] }));
|
|
7
|
+
}
|
|
8
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 18 }, children: [_jsx("div", { className: "slx-card", children: _jsxs("div", { style: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
justifyContent: 'space-between',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
}, children: [_jsxs("div", { children: [_jsx("h3", { style: { fontSize: 15, fontWeight: 600 }, children: "Current plan" }), _jsxs("p", { style: { fontSize: 13, color: 'var(--slx-muted)', marginTop: 4 }, children: ["Status:", ' ', _jsx("span", { style: {
|
|
13
|
+
fontWeight: 650,
|
|
14
|
+
color: subscription.status === 'active' ||
|
|
15
|
+
subscription.status === 'trialing'
|
|
16
|
+
? '#34d399'
|
|
17
|
+
: subscription.status === 'past_due'
|
|
18
|
+
? 'var(--slx-danger)'
|
|
19
|
+
: 'var(--slx-muted)',
|
|
20
|
+
}, children: subscription.status })] }), subscription.currentPeriodEnd && (_jsxs("p", { style: {
|
|
21
|
+
fontSize: 12.5,
|
|
22
|
+
color: 'var(--slx-muted)',
|
|
23
|
+
marginTop: 4,
|
|
24
|
+
}, children: ["Renews", ' ', new Date(subscription.currentPeriodEnd).toLocaleDateString(), subscription.cancelAtPeriodEnd
|
|
25
|
+
? ' (cancels at period end)'
|
|
26
|
+
: ''] }))] }), subscription.status !== 'canceled' &&
|
|
27
|
+
!subscription.cancelAtPeriodEnd &&
|
|
28
|
+
onCancel && (_jsx("button", { type: "button", onClick: onCancel, style: {
|
|
29
|
+
fontSize: 13,
|
|
30
|
+
fontWeight: 550,
|
|
31
|
+
background: 'transparent',
|
|
32
|
+
border: '1px solid var(--slx-border)',
|
|
33
|
+
borderRadius: 'var(--slx-radius)',
|
|
34
|
+
padding: '8px 14px',
|
|
35
|
+
cursor: 'pointer',
|
|
36
|
+
color: 'var(--slx-danger)',
|
|
37
|
+
}, children: "Cancel" }))] }) }), invoices.length > 0 && (_jsxs("div", { className: "slx-card", children: [_jsx("h3", { style: { fontSize: 15, fontWeight: 600, marginBottom: 12 }, children: "Invoices" }), _jsxs("table", { style: { width: '100%', fontSize: 13, borderCollapse: 'collapse' }, children: [_jsx("thead", { children: _jsxs("tr", { style: {
|
|
38
|
+
borderBottom: '1px solid var(--slx-border)',
|
|
39
|
+
textAlign: 'left',
|
|
40
|
+
}, children: [_jsx("th", { style: { padding: '6px 0', fontWeight: 550 }, children: "Date" }), _jsx("th", { style: { padding: '6px 0', fontWeight: 550 }, children: "Amount" }), _jsx("th", { style: { padding: '6px 0', fontWeight: 550 }, children: "Status" })] }) }), _jsx("tbody", { children: invoices.map((inv) => (_jsxs("tr", { style: { borderBottom: '1px solid var(--slx-border)' }, children: [_jsx("td", { style: { padding: '8px 0' }, children: inv.billedAt
|
|
41
|
+
? new Date(inv.billedAt).toLocaleDateString()
|
|
42
|
+
: '—' }), _jsxs("td", { style: { padding: '8px 0' }, children: ["$", (inv.amount / 100).toFixed(2), " ", inv.currency] }), _jsx("td", { style: { padding: '8px 0' }, children: _jsx("span", { style: {
|
|
43
|
+
fontSize: 11.5,
|
|
44
|
+
fontWeight: 600,
|
|
45
|
+
padding: '2px 8px',
|
|
46
|
+
borderRadius: 999,
|
|
47
|
+
background: inv.status === 'paid'
|
|
48
|
+
? 'rgba(52,211,153,.1)'
|
|
49
|
+
: inv.status === 'overdue'
|
|
50
|
+
? 'rgba(214,69,80,.1)'
|
|
51
|
+
: 'rgba(108,108,232,.08)',
|
|
52
|
+
color: inv.status === 'paid'
|
|
53
|
+
? '#34d399'
|
|
54
|
+
: inv.status === 'overdue'
|
|
55
|
+
? 'var(--slx-danger)'
|
|
56
|
+
: 'var(--slx-accent)',
|
|
57
|
+
}, children: inv.status }) })] }, inv.id))) })] })] }))] }));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=BillingPortal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BillingPortal.js","sourceRoot":"","sources":["../../../src/components/BillingPortal/BillingPortal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAwBb,oCAAoC;AACpC,MAAM,UAAU,aAAa,CAAC,EAC5B,YAAY,EACZ,QAAQ,EACR,QAAQ,GACW;IACnB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,CACL,eAAK,SAAS,EAAC,UAAU,aACvB,aAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,uCAEvC,EACL,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,CAAC,EAAE,iFAEjE,IACA,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE,aAE/D,cAAK,SAAS,EAAC,UAAU,YACvB,eACE,KAAK,EAAE;wBACL,OAAO,EAAE,MAAM;wBACf,cAAc,EAAE,eAAe;wBAC/B,UAAU,EAAE,QAAQ;qBACrB,aAED,0BACE,aAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,6BAAmB,EAC/D,aACE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,k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AC,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS;4DACxB,CAAC,CAAC,oBAAoB;4DACtB,CAAC,CAAC,uBAAuB;oDAC/B,KAAK,EACH,GAAG,CAAC,MAAM,KAAK,MAAM;wDACnB,CAAC,CAAC,SAAS;wDACX,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS;4DACxB,CAAC,CAAC,mBAAmB;4DACrB,CAAC,CAAC,mBAAmB;iDAC5B,YAEA,GAAG,CAAC,MAAM,GACN,GACJ,KAlCA,GAAG,CAAC,EAAE,CAmCR,CACN,CAAC,GACI,IACF,IACJ,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface EmailVerificationProps {
|
|
2
|
+
/** Verification token (from email link ?token=...). If absent, shows resend form. */
|
|
3
|
+
token?: string;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
}
|
|
7
|
+
/** Verify an email with the emailed token, or request a new link. */
|
|
8
|
+
export declare function EmailVerification({ token, apiUrl, onSuccess, }: EmailVerificationProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=EmailVerification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailVerification.d.ts","sourceRoot":"","sources":["../../../src/components/EmailVerification/EmailVerification.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACrC,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,MAAM,EACN,SAAS,GACV,EAAE,sBAAsB,+BAoKxB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { CheckIcon, KeyholeMark } from '../../icons';
|
|
4
|
+
/** Verify an email with the emailed token, or request a new link. */
|
|
5
|
+
export function EmailVerification({ token, apiUrl, onSuccess, }) {
|
|
6
|
+
const [status, setStatus] = useState(token ? 'verifying' : 'resend');
|
|
7
|
+
const [message, setMessage] = useState('');
|
|
8
|
+
const [email, setEmail] = useState('');
|
|
9
|
+
const [busy, setBusy] = useState(false);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!token)
|
|
12
|
+
return;
|
|
13
|
+
let cancelled = false;
|
|
14
|
+
(async () => {
|
|
15
|
+
try {
|
|
16
|
+
const base = (apiUrl ??
|
|
17
|
+
process.env.NEXT_PUBLIC_SLYXUP_API_URL ??
|
|
18
|
+
'https://auth.slyxup.online').replace(/\/$/, '');
|
|
19
|
+
const res = await fetch(`${base}/v1/verification/verify`, {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
headers: { 'Content-Type': 'application/json' },
|
|
22
|
+
body: JSON.stringify({ token }),
|
|
23
|
+
});
|
|
24
|
+
if (cancelled)
|
|
25
|
+
return;
|
|
26
|
+
if (res.ok) {
|
|
27
|
+
setStatus('success');
|
|
28
|
+
setTimeout(() => onSuccess?.(), 1800);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const data = await res
|
|
32
|
+
.json()
|
|
33
|
+
.catch(() => ({ error: 'Invalid or expired link' }));
|
|
34
|
+
setMessage(data.error ?? 'Invalid or expired link');
|
|
35
|
+
setStatus('error');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
if (!cancelled) {
|
|
40
|
+
setMessage('Network problem. Try again.');
|
|
41
|
+
setStatus('error');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
return () => {
|
|
46
|
+
cancelled = true;
|
|
47
|
+
};
|
|
48
|
+
}, [token, apiUrl, onSuccess]);
|
|
49
|
+
async function resend(e) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
setBusy(true);
|
|
52
|
+
try {
|
|
53
|
+
const base = (apiUrl ??
|
|
54
|
+
process.env.NEXT_PUBLIC_SLYXUP_API_URL ??
|
|
55
|
+
'https://auth.slyxup.online').replace(/\/$/, '');
|
|
56
|
+
await fetch(`${base}/v1/verification/resend`, {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: { 'Content-Type': 'application/json' },
|
|
59
|
+
body: JSON.stringify({ email }),
|
|
60
|
+
});
|
|
61
|
+
setMessage('If that account exists, a new verification link is on its way.');
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
setMessage('Network problem. Try again.');
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
setBusy(false);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return (_jsxs("div", { className: "slx-card", children: [_jsx("div", { className: "slx-mark", children: _jsx(KeyholeMark, {}) }), status === 'verifying' && (_jsxs(_Fragment, { children: [_jsx("h1", { className: "slx-title", children: "Verifying your email\u2026" }), _jsx("p", { className: "slx-subtitle", children: "One moment while we confirm." })] })), status === 'success' && (_jsxs(_Fragment, { children: [_jsx("div", { className: "slx-success-icon", children: _jsx(CheckIcon, {}) }), _jsx("h1", { className: "slx-title", style: { textAlign: 'center' }, children: "Email verified" }), _jsx("p", { className: "slx-subtitle", style: { textAlign: 'center' }, children: "You're all set. Redirecting\u2026" })] })), status === 'error' && (_jsxs(_Fragment, { children: [_jsx("h1", { className: "slx-title", children: "Link didn't work" }), message && (_jsx("p", { className: "slx-error-text", role: "alert", children: message })), _jsx("p", { className: "slx-subtitle", children: "Request a fresh link below." }), _jsxs("form", { onSubmit: resend, children: [_jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-verify-email", children: "Email" }), _jsx("input", { id: "slx-verify-email", className: "slx-input", type: "email", placeholder: "you@example.com", value: email, onChange: (e) => setEmail(e.target.value), required: true })] }), _jsxs("button", { className: "slx-btn", type: "submit", disabled: busy, children: [busy && _jsx("span", { className: "slx-spinner", "aria-hidden": "true" }), busy ? 'Sending…' : 'Resend verification email'] })] })] })), status === 'resend' && (_jsxs(_Fragment, { children: [_jsx("h1", { className: "slx-title", children: "Verify your email" }), _jsx("p", { className: "slx-subtitle", children: "Enter your email and we'll send a verification link." }), message && (_jsx("p", { className: "slx-hint", style: { marginBottom: 12 }, children: message })), _jsxs("form", { onSubmit: resend, children: [_jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-verify-email2", children: "Email" }), _jsx("input", { id: "slx-verify-email2", className: "slx-input", type: "email", placeholder: "you@example.com", value: email, onChange: (e) => setEmail(e.target.value), required: true })] }), _jsxs("button", { className: "slx-btn", type: "submit", disabled: busy, children: [busy && _jsx("span", { className: "slx-spinner", "aria-hidden": "true" }), busy ? 'Sending…' : 'Send verification link'] })] })] }))] }));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=EmailVerification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailVerification.js","sourceRoot":"","sources":["../../../src/components/EmailVerification/EmailVerification.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AASrD,qEAAqE;AACrE,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,MAAM,EACN,SAAS,GACc;IACvB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAElC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,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B,eAAK,SAAS,EAAC,WAAW,aACxB,gBAAO,SAAS,EAAC,WAAW,EAAC,OAAO,EAAC,mBAAmB,sBAEhD,EACR,gBACE,EAAE,EAAC,mBAAmB,EACtB,SAAS,EAAC,WAAW,EACrB,IAAI,EAAC,OAAO,EACZ,WAAW,EAAC,iBAAiB,EAC7B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,QAAQ,SACR,IACE,EACN,kBAAQ,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,IAAI,aACrD,IAAI,IAAI,eAAM,SAAS,EAAC,aAAa,iBAAa,MAAM,GAAG,EAC3D,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB,IACtC,IACJ,IACN,CACJ,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ForgotPasswordProps {
|
|
2
|
+
apiUrl?: string;
|
|
3
|
+
onSuccess?: () => void;
|
|
4
|
+
onBackToSignIn?: () => void;
|
|
5
|
+
}
|
|
6
|
+
/** Request a password-reset email. */
|
|
7
|
+
export declare function ForgotPassword({ apiUrl, onSuccess, onBackToSignIn, }: ForgotPasswordProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=ForgotPassword.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForgotPassword.d.ts","sourceRoot":"","sources":["../../../src/components/ForgotPassword/ForgotPassword.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,sCAAsC;AACtC,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,SAAS,EACT,cAAc,GACf,EAAE,mBAAmB,+BA0GrB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SlyxupClient } from '@slyxup/core';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { CheckIcon, KeyholeMark } from '../../icons';
|
|
5
|
+
/** Request a password-reset email. */
|
|
6
|
+
export function ForgotPassword({ apiUrl, onSuccess, onBackToSignIn, }) {
|
|
7
|
+
const [email, setEmail] = useState('');
|
|
8
|
+
const [sent, setSent] = useState(false);
|
|
9
|
+
const [busy, setBusy] = useState(false);
|
|
10
|
+
const [error, setError] = useState(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (error) {
|
|
13
|
+
const t = setTimeout(() => setError(null), 4000);
|
|
14
|
+
return () => clearTimeout(t);
|
|
15
|
+
}
|
|
16
|
+
}, [error]);
|
|
17
|
+
async function onSubmit(e) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
setBusy(true);
|
|
20
|
+
setError(null);
|
|
21
|
+
try {
|
|
22
|
+
await fetch(`${(apiUrl ?? process.env.NEXT_PUBLIC_SLYXUP_API_URL ?? 'https://auth.slyxup.online').replace(/\/$/, '')}/v1/verification/password/forgot`, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: { 'Content-Type': 'application/json' },
|
|
25
|
+
body: JSON.stringify({ email }),
|
|
26
|
+
});
|
|
27
|
+
setSent(true); // always success — never reveal account existence
|
|
28
|
+
onSuccess?.();
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
setError('Network problem. Check your connection and try again.');
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
setBusy(false);
|
|
35
|
+
}
|
|
36
|
+
void SlyxupClient; // tree-shake guard
|
|
37
|
+
}
|
|
38
|
+
if (sent) {
|
|
39
|
+
return (_jsxs("div", { className: "slx-card", children: [_jsx("div", { className: "slx-success-icon", children: _jsx(CheckIcon, {}) }), _jsx("h1", { className: "slx-title", style: { textAlign: 'center' }, children: "Check your email" }), _jsxs("p", { className: "slx-subtitle", style: { textAlign: 'center' }, children: ["If an account exists for ", email, ", a reset link is on its way."] }), onBackToSignIn && (_jsx("p", { className: "slx-footer", children: _jsx("button", { type: "button", className: "slx-link", onClick: onBackToSignIn, children: "Back to sign in" }) }))] }));
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs("div", { className: `slx-card${error ? ' slx-card-error' : ''}`, children: [_jsx("div", { className: "slx-mark", children: _jsx(KeyholeMark, {}) }), _jsx("h1", { className: "slx-title", children: "Reset your password" }), _jsx("p", { className: "slx-subtitle", children: "Enter your email and we'll send you a reset link." }), error && (_jsx("p", { className: "slx-error-text", role: "alert", children: error })), _jsxs("form", { onSubmit: onSubmit, children: [_jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-forgot-email", children: "Email" }), _jsx("input", { id: "slx-forgot-email", className: "slx-input", type: "email", autoComplete: "email", placeholder: "you@example.com", value: email, onChange: (e) => setEmail(e.target.value), required: true })] }), _jsxs("button", { className: "slx-btn", type: "submit", disabled: busy, children: [busy && _jsx("span", { className: "slx-spinner", "aria-hidden": "true" }), busy ? 'Sending…' : 'Send reset link'] })] }), onBackToSignIn && (_jsx("p", { className: "slx-footer", children: _jsx("button", { type: "button", className: "slx-link", onClick: onBackToSignIn, children: "Back to sign in" }) }))] }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ForgotPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForgotPassword.js","sourceRoot":"","sources":["../../../src/components/ForgotPassword/ForgotPassword.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE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AS,EAAC,WAAW,EACrB,IAAI,EAAC,OAAO,EACZ,YAAY,EAAC,OAAO,EACpB,WAAW,EAAC,iBAAiB,EAC7B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,QAAQ,SACR,IACE,EACN,kBAAQ,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,IAAI,aACrD,IAAI,IAAI,eAAM,SAAS,EAAC,aAAa,iBAAa,MAAM,GAAG,EAC3D,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,IAC/B,IACJ,EAEN,cAAc,IAAI,CACjB,YAAG,SAAS,EAAC,YAAY,YACvB,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,UAAU,EAAC,OAAO,EAAE,cAAc,gCAEzD,GACP,CACL,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface Plan {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
amount: number;
|
|
5
|
+
currency: string;
|
|
6
|
+
interval: 'month' | 'year';
|
|
7
|
+
trialDays: number | null;
|
|
8
|
+
features: string[] | null;
|
|
9
|
+
isPopular: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface PricingTableProps {
|
|
12
|
+
plans: Plan[];
|
|
13
|
+
onSelect?: (plan: Plan) => void;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Clean pricing grid with popular badge */
|
|
17
|
+
export declare function PricingTable({ plans, onSelect, loading }: PricingTableProps): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=PricingTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PricingTable.d.ts","sourceRoot":"","sources":["../../../src/components/PricingTable/PricingTable.tsx"],"names":[],"mappings":"AAIA,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,iBAAiB,+BAoI3E"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/** Clean pricing grid with popular badge */
|
|
4
|
+
export function PricingTable({ plans, onSelect, loading }) {
|
|
5
|
+
if (loading) {
|
|
6
|
+
return (_jsx("div", { className: "slx-pricing", style: {
|
|
7
|
+
display: 'grid',
|
|
8
|
+
gridTemplateColumns: `repeat(${Math.min(plans.length, 3)}, 1fr)`,
|
|
9
|
+
gap: 16,
|
|
10
|
+
}, children: [1, 2, 3].map((i) => (_jsx("div", { className: "slx-card", style: { minHeight: 320 }, "aria-busy": "true" }, i))) }));
|
|
11
|
+
}
|
|
12
|
+
return (_jsx("div", { style: {
|
|
13
|
+
display: 'grid',
|
|
14
|
+
gridTemplateColumns: `repeat(${Math.min(plans.length, 3)}, 1fr)`,
|
|
15
|
+
gap: 16,
|
|
16
|
+
}, children: plans.map((plan) => (_jsxs("div", { className: `slx-card${plan.isPopular ? ' slx-card-popular' : ''}`, style: {
|
|
17
|
+
position: plan.isPopular ? 'relative' : undefined,
|
|
18
|
+
borderColor: plan.isPopular ? 'var(--slx-accent)' : undefined,
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
}, children: [plan.isPopular && (_jsx("span", { style: {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
top: -11,
|
|
24
|
+
right: 20,
|
|
25
|
+
fontSize: 10.5,
|
|
26
|
+
fontFamily: 'var(--slx-mono)',
|
|
27
|
+
background: 'linear-gradient(135deg, var(--slx-accent), #8b5cf6)',
|
|
28
|
+
color: '#fff',
|
|
29
|
+
padding: '3px 10px',
|
|
30
|
+
borderRadius: 999,
|
|
31
|
+
}, children: "POPULAR" })), _jsx("h3", { style: { fontSize: 15, fontWeight: 550, color: 'var(--slx-muted)' }, children: plan.name }), _jsxs("div", { style: { margin: '8px 0 2px' }, children: [_jsxs("span", { style: {
|
|
32
|
+
fontSize: 38,
|
|
33
|
+
fontWeight: 750,
|
|
34
|
+
letterSpacing: '-0.03em',
|
|
35
|
+
fontFamily: '"Space Grotesk",sans-serif',
|
|
36
|
+
}, children: ["$", (plan.amount / 100).toFixed(0)] }), _jsxs("span", { style: { fontSize: 14, color: 'var(--slx-muted)' }, children: ["/", plan.interval] })] }), plan.trialDays ? (_jsxs("p", { style: {
|
|
37
|
+
fontSize: 12,
|
|
38
|
+
color: 'var(--slx-accent)',
|
|
39
|
+
marginBottom: 4,
|
|
40
|
+
}, children: [plan.trialDays, " day free trial"] })) : (_jsx("p", { style: { fontSize: 12, color: 'transparent', marginBottom: 4 }, children: "\u00A0" })), _jsx("ul", { style: { listStyle: 'none', margin: '14px 0 22px', flex: 1 }, children: (plan.features ?? []).map((f) => (_jsxs("li", { style: {
|
|
41
|
+
fontSize: 13.5,
|
|
42
|
+
color: 'var(--slx-ink)',
|
|
43
|
+
padding: '5px 0 5px 24px',
|
|
44
|
+
position: 'relative',
|
|
45
|
+
}, children: [_jsx("span", { style: {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
left: 0,
|
|
48
|
+
color: '#34d399',
|
|
49
|
+
fontWeight: 700,
|
|
50
|
+
}, children: "\u2713" }), ' ', f] }, f))) }), _jsx("button", { type: "button", className: "slx-btn", onClick: () => onSelect?.(plan), disabled: loading, children: "Get started" })] }, plan.id))) }));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=PricingTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PricingTable.js","sourceRoot":"","sources":["../../../src/components/PricingTable/PricingTable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAqBb,4CAA4C;AAC5C,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAqB;IAC1E,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,cACE,SAAS,EAAC,aAAa,EACvB,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;gBACf,mBAAmB,EAAE,UAAU,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ;gBAChE,GAAG,EAAE,EAAE;aACR,YAEA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACpB,cAEE,SAAS,EAAC,UAAU,EACpB,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,eACf,MAAM,IAHX,CAAC,CAIN,CACH,CAAC,GACE,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,cACE,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,mBAAmB,EAAE,UAAU,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ;YAChE,GAAG,EAAE,EAAE;SACR,YAEA,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,C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ChB,aACE,KAAK,EAAE;wBACL,QAAQ,EAAE,EAAE;wBACZ,KAAK,EAAE,mBAAmB;wBAC1B,YAAY,EAAE,CAAC;qBAChB,aAEA,IAAI,CAAC,SAAS,uBACb,CACL,CAAC,CAAC,CAAC,CACF,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,EAAE,uBAE7D,CACL,EACD,aAAI,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,YAC5D,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAc,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CACtD,cAEE,KAAK,EAAE;4BACL,QAAQ,EAAE,IAAI;4BACd,KAAK,EAAE,gBAAgB;4BACvB,OAAO,EAAE,gBAAgB;4BACzB,QAAQ,EAAE,UAAU;yBACrB,aAED,eACE,KAAK,EAAE;oCACL,QAAQ,EAAE,UAAU;oCACpB,IAAI,EAAE,CAAC;oCACP,KAAK,EAAE,SAAS;oCAChB,UAAU,EAAE,GAAG;iCAChB,uBAGI,EAAC,GAAG,EACV,CAAC,KAlBG,CAAC,CAmBH,CACN,CAAC,GACC,EACL,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,SAAS,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAC/B,QAAQ,EAAE,OAAO,4BAGV,KA9FJ,IAAI,CAAC,EAAE,CA+FR,CACP,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ResetPasswordProps {
|
|
2
|
+
/** Reset token (from email link ?token=...) */
|
|
3
|
+
token: string;
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
}
|
|
7
|
+
/** Set a new password using the emailed reset token. */
|
|
8
|
+
export declare function ResetPassword({ token, apiUrl, onSuccess, }: ResetPasswordProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ResetPassword.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResetPassword.d.ts","sourceRoot":"","sources":["../../../src/components/ResetPassword/ResetPassword.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,SAAS,GACV,EAAE,kBAAkB,+BAwGpB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { CheckIcon, KeyholeMark } from '../../icons';
|
|
4
|
+
/** Set a new password using the emailed reset token. */
|
|
5
|
+
export function ResetPassword({ token, apiUrl, onSuccess, }) {
|
|
6
|
+
const [password, setPassword] = useState('');
|
|
7
|
+
const [done, setDone] = useState(false);
|
|
8
|
+
const [busy, setBusy] = useState(false);
|
|
9
|
+
const [error, setError] = useState(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (error) {
|
|
12
|
+
const t = setTimeout(() => setError(null), 4000);
|
|
13
|
+
return () => clearTimeout(t);
|
|
14
|
+
}
|
|
15
|
+
}, [error]);
|
|
16
|
+
async function onSubmit(e) {
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
setBusy(true);
|
|
19
|
+
setError(null);
|
|
20
|
+
try {
|
|
21
|
+
const base = (apiUrl ??
|
|
22
|
+
process.env.NEXT_PUBLIC_SLYXUP_API_URL ??
|
|
23
|
+
'https://auth.slyxup.online').replace(/\/$/, '');
|
|
24
|
+
const res = await fetch(`${base}/v1/verification/password/reset`, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: { 'Content-Type': 'application/json' },
|
|
27
|
+
body: JSON.stringify({ token, password }),
|
|
28
|
+
});
|
|
29
|
+
if (!res.ok) {
|
|
30
|
+
const data = await res
|
|
31
|
+
.json()
|
|
32
|
+
.catch(() => ({ error: 'Invalid or expired link' }));
|
|
33
|
+
throw new Error(data.error ?? 'Invalid or expired link');
|
|
34
|
+
}
|
|
35
|
+
setDone(true);
|
|
36
|
+
onSuccess?.();
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
setError(err instanceof Error ? err.message : 'Something went wrong.');
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
setBusy(false);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (done) {
|
|
46
|
+
return (_jsxs("div", { className: "slx-card", children: [_jsx("div", { className: "slx-success-icon", children: _jsx(CheckIcon, {}) }), _jsx("h1", { className: "slx-title", style: { textAlign: 'center' }, children: "Password updated" }), _jsx("p", { className: "slx-subtitle", style: { textAlign: 'center' }, children: "Your password has been changed. Use it to sign in." }), onSuccess && (_jsx("button", { type: "button", className: "slx-btn", onClick: onSuccess, children: "Continue to sign in" }))] }));
|
|
47
|
+
}
|
|
48
|
+
return (_jsxs("div", { className: `slx-card${error ? ' slx-card-error' : ''}`, children: [_jsx("div", { className: "slx-mark", children: _jsx(KeyholeMark, {}) }), _jsx("h1", { className: "slx-title", children: "Choose a new password" }), _jsx("p", { className: "slx-subtitle", children: "Pick something strong you haven't used before." }), error && (_jsx("p", { className: "slx-error-text", role: "alert", children: error })), _jsxs("form", { onSubmit: onSubmit, children: [_jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-reset-password", children: "New password" }), _jsx("input", { id: "slx-reset-password", className: "slx-input", type: "password", autoComplete: "new-password", placeholder: "At least 8 characters", value: password, onChange: (e) => setPassword(e.target.value), required: true, minLength: 8 })] }), _jsxs("button", { className: "slx-btn", type: "submit", disabled: busy, children: [busy && _jsx("span", { className: "slx-spinner", "aria-hidden": "true" }), busy ? 'Updating…' : 'Update password'] })] })] }));
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=ResetPassword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResetPassword.js","sourceRoot":"","sources":["../../../src/components/ResetPassword/ResetPassword.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AASrD,wDAAwD;AACxD,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,SAAS,GACU;IACnB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACjD,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,KAAK,UAAU,QAAQ,CAAC,CAAY;QAClC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC;QACd,QAAQ,C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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SignInProps {
|
|
2
|
+
/** Show social buttons (default true) */
|
|
3
|
+
social?: boolean;
|
|
4
|
+
/** Called after successful sign in */
|
|
5
|
+
onSuccess?: () => void;
|
|
6
|
+
/** Switch to sign up */
|
|
7
|
+
onSignUpClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
/** Email/password + OAuth sign-in card. */
|
|
10
|
+
export declare function SignIn({ social, onSuccess, onSignUpClick, }: SignInProps): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=SignIn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../../src/components/SignIn/SignIn.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,wBAAwB;IACxB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,2CAA2C;AAC3C,wBAAgB,MAAM,CAAC,EACrB,MAAa,EACb,SAAS,EACT,aAAa,GACd,EAAE,WAAW,+BAoJb"}
|