@boldvideo/bold-js 0.7.0 → 0.8.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/AGENTS.md +105 -0
- package/CHANGELOG.md +22 -0
- package/llms.txt +45 -0
- package/package.json +2 -2
- package/dist/index.cjs +0 -299
- package/dist/index.d.ts +0 -197
- package/dist/index.js +0 -265
- package/thoughts/shared/plans/2025-10-22-BOLD-759-portal-color-scheme.md +0 -272
- package/thoughts/shared/research/2025-10-22-BOLD-759-portal-color-scheme-settings.md +0 -215
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
date: 2025-10-22T03:51:01+0000
|
|
3
|
-
researcher: Claude Code
|
|
4
|
-
git_commit: b74faa4e21936838e3aca23828c579b7d1da7a82
|
|
5
|
-
branch: main
|
|
6
|
-
repository: bold-js
|
|
7
|
-
topic: "Adding portal.color_scheme to Settings Type in bold-js SDK"
|
|
8
|
-
tags: [research, codebase, bold-js, settings, types, portal, BOLD-759]
|
|
9
|
-
status: complete
|
|
10
|
-
last_updated: 2025-10-22
|
|
11
|
-
last_updated_by: Claude Code
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Research: Adding portal.color_scheme to Settings Type in bold-js SDK
|
|
15
|
-
|
|
16
|
-
**Date**: 2025-10-22T03:51:01+0000
|
|
17
|
-
**Researcher**: Claude Code
|
|
18
|
-
**Git Commit**: b74faa4e21936838e3aca23828c579b7d1da7a82
|
|
19
|
-
**Branch**: main
|
|
20
|
-
**Repository**: bold-js
|
|
21
|
-
**Linear Ticket**: [BOLD-759](https://linear.app/boldvideo/issue/BOLD-759/add-portalcolor-scheme-to-settings-type-in-bold-js-sdk)
|
|
22
|
-
|
|
23
|
-
## Research Question
|
|
24
|
-
|
|
25
|
-
Where and how should the `color_scheme` field be added to the Settings type in the bold-js SDK to support the Next.js starter's theme configuration?
|
|
26
|
-
|
|
27
|
-
## Summary
|
|
28
|
-
|
|
29
|
-
The `color_scheme` field needs to be added to the `Portal` type definition in `/Users/marcelfahle/code/BOLD/code/_oss/bold-js/src/lib/types.ts` at line 133. The Portal type is already part of the Settings type (line 210), so adding the field to Portal will automatically make it available in Settings. The SDK already has established patterns for optional fields and will automatically export the updated type through the main index file.
|
|
30
|
-
|
|
31
|
-
## Detailed Findings
|
|
32
|
-
|
|
33
|
-
### Current Settings Type Structure
|
|
34
|
-
|
|
35
|
-
The Settings type is defined in `src/lib/types.ts:179-217` with the following key components:
|
|
36
|
-
|
|
37
|
-
**Portal Object Location**: `src/lib/types.ts:210`
|
|
38
|
-
```typescript
|
|
39
|
-
portal: Portal
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
The Portal type itself is defined at `src/lib/types.ts:133-138`:
|
|
43
|
-
```typescript
|
|
44
|
-
export type Portal = {
|
|
45
|
-
display: PortalDisplay;
|
|
46
|
-
layout: PortalLayout;
|
|
47
|
-
navigation: PortalNavigation;
|
|
48
|
-
theme: PortalTheme;
|
|
49
|
-
};
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Where to Add color_scheme
|
|
53
|
-
|
|
54
|
-
The `color_scheme` field should be added directly to the `Portal` type definition at `src/lib/types.ts:133-138`. Based on the ticket requirements, it should be:
|
|
55
|
-
|
|
56
|
-
**Type**: `'toggle' | 'light' | 'dark'`
|
|
57
|
-
**Optional**: Yes (using the `?` suffix)
|
|
58
|
-
**Location**: Portal type definition
|
|
59
|
-
|
|
60
|
-
The field would be added as a new property alongside the existing nested objects (display, layout, navigation, theme).
|
|
61
|
-
|
|
62
|
-
### Existing Portal Structure
|
|
63
|
-
|
|
64
|
-
The Portal type currently contains four nested configuration objects:
|
|
65
|
-
|
|
66
|
-
1. **display: PortalDisplay** (`src/lib/types.ts:98-101`)
|
|
67
|
-
- `show_chapters: boolean`
|
|
68
|
-
- `show_transcripts: boolean`
|
|
69
|
-
|
|
70
|
-
2. **layout: PortalLayout** (`src/lib/types.ts:109-114`)
|
|
71
|
-
- `assistant_config: AssistantConfig | null`
|
|
72
|
-
- `show_playlists: boolean`
|
|
73
|
-
- `type: string`
|
|
74
|
-
- `videos_limit: number`
|
|
75
|
-
|
|
76
|
-
3. **navigation: PortalNavigation** (`src/lib/types.ts:116-120`)
|
|
77
|
-
- `show_ai_search: boolean`
|
|
78
|
-
- `show_header: boolean`
|
|
79
|
-
- `show_search: boolean`
|
|
80
|
-
|
|
81
|
-
4. **theme: PortalTheme** (`src/lib/types.ts:122-131`)
|
|
82
|
-
- `background: string`
|
|
83
|
-
- `font_body: string`
|
|
84
|
-
- `font_header: string`
|
|
85
|
-
- `foreground: string`
|
|
86
|
-
- `logo_height: number`
|
|
87
|
-
- `logo_url: string`
|
|
88
|
-
- `logo_width: number`
|
|
89
|
-
- `primary: string`
|
|
90
|
-
|
|
91
|
-
### Optional Field Pattern in Settings
|
|
92
|
-
|
|
93
|
-
The SDK has a consistent pattern for optional fields using the TypeScript `?:` syntax:
|
|
94
|
-
|
|
95
|
-
**Examples from Settings type** (`src/lib/types.ts:179-217`):
|
|
96
|
-
- `ai_greeting?: string` (line 187)
|
|
97
|
-
- `favicon_url?: string` (line 194)
|
|
98
|
-
- `logo_dark_url?: string` (line 195)
|
|
99
|
-
- `logo_url?: string` (line 196)
|
|
100
|
-
- `social_graph_image_url?: string` (line 204, nested in meta_data)
|
|
101
|
-
|
|
102
|
-
**Examples from Video type** (`src/lib/types.ts:33-80`):
|
|
103
|
-
- `chapters?: string`
|
|
104
|
-
- `attachments?: VideoAttachment[]`
|
|
105
|
-
- `internal_id?: string`
|
|
106
|
-
- `playback_speed?: number`
|
|
107
|
-
- `tags?: string[]`
|
|
108
|
-
- `transcript?: VideoTranscript`
|
|
109
|
-
|
|
110
|
-
### Union Type Pattern
|
|
111
|
-
|
|
112
|
-
Currently, the Settings type and its nested types don't extensively use string literal union types. The closest patterns are:
|
|
113
|
-
|
|
114
|
-
**Null unions**:
|
|
115
|
-
- `assistant_config: AssistantConfig | null` (`src/lib/types.ts:110`)
|
|
116
|
-
- `image: string | null` (`src/lib/types.ts:202`)
|
|
117
|
-
|
|
118
|
-
The proposed `'toggle' | 'light' | 'dark'` union type would be a new pattern for the Settings type, though it's a standard TypeScript pattern.
|
|
119
|
-
|
|
120
|
-
### Type Export Chain
|
|
121
|
-
|
|
122
|
-
The Portal type follows this export chain:
|
|
123
|
-
|
|
124
|
-
1. **Definition**: `src/lib/types.ts:133-138` - Portal type is exported
|
|
125
|
-
2. **Re-export**: `src/index.ts:12` - Portal is re-exported from main entry
|
|
126
|
-
3. **Compilation**: `dist/index.d.ts` - Type declarations are generated by tsup
|
|
127
|
-
4. **Consumption**: Available to consumers via `import type { Portal } from '@boldvideo/bold-js'`
|
|
128
|
-
|
|
129
|
-
Any changes to the Portal type will automatically flow through this chain when the project is rebuilt.
|
|
130
|
-
|
|
131
|
-
### Settings API Usage
|
|
132
|
-
|
|
133
|
-
The Settings type is fetched via the `fetchSettings` function in `src/lib/fetchers.ts:26-38`:
|
|
134
|
-
|
|
135
|
-
```typescript
|
|
136
|
-
export function fetchSettings(client: ApiClient) {
|
|
137
|
-
return async (videoLimit = 12) => {
|
|
138
|
-
try {
|
|
139
|
-
return await get<Response<Settings>>(
|
|
140
|
-
client,
|
|
141
|
-
`settings?limit=${videoLimit}`
|
|
142
|
-
);
|
|
143
|
-
} catch (error) {
|
|
144
|
-
console.error(`Error fetching settings with limit: ${videoLimit}`, error);
|
|
145
|
-
throw error;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
The function returns a `Response<Settings>` wrapper type where Settings includes the portal object. The API endpoint is `settings?limit=${videoLimit}`.
|
|
152
|
-
|
|
153
|
-
## Code References
|
|
154
|
-
|
|
155
|
-
- `src/lib/types.ts:133-138` - Portal type definition (where color_scheme should be added)
|
|
156
|
-
- `src/lib/types.ts:179-217` - Settings type definition
|
|
157
|
-
- `src/lib/types.ts:210` - Portal field in Settings type
|
|
158
|
-
- `src/index.ts:12` - Portal type re-export
|
|
159
|
-
- `src/lib/fetchers.ts:26-38` - fetchSettings API implementation
|
|
160
|
-
|
|
161
|
-
## Architecture Documentation
|
|
162
|
-
|
|
163
|
-
### Type Definition Pattern
|
|
164
|
-
|
|
165
|
-
The SDK uses a modular type system where:
|
|
166
|
-
|
|
167
|
-
1. Small, focused types are defined for specific concepts (PortalDisplay, PortalLayout, etc.)
|
|
168
|
-
2. These types are composed into larger structures (Portal contains display, layout, navigation, theme)
|
|
169
|
-
3. The Settings type brings everything together at the top level
|
|
170
|
-
4. All types are exported individually, allowing consumers to use them independently
|
|
171
|
-
|
|
172
|
-
### Build and Type Generation
|
|
173
|
-
|
|
174
|
-
- **Build tool**: tsup
|
|
175
|
-
- **Source**: TypeScript files in `src/`
|
|
176
|
-
- **Output**: ESM and CommonJS in `dist/` with type declarations
|
|
177
|
-
- **Type declarations**: Generated automatically in `dist/index.d.ts`
|
|
178
|
-
|
|
179
|
-
### Backward Compatibility
|
|
180
|
-
|
|
181
|
-
The Settings type maintains backward compatibility by:
|
|
182
|
-
|
|
183
|
-
- Keeping legacy flat AI fields (`ai_avatar`, `ai_name`, `has_ai`) while adding new nested `account` structure
|
|
184
|
-
- Using optional fields for new additions to prevent breaking changes
|
|
185
|
-
- Defaulting to sensible values (as specified in the ticket: default to "toggle" if not specified)
|
|
186
|
-
|
|
187
|
-
## Related Research
|
|
188
|
-
|
|
189
|
-
This research is specific to BOLD-759. No previous research documents were found in the thoughts directory related to Settings type modifications.
|
|
190
|
-
|
|
191
|
-
## Implementation Context
|
|
192
|
-
|
|
193
|
-
According to the Linear ticket:
|
|
194
|
-
|
|
195
|
-
**Purpose**: The Next.js starter now reads `portal.color_scheme` from the settings API to control theme behavior, but this field is not yet defined in the bold-js SDK Settings type.
|
|
196
|
-
|
|
197
|
-
**Expected behavior**:
|
|
198
|
-
- `"toggle"`: Show theme toggle, allow user to switch between light/dark
|
|
199
|
-
- `"light"`: Force light mode, hide theme toggle
|
|
200
|
-
- `"dark"`: Force dark mode, hide theme toggle
|
|
201
|
-
- Default to `"toggle"` if not specified
|
|
202
|
-
|
|
203
|
-
**Already implemented**: The implementation is live in production in these commits:
|
|
204
|
-
- main: b31396f
|
|
205
|
-
- demo/founderwell: b42c9fe
|
|
206
|
-
- custom/yo: b9d8ee8
|
|
207
|
-
|
|
208
|
-
The API is already returning this field; the SDK types just need to be updated to reflect it.
|
|
209
|
-
|
|
210
|
-
## Notes
|
|
211
|
-
|
|
212
|
-
- No string literal union types currently exist in the Settings/Portal types, so this would introduce that pattern
|
|
213
|
-
- The field should be optional to maintain backward compatibility
|
|
214
|
-
- The type will automatically be available to consumers after the SDK is rebuilt and published
|
|
215
|
-
- No changes needed to the API fetcher code - it already returns the full Settings object
|