@namiml/sdk-core 3.4.11-dev.202609100556 → 3.4.11-dev.202609120011

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 CHANGED
@@ -106,7 +106,7 @@ const {
106
106
  // version — stamped by scripts/version.sh
107
107
  NAMI_SDK_VERSION: exports.NAMI_SDK_VERSION = "3.4.11",
108
108
  // full package version including dev suffix — stamped by scripts/version.sh
109
- NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.4.11-dev.202609100556",
109
+ NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.4.11-dev.202609120011",
110
110
  // environments
111
111
  PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
112
112
  // error messages
@@ -62605,6 +62605,25 @@ class FlowLiquidResolver {
62605
62605
  this.flowManager = flowManager;
62606
62606
  this.urlParams = getUrlParams();
62607
62607
  }
62608
+ /**
62609
+ * The paywall for the step currently on screen.
62610
+ *
62611
+ * Deliberately NOT `flow.component.paywall`: that is the outer paywall host
62612
+ * element, whose `paywall` field flow campaigns never populate (their campaign
62613
+ * rule carries `paywall: null`) and which the web renderer only assigns as a
62614
+ * side effect of the screen-transition animation — unset on a flow's first
62615
+ * screen, a screen behind afterwards. Apple reads per-screen state and Android
62616
+ * reads the step's screen id; this matches Android. (NAM-4371)
62617
+ */
62618
+ currentScreenPaywall() {
62619
+ const screenId = this.flowManager.currentFlow?.currentFlowStep?.screen;
62620
+ if (!screenId)
62621
+ return undefined;
62622
+ if (this.screenPaywallLookup?.screenId !== screenId) {
62623
+ this.screenPaywallLookup = { screenId, paywall: getPaywall(screenId) };
62624
+ }
62625
+ return this.screenPaywallLookup.paywall;
62626
+ }
62608
62627
  resolve(key) {
62609
62628
  const flow = this.flowManager.currentFlow;
62610
62629
  const screenState = flow?.component;
@@ -62669,9 +62688,12 @@ class FlowLiquidResolver {
62669
62688
  case "campaignExternalSegmentId":
62670
62689
  return screenState?.campaign?.external_segment ?? undefined;
62671
62690
  case "pageName":
62672
- return screenState?.paywall?.name;
62691
+ return this.currentScreenPaywall()?.name ?? screenState?.paywall?.name;
62673
62692
  case "pageId":
62674
- return screenState?.paywall?.id;
62693
+ // The step's screen id IS the paywall id, so report it even when the
62694
+ // template is not in the cache — a blank id is worse than an id whose
62695
+ // template we could not look up.
62696
+ return flow?.currentFlowStep?.screen ?? screenState?.paywall?.id;
62675
62697
  case "flowName":
62676
62698
  return flow?.name;
62677
62699
  case "flowId":
package/dist/index.mjs CHANGED
@@ -104,7 +104,7 @@ const {
104
104
  // version — stamped by scripts/version.sh
105
105
  NAMI_SDK_VERSION = "3.4.11",
106
106
  // full package version including dev suffix — stamped by scripts/version.sh
107
- NAMI_SDK_PACKAGE_VERSION = "3.4.11-dev.202609100556",
107
+ NAMI_SDK_PACKAGE_VERSION = "3.4.11-dev.202609120011",
108
108
  // environments
109
109
  PRODUCTION = "production", DEVELOPMENT = "development",
110
110
  // error messages
@@ -62603,6 +62603,25 @@ class FlowLiquidResolver {
62603
62603
  this.flowManager = flowManager;
62604
62604
  this.urlParams = getUrlParams();
62605
62605
  }
62606
+ /**
62607
+ * The paywall for the step currently on screen.
62608
+ *
62609
+ * Deliberately NOT `flow.component.paywall`: that is the outer paywall host
62610
+ * element, whose `paywall` field flow campaigns never populate (their campaign
62611
+ * rule carries `paywall: null`) and which the web renderer only assigns as a
62612
+ * side effect of the screen-transition animation — unset on a flow's first
62613
+ * screen, a screen behind afterwards. Apple reads per-screen state and Android
62614
+ * reads the step's screen id; this matches Android. (NAM-4371)
62615
+ */
62616
+ currentScreenPaywall() {
62617
+ const screenId = this.flowManager.currentFlow?.currentFlowStep?.screen;
62618
+ if (!screenId)
62619
+ return undefined;
62620
+ if (this.screenPaywallLookup?.screenId !== screenId) {
62621
+ this.screenPaywallLookup = { screenId, paywall: getPaywall(screenId) };
62622
+ }
62623
+ return this.screenPaywallLookup.paywall;
62624
+ }
62606
62625
  resolve(key) {
62607
62626
  const flow = this.flowManager.currentFlow;
62608
62627
  const screenState = flow?.component;
@@ -62667,9 +62686,12 @@ class FlowLiquidResolver {
62667
62686
  case "campaignExternalSegmentId":
62668
62687
  return screenState?.campaign?.external_segment ?? undefined;
62669
62688
  case "pageName":
62670
- return screenState?.paywall?.name;
62689
+ return this.currentScreenPaywall()?.name ?? screenState?.paywall?.name;
62671
62690
  case "pageId":
62672
- return screenState?.paywall?.id;
62691
+ // The step's screen id IS the paywall id, so report it even when the
62692
+ // template is not in the cache — a blank id is worse than an id whose
62693
+ // template we could not look up.
62694
+ return flow?.currentFlowStep?.screen ?? screenState?.paywall?.id;
62673
62695
  case "flowName":
62674
62696
  return flow?.name;
62675
62697
  case "flowId":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namiml/sdk-core",
3
- "version": "3.4.11-dev.202609100556",
3
+ "version": "3.4.11-dev.202609120011",
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",