@namiml/web-sdk 1.1.0 → 1.3.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 +34 -0
- package/dist/components/ContextConsumer.d.ts +11 -0
- package/dist/components/ContextProvider.d.ts +53 -0
- package/dist/components/NamiElement.d.ts +10 -0
- package/dist/components/Paywall.d.ts +20 -0
- package/dist/components/TemplateComponent.d.ts +2 -0
- package/dist/components/containers/BackgroundContainer.d.ts +10 -0
- package/dist/components/containers/CollapseContainer.d.ts +12 -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 +12 -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 +12 -0
- package/dist/components/elements/Spacer.d.ts +9 -0
- package/dist/components/elements/Text.d.ts +27 -0
- package/dist/components/elements/Video.d.ts +10 -0
- package/dist/components/index.d.ts +34 -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 +19 -0
- package/dist/components/utils/state.d.ts +13 -0
- package/dist/components/utils/styles.d.ts +25 -0
- package/dist/core/errors.d.ts +46 -0
- package/dist/core/withRetry.d.ts +2 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/nami/api.d.ts +19 -0
- package/dist/nami/campaign.d.ts +38 -0
- package/dist/nami/customer.d.ts +91 -0
- package/dist/nami/emitter.d.ts +12 -0
- package/dist/nami/entitlement.d.ts +29 -0
- package/dist/nami/index.d.ts +9 -0
- package/dist/nami/namiRefs.d.ts +8 -0
- package/dist/nami/paywalls.d.ts +37 -0
- package/dist/nami/profile.d.ts +12 -0
- package/dist/nami/purchase.d.ts +5 -0
- package/dist/nami/utils/campaign.d.ts +8 -0
- package/dist/nami/utils/entitlement.d.ts +55 -0
- package/dist/nami/utils/paywall.d.ts +2 -0
- package/dist/nami/utils/purchase.d.ts +4 -0
- package/dist/nami-web.cjs +22 -22
- package/dist/nami-web.d.ts +337 -169
- package/dist/nami-web.js +21 -21
- package/dist/nami-web.mjs +21 -21
- package/dist/nami-web.umd.js +22 -22
- 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/entitlement.repository.d.ts +11 -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 +68 -0
- package/dist/types/api.d.ts +28 -0
- package/dist/types/campaign.d.ts +16 -0
- package/dist/types/components/containers.d.ts +71 -0
- package/dist/types/components/elements.d.ts +82 -0
- package/dist/types/components/index.d.ts +121 -0
- package/dist/types/config.d.ts +44 -0
- package/dist/types/device.d.ts +35 -0
- package/dist/types/entitlements.d.ts +19 -0
- package/dist/types/errors.d.ts +11 -0
- package/dist/types/externals/campaign.d.ts +19 -0
- package/dist/types/externals/config.d.ts +22 -0
- package/dist/types/externals/entitlement.d.ts +11 -0
- package/dist/types/externals/index.d.ts +8 -0
- package/dist/types/externals/languages.d.ts +1 -0
- package/dist/types/externals/paywall.d.ts +73 -0
- package/dist/types/externals/product.d.ts +28 -0
- package/dist/types/externals/purchase.d.ts +18 -0
- package/dist/types/externals/sku.d.ts +17 -0
- package/dist/types/loglevel.d.ts +7 -0
- package/dist/types/paywall.d.ts +184 -0
- package/dist/types/products.d.ts +6 -0
- package/dist/types/profile.d.ts +20 -0
- package/dist/types/purchase.d.ts +32 -0
- package/dist/types/sku.d.ts +22 -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/feature-flags.d.ts +1 -0
- package/dist/utils/fonts.d.ts +7 -0
- package/dist/utils/helpers.d.ts +1 -0
- package/dist/utils/ssr-shim.d.ts +1 -0
- package/package.json +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.0 (August 12, 2024)
|
|
4
|
+
|
|
5
|
+
### New Features
|
|
6
|
+
- **NamiEntitlementManager** - Implemented `NamiEntitlementManager` for Nami to manage entitlements.
|
|
7
|
+
- **NamiEntitlementManager.active** - Retrieve all active entitlements for a user on the current device.
|
|
8
|
+
- **NamiEntitlementManager.isEntitlementActive** - Check if a single entitlement is currently active.
|
|
9
|
+
- **NamiEntitlementManager.refresh** - Manually trigger a refresh of the user's latest active entitlements from the Nami services.
|
|
10
|
+
- **NamiEntitlementManager.registerActiveEntitlementsHandler** - Register a callback to react to a potential changes to the active entitlements for the user
|
|
11
|
+
- **NamiEntitlement** - Object that contains data about an entitlement on the Nami Platform.
|
|
12
|
+
- **Support hidden components** - Hide components without removing them from your paywalls.
|
|
13
|
+
- **New components** - Video and collapsable components.
|
|
14
|
+
- **Improved timeout and error handling**
|
|
15
|
+
|
|
16
|
+
## Bug Fixes
|
|
17
|
+
- Provide consistent typing with other Nami SDKs.
|
|
18
|
+
- Updated the JavaScript version to ECMAScript2021 for better backward compatability.
|
|
19
|
+
|
|
20
|
+
## Breaking changes
|
|
21
|
+
- `NamiConfiguration`'s `appPlatformId` is now `appPlatformID` for consistentcy with other Nami SDKs
|
|
22
|
+
- `NamiPaywallManager.buySkuComplete` has a much simpler (but modified) interface.
|
|
23
|
+
|
|
24
|
+
## 1.2.0 (July 26, 2024)
|
|
25
|
+
|
|
26
|
+
### New Features
|
|
27
|
+
- **NamiCampaignManager.launch** - Implemented `paywallLaunchContext` in `NamiCampaignManager.launch` in order to provide the paywall additional details.
|
|
28
|
+
- **NamiPaywallManager.buySKUCancel** - Implemented `NamiPaywallManager.buySKUCancel` to let Nami know the user has canceled their paywall purchase.
|
|
29
|
+
- **NamiPayallManager.buySKUComplete** - Implemented `NamiPaywallManager.buySKUComplete` to let Nami know the user has completed their paywall purchase.
|
|
30
|
+
- **Impression / Conversion Reporting** - Implemented impression / conversion reporting for paywall analytics.
|
|
31
|
+
- **Improved paywall load time** - Paywalls render signficantly faster when immediately displayed.
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
- Provide consistent typing with other Nami SDKs.
|
|
35
|
+
- Provide consistent APIs with other Nami SDKs.
|
|
36
|
+
|
|
3
37
|
## 1.1.0 (June 24, 2024)
|
|
4
38
|
|
|
5
39
|
### New Features
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { TPaywallContext } from 'src/types/paywall';
|
|
3
|
+
declare class ContextConsumer implements ReactiveController {
|
|
4
|
+
host: ReactiveControllerHost;
|
|
5
|
+
state: TPaywallContext;
|
|
6
|
+
constructor(host: ReactiveControllerHost);
|
|
7
|
+
handleStateChange(): void;
|
|
8
|
+
hostConnected(): void;
|
|
9
|
+
hostDisconnected(): void;
|
|
10
|
+
}
|
|
11
|
+
export default ContextConsumer;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { IPaywall, NamiAppSuppliedVideoDetails, TPaywallContext, TPaywallLaunchContext, TPaywallMedia } from 'src/types/paywall';
|
|
3
|
+
import { NamiProductDetails } from 'src/types/externals/product';
|
|
4
|
+
import { NamiSKU } from 'src/types/externals/sku';
|
|
5
|
+
import { NamiCampaign } from 'src/types/externals/campaign';
|
|
6
|
+
import { TDevice } from 'src/types/device';
|
|
7
|
+
export declare const initialState: TPaywallContext;
|
|
8
|
+
type Callback = () => void;
|
|
9
|
+
declare class ContextProvider implements ReactiveController {
|
|
10
|
+
host: ReactiveControllerHost | null;
|
|
11
|
+
state: TPaywallContext;
|
|
12
|
+
subscribers: Set<Callback>;
|
|
13
|
+
productDetails: NamiProductDetails[];
|
|
14
|
+
constructor();
|
|
15
|
+
subscribe(callback: Callback): Callback;
|
|
16
|
+
unsubscribe(callback: Callback): void;
|
|
17
|
+
hostConnected(): void;
|
|
18
|
+
hostDisconnected(): void;
|
|
19
|
+
private setState;
|
|
20
|
+
setProductDetails(details: NamiProductDetails[]): void;
|
|
21
|
+
getProductDetails(): NamiProductDetails[];
|
|
22
|
+
setCurrentGroupId(currentGroupId: string): void;
|
|
23
|
+
currentGroupId(): string;
|
|
24
|
+
setSelectedProdcuts(products: {
|
|
25
|
+
[currentGroupId: string]: string;
|
|
26
|
+
}): void;
|
|
27
|
+
selectedProducts(): {
|
|
28
|
+
[currentGroupId: string]: string;
|
|
29
|
+
};
|
|
30
|
+
setPaywall(paywall: IPaywall, context?: TPaywallLaunchContext, campaign?: NamiCampaign): void;
|
|
31
|
+
getSelectedPaywall(): IPaywall | undefined;
|
|
32
|
+
getSelectedCampaign(): NamiCampaign | undefined;
|
|
33
|
+
paywallId(): string;
|
|
34
|
+
setCurrentPage(page: string): void;
|
|
35
|
+
setCustomerAttribute(attributes: {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
}): void;
|
|
38
|
+
removeCustomerAttribute(key: string): void;
|
|
39
|
+
setIsLoggedIn(isLoggedIn: boolean): void;
|
|
40
|
+
setMediaList(media: TPaywallMedia[]): void;
|
|
41
|
+
setSafeAreaTop(safeAreaTop: number): void;
|
|
42
|
+
setFullScreenPresentation(fullScreenPresentation: boolean): void;
|
|
43
|
+
setFormFactor(formFactor: TDevice): void;
|
|
44
|
+
getFormFactor(): TDevice;
|
|
45
|
+
setPurchaseInProgress(inProgress: boolean): void;
|
|
46
|
+
setPurchase(inProgress: boolean, product?: NamiSKU): void;
|
|
47
|
+
setTimeSpentOnPaywall(time: number): void;
|
|
48
|
+
setAppSuppliedVideoDetails({ url, name }: NamiAppSuppliedVideoDetails): void;
|
|
49
|
+
resetAppSuppliedVideoDetails(): void;
|
|
50
|
+
setLaunchDetails(value: string, type?: string): void;
|
|
51
|
+
}
|
|
52
|
+
declare const contextProvider: ContextProvider;
|
|
53
|
+
export default contextProvider;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSResult, LitElement, PropertyValueMap } from "lit";
|
|
2
|
+
import ContextConsumer from "./ContextConsumer";
|
|
3
|
+
export declare class NamiElement extends LitElement {
|
|
4
|
+
contextConsumer: ContextConsumer;
|
|
5
|
+
constructor();
|
|
6
|
+
protected styles(): CSSResult;
|
|
7
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
8
|
+
protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IPaywall, TPaywallLaunchContext } from 'src/types/paywall';
|
|
2
|
+
import { TDevice } from 'src/types/device';
|
|
3
|
+
import { NamiElement } from './NamiElement';
|
|
4
|
+
import { TemplateResult } from 'lit';
|
|
5
|
+
import { NamiCampaign } from 'src/types/externals/campaign';
|
|
6
|
+
import { NamiPaywallEvent } from 'src/types/externals/paywall';
|
|
7
|
+
declare class PaywallComponent extends NamiElement {
|
|
8
|
+
formFactor: TDevice;
|
|
9
|
+
campaign: NamiCampaign;
|
|
10
|
+
paywall: IPaywall;
|
|
11
|
+
paywallEvent: Partial<NamiPaywallEvent>;
|
|
12
|
+
constructor(paywall: IPaywall, event: Partial<NamiPaywallEvent>, campaign?: NamiCampaign, context?: TPaywallLaunchContext);
|
|
13
|
+
setPaywallData(paywall: IPaywall, campaign: NamiCampaign): void;
|
|
14
|
+
firstUpdated(): void;
|
|
15
|
+
private postImpression;
|
|
16
|
+
private getTemplate;
|
|
17
|
+
styles(): import("lit").CSSResult;
|
|
18
|
+
render(): TemplateResult;
|
|
19
|
+
}
|
|
20
|
+
export { PaywallComponent };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TContainer } from "src/types/components";
|
|
2
|
+
import { NamiElement } from "../NamiElement";
|
|
3
|
+
import { CSSResult } from "lit";
|
|
4
|
+
export declare class NamiBackgroundContainer extends NamiElement {
|
|
5
|
+
component: TContainer;
|
|
6
|
+
fullscreen: boolean;
|
|
7
|
+
inFocusedState: boolean;
|
|
8
|
+
protected styles(): CSSResult;
|
|
9
|
+
render(): any[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { NamiElement } from '../NamiElement';
|
|
3
|
+
import { TCollapseContainer } from 'src/types/components/containers';
|
|
4
|
+
export declare class NamiCollapseContainer extends NamiElement {
|
|
5
|
+
component: TCollapseContainer;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
height: number;
|
|
8
|
+
constructor();
|
|
9
|
+
private _handleClick;
|
|
10
|
+
protected styles(): CSSResult;
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { TContainer } from 'src/types/components';
|
|
3
|
+
import { NamiElement } from '../NamiElement';
|
|
4
|
+
import { TProductContainer } from 'src/types/components/containers';
|
|
5
|
+
export declare class NamiContainer extends NamiElement {
|
|
6
|
+
component: TContainer | TProductContainer;
|
|
7
|
+
inFocusedState: boolean;
|
|
8
|
+
protected styles(): CSSResult;
|
|
9
|
+
render(): any[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSResult } from "lit";
|
|
2
|
+
import { NamiElement } from "../NamiElement";
|
|
3
|
+
import { TContainer } from "src/types/components";
|
|
4
|
+
export declare class NamiContentContainer extends NamiElement {
|
|
5
|
+
component: TContainer;
|
|
6
|
+
zIndex: number;
|
|
7
|
+
inFocusedState: boolean;
|
|
8
|
+
protected styles(): CSSResult;
|
|
9
|
+
render(): any[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { NamiElement } from '../NamiElement';
|
|
3
|
+
import { THeaderFooter } from 'src/types/components/containers';
|
|
4
|
+
export declare class NamiFooter extends NamiElement {
|
|
5
|
+
components: THeaderFooter;
|
|
6
|
+
zIndex: string;
|
|
7
|
+
inFocusedState: boolean;
|
|
8
|
+
protected styles(): CSSResult;
|
|
9
|
+
render(): any[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { NamiElement } from '../NamiElement';
|
|
3
|
+
import { THeaderFooter } from 'src/types/components/containers';
|
|
4
|
+
export declare class NamiHeader extends NamiElement {
|
|
5
|
+
components: THeaderFooter;
|
|
6
|
+
zIndex: string;
|
|
7
|
+
inFullScreen: boolean;
|
|
8
|
+
inFocusedState: boolean;
|
|
9
|
+
protected styles(): CSSResult;
|
|
10
|
+
render(): any[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { NamiElement } from '../NamiElement';
|
|
3
|
+
import { TProductContainer } from 'src/types/components/containers';
|
|
4
|
+
export declare class NamiProductContainer extends NamiElement {
|
|
5
|
+
component: TProductContainer;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
private currentGroupId;
|
|
8
|
+
protected styles(): CSSResult;
|
|
9
|
+
updated(): void;
|
|
10
|
+
private _offerState;
|
|
11
|
+
render(): any[][];
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { TButtonContainer } from 'src/types/components/containers';
|
|
3
|
+
import { NamiElement } from '../NamiElement';
|
|
4
|
+
export declare class NamiButton extends NamiElement {
|
|
5
|
+
component: TButtonContainer;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
private _handleClick;
|
|
9
|
+
protected styles(): CSSResult;
|
|
10
|
+
render(): any[] | import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TImageComponent } from "src/types/components/elements";
|
|
2
|
+
import { NamiElement } from "../NamiElement";
|
|
3
|
+
import { CSSResult, TemplateResult } from "lit";
|
|
4
|
+
export declare class NamiImage extends NamiElement {
|
|
5
|
+
component: TImageComponent;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
protected styles(): CSSResult;
|
|
8
|
+
protected render(): TemplateResult;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { TSegmentPicker } from 'src/types/components/elements';
|
|
3
|
+
import { NamiElement } from '../NamiElement';
|
|
4
|
+
export declare class NamiSegmentPicker extends NamiElement {
|
|
5
|
+
component: TSegmentPicker;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
private _handleClick;
|
|
9
|
+
protected styles(): CSSResult;
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { TSegmentPickerItem } from 'src/types/components/elements';
|
|
3
|
+
import { NamiElement } from '../NamiElement';
|
|
4
|
+
export declare class NamiSegmentPickerItem extends NamiElement {
|
|
5
|
+
component: TSegmentPickerItem;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
private _handleClick;
|
|
9
|
+
private _handleHover;
|
|
10
|
+
protected styles(): CSSResult;
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSSResult, TemplateResult } from 'lit';
|
|
2
|
+
import { NamiElement } from '../NamiElement';
|
|
3
|
+
import { TSpacerComponent } from 'src/types/components/elements';
|
|
4
|
+
export declare class NamiSpacer extends NamiElement {
|
|
5
|
+
component: TSpacerComponent;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
protected styles(): CSSResult;
|
|
8
|
+
render(): TemplateResult;
|
|
9
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TemplateResult, CSSResult } from 'lit';
|
|
2
|
+
import { TSymbolComponent, TTextComponent, TTextListComponent } from 'src/types/components/elements';
|
|
3
|
+
import { NamiElement } from '../NamiElement';
|
|
4
|
+
export declare class NamiText extends NamiElement {
|
|
5
|
+
component: TTextComponent;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
protected styles(): CSSResult;
|
|
8
|
+
render(): TemplateResult;
|
|
9
|
+
}
|
|
10
|
+
export declare class TextListItemWrapper extends NamiElement {
|
|
11
|
+
component: TTextListComponent;
|
|
12
|
+
inFocusedState: boolean;
|
|
13
|
+
protected styles(): CSSResult;
|
|
14
|
+
render(): TemplateResult;
|
|
15
|
+
}
|
|
16
|
+
export declare class NamiSymbol extends NamiElement {
|
|
17
|
+
component: TSymbolComponent;
|
|
18
|
+
inFocusedState: boolean;
|
|
19
|
+
protected styles(): CSSResult;
|
|
20
|
+
render(): TemplateResult;
|
|
21
|
+
}
|
|
22
|
+
export declare class NamiTextList extends NamiElement {
|
|
23
|
+
component: TTextListComponent;
|
|
24
|
+
inFocusedState: boolean;
|
|
25
|
+
protected styles(): CSSResult;
|
|
26
|
+
render(): TemplateResult;
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TVideoComponent } from "src/types/components/elements";
|
|
2
|
+
import { NamiElement } from "../NamiElement";
|
|
3
|
+
import { CSSResult, TemplateResult } from "lit";
|
|
4
|
+
export declare class NamiVideo extends NamiElement {
|
|
5
|
+
component: TVideoComponent;
|
|
6
|
+
inFocusedState: boolean;
|
|
7
|
+
protected styles(): CSSResult;
|
|
8
|
+
updated(): void;
|
|
9
|
+
protected render(): TemplateResult;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NamiSpacer } from "./elements/Spacer";
|
|
2
|
+
import { NamiButton } from "./elements/Button";
|
|
3
|
+
import { NamiHeader } from "./containers/Header";
|
|
4
|
+
import { NamiFooter } from "./containers/Footer";
|
|
5
|
+
import { NamiSymbol, NamiText } from "./elements/Text";
|
|
6
|
+
import { NamiContainer } from "./containers/Container";
|
|
7
|
+
import { NamiProductContainer } from "./containers/ProductContainer";
|
|
8
|
+
import { NamiImage } from "./elements/Image";
|
|
9
|
+
import { NamiBackgroundContainer } from "./containers/BackgroundContainer";
|
|
10
|
+
import { NamiContentContainer } from "./containers/Content";
|
|
11
|
+
import { NamiSegmentPicker } from "./elements/SegmentPicker";
|
|
12
|
+
import { NamiSegmentPickerItem } from "./elements/SegmentPickerItem";
|
|
13
|
+
import { NamiVideo } from "./elements/Video";
|
|
14
|
+
import { NamiCollapseContainer } from "./containers/CollapseContainer";
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
"nami-spacer": NamiSpacer;
|
|
18
|
+
"nami-button": NamiButton;
|
|
19
|
+
"nami-text": NamiText;
|
|
20
|
+
"nami-segment-picker": NamiSegmentPicker;
|
|
21
|
+
"nami-segment-picker-item": NamiSegmentPickerItem;
|
|
22
|
+
"nami-header": NamiHeader;
|
|
23
|
+
"nami-footer": NamiFooter;
|
|
24
|
+
"nami-container": NamiContainer;
|
|
25
|
+
"nami-product-container": NamiProductContainer;
|
|
26
|
+
"nami-image": NamiImage;
|
|
27
|
+
"nami-background-container": NamiBackgroundContainer;
|
|
28
|
+
"nami-content-container": NamiContentContainer;
|
|
29
|
+
"nami-symbol": NamiSymbol;
|
|
30
|
+
"nami-video": NamiVideo;
|
|
31
|
+
"nami-collapse-container": NamiCollapseContainer;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export { NamiSpacer, NamiButton, NamiHeader, NamiFooter, NamiText, NamiSegmentPicker, NamiSegmentPickerItem, NamiContainer, NamiProductContainer, NamiImage, NamiBackgroundContainer, NamiContentContainer, NamiSymbol, NamiVideo, NamiCollapseContainer };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UserAction } from "src/types/components/containers";
|
|
2
|
+
import { NamiSKU } from "src/types/externals/sku";
|
|
3
|
+
export declare const handleAction: (onTap?: UserAction, sku?: NamiSKU) => void;
|
|
4
|
+
export declare const closePaywallHandler: () => void;
|
|
5
|
+
export declare const restorePurchase: () => void;
|
|
6
|
+
export declare const signIn: () => void;
|
|
7
|
+
export declare const deepLink: (url?: string) => void;
|
|
8
|
+
export declare const buySKU: (onTap: UserAction, sku: NamiSKU) => NamiSKU;
|
|
9
|
+
export declare const navigateToScreen: (screen?: string) => void;
|
|
10
|
+
export declare const setState: () => void;
|
|
11
|
+
export declare const selectSKU: (sku: NamiSKU) => void;
|
|
12
|
+
export declare const purchaseSelectedSKU: (sku: NamiSKU) => void;
|
|
13
|
+
export declare const reloadProducts: () => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const
|
|
2
|
+
/**
|
|
3
|
+
* Constant value of action taps
|
|
4
|
+
*/
|
|
5
|
+
NAMI_CLOSE_PAYWALL: string, NAMI_RESTORE_PURCHASES: string, NAMI_SIGN_IN: string, NAMI_BUY_SKU: string, SET_STATE: string, NAMI_SELECT_SKU: string, NAMI_PURCHASE_SELECTED_SKU: string, NAMI_DEEP_LINK: string, NAMI_NAVIGATE_TO_SCREEN: string, NAMI_RELOAD_PRODUCTS: string, UNSUPPORTED: string, NAMI_PURCHASE_SUCCESS: string, NAMI_PURCHASE_CANCELLED: string, NAMI_PURCHASE_FAILED: string, NAMI_PURCHASE_PENDING: string, NAMI_PURCHASE_UNKNOWN: string, NAMI_SHOW_PAYWALL: string, NAMI_PAGE_CHANGE: string, NAMI_TOGGLE_CHANGE: string, NAMI_SLIDE_CHANGE: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TBaseComponent, TComponent } from "src/types/components";
|
|
2
|
+
import { TButtonContainer, TProductContainer } from "src/types/components/containers";
|
|
3
|
+
import { TConditionalComponent } from "src/types/components/elements";
|
|
4
|
+
import { TPaywallMedia } from "src/types/paywall";
|
|
5
|
+
import { PaywallSKU } from "src/types/sku";
|
|
6
|
+
type ReplacementsType = {
|
|
7
|
+
[type: string]: any extends Array<any> ? never : any;
|
|
8
|
+
};
|
|
9
|
+
export declare function interpolate<T>(value: T, replacements: ReplacementsType): T;
|
|
10
|
+
export declare function getInterpolatedButtonComponents(component: TButtonContainer): TComponent[];
|
|
11
|
+
export declare function getSkuButtonComponents(items: PaywallSKU[], component: TProductContainer, mediaList?: {
|
|
12
|
+
[mediaName: string]: Pick<TPaywallMedia, 'content'>;
|
|
13
|
+
}, additionalVariableStates?: object): [boolean, TComponent[]][];
|
|
14
|
+
export declare function conditionComponentMatches(condition: TConditionalComponent): boolean;
|
|
15
|
+
export declare function withOverrides<T extends TBaseComponent>({ conditionAttributes, ...component }: T): T;
|
|
16
|
+
export declare function valueFromSmartText<T>(value: T, sku?: PaywallSKU): T;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function iconByName(name: string): any;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Impression } from "src/types/api";
|
|
2
|
+
import { TransactionRequest } from "src/types/purchase";
|
|
3
|
+
export declare const postImpression: (options: Impression) => Promise<void>;
|
|
4
|
+
export declare const postConversion: (transactionInfo: TransactionRequest) => Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NamiProductDetails, NamiProductOffer, NamiSubscriptionPeriod } from "src/types/externals/product";
|
|
2
|
+
import { PricingPhase } from "src/types/products";
|
|
3
|
+
import { PaywallSKU } from "src/types/sku";
|
|
4
|
+
export declare function getStandardBillingPeriod(product: NamiProductDetails): string | undefined;
|
|
5
|
+
export declare function getFreeTrialPeriod(product: NamiProductDetails): string | undefined;
|
|
6
|
+
export declare function getFreeTrialOffer(product: NamiProductDetails): NamiProductOffer | undefined;
|
|
7
|
+
export declare function extractStandardPricingPhases(product: NamiProductDetails): PricingPhase[];
|
|
8
|
+
export declare function convertOfferToPricingPhase(offer: NamiProductOffer | null, subPeriod?: NamiSubscriptionPeriod): PricingPhase;
|
|
9
|
+
export declare function convertISO8601PeriodToText(iso8601Period?: string, singular?: boolean, justPeriod?: boolean, justNumber?: boolean): string | null;
|
|
10
|
+
export declare function getCurrencyFormat(priceCurrencyCode: string): Intl.NumberFormat;
|
|
11
|
+
export declare const getPriceDifference: (currentSkuPricePerMonth?: number, referencedSkuPricePerMonth?: number, currencyFormat?: Intl.NumberFormat) => string | null;
|
|
12
|
+
export declare const getPercentagePriceDifference: (currentSkuPrice?: number, currentSkuDurationInMonths?: number, referencedSkuPrice?: number, referencedSkuPeriodInMonths?: number) => string | null;
|
|
13
|
+
export declare const getReferenceSku: (skus: PaywallSKU[], referenceId: string) => PaywallSKU | undefined;
|
|
14
|
+
export declare const getPricePerMonth: (phase: PricingPhase) => number;
|
|
15
|
+
export declare const getPeriodNumberInDays: (billingPeriod: string) => number;
|
|
16
|
+
export declare const getPeriodNumberInWeeks: (billingPeriod: string) => number;
|
|
17
|
+
export declare const getBillingPeriodNumber: (billingPeriod: string) => number;
|
|
18
|
+
export declare const formattedPrice: (price: number) => number;
|
|
19
|
+
export declare function toDouble(num: number): number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ISkuMenu, TInitialState } from "src/types/paywall";
|
|
2
|
+
import { NamiProductDetails } from "src/types/externals/product";
|
|
3
|
+
import { PaywallSKU } from "src/types/sku";
|
|
4
|
+
export declare function currentSku(productDetails: NamiProductDetails[], initialState: TInitialState, skuMenus: ISkuMenu[], skus: PaywallSKU[]): {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
export declare function skuItems(productDetails: NamiProductDetails[], skuMenus: ISkuMenu[], currentGroupId: string): PaywallSKU[];
|
|
8
|
+
export declare function getSkuSmartTextValue(productDetail?: NamiProductDetails | null, sku?: PaywallSKU, skus?: PaywallSKU[]): {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
export declare function checkAnySkuHasTrialOffer(productDetails: NamiProductDetails[], skuMenus: ISkuMenu[], productGroups: string[]): boolean;
|
|
12
|
+
export declare function checkAnySkuHasPromoOffer(productDetails: NamiProductDetails[], skuMenus: ISkuMenu[], productGroups: string[]): boolean;
|
|
13
|
+
export declare function productDetail(details: NamiProductDetails[] | undefined, skuName: string): NamiProductDetails | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TBaseComponent, TContainerPosition } from "src/types/components";
|
|
2
|
+
import { TSegmentPickerItem, TTextLikeComponent } from "src/types/components/elements";
|
|
3
|
+
export declare function parseSize(value: string | number): string;
|
|
4
|
+
export declare function backgroundColor(value: string): string;
|
|
5
|
+
export declare function pickAndApplyBackgroundColor(component: TBaseComponent, inFocusedState?: boolean): string;
|
|
6
|
+
export declare function flexDirection({ direction }: TBaseComponent): string;
|
|
7
|
+
export declare function applyTextOverflow(component: TTextLikeComponent): string;
|
|
8
|
+
export declare function transition(): string;
|
|
9
|
+
export declare function grow({ grow }: TBaseComponent): string;
|
|
10
|
+
export declare function paddingAndMargin(component: TBaseComponent): string;
|
|
11
|
+
export declare function transform({ moveX, moveY, }: TBaseComponent): string;
|
|
12
|
+
export declare function borders(component: TBaseComponent, inFocusedState?: boolean): string;
|
|
13
|
+
export declare function alignItems({ alignment, }: TBaseComponent): string;
|
|
14
|
+
export declare function justifyContent({ alignment, }: TBaseComponent): string;
|
|
15
|
+
export declare function widthAndHeight(component: TBaseComponent): string;
|
|
16
|
+
export declare function zIndex({ zIndex }: TBaseComponent): string;
|
|
17
|
+
export declare function dropShadow(component: TBaseComponent): string;
|
|
18
|
+
export declare function textStrikethrough(value: boolean | undefined): string;
|
|
19
|
+
export declare function font({ fontName }: TTextLikeComponent): string;
|
|
20
|
+
export declare function applyStyles(component: TBaseComponent, inFocusedState?: boolean): string;
|
|
21
|
+
export declare function parsePosition(position?: TContainerPosition): string;
|
|
22
|
+
export declare function getComponentStyles(prefix: string, component: TSegmentPickerItem): TSegmentPickerItem;
|
|
23
|
+
export declare function formatKey(key: string, prefix: string): string;
|
|
24
|
+
export declare function applySegmentStyles(styles: any, inFocusedState: boolean): string;
|
|
25
|
+
export declare function appySegmentFontStyles(styles: any): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare class RetryLimitExceededError extends Error {
|
|
2
|
+
statusCode: number;
|
|
3
|
+
status: number;
|
|
4
|
+
constructor(statusCode: number, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class SDKNotInitializedError extends Error {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
export declare class PlatformIDRequiredError extends Error {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
export declare class DeviceIDRequiredError extends Error {
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
15
|
+
export declare class ExternalIDRequiredError extends Error {
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
export declare class CampaignNotAvailableError extends Error {
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
export declare class AnonymousModeAlreadyOnError extends Error {
|
|
22
|
+
constructor();
|
|
23
|
+
}
|
|
24
|
+
export declare class AnonymousModeAlreadyOffError extends Error {
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
export declare class AnonymousLoginError extends Error {
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
export declare class AnonymousCDPError extends Error {
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
33
|
+
export declare class BadRequestError extends Error {
|
|
34
|
+
constructor(message: string);
|
|
35
|
+
}
|
|
36
|
+
export declare class NotFoundError extends Error {
|
|
37
|
+
constructor(message: string);
|
|
38
|
+
}
|
|
39
|
+
export declare class ClientError extends Error {
|
|
40
|
+
statusCode: number;
|
|
41
|
+
constructor(statusCode: number, message: string);
|
|
42
|
+
}
|
|
43
|
+
export declare class InternalServerError extends Error {
|
|
44
|
+
constructor(message: string);
|
|
45
|
+
}
|
|
46
|
+
export declare const handleErrors: (status: number, path: string) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NamiConfiguration } from "src/types/config";
|
|
2
|
+
import { Impression, LoginResponse } from "src/types/api";
|
|
3
|
+
import { PurchaseValidationRequest, TransactionRequest } from "src/types/purchase";
|
|
4
|
+
export declare class NamiAPI {
|
|
5
|
+
static instance: NamiAPI;
|
|
6
|
+
private baseURL;
|
|
7
|
+
private platformID;
|
|
8
|
+
private get deviceID();
|
|
9
|
+
static configure(config: NamiConfiguration): void;
|
|
10
|
+
protected configure(config: NamiConfiguration): void;
|
|
11
|
+
login(externalId: string): Promise<LoginResponse>;
|
|
12
|
+
logout(): Promise<Record<string, never>>;
|
|
13
|
+
startSession(sessionStartTime: Date): Promise<void>;
|
|
14
|
+
postImpression(options: Impression): Promise<void>;
|
|
15
|
+
postConversion(options: TransactionRequest): Promise<void>;
|
|
16
|
+
purchaseValidation(options: PurchaseValidationRequest): Promise<void>;
|
|
17
|
+
fetchAPI<T>(path: string): Promise<T>;
|
|
18
|
+
requestBodyAPI<T, U>(path: string, bodyData: T, method?: string, keepalive?: boolean, timeout?: number): Promise<U>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AvailableCampaignsResponseHandler } from "src/types/campaign";
|
|
2
|
+
import { TPaywallLaunchContext, PaywallResultHandler } from "src/types/paywall";
|
|
3
|
+
import { PaywallComponent } from "src/components/Paywall";
|
|
4
|
+
import { Callback } from "src/types/components/containers";
|
|
5
|
+
import { NamiPaywallActionHandler } from "src/types/externals/paywall";
|
|
6
|
+
import { NamiCampaign } from "src/types/externals/campaign";
|
|
7
|
+
export declare class NamiCampaignManager {
|
|
8
|
+
static instance: NamiCampaignManager;
|
|
9
|
+
private emitter;
|
|
10
|
+
static allCampaigns(): NamiCampaign[];
|
|
11
|
+
/**
|
|
12
|
+
* Checks if a campaign is available for a given argument.
|
|
13
|
+
* The argument can be a label string, or a deeplink URL.
|
|
14
|
+
*
|
|
15
|
+
* @param label - The argument to check. Can be a label string, or a deeplink URL.
|
|
16
|
+
* @returns True if the campaign is available, false otherwise.
|
|
17
|
+
*/
|
|
18
|
+
static isCampaignAvailable(label: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Asks Nami to fetch the latest active campaigns for this device
|
|
21
|
+
*
|
|
22
|
+
* @returns list of campaigns
|
|
23
|
+
*/
|
|
24
|
+
static refresh(): Promise<NamiCampaign[]>;
|
|
25
|
+
static registerAvailableCampaignsHandler(handler: AvailableCampaignsResponseHandler): Callback;
|
|
26
|
+
/**
|
|
27
|
+
* Launches a campaign with a given label.
|
|
28
|
+
* @param label - The label of the campaign to launch.
|
|
29
|
+
* @param withUrl - The deeplink URL of the campaign to launch.
|
|
30
|
+
* @param actionCallback - Optional handler for paywall actions.
|
|
31
|
+
* @returns - The launched paywall web component.
|
|
32
|
+
*/
|
|
33
|
+
static launch(label?: string, withUrl?: string, context?: TPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallComponent | void;
|
|
34
|
+
/**
|
|
35
|
+
* Private Instance Methods
|
|
36
|
+
*/
|
|
37
|
+
private get sdkInitialized();
|
|
38
|
+
}
|