@pixldocs/canvas-renderer 0.5.218 → 0.5.220
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/{index-D3NJNdX_.cjs → index-DRHaeOxK.cjs} +103 -16
- package/dist/{index-D3NJNdX_.cjs.map → index-DRHaeOxK.cjs.map} +1 -1
- package/dist/{index-CZk_GpIL.js → index-KtRZhEPi.js} +103 -16
- package/dist/{index-CZk_GpIL.js.map → index-KtRZhEPi.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +76 -0
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-som_tmDY.js → vectorPdfExport-D5bhT-57.js} +4 -4
- package/dist/{vectorPdfExport-som_tmDY.js.map → vectorPdfExport-D5bhT-57.js.map} +1 -1
- package/dist/{vectorPdfExport-CoZ-RUqL.cjs → vectorPdfExport-UBFTDrVt.cjs} +4 -4
- package/dist/{vectorPdfExport-CoZ-RUqL.cjs.map → vectorPdfExport-UBFTDrVt.cjs.map} +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-DRHaeOxK.cjs");
|
|
4
4
|
exports.DEPLOYMENT_VERSION_MARKER = index.DEPLOYMENT_VERSION_MARKER;
|
|
5
5
|
exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
|
|
6
6
|
exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
|
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,22 @@ export declare function collectImageUrls(config: TemplateConfig): string[];
|
|
|
97
97
|
*/
|
|
98
98
|
export declare function configHasAutoShrinkText(config: TemplateConfig | null | undefined): boolean;
|
|
99
99
|
|
|
100
|
+
export declare interface DeliveryChannelResult {
|
|
101
|
+
channel: 'email' | 'whatsapp' | string;
|
|
102
|
+
status: 'sent' | 'failed' | 'pending_setup';
|
|
103
|
+
error?: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Recipient info for delivery. */
|
|
107
|
+
export declare interface DeliveryRecipient {
|
|
108
|
+
/** Required for email delivery. */
|
|
109
|
+
email: string;
|
|
110
|
+
/** Used as "Hi {name}" in the email body. Optional. */
|
|
111
|
+
name?: string;
|
|
112
|
+
/** E.164 phone (e.g. "+919876543210"). Reserved for future WhatsApp delivery. */
|
|
113
|
+
phone?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
100
116
|
export declare const DEPLOYMENT_VERSION_MARKER: string;
|
|
101
117
|
|
|
102
118
|
export declare function dumpSvgTextDiagnostics(svgStr: string, pageIndex: number, tag: string, stage: string, maxItems?: number): void;
|
|
@@ -552,6 +568,28 @@ export declare class PixldocsRenderer {
|
|
|
552
568
|
* This is the primary PDF export API — mirrors renderFromForm() but returns a PDF.
|
|
553
569
|
*/
|
|
554
570
|
renderPdfFromForm(options: PdfFromFormOptions): Promise<PdfRenderResult>;
|
|
571
|
+
/**
|
|
572
|
+
* Render the template AND deliver the resulting PDF to the user — currently
|
|
573
|
+
* via email (SendGrid). The PDF is rendered server-side on EC2, uploaded to
|
|
574
|
+
* S3 (returned as `pdfUrl` for download fallback), and emailed with the PDF
|
|
575
|
+
* attached.
|
|
576
|
+
*
|
|
577
|
+
* Every delivery is logged in the `delivery_log` table for audit + admin
|
|
578
|
+
* resend. The same `pdfUrl` is returned to the caller so the host app can
|
|
579
|
+
* also offer a "Download" button on the success screen.
|
|
580
|
+
*
|
|
581
|
+
* ```ts
|
|
582
|
+
* const result = await renderer.renderAndDeliver({
|
|
583
|
+
* templateId, formSchemaId, sectionState,
|
|
584
|
+
* project: 'biomaker',
|
|
585
|
+
* recipient: { email: 'user@example.com', name: 'Anya' },
|
|
586
|
+
* });
|
|
587
|
+
* // → { jobId, pdfUrl, deliveries: [{ channel: 'email', status: 'sent' }] }
|
|
588
|
+
* ```
|
|
589
|
+
*
|
|
590
|
+
* Requires `RendererConfig.deliveryServerUrl` to be set.
|
|
591
|
+
*/
|
|
592
|
+
renderAndDeliver(options: RenderAndDeliverOptions): Promise<RenderAndDeliverResult>;
|
|
555
593
|
renderById(templateId: string, formData?: Record<string, any>, options?: RenderOptions): Promise<RenderResult>;
|
|
556
594
|
/**
|
|
557
595
|
* Convenience: fetch by ID with flat data and render ALL pages.
|
|
@@ -631,6 +669,38 @@ export declare interface PublishedTemplate {
|
|
|
631
669
|
updated_at: string;
|
|
632
670
|
}
|
|
633
671
|
|
|
672
|
+
/** Options for renderAndDeliver — renders the template and emails it to the recipient. */
|
|
673
|
+
export declare interface RenderAndDeliverOptions {
|
|
674
|
+
templateId: string;
|
|
675
|
+
formSchemaId: string;
|
|
676
|
+
sectionState: SectionFormState;
|
|
677
|
+
/**
|
|
678
|
+
* Project key — selects which sender profile (from address, subject, branding)
|
|
679
|
+
* the EC2 server uses. Currently supported: `'biomaker'`, `'pixldocs'`.
|
|
680
|
+
*/
|
|
681
|
+
project: 'biomaker' | 'pixldocs' | string;
|
|
682
|
+
recipient: DeliveryRecipient;
|
|
683
|
+
/** Delivery channels. Default: `['email']`. Future: `'whatsapp'`. */
|
|
684
|
+
channels?: Array<'email' | 'whatsapp'>;
|
|
685
|
+
themeId?: string;
|
|
686
|
+
/** Force watermark on/off. Default: server decides based on template price. */
|
|
687
|
+
watermark?: boolean;
|
|
688
|
+
/** Render scale 1–4 (default 2). */
|
|
689
|
+
scale?: number;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
export declare interface RenderAndDeliverResult {
|
|
693
|
+
/** Unique job ID — links all retries/resends of the same render. */
|
|
694
|
+
jobId: string;
|
|
695
|
+
/** Public/signed download URL of the rendered PDF on S3. */
|
|
696
|
+
pdfUrl: string;
|
|
697
|
+
/** S3 key (e.g. "deliveries/{jobId}.pdf"). */
|
|
698
|
+
s3Key?: string;
|
|
699
|
+
/** Per-channel delivery result. */
|
|
700
|
+
deliveries: DeliveryChannelResult[];
|
|
701
|
+
elapsedMs?: number;
|
|
702
|
+
}
|
|
703
|
+
|
|
634
704
|
export declare interface RendererConfig {
|
|
635
705
|
/** Supabase project URL for fetching templates */
|
|
636
706
|
supabaseUrl: string;
|
|
@@ -671,6 +741,12 @@ export declare interface RendererConfig {
|
|
|
671
741
|
* Default: auto-normalize data:image sources to `2048`; pass `0` to disable.
|
|
672
742
|
*/
|
|
673
743
|
maxImageEdgePx?: number;
|
|
744
|
+
/**
|
|
745
|
+
* Base URL of the PixlDocs PDF/delivery server (EC2). Required by
|
|
746
|
+
* `renderAndDeliver()`. Example: `'https://pdf.pixldocs.com'`. If omitted,
|
|
747
|
+
* `renderAndDeliver` will throw — the rest of the SDK works without it.
|
|
748
|
+
*/
|
|
749
|
+
deliveryServerUrl?: string;
|
|
674
750
|
}
|
|
675
751
|
|
|
676
752
|
/** Options for renderFromForm — matches the server API payload */
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5 } from "./index-
|
|
1
|
+
import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, M, b, N, O, Q, R, S, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5 } from "./index-KtRZhEPi.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEPLOYMENT_VERSION_MARKER,
|
|
4
4
|
F as FONT_FALLBACK_DEVANAGARI,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsPDF, ShadingPattern } from "jspdf";
|
|
2
2
|
import { svg2pdf } from "svg2pdf.js";
|
|
3
3
|
import * as fabric from "fabric";
|
|
4
|
-
import { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-
|
|
4
|
+
import { p as parseTextMarkdown, r as renderSmartElementToSvg, g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, b as getProxiedImageUrl, d as getImageProxyFetchOptions, A as API_URL, n as normalizeShapeType, i as isElement, e as isGroup, h as buildRoundedTrianglePath, j as hasEdgeFade, k as bakeEdgeFade, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-KtRZhEPi.js";
|
|
5
5
|
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-DhEaMTZl.js";
|
|
6
6
|
async function embedFontsForSvg(pdf, svgStr) {
|
|
7
7
|
var _a;
|
|
@@ -2955,7 +2955,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2955
2955
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2956
2956
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2957
2957
|
try {
|
|
2958
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2958
|
+
const { getNormalizedSvgUrl } = await import("./index-KtRZhEPi.js").then((n) => n.a6);
|
|
2959
2959
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2960
2960
|
} catch {
|
|
2961
2961
|
return null;
|
|
@@ -3764,7 +3764,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3764
3764
|
}
|
|
3765
3765
|
let fetchUrl = imageUrl;
|
|
3766
3766
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3767
|
-
const { isPrivateUrl } = await import("./index-
|
|
3767
|
+
const { isPrivateUrl } = await import("./index-KtRZhEPi.js").then((n) => n.a6);
|
|
3768
3768
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3769
3769
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3770
3770
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5865,4 +5865,4 @@ export {
|
|
|
5865
5865
|
preparePagesForExport,
|
|
5866
5866
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5867
5867
|
};
|
|
5868
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5868
|
+
//# sourceMappingURL=vectorPdfExport-D5bhT-57.js.map
|