@posiwise/common-services 0.2.1 → 0.2.3

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.
@@ -1478,7 +1478,18 @@ class PermissionService {
1478
1478
  expr = this.handleNonBooleanPermissions(permission, expr, productKey, permission_key, productSlug);
1479
1479
  // Now expr is made of true/false values with &&, ||, ()
1480
1480
  // Safe parser: no eval() - CSP 'unsafe-eval' not required
1481
- return this.evaluateBooleanExpression(expr);
1481
+ const result = this.evaluateBooleanExpression(expr);
1482
+ // DEBUG: inspect in console - remove after fixing CloudOlive permissions
1483
+ console.debug('[PermissionService] evaluatePermissions', {
1484
+ permission,
1485
+ expr: expr.trim(),
1486
+ result,
1487
+ selectedProduct: PermissionService?.selectedProduct,
1488
+ productKey,
1489
+ permission_key,
1490
+ productSlug
1491
+ });
1492
+ return result;
1482
1493
  }
1483
1494
  /** Safe boolean expression parser - replaces eval() for CSP compliance. */
1484
1495
  evaluateBooleanExpression(expr) {
@@ -1534,12 +1545,15 @@ class PermissionService {
1534
1545
  }
1535
1546
  }
1536
1547
  // Unrecognized token - treat as false for safety
1548
+ console.warn('[PermissionService] evaluateBooleanExpression: unrecognized expr', { expr });
1537
1549
  return false;
1538
1550
  }
1539
1551
  handleNonBooleanPermissions(permission, expr, productKey, permission_key, productSlug) {
1540
1552
  if (typeof permission !== 'boolean') {
1541
1553
  permission.split(' ').forEach(x => {
1542
1554
  const raw = x.trim();
1555
+ if (!raw)
1556
+ return;
1543
1557
  if (['||', '&&', '(', ')'].includes(raw)) {
1544
1558
  expr += ` ${raw} `;
1545
1559
  }