@namiml/web-sdk 1.3.1 → 1.4.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/components/ContextConsumer.d.ts +1 -1
  3. package/dist/components/ContextProvider.d.ts +7 -7
  4. package/dist/components/Paywall.d.ts +4 -4
  5. package/dist/components/TemplateComponent.d.ts +1 -1
  6. package/dist/components/containers/BackgroundContainer.d.ts +2 -1
  7. package/dist/components/containers/CollapseContainer.d.ts +1 -1
  8. package/dist/components/containers/Container.d.ts +6 -2
  9. package/dist/components/containers/Content.d.ts +1 -1
  10. package/dist/components/containers/Footer.d.ts +1 -1
  11. package/dist/components/containers/Header.d.ts +1 -1
  12. package/dist/components/containers/ProductContainer.d.ts +1 -1
  13. package/dist/components/containers/ResponsiveGrid.d.ts +9 -0
  14. package/dist/components/elements/Button.d.ts +4 -1
  15. package/dist/components/elements/Image.d.ts +1 -1
  16. package/dist/components/elements/SegmentPicker.d.ts +1 -1
  17. package/dist/components/elements/SegmentPickerItem.d.ts +1 -1
  18. package/dist/components/elements/Spacer.d.ts +1 -1
  19. package/dist/components/elements/Text.d.ts +1 -1
  20. package/dist/components/elements/Video.d.ts +2 -1
  21. package/dist/components/index.d.ts +3 -1
  22. package/dist/components/productDetails.d.ts +2 -2
  23. package/dist/components/utils/actionTap.d.ts +2 -2
  24. package/dist/components/utils/dateTIme.d.ts +3 -0
  25. package/dist/components/utils/helpers.d.ts +6 -5
  26. package/dist/components/utils/impression.d.ts +2 -2
  27. package/dist/components/utils/products.d.ts +4 -3
  28. package/dist/components/utils/state.d.ts +6 -4
  29. package/dist/components/utils/styles.d.ts +4 -3
  30. package/dist/nami/api.d.ts +4 -3
  31. package/dist/nami/campaign.d.ts +36 -10
  32. package/dist/nami/customer.d.ts +58 -14
  33. package/dist/nami/entitlement.d.ts +22 -5
  34. package/dist/nami/index.d.ts +7 -1
  35. package/dist/nami/namiRefs.d.ts +1 -1
  36. package/dist/nami/paywalls.d.ts +49 -18
  37. package/dist/nami/purchase.d.ts +5 -1
  38. package/dist/nami/utils/campaign.d.ts +2 -2
  39. package/dist/nami/utils/entitlement.d.ts +4 -4
  40. package/dist/nami/utils/paywall.d.ts +1 -1
  41. package/dist/nami/utils/purchase.d.ts +2 -2
  42. package/dist/nami-web.cjs +14 -15
  43. package/dist/nami-web.d.ts +8 -879
  44. package/dist/nami-web.js +14 -15
  45. package/dist/nami-web.mjs +14 -15
  46. package/dist/nami-web.umd.js +14 -15
  47. package/dist/repositories/campaignRule.repository.d.ts +3 -3
  48. package/dist/repositories/config.repository.d.ts +1 -1
  49. package/dist/repositories/customerJourney.repository.d.ts +5 -0
  50. package/dist/repositories/device.repository.d.ts +1 -1
  51. package/dist/repositories/entitlement.repository.d.ts +1 -1
  52. package/dist/repositories/paywall.repository.d.ts +1 -1
  53. package/dist/repositories/products.repository.d.ts +1 -1
  54. package/dist/services/logger.service.d.ts +1 -1
  55. package/dist/services/storage.service.d.ts +7 -1
  56. package/dist/types/components/containers.d.ts +11 -2
  57. package/dist/types/components/elements.d.ts +1 -0
  58. package/dist/types/components/index.d.ts +2 -2
  59. package/dist/types/config.d.ts +2 -2
  60. package/dist/types/customer.d.ts +2 -0
  61. package/dist/types/entitlements.d.ts +2 -0
  62. package/dist/types/externals/campaign.d.ts +9 -1
  63. package/dist/types/externals/config.d.ts +27 -1
  64. package/dist/types/externals/customer.d.ts +18 -0
  65. package/dist/types/externals/entitlement.d.ts +27 -0
  66. package/dist/types/externals/index.d.ts +3 -0
  67. package/dist/types/externals/languages.d.ts +197 -1
  68. package/dist/types/{loglevel.d.ts → externals/loglevel.d.ts} +3 -0
  69. package/dist/types/externals/paywall.d.ts +31 -0
  70. package/dist/types/externals/product.d.ts +4 -0
  71. package/dist/types/externals/purchase.d.ts +24 -0
  72. package/dist/types/externals/sku.d.ts +14 -0
  73. package/dist/types/paywall.d.ts +8 -7
  74. package/dist/types/profile.d.ts +2 -1
  75. package/dist/utils/config.d.ts +2 -1
  76. package/dist/utils/const.d.ts +1 -1
  77. package/dist/utils/device.d.ts +1 -1
  78. package/dist/utils/fonts.d.ts +1 -1
  79. package/package.json +5 -4
  80. /package/dist/types/{errors.d.ts → externals/errors.d.ts} +0 -0
@@ -1,10 +1,14 @@
1
- import { NamiActiveEntitlementsHandler, NamiEntitlement } from "src/types/entitlements";
2
- import { Callback } from "src/types/components/containers";
1
+ import { NamiActiveEntitlementsHandler, NamiEntitlement } from "../types/entitlements";
2
+ import { Callback } from "../types/components/containers";
3
+ /**
4
+ * @class NamiEntitlementManager
5
+ * Contains all methods and objects to work with entitlements in the SDK.
6
+ */
3
7
  export declare class NamiEntitlementManager {
4
8
  static instance: NamiEntitlementManager;
5
9
  private emitter;
6
10
  /**
7
- * @returns list of currently active entitlements
11
+ * @returns {NamiEntitlement[]} A list of currently active entitlements
8
12
  */
9
13
  static active(): NamiEntitlement[];
10
14
  /**
@@ -12,16 +16,29 @@ export declare class NamiEntitlementManager {
12
16
  * and it's not expired.
13
17
  *
14
18
  * @param referenceId - entitlement referenceId
15
- * @returns True if the entitlement is active for given referenceId, false otherwise.
19
+ * @returns {boolean} True if the entitlement is active for given referenceId, false otherwise.
16
20
  */
17
21
  static isEntitlementActive(referenceId: string): boolean;
18
22
  /**
19
23
  * Asks Nami to fetch the latest active entitlements
20
24
  *
21
- * @returns list of NamiEntitlement
25
+ * @returns {Promise<NamiEntitlement[]>} A promise that resolves to a list of NamiEntitlement
22
26
  */
23
27
  static refresh(): Promise<NamiEntitlement[]>;
28
+ /**
29
+ * When there has been an update received to the active entitlements,
30
+ * the Nami SDK will provide notification of that event through
31
+ * this callback with list of active [NamiEntitlement]
32
+ *
33
+ * @param {NamiActiveEntitlementsHandler} handler - The callback function that will be invoked when the campaign list is updated.
34
+ * @returns {Callback} A function that can be called to unregister the handler.
35
+ */
24
36
  static registerActiveEntitlementsHandler(handler: NamiActiveEntitlementsHandler): Callback | undefined;
37
+ /**
38
+ * Clear any provisional entitlement grants, which are entitlements issued on-device only.
39
+ * Useful for development and purchase testing. Not recommended to be called in production.
40
+ */
41
+ static clearProvisionalEntitlementGrants(): void;
25
42
  /**
26
43
  * Private Instance Methods
27
44
  */
@@ -1,8 +1,14 @@
1
- import { NamiConfiguration, NamiConfigurationState } from "src/types/config";
1
+ import { NamiConfiguration, NamiConfigurationState } from "../types/config";
2
2
  export declare class Nami {
3
3
  #private;
4
4
  static instance: Nami;
5
5
  get isInitialized(): boolean;
6
+ /**
7
+ * Configures and initializes the SDK.
8
+ * This method must be called as the first thing before interacting with the SDK.
9
+ * @param with A [NamiConfiguration] object with required values
10
+ * @returns {Promise<NamiConfigurationState>}
11
+ */
6
12
  static configure(options: NamiConfiguration): Promise<NamiConfigurationState>;
7
13
  private static setInitialConfig;
8
14
  private initializeSDK;
@@ -1,4 +1,4 @@
1
- import { NamiConfiguration } from "src/types/config";
1
+ import { NamiConfiguration } from "../types/config";
2
2
  export declare class NamiRefs {
3
3
  static instance: NamiRefs;
4
4
  init(config: NamiConfiguration): Promise<void>;
@@ -1,34 +1,65 @@
1
- import { IPaywall } from "src/types/paywall";
2
- import { NamiProductDetails } from "src/types/externals/product";
3
- import { Callback } from "src/types/components/containers";
4
- import { NamiPurchaseDetails } from "src/types/externals/purchase";
1
+ import { IPaywall } from "../types/paywall";
2
+ import { NamiProductDetails } from "../types/externals/product";
3
+ import { Callback, CloseHandler, DeepLinkUrlHandler, SKUActionHandler } from "../types/components/containers";
4
+ import { NamiPurchaseDetails } from "../types/externals/purchase";
5
+ /**
6
+ * @class NamiPaywallManager
7
+ * Provides methods for managing all aspects of a paywall in the Nami SDK.
8
+ */
5
9
  export declare class NamiPaywallManager {
6
10
  static instance: NamiPaywallManager;
7
11
  private emitter;
8
12
  productDetails: NamiProductDetails[];
13
+ /**
14
+ * @returns {IPaywall[]} a list of Paywall
15
+ */
9
16
  static allPaywalls(): IPaywall[];
17
+ /**
18
+ * Used to set product details when store products are unavailable. For advanced use cases only.
19
+ */
10
20
  static setProductDetails(productDetails: NamiProductDetails[]): void;
21
+ /**
22
+ * Register a callback which would be invoked when user will sign-in
23
+ */
11
24
  static registerSignInHandler(handler: Callback): Callback;
12
- static registerCloseHandler(handler: Callback): Callback;
13
- static registerDeeplinkActionHandler(handler: Callback): Callback;
14
- static registerBuySkuHandler(handler: Callback): Callback;
25
+ /**
26
+ * Register a callback which would be invoked when user close a paywall raised by Nami system
27
+ */
28
+ static registerCloseHandler(handler: CloseHandler): Callback;
29
+ /**
30
+ * Register a callback which would be invoked when user will take action on deeplink
31
+ */
32
+ static registerDeeplinkActionHandler(handler: DeepLinkUrlHandler): Callback;
33
+ /**
34
+ * Register a [NamiBuySkuHandler] which would be invoked when a user triggers
35
+ * a buy sku action on a paywall.
36
+ *
37
+ * Only available for plans where Nami is not handling subscription & IAP management.
38
+ */
39
+ static registerBuySkuHandler(handler: SKUActionHandler): Callback;
40
+ /**
41
+ * Register a callback which would be invoked when user restore a product
42
+ */
15
43
  static registerRestoreHandler(handler: Callback): Callback;
16
44
  /**
17
- * Notify the NamiPaywallManager that a purchase initiated from the
18
- * [NamiBuySkuHandler] is complete. Only available for plans where Nami is
19
- * not handling subscription & IAP management.
20
- */
45
+ * Notify the NamiPaywallManager that a purchase initiated from the
46
+ * [NamiBuySkuHandler] is complete.
47
+ *
48
+ * Only available for plans where Nami is not handling subscription & IAP management.
49
+ *
50
+ * @returns {Promise<void>} A Promise that resolves when buying SKU will be complete.
51
+ */
21
52
  static buySkuComplete(purchase: NamiPurchaseDetails): Promise<void>;
22
53
  /**
23
- Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
24
- Used to disable product purchase-in-progress loading indicators
25
- */
54
+ * Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
55
+ * Used to disable product purchase-in-progress loading indicators
56
+ */
26
57
  static buySkuCancel(): void;
27
58
  /**
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
- */
59
+ * Set the video details for the app supplied video
60
+ * @param url The URL of the video
61
+ * @param name The name of the video
62
+ */
32
63
  static setAppSuppliedVideoDetails(url: string, name?: string): void;
33
64
  /**
34
65
  * Private Instance Methods
@@ -1,4 +1,8 @@
1
- import { NamiPurchase } from "src/types/externals/purchase";
1
+ import { NamiPurchase } from "../types/externals/purchase";
2
+ /**
3
+ * @class NamiPurchaseManager
4
+ * Provides methods for managing all aspects of a purchase in the Nami SDK.
5
+ */
2
6
  export declare class NamiPurchaseManager {
3
7
  static instance: NamiPurchaseManager;
4
8
  static allPurchases(): NamiPurchase[];
@@ -1,5 +1,5 @@
1
- import { NamiCampaign } from "src/types/externals/campaign";
2
- import { IPaywall } from "src/types/paywall";
1
+ import { NamiCampaign } from "../../types/externals/campaign";
2
+ import { IPaywall } from "../../types/paywall";
3
3
  export declare const isValidUrl: (label: string) => boolean;
4
4
  export declare const allCampaigns: () => NamiCampaign[];
5
5
  export declare const getPaywallDataFromLabel: (value: string, type?: string) => {
@@ -1,7 +1,7 @@
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";
1
+ import { IEntitlements, NamiEntitlement } from "../../types/entitlements";
2
+ import { NamiPurchase } from "../../types/externals/purchase";
3
+ import { PaywallSKU, SKU } from "../../types/sku";
4
+ import { NamiSKU } from "../../types/externals/sku";
5
5
  export declare class EntitlementUtils {
6
6
  static instance: EntitlementUtils;
7
7
  refIdToPurchasedSKUs: {
@@ -1,2 +1,2 @@
1
- import { IPaywall } from "src/types/paywall";
1
+ import { IPaywall } from "../../types/paywall";
2
2
  export declare const allPaywalls: () => IPaywall[];
@@ -1,4 +1,4 @@
1
- import { NamiPurchaseCompleteResult } from "src/types/purchase";
2
- import { NamiPurchaseDetails, NamiPurchase } from "src/types/externals/purchase";
1
+ import { NamiPurchaseCompleteResult } from "../../types/purchase";
2
+ import { NamiPurchaseDetails, NamiPurchase } from "../../types/externals/purchase";
3
3
  export declare function toNamiPurchase(purchase: NamiPurchaseDetails): NamiPurchase;
4
4
  export declare function namiBuySKU(skuRefId: string): NamiPurchaseCompleteResult | undefined;