@coxwave/tap-kit-types 0.0.37 → 0.0.39

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 CHANGED
@@ -1,5 +1,25 @@
1
- import { AlarmMessageInstanceType } from '@coxwave/tap-messages';
2
- export { AlarmMessageInstanceType, AlarmType } from '@coxwave/tap-messages';
1
+ type AlarmType = "quiz" | "pingMessage" | "callToAction" | "hourSpent" | "default";
2
+ interface AlarmMessageInstanceType {
3
+ message: string;
4
+ question?: string;
5
+ pingMessageId?: string;
6
+ type: AlarmType;
7
+ priority: number;
8
+ }
9
+
10
+ interface ConfigUpdateMessage {
11
+ type: "config:update";
12
+ apiKey?: string | undefined;
13
+ hostOrigin?: string | undefined;
14
+ tapUrl?: string | undefined;
15
+ apiUrl?: string | undefined;
16
+ environment?: "dev" | "prod" | undefined;
17
+ language?: string | undefined;
18
+ userId?: string | undefined;
19
+ courseId?: string | undefined;
20
+ clipId?: string | undefined;
21
+ clipPlayHead?: number | undefined;
22
+ }
3
23
 
4
24
  /**
5
25
  * Styling Types
@@ -24,9 +44,6 @@ type ContainerStyle = {
24
44
  */
25
45
  type CustomStyles = ContainerStyle;
26
46
 
27
- /**
28
- * Core Configuration Types
29
- */
30
47
  /**
31
48
  * SDK Configuration (Public API)
32
49
  * Constructor only accepts apiKey for simplicity
@@ -40,29 +57,23 @@ type TapKitConfig = {
40
57
  apiKey: string;
41
58
  };
42
59
  /**
43
- * Runtime Configuration Options (Internal API)
60
+ * Runtime configuration sent to iframe via config:update message
61
+ * Derived from ConfigUpdateMessage protocol (without 'type' field)
62
+ * This ensures type consistency between iframe messages and config
63
+ */
64
+ type TapKitRuntimeConfig = Omit<ConfigUpdateMessage, 'type'>;
65
+ /**
66
+ * All SDK Configuration Options (Internal API)
67
+ * Derived from ConfigUpdateMessage protocol for type consistency
44
68
  * Used by Symbol-based config() method for advanced configuration
45
69
  *
70
+ * Note: All fields (tapUrl, environment, etc.) are now part of TapKitRuntimeConfig
71
+ * which is based on ConfigUpdateMessage. This ensures consistency between
72
+ * SDK configuration and iframe message protocol.
73
+ *
46
74
  * @internal This is not part of the public API
47
75
  */
48
- type TapKitConfigOptions = {
49
- /**
50
- * Custom TAP iframe URL
51
- * Default: https://edutap-ai.vercel.app
52
- */
53
- tapUrl?: string;
54
- /**
55
- * Custom API URL
56
- * Default: https://tapapi.coxwave.link
57
- */
58
- apiUrl?: string;
59
- /**
60
- * Environment mode
61
- * - 'dev': Console logging enabled (default)
62
- * - 'prod': Google Analytics logging
63
- */
64
- environment?: 'dev' | 'prod';
65
- };
76
+ type TapKitConfigOptions = TapKitRuntimeConfig;
66
77
  /**
67
78
  * Course Information
68
79
  */
@@ -103,7 +114,12 @@ type ShortcutKeyPropertiesType = {
103
114
  */
104
115
  type ContainerVisibility = "open" | "closed";
105
116
 
106
- /** @internal Symbol for internal configuration method */
117
+ /**
118
+ * @internal
119
+ * Type-only symbol reference for internal configuration method
120
+ * Actual symbol value: Symbol.for("tapkit.config")
121
+ * Use this type in interface definitions, create actual symbol in implementation packages
122
+ */
107
123
  declare const TAPKIT_CONFIG_SYMBOL: unique symbol;
108
124
  /** TapKit instance interface - shared by tap-kit-core and tap-sdk */
109
125
  interface TapKitInstance {
@@ -119,8 +135,8 @@ interface TapKitInstance {
119
135
  ready: Promise<void>;
120
136
  init(params: TapKitInitParams): Promise<void>;
121
137
  destroy(): void;
122
- /** @internal Advanced configuration API */
123
- [TAPKIT_CONFIG_SYMBOL](options: TapKitConfigOptions): void;
138
+ /** @internal Advanced configuration API using Symbol.for("tapkit.config") */
139
+ [TAPKIT_CONFIG_SYMBOL]?(options: TapKitConfigOptions): void;
124
140
  }
125
141
  /** TapKit constructor type */
126
142
  type TapKitConstructor = new (config: TapKitConfig) => TapKitInstance;
@@ -212,4 +228,4 @@ declare global {
212
228
  function cancelIdleCallback(handle: number): void;
213
229
  }
214
230
 
215
- export { type ContainerStyle, type ContainerVisibility, type Course, type CustomStyles, TapKitInitializationError as InitializationError, type PositionType, type SeekTimelineParamsType, type ShortcutKeyPropertiesType, TAPKIT_CONFIG_SYMBOL, TAP_ERROR_MARKER, type TapErrorOptions, type TapKitConfig, type TapKitConfigOptions, TapKitConfigurationError, type TapKitConstructor, TapKitError, TapKitIframeError, type TapKitInitParams, TapKitInitializationError, type TapKitInstance, TapKitLoaderError, TapKitMessageError };
231
+ export { type AlarmMessageInstanceType, type AlarmType, type ContainerStyle, type ContainerVisibility, type Course, type CustomStyles, TapKitInitializationError as InitializationError, type PositionType, type SeekTimelineParamsType, type ShortcutKeyPropertiesType, 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/dist/index.js CHANGED
@@ -2,9 +2,6 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
 
5
- // src/instance.ts
6
- var TAPKIT_CONFIG_SYMBOL = Symbol.for("tapkit.config");
7
-
8
5
  // src/errors.ts
9
6
  var TAP_ERROR_MARKER = "__tap_sdk_error__";
10
7
  var TapKitError = class _TapKitError extends Error {
@@ -134,6 +131,6 @@ var TapKitIframeError = class _TapKitIframeError extends TapKitError {
134
131
  }
135
132
  };
136
133
 
137
- export { TapKitInitializationError as InitializationError, TAPKIT_CONFIG_SYMBOL, TAP_ERROR_MARKER, TapKitConfigurationError, TapKitError, TapKitIframeError, TapKitInitializationError, TapKitLoaderError, TapKitMessageError };
134
+ export { TapKitInitializationError as InitializationError, TAP_ERROR_MARKER, TapKitConfigurationError, TapKitError, TapKitIframeError, TapKitInitializationError, TapKitLoaderError, TapKitMessageError };
138
135
  //# sourceMappingURL=index.js.map
139
136
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/instance.ts","../src/errors.ts"],"names":[],"mappings":";;;;;AAKO,IAAM,oBAAA,GAAsC,MAAA,CAAO,GAAA,CAAI,eAAe;;;ACDtE,IAAM,gBAAA,GAAmB;AAWzB,IAAM,WAAA,GAAN,MAAM,YAAA,SAAoB,KAAA,CAAM;AAAA,EAIrC,WAAA,CAAY,SAAiB,OAAA,EAA2B;AACtD,IAAA,KAAA,CAAM,OAAO,CAAA;AAJf,IAAA,aAAA,CAAA,IAAA,EAAS,OAAA,CAAA;AACT,IAAA,aAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAIE,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,IAAA,CAAK,OAAO,OAAA,EAAS,IAAA;AACrB,IAAA,IAAA,CAAK,QAAQ,OAAA,EAAS,KAAA;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,2BAA2B,KAAA,EAAgC;AAChE,IAAA,IAAI,iBAAiB,YAAA,EAAa;AAChC,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,IACE,KAAA,IACA,OAAO,KAAA,KAAU,QAAA,IACjB,oBAAoB,KAAA,IACpB,KAAA,CAAM,gBAAgB,CAAA,KAAM,aAAA,EAC5B;AACA,MAAA,MAAM,GAAA,GAAM,IAAI,YAAA,CAAY,KAAA,CAAM,OAAA,EAAS;AAAA,QACzC,MAAM,KAAA,CAAM;AAAA,OACb,CAAA;AACD,MAAA,GAAA,CAAI,QAAQ,KAAA,CAAM,KAAA;AAClB,MAAA,OAAO,GAAA;AAAA,IACT;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAKO,IAAM,yBAAA,GAAN,MAAM,0BAAA,SAAkC,WAAA,CAAY;AAAA,EACzD,WAAA,CAAY,SAAiB,OA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iB,kBAAA,EAAmB;AACtC,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,IACE,KAAA,IACA,OAAO,KAAA,KAAU,QAAA,IACjB,oBAAoB,KAAA,IACpB,KAAA,CAAM,gBAAgB,CAAA,KAAM,mBAAA,EAC5B;AACA,MAAA,MAAM,GAAA,GAAM,IAAI,kBAAA,CAAkB,KAAA,CAAM,OAAA,EAAS;AAAA,QAC/C,MAAM,KAAA,CAAM;AAAA,OACb,CAAA;AACD,MAAA,GAAA,CAAI,QAAQ,KAAA,CAAM,KAAA;AAClB,MAAA,OAAO,GAAA;AAAA,IACT;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAKO,IAAM,iBAAA,GAAN,MAAM,kBAAA,SAA0B,WAAA,CAAY;AAAA,EACjD,WAAA,CAAY,SAAiB,OAAA,EAA2B;AACtD,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,SAAS,IAAA,IAAQ,YAAA;AAAA,EAC/B;AAAA,EAEA,OAAgB,2BACd,KAAA,EAC0B;AAC1B,IAAA,IAAI,iBAAiB,kBAAA,EAAmB;AACtC,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,IACE,KAAA,IACA,OAAO,KAAA,KAAU,QAAA,IACjB,oBAAoB,KAAA,IACpB,KAAA,CAAM,gBAAgB,CAAA,KAAM,mBAAA,EAC5B;AACA,MAAA,MAAM,GAAA,GAAM,IAAI,kBAAA,CAAkB,KAAA,CAAM,OAAA,EAAS;AAAA,QAC/C,MAAM,KAAA,CAAM;AAAA,OACb,CAAA;AACD,MAAA,GAAA,CAAI,QAAQ,KAAA,CAAM,KAAA;AAClB,MAAA,OAAO,GAAA;AAAA,IACT;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"index.js","sourcesContent":["import type { AlarmMessageInstanceType } from \"@coxwave/tap-messages\";\nimport type { SeekTimelineParamsType } from \"./events\";\nimport type { TapKitConfig, TapKitConfigOptions, TapKitInitParams } from \"./config.js\";\n\n/** @internal Symbol for internal configuration method */\nexport const TAPKIT_CONFIG_SYMBOL: unique symbol = Symbol.for(\"tapkit.config\") as any;\n\n/** TapKit instance interface - shared by tap-kit-core and tap-sdk */\nexport interface TapKitInstance {\n events: {\n seekTimeline: (params: SeekTimelineParamsType) => Promise<void>;\n onTimelineSeek: (callback: (clipPlayHead: number, clipId: string) => void) => () => void;\n onChatOpened: (handler: () => void) => () => void;\n onChatClosed: (handler: () => void) => () => void;\n onAlarmFadeIn: (handler: (messageInfo: AlarmMessageInstanceType) => void) => () => void;\n };\n isOpen: boolean;\n isInitialized: boolean;\n ready: Promise<void>;\n init(params: TapKitInitParams): Promise<void>;\n destroy(): void;\n /** @internal Advanced configuration API */\n [TAPKIT_CONFIG_SYMBOL](options: TapKitConfigOptions): void;\n}\n\n/** TapKit constructor type */\nexport type TapKitConstructor = new (config: TapKitConfig) => TapKitInstance;\n","/**\n * Error Classes\n */\n\nexport const TAP_ERROR_MARKER = \"__tap_sdk_error__\";\n\nexport interface TapErrorOptions {\n code?: string;\n cause?: Error;\n}\n\n/**\n * Base error class for all TapKit errors\n * Supports serialization across iframe boundaries\n */\nexport class TapKitError extends Error {\n override cause: Error | undefined;\n code: string | undefined;\n\n constructor(message: string, options?: TapErrorOptions) {\n super(message);\n this.name = \"TapKitError\";\n this.code = options?.code;\n this.cause = options?.cause;\n }\n\n /**\n * Restore error from postMessage serialization\n */\n static fromPossibleFrameSafeError(error: any): TapKitError | null {\n if (error instanceof TapKitError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitError\"\n ) {\n const err = new TapKitError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when SDK initialization fails\n */\nexport class TapKitInitializationError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitInitializationError\";\n this.code = options?.code ?? \"ERR_INITIALIZATION\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitInitializationError | null {\n if (error instanceof TapKitInitializationError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitInitializationError\"\n ) {\n const err = new TapKitInitializationError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when message communication fails\n */\nexport class TapKitMessageError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitMessageError\";\n this.code = options?.code ?? \"ERR_MESSAGE\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitMessageError | null {\n if (error instanceof TapKitMessageError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitMessageError\"\n ) {\n const err = new TapKitMessageError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when configuration is invalid\n */\nexport class TapKitConfigurationError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitConfigurationError\";\n this.code = options?.code ?? \"ERR_CONFIGURATION\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitConfigurationError | null {\n if (error instanceof TapKitConfigurationError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitConfigurationError\"\n ) {\n const err = new TapKitConfigurationError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when loader fails to fetch or load resources\n */\nexport class TapKitLoaderError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitLoaderError\";\n this.code = options?.code ?? \"ERR_LOADER\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitLoaderError | null {\n if (error instanceof TapKitLoaderError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitLoaderError\"\n ) {\n const err = new TapKitLoaderError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when iframe operations fail\n */\nexport class TapKitIframeError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitIframeError\";\n this.code = options?.code ?? \"ERR_IFRAME\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitIframeError | null {\n if (error instanceof TapKitIframeError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitIframeError\"\n ) {\n const err = new TapKitIframeError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n// Backward compatibility alias\nexport { TapKitInitializationError as InitializationError };\n"]}
1
+ {"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;;;AAIO,IAAM,gBAAA,GAAmB;AAWzB,IAAM,WAAA,GAAN,MAAM,YAAA,SAAoB,KAAA,CAAM;AAAA,EAIrC,WAAA,CAAY,SAAiB,OAAA,EAA2B;AACtD,IAAA,KAAA,CAAM,OAAO,CAAA;AAJf,IAAA,aAAA,CAAA,IAAA,EAAS,OAAA,CAAA;AACT,IAAA,aAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAIE,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,IAAA,CAAK,OAAO,OAAA,EAAS,IAAA;AACrB,IAAA,IAAA,CAAK,QAAQ,OAAA,EAAS,KAAA;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A,GAAO,SAAS,IAAA,IAAQ,YAAA;AAAA,EAC/B;AAAA,EAEA,OAAgB,2BACd,KAAA,EAC0B;AAC1B,IAAA,IAAI,iBAAiB,kBAAA,EAAmB;AACtC,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,IACE,KAAA,IACA,OAAO,KAAA,KAAU,QAAA,IACjB,oBAAoB,KAAA,IACpB,KAAA,CAAM,gBAAgB,CAAA,KAAM,mBAAA,EAC5B;AACA,MAAA,MAAM,GAAA,GAAM,IAAI,kBAAA,CAAkB,KAAA,CAAM,OAAA,EAAS;AAAA,QAC/C,MAAM,KAAA,CAAM;AAAA,OACb,CAAA;AACD,MAAA,GAAA,CAAI,QAAQ,KAAA,CAAM,KAAA;AAClB,MAAA,OAAO,GAAA;AAAA,IACT;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"index.js","sourcesContent":["/**\n * Error Classes\n */\n\nexport const TAP_ERROR_MARKER = \"__tap_sdk_error__\";\n\nexport interface TapErrorOptions {\n code?: string;\n cause?: Error;\n}\n\n/**\n * Base error class for all TapKit errors\n * Supports serialization across iframe boundaries\n */\nexport class TapKitError extends Error {\n override cause: Error | undefined;\n code: string | undefined;\n\n constructor(message: string, options?: TapErrorOptions) {\n super(message);\n this.name = \"TapKitError\";\n this.code = options?.code;\n this.cause = options?.cause;\n }\n\n /**\n * Restore error from postMessage serialization\n */\n static fromPossibleFrameSafeError(error: any): TapKitError | null {\n if (error instanceof TapKitError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitError\"\n ) {\n const err = new TapKitError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when SDK initialization fails\n */\nexport class TapKitInitializationError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitInitializationError\";\n this.code = options?.code ?? \"ERR_INITIALIZATION\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitInitializationError | null {\n if (error instanceof TapKitInitializationError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitInitializationError\"\n ) {\n const err = new TapKitInitializationError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when message communication fails\n */\nexport class TapKitMessageError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitMessageError\";\n this.code = options?.code ?? \"ERR_MESSAGE\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitMessageError | null {\n if (error instanceof TapKitMessageError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitMessageError\"\n ) {\n const err = new TapKitMessageError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when configuration is invalid\n */\nexport class TapKitConfigurationError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitConfigurationError\";\n this.code = options?.code ?? \"ERR_CONFIGURATION\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitConfigurationError | null {\n if (error instanceof TapKitConfigurationError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitConfigurationError\"\n ) {\n const err = new TapKitConfigurationError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when loader fails to fetch or load resources\n */\nexport class TapKitLoaderError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitLoaderError\";\n this.code = options?.code ?? \"ERR_LOADER\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitLoaderError | null {\n if (error instanceof TapKitLoaderError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitLoaderError\"\n ) {\n const err = new TapKitLoaderError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n/**\n * Error thrown when iframe operations fail\n */\nexport class TapKitIframeError extends TapKitError {\n constructor(message: string, options?: TapErrorOptions) {\n super(message, options);\n this.name = \"TapKitIframeError\";\n this.code = options?.code ?? \"ERR_IFRAME\";\n }\n\n static override fromPossibleFrameSafeError(\n error: any\n ): TapKitIframeError | null {\n if (error instanceof TapKitIframeError) {\n return error;\n }\n if (\n error &&\n typeof error === \"object\" &&\n TAP_ERROR_MARKER in error &&\n error[TAP_ERROR_MARKER] === \"TapKitIframeError\"\n ) {\n const err = new TapKitIframeError(error.message, {\n code: error.code,\n });\n err.stack = error.stack;\n return err;\n }\n return null;\n }\n}\n\n// Backward compatibility alias\nexport { TapKitInitializationError as InitializationError };\n"]}
package/index.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  export type { AlarmMessageInstanceType, AlarmType } from "@coxwave/tap-messages";
11
11
 
12
12
  // Configuration types
13
- export type { TapKitConfig, TapKitConfigOptions, TapKitInitParams, Course } from "./src/config.js";
13
+ export type { TapKitConfig, TapKitRuntimeConfig, TapKitConfigOptions, TapKitInitParams, Course } from "./src/config.js";
14
14
 
15
15
  // Styling types
16
16
  export type { ContainerStyle, PositionType, CustomStyles } from "./src/styles.js";
@@ -19,9 +19,7 @@ export type { ContainerStyle, PositionType, CustomStyles } from "./src/styles.js
19
19
  export type { SeekTimelineParamsType, ShortcutKeyPropertiesType, ContainerVisibility } from "./src/events.js";
20
20
 
21
21
  // Instance types
22
- export type { TapKitInstance, TapKitConstructor } from "./src/instance.js";
23
-
24
- export { TAPKIT_CONFIG_SYMBOL } from "./src/instance.js";
22
+ export type { TapKitInstance, TapKitConstructor, TAPKIT_CONFIG_SYMBOL } from "./src/instance.js";
25
23
 
26
24
  // Error types and classes
27
25
  export type { TapErrorOptions } from "./src/errors.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coxwave/tap-kit-types",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "type": "module",
5
5
  "description": "Shared TypeScript types for TapKit SDK packages",
6
6
  "main": "dist/index.js",
@@ -28,9 +28,6 @@
28
28
  "dist",
29
29
  "index.ts"
30
30
  ],
31
- "peerDependencies": {
32
- "@coxwave/tap-messages": "^0.0.1"
33
- },
34
31
  "devDependencies": {
35
32
  "@coxwave/config-eslint": "workspace:*",
36
33
  "@coxwave/config-typescript": "workspace:*",