@namiml/web-sdk 1.0.0 → 1.2.0
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/CHANGELOG.md +33 -2
- package/dist/components/ContextConsumer.d.ts +11 -0
- package/dist/components/ContextProvider.d.ts +45 -0
- package/dist/components/NamiElement.d.ts +10 -0
- package/dist/components/Paywall.d.ts +17 -0
- package/dist/components/TemplateComponent.d.ts +2 -0
- package/dist/components/containers/BackgroundContainer.d.ts +10 -0
- package/dist/components/containers/Container.d.ts +10 -0
- package/dist/components/containers/Content.d.ts +10 -0
- package/dist/components/containers/Footer.d.ts +10 -0
- package/dist/components/containers/Header.d.ts +11 -0
- package/dist/components/containers/ProductContainer.d.ts +10 -0
- package/dist/components/elements/Button.d.ts +11 -0
- package/dist/components/elements/Image.d.ts +9 -0
- package/dist/components/elements/SegmentPicker.d.ts +11 -0
- package/dist/components/elements/SegmentPickerItem.d.ts +15 -0
- package/dist/components/elements/Spacer.d.ts +9 -0
- package/dist/components/elements/Text.d.ts +27 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/productDetails.d.ts +3 -0
- package/dist/components/styles/reset.d.ts +2 -0
- package/dist/components/utils/actionTap.d.ts +13 -0
- package/dist/components/utils/eventConst.d.ts +5 -0
- package/dist/components/utils/helpers.d.ts +17 -0
- package/dist/components/utils/iconMap.d.ts +1 -0
- package/dist/components/utils/impression.d.ts +4 -0
- package/dist/components/utils/products.d.ts +18 -0
- package/dist/components/utils/state.d.ts +13 -0
- package/dist/components/utils/styles.d.ts +21 -0
- package/dist/core/errors.d.ts +46 -0
- package/dist/core/withRetry.d.ts +1 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/nami/api.d.ts +20 -0
- package/dist/nami/campaign.d.ts +47 -0
- package/dist/nami/customer.d.ts +91 -0
- package/dist/nami/emitter.d.ts +12 -0
- package/dist/nami/index.d.ts +9 -0
- package/dist/nami/namiRefs.d.ts +7 -0
- package/dist/nami/paywalls.d.ts +31 -0
- package/dist/nami/profile.d.ts +12 -0
- package/dist/nami/utils/purchase.d.ts +3 -0
- package/dist/nami-web.cjs +18 -20
- package/dist/nami-web.d.ts +193 -114
- package/dist/nami-web.js +18 -20
- package/dist/nami-web.mjs +18 -20
- package/dist/nami-web.umd.js +15 -17
- package/dist/repositories/campaignRule.repository.d.ts +13 -0
- package/dist/repositories/config.repository.d.ts +5 -0
- package/dist/repositories/device.repository.d.ts +10 -0
- package/dist/repositories/paywall.repository.d.ts +8 -0
- package/dist/repositories/products.repository.d.ts +6 -0
- package/dist/services/logger.service.d.ts +13 -0
- package/dist/services/session.service.d.ts +4 -0
- package/dist/services/storage.service.d.ts +61 -0
- package/dist/types/api.d.ts +28 -0
- package/dist/types/campaign.d.ts +21 -0
- package/dist/types/components/containers.d.ts +67 -0
- package/dist/types/components/elements.d.ts +79 -0
- package/dist/types/components/index.d.ts +117 -0
- package/dist/types/config.d.ts +43 -0
- package/dist/types/device.d.ts +35 -0
- package/dist/types/errors.d.ts +11 -0
- package/dist/types/languages.d.ts +1 -0
- package/dist/types/loglevel.d.ts +7 -0
- package/dist/types/paywall.d.ts +222 -0
- package/dist/types/products.d.ts +34 -0
- package/dist/types/profile.d.ts +20 -0
- package/dist/types/purchase.d.ts +45 -0
- package/dist/types/sku.d.ts +35 -0
- package/dist/types/utils.d.ts +1 -0
- package/dist/utils/config.d.ts +5 -0
- package/dist/utils/const.d.ts +1 -0
- package/dist/utils/device.d.ts +3 -0
- package/dist/utils/events.d.ts +30 -0
- package/dist/utils/fonts.d.ts +7 -0
- package/dist/utils/ssr-shim.d.ts +1 -0
- package/package.json +18 -7
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Callback } from "src/types/components/containers";
|
|
2
|
+
import { AccountStateAction } from "src/types/profile";
|
|
3
|
+
type AccountStateHandler = (action: AccountStateAction, success: boolean, error?: Error) => void;
|
|
4
|
+
/**
|
|
5
|
+
* NamiCustomerManager provides methods for managing customer-related functionality.
|
|
6
|
+
*/
|
|
7
|
+
export declare class NamiCustomerManager {
|
|
8
|
+
static instance: NamiCustomerManager;
|
|
9
|
+
private emitter;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the customer is logged in.
|
|
12
|
+
*
|
|
13
|
+
* @returns {boolean} Returns true if the customer is logged in, false otherwise.
|
|
14
|
+
*/
|
|
15
|
+
static isLoggedIn(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the external ID of the currently logged in user.
|
|
18
|
+
*
|
|
19
|
+
* @returns The external ID of the logged in user.
|
|
20
|
+
*/
|
|
21
|
+
static loggedInId(): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Logs in a customer with the specified ID.
|
|
24
|
+
*
|
|
25
|
+
* @param id - The ID of the customer to log in. Must be a SHA256 hash or UUID.
|
|
26
|
+
* @returns A Promise that resolves when the login is successful.
|
|
27
|
+
*/
|
|
28
|
+
static login(externalId: string): Promise<void>;
|
|
29
|
+
static logout(): Promise<void>;
|
|
30
|
+
static setCustomerDataPlatformId(id: string): Promise<void>;
|
|
31
|
+
static clearCustomerDataPlatformId(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Registers a callback function to handle changes in the account state.
|
|
34
|
+
*
|
|
35
|
+
* @param callback - The callback function to be registered.
|
|
36
|
+
* @returns A function that can be used to unregister the original callback.
|
|
37
|
+
*/
|
|
38
|
+
static registerAccountStateHandler(callback: AccountStateHandler): Callback;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the anonymous mode for the customer.
|
|
41
|
+
*
|
|
42
|
+
* @param enabled - A boolean value indicating whether the anonymous mode should be enabled or disabled.
|
|
43
|
+
* @returns A Promise that resolves when the anonymous mode is set.
|
|
44
|
+
*/
|
|
45
|
+
static setAnonymousMode(enabled: boolean): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns whether or not the SDK is currently operating in anonymous mode
|
|
48
|
+
*/
|
|
49
|
+
static inAnonymousMode(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Sets an optional customer attributes that can be used to personalize your Nami paywalls.
|
|
52
|
+
*
|
|
53
|
+
* @param key - The name of the attribute. For example: `firstName`.
|
|
54
|
+
* @param value - The value of the customer attribute. For example: `Joe`.
|
|
55
|
+
*/
|
|
56
|
+
static setCustomerAttribute(key: string, value: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Retrieves the value for a given key in the on-device customer attribute key/value store.
|
|
59
|
+
*
|
|
60
|
+
* @param key - The name of the attribute. For example: `firstName`
|
|
61
|
+
* @returns The value of the customer attribute.
|
|
62
|
+
*/
|
|
63
|
+
static getCustomerAttribute(key: string): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Clears a value of the given key in the on-device key/value store.
|
|
66
|
+
*
|
|
67
|
+
* @param key - The key of the customer attribute to clear.
|
|
68
|
+
*/
|
|
69
|
+
static clearCustomerAttribute(key: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Clear all customer attributes from the on-device key/value store.
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
static clearAllCustomerAttributes(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Private Static Methods
|
|
77
|
+
*/
|
|
78
|
+
private static invokeStateHandler;
|
|
79
|
+
/**
|
|
80
|
+
* Private Instance Methods
|
|
81
|
+
*/
|
|
82
|
+
private get isSDKInitialized();
|
|
83
|
+
private static updateCustomerDataPlatformId;
|
|
84
|
+
/**
|
|
85
|
+
* Returns whether or not the configured app platform id belongs to an anonymous mode
|
|
86
|
+
* capable Nami account.
|
|
87
|
+
*/
|
|
88
|
+
private static anonymousModeCapability;
|
|
89
|
+
private static refetchConfig;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class NamiEventEmitter {
|
|
2
|
+
private static instance;
|
|
3
|
+
private emitter;
|
|
4
|
+
static getInstance(): NamiEventEmitter;
|
|
5
|
+
on(eventName: string, listener: (...args: any[]) => void): void;
|
|
6
|
+
off(eventName: string, listener: (...args: any[]) => void): void;
|
|
7
|
+
emit(eventName: string, ...args: any[]): void;
|
|
8
|
+
addListener(eventName: string, listener: (...args: any[]) => void): void;
|
|
9
|
+
removeListener(eventName: string, listener: (...args: any[]) => void): void;
|
|
10
|
+
listeners(eventName: string): any[];
|
|
11
|
+
listenerCount(eventName: string): number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NamiConfiguration, NamiConfigurationState } from "src/types/config";
|
|
2
|
+
export declare class Nami {
|
|
3
|
+
#private;
|
|
4
|
+
static instance: Nami;
|
|
5
|
+
get isInitialized(): boolean;
|
|
6
|
+
static configure(options: NamiConfiguration): Promise<NamiConfigurationState>;
|
|
7
|
+
private static setInitialConfig;
|
|
8
|
+
private initializeSDK;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IPaywall } from "src/types/paywall";
|
|
2
|
+
import { NamiProductDetails } from "src/types/products";
|
|
3
|
+
import { Callback } from "src/types/components/containers";
|
|
4
|
+
import { Purchase } from "src/types/purchase";
|
|
5
|
+
export declare class NamiPaywallManager {
|
|
6
|
+
static instance: NamiPaywallManager;
|
|
7
|
+
private emitter;
|
|
8
|
+
productDetails: NamiProductDetails[];
|
|
9
|
+
static allPaywalls(): IPaywall[];
|
|
10
|
+
static setProductDetails(productDetails: NamiProductDetails[]): void;
|
|
11
|
+
static registerSignInHandler(handler: Callback): Callback;
|
|
12
|
+
static registerCloseHandler(handler: Callback): Callback;
|
|
13
|
+
static registerDeeplinkActionHandler(handler: Callback): Callback;
|
|
14
|
+
static registerBuySkuHandler(handler: Callback): Callback;
|
|
15
|
+
static registerRestoreHandler(handler: Callback): Callback;
|
|
16
|
+
/**
|
|
17
|
+
* Notify the NamiPaywallManager that a purchase initiated from the
|
|
18
|
+
* [NamiBuySkuHandler] is complete. Only available for plans where Nami is
|
|
19
|
+
* not handling subscription & IAP management.
|
|
20
|
+
*/
|
|
21
|
+
static buySkuComplete(purchase: Purchase): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
|
|
24
|
+
Used to disable product purchase-in-progress loading indicators
|
|
25
|
+
*/
|
|
26
|
+
static buySkuCancel(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Private Instance Methods
|
|
29
|
+
*/
|
|
30
|
+
private get sdkInitialized();
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class NamiProfileManager {
|
|
2
|
+
static instance: NamiProfileManager;
|
|
3
|
+
private externalId?;
|
|
4
|
+
constructor();
|
|
5
|
+
setExternalId(externalId: string | undefined): NamiProfileManager;
|
|
6
|
+
getExternalId(): string | undefined;
|
|
7
|
+
isLoggedIn(): boolean;
|
|
8
|
+
private save;
|
|
9
|
+
private load;
|
|
10
|
+
login(externalId: string): Promise<void>;
|
|
11
|
+
logout(): Promise<void>;
|
|
12
|
+
}
|