@coxwave/tap-kit-types 2.10.3 → 2.10.4
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 +59 -3
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -207,8 +207,8 @@ type FeatureFlags = Partial<Record<FeatureFlagKey, boolean>>;
|
|
|
207
207
|
/** Check if a feature is enabled. Falls back to FLAG_DEFAULTS. */
|
|
208
208
|
declare function isFeatureEnabled(flags: FeatureFlags | undefined, key: FeatureFlagKey): boolean;
|
|
209
209
|
|
|
210
|
-
type TapMessageType = "tap:ready" | "tap:close" | "timeline:seek" | "alarm:click" | "alarm:fadeIn" | "popUp:open" | "popUp:close" | "material:view:open" | "material:view:close" | "material:view:error" | "html:view:open" | "html:view:close" | "container:mode:change" | "container:mode:change:ack" | "container:layout:state:changed" | "viewport:resize" | "config:update" | "config:request" | "GA_EVENT" | "tutor:info";
|
|
211
|
-
type TapMessage = TapReadyMessage | TapCloseMessage | TimelineSeekMessage | AlarmClickMessage | AlarmFadeInMessage | PopUpOpenMessage | PopUpCloseMessage | MaterialViewOpenMessage | MaterialViewCloseMessage | MaterialViewErrorMessage | HtmlViewOpenMessage | HtmlViewCloseMessage | ContainerModeChangeMessage | ContainerModeChangeAckMessage | ContainerLayoutStateChangedMessage | ViewportResizeMessage | ConfigUpdateMessage | ConfigRequestMessage | GAEventMessage | TutorInfoMessage;
|
|
210
|
+
type TapMessageType = "tap:ready" | "tap:close" | "timeline:seek" | "alarm:click" | "alarm:fadeIn" | "popUp:open" | "popUp:close" | "material:view:open" | "material:view:close" | "material:view:error" | "html:view:open" | "html:view:close" | "container:mode:change" | "container:mode:change:ack" | "container:layout:state:changed" | "viewport:resize" | "config:update" | "config:request" | "GA_EVENT" | "tutor:info" | "host:context";
|
|
211
|
+
type TapMessage = TapReadyMessage | TapCloseMessage | TimelineSeekMessage | AlarmClickMessage | AlarmFadeInMessage | PopUpOpenMessage | PopUpCloseMessage | MaterialViewOpenMessage | MaterialViewCloseMessage | MaterialViewErrorMessage | HtmlViewOpenMessage | HtmlViewCloseMessage | ContainerModeChangeMessage | ContainerModeChangeAckMessage | ContainerLayoutStateChangedMessage | ViewportResizeMessage | ConfigUpdateMessage | ConfigRequestMessage | GAEventMessage | TutorInfoMessage | HostContextMessage;
|
|
212
212
|
interface TapReadyMessage {
|
|
213
213
|
type: "tap:ready";
|
|
214
214
|
gaId: string;
|
|
@@ -438,6 +438,26 @@ interface TutorInfoMessage {
|
|
|
438
438
|
type: "tutor:info";
|
|
439
439
|
tutorName: string;
|
|
440
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Host Context Message (parent → iframe)
|
|
443
|
+
* Generic channel for host application to send contextual data to the iframe.
|
|
444
|
+
* Uses contextType discriminator for different context kinds (quiz answers, reading progress, etc.)
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```typescript
|
|
448
|
+
* // Passage answer submission
|
|
449
|
+
* messenger.post({
|
|
450
|
+
* type: "host:context",
|
|
451
|
+
* contextType: "passage:answer:submit",
|
|
452
|
+
* payload: { passageId, question, selectedOptionId, isCorrect }
|
|
453
|
+
* });
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
interface HostContextMessage {
|
|
457
|
+
type: "host:context";
|
|
458
|
+
contextType: string;
|
|
459
|
+
payload: Record<string, unknown>;
|
|
460
|
+
}
|
|
441
461
|
|
|
442
462
|
/**
|
|
443
463
|
* Fallback type.
|
|
@@ -2279,6 +2299,11 @@ declare const TutorInfoSchema: ObjectSchema<{
|
|
|
2279
2299
|
readonly type: LiteralSchema<"tutor:info", undefined>;
|
|
2280
2300
|
readonly tutorName: StringSchema<undefined>;
|
|
2281
2301
|
}, undefined>;
|
|
2302
|
+
declare const HostContextSchema: ObjectSchema<{
|
|
2303
|
+
readonly type: LiteralSchema<"host:context", undefined>;
|
|
2304
|
+
readonly contextType: StringSchema<undefined>;
|
|
2305
|
+
readonly payload: RecordSchema<StringSchema<undefined>, AnySchema, undefined>;
|
|
2306
|
+
}, undefined>;
|
|
2282
2307
|
declare const TapMessageSchema: UnionSchema<[ObjectSchema<{
|
|
2283
2308
|
readonly type: LiteralSchema<"tap:ready", undefined>;
|
|
2284
2309
|
readonly gaId: StringSchema<undefined>;
|
|
@@ -2387,6 +2412,10 @@ declare const TapMessageSchema: UnionSchema<[ObjectSchema<{
|
|
|
2387
2412
|
}, undefined>, ObjectSchema<{
|
|
2388
2413
|
readonly type: LiteralSchema<"tutor:info", undefined>;
|
|
2389
2414
|
readonly tutorName: StringSchema<undefined>;
|
|
2415
|
+
}, undefined>, ObjectSchema<{
|
|
2416
|
+
readonly type: LiteralSchema<"host:context", undefined>;
|
|
2417
|
+
readonly contextType: StringSchema<undefined>;
|
|
2418
|
+
readonly payload: RecordSchema<StringSchema<undefined>, AnySchema, undefined>;
|
|
2390
2419
|
}, undefined>], undefined>;
|
|
2391
2420
|
|
|
2392
2421
|
type TapMessageRecord = TapMessage;
|
|
@@ -2786,6 +2815,12 @@ interface TapKitInstance {
|
|
|
2786
2815
|
setCourse(course: Partial<Course> & {
|
|
2787
2816
|
courseId: string;
|
|
2788
2817
|
}): void;
|
|
2818
|
+
/**
|
|
2819
|
+
* Send contextual data from host application to the iframe
|
|
2820
|
+
* @param contextType - Discriminator for context kind (e.g., "passage:answer:submit")
|
|
2821
|
+
* @param payload - Arbitrary data payload
|
|
2822
|
+
*/
|
|
2823
|
+
sendContext(contextType: string, payload: Record<string, unknown>): void;
|
|
2789
2824
|
}
|
|
2790
2825
|
/** TapKit constructor type */
|
|
2791
2826
|
type TapKitConstructor = new (config: TapKitConfig) => TapKitInstance;
|
|
@@ -3425,6 +3460,27 @@ interface TapKitElement extends HTMLElement {
|
|
|
3425
3460
|
*/
|
|
3426
3461
|
setCourse(course: Partial<Course> & { courseId: string }): void;
|
|
3427
3462
|
|
|
3463
|
+
/**
|
|
3464
|
+
* Send contextual data from host application to the iframe (AI tutor)
|
|
3465
|
+
*
|
|
3466
|
+
* Generic channel for passing host context (quiz answers, reading progress, etc.)
|
|
3467
|
+
* to the iframe. Uses contextType discriminator for different context kinds.
|
|
3468
|
+
*
|
|
3469
|
+
* @param contextType - Discriminator string (e.g., "passage:answer:submit")
|
|
3470
|
+
* @param payload - Arbitrary data payload
|
|
3471
|
+
*
|
|
3472
|
+
* @example
|
|
3473
|
+
* ```typescript
|
|
3474
|
+
* kit.sendContext("passage:answer:submit", {
|
|
3475
|
+
* passageId: "p1",
|
|
3476
|
+
* question: "What is...?",
|
|
3477
|
+
* selectedOptionId: "A",
|
|
3478
|
+
* isCorrect: true,
|
|
3479
|
+
* });
|
|
3480
|
+
* ```
|
|
3481
|
+
*/
|
|
3482
|
+
sendContext(contextType: string, payload: Record<string, unknown>): void;
|
|
3483
|
+
|
|
3428
3484
|
// ===== Delegate Properties (Read-only) =====
|
|
3429
3485
|
|
|
3430
3486
|
/**
|
|
@@ -3903,4 +3959,4 @@ declare global {
|
|
|
3903
3959
|
function cancelIdleCallback(handle: number): void;
|
|
3904
3960
|
}
|
|
3905
3961
|
|
|
3906
|
-
export { ALARM_DURATION, type AlarmClickMessage, AlarmClickSchema, type AlarmElement, type AlarmElementProps, AlarmElementPropsSchema, AlarmElementSchema, type AlarmFadeInMessage, AlarmFadeInSchema, AlarmMessageInstanceSchema, type AlarmMessageInstanceType, type AlarmPayload, type AlarmType, type CSSStyle, CSSStyleSchema, type ChatMode, type ConfigRequestMessage, ConfigRequestSchema, type ConfigUpdateKey, type ConfigUpdateMessage, type ConfigUpdateOptions, type ConfigUpdatePayload, ConfigUpdateSchema, type ContainerConfig, type ContainerLayoutStateChangedMessage, ContainerLayoutStateChangedSchema, type ContainerModeChangeAckMessage, ContainerModeChangeAckSchema, type ContainerModeChangeMessage, ContainerModeChangeSchema, type ContainerVisibility, type Course, type DisplayMode, type EventManager, FLAG_DEFAULTS, type FeatureFlagKey, type FeatureFlags, type FloatingConfig, type GAEventMessage, GAEventSchema, type HtmlViewCloseMessage, HtmlViewCloseSchema, type HtmlViewConfig, type HtmlViewOpenMessage, HtmlViewOpenSchema, type ITapButtonElement, type ITapContainerElement, type ITapHtmlViewerElement, type ITapKitElement, type ITapMaterialViewerElement, TapKitInitializationError as InitializationError, type LayoutMode, type MaterialViewCloseMessage, MaterialViewCloseSchema, type MaterialViewConfig, type MaterialViewErrorMessage, MaterialViewErrorSchema, type MaterialViewOpenMessage, MaterialViewOpenSchema, MaterialViewerError, type PopUpCloseMessage, PopUpCloseSchema, type PopUpOpenMessage, PopUpOpenSchema, type PositionType, type SeekTimelineParamsType, type ShortcutKeyPropertiesType, type SidebarConfig, type SyncableConfigKey, TAP_BUTTON_CLICK_EVENT, TAP_ERROR_MARKER, type TapButtonAttributes, type TapButtonClickEventDetail, type TapCloseMessage, TapCloseSchema, type TapContainerAttributes, type TapErrorOptions, type TapHtmlViewerAttributes, type TapKitConfig, TapKitConfigurationError, type TapKitConstructor, type TapKitElement, type TapKitElementEventMap, TapKitError, TapKitIframeError, type TapKitInitParams, TapKitInitializationError, type TapKitInstance, TapKitLoaderError, TapKitMessageError, type TapMaterialViewerAttributes, type TapMessage, type TapMessageRecord, TapMessageSchema, type TapMessageType, type TapReadyMessage, TapReadySchema, type TimelineSeekMessage, TimelineSeekSchema, type TutorInfoMessage, TutorInfoSchema, type VideoController, type VideoPlayerAdapter, type VideoPlayerConfig, type ViewportResizeMessage, ViewportResizeSchema, isFeatureEnabled };
|
|
3962
|
+
export { ALARM_DURATION, type AlarmClickMessage, AlarmClickSchema, type AlarmElement, type AlarmElementProps, AlarmElementPropsSchema, AlarmElementSchema, type AlarmFadeInMessage, AlarmFadeInSchema, AlarmMessageInstanceSchema, type AlarmMessageInstanceType, type AlarmPayload, type AlarmType, type CSSStyle, CSSStyleSchema, type ChatMode, type ConfigRequestMessage, ConfigRequestSchema, type ConfigUpdateKey, type ConfigUpdateMessage, type ConfigUpdateOptions, type ConfigUpdatePayload, ConfigUpdateSchema, type ContainerConfig, type ContainerLayoutStateChangedMessage, ContainerLayoutStateChangedSchema, type ContainerModeChangeAckMessage, ContainerModeChangeAckSchema, type ContainerModeChangeMessage, ContainerModeChangeSchema, type ContainerVisibility, type Course, type DisplayMode, type EventManager, FLAG_DEFAULTS, type FeatureFlagKey, type FeatureFlags, type FloatingConfig, type GAEventMessage, GAEventSchema, type HostContextMessage, HostContextSchema, type HtmlViewCloseMessage, HtmlViewCloseSchema, type HtmlViewConfig, type HtmlViewOpenMessage, HtmlViewOpenSchema, type ITapButtonElement, type ITapContainerElement, type ITapHtmlViewerElement, type ITapKitElement, type ITapMaterialViewerElement, TapKitInitializationError as InitializationError, type LayoutMode, type MaterialViewCloseMessage, MaterialViewCloseSchema, type MaterialViewConfig, type MaterialViewErrorMessage, MaterialViewErrorSchema, type MaterialViewOpenMessage, MaterialViewOpenSchema, MaterialViewerError, type PopUpCloseMessage, PopUpCloseSchema, type PopUpOpenMessage, PopUpOpenSchema, type PositionType, type SeekTimelineParamsType, type ShortcutKeyPropertiesType, type SidebarConfig, type SyncableConfigKey, TAP_BUTTON_CLICK_EVENT, TAP_ERROR_MARKER, type TapButtonAttributes, type TapButtonClickEventDetail, type TapCloseMessage, TapCloseSchema, type TapContainerAttributes, type TapErrorOptions, type TapHtmlViewerAttributes, type TapKitConfig, TapKitConfigurationError, type TapKitConstructor, type TapKitElement, type TapKitElementEventMap, TapKitError, TapKitIframeError, type TapKitInitParams, TapKitInitializationError, type TapKitInstance, TapKitLoaderError, TapKitMessageError, type TapMaterialViewerAttributes, type TapMessage, type TapMessageRecord, TapMessageSchema, type TapMessageType, type TapReadyMessage, TapReadySchema, type TimelineSeekMessage, TimelineSeekSchema, type TutorInfoMessage, TutorInfoSchema, type VideoController, type VideoPlayerAdapter, type VideoPlayerConfig, type ViewportResizeMessage, ViewportResizeSchema, isFeatureEnabled };
|
package/dist/index.js
CHANGED
|
@@ -908,6 +908,11 @@ var TutorInfoSchema = object({
|
|
|
908
908
|
type: literal("tutor:info"),
|
|
909
909
|
tutorName: string()
|
|
910
910
|
});
|
|
911
|
+
var HostContextSchema = object({
|
|
912
|
+
type: literal("host:context"),
|
|
913
|
+
contextType: string(),
|
|
914
|
+
payload: record(string(), any())
|
|
915
|
+
});
|
|
911
916
|
var TapMessageSchema = union([
|
|
912
917
|
TapReadySchema,
|
|
913
918
|
TapCloseSchema,
|
|
@@ -928,12 +933,13 @@ var TapMessageSchema = union([
|
|
|
928
933
|
ConfigUpdateSchema,
|
|
929
934
|
ConfigRequestSchema,
|
|
930
935
|
GAEventSchema,
|
|
931
|
-
TutorInfoSchema
|
|
936
|
+
TutorInfoSchema,
|
|
937
|
+
HostContextSchema
|
|
932
938
|
]);
|
|
933
939
|
|
|
934
940
|
// src/tap-button.d.ts
|
|
935
941
|
var TAP_BUTTON_CLICK_EVENT = "tap-button:click";
|
|
936
942
|
|
|
937
|
-
export { ALARM_DURATION, AlarmClickSchema, AlarmElementPropsSchema, AlarmElementSchema, AlarmFadeInSchema, AlarmMessageInstanceSchema, CSSStyleSchema, ConfigRequestSchema, ConfigUpdateSchema, ContainerLayoutStateChangedSchema, ContainerModeChangeAckSchema, ContainerModeChangeSchema, FLAG_DEFAULTS, GAEventSchema, HtmlViewCloseSchema, HtmlViewOpenSchema, TapKitInitializationError as InitializationError, MaterialViewCloseSchema, MaterialViewErrorSchema, MaterialViewOpenSchema, MaterialViewerError, PopUpCloseSchema, PopUpOpenSchema, TAP_BUTTON_CLICK_EVENT, TAP_ERROR_MARKER, TapCloseSchema, TapKitConfigurationError, TapKitError, TapKitIframeError, TapKitInitializationError, TapKitLoaderError, TapKitMessageError, TapMessageSchema, TapReadySchema, TimelineSeekSchema, TutorInfoSchema, ViewportResizeSchema, isFeatureEnabled };
|
|
943
|
+
export { ALARM_DURATION, AlarmClickSchema, AlarmElementPropsSchema, AlarmElementSchema, AlarmFadeInSchema, AlarmMessageInstanceSchema, CSSStyleSchema, ConfigRequestSchema, ConfigUpdateSchema, ContainerLayoutStateChangedSchema, ContainerModeChangeAckSchema, ContainerModeChangeSchema, FLAG_DEFAULTS, GAEventSchema, HostContextSchema, HtmlViewCloseSchema, HtmlViewOpenSchema, TapKitInitializationError as InitializationError, MaterialViewCloseSchema, MaterialViewErrorSchema, MaterialViewOpenSchema, MaterialViewerError, PopUpCloseSchema, PopUpOpenSchema, TAP_BUTTON_CLICK_EVENT, TAP_ERROR_MARKER, TapCloseSchema, TapKitConfigurationError, TapKitError, TapKitIframeError, TapKitInitializationError, TapKitLoaderError, TapKitMessageError, TapMessageSchema, TapReadySchema, TimelineSeekSchema, TutorInfoSchema, ViewportResizeSchema, isFeatureEnabled };
|
|
938
944
|
//# sourceMappingURL=index.js.map
|
|
939
945
|
//# sourceMappingURL=index.js.map
|