@namiml/sdk-core 3.4.1-dev.202605262345 → 3.4.1-dev.202605272004

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.1",
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.1-dev.202605262345",
101
+ NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.4.1-dev.202605272004",
102
102
  // environments
103
103
  PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
104
104
  // error messages
@@ -12412,6 +12412,7 @@ exports.NamiFlowActionFunction = void 0;
12412
12412
  NamiFlowActionFunction["SET_TAGS"] = "setTags";
12413
12413
  NamiFlowActionFunction["PAUSE"] = "flowPause";
12414
12414
  NamiFlowActionFunction["RESUME"] = "flowResume";
12415
+ NamiFlowActionFunction["SET_LAUNCH_CONTEXT"] = "setLaunchContext";
12415
12416
  })(exports.NamiFlowActionFunction || (exports.NamiFlowActionFunction = {}));
12416
12417
  const HandoffTag = {
12417
12418
  SEQUENCE: '__handoff_sequence__',
@@ -13950,6 +13951,16 @@ class NamiFlow extends BasicNamiFlow {
13950
13951
  this.forward(entry.id);
13951
13952
  }
13952
13953
  }
13954
+ applyLaunchContextAttributes(attrs) {
13955
+ if (!this.context) {
13956
+ this.context = { customAttributes: {} };
13957
+ new LaunchContextResolver(this.context);
13958
+ }
13959
+ // Guard against a runtime-supplied context that omits customAttributes
13960
+ // (the field is required by the type but may be absent in untyped JSON).
13961
+ this.context.customAttributes ??= {};
13962
+ Object.assign(this.context.customAttributes, attrs);
13963
+ }
13953
13964
  registerResolvers(context) {
13954
13965
  if (context) {
13955
13966
  new LaunchContextResolver(context);
@@ -14206,6 +14217,9 @@ class NamiFlow extends BasicNamiFlow {
14206
14217
  this.back();
14207
14218
  break;
14208
14219
  case exports.NamiFlowActionFunction.NEXT:
14220
+ if (action.parameters?.customAttributes) {
14221
+ this.applyLaunchContextAttributes(action.parameters.customAttributes);
14222
+ }
14209
14223
  if (action.parameters?.step) {
14210
14224
  this.forward(action.parameters.step);
14211
14225
  }
@@ -14214,6 +14228,9 @@ class NamiFlow extends BasicNamiFlow {
14214
14228
  }
14215
14229
  break;
14216
14230
  case exports.NamiFlowActionFunction.NAVIGATE:
14231
+ if (action.parameters?.customAttributes) {
14232
+ this.applyLaunchContextAttributes(action.parameters.customAttributes);
14233
+ }
14217
14234
  if (action.parameters?.step) {
14218
14235
  if (this.previousFlowStep?.id === action.parameters.step) {
14219
14236
  this.back();
@@ -14339,6 +14356,20 @@ class NamiFlow extends BasicNamiFlow {
14339
14356
  });
14340
14357
  }
14341
14358
  break;
14359
+ case exports.NamiFlowActionFunction.SET_LAUNCH_CONTEXT: {
14360
+ // Two supported shapes (matches the nav-action customAttributes wire shape
14361
+ // and the { key, value } shape used by Apple/Android/Roku). We deliberately
14362
+ // do NOT treat arbitrary top-level parameters as attributes, to avoid writing
14363
+ // reserved keys (step, delay, …) into the launch context.
14364
+ const params = action.parameters;
14365
+ if (params?.customAttributes) {
14366
+ this.applyLaunchContextAttributes(params.customAttributes);
14367
+ }
14368
+ else if (params?.key !== undefined && params?.value !== undefined) {
14369
+ this.applyLaunchContextAttributes({ [params.key]: params.value });
14370
+ }
14371
+ break;
14372
+ }
14342
14373
  default:
14343
14374
  logger.warn(`Missing action handler for ${action.function}`, action);
14344
14375
  break;
package/dist/index.d.ts CHANGED
@@ -130,7 +130,8 @@ declare enum NamiFlowActionFunction {
130
130
  FLOW_DISABLED = "flowInteractionDisabled",
131
131
  SET_TAGS = "setTags",
132
132
  PAUSE = "flowPause",
133
- RESUME = "flowResume"
133
+ RESUME = "flowResume",
134
+ SET_LAUNCH_CONTEXT = "setLaunchContext"
134
135
  }
135
136
  type NamiFlowHandoffStepHandler = (handoffTag: string, handoffData?: Record<string, any>) => void;
136
137
  type NamiFlowEventHandler = (eventHandler: Record<string, any>) => void;
@@ -1429,6 +1430,7 @@ declare class NamiFlow extends BasicNamiFlow {
1429
1430
  [timerId: string]: TimerState;
1430
1431
  };
1431
1432
  constructor(campaign: NamiFlowCampaign, paywall: PaywallHandle, manager: NamiFlowManager, context?: NamiPaywallLaunchContext);
1433
+ private applyLaunchContextAttributes;
1432
1434
  private registerResolvers;
1433
1435
  get currentFlowStep(): NamiFlowStep | undefined;
1434
1436
  get nextStepAvailable(): boolean;
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.1",
98
98
  // full package version including dev suffix — stamped by scripts/version.sh
99
- NAMI_SDK_PACKAGE_VERSION = "3.4.1-dev.202605262345",
99
+ NAMI_SDK_PACKAGE_VERSION = "3.4.1-dev.202605272004",
100
100
  // environments
101
101
  PRODUCTION = "production", DEVELOPMENT = "development",
102
102
  // error messages
@@ -12410,6 +12410,7 @@ var NamiFlowActionFunction;
12410
12410
  NamiFlowActionFunction["SET_TAGS"] = "setTags";
12411
12411
  NamiFlowActionFunction["PAUSE"] = "flowPause";
12412
12412
  NamiFlowActionFunction["RESUME"] = "flowResume";
12413
+ NamiFlowActionFunction["SET_LAUNCH_CONTEXT"] = "setLaunchContext";
12413
12414
  })(NamiFlowActionFunction || (NamiFlowActionFunction = {}));
12414
12415
  const HandoffTag = {
12415
12416
  SEQUENCE: '__handoff_sequence__',
@@ -13948,6 +13949,16 @@ class NamiFlow extends BasicNamiFlow {
13948
13949
  this.forward(entry.id);
13949
13950
  }
13950
13951
  }
13952
+ applyLaunchContextAttributes(attrs) {
13953
+ if (!this.context) {
13954
+ this.context = { customAttributes: {} };
13955
+ new LaunchContextResolver(this.context);
13956
+ }
13957
+ // Guard against a runtime-supplied context that omits customAttributes
13958
+ // (the field is required by the type but may be absent in untyped JSON).
13959
+ this.context.customAttributes ??= {};
13960
+ Object.assign(this.context.customAttributes, attrs);
13961
+ }
13951
13962
  registerResolvers(context) {
13952
13963
  if (context) {
13953
13964
  new LaunchContextResolver(context);
@@ -14204,6 +14215,9 @@ class NamiFlow extends BasicNamiFlow {
14204
14215
  this.back();
14205
14216
  break;
14206
14217
  case NamiFlowActionFunction.NEXT:
14218
+ if (action.parameters?.customAttributes) {
14219
+ this.applyLaunchContextAttributes(action.parameters.customAttributes);
14220
+ }
14207
14221
  if (action.parameters?.step) {
14208
14222
  this.forward(action.parameters.step);
14209
14223
  }
@@ -14212,6 +14226,9 @@ class NamiFlow extends BasicNamiFlow {
14212
14226
  }
14213
14227
  break;
14214
14228
  case NamiFlowActionFunction.NAVIGATE:
14229
+ if (action.parameters?.customAttributes) {
14230
+ this.applyLaunchContextAttributes(action.parameters.customAttributes);
14231
+ }
14215
14232
  if (action.parameters?.step) {
14216
14233
  if (this.previousFlowStep?.id === action.parameters.step) {
14217
14234
  this.back();
@@ -14337,6 +14354,20 @@ class NamiFlow extends BasicNamiFlow {
14337
14354
  });
14338
14355
  }
14339
14356
  break;
14357
+ case NamiFlowActionFunction.SET_LAUNCH_CONTEXT: {
14358
+ // Two supported shapes (matches the nav-action customAttributes wire shape
14359
+ // and the { key, value } shape used by Apple/Android/Roku). We deliberately
14360
+ // do NOT treat arbitrary top-level parameters as attributes, to avoid writing
14361
+ // reserved keys (step, delay, …) into the launch context.
14362
+ const params = action.parameters;
14363
+ if (params?.customAttributes) {
14364
+ this.applyLaunchContextAttributes(params.customAttributes);
14365
+ }
14366
+ else if (params?.key !== undefined && params?.value !== undefined) {
14367
+ this.applyLaunchContextAttributes({ [params.key]: params.value });
14368
+ }
14369
+ break;
14370
+ }
14340
14371
  default:
14341
14372
  logger.warn(`Missing action handler for ${action.function}`, action);
14342
14373
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namiml/sdk-core",
3
- "version": "3.4.1-dev.202605262345",
3
+ "version": "3.4.1-dev.202605272004",
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",