@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.
- package/dist/conditions.js +4 -2
- package/dist/template.js +1 -1
- package/package.json +1 -1
package/dist/conditions.js
CHANGED
|
@@ -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)(
|
|
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) {
|