@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.
Files changed (75) hide show
  1. package/Package.swift +1 -1
  2. package/README.md +8 -0
  3. package/android/build.gradle +2 -2
  4. package/dist/esm/adapty-instance.d.ts +7 -0
  5. package/dist/esm/adapty-instance.js +8 -0
  6. package/dist/esm/adapty-instance.js.map +1 -0
  7. package/dist/esm/adapty.d.ts +112 -59
  8. package/dist/esm/adapty.js +132 -69
  9. package/dist/esm/adapty.js.map +1 -1
  10. package/dist/esm/coders/parse-flow.d.ts +3 -0
  11. package/dist/esm/coders/parse-flow.js +4 -0
  12. package/dist/esm/coders/parse-flow.js.map +1 -0
  13. package/dist/esm/default-configs.js +2 -2
  14. package/dist/esm/default-configs.js.map +1 -1
  15. package/dist/esm/index.d.ts +4 -4
  16. package/dist/esm/index.js +3 -3
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/types/adapty-plugin.d.ts +31 -17
  19. package/dist/esm/types/adapty-plugin.js.map +1 -1
  20. package/dist/esm/types/configs.d.ts +12 -14
  21. package/dist/esm/types/configs.js.map +1 -1
  22. package/dist/esm/types/flow-events.d.ts +1 -0
  23. package/dist/esm/types/flow-events.js +2 -0
  24. package/dist/esm/types/flow-events.js.map +1 -0
  25. package/dist/esm/types/index.d.ts +2 -2
  26. package/dist/esm/types/index.js +1 -1
  27. package/dist/esm/types/index.js.map +1 -1
  28. package/dist/esm/types/inputs.d.ts +1 -1
  29. package/dist/esm/types/inputs.js.map +1 -1
  30. package/dist/esm/ui-builder/base-view-emitter.d.ts +6 -0
  31. package/dist/esm/ui-builder/base-view-emitter.js +12 -0
  32. package/dist/esm/ui-builder/base-view-emitter.js.map +1 -1
  33. package/dist/esm/ui-builder/create-flow-view.d.ts +14 -0
  34. package/dist/esm/ui-builder/create-flow-view.js +16 -0
  35. package/dist/esm/ui-builder/create-flow-view.js.map +1 -0
  36. package/dist/esm/ui-builder/create-onboarding-view.d.ts +2 -0
  37. package/dist/esm/ui-builder/create-onboarding-view.js +2 -0
  38. package/dist/esm/ui-builder/create-onboarding-view.js.map +1 -1
  39. package/dist/esm/ui-builder/{paywall-view-controller.d.ts → flow-view-controller.d.ts} +37 -37
  40. package/dist/esm/ui-builder/{paywall-view-controller.js → flow-view-controller.js} +54 -51
  41. package/dist/esm/ui-builder/flow-view-controller.js.map +1 -0
  42. package/dist/esm/ui-builder/flow-view-emitter.d.ts +38 -0
  43. package/dist/esm/ui-builder/flow-view-emitter.js +151 -0
  44. package/dist/esm/ui-builder/flow-view-emitter.js.map +1 -0
  45. package/dist/esm/ui-builder/index.d.ts +5 -5
  46. package/dist/esm/ui-builder/index.js +3 -2
  47. package/dist/esm/ui-builder/index.js.map +1 -1
  48. package/dist/esm/ui-builder/onboarding-view-controller.d.ts +7 -5
  49. package/dist/esm/ui-builder/onboarding-view-controller.js +7 -5
  50. package/dist/esm/ui-builder/onboarding-view-controller.js.map +1 -1
  51. package/dist/esm/ui-builder/types.d.ts +11 -358
  52. package/dist/esm/ui-builder/types.js +52 -22
  53. package/dist/esm/ui-builder/types.js.map +1 -1
  54. package/dist/esm/version.d.ts +1 -1
  55. package/dist/esm/version.js +1 -1
  56. package/dist/esm/version.js.map +1 -1
  57. package/dist/plugin.cjs.js +903 -679
  58. package/dist/plugin.cjs.js.map +1 -1
  59. package/dist/plugin.js +903 -679
  60. package/dist/plugin.js.map +1 -1
  61. package/package.json +3 -5
  62. package/AdaptyCapacitor.podspec +0 -20
  63. package/dist/esm/coders/parse-paywall.d.ts +0 -3
  64. package/dist/esm/coders/parse-paywall.js +0 -4
  65. package/dist/esm/coders/parse-paywall.js.map +0 -1
  66. package/dist/esm/types/paywall-events.d.ts +0 -1
  67. package/dist/esm/types/paywall-events.js +0 -2
  68. package/dist/esm/types/paywall-events.js.map +0 -1
  69. package/dist/esm/ui-builder/create-paywall-view.d.ts +0 -25
  70. package/dist/esm/ui-builder/create-paywall-view.js +0 -29
  71. package/dist/esm/ui-builder/create-paywall-view.js.map +0 -1
  72. package/dist/esm/ui-builder/paywall-view-controller.js.map +0 -1
  73. package/dist/esm/ui-builder/paywall-view-emitter.d.ts +0 -16
  74. package/dist/esm/ui-builder/paywall-view-emitter.js +0 -114
  75. package/dist/esm/ui-builder/paywall-view-emitter.js.map +0 -1
@@ -25,7 +25,7 @@ export class Adapty {
25
25
  this.nonWaitingMethods = [
26
26
  'activate',
27
27
  'is_activated',
28
- 'get_paywall_for_default_audience',
28
+ 'get_flow_for_default_audience',
29
29
  'get_onboarding_for_default_audience',
30
30
  'set_log_level',
31
31
  'set_fallback',
@@ -143,8 +143,6 @@ export class Adapty {
143
143
  * so background activities can be performed and cache can be updated.
144
144
  *
145
145
  * @example
146
- *
147
- * @example
148
146
  * Usage with your user identifier from your system
149
147
  * ```typescript
150
148
  * await adapty.activate({
@@ -277,39 +275,37 @@ export class Adapty {
277
275
  return await this.handleMethodCall(method, JSON.stringify(args), ctx, log, 'AdaptyInstallationStatus');
278
276
  }
279
277
  /**
280
- * Fetches the paywall by the specified placement.
278
+ * Fetches the flow by the specified placement.
281
279
  *
282
280
  * @remarks
283
281
  * With Adapty, you can remotely configure the products and offers in your app
284
- * by simply adding them to paywalls – no need for hardcoding them.
282
+ * by simply adding them to flows – no need for hardcoding them.
285
283
  * The only thing you hardcode is the placement ID.
286
- * This flexibility allows you to easily update paywalls, products, and offers,
284
+ * This flexibility allows you to easily update flows, products, and offers,
287
285
  * or run A/B tests, all without the need for a new app release.
288
286
  *
289
- * @param options - The options for fetching the paywall
287
+ * @param options - The options for fetching the flow
290
288
  * @param options.placementId - The identifier of the desired placement. This is the value you specified when creating a placement in the Adapty Dashboard.
291
- * @param options.locale - Optional. The identifier of the paywall localization. Default: `'en'`. See {@link https://docs.adapty.io/docs/localizations-and-locale-codes | Localizations and locale codes} for more information.
292
- * @param options.params - Optional. Additional parameters for fetching the paywall, including fetch policy and load timeout.
293
- * @returns A promise that resolves with the requested {@link AdaptyPaywall}.
294
- * @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.
289
+ * @param options.params - Optional. Additional parameters for fetching the flow, including fetch policy and load timeout.
290
+ * @returns A promise that resolves with the requested {@link AdaptyFlow}.
291
+ * @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.
295
292
  *
296
293
  * @example
297
294
  * ```typescript
298
295
  * import { adapty } from '@adapty/capacitor';
299
296
  *
300
297
  * try {
301
- * const paywall = await adapty.getPaywall({
298
+ * const flow = await adapty.getFlow({
302
299
  * placementId: 'YOUR_PLACEMENT_ID',
303
- * locale: 'en',
304
300
  * });
305
- * console.log('Paywall fetched successfully');
301
+ * console.log('Flow fetched successfully');
306
302
  * } catch (error) {
307
- * console.error('Failed to fetch paywall:', error);
303
+ * console.error('Failed to fetch flow:', error);
308
304
  * }
309
305
  * ```
310
306
  */
311
- async getPaywall(options) {
312
- const method = 'get_paywall';
307
+ async getFlow(options) {
308
+ const method = 'get_flow';
313
309
  const optionsWithDefault = mergeOptions(options, this.options[method]);
314
310
  const params = optionsWithDefault.params;
315
311
  const ctx = new LogContext();
@@ -319,54 +315,51 @@ export class Adapty {
319
315
  method,
320
316
  placement_id: optionsWithDefault.placementId,
321
317
  load_timeout: params.loadTimeoutMs / 1000,
322
- locale: optionsWithDefault.locale,
323
318
  fetch_policy: params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'
324
319
  ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }
325
320
  : { type: params.fetchPolicy },
326
321
  };
327
322
  const args = filterUndefined(argsWithUndefined);
328
- return await this.handleMethodCall(method, JSON.stringify(args), ctx, log, 'AdaptyPaywall');
323
+ return await this.handleMethodCall(method, JSON.stringify(args), ctx, log, 'AdaptyFlow');
329
324
  }
330
325
  /**
331
- * Fetches the paywall of the specified placement for the **All Users** audience.
326
+ * Fetches the flow of the specified placement for the **All Users** audience.
332
327
  *
333
328
  * @remarks
334
329
  * With Adapty, you can remotely configure the products and offers in your app
335
- * by simply adding them to paywalls – no need for hardcoding them.
330
+ * by simply adding them to flows – no need for hardcoding them.
336
331
  * The only thing you hardcode is the placement ID.
337
332
  *
338
- * However, it's crucial to understand that the recommended approach is to fetch the paywall
339
- * through the placement ID by the {@link getPaywall} method.
340
- * The `getPaywallForDefaultAudience` method should be a last resort due to its significant drawbacks:
333
+ * However, it's crucial to understand that the recommended approach is to fetch the flow
334
+ * through the placement ID by the {@link getFlow} method.
335
+ * The `getFlowForDefaultAudience` method should be a last resort due to its significant drawbacks:
341
336
  * - Potential backward compatibility issues
342
- * - Loss of targeting (all users see the same paywall)
337
+ * - Loss of targeting (all users see the same flow)
343
338
  *
344
339
  * 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.
345
340
  *
346
- * @param options - The options for fetching the paywall
341
+ * @param options - The options for fetching the flow
347
342
  * @param options.placementId - The identifier of the desired placement.
348
- * @param options.locale - Optional. The identifier of the paywall localization. Default: `'en'`.
349
- * @param options.params - Optional. Additional parameters for fetching the paywall.
350
- * @returns A promise that resolves with the requested {@link AdaptyPaywall}.
351
- * @throws Error if the paywall with the specified ID is not found.
343
+ * @param options.params - Optional. Additional parameters for fetching the flow.
344
+ * @returns A promise that resolves with the requested {@link AdaptyFlow}.
345
+ * @throws Error if the flow with the specified ID is not found.
352
346
  *
353
347
  * @example
354
348
  * ```typescript
355
349
  * import { adapty } from '@adapty/capacitor';
356
350
  *
357
351
  * try {
358
- * const paywall = await adapty.getPaywallForDefaultAudience({
352
+ * const flow = await adapty.getFlowForDefaultAudience({
359
353
  * placementId: 'YOUR_PLACEMENT_ID',
360
- * locale: 'en',
361
354
  * });
362
355
  * } catch (error) {
363
- * console.error('Failed to fetch paywall:', error);
356
+ * console.error('Failed to fetch flow:', error);
364
357
  * }
365
358
  * ```
366
359
  */
367
- async getPaywallForDefaultAudience(options) {
360
+ async getFlowForDefaultAudience(options) {
368
361
  var _a;
369
- const method = 'get_paywall_for_default_audience';
362
+ const method = 'get_flow_for_default_audience';
370
363
  const optionsWithDefault = mergeOptions(options, this.options[method]);
371
364
  const params = optionsWithDefault.params;
372
365
  const ctx = new LogContext();
@@ -375,20 +368,19 @@ export class Adapty {
375
368
  const argsWithUndefined = {
376
369
  method,
377
370
  placement_id: optionsWithDefault.placementId,
378
- locale: optionsWithDefault.locale,
379
371
  fetch_policy: params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'
380
372
  ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }
381
373
  : { type: (_a = params.fetchPolicy) !== null && _a !== void 0 ? _a : 'reload_revalidating_cache_data' },
382
374
  };
383
375
  const args = filterUndefined(argsWithUndefined);
384
- return await this.handleMethodCall(method, JSON.stringify(args), ctx, log, 'AdaptyPaywall');
376
+ return await this.handleMethodCall(method, JSON.stringify(args), ctx, log, 'AdaptyFlow');
385
377
  }
386
378
  /**
387
- * Fetches a list of products associated with a provided paywall.
379
+ * Fetches a list of products associated with a provided flow.
388
380
  *
389
381
  * @param options - The options object
390
- * @param options.paywall - A paywall to fetch products for. You can get it using {@link getPaywall} method.
391
- * @returns A promise that resolves with a list of {@link AdaptyPaywallProduct} associated with a provided paywall.
382
+ * @param options.flow - A flow to fetch products for. You can get it using {@link getFlow} method.
383
+ * @returns A promise that resolves with a list of {@link AdaptyPaywallProduct} associated with a provided flow.
392
384
  * @throws Error if an error occurs while fetching products.
393
385
  *
394
386
  * @example
@@ -396,8 +388,8 @@ export class Adapty {
396
388
  * import { adapty } from '@adapty/capacitor';
397
389
  *
398
390
  * try {
399
- * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });
400
- * const products = await adapty.getPaywallProducts({ paywall });
391
+ * const flow = await adapty.getFlow({ placementId: 'YOUR_PLACEMENT_ID' });
392
+ * const products = await adapty.getPaywallProducts({ flow });
401
393
  * console.log('Products:', products);
402
394
  * } catch (error) {
403
395
  * console.error('Failed to fetch products:', error);
@@ -409,10 +401,10 @@ export class Adapty {
409
401
  const ctx = new LogContext();
410
402
  const log = ctx.call({ methodName: method });
411
403
  log.start(() => ({ options }));
412
- const paywallCoder = coderFactory.createPaywallCoder();
404
+ const coder = coderFactory.createFlowCoder();
413
405
  const argsWithUndefined = {
414
406
  method,
415
- paywall: this.encodeWithLogging(paywallCoder, options.paywall, 'AdaptyPaywall', ctx),
407
+ flow: this.encodeWithLogging(coder, options.flow, 'AdaptyFlow', ctx),
416
408
  };
417
409
  const args = filterUndefined(argsWithUndefined);
418
410
  return await this.handleMethodCall(method, JSON.stringify(args), ctx, log, 'Array<AdaptyPaywallProduct>');
@@ -420,6 +412,8 @@ export class Adapty {
420
412
  /**
421
413
  * Fetches the onboarding by the specified placement.
422
414
  *
415
+ * @deprecated Since 4.0.0. Migrate onboardings to the Flow Builder API.
416
+ *
423
417
  * @remarks
424
418
  * When you create an onboarding with the no-code builder, it's stored as a container with configuration
425
419
  * that your app needs to fetch and display. This container manages the entire experience - what content appears,
@@ -473,6 +467,8 @@ export class Adapty {
473
467
  /**
474
468
  * Fetches the onboarding of the specified placement for the **All Users** audience.
475
469
  *
470
+ * @deprecated Since 4.0.0. Migrate onboardings to the Flow Builder API.
471
+ *
476
472
  * @remarks
477
473
  * It's crucial to understand that the recommended approach is to fetch the onboarding
478
474
  * by the {@link getOnboarding} method. The `getOnboardingForDefaultAudience` method
@@ -606,19 +602,19 @@ export class Adapty {
606
602
  await this.handleMethodCall(method, JSON.stringify(args), ctx, log);
607
603
  }
608
604
  /**
609
- * Logs a paywall view event.
605
+ * Logs a flow view event.
610
606
  *
611
607
  * @remarks
612
- * Adapty helps you to measure the performance of the paywalls.
613
- * We automatically collect all the metrics related to purchases except for custom paywall views.
614
- * This is because only you know when the paywall was shown to a customer.
608
+ * Adapty helps you to measure the performance of the flows.
609
+ * We automatically collect all the metrics related to purchases except for custom flow views.
610
+ * This is because only you know when the flow was shown to a customer.
615
611
  *
616
- * Whenever you show a paywall to your user,
612
+ * Whenever you show a flow to your user,
617
613
  * call this function to log the event,
618
- * and it will be accumulated in the paywall metrics.
614
+ * and it will be accumulated in the flow metrics.
619
615
  *
620
616
  * @param options - The options object
621
- * @param options.paywall - The paywall object that was shown to the user.
617
+ * @param options.flow - The flow object that was shown to the user.
622
618
  * @returns A promise that resolves when the event is logged.
623
619
  * @throws Error if an error occurs while logging the event.
624
620
  *
@@ -626,20 +622,20 @@ export class Adapty {
626
622
  * ```typescript
627
623
  * import { adapty } from '@adapty/capacitor';
628
624
  *
629
- * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });
630
- * // ...after opening the paywall
631
- * await adapty.logShowPaywall({ paywall });
625
+ * const flow = await adapty.getFlow({ placementId: 'YOUR_PLACEMENT_ID' });
626
+ * // ...after opening the flow
627
+ * await adapty.logShowFlow({ flow });
632
628
  * ```
633
629
  */
634
- async logShowPaywall(options) {
635
- const method = 'log_show_paywall';
630
+ async logShowFlow(options) {
631
+ const method = 'log_show_flow';
636
632
  const ctx = new LogContext();
637
633
  const log = ctx.call({ methodName: method });
638
634
  log.start(() => ({ options }));
639
- const paywallCoder = coderFactory.createPaywallCoder();
635
+ const coder = coderFactory.createFlowCoder();
640
636
  const argsWithUndefined = {
641
637
  method,
642
- paywall: this.encodeWithLogging(paywallCoder, options.paywall, 'AdaptyPaywall', ctx),
638
+ flow: this.encodeWithLogging(coder, options.flow, 'AdaptyFlow', ctx),
643
639
  };
644
640
  const args = filterUndefined(argsWithUndefined);
645
641
  await this.handleMethodCall(method, JSON.stringify(args), ctx, log);
@@ -648,7 +644,8 @@ export class Adapty {
648
644
  * Opens a web paywall in the default browser.
649
645
  *
650
646
  * @param options - The options object
651
- * @param options.paywallOrProduct - The paywall or product to open as a web paywall.
647
+ * @param options.paywallOrProduct - The flow paywall or product to open as a web paywall.
648
+ * @param options.openIn - Optional. Where to open the web paywall ({@link WebPresentation}).
652
649
  * @returns A promise that resolves when the web paywall is opened.
653
650
  * @throws Error if an error occurs while opening the web paywall.
654
651
  *
@@ -657,8 +654,8 @@ export class Adapty {
657
654
  * import { adapty } from '@adapty/capacitor';
658
655
  *
659
656
  * try {
660
- * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });
661
- * await adapty.openWebPaywall({ paywallOrProduct: paywall });
657
+ * const flow = await adapty.getFlow({ placementId: 'YOUR_PLACEMENT_ID' });
658
+ * await adapty.openWebPaywall({ paywallOrProduct: flow.paywalls[0] });
662
659
  * } catch (error) {
663
660
  * console.error('Failed to open web paywall:', error);
664
661
  * }
@@ -669,11 +666,11 @@ export class Adapty {
669
666
  const ctx = new LogContext();
670
667
  const log = ctx.call({ methodName: method });
671
668
  log.start(() => ({ options }));
672
- const paywallCoder = coderFactory.createPaywallCoder();
669
+ const flowPaywallCoder = coderFactory.createFlowPaywallCoder();
673
670
  const productCoder = coderFactory.createPaywallProductCoder();
674
671
  const argsWithUndefined = Object.assign(Object.assign({ method }, (this.isPaywallProduct(options.paywallOrProduct)
675
672
  ? { product: this.encodeWithLogging(productCoder, options.paywallOrProduct, 'AdaptyPaywallProduct', ctx) }
676
- : { paywall: this.encodeWithLogging(paywallCoder, options.paywallOrProduct, 'AdaptyPaywall', ctx) })), (options.openIn ? { open_in: options.openIn } : {}));
673
+ : { paywall: this.encodeWithLogging(flowPaywallCoder, options.paywallOrProduct, 'AdaptyFlowPaywall', ctx) })), (options.openIn ? { open_in: options.openIn } : {}));
677
674
  const args = filterUndefined(argsWithUndefined);
678
675
  await this.handleMethodCall(method, JSON.stringify(args), ctx, log);
679
676
  }
@@ -685,7 +682,7 @@ export class Adapty {
685
682
  * You can use this URL in a custom web view or a browser.
686
683
  *
687
684
  * @param options - The options object
688
- * @param options.paywallOrProduct - The paywall or product to create a URL for.
685
+ * @param options.paywallOrProduct - The flow paywall or product to create a URL for.
689
686
  * @returns A promise that resolves with the web paywall URL.
690
687
  * @throws Error if an error occurs while creating the URL.
691
688
  *
@@ -694,8 +691,8 @@ export class Adapty {
694
691
  * import { adapty } from '@adapty/capacitor';
695
692
  *
696
693
  * try {
697
- * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });
698
- * const url = await adapty.createWebPaywallUrl({ paywallOrProduct: paywall });
694
+ * const flow = await adapty.getFlow({ placementId: 'YOUR_PLACEMENT_ID' });
695
+ * const url = await adapty.createWebPaywallUrl({ paywallOrProduct: flow.paywalls[0] });
699
696
  * console.log('Web paywall URL:', url);
700
697
  * } catch (error) {
701
698
  * console.error('Failed to create web paywall URL:', error);
@@ -707,14 +704,80 @@ export class Adapty {
707
704
  const ctx = new LogContext();
708
705
  const log = ctx.call({ methodName: method });
709
706
  log.start(() => ({ options }));
710
- const paywallCoder = coderFactory.createPaywallCoder();
707
+ const flowPaywallCoder = coderFactory.createFlowPaywallCoder();
711
708
  const productCoder = coderFactory.createPaywallProductCoder();
712
709
  const argsWithUndefined = Object.assign({ method }, (this.isPaywallProduct(options.paywallOrProduct)
713
710
  ? { product: this.encodeWithLogging(productCoder, options.paywallOrProduct, 'AdaptyPaywallProduct', ctx) }
714
- : { paywall: this.encodeWithLogging(paywallCoder, options.paywallOrProduct, 'AdaptyPaywall', ctx) }));
711
+ : { paywall: this.encodeWithLogging(flowPaywallCoder, options.paywallOrProduct, 'AdaptyFlowPaywall', ctx) }));
715
712
  const args = filterUndefined(argsWithUndefined);
716
713
  return await this.handleMethodCall(method, JSON.stringify(args), ctx, log, 'String');
717
714
  }
715
+ /**
716
+ * Opens a URL using the native browser.
717
+ *
718
+ * @remarks
719
+ * Backs the default `onUrlPress` flow handler. Call it directly from a custom
720
+ * `onUrlPress` handler when you want to run your own logic but keep the native
721
+ * open-URL behavior. `openIn`: `browser_out_app` → external browser,
722
+ * `browser_in_app` → in-app browser.
723
+ *
724
+ * @param options - The options object
725
+ * @param options.url - The URL to open.
726
+ * @param options.openIn - Optional. How to present the URL ({@link WebPresentation}). When omitted, the native SDK decides.
727
+ * @returns A promise that resolves when the URL is opened.
728
+ * @throws Error if an error occurs while opening the URL.
729
+ *
730
+ * @example
731
+ * ```typescript
732
+ * import { adapty } from '@adapty/capacitor';
733
+ *
734
+ * try {
735
+ * await adapty.openWebUrl({ url: 'https://example.com' });
736
+ * } catch (error) {
737
+ * console.error('Failed to open URL:', error);
738
+ * }
739
+ * ```
740
+ */
741
+ async openWebUrl(options) {
742
+ const method = 'adapty_ui_open_url';
743
+ const ctx = new LogContext();
744
+ const log = ctx.call({ methodName: method });
745
+ log.start(() => ({ options }));
746
+ const argsWithUndefined = Object.assign({ method, url: options.url }, (options.openIn ? { open_in: options.openIn } : {}));
747
+ const args = filterUndefined(argsWithUndefined);
748
+ await this.handleMethodCall(method, JSON.stringify(args), ctx, log);
749
+ }
750
+ /**
751
+ * Requests the native app-review prompt.
752
+ *
753
+ * @remarks
754
+ * Uses `SKStoreReviewController` on iOS and In-App Review on Android. Backs the
755
+ * default `onRequestAppReview` flow handler. Call it directly from a custom
756
+ * `onRequestAppReview` handler when you want to run your own logic but keep the
757
+ * native prompt.
758
+ *
759
+ * @returns A promise that resolves when the native call completes.
760
+ * @throws Error if an error occurs while requesting the app review.
761
+ *
762
+ * @example
763
+ * ```typescript
764
+ * import { adapty } from '@adapty/capacitor';
765
+ *
766
+ * try {
767
+ * await adapty.requestAppReview();
768
+ * } catch (error) {
769
+ * console.error('Failed to request app review:', error);
770
+ * }
771
+ * ```
772
+ */
773
+ async requestAppReview() {
774
+ const method = 'adapty_ui_request_app_review';
775
+ const ctx = new LogContext();
776
+ const log = ctx.call({ methodName: method });
777
+ log.start(() => ({}));
778
+ const args = { method };
779
+ await this.handleMethodCall(method, JSON.stringify(args), ctx, log);
780
+ }
718
781
  /**
719
782
  * Logs out the current user.
720
783
  *
@@ -841,7 +904,7 @@ export class Adapty {
841
904
  *
842
905
  * @param options - The options object
843
906
  * @param options.transactionId - The transaction ID of the purchase.
844
- * @param options.variationId - Optional. The variation ID from the {@link AdaptyPaywall}.
907
+ * @param options.variationId - Optional. The variation ID from the {@link AdaptyFlow}.
845
908
  * @returns A promise that resolves when the transaction is reported.
846
909
  * @throws Error if an error occurs while reporting the transaction.
847
910
  *