@raytio/decrypt-helper 6.3.1 → 6.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers/jsxPdf.d.ts +6 -0
- package/dist/helpers/jsxPdf.js +3 -0
- package/dist/locales/index.d.ts +2 -34
- package/dist/locales/index.js +4 -1
- package/dist/locales/translations/en.json +31 -31
- package/dist/pdf/components/FieldVerificationBadge.js +1 -1
- package/dist/pdf/components/Images.js +1 -1
- package/dist/pdf/components/InnerTableRows.js +1 -1
- package/dist/pdf/components/POVerificationBadge.js +1 -1
- package/dist/pdf/components/Report.js +1 -1
- package/dist/pdf/components/Subheader.js +1 -1
- package/dist/pdf/components/Table.js +1 -1
- package/dist/pdf/components/TableTitle.js +1 -1
- package/dist/pdf/components/ValidationDisplay.js +1 -1
- package/dist/pdf/components/VerifyBox.js +1 -1
- package/dist/public-methods/generatePDF.js +2 -1
- package/package.json +8 -6
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const JsxPdf: {
|
|
2
|
+
createElement: <P extends Record<string, unknown>>(type: string | ((props: P) => JSX.Element), props: P | null, ...children: (string | number | boolean | JSX.Element | null | undefined)[]) => JSX.Element;
|
|
3
|
+
Fragment: JSX.Ele<Omit<import("pdfmake/interfaces").ContentStack, "stack">>;
|
|
4
|
+
renderPdf: (element: JSX.Element) => import("pdfmake/interfaces").TDocumentDefinitions;
|
|
5
|
+
default: any;
|
|
6
|
+
};
|
package/dist/locales/index.d.ts
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
declare const en: any;
|
|
2
2
|
declare const locales: {
|
|
3
|
-
readonly en:
|
|
4
|
-
"FieldVerification.Expired": string;
|
|
5
|
-
"FieldVerification.NotVerified": string;
|
|
6
|
-
"FieldVerification.Verified": string;
|
|
7
|
-
"FieldVerification.VerifiedFalse": string;
|
|
8
|
-
"Images.file-not-found": string;
|
|
9
|
-
"POVerification.Encrypted": string;
|
|
10
|
-
"POVerification.Expired": string;
|
|
11
|
-
"POVerification.FullyVerified": string;
|
|
12
|
-
"POVerification.Loading": string;
|
|
13
|
-
"POVerification.NotVerified": string;
|
|
14
|
-
"POVerification.PartiallyVerified": string;
|
|
15
|
-
"POVerification.VerifiedFalse": string;
|
|
16
|
-
"POVerificationBadge.safe-harbour-no": string;
|
|
17
|
-
"POVerificationBadge.safe-harbour-yes": string;
|
|
18
|
-
"POVerificationBadge.verified-by": string;
|
|
19
|
-
"Report.footer-private": string;
|
|
20
|
-
"Report.header": string;
|
|
21
|
-
"Report.meta.title": string;
|
|
22
|
-
"Report.pagecount": string;
|
|
23
|
-
"ValidationDisplay.text": string;
|
|
24
|
-
"VerifyBox.text": string;
|
|
25
|
-
"constants.confirmation_code": string;
|
|
26
|
-
"constants.end_date": string;
|
|
27
|
-
"constants.i_id": string;
|
|
28
|
-
"constants.reference": string;
|
|
29
|
-
"constants.score": string;
|
|
30
|
-
"constants.score-category": string;
|
|
31
|
-
"constants.start_date": string;
|
|
32
|
-
"field.boolean.no": string;
|
|
33
|
-
"field.boolean.yes": string;
|
|
34
|
-
"field.undefined": string;
|
|
35
|
-
};
|
|
3
|
+
readonly en: any;
|
|
36
4
|
};
|
|
37
5
|
export type I18nKey = keyof typeof en;
|
|
38
6
|
export type I18nLang = keyof typeof locales;
|
package/dist/locales/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { getDirname } from "../helpers/pathUtils.js";
|
|
4
|
+
const en = JSON.parse(readFileSync(join(getDirname(), "../locales/translations/en.json"), "utf8"));
|
|
2
5
|
const locales = { en };
|
|
3
6
|
export const isValidLocale = (lang) => lang in locales;
|
|
4
7
|
export const $$ = (key, variables) => {
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
"FieldVerification.Expired": "Expired",
|
|
3
|
+
"FieldVerification.NotVerified": "Not Verified",
|
|
4
|
+
"FieldVerification.Verified": "Verified",
|
|
5
|
+
"FieldVerification.VerifiedFalse": "Verified False",
|
|
6
|
+
"Images.file-not-found": "File not found",
|
|
7
|
+
"POVerification.Encrypted": "Encrypted",
|
|
8
|
+
"POVerification.Expired": "Expired",
|
|
9
|
+
"POVerification.FullyVerified": "Fully Verified",
|
|
10
|
+
"POVerification.Loading": "Loading...",
|
|
11
|
+
"POVerification.NotVerified": "Not Verified",
|
|
12
|
+
"POVerification.PartiallyVerified": "Partially Verified",
|
|
13
|
+
"POVerification.VerifiedFalse": "Verified False",
|
|
14
|
+
"POVerificationBadge.safe-harbour-no": "Not Safe Harbour Compliant",
|
|
15
|
+
"POVerificationBadge.safe-harbour-yes": "Safe Harbour Compliant",
|
|
16
|
+
"POVerificationBadge.verified-by": "by {verifiedBy}",
|
|
17
|
+
"Report.footer-private": "Private and Confidential",
|
|
18
|
+
"Report.header": "{appName} Verification Report",
|
|
19
|
+
"Report.meta.title": "{appName} Verification Report - {iId}",
|
|
20
|
+
"Report.pagecount": "{currentPage} of {pageCount}",
|
|
21
|
+
"ValidationDisplay.text": "Score: {n}/10",
|
|
22
|
+
"VerifyBox.text": "To verify this submission, scan the QR Code or click here",
|
|
23
|
+
"constants.confirmation_code": "Code",
|
|
24
|
+
"constants.end_date": "Expiry Date",
|
|
25
|
+
"constants.i_id": "Submission ID",
|
|
26
|
+
"constants.reference": "Reference",
|
|
27
|
+
"constants.score": "Score",
|
|
28
|
+
"constants.score-category": "Score Category",
|
|
29
|
+
"constants.start_date": "Date Shared",
|
|
30
|
+
"field.boolean.no": "No",
|
|
31
|
+
"field.boolean.yes": "Yes",
|
|
32
|
+
"field.undefined": "N/A"
|
|
33
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import JsxPdf from "jsx-pdf";
|
|
2
1
|
import { FieldVerification } from "@raytio/types";
|
|
2
|
+
import { JsxPdf } from "../../helpers/jsxPdf.js";
|
|
3
3
|
import { loadAsset } from "../helpers/general.js";
|
|
4
4
|
export const FieldVerificationBadge = ({ status, width, }) => {
|
|
5
5
|
if (status === FieldVerification.VerifiedFalse) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import JsxPdf from "jsx-pdf";
|
|
2
1
|
import { uniq } from "ramda";
|
|
2
|
+
import { JsxPdf } from "../../helpers/jsxPdf.js";
|
|
3
3
|
import { assertSafeProperty } from "../../helpers/index.js";
|
|
4
4
|
import { IS_ARRAY_OF_OBJECTS, IS_IMAGE, transform, } from "../helpers/transform.js";
|
|
5
5
|
import { Images } from "./Images.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { POVerification } from "@raytio/types";
|
|
2
|
-
import JsxPdf from "
|
|
2
|
+
import { JsxPdf } from "../../helpers/jsxPdf.js";
|
|
3
3
|
import { $$ } from "../../locales/index.js";
|
|
4
4
|
import { loadAsset } from "../helpers/general.js";
|
|
5
5
|
import { PO_VER_TEXT_MAP } from "../../constants.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
|
-
import JsxPdf from "jsx-pdf";
|
|
3
2
|
import { isScoreResultValid } from "@raytio/core";
|
|
3
|
+
import { JsxPdf } from "../../helpers/jsxPdf.js";
|
|
4
4
|
import { $$ } from "../../locales/index.js";
|
|
5
5
|
import { classes } from "../style.js";
|
|
6
6
|
import { asset } from "../helpers/general.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldVerification } from "@raytio/types";
|
|
2
|
-
import JsxPdf from "
|
|
2
|
+
import { JsxPdf } from "../../helpers/jsxPdf.js";
|
|
3
3
|
import { $$ } from "../../locales/index.js";
|
|
4
4
|
import { FieldVerificationBadge } from "./FieldVerificationBadge.js";
|
|
5
5
|
export const Subheader = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import JsxPdf from "
|
|
1
|
+
import { JsxPdf } from "../../helpers/jsxPdf.js";
|
|
2
2
|
import { verifyColour } from "../helpers/general.js";
|
|
3
3
|
import { assertSafeProperty, isFieldValueFile, isPOFile, } from "../../helpers/index.js";
|
|
4
4
|
import { FieldVerificationBadge } from "./FieldVerificationBadge.js";
|
|
@@ -10,11 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { promises as fs } from "node:fs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import PdfPrinter from "pdfmake";
|
|
13
|
-
import
|
|
13
|
+
import JsxPdfImport from "jsx-pdf";
|
|
14
14
|
import { isValidLocale } from "../locales/index.js";
|
|
15
15
|
import { Report } from "../pdf/components/Report.js";
|
|
16
16
|
import { fonts } from "../pdf/style.js";
|
|
17
17
|
import { getDirname } from "../helpers/pathUtils.js";
|
|
18
|
+
const JsxPdf = (JsxPdfImport.default || JsxPdfImport);
|
|
18
19
|
export function generatePdfJson(data, DATE_FORMAT, TIMEZONE) {
|
|
19
20
|
return JsxPdf.renderPdf(JsxPdf.createElement(Report, { data: data.json, files: data.files, aId: data.a_id, clientUrl: data.client_url, envConfig: data.envConfig, config: { DATE_FORMAT, TIMEZONE } }));
|
|
20
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raytio/decrypt-helper",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.3",
|
|
4
4
|
"author": "Raytio",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A helper to decrypt data shared by Raytio users",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"dev-pdf": "
|
|
14
|
-
"build": "tsc && find dist -path \"*/__tests__*\" -delete && rm -rf dist/test",
|
|
13
|
+
"dev-pdf": "tsx src/test/pdf.tsx",
|
|
14
|
+
"build": "tsc && find dist -path \"*/__tests__*\" -delete && rm -rf dist/test && cp -r src/locales/translations dist/locales/",
|
|
15
15
|
"i18n": "react-intl-manager",
|
|
16
16
|
"lint": "eslint --ext .js,.ts,.tsx --color --ignore-path .gitignore .",
|
|
17
17
|
"test": "vitest"
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
"jsx-pdf": "^2.3.0",
|
|
31
31
|
"localstorage-polyfill": "^1.0.1",
|
|
32
32
|
"mime-types": "^2.1.35",
|
|
33
|
-
"pdfmake": "^0.
|
|
33
|
+
"pdfmake": "^0.1.59",
|
|
34
34
|
"ramda": "^0.30.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
+
"@babel/plugin-transform-react-jsx": "^7.0.0",
|
|
37
38
|
"@raytio/react-intl-manager": "^6.4.0",
|
|
38
39
|
"@types/jest-image-snapshot": "^6.3.0",
|
|
39
40
|
"@types/jsx-pdf": "^2.2.6",
|
|
@@ -44,12 +45,13 @@
|
|
|
44
45
|
"@vitest/ui": "^1.2.2",
|
|
45
46
|
"babel-preset-react-app": "^10.0.1",
|
|
46
47
|
"dotenv": "^16.3.1",
|
|
47
|
-
"eslint": "^8.
|
|
48
|
+
"eslint": "^8.57.0",
|
|
48
49
|
"eslint-config-kyle": "^18.0.1",
|
|
49
50
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
50
51
|
"jest-image-snapshot": "^6.3.0",
|
|
51
52
|
"pdf-to-img": "^2.1.2",
|
|
52
53
|
"ts-node": "^10.9.1",
|
|
54
|
+
"tsx": "^4.19.3",
|
|
53
55
|
"typescript": "^5.3.3",
|
|
54
56
|
"vitest": "^1.2.2"
|
|
55
57
|
},
|
|
@@ -102,4 +104,4 @@
|
|
|
102
104
|
"codeQualityReport": "tmp/codequality.json",
|
|
103
105
|
"moduleSourceName": false
|
|
104
106
|
}
|
|
105
|
-
}
|
|
107
|
+
}
|