@stackedapp/utils 1.12.1 → 1.13.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.
@@ -543,7 +543,7 @@ additionalData, }) => {
543
543
  trackerAmount,
544
544
  trackerGoal,
545
545
  percentCompleted,
546
- text: (0, template_1.renderTemplate)(conditions.dynamic.template, dynamicObj) || 'Dynamic conditions',
546
+ text: (0, template_1.renderTemplate)((0, template_1.replaceDynamicConditionKey)(conditions.dynamic.template || '', playerOffer?.trackers || {}), dynamicObj) || 'Dynamic conditions',
547
547
  });
548
548
  if (!dynamicResult)
549
549
  isValid = false;
@@ -1067,7 +1067,9 @@ const meetsCompletionConditions = ({ completionConditions, completionTrackers, p
1067
1067
  trackerAmount,
1068
1068
  trackerGoal,
1069
1069
  percentCompleted,
1070
- text: (0, template_1.renderTemplate)(conditions.dynamicTracker.template, primitiveTrackers) || 'Dynamic conditions',
1070
+ text: (0, template_1.renderTemplate)(
1071
+ // First resolve {{}} placeholders (e.g., {{surfacerPlayerId}}) using offer trackers
1072
+ (0, template_1.replaceDynamicConditionKey)(conditions.dynamicTracker.template || '', playerOffer?.trackers || {}), primitiveTrackers) || 'Dynamic conditions',
1071
1073
  });
1072
1074
  if (!dynamicResult)
1073
1075
  isValid = false;
package/dist/template.js CHANGED
@@ -4,7 +4,7 @@ exports.extractTemplateKeys = extractTemplateKeys;
4
4
  exports.renderTemplate = renderTemplate;
5
5
  exports.replaceDynamicConditionKey = replaceDynamicConditionKey;
6
6
  exports.replaceDynamicConditionKeys = replaceDynamicConditionKeys;
7
- const keyPattern = /\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g;
7
+ const keyPattern = /\{([a-zA-Z_][a-zA-Z0-9_-]*)\}/g;
8
8
  // extract {key} placeholders from template string
9
9
  // e.g. "Hello {playerName}, you have {coins} coins!" → Set { "playerName", "coins" }
10
10
  function extractTemplateKeys(template) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackedapp/utils",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "description": "Public utilities for Stacked platform SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",