@corti/dictation-web 0.6.0 → 0.7.0-ambient

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 (91) hide show
  1. package/dist/bundle.js +1838 -1455
  2. package/dist/components/ambient-recording-button.d.ts +16 -0
  3. package/dist/components/ambient-recording-button.js +68 -0
  4. package/dist/components/ambient-recording-button.js.map +1 -0
  5. package/dist/components/corti-ambient.d.ts +27 -0
  6. package/dist/components/corti-ambient.js +97 -0
  7. package/dist/components/corti-ambient.js.map +1 -0
  8. package/dist/components/corti-dictation.d.ts +9 -109
  9. package/dist/components/corti-dictation.js +12 -187
  10. package/dist/components/corti-dictation.js.map +1 -1
  11. package/dist/components/corti-root.d.ts +121 -0
  12. package/dist/components/corti-root.js +196 -0
  13. package/dist/components/corti-root.js.map +1 -0
  14. package/dist/components/device-selector.js +1 -1
  15. package/dist/components/device-selector.js.map +1 -1
  16. package/dist/components/dictation-recording-button.d.ts +13 -0
  17. package/dist/components/dictation-recording-button.js +30 -0
  18. package/dist/components/dictation-recording-button.js.map +1 -0
  19. package/dist/components/keybinding-input.js +1 -1
  20. package/dist/components/keybinding-input.js.map +1 -1
  21. package/dist/components/keybinding-selector.js +1 -1
  22. package/dist/components/keybinding-selector.js.map +1 -1
  23. package/dist/components/language-selector.js +2 -1
  24. package/dist/components/language-selector.js.map +1 -1
  25. package/dist/components/{recording-button.d.ts → recording-button-base.d.ts} +7 -9
  26. package/dist/components/recording-button-base.js +321 -0
  27. package/dist/components/recording-button-base.js.map +1 -0
  28. package/dist/components/settings-menu.js +1 -1
  29. package/dist/components/settings-menu.js.map +1 -1
  30. package/dist/constants.d.ts +1 -0
  31. package/dist/constants.js +9 -0
  32. package/dist/constants.js.map +1 -1
  33. package/dist/contexts/ambient-context.d.ts +18 -0
  34. package/dist/contexts/ambient-context.js +48 -0
  35. package/dist/contexts/ambient-context.js.map +1 -0
  36. package/dist/contexts/dictation-context.d.ts +3 -92
  37. package/dist/contexts/dictation-context.js +5 -257
  38. package/dist/contexts/dictation-context.js.map +1 -1
  39. package/dist/contexts/mixins/auth-context.d.ts +32 -0
  40. package/dist/contexts/mixins/auth-context.js +116 -0
  41. package/dist/contexts/mixins/auth-context.js.map +1 -0
  42. package/dist/contexts/mixins/devices-context.d.ts +14 -0
  43. package/dist/contexts/mixins/devices-context.js +58 -0
  44. package/dist/contexts/mixins/devices-context.js.map +1 -0
  45. package/dist/contexts/mixins/keybindings-context.d.ts +13 -0
  46. package/dist/contexts/mixins/keybindings-context.js +62 -0
  47. package/dist/contexts/mixins/keybindings-context.js.map +1 -0
  48. package/dist/contexts/mixins/languages-context.d.ts +11 -0
  49. package/dist/contexts/mixins/languages-context.js +54 -0
  50. package/dist/contexts/mixins/languages-context.js.map +1 -0
  51. package/dist/contexts/mixins/proxy-context.d.ts +14 -0
  52. package/dist/contexts/mixins/proxy-context.js +24 -0
  53. package/dist/contexts/mixins/proxy-context.js.map +1 -0
  54. package/dist/contexts/mixins/recording-state-context.d.ts +13 -0
  55. package/dist/contexts/mixins/recording-state-context.js +30 -0
  56. package/dist/contexts/mixins/recording-state-context.js.map +1 -0
  57. package/dist/contexts/mixins/types.d.ts +5 -0
  58. package/dist/contexts/mixins/types.js +2 -0
  59. package/dist/contexts/mixins/types.js.map +1 -0
  60. package/dist/contexts/root-context.d.ts +8 -0
  61. package/dist/contexts/root-context.js +34 -0
  62. package/dist/contexts/root-context.js.map +1 -0
  63. package/dist/controllers/ambient-controller.d.ts +16 -0
  64. package/dist/controllers/ambient-controller.js +24 -0
  65. package/dist/controllers/ambient-controller.js.map +1 -0
  66. package/dist/controllers/dictation-controller.d.ts +8 -31
  67. package/dist/controllers/dictation-controller.js +17 -283
  68. package/dist/controllers/dictation-controller.js.map +1 -1
  69. package/dist/controllers/languages-controller.js +0 -4
  70. package/dist/controllers/languages-controller.js.map +1 -1
  71. package/dist/controllers/socket-controller.d.ts +51 -0
  72. package/dist/controllers/socket-controller.js +281 -0
  73. package/dist/controllers/socket-controller.js.map +1 -0
  74. package/dist/index.d.ts +5 -2
  75. package/dist/index.js +12 -2
  76. package/dist/index.js.map +1 -1
  77. package/dist/tsconfig.tsbuildinfo +1 -1
  78. package/dist/types.d.ts +3 -0
  79. package/dist/types.js.map +1 -1
  80. package/dist/utils/devices.d.ts +12 -8
  81. package/dist/utils/devices.js +39 -28
  82. package/dist/utils/devices.js.map +1 -1
  83. package/dist/utils/events.d.ts +5 -3
  84. package/dist/utils/events.js +7 -0
  85. package/dist/utils/events.js.map +1 -1
  86. package/dist/utils/keybinding.d.ts +2 -1
  87. package/dist/utils/keybinding.js +12 -6
  88. package/dist/utils/keybinding.js.map +1 -1
  89. package/package.json +1 -1
  90. package/dist/components/recording-button.js +0 -331
  91. package/dist/components/recording-button.js.map +0 -1
@@ -0,0 +1,62 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ import { createContext, provide } from "@lit/context";
13
+ import { property } from "lit/decorators.js";
14
+ import { keybindingChangedEvent, } from "../../utils/events.js";
15
+ export const pushToTalkKeybindingContext = createContext(Symbol("pushToTalkKeybinding"));
16
+ export const toggleToTalkKeybindingContext = createContext(Symbol("toggleToTalkKeybinding"));
17
+ export function KeybindingsContextMixin(superclass) {
18
+ var _KeybindingsContextMixinClass_handleContextRequest, _KeybindingsContextMixinClass_handleKeybindingChanged;
19
+ class KeybindingsContextMixinClass extends superclass {
20
+ constructor(...args) {
21
+ super(...args);
22
+ _KeybindingsContextMixinClass_handleContextRequest.set(this, (e) => {
23
+ if (e.contextTarget.tagName.toLowerCase() ===
24
+ "dictation-keybinding-selector") {
25
+ if (e.context === pushToTalkKeybindingContext &&
26
+ this.pushToTalkKeybinding === undefined) {
27
+ this.pushToTalkKeybinding = "Space";
28
+ this.dispatchEvent(keybindingChangedEvent(" ", "Space", "Space", "push-to-talk"));
29
+ }
30
+ if (e.context === toggleToTalkKeybindingContext &&
31
+ this.toggleToTalkKeybinding === undefined) {
32
+ this.toggleToTalkKeybinding = "Enter";
33
+ this.dispatchEvent(keybindingChangedEvent("Enter", "Enter", "Enter", "toggle-to-talk"));
34
+ }
35
+ }
36
+ });
37
+ _KeybindingsContextMixinClass_handleKeybindingChanged.set(this, (e) => {
38
+ const event = e;
39
+ const keybinding = event.detail.keybinding;
40
+ if (event.detail.type === "push-to-talk") {
41
+ this.pushToTalkKeybinding = keybinding;
42
+ }
43
+ else if (event.detail.type === "toggle-to-talk") {
44
+ this.toggleToTalkKeybinding = keybinding;
45
+ }
46
+ });
47
+ this.addEventListener("keybinding-changed", __classPrivateFieldGet(this, _KeybindingsContextMixinClass_handleKeybindingChanged, "f"));
48
+ this.addEventListener("context-request", __classPrivateFieldGet(this, _KeybindingsContextMixinClass_handleContextRequest, "f"));
49
+ }
50
+ }
51
+ _KeybindingsContextMixinClass_handleContextRequest = new WeakMap(), _KeybindingsContextMixinClass_handleKeybindingChanged = new WeakMap();
52
+ __decorate([
53
+ provide({ context: pushToTalkKeybindingContext }),
54
+ property({ type: String })
55
+ ], KeybindingsContextMixinClass.prototype, "pushToTalkKeybinding", void 0);
56
+ __decorate([
57
+ provide({ context: toggleToTalkKeybindingContext }),
58
+ property({ type: String })
59
+ ], KeybindingsContextMixinClass.prototype, "toggleToTalkKeybinding", void 0);
60
+ return KeybindingsContextMixinClass;
61
+ }
62
+ //# sourceMappingURL=keybindings-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keybindings-context.js","sourceRoot":"","sources":["../../../src/contexts/mixins/keybindings-context.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAqB,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAEL,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,CAAC,MAAM,2BAA2B,GAAG,aAAa,CAEtD,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,6BAA6B,GAAG,aAAa,CAExD,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC;AAOpC,MAAM,UAAU,uBAAuB,CACrC,UAAa;;IAEb,MAAM,4BAA6B,SAAQ,UAAU;QASnD,YAAY,GAAG,IAAW;YACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YASjB,6DAAwB,CAAC,CAAoB,EAAE,EAAE;gBAC/C,IACE,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE;oBACrC,+BAA+B,EAC/B,CAAC;oBACD,IACE,CAAC,CAAC,OAAO,KAAK,2BAA2B;wBACzC,IAAI,CAAC,oBAAoB,KAAK,SAAS,EACvC,CAAC;wBACD,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC;wBACpC,IAAI,CAAC,aAAa,CAChB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAC9D,CAAC;oBACJ,CAAC;oBAED,IACE,CAAC,CAAC,OAAO,KAAK,6BAA6B;wBAC3C,IAAI,CAAC,sBAAsB,KAAK,SAAS,EACzC,CAAC;wBACD,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC;wBACtC,IAAI,CAAC,aAAa,CAChB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,CAAC,CACpE,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC,EAAC;YAEF,gEAA2B,CAAC,CAAQ,EAAE,EAAE;gBACtC,MAAM,KAAK,GAAG,CAA8C,CAAC;gBAE7D,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;gBAE3C,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;oBACzC,IAAI,CAAC,oBAAoB,GAAG,UAAU,CAAC;gBACzC,CAAC;qBAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;oBAClD,IAAI,CAAC,sBAAsB,GAAG,UAAU,CAAC;gBAC3C,CAAC;YACH,CAAC,EAAC;YA5CA,IAAI,CAAC,gBAAgB,CACnB,oBAAoB,EACpB,uBAAA,IAAI,6DAAyB,CAC9B,CAAC;YACF,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,uBAAA,IAAI,0DAAsB,CAAC,CAAC;QACvE,CAAC;KAwCF;;IAtDC;QAFC,OAAO,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;QACjD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EACU;IAIrC;QAFC,OAAO,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;QACnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gFACY;IAoDzC,OAAO,4BACJ,CAAC;AACN,CAAC","sourcesContent":["import { type ContextEvent, createContext, provide } from \"@lit/context\";\nimport type { LitElement } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport {\n type KeybindingChangedEventDetail,\n keybindingChangedEvent,\n} from \"../../utils/events.js\";\nimport type { Constructor } from \"./types.js\";\n\nexport const pushToTalkKeybindingContext = createContext<\n string | null | undefined\n>(Symbol(\"pushToTalkKeybinding\"));\n\nexport const toggleToTalkKeybindingContext = createContext<\n string | null | undefined\n>(Symbol(\"toggleToTalkKeybinding\"));\n\nexport declare class KeybindingsContextInterface {\n pushToTalkKeybinding?: string | null;\n toggleToTalkKeybinding?: string | null;\n}\n\nexport function KeybindingsContextMixin<T extends Constructor<LitElement>>(\n superclass: T,\n): Constructor<KeybindingsContextInterface> & T {\n class KeybindingsContextMixinClass extends superclass {\n @provide({ context: pushToTalkKeybindingContext })\n @property({ type: String })\n pushToTalkKeybinding?: string | null;\n\n @provide({ context: toggleToTalkKeybindingContext })\n @property({ type: String })\n toggleToTalkKeybinding?: string | null;\n\n constructor(...args: any[]) {\n super(...args);\n\n this.addEventListener(\n \"keybinding-changed\",\n this.#handleKeybindingChanged,\n );\n this.addEventListener(\"context-request\", this.#handleContextRequest);\n }\n\n #handleContextRequest = (e: ContextEvent<any>) => {\n if (\n e.contextTarget.tagName.toLowerCase() ===\n \"dictation-keybinding-selector\"\n ) {\n if (\n e.context === pushToTalkKeybindingContext &&\n this.pushToTalkKeybinding === undefined\n ) {\n this.pushToTalkKeybinding = \"Space\";\n this.dispatchEvent(\n keybindingChangedEvent(\" \", \"Space\", \"Space\", \"push-to-talk\"),\n );\n }\n\n if (\n e.context === toggleToTalkKeybindingContext &&\n this.toggleToTalkKeybinding === undefined\n ) {\n this.toggleToTalkKeybinding = \"Enter\";\n this.dispatchEvent(\n keybindingChangedEvent(\"Enter\", \"Enter\", \"Enter\", \"toggle-to-talk\"),\n );\n }\n }\n };\n\n #handleKeybindingChanged = (e: Event) => {\n const event = e as CustomEvent<KeybindingChangedEventDetail>;\n\n const keybinding = event.detail.keybinding;\n\n if (event.detail.type === \"push-to-talk\") {\n this.pushToTalkKeybinding = keybinding;\n } else if (event.detail.type === \"toggle-to-talk\") {\n this.toggleToTalkKeybinding = keybinding;\n }\n };\n }\n\n return KeybindingsContextMixinClass as Constructor<KeybindingsContextInterface> &\n T;\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { Corti } from "@corti/sdk";
2
+ import type { LitElement } from "lit";
3
+ import type { Constructor } from "./types.js";
4
+ export declare const languagesContext: {
5
+ __context__: string[] | undefined;
6
+ };
7
+ export declare class LanguagesContextInterface {
8
+ _languages?: Corti.TranscribeSupportedLanguage[];
9
+ languages?: Corti.TranscribeSupportedLanguage[];
10
+ }
11
+ export declare function LanguagesContextMixin<T extends Constructor<LitElement>>(superclass: T): Constructor<LanguagesContextInterface> & T;
@@ -0,0 +1,54 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ import { createContext, provide } from "@lit/context";
13
+ import { property, state } from "lit/decorators.js";
14
+ import { LanguagesController } from "../../controllers/languages-controller.js";
15
+ import { commaSeparatedConverter } from "../../utils/converters.js";
16
+ export const languagesContext = createContext(Symbol("languages"));
17
+ export function LanguagesContextMixin(superclass) {
18
+ var _LanguagesContextMixinClass_languagesController;
19
+ class LanguagesContextMixinClass extends superclass {
20
+ set languages(value) {
21
+ this._languages = value;
22
+ // Clear auto-loaded flag when languages are set via property
23
+ if (value !== undefined) {
24
+ __classPrivateFieldGet(this, _LanguagesContextMixinClass_languagesController, "f").clearAutoLoadedFlag();
25
+ }
26
+ }
27
+ get languages() {
28
+ return this._languages;
29
+ }
30
+ constructor(...args) {
31
+ super(...args);
32
+ _LanguagesContextMixinClass_languagesController.set(this, new LanguagesController(this));
33
+ this.addEventListener("context-request", (e) => {
34
+ const ev = e;
35
+ if (ev.context === languagesContext) {
36
+ __classPrivateFieldGet(this, _LanguagesContextMixinClass_languagesController, "f").initialize();
37
+ }
38
+ });
39
+ }
40
+ }
41
+ _LanguagesContextMixinClass_languagesController = new WeakMap();
42
+ __decorate([
43
+ provide({ context: languagesContext }),
44
+ state()
45
+ ], LanguagesContextMixinClass.prototype, "_languages", void 0);
46
+ __decorate([
47
+ property({
48
+ converter: commaSeparatedConverter,
49
+ type: Array,
50
+ })
51
+ ], LanguagesContextMixinClass.prototype, "languages", null);
52
+ return LanguagesContextMixinClass;
53
+ }
54
+ //# sourceMappingURL=languages-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages-context.js","sourceRoot":"","sources":["../../../src/contexts/mixins/languages-context.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAqB,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAE3C,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;AAOvB,MAAM,UAAU,qBAAqB,CACnC,UAAa;;IAEb,MAAM,0BAA2B,SAAQ,UAAU;QAWjD,IAAI,SAAS,CAAC,KAAsD;YAClE,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YAExB,6DAA6D;YAC7D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,uBAAA,IAAI,uDAAqB,CAAC,mBAAmB,EAAE,CAAC;YAClD,CAAC;QACH,CAAC;QAED,IAAI,SAAS;YACX,OAAO,IAAI,CAAC,UAAU,CAAC;QACzB,CAAC;QAED,YAAY,GAAG,IAAW;YACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAxBjB,0DAAuB,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAC;YA0BnD,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,CAAQ,EAAE,EAAE;gBACpD,MAAM,EAAE,GAAG,CAA0C,CAAC;gBAEtD,IAAI,EAAE,CAAC,OAAO,KAAK,gBAAgB,EAAE,CAAC;oBACpC,uBAAA,IAAI,uDAAqB,CAAC,UAAU,EAAE,CAAC;gBACzC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF;;IA9BC;QAFC,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;QACtC,KAAK,EAAE;kEACyC;IAMjD;QAJC,QAAQ,CAAC;YACR,SAAS,EAAE,uBAAuB;YAClC,IAAI,EAAE,KAAK;SACZ,CAAC;+DAQD;IAmBH,OAAO,0BACJ,CAAC;AACN,CAAC","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { type ContextEvent, createContext, provide } from \"@lit/context\";\nimport type { LitElement } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { LanguagesController } from \"../../controllers/languages-controller.js\";\nimport { commaSeparatedConverter } from \"../../utils/converters.js\";\nimport type { Constructor } from \"./types.js\";\n\nexport const languagesContext = createContext<\n Corti.TranscribeSupportedLanguage[] | undefined\n>(Symbol(\"languages\"));\n\nexport declare class LanguagesContextInterface {\n _languages?: Corti.TranscribeSupportedLanguage[];\n languages?: Corti.TranscribeSupportedLanguage[];\n}\n\nexport function LanguagesContextMixin<T extends Constructor<LitElement>>(\n superclass: T,\n): Constructor<LanguagesContextInterface> & T {\n class LanguagesContextMixinClass extends superclass {\n #languagesController = new LanguagesController(this);\n\n @provide({ context: languagesContext })\n @state()\n _languages?: Corti.TranscribeSupportedLanguage[];\n\n @property({\n converter: commaSeparatedConverter,\n type: Array,\n })\n set languages(value: Corti.TranscribeSupportedLanguage[] | undefined) {\n this._languages = value;\n\n // Clear auto-loaded flag when languages are set via property\n if (value !== undefined) {\n this.#languagesController.clearAutoLoadedFlag();\n }\n }\n\n get languages(): Corti.TranscribeSupportedLanguage[] | undefined {\n return this._languages;\n }\n\n constructor(...args: any[]) {\n super(...args);\n\n this.addEventListener(\"context-request\", (e: Event) => {\n const ev = e as ContextEvent<typeof languagesContext>;\n\n if (ev.context === languagesContext) {\n this.#languagesController.initialize();\n }\n });\n }\n }\n\n return LanguagesContextMixinClass as Constructor<LanguagesContextInterface> &\n T;\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { LitElement } from "lit";
2
+ import type { ProxyOptions } from "../../types.js";
3
+ import type { Constructor } from "./types.js";
4
+ export declare const socketUrlContext: {
5
+ __context__: string | undefined;
6
+ };
7
+ export declare const socketProxyContext: {
8
+ __context__: ProxyOptions | undefined;
9
+ };
10
+ export declare class ProxyContextInterface {
11
+ socketUrl?: string;
12
+ socketProxy?: ProxyOptions;
13
+ }
14
+ export declare function ProxyContextMixin<T extends Constructor<LitElement>>(superclass: T): Constructor<ProxyContextInterface> & T;
@@ -0,0 +1,24 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { createContext, provide } from "@lit/context";
8
+ import { property } from "lit/decorators.js";
9
+ export const socketUrlContext = createContext(Symbol("socketUrl"));
10
+ export const socketProxyContext = createContext(Symbol("socketProxy"));
11
+ export function ProxyContextMixin(superclass) {
12
+ class ProxyContextMixinClass extends superclass {
13
+ }
14
+ __decorate([
15
+ provide({ context: socketUrlContext }),
16
+ property({ type: String })
17
+ ], ProxyContextMixinClass.prototype, "socketUrl", void 0);
18
+ __decorate([
19
+ provide({ context: socketProxyContext }),
20
+ property({ attribute: false, type: Object })
21
+ ], ProxyContextMixinClass.prototype, "socketProxy", void 0);
22
+ return ProxyContextMixinClass;
23
+ }
24
+ //# sourceMappingURL=proxy-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy-context.js","sourceRoot":"","sources":["../../../src/contexts/mixins/proxy-context.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAC3C,MAAM,CAAC,WAAW,CAAC,CACpB,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAC7C,MAAM,CAAC,aAAa,CAAC,CACtB,CAAC;AAOF,MAAM,UAAU,iBAAiB,CAC/B,UAAa;IAEb,MAAM,sBAAuB,SAAQ,UAAU;KAY9C;IALC;QAFC,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;QACtC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DACR;IAInB;QAFC,OAAO,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;QACxC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAClB;IAG7B,OAAO,sBAAgE,CAAC;AAC1E,CAAC","sourcesContent":["import { createContext, provide } from \"@lit/context\";\nimport type { LitElement } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport type { ProxyOptions } from \"../../types.js\";\nimport type { Constructor } from \"./types.js\";\n\nexport const socketUrlContext = createContext<string | undefined>(\n Symbol(\"socketUrl\"),\n);\nexport const socketProxyContext = createContext<ProxyOptions | undefined>(\n Symbol(\"socketProxy\"),\n);\n\nexport declare class ProxyContextInterface {\n socketUrl?: string;\n socketProxy?: ProxyOptions;\n}\n\nexport function ProxyContextMixin<T extends Constructor<LitElement>>(\n superclass: T,\n): Constructor<ProxyContextInterface> & T {\n class ProxyContextMixinClass extends superclass {\n // ─────────────────────────────────────────────────────────────────────────────\n // Properties\n // ─────────────────────────────────────────────────────────────────────────────\n\n @provide({ context: socketUrlContext })\n @property({ type: String })\n socketUrl?: string;\n\n @provide({ context: socketProxyContext })\n @property({ attribute: false, type: Object })\n socketProxy?: ProxyOptions;\n }\n\n return ProxyContextMixinClass as Constructor<ProxyContextInterface> & T;\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { LitElement } from "lit";
2
+ import type { RecordingState } from "../../types.js";
3
+ import type { Constructor } from "./types.js";
4
+ /**
5
+ * Lit context and mixin for recording UI state (`stopped`, `recording`, …).
6
+ */
7
+ export declare const recordingStateContext: {
8
+ __context__: RecordingState;
9
+ };
10
+ export declare class RecordingStateContextInterface {
11
+ recordingState: RecordingState;
12
+ }
13
+ export declare function RecordingStateContextMixin<T extends Constructor<LitElement>>(superclass: T): Constructor<RecordingStateContextInterface> & T;
@@ -0,0 +1,30 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { createContext, provide } from "@lit/context";
8
+ import { state } from "lit/decorators.js";
9
+ /**
10
+ * Lit context and mixin for recording UI state (`stopped`, `recording`, …).
11
+ */
12
+ export const recordingStateContext = createContext(Symbol("recordingState"));
13
+ export function RecordingStateContextMixin(superclass) {
14
+ class RecordingStateContextMixinClass extends superclass {
15
+ constructor(...args) {
16
+ super(...args);
17
+ this.recordingState = "stopped";
18
+ this.addEventListener("recording-state-changed", (e) => {
19
+ const event = e;
20
+ this.recordingState = event.detail.state;
21
+ });
22
+ }
23
+ }
24
+ __decorate([
25
+ provide({ context: recordingStateContext }),
26
+ state()
27
+ ], RecordingStateContextMixinClass.prototype, "recordingState", void 0);
28
+ return RecordingStateContextMixinClass;
29
+ }
30
+ //# sourceMappingURL=recording-state-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recording-state-context.js","sourceRoot":"","sources":["../../../src/contexts/mixins/recording-state-context.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C;;GAEG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAChD,MAAM,CAAC,gBAAgB,CAAC,CACzB,CAAC;AAMF,MAAM,UAAU,0BAA0B,CACxC,UAAa;IAEb,MAAM,+BAAgC,SAAQ,UAAU;QAKtD,YAAY,GAAG,IAAW;YACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAHjB,mBAAc,GAAmB,SAAS,CAAC;YAKzC,IAAI,CAAC,gBAAgB,CAAC,yBAAyB,EAAE,CAAC,CAAQ,EAAE,EAAE;gBAC5D,MAAM,KAAK,GAAG,CAA2C,CAAC;gBAE1D,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC;KACF;IAXC;QAFC,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QAC3C,KAAK,EAAE;2EACmC;IAa7C,OAAO,+BACJ,CAAC;AACN,CAAC","sourcesContent":["import { createContext, provide } from \"@lit/context\";\nimport type { LitElement } from \"lit\";\nimport { state } from \"lit/decorators.js\";\nimport type { RecordingState } from \"../../types.js\";\nimport type { Constructor } from \"./types.js\";\n\n/**\n * Lit context and mixin for recording UI state (`stopped`, `recording`, …).\n */\n\nexport const recordingStateContext = createContext<RecordingState>(\n Symbol(\"recordingState\"),\n);\n\nexport declare class RecordingStateContextInterface {\n recordingState: RecordingState;\n}\n\nexport function RecordingStateContextMixin<T extends Constructor<LitElement>>(\n superclass: T,\n): Constructor<RecordingStateContextInterface> & T {\n class RecordingStateContextMixinClass extends superclass {\n @provide({ context: recordingStateContext })\n @state()\n recordingState: RecordingState = \"stopped\";\n\n constructor(...args: any[]) {\n super(...args);\n\n this.addEventListener(\"recording-state-changed\", (e: Event) => {\n const event = e as CustomEvent<{ state: RecordingState }>;\n\n this.recordingState = event.detail.state;\n });\n }\n }\n\n return RecordingStateContextMixinClass as Constructor<RecordingStateContextInterface> &\n T;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Constructor signature for Lit class mixins
3
+ * (https://lit.dev/docs/composition/mixins/).
4
+ */
5
+ export type Constructor<T extends object = object> = new (...args: any[]) => T;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/contexts/mixins/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Constructor signature for Lit class mixins\n * (https://lit.dev/docs/composition/mixins/).\n */\nexport type Constructor<T extends object = object> = new (...args: any[]) => T;\n"]}
@@ -0,0 +1,8 @@
1
+ import { type CSSResultGroup, LitElement } from "lit";
2
+ declare const RootContext_base: import("./mixins/types.js").Constructor<import("./mixins/devices-context.js").DevicesContextInterface> & import("./mixins/types.js").Constructor<import("./mixins/recording-state-context.js").RecordingStateContextInterface> & import("./mixins/types.js").Constructor<import("./mixins/keybindings-context.js").KeybindingsContextInterface> & import("./mixins/types.js").Constructor<import("./mixins/languages-context.js").LanguagesContextInterface> & import("./mixins/types.js").Constructor<import("./mixins/auth-context.js").AuthContextInterface> & import("./mixins/types.js").Constructor<import("./mixins/proxy-context.js").ProxyContextInterface> & typeof LitElement;
3
+ export declare class RootContext extends RootContext_base {
4
+ noWrapper: boolean;
5
+ static styles: CSSResultGroup;
6
+ render(): import("lit-html").TemplateResult<1>;
7
+ }
8
+ export {};
@@ -0,0 +1,34 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, LitElement } from "lit";
8
+ import { property } from "lit/decorators.js";
9
+ import ComponentStyles from "../styles/component-styles.js";
10
+ import { AuthContextMixin } from "./mixins/auth-context.js";
11
+ import { DevicesContextMixin } from "./mixins/devices-context.js";
12
+ import { KeybindingsContextMixin } from "./mixins/keybindings-context.js";
13
+ import { LanguagesContextMixin } from "./mixins/languages-context.js";
14
+ import { ProxyContextMixin } from "./mixins/proxy-context.js";
15
+ import { RecordingStateContextMixin } from "./mixins/recording-state-context.js";
16
+ export class RootContext extends DevicesContextMixin(RecordingStateContextMixin(KeybindingsContextMixin(LanguagesContextMixin(AuthContextMixin(ProxyContextMixin(LitElement)))))) {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.noWrapper = false;
20
+ }
21
+ render() {
22
+ if (this.noWrapper) {
23
+ return html `<slot></slot>`;
24
+ }
25
+ return html `<div class="wrapper">
26
+ <slot></slot>
27
+ </div>`;
28
+ }
29
+ }
30
+ RootContext.styles = [ComponentStyles];
31
+ __decorate([
32
+ property({ type: Boolean })
33
+ ], RootContext.prototype, "noWrapper", void 0);
34
+ //# sourceMappingURL=root-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-context.js","sourceRoot":"","sources":["../../src/contexts/root-context.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAuB,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,MAAM,OAAO,WAAY,SAAQ,mBAAmB,CAClD,0BAA0B,CACxB,uBAAuB,CACrB,qBAAqB,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CACvE,CACF,CACF;IAND;;QAQE,cAAS,GAAY,KAAK,CAAC;IAa7B,CAAC;IATC,MAAM;QACJ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO,IAAI,CAAA,eAAe,CAAC;QAC7B,CAAC;QAED,OAAO,IAAI,CAAA;;WAEJ,CAAC;IACV,CAAC;;AAVM,kBAAM,GAAmB,CAAC,eAAe,CAAC,AAApC,CAAqC;AAFlD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACD","sourcesContent":["import { type CSSResultGroup, html, LitElement } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport ComponentStyles from \"../styles/component-styles.js\";\nimport { AuthContextMixin } from \"./mixins/auth-context.js\";\nimport { DevicesContextMixin } from \"./mixins/devices-context.js\";\nimport { KeybindingsContextMixin } from \"./mixins/keybindings-context.js\";\nimport { LanguagesContextMixin } from \"./mixins/languages-context.js\";\nimport { ProxyContextMixin } from \"./mixins/proxy-context.js\";\nimport { RecordingStateContextMixin } from \"./mixins/recording-state-context.js\";\n\nexport class RootContext extends DevicesContextMixin(\n RecordingStateContextMixin(\n KeybindingsContextMixin(\n LanguagesContextMixin(AuthContextMixin(ProxyContextMixin(LitElement))),\n ),\n ),\n) {\n @property({ type: Boolean })\n noWrapper: boolean = false;\n\n static styles: CSSResultGroup = [ComponentStyles];\n\n render() {\n if (this.noWrapper) {\n return html`<slot></slot>`;\n }\n\n return html`<div class=\"wrapper\">\n <slot></slot>\n </div>`;\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { type Corti, type CortiClient } from "@corti/sdk";
2
+ import type { ProxyOptions } from "../types.js";
3
+ import { SocketController } from "./socket-controller.js";
4
+ export type AmbientStreamSessionConfig = {
5
+ interactionId: string;
6
+ configuration: Corti.StreamConfig;
7
+ };
8
+ type AmbientStreamSocket = Awaited<ReturnType<CortiClient["stream"]["connect"]>>;
9
+ export type StreamAmbientMessage = Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamDeltaUsageMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage | Corti.StreamConfigStatusMessage;
10
+ type OutboundItem = Blob | Corti.StreamEndMessage;
11
+ export declare class AmbientController extends SocketController<OutboundItem, StreamAmbientMessage, AmbientStreamSessionConfig, AmbientStreamSocket> {
12
+ stopRecording(): Promise<void>;
13
+ protected _connectThroughProxy(session: AmbientStreamSessionConfig, proxy: ProxyOptions): Promise<AmbientStreamSocket>;
14
+ protected _connectThroughAuth(client: CortiClient, session: AmbientStreamSessionConfig): Promise<AmbientStreamSocket>;
15
+ }
16
+ export {};
@@ -0,0 +1,24 @@
1
+ import { CortiWebSocketProxyClient, } from "@corti/sdk";
2
+ import { SocketController } from "./socket-controller.js";
3
+ export class AmbientController extends SocketController {
4
+ async stopRecording() {
5
+ await this.closeConnection();
6
+ }
7
+ async _connectThroughProxy(session, proxy) {
8
+ return await CortiWebSocketProxyClient.stream.connect({
9
+ // awaitConfiguration: false — CONFIG_* appears in network activity before the socket is configured server-side
10
+ awaitConfiguration: false,
11
+ configuration: session.configuration,
12
+ proxy,
13
+ });
14
+ }
15
+ async _connectThroughAuth(client, session) {
16
+ return await client.stream.connect({
17
+ // awaitConfiguration: false — CONFIG_* appears in network activity before the socket is configured server-side
18
+ awaitConfiguration: false,
19
+ configuration: session.configuration,
20
+ id: session.interactionId,
21
+ });
22
+ }
23
+ }
24
+ //# sourceMappingURL=ambient-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ambient-controller.js","sourceRoot":"","sources":["../../src/controllers/ambient-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAuB1D,MAAM,OAAO,iBAAkB,SAAQ,gBAKtC;IACC,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC;IAES,KAAK,CAAC,oBAAoB,CAClC,OAAmC,EACnC,KAAmB;QAEnB,OAAO,MAAM,yBAAyB,CAAC,MAAM,CAAC,OAAO,CAAC;YACpD,+GAA+G;YAC/G,kBAAkB,EAAE,KAAK;YACzB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,mBAAmB,CACjC,MAAmB,EACnB,OAAmC;QAEnC,OAAO,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;YACjC,+GAA+G;YAC/G,kBAAkB,EAAE,KAAK;YACzB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,EAAE,EAAE,OAAO,CAAC,aAAa;SAC1B,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import {\n type Corti,\n type CortiClient,\n CortiWebSocketProxyClient,\n} from \"@corti/sdk\";\nimport type { ProxyOptions } from \"../types.js\";\nimport { SocketController } from \"./socket-controller.js\";\n\nexport type AmbientStreamSessionConfig = {\n interactionId: string;\n configuration: Corti.StreamConfig;\n};\n\ntype AmbientStreamSocket = Awaited<\n ReturnType<CortiClient[\"stream\"][\"connect\"]>\n>;\n\nexport type StreamAmbientMessage =\n | Corti.StreamTranscriptMessage\n | Corti.StreamFactsMessage\n | Corti.StreamFlushedMessage\n | Corti.StreamDeltaUsageMessage\n | Corti.StreamEndedMessage\n | Corti.StreamUsageMessage\n | Corti.StreamErrorMessage\n | Corti.StreamConfigStatusMessage;\n\ntype OutboundItem = Blob | Corti.StreamEndMessage;\n\nexport class AmbientController extends SocketController<\n OutboundItem,\n StreamAmbientMessage,\n AmbientStreamSessionConfig,\n AmbientStreamSocket\n> {\n async stopRecording(): Promise<void> {\n await this.closeConnection();\n }\n\n protected async _connectThroughProxy(\n session: AmbientStreamSessionConfig,\n proxy: ProxyOptions,\n ): Promise<AmbientStreamSocket> {\n return await CortiWebSocketProxyClient.stream.connect({\n // awaitConfiguration: false — CONFIG_* appears in network activity before the socket is configured server-side\n awaitConfiguration: false,\n configuration: session.configuration,\n proxy,\n });\n }\n\n protected async _connectThroughAuth(\n client: CortiClient,\n session: AmbientStreamSessionConfig,\n ): Promise<AmbientStreamSocket> {\n return await client.stream.connect({\n // awaitConfiguration: false — CONFIG_* appears in network activity before the socket is configured server-side\n awaitConfiguration: false,\n configuration: session.configuration,\n id: session.interactionId,\n });\n }\n}\n"]}
@@ -1,35 +1,12 @@
1
- import { type Corti, type CortiAuth } from "@corti/sdk";
2
- import type { ReactiveController, ReactiveControllerHost } from "lit";
1
+ import { type Corti, type CortiClient } from "@corti/sdk";
3
2
  import type { ProxyOptions } from "../types.js";
4
- interface DictationControllerHost extends ReactiveControllerHost {
5
- dispatchEvent: (event: Event) => void;
6
- _accessToken?: string;
7
- _authConfig?: CortiAuth.AuthTokenDerivable;
8
- _region?: string;
9
- _tenantName?: string;
10
- _socketUrl?: string;
11
- _socketProxy?: ProxyOptions;
12
- _dictationConfig?: Corti.TranscribeConfig;
13
- }
3
+ import { SocketController } from "./socket-controller.js";
4
+ type TranscribeSocket = Awaited<ReturnType<CortiClient["transcribe"]["connect"]>>;
14
5
  export type TranscribeMessage = Corti.TranscribeConfigStatusMessage | Corti.TranscribeUsageMessage | Corti.TranscribeDeltaUsageMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage | Corti.TranscribeFlushedMessage;
15
- interface WebSocketCallbacks {
16
- onMessage?: (message: TranscribeMessage) => void;
17
- onError?: (error: Error) => void;
18
- onClose?: (event: unknown) => void;
19
- onNetworkActivity?: (direction: "sent" | "received", data: unknown) => void;
20
- }
21
- export declare class DictationController implements ReactiveController {
22
- #private;
23
- host: DictationControllerHost;
24
- constructor(host: DictationControllerHost);
25
- hostDisconnected(): void;
26
- connect(dictationConfig?: Corti.TranscribeConfig, callbacks?: WebSocketCallbacks): Promise<boolean | "superseded">;
27
- mediaRecorderHandler: (data: Blob) => void;
28
- pause(): Promise<void>;
29
- isConnectionOpen(): boolean;
30
- isConnecting(): boolean;
31
- waitForConnection(): Promise<void>;
32
- closeConnection(onClose?: (event: unknown) => void): Promise<void>;
33
- cleanup(): void;
6
+ type OutboundItem = Blob | Corti.TranscribeFlushMessage | Corti.TranscribeEndMessage;
7
+ export declare class DictationController extends SocketController<OutboundItem, TranscribeMessage, Corti.TranscribeConfig, TranscribeSocket> {
8
+ stopRecording(): Promise<void>;
9
+ protected _connectThroughProxy(dictationConfig: Corti.TranscribeConfig, proxy: ProxyOptions): Promise<TranscribeSocket>;
10
+ protected _connectThroughAuth(client: CortiClient, dictationConfig: Corti.TranscribeConfig): Promise<TranscribeSocket>;
34
11
  }
35
12
  export {};