rampkit-expo-dev 0.0.44 → 0.0.45
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/build/RampkitOverlay.js +33 -13
- package/package.json +1 -1
package/build/RampkitOverlay.js
CHANGED
|
@@ -424,22 +424,37 @@ function preloadRampkitOverlay(opts) {
|
|
|
424
424
|
// best-effort preloading; ignore errors
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* Decode HTML entities in a string
|
|
429
|
+
*/
|
|
430
|
+
function decodeHtmlEntities(str) {
|
|
431
|
+
return str
|
|
432
|
+
.replace(/"/g, '"')
|
|
433
|
+
.replace(/"/g, '"')
|
|
434
|
+
.replace(/"/g, '"')
|
|
435
|
+
.replace(/'/g, "'")
|
|
436
|
+
.replace(/'/g, "'")
|
|
437
|
+
.replace(/'/g, "'")
|
|
438
|
+
.replace(/</g, '<')
|
|
439
|
+
.replace(/>/g, '>')
|
|
440
|
+
.replace(/&/g, '&');
|
|
441
|
+
}
|
|
427
442
|
/**
|
|
428
443
|
* Evaluate a comparison condition against variables
|
|
429
444
|
* Supports: ==, !=, >, <, >=, <=, and truthy checks
|
|
430
445
|
*/
|
|
431
446
|
function evaluateCondition(condition, vars) {
|
|
432
|
-
condition = condition.trim();
|
|
447
|
+
condition = decodeHtmlEntities(condition.trim());
|
|
433
448
|
// Match comparison operators: ==, !=, >=, <=, >, <
|
|
434
449
|
const comparisonMatch = condition.match(/^([A-Za-z_][A-Za-z0-9_.]*)\s*(==|!=|>=|<=|>|<)\s*(.+)$/);
|
|
435
450
|
if (comparisonMatch) {
|
|
436
451
|
const [, varName, operator, rawRight] = comparisonMatch;
|
|
437
452
|
const leftValue = vars.hasOwnProperty(varName) ? vars[varName] : undefined;
|
|
438
|
-
let rightValue = rawRight.trim();
|
|
453
|
+
let rightValue = decodeHtmlEntities(rawRight.trim());
|
|
439
454
|
// Parse right side - could be a quoted string or a number or a variable
|
|
440
455
|
if ((rightValue.startsWith('"') && rightValue.endsWith('"')) ||
|
|
441
456
|
(rightValue.startsWith("'") && rightValue.endsWith("'"))) {
|
|
442
|
-
// Quoted string literal
|
|
457
|
+
// Quoted string literal - strip the quotes
|
|
443
458
|
rightValue = rightValue.slice(1, -1);
|
|
444
459
|
}
|
|
445
460
|
else if (!isNaN(Number(rightValue))) {
|
|
@@ -494,10 +509,13 @@ function evaluateCondition(condition, vars) {
|
|
|
494
509
|
* Returns the resolved value, handling both quoted strings and variable references
|
|
495
510
|
*/
|
|
496
511
|
function parseTernaryValue(value, vars) {
|
|
497
|
-
value = value.trim();
|
|
498
|
-
// Check if it's a quoted string
|
|
499
|
-
if (
|
|
500
|
-
|
|
512
|
+
value = decodeHtmlEntities(value.trim());
|
|
513
|
+
// Check if it's a quoted string (double quotes)
|
|
514
|
+
if (value.startsWith('"') && value.endsWith('"') && value.length >= 2) {
|
|
515
|
+
return value.slice(1, -1);
|
|
516
|
+
}
|
|
517
|
+
// Check if it's a quoted string (single quotes)
|
|
518
|
+
if (value.startsWith("'") && value.endsWith("'") && value.length >= 2) {
|
|
501
519
|
return value.slice(1, -1);
|
|
502
520
|
}
|
|
503
521
|
// Otherwise treat as a variable reference
|
|
@@ -516,16 +534,18 @@ function parseTernaryValue(value, vars) {
|
|
|
516
534
|
}
|
|
517
535
|
/**
|
|
518
536
|
* Parse a ternary expression and find the colon that separates true/false values
|
|
519
|
-
* Handles nested quotes properly
|
|
537
|
+
* Handles nested quotes properly (including HTML-encoded quotes)
|
|
520
538
|
*/
|
|
521
539
|
function splitTernary(expr) {
|
|
540
|
+
// First decode HTML entities to normalize the expression
|
|
541
|
+
const decodedExpr = decodeHtmlEntities(expr);
|
|
522
542
|
// Find the ? that starts the ternary
|
|
523
543
|
let questionIdx = -1;
|
|
524
544
|
let inQuote = false;
|
|
525
545
|
let quoteChar = "";
|
|
526
|
-
for (let i = 0; i <
|
|
527
|
-
const char =
|
|
528
|
-
const prevChar = i > 0 ?
|
|
546
|
+
for (let i = 0; i < decodedExpr.length; i++) {
|
|
547
|
+
const char = decodedExpr[i];
|
|
548
|
+
const prevChar = i > 0 ? decodedExpr[i - 1] : "";
|
|
529
549
|
if ((char === '"' || char === "'") && prevChar !== "\\") {
|
|
530
550
|
if (!inQuote) {
|
|
531
551
|
inQuote = true;
|
|
@@ -542,8 +562,8 @@ function splitTernary(expr) {
|
|
|
542
562
|
}
|
|
543
563
|
if (questionIdx === -1)
|
|
544
564
|
return null;
|
|
545
|
-
const condition =
|
|
546
|
-
const rest =
|
|
565
|
+
const condition = decodedExpr.slice(0, questionIdx).trim();
|
|
566
|
+
const rest = decodedExpr.slice(questionIdx + 1);
|
|
547
567
|
// Find the : that separates true/false values
|
|
548
568
|
let colonIdx = -1;
|
|
549
569
|
inQuote = false;
|
package/package.json
CHANGED