@burdenoff/fe-libs 2026.904.1 → 2026.904.3
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/shared/assistant/index.d.ts +3 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/voice/replyLanguage.d.ts +53 -0
- package/dist/shared/assistant/voice/replyLanguage.d.ts.map +1 -0
- package/dist/shared/assistant/voice/replyLanguage.js +112 -0
- package/dist/shared/assistant/voice/speechLabels.d.ts +12 -0
- package/dist/shared/assistant/voice/speechLabels.d.ts.map +1 -0
- package/dist/shared/assistant/voice/speechLabels.js +75 -0
- package/dist/shared/assistant/voice/speechPlayback.d.ts +67 -0
- package/dist/shared/assistant/voice/speechPlayback.d.ts.map +1 -0
- package/dist/shared/assistant/voice/speechPlayback.js +28 -0
- package/dist/shared/config/authBridgeUrls.d.ts.map +1 -1
- package/dist/shared/config/authBridgeUrls.js +16 -15
- package/dist/shared/config/gatewayUrls.d.ts +29 -0
- package/dist/shared/config/gatewayUrls.d.ts.map +1 -1
- package/dist/shared/config/gatewayUrls.js +44 -20
- package/dist/shared/config/index.d.ts.map +1 -1
- package/dist/shared/native/capacitor.d.ts +49 -0
- package/dist/shared/native/capacitor.d.ts.map +1 -0
- package/dist/shared/native/capacitor.js +31 -0
- package/dist/shared/native/index.d.ts +2 -0
- package/dist/shared/native/index.d.ts.map +1 -1
- package/dist/shared/providers/shell/MultiGatewayProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/MultiGatewayProvider.js +101 -100
- package/dist/shared/utils/authCookie.d.ts.map +1 -1
- package/dist/shared/utils/authCookie.js +35 -34
- package/dist/shared/utils/gatewayFetchRewrite.d.ts.map +1 -1
- package/dist/shared/utils/gatewayFetchRewrite.js +95 -87
- package/dist/shared-assistant.js +4 -1
- package/dist/shared-config.js +9 -1
- package/dist/shared-native.js +23 -22
- package/dist/shared.js +124 -123
- package/package.json +2 -2
|
@@ -60,4 +60,7 @@ export * from './operations';
|
|
|
60
60
|
export * from './capabilities';
|
|
61
61
|
export * from './speech/hostedTtsProtocol';
|
|
62
62
|
export * from './i18n';
|
|
63
|
+
export * from './voice/speechLabels';
|
|
64
|
+
export * from './voice/replyLanguage';
|
|
65
|
+
export * from './voice/speechPlayback';
|
|
63
66
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAGxB,cAAc,wBAAwB,CAAC;AAKvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAG9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,gBAAgB,CAAC;AAK/B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAG3C,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAGxB,cAAc,wBAAwB,CAAC;AAKvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAG9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,gBAAgB,CAAC;AAK/B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAG3C,cAAc,QAAQ,CAAC;AAEvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which language is this reply actually in? (BOFF-7107)
|
|
3
|
+
*
|
|
4
|
+
* The assistant reads replies aloud by choosing a voice for `useI18n().locale` —
|
|
5
|
+
* the UI language. That is the wrong signal the moment the model answers in the
|
|
6
|
+
* language the USER wrote in rather than the one the chrome is set to, which is
|
|
7
|
+
* exactly what the language directive in `assistantPrompt` now asks it to do.
|
|
8
|
+
* A Tamil reply read by an English voice is confident nonsense, and it is the
|
|
9
|
+
* one failure the speech module is built to make impossible.
|
|
10
|
+
*
|
|
11
|
+
* So playback keys on the reply text instead. Deliberately by SCRIPT, not by a
|
|
12
|
+
* statistical language detector:
|
|
13
|
+
*
|
|
14
|
+
* - it is deterministic, dependency-free and costs no bundle;
|
|
15
|
+
* - for the languages HealthyBowl actually serves beyond English — Tamil,
|
|
16
|
+
* Hindi, Arabic, Chinese — the script IS the language, unambiguously;
|
|
17
|
+
* - a detector that can separate en/es/fr/de (`franc` and friends) is ~40KB and
|
|
18
|
+
* still guesses on short strings.
|
|
19
|
+
*
|
|
20
|
+
* The honest limitation: **Latin-script languages cannot be told apart this
|
|
21
|
+
* way.** A Spanish reply in an English UI still gets an English voice. That is a
|
|
22
|
+
* far smaller failure than the cross-script one (an English voice reading
|
|
23
|
+
* Spanish is accented but intelligible; an English voice reading Tamil is
|
|
24
|
+
* noise), and closing it needs a real detector — a deliberate later choice, not
|
|
25
|
+
* an oversight.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* The locale whose voice should read `text`, or `null` when the script does not
|
|
29
|
+
* decide it (empty, no letters, or Latin — see the module note).
|
|
30
|
+
*/
|
|
31
|
+
export declare function detectScriptLocale(text: string): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* The locale to speak `text` in: the script when it decides, else the app locale.
|
|
34
|
+
*
|
|
35
|
+
* Falling back to the app locale (rather than refusing) keeps every Latin-script
|
|
36
|
+
* reply behaving exactly as it did before this existed.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* ⚠️ `appLocale` is the caller's best available signal for "which language did
|
|
40
|
+
* the user mean", and it is only as good as that signal.
|
|
41
|
+
*
|
|
42
|
+
* With the interface language alone it is a weak proxy: an English-UI user who
|
|
43
|
+
* writes in Urdu produces an Urdu reply, but `appLocale` says `en`, so a shared
|
|
44
|
+
* Arabic script falls back to the family default and picks an Arabic voice.
|
|
45
|
+
* BOFF-7108 is what fixes this properly — it lets the user state the language
|
|
46
|
+
* they are speaking, independently of the interface, and passes THAT here.
|
|
47
|
+
*
|
|
48
|
+
* Callers should therefore hand in the most specific language they know: the
|
|
49
|
+
* user's declared conversation language if there is one, the UI locale only as a
|
|
50
|
+
* last resort.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveSpeechLocale(text: string, appLocale: string): string;
|
|
53
|
+
//# sourceMappingURL=replyLanguage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replyLanguage.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/replyLanguage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA2EH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgD9D;AAED;;;;;GAKG;AACH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAU3E"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
//#region src/shared/assistant/voice/replyLanguage.ts
|
|
2
|
+
var e = [
|
|
3
|
+
{
|
|
4
|
+
locale: "ja",
|
|
5
|
+
pattern: /[\p{Script=Hiragana}\p{Script=Katakana}]/u
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
locale: "ko",
|
|
9
|
+
pattern: /\p{Script=Hangul}/u
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
locale: "zh",
|
|
13
|
+
pattern: /\p{Script=Han}/u
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
locale: "ta",
|
|
17
|
+
pattern: /\p{Script=Tamil}/u
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
locale: "hi",
|
|
21
|
+
pattern: /\p{Script=Devanagari}/u
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
locale: "bn",
|
|
25
|
+
pattern: /\p{Script=Bengali}/u
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
locale: "te",
|
|
29
|
+
pattern: /\p{Script=Telugu}/u
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
locale: "kn",
|
|
33
|
+
pattern: /\p{Script=Kannada}/u
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
locale: "ml",
|
|
37
|
+
pattern: /\p{Script=Malayalam}/u
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
locale: "gu",
|
|
41
|
+
pattern: /\p{Script=Gujarati}/u
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
locale: "pa",
|
|
45
|
+
pattern: /\p{Script=Gurmukhi}/u
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
locale: "ar",
|
|
49
|
+
pattern: /\p{Script=Arabic}/u
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
locale: "he",
|
|
53
|
+
pattern: /\p{Script=Hebrew}/u
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
locale: "ru",
|
|
57
|
+
pattern: /\p{Script=Cyrillic}/u
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
locale: "el",
|
|
61
|
+
pattern: /\p{Script=Greek}/u
|
|
62
|
+
}
|
|
63
|
+
], t = {
|
|
64
|
+
zh: ["zh", "ja"],
|
|
65
|
+
ar: [
|
|
66
|
+
"ar",
|
|
67
|
+
"ur",
|
|
68
|
+
"fa",
|
|
69
|
+
"ps",
|
|
70
|
+
"sd"
|
|
71
|
+
],
|
|
72
|
+
hi: [
|
|
73
|
+
"hi",
|
|
74
|
+
"mr",
|
|
75
|
+
"ne",
|
|
76
|
+
"sa",
|
|
77
|
+
"kok"
|
|
78
|
+
],
|
|
79
|
+
ru: [
|
|
80
|
+
"ru",
|
|
81
|
+
"uk",
|
|
82
|
+
"bg",
|
|
83
|
+
"sr",
|
|
84
|
+
"mk",
|
|
85
|
+
"be"
|
|
86
|
+
]
|
|
87
|
+
}, n = .3, r = .2, i = /\p{L}/u;
|
|
88
|
+
function a(t) {
|
|
89
|
+
if (!t) return null;
|
|
90
|
+
let a = 0, o = /* @__PURE__ */ new Map();
|
|
91
|
+
for (let n of t) if (i.test(n)) {
|
|
92
|
+
a += 1;
|
|
93
|
+
for (let { locale: t, pattern: r } of e) if (r.test(n)) {
|
|
94
|
+
o.set(t, (o.get(t) ?? 0) + 1);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (a === 0) return null;
|
|
99
|
+
let s = o.get("ja") ?? 0, c = o.get("zh") ?? 0;
|
|
100
|
+
s > 0 && s >= (s + c) * r && (o.set("ja", s + c), o.delete("zh"));
|
|
101
|
+
let l = null, u = 0;
|
|
102
|
+
for (let [e, t] of o) t > u && (l = e, u = t);
|
|
103
|
+
return l !== null && u / a >= n ? l : null;
|
|
104
|
+
}
|
|
105
|
+
function o(e, n) {
|
|
106
|
+
let r = a(e);
|
|
107
|
+
if (r === null) return n;
|
|
108
|
+
let i = t[r];
|
|
109
|
+
return i && i.includes(n) ? n : r;
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { a as detectScriptLocale, o as resolveSpeechLocale };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SpeakableLabels } from './speakableText';
|
|
2
|
+
/**
|
|
3
|
+
* Labels to read a reply in `locale` with.
|
|
4
|
+
*
|
|
5
|
+
* `uiLabels` is the interface-language set, used both as the base and as the
|
|
6
|
+
* fallback for any language not carried here — so English replies, and any
|
|
7
|
+
* language we have no table for, behave exactly as before.
|
|
8
|
+
*/
|
|
9
|
+
export declare function speechLabelsFor(locale: string, uiLabels: SpeakableLabels): SpeakableLabels;
|
|
10
|
+
/** Exposed for tests: which languages have their own spoken labels. */
|
|
11
|
+
export declare const SPOKEN_LABEL_LANGUAGES: string[];
|
|
12
|
+
//# sourceMappingURL=speechLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechLabels.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/speechLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAyGvD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,eAAe,GACxB,eAAe,CAKjB;AAED,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,UAAkC,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//#region src/shared/assistant/voice/speechLabels.ts
|
|
2
|
+
var e = {
|
|
3
|
+
en: {
|
|
4
|
+
codeBlock: "Code block",
|
|
5
|
+
image: "image",
|
|
6
|
+
link: "link",
|
|
7
|
+
largeTable: "Table with {{rows}} rows and {{columns}} columns",
|
|
8
|
+
truncated: "The rest of this message is not read aloud",
|
|
9
|
+
nestedItem: "Sub-item {{ordinal}}",
|
|
10
|
+
emailAt: "at",
|
|
11
|
+
emailDot: "dot"
|
|
12
|
+
},
|
|
13
|
+
ta: {
|
|
14
|
+
codeBlock: "நிரல் தொகுதி",
|
|
15
|
+
image: "படம்",
|
|
16
|
+
link: "இணைப்பு",
|
|
17
|
+
largeTable: "{{rows}} வரிசைகள் மற்றும் {{columns}} நெடுவரிசைகள் கொண்ட அட்டவணை",
|
|
18
|
+
truncated: "இந்தச் செய்தியின் மீதமுள்ள பகுதி வாசிக்கப்படவில்லை",
|
|
19
|
+
nestedItem: "துணை உருப்படி {{ordinal}}",
|
|
20
|
+
emailAt: "அட்",
|
|
21
|
+
emailDot: "புள்ளி"
|
|
22
|
+
},
|
|
23
|
+
hi: {
|
|
24
|
+
codeBlock: "कोड ब्लॉक",
|
|
25
|
+
image: "छवि",
|
|
26
|
+
link: "लिंक",
|
|
27
|
+
largeTable: "{{rows}} पंक्तियों और {{columns}} स्तंभों वाली तालिका",
|
|
28
|
+
truncated: "इस संदेश का शेष भाग नहीं पढ़ा जाता",
|
|
29
|
+
nestedItem: "उप-आइटम {{ordinal}}",
|
|
30
|
+
emailAt: "ऐट",
|
|
31
|
+
emailDot: "डॉट"
|
|
32
|
+
},
|
|
33
|
+
ar: {
|
|
34
|
+
codeBlock: "كتلة برمجية",
|
|
35
|
+
image: "صورة",
|
|
36
|
+
link: "رابط",
|
|
37
|
+
largeTable: "جدول من {{rows}} صفوف و {{columns}} أعمدة",
|
|
38
|
+
truncated: "لا تتم قراءة بقية هذه الرسالة بصوت عالٍ",
|
|
39
|
+
nestedItem: "عنصر فرعي {{ordinal}}",
|
|
40
|
+
emailAt: "أت",
|
|
41
|
+
emailDot: "نقطة"
|
|
42
|
+
},
|
|
43
|
+
es: {
|
|
44
|
+
codeBlock: "Bloque de código",
|
|
45
|
+
image: "imagen",
|
|
46
|
+
link: "enlace",
|
|
47
|
+
largeTable: "Tabla con {{rows}} filas y {{columns}} columnas",
|
|
48
|
+
truncated: "El resto de este mensaje no se lee en voz alta",
|
|
49
|
+
nestedItem: "Subelemento {{ordinal}}",
|
|
50
|
+
emailAt: "arroba",
|
|
51
|
+
emailDot: "punto"
|
|
52
|
+
},
|
|
53
|
+
zh: {
|
|
54
|
+
codeBlock: "代码块",
|
|
55
|
+
image: "图片",
|
|
56
|
+
link: "链接",
|
|
57
|
+
largeTable: "包含 {{rows}} 行 {{columns}} 列的表格",
|
|
58
|
+
truncated: "此消息的其余部分不会朗读",
|
|
59
|
+
nestedItem: "子项 {{ordinal}}",
|
|
60
|
+
emailAt: "at",
|
|
61
|
+
emailDot: "点"
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function t(t, n) {
|
|
65
|
+
let r = t.trim().toLowerCase().split(/[-_]/)[0];
|
|
66
|
+
if (!r) return n;
|
|
67
|
+
let i = e[r];
|
|
68
|
+
return i ? {
|
|
69
|
+
...n,
|
|
70
|
+
...i
|
|
71
|
+
} : n;
|
|
72
|
+
}
|
|
73
|
+
var n = Object.keys(e);
|
|
74
|
+
//#endregion
|
|
75
|
+
export { n as SPOKEN_LABEL_LANGUAGES, t as speechLabelsFor };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playback state for the assistant's spoken reply (BOFF-6290).
|
|
3
|
+
*
|
|
4
|
+
* A reducer rather than a pile of `useState` calls, because the awkward part of
|
|
5
|
+
* speech playback is not "is it speaking" — it is that the engine's `end` and
|
|
6
|
+
* `error` events arrive AFTER the state has already moved on:
|
|
7
|
+
*
|
|
8
|
+
* - tapping speak on message B while A is talking cancels A, and A's `end`
|
|
9
|
+
* event lands a tick later. Without a guard it would clear B's speaking state
|
|
10
|
+
* and leave a button that says "stop" next to silence — or worse, silence
|
|
11
|
+
* next to a button that says "speak" while the voice keeps going;
|
|
12
|
+
* - closing the panel cancels playback, and the cancellation itself fires
|
|
13
|
+
* `error` on every queued utterance.
|
|
14
|
+
*
|
|
15
|
+
* Every transition therefore carries a monotonically increasing `requestId`, and
|
|
16
|
+
* a terminal event is only honoured when it belongs to the CURRENT request. That
|
|
17
|
+
* is the whole trick, and it is pure, so it is tested directly (the audio around
|
|
18
|
+
* it is not testable in this repo's node-environment vitest).
|
|
19
|
+
*/
|
|
20
|
+
export type SpeechPlaybackState = {
|
|
21
|
+
readonly status: "idle";
|
|
22
|
+
} | {
|
|
23
|
+
readonly status: "speaking";
|
|
24
|
+
readonly messageId: string;
|
|
25
|
+
readonly requestId: number;
|
|
26
|
+
};
|
|
27
|
+
export type SpeechPlaybackAction =
|
|
28
|
+
/** User pressed speak on a message (or auto-speak fired). */
|
|
29
|
+
{
|
|
30
|
+
readonly type: "start";
|
|
31
|
+
readonly messageId: string;
|
|
32
|
+
readonly requestId: number;
|
|
33
|
+
}
|
|
34
|
+
/** User pressed the control on `messageId`: stop if it is the one talking. */
|
|
35
|
+
| {
|
|
36
|
+
readonly type: "toggle";
|
|
37
|
+
readonly messageId: string;
|
|
38
|
+
readonly requestId: number;
|
|
39
|
+
}
|
|
40
|
+
/** Explicit stop: the stop button, panel close, conversation switch, unmount. */
|
|
41
|
+
| {
|
|
42
|
+
readonly type: "stop";
|
|
43
|
+
}
|
|
44
|
+
/** The engine finished the queue for `requestId`. */
|
|
45
|
+
| {
|
|
46
|
+
readonly type: "finished";
|
|
47
|
+
readonly requestId: number;
|
|
48
|
+
}
|
|
49
|
+
/** The engine failed (or was cancelled) on `requestId`. */
|
|
50
|
+
| {
|
|
51
|
+
readonly type: "failed";
|
|
52
|
+
readonly requestId: number;
|
|
53
|
+
};
|
|
54
|
+
export declare const IDLE_PLAYBACK: SpeechPlaybackState;
|
|
55
|
+
export declare function speechPlaybackReducer(state: SpeechPlaybackState, action: SpeechPlaybackAction): SpeechPlaybackState;
|
|
56
|
+
/** Is THIS message the one currently being spoken? Drives one button's state. */
|
|
57
|
+
export declare function isSpeakingMessage(state: SpeechPlaybackState, messageId: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Does acting on `messageId` require cancelling what the engine is doing now?
|
|
60
|
+
*
|
|
61
|
+
* True whenever anything is playing — including the same message, where the tap
|
|
62
|
+
* means "stop". The caller cancels first, then speaks; that ordering is what
|
|
63
|
+
* makes "starting a new playback cancels the previous one" hold with a queue of
|
|
64
|
+
* utterances rather than a single one.
|
|
65
|
+
*/
|
|
66
|
+
export declare function requiresCancel(state: SpeechPlaybackState): boolean;
|
|
67
|
+
//# sourceMappingURL=speechPlayback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speechPlayback.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/speechPlayback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3B;IACE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEN,MAAM,MAAM,oBAAoB;AAC9B,6DAA6D;AAC3D;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AACH,8EAA8E;GAC5E;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AACH,iFAAiF;GAC/E;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAC3B,qDAAqD;GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AAC3D,2DAA2D;GACzD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D,eAAO,MAAM,aAAa,EAAE,mBAAwC,CAAC;AAErE,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,oBAAoB,GAC3B,mBAAmB,CAgCrB;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAET;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAElE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/shared/assistant/voice/speechPlayback.ts
|
|
2
|
+
var e = { status: "idle" };
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
switch (n.type) {
|
|
5
|
+
case "start": return {
|
|
6
|
+
status: "speaking",
|
|
7
|
+
messageId: n.messageId,
|
|
8
|
+
requestId: n.requestId
|
|
9
|
+
};
|
|
10
|
+
case "toggle": return t.status === "speaking" && t.messageId === n.messageId ? e : {
|
|
11
|
+
status: "speaking",
|
|
12
|
+
messageId: n.messageId,
|
|
13
|
+
requestId: n.requestId
|
|
14
|
+
};
|
|
15
|
+
case "stop": return t.status === "idle" ? t : e;
|
|
16
|
+
case "finished":
|
|
17
|
+
case "failed": return t.status !== "speaking" || t.requestId !== n.requestId ? t : e;
|
|
18
|
+
default: return t;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function n(e, t) {
|
|
22
|
+
return e.status === "speaking" && e.messageId === t;
|
|
23
|
+
}
|
|
24
|
+
function r(e) {
|
|
25
|
+
return e.status === "speaking";
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { e as IDLE_PLAYBACK, n as isSpeakingMessage, r as requiresCancel, t as speechPlaybackReducer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authBridgeUrls.d.ts","sourceRoot":"","sources":["../../../src/shared/config/authBridgeUrls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"authBridgeUrls.d.ts","sourceRoot":"","sources":["../../../src/shared/config/authBridgeUrls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;CAChB;AAyCD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,IAAI,uBAAuB,CAcjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,IAAI,uBAAuB,GAAG,SAAS,CAWlF"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isCapacitorNative as e } from "../native/capacitor.js";
|
|
2
|
+
import { isDesktop as t } from "../native/desktop.js";
|
|
3
|
+
import { ALL_PRODUCT_DOMAINS as n, ALPHA_HOSTS as r, PROD_HOSTS as i, getCurrentHostname as a } from "./gatewayUrls.js";
|
|
3
4
|
//#region src/shared/config/authBridgeUrls.ts
|
|
4
|
-
var
|
|
5
|
+
var o = {
|
|
5
6
|
url: "https://app.burdenoff.com/auth/session-bridge",
|
|
6
|
-
allowedOrigins:
|
|
7
|
+
allowedOrigins: n.map((e) => `https://app.${e}`).join(","),
|
|
7
8
|
debug: !1
|
|
8
|
-
},
|
|
9
|
+
}, s = {
|
|
9
10
|
url: "https://alphaapp.burdenoff.com/auth/session-bridge",
|
|
10
|
-
allowedOrigins:
|
|
11
|
+
allowedOrigins: n.map((e) => `https://alphaapp.${e}`).join(","),
|
|
11
12
|
debug: !1
|
|
12
|
-
},
|
|
13
|
+
}, c = {
|
|
13
14
|
url: "https://app.local.burdenoff.com/auth/session-bridge",
|
|
14
15
|
allowedOrigins: "*",
|
|
15
16
|
debug: !0
|
|
16
17
|
};
|
|
17
|
-
function
|
|
18
|
+
function l(e) {
|
|
18
19
|
return e ? e === "localhost" || e === "127.0.0.1" || e === "0.0.0.0" || e === "[::1]" || e === "::1" || e.endsWith(".localhost") : !1;
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function u() {
|
|
21
22
|
return {
|
|
22
23
|
url: `${typeof window > "u" ? "" : window.location.origin}/auth/session-bridge`,
|
|
23
24
|
allowedOrigins: "*",
|
|
24
25
|
debug: !0
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
function u() {
|
|
28
|
-
let e = i();
|
|
29
|
-
return r.has(e) ? a : n.has(e) ? o : c(e) ? l() : s;
|
|
30
|
-
}
|
|
31
28
|
function d() {
|
|
32
|
-
|
|
29
|
+
let e = a();
|
|
30
|
+
return i.has(e) ? o : r.has(e) ? s : l(e) ? u() : c;
|
|
31
|
+
}
|
|
32
|
+
function f() {
|
|
33
|
+
if (!t() && !e()) return d();
|
|
33
34
|
}
|
|
34
35
|
//#endregion
|
|
35
|
-
export {
|
|
36
|
+
export { d as resolveAuthBridgeConfig, f as resolveShellAuthBridgeConfig };
|
|
@@ -22,6 +22,35 @@ export declare const PROD_HOSTS: Set<string>;
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const ALPHA_HOSTS: Set<string>;
|
|
24
24
|
export declare function getCurrentHostname(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Which backend estate a bundle is built to talk to.
|
|
27
|
+
*
|
|
28
|
+
* `'local'` means the developer stack behind the `gw-*.local.burdenoff.com`
|
|
29
|
+
* nginx proxy — reachable only from a machine with the dev `/etc/hosts`
|
|
30
|
+
* entries, never from a phone.
|
|
31
|
+
*/
|
|
32
|
+
export type DeployTarget = 'prod' | 'alpha' | 'local';
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the deploy target for a shell whose origin carries no information —
|
|
35
|
+
* a Capacitor WebView, which is always `https://localhost` (or `capacitor://`)
|
|
36
|
+
* regardless of which product or environment the binary was built for.
|
|
37
|
+
*
|
|
38
|
+
* Precedence:
|
|
39
|
+
* 1. `VITE_GATEWAY_TARGET` — the explicit override, already honoured for
|
|
40
|
+
* localhost dev servers.
|
|
41
|
+
* 2. `VITE_DEPLOY_ENV` — the build-time environment marker the shells
|
|
42
|
+
* already set for analytics.
|
|
43
|
+
* 3. `'prod'`.
|
|
44
|
+
*
|
|
45
|
+
* Defaulting to prod is the safe answer here, and it is the OPPOSITE of the
|
|
46
|
+
* fail-loud default for an unknown *web* hostname (BOFF-2507). A web app
|
|
47
|
+
* served from a domain we do not recognise might be anything, so pointing it
|
|
48
|
+
* at production would be reckless. A Capacitor binary is something we built
|
|
49
|
+
* and signed ourselves; the only reason it is on a device at all is to talk to
|
|
50
|
+
* a real backend, and `LOCAL_DEFAULTS` there is not a safe fallback but a
|
|
51
|
+
* guaranteed `TypeError: Failed to fetch` on the first request.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveNativeDeployTarget(): DeployTarget;
|
|
25
54
|
/**
|
|
26
55
|
* Resolve runtime gateway URLs from the current hostname, with an optional
|
|
27
56
|
* env-driven override for localhost dev servers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatewayUrls.d.ts","sourceRoot":"","sources":["../../../src/shared/config/gatewayUrls.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"gatewayUrls.d.ts","sourceRoot":"","sources":["../../../src/shared/config/gatewayUrls.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAoBD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UA+C/B,CAAC;AAEF,eAAO,MAAM,UAAU,aAGrB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,aAOtB,CAAC;AAEH,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C;AAkCD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAWtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,IAAI,YAAY,CAUxD;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,IAAI,kBAAkB,CAkDvD"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isCapacitorNative as e } from "../native/capacitor.js";
|
|
2
|
+
import { getDesktopGatewayUrls as t } from "../native/desktop.js";
|
|
2
3
|
//#region src/shared/config/gatewayUrls.ts
|
|
3
|
-
var
|
|
4
|
+
var n = {
|
|
4
5
|
workspaceBaseUrl: "https://alphagraphqlworkspaces.burdenoff.com",
|
|
5
6
|
globalBaseUrl: "https://alphagraphql.burdenoff.com",
|
|
6
7
|
publicStoreBaseUrl: "https://alphagraphql.burdenoff.com"
|
|
7
|
-
},
|
|
8
|
+
}, r = {
|
|
8
9
|
workspaceBaseUrl: "https://graphqlworkspaces.burdenoff.com",
|
|
9
10
|
globalBaseUrl: "https://graphql.burdenoff.com",
|
|
10
11
|
publicStoreBaseUrl: "https://graphql.burdenoff.com"
|
|
11
|
-
},
|
|
12
|
+
}, i = {
|
|
12
13
|
workspaceBaseUrl: "https://gw-wspace.local.burdenoff.com",
|
|
13
14
|
globalBaseUrl: "https://gw-global.local.burdenoff.com",
|
|
14
15
|
publicStoreBaseUrl: "https://gw-global.local.burdenoff.com"
|
|
15
|
-
},
|
|
16
|
-
function
|
|
16
|
+
}, a = /* @__PURE__ */ "burdenoff.com,vibecontrols.com,fluidgrids.com,fluidgrids.ai,botlit.ai,botmanor.com,bigconsole.com,gethealthybowl.com,headshotmarketing.com,timecampus.com,ggnomad.com,movethewheels.com,crewfoundry.com,planmagnet.com,eventfullymanaged.com,kadaikodi.com,assethandler.com,technospam.com,semanticfed.com,manufacturedops.com,theglobalfuel.com,housingvista.com,proserviceworld.com,mybodyshield.com,artistrybase.com,collabkin.com,brainyrich.com,theculturepost.com,comradecircle.com,cosmicintersection.com,govcitizenhub.com,intelwatchtower.com,ecoimpacthub.com,buildmyiq.com,fluidgrids.ai,atheletebridge.com,adaptercloud.com,coolandlovely.com,subscriberbot.com,labsofscience.com,hookmovies.com".split(","), o = new Set([...a.map((e) => `app.${e}`), "admin.burdenoff.com"]), s = new Set([...a.map((e) => `alphaapp.${e}`), "alphaadmin.burdenoff.com"]);
|
|
17
|
+
function c() {
|
|
17
18
|
return typeof window > "u" ? "" : window.location.hostname.toLowerCase();
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function l(e) {
|
|
20
21
|
let t = `https://${e}`;
|
|
21
22
|
return {
|
|
22
23
|
workspaceBaseUrl: t,
|
|
@@ -24,24 +25,47 @@ function c(e) {
|
|
|
24
25
|
publicStoreBaseUrl: t
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function u(e) {
|
|
28
29
|
return e ? e === "localhost" || e === "127.0.0.1" || e === "0.0.0.0" || e === "[::1]" || e === "::1" || e.endsWith(".localhost") || e.endsWith(".local.burdenoff.com") : !1;
|
|
29
30
|
}
|
|
30
|
-
var u = !1;
|
|
31
31
|
function d() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
try {
|
|
33
|
+
return {
|
|
34
|
+
BASE_URL: "/",
|
|
35
|
+
DEV: !1,
|
|
36
|
+
MODE: "production",
|
|
37
|
+
PROD: !0,
|
|
38
|
+
SSR: !1
|
|
39
|
+
}?.VITE_DEPLOY_ENV?.toLowerCase();
|
|
40
|
+
} catch {
|
|
41
|
+
return;
|
|
41
42
|
}
|
|
42
|
-
return r;
|
|
43
43
|
}
|
|
44
44
|
function f() {
|
|
45
|
+
let e = h();
|
|
46
|
+
if (e === "prod" || e === "alpha" || e === "local") return e;
|
|
47
|
+
let t = d();
|
|
48
|
+
return t === "alpha" || t === "staging" ? "alpha" : t === "dev" || t === "development" ? "local" : "prod";
|
|
49
|
+
}
|
|
50
|
+
var p = !1;
|
|
51
|
+
function m() {
|
|
52
|
+
let a = t();
|
|
53
|
+
if (a) return a;
|
|
54
|
+
if (e()) {
|
|
55
|
+
let e = f();
|
|
56
|
+
return e === "local" ? i : e === "alpha" ? n : r;
|
|
57
|
+
}
|
|
58
|
+
let d = c();
|
|
59
|
+
if (o.has(d)) return r;
|
|
60
|
+
if (s.has(d)) return l(d);
|
|
61
|
+
if (u(d)) {
|
|
62
|
+
let e = h();
|
|
63
|
+
if (e === "prod") return p || (p = !0, console.warn("[gatewayUrls] WARNING: localhost dev server is configured to hit PRODUCTION backends (VITE_GATEWAY_TARGET=prod). Any mutation will modify real prod data. Remove the env var or delete .env.local to disable.")), r;
|
|
64
|
+
if (e === "alpha") return n;
|
|
65
|
+
}
|
|
66
|
+
return i;
|
|
67
|
+
}
|
|
68
|
+
function h() {
|
|
45
69
|
try {
|
|
46
70
|
return {
|
|
47
71
|
BASE_URL: "/",
|
|
@@ -55,4 +79,4 @@ function f() {
|
|
|
55
79
|
}
|
|
56
80
|
}
|
|
57
81
|
//#endregion
|
|
58
|
-
export {
|
|
82
|
+
export { a as ALL_PRODUCT_DOMAINS, s as ALPHA_HOSTS, o as PROD_HOSTS, c as getCurrentHostname, m as resolveGatewayUrls, f as resolveNativeDeployTarget };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ;;QAEjB,uCAAuC;;QAEvC,4BAA4B;;QAE5B,6FAA6F;;;;QAI7F,uCAAuC;;QAEvC,4BAA4B;;QAE5B,6FAA6F;;QAE7F,uDAAuD;;;CAGjD,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,YAAY,CAAC;AACjD,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,QAAQ,CAAC;AAE5C;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CAMlF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO;IApC7C,uCAAuC;;IAEvC,4BAA4B;;IAE5B,6FAA6F;;;IAI7F,uCAAuC;;IAEvC,4BAA4B;;IAE5B,6FAA6F;;IAE7F,uDAAuD;;EAwB1D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAanF;AAYD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACzF,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAGhE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACxF,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capacitor (mobile) runtime detection — MFE-safe, boot-order independent.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS SEPARATELY FROM `platform.ts`
|
|
5
|
+
* --------------------------------------------
|
|
6
|
+
* `isNative()` in `./platform` reads `window.__burdenoffNativeBridge`, which is
|
|
7
|
+
* only published by `installNativeBridge()` during `bootNativeShell()`. Gateway
|
|
8
|
+
* URLs are resolved at module scope in every shell's `main.tsx` — BEFORE React
|
|
9
|
+
* renders and long before that boot step runs — so `isNative()` is still
|
|
10
|
+
* `false` at the moment it matters most. Anything that resolves a network
|
|
11
|
+
* target must therefore use the detector here instead.
|
|
12
|
+
*
|
|
13
|
+
* WHY IT DOES NOT IMPORT `@capacitor/core`
|
|
14
|
+
* ----------------------------------------
|
|
15
|
+
* `shared/*` is the MFE-safe half of fe-libs: a microfrontend must never
|
|
16
|
+
* resolve a Capacitor package (that is the whole reason `shell-native` is a
|
|
17
|
+
* separate, shell-only subpath). Capacitor's native runtime injects a
|
|
18
|
+
* `window.Capacitor` global into the WebView before any application script
|
|
19
|
+
* executes, which is exactly what `@capacitor/core` itself reads — so sniffing
|
|
20
|
+
* that global is both dependency-free and available at module-scope time.
|
|
21
|
+
*
|
|
22
|
+
* PRESENTATION PREVIEWS ARE DELIBERATELY NOT DETECTED HERE.
|
|
23
|
+
* `?__nativePreview=ios|android` (see `shell-native/preview`) changes how the
|
|
24
|
+
* app LOOKS in a normal browser. It must never change which backend the app
|
|
25
|
+
* talks to, so it does not set `window.Capacitor` and is invisible to this
|
|
26
|
+
* module.
|
|
27
|
+
*
|
|
28
|
+
* @module @burdenoff/fe-libs/shared/native/capacitor
|
|
29
|
+
*/
|
|
30
|
+
/** The two real Capacitor mobile platforms (`'web'` is not native). */
|
|
31
|
+
export type CapacitorNativePlatform = 'ios' | 'android';
|
|
32
|
+
/**
|
|
33
|
+
* The real Capacitor platform, or `null` when this is not a native mobile
|
|
34
|
+
* shell. Never returns a value for a presentation preview.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getCapacitorPlatform(): CapacitorNativePlatform | null;
|
|
37
|
+
/**
|
|
38
|
+
* True when running inside a real Capacitor mobile WebView (iOS or Android).
|
|
39
|
+
*
|
|
40
|
+
* Three independent signals are accepted because a wrong `false` here sends a
|
|
41
|
+
* shipped mobile app to a developer-only gateway hostname that resolves
|
|
42
|
+
* nowhere:
|
|
43
|
+
* 1. `Capacitor.isNativePlatform()` — the canonical check.
|
|
44
|
+
* 2. A platform name of `ios`/`android` — correct even if (1) is missing.
|
|
45
|
+
* 3. A `capacitor:` document protocol — the origin a shell gets when it
|
|
46
|
+
* overrides `server.iosScheme`, and proof of a native WebView on its own.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isCapacitorNative(): boolean;
|
|
49
|
+
//# sourceMappingURL=capacitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capacitor.d.ts","sourceRoot":"","sources":["../../../src/shared/native/capacitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,uEAAuE;AACvE,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,SAAS,CAAC;AAiCxD;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,uBAAuB,GAAG,IAAI,CAWrE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAgB3C"}
|