@namiml/web-sdk 0.0.1-alpha.5

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.
Files changed (61) hide show
  1. package/README.md +52 -0
  2. package/dist/components/ContextConsumer.d.ts +11 -0
  3. package/dist/components/ContextProvider.d.ts +45 -0
  4. package/dist/components/NamiElement.d.ts +8 -0
  5. package/dist/components/Paywall.d.ts +11 -0
  6. package/dist/components/TemplateComponent.d.ts +3 -0
  7. package/dist/components/containers/BackgroundContainer.d.ts +12 -0
  8. package/dist/components/containers/Container.d.ts +10 -0
  9. package/dist/components/containers/Content.d.ts +11 -0
  10. package/dist/components/containers/Footer.d.ts +9 -0
  11. package/dist/components/containers/Header.d.ts +11 -0
  12. package/dist/components/containers/ProductContainer.d.ts +9 -0
  13. package/dist/components/elements/Button.d.ts +9 -0
  14. package/dist/components/elements/Image.d.ts +9 -0
  15. package/dist/components/elements/Spacer.d.ts +9 -0
  16. package/dist/components/elements/Text.d.ts +27 -0
  17. package/dist/components/index.d.ts +25 -0
  18. package/dist/components/productDetails.d.ts +1 -0
  19. package/dist/components/styles/reset.d.ts +2 -0
  20. package/dist/components/utils.d.ts +46 -0
  21. package/dist/core/api.d.ts +12 -0
  22. package/dist/core/errors.d.ts +19 -0
  23. package/dist/core/withRetry.d.ts +1 -0
  24. package/dist/decorators/index.d.ts +2 -0
  25. package/dist/index.d.ts +8 -0
  26. package/dist/nami/api.d.ts +14 -0
  27. package/dist/nami/campaign.d.ts +19 -0
  28. package/dist/nami/customer.d.ts +96 -0
  29. package/dist/nami/index.d.ts +8 -0
  30. package/dist/nami/namiRefs.d.ts +7 -0
  31. package/dist/nami/paywalls.d.ts +14 -0
  32. package/dist/nami/profile.d.ts +12 -0
  33. package/dist/nami-web.cjs +10594 -0
  34. package/dist/nami-web.d.ts +559 -0
  35. package/dist/nami-web.js +10589 -0
  36. package/dist/nami-web.mjs +10589 -0
  37. package/dist/nami-web.umd.js +10600 -0
  38. package/dist/repositories/campaignRule.repository.d.ts +12 -0
  39. package/dist/repositories/config.repository.d.ts +7 -0
  40. package/dist/repositories/device.repository.d.ts +12 -0
  41. package/dist/repositories/paywall.repository.d.ts +8 -0
  42. package/dist/repositories/products.repository.d.ts +8 -0
  43. package/dist/services/logger.service.d.ts +13 -0
  44. package/dist/services/storage.service.d.ts +50 -0
  45. package/dist/types/api.d.ts +15 -0
  46. package/dist/types/campaign.d.ts +16 -0
  47. package/dist/types/components/containers.d.ts +52 -0
  48. package/dist/types/components/elements.d.ts +78 -0
  49. package/dist/types/components/index.d.ts +110 -0
  50. package/dist/types/config.d.ts +32 -0
  51. package/dist/types/device.d.ts +34 -0
  52. package/dist/types/languages.d.ts +1 -0
  53. package/dist/types/loglevel.d.ts +7 -0
  54. package/dist/types/paywall.d.ts +169 -0
  55. package/dist/types/profile.d.ts +3 -0
  56. package/dist/types/utils.d.ts +1 -0
  57. package/dist/utils/config.d.ts +3 -0
  58. package/dist/utils/const.d.ts +1 -0
  59. package/dist/utils/device.d.ts +2 -0
  60. package/dist/utils/fonts.d.ts +7 -0
  61. package/package.json +92 -0
@@ -0,0 +1,12 @@
1
+ import { IPaywall } from "src/types/paywall";
2
+ import { ApiService } from "../core/api";
3
+ import { CampaignRule } from "src/types/campaign";
4
+ import { TDevice } from "src/types/device";
5
+ export declare class CampaignRuleRepository {
6
+ private apiService;
7
+ currentFormFactor: TDevice;
8
+ constructor(apiService: ApiService, cFormFactor: TDevice);
9
+ fetchCampaignRules(paywalls: IPaywall[]): Promise<CampaignRule[]>;
10
+ invokeAvailableCampaignsResponseHandler(campaigns: CampaignRule[]): void;
11
+ private fallbackData;
12
+ }
@@ -0,0 +1,7 @@
1
+ import { IConfig } from "src/types/config";
2
+ import { ApiService } from "../core/api";
3
+ export declare class ConfigRepository {
4
+ private apiService;
5
+ constructor(apiService: ApiService);
6
+ fetchConfig(): Promise<IConfig>;
7
+ }
@@ -0,0 +1,12 @@
1
+ import { ApiService } from "../core/api";
2
+ import { Device, DevicePayload } from "src/types/device";
3
+ export declare class DeviceRepository {
4
+ private apiService;
5
+ constructor(apiService: ApiService);
6
+ createOrUpdateDevice(deviceData: DevicePayload): Promise<Device>;
7
+ createDevice(deviceData: DevicePayload): Promise<Device>;
8
+ updateDevice(currentDeviceId: string, deviceData: DevicePayload): Promise<Device>;
9
+ updateDeviceField<T>(request: T): Promise<Device>;
10
+ private requestAPIData;
11
+ private isEqualDevices;
12
+ }
@@ -0,0 +1,8 @@
1
+ import { ApiService } from "../core/api";
2
+ import { IPaywall } from "src/types/paywall";
3
+ export declare class PaywallRepository {
4
+ private apiService;
5
+ constructor(apiService: ApiService);
6
+ fetchPaywalls(): Promise<IPaywall[]>;
7
+ private fallbackData;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { IProducts } from "src/types/paywall";
2
+ import { ApiService } from "../core/api";
3
+ export declare class ProductRepository {
4
+ private apiService;
5
+ constructor(apiService: ApiService);
6
+ fetchProducts(): Promise<IProducts[]>;
7
+ private fallbackData;
8
+ }
@@ -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,50 @@
1
+ import { Device } from "src/types/device";
2
+ import { IConfig, NamiConfiguration } from "src/types/config";
3
+ import { IPaywall, IProducts } from "src/types/paywall";
4
+ import { CampaignRule } from "src/types/campaign";
5
+ import { NamiProfile } from "src/types/profile";
6
+ declare class StorageService {
7
+ setDevice(device: Device): void;
8
+ getDevice(): Device;
9
+ resetDevice(): void;
10
+ setAppConfig(key: string, config: IConfig): void;
11
+ getAppConfig(key: string): IConfig;
12
+ setCampaignRules(key: string, campaignRules: CampaignRule[]): void;
13
+ getCampaignRules(key: string): CampaignRule[];
14
+ setPaywalls(key: string, paywalls: IPaywall[]): void;
15
+ getPaywalls(key: string): IPaywall[];
16
+ setProducts(key: string, products: IProducts[]): void;
17
+ getProducts(key: string): IProducts[];
18
+ setNamiConfig(config: NamiConfiguration): void;
19
+ getNamiConfig(): NamiConfiguration;
20
+ setCustomerAttribute<T>(attribute: string, value: T): void;
21
+ getCustomerAttribute<T>(attribute: string): T;
22
+ clearCustomerAttribute(attribute: string): void;
23
+ clearAllCustomerAttributes(): void;
24
+ setNamiProfile(profileData: NamiProfile): void;
25
+ getNamiProfile(): NamiProfile;
26
+ removeNamiProfile(): void;
27
+ /**
28
+ * Set an item in localStorage.
29
+ * @param {string} key - The key under which to store the data.
30
+ * @param {T} value - The data to store.
31
+ */
32
+ private setItem;
33
+ /**
34
+ * Get an item from localStorage.
35
+ * @param {string} key - The key of the item to retrieve.
36
+ * @returns {T | null} The stored data, or null if not found.
37
+ */
38
+ private getItem;
39
+ /**
40
+ * Remove an item from localStorage.
41
+ * @param {string} key - The key of the item to remove.
42
+ */
43
+ private resetItem;
44
+ /**
45
+ * Clear all items from localStorage.
46
+ */
47
+ clear(): void;
48
+ }
49
+ export declare const storageService: StorageService;
50
+ export {};
@@ -0,0 +1,15 @@
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
+ };
@@ -0,0 +1,16 @@
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: null;
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;
@@ -0,0 +1,52 @@
1
+ import { TBaseComponent, TContainer } from ".";
2
+ import { TImageComponent, TSpacerComponent, TTextComponent, TTextListComponent } from "./elements";
3
+ export type THeaderFooter = (TContainer | TButtonContainer | TSpacerComponent | TTextComponent)[];
4
+ export type TButtonContainer = TBaseComponent & {
5
+ component: "button";
6
+ actionTap: string;
7
+ onTap?: {
8
+ function: string;
9
+ };
10
+ components: Array<TTextComponent | TTextListComponent | TSpacerComponent | TImageComponent>;
11
+ };
12
+ export type TCarouselContainer = Omit<TContainer, "component"> & {
13
+ component: "carouselContainer";
14
+ indicatorColor: string;
15
+ activeIndicatorColor: string;
16
+ autoplay: boolean;
17
+ autoplaySeconds: number;
18
+ };
19
+ export type TCarouselSlidesState = {
20
+ [groupId: string]: {
21
+ [carouselName: string]: TCarouselSlide[];
22
+ };
23
+ };
24
+ export type TCarouselSlide = {
25
+ id: string;
26
+ title: string;
27
+ [slideAttr: string]: any;
28
+ };
29
+ export type TFlexProductContainer = Omit<TContainer, "component"> & {
30
+ component: "flexProductContainer";
31
+ products: "all" | "subset";
32
+ flexDirection: FlexDirectionObject;
33
+ subsetGroup?: string;
34
+ productFeaturedComponents: TContainer[];
35
+ productBaseComponents: TContainer[];
36
+ };
37
+ export type FlexDirectionObject = {
38
+ small: "vertical" | "horizontal";
39
+ medium: "vertical" | "horizontal";
40
+ large: "vertical" | "horizontal";
41
+ xlarge: "vertical" | "horizontal";
42
+ };
43
+ export type TProductContainer = Omit<TContainer, "component"> & {
44
+ component: "productContainer";
45
+ products: "all" | "subset";
46
+ subsetGroup?: string;
47
+ productFeaturedComponents: TContainer[];
48
+ productBaseComponents: TContainer[];
49
+ };
50
+ export type TStack = Omit<TContainer, "component"> & {
51
+ component: "stack";
52
+ };
@@ -0,0 +1,78 @@
1
+ import { AlignmentType, BorderLocationType, TBaseComponent, TComponent, TTestObject } from ".";
2
+ export type TImageComponent = TBaseComponent & {
3
+ component: "image";
4
+ url?: string | null;
5
+ aspectRatio?: number;
6
+ imageCropping?: "fill" | "fit";
7
+ };
8
+ export type TSegmentPicker = TBaseComponent & {
9
+ component: "segmentPicker";
10
+ components: TSegmentPickerItem[];
11
+ };
12
+ export type TSegmentPickerItem = {
13
+ component: "segmentPickerItem";
14
+ ref: any;
15
+ id: string;
16
+ text?: string;
17
+ alignment?: AlignmentType;
18
+ activeFillColor?: string;
19
+ activeBorderColor?: string;
20
+ activeBorderRadius?: number;
21
+ activeBorderWidth?: number;
22
+ activeRoundBorders?: Array<BorderLocationType>;
23
+ activeFontSize?: number;
24
+ activeFontColor?: string;
25
+ activeFontName?: string;
26
+ inactiveBorderRadius?: number;
27
+ inactiveBorderColor?: string;
28
+ inactiveBorderWidth?: number;
29
+ inactiveRoundBorders?: Array<BorderLocationType>;
30
+ inactiveFontSize?: number;
31
+ inactiveFontName?: string;
32
+ inactiveFontColor?: string;
33
+ leftPadding?: number;
34
+ rightPadding?: number;
35
+ topPadding?: number;
36
+ bottomPadding?: number;
37
+ };
38
+ export type TSpacerComponent = TBaseComponent & {
39
+ component: "spacer";
40
+ };
41
+ export type TSvgImageComponent = TBaseComponent & {
42
+ component: "svgImage";
43
+ url?: string | null;
44
+ fontColor?: string;
45
+ };
46
+ export type TSymbolComponent = Omit<TTextComponent, "component" | "textType" | "text"> & {
47
+ component: "symbol";
48
+ name: string;
49
+ };
50
+ export type TTextComponent = TBaseComponent & {
51
+ component: "text";
52
+ textType: "title" | "body" | "legal";
53
+ androidFontSize?: number;
54
+ fontSize?: number;
55
+ fontColor?: string;
56
+ fontName?: string;
57
+ text: string;
58
+ strikethrough?: boolean;
59
+ linkColor?: string;
60
+ };
61
+ export type TTextLikeComponent = TTextComponent | TTextListComponent | TSymbolComponent;
62
+ export type TTextListComponent = Omit<TTextComponent, "component" | "text"> & {
63
+ component: "text-list";
64
+ texts: string[];
65
+ bulletComponent?: TSymbolComponent;
66
+ };
67
+ export type TVideoComponent = TBaseComponent & {
68
+ component: "videoUrl";
69
+ url?: string | null;
70
+ aspectRatio?: number;
71
+ imageCropping?: "fill" | "fit";
72
+ };
73
+ export type TConditionalComponent = TBaseComponent & {
74
+ component: "condition";
75
+ components?: TComponent[];
76
+ assertions?: TTestObject[];
77
+ orAssertions?: TTestObject[] | undefined;
78
+ };
@@ -0,0 +1,110 @@
1
+ import { TButtonContainer, TCarouselContainer, TCarouselSlide, TFlexProductContainer, TProductContainer, TStack } from "./containers";
2
+ import { TConditionalComponent, TImageComponent, TSpacerComponent, TSvgImageComponent, TSymbolComponent, TTextComponent, TTextListComponent } from "./elements";
3
+ export interface TBaseComponent {
4
+ component: string;
5
+ grow?: boolean;
6
+ flag?: null | string;
7
+ context?: {
8
+ [key: string]: any;
9
+ };
10
+ moveX?: number | string;
11
+ moveY?: string | number;
12
+ direction?: DirectionType;
13
+ spacing?: number;
14
+ alignment?: AlignmentType;
15
+ leftPadding?: number;
16
+ rightPadding?: number;
17
+ topPadding?: number;
18
+ bottomPadding?: number;
19
+ leftMargin?: number;
20
+ rightMargin?: number;
21
+ topMargin?: number | string;
22
+ bottomMargin?: number;
23
+ fillColor?: string;
24
+ borderWidth?: number;
25
+ borderRadius?: number;
26
+ borderColor?: string;
27
+ borders?: Array<BorderSideType>;
28
+ focusedBorders?: Array<BorderSideType>;
29
+ focusedFillColor?: string;
30
+ focusedFontColor?: string;
31
+ focusedBorderColor?: string;
32
+ focusedBorderWidth?: number;
33
+ focusedBorderRadius?: number;
34
+ roundBorders?: Array<BorderLocationType>;
35
+ focusedRoundBorders?: Array<BorderLocationType>;
36
+ zIndex?: number;
37
+ conditionAttributes?: TConditionalAttributes;
38
+ height?: number | string;
39
+ width?: number | string;
40
+ dropShadow?: string;
41
+ refId?: string;
42
+ _fields?: {
43
+ [attribute: string]: TFieldSettings;
44
+ } & {
45
+ _group: string;
46
+ _label: string;
47
+ _toggleAttr: string | null;
48
+ _toggleValue: any;
49
+ _collapsible: boolean;
50
+ _hint: string | null;
51
+ };
52
+ _fieldGroupLabel?: string;
53
+ _fieldLabel?: string;
54
+ _fieldHint?: string;
55
+ _fieldReadOnly?: boolean;
56
+ _fieldPlaceholder?: string;
57
+ _fieldDescription?: string;
58
+ _fieldOmit?: string[];
59
+ fixedHeight?: number;
60
+ fixedWidth?: number | "fitContent";
61
+ }
62
+ export type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent;
63
+ export type DirectionType = "vertical" | "horizontal";
64
+ export type AlignmentType = "center" | "right" | "left" | "top" | "bottom";
65
+ export type BorderLocationType = "upperLeft" | "upperRight" | "lowerLeft" | "lowerRight";
66
+ export type BorderSideType = 'left' | 'right' | 'top' | 'bottom';
67
+ export type TContainerPosition = `${'center' | 'start' | 'end'}-${'top' | 'bottom' | 'left' | 'right'}`;
68
+ export declare const BorderMap: Record<BorderLocationType, string>;
69
+ export declare const BorderSideMap: Record<BorderSideType, string>;
70
+ export type TTestObject = {
71
+ value: any;
72
+ expected: any;
73
+ operator: "equals" | "contains" | "notEquals" | "set" | "notSet";
74
+ };
75
+ export type TConditionalAttributes = Array<Omit<TConditionalComponent, "components"> & {
76
+ attributes: Partial<TBaseComponent>;
77
+ }>;
78
+ export type TField = "image" | "listContainerComponent" | "text" | "url" | "textArea" | "fontSelect" | "splitTextArea" | "color" | "colorGradient" | "number" | "alignment" | "carouselSlides" | "option" | "iconSelect" | "toggle";
79
+ export type TContainer = TBaseComponent & {
80
+ component: "container";
81
+ position?: TContainerPosition;
82
+ fillColor?: string;
83
+ fillImage?: string | null;
84
+ components: TComponent[];
85
+ loopVariable?: string;
86
+ loopSource?: any[];
87
+ };
88
+ export type TFieldSettings = {
89
+ type: TField;
90
+ label: string;
91
+ hint: string | null;
92
+ description: string | null;
93
+ placeholder: string | null;
94
+ variable: string;
95
+ readOnly: boolean;
96
+ markdownHint: boolean;
97
+ options: {
98
+ label: string;
99
+ value: any;
100
+ }[] | null;
101
+ maxLimit: number | null;
102
+ minLimit: number | null;
103
+ aspectRatio: number | null;
104
+ newSlide?: TCarouselSlide;
105
+ carousel?: string;
106
+ darkModeVariable?: string;
107
+ conditions?: TTestObject[];
108
+ showOpacity?: boolean;
109
+ newRow?: any;
110
+ };
@@ -0,0 +1,32 @@
1
+ import { CampaignRule } from "./campaign";
2
+ import { TDevice } from "./device";
3
+ import { NamiLanguageCode } from "./languages";
4
+ import { NamiLogLevel } from "./loglevel";
5
+ import { IPaywall, IProducts } from "./paywall";
6
+ export interface IConfig {
7
+ id: string;
8
+ capabilities: string[];
9
+ marketplace_app_id: string;
10
+ }
11
+ export type NamiConfiguration = {
12
+ appPlatformId: string;
13
+ logLevel?: NamiLogLevel;
14
+ languageCode?: NamiLanguageCode;
15
+ namiCommands?: string[];
16
+ initialConfig?: InitialConfig;
17
+ formFactor?: TDevice;
18
+ };
19
+ export type InitialConfig = {
20
+ appConfig: IConfig;
21
+ products: IProducts[];
22
+ paywalls: IPaywall[];
23
+ campaign_rules: CampaignRule[];
24
+ };
25
+ export type NamiConfigurationState = {
26
+ sdkInitialized: boolean;
27
+ configureState: string;
28
+ };
29
+ export type ExtendedPlatformInfo = {
30
+ platform: string;
31
+ version: string;
32
+ };
@@ -0,0 +1,34 @@
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';
@@ -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";
@@ -0,0 +1,7 @@
1
+ export type NamiLogLevel = "error" | "warn" | "info" | "debug";
2
+ export declare enum LogLevel {
3
+ DEBUG = 1,
4
+ INFO = 2,
5
+ WARN = 3,
6
+ ERROR = 4
7
+ }
@@ -0,0 +1,169 @@
1
+ import { CampaignRule } from "./campaign";
2
+ import { TComponent, TContainer } from "./components";
3
+ import { TButtonContainer, TCarouselSlidesState } from "./components/containers";
4
+ import { TSpacerComponent, TTextComponent } from "./components/elements";
5
+ import { Optional } from "./utils";
6
+ export type TPaywallContext = TInitialState & {
7
+ paywallId: string;
8
+ livePaywalls: IPaywall[];
9
+ selectedPaywall: IPaywall | undefined;
10
+ campaignRules: CampaignRule[];
11
+ anySkuHasTrialOffer: boolean;
12
+ anySkuHasIntroOffer: boolean;
13
+ anySkuHasPromoOffer: boolean;
14
+ safeAreaTop: number;
15
+ slides?: TCarouselSlidesState;
16
+ currentPage: string;
17
+ fullScreenPresentation?: boolean;
18
+ isLoggedIn?: boolean;
19
+ darkMode?: boolean;
20
+ [key: string]: any;
21
+ groups: {
22
+ id: string;
23
+ displayName: string;
24
+ ref: string;
25
+ }[];
26
+ currentGroupId: string;
27
+ selectedProducts: {
28
+ [currentGroupId: string]: string;
29
+ };
30
+ launch: {
31
+ productGroups: string[];
32
+ customAttributes: {
33
+ [key: string]: any;
34
+ };
35
+ };
36
+ sku: {
37
+ [key: string]: any;
38
+ };
39
+ };
40
+ export type ProductGroup = {
41
+ id: string;
42
+ products: IProducts[];
43
+ ref: string;
44
+ };
45
+ export type SelectableItemType = {
46
+ id: string;
47
+ sku_id: string;
48
+ featured: boolean;
49
+ selected: boolean;
50
+ name: string;
51
+ sku_ref_id: string;
52
+ sku_type: string;
53
+ variables: {
54
+ [key: string]: any;
55
+ };
56
+ };
57
+ export interface IPaywall {
58
+ id: string;
59
+ name: string;
60
+ paywall_type: string;
61
+ sku_menus: ISkuMenu[];
62
+ template: TPaywallTemplate;
63
+ fonts: FontCollection;
64
+ }
65
+ export interface ISkuMenu {
66
+ id: string;
67
+ name: string;
68
+ display_name: string;
69
+ ref: string;
70
+ products: IProducts[];
71
+ }
72
+ export interface IProducts {
73
+ id: string;
74
+ featured: boolean;
75
+ name: string;
76
+ sku_ref_id: string;
77
+ display_text: string;
78
+ sub_display_text: string;
79
+ entitlements: IEntitlements[];
80
+ variables?: {
81
+ [key: string]: any;
82
+ };
83
+ sku_type: string;
84
+ _isSelected?: boolean;
85
+ }
86
+ export interface IEntitlements {
87
+ id: string;
88
+ entitlement_ref_id: string;
89
+ name: string;
90
+ description: string | null;
91
+ type: string;
92
+ }
93
+ export interface IProductsWithComponents extends IProducts {
94
+ components: TComponent;
95
+ }
96
+ export type FontCollection = {
97
+ [fontName: string]: FontDetails;
98
+ };
99
+ export type FontDetails = {
100
+ id: string;
101
+ family: string;
102
+ style: string;
103
+ file: string;
104
+ };
105
+ export type TPaywallTemplate = {
106
+ id: string;
107
+ orgs?: string | null;
108
+ media?: {
109
+ [key: string]: string;
110
+ };
111
+ pages: TPages[];
112
+ ready?: boolean;
113
+ version: string | number;
114
+ codename: string;
115
+ doc_link: string;
116
+ thumbnail?: string;
117
+ skuContexts?: {
118
+ [skuId: string]: {
119
+ [key: string]: any;
120
+ };
121
+ };
122
+ initialState: TInitialState;
123
+ min_sdk_version: string;
124
+ };
125
+ export type TPages = {
126
+ name: string;
127
+ header: Array<TButtonContainer | TSpacerComponent | TTextComponent | TContainer>;
128
+ contentContainer: TContainer | null;
129
+ footer: TComponent[] | null;
130
+ backgroundContainer: TContainer | null;
131
+ };
132
+ export type TInitialState = {
133
+ slides?: TCarouselSlidesState;
134
+ currentPage: string;
135
+ fullScreenPresentation?: boolean;
136
+ isLoggedIn?: boolean;
137
+ [key: string]: any;
138
+ groups: {
139
+ id: string;
140
+ displayName: string;
141
+ ref: string;
142
+ }[];
143
+ currentGroupId: string;
144
+ selectedProducts: {
145
+ [currentGroupId: string]: string;
146
+ };
147
+ };
148
+ export type TPaywallMedia = {
149
+ id: string;
150
+ content: string | null;
151
+ paywall: string;
152
+ name: string;
153
+ };
154
+ export type TProductGroup = {
155
+ id: string;
156
+ display_name: string;
157
+ display_order: number;
158
+ default: boolean;
159
+ paywall: string;
160
+ ref: string;
161
+ };
162
+ export type TMediaTypes = {
163
+ [name: string]: Optional<TPaywallMedia, 'id'>;
164
+ };
165
+ export type TOffer = {
166
+ freeTrialEligible: boolean;
167
+ introEligible: boolean;
168
+ promoEligible: boolean;
169
+ };
@@ -0,0 +1,3 @@
1
+ export type NamiProfile = {
2
+ externalId: string;
3
+ };
@@ -0,0 +1 @@
1
+ export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
@@ -0,0 +1,3 @@
1
+ import { ExtendedPlatformInfo } from "src/types/config";
2
+ export declare const getBaseUrl: (namiCommands?: string[]) => string;
3
+ export declare const getExtendedClientInfo: (namiCommands?: string[]) => ExtendedPlatformInfo;
@@ -0,0 +1 @@
1
+ export declare const PRODUCTION: string, DEVELOPMENT: string, PLATFORM_ID_REQUIRED: string, DEVICE_ID_REQUIRED: string, EXTERNAL_ID_REQUIRED: string, REQUEST_EMPTY: string, SDK_NOT_INITIALIZED: string, CAMPAIGN_NOT_AVAILABLE: string, AUTH_DEVICE: string, NAMI_CONFIGURATION: string, NAMI_PROFILE: string, API_CONFIG: string, API_CAMPAIGN_RULES: string, API_PAYWALLS: string, API_PRODUCTS: string, INITIAL_APP_CONFIG: string, INITIAL_CAMPAIGN_RULES: string, INITIAL_PAYWALLS: string, INITIAL_PRODUCTS: string, CUSTOMER_ATTRIBUTES_KEY_PREFIX: string, BASE_URL: string, BASE_STAGING_URL: string, CUSTOM_HOST_PREFIX: string, USE_STAGING_API: string, EXTENDED_CLIENT_INFO_PREFIX: string, EXTENDED_CLIENT_INFO_DELIMITER: string, EXTENDED_PLATFORM: string, EXTENDED_PLATFORM_VERSION: string, API_MAX_CALLS_LIMIT: number, API_RETRY_DELAY_SEC: number, STATUS_SUCCESS: number, STATUS_BAD_REQUEST: number, STATUS_NOT_FOUND: number, STATUS_INTERNAL_SERVER_ERROR: number, INITIAL_SUCCESS: string, RECONFIG_SUCCESS: string, ALREADY_CONFIGURED: string, AVAILABLE_CAMPAIGNS_CHANGED: string, SKU_TEXT_REGEX: RegExp, VAR_REGEX: RegExp, CORS_PROXY_URL: string, CORS_PROXY_URL_LOCAL: string;
@@ -0,0 +1,2 @@
1
+ import { DevicePayload } from "src/types/device";
2
+ export declare const getDeviceData: (namiCommands?: string[]) => DevicePayload;
@@ -0,0 +1,7 @@
1
+ import { FontDetails } from "src/types/paywall";
2
+ export declare function prepareAndLoadFonts(fontsObject: {
3
+ [key: string]: any;
4
+ }): Promise<FontFaceSet>;
5
+ export declare const loadFonts: (fonts: FontDetails[]) => Promise<FontFaceSet>;
6
+ export declare function buildFontFaceFamily(font: FontDetails): string;
7
+ export declare function sanitizeFontName(value: string): string;