@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.
@@ -13,8 +13,8 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'Adapty', '3.15.7'
17
- s.dependency 'AdaptyUI', '3.15.7'
18
- s.dependency 'AdaptyPlugin', '3.15.7'
16
+ s.dependency 'Adapty', '3.17.2'
17
+ s.dependency 'AdaptyUI', '3.17.2'
18
+ s.dependency 'AdaptyPlugin', '3.17.2'
19
19
  s.swift_version = '5.1'
20
20
  end
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: "3.15.7")
14
+ .package(url: "https://github.com/adaptyteam/AdaptySDK-iOS.git", exact: "3.17.2")
15
15
  ],
16
16
  targets: [
17
17
  .target(
@@ -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:3.15.2')
69
+ implementation platform('io.adapty:adapty-bom:3.17.1')
70
70
  implementation 'io.adapty:android-sdk'
71
71
  implementation 'io.adapty:android-ui'
72
- implementation 'io.adapty.internal:crossplatform:3.15.6'
72
+ implementation 'io.adapty.internal:crossplatform:3.17.2'
73
73
 
74
74
  testImplementation "junit:junit:$junitVersion"
75
75
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
@@ -1,4 +1,4 @@
1
- export type { AdaptyPrice, AdaptyPaywall, AdaptyOnboarding, AdaptyPlacement, AdaptyRemoteConfig, AdaptyPaywallBuilder, AdaptyOnboardingBuilder, AdaptyPurchaseResult, AdaptyProfile, AdaptyAccessLevel, AdaptyNonSubscription, AdaptySubscription, AdaptyPaywallProduct, AdaptySubscriptionDetails, AdaptySubscriptionOffer, AdaptySubscriptionOfferId, AdaptyDiscountPhase, AdaptySubscriptionPeriod, AdaptyProfileParameters, ProductReference, AdaptyProductIdentifier, AdaptyInstallationStatus, AdaptyInstallationDetails, } from '@adapty/core';
1
+ export type { AdaptyPrice, AdaptyPaywall, AdaptyOnboarding, AdaptyPlacement, AdaptyRemoteConfig, AdaptyPaywallBuilder, AdaptyOnboardingBuilder, AdaptyPurchaseResult, AdaptyProfile, AttributionSource, AdaptyAccessLevel, AdaptyNonSubscription, AdaptySubscription, AdaptyPaywallProduct, AdaptySubscriptionDetails, AdaptySubscriptionOffer, AdaptySubscriptionOfferId, AdaptyDiscountPhase, AdaptySubscriptionPeriod, AdaptyProfileParameters, ProductReference, AdaptyProductIdentifier, AdaptyInstallationStatus, AdaptyInstallationDetails, } from '@adapty/core';
2
2
  export { WebPresentation, RefundPreference, VendorStore, OfferType, CancellationReason, Gender, AppTrackingTransparencyStatus, ProductPeriod, ErrorCode, ErrorCodeName, getErrorCode, getErrorPrompt, } from '@adapty/core';
3
3
  export * from './inputs';
4
4
  export * from './paywall-events';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AA2BA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,MAAM,EACN,6BAA6B,EAC7B,aAAa,EACb,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,+CAA+C;AAC/C,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC","sourcesContent":["// Re-export all model types from @adapty/core\nexport type {\n AdaptyPrice,\n AdaptyPaywall,\n AdaptyOnboarding,\n AdaptyPlacement,\n AdaptyRemoteConfig,\n AdaptyPaywallBuilder,\n AdaptyOnboardingBuilder,\n AdaptyPurchaseResult,\n AdaptyProfile,\n AdaptyAccessLevel,\n AdaptyNonSubscription,\n AdaptySubscription,\n AdaptyPaywallProduct,\n AdaptySubscriptionDetails,\n AdaptySubscriptionOffer,\n AdaptySubscriptionOfferId,\n AdaptyDiscountPhase,\n AdaptySubscriptionPeriod,\n AdaptyProfileParameters,\n ProductReference,\n AdaptyProductIdentifier,\n AdaptyInstallationStatus,\n AdaptyInstallationDetails,\n} from '@adapty/core';\n\nexport {\n WebPresentation,\n RefundPreference,\n VendorStore,\n OfferType,\n CancellationReason,\n Gender,\n AppTrackingTransparencyStatus,\n ProductPeriod,\n ErrorCode,\n ErrorCodeName,\n getErrorCode,\n getErrorPrompt,\n} from '@adapty/core';\n\n// Re-export local modules that are NOT in core\nexport * from './inputs';\nexport * from './paywall-events';\nexport * from './onboarding-events';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AA4BA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,MAAM,EACN,6BAA6B,EAC7B,aAAa,EACb,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,+CAA+C;AAC/C,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC","sourcesContent":["// Re-export all model types from @adapty/core\nexport type {\n AdaptyPrice,\n AdaptyPaywall,\n AdaptyOnboarding,\n AdaptyPlacement,\n AdaptyRemoteConfig,\n AdaptyPaywallBuilder,\n AdaptyOnboardingBuilder,\n AdaptyPurchaseResult,\n AdaptyProfile,\n AttributionSource,\n AdaptyAccessLevel,\n AdaptyNonSubscription,\n AdaptySubscription,\n AdaptyPaywallProduct,\n AdaptySubscriptionDetails,\n AdaptySubscriptionOffer,\n AdaptySubscriptionOfferId,\n AdaptyDiscountPhase,\n AdaptySubscriptionPeriod,\n AdaptyProfileParameters,\n ProductReference,\n AdaptyProductIdentifier,\n AdaptyInstallationStatus,\n AdaptyInstallationDetails,\n} from '@adapty/core';\n\nexport {\n WebPresentation,\n RefundPreference,\n VendorStore,\n OfferType,\n CancellationReason,\n Gender,\n AppTrackingTransparencyStatus,\n ProductPeriod,\n ErrorCode,\n ErrorCodeName,\n getErrorCode,\n getErrorPrompt,\n} from '@adapty/core';\n\n// Re-export local modules that are NOT in core\nexport * from './inputs';\nexport * from './paywall-events';\nexport * from './onboarding-events';\n"]}
@@ -80,7 +80,6 @@ const HANDLER_TO_NATIVE_EVENT = {
80
80
  onWebPaymentNavigationFinished: PaywallEventId.DidFinishWebPaymentNavigation,
81
81
  };
82
82
  function extractCallbackArgs(handlerName, event) {
83
- var _a;
84
83
  switch (event.id) {
85
84
  case PaywallEventId.DidSelectProduct:
86
85
  return [event.productId];
@@ -97,8 +96,11 @@ function extractCallbackArgs(handlerName, event) {
97
96
  case PaywallEventId.DidFailLoadingProducts:
98
97
  return [event.error];
99
98
  case PaywallEventId.DidPerformAction:
100
- if (handlerName === 'onUrlPress' || handlerName === 'onCustomAction') {
101
- return [(_a = event.action.value) !== null && _a !== void 0 ? _a : ''];
99
+ if (handlerName === 'onUrlPress' && event.action.type === 'open_url') {
100
+ return [event.action.value, event.action.openIn];
101
+ }
102
+ if (handlerName === 'onCustomAction' && event.action.type === 'custom') {
103
+ return [event.action.value];
102
104
  }
103
105
  return [];
104
106
  case PaywallEventId.DidFinishWebPaymentNavigation:
@@ -1 +1 @@
1
- {"version":3,"file":"paywall-view-emitter.js","sourceRoot":"","sources":["../../../src/ui-builder/paywall-view-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM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AAgB,EAAE,CAAC;gBACrE,OAAO,CAAC,MAAA,KAAK,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAqB,CAAC;YACxD,CAAC;YACD,OAAO,EAAsB,CAAC;QAEhC,KAAK,cAAc,CAAC,6BAA6B;YAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAgC,CAAC;QAErE,KAAK,cAAc,CAAC,SAAS,CAAC;QAC9B,KAAK,cAAc,CAAC,YAAY,CAAC;QACjC,KAAK,cAAc,CAAC,eAAe;YACjC,OAAO,EAAsB,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import { parsePaywallEvent } from '../coders/parse-paywall';\nimport type { LogContext } from '../logger';\nimport { PaywallEventId } from '../types/paywall-events';\nimport type { ParsedPaywallEvent, PaywallEventIdType } from '../types/paywall-events';\n\nimport { BaseViewEmitter } from './base-view-emitter';\nimport type { EventHandlers } from './types';\n\ntype EventName = keyof EventHandlers;\n\n/**\n * PaywallViewEmitter manages event handlers for paywall view events.\n * Each event type can have only one handler - new handlers replace existing ones.\n */\nexport class PaywallViewEmitter extends BaseViewEmitter<EventHandlers, ParsedPaywallEvent, PaywallEventIdType> {\n protected parseEventData(rawEventData: string, ctx: LogContext): ParsedPaywallEvent {\n const result = parsePaywallEvent(rawEventData, ctx);\n if (!result) {\n throw new Error('Failed to parse paywall event');\n }\n return result;\n }\n\n protected getNativeEventForHandler(event: keyof EventHandlers): PaywallEventIdType | null {\n return HANDLER_TO_NATIVE_EVENT[event as EventName];\n }\n\n protected getHandlerForNativeEvent(\n nativeEvent: PaywallEventIdType,\n eventData: ParsedPaywallEvent,\n ): keyof EventHandlers | null {\n const resolver = NATIVE_EVENT_RESOLVER[nativeEvent];\n if (!resolver) {\n return null;\n }\n return resolver(eventData) as keyof EventHandlers | null;\n }\n\n protected extractCallbackArgs(handlerName: keyof EventHandlers, eventData: ParsedPaywallEvent): unknown[] {\n return extractCallbackArgs(handlerName as EventName, eventData);\n }\n\n protected getEventViewId(eventData: ParsedPaywallEvent): string | null {\n return eventData?.view?.id ?? null;\n }\n\n protected getEmitterName(): string {\n return 'PaywallViewEmitter';\n }\n}\n\nconst NATIVE_EVENT_RESOLVER: Record<PaywallEventIdType, (event: ParsedPaywallEvent) => EventName | null> = {\n [PaywallEventId.DidPerformAction]: (event) => {\n if (event.id !== PaywallEventId.DidPerformAction) {\n return null;\n }\n\n const actionMap: Record<string, EventName> = {\n close: 'onCloseButtonPress',\n system_back: 'onAndroidSystemBack',\n open_url: 'onUrlPress',\n custom: 'onCustomAction',\n };\n\n return actionMap[event.action.type] ?? null;\n },\n [PaywallEventId.DidAppear]: () => 'onAppeared',\n [PaywallEventId.DidDisappear]: () => 'onDisappeared',\n [PaywallEventId.DidSelectProduct]: () => 'onProductSelected',\n [PaywallEventId.DidStartPurchase]: () => 'onPurchaseStarted',\n [PaywallEventId.DidFinishPurchase]: () => 'onPurchaseCompleted',\n [PaywallEventId.DidFailPurchase]: () => 'onPurchaseFailed',\n [PaywallEventId.DidStartRestore]: () => 'onRestoreStarted',\n [PaywallEventId.DidFinishRestore]: () => 'onRestoreCompleted',\n [PaywallEventId.DidFailRestore]: () => 'onRestoreFailed',\n [PaywallEventId.DidFailRendering]: () => 'onRenderingFailed',\n [PaywallEventId.DidFailLoadingProducts]: () => 'onLoadingProductsFailed',\n [PaywallEventId.DidFinishWebPaymentNavigation]: () => 'onWebPaymentNavigationFinished',\n};\n\nconst HANDLER_TO_NATIVE_EVENT: Record<EventName, PaywallEventIdType> = {\n onCloseButtonPress: PaywallEventId.DidPerformAction,\n onAndroidSystemBack: PaywallEventId.DidPerformAction,\n onUrlPress: PaywallEventId.DidPerformAction,\n onCustomAction: PaywallEventId.DidPerformAction,\n onProductSelected: PaywallEventId.DidSelectProduct,\n onPurchaseStarted: PaywallEventId.DidStartPurchase,\n onPurchaseCompleted: PaywallEventId.DidFinishPurchase,\n onPurchaseFailed: PaywallEventId.DidFailPurchase,\n onRestoreStarted: PaywallEventId.DidStartRestore,\n onRestoreCompleted: PaywallEventId.DidFinishRestore,\n onRestoreFailed: PaywallEventId.DidFailRestore,\n onAppeared: PaywallEventId.DidAppear,\n onDisappeared: PaywallEventId.DidDisappear,\n onRenderingFailed: PaywallEventId.DidFailRendering,\n onLoadingProductsFailed: PaywallEventId.DidFailLoadingProducts,\n onWebPaymentNavigationFinished: PaywallEventId.DidFinishWebPaymentNavigation,\n};\n\ntype ExtractedArgs<T extends keyof EventHandlers> = Parameters<EventHandlers[T]>;\n\nfunction extractCallbackArgs<T extends keyof EventHandlers>(\n handlerName: T,\n event: ParsedPaywallEvent,\n): ExtractedArgs<T> {\n switch (event.id) {\n case PaywallEventId.DidSelectProduct:\n return [event.productId] as ExtractedArgs<T>;\n\n case PaywallEventId.DidStartPurchase:\n return [event.product] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFinishPurchase:\n return [event.purchaseResult, event.product] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFailPurchase:\n return [event.error, event.product] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFinishRestore:\n return [event.profile] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFailRestore:\n case PaywallEventId.DidFailRendering:\n case PaywallEventId.DidFailLoadingProducts:\n return [event.error] as ExtractedArgs<T>;\n\n case PaywallEventId.DidPerformAction:\n if (handlerName === 'onUrlPress' || handlerName === 'onCustomAction') {\n return [event.action.value ?? ''] as ExtractedArgs<T>;\n }\n return [] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFinishWebPaymentNavigation:\n return [event.product, event.error] as unknown as ExtractedArgs<T>;\n\n case PaywallEventId.DidAppear:\n case PaywallEventId.DidDisappear:\n case PaywallEventId.DidStartRestore:\n return [] as ExtractedArgs<T>;\n }\n}\n"]}
1
+ {"version":3,"file":"paywall-view-emitter.js","sourceRoot":"","sources":["../../../src/ui-builder/paywall-view-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAA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AAqB,CAAC;QAE3C,KAAK,cAAc,CAAC,gBAAgB;YAClC,IAAI,WAAW,KAAK,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBACrE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAqB,CAAC;YACvE,CAAC;YACD,IAAI,WAAW,KAAK,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACvE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAqB,CAAC;YAClD,CAAC;YACD,OAAO,EAAsB,CAAC;QAEhC,KAAK,cAAc,CAAC,6BAA6B;YAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAgC,CAAC;QAErE,KAAK,cAAc,CAAC,SAAS,CAAC;QAC9B,KAAK,cAAc,CAAC,YAAY,CAAC;QACjC,KAAK,cAAc,CAAC,eAAe;YACjC,OAAO,EAAsB,CAAC;IAClC,CAAC;AACH,CAAC","sourcesContent":["import { parsePaywallEvent } from '../coders/parse-paywall';\nimport type { LogContext } from '../logger';\nimport { PaywallEventId } from '../types/paywall-events';\nimport type { ParsedPaywallEvent, PaywallEventIdType } from '../types/paywall-events';\n\nimport { BaseViewEmitter } from './base-view-emitter';\nimport type { EventHandlers } from './types';\n\ntype EventName = keyof EventHandlers;\n\n/**\n * PaywallViewEmitter manages event handlers for paywall view events.\n * Each event type can have only one handler - new handlers replace existing ones.\n */\nexport class PaywallViewEmitter extends BaseViewEmitter<EventHandlers, ParsedPaywallEvent, PaywallEventIdType> {\n protected parseEventData(rawEventData: string, ctx: LogContext): ParsedPaywallEvent {\n const result = parsePaywallEvent(rawEventData, ctx);\n if (!result) {\n throw new Error('Failed to parse paywall event');\n }\n return result;\n }\n\n protected getNativeEventForHandler(event: keyof EventHandlers): PaywallEventIdType | null {\n return HANDLER_TO_NATIVE_EVENT[event as EventName];\n }\n\n protected getHandlerForNativeEvent(\n nativeEvent: PaywallEventIdType,\n eventData: ParsedPaywallEvent,\n ): keyof EventHandlers | null {\n const resolver = NATIVE_EVENT_RESOLVER[nativeEvent];\n if (!resolver) {\n return null;\n }\n return resolver(eventData) as keyof EventHandlers | null;\n }\n\n protected extractCallbackArgs(handlerName: keyof EventHandlers, eventData: ParsedPaywallEvent): unknown[] {\n return extractCallbackArgs(handlerName as EventName, eventData);\n }\n\n protected getEventViewId(eventData: ParsedPaywallEvent): string | null {\n return eventData?.view?.id ?? null;\n }\n\n protected getEmitterName(): string {\n return 'PaywallViewEmitter';\n }\n}\n\nconst NATIVE_EVENT_RESOLVER: Record<PaywallEventIdType, (event: ParsedPaywallEvent) => EventName | null> = {\n [PaywallEventId.DidPerformAction]: (event) => {\n if (event.id !== PaywallEventId.DidPerformAction) {\n return null;\n }\n\n const actionMap: Record<string, EventName> = {\n close: 'onCloseButtonPress',\n system_back: 'onAndroidSystemBack',\n open_url: 'onUrlPress',\n custom: 'onCustomAction',\n };\n\n return actionMap[event.action.type] ?? null;\n },\n [PaywallEventId.DidAppear]: () => 'onAppeared',\n [PaywallEventId.DidDisappear]: () => 'onDisappeared',\n [PaywallEventId.DidSelectProduct]: () => 'onProductSelected',\n [PaywallEventId.DidStartPurchase]: () => 'onPurchaseStarted',\n [PaywallEventId.DidFinishPurchase]: () => 'onPurchaseCompleted',\n [PaywallEventId.DidFailPurchase]: () => 'onPurchaseFailed',\n [PaywallEventId.DidStartRestore]: () => 'onRestoreStarted',\n [PaywallEventId.DidFinishRestore]: () => 'onRestoreCompleted',\n [PaywallEventId.DidFailRestore]: () => 'onRestoreFailed',\n [PaywallEventId.DidFailRendering]: () => 'onRenderingFailed',\n [PaywallEventId.DidFailLoadingProducts]: () => 'onLoadingProductsFailed',\n [PaywallEventId.DidFinishWebPaymentNavigation]: () => 'onWebPaymentNavigationFinished',\n};\n\nconst HANDLER_TO_NATIVE_EVENT: Record<EventName, PaywallEventIdType> = {\n onCloseButtonPress: PaywallEventId.DidPerformAction,\n onAndroidSystemBack: PaywallEventId.DidPerformAction,\n onUrlPress: PaywallEventId.DidPerformAction,\n onCustomAction: PaywallEventId.DidPerformAction,\n onProductSelected: PaywallEventId.DidSelectProduct,\n onPurchaseStarted: PaywallEventId.DidStartPurchase,\n onPurchaseCompleted: PaywallEventId.DidFinishPurchase,\n onPurchaseFailed: PaywallEventId.DidFailPurchase,\n onRestoreStarted: PaywallEventId.DidStartRestore,\n onRestoreCompleted: PaywallEventId.DidFinishRestore,\n onRestoreFailed: PaywallEventId.DidFailRestore,\n onAppeared: PaywallEventId.DidAppear,\n onDisappeared: PaywallEventId.DidDisappear,\n onRenderingFailed: PaywallEventId.DidFailRendering,\n onLoadingProductsFailed: PaywallEventId.DidFailLoadingProducts,\n onWebPaymentNavigationFinished: PaywallEventId.DidFinishWebPaymentNavigation,\n};\n\ntype ExtractedArgs<T extends keyof EventHandlers> = Parameters<EventHandlers[T]>;\n\nfunction extractCallbackArgs<T extends keyof EventHandlers>(\n handlerName: T,\n event: ParsedPaywallEvent,\n): ExtractedArgs<T> {\n switch (event.id) {\n case PaywallEventId.DidSelectProduct:\n return [event.productId] as ExtractedArgs<T>;\n\n case PaywallEventId.DidStartPurchase:\n return [event.product] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFinishPurchase:\n return [event.purchaseResult, event.product] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFailPurchase:\n return [event.error, event.product] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFinishRestore:\n return [event.profile] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFailRestore:\n case PaywallEventId.DidFailRendering:\n case PaywallEventId.DidFailLoadingProducts:\n return [event.error] as ExtractedArgs<T>;\n\n case PaywallEventId.DidPerformAction:\n if (handlerName === 'onUrlPress' && event.action.type === 'open_url') {\n return [event.action.value, event.action.openIn] as ExtractedArgs<T>;\n }\n if (handlerName === 'onCustomAction' && event.action.type === 'custom') {\n return [event.action.value] as ExtractedArgs<T>;\n }\n return [] as ExtractedArgs<T>;\n\n case PaywallEventId.DidFinishWebPaymentNavigation:\n return [event.product, event.error] as unknown as ExtractedArgs<T>;\n\n case PaywallEventId.DidAppear:\n case PaywallEventId.DidDisappear:\n case PaywallEventId.DidStartRestore:\n return [] as ExtractedArgs<T>;\n }\n}\n"]}
@@ -100,12 +100,21 @@ export interface EventHandlers {
100
100
  */
101
101
  onAndroidSystemBack: () => EventHandlerResult;
102
102
  /**
103
- * Called when a user taps an URL in the paywall view
103
+ * Called when a user taps an URL in the paywall view.
104
104
  *
105
105
  * If you return `true`, the paywall view will be closed.
106
106
  * @default false
107
+ *
108
+ * The default onUrlPress handler does not support `browser_in_app`.
109
+ * To support it, install an in-app browser plugin (e.g. `@capacitor/inappbrowser`)
110
+ * and handle the `openIn` argument in your own custom onUrlPress handler.
111
+ *
112
+ * @param url - URL to open
113
+ * @param openIn - How the URL was configured to open in the dashboard:
114
+ * `'browser_in_app'` — in-app browser
115
+ * `'browser_out_app'` — external/system browser
107
116
  */
108
- onUrlPress: (url: string) => EventHandlerResult;
117
+ onUrlPress: (url: string, openIn: WebPresentation) => EventHandlerResult;
109
118
  /**
110
119
  * Called when a user performs a custom action in the paywall view
111
120
  *
@@ -5,7 +5,10 @@ import { Log } from '../logger';
5
5
  export const DEFAULT_EVENT_HANDLERS = {
6
6
  onCloseButtonPress: () => true,
7
7
  onAndroidSystemBack: () => true,
8
- onUrlPress: (url) => {
8
+ onUrlPress: (url, openIn) => {
9
+ if (openIn === 'browser_in_app') {
10
+ Log.warn('onUrlPress', () => 'open_in=browser_in_app is not supported by the default onUrlPress handler. Override onUrlPress to support an in-app browser.');
11
+ }
9
12
  if (typeof window !== 'undefined') {
10
13
  try {
11
14
  window.open(new URL(url), '_blank');
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ui-builder/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GA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AM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACvB,CAAC,CAAC;AA8EH,MAAM,CAAC,MAAM,iCAAiC,GAAqC;IACjF,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;CACpB,CAAC","sourcesContent":["import type { AdaptyError } from '@adapty/core';\n\nimport { Log } from '../logger';\nimport type {\n AdaptyPaywallProduct,\n AdaptyProductIdentifier,\n AdaptyProfile,\n AdaptyPurchaseResult,\n WebPresentation,\n} from '../types';\nimport type { FileLocation, MakePurchaseParamsInput } from '../types/inputs';\n\n/**\n * @internal\n */\nexport type ArgType<T> = T extends () => any ? void : T extends (arg: infer U) => any ? U : void;\n\n/**\n * EventHandler callback should not return a promise,\n * because using `await` may postpone closing a paywall view.\n *\n * We don't want to block the UI thread.\n */\nexport type EventHandlerResult = boolean | void;\n\n/**\n * Purchase parameters keyed by AdaptyProductIdentifier objects\n */\nexport type ProductPurchaseParams = {\n productId: AdaptyProductIdentifier;\n params: MakePurchaseParamsInput;\n}[];\n\nexport type AdaptyCustomAsset =\n | AdaptyCustomImageAsset\n | AdaptyCustomVideoAsset\n | AdaptyCustomColorAsset\n | AdaptyCustomGradientAsset;\n\nexport type AdaptyCustomImageAsset =\n | { type: 'image'; base64: string }\n | { type: 'image'; relativeAssetPath: string } // shorthand: uses same path for both iOS fileName and Android relativeAssetPath\n | { type: 'image'; fileLocation: FileLocation }; // full control for platform-specific paths\n\nexport type AdaptyCustomVideoAsset =\n | { type: 'video'; relativeAssetPath: string } // shorthand: uses same path for both iOS fileName and Android relativeAssetPath\n | { type: 'video'; fileLocation: FileLocation }; // full control for platform-specific paths\n\nexport type AdaptyCustomColorAsset =\n | { type: 'color'; argb: number /* e.g. 0xFFFF0000 (opaque red) */ }\n | { type: 'color'; rgb: number /* e.g. 0xFF0000 (red) */ }\n | { type: 'color'; rgba: number /* e.g. 0xFF0000FF (opaque red) */ };\n\nexport type AdaptyCustomGradientAsset = {\n type: 'linear-gradient';\n values: ({ p: number; argb: number } | { p: number; rgb: number } | { p: number; rgba: number })[];\n points?: { x0?: number; y0?: number; x1?: number; y1?: number };\n};\n\nexport type AdaptyUiOnboardingMeta = {\n onboardingId: string;\n screenClientId: string;\n screenIndex: number;\n totalScreens: number;\n};\n\nexport type AdaptyUiOnboardingStateParams = {\n id: string;\n value: string;\n label: string;\n};\n\n/**\n * Paywall event handlers configuration\n *\n * @see {@link https://adapty.io/docs/capacitor-handling-events | [DOC] Handling View Events}\n */\nexport interface EventHandlers {\n /**\n * Called when a user taps the close button on the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n */\n onCloseButtonPress: () => EventHandlerResult;\n /**\n * Called when a user navigates back on Android\n *\n * If you return `true`, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n */\n onAndroidSystemBack: () => EventHandlerResult;\n /**\n * Called when a user taps an URL in the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onUrlPress: (url: string) => EventHandlerResult;\n /**\n * Called when a user performs a custom action in the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onCustomAction: (actionId: string) => EventHandlerResult;\n /**\n * Called when a user selects a product in the paywall view\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onProductSelected: (productId: string) => EventHandlerResult;\n /**\n * Called when a purchase process starts\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onPurchaseStarted: (product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called when the purchase succeeds, the user cancels their purchase, or the purchase appears to be pending\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * We strongly recommend returning `purchaseResult.type !== 'user_cancelled'` in this case.\n * @default `purchaseResult.type !== 'user_cancelled'`\n *\n * @param purchaseResult - object, which provides details about the purchase.\n * If the result is `'success'`, it also includes the updated user's profile.\n */\n onPurchaseCompleted: (purchaseResult: AdaptyPurchaseResult, product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called if a purchase fails after a user taps the purchase button\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onPurchaseFailed: (error: AdaptyError, product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called when a user taps the restore button in the paywall view\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onRestoreStarted: () => EventHandlerResult;\n /**\n * Called when a purchase is completed\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n *\n * @param profile - updated user profile\n */\n onRestoreCompleted: (profile: AdaptyProfile) => EventHandlerResult;\n /**\n * Called if a restore fails after a user taps the restore button\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onRestoreFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called when the paywall view appears\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onAppeared: () => EventHandlerResult;\n /**\n * Called when the paywall view disappears\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onDisappeared: () => EventHandlerResult;\n /**\n * Called if a paywall view fails to render.\n * This should not ever happen, but if it does, feel free to report it to us.\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default true\n *\n * @param error - AdaptyError object with error code and message\n */\n onRenderingFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called if a product list fails to load on a presented view,\n * for example, if there is no internet connection\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onLoadingProductsFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called when web payment navigation finishes\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onWebPaymentNavigationFinished: (product?: AdaptyPaywallProduct, error?: AdaptyError) => EventHandlerResult;\n}\n\n/**\n * Default event handlers that provide standard closing behavior\n */\nexport const DEFAULT_EVENT_HANDLERS: EventHandlers = {\n onCloseButtonPress: () => true,\n onAndroidSystemBack: () => true,\n onUrlPress: (url: string) => {\n if (typeof window !== 'undefined') {\n try {\n window.open(new URL(url), '_blank');\n } catch {\n Log.warn('onUrlPress', () => `Invalid URL: ${url}`);\n }\n }\n return false;\n },\n onCustomAction: () => false,\n onProductSelected: () => false,\n onPurchaseStarted: () => false,\n onPurchaseCompleted: (purchaseResult: AdaptyPurchaseResult) => purchaseResult?.type !== 'user_cancelled',\n onPurchaseFailed: () => false,\n onRestoreStarted: () => false,\n onRestoreCompleted: () => true,\n onRestoreFailed: () => false,\n onAppeared: () => false,\n onDisappeared: () => false,\n onRenderingFailed: () => true,\n onLoadingProductsFailed: () => false,\n onWebPaymentNavigationFinished: () => false,\n};\n\nexport type OnboardingStateUpdatedAction =\n | {\n elementId: string;\n elementType: 'select';\n value: AdaptyUiOnboardingStateParams;\n }\n | {\n elementId: string;\n elementType: 'multi_select';\n value: AdaptyUiOnboardingStateParams[];\n }\n | {\n elementId: string;\n elementType: 'input';\n value: { type: 'text' | 'email'; value: string } | { type: 'number'; value: number };\n }\n | {\n elementId: string;\n elementType: 'date_picker';\n value: {\n day?: number;\n month?: number;\n year?: number;\n };\n };\n\nexport interface AdaptyUiView {\n id: string;\n}\n\nexport interface AdaptyUiMediaCache {\n memoryStorageTotalCostLimit?: number;\n memoryStorageCountLimit?: number;\n diskStorageSizeLimit?: number;\n}\n\nexport interface AdaptyUiDialogConfig {\n /**\n * The action title to display as part of the dialog. If you provide two actions,\n * be sure `primaryAction` cancels the operation and leaves things unchanged.\n */\n primaryActionTitle: string;\n /**\n * The secondary action title to display as part of the dialog.\n */\n secondaryActionTitle?: string;\n /**\n * The title of the dialog.\n */\n title?: string;\n /**\n * Descriptive text that provides additional details about the reason for the dialog.\n */\n content?: string;\n}\n\nexport const AdaptyUiDialogActionType = Object.freeze({\n primary: 'primary',\n secondary: 'secondary',\n});\n\nexport type AdaptyUiDialogActionType = (typeof AdaptyUiDialogActionType)[keyof typeof AdaptyUiDialogActionType];\n\n/**\n * Additional options for creating a paywall view\n *\n * @see {@link https://adapty.io/docs/capacitor-present-paywalls | [DOC] Creating Paywall View}\n */\nexport interface CreatePaywallViewParamsInput {\n /**\n * `true` if you want to prefetch products before presenting a paywall view.\n */\n prefetchProducts?: boolean;\n /**\n * This value limits the timeout (in milliseconds) for this method.\n */\n loadTimeoutMs?: number;\n /**\n * If you are going to use custom tags functionality, pass an object with tags and corresponding replacement values\n *\n * ```\n * {\n * 'USERNAME': 'Bruce',\n * 'CITY': 'Philadelphia'\n * }\n * ```\n */\n customTags?: Record<string, string>;\n /**\n * If you are going to use custom timer functionality, pass an object with timer ids and corresponding dates the timers should end at\n */\n customTimers?: Record<string, Date>;\n /**\n * Use this when you need to override paywall assets with your own\n */\n customAssets?: Record<string, AdaptyCustomAsset>;\n /**\n * Provide per-product purchase parameters keyed by Adapty product identifier\n */\n productPurchaseParams?: ProductPurchaseParams;\n}\n\n/**\n * Additional options for creating an onboarding view\n *\n * @see {@link https://adapty.io/docs/capacitor-get-onboardings | [DOC] Creating Onboarding View}\n */\nexport interface CreateOnboardingViewParamsInput {\n /**\n * If you want to change the presentation behavior of external URLs, pass a preferred value.\n *\n * @default {@link WebPresentation.BrowserInApp}\n */\n externalUrlsPresentation?: WebPresentation;\n}\n\nexport interface OnboardingEventHandlers {\n onClose: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onCustom: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onPaywall: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onStateUpdated: (action: OnboardingStateUpdatedAction, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onFinishedLoading: (meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onAnalytics: (\n event: {\n name: string;\n /**\n * @deprecated Use `elementId` instead\n */\n element_id?: string;\n elementId?: string;\n reply?: string;\n },\n meta: AdaptyUiOnboardingMeta,\n ) => EventHandlerResult;\n onError: (error: AdaptyError) => EventHandlerResult;\n}\n\nexport const DEFAULT_ONBOARDING_EVENT_HANDLERS: Partial<OnboardingEventHandlers> = {\n onClose: () => true,\n};\n\n/**\n * iOS presentation style for paywall and onboarding views\n * @platform ios\n */\nexport type AdaptyIOSPresentationStyle = 'full_screen' | 'page_sheet';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ui-builder/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AA0NhC;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC/B,UAAU,EAAE,CAAC,GAAW,EAAE,MAAuB,EAAE,EAAE;QACnD,IAAI,MAAM,KAAK,gBAAgB,EAAE,CAAC;YAChC,GAAG,CAAC,IAAI,CACN,YAAY,EACZ,GAAG,EAAE,CACH,8HAA8H,CACjI,CAAC;QACJ,CAAC;QACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC;gBACH,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC;YACtC,CAAC;YAAC,WAAM,CAAC;gBACP,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK;IAC3B,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC9B,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC9B,mBAAmB,EAAE,CAAC,cAAoC,EAAE,EAAE,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,MAAK,gBAAgB;IACxG,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC7B,gBAAgB,EAAE,GAAG,EAAE,CAAC,KAAK;IAC7B,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC9B,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK;IAC5B,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;IACvB,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;IAC1B,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI;IAC7B,uBAAuB,EAAE,GAAG,EAAE,CAAC,KAAK;IACpC,8BAA8B,EAAE,GAAG,EAAE,CAAC,KAAK;CAC5C,CAAC;AA0DF,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACvB,CAAC,CAAC;AA8EH,MAAM,CAAC,MAAM,iCAAiC,GAAqC;IACjF,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;CACpB,CAAC","sourcesContent":["import type { AdaptyError } from '@adapty/core';\n\nimport { Log } from '../logger';\nimport type {\n AdaptyPaywallProduct,\n AdaptyProductIdentifier,\n AdaptyProfile,\n AdaptyPurchaseResult,\n WebPresentation,\n} from '../types';\nimport type { FileLocation, MakePurchaseParamsInput } from '../types/inputs';\n\n/**\n * @internal\n */\nexport type ArgType<T> = T extends () => any ? void : T extends (arg: infer U) => any ? U : void;\n\n/**\n * EventHandler callback should not return a promise,\n * because using `await` may postpone closing a paywall view.\n *\n * We don't want to block the UI thread.\n */\nexport type EventHandlerResult = boolean | void;\n\n/**\n * Purchase parameters keyed by AdaptyProductIdentifier objects\n */\nexport type ProductPurchaseParams = {\n productId: AdaptyProductIdentifier;\n params: MakePurchaseParamsInput;\n}[];\n\nexport type AdaptyCustomAsset =\n | AdaptyCustomImageAsset\n | AdaptyCustomVideoAsset\n | AdaptyCustomColorAsset\n | AdaptyCustomGradientAsset;\n\nexport type AdaptyCustomImageAsset =\n | { type: 'image'; base64: string }\n | { type: 'image'; relativeAssetPath: string } // shorthand: uses same path for both iOS fileName and Android relativeAssetPath\n | { type: 'image'; fileLocation: FileLocation }; // full control for platform-specific paths\n\nexport type AdaptyCustomVideoAsset =\n | { type: 'video'; relativeAssetPath: string } // shorthand: uses same path for both iOS fileName and Android relativeAssetPath\n | { type: 'video'; fileLocation: FileLocation }; // full control for platform-specific paths\n\nexport type AdaptyCustomColorAsset =\n | { type: 'color'; argb: number /* e.g. 0xFFFF0000 (opaque red) */ }\n | { type: 'color'; rgb: number /* e.g. 0xFF0000 (red) */ }\n | { type: 'color'; rgba: number /* e.g. 0xFF0000FF (opaque red) */ };\n\nexport type AdaptyCustomGradientAsset = {\n type: 'linear-gradient';\n values: ({ p: number; argb: number } | { p: number; rgb: number } | { p: number; rgba: number })[];\n points?: { x0?: number; y0?: number; x1?: number; y1?: number };\n};\n\nexport type AdaptyUiOnboardingMeta = {\n onboardingId: string;\n screenClientId: string;\n screenIndex: number;\n totalScreens: number;\n};\n\nexport type AdaptyUiOnboardingStateParams = {\n id: string;\n value: string;\n label: string;\n};\n\n/**\n * Paywall event handlers configuration\n *\n * @see {@link https://adapty.io/docs/capacitor-handling-events | [DOC] Handling View Events}\n */\nexport interface EventHandlers {\n /**\n * Called when a user taps the close button on the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n */\n onCloseButtonPress: () => EventHandlerResult;\n /**\n * Called when a user navigates back on Android\n *\n * If you return `true`, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n */\n onAndroidSystemBack: () => EventHandlerResult;\n /**\n * Called when a user taps an URL in the paywall view.\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n *\n * The default onUrlPress handler does not support `browser_in_app`.\n * To support it, install an in-app browser plugin (e.g. `@capacitor/inappbrowser`)\n * and handle the `openIn` argument in your own custom onUrlPress handler.\n *\n * @param url - URL to open\n * @param openIn - How the URL was configured to open in the dashboard:\n * `'browser_in_app'` — in-app browser\n * `'browser_out_app'` — external/system browser\n */\n onUrlPress: (url: string, openIn: WebPresentation) => EventHandlerResult;\n /**\n * Called when a user performs a custom action in the paywall view\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onCustomAction: (actionId: string) => EventHandlerResult;\n /**\n * Called when a user selects a product in the paywall view\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onProductSelected: (productId: string) => EventHandlerResult;\n /**\n * Called when a purchase process starts\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onPurchaseStarted: (product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called when the purchase succeeds, the user cancels their purchase, or the purchase appears to be pending\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * We strongly recommend returning `purchaseResult.type !== 'user_cancelled'` in this case.\n * @default `purchaseResult.type !== 'user_cancelled'`\n *\n * @param purchaseResult - object, which provides details about the purchase.\n * If the result is `'success'`, it also includes the updated user's profile.\n */\n onPurchaseCompleted: (purchaseResult: AdaptyPurchaseResult, product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called if a purchase fails after a user taps the purchase button\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onPurchaseFailed: (error: AdaptyError, product: AdaptyPaywallProduct) => EventHandlerResult;\n /**\n * Called when a user taps the restore button in the paywall view\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n */\n onRestoreStarted: () => EventHandlerResult;\n /**\n * Called when a purchase is completed\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * We strongly recommend to return `true` in this case.\n * @default true\n *\n * @param profile - updated user profile\n */\n onRestoreCompleted: (profile: AdaptyProfile) => EventHandlerResult;\n /**\n * Called if a restore fails after a user taps the restore button\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onRestoreFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called when the paywall view appears\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onAppeared: () => EventHandlerResult;\n /**\n * Called when the paywall view disappears\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onDisappeared: () => EventHandlerResult;\n /**\n * Called if a paywall view fails to render.\n * This should not ever happen, but if it does, feel free to report it to us.\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default true\n *\n * @param error - AdaptyError object with error code and message\n */\n onRenderingFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called if a product list fails to load on a presented view,\n * for example, if there is no internet connection\n *\n * If you return `true` from this callback, the paywall view will be closed.\n * @default false\n *\n * @param error - AdaptyError object with error code and message\n */\n onLoadingProductsFailed: (error: AdaptyError) => EventHandlerResult;\n /**\n * Called when web payment navigation finishes\n *\n * If you return `true`, the paywall view will be closed.\n * @default false\n */\n onWebPaymentNavigationFinished: (product?: AdaptyPaywallProduct, error?: AdaptyError) => EventHandlerResult;\n}\n\n/**\n * Default event handlers that provide standard closing behavior\n */\nexport const DEFAULT_EVENT_HANDLERS: EventHandlers = {\n onCloseButtonPress: () => true,\n onAndroidSystemBack: () => true,\n onUrlPress: (url: string, openIn: WebPresentation) => {\n if (openIn === 'browser_in_app') {\n Log.warn(\n 'onUrlPress',\n () =>\n 'open_in=browser_in_app is not supported by the default onUrlPress handler. Override onUrlPress to support an in-app browser.',\n );\n }\n if (typeof window !== 'undefined') {\n try {\n window.open(new URL(url), '_blank');\n } catch {\n Log.warn('onUrlPress', () => `Invalid URL: ${url}`);\n }\n }\n return false;\n },\n onCustomAction: () => false,\n onProductSelected: () => false,\n onPurchaseStarted: () => false,\n onPurchaseCompleted: (purchaseResult: AdaptyPurchaseResult) => purchaseResult?.type !== 'user_cancelled',\n onPurchaseFailed: () => false,\n onRestoreStarted: () => false,\n onRestoreCompleted: () => true,\n onRestoreFailed: () => false,\n onAppeared: () => false,\n onDisappeared: () => false,\n onRenderingFailed: () => true,\n onLoadingProductsFailed: () => false,\n onWebPaymentNavigationFinished: () => false,\n};\n\nexport type OnboardingStateUpdatedAction =\n | {\n elementId: string;\n elementType: 'select';\n value: AdaptyUiOnboardingStateParams;\n }\n | {\n elementId: string;\n elementType: 'multi_select';\n value: AdaptyUiOnboardingStateParams[];\n }\n | {\n elementId: string;\n elementType: 'input';\n value: { type: 'text' | 'email'; value: string } | { type: 'number'; value: number };\n }\n | {\n elementId: string;\n elementType: 'date_picker';\n value: {\n day?: number;\n month?: number;\n year?: number;\n };\n };\n\nexport interface AdaptyUiView {\n id: string;\n}\n\nexport interface AdaptyUiMediaCache {\n memoryStorageTotalCostLimit?: number;\n memoryStorageCountLimit?: number;\n diskStorageSizeLimit?: number;\n}\n\nexport interface AdaptyUiDialogConfig {\n /**\n * The action title to display as part of the dialog. If you provide two actions,\n * be sure `primaryAction` cancels the operation and leaves things unchanged.\n */\n primaryActionTitle: string;\n /**\n * The secondary action title to display as part of the dialog.\n */\n secondaryActionTitle?: string;\n /**\n * The title of the dialog.\n */\n title?: string;\n /**\n * Descriptive text that provides additional details about the reason for the dialog.\n */\n content?: string;\n}\n\nexport const AdaptyUiDialogActionType = Object.freeze({\n primary: 'primary',\n secondary: 'secondary',\n});\n\nexport type AdaptyUiDialogActionType = (typeof AdaptyUiDialogActionType)[keyof typeof AdaptyUiDialogActionType];\n\n/**\n * Additional options for creating a paywall view\n *\n * @see {@link https://adapty.io/docs/capacitor-present-paywalls | [DOC] Creating Paywall View}\n */\nexport interface CreatePaywallViewParamsInput {\n /**\n * `true` if you want to prefetch products before presenting a paywall view.\n */\n prefetchProducts?: boolean;\n /**\n * This value limits the timeout (in milliseconds) for this method.\n */\n loadTimeoutMs?: number;\n /**\n * If you are going to use custom tags functionality, pass an object with tags and corresponding replacement values\n *\n * ```\n * {\n * 'USERNAME': 'Bruce',\n * 'CITY': 'Philadelphia'\n * }\n * ```\n */\n customTags?: Record<string, string>;\n /**\n * If you are going to use custom timer functionality, pass an object with timer ids and corresponding dates the timers should end at\n */\n customTimers?: Record<string, Date>;\n /**\n * Use this when you need to override paywall assets with your own\n */\n customAssets?: Record<string, AdaptyCustomAsset>;\n /**\n * Provide per-product purchase parameters keyed by Adapty product identifier\n */\n productPurchaseParams?: ProductPurchaseParams;\n}\n\n/**\n * Additional options for creating an onboarding view\n *\n * @see {@link https://adapty.io/docs/capacitor-get-onboardings | [DOC] Creating Onboarding View}\n */\nexport interface CreateOnboardingViewParamsInput {\n /**\n * If you want to change the presentation behavior of external URLs, pass a preferred value.\n *\n * @default {@link WebPresentation.BrowserInApp}\n */\n externalUrlsPresentation?: WebPresentation;\n}\n\nexport interface OnboardingEventHandlers {\n onClose: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onCustom: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onPaywall: (actionId: string, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onStateUpdated: (action: OnboardingStateUpdatedAction, meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onFinishedLoading: (meta: AdaptyUiOnboardingMeta) => EventHandlerResult;\n onAnalytics: (\n event: {\n name: string;\n /**\n * @deprecated Use `elementId` instead\n */\n element_id?: string;\n elementId?: string;\n reply?: string;\n },\n meta: AdaptyUiOnboardingMeta,\n ) => EventHandlerResult;\n onError: (error: AdaptyError) => EventHandlerResult;\n}\n\nexport const DEFAULT_ONBOARDING_EVENT_HANDLERS: Partial<OnboardingEventHandlers> = {\n onClose: () => true,\n};\n\n/**\n * iOS presentation style for paywall and onboarding views\n * @platform ios\n */\nexport type AdaptyIOSPresentationStyle = 'full_screen' | 'page_sheet';\n"]}
@@ -1,2 +1,2 @@
1
- declare const _default: "3.16.3";
1
+ declare const _default: "3.17.1";
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- export default '3.16.3';
1
+ export default '3.17.1';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAe,QAAQ,CAAC","sourcesContent":["export default '3.16.3';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAe,QAAQ,CAAC","sourcesContent":["export default '3.17.1';\n"]}
@@ -1731,6 +1731,11 @@ var AdaptyProfileCoder = class extends SimpleCoder {
1731
1731
  type: "object",
1732
1732
  converter: new HashmapCoder(new AdaptyAccessLevelCoder())
1733
1733
  },
1734
+ appliedAttributionSources: {
1735
+ key: "applied_attribution_sources",
1736
+ required: false,
1737
+ type: "array"
1738
+ },
1734
1739
  customAttributes: {
1735
1740
  key: "custom_attributes",
1736
1741
  required: false,
@@ -2593,10 +2598,7 @@ function parsePaywallEvent$1(factory, input, ctx) {
2593
2598
  return {
2594
2599
  id: eventId,
2595
2600
  view,
2596
- action: {
2597
- type: actionObj["type"],
2598
- value: actionObj["value"]
2599
- }
2601
+ action: parsePaywallUserAction(actionObj)
2600
2602
  };
2601
2603
  }
2602
2604
  case PaywallEventId.DidSelectProduct: return {
@@ -2674,6 +2676,22 @@ function parsePaywallEvent$1(factory, input, ctx) {
2674
2676
  default: return null;
2675
2677
  }
2676
2678
  }
2679
+ function parsePaywallUserAction(actionObj) {
2680
+ const type = actionObj["type"];
2681
+ switch (type) {
2682
+ case "open_url": return {
2683
+ type,
2684
+ value: actionObj["value"],
2685
+ openIn: actionObj["open_in"]
2686
+ };
2687
+ case "custom": return {
2688
+ type,
2689
+ value: actionObj["value"]
2690
+ };
2691
+ case "close":
2692
+ case "system_back": return { type };
2693
+ }
2694
+ }
2677
2695
  function getPaywallCoder(factory, type, _ctx) {
2678
2696
  switch (type) {
2679
2697
  case "product": return factory.createPaywallProductCoder();
@@ -2866,7 +2884,7 @@ const AdaptyCapacitorPlugin = core.registerPlugin('AdaptyCapacitorPlugin', {
2866
2884
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.AdaptyCapacitorPluginWeb()),
2867
2885
  });
2868
2886
 
2869
- var VERSION = '3.16.3';
2887
+ var VERSION = '3.17.1';
2870
2888
 
2871
2889
  /**
2872
2890
  * Capacitor implementation of IPlatformAdapter
@@ -4591,7 +4609,6 @@ const HANDLER_TO_NATIVE_EVENT$1 = {
4591
4609
  onWebPaymentNavigationFinished: PaywallEventId.DidFinishWebPaymentNavigation,
4592
4610
  };
4593
4611
  function extractCallbackArgs$1(handlerName, event) {
4594
- var _a;
4595
4612
  switch (event.id) {
4596
4613
  case PaywallEventId.DidSelectProduct:
4597
4614
  return [event.productId];
@@ -4608,8 +4625,11 @@ function extractCallbackArgs$1(handlerName, event) {
4608
4625
  case PaywallEventId.DidFailLoadingProducts:
4609
4626
  return [event.error];
4610
4627
  case PaywallEventId.DidPerformAction:
4611
- if (handlerName === 'onUrlPress' || handlerName === 'onCustomAction') {
4612
- return [(_a = event.action.value) !== null && _a !== void 0 ? _a : ''];
4628
+ if (handlerName === 'onUrlPress' && event.action.type === 'open_url') {
4629
+ return [event.action.value, event.action.openIn];
4630
+ }
4631
+ if (handlerName === 'onCustomAction' && event.action.type === 'custom') {
4632
+ return [event.action.value];
4613
4633
  }
4614
4634
  return [];
4615
4635
  case PaywallEventId.DidFinishWebPaymentNavigation:
@@ -4627,7 +4647,10 @@ function extractCallbackArgs$1(handlerName, event) {
4627
4647
  const DEFAULT_EVENT_HANDLERS = {
4628
4648
  onCloseButtonPress: () => true,
4629
4649
  onAndroidSystemBack: () => true,
4630
- onUrlPress: (url) => {
4650
+ onUrlPress: (url, openIn) => {
4651
+ if (openIn === 'browser_in_app') {
4652
+ Log.warn('onUrlPress', () => 'open_in=browser_in_app is not supported by the default onUrlPress handler. Override onUrlPress to support an in-app browser.');
4653
+ }
4631
4654
  if (typeof window !== 'undefined') {
4632
4655
  try {
4633
4656
  window.open(new URL(url), '_blank');