@blipit/react-native 0.5.0 → 0.6.0
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/BlipitReactNative.podspec +2 -2
- package/CHANGELOG.md +12 -0
- package/README.md +42 -2
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/blipit/reactnative/BlipitNuggetsModule.kt +36 -1
- package/dist/index.cjs +346 -31
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +351 -35
- package/ios/BlipitNuggets.m +4 -2
- package/ios/BlipitNuggets.swift +30 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6,10 +6,93 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import { AppState, Dimensions, Platform as Platform2 } from "react-native";
|
|
9
|
+
import { AppState, Dimensions as Dimensions2, Platform as Platform2 } from "react-native";
|
|
10
|
+
|
|
11
|
+
// src/mismatch.ts
|
|
12
|
+
var blocked = false;
|
|
13
|
+
async function checkPlatformMismatch(res) {
|
|
14
|
+
if (res.status !== 409) return false;
|
|
15
|
+
let body = null;
|
|
16
|
+
try {
|
|
17
|
+
body = JSON.parse(await (typeof res.clone === "function" ? res.clone() : res).text());
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
if (body?.reason !== "platform_mismatch") return false;
|
|
21
|
+
if (!blocked) {
|
|
22
|
+
blocked = true;
|
|
23
|
+
const message = typeof body.error === "string" ? body.error : "This key belongs to a Blipit project for another platform.";
|
|
24
|
+
console.error(`[blipit] BLIPIT IS NOT SENDING: ${message} Nothing more is sent with this key until the app restarts.`);
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
function guardPlatform(fetcher) {
|
|
29
|
+
return (async (...args) => {
|
|
30
|
+
if (blocked) return new Response(null, { status: 409 });
|
|
31
|
+
const res = await fetcher(...args);
|
|
32
|
+
await checkPlatformMismatch(res);
|
|
33
|
+
return res;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/triggers.ts
|
|
38
|
+
var TRIGGERS = ["shake", "screenshot", "two_finger", "crash"];
|
|
39
|
+
var PICKER_MAX = 3;
|
|
40
|
+
var PICKER_SIDE = 480;
|
|
41
|
+
var PICKER_SETTLE_MS = 700;
|
|
42
|
+
var PICKER_IDLE_MS = 18e4;
|
|
43
|
+
var isTrigger = (v) => typeof v === "string" && TRIGGERS.includes(v);
|
|
44
|
+
function createDebounce(gapMs = 1500, now = Date.now) {
|
|
45
|
+
let last = -Infinity;
|
|
46
|
+
return {
|
|
47
|
+
allow(open2) {
|
|
48
|
+
const t = now();
|
|
49
|
+
if (open2 || t - last < gapMs) return false;
|
|
50
|
+
last = t;
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var parseReportButton = (json2) => !!json2 && typeof json2 === "object" && json2.report_button === true;
|
|
56
|
+
function userHeaders(user) {
|
|
57
|
+
const out = {};
|
|
58
|
+
if (user?.id) out["X-Blipit-User-Id"] = user.id;
|
|
59
|
+
if (user?.email) out["X-Blipit-User-Email"] = user.email;
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
function pickerSize(width, height, side = PICKER_SIDE) {
|
|
63
|
+
const scale = Math.min(1, side / Math.max(width, height, 1));
|
|
64
|
+
return { width: Math.max(1, Math.round(width * scale)), height: Math.max(1, Math.round(height * scale)) };
|
|
65
|
+
}
|
|
66
|
+
var ScreenShots = class {
|
|
67
|
+
items = [];
|
|
68
|
+
hiddenAt = 0;
|
|
69
|
+
add(shot) {
|
|
70
|
+
this.items = [shot, ...this.items.filter((s2) => s2.name !== shot.name)].slice(0, PICKER_MAX);
|
|
71
|
+
}
|
|
72
|
+
list(except) {
|
|
73
|
+
return this.items.filter((s2) => s2.name !== except);
|
|
74
|
+
}
|
|
75
|
+
clear() {
|
|
76
|
+
this.items = [];
|
|
77
|
+
}
|
|
78
|
+
background(at) {
|
|
79
|
+
this.hiddenAt = at;
|
|
80
|
+
}
|
|
81
|
+
foreground(at) {
|
|
82
|
+
if (this.hiddenAt && at - this.hiddenAt >= PICKER_IDLE_MS) this.clear();
|
|
83
|
+
this.hiddenAt = 0;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
function lastFatal(queue) {
|
|
87
|
+
for (let i = queue.length - 1; i >= 0; i--) {
|
|
88
|
+
const e = queue[i];
|
|
89
|
+
if (e?.level === "fatal" && e.exception?.handled === false && typeof e.event_id === "string" && /^[0-9a-f]{32}$/.test(e.event_id)) return e.event_id;
|
|
90
|
+
}
|
|
91
|
+
return void 0;
|
|
92
|
+
}
|
|
10
93
|
|
|
11
94
|
// src/nuggets.ts
|
|
12
|
-
var VERSION = "0.
|
|
95
|
+
var VERSION = "0.6.0";
|
|
13
96
|
var SDK_NAME = "@blipit/react-native";
|
|
14
97
|
var DEFAULT_ENDPOINT = "https://in.blipit.io";
|
|
15
98
|
var CATEGORIES = /* @__PURE__ */ new Set(["ui.click", "ui.input", "navigation", "http", "console", "query", "custom"]);
|
|
@@ -53,6 +136,7 @@ var Nuggets = class {
|
|
|
53
136
|
user;
|
|
54
137
|
tags = {};
|
|
55
138
|
lastEventId;
|
|
139
|
+
crashId;
|
|
56
140
|
enabled;
|
|
57
141
|
onError;
|
|
58
142
|
crumbs = [];
|
|
@@ -69,13 +153,14 @@ var Nuggets = class {
|
|
|
69
153
|
this.endpoint = (options.endpoint ?? DEFAULT_ENDPOINT).replace(/\/api\/v1\/events.*$/, "").replace(/\/+$/, "");
|
|
70
154
|
this.key = options.key;
|
|
71
155
|
this.enabled = options.enabled !== false;
|
|
72
|
-
this.fetcher = options.fetch ?? ((...a) => fetch(...a));
|
|
156
|
+
this.fetcher = guardPlatform(options.fetch ?? ((...a) => fetch(...a)));
|
|
73
157
|
this.now = options.now ?? Date.now;
|
|
74
158
|
try {
|
|
75
159
|
const saved = JSON.parse(options.store?.load() ?? "[]");
|
|
76
160
|
if (Array.isArray(saved)) this.queue = saved.slice(-QUEUE_MAX);
|
|
77
161
|
} catch {
|
|
78
162
|
}
|
|
163
|
+
this.crashId = lastFatal(this.queue);
|
|
79
164
|
}
|
|
80
165
|
get pending() {
|
|
81
166
|
return this.queue.length;
|
|
@@ -306,11 +391,11 @@ function instrument(core2, g = globalThis) {
|
|
|
306
391
|
}
|
|
307
392
|
const proto = g.XMLHttpRequest?.prototype;
|
|
308
393
|
if (proto?.open && proto.send) {
|
|
309
|
-
const
|
|
394
|
+
const open2 = proto.open;
|
|
310
395
|
const send = proto.send;
|
|
311
396
|
proto.open = function(method, url, ...rest) {
|
|
312
397
|
this._blipit = [String(method).toUpperCase(), String(url)];
|
|
313
|
-
return
|
|
398
|
+
return open2.call(this, method, url, ...rest);
|
|
314
399
|
};
|
|
315
400
|
proto.send = function(...args) {
|
|
316
401
|
const meta = this._blipit;
|
|
@@ -352,7 +437,17 @@ function json(v) {
|
|
|
352
437
|
}
|
|
353
438
|
|
|
354
439
|
// src/native.ts
|
|
355
|
-
import { NativeModules } from "react-native";
|
|
440
|
+
import { NativeEventEmitter, NativeModules } from "react-native";
|
|
441
|
+
function onNativeTrigger(handle) {
|
|
442
|
+
const b = bridge();
|
|
443
|
+
if (!b) return void 0;
|
|
444
|
+
try {
|
|
445
|
+
const sub = new NativeEventEmitter(b).addListener("BlipitReportTrigger", (e) => handle(e?.trigger, e?.crashId));
|
|
446
|
+
return () => sub.remove();
|
|
447
|
+
} catch {
|
|
448
|
+
return void 0;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
356
451
|
var bridge = () => NativeModules.BlipitNuggets;
|
|
357
452
|
function nativeInfo() {
|
|
358
453
|
const b = bridge();
|
|
@@ -444,7 +539,15 @@ var REPORT_STRINGS = {
|
|
|
444
539
|
"recError": "The recording could not be made. You can still send the report.",
|
|
445
540
|
"uploadingVideo": "Uploading recording\u2026",
|
|
446
541
|
"close": "Close",
|
|
447
|
-
"noShot": "The screenshot could not be taken. You can still send the report."
|
|
542
|
+
"noShot": "The screenshot could not be taken. You can still send the report.",
|
|
543
|
+
"shotAsk": "Report a bug with this screen?",
|
|
544
|
+
"report": "Report",
|
|
545
|
+
"notNow": "Not now",
|
|
546
|
+
"crashAsk": "The app closed unexpectedly. Tell us what you were doing?",
|
|
547
|
+
"tellUs": "Tell us",
|
|
548
|
+
"pickTitle": "Which screen is the bug on?",
|
|
549
|
+
"pickNow": "Current screen",
|
|
550
|
+
"pickBefore": "Earlier screen"
|
|
448
551
|
},
|
|
449
552
|
"ar": {
|
|
450
553
|
"title": "\u0627\u0644\u0625\u0628\u0644\u0627\u063A \u0639\u0646 \u062E\u0637\u0623",
|
|
@@ -477,7 +580,15 @@ var REPORT_STRINGS = {
|
|
|
477
580
|
"recError": "\u062A\u0639\u0630\u0651\u0631 \u0625\u0646\u0634\u0627\u0621 \u0627\u0644\u062A\u0633\u062C\u064A\u0644. \u0644\u0627 \u064A\u0632\u0627\u0644 \u0628\u0625\u0645\u0643\u0627\u0646\u0643 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0644\u0627\u063A.",
|
|
478
581
|
"uploadingVideo": "\u062C\u0627\u0631\u064D \u0631\u0641\u0639 \u0627\u0644\u062A\u0633\u062C\u064A\u0644\u2026",
|
|
479
582
|
"close": "\u0625\u063A\u0644\u0627\u0642",
|
|
480
|
-
"noShot": "\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u062A\u0642\u0627\u0637 \u0644\u0642\u0637\u0629 \u0627\u0644\u0634\u0627\u0634\u0629. \u0644\u0627 \u064A\u0632\u0627\u0644 \u0628\u0625\u0645\u0643\u0627\u0646\u0643 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0644\u0627\u063A."
|
|
583
|
+
"noShot": "\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u062A\u0642\u0627\u0637 \u0644\u0642\u0637\u0629 \u0627\u0644\u0634\u0627\u0634\u0629. \u0644\u0627 \u064A\u0632\u0627\u0644 \u0628\u0625\u0645\u0643\u0627\u0646\u0643 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0644\u0627\u063A.",
|
|
584
|
+
"shotAsk": "\u0647\u0644 \u062A\u0631\u064A\u062F \u0627\u0644\u0625\u0628\u0644\u0627\u063A \u0639\u0646 \u062E\u0637\u0623 \u0641\u064A \u0647\u0630\u0647 \u0627\u0644\u0634\u0627\u0634\u0629\u061F",
|
|
585
|
+
"report": "\u0625\u0628\u0644\u0627\u063A",
|
|
586
|
+
"notNow": "\u0644\u064A\u0633 \u0627\u0644\u0622\u0646",
|
|
587
|
+
"crashAsk": "\u0623\u064F\u063A\u0644\u0642 \u0627\u0644\u062A\u0637\u0628\u064A\u0642 \u0628\u0634\u0643\u0644 \u063A\u064A\u0631 \u0645\u062A\u0648\u0642\u0639. \u0623\u062E\u0628\u0631\u0646\u0627 \u0628\u0645\u0627 \u0643\u0646\u062A \u062A\u0641\u0639\u0644\u0647\u061F",
|
|
588
|
+
"tellUs": "\u0623\u062E\u0628\u0631\u0646\u0627",
|
|
589
|
+
"pickTitle": "\u0641\u064A \u0623\u064A \u0634\u0627\u0634\u0629 \u064A\u0638\u0647\u0631 \u0627\u0644\u062E\u0637\u0623\u061F",
|
|
590
|
+
"pickNow": "\u0627\u0644\u0634\u0627\u0634\u0629 \u0627\u0644\u062D\u0627\u0644\u064A\u0629",
|
|
591
|
+
"pickBefore": "\u0634\u0627\u0634\u0629 \u0633\u0627\u0628\u0642\u0629"
|
|
481
592
|
},
|
|
482
593
|
"de": {
|
|
483
594
|
"title": "Fehler melden",
|
|
@@ -510,7 +621,15 @@ var REPORT_STRINGS = {
|
|
|
510
621
|
"recError": "Die Aufnahme konnte nicht erstellt werden. Sie k\xF6nnen den Bericht trotzdem senden.",
|
|
511
622
|
"uploadingVideo": "Aufnahme wird hochgeladen\u2026",
|
|
512
623
|
"close": "Schlie\xDFen",
|
|
513
|
-
"noShot": "Der Screenshot konnte nicht erstellt werden. Sie k\xF6nnen die Meldung trotzdem senden."
|
|
624
|
+
"noShot": "Der Screenshot konnte nicht erstellt werden. Sie k\xF6nnen die Meldung trotzdem senden.",
|
|
625
|
+
"shotAsk": "Einen Fehler mit diesem Bildschirm melden?",
|
|
626
|
+
"report": "Melden",
|
|
627
|
+
"notNow": "Nicht jetzt",
|
|
628
|
+
"crashAsk": "Die App wurde unerwartet beendet. M\xF6chten Sie uns sagen, was Sie gerade getan haben?",
|
|
629
|
+
"tellUs": "Erz\xE4hlen",
|
|
630
|
+
"pickTitle": "Auf welchem Bildschirm ist der Fehler?",
|
|
631
|
+
"pickNow": "Aktueller Bildschirm",
|
|
632
|
+
"pickBefore": "Fr\xFCherer Bildschirm"
|
|
514
633
|
},
|
|
515
634
|
"es": {
|
|
516
635
|
"title": "Reportar un error",
|
|
@@ -543,7 +662,15 @@ var REPORT_STRINGS = {
|
|
|
543
662
|
"recError": "No se pudo hacer la grabaci\xF3n. A\xFAn puedes enviar el informe.",
|
|
544
663
|
"uploadingVideo": "Subiendo grabaci\xF3n\u2026",
|
|
545
664
|
"close": "Cerrar",
|
|
546
|
-
"noShot": "No se pudo tomar la captura. Aun as\xED puedes enviar el reporte."
|
|
665
|
+
"noShot": "No se pudo tomar la captura. Aun as\xED puedes enviar el reporte.",
|
|
666
|
+
"shotAsk": "\xBFInformar de un error con esta pantalla?",
|
|
667
|
+
"report": "Informar",
|
|
668
|
+
"notNow": "Ahora no",
|
|
669
|
+
"crashAsk": "La aplicaci\xF3n se cerr\xF3 inesperadamente. \xBFNos cuenta qu\xE9 estaba haciendo?",
|
|
670
|
+
"tellUs": "Contarlo",
|
|
671
|
+
"pickTitle": "\xBFEn qu\xE9 pantalla est\xE1 el error?",
|
|
672
|
+
"pickNow": "Pantalla actual",
|
|
673
|
+
"pickBefore": "Pantalla anterior"
|
|
547
674
|
},
|
|
548
675
|
"fr": {
|
|
549
676
|
"title": "Signaler un bug",
|
|
@@ -576,7 +703,15 @@ var REPORT_STRINGS = {
|
|
|
576
703
|
"recError": "L\u2019enregistrement n\u2019a pas pu \xEAtre effectu\xE9. Vous pouvez quand m\xEAme envoyer le rapport.",
|
|
577
704
|
"uploadingVideo": "Envoi de l\u2019enregistrement\u2026",
|
|
578
705
|
"close": "Fermer",
|
|
579
|
-
"noShot": "La capture d\u2019\xE9cran a \xE9chou\xE9. Vous pouvez quand m\xEAme envoyer le signalement."
|
|
706
|
+
"noShot": "La capture d\u2019\xE9cran a \xE9chou\xE9. Vous pouvez quand m\xEAme envoyer le signalement.",
|
|
707
|
+
"shotAsk": "Signaler un bug avec cet \xE9cran ?",
|
|
708
|
+
"report": "Signaler",
|
|
709
|
+
"notNow": "Plus tard",
|
|
710
|
+
"crashAsk": "L\u2019application s\u2019est ferm\xE9e de fa\xE7on inattendue. Dites-nous ce que vous faisiez ?",
|
|
711
|
+
"tellUs": "Raconter",
|
|
712
|
+
"pickTitle": "Sur quel \xE9cran se trouve le bug ?",
|
|
713
|
+
"pickNow": "\xC9cran actuel",
|
|
714
|
+
"pickBefore": "\xC9cran pr\xE9c\xE9dent"
|
|
580
715
|
},
|
|
581
716
|
"it": {
|
|
582
717
|
"title": "Segnala un bug",
|
|
@@ -609,7 +744,15 @@ var REPORT_STRINGS = {
|
|
|
609
744
|
"recError": "Non \xE8 stato possibile registrare. Puoi comunque inviare la segnalazione.",
|
|
610
745
|
"uploadingVideo": "Caricamento della registrazione\u2026",
|
|
611
746
|
"close": "Chiudi",
|
|
612
|
-
"noShot": "Non \xE8 stato possibile acquisire lo screenshot. Puoi comunque inviare la segnalazione."
|
|
747
|
+
"noShot": "Non \xE8 stato possibile acquisire lo screenshot. Puoi comunque inviare la segnalazione.",
|
|
748
|
+
"shotAsk": "Segnalare un bug con questa schermata?",
|
|
749
|
+
"report": "Segnala",
|
|
750
|
+
"notNow": "Non ora",
|
|
751
|
+
"crashAsk": "L\u2019app si \xE8 chiusa in modo imprevisto. Ci dice cosa stava facendo?",
|
|
752
|
+
"tellUs": "Racconta",
|
|
753
|
+
"pickTitle": "In quale schermata si trova il bug?",
|
|
754
|
+
"pickNow": "Schermata attuale",
|
|
755
|
+
"pickBefore": "Schermata precedente"
|
|
613
756
|
},
|
|
614
757
|
"ja": {
|
|
615
758
|
"title": "\u4E0D\u5177\u5408\u3092\u5831\u544A",
|
|
@@ -642,7 +785,15 @@ var REPORT_STRINGS = {
|
|
|
642
785
|
"recError": "\u9332\u753B\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30EC\u30DD\u30FC\u30C8\u306F\u305D\u306E\u307E\u307E\u9001\u4FE1\u3067\u304D\u307E\u3059\u3002",
|
|
643
786
|
"uploadingVideo": "\u9332\u753B\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u2026",
|
|
644
787
|
"close": "\u9589\u3058\u308B",
|
|
645
|
-
"noShot": "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u3092\u64AE\u5F71\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u5831\u544A\u306F\u3053\u306E\u307E\u307E\u9001\u4FE1\u3067\u304D\u307E\u3059\u3002"
|
|
788
|
+
"noShot": "\u30B9\u30AF\u30EA\u30FC\u30F3\u30B7\u30E7\u30C3\u30C8\u3092\u64AE\u5F71\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u5831\u544A\u306F\u3053\u306E\u307E\u307E\u9001\u4FE1\u3067\u304D\u307E\u3059\u3002",
|
|
789
|
+
"shotAsk": "\u3053\u306E\u753B\u9762\u3067\u4E0D\u5177\u5408\u3092\u5831\u544A\u3057\u307E\u3059\u304B\uFF1F",
|
|
790
|
+
"report": "\u5831\u544A\u3059\u308B",
|
|
791
|
+
"notNow": "\u4ECA\u306F\u3057\u306A\u3044",
|
|
792
|
+
"crashAsk": "\u30A2\u30D7\u30EA\u304C\u4E88\u671F\u305B\u305A\u7D42\u4E86\u3057\u307E\u3057\u305F\u3002\u4F55\u3092\u3057\u3066\u3044\u305F\u304B\u6559\u3048\u3066\u3044\u305F\u3060\u3051\u307E\u3059\u304B\uFF1F",
|
|
793
|
+
"tellUs": "\u4F1D\u3048\u308B",
|
|
794
|
+
"pickTitle": "\u4E0D\u5177\u5408\u304C\u3042\u308B\u306E\u306F\u3069\u306E\u753B\u9762\u3067\u3059\u304B\uFF1F",
|
|
795
|
+
"pickNow": "\u73FE\u5728\u306E\u753B\u9762",
|
|
796
|
+
"pickBefore": "\u524D\u306E\u753B\u9762"
|
|
646
797
|
},
|
|
647
798
|
"nl": {
|
|
648
799
|
"title": "Bug melden",
|
|
@@ -675,7 +826,15 @@ var REPORT_STRINGS = {
|
|
|
675
826
|
"recError": "De opname kon niet worden gemaakt. Je kunt het rapport nog steeds versturen.",
|
|
676
827
|
"uploadingVideo": "Opname uploaden\u2026",
|
|
677
828
|
"close": "Sluiten",
|
|
678
|
-
"noShot": "De schermafbeelding kon niet worden gemaakt. Je kunt de melding toch versturen."
|
|
829
|
+
"noShot": "De schermafbeelding kon niet worden gemaakt. Je kunt de melding toch versturen.",
|
|
830
|
+
"shotAsk": "Een bug melden met dit scherm?",
|
|
831
|
+
"report": "Melden",
|
|
832
|
+
"notNow": "Niet nu",
|
|
833
|
+
"crashAsk": "De app is onverwacht gesloten. Vertelt u ons wat u aan het doen was?",
|
|
834
|
+
"tellUs": "Vertellen",
|
|
835
|
+
"pickTitle": "Op welk scherm zit de bug?",
|
|
836
|
+
"pickNow": "Huidig scherm",
|
|
837
|
+
"pickBefore": "Eerder scherm"
|
|
679
838
|
},
|
|
680
839
|
"pt": {
|
|
681
840
|
"title": "Reportar um erro",
|
|
@@ -708,7 +867,15 @@ var REPORT_STRINGS = {
|
|
|
708
867
|
"recError": "N\xE3o foi poss\xEDvel gravar. Voc\xEA ainda pode enviar o relat\xF3rio.",
|
|
709
868
|
"uploadingVideo": "Enviando grava\xE7\xE3o\u2026",
|
|
710
869
|
"close": "Fechar",
|
|
711
|
-
"noShot": "N\xE3o foi poss\xEDvel fazer a captura. Voc\xEA ainda pode enviar o relat\xF3rio."
|
|
870
|
+
"noShot": "N\xE3o foi poss\xEDvel fazer a captura. Voc\xEA ainda pode enviar o relat\xF3rio.",
|
|
871
|
+
"shotAsk": "Reportar um erro com esta tela?",
|
|
872
|
+
"report": "Reportar",
|
|
873
|
+
"notNow": "Agora n\xE3o",
|
|
874
|
+
"crashAsk": "O app fechou inesperadamente. Conte o que voc\xEA estava fazendo?",
|
|
875
|
+
"tellUs": "Contar",
|
|
876
|
+
"pickTitle": "Em qual tela est\xE1 o erro?",
|
|
877
|
+
"pickNow": "Tela atual",
|
|
878
|
+
"pickBefore": "Tela anterior"
|
|
712
879
|
},
|
|
713
880
|
"tr": {
|
|
714
881
|
"title": "Hata bildir",
|
|
@@ -741,7 +908,15 @@ var REPORT_STRINGS = {
|
|
|
741
908
|
"recError": "Kay\u0131t yap\u0131lamad\u0131. Raporu yine de g\xF6nderebilirsiniz.",
|
|
742
909
|
"uploadingVideo": "Kay\u0131t y\xFCkleniyor\u2026",
|
|
743
910
|
"close": "Kapat",
|
|
744
|
-
"noShot": "Ekran g\xF6r\xFCnt\xFCs\xFC al\u0131namad\u0131. Bildirimi yine de g\xF6nderebilirsiniz."
|
|
911
|
+
"noShot": "Ekran g\xF6r\xFCnt\xFCs\xFC al\u0131namad\u0131. Bildirimi yine de g\xF6nderebilirsiniz.",
|
|
912
|
+
"shotAsk": "Bu ekranla bir hata bildirilsin mi?",
|
|
913
|
+
"report": "Bildir",
|
|
914
|
+
"notNow": "\u015Eimdi de\u011Fil",
|
|
915
|
+
"crashAsk": "Uygulama beklenmedik \u015Fekilde kapand\u0131. Ne yapt\u0131\u011F\u0131n\u0131z\u0131 bize anlat\u0131r m\u0131s\u0131n\u0131z?",
|
|
916
|
+
"tellUs": "Anlat",
|
|
917
|
+
"pickTitle": "Hata hangi ekranda?",
|
|
918
|
+
"pickNow": "Ge\xE7erli ekran",
|
|
919
|
+
"pickBefore": "\xD6nceki ekran"
|
|
745
920
|
},
|
|
746
921
|
"zh": {
|
|
747
922
|
"title": "\u62A5\u544A\u95EE\u9898",
|
|
@@ -774,7 +949,15 @@ var REPORT_STRINGS = {
|
|
|
774
949
|
"recError": "\u65E0\u6CD5\u5B8C\u6210\u5F55\u5236\u3002\u4F60\u4ECD\u7136\u53EF\u4EE5\u53D1\u9001\u62A5\u544A\u3002",
|
|
775
950
|
"uploadingVideo": "\u6B63\u5728\u4E0A\u4F20\u5F55\u5236\u5185\u5BB9\u2026",
|
|
776
951
|
"close": "\u5173\u95ED",
|
|
777
|
-
"noShot": "\u65E0\u6CD5\u622A\u53D6\u5C4F\u5E55\u3002\u60A8\u4ECD\u7136\u53EF\u4EE5\u53D1\u9001\u62A5\u544A\u3002"
|
|
952
|
+
"noShot": "\u65E0\u6CD5\u622A\u53D6\u5C4F\u5E55\u3002\u60A8\u4ECD\u7136\u53EF\u4EE5\u53D1\u9001\u62A5\u544A\u3002",
|
|
953
|
+
"shotAsk": "\u8981\u7528\u6B64\u5C4F\u5E55\u62A5\u544A\u95EE\u9898\u5417\uFF1F",
|
|
954
|
+
"report": "\u62A5\u544A",
|
|
955
|
+
"notNow": "\u4EE5\u540E\u518D\u8BF4",
|
|
956
|
+
"crashAsk": "\u5E94\u7528\u610F\u5916\u5173\u95ED\u3002\u80FD\u544A\u8BC9\u6211\u4EEC\u4F60\u5F53\u65F6\u5728\u505A\u4EC0\u4E48\u5417\uFF1F",
|
|
957
|
+
"tellUs": "\u544A\u8BC9\u6211\u4EEC",
|
|
958
|
+
"pickTitle": "\u95EE\u9898\u51FA\u73B0\u5728\u54EA\u4E2A\u5C4F\u5E55\uFF1F",
|
|
959
|
+
"pickNow": "\u5F53\u524D\u5C4F\u5E55",
|
|
960
|
+
"pickBefore": "\u4E4B\u524D\u7684\u5C4F\u5E55"
|
|
778
961
|
}
|
|
779
962
|
};
|
|
780
963
|
|
|
@@ -815,6 +998,7 @@ function feedbackBody(input) {
|
|
|
815
998
|
};
|
|
816
999
|
if (input.title.trim()) body.title = input.title.trim();
|
|
817
1000
|
if (input.email?.trim()) body.email = input.email.trim();
|
|
1001
|
+
if (input.eventId && /^[0-9a-f]{32}$/.test(input.eventId)) body.event_id = input.eventId;
|
|
818
1002
|
if (input.image) {
|
|
819
1003
|
const list = annotations(input.shapes ?? [], input.image.width, input.image.height);
|
|
820
1004
|
if (list.length) body.annotations = [{ position: 0, shapes: list }];
|
|
@@ -828,7 +1012,7 @@ var ReportClient = class {
|
|
|
828
1012
|
constructor(endpoint, key, fetcher = (...a) => fetch(...a)) {
|
|
829
1013
|
this.endpoint = endpoint.replace(/\/+$/, "");
|
|
830
1014
|
this.key = key;
|
|
831
|
-
this.fetcher = fetcher;
|
|
1015
|
+
this.fetcher = guardPlatform(fetcher);
|
|
832
1016
|
}
|
|
833
1017
|
async call(path, init2) {
|
|
834
1018
|
const res = await this.fetcher(`${this.endpoint}${path}`, { ...init2, headers: { "X-Blipit-Key": this.key, ...init2.headers } });
|
|
@@ -836,8 +1020,8 @@ var ReportClient = class {
|
|
|
836
1020
|
if (!res.ok) throw new Error(`Blipit returned ${res.status}`);
|
|
837
1021
|
return text2;
|
|
838
1022
|
}
|
|
839
|
-
async settings() {
|
|
840
|
-
return JSON.parse(await this.call("/api/v1/feedback/settings", { method: "GET" }));
|
|
1023
|
+
async settings(user) {
|
|
1024
|
+
return JSON.parse(await this.call("/api/v1/feedback/settings", { method: "GET", headers: userHeaders(user) }));
|
|
841
1025
|
}
|
|
842
1026
|
async event(body) {
|
|
843
1027
|
const res = await this.fetcher(`${this.endpoint}/api/v1/events`, { method: "POST", headers: { "X-Blipit-Key": this.key, "Content-Type": "application/json" }, body: JSON.stringify(body) });
|
|
@@ -1031,6 +1215,7 @@ function createStuck(transport, info, clock = Date.now) {
|
|
|
1031
1215
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
1032
1216
|
import {
|
|
1033
1217
|
ActivityIndicator,
|
|
1218
|
+
Dimensions,
|
|
1034
1219
|
I18nManager,
|
|
1035
1220
|
Image,
|
|
1036
1221
|
KeyboardAvoidingView,
|
|
@@ -1050,13 +1235,46 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
1050
1235
|
var C = { navy: "#0B1A3A", card: "#1A2135", brand: "#3882F6", muted: "#98A6BE", mark: "#FF3B30", danger: "#FF7A6E", white: "#FFFFFF" };
|
|
1051
1236
|
var opener = null;
|
|
1052
1237
|
var config = null;
|
|
1053
|
-
|
|
1054
|
-
|
|
1238
|
+
var open = false;
|
|
1239
|
+
var serverButton = false;
|
|
1240
|
+
var onServerButton = null;
|
|
1241
|
+
var currentScreen;
|
|
1242
|
+
var settle;
|
|
1243
|
+
var debounce = createDebounce();
|
|
1244
|
+
var screens = new ScreenShots();
|
|
1245
|
+
function configureReporter(client, device, o = { picker: true }) {
|
|
1246
|
+
config = { client, device, picker: o.picker };
|
|
1247
|
+
if (!o.picker) screens.clear();
|
|
1055
1248
|
}
|
|
1056
1249
|
function showReport() {
|
|
1057
1250
|
if (!config) console.warn("[blipit] call Blipit.init before showReport");
|
|
1058
1251
|
else if (!opener) console.warn("[blipit] wrap your app in <BlipitReporter> to use showReport");
|
|
1059
|
-
else opener();
|
|
1252
|
+
else opener({ picker: config.picker, crashId: null });
|
|
1253
|
+
}
|
|
1254
|
+
function reportTrigger(trigger, crashId) {
|
|
1255
|
+
if (!config || !opener || !debounce.allow(open)) return;
|
|
1256
|
+
opener({ picker: false, crashId: trigger === "crash" ? crashId : null });
|
|
1257
|
+
}
|
|
1258
|
+
function setServerButton(on) {
|
|
1259
|
+
serverButton = on;
|
|
1260
|
+
onServerButton?.(on);
|
|
1261
|
+
}
|
|
1262
|
+
function noteScreen(name) {
|
|
1263
|
+
if (!name || !config?.picker) return;
|
|
1264
|
+
currentScreen = name;
|
|
1265
|
+
if (settle) clearTimeout(settle);
|
|
1266
|
+
settle = setTimeout(async () => {
|
|
1267
|
+
settle = void 0;
|
|
1268
|
+
const shooter = viewShot();
|
|
1269
|
+
if (open || !shooter || currentScreen !== name || !config?.picker) return;
|
|
1270
|
+
try {
|
|
1271
|
+
const { width, height } = Dimensions.get("window");
|
|
1272
|
+
const size = pickerSize(width, height);
|
|
1273
|
+
const uri = await shooter.captureScreen({ format: "jpg", quality: 0.6, result: "data-uri", ...size });
|
|
1274
|
+
if (!open && currentScreen === name && config?.picker) screens.add({ name, uri, ...size });
|
|
1275
|
+
} catch {
|
|
1276
|
+
}
|
|
1277
|
+
}, PICKER_SETTLE_MS);
|
|
1060
1278
|
}
|
|
1061
1279
|
function viewShot() {
|
|
1062
1280
|
try {
|
|
@@ -1079,19 +1297,32 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1079
1297
|
const [shot, setShot] = useState(null);
|
|
1080
1298
|
const [flat, setFlat] = useState(null);
|
|
1081
1299
|
const [notice, setNotice] = useState(null);
|
|
1300
|
+
const [wantPicker, setWantPicker] = useState(false);
|
|
1301
|
+
const [crashId, setCrashId] = useState(null);
|
|
1302
|
+
const [earlier, setEarlier] = useState([]);
|
|
1303
|
+
const [server, setServer] = useState(serverButton);
|
|
1082
1304
|
const shapes = useRef([]);
|
|
1083
1305
|
useEffect(() => {
|
|
1084
|
-
opener = () => {
|
|
1306
|
+
opener = (o) => {
|
|
1085
1307
|
shapes.current = [];
|
|
1086
1308
|
setShot(null);
|
|
1087
1309
|
setFlat(null);
|
|
1088
1310
|
setNotice(null);
|
|
1311
|
+
setEarlier([]);
|
|
1312
|
+
setWantPicker(o.picker);
|
|
1313
|
+
setCrashId(o.crashId);
|
|
1089
1314
|
setStage("choice");
|
|
1090
1315
|
};
|
|
1316
|
+
onServerButton = setServer;
|
|
1317
|
+
setServer(serverButton);
|
|
1091
1318
|
return () => {
|
|
1092
1319
|
opener = null;
|
|
1320
|
+
onServerButton = null;
|
|
1093
1321
|
};
|
|
1094
1322
|
}, []);
|
|
1323
|
+
useEffect(() => {
|
|
1324
|
+
open = stage !== "closed";
|
|
1325
|
+
}, [stage]);
|
|
1095
1326
|
const capture = async () => {
|
|
1096
1327
|
const shooter = viewShot();
|
|
1097
1328
|
setStage("closed");
|
|
@@ -1101,7 +1332,9 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1101
1332
|
const uri = await shooter.captureScreen({ format: "jpg", quality: 0.9, result: "tmpfile" });
|
|
1102
1333
|
const size = await new Promise((ok, fail) => Image.getSize(uri, (width, height) => ok({ width, height }), fail));
|
|
1103
1334
|
setShot({ uri, ...size });
|
|
1104
|
-
|
|
1335
|
+
const before = wantPicker ? screens.list(currentScreen) : [];
|
|
1336
|
+
setEarlier(before);
|
|
1337
|
+
setStage(before.length ? "pick" : "editor");
|
|
1105
1338
|
} catch (err) {
|
|
1106
1339
|
if (!shooter) console.warn("[blipit] install react-native-view-shot to attach screenshots to bug reports");
|
|
1107
1340
|
setNotice(t("noShot"));
|
|
@@ -1110,7 +1343,7 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1110
1343
|
};
|
|
1111
1344
|
return /* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
|
|
1112
1345
|
children,
|
|
1113
|
-
showButton && stage === "closed" ? /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: t("title"), onPress:
|
|
1346
|
+
(showButton || server) && stage === "closed" ? /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: t("title"), onPress: showReport, style: ({ pressed }) => [s.fab, pressed && { opacity: 0.85 }], children: [
|
|
1114
1347
|
/* @__PURE__ */ jsx(Text, { style: s.fabIcon, children: "!" }),
|
|
1115
1348
|
/* @__PURE__ */ jsx(Text, { style: s.fabText, children: t("title") })
|
|
1116
1349
|
] }) : null,
|
|
@@ -1133,6 +1366,28 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1133
1366
|
)
|
|
1134
1367
|
] })
|
|
1135
1368
|
] }) : null,
|
|
1369
|
+
stage === "pick" && shot ? /* @__PURE__ */ jsxs(View, { style: s.pad, children: [
|
|
1370
|
+
/* @__PURE__ */ jsx(Bar, { children: /* @__PURE__ */ jsx(BarButton, { label: t("mBack"), glyph: "\u2039", onPress: () => setStage("choice") }) }),
|
|
1371
|
+
/* @__PURE__ */ jsx(Text, { style: s.h1, children: t("pickTitle") }),
|
|
1372
|
+
/* @__PURE__ */ jsx(ScrollView, { contentContainerStyle: s.thumbs, children: [shot, ...earlier].map((item, i) => /* @__PURE__ */ jsxs(
|
|
1373
|
+
Pressable,
|
|
1374
|
+
{
|
|
1375
|
+
accessibilityRole: "button",
|
|
1376
|
+
accessibilityLabel: i === 0 ? t("pickNow") : t("pickBefore"),
|
|
1377
|
+
onPress: () => {
|
|
1378
|
+
setShot(item);
|
|
1379
|
+
setEarlier([]);
|
|
1380
|
+
setStage("editor");
|
|
1381
|
+
},
|
|
1382
|
+
style: ({ pressed }) => [s.thumb, pressed && { opacity: 0.85 }],
|
|
1383
|
+
children: [
|
|
1384
|
+
/* @__PURE__ */ jsx(Image, { source: { uri: item.uri }, style: [s.thumbImage, { aspectRatio: item.width / Math.max(1, item.height) }], resizeMode: "contain", accessibilityIgnoresInvertColors: true }),
|
|
1385
|
+
/* @__PURE__ */ jsx(Text, { style: s.thumbText, numberOfLines: 1, children: i === 0 ? t("pickNow") : t("pickBefore") })
|
|
1386
|
+
]
|
|
1387
|
+
},
|
|
1388
|
+
i
|
|
1389
|
+
)) })
|
|
1390
|
+
] }) : null,
|
|
1136
1391
|
stage === "editor" && shot ? /* @__PURE__ */ jsx(
|
|
1137
1392
|
Editor,
|
|
1138
1393
|
{
|
|
@@ -1155,6 +1410,7 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1155
1410
|
flat,
|
|
1156
1411
|
shapes: shapes.current,
|
|
1157
1412
|
notice,
|
|
1413
|
+
eventId: crashId,
|
|
1158
1414
|
onBack: () => setStage(shot ? "editor" : "choice"),
|
|
1159
1415
|
onDone: () => setStage("closed")
|
|
1160
1416
|
}
|
|
@@ -1284,7 +1540,7 @@ function Editor({ shot, shapes, t, onBack, onNext }) {
|
|
|
1284
1540
|
await new Promise((r) => setTimeout(r, 80));
|
|
1285
1541
|
let out = shot;
|
|
1286
1542
|
const shooter = viewShot();
|
|
1287
|
-
if (shapes.current.length && shooter && content.current) {
|
|
1543
|
+
if ((shapes.current.length || shot.uri.startsWith("data:")) && shooter && content.current) {
|
|
1288
1544
|
try {
|
|
1289
1545
|
const uri = await shooter.captureRef(content.current, { format: "jpg", quality: 0.85, result: "tmpfile" });
|
|
1290
1546
|
out = { uri, width: shot.width, height: shot.height };
|
|
@@ -1387,7 +1643,7 @@ function ToolButton({ label, glyph, on, onPress }) {
|
|
|
1387
1643
|
/* @__PURE__ */ jsx(Text, { style: [s.toolText, { color: on ? C.white : C.muted }], numberOfLines: 1, children: label })
|
|
1388
1644
|
] });
|
|
1389
1645
|
}
|
|
1390
|
-
function Details({ t, lang, shot, flat, shapes, notice, onBack, onDone }) {
|
|
1646
|
+
function Details({ t, lang, shot, flat, shapes, notice, eventId, onBack, onDone }) {
|
|
1391
1647
|
const [title, setTitle] = useState("");
|
|
1392
1648
|
const [message, setMessage] = useState("");
|
|
1393
1649
|
const [email, setEmail] = useState("");
|
|
@@ -1403,7 +1659,7 @@ function Details({ t, lang, shot, flat, shapes, notice, onBack, onDone }) {
|
|
|
1403
1659
|
setBusy(true);
|
|
1404
1660
|
setStatus({ text: t("sending"), error: false });
|
|
1405
1661
|
try {
|
|
1406
|
-
const receipt = await config.client.send(feedbackBody({ title, message: message.trim(), email, context: config.device(), shapes, image: shot, screenshots: image ? 1 : 0, locale: lang }));
|
|
1662
|
+
const receipt = await config.client.send(feedbackBody({ title, message: message.trim(), email, context: config.device(), shapes, image: shot, screenshots: image ? 1 : 0, locale: lang, eventId }));
|
|
1407
1663
|
let uploaded = true;
|
|
1408
1664
|
if (image) {
|
|
1409
1665
|
try {
|
|
@@ -1462,6 +1718,10 @@ var s = StyleSheet.create({
|
|
|
1462
1718
|
tool: { flex: 1, height: 60, alignItems: "center", justifyContent: "center", borderRadius: 12, marginHorizontal: 2 },
|
|
1463
1719
|
toolGlyph: { fontSize: 20 },
|
|
1464
1720
|
toolText: { fontSize: 11, marginTop: 2 },
|
|
1721
|
+
thumbs: { flexDirection: "row", flexWrap: "wrap", gap: 12, paddingVertical: 12 },
|
|
1722
|
+
thumb: { width: "47%", backgroundColor: C.card, borderRadius: 14, borderWidth: 1, borderColor: "rgba(255,255,255,0.1)", padding: 8, gap: 8 },
|
|
1723
|
+
thumbImage: { width: "100%", borderRadius: 8, backgroundColor: C.navy },
|
|
1724
|
+
thumbText: { color: C.white, fontSize: 14, fontWeight: "600", textAlign: "center" },
|
|
1465
1725
|
preview: { height: 150, borderRadius: 12, backgroundColor: C.card },
|
|
1466
1726
|
input: { backgroundColor: C.card, borderRadius: 12, color: C.white, fontSize: 16, paddingHorizontal: 14, paddingVertical: 12, minHeight: 48 },
|
|
1467
1727
|
fab: { position: "absolute", right: 16, bottom: 32, height: 48, borderRadius: 24, backgroundColor: C.brand, flexDirection: "row", alignItems: "center", paddingHorizontal: 18, elevation: 6, shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 10, shadowOffset: { width: 0, height: 4 } },
|
|
@@ -1477,7 +1737,7 @@ var core;
|
|
|
1477
1737
|
var session;
|
|
1478
1738
|
var appState;
|
|
1479
1739
|
function init(options) {
|
|
1480
|
-
const { key, publicKey, project, endpoint, waitForReady, ...rest } = options ?? {};
|
|
1740
|
+
const { key, publicKey, project, endpoint, waitForReady, shakeToReport, screenshotToReport, twoFingerReport, reportAfterCrash, screenPicker, ...rest } = options ?? {};
|
|
1481
1741
|
const k = (key ?? publicKey ?? "").trim();
|
|
1482
1742
|
if (!k) {
|
|
1483
1743
|
console.warn(MISSING_KEY);
|
|
@@ -1497,26 +1757,42 @@ function init(options) {
|
|
|
1497
1757
|
setBoundaryReporter((error) => c.captureException(error, false));
|
|
1498
1758
|
instrument(() => core);
|
|
1499
1759
|
const native = rest.enableNative !== false ? bridge() : void 0;
|
|
1760
|
+
if (native && !triggerOff) triggerOff = onNativeTrigger((trigger, crashId) => isTrigger(trigger) && reportTrigger(trigger, typeof crashId === "string" ? crashId : null));
|
|
1500
1761
|
try {
|
|
1501
|
-
native?.start(k, String(project), rest.environment ?? null, release ?? null, c.endpoint
|
|
1762
|
+
native?.start(k, String(project), rest.environment ?? null, release ?? null, c.endpoint, {
|
|
1763
|
+
shakeToReport: shakeToReport === true,
|
|
1764
|
+
screenshotToReport: screenshotToReport === true,
|
|
1765
|
+
twoFingerReport: twoFingerReport === true,
|
|
1766
|
+
reportAfterCrash: reportAfterCrash === true,
|
|
1767
|
+
screenPicker: false
|
|
1768
|
+
});
|
|
1502
1769
|
} catch {
|
|
1503
1770
|
}
|
|
1771
|
+
if (reportAfterCrash === true && c.crashId) {
|
|
1772
|
+
try {
|
|
1773
|
+
native?.promptAfterCrash?.(c.crashId);
|
|
1774
|
+
} catch {
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1504
1777
|
session = release && rest.autoSessionTracking !== false ? new Session(c, release, rest.environment ?? "production") : void 0;
|
|
1505
1778
|
c.onError = (unhandled) => session?.markError(unhandled);
|
|
1506
1779
|
if (c.enabled) session?.start();
|
|
1507
1780
|
appState = AppState?.addEventListener?.("change", (state) => {
|
|
1508
1781
|
if (state === "active") {
|
|
1782
|
+
screens.foreground(Date.now());
|
|
1509
1783
|
if (c.enabled) session?.start();
|
|
1510
1784
|
void c.flush();
|
|
1511
1785
|
} else if (state === "background") {
|
|
1786
|
+
screens.background(Date.now());
|
|
1512
1787
|
session?.end();
|
|
1513
1788
|
void c.flush();
|
|
1514
1789
|
}
|
|
1515
1790
|
});
|
|
1516
1791
|
void c.flush();
|
|
1517
1792
|
const reports = new ReportClient(base, k);
|
|
1518
|
-
configureReporter(reports, () => deviceContext(release));
|
|
1793
|
+
configureReporter(reports, () => deviceContext(release), { picker: screenPicker !== false });
|
|
1519
1794
|
reportClient = reports;
|
|
1795
|
+
refreshButton(0);
|
|
1520
1796
|
if (!stuck) {
|
|
1521
1797
|
stuck = createStuck(
|
|
1522
1798
|
{
|
|
@@ -1538,6 +1814,33 @@ function init(options) {
|
|
|
1538
1814
|
}
|
|
1539
1815
|
var stuck = null;
|
|
1540
1816
|
var reportClient;
|
|
1817
|
+
var triggerOff;
|
|
1818
|
+
var buttonTimer;
|
|
1819
|
+
var buttonBusy = false;
|
|
1820
|
+
var buttonAgain = false;
|
|
1821
|
+
function refreshButton(delay) {
|
|
1822
|
+
if (buttonTimer) clearTimeout(buttonTimer);
|
|
1823
|
+
buttonTimer = setTimeout(() => {
|
|
1824
|
+
buttonTimer = void 0;
|
|
1825
|
+
void fetchButton();
|
|
1826
|
+
}, delay);
|
|
1827
|
+
}
|
|
1828
|
+
async function fetchButton() {
|
|
1829
|
+
const client = reportClient;
|
|
1830
|
+
if (!client) return;
|
|
1831
|
+
if (buttonBusy) return void (buttonAgain = true);
|
|
1832
|
+
buttonBusy = true;
|
|
1833
|
+
try {
|
|
1834
|
+
setServerButton(parseReportButton(await client.settings(core?.user)));
|
|
1835
|
+
} catch {
|
|
1836
|
+
} finally {
|
|
1837
|
+
buttonBusy = false;
|
|
1838
|
+
if (buttonAgain) {
|
|
1839
|
+
buttonAgain = false;
|
|
1840
|
+
void fetchButton();
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1541
1844
|
function reportReady() {
|
|
1542
1845
|
stuck?.end(STARTUP);
|
|
1543
1846
|
}
|
|
@@ -1555,7 +1858,7 @@ function endFlow(name) {
|
|
|
1555
1858
|
if (flow) stuck?.end(flow);
|
|
1556
1859
|
}
|
|
1557
1860
|
function contexts(model, osVersion) {
|
|
1558
|
-
const { width, height } =
|
|
1861
|
+
const { width, height } = Dimensions2.get("window");
|
|
1559
1862
|
const engine = globalThis.HermesInternal ? "hermes" : "jsc";
|
|
1560
1863
|
const rn = Platform2.constants?.reactNativeVersion;
|
|
1561
1864
|
return {
|
|
@@ -1565,7 +1868,7 @@ function contexts(model, osVersion) {
|
|
|
1565
1868
|
};
|
|
1566
1869
|
}
|
|
1567
1870
|
function deviceContext(release) {
|
|
1568
|
-
const { width, height, scale } =
|
|
1871
|
+
const { width, height, scale } = Dimensions2.get("window");
|
|
1569
1872
|
let language = "";
|
|
1570
1873
|
let timezone = "";
|
|
1571
1874
|
try {
|
|
@@ -1603,6 +1906,7 @@ function setUser(user) {
|
|
|
1603
1906
|
bridge()?.setUser(u?.id ?? null, u?.email ?? null, u?.username ?? null);
|
|
1604
1907
|
} catch {
|
|
1605
1908
|
}
|
|
1909
|
+
refreshButton(1e3);
|
|
1606
1910
|
}
|
|
1607
1911
|
function setTag(key, value) {
|
|
1608
1912
|
core?.setTag(key, value);
|
|
@@ -1626,6 +1930,7 @@ async function flush(timeout = 2e3) {
|
|
|
1626
1930
|
function setEnabled(on) {
|
|
1627
1931
|
if (!core) return;
|
|
1628
1932
|
core.setEnabled(on);
|
|
1933
|
+
if (!on) screens.clear();
|
|
1629
1934
|
if (on) session?.start();
|
|
1630
1935
|
else session?.end();
|
|
1631
1936
|
}
|
|
@@ -1644,7 +1949,18 @@ function hasReplayConsent() {
|
|
|
1644
1949
|
return false;
|
|
1645
1950
|
}
|
|
1646
1951
|
}
|
|
1647
|
-
|
|
1952
|
+
function trackNavigation2(ref) {
|
|
1953
|
+
const stop = trackNavigation(() => core, ref);
|
|
1954
|
+
const seen = () => {
|
|
1955
|
+
if (core?.enabled) noteScreen(ref.getCurrentRoute()?.name);
|
|
1956
|
+
};
|
|
1957
|
+
seen();
|
|
1958
|
+
const off = ref.addListener("state", seen);
|
|
1959
|
+
return () => {
|
|
1960
|
+
stop();
|
|
1961
|
+
off();
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1648
1964
|
export {
|
|
1649
1965
|
BlipitReporter,
|
|
1650
1966
|
DEFAULT_ENDPOINT,
|