@namiml/web-sdk 3.4.0-dev.202604010118 → 3.4.0-dev.202604170506

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 (135) hide show
  1. package/dist/adapters/index.d.ts +1 -0
  2. package/dist/adapters/web-device.adapter.d.ts +14 -0
  3. package/dist/adapters/web-storage.adapter.d.ts +8 -0
  4. package/dist/adapters/web-ui.adapter.d.ts +9 -0
  5. package/dist/components/ContextConsumer.d.ts +1 -1
  6. package/dist/components/ContextProvider.d.ts +32 -87
  7. package/dist/components/NamiElement.d.ts +1 -1
  8. package/dist/components/Paywall.d.ts +1 -5
  9. package/dist/components/PaywallScreen.d.ts +2 -4
  10. package/dist/components/TemplateComponent.d.ts +2 -2
  11. package/dist/components/containers/BackgroundContainer.d.ts +1 -2
  12. package/dist/components/containers/CarouselContainer.d.ts +3 -3
  13. package/dist/components/containers/CollapseContainer.d.ts +3 -3
  14. package/dist/components/containers/Container.d.ts +3 -3
  15. package/dist/components/containers/Content.d.ts +1 -2
  16. package/dist/components/containers/Footer.d.ts +2 -2
  17. package/dist/components/containers/Header.d.ts +2 -2
  18. package/dist/components/containers/ProductContainer.d.ts +2 -2
  19. package/dist/components/containers/RepeatingGrid.d.ts +1 -2
  20. package/dist/components/containers/ResponsiveGrid.d.ts +2 -2
  21. package/dist/components/elements/Button.d.ts +3 -3
  22. package/dist/components/elements/CountdownTimerText.d.ts +2 -3
  23. package/dist/components/elements/Image.d.ts +1 -1
  24. package/dist/components/elements/PlayPauseButton.d.ts +2 -2
  25. package/dist/components/elements/ProgressBar.d.ts +2 -2
  26. package/dist/components/elements/ProgressIndicator.d.ts +2 -2
  27. package/dist/components/elements/QRCode.d.ts +2 -2
  28. package/dist/components/elements/RadioButton.d.ts +2 -2
  29. package/dist/components/elements/SegmentPicker.d.ts +3 -3
  30. package/dist/components/elements/SegmentPickerItem.d.ts +2 -2
  31. package/dist/components/elements/Spacer.d.ts +2 -2
  32. package/dist/components/elements/Stack.d.ts +2 -2
  33. package/dist/components/elements/Text.d.ts +2 -2
  34. package/dist/components/elements/ToggleButton.d.ts +2 -2
  35. package/dist/components/elements/ToggleSwitch.d.ts +2 -2
  36. package/dist/components/elements/Video.d.ts +1 -1
  37. package/dist/components/elements/VolumeButton.d.ts +2 -2
  38. package/dist/components/productDetails.d.ts +1 -1
  39. package/dist/components/utils/actionTap.d.ts +1 -1
  40. package/dist/components/utils/helpers.d.ts +5 -5
  41. package/dist/components/utils/impression.d.ts +2 -2
  42. package/dist/components/utils/products.d.ts +1 -2
  43. package/dist/components/utils/state.d.ts +4 -4
  44. package/dist/components/utils/styles.d.ts +12 -4
  45. package/dist/legacy-support.cjs +213 -25528
  46. package/dist/legacy-support.d.ts +48 -1
  47. package/dist/legacy-support.mjs +213 -25528
  48. package/dist/nami-web.cjs +26 -26
  49. package/dist/nami-web.d.ts +606 -10
  50. package/dist/nami-web.mjs +26 -26
  51. package/dist/nami-web.umd.js +91 -91
  52. package/dist/polyfills.cjs +50 -25519
  53. package/dist/polyfills.js +50 -25519
  54. package/dist/translations/translate.d.ts +1 -6
  55. package/dist/types/externals/campaign.d.ts +2 -62
  56. package/dist/types/externals/config.d.ts +1 -41
  57. package/dist/types/externals/customer.d.ts +1 -18
  58. package/dist/types/externals/entitlement.d.ts +1 -38
  59. package/dist/types/externals/errors.d.ts +1 -12
  60. package/dist/types/externals/flow.d.ts +2 -51
  61. package/dist/types/externals/languages.d.ts +1 -197
  62. package/dist/types/externals/loglevel.d.ts +2 -10
  63. package/dist/types/externals/paywall.d.ts +2 -109
  64. package/dist/types/externals/product.d.ts +1 -32
  65. package/dist/types/externals/purchase.d.ts +1 -42
  66. package/dist/types/externals/sku.d.ts +1 -31
  67. package/dist/utils/animations.d.ts +1 -1
  68. package/dist/utils/fonts.d.ts +1 -1
  69. package/package.json +35 -51
  70. package/dist/core/errors.d.ts +0 -55
  71. package/dist/core/withRetry.d.ts +0 -2
  72. package/dist/decorators/index.d.ts +0 -2
  73. package/dist/nami/api.d.ts +0 -20
  74. package/dist/nami/campaign.d.ts +0 -87
  75. package/dist/nami/customer.d.ts +0 -136
  76. package/dist/nami/emitter.d.ts +0 -13
  77. package/dist/nami/entitlement.d.ts +0 -46
  78. package/dist/nami/flow/NamiFlow.d.ts +0 -77
  79. package/dist/nami/flow/NamiFlowManager.d.ts +0 -77
  80. package/dist/nami/index.d.ts +0 -19
  81. package/dist/nami/namiRefs.d.ts +0 -17
  82. package/dist/nami/paywalls.d.ts +0 -77
  83. package/dist/nami/profile.d.ts +0 -12
  84. package/dist/nami/purchase.d.ts +0 -9
  85. package/dist/nami/utils/campaign.d.ts +0 -29
  86. package/dist/nami/utils/entitlement.d.ts +0 -55
  87. package/dist/nami/utils/index.d.ts +0 -1
  88. package/dist/nami/utils/paywall.d.ts +0 -21
  89. package/dist/nami/utils/purchase.d.ts +0 -4
  90. package/dist/nami/utils/resolvers/BaseNamespaceResolver.d.ts +0 -7
  91. package/dist/nami/utils/resolvers/ConditionalEvaluator.d.ts +0 -19
  92. package/dist/nami/utils/resolvers/DeviceResolver.d.ts +0 -10
  93. package/dist/nami/utils/resolvers/FlowLiquidResolver.d.ts +0 -19
  94. package/dist/nami/utils/resolvers/FormStateResolver.d.ts +0 -7
  95. package/dist/nami/utils/resolvers/LaunchContextResolver.d.ts +0 -8
  96. package/dist/nami/utils/resolvers/PlacementLabelResolver.d.ts +0 -8
  97. package/dist/nami/utils/resolvers/URLParamsResolver.d.ts +0 -7
  98. package/dist/repositories/campaignRule.repository.d.ts +0 -21
  99. package/dist/repositories/config.repository.d.ts +0 -5
  100. package/dist/repositories/customerJourney.repository.d.ts +0 -5
  101. package/dist/repositories/device.repository.d.ts +0 -16
  102. package/dist/repositories/entitlement.repository.d.ts +0 -11
  103. package/dist/repositories/paywall.repository.d.ts +0 -10
  104. package/dist/repositories/products.repository.d.ts +0 -6
  105. package/dist/services/logger.service.d.ts +0 -13
  106. package/dist/services/session.service.d.ts +0 -4
  107. package/dist/services/storage.service.d.ts +0 -90
  108. package/dist/types/api.d.ts +0 -30
  109. package/dist/types/campaign.d.ts +0 -16
  110. package/dist/types/components/animation.d.ts +0 -40
  111. package/dist/types/components/containers.d.ts +0 -182
  112. package/dist/types/components/elements.d.ts +0 -188
  113. package/dist/types/components/index.d.ts +0 -137
  114. package/dist/types/conditions.d.ts +0 -26
  115. package/dist/types/config.d.ts +0 -38
  116. package/dist/types/customer.d.ts +0 -2
  117. package/dist/types/device.d.ts +0 -36
  118. package/dist/types/entitlements.d.ts +0 -21
  119. package/dist/types/flow.d.ts +0 -108
  120. package/dist/types/paywall.d.ts +0 -201
  121. package/dist/types/products.d.ts +0 -6
  122. package/dist/types/profile.d.ts +0 -21
  123. package/dist/types/purchase.d.ts +0 -32
  124. package/dist/types/sku.d.ts +0 -26
  125. package/dist/types/utils.d.ts +0 -1
  126. package/dist/utils/anonymousMode.d.ts +0 -25
  127. package/dist/utils/config.d.ts +0 -10
  128. package/dist/utils/const.d.ts +0 -1
  129. package/dist/utils/device.d.ts +0 -10
  130. package/dist/utils/events.d.ts +0 -30
  131. package/dist/utils/feature-flags.d.ts +0 -1
  132. package/dist/utils/helpers.d.ts +0 -1
  133. package/dist/utils/parsers.d.ts +0 -26
  134. package/dist/utils/simple-event-target.d.ts +0 -7
  135. package/dist/utils/url-params.d.ts +0 -11
@@ -1,4 +1,4 @@
1
- import { FontDetails } from "../types/paywall";
1
+ import { FontDetails } from "@namiml/sdk-core";
2
2
  export declare function prepareAndLoadFonts(fontsObject: {
3
3
  [key: string]: any;
4
4
  }): Promise<FontFaceSet>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@namiml/web-sdk",
3
3
  "type": "module",
4
- "version": "3.4.0-dev.202604010118",
4
+ "version": "3.4.0-dev.202604170506",
5
5
  "source": "src/nami-web.ts",
6
6
  "description": "Subscription monetization infrastructure — drop-in SDK with no-code paywalls, onboarding flows, A/B testing for web",
7
7
  "scripts": {
@@ -12,17 +12,11 @@
12
12
  "dev": "NAMI_SDK_ENV=development rollup -c -w",
13
13
  "build": "NAMI_SDK_ENV=production rollup -c",
14
14
  "build:dev": "NAMI_SDK_ENV=development rollup -c",
15
- "build:prod": "NAMI_SDK_ENV=production rollup -c",
16
- "react-dev": "yarn build:dev && cd examples/react-demo && yarn start",
17
- "react-prod": "yarn build:dev && cd examples/react-demo && yarn start",
18
- "vue-dev": "yarn build:dev && cd examples/vue-demo && yarn serve",
19
- "vue-prod": "yarn build:dev && cd examples/vue-demo && yarn serve",
20
- "lit-dev": "yarn build:dev && cd examples/lit && yarn serve",
21
- "lit-prod": "yarn build:dev && cd examples/lit && yarn serve"
15
+ "build:prod": "NAMI_SDK_ENV=production rollup -c"
22
16
  },
23
17
  "main": "./dist/nami-web.cjs",
24
18
  "module": "./dist/nami-web.mjs",
25
- "types": "dist/nami-web.d.ts",
19
+ "types": "./dist/nami-web.d.ts",
26
20
  "exports": {
27
21
  ".": {
28
22
  "types": "./dist/nami-web.d.ts",
@@ -40,11 +34,11 @@
40
34
  "./polyfills": {
41
35
  "import": "./dist/polyfills.js",
42
36
  "require": "./dist/polyfills.cjs"
43
- },
44
- "./dist/legacy-support.mjs": "./dist/legacy-support.mjs"
37
+ }
45
38
  },
46
39
  "files": [
47
40
  "dist",
41
+ "!dist/**/*.map",
48
42
  "CHANGELOG.md"
49
43
  ],
50
44
  "keywords": [
@@ -67,63 +61,53 @@
67
61
  },
68
62
  "license": "SEE LICENSE FILE",
69
63
  "devDependencies": {
70
- "@babel/core": "^7.28.3",
71
- "@babel/plugin-proposal-class-properties": "^7.18.6",
72
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
73
- "@babel/plugin-proposal-optional-chaining": "^7.21.0",
74
- "@babel/preset-env": "^7.28.3",
75
- "@babel/preset-typescript": "^7.27.1",
64
+ "@babel/core": "^7.29.0",
65
+ "@babel/plugin-transform-class-properties": "^7.28.6",
66
+ "@babel/plugin-transform-classes": "^7.28.6",
67
+ "@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6",
68
+ "@babel/plugin-transform-optional-chaining": "^7.28.6",
69
+ "@babel/plugin-transform-private-methods": "^7.28.6",
70
+ "@babel/plugin-transform-private-property-in-object": "^7.28.6",
71
+ "@babel/preset-env": "^7.29.0",
72
+ "@babel/preset-typescript": "^7.28.5",
76
73
  "@eslint/js": "^9.2.0",
77
74
  "@open-wc/testing": "^4.0.0",
78
75
  "@rollup/plugin-babel": "^6.0.4",
79
- "@rollup/plugin-commonjs": "^28.0.6",
80
- "@rollup/plugin-json": "^6.1.0",
81
- "@rollup/plugin-node-resolve": "^15.2.3",
82
- "@rollup/plugin-replace": "^5.0.5",
83
- "@rollup/plugin-terser": "^0.4.4",
84
- "@rollup/plugin-typescript": "^11.1.6",
76
+ "@rollup/plugin-commonjs": "^28.0.2",
77
+ "@rollup/plugin-node-resolve": "^16.0.0",
78
+ "@rollup/plugin-replace": "^6.0.2",
79
+ "@rollup/plugin-terser": "^1.0.0",
80
+ "@rollup/plugin-typescript": "^12.1.2",
85
81
  "@types/babel__core": "^7",
86
82
  "@types/babel__preset-env": "^7",
87
- "@types/jest": "^29.5.12",
88
- "@types/lodash-es": "^4.17.4",
89
- "@types/node": "^22.2.0",
90
- "@types/pako": "^2",
91
- "@types/qrcode": "^1",
83
+ "@types/jest": "^29.5.14",
84
+ "@types/lodash-es": "^4.17.12",
85
+ "@types/qrcode": "^1.5.5",
92
86
  "@webcomponents/webcomponentsjs": "^2.8.0",
93
87
  "abort-controller": "^3.0.0",
94
- "babel-jest": "^29.7.0",
95
- "buffer": "^6.0.3",
96
- "core-js": "^3.45.1",
88
+ "babel-jest": "^30.2.0",
97
89
  "eslint": "^9.2.0",
98
90
  "jest": "^29.7.0",
99
- "jest-environment-jsdom": "^29.7.0",
91
+ "jest-environment-jsdom": "^30.2.0",
100
92
  "jest-fetch-mock": "^3.0.3",
101
- "microbundle": "^0.15.1",
102
- "prettier": "3.2.5",
103
93
  "rollup": "^4.18.0",
104
94
  "rollup-plugin-dts": "^6.1.1",
105
- "ts-jest": "^29.1.2",
106
- "ts-node": "^10.9.2",
107
- "tslib": "^2.6.3",
95
+ "ts-jest": "^29.4.9",
96
+ "tslib": "^2.8.1",
108
97
  "typescript": "^5.4.5",
109
98
  "typescript-eslint": "^8.0.1",
110
- "url-polyfill": "^1.1.13",
111
- "whatwg-fetch": "^3.6.20",
112
- "wrangler": "^3.66.0"
99
+ "url-polyfill": "^1.1.13"
113
100
  },
114
101
  "dependencies": {
115
- "@lit-labs/ssr-dom-shim": "^1.4.0",
116
- "@lit/context": "^1.1.6",
102
+ "@lit-labs/ssr-dom-shim": "^1.2.1",
103
+ "@lit/context": "^1.1.3",
104
+ "@namiml/sdk-core": "3.4.0-dev.202604170506",
117
105
  "bowser": "^2.11.0",
118
- "date-fns": "^4.1.0",
119
- "date-fns-tz": "^3.2.0",
120
- "hls.js": "^1.5.15",
106
+ "hls.js": "^1.5.18",
121
107
  "lit": "^3.3.1",
122
- "lodash-es": "^4.17.21",
123
108
  "marked": "^12.0.2",
124
- "pako": "^2.1.0",
125
109
  "qrcode": "^1.5.4",
126
- "swiper": "^11.1.12"
110
+ "swiper": "^12.1.2"
127
111
  },
128
112
  "homepage": "https://www.namiml.com",
129
113
  "bugs": {
@@ -135,9 +119,9 @@
135
119
  "directory": "sdk/web"
136
120
  },
137
121
  "sideEffects": [
138
- "dist/polyfills.js",
139
- "dist/legacy-support.mjs",
140
- "dist/legacy-support.cjs"
122
+ "./dist/nami-web.*",
123
+ "./dist/polyfills.*",
124
+ "./dist/legacy-support.*"
141
125
  ],
142
126
  "resolutions": {
143
127
  "@esm-bundle/chai": "4.3.4-fix.0"
@@ -1,55 +0,0 @@
1
- export declare class RetryLimitExceededError extends Error {
2
- statusCode: number;
3
- status: number;
4
- constructor(statusCode: number, message: string);
5
- }
6
- export declare class APIError extends Error {
7
- }
8
- export declare class ConflictError extends APIError {
9
- status: number;
10
- constructor();
11
- }
12
- export declare class SDKNotInitializedError extends Error {
13
- constructor();
14
- }
15
- export declare class PlatformIDRequiredError extends Error {
16
- constructor();
17
- }
18
- export declare class DeviceIDRequiredError extends Error {
19
- constructor();
20
- }
21
- export declare class ExternalIDRequiredError extends Error {
22
- constructor();
23
- }
24
- export declare class CampaignNotAvailableError extends Error {
25
- constructor();
26
- }
27
- export declare class FlowScreensNotAvailableError extends Error {
28
- constructor();
29
- }
30
- export declare class AnonymousModeAlreadyOnError extends Error {
31
- constructor();
32
- }
33
- export declare class AnonymousModeAlreadyOffError extends Error {
34
- constructor();
35
- }
36
- export declare class AnonymousLoginError extends Error {
37
- constructor();
38
- }
39
- export declare class AnonymousCDPError extends Error {
40
- constructor();
41
- }
42
- export declare class BadRequestError extends APIError {
43
- constructor(message: string);
44
- }
45
- export declare class NotFoundError extends APIError {
46
- constructor(message: string);
47
- }
48
- export declare class ClientError extends APIError {
49
- statusCode: number;
50
- constructor(statusCode: number, message: string);
51
- }
52
- export declare class InternalServerError extends APIError {
53
- constructor(message: string);
54
- }
55
- export declare const handleErrors: (status: number, path: string) => void;
@@ -1,2 +0,0 @@
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>;
@@ -1,2 +0,0 @@
1
- export declare function requirePlatformID(target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
2
- export declare function requireDeviceID(target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
@@ -1,20 +0,0 @@
1
- import { NamiConfiguration } from "../types/externals/config";
2
- import { Impression, LoginResponse } from "../types/api";
3
- import { PurchaseValidationRequest, TransactionRequest } from "../types/purchase";
4
- export declare class NamiAPI {
5
- static instance: NamiAPI;
6
- private baseURL;
7
- private platformID;
8
- private get deviceID();
9
- constructor();
10
- static configure(config: NamiConfiguration): void;
11
- protected configure(config: NamiConfiguration): void;
12
- login(externalId: string): Promise<LoginResponse>;
13
- logout(): Promise<Record<string, never>>;
14
- startSession(sessionStartTime: Date): Promise<void>;
15
- postImpression(options: Impression): Promise<void>;
16
- postConversion(options: TransactionRequest): Promise<void>;
17
- purchaseValidation(options: PurchaseValidationRequest): Promise<void>;
18
- fetchAPI<T>(path: string, timeout?: number, retries?: number): Promise<T>;
19
- requestBodyAPI<T, U>(path: string, bodyData: T, method?: string, keepalive?: boolean, timeout?: number, retries?: number): Promise<U>;
20
- }
@@ -1,87 +0,0 @@
1
- import { AvailableCampaignsResponseHandler } from "../types/campaign";
2
- import { PaywallResultHandler } from "../types/paywall";
3
- import { PaywallComponent } from "../components/Paywall";
4
- import { Callback } from "../types/components/containers";
5
- import { NamiPaywallActionHandler, NamiPaywallLaunchContext } from "../types/externals/paywall";
6
- import { NamiCampaign } from "../types/externals/campaign";
7
- /**
8
- * @class NamiCampaignManager
9
- * Provides methods for managing all aspects of a campaign.
10
- */
11
- export declare class NamiCampaignManager {
12
- static instance: NamiCampaignManager;
13
- private emitter;
14
- /**
15
- * @returns {NamiCampaign[]} A list of NamiCampaign
16
- */
17
- static allCampaigns(): NamiCampaign[];
18
- /**
19
- * Checks if a campaign is available for a given argument.
20
- * The argument can be a label string, or a deeplink URL.
21
- *
22
- * @param label - The argument to check. Can be a label string, or a deeplink URL.
23
- * @returns {boolean} True if the campaign is available, False otherwise.
24
- */
25
- static isCampaignAvailable(label: string): boolean;
26
- /**
27
- * Checks if a campaign is a Flow campaign for a given argument.
28
- * The argument can be a label string, or a deeplink URL.
29
- *
30
- * @param label - The label of the campaign to check. Can be a label string.
31
- * @param withUrl - The deeplink URL of the campaign to check.
32
- * @returns {boolean} True if the campaign is a Flow campaign, False otherwise.
33
- */
34
- static isFlow(label?: string, withUrl?: string): boolean;
35
- /**
36
- * Fetches the latest active campaigns for the current device.
37
- *
38
- * @returns {Promise<NamiCampaign[]>} A promise that resolves to a list of active campaigns.
39
- */
40
- static refresh(): Promise<NamiCampaign[]>;
41
- /**
42
- * Registers a handler that will be called whenever there is an update
43
- * in the list of active campaigns. The Nami SDK will trigger this callback
44
- * with the updated list of active campaigns.
45
- *
46
- * The handler will receive an array of `NamiCampaign` objects representing
47
- * the current active campaigns.
48
- *
49
- * @param {AvailableCampaignsResponseHandler} handler - The callback function that will be invoked when the campaign list is updated.
50
- * @returns {Callback} A function that can be called to unregister the handler.
51
- */
52
- static registerAvailableCampaignsHandler(handler: AvailableCampaignsResponseHandler): Callback;
53
- /**
54
- * Launches a campaign with a given label.
55
- * @param label - The label of the campaign to launch.
56
- * @param withUrl - The deeplink URL of the campaign to launch.
57
- * @param actionCallback - Optional handler for paywall actions.
58
- * @returns {PaywallComponent | void} The launched paywall web component.
59
- */
60
- static launch(label?: string, withUrl?: string, context?: NamiPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallComponent;
61
- /**
62
- * Provide the list of product groups supported by the provided placement label or URL.
63
- * @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
64
- * @param uri Campaign placement URI defined in Nami Control Center for launching a specific campaign.
65
- * @return List of product groups associated with the specified campaign placement.
66
- */
67
- static getProductGroups(label?: string, withUrl?: string): string[];
68
- /**
69
- * Get all product SKUs associated with the provided placement label or URL.
70
- * @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
71
- * @param withUrl Campaign placement URI defined in Nami Control Center for launching a specific campaign.
72
- * @returns List of product SKUs associated with the specified campaign placement.
73
- */
74
- static getAllProducts(label?: string, withUrl?: string): string[];
75
- /**
76
- * Get the list of currently active product SKUs associated with the provided placement label or URL.
77
- * @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
78
- * @param withUrl Campaign placement URI defined in Nami Control Center for launching a specific campaign.
79
- * @returns List of current product SKUs associated with the specified campaign placement.
80
- */
81
- static getCurrentProducts(label?: string, withUrl?: string): string[];
82
- /**
83
- * Private Instance Methods
84
- */
85
- private get sdkInitialized();
86
- private campaignTypeAndLabel;
87
- }
@@ -1,136 +0,0 @@
1
- import { Callback } from "../types/components/containers";
2
- import { AccountStateAction } from "../types/profile";
3
- import { NamiCustomerJourneyStateHandler } from "../types/customer";
4
- import { CustomerJourneyState } from "../types/externals/customer";
5
- type AccountStateHandler = (action: AccountStateAction, success: boolean, error?: Error) => void;
6
- /**
7
- * @class NamiCustomerManager
8
- * Provides methods for managing customer-related functionality.
9
- */
10
- export declare class NamiCustomerManager {
11
- static instance: NamiCustomerManager;
12
- private emitter;
13
- constructor();
14
- /**
15
- * Checks if the customer is logged in.
16
- *
17
- * @returns {boolean} Returns true if the customer is logged in, false otherwise.
18
- */
19
- static isLoggedIn(): boolean;
20
- /**
21
- * Returns the external ID of the currently logged in user.
22
- *
23
- * @returns {string | undefined} The external ID of the logged in user.
24
- */
25
- static loggedInId(): string | undefined;
26
- /**
27
- * Logs in a customer with the specified ID.
28
- *
29
- * @param id - The ID of the customer to log in. Must be a SHA256 hash or UUID.
30
- * @returns {Promise<void>} A Promise that resolves when the login is successful.
31
- */
32
- static login(externalId: string): Promise<void>;
33
- /**
34
- * This method detaches the whole platform account from the signed in user
35
- * @returns {Promise<void>} A Promise that resolves when the logout is successful.
36
- */
37
- static logout(): Promise<void>;
38
- /**
39
- * This method for connecting the device to a Customer Data Platform identifier
40
- *
41
- * Advanced use case. Make sure you have user consent.
42
- *
43
- * @param id a value supplied from your CDP platform
44
- * @returns {Promise<void>} A Promise that resolves when CustomerDataPlatformId will be set.
45
- */
46
- static setCustomerDataPlatformId(id: string): Promise<void>;
47
- /**
48
- * This method for clearing the Customer Data Platform identifier linked to this device
49
- *
50
- * Advanced use case.
51
- * @returns {Promise<void>} A Promise that resolves when CustomerDataPlatformId will be cleared.
52
- */
53
- static clearCustomerDataPlatformId(): Promise<void>;
54
- /**
55
- * Registers a callback function to handle changes in the account state.
56
- *
57
- * @param callback - The callback function to be registered.
58
- * @returns {Callback} A function that can be used to unregister the original callback.
59
- */
60
- static registerAccountStateHandler(handler: AccountStateHandler): Callback;
61
- /**
62
- * Sets the anonymous mode for the customer.
63
- *
64
- * @param enabled - A boolean value indicating whether the anonymous mode should be enabled or disabled.
65
- * @returns {Promise<void>} A Promise that resolves when the anonymous mode is set.
66
- */
67
- static setAnonymousMode(enabled: boolean): Promise<void>;
68
- /**
69
- * @returns {boolean} whether or not the SDK is currently operating in anonymous mode
70
- */
71
- static inAnonymousMode(): boolean;
72
- /**
73
- * Sets an optional customer attributes that can be used to personalize your Nami paywalls.
74
- *
75
- * @param key - The name of the attribute. For example: `firstName`.
76
- * @param value - The value of the customer attribute. For example: `Joe`.
77
- */
78
- static setCustomerAttribute(key: string, value: string): void;
79
- /**
80
- * Retrieves the value for a given key in the on-device customer attribute key/value store.
81
- *
82
- * @param key - The name of the attribute. For example: `firstName`
83
- * @returns {string | null} The value of the customer attribute.
84
- */
85
- static getCustomerAttribute(key: string): string | null;
86
- /**
87
- * Retrieves all the customer attribute key/value store.
88
- *
89
- * @returns {string | null} The value of the customer attribute.
90
- */
91
- static getAllCustomerAttributes(): string[];
92
- /**
93
- * Clears a value of the given key in the on-device key/value store.
94
- *
95
- * @param key - The key of the customer attribute to clear.
96
- */
97
- static clearCustomerAttribute(key: string): void;
98
- /**
99
- * Clear all customer attributes from the on-device key/value store.
100
- */
101
- static clearAllCustomerAttributes(): void;
102
- /**
103
- * @return current customer's journey state.
104
- */
105
- static journeyState(): CustomerJourneyState | null;
106
- /**
107
- * @return the unique identifier Nami users to identify this device. Please note
108
- * you should not depend on the device identifier persisting across app re-installs.
109
- */
110
- static deviceId(): string;
111
- /**
112
- * When there has been an update received to the active entitlements,
113
- * the Nami SDK will provide notification of that event through
114
- * this callback with list of active [NamiEntitlement]
115
- *
116
- * @param {NamiCustomerJourneyStateHandler} handler - The callback function that will be invoked when the campaign list is updated.
117
- * @returns {Callback} A function that can be called to unregister the handler.
118
- */
119
- static registerJourneyStateHandler(handler: NamiCustomerJourneyStateHandler): Callback | undefined;
120
- /**
121
- * Private Static Methods
122
- */
123
- private static invokeStateHandler;
124
- /**
125
- * Private Instance Methods
126
- */
127
- private get isSDKInitialized();
128
- private static updateCustomerDataPlatformId;
129
- /**
130
- * @returns whether or not the configured app platform id belongs to an anonymous mode
131
- * capable Nami account.
132
- */
133
- private static anonymousModeCapability;
134
- private static refetchConfig;
135
- }
136
- export {};
@@ -1,13 +0,0 @@
1
- export declare class NamiEventEmitter {
2
- private static instance;
3
- private emitter;
4
- static getInstance(): NamiEventEmitter;
5
- on(eventName: string, listener: (...args: any[]) => void): void;
6
- off(eventName: string, listener: (...args: any[]) => void): void;
7
- emit(eventName: string, ...args: any[]): void;
8
- addListener(eventName: string, listener: (...args: any[]) => void): void;
9
- removeListener(eventName: string, listener: (...args: any[]) => void): void;
10
- removeAllListeners(eventName?: string): void;
11
- listeners(eventName: string): any[];
12
- listenerCount(eventName: string): number;
13
- }
@@ -1,46 +0,0 @@
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
- */
7
- export declare class NamiEntitlementManager {
8
- static instance: NamiEntitlementManager;
9
- private emitter;
10
- /**
11
- * @returns {NamiEntitlement[]} A list of currently active entitlements
12
- */
13
- static active(): NamiEntitlement[];
14
- /**
15
- * Checks if a Nami Control Center defined Entitlement has at least one backing purchase
16
- * and it's not expired.
17
- *
18
- * @param referenceId - entitlement referenceId
19
- * @returns {boolean} True if the entitlement is active for given referenceId, false otherwise.
20
- */
21
- static isEntitlementActive(referenceId: string): boolean;
22
- /**
23
- * Asks Nami to fetch the latest active entitlements
24
- *
25
- * @returns {Promise<NamiEntitlement[]>} A promise that resolves to a list of NamiEntitlement
26
- */
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
- */
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;
42
- /**
43
- * Private Instance Methods
44
- */
45
- private get sdkInitialized();
46
- }
@@ -1,77 +0,0 @@
1
- import { NamiFlowObjectDTO, NamiFlowOn, NamiFlowStep, NamiFlowTransition } from "../../types/flow";
2
- import type { NamiCampaign, NamiFlowCampaign } from '../../types/externals/campaign';
3
- import type { NamiPaywallLaunchContext } from '../../types/externals/paywall';
4
- import type { PaywallComponent } from "../../components/Paywall";
5
- import type { NamiFlowManager } from "./NamiFlowManager";
6
- import type { NamiButton } from "../../components";
7
- import { type TPaywallContext } from "../../types/paywall";
8
- import { TimerState } from "../../types/paywall";
9
- export declare class BasicNamiFlow implements NamiFlowObjectDTO {
10
- id: string;
11
- name: string;
12
- steps: NamiFlowStep[];
13
- screens: string[];
14
- resumeFromBookmark: boolean;
15
- transition: NamiFlowTransition;
16
- constructor(flowObject?: Partial<{
17
- id: string;
18
- name: string;
19
- steps: NamiFlowStep[];
20
- screens: string[];
21
- resume_from_bookmark: boolean;
22
- transition?: NamiFlowTransition;
23
- }>);
24
- get allScreensAvailable(): boolean;
25
- }
26
- export declare class NamiFlow extends BasicNamiFlow {
27
- campaign?: NamiCampaign;
28
- context?: NamiPaywallLaunchContext;
29
- stepcrumbs: NamiFlowStep[];
30
- branchcrumbs: string[];
31
- component: PaywallComponent;
32
- manager: NamiFlowManager;
33
- currentButton?: NamiButton;
34
- activeHandoffSequence: {
35
- formStates: Record<string, boolean | string>;
36
- remainingKeys: string[];
37
- } | null;
38
- currentScreenState: TPaywallContext | null;
39
- isPaused: boolean;
40
- pausedStepID?: string;
41
- timerStates: {
42
- [timerId: string]: TimerState;
43
- };
44
- constructor(campaign: NamiFlowCampaign, paywall: PaywallComponent, manager: NamiFlowManager, context?: NamiPaywallLaunchContext);
45
- private registerResolvers;
46
- get currentFlowStep(): NamiFlowStep | undefined;
47
- get nextStepAvailable(): boolean;
48
- get previousStepAvailable(): boolean;
49
- get previousFlowStep(): NamiFlowStep | undefined;
50
- get nextFlowStep(): NamiFlowStep | undefined;
51
- getStep(stepId: string): NamiFlowStep | undefined;
52
- private findStepByType;
53
- private isStepActive;
54
- private flowLog;
55
- finished(): void;
56
- back(): void;
57
- next(): void;
58
- private backToPreviousScreenStep;
59
- forward(stepId: string): void;
60
- pause(): void;
61
- resumeFromPause(): void;
62
- executeLifecycle(step: NamiFlowStep, key: string, data?: Record<string, any>): void;
63
- private lifecycles;
64
- triggerActions(actionId: string, component?: NamiButton, data?: Record<string, any>): void;
65
- executeFullLifecycles(lifecycles: NamiFlowOn[], data?: Record<string, any>): void;
66
- triggerBeforeActions(actionId: string, component?: NamiButton, data?: Record<string, any>): void;
67
- triggerAfterActions(actionId: string, component?: NamiButton, data?: Record<string, any>): void;
68
- currentStepHasHoistedPrimaryActions(actionId: string): boolean;
69
- private shouldRun;
70
- private performAction;
71
- private nextStep;
72
- private handleScreenStep;
73
- private handleBranchStep;
74
- getFormData(): Record<string, boolean | string>;
75
- flowHandoffFormSequence(): void;
76
- resumeNextHandoff(): void;
77
- }