@namiml/sdk-core 3.4.1-dev.202605280043 → 3.4.1-dev.202605300006
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 +277 -202
- package/dist/index.d.ts +960 -664
- package/dist/index.mjs +270 -196
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1394,161 +1394,6 @@ type DeviceProfile = {
|
|
|
1394
1394
|
customer_journey_state: CustomerJourneyState;
|
|
1395
1395
|
};
|
|
1396
1396
|
|
|
1397
|
-
declare class BasicNamiFlow implements NamiFlowObjectDTO {
|
|
1398
|
-
id: string;
|
|
1399
|
-
name: string;
|
|
1400
|
-
steps: NamiFlowStep[];
|
|
1401
|
-
screens: string[];
|
|
1402
|
-
resumeFromBookmark: boolean;
|
|
1403
|
-
transition: NamiFlowTransition;
|
|
1404
|
-
constructor(flowObject?: Partial<{
|
|
1405
|
-
id: string;
|
|
1406
|
-
name: string;
|
|
1407
|
-
steps: NamiFlowStep[];
|
|
1408
|
-
screens: string[];
|
|
1409
|
-
resume_from_bookmark: boolean;
|
|
1410
|
-
transition?: NamiFlowTransition;
|
|
1411
|
-
}>);
|
|
1412
|
-
get allScreensAvailable(): boolean;
|
|
1413
|
-
}
|
|
1414
|
-
declare class NamiFlow extends BasicNamiFlow {
|
|
1415
|
-
campaign?: NamiCampaign;
|
|
1416
|
-
context?: NamiPaywallLaunchContext;
|
|
1417
|
-
stepcrumbs: NamiFlowStep[];
|
|
1418
|
-
branchcrumbs: string[];
|
|
1419
|
-
component: PaywallHandle;
|
|
1420
|
-
manager: NamiFlowManager;
|
|
1421
|
-
currentButton?: any;
|
|
1422
|
-
activeHandoffSequence: {
|
|
1423
|
-
formStates: Record<string, boolean | string>;
|
|
1424
|
-
remainingKeys: string[];
|
|
1425
|
-
} | null;
|
|
1426
|
-
currentScreenState: TPaywallContext | null;
|
|
1427
|
-
isPaused: boolean;
|
|
1428
|
-
pausedStepID?: string;
|
|
1429
|
-
timerStates: {
|
|
1430
|
-
[timerId: string]: TimerState;
|
|
1431
|
-
};
|
|
1432
|
-
constructor(campaign: NamiFlowCampaign, paywall: PaywallHandle, manager: NamiFlowManager, context?: NamiPaywallLaunchContext);
|
|
1433
|
-
private applyLaunchContextAttributes;
|
|
1434
|
-
private registerResolvers;
|
|
1435
|
-
get currentFlowStep(): NamiFlowStep | undefined;
|
|
1436
|
-
get nextStepAvailable(): boolean;
|
|
1437
|
-
get previousStepAvailable(): boolean;
|
|
1438
|
-
get previousFlowStep(): NamiFlowStep | undefined;
|
|
1439
|
-
get nextFlowStep(): NamiFlowStep | undefined;
|
|
1440
|
-
getStep(stepId: string): NamiFlowStep | undefined;
|
|
1441
|
-
private findStepByType;
|
|
1442
|
-
private isStepActive;
|
|
1443
|
-
private flowLog;
|
|
1444
|
-
finished(): void;
|
|
1445
|
-
back(): void;
|
|
1446
|
-
next(): void;
|
|
1447
|
-
private backToPreviousScreenStep;
|
|
1448
|
-
forward(stepId: string): void;
|
|
1449
|
-
pause(): void;
|
|
1450
|
-
resumeFromPause(): void;
|
|
1451
|
-
executeLifecycle(step: NamiFlowStep, key: string, data?: Record<string, any>): void;
|
|
1452
|
-
private lifecycles;
|
|
1453
|
-
triggerActions(actionId: string, component?: any, data?: Record<string, any>): void;
|
|
1454
|
-
executeFullLifecycles(lifecycles: NamiFlowOn[], data?: Record<string, any>): void;
|
|
1455
|
-
triggerBeforeActions(actionId: string, component?: any, data?: Record<string, any>): void;
|
|
1456
|
-
triggerAfterActions(actionId: string, component?: any, data?: Record<string, any>): void;
|
|
1457
|
-
currentStepHasHoistedPrimaryActions(actionId: string): boolean;
|
|
1458
|
-
private shouldRun;
|
|
1459
|
-
private performAction;
|
|
1460
|
-
private nextStep;
|
|
1461
|
-
private handleScreenStep;
|
|
1462
|
-
private handleBranchStep;
|
|
1463
|
-
getFormData(): Record<string, boolean | string>;
|
|
1464
|
-
flowHandoffFormSequence(): void;
|
|
1465
|
-
resumeNextHandoff(): void;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
declare class NamiFlowManager {
|
|
1469
|
-
private static _instance;
|
|
1470
|
-
static get instance(): NamiFlowManager;
|
|
1471
|
-
currentFlow?: NamiFlow;
|
|
1472
|
-
flowOpen: boolean;
|
|
1473
|
-
private lastAnimatedFlowProgress;
|
|
1474
|
-
private navGraphCache;
|
|
1475
|
-
private constructor();
|
|
1476
|
-
/**
|
|
1477
|
-
* Clear flow data state. Called from `Nami.reset()`.
|
|
1478
|
-
*
|
|
1479
|
-
* Resets the active flow, openness flag, animation progress, and the
|
|
1480
|
-
* nav-graph cache. Host-registered handler refs (`handoffStepHandler`,
|
|
1481
|
-
* `eventHandler`) are intentionally preserved across reset — they're
|
|
1482
|
-
* owned by the integrating app via `registerStepHandoff()` /
|
|
1483
|
-
* `registerEventHandler()`, consistent with how Apple/Android handle
|
|
1484
|
-
* host callbacks across reset.
|
|
1485
|
-
*/
|
|
1486
|
-
static reset(): void;
|
|
1487
|
-
handoffStepHandler?: NamiFlowHandoffStepHandler;
|
|
1488
|
-
static registerStepHandoff(handoffStepHandler?: NamiFlowHandoffStepHandler): void;
|
|
1489
|
-
eventHandler?: NamiFlowEventHandler;
|
|
1490
|
-
static registerEventHandler(eventHandler: NamiFlowEventHandler): void;
|
|
1491
|
-
static resume(): void;
|
|
1492
|
-
resume(): void;
|
|
1493
|
-
static finish(): void;
|
|
1494
|
-
static pause(): void;
|
|
1495
|
-
static isFlowOpen(): boolean;
|
|
1496
|
-
presentFlow(campaign: NamiFlowCampaign, paywall: PaywallHandle, context?: NamiPaywallLaunchContext): NamiFlow;
|
|
1497
|
-
finishFlow(): void;
|
|
1498
|
-
/**
|
|
1499
|
-
* Gets the last animated progress for a component by ID
|
|
1500
|
-
* @param key Component ID
|
|
1501
|
-
* @returns Last animated progress value (0-1), or 0 if not found
|
|
1502
|
-
*/
|
|
1503
|
-
getLastAnimatedFlowProgress(key: string): number;
|
|
1504
|
-
/**
|
|
1505
|
-
* Sets the last animated progress for a component by ID
|
|
1506
|
-
* Only stores if there's an active flow
|
|
1507
|
-
* @param key Component ID
|
|
1508
|
-
* @param value Progress value (0-1)
|
|
1509
|
-
*/
|
|
1510
|
-
setLastAnimatedFlowProgress(key: string, value: number): void;
|
|
1511
|
-
/**
|
|
1512
|
-
* Gets the current flow progress based on screen steps
|
|
1513
|
-
* @param key Component ID (for compatibility)
|
|
1514
|
-
* @returns Progress as a percentage (0-1)
|
|
1515
|
-
*/
|
|
1516
|
-
getCurrentFlowProgress(key?: string): number;
|
|
1517
|
-
/**
|
|
1518
|
-
* Find the first screen that has branching (multiple forward navigation targets)
|
|
1519
|
-
*/
|
|
1520
|
-
private findBranchPoint;
|
|
1521
|
-
/**
|
|
1522
|
-
* Calculate progress for flows with branching (supports 2+ branches)
|
|
1523
|
-
*/
|
|
1524
|
-
private calculateBranchingProgress;
|
|
1525
|
-
/**
|
|
1526
|
-
* Count how many screens are forward-reachable from the current step
|
|
1527
|
-
* Only counts screens with higher indices (true forward navigation)
|
|
1528
|
-
*/
|
|
1529
|
-
private countForwardScreens;
|
|
1530
|
-
/**
|
|
1531
|
-
* Checks if a screen has branching navigation (2 or more forward targets)
|
|
1532
|
-
* Supports any number of branches: 2, 3, 4, etc.
|
|
1533
|
-
*/
|
|
1534
|
-
private hasBranching;
|
|
1535
|
-
/**
|
|
1536
|
-
* Build navigation graph from flow steps
|
|
1537
|
-
* Maps each step ID to its possible navigation targets
|
|
1538
|
-
*/
|
|
1539
|
-
private buildNavGraph;
|
|
1540
|
-
static getLastAnimatedFlowProgress(key: string): number;
|
|
1541
|
-
static setLastAnimatedFlowProgress(key: string, value: number): void;
|
|
1542
|
-
static getCurrentFlowProgress(key?: string): number;
|
|
1543
|
-
/**
|
|
1544
|
-
* Gets the current flow step's auto-advance delay (in seconds)
|
|
1545
|
-
* Parses __appear__ actions to find flowNav/flowNext with a delay parameter
|
|
1546
|
-
* @returns Delay in seconds, or null if not auto-advancing
|
|
1547
|
-
*/
|
|
1548
|
-
getCurrentFlowStepAutoAdvanceDelay(): number | null;
|
|
1549
|
-
static getCurrentFlowStepAutoAdvanceDelay(): number | null;
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
1397
|
type NamiPurchaseSource = 'CAMPAIGN' | 'MARKETPLACE' | 'UNKNOWN';
|
|
1553
1398
|
type TransactionRequest = {
|
|
1554
1399
|
quantity?: string;
|
|
@@ -1925,87 +1770,322 @@ declare class Nami {
|
|
|
1925
1770
|
private initializeSDK;
|
|
1926
1771
|
}
|
|
1927
1772
|
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
private
|
|
1773
|
+
declare class NamiFlowManager$2 {
|
|
1774
|
+
private static _instance;
|
|
1775
|
+
static get instance(): NamiFlowManager$2;
|
|
1776
|
+
currentFlow?: NamiFlow;
|
|
1777
|
+
flowOpen: boolean;
|
|
1778
|
+
private lastAnimatedFlowProgress;
|
|
1779
|
+
private navGraphCache;
|
|
1780
|
+
private constructor();
|
|
1935
1781
|
/**
|
|
1936
|
-
*
|
|
1782
|
+
* Clear flow data state. Called from `Nami.reset()`.
|
|
1783
|
+
*
|
|
1784
|
+
* Resets the active flow, openness flag, animation progress, and the
|
|
1785
|
+
* nav-graph cache. Host-registered handler refs (`handoffStepHandler`,
|
|
1786
|
+
* `eventHandler`) are intentionally preserved across reset — they're
|
|
1787
|
+
* owned by the integrating app via `registerStepHandoff()` /
|
|
1788
|
+
* `registerEventHandler()`, consistent with how Apple/Android handle
|
|
1789
|
+
* host callbacks across reset.
|
|
1937
1790
|
*/
|
|
1938
|
-
static
|
|
1791
|
+
static reset(): void;
|
|
1792
|
+
handoffStepHandler?: NamiFlowHandoffStepHandler;
|
|
1939
1793
|
/**
|
|
1940
|
-
*
|
|
1941
|
-
* The argument can be a label string, or a deeplink URL.
|
|
1794
|
+
* Registers a handoff step handler and returns an unsubscribe callback.
|
|
1942
1795
|
*
|
|
1943
|
-
*
|
|
1944
|
-
*
|
|
1796
|
+
* The returned callback clears the registered handler only if it is still
|
|
1797
|
+
* the active one (identity-check guard). This protects against React 18
|
|
1798
|
+
* StrictMode dev-mode double-mount where a stale unsubscribe from the
|
|
1799
|
+
* first effect could fire after a second effect has already registered.
|
|
1800
|
+
*
|
|
1801
|
+
* Passing `undefined` clears the current handler immediately (preserved
|
|
1802
|
+
* for backward compatibility with the 3.3.x escape hatch). The returned
|
|
1803
|
+
* callback in that case is a no-op identity-check that will never fire.
|
|
1804
|
+
*
|
|
1805
|
+
* Aligns with the rest of the SDK's register*Handler family: all
|
|
1806
|
+
* NamiPaywallManager / NamiCampaignManager / NamiCustomerManager handler
|
|
1807
|
+
* registration methods return `Callback`. See NAM-1219.
|
|
1945
1808
|
*/
|
|
1946
|
-
static
|
|
1809
|
+
static registerStepHandoff(handoffStepHandler?: NamiFlowHandoffStepHandler): Callback$1;
|
|
1810
|
+
eventHandler?: NamiFlowEventHandler;
|
|
1947
1811
|
/**
|
|
1948
|
-
*
|
|
1949
|
-
* The argument can be a label string, or a deeplink URL.
|
|
1812
|
+
* Registers an event handler and returns an unsubscribe callback.
|
|
1950
1813
|
*
|
|
1951
|
-
*
|
|
1952
|
-
*
|
|
1953
|
-
*
|
|
1814
|
+
* The returned callback clears the registered handler only if it is still
|
|
1815
|
+
* the active one (identity-check guard). See `registerStepHandoff` for the
|
|
1816
|
+
* full rationale.
|
|
1817
|
+
*
|
|
1818
|
+
* Passing `undefined` clears the current handler immediately.
|
|
1819
|
+
*
|
|
1820
|
+
* See NAM-1219.
|
|
1954
1821
|
*/
|
|
1955
|
-
static
|
|
1822
|
+
static registerEventHandler(eventHandler?: NamiFlowEventHandler): Callback$1;
|
|
1823
|
+
static resume(): void;
|
|
1824
|
+
resume(): void;
|
|
1825
|
+
static finish(): void;
|
|
1826
|
+
static pause(): void;
|
|
1827
|
+
static isFlowOpen(): boolean;
|
|
1828
|
+
presentFlow(campaign: NamiFlowCampaign, paywall: PaywallHandle, context?: NamiPaywallLaunchContext): NamiFlow;
|
|
1829
|
+
finishFlow(): void;
|
|
1956
1830
|
/**
|
|
1957
|
-
*
|
|
1958
|
-
*
|
|
1959
|
-
* @returns
|
|
1831
|
+
* Gets the last animated progress for a component by ID
|
|
1832
|
+
* @param key Component ID
|
|
1833
|
+
* @returns Last animated progress value (0-1), or 0 if not found
|
|
1960
1834
|
*/
|
|
1961
|
-
|
|
1835
|
+
getLastAnimatedFlowProgress(key: string): number;
|
|
1962
1836
|
/**
|
|
1963
|
-
*
|
|
1964
|
-
*
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
1967
|
-
* The handler will receive an array of `NamiCampaign` objects representing
|
|
1968
|
-
* the current active campaigns.
|
|
1969
|
-
*
|
|
1970
|
-
* @param {AvailableCampaignsResponseHandler} handler - The callback function that will be invoked when the campaign list is updated.
|
|
1971
|
-
* @returns {Callback} A function that can be called to unregister the handler.
|
|
1837
|
+
* Sets the last animated progress for a component by ID
|
|
1838
|
+
* Only stores if there's an active flow
|
|
1839
|
+
* @param key Component ID
|
|
1840
|
+
* @param value Progress value (0-1)
|
|
1972
1841
|
*/
|
|
1973
|
-
|
|
1842
|
+
setLastAnimatedFlowProgress(key: string, value: number): void;
|
|
1974
1843
|
/**
|
|
1975
|
-
*
|
|
1976
|
-
* @param
|
|
1977
|
-
* @
|
|
1978
|
-
* @param actionCallback - Optional handler for paywall actions.
|
|
1979
|
-
* @returns {PaywallHandle | void} The launched paywall handle (platform-specific).
|
|
1844
|
+
* Gets the current flow progress based on screen steps
|
|
1845
|
+
* @param key Component ID (for compatibility)
|
|
1846
|
+
* @returns Progress as a percentage (0-1)
|
|
1980
1847
|
*/
|
|
1981
|
-
|
|
1848
|
+
getCurrentFlowProgress(key?: string): number;
|
|
1982
1849
|
/**
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
* @return List of product groups associated with the specified campaign placement.
|
|
1987
|
-
*/
|
|
1988
|
-
static getProductGroups(label?: string, withUrl?: string): string[];
|
|
1850
|
+
* Find the first screen that has branching (multiple forward navigation targets)
|
|
1851
|
+
*/
|
|
1852
|
+
private findBranchPoint;
|
|
1989
1853
|
/**
|
|
1990
|
-
*
|
|
1991
|
-
* @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
|
|
1992
|
-
* @param withUrl Campaign placement URI defined in Nami Control Center for launching a specific campaign.
|
|
1993
|
-
* @returns List of product SKUs associated with the specified campaign placement.
|
|
1854
|
+
* Calculate progress for flows with branching (supports 2+ branches)
|
|
1994
1855
|
*/
|
|
1995
|
-
|
|
1856
|
+
private calculateBranchingProgress;
|
|
1996
1857
|
/**
|
|
1997
|
-
*
|
|
1998
|
-
*
|
|
1999
|
-
* @param withUrl Campaign placement URI defined in Nami Control Center for launching a specific campaign.
|
|
2000
|
-
* @returns List of current product SKUs associated with the specified campaign placement.
|
|
1858
|
+
* Count how many screens are forward-reachable from the current step
|
|
1859
|
+
* Only counts screens with higher indices (true forward navigation)
|
|
2001
1860
|
*/
|
|
2002
|
-
|
|
1861
|
+
private countForwardScreens;
|
|
2003
1862
|
/**
|
|
2004
|
-
*
|
|
1863
|
+
* Checks if a screen has branching navigation (2 or more forward targets)
|
|
1864
|
+
* Supports any number of branches: 2, 3, 4, etc.
|
|
2005
1865
|
*/
|
|
2006
|
-
private
|
|
2007
|
-
|
|
1866
|
+
private hasBranching;
|
|
1867
|
+
/**
|
|
1868
|
+
* Build navigation graph from flow steps
|
|
1869
|
+
* Maps each step ID to its possible navigation targets
|
|
1870
|
+
*/
|
|
1871
|
+
private buildNavGraph;
|
|
1872
|
+
static getLastAnimatedFlowProgress(key: string): number;
|
|
1873
|
+
static setLastAnimatedFlowProgress(key: string, value: number): void;
|
|
1874
|
+
static getCurrentFlowProgress(key?: string): number;
|
|
1875
|
+
/**
|
|
1876
|
+
* Gets the current flow step's auto-advance delay (in seconds)
|
|
1877
|
+
* Parses __appear__ actions to find flowNav/flowNext with a delay parameter
|
|
1878
|
+
* @returns Delay in seconds, or null if not auto-advancing
|
|
1879
|
+
*/
|
|
1880
|
+
getCurrentFlowStepAutoAdvanceDelay(): number | null;
|
|
1881
|
+
static getCurrentFlowStepAutoAdvanceDelay(): number | null;
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
declare class BasicNamiFlow implements NamiFlowObjectDTO {
|
|
1885
|
+
id: string;
|
|
1886
|
+
name: string;
|
|
1887
|
+
steps: NamiFlowStep[];
|
|
1888
|
+
screens: string[];
|
|
1889
|
+
resumeFromBookmark: boolean;
|
|
1890
|
+
transition: NamiFlowTransition;
|
|
1891
|
+
constructor(flowObject?: Partial<{
|
|
1892
|
+
id: string;
|
|
1893
|
+
name: string;
|
|
1894
|
+
steps: NamiFlowStep[];
|
|
1895
|
+
screens: string[];
|
|
1896
|
+
resume_from_bookmark: boolean;
|
|
1897
|
+
transition?: NamiFlowTransition;
|
|
1898
|
+
}>);
|
|
1899
|
+
get allScreensAvailable(): boolean;
|
|
1900
|
+
}
|
|
1901
|
+
declare class NamiFlow extends BasicNamiFlow {
|
|
1902
|
+
campaign?: NamiCampaign;
|
|
1903
|
+
context?: NamiPaywallLaunchContext;
|
|
1904
|
+
stepcrumbs: NamiFlowStep[];
|
|
1905
|
+
branchcrumbs: string[];
|
|
1906
|
+
component: PaywallHandle;
|
|
1907
|
+
manager: NamiFlowManager$2;
|
|
1908
|
+
currentButton?: any;
|
|
1909
|
+
activeHandoffSequence: {
|
|
1910
|
+
formStates: Record<string, boolean | string>;
|
|
1911
|
+
remainingKeys: string[];
|
|
1912
|
+
} | null;
|
|
1913
|
+
currentScreenState: TPaywallContext | null;
|
|
1914
|
+
isPaused: boolean;
|
|
1915
|
+
pausedStepID?: string;
|
|
1916
|
+
timerStates: {
|
|
1917
|
+
[timerId: string]: TimerState;
|
|
1918
|
+
};
|
|
1919
|
+
constructor(campaign: NamiFlowCampaign, paywall: PaywallHandle, manager: NamiFlowManager$2, context?: NamiPaywallLaunchContext);
|
|
1920
|
+
private applyLaunchContextAttributes;
|
|
1921
|
+
private registerResolvers;
|
|
1922
|
+
get currentFlowStep(): NamiFlowStep | undefined;
|
|
1923
|
+
get nextStepAvailable(): boolean;
|
|
1924
|
+
get previousStepAvailable(): boolean;
|
|
1925
|
+
get previousFlowStep(): NamiFlowStep | undefined;
|
|
1926
|
+
get nextFlowStep(): NamiFlowStep | undefined;
|
|
1927
|
+
getStep(stepId: string): NamiFlowStep | undefined;
|
|
1928
|
+
private findStepByType;
|
|
1929
|
+
private isStepActive;
|
|
1930
|
+
private flowLog;
|
|
1931
|
+
finished(): void;
|
|
1932
|
+
back(): void;
|
|
1933
|
+
next(): void;
|
|
1934
|
+
private backToPreviousScreenStep;
|
|
1935
|
+
forward(stepId: string): void;
|
|
1936
|
+
pause(): void;
|
|
1937
|
+
resumeFromPause(): void;
|
|
1938
|
+
executeLifecycle(step: NamiFlowStep, key: string, data?: Record<string, any>): void;
|
|
1939
|
+
private lifecycles;
|
|
1940
|
+
triggerActions(actionId: string, component?: any, data?: Record<string, any>): void;
|
|
1941
|
+
executeFullLifecycles(lifecycles: NamiFlowOn[], data?: Record<string, any>): void;
|
|
1942
|
+
triggerBeforeActions(actionId: string, component?: any, data?: Record<string, any>): void;
|
|
1943
|
+
triggerAfterActions(actionId: string, component?: any, data?: Record<string, any>): void;
|
|
1944
|
+
currentStepHasHoistedPrimaryActions(actionId: string): boolean;
|
|
1945
|
+
private shouldRun;
|
|
1946
|
+
private performAction;
|
|
1947
|
+
private nextStep;
|
|
1948
|
+
private handleScreenStep;
|
|
1949
|
+
private handleBranchStep;
|
|
1950
|
+
getFormData(): Record<string, boolean | string>;
|
|
1951
|
+
flowHandoffFormSequence(): void;
|
|
1952
|
+
resumeNextHandoff(): void;
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
declare class SimpleEventTarget implements EventTarget {
|
|
1956
|
+
private listeners;
|
|
1957
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
1958
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null): void;
|
|
1959
|
+
dispatchEvent(event: Event): boolean;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
type Callback = () => void;
|
|
1963
|
+
declare const initialState: TPaywallContext;
|
|
1964
|
+
declare class PaywallState extends SimpleEventTarget {
|
|
1965
|
+
static providers: PaywallState[];
|
|
1966
|
+
state: TPaywallContext;
|
|
1967
|
+
subscribers: Set<Callback>;
|
|
1968
|
+
productDetails: NamiProductDetails[];
|
|
1969
|
+
flow?: NamiFlow;
|
|
1970
|
+
filteredSkuMenus: ISkuMenu[];
|
|
1971
|
+
static create(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign): PaywallState;
|
|
1972
|
+
static remove(provider: PaywallState): void;
|
|
1973
|
+
/**
|
|
1974
|
+
* Clear the static `providers` array. Called from `Nami.reset()` so
|
|
1975
|
+
* orphaned PaywallState instances from a previous SDK lifecycle don't
|
|
1976
|
+
* receive customer-attribute / login / product-detail updates intended
|
|
1977
|
+
* for the next configure() cycle.
|
|
1978
|
+
*/
|
|
1979
|
+
static reset(): void;
|
|
1980
|
+
static get currentProvider(): PaywallState | undefined;
|
|
1981
|
+
static setCustomerAttribute(attributes: {
|
|
1982
|
+
[key: string]: string;
|
|
1983
|
+
}): void;
|
|
1984
|
+
static removeCustomerAttribute(key: string): void;
|
|
1985
|
+
static setAppSuppliedVideoDetails(details: NamiAppSuppliedVideoDetails): void;
|
|
1986
|
+
static getSelectedPaywall(): IPaywall | undefined;
|
|
1987
|
+
static setUserInteractionEnabled(enabled: boolean): void;
|
|
1988
|
+
static setUserTags(tags: {
|
|
1989
|
+
[key: string]: string;
|
|
1990
|
+
}): void;
|
|
1991
|
+
static setProductDetails(details: NamiProductDetails[]): void;
|
|
1992
|
+
static setPurchaseInProgress(inProgress: boolean): void;
|
|
1993
|
+
static setIsLoggedIn(isLoggedIn: boolean): void;
|
|
1994
|
+
static setPurchase(inProgress: boolean, product?: NamiSKU): void;
|
|
1995
|
+
static getSelectedSlideIndex(): number | undefined;
|
|
1996
|
+
constructor(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign);
|
|
1997
|
+
protected onStateChanged(): void;
|
|
1998
|
+
subscribe(callback: Callback): Callback;
|
|
1999
|
+
unsubscribe(callback: Callback): void;
|
|
2000
|
+
emitEvent<T = any>(name: string, payload?: T): void;
|
|
2001
|
+
onEvent<T = any>(name: string, handler: (payload: T) => void): () => void;
|
|
2002
|
+
private setState;
|
|
2003
|
+
setProductDetails(details: NamiProductDetails[]): void;
|
|
2004
|
+
getProductDetails(): NamiProductDetails[];
|
|
2005
|
+
setCurrentGroupData(currentGroupId: string, currentGroupName: string): void;
|
|
2006
|
+
setFormState(formId: string, state: boolean | string): void;
|
|
2007
|
+
setTimerState(timerId: string, remainingSeconds: number, savedAt: number, hasEmittedCompletion: boolean): void;
|
|
2008
|
+
getTimerState(timerId: string): TimerState | undefined;
|
|
2009
|
+
getCurrentGroupId(): string;
|
|
2010
|
+
getCurrentGroupName(): string;
|
|
2011
|
+
setCurrentFormId(formId: string, value?: string): void;
|
|
2012
|
+
getCurrentFormId(formId: string): boolean | string;
|
|
2013
|
+
setSelectedProducts(products: {
|
|
2014
|
+
[currentGroupId: string]: string | null;
|
|
2015
|
+
}): void;
|
|
2016
|
+
selectedProducts(): {
|
|
2017
|
+
[currentGroupId: string]: string | null;
|
|
2018
|
+
};
|
|
2019
|
+
setPaywall(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign): void;
|
|
2020
|
+
getSelectedPaywall(): IPaywall | undefined;
|
|
2021
|
+
getSelectedCampaign(): NamiCampaign | undefined;
|
|
2022
|
+
getCurrentPlacementLabel(): string | null | undefined;
|
|
2023
|
+
getPaywallActionEventData(): Partial<NamiPaywallEvent>;
|
|
2024
|
+
paywallId(): string;
|
|
2025
|
+
setCurrentPage(page: string): void;
|
|
2026
|
+
canGoBackPage(): boolean;
|
|
2027
|
+
goBackPage(): boolean;
|
|
2028
|
+
setCustomerAttribute(attributes: {
|
|
2029
|
+
[key: string]: string;
|
|
2030
|
+
}): void;
|
|
2031
|
+
removeCustomerAttribute(key: string): void;
|
|
2032
|
+
setIsLoggedIn(isLoggedIn: boolean): void;
|
|
2033
|
+
setMediaList(media: TPaywallMedia[]): void;
|
|
2034
|
+
setSafeAreaTop(safeAreaTop: number): void;
|
|
2035
|
+
setFullScreenPresentation(fullScreenPresentation: boolean): void;
|
|
2036
|
+
setFormFactor(formFactor: TDevice): void;
|
|
2037
|
+
getFormFactor(): TDevice;
|
|
2038
|
+
setPurchaseInProgress(inProgress: boolean): void;
|
|
2039
|
+
setPurchase(inProgress: boolean, product?: NamiSKU): void;
|
|
2040
|
+
setTimeSpentOnPaywall(time: number): void;
|
|
2041
|
+
setAppSuppliedVideoDetails({ url, name }: NamiAppSuppliedVideoDetails): void;
|
|
2042
|
+
resetAppSuppliedVideoDetails(): void;
|
|
2043
|
+
setLaunchDetails(value: string, type?: string): void;
|
|
2044
|
+
setOpenHeaderIds(id: string, sku?: NamiSKU): void;
|
|
2045
|
+
getCurrentCollapsibleSku(): NamiSKU;
|
|
2046
|
+
setFlow(flow: NamiFlow): void;
|
|
2047
|
+
setUserInteractionEnabled(enabled: boolean): void;
|
|
2048
|
+
setUserTags(tags: {
|
|
2049
|
+
[key: string]: string;
|
|
2050
|
+
}): void;
|
|
2051
|
+
setCurrentSlideIndex(index: number): void;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* Static shape of the public {@link NamiCampaignManager} entry point.
|
|
2056
|
+
* Declared explicitly so the bundled `.d.ts` keeps full type fidelity for
|
|
2057
|
+
* the const proxy below. See NAM-1207.
|
|
2058
|
+
*/
|
|
2059
|
+
interface NamiCampaignManagerStatic {
|
|
2060
|
+
/** Returns the list of campaigns available to the current device. */
|
|
2061
|
+
allCampaigns: () => NamiCampaign[];
|
|
2062
|
+
/** Returns `true` if a campaign with the given label is available. */
|
|
2063
|
+
isCampaignAvailable: (label: string) => boolean;
|
|
2064
|
+
/** Returns `true` if the addressed campaign is a Flow campaign. */
|
|
2065
|
+
isFlow: (label?: string, withUrl?: string) => boolean;
|
|
2066
|
+
/** Refreshes the available campaigns from the Nami backend. */
|
|
2067
|
+
refresh: () => Promise<NamiCampaign[]>;
|
|
2068
|
+
/**
|
|
2069
|
+
* Registers a handler invoked whenever the list of available campaigns
|
|
2070
|
+
* changes. Returns an unregister callback.
|
|
2071
|
+
*/
|
|
2072
|
+
registerAvailableCampaignsHandler: (handler: AvailableCampaignsResponseHandler) => () => void;
|
|
2073
|
+
/**
|
|
2074
|
+
* Launches a campaign by label or URL. Returns the platform's paywall
|
|
2075
|
+
* handle (a Web Component on web; opaque on other platforms).
|
|
2076
|
+
*/
|
|
2077
|
+
launch: (label?: string, withUrl?: string, context?: NamiPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler) => PaywallHandle;
|
|
2078
|
+
/** Returns the product-group identifiers configured on the addressed campaign. */
|
|
2079
|
+
getProductGroups: (label?: string, withUrl?: string) => string[];
|
|
2080
|
+
/** Returns every product SKU referenced by the addressed campaign's groups. */
|
|
2081
|
+
getAllProducts: (label?: string, withUrl?: string) => string[];
|
|
2082
|
+
/**
|
|
2083
|
+
* Returns the SKUs that should be priced and displayed for the current
|
|
2084
|
+
* device after segment + form-factor filtering.
|
|
2085
|
+
*/
|
|
2086
|
+
getCurrentProducts: (label?: string, withUrl?: string) => string[];
|
|
2008
2087
|
}
|
|
2088
|
+
declare const NamiCampaignManager$2: NamiCampaignManagerStatic;
|
|
2009
2089
|
|
|
2010
2090
|
type NamiProfile = {
|
|
2011
2091
|
externalId: string;
|
|
@@ -2031,143 +2111,237 @@ declare enum AccountStateAction {
|
|
|
2031
2111
|
|
|
2032
2112
|
type NamiCustomerJourneyStateHandler = (customerJourneyState: CustomerJourneyState) => void;
|
|
2033
2113
|
|
|
2034
|
-
type AccountStateHandler = (action: AccountStateAction, success: boolean, error?: Error) => void;
|
|
2035
2114
|
/**
|
|
2036
|
-
*
|
|
2037
|
-
*
|
|
2115
|
+
* Callback fired when the account-state machine transitions (login,
|
|
2116
|
+
* logout, anonymous-mode toggles). Receives the action that just
|
|
2117
|
+
* completed, a success flag, and an optional error.
|
|
2118
|
+
*
|
|
2119
|
+
* Mirrored verbatim from `sdk/core/src/nami/customer.ts` so the public
|
|
2120
|
+
* interface stays self-contained.
|
|
2038
2121
|
*/
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2122
|
+
type AccountStateHandler$1 = (action: AccountStateAction, success: boolean, error?: Error) => void;
|
|
2123
|
+
/**
|
|
2124
|
+
* Static shape of the public {@link NamiCustomerManager} entry point.
|
|
2125
|
+
* See NAM-1207.
|
|
2126
|
+
*/
|
|
2127
|
+
interface NamiCustomerManagerStatic {
|
|
2128
|
+
/** Returns `true` if a customer has been logged in via `login()`. */
|
|
2129
|
+
isLoggedIn: () => boolean;
|
|
2130
|
+
/** Returns the externalId of the logged-in customer, if any. */
|
|
2131
|
+
loggedInId: () => string | undefined;
|
|
2132
|
+
/**
|
|
2133
|
+
* Logs in an external customer ID. Drives subsequent API calls, drives
|
|
2134
|
+
* the journey-state machine, and triggers any registered handlers.
|
|
2135
|
+
*/
|
|
2136
|
+
login: (externalId: string) => Promise<void>;
|
|
2137
|
+
/** Logs out the current customer. */
|
|
2138
|
+
logout: () => Promise<void>;
|
|
2139
|
+
/** Associates a customer-data-platform ID with the current customer. */
|
|
2140
|
+
setCustomerDataPlatformId: (id: string) => Promise<void>;
|
|
2141
|
+
/** Clears any previously-set customer-data-platform ID. */
|
|
2142
|
+
clearCustomerDataPlatformId: () => Promise<void>;
|
|
2143
|
+
/**
|
|
2144
|
+
* Registers a callback for account-state transitions. Returns an
|
|
2145
|
+
* unregister function.
|
|
2146
|
+
*/
|
|
2147
|
+
registerAccountStateHandler: (handler: AccountStateHandler$1) => () => void;
|
|
2148
|
+
/** Enables or disables anonymous-mode tracking. */
|
|
2149
|
+
setAnonymousMode: (enabled: boolean) => Promise<void>;
|
|
2150
|
+
/** Returns `true` if the SDK is operating in anonymous mode. */
|
|
2151
|
+
inAnonymousMode: () => boolean;
|
|
2152
|
+
/** Persists a per-customer key/value attribute. */
|
|
2153
|
+
setCustomerAttribute: (key: string, value: string) => void;
|
|
2154
|
+
/** Reads a previously-persisted attribute by key. */
|
|
2155
|
+
getCustomerAttribute: (key: string) => string | null;
|
|
2156
|
+
/** Returns the keys of every persisted customer attribute. */
|
|
2157
|
+
getAllCustomerAttributes: () => string[];
|
|
2158
|
+
/** Removes a single customer attribute. */
|
|
2159
|
+
clearCustomerAttribute: (key: string) => void;
|
|
2160
|
+
/** Removes every customer attribute. */
|
|
2161
|
+
clearAllCustomerAttributes: () => void;
|
|
2162
|
+
/** Returns the current customer journey-state snapshot, if available. */
|
|
2163
|
+
journeyState: () => CustomerJourneyState | null;
|
|
2164
|
+
/** Returns the SDK-assigned device ID for the current device. */
|
|
2165
|
+
deviceId: () => string;
|
|
2166
|
+
/**
|
|
2167
|
+
* Registers a callback for journey-state changes. Returns an
|
|
2168
|
+
* unregister function, or `undefined` if the SDK is not initialized.
|
|
2169
|
+
*/
|
|
2170
|
+
registerJourneyStateHandler: (handler: NamiCustomerJourneyStateHandler) => (() => void) | undefined;
|
|
2171
|
+
}
|
|
2172
|
+
declare const NamiCustomerManager$2: NamiCustomerManagerStatic;
|
|
2173
|
+
|
|
2174
|
+
type IEntitlements = {
|
|
2175
|
+
id: string;
|
|
2176
|
+
entitlement_ref_id: string;
|
|
2177
|
+
name: string;
|
|
2178
|
+
description: string | null;
|
|
2179
|
+
type: string;
|
|
2180
|
+
expires?: string;
|
|
2181
|
+
};
|
|
2182
|
+
type NamiEntitlement = {
|
|
2183
|
+
activePurchases: NamiPurchase[];
|
|
2184
|
+
desc: string;
|
|
2185
|
+
name: string;
|
|
2186
|
+
namiId: string;
|
|
2187
|
+
purchasedSkus: NamiSKU[];
|
|
2188
|
+
referenceId: string;
|
|
2189
|
+
relatedSkus: NamiSKU[];
|
|
2190
|
+
expires?: number;
|
|
2191
|
+
};
|
|
2192
|
+
type NamiActiveEntitlementsHandler = (entitlement: NamiEntitlement[]) => void;
|
|
2193
|
+
|
|
2194
|
+
/**
|
|
2195
|
+
* Static shape of the public {@link NamiEntitlementManager} entry point.
|
|
2196
|
+
* See NAM-1207.
|
|
2197
|
+
*/
|
|
2198
|
+
interface NamiEntitlementManagerStatic {
|
|
2199
|
+
/** Returns the currently-active entitlements. */
|
|
2200
|
+
active: () => NamiEntitlement[];
|
|
2201
|
+
/** Returns `true` if an entitlement with the given referenceId is active. */
|
|
2202
|
+
isEntitlementActive: (referenceId: string) => boolean;
|
|
2203
|
+
/** Refreshes the active-entitlements list from the Nami backend. */
|
|
2204
|
+
refresh: () => Promise<NamiEntitlement[]>;
|
|
2043
2205
|
/**
|
|
2044
|
-
*
|
|
2045
|
-
*
|
|
2046
|
-
*
|
|
2206
|
+
* Registers a callback fired whenever the active-entitlements list
|
|
2207
|
+
* changes. Returns an unregister function, or `undefined` if the SDK
|
|
2208
|
+
* is not initialized.
|
|
2047
2209
|
*/
|
|
2048
|
-
|
|
2210
|
+
registerActiveEntitlementsHandler: (handler: NamiActiveEntitlementsHandler) => Callback$1 | undefined;
|
|
2049
2211
|
/**
|
|
2050
|
-
*
|
|
2051
|
-
*
|
|
2052
|
-
*
|
|
2053
|
-
|
|
2054
|
-
|
|
2212
|
+
* Clears any provisional entitlement grants (i.e., entitlements
|
|
2213
|
+
* activated locally before backend confirmation). Used to reset
|
|
2214
|
+
* post-purchase optimistic state when reconciliation fails.
|
|
2215
|
+
*/
|
|
2216
|
+
clearProvisionalEntitlementGrants: () => void;
|
|
2217
|
+
}
|
|
2218
|
+
declare const NamiEntitlementManager$2: NamiEntitlementManagerStatic;
|
|
2219
|
+
|
|
2220
|
+
/**
|
|
2221
|
+
* Static shape of the public {@link NamiFlowManager} entry point. Declared
|
|
2222
|
+
* explicitly so the bundled `.d.ts` keeps full type fidelity for the const
|
|
2223
|
+
* proxy below — without this, declaration emitters can either widen each
|
|
2224
|
+
* member to `any` (the 3.3.12 behavior, which silently accepted mis-typed
|
|
2225
|
+
* consumer code) or drop the const declaration in favor of the underlying
|
|
2226
|
+
* class declaration (the 3.4.0 behavior — see NAM-1207).
|
|
2227
|
+
*/
|
|
2228
|
+
interface NamiFlowManagerStatic {
|
|
2055
2229
|
/**
|
|
2056
|
-
*
|
|
2230
|
+
* Registers a handler to be invoked when a flow step triggers a handoff event.
|
|
2057
2231
|
*
|
|
2058
|
-
*
|
|
2059
|
-
*
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
*
|
|
2064
|
-
*
|
|
2232
|
+
* This allows you to intercept a handoff step in a Nami Flow and execute custom logic.
|
|
2233
|
+
*
|
|
2234
|
+
* @param handoffStepHandler - A callback function that will be called when a handoff occurs.
|
|
2235
|
+
* It receives the `handoffTag` string (identifying the step) and an optional `handoffData`
|
|
2236
|
+
* object with additional context. If `undefined`, the current handler is cleared.
|
|
2237
|
+
* @returns An unsubscribe `Callback`. Call it to clear the registered handler.
|
|
2238
|
+
* The unsubscribe is identity-checked — calling it after a different handler has been
|
|
2239
|
+
* registered is a no-op. See NAM-1219.
|
|
2065
2240
|
*/
|
|
2066
|
-
|
|
2241
|
+
registerStepHandoff: (handoffStepHandler?: NamiFlowHandoffStepHandler) => Callback$1;
|
|
2067
2242
|
/**
|
|
2068
|
-
*
|
|
2243
|
+
* Registers a handler to be invoked when events are emitted.
|
|
2069
2244
|
*
|
|
2070
|
-
*
|
|
2245
|
+
* This enables you to use your own custom event tracking.
|
|
2071
2246
|
*
|
|
2072
|
-
* @param
|
|
2073
|
-
*
|
|
2247
|
+
* @param eventHandler - A callback function that will be called when an event occurs.
|
|
2248
|
+
* The argument is a key-value object containing event data. If `undefined`, the
|
|
2249
|
+
* current handler is cleared.
|
|
2250
|
+
* @returns An unsubscribe `Callback`. Call it to clear the registered handler.
|
|
2251
|
+
* The unsubscribe is identity-checked — calling it after a different handler has been
|
|
2252
|
+
* registered is a no-op. See NAM-1219.
|
|
2074
2253
|
*/
|
|
2075
|
-
|
|
2254
|
+
registerEventHandler: (eventHandler?: NamiFlowEventHandler) => Callback$1;
|
|
2076
2255
|
/**
|
|
2077
|
-
*
|
|
2256
|
+
* Resumes the Nami Flow after a handoff has been completed.
|
|
2078
2257
|
*
|
|
2079
|
-
*
|
|
2080
|
-
*
|
|
2081
|
-
|
|
2082
|
-
static clearCustomerDataPlatformId(): Promise<void>;
|
|
2083
|
-
/**
|
|
2084
|
-
* Registers a callback function to handle changes in the account state.
|
|
2085
|
-
*
|
|
2086
|
-
* @param callback - The callback function to be registered.
|
|
2087
|
-
* @returns {Callback} A function that can be used to unregister the original callback.
|
|
2088
|
-
*/
|
|
2089
|
-
static registerAccountStateHandler(handler: AccountStateHandler): Callback$1;
|
|
2090
|
-
/**
|
|
2091
|
-
* Sets the anonymous mode for the customer.
|
|
2092
|
-
*
|
|
2093
|
-
* @param enabled - A boolean value indicating whether the anonymous mode should be enabled or disabled.
|
|
2094
|
-
* @returns {Promise<void>} A Promise that resolves when the anonymous mode is set.
|
|
2258
|
+
* This should be called by once any custom logic associated with
|
|
2259
|
+
* a handoff has completed.
|
|
2260
|
+
* It signals to continue to the next step in the flow sequence.
|
|
2095
2261
|
*/
|
|
2096
|
-
|
|
2097
|
-
/**
|
|
2098
|
-
* @returns {boolean} whether or not the SDK is currently operating in anonymous mode
|
|
2099
|
-
*/
|
|
2100
|
-
static inAnonymousMode(): boolean;
|
|
2262
|
+
resume: () => void;
|
|
2101
2263
|
/**
|
|
2102
|
-
*
|
|
2264
|
+
* Finishes the current flow programmatically.
|
|
2103
2265
|
*
|
|
2104
|
-
*
|
|
2105
|
-
* @param value - The value of the customer attribute. For example: `Joe`.
|
|
2266
|
+
* This can be used to end the flow at any point, typically after a handoff or custom logic.
|
|
2106
2267
|
*/
|
|
2107
|
-
|
|
2268
|
+
finish: () => void;
|
|
2108
2269
|
/**
|
|
2109
|
-
*
|
|
2270
|
+
* Pauses the current flow.
|
|
2110
2271
|
*
|
|
2111
|
-
*
|
|
2112
|
-
* @returns {string | null} The value of the customer attribute.
|
|
2272
|
+
* This can be used to temporarily halt the flow, typically in response to user input or other events.
|
|
2113
2273
|
*/
|
|
2114
|
-
|
|
2115
|
-
/**
|
|
2116
|
-
* Retrieves all the customer attribute key/value store.
|
|
2117
|
-
*
|
|
2118
|
-
* @returns {string | null} The value of the customer attribute.
|
|
2119
|
-
*/
|
|
2120
|
-
static getAllCustomerAttributes(): string[];
|
|
2274
|
+
pause: () => void;
|
|
2121
2275
|
/**
|
|
2122
|
-
*
|
|
2276
|
+
* Checks if a flow is currently open.
|
|
2123
2277
|
*
|
|
2124
|
-
* @
|
|
2125
|
-
*/
|
|
2126
|
-
static clearCustomerAttribute(key: string): void;
|
|
2127
|
-
/**
|
|
2128
|
-
* Clear all customer attributes from the on-device key/value store.
|
|
2129
|
-
*/
|
|
2130
|
-
static clearAllCustomerAttributes(): void;
|
|
2131
|
-
/**
|
|
2132
|
-
* @return current customer's journey state.
|
|
2133
|
-
*/
|
|
2134
|
-
static journeyState(): CustomerJourneyState | null;
|
|
2135
|
-
/**
|
|
2136
|
-
* @return the unique identifier Nami users to identify this device. Please note
|
|
2137
|
-
* you should not depend on the device identifier persisting across app re-installs.
|
|
2278
|
+
* @returns `true` if a flow is open, `false` otherwise.
|
|
2138
2279
|
*/
|
|
2139
|
-
|
|
2280
|
+
isFlowOpen: () => boolean;
|
|
2281
|
+
}
|
|
2282
|
+
declare const NamiFlowManager$1: NamiFlowManagerStatic;
|
|
2283
|
+
|
|
2284
|
+
/**
|
|
2285
|
+
* Static shape of the public {@link NamiPaywallManager} entry point.
|
|
2286
|
+
*
|
|
2287
|
+
* `emitter` (a public class static that holds the internal event bus) is
|
|
2288
|
+
* intentionally NOT on this interface. Tests reach for it via the
|
|
2289
|
+
* underlying class via the `_internal` namespace on `@namiml/sdk-core` (NAM-1217). See NAM-1207.
|
|
2290
|
+
*/
|
|
2291
|
+
interface NamiPaywallManagerStatic {
|
|
2292
|
+
/** Returns every paywall currently loaded for the device. */
|
|
2293
|
+
allPaywalls: () => IPaywall[];
|
|
2140
2294
|
/**
|
|
2141
|
-
*
|
|
2142
|
-
* the
|
|
2143
|
-
*
|
|
2144
|
-
*
|
|
2145
|
-
* @param {NamiCustomerJourneyStateHandler} handler - The callback function that will be invoked when the campaign list is updated.
|
|
2146
|
-
* @returns {Callback} A function that can be called to unregister the handler.
|
|
2295
|
+
* Overrides the in-memory product details used to price paywalls. Pass
|
|
2296
|
+
* the host app's StoreKit/Google-Play-derived product details to keep
|
|
2297
|
+
* Nami's localized strings accurate.
|
|
2147
2298
|
*/
|
|
2148
|
-
|
|
2299
|
+
setProductDetails: (productDetails: NamiProductDetails[]) => void;
|
|
2300
|
+
/** Registers a sign-in handler. Returns an unregister function. */
|
|
2301
|
+
registerSignInHandler: (handler: Callback$1) => Callback$1;
|
|
2302
|
+
/** Registers a close handler. Returns an unregister function. */
|
|
2303
|
+
registerCloseHandler: (handler: CloseHandler) => Callback$1;
|
|
2304
|
+
/** Registers a deep-link action handler. Returns an unregister function. */
|
|
2305
|
+
registerDeeplinkActionHandler: (handler: DeepLinkUrlHandler) => Callback$1;
|
|
2149
2306
|
/**
|
|
2150
|
-
*
|
|
2307
|
+
* Registers a buy-SKU handler — invoked when a user taps a purchase
|
|
2308
|
+
* button. Required for host-managed purchase flows.
|
|
2151
2309
|
*/
|
|
2152
|
-
|
|
2310
|
+
registerBuySkuHandler: (handler: SKUActionHandler) => Callback$1;
|
|
2311
|
+
/** Registers a restore-purchase handler. Returns an unregister function. */
|
|
2312
|
+
registerRestoreHandler: (handler: Callback$1) => Callback$1;
|
|
2313
|
+
/** Notifies Nami that a host-managed purchase completed successfully. */
|
|
2314
|
+
buySkuComplete: (purchase: NamiPurchaseDetails) => Promise<void>;
|
|
2315
|
+
/** Notifies Nami that a host-managed purchase was cancelled. */
|
|
2316
|
+
buySkuCancel: () => void;
|
|
2153
2317
|
/**
|
|
2154
|
-
*
|
|
2318
|
+
* Provides Nami with the URL of a host-supplied video to use in
|
|
2319
|
+
* place of the paywall-configured video for the current launch.
|
|
2155
2320
|
*/
|
|
2156
|
-
|
|
2157
|
-
private static updateCustomerDataPlatformId;
|
|
2321
|
+
setAppSuppliedVideoDetails: (url: string, name?: string) => void;
|
|
2158
2322
|
/**
|
|
2159
|
-
*
|
|
2160
|
-
*
|
|
2323
|
+
* Toggles whether user interaction on the active paywall is allowed.
|
|
2324
|
+
* Use during host-controlled animations or modal transitions.
|
|
2161
2325
|
*/
|
|
2162
|
-
|
|
2163
|
-
private static refetchConfig;
|
|
2326
|
+
allowUserInteraction: (allowed: boolean) => void;
|
|
2164
2327
|
}
|
|
2328
|
+
declare const NamiPaywallManager$2: NamiPaywallManagerStatic;
|
|
2165
2329
|
|
|
2166
|
-
|
|
2167
|
-
|
|
2330
|
+
/**
|
|
2331
|
+
* Static shape of the public {@link NamiPurchaseManager} entry point.
|
|
2332
|
+
* See NAM-1207.
|
|
2333
|
+
*/
|
|
2334
|
+
interface NamiPurchaseManagerStatic {
|
|
2335
|
+
/** Returns the full list of purchases recorded for the current customer. */
|
|
2336
|
+
allPurchases: () => NamiPurchase[];
|
|
2337
|
+
}
|
|
2338
|
+
declare const NamiPurchaseManager$2: NamiPurchaseManagerStatic;
|
|
2339
|
+
|
|
2340
|
+
declare class NamiProfileManager$1 {
|
|
2341
|
+
static instance: NamiProfileManager$1;
|
|
2168
2342
|
private externalId?;
|
|
2169
2343
|
constructor();
|
|
2170
|
-
setExternalId(externalId: string | undefined): NamiProfileManager;
|
|
2344
|
+
setExternalId(externalId: string | undefined): NamiProfileManager$1;
|
|
2171
2345
|
getExternalId(): string | undefined;
|
|
2172
2346
|
isLoggedIn(): boolean;
|
|
2173
2347
|
private save;
|
|
@@ -2196,356 +2370,105 @@ declare class NamiProfileManager {
|
|
|
2196
2370
|
logout(): Promise<void>;
|
|
2197
2371
|
}
|
|
2198
2372
|
|
|
2199
|
-
declare class
|
|
2200
|
-
private
|
|
2201
|
-
private
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2373
|
+
declare class StorageService {
|
|
2374
|
+
private memoryStore;
|
|
2375
|
+
private get storage();
|
|
2376
|
+
setDevice(device: Device): void;
|
|
2377
|
+
getDevice(): Device | null;
|
|
2378
|
+
resetDevice(): void;
|
|
2379
|
+
getAnonymousMode(): boolean;
|
|
2380
|
+
setAnonymousMode(mode: boolean): void;
|
|
2381
|
+
clearAnonymousMode(): void;
|
|
2382
|
+
setAppConfig(key: string, config: IConfig): void;
|
|
2383
|
+
getAppConfig(key: string): IConfig | null;
|
|
2384
|
+
setLanguageCode(code?: string): void;
|
|
2385
|
+
getLanguageCode(): string;
|
|
2386
|
+
setCampaignRules(key: string, campaignRules: NamiCampaign[]): void;
|
|
2387
|
+
getCampaignRules(key: string): NamiCampaign[] | null;
|
|
2388
|
+
setPaywalls(key: string, paywalls: IPaywall[]): void;
|
|
2389
|
+
getPaywalls(key: string): IPaywall[] | null;
|
|
2390
|
+
setActiveEntitlements(key: string, entitlements: IEntitlements[]): void;
|
|
2391
|
+
getActiveEntitlements(key: string): IEntitlements[];
|
|
2392
|
+
setNamiEntitlements(key: string, entitlements: NamiEntitlement[]): void;
|
|
2393
|
+
getNamiEntitlements(key: string): NamiEntitlement[];
|
|
2394
|
+
setProducts(key: string, products: SKU[]): void;
|
|
2395
|
+
getProducts(key: string): SKU[] | null;
|
|
2396
|
+
getCachedProducts(): SKU[] | null;
|
|
2397
|
+
setNamiConfig(config: Omit<NamiConfiguration, "initialConfig">): void;
|
|
2398
|
+
getNamiConfig(): Omit<NamiConfiguration, "initialConfig"> | null;
|
|
2399
|
+
setCustomerAttribute<T>(attribute: string, value: T): void;
|
|
2400
|
+
getCustomerAttribute<T>(attribute: string): T | null;
|
|
2401
|
+
getAllCustomerAttributes(): string[];
|
|
2402
|
+
getAllCustomerAttributesKeys(): string[];
|
|
2403
|
+
clearCustomerAttribute(attribute: string): boolean;
|
|
2404
|
+
clearAllCustomerAttributes(): void;
|
|
2405
|
+
setNamiProfile(profileData: NamiProfile): void;
|
|
2406
|
+
getNamiProfile(): NamiProfile | null;
|
|
2407
|
+
removeNamiProfile(): void;
|
|
2408
|
+
setCustomerJourneyState(state: CustomerJourneyState): void;
|
|
2409
|
+
getCustomerJourneyState(): CustomerJourneyState | null;
|
|
2410
|
+
setSessionCounter(): void;
|
|
2411
|
+
getSessionCounter(): number;
|
|
2412
|
+
setLastImpressionId(id: string): void;
|
|
2413
|
+
getLastImpressionId(): string;
|
|
2414
|
+
setPurchaseImpression(): void;
|
|
2415
|
+
getPurchaseImpression(): string;
|
|
2416
|
+
setSessionId(id?: string): void;
|
|
2417
|
+
getSessionId(): string;
|
|
2418
|
+
clearSessionId(): void;
|
|
2419
|
+
setLaunchId(id?: string): void;
|
|
2420
|
+
getLaunchId(): string;
|
|
2421
|
+
clearLaunchId(): void;
|
|
2422
|
+
setPurchaseChannel(channel?: string): void;
|
|
2423
|
+
getPurchaseChannel(): string | null;
|
|
2424
|
+
getAnonymousUUID(): string | null;
|
|
2425
|
+
setAnonymousUUID(uuid: string): void;
|
|
2426
|
+
clearAnonymousUUID(): void;
|
|
2427
|
+
setApiCampaignSessionTimestamp(): void;
|
|
2428
|
+
getApiCampaignSessionTimestamp(): number | null;
|
|
2429
|
+
purgeApiCampaignCache(): void;
|
|
2430
|
+
private getCampaignCacheTtl;
|
|
2431
|
+
private isLegacyTimestampedCache;
|
|
2253
2432
|
/**
|
|
2254
|
-
*
|
|
2255
|
-
*
|
|
2256
|
-
*
|
|
2257
|
-
* Only available for plans where Nami is not handling subscription & IAP management.
|
|
2258
|
-
*
|
|
2259
|
-
* @returns {Promise<void>} A Promise that resolves when buying SKU will be complete.
|
|
2433
|
+
* Set an item in localStorage.
|
|
2434
|
+
* @param {string} key - The key under which to store the data.
|
|
2435
|
+
* @param {T} value - The data to store.
|
|
2260
2436
|
*/
|
|
2261
|
-
|
|
2437
|
+
private setItem;
|
|
2262
2438
|
/**
|
|
2263
|
-
*
|
|
2264
|
-
*
|
|
2439
|
+
* Get an item from localStorage.
|
|
2440
|
+
* @param {string} key - The key of the item to retrieve.
|
|
2441
|
+
* @returns {T | null} The stored data, or null if not found.
|
|
2265
2442
|
*/
|
|
2266
|
-
|
|
2443
|
+
private getItem;
|
|
2267
2444
|
/**
|
|
2268
|
-
*
|
|
2269
|
-
* @param
|
|
2270
|
-
* @param name The name of the video
|
|
2445
|
+
* Remove an item from localStorage.
|
|
2446
|
+
* @param {string} key - The key of the item to remove.
|
|
2271
2447
|
*/
|
|
2272
|
-
|
|
2448
|
+
private resetItem;
|
|
2273
2449
|
/**
|
|
2274
|
-
*
|
|
2275
|
-
*
|
|
2276
|
-
* @param {boolean} allowed - Whether user interaction should be allowed.
|
|
2277
|
-
* @returns {void}
|
|
2450
|
+
* Clear all Nami-owned storage keys without touching host-app data.
|
|
2451
|
+
* Uses targeted key removal instead of localStorage.clear().
|
|
2278
2452
|
*/
|
|
2279
|
-
|
|
2453
|
+
clearAll(): void;
|
|
2280
2454
|
/**
|
|
2281
|
-
*
|
|
2455
|
+
* Clear all items from localStorage.
|
|
2282
2456
|
*/
|
|
2283
|
-
|
|
2457
|
+
clear(): void;
|
|
2284
2458
|
}
|
|
2459
|
+
declare const storageService: StorageService;
|
|
2285
2460
|
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
name: string;
|
|
2298
|
-
namiId: string;
|
|
2299
|
-
purchasedSkus: NamiSKU[];
|
|
2300
|
-
referenceId: string;
|
|
2301
|
-
relatedSkus: NamiSKU[];
|
|
2302
|
-
expires?: number;
|
|
2303
|
-
};
|
|
2304
|
-
type NamiActiveEntitlementsHandler = (entitlement: NamiEntitlement[]) => void;
|
|
2305
|
-
|
|
2306
|
-
/**
|
|
2307
|
-
* @class NamiEntitlementManager
|
|
2308
|
-
* Contains all methods and objects to work with entitlements in the SDK.
|
|
2309
|
-
*/
|
|
2310
|
-
declare class NamiEntitlementManager {
|
|
2311
|
-
static instance: NamiEntitlementManager;
|
|
2312
|
-
private emitter;
|
|
2313
|
-
/**
|
|
2314
|
-
* @returns {NamiEntitlement[]} A list of currently active entitlements
|
|
2315
|
-
*/
|
|
2316
|
-
static active(): NamiEntitlement[];
|
|
2317
|
-
/**
|
|
2318
|
-
* Checks if a Nami Control Center defined Entitlement has at least one backing purchase
|
|
2319
|
-
* and it's not expired.
|
|
2320
|
-
*
|
|
2321
|
-
* @param referenceId - entitlement referenceId
|
|
2322
|
-
* @returns {boolean} True if the entitlement is active for given referenceId, false otherwise.
|
|
2323
|
-
*/
|
|
2324
|
-
static isEntitlementActive(referenceId: string): boolean;
|
|
2325
|
-
/**
|
|
2326
|
-
* Asks Nami to fetch the latest active entitlements
|
|
2327
|
-
*
|
|
2328
|
-
* @returns {Promise<NamiEntitlement[]>} A promise that resolves to a list of NamiEntitlement
|
|
2329
|
-
*/
|
|
2330
|
-
static refresh(): Promise<NamiEntitlement[]>;
|
|
2331
|
-
/**
|
|
2332
|
-
* When there has been an update received to the active entitlements,
|
|
2333
|
-
* the Nami SDK will provide notification of that event through
|
|
2334
|
-
* this callback with list of active [NamiEntitlement]
|
|
2335
|
-
*
|
|
2336
|
-
* @param {NamiActiveEntitlementsHandler} handler - The callback function that will be invoked when the campaign list is updated.
|
|
2337
|
-
* @returns {Callback} A function that can be called to unregister the handler.
|
|
2338
|
-
*/
|
|
2339
|
-
static registerActiveEntitlementsHandler(handler: NamiActiveEntitlementsHandler): Callback$1 | undefined;
|
|
2340
|
-
/**
|
|
2341
|
-
* Clear any provisional entitlement grants, which are entitlements issued on-device only.
|
|
2342
|
-
* Useful for development and purchase testing. Not recommended to be called in production.
|
|
2343
|
-
*/
|
|
2344
|
-
static clearProvisionalEntitlementGrants(): void;
|
|
2345
|
-
/**
|
|
2346
|
-
* Private Instance Methods
|
|
2347
|
-
*/
|
|
2348
|
-
private get sdkInitialized();
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
declare class SimpleEventTarget implements EventTarget {
|
|
2352
|
-
private listeners;
|
|
2353
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
2354
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null): void;
|
|
2355
|
-
dispatchEvent(event: Event): boolean;
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
type Callback = () => void;
|
|
2359
|
-
declare const initialState: TPaywallContext;
|
|
2360
|
-
declare class PaywallState extends SimpleEventTarget {
|
|
2361
|
-
static providers: PaywallState[];
|
|
2362
|
-
state: TPaywallContext;
|
|
2363
|
-
subscribers: Set<Callback>;
|
|
2364
|
-
productDetails: NamiProductDetails[];
|
|
2365
|
-
flow?: NamiFlow;
|
|
2366
|
-
filteredSkuMenus: ISkuMenu[];
|
|
2367
|
-
static create(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign): PaywallState;
|
|
2368
|
-
static remove(provider: PaywallState): void;
|
|
2369
|
-
/**
|
|
2370
|
-
* Clear the static `providers` array. Called from `Nami.reset()` so
|
|
2371
|
-
* orphaned PaywallState instances from a previous SDK lifecycle don't
|
|
2372
|
-
* receive customer-attribute / login / product-detail updates intended
|
|
2373
|
-
* for the next configure() cycle.
|
|
2374
|
-
*/
|
|
2375
|
-
static reset(): void;
|
|
2376
|
-
static get currentProvider(): PaywallState | undefined;
|
|
2377
|
-
static setCustomerAttribute(attributes: {
|
|
2378
|
-
[key: string]: string;
|
|
2379
|
-
}): void;
|
|
2380
|
-
static removeCustomerAttribute(key: string): void;
|
|
2381
|
-
static setAppSuppliedVideoDetails(details: NamiAppSuppliedVideoDetails): void;
|
|
2382
|
-
static getSelectedPaywall(): IPaywall | undefined;
|
|
2383
|
-
static setUserInteractionEnabled(enabled: boolean): void;
|
|
2384
|
-
static setUserTags(tags: {
|
|
2385
|
-
[key: string]: string;
|
|
2386
|
-
}): void;
|
|
2387
|
-
static setProductDetails(details: NamiProductDetails[]): void;
|
|
2388
|
-
static setPurchaseInProgress(inProgress: boolean): void;
|
|
2389
|
-
static setIsLoggedIn(isLoggedIn: boolean): void;
|
|
2390
|
-
static setPurchase(inProgress: boolean, product?: NamiSKU): void;
|
|
2391
|
-
static getSelectedSlideIndex(): number | undefined;
|
|
2392
|
-
constructor(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign);
|
|
2393
|
-
protected onStateChanged(): void;
|
|
2394
|
-
subscribe(callback: Callback): Callback;
|
|
2395
|
-
unsubscribe(callback: Callback): void;
|
|
2396
|
-
emitEvent<T = any>(name: string, payload?: T): void;
|
|
2397
|
-
onEvent<T = any>(name: string, handler: (payload: T) => void): () => void;
|
|
2398
|
-
private setState;
|
|
2399
|
-
setProductDetails(details: NamiProductDetails[]): void;
|
|
2400
|
-
getProductDetails(): NamiProductDetails[];
|
|
2401
|
-
setCurrentGroupData(currentGroupId: string, currentGroupName: string): void;
|
|
2402
|
-
setFormState(formId: string, state: boolean | string): void;
|
|
2403
|
-
setTimerState(timerId: string, remainingSeconds: number, savedAt: number, hasEmittedCompletion: boolean): void;
|
|
2404
|
-
getTimerState(timerId: string): TimerState | undefined;
|
|
2405
|
-
getCurrentGroupId(): string;
|
|
2406
|
-
getCurrentGroupName(): string;
|
|
2407
|
-
setCurrentFormId(formId: string, value?: string): void;
|
|
2408
|
-
getCurrentFormId(formId: string): boolean | string;
|
|
2409
|
-
setSelectedProducts(products: {
|
|
2410
|
-
[currentGroupId: string]: string | null;
|
|
2411
|
-
}): void;
|
|
2412
|
-
selectedProducts(): {
|
|
2413
|
-
[currentGroupId: string]: string | null;
|
|
2414
|
-
};
|
|
2415
|
-
setPaywall(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign): void;
|
|
2416
|
-
getSelectedPaywall(): IPaywall | undefined;
|
|
2417
|
-
getSelectedCampaign(): NamiCampaign | undefined;
|
|
2418
|
-
getCurrentPlacementLabel(): string | null | undefined;
|
|
2419
|
-
getPaywallActionEventData(): Partial<NamiPaywallEvent>;
|
|
2420
|
-
paywallId(): string;
|
|
2421
|
-
setCurrentPage(page: string): void;
|
|
2422
|
-
canGoBackPage(): boolean;
|
|
2423
|
-
goBackPage(): boolean;
|
|
2424
|
-
setCustomerAttribute(attributes: {
|
|
2425
|
-
[key: string]: string;
|
|
2426
|
-
}): void;
|
|
2427
|
-
removeCustomerAttribute(key: string): void;
|
|
2428
|
-
setIsLoggedIn(isLoggedIn: boolean): void;
|
|
2429
|
-
setMediaList(media: TPaywallMedia[]): void;
|
|
2430
|
-
setSafeAreaTop(safeAreaTop: number): void;
|
|
2431
|
-
setFullScreenPresentation(fullScreenPresentation: boolean): void;
|
|
2432
|
-
setFormFactor(formFactor: TDevice): void;
|
|
2433
|
-
getFormFactor(): TDevice;
|
|
2434
|
-
setPurchaseInProgress(inProgress: boolean): void;
|
|
2435
|
-
setPurchase(inProgress: boolean, product?: NamiSKU): void;
|
|
2436
|
-
setTimeSpentOnPaywall(time: number): void;
|
|
2437
|
-
setAppSuppliedVideoDetails({ url, name }: NamiAppSuppliedVideoDetails): void;
|
|
2438
|
-
resetAppSuppliedVideoDetails(): void;
|
|
2439
|
-
setLaunchDetails(value: string, type?: string): void;
|
|
2440
|
-
setOpenHeaderIds(id: string, sku?: NamiSKU): void;
|
|
2441
|
-
getCurrentCollapsibleSku(): NamiSKU;
|
|
2442
|
-
setFlow(flow: NamiFlow): void;
|
|
2443
|
-
setUserInteractionEnabled(enabled: boolean): void;
|
|
2444
|
-
setUserTags(tags: {
|
|
2445
|
-
[key: string]: string;
|
|
2446
|
-
}): void;
|
|
2447
|
-
setCurrentSlideIndex(index: number): void;
|
|
2448
|
-
}
|
|
2449
|
-
|
|
2450
|
-
declare class StorageService {
|
|
2451
|
-
private memoryStore;
|
|
2452
|
-
private get storage();
|
|
2453
|
-
setDevice(device: Device): void;
|
|
2454
|
-
getDevice(): Device | null;
|
|
2455
|
-
resetDevice(): void;
|
|
2456
|
-
getAnonymousMode(): boolean;
|
|
2457
|
-
setAnonymousMode(mode: boolean): void;
|
|
2458
|
-
clearAnonymousMode(): void;
|
|
2459
|
-
setAppConfig(key: string, config: IConfig): void;
|
|
2460
|
-
getAppConfig(key: string): IConfig | null;
|
|
2461
|
-
setLanguageCode(code?: string): void;
|
|
2462
|
-
getLanguageCode(): string;
|
|
2463
|
-
setCampaignRules(key: string, campaignRules: NamiCampaign[]): void;
|
|
2464
|
-
getCampaignRules(key: string): NamiCampaign[] | null;
|
|
2465
|
-
setPaywalls(key: string, paywalls: IPaywall[]): void;
|
|
2466
|
-
getPaywalls(key: string): IPaywall[] | null;
|
|
2467
|
-
setActiveEntitlements(key: string, entitlements: IEntitlements[]): void;
|
|
2468
|
-
getActiveEntitlements(key: string): IEntitlements[];
|
|
2469
|
-
setNamiEntitlements(key: string, entitlements: NamiEntitlement[]): void;
|
|
2470
|
-
getNamiEntitlements(key: string): NamiEntitlement[];
|
|
2471
|
-
setProducts(key: string, products: SKU[]): void;
|
|
2472
|
-
getProducts(key: string): SKU[] | null;
|
|
2473
|
-
getCachedProducts(): SKU[] | null;
|
|
2474
|
-
setNamiConfig(config: Omit<NamiConfiguration, "initialConfig">): void;
|
|
2475
|
-
getNamiConfig(): Omit<NamiConfiguration, "initialConfig"> | null;
|
|
2476
|
-
setCustomerAttribute<T>(attribute: string, value: T): void;
|
|
2477
|
-
getCustomerAttribute<T>(attribute: string): T | null;
|
|
2478
|
-
getAllCustomerAttributes(): string[];
|
|
2479
|
-
getAllCustomerAttributesKeys(): string[];
|
|
2480
|
-
clearCustomerAttribute(attribute: string): boolean;
|
|
2481
|
-
clearAllCustomerAttributes(): void;
|
|
2482
|
-
setNamiProfile(profileData: NamiProfile): void;
|
|
2483
|
-
getNamiProfile(): NamiProfile | null;
|
|
2484
|
-
removeNamiProfile(): void;
|
|
2485
|
-
setCustomerJourneyState(state: CustomerJourneyState): void;
|
|
2486
|
-
getCustomerJourneyState(): CustomerJourneyState | null;
|
|
2487
|
-
setSessionCounter(): void;
|
|
2488
|
-
getSessionCounter(): number;
|
|
2489
|
-
setLastImpressionId(id: string): void;
|
|
2490
|
-
getLastImpressionId(): string;
|
|
2491
|
-
setPurchaseImpression(): void;
|
|
2492
|
-
getPurchaseImpression(): string;
|
|
2493
|
-
setSessionId(id?: string): void;
|
|
2494
|
-
getSessionId(): string;
|
|
2495
|
-
clearSessionId(): void;
|
|
2496
|
-
setLaunchId(id?: string): void;
|
|
2497
|
-
getLaunchId(): string;
|
|
2498
|
-
clearLaunchId(): void;
|
|
2499
|
-
setPurchaseChannel(channel?: string): void;
|
|
2500
|
-
getPurchaseChannel(): string | null;
|
|
2501
|
-
getAnonymousUUID(): string | null;
|
|
2502
|
-
setAnonymousUUID(uuid: string): void;
|
|
2503
|
-
clearAnonymousUUID(): void;
|
|
2504
|
-
setApiCampaignSessionTimestamp(): void;
|
|
2505
|
-
getApiCampaignSessionTimestamp(): number | null;
|
|
2506
|
-
purgeApiCampaignCache(): void;
|
|
2507
|
-
private getCampaignCacheTtl;
|
|
2508
|
-
private isLegacyTimestampedCache;
|
|
2509
|
-
/**
|
|
2510
|
-
* Set an item in localStorage.
|
|
2511
|
-
* @param {string} key - The key under which to store the data.
|
|
2512
|
-
* @param {T} value - The data to store.
|
|
2513
|
-
*/
|
|
2514
|
-
private setItem;
|
|
2515
|
-
/**
|
|
2516
|
-
* Get an item from localStorage.
|
|
2517
|
-
* @param {string} key - The key of the item to retrieve.
|
|
2518
|
-
* @returns {T | null} The stored data, or null if not found.
|
|
2519
|
-
*/
|
|
2520
|
-
private getItem;
|
|
2521
|
-
/**
|
|
2522
|
-
* Remove an item from localStorage.
|
|
2523
|
-
* @param {string} key - The key of the item to remove.
|
|
2524
|
-
*/
|
|
2525
|
-
private resetItem;
|
|
2526
|
-
/**
|
|
2527
|
-
* Clear all Nami-owned storage keys without touching host-app data.
|
|
2528
|
-
* Uses targeted key removal instead of localStorage.clear().
|
|
2529
|
-
*/
|
|
2530
|
-
clearAll(): void;
|
|
2531
|
-
/**
|
|
2532
|
-
* Clear all items from localStorage.
|
|
2533
|
-
*/
|
|
2534
|
-
clear(): void;
|
|
2535
|
-
}
|
|
2536
|
-
declare const storageService: StorageService;
|
|
2537
|
-
|
|
2538
|
-
declare class Logger {
|
|
2539
|
-
private currentLogLevel;
|
|
2540
|
-
setLogger: (level?: NamiLogLevel) => void;
|
|
2541
|
-
debug<T>(message: T, ...args: unknown[]): void;
|
|
2542
|
-
info<T>(message: T, ...args: unknown[]): void;
|
|
2543
|
-
warn<T>(message: T, ...args: unknown[]): void;
|
|
2544
|
-
error<T>(message: T, ...args: unknown[]): void;
|
|
2545
|
-
private shouldLog;
|
|
2546
|
-
private formatMessage;
|
|
2547
|
-
}
|
|
2548
|
-
declare const logger: Logger;
|
|
2461
|
+
declare class Logger {
|
|
2462
|
+
private currentLogLevel;
|
|
2463
|
+
setLogger: (level?: NamiLogLevel) => void;
|
|
2464
|
+
debug<T>(message: T, ...args: unknown[]): void;
|
|
2465
|
+
info<T>(message: T, ...args: unknown[]): void;
|
|
2466
|
+
warn<T>(message: T, ...args: unknown[]): void;
|
|
2467
|
+
error<T>(message: T, ...args: unknown[]): void;
|
|
2468
|
+
private shouldLog;
|
|
2469
|
+
private formatMessage;
|
|
2470
|
+
}
|
|
2471
|
+
declare const logger: Logger;
|
|
2549
2472
|
|
|
2550
2473
|
declare class SessionService {
|
|
2551
2474
|
static instance: SessionService;
|
|
@@ -2786,6 +2709,20 @@ declare function aggregateScreenreaderText(page: TPages, focusedButtonLabel?: st
|
|
|
2786
2709
|
*/
|
|
2787
2710
|
declare function getTranslate(key: string): string;
|
|
2788
2711
|
|
|
2712
|
+
declare class NamiEventEmitter {
|
|
2713
|
+
private static instance;
|
|
2714
|
+
private emitter;
|
|
2715
|
+
static getInstance(): NamiEventEmitter;
|
|
2716
|
+
on(eventName: string, listener: (...args: any[]) => void): void;
|
|
2717
|
+
off(eventName: string, listener: (...args: any[]) => void): void;
|
|
2718
|
+
emit(eventName: string, ...args: any[]): void;
|
|
2719
|
+
addListener(eventName: string, listener: (...args: any[]) => void): void;
|
|
2720
|
+
removeListener(eventName: string, listener: (...args: any[]) => void): void;
|
|
2721
|
+
removeAllListeners(eventName?: string): void;
|
|
2722
|
+
listeners(eventName: string): any[];
|
|
2723
|
+
listenerCount(eventName: string): number;
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2789
2726
|
declare class NamiAPI {
|
|
2790
2727
|
static instance: NamiAPI;
|
|
2791
2728
|
private baseURL;
|
|
@@ -2924,15 +2861,6 @@ declare const updateRelatedSKUsForNamiEntitlement: (entitlementRefId: string, en
|
|
|
2924
2861
|
}) => void;
|
|
2925
2862
|
declare function toNamiSKU(sku: PaywallSKU | SKU): NamiSKU;
|
|
2926
2863
|
|
|
2927
|
-
/**
|
|
2928
|
-
* @class NamiPurchaseManager
|
|
2929
|
-
* Provides methods for managing all aspects of a purchase in the Nami SDK.
|
|
2930
|
-
*/
|
|
2931
|
-
declare class NamiPurchaseManager {
|
|
2932
|
-
static instance: NamiPurchaseManager;
|
|
2933
|
-
static allPurchases(): NamiPurchase[];
|
|
2934
|
-
}
|
|
2935
|
-
|
|
2936
2864
|
declare function namiBuySKU(skuRefId: string): NamiPurchaseCompleteResult | undefined;
|
|
2937
2865
|
|
|
2938
2866
|
declare function currentSku(productDetails: NamiProductDetails[], initialState: TInitialState, skuMenus: ISkuMenu[], skus: PaywallSKU[]): {
|
|
@@ -3179,5 +3107,373 @@ declare const getBillingPeriodNumber: (billingPeriod: string) => number;
|
|
|
3179
3107
|
declare const formattedPrice: (price: number) => number;
|
|
3180
3108
|
declare function toDouble(num: number): number;
|
|
3181
3109
|
|
|
3182
|
-
|
|
3183
|
-
|
|
3110
|
+
/**
|
|
3111
|
+
* @class NamiCampaignManager
|
|
3112
|
+
* Provides methods for managing all aspects of a campaign.
|
|
3113
|
+
*/
|
|
3114
|
+
declare class NamiCampaignManager$1 {
|
|
3115
|
+
static instance: NamiCampaignManager$1;
|
|
3116
|
+
private emitter;
|
|
3117
|
+
/**
|
|
3118
|
+
* @returns {NamiCampaign[]} A list of NamiCampaign
|
|
3119
|
+
*/
|
|
3120
|
+
static allCampaigns(): NamiCampaign[];
|
|
3121
|
+
/**
|
|
3122
|
+
* Checks if a campaign is available for a given argument.
|
|
3123
|
+
* The argument can be a label string, or a deeplink URL.
|
|
3124
|
+
*
|
|
3125
|
+
* @param label - The argument to check. Can be a label string, or a deeplink URL.
|
|
3126
|
+
* @returns {boolean} True if the campaign is available, False otherwise.
|
|
3127
|
+
*/
|
|
3128
|
+
static isCampaignAvailable(label: string): boolean;
|
|
3129
|
+
/**
|
|
3130
|
+
* Checks if a campaign is a Flow campaign for a given argument.
|
|
3131
|
+
* The argument can be a label string, or a deeplink URL.
|
|
3132
|
+
*
|
|
3133
|
+
* @param label - The label of the campaign to check. Can be a label string.
|
|
3134
|
+
* @param withUrl - The deeplink URL of the campaign to check.
|
|
3135
|
+
* @returns {boolean} True if the campaign is a Flow campaign, False otherwise.
|
|
3136
|
+
*/
|
|
3137
|
+
static isFlow(label?: string, withUrl?: string): boolean;
|
|
3138
|
+
/**
|
|
3139
|
+
* Fetches the latest active campaigns for the current device.
|
|
3140
|
+
*
|
|
3141
|
+
* @returns {Promise<NamiCampaign[]>} A promise that resolves to a list of active campaigns.
|
|
3142
|
+
*/
|
|
3143
|
+
static refresh(): Promise<NamiCampaign[]>;
|
|
3144
|
+
/**
|
|
3145
|
+
* Registers a handler that will be called whenever there is an update
|
|
3146
|
+
* in the list of active campaigns. The Nami SDK will trigger this callback
|
|
3147
|
+
* with the updated list of active campaigns.
|
|
3148
|
+
*
|
|
3149
|
+
* The handler will receive an array of `NamiCampaign` objects representing
|
|
3150
|
+
* the current active campaigns.
|
|
3151
|
+
*
|
|
3152
|
+
* @param {AvailableCampaignsResponseHandler} handler - The callback function that will be invoked when the campaign list is updated.
|
|
3153
|
+
* @returns {Callback} A function that can be called to unregister the handler.
|
|
3154
|
+
*/
|
|
3155
|
+
static registerAvailableCampaignsHandler(handler: AvailableCampaignsResponseHandler): Callback$1;
|
|
3156
|
+
/**
|
|
3157
|
+
* Launches a campaign with a given label.
|
|
3158
|
+
* @param label - The label of the campaign to launch.
|
|
3159
|
+
* @param withUrl - The deeplink URL of the campaign to launch.
|
|
3160
|
+
* @param actionCallback - Optional handler for paywall actions.
|
|
3161
|
+
* @returns {PaywallHandle | void} The launched paywall handle (platform-specific).
|
|
3162
|
+
*/
|
|
3163
|
+
static launch(label?: string, withUrl?: string, context?: NamiPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallHandle;
|
|
3164
|
+
/**
|
|
3165
|
+
* Provide the list of product groups supported by the provided placement label or URL.
|
|
3166
|
+
* @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
|
|
3167
|
+
* @param uri Campaign placement URI defined in Nami Control Center for launching a specific campaign.
|
|
3168
|
+
* @return List of product groups associated with the specified campaign placement.
|
|
3169
|
+
*/
|
|
3170
|
+
static getProductGroups(label?: string, withUrl?: string): string[];
|
|
3171
|
+
/**
|
|
3172
|
+
* Get all product SKUs associated with the provided placement label or URL.
|
|
3173
|
+
* @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
|
|
3174
|
+
* @param withUrl Campaign placement URI defined in Nami Control Center for launching a specific campaign.
|
|
3175
|
+
* @returns List of product SKUs associated with the specified campaign placement.
|
|
3176
|
+
*/
|
|
3177
|
+
static getAllProducts(label?: string, withUrl?: string): string[];
|
|
3178
|
+
/**
|
|
3179
|
+
* Get the list of currently active product SKUs associated with the provided placement label or URL.
|
|
3180
|
+
* @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
|
|
3181
|
+
* @param withUrl Campaign placement URI defined in Nami Control Center for launching a specific campaign.
|
|
3182
|
+
* @returns List of current product SKUs associated with the specified campaign placement.
|
|
3183
|
+
*/
|
|
3184
|
+
static getCurrentProducts(label?: string, withUrl?: string): string[];
|
|
3185
|
+
/**
|
|
3186
|
+
* Private Instance Methods
|
|
3187
|
+
*/
|
|
3188
|
+
private get sdkInitialized();
|
|
3189
|
+
private campaignTypeAndLabel;
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
type AccountStateHandler = (action: AccountStateAction, success: boolean, error?: Error) => void;
|
|
3193
|
+
/**
|
|
3194
|
+
* @class NamiCustomerManager
|
|
3195
|
+
* Provides methods for managing customer-related functionality.
|
|
3196
|
+
*/
|
|
3197
|
+
declare class NamiCustomerManager$1 {
|
|
3198
|
+
static instance: NamiCustomerManager$1;
|
|
3199
|
+
private emitter;
|
|
3200
|
+
constructor();
|
|
3201
|
+
/**
|
|
3202
|
+
* Checks if the customer is logged in.
|
|
3203
|
+
*
|
|
3204
|
+
* @returns {boolean} Returns true if the customer is logged in, false otherwise.
|
|
3205
|
+
*/
|
|
3206
|
+
static isLoggedIn(): boolean;
|
|
3207
|
+
/**
|
|
3208
|
+
* Returns the external ID of the currently logged in user.
|
|
3209
|
+
*
|
|
3210
|
+
* @returns {string | undefined} The external ID of the logged in user.
|
|
3211
|
+
*/
|
|
3212
|
+
static loggedInId(): string | undefined;
|
|
3213
|
+
/**
|
|
3214
|
+
* Logs in a customer with the specified ID.
|
|
3215
|
+
*
|
|
3216
|
+
* @param id - The ID of the customer to log in. Must be a SHA256 hash or UUID.
|
|
3217
|
+
* @returns {Promise<void>} A Promise that resolves when the login is successful.
|
|
3218
|
+
*/
|
|
3219
|
+
static login(externalId: string): Promise<void>;
|
|
3220
|
+
/**
|
|
3221
|
+
* This method detaches the whole platform account from the signed in user
|
|
3222
|
+
* @returns {Promise<void>} A Promise that resolves when the logout is successful.
|
|
3223
|
+
*/
|
|
3224
|
+
static logout(): Promise<void>;
|
|
3225
|
+
/**
|
|
3226
|
+
* This method for connecting the device to a Customer Data Platform identifier
|
|
3227
|
+
*
|
|
3228
|
+
* Advanced use case. Make sure you have user consent.
|
|
3229
|
+
*
|
|
3230
|
+
* @param id a value supplied from your CDP platform
|
|
3231
|
+
* @returns {Promise<void>} A Promise that resolves when CustomerDataPlatformId will be set.
|
|
3232
|
+
*/
|
|
3233
|
+
static setCustomerDataPlatformId(id: string): Promise<void>;
|
|
3234
|
+
/**
|
|
3235
|
+
* This method for clearing the Customer Data Platform identifier linked to this device
|
|
3236
|
+
*
|
|
3237
|
+
* Advanced use case.
|
|
3238
|
+
* @returns {Promise<void>} A Promise that resolves when CustomerDataPlatformId will be cleared.
|
|
3239
|
+
*/
|
|
3240
|
+
static clearCustomerDataPlatformId(): Promise<void>;
|
|
3241
|
+
/**
|
|
3242
|
+
* Registers a callback function to handle changes in the account state.
|
|
3243
|
+
*
|
|
3244
|
+
* @param callback - The callback function to be registered.
|
|
3245
|
+
* @returns {Callback} A function that can be used to unregister the original callback.
|
|
3246
|
+
*/
|
|
3247
|
+
static registerAccountStateHandler(handler: AccountStateHandler): Callback$1;
|
|
3248
|
+
/**
|
|
3249
|
+
* Sets the anonymous mode for the customer.
|
|
3250
|
+
*
|
|
3251
|
+
* @param enabled - A boolean value indicating whether the anonymous mode should be enabled or disabled.
|
|
3252
|
+
* @returns {Promise<void>} A Promise that resolves when the anonymous mode is set.
|
|
3253
|
+
*/
|
|
3254
|
+
static setAnonymousMode(enabled: boolean): Promise<void>;
|
|
3255
|
+
/**
|
|
3256
|
+
* @returns {boolean} whether or not the SDK is currently operating in anonymous mode
|
|
3257
|
+
*/
|
|
3258
|
+
static inAnonymousMode(): boolean;
|
|
3259
|
+
/**
|
|
3260
|
+
* Sets an optional customer attributes that can be used to personalize your Nami paywalls.
|
|
3261
|
+
*
|
|
3262
|
+
* @param key - The name of the attribute. For example: `firstName`.
|
|
3263
|
+
* @param value - The value of the customer attribute. For example: `Joe`.
|
|
3264
|
+
*/
|
|
3265
|
+
static setCustomerAttribute(key: string, value: string): void;
|
|
3266
|
+
/**
|
|
3267
|
+
* Retrieves the value for a given key in the on-device customer attribute key/value store.
|
|
3268
|
+
*
|
|
3269
|
+
* @param key - The name of the attribute. For example: `firstName`
|
|
3270
|
+
* @returns {string | null} The value of the customer attribute.
|
|
3271
|
+
*/
|
|
3272
|
+
static getCustomerAttribute(key: string): string | null;
|
|
3273
|
+
/**
|
|
3274
|
+
* Retrieves all the customer attribute key/value store.
|
|
3275
|
+
*
|
|
3276
|
+
* @returns {string | null} The value of the customer attribute.
|
|
3277
|
+
*/
|
|
3278
|
+
static getAllCustomerAttributes(): string[];
|
|
3279
|
+
/**
|
|
3280
|
+
* Clears a value of the given key in the on-device key/value store.
|
|
3281
|
+
*
|
|
3282
|
+
* @param key - The key of the customer attribute to clear.
|
|
3283
|
+
*/
|
|
3284
|
+
static clearCustomerAttribute(key: string): void;
|
|
3285
|
+
/**
|
|
3286
|
+
* Clear all customer attributes from the on-device key/value store.
|
|
3287
|
+
*/
|
|
3288
|
+
static clearAllCustomerAttributes(): void;
|
|
3289
|
+
/**
|
|
3290
|
+
* @return current customer's journey state.
|
|
3291
|
+
*/
|
|
3292
|
+
static journeyState(): CustomerJourneyState | null;
|
|
3293
|
+
/**
|
|
3294
|
+
* @return the unique identifier Nami users to identify this device. Please note
|
|
3295
|
+
* you should not depend on the device identifier persisting across app re-installs.
|
|
3296
|
+
*/
|
|
3297
|
+
static deviceId(): string;
|
|
3298
|
+
/**
|
|
3299
|
+
* When there has been an update received to the active entitlements,
|
|
3300
|
+
* the Nami SDK will provide notification of that event through
|
|
3301
|
+
* this callback with list of active [NamiEntitlement]
|
|
3302
|
+
*
|
|
3303
|
+
* @param {NamiCustomerJourneyStateHandler} handler - The callback function that will be invoked when the campaign list is updated.
|
|
3304
|
+
* @returns {Callback} A function that can be called to unregister the handler.
|
|
3305
|
+
*/
|
|
3306
|
+
static registerJourneyStateHandler(handler: NamiCustomerJourneyStateHandler): Callback$1 | undefined;
|
|
3307
|
+
/**
|
|
3308
|
+
* Private Static Methods
|
|
3309
|
+
*/
|
|
3310
|
+
private static invokeStateHandler;
|
|
3311
|
+
/**
|
|
3312
|
+
* Private Instance Methods
|
|
3313
|
+
*/
|
|
3314
|
+
private get isSDKInitialized();
|
|
3315
|
+
private static updateCustomerDataPlatformId;
|
|
3316
|
+
/**
|
|
3317
|
+
* @returns whether or not the configured app platform id belongs to an anonymous mode
|
|
3318
|
+
* capable Nami account.
|
|
3319
|
+
*/
|
|
3320
|
+
private static anonymousModeCapability;
|
|
3321
|
+
private static refetchConfig;
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
/**
|
|
3325
|
+
* @class NamiPaywallManager
|
|
3326
|
+
* Provides methods for managing all aspects of a paywall in the Nami SDK.
|
|
3327
|
+
*/
|
|
3328
|
+
declare class NamiPaywallManager$1 {
|
|
3329
|
+
static instance: NamiPaywallManager$1;
|
|
3330
|
+
static emitter: NamiEventEmitter;
|
|
3331
|
+
private emitter;
|
|
3332
|
+
productDetails: NamiProductDetails[];
|
|
3333
|
+
/**
|
|
3334
|
+
* @returns {IPaywall[]} a list of Paywall
|
|
3335
|
+
*/
|
|
3336
|
+
static allPaywalls(): IPaywall[];
|
|
3337
|
+
/**
|
|
3338
|
+
* Used to set product details when store products are unavailable. For advanced use cases only.
|
|
3339
|
+
*/
|
|
3340
|
+
static setProductDetails(productDetails: NamiProductDetails[]): void;
|
|
3341
|
+
/**
|
|
3342
|
+
* Register a callback which would be invoked when user will sign-in
|
|
3343
|
+
*/
|
|
3344
|
+
static registerSignInHandler(handler: Callback$1): Callback$1;
|
|
3345
|
+
/**
|
|
3346
|
+
* Register a callback which would be invoked when user close a paywall raised by Nami system
|
|
3347
|
+
*/
|
|
3348
|
+
static registerCloseHandler(handler: CloseHandler): Callback$1;
|
|
3349
|
+
/**
|
|
3350
|
+
* Register a callback which would be invoked when user will take action on deeplink
|
|
3351
|
+
*/
|
|
3352
|
+
static registerDeeplinkActionHandler(handler: DeepLinkUrlHandler): Callback$1;
|
|
3353
|
+
/**
|
|
3354
|
+
* Register a [NamiBuySkuHandler] which would be invoked when a user triggers
|
|
3355
|
+
* a buy sku action on a paywall.
|
|
3356
|
+
*
|
|
3357
|
+
* Only available for plans where Nami is not handling subscription & IAP management.
|
|
3358
|
+
*/
|
|
3359
|
+
static registerBuySkuHandler(handler: SKUActionHandler): Callback$1;
|
|
3360
|
+
/**
|
|
3361
|
+
* Register a callback which would be invoked when user restore a product
|
|
3362
|
+
*/
|
|
3363
|
+
static registerRestoreHandler(handler: Callback$1): Callback$1;
|
|
3364
|
+
/**
|
|
3365
|
+
* Notify the NamiPaywallManager that a purchase initiated from the
|
|
3366
|
+
* [NamiBuySkuHandler] is complete.
|
|
3367
|
+
*
|
|
3368
|
+
* Only available for plans where Nami is not handling subscription & IAP management.
|
|
3369
|
+
*
|
|
3370
|
+
* @returns {Promise<void>} A Promise that resolves when buying SKU will be complete.
|
|
3371
|
+
*/
|
|
3372
|
+
static buySkuComplete(purchase: NamiPurchaseDetails): Promise<void>;
|
|
3373
|
+
/**
|
|
3374
|
+
* Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
|
|
3375
|
+
* Used to disable product purchase-in-progress loading indicators
|
|
3376
|
+
*/
|
|
3377
|
+
static buySkuCancel(): void;
|
|
3378
|
+
/**
|
|
3379
|
+
* Set the video details for the app supplied video
|
|
3380
|
+
* @param url The URL of the video
|
|
3381
|
+
* @param name The name of the video
|
|
3382
|
+
*/
|
|
3383
|
+
static setAppSuppliedVideoDetails(url: string, name?: string): void;
|
|
3384
|
+
/**
|
|
3385
|
+
* Enables or disables user interaction on Nami paywalls.
|
|
3386
|
+
*
|
|
3387
|
+
* @param {boolean} allowed - Whether user interaction should be allowed.
|
|
3388
|
+
* @returns {void}
|
|
3389
|
+
*/
|
|
3390
|
+
static allowUserInteraction(allowed: boolean): void;
|
|
3391
|
+
/**
|
|
3392
|
+
* Private Instance Methods
|
|
3393
|
+
*/
|
|
3394
|
+
private get sdkInitialized();
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
/**
|
|
3398
|
+
* @class NamiEntitlementManager
|
|
3399
|
+
* Contains all methods and objects to work with entitlements in the SDK.
|
|
3400
|
+
*/
|
|
3401
|
+
declare class NamiEntitlementManager$1 {
|
|
3402
|
+
static instance: NamiEntitlementManager$1;
|
|
3403
|
+
private emitter;
|
|
3404
|
+
/**
|
|
3405
|
+
* @returns {NamiEntitlement[]} A list of currently active entitlements
|
|
3406
|
+
*/
|
|
3407
|
+
static active(): NamiEntitlement[];
|
|
3408
|
+
/**
|
|
3409
|
+
* Checks if a Nami Control Center defined Entitlement has at least one backing purchase
|
|
3410
|
+
* and it's not expired.
|
|
3411
|
+
*
|
|
3412
|
+
* @param referenceId - entitlement referenceId
|
|
3413
|
+
* @returns {boolean} True if the entitlement is active for given referenceId, false otherwise.
|
|
3414
|
+
*/
|
|
3415
|
+
static isEntitlementActive(referenceId: string): boolean;
|
|
3416
|
+
/**
|
|
3417
|
+
* Asks Nami to fetch the latest active entitlements
|
|
3418
|
+
*
|
|
3419
|
+
* @returns {Promise<NamiEntitlement[]>} A promise that resolves to a list of NamiEntitlement
|
|
3420
|
+
*/
|
|
3421
|
+
static refresh(): Promise<NamiEntitlement[]>;
|
|
3422
|
+
/**
|
|
3423
|
+
* When there has been an update received to the active entitlements,
|
|
3424
|
+
* the Nami SDK will provide notification of that event through
|
|
3425
|
+
* this callback with list of active [NamiEntitlement]
|
|
3426
|
+
*
|
|
3427
|
+
* @param {NamiActiveEntitlementsHandler} handler - The callback function that will be invoked when the campaign list is updated.
|
|
3428
|
+
* @returns {Callback} A function that can be called to unregister the handler.
|
|
3429
|
+
*/
|
|
3430
|
+
static registerActiveEntitlementsHandler(handler: NamiActiveEntitlementsHandler): Callback$1 | undefined;
|
|
3431
|
+
/**
|
|
3432
|
+
* Clear any provisional entitlement grants, which are entitlements issued on-device only.
|
|
3433
|
+
* Useful for development and purchase testing. Not recommended to be called in production.
|
|
3434
|
+
*/
|
|
3435
|
+
static clearProvisionalEntitlementGrants(): void;
|
|
3436
|
+
/**
|
|
3437
|
+
* Private Instance Methods
|
|
3438
|
+
*/
|
|
3439
|
+
private get sdkInitialized();
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
/**
|
|
3443
|
+
* @class NamiPurchaseManager
|
|
3444
|
+
* Provides methods for managing all aspects of a purchase in the Nami SDK.
|
|
3445
|
+
*/
|
|
3446
|
+
declare class NamiPurchaseManager$1 {
|
|
3447
|
+
static instance: NamiPurchaseManager$1;
|
|
3448
|
+
static allPurchases(): NamiPurchase[];
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
declare const NamiCampaignManager: typeof NamiCampaignManager$1;
|
|
3452
|
+
declare const NamiCustomerManager: typeof NamiCustomerManager$1;
|
|
3453
|
+
declare const NamiPaywallManager: typeof NamiPaywallManager$1;
|
|
3454
|
+
declare const NamiEntitlementManager: typeof NamiEntitlementManager$1;
|
|
3455
|
+
declare const NamiFlowManager: typeof NamiFlowManager$2;
|
|
3456
|
+
declare const NamiPurchaseManager: typeof NamiPurchaseManager$1;
|
|
3457
|
+
declare const NamiProfileManager: typeof NamiProfileManager$1;
|
|
3458
|
+
|
|
3459
|
+
declare const internal_NamiCampaignManager: typeof NamiCampaignManager;
|
|
3460
|
+
declare const internal_NamiCustomerManager: typeof NamiCustomerManager;
|
|
3461
|
+
declare const internal_NamiEntitlementManager: typeof NamiEntitlementManager;
|
|
3462
|
+
declare const internal_NamiFlowManager: typeof NamiFlowManager;
|
|
3463
|
+
declare const internal_NamiPaywallManager: typeof NamiPaywallManager;
|
|
3464
|
+
declare const internal_NamiProfileManager: typeof NamiProfileManager;
|
|
3465
|
+
declare const internal_NamiPurchaseManager: typeof NamiPurchaseManager;
|
|
3466
|
+
declare namespace internal {
|
|
3467
|
+
export {
|
|
3468
|
+
internal_NamiCampaignManager as NamiCampaignManager,
|
|
3469
|
+
internal_NamiCustomerManager as NamiCustomerManager,
|
|
3470
|
+
internal_NamiEntitlementManager as NamiEntitlementManager,
|
|
3471
|
+
internal_NamiFlowManager as NamiFlowManager,
|
|
3472
|
+
internal_NamiPaywallManager as NamiPaywallManager,
|
|
3473
|
+
internal_NamiProfileManager as NamiProfileManager,
|
|
3474
|
+
internal_NamiPurchaseManager as NamiPurchaseManager,
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3478
|
+
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_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, 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, NamiPaywallAction, NamiPaywallManager$2 as NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, 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, 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, coerceBooleanish, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, empty, extractStandardPricingPhases, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, 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, registerPlatformAdapters, registerPurchaseAdapter, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateMinSDKVersion };
|
|
3479
|
+
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, GoogleProduct, IConfig, IDeviceAdapter, IEntitlements$1 as IEntitlements, IPaywall, IPlatformAdapters, IProductsWithComponents, IPurchaseAdapter, ISkuMenu, IStorageAdapter, IUIAdapter, Impression, InitialConfig, InitialConfigCompressed, InitiateStateGroup, LoginResponse, NamiAnimation, NamiAnimationObjectSpec, NamiAnimationSpec, NamiAnonymousCampaign, NamiAppSuppliedVideoDetails, NamiCampaign, NamiCampaignManagerStatic, NamiCampaignSegment, NamiConfiguration, NamiConfigurationState, NamiCustomAttributeValue, NamiCustomerManagerStatic, NamiEntitlement$1 as NamiEntitlement, NamiEntitlementManagerStatic, NamiFlowAction, NamiFlowAnimation, NamiFlowCampaign, NamiFlowDTO, NamiFlowEventHandler, NamiFlowHandoffStepHandler, NamiFlowManagerStatic, NamiFlowObjectDTO, NamiFlowOn, NamiFlowStep, NamiFlowTransition, NamiFlowTransitionDirection, NamiFlowWithObject, NamiInitialConfig, NamiLanguageCodes, NamiLogLevel, NamiPaywallActionHandler, NamiPaywallComponentChange, NamiPaywallEvent, NamiPaywallEventVideoMetadata, NamiPaywallLaunchContext, NamiPaywallManagerStatic, NamiPresentationStyle, NamiProductDetails, NamiProductOffer, NamiProfile, NamiPurchase, NamiPurchaseCompleteResult, NamiPurchaseDetails, NamiPurchaseManagerStatic, NamiPurchasesState, NamiSKU, NamiSKUType, NamiSubscriptionInterval, NamiSubscriptionPeriod, 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, TSpacerComponent, TStack, TSvgImageComponent, TSymbolComponent, TTestObject, TTextComponent, TTextLikeComponent, TTextListComponent, TToggleButtonComponent, TToggleSwitch, TVariablePattern, TVideoComponent, TVolumeButton, TimerState, TransactionRequest, UserAction, UserActionParameters, Wave, WaveSpec };
|