@speechos/client 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export { snippetsStore, getSnippets, addSnippet, updateSnippet, deleteSnippet, c
17
17
  export type { Snippet, SnippetValidationError, AddSnippetResult, } from "./stores/snippets-store.js";
18
18
  export { vocabularyStore, getVocabulary, addTerm, deleteTerm, clearVocabulary, getVocabularyCount, isAtVocabularyLimit, } from "./stores/vocabulary-store.js";
19
19
  export type { VocabularyTerm, VocabularyValidationError, AddTermResult, } from "./stores/vocabulary-store.js";
20
- export { getClientConfig, setClientConfig, resetClientConfig, hasCommands, getCommands, getZIndex, } from "./config.js";
20
+ export { getClientConfig, setClientConfig, resetClientConfig, hasCommands, getCommands, getZIndex, useExternalSettings, } from "./config.js";
21
21
  export type { SpeechOSClientConfig, ResolvedClientConfig } from "./config.js";
22
22
  export { formDetector, FormDetector } from "./form-detector.js";
23
23
  export type { FormDetectorInterface } from "./form-detector.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG9E,OAAO,EACL,MAAM,EACN,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,OAAO,EACP,YAAY,GACb,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AACtC,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AAC;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,CAAC;AACrC,eAAe,aAAa,CAAC"}
@@ -26912,7 +26912,6 @@
26912
26912
  host: DEFAULT_HOST,
26913
26913
  debug: false,
26914
26914
  webSocketFactory: void 0,
26915
- fetchHandler: void 0,
26916
26915
  settingsToken: void 0
26917
26916
  };
26918
26917
  /**
@@ -26921,14 +26920,13 @@
26921
26920
  * @returns Validated and merged configuration
26922
26921
  */
26923
26922
  function validateConfig(userConfig) {
26924
- if (!userConfig.apiKey) throw new Error("SpeechOS requires an apiKey. Get one from your team dashboard at /a/<team-slug>/.");
26923
+ if (!userConfig.apiKey) throw new Error("SpeechOS requires an apiKey. Get one from your team dashboard at /a/.");
26925
26924
  return {
26926
26925
  apiKey: userConfig.apiKey,
26927
26926
  userId: userConfig.userId ?? defaultConfig.userId,
26928
26927
  host: userConfig.host ?? defaultConfig.host,
26929
26928
  debug: userConfig.debug ?? defaultConfig.debug,
26930
26929
  webSocketFactory: userConfig.webSocketFactory ?? defaultConfig.webSocketFactory,
26931
- fetchHandler: userConfig.fetchHandler ?? defaultConfig.fetchHandler,
26932
26930
  settingsToken: userConfig.settingsToken ?? defaultConfig.settingsToken
26933
26931
  };
26934
26932
  }
@@ -26982,13 +26980,6 @@
26982
26980
  };
26983
26981
  }
26984
26982
  /**
26985
- * Get the fetch handler from the current configuration
26986
- * @returns The fetch handler or undefined if not configured
26987
- */
26988
- function getFetchHandler() {
26989
- return currentConfig.fetchHandler;
26990
- }
26991
- /**
26992
26983
  * LocalStorage key for anonymous ID persistence
26993
26984
  */
26994
26985
  const ANONYMOUS_ID_KEY = "speechos_anonymous_id";
@@ -28805,6 +28796,7 @@
28805
28796
  commands: [],
28806
28797
  zIndex: 999999,
28807
28798
  alwaysVisible: false,
28799
+ useExternalSettings: false,
28808
28800
  };
28809
28801
  /**
28810
28802
  * Current client configuration singleton
@@ -28820,6 +28812,7 @@
28820
28812
  commands: config.commands ?? defaultClientConfig.commands,
28821
28813
  zIndex: config.zIndex ?? defaultClientConfig.zIndex,
28822
28814
  alwaysVisible: config.alwaysVisible ?? defaultClientConfig.alwaysVisible,
28815
+ useExternalSettings: config.useExternalSettings ?? defaultClientConfig.useExternalSettings,
28823
28816
  };
28824
28817
  // Validate zIndex
28825
28818
  if (typeof resolved.zIndex !== "number" || resolved.zIndex < 0) {
@@ -28871,6 +28864,12 @@
28871
28864
  function isAlwaysVisible() {
28872
28865
  return currentClientConfig.alwaysVisible;
28873
28866
  }
28867
+ /**
28868
+ * Check if external settings page should be used
28869
+ */
28870
+ function useExternalSettings() {
28871
+ return currentClientConfig.useExternalSettings;
28872
+ }
28874
28873
 
28875
28874
  /**
28876
28875
  * Form field focus detection for SpeechOS Client SDK
@@ -29285,9 +29284,12 @@
29285
29284
  * Sorted alphabetically by name for dropdown display
29286
29285
  */
29287
29286
  const SUPPORTED_LANGUAGES = [
29287
+ { name: "Belarusian", code: "be", variants: ["be"] },
29288
+ { name: "Bengali", code: "bn", variants: ["bn"] },
29289
+ { name: "Bosnian", code: "bs", variants: ["bs"] },
29288
29290
  { name: "Bulgarian", code: "bg", variants: ["bg"] },
29289
29291
  { name: "Catalan", code: "ca", variants: ["ca"] },
29290
- { name: "Chinese", code: "zh", variants: ["zh"] },
29292
+ { name: "Croatian", code: "hr", variants: ["hr"] },
29291
29293
  { name: "Czech", code: "cs", variants: ["cs"] },
29292
29294
  { name: "Danish", code: "da", variants: ["da", "da-DK"] },
29293
29295
  { name: "Dutch", code: "nl", variants: ["nl"] },
@@ -29308,18 +29310,26 @@
29308
29310
  { name: "Indonesian", code: "id", variants: ["id"] },
29309
29311
  { name: "Italian", code: "it", variants: ["it"] },
29310
29312
  { name: "Japanese", code: "ja", variants: ["ja"] },
29313
+ { name: "Kannada", code: "kn", variants: ["kn"] },
29311
29314
  { name: "Korean", code: "ko", variants: ["ko", "ko-KR"] },
29312
29315
  { name: "Latvian", code: "lv", variants: ["lv"] },
29313
29316
  { name: "Lithuanian", code: "lt", variants: ["lt"] },
29317
+ { name: "Macedonian", code: "mk", variants: ["mk"] },
29314
29318
  { name: "Malay", code: "ms", variants: ["ms"] },
29319
+ { name: "Marathi", code: "mr", variants: ["mr"] },
29315
29320
  { name: "Norwegian", code: "no", variants: ["no"] },
29316
29321
  { name: "Polish", code: "pl", variants: ["pl"] },
29317
29322
  { name: "Portuguese", code: "pt", variants: ["pt", "pt-BR", "pt-PT"] },
29318
29323
  { name: "Romanian", code: "ro", variants: ["ro"] },
29319
29324
  { name: "Russian", code: "ru", variants: ["ru"] },
29325
+ { name: "Serbian", code: "sr", variants: ["sr"] },
29320
29326
  { name: "Slovak", code: "sk", variants: ["sk"] },
29327
+ { name: "Slovenian", code: "sl", variants: ["sl"] },
29321
29328
  { name: "Spanish", code: "es", variants: ["es", "es-419"] },
29322
29329
  { name: "Swedish", code: "sv", variants: ["sv", "sv-SE"] },
29330
+ { name: "Tagalog", code: "tl", variants: ["tl"] },
29331
+ { name: "Tamil", code: "ta", variants: ["ta"] },
29332
+ { name: "Telugu", code: "te", variants: ["te"] },
29323
29333
  { name: "Turkish", code: "tr", variants: ["tr"] },
29324
29334
  { name: "Ukrainian", code: "uk", variants: ["uk"] },
29325
29335
  { name: "Vietnamese", code: "vi", variants: ["vi"] },
@@ -30112,25 +30122,14 @@
30112
30122
  this.syncDisabled = false;
30113
30123
  }
30114
30124
  /**
30115
- * Make a fetch request using custom fetchHandler if configured, otherwise native fetch.
30116
- * This allows the Chrome extension to route fetch traffic through the service worker
30117
- * to bypass page CSP restrictions.
30125
+ * Make a fetch request using native fetch.
30118
30126
  */
30119
30127
  async doFetch(url, options) {
30120
30128
  const config = getConfig();
30121
- const customHandler = getFetchHandler();
30122
- if (customHandler) {
30123
- if (config.debug) {
30124
- console.log("[SpeechOS] Using custom fetch handler (extension proxy)", options.method, url);
30125
- }
30126
- return customHandler(url, options);
30127
- }
30128
30129
  if (config.debug) {
30129
30130
  console.log("[SpeechOS] Using native fetch", options.method, url);
30130
30131
  }
30131
- // Use native fetch and wrap response to match FetchResponse interface
30132
- const response = await fetch(url, options);
30133
- return response;
30132
+ return fetch(url, options);
30134
30133
  }
30135
30134
  /**
30136
30135
  * Initialize the settings sync manager
@@ -34006,6 +34005,16 @@
34006
34005
  padding: 8px;
34007
34006
  }
34008
34007
 
34008
+ .settings-select:disabled {
34009
+ opacity: 0.4;
34010
+ cursor: not-allowed;
34011
+ }
34012
+
34013
+ .settings-select:disabled:hover {
34014
+ border-color: rgba(255, 255, 255, 0.08);
34015
+ background: rgba(0, 0, 0, 0.3);
34016
+ }
34017
+
34009
34018
  .settings-select-arrow {
34010
34019
  position: absolute;
34011
34020
  right: 14px;
@@ -34187,13 +34196,14 @@
34187
34196
  setSmartFormatEnabled(this.smartFormatEnabled);
34188
34197
  this.showSaved();
34189
34198
  }
34190
- renderLanguageSelector(selectedCode, onChange) {
34199
+ renderLanguageSelector(selectedCode, onChange, disabled = false) {
34191
34200
  return b `
34192
34201
  <div class="settings-select-wrapper">
34193
34202
  <select
34194
34203
  class="settings-select"
34195
34204
  .value="${selectedCode}"
34196
34205
  @change="${onChange}"
34206
+ ?disabled="${disabled}"
34197
34207
  >
34198
34208
  ${SUPPORTED_LANGUAGES.map((lang) => b `
34199
34209
  <option
@@ -34311,7 +34321,7 @@
34311
34321
  <div class="settings-section-description">
34312
34322
  AI automatically removes filler words, adds punctuation, and polishes
34313
34323
  your text. Disable for raw transcription output. Note: disabling also
34314
- turns off text snippets.
34324
+ turns off text snippets and output language translation.
34315
34325
  </div>
34316
34326
  <div class="settings-toggle-row">
34317
34327
  <span class="settings-toggle-label">Enable AI formatting</span>
@@ -34352,9 +34362,13 @@
34352
34362
  </div>
34353
34363
  <div class="settings-section-description">
34354
34364
  The language for your transcribed text. Usually the same as input, but
34355
- can differ for translation.
34365
+ can differ for translation.${!this.smartFormatEnabled
34366
+ ? " Requires Smart Format to be enabled."
34367
+ : ""}
34356
34368
  </div>
34357
- ${this.renderLanguageSelector(this.selectedOutputLanguageCode, this.handleOutputLanguageChange.bind(this))}
34369
+ ${this.renderLanguageSelector(this.smartFormatEnabled
34370
+ ? this.selectedOutputLanguageCode
34371
+ : this.selectedInputLanguageCode, this.handleOutputLanguageChange.bind(this), !this.smartFormatEnabled)}
34358
34372
  </div>
34359
34373
  `;
34360
34374
  }
@@ -36340,7 +36354,14 @@
36340
36354
  state.hide();
36341
36355
  }
36342
36356
  handleSettingsClick() {
36343
- this.settingsOpen = true;
36357
+ if (useExternalSettings()) {
36358
+ const host = getConfig().host;
36359
+ const fullUrl = `${host}/a/extension-settings`;
36360
+ window.open(fullUrl, '_blank', 'noopener,noreferrer');
36361
+ }
36362
+ else {
36363
+ this.settingsOpen = true;
36364
+ }
36344
36365
  }
36345
36366
  handleDragStart(e) {
36346
36367
  if (e.button !== 0)
@@ -36881,10 +36902,17 @@
36881
36902
  this.editSelectionStart = null;
36882
36903
  this.editSelectionEnd = null;
36883
36904
  this.editSelectedText = "";
36884
- // Open settings modal
36885
- this.settingsOpen = true;
36905
+ // Open settings - either external URL or modal
36906
+ if (useExternalSettings()) {
36907
+ const host = getConfig().host;
36908
+ const fullUrl = `${host}/a/extension-settings`;
36909
+ window.open(fullUrl, '_blank', 'noopener,noreferrer');
36910
+ }
36911
+ else {
36912
+ this.settingsOpen = true;
36913
+ }
36886
36914
  if (getConfig().debug) {
36887
- console.log("[SpeechOS] Settings modal opened from no-audio warning");
36915
+ console.log("[SpeechOS] Settings opened from no-audio warning", { useExternalSettings: useExternalSettings() });
36888
36916
  }
36889
36917
  await disconnectPromise;
36890
36918
  }
@@ -37465,6 +37493,7 @@
37465
37493
  exports.state = state;
37466
37494
  exports.transcriptStore = transcriptStore;
37467
37495
  exports.updateSnippet = updateSnippet;
37496
+ exports.useExternalSettings = useExternalSettings;
37468
37497
  exports.vocabularyStore = vocabularyStore;
37469
37498
 
37470
37499
  Object.defineProperty(exports, '__esModule', { value: true });