@pixldocs/canvas-renderer 0.5.54 → 0.5.55

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.cjs CHANGED
@@ -11693,8 +11693,8 @@ function deriveRepeatablePagesFromTemplate(config, inlineFormSchema, formData) {
11693
11693
  return out;
11694
11694
  }
11695
11695
  async function resolveTemplateData(options) {
11696
- const { templateId, formData, supabaseUrl, supabaseAnonKey } = options;
11697
- const template = await fetchRow(supabaseUrl, supabaseAnonKey, "templates", templateId);
11696
+ const { templateId, formData, supabaseUrl, supabaseAnonKey, prefetched } = options;
11697
+ const template = (prefetched == null ? void 0 : prefetched.templateRow) ? prefetched.templateRow : await fetchRow(supabaseUrl, supabaseAnonKey, "templates", templateId);
11698
11698
  let config = template.config;
11699
11699
  const inlineFormSchema = template.form_schema;
11700
11700
  const defaultData = template.default_data;
@@ -11761,7 +11761,16 @@ async function resolveTemplateData(options) {
11761
11761
  }
11762
11762
  async function resolveFromForm(options) {
11763
11763
  var _a, _b, _c;
11764
- const { templateId, formSchemaId, sectionState, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
11764
+ const { templateId, formSchemaId, sectionState, flatFormData: directFlatFormData, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
11765
+ if (!formSchemaId) {
11766
+ return resolveTemplateData({
11767
+ templateId,
11768
+ formData: directFlatFormData ?? sectionState ?? {},
11769
+ supabaseUrl,
11770
+ supabaseAnonKey,
11771
+ prefetched: (prefetched == null ? void 0 : prefetched.templateRow) ? { templateRow: prefetched.templateRow } : void 0
11772
+ });
11773
+ }
11765
11774
  const [templateRow, formSchemaRow, defaultForm] = await Promise.all([
11766
11775
  (prefetched == null ? void 0 : prefetched.templateRow) ? Promise.resolve(prefetched.templateRow) : fetchRow(supabaseUrl, supabaseAnonKey, "templates", templateId),
11767
11776
  (prefetched == null ? void 0 : prefetched.formSchemaRow) !== void 0 ? Promise.resolve(prefetched.formSchemaRow) : fetchRow(supabaseUrl, supabaseAnonKey, "form_schemas", formSchemaId),