@stackedapp/utils 2.39.2 → 2.40.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.
@@ -33,7 +33,7 @@ export declare function evaluateCompletionContext(cond: ICompletionContextCondit
33
33
  export declare function evaluateBuyItem(cond: IBuyItemCondition, ctx: EvalContext): EvalResult;
34
34
  export declare function evaluateSpendCurrency(cond: ISpendCurrencyCondition, ctx: EvalContext): EvalResult;
35
35
  export declare function evaluateDepositCurrency(cond: IDepositCurrencyCondition, ctx: EvalContext): EvalResult;
36
- export declare function evaluateLogin(_cond: ILoginCondition, ctx: EvalContext): EvalResult;
36
+ export declare function evaluateLogin(cond: ILoginCondition, ctx: EvalContext): EvalResult;
37
37
  export declare function evaluateSocial(cond: ISocialCondition, ctx: EvalContext): EvalResult;
38
38
  export declare function evaluateLinkedCompletions(cond: ILinkedCompletionsCondition, ctx: EvalContext): EvalResult;
39
39
  export declare function evaluateDynamicTracker(cond: IDynamicTrackerCondition, ctx: EvalContext): EvalResult;
@@ -31,6 +31,9 @@ const template_1 = require("../template");
31
31
  const dynamic_1 = require("../dynamic");
32
32
  const helpers_1 = require("./helpers");
33
33
  const blockchain_utils_1 = require("../blockchain_utils");
34
+ function templateText(cond, vars, fallback) {
35
+ return cond.template ? (0, template_1.renderTemplate)(cond.template, vars) || fallback : fallback;
36
+ }
34
37
  // ─── Base Condition Handlers ─────────────────────────────────────────────────
35
38
  function evaluateDaysInGame(cond, ctx) {
36
39
  const details = [];
@@ -47,7 +50,7 @@ function evaluateDaysInGame(cond, ctx) {
47
50
  trackerAmount,
48
51
  trackerGoal,
49
52
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
50
- text: `More than ${trackerGoal} Days in Game`,
53
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal }, `More than ${trackerGoal} Days in Game`),
51
54
  });
52
55
  }
53
56
  if (cond.max) {
@@ -61,7 +64,7 @@ function evaluateDaysInGame(cond, ctx) {
61
64
  trackerAmount,
62
65
  trackerGoal: cond.max,
63
66
  percentCompleted: met ? 100 : 0,
64
- text: `Less than ${cond.max} Days in Game`,
67
+ text: templateText(cond, { current: trackerAmount, goal: cond.max }, `Less than ${cond.max} Days in Game`),
65
68
  });
66
69
  }
67
70
  return { isMet, details };
@@ -81,7 +84,7 @@ function evaluateTrustScore(cond, ctx) {
81
84
  trackerAmount,
82
85
  trackerGoal,
83
86
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
84
- text: `More than ${trackerGoal} Rep`,
87
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal }, `More than ${trackerGoal} Rep`),
85
88
  });
86
89
  }
87
90
  if (cond.max) {
@@ -95,7 +98,7 @@ function evaluateTrustScore(cond, ctx) {
95
98
  trackerAmount,
96
99
  trackerGoal: cond.max,
97
100
  percentCompleted: met ? 100 : 0,
98
- text: `Less than ${cond.max} Rep`,
101
+ text: templateText(cond, { current: trackerAmount, goal: cond.max }, `Less than ${cond.max} Rep`),
99
102
  });
100
103
  }
101
104
  return { isMet, details };
@@ -116,7 +119,7 @@ function evaluateLevel(cond, ctx) {
116
119
  trackerAmount,
117
120
  trackerGoal,
118
121
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
119
- text: `Be above level ${trackerGoal} ${cond.name}`,
122
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, `Be above level ${trackerGoal} ${cond.name}`),
120
123
  });
121
124
  }
122
125
  if (cond.max) {
@@ -130,7 +133,7 @@ function evaluateLevel(cond, ctx) {
130
133
  trackerAmount,
131
134
  trackerGoal: cond.max,
132
135
  percentCompleted: met ? 100 : 0,
133
- text: `Be under level ${cond.max} ${cond.name}`,
136
+ text: templateText(cond, { current: trackerAmount, goal: cond.max, name: cond.name }, `Be under level ${cond.max} ${cond.name}`),
134
137
  });
135
138
  }
136
139
  return { isMet, details };
@@ -151,7 +154,7 @@ function evaluateCurrency(cond, ctx) {
151
154
  trackerAmount,
152
155
  trackerGoal,
153
156
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
154
- text: `Have more than ${trackerGoal} ${cond.name}`,
157
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, `Have more than ${trackerGoal} ${cond.name}`),
155
158
  });
156
159
  }
157
160
  if (cond.max) {
@@ -165,7 +168,7 @@ function evaluateCurrency(cond, ctx) {
165
168
  trackerAmount,
166
169
  trackerGoal: cond.max,
167
170
  percentCompleted: met ? 100 : 0,
168
- text: `Have less than ${cond.max} ${cond.name}`,
171
+ text: templateText(cond, { current: trackerAmount, goal: cond.max, name: cond.name }, `Have less than ${cond.max} ${cond.name}`),
169
172
  });
170
173
  }
171
174
  if (cond.in) {
@@ -180,7 +183,7 @@ function evaluateCurrency(cond, ctx) {
180
183
  trackerAmount,
181
184
  trackerGoal,
182
185
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
183
- text: `Deposit at least ${trackerGoal} ${cond.name}`,
186
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, `Deposit at least ${trackerGoal} ${cond.name}`),
184
187
  });
185
188
  }
186
189
  if (cond.out) {
@@ -195,7 +198,7 @@ function evaluateCurrency(cond, ctx) {
195
198
  trackerAmount,
196
199
  trackerGoal,
197
200
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
198
- text: `Withdraw at least ${trackerGoal} ${cond.name}`,
201
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, `Withdraw at least ${trackerGoal} ${cond.name}`),
199
202
  });
200
203
  }
201
204
  return { isMet, details };
@@ -216,7 +219,7 @@ function evaluateStakedTokens(cond, ctx) {
216
219
  trackerAmount,
217
220
  trackerGoal,
218
221
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
219
- text: `Have at least ${trackerGoal} ${cond.name} staked`,
222
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, `Have at least ${trackerGoal} ${cond.name} staked`),
220
223
  });
221
224
  }
222
225
  return { isMet, details };
@@ -242,7 +245,7 @@ function evaluateLoginStreak(cond, ctx) {
242
245
  trackerAmount,
243
246
  trackerGoal,
244
247
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, isMet),
245
- text: `Login streak of ${trackerGoal || 0} days`,
248
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal }, `Login streak of ${trackerGoal || 0} days`),
246
249
  },
247
250
  ],
248
251
  };
@@ -259,7 +262,7 @@ function evaluateAchievement(cond, ctx) {
259
262
  trackerAmount: 0,
260
263
  trackerGoal: 1,
261
264
  percentCompleted: 0,
262
- text: `Have the achievement ${cond.name}`,
265
+ text: templateText(cond, { current: 0, goal: 1, name: cond.name }, `Have the achievement ${cond.name}`),
263
266
  });
264
267
  }
265
268
  if (cond.minCount) {
@@ -274,7 +277,7 @@ function evaluateAchievement(cond, ctx) {
274
277
  trackerAmount,
275
278
  trackerGoal,
276
279
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
277
- text: `Have the achievement ${cond.name} more than ${trackerGoal} times`,
280
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, `Have the achievement ${cond.name} more than ${trackerGoal} times`),
278
281
  });
279
282
  }
280
283
  return { isMet, details };
@@ -295,7 +298,7 @@ function evaluateMembership(cond, ctx) {
295
298
  trackerAmount,
296
299
  trackerGoal,
297
300
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
298
- text: trackerGoal > 1 ? `Have at least ${trackerGoal} ${cond.name} memberships` : `Have a ${cond.name} membership`,
301
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, trackerGoal > 1 ? `Have at least ${trackerGoal} ${cond.name} memberships` : `Have a ${cond.name} membership`),
299
302
  });
300
303
  }
301
304
  if (cond.maxCount) {
@@ -309,7 +312,7 @@ function evaluateMembership(cond, ctx) {
309
312
  trackerAmount,
310
313
  trackerGoal: cond.maxCount,
311
314
  percentCompleted: met ? 100 : 0,
312
- text: `Have less than ${cond.maxCount} ${cond.name} memberships`,
315
+ text: templateText(cond, { current: trackerAmount, goal: cond.maxCount, name: cond.name }, `Have less than ${cond.maxCount} ${cond.name} memberships`),
313
316
  });
314
317
  }
315
318
  const timeOwned = (playerData?.expiresAt || 0) - Date.now();
@@ -325,7 +328,7 @@ function evaluateMembership(cond, ctx) {
325
328
  trackerAmount,
326
329
  trackerGoal,
327
330
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, met),
328
- text: `Own ${cond.name} membership for at least ${trackerGoal} days`,
331
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, `Own ${cond.name} membership for at least ${trackerGoal} days`),
329
332
  });
330
333
  }
331
334
  if (cond.maxMs) {
@@ -339,7 +342,7 @@ function evaluateMembership(cond, ctx) {
339
342
  trackerAmount,
340
343
  trackerGoal: Number((cond.maxMs / (1000 * 60 * 60 * 24)).toFixed(1)),
341
344
  percentCompleted: met ? 100 : 0,
342
- text: `Own ${cond.name} membership for less than ${(cond.maxMs / (1000 * 60 * 60 * 24)).toFixed(1)} days`,
345
+ text: templateText(cond, { current: trackerAmount, goal: Number((cond.maxMs / (1000 * 60 * 60 * 24)).toFixed(1)), name: cond.name }, `Own ${cond.name} membership for less than ${(cond.maxMs / (1000 * 60 * 60 * 24)).toFixed(1)} days`),
343
346
  });
344
347
  }
345
348
  return { isMet, details };
@@ -358,11 +361,11 @@ function evaluateQuest(cond, ctx) {
358
361
  trackerAmount,
359
362
  trackerGoal,
360
363
  percentCompleted: (0, helpers_1.calculatePercent)(trackerAmount, trackerGoal, isMet),
361
- text: cond.completions === 1
364
+ text: templateText(cond, { current: trackerAmount, goal: trackerGoal, name: cond.name }, cond.completions === 1
362
365
  ? `Complete the quest ${cond.name}`
363
366
  : (cond.completions || 0) < 1
364
367
  ? `Start the quest ${cond.name}`
365
- : `Complete the quest ${cond.name} ${cond.completions} times`,
368
+ : `Complete the quest ${cond.name} ${cond.completions} times`),
366
369
  },
367
370
  ],
368
371
  };
@@ -484,7 +487,7 @@ function evaluateIdentifiers(cond, ctx) {
484
487
  trackerAmount: isMet ? 1 : 0,
485
488
  trackerGoal: 1,
486
489
  percentCompleted,
487
- text: displayText,
490
+ text: templateText(cond, { current: metPlatforms.length, goal: platformsToCheck.length }, displayText),
488
491
  },
489
492
  ],
490
493
  };
@@ -509,7 +512,7 @@ function evaluateTokenBalance(cond, ctx) {
509
512
  trackerAmount: totalBalance,
510
513
  trackerGoal: cond.min,
511
514
  percentCompleted: (0, helpers_1.calculatePercent)(totalBalance, cond.min, met),
512
- text: `Have at least ${cond.min} ${cond.name || 'tokens'}`,
515
+ text: templateText(cond, { current: totalBalance, goal: cond.min, name: cond.name || 'tokens' }, `Have at least ${cond.min} ${cond.name || 'tokens'}`),
513
516
  });
514
517
  }
515
518
  if (cond.max !== undefined) {
@@ -522,7 +525,7 @@ function evaluateTokenBalance(cond, ctx) {
522
525
  trackerAmount: totalBalance,
523
526
  trackerGoal: cond.max,
524
527
  percentCompleted: met ? 100 : 0,
525
- text: `Have at most ${cond.max} ${cond.name || 'tokens'}`,
528
+ text: templateText(cond, { current: totalBalance, goal: cond.max, name: cond.name || 'tokens' }, `Have at most ${cond.max} ${cond.name || 'tokens'}`),
526
529
  });
527
530
  }
528
531
  return { isMet, details };
@@ -541,7 +544,7 @@ function evaluateStackedAccount(cond, ctx) {
541
544
  trackerAmount: playerHasAccount ? 1 : 0,
542
545
  trackerGoal: 1,
543
546
  percentCompleted: met ? 100 : 0,
544
- text: cond.hasLinkedAccount ? 'Link a Stacked account' : 'Must not have Stacked account linked',
547
+ text: templateText(cond, { current: playerHasAccount ? 1 : 0, goal: 1 }, cond.hasLinkedAccount ? 'Link a Stacked account' : 'Must not have Stacked account linked'),
545
548
  });
546
549
  }
547
550
  if (cond.cryptoWallets) {
@@ -556,7 +559,7 @@ function evaluateStackedAccount(cond, ctx) {
556
559
  trackerAmount: walletCount,
557
560
  trackerGoal: cond.cryptoWallets.min,
558
561
  percentCompleted: (0, helpers_1.calculatePercent)(walletCount, cond.cryptoWallets.min, met),
559
- text: `Link at least ${cond.cryptoWallets.min} crypto wallet${cond.cryptoWallets.min === 1 ? '' : 's'}`,
562
+ text: templateText(cond, { current: walletCount, goal: cond.cryptoWallets.min }, `Link at least ${cond.cryptoWallets.min} crypto wallet${cond.cryptoWallets.min === 1 ? '' : 's'}`),
560
563
  });
561
564
  }
562
565
  if (cond.cryptoWallets.max !== undefined) {
@@ -569,7 +572,7 @@ function evaluateStackedAccount(cond, ctx) {
569
572
  trackerAmount: walletCount,
570
573
  trackerGoal: cond.cryptoWallets.max,
571
574
  percentCompleted: met ? 100 : 0,
572
- text: `Have at most ${cond.cryptoWallets.max} crypto wallet${cond.cryptoWallets.max === 1 ? '' : 's'}`,
575
+ text: templateText(cond, { current: walletCount, goal: cond.cryptoWallets.max }, `Have at most ${cond.cryptoWallets.max} crypto wallet${cond.cryptoWallets.max === 1 ? '' : 's'}`),
573
576
  });
574
577
  }
575
578
  }
@@ -584,7 +587,7 @@ function evaluateStackedAccount(cond, ctx) {
584
587
  trackerAmount: hasCustomUsername ? 1 : 0,
585
588
  trackerGoal: 1,
586
589
  percentCompleted: met ? 100 : 0,
587
- text: cond.hasUsername ? 'Set a custom username' : 'Must not have a custom username',
590
+ text: templateText(cond, { current: hasCustomUsername ? 1 : 0, goal: 1 }, cond.hasUsername ? 'Set a custom username' : 'Must not have a custom username'),
588
591
  });
589
592
  }
590
593
  if (cond.hasProfilePic !== undefined) {
@@ -598,7 +601,7 @@ function evaluateStackedAccount(cond, ctx) {
598
601
  trackerAmount: hasCustomPic ? 1 : 0,
599
602
  trackerGoal: 1,
600
603
  percentCompleted: met ? 100 : 0,
601
- text: cond.hasProfilePic ? 'Set a custom profile picture' : 'Must not have a custom profile picture',
604
+ text: templateText(cond, { current: hasCustomPic ? 1 : 0, goal: 1 }, cond.hasProfilePic ? 'Set a custom profile picture' : 'Must not have a custom profile picture'),
602
605
  });
603
606
  }
604
607
  if (cond.authPlatforms && cond.authPlatforms.platforms.length > 0) {
@@ -635,7 +638,7 @@ function evaluateStackedAccount(cond, ctx) {
635
638
  trackerAmount: met ? 1 : 0,
636
639
  trackerGoal: 1,
637
640
  percentCompleted,
638
- text: displayText,
641
+ text: templateText(cond, { current: met ? 1 : 0, goal: 1 }, displayText),
639
642
  });
640
643
  }
641
644
  return { isMet, details };
@@ -654,7 +657,7 @@ function evaluateUserSettings(cond, ctx) {
654
657
  trackerAmount: playerHasNewsletter ? 1 : 0,
655
658
  trackerGoal: 1,
656
659
  percentCompleted: met ? 100 : 0,
657
- text: cond.emailNewsletter ? 'Subscribe to email newsletter' : 'Must not be subscribed to email newsletter',
660
+ text: templateText(cond, { current: playerHasNewsletter ? 1 : 0, goal: 1 }, cond.emailNewsletter ? 'Subscribe to email newsletter' : 'Must not be subscribed to email newsletter'),
658
661
  });
659
662
  }
660
663
  return { isMet, details };
@@ -672,7 +675,7 @@ function evaluateCompletionContext(cond, ctx) {
672
675
  trackerAmount: isMet ? 1 : 0,
673
676
  trackerGoal: 1,
674
677
  percentCompleted: isMet ? 100 : 0,
675
- text: cond.name,
678
+ text: templateText(cond, { current: isMet ? 1 : 0, goal: 1, name: cond.name }, cond.name),
676
679
  },
677
680
  ],
678
681
  };
@@ -691,7 +694,7 @@ function evaluateBuyItem(cond, ctx) {
691
694
  trackerAmount: trackerValue,
692
695
  trackerGoal: scaledAmount,
693
696
  percentCompleted: (0, helpers_1.calculatePercent)(trackerValue, scaledAmount, isMet),
694
- text: `Buy ${scaledAmount} ${cond.name}`,
697
+ text: templateText(cond, { current: trackerValue, goal: scaledAmount, name: cond.name }, `Buy ${scaledAmount} ${cond.name}`),
695
698
  },
696
699
  ],
697
700
  maxClaims: ctx.shouldScale && baseAmount > 0 ? Math.floor(trackerValue / baseAmount) : undefined,
@@ -711,7 +714,7 @@ function evaluateSpendCurrency(cond, ctx) {
711
714
  trackerAmount: trackerValue,
712
715
  trackerGoal: scaledAmount,
713
716
  percentCompleted: (0, helpers_1.calculatePercent)(trackerValue, scaledAmount, isMet),
714
- text: `Spend ${scaledAmount} ${cond.name}`,
717
+ text: templateText(cond, { current: trackerValue, goal: scaledAmount, name: cond.name }, `Spend ${scaledAmount} ${cond.name}`),
715
718
  },
716
719
  ],
717
720
  maxClaims: ctx.shouldScale && baseAmount > 0 ? Math.floor(trackerValue / baseAmount) : undefined,
@@ -731,13 +734,13 @@ function evaluateDepositCurrency(cond, ctx) {
731
734
  trackerAmount: trackerValue,
732
735
  trackerGoal: scaledAmount,
733
736
  percentCompleted: (0, helpers_1.calculatePercent)(trackerValue, scaledAmount, isMet),
734
- text: `Deposit ${scaledAmount} ${cond.name}`,
737
+ text: templateText(cond, { current: trackerValue, goal: scaledAmount, name: cond.name }, `Deposit ${scaledAmount} ${cond.name}`),
735
738
  },
736
739
  ],
737
740
  maxClaims: ctx.shouldScale && baseAmount > 0 ? Math.floor(trackerValue / baseAmount) : undefined,
738
741
  };
739
742
  }
740
- function evaluateLogin(_cond, ctx) {
743
+ function evaluateLogin(cond, ctx) {
741
744
  const isMet = new Date(ctx.snap.snapshotLastUpdated || 0).getTime() > new Date(ctx.offerCreatedAt || 0).getTime();
742
745
  return {
743
746
  isMet,
@@ -748,7 +751,7 @@ function evaluateLogin(_cond, ctx) {
748
751
  trackerAmount: isMet ? 1 : 0,
749
752
  trackerGoal: 1,
750
753
  percentCompleted: isMet ? 100 : 0,
751
- text: 'Login to the game',
754
+ text: templateText(cond, { current: isMet ? 1 : 0, goal: 1 }, 'Login to the game'),
752
755
  },
753
756
  ],
754
757
  };
@@ -812,11 +815,11 @@ function evaluateSocial(cond, ctx) {
812
815
  trackerAmount: matchCount,
813
816
  trackerGoal: 1,
814
817
  percentCompleted: socialPercent,
815
- text: hasContent
818
+ text: templateText(cond, { current: matchCount, goal: 1, likes, views, comments, minLikes, minViews, minComments }, hasContent
816
819
  ? `Found ${matchCount} matching ${platformText} post${matchCount !== 1 ? 's' : ''}`
817
820
  : requiredWords.length > 0
818
821
  ? `Post ${platformText} content with ${requiredWords.map((w) => `"${w}"`).join(', ')}${afterText}`
819
- : `Post ${platformText} content${afterText}`,
822
+ : `Post ${platformText} content${afterText}`),
820
823
  });
821
824
  }
822
825
  else {
@@ -827,11 +830,11 @@ function evaluateSocial(cond, ctx) {
827
830
  trackerAmount: hasContent ? 1 : 0,
828
831
  trackerGoal: 1,
829
832
  percentCompleted: socialPercent,
830
- text: !hasContent
833
+ text: templateText(cond, { current: hasContent ? 1 : 0, goal: 1, likes, views, comments, minLikes, minViews, minComments }, !hasContent
831
834
  ? requiredWords.length > 0
832
835
  ? `Attach a ${platformText} post with ${requiredWords.map((w) => `"${w}"`).join(', ')} in the title${afterText}`
833
836
  : `Attach a ${platformText} post${afterText}`
834
- : `Attached: ${title}`,
837
+ : `Attached: ${title}`),
835
838
  });
836
839
  }
837
840
  if (minLikes > 0) {
@@ -841,7 +844,7 @@ function evaluateSocial(cond, ctx) {
841
844
  trackerAmount: likes,
842
845
  trackerGoal: minLikes,
843
846
  percentCompleted: (0, helpers_1.calculatePercent)(likes, minLikes, hasContent && likes >= minLikes),
844
- text: mode === 'accumulate' ? `Combined ${minLikes} Likes` : `Reach ${minLikes} Likes`,
847
+ text: templateText(cond, { current: likes, goal: minLikes }, mode === 'accumulate' ? `Combined ${minLikes} Likes` : `Reach ${minLikes} Likes`),
845
848
  });
846
849
  }
847
850
  if (minViews > 0) {
@@ -851,7 +854,7 @@ function evaluateSocial(cond, ctx) {
851
854
  trackerAmount: views,
852
855
  trackerGoal: minViews,
853
856
  percentCompleted: (0, helpers_1.calculatePercent)(views, minViews, hasContent && views >= minViews),
854
- text: mode === 'accumulate' ? `Combined ${minViews} Views` : `Reach ${minViews} Views`,
857
+ text: templateText(cond, { current: views, goal: minViews }, mode === 'accumulate' ? `Combined ${minViews} Views` : `Reach ${minViews} Views`),
855
858
  });
856
859
  }
857
860
  if (minComments > 0) {
@@ -861,7 +864,7 @@ function evaluateSocial(cond, ctx) {
861
864
  trackerAmount: comments,
862
865
  trackerGoal: minComments,
863
866
  percentCompleted: (0, helpers_1.calculatePercent)(comments, minComments, hasContent && comments >= minComments),
864
- text: mode === 'accumulate' ? `Combined ${minComments} Comments` : `Reach ${minComments} Comments`,
867
+ text: templateText(cond, { current: comments, goal: minComments }, mode === 'accumulate' ? `Combined ${minComments} Comments` : `Reach ${minComments} Comments`),
865
868
  });
866
869
  }
867
870
  return { isMet, details, maxClaims };
@@ -1010,7 +1013,7 @@ function evaluateTwitterVerification(cond, ctx) {
1010
1013
  trackerAmount: isMet ? 1 : 0,
1011
1014
  trackerGoal: 1,
1012
1015
  percentCompleted: isMet ? 100 : 0,
1013
- text: actionTextMap[cond.action] || 'Complete action on X',
1016
+ text: templateText(cond, { current: isMet ? 1 : 0, goal: 1 }, actionTextMap[cond.action] || 'Complete action on X'),
1014
1017
  },
1015
1018
  ],
1016
1019
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackedapp/utils",
3
- "version": "2.39.2",
3
+ "version": "2.40.0",
4
4
  "description": "Public utilities for Stacked platform SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",