@b2y/ecommerce-common 1.3.9 → 1.4.0

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.
@@ -8,16 +8,6 @@ module.exports = (sequelize) => {
8
8
  allowNull: false,
9
9
  defaultValue: DataTypes.UUIDV4
10
10
  },
11
- TenantID: {
12
- type: DataTypes.UUID,
13
- allowNull: false,
14
- references: {
15
- model: 'Tenant',
16
- key: 'TenantID'
17
- },
18
- onDelete: 'CASCADE',
19
- onUpdate: 'CASCADE'
20
- },
21
11
  Module: {
22
12
  type: DataTypes.STRING(100),
23
13
  allowNull: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b2y/ecommerce-common",
3
- "version": "1.3.9",
3
+ "version": "1.4.0",
4
4
  "description": "E-commerce common library",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -118,8 +118,8 @@ static productQueryBuilder(filters) {
118
118
  fv."SellingPrice",
119
119
  fp."GroupBy",
120
120
 
121
- CASE
122
- WHEN fp."GroupBy" IS NULL
121
+ CASE
122
+ WHEN fp."GroupBy" IS NULL OR fv."GroupByAttributeValue" IS NULL
123
123
  THEN fv."ProductVariantID"::text
124
124
  ELSE
125
125
  fv."ProductID"::text || '_' || fv."GroupByAttributeValue"::text
@@ -127,8 +127,8 @@ static productQueryBuilder(filters) {
127
127
 
128
128
  ROW_NUMBER() OVER (
129
129
  PARTITION BY
130
- CASE
131
- WHEN fp."GroupBy" IS NULL
130
+ CASE
131
+ WHEN fp."GroupBy" IS NULL OR fv."GroupByAttributeValue" IS NULL
132
132
  THEN fv."ProductVariantID"::text
133
133
  ELSE
134
134
  fv."ProductID"::text || '_' || fv."GroupByAttributeValue"::text
@@ -59,6 +59,10 @@ const AppUtil = {
59
59
  isValidPhone: function (phoneNumber) {
60
60
  const phoneRegex = /^\d{10,20}$/;
61
61
  return phoneRegex.test(phoneNumber);
62
+ },
63
+ generateTimestampedId: function (prefix, suffix) {
64
+ const id = `${prefix}-${Date.now()}`;
65
+ return suffix == null ? id : `${id}-${suffix}`;
62
66
  }
63
67
  };
64
68
 
@@ -26,12 +26,15 @@ class PdfUtil {
26
26
  let browser;
27
27
  try {
28
28
  // Launch puppeteer
29
- browser = await puppeteer.launch({
30
- executablePath: '/usr/bin/chromium',
29
+ const launchOptions = {
31
30
  headless: true,
32
- args: ['--no-sandbox', '--disable-setuid-sandbox','--disable-dev-shm-usage']
33
- });
34
-
31
+ args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage']
32
+ };
33
+ // Use system browser when configured (e.g. Docker); otherwise fall back to Puppeteer's bundled Chrome
34
+ if (process.env.PUPPETEER_EXECUTABLE_PATH) {
35
+ launchOptions.executablePath = process.env.PUPPETEER_EXECUTABLE_PATH || '/usr/bin/chromium';
36
+ }
37
+ browser = await puppeteer.launch(launchOptions);
35
38
  const page = await browser.newPage();
36
39
 
37
40
  // Set content and wait for any resources to load