@adapty/capacitor 3.16.3 → 3.17.1

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
@@ -1730,6 +1730,11 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
1730
1730
  type: "object",
1731
1731
  converter: new HashmapCoder(new AdaptyAccessLevelCoder())
1732
1732
  },
1733
+ appliedAttributionSources: {
1734
+ key: "applied_attribution_sources",
1735
+ required: false,
1736
+ type: "array"
1737
+ },
1733
1738
  customAttributes: {
1734
1739
  key: "custom_attributes",
1735
1740
  required: false,
@@ -2592,10 +2597,7 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
2592
2597
  return {
2593
2598
  id: eventId,
2594
2599
  view,
2595
- action: {
2596
- type: actionObj["type"],
2597
- value: actionObj["value"]
2598
- }
2600
+ action: parsePaywallUserAction(actionObj)
2599
2601
  };
2600
2602
  }
2601
2603
  case PaywallEventId.DidSelectProduct: return {
@@ -2673,6 +2675,22 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
2673
2675
  default: return null;
2674
2676
  }
2675
2677
  }
2678
+ function parsePaywallUserAction(actionObj) {
2679
+ const type = actionObj["type"];
2680
+ switch (type) {
2681
+ case "open_url": return {
2682
+ type,
2683
+ value: actionObj["value"],
2684
+ openIn: actionObj["open_in"]
2685
+ };
2686
+ case "custom": return {
2687
+ type,
2688
+ value: actionObj["value"]
2689
+ };
2690
+ case "close":
2691
+ case "system_back": return { type };
2692
+ }
2693
+ }
2676
2694
  function getPaywallCoder(factory, type, _ctx) {
2677
2695
  switch (type) {
2678
2696
  case "product": return factory.createPaywallProductCoder();
@@ -2865,7 +2883,7 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
2865
2883
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.AdaptyCapacitorPluginWeb()),
2866
2884
  });
2867
2885
 
2868
- var VERSION = '3.16.3';
2886
+ var VERSION = '3.17.1';
2869
2887
 
2870
2888
  /**
2871
2889
  * Capacitor implementation of IPlatformAdapter
@@ -4590,7 +4608,6 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
4590
4608
  onWebPaymentNavigationFinished: PaywallEventId.DidFinishWebPaymentNavigation,
4591
4609
  };
4592
4610
  function extractCallbackArgs$1(handlerName, event) {
4593
- var _a;
4594
4611
  switch (event.id) {
4595
4612
  case PaywallEventId.DidSelectProduct:
4596
4613
  return [event.productId];
@@ -4607,8 +4624,11 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
4607
4624
  case PaywallEventId.DidFailLoadingProducts:
4608
4625
  return [event.error];
4609
4626
  case PaywallEventId.DidPerformAction:
4610
- if (handlerName === 'onUrlPress' || handlerName === 'onCustomAction') {
4611
- return [(_a = event.action.value) !== null && _a !== void 0 ? _a : ''];
4627
+ if (handlerName === 'onUrlPress' && event.action.type === 'open_url') {
4628
+ return [event.action.value, event.action.openIn];
4629
+ }
4630
+ if (handlerName === 'onCustomAction' && event.action.type === 'custom') {
4631
+ return [event.action.value];
4612
4632
  }
4613
4633
  return [];
4614
4634
  case PaywallEventId.DidFinishWebPaymentNavigation:
@@ -4626,7 +4646,10 @@ var capacitorAdaptyCapacitorPlugin = (function (exports, core) {
4626
4646
  const DEFAULT_EVENT_HANDLERS = {
4627
4647
  onCloseButtonPress: () => true,
4628
4648
  onAndroidSystemBack: () => true,
4629
- onUrlPress: (url) => {
4649
+ onUrlPress: (url, openIn) => {
4650
+ if (openIn === 'browser_in_app') {
4651
+ Log.warn('onUrlPress', () => 'open_in=browser_in_app is not supported by the default onUrlPress handler. Override onUrlPress to support an in-app browser.');
4652
+ }
4630
4653
  if (typeof window !== 'undefined') {
4631
4654
  try {
4632
4655
  window.open(new URL(url), '_blank');