@namiml/web-sdk 1.2.0 → 1.3.1

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 (58) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/ContextProvider.d.ts +13 -5
  3. package/dist/components/Paywall.d.ts +10 -7
  4. package/dist/components/containers/CollapseContainer.d.ts +12 -0
  5. package/dist/components/containers/ProductContainer.d.ts +2 -0
  6. package/dist/components/elements/SegmentPicker.d.ts +1 -1
  7. package/dist/components/elements/SegmentPickerItem.d.ts +0 -3
  8. package/dist/components/elements/Video.d.ts +10 -0
  9. package/dist/components/index.d.ts +5 -1
  10. package/dist/components/productDetails.d.ts +1 -1
  11. package/dist/components/utils/actionTap.d.ts +1 -1
  12. package/dist/components/utils/impression.d.ts +1 -1
  13. package/dist/components/utils/products.d.ts +2 -1
  14. package/dist/components/utils/state.d.ts +1 -1
  15. package/dist/components/utils/styles.d.ts +5 -1
  16. package/dist/core/withRetry.d.ts +2 -1
  17. package/dist/nami/api.d.ts +0 -1
  18. package/dist/nami/campaign.d.ts +11 -20
  19. package/dist/nami/entitlement.d.ts +29 -0
  20. package/dist/nami/namiRefs.d.ts +1 -0
  21. package/dist/nami/paywalls.d.ts +9 -3
  22. package/dist/nami/purchase.d.ts +5 -0
  23. package/dist/nami/utils/campaign.d.ts +8 -0
  24. package/dist/nami/utils/entitlement.d.ts +55 -0
  25. package/dist/nami/utils/paywall.d.ts +2 -0
  26. package/dist/nami/utils/purchase.d.ts +4 -3
  27. package/dist/nami-web.cjs +10 -8
  28. package/dist/nami-web.d.ts +222 -124
  29. package/dist/nami-web.js +12 -10
  30. package/dist/nami-web.mjs +12 -10
  31. package/dist/nami-web.umd.js +13 -11
  32. package/dist/repositories/campaignRule.repository.d.ts +3 -3
  33. package/dist/repositories/entitlement.repository.d.ts +11 -0
  34. package/dist/services/storage.service.d.ts +12 -5
  35. package/dist/types/campaign.d.ts +6 -11
  36. package/dist/types/components/containers.d.ts +8 -4
  37. package/dist/types/components/elements.d.ts +5 -2
  38. package/dist/types/components/index.d.ts +7 -3
  39. package/dist/types/config.d.ts +7 -6
  40. package/dist/types/entitlements.d.ts +19 -0
  41. package/dist/types/externals/campaign.d.ts +19 -0
  42. package/dist/types/externals/config.d.ts +22 -0
  43. package/dist/types/externals/entitlement.d.ts +11 -0
  44. package/dist/types/externals/index.d.ts +8 -0
  45. package/dist/types/externals/languages.d.ts +1 -0
  46. package/dist/types/externals/paywall.d.ts +73 -0
  47. package/dist/types/externals/product.d.ts +28 -0
  48. package/dist/types/externals/purchase.d.ts +18 -0
  49. package/dist/types/externals/sku.d.ts +17 -0
  50. package/dist/types/paywall.d.ts +16 -54
  51. package/dist/types/products.d.ts +0 -28
  52. package/dist/types/purchase.d.ts +15 -28
  53. package/dist/types/sku.d.ts +6 -19
  54. package/dist/utils/const.d.ts +1 -1
  55. package/dist/utils/feature-flags.d.ts +1 -0
  56. package/dist/utils/helpers.d.ts +1 -0
  57. package/package.json +6 -3
  58. package/dist/types/languages.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.1 (August 12, 2024)
4
+
5
+ ### Bug Fixes
6
+ - `SHOW_PAYWALL` event action is being triggered as `UNKNOWN`
7
+
8
+ ## 1.3.0 (August 12, 2024)
9
+
10
+ ### New Features
11
+ - **NamiEntitlementManager** - Implemented `NamiEntitlementManager` for Nami to manage entitlements.
12
+ - **NamiEntitlementManager.active** - Retrieve all active entitlements for a user on the current device.
13
+ - **NamiEntitlementManager.isEntitlementActive** - Check if a single entitlement is currently active.
14
+ - **NamiEntitlementManager.refresh** - Manually trigger a refresh of the user's latest active entitlements from the Nami services.
15
+ - **NamiEntitlementManager.registerActiveEntitlementsHandler** - Register a callback to react to a potential changes to the active entitlements for the user
16
+ - **NamiEntitlement** - Object that contains data about an entitlement on the Nami Platform.
17
+ - **Support hidden components** - Hide components without removing them from your paywalls.
18
+ - **New components** - Video and collapsable components.
19
+ - **Improved timeout and error handling**
20
+
21
+ ### Bug Fixes
22
+ - Provide consistent typing with other Nami SDKs.
23
+ - Updated the JavaScript version to ECMAScript2021 for better backward compatability.
24
+
25
+ ### Breaking changes
26
+ - `NamiConfiguration`'s `appPlatformId` is now `appPlatformID` for consistentcy with other Nami SDKs
27
+ - `NamiPaywallManager.buySkuComplete` has a much simpler (but modified) interface.
28
+
3
29
  ## 1.2.0 (July 26, 2024)
4
30
 
5
31
  ### New Features
@@ -1,7 +1,9 @@
1
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';
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';
5
7
  export declare const initialState: TPaywallContext;
6
8
  type Callback = () => void;
7
9
  declare class ContextProvider implements ReactiveController {
@@ -25,7 +27,9 @@ declare class ContextProvider implements ReactiveController {
25
27
  selectedProducts(): {
26
28
  [currentGroupId: string]: string;
27
29
  };
28
- setPaywall(paywall: IPaywall, context?: TPaywallLaunchContext): void;
30
+ setPaywall(paywall: IPaywall, context?: TPaywallLaunchContext, campaign?: NamiCampaign): void;
31
+ getSelectedPaywall(): IPaywall | undefined;
32
+ getSelectedCampaign(): NamiCampaign | undefined;
29
33
  paywallId(): string;
30
34
  setCurrentPage(page: string): void;
31
35
  setCustomerAttribute(attributes: {
@@ -36,10 +40,14 @@ declare class ContextProvider implements ReactiveController {
36
40
  setMediaList(media: TPaywallMedia[]): void;
37
41
  setSafeAreaTop(safeAreaTop: number): void;
38
42
  setFullScreenPresentation(fullScreenPresentation: boolean): void;
39
- setFormFactor(formFactor: string): void;
43
+ setFormFactor(formFactor: TDevice): void;
44
+ getFormFactor(): TDevice;
40
45
  setPurchaseInProgress(inProgress: boolean): void;
41
46
  setPurchase(inProgress: boolean, product?: NamiSKU): void;
42
47
  setTimeSpentOnPaywall(time: number): void;
48
+ setAppSuppliedVideoDetails({ url, name }: NamiAppSuppliedVideoDetails): void;
49
+ resetAppSuppliedVideoDetails(): void;
50
+ setLaunchDetails(value: string, type?: string): void;
43
51
  }
44
52
  declare const contextProvider: ContextProvider;
45
53
  export default contextProvider;
@@ -1,15 +1,18 @@
1
- import { IPaywall, NamiPaywallEvent, TPaywallLaunchContext } from 'src/types/paywall';
1
+ import { IPaywall, TPaywallLaunchContext } from 'src/types/paywall';
2
2
  import { TDevice } from 'src/types/device';
3
3
  import { NamiElement } from './NamiElement';
4
4
  import { TemplateResult } from 'lit';
5
- import { CampaignRule } from 'src/types/campaign';
5
+ import { NamiCampaign } from 'src/types/externals/campaign';
6
+ import { NamiPaywallEvent } from 'src/types/externals/paywall';
6
7
  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);
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;
12
14
  firstUpdated(): void;
15
+ private postImpression;
13
16
  private getTemplate;
14
17
  styles(): import("lit").CSSResult;
15
18
  render(): TemplateResult;
@@ -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
+ }
@@ -4,7 +4,9 @@ import { TProductContainer } from 'src/types/components/containers';
4
4
  export declare class NamiProductContainer extends NamiElement {
5
5
  component: TProductContainer;
6
6
  inFocusedState: boolean;
7
+ private currentGroupId;
7
8
  protected styles(): CSSResult;
9
+ updated(): void;
8
10
  private _offerState;
9
11
  render(): any[][];
10
12
  }
@@ -7,5 +7,5 @@ export declare class NamiSegmentPicker extends NamiElement {
7
7
  constructor();
8
8
  private _handleClick;
9
9
  protected styles(): CSSResult;
10
- render(): any[];
10
+ render(): import("lit-html").TemplateResult<1>;
11
11
  }
@@ -7,9 +7,6 @@ export declare class NamiSegmentPickerItem extends NamiElement {
7
7
  constructor();
8
8
  private _handleClick;
9
9
  private _handleHover;
10
- private getComponentStyles;
11
- private formatKey;
12
- private applyStyles;
13
10
  protected styles(): CSSResult;
14
11
  render(): import("lit-html").TemplateResult<1>;
15
12
  }
@@ -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
+ }
@@ -10,6 +10,8 @@ import { NamiBackgroundContainer } from "./containers/BackgroundContainer";
10
10
  import { NamiContentContainer } from "./containers/Content";
11
11
  import { NamiSegmentPicker } from "./elements/SegmentPicker";
12
12
  import { NamiSegmentPickerItem } from "./elements/SegmentPickerItem";
13
+ import { NamiVideo } from "./elements/Video";
14
+ import { NamiCollapseContainer } from "./containers/CollapseContainer";
13
15
  declare global {
14
16
  interface HTMLElementTagNameMap {
15
17
  "nami-spacer": NamiSpacer;
@@ -25,6 +27,8 @@ declare global {
25
27
  "nami-background-container": NamiBackgroundContainer;
26
28
  "nami-content-container": NamiContentContainer;
27
29
  "nami-symbol": NamiSymbol;
30
+ "nami-video": NamiVideo;
31
+ "nami-collapse-container": NamiCollapseContainer;
28
32
  }
29
33
  }
30
- export { NamiSpacer, NamiButton, NamiHeader, NamiFooter, NamiText, NamiSegmentPicker, NamiSegmentPickerItem, NamiContainer, NamiProductContainer, NamiImage, NamiBackgroundContainer, NamiContentContainer, NamiSymbol };
34
+ export { NamiSpacer, NamiButton, NamiHeader, NamiFooter, NamiText, NamiSegmentPicker, NamiSegmentPickerItem, NamiContainer, NamiProductContainer, NamiImage, NamiBackgroundContainer, NamiContentContainer, NamiSymbol, NamiVideo, NamiCollapseContainer };
@@ -1,3 +1,3 @@
1
- import { NamiProductDetails } from "src/types/products";
1
+ import { NamiProductDetails } from "src/types/externals/product";
2
2
  import { PaywallSKU } from "src/types/sku";
3
3
  export declare const getProductDetail: (variableName: string, product?: NamiProductDetails | null, referenceId?: string, skus?: PaywallSKU[]) => unknown;
@@ -1,5 +1,5 @@
1
1
  import { UserAction } from "src/types/components/containers";
2
- import { NamiSKU } from "src/types/sku";
2
+ import { NamiSKU } from "src/types/externals/sku";
3
3
  export declare const handleAction: (onTap?: UserAction, sku?: NamiSKU) => void;
4
4
  export declare const closePaywallHandler: () => void;
5
5
  export declare const restorePurchase: () => void;
@@ -1,4 +1,4 @@
1
1
  import { Impression } from "src/types/api";
2
2
  import { TransactionRequest } from "src/types/purchase";
3
3
  export declare const postImpression: (options: Impression) => Promise<void>;
4
- export declare const postConversion: (transactionInfo?: TransactionRequest) => Promise<void>;
4
+ export declare const postConversion: (transactionInfo: TransactionRequest) => Promise<void>;
@@ -1,4 +1,5 @@
1
- import { NamiProductDetails, NamiProductOffer, NamiSubscriptionPeriod, PricingPhase } from "src/types/products";
1
+ import { NamiProductDetails, NamiProductOffer, NamiSubscriptionPeriod } from "src/types/externals/product";
2
+ import { PricingPhase } from "src/types/products";
2
3
  import { PaywallSKU } from "src/types/sku";
3
4
  export declare function getStandardBillingPeriod(product: NamiProductDetails): string | undefined;
4
5
  export declare function getFreeTrialPeriod(product: NamiProductDetails): string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { ISkuMenu, TInitialState } from "src/types/paywall";
2
- import { NamiProductDetails } from "src/types/products";
2
+ import { NamiProductDetails } from "src/types/externals/product";
3
3
  import { PaywallSKU } from "src/types/sku";
4
4
  export declare function currentSku(productDetails: NamiProductDetails[], initialState: TInitialState, skuMenus: ISkuMenu[], skus: PaywallSKU[]): {
5
5
  [key: string]: any;
@@ -1,5 +1,5 @@
1
1
  import { TBaseComponent, TContainerPosition } from "src/types/components";
2
- import { TTextLikeComponent } from "src/types/components/elements";
2
+ import { TSegmentPickerItem, TTextLikeComponent } from "src/types/components/elements";
3
3
  export declare function parseSize(value: string | number): string;
4
4
  export declare function backgroundColor(value: string): string;
5
5
  export declare function pickAndApplyBackgroundColor(component: TBaseComponent, inFocusedState?: boolean): string;
@@ -19,3 +19,7 @@ export declare function textStrikethrough(value: boolean | undefined): string;
19
19
  export declare function font({ fontName }: TTextLikeComponent): string;
20
20
  export declare function applyStyles(component: TBaseComponent, inFocusedState?: boolean): string;
21
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;
@@ -1 +1,2 @@
1
- export declare function withRetry<T>(url: string, options?: RequestInit, retries?: number): Promise<T>;
1
+ export declare function withRetry<T>(url: string, options?: RequestInit, timeout?: number, retries?: number): Promise<T>;
2
+ export declare function timeoutRequest(url: string, options: RequestInit | undefined, timeout: number): Promise<Response>;
@@ -16,5 +16,4 @@ export declare class NamiAPI {
16
16
  purchaseValidation(options: PurchaseValidationRequest): Promise<void>;
17
17
  fetchAPI<T>(path: string): Promise<T>;
18
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
19
  }
@@ -1,36 +1,27 @@
1
- import { AvailableCampaignsResponseHandler, CampaignRule } from "src/types/campaign";
2
- import { NamiPaywallActionHandler, TPaywallLaunchContext, PaywallResultHandler } from "src/types/paywall";
1
+ import { AvailableCampaignsResponseHandler } from "src/types/campaign";
2
+ import { TPaywallLaunchContext, PaywallResultHandler } from "src/types/paywall";
3
3
  import { PaywallComponent } from "src/components/Paywall";
4
4
  import { Callback } from "src/types/components/containers";
5
+ import { NamiPaywallActionHandler } from "src/types/externals/paywall";
6
+ import { NamiCampaign } from "src/types/externals/campaign";
5
7
  export declare class NamiCampaignManager {
6
8
  static instance: NamiCampaignManager;
7
9
  private emitter;
8
- static allCampaigns(): CampaignRule[];
10
+ static allCampaigns(): NamiCampaign[];
9
11
  /**
10
- * Checks if a campaign is available for a given label.
12
+ * Checks if a campaign is available for a given argument.
13
+ * The argument can be a label string, or a deeplink URL.
11
14
  *
12
- * @param label - The label of the campaign to check.
15
+ * @param label - The argument to check. Can be a label string, or a deeplink URL.
13
16
  * @returns True if the campaign is available, false otherwise.
14
17
  */
15
18
  static isCampaignAvailable(label: string): boolean;
16
19
  /**
17
- * Checks if a campaign is available for a given URL.
20
+ * Asks Nami to fetch the latest active campaigns for this device
18
21
  *
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.
22
+ * @returns list of campaigns
28
23
  */
29
- static isCampaignAvailable(params: {
30
- type?: string;
31
- value: string;
32
- }): boolean;
33
- static refresh(): Promise<CampaignRule[]>;
24
+ static refresh(): Promise<NamiCampaign[]>;
34
25
  static registerAvailableCampaignsHandler(handler: AvailableCampaignsResponseHandler): Callback;
35
26
  /**
36
27
  * Launches a campaign with a given label.
@@ -0,0 +1,29 @@
1
+ import { NamiActiveEntitlementsHandler, NamiEntitlement } from "src/types/entitlements";
2
+ import { Callback } from "src/types/components/containers";
3
+ export declare class NamiEntitlementManager {
4
+ static instance: NamiEntitlementManager;
5
+ private emitter;
6
+ /**
7
+ * @returns list of currently active entitlements
8
+ */
9
+ static active(): NamiEntitlement[];
10
+ /**
11
+ * Checks if a Nami Control Center defined Entitlement has at least one backing purchase
12
+ * and it's not expired.
13
+ *
14
+ * @param referenceId - entitlement referenceId
15
+ * @returns True if the entitlement is active for given referenceId, false otherwise.
16
+ */
17
+ static isEntitlementActive(referenceId: string): boolean;
18
+ /**
19
+ * Asks Nami to fetch the latest active entitlements
20
+ *
21
+ * @returns list of NamiEntitlement
22
+ */
23
+ static refresh(): Promise<NamiEntitlement[]>;
24
+ static registerActiveEntitlementsHandler(handler: NamiActiveEntitlementsHandler): Callback | undefined;
25
+ /**
26
+ * Private Instance Methods
27
+ */
28
+ private get sdkInitialized();
29
+ }
@@ -4,4 +4,5 @@ export declare class NamiRefs {
4
4
  init(config: NamiConfiguration): Promise<void>;
5
5
  private setInitialValues;
6
6
  private initAndFetchRequiredData;
7
+ private reRenderPaywall;
7
8
  }
@@ -1,7 +1,7 @@
1
1
  import { IPaywall } from "src/types/paywall";
2
- import { NamiProductDetails } from "src/types/products";
2
+ import { NamiProductDetails } from "src/types/externals/product";
3
3
  import { Callback } from "src/types/components/containers";
4
- import { Purchase } from "src/types/purchase";
4
+ import { NamiPurchaseDetails } from "src/types/externals/purchase";
5
5
  export declare class NamiPaywallManager {
6
6
  static instance: NamiPaywallManager;
7
7
  private emitter;
@@ -18,12 +18,18 @@ export declare class NamiPaywallManager {
18
18
  * [NamiBuySkuHandler] is complete. Only available for plans where Nami is
19
19
  * not handling subscription & IAP management.
20
20
  */
21
- static buySkuComplete(purchase: Purchase): Promise<void>;
21
+ static buySkuComplete(purchase: NamiPurchaseDetails): Promise<void>;
22
22
  /**
23
23
  Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
24
24
  Used to disable product purchase-in-progress loading indicators
25
25
  */
26
26
  static buySkuCancel(): void;
27
+ /**
28
+ * Set the video details for the app supplied video
29
+ * @param url The URL of the video
30
+ * @param name The name of the video
31
+ */
32
+ static setAppSuppliedVideoDetails(url: string, name?: string): void;
27
33
  /**
28
34
  * Private Instance Methods
29
35
  */
@@ -0,0 +1,5 @@
1
+ import { NamiPurchase } from "src/types/externals/purchase";
2
+ export declare class NamiPurchaseManager {
3
+ static instance: NamiPurchaseManager;
4
+ static allPurchases(): NamiPurchase[];
5
+ }
@@ -0,0 +1,8 @@
1
+ import { NamiCampaign } from "src/types/externals/campaign";
2
+ import { IPaywall } from "src/types/paywall";
3
+ export declare const isValidUrl: (label: string) => boolean;
4
+ export declare const allCampaigns: () => NamiCampaign[];
5
+ export declare const getPaywallDataFromLabel: (value: string, type?: string) => {
6
+ campaign: NamiCampaign | undefined;
7
+ paywall: IPaywall | undefined;
8
+ };
@@ -0,0 +1,55 @@
1
+ import { IEntitlements, NamiEntitlement } from "src/types/entitlements";
2
+ import { NamiPurchase } from "src/types/externals/purchase";
3
+ import { PaywallSKU, SKU } from "src/types/sku";
4
+ import { NamiSKU } from "src/types/externals/sku";
5
+ export declare class EntitlementUtils {
6
+ static instance: EntitlementUtils;
7
+ refIdToPurchasedSKUs: {
8
+ [key: string]: NamiSKU[];
9
+ };
10
+ refIdToRelatedSKUs: {
11
+ [key: string]: NamiSKU[];
12
+ };
13
+ refIdToActivePurchases: {
14
+ [key: string]: NamiPurchase[];
15
+ };
16
+ }
17
+ export declare const toNamiEntitlements: (entitlement: IEntitlements) => NamiEntitlement;
18
+ export declare const setActiveNamiEntitlements: (entitlements: NamiEntitlement[]) => void;
19
+ export declare const activeEntitlements: () => NamiEntitlement[];
20
+ export declare const invokeHandler: () => void;
21
+ export declare const getEntitlementRefIdsForSku: (purchasedSkuId: string) => string[];
22
+ /**
23
+ * Populate a list of [NamiEntitlement] from the entitlements that have been provided by the
24
+ * app config. Also clears any previous list of [NamiEntitlement] from cache
25
+ */
26
+ export declare const createNamiEntitlements: (entitlements?: IEntitlements[]) => NamiEntitlement[];
27
+ /**
28
+ * For namiPurchase instance, it will have a purchasedSKU that will back the activation of
29
+ * the entitlement.
30
+ *
31
+ * The purchaseSku (pSKU) can then be used to retrieve all entitlements activated by that pSKU
32
+ *
33
+ * The entitlement will then be inspected to see if pSKU has yet to be tracked by that
34
+ * entitlement. If it has not, then it will be added.
35
+ *
36
+ * The entitlement will then be inspected to see if there any active purchases that match
37
+ * the NamiSKU. If there isn't any, then the NamiPurchase is then added to the
38
+ * entitlement's list of active purchases
39
+ */
40
+ export declare const applyEntitlementActivation: (namiPurchase: NamiPurchase) => string[];
41
+ /**
42
+ * Using the Nami Purchase object, look up the corresponding NamiSKU
43
+ * and set the NamiEntitlement associated to NamiSKU as an active entitlement
44
+ *
45
+ * @return List of strings where each string is a reference Id of an entitlement
46
+ * that was just successfully activated
47
+ */
48
+ export declare const activateEntitlementByPurchase: (purchase: NamiPurchase) => string[];
49
+ export declare const skuMapFromEntitlements: (entitlements?: IEntitlements[]) => {
50
+ [key: string]: NamiSKU[];
51
+ };
52
+ export declare const updateRelatedSKUsForNamiEntitlement: (entitlementRefId: string, entitlementRefIdToNamiSkus: {
53
+ [key: string]: NamiSKU[];
54
+ }) => void;
55
+ export declare function toNamiSKU(sku: PaywallSKU | SKU): NamiSKU;
@@ -0,0 +1,2 @@
1
+ import { IPaywall } from "src/types/paywall";
2
+ export declare const allPaywalls: () => IPaywall[];
@@ -1,3 +1,4 @@
1
- import { NamiPurchase, Purchase, TransactionRequest } from "src/types/purchase";
2
- export declare function toNamiPurchase(purchase: Purchase): NamiPurchase;
3
- export declare function getTransactionInfo(purchase?: NamiPurchase): TransactionRequest | undefined;
1
+ import { NamiPurchaseCompleteResult } from "src/types/purchase";
2
+ import { NamiPurchaseDetails, NamiPurchase } from "src/types/externals/purchase";
3
+ export declare function toNamiPurchase(purchase: NamiPurchaseDetails): NamiPurchase;
4
+ export declare function namiBuySKU(skuRefId: string): NamiPurchaseCompleteResult | undefined;