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

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.202609151845",
110
110
  // environments
111
111
  PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
112
112
  // error messages
@@ -60853,6 +60853,11 @@ class PaywallState extends SimpleEventTarget {
60853
60853
  };
60854
60854
  const initState = paywall.template?.initialState;
60855
60855
  state = { ...state, ...initState };
60856
+ // NAM-4244: the Nami app platform id is a per-configuration constant, not paywall data.
60857
+ // Read it once here so `${platform.id}` / `${state.platformId}` conditions resolve without
60858
+ // touching storage on the per-assertion render path. Assigned after the template's
60859
+ // initialState so an authored `platformId` cannot shadow the real one.
60860
+ state.platformId = storageService.getNamiConfig()?.appPlatformID ?? '';
60856
60861
  const launch = normalizeLaunchContext(state.launch, context, paywall.sku_menus);
60857
60862
  this.filteredSkuMenus = paywall.sku_menus ?? [];
60858
60863
  if (launch.productGroups.length) {
@@ -62605,6 +62610,25 @@ class FlowLiquidResolver {
62605
62610
  this.flowManager = flowManager;
62606
62611
  this.urlParams = getUrlParams();
62607
62612
  }
62613
+ /**
62614
+ * The paywall for the step currently on screen.
62615
+ *
62616
+ * Deliberately NOT `flow.component.paywall`: that is the outer paywall host
62617
+ * element, whose `paywall` field flow campaigns never populate (their campaign
62618
+ * rule carries `paywall: null`) and which the web renderer only assigns as a
62619
+ * side effect of the screen-transition animation — unset on a flow's first
62620
+ * screen, a screen behind afterwards. Apple reads per-screen state and Android
62621
+ * reads the step's screen id; this matches Android. (NAM-4371)
62622
+ */
62623
+ currentScreenPaywall() {
62624
+ const screenId = this.flowManager.currentFlow?.currentFlowStep?.screen;
62625
+ if (!screenId)
62626
+ return undefined;
62627
+ if (this.screenPaywallLookup?.screenId !== screenId) {
62628
+ this.screenPaywallLookup = { screenId, paywall: getPaywall(screenId) };
62629
+ }
62630
+ return this.screenPaywallLookup.paywall;
62631
+ }
62608
62632
  resolve(key) {
62609
62633
  const flow = this.flowManager.currentFlow;
62610
62634
  const screenState = flow?.component;
@@ -62669,9 +62693,12 @@ class FlowLiquidResolver {
62669
62693
  case "campaignExternalSegmentId":
62670
62694
  return screenState?.campaign?.external_segment ?? undefined;
62671
62695
  case "pageName":
62672
- return screenState?.paywall?.name;
62696
+ return this.currentScreenPaywall()?.name ?? screenState?.paywall?.name;
62673
62697
  case "pageId":
62674
- return screenState?.paywall?.id;
62698
+ // The step's screen id IS the paywall id, so report it even when the
62699
+ // template is not in the cache — a blank id is worse than an id whose
62700
+ // template we could not look up.
62701
+ return flow?.currentFlowStep?.screen ?? screenState?.paywall?.id;
62675
62702
  case "flowName":
62676
62703
  return flow?.name;
62677
62704
  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.202609151845",
108
108
  // environments
109
109
  PRODUCTION = "production", DEVELOPMENT = "development",
110
110
  // error messages
@@ -60851,6 +60851,11 @@ class PaywallState extends SimpleEventTarget {
60851
60851
  };
60852
60852
  const initState = paywall.template?.initialState;
60853
60853
  state = { ...state, ...initState };
60854
+ // NAM-4244: the Nami app platform id is a per-configuration constant, not paywall data.
60855
+ // Read it once here so `${platform.id}` / `${state.platformId}` conditions resolve without
60856
+ // touching storage on the per-assertion render path. Assigned after the template's
60857
+ // initialState so an authored `platformId` cannot shadow the real one.
60858
+ state.platformId = storageService.getNamiConfig()?.appPlatformID ?? '';
60854
60859
  const launch = normalizeLaunchContext(state.launch, context, paywall.sku_menus);
60855
60860
  this.filteredSkuMenus = paywall.sku_menus ?? [];
60856
60861
  if (launch.productGroups.length) {
@@ -62603,6 +62608,25 @@ class FlowLiquidResolver {
62603
62608
  this.flowManager = flowManager;
62604
62609
  this.urlParams = getUrlParams();
62605
62610
  }
62611
+ /**
62612
+ * The paywall for the step currently on screen.
62613
+ *
62614
+ * Deliberately NOT `flow.component.paywall`: that is the outer paywall host
62615
+ * element, whose `paywall` field flow campaigns never populate (their campaign
62616
+ * rule carries `paywall: null`) and which the web renderer only assigns as a
62617
+ * side effect of the screen-transition animation — unset on a flow's first
62618
+ * screen, a screen behind afterwards. Apple reads per-screen state and Android
62619
+ * reads the step's screen id; this matches Android. (NAM-4371)
62620
+ */
62621
+ currentScreenPaywall() {
62622
+ const screenId = this.flowManager.currentFlow?.currentFlowStep?.screen;
62623
+ if (!screenId)
62624
+ return undefined;
62625
+ if (this.screenPaywallLookup?.screenId !== screenId) {
62626
+ this.screenPaywallLookup = { screenId, paywall: getPaywall(screenId) };
62627
+ }
62628
+ return this.screenPaywallLookup.paywall;
62629
+ }
62606
62630
  resolve(key) {
62607
62631
  const flow = this.flowManager.currentFlow;
62608
62632
  const screenState = flow?.component;
@@ -62667,9 +62691,12 @@ class FlowLiquidResolver {
62667
62691
  case "campaignExternalSegmentId":
62668
62692
  return screenState?.campaign?.external_segment ?? undefined;
62669
62693
  case "pageName":
62670
- return screenState?.paywall?.name;
62694
+ return this.currentScreenPaywall()?.name ?? screenState?.paywall?.name;
62671
62695
  case "pageId":
62672
- return screenState?.paywall?.id;
62696
+ // The step's screen id IS the paywall id, so report it even when the
62697
+ // template is not in the cache — a blank id is worse than an id whose
62698
+ // template we could not look up.
62699
+ return flow?.currentFlowStep?.screen ?? screenState?.paywall?.id;
62673
62700
  case "flowName":
62674
62701
  return flow?.name;
62675
62702
  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.202609151845",
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",