@stackedapp/utils 2.23.0 → 2.29.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILevelCondition, ICurrencyCondition, IStakedTokensCondition, ITrustScoreCondition, IDaysInGameCondition, ILoginStreakCondition, IAchievementCondition, IMembershipCondition, IQuestCondition, IEntityLinkCondition, IDynamicConditionItem, IIdentifiersCondition, ITokenBalanceCondition, IStackedAccountCondition, IUserSettingsCondition, IBuyItemCondition, ISpendCurrencyCondition, IDepositCurrencyCondition, ISocialCondition, ILoginCondition, ICompletionContextCondition, ILinkedCompletionsCondition, IDynamicTrackerCondition, IContractInteractionCondition,
|
|
1
|
+
import { ILevelCondition, ICurrencyCondition, IStakedTokensCondition, ITrustScoreCondition, IDaysInGameCondition, ILoginStreakCondition, IAchievementCondition, IMembershipCondition, IQuestCondition, IEntityLinkCondition, IDynamicConditionItem, IIdentifiersCondition, ITokenBalanceCondition, IStackedAccountCondition, IUserSettingsCondition, IBuyItemCondition, ISpendCurrencyCondition, IDepositCurrencyCondition, ISocialCondition, ILoginCondition, ICompletionContextCondition, ILinkedCompletionsCondition, IDynamicTrackerCondition, IContractInteractionCondition, ITwitterVerificationCondition, ICompletionTrackers, ConditionDetail, StackedSnapshot, StackedBaseUserExtra } from '@stackedapp/types';
|
|
2
2
|
export interface EvalContext {
|
|
3
3
|
snap: StackedSnapshot;
|
|
4
4
|
additionalData?: StackedBaseUserExtra;
|
|
@@ -38,5 +38,5 @@ export declare function evaluateSocial(cond: ISocialCondition, ctx: EvalContext)
|
|
|
38
38
|
export declare function evaluateLinkedCompletions(cond: ILinkedCompletionsCondition, ctx: EvalContext): EvalResult;
|
|
39
39
|
export declare function evaluateDynamicTracker(cond: IDynamicTrackerCondition, ctx: EvalContext): EvalResult;
|
|
40
40
|
export declare function evaluateContractInteraction(cond: IContractInteractionCondition, ctx: EvalContext): EvalResult;
|
|
41
|
-
export declare function
|
|
41
|
+
export declare function evaluateTwitterVerification(cond: ITwitterVerificationCondition, ctx: EvalContext): EvalResult;
|
|
42
42
|
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -24,7 +24,7 @@ exports.evaluateSocial = evaluateSocial;
|
|
|
24
24
|
exports.evaluateLinkedCompletions = evaluateLinkedCompletions;
|
|
25
25
|
exports.evaluateDynamicTracker = evaluateDynamicTracker;
|
|
26
26
|
exports.evaluateContractInteraction = evaluateContractInteraction;
|
|
27
|
-
exports.
|
|
27
|
+
exports.evaluateTwitterVerification = evaluateTwitterVerification;
|
|
28
28
|
const types_1 = require("@stackedapp/types");
|
|
29
29
|
const template_1 = require("../template");
|
|
30
30
|
const dynamic_1 = require("../dynamic");
|
|
@@ -823,8 +823,8 @@ function evaluateContractInteraction(cond, ctx) {
|
|
|
823
823
|
maxClaims,
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
|
-
function
|
|
827
|
-
const tracker = ctx.completionTrackers?.
|
|
826
|
+
function evaluateTwitterVerification(cond, ctx) {
|
|
827
|
+
const tracker = ctx.completionTrackers?.twitterVerification?.[cond.id];
|
|
828
828
|
const isMet = tracker?.verified === true;
|
|
829
829
|
const actionTextMap = {
|
|
830
830
|
follow: `Follow @${cond.targetUsername || '?'} on X`,
|
|
@@ -836,10 +836,10 @@ function evaluateSocialEngagement(cond, ctx) {
|
|
|
836
836
|
return {
|
|
837
837
|
isMet,
|
|
838
838
|
details: [{
|
|
839
|
-
isMet, kind: '
|
|
839
|
+
isMet, kind: 'twitterVerification',
|
|
840
840
|
trackerAmount: isMet ? 1 : 0, trackerGoal: 1,
|
|
841
841
|
percentCompleted: isMet ? 100 : 0,
|
|
842
|
-
text: actionTextMap[cond.action] || 'Complete X
|
|
842
|
+
text: actionTextMap[cond.action] || 'Complete action on X',
|
|
843
843
|
}],
|
|
844
844
|
};
|
|
845
845
|
}
|
package/dist/conditions/index.js
CHANGED
|
@@ -42,7 +42,7 @@ function evaluateCompletionOnlyCondition(cond, ctx) {
|
|
|
42
42
|
case 'linkedCompletions': return (0, handlers_1.evaluateLinkedCompletions)(cond, ctx);
|
|
43
43
|
case 'dynamicTracker': return (0, handlers_1.evaluateDynamicTracker)(cond, ctx);
|
|
44
44
|
case 'contractInteraction': return (0, handlers_1.evaluateContractInteraction)(cond, ctx);
|
|
45
|
-
case '
|
|
45
|
+
case 'twitterVerification': return (0, handlers_1.evaluateTwitterVerification)(cond, ctx);
|
|
46
46
|
// base kinds handled by evaluateBaseCondition
|
|
47
47
|
case 'level':
|
|
48
48
|
case 'currency':
|
|
@@ -386,7 +386,7 @@ const meetsCompletionConditionsBeforeExpiry = ({ completionConditions, completio
|
|
|
386
386
|
case 'completionContext':
|
|
387
387
|
case 'linkedCompletions':
|
|
388
388
|
case 'contractInteraction':
|
|
389
|
-
case '
|
|
389
|
+
case 'twitterVerification':
|
|
390
390
|
if (completionTrackers?.lastUpdated != null && wasUpdatedAfterExpiry(completionTrackers.lastUpdated)) {
|
|
391
391
|
return false;
|
|
392
392
|
}
|