@namiml/sdk-core 3.4.12-dev.202609251647 → 3.4.12-dev.202609281806
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 +752 -79
- package/dist/index.d.ts +257 -15
- package/dist/index.mjs +753 -80
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,13 @@ interface IDeviceAdapter {
|
|
|
65
65
|
generateUUID(): string;
|
|
66
66
|
getScreenInfo(): ScreenInfo;
|
|
67
67
|
getLanguage(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Calls `listener` each time the app returns to the foreground — a browser tab becoming
|
|
70
|
+
* visible, a React Native app going `active` — and returns a function that stops listening.
|
|
71
|
+
* Drives core's resume config refresh (NAM-4589). Optional: a host with no foreground
|
|
72
|
+
* concept (the CLI) omits it and simply never resumes.
|
|
73
|
+
*/
|
|
74
|
+
onAppForeground?(listener: () => void): () => void;
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
interface FormFactor {
|
|
@@ -1887,6 +1894,11 @@ type ProductGroup = {
|
|
|
1887
1894
|
products: PaywallSKU[];
|
|
1888
1895
|
ref: string;
|
|
1889
1896
|
};
|
|
1897
|
+
/**
|
|
1898
|
+
* Where a paywall object came from (NAM-4357). `initialConfig` marks bodies bundled with the app,
|
|
1899
|
+
* which never enter the per-URL body cache.
|
|
1900
|
+
*/
|
|
1901
|
+
type PaywallFetchSource = 'fetched' | 'cacheHit' | 'cacheAfterFetchFailure' | 'initialConfig';
|
|
1890
1902
|
interface IPaywall {
|
|
1891
1903
|
id: string;
|
|
1892
1904
|
name: string;
|
|
@@ -1894,6 +1906,10 @@ interface IPaywall {
|
|
|
1894
1906
|
sku_menus: ISkuMenu[];
|
|
1895
1907
|
template: TPaywallTemplate;
|
|
1896
1908
|
fonts: FontCollection;
|
|
1909
|
+
/** Runtime only — never written into the aggregate `api_paywalls` cache. */
|
|
1910
|
+
fetchSource?: PaywallFetchSource;
|
|
1911
|
+
/** Runtime only: the `content_hash` of the URL this paywall was resolved for, if it had one. */
|
|
1912
|
+
contentHash?: string;
|
|
1897
1913
|
}
|
|
1898
1914
|
interface ISkuMenu {
|
|
1899
1915
|
id: string;
|
|
@@ -2122,6 +2138,12 @@ declare class Nami {
|
|
|
2122
2138
|
*/
|
|
2123
2139
|
static configure(options: NamiConfiguration): Promise<NamiConfigurationState>;
|
|
2124
2140
|
private static setInitialConfig;
|
|
2141
|
+
/**
|
|
2142
|
+
* Subscribes the resume config refresh to the host's foreground signal, once per process —
|
|
2143
|
+
* a reconfigure must not stack a second listener (the Android defect NAM-4541 fixed).
|
|
2144
|
+
* Registered before startup runs; `resume()` itself skips while startup is in flight.
|
|
2145
|
+
*/
|
|
2146
|
+
private listenForAppForeground;
|
|
2125
2147
|
private initializeSDK;
|
|
2126
2148
|
}
|
|
2127
2149
|
|
|
@@ -2920,6 +2942,13 @@ declare class StorageService {
|
|
|
2920
2942
|
setCampaignRules(key: string, campaignRules: NamiCampaign[]): void;
|
|
2921
2943
|
getCampaignRules(key: string): NamiCampaign[] | null;
|
|
2922
2944
|
setPaywalls(key: string, paywalls: IPaywall[]): void;
|
|
2945
|
+
/**
|
|
2946
|
+
* Writes the aggregate `api_paywalls` as the list of URLs a per-URL resolution produced, rather
|
|
2947
|
+
* than a second copy of their bodies (NAM-4357): the bodies already live in the per-URL body
|
|
2948
|
+
* cache, and `getPaywalls(API_PAYWALLS)` rebuilds the paywall objects from it. The legacy bulk
|
|
2949
|
+
* path still writes whole objects through `setPaywalls`.
|
|
2950
|
+
*/
|
|
2951
|
+
setApiPaywallsFromBodyCache(urls: string[]): void;
|
|
2923
2952
|
getPaywalls(key: string): IPaywall[] | null;
|
|
2924
2953
|
setActiveEntitlements(key: string, entitlements: IEntitlements[]): void;
|
|
2925
2954
|
getActiveEntitlements(key: string): IEntitlements[];
|
|
@@ -2970,7 +2999,12 @@ declare class StorageService {
|
|
|
2970
2999
|
setApiCampaignSessionTimestamp(): void;
|
|
2971
3000
|
getApiCampaignSessionTimestamp(): number | null;
|
|
2972
3001
|
purgeApiCampaignCache(): void;
|
|
2973
|
-
|
|
3002
|
+
/**
|
|
3003
|
+
* The effective `campaign_cache_ttl`: a `campaignCacheTTL=<n>` namiCommand first, then the API
|
|
3004
|
+
* config, then the initial config. Lives here rather than in `utils/config` because this service
|
|
3005
|
+
* needs it to decide where the aggregate caches go, and `utils/config` already imports this one.
|
|
3006
|
+
*/
|
|
3007
|
+
getCampaignCacheTtl(): number | null;
|
|
2974
3008
|
private isLegacyTimestampedCache;
|
|
2975
3009
|
/**
|
|
2976
3010
|
* Set an item in localStorage.
|
|
@@ -3183,12 +3217,18 @@ declare const LOG_HTTP_REQUESTS: string;
|
|
|
3183
3217
|
declare const LOG_HTTP_TRAFFIC: string;
|
|
3184
3218
|
declare const API_TRAFFIC_OBSERVER: string;
|
|
3185
3219
|
declare const STARTUP_TELEMETRY: string;
|
|
3220
|
+
declare const SIMULATE_CONFIG_FETCH_FAILURE: string;
|
|
3221
|
+
declare const SIMULATE_PAYWALL_FETCH_FAILURE: string;
|
|
3222
|
+
declare const CAMPAIGN_CACHE_TTL_PREFIX: string;
|
|
3186
3223
|
declare const EXTENDED_PLATFORM: string;
|
|
3187
3224
|
declare const EXTENDED_PLATFORM_VERSION: string;
|
|
3188
3225
|
declare const API_MAX_CALLS_LIMIT: number;
|
|
3189
3226
|
declare const API_RETRY_DELAY_SEC: number;
|
|
3190
3227
|
declare const API_TIMEOUT_LIMIT: number;
|
|
3191
3228
|
declare const DEVICE_API_TIMEOUT_LIMIT: number;
|
|
3229
|
+
declare const CONFIG_MAX_ATTEMPTS: number;
|
|
3230
|
+
declare const CONFIG_API_TIMEOUT_LIMIT: number;
|
|
3231
|
+
declare const RESUME_THROTTLE_MS: number;
|
|
3192
3232
|
declare const STATUS_SUCCESS: number;
|
|
3193
3233
|
declare const STATUS_BAD_REQUEST: number;
|
|
3194
3234
|
declare const STATUS_NOT_FOUND: number;
|
|
@@ -3392,12 +3432,51 @@ declare class NamiRefs {
|
|
|
3392
3432
|
static instance: NamiRefs;
|
|
3393
3433
|
private inMemoryAnonymousMode;
|
|
3394
3434
|
private isFirstSession;
|
|
3435
|
+
private startupDisabled;
|
|
3436
|
+
private hasInitialConfig;
|
|
3437
|
+
private lastConfig;
|
|
3438
|
+
private lastStartupRunAt;
|
|
3439
|
+
private startupInFlight;
|
|
3395
3440
|
constructor();
|
|
3396
3441
|
setInMemoryAnonymousMode(enabled: boolean): void;
|
|
3397
3442
|
isInMemoryAnonymousMode(): boolean;
|
|
3398
3443
|
isAnonymousMode(): boolean;
|
|
3399
3444
|
getIsFirstSession(): boolean;
|
|
3445
|
+
/**
|
|
3446
|
+
* True when the platform-config step found no usable config and startup stopped after it —
|
|
3447
|
+
* the equivalent of Apple's `sdkEnabled = false` and Android's `NamiRefs.startupDisabled`.
|
|
3448
|
+
* Like both, it gates only the startup sequence, nothing else.
|
|
3449
|
+
*/
|
|
3450
|
+
isStartupDisabled(): boolean;
|
|
3400
3451
|
init(config: NamiConfiguration): Promise<void>;
|
|
3452
|
+
/**
|
|
3453
|
+
* The app returned to the foreground. Re-reads the platform config, as Apple's `.appResume`
|
|
3454
|
+
* and Android's `onAppComesFromBackground` do, so a config change — the `sdk` kill switch
|
|
3455
|
+
* included — reaches a long-lived tab or app without a cold start.
|
|
3456
|
+
*
|
|
3457
|
+
* - Skipped within {@link RESUME_THROTTLE_MS} of the last launch/resume, and while one is
|
|
3458
|
+
* still running.
|
|
3459
|
+
* - When the launch had **stopped** for want of a config and one is now usable, the rest of
|
|
3460
|
+
* startup runs — the steps an Apple resume re-runs because the launch never executed them.
|
|
3461
|
+
* - Otherwise this is a config refresh only. Apple and Android also re-run device, campaigns,
|
|
3462
|
+
* profile, products and the session start on resume; core does not yet, and has no
|
|
3463
|
+
* session end on background for a second session start to pair with (NAM-4623).
|
|
3464
|
+
*/
|
|
3465
|
+
resume(): Promise<void>;
|
|
3466
|
+
/** Everything startup runs once the platform-config step has found a usable config. */
|
|
3467
|
+
private runStartupAfterConfig;
|
|
3468
|
+
/** Forgets the configuration a resume would run against; called by `Nami.reset()`. */
|
|
3469
|
+
clearResumeState(): void;
|
|
3470
|
+
/**
|
|
3471
|
+
* The platform-config startup step, ahead of device registration — the position it holds on
|
|
3472
|
+
* Apple (`.fetchPlatformConfig`) and Android (`fetchAppConfigOnce`) (NAM-4464, NAM-4589).
|
|
3473
|
+
* Without an initial config it is awaited, so everything downstream — `campaign_cache_ttl`
|
|
3474
|
+
* included — is evaluated against the config it leaves in storage. With one it resolves at
|
|
3475
|
+
* once and the request finishes in the background (see `fetchConfigForStartup`).
|
|
3476
|
+
*
|
|
3477
|
+
* @returns false when there is no usable config, in which case startup must stop.
|
|
3478
|
+
*/
|
|
3479
|
+
private fetchPlatformConfig;
|
|
3401
3480
|
private setInitialValues;
|
|
3402
3481
|
private initAnonymousDevice;
|
|
3403
3482
|
private initIdentifiedDevice;
|
|
@@ -3576,6 +3655,11 @@ declare class InternalServerError extends APIError {
|
|
|
3576
3655
|
}
|
|
3577
3656
|
declare const handleErrors: (status: number, path: string) => void;
|
|
3578
3657
|
|
|
3658
|
+
/** Campaign rules as fetched, and whether they came from the network or the stored copy. */
|
|
3659
|
+
type CampaignRulesFetch = {
|
|
3660
|
+
campaigns: NamiCampaign[];
|
|
3661
|
+
fromNetwork: boolean;
|
|
3662
|
+
};
|
|
3579
3663
|
declare class CampaignRuleRepository {
|
|
3580
3664
|
currentFormFactor: TDevice;
|
|
3581
3665
|
splitPosition: number;
|
|
@@ -3594,17 +3678,71 @@ declare class CampaignRuleRepository {
|
|
|
3594
3678
|
fetchCampaignRules(paywalls: IPaywall[]): Promise<NamiCampaign[]>;
|
|
3595
3679
|
static extractPaywallUrls(campaigns: NamiCampaign[]): string[];
|
|
3596
3680
|
static hasPaywallUrls(campaigns: NamiCampaign[]): boolean;
|
|
3597
|
-
|
|
3681
|
+
/**
|
|
3682
|
+
* The campaign rules for this form factor, unvalidated, plus whether they came from the network.
|
|
3683
|
+
* `fromNetwork` is false when the stored rules stood in for a failed fetch (or updates are
|
|
3684
|
+
* disabled): the per-URL body cache must then neither resolve nor evict (NAM-4357).
|
|
3685
|
+
*/
|
|
3686
|
+
fetchCampaignRulesRaw(): Promise<CampaignRulesFetch>;
|
|
3598
3687
|
finalizeCampaignRules(campaignRules: NamiCampaign[], paywalls: IPaywall[]): NamiCampaign[];
|
|
3599
3688
|
invokeAvailableCampaignsResponseHandler(): void;
|
|
3600
3689
|
private getAnonymousCampaigns;
|
|
3601
3690
|
private getCampaigns;
|
|
3691
|
+
private fetchAnonymousCampaigns;
|
|
3692
|
+
private fetchCampaigns;
|
|
3602
3693
|
private fallbackData;
|
|
3603
3694
|
}
|
|
3604
3695
|
|
|
3696
|
+
/**
|
|
3697
|
+
* Whether startup may continue past the platform-config step; `reason` explains a `false`.
|
|
3698
|
+
* A plain shape rather than a discriminated union: core does not compile with
|
|
3699
|
+
* `strictNullChecks`, so a union on `usable` would not narrow.
|
|
3700
|
+
*/
|
|
3701
|
+
type ConfigStartupOutcome = {
|
|
3702
|
+
usable: boolean;
|
|
3703
|
+
reason?: string;
|
|
3704
|
+
};
|
|
3605
3705
|
declare class ConfigRepository {
|
|
3606
3706
|
static instance: ConfigRepository;
|
|
3607
|
-
|
|
3707
|
+
/**
|
|
3708
|
+
* One `GET config/` attempt. Persists the config on success and throws on any failure —
|
|
3709
|
+
* a non-2xx or a transport error alike. `withRetry`'s own retries are turned off, so the
|
|
3710
|
+
* attempt count belongs to {@link fetchConfigForStartup} alone.
|
|
3711
|
+
*/
|
|
3712
|
+
fetchConfig(): Promise<IConfig>;
|
|
3713
|
+
/**
|
|
3714
|
+
* The startup platform-config step, converged on Apple's `NamiPlatformConfigService.fetch` and
|
|
3715
|
+
* Android's `fetchAppConfigOnce` (NAM-4470, NAM-4589):
|
|
3716
|
+
*
|
|
3717
|
+
* | case | outcome |
|
|
3718
|
+
* |---|---|
|
|
3719
|
+
* | an initial config was supplied | NOT awaited: one attempt runs in the background and stores the config when it lands; usable |
|
|
3720
|
+
* | no initial config, success, capabilities include `sdk` | usable |
|
|
3721
|
+
* | no initial config, success, capabilities lack `sdk` | not usable |
|
|
3722
|
+
* | no initial config, failure | {@link CONFIG_MAX_ATTEMPTS} attempts of up to {@link CONFIG_API_TIMEOUT_LIMIT} each, then usable only if a config is cached (and grants `sdk`) |
|
|
3723
|
+
*
|
|
3724
|
+
* The two fallbacks are consulted at two different points, deliberately. An initial config
|
|
3725
|
+
* decides the case *before* any request: startup does not wait on the network at all, since the
|
|
3726
|
+
* initial config is what makes the SDK ready without it (Apple: "Initial config is available.
|
|
3727
|
+
* Skipping retry."). The config cached by a previous launch is consulted only *after* the
|
|
3728
|
+
* retries run out. A stored `INITIAL_APP_CONFIG` is not that cache.
|
|
3729
|
+
*
|
|
3730
|
+
* One check does apply with an initial config, because it costs no wait: a cached config that
|
|
3731
|
+
* withholds `sdk` still stops startup, as Apple's cache load re-applies `updateSdkFlags`.
|
|
3732
|
+
* Without it a kill switch could never reach an app that ships an initial config — the
|
|
3733
|
+
* background fetch lands after startup has already run, so it takes effect from the next launch.
|
|
3734
|
+
*
|
|
3735
|
+
* A `404` is treated as any other 4xx, matching Apple's effective behaviour (its dedicated 404
|
|
3736
|
+
* branch is unreachable, NAM-4471) and Android's.
|
|
3737
|
+
*
|
|
3738
|
+
* @param hasInitialConfig whether the host passed an `initialConfig` that decoded to content.
|
|
3739
|
+
*/
|
|
3740
|
+
fetchConfigForStartup(hasInitialConfig: boolean): Promise<ConfigStartupOutcome>;
|
|
3741
|
+
/**
|
|
3742
|
+
* The initial-config case: nothing is awaited. The cached kill switch is a storage read; the
|
|
3743
|
+
* config request is left running and persists its answer (`fetchConfig`) when it lands.
|
|
3744
|
+
*/
|
|
3745
|
+
private startupOnInitialConfig;
|
|
3608
3746
|
}
|
|
3609
3747
|
|
|
3610
3748
|
declare class CustomerJourneyRepository {
|
|
@@ -3639,25 +3777,129 @@ declare class EntitlementRepository {
|
|
|
3639
3777
|
}
|
|
3640
3778
|
|
|
3641
3779
|
/**
|
|
3642
|
-
*
|
|
3643
|
-
*
|
|
3644
|
-
*
|
|
3780
|
+
* Per-URL paywall body cache (NAM-4357), the Core/Web port of Apple's and Android's
|
|
3781
|
+
* `NamiPaywallBodyCache` (NAM-4356, NAM-4358). The contract is
|
|
3782
|
+
* `docs/technical-designs/api-resilience-and-caching.md` § 2.2.
|
|
3783
|
+
*
|
|
3784
|
+
* An entry is keyed on the **exact** URL `campaign_rules` delivered and holds the raw response
|
|
3785
|
+
* text, so a cached body goes through the same decode as a fetched one. The cache only stores and
|
|
3786
|
+
* ages entries — which entry is served when is `PaywallRepository.resolvePaywallsByUrls`' call.
|
|
3787
|
+
*
|
|
3788
|
+
* Entries live in the platform storage adapter (localStorage on web, the CLI's file store), and
|
|
3789
|
+
* this is the ONLY copy of the bodies: the aggregate `api_paywalls` records which URLs the last
|
|
3790
|
+
* resolution produced and is rebuilt from these entries (`StorageService.getPaywalls`). Measured
|
|
3791
|
+
* 2026-09-28, NFL Web Prod's largest set is 66 bodies / 2.1 MB, well inside localStorage's ~5 MB;
|
|
3792
|
+
* a second copy beside an aggregate would have doubled that. Under `campaign_cache_ttl == 0`
|
|
3793
|
+
* entries are held in memory instead. Every storage failure degrades to "not cached".
|
|
3645
3794
|
*/
|
|
3646
|
-
type
|
|
3647
|
-
|
|
3648
|
-
|
|
3795
|
+
type PaywallBodyMeta = {
|
|
3796
|
+
url: string;
|
|
3797
|
+
/** The URL's `content_hash`, absent for an un-hashed URL. */
|
|
3798
|
+
contentHash?: string;
|
|
3799
|
+
/** Epoch milliseconds at which this entry was stored. */
|
|
3800
|
+
savedAt: number;
|
|
3801
|
+
};
|
|
3802
|
+
type PaywallBodyEntry = {
|
|
3803
|
+
meta: PaywallBodyMeta;
|
|
3804
|
+
body: string;
|
|
3649
3805
|
};
|
|
3806
|
+
declare class PaywallBodyCache {
|
|
3807
|
+
private readonly storage;
|
|
3808
|
+
readonly maxEntries: number;
|
|
3809
|
+
/** Set under `campaign_cache_ttl == 0`: entries live here, in this process only. */
|
|
3810
|
+
private memory;
|
|
3811
|
+
/** Metadata of every persisted entry, loaded once from the storage adapter. */
|
|
3812
|
+
private index;
|
|
3813
|
+
constructor(storage?: () => IStorageAdapter, maxEntries?: number);
|
|
3814
|
+
get count(): number;
|
|
3815
|
+
/**
|
|
3816
|
+
* Applies `campaign_cache_ttl` at the start of a resolution. `null` keeps everything, `n > 0`
|
|
3817
|
+
* purges entries whose own age is `>= n` seconds, and `0` purges the persistent store and keeps
|
|
3818
|
+
* this process's entries in memory only.
|
|
3819
|
+
*/
|
|
3820
|
+
evaluateTtl(ttl: number | null, now?: number): void;
|
|
3821
|
+
/**
|
|
3822
|
+
* The entry stored under this exact URL, or null when there is none, it is past `ttl`, or its
|
|
3823
|
+
* body is missing (a half-written entry, which is deleted here).
|
|
3824
|
+
*/
|
|
3825
|
+
validEntry(url: string, ttl: number | null, now?: number): PaywallBodyEntry | null;
|
|
3826
|
+
/**
|
|
3827
|
+
* The stored body for this exact URL, read straight from storage rather than through the index,
|
|
3828
|
+
* with no TTL check. This is what rebuilds the aggregate `api_paywalls`, so it also sees an entry
|
|
3829
|
+
* a host wrote after the index was loaded (the web test apps inject local test paywalls that way).
|
|
3830
|
+
*/
|
|
3831
|
+
bodyFor(url: string): string | null;
|
|
3832
|
+
/** Stores a body under its exact URL. Returns false when the write did not land (quota, I/O). */
|
|
3833
|
+
store(url: string, contentHash: string | undefined, body: string, now?: number): boolean;
|
|
3834
|
+
/** Stores a bundled body unless an entry already exists — a body the SDK fetched always wins. */
|
|
3835
|
+
seedIfAbsent(url: string, contentHash: string | undefined, body: string, now?: number): boolean;
|
|
3836
|
+
/** Deletes one entry — used for an undecodable body. Not eviction. */
|
|
3837
|
+
remove(url: string): void;
|
|
3838
|
+
/**
|
|
3839
|
+
* Eviction, run once per resolution after a complete `campaign_rules` fetch: delete every entry
|
|
3840
|
+
* whose URL this resolution did not name, then cap the store at `maxEntries`, oldest first.
|
|
3841
|
+
*/
|
|
3842
|
+
reconcile(currentUrls: Set<string>): void;
|
|
3843
|
+
/** Empties the store — persisted and in-memory entries alike. Called by `Nami.reset()`. */
|
|
3844
|
+
purgeAll(): void;
|
|
3845
|
+
/** Builds the index from the metadata keys, clearing away half-written and unreadable entries. */
|
|
3846
|
+
private loadIndex;
|
|
3847
|
+
private dropPersisted;
|
|
3848
|
+
private read;
|
|
3849
|
+
private write;
|
|
3850
|
+
private removeKey;
|
|
3851
|
+
}
|
|
3650
3852
|
|
|
3853
|
+
/** Counts for one resolution — the fields of the `Paywall fetch telemetry:` line. */
|
|
3854
|
+
type PaywallResolutionOutcome = {
|
|
3855
|
+
/** Valid paywall objects handed to the caller (`count`). */
|
|
3856
|
+
paywalls: IPaywall[];
|
|
3857
|
+
urls: number;
|
|
3858
|
+
hashed: number;
|
|
3859
|
+
cacheHits: number;
|
|
3860
|
+
/** Network 2xx only; a body served after a failure never counts here. */
|
|
3861
|
+
fetched: number;
|
|
3862
|
+
cacheAfterFetchFailure: number;
|
|
3863
|
+
failed: number;
|
|
3864
|
+
retryCount: number;
|
|
3865
|
+
};
|
|
3651
3866
|
declare class PaywallRepository {
|
|
3867
|
+
private readonly bodyCache;
|
|
3652
3868
|
static instance: PaywallRepository;
|
|
3869
|
+
constructor(bodyCache?: PaywallBodyCache);
|
|
3653
3870
|
fetchPaywalls(): Promise<IPaywall[]>;
|
|
3654
3871
|
private getAnonymousPaywalls;
|
|
3655
3872
|
private getPaywalls;
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3873
|
+
/**
|
|
3874
|
+
* Resolves the URL set named by `campaign_rules` into paywall objects — the decision table of
|
|
3875
|
+
* `api-resilience-and-caching.md` § 2.2, run identically at startup and on `refresh()`:
|
|
3876
|
+
*
|
|
3877
|
+
* | URL | entry for the exact URL within TTL | action | provenance |
|
|
3878
|
+
* |-----------|------------------------------------|-------------------------------|--------------------------|
|
|
3879
|
+
* | hashed | yes | serve it, no request | `cacheHit` |
|
|
3880
|
+
* | hashed | no | fetch; store the 2xx body | `fetched` |
|
|
3881
|
+
* | un-hashed | not consulted | fetch; store the 2xx body | `fetched` |
|
|
3882
|
+
* | either | fetch failed, entry within TTL | serve it, keep it | `cacheAfterFetchFailure` |
|
|
3883
|
+
* | either | fetch failed, no entry | no body | counts `failed` |
|
|
3884
|
+
*
|
|
3885
|
+
* Writes the aggregate `api_paywalls` — as the URLs of every body this resolution produced, since
|
|
3886
|
+
* the bodies themselves are already in the body cache — unless it produced none, so an outage
|
|
3887
|
+
* cannot overwrite a good aggregate with an empty one. Eviction is the caller's: it runs only
|
|
3888
|
+
* after a complete `campaign_rules` fetch.
|
|
3889
|
+
*/
|
|
3890
|
+
resolvePaywallsByUrls(urls: string[]): Promise<PaywallResolutionOutcome>;
|
|
3891
|
+
/**
|
|
3892
|
+
* Seeds the body cache from the initial-config bundle (§ 2.2 "Seeding"): every **hashed** bundled
|
|
3893
|
+
* URL whose paywall id matches a bundled body is stored under that exact URL unless an entry
|
|
3894
|
+
* already exists. A hash in a bundled URL was minted against the bundled body, so the pair is
|
|
3895
|
+
* exact. Runs at configure, before the first resolution.
|
|
3896
|
+
*/
|
|
3897
|
+
seedFromInitialConfig(campaignRules: NamiAnonymousCampaign[], paywalls: IPaywall[]): void;
|
|
3898
|
+
/** One row of the decision table. Never throws. */
|
|
3899
|
+
private resolvePaywall;
|
|
3900
|
+
/** The stored body for this exact URL, decoded; an undecodable one is deleted (not eviction). */
|
|
3901
|
+
private decodeCached;
|
|
3902
|
+
private fetchPaywallText;
|
|
3661
3903
|
private validatePaywalls;
|
|
3662
3904
|
private fallbackData;
|
|
3663
3905
|
}
|
|
@@ -4117,5 +4359,5 @@ declare namespace internal {
|
|
|
4117
4359
|
};
|
|
4118
4360
|
}
|
|
4119
4361
|
|
|
4120
|
-
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_NOT_AVAILABLE, 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, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STARTUP_TELEMETRY, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SessionService, SimpleEventTarget, StorageService, 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, 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, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseToSemver, postConversion, productDetail, registerAPITrafficObserver, registerPlatformAdapters, registerPurchaseAdapter, resolveLoopSource, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateForm, validateMinSDKVersion, validateTextInput };
|
|
4362
|
+
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, SessionService, SimpleEventTarget, StorageService, 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, 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, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseToSemver, postConversion, productDetail, registerAPITrafficObserver, registerPlatformAdapters, registerPurchaseAdapter, resolveLoopSource, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateForm, validateMinSDKVersion, validateTextInput };
|
|
4121
4363
|
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 };
|