@adapty/capacitor 3.17.1 → 4.0.0-beta.2
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/Package.swift +1 -1
- package/README.md +8 -0
- package/android/build.gradle +2 -2
- package/dist/esm/adapty-instance.d.ts +7 -0
- package/dist/esm/adapty-instance.js +8 -0
- package/dist/esm/adapty-instance.js.map +1 -0
- package/dist/esm/adapty.d.ts +112 -59
- package/dist/esm/adapty.js +132 -69
- package/dist/esm/adapty.js.map +1 -1
- package/dist/esm/coders/parse-flow.d.ts +3 -0
- package/dist/esm/coders/parse-flow.js +4 -0
- package/dist/esm/coders/parse-flow.js.map +1 -0
- package/dist/esm/default-configs.js +2 -2
- package/dist/esm/default-configs.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/adapty-plugin.d.ts +31 -17
- package/dist/esm/types/adapty-plugin.js.map +1 -1
- package/dist/esm/types/configs.d.ts +12 -14
- package/dist/esm/types/configs.js.map +1 -1
- package/dist/esm/types/flow-events.d.ts +1 -0
- package/dist/esm/types/flow-events.js +2 -0
- package/dist/esm/types/flow-events.js.map +1 -0
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/types/index.js +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/inputs.d.ts +1 -1
- package/dist/esm/types/inputs.js.map +1 -1
- package/dist/esm/ui-builder/base-view-emitter.d.ts +6 -0
- package/dist/esm/ui-builder/base-view-emitter.js +12 -0
- package/dist/esm/ui-builder/base-view-emitter.js.map +1 -1
- package/dist/esm/ui-builder/create-flow-view.d.ts +14 -0
- package/dist/esm/ui-builder/create-flow-view.js +16 -0
- package/dist/esm/ui-builder/create-flow-view.js.map +1 -0
- package/dist/esm/ui-builder/create-onboarding-view.d.ts +2 -0
- package/dist/esm/ui-builder/create-onboarding-view.js +2 -0
- package/dist/esm/ui-builder/create-onboarding-view.js.map +1 -1
- package/dist/esm/ui-builder/{paywall-view-controller.d.ts → flow-view-controller.d.ts} +37 -37
- package/dist/esm/ui-builder/{paywall-view-controller.js → flow-view-controller.js} +54 -51
- package/dist/esm/ui-builder/flow-view-controller.js.map +1 -0
- package/dist/esm/ui-builder/flow-view-emitter.d.ts +38 -0
- package/dist/esm/ui-builder/flow-view-emitter.js +151 -0
- package/dist/esm/ui-builder/flow-view-emitter.js.map +1 -0
- package/dist/esm/ui-builder/index.d.ts +5 -5
- package/dist/esm/ui-builder/index.js +3 -2
- package/dist/esm/ui-builder/index.js.map +1 -1
- package/dist/esm/ui-builder/onboarding-view-controller.d.ts +7 -5
- package/dist/esm/ui-builder/onboarding-view-controller.js +7 -5
- package/dist/esm/ui-builder/onboarding-view-controller.js.map +1 -1
- package/dist/esm/ui-builder/types.d.ts +11 -358
- package/dist/esm/ui-builder/types.js +52 -22
- package/dist/esm/ui-builder/types.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/plugin.cjs.js +903 -679
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +903 -679
- package/dist/plugin.js.map +1 -1
- package/package.json +3 -5
- package/AdaptyCapacitor.podspec +0 -20
- package/dist/esm/coders/parse-paywall.d.ts +0 -3
- package/dist/esm/coders/parse-paywall.js +0 -4
- package/dist/esm/coders/parse-paywall.js.map +0 -1
- package/dist/esm/types/paywall-events.d.ts +0 -1
- package/dist/esm/types/paywall-events.js +0 -2
- package/dist/esm/types/paywall-events.js.map +0 -1
- package/dist/esm/ui-builder/create-paywall-view.d.ts +0 -25
- package/dist/esm/ui-builder/create-paywall-view.js +0 -29
- package/dist/esm/ui-builder/create-paywall-view.js.map +0 -1
- package/dist/esm/ui-builder/paywall-view-controller.js.map +0 -1
- package/dist/esm/ui-builder/paywall-view-emitter.d.ts +0 -16
- package/dist/esm/ui-builder/paywall-view-emitter.js +0 -114
- package/dist/esm/ui-builder/paywall-view-emitter.js.map +0 -1
package/Package.swift
CHANGED
|
@@ -11,7 +11,7 @@ let package = Package(
|
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
13
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
|
|
14
|
-
.package(url: "https://github.com/adaptyteam/AdaptySDK-iOS.git", exact: "
|
|
14
|
+
.package(url: "https://github.com/adaptyteam/AdaptySDK-iOS.git", exact: "4.0.0")
|
|
15
15
|
],
|
|
16
16
|
targets: [
|
|
17
17
|
.target(
|
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ Adapty SDK is an open-source framework that makes implementing in-app subscripti
|
|
|
33
33
|
- [Mobile app monetization's largest community](#mobile-app-monetizations-largest-community)
|
|
34
34
|
- [Platform Support](#platform-support)
|
|
35
35
|
- [Capacitor compatibility](#capacitor-compatibility)
|
|
36
|
+
- [iOS dependency manager](#ios-dependency-manager)
|
|
36
37
|
- [Examples](#examples)
|
|
37
38
|
- [Contributing](#contributing)
|
|
38
39
|
- [Like Adapty SDK?](#like-adapty-sdk)
|
|
@@ -112,6 +113,13 @@ Adapty SDK for Capacitor is fully supported on **iOS** and **Android** platforms
|
|
|
112
113
|
| 7.x | 3.15.x and older |
|
|
113
114
|
| 6.x and older | Not supported |
|
|
114
115
|
|
|
116
|
+
### iOS dependency manager
|
|
117
|
+
|
|
118
|
+
| `@adapty/capacitor` version | iOS dependency manager |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| 4.x and newer | Swift Package Manager (SPM) only |
|
|
121
|
+
| 3.x | CocoaPods and Swift Package Manager (SPM) |
|
|
122
|
+
|
|
115
123
|
|
|
116
124
|
## Examples
|
|
117
125
|
|
package/android/build.gradle
CHANGED
|
@@ -66,10 +66,10 @@ dependencies {
|
|
|
66
66
|
// kotlin-stdlib is added automatically by Kotlin Gradle plugin
|
|
67
67
|
|
|
68
68
|
// Adapty SDK dependencies
|
|
69
|
-
implementation platform('io.adapty:adapty-bom:
|
|
69
|
+
implementation platform('io.adapty:adapty-bom:4.0.0')
|
|
70
70
|
implementation 'io.adapty:android-sdk'
|
|
71
71
|
implementation 'io.adapty:android-ui'
|
|
72
|
-
implementation 'io.adapty.internal:crossplatform:
|
|
72
|
+
implementation 'io.adapty.internal:crossplatform:4.0.0'
|
|
73
73
|
|
|
74
74
|
testImplementation "junit:junit:$junitVersion"
|
|
75
75
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Adapty } from './adapty';
|
|
2
|
+
/**
|
|
3
|
+
* The shared Adapty singleton. Extracted into its own module so UI default
|
|
4
|
+
* handlers can delegate to native handler methods (openWebUrl / requestAppReview)
|
|
5
|
+
* without importing the package entry point and creating an import cycle.
|
|
6
|
+
*/
|
|
7
|
+
export declare const adapty: Adapty;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Adapty } from './adapty';
|
|
2
|
+
/**
|
|
3
|
+
* The shared Adapty singleton. Extracted into its own module so UI default
|
|
4
|
+
* handlers can delegate to native handler methods (openWebUrl / requestAppReview)
|
|
5
|
+
* without importing the package entry point and creating an import cycle.
|
|
6
|
+
*/
|
|
7
|
+
export const adapty = new Adapty();
|
|
8
|
+
//# sourceMappingURL=adapty-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapty-instance.js","sourceRoot":"","sources":["../../src/adapty-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC","sourcesContent":["import { Adapty } from './adapty';\n\n/**\n * The shared Adapty singleton. Extracted into its own module so UI default\n * handlers can delegate to native handler methods (openWebUrl / requestAppReview)\n * without importing the package entry point and creating an import cycle.\n */\nexport const adapty = new Adapty();\n"]}
|
package/dist/esm/adapty.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type AdaptyType } from './coders/parse';
|
|
2
2
|
import { LogContext } from './logger';
|
|
3
3
|
import type { LoggerConfig, LogScope } from './logger';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AdaptyFlow, AdaptyFlowPaywall, AdaptyPaywallProduct, AdaptyOnboarding, AdaptyProfile, AdaptyPurchaseResult, AdaptyProfileParameters, RefundPreference, AdaptyInstallationStatus, WebPresentation } from './types';
|
|
5
5
|
import type { AdaptyPlugin, AddListenerFn } from './types/adapty-plugin';
|
|
6
|
-
import type {
|
|
6
|
+
import type { GetFlowOptions, GetFlowForDefaultAudienceOptions, MakePurchaseOptions, GetOnboardingOptions, GetOnboardingForDefaultAudienceOptions } from './types/configs';
|
|
7
7
|
import type { ActivateParamsInput, FileLocation, LogLevel, IdentifyParamsInput } from './types/inputs';
|
|
8
8
|
import type { MethodName } from './types/method-types';
|
|
9
9
|
/**
|
|
@@ -40,8 +40,6 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
40
40
|
* so background activities can be performed and cache can be updated.
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
43
|
* Usage with your user identifier from your system
|
|
46
44
|
* ```typescript
|
|
47
45
|
* await adapty.activate({
|
|
@@ -98,82 +96,78 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
98
96
|
*/
|
|
99
97
|
getCurrentInstallationStatus(): Promise<AdaptyInstallationStatus>;
|
|
100
98
|
/**
|
|
101
|
-
* Fetches the
|
|
99
|
+
* Fetches the flow by the specified placement.
|
|
102
100
|
*
|
|
103
101
|
* @remarks
|
|
104
102
|
* With Adapty, you can remotely configure the products and offers in your app
|
|
105
|
-
* by simply adding them to
|
|
103
|
+
* by simply adding them to flows – no need for hardcoding them.
|
|
106
104
|
* The only thing you hardcode is the placement ID.
|
|
107
|
-
* This flexibility allows you to easily update
|
|
105
|
+
* This flexibility allows you to easily update flows, products, and offers,
|
|
108
106
|
* or run A/B tests, all without the need for a new app release.
|
|
109
107
|
*
|
|
110
|
-
* @param options - The options for fetching the
|
|
108
|
+
* @param options - The options for fetching the flow
|
|
111
109
|
* @param options.placementId - The identifier of the desired placement. This is the value you specified when creating a placement in the Adapty Dashboard.
|
|
112
|
-
* @param options.
|
|
113
|
-
* @
|
|
114
|
-
* @
|
|
115
|
-
* @throws Error if the paywall with the specified ID is not found or if your bundle ID does not match with your Adapty Dashboard setup.
|
|
110
|
+
* @param options.params - Optional. Additional parameters for fetching the flow, including fetch policy and load timeout.
|
|
111
|
+
* @returns A promise that resolves with the requested {@link AdaptyFlow}.
|
|
112
|
+
* @throws Error if the flow with the specified ID is not found or if your bundle ID does not match with your Adapty Dashboard setup.
|
|
116
113
|
*
|
|
117
114
|
* @example
|
|
118
115
|
* ```typescript
|
|
119
116
|
* import { adapty } from '@adapty/capacitor';
|
|
120
117
|
*
|
|
121
118
|
* try {
|
|
122
|
-
* const
|
|
119
|
+
* const flow = await adapty.getFlow({
|
|
123
120
|
* placementId: 'YOUR_PLACEMENT_ID',
|
|
124
|
-
* locale: 'en',
|
|
125
121
|
* });
|
|
126
|
-
* console.log('
|
|
122
|
+
* console.log('Flow fetched successfully');
|
|
127
123
|
* } catch (error) {
|
|
128
|
-
* console.error('Failed to fetch
|
|
124
|
+
* console.error('Failed to fetch flow:', error);
|
|
129
125
|
* }
|
|
130
126
|
* ```
|
|
131
127
|
*/
|
|
132
|
-
|
|
128
|
+
getFlow(options: GetFlowOptions): Promise<AdaptyFlow>;
|
|
133
129
|
/**
|
|
134
|
-
* Fetches the
|
|
130
|
+
* Fetches the flow of the specified placement for the **All Users** audience.
|
|
135
131
|
*
|
|
136
132
|
* @remarks
|
|
137
133
|
* With Adapty, you can remotely configure the products and offers in your app
|
|
138
|
-
* by simply adding them to
|
|
134
|
+
* by simply adding them to flows – no need for hardcoding them.
|
|
139
135
|
* The only thing you hardcode is the placement ID.
|
|
140
136
|
*
|
|
141
|
-
* However, it's crucial to understand that the recommended approach is to fetch the
|
|
142
|
-
* through the placement ID by the {@link
|
|
143
|
-
* The `
|
|
137
|
+
* However, it's crucial to understand that the recommended approach is to fetch the flow
|
|
138
|
+
* through the placement ID by the {@link getFlow} method.
|
|
139
|
+
* The `getFlowForDefaultAudience` method should be a last resort due to its significant drawbacks:
|
|
144
140
|
* - Potential backward compatibility issues
|
|
145
|
-
* - Loss of targeting (all users see the same
|
|
141
|
+
* - Loss of targeting (all users see the same flow)
|
|
146
142
|
*
|
|
147
143
|
* See {@link https://docs.adapty.io/docs/capacitor-get-pb-paywalls#get-a-paywall-for-a-default-audience-to-fetch-it-faster | documentation} for more details.
|
|
148
144
|
*
|
|
149
|
-
* @param options - The options for fetching the
|
|
145
|
+
* @param options - The options for fetching the flow
|
|
150
146
|
* @param options.placementId - The identifier of the desired placement.
|
|
151
|
-
* @param options.
|
|
152
|
-
* @
|
|
153
|
-
* @
|
|
154
|
-
* @throws Error if the paywall with the specified ID is not found.
|
|
147
|
+
* @param options.params - Optional. Additional parameters for fetching the flow.
|
|
148
|
+
* @returns A promise that resolves with the requested {@link AdaptyFlow}.
|
|
149
|
+
* @throws Error if the flow with the specified ID is not found.
|
|
155
150
|
*
|
|
156
151
|
* @example
|
|
157
152
|
* ```typescript
|
|
158
153
|
* import { adapty } from '@adapty/capacitor';
|
|
159
154
|
*
|
|
160
155
|
* try {
|
|
161
|
-
* const
|
|
156
|
+
* const flow = await adapty.getFlowForDefaultAudience({
|
|
162
157
|
* placementId: 'YOUR_PLACEMENT_ID',
|
|
163
|
-
* locale: 'en',
|
|
164
158
|
* });
|
|
165
159
|
* } catch (error) {
|
|
166
|
-
* console.error('Failed to fetch
|
|
160
|
+
* console.error('Failed to fetch flow:', error);
|
|
167
161
|
* }
|
|
168
162
|
* ```
|
|
169
163
|
*/
|
|
170
|
-
|
|
164
|
+
getFlowForDefaultAudience(options: GetFlowForDefaultAudienceOptions): Promise<AdaptyFlow>;
|
|
171
165
|
/**
|
|
172
|
-
* Fetches a list of products associated with a provided
|
|
166
|
+
* Fetches a list of products associated with a provided flow.
|
|
173
167
|
*
|
|
174
168
|
* @param options - The options object
|
|
175
|
-
* @param options.
|
|
176
|
-
* @returns A promise that resolves with a list of {@link AdaptyPaywallProduct} associated with a provided
|
|
169
|
+
* @param options.flow - A flow to fetch products for. You can get it using {@link getFlow} method.
|
|
170
|
+
* @returns A promise that resolves with a list of {@link AdaptyPaywallProduct} associated with a provided flow.
|
|
177
171
|
* @throws Error if an error occurs while fetching products.
|
|
178
172
|
*
|
|
179
173
|
* @example
|
|
@@ -181,8 +175,8 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
181
175
|
* import { adapty } from '@adapty/capacitor';
|
|
182
176
|
*
|
|
183
177
|
* try {
|
|
184
|
-
* const
|
|
185
|
-
* const products = await adapty.getPaywallProducts({
|
|
178
|
+
* const flow = await adapty.getFlow({ placementId: 'YOUR_PLACEMENT_ID' });
|
|
179
|
+
* const products = await adapty.getPaywallProducts({ flow });
|
|
186
180
|
* console.log('Products:', products);
|
|
187
181
|
* } catch (error) {
|
|
188
182
|
* console.error('Failed to fetch products:', error);
|
|
@@ -190,11 +184,13 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
190
184
|
* ```
|
|
191
185
|
*/
|
|
192
186
|
getPaywallProducts(options: {
|
|
193
|
-
|
|
187
|
+
flow: AdaptyFlow;
|
|
194
188
|
}): Promise<AdaptyPaywallProduct[]>;
|
|
195
189
|
/**
|
|
196
190
|
* Fetches the onboarding by the specified placement.
|
|
197
191
|
*
|
|
192
|
+
* @deprecated Since 4.0.0. Migrate onboardings to the Flow Builder API.
|
|
193
|
+
*
|
|
198
194
|
* @remarks
|
|
199
195
|
* When you create an onboarding with the no-code builder, it's stored as a container with configuration
|
|
200
196
|
* that your app needs to fetch and display. This container manages the entire experience - what content appears,
|
|
@@ -230,6 +226,8 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
230
226
|
/**
|
|
231
227
|
* Fetches the onboarding of the specified placement for the **All Users** audience.
|
|
232
228
|
*
|
|
229
|
+
* @deprecated Since 4.0.0. Migrate onboardings to the Flow Builder API.
|
|
230
|
+
*
|
|
233
231
|
* @remarks
|
|
234
232
|
* It's crucial to understand that the recommended approach is to fetch the onboarding
|
|
235
233
|
* by the {@link getOnboarding} method. The `getOnboardingForDefaultAudience` method
|
|
@@ -324,19 +322,19 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
324
322
|
params?: IdentifyParamsInput;
|
|
325
323
|
}): Promise<void>;
|
|
326
324
|
/**
|
|
327
|
-
* Logs a
|
|
325
|
+
* Logs a flow view event.
|
|
328
326
|
*
|
|
329
327
|
* @remarks
|
|
330
|
-
* Adapty helps you to measure the performance of the
|
|
331
|
-
* We automatically collect all the metrics related to purchases except for custom
|
|
332
|
-
* This is because only you know when the
|
|
328
|
+
* Adapty helps you to measure the performance of the flows.
|
|
329
|
+
* We automatically collect all the metrics related to purchases except for custom flow views.
|
|
330
|
+
* This is because only you know when the flow was shown to a customer.
|
|
333
331
|
*
|
|
334
|
-
* Whenever you show a
|
|
332
|
+
* Whenever you show a flow to your user,
|
|
335
333
|
* call this function to log the event,
|
|
336
|
-
* and it will be accumulated in the
|
|
334
|
+
* and it will be accumulated in the flow metrics.
|
|
337
335
|
*
|
|
338
336
|
* @param options - The options object
|
|
339
|
-
* @param options.
|
|
337
|
+
* @param options.flow - The flow object that was shown to the user.
|
|
340
338
|
* @returns A promise that resolves when the event is logged.
|
|
341
339
|
* @throws Error if an error occurs while logging the event.
|
|
342
340
|
*
|
|
@@ -344,19 +342,20 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
344
342
|
* ```typescript
|
|
345
343
|
* import { adapty } from '@adapty/capacitor';
|
|
346
344
|
*
|
|
347
|
-
* const
|
|
348
|
-
* // ...after opening the
|
|
349
|
-
* await adapty.
|
|
345
|
+
* const flow = await adapty.getFlow({ placementId: 'YOUR_PLACEMENT_ID' });
|
|
346
|
+
* // ...after opening the flow
|
|
347
|
+
* await adapty.logShowFlow({ flow });
|
|
350
348
|
* ```
|
|
351
349
|
*/
|
|
352
|
-
|
|
353
|
-
|
|
350
|
+
logShowFlow(options: {
|
|
351
|
+
flow: AdaptyFlow;
|
|
354
352
|
}): Promise<void>;
|
|
355
353
|
/**
|
|
356
354
|
* Opens a web paywall in the default browser.
|
|
357
355
|
*
|
|
358
356
|
* @param options - The options object
|
|
359
|
-
* @param options.paywallOrProduct - The paywall or product to open as a web paywall.
|
|
357
|
+
* @param options.paywallOrProduct - The flow paywall or product to open as a web paywall.
|
|
358
|
+
* @param options.openIn - Optional. Where to open the web paywall ({@link WebPresentation}).
|
|
360
359
|
* @returns A promise that resolves when the web paywall is opened.
|
|
361
360
|
* @throws Error if an error occurs while opening the web paywall.
|
|
362
361
|
*
|
|
@@ -365,15 +364,15 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
365
364
|
* import { adapty } from '@adapty/capacitor';
|
|
366
365
|
*
|
|
367
366
|
* try {
|
|
368
|
-
* const
|
|
369
|
-
* await adapty.openWebPaywall({ paywallOrProduct:
|
|
367
|
+
* const flow = await adapty.getFlow({ placementId: 'YOUR_PLACEMENT_ID' });
|
|
368
|
+
* await adapty.openWebPaywall({ paywallOrProduct: flow.paywalls[0] });
|
|
370
369
|
* } catch (error) {
|
|
371
370
|
* console.error('Failed to open web paywall:', error);
|
|
372
371
|
* }
|
|
373
372
|
* ```
|
|
374
373
|
*/
|
|
375
374
|
openWebPaywall(options: {
|
|
376
|
-
paywallOrProduct:
|
|
375
|
+
paywallOrProduct: AdaptyFlowPaywall | AdaptyPaywallProduct;
|
|
377
376
|
openIn?: WebPresentation;
|
|
378
377
|
}): Promise<void>;
|
|
379
378
|
/**
|
|
@@ -384,7 +383,7 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
384
383
|
* You can use this URL in a custom web view or a browser.
|
|
385
384
|
*
|
|
386
385
|
* @param options - The options object
|
|
387
|
-
* @param options.paywallOrProduct - The paywall or product to create a URL for.
|
|
386
|
+
* @param options.paywallOrProduct - The flow paywall or product to create a URL for.
|
|
388
387
|
* @returns A promise that resolves with the web paywall URL.
|
|
389
388
|
* @throws Error if an error occurs while creating the URL.
|
|
390
389
|
*
|
|
@@ -393,8 +392,8 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
393
392
|
* import { adapty } from '@adapty/capacitor';
|
|
394
393
|
*
|
|
395
394
|
* try {
|
|
396
|
-
* const
|
|
397
|
-
* const url = await adapty.createWebPaywallUrl({ paywallOrProduct:
|
|
395
|
+
* const flow = await adapty.getFlow({ placementId: 'YOUR_PLACEMENT_ID' });
|
|
396
|
+
* const url = await adapty.createWebPaywallUrl({ paywallOrProduct: flow.paywalls[0] });
|
|
398
397
|
* console.log('Web paywall URL:', url);
|
|
399
398
|
* } catch (error) {
|
|
400
399
|
* console.error('Failed to create web paywall URL:', error);
|
|
@@ -402,8 +401,62 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
402
401
|
* ```
|
|
403
402
|
*/
|
|
404
403
|
createWebPaywallUrl(options: {
|
|
405
|
-
paywallOrProduct:
|
|
404
|
+
paywallOrProduct: AdaptyFlowPaywall | AdaptyPaywallProduct;
|
|
406
405
|
}): Promise<string>;
|
|
406
|
+
/**
|
|
407
|
+
* Opens a URL using the native browser.
|
|
408
|
+
*
|
|
409
|
+
* @remarks
|
|
410
|
+
* Backs the default `onUrlPress` flow handler. Call it directly from a custom
|
|
411
|
+
* `onUrlPress` handler when you want to run your own logic but keep the native
|
|
412
|
+
* open-URL behavior. `openIn`: `browser_out_app` → external browser,
|
|
413
|
+
* `browser_in_app` → in-app browser.
|
|
414
|
+
*
|
|
415
|
+
* @param options - The options object
|
|
416
|
+
* @param options.url - The URL to open.
|
|
417
|
+
* @param options.openIn - Optional. How to present the URL ({@link WebPresentation}). When omitted, the native SDK decides.
|
|
418
|
+
* @returns A promise that resolves when the URL is opened.
|
|
419
|
+
* @throws Error if an error occurs while opening the URL.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* import { adapty } from '@adapty/capacitor';
|
|
424
|
+
*
|
|
425
|
+
* try {
|
|
426
|
+
* await adapty.openWebUrl({ url: 'https://example.com' });
|
|
427
|
+
* } catch (error) {
|
|
428
|
+
* console.error('Failed to open URL:', error);
|
|
429
|
+
* }
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
openWebUrl(options: {
|
|
433
|
+
url: string;
|
|
434
|
+
openIn?: WebPresentation;
|
|
435
|
+
}): Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Requests the native app-review prompt.
|
|
438
|
+
*
|
|
439
|
+
* @remarks
|
|
440
|
+
* Uses `SKStoreReviewController` on iOS and In-App Review on Android. Backs the
|
|
441
|
+
* default `onRequestAppReview` flow handler. Call it directly from a custom
|
|
442
|
+
* `onRequestAppReview` handler when you want to run your own logic but keep the
|
|
443
|
+
* native prompt.
|
|
444
|
+
*
|
|
445
|
+
* @returns A promise that resolves when the native call completes.
|
|
446
|
+
* @throws Error if an error occurs while requesting the app review.
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```typescript
|
|
450
|
+
* import { adapty } from '@adapty/capacitor';
|
|
451
|
+
*
|
|
452
|
+
* try {
|
|
453
|
+
* await adapty.requestAppReview();
|
|
454
|
+
* } catch (error) {
|
|
455
|
+
* console.error('Failed to request app review:', error);
|
|
456
|
+
* }
|
|
457
|
+
* ```
|
|
458
|
+
*/
|
|
459
|
+
requestAppReview(): Promise<void>;
|
|
407
460
|
/**
|
|
408
461
|
* Logs out the current user.
|
|
409
462
|
*
|
|
@@ -491,7 +544,7 @@ export declare class Adapty implements AdaptyPlugin {
|
|
|
491
544
|
*
|
|
492
545
|
* @param options - The options object
|
|
493
546
|
* @param options.transactionId - The transaction ID of the purchase.
|
|
494
|
-
* @param options.variationId - Optional. The variation ID from the {@link
|
|
547
|
+
* @param options.variationId - Optional. The variation ID from the {@link AdaptyFlow}.
|
|
495
548
|
* @returns A promise that resolves when the transaction is reported.
|
|
496
549
|
* @throws Error if an error occurs while reporting the transaction.
|
|
497
550
|
*
|