@namiml/web-sdk 1.1.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 +13 -0
- 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 +20 -22
- package/dist/nami-web.d.ts +185 -115
- package/dist/nami-web.js +20 -22
- package/dist/nami-web.mjs +20 -22
- package/dist/nami-web.umd.js +21 -23
- 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 +9 -5
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IPaywall } from "src/types/paywall";
|
|
2
|
+
import { CampaignRule } from "src/types/campaign";
|
|
3
|
+
import { TDevice } from "src/types/device";
|
|
4
|
+
export declare class CampaignRuleRepository {
|
|
5
|
+
currentFormFactor: TDevice;
|
|
6
|
+
static instance: CampaignRuleRepository;
|
|
7
|
+
constructor(cFormFactor: TDevice);
|
|
8
|
+
fetchCampaignRules(paywalls: IPaywall[]): Promise<CampaignRule[]>;
|
|
9
|
+
invokeAvailableCampaignsResponseHandler(campaigns?: CampaignRule[]): void;
|
|
10
|
+
private getAnonymousCampaigns;
|
|
11
|
+
private getCampaigns;
|
|
12
|
+
private fallbackData;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Device, DevicePayload } from "src/types/device";
|
|
2
|
+
export declare class DeviceRepository {
|
|
3
|
+
static instance: DeviceRepository;
|
|
4
|
+
createOrUpdateDevice(deviceData: DevicePayload): Promise<Device | null>;
|
|
5
|
+
createDevice(deviceData: DevicePayload): Promise<Device | null>;
|
|
6
|
+
updateDevice(currentDeviceId: string, deviceData: DevicePayload): Promise<Device | null>;
|
|
7
|
+
updateDeviceField<T>(key: string, value: T): Promise<Device | null>;
|
|
8
|
+
private requestAPIData;
|
|
9
|
+
private isEqualDevices;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NamiLogLevel } from "src/types/loglevel";
|
|
2
|
+
declare class Logger {
|
|
3
|
+
private currentLogLevel;
|
|
4
|
+
setLogger: (level?: NamiLogLevel) => void;
|
|
5
|
+
debug<T>(message: T, ...args: unknown[]): void;
|
|
6
|
+
info<T>(message: T, ...args: unknown[]): void;
|
|
7
|
+
warn<T>(message: T, ...args: unknown[]): void;
|
|
8
|
+
error<T>(message: T, ...args: unknown[]): void;
|
|
9
|
+
private shouldLog;
|
|
10
|
+
private formatMessage;
|
|
11
|
+
}
|
|
12
|
+
export declare const logger: Logger;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Device } from "src/types/device";
|
|
2
|
+
import { IConfig, NamiConfiguration } from "src/types/config";
|
|
3
|
+
import { IPaywall } from "src/types/paywall";
|
|
4
|
+
import { CampaignRule } from "src/types/campaign";
|
|
5
|
+
import { NamiProfile } from "src/types/profile";
|
|
6
|
+
import { SKU } from "src/types/sku";
|
|
7
|
+
declare class StorageService {
|
|
8
|
+
setDevice(device: Device): void;
|
|
9
|
+
getDevice(): Device | null;
|
|
10
|
+
resetDevice(): void;
|
|
11
|
+
getAnonymousMode(): boolean;
|
|
12
|
+
setAnonymousMode(mode: boolean): void;
|
|
13
|
+
clearAnonymousMode(): void;
|
|
14
|
+
setAppConfig(key: string, config: IConfig): void;
|
|
15
|
+
getAppConfig(key: string): IConfig | null;
|
|
16
|
+
setCampaignRules(key: string, campaignRules: CampaignRule[]): void;
|
|
17
|
+
getCampaignRules(key: string): CampaignRule[] | null;
|
|
18
|
+
setPaywalls(key: string, paywalls: IPaywall[]): void;
|
|
19
|
+
getPaywalls(key: string): IPaywall[] | null;
|
|
20
|
+
setProducts(key: string, products: SKU[]): void;
|
|
21
|
+
getProducts(key: string): SKU[] | null;
|
|
22
|
+
setNamiConfig(config: NamiConfiguration): void;
|
|
23
|
+
getNamiConfig(): NamiConfiguration | null;
|
|
24
|
+
setCustomerAttribute<T>(attribute: string, value: T): void;
|
|
25
|
+
getCustomerAttribute<T>(attribute: string): T | null;
|
|
26
|
+
getAllCustomerAttributes(): string[];
|
|
27
|
+
clearCustomerAttribute(attribute: string): boolean;
|
|
28
|
+
clearAllCustomerAttributes(): void;
|
|
29
|
+
setNamiProfile(profileData: NamiProfile): void;
|
|
30
|
+
getNamiProfile(): NamiProfile | null;
|
|
31
|
+
removeNamiProfile(): void;
|
|
32
|
+
setSessionCounter(): void;
|
|
33
|
+
setLastImpressionId(id?: string): void;
|
|
34
|
+
getLastImpressionId(): string;
|
|
35
|
+
setSessionId(id?: string): void;
|
|
36
|
+
getSessionId(): string | null;
|
|
37
|
+
clearSessionId(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Set an item in localStorage.
|
|
40
|
+
* @param {string} key - The key under which to store the data.
|
|
41
|
+
* @param {T} value - The data to store.
|
|
42
|
+
*/
|
|
43
|
+
private setItem;
|
|
44
|
+
/**
|
|
45
|
+
* Get an item from localStorage.
|
|
46
|
+
* @param {string} key - The key of the item to retrieve.
|
|
47
|
+
* @returns {T | null} The stored data, or null if not found.
|
|
48
|
+
*/
|
|
49
|
+
private getItem;
|
|
50
|
+
/**
|
|
51
|
+
* Remove an item from localStorage.
|
|
52
|
+
* @param {string} key - The key of the item to remove.
|
|
53
|
+
*/
|
|
54
|
+
private resetItem;
|
|
55
|
+
/**
|
|
56
|
+
* Clear all items from localStorage.
|
|
57
|
+
*/
|
|
58
|
+
clear(): void;
|
|
59
|
+
}
|
|
60
|
+
export declare const storageService: StorageService;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ApiResponse<T> {
|
|
2
|
+
count: number;
|
|
3
|
+
next: number;
|
|
4
|
+
page_number: number;
|
|
5
|
+
previous: null;
|
|
6
|
+
results: T;
|
|
7
|
+
total_pages: number;
|
|
8
|
+
}
|
|
9
|
+
export type LoginPayload = {
|
|
10
|
+
external_id: string;
|
|
11
|
+
};
|
|
12
|
+
export type LoginResponse = {
|
|
13
|
+
external_id: string;
|
|
14
|
+
user_id: string;
|
|
15
|
+
};
|
|
16
|
+
export type Session = {
|
|
17
|
+
id?: string;
|
|
18
|
+
app_env?: string;
|
|
19
|
+
start_time?: Date;
|
|
20
|
+
end_time?: Date;
|
|
21
|
+
};
|
|
22
|
+
export type Impression = {
|
|
23
|
+
id?: string;
|
|
24
|
+
session?: string;
|
|
25
|
+
segment?: string;
|
|
26
|
+
call_to_action?: string;
|
|
27
|
+
app_env?: string;
|
|
28
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface CampaignRule {
|
|
2
|
+
rule: string;
|
|
3
|
+
name: string;
|
|
4
|
+
paywall: string;
|
|
5
|
+
segment: string;
|
|
6
|
+
form_factors: FormFactor[];
|
|
7
|
+
type: string;
|
|
8
|
+
external_segment_id: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
export interface FormFactor {
|
|
12
|
+
form_factor: string;
|
|
13
|
+
supports_portrait: boolean;
|
|
14
|
+
supports_landscape: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type AvailableCampaignsResponseHandler = (campaigns: CampaignRule[]) => void;
|
|
17
|
+
export declare enum CampaignRuleType {
|
|
18
|
+
DEFAULT = "default",
|
|
19
|
+
LABEL = "label",
|
|
20
|
+
URL = "url"
|
|
21
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { TBaseComponent, TContainer, TTestObject } from ".";
|
|
2
|
+
import { NamiSKU } from "../sku";
|
|
3
|
+
import { TImageComponent, TSpacerComponent, TTextComponent, TTextListComponent } from "./elements";
|
|
4
|
+
export type THeaderFooter = (TContainer | TButtonContainer | TSpacerComponent | TTextComponent)[];
|
|
5
|
+
export type TButtonContainer = TBaseComponent & {
|
|
6
|
+
id?: string;
|
|
7
|
+
component: "button";
|
|
8
|
+
actionTap?: string;
|
|
9
|
+
onTap?: UserAction;
|
|
10
|
+
sku?: NamiSKU;
|
|
11
|
+
components: Array<TTextComponent | TTextListComponent | TSpacerComponent | TImageComponent>;
|
|
12
|
+
screenreaderText?: string;
|
|
13
|
+
};
|
|
14
|
+
export type UserAction = {
|
|
15
|
+
function: string;
|
|
16
|
+
parameters?: UserActionParameters;
|
|
17
|
+
};
|
|
18
|
+
export type UserActionParameters = {
|
|
19
|
+
partialState?: Record<string, any>;
|
|
20
|
+
url?: string;
|
|
21
|
+
screen?: string;
|
|
22
|
+
promo?: string;
|
|
23
|
+
confirmationMessage?: string;
|
|
24
|
+
confirmBeforePurchase?: TTestObject[];
|
|
25
|
+
};
|
|
26
|
+
export type Callback = (sku?: NamiSKU) => void;
|
|
27
|
+
export type TCarouselContainer = Omit<TContainer, "component"> & {
|
|
28
|
+
component: "carouselContainer";
|
|
29
|
+
indicatorColor: string;
|
|
30
|
+
activeIndicatorColor: string;
|
|
31
|
+
autoplay: boolean;
|
|
32
|
+
autoplaySeconds: number;
|
|
33
|
+
};
|
|
34
|
+
export type TCarouselSlidesState = {
|
|
35
|
+
[groupId: string]: {
|
|
36
|
+
[carouselName: string]: TCarouselSlide[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type TCarouselSlide = {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string;
|
|
42
|
+
[slideAttr: string]: any;
|
|
43
|
+
};
|
|
44
|
+
export type TFlexProductContainer = Omit<TContainer, "component"> & {
|
|
45
|
+
component: "flexProductContainer";
|
|
46
|
+
products: "all" | "subset";
|
|
47
|
+
flexDirection: FlexDirectionObject;
|
|
48
|
+
subsetGroup?: string;
|
|
49
|
+
productFeaturedComponents?: TContainer[];
|
|
50
|
+
productBaseComponents?: TContainer[];
|
|
51
|
+
};
|
|
52
|
+
export type FlexDirectionObject = {
|
|
53
|
+
small: "vertical" | "horizontal";
|
|
54
|
+
medium: "vertical" | "horizontal";
|
|
55
|
+
large: "vertical" | "horizontal";
|
|
56
|
+
xlarge: "vertical" | "horizontal";
|
|
57
|
+
};
|
|
58
|
+
export type TProductContainer = Omit<TContainer, "component"> & {
|
|
59
|
+
component: "productContainer";
|
|
60
|
+
products: "all" | "subset";
|
|
61
|
+
subsetGroup?: string;
|
|
62
|
+
productFeaturedComponents?: TContainer[];
|
|
63
|
+
productBaseComponents?: TContainer[];
|
|
64
|
+
};
|
|
65
|
+
export type TStack = Omit<TContainer, "component"> & {
|
|
66
|
+
component: "stack";
|
|
67
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AlignmentType, BorderLocationType, TBaseComponent, TComponent, TTestObject } from ".";
|
|
2
|
+
import { UserAction } from "./containers";
|
|
3
|
+
export type TImageComponent = TBaseComponent & {
|
|
4
|
+
component: "image";
|
|
5
|
+
url?: string | null;
|
|
6
|
+
aspectRatio?: number;
|
|
7
|
+
imageCropping?: "fill" | "fit";
|
|
8
|
+
};
|
|
9
|
+
export type TSegmentPicker = TBaseComponent & {
|
|
10
|
+
component: "segmentPicker";
|
|
11
|
+
components: TSegmentPickerItem[];
|
|
12
|
+
onTap?: UserAction;
|
|
13
|
+
};
|
|
14
|
+
export type TSegmentPickerItem = TBaseComponent & {
|
|
15
|
+
component: "segmentPickerItem";
|
|
16
|
+
ref?: any;
|
|
17
|
+
text?: string;
|
|
18
|
+
alignment?: AlignmentType;
|
|
19
|
+
activeFillColor?: string;
|
|
20
|
+
activeBorderColor?: string;
|
|
21
|
+
activeBorderRadius?: number;
|
|
22
|
+
activeBorderWidth?: number;
|
|
23
|
+
activeRoundBorders?: Array<BorderLocationType>;
|
|
24
|
+
activeFontSize?: number;
|
|
25
|
+
activeFontColor?: string;
|
|
26
|
+
activeFontName?: string;
|
|
27
|
+
inactiveBorderRadius?: number;
|
|
28
|
+
inactiveBorderColor?: string;
|
|
29
|
+
inactiveBorderWidth?: number;
|
|
30
|
+
inactiveRoundBorders?: Array<BorderLocationType>;
|
|
31
|
+
inactiveFontSize?: number;
|
|
32
|
+
inactiveFontName?: string;
|
|
33
|
+
inactiveFontColor?: string;
|
|
34
|
+
leftPadding?: number;
|
|
35
|
+
rightPadding?: number;
|
|
36
|
+
topPadding?: number;
|
|
37
|
+
bottomPadding?: number;
|
|
38
|
+
};
|
|
39
|
+
export type TSpacerComponent = TBaseComponent & {
|
|
40
|
+
component: "spacer";
|
|
41
|
+
};
|
|
42
|
+
export type TSvgImageComponent = TBaseComponent & {
|
|
43
|
+
component: "svgImage";
|
|
44
|
+
url?: string | null;
|
|
45
|
+
fontColor?: string;
|
|
46
|
+
};
|
|
47
|
+
export type TSymbolComponent = Omit<TTextComponent, "component" | "textType" | "text"> & {
|
|
48
|
+
component: "symbol";
|
|
49
|
+
name: string;
|
|
50
|
+
};
|
|
51
|
+
export type TTextComponent = TBaseComponent & {
|
|
52
|
+
component: "text";
|
|
53
|
+
textType: "title" | "body" | "legal" | "text";
|
|
54
|
+
androidFontSize?: number;
|
|
55
|
+
fontSize?: number;
|
|
56
|
+
fontColor?: string;
|
|
57
|
+
fontName?: string;
|
|
58
|
+
text: string;
|
|
59
|
+
strikethrough?: boolean | string;
|
|
60
|
+
linkColor?: string;
|
|
61
|
+
};
|
|
62
|
+
export type TTextLikeComponent = TTextComponent | TTextListComponent | TSymbolComponent;
|
|
63
|
+
export type TTextListComponent = Omit<TTextComponent, "component" | "text"> & {
|
|
64
|
+
component: "text-list";
|
|
65
|
+
texts: string[];
|
|
66
|
+
bulletComponent?: TSymbolComponent;
|
|
67
|
+
};
|
|
68
|
+
export type TVideoComponent = TBaseComponent & {
|
|
69
|
+
component: "videoUrl";
|
|
70
|
+
url?: string | null;
|
|
71
|
+
aspectRatio?: number;
|
|
72
|
+
imageCropping?: "fill" | "fit";
|
|
73
|
+
};
|
|
74
|
+
export type TConditionalComponent = TBaseComponent & {
|
|
75
|
+
component: "condition";
|
|
76
|
+
components?: TComponent[];
|
|
77
|
+
assertions?: TTestObject[];
|
|
78
|
+
orAssertions?: TTestObject[] | undefined;
|
|
79
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { TButtonContainer, TCarouselContainer, TCarouselSlide, TFlexProductContainer, TProductContainer, TStack } from "./containers";
|
|
2
|
+
import { TConditionalComponent, TImageComponent, TSegmentPicker, TSegmentPickerItem, TSpacerComponent, TSvgImageComponent, TSymbolComponent, TTextComponent, TTextListComponent } from "./elements";
|
|
3
|
+
export interface TBaseComponent {
|
|
4
|
+
id?: string;
|
|
5
|
+
component: string;
|
|
6
|
+
grow?: boolean;
|
|
7
|
+
flag?: null | string;
|
|
8
|
+
context?: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
moveX?: number | string;
|
|
12
|
+
moveY?: string | number;
|
|
13
|
+
direction?: DirectionType;
|
|
14
|
+
spacing?: number;
|
|
15
|
+
alignment?: AlignmentType;
|
|
16
|
+
leftPadding?: number;
|
|
17
|
+
rightPadding?: number;
|
|
18
|
+
topPadding?: number;
|
|
19
|
+
bottomPadding?: number;
|
|
20
|
+
leftMargin?: number;
|
|
21
|
+
rightMargin?: number;
|
|
22
|
+
topMargin?: number | string;
|
|
23
|
+
bottomMargin?: number;
|
|
24
|
+
fillColor?: string;
|
|
25
|
+
borderWidth?: number;
|
|
26
|
+
borderRadius?: number;
|
|
27
|
+
borderColor?: string;
|
|
28
|
+
borders?: Array<BorderSideType>;
|
|
29
|
+
focusedBorders?: Array<BorderSideType>;
|
|
30
|
+
focusedFillColor?: string;
|
|
31
|
+
focusedFontColor?: string;
|
|
32
|
+
focusedBorderColor?: string;
|
|
33
|
+
focusedBorderWidth?: number;
|
|
34
|
+
focusedBorderRadius?: number;
|
|
35
|
+
roundBorders?: Array<BorderLocationType>;
|
|
36
|
+
focusedRoundBorders?: Array<BorderLocationType>;
|
|
37
|
+
zIndex?: number;
|
|
38
|
+
conditionAttributes?: TConditionalAttributes;
|
|
39
|
+
height?: number | string;
|
|
40
|
+
width?: number | string;
|
|
41
|
+
dropShadow?: string;
|
|
42
|
+
refId?: string;
|
|
43
|
+
_fields?: {
|
|
44
|
+
[attribute: string]: TFieldSettings;
|
|
45
|
+
} & {
|
|
46
|
+
_group: string;
|
|
47
|
+
_label: string;
|
|
48
|
+
_toggleAttr: string | null;
|
|
49
|
+
_toggleValue: any;
|
|
50
|
+
_collapsible: boolean;
|
|
51
|
+
_hint: string | null;
|
|
52
|
+
};
|
|
53
|
+
_fieldGroupLabel?: string;
|
|
54
|
+
_fieldLabel?: string;
|
|
55
|
+
_fieldHint?: string;
|
|
56
|
+
_fieldReadOnly?: boolean;
|
|
57
|
+
_fieldPlaceholder?: string;
|
|
58
|
+
_fieldDescription?: string;
|
|
59
|
+
_fieldOmit?: string[];
|
|
60
|
+
fixedHeight?: number;
|
|
61
|
+
fixedWidth?: number | "fitContent";
|
|
62
|
+
}
|
|
63
|
+
export type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPicker | TSegmentPickerItem;
|
|
64
|
+
export type DirectionType = "vertical" | "horizontal";
|
|
65
|
+
export type AlignmentType = "center" | "right" | "left" | "top" | "bottom";
|
|
66
|
+
export type BorderLocationType = "upperLeft" | "upperRight" | "lowerLeft" | "lowerRight";
|
|
67
|
+
export type BorderSideType = 'left' | 'right' | 'top' | 'bottom';
|
|
68
|
+
export type TContainerPosition = `${'center' | 'start' | 'end'}-${'top' | 'bottom' | 'left' | 'right'}`;
|
|
69
|
+
export declare const BorderMap: Record<BorderLocationType, string>;
|
|
70
|
+
export declare const BorderSideMap: Record<BorderSideType, string>;
|
|
71
|
+
export type TTestObject = {
|
|
72
|
+
value: any;
|
|
73
|
+
expected: any;
|
|
74
|
+
operator: "equals" | "contains" | "notEquals" | "set" | "notSet" | "notContains";
|
|
75
|
+
};
|
|
76
|
+
type TransformToString<T> = {
|
|
77
|
+
[P in keyof T]: T[P] extends number | boolean ? T[P] | string : T[P];
|
|
78
|
+
};
|
|
79
|
+
export type TConditionalAttributes = Array<Omit<TConditionalComponent, "components"> & {
|
|
80
|
+
attributes: Partial<TransformToString<TBaseComponent>> & {
|
|
81
|
+
text?: string;
|
|
82
|
+
};
|
|
83
|
+
}>;
|
|
84
|
+
export type TField = "image" | "listContainerComponent" | "text" | "url" | "textArea" | "fontSelect" | "splitTextArea" | "color" | "colorGradient" | "number" | "alignment" | "carouselSlides" | "option" | "iconSelect" | "toggle";
|
|
85
|
+
export type TContainer = TBaseComponent & {
|
|
86
|
+
component: "container";
|
|
87
|
+
position?: TContainerPosition;
|
|
88
|
+
fillColor?: string;
|
|
89
|
+
fillImage?: string | null;
|
|
90
|
+
components: TComponent[];
|
|
91
|
+
loopVariable?: string;
|
|
92
|
+
loopSource?: any[];
|
|
93
|
+
};
|
|
94
|
+
export type TFieldSettings = {
|
|
95
|
+
type: TField;
|
|
96
|
+
label: string;
|
|
97
|
+
hint: string | null;
|
|
98
|
+
description: string | null;
|
|
99
|
+
placeholder: string | null;
|
|
100
|
+
variable: string;
|
|
101
|
+
readOnly: boolean;
|
|
102
|
+
markdownHint: boolean;
|
|
103
|
+
options: {
|
|
104
|
+
label: string;
|
|
105
|
+
value: any;
|
|
106
|
+
}[] | null;
|
|
107
|
+
maxLimit: number | null;
|
|
108
|
+
minLimit: number | null;
|
|
109
|
+
aspectRatio: number | null;
|
|
110
|
+
newSlide?: TCarouselSlide;
|
|
111
|
+
carousel?: string;
|
|
112
|
+
darkModeVariable?: string;
|
|
113
|
+
conditions?: TTestObject[];
|
|
114
|
+
showOpacity?: boolean;
|
|
115
|
+
newRow?: any;
|
|
116
|
+
};
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CampaignRule } from "./campaign";
|
|
2
|
+
import { TDevice } from "./device";
|
|
3
|
+
import { NamiLanguageCode } from "./languages";
|
|
4
|
+
import { NamiLogLevel } from "./loglevel";
|
|
5
|
+
import { IPaywall } from "./paywall";
|
|
6
|
+
import { PaywallSKU } from "./sku";
|
|
7
|
+
export interface IConfig {
|
|
8
|
+
id: string;
|
|
9
|
+
capabilities: string[];
|
|
10
|
+
marketplace_app_id?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export type NamiConfiguration = {
|
|
13
|
+
appPlatformId: string;
|
|
14
|
+
logLevel?: NamiLogLevel;
|
|
15
|
+
languageCode?: NamiLanguageCode;
|
|
16
|
+
namiCommands?: string[];
|
|
17
|
+
initialConfig?: string | InitialConfig;
|
|
18
|
+
formFactor?: TDevice;
|
|
19
|
+
};
|
|
20
|
+
export type InitialConfig = {
|
|
21
|
+
appConfig?: IConfig;
|
|
22
|
+
platform_config?: IConfig;
|
|
23
|
+
products?: PaywallSKU[];
|
|
24
|
+
paywalls?: IPaywall[];
|
|
25
|
+
campaign_rules?: CampaignRule[];
|
|
26
|
+
};
|
|
27
|
+
export type NamiConfigurationState = {
|
|
28
|
+
sdkInitialized: boolean;
|
|
29
|
+
configureState: string;
|
|
30
|
+
};
|
|
31
|
+
export type ExtendedPlatformInfo = {
|
|
32
|
+
platform: string;
|
|
33
|
+
version: string;
|
|
34
|
+
};
|
|
35
|
+
export declare enum Capabilities {
|
|
36
|
+
SDK = "sdk",
|
|
37
|
+
ML = "ml",
|
|
38
|
+
THIRD_PARTY_ANALYTICS = "third_party_analytics",
|
|
39
|
+
THIRD_PARTY_TRANSACTIONS = "third_party_transactions",
|
|
40
|
+
PAYWALL_PERSONALIZATION = "paywall_personalization",
|
|
41
|
+
ANONYMOUS_MODE_CAPABILITY = "anonymous_allowed",
|
|
42
|
+
LANGUAGE_MANAGEMENT = "language_management"
|
|
43
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface Device {
|
|
2
|
+
id: string;
|
|
3
|
+
advertising_id: string;
|
|
4
|
+
app_env: string;
|
|
5
|
+
app_version: string;
|
|
6
|
+
country: string;
|
|
7
|
+
customer_data_platform_id: string;
|
|
8
|
+
device_model: string;
|
|
9
|
+
extended_framework_version: string;
|
|
10
|
+
extended_platform_version: string;
|
|
11
|
+
extended_platform: string;
|
|
12
|
+
form_factor: TDevice;
|
|
13
|
+
language: string;
|
|
14
|
+
marketplace_country: string;
|
|
15
|
+
os_name: string;
|
|
16
|
+
os_version: string;
|
|
17
|
+
sdk_client: string;
|
|
18
|
+
sdk_version: string;
|
|
19
|
+
vendor_id: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DevicePayload {
|
|
22
|
+
os_version: string;
|
|
23
|
+
os_name: string;
|
|
24
|
+
browser_name: string;
|
|
25
|
+
browser_version: string;
|
|
26
|
+
sdk_client: string;
|
|
27
|
+
device_model?: string;
|
|
28
|
+
form_factor?: string;
|
|
29
|
+
sdk_version: string;
|
|
30
|
+
language: string;
|
|
31
|
+
extended_platform_version?: string;
|
|
32
|
+
extended_platform?: string;
|
|
33
|
+
}
|
|
34
|
+
export type TDevice = 'phone' | 'tablet' | 'television' | 'desktop';
|
|
35
|
+
export type TDeviceOrientation = 'landscape' | 'portrait';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum LaunchCampaignError {
|
|
2
|
+
DEFAULT_CAMPAIGN_NOT_FOUND = 0,
|
|
3
|
+
LABELED_CAMPAIGN_NOT_FOUND = 1,
|
|
4
|
+
CAMPAIGN_DATA_NOT_FOUND = 2,
|
|
5
|
+
PAYWALL_ALREADY_DISPLAYED = 3,
|
|
6
|
+
SDK_NOT_INITIALIZED = 4,
|
|
7
|
+
PAYWALL_COULD_NOT_DISPLAY = 5,
|
|
8
|
+
URL_CAMPAIGN_NOT_FOUND = 6,
|
|
9
|
+
PRODUCT_DATA_NOT_FOUND = 7,
|
|
10
|
+
PRODUCT_GROUPS_NOT_FOUND = 8
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type NamiLanguageCode = "af" | "ar" | "ar-dz" | "ast" | "az" | "bg" | "be" | "bn" | "br" | "bs" | "ca" | "cs" | "cy" | "da" | "de" | "dsb" | "el" | "en" | "en-au" | "en-gb" | "eo" | "es" | "es-ar" | "es-co" | "es-mx" | "es-ni" | "es-ve" | "et" | "eu" | "fa" | "fi" | "fr" | "fy" | "ga" | "gd" | "gl" | "he" | "hi" | "hr" | "hsb" | "hu" | "hy" | "ia" | "id" | "ig" | "io" | "is" | "it" | "ja" | "ka" | "kab" | "kk" | "km" | "kn" | "ko" | "ky" | "lb" | "lt" | "lv" | "mk" | "ml" | "mn" | "mr" | "my" | "nb" | "ne" | "nl" | "nn" | "os" | "pa" | "pl" | "pt" | "pt-br" | "ro" | "ru" | "sk" | "sl" | "sq" | "sr" | "sr-latn" | "sv" | "sw" | "ta" | "te" | "tg" | "th" | "tk" | "tr" | "tt" | "udm" | "uk" | "ur" | "uz" | "vi" | "zh-hans" | "zh-hant";
|