@adapty/capacitor 3.16.3 → 3.17.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.
package/dist/plugin.js CHANGED
@@ -2592,10 +2592,7 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
2592
2592
  return {
2593
2593
  id: eventId,
2594
2594
  view,
2595
- action: {
2596
- type: actionObj["type"],
2597
- value: actionObj["value"]
2598
- }
2595
+ action: parsePaywallUserAction(actionObj)
2599
2596
  };
2600
2597
  }
2601
2598
  case PaywallEventId.DidSelectProduct: return {
@@ -2673,6 +2670,22 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
2673
2670
  default: return null;
2674
2671
  }
2675
2672
  }
2673
+ function parsePaywallUserAction(actionObj) {
2674
+ const type = actionObj["type"];
2675
+ switch (type) {
2676
+ case "open_url": return {
2677
+ type,
2678
+ value: actionObj["value"],
2679
+ openIn: actionObj["open_in"]
2680
+ };
2681
+ case "custom": return {
2682
+ type,
2683
+ value: actionObj["value"]
2684
+ };
2685
+ case "close":
2686
+ case "system_back": return { type };
2687
+ }
2688
+ }
2676
2689
  function getPaywallCoder(factory, type, _ctx) {
2677
2690
  switch (type) {
2678
2691
  case "product": return factory.createPaywallProductCoder();
@@ -2865,7 +2878,7 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
2865
2878
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.AdaptyCapacitorPluginWeb()),
2866
2879
  });
2867
2880
 
2868
- var VERSION = '3.16.3';
2881
+ var VERSION = '3.17.0';
2869
2882
 
2870
2883
  /**
2871
2884
  * Capacitor implementation of IPlatformAdapter
@@ -4590,7 +4603,6 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
4590
4603
  onWebPaymentNavigationFinished: PaywallEventId.DidFinishWebPaymentNavigation,
4591
4604
  };
4592
4605
  function extractCallbackArgs$1(handlerName, event) {
4593
- var _a;
4594
4606
  switch (event.id) {
4595
4607
  case PaywallEventId.DidSelectProduct:
4596
4608
  return [event.productId];
@@ -4607,8 +4619,11 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
4607
4619
  case PaywallEventId.DidFailLoadingProducts:
4608
4620
  return [event.error];
4609
4621
  case PaywallEventId.DidPerformAction:
4610
- if (handlerName === 'onUrlPress' || handlerName === 'onCustomAction') {
4611
- return [(_a = event.action.value) !== null && _a !== void 0 ? _a : ''];
4622
+ if (handlerName === 'onUrlPress' && event.action.type === 'open_url') {
4623
+ return [event.action.value, event.action.openIn];
4624
+ }
4625
+ if (handlerName === 'onCustomAction' && event.action.type === 'custom') {
4626
+ return [event.action.value];
4612
4627
  }
4613
4628
  return [];
4614
4629
  case PaywallEventId.DidFinishWebPaymentNavigation:
@@ -4626,7 +4641,10 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
4626
4641
  const DEFAULT_EVENT_HANDLERS = {
4627
4642
  onCloseButtonPress: () => true,
4628
4643
  onAndroidSystemBack: () => true,
4629
- onUrlPress: (url) => {
4644
+ onUrlPress: (url, openIn) => {
4645
+ if (openIn === 'browser_in_app') {
4646
+ Log.warn('onUrlPress', () => 'open_in=browser_in_app is not supported by the default onUrlPress handler. Override onUrlPress to support an in-app browser.');
4647
+ }
4630
4648
  if (typeof window !== 'undefined') {
4631
4649
  try {
4632
4650
  window.open(new URL(url), '_blank');