qumra-engine 2.0.172 → 2.0.176

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.
@@ -10,8 +10,9 @@ function renderHandler(locals) {
10
10
  const render = locals?.render;
11
11
  const settings = locals?.env?.getGlobal("settings");
12
12
  const lang = locals?.lang;
13
+ console.log("🚀 ~ renderHandler ~ locals:", locals);
13
14
  const market = locals?.render?.globals?.market || locals?.market;
14
- const currency = market?.currency;
15
+ const currency = locals?.render?.globals?.currency;
15
16
  const localesPath = locals?.localesPath;
16
17
  let languages = [];
17
18
  if (localesPath && fs_1.default.existsSync(localesPath)) {
@@ -76,6 +76,7 @@ const prepareDataMiddleware = (req, res, next) => {
76
76
  next();
77
77
  })
78
78
  .catch((err) => {
79
+ console.log("🚀 ~ prepareDataMiddleware ~ err:", err);
79
80
  console.log("❌ prepareDataMiddleware error:", err.message);
80
81
  next(err);
81
82
  });
@@ -17,16 +17,11 @@ const renderMiddleware = (req, res, next) => {
17
17
  const pageLayout = env.getGlobal("pageData").layout ?? "layout";
18
18
  if (widgetId && jsonPreview === "true") {
19
19
  const overrideLayout = `{% content " " %}`;
20
- env.renderString(overrideLayout,
21
- // resolveTranslations(
22
- {
20
+ env.renderString(overrideLayout, {
23
21
  context,
24
22
  globals,
25
23
  ...renderData
26
- },
27
- // env.getGlobal("t")
28
- // ),
29
- (err, html) => {
24
+ }, (err, html) => {
30
25
  if (err) {
31
26
  return next(new Error(`❌ Nunjucks render error: ${err.message}`));
32
27
  }
@@ -41,16 +36,11 @@ const renderMiddleware = (req, res, next) => {
41
36
  });
42
37
  return;
43
38
  }
44
- env.render(`layouts/${pageLayout}.njk`,
45
- // resolveTranslations(
46
- {
39
+ env.render(`layouts/${pageLayout}.njk`, {
47
40
  context,
48
41
  globals,
49
42
  ...renderData
50
- },
51
- // env.getGlobal("t")
52
- // ),
53
- (err, html) => {
43
+ }, (err, html) => {
54
44
  if (err) {
55
45
  return next(new Error(`❌ Nunjucks render error: ${err.message}`));
56
46
  }
@@ -2,9 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validatePathForRender = void 0;
4
4
  const validatePathForRender = (filePath) => {
5
- // نشيل أي query string
6
5
  const path = filePath.split("?")[0].toLowerCase();
7
- const whitelistRegex = /^\/($|collections$|collection$|collection\/[^\/]+$|latest$|product\/[^\/]+$|blog\/[^\/]+$|cart$|search$|localize\/(lang|market|currency|search)$|auth\/(login|logout|verify|signup)$|checkout\/order$|order\/(buynow|create)$)/;
6
+ const whitelistRegex = /^\/($|collections$|collection$|collection\/[^\/]+$|latest$|blogs$|blog\/[^\/]+$|article\/[^\/]+$|product\/[^\/]+$|cart$|search$|localize\/(lang|market|currency|search)$|auth\/(login|logout|verify|signup)$|checkout\/order$|order\/(buynow|create)$)/;
8
7
  if (!whitelistRegex.test(path)) {
9
8
  return {
10
9
  allowed: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qumra-engine",
3
- "version": "2.0.172",
3
+ "version": "2.0.176",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {