@namiml/sdk-core 3.5.0-dev.202610311650 → 3.5.0-dev.202610312243
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/index.cjs +31 -4
- package/dist/index.mjs +31 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -106,7 +106,7 @@ const {
|
|
|
106
106
|
// version — stamped by scripts/version.sh
|
|
107
107
|
NAMI_SDK_VERSION: exports.NAMI_SDK_VERSION = "3.5.0",
|
|
108
108
|
// full package version including dev suffix — stamped by scripts/version.sh
|
|
109
|
-
NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.5.0-dev.
|
|
109
|
+
NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.5.0-dev.202610312243",
|
|
110
110
|
// environments
|
|
111
111
|
PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
|
|
112
112
|
// error messages
|
|
@@ -61574,6 +61574,23 @@ const getSystemTimeNow = () => {
|
|
|
61574
61574
|
}
|
|
61575
61575
|
return override;
|
|
61576
61576
|
};
|
|
61577
|
+
/**
|
|
61578
|
+
* Flow Liquid `{{ now }}` tokens (README "Flow Liquid `{{ now }}` token", NAM-5291): the string
|
|
61579
|
+
* `now`, `now.ms` or `now.iso` resolves to at `epochMs`, or `undefined` for any other key,
|
|
61580
|
+
* `now.foo` included. `epochMs` comes from `Date.getTime()`, an integer, so every form truncates.
|
|
61581
|
+
*/
|
|
61582
|
+
const resolveNowToken = (key, epochMs) => {
|
|
61583
|
+
switch (key) {
|
|
61584
|
+
case "now":
|
|
61585
|
+
return String(Math.floor(epochMs / 1000));
|
|
61586
|
+
case "now.ms":
|
|
61587
|
+
return String(epochMs);
|
|
61588
|
+
case "now.iso":
|
|
61589
|
+
return new Date(epochMs).toISOString();
|
|
61590
|
+
default:
|
|
61591
|
+
return undefined;
|
|
61592
|
+
}
|
|
61593
|
+
};
|
|
61577
61594
|
/**
|
|
61578
61595
|
* Evaluates a Page assertion against a presentation's `PaywallState` snapshot
|
|
61579
61596
|
* (`state.systemTimeSnapshot`, taken once in `PaywallState.setPaywall`). This is the one entry
|
|
@@ -63833,6 +63850,12 @@ class FlowLiquidResolver {
|
|
|
63833
63850
|
return this.screenPaywallLookup.paywall;
|
|
63834
63851
|
}
|
|
63835
63852
|
resolve(key) {
|
|
63853
|
+
// Matched before every other key, so neither the URL-param fallback (`?now=`) nor
|
|
63854
|
+
// launchContext.now can shadow it. now.foo is an ordinary unknown key.
|
|
63855
|
+
if (key === "now" || key === "now.ms" || key === "now.iso") {
|
|
63856
|
+
this.nowMs ??= getSystemTimeNow().getTime();
|
|
63857
|
+
return resolveNowToken(key, this.nowMs);
|
|
63858
|
+
}
|
|
63836
63859
|
const flow = this.flowManager.currentFlow;
|
|
63837
63860
|
const screenState = flow?.component;
|
|
63838
63861
|
// Handle launchContext paths
|
|
@@ -65957,9 +65980,11 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
65957
65980
|
}
|
|
65958
65981
|
// Legacy payload precedence, unchanged: embedded handoffData →
|
|
65959
65982
|
// trigger data → form data (when a form id is present) → none.
|
|
65983
|
+
// Only the authored handoffData is Flow Liquid; trigger data and
|
|
65984
|
+
// form data can carry user-typed text (NAM-5291).
|
|
65960
65985
|
let payload;
|
|
65961
65986
|
if (action.parameters?.handoffData) {
|
|
65962
|
-
payload = action.parameters.handoffData;
|
|
65987
|
+
payload = new FlowLiquidResolver(this.manager).interpolateDeep(action.parameters.handoffData);
|
|
65963
65988
|
}
|
|
65964
65989
|
else if (data) {
|
|
65965
65990
|
payload = data;
|
|
@@ -66034,8 +66059,10 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
66034
66059
|
break;
|
|
66035
66060
|
case exports.NamiFlowActionFunction.SET_TAGS:
|
|
66036
66061
|
if (action.parameters) {
|
|
66037
|
-
|
|
66038
|
-
|
|
66062
|
+
// Values are Flow Liquid, one instant per action (NAM-5291).
|
|
66063
|
+
const tags = new FlowLiquidResolver(this.manager).interpolateDeep(action.parameters);
|
|
66064
|
+
PaywallState.setUserTags(tags);
|
|
66065
|
+
Object.entries(tags).forEach(([key, value]) => {
|
|
66039
66066
|
NamiCustomerManager$2.setCustomerAttribute(key, value);
|
|
66040
66067
|
});
|
|
66041
66068
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -104,7 +104,7 @@ const {
|
|
|
104
104
|
// version — stamped by scripts/version.sh
|
|
105
105
|
NAMI_SDK_VERSION = "3.5.0",
|
|
106
106
|
// full package version including dev suffix — stamped by scripts/version.sh
|
|
107
|
-
NAMI_SDK_PACKAGE_VERSION = "3.5.0-dev.
|
|
107
|
+
NAMI_SDK_PACKAGE_VERSION = "3.5.0-dev.202610312243",
|
|
108
108
|
// environments
|
|
109
109
|
PRODUCTION = "production", DEVELOPMENT = "development",
|
|
110
110
|
// error messages
|
|
@@ -61572,6 +61572,23 @@ const getSystemTimeNow = () => {
|
|
|
61572
61572
|
}
|
|
61573
61573
|
return override;
|
|
61574
61574
|
};
|
|
61575
|
+
/**
|
|
61576
|
+
* Flow Liquid `{{ now }}` tokens (README "Flow Liquid `{{ now }}` token", NAM-5291): the string
|
|
61577
|
+
* `now`, `now.ms` or `now.iso` resolves to at `epochMs`, or `undefined` for any other key,
|
|
61578
|
+
* `now.foo` included. `epochMs` comes from `Date.getTime()`, an integer, so every form truncates.
|
|
61579
|
+
*/
|
|
61580
|
+
const resolveNowToken = (key, epochMs) => {
|
|
61581
|
+
switch (key) {
|
|
61582
|
+
case "now":
|
|
61583
|
+
return String(Math.floor(epochMs / 1000));
|
|
61584
|
+
case "now.ms":
|
|
61585
|
+
return String(epochMs);
|
|
61586
|
+
case "now.iso":
|
|
61587
|
+
return new Date(epochMs).toISOString();
|
|
61588
|
+
default:
|
|
61589
|
+
return undefined;
|
|
61590
|
+
}
|
|
61591
|
+
};
|
|
61575
61592
|
/**
|
|
61576
61593
|
* Evaluates a Page assertion against a presentation's `PaywallState` snapshot
|
|
61577
61594
|
* (`state.systemTimeSnapshot`, taken once in `PaywallState.setPaywall`). This is the one entry
|
|
@@ -63831,6 +63848,12 @@ class FlowLiquidResolver {
|
|
|
63831
63848
|
return this.screenPaywallLookup.paywall;
|
|
63832
63849
|
}
|
|
63833
63850
|
resolve(key) {
|
|
63851
|
+
// Matched before every other key, so neither the URL-param fallback (`?now=`) nor
|
|
63852
|
+
// launchContext.now can shadow it. now.foo is an ordinary unknown key.
|
|
63853
|
+
if (key === "now" || key === "now.ms" || key === "now.iso") {
|
|
63854
|
+
this.nowMs ??= getSystemTimeNow().getTime();
|
|
63855
|
+
return resolveNowToken(key, this.nowMs);
|
|
63856
|
+
}
|
|
63834
63857
|
const flow = this.flowManager.currentFlow;
|
|
63835
63858
|
const screenState = flow?.component;
|
|
63836
63859
|
// Handle launchContext paths
|
|
@@ -65955,9 +65978,11 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
65955
65978
|
}
|
|
65956
65979
|
// Legacy payload precedence, unchanged: embedded handoffData →
|
|
65957
65980
|
// trigger data → form data (when a form id is present) → none.
|
|
65981
|
+
// Only the authored handoffData is Flow Liquid; trigger data and
|
|
65982
|
+
// form data can carry user-typed text (NAM-5291).
|
|
65958
65983
|
let payload;
|
|
65959
65984
|
if (action.parameters?.handoffData) {
|
|
65960
|
-
payload = action.parameters.handoffData;
|
|
65985
|
+
payload = new FlowLiquidResolver(this.manager).interpolateDeep(action.parameters.handoffData);
|
|
65961
65986
|
}
|
|
65962
65987
|
else if (data) {
|
|
65963
65988
|
payload = data;
|
|
@@ -66032,8 +66057,10 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
66032
66057
|
break;
|
|
66033
66058
|
case NamiFlowActionFunction.SET_TAGS:
|
|
66034
66059
|
if (action.parameters) {
|
|
66035
|
-
|
|
66036
|
-
|
|
66060
|
+
// Values are Flow Liquid, one instant per action (NAM-5291).
|
|
66061
|
+
const tags = new FlowLiquidResolver(this.manager).interpolateDeep(action.parameters);
|
|
66062
|
+
PaywallState.setUserTags(tags);
|
|
66063
|
+
Object.entries(tags).forEach(([key, value]) => {
|
|
66037
66064
|
NamiCustomerManager$2.setCustomerAttribute(key, value);
|
|
66038
66065
|
});
|
|
66039
66066
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namiml/sdk-core",
|
|
3
|
-
"version": "3.5.0-dev.
|
|
3
|
+
"version": "3.5.0-dev.202610312243",
|
|
4
4
|
"description": "Platform-agnostic core for the Nami SDK — business logic, API, types, and state management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|