@corti/dictation-web 0.0.0-test.562 → 0.0.0-test.571

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.
Files changed (129) hide show
  1. package/README.md +164 -112
  2. package/dist/bundle.js +1416 -546
  3. package/dist/components/audio-visualiser.d.ts +3 -2
  4. package/dist/components/audio-visualiser.js +15 -12
  5. package/dist/components/audio-visualiser.js.map +1 -1
  6. package/dist/components/corti-dictation.d.ts +26 -13
  7. package/dist/components/corti-dictation.js +70 -21
  8. package/dist/components/corti-dictation.js.map +1 -1
  9. package/dist/components/device-selector.d.ts +6 -16
  10. package/dist/components/device-selector.js +27 -58
  11. package/dist/components/device-selector.js.map +1 -1
  12. package/dist/components/keybinding-selector.d.ts +14 -0
  13. package/dist/components/keybinding-selector.js +81 -0
  14. package/dist/components/keybinding-selector.js.map +1 -0
  15. package/dist/components/language-selector.d.ts +8 -17
  16. package/dist/components/language-selector.js +26 -52
  17. package/dist/components/language-selector.js.map +1 -1
  18. package/dist/components/mode-selector.d.ts +14 -0
  19. package/dist/components/mode-selector.js +73 -0
  20. package/dist/components/mode-selector.js.map +1 -0
  21. package/dist/components/recording-button.d.ts +8 -14
  22. package/dist/components/recording-button.js +155 -96
  23. package/dist/components/recording-button.js.map +1 -1
  24. package/dist/components/settings-menu.d.ts +4 -2
  25. package/dist/components/settings-menu.js +34 -14
  26. package/dist/components/settings-menu.js.map +1 -1
  27. package/dist/constants.d.ts +5 -0
  28. package/dist/constants.js +5 -0
  29. package/dist/constants.js.map +1 -1
  30. package/dist/contexts/dictation-context.d.ts +24 -14
  31. package/dist/contexts/dictation-context.js +128 -46
  32. package/dist/contexts/dictation-context.js.map +1 -1
  33. package/dist/controllers/devices-controller.d.ts +26 -0
  34. package/dist/controllers/devices-controller.js +99 -0
  35. package/dist/controllers/devices-controller.js.map +1 -0
  36. package/dist/controllers/dictation-controller.d.ts +29 -0
  37. package/dist/controllers/dictation-controller.js +179 -0
  38. package/dist/controllers/dictation-controller.js.map +1 -0
  39. package/dist/controllers/keybinding-controller.d.ts +17 -0
  40. package/dist/controllers/keybinding-controller.js +80 -0
  41. package/dist/controllers/keybinding-controller.js.map +1 -0
  42. package/dist/controllers/languages-controller.d.ts +26 -0
  43. package/dist/controllers/languages-controller.js +83 -0
  44. package/dist/controllers/languages-controller.js.map +1 -0
  45. package/dist/controllers/media-controller.d.ts +24 -0
  46. package/dist/controllers/media-controller.js +115 -0
  47. package/dist/controllers/media-controller.js.map +1 -0
  48. package/dist/index.d.ts +9 -7
  49. package/dist/index.js +30 -20
  50. package/dist/index.js.map +1 -1
  51. package/dist/src/components/audio-visualiser.d.ts +1 -0
  52. package/dist/src/components/audio-visualiser.js +6 -3
  53. package/dist/src/components/audio-visualiser.js.map +1 -1
  54. package/dist/src/components/corti-dictation.d.ts +21 -6
  55. package/dist/src/components/corti-dictation.js +25 -2
  56. package/dist/src/components/corti-dictation.js.map +1 -1
  57. package/dist/src/components/recording-button.d.ts +4 -0
  58. package/dist/src/components/recording-button.js +34 -10
  59. package/dist/src/components/recording-button.js.map +1 -1
  60. package/dist/src/components/settings-menu.js +1 -1
  61. package/dist/src/components/settings-menu.js.map +1 -1
  62. package/dist/src/constants.js +24 -6
  63. package/dist/src/constants.js.map +1 -1
  64. package/dist/src/contexts/dictation-context.d.ts +19 -5
  65. package/dist/src/contexts/dictation-context.js +32 -12
  66. package/dist/src/contexts/dictation-context.js.map +1 -1
  67. package/dist/src/controllers/DictationController.d.ts +5 -0
  68. package/dist/src/controllers/DictationController.js +27 -8
  69. package/dist/src/controllers/DictationController.js.map +1 -1
  70. package/dist/src/controllers/MediaController.d.ts +6 -0
  71. package/dist/src/controllers/MediaController.js +17 -1
  72. package/dist/src/controllers/MediaController.js.map +1 -1
  73. package/dist/src/styles/ComponentStyles.js +5 -5
  74. package/dist/src/styles/ComponentStyles.js.map +1 -1
  75. package/dist/src/styles/audio-visualiser.js +1 -1
  76. package/dist/src/styles/audio-visualiser.js.map +1 -1
  77. package/dist/src/styles/buttons.js +12 -12
  78. package/dist/src/styles/buttons.js.map +1 -1
  79. package/dist/src/styles/callout.js +7 -7
  80. package/dist/src/styles/callout.js.map +1 -1
  81. package/dist/src/styles/select.js +8 -8
  82. package/dist/src/styles/select.js.map +1 -1
  83. package/dist/src/styles/settings-menu.js +4 -4
  84. package/dist/src/styles/settings-menu.js.map +1 -1
  85. package/dist/src/types.d.ts +5 -0
  86. package/dist/src/types.js.map +1 -1
  87. package/dist/src/utils/converters.js +4 -1
  88. package/dist/src/utils/converters.js.map +1 -1
  89. package/dist/src/utils/events.d.ts +11 -4
  90. package/dist/src/utils/events.js.map +1 -1
  91. package/dist/src/utils/languages.js +2 -1
  92. package/dist/src/utils/languages.js.map +1 -1
  93. package/dist/src/utils/media.d.ts +1 -1
  94. package/dist/src/utils/media.js +13 -1
  95. package/dist/src/utils/media.js.map +1 -1
  96. package/dist/src/utils/token.d.ts +1 -1
  97. package/dist/src/utils/token.js +12 -11
  98. package/dist/src/utils/token.js.map +1 -1
  99. package/dist/styles/buttons.js +1 -2
  100. package/dist/styles/buttons.js.map +1 -1
  101. package/dist/styles/component-styles.d.ts +3 -0
  102. package/dist/styles/component-styles.js +32 -0
  103. package/dist/styles/component-styles.js.map +1 -0
  104. package/dist/styles/keybinding-selector.d.ts +2 -0
  105. package/dist/styles/keybinding-selector.js +72 -0
  106. package/dist/styles/keybinding-selector.js.map +1 -0
  107. package/dist/styles/mode-selector.d.ts +2 -0
  108. package/dist/styles/mode-selector.js +54 -0
  109. package/dist/styles/mode-selector.js.map +1 -0
  110. package/dist/styles/select.d.ts +1 -1
  111. package/dist/styles/select.js +6 -10
  112. package/dist/styles/select.js.map +1 -1
  113. package/dist/styles/settings-menu.js +9 -1
  114. package/dist/styles/settings-menu.js.map +1 -1
  115. package/dist/tsconfig.stories.tsbuildinfo +1 -1
  116. package/dist/types.d.ts +3 -1
  117. package/dist/types.js.map +1 -1
  118. package/dist/utils/events.d.ts +12 -3
  119. package/dist/utils/events.js +14 -0
  120. package/dist/utils/events.js.map +1 -1
  121. package/dist/utils/keybinding.d.ts +49 -0
  122. package/dist/utils/keybinding.js +140 -0
  123. package/dist/utils/keybinding.js.map +1 -0
  124. package/dist/utils/languages.d.ts +4 -3
  125. package/dist/utils/languages.js.map +1 -1
  126. package/dist/utils/token.d.ts +1 -1
  127. package/dist/utils/token.js +12 -11
  128. package/dist/utils/token.js.map +1 -1
  129. package/package.json +9 -8
package/dist/types.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export type RecordingState = "initializing" | "recording" | "stopping" | "stopped";
2
- export type ConfigurableSettings = "device" | "language";
2
+ export type DictationMode = "toggle-to-talk" | "push-to-talk";
3
+ export type Keybinding = string;
4
+ export type ConfigurableSettings = "device" | "language" | "mode" | "keybinding";
3
5
  export type ProxyOptions = {
4
6
  url: string;
5
7
  protocols?: string[];
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type RecordingState =\n | \"initializing\"\n | \"recording\"\n | \"stopping\"\n | \"stopped\";\n\nexport type ConfigurableSettings = \"device\" | \"language\";\n\nexport type ProxyOptions = {\n url: string;\n protocols?: string[];\n queryParameters?: Record<string, string>;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type RecordingState =\n | \"initializing\"\n | \"recording\"\n | \"stopping\"\n | \"stopped\";\n\nexport type DictationMode = \"toggle-to-talk\" | \"push-to-talk\";\n\nexport type Keybinding = string;\n\nexport type ConfigurableSettings =\n | \"device\"\n | \"language\"\n | \"mode\"\n | \"keybinding\";\n\nexport type ProxyOptions = {\n url: string;\n protocols?: string[];\n queryParameters?: Record<string, string>;\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { Corti } from "@corti/sdk";
2
- import type { RecordingState } from "../types.js";
2
+ import type { DictationMode, RecordingState } from "../types.js";
3
3
  export type LanguagesChangedEventDetail = {
4
- languages: string[];
4
+ languages: Corti.TranscribeSupportedLanguage[];
5
5
  selectedLanguage: string | undefined;
6
6
  };
7
7
  export type LanguageChangedEventDetail = {
@@ -23,7 +23,7 @@ export type UsageEventDetail = Corti.TranscribeUsageMessage;
23
23
  export type ErrorEventDetail = {
24
24
  message: string;
25
25
  };
26
- export declare function languagesChangedEvent(languages: string[], selectedLanguage: string | undefined): CustomEvent<LanguagesChangedEventDetail>;
26
+ export declare function languagesChangedEvent(languages: Corti.TranscribeSupportedLanguage[], selectedLanguage: string | undefined): CustomEvent<LanguagesChangedEventDetail>;
27
27
  /**
28
28
  * @deprecated Use languagesChangedEvent instead. This event is kept for backward compatibility.
29
29
  */
@@ -42,3 +42,12 @@ export type NetworkActivityEventDetail = {
42
42
  data: unknown;
43
43
  };
44
44
  export declare function networkActivityEvent(direction: "sent" | "received", data: unknown): CustomEvent<NetworkActivityEventDetail>;
45
+ export type ModeChangedEventDetail = {
46
+ mode: DictationMode;
47
+ };
48
+ export type KeybindingChangedEventDetail = {
49
+ key: string | null | undefined;
50
+ code: string | null | undefined;
51
+ };
52
+ export declare function modeChangedEvent(mode: DictationMode): CustomEvent<ModeChangedEventDetail>;
53
+ export declare function keybindingChangedEvent(key: string | null | undefined, code: string | null | undefined): CustomEvent<KeybindingChangedEventDetail>;
@@ -85,4 +85,18 @@ export function networkActivityEvent(direction, data) {
85
85
  detail: { data, direction },
86
86
  });
87
87
  }
88
+ export function modeChangedEvent(mode) {
89
+ return new CustomEvent("mode-changed", {
90
+ bubbles: true,
91
+ composed: true,
92
+ detail: { mode },
93
+ });
94
+ }
95
+ export function keybindingChangedEvent(key, code) {
96
+ return new CustomEvent("keybinding-changed", {
97
+ bubbles: true,
98
+ composed: true,
99
+ detail: { code, key },
100
+ });
101
+ }
88
102
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names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dk\";\nimport type { RecordingState } from \"../types.js\";\n\nexport type LanguagesChangedEventDetail = {\n languages: string[];\n selectedLanguage: string | undefined;\n};\n\nexport type LanguageChangedEventDetail = {\n language: string;\n};\n\nexport type RecordingDevicesChangedEventDetail = {\n devices: MediaDeviceInfo[];\n selectedDevice: MediaDeviceInfo | undefined;\n};\n\nexport type RecordingStateChangedEventDetail = {\n state: RecordingState;\n};\n\nexport type AudioLevelChangedEventDetail = {\n audioLevel: number;\n};\n\nexport type TranscriptEventDetail = Corti.TranscribeTranscriptMessage;\nexport type CommandEventDetail = Corti.TranscribeCommandMessage;\nexport type UsageEventDetail = Corti.TranscribeUsageMessage;\n\nexport type ErrorEventDetail = {\n message: string;\n};\n\nexport function languagesChangedEvent(\n languages: string[],\n selectedLanguage: string | undefined,\n): CustomEvent<LanguagesChangedEventDetail> {\n return new CustomEvent(\"languages-changed\", {\n bubbles: true,\n composed: true,\n detail: { languages, selectedLanguage },\n });\n}\n\n/**\n * @deprecated Use languagesChangedEvent instead. This event is kept for backward compatibility.\n */\nexport function languageChangedEvent(\n language: string,\n): CustomEvent<LanguageChangedEventDetail> {\n return new CustomEvent(\"language-changed\", {\n bubbles: true,\n composed: true,\n detail: { language },\n });\n}\n\nexport function recordingDevicesChangedEvent(\n devices: MediaDeviceInfo[],\n selectedDevice: MediaDeviceInfo | undefined,\n): CustomEvent<RecordingDevicesChangedEventDetail> {\n return new CustomEvent(\"recording-devices-changed\", {\n bubbles: true,\n composed: true,\n detail: { devices, selectedDevice },\n });\n}\n\nexport function recordingStateChangedEvent(\n state: RecordingState,\n): CustomEvent<RecordingStateChangedEventDetail> {\n return new CustomEvent(\"recording-state-changed\", {\n bubbles: true,\n composed: true,\n detail: { state },\n });\n}\n\nexport function transcriptEvent(\n detail: TranscriptEventDetail,\n): CustomEvent<TranscriptEventDetail> {\n return new CustomEvent(\"transcript\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function commandEvent(\n detail: CommandEventDetail,\n): CustomEvent<CommandEventDetail> {\n return new CustomEvent(\"command\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function usageEvent(\n detail: UsageEventDetail,\n): CustomEvent<UsageEventDetail> {\n return new CustomEvent(\"usage\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function errorEvent(error: unknown): CustomEvent<ErrorEventDetail> {\n const message =\n error instanceof Error && error.message ? error.message : String(error);\n\n return new CustomEvent(\"error\", {\n bubbles: false,\n composed: true,\n detail: { message },\n });\n}\n\nexport function streamClosedEvent(detail: unknown): CustomEvent {\n return new CustomEvent(\"stream-closed\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function readyEvent(): CustomEvent {\n return new CustomEvent(\"ready\", {\n bubbles: true,\n composed: true,\n });\n}\n\nexport function audioLevelChangedEvent(\n audioLevel: number,\n): CustomEvent<AudioLevelChangedEventDetail> {\n return new CustomEvent(\"audio-level-changed\", {\n bubbles: true,\n composed: true,\n detail: { audioLevel },\n });\n}\n\nexport type NetworkActivityEventDetail = {\n direction: \"sent\" | \"received\";\n data: unknown;\n};\n\nexport function networkActivityEvent(\n direction: \"sent\" | \"received\",\n data: unknown,\n): CustomEvent<NetworkActivityEventDetail> {\n return new CustomEvent(\"network-activity\", {\n bubbles: true,\n composed: true,\n detail: { data, direction },\n });\n}\n"]}
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAiCA,MAAM,UAAU,qBAAqB,CACnC,SAA8C,EAC9C,gBAAoC;IAEpC,OAAO,IAAI,WAAW,CAAC,mBAAmB,EAAE;QAC1C,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE;KACxC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAgB;IAEhB,OAAO,IAAI,WAAW,CAAC,kBAAkB,EAAE;QACzC,OAAO,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AE,GAAG,EAAE;KACtB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport type { DictationMode, RecordingState } from \"../types.js\";\n\nexport type LanguagesChangedEventDetail = {\n languages: Corti.TranscribeSupportedLanguage[];\n selectedLanguage: string | undefined;\n};\n\nexport type LanguageChangedEventDetail = {\n language: string;\n};\n\nexport type RecordingDevicesChangedEventDetail = {\n devices: MediaDeviceInfo[];\n selectedDevice: MediaDeviceInfo | undefined;\n};\n\nexport type RecordingStateChangedEventDetail = {\n state: RecordingState;\n};\n\nexport type AudioLevelChangedEventDetail = {\n audioLevel: number;\n};\n\nexport type TranscriptEventDetail = Corti.TranscribeTranscriptMessage;\nexport type CommandEventDetail = Corti.TranscribeCommandMessage;\nexport type UsageEventDetail = Corti.TranscribeUsageMessage;\n\nexport type ErrorEventDetail = {\n message: string;\n};\n\nexport function languagesChangedEvent(\n languages: Corti.TranscribeSupportedLanguage[],\n selectedLanguage: string | undefined,\n): CustomEvent<LanguagesChangedEventDetail> {\n return new CustomEvent(\"languages-changed\", {\n bubbles: true,\n composed: true,\n detail: { languages, selectedLanguage },\n });\n}\n\n/**\n * @deprecated Use languagesChangedEvent instead. This event is kept for backward compatibility.\n */\nexport function languageChangedEvent(\n language: string,\n): CustomEvent<LanguageChangedEventDetail> {\n return new CustomEvent(\"language-changed\", {\n bubbles: true,\n composed: true,\n detail: { language },\n });\n}\n\nexport function recordingDevicesChangedEvent(\n devices: MediaDeviceInfo[],\n selectedDevice: MediaDeviceInfo | undefined,\n): CustomEvent<RecordingDevicesChangedEventDetail> {\n return new CustomEvent(\"recording-devices-changed\", {\n bubbles: true,\n composed: true,\n detail: { devices, selectedDevice },\n });\n}\n\nexport function recordingStateChangedEvent(\n state: RecordingState,\n): CustomEvent<RecordingStateChangedEventDetail> {\n return new CustomEvent(\"recording-state-changed\", {\n bubbles: true,\n composed: true,\n detail: { state },\n });\n}\n\nexport function transcriptEvent(\n detail: TranscriptEventDetail,\n): CustomEvent<TranscriptEventDetail> {\n return new CustomEvent(\"transcript\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function commandEvent(\n detail: CommandEventDetail,\n): CustomEvent<CommandEventDetail> {\n return new CustomEvent(\"command\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function usageEvent(\n detail: UsageEventDetail,\n): CustomEvent<UsageEventDetail> {\n return new CustomEvent(\"usage\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function errorEvent(error: unknown): CustomEvent<ErrorEventDetail> {\n const message =\n error instanceof Error && error.message ? error.message : String(error);\n\n return new CustomEvent(\"error\", {\n bubbles: false,\n composed: true,\n detail: { message },\n });\n}\n\nexport function streamClosedEvent(detail: unknown): CustomEvent {\n return new CustomEvent(\"stream-closed\", {\n bubbles: true,\n composed: true,\n detail,\n });\n}\n\nexport function readyEvent(): CustomEvent {\n return new CustomEvent(\"ready\", {\n bubbles: true,\n composed: true,\n });\n}\n\nexport function audioLevelChangedEvent(\n audioLevel: number,\n): CustomEvent<AudioLevelChangedEventDetail> {\n return new CustomEvent(\"audio-level-changed\", {\n bubbles: true,\n composed: true,\n detail: { audioLevel },\n });\n}\n\nexport type NetworkActivityEventDetail = {\n direction: \"sent\" | \"received\";\n data: unknown;\n};\n\nexport function networkActivityEvent(\n direction: \"sent\" | \"received\",\n data: unknown,\n): CustomEvent<NetworkActivityEventDetail> {\n return new CustomEvent(\"network-activity\", {\n bubbles: true,\n composed: true,\n detail: { data, direction },\n });\n}\n\nexport type ModeChangedEventDetail = {\n mode: DictationMode;\n};\n\nexport type KeybindingChangedEventDetail = {\n key: string | null | undefined;\n code: string | null | undefined;\n};\n\nexport function modeChangedEvent(\n mode: DictationMode,\n): CustomEvent<ModeChangedEventDetail> {\n return new CustomEvent(\"mode-changed\", {\n bubbles: true,\n composed: true,\n detail: { mode },\n });\n}\n\nexport function keybindingChangedEvent(\n key: string | null | undefined,\n code: string | null | undefined,\n): CustomEvent<KeybindingChangedEventDetail> {\n return new CustomEvent(\"keybinding-changed\", {\n bubbles: true,\n composed: true,\n detail: { code, key },\n });\n}\n"]}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Normalizes a keybinding string.
3
+ *
4
+ * @param keybinding - Keybinding string to normalize
5
+ * @returns Normalized keybinding string or null if empty
6
+ *
7
+ * @example
8
+ * normalizeKeybinding("k") // "k"
9
+ * normalizeKeybinding("meta") // "Cmd" on Mac
10
+ * normalizeKeybinding(" space ") // "Space"
11
+ */
12
+ export declare function normalizeKeybinding(keybinding: string | null | undefined): string | null;
13
+ /**
14
+ * Checks if a pressed key matches the keybinding.
15
+ * Checks both event.key and event.code for better reliability.
16
+ *
17
+ * @param event - KeyboardEvent to check
18
+ * @param keybinding - Keybinding string to match against
19
+ * @returns true if either the key or code matches the keybinding
20
+ *
21
+ * @example
22
+ * matchesKeybinding(event, "k") // true if event.key is "k" or event.code is "KeyK"
23
+ * matchesKeybinding(event, "`") // true if event.key is "`" or event.code is "Backquote"
24
+ */
25
+ export declare function matchesKeybinding(event: KeyboardEvent, keybinding: string | null | undefined): boolean;
26
+ /**
27
+ * Gets the pressed key from a KeyboardEvent.
28
+ * Treats modifier keys the same as any other key - they generate their own events.
29
+ * Keys longer than 1 character are capitalized (e.g., "Cmd", "Ctrl", "Space").
30
+ * Platform-specific: "Meta" -> "Cmd" on Mac, "Alt" -> "Opt" on Mac.
31
+ *
32
+ * @param event - KeyboardEvent to extract the pressed key from
33
+ * @returns Normalized key string in keybinding format (e.g., "Cmd", "Opt", "Ctrl", "k")
34
+ *
35
+ * @example
36
+ * getPressedKeyFromEvent(event) // "Cmd" when Meta key is pressed on Mac, "Opt" when Alt is pressed on Mac
37
+ */
38
+ export declare function getPressedKeyFromEvent(event: KeyboardEvent): string;
39
+ /**
40
+ * Checks if keybindings should be ignored for the current active element.
41
+ * Returns true if the user is typing in an input field.
42
+ *
43
+ * @param element - Element to check
44
+ * @returns true if keybindings should be ignored for this element
45
+ *
46
+ * @example
47
+ * shouldIgnoreKeybinding(document.activeElement) // true if input/textarea/contenteditable
48
+ */
49
+ export declare function shouldIgnoreKeybinding(element: Element | null): boolean;
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Checks if the current platform is macOS.
3
+ * Uses userAgent string for reliable cross-browser detection.
4
+ *
5
+ * @returns true if running on macOS
6
+ */
7
+ function isMac() {
8
+ if (typeof navigator === "undefined") {
9
+ return false;
10
+ }
11
+ // Check user agent for Mac patterns (most reliable method)
12
+ return /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
13
+ }
14
+ /**
15
+ * Capitalizes the first letter of a string.
16
+ *
17
+ * @param str - String to capitalize
18
+ * @returns String with first letter capitalized
19
+ */
20
+ function capitalize(str) {
21
+ if (str.length === 0) {
22
+ return str;
23
+ }
24
+ return str.charAt(0).toUpperCase() + str.slice(1);
25
+ }
26
+ /**
27
+ * Normalizes a key string to the keybinding format.
28
+ * Handles platform-specific mappings and capitalization.
29
+ *
30
+ * @param key - Key string to normalize (will be trimmed and lowercased)
31
+ * @returns Formatted key string for keybinding
32
+ *
33
+ * @example
34
+ * normalizeKeyForKeybinding("Control") // "Ctrl"
35
+ * normalizeKeyForKeybinding("META") // "Cmd" on Mac, "Meta" elsewhere
36
+ * normalizeKeyForKeybinding(" alt ") // "Opt" on Mac, "Alt" elsewhere
37
+ * normalizeKeyForKeybinding("shift") // "Shift"
38
+ * normalizeKeyForKeybinding("k") // "k"
39
+ */
40
+ function normalizeKeyForKeybinding(key) {
41
+ if (key === " ") {
42
+ return "Space";
43
+ }
44
+ const normalized = key.trim().toLowerCase();
45
+ if (normalized === "control") {
46
+ return "Ctrl";
47
+ }
48
+ if (normalized === "meta" || normalized === "cmd") {
49
+ return isMac() ? "Cmd" : "Meta";
50
+ }
51
+ if (normalized === "alt" || normalized === "opt") {
52
+ return isMac() ? "Opt" : "Alt";
53
+ }
54
+ if (normalized === "space") {
55
+ return "Space";
56
+ }
57
+ return normalized.length > 1 ? capitalize(normalized) : normalized;
58
+ }
59
+ /**
60
+ * Normalizes a keybinding string.
61
+ *
62
+ * @param keybinding - Keybinding string to normalize
63
+ * @returns Normalized keybinding string or null if empty
64
+ *
65
+ * @example
66
+ * normalizeKeybinding("k") // "k"
67
+ * normalizeKeybinding("meta") // "Cmd" on Mac
68
+ * normalizeKeybinding(" space ") // "Space"
69
+ */
70
+ export function normalizeKeybinding(keybinding) {
71
+ if (!keybinding) {
72
+ return null;
73
+ }
74
+ const trimmed = keybinding.trim();
75
+ if (trimmed === "") {
76
+ return null;
77
+ }
78
+ return normalizeKeyForKeybinding(trimmed);
79
+ }
80
+ /**
81
+ * Checks if a pressed key matches the keybinding.
82
+ * Checks both event.key and event.code for better reliability.
83
+ *
84
+ * @param event - KeyboardEvent to check
85
+ * @param keybinding - Keybinding string to match against
86
+ * @returns true if either the key or code matches the keybinding
87
+ *
88
+ * @example
89
+ * matchesKeybinding(event, "k") // true if event.key is "k" or event.code is "KeyK"
90
+ * matchesKeybinding(event, "`") // true if event.key is "`" or event.code is "Backquote"
91
+ */
92
+ export function matchesKeybinding(event, keybinding) {
93
+ const normalizedKeybinding = normalizeKeybinding(keybinding);
94
+ if (!normalizedKeybinding) {
95
+ return false;
96
+ }
97
+ const normalizedKey = normalizeKeyForKeybinding(event.key);
98
+ const normalizedCode = normalizeKeyForKeybinding(event.code);
99
+ return (normalizedKey === normalizedKeybinding ||
100
+ normalizedCode === normalizedKeybinding);
101
+ }
102
+ /**
103
+ * Gets the pressed key from a KeyboardEvent.
104
+ * Treats modifier keys the same as any other key - they generate their own events.
105
+ * Keys longer than 1 character are capitalized (e.g., "Cmd", "Ctrl", "Space").
106
+ * Platform-specific: "Meta" -> "Cmd" on Mac, "Alt" -> "Opt" on Mac.
107
+ *
108
+ * @param event - KeyboardEvent to extract the pressed key from
109
+ * @returns Normalized key string in keybinding format (e.g., "Cmd", "Opt", "Ctrl", "k")
110
+ *
111
+ * @example
112
+ * getPressedKeyFromEvent(event) // "Cmd" when Meta key is pressed on Mac, "Opt" when Alt is pressed on Mac
113
+ */
114
+ export function getPressedKeyFromEvent(event) {
115
+ return normalizeKeyForKeybinding(event.key);
116
+ }
117
+ /**
118
+ * Checks if keybindings should be ignored for the current active element.
119
+ * Returns true if the user is typing in an input field.
120
+ *
121
+ * @param element - Element to check
122
+ * @returns true if keybindings should be ignored for this element
123
+ *
124
+ * @example
125
+ * shouldIgnoreKeybinding(document.activeElement) // true if input/textarea/contenteditable
126
+ */
127
+ export function shouldIgnoreKeybinding(element) {
128
+ if (!element) {
129
+ return false;
130
+ }
131
+ const tagName = element.tagName.toLowerCase();
132
+ if (tagName === "input" || tagName === "textarea") {
133
+ return true;
134
+ }
135
+ if (element instanceof HTMLElement && element.contentEditable === "true") {
136
+ return true;
137
+ }
138
+ return false;
139
+ }
140
+ //# sourceMappingURL=keybinding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keybinding.js","sourceRoot":"","sources":["../../src/utils/keybinding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,SAAS,KAAK;IACZ,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,2DAA2D;IAC3D,OAAO,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,yBAAyB,CAAC,GAAW;IAC5C,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,UAAU,GA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AC,CAAC;IAC3D,MAAM,cAAc,GAAG,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE7D,OAAO,CACL,aAAa,KAAK,oBAAoB;QACtC,cAAc,KAAK,oBAAoB,CACxC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAoB;IACzD,OAAO,yBAAyB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAuB;IAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAE9C,IAAI,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,YAAY,WAAW,IAAI,OAAO,CAAC,eAAe,KAAK,MAAM,EAAE,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Checks if the current platform is macOS.\n * Uses userAgent string for reliable cross-browser detection.\n *\n * @returns true if running on macOS\n */\nfunction isMac(): boolean {\n if (typeof navigator === \"undefined\") {\n return false;\n }\n\n // Check user agent for Mac patterns (most reliable method)\n return /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);\n}\n\n/**\n * Capitalizes the first letter of a string.\n *\n * @param str - String to capitalize\n * @returns String with first letter capitalized\n */\nfunction capitalize(str: string): string {\n if (str.length === 0) {\n return str;\n }\n\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\n/**\n * Normalizes a key string to the keybinding format.\n * Handles platform-specific mappings and capitalization.\n *\n * @param key - Key string to normalize (will be trimmed and lowercased)\n * @returns Formatted key string for keybinding\n *\n * @example\n * normalizeKeyForKeybinding(\"Control\") // \"Ctrl\"\n * normalizeKeyForKeybinding(\"META\") // \"Cmd\" on Mac, \"Meta\" elsewhere\n * normalizeKeyForKeybinding(\" alt \") // \"Opt\" on Mac, \"Alt\" elsewhere\n * normalizeKeyForKeybinding(\"shift\") // \"Shift\"\n * normalizeKeyForKeybinding(\"k\") // \"k\"\n */\nfunction normalizeKeyForKeybinding(key: string): string {\n if (key === \" \") {\n return \"Space\";\n }\n\n const normalized = key.trim().toLowerCase();\n\n if (normalized === \"control\") {\n return \"Ctrl\";\n }\n if (normalized === \"meta\" || normalized === \"cmd\") {\n return isMac() ? \"Cmd\" : \"Meta\";\n }\n if (normalized === \"alt\" || normalized === \"opt\") {\n return isMac() ? \"Opt\" : \"Alt\";\n }\n if (normalized === \"space\") {\n return \"Space\";\n }\n\n return normalized.length > 1 ? capitalize(normalized) : normalized;\n}\n\n/**\n * Normalizes a keybinding string.\n *\n * @param keybinding - Keybinding string to normalize\n * @returns Normalized keybinding string or null if empty\n *\n * @example\n * normalizeKeybinding(\"k\") // \"k\"\n * normalizeKeybinding(\"meta\") // \"Cmd\" on Mac\n * normalizeKeybinding(\" space \") // \"Space\"\n */\nexport function normalizeKeybinding(\n keybinding: string | null | undefined,\n): string | null {\n if (!keybinding) {\n return null;\n }\n\n const trimmed = keybinding.trim();\n\n if (trimmed === \"\") {\n return null;\n }\n\n return normalizeKeyForKeybinding(trimmed);\n}\n\n/**\n * Checks if a pressed key matches the keybinding.\n * Checks both event.key and event.code for better reliability.\n *\n * @param event - KeyboardEvent to check\n * @param keybinding - Keybinding string to match against\n * @returns true if either the key or code matches the keybinding\n *\n * @example\n * matchesKeybinding(event, \"k\") // true if event.key is \"k\" or event.code is \"KeyK\"\n * matchesKeybinding(event, \"`\") // true if event.key is \"`\" or event.code is \"Backquote\"\n */\nexport function matchesKeybinding(\n event: KeyboardEvent,\n keybinding: string | null | undefined,\n): boolean {\n const normalizedKeybinding = normalizeKeybinding(keybinding);\n\n if (!normalizedKeybinding) {\n return false;\n }\n\n const normalizedKey = normalizeKeyForKeybinding(event.key);\n const normalizedCode = normalizeKeyForKeybinding(event.code);\n\n return (\n normalizedKey === normalizedKeybinding ||\n normalizedCode === normalizedKeybinding\n );\n}\n\n/**\n * Gets the pressed key from a KeyboardEvent.\n * Treats modifier keys the same as any other key - they generate their own events.\n * Keys longer than 1 character are capitalized (e.g., \"Cmd\", \"Ctrl\", \"Space\").\n * Platform-specific: \"Meta\" -> \"Cmd\" on Mac, \"Alt\" -> \"Opt\" on Mac.\n *\n * @param event - KeyboardEvent to extract the pressed key from\n * @returns Normalized key string in keybinding format (e.g., \"Cmd\", \"Opt\", \"Ctrl\", \"k\")\n *\n * @example\n * getPressedKeyFromEvent(event) // \"Cmd\" when Meta key is pressed on Mac, \"Opt\" when Alt is pressed on Mac\n */\nexport function getPressedKeyFromEvent(event: KeyboardEvent): string {\n return normalizeKeyForKeybinding(event.key);\n}\n\n/**\n * Checks if keybindings should be ignored for the current active element.\n * Returns true if the user is typing in an input field.\n *\n * @param element - Element to check\n * @returns true if keybindings should be ignored for this element\n *\n * @example\n * shouldIgnoreKeybinding(document.activeElement) // true if input/textarea/contenteditable\n */\nexport function shouldIgnoreKeybinding(element: Element | null): boolean {\n if (!element) {\n return false;\n }\n\n const tagName = element.tagName.toLowerCase();\n\n if (tagName === \"input\" || tagName === \"textarea\") {\n return true;\n }\n\n if (element instanceof HTMLElement && element.contentEditable === \"true\") {\n return true;\n }\n\n return false;\n}\n"]}
@@ -1,7 +1,8 @@
1
- export declare const DEFAULT_LANGUAGES_BY_REGION: Record<string, string[]>;
1
+ import type { Corti } from "@corti/sdk";
2
+ export declare const DEFAULT_LANGUAGES_BY_REGION: Record<string, Corti.TranscribeSupportedLanguage[]>;
2
3
  export declare function getLanguageName(languageCode: string): string;
3
- export declare function checkIfDefaultLanguagesList(languages?: string[]): boolean;
4
+ export declare function checkIfDefaultLanguagesList(languages?: Corti.TranscribeSupportedLanguage[]): boolean;
4
5
  export declare function getLanguagesByRegion(region?: string): {
5
- languages: string[];
6
+ languages: Corti.TranscribeSupportedLanguage[];
6
7
  defaultLanguage: string | undefined;
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"languages.js","sourceRoot":"","sources":["../../src/utils/languages.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,2BAA2B,GAA6B;IACnE,OAAO,EAAE,sBAAsB;IAC/B,EAAE,EAAE,sBAAsB;IAC1B,EAAE,EAAE,sBAAsB;CAC3B,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,YAAoB;IAClD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC;QAC9C,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,EAAE;YACvD,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAEnD,OAAO,YAAY,IAAI,YAAY,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,YAAY,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,YAAsB,EAAE;IAClE,OAAO,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,IAAI,CACpD,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,KAAK,SAAS,CAC7C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAe;IAIlD,MAAM,SAAS,GACb,2BAA2B,CAAC,MAAM,IAAI,SAAS,CAAC;QAChD,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;IAEvC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import {\n LANGUAGES_SUPPORTED_EU,\n LANGUAGES_SUPPORTED_US,\n} from \"../constants.js\";\n\nexport const DEFAULT_LANGUAGES_BY_REGION: Record<string, string[]> = {\n default: LANGUAGES_SUPPORTED_EU,\n eu: LANGUAGES_SUPPORTED_EU,\n us: LANGUAGES_SUPPORTED_US,\n};\n\nexport function getLanguageName(languageCode: string): string {\n try {\n const userLocale = navigator.language || \"en\";\n const displayNames = new Intl.DisplayNames([userLocale], {\n type: \"language\",\n });\n const languageName = displayNames.of(languageCode);\n\n return languageName || languageCode;\n } catch {\n return languageCode;\n }\n}\n\nexport function checkIfDefaultLanguagesList(languages: string[] = []): boolean {\n return Object.values(DEFAULT_LANGUAGES_BY_REGION).some(\n (languageList) => languageList === languages,\n );\n}\n\nexport function getLanguagesByRegion(region?: string): {\n languages: string[];\n defaultLanguage: string | undefined;\n} {\n const languages =\n DEFAULT_LANGUAGES_BY_REGION[region || \"default\"] ||\n DEFAULT_LANGUAGES_BY_REGION[\"default\"];\n const defaultLanguage = languages?.[0];\n\n return { defaultLanguage, languages };\n}\n"]}
1
+ {"version":3,"file":"languages.js","sourceRoot":"","sources":["../../src/utils/languages.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,2BAA2B,GAGpC;IACF,OAAO,EAAE,sBAAsB;IAC/B,EAAE,EAAE,sBAAsB;IAC1B,EAAE,EAAE,sBAAsB;CAC3B,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,YAAoB;IAClD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC;QAC9C,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,EAAE;YACvD,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAEnD,OAAO,YAAY,IAAI,YAAY,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,YAAY,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,YAAiD,EAAE;IAEnD,OAAO,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,IAAI,CACpD,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,KAAK,SAAS,CAC7C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAe;IAIlD,MAAM,SAAS,GACb,2BAA2B,CAAC,MAAM,IAAI,SAAS,CAAC;QAChD,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,eAAe,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;IAEvC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport {\n LANGUAGES_SUPPORTED_EU,\n LANGUAGES_SUPPORTED_US,\n} from \"../constants.js\";\n\nexport const DEFAULT_LANGUAGES_BY_REGION: Record<\n string,\n Corti.TranscribeSupportedLanguage[]\n> = {\n default: LANGUAGES_SUPPORTED_EU,\n eu: LANGUAGES_SUPPORTED_EU,\n us: LANGUAGES_SUPPORTED_US,\n};\n\nexport function getLanguageName(languageCode: string): string {\n try {\n const userLocale = navigator.language || \"en\";\n const displayNames = new Intl.DisplayNames([userLocale], {\n type: \"language\",\n });\n const languageName = displayNames.of(languageCode);\n\n return languageName || languageCode;\n } catch {\n return languageCode;\n }\n}\n\nexport function checkIfDefaultLanguagesList(\n languages: Corti.TranscribeSupportedLanguage[] = [],\n): boolean {\n return Object.values(DEFAULT_LANGUAGES_BY_REGION).some(\n (languageList) => languageList === languages,\n );\n}\n\nexport function getLanguagesByRegion(region?: string): {\n languages: Corti.TranscribeSupportedLanguage[];\n defaultLanguage: string | undefined;\n} {\n const languages =\n DEFAULT_LANGUAGES_BY_REGION[region || \"default\"] ||\n DEFAULT_LANGUAGES_BY_REGION[\"default\"];\n const defaultLanguage = languages?.[0];\n\n return { defaultLanguage, languages };\n}\n"]}
@@ -10,4 +10,4 @@ export declare function decodeToken(token: string): {
10
10
  environment: string;
11
11
  expiresAt: number | undefined;
12
12
  tenant: string;
13
- } | undefined;
13
+ };
@@ -43,17 +43,18 @@ export function decodeToken(token) {
43
43
  // Expected format: https://keycloak.{environment}.corti.app/realms/{tenant}
44
44
  const regex = /^https:\/\/(keycloak|auth)\.([^.]+)\.corti\.app\/realms\/([^/]+)/;
45
45
  const match = issuerUrl.match(regex);
46
- // If the issuer URL matches the expected pattern, return the extracted values along with the token
47
- if (match) {
48
- const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === "number"
49
- ? tokenDetails.exp
50
- : undefined;
51
- return {
52
- accessToken: token,
53
- environment: match[2],
54
- expiresAt,
55
- tenant: match[3],
56
- };
46
+ if (!match) {
47
+ throw new Error("Access token does not match expected format");
57
48
  }
49
+ // If the issuer URL matches the expected pattern, return the extracted values along with the token
50
+ const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === "number"
51
+ ? tokenDetails.exp
52
+ : undefined;
53
+ return {
54
+ accessToken: token,
55
+ environment: match[2],
56
+ expiresAt,
57
+ tenant: match[3],
58
+ };
58
59
  }
59
60
  //# sourceMappingURL=token.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/utils/token.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,kFAAkF;IAClF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,sDAAsD;IACtD,MAAM,SAAS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GACb,YAAY,CAAC,GAAG,IAAI,OAAO,YAAY,CAAC,GAAG,KAAK,QAAQ;YACtD,CAAC,CAAC,YAAY,CAAC,GAAG;YAClB,CAAC,CAAC,SAAS,CAAC;QAEhB,OAAO;YACL,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;YACrB,SAAS;YACT,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;SACjB,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["/**\n * Decodes a JWT token and extracts environment and tenant information.\n *\n * @param token - The JWT token to decode\n * @returns Object containing environment, tenant, accessToken, and expiresAt\n * @throws Error if token format is invalid or cannot be decoded\n */\nexport function decodeToken(token: string) {\n // Validate the token structure (should contain at least header and payload parts)\n const parts = token.split(\".\");\n if (parts.length < 2) {\n throw new Error(\"Invalid token format\");\n }\n\n // Retrieve the payload (second part) of the JWT token\n const base64Url = parts[1];\n\n // Replace URL-safe characters to match standard base64 encoding\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n // Decode the base64 string into a JSON string\n let jsonPayload: string;\n try {\n jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2))\n .join(\"\"),\n );\n } catch (error) {\n throw new Error(\"Failed to decode token payload\");\n }\n\n // Parse the JSON string to obtain token details\n let tokenDetails: { iss: string; exp?: number; [key: string]: unknown };\n try {\n tokenDetails = JSON.parse(jsonPayload);\n } catch (error) {\n throw new Error(\"Invalid JSON payload in token\");\n }\n\n // Extract the issuer URL from the token details\n const issuerUrl: string = tokenDetails.iss;\n if (!issuerUrl) {\n throw new Error(\"Token payload does not contain an issuer (iss) field\");\n }\n\n // Regex to extract environment and tenant from issuer URL:\n // Expected format: https://keycloak.{environment}.corti.app/realms/{tenant}\n const regex =\n /^https:\\/\\/(keycloak|auth)\\.([^.]+)\\.corti\\.app\\/realms\\/([^/]+)/;\n const match = issuerUrl.match(regex);\n\n // If the issuer URL matches the expected pattern, return the extracted values along with the token\n if (match) {\n const expiresAt =\n tokenDetails.exp && typeof tokenDetails.exp === \"number\"\n ? tokenDetails.exp\n : undefined;\n\n return {\n accessToken: token,\n environment: match[2],\n expiresAt,\n tenant: match[3],\n };\n }\n}\n"]}
1
+ {"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/utils/token.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,kFAAkF;IAClF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,sDAAsD;IACtD,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAE3B,gEAAgE;IAChE,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAE/D,8CAA8C;IAC9C,IAAI,WAAmB,CAAC;IACxB,IAAI,CAAC;QACH,WAAW,GAAG,kBAAkB,CAC9B,IAAI,CAAC,MAAM,CAAC;aACT,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACjE,IAAI,CAAC,EAAE,CAAC,CACZ,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,gDAAgD;IAChD,IAAI,YAAmE,CAAC;IACxE,IAAI,CAAC;QACH,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,gDAAgD;IAChD,MAAM,SAAS,GAAW,YAAY,CAAC,GAAG,CAAC;IAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED,2DAA2D;IAC3D,4EAA4E;IAC5E,MAAM,KAAK,GACT,kEAAkE,CAAC;IACrE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAErC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,mGAAmG;IACnG,MAAM,SAAS,GACb,YAAY,CAAC,GAAG,IAAI,OAAO,YAAY,CAAC,GAAG,KAAK,QAAQ;QACtD,CAAC,CAAC,YAAY,CAAC,GAAG;QAClB,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO;QACL,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QACrB,SAAS;QACT,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;KACjB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Decodes a JWT token and extracts environment and tenant information.\n *\n * @param token - The JWT token to decode\n * @returns Object containing environment, tenant, accessToken, and expiresAt\n * @throws Error if token format is invalid or cannot be decoded\n */\nexport function decodeToken(token: string) {\n // Validate the token structure (should contain at least header and payload parts)\n const parts = token.split(\".\");\n if (parts.length < 2) {\n throw new Error(\"Invalid token format\");\n }\n\n // Retrieve the payload (second part) of the JWT token\n const base64Url = parts[1];\n\n // Replace URL-safe characters to match standard base64 encoding\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n\n // Decode the base64 string into a JSON string\n let jsonPayload: string;\n try {\n jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2))\n .join(\"\"),\n );\n } catch (error) {\n throw new Error(\"Failed to decode token payload\");\n }\n\n // Parse the JSON string to obtain token details\n let tokenDetails: { iss: string; exp?: number; [key: string]: unknown };\n try {\n tokenDetails = JSON.parse(jsonPayload);\n } catch (error) {\n throw new Error(\"Invalid JSON payload in token\");\n }\n\n // Extract the issuer URL from the token details\n const issuerUrl: string = tokenDetails.iss;\n if (!issuerUrl) {\n throw new Error(\"Token payload does not contain an issuer (iss) field\");\n }\n\n // Regex to extract environment and tenant from issuer URL:\n // Expected format: https://keycloak.{environment}.corti.app/realms/{tenant}\n const regex =\n /^https:\\/\\/(keycloak|auth)\\.([^.]+)\\.corti\\.app\\/realms\\/([^/]+)/;\n const match = issuerUrl.match(regex);\n\n if (!match) {\n throw new Error(\"Access token does not match expected format\");\n }\n\n // If the issuer URL matches the expected pattern, return the extracted values along with the token\n const expiresAt =\n tokenDetails.exp && typeof tokenDetails.exp === \"number\"\n ? tokenDetails.exp\n : undefined;\n\n return {\n accessToken: token,\n environment: match[2],\n expiresAt,\n tenant: match[3],\n };\n}\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@corti/dictation-web",
3
3
  "description": "Web component for Corti Dictation",
4
4
  "author": "Corti ApS",
5
- "version": "0.0.0-test.562",
5
+ "version": "0.0.0-test.571",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
@@ -54,11 +54,11 @@
54
54
  "prepare": "husky && husky install",
55
55
  "test": "tsc && wtr --coverage",
56
56
  "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
57
- "storybook": "tsc && tsc -p tsconfig.stories.json && npm run analyze -- --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"tsc -p tsconfig.stories.json --watch --preserveWatchOutput\" \"storybook dev -p 8080\"",
57
+ "storybook": "npm run analyze -- --exclude dist && storybook dev -p 8080",
58
58
  "storybook:build": "tsc && tsc -p tsconfig.stories.json && npm run analyze -- --exclude dist && storybook build"
59
59
  },
60
60
  "dependencies": {
61
- "@corti/sdk": "^0.8.0-rc",
61
+ "@corti/sdk": "^0.8.0",
62
62
  "@lit/context": "^1.1.6",
63
63
  "lit": "^3.3.1"
64
64
  },
@@ -66,10 +66,11 @@
66
66
  "@biomejs/biome": "^2.3.6",
67
67
  "@custom-elements-manifest/analyzer": "^0.10.3",
68
68
  "@open-wc/testing": "^4.0.0",
69
- "@storybook/addon-a11y": "^7.6.20",
70
- "@storybook/addon-essentials": "^7.6.20",
71
- "@storybook/addon-links": "^7.6.20",
72
- "@storybook/web-components": "^7.6.20",
69
+ "@storybook/addon-a11y": "10.1.5",
70
+ "@storybook/addon-docs": "^10.1.5",
71
+ "@storybook/addon-links": "10.1.5",
72
+ "@storybook/web-components": "10.1.5",
73
+ "@storybook/web-components-vite": "^10.1.5",
73
74
  "@types/mocha": "^10.0.7",
74
75
  "@web/dev-server": "^0.4.6",
75
76
  "@web/storybook-builder": "^0.1.16",
@@ -80,7 +81,7 @@
80
81
  "husky": "^8.0.0",
81
82
  "lint-staged": "^15.2.7",
82
83
  "sinon": "^19.0.2",
83
- "storybook": "^7.6.20",
84
+ "storybook": "10.1.5",
84
85
  "tslib": "^2.6.3",
85
86
  "typescript": "^5.5.3"
86
87
  },