@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.0 (July 26, 2024)
|
|
4
|
+
|
|
5
|
+
### New Features
|
|
6
|
+
- **NamiCampaignManager.launch** - Implemented `paywallLaunchContext` in `NamiCampaignManager.launch` in order to provide the paywall additional details.
|
|
7
|
+
- **NamiPaywallManager.buySKUCancel** - Implemented `NamiPaywallManager.buySKUCancel` to let Nami know the user has canceled their paywall purchase.
|
|
8
|
+
- **NamiPayallManager.buySKUComplete** - Implemented `NamiPaywallManager.buySKUComplete` to let Nami know the user has completed their paywall purchase.
|
|
9
|
+
- **Impression / Conversion Reporting** - Implemented impression / conversion reporting for paywall analytics.
|
|
10
|
+
- **Improved paywall load time** - Paywalls render signficantly faster when immediately displayed.
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
- Provide consistent typing with other Nami SDKs.
|
|
14
|
+
- Provide consistent APIs with other Nami SDKs.
|
|
15
|
+
|
|
3
16
|
## 1.1.0 (June 24, 2024)
|
|
4
17
|
|
|
5
18
|
### 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,45 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { IPaywall, TPaywallContext, TPaywallLaunchContext, TPaywallMedia } from 'src/types/paywall';
|
|
3
|
+
import { NamiProductDetails } from 'src/types/products';
|
|
4
|
+
import { NamiSKU } from 'src/types/sku';
|
|
5
|
+
export declare const initialState: TPaywallContext;
|
|
6
|
+
type Callback = () => void;
|
|
7
|
+
declare class ContextProvider implements ReactiveController {
|
|
8
|
+
host: ReactiveControllerHost | null;
|
|
9
|
+
state: TPaywallContext;
|
|
10
|
+
subscribers: Set<Callback>;
|
|
11
|
+
productDetails: NamiProductDetails[];
|
|
12
|
+
constructor();
|
|
13
|
+
subscribe(callback: Callback): Callback;
|
|
14
|
+
unsubscribe(callback: Callback): void;
|
|
15
|
+
hostConnected(): void;
|
|
16
|
+
hostDisconnected(): void;
|
|
17
|
+
private setState;
|
|
18
|
+
setProductDetails(details: NamiProductDetails[]): void;
|
|
19
|
+
getProductDetails(): NamiProductDetails[];
|
|
20
|
+
setCurrentGroupId(currentGroupId: string): void;
|
|
21
|
+
currentGroupId(): string;
|
|
22
|
+
setSelectedProdcuts(products: {
|
|
23
|
+
[currentGroupId: string]: string;
|
|
24
|
+
}): void;
|
|
25
|
+
selectedProducts(): {
|
|
26
|
+
[currentGroupId: string]: string;
|
|
27
|
+
};
|
|
28
|
+
setPaywall(paywall: IPaywall, context?: TPaywallLaunchContext): void;
|
|
29
|
+
paywallId(): string;
|
|
30
|
+
setCurrentPage(page: string): void;
|
|
31
|
+
setCustomerAttribute(attributes: {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
}): void;
|
|
34
|
+
removeCustomerAttribute(key: string): void;
|
|
35
|
+
setIsLoggedIn(isLoggedIn: boolean): void;
|
|
36
|
+
setMediaList(media: TPaywallMedia[]): void;
|
|
37
|
+
setSafeAreaTop(safeAreaTop: number): void;
|
|
38
|
+
setFullScreenPresentation(fullScreenPresentation: boolean): void;
|
|
39
|
+
setFormFactor(formFactor: string): void;
|
|
40
|
+
setPurchaseInProgress(inProgress: boolean): void;
|
|
41
|
+
setPurchase(inProgress: boolean, product?: NamiSKU): void;
|
|
42
|
+
setTimeSpentOnPaywall(time: number): void;
|
|
43
|
+
}
|
|
44
|
+
declare const contextProvider: ContextProvider;
|
|
45
|
+
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,17 @@
|
|
|
1
|
+
import { IPaywall, NamiPaywallEvent, TPaywallLaunchContext } from 'src/types/paywall';
|
|
2
|
+
import { TDevice } from 'src/types/device';
|
|
3
|
+
import { NamiElement } from './NamiElement';
|
|
4
|
+
import { TemplateResult } from 'lit';
|
|
5
|
+
import { CampaignRule } from 'src/types/campaign';
|
|
6
|
+
declare class PaywallComponent extends NamiElement {
|
|
7
|
+
private formFactor;
|
|
8
|
+
private campaign;
|
|
9
|
+
private paywall;
|
|
10
|
+
private paywallEvent;
|
|
11
|
+
constructor(paywall: IPaywall, formFactor: TDevice, event: Partial<NamiPaywallEvent>, campaign?: CampaignRule, context?: TPaywallLaunchContext);
|
|
12
|
+
firstUpdated(): void;
|
|
13
|
+
private getTemplate;
|
|
14
|
+
styles(): import("lit").CSSResult;
|
|
15
|
+
render(): TemplateResult;
|
|
16
|
+
}
|
|
17
|
+
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,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,10 @@
|
|
|
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
|
+
protected styles(): CSSResult;
|
|
8
|
+
private _offerState;
|
|
9
|
+
render(): any[][];
|
|
10
|
+
}
|
|
@@ -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(): any[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
private getComponentStyles;
|
|
11
|
+
private formatKey;
|
|
12
|
+
private applyStyles;
|
|
13
|
+
protected styles(): CSSResult;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
15
|
+
}
|
|
@@ -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,30 @@
|
|
|
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
|
+
declare global {
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
"nami-spacer": NamiSpacer;
|
|
16
|
+
"nami-button": NamiButton;
|
|
17
|
+
"nami-text": NamiText;
|
|
18
|
+
"nami-segment-picker": NamiSegmentPicker;
|
|
19
|
+
"nami-segment-picker-item": NamiSegmentPickerItem;
|
|
20
|
+
"nami-header": NamiHeader;
|
|
21
|
+
"nami-footer": NamiFooter;
|
|
22
|
+
"nami-container": NamiContainer;
|
|
23
|
+
"nami-product-container": NamiProductContainer;
|
|
24
|
+
"nami-image": NamiImage;
|
|
25
|
+
"nami-background-container": NamiBackgroundContainer;
|
|
26
|
+
"nami-content-container": NamiContentContainer;
|
|
27
|
+
"nami-symbol": NamiSymbol;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export { NamiSpacer, NamiButton, NamiHeader, NamiFooter, NamiText, NamiSegmentPicker, NamiSegmentPickerItem, NamiContainer, NamiProductContainer, NamiImage, NamiBackgroundContainer, NamiContentContainer, NamiSymbol };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UserAction } from "src/types/components/containers";
|
|
2
|
+
import { NamiSKU } from "src/types/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,18 @@
|
|
|
1
|
+
import { NamiProductDetails, NamiProductOffer, NamiSubscriptionPeriod, PricingPhase } from "src/types/products";
|
|
2
|
+
import { PaywallSKU } from "src/types/sku";
|
|
3
|
+
export declare function getStandardBillingPeriod(product: NamiProductDetails): string | undefined;
|
|
4
|
+
export declare function getFreeTrialPeriod(product: NamiProductDetails): string | undefined;
|
|
5
|
+
export declare function getFreeTrialOffer(product: NamiProductDetails): NamiProductOffer | undefined;
|
|
6
|
+
export declare function extractStandardPricingPhases(product: NamiProductDetails): PricingPhase[];
|
|
7
|
+
export declare function convertOfferToPricingPhase(offer: NamiProductOffer | null, subPeriod?: NamiSubscriptionPeriod): PricingPhase;
|
|
8
|
+
export declare function convertISO8601PeriodToText(iso8601Period?: string, singular?: boolean, justPeriod?: boolean, justNumber?: boolean): string | null;
|
|
9
|
+
export declare function getCurrencyFormat(priceCurrencyCode: string): Intl.NumberFormat;
|
|
10
|
+
export declare const getPriceDifference: (currentSkuPricePerMonth?: number, referencedSkuPricePerMonth?: number, currencyFormat?: Intl.NumberFormat) => string | null;
|
|
11
|
+
export declare const getPercentagePriceDifference: (currentSkuPrice?: number, currentSkuDurationInMonths?: number, referencedSkuPrice?: number, referencedSkuPeriodInMonths?: number) => string | null;
|
|
12
|
+
export declare const getReferenceSku: (skus: PaywallSKU[], referenceId: string) => PaywallSKU | undefined;
|
|
13
|
+
export declare const getPricePerMonth: (phase: PricingPhase) => number;
|
|
14
|
+
export declare const getPeriodNumberInDays: (billingPeriod: string) => number;
|
|
15
|
+
export declare const getPeriodNumberInWeeks: (billingPeriod: string) => number;
|
|
16
|
+
export declare const getBillingPeriodNumber: (billingPeriod: string) => number;
|
|
17
|
+
export declare const formattedPrice: (price: number) => number;
|
|
18
|
+
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/products";
|
|
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,21 @@
|
|
|
1
|
+
import { TBaseComponent, TContainerPosition } from "src/types/components";
|
|
2
|
+
import { 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;
|
|
@@ -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 @@
|
|
|
1
|
+
export declare function withRetry<T>(url: string, options?: RequestInit, retries?: number): Promise<T>;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
timeoutRequest<T>(url: string, options: RequestInit, timeout: number): Promise<T>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AvailableCampaignsResponseHandler, CampaignRule } from "src/types/campaign";
|
|
2
|
+
import { NamiPaywallActionHandler, TPaywallLaunchContext, PaywallResultHandler } from "src/types/paywall";
|
|
3
|
+
import { PaywallComponent } from "src/components/Paywall";
|
|
4
|
+
import { Callback } from "src/types/components/containers";
|
|
5
|
+
export declare class NamiCampaignManager {
|
|
6
|
+
static instance: NamiCampaignManager;
|
|
7
|
+
private emitter;
|
|
8
|
+
static allCampaigns(): CampaignRule[];
|
|
9
|
+
/**
|
|
10
|
+
* Checks if a campaign is available for a given label.
|
|
11
|
+
*
|
|
12
|
+
* @param label - The label of the campaign to check.
|
|
13
|
+
* @returns True if the campaign is available, false otherwise.
|
|
14
|
+
*/
|
|
15
|
+
static isCampaignAvailable(label: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if a campaign is available for a given URL.
|
|
18
|
+
*
|
|
19
|
+
* @param url - The deeplink URL of the campaign to check.
|
|
20
|
+
* @returns True if the campaign is available, false otherwise.
|
|
21
|
+
*/
|
|
22
|
+
static isCampaignAvailable(url: URL): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a campaign is available for a given type and value.
|
|
25
|
+
*
|
|
26
|
+
* @param params - An object containing the type and value of the campaign to check.
|
|
27
|
+
* @returns True if the campaign is available, false otherwise.
|
|
28
|
+
*/
|
|
29
|
+
static isCampaignAvailable(params: {
|
|
30
|
+
type?: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}): boolean;
|
|
33
|
+
static refresh(): Promise<CampaignRule[]>;
|
|
34
|
+
static registerAvailableCampaignsHandler(handler: AvailableCampaignsResponseHandler): Callback;
|
|
35
|
+
/**
|
|
36
|
+
* Launches a campaign with a given label.
|
|
37
|
+
* @param label - The label of the campaign to launch.
|
|
38
|
+
* @param withUrl - The deeplink URL of the campaign to launch.
|
|
39
|
+
* @param actionCallback - Optional handler for paywall actions.
|
|
40
|
+
* @returns - The launched paywall web component.
|
|
41
|
+
*/
|
|
42
|
+
static launch(label?: string, withUrl?: string, context?: TPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallComponent | void;
|
|
43
|
+
/**
|
|
44
|
+
* Private Instance Methods
|
|
45
|
+
*/
|
|
46
|
+
private get sdkInitialized();
|
|
47
|
+
}
|
|
@@ -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 {};
|