@pixldocs/canvas-renderer 0.3.16 → 0.3.17
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/canvasWatermark-BgiyK4gu.js +115 -0
- package/dist/canvasWatermark-BgiyK4gu.js.map +1 -0
- package/dist/canvasWatermark-C7Jk6O8G.cjs +115 -0
- package/dist/canvasWatermark-C7Jk6O8G.cjs.map +1 -0
- package/dist/index.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -203,6 +203,8 @@ export declare interface RenderFromFormOptions extends Omit<RenderOptions, 'page
|
|
|
203
203
|
formSchemaId: string;
|
|
204
204
|
sectionState: SectionFormState;
|
|
205
205
|
themeId?: string;
|
|
206
|
+
/** Whether to inject watermark on preview. Default: auto (true for paid templates, false for free). */
|
|
207
|
+
watermark?: boolean;
|
|
206
208
|
}
|
|
207
209
|
|
|
208
210
|
export declare interface RenderOptions {
|
|
@@ -235,6 +237,8 @@ export declare interface ResolvedTemplate {
|
|
|
235
237
|
config: TemplateConfig;
|
|
236
238
|
templateName: string;
|
|
237
239
|
templateId: string;
|
|
240
|
+
/** Template price — 0 = free, >0 = paid (watermark applies) */
|
|
241
|
+
price: number;
|
|
238
242
|
}
|
|
239
243
|
|
|
240
244
|
/**
|
package/dist/index.js
CHANGED
|
@@ -10074,7 +10074,7 @@ async function resolveTemplateData(options) {
|
|
|
10074
10074
|
const defaultData = template.default_data;
|
|
10075
10075
|
if (defaultData) config = applyFormDataSimple(config, defaultData);
|
|
10076
10076
|
if (formData && Object.keys(formData).length > 0) config = applyFormDataSimple(config, formData);
|
|
10077
|
-
return { config, templateName: template.name || "Untitled", templateId };
|
|
10077
|
+
return { config, templateName: template.name || "Untitled", templateId, price: template.price ?? 0 };
|
|
10078
10078
|
}
|
|
10079
10079
|
async function resolveFromForm(options) {
|
|
10080
10080
|
var _a, _b, _c, _d;
|
|
@@ -10215,7 +10215,8 @@ async function resolveFromForm(options) {
|
|
|
10215
10215
|
return {
|
|
10216
10216
|
config: resolvedConfig,
|
|
10217
10217
|
templateName: templateRow.name || "Untitled",
|
|
10218
|
-
templateId
|
|
10218
|
+
templateId,
|
|
10219
|
+
price: templateRow.price ?? 0
|
|
10219
10220
|
};
|
|
10220
10221
|
}
|
|
10221
10222
|
function flattenAll(nodes) {
|
|
@@ -10665,7 +10666,7 @@ class PixldocsRenderer {
|
|
|
10665
10666
|
* This is the primary external API for the package.
|
|
10666
10667
|
*/
|
|
10667
10668
|
async renderFromForm(options) {
|
|
10668
|
-
const { templateId, formSchemaId, sectionState, themeId, ...renderOpts } = options;
|
|
10669
|
+
const { templateId, formSchemaId, sectionState, themeId, watermark, ...renderOpts } = options;
|
|
10669
10670
|
const resolved = await resolveFromForm({
|
|
10670
10671
|
templateId,
|
|
10671
10672
|
formSchemaId,
|
|
@@ -10674,7 +10675,13 @@ class PixldocsRenderer {
|
|
|
10674
10675
|
supabaseUrl: this.config.supabaseUrl,
|
|
10675
10676
|
supabaseAnonKey: this.config.supabaseAnonKey
|
|
10676
10677
|
});
|
|
10677
|
-
|
|
10678
|
+
const shouldWatermark = watermark ?? resolved.price > 0;
|
|
10679
|
+
let configToRender = resolved.config;
|
|
10680
|
+
if (shouldWatermark) {
|
|
10681
|
+
const { injectWatermark } = await import("./canvasWatermark-BgiyK4gu.js");
|
|
10682
|
+
configToRender = injectWatermark(configToRender);
|
|
10683
|
+
}
|
|
10684
|
+
return this.renderAllPages(configToRender, renderOpts);
|
|
10678
10685
|
}
|
|
10679
10686
|
/**
|
|
10680
10687
|
* Convenience: fetch by ID with simple flat data and render.
|