@coxwave/tap-kit-types 0.0.45 → 0.0.52
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/index.d.ts +165 -9
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -7,18 +7,54 @@ interface AlarmMessageInstanceType {
|
|
|
7
7
|
priority: number;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Config Update Message (parent → iframe)
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: container field mirrors ContainerConfig from @coxwave/tap-kit-types
|
|
14
|
+
* - SSOT: @coxwave/tap-kit-types/src/styles.ts (ContainerConfig)
|
|
15
|
+
* - This message protocol mirrors the structure for serialization
|
|
16
|
+
* - When updating ContainerConfig, update this structure accordingly
|
|
17
|
+
*/
|
|
10
18
|
interface ConfigUpdateMessage {
|
|
11
19
|
type: "config:update";
|
|
12
20
|
apiKey?: string;
|
|
13
21
|
hostOrigin?: string;
|
|
14
22
|
tapUrl?: string;
|
|
15
23
|
apiUrl?: string;
|
|
16
|
-
environment?: "dev" | "prod";
|
|
24
|
+
environment?: "dev" | "prod" | "demo";
|
|
17
25
|
language?: "ko" | "en" | (string & {});
|
|
18
26
|
userId?: string;
|
|
19
27
|
courseId?: string;
|
|
20
28
|
clipId?: string;
|
|
21
29
|
clipPlayHead?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Container configuration (mirrors ContainerConfig from @coxwave/tap-kit-types)
|
|
32
|
+
*
|
|
33
|
+
* Structure:
|
|
34
|
+
* - mode: "auto" (default) | "floating" | "sidebar"
|
|
35
|
+
* - floatingConfig: { position, width, height, borderRadius }
|
|
36
|
+
* - sidebarConfig: { maxWidth, minViewportWidth }
|
|
37
|
+
*
|
|
38
|
+
* @see ContainerConfig in @coxwave/tap-kit-types
|
|
39
|
+
*/
|
|
40
|
+
container?: {
|
|
41
|
+
mode?: "auto" | "floating" | "sidebar";
|
|
42
|
+
floatingConfig?: {
|
|
43
|
+
position?: {
|
|
44
|
+
top?: string;
|
|
45
|
+
left?: string;
|
|
46
|
+
right?: string;
|
|
47
|
+
bottom?: string;
|
|
48
|
+
};
|
|
49
|
+
width?: string;
|
|
50
|
+
height?: string;
|
|
51
|
+
borderRadius?: string;
|
|
52
|
+
};
|
|
53
|
+
sidebarConfig?: {
|
|
54
|
+
maxWidth?: string;
|
|
55
|
+
minViewportWidth?: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
22
58
|
}
|
|
23
59
|
|
|
24
60
|
/**
|
|
@@ -31,18 +67,104 @@ type PositionType = {
|
|
|
31
67
|
bottom?: string;
|
|
32
68
|
};
|
|
33
69
|
/**
|
|
34
|
-
* Container
|
|
70
|
+
* Container Layout State (SSOT - Visual State)
|
|
71
|
+
*
|
|
72
|
+
* This is the SINGLE SOURCE OF TRUTH for container visual state.
|
|
73
|
+
* Managed by Container class (tap-kit-core), streamed to iframe via messages.
|
|
74
|
+
*
|
|
75
|
+
* - floating: User-chosen floating layout
|
|
76
|
+
* - sidebar: User-chosen sidebar layout
|
|
77
|
+
* - floating-forced: Forced floating due to narrow viewport (sidebar unavailable)
|
|
78
|
+
*
|
|
79
|
+
* Both tap-kit-core (Container) and edutap (UIConfigStore) use this type.
|
|
80
|
+
* iframe receives this as read-only shadow state via container:layout:state:changed message.
|
|
35
81
|
*/
|
|
36
|
-
type
|
|
82
|
+
type ContainerLayoutState = "floating" | "sidebar" | "floating-forced";
|
|
83
|
+
/**
|
|
84
|
+
* Container Mode (Behavior Configuration)
|
|
85
|
+
*
|
|
86
|
+
* Controls toggle button visibility and layout persistence:
|
|
87
|
+
* - auto: User can toggle between layouts, remembers preference via localStorage (DEFAULT)
|
|
88
|
+
* - floating: Fixed in floating layout, no toggle button, no persistence
|
|
89
|
+
* - sidebar: Fixed in sidebar layout, no toggle button, no persistence
|
|
90
|
+
*/
|
|
91
|
+
type ContainerMode = "auto" | "floating" | "sidebar";
|
|
92
|
+
/**
|
|
93
|
+
* Floating mode configuration
|
|
94
|
+
* Includes position, size, and style settings for floating container
|
|
95
|
+
*/
|
|
96
|
+
type FloatingConfig = {
|
|
97
|
+
/** Position (default: top: "50px", right: "24px") */
|
|
37
98
|
position?: PositionType;
|
|
99
|
+
/** Width (default: "340px") */
|
|
38
100
|
width?: string;
|
|
101
|
+
/** Height (default: "calc(100% - 116px)") */
|
|
39
102
|
height?: string;
|
|
103
|
+
/** Border radius (default: "16px") */
|
|
40
104
|
borderRadius?: string;
|
|
41
105
|
};
|
|
42
106
|
/**
|
|
43
|
-
*
|
|
107
|
+
* Sidebar Configuration
|
|
108
|
+
*/
|
|
109
|
+
type SidebarConfig = {
|
|
110
|
+
/** Maximum width of the sidebar (default: "min(50%, 600px)") */
|
|
111
|
+
maxWidth?: string;
|
|
112
|
+
/** Minimum viewport width to enable sidebar mode (default: 768) */
|
|
113
|
+
minViewportWidth?: number;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Container Configuration (SSOT - Type Level)
|
|
117
|
+
*
|
|
118
|
+
* This is the SINGLE SOURCE OF TRUTH for container configuration at the TYPE level.
|
|
119
|
+
* - Public API: TapKitInitParams.container
|
|
120
|
+
* - Internal: Container class configuration
|
|
121
|
+
* - Protocol: ConfigUpdateMessage.container mirrors this structure
|
|
122
|
+
*
|
|
123
|
+
* When modifying this type, also update ConfigUpdateMessage.container in @coxwave/tap-messages
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* // Default: Auto mode with floating layout (toggle button visible)
|
|
127
|
+
* const config: ContainerConfig = {}
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* // Auto mode with custom styling for both layouts
|
|
131
|
+
* const config: ContainerConfig = {
|
|
132
|
+
* floatingConfig: { width: "400px", position: { top: "80px" } },
|
|
133
|
+
* sidebarConfig: { maxWidth: "600px" }
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* // Fixed floating mode (no toggle button)
|
|
138
|
+
* const config: ContainerConfig = {
|
|
139
|
+
* mode: "floating",
|
|
140
|
+
* floatingConfig: { position: { top: "80px" }, width: "400px" }
|
|
141
|
+
* }
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* // Fixed sidebar mode (no toggle button)
|
|
145
|
+
* const config: ContainerConfig = {
|
|
146
|
+
* mode: "sidebar",
|
|
147
|
+
* sidebarConfig: { maxWidth: "500px" }
|
|
148
|
+
* }
|
|
149
|
+
*/
|
|
150
|
+
type ContainerConfig = {
|
|
151
|
+
/**
|
|
152
|
+
* Container mode controls toggle button visibility and behavior
|
|
153
|
+
* - "auto" (default): User can toggle between layouts, starts in floating, remembers preference via localStorage
|
|
154
|
+
* - "floating": Fixed in floating layout, no toggle button
|
|
155
|
+
* - "sidebar": Fixed in sidebar layout, no toggle button
|
|
156
|
+
*/
|
|
157
|
+
mode?: ContainerMode;
|
|
158
|
+
/** Floating layout configuration (applied when in floating layout) */
|
|
159
|
+
floatingConfig?: FloatingConfig;
|
|
160
|
+
/** Sidebar layout configuration (applied when in sidebar layout) */
|
|
161
|
+
sidebarConfig?: SidebarConfig;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Core Configuration Types
|
|
166
|
+
* Based on ConfigUpdateMessage protocol for type consistency (SSOT)
|
|
44
167
|
*/
|
|
45
|
-
type CustomStyles = ContainerStyle;
|
|
46
168
|
|
|
47
169
|
/**
|
|
48
170
|
* SDK Configuration (Public API)
|
|
@@ -51,7 +173,7 @@ type CustomStyles = ContainerStyle;
|
|
|
51
173
|
* Default values:
|
|
52
174
|
* - tapUrl: https://edutap-ai.vercel.app
|
|
53
175
|
* - apiUrl: https://tapapi.coxwave.link
|
|
54
|
-
* - environment:
|
|
176
|
+
* - environment: dev (console logging enabled)
|
|
55
177
|
*/
|
|
56
178
|
type TapKitConfig = {
|
|
57
179
|
apiKey: string;
|
|
@@ -61,7 +183,7 @@ type TapKitConfig = {
|
|
|
61
183
|
* Derived from ConfigUpdateMessage protocol (without 'type' field)
|
|
62
184
|
* This ensures type consistency between iframe messages and config
|
|
63
185
|
*/
|
|
64
|
-
type TapKitRuntimeConfig = Omit<ConfigUpdateMessage,
|
|
186
|
+
type TapKitRuntimeConfig = Omit<ConfigUpdateMessage, "type">;
|
|
65
187
|
/**
|
|
66
188
|
* All SDK Configuration Options (Internal API)
|
|
67
189
|
* Derived from ConfigUpdateMessage protocol for type consistency
|
|
@@ -85,11 +207,45 @@ type Course = {
|
|
|
85
207
|
};
|
|
86
208
|
/**
|
|
87
209
|
* SDK Initialization Parameters
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const sdk = new TapSDK({ apiKey: "your-key" });
|
|
214
|
+
*
|
|
215
|
+
* // Minimal initialization (uses all defaults)
|
|
216
|
+
* await sdk.init({
|
|
217
|
+
* buttonId: "tap-button",
|
|
218
|
+
* course: { userId: "user1", courseId: "course1", clipId: "clip1" }
|
|
219
|
+
* });
|
|
220
|
+
*
|
|
221
|
+
* // Custom floating container
|
|
222
|
+
* await sdk.init({
|
|
223
|
+
* buttonId: "tap-button",
|
|
224
|
+
* course: { userId: "user1", courseId: "course1", clipId: "clip1" },
|
|
225
|
+
* container: {
|
|
226
|
+
* mode: "floating",
|
|
227
|
+
* position: { top: "80px", right: "32px" },
|
|
228
|
+
* width: "400px",
|
|
229
|
+
* disableSidebar: true // Prevent user from switching to sidebar
|
|
230
|
+
* }
|
|
231
|
+
* });
|
|
232
|
+
*
|
|
233
|
+
* // Sidebar mode with custom width
|
|
234
|
+
* await sdk.init({
|
|
235
|
+
* buttonId: "tap-button",
|
|
236
|
+
* course: { userId: "user1", courseId: "course1", clipId: "clip1" },
|
|
237
|
+
* container: {
|
|
238
|
+
* mode: "sidebar",
|
|
239
|
+
* sidebarConfig: { width: "600px", minViewportWidth: 1024 }
|
|
240
|
+
* }
|
|
241
|
+
* });
|
|
242
|
+
* ```
|
|
88
243
|
*/
|
|
89
244
|
type TapKitInitParams = {
|
|
90
245
|
buttonId: string;
|
|
91
246
|
course: Course;
|
|
92
|
-
|
|
247
|
+
/** Container configuration (optional, uses defaults if omitted) */
|
|
248
|
+
container?: ContainerConfig;
|
|
93
249
|
};
|
|
94
250
|
|
|
95
251
|
/**
|
|
@@ -228,4 +384,4 @@ declare global {
|
|
|
228
384
|
function cancelIdleCallback(handle: number): void;
|
|
229
385
|
}
|
|
230
386
|
|
|
231
|
-
export { type AlarmMessageInstanceType, type AlarmType, type
|
|
387
|
+
export { type AlarmMessageInstanceType, type AlarmType, type ContainerConfig, type ContainerLayoutState, type ContainerMode, type ContainerVisibility, type Course, type FloatingConfig, TapKitInitializationError as InitializationError, type PositionType, type SeekTimelineParamsType, type ShortcutKeyPropertiesType, type SidebarConfig, TAPKIT_CONFIG_SYMBOL, TAP_ERROR_MARKER, type TapErrorOptions, type TapKitConfig, type TapKitConfigOptions, TapKitConfigurationError, type TapKitConstructor, TapKitError, TapKitIframeError, type TapKitInitParams, TapKitInitializationError, type TapKitInstance, TapKitLoaderError, TapKitMessageError, type TapKitRuntimeConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coxwave/tap-kit-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared TypeScript types for TapKit SDK packages",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
],
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"tsup": "^8.5.0",
|
|
26
|
-
"@coxwave/config-
|
|
26
|
+
"@coxwave/config-eslint": "1.0.0",
|
|
27
27
|
"@coxwave/tap-messages": "0.0.1",
|
|
28
|
-
"@coxwave/config-
|
|
28
|
+
"@coxwave/config-typescript": "1.0.0"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsup",
|