@corti/dictation-web 0.7.0-ambient.6 → 0.7.0-ambient.7

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/bundle.js CHANGED
@@ -1679,18 +1679,31 @@ var AmbientRoot = class AmbientRoot2 extends RootContext {
1679
1679
  this.addEventListener("virtual-mode-changed", (e10) => {
1680
1680
  const event = e10;
1681
1681
  this.virtualMode = event.detail.enabled;
1682
- if (!event.detail.enabled) {
1683
- return;
1684
- }
1685
1682
  const base = this.ambientConfig ?? DEFAULT_STREAM_CONFIG;
1686
- this.ambientConfig = {
1687
- ...base,
1688
- transcription: {
1689
- ...base.transcription,
1690
- isDiarization: false,
1691
- isMultichannel: true
1692
- }
1693
- };
1683
+ if (event.detail.enabled) {
1684
+ this.ambientConfig = {
1685
+ ...base,
1686
+ transcription: {
1687
+ ...base.transcription,
1688
+ isDiarization: false,
1689
+ isMultichannel: true,
1690
+ participants: [
1691
+ { channel: 0, role: "doctor" },
1692
+ { channel: 1, role: "patient" }
1693
+ ]
1694
+ }
1695
+ };
1696
+ } else {
1697
+ this.ambientConfig = {
1698
+ ...base,
1699
+ transcription: {
1700
+ ...base.transcription,
1701
+ isDiarization: true,
1702
+ isMultichannel: false,
1703
+ participants: []
1704
+ }
1705
+ };
1706
+ }
1694
1707
  });
1695
1708
  this.addEventListener("languages-changed", (e10) => {
1696
1709
  const event = e10;
@@ -19,19 +19,33 @@ let AmbientRoot = class AmbientRoot extends RootContext {
19
19
  this.addEventListener("virtual-mode-changed", (e) => {
20
20
  const event = e;
21
21
  this.virtualMode = event.detail.enabled;
22
- if (!event.detail.enabled) {
23
- return;
24
- }
25
22
  // Set multichannel transcription for virtual mode
26
23
  const base = this.ambientConfig ?? DEFAULT_STREAM_CONFIG;
27
- this.ambientConfig = {
28
- ...base,
29
- transcription: {
30
- ...base.transcription,
31
- isDiarization: false,
32
- isMultichannel: true,
33
- },
34
- };
24
+ if (event.detail.enabled) {
25
+ this.ambientConfig = {
26
+ ...base,
27
+ transcription: {
28
+ ...base.transcription,
29
+ isDiarization: false,
30
+ isMultichannel: true,
31
+ participants: [
32
+ { channel: 0, role: "doctor" },
33
+ { channel: 1, role: "patient" },
34
+ ],
35
+ },
36
+ };
37
+ }
38
+ else {
39
+ this.ambientConfig = {
40
+ ...base,
41
+ transcription: {
42
+ ...base.transcription,
43
+ isDiarization: true,
44
+ isMultichannel: false,
45
+ participants: [],
46
+ },
47
+ };
48
+ }
35
49
  });
36
50
  this.addEventListener("languages-changed", (e) => {
37
51
  const event = e;
@@ -1 +1 @@
1
- {"version":3,"file":"ambient-context.js","sourceRoot":"","sources":["../../src/contexts/ambient-context.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAE/C,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;AAE3B,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC/C,MAAM,CAAC,eAAe,CAAC,CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAU,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAGzE,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,WAAW;IAa1C;QACE,KAAK,EAAE,CAAC;QAXV,kBAAa,GAAuB,qBAAqB,CAAC;QAQ1D,gBAAW,GAAY,KAAK,CAAC;QAK3B,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC,CAAQ,EAAE,EAAE;YACzD,MAAM,KAAK,GAAG,CAAsC,CAAC;YACrD,IAAI,CAAC,WAAW,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AAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACa;AAI1D;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACJ;AAIvB;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IACxC,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDACzB;AAXlB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAoEvB","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { createContext, provide } from \"@lit/context\";\nimport type { PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { DEFAULT_STREAM_CONFIG } from \"../constants.js\";\nimport { RootContext } from \"./root-context.js\";\n\nexport const ambientConfigContext = createContext<\n Corti.StreamConfig | undefined\n>(Symbol(\"ambientConfig\"));\n\nexport const interactionIdContext = createContext<string | undefined>(\n Symbol(\"interactionId\"),\n);\n\nexport const virtualModeContext = createContext<boolean>(Symbol(\"virtualMode\"));\n\n@customElement(\"ambient-root\")\nexport class AmbientRoot extends RootContext {\n @provide({ context: ambientConfigContext })\n @property({ attribute: false, type: Object })\n ambientConfig: Corti.StreamConfig = DEFAULT_STREAM_CONFIG;\n\n @provide({ context: interactionIdContext })\n @property({ type: String })\n interactionId?: string;\n\n @provide({ context: virtualModeContext })\n @property({ attribute: \"virtualMode\", type: Boolean })\n virtualMode: boolean = false;\n\n constructor() {\n super();\n\n this.addEventListener(\"virtual-mode-changed\", (e: Event) => {\n const event = e as CustomEvent<{ enabled: boolean }>;\n this.virtualMode = event.detail.enabled;\n\n if (!event.detail.enabled) {\n return;\n }\n\n // Set multichannel transcription for virtual mode\n const base = this.ambientConfig ?? DEFAULT_STREAM_CONFIG;\n\n this.ambientConfig = {\n ...base,\n transcription: {\n ...base.transcription,\n isDiarization: false,\n isMultichannel: true,\n },\n };\n });\n\n this.addEventListener(\"languages-changed\", (e: Event) => {\n const event = e as CustomEvent;\n\n const lang = (event.detail.selectedLanguage ??\n \"en\") as Corti.TranscribeSupportedLanguage;\n const base = this.ambientConfig ?? DEFAULT_STREAM_CONFIG;\n\n this.ambientConfig = {\n ...base,\n mode: {\n ...base.mode,\n outputLocale: lang,\n },\n transcription: {\n ...base.transcription,\n primaryLanguage: lang,\n },\n };\n });\n }\n\n protected override willUpdate(changedProperties: PropertyValues): void {\n super.willUpdate(changedProperties);\n\n if (!changedProperties.has(\"ambientConfig\")) {\n return;\n }\n\n this._selectedLanguage =\n this.ambientConfig?.transcription?.primaryLanguage ?? \"en\";\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ambient-root\": AmbientRoot;\n }\n}\n"]}
1
+ {"version":3,"file":"ambient-context.js","sourceRoot":"","sources":["../../src/contexts/ambient-context.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAE/C,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;AAE3B,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC/C,MAAM,CAAC,eAAe,CAAC,CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAU,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAGzE,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,WAAW;IAa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,CAAC;YAEzD,IAAI,CAAC,aAAa,GAAG;gBACnB,GAAG,IAAI;gBACP,IAAI,EAAE;oBACJ,GAAG,IAAI,CAAC,IAAI;oBACZ,YAAY,EAAE,IAAI;iBACnB;gBACD,aAAa,EAAE;oBACb,GAAG,IAAI,CAAC,aAAa;oBACrB,eAAe,EAAE,IAAI;iBACtB;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEkB,UAAU,CAAC,iBAAiC;QAC7D,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAEpC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;YAC5C,OAAO;QACT,CAAC;QAED,IAAI,CAAC,iBAAiB;YACpB,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,IAAI,IAAI,CAAC;IAC/D,CAAC;CACF,CAAA;AA5EC;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACa;AAI1D;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACJ;AAIvB;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IACxC,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDACzB;AAXlB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA+EvB","sourcesContent":["import type { Corti } from \"@corti/sdk\";\nimport { createContext, provide } from \"@lit/context\";\nimport type { PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { DEFAULT_STREAM_CONFIG } from \"../constants.js\";\nimport { RootContext } from \"./root-context.js\";\n\nexport const ambientConfigContext = createContext<\n Corti.StreamConfig | undefined\n>(Symbol(\"ambientConfig\"));\n\nexport const interactionIdContext = createContext<string | undefined>(\n Symbol(\"interactionId\"),\n);\n\nexport const virtualModeContext = createContext<boolean>(Symbol(\"virtualMode\"));\n\n@customElement(\"ambient-root\")\nexport class AmbientRoot extends RootContext {\n @provide({ context: ambientConfigContext })\n @property({ attribute: false, type: Object })\n ambientConfig: Corti.StreamConfig = DEFAULT_STREAM_CONFIG;\n\n @provide({ context: interactionIdContext })\n @property({ type: String })\n interactionId?: string;\n\n @provide({ context: virtualModeContext })\n @property({ attribute: \"virtualMode\", type: Boolean })\n virtualMode: boolean = false;\n\n constructor() {\n super();\n\n this.addEventListener(\"virtual-mode-changed\", (e: Event) => {\n const event = e as CustomEvent<{ enabled: boolean }>;\n this.virtualMode = event.detail.enabled;\n // Set multichannel transcription for virtual mode\n const base = this.ambientConfig ?? DEFAULT_STREAM_CONFIG;\n\n if (event.detail.enabled) {\n this.ambientConfig = {\n ...base,\n transcription: {\n ...base.transcription,\n isDiarization: false,\n isMultichannel: true,\n participants: [\n { channel: 0, role: \"doctor\" },\n { channel: 1, role: \"patient\" },\n ],\n },\n };\n } else {\n this.ambientConfig = {\n ...base,\n transcription: {\n ...base.transcription,\n isDiarization: true,\n isMultichannel: false,\n participants: [],\n },\n };\n }\n });\n\n this.addEventListener(\"languages-changed\", (e: Event) => {\n const event = e as CustomEvent;\n\n const lang = (event.detail.selectedLanguage ??\n \"en\") as Corti.TranscribeSupportedLanguage;\n const base = this.ambientConfig ?? DEFAULT_STREAM_CONFIG;\n\n this.ambientConfig = {\n ...base,\n mode: {\n ...base.mode,\n outputLocale: lang,\n },\n transcription: {\n ...base.transcription,\n primaryLanguage: lang,\n },\n };\n });\n }\n\n protected override willUpdate(changedProperties: PropertyValues): void {\n super.willUpdate(changedProperties);\n\n if (!changedProperties.has(\"ambientConfig\")) {\n return;\n }\n\n this._selectedLanguage =\n this.ambientConfig?.transcription?.primaryLanguage ?? \"en\";\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ambient-root\": AmbientRoot;\n }\n}\n"]}