qumra-engine 2.0.94 → 2.0.96

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.
@@ -57,7 +57,7 @@ exports.default = new (class WidgetExtension {
57
57
  }
58
58
  if (isIframe) {
59
59
  renderedWidgets.push(`
60
- <section content-type="widget" widget-id="${widget._id}" id="qumra-widget-id-${widget._id}">
60
+ <section content-type="widget" widget-id="${widget._id}" id="qumra-widget-id-${widget._id}" template-key="main">
61
61
  ${html}
62
62
  </section>
63
63
  `);
@@ -279,7 +279,7 @@ exports.default = new (class SeoExtension {
279
279
 
280
280
  element.onclick = () => {
281
281
  window.parent.postMessage(
282
- { type: "widgetAction", action: "edit", widgetId: element.getAttribute("widget-id") },
282
+ { type: "widgetAction", action: "edit", widgetId: element.getAttribute("widget-id"), templateKey: element.getAttribute("template-key") },
283
283
  "*"
284
284
  );
285
285
  };
@@ -314,7 +314,7 @@ exports.default = new (class SeoExtension {
314
314
  const btnActions = {
315
315
  'btn-edit': el => {
316
316
  window.parent.postMessage(
317
- { type: "widgetAction", action: "edit", widgetId: el.getAttribute("widget-id") },
317
+ { type: "widgetAction", action: "edit", widgetId: el.getAttribute("widget-id"), templateKey: el.getAttribute("template-key") },
318
318
  "*"
319
319
  );
320
320
  },
@@ -322,7 +322,7 @@ exports.default = new (class SeoExtension {
322
322
 
323
323
  'btn-delete': el => {
324
324
  window.parent.postMessage(
325
- { type: "widgetAction", action: "delete", widgetId: el.getAttribute("widget-id") },
325
+ { type: "widgetAction", action: "delete", widgetId: el.getAttribute("widget-id"), templateKey: el.getAttribute("template-key") },
326
326
  "*"
327
327
  );
328
328
  }
@@ -29,7 +29,8 @@ exports.default = new (class WidgetExtension {
29
29
  `);
30
30
  }
31
31
  const templates = env.getGlobal("templates");
32
- const widgets = templates.find((t) => t.key === templateKey)?.widgets || [];
32
+ const template = templates.find((t) => t.key === templateKey);
33
+ const widgets = template?.widgets || [];
33
34
  const renderedWidgets = [];
34
35
  for (const widget of widgets) {
35
36
  const widgetTemplatePath = (0, normalizeWidgetPath_1.normalizeWidgetPath)(widget.widget);
@@ -57,7 +58,7 @@ exports.default = new (class WidgetExtension {
57
58
  }
58
59
  if (isIframe) {
59
60
  renderedWidgets.push(`
60
- <section widget-id="${widget._id}" id="qumra-widget-id-${widget._id}">
61
+ <section widget-id="${widget._id}" id="qumra-widget-id-${widget._id}" template-key="${templateKey}" >
61
62
  ${html}
62
63
  </section>
63
64
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "2.0.94",
3
+ "version": "2.0.96",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {