@stackedapp/utils 1.22.1 → 1.23.1
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/conditions.js +27 -0
- package/package.json +1 -1
package/dist/conditions.js
CHANGED
|
@@ -1470,6 +1470,14 @@ const meetsCompletionConditionsBeforeExpiry = ({ completionConditions, completio
|
|
|
1470
1470
|
if (wasUpdatedAfterExpiry())
|
|
1471
1471
|
return false;
|
|
1472
1472
|
}
|
|
1473
|
+
if (completionConditions.dynamic?.conditions?.length) {
|
|
1474
|
+
if (wasUpdatedAfterExpiry())
|
|
1475
|
+
return false;
|
|
1476
|
+
}
|
|
1477
|
+
if (completionConditions.identifiers?.platforms?.length) {
|
|
1478
|
+
if (wasUpdatedAfterExpiry())
|
|
1479
|
+
return false;
|
|
1480
|
+
}
|
|
1473
1481
|
if (completionConditions.social) {
|
|
1474
1482
|
// Check if social content was attached/validated after expiry
|
|
1475
1483
|
if (completionTrackers?.social?.lastChecked) {
|
|
@@ -1477,6 +1485,25 @@ const meetsCompletionConditionsBeforeExpiry = ({ completionConditions, completio
|
|
|
1477
1485
|
return false;
|
|
1478
1486
|
}
|
|
1479
1487
|
}
|
|
1488
|
+
// Tracker-based conditions: use completionTrackers.lastUpdated if available.
|
|
1489
|
+
// Legacy offers without lastUpdated skip these checks (preserving current grace-period behavior).
|
|
1490
|
+
if (completionTrackers?.lastUpdated != null) {
|
|
1491
|
+
const trackerUpdatedAfterExpiry = wasUpdatedAfterExpiry(completionTrackers.lastUpdated);
|
|
1492
|
+
if (trackerUpdatedAfterExpiry && (completionConditions.buyItem ||
|
|
1493
|
+
completionConditions.spendCurrency ||
|
|
1494
|
+
completionConditions.depositCurrency ||
|
|
1495
|
+
completionConditions.context ||
|
|
1496
|
+
completionConditions.linkedCompletions ||
|
|
1497
|
+
completionConditions.contractInteractions))
|
|
1498
|
+
return false;
|
|
1499
|
+
if (completionConditions.dynamicTracker?.conditions?.length) {
|
|
1500
|
+
for (const cond of completionConditions.dynamicTracker.conditions) {
|
|
1501
|
+
const perKeyTs = completionTrackers.dynamicTracker?.[cond.key]?.lastUpdated;
|
|
1502
|
+
if (wasUpdatedAfterExpiry(perKeyTs ?? completionTrackers.lastUpdated))
|
|
1503
|
+
return false;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1480
1507
|
// All conditions were met before expiry
|
|
1481
1508
|
return true;
|
|
1482
1509
|
};
|