@namiml/sdk-core 3.4.4-dev.202607022027 → 3.4.4-dev.202607022250

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
@@ -98,7 +98,7 @@ const {
98
98
  // version — stamped by scripts/version.sh
99
99
  NAMI_SDK_VERSION: exports.NAMI_SDK_VERSION = "3.4.4",
100
100
  // full package version including dev suffix — stamped by scripts/version.sh
101
- NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.4.4-dev.202607022027",
101
+ NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.4.4-dev.202607022250",
102
102
  // environments
103
103
  PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
104
104
  // error messages
@@ -57316,12 +57316,24 @@ class CampaignRuleRepository {
57316
57316
  return campaignRules;
57317
57317
  }
57318
57318
  finalizeCampaignRules(campaignRules, paywalls) {
57319
+ // NAM-2457: a server flow rule is kept only when BOTH assets are satisfied —
57320
+ // flow.object hydrated (from flow.url, or inline) AND every screen resolvable
57321
+ // against the fetched paywalls ∪ bundled initial-config paywalls. Dropping the
57322
+ // broken copy lets isCampaignAvailable and getPaywallDataFromLabel fall
57323
+ // through to the initial-config copy of the same placement.
57324
+ const resolvableIds = new Set([
57325
+ ...paywalls.map((p) => p.id),
57326
+ ...getInitialPaywalls().map((p) => p.id),
57327
+ ]);
57319
57328
  const validated = campaignRules?.filter((cRule) => {
57320
57329
  if (cRule.paywall) {
57321
57330
  return paywalls.find((p) => p.id == cRule.paywall);
57322
57331
  }
57323
57332
  else if (cRule.flow) {
57324
- return true;
57333
+ if (!cRule.flow.object)
57334
+ return false;
57335
+ const screens = cRule.flow.object.screens ?? [];
57336
+ return screens.every((id) => resolvableIds.has(id));
57325
57337
  }
57326
57338
  return false;
57327
57339
  });
@@ -61437,13 +61449,11 @@ class NamiRefs {
61437
61449
  .filter((c) => c.flow?.url && !c.flow.object)
61438
61450
  .map(async (c) => {
61439
61451
  try {
61440
- const res = await fetch(c.flow.url, { cache: 'no-cache' });
61441
- if (res.ok) {
61442
- c.flow.object = await res.json();
61443
- }
61444
- else {
61445
- logger.warn(`Failed to fetch flow object from ${c.flow.url}: ${res.status}`);
61446
- }
61452
+ // Same bounded retry policy as page fetches (NAM-2457); on
61453
+ // exhaustion flow.object stays unset and finalizeCampaignRules
61454
+ // drops the rule so the initial-config copy serves the placement.
61455
+ const result = await fetchWithCdnRetry(c.flow.url);
61456
+ c.flow.object = result.data;
61447
61457
  }
61448
61458
  catch (err) {
61449
61459
  logger.warn(`Error fetching flow object from ${c.flow.url}: ${err}`);
package/dist/index.mjs CHANGED
@@ -96,7 +96,7 @@ const {
96
96
  // version — stamped by scripts/version.sh
97
97
  NAMI_SDK_VERSION = "3.4.4",
98
98
  // full package version including dev suffix — stamped by scripts/version.sh
99
- NAMI_SDK_PACKAGE_VERSION = "3.4.4-dev.202607022027",
99
+ NAMI_SDK_PACKAGE_VERSION = "3.4.4-dev.202607022250",
100
100
  // environments
101
101
  PRODUCTION = "production", DEVELOPMENT = "development",
102
102
  // error messages
@@ -57314,12 +57314,24 @@ class CampaignRuleRepository {
57314
57314
  return campaignRules;
57315
57315
  }
57316
57316
  finalizeCampaignRules(campaignRules, paywalls) {
57317
+ // NAM-2457: a server flow rule is kept only when BOTH assets are satisfied —
57318
+ // flow.object hydrated (from flow.url, or inline) AND every screen resolvable
57319
+ // against the fetched paywalls ∪ bundled initial-config paywalls. Dropping the
57320
+ // broken copy lets isCampaignAvailable and getPaywallDataFromLabel fall
57321
+ // through to the initial-config copy of the same placement.
57322
+ const resolvableIds = new Set([
57323
+ ...paywalls.map((p) => p.id),
57324
+ ...getInitialPaywalls().map((p) => p.id),
57325
+ ]);
57317
57326
  const validated = campaignRules?.filter((cRule) => {
57318
57327
  if (cRule.paywall) {
57319
57328
  return paywalls.find((p) => p.id == cRule.paywall);
57320
57329
  }
57321
57330
  else if (cRule.flow) {
57322
- return true;
57331
+ if (!cRule.flow.object)
57332
+ return false;
57333
+ const screens = cRule.flow.object.screens ?? [];
57334
+ return screens.every((id) => resolvableIds.has(id));
57323
57335
  }
57324
57336
  return false;
57325
57337
  });
@@ -61435,13 +61447,11 @@ class NamiRefs {
61435
61447
  .filter((c) => c.flow?.url && !c.flow.object)
61436
61448
  .map(async (c) => {
61437
61449
  try {
61438
- const res = await fetch(c.flow.url, { cache: 'no-cache' });
61439
- if (res.ok) {
61440
- c.flow.object = await res.json();
61441
- }
61442
- else {
61443
- logger.warn(`Failed to fetch flow object from ${c.flow.url}: ${res.status}`);
61444
- }
61450
+ // Same bounded retry policy as page fetches (NAM-2457); on
61451
+ // exhaustion flow.object stays unset and finalizeCampaignRules
61452
+ // drops the rule so the initial-config copy serves the placement.
61453
+ const result = await fetchWithCdnRetry(c.flow.url);
61454
+ c.flow.object = result.data;
61445
61455
  }
61446
61456
  catch (err) {
61447
61457
  logger.warn(`Error fetching flow object from ${c.flow.url}: ${err}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namiml/sdk-core",
3
- "version": "3.4.4-dev.202607022027",
3
+ "version": "3.4.4-dev.202607022250",
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",