@pixels-online/pixels-client-js-sdk 1.20.0 → 1.21.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.
- package/README.md +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/core/OfferwallClient.d.ts +1 -1
- package/dist/index.esm.js +79 -45
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +79 -45
- package/dist/index.js.map +1 -1
- package/dist/offerwall-sdk.umd.js +79 -45
- package/dist/offerwall-sdk.umd.js.map +1 -1
- package/dist/types/player.d.ts +6 -2
- package/dist/utils/conditions.d.ts +7 -2
- package/dist/utils/env.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -394,7 +394,7 @@ This project is licensed under the AGPLv3 License - see the [LICENSE.md](LICENSE
|
|
|
394
394
|
|
|
395
395
|
- [GitLab Repository](https://gitlab.com/pixels-online-oss/pixels-buildon-client-js-sdk)
|
|
396
396
|
- [Issue Tracker](https://gitlab.com/pixels-online-oss/pixels-buildon-client-js-sdk/issues)
|
|
397
|
-
- [Pixels BuildOn Documentation](https://docs.
|
|
397
|
+
- [Pixels BuildOn Documentation](https://docs.stackedplatform.io)
|
|
398
398
|
|
|
399
399
|
## 📞 Support
|
|
400
400
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stackedDomain = "stackedplatform.io";
|
|
@@ -6,7 +6,7 @@ import { IClientOffer } from '../types/offer';
|
|
|
6
6
|
import { ConnectionState } from '../types/connection';
|
|
7
7
|
import { IClientPlayer } from '../types/player';
|
|
8
8
|
import { StackedLinkResult } from '../types/linking';
|
|
9
|
-
export declare const mapEnvToOfferClientUrl: (env: "test" | "live" | (string & {})) => "https://
|
|
9
|
+
export declare const mapEnvToOfferClientUrl: (env: "test" | "live" | (string & {})) => "https://app.stackedplatform.io" | "https://app.sandbox.stackedplatform.io" | "https://app.staging.stackedplatform.io" | "https://app.dev.stackedplatform.io";
|
|
10
10
|
export declare class OfferwallClient {
|
|
11
11
|
private config;
|
|
12
12
|
private endpoint;
|
package/dist/index.esm.js
CHANGED
|
@@ -332,21 +332,22 @@ class CustomEventSource {
|
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
const stackedDomain = 'stackedplatform.io';
|
|
336
|
+
|
|
335
337
|
const mapEnvToBuildOnApiUrl = (env) => {
|
|
336
338
|
switch (env) {
|
|
337
339
|
case 'live':
|
|
338
|
-
return
|
|
340
|
+
return `https://api.${stackedDomain}`;
|
|
339
341
|
case 'test':
|
|
340
|
-
return
|
|
342
|
+
return `https://api.sandbox.${stackedDomain}`;
|
|
341
343
|
case 'staging':
|
|
342
|
-
return
|
|
344
|
+
return `https://api.staging.${stackedDomain}`;
|
|
343
345
|
case 'preview':
|
|
344
|
-
return 'https://api.preview.pixels.xyz';
|
|
345
346
|
case 'dev':
|
|
346
347
|
case 'development':
|
|
347
|
-
return
|
|
348
|
+
return `https://api.dev.${stackedDomain}`;
|
|
348
349
|
default:
|
|
349
|
-
return
|
|
350
|
+
return `https://api.sandbox.${stackedDomain}`;
|
|
350
351
|
}
|
|
351
352
|
};
|
|
352
353
|
|
|
@@ -906,18 +907,17 @@ class AssetHelper {
|
|
|
906
907
|
const mapEnvToOfferClientUrl = (env) => {
|
|
907
908
|
switch (env) {
|
|
908
909
|
case 'live':
|
|
909
|
-
return
|
|
910
|
+
return `https://app.${stackedDomain}`;
|
|
910
911
|
case 'test':
|
|
911
|
-
return
|
|
912
|
+
return `https://app.sandbox.${stackedDomain}`;
|
|
912
913
|
case 'staging':
|
|
913
|
-
return
|
|
914
|
+
return `https://app.staging.${stackedDomain}`;
|
|
914
915
|
case 'preview':
|
|
915
|
-
return 'https://offers.preview.pixels.xyz';
|
|
916
916
|
case 'dev':
|
|
917
917
|
case 'development':
|
|
918
|
-
return
|
|
918
|
+
return `https://app.dev.${stackedDomain}`;
|
|
919
919
|
default:
|
|
920
|
-
return
|
|
920
|
+
return `https://app.sandbox.${stackedDomain}`;
|
|
921
921
|
}
|
|
922
922
|
};
|
|
923
923
|
class OfferwallClient {
|
|
@@ -1388,6 +1388,7 @@ additionalData, }) => {
|
|
|
1388
1388
|
isMet: !isDisqualify,
|
|
1389
1389
|
kind: 'minDaysInGame',
|
|
1390
1390
|
trackerAmount: playerSnap.daysInGame || 0,
|
|
1391
|
+
trackerGoal: conditions.minDaysInGame,
|
|
1391
1392
|
text: `More than ${conditions.minDaysInGame} Days in Game`,
|
|
1392
1393
|
});
|
|
1393
1394
|
if (isDisqualify)
|
|
@@ -1405,6 +1406,7 @@ additionalData, }) => {
|
|
|
1405
1406
|
isMet: !isDisqualify,
|
|
1406
1407
|
kind: 'minTrustScore',
|
|
1407
1408
|
trackerAmount: playerSnap.trustScore || 0,
|
|
1409
|
+
trackerGoal: conditions.minTrustScore,
|
|
1408
1410
|
text: `More than ${conditions.minTrustScore} Rep`,
|
|
1409
1411
|
});
|
|
1410
1412
|
if (isDisqualify)
|
|
@@ -1436,12 +1438,12 @@ additionalData, }) => {
|
|
|
1436
1438
|
const a = conditions.achievements[key];
|
|
1437
1439
|
const playerAchData = playerSnap.achievements?.[key];
|
|
1438
1440
|
if (!playerAchData) {
|
|
1439
|
-
const isDisqualify = true;
|
|
1440
1441
|
if (addDetails) {
|
|
1441
1442
|
conditionData.push({
|
|
1442
|
-
isMet:
|
|
1443
|
+
isMet: false,
|
|
1443
1444
|
kind: 'achievements',
|
|
1444
1445
|
trackerAmount: 0,
|
|
1446
|
+
trackerGoal: 1,
|
|
1445
1447
|
text: `Have the achievement ${a.name}`,
|
|
1446
1448
|
});
|
|
1447
1449
|
isValid = false;
|
|
@@ -1451,12 +1453,13 @@ additionalData, }) => {
|
|
|
1451
1453
|
}
|
|
1452
1454
|
}
|
|
1453
1455
|
if (a.minCount) {
|
|
1454
|
-
const isDisqualify = (playerAchData?.count ||
|
|
1456
|
+
const isDisqualify = (playerAchData?.count || 0) < a.minCount;
|
|
1455
1457
|
if (addDetails) {
|
|
1456
1458
|
conditionData.push({
|
|
1457
1459
|
isMet: !isDisqualify,
|
|
1458
1460
|
kind: 'achievements',
|
|
1459
1461
|
trackerAmount: playerAchData?.count || 0,
|
|
1462
|
+
trackerGoal: a.minCount,
|
|
1460
1463
|
text: `Have the achievement ${a.name} more than ${a.minCount} times`,
|
|
1461
1464
|
});
|
|
1462
1465
|
if (isDisqualify)
|
|
@@ -1478,6 +1481,7 @@ additionalData, }) => {
|
|
|
1478
1481
|
isMet: !isDisqualify,
|
|
1479
1482
|
kind: 'currencies',
|
|
1480
1483
|
trackerAmount: playerCurrencyData?.balance || 0,
|
|
1484
|
+
trackerGoal: c.min,
|
|
1481
1485
|
text: `Have more than ${c.min} ${c.name}`,
|
|
1482
1486
|
});
|
|
1483
1487
|
if (isDisqualify)
|
|
@@ -1512,6 +1516,7 @@ additionalData, }) => {
|
|
|
1512
1516
|
isMet: !isDisqualify,
|
|
1513
1517
|
kind: 'currencies',
|
|
1514
1518
|
trackerAmount: playerCurrencyData?.in || 0,
|
|
1519
|
+
trackerGoal: c.in,
|
|
1515
1520
|
text: `Deposit at least ${c.in} ${c.name}`,
|
|
1516
1521
|
});
|
|
1517
1522
|
if (isDisqualify)
|
|
@@ -1529,6 +1534,7 @@ additionalData, }) => {
|
|
|
1529
1534
|
isMet: !isDisqualify,
|
|
1530
1535
|
kind: 'currencies',
|
|
1531
1536
|
trackerAmount: playerCurrencyData?.out || 0,
|
|
1537
|
+
trackerGoal: c.out,
|
|
1532
1538
|
text: `Withdraw at least ${c.out} ${c.name}`,
|
|
1533
1539
|
});
|
|
1534
1540
|
if (isDisqualify)
|
|
@@ -1550,6 +1556,7 @@ additionalData, }) => {
|
|
|
1550
1556
|
isMet: !isDisqualify,
|
|
1551
1557
|
kind: 'levels',
|
|
1552
1558
|
trackerAmount: playerLevelData?.level || 0,
|
|
1559
|
+
trackerGoal: l.min,
|
|
1553
1560
|
text: `Be above level ${l.min} ${l.name}`,
|
|
1554
1561
|
});
|
|
1555
1562
|
if (isDisqualify)
|
|
@@ -1584,12 +1591,13 @@ additionalData, }) => {
|
|
|
1584
1591
|
const playerQuestData = playerSnap.quests?.[questId];
|
|
1585
1592
|
const isDisqualify = playerQuestData
|
|
1586
1593
|
? (playerQuestData?.completions || 0) < (quest.completions || 0)
|
|
1587
|
-
:
|
|
1594
|
+
: true; // if player has no data for this quest, they haven't completed it
|
|
1588
1595
|
if (addDetails) {
|
|
1589
1596
|
conditionData.push({
|
|
1590
1597
|
isMet: !isDisqualify,
|
|
1591
1598
|
kind: 'quests',
|
|
1592
1599
|
trackerAmount: playerQuestData?.completions || 0,
|
|
1600
|
+
trackerGoal: quest.completions || 1,
|
|
1593
1601
|
text: quest.completions === 1
|
|
1594
1602
|
? `Complete the quest ${quest.name}`
|
|
1595
1603
|
: (quest.completions || 0) < 1
|
|
@@ -1615,6 +1623,7 @@ additionalData, }) => {
|
|
|
1615
1623
|
isMet: !isDisqualify,
|
|
1616
1624
|
kind: 'memberships',
|
|
1617
1625
|
trackerAmount: playerMembershipsData?.count || 0,
|
|
1626
|
+
trackerGoal: m.minCount,
|
|
1618
1627
|
text: m.minCount > 1
|
|
1619
1628
|
? `Have at least ${m.minCount} ${m.name} memberships`
|
|
1620
1629
|
: `Have a ${m.name} membership`,
|
|
@@ -1652,6 +1661,7 @@ additionalData, }) => {
|
|
|
1652
1661
|
isMet: !isDisqualify,
|
|
1653
1662
|
kind: 'memberships',
|
|
1654
1663
|
trackerAmount: Number((timeOwned / (1000 * 60 * 60 * 24)).toFixed(1)),
|
|
1664
|
+
trackerGoal: Number((m.minMs / (1000 * 60 * 60 * 24)).toFixed(1)),
|
|
1655
1665
|
text: `Own ${m.name} membership for at least ${(m.minMs /
|
|
1656
1666
|
(1000 * 60 * 60 * 24)).toFixed(1)} days`,
|
|
1657
1667
|
});
|
|
@@ -1692,6 +1702,7 @@ additionalData, }) => {
|
|
|
1692
1702
|
isMet: !isDisqualify,
|
|
1693
1703
|
kind: 'stakedTokens',
|
|
1694
1704
|
trackerAmount: playerStakedData?.balance || 0,
|
|
1705
|
+
trackerGoal: s.min,
|
|
1695
1706
|
text: `Have at least ${s.min} ${s.name} staked`,
|
|
1696
1707
|
});
|
|
1697
1708
|
if (isDisqualify)
|
|
@@ -1715,7 +1726,15 @@ additionalData, }) => {
|
|
|
1715
1726
|
isMet: !isDisqualify,
|
|
1716
1727
|
kind: 'links',
|
|
1717
1728
|
trackerAmount: linkCount,
|
|
1718
|
-
|
|
1729
|
+
trackerGoal: constraint.min,
|
|
1730
|
+
text: constraint.template
|
|
1731
|
+
? renderTemplate(constraint.template, {
|
|
1732
|
+
current: linkCount,
|
|
1733
|
+
min: constraint.min ?? 0,
|
|
1734
|
+
max: constraint.max ?? 0,
|
|
1735
|
+
type: linkType,
|
|
1736
|
+
})
|
|
1737
|
+
: `At least ${constraint.min} ${linkType} link(s)`,
|
|
1719
1738
|
});
|
|
1720
1739
|
if (isDisqualify)
|
|
1721
1740
|
isValid = false;
|
|
@@ -1732,7 +1751,14 @@ additionalData, }) => {
|
|
|
1732
1751
|
isMet: !isDisqualify,
|
|
1733
1752
|
kind: 'links',
|
|
1734
1753
|
trackerAmount: linkCount,
|
|
1735
|
-
text:
|
|
1754
|
+
text: constraint.template
|
|
1755
|
+
? renderTemplate(constraint.template, {
|
|
1756
|
+
current: linkCount,
|
|
1757
|
+
min: constraint.min ?? 0,
|
|
1758
|
+
max: constraint.max ?? 0,
|
|
1759
|
+
type: linkType,
|
|
1760
|
+
})
|
|
1761
|
+
: `At most ${constraint.max} ${linkType} link(s)`,
|
|
1736
1762
|
});
|
|
1737
1763
|
if (isDisqualify)
|
|
1738
1764
|
isValid = false;
|
|
@@ -1784,6 +1810,8 @@ additionalData, }) => {
|
|
|
1784
1810
|
conditionData.push({
|
|
1785
1811
|
isMet,
|
|
1786
1812
|
kind: 'identifiers',
|
|
1813
|
+
trackerAmount: isMet ? 1 : 0,
|
|
1814
|
+
trackerGoal: 1,
|
|
1787
1815
|
text: displayText,
|
|
1788
1816
|
});
|
|
1789
1817
|
if (!isMet)
|
|
@@ -1810,6 +1838,7 @@ additionalData, }) => {
|
|
|
1810
1838
|
isMet: !isDisqualify,
|
|
1811
1839
|
kind: 'tokenBalances',
|
|
1812
1840
|
trackerAmount: totalBalance,
|
|
1841
|
+
trackerGoal: tokenCond.min,
|
|
1813
1842
|
text: `Have at least ${tokenCond.min} ${tokenCond.name || 'tokens'}`,
|
|
1814
1843
|
});
|
|
1815
1844
|
if (isDisqualify)
|
|
@@ -1840,7 +1869,7 @@ additionalData, }) => {
|
|
|
1840
1869
|
}
|
|
1841
1870
|
return { isValid, conditionData: addDetails ? conditionData : undefined };
|
|
1842
1871
|
};
|
|
1843
|
-
const meetsSurfacingConditions = ({ surfacingConditions, playerSnap, context, playerOffers, additionalData, }) => {
|
|
1872
|
+
const meetsSurfacingConditions = ({ surfacingConditions, playerSnap, context, playerOffers, ignoreRequiredCompletions, additionalData, }) => {
|
|
1844
1873
|
if (surfacingConditions?.contexts?.length &&
|
|
1845
1874
|
!surfacingConditions.contexts?.includes(context || '')) {
|
|
1846
1875
|
// context is not in the list of surfacing contexts, so we don't want to surface this offer
|
|
@@ -1876,7 +1905,7 @@ const meetsSurfacingConditions = ({ surfacingConditions, playerSnap, context, pl
|
|
|
1876
1905
|
}
|
|
1877
1906
|
}
|
|
1878
1907
|
if (conditions?.maxDaysInGame &&
|
|
1879
|
-
(playerSnap.daysInGame
|
|
1908
|
+
(playerSnap.daysInGame ?? 0) > conditions.maxDaysInGame) {
|
|
1880
1909
|
return { isValid: false };
|
|
1881
1910
|
}
|
|
1882
1911
|
if (conditions.loginStreak && (playerSnap.loginStreak || 0) < conditions.loginStreak) {
|
|
@@ -1899,7 +1928,7 @@ const meetsSurfacingConditions = ({ surfacingConditions, playerSnap, context, pl
|
|
|
1899
1928
|
}
|
|
1900
1929
|
if (conditions.completedOffers?.length) {
|
|
1901
1930
|
const hasCompletedAllOffers = conditions.completedOffers.every((offerId) => completedOfferIds.has(offerId));
|
|
1902
|
-
if (!hasCompletedAllOffers) {
|
|
1931
|
+
if (!hasCompletedAllOffers && !ignoreRequiredCompletions) {
|
|
1903
1932
|
return { isValid: false };
|
|
1904
1933
|
}
|
|
1905
1934
|
}
|
|
@@ -2060,7 +2089,8 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2060
2089
|
conditionData.push({
|
|
2061
2090
|
isMet: !isDisqualify,
|
|
2062
2091
|
kind: 'context',
|
|
2063
|
-
trackerAmount: 0,
|
|
2092
|
+
trackerAmount: hasTrackedContext ? 1 : 0,
|
|
2093
|
+
trackerGoal: 1,
|
|
2064
2094
|
text: completionConditions.context.name,
|
|
2065
2095
|
});
|
|
2066
2096
|
if (isDisqualify)
|
|
@@ -2084,6 +2114,7 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2084
2114
|
isMet: !isDisqualify,
|
|
2085
2115
|
kind: 'buyItem',
|
|
2086
2116
|
trackerAmount: trackerValue,
|
|
2117
|
+
trackerGoal: scaledAmount,
|
|
2087
2118
|
text: `Buy ${scaledAmount} ${conditions.buyItem.name}`,
|
|
2088
2119
|
});
|
|
2089
2120
|
if (isDisqualify)
|
|
@@ -2107,6 +2138,7 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2107
2138
|
isMet: !isDisqualify,
|
|
2108
2139
|
kind: 'spendCurrency',
|
|
2109
2140
|
trackerAmount: trackerValue,
|
|
2141
|
+
trackerGoal: scaledAmount,
|
|
2110
2142
|
text: `Spend ${scaledAmount} ${conditions.spendCurrency.name}`,
|
|
2111
2143
|
});
|
|
2112
2144
|
if (isDisqualify)
|
|
@@ -2130,6 +2162,7 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2130
2162
|
isMet: !isDisqualify,
|
|
2131
2163
|
kind: 'depositCurrency',
|
|
2132
2164
|
trackerAmount: trackerValue,
|
|
2165
|
+
trackerGoal: scaledAmount,
|
|
2133
2166
|
text: `Deposit ${scaledAmount} ${conditions.depositCurrency.name}`,
|
|
2134
2167
|
});
|
|
2135
2168
|
if (isDisqualify)
|
|
@@ -2148,9 +2181,11 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2148
2181
|
isMet,
|
|
2149
2182
|
kind: 'login',
|
|
2150
2183
|
trackerAmount: isMet ? 1 : 0,
|
|
2184
|
+
trackerGoal: 1,
|
|
2151
2185
|
text: `Login to the game`,
|
|
2152
2186
|
});
|
|
2153
|
-
|
|
2187
|
+
if (!isMet)
|
|
2188
|
+
isValid = false;
|
|
2154
2189
|
}
|
|
2155
2190
|
else {
|
|
2156
2191
|
if (!isMet)
|
|
@@ -2166,7 +2201,8 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2166
2201
|
conditionData.push({
|
|
2167
2202
|
isMet: !isDisqualify,
|
|
2168
2203
|
kind: 'loginStreak',
|
|
2169
|
-
trackerAmount:
|
|
2204
|
+
trackerAmount: streakSinceOffer + 1,
|
|
2205
|
+
trackerGoal: conditions.loginStreak,
|
|
2170
2206
|
text: `Login streak of ${conditions.loginStreak || 0} days`,
|
|
2171
2207
|
});
|
|
2172
2208
|
if (isDisqualify)
|
|
@@ -2225,6 +2261,7 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2225
2261
|
isMet: hasContent,
|
|
2226
2262
|
kind: 'social',
|
|
2227
2263
|
trackerAmount: matchCount,
|
|
2264
|
+
trackerGoal: 1,
|
|
2228
2265
|
text: hasContent
|
|
2229
2266
|
? `Found ${matchCount} matching ${platformText} post${matchCount !== 1 ? 's' : ''}`
|
|
2230
2267
|
: requiredWords.length > 0
|
|
@@ -2237,7 +2274,8 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2237
2274
|
conditionData.push({
|
|
2238
2275
|
isMet: hasContent,
|
|
2239
2276
|
kind: 'social',
|
|
2240
|
-
trackerAmount: 0,
|
|
2277
|
+
trackerAmount: hasContent ? 1 : 0,
|
|
2278
|
+
trackerGoal: 1,
|
|
2241
2279
|
text: !hasContent
|
|
2242
2280
|
? requiredWords.length > 0
|
|
2243
2281
|
? `Attach a ${platformText} post with ${requiredWords.map((w) => `"${w}"`).join(', ')} in the title`
|
|
@@ -2250,6 +2288,7 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2250
2288
|
isMet: hasContent && likes >= minLikes,
|
|
2251
2289
|
kind: 'social',
|
|
2252
2290
|
trackerAmount: likes,
|
|
2291
|
+
trackerGoal: minLikes,
|
|
2253
2292
|
text: mode === 'accumulate'
|
|
2254
2293
|
? `Combined ${minLikes} Likes`
|
|
2255
2294
|
: `Reach ${minLikes} Likes`,
|
|
@@ -2260,6 +2299,7 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2260
2299
|
isMet: hasContent && views >= minViews,
|
|
2261
2300
|
kind: 'social',
|
|
2262
2301
|
trackerAmount: views,
|
|
2302
|
+
trackerGoal: minViews,
|
|
2263
2303
|
text: mode === 'accumulate'
|
|
2264
2304
|
? `Combined ${minViews} Views`
|
|
2265
2305
|
: `Reach ${minViews} Views`,
|
|
@@ -2270,6 +2310,7 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2270
2310
|
isMet: hasContent && comments >= minComments,
|
|
2271
2311
|
kind: 'social',
|
|
2272
2312
|
trackerAmount: comments,
|
|
2313
|
+
trackerGoal: minComments,
|
|
2273
2314
|
text: mode === 'accumulate'
|
|
2274
2315
|
? `Combined ${minComments} Comments`
|
|
2275
2316
|
: `Reach ${minComments} Comments`,
|
|
@@ -2297,7 +2338,13 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2297
2338
|
isMet: !isDisqualify,
|
|
2298
2339
|
kind: 'linkedCompletions',
|
|
2299
2340
|
trackerAmount: currentCount,
|
|
2300
|
-
|
|
2341
|
+
trackerGoal: scaledMin,
|
|
2342
|
+
text: conditions.linkedCompletions.template
|
|
2343
|
+
? renderTemplate(conditions.linkedCompletions.template, {
|
|
2344
|
+
current: currentCount,
|
|
2345
|
+
required: scaledMin,
|
|
2346
|
+
})
|
|
2347
|
+
: `Wait for ${scaledMin} linked ${scaledMin === 1 ? 'entity' : 'entities'} to complete`,
|
|
2301
2348
|
});
|
|
2302
2349
|
if (isDisqualify)
|
|
2303
2350
|
isValid = false;
|
|
@@ -2346,28 +2393,15 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
|
|
|
2346
2393
|
updateMax(Math.floor(trackerValue / baseAmount));
|
|
2347
2394
|
}
|
|
2348
2395
|
if (addDetails) {
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
displayText = `Spend ${scaledAmount} ${name}`;
|
|
2354
|
-
}
|
|
2355
|
-
else if (eventType === 'earn') {
|
|
2356
|
-
displayText = `Earn ${scaledAmount} ${name}`;
|
|
2357
|
-
}
|
|
2358
|
-
else if (eventType === 'gain') {
|
|
2359
|
-
displayText = `Gain ${scaledAmount} ${name}`;
|
|
2360
|
-
}
|
|
2361
|
-
else if (eventType === 'lose') {
|
|
2362
|
-
displayText = `Lose ${scaledAmount} ${name}`;
|
|
2363
|
-
}
|
|
2364
|
-
else {
|
|
2365
|
-
displayText = `${name}: ${scaledAmount}`;
|
|
2366
|
-
}
|
|
2396
|
+
const displayText = renderTemplate(condition.template, {
|
|
2397
|
+
current: trackerValue,
|
|
2398
|
+
amount: scaledAmount,
|
|
2399
|
+
});
|
|
2367
2400
|
conditionData.push({
|
|
2368
2401
|
isMet: !isDisqualify,
|
|
2369
2402
|
kind: 'contractInteractions',
|
|
2370
2403
|
trackerAmount: trackerValue,
|
|
2404
|
+
trackerGoal: scaledAmount,
|
|
2371
2405
|
text: displayText,
|
|
2372
2406
|
});
|
|
2373
2407
|
if (isDisqualify)
|
|
@@ -2549,7 +2583,7 @@ function evaluateDynamicCondition(dynamicObj, cond, claimMultiplier = 1) {
|
|
|
2549
2583
|
if (!dynamicObj)
|
|
2550
2584
|
return false;
|
|
2551
2585
|
const val = dynamicObj[cond.key];
|
|
2552
|
-
if (val
|
|
2586
|
+
if (val == undefined)
|
|
2553
2587
|
return false;
|
|
2554
2588
|
const isNumber = typeof val === 'number';
|
|
2555
2589
|
const isBoolean = typeof val === 'boolean';
|