@brokr/sdk 1.0.0 → 2.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/account.js +34 -0
- package/dist/account.mjs +7 -0
- package/dist/auth.js +628 -114
- package/dist/auth.mjs +611 -111
- package/dist/chat.js +34 -0
- package/dist/chat.mjs +7 -0
- package/dist/events.js +64 -0
- package/dist/events.mjs +37 -0
- package/dist/feature.js +6304 -0
- package/dist/feature.mjs +6278 -0
- package/dist/files.js +428 -0
- package/dist/files.mjs +408 -0
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4069 -454
- package/dist/index.mjs +4040 -448
- package/dist/logs.js +148 -0
- package/dist/logs.mjs +124 -0
- package/dist/management.js +14 -13
- package/dist/management.mjs +14 -13
- package/dist/next.js +2725 -0
- package/dist/next.mjs +2710 -0
- package/dist/notifications.js +140 -0
- package/dist/notifications.mjs +110 -0
- package/dist/payments.js +32 -0
- package/dist/payments.mjs +7 -0
- package/dist/react-notifications.js +299 -0
- package/dist/react-notifications.mjs +267 -0
- package/dist/react-styles.js +2756 -0
- package/dist/react-styles.mjs +2720 -0
- package/dist/react-theme.js +4196 -0
- package/dist/react-theme.mjs +4172 -0
- package/dist/react.js +8591 -209
- package/dist/react.mjs +8571 -183
- package/dist/runtime.js +2113 -385
- package/dist/runtime.mjs +2085 -397
- package/dist/src/account/config.d.ts +42 -0
- package/dist/src/account/config.d.ts.map +1 -0
- package/dist/src/account/index.d.ts +3 -0
- package/dist/src/account/index.d.ts.map +1 -0
- package/dist/src/ai/client.d.ts +58 -0
- package/dist/src/ai/client.d.ts.map +1 -0
- package/dist/src/ai/conversation-title.d.ts +13 -0
- package/dist/src/ai/conversation-title.d.ts.map +1 -0
- package/dist/src/ai/types.d.ts +81 -0
- package/dist/src/ai/types.d.ts.map +1 -0
- package/dist/src/auth.d.ts +133 -20
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/chat/config.d.ts +61 -0
- package/dist/src/chat/config.d.ts.map +1 -0
- package/dist/src/chat/index.d.ts +3 -0
- package/dist/src/chat/index.d.ts.map +1 -0
- package/dist/src/chat/sse-parser.d.ts +44 -0
- package/dist/src/chat/sse-parser.d.ts.map +1 -0
- package/dist/src/dev-console.d.ts +18 -0
- package/dist/src/dev-console.d.ts.map +1 -0
- package/dist/src/email/client.d.ts +33 -0
- package/dist/src/email/client.d.ts.map +1 -0
- package/dist/src/email/templates.d.ts +15 -0
- package/dist/src/email/templates.d.ts.map +1 -0
- package/dist/src/email/types.d.ts +35 -0
- package/dist/src/email/types.d.ts.map +1 -0
- package/dist/src/env-detect.d.ts +25 -0
- package/dist/src/env-detect.d.ts.map +1 -0
- package/dist/src/errors.d.ts +53 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/events/client.d.ts +25 -0
- package/dist/src/events/client.d.ts.map +1 -0
- package/dist/src/events/index.d.ts +9 -0
- package/dist/src/events/index.d.ts.map +1 -0
- package/dist/src/events/types.d.ts +10 -0
- package/dist/src/events/types.d.ts.map +1 -0
- package/dist/src/feature/canonical.d.ts +33 -0
- package/dist/src/feature/canonical.d.ts.map +1 -0
- package/dist/src/feature/create-feature.d.ts +33 -0
- package/dist/src/feature/create-feature.d.ts.map +1 -0
- package/dist/src/feature/db.d.ts +16 -0
- package/dist/src/feature/db.d.ts.map +1 -0
- package/dist/src/feature/handlers.d.ts +28 -0
- package/dist/src/feature/handlers.d.ts.map +1 -0
- package/dist/src/feature/index.d.ts +21 -0
- package/dist/src/feature/index.d.ts.map +1 -0
- package/dist/src/feature/manifest.d.ts +173 -0
- package/dist/src/feature/manifest.d.ts.map +1 -0
- package/dist/src/feature/mapping.d.ts +18 -0
- package/dist/src/feature/mapping.d.ts.map +1 -0
- package/dist/src/feature/runtime.d.ts +45 -0
- package/dist/src/feature/runtime.d.ts.map +1 -0
- package/dist/src/feature/types.d.ts +65 -0
- package/dist/src/feature/types.d.ts.map +1 -0
- package/dist/src/files/client.d.ts +28 -0
- package/dist/src/files/client.d.ts.map +1 -0
- package/dist/src/files/types.d.ts +28 -0
- package/dist/src/files/types.d.ts.map +1 -0
- package/dist/src/fix-registry.d.ts +8 -0
- package/dist/src/fix-registry.d.ts.map +1 -0
- package/dist/src/gateway.d.ts +32 -0
- package/dist/src/gateway.d.ts.map +1 -0
- package/dist/src/logs/capture.d.ts +56 -0
- package/dist/src/logs/capture.d.ts.map +1 -0
- package/dist/src/logs/index.d.ts +2 -0
- package/dist/src/logs/index.d.ts.map +1 -0
- package/dist/src/management.d.ts +1 -1
- package/dist/src/management.d.ts.map +1 -1
- package/dist/src/models.d.ts +32 -0
- package/dist/src/models.d.ts.map +1 -0
- package/dist/src/next/auth.d.ts +54 -0
- package/dist/src/next/auth.d.ts.map +1 -0
- package/dist/src/next/chat.d.ts +31 -0
- package/dist/src/next/chat.d.ts.map +1 -0
- package/dist/src/next/index.d.ts +14 -0
- package/dist/src/next/index.d.ts.map +1 -0
- package/dist/src/next/notifications.d.ts +67 -0
- package/dist/src/next/notifications.d.ts.map +1 -0
- package/dist/src/notifications/built-ins.d.ts +9 -0
- package/dist/src/notifications/built-ins.d.ts.map +1 -0
- package/dist/src/notifications/client.d.ts +38 -0
- package/dist/src/notifications/client.d.ts.map +1 -0
- package/dist/src/notifications/config.d.ts +71 -0
- package/dist/src/notifications/config.d.ts.map +1 -0
- package/dist/src/notifications/index.d.ts +6 -0
- package/dist/src/notifications/index.d.ts.map +1 -0
- package/dist/src/notifications/registry.d.ts +67 -0
- package/dist/src/notifications/registry.d.ts.map +1 -0
- package/dist/src/notifications/types.d.ts +48 -0
- package/dist/src/notifications/types.d.ts.map +1 -0
- package/dist/src/payments/client.d.ts +64 -0
- package/dist/src/payments/client.d.ts.map +1 -0
- package/dist/src/payments/config.d.ts +46 -0
- package/dist/src/payments/config.d.ts.map +1 -0
- package/dist/src/payments/entitlements.d.ts +48 -0
- package/dist/src/payments/entitlements.d.ts.map +1 -0
- package/dist/src/payments/types.d.ts +135 -0
- package/dist/src/payments/types.d.ts.map +1 -0
- package/dist/src/react/BrokrErrorBoundary.d.ts +23 -0
- package/dist/src/react/BrokrErrorBoundary.d.ts.map +1 -0
- package/dist/src/react/account/AccountPanel.d.ts +12 -0
- package/dist/src/react/account/AccountPanel.d.ts.map +1 -0
- package/dist/src/react/account/Avatar.d.ts +11 -0
- package/dist/src/react/account/Avatar.d.ts.map +1 -0
- package/dist/src/react/account/ProfilePhotoButton.d.ts +7 -0
- package/dist/src/react/account/ProfilePhotoButton.d.ts.map +1 -0
- package/dist/src/react/account/UserButton.d.ts +7 -0
- package/dist/src/react/account/UserButton.d.ts.map +1 -0
- package/dist/src/react/auth-pages/AuthPageShell.d.ts +9 -0
- package/dist/src/react/auth-pages/AuthPageShell.d.ts.map +1 -0
- package/dist/src/react/auth-pages/SignInPage.d.ts +9 -0
- package/dist/src/react/auth-pages/SignInPage.d.ts.map +1 -0
- package/dist/src/react/auth-pages/SignUpPage.d.ts +8 -0
- package/dist/src/react/auth-pages/SignUpPage.d.ts.map +1 -0
- package/dist/src/react/auth.d.ts +1 -49
- package/dist/src/react/auth.d.ts.map +1 -1
- package/dist/src/react/chat/AIChat.d.ts +4 -0
- package/dist/src/react/chat/AIChat.d.ts.map +1 -0
- package/dist/src/react/chat/ChatContext.d.ts +76 -0
- package/dist/src/react/chat/ChatContext.d.ts.map +1 -0
- package/dist/src/react/chat/ChatInput.d.ts +3 -0
- package/dist/src/react/chat/ChatInput.d.ts.map +1 -0
- package/dist/src/react/chat/MarkdownRenderer.d.ts +5 -0
- package/dist/src/react/chat/MarkdownRenderer.d.ts.map +1 -0
- package/dist/src/react/chat/MessageBubble.d.ts +14 -0
- package/dist/src/react/chat/MessageBubble.d.ts.map +1 -0
- package/dist/src/react/chat/MessagePane.d.ts +10 -0
- package/dist/src/react/chat/MessagePane.d.ts.map +1 -0
- package/dist/src/react/chat/ModelSelector.d.ts +13 -0
- package/dist/src/react/chat/ModelSelector.d.ts.map +1 -0
- package/dist/src/react/chat/ThreadSidebar.d.ts +3 -0
- package/dist/src/react/chat/ThreadSidebar.d.ts.map +1 -0
- package/dist/src/react/chat/index.d.ts +5 -0
- package/dist/src/react/chat/index.d.ts.map +1 -0
- package/dist/src/react/chat/token-limit.d.ts +14 -0
- package/dist/src/react/chat/token-limit.d.ts.map +1 -0
- package/dist/src/react/chat/types.d.ts +65 -0
- package/dist/src/react/chat/types.d.ts.map +1 -0
- package/dist/src/react/chat/useChat.d.ts +57 -0
- package/dist/src/react/chat/useChat.d.ts.map +1 -0
- package/dist/src/react/composites/FabAI.d.ts +15 -0
- package/dist/src/react/composites/FabAI.d.ts.map +1 -0
- package/dist/src/react/composites/FeedbackWidget.d.ts +10 -0
- package/dist/src/react/composites/FeedbackWidget.d.ts.map +1 -0
- package/dist/src/react/composites/SmartUpload.d.ts +12 -0
- package/dist/src/react/composites/SmartUpload.d.ts.map +1 -0
- package/dist/src/react/config.d.ts +23 -0
- package/dist/src/react/config.d.ts.map +1 -0
- package/dist/src/react/context.d.ts +4 -0
- package/dist/src/react/context.d.ts.map +1 -0
- package/dist/src/react/css/account.d.ts +2 -0
- package/dist/src/react/css/account.d.ts.map +1 -0
- package/dist/src/react/css/animations.d.ts +2 -0
- package/dist/src/react/css/animations.d.ts.map +1 -0
- package/dist/src/react/css/auth.d.ts +2 -0
- package/dist/src/react/css/auth.d.ts.map +1 -0
- package/dist/src/react/css/chat-extras.d.ts +2 -0
- package/dist/src/react/css/chat-extras.d.ts.map +1 -0
- package/dist/src/react/css/chat.d.ts +2 -0
- package/dist/src/react/css/chat.d.ts.map +1 -0
- package/dist/src/react/css/composites.d.ts +2 -0
- package/dist/src/react/css/composites.d.ts.map +1 -0
- package/dist/src/react/css/gates.d.ts +2 -0
- package/dist/src/react/css/gates.d.ts.map +1 -0
- package/dist/src/react/css/index.d.ts +3 -0
- package/dist/src/react/css/index.d.ts.map +1 -0
- package/dist/src/react/css/markdown.d.ts +2 -0
- package/dist/src/react/css/markdown.d.ts.map +1 -0
- package/dist/src/react/css/notifications.d.ts +2 -0
- package/dist/src/react/css/notifications.d.ts.map +1 -0
- package/dist/src/react/css/primitives.d.ts +2 -0
- package/dist/src/react/css/primitives.d.ts.map +1 -0
- package/dist/src/react/css/reset.d.ts +2 -0
- package/dist/src/react/css/reset.d.ts.map +1 -0
- package/dist/src/react/css/responsive.d.ts +2 -0
- package/dist/src/react/css/responsive.d.ts.map +1 -0
- package/dist/src/react/css/skeleton.d.ts +2 -0
- package/dist/src/react/css/skeleton.d.ts.map +1 -0
- package/dist/src/react/css/tokens.d.ts +2 -0
- package/dist/src/react/css/tokens.d.ts.map +1 -0
- package/dist/src/react/gates/AuthWall.d.ts +7 -0
- package/dist/src/react/gates/AuthWall.d.ts.map +1 -0
- package/dist/src/react/gates/BillingBoundary.d.ts +4 -0
- package/dist/src/react/gates/BillingBoundary.d.ts.map +1 -0
- package/dist/src/react/gates/Gate.d.ts +9 -0
- package/dist/src/react/gates/Gate.d.ts.map +1 -0
- package/dist/src/react/gates/RequirePlan.d.ts +4 -0
- package/dist/src/react/gates/RequirePlan.d.ts.map +1 -0
- package/dist/src/react/gates/RequireUser.d.ts +4 -0
- package/dist/src/react/gates/RequireUser.d.ts.map +1 -0
- package/dist/src/react/gates/UsageGate.d.ts +4 -0
- package/dist/src/react/gates/UsageGate.d.ts.map +1 -0
- package/dist/src/react/helpers.d.ts +7 -0
- package/dist/src/react/helpers.d.ts.map +1 -0
- package/dist/src/react/hooks/use-theme.d.ts +15 -0
- package/dist/src/react/hooks/use-theme.d.ts.map +1 -0
- package/dist/src/react/hooks/use-user.d.ts +12 -0
- package/dist/src/react/hooks/use-user.d.ts.map +1 -0
- package/dist/src/react/icons.d.ts +26 -0
- package/dist/src/react/icons.d.ts.map +1 -0
- package/dist/src/react/index.d.ts +48 -0
- package/dist/src/react/index.d.ts.map +1 -0
- package/dist/src/react/notifications/NotificationBell.d.ts +7 -0
- package/dist/src/react/notifications/NotificationBell.d.ts.map +1 -0
- package/dist/src/react/notifications/NotificationList.d.ts +7 -0
- package/dist/src/react/notifications/NotificationList.d.ts.map +1 -0
- package/dist/src/react/notifications/Toast.d.ts +13 -0
- package/dist/src/react/notifications/Toast.d.ts.map +1 -0
- package/dist/src/react/notifications/index.d.ts +8 -0
- package/dist/src/react/notifications/index.d.ts.map +1 -0
- package/dist/src/react/notifications/provider.d.ts +14 -0
- package/dist/src/react/notifications/provider.d.ts.map +1 -0
- package/dist/src/react/notifications/use-notifications.d.ts +24 -0
- package/dist/src/react/notifications/use-notifications.d.ts.map +1 -0
- package/dist/src/react/payments/AutoReloadToggle.d.ts +6 -0
- package/dist/src/react/payments/AutoReloadToggle.d.ts.map +1 -0
- package/dist/src/react/payments/Balance.d.ts +8 -0
- package/dist/src/react/payments/Balance.d.ts.map +1 -0
- package/dist/src/react/payments/CancelSubscription.d.ts +6 -0
- package/dist/src/react/payments/CancelSubscription.d.ts.map +1 -0
- package/dist/src/react/payments/CheckoutButton.d.ts +7 -0
- package/dist/src/react/payments/CheckoutButton.d.ts.map +1 -0
- package/dist/src/react/payments/CustomerPortalButton.d.ts +6 -0
- package/dist/src/react/payments/CustomerPortalButton.d.ts.map +1 -0
- package/dist/src/react/payments/FeatureMeter.d.ts +6 -0
- package/dist/src/react/payments/FeatureMeter.d.ts.map +1 -0
- package/dist/src/react/payments/Plans.d.ts +8 -0
- package/dist/src/react/payments/Plans.d.ts.map +1 -0
- package/dist/src/react/payments/TopUpButton.d.ts +8 -0
- package/dist/src/react/payments/TopUpButton.d.ts.map +1 -0
- package/dist/src/react/payments/UpdateBilling.d.ts +3 -0
- package/dist/src/react/payments/UpdateBilling.d.ts.map +1 -0
- package/dist/src/react/payments/UpgradePrompt.d.ts +8 -0
- package/dist/src/react/payments/UpgradePrompt.d.ts.map +1 -0
- package/dist/src/react/primitives/Skeleton.d.ts +15 -0
- package/dist/src/react/primitives/Skeleton.d.ts.map +1 -0
- package/dist/src/react/provider.d.ts +21 -0
- package/dist/src/react/provider.d.ts.map +1 -0
- package/dist/src/react/request.d.ts +2 -0
- package/dist/src/react/request.d.ts.map +1 -0
- package/dist/src/react/styles-entry.d.ts +4 -0
- package/dist/src/react/styles-entry.d.ts.map +1 -0
- package/dist/src/react/styles.d.ts +2 -0
- package/dist/src/react/styles.d.ts.map +1 -0
- package/dist/src/react/theme-entry.d.ts +3 -0
- package/dist/src/react/theme-entry.d.ts.map +1 -0
- package/dist/src/react/theme.d.ts +6 -0
- package/dist/src/react/theme.d.ts.map +1 -0
- package/dist/src/react/types.d.ts +191 -0
- package/dist/src/react/types.d.ts.map +1 -0
- package/dist/src/react/use-brokr-theme.d.ts +6 -0
- package/dist/src/react/use-brokr-theme.d.ts.map +1 -0
- package/dist/src/runtime.d.ts +69 -180
- package/dist/src/runtime.d.ts.map +1 -1
- package/dist/src/storage/client.d.ts +113 -0
- package/dist/src/storage/client.d.ts.map +1 -0
- package/dist/src/storage/types.d.ts +60 -0
- package/dist/src/storage/types.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +70 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACrG,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr Notifications — Type Registry
|
|
3
|
+
*
|
|
4
|
+
* Defines the shape of notification type entries and the registry pattern.
|
|
5
|
+
* Each type specifies how to resolve its visual identity (image, variant, href)
|
|
6
|
+
* from the notification's data payload. Sync-only — no async resolvers.
|
|
7
|
+
*
|
|
8
|
+
* Built-in types ship in `./built-ins.ts`. Consumers extend via
|
|
9
|
+
* `defineNotifications({ types: { ... } })`.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Resolved image for a notification — shown in toast and bell dropdown.
|
|
13
|
+
*/
|
|
14
|
+
export interface NotificationImage {
|
|
15
|
+
url: string;
|
|
16
|
+
alt: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A single notification type definition.
|
|
20
|
+
*
|
|
21
|
+
* All fields are optional — unknown types degrade gracefully to a colored dot
|
|
22
|
+
* and no image/href.
|
|
23
|
+
*/
|
|
24
|
+
export interface NotificationTypeEntry {
|
|
25
|
+
/** Human-readable label for this type (used in filters, grouping). */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Default variant when none is provided on send. */
|
|
28
|
+
defaultVariant?: 'default' | 'success' | 'error' | 'warning';
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the image to display in Toast and Bell for this type.
|
|
31
|
+
* Receives the notification's `data` payload. Return null for no image.
|
|
32
|
+
*
|
|
33
|
+
* MUST be synchronous. If you need async data (e.g. fetch avatar from DB),
|
|
34
|
+
* pre-resolve it and pass `imageUrl` directly when sending.
|
|
35
|
+
*/
|
|
36
|
+
imageResolver?: (data: Record<string, unknown>) => NotificationImage | null;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the navigation href for this type.
|
|
39
|
+
* Receives the notification's `data` payload. Return null for no navigation.
|
|
40
|
+
*
|
|
41
|
+
* IMPORTANT: Always use encodeURIComponent on interpolated values to
|
|
42
|
+
* prevent open-redirect and XSS vectors.
|
|
43
|
+
*/
|
|
44
|
+
hrefResolver?: (data: Record<string, unknown>) => string | null;
|
|
45
|
+
/**
|
|
46
|
+
* When the user is "in context" for this notification type, suppress the toast.
|
|
47
|
+
* Return a context key (e.g. thread ID) that maps to the viewing registration
|
|
48
|
+
* system. Return null to never suppress.
|
|
49
|
+
*/
|
|
50
|
+
suppressKey?: (data: Record<string, unknown>) => string | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Registry of notification types. Keys are type strings stored in the DB.
|
|
54
|
+
* Built-in types are pre-defined; consumers add their own.
|
|
55
|
+
*/
|
|
56
|
+
export type NotificationTypeRegistry = Record<string, NotificationTypeEntry>;
|
|
57
|
+
/**
|
|
58
|
+
* Resolve display properties for a notification from the registry.
|
|
59
|
+
* Gracefully falls back for unknown types — never throws.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveNotificationType(registry: NotificationTypeRegistry, type: string | undefined, data: Record<string, unknown>): {
|
|
62
|
+
image: NotificationImage | null;
|
|
63
|
+
href: string | null;
|
|
64
|
+
variant: 'default' | 'success' | 'error' | 'warning';
|
|
65
|
+
suppressKey: string | null;
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/notifications/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,qDAAqD;IACrD,cAAc,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IAE7D;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,iBAAiB,GAAG,IAAI,CAAC;IAE5E;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC;IAEhE;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC;CAChE;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAE7E;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B;IACD,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAChC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACrD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAiCA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared notification types used across runtime SDK and React components.
|
|
3
|
+
*/
|
|
4
|
+
export interface Notification {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
message: string;
|
|
8
|
+
variant: 'default' | 'success' | 'error' | 'warning';
|
|
9
|
+
read: boolean;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
data?: Record<string, unknown>;
|
|
12
|
+
/** Notification category (e.g. 'ai_response', 'system'). Maps to the type registry. */
|
|
13
|
+
type?: string;
|
|
14
|
+
/** Navigation target. Resolved from registry > this field > data.href. */
|
|
15
|
+
href?: string;
|
|
16
|
+
/** Visual identity image URL (provider logo, user avatar, etc.). */
|
|
17
|
+
imageUrl?: string;
|
|
18
|
+
/** Alt text for the image (accessibility). */
|
|
19
|
+
imageAlt?: string;
|
|
20
|
+
/** When this notification was marked as read (ISO string). */
|
|
21
|
+
readAt?: string;
|
|
22
|
+
/** When this notification expires and should be hidden (ISO string). */
|
|
23
|
+
expiresAt?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Server → Client WebSocket messages. */
|
|
26
|
+
export type ServerMessage = {
|
|
27
|
+
seq: number;
|
|
28
|
+
type: 'notification';
|
|
29
|
+
notification: Notification;
|
|
30
|
+
} | {
|
|
31
|
+
seq: number;
|
|
32
|
+
type: 'history';
|
|
33
|
+
notifications: Notification[];
|
|
34
|
+
} | {
|
|
35
|
+
type: 'ack';
|
|
36
|
+
seq: number;
|
|
37
|
+
};
|
|
38
|
+
/** Client → Server WebSocket messages. */
|
|
39
|
+
export type ClientMessage = {
|
|
40
|
+
type: 'resume';
|
|
41
|
+
lastSeq: number;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'mark_read';
|
|
44
|
+
notificationId: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'mark_all_read';
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/notifications/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACrD,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,0CAA0C;AAC1C,MAAM,MAAM,aAAa,GACrB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAE,GACjE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,aAAa,EAAE,YAAY,EAAE,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,0CAA0C;AAC1C,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Payments Client
|
|
3
|
+
*
|
|
4
|
+
* Checkout, portal, and plan queries for the developer's end users.
|
|
5
|
+
*
|
|
6
|
+
* Every method requires a `userId` — this is the end user's ID from the
|
|
7
|
+
* developer's auth system (e.g. from brokr.auth.requireUser(headers).id).
|
|
8
|
+
* The BROKR_TOKEN identifies the stack; userId identifies which end user.
|
|
9
|
+
*/
|
|
10
|
+
import type { CheckoutResult, PortalResult, UserPlan } from './types';
|
|
11
|
+
export declare class BrokrPaymentsClient {
|
|
12
|
+
private readonly _token;
|
|
13
|
+
private readonly _gatewayUrl;
|
|
14
|
+
constructor(_token: string | undefined, _gatewayUrl: string);
|
|
15
|
+
/**
|
|
16
|
+
* Create a Stripe Checkout session for a plan.
|
|
17
|
+
* Returns a URL to redirect the end user to.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const user = await brokr.auth.requireUser(request.headers);
|
|
22
|
+
* const { checkoutUrl } = await brokr.payments.checkout({
|
|
23
|
+
* plan: 'pro',
|
|
24
|
+
* userId: user.id,
|
|
25
|
+
* });
|
|
26
|
+
* // Redirect user to checkoutUrl
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Create a Stripe Checkout session for a plan.
|
|
31
|
+
*
|
|
32
|
+
* @param params.plan - Plan slug (e.g. 'pro')
|
|
33
|
+
* @param params.userId - End user's ID from your auth system
|
|
34
|
+
* @param params.returnUrl - Where to redirect after checkout. Defaults to your stack's URL.
|
|
35
|
+
* Pass explicitly for localhost or non-Brokr deployments.
|
|
36
|
+
*/
|
|
37
|
+
checkout(params: {
|
|
38
|
+
plan: string;
|
|
39
|
+
userId: string;
|
|
40
|
+
returnUrl?: string;
|
|
41
|
+
}): Promise<CheckoutResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Create a Stripe Customer Portal session.
|
|
44
|
+
* Returns a URL where the end user can manage their subscription.
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Create a Stripe Customer Portal session.
|
|
48
|
+
*
|
|
49
|
+
* @param params.userId - End user's ID
|
|
50
|
+
* @param params.returnUrl - Where to redirect when they're done. Defaults to your stack's URL.
|
|
51
|
+
*/
|
|
52
|
+
portal(params: {
|
|
53
|
+
userId: string;
|
|
54
|
+
returnUrl?: string;
|
|
55
|
+
}): Promise<PortalResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Get the end user's current plan.
|
|
58
|
+
* Returns null if the user has no subscription.
|
|
59
|
+
*/
|
|
60
|
+
currentPlan(params: {
|
|
61
|
+
userId: string;
|
|
62
|
+
}): Promise<UserPlan | null>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/payments/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtE,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,MAAM;IAGtC;;;;;;;;;;;;;OAaG;IACH;;;;;;;OAOG;IACG,QAAQ,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAarG;;;OAGG;IACH;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAanF;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAYxE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Payments config
|
|
3
|
+
*
|
|
4
|
+
* Type-checked passthrough for payments configuration.
|
|
5
|
+
* The actual Stripe sync happens server-side when `brokr deploy` or
|
|
6
|
+
* `brokr payments sync` runs.
|
|
7
|
+
*/
|
|
8
|
+
import type { PaymentsConfig } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Define the payments configuration for your app.
|
|
11
|
+
* This is a type-checked passthrough — the config is synced to Stripe
|
|
12
|
+
* when you deploy or run `brokr payments sync`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // payments.config.ts
|
|
17
|
+
* import { definePayments } from '@brokr/sdk/payments';
|
|
18
|
+
*
|
|
19
|
+
* export default definePayments({
|
|
20
|
+
* plans: {
|
|
21
|
+
* free: {
|
|
22
|
+
* name: 'Free',
|
|
23
|
+
* price: 0,
|
|
24
|
+
* features: {
|
|
25
|
+
* 'api.calls': 100,
|
|
26
|
+
* 'storage.mb': 50,
|
|
27
|
+
* 'ai.chat': true,
|
|
28
|
+
* },
|
|
29
|
+
* },
|
|
30
|
+
* pro: {
|
|
31
|
+
* name: 'Pro',
|
|
32
|
+
* price: 2900, // $29/month
|
|
33
|
+
* features: {
|
|
34
|
+
* 'api.calls': 10000,
|
|
35
|
+
* 'storage.mb': 5000,
|
|
36
|
+
* 'ai.chat': true,
|
|
37
|
+
* 'ai.image': true,
|
|
38
|
+
* 'priority.support': true,
|
|
39
|
+
* },
|
|
40
|
+
* },
|
|
41
|
+
* },
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function definePayments(config: PaymentsConfig): PaymentsConfig;
|
|
46
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/payments/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAErE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Entitlements Client
|
|
3
|
+
*
|
|
4
|
+
* Check feature access, enforce limits, and query usage for end users.
|
|
5
|
+
*
|
|
6
|
+
* Every method takes a params object with `feature` and `userId`.
|
|
7
|
+
* Consistent with payments client calling convention.
|
|
8
|
+
*/
|
|
9
|
+
import type { UsageResult } from './types';
|
|
10
|
+
export interface EntitlementParams {
|
|
11
|
+
feature: string;
|
|
12
|
+
userId: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class BrokrEntitlementsClient {
|
|
15
|
+
private readonly _token;
|
|
16
|
+
private readonly _gatewayUrl;
|
|
17
|
+
constructor(_token: string | undefined, _gatewayUrl: string);
|
|
18
|
+
/**
|
|
19
|
+
* Check if an end user is entitled to a feature.
|
|
20
|
+
* Returns true/false without throwing.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const user = await brokr.auth.requireUser(request.headers);
|
|
25
|
+
* const canChat = await brokr.entitlements.check({ feature: 'ai.chat', userId: user.id });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
check(params: EntitlementParams): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Require that an end user is entitled to a feature.
|
|
31
|
+
* Throws BrokrError if not entitled.
|
|
32
|
+
*/
|
|
33
|
+
require(params: EntitlementParams): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Get usage stats for a metered feature.
|
|
36
|
+
* This is a READ — does NOT increment the counter.
|
|
37
|
+
* Use `increment()` to record usage.
|
|
38
|
+
*/
|
|
39
|
+
usage(params: EntitlementParams): Promise<UsageResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Record a usage event for a metered feature.
|
|
42
|
+
* This is a WRITE — increments the counter.
|
|
43
|
+
*/
|
|
44
|
+
increment(params: EntitlementParams & {
|
|
45
|
+
amount?: number;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=entitlements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../../../src/payments/entitlements.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,uBAAuB;IAEhC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,WAAW,EAAE,MAAM;IAGtC;;;;;;;;;OASG;IACG,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IASxD;;;OAGG;IACG,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvD;;;;OAIG;IACG,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ5D;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAQhF"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brokr SDK — Payments & Entitlements types
|
|
3
|
+
*
|
|
4
|
+
* These types power definePayments() config, the payments client,
|
|
5
|
+
* and the entitlements system.
|
|
6
|
+
*/
|
|
7
|
+
export interface PaymentsConfig {
|
|
8
|
+
/** Plan definitions keyed by slug. */
|
|
9
|
+
plans: Record<string, PlanDef>;
|
|
10
|
+
/** Optional standalone product definitions (one-time purchases). */
|
|
11
|
+
products?: Record<string, ProductDef>;
|
|
12
|
+
/** Stripe webhook secret (injected by Brokr at deploy time). */
|
|
13
|
+
webhookSecret?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PlanDef {
|
|
16
|
+
/** Display name. */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Monthly price in cents (0 for free tier). */
|
|
19
|
+
price: number;
|
|
20
|
+
/** Billing interval. Defaults to 'month'. */
|
|
21
|
+
interval?: 'month' | 'year';
|
|
22
|
+
/** Feature entitlements keyed by feature slug. */
|
|
23
|
+
features: Record<string, boolean | number | 'unlimited'>;
|
|
24
|
+
/** Optional trial period in days. */
|
|
25
|
+
trialDays?: number;
|
|
26
|
+
/** Optional Stripe metadata. */
|
|
27
|
+
metadata?: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
export interface ProductDef {
|
|
30
|
+
/** Display name. */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Price in cents. */
|
|
33
|
+
price: number;
|
|
34
|
+
/** Features this product unlocks. */
|
|
35
|
+
features?: Record<string, boolean | number | 'unlimited'>;
|
|
36
|
+
/** Optional Stripe metadata. */
|
|
37
|
+
metadata?: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
export interface UserPlan {
|
|
40
|
+
/** Plan slug (e.g. 'free', 'pro', 'enterprise'). */
|
|
41
|
+
slug: string;
|
|
42
|
+
/** Display name. */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Resolved features for this plan. */
|
|
45
|
+
features: Record<string, boolean | number | 'unlimited'>;
|
|
46
|
+
}
|
|
47
|
+
export interface EntitlementCheck {
|
|
48
|
+
/** Whether the user is allowed to use this feature. */
|
|
49
|
+
allowed: boolean;
|
|
50
|
+
/** Type of limit. */
|
|
51
|
+
limitType: 'numeric' | 'unlimited' | 'boolean';
|
|
52
|
+
/** Max allowed (for numeric limits). */
|
|
53
|
+
limit?: number;
|
|
54
|
+
/** Current usage (for numeric limits). */
|
|
55
|
+
used?: number;
|
|
56
|
+
/** Remaining quota (for numeric limits). */
|
|
57
|
+
remaining?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface EntitlementMap {
|
|
60
|
+
features: Record<string, EntitlementCheck>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Full UI-ready gating context.
|
|
64
|
+
*
|
|
65
|
+
* Returned by `POST /v1/payments/gating-context`. This is the product surface
|
|
66
|
+
* that BrokrProvider consumes — normalized for UI, not raw Stripe/DB shapes.
|
|
67
|
+
*
|
|
68
|
+
* Contains everything the React layer needs to render Plans grids,
|
|
69
|
+
* FeatureMeters, billing controls, upgrade prompts, and sandbox badges
|
|
70
|
+
* without any additional API calls.
|
|
71
|
+
*/
|
|
72
|
+
export interface GatingContext {
|
|
73
|
+
/** Current user's active plan (null if no subscription). */
|
|
74
|
+
plan: UserPlan | null;
|
|
75
|
+
/**
|
|
76
|
+
* Full plan catalog — all plans defined in definePayments(), resolved with
|
|
77
|
+
* Stripe pricing. Keyed by slug. This is what the Plans component renders.
|
|
78
|
+
*/
|
|
79
|
+
plans: PlanCatalogEntry[];
|
|
80
|
+
/** Per-feature entitlement map for the current user. */
|
|
81
|
+
entitlements: EntitlementMap | null;
|
|
82
|
+
/** Billing summary — normalized for UI consumption. */
|
|
83
|
+
billing: BillingSummary | null;
|
|
84
|
+
/** Payments mode: sandbox or live. */
|
|
85
|
+
mode: 'sandbox' | 'live';
|
|
86
|
+
}
|
|
87
|
+
/** A plan as it appears in the UI catalog (Plans grid, upgrade prompts). */
|
|
88
|
+
export interface PlanCatalogEntry {
|
|
89
|
+
/** Plan slug (matches key in definePayments()). */
|
|
90
|
+
slug: string;
|
|
91
|
+
/** Display name. */
|
|
92
|
+
name: string;
|
|
93
|
+
/** Price in cents. */
|
|
94
|
+
price: number;
|
|
95
|
+
/** Billing interval. */
|
|
96
|
+
interval: 'month' | 'year';
|
|
97
|
+
/** Feature entitlements for this plan. */
|
|
98
|
+
features: Record<string, boolean | number | 'unlimited'>;
|
|
99
|
+
/** Whether this is the user's current plan. */
|
|
100
|
+
isCurrent: boolean;
|
|
101
|
+
/** Trial days (if applicable). */
|
|
102
|
+
trialDays?: number;
|
|
103
|
+
}
|
|
104
|
+
/** Normalized billing state for UI controls. */
|
|
105
|
+
export interface BillingSummary {
|
|
106
|
+
/** Whether the user has a payment method on file. */
|
|
107
|
+
hasPaymentMethod: boolean;
|
|
108
|
+
/** Credit balance in cents (for credit-based billing). Null if not applicable. */
|
|
109
|
+
balanceCents: number | null;
|
|
110
|
+
/** Currency code (e.g. 'usd'). */
|
|
111
|
+
currency: string;
|
|
112
|
+
/** Auto-reload configuration. Null if not configured. */
|
|
113
|
+
autoReload: {
|
|
114
|
+
enabled: boolean;
|
|
115
|
+
thresholdCents: number;
|
|
116
|
+
amountCents: number;
|
|
117
|
+
} | null;
|
|
118
|
+
}
|
|
119
|
+
export interface CheckoutResult {
|
|
120
|
+
/** Stripe Checkout URL to redirect the user to. */
|
|
121
|
+
checkoutUrl: string;
|
|
122
|
+
}
|
|
123
|
+
export interface PortalResult {
|
|
124
|
+
/** Stripe Customer Portal URL. */
|
|
125
|
+
url: string;
|
|
126
|
+
}
|
|
127
|
+
export interface UsageResult {
|
|
128
|
+
/** Amount used in the current period. */
|
|
129
|
+
used: number;
|
|
130
|
+
/** Limit for the current period (null if unlimited). */
|
|
131
|
+
limit: number | null;
|
|
132
|
+
/** Remaining quota (null if unlimited). */
|
|
133
|
+
remaining: number | null;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/payments/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BrokrErrorBoundary — React error boundary for BrokrErrors.
|
|
3
|
+
*
|
|
4
|
+
* Catches BrokrErrors thrown during render, shows a user-friendly message
|
|
5
|
+
* via err.toUserMessage(), and renders a retry button. Accept a `fallback`
|
|
6
|
+
* prop for custom rendering.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
interface Props {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
fallback?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
interface State {
|
|
14
|
+
hasError: boolean;
|
|
15
|
+
error: Error | null;
|
|
16
|
+
}
|
|
17
|
+
export declare class BrokrErrorBoundary extends React.Component<Props, State> {
|
|
18
|
+
state: State;
|
|
19
|
+
static getDerivedStateFromError(error: Error): State;
|
|
20
|
+
render(): React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=BrokrErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrokrErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/react/BrokrErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,qBAAa,kBAAmB,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACnE,KAAK,EAAE,KAAK,CAAoC;IAEhD,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAIpD,MAAM;CAuBP"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type AccountPanelTab = 'general' | 'security' | 'billing' | 'plan';
|
|
3
|
+
export interface AccountPanelProps {
|
|
4
|
+
density?: 'compact' | 'default';
|
|
5
|
+
initialTab?: AccountPanelTab;
|
|
6
|
+
showPlan?: boolean;
|
|
7
|
+
showSessions?: boolean;
|
|
8
|
+
tabs?: AccountPanelTab[];
|
|
9
|
+
}
|
|
10
|
+
export declare function AccountPanel(inlineProps: AccountPanelProps): React.JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=AccountPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountPanel.d.ts","sourceRoot":"","sources":["../../../../src/react/account/AccountPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAczE,KAAK,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AA6BnE,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,eAAe,EAAE,CAAC;CAC1B;AAiBD,wBAAgB,YAAY,CAAC,WAAW,EAAE,iBAAiB,qBAyT1D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AvatarProps {
|
|
3
|
+
name?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
src?: string;
|
|
6
|
+
large?: boolean;
|
|
7
|
+
size?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function Avatar({ email, large, name, size, src }: AvatarProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../src/react/account/Avatar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,KAAa,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,WAAW,qBAsB5E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ProfilePhotoButtonProps {
|
|
3
|
+
size?: number;
|
|
4
|
+
onUpload?: (url: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function ProfilePhotoButton({ onUpload, size, }: ProfilePhotoButtonProps): React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ProfilePhotoButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProfilePhotoButton.d.ts","sourceRoot":"","sources":["../../../../src/react/account/ProfilePhotoButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AAKf,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,IAAS,GACV,EAAE,uBAAuB,qBAiEzB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface UserButtonProps {
|
|
3
|
+
align?: 'end' | 'start';
|
|
4
|
+
display?: 'avatar' | 'full';
|
|
5
|
+
}
|
|
6
|
+
export declare function UserButton({ align: alignProp, display: displayProp, }: UserButtonProps): React.JSX.Element | null;
|
|
7
|
+
//# sourceMappingURL=UserButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserButton.d.ts","sourceRoot":"","sources":["../../../../src/react/account/UserButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAMN,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC7B;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,WAAW,GACrB,EAAE,eAAe,4BA8HjB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AuthPageShellProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle: string;
|
|
6
|
+
variant?: number | `${number}`;
|
|
7
|
+
}
|
|
8
|
+
export declare function AuthPageShell({ children, subtitle, title, variant, }: AuthPageShellProps): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=AuthPageShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthPageShell.d.ts","sourceRoot":"","sources":["../../../../src/react/auth-pages/AuthPageShell.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,OAAO,GACR,EAAE,kBAAkB,qBAwDpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SignInPageProps {
|
|
3
|
+
magicLink?: boolean;
|
|
4
|
+
providers?: Array<'github' | 'google'>;
|
|
5
|
+
redirectTo?: string;
|
|
6
|
+
signUpUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function SignInPage({ magicLink, providers, redirectTo: nextUrl, signUpUrl, }: SignInPageProps): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SignInPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignInPage.d.ts","sourceRoot":"","sources":["../../../../src/react/auth-pages/SignInPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAM9D,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmBD,wBAAgB,UAAU,CAAC,EACzB,SAAgB,EAChB,SAAsB,EACtB,UAAU,EAAE,OAAO,EACnB,SAAsB,GACvB,EAAE,eAAe,qBA8GjB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SignUpPageProps {
|
|
3
|
+
providers?: Array<'github' | 'google'>;
|
|
4
|
+
redirectTo?: string;
|
|
5
|
+
signInUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function SignUpPage({ providers, redirectTo: nextUrl, signInUrl, }: SignUpPageProps): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=SignUpPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignUpPage.d.ts","sourceRoot":"","sources":["../../../../src/react/auth-pages/SignUpPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAM9D,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAsB,EACtB,UAAU,EAAE,OAAO,EACnB,SAAsB,GACvB,EAAE,eAAe,qBAuGjB"}
|
package/dist/src/react/auth.d.ts
CHANGED
|
@@ -1,50 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Brokr Auth React Components + Hooks
|
|
3
|
-
*
|
|
4
|
-
* Wraps Better Auth's React client with Brokr's DX.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* import { BrokrAuth, useUser, useAuth, SignIn, SignUp, UserButton } from '@brokr/sdk/react'
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
export interface AuthClientUser {
|
|
11
|
-
id: string;
|
|
12
|
-
email: string;
|
|
13
|
-
name: string | null;
|
|
14
|
-
avatarUrl: string | null;
|
|
15
|
-
emailVerified: boolean;
|
|
16
|
-
}
|
|
17
|
-
interface SignInRenderProps {
|
|
18
|
-
action: (formData: FormData) => Promise<void>;
|
|
19
|
-
error: string | null;
|
|
20
|
-
pending: boolean;
|
|
21
|
-
}
|
|
22
|
-
interface SignUpRenderProps {
|
|
23
|
-
action: (formData: FormData) => Promise<void>;
|
|
24
|
-
error: string | null;
|
|
25
|
-
pending: boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare function BrokrAuth({ children }: {
|
|
28
|
-
children: React.ReactNode;
|
|
29
|
-
}): React.JSX.Element;
|
|
30
|
-
export declare function useUser(): {
|
|
31
|
-
user: AuthClientUser | null;
|
|
32
|
-
isLoaded: boolean;
|
|
33
|
-
};
|
|
34
|
-
export declare function useAuth(): {
|
|
35
|
-
signIn: (email: string, password: string) => Promise<void>;
|
|
36
|
-
signUp: (email: string, password: string, name?: string) => Promise<void>;
|
|
37
|
-
signOut: () => Promise<void>;
|
|
38
|
-
isSigningOut: boolean;
|
|
39
|
-
};
|
|
40
|
-
export declare function SignIn({ redirectTo, children, }: {
|
|
41
|
-
redirectTo?: string;
|
|
42
|
-
children?: (props: SignInRenderProps) => React.ReactNode;
|
|
43
|
-
}): React.JSX.Element;
|
|
44
|
-
export declare function SignUp({ redirectTo, children, }: {
|
|
45
|
-
redirectTo?: string;
|
|
46
|
-
children?: (props: SignUpRenderProps) => React.ReactNode;
|
|
47
|
-
}): React.JSX.Element;
|
|
48
|
-
export declare function UserButton(): React.JSX.Element | null;
|
|
49
|
-
export {};
|
|
1
|
+
export * from './index';
|
|
50
2
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/react/auth.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/react/auth.tsx"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIChat.d.ts","sourceRoot":"","sources":["../../../../src/react/chat/AIChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAgC,WAAW,EAAE,MAAM,SAAS,CAAC;AAuBzE,wBAAgB,MAAM,CAAC,WAAW,EAAE,WAAW,qBAuW9C"}
|