@merittdev/horus-lens 0.5.1 → 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/README.md +16 -0
- package/dist/browser.cjs +282 -213
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +3 -2
- package/dist/chunk-AS225HUA.js +15344 -0
- package/dist/chunk-AS225HUA.js.map +1 -0
- package/dist/{chunk-MN44USB4.js → chunk-RVIL2GL4.js} +5 -3
- package/dist/{chunk-MN44USB4.js.map → chunk-RVIL2GL4.js.map} +1 -1
- package/dist/chunk-XGZ7BZTS.js +15082 -0
- package/dist/chunk-XGZ7BZTS.js.map +1 -0
- package/dist/index.cjs +282 -213
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +4 -2
- package/dist/lens.min.js +31 -31
- package/dist/{chunk-GVULQ2IF.js → react-native.cjs} +2741 -15965
- package/dist/react-native.cjs.map +1 -0
- package/dist/react-native.d.cts +492 -0
- package/dist/react-native.d.ts +492 -0
- package/dist/react-native.js +2105 -0
- package/dist/react-native.js.map +1 -0
- package/dist/react.cjs +282 -213
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +3 -2
- package/dist/react.js.map +1 -1
- package/package.json +25 -3
- package/dist/chunk-GVULQ2IF.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -14822,6 +14822,260 @@ var ApiErrorSchema = external_exports.object({
|
|
|
14822
14822
|
message: external_exports.string()
|
|
14823
14823
|
});
|
|
14824
14824
|
|
|
14825
|
+
// ../core/dist/chunk-YBVE6CBL.js
|
|
14826
|
+
var SDK_NAME = "@merittdev/horus-lens";
|
|
14827
|
+
var SDK_VERSION = true ? "0.6.0" : "0.0.0-dev";
|
|
14828
|
+
var DEFAULT_ENDPOINT = "https://api.horus.sh";
|
|
14829
|
+
var DEFAULT_REPLAY_WINDOW_MS = 15e3;
|
|
14830
|
+
var DEFAULT_MAX_CONSOLE_ENTRIES = 200;
|
|
14831
|
+
var DEFAULT_MAX_NETWORK_ENTRIES = 100;
|
|
14832
|
+
var MAX_ERROR_ENTRIES = 100;
|
|
14833
|
+
var CONSOLE_TAIL_SIZE = 50;
|
|
14834
|
+
var NETWORK_TAIL_SIZE = 30;
|
|
14835
|
+
var MAX_SERIALIZED_ARG_CHARS = 2e3;
|
|
14836
|
+
var MAX_DOM_BYTES = 2 * 1024 * 1024;
|
|
14837
|
+
var MAX_TARGET_TEXT_CHARS = 200;
|
|
14838
|
+
var SCREENSHOT_TIMEOUT_MS = 2e4;
|
|
14839
|
+
var SCREENSHOT_RESOURCE_TIMEOUT_MS = 3500;
|
|
14840
|
+
var SCREENSHOT_MAX_SCALE = 2;
|
|
14841
|
+
var SCREENSHOT_MAX_PIXELS = 25e5;
|
|
14842
|
+
var AUTO_CAPTURE_COOLDOWN_MS = 10 * 60 * 1e3;
|
|
14843
|
+
var AUTO_CAPTURE_SESSION_CAP = 5;
|
|
14844
|
+
var MAX_MANUAL_RECORDING_MS = 12e4;
|
|
14845
|
+
var MAX_MANUAL_RECORDING_EVENTS = 1e4;
|
|
14846
|
+
var LENS_OVERLAY_HOST_ID = "__lens_root__";
|
|
14847
|
+
var RingBuffer = class {
|
|
14848
|
+
constructor(capacity) {
|
|
14849
|
+
this.capacity = capacity;
|
|
14850
|
+
if (capacity <= 0) throw new Error("RingBuffer capacity must be > 0");
|
|
14851
|
+
}
|
|
14852
|
+
capacity;
|
|
14853
|
+
items = [];
|
|
14854
|
+
push(item) {
|
|
14855
|
+
this.items.push(item);
|
|
14856
|
+
if (this.items.length > this.capacity) {
|
|
14857
|
+
this.items.splice(0, this.items.length - this.capacity);
|
|
14858
|
+
}
|
|
14859
|
+
}
|
|
14860
|
+
/** Snapshot of current contents, oldest first. */
|
|
14861
|
+
drain() {
|
|
14862
|
+
return [...this.items];
|
|
14863
|
+
}
|
|
14864
|
+
tail(count) {
|
|
14865
|
+
return this.items.slice(-count);
|
|
14866
|
+
}
|
|
14867
|
+
clear() {
|
|
14868
|
+
this.items = [];
|
|
14869
|
+
}
|
|
14870
|
+
get size() {
|
|
14871
|
+
return this.items.length;
|
|
14872
|
+
}
|
|
14873
|
+
};
|
|
14874
|
+
var HttpError = class extends Error {
|
|
14875
|
+
constructor(status, message) {
|
|
14876
|
+
super(message);
|
|
14877
|
+
this.status = status;
|
|
14878
|
+
this.name = "HttpError";
|
|
14879
|
+
}
|
|
14880
|
+
status;
|
|
14881
|
+
};
|
|
14882
|
+
var Transport = class {
|
|
14883
|
+
constructor(config2) {
|
|
14884
|
+
this.config = config2;
|
|
14885
|
+
}
|
|
14886
|
+
config;
|
|
14887
|
+
async initiate(assets) {
|
|
14888
|
+
const body = {
|
|
14889
|
+
accessId: this.config.accessId,
|
|
14890
|
+
assets
|
|
14891
|
+
};
|
|
14892
|
+
return this.postJson(
|
|
14893
|
+
`${this.config.endpoint}/v1/reports/initiate`,
|
|
14894
|
+
body,
|
|
14895
|
+
{ retries: 0 }
|
|
14896
|
+
);
|
|
14897
|
+
}
|
|
14898
|
+
/** Record a late-uploaded asset (background screenshot) on a finalized report. */
|
|
14899
|
+
async attachAsset(reportId, asset) {
|
|
14900
|
+
const body = {
|
|
14901
|
+
accessId: this.config.accessId,
|
|
14902
|
+
...asset
|
|
14903
|
+
};
|
|
14904
|
+
await this.postJson(
|
|
14905
|
+
`${this.config.endpoint}/v1/reports/${encodeURIComponent(reportId)}/assets`,
|
|
14906
|
+
body
|
|
14907
|
+
);
|
|
14908
|
+
}
|
|
14909
|
+
async uploadAsset(upload, blob2, signal) {
|
|
14910
|
+
const session = this.config.signal;
|
|
14911
|
+
const controller = session ? new AbortController() : void 0;
|
|
14912
|
+
const abort = () => controller?.abort();
|
|
14913
|
+
if (session?.aborted || signal?.aborted) abort();
|
|
14914
|
+
session?.addEventListener("abort", abort);
|
|
14915
|
+
if (controller) signal?.addEventListener("abort", abort);
|
|
14916
|
+
try {
|
|
14917
|
+
const response = await (this.config.fetch ?? fetch)(upload.url, {
|
|
14918
|
+
method: upload.method,
|
|
14919
|
+
headers: upload.headers,
|
|
14920
|
+
body: blob2,
|
|
14921
|
+
signal: controller?.signal ?? signal
|
|
14922
|
+
});
|
|
14923
|
+
if (!response.ok) {
|
|
14924
|
+
throw new Error(
|
|
14925
|
+
`Asset upload failed (${upload.kind}): ${response.status}`
|
|
14926
|
+
);
|
|
14927
|
+
}
|
|
14928
|
+
} finally {
|
|
14929
|
+
session?.removeEventListener("abort", abort);
|
|
14930
|
+
if (controller) signal?.removeEventListener("abort", abort);
|
|
14931
|
+
}
|
|
14932
|
+
}
|
|
14933
|
+
async finalize(reportId, metadata, uploadedAssets) {
|
|
14934
|
+
const body = {
|
|
14935
|
+
accessId: this.config.accessId,
|
|
14936
|
+
metadata,
|
|
14937
|
+
uploadedAssets
|
|
14938
|
+
};
|
|
14939
|
+
try {
|
|
14940
|
+
return await this.postJson(
|
|
14941
|
+
`${this.config.endpoint}/v1/reports/${reportId}/finalize`,
|
|
14942
|
+
body
|
|
14943
|
+
);
|
|
14944
|
+
} catch (err) {
|
|
14945
|
+
if (err instanceof HttpError && err.status === 409) {
|
|
14946
|
+
return { reportId, status: "submitted" };
|
|
14947
|
+
}
|
|
14948
|
+
throw err;
|
|
14949
|
+
}
|
|
14950
|
+
}
|
|
14951
|
+
async postJson(url2, body, opts = {}) {
|
|
14952
|
+
const retries = opts.retries ?? 1;
|
|
14953
|
+
let lastError;
|
|
14954
|
+
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
14955
|
+
const controller = this.config.requestTimeoutMs || this.config.signal ? new AbortController() : void 0;
|
|
14956
|
+
const abort = () => controller?.abort();
|
|
14957
|
+
const session = this.config.signal;
|
|
14958
|
+
if (session?.aborted) throw new Error("Capture session ended");
|
|
14959
|
+
session?.addEventListener("abort", abort);
|
|
14960
|
+
const timeout = controller && this.config.requestTimeoutMs ? setTimeout(() => controller.abort(), this.config.requestTimeoutMs) : void 0;
|
|
14961
|
+
try {
|
|
14962
|
+
const response = await (this.config.fetch ?? fetch)(url2, {
|
|
14963
|
+
method: "POST",
|
|
14964
|
+
headers: {
|
|
14965
|
+
"content-type": "application/json",
|
|
14966
|
+
...this.config.origin ? { Origin: this.config.origin } : {}
|
|
14967
|
+
},
|
|
14968
|
+
body: JSON.stringify(body),
|
|
14969
|
+
...controller ? { signal: controller.signal } : {}
|
|
14970
|
+
});
|
|
14971
|
+
if (!response.ok) {
|
|
14972
|
+
const text = await response.text().catch(() => "");
|
|
14973
|
+
throw new HttpError(
|
|
14974
|
+
response.status,
|
|
14975
|
+
`Request to ${url2} failed: ${response.status} ${text}`.trim()
|
|
14976
|
+
);
|
|
14977
|
+
}
|
|
14978
|
+
return await response.json();
|
|
14979
|
+
} catch (err) {
|
|
14980
|
+
lastError = err;
|
|
14981
|
+
if (this.config.debug) {
|
|
14982
|
+
console.warn(
|
|
14983
|
+
`[lens] request failed (attempt ${attempt + 1}/${retries + 1})`,
|
|
14984
|
+
err
|
|
14985
|
+
);
|
|
14986
|
+
}
|
|
14987
|
+
} finally {
|
|
14988
|
+
if (timeout !== void 0) clearTimeout(timeout);
|
|
14989
|
+
session?.removeEventListener("abort", abort);
|
|
14990
|
+
}
|
|
14991
|
+
}
|
|
14992
|
+
throw lastError;
|
|
14993
|
+
}
|
|
14994
|
+
};
|
|
14995
|
+
var LEVELS = ["log", "info", "warn", "error", "debug"];
|
|
14996
|
+
function cap(value) {
|
|
14997
|
+
return value.length > MAX_SERIALIZED_ARG_CHARS ? `${value.slice(0, MAX_SERIALIZED_ARG_CHARS)}\u2026[truncated]` : value;
|
|
14998
|
+
}
|
|
14999
|
+
function serializeArg(value) {
|
|
15000
|
+
if (value === null) return "null";
|
|
15001
|
+
if (value === void 0) return "undefined";
|
|
15002
|
+
const type = typeof value;
|
|
15003
|
+
if (type === "string") return cap(value);
|
|
15004
|
+
if (type === "number" || type === "boolean" || type === "bigint" || type === "symbol") {
|
|
15005
|
+
return String(value);
|
|
15006
|
+
}
|
|
15007
|
+
if (type === "function") {
|
|
15008
|
+
return `[Function: ${value.name || "anonymous"}]`;
|
|
15009
|
+
}
|
|
15010
|
+
if (value instanceof Error) {
|
|
15011
|
+
return cap(value.stack ? `${value.name}: ${value.message}
|
|
15012
|
+
${value.stack}` : `${value.name}: ${value.message}`);
|
|
15013
|
+
}
|
|
15014
|
+
try {
|
|
15015
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
15016
|
+
const json2 = JSON.stringify(value, (_key, val) => {
|
|
15017
|
+
if (typeof val === "bigint") return String(val);
|
|
15018
|
+
if (typeof val === "function") return "[Function]";
|
|
15019
|
+
if (typeof val === "object" && val !== null) {
|
|
15020
|
+
if (seen.has(val)) return "[Circular]";
|
|
15021
|
+
seen.add(val);
|
|
15022
|
+
}
|
|
15023
|
+
return val;
|
|
15024
|
+
});
|
|
15025
|
+
return cap(json2 ?? String(value));
|
|
15026
|
+
} catch {
|
|
15027
|
+
return cap(String(value));
|
|
15028
|
+
}
|
|
15029
|
+
}
|
|
15030
|
+
function firstErrorStack(args) {
|
|
15031
|
+
for (const arg of args) {
|
|
15032
|
+
if (arg instanceof Error && arg.stack) return arg.stack;
|
|
15033
|
+
}
|
|
15034
|
+
return void 0;
|
|
15035
|
+
}
|
|
15036
|
+
function installConsole(consoleBuffer, errorBuffer) {
|
|
15037
|
+
if (typeof console === "undefined") return () => {
|
|
15038
|
+
};
|
|
15039
|
+
const target = console;
|
|
15040
|
+
const restores = [];
|
|
15041
|
+
let active = true;
|
|
15042
|
+
for (const level of LEVELS) {
|
|
15043
|
+
const original = target[level];
|
|
15044
|
+
if (typeof original !== "function") continue;
|
|
15045
|
+
const wrapped = (...args) => {
|
|
15046
|
+
if (!active) {
|
|
15047
|
+
original.apply(console, args);
|
|
15048
|
+
return;
|
|
15049
|
+
}
|
|
15050
|
+
try {
|
|
15051
|
+
const serialized = args.map(serializeArg);
|
|
15052
|
+
const timestamp = Date.now();
|
|
15053
|
+
consoleBuffer.push({ level, args: serialized, timestamp });
|
|
15054
|
+
if (level === "error") {
|
|
15055
|
+
const stack = firstErrorStack(args);
|
|
15056
|
+
const entry = {
|
|
15057
|
+
message: serialized.join(" ") || "console.error",
|
|
15058
|
+
source: "console.error",
|
|
15059
|
+
timestamp
|
|
15060
|
+
};
|
|
15061
|
+
if (stack) entry.stack = stack;
|
|
15062
|
+
errorBuffer.push(entry);
|
|
15063
|
+
}
|
|
15064
|
+
} catch {
|
|
15065
|
+
}
|
|
15066
|
+
original.apply(console, args);
|
|
15067
|
+
};
|
|
15068
|
+
target[level] = wrapped;
|
|
15069
|
+
restores.push(() => {
|
|
15070
|
+
if (target[level] === wrapped) target[level] = original;
|
|
15071
|
+
});
|
|
15072
|
+
}
|
|
15073
|
+
return () => {
|
|
15074
|
+
active = false;
|
|
15075
|
+
for (const restore of restores) restore();
|
|
15076
|
+
};
|
|
15077
|
+
}
|
|
15078
|
+
|
|
14825
15079
|
// ../../node_modules/.pnpm/rrweb@2.1.0/node_modules/rrweb/dist/rrweb.js
|
|
14826
15080
|
var __defProp2 = Object.defineProperty;
|
|
14827
15081
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -26471,9 +26725,9 @@ var saveWebGLVar = (value, win, ctx) => {
|
|
|
26471
26725
|
}
|
|
26472
26726
|
return index2;
|
|
26473
26727
|
};
|
|
26474
|
-
function
|
|
26728
|
+
function serializeArg2(value, win, ctx) {
|
|
26475
26729
|
if (value instanceof Array) {
|
|
26476
|
-
return value.map((arg) =>
|
|
26730
|
+
return value.map((arg) => serializeArg2(arg, win, ctx));
|
|
26477
26731
|
} else if (value === null) {
|
|
26478
26732
|
return value;
|
|
26479
26733
|
} else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {
|
|
@@ -26499,7 +26753,7 @@ function serializeArg(value, win, ctx) {
|
|
|
26499
26753
|
return {
|
|
26500
26754
|
rr_type: name,
|
|
26501
26755
|
args: [
|
|
26502
|
-
|
|
26756
|
+
serializeArg2(value.buffer, win, ctx),
|
|
26503
26757
|
value.byteOffset,
|
|
26504
26758
|
value.byteLength
|
|
26505
26759
|
]
|
|
@@ -26522,7 +26776,7 @@ function serializeArg(value, win, ctx) {
|
|
|
26522
26776
|
const name = value.constructor.name;
|
|
26523
26777
|
return {
|
|
26524
26778
|
rr_type: name,
|
|
26525
|
-
args: [
|
|
26779
|
+
args: [serializeArg2(value.data, win, ctx), value.width, value.height]
|
|
26526
26780
|
};
|
|
26527
26781
|
} else if (isInstanceOfWebGLObject(value, win) || typeof value === "object") {
|
|
26528
26782
|
const name = value.constructor.name;
|
|
@@ -26535,7 +26789,7 @@ function serializeArg(value, win, ctx) {
|
|
|
26535
26789
|
return value;
|
|
26536
26790
|
}
|
|
26537
26791
|
var serializeArgs = (args, win, ctx) => {
|
|
26538
|
-
return args.map((arg) =>
|
|
26792
|
+
return args.map((arg) => serializeArg2(arg, win, ctx));
|
|
26539
26793
|
};
|
|
26540
26794
|
var isInstanceOfWebGLObject = (value, win) => {
|
|
26541
26795
|
const webGLConstructorNames = [
|
|
@@ -29110,26 +29364,6 @@ async function domToBlob(node2, options) {
|
|
|
29110
29364
|
}
|
|
29111
29365
|
|
|
29112
29366
|
// ../core/dist/index.js
|
|
29113
|
-
var SDK_NAME = "@merittdev/horus-lens";
|
|
29114
|
-
var SDK_VERSION = true ? "0.5.1" : "0.0.0-dev";
|
|
29115
|
-
var DEFAULT_ENDPOINT = "https://api.horus.sh";
|
|
29116
|
-
var DEFAULT_REPLAY_WINDOW_MS = 15e3;
|
|
29117
|
-
var DEFAULT_MAX_CONSOLE_ENTRIES = 200;
|
|
29118
|
-
var DEFAULT_MAX_NETWORK_ENTRIES = 100;
|
|
29119
|
-
var MAX_ERROR_ENTRIES = 100;
|
|
29120
|
-
var CONSOLE_TAIL_SIZE = 50;
|
|
29121
|
-
var NETWORK_TAIL_SIZE = 30;
|
|
29122
|
-
var MAX_SERIALIZED_ARG_CHARS = 2e3;
|
|
29123
|
-
var MAX_DOM_BYTES = 2 * 1024 * 1024;
|
|
29124
|
-
var MAX_TARGET_TEXT_CHARS = 200;
|
|
29125
|
-
var SCREENSHOT_TIMEOUT_MS = 2e4;
|
|
29126
|
-
var SCREENSHOT_MAX_SCALE = 2;
|
|
29127
|
-
var SCREENSHOT_MAX_PIXELS = 25e5;
|
|
29128
|
-
var AUTO_CAPTURE_COOLDOWN_MS = 10 * 60 * 1e3;
|
|
29129
|
-
var AUTO_CAPTURE_SESSION_CAP = 5;
|
|
29130
|
-
var MAX_MANUAL_RECORDING_MS = 12e4;
|
|
29131
|
-
var MAX_MANUAL_RECORDING_EVENTS = 1e4;
|
|
29132
|
-
var LENS_OVERLAY_HOST_ID = "__lens_root__";
|
|
29133
29367
|
function autoCaptureSignature(message) {
|
|
29134
29368
|
return message.toLowerCase().replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g, "<uuid>").replace(/\d+/g, "<n>").replace(/\s+/g, " ").trim();
|
|
29135
29369
|
}
|
|
@@ -29208,189 +29442,6 @@ function startAutoCapture(client, options = {}) {
|
|
|
29208
29442
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
29209
29443
|
};
|
|
29210
29444
|
}
|
|
29211
|
-
var RingBuffer = class {
|
|
29212
|
-
constructor(capacity) {
|
|
29213
|
-
this.capacity = capacity;
|
|
29214
|
-
if (capacity <= 0) throw new Error("RingBuffer capacity must be > 0");
|
|
29215
|
-
}
|
|
29216
|
-
capacity;
|
|
29217
|
-
items = [];
|
|
29218
|
-
push(item) {
|
|
29219
|
-
this.items.push(item);
|
|
29220
|
-
if (this.items.length > this.capacity) {
|
|
29221
|
-
this.items.splice(0, this.items.length - this.capacity);
|
|
29222
|
-
}
|
|
29223
|
-
}
|
|
29224
|
-
/** Snapshot of current contents, oldest first. */
|
|
29225
|
-
drain() {
|
|
29226
|
-
return [...this.items];
|
|
29227
|
-
}
|
|
29228
|
-
tail(count) {
|
|
29229
|
-
return this.items.slice(-count);
|
|
29230
|
-
}
|
|
29231
|
-
clear() {
|
|
29232
|
-
this.items = [];
|
|
29233
|
-
}
|
|
29234
|
-
get size() {
|
|
29235
|
-
return this.items.length;
|
|
29236
|
-
}
|
|
29237
|
-
};
|
|
29238
|
-
var HttpError = class extends Error {
|
|
29239
|
-
constructor(status, message) {
|
|
29240
|
-
super(message);
|
|
29241
|
-
this.status = status;
|
|
29242
|
-
this.name = "HttpError";
|
|
29243
|
-
}
|
|
29244
|
-
status;
|
|
29245
|
-
};
|
|
29246
|
-
var Transport = class {
|
|
29247
|
-
constructor(config2) {
|
|
29248
|
-
this.config = config2;
|
|
29249
|
-
}
|
|
29250
|
-
config;
|
|
29251
|
-
async initiate(assets) {
|
|
29252
|
-
const body = { accessId: this.config.accessId, assets };
|
|
29253
|
-
return this.postJson(
|
|
29254
|
-
`${this.config.endpoint}/v1/reports/initiate`,
|
|
29255
|
-
body,
|
|
29256
|
-
{ retries: 0 }
|
|
29257
|
-
);
|
|
29258
|
-
}
|
|
29259
|
-
/** Record a late-uploaded asset (background screenshot) on a finalized report. */
|
|
29260
|
-
async attachAsset(reportId, asset) {
|
|
29261
|
-
const body = { accessId: this.config.accessId, ...asset };
|
|
29262
|
-
await this.postJson(`${this.config.endpoint}/v1/reports/${encodeURIComponent(reportId)}/assets`, body);
|
|
29263
|
-
}
|
|
29264
|
-
async uploadAsset(upload, blob2, signal) {
|
|
29265
|
-
const response = await fetch(upload.url, {
|
|
29266
|
-
method: upload.method,
|
|
29267
|
-
headers: upload.headers,
|
|
29268
|
-
body: blob2,
|
|
29269
|
-
signal
|
|
29270
|
-
});
|
|
29271
|
-
if (!response.ok) {
|
|
29272
|
-
throw new Error(`Asset upload failed (${upload.kind}): ${response.status}`);
|
|
29273
|
-
}
|
|
29274
|
-
}
|
|
29275
|
-
async finalize(reportId, metadata, uploadedAssets) {
|
|
29276
|
-
const body = { accessId: this.config.accessId, metadata, uploadedAssets };
|
|
29277
|
-
try {
|
|
29278
|
-
return await this.postJson(
|
|
29279
|
-
`${this.config.endpoint}/v1/reports/${reportId}/finalize`,
|
|
29280
|
-
body
|
|
29281
|
-
);
|
|
29282
|
-
} catch (err) {
|
|
29283
|
-
if (err instanceof HttpError && err.status === 409) {
|
|
29284
|
-
return { reportId, status: "submitted" };
|
|
29285
|
-
}
|
|
29286
|
-
throw err;
|
|
29287
|
-
}
|
|
29288
|
-
}
|
|
29289
|
-
async postJson(url2, body, opts = {}) {
|
|
29290
|
-
const retries = opts.retries ?? 1;
|
|
29291
|
-
let lastError;
|
|
29292
|
-
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
29293
|
-
try {
|
|
29294
|
-
const response = await fetch(url2, {
|
|
29295
|
-
method: "POST",
|
|
29296
|
-
headers: { "content-type": "application/json" },
|
|
29297
|
-
body: JSON.stringify(body)
|
|
29298
|
-
});
|
|
29299
|
-
if (!response.ok) {
|
|
29300
|
-
const text = await response.text().catch(() => "");
|
|
29301
|
-
throw new HttpError(
|
|
29302
|
-
response.status,
|
|
29303
|
-
`Request to ${url2} failed: ${response.status} ${text}`.trim()
|
|
29304
|
-
);
|
|
29305
|
-
}
|
|
29306
|
-
return await response.json();
|
|
29307
|
-
} catch (err) {
|
|
29308
|
-
lastError = err;
|
|
29309
|
-
if (this.config.debug) {
|
|
29310
|
-
console.warn(`[lens] request failed (attempt ${attempt + 1}/${retries + 1})`, err);
|
|
29311
|
-
}
|
|
29312
|
-
}
|
|
29313
|
-
}
|
|
29314
|
-
throw lastError;
|
|
29315
|
-
}
|
|
29316
|
-
};
|
|
29317
|
-
var LEVELS = ["log", "info", "warn", "error", "debug"];
|
|
29318
|
-
function cap(value) {
|
|
29319
|
-
return value.length > MAX_SERIALIZED_ARG_CHARS ? `${value.slice(0, MAX_SERIALIZED_ARG_CHARS)}\u2026[truncated]` : value;
|
|
29320
|
-
}
|
|
29321
|
-
function serializeArg2(value) {
|
|
29322
|
-
if (value === null) return "null";
|
|
29323
|
-
if (value === void 0) return "undefined";
|
|
29324
|
-
const type = typeof value;
|
|
29325
|
-
if (type === "string") return cap(value);
|
|
29326
|
-
if (type === "number" || type === "boolean" || type === "bigint" || type === "symbol") {
|
|
29327
|
-
return String(value);
|
|
29328
|
-
}
|
|
29329
|
-
if (type === "function") {
|
|
29330
|
-
return `[Function: ${value.name || "anonymous"}]`;
|
|
29331
|
-
}
|
|
29332
|
-
if (value instanceof Error) {
|
|
29333
|
-
return cap(value.stack ? `${value.name}: ${value.message}
|
|
29334
|
-
${value.stack}` : `${value.name}: ${value.message}`);
|
|
29335
|
-
}
|
|
29336
|
-
try {
|
|
29337
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
29338
|
-
const json2 = JSON.stringify(value, (_key, val) => {
|
|
29339
|
-
if (typeof val === "bigint") return String(val);
|
|
29340
|
-
if (typeof val === "function") return "[Function]";
|
|
29341
|
-
if (typeof val === "object" && val !== null) {
|
|
29342
|
-
if (seen.has(val)) return "[Circular]";
|
|
29343
|
-
seen.add(val);
|
|
29344
|
-
}
|
|
29345
|
-
return val;
|
|
29346
|
-
});
|
|
29347
|
-
return cap(json2 ?? String(value));
|
|
29348
|
-
} catch {
|
|
29349
|
-
return cap(String(value));
|
|
29350
|
-
}
|
|
29351
|
-
}
|
|
29352
|
-
function firstErrorStack(args) {
|
|
29353
|
-
for (const arg of args) {
|
|
29354
|
-
if (arg instanceof Error && arg.stack) return arg.stack;
|
|
29355
|
-
}
|
|
29356
|
-
return void 0;
|
|
29357
|
-
}
|
|
29358
|
-
function installConsole(consoleBuffer, errorBuffer) {
|
|
29359
|
-
if (typeof console === "undefined") return () => {
|
|
29360
|
-
};
|
|
29361
|
-
const target = console;
|
|
29362
|
-
const restores = [];
|
|
29363
|
-
for (const level of LEVELS) {
|
|
29364
|
-
const original = target[level];
|
|
29365
|
-
if (typeof original !== "function") continue;
|
|
29366
|
-
const wrapped = (...args) => {
|
|
29367
|
-
try {
|
|
29368
|
-
const serialized = args.map(serializeArg2);
|
|
29369
|
-
const timestamp = Date.now();
|
|
29370
|
-
consoleBuffer.push({ level, args: serialized, timestamp });
|
|
29371
|
-
if (level === "error") {
|
|
29372
|
-
const stack = firstErrorStack(args);
|
|
29373
|
-
const entry = {
|
|
29374
|
-
message: serialized.join(" ") || "console.error",
|
|
29375
|
-
source: "console.error",
|
|
29376
|
-
timestamp
|
|
29377
|
-
};
|
|
29378
|
-
if (stack) entry.stack = stack;
|
|
29379
|
-
errorBuffer.push(entry);
|
|
29380
|
-
}
|
|
29381
|
-
} catch {
|
|
29382
|
-
}
|
|
29383
|
-
original.apply(console, args);
|
|
29384
|
-
};
|
|
29385
|
-
target[level] = wrapped;
|
|
29386
|
-
restores.push(() => {
|
|
29387
|
-
target[level] = original;
|
|
29388
|
-
});
|
|
29389
|
-
}
|
|
29390
|
-
return () => {
|
|
29391
|
-
for (const restore of restores) restore();
|
|
29392
|
-
};
|
|
29393
|
-
}
|
|
29394
29445
|
function nowMs() {
|
|
29395
29446
|
return typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
29396
29447
|
}
|
|
@@ -29677,6 +29728,14 @@ var ReplayRecorder = class {
|
|
|
29677
29728
|
}
|
|
29678
29729
|
};
|
|
29679
29730
|
var SVG_RASTERIZE_TIMEOUT_MS = 3e3;
|
|
29731
|
+
function isOffscreenMedia(node2) {
|
|
29732
|
+
if (!(node2 instanceof HTMLImageElement) && !(node2 instanceof HTMLIFrameElement) && !(typeof HTMLVideoElement !== "undefined" && node2 instanceof HTMLVideoElement)) {
|
|
29733
|
+
return false;
|
|
29734
|
+
}
|
|
29735
|
+
const r = node2.getBoundingClientRect();
|
|
29736
|
+
if (r.width === 0 && r.height === 0) return false;
|
|
29737
|
+
return r.bottom < 0 || r.top > window.innerHeight || r.right < 0 || r.left > window.innerWidth;
|
|
29738
|
+
}
|
|
29680
29739
|
function computeCropRect(crop, scale, rasterWidth, rasterHeight) {
|
|
29681
29740
|
let sx = Math.round(crop.x * scale);
|
|
29682
29741
|
let sy = Math.round(crop.y * scale);
|
|
@@ -29718,12 +29777,22 @@ async function captureScreenshot(excludeHost, crop, composite) {
|
|
|
29718
29777
|
transformOrigin: "top left"
|
|
29719
29778
|
}
|
|
29720
29779
|
} : {},
|
|
29721
|
-
// Exclude the overlay from the capture CLONE
|
|
29722
|
-
|
|
29723
|
-
//
|
|
29724
|
-
|
|
29780
|
+
// Exclude the overlay from the capture CLONE (never hide the live node),
|
|
29781
|
+
// and — for a plain viewport report — drop images/iframes entirely outside
|
|
29782
|
+
// the viewport so we don't fetch dozens of off-screen cross-origin assets.
|
|
29783
|
+
filter: (node2) => {
|
|
29784
|
+
if (node2 === excludeHost) return false;
|
|
29785
|
+
if (viewportOnly && isOffscreenMedia(node2)) return false;
|
|
29786
|
+
return true;
|
|
29787
|
+
},
|
|
29788
|
+
// Skip web-font download/embed. On font-heavy pages (multiple custom
|
|
29789
|
+
// families) this is a dominant, flaky cost; fallback fonts are fine for a
|
|
29790
|
+
// bug-report screenshot and capture becomes far more reliable.
|
|
29791
|
+
font: false,
|
|
29725
29792
|
fetch: { requestInit: { cache: "force-cache" }, bypassingCache: false },
|
|
29726
|
-
|
|
29793
|
+
// PER-RESOURCE cap (NOT the overall budget): a hanging asset fails fast to
|
|
29794
|
+
// a placeholder instead of stalling the whole capture.
|
|
29795
|
+
timeout: SCREENSHOT_RESOURCE_TIMEOUT_MS
|
|
29727
29796
|
});
|
|
29728
29797
|
const started = Date.now();
|
|
29729
29798
|
const timeout = new Promise((resolve) => {
|