@react-pdf-kit/viewer 2.9.0-beta.0 → 2.9.0-rc.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.
|
@@ -6,14 +6,15 @@ import { useLoadWorker as r } from "../utils/hooks/useLoadWorker.js";
|
|
|
6
6
|
import { jsx as i } from "react/jsx-runtime";
|
|
7
7
|
//#region lib/components/RPConfig.tsx
|
|
8
8
|
var a = (a) => {
|
|
9
|
-
let { children: o, customVariables: s, customDarkVariables: c, workerUrl: l, wasmUrl: u,
|
|
9
|
+
let { children: o, customVariables: s, customDarkVariables: c, workerUrl: l, wasmUrl: u, iccUrl: d, standardFontDataUrl: f, licenseKey: p, ...m } = a, { workerUrlAdded: h } = r(l);
|
|
10
10
|
return /* @__PURE__ */ i(t, {
|
|
11
|
-
licenseKey:
|
|
11
|
+
licenseKey: p,
|
|
12
12
|
children: /* @__PURE__ */ i(e, {
|
|
13
|
-
workerUrlAdded:
|
|
13
|
+
workerUrlAdded: h,
|
|
14
14
|
wasmUrl: u,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
iccUrl: d,
|
|
16
|
+
standardFontDataUrl: f,
|
|
17
|
+
...m,
|
|
17
18
|
children: /* @__PURE__ */ i(n, {
|
|
18
19
|
customDarkVariables: c,
|
|
19
20
|
customVariables: s,
|
|
@@ -3,7 +3,7 @@ import { LicenseType as t } from "../types.js";
|
|
|
3
3
|
import { appConsole as n } from "../appConsole.js";
|
|
4
4
|
import { useCallback as r, useEffect as i, useState as a } from "react";
|
|
5
5
|
//#region lib/utils/hooks/useLicense.ts
|
|
6
|
-
var o = /* @__PURE__ */ new Date("2026-08-
|
|
6
|
+
var o = /* @__PURE__ */ new Date("2026-08-14T08:55:34.158Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
|
|
7
7
|
invalidLicense: `You are currently using without a valid license. ${c}`,
|
|
8
8
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${c}`,
|
|
9
9
|
expired: `Your license key has expired. ${c}`,
|
|
@@ -24,41 +24,45 @@ function _(e) {
|
|
|
24
24
|
return t.cause = e, t;
|
|
25
25
|
}
|
|
26
26
|
var v = (a, o, c = {}) => {
|
|
27
|
-
let [p, v] = d(), { workerUrlAdded: y, wasmUrl: b,
|
|
27
|
+
let [p, v] = d(), { workerUrlAdded: y, wasmUrl: b, iccUrl: x, standardFontDataUrl: S } = n(), [C, w] = d(/* @__PURE__ */ new Map()), T = u(), [E, D] = d(0), [O, k] = d(!1), [A, j] = d(), { password: M, passwordError: N, setPasswordError: P, passwordRequired: F, setPasswordRequired: I } = i(), { onLoadError: L, onLoaded: R, onLoadProgress: z, disableAutoFetch: B, disableStream: V, rangeChunkSize: H, withCredentials: U, httpHeaders: W } = c;
|
|
28
28
|
return l(() => {
|
|
29
|
-
|
|
30
|
-
}, [
|
|
29
|
+
z && z(E);
|
|
30
|
+
}, [E, z]), l(() => {
|
|
31
31
|
if (!y || !a) return;
|
|
32
|
-
|
|
33
|
-
let t =
|
|
32
|
+
D(0), j(void 0), T.current = Date.now();
|
|
33
|
+
let t = T.current, n = {
|
|
34
34
|
url: a,
|
|
35
35
|
cMapPacked: o?.isCompressed ?? !0,
|
|
36
36
|
...o?.url && { cMapUrl: o.url },
|
|
37
|
-
...
|
|
38
|
-
...
|
|
39
|
-
...
|
|
40
|
-
...
|
|
41
|
-
...
|
|
42
|
-
...
|
|
37
|
+
...M && { password: M },
|
|
38
|
+
...B !== void 0 && { disableAutoFetch: B },
|
|
39
|
+
...V !== void 0 && { disableStream: V },
|
|
40
|
+
...H !== void 0 && { rangeChunkSize: H },
|
|
41
|
+
...U !== void 0 && { withCredentials: U },
|
|
42
|
+
...W !== void 0 && { httpHeaders: W },
|
|
43
43
|
...b && { wasmUrl: b },
|
|
44
|
-
...x && {
|
|
44
|
+
...x && {
|
|
45
|
+
iccUrl: x,
|
|
46
|
+
useWorkerFetch: !0
|
|
47
|
+
},
|
|
48
|
+
...S && { standardFontDataUrl: S },
|
|
45
49
|
verbosity: f.VerbosityLevel.ERRORS
|
|
46
50
|
};
|
|
47
51
|
try {
|
|
48
52
|
let i = f.getDocument(n);
|
|
49
53
|
i.onProgress = (e) => {
|
|
50
|
-
if (t ===
|
|
54
|
+
if (t === T.current) {
|
|
51
55
|
let { loaded: t, total: n } = e;
|
|
52
|
-
|
|
56
|
+
D(n ? Math.min(100, Math.round(t / n * 100)) : 0);
|
|
53
57
|
}
|
|
54
|
-
},
|
|
55
|
-
let a = i.promise.then(async (n) => !b && m(await n.getData()) ? (t ===
|
|
58
|
+
}, k(!0), v(void 0);
|
|
59
|
+
let a = i.promise.then(async (n) => !b && m(await n.getData()) ? (t === T.current && (v(void 0), j(e.WASM_URL_REQUIRED)), r.error(s), L?.(g()), n) : (t === T.current && (v(n), D(100)), R && R(n), I(!1), P(""), n)).catch((t) => {
|
|
56
60
|
if (t instanceof Error && t.name === "PasswordException") {
|
|
57
61
|
let e = t.code;
|
|
58
|
-
|
|
59
|
-
} else t instanceof Error && t.name === "InvalidPDFException" &&
|
|
62
|
+
I(!0), e === f.PasswordResponses.INCORRECT_PASSWORD ? P("Incorrect password") : P(void 0);
|
|
63
|
+
} else t instanceof Error && t.name === "InvalidPDFException" && M ? (I(!0), P("Incorrect password")) : t instanceof Error && t.name === "InvalidPDFException" ? (j(e.INVALID_OR_CORRUPTED_PDF), L?.(h(t))) : L && L(t);
|
|
60
64
|
}).finally(() => {
|
|
61
|
-
|
|
65
|
+
k(!1);
|
|
62
66
|
});
|
|
63
67
|
return () => {
|
|
64
68
|
a.finally(() => {
|
|
@@ -66,21 +70,22 @@ var v = (a, o, c = {}) => {
|
|
|
66
70
|
});
|
|
67
71
|
};
|
|
68
72
|
} catch (t) {
|
|
69
|
-
|
|
73
|
+
j(e.NOT_SUPPORTED), L?.(_(t));
|
|
70
74
|
}
|
|
71
75
|
}, [
|
|
72
76
|
a,
|
|
73
77
|
y,
|
|
74
78
|
b,
|
|
75
79
|
x,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
L
|
|
80
|
+
S,
|
|
81
|
+
M,
|
|
82
|
+
L,
|
|
83
|
+
R
|
|
79
84
|
]), l(() => {
|
|
80
|
-
if (
|
|
85
|
+
if (F) return;
|
|
81
86
|
let n = /* @__PURE__ */ new Map();
|
|
82
|
-
if (!p ||
|
|
83
|
-
|
|
87
|
+
if (!p || O) {
|
|
88
|
+
w(n);
|
|
84
89
|
return;
|
|
85
90
|
}
|
|
86
91
|
let r = p.numPages, i = [];
|
|
@@ -99,23 +104,23 @@ var v = (a, o, c = {}) => {
|
|
|
99
104
|
thumbnailScale: i,
|
|
100
105
|
defaultRotation: a.rotation
|
|
101
106
|
});
|
|
102
|
-
}),
|
|
107
|
+
}), w(n);
|
|
103
108
|
}).catch((t) => {
|
|
104
|
-
v(void 0),
|
|
109
|
+
v(void 0), j(e.INVALID_OR_CORRUPTED_PDF), L?.(h(t));
|
|
105
110
|
});
|
|
106
111
|
}, [
|
|
107
112
|
p,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
O,
|
|
114
|
+
F,
|
|
115
|
+
L
|
|
111
116
|
]), {
|
|
112
117
|
pdf: p,
|
|
113
|
-
pages:
|
|
114
|
-
loading:
|
|
115
|
-
error:
|
|
116
|
-
loadingProgress:
|
|
117
|
-
passwordRequired:
|
|
118
|
-
passwordError:
|
|
118
|
+
pages: C,
|
|
119
|
+
loading: O,
|
|
120
|
+
error: A,
|
|
121
|
+
loadingProgress: E,
|
|
122
|
+
passwordRequired: F,
|
|
123
|
+
passwordError: N
|
|
119
124
|
};
|
|
120
125
|
};
|
|
121
126
|
//#endregion
|