@blipit/react-native 0.5.0 → 0.6.1
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 +16 -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 +350 -34
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +355 -38
- package/ios/BlipitNuggets.m +4 -2
- package/ios/BlipitNuggets.swift +30 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -48,9 +48,93 @@ __export(index_exports, {
|
|
|
48
48
|
module.exports = __toCommonJS(index_exports);
|
|
49
49
|
var import_react_native3 = require("react-native");
|
|
50
50
|
|
|
51
|
+
// src/mismatch.ts
|
|
52
|
+
var blocked = false;
|
|
53
|
+
async function checkPlatformMismatch(res) {
|
|
54
|
+
if (res.status !== 409) return false;
|
|
55
|
+
let body = null;
|
|
56
|
+
try {
|
|
57
|
+
body = JSON.parse(await (typeof res.clone === "function" ? res.clone() : res).text());
|
|
58
|
+
} catch {
|
|
59
|
+
}
|
|
60
|
+
if (body?.reason !== "platform_mismatch") return false;
|
|
61
|
+
if (!blocked) {
|
|
62
|
+
blocked = true;
|
|
63
|
+
const message = typeof body.error === "string" ? body.error : "This key belongs to a Blipit project for another platform.";
|
|
64
|
+
console.error(`[blipit] BLIPIT IS NOT SENDING: ${message} Nothing more is sent with this key until the app restarts.`);
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
function guardPlatform(fetcher) {
|
|
69
|
+
return (async (...args) => {
|
|
70
|
+
if (blocked) return new Response(null, { status: 409 });
|
|
71
|
+
const res = await fetcher(...args);
|
|
72
|
+
await checkPlatformMismatch(res);
|
|
73
|
+
return res;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/triggers.ts
|
|
78
|
+
var TRIGGERS = ["shake", "screenshot", "two_finger", "crash"];
|
|
79
|
+
var PICKER_MAX = 3;
|
|
80
|
+
var PICKER_SIDE = 480;
|
|
81
|
+
var PICKER_SETTLE_MS = 700;
|
|
82
|
+
var PICKER_IDLE_MS = 18e4;
|
|
83
|
+
var isTrigger = (v) => typeof v === "string" && TRIGGERS.includes(v);
|
|
84
|
+
function createDebounce(gapMs = 1500, now = Date.now) {
|
|
85
|
+
let last = -Infinity;
|
|
86
|
+
return {
|
|
87
|
+
allow(open2) {
|
|
88
|
+
const t = now();
|
|
89
|
+
if (open2 || t - last < gapMs) return false;
|
|
90
|
+
last = t;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
var parseReportButton = (json2) => !!json2 && typeof json2 === "object" && json2.report_button === true;
|
|
96
|
+
function userHeaders(user) {
|
|
97
|
+
const out = {};
|
|
98
|
+
if (user?.id) out["X-Blipit-User-Id"] = user.id;
|
|
99
|
+
if (user?.email) out["X-Blipit-User-Email"] = user.email;
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
function pickerSize(width, height, side = PICKER_SIDE) {
|
|
103
|
+
const scale = Math.min(1, side / Math.max(width, height, 1));
|
|
104
|
+
return { width: Math.max(1, Math.round(width * scale)), height: Math.max(1, Math.round(height * scale)) };
|
|
105
|
+
}
|
|
106
|
+
var ScreenShots = class {
|
|
107
|
+
items = [];
|
|
108
|
+
hiddenAt = 0;
|
|
109
|
+
add(shot) {
|
|
110
|
+
this.items = [shot, ...this.items.filter((s2) => s2.name !== shot.name)].slice(0, PICKER_MAX);
|
|
111
|
+
}
|
|
112
|
+
list(except) {
|
|
113
|
+
return this.items.filter((s2) => s2.name !== except);
|
|
114
|
+
}
|
|
115
|
+
clear() {
|
|
116
|
+
this.items = [];
|
|
117
|
+
}
|
|
118
|
+
background(at) {
|
|
119
|
+
this.hiddenAt = at;
|
|
120
|
+
}
|
|
121
|
+
foreground(at) {
|
|
122
|
+
if (this.hiddenAt && at - this.hiddenAt >= PICKER_IDLE_MS) this.clear();
|
|
123
|
+
this.hiddenAt = 0;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
function lastFatal(queue) {
|
|
127
|
+
for (let i = queue.length - 1; i >= 0; i--) {
|
|
128
|
+
const e = queue[i];
|
|
129
|
+
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;
|
|
130
|
+
}
|
|
131
|
+
return void 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
51
134
|
// src/nuggets.ts
|
|
52
|
-
var VERSION = "0.
|
|
135
|
+
var VERSION = "0.6.1";
|
|
53
136
|
var SDK_NAME = "@blipit/react-native";
|
|
137
|
+
var SDK_HEADER = `${SDK_NAME}/${VERSION}`;
|
|
54
138
|
var DEFAULT_ENDPOINT = "https://in.blipit.io";
|
|
55
139
|
var CATEGORIES = /* @__PURE__ */ new Set(["ui.click", "ui.input", "navigation", "http", "console", "query", "custom"]);
|
|
56
140
|
var CRUMB_LEVELS = /* @__PURE__ */ new Set(["error", "warning", "info", "debug"]);
|
|
@@ -93,6 +177,7 @@ var Nuggets = class {
|
|
|
93
177
|
user;
|
|
94
178
|
tags = {};
|
|
95
179
|
lastEventId;
|
|
180
|
+
crashId;
|
|
96
181
|
enabled;
|
|
97
182
|
onError;
|
|
98
183
|
crumbs = [];
|
|
@@ -109,13 +194,14 @@ var Nuggets = class {
|
|
|
109
194
|
this.endpoint = (options.endpoint ?? DEFAULT_ENDPOINT).replace(/\/api\/v1\/events.*$/, "").replace(/\/+$/, "");
|
|
110
195
|
this.key = options.key;
|
|
111
196
|
this.enabled = options.enabled !== false;
|
|
112
|
-
this.fetcher = options.fetch ?? ((...a) => fetch(...a));
|
|
197
|
+
this.fetcher = guardPlatform(options.fetch ?? ((...a) => fetch(...a)));
|
|
113
198
|
this.now = options.now ?? Date.now;
|
|
114
199
|
try {
|
|
115
200
|
const saved = JSON.parse(options.store?.load() ?? "[]");
|
|
116
201
|
if (Array.isArray(saved)) this.queue = saved.slice(-QUEUE_MAX);
|
|
117
202
|
} catch {
|
|
118
203
|
}
|
|
204
|
+
this.crashId = lastFatal(this.queue);
|
|
119
205
|
}
|
|
120
206
|
get pending() {
|
|
121
207
|
return this.queue.length;
|
|
@@ -235,7 +321,7 @@ var Nuggets = class {
|
|
|
235
321
|
}
|
|
236
322
|
}
|
|
237
323
|
post(path, body) {
|
|
238
|
-
return this.fetcher(this.url(path), { method: "POST", headers: { "Content-Type": "application/json", "X-Blipit-Key": this.key }, body: JSON.stringify(body) });
|
|
324
|
+
return this.fetcher(this.url(path), { method: "POST", headers: { "Content-Type": "application/json", "X-Blipit-Key": this.key, "X-Blipit-Sdk": SDK_HEADER }, body: JSON.stringify(body) });
|
|
239
325
|
}
|
|
240
326
|
async send(event) {
|
|
241
327
|
try {
|
|
@@ -346,11 +432,11 @@ function instrument(core2, g = globalThis) {
|
|
|
346
432
|
}
|
|
347
433
|
const proto = g.XMLHttpRequest?.prototype;
|
|
348
434
|
if (proto?.open && proto.send) {
|
|
349
|
-
const
|
|
435
|
+
const open2 = proto.open;
|
|
350
436
|
const send = proto.send;
|
|
351
437
|
proto.open = function(method, url, ...rest) {
|
|
352
438
|
this._blipit = [String(method).toUpperCase(), String(url)];
|
|
353
|
-
return
|
|
439
|
+
return open2.call(this, method, url, ...rest);
|
|
354
440
|
};
|
|
355
441
|
proto.send = function(...args) {
|
|
356
442
|
const meta = this._blipit;
|
|
@@ -393,6 +479,16 @@ function json(v) {
|
|
|
393
479
|
|
|
394
480
|
// src/native.ts
|
|
395
481
|
var import_react_native = require("react-native");
|
|
482
|
+
function onNativeTrigger(handle) {
|
|
483
|
+
const b = bridge();
|
|
484
|
+
if (!b) return void 0;
|
|
485
|
+
try {
|
|
486
|
+
const sub = new import_react_native.NativeEventEmitter(b).addListener("BlipitReportTrigger", (e) => handle(e?.trigger, e?.crashId));
|
|
487
|
+
return () => sub.remove();
|
|
488
|
+
} catch {
|
|
489
|
+
return void 0;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
396
492
|
var bridge = () => import_react_native.NativeModules.BlipitNuggets;
|
|
397
493
|
function nativeInfo() {
|
|
398
494
|
const b = bridge();
|
|
@@ -484,7 +580,15 @@ var REPORT_STRINGS = {
|
|
|
484
580
|
"recError": "The recording could not be made. You can still send the report.",
|
|
485
581
|
"uploadingVideo": "Uploading recording\u2026",
|
|
486
582
|
"close": "Close",
|
|
487
|
-
"noShot": "The screenshot could not be taken. You can still send the report."
|
|
583
|
+
"noShot": "The screenshot could not be taken. You can still send the report.",
|
|
584
|
+
"shotAsk": "Report a bug with this screen?",
|
|
585
|
+
"report": "Report",
|
|
586
|
+
"notNow": "Not now",
|
|
587
|
+
"crashAsk": "The app closed unexpectedly. Tell us what you were doing?",
|
|
588
|
+
"tellUs": "Tell us",
|
|
589
|
+
"pickTitle": "Which screen is the bug on?",
|
|
590
|
+
"pickNow": "Current screen",
|
|
591
|
+
"pickBefore": "Earlier screen"
|
|
488
592
|
},
|
|
489
593
|
"ar": {
|
|
490
594
|
"title": "\u0627\u0644\u0625\u0628\u0644\u0627\u063A \u0639\u0646 \u062E\u0637\u0623",
|
|
@@ -517,7 +621,15 @@ var REPORT_STRINGS = {
|
|
|
517
621
|
"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.",
|
|
518
622
|
"uploadingVideo": "\u062C\u0627\u0631\u064D \u0631\u0641\u0639 \u0627\u0644\u062A\u0633\u062C\u064A\u0644\u2026",
|
|
519
623
|
"close": "\u0625\u063A\u0644\u0627\u0642",
|
|
520
|
-
"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."
|
|
624
|
+
"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.",
|
|
625
|
+
"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",
|
|
626
|
+
"report": "\u0625\u0628\u0644\u0627\u063A",
|
|
627
|
+
"notNow": "\u0644\u064A\u0633 \u0627\u0644\u0622\u0646",
|
|
628
|
+
"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",
|
|
629
|
+
"tellUs": "\u0623\u062E\u0628\u0631\u0646\u0627",
|
|
630
|
+
"pickTitle": "\u0641\u064A \u0623\u064A \u0634\u0627\u0634\u0629 \u064A\u0638\u0647\u0631 \u0627\u0644\u062E\u0637\u0623\u061F",
|
|
631
|
+
"pickNow": "\u0627\u0644\u0634\u0627\u0634\u0629 \u0627\u0644\u062D\u0627\u0644\u064A\u0629",
|
|
632
|
+
"pickBefore": "\u0634\u0627\u0634\u0629 \u0633\u0627\u0628\u0642\u0629"
|
|
521
633
|
},
|
|
522
634
|
"de": {
|
|
523
635
|
"title": "Fehler melden",
|
|
@@ -550,7 +662,15 @@ var REPORT_STRINGS = {
|
|
|
550
662
|
"recError": "Die Aufnahme konnte nicht erstellt werden. Sie k\xF6nnen den Bericht trotzdem senden.",
|
|
551
663
|
"uploadingVideo": "Aufnahme wird hochgeladen\u2026",
|
|
552
664
|
"close": "Schlie\xDFen",
|
|
553
|
-
"noShot": "Der Screenshot konnte nicht erstellt werden. Sie k\xF6nnen die Meldung trotzdem senden."
|
|
665
|
+
"noShot": "Der Screenshot konnte nicht erstellt werden. Sie k\xF6nnen die Meldung trotzdem senden.",
|
|
666
|
+
"shotAsk": "Einen Fehler mit diesem Bildschirm melden?",
|
|
667
|
+
"report": "Melden",
|
|
668
|
+
"notNow": "Nicht jetzt",
|
|
669
|
+
"crashAsk": "Die App wurde unerwartet beendet. M\xF6chten Sie uns sagen, was Sie gerade getan haben?",
|
|
670
|
+
"tellUs": "Erz\xE4hlen",
|
|
671
|
+
"pickTitle": "Auf welchem Bildschirm ist der Fehler?",
|
|
672
|
+
"pickNow": "Aktueller Bildschirm",
|
|
673
|
+
"pickBefore": "Fr\xFCherer Bildschirm"
|
|
554
674
|
},
|
|
555
675
|
"es": {
|
|
556
676
|
"title": "Reportar un error",
|
|
@@ -583,7 +703,15 @@ var REPORT_STRINGS = {
|
|
|
583
703
|
"recError": "No se pudo hacer la grabaci\xF3n. A\xFAn puedes enviar el informe.",
|
|
584
704
|
"uploadingVideo": "Subiendo grabaci\xF3n\u2026",
|
|
585
705
|
"close": "Cerrar",
|
|
586
|
-
"noShot": "No se pudo tomar la captura. Aun as\xED puedes enviar el reporte."
|
|
706
|
+
"noShot": "No se pudo tomar la captura. Aun as\xED puedes enviar el reporte.",
|
|
707
|
+
"shotAsk": "\xBFInformar de un error con esta pantalla?",
|
|
708
|
+
"report": "Informar",
|
|
709
|
+
"notNow": "Ahora no",
|
|
710
|
+
"crashAsk": "La aplicaci\xF3n se cerr\xF3 inesperadamente. \xBFNos cuenta qu\xE9 estaba haciendo?",
|
|
711
|
+
"tellUs": "Contarlo",
|
|
712
|
+
"pickTitle": "\xBFEn qu\xE9 pantalla est\xE1 el error?",
|
|
713
|
+
"pickNow": "Pantalla actual",
|
|
714
|
+
"pickBefore": "Pantalla anterior"
|
|
587
715
|
},
|
|
588
716
|
"fr": {
|
|
589
717
|
"title": "Signaler un bug",
|
|
@@ -616,7 +744,15 @@ var REPORT_STRINGS = {
|
|
|
616
744
|
"recError": "L\u2019enregistrement n\u2019a pas pu \xEAtre effectu\xE9. Vous pouvez quand m\xEAme envoyer le rapport.",
|
|
617
745
|
"uploadingVideo": "Envoi de l\u2019enregistrement\u2026",
|
|
618
746
|
"close": "Fermer",
|
|
619
|
-
"noShot": "La capture d\u2019\xE9cran a \xE9chou\xE9. Vous pouvez quand m\xEAme envoyer le signalement."
|
|
747
|
+
"noShot": "La capture d\u2019\xE9cran a \xE9chou\xE9. Vous pouvez quand m\xEAme envoyer le signalement.",
|
|
748
|
+
"shotAsk": "Signaler un bug avec cet \xE9cran ?",
|
|
749
|
+
"report": "Signaler",
|
|
750
|
+
"notNow": "Plus tard",
|
|
751
|
+
"crashAsk": "L\u2019application s\u2019est ferm\xE9e de fa\xE7on inattendue. Dites-nous ce que vous faisiez ?",
|
|
752
|
+
"tellUs": "Raconter",
|
|
753
|
+
"pickTitle": "Sur quel \xE9cran se trouve le bug ?",
|
|
754
|
+
"pickNow": "\xC9cran actuel",
|
|
755
|
+
"pickBefore": "\xC9cran pr\xE9c\xE9dent"
|
|
620
756
|
},
|
|
621
757
|
"it": {
|
|
622
758
|
"title": "Segnala un bug",
|
|
@@ -649,7 +785,15 @@ var REPORT_STRINGS = {
|
|
|
649
785
|
"recError": "Non \xE8 stato possibile registrare. Puoi comunque inviare la segnalazione.",
|
|
650
786
|
"uploadingVideo": "Caricamento della registrazione\u2026",
|
|
651
787
|
"close": "Chiudi",
|
|
652
|
-
"noShot": "Non \xE8 stato possibile acquisire lo screenshot. Puoi comunque inviare la segnalazione."
|
|
788
|
+
"noShot": "Non \xE8 stato possibile acquisire lo screenshot. Puoi comunque inviare la segnalazione.",
|
|
789
|
+
"shotAsk": "Segnalare un bug con questa schermata?",
|
|
790
|
+
"report": "Segnala",
|
|
791
|
+
"notNow": "Non ora",
|
|
792
|
+
"crashAsk": "L\u2019app si \xE8 chiusa in modo imprevisto. Ci dice cosa stava facendo?",
|
|
793
|
+
"tellUs": "Racconta",
|
|
794
|
+
"pickTitle": "In quale schermata si trova il bug?",
|
|
795
|
+
"pickNow": "Schermata attuale",
|
|
796
|
+
"pickBefore": "Schermata precedente"
|
|
653
797
|
},
|
|
654
798
|
"ja": {
|
|
655
799
|
"title": "\u4E0D\u5177\u5408\u3092\u5831\u544A",
|
|
@@ -682,7 +826,15 @@ var REPORT_STRINGS = {
|
|
|
682
826
|
"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",
|
|
683
827
|
"uploadingVideo": "\u9332\u753B\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u4E2D\u2026",
|
|
684
828
|
"close": "\u9589\u3058\u308B",
|
|
685
|
-
"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"
|
|
829
|
+
"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",
|
|
830
|
+
"shotAsk": "\u3053\u306E\u753B\u9762\u3067\u4E0D\u5177\u5408\u3092\u5831\u544A\u3057\u307E\u3059\u304B\uFF1F",
|
|
831
|
+
"report": "\u5831\u544A\u3059\u308B",
|
|
832
|
+
"notNow": "\u4ECA\u306F\u3057\u306A\u3044",
|
|
833
|
+
"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",
|
|
834
|
+
"tellUs": "\u4F1D\u3048\u308B",
|
|
835
|
+
"pickTitle": "\u4E0D\u5177\u5408\u304C\u3042\u308B\u306E\u306F\u3069\u306E\u753B\u9762\u3067\u3059\u304B\uFF1F",
|
|
836
|
+
"pickNow": "\u73FE\u5728\u306E\u753B\u9762",
|
|
837
|
+
"pickBefore": "\u524D\u306E\u753B\u9762"
|
|
686
838
|
},
|
|
687
839
|
"nl": {
|
|
688
840
|
"title": "Bug melden",
|
|
@@ -715,7 +867,15 @@ var REPORT_STRINGS = {
|
|
|
715
867
|
"recError": "De opname kon niet worden gemaakt. Je kunt het rapport nog steeds versturen.",
|
|
716
868
|
"uploadingVideo": "Opname uploaden\u2026",
|
|
717
869
|
"close": "Sluiten",
|
|
718
|
-
"noShot": "De schermafbeelding kon niet worden gemaakt. Je kunt de melding toch versturen."
|
|
870
|
+
"noShot": "De schermafbeelding kon niet worden gemaakt. Je kunt de melding toch versturen.",
|
|
871
|
+
"shotAsk": "Een bug melden met dit scherm?",
|
|
872
|
+
"report": "Melden",
|
|
873
|
+
"notNow": "Niet nu",
|
|
874
|
+
"crashAsk": "De app is onverwacht gesloten. Vertelt u ons wat u aan het doen was?",
|
|
875
|
+
"tellUs": "Vertellen",
|
|
876
|
+
"pickTitle": "Op welk scherm zit de bug?",
|
|
877
|
+
"pickNow": "Huidig scherm",
|
|
878
|
+
"pickBefore": "Eerder scherm"
|
|
719
879
|
},
|
|
720
880
|
"pt": {
|
|
721
881
|
"title": "Reportar um erro",
|
|
@@ -748,7 +908,15 @@ var REPORT_STRINGS = {
|
|
|
748
908
|
"recError": "N\xE3o foi poss\xEDvel gravar. Voc\xEA ainda pode enviar o relat\xF3rio.",
|
|
749
909
|
"uploadingVideo": "Enviando grava\xE7\xE3o\u2026",
|
|
750
910
|
"close": "Fechar",
|
|
751
|
-
"noShot": "N\xE3o foi poss\xEDvel fazer a captura. Voc\xEA ainda pode enviar o relat\xF3rio."
|
|
911
|
+
"noShot": "N\xE3o foi poss\xEDvel fazer a captura. Voc\xEA ainda pode enviar o relat\xF3rio.",
|
|
912
|
+
"shotAsk": "Reportar um erro com esta tela?",
|
|
913
|
+
"report": "Reportar",
|
|
914
|
+
"notNow": "Agora n\xE3o",
|
|
915
|
+
"crashAsk": "O app fechou inesperadamente. Conte o que voc\xEA estava fazendo?",
|
|
916
|
+
"tellUs": "Contar",
|
|
917
|
+
"pickTitle": "Em qual tela est\xE1 o erro?",
|
|
918
|
+
"pickNow": "Tela atual",
|
|
919
|
+
"pickBefore": "Tela anterior"
|
|
752
920
|
},
|
|
753
921
|
"tr": {
|
|
754
922
|
"title": "Hata bildir",
|
|
@@ -781,7 +949,15 @@ var REPORT_STRINGS = {
|
|
|
781
949
|
"recError": "Kay\u0131t yap\u0131lamad\u0131. Raporu yine de g\xF6nderebilirsiniz.",
|
|
782
950
|
"uploadingVideo": "Kay\u0131t y\xFCkleniyor\u2026",
|
|
783
951
|
"close": "Kapat",
|
|
784
|
-
"noShot": "Ekran g\xF6r\xFCnt\xFCs\xFC al\u0131namad\u0131. Bildirimi yine de g\xF6nderebilirsiniz."
|
|
952
|
+
"noShot": "Ekran g\xF6r\xFCnt\xFCs\xFC al\u0131namad\u0131. Bildirimi yine de g\xF6nderebilirsiniz.",
|
|
953
|
+
"shotAsk": "Bu ekranla bir hata bildirilsin mi?",
|
|
954
|
+
"report": "Bildir",
|
|
955
|
+
"notNow": "\u015Eimdi de\u011Fil",
|
|
956
|
+
"crashAsk": "Uygulama beklenmedik \u015Fekilde kapand\u0131. Ne yapt\u0131\u011F\u0131n\u0131z\u0131 bize anlat\u0131r m\u0131s\u0131n\u0131z?",
|
|
957
|
+
"tellUs": "Anlat",
|
|
958
|
+
"pickTitle": "Hata hangi ekranda?",
|
|
959
|
+
"pickNow": "Ge\xE7erli ekran",
|
|
960
|
+
"pickBefore": "\xD6nceki ekran"
|
|
785
961
|
},
|
|
786
962
|
"zh": {
|
|
787
963
|
"title": "\u62A5\u544A\u95EE\u9898",
|
|
@@ -814,7 +990,15 @@ var REPORT_STRINGS = {
|
|
|
814
990
|
"recError": "\u65E0\u6CD5\u5B8C\u6210\u5F55\u5236\u3002\u4F60\u4ECD\u7136\u53EF\u4EE5\u53D1\u9001\u62A5\u544A\u3002",
|
|
815
991
|
"uploadingVideo": "\u6B63\u5728\u4E0A\u4F20\u5F55\u5236\u5185\u5BB9\u2026",
|
|
816
992
|
"close": "\u5173\u95ED",
|
|
817
|
-
"noShot": "\u65E0\u6CD5\u622A\u53D6\u5C4F\u5E55\u3002\u60A8\u4ECD\u7136\u53EF\u4EE5\u53D1\u9001\u62A5\u544A\u3002"
|
|
993
|
+
"noShot": "\u65E0\u6CD5\u622A\u53D6\u5C4F\u5E55\u3002\u60A8\u4ECD\u7136\u53EF\u4EE5\u53D1\u9001\u62A5\u544A\u3002",
|
|
994
|
+
"shotAsk": "\u8981\u7528\u6B64\u5C4F\u5E55\u62A5\u544A\u95EE\u9898\u5417\uFF1F",
|
|
995
|
+
"report": "\u62A5\u544A",
|
|
996
|
+
"notNow": "\u4EE5\u540E\u518D\u8BF4",
|
|
997
|
+
"crashAsk": "\u5E94\u7528\u610F\u5916\u5173\u95ED\u3002\u80FD\u544A\u8BC9\u6211\u4EEC\u4F60\u5F53\u65F6\u5728\u505A\u4EC0\u4E48\u5417\uFF1F",
|
|
998
|
+
"tellUs": "\u544A\u8BC9\u6211\u4EEC",
|
|
999
|
+
"pickTitle": "\u95EE\u9898\u51FA\u73B0\u5728\u54EA\u4E2A\u5C4F\u5E55\uFF1F",
|
|
1000
|
+
"pickNow": "\u5F53\u524D\u5C4F\u5E55",
|
|
1001
|
+
"pickBefore": "\u4E4B\u524D\u7684\u5C4F\u5E55"
|
|
818
1002
|
}
|
|
819
1003
|
};
|
|
820
1004
|
|
|
@@ -855,6 +1039,7 @@ function feedbackBody(input) {
|
|
|
855
1039
|
};
|
|
856
1040
|
if (input.title.trim()) body.title = input.title.trim();
|
|
857
1041
|
if (input.email?.trim()) body.email = input.email.trim();
|
|
1042
|
+
if (input.eventId && /^[0-9a-f]{32}$/.test(input.eventId)) body.event_id = input.eventId;
|
|
858
1043
|
if (input.image) {
|
|
859
1044
|
const list = annotations(input.shapes ?? [], input.image.width, input.image.height);
|
|
860
1045
|
if (list.length) body.annotations = [{ position: 0, shapes: list }];
|
|
@@ -868,19 +1053,19 @@ var ReportClient = class {
|
|
|
868
1053
|
constructor(endpoint, key, fetcher = (...a) => fetch(...a)) {
|
|
869
1054
|
this.endpoint = endpoint.replace(/\/+$/, "");
|
|
870
1055
|
this.key = key;
|
|
871
|
-
this.fetcher = fetcher;
|
|
1056
|
+
this.fetcher = guardPlatform(fetcher);
|
|
872
1057
|
}
|
|
873
1058
|
async call(path, init2) {
|
|
874
|
-
const res = await this.fetcher(`${this.endpoint}${path}`, { ...init2, headers: { "X-Blipit-Key": this.key, ...init2.headers } });
|
|
1059
|
+
const res = await this.fetcher(`${this.endpoint}${path}`, { ...init2, headers: { "X-Blipit-Key": this.key, "X-Blipit-Sdk": SDK_HEADER, ...init2.headers } });
|
|
875
1060
|
const text2 = await res.text();
|
|
876
1061
|
if (!res.ok) throw new Error(`Blipit returned ${res.status}`);
|
|
877
1062
|
return text2;
|
|
878
1063
|
}
|
|
879
|
-
async settings() {
|
|
880
|
-
return JSON.parse(await this.call("/api/v1/feedback/settings", { method: "GET" }));
|
|
1064
|
+
async settings(user) {
|
|
1065
|
+
return JSON.parse(await this.call("/api/v1/feedback/settings", { method: "GET", headers: userHeaders(user) }));
|
|
881
1066
|
}
|
|
882
1067
|
async event(body) {
|
|
883
|
-
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) });
|
|
1068
|
+
const res = await this.fetcher(`${this.endpoint}/api/v1/events`, { method: "POST", headers: { "X-Blipit-Key": this.key, "X-Blipit-Sdk": SDK_HEADER, "Content-Type": "application/json" }, body: JSON.stringify(body) });
|
|
884
1069
|
return res.ok || res.status >= 400 && res.status < 500 && res.status !== 408 && res.status !== 429;
|
|
885
1070
|
}
|
|
886
1071
|
async send(body) {
|
|
@@ -1074,13 +1259,46 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
1074
1259
|
var C = { navy: "#0B1A3A", card: "#1A2135", brand: "#3882F6", muted: "#98A6BE", mark: "#FF3B30", danger: "#FF7A6E", white: "#FFFFFF" };
|
|
1075
1260
|
var opener = null;
|
|
1076
1261
|
var config = null;
|
|
1077
|
-
|
|
1078
|
-
|
|
1262
|
+
var open = false;
|
|
1263
|
+
var serverButton = false;
|
|
1264
|
+
var onServerButton = null;
|
|
1265
|
+
var currentScreen;
|
|
1266
|
+
var settle;
|
|
1267
|
+
var debounce = createDebounce();
|
|
1268
|
+
var screens = new ScreenShots();
|
|
1269
|
+
function configureReporter(client, device, o = { picker: true }) {
|
|
1270
|
+
config = { client, device, picker: o.picker };
|
|
1271
|
+
if (!o.picker) screens.clear();
|
|
1079
1272
|
}
|
|
1080
1273
|
function showReport() {
|
|
1081
1274
|
if (!config) console.warn("[blipit] call Blipit.init before showReport");
|
|
1082
1275
|
else if (!opener) console.warn("[blipit] wrap your app in <BlipitReporter> to use showReport");
|
|
1083
|
-
else opener();
|
|
1276
|
+
else opener({ picker: config.picker, crashId: null });
|
|
1277
|
+
}
|
|
1278
|
+
function reportTrigger(trigger, crashId) {
|
|
1279
|
+
if (!config || !opener || !debounce.allow(open)) return;
|
|
1280
|
+
opener({ picker: false, crashId: trigger === "crash" ? crashId : null });
|
|
1281
|
+
}
|
|
1282
|
+
function setServerButton(on) {
|
|
1283
|
+
serverButton = on;
|
|
1284
|
+
onServerButton?.(on);
|
|
1285
|
+
}
|
|
1286
|
+
function noteScreen(name) {
|
|
1287
|
+
if (!name || !config?.picker) return;
|
|
1288
|
+
currentScreen = name;
|
|
1289
|
+
if (settle) clearTimeout(settle);
|
|
1290
|
+
settle = setTimeout(async () => {
|
|
1291
|
+
settle = void 0;
|
|
1292
|
+
const shooter = viewShot();
|
|
1293
|
+
if (open || !shooter || currentScreen !== name || !config?.picker) return;
|
|
1294
|
+
try {
|
|
1295
|
+
const { width, height } = import_react_native2.Dimensions.get("window");
|
|
1296
|
+
const size = pickerSize(width, height);
|
|
1297
|
+
const uri = await shooter.captureScreen({ format: "jpg", quality: 0.6, result: "data-uri", ...size });
|
|
1298
|
+
if (!open && currentScreen === name && config?.picker) screens.add({ name, uri, ...size });
|
|
1299
|
+
} catch {
|
|
1300
|
+
}
|
|
1301
|
+
}, PICKER_SETTLE_MS);
|
|
1084
1302
|
}
|
|
1085
1303
|
function viewShot() {
|
|
1086
1304
|
try {
|
|
@@ -1103,19 +1321,32 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1103
1321
|
const [shot, setShot] = (0, import_react2.useState)(null);
|
|
1104
1322
|
const [flat, setFlat] = (0, import_react2.useState)(null);
|
|
1105
1323
|
const [notice, setNotice] = (0, import_react2.useState)(null);
|
|
1324
|
+
const [wantPicker, setWantPicker] = (0, import_react2.useState)(false);
|
|
1325
|
+
const [crashId, setCrashId] = (0, import_react2.useState)(null);
|
|
1326
|
+
const [earlier, setEarlier] = (0, import_react2.useState)([]);
|
|
1327
|
+
const [server, setServer] = (0, import_react2.useState)(serverButton);
|
|
1106
1328
|
const shapes = (0, import_react2.useRef)([]);
|
|
1107
1329
|
(0, import_react2.useEffect)(() => {
|
|
1108
|
-
opener = () => {
|
|
1330
|
+
opener = (o) => {
|
|
1109
1331
|
shapes.current = [];
|
|
1110
1332
|
setShot(null);
|
|
1111
1333
|
setFlat(null);
|
|
1112
1334
|
setNotice(null);
|
|
1335
|
+
setEarlier([]);
|
|
1336
|
+
setWantPicker(o.picker);
|
|
1337
|
+
setCrashId(o.crashId);
|
|
1113
1338
|
setStage("choice");
|
|
1114
1339
|
};
|
|
1340
|
+
onServerButton = setServer;
|
|
1341
|
+
setServer(serverButton);
|
|
1115
1342
|
return () => {
|
|
1116
1343
|
opener = null;
|
|
1344
|
+
onServerButton = null;
|
|
1117
1345
|
};
|
|
1118
1346
|
}, []);
|
|
1347
|
+
(0, import_react2.useEffect)(() => {
|
|
1348
|
+
open = stage !== "closed";
|
|
1349
|
+
}, [stage]);
|
|
1119
1350
|
const capture = async () => {
|
|
1120
1351
|
const shooter = viewShot();
|
|
1121
1352
|
setStage("closed");
|
|
@@ -1125,7 +1356,9 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1125
1356
|
const uri = await shooter.captureScreen({ format: "jpg", quality: 0.9, result: "tmpfile" });
|
|
1126
1357
|
const size = await new Promise((ok, fail) => import_react_native2.Image.getSize(uri, (width, height) => ok({ width, height }), fail));
|
|
1127
1358
|
setShot({ uri, ...size });
|
|
1128
|
-
|
|
1359
|
+
const before = wantPicker ? screens.list(currentScreen) : [];
|
|
1360
|
+
setEarlier(before);
|
|
1361
|
+
setStage(before.length ? "pick" : "editor");
|
|
1129
1362
|
} catch (err) {
|
|
1130
1363
|
if (!shooter) console.warn("[blipit] install react-native-view-shot to attach screenshots to bug reports");
|
|
1131
1364
|
setNotice(t("noShot"));
|
|
@@ -1134,7 +1367,7 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1134
1367
|
};
|
|
1135
1368
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native2.View, { style: { flex: 1 }, children: [
|
|
1136
1369
|
children,
|
|
1137
|
-
showButton && stage === "closed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native2.Pressable, { accessibilityRole: "button", accessibilityLabel: t("title"), onPress:
|
|
1370
|
+
(showButton || server) && stage === "closed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native2.Pressable, { accessibilityRole: "button", accessibilityLabel: t("title"), onPress: showReport, style: ({ pressed }) => [s.fab, pressed && { opacity: 0.85 }], children: [
|
|
1138
1371
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { style: s.fabIcon, children: "!" }),
|
|
1139
1372
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { style: s.fabText, children: t("title") })
|
|
1140
1373
|
] }) : null,
|
|
@@ -1157,6 +1390,28 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1157
1390
|
)
|
|
1158
1391
|
] })
|
|
1159
1392
|
] }) : null,
|
|
1393
|
+
stage === "pick" && shot ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native2.View, { style: s.pad, children: [
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Bar, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BarButton, { label: t("mBack"), glyph: "\u2039", onPress: () => setStage("choice") }) }),
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { style: s.h1, children: t("pickTitle") }),
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.ScrollView, { contentContainerStyle: s.thumbs, children: [shot, ...earlier].map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1397
|
+
import_react_native2.Pressable,
|
|
1398
|
+
{
|
|
1399
|
+
accessibilityRole: "button",
|
|
1400
|
+
accessibilityLabel: i === 0 ? t("pickNow") : t("pickBefore"),
|
|
1401
|
+
onPress: () => {
|
|
1402
|
+
setShot(item);
|
|
1403
|
+
setEarlier([]);
|
|
1404
|
+
setStage("editor");
|
|
1405
|
+
},
|
|
1406
|
+
style: ({ pressed }) => [s.thumb, pressed && { opacity: 0.85 }],
|
|
1407
|
+
children: [
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Image, { source: { uri: item.uri }, style: [s.thumbImage, { aspectRatio: item.width / Math.max(1, item.height) }], resizeMode: "contain", accessibilityIgnoresInvertColors: true }),
|
|
1409
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { style: s.thumbText, numberOfLines: 1, children: i === 0 ? t("pickNow") : t("pickBefore") })
|
|
1410
|
+
]
|
|
1411
|
+
},
|
|
1412
|
+
i
|
|
1413
|
+
)) })
|
|
1414
|
+
] }) : null,
|
|
1160
1415
|
stage === "editor" && shot ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1161
1416
|
Editor,
|
|
1162
1417
|
{
|
|
@@ -1179,6 +1434,7 @@ function BlipitReporter({ children, showButton = false }) {
|
|
|
1179
1434
|
flat,
|
|
1180
1435
|
shapes: shapes.current,
|
|
1181
1436
|
notice,
|
|
1437
|
+
eventId: crashId,
|
|
1182
1438
|
onBack: () => setStage(shot ? "editor" : "choice"),
|
|
1183
1439
|
onDone: () => setStage("closed")
|
|
1184
1440
|
}
|
|
@@ -1308,7 +1564,7 @@ function Editor({ shot, shapes, t, onBack, onNext }) {
|
|
|
1308
1564
|
await new Promise((r) => setTimeout(r, 80));
|
|
1309
1565
|
let out = shot;
|
|
1310
1566
|
const shooter = viewShot();
|
|
1311
|
-
if (shapes.current.length && shooter && content.current) {
|
|
1567
|
+
if ((shapes.current.length || shot.uri.startsWith("data:")) && shooter && content.current) {
|
|
1312
1568
|
try {
|
|
1313
1569
|
const uri = await shooter.captureRef(content.current, { format: "jpg", quality: 0.85, result: "tmpfile" });
|
|
1314
1570
|
out = { uri, width: shot.width, height: shot.height };
|
|
@@ -1411,7 +1667,7 @@ function ToolButton({ label, glyph, on, onPress }) {
|
|
|
1411
1667
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { style: [s.toolText, { color: on ? C.white : C.muted }], numberOfLines: 1, children: label })
|
|
1412
1668
|
] });
|
|
1413
1669
|
}
|
|
1414
|
-
function Details({ t, lang, shot, flat, shapes, notice, onBack, onDone }) {
|
|
1670
|
+
function Details({ t, lang, shot, flat, shapes, notice, eventId, onBack, onDone }) {
|
|
1415
1671
|
const [title, setTitle] = (0, import_react2.useState)("");
|
|
1416
1672
|
const [message, setMessage] = (0, import_react2.useState)("");
|
|
1417
1673
|
const [email, setEmail] = (0, import_react2.useState)("");
|
|
@@ -1427,7 +1683,7 @@ function Details({ t, lang, shot, flat, shapes, notice, onBack, onDone }) {
|
|
|
1427
1683
|
setBusy(true);
|
|
1428
1684
|
setStatus({ text: t("sending"), error: false });
|
|
1429
1685
|
try {
|
|
1430
|
-
const receipt = await config.client.send(feedbackBody({ title, message: message.trim(), email, context: config.device(), shapes, image: shot, screenshots: image ? 1 : 0, locale: lang }));
|
|
1686
|
+
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 }));
|
|
1431
1687
|
let uploaded = true;
|
|
1432
1688
|
if (image) {
|
|
1433
1689
|
try {
|
|
@@ -1486,6 +1742,10 @@ var s = import_react_native2.StyleSheet.create({
|
|
|
1486
1742
|
tool: { flex: 1, height: 60, alignItems: "center", justifyContent: "center", borderRadius: 12, marginHorizontal: 2 },
|
|
1487
1743
|
toolGlyph: { fontSize: 20 },
|
|
1488
1744
|
toolText: { fontSize: 11, marginTop: 2 },
|
|
1745
|
+
thumbs: { flexDirection: "row", flexWrap: "wrap", gap: 12, paddingVertical: 12 },
|
|
1746
|
+
thumb: { width: "47%", backgroundColor: C.card, borderRadius: 14, borderWidth: 1, borderColor: "rgba(255,255,255,0.1)", padding: 8, gap: 8 },
|
|
1747
|
+
thumbImage: { width: "100%", borderRadius: 8, backgroundColor: C.navy },
|
|
1748
|
+
thumbText: { color: C.white, fontSize: 14, fontWeight: "600", textAlign: "center" },
|
|
1489
1749
|
preview: { height: 150, borderRadius: 12, backgroundColor: C.card },
|
|
1490
1750
|
input: { backgroundColor: C.card, borderRadius: 12, color: C.white, fontSize: 16, paddingHorizontal: 14, paddingVertical: 12, minHeight: 48 },
|
|
1491
1751
|
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 } },
|
|
@@ -1501,7 +1761,7 @@ var core;
|
|
|
1501
1761
|
var session;
|
|
1502
1762
|
var appState;
|
|
1503
1763
|
function init(options) {
|
|
1504
|
-
const { key, publicKey, project, endpoint, waitForReady, ...rest } = options ?? {};
|
|
1764
|
+
const { key, publicKey, project, endpoint, waitForReady, shakeToReport, screenshotToReport, twoFingerReport, reportAfterCrash, screenPicker, ...rest } = options ?? {};
|
|
1505
1765
|
const k = (key ?? publicKey ?? "").trim();
|
|
1506
1766
|
if (!k) {
|
|
1507
1767
|
console.warn(MISSING_KEY);
|
|
@@ -1521,26 +1781,42 @@ function init(options) {
|
|
|
1521
1781
|
setBoundaryReporter((error) => c.captureException(error, false));
|
|
1522
1782
|
instrument(() => core);
|
|
1523
1783
|
const native = rest.enableNative !== false ? bridge() : void 0;
|
|
1784
|
+
if (native && !triggerOff) triggerOff = onNativeTrigger((trigger, crashId) => isTrigger(trigger) && reportTrigger(trigger, typeof crashId === "string" ? crashId : null));
|
|
1524
1785
|
try {
|
|
1525
|
-
native?.start(k, String(project), rest.environment ?? null, release ?? null, c.endpoint
|
|
1786
|
+
native?.start(k, String(project), rest.environment ?? null, release ?? null, c.endpoint, {
|
|
1787
|
+
shakeToReport: shakeToReport === true,
|
|
1788
|
+
screenshotToReport: screenshotToReport === true,
|
|
1789
|
+
twoFingerReport: twoFingerReport === true,
|
|
1790
|
+
reportAfterCrash: reportAfterCrash === true,
|
|
1791
|
+
screenPicker: false
|
|
1792
|
+
});
|
|
1526
1793
|
} catch {
|
|
1527
1794
|
}
|
|
1795
|
+
if (reportAfterCrash === true && c.crashId) {
|
|
1796
|
+
try {
|
|
1797
|
+
native?.promptAfterCrash?.(c.crashId);
|
|
1798
|
+
} catch {
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1528
1801
|
session = release && rest.autoSessionTracking !== false ? new Session(c, release, rest.environment ?? "production") : void 0;
|
|
1529
1802
|
c.onError = (unhandled) => session?.markError(unhandled);
|
|
1530
1803
|
if (c.enabled) session?.start();
|
|
1531
1804
|
appState = import_react_native3.AppState?.addEventListener?.("change", (state) => {
|
|
1532
1805
|
if (state === "active") {
|
|
1806
|
+
screens.foreground(Date.now());
|
|
1533
1807
|
if (c.enabled) session?.start();
|
|
1534
1808
|
void c.flush();
|
|
1535
1809
|
} else if (state === "background") {
|
|
1810
|
+
screens.background(Date.now());
|
|
1536
1811
|
session?.end();
|
|
1537
1812
|
void c.flush();
|
|
1538
1813
|
}
|
|
1539
1814
|
});
|
|
1540
1815
|
void c.flush();
|
|
1541
1816
|
const reports = new ReportClient(base, k);
|
|
1542
|
-
configureReporter(reports, () => deviceContext(release));
|
|
1817
|
+
configureReporter(reports, () => deviceContext(release), { picker: screenPicker !== false });
|
|
1543
1818
|
reportClient = reports;
|
|
1819
|
+
refreshButton(0);
|
|
1544
1820
|
if (!stuck) {
|
|
1545
1821
|
stuck = createStuck(
|
|
1546
1822
|
{
|
|
@@ -1562,6 +1838,33 @@ function init(options) {
|
|
|
1562
1838
|
}
|
|
1563
1839
|
var stuck = null;
|
|
1564
1840
|
var reportClient;
|
|
1841
|
+
var triggerOff;
|
|
1842
|
+
var buttonTimer;
|
|
1843
|
+
var buttonBusy = false;
|
|
1844
|
+
var buttonAgain = false;
|
|
1845
|
+
function refreshButton(delay) {
|
|
1846
|
+
if (buttonTimer) clearTimeout(buttonTimer);
|
|
1847
|
+
buttonTimer = setTimeout(() => {
|
|
1848
|
+
buttonTimer = void 0;
|
|
1849
|
+
void fetchButton();
|
|
1850
|
+
}, delay);
|
|
1851
|
+
}
|
|
1852
|
+
async function fetchButton() {
|
|
1853
|
+
const client = reportClient;
|
|
1854
|
+
if (!client) return;
|
|
1855
|
+
if (buttonBusy) return void (buttonAgain = true);
|
|
1856
|
+
buttonBusy = true;
|
|
1857
|
+
try {
|
|
1858
|
+
setServerButton(parseReportButton(await client.settings(core?.user)));
|
|
1859
|
+
} catch {
|
|
1860
|
+
} finally {
|
|
1861
|
+
buttonBusy = false;
|
|
1862
|
+
if (buttonAgain) {
|
|
1863
|
+
buttonAgain = false;
|
|
1864
|
+
void fetchButton();
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1565
1868
|
function reportReady() {
|
|
1566
1869
|
stuck?.end(STARTUP);
|
|
1567
1870
|
}
|
|
@@ -1627,6 +1930,7 @@ function setUser(user) {
|
|
|
1627
1930
|
bridge()?.setUser(u?.id ?? null, u?.email ?? null, u?.username ?? null);
|
|
1628
1931
|
} catch {
|
|
1629
1932
|
}
|
|
1933
|
+
refreshButton(1e3);
|
|
1630
1934
|
}
|
|
1631
1935
|
function setTag(key, value) {
|
|
1632
1936
|
core?.setTag(key, value);
|
|
@@ -1650,6 +1954,7 @@ async function flush(timeout = 2e3) {
|
|
|
1650
1954
|
function setEnabled(on) {
|
|
1651
1955
|
if (!core) return;
|
|
1652
1956
|
core.setEnabled(on);
|
|
1957
|
+
if (!on) screens.clear();
|
|
1653
1958
|
if (on) session?.start();
|
|
1654
1959
|
else session?.end();
|
|
1655
1960
|
}
|
|
@@ -1668,7 +1973,18 @@ function hasReplayConsent() {
|
|
|
1668
1973
|
return false;
|
|
1669
1974
|
}
|
|
1670
1975
|
}
|
|
1671
|
-
|
|
1976
|
+
function trackNavigation2(ref) {
|
|
1977
|
+
const stop = trackNavigation(() => core, ref);
|
|
1978
|
+
const seen = () => {
|
|
1979
|
+
if (core?.enabled) noteScreen(ref.getCurrentRoute()?.name);
|
|
1980
|
+
};
|
|
1981
|
+
seen();
|
|
1982
|
+
const off = ref.addListener("state", seen);
|
|
1983
|
+
return () => {
|
|
1984
|
+
stop();
|
|
1985
|
+
off();
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1672
1988
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1673
1989
|
0 && (module.exports = {
|
|
1674
1990
|
BlipitReporter,
|