@namiml/sdk-core 3.5.0-dev.202610312122 → 3.5.0-dev.202611011529
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 +198 -22
- package/dist/index.d.ts +94 -3
- package/dist/index.mjs +189 -23
- 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.202611011529",
|
|
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
|
|
@@ -64629,33 +64652,60 @@ let NamiFlowManager$2 = class NamiFlowManager {
|
|
|
64629
64652
|
getCurrentFlowProgress(key) {
|
|
64630
64653
|
if (!this.currentFlow)
|
|
64631
64654
|
return 1;
|
|
64632
|
-
|
|
64655
|
+
const position = this.getCurrentFlowStepPosition();
|
|
64656
|
+
if (!position)
|
|
64657
|
+
return 0;
|
|
64658
|
+
let progress = position.index / position.total;
|
|
64659
|
+
progress = Math.max(0, Math.min(1, progress));
|
|
64660
|
+
if (key) {
|
|
64661
|
+
this.setLastAnimatedFlowProgress(key, progress);
|
|
64662
|
+
}
|
|
64663
|
+
return progress;
|
|
64664
|
+
}
|
|
64665
|
+
/**
|
|
64666
|
+
* Gets the 1-based position of the current screen within the flow, using the
|
|
64667
|
+
* same step math as {@link getCurrentFlowProgress}.
|
|
64668
|
+
* @returns The current step index (1-based), or 0 when unknown
|
|
64669
|
+
*/
|
|
64670
|
+
getCurrentFlowStepIndex() {
|
|
64671
|
+
const position = this.getCurrentFlowStepPosition();
|
|
64672
|
+
if (!position)
|
|
64633
64673
|
return 0;
|
|
64674
|
+
return Math.max(0, Math.min(position.total, position.index));
|
|
64675
|
+
}
|
|
64676
|
+
/**
|
|
64677
|
+
* Gets the total number of screen steps the current flow's progress is measured against.
|
|
64678
|
+
* @returns The total step count, or 0 when unknown (no open flow, no current step, no screens)
|
|
64679
|
+
*/
|
|
64680
|
+
getTotalFlowSteps() {
|
|
64681
|
+
return this.getCurrentFlowStepPosition()?.total ?? 0;
|
|
64682
|
+
}
|
|
64683
|
+
/**
|
|
64684
|
+
* Resolves the current flow position as an integer pair. `index / total` is the
|
|
64685
|
+
* flow progress. Returns null when the position is unknown.
|
|
64686
|
+
*/
|
|
64687
|
+
getCurrentFlowStepPosition() {
|
|
64688
|
+
if (!this.currentFlow)
|
|
64689
|
+
return null;
|
|
64690
|
+
if (!this.currentFlow.currentFlowStep)
|
|
64691
|
+
return null;
|
|
64634
64692
|
const allScreens = this.currentFlow.steps.filter(step => step.type === NamiFlowStepType.SCREEN);
|
|
64635
64693
|
if (allScreens.length === 0)
|
|
64636
|
-
return
|
|
64694
|
+
return null;
|
|
64637
64695
|
const visitedScreens = this.currentFlow.stepcrumbs.filter(step => step.type === NamiFlowStepType.SCREEN);
|
|
64638
64696
|
if (visitedScreens.length === 0)
|
|
64639
|
-
return
|
|
64697
|
+
return null;
|
|
64640
64698
|
const navGraph = this.buildNavGraph(this.currentFlow);
|
|
64641
64699
|
const currentStep = this.currentFlow.currentFlowStep;
|
|
64642
64700
|
// Find the branch point (first screen with multiple forward paths)
|
|
64643
64701
|
const branchPoint = this.findBranchPoint(allScreens, navGraph);
|
|
64644
|
-
let progress = 0;
|
|
64645
64702
|
if (branchPoint) {
|
|
64646
64703
|
// Branching flow
|
|
64647
|
-
|
|
64648
|
-
}
|
|
64649
|
-
else {
|
|
64650
|
-
// Linear flow
|
|
64651
|
-
const currentIndex = allScreens.findIndex(s => s.id === currentStep.id);
|
|
64652
|
-
progress = currentIndex >= 0 ? (currentIndex + 1) / allScreens.length : 0;
|
|
64653
|
-
}
|
|
64654
|
-
progress = Math.max(0, Math.min(1, progress));
|
|
64655
|
-
if (key) {
|
|
64656
|
-
this.setLastAnimatedFlowProgress(key, progress);
|
|
64704
|
+
return this.calculateBranchingProgress(visitedScreens, allScreens, currentStep, branchPoint, navGraph);
|
|
64657
64705
|
}
|
|
64658
|
-
|
|
64706
|
+
// Linear flow
|
|
64707
|
+
const currentIndex = allScreens.findIndex(s => s.id === currentStep.id);
|
|
64708
|
+
return { index: currentIndex >= 0 ? currentIndex + 1 : 0, total: allScreens.length };
|
|
64659
64709
|
}
|
|
64660
64710
|
/**
|
|
64661
64711
|
* Find the first screen that has branching (multiple forward navigation targets)
|
|
@@ -64669,7 +64719,8 @@ let NamiFlowManager$2 = class NamiFlowManager {
|
|
|
64669
64719
|
return null;
|
|
64670
64720
|
}
|
|
64671
64721
|
/**
|
|
64672
|
-
* Calculate
|
|
64722
|
+
* Calculate the step position for flows with branching (supports 2+ branches).
|
|
64723
|
+
* Progress is `index / total`.
|
|
64673
64724
|
*/
|
|
64674
64725
|
calculateBranchingProgress(visitedScreens, allScreens, currentStep, branchPoint, navGraph) {
|
|
64675
64726
|
const visitedCount = visitedScreens.length;
|
|
@@ -64683,14 +64734,14 @@ let NamiFlowManager$2 = class NamiFlowManager {
|
|
|
64683
64734
|
// - visitedScreens = currentPosition + 1 (0-indexed)
|
|
64684
64735
|
// - minimumTotalPathLength = branchPosition + 2
|
|
64685
64736
|
// (all screens before branch + branch itself + at least 1 screen after)
|
|
64686
|
-
return
|
|
64737
|
+
return { index: currentIndexInAll + 1, total: branchPointIndexInAll + 2 };
|
|
64687
64738
|
}
|
|
64688
64739
|
// Case 2: Past the branch point (entered a specific branch)
|
|
64689
64740
|
// Calculate based on: visitedScreens / (visitedScreens + remainingInThisBranch)
|
|
64690
64741
|
const remainingInBranch = this.countForwardScreens(currentStep, allScreens, navGraph);
|
|
64691
64742
|
const totalPathLength = visitedCount + remainingInBranch;
|
|
64692
64743
|
logger.debug(`Branching progress: visited=${visitedCount}, remaining=${remainingInBranch}, total=${totalPathLength}, step=${currentStep.id}`);
|
|
64693
|
-
return visitedCount
|
|
64744
|
+
return { index: visitedCount, total: totalPathLength };
|
|
64694
64745
|
}
|
|
64695
64746
|
/**
|
|
64696
64747
|
* Count how many screens are forward-reachable from the current step
|
|
@@ -64788,6 +64839,12 @@ let NamiFlowManager$2 = class NamiFlowManager {
|
|
|
64788
64839
|
static getCurrentFlowProgress(key) {
|
|
64789
64840
|
return this.instance.getCurrentFlowProgress(key);
|
|
64790
64841
|
}
|
|
64842
|
+
static getCurrentFlowStepIndex() {
|
|
64843
|
+
return this.instance.getCurrentFlowStepIndex();
|
|
64844
|
+
}
|
|
64845
|
+
static getTotalFlowSteps() {
|
|
64846
|
+
return this.instance.getTotalFlowSteps();
|
|
64847
|
+
}
|
|
64791
64848
|
/**
|
|
64792
64849
|
* Gets the current flow step's auto-advance delay (in seconds)
|
|
64793
64850
|
* Parses __appear__ actions to find flowNav/flowNext with a delay parameter
|
|
@@ -65957,9 +66014,11 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
65957
66014
|
}
|
|
65958
66015
|
// Legacy payload precedence, unchanged: embedded handoffData →
|
|
65959
66016
|
// trigger data → form data (when a form id is present) → none.
|
|
66017
|
+
// Only the authored handoffData is Flow Liquid; trigger data and
|
|
66018
|
+
// form data can carry user-typed text (NAM-5291).
|
|
65960
66019
|
let payload;
|
|
65961
66020
|
if (action.parameters?.handoffData) {
|
|
65962
|
-
payload = action.parameters.handoffData;
|
|
66021
|
+
payload = new FlowLiquidResolver(this.manager).interpolateDeep(action.parameters.handoffData);
|
|
65963
66022
|
}
|
|
65964
66023
|
else if (data) {
|
|
65965
66024
|
payload = data;
|
|
@@ -66034,8 +66093,10 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
66034
66093
|
break;
|
|
66035
66094
|
case exports.NamiFlowActionFunction.SET_TAGS:
|
|
66036
66095
|
if (action.parameters) {
|
|
66037
|
-
|
|
66038
|
-
|
|
66096
|
+
// Values are Flow Liquid, one instant per action (NAM-5291).
|
|
66097
|
+
const tags = new FlowLiquidResolver(this.manager).interpolateDeep(action.parameters);
|
|
66098
|
+
PaywallState.setUserTags(tags);
|
|
66099
|
+
Object.entries(tags).forEach(([key, value]) => {
|
|
66039
66100
|
NamiCustomerManager$2.setCustomerAttribute(key, value);
|
|
66040
66101
|
});
|
|
66041
66102
|
}
|
|
@@ -66988,6 +67049,111 @@ function aggregateScreenreaderText(page, focusedButtonLabel = '') {
|
|
|
66988
67049
|
return joinFragments(fragments);
|
|
66989
67050
|
}
|
|
66990
67051
|
|
|
67052
|
+
/**
|
|
67053
|
+
* Step model for the stepped `progressIndicator` (`style: "steps"`).
|
|
67054
|
+
*
|
|
67055
|
+
* Pure helpers shared by every TypeScript renderer (Web, Expo). Apple and
|
|
67056
|
+
* Android mirror these rules natively, so keep the behaviour in sync with
|
|
67057
|
+
* them when changing anything here.
|
|
67058
|
+
*/
|
|
67059
|
+
/** Smallest step count a fixed (non-"auto") `stepCount` resolves to. */
|
|
67060
|
+
const MIN_FIXED_STEP_COUNT = 2;
|
|
67061
|
+
/** Largest step count a fixed (non-"auto") `stepCount` resolves to. */
|
|
67062
|
+
const MAX_FIXED_STEP_COUNT = 12;
|
|
67063
|
+
/**
|
|
67064
|
+
* Parses a numeric field that may arrive as a number or as a numeric string
|
|
67065
|
+
* (for example from smart text). Returns NaN for "auto", missing, empty or
|
|
67066
|
+
* unparseable values.
|
|
67067
|
+
*/
|
|
67068
|
+
function parseStepNumber(value) {
|
|
67069
|
+
if (typeof value === "number")
|
|
67070
|
+
return Number.isFinite(value) ? value : NaN;
|
|
67071
|
+
if (typeof value === "string") {
|
|
67072
|
+
const trimmed = value.trim();
|
|
67073
|
+
if (trimmed === "")
|
|
67074
|
+
return NaN;
|
|
67075
|
+
const parsed = Number(trimmed);
|
|
67076
|
+
return Number.isFinite(parsed) ? parsed : NaN;
|
|
67077
|
+
}
|
|
67078
|
+
return NaN;
|
|
67079
|
+
}
|
|
67080
|
+
/** True when the component asks for the stepped style; anything else renders the bar. */
|
|
67081
|
+
function isStepsStyle(c) {
|
|
67082
|
+
return c.style === "steps";
|
|
67083
|
+
}
|
|
67084
|
+
/**
|
|
67085
|
+
* Resolves the number of segments to draw.
|
|
67086
|
+
*
|
|
67087
|
+
* "auto", missing or unparseable values use `autoTotal` as is (not clamped).
|
|
67088
|
+
* A number or numeric string is rounded and clamped to
|
|
67089
|
+
* [MIN_FIXED_STEP_COUNT, MAX_FIXED_STEP_COUNT].
|
|
67090
|
+
*/
|
|
67091
|
+
function resolveStepCount(stepCount, autoTotal) {
|
|
67092
|
+
const parsed = parseStepNumber(stepCount);
|
|
67093
|
+
if (Number.isNaN(parsed))
|
|
67094
|
+
return autoTotal;
|
|
67095
|
+
return Math.min(MAX_FIXED_STEP_COUNT, Math.max(MIN_FIXED_STEP_COUNT, Math.round(parsed)));
|
|
67096
|
+
}
|
|
67097
|
+
/**
|
|
67098
|
+
* Resolves the 1-based current step.
|
|
67099
|
+
*
|
|
67100
|
+
* "auto", missing or unparseable values use `autoIndex`. A number or numeric
|
|
67101
|
+
* string is rounded but not clamped: out-of-range values are handled by
|
|
67102
|
+
* {@link stepSegmentState}.
|
|
67103
|
+
*/
|
|
67104
|
+
function resolveCurrentStep(currentStep, autoIndex) {
|
|
67105
|
+
const parsed = parseStepNumber(currentStep);
|
|
67106
|
+
if (Number.isNaN(parsed))
|
|
67107
|
+
return autoIndex;
|
|
67108
|
+
return Math.round(parsed);
|
|
67109
|
+
}
|
|
67110
|
+
/**
|
|
67111
|
+
* State of the segment at 1-based `index1` given the 1-based `current` step.
|
|
67112
|
+
*
|
|
67113
|
+
* `currentStep` mode marks only the matching segment as current. Any other
|
|
67114
|
+
* `fillMode` (including unknown or missing) behaves as `fillUp`, which marks
|
|
67115
|
+
* every segment up to and including `current` as active.
|
|
67116
|
+
*/
|
|
67117
|
+
function stepSegmentState(index1, current, fillMode) {
|
|
67118
|
+
if (fillMode === "currentStep") {
|
|
67119
|
+
return index1 === current ? "current" : "inactive";
|
|
67120
|
+
}
|
|
67121
|
+
return index1 <= current ? "active" : "inactive";
|
|
67122
|
+
}
|
|
67123
|
+
/**
|
|
67124
|
+
* Width of one segment when `count` segments separated by `spacing` share
|
|
67125
|
+
* `available` width evenly. Never negative; 0 when `count <= 0`.
|
|
67126
|
+
*/
|
|
67127
|
+
function evenSegmentWidth(available, count, spacing) {
|
|
67128
|
+
if (count <= 0)
|
|
67129
|
+
return 0;
|
|
67130
|
+
return Math.max(0, (available - (count - 1) * spacing) / count);
|
|
67131
|
+
}
|
|
67132
|
+
/** Resolves `stepSizing`; unknown or missing values fall back to "even". */
|
|
67133
|
+
function resolveStepSizing(v) {
|
|
67134
|
+
return v === "fixed" ? "fixed" : "even";
|
|
67135
|
+
}
|
|
67136
|
+
/** Resolves `alignment`; unknown or missing values fall back to "center". */
|
|
67137
|
+
function resolveStepAlignment(v) {
|
|
67138
|
+
return v === "left" || v === "right" ? v : "center";
|
|
67139
|
+
}
|
|
67140
|
+
/**
|
|
67141
|
+
* First value that is actually set: skips `undefined`, `null`, `""` and
|
|
67142
|
+
* whitespace-only strings, so an empty `current*` field falls back to the
|
|
67143
|
+
* next candidate (for example `active*`) the way Apple and Android do.
|
|
67144
|
+
* `0`, `false` and other falsy non-string values count as set.
|
|
67145
|
+
*/
|
|
67146
|
+
function firstSet(...values) {
|
|
67147
|
+
for (const v of values) {
|
|
67148
|
+
if (v === undefined || v === null)
|
|
67149
|
+
continue;
|
|
67150
|
+
if (typeof v === "string" && v.trim() === "")
|
|
67151
|
+
continue;
|
|
67152
|
+
return v;
|
|
67153
|
+
}
|
|
67154
|
+
return undefined;
|
|
67155
|
+
}
|
|
67156
|
+
|
|
66991
67157
|
function namiBuySKU(skuRefId) {
|
|
66992
67158
|
if (!hasPurchaseManagement("NamiPurchaseManager.buySKU")) {
|
|
66993
67159
|
return;
|
|
@@ -67074,6 +67240,8 @@ exports.ExternalIDRequiredError = ExternalIDRequiredError;
|
|
|
67074
67240
|
exports.FlowScreensNotAvailableError = FlowScreensNotAvailableError;
|
|
67075
67241
|
exports.InternalServerError = InternalServerError;
|
|
67076
67242
|
exports.LaunchContextResolver = LaunchContextResolver;
|
|
67243
|
+
exports.MAX_FIXED_STEP_COUNT = MAX_FIXED_STEP_COUNT;
|
|
67244
|
+
exports.MIN_FIXED_STEP_COUNT = MIN_FIXED_STEP_COUNT;
|
|
67077
67245
|
exports.NAMI_STORAGE_KEYS = NAMI_STORAGE_KEYS;
|
|
67078
67246
|
exports.Nami = Nami;
|
|
67079
67247
|
exports.NamiAPI = NamiAPI;
|
|
@@ -67128,7 +67296,9 @@ exports.didReceiveResponse = didReceiveResponse;
|
|
|
67128
67296
|
exports.empty = empty;
|
|
67129
67297
|
exports.evaluateSystemTimeAssertion = evaluateSystemTimeAssertion;
|
|
67130
67298
|
exports.evaluateSystemTimeCondition = evaluateSystemTimeCondition;
|
|
67299
|
+
exports.evenSegmentWidth = evenSegmentWidth;
|
|
67131
67300
|
exports.extractStandardPricingPhases = extractStandardPricingPhases;
|
|
67301
|
+
exports.firstSet = firstSet;
|
|
67132
67302
|
exports.formatDate = formatDate;
|
|
67133
67303
|
exports.formattedPrice = formattedPrice;
|
|
67134
67304
|
exports.generateUUID = generateUUID;
|
|
@@ -67174,6 +67344,7 @@ exports.invokeHandler = invokeHandler;
|
|
|
67174
67344
|
exports.isAnonymousMode = isAnonymousMode;
|
|
67175
67345
|
exports.isInitialConfigCompressed = isInitialConfigCompressed;
|
|
67176
67346
|
exports.isNamiFlowCampaign = isNamiFlowCampaign;
|
|
67347
|
+
exports.isStepsStyle = isStepsStyle;
|
|
67177
67348
|
exports.isSubscription = isSubscription;
|
|
67178
67349
|
exports.isSystemTimeAssertion = isSystemTimeAssertion;
|
|
67179
67350
|
exports.isValidISODate = isValidISODate;
|
|
@@ -67189,12 +67360,17 @@ exports.productDetail = productDetail;
|
|
|
67189
67360
|
exports.registerAPITrafficObserver = registerAPITrafficObserver;
|
|
67190
67361
|
exports.registerPlatformAdapters = registerPlatformAdapters;
|
|
67191
67362
|
exports.registerPurchaseAdapter = registerPurchaseAdapter;
|
|
67363
|
+
exports.resolveCurrentStep = resolveCurrentStep;
|
|
67192
67364
|
exports.resolveLoopSource = resolveLoopSource;
|
|
67365
|
+
exports.resolveStepAlignment = resolveStepAlignment;
|
|
67366
|
+
exports.resolveStepCount = resolveStepCount;
|
|
67367
|
+
exports.resolveStepSizing = resolveStepSizing;
|
|
67193
67368
|
exports.selectSegment = selectSegment;
|
|
67194
67369
|
exports.setActiveNamiEntitlements = setActiveNamiEntitlements;
|
|
67195
67370
|
exports.shouldValidateProductGroups = shouldValidateProductGroups;
|
|
67196
67371
|
exports.skuItems = skuItems;
|
|
67197
67372
|
exports.skuMapFromEntitlements = skuMapFromEntitlements;
|
|
67373
|
+
exports.stepSegmentState = stepSegmentState;
|
|
67198
67374
|
exports.storageService = storageService;
|
|
67199
67375
|
exports.toDouble = toDouble;
|
|
67200
67376
|
exports.toNamiEntitlements = toNamiEntitlements;
|
package/dist/index.d.ts
CHANGED
|
@@ -1274,6 +1274,20 @@ type TProgressIndicatorComponent = TBaseComponent & {
|
|
|
1274
1274
|
innerPadding?: number;
|
|
1275
1275
|
activeDropShadow?: string;
|
|
1276
1276
|
inactiveDropShadow?: string;
|
|
1277
|
+
style?: "bar" | "steps";
|
|
1278
|
+
stepSizing?: "even" | "fixed";
|
|
1279
|
+
fillMode?: "fillUp" | "currentStep";
|
|
1280
|
+
stepCount?: "auto" | number | string;
|
|
1281
|
+
currentStep?: "auto" | number | string;
|
|
1282
|
+
indicatorSpacing?: number;
|
|
1283
|
+
alignment?: "left" | "center" | "right";
|
|
1284
|
+
activeSize?: number;
|
|
1285
|
+
currentSize?: number;
|
|
1286
|
+
inactiveSize?: number;
|
|
1287
|
+
currentFillColor?: string;
|
|
1288
|
+
currentFillColorFallback?: string;
|
|
1289
|
+
currentBorderRadius?: number;
|
|
1290
|
+
currentDropShadow?: string;
|
|
1277
1291
|
};
|
|
1278
1292
|
type TProgressBarComponent = TBaseComponent & {
|
|
1279
1293
|
component: "progressBar";
|
|
@@ -2270,12 +2284,29 @@ declare class NamiFlowManager$2 {
|
|
|
2270
2284
|
* @returns Progress as a percentage (0-1)
|
|
2271
2285
|
*/
|
|
2272
2286
|
getCurrentFlowProgress(key?: string): number;
|
|
2287
|
+
/**
|
|
2288
|
+
* Gets the 1-based position of the current screen within the flow, using the
|
|
2289
|
+
* same step math as {@link getCurrentFlowProgress}.
|
|
2290
|
+
* @returns The current step index (1-based), or 0 when unknown
|
|
2291
|
+
*/
|
|
2292
|
+
getCurrentFlowStepIndex(): number;
|
|
2293
|
+
/**
|
|
2294
|
+
* Gets the total number of screen steps the current flow's progress is measured against.
|
|
2295
|
+
* @returns The total step count, or 0 when unknown (no open flow, no current step, no screens)
|
|
2296
|
+
*/
|
|
2297
|
+
getTotalFlowSteps(): number;
|
|
2298
|
+
/**
|
|
2299
|
+
* Resolves the current flow position as an integer pair. `index / total` is the
|
|
2300
|
+
* flow progress. Returns null when the position is unknown.
|
|
2301
|
+
*/
|
|
2302
|
+
private getCurrentFlowStepPosition;
|
|
2273
2303
|
/**
|
|
2274
2304
|
* Find the first screen that has branching (multiple forward navigation targets)
|
|
2275
2305
|
*/
|
|
2276
2306
|
private findBranchPoint;
|
|
2277
2307
|
/**
|
|
2278
|
-
* Calculate
|
|
2308
|
+
* Calculate the step position for flows with branching (supports 2+ branches).
|
|
2309
|
+
* Progress is `index / total`.
|
|
2279
2310
|
*/
|
|
2280
2311
|
private calculateBranchingProgress;
|
|
2281
2312
|
/**
|
|
@@ -2296,6 +2327,8 @@ declare class NamiFlowManager$2 {
|
|
|
2296
2327
|
static getLastAnimatedFlowProgress(key: string): number;
|
|
2297
2328
|
static setLastAnimatedFlowProgress(key: string, value: number): void;
|
|
2298
2329
|
static getCurrentFlowProgress(key?: string): number;
|
|
2330
|
+
static getCurrentFlowStepIndex(): number;
|
|
2331
|
+
static getTotalFlowSteps(): number;
|
|
2299
2332
|
/**
|
|
2300
2333
|
* Gets the current flow step's auto-advance delay (in seconds)
|
|
2301
2334
|
* Parses __appear__ actions to find flowNav/flowNext with a delay parameter
|
|
@@ -3434,6 +3467,64 @@ declare function isAnonymousMode(): boolean;
|
|
|
3434
3467
|
*/
|
|
3435
3468
|
declare function aggregateScreenreaderText(page: TPages, focusedButtonLabel?: string): string;
|
|
3436
3469
|
|
|
3470
|
+
/**
|
|
3471
|
+
* Step model for the stepped `progressIndicator` (`style: "steps"`).
|
|
3472
|
+
*
|
|
3473
|
+
* Pure helpers shared by every TypeScript renderer (Web, Expo). Apple and
|
|
3474
|
+
* Android mirror these rules natively, so keep the behaviour in sync with
|
|
3475
|
+
* them when changing anything here.
|
|
3476
|
+
*/
|
|
3477
|
+
/** Smallest step count a fixed (non-"auto") `stepCount` resolves to. */
|
|
3478
|
+
declare const MIN_FIXED_STEP_COUNT = 2;
|
|
3479
|
+
/** Largest step count a fixed (non-"auto") `stepCount` resolves to. */
|
|
3480
|
+
declare const MAX_FIXED_STEP_COUNT = 12;
|
|
3481
|
+
/** Visual state of one step segment. */
|
|
3482
|
+
type TStepState = "active" | "current" | "inactive";
|
|
3483
|
+
/** True when the component asks for the stepped style; anything else renders the bar. */
|
|
3484
|
+
declare function isStepsStyle(c: {
|
|
3485
|
+
style?: string;
|
|
3486
|
+
}): boolean;
|
|
3487
|
+
/**
|
|
3488
|
+
* Resolves the number of segments to draw.
|
|
3489
|
+
*
|
|
3490
|
+
* "auto", missing or unparseable values use `autoTotal` as is (not clamped).
|
|
3491
|
+
* A number or numeric string is rounded and clamped to
|
|
3492
|
+
* [MIN_FIXED_STEP_COUNT, MAX_FIXED_STEP_COUNT].
|
|
3493
|
+
*/
|
|
3494
|
+
declare function resolveStepCount(stepCount: unknown, autoTotal: number): number;
|
|
3495
|
+
/**
|
|
3496
|
+
* Resolves the 1-based current step.
|
|
3497
|
+
*
|
|
3498
|
+
* "auto", missing or unparseable values use `autoIndex`. A number or numeric
|
|
3499
|
+
* string is rounded but not clamped: out-of-range values are handled by
|
|
3500
|
+
* {@link stepSegmentState}.
|
|
3501
|
+
*/
|
|
3502
|
+
declare function resolveCurrentStep(currentStep: unknown, autoIndex: number): number;
|
|
3503
|
+
/**
|
|
3504
|
+
* State of the segment at 1-based `index1` given the 1-based `current` step.
|
|
3505
|
+
*
|
|
3506
|
+
* `currentStep` mode marks only the matching segment as current. Any other
|
|
3507
|
+
* `fillMode` (including unknown or missing) behaves as `fillUp`, which marks
|
|
3508
|
+
* every segment up to and including `current` as active.
|
|
3509
|
+
*/
|
|
3510
|
+
declare function stepSegmentState(index1: number, current: number, fillMode?: string): TStepState;
|
|
3511
|
+
/**
|
|
3512
|
+
* Width of one segment when `count` segments separated by `spacing` share
|
|
3513
|
+
* `available` width evenly. Never negative; 0 when `count <= 0`.
|
|
3514
|
+
*/
|
|
3515
|
+
declare function evenSegmentWidth(available: number, count: number, spacing: number): number;
|
|
3516
|
+
/** Resolves `stepSizing`; unknown or missing values fall back to "even". */
|
|
3517
|
+
declare function resolveStepSizing(v?: string): "even" | "fixed";
|
|
3518
|
+
/** Resolves `alignment`; unknown or missing values fall back to "center". */
|
|
3519
|
+
declare function resolveStepAlignment(v?: string): "left" | "center" | "right";
|
|
3520
|
+
/**
|
|
3521
|
+
* First value that is actually set: skips `undefined`, `null`, `""` and
|
|
3522
|
+
* whitespace-only strings, so an empty `current*` field falls back to the
|
|
3523
|
+
* next candidate (for example `active*`) the way Apple and Android do.
|
|
3524
|
+
* `0`, `false` and other falsy non-string values count as set.
|
|
3525
|
+
*/
|
|
3526
|
+
declare function firstSet<T>(...values: T[]): Exclude<T, "" | null | undefined> | undefined;
|
|
3527
|
+
|
|
3437
3528
|
/**
|
|
3438
3529
|
* Returns the translated string for the given key in the current SDK language.
|
|
3439
3530
|
* Uses Nami language code from storage (set via Nami.configure({ namiLanguageCode })).
|
|
@@ -4451,5 +4542,5 @@ declare namespace internal {
|
|
|
4451
4542
|
};
|
|
4452
4543
|
}
|
|
4453
4544
|
|
|
4454
|
-
export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_TRAFFIC_OBSERVER, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_CACHE_TTL_PREFIX, CAMPAIGN_NOT_AVAILABLE, CONFIG_API_TIMEOUT_LIMIT, CONFIG_MAX_ATTEMPTS, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEFAULT_JOURNEY_SETTINGS, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DISABLE_ASYNC_LOGIN_LOGOUT, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LOG_HTTP_REQUESTS, LOG_HTTP_TRAFFIC, LaunchCampaignError, LaunchContextResolver, LogLevel, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, NAMI_STORAGE_KEYS, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager$2 as NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager$2 as NamiCustomerManager, NamiEntitlementManager$2 as NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager$1 as NamiFlowManager, NamiFlowStepType, NamiHandoffTag, NamiPaywallAction, NamiPaywallManager$2 as NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiPermissionOutcome, NamiPurchaseManager$2 as NamiPurchaseManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RESUME_THROTTLE_MS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SIMULATE_CONFIG_FETCH_FAILURE, SIMULATE_PAYWALL_FETCH_FAILURE, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STARTUP_TELEMETRY, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SYSTEM_TIME_FILTER_PREFIX, SYSTEM_TIME_TOKEN_PREFIX, SessionService, SimpleEventTarget, StorageService, TIME_OVERRIDE_PREFIX, TRANSPORT_FAILURE_STATUS, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, NamiProfileManager$1 as _NamiProfileManager, internal as _internal, activateEntitlementByPurchase, activeEntitlements, aggregateScreenreaderText, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bestUrlCampaignMatch, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, didReceiveResponse, empty, evaluateSystemTimeAssertion, evaluateSystemTimeCondition, extractStandardPricingPhases, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getJourneySettings, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getPurchaseAdapter, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getSystemTimeNow, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isSystemTimeAssertion, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseTimeOverride, parseToSemver, postConversion, productDetail, registerAPITrafficObserver, registerPlatformAdapters, registerPurchaseAdapter, resolveLoopSource, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateForm, validateMinSDKVersion, validateTextInput };
|
|
4455
|
-
export type { AccountStateHandler$1 as AccountStateHandler, AlignmentType, AmazonProduct, ApiResponse, AppleProduct, AvailableCampaignsResponseHandler, BorderLocationType, BorderSideType, Callback$1 as Callback, CloseHandler, CustomerJourneyState, DeepLinkUrlHandler, Device, DevicePayload, DeviceProfile, DirectionType, ExtendedPlatformInfo, FlexDirectionObject, FlowNavigationOptions, FontCollection, FontDetails, FormFactor, FormFieldValidator, GoogleProduct, IConfig, IDeviceAdapter, IEntitlements$1 as IEntitlements, IPaywall, IPlatformAdapters, IProductsWithComponents, IPurchaseAdapter, ISkuMenu, IStorageAdapter, IUIAdapter, Impression, InitialConfig, InitialConfigCompressed, InitiateStateGroup, JourneySettings, LoginResponse, NamiAPITrafficKind, NamiAPITrafficObserver, NamiAPITrafficRecord, NamiAnimation, NamiAnimationObjectSpec, NamiAnimationSpec, NamiAnonymousCampaign, NamiAppSuppliedVideoDetails, NamiCampaign, NamiCampaignManagerStatic, NamiCampaignSegment, NamiCompletionResult, NamiConfiguration, NamiConfigurationState, NamiCustomAttributeValue, NamiCustomerManagerStatic, NamiEntitlement$1 as NamiEntitlement, NamiEntitlementManagerStatic, NamiFlowAction, NamiFlowAnimation, NamiFlowCampaign, NamiFlowCompletionCondition, NamiFlowDTO, NamiFlowEventHandler, NamiFlowHandoffStepHandler, NamiFlowManagerStatic, NamiFlowObjectDTO, NamiFlowOn, NamiFlowStep, NamiFlowTransition, NamiFlowTransitionDirection, NamiFlowWithObject, NamiHandoffAttributeValue, NamiHandoffComplete, NamiHandoffOutcome, NamiHandoffTagValue, NamiInitialConfig, NamiKnownHandoffTag, NamiLanguageCodes, NamiLogLevel, NamiLoginSuccess, NamiPaywallActionHandler, NamiPaywallComponentChange, NamiPaywallEvent, NamiPaywallEventVideoMetadata, NamiPaywallLaunchContext, NamiPaywallManagerStatic, NamiPresentationStyle, NamiProductDetails, NamiProductOffer, NamiProfile, NamiPurchase, NamiPurchaseCompleteResult, NamiPurchaseDetails, NamiPurchaseManagerStatic, NamiPurchaseSuccess, NamiPurchasesState, NamiSKU, NamiSKUType, NamiSubscriptionInterval, NamiSubscriptionPeriod, NamiUserDataEnvelope, None, NoneSpec, PaywallActionEvent, PaywallHandle, PaywallResultHandler, PaywallSKU, PricingPhase, ProductGroup, Pulse, PulseSpec, PurchaseContext, PurchaseResult, PurchaseValidationRequest, SKU, SKUActionHandler, ScreenInfo, Session, TBaseComponent, TButtonContainer, TCarouselContainer, TCarouselSlide, TCarouselSlidesState, TCollapseContainer, TComponent, TConditionalAttributes, TConditionalComponent, TContainer, TContainerPosition, TCountdownTimerTextComponent, TDevice, TDisabledButton, TField, TFieldSettings, TFlexProductContainer, THeaderFooter, TImageComponent, TInitialState, TMediaTypes, TOffer, TPages, TPaywallContext, TPaywallLaunchContext, TPaywallMedia, TPaywallTemplate, TPlayPauseButton, TProductContainer, TProductGroup, TProgressBarComponent, TProgressIndicatorComponent, TQRCodeComponent, TRadioButton, TRepeatingGrid, TResponsiveGrid, TSegmentPicker, TSegmentPickerItem, TSemverObj, TSlot, TSlotGroupSelector, TSpacerComponent, TStack, TSvgImageComponent, TSymbolComponent, TTestObject, TTextComponent, TTextInputComponent, TTextInputType, TTextLikeComponent, TTextListComponent, TTimelineRail, TToggleButtonComponent, TToggleSwitch, TVariablePattern, TVideoComponent, TVolumeButton, TimerState, TransactionRequest, UserAction, UserActionParameters, Wave, WaveSpec };
|
|
4545
|
+
export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_TRAFFIC_OBSERVER, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_CACHE_TTL_PREFIX, CAMPAIGN_NOT_AVAILABLE, CONFIG_API_TIMEOUT_LIMIT, CONFIG_MAX_ATTEMPTS, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEFAULT_JOURNEY_SETTINGS, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DISABLE_ASYNC_LOGIN_LOGOUT, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LOG_HTTP_REQUESTS, LOG_HTTP_TRAFFIC, LaunchCampaignError, LaunchContextResolver, LogLevel, MAX_FIXED_STEP_COUNT, MIN_FIXED_STEP_COUNT, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, NAMI_STORAGE_KEYS, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager$2 as NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager$2 as NamiCustomerManager, NamiEntitlementManager$2 as NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager$1 as NamiFlowManager, NamiFlowStepType, NamiHandoffTag, NamiPaywallAction, NamiPaywallManager$2 as NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiPermissionOutcome, NamiPurchaseManager$2 as NamiPurchaseManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RESUME_THROTTLE_MS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SIMULATE_CONFIG_FETCH_FAILURE, SIMULATE_PAYWALL_FETCH_FAILURE, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STARTUP_TELEMETRY, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SYSTEM_TIME_FILTER_PREFIX, SYSTEM_TIME_TOKEN_PREFIX, SessionService, SimpleEventTarget, StorageService, TIME_OVERRIDE_PREFIX, TRANSPORT_FAILURE_STATUS, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, NamiProfileManager$1 as _NamiProfileManager, internal as _internal, activateEntitlementByPurchase, activeEntitlements, aggregateScreenreaderText, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bestUrlCampaignMatch, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, didReceiveResponse, empty, evaluateSystemTimeAssertion, evaluateSystemTimeCondition, evenSegmentWidth, extractStandardPricingPhases, firstSet, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getJourneySettings, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getPurchaseAdapter, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getSystemTimeNow, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isStepsStyle, isSubscription, isSystemTimeAssertion, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseTimeOverride, parseToSemver, postConversion, productDetail, registerAPITrafficObserver, registerPlatformAdapters, registerPurchaseAdapter, resolveCurrentStep, resolveLoopSource, resolveStepAlignment, resolveStepCount, resolveStepSizing, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, stepSegmentState, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateForm, validateMinSDKVersion, validateTextInput };
|
|
4546
|
+
export type { AccountStateHandler$1 as AccountStateHandler, AlignmentType, AmazonProduct, ApiResponse, AppleProduct, AvailableCampaignsResponseHandler, BorderLocationType, BorderSideType, Callback$1 as Callback, CloseHandler, CustomerJourneyState, DeepLinkUrlHandler, Device, DevicePayload, DeviceProfile, DirectionType, ExtendedPlatformInfo, FlexDirectionObject, FlowNavigationOptions, FontCollection, FontDetails, FormFactor, FormFieldValidator, GoogleProduct, IConfig, IDeviceAdapter, IEntitlements$1 as IEntitlements, IPaywall, IPlatformAdapters, IProductsWithComponents, IPurchaseAdapter, ISkuMenu, IStorageAdapter, IUIAdapter, Impression, InitialConfig, InitialConfigCompressed, InitiateStateGroup, JourneySettings, LoginResponse, NamiAPITrafficKind, NamiAPITrafficObserver, NamiAPITrafficRecord, NamiAnimation, NamiAnimationObjectSpec, NamiAnimationSpec, NamiAnonymousCampaign, NamiAppSuppliedVideoDetails, NamiCampaign, NamiCampaignManagerStatic, NamiCampaignSegment, NamiCompletionResult, NamiConfiguration, NamiConfigurationState, NamiCustomAttributeValue, NamiCustomerManagerStatic, NamiEntitlement$1 as NamiEntitlement, NamiEntitlementManagerStatic, NamiFlowAction, NamiFlowAnimation, NamiFlowCampaign, NamiFlowCompletionCondition, NamiFlowDTO, NamiFlowEventHandler, NamiFlowHandoffStepHandler, NamiFlowManagerStatic, NamiFlowObjectDTO, NamiFlowOn, NamiFlowStep, NamiFlowTransition, NamiFlowTransitionDirection, NamiFlowWithObject, NamiHandoffAttributeValue, NamiHandoffComplete, NamiHandoffOutcome, NamiHandoffTagValue, NamiInitialConfig, NamiKnownHandoffTag, NamiLanguageCodes, NamiLogLevel, NamiLoginSuccess, NamiPaywallActionHandler, NamiPaywallComponentChange, NamiPaywallEvent, NamiPaywallEventVideoMetadata, NamiPaywallLaunchContext, NamiPaywallManagerStatic, NamiPresentationStyle, NamiProductDetails, NamiProductOffer, NamiProfile, NamiPurchase, NamiPurchaseCompleteResult, NamiPurchaseDetails, NamiPurchaseManagerStatic, NamiPurchaseSuccess, NamiPurchasesState, NamiSKU, NamiSKUType, NamiSubscriptionInterval, NamiSubscriptionPeriod, NamiUserDataEnvelope, None, NoneSpec, PaywallActionEvent, PaywallHandle, PaywallResultHandler, PaywallSKU, PricingPhase, ProductGroup, Pulse, PulseSpec, PurchaseContext, PurchaseResult, PurchaseValidationRequest, SKU, SKUActionHandler, ScreenInfo, Session, TBaseComponent, TButtonContainer, TCarouselContainer, TCarouselSlide, TCarouselSlidesState, TCollapseContainer, TComponent, TConditionalAttributes, TConditionalComponent, TContainer, TContainerPosition, TCountdownTimerTextComponent, TDevice, TDisabledButton, TField, TFieldSettings, TFlexProductContainer, THeaderFooter, TImageComponent, TInitialState, TMediaTypes, TOffer, TPages, TPaywallContext, TPaywallLaunchContext, TPaywallMedia, TPaywallTemplate, TPlayPauseButton, TProductContainer, TProductGroup, TProgressBarComponent, TProgressIndicatorComponent, TQRCodeComponent, TRadioButton, TRepeatingGrid, TResponsiveGrid, TSegmentPicker, TSegmentPickerItem, TSemverObj, TSlot, TSlotGroupSelector, TSpacerComponent, TStack, TStepState, TSvgImageComponent, TSymbolComponent, TTestObject, TTextComponent, TTextInputComponent, TTextInputType, TTextLikeComponent, TTextListComponent, TTimelineRail, TToggleButtonComponent, TToggleSwitch, TVariablePattern, TVideoComponent, TVolumeButton, TimerState, TransactionRequest, UserAction, UserActionParameters, Wave, WaveSpec };
|
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.202611011529",
|
|
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
|
|
@@ -64627,33 +64650,60 @@ let NamiFlowManager$2 = class NamiFlowManager {
|
|
|
64627
64650
|
getCurrentFlowProgress(key) {
|
|
64628
64651
|
if (!this.currentFlow)
|
|
64629
64652
|
return 1;
|
|
64630
|
-
|
|
64653
|
+
const position = this.getCurrentFlowStepPosition();
|
|
64654
|
+
if (!position)
|
|
64655
|
+
return 0;
|
|
64656
|
+
let progress = position.index / position.total;
|
|
64657
|
+
progress = Math.max(0, Math.min(1, progress));
|
|
64658
|
+
if (key) {
|
|
64659
|
+
this.setLastAnimatedFlowProgress(key, progress);
|
|
64660
|
+
}
|
|
64661
|
+
return progress;
|
|
64662
|
+
}
|
|
64663
|
+
/**
|
|
64664
|
+
* Gets the 1-based position of the current screen within the flow, using the
|
|
64665
|
+
* same step math as {@link getCurrentFlowProgress}.
|
|
64666
|
+
* @returns The current step index (1-based), or 0 when unknown
|
|
64667
|
+
*/
|
|
64668
|
+
getCurrentFlowStepIndex() {
|
|
64669
|
+
const position = this.getCurrentFlowStepPosition();
|
|
64670
|
+
if (!position)
|
|
64631
64671
|
return 0;
|
|
64672
|
+
return Math.max(0, Math.min(position.total, position.index));
|
|
64673
|
+
}
|
|
64674
|
+
/**
|
|
64675
|
+
* Gets the total number of screen steps the current flow's progress is measured against.
|
|
64676
|
+
* @returns The total step count, or 0 when unknown (no open flow, no current step, no screens)
|
|
64677
|
+
*/
|
|
64678
|
+
getTotalFlowSteps() {
|
|
64679
|
+
return this.getCurrentFlowStepPosition()?.total ?? 0;
|
|
64680
|
+
}
|
|
64681
|
+
/**
|
|
64682
|
+
* Resolves the current flow position as an integer pair. `index / total` is the
|
|
64683
|
+
* flow progress. Returns null when the position is unknown.
|
|
64684
|
+
*/
|
|
64685
|
+
getCurrentFlowStepPosition() {
|
|
64686
|
+
if (!this.currentFlow)
|
|
64687
|
+
return null;
|
|
64688
|
+
if (!this.currentFlow.currentFlowStep)
|
|
64689
|
+
return null;
|
|
64632
64690
|
const allScreens = this.currentFlow.steps.filter(step => step.type === NamiFlowStepType.SCREEN);
|
|
64633
64691
|
if (allScreens.length === 0)
|
|
64634
|
-
return
|
|
64692
|
+
return null;
|
|
64635
64693
|
const visitedScreens = this.currentFlow.stepcrumbs.filter(step => step.type === NamiFlowStepType.SCREEN);
|
|
64636
64694
|
if (visitedScreens.length === 0)
|
|
64637
|
-
return
|
|
64695
|
+
return null;
|
|
64638
64696
|
const navGraph = this.buildNavGraph(this.currentFlow);
|
|
64639
64697
|
const currentStep = this.currentFlow.currentFlowStep;
|
|
64640
64698
|
// Find the branch point (first screen with multiple forward paths)
|
|
64641
64699
|
const branchPoint = this.findBranchPoint(allScreens, navGraph);
|
|
64642
|
-
let progress = 0;
|
|
64643
64700
|
if (branchPoint) {
|
|
64644
64701
|
// Branching flow
|
|
64645
|
-
|
|
64646
|
-
}
|
|
64647
|
-
else {
|
|
64648
|
-
// Linear flow
|
|
64649
|
-
const currentIndex = allScreens.findIndex(s => s.id === currentStep.id);
|
|
64650
|
-
progress = currentIndex >= 0 ? (currentIndex + 1) / allScreens.length : 0;
|
|
64651
|
-
}
|
|
64652
|
-
progress = Math.max(0, Math.min(1, progress));
|
|
64653
|
-
if (key) {
|
|
64654
|
-
this.setLastAnimatedFlowProgress(key, progress);
|
|
64702
|
+
return this.calculateBranchingProgress(visitedScreens, allScreens, currentStep, branchPoint, navGraph);
|
|
64655
64703
|
}
|
|
64656
|
-
|
|
64704
|
+
// Linear flow
|
|
64705
|
+
const currentIndex = allScreens.findIndex(s => s.id === currentStep.id);
|
|
64706
|
+
return { index: currentIndex >= 0 ? currentIndex + 1 : 0, total: allScreens.length };
|
|
64657
64707
|
}
|
|
64658
64708
|
/**
|
|
64659
64709
|
* Find the first screen that has branching (multiple forward navigation targets)
|
|
@@ -64667,7 +64717,8 @@ let NamiFlowManager$2 = class NamiFlowManager {
|
|
|
64667
64717
|
return null;
|
|
64668
64718
|
}
|
|
64669
64719
|
/**
|
|
64670
|
-
* Calculate
|
|
64720
|
+
* Calculate the step position for flows with branching (supports 2+ branches).
|
|
64721
|
+
* Progress is `index / total`.
|
|
64671
64722
|
*/
|
|
64672
64723
|
calculateBranchingProgress(visitedScreens, allScreens, currentStep, branchPoint, navGraph) {
|
|
64673
64724
|
const visitedCount = visitedScreens.length;
|
|
@@ -64681,14 +64732,14 @@ let NamiFlowManager$2 = class NamiFlowManager {
|
|
|
64681
64732
|
// - visitedScreens = currentPosition + 1 (0-indexed)
|
|
64682
64733
|
// - minimumTotalPathLength = branchPosition + 2
|
|
64683
64734
|
// (all screens before branch + branch itself + at least 1 screen after)
|
|
64684
|
-
return
|
|
64735
|
+
return { index: currentIndexInAll + 1, total: branchPointIndexInAll + 2 };
|
|
64685
64736
|
}
|
|
64686
64737
|
// Case 2: Past the branch point (entered a specific branch)
|
|
64687
64738
|
// Calculate based on: visitedScreens / (visitedScreens + remainingInThisBranch)
|
|
64688
64739
|
const remainingInBranch = this.countForwardScreens(currentStep, allScreens, navGraph);
|
|
64689
64740
|
const totalPathLength = visitedCount + remainingInBranch;
|
|
64690
64741
|
logger.debug(`Branching progress: visited=${visitedCount}, remaining=${remainingInBranch}, total=${totalPathLength}, step=${currentStep.id}`);
|
|
64691
|
-
return visitedCount
|
|
64742
|
+
return { index: visitedCount, total: totalPathLength };
|
|
64692
64743
|
}
|
|
64693
64744
|
/**
|
|
64694
64745
|
* Count how many screens are forward-reachable from the current step
|
|
@@ -64786,6 +64837,12 @@ let NamiFlowManager$2 = class NamiFlowManager {
|
|
|
64786
64837
|
static getCurrentFlowProgress(key) {
|
|
64787
64838
|
return this.instance.getCurrentFlowProgress(key);
|
|
64788
64839
|
}
|
|
64840
|
+
static getCurrentFlowStepIndex() {
|
|
64841
|
+
return this.instance.getCurrentFlowStepIndex();
|
|
64842
|
+
}
|
|
64843
|
+
static getTotalFlowSteps() {
|
|
64844
|
+
return this.instance.getTotalFlowSteps();
|
|
64845
|
+
}
|
|
64789
64846
|
/**
|
|
64790
64847
|
* Gets the current flow step's auto-advance delay (in seconds)
|
|
64791
64848
|
* Parses __appear__ actions to find flowNav/flowNext with a delay parameter
|
|
@@ -65955,9 +66012,11 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
65955
66012
|
}
|
|
65956
66013
|
// Legacy payload precedence, unchanged: embedded handoffData →
|
|
65957
66014
|
// trigger data → form data (when a form id is present) → none.
|
|
66015
|
+
// Only the authored handoffData is Flow Liquid; trigger data and
|
|
66016
|
+
// form data can carry user-typed text (NAM-5291).
|
|
65958
66017
|
let payload;
|
|
65959
66018
|
if (action.parameters?.handoffData) {
|
|
65960
|
-
payload = action.parameters.handoffData;
|
|
66019
|
+
payload = new FlowLiquidResolver(this.manager).interpolateDeep(action.parameters.handoffData);
|
|
65961
66020
|
}
|
|
65962
66021
|
else if (data) {
|
|
65963
66022
|
payload = data;
|
|
@@ -66032,8 +66091,10 @@ class NamiFlow extends BasicNamiFlow {
|
|
|
66032
66091
|
break;
|
|
66033
66092
|
case NamiFlowActionFunction.SET_TAGS:
|
|
66034
66093
|
if (action.parameters) {
|
|
66035
|
-
|
|
66036
|
-
|
|
66094
|
+
// Values are Flow Liquid, one instant per action (NAM-5291).
|
|
66095
|
+
const tags = new FlowLiquidResolver(this.manager).interpolateDeep(action.parameters);
|
|
66096
|
+
PaywallState.setUserTags(tags);
|
|
66097
|
+
Object.entries(tags).forEach(([key, value]) => {
|
|
66037
66098
|
NamiCustomerManager$2.setCustomerAttribute(key, value);
|
|
66038
66099
|
});
|
|
66039
66100
|
}
|
|
@@ -66986,6 +67047,111 @@ function aggregateScreenreaderText(page, focusedButtonLabel = '') {
|
|
|
66986
67047
|
return joinFragments(fragments);
|
|
66987
67048
|
}
|
|
66988
67049
|
|
|
67050
|
+
/**
|
|
67051
|
+
* Step model for the stepped `progressIndicator` (`style: "steps"`).
|
|
67052
|
+
*
|
|
67053
|
+
* Pure helpers shared by every TypeScript renderer (Web, Expo). Apple and
|
|
67054
|
+
* Android mirror these rules natively, so keep the behaviour in sync with
|
|
67055
|
+
* them when changing anything here.
|
|
67056
|
+
*/
|
|
67057
|
+
/** Smallest step count a fixed (non-"auto") `stepCount` resolves to. */
|
|
67058
|
+
const MIN_FIXED_STEP_COUNT = 2;
|
|
67059
|
+
/** Largest step count a fixed (non-"auto") `stepCount` resolves to. */
|
|
67060
|
+
const MAX_FIXED_STEP_COUNT = 12;
|
|
67061
|
+
/**
|
|
67062
|
+
* Parses a numeric field that may arrive as a number or as a numeric string
|
|
67063
|
+
* (for example from smart text). Returns NaN for "auto", missing, empty or
|
|
67064
|
+
* unparseable values.
|
|
67065
|
+
*/
|
|
67066
|
+
function parseStepNumber(value) {
|
|
67067
|
+
if (typeof value === "number")
|
|
67068
|
+
return Number.isFinite(value) ? value : NaN;
|
|
67069
|
+
if (typeof value === "string") {
|
|
67070
|
+
const trimmed = value.trim();
|
|
67071
|
+
if (trimmed === "")
|
|
67072
|
+
return NaN;
|
|
67073
|
+
const parsed = Number(trimmed);
|
|
67074
|
+
return Number.isFinite(parsed) ? parsed : NaN;
|
|
67075
|
+
}
|
|
67076
|
+
return NaN;
|
|
67077
|
+
}
|
|
67078
|
+
/** True when the component asks for the stepped style; anything else renders the bar. */
|
|
67079
|
+
function isStepsStyle(c) {
|
|
67080
|
+
return c.style === "steps";
|
|
67081
|
+
}
|
|
67082
|
+
/**
|
|
67083
|
+
* Resolves the number of segments to draw.
|
|
67084
|
+
*
|
|
67085
|
+
* "auto", missing or unparseable values use `autoTotal` as is (not clamped).
|
|
67086
|
+
* A number or numeric string is rounded and clamped to
|
|
67087
|
+
* [MIN_FIXED_STEP_COUNT, MAX_FIXED_STEP_COUNT].
|
|
67088
|
+
*/
|
|
67089
|
+
function resolveStepCount(stepCount, autoTotal) {
|
|
67090
|
+
const parsed = parseStepNumber(stepCount);
|
|
67091
|
+
if (Number.isNaN(parsed))
|
|
67092
|
+
return autoTotal;
|
|
67093
|
+
return Math.min(MAX_FIXED_STEP_COUNT, Math.max(MIN_FIXED_STEP_COUNT, Math.round(parsed)));
|
|
67094
|
+
}
|
|
67095
|
+
/**
|
|
67096
|
+
* Resolves the 1-based current step.
|
|
67097
|
+
*
|
|
67098
|
+
* "auto", missing or unparseable values use `autoIndex`. A number or numeric
|
|
67099
|
+
* string is rounded but not clamped: out-of-range values are handled by
|
|
67100
|
+
* {@link stepSegmentState}.
|
|
67101
|
+
*/
|
|
67102
|
+
function resolveCurrentStep(currentStep, autoIndex) {
|
|
67103
|
+
const parsed = parseStepNumber(currentStep);
|
|
67104
|
+
if (Number.isNaN(parsed))
|
|
67105
|
+
return autoIndex;
|
|
67106
|
+
return Math.round(parsed);
|
|
67107
|
+
}
|
|
67108
|
+
/**
|
|
67109
|
+
* State of the segment at 1-based `index1` given the 1-based `current` step.
|
|
67110
|
+
*
|
|
67111
|
+
* `currentStep` mode marks only the matching segment as current. Any other
|
|
67112
|
+
* `fillMode` (including unknown or missing) behaves as `fillUp`, which marks
|
|
67113
|
+
* every segment up to and including `current` as active.
|
|
67114
|
+
*/
|
|
67115
|
+
function stepSegmentState(index1, current, fillMode) {
|
|
67116
|
+
if (fillMode === "currentStep") {
|
|
67117
|
+
return index1 === current ? "current" : "inactive";
|
|
67118
|
+
}
|
|
67119
|
+
return index1 <= current ? "active" : "inactive";
|
|
67120
|
+
}
|
|
67121
|
+
/**
|
|
67122
|
+
* Width of one segment when `count` segments separated by `spacing` share
|
|
67123
|
+
* `available` width evenly. Never negative; 0 when `count <= 0`.
|
|
67124
|
+
*/
|
|
67125
|
+
function evenSegmentWidth(available, count, spacing) {
|
|
67126
|
+
if (count <= 0)
|
|
67127
|
+
return 0;
|
|
67128
|
+
return Math.max(0, (available - (count - 1) * spacing) / count);
|
|
67129
|
+
}
|
|
67130
|
+
/** Resolves `stepSizing`; unknown or missing values fall back to "even". */
|
|
67131
|
+
function resolveStepSizing(v) {
|
|
67132
|
+
return v === "fixed" ? "fixed" : "even";
|
|
67133
|
+
}
|
|
67134
|
+
/** Resolves `alignment`; unknown or missing values fall back to "center". */
|
|
67135
|
+
function resolveStepAlignment(v) {
|
|
67136
|
+
return v === "left" || v === "right" ? v : "center";
|
|
67137
|
+
}
|
|
67138
|
+
/**
|
|
67139
|
+
* First value that is actually set: skips `undefined`, `null`, `""` and
|
|
67140
|
+
* whitespace-only strings, so an empty `current*` field falls back to the
|
|
67141
|
+
* next candidate (for example `active*`) the way Apple and Android do.
|
|
67142
|
+
* `0`, `false` and other falsy non-string values count as set.
|
|
67143
|
+
*/
|
|
67144
|
+
function firstSet(...values) {
|
|
67145
|
+
for (const v of values) {
|
|
67146
|
+
if (v === undefined || v === null)
|
|
67147
|
+
continue;
|
|
67148
|
+
if (typeof v === "string" && v.trim() === "")
|
|
67149
|
+
continue;
|
|
67150
|
+
return v;
|
|
67151
|
+
}
|
|
67152
|
+
return undefined;
|
|
67153
|
+
}
|
|
67154
|
+
|
|
66989
67155
|
function namiBuySKU(skuRefId) {
|
|
66990
67156
|
if (!hasPurchaseManagement("NamiPurchaseManager.buySKU")) {
|
|
66991
67157
|
return;
|
|
@@ -67047,4 +67213,4 @@ var internal = /*#__PURE__*/Object.freeze({
|
|
|
67047
67213
|
NamiPurchaseManager: NamiPurchaseManager
|
|
67048
67214
|
});
|
|
67049
67215
|
|
|
67050
|
-
export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_TRAFFIC_OBSERVER, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_CACHE_TTL_PREFIX, CAMPAIGN_NOT_AVAILABLE, CONFIG_API_TIMEOUT_LIMIT, CONFIG_MAX_ATTEMPTS, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEFAULT_JOURNEY_SETTINGS, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DISABLE_ASYNC_LOGIN_LOGOUT, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LOG_HTTP_REQUESTS, LOG_HTTP_TRAFFIC, LaunchCampaignError, LaunchContextResolver, LogLevel, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, NAMI_STORAGE_KEYS, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager$1 as NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager$1 as NamiCustomerManager, NamiEntitlementManager$1 as NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager$1 as NamiFlowManager, NamiFlowStepType, NamiHandoffTag, NamiPaywallAction, NamiPaywallManager$1 as NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiPermissionOutcome, NamiPurchaseManager$1 as NamiPurchaseManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RESUME_THROTTLE_MS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SIMULATE_CONFIG_FETCH_FAILURE, SIMULATE_PAYWALL_FETCH_FAILURE, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STARTUP_TELEMETRY, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SYSTEM_TIME_FILTER_PREFIX, SYSTEM_TIME_TOKEN_PREFIX, SessionService, SimpleEventTarget, StorageService, TIME_OVERRIDE_PREFIX, TRANSPORT_FAILURE_STATUS, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, NamiProfileManager$1 as _NamiProfileManager, internal as _internal, activateEntitlementByPurchase, activeEntitlements, aggregateScreenreaderText, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bestUrlCampaignMatch, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, didReceiveResponse, empty, evaluateSystemTimeAssertion, evaluateSystemTimeCondition, extractStandardPricingPhases, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getJourneySettings, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getPurchaseAdapter, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getSystemTimeNow, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isSystemTimeAssertion, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseTimeOverride, parseToSemver, postConversion, productDetail, registerAPITrafficObserver, registerPlatformAdapters, registerPurchaseAdapter, resolveLoopSource, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateForm, validateMinSDKVersion, validateTextInput };
|
|
67216
|
+
export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_TRAFFIC_OBSERVER, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_CACHE_TTL_PREFIX, CAMPAIGN_NOT_AVAILABLE, CONFIG_API_TIMEOUT_LIMIT, CONFIG_MAX_ATTEMPTS, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEFAULT_JOURNEY_SETTINGS, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DISABLE_ASYNC_LOGIN_LOGOUT, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LOG_HTTP_REQUESTS, LOG_HTTP_TRAFFIC, LaunchCampaignError, LaunchContextResolver, LogLevel, MAX_FIXED_STEP_COUNT, MIN_FIXED_STEP_COUNT, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, NAMI_STORAGE_KEYS, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager$1 as NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager$1 as NamiCustomerManager, NamiEntitlementManager$1 as NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager$1 as NamiFlowManager, NamiFlowStepType, NamiHandoffTag, NamiPaywallAction, NamiPaywallManager$1 as NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiPermissionOutcome, NamiPurchaseManager$1 as NamiPurchaseManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RESUME_THROTTLE_MS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SIMULATE_CONFIG_FETCH_FAILURE, SIMULATE_PAYWALL_FETCH_FAILURE, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STARTUP_TELEMETRY, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SYSTEM_TIME_FILTER_PREFIX, SYSTEM_TIME_TOKEN_PREFIX, SessionService, SimpleEventTarget, StorageService, TIME_OVERRIDE_PREFIX, TRANSPORT_FAILURE_STATUS, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, NamiProfileManager$1 as _NamiProfileManager, internal as _internal, activateEntitlementByPurchase, activeEntitlements, aggregateScreenreaderText, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bestUrlCampaignMatch, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, didReceiveResponse, empty, evaluateSystemTimeAssertion, evaluateSystemTimeCondition, evenSegmentWidth, extractStandardPricingPhases, firstSet, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getJourneySettings, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getPurchaseAdapter, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getSystemTimeNow, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isStepsStyle, isSubscription, isSystemTimeAssertion, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseTimeOverride, parseToSemver, postConversion, productDetail, registerAPITrafficObserver, registerPlatformAdapters, registerPurchaseAdapter, resolveCurrentStep, resolveLoopSource, resolveStepAlignment, resolveStepCount, resolveStepSizing, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, stepSegmentState, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateForm, validateMinSDKVersion, validateTextInput };
|
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.202611011529",
|
|
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",
|