@omniloy/sofia-sdk 1.0.10 → 1.0.12
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/legacy/webcomponents.d.ts +155 -0
- package/dist/legacy/webcomponents.es.js +918 -327
- package/dist/legacy/webcomponents.umd.js +918 -327
- package/dist/react/index.css +59 -39
- package/dist/react/index.d.ts +155 -0
- package/dist/react/index.es.js +756 -133
- package/dist/webcomponents.d.ts +155 -0
- package/dist/webcomponents.es.js +634 -39
- package/dist/webcomponents.umd.js +634 -39
- package/package.json +1 -1
package/dist/react/index.es.js
CHANGED
|
@@ -5145,7 +5145,7 @@ const {
|
|
|
5145
5145
|
create: create$1,
|
|
5146
5146
|
} = axios;
|
|
5147
5147
|
|
|
5148
|
-
const version$2 = "1.0.
|
|
5148
|
+
const version$2 = "1.0.12";
|
|
5149
5149
|
|
|
5150
5150
|
const handleApiError$1 = async (error) => {
|
|
5151
5151
|
return Promise.reject(error);
|
|
@@ -5903,6 +5903,11 @@ const ar = {
|
|
|
5903
5903
|
"Generation failed": "فشل الإنشاء",
|
|
5904
5904
|
"Could not generate {category}. Please try again.": "تعذّر إنشاء {category}. يرجى المحاولة مرة أخرى.",
|
|
5905
5905
|
"The new note is waiting for this review — apply or cancel to continue.": "الملاحظة الجديدة في انتظار هذه المراجعة — طبّق أو ألغِ للمتابعة.",
|
|
5906
|
+
" +{count} more": " +{count} أخرى",
|
|
5907
|
+
"{count} mandatory fields missing in this group": "{count, plural, zero {# حقل إلزامي ناقص} one {# حقل إلزامي ناقص} two {حقلان إلزاميان ناقصان} few {# حقول إلزامية ناقصة} many {# حقلاً إلزامياً ناقصاً} other {# حقل إلزامي ناقص}} في هذه المجموعة",
|
|
5908
|
+
"{group} · row {row}": "{group} · الصف {row}",
|
|
5909
|
+
"{group} · row {row} · {field}": "{group} · الصف {row} · {field}",
|
|
5910
|
+
"{count} rows need a type selected in this group": "{count, plural, zero {# صف يحتاج} one {# صف يحتاج} two {صفّان يحتاجان} few {# صفوف تحتاج} many {# صفاً يحتاج} other {# صف يحتاج}} إلى تحديد النوع في هذه المجموعة",
|
|
5906
5911
|
};
|
|
5907
5912
|
|
|
5908
5913
|
const Add$b = "Afegir";
|
|
@@ -6273,6 +6278,11 @@ const ca = {
|
|
|
6273
6278
|
"Generation failed": "La generació ha fallat",
|
|
6274
6279
|
"Could not generate {category}. Please try again.": "No s'ha pogut generar {category}. Torna-ho a provar.",
|
|
6275
6280
|
"The new note is waiting for this review — apply or cancel to continue.": "La nova nota està esperant aquesta revisió: aplica o cancel·la per continuar.",
|
|
6281
|
+
" +{count} more": " +{count} més",
|
|
6282
|
+
"{count} mandatory fields missing in this group": "{count, plural, one {Falta # camp obligatori} other {Falten # camps obligatoris}} en aquest grup",
|
|
6283
|
+
"{group} · row {row}": "{group} · fila {row}",
|
|
6284
|
+
"{group} · row {row} · {field}": "{group} · fila {row} · {field}",
|
|
6285
|
+
"{count} rows need a type selected in this group": "{count, plural, one {# fila necessita} other {# files necessiten}} que se seleccioni un tipus en aquest grup",
|
|
6276
6286
|
};
|
|
6277
6287
|
|
|
6278
6288
|
const Add$a = "Afegir";
|
|
@@ -6643,6 +6653,11 @@ const ca_valencia = {
|
|
|
6643
6653
|
"Generation failed": "La generació ha fallat",
|
|
6644
6654
|
"Could not generate {category}. Please try again.": "No s'ha pogut generar {category}. Torna-ho a provar.",
|
|
6645
6655
|
"The new note is waiting for this review — apply or cancel to continue.": "La nova nota està esperant aquesta revisió: aplica o cancel·la per continuar.",
|
|
6656
|
+
" +{count} more": " +{count} més",
|
|
6657
|
+
"{count} mandatory fields missing in this group": "{count, plural, one {Falta # camp obligatori} other {Falten # camps obligatoris}} en este grup",
|
|
6658
|
+
"{group} · row {row}": "{group} · fila {row}",
|
|
6659
|
+
"{group} · row {row} · {field}": "{group} · fila {row} · {field}",
|
|
6660
|
+
"{count} rows need a type selected in this group": "{count, plural, one {# fila necessita} other {# files necessiten}} que se seleccione un tipus en este grup",
|
|
6646
6661
|
};
|
|
6647
6662
|
|
|
6648
6663
|
const Add$9 = "Přidat";
|
|
@@ -7013,6 +7028,11 @@ const cs = {
|
|
|
7013
7028
|
"Generation failed": "Generování se nezdařilo",
|
|
7014
7029
|
"Could not generate {category}. Please try again.": "Nepodařilo se vygenerovat {category}. Zkuste to znovu.",
|
|
7015
7030
|
"The new note is waiting for this review — apply or cancel to continue.": "Nová poznámka čeká na tuto kontrolu — potvrďte ji, nebo ji zrušte, aby mohla pokračovat.",
|
|
7031
|
+
" +{count} more": " +{count} dalších",
|
|
7032
|
+
"{count} mandatory fields missing in this group": "{count, plural, one {Chybí # povinné pole} few {Chybí # povinná pole} other {Chybí # povinných polí}} v této skupině",
|
|
7033
|
+
"{group} · row {row}": "{group} · řádek {row}",
|
|
7034
|
+
"{group} · row {row} · {field}": "{group} · řádek {row} · {field}",
|
|
7035
|
+
"{count} rows need a type selected in this group": "{count, plural, one {U # řádku} few {U # řádků} other {U # řádků}} v této skupině je třeba vybrat typ",
|
|
7016
7036
|
};
|
|
7017
7037
|
|
|
7018
7038
|
const Add$8 = "Add";
|
|
@@ -7383,6 +7403,11 @@ const en_GB = {
|
|
|
7383
7403
|
"Generation failed": "Generation failed",
|
|
7384
7404
|
"Could not generate {category}. Please try again.": "Could not generate {category}. Please try again.",
|
|
7385
7405
|
"The new note is waiting for this review — apply or cancel to continue.": "The new note is waiting for this review — apply or cancel to continue.",
|
|
7406
|
+
" +{count} more": " +{count} more",
|
|
7407
|
+
"{count} mandatory fields missing in this group": "{count, plural, one {# mandatory field missing} other {# mandatory fields missing}} in this group",
|
|
7408
|
+
"{group} · row {row}": "{group} · row {row}",
|
|
7409
|
+
"{group} · row {row} · {field}": "{group} · row {row} · {field}",
|
|
7410
|
+
"{count} rows need a type selected in this group": "{count, plural, one {# row needs} other {# rows need}} a type selected in this group",
|
|
7386
7411
|
};
|
|
7387
7412
|
|
|
7388
7413
|
const Add$7 = "Add";
|
|
@@ -7754,6 +7779,11 @@ const en_US = {
|
|
|
7754
7779
|
"Generation failed": "Generation failed",
|
|
7755
7780
|
"Could not generate {category}. Please try again.": "Could not generate {category}. Please try again.",
|
|
7756
7781
|
"The new note is waiting for this review — apply or cancel to continue.": "The new note is waiting for this review — apply or cancel to continue.",
|
|
7782
|
+
" +{count} more": " +{count} more",
|
|
7783
|
+
"{count} mandatory fields missing in this group": "{count, plural, one {# mandatory field missing} other {# mandatory fields missing}} in this group",
|
|
7784
|
+
"{group} · row {row}": "{group} · row {row}",
|
|
7785
|
+
"{group} · row {row} · {field}": "{group} · row {row} · {field}",
|
|
7786
|
+
"{count} rows need a type selected in this group": "{count, plural, one {# row needs} other {# rows need}} a type selected in this group",
|
|
7757
7787
|
};
|
|
7758
7788
|
|
|
7759
7789
|
const Add$6 = "Añadir";
|
|
@@ -8137,6 +8167,11 @@ const es = {
|
|
|
8137
8167
|
"{name} has expressly refused the use of AI, so recording and report generation are unavailable in this consultation.": "{name} ha rechazado expresamente el uso de IA, así que no se puede grabar ni generar informes en esta consulta.",
|
|
8138
8168
|
"{name} expressly refused the use of AI on {date}, so recording and report generation are unavailable in this consultation.": "{name} rechazó expresamente el uso de IA el {date}, así que no se puede grabar ni generar informes en esta consulta.",
|
|
8139
8169
|
"this patient": "este paciente",
|
|
8170
|
+
" +{count} more": " +{count} más",
|
|
8171
|
+
"{count} mandatory fields missing in this group": "{count, plural, one {Falta # campo obligatorio} other {Faltan # campos obligatorios}} en este grupo",
|
|
8172
|
+
"{group} · row {row}": "{group} · fila {row}",
|
|
8173
|
+
"{group} · row {row} · {field}": "{group} · fila {row} · {field}",
|
|
8174
|
+
"{count} rows need a type selected in this group": "{count, plural, one {# fila necesita} other {# filas necesitan}} que se seleccione un tipo en este grupo",
|
|
8140
8175
|
};
|
|
8141
8176
|
|
|
8142
8177
|
const Add$5 = "Ajouter";
|
|
@@ -8507,6 +8542,11 @@ const fr = {
|
|
|
8507
8542
|
"Generation failed": "Échec de la génération",
|
|
8508
8543
|
"Could not generate {category}. Please try again.": "Impossible de générer {category}. Veuillez réessayer.",
|
|
8509
8544
|
"The new note is waiting for this review — apply or cancel to continue.": "La nouvelle note attend cette révision : appliquez ou annulez pour continuer.",
|
|
8545
|
+
" +{count} more": " +{count} de plus",
|
|
8546
|
+
"{count} mandatory fields missing in this group": "{count, plural, one {# champ obligatoire manquant} other {# champs obligatoires manquants}} dans ce groupe",
|
|
8547
|
+
"{group} · row {row}": "{group} · ligne {row}",
|
|
8548
|
+
"{group} · row {row} · {field}": "{group} · ligne {row} · {field}",
|
|
8549
|
+
"{count} rows need a type selected in this group": "{count, plural, one {# ligne nécessite} other {# lignes nécessitent}} la sélection d'un type dans ce groupe",
|
|
8510
8550
|
};
|
|
8511
8551
|
|
|
8512
8552
|
const Add$4 = "जोड़ें";
|
|
@@ -8856,6 +8896,11 @@ const hi = {
|
|
|
8856
8896
|
"Generation failed": "जनरेशन विफल रहा",
|
|
8857
8897
|
"Could not generate {category}. Please try again.": "{category} जनरेट नहीं किया जा सका। कृपया पुनः प्रयास करें।",
|
|
8858
8898
|
"The new note is waiting for this review — apply or cancel to continue.": "नई नोट इस समीक्षा की प्रतीक्षा कर रही है — जारी रखने के लिए लागू करें या रद्द करें।",
|
|
8899
|
+
" +{count} more": " +{count} और",
|
|
8900
|
+
"{count} mandatory fields missing in this group": "इस समूह में {count, plural, one {# अनिवार्य फ़ील्ड खाली है} other {# अनिवार्य फ़ील्ड खाली हैं}}",
|
|
8901
|
+
"{group} · row {row}": "{group} · पंक्ति {row}",
|
|
8902
|
+
"{group} · row {row} · {field}": "{group} · पंक्ति {row} · {field}",
|
|
8903
|
+
"{count} rows need a type selected in this group": "इस समूह में {count, plural, one {# पंक्ति के लिए} other {# पंक्तियों के लिए}} प्रकार चुनना आवश्यक है",
|
|
8859
8904
|
};
|
|
8860
8905
|
|
|
8861
8906
|
const Add$3 = "Tambahkan";
|
|
@@ -9204,6 +9249,11 @@ const id = {
|
|
|
9204
9249
|
"Generation failed": "Pembuatan gagal",
|
|
9205
9250
|
"Could not generate {category}. Please try again.": "Tidak dapat membuat {category}. Silakan coba lagi.",
|
|
9206
9251
|
"The new note is waiting for this review — apply or cancel to continue.": "Catatan baru menunggu tinjauan ini — terapkan atau batalkan untuk melanjutkan.",
|
|
9252
|
+
" +{count} more": " +{count} lainnya",
|
|
9253
|
+
"{count} mandatory fields missing in this group": "{count, plural, other {# bidang wajib belum diisi}} di grup ini",
|
|
9254
|
+
"{group} · row {row}": "{group} · baris {row}",
|
|
9255
|
+
"{group} · row {row} · {field}": "{group} · baris {row} · {field}",
|
|
9256
|
+
"{count} rows need a type selected in this group": "{count, plural, other {# baris perlu dipilih jenisnya}} di grup ini",
|
|
9207
9257
|
};
|
|
9208
9258
|
|
|
9209
9259
|
const Add$2 = "ਸ਼ਾਮਲ ਕਰੋ";
|
|
@@ -9574,6 +9624,11 @@ const pa = {
|
|
|
9574
9624
|
"Generation failed": "ਜਨਰੇਸ਼ਨ ਅਸਫਲ ਰਹੀ",
|
|
9575
9625
|
"Could not generate {category}. Please try again.": "{category} ਜਨਰੇਟ ਨਹੀਂ ਕੀਤਾ ਜਾ ਸਕਿਆ। ਕਿਰਪਾ ਕਰਕੇ ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ।",
|
|
9576
9626
|
"The new note is waiting for this review — apply or cancel to continue.": "ਨਵਾਂ ਨੋਟ ਇਸ ਸਮੀਖਿਆ ਦੀ ਉਡੀਕ ਕਰ ਰਿਹਾ ਹੈ — ਜਾਰੀ ਰੱਖਣ ਲਈ ਲਾਗੂ ਕਰੋ ਜਾਂ ਰੱਦ ਕਰੋ।",
|
|
9627
|
+
" +{count} more": " +{count} ਹੋਰ",
|
|
9628
|
+
"{count} mandatory fields missing in this group": "ਇਸ ਸਮੂਹ ਵਿੱਚ {count, plural, one {# ਲਾਜ਼ਮੀ ਖੇਤਰ ਖਾਲੀ ਹੈ} other {# ਲਾਜ਼ਮੀ ਖੇਤਰ ਖਾਲੀ ਹਨ}}",
|
|
9629
|
+
"{group} · row {row}": "{group} · ਕਤਾਰ {row}",
|
|
9630
|
+
"{group} · row {row} · {field}": "{group} · ਕਤਾਰ {row} · {field}",
|
|
9631
|
+
"{count} rows need a type selected in this group": "ਇਸ ਸਮੂਹ ਵਿੱਚ {count, plural, one {# ਕਤਾਰ ਲਈ} other {# ਕਤਾਰਾਂ ਲਈ}} ਕਿਸਮ ਚੁਣਨੀ ਲਾਜ਼ਮੀ ਹੈ",
|
|
9577
9632
|
};
|
|
9578
9633
|
|
|
9579
9634
|
const Add$1 = "Lägg till";
|
|
@@ -9944,6 +9999,11 @@ const sv = {
|
|
|
9944
9999
|
"Generation failed": "Genereringen misslyckades",
|
|
9945
10000
|
"Could not generate {category}. Please try again.": "Det gick inte att generera {category}. Försök igen.",
|
|
9946
10001
|
"The new note is waiting for this review — apply or cancel to continue.": "Den nya anteckningen väntar på den här granskningen — tillämpa eller avbryt för att fortsätta.",
|
|
10002
|
+
" +{count} more": " +{count} till",
|
|
10003
|
+
"{count} mandatory fields missing in this group": "{count, plural, one {# obligatoriskt fält saknas} other {# obligatoriska fält saknas}} i den här gruppen",
|
|
10004
|
+
"{group} · row {row}": "{group} · rad {row}",
|
|
10005
|
+
"{group} · row {row} · {field}": "{group} · rad {row} · {field}",
|
|
10006
|
+
"{count} rows need a type selected in this group": "{count, plural, one {# rad behöver} other {# rader behöver}} en vald typ i den här gruppen",
|
|
9947
10007
|
};
|
|
9948
10008
|
|
|
9949
10009
|
const Add = "شامل کریں";
|
|
@@ -10315,6 +10375,11 @@ const ur = {
|
|
|
10315
10375
|
"Generation failed": "تخلیق ناکام ہو گئی",
|
|
10316
10376
|
"Could not generate {category}. Please try again.": "{category} تیار نہیں کیا جا سکا۔ براہ کرم دوبارہ کوشش کریں۔",
|
|
10317
10377
|
"The new note is waiting for this review — apply or cancel to continue.": "نیا نوٹ اس جائزے کا منتظر ہے — جاری رکھنے کے لیے لاگو کریں یا منسوخ کریں۔",
|
|
10378
|
+
" +{count} more": " +{count} مزید",
|
|
10379
|
+
"{count} mandatory fields missing in this group": "اس گروپ میں {count, plural, one {# لازمی خانہ خالی ہے} other {# لازمی خانے خالی ہیں}}",
|
|
10380
|
+
"{group} · row {row}": "{group} · قطار {row}",
|
|
10381
|
+
"{group} · row {row} · {field}": "{group} · قطار {row} · {field}",
|
|
10382
|
+
"{count} rows need a type selected in this group": "اس گروپ میں {count, plural, one {# قطار کے لیے} other {# قطاروں کے لیے}} قسم منتخب کرنا ضروری ہے",
|
|
10318
10383
|
};
|
|
10319
10384
|
|
|
10320
10385
|
var LanguageCode = /* @__PURE__ */ ((LanguageCode2) => {
|
|
@@ -11078,6 +11143,299 @@ const useVadCoverage = () => {
|
|
|
11078
11143
|
};
|
|
11079
11144
|
};
|
|
11080
11145
|
|
|
11146
|
+
const KNOWN_SDK_EVENT_NAMES = [
|
|
11147
|
+
"recording.started",
|
|
11148
|
+
"recording.stopped",
|
|
11149
|
+
"recording.audio_lost",
|
|
11150
|
+
"recording.microphone_disconnected",
|
|
11151
|
+
"recording.heartbeat",
|
|
11152
|
+
"activity.interaction",
|
|
11153
|
+
"activity.typing",
|
|
11154
|
+
"report.generation_started",
|
|
11155
|
+
"report.settled",
|
|
11156
|
+
"lifecycle.ready",
|
|
11157
|
+
"lifecycle.closed"
|
|
11158
|
+
];
|
|
11159
|
+
const SDK_EVENT_FAMILIES = [
|
|
11160
|
+
"recording",
|
|
11161
|
+
"activity",
|
|
11162
|
+
"report",
|
|
11163
|
+
"lifecycle"
|
|
11164
|
+
];
|
|
11165
|
+
const FAMILIES = SDK_EVENT_FAMILIES;
|
|
11166
|
+
const familyOf = (name) => {
|
|
11167
|
+
const prefix = name.split(".")[0];
|
|
11168
|
+
return FAMILIES.includes(prefix) ? prefix : "lifecycle";
|
|
11169
|
+
};
|
|
11170
|
+
|
|
11171
|
+
const KNOWN_NAMES = new Set(KNOWN_SDK_EVENT_NAMES);
|
|
11172
|
+
const KNOWN_FAMILIES = new Set(SDK_EVENT_FAMILIES);
|
|
11173
|
+
const distance = (a, b) => {
|
|
11174
|
+
const prev = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
11175
|
+
for (let i = 1; i <= a.length; i++) {
|
|
11176
|
+
let corner = prev[0];
|
|
11177
|
+
prev[0] = i;
|
|
11178
|
+
for (let j = 1; j <= b.length; j++) {
|
|
11179
|
+
const next = Math.min(
|
|
11180
|
+
prev[j] + 1,
|
|
11181
|
+
prev[j - 1] + 1,
|
|
11182
|
+
corner + (a[i - 1] === b[j - 1] ? 0 : 1)
|
|
11183
|
+
);
|
|
11184
|
+
corner = prev[j];
|
|
11185
|
+
prev[j] = next;
|
|
11186
|
+
}
|
|
11187
|
+
}
|
|
11188
|
+
return prev[b.length];
|
|
11189
|
+
};
|
|
11190
|
+
const describeEntry = (entry) => {
|
|
11191
|
+
try {
|
|
11192
|
+
return JSON.stringify(entry) ?? `<${typeof entry}>`;
|
|
11193
|
+
} catch {
|
|
11194
|
+
return `<unserializable ${typeof entry}>`;
|
|
11195
|
+
}
|
|
11196
|
+
};
|
|
11197
|
+
const suggest = (value, candidates) => {
|
|
11198
|
+
let best = null;
|
|
11199
|
+
let bestScore = Infinity;
|
|
11200
|
+
for (const candidate of candidates) {
|
|
11201
|
+
const score = distance(value, candidate);
|
|
11202
|
+
if (score < bestScore) {
|
|
11203
|
+
bestScore = score;
|
|
11204
|
+
best = candidate;
|
|
11205
|
+
}
|
|
11206
|
+
}
|
|
11207
|
+
return best !== null && bestScore <= Math.max(3, best.length / 3) ? ` Did you mean "${best}"?` : "";
|
|
11208
|
+
};
|
|
11209
|
+
const REJECTED_KEY_CHARS = 40;
|
|
11210
|
+
const scanSubscriptions = (input) => {
|
|
11211
|
+
if (input === void 0 || input === null) {
|
|
11212
|
+
return { patterns: [], rejected: [], unusable: false, key: "" };
|
|
11213
|
+
}
|
|
11214
|
+
const raw = typeof input === "string" ? [input] : input;
|
|
11215
|
+
if (!Array.isArray(raw)) {
|
|
11216
|
+
return {
|
|
11217
|
+
patterns: [],
|
|
11218
|
+
rejected: [],
|
|
11219
|
+
unusable: true,
|
|
11220
|
+
key: `!${typeof input}`
|
|
11221
|
+
};
|
|
11222
|
+
}
|
|
11223
|
+
const patterns = [];
|
|
11224
|
+
const rejected = [];
|
|
11225
|
+
for (const entry of raw) {
|
|
11226
|
+
if (typeof entry !== "string") {
|
|
11227
|
+
rejected.push(entry);
|
|
11228
|
+
continue;
|
|
11229
|
+
}
|
|
11230
|
+
const pattern = entry.trim();
|
|
11231
|
+
if (pattern === "" || patterns.includes(pattern)) continue;
|
|
11232
|
+
patterns.push(pattern);
|
|
11233
|
+
}
|
|
11234
|
+
const key = JSON.stringify(patterns) + (rejected.length > 0 ? `!${rejected.map((entry) => describeEntry(entry).slice(0, REJECTED_KEY_CHARS)).join(",")}` : "");
|
|
11235
|
+
return { patterns, rejected, unusable: false, key };
|
|
11236
|
+
};
|
|
11237
|
+
const normalizeSubscriptions = (input) => {
|
|
11238
|
+
const { patterns, rejected, unusable, key } = scanSubscriptions(input);
|
|
11239
|
+
const problems = [];
|
|
11240
|
+
const warnings = [];
|
|
11241
|
+
if (unusable) {
|
|
11242
|
+
problems.push(
|
|
11243
|
+
`eventSubscriptions must be an array of strings, received ${typeof input}. No events will be delivered.`
|
|
11244
|
+
);
|
|
11245
|
+
return { patterns, key, problems, warnings };
|
|
11246
|
+
}
|
|
11247
|
+
for (const entry of rejected) {
|
|
11248
|
+
problems.push(
|
|
11249
|
+
`eventSubscriptions entry ${describeEntry(entry)} is not a string and was ignored.`
|
|
11250
|
+
);
|
|
11251
|
+
}
|
|
11252
|
+
for (const pattern of patterns) {
|
|
11253
|
+
if (pattern === "*" || KNOWN_NAMES.has(pattern)) continue;
|
|
11254
|
+
if (pattern.endsWith(".*")) {
|
|
11255
|
+
const family = pattern.slice(0, -2);
|
|
11256
|
+
if (!KNOWN_FAMILIES.has(family)) {
|
|
11257
|
+
const hint2 = suggest(family, KNOWN_FAMILIES);
|
|
11258
|
+
(hint2 ? problems : warnings).push(
|
|
11259
|
+
`"${pattern}" is not a known event family.${hint2}`
|
|
11260
|
+
);
|
|
11261
|
+
}
|
|
11262
|
+
continue;
|
|
11263
|
+
}
|
|
11264
|
+
const hint = suggest(pattern, KNOWN_NAMES);
|
|
11265
|
+
(hint ? problems : warnings).push(
|
|
11266
|
+
`"${pattern}" is not an event this SDK version emits.${hint}`
|
|
11267
|
+
);
|
|
11268
|
+
}
|
|
11269
|
+
const present = input !== void 0 && input !== null;
|
|
11270
|
+
if (present && patterns.length === 0 && problems.length === 0) {
|
|
11271
|
+
problems.push(
|
|
11272
|
+
'eventSubscriptions is empty, so onEvent will never fire. Pass e.g. ["recording.*", "activity.*"] or ["*"].'
|
|
11273
|
+
);
|
|
11274
|
+
}
|
|
11275
|
+
return { patterns, key, problems, warnings };
|
|
11276
|
+
};
|
|
11277
|
+
const reported = /* @__PURE__ */ new Set();
|
|
11278
|
+
const VALID_VALUES = `Valid values are "*", a family wildcard (${SDK_EVENT_FAMILIES.map((f) => `"${f}.*"`).join(", ")}), or an exact name (${KNOWN_SDK_EVENT_NAMES.join(", ")}).`;
|
|
11279
|
+
const reportOnce = (level, signature, message) => {
|
|
11280
|
+
if (reported.has(signature)) return;
|
|
11281
|
+
reported.add(signature);
|
|
11282
|
+
if (level === "error") logger.configError(message);
|
|
11283
|
+
else logger.warn(message);
|
|
11284
|
+
};
|
|
11285
|
+
const reportSubscriptionProblems = ({
|
|
11286
|
+
key,
|
|
11287
|
+
problems,
|
|
11288
|
+
warnings
|
|
11289
|
+
}) => {
|
|
11290
|
+
if (problems.length > 0) {
|
|
11291
|
+
reportOnce(
|
|
11292
|
+
"error",
|
|
11293
|
+
`error:${key}:${problems.join("|")}`,
|
|
11294
|
+
`[Sofia SDK] eventSubscriptions: ${problems.join(" ")} ${VALID_VALUES}`
|
|
11295
|
+
);
|
|
11296
|
+
}
|
|
11297
|
+
if (warnings.length > 0) {
|
|
11298
|
+
reportOnce(
|
|
11299
|
+
"warn",
|
|
11300
|
+
`warn:${key}:${warnings.join("|")}`,
|
|
11301
|
+
`[Sofia SDK] eventSubscriptions: ${warnings.join(" ")} ${VALID_VALUES}`
|
|
11302
|
+
);
|
|
11303
|
+
}
|
|
11304
|
+
};
|
|
11305
|
+
const reportHandlerWithoutSubscriptions = () => {
|
|
11306
|
+
reportOnce(
|
|
11307
|
+
"error",
|
|
11308
|
+
"onEvent:no-subscriptions",
|
|
11309
|
+
"[Sofia SDK] onEvent: onEvent was provided without eventSubscriptions, so no events will be delivered. " + VALID_VALUES
|
|
11310
|
+
);
|
|
11311
|
+
};
|
|
11312
|
+
const compileSubscription = (input) => {
|
|
11313
|
+
const normalized = normalizeSubscriptions(input);
|
|
11314
|
+
reportSubscriptionProblems(normalized);
|
|
11315
|
+
const { patterns } = normalized;
|
|
11316
|
+
if (patterns.length === 0) return () => false;
|
|
11317
|
+
if (patterns.includes("*")) return () => true;
|
|
11318
|
+
const exact = /* @__PURE__ */ new Set();
|
|
11319
|
+
const families = /* @__PURE__ */ new Set();
|
|
11320
|
+
for (const pattern of patterns) {
|
|
11321
|
+
if (pattern.endsWith(".*")) families.add(pattern.slice(0, -2));
|
|
11322
|
+
else exact.add(pattern);
|
|
11323
|
+
}
|
|
11324
|
+
if (families.size === 0) return (name) => exact.has(name);
|
|
11325
|
+
return (name) => {
|
|
11326
|
+
if (exact.has(name)) return true;
|
|
11327
|
+
const dot = name.indexOf(".");
|
|
11328
|
+
return dot > 0 && families.has(name.slice(0, dot));
|
|
11329
|
+
};
|
|
11330
|
+
};
|
|
11331
|
+
const subscriptionKey = (input) => scanSubscriptions(input).key;
|
|
11332
|
+
|
|
11333
|
+
const QUEUE_CAP = 200;
|
|
11334
|
+
let handler = null;
|
|
11335
|
+
let matches = () => false;
|
|
11336
|
+
let sessionId = null;
|
|
11337
|
+
let seq = 0;
|
|
11338
|
+
let queue$1 = [];
|
|
11339
|
+
let draining = false;
|
|
11340
|
+
let handlerFailed = false;
|
|
11341
|
+
let registrations = 0;
|
|
11342
|
+
const drain = () => {
|
|
11343
|
+
draining = false;
|
|
11344
|
+
const batch = queue$1;
|
|
11345
|
+
queue$1 = [];
|
|
11346
|
+
const current = handler;
|
|
11347
|
+
if (!current) return;
|
|
11348
|
+
for (const event of batch) {
|
|
11349
|
+
try {
|
|
11350
|
+
current(event);
|
|
11351
|
+
} catch {
|
|
11352
|
+
if (!handlerFailed) {
|
|
11353
|
+
handlerFailed = true;
|
|
11354
|
+
logger.warn(
|
|
11355
|
+
"[SdkEvents] onEvent handler threw; further failures suppressed"
|
|
11356
|
+
);
|
|
11357
|
+
}
|
|
11358
|
+
}
|
|
11359
|
+
}
|
|
11360
|
+
};
|
|
11361
|
+
const schedule = () => {
|
|
11362
|
+
if (draining) return;
|
|
11363
|
+
draining = true;
|
|
11364
|
+
queueMicrotask(drain);
|
|
11365
|
+
};
|
|
11366
|
+
const SdkEventBus = {
|
|
11367
|
+
/**
|
|
11368
|
+
* Installs the host handler. Returns an unsubscribe. Events that matched
|
|
11369
|
+
* the subscription but arrived before a handler existed are queued and
|
|
11370
|
+
* delivered on the next microtask. That window is real: React runs child
|
|
11371
|
+
* effects before parent ones, so a provider below `Omniscribe` can emit
|
|
11372
|
+
* after `setSubscription` and before this call.
|
|
11373
|
+
*/
|
|
11374
|
+
setHandler(next) {
|
|
11375
|
+
registrations += 1;
|
|
11376
|
+
if (next && handler && registrations > 1) {
|
|
11377
|
+
logger.warn(
|
|
11378
|
+
"[SdkEvents] a second onEvent handler was registered. The SDK supports one <Omniscribe> per page; the newest handler wins."
|
|
11379
|
+
);
|
|
11380
|
+
}
|
|
11381
|
+
handler = next;
|
|
11382
|
+
if (next && queue$1.length > 0) schedule();
|
|
11383
|
+
return () => {
|
|
11384
|
+
if (handler === next) handler = null;
|
|
11385
|
+
};
|
|
11386
|
+
},
|
|
11387
|
+
setSubscription(patterns) {
|
|
11388
|
+
matches = compileSubscription(patterns);
|
|
11389
|
+
},
|
|
11390
|
+
setSessionId(next) {
|
|
11391
|
+
sessionId = next;
|
|
11392
|
+
},
|
|
11393
|
+
/**
|
|
11394
|
+
* Cheap guard for callers on a hot path who would otherwise build a
|
|
11395
|
+
* payload for nobody.
|
|
11396
|
+
*/
|
|
11397
|
+
wants(name) {
|
|
11398
|
+
return matches(name);
|
|
11399
|
+
},
|
|
11400
|
+
/**
|
|
11401
|
+
* Queues an event for delivery on the next microtask.
|
|
11402
|
+
*
|
|
11403
|
+
* Never throws. Deferring delivery does three things at once: host code
|
|
11404
|
+
* never runs inside React's render phase (where a `setState` would
|
|
11405
|
+
* throw), a slow handler cannot block `socket.onmessage` on the audio
|
|
11406
|
+
* path, and a handler that itself triggers an event cannot recurse —
|
|
11407
|
+
* the re-entrant call only appends to a queue the current drain has
|
|
11408
|
+
* already taken. One shared drain, not one microtask per event, so `seq`
|
|
11409
|
+
* ordering is preserved.
|
|
11410
|
+
*/
|
|
11411
|
+
emit(name, payload, level = "info") {
|
|
11412
|
+
if (!matches(name)) return;
|
|
11413
|
+
queue$1.push({
|
|
11414
|
+
name,
|
|
11415
|
+
family: familyOf(name),
|
|
11416
|
+
level,
|
|
11417
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11418
|
+
seq: ++seq,
|
|
11419
|
+
sdkVersion: version$2,
|
|
11420
|
+
sessionId,
|
|
11421
|
+
payload
|
|
11422
|
+
});
|
|
11423
|
+
if (queue$1.length > QUEUE_CAP) queue$1.shift();
|
|
11424
|
+
if (handler) schedule();
|
|
11425
|
+
},
|
|
11426
|
+
/** Test-only: restores the module to its initial state. */
|
|
11427
|
+
__resetForTests() {
|
|
11428
|
+
handler = null;
|
|
11429
|
+
matches = () => false;
|
|
11430
|
+
sessionId = null;
|
|
11431
|
+
seq = 0;
|
|
11432
|
+
queue$1 = [];
|
|
11433
|
+
draining = false;
|
|
11434
|
+
handlerFailed = false;
|
|
11435
|
+
registrations = 0;
|
|
11436
|
+
}
|
|
11437
|
+
};
|
|
11438
|
+
|
|
11081
11439
|
const SettingsContext = React__default.createContext(
|
|
11082
11440
|
void 0
|
|
11083
11441
|
);
|
|
@@ -11118,6 +11476,7 @@ const SettingsProvider = ({
|
|
|
11118
11476
|
DEFAULT_MINOR_AGE_THRESHOLD
|
|
11119
11477
|
);
|
|
11120
11478
|
const [isLoading, setIsLoading] = React__default.useState(true);
|
|
11479
|
+
const hasEmittedReadyRef = React__default.useRef(false);
|
|
11121
11480
|
const isInitializedRef = React__default.useRef(false);
|
|
11122
11481
|
const applySettings = React__default.useCallback(
|
|
11123
11482
|
(parsed) => {
|
|
@@ -11170,6 +11529,10 @@ const SettingsProvider = ({
|
|
|
11170
11529
|
SettingsCache.getInstance().clear();
|
|
11171
11530
|
} finally {
|
|
11172
11531
|
setIsLoading(false);
|
|
11532
|
+
if (!hasEmittedReadyRef.current) {
|
|
11533
|
+
hasEmittedReadyRef.current = true;
|
|
11534
|
+
SdkEventBus.emit("lifecycle.ready", {});
|
|
11535
|
+
}
|
|
11173
11536
|
}
|
|
11174
11537
|
}, [toolArgs, templateId, predefinedLanguage, applySettings]);
|
|
11175
11538
|
const reloadSettings = React__default.useCallback(async () => {
|
|
@@ -17282,8 +17645,147 @@ const evaluateMinorRule = ({
|
|
|
17282
17645
|
|
|
17283
17646
|
const postAppEvent = (event) => requester.post("/app-events", event).catch(() => void 0);
|
|
17284
17647
|
|
|
17648
|
+
const ACTIVITY_THROTTLE_MS = 5e3;
|
|
17649
|
+
const lastEmittedAt = /* @__PURE__ */ new Map();
|
|
17650
|
+
const shouldEmit = (key) => {
|
|
17651
|
+
const now = Date.now();
|
|
17652
|
+
const previous = lastEmittedAt.get(key);
|
|
17653
|
+
if (previous !== void 0 && now - previous < ACTIVITY_THROTTLE_MS) {
|
|
17654
|
+
return false;
|
|
17655
|
+
}
|
|
17656
|
+
lastEmittedAt.set(key, now);
|
|
17657
|
+
return true;
|
|
17658
|
+
};
|
|
17659
|
+
const emitInteraction = (kind) => {
|
|
17660
|
+
if (!SdkEventBus.wants("activity.interaction")) return;
|
|
17661
|
+
if (!shouldEmit(`interaction:${kind}`)) return;
|
|
17662
|
+
SdkEventBus.emit("activity.interaction", { kind });
|
|
17663
|
+
};
|
|
17664
|
+
const emitTyping = (surface) => {
|
|
17665
|
+
if (!SdkEventBus.wants("activity.typing")) return;
|
|
17666
|
+
if (!shouldEmit(`typing:${surface}`)) return;
|
|
17667
|
+
SdkEventBus.emit("activity.typing", { surface });
|
|
17668
|
+
};
|
|
17669
|
+
|
|
17670
|
+
let open$1 = false;
|
|
17671
|
+
const openReportBracket = () => {
|
|
17672
|
+
if (open$1) return;
|
|
17673
|
+
open$1 = true;
|
|
17674
|
+
SdkEventBus.emit("report.generation_started", {});
|
|
17675
|
+
};
|
|
17676
|
+
const closeReportBracket = (ok) => {
|
|
17677
|
+
if (!open$1) return;
|
|
17678
|
+
open$1 = false;
|
|
17679
|
+
SdkEventBus.emit("report.settled", { ok });
|
|
17680
|
+
};
|
|
17681
|
+
|
|
17682
|
+
const RECORDING_HEARTBEAT_MS = 3e4;
|
|
17683
|
+
let lastBeatAt = null;
|
|
17684
|
+
const emitRecordingHeartbeat = () => {
|
|
17685
|
+
if (!SdkEventBus.wants("recording.heartbeat")) return;
|
|
17686
|
+
const now = Date.now();
|
|
17687
|
+
if (lastBeatAt !== null && now - lastBeatAt < RECORDING_HEARTBEAT_MS) return;
|
|
17688
|
+
lastBeatAt = now;
|
|
17689
|
+
SdkEventBus.emit("recording.heartbeat", {});
|
|
17690
|
+
};
|
|
17691
|
+
const resetRecordingHeartbeat = () => {
|
|
17692
|
+
lastBeatAt = null;
|
|
17693
|
+
};
|
|
17694
|
+
|
|
17695
|
+
const INTERACTION_KIND = {
|
|
17696
|
+
recording_button: "recording",
|
|
17697
|
+
chat_mic_button: "chat",
|
|
17698
|
+
attach_file_button: "chat",
|
|
17699
|
+
remove_file_button: "chat",
|
|
17700
|
+
edit_message_button: "chat",
|
|
17701
|
+
cancel_edit_message_button: "chat",
|
|
17702
|
+
send_edit_message_button: "chat",
|
|
17703
|
+
copy_human_message_button: "chat",
|
|
17704
|
+
copy_ai_message_button: "chat",
|
|
17705
|
+
settings_button: "settings",
|
|
17706
|
+
settings_back_button: "settings",
|
|
17707
|
+
settings_section_button: "settings",
|
|
17708
|
+
select_audio_environment: "settings",
|
|
17709
|
+
compile_summary_button: "report",
|
|
17710
|
+
regenerate_summary_button: "report",
|
|
17711
|
+
generate_extras_button: "report",
|
|
17712
|
+
expand_transcription_button: "transcript",
|
|
17713
|
+
history_thread_item: "history",
|
|
17714
|
+
close_widget_button: "widget",
|
|
17715
|
+
main_menu_button: "widget",
|
|
17716
|
+
play_panel_button: "widget"
|
|
17717
|
+
};
|
|
17718
|
+
const CLICK_FALLBACK_KIND = "widget";
|
|
17719
|
+
const RECORDING_MODES = ["consultation", "dictation"];
|
|
17720
|
+
const AUDIO_LOSS_CAUSES = ["mic", "network", "server"];
|
|
17721
|
+
const readNumber = (payload, key) => {
|
|
17722
|
+
const value = payload?.[key];
|
|
17723
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
17724
|
+
};
|
|
17725
|
+
const readMode = (payload) => {
|
|
17726
|
+
const value = payload?.mode;
|
|
17727
|
+
return typeof value === "string" && RECORDING_MODES.includes(value) ? value : "consultation";
|
|
17728
|
+
};
|
|
17729
|
+
const readCause = (payload) => {
|
|
17730
|
+
const value = payload?.cause;
|
|
17731
|
+
return typeof value === "string" && AUDIO_LOSS_CAUSES.includes(value) ? value : "server";
|
|
17732
|
+
};
|
|
17733
|
+
const fanOutAppEvent = (input) => {
|
|
17734
|
+
try {
|
|
17735
|
+
const { event_type, event_name, payload } = input;
|
|
17736
|
+
if (event_type === "click") {
|
|
17737
|
+
emitInteraction(INTERACTION_KIND[event_name] ?? CLICK_FALLBACK_KIND);
|
|
17738
|
+
}
|
|
17739
|
+
switch (event_name) {
|
|
17740
|
+
case "recording_started":
|
|
17741
|
+
resetRecordingHeartbeat();
|
|
17742
|
+
SdkEventBus.emit("recording.started", { mode: readMode(payload) });
|
|
17743
|
+
break;
|
|
17744
|
+
case "recording_stopped":
|
|
17745
|
+
SdkEventBus.emit("recording.stopped", {
|
|
17746
|
+
mode: readMode(payload),
|
|
17747
|
+
durationSeconds: readNumber(payload, "duration_seconds")
|
|
17748
|
+
});
|
|
17749
|
+
break;
|
|
17750
|
+
// The mic/network emitter reports the length of the gap once audio
|
|
17751
|
+
// recovers. The server-close emitter has no gap to measure — capture
|
|
17752
|
+
// is torn down on the spot — and reports the recording position
|
|
17753
|
+
// instead, so fall back to that rather than hand the host a silent 0.
|
|
17754
|
+
case "audio_lost":
|
|
17755
|
+
SdkEventBus.emit(
|
|
17756
|
+
"recording.audio_lost",
|
|
17757
|
+
{
|
|
17758
|
+
cause: readCause(payload),
|
|
17759
|
+
durationSeconds: readNumber(payload, "duration_seconds") || readNumber(payload, "recording_position_seconds")
|
|
17760
|
+
},
|
|
17761
|
+
"warn"
|
|
17762
|
+
);
|
|
17763
|
+
break;
|
|
17764
|
+
case "mic_disconnected":
|
|
17765
|
+
SdkEventBus.emit("recording.microphone_disconnected", {}, "warn");
|
|
17766
|
+
break;
|
|
17767
|
+
// A report request is in flight. The host must suppress its idle
|
|
17768
|
+
// timer until report.settled, or it will close the widget during
|
|
17769
|
+
// generation — which looks exactly like idleness and loses the note.
|
|
17770
|
+
// openReportBracket ignores a second click while one is in flight, so
|
|
17771
|
+
// the pair stays balanced.
|
|
17772
|
+
case "compile_summary_button":
|
|
17773
|
+
case "regenerate_summary_button":
|
|
17774
|
+
openReportBracket();
|
|
17775
|
+
break;
|
|
17776
|
+
case "close_widget_button":
|
|
17777
|
+
SdkEventBus.emit("lifecycle.closed", {});
|
|
17778
|
+
break;
|
|
17779
|
+
default:
|
|
17780
|
+
break;
|
|
17781
|
+
}
|
|
17782
|
+
} catch {
|
|
17783
|
+
}
|
|
17784
|
+
};
|
|
17785
|
+
|
|
17285
17786
|
const EventTracker = {
|
|
17286
17787
|
track(input) {
|
|
17788
|
+
fanOutAppEvent(input);
|
|
17287
17789
|
const event = {
|
|
17288
17790
|
event_type: input.event_type,
|
|
17289
17791
|
event_name: input.event_name,
|
|
@@ -21051,6 +21553,7 @@ const useAudioProcessor = ({
|
|
|
21051
21553
|
);
|
|
21052
21554
|
socket.send(audioData16kHz);
|
|
21053
21555
|
lastSendAtRef.current = Date.now();
|
|
21556
|
+
emitRecordingHeartbeat();
|
|
21054
21557
|
}
|
|
21055
21558
|
};
|
|
21056
21559
|
audioTracks.forEach((t) => {
|
|
@@ -22540,6 +23043,7 @@ const useReportPreviewState = ({
|
|
|
22540
23043
|
}, []);
|
|
22541
23044
|
const setScalarEdit = React__default.useCallback(
|
|
22542
23045
|
(entryKey, value) => {
|
|
23046
|
+
emitTyping("note");
|
|
22543
23047
|
setEdits((prev) => {
|
|
22544
23048
|
const next = new Map(prev);
|
|
22545
23049
|
next.set(entryKey, value);
|
|
@@ -22550,6 +23054,7 @@ const useReportPreviewState = ({
|
|
|
22550
23054
|
);
|
|
22551
23055
|
const setRowFieldEdit = React__default.useCallback(
|
|
22552
23056
|
(entryKey, rowIndex, fieldKey, value) => {
|
|
23057
|
+
emitTyping("note");
|
|
22553
23058
|
setEdits((prev) => {
|
|
22554
23059
|
const next = new Map(prev);
|
|
22555
23060
|
next.set(rowFieldEditKey(entryKey, rowIndex, fieldKey), value);
|
|
@@ -22559,6 +23064,7 @@ const useReportPreviewState = ({
|
|
|
22559
23064
|
[]
|
|
22560
23065
|
);
|
|
22561
23066
|
const setScalarGapValue = React__default.useCallback((key, value) => {
|
|
23067
|
+
emitTyping("note");
|
|
22562
23068
|
setFilledScalarGaps((prev) => {
|
|
22563
23069
|
const next = new Map(prev);
|
|
22564
23070
|
next.set(key, value);
|
|
@@ -22588,18 +23094,22 @@ const useReportPreviewState = ({
|
|
|
22588
23094
|
}),
|
|
22589
23095
|
[entries, selectedKeys, selectedRows, filledScalarGaps]
|
|
22590
23096
|
);
|
|
22591
|
-
const
|
|
22592
|
-
|
|
23097
|
+
const blockingGaps = React__default.useMemo(() => {
|
|
23098
|
+
const out = [];
|
|
22593
23099
|
for (const g of scalarGaps) {
|
|
22594
23100
|
if (!g.mandatory) continue;
|
|
22595
23101
|
const filled = filledScalarGaps.get(g.key);
|
|
22596
|
-
if (isEmptyValue(filled))
|
|
23102
|
+
if (isEmptyValue(filled)) {
|
|
23103
|
+
out.push({ scope: "field", key: g.key, label: g.descriptor.label });
|
|
23104
|
+
}
|
|
22597
23105
|
}
|
|
22598
23106
|
for (const e of entries) {
|
|
22599
23107
|
if (!selectedKeys.has(e.key)) continue;
|
|
22600
23108
|
if (e.descriptor.kind !== "array-of-objects" && e.descriptor.mandatory) {
|
|
22601
23109
|
const v = edits.has(e.key) ? edits.get(e.key) : e.value;
|
|
22602
|
-
if (isEmptyValue(v))
|
|
23110
|
+
if (isEmptyValue(v)) {
|
|
23111
|
+
out.push({ scope: "field", key: e.key, label: e.descriptor.label });
|
|
23112
|
+
}
|
|
22603
23113
|
}
|
|
22604
23114
|
if (e.descriptor.kind !== "array-of-objects") continue;
|
|
22605
23115
|
const rows = e.value ?? [];
|
|
@@ -22607,16 +23117,32 @@ const useReportPreviewState = ({
|
|
|
22607
23117
|
if (!selectedRows.has(`${e.key}#${idx}`)) return;
|
|
22608
23118
|
const row = mergeRowEdits(e.key, idx, rawRow, edits);
|
|
22609
23119
|
if (e.descriptor.discriminator && !pickBranch(e.descriptor, row)) {
|
|
22610
|
-
|
|
23120
|
+
out.push({
|
|
23121
|
+
scope: "row",
|
|
23122
|
+
key: e.key,
|
|
23123
|
+
groupLabel: e.descriptor.label,
|
|
23124
|
+
rowIndex: idx,
|
|
23125
|
+
label: null,
|
|
23126
|
+
fieldKey: e.descriptor.discriminator.propertyName
|
|
23127
|
+
});
|
|
22611
23128
|
return;
|
|
22612
23129
|
}
|
|
22613
|
-
const
|
|
22614
|
-
|
|
22615
|
-
if (isEmptyValue(row[
|
|
23130
|
+
for (const f of effectiveItemFields(e.descriptor, row)) {
|
|
23131
|
+
if (!f.mandatory) continue;
|
|
23132
|
+
if (isEmptyValue(row[f.key])) {
|
|
23133
|
+
out.push({
|
|
23134
|
+
scope: "row",
|
|
23135
|
+
key: e.key,
|
|
23136
|
+
groupLabel: e.descriptor.label,
|
|
23137
|
+
rowIndex: idx,
|
|
23138
|
+
label: f.label,
|
|
23139
|
+
fieldKey: f.key
|
|
23140
|
+
});
|
|
23141
|
+
}
|
|
22616
23142
|
}
|
|
22617
23143
|
});
|
|
22618
23144
|
}
|
|
22619
|
-
return
|
|
23145
|
+
return out;
|
|
22620
23146
|
}, [
|
|
22621
23147
|
entries,
|
|
22622
23148
|
scalarGaps,
|
|
@@ -22625,9 +23151,11 @@ const useReportPreviewState = ({
|
|
|
22625
23151
|
edits,
|
|
22626
23152
|
filledScalarGaps
|
|
22627
23153
|
]);
|
|
23154
|
+
const blockingMandatoryCount = blockingGaps.length;
|
|
22628
23155
|
return {
|
|
22629
23156
|
entries,
|
|
22630
23157
|
scalarGaps,
|
|
23158
|
+
blockingGaps,
|
|
22631
23159
|
rowGaps,
|
|
22632
23160
|
selectedKeys,
|
|
22633
23161
|
selectedRows,
|
|
@@ -23351,13 +23879,41 @@ const InsertionPreviewModal = ({
|
|
|
23351
23879
|
]
|
|
23352
23880
|
}
|
|
23353
23881
|
),
|
|
23354
|
-
(state.scalarGaps.length > 0 || state.blockingMandatoryCount > 0) && /* @__PURE__ */ jsx$2("p", { className: "omniscribe_insertion-preview__sub", children: state.blockingMandatoryCount > 0 ? /* @__PURE__ */
|
|
23355
|
-
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
|
|
23359
|
-
|
|
23360
|
-
|
|
23882
|
+
(state.scalarGaps.length > 0 || state.blockingMandatoryCount > 0) && /* @__PURE__ */ jsx$2("p", { className: "omniscribe_insertion-preview__sub", children: state.blockingMandatoryCount > 0 ? /* @__PURE__ */ jsxs("strong", { className: "omniscribe_insertion-preview__sub--blocking", children: [
|
|
23883
|
+
formatMessage(
|
|
23884
|
+
{
|
|
23885
|
+
id: "{count} mandatory fields must be filled before applying",
|
|
23886
|
+
defaultMessage: "{count, plural, one {# mandatory field} other {# mandatory fields}} must be filled before applying"
|
|
23887
|
+
},
|
|
23888
|
+
{ count: state.blockingMandatoryCount }
|
|
23889
|
+
),
|
|
23890
|
+
": ",
|
|
23891
|
+
state.blockingGaps.slice(0, BLOCKING_GAPS_SHOWN).map(
|
|
23892
|
+
(g) => g.scope === "field" ? g.label : g.label === null ? formatMessage(
|
|
23893
|
+
{
|
|
23894
|
+
id: "{group} · row {row}",
|
|
23895
|
+
defaultMessage: "{group} · row {row}"
|
|
23896
|
+
},
|
|
23897
|
+
{ group: g.groupLabel, row: g.rowIndex + 1 }
|
|
23898
|
+
) : formatMessage(
|
|
23899
|
+
{
|
|
23900
|
+
id: "{group} · row {row} · {field}",
|
|
23901
|
+
defaultMessage: "{group} · row {row} · {field}"
|
|
23902
|
+
},
|
|
23903
|
+
{
|
|
23904
|
+
group: g.groupLabel,
|
|
23905
|
+
row: g.rowIndex + 1,
|
|
23906
|
+
field: g.label
|
|
23907
|
+
}
|
|
23908
|
+
)
|
|
23909
|
+
).join(", "),
|
|
23910
|
+
state.blockingGaps.length > BLOCKING_GAPS_SHOWN && formatMessage(
|
|
23911
|
+
{ id: " +{count} more", defaultMessage: " +{count} more" },
|
|
23912
|
+
{
|
|
23913
|
+
count: state.blockingGaps.length - BLOCKING_GAPS_SHOWN
|
|
23914
|
+
}
|
|
23915
|
+
)
|
|
23916
|
+
] }) : formatMessage(
|
|
23361
23917
|
{
|
|
23362
23918
|
id: "{count} fields need your attention",
|
|
23363
23919
|
defaultMessage: "{count, plural, one {# field needs} other {# fields need}} your attention"
|
|
@@ -23543,14 +24099,44 @@ const EntrySection = ({
|
|
|
23543
24099
|
classNames
|
|
23544
24100
|
}) => {
|
|
23545
24101
|
const { formatMessage } = useIntl();
|
|
23546
|
-
const
|
|
23547
|
-
|
|
23548
|
-
|
|
23549
|
-
|
|
24102
|
+
const blockingRows = React.useMemo(
|
|
24103
|
+
() => state.blockingGaps.filter((g) => g.scope === "row" && g.key === entry.key),
|
|
24104
|
+
[state.blockingGaps, entry.key]
|
|
24105
|
+
);
|
|
24106
|
+
const hasMandatoryRowGap = blockingRows.length > 0;
|
|
24107
|
+
const missingFieldCount = blockingRows.filter(
|
|
24108
|
+
(g) => g.scope === "row" && g.label !== null
|
|
24109
|
+
).length;
|
|
24110
|
+
const untypedRowCount = blockingRows.length - missingFieldCount;
|
|
24111
|
+
const groupGapSummary = [
|
|
24112
|
+
missingFieldCount > 0 && formatMessage(
|
|
24113
|
+
{
|
|
24114
|
+
id: "{count} mandatory fields missing in this group",
|
|
24115
|
+
defaultMessage: "{count, plural, one {# mandatory field missing} other {# mandatory fields missing}} in this group"
|
|
24116
|
+
},
|
|
24117
|
+
{ count: missingFieldCount }
|
|
24118
|
+
),
|
|
24119
|
+
untypedRowCount > 0 && formatMessage(
|
|
24120
|
+
{
|
|
24121
|
+
id: "{count} rows need a type selected in this group",
|
|
24122
|
+
defaultMessage: "{count, plural, one {# row needs} other {# rows need}} a type selected in this group"
|
|
24123
|
+
},
|
|
24124
|
+
{ count: untypedRowCount }
|
|
24125
|
+
)
|
|
24126
|
+
].filter(Boolean).join(" · ");
|
|
23550
24127
|
const [expanded, setExpanded] = React.useState(hasMandatoryRowGap);
|
|
23551
24128
|
React.useEffect(() => {
|
|
23552
24129
|
if (hasMandatoryRowGap) setExpanded(true);
|
|
23553
24130
|
}, [hasMandatoryRowGap]);
|
|
24131
|
+
const missingKeysOfRow = (idx) => {
|
|
24132
|
+
const keys = new Set(
|
|
24133
|
+
state.rowGaps.get(entry.key)?.find((g) => g.index === idx)?.missingKeys
|
|
24134
|
+
);
|
|
24135
|
+
for (const g of blockingRows) {
|
|
24136
|
+
if (g.scope === "row" && g.rowIndex === idx) keys.add(g.fieldKey);
|
|
24137
|
+
}
|
|
24138
|
+
return [...keys];
|
|
24139
|
+
};
|
|
23554
24140
|
if (entry.descriptor.kind === "array-of-objects") {
|
|
23555
24141
|
const rows = entry.value;
|
|
23556
24142
|
return /* @__PURE__ */ jsxs(
|
|
@@ -23576,7 +24162,23 @@ const EntrySection = ({
|
|
|
23576
24162
|
/* @__PURE__ */ jsx$2("div", { className: "omniscribe_insertion-preview__row-body", children: /* @__PURE__ */ jsxs("div", { className: "omniscribe_insertion-preview__row-label", children: [
|
|
23577
24163
|
entry.descriptor.label,
|
|
23578
24164
|
" · ",
|
|
23579
|
-
rows.length
|
|
24165
|
+
rows.length,
|
|
24166
|
+
hasMandatoryRowGap && // `role="img"` + `aria-label`: a `title` alone is not exposed
|
|
24167
|
+
// reliably, so a screen reader announced only "star 1".
|
|
24168
|
+
/* @__PURE__ */ jsxs(
|
|
24169
|
+
"span",
|
|
24170
|
+
{
|
|
24171
|
+
className: "omniscribe_insertion-preview__group-count--gap",
|
|
24172
|
+
role: "img",
|
|
24173
|
+
title: groupGapSummary,
|
|
24174
|
+
"aria-label": groupGapSummary,
|
|
24175
|
+
children: [
|
|
24176
|
+
" ",
|
|
24177
|
+
"★ ",
|
|
24178
|
+
blockingRows.length
|
|
24179
|
+
]
|
|
24180
|
+
}
|
|
24181
|
+
)
|
|
23580
24182
|
] }) })
|
|
23581
24183
|
] }),
|
|
23582
24184
|
/* @__PURE__ */ jsx$2(
|
|
@@ -23597,7 +24199,7 @@ const EntrySection = ({
|
|
|
23597
24199
|
row,
|
|
23598
24200
|
descriptor: entry.descriptor,
|
|
23599
24201
|
state,
|
|
23600
|
-
missingKeys:
|
|
24202
|
+
missingKeys: missingKeysOfRow(idx),
|
|
23601
24203
|
classNames
|
|
23602
24204
|
},
|
|
23603
24205
|
idx
|
|
@@ -23763,6 +24365,7 @@ const RowItem = ({
|
|
|
23763
24365
|
}
|
|
23764
24366
|
);
|
|
23765
24367
|
};
|
|
24368
|
+
const BLOCKING_GAPS_SHOWN = 3;
|
|
23766
24369
|
const ScalarGapRow = ({
|
|
23767
24370
|
descriptor,
|
|
23768
24371
|
value,
|
|
@@ -24458,6 +25061,7 @@ const useReportGeneration = (options) => {
|
|
|
24458
25061
|
} finally {
|
|
24459
25062
|
setState((prev) => ({ ...prev, generating: false }));
|
|
24460
25063
|
regenerateInflightRef.current = false;
|
|
25064
|
+
closeReportBracket(false);
|
|
24461
25065
|
}
|
|
24462
25066
|
}, [
|
|
24463
25067
|
abortIfBlocked,
|
|
@@ -24498,6 +25102,7 @@ const useReportGeneration = (options) => {
|
|
|
24498
25102
|
handleReport?.(result);
|
|
24499
25103
|
}
|
|
24500
25104
|
trackEvent("event", "summary_compiled");
|
|
25105
|
+
closeReportBracket(true);
|
|
24501
25106
|
if (patientId && doctorId) {
|
|
24502
25107
|
await saveDayData({
|
|
24503
25108
|
patientId,
|
|
@@ -24688,6 +25293,7 @@ const useReportGeneration = (options) => {
|
|
|
24688
25293
|
}
|
|
24689
25294
|
} finally {
|
|
24690
25295
|
generateInflightRef.current = false;
|
|
25296
|
+
closeReportBracket(false);
|
|
24691
25297
|
setUserPendingClick(false);
|
|
24692
25298
|
const finalPid = appointmentData?.patientId;
|
|
24693
25299
|
const finalDid = appointmentData?.doctorId;
|
|
@@ -151315,122 +151921,108 @@ const ChatFooter = ({
|
|
|
151315
151921
|
]
|
|
151316
151922
|
}
|
|
151317
151923
|
),
|
|
151318
|
-
/* @__PURE__ */ jsxs(
|
|
151319
|
-
|
|
151320
|
-
|
|
151321
|
-
|
|
151322
|
-
|
|
151323
|
-
|
|
151324
|
-
|
|
151325
|
-
|
|
151326
|
-
|
|
151327
|
-
|
|
151328
|
-
|
|
151329
|
-
|
|
151330
|
-
|
|
151331
|
-
|
|
151332
|
-
|
|
151333
|
-
|
|
151334
|
-
|
|
151335
|
-
|
|
151336
|
-
"div",
|
|
151337
|
-
|
|
151338
|
-
|
|
151339
|
-
|
|
151340
|
-
|
|
151341
|
-
|
|
151342
|
-
/* @__PURE__ */ jsx$2(
|
|
151343
|
-
|
|
151924
|
+
/* @__PURE__ */ jsxs("div", { className: "omniscribe_chat-view-combined-footer-row", children: [
|
|
151925
|
+
/* @__PURE__ */ jsx$2(
|
|
151926
|
+
"input",
|
|
151927
|
+
{
|
|
151928
|
+
ref: fileInputRef,
|
|
151929
|
+
type: "file",
|
|
151930
|
+
multiple: true,
|
|
151931
|
+
accept: "image/*,.pdf",
|
|
151932
|
+
onChange: onFileSelect,
|
|
151933
|
+
style: { display: "none" }
|
|
151934
|
+
}
|
|
151935
|
+
),
|
|
151936
|
+
/* @__PURE__ */ jsxs(
|
|
151937
|
+
"div",
|
|
151938
|
+
{
|
|
151939
|
+
className: `omniscribe_chat-view-combined-input-container${uploadedFiles.length > 0 ? " omniscribe_chat-view-combined-input-container--with-files" : ""}`,
|
|
151940
|
+
children: [
|
|
151941
|
+
uploadedFiles.length > 0 && /* @__PURE__ */ jsx$2("div", { className: "omniscribe_chat-view-combined-files-row", children: /* @__PURE__ */ jsx$2(FilePreview, { files: uploadedFiles, onRemove: onFileRemove }) }),
|
|
151942
|
+
/* @__PURE__ */ jsxs("div", { className: "omniscribe_chat-view-combined-input-row", children: [
|
|
151943
|
+
/* @__PURE__ */ jsx$2(
|
|
151944
|
+
Tooltip,
|
|
151945
|
+
{
|
|
151946
|
+
message: formatMessage({ id: "Attach file" }),
|
|
151947
|
+
side: "top",
|
|
151948
|
+
children: /* @__PURE__ */ jsx$2(
|
|
151949
|
+
"button",
|
|
151344
151950
|
{
|
|
151345
|
-
|
|
151346
|
-
|
|
151951
|
+
type: "button",
|
|
151952
|
+
className: "omniscribe_chat-view-combined-clip-icon",
|
|
151953
|
+
onClick: () => {
|
|
151954
|
+
trackEvent("click", "attach_file_button");
|
|
151955
|
+
onAttachClick();
|
|
151956
|
+
},
|
|
151957
|
+
disabled: uploadedFiles.length >= MAX_FILES,
|
|
151958
|
+
"aria-label": formatMessage({ id: "Attach file" }),
|
|
151347
151959
|
children: /* @__PURE__ */ jsx$2(
|
|
151348
|
-
"
|
|
151960
|
+
"svg",
|
|
151349
151961
|
{
|
|
151350
|
-
|
|
151351
|
-
|
|
151352
|
-
|
|
151353
|
-
|
|
151354
|
-
|
|
151355
|
-
|
|
151356
|
-
|
|
151357
|
-
|
|
151358
|
-
children: /* @__PURE__ */ jsx$2(
|
|
151359
|
-
"svg",
|
|
151360
|
-
{
|
|
151361
|
-
width: "12",
|
|
151362
|
-
height: "12",
|
|
151363
|
-
viewBox: "0 0 24 24",
|
|
151364
|
-
fill: "none",
|
|
151365
|
-
stroke: "currentColor",
|
|
151366
|
-
strokeWidth: "2",
|
|
151367
|
-
strokeLinecap: "round",
|
|
151368
|
-
strokeLinejoin: "round",
|
|
151369
|
-
children: /* @__PURE__ */ jsx$2("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" })
|
|
151370
|
-
}
|
|
151371
|
-
)
|
|
151962
|
+
width: "12",
|
|
151963
|
+
height: "12",
|
|
151964
|
+
viewBox: "0 0 24 24",
|
|
151965
|
+
fill: "none",
|
|
151966
|
+
stroke: "currentColor",
|
|
151967
|
+
strokeWidth: "2",
|
|
151968
|
+
strokeLinecap: "round",
|
|
151969
|
+
strokeLinejoin: "round",
|
|
151970
|
+
children: /* @__PURE__ */ jsx$2("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" })
|
|
151372
151971
|
}
|
|
151373
151972
|
)
|
|
151374
151973
|
}
|
|
151375
|
-
)
|
|
151376
|
-
|
|
151377
|
-
|
|
151378
|
-
|
|
151379
|
-
|
|
151380
|
-
|
|
151381
|
-
|
|
151382
|
-
|
|
151383
|
-
|
|
151384
|
-
|
|
151385
|
-
|
|
151386
|
-
|
|
151387
|
-
|
|
151388
|
-
|
|
151389
|
-
|
|
151390
|
-
|
|
151391
|
-
}
|
|
151392
|
-
},
|
|
151393
|
-
maxLength: inputMaxLength,
|
|
151394
|
-
className: "omniscribe_chat-view-combined-textarea no-scrollbar text-p",
|
|
151395
|
-
placeholder: formatMessage({
|
|
151396
|
-
id: "What do you need to know?"
|
|
151397
|
-
})
|
|
151398
|
-
}
|
|
151399
|
-
),
|
|
151400
|
-
isLoading ? /* @__PURE__ */ jsx$2(
|
|
151401
|
-
"button",
|
|
151402
|
-
{
|
|
151403
|
-
type: "button",
|
|
151404
|
-
"data-testid": "sofia-chat-stop",
|
|
151405
|
-
onClick: onStop,
|
|
151406
|
-
className: "omniscribe_chat-view-combined-send-btn omniscribe_chat-view-combined-stop-btn",
|
|
151407
|
-
title: formatMessage({ id: "Stop" }),
|
|
151408
|
-
children: /* @__PURE__ */ jsx$2(SquareIcon, { width: 10, height: 10 })
|
|
151409
|
-
}
|
|
151410
|
-
) : inputValue.length > 0 ? /* @__PURE__ */ jsx$2(
|
|
151411
|
-
"button",
|
|
151412
|
-
{
|
|
151413
|
-
type: "button",
|
|
151414
|
-
"data-testid": "sofia-chat-send",
|
|
151415
|
-
onClick: (e) => {
|
|
151416
|
-
const form = e.currentTarget.closest(
|
|
151417
|
-
"form"
|
|
151418
|
-
);
|
|
151419
|
-
form?.requestSubmit();
|
|
151420
|
-
},
|
|
151421
|
-
className: "omniscribe_chat-view-combined-send-btn",
|
|
151422
|
-
disabled: isLoading || !inputIsValid,
|
|
151423
|
-
title: formatMessage({ id: "Send" }),
|
|
151424
|
-
children: /* @__PURE__ */ jsx$2(SendArrowIcon, { width: 16, height: 16 })
|
|
151974
|
+
)
|
|
151975
|
+
}
|
|
151976
|
+
),
|
|
151977
|
+
/* @__PURE__ */ jsx$2(
|
|
151978
|
+
Textarea,
|
|
151979
|
+
{
|
|
151980
|
+
ref: textareaRef,
|
|
151981
|
+
rows: 1,
|
|
151982
|
+
"data-testid": "sofia-chat-input",
|
|
151983
|
+
value: inputValue,
|
|
151984
|
+
variant: "secondary",
|
|
151985
|
+
onChange: onInputChange,
|
|
151986
|
+
onKeyDown: (e) => {
|
|
151987
|
+
if (e.key === "Enter" && !e.shiftKey && !e.metaKey) {
|
|
151988
|
+
e.preventDefault();
|
|
151989
|
+
onSubmit(e);
|
|
151425
151990
|
}
|
|
151426
|
-
|
|
151427
|
-
|
|
151428
|
-
|
|
151429
|
-
|
|
151430
|
-
|
|
151431
|
-
|
|
151432
|
-
|
|
151433
|
-
|
|
151991
|
+
},
|
|
151992
|
+
maxLength: inputMaxLength,
|
|
151993
|
+
className: "omniscribe_chat-view-combined-textarea no-scrollbar text-p",
|
|
151994
|
+
placeholder: formatMessage({
|
|
151995
|
+
id: "What do you need to know?"
|
|
151996
|
+
})
|
|
151997
|
+
}
|
|
151998
|
+
),
|
|
151999
|
+
isLoading ? /* @__PURE__ */ jsx$2(
|
|
152000
|
+
"button",
|
|
152001
|
+
{
|
|
152002
|
+
type: "button",
|
|
152003
|
+
"data-testid": "sofia-chat-stop",
|
|
152004
|
+
onClick: onStop,
|
|
152005
|
+
className: "omniscribe_chat-view-combined-send-btn omniscribe_chat-view-combined-stop-btn",
|
|
152006
|
+
title: formatMessage({ id: "Stop" }),
|
|
152007
|
+
children: /* @__PURE__ */ jsx$2(SquareIcon, { width: 10, height: 10 })
|
|
152008
|
+
}
|
|
152009
|
+
) : inputValue.length > 0 ? /* @__PURE__ */ jsx$2(
|
|
152010
|
+
"button",
|
|
152011
|
+
{
|
|
152012
|
+
type: "button",
|
|
152013
|
+
"data-testid": "sofia-chat-send",
|
|
152014
|
+
onClick: onSubmit,
|
|
152015
|
+
className: "omniscribe_chat-view-combined-send-btn",
|
|
152016
|
+
disabled: isLoading || !inputIsValid,
|
|
152017
|
+
title: formatMessage({ id: "Send" }),
|
|
152018
|
+
children: /* @__PURE__ */ jsx$2(SendArrowIcon, { width: 16, height: 16 })
|
|
152019
|
+
}
|
|
152020
|
+
) : /* @__PURE__ */ jsx$2(MicrophoneButton, { onTextUpdate: onTranscriptionUpdate })
|
|
152021
|
+
] })
|
|
152022
|
+
]
|
|
152023
|
+
}
|
|
152024
|
+
)
|
|
152025
|
+
] })
|
|
151434
152026
|
] })
|
|
151435
152027
|
] });
|
|
151436
152028
|
};
|
|
@@ -152083,6 +152675,7 @@ const ChatView = () => {
|
|
|
152083
152675
|
appointmentData?.doctorId
|
|
152084
152676
|
]);
|
|
152085
152677
|
const handleInputChange = (e) => {
|
|
152678
|
+
emitTyping("chat");
|
|
152086
152679
|
input.onChange(e);
|
|
152087
152680
|
setInputIsValid(
|
|
152088
152681
|
InputValidator.validate(e.target.value, CHAT_INPUT_VALIDATION).isValid
|
|
@@ -156492,6 +157085,9 @@ const SessionProvider = ({ children }) => {
|
|
|
156492
157085
|
prevPatientIdRef.current = patientId;
|
|
156493
157086
|
setSessionId(patientId ? generateUuid() : null);
|
|
156494
157087
|
}, [patientId]);
|
|
157088
|
+
useEffect(() => {
|
|
157089
|
+
SdkEventBus.setSessionId(sessionId);
|
|
157090
|
+
}, [sessionId]);
|
|
156495
157091
|
return /* @__PURE__ */ jsx$2(SessionContext.Provider, { value: { sessionId }, children });
|
|
156496
157092
|
};
|
|
156497
157093
|
|
|
@@ -156677,6 +157273,7 @@ const useBrowserCapabilityCheck = () => {
|
|
|
156677
157273
|
}, []);
|
|
156678
157274
|
};
|
|
156679
157275
|
|
|
157276
|
+
const MISSING_SUBSCRIPTIONS_GRACE_MS = 1e3;
|
|
156680
157277
|
const BrowserCapabilityProbe = () => {
|
|
156681
157278
|
useBrowserCapabilityCheck();
|
|
156682
157279
|
return null;
|
|
@@ -156711,7 +157308,9 @@ const Omniscribe = ({
|
|
|
156711
157308
|
onReportApply,
|
|
156712
157309
|
updateTemplate,
|
|
156713
157310
|
templateExtras,
|
|
156714
|
-
handleExtras
|
|
157311
|
+
handleExtras,
|
|
157312
|
+
onEvent,
|
|
157313
|
+
eventSubscriptions
|
|
156715
157314
|
}) => {
|
|
156716
157315
|
const templateFields = template ?? toolsargs;
|
|
156717
157316
|
const effectiveBaseUrl = React.useMemo(
|
|
@@ -156760,6 +157359,30 @@ const Omniscribe = ({
|
|
|
156760
157359
|
React.useEffect(() => {
|
|
156761
157360
|
logger.setDebugMode(debug || false);
|
|
156762
157361
|
}, [debug]);
|
|
157362
|
+
const onEventRef = React.useRef(onEvent);
|
|
157363
|
+
onEventRef.current = onEvent;
|
|
157364
|
+
const hasEventHandler = onEvent !== void 0;
|
|
157365
|
+
const subscriptionsRef = React.useRef(
|
|
157366
|
+
eventSubscriptions
|
|
157367
|
+
);
|
|
157368
|
+
subscriptionsRef.current = eventSubscriptions;
|
|
157369
|
+
const subscriptions = subscriptionKey(eventSubscriptions);
|
|
157370
|
+
React.useEffect(() => {
|
|
157371
|
+
SdkEventBus.setSubscription(subscriptionsRef.current);
|
|
157372
|
+
}, [subscriptions]);
|
|
157373
|
+
React.useEffect(() => {
|
|
157374
|
+
if (!hasEventHandler) return;
|
|
157375
|
+
return SdkEventBus.setHandler((event) => onEventRef.current?.(event));
|
|
157376
|
+
}, [hasEventHandler]);
|
|
157377
|
+
const hasSubscriptionsProp = eventSubscriptions !== void 0 && eventSubscriptions !== null;
|
|
157378
|
+
React.useEffect(() => {
|
|
157379
|
+
if (!hasEventHandler || hasSubscriptionsProp) return;
|
|
157380
|
+
const timer = setTimeout(
|
|
157381
|
+
reportHandlerWithoutSubscriptions,
|
|
157382
|
+
MISSING_SUBSCRIPTIONS_GRACE_MS
|
|
157383
|
+
);
|
|
157384
|
+
return () => clearTimeout(timer);
|
|
157385
|
+
}, [hasEventHandler, hasSubscriptionsProp]);
|
|
156763
157386
|
React.useEffect(() => {
|
|
156764
157387
|
if (apikey && apikey.trim() !== "") {
|
|
156765
157388
|
setEncryptionSeed(apikey);
|