qumra-engine 2.0.20 → 2.0.21
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.
|
@@ -5,16 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const nunjucks_1 = __importDefault(require("nunjucks"));
|
|
7
7
|
const normalizeWidgetPath_1 = require("../../utils/normalizeWidgetPath");
|
|
8
|
-
const getLocalWidgetData_1 = require("../../utils/getLocalWidgetData");
|
|
9
|
-
const mergeObjects_1 = require("../../utils/mergeObjects");
|
|
10
|
-
const resolveTranslations_1 = require("../../utils/resolveTranslations");
|
|
11
8
|
exports.default = new (class WidgetExtension {
|
|
12
9
|
constructor() {
|
|
13
10
|
this.tags = ["content"];
|
|
14
11
|
}
|
|
15
12
|
parse(parser, nodes) {
|
|
16
13
|
const tok = parser.nextToken();
|
|
17
|
-
const args = parser.parseSignature(true, true);
|
|
14
|
+
const args = parser.parseSignature(true, true);
|
|
18
15
|
parser.advanceAfterBlockEnd(tok.value);
|
|
19
16
|
return new nodes.CallExtension(this, "run", args);
|
|
20
17
|
}
|
|
@@ -22,11 +19,6 @@ exports.default = new (class WidgetExtension {
|
|
|
22
19
|
const widgets = env.getGlobal("widgets");
|
|
23
20
|
const renderedWidgets = [];
|
|
24
21
|
for (const widget of widgets) {
|
|
25
|
-
const finalDataFromLocal = (0, getLocalWidgetData_1.getLocalWidgetData)({
|
|
26
|
-
widget: widget.widget,
|
|
27
|
-
widgetPath: env.getGlobal("widgetsPath"),
|
|
28
|
-
}) ?? {};
|
|
29
|
-
const finalData = (0, mergeObjects_1.mergeObjects)(finalDataFromLocal, widget.data, "override") || {};
|
|
30
22
|
const widgetTemplatePath = (0, normalizeWidgetPath_1.normalizeWidgetPath)(widget.widget);
|
|
31
23
|
if (!widgetTemplatePath) {
|
|
32
24
|
return new nunjucks_1.default.runtime.SafeString(`
|
|
@@ -42,7 +34,7 @@ exports.default = new (class WidgetExtension {
|
|
|
42
34
|
widget: {
|
|
43
35
|
id: widget.id,
|
|
44
36
|
type: widget.widget,
|
|
45
|
-
data:
|
|
37
|
+
data: widget.data,
|
|
46
38
|
},
|
|
47
39
|
});
|
|
48
40
|
renderedWidgets.push(html);
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.mergeDataMiddleware = void 0;
|
|
4
4
|
const mergeDataMiddleware = async (req, res, next) => {
|
|
5
5
|
try {
|
|
6
|
-
const pageHandle = res.locals.render.context?.page.handle;
|
|
7
6
|
const widgets = res.locals.render.engine.page?.widgets ?? [];
|
|
8
7
|
res.locals.env.addGlobal("engineData", res.locals.render.engine);
|
|
9
8
|
res.locals.env.addGlobal("widgets", widgets);
|
|
@@ -13,6 +12,7 @@ const mergeDataMiddleware = async (req, res, next) => {
|
|
|
13
12
|
handle: res.locals.render.engine.page?.handle,
|
|
14
13
|
});
|
|
15
14
|
const settingsData = res.locals.render.engine.settings;
|
|
15
|
+
console.log("🚀 ~ settingsData:", settingsData);
|
|
16
16
|
res.locals.env.addGlobal("settings", settingsData);
|
|
17
17
|
next();
|
|
18
18
|
}
|