qumra-engine 2.0.144 → 2.0.146
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/config/initClient.d.ts +0 -0
- package/dist/config/initClient.js +46 -0
- package/dist/config/logger.d.ts +0 -0
- package/dist/config/logger.js +75 -0
- package/dist/controllers/article/create-comment.controller.d.ts +2 -0
- package/dist/controllers/article/create-comment.controller.js +17 -0
- package/dist/controllers/auth/activate-password-backignore.controller.d.ts +2 -0
- package/dist/controllers/auth/activate-password-backignore.controller.js +25 -0
- package/dist/controllers/auth/create-customer.controller.d.ts +2 -0
- package/dist/controllers/auth/create-customer.controller.js +24 -0
- package/dist/controllers/auth/customer-address.controller.d.ts +2 -0
- package/dist/controllers/auth/customer-address.controller.js +20 -0
- package/dist/controllers/auth/customer-login-verify.controller.d.ts +2 -0
- package/dist/controllers/auth/customer-login-verify.controller.js +21 -0
- package/dist/controllers/auth/customer-login.controller.d.ts +2 -0
- package/dist/controllers/auth/customer-login.controller.js +23 -0
- package/dist/controllers/auth/customer.controller.d.ts +2 -0
- package/dist/controllers/auth/customer.controller.js +25 -0
- package/dist/controllers/auth/guest-login-backignore.controller.d.ts +2 -0
- package/dist/controllers/auth/guest-login-backignore.controller.js +25 -0
- package/dist/controllers/auth/recover-password-backignore.controller.d.ts +2 -0
- package/dist/controllers/auth/recover-password-backignore.controller.js +26 -0
- package/dist/controllers/auth/reset-password-backignore.controller.d.ts +2 -0
- package/dist/controllers/auth/reset-password-backignore.controller.js +25 -0
- package/dist/controllers/auth/storefront-password-backignore.controller.d.ts +2 -0
- package/dist/controllers/auth/storefront-password-backignore.controller.js +25 -0
- package/dist/controllers/cart/add-to-cart.controller.d.ts +2 -0
- package/dist/controllers/cart/add-to-cart.controller.js +20 -0
- package/dist/controllers/cart/update-cart.controller.d.ts +2 -0
- package/dist/controllers/cart/update-cart.controller.js +26 -0
- package/dist/controllers/checkout/checkout.controller.d.ts +2 -0
- package/dist/controllers/checkout/checkout.controller.js +23 -0
- package/dist/controllers/contact/contact.controller.d.ts +2 -0
- package/dist/controllers/contact/contact.controller.js +20 -0
- package/dist/controllers/localize/currency.controller.d.ts +2 -0
- package/dist/controllers/localize/currency.controller.js +17 -0
- package/dist/controllers/localize/lang.controller.d.ts +2 -0
- package/dist/controllers/localize/lang.controller.js +18 -0
- package/dist/controllers/localize/market.controller.d.ts +2 -0
- package/dist/controllers/localize/market.controller.js +17 -0
- package/dist/extensions/Iteration/break.d.ts +9 -0
- package/dist/extensions/Iteration/break.js +23 -0
- package/dist/extensions/Iteration/continue.d.ts +2 -0
- package/dist/extensions/Iteration/continue.js +10 -0
- package/dist/extensions/{logic/form.d.ts → Iteration/cycle.d.ts} +1 -2
- package/dist/extensions/Iteration/cycle.js +26 -0
- package/dist/extensions/Iteration/forx.d.ts +6 -0
- package/dist/extensions/Iteration/forx.js +69 -0
- package/dist/extensions/Iteration/index.d.ts +2 -0
- package/dist/extensions/Iteration/index.js +10 -0
- package/dist/extensions/html/form.d.ts +13 -0
- package/dist/extensions/html/form.js +77 -0
- package/dist/extensions/html/index.d.ts +2 -0
- package/dist/extensions/html/index.js +10 -0
- package/dist/extensions/html/style.d.ts +7 -0
- package/dist/extensions/html/style.js +26 -0
- package/dist/extensions/index.d.ts +3 -11
- package/dist/extensions/index.js +16 -25
- package/dist/extensions/logic/all_products.d.ts +6 -0
- package/dist/extensions/logic/all_products.js +55 -0
- package/dist/extensions/logic/content.js +3 -0
- package/dist/extensions/logic/echo.d.ts +7 -0
- package/dist/extensions/logic/echo.js +22 -0
- package/dist/extensions/logic/index.d.ts +12 -0
- package/dist/extensions/logic/index.js +31 -0
- package/dist/extensions/logic/log.d.ts +6 -0
- package/dist/extensions/logic/log.js +26 -0
- package/dist/extensions/logic/seo.js +0 -2
- package/dist/extensions/logic/template.js +3 -0
- package/dist/extensions/logic/ui.js +4 -1
- package/dist/extensions/registerAllExtensions.d.ts +1 -1
- package/dist/extensions/registerAllExtensions.js +7 -5
- package/dist/filters/index.d.ts +10 -10
- package/dist/filters/index.js +25 -21
- package/dist/filters/logic/array/find_index.d.ts +1 -0
- package/dist/filters/logic/array/find_index.js +8 -0
- package/dist/filters/logic/array/has.d.ts +1 -0
- package/dist/filters/logic/array/has.js +9 -0
- package/dist/filters/logic/array/index.d.ts +19 -0
- package/dist/filters/logic/array/index.js +44 -0
- package/dist/filters/logic/array/map.d.ts +1 -0
- package/dist/filters/logic/array/map.js +9 -0
- package/dist/filters/logic/array/reject.d.ts +1 -0
- package/dist/filters/logic/array/reject.js +15 -0
- package/dist/filters/logic/array/reverse.d.ts +1 -0
- package/dist/filters/logic/array/reverse.js +9 -0
- package/dist/filters/logic/array/sort.d.ts +1 -0
- package/dist/filters/logic/array/sort.js +20 -0
- package/dist/filters/logic/array/sort_natural.d.ts +1 -0
- package/dist/filters/logic/array/sort_natural.js +20 -0
- package/dist/filters/logic/array/sum.d.ts +1 -0
- package/dist/filters/logic/array/sum.js +9 -0
- package/dist/filters/logic/array/uniq.d.ts +1 -0
- package/dist/filters/logic/array/uniq.js +9 -0
- package/dist/filters/logic/array/uniq_by.d.ts +1 -0
- package/dist/filters/logic/array/uniq_by.js +29 -0
- package/dist/filters/logic/cart/index.d.ts +2 -0
- package/dist/filters/logic/cart/index.js +10 -0
- package/dist/filters/logic/cart/item_count_for_variant.d.ts +1 -0
- package/dist/filters/logic/cart/item_count_for_variant.js +11 -0
- package/dist/filters/logic/cart/line_items_for.d.ts +1 -0
- package/dist/filters/logic/cart/line_items_for.js +15 -0
- package/dist/filters/logic/colors/brightness_difference.d.ts +1 -0
- package/dist/filters/logic/colors/brightness_difference.js +12 -0
- package/dist/filters/logic/colors/color_brightness.d.ts +1 -0
- package/dist/filters/logic/colors/color_brightness.js +7 -0
- package/dist/filters/logic/colors/color_contrast.d.ts +1 -0
- package/dist/filters/logic/colors/color_contrast.js +12 -0
- package/dist/filters/logic/colors/color_darken.d.ts +1 -0
- package/dist/filters/logic/colors/color_darken.js +7 -0
- package/dist/filters/logic/colors/color_desaturate.d.ts +1 -0
- package/dist/filters/logic/colors/color_desaturate.js +7 -0
- package/dist/filters/logic/colors/color_difference.d.ts +1 -0
- package/dist/filters/logic/colors/color_difference.js +12 -0
- package/dist/filters/logic/colors/color_extract.d.ts +1 -0
- package/dist/filters/logic/colors/color_extract.js +22 -0
- package/dist/filters/logic/colors/color_lighten.d.ts +1 -0
- package/dist/filters/logic/colors/color_lighten.js +7 -0
- package/dist/filters/logic/colors/color_mix.d.ts +1 -0
- package/dist/filters/logic/colors/color_mix.js +12 -0
- package/dist/filters/logic/colors/color_modify.d.ts +1 -0
- package/dist/filters/logic/colors/color_modify.js +26 -0
- package/dist/filters/logic/colors/color_saturate.d.ts +1 -0
- package/dist/filters/logic/colors/color_saturate.js +7 -0
- package/dist/filters/logic/colors/color_to_hsl.d.ts +1 -0
- package/dist/filters/logic/colors/color_to_hsl.js +7 -0
- package/dist/filters/logic/colors/color_to_oklch.d.ts +1 -0
- package/dist/filters/logic/colors/color_to_oklch.js +12 -0
- package/dist/filters/logic/colors/color_to_rgb.d.ts +1 -0
- package/dist/filters/logic/colors/color_to_rgb.js +7 -0
- package/dist/filters/logic/colors/hex_to_rgba.d.ts +1 -0
- package/dist/filters/logic/colors/hex_to_rgba.js +7 -0
- package/dist/filters/logic/colors/index.d.ts +16 -0
- package/dist/filters/logic/colors/index.js +38 -0
- package/dist/filters/logic/customer/customer_login_link.d.ts +2 -0
- package/dist/filters/logic/customer/customer_login_link.js +10 -0
- package/dist/filters/logic/customer/customer_logout_link.d.ts +2 -0
- package/dist/filters/logic/customer/customer_logout_link.js +10 -0
- package/dist/filters/logic/customer/customer_register_link.d.ts +2 -0
- package/dist/filters/logic/customer/customer_register_link.js +10 -0
- package/dist/filters/logic/customer/index.d.ts +4 -0
- package/dist/filters/logic/customer/index.js +14 -0
- package/dist/filters/logic/customer/login_button.d.ts +7 -0
- package/dist/filters/logic/customer/login_button.js +39 -0
- package/dist/filters/logic/default/default_pagination.d.ts +10 -0
- package/dist/filters/logic/default/default_pagination.js +41 -0
- package/dist/filters/logic/default/index.d.ts +1 -0
- package/dist/filters/logic/default/index.js +8 -0
- package/dist/filters/logic/format/date.d.ts +1 -0
- package/dist/filters/logic/format/date.js +13 -0
- package/dist/filters/logic/format/index.d.ts +4 -0
- package/dist/filters/logic/format/index.js +14 -0
- package/dist/filters/logic/format/structured_data.d.ts +2 -0
- package/dist/filters/logic/format/structured_data.js +11 -0
- package/dist/filters/logic/format/unit_price_with_measurement.d.ts +1 -0
- package/dist/filters/logic/format/unit_price_with_measurement.js +9 -0
- package/dist/filters/logic/format/weight_with_unit.d.ts +1 -0
- package/dist/filters/logic/format/weight_with_unit.js +12 -0
- package/dist/filters/logic/html/highlight.d.ts +1 -0
- package/dist/filters/logic/html/highlight.js +22 -0
- package/dist/filters/logic/html/index.d.ts +7 -0
- package/dist/filters/logic/html/index.js +20 -0
- package/dist/filters/logic/html/link_to.d.ts +8 -0
- package/dist/filters/logic/html/link_to.js +30 -0
- package/dist/filters/logic/html/placeholder_svg_tag.d.ts +7 -0
- package/dist/filters/logic/html/placeholder_svg_tag.js +28 -0
- package/dist/filters/logic/html/preload_tag.d.ts +7 -0
- package/dist/filters/logic/html/preload_tag.js +27 -0
- package/dist/filters/logic/html/script_tag.d.ts +7 -0
- package/dist/filters/logic/html/script_tag.js +30 -0
- package/dist/filters/logic/html/stylesheet_tag.d.ts +8 -0
- package/dist/filters/logic/html/stylesheet_tag.js +29 -0
- package/dist/filters/logic/html/time_tag.d.ts +7 -0
- package/dist/filters/logic/html/time_tag.js +28 -0
- package/dist/filters/logic/localization/currency_selector.d.ts +7 -0
- package/dist/filters/logic/localization/currency_selector.js +54 -0
- package/dist/filters/logic/localization/format_address.d.ts +13 -0
- package/dist/filters/logic/localization/format_address.js +51 -0
- package/dist/filters/logic/localization/index.d.ts +2 -0
- package/dist/filters/logic/localization/index.js +10 -0
- package/dist/filters/logic/math/abs.d.ts +1 -0
- package/dist/filters/logic/math/abs.js +9 -0
- package/dist/filters/logic/math/at_least.d.ts +1 -0
- package/dist/filters/logic/math/at_least.js +10 -0
- package/dist/filters/logic/math/at_most.d.ts +1 -0
- package/dist/filters/logic/math/at_most.js +10 -0
- package/dist/filters/logic/math/ceil.d.ts +1 -0
- package/dist/filters/logic/math/ceil.js +9 -0
- package/dist/filters/logic/math/divided_by.d.ts +1 -0
- package/dist/filters/logic/math/divided_by.js +10 -0
- package/dist/filters/logic/math/floor.d.ts +1 -0
- package/dist/filters/logic/math/floor.js +9 -0
- package/dist/filters/logic/math/index.d.ts +11 -0
- package/dist/filters/logic/math/index.js +28 -0
- package/dist/filters/logic/math/minus.d.ts +1 -0
- package/dist/filters/logic/math/minus.js +10 -0
- package/dist/filters/logic/math/modulo.d.ts +1 -0
- package/dist/filters/logic/math/modulo.js +10 -0
- package/dist/filters/logic/math/plus.d.ts +1 -0
- package/dist/filters/logic/math/plus.js +10 -0
- package/dist/filters/logic/math/round.d.ts +1 -0
- package/dist/filters/logic/math/round.js +10 -0
- package/dist/filters/logic/math/times.d.ts +1 -0
- package/dist/filters/logic/math/times.js +10 -0
- package/dist/filters/logic/media/external_video_tag.d.ts +11 -0
- package/dist/filters/logic/media/external_video_tag.js +16 -0
- package/dist/filters/logic/media/external_video_url.d.ts +6 -0
- package/dist/filters/logic/media/external_video_url.js +12 -0
- package/dist/filters/logic/media/image_tag.d.ts +11 -0
- package/dist/filters/logic/media/image_tag.js +30 -0
- package/dist/filters/logic/media/image_url.d.ts +9 -0
- package/dist/filters/logic/media/image_url.js +8 -0
- package/dist/filters/logic/media/index.d.ts +8 -0
- package/dist/filters/logic/media/index.js +22 -0
- package/dist/filters/logic/media/media_tag.d.ts +8 -0
- package/dist/filters/logic/media/media_tag.js +25 -0
- package/dist/filters/logic/media/model_viewer_tag.d.ts +7 -0
- package/dist/filters/logic/media/model_viewer_tag.js +14 -0
- package/dist/filters/logic/media/video_tag.d.ts +11 -0
- package/dist/filters/logic/media/video_tag.js +14 -0
- package/dist/filters/logic/syntax/echo.d.ts +1 -0
- package/dist/filters/logic/syntax/echo.js +8 -0
- package/dist/functions/set-optional-param.d.ts +1 -0
- package/dist/functions/set-optional-param.js +11 -0
- package/dist/globals/index.d.ts +1 -0
- package/dist/globals/index.js +3 -1
- package/dist/globals/logic/all_products.d.ts +7 -0
- package/dist/globals/logic/all_products.js +43 -0
- package/dist/graphql/index.d.ts +3 -0
- package/dist/graphql/index.js +40 -0
- package/dist/graphql/mutation/createCustomerAddresses.d.ts +2 -0
- package/dist/graphql/mutation/createCustomerAddresses.js +32 -0
- package/dist/graphql/mutation/customerLogin.d.ts +2 -0
- package/dist/graphql/mutation/customerLogin.js +11 -0
- package/dist/graphql/mutation/customerSignup.d.ts +2 -0
- package/dist/graphql/mutation/customerSignup.js +10 -0
- package/dist/graphql/mutation/customerVerifyOtp.d.ts +2 -0
- package/dist/graphql/mutation/customerVerifyOtp.js +13 -0
- package/dist/graphql/mutation/index.d.ts +5 -0
- package/dist/graphql/mutation/index.js +14 -0
- package/dist/graphql/query/findAllProducts.d.ts +2 -0
- package/dist/graphql/query/findAllProducts.js +93 -0
- package/dist/graphql/query/index.d.ts +2 -0
- package/dist/graphql/query/index.js +8 -0
- package/dist/index.local.d.ts +1 -0
- package/dist/index.local.js +11 -0
- package/dist/middleware/init.middleware.js +16 -0
- package/dist/middleware/locals.middleware.js +1 -1
- package/dist/middleware/prepareData.middleware.js +13 -17
- package/dist/middleware/render.middleware.js +6 -0
- package/dist/middleware/setGlobals.middleware.js +5 -0
- package/dist/middleware.d.ts +1 -1
- package/dist/middleware.js +33 -49
- package/dist/routers/dev/index.js +5 -0
- package/dist/routers/production/auth/index.d.ts +2 -0
- package/dist/routers/production/auth/index.js +16 -0
- package/dist/routers/production/auth/login/index.d.ts +2 -0
- package/dist/routers/production/auth/login/index.js +7 -0
- package/dist/routers/production/auth/logout/index.d.ts +2 -0
- package/dist/routers/production/auth/logout/index.js +8 -0
- package/dist/routers/production/auth/signup/index.d.ts +2 -0
- package/dist/routers/production/auth/signup/index.js +7 -0
- package/dist/routers/production/auth/verify/index.d.ts +2 -0
- package/dist/routers/production/auth/verify/index.js +7 -0
- package/dist/routers/production/cart/add/index.d.ts +2 -0
- package/dist/routers/production/cart/add/index.js +7 -0
- package/dist/routers/production/cart/index.d.ts +2 -0
- package/dist/routers/production/cart/index.js +12 -0
- package/dist/routers/production/cart/update/index.d.ts +2 -0
- package/dist/routers/production/cart/update/index.js +7 -0
- package/dist/routers/production/checkout/buy-now/index.d.ts +2 -0
- package/dist/routers/production/checkout/buy-now/index.js +7 -0
- package/dist/routers/production/checkout/create-order/index.d.ts +2 -0
- package/dist/routers/production/checkout/create-order/index.js +7 -0
- package/dist/routers/production/checkout/index.d.ts +2 -0
- package/dist/routers/production/checkout/index.js +12 -0
- package/dist/routers/production/index.d.ts +2 -0
- package/dist/routers/production/index.js +14 -0
- package/dist/routers/production/localize/currency/index.d.ts +2 -0
- package/dist/routers/production/localize/currency/index.js +7 -0
- package/dist/routers/production/localize/index.d.ts +2 -0
- package/dist/routers/production/localize/index.js +14 -0
- package/dist/routers/production/localize/lang/index.d.ts +2 -0
- package/dist/routers/production/localize/lang/index.js +7 -0
- package/dist/routers/production/localize/market/index.d.ts +2 -0
- package/dist/routers/production/localize/market/index.js +7 -0
- package/dist/utils/axios.d.ts +10 -0
- package/dist/utils/axios.js +25 -0
- package/dist/utils/client.d.ts +2 -0
- package/dist/utils/client.js +23 -0
- package/package.json +6 -1
- package/dist/controllers/auth/login.d.ts +0 -2
- package/dist/controllers/auth/login.js +0 -21
- package/dist/extensions/logic/form.js +0 -41
- package/dist/routers/index.js +0 -10
- /package/dist/controllers/auth/{logout.d.ts → logout.controller.d.ts} +0 -0
- /package/dist/controllers/auth/{logout.js → logout.controller.js} +0 -0
- /package/dist/routers/{index.d.ts → dev/index.d.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = setOptionalParam;
|
|
4
|
+
function setOptionalParam(params, key, value) {
|
|
5
|
+
if (value !== undefined && value !== null && value !== "") {
|
|
6
|
+
params.set(key, String(value));
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
params.delete(key);
|
|
10
|
+
}
|
|
11
|
+
}
|
package/dist/globals/index.d.ts
CHANGED
package/dist/globals/index.js
CHANGED
|
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.t = void 0;
|
|
6
|
+
exports.all_products = exports.t = void 0;
|
|
7
7
|
var t_1 = require("./logic/t");
|
|
8
8
|
Object.defineProperty(exports, "t", { enumerable: true, get: function () { return __importDefault(t_1).default; } });
|
|
9
|
+
var all_products_1 = require("./logic/all_products");
|
|
10
|
+
Object.defineProperty(exports, "all_products", { enumerable: true, get: function () { return __importDefault(all_products_1).default; } });
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = all_products;
|
|
4
|
+
const client_js_1 = require("../../utils/client.js");
|
|
5
|
+
const index_js_1 = require("../../graphql/index.js");
|
|
6
|
+
/**
|
|
7
|
+
* ✅ دالة all_products
|
|
8
|
+
* - تجلب المنتجات من الـ GraphQL API
|
|
9
|
+
* - تنظف المدخلات وتقبل فقط المفاتيح المسموح بها
|
|
10
|
+
* - آمنة تمامًا للاستخدام في Nunjucks أو Node.js
|
|
11
|
+
*/
|
|
12
|
+
function all_products(args = {}) {
|
|
13
|
+
// ✅ تأكد أن args كائن صالح
|
|
14
|
+
if (!args || typeof args !== "object" || Array.isArray(args)) {
|
|
15
|
+
args = {};
|
|
16
|
+
}
|
|
17
|
+
const client = (0, client_js_1.getGqlClient)();
|
|
18
|
+
// ✅ تنظيف المدخلات من أي مفاتيح غير مصرح بها
|
|
19
|
+
const cleanInput = (input) => {
|
|
20
|
+
const allowedKeys = ["collection", "limit", "page", "sort", "status", "title"];
|
|
21
|
+
const cleaned = {};
|
|
22
|
+
for (const key of allowedKeys) {
|
|
23
|
+
const value = input[key];
|
|
24
|
+
if (value !== undefined && value !== "__keywords") {
|
|
25
|
+
cleaned[key] = value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return cleaned;
|
|
29
|
+
};
|
|
30
|
+
const cleanedInput = cleanInput(args);
|
|
31
|
+
// ✅ استعلام GraphQL
|
|
32
|
+
return client.request(index_js_1.query.findAllProducts, {
|
|
33
|
+
input: cleanedInput,
|
|
34
|
+
}).then((data) => {
|
|
35
|
+
// ✅ استخراج النتائج
|
|
36
|
+
const products = data?.findAllProducts?.data ?? [];
|
|
37
|
+
console.log("🚀 ~ all_products ~ products:", products);
|
|
38
|
+
return products;
|
|
39
|
+
}).catch((error) => {
|
|
40
|
+
console.error("Error in all_products then/catch:", error);
|
|
41
|
+
return [];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.query = exports.mutation = void 0;
|
|
37
|
+
const mutation = __importStar(require("./mutation"));
|
|
38
|
+
exports.mutation = mutation;
|
|
39
|
+
const query = __importStar(require("./query"));
|
|
40
|
+
exports.query = query;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_request_1 = require("graphql-request");
|
|
4
|
+
exports.default = (0, graphql_request_1.gql) `mutation CreateCustomerAddresses($input: CreateCustomerAddressInput!) {
|
|
5
|
+
createCustomerAddresses(input: $input) {
|
|
6
|
+
success
|
|
7
|
+
message
|
|
8
|
+
data {
|
|
9
|
+
_id
|
|
10
|
+
country {
|
|
11
|
+
_id
|
|
12
|
+
name
|
|
13
|
+
image {
|
|
14
|
+
image
|
|
15
|
+
imageUrl
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
city {
|
|
19
|
+
_id
|
|
20
|
+
name
|
|
21
|
+
}
|
|
22
|
+
neighborhood
|
|
23
|
+
street
|
|
24
|
+
zipCode
|
|
25
|
+
description
|
|
26
|
+
account
|
|
27
|
+
device
|
|
28
|
+
app
|
|
29
|
+
deleted
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_request_1 = require("graphql-request");
|
|
4
|
+
exports.default = (0, graphql_request_1.gql) `mutation CustomerLogin($input: CustomerLoginInput!) {
|
|
5
|
+
customerLogin(input: $input) {
|
|
6
|
+
success
|
|
7
|
+
message
|
|
8
|
+
token
|
|
9
|
+
data
|
|
10
|
+
}
|
|
11
|
+
}`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_request_1 = require("graphql-request");
|
|
4
|
+
exports.default = (0, graphql_request_1.gql) `mutation CustomerSignup($input: CustomerSignupInput!) {
|
|
5
|
+
customerSignup(input: $input) {
|
|
6
|
+
success
|
|
7
|
+
message
|
|
8
|
+
token
|
|
9
|
+
}
|
|
10
|
+
}`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_request_1 = require("graphql-request");
|
|
4
|
+
exports.default = (0, graphql_request_1.gql) `
|
|
5
|
+
mutation CustomerVerifyOtp($input: CustomerVerifyOtpInput!) {
|
|
6
|
+
customerVerifyOtp(input: $input) {
|
|
7
|
+
success
|
|
8
|
+
message
|
|
9
|
+
accessToken
|
|
10
|
+
data
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import createCustomerAddresses from './createCustomerAddresses';
|
|
2
|
+
import customerLogin from './customerLogin';
|
|
3
|
+
import customerSignup from './customerSignup';
|
|
4
|
+
import customerVerifyOtp from './customerVerifyOtp';
|
|
5
|
+
export { customerLogin, customerVerifyOtp, customerSignup, createCustomerAddresses };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createCustomerAddresses = exports.customerSignup = exports.customerVerifyOtp = exports.customerLogin = void 0;
|
|
7
|
+
const createCustomerAddresses_1 = __importDefault(require("./createCustomerAddresses"));
|
|
8
|
+
exports.createCustomerAddresses = createCustomerAddresses_1.default;
|
|
9
|
+
const customerLogin_1 = __importDefault(require("./customerLogin"));
|
|
10
|
+
exports.customerLogin = customerLogin_1.default;
|
|
11
|
+
const customerSignup_1 = __importDefault(require("./customerSignup"));
|
|
12
|
+
exports.customerSignup = customerSignup_1.default;
|
|
13
|
+
const customerVerifyOtp_1 = __importDefault(require("./customerVerifyOtp"));
|
|
14
|
+
exports.customerVerifyOtp = customerVerifyOtp_1.default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const graphql_request_1 = require("graphql-request");
|
|
4
|
+
exports.default = (0, graphql_request_1.gql) `
|
|
5
|
+
query FindAllProducts($input: GetAllProductsInput) {
|
|
6
|
+
findAllProducts(input: $input) {
|
|
7
|
+
success
|
|
8
|
+
message
|
|
9
|
+
data {
|
|
10
|
+
_id
|
|
11
|
+
title
|
|
12
|
+
slug
|
|
13
|
+
description
|
|
14
|
+
app
|
|
15
|
+
tags
|
|
16
|
+
status
|
|
17
|
+
publishedAt
|
|
18
|
+
images {
|
|
19
|
+
_id
|
|
20
|
+
fileUrl
|
|
21
|
+
}
|
|
22
|
+
collections {
|
|
23
|
+
_id
|
|
24
|
+
image {
|
|
25
|
+
_id
|
|
26
|
+
fileUrl
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
pricing {
|
|
31
|
+
compareAtPrice
|
|
32
|
+
originalPrice
|
|
33
|
+
price
|
|
34
|
+
}
|
|
35
|
+
variantsCount
|
|
36
|
+
dimensions {
|
|
37
|
+
height
|
|
38
|
+
length
|
|
39
|
+
width
|
|
40
|
+
}
|
|
41
|
+
weight {
|
|
42
|
+
unit
|
|
43
|
+
weight
|
|
44
|
+
}
|
|
45
|
+
variants {
|
|
46
|
+
_id
|
|
47
|
+
product
|
|
48
|
+
options {
|
|
49
|
+
label
|
|
50
|
+
_id
|
|
51
|
+
}
|
|
52
|
+
images {
|
|
53
|
+
_id
|
|
54
|
+
fileUrl
|
|
55
|
+
}
|
|
56
|
+
identification {
|
|
57
|
+
sku
|
|
58
|
+
barcode
|
|
59
|
+
barcodeType
|
|
60
|
+
hsCode
|
|
61
|
+
countryOfOrigin
|
|
62
|
+
mpn
|
|
63
|
+
}
|
|
64
|
+
pricing {
|
|
65
|
+
price
|
|
66
|
+
compareAtPrice
|
|
67
|
+
originalPrice
|
|
68
|
+
discount {
|
|
69
|
+
discountType
|
|
70
|
+
discountValue
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
quantity
|
|
74
|
+
dimensions {
|
|
75
|
+
height
|
|
76
|
+
width
|
|
77
|
+
length
|
|
78
|
+
}
|
|
79
|
+
weight {
|
|
80
|
+
unit
|
|
81
|
+
weight
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
currency {
|
|
86
|
+
currencyCode
|
|
87
|
+
}
|
|
88
|
+
pagination {
|
|
89
|
+
limit
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.findAllProducts = void 0;
|
|
7
|
+
const findAllProducts_1 = __importDefault(require("./findAllProducts"));
|
|
8
|
+
exports.findAllProducts = findAllProducts_1.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const middleware_1 = __importDefault(require("./middleware"));
|
|
7
|
+
(0, middleware_1.default)({
|
|
8
|
+
mode: "devlopment",
|
|
9
|
+
port: 4000,
|
|
10
|
+
renderApi: null,
|
|
11
|
+
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initMiddleware = void 0;
|
|
4
4
|
const qumra_utils_1 = require("qumra-utils");
|
|
5
|
+
const globals_1 = require("../store/globals");
|
|
5
6
|
const initMiddleware = ({ mode, getRender, setRender, app, renderApi, market, }) => {
|
|
6
7
|
return (req, res, next) => {
|
|
7
8
|
res.locals.mode = mode;
|
|
@@ -25,12 +26,27 @@ const initMiddleware = ({ mode, getRender, setRender, app, renderApi, market, })
|
|
|
25
26
|
Boolean(req.query?.preview) ?? false;
|
|
26
27
|
}
|
|
27
28
|
res.locals.renderApi = renderApi ?? "https://store-gate.qumra.cloud";
|
|
29
|
+
res.locals.app = app;
|
|
30
|
+
if (app) {
|
|
31
|
+
(0, globals_1.setGlobal)('app', app);
|
|
32
|
+
}
|
|
28
33
|
if (typeof getRender === "function") {
|
|
29
34
|
res.locals.cache.getRender = getRender;
|
|
30
35
|
}
|
|
31
36
|
if (typeof setRender === "function") {
|
|
32
37
|
res.locals.cache.setRender = setRender;
|
|
33
38
|
}
|
|
39
|
+
const langCookie = req.cookies.lang;
|
|
40
|
+
console.log("🚀 ~ initMiddleware ~ langCookie:", langCookie);
|
|
41
|
+
const currencyCookie = req.cookies.currency;
|
|
42
|
+
console.log("🚀 ~ initMiddleware ~ currencyCookie:", currencyCookie);
|
|
43
|
+
const marketCookie = req.cookies.market;
|
|
44
|
+
console.log("🚀 ~ initMiddleware ~ marketCookie:", marketCookie);
|
|
45
|
+
if (langCookie || currencyCookie || marketCookie) {
|
|
46
|
+
res.locals.lang = langCookie;
|
|
47
|
+
res.locals.currency = currencyCookie;
|
|
48
|
+
res.locals.market = marketCookie;
|
|
49
|
+
}
|
|
34
50
|
next();
|
|
35
51
|
};
|
|
36
52
|
};
|
|
@@ -9,7 +9,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const locals_1 = require("../store/locals");
|
|
10
10
|
const localesMiddleware = (req, res, next) => {
|
|
11
11
|
const localesDirectory = res.locals.localesPath;
|
|
12
|
-
const lang = res.locals.parsedUrl.language;
|
|
12
|
+
const lang = res.locals.lang || res.locals.parsedUrl.language;
|
|
13
13
|
if (!lang)
|
|
14
14
|
return next();
|
|
15
15
|
try {
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.prepareDataMiddleware = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const set_optional_param_1 = __importDefault(require("../functions/set-optional-param"));
|
|
8
9
|
const prepareDataMiddleware = (req, res, next) => {
|
|
9
10
|
const parsedUrl = res.locals.parsedUrl;
|
|
10
11
|
// ✅ تخطي الرندر في production لبعض المسارات
|
|
@@ -17,23 +18,16 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
17
18
|
//{ themeVersionId: req.session.themeId }
|
|
18
19
|
let themePath = "";
|
|
19
20
|
const params = new URLSearchParams();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
params.set("widgetId", String(req.query.widgetId));
|
|
31
|
-
}
|
|
32
|
-
if (req.query?.previewCategory) {
|
|
33
|
-
params.set("previewCategory", String(req.query.previewCategory));
|
|
34
|
-
}
|
|
35
|
-
if (res.locals.themeWidget) {
|
|
36
|
-
params.set("themeWidget", String(res.locals.themeWidget));
|
|
21
|
+
const optionalParams = {
|
|
22
|
+
theme: req.session?.theme,
|
|
23
|
+
devMode: req.session?.devMode,
|
|
24
|
+
themeVersion: req.query?.themeVersion,
|
|
25
|
+
widgetId: req.query?.widgetId,
|
|
26
|
+
previewCategory: req.query?.previewCategory,
|
|
27
|
+
themeWidget: res.locals.themeWidget,
|
|
28
|
+
};
|
|
29
|
+
for (const [key, value] of Object.entries(optionalParams)) {
|
|
30
|
+
(0, set_optional_param_1.default)(params, key, value);
|
|
37
31
|
}
|
|
38
32
|
themePath = params.toString() ? `?${params.toString()}` : "";
|
|
39
33
|
let api = "";
|
|
@@ -58,6 +52,8 @@ const prepareDataMiddleware = (req, res, next) => {
|
|
|
58
52
|
qdid: qdid,
|
|
59
53
|
"client-ip": res.locals.clientIp || "",
|
|
60
54
|
market: res.locals.market || "",
|
|
55
|
+
lang: res.locals.lang || "",
|
|
56
|
+
currency: res.locals.currency || "",
|
|
61
57
|
},
|
|
62
58
|
})
|
|
63
59
|
.then((engineResponse) => {
|
|
@@ -17,6 +17,9 @@ const renderMiddleware = (req, res, next) => {
|
|
|
17
17
|
context,
|
|
18
18
|
globals,
|
|
19
19
|
settings: env.getGlobal("settings"),
|
|
20
|
+
market: res.locals.market || "",
|
|
21
|
+
lang: res.locals.lang || "",
|
|
22
|
+
currency: res.locals.currency || "",
|
|
20
23
|
}, env.getGlobal("t")), (err, html) => {
|
|
21
24
|
if (err) {
|
|
22
25
|
return next(new Error(`❌ Nunjucks render error: ${err.message}`));
|
|
@@ -36,6 +39,9 @@ const renderMiddleware = (req, res, next) => {
|
|
|
36
39
|
context,
|
|
37
40
|
globals,
|
|
38
41
|
settings: env.getGlobal("settings"),
|
|
42
|
+
market: res.locals.market || "",
|
|
43
|
+
lang: res.locals.lang || "",
|
|
44
|
+
currency: res.locals.currency || "",
|
|
39
45
|
}, env.getGlobal("t")), (err, html) => {
|
|
40
46
|
if (err) {
|
|
41
47
|
return next(new Error(`❌ Nunjucks render error: ${err.message}`));
|
|
@@ -12,6 +12,11 @@ const mergeDataMiddleware = async (req, res, next) => {
|
|
|
12
12
|
}
|
|
13
13
|
const widgets = res.locals.render.engine?.page?.widgets ?? [];
|
|
14
14
|
(0, globals_1.setGlobal)('currency', res.locals.render.globals?.currency);
|
|
15
|
+
// Set app from either render globals (production) or res.locals (dev)
|
|
16
|
+
const app = res.locals.render.globals?.app || res.locals.app;
|
|
17
|
+
if (app) {
|
|
18
|
+
(0, globals_1.setGlobal)('app', app);
|
|
19
|
+
}
|
|
15
20
|
if (res.locals.isIframe) {
|
|
16
21
|
res.locals.env.addGlobal('isIframe', res.locals.isIframe);
|
|
17
22
|
}
|