@coxwave/tap-kit-types 2.0.7 → 2.0.9
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 +72 -6
- package/dist/index.js +17 -28
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -123,7 +123,7 @@ type PositionType = {
|
|
|
123
123
|
type FloatingConfig = {
|
|
124
124
|
/** Position (default: top: "50px", right: "24px") */
|
|
125
125
|
position?: PositionType;
|
|
126
|
-
/** Width (default: "
|
|
126
|
+
/** Width (default: "430px") */
|
|
127
127
|
width?: string;
|
|
128
128
|
/** Height (default: "calc(100% - 116px)") */
|
|
129
129
|
height?: string;
|
|
@@ -178,8 +178,8 @@ type ContainerConfig = {
|
|
|
178
178
|
sidebarConfig?: SidebarConfig;
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
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" | "GA_EVENT";
|
|
182
|
-
type TapMessage = TapReadyMessage | TapCloseMessage | TimelineSeekMessage | AlarmClickMessage | AlarmFadeInMessage | PopUpOpenMessage | PopUpCloseMessage | MaterialViewOpenMessage | MaterialViewCloseMessage | MaterialViewErrorMessage | HtmlViewOpenMessage | HtmlViewCloseMessage | ContainerModeChangeMessage | ContainerModeChangeAckMessage | ContainerLayoutStateChangedMessage | ViewportResizeMessage | ConfigUpdateMessage | GAEventMessage;
|
|
181
|
+
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";
|
|
182
|
+
type TapMessage = TapReadyMessage | TapCloseMessage | TimelineSeekMessage | AlarmClickMessage | AlarmFadeInMessage | PopUpOpenMessage | PopUpCloseMessage | MaterialViewOpenMessage | MaterialViewCloseMessage | MaterialViewErrorMessage | HtmlViewOpenMessage | HtmlViewCloseMessage | ContainerModeChangeMessage | ContainerModeChangeAckMessage | ContainerLayoutStateChangedMessage | ViewportResizeMessage | ConfigUpdateMessage | ConfigRequestMessage | GAEventMessage | TutorInfoMessage;
|
|
183
183
|
interface TapReadyMessage {
|
|
184
184
|
type: "tap:ready";
|
|
185
185
|
gaId: string;
|
|
@@ -222,6 +222,7 @@ interface MaterialViewOpenMessage {
|
|
|
222
222
|
presignedUrl: string;
|
|
223
223
|
pageStart: number;
|
|
224
224
|
pageEnd: number;
|
|
225
|
+
title?: string;
|
|
225
226
|
nonce?: string | number;
|
|
226
227
|
}
|
|
227
228
|
/**
|
|
@@ -367,6 +368,21 @@ interface ConfigUpdateMessage {
|
|
|
367
368
|
};
|
|
368
369
|
};
|
|
369
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* Config Request Message (iframe → parent, call/handle pattern)
|
|
373
|
+
*
|
|
374
|
+
* Used for self-heal when iframe misses initial config:update.
|
|
375
|
+
* Response: ConfigUpdateMessage fields via :ack (auto-generated by call/handle)
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* // iframe requests config
|
|
379
|
+
* const config = await messenger.call("config:request", {});
|
|
380
|
+
* // → receives config:request:ack with ConfigUpdateMessage fields
|
|
381
|
+
*/
|
|
382
|
+
interface ConfigRequestMessage {
|
|
383
|
+
type: "config:request";
|
|
384
|
+
nonce?: string | number;
|
|
385
|
+
}
|
|
370
386
|
/**
|
|
371
387
|
* Google Analytics Event Message (iframe → parent)
|
|
372
388
|
* Sent from edutap iframe to tap-kit-core for analytics tracking
|
|
@@ -375,6 +391,15 @@ interface GAEventMessage {
|
|
|
375
391
|
type: "GA_EVENT";
|
|
376
392
|
payload: Record<string, unknown>;
|
|
377
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Tutor Info Message (iframe → parent)
|
|
396
|
+
* Sent from edutap after tutor_setting API response
|
|
397
|
+
* Contains tutor name for button tooltip customization
|
|
398
|
+
*/
|
|
399
|
+
interface TutorInfoMessage {
|
|
400
|
+
type: "tutor:info";
|
|
401
|
+
tutorName: string;
|
|
402
|
+
}
|
|
378
403
|
|
|
379
404
|
/**
|
|
380
405
|
* Fallback type.
|
|
@@ -2202,10 +2227,18 @@ declare const ConfigUpdateSchema: ObjectSchema<{
|
|
|
2202
2227
|
}, undefined>, undefined>;
|
|
2203
2228
|
}, undefined>, undefined>;
|
|
2204
2229
|
}, undefined>;
|
|
2230
|
+
declare const ConfigRequestSchema: ObjectSchema<{
|
|
2231
|
+
readonly type: LiteralSchema<"config:request", undefined>;
|
|
2232
|
+
readonly nonce: OptionalSchema<UnionSchema<[StringSchema<undefined>, NumberSchema<undefined>], undefined>, undefined>;
|
|
2233
|
+
}, undefined>;
|
|
2205
2234
|
declare const GAEventSchema: ObjectSchema<{
|
|
2206
2235
|
readonly type: LiteralSchema<"GA_EVENT", undefined>;
|
|
2207
2236
|
readonly payload: RecordSchema<StringSchema<undefined>, AnySchema, undefined>;
|
|
2208
2237
|
}, undefined>;
|
|
2238
|
+
declare const TutorInfoSchema: ObjectSchema<{
|
|
2239
|
+
readonly type: LiteralSchema<"tutor:info", undefined>;
|
|
2240
|
+
readonly tutorName: StringSchema<undefined>;
|
|
2241
|
+
}, undefined>;
|
|
2209
2242
|
declare const TapMessageSchema: UnionSchema<[ObjectSchema<{
|
|
2210
2243
|
readonly type: LiteralSchema<"tap:ready", undefined>;
|
|
2211
2244
|
readonly gaId: StringSchema<undefined>;
|
|
@@ -2303,9 +2336,15 @@ declare const TapMessageSchema: UnionSchema<[ObjectSchema<{
|
|
|
2303
2336
|
readonly minViewportWidth: OptionalSchema<NumberSchema<undefined>, undefined>;
|
|
2304
2337
|
}, undefined>, undefined>;
|
|
2305
2338
|
}, undefined>, undefined>;
|
|
2339
|
+
}, undefined>, ObjectSchema<{
|
|
2340
|
+
readonly type: LiteralSchema<"config:request", undefined>;
|
|
2341
|
+
readonly nonce: OptionalSchema<UnionSchema<[StringSchema<undefined>, NumberSchema<undefined>], undefined>, undefined>;
|
|
2306
2342
|
}, undefined>, ObjectSchema<{
|
|
2307
2343
|
readonly type: LiteralSchema<"GA_EVENT", undefined>;
|
|
2308
2344
|
readonly payload: RecordSchema<StringSchema<undefined>, AnySchema, undefined>;
|
|
2345
|
+
}, undefined>, ObjectSchema<{
|
|
2346
|
+
readonly type: LiteralSchema<"tutor:info", undefined>;
|
|
2347
|
+
readonly tutorName: StringSchema<undefined>;
|
|
2309
2348
|
}, undefined>], undefined>;
|
|
2310
2349
|
|
|
2311
2350
|
type TapMessageRecord = TapMessage;
|
|
@@ -2617,8 +2656,12 @@ type ContainerVisibility = "open" | "closed";
|
|
|
2617
2656
|
interface VideoPlayerAdapter {
|
|
2618
2657
|
/** Get current playback time in seconds */
|
|
2619
2658
|
getCurrentTime: () => number;
|
|
2620
|
-
/**
|
|
2621
|
-
|
|
2659
|
+
/**
|
|
2660
|
+
* Set playback time in seconds
|
|
2661
|
+
* @param time - Playback time in seconds
|
|
2662
|
+
* @param clipId - ClipId from the seek request (for cross-clip seeking)
|
|
2663
|
+
*/
|
|
2664
|
+
setCurrentTime: (time: number, clipId: string) => void;
|
|
2622
2665
|
}
|
|
2623
2666
|
/**
|
|
2624
2667
|
* Video Player Configuration
|
|
@@ -3583,6 +3626,16 @@ interface MaterialViewConfig {
|
|
|
3583
3626
|
* Ending page number (1-indexed)
|
|
3584
3627
|
*/
|
|
3585
3628
|
pageEnd: number;
|
|
3629
|
+
|
|
3630
|
+
/**
|
|
3631
|
+
* Text phrases to highlight in PDF (from reference_string parsing)
|
|
3632
|
+
*/
|
|
3633
|
+
highlightPhrases?: string[];
|
|
3634
|
+
|
|
3635
|
+
/**
|
|
3636
|
+
* Optional title for the viewer header
|
|
3637
|
+
*/
|
|
3638
|
+
title?: string;
|
|
3586
3639
|
}
|
|
3587
3640
|
|
|
3588
3641
|
/**
|
|
@@ -3616,6 +3669,19 @@ interface ITapMaterialViewerElement extends HTMLElement {
|
|
|
3616
3669
|
*/
|
|
3617
3670
|
open(config: MaterialViewConfig): Promise<void>;
|
|
3618
3671
|
|
|
3672
|
+
/**
|
|
3673
|
+
* Open material viewer with HTML URL
|
|
3674
|
+
*
|
|
3675
|
+
* Loads HTML content directly in iframe without PDF processing.
|
|
3676
|
+
* Useful for viewing HTML documents or web pages.
|
|
3677
|
+
*
|
|
3678
|
+
* @param url - URL of the HTML content to display
|
|
3679
|
+
* @param materialId - Optional identifier for the material (defaults to 'html')
|
|
3680
|
+
* @fires error - When HTML loading fails
|
|
3681
|
+
* @fires open - When HTML is successfully displayed
|
|
3682
|
+
*/
|
|
3683
|
+
openHtml(url: string, materialId?: string): void;
|
|
3684
|
+
|
|
3619
3685
|
/**
|
|
3620
3686
|
* Close material viewer and cleanup resources
|
|
3621
3687
|
*
|
|
@@ -3781,4 +3847,4 @@ declare global {
|
|
|
3781
3847
|
function cancelIdleCallback(handle: number): void;
|
|
3782
3848
|
}
|
|
3783
3849
|
|
|
3784
|
-
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 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, 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 VideoController, type VideoPlayerAdapter, type VideoPlayerConfig, type ViewportResizeMessage, ViewportResizeSchema };
|
|
3850
|
+
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 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, 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 };
|
package/dist/index.js
CHANGED
|
@@ -733,10 +733,7 @@ function union(options, message2) {
|
|
|
733
733
|
}
|
|
734
734
|
|
|
735
735
|
// src/protocol/schema.ts
|
|
736
|
-
var CSSStyleSchema = record(
|
|
737
|
-
string(),
|
|
738
|
-
union([string(), number()])
|
|
739
|
-
);
|
|
736
|
+
var CSSStyleSchema = record(string(), union([string(), number()]));
|
|
740
737
|
var AlarmElementPropsSchema = object({
|
|
741
738
|
style: optional(CSSStyleSchema),
|
|
742
739
|
className: optional(string()),
|
|
@@ -811,12 +808,7 @@ var MaterialViewCloseSchema = object({
|
|
|
811
808
|
var MaterialViewErrorSchema = object({
|
|
812
809
|
type: literal("material:view:error"),
|
|
813
810
|
materialId: string(),
|
|
814
|
-
error: union([
|
|
815
|
-
literal("fetch_failed"),
|
|
816
|
-
literal("expired_url"),
|
|
817
|
-
literal("extraction_failed"),
|
|
818
|
-
literal("unknown")
|
|
819
|
-
]),
|
|
811
|
+
error: union([literal("fetch_failed"), literal("expired_url"), literal("extraction_failed"), literal("unknown")]),
|
|
820
812
|
message: optional(string())
|
|
821
813
|
});
|
|
822
814
|
var HtmlViewOpenSchema = object({
|
|
@@ -836,11 +828,7 @@ var ContainerModeChangeSchema = object({
|
|
|
836
828
|
var ContainerModeChangeAckSchema = object({
|
|
837
829
|
type: literal("container:mode:change:ack"),
|
|
838
830
|
success: boolean(),
|
|
839
|
-
currentMode: union([
|
|
840
|
-
literal("floating"),
|
|
841
|
-
literal("sidebar"),
|
|
842
|
-
literal("floating-forced")
|
|
843
|
-
]),
|
|
831
|
+
currentMode: union([literal("floating"), literal("sidebar"), literal("floating-forced")]),
|
|
844
832
|
nonce: optional(union([string(), number()]))
|
|
845
833
|
});
|
|
846
834
|
var ContainerLayoutStateChangedSchema = object({
|
|
@@ -858,22 +846,13 @@ var ConfigUpdateSchema = object({
|
|
|
858
846
|
hostOrigin: optional(string()),
|
|
859
847
|
tapUrl: optional(string()),
|
|
860
848
|
apiUrl: optional(string()),
|
|
861
|
-
environment: optional(
|
|
862
|
-
union([
|
|
863
|
-
literal("dev"),
|
|
864
|
-
literal("prod"),
|
|
865
|
-
literal("demo"),
|
|
866
|
-
literal("staging")
|
|
867
|
-
])
|
|
868
|
-
),
|
|
849
|
+
environment: optional(union([literal("dev"), literal("prod"), literal("demo"), literal("staging")])),
|
|
869
850
|
language: optional(string()),
|
|
870
851
|
userId: optional(string()),
|
|
871
852
|
courseId: optional(string()),
|
|
872
853
|
clipId: optional(string()),
|
|
873
854
|
clipPlayHead: optional(number()),
|
|
874
|
-
mode: optional(
|
|
875
|
-
union([literal("inline"), literal("floating"), literal("sidebar")])
|
|
876
|
-
),
|
|
855
|
+
mode: optional(union([literal("inline"), literal("floating"), literal("sidebar")])),
|
|
877
856
|
allowLayoutToggle: optional(boolean()),
|
|
878
857
|
container: optional(
|
|
879
858
|
object({
|
|
@@ -901,11 +880,19 @@ var ConfigUpdateSchema = object({
|
|
|
901
880
|
})
|
|
902
881
|
)
|
|
903
882
|
});
|
|
883
|
+
var ConfigRequestSchema = object({
|
|
884
|
+
type: literal("config:request"),
|
|
885
|
+
nonce: optional(union([string(), number()]))
|
|
886
|
+
});
|
|
904
887
|
var GAEventSchema = object({
|
|
905
888
|
type: literal("GA_EVENT"),
|
|
906
889
|
payload: record(string(), any())
|
|
907
890
|
// 유연한 payload 구조
|
|
908
891
|
});
|
|
892
|
+
var TutorInfoSchema = object({
|
|
893
|
+
type: literal("tutor:info"),
|
|
894
|
+
tutorName: string()
|
|
895
|
+
});
|
|
909
896
|
var TapMessageSchema = union([
|
|
910
897
|
TapReadySchema,
|
|
911
898
|
TapCloseSchema,
|
|
@@ -924,12 +911,14 @@ var TapMessageSchema = union([
|
|
|
924
911
|
ContainerLayoutStateChangedSchema,
|
|
925
912
|
ViewportResizeSchema,
|
|
926
913
|
ConfigUpdateSchema,
|
|
927
|
-
|
|
914
|
+
ConfigRequestSchema,
|
|
915
|
+
GAEventSchema,
|
|
916
|
+
TutorInfoSchema
|
|
928
917
|
]);
|
|
929
918
|
|
|
930
919
|
// src/tap-button.d.ts
|
|
931
920
|
var TAP_BUTTON_CLICK_EVENT = "tap-button:click";
|
|
932
921
|
|
|
933
|
-
export { ALARM_DURATION, AlarmClickSchema, AlarmElementPropsSchema, AlarmElementSchema, AlarmFadeInSchema, AlarmMessageInstanceSchema, CSSStyleSchema, ConfigUpdateSchema, ContainerLayoutStateChangedSchema, ContainerModeChangeAckSchema, ContainerModeChangeSchema, 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, ViewportResizeSchema };
|
|
922
|
+
export { ALARM_DURATION, AlarmClickSchema, AlarmElementPropsSchema, AlarmElementSchema, AlarmFadeInSchema, AlarmMessageInstanceSchema, CSSStyleSchema, ConfigRequestSchema, ConfigUpdateSchema, ContainerLayoutStateChangedSchema, ContainerModeChangeAckSchema, ContainerModeChangeSchema, 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 };
|
|
934
923
|
//# sourceMappingURL=index.js.map
|
|
935
924
|
//# sourceMappingURL=index.js.map
|